sel is no more extern
This commit is contained in:
parent
12ef66b79a
commit
c3986a5937
|
@ -40,7 +40,6 @@
|
|||
#include "util.h"
|
||||
#include "statusbar.h"
|
||||
|
||||
Client *sel = NULL;
|
||||
Client *stack = NULL;
|
||||
|
||||
static int (*xerrorxlib) (Display *, XErrorEvent *);
|
||||
|
@ -91,6 +90,7 @@ cleanup(awesome_config *awesomeconf)
|
|||
XSetInputFocus(awesomeconf->display, PointerRoot, RevertToPointerRoot, CurrentTime);
|
||||
XSync(awesomeconf->display, False);
|
||||
p_delete(&awesomeconf->clients);
|
||||
p_delete(&awesomeconf->client_sel);
|
||||
p_delete(&awesomeconf);
|
||||
}
|
||||
|
||||
|
@ -269,7 +269,7 @@ main(int argc, char *argv[])
|
|||
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
|
||||
Atom netatom[NetLast];
|
||||
event_handler **handler;
|
||||
Client **clients;
|
||||
Client **clients, **sel;
|
||||
|
||||
if(argc >= 2)
|
||||
{
|
||||
|
@ -311,12 +311,14 @@ main(int argc, char *argv[])
|
|||
/* allocate stuff */
|
||||
awesomeconf = p_new(awesome_config, get_screen_count(dpy));
|
||||
clients = p_new(Client *, 1);
|
||||
sel = p_new(Client *, 1);
|
||||
|
||||
for(screen = 0; screen < get_screen_count(dpy); screen++)
|
||||
{
|
||||
parse_config(dpy, screen, confpath, &awesomeconf[screen]);
|
||||
setup(&awesomeconf[screen]);
|
||||
awesomeconf[screen].clients = clients;
|
||||
awesomeconf[screen].client_sel = sel;
|
||||
drawstatusbar(dpy, &awesomeconf[screen]);
|
||||
}
|
||||
|
||||
|
|
85
client.c
85
client.c
|
@ -34,7 +34,7 @@
|
|||
#include "layouts/floating.h"
|
||||
|
||||
/* extern */
|
||||
extern Client *sel, *stack; /* global client list and stack */
|
||||
extern Client *stack;
|
||||
|
||||
/** Attach client stack to clients stacks
|
||||
* \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);
|
||||
|
||||
/* 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);
|
||||
XSetWindowBorder(sel->display, sel->win, awesomeconf->colors_normal[ColBorder].pixel);
|
||||
setclienttrans(sel, awesomeconf->opacity_unfocused);
|
||||
grabbuttons(*awesomeconf->client_sel, False, True, awesomeconf->modkey, awesomeconf->numlockmask);
|
||||
XSetWindowBorder(awesomeconf->display, (*awesomeconf->client_sel)->win, awesomeconf->colors_normal[ColBorder].pixel);
|
||||
setclienttrans(*awesomeconf->client_sel, awesomeconf->opacity_unfocused);
|
||||
}
|
||||
if(sel == c)
|
||||
if(*awesomeconf->client_sel == c)
|
||||
return;
|
||||
if(c)
|
||||
{
|
||||
|
@ -345,16 +345,16 @@ focus(Display *disp, Client * c, Bool selscreen, awesome_config *awesomeconf)
|
|||
}
|
||||
if(!selscreen)
|
||||
return;
|
||||
sel = c;
|
||||
*awesomeconf->client_sel = c;
|
||||
drawstatusbar(disp, awesomeconf);
|
||||
if(sel)
|
||||
if(*awesomeconf->client_sel)
|
||||
{
|
||||
XSetWindowBorder(sel->display, sel->win, awesomeconf->colors_selected[ColBorder].pixel);
|
||||
XSetInputFocus(sel->display, sel->win, RevertToPointerRoot, CurrentTime);
|
||||
XSetWindowBorder(awesomeconf->display, (*awesomeconf->client_sel)->win, awesomeconf->colors_selected[ColBorder].pixel);
|
||||
XSetInputFocus(awesomeconf->display, (*awesomeconf->client_sel)->win, RevertToPointerRoot, CurrentTime);
|
||||
for(c = stack; c; c = c->snext)
|
||||
if(c != sel)
|
||||
if(c != *awesomeconf->client_sel)
|
||||
setclienttrans(c, awesomeconf->opacity_unfocused);
|
||||
setclienttrans(sel, -1);
|
||||
setclienttrans(*awesomeconf->client_sel, -1);
|
||||
}
|
||||
else
|
||||
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 */
|
||||
detach(awesomeconf->clients, c);
|
||||
detachstack(c);
|
||||
if(sel == c)
|
||||
if(*awesomeconf->client_sel == c)
|
||||
focus(c->display, NULL, True, awesomeconf);
|
||||
XUngrabButton(c->display, AnyButton, AnyModifier, c->win);
|
||||
setclientstate(c, state);
|
||||
|
@ -697,10 +697,11 @@ uicb_settrans(Display *disp __attribute__ ((unused)),
|
|||
unsigned int current_opacity_raw = 0;
|
||||
int set_prop = 0;
|
||||
|
||||
if(!sel)
|
||||
if(!*awesomeconf->client_sel)
|
||||
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,
|
||||
(unsigned char **) &data);
|
||||
if(data)
|
||||
|
@ -723,9 +724,9 @@ uicb_settrans(Display *disp __attribute__ ((unused)),
|
|||
}
|
||||
|
||||
if(delta == 100.0 && !set_prop)
|
||||
setclienttrans(sel, -1);
|
||||
setclienttrans(*awesomeconf->client_sel, -1);
|
||||
else
|
||||
setclienttrans(sel, delta);
|
||||
setclienttrans(*awesomeconf->client_sel, delta);
|
||||
}
|
||||
|
||||
|
||||
|
@ -754,13 +755,13 @@ uicb_swapnext(Display *disp,
|
|||
{
|
||||
Client *next;
|
||||
|
||||
if(!sel)
|
||||
if(!*awesomeconf->client_sel)
|
||||
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)
|
||||
{
|
||||
client_swap(awesomeconf->clients, sel, next);
|
||||
client_swap(awesomeconf->clients, *awesomeconf->client_sel, next);
|
||||
arrange(disp, awesomeconf);
|
||||
}
|
||||
}
|
||||
|
@ -772,13 +773,13 @@ uicb_swapprev(Display *disp,
|
|||
{
|
||||
Client *prev;
|
||||
|
||||
if(!sel)
|
||||
if(!*awesomeconf->client_sel)
|
||||
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)
|
||||
{
|
||||
client_swap(awesomeconf->clients, prev, sel);
|
||||
client_swap(awesomeconf->clients, prev, *awesomeconf->client_sel);
|
||||
arrange(disp, awesomeconf);
|
||||
}
|
||||
}
|
||||
|
@ -795,27 +796,27 @@ uicb_moveresize(Display *disp __attribute__ ((unused)),
|
|||
Window dummy;
|
||||
|
||||
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;
|
||||
if(sscanf(arg, "%s %s %s %s", x, y, w, h) != 4)
|
||||
return;
|
||||
nx = (int) compute_new_value_from_arg(x, sel->x);
|
||||
ny = (int) compute_new_value_from_arg(y, sel->y);
|
||||
nw = (int) compute_new_value_from_arg(w, sel->w);
|
||||
nh = (int) compute_new_value_from_arg(h, sel->h);
|
||||
nx = (int) compute_new_value_from_arg(x, (*awesomeconf->client_sel)->x);
|
||||
ny = (int) compute_new_value_from_arg(y, (*awesomeconf->client_sel)->y);
|
||||
nw = (int) compute_new_value_from_arg(w, (*awesomeconf->client_sel)->w);
|
||||
nh = (int) compute_new_value_from_arg(h, (*awesomeconf->client_sel)->h);
|
||||
|
||||
ox = sel->x;
|
||||
oy = sel->y;
|
||||
ow = sel->w;
|
||||
oh = sel->h;
|
||||
ox = (*awesomeconf->client_sel)->x;
|
||||
oy = (*awesomeconf->client_sel)->y;
|
||||
ow = (*awesomeconf->client_sel)->w;
|
||||
oh = (*awesomeconf->client_sel)->h;
|
||||
|
||||
Bool xqp = XQueryPointer(sel->display, RootWindow(sel->display, sel->phys_screen), &dummy, &dummy, &mx, &my, &dx, &dy, &dui);
|
||||
resize(sel, nx, ny, nw, nh, awesomeconf, True);
|
||||
Bool xqp = XQueryPointer(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen), &dummy, &dummy, &mx, &my, &dx, &dy, &dui);
|
||||
resize(*awesomeconf->client_sel, nx, ny, nw, nh, awesomeconf, True);
|
||||
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;
|
||||
nmy = my-oy+sel->h-oh-1 < 0 ? 0 : my-oy+sel->h-oh-1;
|
||||
XWarpPointer(sel->display, None, sel->win, 0, 0, 0, 0, nmx, nmy);
|
||||
nmx = mx - ox + (*awesomeconf->client_sel)->w - ow - 1 < 0 ? 0 : mx - ox + (*awesomeconf->client_sel)->w - ow - 1;
|
||||
nmy = my - oy + (*awesomeconf->client_sel)->h - oh - 1 < 0 ? 0 : my - oy + (*awesomeconf->client_sel)->h - oh - 1;
|
||||
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;
|
||||
|
||||
if(!sel)
|
||||
if(!*awesomeconf->client_sel)
|
||||
return;
|
||||
if(isprotodel(sel))
|
||||
if(isprotodel(*awesomeconf->client_sel))
|
||||
{
|
||||
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.format = 32;
|
||||
ev.xclient.data.l[0] = XInternAtom(disp, "WM_DELETE_WINDOW", False);
|
||||
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
|
||||
XKillClient(sel->display, sel->win);
|
||||
XKillClient(awesomeconf->display, (*awesomeconf->client_sel)->win);
|
||||
}
|
||||
|
|
2
config.h
2
config.h
|
@ -194,6 +194,8 @@ struct awesome_config
|
|||
XftFont *font;
|
||||
/** Clients list */
|
||||
Client **clients;
|
||||
/** Focused client */
|
||||
Client **client_sel;
|
||||
};
|
||||
|
||||
void parse_config(Display *, int, const char *, awesome_config *); /* parse configuration file */
|
||||
|
|
13
event.c
13
event.c
|
@ -35,9 +35,6 @@
|
|||
#include "layouts/tile.h"
|
||||
#include "layouts/floating.h"
|
||||
|
||||
/* extern */
|
||||
extern Client *sel;
|
||||
|
||||
#define CLEANMASK(mask, screen) (mask & ~(awesomeconf[screen].numlockmask | LockMask))
|
||||
#define MOUSEMASK (BUTTONMASK | PointerMotionMask)
|
||||
|
||||
|
@ -237,7 +234,7 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
|
|||
else if(ev->button == Button5)
|
||||
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++)
|
||||
if(RootWindow(e->xany.display, screen) == ev->window
|
||||
&& 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;
|
||||
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]);
|
||||
if (sel && (sel->isfloating || IS_ARRANGE(sel->screen, layout_floating)))
|
||||
grabbuttons(sel, True, False, awesomeconf->modkey, awesomeconf->numlockmask);
|
||||
if (*awesomeconf->client_sel && ((*awesomeconf->client_sel)->isfloating || IS_ARRANGE((*awesomeconf->client_sel)->screen, layout_floating)))
|
||||
grabbuttons(*awesomeconf->client_sel, True, False, awesomeconf->modkey, awesomeconf->numlockmask);
|
||||
}
|
||||
}
|
||||
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))
|
||||
{
|
||||
updatetitle(c);
|
||||
if(c == sel)
|
||||
if(c == *awesomeconf->client_sel)
|
||||
drawstatusbar(e->xany.display, &awesomeconf[c->screen]);
|
||||
}
|
||||
}
|
||||
|
|
86
layout.c
86
layout.c
|
@ -29,9 +29,6 @@
|
|||
#include "statusbar.h"
|
||||
#include "layouts/floating.h"
|
||||
|
||||
/* extern */
|
||||
extern Client *sel;
|
||||
|
||||
/** Arrange windows following current selected layout
|
||||
* \param disp display ref
|
||||
* \param awesomeconf awesome config
|
||||
|
@ -61,9 +58,9 @@ uicb_focusnext(Display *disp __attribute__ ((unused)),
|
|||
{
|
||||
Client *c;
|
||||
|
||||
if(!sel)
|
||||
if(!*awesomeconf->client_sel)
|
||||
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)
|
||||
for(c = *awesomeconf->clients; c && !isvisible(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); c = c->next);
|
||||
if(c)
|
||||
|
@ -80,9 +77,9 @@ uicb_focusprev(Display *disp __attribute__ ((unused)),
|
|||
{
|
||||
Client *c;
|
||||
|
||||
if(!sel)
|
||||
if(!*awesomeconf->client_sel)
|
||||
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)
|
||||
{
|
||||
for(c = *awesomeconf->clients; c && c->next; c = c->next);
|
||||
|
@ -124,29 +121,29 @@ restack(Display * disp, awesome_config *awesomeconf)
|
|||
XWindowChanges wc;
|
||||
|
||||
drawstatusbar(disp, awesomeconf);
|
||||
if(!sel)
|
||||
if(!*awesomeconf->client_sel)
|
||||
return;
|
||||
if(sel->isfloating || IS_ARRANGE(0, layout_floating))
|
||||
XRaiseWindow(disp, sel->win);
|
||||
if((*awesomeconf->client_sel)->isfloating || IS_ARRANGE(0, layout_floating))
|
||||
XRaiseWindow(disp, (*awesomeconf->client_sel)->win);
|
||||
if(!IS_ARRANGE(0, layout_floating))
|
||||
{
|
||||
wc.stack_mode = Below;
|
||||
wc.sibling = awesomeconf->statusbar.window;
|
||||
if(!sel->isfloating)
|
||||
if(!(*awesomeconf->client_sel)->isfloating)
|
||||
{
|
||||
XConfigureWindow(disp, sel->win, CWSibling | CWStackMode, &wc);
|
||||
wc.sibling = sel->win;
|
||||
XConfigureWindow(disp, (*awesomeconf->client_sel)->win, CWSibling | CWStackMode, &wc);
|
||||
wc.sibling = (*awesomeconf->client_sel)->win;
|
||||
}
|
||||
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;
|
||||
XConfigureWindow(disp, c->win, CWSibling | CWStackMode, &wc);
|
||||
wc.sibling = c->win;
|
||||
}
|
||||
}
|
||||
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);
|
||||
while(XCheckMaskEvent(disp, EnterWindowMask, &ev));
|
||||
}
|
||||
|
@ -192,7 +189,7 @@ uicb_setlayout(Display *disp,
|
|||
for(c = *awesomeconf->clients; c; c = c->next)
|
||||
c->ftview = True;
|
||||
|
||||
if(sel)
|
||||
if(*awesomeconf->client_sel)
|
||||
arrange(disp, awesomeconf);
|
||||
else
|
||||
drawstatusbar(disp, awesomeconf);
|
||||
|
@ -207,25 +204,30 @@ uicb_setlayout(Display *disp,
|
|||
static void
|
||||
maximize(int x, int y, int w, int h, awesome_config *awesomeconf)
|
||||
{
|
||||
if(!sel)
|
||||
if(!*awesomeconf->client_sel)
|
||||
return;
|
||||
|
||||
if((sel->ismax = !sel->ismax))
|
||||
if(((*awesomeconf->client_sel)->ismax = !(*awesomeconf->client_sel)->ismax))
|
||||
{
|
||||
sel->wasfloating = sel->isfloating;
|
||||
sel->isfloating = True;
|
||||
sel->rx = sel->x;
|
||||
sel->ry = sel->y;
|
||||
sel->rw = sel->w;
|
||||
sel->rh = sel->h;
|
||||
resize(sel, x, y, w, h, awesomeconf, True);
|
||||
(*awesomeconf->client_sel)->wasfloating = (*awesomeconf->client_sel)->isfloating;
|
||||
(*awesomeconf->client_sel)->isfloating = True;
|
||||
(*awesomeconf->client_sel)->rx = (*awesomeconf->client_sel)->x;
|
||||
(*awesomeconf->client_sel)->ry = (*awesomeconf->client_sel)->y;
|
||||
(*awesomeconf->client_sel)->rw = (*awesomeconf->client_sel)->w;
|
||||
(*awesomeconf->client_sel)->rh = (*awesomeconf->client_sel)->h;
|
||||
resize(*awesomeconf->client_sel, x, y, w, h, awesomeconf, True);
|
||||
}
|
||||
else if(sel->wasfloating)
|
||||
resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, awesomeconf, True);
|
||||
else if((*awesomeconf->client_sel)->wasfloating)
|
||||
resize(*awesomeconf->client_sel,
|
||||
(*awesomeconf->client_sel)->rx,
|
||||
(*awesomeconf->client_sel)->ry,
|
||||
(*awesomeconf->client_sel)->rw,
|
||||
(*awesomeconf->client_sel)->rh,
|
||||
awesomeconf, True);
|
||||
else
|
||||
sel->isfloating = False;
|
||||
(*awesomeconf->client_sel)->isfloating = False;
|
||||
|
||||
arrange(sel->display, awesomeconf);
|
||||
arrange(awesomeconf->display, awesomeconf);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -249,9 +251,11 @@ uicb_toggleverticalmax(Display *disp,
|
|||
{
|
||||
ScreenInfo *si = get_screen_info(disp, awesomeconf->screen, &awesomeconf->statusbar);
|
||||
|
||||
if(sel)
|
||||
maximize(sel->x, si[awesomeconf->screen].y_org,
|
||||
sel->w, si[awesomeconf->screen].height - 2 * awesomeconf->borderpx,
|
||||
if(*awesomeconf->client_sel)
|
||||
maximize((*awesomeconf->client_sel)->x,
|
||||
si[awesomeconf->screen].y_org,
|
||||
(*awesomeconf->client_sel)->w,
|
||||
si[awesomeconf->screen].height - 2 * awesomeconf->borderpx,
|
||||
awesomeconf);
|
||||
XFree(si);
|
||||
}
|
||||
|
@ -264,9 +268,11 @@ uicb_togglehorizontalmax(Display *disp,
|
|||
{
|
||||
ScreenInfo *si = get_screen_info(disp, awesomeconf->screen, &awesomeconf->statusbar);
|
||||
|
||||
if(sel)
|
||||
maximize(si[awesomeconf->screen].x_org, sel->y,
|
||||
si[awesomeconf->screen].height - 2 * awesomeconf->borderpx, sel->h,
|
||||
if(*awesomeconf->client_sel)
|
||||
maximize(si[awesomeconf->screen].x_org,
|
||||
(*awesomeconf->client_sel)->y,
|
||||
si[awesomeconf->screen].height - 2 * awesomeconf->borderpx,
|
||||
(*awesomeconf->client_sel)->h,
|
||||
awesomeconf);
|
||||
XFree(si);
|
||||
}
|
||||
|
@ -276,11 +282,11 @@ uicb_zoom(Display *disp __attribute__ ((unused)),
|
|||
awesome_config *awesomeconf,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
if(!sel)
|
||||
if(!*awesomeconf->client_sel)
|
||||
return;
|
||||
detach(awesomeconf->clients, sel);
|
||||
attach(awesomeconf->clients, sel);
|
||||
focus(sel->display, sel, True, awesomeconf);
|
||||
arrange(sel->display, awesomeconf);
|
||||
detach(awesomeconf->clients, *awesomeconf->client_sel);
|
||||
attach(awesomeconf->clients, *awesomeconf->client_sel);
|
||||
focus(awesomeconf->display, *awesomeconf->client_sel, True, awesomeconf);
|
||||
arrange(awesomeconf->display, awesomeconf);
|
||||
}
|
||||
|
||||
|
|
12
screen.c
12
screen.c
|
@ -24,8 +24,6 @@
|
|||
#include "tag.h"
|
||||
#include "layout.h"
|
||||
|
||||
extern Client *sel;
|
||||
|
||||
/** Get screens info
|
||||
* \param disp Display ref
|
||||
* \param screen Screen number
|
||||
|
@ -236,21 +234,21 @@ uicb_movetoscreen(Display *disp,
|
|||
{
|
||||
int new_screen, prev_screen;
|
||||
|
||||
if(!sel || !XineramaIsActive(disp))
|
||||
if(!*awesomeconf->client_sel || !XineramaIsActive(disp))
|
||||
return;
|
||||
|
||||
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
|
||||
new_screen = sel->screen + 1;
|
||||
new_screen = (*awesomeconf->client_sel)->screen + 1;
|
||||
|
||||
if(new_screen >= get_screen_count(disp))
|
||||
new_screen = 0;
|
||||
else if(new_screen < 0)
|
||||
new_screen = get_screen_count(disp) - 1;
|
||||
|
||||
prev_screen = sel->screen;
|
||||
move_client_to_screen(sel, &awesomeconf[new_screen - awesomeconf->screen], True);
|
||||
prev_screen = (*awesomeconf->client_sel)->screen;
|
||||
move_client_to_screen(*awesomeconf->client_sel, &awesomeconf[new_screen - awesomeconf->screen], True);
|
||||
move_mouse_pointer_to_screen(disp, new_screen);
|
||||
arrange(disp, &awesomeconf[prev_screen - awesomeconf->screen]);
|
||||
arrange(disp, &awesomeconf[new_screen - awesomeconf->screen]);
|
||||
|
|
14
statusbar.c
14
statusbar.c
|
@ -28,8 +28,6 @@
|
|||
#include "util.h"
|
||||
#include "layouts/tile.h"
|
||||
|
||||
extern Client *sel;
|
||||
|
||||
/** Check if at least a client is tagged with tag number t and is on screen
|
||||
* screen
|
||||
* \param t tag number
|
||||
|
@ -75,7 +73,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
|
|||
awesomeconf->statusbar.drawable,
|
||||
awesomeconf->statusbar.width,
|
||||
awesomeconf->statusbar.height,
|
||||
sel && sel->tags[i],
|
||||
*awesomeconf->client_sel && (*awesomeconf->client_sel)->tags[i],
|
||||
awesomeconf->colors_selected[ColFG]);
|
||||
}
|
||||
else
|
||||
|
@ -96,7 +94,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
|
|||
awesomeconf->statusbar.drawable,
|
||||
awesomeconf->statusbar.width,
|
||||
awesomeconf->statusbar.height,
|
||||
sel && sel->tags[i],
|
||||
*awesomeconf->client_sel && (*awesomeconf->client_sel)->tags[i],
|
||||
awesomeconf->colors_normal[ColFG]);
|
||||
}
|
||||
x += w;
|
||||
|
@ -129,7 +127,7 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
|
|||
if((w = x - z) > awesomeconf->statusbar.height)
|
||||
{
|
||||
x = z;
|
||||
if(sel)
|
||||
if(*awesomeconf->client_sel)
|
||||
{
|
||||
drawtext(disp, awesomeconf->phys_screen,
|
||||
x, y, w,
|
||||
|
@ -138,15 +136,15 @@ drawstatusbar(Display *disp, awesome_config * awesomeconf)
|
|||
awesomeconf->statusbar.width,
|
||||
awesomeconf->statusbar.height,
|
||||
awesomeconf->font,
|
||||
sel->name, awesomeconf->colors_selected);
|
||||
if(sel->isfloating)
|
||||
(*awesomeconf->client_sel)->name, awesomeconf->colors_selected);
|
||||
if((*awesomeconf->client_sel)->isfloating)
|
||||
drawcircle(disp, awesomeconf->phys_screen,
|
||||
x, y,
|
||||
(awesomeconf->font->height + 2) / 4,
|
||||
awesomeconf->statusbar.drawable,
|
||||
awesomeconf->statusbar.width,
|
||||
awesomeconf->statusbar.height,
|
||||
sel->ismax,
|
||||
(*awesomeconf->client_sel)->ismax,
|
||||
awesomeconf->colors_selected[ColFG]);
|
||||
}
|
||||
else if(IS_ARRANGE(0, layout_tile) || IS_ARRANGE(0, layout_tileleft))
|
||||
|
|
43
tag.c
43
tag.c
|
@ -26,8 +26,6 @@
|
|||
#include "tag.h"
|
||||
#include "util.h"
|
||||
|
||||
extern Client *sel; /* global client list */
|
||||
|
||||
typedef struct
|
||||
{
|
||||
regex_t *propregex;
|
||||
|
@ -164,14 +162,14 @@ uicb_tag(Display *disp,
|
|||
{
|
||||
int i;
|
||||
|
||||
if(!sel)
|
||||
if(!*awesomeconf->client_sel)
|
||||
return;
|
||||
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);
|
||||
if(i >= 0 && i < awesomeconf->ntags)
|
||||
sel->tags[i] = True;
|
||||
saveprops(sel, awesomeconf->ntags);
|
||||
(*awesomeconf->client_sel)->tags[i] = True;
|
||||
saveprops(*awesomeconf->client_sel, awesomeconf->ntags);
|
||||
arrange(disp, awesomeconf);
|
||||
}
|
||||
|
||||
|
@ -185,21 +183,26 @@ uicb_togglefloating(Display *disp,
|
|||
awesome_config * awesomeconf,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
if(!sel)
|
||||
if(!*awesomeconf->client_sel)
|
||||
return;
|
||||
sel->isfloating = !sel->isfloating;
|
||||
if(sel->isfloating)
|
||||
(*awesomeconf->client_sel)->isfloating = !(*awesomeconf->client_sel)->isfloating;
|
||||
if((*awesomeconf->client_sel)->isfloating)
|
||||
/*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
|
||||
{
|
||||
/*save last known float dimensions*/
|
||||
sel->rx = sel->x;
|
||||
sel->ry = sel->y;
|
||||
sel->rw = sel->w;
|
||||
sel->rh = sel->h;
|
||||
(*awesomeconf->client_sel)->rx = (*awesomeconf->client_sel)->x;
|
||||
(*awesomeconf->client_sel)->ry = (*awesomeconf->client_sel)->y;
|
||||
(*awesomeconf->client_sel)->rw = (*awesomeconf->client_sel)->w;
|
||||
(*awesomeconf->client_sel)->rh = (*awesomeconf->client_sel)->h;
|
||||
}
|
||||
saveprops(sel, awesomeconf->ntags);
|
||||
saveprops(*awesomeconf->client_sel, awesomeconf->ntags);
|
||||
arrange(disp, awesomeconf);
|
||||
}
|
||||
|
||||
|
@ -216,14 +219,14 @@ uicb_toggletag(Display *disp,
|
|||
unsigned int i;
|
||||
int j;
|
||||
|
||||
if(!sel)
|
||||
if(!*awesomeconf->client_sel)
|
||||
return;
|
||||
i = idxoftag(arg, awesomeconf->tags, awesomeconf->ntags);
|
||||
sel->tags[i] = !sel->tags[i];
|
||||
for(j = 0; j < awesomeconf->ntags && !sel->tags[j]; j++);
|
||||
(*awesomeconf->client_sel)->tags[i] = !(*awesomeconf->client_sel)->tags[i];
|
||||
for(j = 0; j < awesomeconf->ntags && !(*awesomeconf->client_sel)->tags[j]; j++);
|
||||
if(j == awesomeconf->ntags)
|
||||
sel->tags[i] = True;
|
||||
saveprops(sel, awesomeconf->ntags);
|
||||
(*awesomeconf->client_sel)->tags[i] = True;
|
||||
saveprops(*awesomeconf->client_sel, awesomeconf->ntags);
|
||||
arrange(disp, awesomeconf);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue