summaryrefslogtreecommitdiff
path: root/gdk
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2017-11-28 22:37:42 -0500
committerMatthias Clasen <mclasen@redhat.com>2020-04-13 07:54:31 -0400
commit209398d736cc3a9af79b2f236453079fcc24dff4 (patch)
tree5836afae70861c8ac4a15a96c28ae2fd704b8c27 /gdk
parent3ee18b88b947198a3f86e363be445e5dbb68fbca (diff)
downloadgtk+-209398d736cc3a9af79b2f236453079fcc24dff4.tar.gz
wayland: emit ::enter/leave-monitor
These signals directly mirror the surface_enter/leave events of the Wayland protocol, so this is very staightforward.
Diffstat (limited to 'gdk')
-rw-r--r--gdk/wayland/gdkdisplay-wayland.c7
-rw-r--r--gdk/wayland/gdkprivate-wayland.h2
-rw-r--r--gdk/wayland/gdksurface-wayland.c10
3 files changed, 19 insertions, 0 deletions
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index dc8c52f305..e30acdad1b 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -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)
diff --git a/gdk/wayland/gdkprivate-wayland.h b/gdk/wayland/gdkprivate-wayland.h
index 13dbd221e0..99fa9b5d4b 100644
--- a/gdk/wayland/gdkprivate-wayland.h
+++ b/gdk/wayland/gdkprivate-wayland.h
@@ -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);
diff --git a/gdk/wayland/gdksurface-wayland.c b/gdk/wayland/gdksurface-wayland.c
index 06de4fa500..82fae79e8e 100644
--- a/gdk/wayland/gdksurface-wayland.c
+++ b/gdk/wayland/gdksurface-wayland.c
@@ -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 = {