[dev] [tabbed][PATCH] Resize clients that notify about WM_NORMAL_HINTS

From: S. Gilles <sgilles_AT_math.umd.edu>
Date: Mon, 15 Oct 2018 00:56:50 -0400

Signed-off-by: S Gilles <sgilles_AT_math.umd.edu>
---
Fixes the following program. This could probably also be done be
adjusting configurerequest.
    /* cc -o mwe mwe.c  $(pkg-config --cflags --libs gtk+-2.0) */
    #include <gtk/gtk.h>
    #include <X11/X.h>
    
    static int x, y;
    
    static gboolean tick(gpointer p)
    {
            gtk_entry_progress_pulse(GTK_ENTRY((GtkWidget *) p));
    
            if (x++ > 99)
                    gtk_main_quit();
    
            return 1;
    }
    
    static gboolean tock(gpointer p)
    {
            gtk_image_set_from_icon_name(GTK_IMAGE((GtkWidget *) p),
                                         "text-x-generic", (y++ % 2) ?
                                         GTK_ICON_SIZE_DIALOG :
                                         GTK_ICON_SIZE_MENU);
    
            return 1;
    }
    
    int main(int argc, char **argv)
    {
            GtkWidget *w, *h, *e, *i;
    
            gtk_init(0, 0);
            w = (argc == 2) ? gtk_plug_new(strtoll(argv[1], 0, 0)) :
                              gtk_window_new(GTK_WINDOW_TOPLEVEL);
            gtk_window_set_default_size(GTK_WINDOW(w), 1024, 800);
            h = gtk_hbox_new(0, 0);
            e = gtk_entry_new();
            i = gtk_image_new();
            gtk_container_add(GTK_CONTAINER(w), h);
            gtk_box_pack_start(GTK_BOX(h), e, 0, 0, 0);
            gtk_box_pack_start(GTK_BOX(h), i, 0, 0, 0);
            g_timeout_add(100, tick, (gpointer) e);
            g_timeout_add(550, tock, (gpointer) i);
            gtk_widget_show_all(w);
            gtk_main();
    
            return 0;
    }
 tabbed.c | 3 +++
 1 file changed, 3 insertions(+)
diff --git a/tabbed.c b/tabbed.c
index ff3ada0..7bb16e3 100644
--- a/tabbed.c
+++ b/tabbed.c
_AT_@ -859,6 +859,9 @@ propertynotify(const XEvent *e)
 			}
 		}
 		XFree(wmh);
+	} else if (ev->state == PropertyNewValue && ev->atom == XA_WM_NORMAL_HINTS &&
+	           (c = getclient(ev->window)) > -1) {
+		resize(c, ww, wh - bh);
 	} else if (ev->state != PropertyDelete && ev->atom == XA_WM_NAME &&
 	           (c = getclient(ev->window)) > -1) {
 		updatetitle(c);
-- 
2.19.1
Received on Mon Oct 15 2018 - 06:56:50 CEST

This archive was generated by hypermail 2.3.0 : Mon Oct 15 2018 - 07:00:08 CEST