Fixed issues with 'unclicking' when clicking or hovering some places (thus leaving previews of some Magic tools) when in mouse-accessibility mode.

This commit is contained in:
William Kendrick 2011-05-02 17:58:28 +00:00
parent 20f6c8165d
commit aa488fcf74

View file

@ -3609,6 +3609,8 @@ static void mainloop(void)
WARNING: this must be kept in sync with the mouse-move WARNING: this must be kept in sync with the mouse-move
code (for cursor changes) and mouse-scroll code. */ code (for cursor changes) and mouse-scroll code. */
magic_switchout(canvas);
if (cur_tool == TOOL_BRUSH || cur_tool == TOOL_STAMP || if (cur_tool == TOOL_BRUSH || cur_tool == TOOL_STAMP ||
cur_tool == TOOL_SHAPES || cur_tool == TOOL_LINES || cur_tool == TOOL_SHAPES || cur_tool == TOOL_LINES ||
cur_tool == TOOL_MAGIC || cur_tool == TOOL_TEXT || cur_tool == TOOL_MAGIC || cur_tool == TOOL_TEXT ||
@ -4293,19 +4295,16 @@ static void mainloop(void)
if (do_draw) if (do_draw)
update_screen_rect(&r_toolopt); update_screen_rect(&r_toolopt);
} }
if (mouseaccessibility)
emulate_button_pressed = 0;
} }
else if (HIT(r_colors) && colors_are_selectable) else if (HIT(r_colors) && colors_are_selectable)
{ {
/* Color! */ /* Color! */
whichc = GRIDHIT_GD(r_colors, gd_colors); whichc = GRIDHIT_GD(r_colors, gd_colors);
if (mouseaccessibility)
emulate_button_pressed = 0;
if (valid_click(event.button.button)) if (valid_click(event.button.button))
{ {
magic_switchout(canvas);
if (whichc >= 0 && whichc < NUM_COLORS) if (whichc >= 0 && whichc < NUM_COLORS)
{ {
cur_color = whichc; cur_color = whichc;
@ -4626,9 +4625,6 @@ static void mainloop(void)
else if (HIT(r_sfx) && valid_click(event.button.button)) else if (HIT(r_sfx) && valid_click(event.button.button))
{ {
/* A sound player button on the lower left has been pressed! */ /* A sound player button on the lower left has been pressed! */
if (mouseaccessibility)
emulate_button_pressed = 0;
#ifndef NOSOUND #ifndef NOSOUND
if (cur_tool == TOOL_STAMP && use_sound && !mute) if (cur_tool == TOOL_STAMP && use_sound && !mute)
{ {
@ -4648,6 +4644,8 @@ static void mainloop(void)
Mix_ChannelFinished(NULL); Mix_ChannelFinished(NULL);
Mix_PlayChannel(2, stamp_data[stamp_group][cur_thing]->sdesc, 0); Mix_PlayChannel(2, stamp_data[stamp_group][cur_thing]->sdesc, 0);
} }
magic_switchout(canvas);
} }
#endif #endif
} }
@ -5118,7 +5116,6 @@ static void mainloop(void)
else if (HIT(r_sfx)) else if (HIT(r_sfx))
{ {
/* Sound player buttons: */ /* Sound player buttons: */
emulate_button_pressed = 0;
if (cur_tool == TOOL_STAMP && use_sound && !mute && if (cur_tool == TOOL_STAMP && use_sound && !mute &&
((GRIDHIT_GD(r_sfx, gd_sfx) == 0 && ((GRIDHIT_GD(r_sfx, gd_sfx) == 0 &&
@ -16531,7 +16528,6 @@ static void handle_active(SDL_Event * event)
{ {
if (mouseaccessibility && emulate_button_pressed) { if (mouseaccessibility && emulate_button_pressed) {
magic_switchout(canvas); magic_switchout(canvas);
emulate_button_pressed = 0;
} }
#ifdef _WIN32 #ifdef _WIN32