diff options
author | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2009-04-11 19:06:45 -0700 |
---|---|---|
committer | Jeremy Huddleston <jeremyhu@freedesktop.org> | 2009-04-22 19:30:18 -0700 |
commit | a362d0f4fb79150f7b8e0eb3d1dc1cdee2f98d95 (patch) | |
tree | a7f7f9501188f2ee0c2b28bacbb884f624818cbb | |
parent | 8dc8812c226222fc64f8e489f9f123687a95d3d1 (diff) |
XQuartz: Make sure the bgMouseLocationUpdated state is consistent
(cherry picked from commit 8fa8a8e1db60c8ac60d10f1f15517471d2291f77)
-rw-r--r-- | hw/xquartz/X11Application.m | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/hw/xquartz/X11Application.m b/hw/xquartz/X11Application.m index 0445b8e29..b31634de0 100644 --- a/hw/xquartz/X11Application.m +++ b/hw/xquartz/X11Application.m @@ -191,8 +191,10 @@ static void message_kit_thread (SEL selector, NSObject *arg) { size_t i; DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active) if (state) { - if(bgMouseLocationUpdated) + if(bgMouseLocationUpdated) { DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, bgMouseLocation.x, bgMouseLocation.y, 0.0, 0.0, 0.0); + bgMouseLocationUpdated = FALSE; + } DarwinSendDDXEvent(kXquartzActivate, 0); if (!_x_active) { @@ -1064,32 +1066,34 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe } if(!quartzServerVisible && noTestExtensions) { - if(ev_button == 0) { #if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION > 0 /* Older libXplugin (Tiger/"Stock" Leopard) aren't thread safe, so we can't call xp_find_window from the Appkit thread */ - xp_window_id wid = 0; - xp_error e; + xp_window_id wid = 0; + xp_error e; - /* Sigh. Need to check that we're really over one of - * our windows. (We need to receive pointer events while - * not in the foreground, but we don't want to receive them - * when another window is over us or we might show a tooltip) - */ + /* Sigh. Need to check that we're really over one of + * our windows. (We need to receive pointer events while + * not in the foreground, but we don't want to receive them + * when another window is over us or we might show a tooltip) + */ - e = xp_find_window(location.x, location.y, 0, &wid); + e = xp_find_window(location.x, location.y, 0, &wid); - if (e == XP_Success && wid == 0) + if (e != XP_Success || (e == XP_Success && wid == 0)) #endif - { - bgMouseLocation = location; - bgMouseLocationUpdated = TRUE; - return; - } - } else { - bgMouseLocationUpdated = FALSE; + { + bgMouseLocation = location; + bgMouseLocationUpdated = TRUE; + return; + } + } + + if(bgMouseLocationUpdated) { + if(!(ev_type == MotionNotify && ev_button == 0)) { DarwinSendPointerEvents(pDev, MotionNotify, 0, location.x, location.y, pressure, tilt.x, tilt.y); } + bgMouseLocationUpdated = FALSE; } DarwinSendPointerEvents(pDev, ev_type, ev_button, location.x, location.y, @@ -1122,6 +1126,7 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe * first, since we aren't getting them on background mouse motion */ if(!quartzServerVisible && noTestExtensions) { + bgMouseLocationUpdated = FALSE; DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, location.x, location.y, pressure, tilt.x, tilt.y); } |