diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2016-05-17 13:09:23 +0200 |
---|---|---|
committer | Olivier Fourdan <ofourdan@redhat.com> | 2016-05-18 19:07:27 +0200 |
commit | d288a134a427e5728d230404c6a56fc9397b45d9 (patch) | |
tree | df9aab5b3614c2e395de16af5f514eebf2d07e82 /gdk/gdkdisplay.c | |
parent | fa9f22eec4fafd9a484864f45e0ac26ba584f0ef (diff) | |
download | gtk+-d288a134a427e5728d230404c6a56fc9397b45d9.tar.gz |
display: Add vfunc for get_monitor_at_window
Some backends (namely Wayland) do not support global coordinates so
using the window position to determine the monitor will always fail on
such backends.
In such cases, the backend itself might be better suited to identify
the monitor a given window resides on.
Add a vfunc get_monitor_at_window() to the display class so that we can
use the backend to retrieve the monitor, if the backend implements it.
https://bugzilla.gnome.org/show_bug.cgi?id=766566
Diffstat (limited to 'gdk/gdkdisplay.c')
-rw-r--r-- | gdk/gdkdisplay.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/gdk/gdkdisplay.c b/gdk/gdkdisplay.c index 5e2fa873eb..9e638dceec 100644 --- a/gdk/gdkdisplay.c +++ b/gdk/gdkdisplay.c @@ -2692,9 +2692,20 @@ gdk_display_get_monitor_at_window (GdkDisplay *display, int n_monitors, i; int area = 0; GdkMonitor *best = NULL; + GdkWindowImplClass *impl_class; + GdkDisplayClass *class; g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); + class = GDK_DISPLAY_GET_CLASS (display); + if (class->get_monitor_at_window) + { + best = class->get_monitor_at_window (display, window); + + if (best) + return best; + } + gdk_window_get_geometry (window, &win.x, &win.y, &win.width, &win.height); gdk_window_get_origin (window, &win.x, &win.y); |