[gtk+] wayland: Apply maximized and fullscreen state



commit a0eb0e23468c7516fa7809f22a8bcaf165915c1a
Author: Matthias Clasen <mclasen redhat com>
Date:   Fri Feb 27 23:18:00 2015 +0000

    wayland: Apply maximized and fullscreen state
    
    We were just throwing the request away if the app asks to
    fullscreen or maximize a window before it has been mapped.
    This is something the GdkWindow API explicitly supports,
    so make it work by saving the state until the surface exists.
    
    This fixes things under weston. There are bugs in mutter
    that keep this from working correctly with gnome-shell.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=745303

 gdk/wayland/gdkwindow-wayland.c |   38 ++++++++++++++++++++++----------------
 1 files changed, 22 insertions(+), 16 deletions(-)
---
diff --git a/gdk/wayland/gdkwindow-wayland.c b/gdk/wayland/gdkwindow-wayland.c
index 8a449ff..cc0d3b4 100644
--- a/gdk/wayland/gdkwindow-wayland.c
+++ b/gdk/wayland/gdkwindow-wayland.c
@@ -953,6 +953,12 @@ gdk_wayland_window_create_xdg_surface (GdkWindow *window)
   gdk_wayland_window_sync_parent (window);
   gdk_wayland_window_sync_title (window);
   gdk_wayland_window_sync_margin (window);
+
+  if (window->state & GDK_WINDOW_STATE_MAXIMIZED)
+    xdg_surface_set_maximized (impl->xdg_surface);
+  if (window->state & GDK_WINDOW_STATE_FULLSCREEN)
+    xdg_surface_set_fullscreen (impl->xdg_surface, NULL);
+
   xdg_surface_set_app_id (impl->xdg_surface, gdk_get_program_class ());
 }
 
@@ -1757,10 +1763,10 @@ gdk_wayland_window_maximize (GdkWindow *window)
   if (GDK_WINDOW_DESTROYED (window))
     return;
 
-  if (!impl->xdg_surface)
-    return;
-
-  xdg_surface_set_maximized (impl->xdg_surface);
+  if (impl->xdg_surface)
+    xdg_surface_set_maximized (impl->xdg_surface);
+  else
+    gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_MAXIMIZED);
 }
 
 static void
@@ -1771,10 +1777,10 @@ gdk_wayland_window_unmaximize (GdkWindow *window)
   if (GDK_WINDOW_DESTROYED (window))
     return;
 
-  if (!impl->xdg_surface)
-    return;
-
-  xdg_surface_unset_maximized (impl->xdg_surface);
+  if (impl->xdg_surface)
+    xdg_surface_unset_maximized (impl->xdg_surface);
+  else
+    gdk_synthesize_window_state (window, GDK_WINDOW_STATE_MAXIMIZED, 0);
 }
 
 static void
@@ -1785,10 +1791,10 @@ gdk_wayland_window_fullscreen (GdkWindow *window)
   if (GDK_WINDOW_DESTROYED (window))
     return;
 
-  if (!impl->xdg_surface)
-    return;
-
-  xdg_surface_set_fullscreen (impl->xdg_surface, NULL);
+  if (impl->xdg_surface)
+    xdg_surface_set_fullscreen (impl->xdg_surface, NULL);
+  else
+    gdk_synthesize_window_state (window, 0, GDK_WINDOW_STATE_FULLSCREEN);
 }
 
 static void
@@ -1799,10 +1805,10 @@ gdk_wayland_window_unfullscreen (GdkWindow *window)
   if (GDK_WINDOW_DESTROYED (window))
     return;
 
-  if (!impl->xdg_surface)
-    return;
-
-  xdg_surface_unset_fullscreen (impl->xdg_surface);
+  if (impl->xdg_surface)
+    xdg_surface_unset_fullscreen (impl->xdg_surface);
+  else
+    gdk_synthesize_window_state (window, GDK_WINDOW_STATE_FULLSCREEN, 0);
 }
 
 static void


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