[hackers] [tabbed] Fix the atom handling and fix the title setting. Thanks to Carlos Pita! || Christoph Lohmann

From: <hg_AT_suckless.org>
Date: Sat, 13 Oct 2012 07:00:21 +0200 (CEST)

changeset: 176:71cf9456e6ec
tag: tip
user: Christoph Lohmann <20h_AT_r-36.net>
date: Sat Oct 13 06:57:32 2012 +0200
files: tabbed.c
description:
Fix the atom handling and fix the title setting. Thanks to Carlos Pita!


diff -r f923291b4237 -r 71cf9456e6ec tabbed.c
--- a/tabbed.c Wed Oct 03 07:56:53 2012 +0200
+++ b/tabbed.c Sat Oct 13 06:57:32 2012 +0200
_AT_@ -47,7 +47,7 @@
 #define TEXTW(x) (textnw(x, strlen(x)) + dc.font.height)
 
 enum { ColFG, ColBG, ColLast }; /* color */
-enum { WMProtocols, WMDelete, WMLast }; /* default atoms */
+enum { WMProtocols, WMDelete, WMName, XEmbed, WMLast }; /* default atoms */
 
 typedef union {
         int i;
_AT_@ -147,7 +147,7 @@
 static Bool running = True, nextfocus, doinitspawn = True;
 static Display *dpy;
 static DC dc;
-static Atom wmatom[WMLast], xembedatom;
+static Atom wmatom[WMLast];
 static Window root, win;
 static Client *clients = NULL, *sel = NULL, *lastsel = NULL;
 static int (*xerrorxlib)(Display *, XErrorEvent *);
_AT_@ -601,7 +601,7 @@
                 XMapRaised(dpy, w);
                 e.xclient.window = w;
                 e.xclient.type = ClientMessage;
- e.xclient.message_type = xembedatom;
+ e.xclient.message_type = wmatom[XEmbed];
                 e.xclient.format = 32;
                 e.xclient.data.l[0] = CurrentTime;
                 e.xclient.data.l[1] = XEMBED_EMBEDDED_NOTIFY;
_AT_@ -708,7 +708,7 @@
 
         e.xclient.window = c->win;
         e.xclient.type = ClientMessage;
- e.xclient.message_type = xembedatom;
+ e.xclient.message_type = wmatom[XEmbed];
         e.xclient.format = 32;
         e.xclient.data.l[0] = CurrentTime;
         e.xclient.data.l[1] = msg;
_AT_@ -743,7 +743,8 @@
         /* init atoms */
         wmatom[WMProtocols] = XInternAtom(dpy, "WM_PROTOCOLS", False);
         wmatom[WMDelete] = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
- xembedatom = XInternAtom(dpy, "_XEMBED", False);
+ wmatom[XEmbed] = XInternAtom(dpy, "_XEMBED", False);
+ wmatom[WMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
 
         /* init appearance */
         wx = 0;
_AT_@ -855,7 +856,8 @@
 
 void
 updatetitle(Client *c) {
- gettextprop(c->win, XA_WM_NAME, c->name, sizeof c->name);
+ if(!gettextprop(c->win, wmatom[WMName], c->name, sizeof c->name))
+ gettextprop(c->win, XA_WM_NAME, c->name, sizeof c->name);
         if(sel == c)
                 XStoreName(dpy, win, c->name);
         drawbar();
Received on Sat Oct 13 2012 - 07:00:21 CEST

This archive was generated by hypermail 2.3.0 : Sat Oct 13 2012 - 07:12:07 CEST