remove jdwmprops as global var, replaced by a macro

This commit is contained in:
Julien Danjou 2007-09-07 16:46:46 +02:00
parent d61ca0da62
commit c3d2e56ef1
4 changed files with 10 additions and 8 deletions

View File

@ -16,7 +16,7 @@
extern int sx, sy, sw, sh; /* screen geometry */
extern int wax, way, wah, waw; /* windowarea geometry */
extern Client *clients, *sel, *stack; /* global client list and stack */
extern Atom jdwmprops, wmatom[WMLast], netatom[NetLast];
extern Atom wmatom[WMLast], netatom[NetLast];
/** Attach client stack to clients stacks
* \param c the client
@ -313,7 +313,7 @@ loadprops(Client * c, int ntags)
prop = p_new(char, ntags + 2);
if(gettextprop(c->display, c->win, jdwmprops, prop, ntags + 2))
if(gettextprop(c->display, c->win, JDWMPROPS_ATOM(c->display), prop, ntags + 2))
{
for(i = 0; i < ntags && prop[i]; i++)
if((c->tags[i] = prop[i] == '1'))
@ -511,7 +511,7 @@ saveprops(Client * c, int ntags)
prop[++i] = '\0';
XChangeProperty(c->display, c->win, jdwmprops, XA_STRING, 8,
XChangeProperty(c->display, c->win, JDWMPROPS_ATOM(c->display), XA_STRING, 8,
PropModeReplace, (unsigned char *) prop, i);
p_delete(&prop);

3
jdwm.c
View File

@ -19,7 +19,7 @@
#include "tag.h"
int screen, sx, sy, sw, sh, wax, way, waw, wah;
Atom jdwmprops, wmatom[WMLast], netatom[NetLast];
Atom wmatom[WMLast], netatom[NetLast];
Client *clients = NULL;
Client *sel = NULL;
Client *stack = NULL;
@ -148,7 +148,6 @@ setup(Display *disp, jdwm_config *jdwmconf)
XSetWindowAttributes wa;
/* init atoms */
jdwmprops = XInternAtom(disp, "_JDWM_PROPERTIES", False);
wmatom[WMProtocols] = XInternAtom(disp, "WM_PROTOCOLS", False);
wmatom[WMDelete] = XInternAtom(disp, "WM_DELETE_WINDOW", False);
wmatom[WMName] = XInternAtom(disp, "WM_NAME", False);

View File

@ -14,7 +14,6 @@
extern int wax, way, wah, waw; /* windowarea geometry */
extern Window barwin;
extern Client *clients, *sel; /* global client list */
extern Atom jdwmprops;
extern DC dc;
void
@ -81,7 +80,7 @@ loadjdwmprops(Display *disp, jdwm_config * jdwmconf)
prop = p_new(char, jdwmconf->ntags + 1);
if(gettextprop(disp, DefaultRootWindow(disp), jdwmprops, prop, jdwmconf->ntags + 1))
if(gettextprop(disp, DefaultRootWindow(disp), JDWMPROPS_ATOM(disp), prop, jdwmconf->ntags + 1))
for(i = 0; i < jdwmconf->ntags && prop[i]; i++)
jdwmconf->selected_tags[i] = prop[i] == '1';
@ -131,7 +130,9 @@ savejdwmprops(Display *disp, jdwm_config *jdwmconf)
for(i = 0; i < jdwmconf->ntags; i++)
prop[i] = jdwmconf->selected_tags[i] ? '1' : '0';
prop[i] = '\0';
XChangeProperty(disp, DefaultRootWindow(disp), jdwmprops, XA_STRING, 8, PropModeReplace, (unsigned char *) prop, i);
XChangeProperty(disp, DefaultRootWindow(disp),
JDWMPROPS_ATOM(disp), XA_STRING, 8,
PropModeReplace, (unsigned char *) prop, i);
p_delete(&prop);
}

View File

@ -8,6 +8,8 @@
/** Check if current layout is arranged with a layout */
#define IS_ARRANGE(layout) (layout == jdwmconf->current_layout->arrange)
#define JDWMPROPS_ATOM(disp) XInternAtom(disp, "_JDWM_PROPERTIES", False)
void arrange(Display *, jdwm_config *); /* arranges all windows depending on the layout in use */
void restack(Display *, jdwm_config *); /* restores z layers of all clients */
void uicb_focusnext(Display *, jdwm_config *, const char *); /* focuses next visible client */