Fix #12650: "windows not receiving mouse events in multiple screens context"
* dix/events.c, include/dix.h: (UpdateSpriteForScreen): added this to update the mouse sprite context when we switch from a pScreen to another. * mi/mipointer.c: (miPointerWarpCursor): as we are switching to a new pScreen, don't forget to update the mouse sprite context.
This commit is contained in:
		
							parent
							
								
									dc90d50008
								
							
						
					
					
						commit
						81692b628f
					
				
							
								
								
									
										55
									
								
								dix/events.c
								
								
								
								
							
							
						
						
									
										55
									
								
								dix/events.c
								
								
								
								
							| 
						 | 
				
			
			@ -2352,6 +2352,61 @@ DefineInitialRootWindow(WindowPtr win)
 | 
			
		|||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Update the mouse sprite info when the server switches from a pScreen to another.
 | 
			
		||||
 * Otherwise, the pScreen of the mouse sprite is never updated when we switch
 | 
			
		||||
 * from a pScreen to another. Never updating the pScreen of the mouse sprite
 | 
			
		||||
 * implies that windows that are in pScreen whose pScreen->myNum >0 will never
 | 
			
		||||
 * get pointer events. This is  because in CheckMotion(), sprite.hotPhys.pScreen
 | 
			
		||||
 * always points to the first pScreen it has been set by
 | 
			
		||||
 * DefineInitialRootWindow().
 | 
			
		||||
 *
 | 
			
		||||
 * Calling this function is useful for use cases where the server
 | 
			
		||||
 * has more than one pScreen.
 | 
			
		||||
 * This function is similar to DefineInitialRootWindow() but it does not
 | 
			
		||||
 * reset the mouse pointer position.
 | 
			
		||||
 * @param win must be the new pScreen we are switching to.
 | 
			
		||||
 */
 | 
			
		||||
void
 | 
			
		||||
UpdateSpriteForScreen(ScreenPtr pScreen)
 | 
			
		||||
{
 | 
			
		||||
    WindowPtr win = NULL;
 | 
			
		||||
    if (!pScreen)
 | 
			
		||||
        return ;
 | 
			
		||||
    win = WindowTable[pScreen->myNum];
 | 
			
		||||
 | 
			
		||||
    sprite.hotPhys.pScreen = pScreen;
 | 
			
		||||
    sprite.hot = sprite.hotPhys;
 | 
			
		||||
    sprite.hotLimits.x2 = pScreen->width;
 | 
			
		||||
    sprite.hotLimits.y2 = pScreen->height;
 | 
			
		||||
#ifdef XEVIE
 | 
			
		||||
    xeviewin =
 | 
			
		||||
#endif
 | 
			
		||||
    sprite.win = win;
 | 
			
		||||
    sprite.current = wCursor (win);
 | 
			
		||||
    sprite.current->refcnt++;
 | 
			
		||||
    spriteTraceGood = 1;
 | 
			
		||||
    ROOT = win;
 | 
			
		||||
    (*pScreen->CursorLimits) (pScreen,
 | 
			
		||||
                              sprite.current,
 | 
			
		||||
                              &sprite.hotLimits,
 | 
			
		||||
                              &sprite.physLimits);
 | 
			
		||||
    sprite.confined = FALSE;
 | 
			
		||||
    (*pScreen->ConstrainCursor) (pScreen, &sprite.physLimits);
 | 
			
		||||
    (*pScreen->DisplayCursor) (pScreen, sprite.current);
 | 
			
		||||
 | 
			
		||||
#ifdef PANORAMIX
 | 
			
		||||
    if(!noPanoramiXExtension) {
 | 
			
		||||
        sprite.hotLimits.x1 = -panoramiXdataPtr[0].x;
 | 
			
		||||
        sprite.hotLimits.y1 = -panoramiXdataPtr[0].y;
 | 
			
		||||
        sprite.hotLimits.x2 = PanoramiXPixWidth  - panoramiXdataPtr[0].x;
 | 
			
		||||
        sprite.hotLimits.y2 = PanoramiXPixHeight - panoramiXdataPtr[0].y;
 | 
			
		||||
        sprite.physLimits = sprite.hotLimits;
 | 
			
		||||
        sprite.screen = pScreen;
 | 
			
		||||
    }
 | 
			
		||||
#endif
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * This does not take any shortcuts, and even ignores its argument, since
 | 
			
		||||
 * it does not happen very often, and one has to walk up the tree since
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -415,6 +415,9 @@ extern int DeliverDeviceEvents(
 | 
			
		|||
extern void DefineInitialRootWindow(
 | 
			
		||||
    WindowPtr /* win */);
 | 
			
		||||
 | 
			
		||||
extern void UpdateSpriteForScreen(
 | 
			
		||||
     ScreenPtr /* pScreen */);
 | 
			
		||||
 | 
			
		||||
extern void WindowHasNewCursor(
 | 
			
		||||
    WindowPtr /* pWin */);
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -262,6 +262,7 @@ miPointerWarpCursor (pScreen, x, y)
 | 
			
		|||
	miPointer.y = y;
 | 
			
		||||
	miPointer.pScreen = pScreen;
 | 
			
		||||
    }
 | 
			
		||||
    UpdateSpriteForScreen (pScreen) ;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue