Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorperepujal <perepujal>2011-05-15 16:05:21 (GMT)
committer perepujal <perepujal>2011-05-15 16:05:21 (GMT)
commit9e9f2db8f51a790be98b0fa3ae8d61f6c9eb9dcc (patch)
tree76916ecf92684cbad388b53910318ff254137dd4
parentf4783657eb60326da1b7afffd4e9e161cfe5a1c4 (diff)
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.
-rw-r--r--src/tuxpaint.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/tuxpaint.c b/src/tuxpaint.c
index bf4bb8c..fb5767b 100644
--- a/src/tuxpaint.c
+++ b/src/tuxpaint.c
@@ -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);