xwayland: use get_pointer_device() for enter/leave handling too
In Weston, clicking the window decoration of an Xwayland client gives us a
wl_pointer.button event immediately followed by a wl_pointer.leave event.
The leave event does not contain any button state information, so the button
remains logically down in the DIX.
Once the pointer button is released, a wl_pointer.enter event is sent with
the current button state (zero). This needs to trigger a ButtonRelease event
but for that we need to ensure that the device is the same as the one we send
ButtonPress events through.
Fixes a regression introduced in a4095162ca.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
Reviewed-by: Olivier Fourdan <ofourdan@redhat.com>
			
			
This commit is contained in:
		
							parent
							
								
									dee2bb033e
								
							
						
					
					
						commit
						20c78f38a0
					
				| 
						 | 
					@ -92,6 +92,15 @@ xwl_pointer_control(DeviceIntPtr device, PtrCtrl *ctrl)
 | 
				
			||||||
    /* Nothing to do, dix handles all settings */
 | 
					    /* Nothing to do, dix handles all settings */
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					static DeviceIntPtr
 | 
				
			||||||
 | 
					get_pointer_device(struct xwl_seat *xwl_seat)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    if (xwl_seat->relative_pointer)
 | 
				
			||||||
 | 
					        return xwl_seat->relative_pointer;
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					        return xwl_seat->pointer;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static Bool
 | 
					static Bool
 | 
				
			||||||
init_pointer_buttons(DeviceIntPtr device)
 | 
					init_pointer_buttons(DeviceIntPtr device)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
| 
						 | 
					@ -400,7 +409,7 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer,
 | 
				
			||||||
                     wl_fixed_t sx_w, wl_fixed_t sy_w)
 | 
					                     wl_fixed_t sx_w, wl_fixed_t sy_w)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    struct xwl_seat *xwl_seat = data;
 | 
					    struct xwl_seat *xwl_seat = data;
 | 
				
			||||||
    DeviceIntPtr dev = xwl_seat->pointer;
 | 
					    DeviceIntPtr dev = get_pointer_device(xwl_seat);
 | 
				
			||||||
    DeviceIntPtr master;
 | 
					    DeviceIntPtr master;
 | 
				
			||||||
    int i;
 | 
					    int i;
 | 
				
			||||||
    int sx = wl_fixed_to_int(sx_w);
 | 
					    int sx = wl_fixed_to_int(sx_w);
 | 
				
			||||||
| 
						 | 
					@ -475,7 +484,7 @@ pointer_handle_leave(void *data, struct wl_pointer *pointer,
 | 
				
			||||||
                     uint32_t serial, struct wl_surface *surface)
 | 
					                     uint32_t serial, struct wl_surface *surface)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    struct xwl_seat *xwl_seat = data;
 | 
					    struct xwl_seat *xwl_seat = data;
 | 
				
			||||||
    DeviceIntPtr dev = xwl_seat->pointer;
 | 
					    DeviceIntPtr dev = get_pointer_device(xwl_seat);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    xwl_seat->xwl_screen->serial = serial;
 | 
					    xwl_seat->xwl_screen->serial = serial;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -595,15 +604,6 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer,
 | 
				
			||||||
        dispatch_pointer_motion_event(xwl_seat);
 | 
					        dispatch_pointer_motion_event(xwl_seat);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
static DeviceIntPtr
 | 
					 | 
				
			||||||
get_pointer_device(struct xwl_seat *xwl_seat)
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    if (xwl_seat->relative_pointer)
 | 
					 | 
				
			||||||
        return xwl_seat->relative_pointer;
 | 
					 | 
				
			||||||
    else
 | 
					 | 
				
			||||||
        return xwl_seat->pointer;
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
static void
 | 
					static void
 | 
				
			||||||
pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial,
 | 
					pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial,
 | 
				
			||||||
                      uint32_t time, uint32_t button, uint32_t state)
 | 
					                      uint32_t time, uint32_t button, uint32_t state)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue