diff options
author | Olivier Fourdan <ofourdan@redhat.com> | 2016-05-17 15:02:01 +0200 |
---|---|---|
committer | Olivier Fourdan <ofourdan@redhat.com> | 2016-05-18 19:07:27 +0200 |
commit | ca77de055baa403f7ebf397772dfb8f13656607d (patch) | |
tree | cd8dabacaff565cbbee62dd8758e6f4b944caab7 | |
parent | d288a134a427e5728d230404c6a56fc9397b45d9 (diff) | |
download | gtk+-ca77de055baa403f7ebf397772dfb8f13656607d.tar.gz |
wayland: Add API to retrieve the Wayland output
In Wayland, surfaces get an enter/leave notification each time they
enter or leave an output.
Add an API to GdkWaylandWindow to retrieve the output the window has
last entered.
https://bugzilla.gnome.org/show_bug.cgi?id=766566
-rw-r--r-- | docs/reference/gdk/gdk3-sections.txt | 1 | ||||
-rw-r--r-- | gdk/wayland/gdkwaylandwindow.h | 3 | ||||
-rw-r--r-- | gdk/wayland/gdkwindow-wayland.c | 26 |
3 files changed, 30 insertions, 0 deletions
diff --git a/docs/reference/gdk/gdk3-sections.txt b/docs/reference/gdk/gdk3-sections.txt index 0ca8d48ddd..6dc208c218 100644 --- a/docs/reference/gdk/gdk3-sections.txt +++ b/docs/reference/gdk/gdk3-sections.txt @@ -1245,6 +1245,7 @@ gdk_wayland_display_get_wl_display gdk_wayland_display_get_xdg_shell gdk_wayland_window_get_wl_surface gdk_wayland_window_set_use_custom_surface +gdk_wayland_window_get_wl_output <SUBSECTION Standard> GDK_TYPE_WAYLAND_DEVICE diff --git a/gdk/wayland/gdkwaylandwindow.h b/gdk/wayland/gdkwaylandwindow.h index 73f1da05ba..fb84d347ed 100644 --- a/gdk/wayland/gdkwaylandwindow.h +++ b/gdk/wayland/gdkwaylandwindow.h @@ -59,6 +59,9 @@ void gdk_wayland_window_set_dbus_properties_libgtk_only (Gdk const char *window_object_path, const char *application_object_path, const char *unique_bus_name); +GDK_AVAILABLE_IN_3_22 +struct wl_output *gdk_wayland_window_get_wl_output (GdkWindow *window); + G_END_DECLS diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c index 3b70318161..64b3cd8457 100644 --- a/gdk/wayland/gdkwindow-wayland.c +++ b/gdk/wayland/gdkwindow-wayland.c @@ -2954,6 +2954,32 @@ gdk_wayland_window_get_wl_surface (GdkWindow *window) return GDK_WINDOW_IMPL_WAYLAND (window->impl)->display_server.wl_surface; } +/** + * gdk_wayland_window_get_wl_output: + * @window: (type GdkWaylandWindow): a #GdkWindow + * + * Returns the Wayland output a #GdkWindow has last entered. + * + * Returns: (transfer none): a Wayland wl_output or NULL if the #GdkWindow + * is not associated with any Wayland wl_output. + * + * Since: 3.22 + */ +struct wl_output * +gdk_wayland_window_get_wl_output (GdkWindow *window) +{ + GdkWindowImplWayland *impl; + + g_return_val_if_fail (GDK_IS_WAYLAND_WINDOW (window), NULL); + + impl = GDK_WINDOW_IMPL_WAYLAND (window->impl); + /* We pick the head of the list as this is the last entered output */ + if (impl->display_server.outputs) + return (struct wl_output *) impl->display_server.outputs->data; + + return NULL; +} + static struct wl_egl_window * gdk_wayland_window_get_wl_egl_window (GdkWindow *window) { |