]> git.mxchange.org Git - simgear.git/commitdiff
Canvas: set button for drag events.
authorThomas Geymayer <tomgey@gmail.com>
Fri, 14 Mar 2014 23:40:48 +0000 (00:40 +0100)
committerThomas Geymayer <tomgey@gmail.com>
Fri, 14 Mar 2014 23:40:48 +0000 (00:40 +0100)
simgear/canvas/CanvasEventManager.cxx
simgear/canvas/CanvasEventManager.hxx

index bac9d76995097614b7493b4d017c1c6cdc90f6e9..0033ec62fae35849a03d38df9c01a2f4b966b112 100644 (file)
@@ -63,6 +63,7 @@ namespace canvas
 
   //----------------------------------------------------------------------------
   EventManager::EventManager():
+    _last_button_down(0),
     _current_click_count(0)
   {
 
@@ -77,6 +78,7 @@ namespace canvas
     {
       case Event::MOUSE_DOWN:
         _last_mouse_down = StampedPropagationPath(path, event->getTime());
+        _last_button_down = event->button;
         break;
       case Event::MOUSE_UP:
       {
@@ -106,7 +108,11 @@ namespace canvas
         if( !_last_mouse_down.valid() )
           return false;
         else
+        {
+          // OSG does not set button for drag events.
+          event->button = _last_button_down;
           return propagateEvent(event, _last_mouse_down.path);
+        }
       case Event::MOUSE_MOVE:
         handled |= handleMove(event, path);
         break;
index efdd0b560ddf395c844acff6e861ca1f46d6f377..3455f5f8084f6aadeac0395ff1370c0eb9b43cea 100644 (file)
@@ -65,6 +65,7 @@ namespace canvas
       StampedPropagationPath _last_mouse_down,
                              _last_click,
                              _last_mouse_over;
+      int    _last_button_down;
       size_t _current_click_count;
 
       /**