mail[Wesnoth-commits] r33255 - in /trunk/src: mouse_events.cpp mouse_events.hpp 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 01, 2009 - 18:58:
Author: alink
Date: Sun Mar  1 18:58:38 2009
New Revision: 33255

URL: http://svn.gna.org/viewcvs/wesnoth?rev=33255&view=rev
Log:
Quick fix for restoring a 15px threshold for drag&drop (instead of 0)
This fix unwanted double-click (causing double select event and reset goto)
ilor: the editor continue to use 0, but I don't know where test it.

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

Modified: trunk/src/mouse_events.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mouse_events.cpp?rev=33255&r1=33254&r2=33255&view=diff
==============================================================================
--- trunk/src/mouse_events.cpp (original)
+++ trunk/src/mouse_events.cpp Sun Mar  1 18:58:38 2009
@@ -31,11 +31,6 @@
 
 namespace events{
 
-
-namespace{
-       //minimum dragging distance to fire the drag&drop
-       const double drag_threshold = 14.0;
-}
 
 mouse_handler::mouse_handler(game_display* gui, std::vector<team>& teams,
                unit_map& units, gamemap& map, gamestatus& status,
@@ -77,6 +72,11 @@
        team_num_ = team_number;
 }
 
+int mouse_handler::drag_threshold() const
+{
+       return 14;
+}
+
 void mouse_handler::mouse_motion(int x, int y, const bool browse, bool 
update)
 {
        if (attackmove_) return;

Modified: trunk/src/mouse_events.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mouse_events.hpp?rev=33255&r1=33254&r2=33255&view=diff
==============================================================================
--- trunk/src/mouse_events.hpp (original)
+++ trunk/src/mouse_events.hpp Sun Mar  1 18:58:38 2009
@@ -69,6 +69,7 @@
        const team& viewing_team() const { return 
teams_[gui().viewing_team()]; }
        team& current_team() { return teams_[team_num_-1]; }
 
+       int drag_threshold() const;
        /**
         * Use update to force an update of the mouse state.
         */

Modified: trunk/src/mouse_handler_base.cpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mouse_handler_base.cpp?rev=33255&r1=33254&r2=33255&view=diff
==============================================================================
--- trunk/src/mouse_handler_base.cpp (original)
+++ trunk/src/mouse_handler_base.cpp Sun Mar  1 18:58:38 2009
@@ -33,8 +33,6 @@
 }
 
 int commands_disabled= 0;
-
-const int mouse_handler_base::drag_threshold_ = 0;
 
 static bool command_active()
 {
@@ -110,7 +108,7 @@
                if ((dragging_left_ && (SDL_GetMouseState(&mx,&my) & 
SDL_BUTTON_LEFT) != 0)
                || (dragging_right_ && (SDL_GetMouseState(&mx,&my) & 
SDL_BUTTON_RIGHT) != 0)) {
                        const double drag_distance = std::pow((double) 
(drag_from_x_- mx), 2) + std::pow((double) (drag_from_y_- my), 2);
-                       if (drag_distance > drag_threshold_*drag_threshold_) {
+                       if (drag_distance > 
drag_threshold()*drag_threshold()) {
                                dragging_started_ = true;
                                cursor::set_dragging(true);
                        }

Modified: trunk/src/mouse_handler_base.hpp
URL: 
http://svn.gna.org/viewcvs/wesnoth/trunk/src/mouse_handler_base.hpp?rev=33255&r1=33254&r2=33255&view=diff
==============================================================================
--- trunk/src/mouse_handler_base.hpp (original)
+++ trunk/src/mouse_handler_base.hpp Sun Mar  1 18:58:38 2009
@@ -50,6 +50,9 @@
         * @return true when the class in the "dragging" state.
         */
        bool is_dragging() const;
+
+       //minimum dragging distance to fire the drag&drop
+       virtual int drag_threshold() const {return 0;};
 
        void mouse_motion_event(const SDL_MouseMotionEvent& event, const bool 
browse);
 
@@ -156,8 +159,6 @@
 
        /** Show context menu flag */
        bool show_menu_;
-
-       static const int drag_threshold_;
 };
 
 } // end namespace events




Related Messages


Powered by MHonArc, Updated Sun Mar 01 19:20:05 2009