remove global client_sel, use tag's client_sel

This commit is contained in:
Julien Danjou 2007-10-26 23:19:13 +02:00
parent 9d507dc50c
commit 001f430c0c
9 changed files with 126 additions and 134 deletions

View File

@ -101,7 +101,6 @@ 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);
}
@ -300,7 +299,6 @@ main(int argc, char *argv[])
parse_config(dpy, screen, confpath, &awesomeconf[screen]);
setup(&awesomeconf[screen]);
awesomeconf[screen].clients = clients;
awesomeconf[screen].client_sel = sel;
initstatusbar(awesomeconf[screen].display, screen, &awesomeconf[screen].statusbar,
awesomeconf[screen].cursor[CurNormal], awesomeconf[screen].font,
awesomeconf[screen].layouts, awesomeconf[screen].nlayouts);

View File

@ -176,21 +176,26 @@ client_detach(Client **head, Client *c)
void
focus(Client *c, Bool selscreen, awesome_config *awesomeconf)
{
Tag *tag;
int i;
Tag *tag = get_current_tag(awesomeconf->tags, awesomeconf->ntags);
/* if c is NULL or invisible, take next client in the stack */
if((!c && selscreen) || (c && !isvisible(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags)))
for(c = *awesomeconf->clients; c && !isvisible(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); c = c->next);
/* if a client was selected but it's not the current client, unfocus it */
if(*awesomeconf->client_sel && *awesomeconf->client_sel != c)
/* XXX unfocus other tags clients, this is a bit too much */
for(i = 0; i < awesomeconf->ntags; i++)
if(awesomeconf->tags[i].client_sel)
{
window_grabbuttons((*awesomeconf->client_sel)->display,
(*awesomeconf->client_sel)->phys_screen,
(*awesomeconf->client_sel)->win,
window_grabbuttons(awesomeconf->tags[i].client_sel->display,
awesomeconf->tags[i].client_sel->phys_screen,
awesomeconf->tags[i].client_sel->win,
False, True, awesomeconf->modkey, awesomeconf->numlockmask);
XSetWindowBorder(awesomeconf->display, (*awesomeconf->client_sel)->win, awesomeconf->colors_normal[ColBorder].pixel);
window_settrans(awesomeconf->display, (*awesomeconf->client_sel)->win, awesomeconf->opacity_unfocused);
XSetWindowBorder(awesomeconf->tags[i].client_sel->display,
awesomeconf->tags[i].client_sel->win,
awesomeconf->colors_normal[ColBorder].pixel);
window_settrans(awesomeconf->tags[i].client_sel->display,
awesomeconf->tags[i].client_sel->win, awesomeconf->opacity_unfocused);
}
if(c)
{
@ -199,24 +204,20 @@ focus(Client *c, Bool selscreen, awesome_config *awesomeconf)
else
XSetWindowBorder(awesomeconf->display, c->win, awesomeconf->colors_selected[ColBorder].pixel);
}
if(*awesomeconf->client_sel == c)
return;
if(c)
window_grabbuttons(c->display, c->phys_screen, c->win,
True, True, awesomeconf->modkey, awesomeconf->numlockmask);
if(!selscreen)
return;
*awesomeconf->client_sel = c;
if((tag = get_current_tag(awesomeconf->tags, awesomeconf->ntags)))
tag->client_sel = c;
drawstatusbar(awesomeconf);
if(*awesomeconf->client_sel)
if(tag->client_sel)
{
XSetInputFocus(awesomeconf->display, (*awesomeconf->client_sel)->win, RevertToPointerRoot, CurrentTime);
XSetInputFocus(tag->client_sel->display, tag->client_sel->win, RevertToPointerRoot, CurrentTime);
for(c = *awesomeconf->clients; c; c = c->next)
if(c != *awesomeconf->client_sel)
window_settrans(awesomeconf->display, (*awesomeconf->client_sel)->win, awesomeconf->opacity_unfocused);
window_settrans(awesomeconf->display, (*awesomeconf->client_sel)->win, -1);
if(c != tag->client_sel)
window_settrans(awesomeconf->display, tag->client_sel->win, awesomeconf->opacity_unfocused);
window_settrans(awesomeconf->display, tag->client_sel->win, -1);
}
else
XSetInputFocus(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen), RevertToPointerRoot, CurrentTime);
@ -497,7 +498,7 @@ client_unmanage(Client *c, long state, awesome_config *awesomeconf)
XGrabServer(c->display);
XConfigureWindow(c->display, c->win, CWBorderWidth, &wc); /* restore border */
client_detach(awesomeconf->clients, c);
if(*awesomeconf->client_sel == c)
if(get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel == c)
focus(NULL, True, awesomeconf);
for(tag = 0; tag < awesomeconf->ntags; tag++)
if(awesomeconf->tags[tag].client_sel == c)
@ -583,7 +584,7 @@ updatesizehints(Client *c)
* \ingroup ui_callback
*/
void
uicb_settrans(awesome_config *awesomeconf __attribute__ ((unused)),
uicb_settrans(awesome_config *awesomeconf,
const char *arg)
{
double delta = 100.0, current_opacity = 100.0;
@ -593,12 +594,13 @@ uicb_settrans(awesome_config *awesomeconf __attribute__ ((unused)),
unsigned long n, left;
unsigned int current_opacity_raw = 0;
int set_prop = 0;
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
if(!*awesomeconf->client_sel)
if(!sel)
return;
XGetWindowProperty(awesomeconf->display, (*awesomeconf->client_sel)->win,
XInternAtom((*awesomeconf->client_sel)->display, "_NET_WM_WINDOW_OPACITY", False),
XGetWindowProperty(awesomeconf->display, sel->win,
XInternAtom(sel->display, "_NET_WM_WINDOW_OPACITY", False),
0L, 1L, False, XA_CARDINAL, &actual, &format, &n, &left,
(unsigned char **) &data);
if(data)
@ -621,9 +623,9 @@ uicb_settrans(awesome_config *awesomeconf __attribute__ ((unused)),
}
if(delta == 100.0 && !set_prop)
window_settrans((*awesomeconf->client_sel)->display, (*awesomeconf->client_sel)->win, -1);
window_settrans(sel->display, sel->win, -1);
else
window_settrans((*awesomeconf->client_sel)->display, (*awesomeconf->client_sel)->win, delta);
window_settrans(sel->display, sel->win, delta);
}
@ -647,7 +649,7 @@ void
uicb_swapnext(awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
Client *next, *sel = *awesomeconf->client_sel;
Client *next, *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
if(!sel)
return;
@ -655,7 +657,7 @@ uicb_swapnext(awesome_config *awesomeconf,
for(next = sel->next; next && !isvisible(next, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); next = next->next);
if(next)
{
client_swap(awesomeconf->clients, *awesomeconf->client_sel, next);
client_swap(awesomeconf->clients, sel, next);
arrange(awesomeconf);
/* restore focus */
focus(sel, True, awesomeconf);
@ -666,7 +668,7 @@ void
uicb_swapprev(awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
Client *prev, *sel = *awesomeconf->client_sel;
Client *prev, *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
if(!sel)
return;
@ -674,7 +676,7 @@ uicb_swapprev(awesome_config *awesomeconf,
for(prev = sel->prev; prev && !isvisible(prev, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); prev = prev->prev);
if(prev)
{
client_swap(awesomeconf->clients, prev, *awesomeconf->client_sel);
client_swap(awesomeconf->clients, prev, sel);
arrange(awesomeconf);
/* restore focus */
focus(sel, True, awesomeconf);
@ -690,29 +692,30 @@ uicb_moveresize(awesome_config *awesomeconf,
int mx, my, dx, dy, nmx, nmy;
unsigned int dui;
Window dummy;
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
if(get_current_layout(awesomeconf->tags, awesomeconf->ntags)->arrange != layout_floating)
if(!*awesomeconf->client_sel || !(*awesomeconf->client_sel)->isfloating || (*awesomeconf->client_sel)->isfixed || !arg)
if(!sel || !sel->isfloating || 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, (*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);
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);
ox = (*awesomeconf->client_sel)->x;
oy = (*awesomeconf->client_sel)->y;
ow = (*awesomeconf->client_sel)->w;
oh = (*awesomeconf->client_sel)->h;
ox = sel->x;
oy = sel->y;
ow = sel->w;
oh = sel->h;
Bool xqp = XQueryPointer(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen), &dummy, &dummy, &mx, &my, &dx, &dy, &dui);
client_resize(*awesomeconf->client_sel, nx, ny, nw, nh, awesomeconf, True);
client_resize(sel, nx, ny, nw, nh, awesomeconf, True);
if (xqp && ox <= mx && (ox + ow) >= mx && oy <= my && (oy + oh) >= my)
{
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);
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(awesomeconf->display, None, sel->win, 0, 0, 0, 0, nmx, nmy);
}
}
@ -726,9 +729,9 @@ uicb_killclient(awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
XEvent ev;
Client *sel = *awesomeconf->client_sel;
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
if(!*awesomeconf->client_sel)
if(!sel)
return;
if(isprotodel(sel->display, sel->win))
{

View File

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

18
event.c
View File

@ -234,7 +234,7 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
else if(ev->button == Button5)
uicb_settrans(&awesomeconf[c->screen], "-5");
}
else if(!*awesomeconf->client_sel)
else if(!get_current_tag(awesomeconf->tags, awesomeconf->ntags)->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))
@ -354,20 +354,14 @@ handle_event_enternotify(XEvent * e, awesome_config *awesomeconf)
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
return;
if((c = get_client_bywin(*awesomeconf->clients, ev->window)))
{
if(!*awesomeconf->client_sel || *awesomeconf->client_sel != c)
{
focus(c, ev->same_screen, &awesomeconf[c->screen]);
if (*awesomeconf->client_sel
&& ((*awesomeconf->client_sel)->isfloating
|| get_current_layout(awesomeconf[(*awesomeconf->client_sel)->screen].tags,
awesomeconf[(*awesomeconf->client_sel)->screen].ntags)->arrange == layout_floating))
window_grabbuttons((*awesomeconf->client_sel)->display,
(*awesomeconf->client_sel)->phys_screen,
(*awesomeconf->client_sel)->win,
if (c->isfloating
|| get_current_layout(awesomeconf[c->screen].tags,
awesomeconf[c->screen].ntags)->arrange == layout_floating)
window_grabbuttons(c->display, c->phys_screen, c->win,
True, False, awesomeconf->modkey, awesomeconf->numlockmask);
}
}
else
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
if(ev->window == RootWindow(e->xany.display, screen))
@ -493,7 +487,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 == *awesomeconf->client_sel)
if(c == get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel)
drawstatusbar(&awesomeconf[c->screen]);
}
}

View File

@ -54,7 +54,7 @@ void
arrange(awesome_config *awesomeconf)
{
Client *c;
Tag *curtag;
Tag *curtag = get_current_tag(awesomeconf->tags, awesomeconf->ntags);
for(c = *awesomeconf->clients; c; c = c->next)
{
@ -64,13 +64,9 @@ arrange(awesome_config *awesomeconf)
else if(c->screen == awesomeconf->screen)
client_ban(c);
}
if ((curtag = get_current_tag(awesomeconf->tags, awesomeconf->ntags)))
{
curtag->layout->arrange(awesomeconf);
focus(curtag->client_sel, True, awesomeconf);
}
else
focus(NULL, True, awesomeconf);
restack(awesomeconf);
}
@ -89,11 +85,11 @@ void
uicb_focusnext(awesome_config * awesomeconf,
const char *arg __attribute__ ((unused)))
{
Client *c;
Client *c, *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
if(!*awesomeconf->client_sel)
if(!sel)
return;
for(c = (*awesomeconf->client_sel)->next; c && !isvisible(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); c = c->next);
for(c = 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)
@ -107,11 +103,11 @@ void
uicb_focusprev(awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
Client *c;
Client *c, *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
if(!*awesomeconf->client_sel)
if(!sel)
return;
for(c = (*awesomeconf->client_sel)->prev; c && !isvisible(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); c = c->prev);
for(c = 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);
@ -146,32 +142,32 @@ loadawesomeprops(awesome_config * awesomeconf)
void
restack(awesome_config *awesomeconf)
{
Client *c;
Client *c, *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
XEvent ev;
XWindowChanges wc;
drawstatusbar(awesomeconf);
if(!*awesomeconf->client_sel)
if(!sel)
return;
if(awesomeconf->allow_lower_floats)
XRaiseWindow(awesomeconf->display, (*awesomeconf->client_sel)->win);
XRaiseWindow(awesomeconf->display, sel->win);
else
{
if((*awesomeconf->client_sel)->isfloating ||
(get_current_layout(awesomeconf->tags, awesomeconf->ntags)->arrange == layout_floating))
XRaiseWindow(awesomeconf->display, (*awesomeconf->client_sel)->win);
if(sel->isfloating ||
get_current_layout(awesomeconf->tags, awesomeconf->ntags)->arrange == layout_floating)
XRaiseWindow(sel->display, sel->win);
if(!(get_current_layout(awesomeconf->tags, awesomeconf->ntags)->arrange == layout_floating))
{
wc.stack_mode = Below;
wc.sibling = awesomeconf->statusbar.window;
if(!(*awesomeconf->client_sel)->isfloating)
if(!sel->isfloating)
{
XConfigureWindow(awesomeconf->display, (*awesomeconf->client_sel)->win, CWSibling | CWStackMode, &wc);
wc.sibling = (*awesomeconf->client_sel)->win;
XConfigureWindow(sel->display, sel->win, CWSibling | CWStackMode, &wc);
wc.sibling = sel->win;
}
for(c = *awesomeconf->clients; c; c = c->next)
{
if(!IS_TILED(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags) || c == *awesomeconf->client_sel)
if(!IS_TILED(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags) || c == sel)
continue;
XConfigureWindow(awesomeconf->display, c->win, CWSibling | CWStackMode, &wc);
wc.sibling = c->win;
@ -179,7 +175,7 @@ restack(awesome_config *awesomeconf)
}
}
if(awesomeconf->focus_move_pointer)
XWarpPointer(awesomeconf->display, None, (*awesomeconf->client_sel)->win, 0, 0, 0, 0, (*awesomeconf->client_sel)->w / 2, (*awesomeconf->client_sel)->h / 2);
XWarpPointer(awesomeconf->display, None, sel->win, 0, 0, 0, 0, sel->w / 2, sel->h / 2);
XSync(awesomeconf->display, False);
while(XCheckMaskEvent(awesomeconf->display, EnterWindowMask, &ev));
}
@ -224,7 +220,7 @@ uicb_setlayout(awesome_config * awesomeconf,
if (awesomeconf->tags[j].selected)
awesomeconf->tags[j].layout = &awesomeconf->layouts[i];
if(*awesomeconf->client_sel)
if(get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel)
arrange(awesomeconf);
else
drawstatusbar(awesomeconf);
@ -235,7 +231,7 @@ uicb_setlayout(awesome_config * awesomeconf,
static void
maximize(int x, int y, int w, int h, awesome_config *awesomeconf)
{
Client *sel = *awesomeconf->client_sel;
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
if(!sel)
return;
@ -275,12 +271,13 @@ void
uicb_toggleverticalmax(awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
ScreenInfo *si = get_screen_info(awesomeconf->display, awesomeconf->screen, &awesomeconf->statusbar);
if(*awesomeconf->client_sel)
maximize((*awesomeconf->client_sel)->x,
if(sel)
maximize(sel->x,
si[awesomeconf->screen].y_org,
(*awesomeconf->client_sel)->w,
sel->w,
si[awesomeconf->screen].height - 2 * awesomeconf->borderpx,
awesomeconf);
p_delete(&si);
@ -291,13 +288,14 @@ void
uicb_togglehorizontalmax(awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
ScreenInfo *si = get_screen_info(awesomeconf->display, awesomeconf->screen, &awesomeconf->statusbar);
if(*awesomeconf->client_sel)
if(sel)
maximize(si[awesomeconf->screen].x_org,
(*awesomeconf->client_sel)->y,
sel->y,
si[awesomeconf->screen].height - 2 * awesomeconf->borderpx,
(*awesomeconf->client_sel)->h,
sel->h,
awesomeconf);
p_delete(&si);
}
@ -306,9 +304,9 @@ void
uicb_zoom(awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
Client *c, *sel = *awesomeconf->client_sel;
Client *c, *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
if(!*awesomeconf->client_sel)
if(!sel)
return;
client_detach(awesomeconf->clients, sel);

View File

@ -253,22 +253,23 @@ uicb_movetoscreen(awesome_config * awesomeconf,
const char *arg)
{
int new_screen, prev_screen;
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
if(!*awesomeconf->client_sel || !XineramaIsActive(awesomeconf->display))
if(!sel || !XineramaIsActive(awesomeconf->display))
return;
if(arg)
new_screen = compute_new_value_from_arg(arg, (*awesomeconf->client_sel)->screen);
new_screen = compute_new_value_from_arg(arg, sel->screen);
else
new_screen = (*awesomeconf->client_sel)->screen + 1;
new_screen = sel->screen + 1;
if(new_screen >= get_screen_count(awesomeconf->display))
new_screen = 0;
else if(new_screen < 0)
new_screen = get_screen_count(awesomeconf->display) - 1;
prev_screen = (*awesomeconf->client_sel)->screen;
move_client_to_screen(*awesomeconf->client_sel, &awesomeconf[new_screen - awesomeconf->screen], True);
prev_screen = sel->screen;
move_client_to_screen(sel, &awesomeconf[new_screen - awesomeconf->screen], True);
move_mouse_pointer_to_screen(awesomeconf->display, new_screen);
arrange(&awesomeconf[prev_screen - awesomeconf->screen]);
arrange(&awesomeconf[new_screen - awesomeconf->screen]);

View File

@ -49,6 +49,7 @@ void
drawstatusbar(awesome_config * awesomeconf)
{
int z, i, x = 0, y = 0, w;
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
for(i = 0; i < awesomeconf->ntags; i++)
{
@ -72,7 +73,7 @@ drawstatusbar(awesome_config * awesomeconf)
awesomeconf->statusbar.drawable,
awesomeconf->statusbar.width,
awesomeconf->statusbar.height,
*awesomeconf->client_sel && (*awesomeconf->client_sel)->tags[i],
sel && sel->tags[i],
awesomeconf->colors_selected[ColFG]);
}
else
@ -93,7 +94,7 @@ drawstatusbar(awesome_config * awesomeconf)
awesomeconf->statusbar.drawable,
awesomeconf->statusbar.width,
awesomeconf->statusbar.height,
*awesomeconf->client_sel && (*awesomeconf->client_sel)->tags[i],
sel && sel->tags[i],
awesomeconf->colors_normal[ColFG]);
}
x += w;
@ -126,7 +127,7 @@ drawstatusbar(awesome_config * awesomeconf)
if((w = x - z) > awesomeconf->statusbar.height)
{
x = z;
if(*awesomeconf->client_sel && (*awesomeconf->client_sel)->screen == awesomeconf->screen)
if(sel && sel->screen == awesomeconf->screen)
{
drawtext(awesomeconf->display, awesomeconf->phys_screen,
x, y, w,
@ -135,15 +136,15 @@ drawstatusbar(awesome_config * awesomeconf)
awesomeconf->statusbar.width,
awesomeconf->statusbar.height,
awesomeconf->font,
(*awesomeconf->client_sel)->name, awesomeconf->colors_selected);
if((*awesomeconf->client_sel)->isfloating)
sel->name, awesomeconf->colors_selected);
if(sel->isfloating)
drawcircle(awesomeconf->display, awesomeconf->phys_screen,
x, y,
(awesomeconf->font->height + 2) / 4,
awesomeconf->statusbar.drawable,
awesomeconf->statusbar.width,
awesomeconf->statusbar.height,
(*awesomeconf->client_sel)->ismax,
sel->ismax,
awesomeconf->colors_selected[ColFG]);
}
else

8
tab.c
View File

@ -55,7 +55,7 @@ uicb_tab(awesome_config *awesomeconf,
int x1, y1, di;
unsigned int dui;
XEvent ev;
Client *sel = *awesomeconf->client_sel, *c = NULL, *tmp;
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel, *c = NULL, *tmp;
if(XGrabPointer(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen),
False, ButtonPressMask, GrabModeAsync, GrabModeAsync, None,
@ -99,7 +99,7 @@ void
uicb_untab(awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
Client *sel = *awesomeconf->client_sel;
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
if(!sel)
return;
@ -113,7 +113,7 @@ void
uicb_viewnexttab(awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
Client *sel = *awesomeconf->client_sel;
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
if(!sel || !sel->tab.next)
return;
@ -128,7 +128,7 @@ void
uicb_viewprevtab(awesome_config *awesomeconf,
const char *arg __attribute__ ((unused)))
{
Client *sel = *awesomeconf->client_sel;
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
if(!sel || !sel->tab.prev)
return;

37
tag.c
View File

@ -149,15 +149,16 @@ uicb_tag(awesome_config *awesomeconf,
const char *arg)
{
int i;
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
if(!*awesomeconf->client_sel)
if(!sel)
return;
for(i = 0; i < awesomeconf->ntags; i++)
(*awesomeconf->client_sel)->tags[i] = arg == NULL;
sel->tags[i] = arg == NULL;
i = idxoftag(arg, awesomeconf->tags, awesomeconf->ntags);
if(i >= 0 && i < awesomeconf->ntags)
(*awesomeconf->client_sel)->tags[i] = True;
saveprops(*awesomeconf->client_sel, awesomeconf->ntags);
sel->tags[i] = True;
saveprops(sel, awesomeconf->ntags);
arrange(awesomeconf);
}
@ -169,20 +170,17 @@ void
uicb_togglefloating(awesome_config * awesomeconf,
const char *arg __attribute__ ((unused)))
{
if(!*awesomeconf->client_sel)
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
if(!sel)
return;
(*awesomeconf->client_sel)->isfloating = !(*awesomeconf->client_sel)->isfloating;
sel->isfloating = !sel->isfloating;
client_resize(*awesomeconf->client_sel,
(*awesomeconf->client_sel)->rx,
(*awesomeconf->client_sel)->ry,
(*awesomeconf->client_sel)->rw,
(*awesomeconf->client_sel)->rh,
awesomeconf, True);
client_resize(sel, sel->rx, sel->ry, sel->rw, sel->rh, awesomeconf, True);
client_untab(*awesomeconf->client_sel);
saveprops(*awesomeconf->client_sel, awesomeconf->ntags);
client_untab(sel);
saveprops(sel, awesomeconf->ntags);
arrange(awesomeconf);
}
@ -194,17 +192,18 @@ void
uicb_toggletag(awesome_config *awesomeconf,
const char *arg)
{
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
unsigned int i;
int j;
if(!*awesomeconf->client_sel)
if(!sel)
return;
i = idxoftag(arg, awesomeconf->tags, awesomeconf->ntags);
(*awesomeconf->client_sel)->tags[i] = !(*awesomeconf->client_sel)->tags[i];
for(j = 0; j < awesomeconf->ntags && !(*awesomeconf->client_sel)->tags[j]; j++);
sel->tags[i] = !sel->tags[i];
for(j = 0; j < awesomeconf->ntags && !sel->tags[j]; j++);
if(j == awesomeconf->ntags)
(*awesomeconf->client_sel)->tags[i] = True;
saveprops(*awesomeconf->client_sel, awesomeconf->ntags);
sel->tags[i] = True;
saveprops(sel, awesomeconf->ntags);
arrange(awesomeconf);
}