fixed scrolling lists with the mousewheel for some X11 windowmanagers.
authorM.G. Kishalmi <lmg@kishalmi.net>
Mon, 9 May 2011 12:46:59 +0000 (12:46 +0000)
committerM.G. Kishalmi <lmg@kishalmi.net>
Mon, 9 May 2011 12:46:59 +0000 (12:46 +0000)
some WMs not only send 'crossing' events when really moving from one
window to another, but also when mousewheeling.
distinguishing those events 'mode' property fixed this.

brecht++ for figuring out the details.

intern/ghost/intern/GHOST_SystemX11.cpp

index 378bc6b90beeb56f068a61d5a48ae495c0ca1602..b44f2b1822507bab2fd46c3d5678718d01d683d6 100644 (file)
@@ -700,19 +700,24 @@ GHOST_SystemX11::processEvent(XEvent *xe)
                case EnterNotify:
                case LeaveNotify:
                {
-                       // XCrossingEvents pointer leave enter window.
-                       // also do cursor move here, MotionNotify only
-                       // happens when motion starts & ends inside window
+                       /* XCrossingEvents pointer leave enter window.
+                          also do cursor move here, MotionNotify only
+                          happens when motion starts & ends inside window.
+                          we only do moves when the crossing mode is 'normal'
+                          (really crossing between windows) since some windowmanagers
+                          also send grab/ungrab crossings for mousewheel events.
+                       */
                        XCrossingEvent &xce = xe->xcrossing;
-                       
-                       g_event = new 
-                       GHOST_EventCursor(
-                               getMilliSeconds(),
-                               GHOST_kEventCursorMove,
-                               window,
-                               xce.x_root,
-                               xce.y_root
-                       );
+                       if( xce.mode == NotifyNormal ) {
+                               g_event = new 
+                               GHOST_EventCursor(
+                                       getMilliSeconds(),
+                                       GHOST_kEventCursorMove,
+                                       window,
+                                       xce.x_root,
+                                       xce.y_root
+                               );
+                       }
                        break;
                }
                case MapNotify: