mail[Wesnoth-commits] r33513 - in /trunk/src: mouse_handler_base.cpp mouse_handler_base.hpp


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by alinktomine on March 10, 2009 - 08:41:
Author: alink
Date: Tue Mar 10 08:41:50 2009
New Revision: 33513

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33513&view=rev
Log:
Fix a problem when trying to attack with a double-click(?),
the following clicks were doubled and so the attack dialog (when canceled)

Modified:
    trunk/src/mouse_handler_base.cpp
    trunk/src/mouse_handler_base.hpp

Modified: trunk/src/mouse_handler_base.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mouse_handler_base.cpp?rev=33513&r1=33512&r2=33513&view=diff
==============================================================================
--- trunk/src/mouse_handler_base.cpp (original)
+++ trunk/src/mouse_handler_base.cpp Tue Mar 10 08:41:50 2009
@@ -129,7 +129,7 @@
 
        if (is_left_click(event)) {
                if (event.state == SDL_PRESSED) {
-                       clear_dragging(event, browse);
+                       cancel_dragging();
                        init_dragging(dragging_left_);
                        left_click(event.x, event.y, browse);
                } else if (event.state == SDL_RELEASED) {
@@ -139,7 +139,7 @@
                }
        } else if (is_right_click(event)) {
                if (event.state == SDL_PRESSED) {
-                       clear_dragging(event, browse);
+                       cancel_dragging();
                        init_dragging(dragging_right_);
                        right_click(event.x, event.y, browse);
                } else if (event.state == SDL_RELEASED) {
@@ -274,6 +274,14 @@
        drag_from_hex_ = gui().hex_clicked_on(drag_from_x_, drag_from_y_);
 }
 
+void mouse_handler_base::cancel_dragging()
+{
+       dragging_started_ = false;
+       dragging_left_ = false;
+       dragging_right_ = false;
+       cursor::set_dragging(false);
+}
+
 void mouse_handler_base::clear_dragging(const SDL_MouseButtonEvent& event, 
bool browse)
 {
        // we reset dragging info before calling functions

Modified: trunk/src/mouse_handler_base.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mouse_handler_base.hpp?rev=33513&r1=33512&r2=33513&view=diff
==============================================================================
--- trunk/src/mouse_handler_base.hpp (original)
+++ trunk/src/mouse_handler_base.hpp Tue Mar 10 08:41:50 2009
@@ -134,6 +134,7 @@
        virtual void right_mouse_up(int x, int y, const bool browse);
 
 protected:
+       void cancel_dragging();
        void clear_dragging(const SDL_MouseButtonEvent& event, bool browse);
        void init_dragging(bool& dragging_flag);
 




Related Messages


Powered by MHonArc, Updated Tue Mar 10 09:20:33 2009