XQuartz: Make sure the bgMouseLocationUpdated state is consistent

(cherry picked from commit 8fa8a8e1db60c8ac60d10f1f15517471d2291f77)
This commit is contained in:
Jeremy Huddleston 2009-04-11 19:06:45 -07:00
parent 8dc8812c22
commit a362d0f4fb

View File

@ -191,8 +191,10 @@ static void message_kit_thread (SEL selector, NSObject *arg) {
size_t i; size_t i;
DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active) DEBUG_LOG("state=%d, _x_active=%d, \n", state, _x_active)
if (state) { if (state) {
if(bgMouseLocationUpdated) if(bgMouseLocationUpdated) {
DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, bgMouseLocation.x, bgMouseLocation.y, 0.0, 0.0, 0.0); DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, bgMouseLocation.x, bgMouseLocation.y, 0.0, 0.0, 0.0);
bgMouseLocationUpdated = FALSE;
}
DarwinSendDDXEvent(kXquartzActivate, 0); DarwinSendDDXEvent(kXquartzActivate, 0);
if (!_x_active) { if (!_x_active) {
@ -1064,32 +1066,34 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
} }
if(!quartzServerVisible && noTestExtensions) { if(!quartzServerVisible && noTestExtensions) {
if(ev_button == 0) {
#if defined(XPLUGIN_VERSION) && XPLUGIN_VERSION > 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 */ /* 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_window_id wid = 0;
xp_error e; xp_error e;
/* Sigh. Need to check that we're really over one of /* Sigh. Need to check that we're really over one of
* our windows. (We need to receive pointer events while * our windows. (We need to receive pointer events while
* not in the foreground, but we don't want to receive them * not in the foreground, but we don't want to receive them
* when another window is over us or we might show a tooltip) * 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 #endif
{ {
bgMouseLocation = location; bgMouseLocation = location;
bgMouseLocationUpdated = TRUE; bgMouseLocationUpdated = TRUE;
return; return;
} }
} else { }
bgMouseLocationUpdated = FALSE;
if(bgMouseLocationUpdated) {
if(!(ev_type == MotionNotify && ev_button == 0)) {
DarwinSendPointerEvents(pDev, MotionNotify, 0, location.x, DarwinSendPointerEvents(pDev, MotionNotify, 0, location.x,
location.y, pressure, tilt.x, tilt.y); location.y, pressure, tilt.x, tilt.y);
} }
bgMouseLocationUpdated = FALSE;
} }
DarwinSendPointerEvents(pDev, ev_type, ev_button, location.x, location.y, 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 * first, since we aren't getting them on background mouse motion
*/ */
if(!quartzServerVisible && noTestExtensions) { if(!quartzServerVisible && noTestExtensions) {
bgMouseLocationUpdated = FALSE;
DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, location.x, DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, location.x,
location.y, pressure, tilt.x, tilt.y); location.y, pressure, tilt.x, tilt.y);
} }