[gtk/present-toplevel-2: 83/178] tests: Stop using gdk_surface_fullscreen



commit 015050fda08210e7e5bb28fac37a828f8421bca5
Author: Matthias Clasen <mclasen redhat com>
Date:   Sun Mar 1 10:10:39 2020 -0800

    tests: Stop using gdk_surface_fullscreen

 tests/testfullscreen.c | 38 ++++++++++++++++++++++++++++++--------
 1 file changed, 30 insertions(+), 8 deletions(-)
---
diff --git a/tests/testfullscreen.c b/tests/testfullscreen.c
index f73a6d608f..e22d190ce5 100644
--- a/tests/testfullscreen.c
+++ b/tests/testfullscreen.c
@@ -22,21 +22,43 @@
 static void
 set_fullscreen_monitor_cb (GtkWidget *widget, gpointer user_data)
 {
-  GdkFullscreenMode mode = (GdkFullscreenMode) GPOINTER_TO_INT (user_data);
-  GdkSurface  *window;
+  GdkFullscreenMode mode = GPOINTER_TO_INT (user_data);
+  GdkDisplay *display;
+  GdkSurface *surface;
+  GdkMonitor *monitor;
+  GdkToplevelLayout *layout;
 
-  window = gtk_native_get_surface (gtk_widget_get_native (widget));
-  gdk_surface_set_fullscreen_mode (window, mode);
-  gdk_surface_fullscreen (window);
+  display = gtk_widget_get_display (widget);
+  surface = gtk_native_get_surface (gtk_widget_get_native (widget));
+  if (mode == GDK_FULLSCREEN_ON_CURRENT_MONITOR)
+    monitor = gdk_display_get_monitor_at_surface (display, surface);
+  else
+    monitor = NULL;
+  layout = gdk_toplevel_layout_new (0, 0);
+  gdk_toplevel_layout_set_resizable (layout, TRUE);
+  gdk_toplevel_layout_set_fullscreen (layout, TRUE, monitor);
+  gdk_toplevel_present (GDK_TOPLEVEL (surface),
+                        gdk_surface_get_width (surface),
+                        gdk_surface_get_height (surface),
+                        layout);
+  gdk_toplevel_layout_unref (layout);
 }
 
 static void
 remove_fullscreen_cb (GtkWidget *widget, gpointer user_data)
 {
-  GdkSurface  *window;
+  GdkSurface *surface;
+  GdkToplevelLayout *layout;
 
-  window = gtk_native_get_surface (gtk_widget_get_native (widget));
-  gdk_surface_unfullscreen (window);
+  surface = gtk_native_get_surface (gtk_widget_get_native (widget));
+  layout = gdk_toplevel_layout_new (0, 0);
+  gdk_toplevel_layout_set_resizable (layout, TRUE);
+  gdk_toplevel_layout_set_fullscreen (layout, FALSE, NULL);
+  gdk_toplevel_present (GDK_TOPLEVEL (surface),
+                        gdk_surface_get_width (surface),
+                        gdk_surface_get_height (surface),
+                        layout);
+  gdk_toplevel_layout_unref (layout);
 }
 
 int


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