wayland: Store the device that does a grab for a window on the window
This allows us to get the device if we need to make the window a popup. This relies on the side effect that GTK calls into GDK to take a grab before the popup window is shown.
This commit is contained in:
		| @ -243,6 +243,15 @@ gdk_device_core_grab (GdkDevice    *device, | ||||
|  | ||||
|       wayland_device->pointer_grab_window = window; | ||||
|       wayland_device->pointer_grab_time = time_; | ||||
|  | ||||
|       /* FIXME: This probably breaks if you end up with multiple grabs on the | ||||
|        * same window - but we need to know the input device for when we are | ||||
|        * asked to map a popup window so that the grab can be managed by the | ||||
|        * compositor. | ||||
|        */ | ||||
|       _gdk_wayland_window_set_device_grabbed (window, | ||||
|                                               wayland_device->device, | ||||
|                                               time_); | ||||
|     } | ||||
|  | ||||
|   return GDK_GRAB_SUCCESS; | ||||
| @ -252,6 +261,7 @@ static void | ||||
| gdk_device_core_ungrab (GdkDevice *device, | ||||
|                         guint32    time_) | ||||
| { | ||||
|   GdkWaylandDevice *wayland_device = GDK_DEVICE_CORE (device)->device; | ||||
|   GdkDisplay *display; | ||||
|   GdkDeviceGrabInfo *grab; | ||||
|  | ||||
| @ -268,6 +278,10 @@ gdk_device_core_ungrab (GdkDevice *device, | ||||
|  | ||||
|       if (grab) | ||||
|         grab->serial_end = grab->serial_start; | ||||
|  | ||||
|       _gdk_wayland_window_set_device_grabbed (wayland_device->pointer_grab_window, | ||||
|                                               NULL, | ||||
|                                               0); | ||||
|     } | ||||
| } | ||||
|  | ||||
|  | ||||
| @ -146,4 +146,8 @@ void _gdk_wayland_display_manager_add_display (GdkDisplayManager *manager, | ||||
| void _gdk_wayland_display_manager_remove_display (GdkDisplayManager *manager, | ||||
| 						  GdkDisplay        *display); | ||||
|  | ||||
| void _gdk_wayland_window_set_device_grabbed (GdkWindow *window, | ||||
|                                              struct wl_input_device *input_device, | ||||
|                                              guint32 time_); | ||||
|  | ||||
| #endif /* __GDK_PRIVATE_WAYLAND_H__ */ | ||||
|  | ||||
| @ -119,6 +119,9 @@ struct _GdkWindowImplWayland | ||||
|  | ||||
|   GdkGeometry geometry_hints; | ||||
|   GdkWindowHints geometry_mask; | ||||
|  | ||||
|   struct wl_input_device *grab_input_device; | ||||
|   guint32 grab_time; | ||||
| }; | ||||
|  | ||||
| struct _GdkWindowImplWaylandClass | ||||
| @ -1477,3 +1480,15 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass) | ||||
|   impl_class->change_property = gdk_wayland_window_change_property; | ||||
|   impl_class->delete_property = gdk_wayland_window_delete_property; | ||||
| } | ||||
|  | ||||
|  | ||||
| void | ||||
| _gdk_wayland_window_set_device_grabbed (GdkWindow              *window, | ||||
|                                         struct wl_input_device *input_device, | ||||
|                                         guint32                 time_) | ||||
| { | ||||
|   GdkWindowImplWayland *impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); | ||||
|  | ||||
|   impl->grab_input_device = input_device; | ||||
|   impl->grab_time = time_; | ||||
| } | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 Rob Bradford
					Rob Bradford