sel is no more extern

This commit is contained in:
Julien Danjou 2007-10-11 23:12:05 +02:00
parent 12ef66b79a
commit c3986a5937
8 changed files with 134 additions and 127 deletions

View File

@ -40,7 +40,6 @@
#include "util.h" #include "util.h"
#include "statusbar.h" #include "statusbar.h"
Client *sel = NULL;
Client *stack = NULL; Client *stack = NULL;
static int (*xerrorxlib) (Display *, XErrorEvent *); static int (*xerrorxlib) (Display *, XErrorEvent *);
@ -91,6 +90,7 @@ cleanup(awesome_config *awesomeconf)
XSetInputFocus(awesomeconf->display, PointerRoot, RevertToPointerRoot, CurrentTime); XSetInputFocus(awesomeconf->display, PointerRoot, RevertToPointerRoot, CurrentTime);
XSync(awesomeconf->display, False); XSync(awesomeconf->display, False);
p_delete(&awesomeconf->clients); p_delete(&awesomeconf->clients);
p_delete(&awesomeconf->client_sel);
p_delete(&awesomeconf); p_delete(&awesomeconf);
} }
@ -269,7 +269,7 @@ main(int argc, char *argv[])
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */ enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
Atom netatom[NetLast]; Atom netatom[NetLast];
event_handler **handler; event_handler **handler;
Client **clients; Client **clients, **sel;
if(argc >= 2) if(argc >= 2)
{ {
@ -311,12 +311,14 @@ main(int argc, char *argv[])
/* allocate stuff */ /* allocate stuff */
awesomeconf = p_new(awesome_config, get_screen_count(dpy)); awesomeconf = p_new(awesome_config, get_screen_count(dpy));
clients = p_new(Client *, 1); clients = p_new(Client *, 1);
sel = p_new(Client *, 1);
for(screen = 0; screen < get_screen_count(dpy); screen++) for(screen = 0; screen < get_screen_count(dpy); screen++)
{ {
parse_config(dpy, screen, confpath, &awesomeconf[screen]); parse_config(dpy, screen, confpath, &awesomeconf[screen]);
setup(&awesomeconf[screen]); setup(&awesomeconf[screen]);
awesomeconf[screen].clients = clients; awesomeconf[screen].clients = clients;
awesomeconf[screen].client_sel = sel;
drawstatusbar(dpy, &awesomeconf[screen]); drawstatusbar(dpy, &awesomeconf[screen]);
} }

View File

@ -34,7 +34,7 @@
#include "layouts/floating.h" #include "layouts/floating.h"
/* extern */ /* extern */
extern Client *sel, *stack; /* global client list and stack */ extern Client *stack;
/** Attach client stack to clients stacks /** Attach client stack to clients stacks
* \param c the client * \param c the client
@ -329,13 +329,13 @@ focus(Display *disp, Client * c, Bool selscreen, awesome_config *awesomeconf)
for(c = stack; c && !isvisible(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); c = c->snext); for(c = stack; c && !isvisible(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); c = c->snext);
/* if a client was selected but it's not the current client, unfocus it */ /* if a client was selected but it's not the current client, unfocus it */
if(sel && sel != c) if(*awesomeconf->client_sel && *awesomeconf->client_sel != c)
{ {
grabbuttons(sel, False, True, awesomeconf->modkey, awesomeconf->numlockmask); grabbuttons(*awesomeconf->client_sel, False, True, awesomeconf->modkey, awesomeconf->numlockmask);
XSetWindowBorder(sel->display, sel->win, awesomeconf->colors_normal[ColBorder].pixel); XSetWindowBorder(awesomeconf->display, (*awesomeconf->client_sel)->win, awesomeconf->colors_normal[ColBorder].pixel);
setclienttrans(sel, awesomeconf->opacity_unfocused); setclienttrans(*awesomeconf->client_sel, awesomeconf->opacity_unfocused);
} }
if(sel == c) if(*awesomeconf->client_sel == c)
return; return;
if(c) if(c)
{ {
@ -345,16 +345,16 @@ focus(Display *disp, Client * c, Bool selscreen, awesome_config *awesomeconf)
} }
if(!selscreen) if(!selscreen)
return; return;
sel = c; *awesomeconf->client_sel = c;
drawstatusbar(disp, awesomeconf); drawstatusbar(disp, awesomeconf);
if(sel) if(*awesomeconf->client_sel)
{ {
XSetWindowBorder(sel->display, sel->win, awesomeconf->colors_selected[ColBorder].pixel); XSetWindowBorder(awesomeconf->display, (*awesomeconf->client_sel)->win, awesomeconf->colors_selected[ColBorder].pixel);
XSetInputFocus(sel->display, sel->win, RevertToPointerRoot, CurrentTime); XSetInputFocus(awesomeconf->display, (*awesomeconf->client_sel)->win, RevertToPointerRoot, CurrentTime);
for(c = stack; c; c = c->snext) for(c = stack; c; c = c->snext)
if(c != sel) if(c != *awesomeconf->client_sel)
setclienttrans(c, awesomeconf->opacity_unfocused); setclienttrans(c, awesomeconf->opacity_unfocused);
setclienttrans(sel, -1); setclienttrans(*awesomeconf->client_sel, -1);
} }
else else
XSetInputFocus(disp, RootWindow(disp, awesomeconf->phys_screen), RevertToPointerRoot, CurrentTime); XSetInputFocus(disp, RootWindow(disp, awesomeconf->phys_screen), RevertToPointerRoot, CurrentTime);
@ -590,7 +590,7 @@ unmanage(Client * c, long state, awesome_config *awesomeconf)
XConfigureWindow(c->display, c->win, CWBorderWidth, &wc); /* restore border */ XConfigureWindow(c->display, c->win, CWBorderWidth, &wc); /* restore border */
detach(awesomeconf->clients, c); detach(awesomeconf->clients, c);
detachstack(c); detachstack(c);
if(sel == c) if(*awesomeconf->client_sel == c)
focus(c->display, NULL, True, awesomeconf); focus(c->display, NULL, True, awesomeconf);
XUngrabButton(c->display, AnyButton, AnyModifier, c->win); XUngrabButton(c->display, AnyButton, AnyModifier, c->win);
setclientstate(c, state); setclientstate(c, state);
@ -697,10 +697,11 @@ uicb_settrans(Display *disp __attribute__ ((unused)),
unsigned int current_opacity_raw = 0; unsigned int current_opacity_raw = 0;
int set_prop = 0; int set_prop = 0;
if(!sel) if(!*awesomeconf->client_sel)
return; return;
XGetWindowProperty(sel->display, sel->win, XInternAtom(sel->display, "_NET_WM_WINDOW_OPACITY", False), XGetWindowProperty(awesomeconf->display, (*awesomeconf->client_sel)->win,
XInternAtom((*awesomeconf->client_sel)->display, "_NET_WM_WINDOW_OPACITY", False),
0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left, 0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left,
(unsigned char **) &data); (unsigned char **) &data);
if(data) if(data)
@ -723,9 +724,9 @@ uicb_settrans(Display *disp __attribute__ ((unused)),
} }
if(delta == 100.0 && !set_prop) if(delta == 100.0 && !set_prop)
setclienttrans(sel, -1); setclienttrans(*awesomeconf->client_sel, -1);
else else
setclienttrans(sel, delta); setclienttrans(*awesomeconf->client_sel, delta);
} }
@ -754,13 +755,13 @@ uicb_swapnext(Display *disp,
{ {
Client *next; Client *next;
if(!sel) if(!*awesomeconf->client_sel)
return; return;
for(next = sel->next; next && !isvisible(next, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); next = next->next); for(next = (*awesomeconf->client_sel)->next; next && !isvisible(next, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); next = next->next);
if(next) if(next)
{ {
client_swap(awesomeconf->clients, sel, next); client_swap(awesomeconf->clients, *awesomeconf->client_sel, next);
arrange(disp, awesomeconf); arrange(disp, awesomeconf);
} }
} }
@ -772,13 +773,13 @@ uicb_swapprev(Display *disp,
{ {
Client *prev; Client *prev;
if(!sel) if(!*awesomeconf->client_sel)
return; return;
for(prev = sel->prev; prev && !isvisible(prev, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); prev = prev->prev); for(prev = (*awesomeconf->client_sel)->prev; prev && !isvisible(prev, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); prev = prev->prev);
if(prev) if(prev)
{ {
client_swap(awesomeconf->clients, prev, sel); client_swap(awesomeconf->clients, prev, *awesomeconf->client_sel);
arrange(disp, awesomeconf); arrange(disp, awesomeconf);
} }
} }
@ -795,27 +796,27 @@ uicb_moveresize(Display *disp __attribute__ ((unused)),
Window dummy; Window dummy;
if(!IS_ARRANGE(0, layout_floating)) if(!IS_ARRANGE(0, layout_floating))
if(!sel || !sel->isfloating || sel->isfixed || !arg) if(!*awesomeconf->client_sel || !(*awesomeconf->client_sel)->isfloating || (*awesomeconf->client_sel)->isfixed || !arg)
return; return;
if(sscanf(arg, "%s %s %s %s", x, y, w, h) != 4) if(sscanf(arg, "%s %s %s %s", x, y, w, h) != 4)
return; return;
nx = (int) compute_new_value_from_arg(x, sel->x); nx = (int) compute_new_value_from_arg(x, (*awesomeconf->client_sel)->x);
ny = (int) compute_new_value_from_arg(y, sel->y); ny = (int) compute_new_value_from_arg(y, (*awesomeconf->client_sel)->y);
nw = (int) compute_new_value_from_arg(w, sel->w); nw = (int) compute_new_value_from_arg(w, (*awesomeconf->client_sel)->w);
nh = (int) compute_new_value_from_arg(h, sel->h); nh = (int) compute_new_value_from_arg(h, (*awesomeconf->client_sel)->h);
ox = sel->x; ox = (*awesomeconf->client_sel)->x;
oy = sel->y; oy = (*awesomeconf->client_sel)->y;
ow = sel->w; ow = (*awesomeconf->client_sel)->w;
oh = sel->h; oh = (*awesomeconf->client_sel)->h;
Bool xqp = XQueryPointer(sel->display, RootWindow(sel->display, sel->phys_screen), &dummy, &dummy, &mx, &my, &dx, &dy, &dui); Bool xqp = XQueryPointer(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen), &dummy, &dummy, &mx, &my, &dx, &dy, &dui);
resize(sel, nx, ny, nw, nh, awesomeconf, True); resize(*awesomeconf->client_sel, nx, ny, nw, nh, awesomeconf, True);
if (xqp && ox <= mx && (ox + ow) >= mx && oy <= my && (oy + oh) >= my) if (xqp && ox <= mx && (ox + ow) >= mx && oy <= my && (oy + oh) >= my)
{ {
nmx = mx-ox+sel->w-ow-1 < 0 ? 0 : mx-ox+sel->w-ow-1; nmx = mx - ox + (*awesomeconf->client_sel)->w - ow - 1 < 0 ? 0 : mx - ox + (*awesomeconf->client_sel)->w - ow - 1;
nmy = my-oy+sel->h-oh-1 < 0 ? 0 : my-oy+sel->h-oh-1; nmy = my - oy + (*awesomeconf->client_sel)->h - oh - 1 < 0 ? 0 : my - oy + (*awesomeconf->client_sel)->h - oh - 1;
XWarpPointer(sel->display, None, sel->win, 0, 0, 0, 0, nmx, nmy); XWarpPointer(awesomeconf->display, None, (*awesomeconf->client_sel)->win, 0, 0, 0, 0, nmx, nmy);
} }
} }
@ -832,18 +833,18 @@ uicb_killclient(Display *disp __attribute__ ((unused)),
{ {
XEvent ev; XEvent ev;
if(!sel) if(!*awesomeconf->client_sel)
return; return;
if(isprotodel(sel)) if(isprotodel(*awesomeconf->client_sel))
{ {
ev.type = ClientMessage; ev.type = ClientMessage;
ev.xclient.window = sel->win; ev.xclient.window = (*awesomeconf->client_sel)->win;
ev.xclient.message_type = XInternAtom(disp, "WM_PROTOCOLS", False); ev.xclient.message_type = XInternAtom(disp, "WM_PROTOCOLS", False);
ev.xclient.format = 32; ev.xclient.format = 32;
ev.xclient.data.l[0] = XInternAtom(disp, "WM_DELETE_WINDOW", False); ev.xclient.data.l[0] = XInternAtom(disp, "WM_DELETE_WINDOW", False);
ev.xclient.data.l[1] = CurrentTime; ev.xclient.data.l[1] = CurrentTime;
XSendEvent(sel->display, sel->win, False, NoEventMask, &ev); XSendEvent(awesomeconf->display, (*awesomeconf->client_sel)->win, False, NoEventMask, &ev);
} }
else else
XKillClient(sel->display, sel->win); XKillClient(awesomeconf->display, (*awesomeconf->client_sel)->win);
} }

View File

@ -194,6 +194,8 @@ struct awesome_config
XftFont *font; XftFont *font;
/** Clients list */ /** Clients list */
Client **clients; Client **clients;
/** Focused client */
Client **client_sel;
}; };
void parse_config(Display *, int, const char *, awesome_config *); /* parse configuration file */ void parse_config(Display *, int, const char *, awesome_config *); /* parse configuration file */

13
event.c
View File

@ -35,9 +35,6 @@
#include "layouts/tile.h" #include "layouts/tile.h"
#include "layouts/floating.h" #include "layouts/floating.h"
/* extern */
extern Client *sel;
#define CLEANMASK(mask, screen) (mask & ~(awesomeconf[screen].numlockmask | LockMask)) #define CLEANMASK(mask, screen) (mask & ~(awesomeconf[screen].numlockmask | LockMask))
#define MOUSEMASK (BUTTONMASK | PointerMotionMask) #define MOUSEMASK (BUTTONMASK | PointerMotionMask)
@ -237,7 +234,7 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
else if(ev->button == Button5) else if(ev->button == Button5)
uicb_settrans(e->xany.display, &awesomeconf[c->screen], "-5"); uicb_settrans(e->xany.display, &awesomeconf[c->screen], "-5");
} }
else if(!sel) else if(!*awesomeconf->client_sel)
for(screen = 0; screen < ScreenCount(e->xany.display); screen++) for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
if(RootWindow(e->xany.display, screen) == ev->window if(RootWindow(e->xany.display, screen) == ev->window
&& XQueryPointer(e->xany.display, ev->window, &wdummy, &wdummy, &x, &y, &i, &i, &udummy)) && XQueryPointer(e->xany.display, ev->window, &wdummy, &wdummy, &x, &y, &i, &i, &udummy))
@ -349,11 +346,11 @@ handle_event_enternotify(XEvent * e, awesome_config *awesomeconf)
return; return;
if((c = getclient(awesomeconf->clients, ev->window))) if((c = getclient(awesomeconf->clients, ev->window)))
{ {
if(!sel || sel != c) if(!*awesomeconf->client_sel || *awesomeconf->client_sel != c)
{ {
focus(c->display, c, ev->same_screen, &awesomeconf[c->screen]); focus(c->display, c, ev->same_screen, &awesomeconf[c->screen]);
if (sel && (sel->isfloating || IS_ARRANGE(sel->screen, layout_floating))) if (*awesomeconf->client_sel && ((*awesomeconf->client_sel)->isfloating || IS_ARRANGE((*awesomeconf->client_sel)->screen, layout_floating)))
grabbuttons(sel, True, False, awesomeconf->modkey, awesomeconf->numlockmask); grabbuttons(*awesomeconf->client_sel, True, False, awesomeconf->modkey, awesomeconf->numlockmask);
} }
} }
else else
@ -472,7 +469,7 @@ handle_event_propertynotify(XEvent * e, awesome_config *awesomeconf)
if(ev->atom == XA_WM_NAME || ev->atom == XInternAtom(c->display, "_NET_WM_NAME", False)) if(ev->atom == XA_WM_NAME || ev->atom == XInternAtom(c->display, "_NET_WM_NAME", False))
{ {
updatetitle(c); updatetitle(c);
if(c == sel) if(c == *awesomeconf->client_sel)
drawstatusbar(e->xany.display, &awesomeconf[c->screen]); drawstatusbar(e->xany.display, &awesomeconf[c->screen]);
} }
} }

View File

@ -29,9 +29,6 @@
#include "statusbar.h" #include "statusbar.h"
#include "layouts/floating.h" #include "layouts/floating.h"
/* extern */
extern Client *sel;
/** Arrange windows following current selected layout /** Arrange windows following current selected layout
* \param disp display ref * \param disp display ref
* \param awesomeconf awesome config * \param awesomeconf awesome config
@ -61,9 +58,9 @@ uicb_focusnext(Display *disp __attribute__ ((unused)),
{ {
Client *c; Client *c;
if(!sel) if(!*awesomeconf->client_sel)
return; return;
for(c = sel->next; c && !isvisible(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); c = c->next); for(c = (*awesomeconf->client_sel)->next; c && !isvisible(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); c = c->next);
if(!c) if(!c)
for(c = *awesomeconf->clients; c && !isvisible(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); c = c->next); for(c = *awesomeconf->clients; c && !isvisible(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); c = c->next);
if(c) if(c)
@ -80,9 +77,9 @@ uicb_focusprev(Display *disp __attribute__ ((unused)),
{ {
Client *c; Client *c;
if(!sel) if(!*awesomeconf->client_sel)
return; return;
for(c = sel->prev; c && !isvisible(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); c = c->prev); for(c = (*awesomeconf->client_sel)->prev; c && !isvisible(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); c = c->prev);
if(!c) if(!c)
{ {
for(c = *awesomeconf->clients; c && c->next; c = c->next); for(c = *awesomeconf->clients; c && c->next; c = c->next);
@ -124,29 +121,29 @@ restack(Display * disp, awesome_config *awesomeconf)
XWindowChanges wc; XWindowChanges wc;
drawstatusbar(disp, awesomeconf); drawstatusbar(disp, awesomeconf);
if(!sel) if(!*awesomeconf->client_sel)
return; return;
if(sel->isfloating || IS_ARRANGE(0, layout_floating)) if((*awesomeconf->client_sel)->isfloating || IS_ARRANGE(0, layout_floating))
XRaiseWindow(disp, sel->win); XRaiseWindow(disp, (*awesomeconf->client_sel)->win);
if(!IS_ARRANGE(0, layout_floating)) if(!IS_ARRANGE(0, layout_floating))
{ {
wc.stack_mode = Below; wc.stack_mode = Below;
wc.sibling = awesomeconf->statusbar.window; wc.sibling = awesomeconf->statusbar.window;
if(!sel->isfloating) if(!(*awesomeconf->client_sel)->isfloating)
{ {
XConfigureWindow(disp, sel->win, CWSibling | CWStackMode, &wc); XConfigureWindow(disp, (*awesomeconf->client_sel)->win, CWSibling | CWStackMode, &wc);
wc.sibling = sel->win; wc.sibling = (*awesomeconf->client_sel)->win;
} }
for(c = *awesomeconf->clients; c; c = c->next) for(c = *awesomeconf->clients; c; c = c->next)
{ {
if(!IS_TILED(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags) || c == sel) if(!IS_TILED(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags) || c == *awesomeconf->client_sel)
continue; continue;
XConfigureWindow(disp, c->win, CWSibling | CWStackMode, &wc); XConfigureWindow(disp, c->win, CWSibling | CWStackMode, &wc);
wc.sibling = c->win; wc.sibling = c->win;
} }
} }
if(awesomeconf->focus_move_pointer) if(awesomeconf->focus_move_pointer)
XWarpPointer(disp, None, sel->win, 0, 0, 0, 0, sel->w / 2, sel->h / 2); XWarpPointer(disp, None, (*awesomeconf->client_sel)->win, 0, 0, 0, 0, (*awesomeconf->client_sel)->w / 2, (*awesomeconf->client_sel)->h / 2);
XSync(disp, False); XSync(disp, False);
while(XCheckMaskEvent(disp, EnterWindowMask, &ev)); while(XCheckMaskEvent(disp, EnterWindowMask, &ev));
} }
@ -192,7 +189,7 @@ uicb_setlayout(Display *disp,
for(c = *awesomeconf->clients; c; c = c->next) for(c = *awesomeconf->clients; c; c = c->next)
c->ftview = True; c->ftview = True;
if(sel) if(*awesomeconf->client_sel)
arrange(disp, awesomeconf); arrange(disp, awesomeconf);
else else
drawstatusbar(disp, awesomeconf); drawstatusbar(disp, awesomeconf);
@ -207,25 +204,30 @@ uicb_setlayout(Display *disp,
static void static void
maximize(int x, int y, int w, int h, awesome_config *awesomeconf) maximize(int x, int y, int w, int h, awesome_config *awesomeconf)
{ {
if(!sel) if(!*awesomeconf->client_sel)
return; return;
if((sel->ismax = !sel->ismax)) if(((*awesomeconf->client_sel)->ismax = !(*awesomeconf->client_sel)->ismax))
{ {
sel->wasfloating = sel->isfloating; (*awesomeconf->client_sel)->wasfloating = (*awesomeconf->client_sel)->isfloating;
sel->isfloating = True; (*awesomeconf->client_sel)->isfloating = True;
sel->rx = sel->x; (*awesomeconf->client_sel)->rx = (*awesomeconf->client_sel)->x;
sel->ry = sel->y; (*awesomeconf->client_sel)->ry = (*awesomeconf->client_sel)->y;
sel->rw = sel->w; (*awesomeconf->client_sel)->rw = (*awesomeconf->client_sel)->w;
sel->rh = sel->h; (*awesomeconf->client_sel)->rh = (*awesomeconf->client_sel)->h;
resize(sel, x, y, w, h, awesomeconf, True); resize(*awesomeconf->client_sel, x, y, w, h, awesomeconf, True);
} }
else if(sel->wasfloating) else if((*awesomeconf->client_sel)->wasfloating)
resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, awesomeconf, True); resize(*awesomeconf->client_sel,
(*awesomeconf->client_sel)->rx,
(*awesomeconf->client_sel)->ry,
(*awesomeconf->client_sel)->rw,
(*awesomeconf->client_sel)->rh,
awesomeconf, True);
else else
sel->isfloating = False; (*awesomeconf->client_sel)->isfloating = False;
arrange(sel->display, awesomeconf); arrange(awesomeconf->display, awesomeconf);
} }
void void
@ -249,9 +251,11 @@ uicb_toggleverticalmax(Display *disp,
{ {
ScreenInfo *si = get_screen_info(disp, awesomeconf->screen, &awesomeconf->statusbar); ScreenInfo *si = get_screen_info(disp, awesomeconf->screen, &awesomeconf->statusbar);
if(sel) if(*awesomeconf->client_sel)
maximize(sel->x, si[awesomeconf->screen].y_org, maximize((*awesomeconf->client_sel)->x,
sel->w, si[awesomeconf->screen].height - 2 * awesomeconf->borderpx, si[awesomeconf->screen].y_org,
(*awesomeconf->client_sel)->w,
si[awesomeconf->screen].height - 2 * awesomeconf->borderpx,
awesomeconf); awesomeconf);
XFree(si); XFree(si);
} }
@ -264,9 +268,11 @@ uicb_togglehorizontalmax(Display *disp,
{ {
ScreenInfo *si = get_screen_info(disp, awesomeconf->screen, &awesomeconf->statusbar); ScreenInfo *si = get_screen_info(disp, awesomeconf->screen, &awesomeconf->statusbar);
if(sel) if(*awesomeconf->client_sel)
maximize(si[awesomeconf->screen].x_org, sel->y, maximize(si[awesomeconf->screen].x_org,
si[awesomeconf->screen].height - 2 * awesomeconf->borderpx, sel->h, (*awesomeconf->client_sel)->y,
si[awesomeconf->screen].height - 2 * awesomeconf->borderpx,
(*awesomeconf->client_sel)->h,
awesomeconf); awesomeconf);
XFree(si); XFree(si);
} }
@ -276,11 +282,11 @@ uicb_zoom(Display *disp __attribute__ ((unused)),
awesome_config *awesomeconf, awesome_config *awesomeconf,
const char *arg __attribute__ ((unused))) const char *arg __attribute__ ((unused)))
{ {
if(!sel) if(!*awesomeconf->client_sel)
return; return;
detach(awesomeconf->clients, sel); detach(awesomeconf->clients, *awesomeconf->client_sel);
attach(awesomeconf->clients, sel); attach(awesomeconf->clients, *awesomeconf->client_sel);
focus(sel->display, sel, True, awesomeconf); focus(awesomeconf->display, *awesomeconf->client_sel, True, awesomeconf);
arrange(sel->display, awesomeconf); arrange(awesomeconf->display, awesomeconf);
} }

View File

@ -24,8 +24,6 @@
#include "tag.h" #include "tag.h"
#include "layout.h" #include "layout.h"
extern Client *sel;
/** Get screens info /** Get screens info
* \param disp Display ref * \param disp Display ref
* \param screen Screen number * \param screen Screen number
@ -236,21 +234,21 @@ uicb_movetoscreen(Display *disp,
{ {
int new_screen, prev_screen; int new_screen, prev_screen;
if(!sel || !XineramaIsActive(disp)) if(!*awesomeconf->client_sel || !XineramaIsActive(disp))
return; return;
if(arg) if(arg)
new_screen = compute_new_value_from_arg(arg, sel->screen); new_screen = compute_new_value_from_arg(arg, (*awesomeconf->client_sel)->screen);
else else
new_screen = sel->screen + 1; new_screen = (*awesomeconf->client_sel)->screen + 1;
if(new_screen >= get_screen_count(disp)) if(new_screen >= get_screen_count(disp))
new_screen = 0; new_screen = 0;
else if(new_screen < 0) else if(new_screen < 0)
new_screen = get_screen_count(disp) - 1; new_screen = get_screen_count(disp) - 1;
prev_screen = sel->screen; prev_screen = (*awesomeconf->client_sel)->screen;
move_client_to_screen(sel, &awesomeconf[new_screen - awesomeconf->screen], True); move_client_to_screen(*awesomeconf->client_sel, &awesomeconf[new_screen - awesomeconf->screen], True);
move_mouse_pointer_to_screen(disp, new_screen); move_mouse_pointer_to_screen(disp, new_screen);
arrange(disp, &awesomeconf[prev_screen - awesomeconf->screen]); arrange(disp, &awesomeconf[prev_screen - awesomeconf->screen]);
arrange(disp, &awesomeconf[new_screen - awesomeconf->screen]); arrange(disp, &awesomeconf[new_screen - awesomeconf->screen]);

View File

@ -28,8 +28,6 @@
#include "util.h" #include "util.h"
#include "layouts/tile.h" #include "layouts/tile.h"
extern Client *sel;
/** Check if at least a client is tagged with tag number t and is on screen /** Check if at least a client is tagged with tag number t and is on screen
* screen * screen
* \param t tag number * \param t tag number
@ -75,7 +73,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
awesomeconf->statusbar.drawable, awesomeconf->statusbar.drawable,
awesomeconf->statusbar.width, awesomeconf->statusbar.width,
awesomeconf->statusbar.height, awesomeconf->statusbar.height,
sel && sel->tags[i], *awesomeconf->client_sel && (*awesomeconf->client_sel)->tags[i],
awesomeconf->colors_selected[ColFG]); awesomeconf->colors_selected[ColFG]);
} }
else else
@ -96,7 +94,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
awesomeconf->statusbar.drawable, awesomeconf->statusbar.drawable,
awesomeconf->statusbar.width, awesomeconf->statusbar.width,
awesomeconf->statusbar.height, awesomeconf->statusbar.height,
sel && sel->tags[i], *awesomeconf->client_sel && (*awesomeconf->client_sel)->tags[i],
awesomeconf->colors_normal[ColFG]); awesomeconf->colors_normal[ColFG]);
} }
x += w; x += w;
@ -129,7 +127,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
if((w = x - z) > awesomeconf->statusbar.height) if((w = x - z) > awesomeconf->statusbar.height)
{ {
x = z; x = z;
if(sel) if(*awesomeconf->client_sel)
{ {
drawtext(disp, awesomeconf->phys_screen, drawtext(disp, awesomeconf->phys_screen,
x, y, w, x, y, w,
@ -138,15 +136,15 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
awesomeconf->statusbar.width, awesomeconf->statusbar.width,
awesomeconf->statusbar.height, awesomeconf->statusbar.height,
awesomeconf->font, awesomeconf->font,
sel->name, awesomeconf->colors_selected); (*awesomeconf->client_sel)->name, awesomeconf->colors_selected);
if(sel->isfloating) if((*awesomeconf->client_sel)->isfloating)
drawcircle(disp, awesomeconf->phys_screen, drawcircle(disp, awesomeconf->phys_screen,
x, y, x, y,
(awesomeconf->font->height + 2) / 4, (awesomeconf->font->height + 2) / 4,
awesomeconf->statusbar.drawable, awesomeconf->statusbar.drawable,
awesomeconf->statusbar.width, awesomeconf->statusbar.width,
awesomeconf->statusbar.height, awesomeconf->statusbar.height,
sel->ismax, (*awesomeconf->client_sel)->ismax,
awesomeconf->colors_selected[ColFG]); awesomeconf->colors_selected[ColFG]);
} }
else if(IS_ARRANGE(0, layout_tile) || IS_ARRANGE(0, layout_tileleft)) else if(IS_ARRANGE(0, layout_tile) || IS_ARRANGE(0, layout_tileleft))

43
tag.c
View File

@ -26,8 +26,6 @@
#include "tag.h" #include "tag.h"
#include "util.h" #include "util.h"
extern Client *sel; /* global client list */
typedef struct typedef struct
{ {
regex_t *propregex; regex_t *propregex;
@ -164,14 +162,14 @@ uicb_tag(Display *disp,
{ {
int i; int i;
if(!sel) if(!*awesomeconf->client_sel)
return; return;
for(i = 0; i < awesomeconf->ntags; i++) for(i = 0; i < awesomeconf->ntags; i++)
sel->tags[i] = arg == NULL; (*awesomeconf->client_sel)->tags[i] = arg == NULL;
i = idxoftag(arg, awesomeconf->tags, awesomeconf->ntags); i = idxoftag(arg, awesomeconf->tags, awesomeconf->ntags);
if(i >= 0 && i < awesomeconf->ntags) if(i >= 0 && i < awesomeconf->ntags)
sel->tags[i] = True; (*awesomeconf->client_sel)->tags[i] = True;
saveprops(sel, awesomeconf->ntags); saveprops(*awesomeconf->client_sel, awesomeconf->ntags);
arrange(disp, awesomeconf); arrange(disp, awesomeconf);
} }
@ -185,21 +183,26 @@ uicb_togglefloating(Display *disp,
awesome_config * awesomeconf, awesome_config * awesomeconf,
const char *arg __attribute__ ((unused))) const char *arg __attribute__ ((unused)))
{ {
if(!sel) if(!*awesomeconf->client_sel)
return; return;
sel->isfloating = !sel->isfloating; (*awesomeconf->client_sel)->isfloating = !(*awesomeconf->client_sel)->isfloating;
if(sel->isfloating) if((*awesomeconf->client_sel)->isfloating)
/*restore last known float dimensions*/ /*restore last known float dimensions*/
resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, awesomeconf, True); resize(*awesomeconf->client_sel,
(*awesomeconf->client_sel)->rx,
(*awesomeconf->client_sel)->ry,
(*awesomeconf->client_sel)->rw,
(*awesomeconf->client_sel)->rh,
awesomeconf, True);
else else
{ {
/*save last known float dimensions*/ /*save last known float dimensions*/
sel->rx = sel->x; (*awesomeconf->client_sel)->rx = (*awesomeconf->client_sel)->x;
sel->ry = sel->y; (*awesomeconf->client_sel)->ry = (*awesomeconf->client_sel)->y;
sel->rw = sel->w; (*awesomeconf->client_sel)->rw = (*awesomeconf->client_sel)->w;
sel->rh = sel->h; (*awesomeconf->client_sel)->rh = (*awesomeconf->client_sel)->h;
} }
saveprops(sel, awesomeconf->ntags); saveprops(*awesomeconf->client_sel, awesomeconf->ntags);
arrange(disp, awesomeconf); arrange(disp, awesomeconf);
} }
@ -216,14 +219,14 @@ uicb_toggletag(Display *disp,
unsigned int i; unsigned int i;
int j; int j;
if(!sel) if(!*awesomeconf->client_sel)
return; return;
i = idxoftag(arg, awesomeconf->tags, awesomeconf->ntags); i = idxoftag(arg, awesomeconf->tags, awesomeconf->ntags);
sel->tags[i] = !sel->tags[i]; (*awesomeconf->client_sel)->tags[i] = !(*awesomeconf->client_sel)->tags[i];
for(j = 0; j < awesomeconf->ntags && !sel->tags[j]; j++); for(j = 0; j < awesomeconf->ntags && !(*awesomeconf->client_sel)->tags[j]; j++);
if(j == awesomeconf->ntags) if(j == awesomeconf->ntags)
sel->tags[i] = True; (*awesomeconf->client_sel)->tags[i] = True;
saveprops(sel, awesomeconf->ntags); saveprops(*awesomeconf->client_sel, awesomeconf->ntags);
arrange(disp, awesomeconf); arrange(disp, awesomeconf);
} }