Subject: [ xfwm4 ] - patch to get resize information
To: None <netbsd-users@NetBSD.org>
From: Joel CARNAT <joel@carnat.net>
List: netbsd-users
Date: 05/27/2004 18:45:30
--ikeVEW9yuYc//A+q
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: inline

Hi,

There is a patch for xfwm4 allowing one to see window size when resizing.
See http://lunar-linux.org/pipermail/xfce-dev/2004-April/000698.html for
original message. It seems this patch will be included some day.
As I really wanted to see the windows dimensions when resizing, I
grabbed and modified it.

Find it attached.
You can put it in your /usr/pkgsrc/wm/xfce4-wm/patches and recompile xfwm4.
The distinfo should contain "SHA1 (patch-aa) = b28e0e907ee9e118f41e757215a8e8335b219fb4".
Tested on NetBSD-2.0-BETA/i386.

What it does :
-> show a rectangular text zone containing the current window size (in
the XTerm*geometry format)

Cheers,
	Jo
-- 
                  ,      ,
       o    .    /(,----.)\        o
       |   /,\   \' ^  ^ `/        |
       |   ((    | (o)(o) |        |
  _____|____\\.OOOo_(__)_oOOO._____|_____
 /                                       \
 )  Of course, this mail runs NetBSD...  (
 \_____________________Oooo._____________/ 
       |       .oooO   (   )       |
     ,---.     (   )    ) /      ,---.
     | | |      \ (    (_/       | | |
     V V V       \_)             V V V

--ikeVEW9yuYc//A+q
Content-Type: text/plain; charset=iso-8859-15
Content-Disposition: attachment; filename=patch-aa

--- src/client.c.orig	2004-04-14 19:00:06.000000000 +0200
+++ src/client.c	2004-05-27 18:20:44.000000000 +0200
@@ -5424,4 +5445,7 @@
     int frame_x, frame_y, frame_height, frame_width;
     int frame_top, frame_left, frame_right, frame_bottom;
+    static GtkWidget *window = NULL;
+    static GtkWidget *label = NULL;
+    char location[26];  /* 26 is enough for " NNNNxNNNN " */
 
     TRACE ("entering clientResize_event_filter");
@@ -5457,4 +5481,17 @@
 
     last_timestamp = stashEventTime (last_timestamp, xevent);
+
+    if (window == NULL) {  /* FIXME - create preference for this */
+        window = gtk_window_new(GTK_WINDOW_POPUP);
+        /* FIXME - POS_CENTER_ALWAYS really ought to be an option as well */
+        gtk_window_set_position(GTK_WINDOW(window), GTK_WIN_POS_CENTER_ALWAYS);
+	snprintf(location, 26, " %u x %u ",
+                 c->width / c->size->width_inc,
+                 c->height / c->size->height_inc);
+        label = gtk_label_new(location);
+        gtk_container_add(GTK_CONTAINER(window), label);
+        gtk_widget_show_all(window);
+    }
+
     if (xevent->type == KeyPress)
     {
@@ -5673,4 +5710,12 @@
             clientConfigure (c, &wc, CWX | CWY | CWWidth | CWHeight, NO_CFG_FLAG);
         }
+        
+        if (window != NULL && label != NULL) {
+	    snprintf(location, 26, " %u x %u ",
+                     c->width / c->size->width_inc,
+                     c->height / c->size->height_inc);
+            gtk_label_set_text(GTK_LABEL(label), location);
+            gtk_widget_show(label);
+        }
     }
     else if (xevent->type == ButtonRelease)
@@ -5699,4 +5744,7 @@
     {
         TRACE ("event loop now finished");
+        gtk_widget_destroy(window);
+        window = NULL;
+        label = NULL;
         gtk_main_quit ();
     }

--ikeVEW9yuYc//A+q--