Author: ilor
Date: Thu Jul 10 13:09:48 2008
New Revision: 27888
URL: http://svn.gna.org/viewcvs/wesnoth?rev=27888&view=rev
Log:
only use the fake event when the mouse button is released. This doesn't appear
to change windows behaviour, but might help on X
Modified:
trunk/src/controller_base.cpp
Modified: trunk/src/controller_base.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/controller_base.cpp?rev=27888&r1=27887&r2=27888&view=diff
==============================================================================
--- trunk/src/controller_base.cpp (original)
+++ trunk/src/controller_base.cpp Thu Jul 10 13:09:48 2008
@@ -79,16 +79,18 @@
//simulate mouse button up when the app has
lost mouse focus
//this should be a general fix for the issue
when the mouse
//is dragged out of the game window and then
the button is released
- SDL_Event e;
- e.type = SDL_MOUSEBUTTONUP;
- e.button.state = SDL_RELEASED;
- e.button.button = SDL_BUTTON_LEFT;
int x, y;
- SDL_GetMouseState(&x, &y);
- e.button.x = x;
- e.button.y = y;
-
get_mouse_handler_base().mouse_press(event.button, browse_);
- post_mouse_press(event);
+ Uint8 mouse_flags = SDL_GetMouseState(&x, &y);
+ if ((mouse_flags & SDL_BUTTON_LEFT) == 0) {
+ SDL_Event e;
+ e.type = SDL_MOUSEBUTTONUP;
+ e.button.state = SDL_RELEASED;
+ e.button.button = SDL_BUTTON_LEFT;
+ e.button.x = x;
+ e.button.y = y;
+
get_mouse_handler_base().mouse_press(event.button, browse_);
+ post_mouse_press(event);
+ }
}
}
break;
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits