XQuartz: Send MotionNotify before button presses when X11 is in the background
(cherry picked from commit c80d0ec18ef5b842447d31360406d0b5b9424222)
This commit is contained in:
		
							parent
							
								
									5ccfad8df0
								
							
						
					
					
						commit
						e86f4e9302
					
				| 
						 | 
					@ -1054,8 +1054,7 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
 | 
				
			||||||
                 * NSTabletProximityEventSubtype will come from NSTabletPoint
 | 
					                 * NSTabletProximityEventSubtype will come from NSTabletPoint
 | 
				
			||||||
                 * rather than NSMouseMoved.
 | 
					                 * rather than NSMouseMoved.
 | 
				
			||||||
                pressure = [e pressure];
 | 
					                pressure = [e pressure];
 | 
				
			||||||
                tilt_x   = [e tilt].x;
 | 
					                tilt     = [e tilt];
 | 
				
			||||||
                tilt_y   = [e tilt].y;
 | 
					 | 
				
			||||||
                pDev = darwinTabletCurrent;                
 | 
					                pDev = darwinTabletCurrent;                
 | 
				
			||||||
                 */
 | 
					                 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1071,6 +1070,7 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if(!quartzServerVisible && noTestExtensions) {
 | 
					            if(!quartzServerVisible && noTestExtensions) {
 | 
				
			||||||
 | 
					                if(ev_button == 0) {
 | 
				
			||||||
#if 0
 | 
					#if 0
 | 
				
			||||||
/* Seems this has somehow triggered 100% CPU usage while X11.app is in the
 | 
					/* Seems this has somehow triggered 100% CPU usage while X11.app is in the
 | 
				
			||||||
 * background on some obscure HW configurations.
 | 
					 * background on some obscure HW configurations.
 | 
				
			||||||
| 
						 | 
					@ -1078,26 +1078,27 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
//#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;
 | 
					                    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)
 | 
				
			||||||
                 */
 | 
					                     */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                wid = 0;
 | 
					                    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 && wid == 0)
 | 
				
			||||||
                    bgMouseLocation = location;
 | 
					 | 
				
			||||||
                    return;
 | 
					 | 
				
			||||||
                }
 | 
					 | 
				
			||||||
#else
 | 
					 | 
				
			||||||
                bgMouseLocation = location;
 | 
					 | 
				
			||||||
                return;
 | 
					 | 
				
			||||||
#endif
 | 
					#endif
 | 
				
			||||||
 | 
					                    {
 | 
				
			||||||
 | 
					                        bgMouseLocation = location;
 | 
				
			||||||
 | 
					                        return;
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                } else {
 | 
				
			||||||
 | 
					                    DarwinSendPointerEvents(pDev, MotionNotify, 0, location.x,
 | 
				
			||||||
 | 
					                                            location.y, pressure, tilt.x, tilt.y);
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            DarwinSendPointerEvents(pDev, ev_type, ev_button, location.x, location.y,
 | 
					            DarwinSendPointerEvents(pDev, ev_type, ev_button, location.x, location.y,
 | 
				
			||||||
| 
						 | 
					@ -1125,6 +1126,16 @@ static inline int ensure_flag(int flags, int device_independent, int device_depe
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
            
 | 
					            
 | 
				
			||||||
		case NSScrollWheel:
 | 
							case NSScrollWheel:
 | 
				
			||||||
 | 
					//#if !defined(XPLUGIN_VERSION) || XPLUGIN_VERSION == 0
 | 
				
			||||||
 | 
					#if 1 /* Strange 100% CPU issue, so always enabling.  see above */
 | 
				
			||||||
 | 
					            /* If we're in the background, we need to send a MotionNotify event
 | 
				
			||||||
 | 
					             * first, since we aren't getting them on background mouse motion
 | 
				
			||||||
 | 
					             */
 | 
				
			||||||
 | 
					            if(!quartzServerVisible && noTestExtensions) {
 | 
				
			||||||
 | 
					                DarwinSendPointerEvents(darwinPointer, MotionNotify, 0, location.x,
 | 
				
			||||||
 | 
					                                        location.y, pressure, tilt.x, tilt.y);
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					#endif
 | 
				
			||||||
			DarwinSendScrollEvents([e deltaX], [e deltaY], location.x, location.y,
 | 
								DarwinSendScrollEvents([e deltaX], [e deltaY], location.x, location.y,
 | 
				
			||||||
                                   pressure, tilt.x, tilt.y);
 | 
					                                   pressure, tilt.x, tilt.y);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue