tests: Stop using gdk_surface_fullscreen

This commit is contained in:
Matthias Clasen 2020-03-01 10:10:39 -08:00
parent 8ea80801b4
commit 496bd5783c

View File

@ -22,21 +22,43 @@
static void static void
set_fullscreen_monitor_cb (GtkWidget *widget, gpointer user_data) set_fullscreen_monitor_cb (GtkWidget *widget, gpointer user_data)
{ {
GdkFullscreenMode mode = (GdkFullscreenMode) GPOINTER_TO_INT (user_data); GdkFullscreenMode mode = GPOINTER_TO_INT (user_data);
GdkSurface *window; GdkDisplay *display;
GdkSurface *surface;
GdkMonitor *monitor;
GdkToplevelLayout *layout;
window = gtk_native_get_surface (gtk_widget_get_native (widget)); display = gtk_widget_get_display (widget);
gdk_surface_set_fullscreen_mode (window, mode); surface = gtk_native_get_surface (gtk_widget_get_native (widget));
gdk_surface_fullscreen (window); 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 static void
remove_fullscreen_cb (GtkWidget *widget, gpointer user_data) remove_fullscreen_cb (GtkWidget *widget, gpointer user_data)
{ {
GdkSurface *window; GdkSurface *surface;
GdkToplevelLayout *layout;
window = gtk_native_get_surface (gtk_widget_get_native (widget)); surface = gtk_native_get_surface (gtk_widget_get_native (widget));
gdk_surface_unfullscreen (window); 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 int