[gtk+] gdkwindow-x11: Add support for gdk_window_fullscreen_on_monitor



commit b8fc4c246ac6ef5cd7eccd477e2b64ea9efffff6
Author: Rui Matos <tiagomatos gmail com>
Date:   Wed Nov 2 19:00:34 2016 +0100

    gdkwindow-x11: Add support for gdk_window_fullscreen_on_monitor
    
    This way we can recommend that applications use the
    fullscreen_on_monitor() API on both X and Wayland otherwise they'd
    have to keep a path for each backend to achieve this functionality.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=773857

 gdk/x11/gdkwindow-x11.c |   18 ++++++++++++++++++
 1 files changed, 18 insertions(+), 0 deletions(-)
---
diff --git a/gdk/x11/gdkwindow-x11.c b/gdk/x11/gdkwindow-x11.c
index 4c0eddb..9d37eb1 100644
--- a/gdk/x11/gdkwindow-x11.c
+++ b/gdk/x11/gdkwindow-x11.c
@@ -3957,6 +3957,23 @@ gdk_x11_window_fullscreen (GdkWindow *window)
 }
 
 static void
+gdk_x11_window_fullscreen_on_monitor (GdkWindow *window,
+                                      gint       monitor)
+{
+  GdkRectangle monitor_geom;
+
+  if (GDK_WINDOW_DESTROYED (window) ||
+      !WINDOW_IS_TOPLEVEL_OR_FOREIGN (window))
+    return;
+
+  gdk_screen_get_monitor_geometry (GDK_WINDOW_SCREEN (window), monitor, &monitor_geom);
+  gdk_window_move (window, monitor_geom.x, monitor_geom.y);
+
+  gdk_window_set_fullscreen_mode (window, GDK_FULLSCREEN_ON_CURRENT_MONITOR);
+  gdk_x11_window_fullscreen (window);
+}
+
+static void
 gdk_x11_window_unfullscreen (GdkWindow *window)
 {
   if (GDK_WINDOW_DESTROYED (window) ||
@@ -5412,6 +5429,7 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
   impl_class->maximize = gdk_x11_window_maximize;
   impl_class->unmaximize = gdk_x11_window_unmaximize;
   impl_class->fullscreen = gdk_x11_window_fullscreen;
+  impl_class->fullscreen_on_monitor = gdk_x11_window_fullscreen_on_monitor;
   impl_class->apply_fullscreen_mode = gdk_x11_window_apply_fullscreen_mode;
   impl_class->unfullscreen = gdk_x11_window_unfullscreen;
   impl_class->set_keep_above = gdk_x11_window_set_keep_above;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]