remove global selscreen variable and remove unused vars from setup()
This commit is contained in:
parent
1d25e8897a
commit
a9d1f4a37d
6
client.c
6
client.c
|
@ -16,7 +16,6 @@
|
||||||
extern int sx, sy, sw, sh; /* screen geometry */
|
extern int sx, sy, sw, sh; /* screen geometry */
|
||||||
extern int wax, way, wah, waw; /* windowarea geometry */
|
extern int wax, way, wah, waw; /* windowarea geometry */
|
||||||
extern Client *clients, *sel, *stack; /* global client list and stack */
|
extern Client *clients, *sel, *stack; /* global client list and stack */
|
||||||
extern Bool selscreen;
|
|
||||||
extern Atom jdwmprops, wmatom[WMLast], netatom[NetLast];
|
extern Atom jdwmprops, wmatom[WMLast], netatom[NetLast];
|
||||||
|
|
||||||
/** Attach client stack to clients stacks
|
/** Attach client stack to clients stacks
|
||||||
|
@ -236,10 +235,11 @@ detach(Client * c)
|
||||||
* \param disp Display ref
|
* \param disp Display ref
|
||||||
* \param drawcontext drawcontext ref
|
* \param drawcontext drawcontext ref
|
||||||
* \param c client
|
* \param c client
|
||||||
|
* \param selscreen True if current screen is selected
|
||||||
* \param jdwmconf jdwm config
|
* \param jdwmconf jdwm config
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
focus(Display *disp, DC *drawcontext, Client * c, jdwm_config *jdwmconf)
|
focus(Display *disp, DC *drawcontext, Client * c, Bool selscreen, jdwm_config *jdwmconf)
|
||||||
{
|
{
|
||||||
/* if c is NULL or invisible, take next client in the stack */
|
/* if c is NULL or invisible, take next client in the stack */
|
||||||
if((!c && selscreen) || (c && !isvisible(c, jdwmconf->selected_tags, jdwmconf->ntags)))
|
if((!c && selscreen) || (c && !isvisible(c, jdwmconf->selected_tags, jdwmconf->ntags)))
|
||||||
|
@ -539,7 +539,7 @@ unmanage(Client * c, DC *drawcontext, long state, jdwm_config *jdwmconf)
|
||||||
detach(c);
|
detach(c);
|
||||||
detachstack(c);
|
detachstack(c);
|
||||||
if(sel == c)
|
if(sel == c)
|
||||||
focus(c->display, drawcontext, NULL, jdwmconf);
|
focus(c->display, drawcontext, NULL, True, jdwmconf);
|
||||||
XUngrabButton(c->display, AnyButton, AnyModifier, c->win);
|
XUngrabButton(c->display, AnyButton, AnyModifier, c->win);
|
||||||
setclientstate(c, state);
|
setclientstate(c, state);
|
||||||
XSync(c->display, False);
|
XSync(c->display, False);
|
||||||
|
|
2
client.h
2
client.h
|
@ -33,7 +33,7 @@ void attach(Client *); /* attaches c to global client list */
|
||||||
void ban(Client *); /* bans c */
|
void ban(Client *); /* bans c */
|
||||||
void configure(Client *); /* send synthetic configure event */
|
void configure(Client *); /* send synthetic configure event */
|
||||||
void detach(Client *); /* detaches c from global client list */
|
void detach(Client *); /* detaches c from global client list */
|
||||||
void focus(Display *, DC *, Client *, jdwm_config *); /* focus c if visible && !NULL, or focus top visible */
|
void focus(Display *, DC *, Client *, Bool, jdwm_config *); /* focus c if visible && !NULL, or focus top visible */
|
||||||
void manage(Display *, DC *, Window, XWindowAttributes *, jdwm_config *); /* manage new client */
|
void manage(Display *, DC *, Window, XWindowAttributes *, jdwm_config *); /* manage new client */
|
||||||
void resize(Client *, int, int, int, int, Bool); /* resize with given coordinates c */
|
void resize(Client *, int, int, int, int, Bool); /* resize with given coordinates c */
|
||||||
void unban(Client *); /* unbans c */
|
void unban(Client *); /* unbans c */
|
||||||
|
|
15
event.c
15
event.c
|
@ -20,7 +20,6 @@ extern Window barwin;
|
||||||
extern DC dc; /* global draw context */
|
extern DC dc; /* global draw context */
|
||||||
extern Cursor cursor[CurLast];
|
extern Cursor cursor[CurLast];
|
||||||
extern Client *clients, *sel; /* global client list */
|
extern Client *clients, *sel; /* global client list */
|
||||||
extern Bool selscreen;
|
|
||||||
extern Atom netatom[NetLast];
|
extern Atom netatom[NetLast];
|
||||||
|
|
||||||
#define CLEANMASK(mask) (mask & ~(jdwmconf->numlockmask | LockMask))
|
#define CLEANMASK(mask) (mask & ~(jdwmconf->numlockmask | LockMask))
|
||||||
|
@ -158,7 +157,7 @@ handle_event_buttonpress(XEvent * e, jdwm_config *jdwmconf)
|
||||||
}
|
}
|
||||||
else if((c = getclient(ev->window)))
|
else if((c = getclient(ev->window)))
|
||||||
{
|
{
|
||||||
focus(c->display, &dc, c, jdwmconf);
|
focus(c->display, &dc, c, ev->same_screen, jdwmconf);
|
||||||
if(CLEANMASK(ev->state) != jdwmconf->modkey)
|
if(CLEANMASK(ev->state) != jdwmconf->modkey)
|
||||||
return;
|
return;
|
||||||
if(ev->button == Button1 && (IS_ARRANGE(floating) || c->isfloating))
|
if(ev->button == Button1 && (IS_ARRANGE(floating) || c->isfloating))
|
||||||
|
@ -267,12 +266,9 @@ handle_event_enternotify(XEvent * e, jdwm_config *jdwmconf)
|
||||||
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
|
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
|
||||||
return;
|
return;
|
||||||
if((c = getclient(ev->window)))
|
if((c = getclient(ev->window)))
|
||||||
focus(c->display, &dc, c, jdwmconf);
|
focus(c->display, &dc, c, ev->same_screen, jdwmconf);
|
||||||
else if(ev->window == DefaultRootWindow(e->xany.display))
|
else if(ev->window == DefaultRootWindow(e->xany.display))
|
||||||
{
|
focus(e->xany.display, &dc, NULL, True, jdwmconf);
|
||||||
selscreen = True;
|
|
||||||
focus(e->xany.display, &dc, NULL, jdwmconf);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -304,10 +300,7 @@ handle_event_leavenotify(XEvent * e, jdwm_config *jdwmconf)
|
||||||
XCrossingEvent *ev = &e->xcrossing;
|
XCrossingEvent *ev = &e->xcrossing;
|
||||||
|
|
||||||
if((ev->window == DefaultRootWindow(e->xany.display)) && !ev->same_screen)
|
if((ev->window == DefaultRootWindow(e->xany.display)) && !ev->same_screen)
|
||||||
{
|
focus(e->xany.display, &dc, NULL, ev->same_screen, jdwmconf);
|
||||||
selscreen = False;
|
|
||||||
focus(e->xany.display, &dc, NULL, jdwmconf);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
6
jdwm.c
6
jdwm.c
|
@ -21,7 +21,6 @@
|
||||||
int screen, sx, sy, sw, sh, wax, way, waw, wah;
|
int screen, sx, sy, sw, sh, wax, way, waw, wah;
|
||||||
int bh;
|
int bh;
|
||||||
Atom jdwmprops, wmatom[WMLast], netatom[NetLast];
|
Atom jdwmprops, wmatom[WMLast], netatom[NetLast];
|
||||||
Bool selscreen = True;
|
|
||||||
Client *clients = NULL;
|
Client *clients = NULL;
|
||||||
Client *sel = NULL;
|
Client *sel = NULL;
|
||||||
Client *stack = NULL;
|
Client *stack = NULL;
|
||||||
|
@ -147,9 +146,6 @@ scan(Display *disp, jdwm_config *jdwmconf)
|
||||||
static void
|
static void
|
||||||
setup(Display *disp, jdwm_config *jdwmconf)
|
setup(Display *disp, jdwm_config *jdwmconf)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
unsigned int mask;
|
|
||||||
Window w;
|
|
||||||
XSetWindowAttributes wa;
|
XSetWindowAttributes wa;
|
||||||
|
|
||||||
/* init atoms */
|
/* init atoms */
|
||||||
|
@ -197,8 +193,6 @@ setup(Display *disp, jdwm_config *jdwmconf)
|
||||||
XSetLineAttributes(disp, dc.gc, 1, LineSolid, CapButt, JoinMiter);
|
XSetLineAttributes(disp, dc.gc, 1, LineSolid, CapButt, JoinMiter);
|
||||||
if(!dc.font.set)
|
if(!dc.font.set)
|
||||||
XSetFont(disp, dc.gc, dc.font.xfont->fid);
|
XSetFont(disp, dc.gc, dc.font.xfont->fid);
|
||||||
/* multihead support */
|
|
||||||
selscreen = XQueryPointer(disp, DefaultRootWindow(disp), &w, &w, &i, &i, &i, &i, &mask);
|
|
||||||
loadjdwmprops(disp, jdwmconf);
|
loadjdwmprops(disp, jdwmconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
8
layout.c
8
layout.c
|
@ -30,7 +30,7 @@ arrange(Display * disp, jdwm_config *jdwmconf)
|
||||||
else
|
else
|
||||||
ban(c);
|
ban(c);
|
||||||
jdwmconf->current_layout->arrange(disp, jdwmconf);
|
jdwmconf->current_layout->arrange(disp, jdwmconf);
|
||||||
focus(disp, &dc, NULL, jdwmconf);
|
focus(disp, &dc, NULL, True, jdwmconf);
|
||||||
restack(disp, jdwmconf);
|
restack(disp, jdwmconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,7 +48,7 @@ uicb_focusnext(Display *disp __attribute__ ((unused)),
|
||||||
for(c = clients; c && !isvisible(c, jdwmconf->selected_tags, jdwmconf->ntags); c = c->next);
|
for(c = clients; c && !isvisible(c, jdwmconf->selected_tags, jdwmconf->ntags); c = c->next);
|
||||||
if(c)
|
if(c)
|
||||||
{
|
{
|
||||||
focus(c->display, &dc, c, jdwmconf);
|
focus(c->display, &dc, c, True, jdwmconf);
|
||||||
restack(c->display, jdwmconf);
|
restack(c->display, jdwmconf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -70,7 +70,7 @@ uicb_focusprev(Display *disp __attribute__ ((unused)),
|
||||||
}
|
}
|
||||||
if(c)
|
if(c)
|
||||||
{
|
{
|
||||||
focus(c->display, &dc, c, jdwmconf);
|
focus(c->display, &dc, c, True, jdwmconf);
|
||||||
restack(c->display, jdwmconf);
|
restack(c->display, jdwmconf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ uicb_zoom(Display *disp __attribute__ ((unused)),
|
||||||
return;
|
return;
|
||||||
detach(sel);
|
detach(sel);
|
||||||
attach(sel);
|
attach(sel);
|
||||||
focus(sel->display, &dc, sel, jdwmconf);
|
focus(sel->display, &dc, sel, True, jdwmconf);
|
||||||
arrange(sel->display, jdwmconf);
|
arrange(sel->display, jdwmconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -46,6 +46,6 @@ grid(Display *disp, jdwm_config *jdwmconf)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ban(c);
|
ban(c);
|
||||||
focus(disp, &dc, NULL, jdwmconf);
|
focus(disp, &dc, NULL, True, jdwmconf);
|
||||||
restack(disp, jdwmconf);
|
restack(disp, jdwmconf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -60,7 +60,7 @@ fibonacci(Display *disp, jdwm_config *jdwmconf, int shape)
|
||||||
}
|
}
|
||||||
resize(c, nx, ny, nw - 2 * c->border, nh - 2 * c->border, False);
|
resize(c, nx, ny, nw - 2 * c->border, nh - 2 * c->border, False);
|
||||||
}
|
}
|
||||||
focus(disp, &dc, NULL, jdwmconf);
|
focus(disp, &dc, NULL, True, jdwmconf);
|
||||||
restack(disp, jdwmconf);
|
restack(disp, jdwmconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue