Adding a switchin when the mouse returns in mouse accessibility mode. Also removing ghost previews for lines and the first step of shapes when the mouse goes out. For the secon step of shapes, I think there is a bug report in sourceforge that must be taked in account.

This commit is contained in:
Pere Pujal i Carabantes 2011-05-15 16:05:21 +00:00
parent 68014a7908
commit 5e3f824301

View file

@ -2109,7 +2109,20 @@ static void mainloop(void)
}
else if (event.type == SDL_ACTIVEEVENT)
{
/* Reset Shapes tool and clean the canvas if we lose focus*/
if (mouseaccessibility && emulate_button_pressed &&
((cur_tool == TOOL_SHAPES && shape_tool_mode != SHAPE_TOOL_MODE_DONE) || cur_tool == TOOL_LINES) &&
event.active.state & SDL_APPINPUTFOCUS|SDL_APPACTIVE &&
event.active.gain == 0)
{
do_undo();
tool_avail[TOOL_REDO] = 0; /* Don't let them 'redo' to get preview back */
draw_toolbar();
update_screen_rect(&r_tools);
shape_tool_mode = SHAPE_TOOL_MODE_DONE;
}
handle_active(&event);
}
else if (event.type == SDL_KEYUP)
{
@ -16526,9 +16539,15 @@ static void handle_active(SDL_Event * event)
}
if (event->active.state & SDL_APPINPUTFOCUS|SDL_APPACTIVE)
{
if (mouseaccessibility && emulate_button_pressed) {
magic_switchout(canvas);
if (event->active.gain == 1)
{
if (mouseaccessibility) {
magic_switchin(canvas);
}
}
else if (mouseaccessibility && emulate_button_pressed) {
magic_switchout(canvas);
}
#ifdef _WIN32
SetActivationState(event->active.gain);