[Xfce4-commits] <xfce4-appfinder:master> Block maximize and fullscreen in collapsed mode (bug #8491).

Nick Schermer noreply at xfce.org
Sun Mar 25 20:26:01 CEST 2012


Updating branch refs/heads/master
         to 543ac6a808a0882033efab761cd0a2d8c2e71dad (commit)
       from d2693166f23807f3065529907d267459408addff (commit)

commit 543ac6a808a0882033efab761cd0a2d8c2e71dad
Author: Nick Schermer <nick at xfce.org>
Date:   Sun Mar 25 20:24:11 2012 +0200

    Block maximize and fullscreen in collapsed mode (bug #8491).
    
    No way to block this on the wm side, so use this instead.

 src/appfinder-window.c |   33 +++++++++++++++++++++++++++++++++
 1 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/src/appfinder-window.c b/src/appfinder-window.c
index 23851f0..33f5cba 100644
--- a/src/appfinder-window.c
+++ b/src/appfinder-window.c
@@ -59,6 +59,8 @@ static void       xfce_appfinder_window_finalize                      (GObject
 static void       xfce_appfinder_window_unmap                         (GtkWidget                   *widget);
 static gboolean   xfce_appfinder_window_key_press_event               (GtkWidget                   *widget,
                                                                        GdkEventKey                 *event);
+static gboolean   xfce_appfinder_window_window_state_event            (GtkWidget                   *widget,
+                                                                       GdkEventWindowState         *event);
 static void       xfce_appfinder_window_view                          (XfceAppfinderWindow         *window);
 static gboolean   xfce_appfinder_window_popup_menu                    (GtkWidget                   *view,
                                                                        XfceAppfinderWindow         *window);
@@ -178,6 +180,7 @@ xfce_appfinder_window_class_init (XfceAppfinderWindowClass *klass)
   gtkwidget_class = GTK_WIDGET_CLASS (klass);
   gtkwidget_class->unmap = xfce_appfinder_window_unmap;
   gtkwidget_class->key_press_event = xfce_appfinder_window_key_press_event;
+  gtkwidget_class->window_state_event = xfce_appfinder_window_window_state_event;
 }
 
 
@@ -496,6 +499,36 @@ xfce_appfinder_window_key_press_event (GtkWidget   *widget,
 
 
 
+static gboolean
+xfce_appfinder_window_window_state_event (GtkWidget           *widget,
+                                          GdkEventWindowState *event)
+{
+  XfceAppfinderWindow *window = XFCE_APPFINDER_WINDOW (widget);
+  gint                 width;
+
+  if (!gtk_widget_get_visible (window->paned))
+    {
+      if ((event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) != 0)
+        {
+          gtk_window_unmaximize (GTK_WINDOW (widget));
+
+          /* set sensible width instead of taking entire width */
+          width = xfconf_channel_get_int (window->channel, "/last/window-width", DEFAULT_WINDOW_WIDTH);
+          gtk_window_resize (GTK_WINDOW (widget), width, 100 /* should be corrected by wm */);
+        }
+
+      if ((event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0)
+        gtk_window_unfullscreen (GTK_WINDOW (widget));
+    }
+
+  if ((*GTK_WIDGET_CLASS (xfce_appfinder_window_parent_class)->window_state_event) != NULL)
+    return (*GTK_WIDGET_CLASS (xfce_appfinder_window_parent_class)->window_state_event) (widget, event);
+
+  return FALSE;
+}
+
+
+
 static void
 xfce_appfinder_window_set_item_width (XfceAppfinderWindow *window)
 {


More information about the Xfce4-commits mailing list