wayland: emit ::enter/leave-monitor

These signals directly mirror the surface_enter/leave events
of the Wayland protocol, so this is very staightforward.
This commit is contained in:
Matthias Clasen 2017-11-28 22:37:42 -05:00
parent 3ee18b88b9
commit 209398d736
3 changed files with 19 additions and 0 deletions

View File

@ -2539,6 +2539,13 @@ get_monitor_for_output (GdkWaylandDisplay *display_wayland,
return NULL;
}
GdkMonitor *
gdk_wayland_display_get_monitor_for_output (GdkDisplay *display,
struct wl_output *output)
{
return (GdkMonitor *)get_monitor_for_output (GDK_WAYLAND_DISPLAY (display), output);
}
static void
gdk_wayland_display_remove_output (GdkWaylandDisplay *display_wayland,
guint32 id)

View File

@ -163,6 +163,8 @@ guint32 gdk_wayland_display_get_output_scale (GdkWaylandDisplay *display_wayland
struct wl_output *output);
struct wl_output *gdk_wayland_display_get_wl_output (GdkDisplay *display,
int monitor_num);
GdkMonitor *gdk_wayland_display_get_monitor_for_output (GdkDisplay *display,
struct wl_output *output);
void _gdk_wayland_surface_set_grab_seat (GdkSurface *surface,
GdkSeat *seat);

View File

@ -1201,6 +1201,8 @@ surface_enter (void *data,
{
GdkSurface *surface = GDK_SURFACE (data);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkDisplay *display = gdk_surface_get_display (surface);
GdkMonitor *monitor;
GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS,
g_message ("surface enter, surface %p output %p", surface, output));
@ -1208,6 +1210,9 @@ surface_enter (void *data,
impl->display_server.outputs = g_slist_prepend (impl->display_server.outputs, output);
gdk_wayland_surface_update_scale (surface);
monitor = gdk_wayland_display_get_monitor_for_output (display, output);
gdk_surface_enter_monitor (surface, monitor);
}
static void
@ -1217,6 +1222,8 @@ surface_leave (void *data,
{
GdkSurface *surface = GDK_SURFACE (data);
GdkWaylandSurface *impl = GDK_WAYLAND_SURFACE (surface);
GdkDisplay *display = gdk_surface_get_display (surface);
GdkMonitor *monitor;
GDK_DISPLAY_NOTE (gdk_surface_get_display (surface), EVENTS,
g_message ("surface leave, surface %p output %p", surface, output));
@ -1225,6 +1232,9 @@ surface_leave (void *data,
if (impl->display_server.outputs)
gdk_wayland_surface_update_scale (surface);
monitor = gdk_wayland_display_get_monitor_for_output (display, output);
gdk_surface_leave_monitor (surface, monitor);
}
static const struct wl_surface_listener surface_listener = {