[gtk+] wayland: Add get_monitor_at_window to Wayland backend
- From: Olivier Fourdan <ofourdan src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] wayland: Add get_monitor_at_window to Wayland backend
- Date: Wed, 18 May 2016 17:08:18 +0000 (UTC)
commit b03784eb979bb8c7fee317f1ddeeed67c35eb63e
Author: Olivier Fourdan <ofourdan redhat com>
Date: Tue May 17 15:04:23 2016 +0200
wayland: Add get_monitor_at_window to Wayland backend
Given that Wayland has no global coordinate, the only way for gdk to
retrieve the monitor a window last entered is to retrieve it from the
GdkWaylandWindow itself.
Implement the backend specific get_monitor_at_window() to return the
monitor that was last entered by the window.
https://bugzilla.gnome.org/show_bug.cgi?id=766566
gdk/wayland/gdkdisplay-wayland.c | 27 +++++++++++++++++++++++++++
1 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c
index 7b54c77..c541a6a 100644
--- a/gdk/wayland/gdkdisplay-wayland.c
+++ b/gdk/wayland/gdkdisplay-wayland.c
@@ -37,6 +37,7 @@
#include "gdkkeysprivate.h"
#include "gdkprivate-wayland.h"
#include "gdkglcontext-wayland.h"
+#include "gdkwaylandmonitor.h"
#include "pointer-gestures-unstable-v1-client-protocol.h"
#include "tablet-unstable-v1-client-protocol.h"
@@ -840,6 +841,31 @@ gdk_wayland_display_get_monitor (GdkDisplay *display,
return (GdkMonitor *)display_wayland->monitors->pdata[monitor_num];
}
+static GdkMonitor *
+gdk_wayland_display_get_monitor_at_window (GdkDisplay *display,
+ GdkWindow *window)
+{
+ GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (display);
+ struct wl_output *output;
+ int i;
+
+ g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL);
+
+ output = gdk_wayland_window_get_wl_output (window);
+ if (output == NULL)
+ return NULL;
+
+ for (i = 0; i < display_wayland->monitors->len; i++)
+ {
+ GdkMonitor *monitor = display_wayland->monitors->pdata[i];
+
+ if (gdk_wayland_monitor_get_wl_output (monitor) == output)
+ return monitor;
+ }
+
+ return NULL;
+}
+
static void
gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
{
@@ -894,6 +920,7 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class)
display_class->get_n_monitors = gdk_wayland_display_get_n_monitors;
display_class->get_monitor = gdk_wayland_display_get_monitor;
+ display_class->get_monitor_at_window = gdk_wayland_display_get_monitor_at_window;
}
static void
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]