Author: alink
Date: Fri Apr 6 05:17:58 2007
New Revision: 16617
URL: http://svn.gna.org/viewcvs/wesnoth?rev=16617&view=rev
Log:
* Before start the dragging, check also the current mouse position
instead of trusting the calling parameters.
* Remove an now unused data from the header
Modified:
trunk/src/mouse_events.cpp
trunk/src/mouse_events.hpp
Modified: trunk/src/mouse_events.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mouse_events.cpp?rev=16617&r1=16616&r2=16617&view=diff
==============================================================================
--- trunk/src/mouse_events.cpp (original)
+++ trunk/src/mouse_events.cpp Fri Apr 6 05:17:58 2007
@@ -723,11 +723,14 @@
const gamemap::location new_hex =
(*gui_).hex_clicked_on(x,y,&nearest_hex,&second_nearest_hex);
// Fire the drag & drop only after minimal drag distance
- // or when we quit the initial hex.
- const int drag_distance = maximum<int>(abs(drag_from_x_- x),
abs(drag_from_y_- y));
- if (dragging_ && !dragging_started_ && drag_distance > 10 &&
(SDL_GetMouseState(NULL,NULL) & SDL_BUTTON(1) != 0)) {
- dragging_started_ = true;
- cursor::set_dragging(true);
+ // While we check the mouse buttons state, we also grab fresh position
data.
+ int mx,my;
+ if (dragging_ && !dragging_started_ && (SDL_GetMouseState(&mx,&my) &
SDL_BUTTON(1) != 0)) {
+ const int drag_distance = maximum<int>(abs(drag_from_x_- mx),
abs(drag_from_y_- my));
+ if (drag_distance > 10) {
+ dragging_started_ = true;
+ cursor::set_dragging(true);
+ }
}
if(new_hex != last_hex_ || nearest_hex != last_nearest_ ||
second_nearest_hex != last_second_nearest_) {
Modified: trunk/src/mouse_events.hpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mouse_events.hpp?rev=16617&r1=16616&r2=16617&view=diff
==============================================================================
--- trunk/src/mouse_events.hpp (original)
+++ trunk/src/mouse_events.hpp Fri Apr 6 05:17:58 2007
@@ -91,7 +91,6 @@
undo_list& redo_stack_;
bool minimap_scrolling_;
- bool update_cursor_;
bool dragging_;
bool dragging_started_;
int drag_from_x_;
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits