move bpos to Statusbar struct and change name of default_statubar_position in jdwmconf
This commit is contained in:
parent
a6a705dd85
commit
d61ca0da62
8
config.c
8
config.c
|
@ -299,13 +299,13 @@ parse_config(Display * disp, int scr, DC * drawcontext, jdwm_config *jdwmconf)
|
||||||
tmp = config_lookup_string(&jdwmlibconf, "jdwm.barpos");
|
tmp = config_lookup_string(&jdwmlibconf, "jdwm.barpos");
|
||||||
|
|
||||||
if(!strncmp(tmp, "BarTop", 6))
|
if(!strncmp(tmp, "BarTop", 6))
|
||||||
jdwmconf->bpos = BarTop;
|
jdwmconf->statusbar_default_position = BarTop;
|
||||||
else if(!strncmp(tmp, "BarBot", 6))
|
else if(!strncmp(tmp, "BarBot", 6))
|
||||||
jdwmconf->bpos = BarBot;
|
jdwmconf->statusbar_default_position = BarBot;
|
||||||
else if(!strncmp(tmp, "BarOff", 6))
|
else if(!strncmp(tmp, "BarOff", 6))
|
||||||
jdwmconf->bpos = BarOff;
|
jdwmconf->statusbar_default_position = BarOff;
|
||||||
|
|
||||||
jdwmconf->current_bpos = jdwmconf->bpos;
|
jdwmconf->statusbar.position = jdwmconf->statusbar_default_position;
|
||||||
|
|
||||||
/* borderpx */
|
/* borderpx */
|
||||||
jdwmconf->borderpx = config_lookup_int(&jdwmlibconf, "jdwm.borderpx");
|
jdwmconf->borderpx = config_lookup_int(&jdwmlibconf, "jdwm.borderpx");
|
||||||
|
|
10
config.h
10
config.h
|
@ -57,8 +57,12 @@ typedef struct
|
||||||
/** Status bar */
|
/** Status bar */
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
|
/** Bar width */
|
||||||
int width;
|
int width;
|
||||||
|
/** Bar height */
|
||||||
int height;
|
int height;
|
||||||
|
/** Bar position */
|
||||||
|
int position;
|
||||||
} Statusbar;
|
} Statusbar;
|
||||||
|
|
||||||
/** Main configuration structure */
|
/** Main configuration structure */
|
||||||
|
@ -90,10 +94,8 @@ struct jdwm_config
|
||||||
KeySym modkey;
|
KeySym modkey;
|
||||||
/** Numlock mask */
|
/** Numlock mask */
|
||||||
unsigned int numlockmask;
|
unsigned int numlockmask;
|
||||||
/** Bar position */
|
/** Default status bar position */
|
||||||
int bpos;
|
int statusbar_default_position;
|
||||||
/** Current bar position */
|
|
||||||
int current_bpos;
|
|
||||||
/** Border size */
|
/** Border size */
|
||||||
int borderpx;
|
int borderpx;
|
||||||
/** Master width factor */
|
/** Master width factor */
|
||||||
|
|
2
event.c
2
event.c
|
@ -241,7 +241,7 @@ handle_event_configurenotify(XEvent * e, jdwm_config *jdwmconf)
|
||||||
XFreePixmap(e->xany.display, dc.drawable);
|
XFreePixmap(e->xany.display, dc.drawable);
|
||||||
dc.drawable = XCreatePixmap(e->xany.display, DefaultRootWindow(e->xany.display), sw, jdwmconf->statusbar.height, DefaultDepth(e->xany.display, screen));
|
dc.drawable = XCreatePixmap(e->xany.display, DefaultRootWindow(e->xany.display), sw, jdwmconf->statusbar.height, DefaultDepth(e->xany.display, screen));
|
||||||
XResizeWindow(e->xany.display, barwin, sw, jdwmconf->statusbar.height);
|
XResizeWindow(e->xany.display, barwin, sw, jdwmconf->statusbar.height);
|
||||||
updatebarpos(e->xany.display, jdwmconf->statusbar, jdwmconf->current_bpos);
|
updatebarpos(e->xany.display, jdwmconf->statusbar);
|
||||||
arrange(e->xany.display, jdwmconf);
|
arrange(e->xany.display, jdwmconf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
6
jdwm.c
6
jdwm.c
|
@ -183,7 +183,7 @@ setup(Display *disp, jdwm_config *jdwmconf)
|
||||||
DefaultVisual(disp, screen),
|
DefaultVisual(disp, screen),
|
||||||
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
|
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
|
||||||
XDefineCursor(disp, barwin, cursor[CurNormal]);
|
XDefineCursor(disp, barwin, cursor[CurNormal]);
|
||||||
updatebarpos(disp, jdwmconf->statusbar, jdwmconf->current_bpos);
|
updatebarpos(disp, jdwmconf->statusbar);
|
||||||
XMapRaised(disp, barwin);
|
XMapRaised(disp, barwin);
|
||||||
/* pixmap for everything */
|
/* pixmap for everything */
|
||||||
dc.drawable = XCreatePixmap(disp, DefaultRootWindow(disp), sw, jdwmconf->statusbar.height, DefaultDepth(disp, screen));
|
dc.drawable = XCreatePixmap(disp, DefaultRootWindow(disp), sw, jdwmconf->statusbar.height, DefaultDepth(disp, screen));
|
||||||
|
@ -216,7 +216,7 @@ uicb_quit(Display *disp __attribute__ ((unused)),
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
updatebarpos(Display *disp, Statusbar statusbar, int bpos)
|
updatebarpos(Display *disp, Statusbar statusbar)
|
||||||
{
|
{
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
|
|
||||||
|
@ -224,7 +224,7 @@ updatebarpos(Display *disp, Statusbar statusbar, int bpos)
|
||||||
way = sy;
|
way = sy;
|
||||||
wah = sh;
|
wah = sh;
|
||||||
waw = sw;
|
waw = sw;
|
||||||
switch (bpos)
|
switch (statusbar.position)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
wah -= statusbar.height;
|
wah -= statusbar.height;
|
||||||
|
|
2
jdwm.h
2
jdwm.h
|
@ -42,7 +42,7 @@ enum
|
||||||
{ WMProtocols, WMDelete, WMName, WMState, WMLast }; /* default atoms */
|
{ WMProtocols, WMDelete, WMName, WMState, WMLast }; /* default atoms */
|
||||||
|
|
||||||
Bool gettextprop(Display *, Window, Atom, char *, unsigned int); /* return text property, UTF-8 compliant */
|
Bool gettextprop(Display *, Window, Atom, char *, unsigned int); /* return text property, UTF-8 compliant */
|
||||||
void updatebarpos(Display *, Statusbar, int); /* updates the bar position */
|
void updatebarpos(Display *, Statusbar); /* updates the bar position */
|
||||||
void uicb_quit(Display *, jdwm_config *, const char *); /* quit jdwm nicely */
|
void uicb_quit(Display *, jdwm_config *, const char *); /* quit jdwm nicely */
|
||||||
int xerror(Display *, XErrorEvent *); /* jdwm's X error handler */
|
int xerror(Display *, XErrorEvent *); /* jdwm's X error handler */
|
||||||
|
|
||||||
|
|
8
layout.c
8
layout.c
|
@ -174,11 +174,11 @@ uicb_togglebar(Display *disp,
|
||||||
jdwm_config *jdwmconf,
|
jdwm_config *jdwmconf,
|
||||||
const char *arg __attribute__ ((unused)))
|
const char *arg __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
if(jdwmconf->current_bpos == BarOff)
|
if(jdwmconf->statusbar.position == BarOff)
|
||||||
jdwmconf->current_bpos = (jdwmconf->bpos == BarOff) ? BarTop : jdwmconf->bpos;
|
jdwmconf->statusbar.position = (jdwmconf->statusbar.position == BarOff) ? BarTop : jdwmconf->statusbar_default_position;
|
||||||
else
|
else
|
||||||
jdwmconf->current_bpos = BarOff;
|
jdwmconf->statusbar.position = BarOff;
|
||||||
updatebarpos(disp, jdwmconf->statusbar, jdwmconf->current_bpos);
|
updatebarpos(disp, jdwmconf->statusbar);
|
||||||
arrange(disp, jdwmconf);
|
arrange(disp, jdwmconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,7 +36,7 @@ grid(Display *disp, jdwm_config *jdwmconf)
|
||||||
continue;
|
continue;
|
||||||
c->ismax = False;
|
c->ismax = False;
|
||||||
cx = (i / rows) * cw;
|
cx = (i / rows) * cw;
|
||||||
cy = (i % rows) * ch + (jdwmconf->current_bpos == BarTop ? jdwmconf->statusbar.height : 0); // bh? adjust
|
cy = (i % rows) * ch + (jdwmconf->statusbar.position == BarTop ? jdwmconf->statusbar.height : 0); // bh? adjust
|
||||||
/* adjust height/width of last row/column's windows */
|
/* adjust height/width of last row/column's windows */
|
||||||
ah = ((i + 1) % rows == 0) ? wah - ch * rows : 0;
|
ah = ((i + 1) % rows == 0) ? wah - ch * rows : 0;
|
||||||
aw = (i >= rows * (cols - 1)) ? waw - cw * cols : 0;
|
aw = (i >= rows * (cols - 1)) ? waw - cw * cols : 0;
|
||||||
|
|
Loading…
Reference in New Issue