[gnome-initial-setup/gnome-3-14] driver: Allow resizing and moving the window on small screens



commit 7948f4cddbe4542b3f7ff349686e7c0cc68beaef
Author: Rui Matos <tiagomatos gmail com>
Date:   Thu Jan 15 14:25:31 2015 +0100

    driver: Allow resizing and moving the window on small screens
    
    Otherwise, if the WM doesn't maximize or allows users to unmaximize,
    we might be stuck in a too small window that doesn't move and can't be
    resized or maximized again.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=742958

 gnome-initial-setup/gis-driver.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)
---
diff --git a/gnome-initial-setup/gis-driver.c b/gnome-initial-setup/gis-driver.c
index 524e1ec..cbc4410 100644
--- a/gnome-initial-setup/gis-driver.c
+++ b/gnome-initial-setup/gis-driver.c
@@ -122,6 +122,8 @@ prepare_main_window (GisDriver *driver)
                                      NULL,
                                      &size_hints,
                                      GDK_HINT_MIN_SIZE | GDK_HINT_WIN_GRAVITY);
+      gtk_window_set_resizable (priv->main_window, FALSE);
+      gtk_window_set_position (priv->main_window, GTK_WIN_POS_CENTER_ALWAYS);
     }
 
   gtk_window_set_titlebar (priv->main_window,
@@ -303,14 +305,15 @@ window_realize_cb (GtkWidget *widget, gpointer user_data)
   GisDriver *driver = GIS_DRIVER (user_data);
   GisDriverPrivate *priv = gis_driver_get_instance_private (driver);
   GdkWindow *window;
+  GdkWMFunction funcs;
+
   window = gtk_widget_get_window (GTK_WIDGET (priv->main_window));
-  /* disable all the WM functions */
-  gdk_window_set_functions (window, GDK_FUNC_ALL
-                            | GDK_FUNC_RESIZE
-                            | GDK_FUNC_MOVE
-                            | GDK_FUNC_MINIMIZE
-                            | GDK_FUNC_MAXIMIZE
-                            | GDK_FUNC_CLOSE);
+  funcs = GDK_FUNC_ALL | GDK_FUNC_MINIMIZE | GDK_FUNC_CLOSE;
+
+  if (!gis_driver_is_small_screen (driver))
+    funcs |= GDK_FUNC_RESIZE | GDK_FUNC_MOVE | GDK_FUNC_MAXIMIZE;
+
+  gdk_window_set_functions (window, funcs);
 }
 
 static void
@@ -325,8 +328,6 @@ gis_driver_startup (GApplication *app)
                                     "application", app,
                                     "type", GTK_WINDOW_TOPLEVEL,
                                     "icon-name", "preferences-system",
-                                    "resizable", FALSE,
-                                    "window-position", GTK_WIN_POS_CENTER_ALWAYS,
                                     "deletable", FALSE,
                                     NULL);
 


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