split awesomeconf and screen config
a.k.a the big post-2.0 blind commit
This commit is contained in:
parent
db65eac4b8
commit
5fa67c23df
134
awesome.c
134
awesome.c
|
@ -65,21 +65,52 @@ cleanup_buttons(Button *buttons)
|
|||
}
|
||||
|
||||
void
|
||||
cleanup_screen(awesome_config *awesomeconf)
|
||||
cleanup_screen(awesome_config *awesomeconf, int screen)
|
||||
{
|
||||
int i;
|
||||
Key *k, *kn;
|
||||
Rule *r, *rn;
|
||||
|
||||
XftFontClose(awesomeconf->display, awesomeconf->font);
|
||||
XUngrabKey(awesomeconf->display, AnyKey, AnyModifier, RootWindow(awesomeconf->display, awesomeconf->phys_screen));
|
||||
XDestroyWindow(awesomeconf->display, awesomeconf->statusbar.window);
|
||||
XftFontClose(awesomeconf->display, awesomeconf->screens[screen].font);
|
||||
XUngrabKey(awesomeconf->display, AnyKey, AnyModifier, RootWindow(awesomeconf->display, get_phys_screen(awesomeconf->display, screen)));
|
||||
XDestroyWindow(awesomeconf->display, awesomeconf->screens[screen].statusbar.window);
|
||||
|
||||
for(i = 0; i < awesomeconf->screens[screen].ntags; i++)
|
||||
p_delete(&awesomeconf->screens[screen].tags[i].name);
|
||||
|
||||
for(i = 0; i < awesomeconf->screens[screen].nlayouts; i++)
|
||||
p_delete(&awesomeconf->screens[screen].layouts[i].symbol);
|
||||
|
||||
p_delete(&awesomeconf->screens[screen].tags);
|
||||
p_delete(&awesomeconf->screens[screen].layouts);
|
||||
}
|
||||
|
||||
/** Cleanup everything on quit
|
||||
* \param awesomeconf awesome config
|
||||
*/
|
||||
static void
|
||||
cleanup(awesome_config *awesomeconf)
|
||||
{
|
||||
int screen;
|
||||
Rule *r, *rn;
|
||||
Key *k, *kn;
|
||||
|
||||
while(awesomeconf->clients)
|
||||
{
|
||||
client_unban(awesomeconf->clients);
|
||||
client_unmanage(awesomeconf->clients, NormalState, awesomeconf);
|
||||
}
|
||||
|
||||
XFreeCursor(awesomeconf->display, awesomeconf->cursor[CurNormal]);
|
||||
XFreeCursor(awesomeconf->display, awesomeconf->cursor[CurResize]);
|
||||
XFreeCursor(awesomeconf->display, awesomeconf->cursor[CurMove]);
|
||||
|
||||
for(i = 0; i < awesomeconf->ntags; i++)
|
||||
p_delete(&awesomeconf->tags[i].name);
|
||||
for(r = awesomeconf->rules; r; r = rn)
|
||||
{
|
||||
rn = r->next;
|
||||
p_delete(&r->prop);
|
||||
p_delete(&r->tags);
|
||||
p_delete(&r);
|
||||
}
|
||||
|
||||
for(k = awesomeconf->keys; k; k = kn)
|
||||
{
|
||||
kn = k->next;
|
||||
|
@ -93,37 +124,10 @@ cleanup_screen(awesome_config *awesomeconf)
|
|||
cleanup_buttons(awesomeconf->buttons.root);
|
||||
cleanup_buttons(awesomeconf->buttons.client);
|
||||
|
||||
for(i = 0; i < awesomeconf->nlayouts; i++)
|
||||
p_delete(&awesomeconf->layouts[i].symbol);
|
||||
for(r = awesomeconf->rules; r; r = rn)
|
||||
{
|
||||
rn = r->next;
|
||||
p_delete(&r->prop);
|
||||
p_delete(&r->tags);
|
||||
p_delete(&r);
|
||||
}
|
||||
|
||||
p_delete(&awesomeconf->tags);
|
||||
p_delete(&awesomeconf->layouts);
|
||||
p_delete(&awesomeconf->configpath);
|
||||
}
|
||||
|
||||
/** Cleanup everything on quit
|
||||
* \param awesomeconf awesome config
|
||||
*/
|
||||
static void
|
||||
cleanup(awesome_config *awesomeconf)
|
||||
{
|
||||
int screen;
|
||||
|
||||
while(*awesomeconf->clients)
|
||||
{
|
||||
client_unban(*awesomeconf->clients);
|
||||
client_unmanage(*awesomeconf->clients, NormalState, awesomeconf);
|
||||
}
|
||||
|
||||
for(screen = 0; screen < get_screen_count(awesomeconf->display); screen++)
|
||||
cleanup_screen(&awesomeconf[screen]);
|
||||
cleanup_screen(awesomeconf, screen);
|
||||
|
||||
XSetInputFocus(awesomeconf->display, PointerRoot, RevertToPointerRoot, CurrentTime);
|
||||
XSync(awesomeconf->display, False);
|
||||
|
@ -159,7 +163,7 @@ scan(awesome_config *awesomeconf)
|
|||
{
|
||||
if(screen == 0)
|
||||
real_screen = get_screen_bycoord(awesomeconf->display, wa.x, wa.y);
|
||||
client_manage(wins[i], &wa, &awesomeconf[real_screen]);
|
||||
client_manage(wins[i], &wa, awesomeconf, real_screen);
|
||||
}
|
||||
}
|
||||
/* now the transients */
|
||||
|
@ -172,7 +176,7 @@ scan(awesome_config *awesomeconf)
|
|||
{
|
||||
if(screen == 0)
|
||||
real_screen = get_screen_bycoord(awesomeconf->display, wa.x, wa.y);
|
||||
client_manage(wins[i], &wa, &awesomeconf[real_screen]);
|
||||
client_manage(wins[i], &wa, awesomeconf, real_screen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -186,7 +190,7 @@ scan(awesome_config *awesomeconf)
|
|||
* \todo clean things...
|
||||
*/
|
||||
static void
|
||||
setup(awesome_config *awesomeconf)
|
||||
setup(awesome_config *awesomeconf, int screen)
|
||||
{
|
||||
XSetWindowAttributes wa;
|
||||
|
||||
|
@ -200,21 +204,22 @@ setup(awesome_config *awesomeconf)
|
|||
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
|
||||
wa.cursor = awesomeconf->cursor[CurNormal];
|
||||
|
||||
XChangeWindowAttributes(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen), CWEventMask | CWCursor, &wa);
|
||||
XChangeWindowAttributes(awesomeconf->display,
|
||||
RootWindow(awesomeconf->display, get_phys_screen(awesomeconf->display, screen)),
|
||||
CWEventMask | CWCursor, &wa);
|
||||
|
||||
XSelectInput(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen), wa.event_mask);
|
||||
XSelectInput(awesomeconf->display, RootWindow(awesomeconf->display, get_phys_screen(awesomeconf->display, screen)), wa.event_mask);
|
||||
|
||||
grabkeys(awesomeconf);
|
||||
grabkeys(awesomeconf, screen);
|
||||
}
|
||||
|
||||
void
|
||||
setup_screen(awesome_config *awesomeconf, const char *confpath)
|
||||
setup_screen(awesome_config *awesomeconf, int screen)
|
||||
{
|
||||
parse_config(confpath, awesomeconf);
|
||||
setup(awesomeconf);
|
||||
initstatusbar(awesomeconf->display, awesomeconf->screen, &awesomeconf->statusbar,
|
||||
awesomeconf->cursor[CurNormal], awesomeconf->font,
|
||||
awesomeconf->layouts, awesomeconf->nlayouts,&awesomeconf->padding);
|
||||
setup(awesomeconf, screen);
|
||||
initstatusbar(awesomeconf->display, screen, &awesomeconf->screens[screen].statusbar,
|
||||
awesomeconf->cursor[CurNormal], awesomeconf->screens[screen].font,
|
||||
awesomeconf->screens[screen].layouts, awesomeconf->screens[screen].nlayouts, &awesomeconf->screens[screen].padding);
|
||||
}
|
||||
|
||||
/** Startup Error handler to check if another window manager
|
||||
|
@ -235,6 +240,7 @@ xerrorstart(Display * disp __attribute__ ((unused)), XErrorEvent * ee __attribut
|
|||
*/
|
||||
void
|
||||
uicb_quit(awesome_config *awesomeconf __attribute__((unused)),
|
||||
int screen __attribute__ ((unused)),
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
running = False;
|
||||
|
@ -285,7 +291,6 @@ main(int argc, char *argv[])
|
|||
enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
|
||||
Atom netatom[NetLast];
|
||||
event_handler **handler;
|
||||
Client **clients;
|
||||
struct sockaddr_un *addr;
|
||||
|
||||
if(argc >= 2)
|
||||
|
@ -326,19 +331,17 @@ main(int argc, char *argv[])
|
|||
XSync(dpy, False);
|
||||
|
||||
/* allocate stuff */
|
||||
awesomeconf = p_new(awesome_config, get_screen_count(dpy));
|
||||
clients = p_new(Client *, 1);
|
||||
awesomeconf = p_new(awesome_config, 1);
|
||||
awesomeconf->screens = p_new(VirtScreen, get_screen_count(dpy));
|
||||
/* store display */
|
||||
awesomeconf->display = dpy;
|
||||
parse_config(confpath, awesomeconf);
|
||||
|
||||
for(screen = 0; screen < get_screen_count(dpy); screen++)
|
||||
{
|
||||
/* store display */
|
||||
awesomeconf[screen].display = dpy;
|
||||
|
||||
/* set screen */
|
||||
awesomeconf[screen].screen = screen;
|
||||
setup_screen(&awesomeconf[screen], confpath);
|
||||
awesomeconf[screen].clients = clients;
|
||||
drawstatusbar(&awesomeconf[screen]);
|
||||
setup_screen(awesomeconf, screen);
|
||||
drawstatusbar(awesomeconf, screen);
|
||||
}
|
||||
|
||||
netatom[NetSupported] = XInternAtom(dpy, "_NET_SUPPORTED", False);
|
||||
|
@ -347,7 +350,7 @@ main(int argc, char *argv[])
|
|||
/* do this only for real screen */
|
||||
for(screen = 0; screen < ScreenCount(dpy); screen++)
|
||||
{
|
||||
loadawesomeprops(&awesomeconf[screen]);
|
||||
loadawesomeprops(awesomeconf, screen);
|
||||
XChangeProperty(dpy, RootWindow(dpy, screen), netatom[NetSupported],
|
||||
XA_ATOM, 32, PropModeReplace, (unsigned char *) netatom, NetLast);
|
||||
}
|
||||
|
@ -367,25 +370,19 @@ main(int argc, char *argv[])
|
|||
handler[UnmapNotify] = handle_event_unmapnotify;
|
||||
|
||||
/* check for shape extension */
|
||||
if((awesomeconf[0].have_shape = XShapeQueryExtension(dpy, &shape_event, &e_dummy)))
|
||||
if((awesomeconf->have_shape = XShapeQueryExtension(dpy, &shape_event, &e_dummy)))
|
||||
{
|
||||
p_realloc(&handler, shape_event + 1);
|
||||
handler[shape_event] = handle_event_shape;
|
||||
}
|
||||
|
||||
/* check for randr extension */
|
||||
if((awesomeconf[0].have_randr = XRRQueryExtension(dpy, &randr_event_base, &e_dummy)))
|
||||
if((awesomeconf->have_randr = XRRQueryExtension(dpy, &randr_event_base, &e_dummy)))
|
||||
{
|
||||
p_realloc(&handler, randr_event_base + RRScreenChangeNotify + 1);
|
||||
handler[randr_event_base + RRScreenChangeNotify] = handle_event_randr_screen_change_notify;
|
||||
}
|
||||
|
||||
for(screen = 0; screen < get_screen_count(dpy); screen++)
|
||||
{
|
||||
awesomeconf[screen].have_shape = awesomeconf[0].have_shape;
|
||||
awesomeconf[screen].have_randr = awesomeconf[0].have_randr;
|
||||
}
|
||||
|
||||
scan(awesomeconf);
|
||||
|
||||
XSync(dpy, False);
|
||||
|
@ -425,9 +422,6 @@ main(int argc, char *argv[])
|
|||
{
|
||||
case -1:
|
||||
perror("awesome: error reading UNIX domain socket");
|
||||
a_strncpy(awesomeconf[0].statustext, sizeof(awesomeconf[0].statustext),
|
||||
strerror(errno), sizeof(awesomeconf[0].statustext) - 1);
|
||||
awesomeconf[0].statustext[sizeof(awesomeconf[0].statustext) - 1] = '\0';
|
||||
csfd = -1;
|
||||
break;
|
||||
case 0:
|
||||
|
|
|
@ -24,8 +24,8 @@
|
|||
|
||||
#include "common.h"
|
||||
|
||||
void cleanup_screen(awesome_config *);
|
||||
void setup_screen(awesome_config *, const char *);
|
||||
void cleanup_screen(awesome_config *, int);
|
||||
void setup_screen(awesome_config *, int);
|
||||
int xerror(Display *, XErrorEvent *);
|
||||
UICB_PROTO(uicb_quit);
|
||||
|
||||
|
|
156
client.c
156
client.c
|
@ -174,33 +174,33 @@ client_detach(Client **head, Client *c)
|
|||
* \param awesomeconf awesome config
|
||||
*/
|
||||
void
|
||||
focus(Client *c, Bool selscreen, awesome_config *awesomeconf)
|
||||
focus(Client *c, Bool selscreen, awesome_config *awesomeconf, int screen)
|
||||
{
|
||||
int i;
|
||||
Tag *tag = get_current_tag(awesomeconf->tags, awesomeconf->ntags);
|
||||
Tag *tag = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].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((!c && selscreen) || (c && !isvisible(c, screen, awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)))
|
||||
for(c = awesomeconf->clients; c && !isvisible(c, screen, awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags); c = c->next);
|
||||
|
||||
/* XXX unfocus other tags clients, this is a bit too much */
|
||||
for(i = 0; i < awesomeconf->ntags; i++)
|
||||
if(awesomeconf->tags[i].client_sel)
|
||||
for(i = 0; i < awesomeconf->screens[screen].ntags; i++)
|
||||
if(awesomeconf->screens[screen].tags[i].client_sel)
|
||||
{
|
||||
window_grabbuttons(awesomeconf->tags[i].client_sel->display,
|
||||
awesomeconf->tags[i].client_sel->phys_screen,
|
||||
awesomeconf->tags[i].client_sel->win,
|
||||
window_grabbuttons(awesomeconf->screens[screen].tags[i].client_sel->display,
|
||||
awesomeconf->screens[screen].tags[i].client_sel->phys_screen,
|
||||
awesomeconf->screens[screen].tags[i].client_sel->win,
|
||||
False, True, awesomeconf->buttons.root,
|
||||
awesomeconf->buttons.client, awesomeconf->numlockmask);
|
||||
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);
|
||||
XSetWindowBorder(awesomeconf->screens[screen].tags[i].client_sel->display,
|
||||
awesomeconf->screens[screen].tags[i].client_sel->win,
|
||||
awesomeconf->screens[screen].colors_normal[ColBorder].pixel);
|
||||
window_settrans(awesomeconf->screens[screen].tags[i].client_sel->display,
|
||||
awesomeconf->screens[screen].tags[i].client_sel->win, awesomeconf->screens[screen].opacity_unfocused);
|
||||
}
|
||||
if(c)
|
||||
{
|
||||
XSetWindowBorder(awesomeconf->display, c->win, awesomeconf->colors_selected[ColBorder].pixel);
|
||||
XSetWindowBorder(awesomeconf->display, c->win, awesomeconf->screens[screen].colors_selected[ColBorder].pixel);
|
||||
window_grabbuttons(c->display, c->phys_screen, c->win,
|
||||
True, True, awesomeconf->buttons.root,
|
||||
awesomeconf->buttons.client, awesomeconf->numlockmask);
|
||||
|
@ -208,17 +208,17 @@ focus(Client *c, Bool selscreen, awesome_config *awesomeconf)
|
|||
if(!selscreen)
|
||||
return;
|
||||
tag->client_sel = c;
|
||||
drawstatusbar(awesomeconf);
|
||||
drawstatusbar(awesomeconf, screen);
|
||||
if(tag->client_sel)
|
||||
{
|
||||
XSetInputFocus(tag->client_sel->display, tag->client_sel->win, RevertToPointerRoot, CurrentTime);
|
||||
for(c = *awesomeconf->clients; c; c = c->next)
|
||||
for(c = awesomeconf->clients; c; c = c->next)
|
||||
if(c != tag->client_sel)
|
||||
window_settrans(awesomeconf->display, tag->client_sel->win, awesomeconf->opacity_unfocused);
|
||||
window_settrans(awesomeconf->display, tag->client_sel->win, awesomeconf->screens[screen].opacity_unfocused);
|
||||
window_settrans(awesomeconf->display, tag->client_sel->win, -1);
|
||||
}
|
||||
else
|
||||
XSetInputFocus(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen), RevertToPointerRoot, CurrentTime);
|
||||
XSetInputFocus(awesomeconf->display, RootWindow(awesomeconf->display, get_phys_screen(awesomeconf->display, screen)), RevertToPointerRoot, CurrentTime);
|
||||
}
|
||||
|
||||
|
||||
|
@ -257,7 +257,7 @@ loadprops(Client * c, int ntags)
|
|||
* \param awesomeconf awesome config
|
||||
*/
|
||||
void
|
||||
client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf)
|
||||
client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf, int screen)
|
||||
{
|
||||
int i;
|
||||
Client *c, *t = NULL;
|
||||
|
@ -265,7 +265,6 @@ client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf)
|
|||
Status rettrans;
|
||||
XWindowChanges wc;
|
||||
ScreenInfo *screen_info;
|
||||
awesome_config *current_acf = awesomeconf;
|
||||
|
||||
c = p_new(Client, 1);
|
||||
|
||||
|
@ -277,31 +276,31 @@ client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf)
|
|||
c->oldborder = wa->border_width;
|
||||
|
||||
c->display = awesomeconf->display;
|
||||
c->phys_screen = awesomeconf->phys_screen;
|
||||
c->screen = get_screen_bycoord(c->display, c->x, c->y);
|
||||
c->phys_screen = get_phys_screen(awesomeconf->display, c->screen);
|
||||
|
||||
move_client_to_screen(c, current_acf, True);
|
||||
move_client_to_screen(c, awesomeconf, screen, True);
|
||||
|
||||
/* update window title */
|
||||
updatetitle(c);
|
||||
|
||||
/* loadprops or apply rules if no props */
|
||||
if(!loadprops(c, awesomeconf->ntags))
|
||||
tag_client_with_rules(c, current_acf);
|
||||
if(!loadprops(c, awesomeconf->screens[screen].ntags))
|
||||
tag_client_with_rules(c, awesomeconf);
|
||||
|
||||
screen_info = get_screen_info(current_acf->display, current_acf->screen, NULL, NULL);
|
||||
screen_info = get_screen_info(awesomeconf->display, screen, NULL, NULL);
|
||||
|
||||
/* if window request fullscreen mode */
|
||||
if(c->w == screen_info[current_acf->screen].width && c->h == screen_info[current_acf->screen].height)
|
||||
if(c->w == screen_info[screen].width && c->h == screen_info[screen].height)
|
||||
{
|
||||
c->x = screen_info[current_acf->screen].x_org;
|
||||
c->y = screen_info[current_acf->screen].y_org;
|
||||
c->x = screen_info[screen].x_org;
|
||||
c->y = screen_info[screen].y_org;
|
||||
|
||||
c->border = wa->border_width;
|
||||
}
|
||||
else
|
||||
{
|
||||
ScreenInfo *display_info = get_display_info(c->display, c->phys_screen, ¤t_acf->statusbar,&awesomeconf->padding);
|
||||
ScreenInfo *display_info = get_display_info(c->display, c->phys_screen, &awesomeconf->screens[screen].statusbar, &awesomeconf->screens[screen].padding);
|
||||
|
||||
if(c->x + c->w + 2 * c->border > display_info->x_org + display_info->width)
|
||||
c->x = c->rx = display_info->x_org + display_info->width - c->w - 2 * c->border;
|
||||
|
@ -312,7 +311,7 @@ client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf)
|
|||
if(c->y < display_info->y_org)
|
||||
c->y = c->ry = display_info->y_org;
|
||||
|
||||
c->border = current_acf->borderpx;
|
||||
c->border = awesomeconf->screens[screen].borderpx;
|
||||
|
||||
p_delete(&display_info);
|
||||
}
|
||||
|
@ -321,7 +320,7 @@ client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf)
|
|||
/* set borders */
|
||||
wc.border_width = c->border;
|
||||
XConfigureWindow(c->display, w, CWBorderWidth, &wc);
|
||||
XSetWindowBorder(c->display, w, current_acf->colors_normal[ColBorder].pixel);
|
||||
XSetWindowBorder(c->display, w, awesomeconf->screens[screen].colors_normal[ColBorder].pixel);
|
||||
|
||||
/* propagates border_width, if size doesn't change */
|
||||
window_configure(c->display, c->win, c->x, c->y, c->w, c->h, c->border);
|
||||
|
@ -332,7 +331,7 @@ client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf)
|
|||
XSelectInput(c->display, w, StructureNotifyMask | PropertyChangeMask | EnterWindowMask);
|
||||
|
||||
/* handle xshape */
|
||||
if(current_acf->have_shape)
|
||||
if(awesomeconf->have_shape)
|
||||
{
|
||||
XShapeSelectInput(c->display, w, ShapeNotifyMask);
|
||||
window_setshape(c->display, c->phys_screen, c->win);
|
||||
|
@ -340,13 +339,13 @@ client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf)
|
|||
|
||||
/* grab buttons */
|
||||
window_grabbuttons(c->display, c->phys_screen, c->win,
|
||||
False, True, current_acf->buttons.root,
|
||||
current_acf->buttons.client, current_acf->numlockmask);
|
||||
False, True, awesomeconf->buttons.root,
|
||||
awesomeconf->buttons.client, awesomeconf->numlockmask);
|
||||
|
||||
/* check for transient and set tags like its parent */
|
||||
if((rettrans = XGetTransientForHint(c->display, w, &trans) == Success)
|
||||
&& (t = get_client_bywin(*current_acf->clients, trans)))
|
||||
for(i = 0; i < current_acf->ntags; i++)
|
||||
&& (t = get_client_bywin(awesomeconf->clients, trans)))
|
||||
for(i = 0; i < awesomeconf->screens[c->screen].ntags; i++)
|
||||
c->tags[i] = t->tags[i];
|
||||
|
||||
/* should be floating if transsient or fixed) */
|
||||
|
@ -354,18 +353,18 @@ client_manage(Window w, XWindowAttributes *wa, awesome_config *awesomeconf)
|
|||
c->isfloating = (rettrans == Success) || c->isfixed;
|
||||
|
||||
/* save new props */
|
||||
saveprops(c, current_acf->ntags);
|
||||
saveprops(c, awesomeconf->screens[c->screen].ntags);
|
||||
|
||||
/* attach to the stack */
|
||||
client_attach(current_acf->clients, c);
|
||||
client_attach(&awesomeconf->clients, c);
|
||||
|
||||
/* some windows require this */
|
||||
XMoveResizeWindow(c->display, c->win, c->x, c->y, c->w, c->h);
|
||||
|
||||
focus(c, True, current_acf);
|
||||
focus(c, True, awesomeconf, screen);
|
||||
|
||||
/* rearrange to display new window */
|
||||
arrange(current_acf);
|
||||
arrange(awesomeconf, screen);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -419,7 +418,7 @@ client_resize(Client *c, int x, int y, int w, int h, awesome_config *awesomeconf
|
|||
if(w <= 0 || h <= 0)
|
||||
return;
|
||||
/* offscreen appearance fixes */
|
||||
si = get_display_info(c->display, c->phys_screen, NULL, &awesomeconf->padding);
|
||||
si = get_display_info(c->display, c->phys_screen, NULL, &awesomeconf->screens[c->screen].padding);
|
||||
if(x > si->width)
|
||||
x = si->width - w - 2 * c->border;
|
||||
if(y > si->height)
|
||||
|
@ -437,7 +436,7 @@ client_resize(Client *c, int x, int y, int w, int h, awesome_config *awesomeconf
|
|||
c->h = wc.height = h;
|
||||
if(!volatile_coords
|
||||
&& (c->isfloating
|
||||
|| get_current_layout(awesomeconf->tags, awesomeconf->ntags)->arrange == layout_floating))
|
||||
|| get_current_layout(awesomeconf->screens[c->screen].tags, awesomeconf->screens[c->screen].ntags)->arrange == layout_floating))
|
||||
{
|
||||
c->rx = c->x;
|
||||
c->ry = c->y;
|
||||
|
@ -452,7 +451,7 @@ client_resize(Client *c, int x, int y, int w, int h, awesome_config *awesomeconf
|
|||
{
|
||||
int new_screen = get_screen_bycoord(c->display, c->x, c->y);
|
||||
if(c->screen != new_screen)
|
||||
move_client_to_screen(c, &awesomeconf[new_screen - awesomeconf->screen], False);
|
||||
move_client_to_screen(c, awesomeconf, new_screen, False);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -496,19 +495,19 @@ client_unmanage(Client *c, long state, awesome_config *awesomeconf)
|
|||
/* The server grab construct avoids race conditions. */
|
||||
XGrabServer(c->display);
|
||||
XConfigureWindow(c->display, c->win, CWBorderWidth, &wc); /* restore border */
|
||||
client_detach(awesomeconf->clients, 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)
|
||||
awesomeconf->tags[tag].client_sel = NULL;
|
||||
client_detach(&awesomeconf->clients, c);
|
||||
if(get_current_tag(awesomeconf->screens[c->screen].tags, awesomeconf->screens[c->screen].ntags)->client_sel == c)
|
||||
focus(NULL, True, awesomeconf, c->screen);
|
||||
for(tag = 0; tag < awesomeconf->screens[c->screen].ntags; tag++)
|
||||
if(awesomeconf->screens[c->screen].tags[tag].client_sel == c)
|
||||
awesomeconf->screens[c->screen].tags[tag].client_sel = NULL;
|
||||
XUngrabButton(c->display, AnyButton, AnyModifier, c->win);
|
||||
window_setstate(c->display, c->win, state);
|
||||
XSync(c->display, False);
|
||||
XSetErrorHandler(xerror);
|
||||
XUngrabServer(c->display);
|
||||
if(state != NormalState)
|
||||
arrange(awesomeconf);
|
||||
arrange(awesomeconf, c->screen);
|
||||
p_delete(&c->tags);
|
||||
p_delete(&c);
|
||||
}
|
||||
|
@ -578,25 +577,22 @@ updatesizehints(Client *c)
|
|||
}
|
||||
|
||||
void
|
||||
tag_client_with_rules(Client *c, awesome_config *current_acf)
|
||||
tag_client_with_rules(Client *c, awesome_config *awesomeconf)
|
||||
{
|
||||
Rule *r;
|
||||
Bool matched = False;
|
||||
int i;
|
||||
|
||||
for(r = current_acf->rules; r; r = r->next)
|
||||
for(r = awesomeconf->rules; r; r = r->next)
|
||||
if(client_match_rule(c, r))
|
||||
{
|
||||
c->isfloating = r->isfloating;
|
||||
|
||||
if(r->screen != RULE_NOSCREEN && r->screen != c->screen)
|
||||
{
|
||||
current_acf = ¤t_acf[r->screen - current_acf->screen];
|
||||
move_client_to_screen(c, current_acf, True);
|
||||
}
|
||||
move_client_to_screen(c, awesomeconf, r->screen, True);
|
||||
|
||||
for(i = 0; i < current_acf->ntags; i++)
|
||||
if(is_tag_match_rules(¤t_acf->tags[i], r))
|
||||
for(i = 0; i < awesomeconf->screens[c->screen].ntags; i++)
|
||||
if(is_tag_match_rules(&awesomeconf->screens[c->screen].tags[i], r))
|
||||
{
|
||||
matched = True;
|
||||
c->tags[i] = True;
|
||||
|
@ -605,7 +601,7 @@ tag_client_with_rules(Client *c, awesome_config *current_acf)
|
|||
c->tags[i] = False;
|
||||
|
||||
if(!matched)
|
||||
tag_client_with_current_selected(c, current_acf);
|
||||
tag_client_with_current_selected(c, awesomeconf, c->screen);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -617,6 +613,7 @@ tag_client_with_rules(Client *c, awesome_config *current_acf)
|
|||
*/
|
||||
void
|
||||
uicb_client_settrans(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
{
|
||||
double delta = 100.0, current_opacity = 100.0;
|
||||
|
@ -626,7 +623,7 @@ uicb_client_settrans(awesome_config *awesomeconf,
|
|||
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;
|
||||
Client *sel = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->client_sel;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
@ -668,55 +665,59 @@ uicb_client_settrans(awesome_config *awesomeconf,
|
|||
*/
|
||||
void
|
||||
uicb_setborder(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
{
|
||||
if(!arg)
|
||||
return;
|
||||
|
||||
if((awesomeconf->borderpx = (int) compute_new_value_from_arg(arg, (double) awesomeconf->borderpx)) < 0)
|
||||
awesomeconf->borderpx = 0;
|
||||
if((awesomeconf->screens[screen].borderpx = (int) compute_new_value_from_arg(arg, (double) awesomeconf->screens[screen].borderpx)) < 0)
|
||||
awesomeconf->screens[screen].borderpx = 0;
|
||||
}
|
||||
|
||||
void
|
||||
uicb_client_swapnext(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *next, *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
|
||||
Client *next, *sel = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->client_sel;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
||||
for(next = sel->next; next && !isvisible(next, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); next = next->next);
|
||||
for(next = sel->next; next && !isvisible(next, screen, awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags); next = next->next);
|
||||
if(next)
|
||||
{
|
||||
client_swap(awesomeconf->clients, sel, next);
|
||||
arrange(awesomeconf);
|
||||
client_swap(&awesomeconf->clients, sel, next);
|
||||
arrange(awesomeconf, screen);
|
||||
/* restore focus */
|
||||
focus(sel, True, awesomeconf);
|
||||
focus(sel, True, awesomeconf, screen);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
uicb_client_swapprev(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *prev, *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
|
||||
Client *prev, *sel = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->client_sel;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
||||
for(prev = sel->prev; prev && !isvisible(prev, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); prev = prev->prev);
|
||||
for(prev = sel->prev; prev && !isvisible(prev, screen, awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags); prev = prev->prev);
|
||||
if(prev)
|
||||
{
|
||||
client_swap(awesomeconf->clients, prev, sel);
|
||||
arrange(awesomeconf);
|
||||
client_swap(&awesomeconf->clients, prev, sel);
|
||||
arrange(awesomeconf, screen);
|
||||
/* restore focus */
|
||||
focus(sel, True, awesomeconf);
|
||||
focus(sel, True, awesomeconf, screen);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
uicb_client_moveresize(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
{
|
||||
int nx, ny, nw, nh, ox, oy, ow, oh;
|
||||
|
@ -724,9 +725,9 @@ uicb_client_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;
|
||||
Client *sel = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->client_sel;
|
||||
|
||||
if(get_current_layout(awesomeconf->tags, awesomeconf->ntags)->arrange != layout_floating)
|
||||
if(get_current_layout(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->arrange != layout_floating)
|
||||
if(!sel || !sel->isfloating || sel->isfixed || !arg)
|
||||
return;
|
||||
if(sscanf(arg, "%s %s %s %s", x, y, w, h) != 4)
|
||||
|
@ -741,7 +742,7 @@ uicb_client_moveresize(awesome_config *awesomeconf,
|
|||
ow = sel->w;
|
||||
oh = sel->h;
|
||||
|
||||
Bool xqp = XQueryPointer(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen), &dummy, &dummy, &mx, &my, &dx, &dy, &dui);
|
||||
Bool xqp = XQueryPointer(awesomeconf->display, RootWindow(awesomeconf->display, get_phys_screen(awesomeconf->display, screen)), &dummy, &dummy, &mx, &my, &dx, &dy, &dui);
|
||||
client_resize(sel, nx, ny, nw, nh, awesomeconf, True, False);
|
||||
if (xqp && ox <= mx && (ox + ow) >= mx && oy <= my && (oy + oh) >= my)
|
||||
{
|
||||
|
@ -758,10 +759,11 @@ uicb_client_moveresize(awesome_config *awesomeconf,
|
|||
*/
|
||||
void
|
||||
uicb_client_kill(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
XEvent ev;
|
||||
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
|
||||
Client *sel = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->client_sel;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
|
4
client.h
4
client.h
|
@ -30,8 +30,8 @@ inline void client_detach(Client **, Client *);
|
|||
void client_reattach_after(Client *, Client *);
|
||||
Bool loadprops(Client *, int );
|
||||
void client_ban(Client *);
|
||||
void focus(Client *, Bool, awesome_config *);
|
||||
void client_manage(Window, XWindowAttributes *, awesome_config *);
|
||||
void focus(Client *, Bool, awesome_config *, int);
|
||||
void client_manage(Window, XWindowAttributes *, awesome_config *, int);
|
||||
void client_resize(Client *, int, int, int, int, awesome_config *, Bool, Bool);
|
||||
void client_unban(Client *);
|
||||
void client_unmanage(Client *, long, awesome_config *);
|
||||
|
|
4
common.h
4
common.h
|
@ -25,10 +25,10 @@
|
|||
#include "config.h"
|
||||
|
||||
/** Common prototype definition for ui_callbak functions */
|
||||
#define UICB_PROTO(name) void name(awesome_config *, const char *)
|
||||
#define UICB_PROTO(name) void name(awesome_config *, int, const char *)
|
||||
|
||||
/** Common prototype definition for layouts function */
|
||||
#define LAYOUT_PROTO(name) void name(awesome_config *)
|
||||
#define LAYOUT_PROTO(name) void name(awesome_config *, int)
|
||||
|
||||
#endif
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
265
config.c
265
config.c
|
@ -298,7 +298,7 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
|
|||
};
|
||||
cfg_t *cfg, *cfg_general, *cfg_colors, *cfg_screen, *cfg_statusbar, *cfg_tags,
|
||||
*cfg_layouts, *cfg_rules, *cfg_keys, *cfg_mouse, *cfgsectmp, *cfg_padding;
|
||||
int i = 0, k = 0, ret;
|
||||
int i = 0, k = 0, ret, screen;
|
||||
unsigned int j = 0, l = 0;
|
||||
const char *tmp, *homedir;
|
||||
char *confpath, buf[2];
|
||||
|
@ -320,10 +320,6 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
|
|||
|
||||
awesomeconf->configpath = a_strdup(confpath);
|
||||
|
||||
a_strcpy(awesomeconf->statustext, sizeof(awesomeconf->statustext), "awesome-" VERSION " (" RELEASE ")");
|
||||
|
||||
awesomeconf->phys_screen = get_phys_screen(awesomeconf->display, awesomeconf->screen);
|
||||
|
||||
cfg = cfg_init(opts, CFGF_NONE);
|
||||
|
||||
ret = cfg_parse(cfg, confpath);
|
||||
|
@ -336,7 +332,12 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
|
|||
cfg_error(cfg, "awesome: parsing configuration file %s failed.\n", confpath);
|
||||
|
||||
/* get the right screen section */
|
||||
snprintf(buf, sizeof(buf), "%d", awesomeconf->screen);
|
||||
for(screen = 0; screen < get_screen_count(awesomeconf->display); screen++)
|
||||
{
|
||||
a_strcpy(awesomeconf->screens[screen].statustext,
|
||||
sizeof(awesomeconf->screens[screen].statustext),
|
||||
"awesome-" VERSION " (" RELEASE ")");
|
||||
snprintf(buf, sizeof(buf), "%d", screen);
|
||||
cfg_screen = cfg_gettsec(cfg, "screen", buf);
|
||||
if(!cfg_screen)
|
||||
cfg_screen = cfg_getsec(cfg, "screen");
|
||||
|
@ -356,66 +357,102 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
|
|||
cfg_layouts = cfg_getsec(cfg_screen, "layouts");
|
||||
cfg_padding = cfg_getsec(cfg_screen, "padding");
|
||||
|
||||
/* get general sections */
|
||||
cfg_rules = cfg_getsec(cfg, "rules");
|
||||
cfg_keys = cfg_getsec(cfg, "keys");
|
||||
cfg_mouse = cfg_getsec(cfg, "mouse");
|
||||
|
||||
/* General section */
|
||||
|
||||
awesomeconf->borderpx = cfg_getint(cfg_general, "border");
|
||||
awesomeconf->snap = cfg_getint(cfg_general, "snap");
|
||||
awesomeconf->resize_hints = cfg_getbool(cfg_general, "resize_hints");
|
||||
awesomeconf->opacity_unfocused = cfg_getint(cfg_general, "opacity_unfocused");
|
||||
awesomeconf->focus_move_pointer = cfg_getbool(cfg_general, "focus_move_pointer");
|
||||
awesomeconf->allow_lower_floats = cfg_getbool(cfg_general, "allow_lower_floats");
|
||||
awesomeconf->font = XftFontOpenName(awesomeconf->display, awesomeconf->phys_screen, cfg_getstr(cfg_general, "font"));
|
||||
if(!awesomeconf->font)
|
||||
awesomeconf->screens[screen].borderpx = cfg_getint(cfg_general, "border");
|
||||
awesomeconf->screens[screen].snap = cfg_getint(cfg_general, "snap");
|
||||
awesomeconf->screens[screen].resize_hints = cfg_getbool(cfg_general, "resize_hints");
|
||||
awesomeconf->screens[screen].opacity_unfocused = cfg_getint(cfg_general, "opacity_unfocused");
|
||||
awesomeconf->screens[screen].focus_move_pointer = cfg_getbool(cfg_general, "focus_move_pointer");
|
||||
awesomeconf->screens[screen].allow_lower_floats = cfg_getbool(cfg_general, "allow_lower_floats");
|
||||
awesomeconf->screens[screen].font = XftFontOpenName(awesomeconf->display,
|
||||
get_phys_screen(awesomeconf->display, screen),
|
||||
cfg_getstr(cfg_general, "font"));
|
||||
if(!awesomeconf->screens[screen].font)
|
||||
eprint("awesome: cannot init font\n");
|
||||
|
||||
/* Colors */
|
||||
awesomeconf->colors_normal[ColBorder] = initxcolor(awesomeconf->display, awesomeconf->phys_screen, cfg_getstr(cfg_colors, "normal_border"));
|
||||
awesomeconf->colors_normal[ColBG] = initxcolor(awesomeconf->display, awesomeconf->phys_screen, cfg_getstr(cfg_colors, "normal_bg"));
|
||||
awesomeconf->colors_normal[ColFG] = initxcolor(awesomeconf->display, awesomeconf->phys_screen, cfg_getstr(cfg_colors, "normal_fg"));
|
||||
awesomeconf->colors_selected[ColBorder] = initxcolor(awesomeconf->display, awesomeconf->phys_screen, cfg_getstr(cfg_colors, "focus_border"));
|
||||
awesomeconf->colors_selected[ColBG] = initxcolor(awesomeconf->display, awesomeconf->phys_screen, cfg_getstr(cfg_colors, "focus_bg"));
|
||||
awesomeconf->colors_selected[ColFG] = initxcolor(awesomeconf->display, awesomeconf->phys_screen, cfg_getstr(cfg_colors, "focus_fg"));
|
||||
awesomeconf->screens[screen].colors_normal[ColBorder] = initxcolor(awesomeconf->display, get_phys_screen(awesomeconf->display, screen), cfg_getstr(cfg_colors, "normal_border"));
|
||||
awesomeconf->screens[screen].colors_normal[ColBG] = initxcolor(awesomeconf->display, get_phys_screen(awesomeconf->display, screen), cfg_getstr(cfg_colors, "normal_bg"));
|
||||
awesomeconf->screens[screen].colors_normal[ColFG] = initxcolor(awesomeconf->display, get_phys_screen(awesomeconf->display, screen), cfg_getstr(cfg_colors, "normal_fg"));
|
||||
awesomeconf->screens[screen].colors_selected[ColBorder] = initxcolor(awesomeconf->display, get_phys_screen(awesomeconf->display, screen), cfg_getstr(cfg_colors, "focus_border"));
|
||||
awesomeconf->screens[screen].colors_selected[ColBG] = initxcolor(awesomeconf->display, get_phys_screen(awesomeconf->display, screen), cfg_getstr(cfg_colors, "focus_bg"));
|
||||
awesomeconf->screens[screen].colors_selected[ColFG] = initxcolor(awesomeconf->display, get_phys_screen(awesomeconf->display, screen), cfg_getstr(cfg_colors, "focus_fg"));
|
||||
|
||||
/* Statusbar */
|
||||
tmp = cfg_getstr(cfg_statusbar, "position");
|
||||
|
||||
if(tmp && !a_strncmp(tmp, "off", 6))
|
||||
awesomeconf->statusbar.dposition = BarOff;
|
||||
awesomeconf->screens[screen].statusbar.dposition = BarOff;
|
||||
else if(tmp && !a_strncmp(tmp, "bottom", 6))
|
||||
awesomeconf->statusbar.dposition = BarBot;
|
||||
awesomeconf->screens[screen].statusbar.dposition = BarBot;
|
||||
else if(tmp && !a_strncmp(tmp, "right", 5))
|
||||
awesomeconf->statusbar.dposition = BarRight;
|
||||
awesomeconf->screens[screen].statusbar.dposition = BarRight;
|
||||
else if(tmp && !a_strncmp(tmp, "left", 4))
|
||||
awesomeconf->statusbar.dposition = BarLeft;
|
||||
awesomeconf->screens[screen].statusbar.dposition = BarLeft;
|
||||
else
|
||||
awesomeconf->statusbar.dposition = BarTop;
|
||||
awesomeconf->screens[screen].statusbar.dposition = BarTop;
|
||||
|
||||
awesomeconf->statusbar.position = awesomeconf->statusbar.dposition;
|
||||
awesomeconf->screens[screen].statusbar.position = awesomeconf->screens[screen].statusbar.dposition;
|
||||
|
||||
/* Layouts */
|
||||
awesomeconf->nlayouts = cfg_size(cfg_layouts, "layout");
|
||||
awesomeconf->layouts = p_new(Layout, awesomeconf->nlayouts);
|
||||
for(i = 0; i < awesomeconf->nlayouts; i++)
|
||||
awesomeconf->screens[screen].nlayouts = cfg_size(cfg_layouts, "layout");
|
||||
awesomeconf->screens[screen].layouts = p_new(Layout, awesomeconf->screens[screen].nlayouts);
|
||||
for(i = 0; i < awesomeconf->screens[screen].nlayouts; i++)
|
||||
{
|
||||
cfgsectmp = cfg_getnsec(cfg_layouts, "layout", i);
|
||||
awesomeconf->layouts[i].arrange = name_func_lookup(cfg_title(cfgsectmp), LayoutsList);
|
||||
if(!awesomeconf->layouts[i].arrange)
|
||||
awesomeconf->screens[screen].layouts[i].arrange = name_func_lookup(cfg_title(cfgsectmp), LayoutsList);
|
||||
if(!awesomeconf->screens[screen].layouts[i].arrange)
|
||||
{
|
||||
fprintf(stderr, "awesome: unknown layout %s in configuration file\n", cfg_title(cfgsectmp));
|
||||
awesomeconf->layouts[i].symbol = NULL;
|
||||
awesomeconf->screens[screen].layouts[i].symbol = NULL;
|
||||
continue;
|
||||
}
|
||||
awesomeconf->layouts[i].symbol = a_strdup(cfg_getstr(cfgsectmp, "symbol"));
|
||||
awesomeconf->screens[screen].layouts[i].symbol = a_strdup(cfg_getstr(cfgsectmp, "symbol"));
|
||||
}
|
||||
|
||||
if(!awesomeconf->nlayouts)
|
||||
if(!awesomeconf->screens[screen].nlayouts)
|
||||
eprint("awesome: fatal: no default layout available\n");
|
||||
|
||||
/* Tags */
|
||||
awesomeconf->screens[screen].ntags = cfg_size(cfg_tags, "tag");
|
||||
awesomeconf->screens[screen].tags = p_new(Tag, awesomeconf->screens[screen].ntags);
|
||||
for(i = 0; i < awesomeconf->screens[screen].ntags; i++)
|
||||
{
|
||||
cfgsectmp = cfg_getnsec(cfg_tags, "tag", i);
|
||||
awesomeconf->screens[screen].tags[i].name = a_strdup(cfg_title(cfgsectmp));
|
||||
awesomeconf->screens[screen].tags[i].selected = False;
|
||||
awesomeconf->screens[screen].tags[i].was_selected = False;
|
||||
tmp = cfg_getstr(cfgsectmp, "layout");
|
||||
for(k = 0; k < awesomeconf->screens[screen].nlayouts; k++)
|
||||
if(awesomeconf->screens[screen].layouts[k].arrange == name_func_lookup(tmp, LayoutsList))
|
||||
break;
|
||||
if(k == awesomeconf->screens[screen].nlayouts)
|
||||
k = 0;
|
||||
awesomeconf->screens[screen].tags[i].layout = &awesomeconf->screens[screen].layouts[k];
|
||||
awesomeconf->screens[screen].tags[i].mwfact = cfg_getfloat(cfgsectmp, "mwfact");
|
||||
awesomeconf->screens[screen].tags[i].nmaster = cfg_getint(cfgsectmp, "nmaster");
|
||||
awesomeconf->screens[screen].tags[i].ncol = cfg_getint(cfgsectmp, "ncol");
|
||||
}
|
||||
|
||||
if(!awesomeconf->screens[screen].ntags)
|
||||
eprint("awesome: fatal: no tags found in configuration file\n");
|
||||
|
||||
/* select first tag by default */
|
||||
awesomeconf->screens[screen].tags[0].selected = True;
|
||||
awesomeconf->screens[screen].tags[0].was_selected = True;
|
||||
|
||||
/* padding */
|
||||
awesomeconf->screens[screen].padding.top = cfg_getint(cfg_padding, "top");
|
||||
awesomeconf->screens[screen].padding.bottom = cfg_getint(cfg_padding, "bottom");
|
||||
awesomeconf->screens[screen].padding.left = cfg_getint(cfg_padding, "left");
|
||||
awesomeconf->screens[screen].padding.right = cfg_getint(cfg_padding, "right");
|
||||
}
|
||||
|
||||
/* get general sections */
|
||||
cfg_rules = cfg_getsec(cfg, "rules");
|
||||
cfg_keys = cfg_getsec(cfg, "keys");
|
||||
cfg_mouse = cfg_getsec(cfg, "mouse");
|
||||
|
||||
/* Rules */
|
||||
if(cfg_size(cfg_rules, "rule"))
|
||||
{
|
||||
|
@ -446,39 +483,6 @@ parse_config(const char *confpatharg, awesome_config *awesomeconf)
|
|||
|
||||
compileregs(awesomeconf->rules);
|
||||
|
||||
/* Tags */
|
||||
awesomeconf->ntags = cfg_size(cfg_tags, "tag");
|
||||
awesomeconf->tags = p_new(Tag, awesomeconf->ntags);
|
||||
for(i = 0; i < awesomeconf->ntags; i++)
|
||||
{
|
||||
cfgsectmp = cfg_getnsec(cfg_tags, "tag", i);
|
||||
awesomeconf->tags[i].name = a_strdup(cfg_title(cfgsectmp));
|
||||
awesomeconf->tags[i].selected = False;
|
||||
awesomeconf->tags[i].was_selected = False;
|
||||
tmp = cfg_getstr(cfgsectmp, "layout");
|
||||
for(k = 0; k < awesomeconf->nlayouts; k++)
|
||||
if(awesomeconf->layouts[k].arrange == name_func_lookup(tmp, LayoutsList))
|
||||
break;
|
||||
if(k == awesomeconf->nlayouts)
|
||||
k = 0;
|
||||
awesomeconf->tags[i].layout = &awesomeconf->layouts[k];
|
||||
awesomeconf->tags[i].mwfact = cfg_getfloat(cfgsectmp, "mwfact");
|
||||
awesomeconf->tags[i].nmaster = cfg_getint(cfgsectmp, "nmaster");
|
||||
awesomeconf->tags[i].ncol = cfg_getint(cfgsectmp, "ncol");
|
||||
}
|
||||
|
||||
/* padding */
|
||||
awesomeconf->padding.top = cfg_getint(cfg_padding, "top");
|
||||
awesomeconf->padding.bottom = cfg_getint(cfg_padding, "bottom");
|
||||
awesomeconf->padding.left = cfg_getint(cfg_padding, "left");
|
||||
awesomeconf->padding.right = cfg_getint(cfg_padding, "right");
|
||||
|
||||
if(!awesomeconf->ntags)
|
||||
eprint("awesome: fatal: no tags found in configuration file\n");
|
||||
|
||||
/* select first tag by default */
|
||||
awesomeconf->tags[0].selected = True;
|
||||
awesomeconf->tags[0].was_selected = True;
|
||||
|
||||
/* Mouse: tags click bindings */
|
||||
awesomeconf->buttons.tag = parse_mouse_bindings(cfg_mouse, "tag", False);
|
||||
|
@ -563,119 +567,4 @@ initxcolor(Display *disp, int scr, const char *colstr)
|
|||
return color;
|
||||
}
|
||||
|
||||
void
|
||||
uicb_reloadconfig(awesome_config *awesomeconf,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
int i, j, tag, screen, screen_count = get_screen_count(awesomeconf->display);
|
||||
awesome_config *awesomeconf_first = &awesomeconf[-awesomeconf->screen];
|
||||
int *old_ntags, old_c_ntags, new_c_ntags, **mapping;
|
||||
char ***savetagnames;
|
||||
Client ***savetagclientsel;
|
||||
char *configpath = a_strdup(awesomeconf_first->configpath);
|
||||
Bool ***savetagselected;
|
||||
Bool *old_c_tags;
|
||||
Client *c, *clients;
|
||||
|
||||
/* Save tag information */
|
||||
savetagnames = p_new(char **, screen_count);
|
||||
savetagclientsel = p_new(Client **, screen_count);
|
||||
savetagselected = p_new(Bool **, screen_count);
|
||||
clients = *awesomeconf_first->clients;
|
||||
for (screen = 0; screen < screen_count; screen ++)
|
||||
{
|
||||
savetagnames[screen] = p_new(char *, awesomeconf_first[screen].ntags);
|
||||
savetagclientsel[screen] = p_new(Client *, awesomeconf_first[screen].ntags);
|
||||
savetagselected[screen] = p_new(Bool *, awesomeconf_first[screen].ntags);
|
||||
for (tag = 0; tag < awesomeconf_first[screen].ntags; tag++)
|
||||
{
|
||||
savetagnames[screen][tag] = a_strdup(awesomeconf_first[screen].tags[tag].name);
|
||||
savetagclientsel[screen][tag] = awesomeconf_first[screen].tags[tag].client_sel;
|
||||
savetagselected[screen][tag] = p_new(Bool, 2);
|
||||
savetagselected[screen][tag][0] = awesomeconf_first[screen].tags[tag].selected;
|
||||
savetagselected[screen][tag][1] = awesomeconf_first[screen].tags[tag].was_selected;
|
||||
}
|
||||
}
|
||||
old_ntags = p_new(int, screen_count);
|
||||
for (screen = 0; screen < screen_count; screen ++)
|
||||
old_ntags[screen] = awesomeconf_first[screen].ntags;
|
||||
|
||||
mapping = p_new(int*, screen_count);
|
||||
for(screen = 0; screen < screen_count; screen++)
|
||||
{
|
||||
/* Cleanup screens and reload their config. */
|
||||
cleanup_screen(&awesomeconf_first[screen]);
|
||||
setup_screen(&awesomeconf_first[screen], configpath);
|
||||
|
||||
/* Compute a mapping of tags between the old and new config, based on
|
||||
* tag names. */
|
||||
mapping[screen] = p_new(int, awesomeconf_first[screen].ntags);
|
||||
for (i = 0; i < awesomeconf_first[screen].ntags; i ++)
|
||||
{
|
||||
mapping[screen][i] = -1;
|
||||
for (j = 0; j < old_ntags[screen]; j ++)
|
||||
if (!a_strcmp(savetagnames[screen][j], awesomeconf_first[screen].tags[i].name))
|
||||
{
|
||||
mapping[screen][i] = j;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Reinitialize the tags' client lists and selected client. */
|
||||
*awesomeconf_first[screen].clients = clients;
|
||||
for (tag = 0; tag < awesomeconf_first[screen].ntags; tag++)
|
||||
if (mapping[screen][tag] >= 0)
|
||||
{
|
||||
awesomeconf_first[screen].tags[tag].client_sel = savetagclientsel[screen][mapping[screen][tag]];
|
||||
awesomeconf_first[screen].tags[tag].selected = savetagselected[screen][mapping[screen][tag]][0];
|
||||
awesomeconf_first[screen].tags[tag].was_selected = savetagselected[screen][mapping[screen][tag]][1];
|
||||
}
|
||||
drawstatusbar(&awesomeconf_first[screen]);
|
||||
}
|
||||
|
||||
/* Reinitialize the 'tags' array of each client.
|
||||
* Clients are assigned to the tags of the same name as in the previous
|
||||
* awesomerc, or to tag #1 otherwise. */
|
||||
for (c = *awesomeconf_first->clients; c; c = c->next)
|
||||
{
|
||||
old_c_ntags = old_ntags[c->screen];
|
||||
new_c_ntags = awesomeconf_first[c->screen].ntags;
|
||||
|
||||
old_c_tags = c->tags;
|
||||
c->tags = p_new(Bool, new_c_ntags);
|
||||
for (i = 0; i < new_c_ntags; i ++)
|
||||
if (mapping[c->screen][i] >= 0)
|
||||
c->tags[i] = old_c_tags[mapping[c->screen][i]];
|
||||
p_delete(&old_c_tags);
|
||||
|
||||
for (i = 0; i < new_c_ntags && c->tags[i] == 0; i++) {}
|
||||
if (i == new_c_ntags)
|
||||
c->tags[0] = 1;
|
||||
|
||||
saveprops(c, awesomeconf_first[c->screen].ntags);
|
||||
}
|
||||
|
||||
/* Cleanup after ourselves */
|
||||
for(screen = 0; screen < screen_count; screen++)
|
||||
{
|
||||
for(i = 0; i < old_ntags[screen]; i++)
|
||||
{
|
||||
p_delete(&savetagnames[screen][i]);
|
||||
p_delete(&savetagselected[screen][i]);
|
||||
}
|
||||
p_delete(&savetagselected[screen]);
|
||||
p_delete(&savetagnames[screen]);
|
||||
p_delete(&mapping[screen]);
|
||||
p_delete(&savetagclientsel[screen]);
|
||||
}
|
||||
p_delete(&mapping);
|
||||
p_delete(&savetagselected);
|
||||
p_delete(&savetagnames);
|
||||
p_delete(&old_ntags);
|
||||
p_delete(&savetagclientsel);
|
||||
p_delete(&configpath);
|
||||
for (screen = 0; screen < screen_count; screen ++)
|
||||
arrange(&awesomeconf_first[screen]);
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
74
config.h
74
config.h
|
@ -53,7 +53,7 @@ typedef struct awesome_config awesome_config;
|
|||
typedef struct
|
||||
{
|
||||
char *symbol;
|
||||
void (*arrange) (awesome_config *);
|
||||
void (*arrange) (awesome_config *, int);
|
||||
} Layout;
|
||||
|
||||
typedef struct Key Key;
|
||||
|
@ -61,7 +61,7 @@ struct Key
|
|||
{
|
||||
unsigned long mod;
|
||||
KeySym keysym;
|
||||
void (*func) (awesome_config *, char *);
|
||||
void (*func) (awesome_config *, int, char *);
|
||||
char *arg;
|
||||
Key *next;
|
||||
};
|
||||
|
@ -71,7 +71,7 @@ struct Button
|
|||
{
|
||||
unsigned long mod;
|
||||
unsigned int button;
|
||||
void (*func) (awesome_config *, char *);
|
||||
void (*func) (awesome_config *, int, char *);
|
||||
char *arg;
|
||||
Button *next;
|
||||
};
|
||||
|
@ -166,15 +166,26 @@ typedef struct
|
|||
int right;
|
||||
} Padding;
|
||||
|
||||
/** Main configuration structure */
|
||||
struct awesome_config
|
||||
typedef struct
|
||||
{
|
||||
/** Display ref */
|
||||
Display *display;
|
||||
/** Config virtual screen number */
|
||||
int screen;
|
||||
/** Config physical screen */
|
||||
int phys_screen;
|
||||
/** Text displayed in bar */
|
||||
char statustext[256];
|
||||
/** Number of pixels to snap windows */
|
||||
int snap;
|
||||
/** Border size */
|
||||
int borderpx;
|
||||
/** Transparency of unfocused clients */
|
||||
int opacity_unfocused;
|
||||
/** Focus move pointer */
|
||||
Bool focus_move_pointer;
|
||||
/** Allow floats to be lowered on focus change */
|
||||
Bool allow_lower_floats;
|
||||
/** Respect resize hints */
|
||||
Bool resize_hints;
|
||||
/** Normal colors */
|
||||
XColor colors_normal[ColLast];
|
||||
/** Selected colors */
|
||||
XColor colors_selected[ColLast];
|
||||
/** Tag list */
|
||||
Tag *tags;
|
||||
/** Number of tags in **tags */
|
||||
|
@ -182,6 +193,21 @@ struct awesome_config
|
|||
/** Layout list */
|
||||
Layout *layouts;
|
||||
int nlayouts;
|
||||
/** Status bar */
|
||||
Statusbar statusbar;
|
||||
/** Padding */
|
||||
Padding padding;
|
||||
/** Font */
|
||||
XftFont *font;
|
||||
} VirtScreen;
|
||||
|
||||
/** Main configuration structure */
|
||||
struct awesome_config
|
||||
{
|
||||
/** Display ref */
|
||||
Display *display;
|
||||
/** Logical screens */
|
||||
VirtScreen *screens;
|
||||
/** Rules list */
|
||||
Rule *rules;
|
||||
/** Keys bindings list */
|
||||
|
@ -197,38 +223,14 @@ struct awesome_config
|
|||
} buttons;
|
||||
/** Numlock mask */
|
||||
unsigned int numlockmask;
|
||||
/** Border size */
|
||||
int borderpx;
|
||||
/** Number of pixels to snap windows */
|
||||
int snap;
|
||||
/** Transparency of unfocused clients */
|
||||
int opacity_unfocused;
|
||||
/** Focus move pointer */
|
||||
Bool focus_move_pointer;
|
||||
/** Allow floats to be lowered on focus change */
|
||||
Bool allow_lower_floats;
|
||||
/** Respect resize hints */
|
||||
Bool resize_hints;
|
||||
/** Text displayed in bar */
|
||||
char statustext[256];
|
||||
/** Status bar */
|
||||
Statusbar statusbar;
|
||||
/** Check for XShape extension */
|
||||
Bool have_shape;
|
||||
/** Check for XRandR extension */
|
||||
Bool have_randr;
|
||||
/** Normal colors */
|
||||
XColor colors_normal[ColLast];
|
||||
/** Selected colors */
|
||||
XColor colors_selected[ColLast];
|
||||
/** Cursors */
|
||||
Cursor cursor[CurLast];
|
||||
/** Padding */
|
||||
Padding padding;
|
||||
/** Font */
|
||||
XftFont *font;
|
||||
/** Clients list */
|
||||
Client **clients;
|
||||
Client *clients;
|
||||
/** Path to config file */
|
||||
char *configpath;
|
||||
};
|
||||
|
|
152
event.c
152
event.c
|
@ -37,22 +37,22 @@
|
|||
#include "layouts/tile.h"
|
||||
#include "layouts/floating.h"
|
||||
|
||||
#define CLEANMASK(mask, acf) (mask & ~(acf.numlockmask | LockMask))
|
||||
#define CLEANMASK(mask, acf) (mask & ~(acf->numlockmask | LockMask))
|
||||
|
||||
static void
|
||||
handle_mouse_button_press(awesome_config *awesomeconf,
|
||||
handle_mouse_button_press(awesome_config *awesomeconf, int screen,
|
||||
unsigned int button, unsigned int state,
|
||||
Button *buttons, char *arg)
|
||||
{
|
||||
Button *b;
|
||||
|
||||
for(b = buttons; b; b = b->next)
|
||||
if(button == b->button && CLEANMASK(state, awesomeconf[0]) == b->mod && b->func)
|
||||
if(button == b->button && CLEANMASK(state, awesomeconf) == b->mod && b->func)
|
||||
{
|
||||
if(arg)
|
||||
b->func(awesomeconf, arg);
|
||||
b->func(awesomeconf, screen, arg);
|
||||
else
|
||||
b->func(awesomeconf, b->arg);
|
||||
b->func(awesomeconf, screen, b->arg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -68,52 +68,52 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
|
|||
XButtonPressedEvent *ev = &e->xbutton;
|
||||
|
||||
for(screen = 0; screen < get_screen_count(e->xany.display); screen++)
|
||||
if(awesomeconf[screen].statusbar.window == ev->window)
|
||||
if(awesomeconf->screens[screen].statusbar.window == ev->window)
|
||||
{
|
||||
for(i = 0; i < awesomeconf[screen].ntags; i++)
|
||||
for(i = 0; i < awesomeconf->screens[screen].ntags; i++)
|
||||
{
|
||||
x += textwidth(e->xany.display, awesomeconf[screen].font, awesomeconf[screen].tags[i].name);
|
||||
if(((awesomeconf[screen].statusbar.position == BarTop
|
||||
|| awesomeconf[screen].statusbar.position == BarBot)
|
||||
x += textwidth(e->xany.display, awesomeconf->screens[screen].font, awesomeconf->screens[screen].tags[i].name);
|
||||
if(((awesomeconf->screens[screen].statusbar.position == BarTop
|
||||
|| awesomeconf->screens[screen].statusbar.position == BarBot)
|
||||
&& ev->x < x)
|
||||
|| (awesomeconf[screen].statusbar.position == BarRight && ev->y < x)
|
||||
|| (awesomeconf[screen].statusbar.position == BarLeft && ev->y > awesomeconf[screen].statusbar.width - x))
|
||||
|| (awesomeconf->screens[screen].statusbar.position == BarRight && ev->y < x)
|
||||
|| (awesomeconf->screens[screen].statusbar.position == BarLeft && ev->y > awesomeconf->screens[screen].statusbar.width - x))
|
||||
{
|
||||
snprintf(arg, sizeof(arg), "%d", i + 1);
|
||||
handle_mouse_button_press(&awesomeconf[screen], ev->button, ev->state,
|
||||
awesomeconf[screen].buttons.tag, arg);
|
||||
handle_mouse_button_press(awesomeconf, screen, ev->button, ev->state,
|
||||
awesomeconf->buttons.tag, arg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
x += awesomeconf[screen].statusbar.txtlayoutwidth;
|
||||
if(((awesomeconf[screen].statusbar.position == BarTop
|
||||
|| awesomeconf[screen].statusbar.position == BarBot)
|
||||
x += awesomeconf->screens[screen].statusbar.txtlayoutwidth;
|
||||
if(((awesomeconf->screens[screen].statusbar.position == BarTop
|
||||
|| awesomeconf->screens[screen].statusbar.position == BarBot)
|
||||
&& ev->x < x)
|
||||
|| (awesomeconf[screen].statusbar.position == BarRight && ev->y < x)
|
||||
|| (awesomeconf[screen].statusbar.position == BarLeft && ev->y > awesomeconf[screen].statusbar.width - x))
|
||||
handle_mouse_button_press(&awesomeconf[screen], ev->button, ev->state,
|
||||
awesomeconf[screen].buttons.layout, NULL);
|
||||
|| (awesomeconf->screens[screen].statusbar.position == BarRight && ev->y < x)
|
||||
|| (awesomeconf->screens[screen].statusbar.position == BarLeft && ev->y > awesomeconf->screens[screen].statusbar.width - x))
|
||||
handle_mouse_button_press(awesomeconf, screen, ev->button, ev->state,
|
||||
awesomeconf->buttons.layout, NULL);
|
||||
else
|
||||
handle_mouse_button_press(&awesomeconf[screen], ev->button, ev->state,
|
||||
awesomeconf[screen].buttons.title, NULL);
|
||||
handle_mouse_button_press(awesomeconf, screen, ev->button, ev->state,
|
||||
awesomeconf->buttons.title, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if((c = get_client_bywin(*awesomeconf->clients, ev->window)))
|
||||
if((c = get_client_bywin(awesomeconf->clients, ev->window)))
|
||||
{
|
||||
focus(c, ev->same_screen, &awesomeconf[c->screen]);
|
||||
if(CLEANMASK(ev->state, awesomeconf[c->screen]) == NoSymbol
|
||||
focus(c, ev->same_screen, awesomeconf, c->screen);
|
||||
if(CLEANMASK(ev->state, awesomeconf) == NoSymbol
|
||||
&& ev->button == Button1)
|
||||
{
|
||||
restack(&awesomeconf[c->screen]);
|
||||
restack(awesomeconf, c->screen);
|
||||
XAllowEvents(c->display, ReplayPointer, CurrentTime);
|
||||
window_grabbuttons(c->display, c->phys_screen, c->win,
|
||||
True, True, awesomeconf->buttons.root,
|
||||
awesomeconf->buttons.client, awesomeconf->numlockmask);
|
||||
}
|
||||
else
|
||||
handle_mouse_button_press(&awesomeconf[c->screen], ev->button, ev->state,
|
||||
awesomeconf[c->screen].buttons.client, NULL);
|
||||
handle_mouse_button_press(awesomeconf, c->screen, ev->button, ev->state,
|
||||
awesomeconf->buttons.client, NULL);
|
||||
}
|
||||
else
|
||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||
|
@ -121,8 +121,8 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
|
|||
&& XQueryPointer(e->xany.display, ev->window, &wdummy, &wdummy, &x, &y, &i, &i, &udummy))
|
||||
{
|
||||
screen = get_screen_bycoord(e->xany.display, x, y);
|
||||
handle_mouse_button_press(&awesomeconf[screen], ev->button, ev->state,
|
||||
awesomeconf[screen].buttons.root, NULL);
|
||||
handle_mouse_button_press(awesomeconf, screen, ev->button, ev->state,
|
||||
awesomeconf->buttons.root, NULL);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -135,14 +135,14 @@ handle_event_configurerequest(XEvent * e, awesome_config *awesomeconf)
|
|||
XWindowChanges wc;
|
||||
int old_screen;
|
||||
|
||||
if((c = get_client_bywin(*awesomeconf->clients, ev->window)))
|
||||
if((c = get_client_bywin(awesomeconf->clients, ev->window)))
|
||||
{
|
||||
c->ismax = False;
|
||||
if(ev->value_mask & CWBorderWidth)
|
||||
c->border = ev->border_width;
|
||||
if(c->isfixed || c->isfloating
|
||||
|| get_current_layout(awesomeconf[c->screen].tags,
|
||||
awesomeconf[c->screen].ntags)->arrange == layout_floating)
|
||||
|| get_current_layout(awesomeconf->screens[c->screen].tags,
|
||||
awesomeconf->screens[c->screen].ntags)->arrange == layout_floating)
|
||||
{
|
||||
if(ev->value_mask & CWX)
|
||||
c->rx = c->x = ev->x;
|
||||
|
@ -159,13 +159,13 @@ handle_event_configurerequest(XEvent * e, awesome_config *awesomeconf)
|
|||
c->screen = get_screen_bycoord(c->display, c->x, c->y);
|
||||
if(old_screen != c->screen)
|
||||
{
|
||||
move_client_to_screen(c, &awesomeconf[c->screen], False);
|
||||
drawstatusbar(&awesomeconf[old_screen]);
|
||||
drawstatusbar(&awesomeconf[c->screen]);
|
||||
move_client_to_screen(c, awesomeconf, c->screen, False);
|
||||
drawstatusbar(awesomeconf, old_screen);
|
||||
drawstatusbar(awesomeconf, c->screen);
|
||||
}
|
||||
tag_client_with_rules(c, &awesomeconf[c->screen]);
|
||||
tag_client_with_rules(c, awesomeconf);
|
||||
XMoveResizeWindow(e->xany.display, c->win, c->rx, c->ry, c->rw, c->rh);
|
||||
arrange(&awesomeconf[c->screen]);
|
||||
arrange(awesomeconf, c->screen);
|
||||
}
|
||||
else
|
||||
window_configure(c->display, c->win, c->x, c->y, c->w, c->h, c->border);
|
||||
|
@ -200,17 +200,17 @@ handle_event_configurenotify(XEvent * e, awesome_config *awesomeconf)
|
|||
DisplayHeight(e->xany.display, screen) = ev->height;
|
||||
|
||||
/* update statusbar */
|
||||
si = get_screen_info(e->xany.display, screen, NULL, &awesomeconf->padding);
|
||||
awesomeconf[screen].statusbar.width = si[screen].width;
|
||||
si = get_screen_info(e->xany.display, screen, NULL, &awesomeconf->screens[screen].padding);
|
||||
awesomeconf->screens[screen].statusbar.width = si[screen].width;
|
||||
p_delete(&si);
|
||||
|
||||
XResizeWindow(e->xany.display,
|
||||
awesomeconf[screen].statusbar.window,
|
||||
awesomeconf[screen].statusbar.width,
|
||||
awesomeconf[screen].statusbar.height);
|
||||
awesomeconf->screens[screen].statusbar.window,
|
||||
awesomeconf->screens[screen].statusbar.width,
|
||||
awesomeconf->screens[screen].statusbar.height);
|
||||
|
||||
updatebarpos(e->xany.display, awesomeconf[screen].statusbar, &awesomeconf[screen].padding);
|
||||
arrange(&awesomeconf[screen]);
|
||||
updatebarpos(e->xany.display, awesomeconf->screens[screen].statusbar, &awesomeconf->screens[screen].padding);
|
||||
arrange(awesomeconf, screen);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -220,8 +220,8 @@ handle_event_destroynotify(XEvent * e, awesome_config *awesomeconf)
|
|||
Client *c;
|
||||
XDestroyWindowEvent *ev = &e->xdestroywindow;
|
||||
|
||||
if((c = get_client_bywin(*awesomeconf->clients, ev->window)))
|
||||
client_unmanage(c, WithdrawnState, &awesomeconf[c->screen]);
|
||||
if((c = get_client_bywin(awesomeconf->clients, ev->window)))
|
||||
client_unmanage(c, WithdrawnState, awesomeconf);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -233,12 +233,12 @@ 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((c = get_client_bywin(awesomeconf->clients, ev->window)))
|
||||
{
|
||||
focus(c, ev->same_screen, &awesomeconf[c->screen]);
|
||||
focus(c, ev->same_screen, awesomeconf, c->screen);
|
||||
if (c->isfloating
|
||||
|| get_current_layout(awesomeconf[c->screen].tags,
|
||||
awesomeconf[c->screen].ntags)->arrange == layout_floating)
|
||||
|| get_current_layout(awesomeconf->screens[c->screen].tags,
|
||||
awesomeconf->screens[c->screen].ntags)->arrange == layout_floating)
|
||||
window_grabbuttons(c->display, c->phys_screen, c->win,
|
||||
True, False, awesomeconf->buttons.root,
|
||||
awesomeconf->buttons.client, awesomeconf->numlockmask);
|
||||
|
@ -246,7 +246,7 @@ handle_event_enternotify(XEvent * e, awesome_config *awesomeconf)
|
|||
else
|
||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||
if(ev->window == RootWindow(e->xany.display, screen))
|
||||
focus(NULL, True, &awesomeconf[screen]);
|
||||
focus(NULL, True, awesomeconf, screen);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -257,8 +257,8 @@ handle_event_expose(XEvent * e, awesome_config *awesomeconf)
|
|||
|
||||
if(!ev->count)
|
||||
for(screen = 0; screen < get_screen_count(e->xany.display); screen++)
|
||||
if(awesomeconf[screen].statusbar.window == ev->window)
|
||||
drawstatusbar(&awesomeconf[screen]);
|
||||
if(awesomeconf->screens[screen].statusbar.window == ev->window)
|
||||
drawstatusbar(awesomeconf, screen);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -286,11 +286,11 @@ handle_event_keypress(XEvent * e, awesome_config *awesomeconf)
|
|||
break;
|
||||
}
|
||||
|
||||
for(k = awesomeconf[screen].keys; k; k = k->next)
|
||||
for(k = awesomeconf->keys; k; k = k->next)
|
||||
if(keysym == k->keysym && k->func
|
||||
&& CLEANMASK(k->mod, awesomeconf[screen]) == CLEANMASK(ev->state, awesomeconf[screen]))
|
||||
&& CLEANMASK(k->mod, awesomeconf) == CLEANMASK(ev->state, awesomeconf))
|
||||
{
|
||||
k->func(&awesomeconf[screen], k->arg);
|
||||
k->func(awesomeconf, screen, k->arg);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ handle_event_leavenotify(XEvent * e, awesome_config *awesomeconf)
|
|||
|
||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||
if((ev->window == RootWindow(e->xany.display, screen)) && !ev->same_screen)
|
||||
focus(NULL, ev->same_screen, &awesomeconf[screen]);
|
||||
focus(NULL, ev->same_screen, awesomeconf, screen);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -315,7 +315,7 @@ handle_event_mappingnotify(XEvent * e, awesome_config *awesomeconf)
|
|||
XRefreshKeyboardMapping(ev);
|
||||
if(ev->request == MappingKeyboard)
|
||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||
grabkeys(&awesomeconf[screen]);
|
||||
grabkeys(awesomeconf, get_phys_screen(awesomeconf->display, screen));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -331,13 +331,13 @@ handle_event_maprequest(XEvent * e, awesome_config *awesomeconf)
|
|||
return;
|
||||
if(wa.override_redirect)
|
||||
return;
|
||||
if(!get_client_bywin(*awesomeconf->clients, ev->window))
|
||||
if(!get_client_bywin(awesomeconf->clients, ev->window))
|
||||
{
|
||||
for(screen = 0; wa.screen != ScreenOfDisplay(e->xany.display, screen); screen++);
|
||||
if(screen == 0 && XQueryPointer(e->xany.display, RootWindow(e->xany.display, screen),
|
||||
&dummy, &dummy, &x, &y, &d, &d, &m))
|
||||
screen = get_screen_bycoord(e->xany.display, x, y);
|
||||
client_manage(ev->window, &wa, &awesomeconf[screen]);
|
||||
client_manage(ev->window, &wa, awesomeconf, screen);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -350,14 +350,14 @@ handle_event_propertynotify(XEvent * e, awesome_config *awesomeconf)
|
|||
|
||||
if(ev->state == PropertyDelete)
|
||||
return; /* ignore */
|
||||
if((c = get_client_bywin(*awesomeconf->clients, ev->window)))
|
||||
if((c = get_client_bywin(awesomeconf->clients, ev->window)))
|
||||
{
|
||||
switch (ev->atom)
|
||||
{
|
||||
case XA_WM_TRANSIENT_FOR:
|
||||
XGetTransientForHint(e->xany.display, c->win, &trans);
|
||||
if(!c->isfloating && (c->isfloating = (get_client_bywin(*awesomeconf->clients, trans) != NULL)))
|
||||
arrange(&awesomeconf[c->screen]);
|
||||
if(!c->isfloating && (c->isfloating = (get_client_bywin(awesomeconf->clients, trans) != NULL)))
|
||||
arrange(awesomeconf, c->screen);
|
||||
break;
|
||||
case XA_WM_NORMAL_HINTS:
|
||||
updatesizehints(c);
|
||||
|
@ -366,8 +366,8 @@ 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 == get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel)
|
||||
drawstatusbar(&awesomeconf[c->screen]);
|
||||
if(c == get_current_tag(awesomeconf->screens[c->screen].tags, awesomeconf->screens[c->screen].ntags)->client_sel)
|
||||
drawstatusbar(awesomeconf, c->screen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -378,10 +378,10 @@ handle_event_unmapnotify(XEvent * e, awesome_config *awesomeconf)
|
|||
Client *c;
|
||||
XUnmapEvent *ev = &e->xunmap;
|
||||
|
||||
if((c = get_client_bywin(*awesomeconf->clients, ev->window))
|
||||
if((c = get_client_bywin(awesomeconf->clients, ev->window))
|
||||
&& ev->event == RootWindow(e->xany.display, c->phys_screen)
|
||||
&& ev->send_event && window_getstate(c->display, c->win) == NormalState)
|
||||
client_unmanage(c, WithdrawnState, &awesomeconf[c->screen]);
|
||||
client_unmanage(c, WithdrawnState, awesomeconf);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -389,7 +389,7 @@ handle_event_shape(XEvent * e,
|
|||
awesome_config *awesomeconf __attribute__ ((unused)))
|
||||
{
|
||||
XShapeEvent *ev = (XShapeEvent *) e;
|
||||
Client *c = get_client_bywin(*awesomeconf->clients, ev->window);
|
||||
Client *c = get_client_bywin(awesomeconf->clients, ev->window);
|
||||
|
||||
if(c)
|
||||
window_setshape(c->display, c->phys_screen, c->win);
|
||||
|
@ -403,20 +403,20 @@ handle_event_randr_screen_change_notify(XEvent *e,
|
|||
}
|
||||
|
||||
void
|
||||
grabkeys(awesome_config *awesomeconf)
|
||||
grabkeys(awesome_config *awesomeconf, int phys_screen)
|
||||
{
|
||||
Key *k;
|
||||
KeyCode code;
|
||||
|
||||
XUngrabKey(awesomeconf->display, AnyKey, AnyModifier, RootWindow(awesomeconf->display, awesomeconf->phys_screen));
|
||||
XUngrabKey(awesomeconf->display, AnyKey, AnyModifier, RootWindow(awesomeconf->display, phys_screen));
|
||||
for(k = awesomeconf->keys; k; k = k->next)
|
||||
{
|
||||
if((code = XKeysymToKeycode(awesomeconf->display, k->keysym)) == NoSymbol)
|
||||
continue;
|
||||
XGrabKey(awesomeconf->display, code, k->mod, RootWindow(awesomeconf->display, awesomeconf->phys_screen), True, GrabModeAsync, GrabModeAsync);
|
||||
XGrabKey(awesomeconf->display, code, k->mod | LockMask, RootWindow(awesomeconf->display, awesomeconf->phys_screen), True, GrabModeAsync, GrabModeAsync);
|
||||
XGrabKey(awesomeconf->display, code, k->mod | awesomeconf->numlockmask, RootWindow(awesomeconf->display, awesomeconf->phys_screen), True, GrabModeAsync, GrabModeAsync);
|
||||
XGrabKey(awesomeconf->display, code, k->mod | awesomeconf->numlockmask | LockMask, RootWindow(awesomeconf->display, awesomeconf->phys_screen), True, GrabModeAsync, GrabModeAsync);
|
||||
XGrabKey(awesomeconf->display, code, k->mod, RootWindow(awesomeconf->display, phys_screen), True, GrabModeAsync, GrabModeAsync);
|
||||
XGrabKey(awesomeconf->display, code, k->mod | LockMask, RootWindow(awesomeconf->display, phys_screen), True, GrabModeAsync, GrabModeAsync);
|
||||
XGrabKey(awesomeconf->display, code, k->mod | awesomeconf->numlockmask, RootWindow(awesomeconf->display, phys_screen), True, GrabModeAsync, GrabModeAsync);
|
||||
XGrabKey(awesomeconf->display, code, k->mod | awesomeconf->numlockmask | LockMask, RootWindow(awesomeconf->display, phys_screen), True, GrabModeAsync, GrabModeAsync);
|
||||
}
|
||||
}
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
2
event.h
2
event.h
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "config.h"
|
||||
|
||||
void grabkeys(awesome_config *);
|
||||
void grabkeys(awesome_config *, int);
|
||||
|
||||
void handle_event_buttonpress(XEvent *, awesome_config *);
|
||||
void handle_event_configurerequest(XEvent *, awesome_config *);
|
||||
|
|
161
layout.c
161
layout.c
|
@ -51,23 +51,23 @@ get_current_tag(Tag *tags, int ntags)
|
|||
* \param awesomeconf awesome config
|
||||
*/
|
||||
void
|
||||
arrange(awesome_config *awesomeconf)
|
||||
arrange(awesome_config *awesomeconf, int screen)
|
||||
{
|
||||
Client *c;
|
||||
Tag *curtag = get_current_tag(awesomeconf->tags, awesomeconf->ntags);
|
||||
Tag *curtag = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags);
|
||||
|
||||
for(c = *awesomeconf->clients; c; c = c->next)
|
||||
for(c = awesomeconf->clients; c; c = c->next)
|
||||
{
|
||||
if(isvisible(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags))
|
||||
if(isvisible(c, screen, awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags))
|
||||
client_unban(c);
|
||||
/* we don't touch other screens windows */
|
||||
else if(c->screen == awesomeconf->screen)
|
||||
else if(c->screen == screen)
|
||||
client_ban(c);
|
||||
}
|
||||
|
||||
curtag->layout->arrange(awesomeconf);
|
||||
focus(curtag->client_sel, True, awesomeconf);
|
||||
restack(awesomeconf);
|
||||
curtag->layout->arrange(awesomeconf, screen);
|
||||
focus(curtag->client_sel, True, awesomeconf, screen);
|
||||
restack(awesomeconf, screen);
|
||||
}
|
||||
|
||||
Layout *
|
||||
|
@ -83,114 +83,116 @@ get_current_layout(Tag *tags, int ntags)
|
|||
|
||||
void
|
||||
uicb_client_focusnext(awesome_config * awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *c, *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
|
||||
Client *c, *sel = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->client_sel;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
for(c = sel->next; c && !isvisible(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); c = c->next);
|
||||
for(c = sel->next; c && !isvisible(c, screen, awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags); c = c->next);
|
||||
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, screen, awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags); c = c->next);
|
||||
if(c)
|
||||
{
|
||||
focus(c, True, awesomeconf);
|
||||
restack(awesomeconf);
|
||||
focus(c, True, awesomeconf, screen);
|
||||
restack(awesomeconf, screen);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
uicb_client_focusprev(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *c, *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
|
||||
Client *c, *sel = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->client_sel;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
for(c = sel->prev; c && !isvisible(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); c = c->prev);
|
||||
for(c = sel->prev; c && !isvisible(c, screen, awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags); c = c->prev);
|
||||
if(!c)
|
||||
{
|
||||
for(c = *awesomeconf->clients; c && c->next; c = c->next);
|
||||
for(; c && !isvisible(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); c = c->prev);
|
||||
for(c = awesomeconf->clients; c && c->next; c = c->next);
|
||||
for(; c && !isvisible(c, screen, awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags); c = c->prev);
|
||||
}
|
||||
if(c)
|
||||
{
|
||||
focus(c, True, awesomeconf);
|
||||
restack(awesomeconf);
|
||||
focus(c, True, awesomeconf, screen);
|
||||
restack(awesomeconf, screen);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
loadawesomeprops(awesome_config * awesomeconf)
|
||||
loadawesomeprops(awesome_config * awesomeconf, int screen)
|
||||
{
|
||||
int i;
|
||||
char *prop;
|
||||
|
||||
prop = p_new(char, awesomeconf->ntags + 1);
|
||||
prop = p_new(char, awesomeconf->screens[screen].ntags + 1);
|
||||
|
||||
if(xgettextprop(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen),
|
||||
AWESOMEPROPS_ATOM(awesomeconf->display), prop, awesomeconf->ntags + 1))
|
||||
for(i = 0; i < awesomeconf->ntags && prop[i]; i++)
|
||||
if(xgettextprop(awesomeconf->display, RootWindow(awesomeconf->display, get_phys_screen(awesomeconf->display, screen)),
|
||||
AWESOMEPROPS_ATOM(awesomeconf->display), prop, awesomeconf->screens[screen].ntags + 1))
|
||||
for(i = 0; i < awesomeconf->screens[screen].ntags && prop[i]; i++)
|
||||
if(prop[i] == '1')
|
||||
awesomeconf->tags[i].selected = True;
|
||||
awesomeconf->screens[screen].tags[i].selected = True;
|
||||
else
|
||||
awesomeconf->tags[i].selected = False;
|
||||
awesomeconf->screens[screen].tags[i].selected = False;
|
||||
|
||||
p_delete(&prop);
|
||||
}
|
||||
|
||||
void
|
||||
restack(awesome_config *awesomeconf)
|
||||
restack(awesome_config *awesomeconf, int screen)
|
||||
{
|
||||
Client *c, *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
|
||||
Client *c, *sel = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->client_sel;
|
||||
XEvent ev;
|
||||
XWindowChanges wc;
|
||||
|
||||
drawstatusbar(awesomeconf);
|
||||
drawstatusbar(awesomeconf, screen);
|
||||
if(!sel)
|
||||
return;
|
||||
if(awesomeconf->allow_lower_floats)
|
||||
if(awesomeconf->screens[screen].allow_lower_floats)
|
||||
XRaiseWindow(awesomeconf->display, sel->win);
|
||||
else
|
||||
{
|
||||
if(sel->isfloating ||
|
||||
get_current_layout(awesomeconf->tags, awesomeconf->ntags)->arrange == layout_floating)
|
||||
get_current_layout(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->arrange == layout_floating)
|
||||
XRaiseWindow(sel->display, sel->win);
|
||||
if(!(get_current_layout(awesomeconf->tags, awesomeconf->ntags)->arrange == layout_floating))
|
||||
if(!(get_current_layout(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->arrange == layout_floating))
|
||||
{
|
||||
wc.stack_mode = Below;
|
||||
wc.sibling = awesomeconf->statusbar.window;
|
||||
wc.sibling = awesomeconf->screens[screen].statusbar.window;
|
||||
if(!sel->isfloating)
|
||||
{
|
||||
XConfigureWindow(sel->display, sel->win, CWSibling | CWStackMode, &wc);
|
||||
wc.sibling = 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, screen, awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags) || c == sel)
|
||||
continue;
|
||||
XConfigureWindow(awesomeconf->display, c->win, CWSibling | CWStackMode, &wc);
|
||||
wc.sibling = c->win;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(awesomeconf->focus_move_pointer)
|
||||
if(awesomeconf->screens[screen].focus_move_pointer)
|
||||
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));
|
||||
}
|
||||
|
||||
void
|
||||
saveawesomeprops(awesome_config *awesomeconf)
|
||||
saveawesomeprops(awesome_config *awesomeconf, int screen)
|
||||
{
|
||||
int i;
|
||||
char *prop;
|
||||
|
||||
prop = p_new(char, awesomeconf->ntags + 1);
|
||||
for(i = 0; i < awesomeconf->ntags; i++)
|
||||
prop[i] = awesomeconf->tags[i].selected ? '1' : '0';
|
||||
prop = p_new(char, awesomeconf->screens[screen].ntags + 1);
|
||||
for(i = 0; i < awesomeconf->screens[screen].ntags; i++)
|
||||
prop[i] = awesomeconf->screens[screen].tags[i].selected ? '1' : '0';
|
||||
prop[i] = '\0';
|
||||
XChangeProperty(awesomeconf->display, RootWindow(awesomeconf->display, awesomeconf->phys_screen),
|
||||
XChangeProperty(awesomeconf->display, RootWindow(awesomeconf->display, get_phys_screen(awesomeconf->display, screen)),
|
||||
AWESOMEPROPS_ATOM(awesomeconf->display), XA_STRING, 8,
|
||||
PropModeReplace, (unsigned char *) prop, i);
|
||||
p_delete(&prop);
|
||||
|
@ -198,6 +200,7 @@ saveawesomeprops(awesome_config *awesomeconf)
|
|||
|
||||
void
|
||||
uicb_tag_setlayout(awesome_config * awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
{
|
||||
int i, j;
|
||||
|
@ -205,33 +208,33 @@ uicb_tag_setlayout(awesome_config * awesomeconf,
|
|||
if(arg)
|
||||
{
|
||||
/* compute current index */
|
||||
for(i = 0; i < awesomeconf->nlayouts &&
|
||||
&awesomeconf->layouts[i] != get_current_layout(awesomeconf->tags, awesomeconf->ntags); i++);
|
||||
for(i = 0; i < awesomeconf->screens[screen].nlayouts &&
|
||||
&awesomeconf->screens[screen].layouts[i] != get_current_layout(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags); i++);
|
||||
i = compute_new_value_from_arg(arg, (double) i);
|
||||
if(i >= awesomeconf->nlayouts)
|
||||
if(i >= awesomeconf->screens[screen].nlayouts)
|
||||
i = 0;
|
||||
else if(i < 0)
|
||||
i = awesomeconf->nlayouts - 1;
|
||||
i = awesomeconf->screens[screen].nlayouts - 1;
|
||||
}
|
||||
else
|
||||
i = 0;
|
||||
|
||||
for(j = 0; j < awesomeconf->ntags; j++)
|
||||
if (awesomeconf->tags[j].selected)
|
||||
awesomeconf->tags[j].layout = &awesomeconf->layouts[i];
|
||||
for(j = 0; j < awesomeconf->screens[screen].ntags; j++)
|
||||
if (awesomeconf->screens[screen].tags[j].selected)
|
||||
awesomeconf->screens[screen].tags[j].layout = &awesomeconf->screens[screen].layouts[i];
|
||||
|
||||
if(get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel)
|
||||
arrange(awesomeconf);
|
||||
if(get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->client_sel)
|
||||
arrange(awesomeconf, screen);
|
||||
else
|
||||
drawstatusbar(awesomeconf);
|
||||
drawstatusbar(awesomeconf, screen);
|
||||
|
||||
saveawesomeprops(awesomeconf);
|
||||
saveawesomeprops(awesomeconf, screen);
|
||||
}
|
||||
|
||||
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, int screen)
|
||||
{
|
||||
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
|
||||
Client *sel = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->client_sel;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
@ -247,72 +250,76 @@ maximize(int x, int y, int w, int h, awesome_config *awesomeconf)
|
|||
else
|
||||
sel->isfloating = False;
|
||||
|
||||
arrange(awesomeconf);
|
||||
arrange(awesomeconf, screen);
|
||||
}
|
||||
|
||||
void
|
||||
uicb_client_togglemax(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
ScreenInfo *si = get_screen_info(awesomeconf->display, awesomeconf->screen, &awesomeconf->statusbar, &awesomeconf->padding);
|
||||
ScreenInfo *si = get_screen_info(awesomeconf->display, screen, &awesomeconf->screens[screen].statusbar, &awesomeconf->screens[screen].padding);
|
||||
|
||||
maximize(si[awesomeconf->screen].x_org, si[awesomeconf->screen].y_org,
|
||||
si[awesomeconf->screen].width - 2 * awesomeconf->borderpx,
|
||||
si[awesomeconf->screen].height - 2 * awesomeconf->borderpx,
|
||||
awesomeconf);
|
||||
maximize(si[screen].x_org, si[screen].y_org,
|
||||
si[screen].width - 2 * awesomeconf->screens[screen].borderpx,
|
||||
si[screen].height - 2 * awesomeconf->screens[screen].borderpx,
|
||||
awesomeconf, screen);
|
||||
p_delete(&si);
|
||||
}
|
||||
|
||||
void
|
||||
uicb_client_toggleverticalmax(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
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, &awesomeconf->padding);
|
||||
Client *sel = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->client_sel;
|
||||
ScreenInfo *si = get_screen_info(awesomeconf->display, screen, &awesomeconf->screens[screen].statusbar, &awesomeconf->screens[screen].padding);
|
||||
|
||||
if(sel)
|
||||
maximize(sel->x,
|
||||
si[awesomeconf->screen].y_org,
|
||||
si[screen].y_org,
|
||||
sel->w,
|
||||
si[awesomeconf->screen].height - 2 * awesomeconf->borderpx,
|
||||
awesomeconf);
|
||||
si[screen].height - 2 * awesomeconf->screens[screen].borderpx,
|
||||
awesomeconf, screen);
|
||||
p_delete(&si);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
uicb_client_togglehorizontalmax(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
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, &awesomeconf->padding);
|
||||
Client *sel = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->client_sel;
|
||||
ScreenInfo *si = get_screen_info(awesomeconf->display, screen, &awesomeconf->screens[screen].statusbar, &awesomeconf->screens[screen].padding);
|
||||
|
||||
if(sel)
|
||||
maximize(si[awesomeconf->screen].x_org,
|
||||
maximize(si[screen].x_org,
|
||||
sel->y,
|
||||
si[awesomeconf->screen].height - 2 * awesomeconf->borderpx,
|
||||
si[screen].height - 2 * awesomeconf->screens[screen].borderpx,
|
||||
sel->h,
|
||||
awesomeconf);
|
||||
awesomeconf, screen);
|
||||
p_delete(&si);
|
||||
}
|
||||
|
||||
void
|
||||
uicb_client_zoom(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
|
||||
Client *sel = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->client_sel;
|
||||
|
||||
if(*awesomeconf->clients == sel)
|
||||
for(sel = sel->next; sel && !isvisible(sel, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags); sel = sel->next);
|
||||
if(awesomeconf->clients == sel)
|
||||
for(sel = sel->next; sel && !isvisible(sel, screen, awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags); sel = sel->next);
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
||||
client_detach(awesomeconf->clients, sel);
|
||||
client_attach(awesomeconf->clients, sel);
|
||||
client_detach(&awesomeconf->clients, sel);
|
||||
client_attach(&awesomeconf->clients, sel);
|
||||
|
||||
focus(sel, True, awesomeconf);
|
||||
arrange(awesomeconf);
|
||||
focus(sel, True, awesomeconf, screen);
|
||||
arrange(awesomeconf, screen);
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
8
layout.h
8
layout.h
|
@ -26,12 +26,12 @@
|
|||
|
||||
#define AWESOMEPROPS_ATOM(disp) XInternAtom(disp, "_AWESOME_PROPERTIES", False)
|
||||
|
||||
void arrange(awesome_config *);
|
||||
void arrange(awesome_config *, int);
|
||||
Layout * get_current_layout(Tag *, int);
|
||||
Tag * get_current_tag(Tag *, int);
|
||||
void restack(awesome_config *);
|
||||
void loadawesomeprops(awesome_config *);
|
||||
void saveawesomeprops(awesome_config *);
|
||||
void restack(awesome_config *, int);
|
||||
void loadawesomeprops(awesome_config *, int);
|
||||
void saveawesomeprops(awesome_config *, int);
|
||||
|
||||
UICB_PROTO(uicb_client_focusnext);
|
||||
UICB_PROTO(uicb_client_focusprev);
|
||||
|
|
|
@ -23,12 +23,12 @@
|
|||
#include "layouts/floating.h"
|
||||
|
||||
void
|
||||
layout_floating(awesome_config *awesomeconf)
|
||||
layout_floating(awesome_config *awesomeconf, int screen)
|
||||
{
|
||||
Client *c;
|
||||
|
||||
for(c = *awesomeconf->clients; c; c = c->next)
|
||||
if(isvisible(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags))
|
||||
for(c = awesomeconf->clients; c; c = c->next)
|
||||
if(isvisible(c, screen, awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags))
|
||||
client_resize(c, c->rx, c->ry, c->rw, c->rh, awesomeconf, True, False);
|
||||
}
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
|
@ -25,16 +25,16 @@
|
|||
#include "layouts/max.h"
|
||||
|
||||
void
|
||||
layout_max(awesome_config *awesomeconf)
|
||||
layout_max(awesome_config *awesomeconf, int screen)
|
||||
{
|
||||
Client *c;
|
||||
ScreenInfo *si = get_screen_info(awesomeconf->display, awesomeconf->screen, &awesomeconf->statusbar, &awesomeconf->padding);
|
||||
ScreenInfo *si = get_screen_info(awesomeconf->display, screen, &awesomeconf->screens[screen].statusbar, &awesomeconf->screens[screen].padding);
|
||||
|
||||
for(c = *awesomeconf->clients; c; c = c->next)
|
||||
if(IS_TILED(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags))
|
||||
client_resize(c, si[awesomeconf->screen].x_org, si[awesomeconf->screen].y_org,
|
||||
si[awesomeconf->screen].width - 2 * c->border,
|
||||
si[awesomeconf->screen].height - 2 * c->border, awesomeconf, awesomeconf->resize_hints, False);
|
||||
for(c = awesomeconf->clients; c; c = c->next)
|
||||
if(IS_TILED(c, screen, awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags))
|
||||
client_resize(c, si[screen].x_org, si[screen].y_org,
|
||||
si[screen].width - 2 * c->border,
|
||||
si[screen].height - 2 * c->border, awesomeconf, awesomeconf->screens[screen].resize_hints, False);
|
||||
p_delete(&si);
|
||||
}
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
|
@ -30,9 +30,10 @@
|
|||
|
||||
void
|
||||
uicb_tag_setnmaster(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char * arg)
|
||||
{
|
||||
Tag *curtag = get_current_tag(awesomeconf->tags, awesomeconf->ntags);
|
||||
Tag *curtag = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags);
|
||||
Layout *curlay = curtag->layout;
|
||||
|
||||
if(!arg || (curlay->arrange != layout_tile && curlay->arrange != layout_tileleft))
|
||||
|
@ -41,14 +42,15 @@ uicb_tag_setnmaster(awesome_config *awesomeconf,
|
|||
if((curtag->nmaster = (int) compute_new_value_from_arg(arg, (double) curtag->nmaster)) < 0)
|
||||
curtag->nmaster = 0;
|
||||
|
||||
arrange(awesomeconf);
|
||||
arrange(awesomeconf, screen);
|
||||
}
|
||||
|
||||
void
|
||||
uicb_tag_setncol(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char * arg)
|
||||
{
|
||||
Tag *curtag = get_current_tag(awesomeconf->tags, awesomeconf->ntags);
|
||||
Tag *curtag = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags);
|
||||
Layout *curlay = curtag->layout;
|
||||
|
||||
if(!arg || (curlay->arrange != layout_tile && curlay->arrange != layout_tileleft))
|
||||
|
@ -57,15 +59,16 @@ uicb_tag_setncol(awesome_config *awesomeconf,
|
|||
if((curtag->ncol = (int) compute_new_value_from_arg(arg, (double) curtag->ncol)) < 1)
|
||||
curtag->ncol = 1;
|
||||
|
||||
arrange(awesomeconf);
|
||||
arrange(awesomeconf, screen);
|
||||
}
|
||||
|
||||
void
|
||||
uicb_tag_setmwfact(awesome_config * awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
{
|
||||
char *newarg;
|
||||
Tag *curtag = get_current_tag(awesomeconf->tags, awesomeconf->ntags);
|
||||
Tag *curtag = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags);
|
||||
Layout *curlay = curtag->layout;
|
||||
|
||||
if(!arg || (curlay->arrange != layout_tile && curlay->arrange != layout_tileleft))
|
||||
|
@ -85,12 +88,12 @@ uicb_tag_setmwfact(awesome_config * awesomeconf,
|
|||
else if(curtag->mwfact > 0.9)
|
||||
curtag->mwfact = 0.9;
|
||||
|
||||
arrange(awesomeconf);
|
||||
arrange(awesomeconf, screen);
|
||||
p_delete(&newarg);
|
||||
}
|
||||
|
||||
static void
|
||||
_tile(awesome_config *awesomeconf, const Bool right)
|
||||
_tile(awesome_config *awesomeconf, int screen, const Bool right)
|
||||
{
|
||||
/* windows area geometry */
|
||||
int wah = 0, waw = 0, wax = 0, way = 0;
|
||||
|
@ -102,18 +105,18 @@ _tile(awesome_config *awesomeconf, const Bool right)
|
|||
int real_ncol = 1, win_by_col = 1, current_col = 0;
|
||||
ScreenInfo *screens_info = NULL;
|
||||
Client *c;
|
||||
Tag *curtag = get_current_tag(awesomeconf->tags, awesomeconf->ntags);
|
||||
Tag *curtag = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags);
|
||||
|
||||
screens_info = get_screen_info(awesomeconf->display, awesomeconf->screen, &awesomeconf->statusbar, &awesomeconf->padding);
|
||||
screens_info = get_screen_info(awesomeconf->display, screen, &awesomeconf->screens[screen].statusbar, &awesomeconf->screens[screen].padding);
|
||||
|
||||
for(n = 0, c = *awesomeconf->clients; c; c = c->next)
|
||||
if(IS_TILED(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags))
|
||||
for(n = 0, c = awesomeconf->clients; c; c = c->next)
|
||||
if(IS_TILED(c, screen, awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags))
|
||||
n++;
|
||||
|
||||
wah = screens_info[awesomeconf->screen].height;
|
||||
waw = screens_info[awesomeconf->screen].width;
|
||||
wax = screens_info[awesomeconf->screen].x_org;
|
||||
way = screens_info[awesomeconf->screen].y_org;
|
||||
wah = screens_info[screen].height;
|
||||
waw = screens_info[screen].width;
|
||||
wax = screens_info[screen].x_org;
|
||||
way = screens_info[screen].y_org;
|
||||
|
||||
masterwin = MIN(n, curtag->nmaster);
|
||||
|
||||
|
@ -132,9 +135,9 @@ _tile(awesome_config *awesomeconf, const Bool right)
|
|||
|
||||
real_ncol = MIN(otherwin, curtag->ncol);
|
||||
|
||||
for(i = 0, c = *awesomeconf->clients; c; c = c->next)
|
||||
for(i = 0, c = awesomeconf->clients; c; c = c->next)
|
||||
{
|
||||
if(!IS_TILED(c, awesomeconf->screen, awesomeconf->tags, awesomeconf->ntags))
|
||||
if(!IS_TILED(c, screen, awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags))
|
||||
continue;
|
||||
|
||||
c->ismax = False;
|
||||
|
@ -142,7 +145,7 @@ _tile(awesome_config *awesomeconf, const Bool right)
|
|||
{ /* master */
|
||||
ny = way + i * mh;
|
||||
nx = wax + (right ? 0 : waw - mw);
|
||||
client_resize(c, nx, ny, mw - 2 * c->border, mh - 2 * c->border, awesomeconf, awesomeconf->resize_hints, False);
|
||||
client_resize(c, nx, ny, mw - 2 * c->border, mh - 2 * c->border, awesomeconf, awesomeconf->screens[screen].resize_hints, False);
|
||||
}
|
||||
else
|
||||
{ /* tile window */
|
||||
|
@ -168,7 +171,7 @@ _tile(awesome_config *awesomeconf, const Bool right)
|
|||
ny = way + ((i - curtag->nmaster) % win_by_col) * (nh + 2 * c->border);
|
||||
|
||||
nx = wax + current_col * (nw + 2 * c->border) + (right ? mw : 0);
|
||||
client_resize(c, nx, ny, nw, nh, awesomeconf, awesomeconf->resize_hints, False);
|
||||
client_resize(c, nx, ny, nw, nh, awesomeconf, awesomeconf->screens[screen].resize_hints, False);
|
||||
}
|
||||
i++;
|
||||
}
|
||||
|
@ -176,14 +179,15 @@ _tile(awesome_config *awesomeconf, const Bool right)
|
|||
}
|
||||
|
||||
void
|
||||
layout_tile(awesome_config *awesomeconf)
|
||||
layout_tile(awesome_config *awesomeconf, int screen)
|
||||
{
|
||||
_tile(awesomeconf, True);
|
||||
_tile(awesomeconf, screen, True);
|
||||
}
|
||||
|
||||
void
|
||||
layout_tileleft(awesome_config *awesomeconf)
|
||||
layout_tileleft(awesome_config *awesomeconf, int screen)
|
||||
{
|
||||
_tile(awesomeconf, False);
|
||||
_tile(awesomeconf, screen, False);
|
||||
}
|
||||
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
42
mouse.c
42
mouse.c
|
@ -29,25 +29,25 @@
|
|||
#include "layouts/floating.h"
|
||||
|
||||
void
|
||||
uicb_client_movemouse(awesome_config *awesomeconf, const char *arg __attribute__ ((unused)))
|
||||
uicb_client_movemouse(awesome_config *awesomeconf, int screen, const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
int x1, y1, ocx, ocy, di, nx, ny;
|
||||
unsigned int dui;
|
||||
Window dummy;
|
||||
XEvent ev;
|
||||
ScreenInfo *si;
|
||||
Client *c = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
|
||||
Client *c = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->client_sel;
|
||||
|
||||
if(!c)
|
||||
return;
|
||||
|
||||
if((get_current_layout(awesomeconf->tags, awesomeconf->ntags)->arrange != layout_floating)
|
||||
if((get_current_layout(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->arrange != layout_floating)
|
||||
&& !c->isfloating)
|
||||
uicb_client_togglefloating(awesomeconf, "DUMMY");
|
||||
uicb_client_togglefloating(awesomeconf, screen, "DUMMY");
|
||||
else
|
||||
restack(awesomeconf);
|
||||
restack(awesomeconf, screen);
|
||||
|
||||
si = get_screen_info(c->display, c->screen, &awesomeconf->statusbar, &awesomeconf->padding);
|
||||
si = get_screen_info(c->display, c->screen, &awesomeconf->screens[screen].statusbar, &awesomeconf->screens[screen].padding);
|
||||
|
||||
ocx = nx = c->x;
|
||||
ocy = ny = c->y;
|
||||
|
@ -65,25 +65,25 @@ uicb_client_movemouse(awesome_config *awesomeconf, const char *arg __attribute__
|
|||
p_delete(&si);
|
||||
return;
|
||||
case ConfigureRequest:
|
||||
handle_event_configurerequest(&ev, &awesomeconf[0 - awesomeconf->screen]);
|
||||
handle_event_configurerequest(&ev, awesomeconf);
|
||||
break;
|
||||
case Expose:
|
||||
handle_event_expose(&ev, &awesomeconf[0 - awesomeconf->screen]);
|
||||
handle_event_expose(&ev, awesomeconf);
|
||||
break;
|
||||
case MapRequest:
|
||||
handle_event_maprequest(&ev, &awesomeconf[0 - awesomeconf->screen]);
|
||||
handle_event_maprequest(&ev, awesomeconf);
|
||||
break;
|
||||
case MotionNotify:
|
||||
XSync(c->display, False);
|
||||
nx = ocx + (ev.xmotion.x - x1);
|
||||
ny = ocy + (ev.xmotion.y - y1);
|
||||
if(abs(nx) < awesomeconf->snap + si[c->screen].x_org && nx > si[c->screen].x_org)
|
||||
if(abs(nx) < awesomeconf->screens[screen].snap + si[c->screen].x_org && nx > si[c->screen].x_org)
|
||||
nx = si[c->screen].x_org;
|
||||
else if(abs((si[c->screen].x_org + si[c->screen].width) - (nx + c->w + 2 * c->border)) < awesomeconf->snap)
|
||||
else if(abs((si[c->screen].x_org + si[c->screen].width) - (nx + c->w + 2 * c->border)) < awesomeconf->screens[screen].snap)
|
||||
nx = si[c->screen].x_org + si[c->screen].width - c->w - 2 * c->border;
|
||||
if(abs(ny) < awesomeconf->snap + si[c->screen].y_org && ny > si[c->screen].y_org)
|
||||
if(abs(ny) < awesomeconf->screens[screen].snap + si[c->screen].y_org && ny > si[c->screen].y_org)
|
||||
ny = si[c->screen].y_org;
|
||||
else if(abs((si[c->screen].y_org + si[c->screen].height) - (ny + c->h + 2 * c->border)) < awesomeconf->snap)
|
||||
else if(abs((si[c->screen].y_org + si[c->screen].height) - (ny + c->h + 2 * c->border)) < awesomeconf->screens[screen].snap)
|
||||
ny = si[c->screen].y_org + si[c->screen].height - c->h - 2 * c->border;
|
||||
client_resize(c, nx, ny, c->w, c->h, awesomeconf, False, False);
|
||||
break;
|
||||
|
@ -92,20 +92,20 @@ uicb_client_movemouse(awesome_config *awesomeconf, const char *arg __attribute__
|
|||
}
|
||||
|
||||
void
|
||||
uicb_client_resizemouse(awesome_config *awesomeconf, const char *arg __attribute__ ((unused)))
|
||||
uicb_client_resizemouse(awesome_config *awesomeconf, int screen, const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
int ocx, ocy, nw, nh;
|
||||
XEvent ev;
|
||||
Client *c = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
|
||||
Client *c = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->client_sel;
|
||||
|
||||
if(!c)
|
||||
return;
|
||||
|
||||
if((get_current_layout(awesomeconf->tags, awesomeconf->ntags)->arrange != layout_floating)
|
||||
if((get_current_layout(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->arrange != layout_floating)
|
||||
&& !c->isfloating)
|
||||
uicb_client_togglefloating(awesomeconf, "DUMMY");
|
||||
uicb_client_togglefloating(awesomeconf, screen, "DUMMY");
|
||||
else
|
||||
restack(awesomeconf);
|
||||
restack(awesomeconf, screen);
|
||||
|
||||
ocx = c->x;
|
||||
ocy = c->y;
|
||||
|
@ -126,13 +126,13 @@ uicb_client_resizemouse(awesome_config *awesomeconf, const char *arg __attribute
|
|||
while(XCheckMaskEvent(c->display, EnterWindowMask, &ev));
|
||||
return;
|
||||
case ConfigureRequest:
|
||||
handle_event_configurerequest(&ev, &awesomeconf[0 - awesomeconf->screen]);
|
||||
handle_event_configurerequest(&ev, awesomeconf);
|
||||
break;
|
||||
case Expose:
|
||||
handle_event_expose(&ev, &awesomeconf[0 - awesomeconf->screen]);
|
||||
handle_event_expose(&ev, awesomeconf);
|
||||
break;
|
||||
case MapRequest:
|
||||
handle_event_maprequest(&ev, &awesomeconf[0 - awesomeconf->screen]);
|
||||
handle_event_maprequest(&ev, awesomeconf);
|
||||
break;
|
||||
case MotionNotify:
|
||||
XSync(c->display, False);
|
||||
|
|
47
screen.c
47
screen.c
|
@ -177,19 +177,19 @@ get_phys_screen(Display *disp, int screen)
|
|||
* y_org of the new screen
|
||||
*/
|
||||
void
|
||||
move_client_to_screen(Client *c, awesome_config *acf_new, Bool doresize)
|
||||
move_client_to_screen(Client *c, awesome_config *awesomeconf, int new_screen, Bool doresize)
|
||||
{
|
||||
int i, old_screen = c->screen;
|
||||
|
||||
/* if the client was focused on an old screen tag, remove it */
|
||||
for(i = 0; i < acf_new[old_screen - acf_new->screen].ntags; i++)
|
||||
if(acf_new[old_screen - acf_new->screen].tags[i].client_sel == c)
|
||||
acf_new[old_screen - acf_new->screen].tags[i].client_sel = NULL;
|
||||
for(i = 0; i < awesomeconf->screens[old_screen].ntags; i++)
|
||||
if(awesomeconf->screens[old_screen].tags[i].client_sel == c)
|
||||
awesomeconf->screens[old_screen].tags[i].client_sel = NULL;
|
||||
|
||||
/* tag client with new screen tags */
|
||||
tag_client_with_current_selected(c, acf_new);
|
||||
tag_client_with_current_selected(c, awesomeconf, new_screen);
|
||||
|
||||
c->screen = acf_new->screen;
|
||||
c->screen = new_screen;
|
||||
|
||||
if(doresize && old_screen != c->screen)
|
||||
{
|
||||
|
@ -211,17 +211,17 @@ move_client_to_screen(Client *c, awesome_config *acf_new, Bool doresize)
|
|||
if(c->ry + c->rh >= si[c->screen].y_org + si[c->screen].height)
|
||||
c->ry = si[c->screen].y_org + si[c->screen].height - c->rh - 2 * c->border;
|
||||
|
||||
client_resize(c, c->rx, c->ry, c->rw, c->rh, acf_new, True, False);
|
||||
client_resize(c, c->rx, c->ry, c->rw, c->rh, awesomeconf, True, False);
|
||||
|
||||
p_delete(&si);
|
||||
p_delete(&si_old);
|
||||
}
|
||||
|
||||
focus(c, True, acf_new);
|
||||
focus(c, True, awesomeconf, c->screen);
|
||||
|
||||
/* redraw statusbar on all screens */
|
||||
drawstatusbar(&acf_new[old_screen - acf_new->screen]);
|
||||
drawstatusbar(acf_new);
|
||||
drawstatusbar(awesomeconf, old_screen);
|
||||
drawstatusbar(awesomeconf, new_screen);
|
||||
}
|
||||
|
||||
/** Move mouse pointer to x_org and y_xorg of specified screen
|
||||
|
@ -243,25 +243,27 @@ move_mouse_pointer_to_screen(Display *disp, int screen)
|
|||
|
||||
void
|
||||
uicb_screen_focusnext(awesome_config * awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
int next_screen = awesomeconf->screen + 1 >= get_screen_count(awesomeconf->display) ? 0 : awesomeconf->screen + 1;
|
||||
Client *sel = get_current_tag(awesomeconf[next_screen - awesomeconf->screen].tags,
|
||||
awesomeconf[next_screen - awesomeconf->screen].ntags)->client_sel;
|
||||
int next_screen = screen + 1 >= get_screen_count(awesomeconf->display) ? 0 : screen + 1;
|
||||
Client *sel = get_current_tag(awesomeconf->screens[next_screen].tags,
|
||||
awesomeconf->screens[next_screen].ntags)->client_sel;
|
||||
|
||||
focus(sel, True, &awesomeconf[next_screen - awesomeconf->screen]);
|
||||
focus(sel, True, awesomeconf, next_screen - screen);
|
||||
move_mouse_pointer_to_screen(awesomeconf->display, next_screen);
|
||||
}
|
||||
|
||||
void
|
||||
uicb_screen_focusprev(awesome_config * awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
int prev_screen = awesomeconf->screen - 1 < 0 ? get_screen_count(awesomeconf->display) - 1 : awesomeconf->screen - 1;
|
||||
Client *sel = get_current_tag(awesomeconf[prev_screen - awesomeconf->screen].tags,
|
||||
awesomeconf[prev_screen - awesomeconf->screen].ntags)->client_sel;
|
||||
int prev_screen = screen - 1 < 0 ? get_screen_count(awesomeconf->display) - 1 : screen - 1;
|
||||
Client *sel = get_current_tag(awesomeconf->screens[prev_screen].tags,
|
||||
awesomeconf->screens[prev_screen].ntags)->client_sel;
|
||||
|
||||
focus(sel, True, &awesomeconf[prev_screen - awesomeconf->screen]);
|
||||
focus(sel, True, awesomeconf, prev_screen - screen);
|
||||
move_mouse_pointer_to_screen(awesomeconf->display, prev_screen);
|
||||
}
|
||||
|
||||
|
@ -272,10 +274,11 @@ uicb_screen_focusprev(awesome_config * awesomeconf,
|
|||
*/
|
||||
void
|
||||
uicb_client_movetoscreen(awesome_config * awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
{
|
||||
int new_screen, prev_screen;
|
||||
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
|
||||
Client *sel = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->client_sel;
|
||||
|
||||
if(!sel || !XineramaIsActive(awesomeconf->display))
|
||||
return;
|
||||
|
@ -291,9 +294,9 @@ uicb_client_movetoscreen(awesome_config * awesomeconf,
|
|||
new_screen = get_screen_count(awesomeconf->display) - 1;
|
||||
|
||||
prev_screen = sel->screen;
|
||||
move_client_to_screen(sel, &awesomeconf[new_screen - awesomeconf->screen], True);
|
||||
move_client_to_screen(sel, awesomeconf, new_screen, True);
|
||||
move_mouse_pointer_to_screen(awesomeconf->display, new_screen);
|
||||
arrange(&awesomeconf[prev_screen - awesomeconf->screen]);
|
||||
arrange(&awesomeconf[new_screen - awesomeconf->screen]);
|
||||
arrange(awesomeconf, prev_screen);
|
||||
arrange(awesomeconf, new_screen);
|
||||
}
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
2
screen.h
2
screen.h
|
@ -33,7 +33,7 @@ ScreenInfo * get_display_info(Display *, int, Statusbar *, Padding *);
|
|||
int get_screen_bycoord(Display *, int, int);
|
||||
int get_screen_count(Display *);
|
||||
int get_phys_screen(Display *, int);
|
||||
void move_client_to_screen(Client *, awesome_config *, Bool);
|
||||
void move_client_to_screen(Client *, awesome_config *, int, Bool);
|
||||
|
||||
UICB_PROTO(uicb_screen_focusnext);
|
||||
UICB_PROTO(uicb_screen_focusprev);
|
||||
|
|
201
statusbar.c
201
statusbar.c
|
@ -36,162 +36,163 @@
|
|||
* \return True or False
|
||||
*/
|
||||
static Bool
|
||||
isoccupied(Client **head, unsigned int t, int screen)
|
||||
isoccupied(Client *head, unsigned int t, int screen)
|
||||
{
|
||||
Client *c;
|
||||
|
||||
for(c = *head; c; c = c->next)
|
||||
for(c = head; c; c = c->next)
|
||||
if(c->tags[t] && c->screen == screen)
|
||||
return True;
|
||||
return False;
|
||||
}
|
||||
|
||||
void
|
||||
drawstatusbar(awesome_config *awesomeconf)
|
||||
drawstatusbar(awesome_config *awesomeconf, int screen)
|
||||
{
|
||||
int z, i, x = 0, y = 0, w;
|
||||
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
|
||||
Client *sel = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->client_sel;
|
||||
Drawable drawable;
|
||||
int phys_screen = get_phys_screen(awesomeconf->display, screen);
|
||||
|
||||
/* don't waste our time */
|
||||
if(awesomeconf->statusbar.position == BarOff)
|
||||
if(awesomeconf->screens[screen].statusbar.position == BarOff)
|
||||
return;
|
||||
|
||||
drawable = XCreatePixmap(awesomeconf->display,
|
||||
RootWindow(awesomeconf->display, awesomeconf->phys_screen),
|
||||
awesomeconf->statusbar.width,
|
||||
awesomeconf->statusbar.height,
|
||||
DefaultDepth(awesomeconf->display, awesomeconf->phys_screen));
|
||||
RootWindow(awesomeconf->display, phys_screen),
|
||||
awesomeconf->screens[screen].statusbar.width,
|
||||
awesomeconf->screens[screen].statusbar.height,
|
||||
DefaultDepth(awesomeconf->display, phys_screen));
|
||||
|
||||
for(i = 0; i < awesomeconf->ntags; i++)
|
||||
for(i = 0; i < awesomeconf->screens[screen].ntags; i++)
|
||||
{
|
||||
w = textwidth(awesomeconf->display, awesomeconf->font,
|
||||
awesomeconf->tags[i].name);
|
||||
if(awesomeconf->tags[i].selected)
|
||||
w = textwidth(awesomeconf->display, awesomeconf->screens[screen].font,
|
||||
awesomeconf->screens[screen].tags[i].name);
|
||||
if(awesomeconf->screens[screen].tags[i].selected)
|
||||
{
|
||||
drawtext(awesomeconf->display, awesomeconf->phys_screen,
|
||||
drawtext(awesomeconf->display, phys_screen,
|
||||
x, y, w,
|
||||
awesomeconf->statusbar.height,
|
||||
awesomeconf->screens[screen].statusbar.height,
|
||||
drawable,
|
||||
awesomeconf->statusbar.width,
|
||||
awesomeconf->statusbar.height,
|
||||
awesomeconf->font,
|
||||
awesomeconf->tags[i].name, awesomeconf->colors_selected);
|
||||
if(isoccupied(awesomeconf->clients, i, awesomeconf->screen))
|
||||
drawrectangle(awesomeconf->display, awesomeconf->phys_screen,
|
||||
awesomeconf->screens[screen].statusbar.width,
|
||||
awesomeconf->screens[screen].statusbar.height,
|
||||
awesomeconf->screens[screen].font,
|
||||
awesomeconf->screens[screen].tags[i].name, awesomeconf->screens[screen].colors_selected);
|
||||
if(isoccupied(awesomeconf->clients, i, screen))
|
||||
drawrectangle(awesomeconf->display, phys_screen,
|
||||
x, y,
|
||||
(awesomeconf->font->height + 2) / 4,
|
||||
(awesomeconf->font->height + 2) / 4,
|
||||
(awesomeconf->screens[screen].font->height + 2) / 4,
|
||||
(awesomeconf->screens[screen].font->height + 2) / 4,
|
||||
drawable,
|
||||
awesomeconf->statusbar.width,
|
||||
awesomeconf->statusbar.height,
|
||||
awesomeconf->screens[screen].statusbar.width,
|
||||
awesomeconf->screens[screen].statusbar.height,
|
||||
sel && sel->tags[i],
|
||||
awesomeconf->colors_selected[ColFG]);
|
||||
awesomeconf->screens[screen].colors_selected[ColFG]);
|
||||
}
|
||||
else
|
||||
{
|
||||
drawtext(awesomeconf->display, awesomeconf->phys_screen,
|
||||
drawtext(awesomeconf->display, phys_screen,
|
||||
x, y, w,
|
||||
awesomeconf->statusbar.height,
|
||||
awesomeconf->screens[screen].statusbar.height,
|
||||
drawable,
|
||||
awesomeconf->statusbar.width,
|
||||
awesomeconf->statusbar.height,
|
||||
awesomeconf->font,
|
||||
awesomeconf->tags[i].name, awesomeconf->colors_normal);
|
||||
if(isoccupied(awesomeconf->clients, i, awesomeconf->screen))
|
||||
drawrectangle(awesomeconf->display, awesomeconf->phys_screen,
|
||||
awesomeconf->screens[screen].statusbar.width,
|
||||
awesomeconf->screens[screen].statusbar.height,
|
||||
awesomeconf->screens[screen].font,
|
||||
awesomeconf->screens[screen].tags[i].name, awesomeconf->screens[screen].colors_normal);
|
||||
if(isoccupied(awesomeconf->clients, i, screen))
|
||||
drawrectangle(awesomeconf->display, phys_screen,
|
||||
x, y,
|
||||
(awesomeconf->font->height + 2) / 4,
|
||||
(awesomeconf->font->height + 2) / 4,
|
||||
(awesomeconf->screens[screen].font->height + 2) / 4,
|
||||
(awesomeconf->screens[screen].font->height + 2) / 4,
|
||||
drawable,
|
||||
awesomeconf->statusbar.width,
|
||||
awesomeconf->statusbar.height,
|
||||
awesomeconf->screens[screen].statusbar.width,
|
||||
awesomeconf->screens[screen].statusbar.height,
|
||||
sel && sel->tags[i],
|
||||
awesomeconf->colors_normal[ColFG]);
|
||||
awesomeconf->screens[screen].colors_normal[ColFG]);
|
||||
}
|
||||
x += w;
|
||||
}
|
||||
drawtext(awesomeconf->display, awesomeconf->phys_screen,
|
||||
x, y, awesomeconf->statusbar.txtlayoutwidth,
|
||||
awesomeconf->statusbar.height,
|
||||
drawtext(awesomeconf->display, phys_screen,
|
||||
x, y, awesomeconf->screens[screen].statusbar.txtlayoutwidth,
|
||||
awesomeconf->screens[screen].statusbar.height,
|
||||
drawable,
|
||||
awesomeconf->statusbar.width,
|
||||
awesomeconf->statusbar.height,
|
||||
awesomeconf->font,
|
||||
get_current_layout(awesomeconf->tags, awesomeconf->ntags)->symbol,
|
||||
awesomeconf->colors_normal);
|
||||
z = x + awesomeconf->statusbar.txtlayoutwidth;
|
||||
w = textwidth(awesomeconf->display, awesomeconf->font, awesomeconf->statustext);
|
||||
x = awesomeconf->statusbar.width - w;
|
||||
awesomeconf->screens[screen].statusbar.width,
|
||||
awesomeconf->screens[screen].statusbar.height,
|
||||
awesomeconf->screens[screen].font,
|
||||
get_current_layout(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->symbol,
|
||||
awesomeconf->screens[screen].colors_normal);
|
||||
z = x + awesomeconf->screens[screen].statusbar.txtlayoutwidth;
|
||||
w = textwidth(awesomeconf->display, awesomeconf->screens[screen].font, awesomeconf->screens[screen].statustext);
|
||||
x = awesomeconf->screens[screen].statusbar.width - w;
|
||||
if(x < z)
|
||||
{
|
||||
x = z;
|
||||
w = awesomeconf->statusbar.width - z;
|
||||
w = awesomeconf->screens[screen].statusbar.width - z;
|
||||
}
|
||||
drawtext(awesomeconf->display, awesomeconf->phys_screen,
|
||||
drawtext(awesomeconf->display, phys_screen,
|
||||
x, y, w,
|
||||
awesomeconf->statusbar.height,
|
||||
awesomeconf->screens[screen].statusbar.height,
|
||||
drawable,
|
||||
awesomeconf->statusbar.width,
|
||||
awesomeconf->statusbar.height,
|
||||
awesomeconf->font,
|
||||
awesomeconf->statustext, awesomeconf->colors_normal);
|
||||
if((w = x - z) > awesomeconf->statusbar.height)
|
||||
awesomeconf->screens[screen].statusbar.width,
|
||||
awesomeconf->screens[screen].statusbar.height,
|
||||
awesomeconf->screens[screen].font,
|
||||
awesomeconf->screens[screen].statustext, awesomeconf->screens[screen].colors_normal);
|
||||
if((w = x - z) > awesomeconf->screens[screen].statusbar.height)
|
||||
{
|
||||
x = z;
|
||||
if(sel && sel->screen == awesomeconf->screen)
|
||||
if(sel && sel->screen == screen)
|
||||
{
|
||||
drawtext(awesomeconf->display, awesomeconf->phys_screen,
|
||||
drawtext(awesomeconf->display, phys_screen,
|
||||
x, y, w,
|
||||
awesomeconf->statusbar.height,
|
||||
awesomeconf->screens[screen].statusbar.height,
|
||||
drawable,
|
||||
awesomeconf->statusbar.width,
|
||||
awesomeconf->statusbar.height,
|
||||
awesomeconf->font,
|
||||
sel->name, awesomeconf->colors_selected);
|
||||
awesomeconf->screens[screen].statusbar.width,
|
||||
awesomeconf->screens[screen].statusbar.height,
|
||||
awesomeconf->screens[screen].font,
|
||||
sel->name, awesomeconf->screens[screen].colors_selected);
|
||||
if(sel->isfloating)
|
||||
drawcircle(awesomeconf->display, awesomeconf->phys_screen,
|
||||
drawcircle(awesomeconf->display, phys_screen,
|
||||
x, y,
|
||||
(awesomeconf->font->height + 2) / 4,
|
||||
(awesomeconf->screens[screen].font->height + 2) / 4,
|
||||
drawable,
|
||||
awesomeconf->statusbar.width,
|
||||
awesomeconf->statusbar.height,
|
||||
awesomeconf->screens[screen].statusbar.width,
|
||||
awesomeconf->screens[screen].statusbar.height,
|
||||
sel->ismax,
|
||||
awesomeconf->colors_selected[ColFG]);
|
||||
awesomeconf->screens[screen].colors_selected[ColFG]);
|
||||
}
|
||||
else
|
||||
drawtext(awesomeconf->display, awesomeconf->phys_screen,
|
||||
drawtext(awesomeconf->display, phys_screen,
|
||||
x, y, w,
|
||||
awesomeconf->statusbar.height,
|
||||
awesomeconf->screens[screen].statusbar.height,
|
||||
drawable,
|
||||
awesomeconf->statusbar.width,
|
||||
awesomeconf->statusbar.height,
|
||||
awesomeconf->font,
|
||||
NULL, awesomeconf->colors_normal);
|
||||
awesomeconf->screens[screen].statusbar.width,
|
||||
awesomeconf->screens[screen].statusbar.height,
|
||||
awesomeconf->screens[screen].font,
|
||||
NULL, awesomeconf->screens[screen].colors_normal);
|
||||
}
|
||||
if(awesomeconf->statusbar.position == BarRight
|
||||
|| awesomeconf->statusbar.position == BarLeft)
|
||||
if(awesomeconf->screens[screen].statusbar.position == BarRight
|
||||
|| awesomeconf->screens[screen].statusbar.position == BarLeft)
|
||||
{
|
||||
Drawable d;
|
||||
if(awesomeconf->statusbar.position == BarRight)
|
||||
d = draw_rotate(awesomeconf->display, awesomeconf->phys_screen, drawable,
|
||||
awesomeconf->statusbar.width, awesomeconf->statusbar.height,
|
||||
M_PI_2, awesomeconf->statusbar.height, 0);
|
||||
if(awesomeconf->screens[screen].statusbar.position == BarRight)
|
||||
d = draw_rotate(awesomeconf->display, phys_screen, drawable,
|
||||
awesomeconf->screens[screen].statusbar.width, awesomeconf->screens[screen].statusbar.height,
|
||||
M_PI_2, awesomeconf->screens[screen].statusbar.height, 0);
|
||||
else
|
||||
d = draw_rotate(awesomeconf->display, awesomeconf->phys_screen, drawable,
|
||||
awesomeconf->statusbar.width, awesomeconf->statusbar.height,
|
||||
- M_PI_2, 0, awesomeconf->statusbar.width);
|
||||
d = draw_rotate(awesomeconf->display, phys_screen, drawable,
|
||||
awesomeconf->screens[screen].statusbar.width, awesomeconf->screens[screen].statusbar.height,
|
||||
- M_PI_2, 0, awesomeconf->screens[screen].statusbar.width);
|
||||
XCopyArea(awesomeconf->display, d,
|
||||
awesomeconf->statusbar.window,
|
||||
DefaultGC(awesomeconf->display, awesomeconf->phys_screen), 0, 0,
|
||||
awesomeconf->statusbar.height, awesomeconf->statusbar.width, 0, 0);
|
||||
awesomeconf->screens[screen].statusbar.window,
|
||||
DefaultGC(awesomeconf->display, phys_screen), 0, 0,
|
||||
awesomeconf->screens[screen].statusbar.height, awesomeconf->screens[screen].statusbar.width, 0, 0);
|
||||
XFreePixmap(awesomeconf->display, d);
|
||||
}
|
||||
else
|
||||
XCopyArea(awesomeconf->display, drawable,
|
||||
awesomeconf->statusbar.window,
|
||||
DefaultGC(awesomeconf->display, awesomeconf->phys_screen), 0, 0,
|
||||
awesomeconf->statusbar.width, awesomeconf->statusbar.height, 0, 0);
|
||||
awesomeconf->screens[screen].statusbar.window,
|
||||
DefaultGC(awesomeconf->display, phys_screen), 0, 0,
|
||||
awesomeconf->screens[screen].statusbar.width, awesomeconf->screens[screen].statusbar.height, 0, 0);
|
||||
XFreePixmap(awesomeconf->display, drawable);
|
||||
XSync(awesomeconf->display, False);
|
||||
}
|
||||
|
@ -272,24 +273,26 @@ updatebarpos(Display *disp, Statusbar statusbar, Padding *padding)
|
|||
|
||||
void
|
||||
uicb_togglebar(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
if(awesomeconf->statusbar.position == BarOff)
|
||||
awesomeconf->statusbar.position = (awesomeconf->statusbar.dposition == BarOff) ? BarTop : awesomeconf->statusbar.dposition;
|
||||
if(awesomeconf->screens[screen].statusbar.position == BarOff)
|
||||
awesomeconf->screens[screen].statusbar.position = (awesomeconf->screens[screen].statusbar.dposition == BarOff) ? BarTop : awesomeconf->screens[screen].statusbar.dposition;
|
||||
else
|
||||
awesomeconf->statusbar.position = BarOff;
|
||||
updatebarpos(awesomeconf->display, awesomeconf->statusbar, &awesomeconf->padding);
|
||||
arrange(awesomeconf);
|
||||
awesomeconf->screens[screen].statusbar.position = BarOff;
|
||||
updatebarpos(awesomeconf->display, awesomeconf->screens[screen].statusbar, &awesomeconf->screens[screen].padding);
|
||||
arrange(awesomeconf, screen);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
uicb_setstatustext(awesome_config *awesomeconf, const char *arg)
|
||||
uicb_setstatustext(awesome_config *awesomeconf, int screen, const char *arg)
|
||||
{
|
||||
if(!arg)
|
||||
return;
|
||||
a_strncpy(awesomeconf->statustext, sizeof(awesomeconf->statustext), arg, a_strlen(arg));
|
||||
a_strncpy(awesomeconf->screens[screen].statustext,
|
||||
sizeof(awesomeconf->screens[screen].statustext), arg, a_strlen(arg));
|
||||
|
||||
drawstatusbar(awesomeconf);
|
||||
drawstatusbar(awesomeconf, screen);
|
||||
}
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "common.h"
|
||||
|
||||
void initstatusbar(Display *, int, Statusbar *, Cursor, XftFont *, Layout *, int, Padding *);
|
||||
void drawstatusbar(awesome_config *);
|
||||
void drawstatusbar(awesome_config *, int);
|
||||
void updatebarpos(Display *, Statusbar, Padding *);
|
||||
|
||||
UICB_PROTO(uicb_togglebar);
|
||||
|
|
112
tag.c
112
tag.c
|
@ -50,13 +50,13 @@ isvisible(Client * c, int screen, Tag * tags, int ntags)
|
|||
}
|
||||
|
||||
void
|
||||
tag_client_with_current_selected(Client *c, awesome_config *awesomeconf)
|
||||
tag_client_with_current_selected(Client *c, awesome_config *awesomeconf, int screen)
|
||||
{
|
||||
int i;
|
||||
|
||||
p_realloc(&c->tags, awesomeconf->ntags);
|
||||
for(i = 0; i < awesomeconf->ntags; i++)
|
||||
c->tags[i] = awesomeconf->tags[i].selected;
|
||||
p_realloc(&c->tags, awesomeconf->screens[screen].ntags);
|
||||
for(i = 0; i < awesomeconf->screens[screen].ntags; i++)
|
||||
c->tags[i] = awesomeconf->screens[screen].tags[i].selected;
|
||||
}
|
||||
|
||||
/** Tag selected window with tag
|
||||
|
@ -65,10 +65,11 @@ tag_client_with_current_selected(Client *c, awesome_config *awesomeconf)
|
|||
*/
|
||||
void
|
||||
uicb_client_tag(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
{
|
||||
int i, tag_id = -1;
|
||||
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
|
||||
Client *sel = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->client_sel;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
@ -76,18 +77,18 @@ uicb_client_tag(awesome_config *awesomeconf,
|
|||
if(arg)
|
||||
{
|
||||
tag_id = atoi(arg) - 1;
|
||||
if(tag_id < 0 || tag_id >= awesomeconf->ntags)
|
||||
if(tag_id < 0 || tag_id >= awesomeconf->screens[screen].ntags)
|
||||
return;
|
||||
}
|
||||
|
||||
for(i = 0; i < awesomeconf->ntags; i++)
|
||||
for(i = 0; i < awesomeconf->screens[screen].ntags; i++)
|
||||
sel->tags[i] = arg == NULL;
|
||||
|
||||
if(tag_id != -1)
|
||||
sel->tags[tag_id] = True;
|
||||
|
||||
saveprops(sel, awesomeconf->ntags);
|
||||
arrange(awesomeconf);
|
||||
saveprops(sel, awesomeconf->screens[screen].ntags);
|
||||
arrange(awesomeconf, screen);
|
||||
}
|
||||
|
||||
/** Toggle floating state of a client
|
||||
|
@ -96,9 +97,10 @@ uicb_client_tag(awesome_config *awesomeconf,
|
|||
*/
|
||||
void
|
||||
uicb_client_togglefloating(awesome_config * awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
|
||||
Client *sel = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->client_sel;
|
||||
|
||||
if(!sel)
|
||||
return;
|
||||
|
@ -110,8 +112,8 @@ uicb_client_togglefloating(awesome_config * awesomeconf,
|
|||
else
|
||||
client_resize(sel, sel->x, sel->y, sel->w, sel->h, awesomeconf, True, True);
|
||||
|
||||
saveprops(sel, awesomeconf->ntags);
|
||||
arrange(awesomeconf);
|
||||
saveprops(sel, awesomeconf->screens[screen].ntags);
|
||||
arrange(awesomeconf, screen);
|
||||
}
|
||||
|
||||
/** Toggle a tag on client
|
||||
|
@ -120,9 +122,10 @@ uicb_client_togglefloating(awesome_config * awesomeconf,
|
|||
*/
|
||||
void
|
||||
uicb_client_toggletag(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
{
|
||||
Client *sel = get_current_tag(awesomeconf->tags, awesomeconf->ntags)->client_sel;
|
||||
Client *sel = get_current_tag(awesomeconf->screens[screen].tags, awesomeconf->screens[screen].ntags)->client_sel;
|
||||
int i, j;
|
||||
|
||||
if(!sel)
|
||||
|
@ -132,22 +135,22 @@ uicb_client_toggletag(awesome_config *awesomeconf,
|
|||
{
|
||||
i = atoi(arg) - 1;
|
||||
|
||||
if(i < 0 || i >= awesomeconf->ntags)
|
||||
if(i < 0 || i >= awesomeconf->screens[screen].ntags)
|
||||
return;
|
||||
|
||||
sel->tags[i] = !sel->tags[i];
|
||||
|
||||
/* check that there's at least one tag selected for this client*/
|
||||
for(j = 0; j < awesomeconf->ntags && !sel->tags[j]; j++);
|
||||
if(j == awesomeconf->ntags)
|
||||
for(j = 0; j < awesomeconf->screens[screen].ntags && !sel->tags[j]; j++);
|
||||
if(j == awesomeconf->screens[screen].ntags)
|
||||
sel->tags[i] = True;
|
||||
}
|
||||
else
|
||||
for(i = 0; i < awesomeconf->ntags; i++)
|
||||
for(i = 0; i < awesomeconf->screens[screen].ntags; i++)
|
||||
sel->tags[i] = True;
|
||||
|
||||
saveprops(sel, awesomeconf->ntags);
|
||||
arrange(awesomeconf);
|
||||
saveprops(sel, awesomeconf->screens[screen].ntags);
|
||||
arrange(awesomeconf, screen);
|
||||
}
|
||||
|
||||
/** Add a tag to viewed tags
|
||||
|
@ -156,24 +159,25 @@ uicb_client_toggletag(awesome_config *awesomeconf,
|
|||
*/
|
||||
void
|
||||
uicb_tag_toggleview(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
i = arg ? atoi(arg) - 1: 0;
|
||||
|
||||
if(i < 0 || i >= awesomeconf->ntags)
|
||||
if(i < 0 || i >= awesomeconf->screens[screen].ntags)
|
||||
return;
|
||||
|
||||
awesomeconf->tags[i].selected = !awesomeconf->tags[i].selected;
|
||||
awesomeconf->screens[screen].tags[i].selected = !awesomeconf->screens[screen].tags[i].selected;
|
||||
|
||||
/* check that there's at least one tag selected */
|
||||
for(j = 0; j < awesomeconf->ntags && !awesomeconf->tags[j].selected; j++);
|
||||
if(j == awesomeconf->ntags)
|
||||
awesomeconf->tags[i].selected = True;
|
||||
for(j = 0; j < awesomeconf->screens[screen].ntags && !awesomeconf->screens[screen].tags[j].selected; j++);
|
||||
if(j == awesomeconf->screens[screen].ntags)
|
||||
awesomeconf->screens[screen].tags[i].selected = True;
|
||||
|
||||
saveawesomeprops(awesomeconf);
|
||||
arrange(awesomeconf);
|
||||
saveawesomeprops(awesomeconf, screen);
|
||||
arrange(awesomeconf, screen);
|
||||
}
|
||||
|
||||
/** View tag
|
||||
|
@ -183,6 +187,7 @@ uicb_tag_toggleview(awesome_config *awesomeconf,
|
|||
*/
|
||||
void
|
||||
uicb_tag_view(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
{
|
||||
int i, tag_id = -1;
|
||||
|
@ -190,21 +195,21 @@ uicb_tag_view(awesome_config *awesomeconf,
|
|||
if(arg)
|
||||
{
|
||||
tag_id = atoi(arg) - 1;
|
||||
if(tag_id < 0 || tag_id >= awesomeconf->ntags)
|
||||
if(tag_id < 0 || tag_id >= awesomeconf->screens[screen].ntags)
|
||||
return;
|
||||
}
|
||||
|
||||
for(i = 0; i < awesomeconf->ntags; i++)
|
||||
for(i = 0; i < awesomeconf->screens[screen].ntags; i++)
|
||||
{
|
||||
awesomeconf->tags[i].was_selected = awesomeconf->tags[i].selected;
|
||||
awesomeconf->tags[i].selected = arg == NULL;
|
||||
awesomeconf->screens[screen].tags[i].was_selected = awesomeconf->screens[screen].tags[i].selected;
|
||||
awesomeconf->screens[screen].tags[i].selected = arg == NULL;
|
||||
}
|
||||
|
||||
if(tag_id != -1)
|
||||
awesomeconf->tags[tag_id].selected = True;
|
||||
awesomeconf->screens[screen].tags[tag_id].selected = True;
|
||||
|
||||
saveawesomeprops(awesomeconf);
|
||||
arrange(awesomeconf);
|
||||
saveawesomeprops(awesomeconf, screen);
|
||||
arrange(awesomeconf, screen);
|
||||
}
|
||||
|
||||
/** View previously selected tags
|
||||
|
@ -214,18 +219,19 @@ uicb_tag_view(awesome_config *awesomeconf,
|
|||
*/
|
||||
void
|
||||
uicb_tag_prev_selected(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
int i;
|
||||
Bool t;
|
||||
|
||||
for(i = 0; i < awesomeconf->ntags; i++)
|
||||
for(i = 0; i < awesomeconf->screens[screen].ntags; i++)
|
||||
{
|
||||
t = awesomeconf->tags[i].selected;
|
||||
awesomeconf->tags[i].selected = awesomeconf->tags[i].was_selected;
|
||||
awesomeconf->tags[i].was_selected = t;
|
||||
t = awesomeconf->screens[screen].tags[i].selected;
|
||||
awesomeconf->screens[screen].tags[i].selected = awesomeconf->screens[screen].tags[i].was_selected;
|
||||
awesomeconf->screens[screen].tags[i].was_selected = t;
|
||||
}
|
||||
arrange(awesomeconf);
|
||||
arrange(awesomeconf, screen);
|
||||
}
|
||||
|
||||
/** View next tag
|
||||
|
@ -234,22 +240,23 @@ uicb_tag_prev_selected(awesome_config *awesomeconf,
|
|||
*/
|
||||
void
|
||||
uicb_tag_viewnext(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
int i;
|
||||
int firsttag = -1;
|
||||
|
||||
for(i = 0; i < awesomeconf->ntags; i++)
|
||||
for(i = 0; i < awesomeconf->screens[screen].ntags; i++)
|
||||
{
|
||||
if(firsttag < 0 && awesomeconf->tags[i].selected)
|
||||
if(firsttag < 0 && awesomeconf->screens[screen].tags[i].selected)
|
||||
firsttag = i;
|
||||
awesomeconf->tags[i].selected = False;
|
||||
awesomeconf->screens[screen].tags[i].selected = False;
|
||||
}
|
||||
if(++firsttag >= awesomeconf->ntags)
|
||||
if(++firsttag >= awesomeconf->screens[screen].ntags)
|
||||
firsttag = 0;
|
||||
awesomeconf->tags[firsttag].selected = True;
|
||||
saveawesomeprops(awesomeconf);
|
||||
arrange(awesomeconf);
|
||||
awesomeconf->screens[screen].tags[firsttag].selected = True;
|
||||
saveawesomeprops(awesomeconf, screen);
|
||||
arrange(awesomeconf, screen);
|
||||
}
|
||||
|
||||
/** View previous tag
|
||||
|
@ -258,21 +265,22 @@ uicb_tag_viewnext(awesome_config *awesomeconf,
|
|||
*/
|
||||
void
|
||||
uicb_tag_viewprev(awesome_config *awesomeconf,
|
||||
int screen,
|
||||
const char *arg __attribute__ ((unused)))
|
||||
{
|
||||
int i;
|
||||
int firsttag = -1;
|
||||
|
||||
for(i = awesomeconf->ntags - 1; i >= 0; i--)
|
||||
for(i = awesomeconf->screens[screen].ntags - 1; i >= 0; i--)
|
||||
{
|
||||
if(firsttag < 0 && awesomeconf->tags[i].selected)
|
||||
if(firsttag < 0 && awesomeconf->screens[screen].tags[i].selected)
|
||||
firsttag = i;
|
||||
awesomeconf->tags[i].selected = False;
|
||||
awesomeconf->screens[screen].tags[i].selected = False;
|
||||
}
|
||||
if(--firsttag < 0)
|
||||
firsttag = awesomeconf->ntags - 1;
|
||||
awesomeconf->tags[firsttag].selected = True;
|
||||
saveawesomeprops(awesomeconf);
|
||||
arrange(awesomeconf);
|
||||
firsttag = awesomeconf->screens[screen].ntags - 1;
|
||||
awesomeconf->screens[screen].tags[firsttag].selected = True;
|
||||
saveawesomeprops(awesomeconf, screen);
|
||||
arrange(awesomeconf, screen);
|
||||
}
|
||||
// vim: filetype=c:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99
|
||||
|
|
2
tag.h
2
tag.h
|
@ -28,7 +28,7 @@
|
|||
#define IS_TILED(client, screen, tags, ntags) (client && !client->isfloating && isvisible(client, screen, tags, ntags))
|
||||
|
||||
Bool isvisible(Client *, int, Tag *, int);
|
||||
void tag_client_with_current_selected(Client *, awesome_config *);
|
||||
void tag_client_with_current_selected(Client *, awesome_config *, int);
|
||||
|
||||
UICB_PROTO(uicb_client_tag);
|
||||
UICB_PROTO(uicb_client_togglefloating);
|
||||
|
|
5
uicb.c
5
uicb.c
|
@ -70,7 +70,6 @@ const NameFuncLink UicbList[] = {
|
|||
/* statusbar.c */
|
||||
{"togglebar", uicb_togglebar},
|
||||
/* config.c */
|
||||
{"reloadconfig", uicb_reloadconfig},
|
||||
{"setstatustext", uicb_setstatustext},
|
||||
/* mouse.c */
|
||||
{"client_movemouse", uicb_client_movemouse},
|
||||
|
@ -102,7 +101,7 @@ run_uicb(char *cmd, awesome_config *awesomeconf)
|
|||
char *p, *uicb_name;
|
||||
const char *arg;
|
||||
int screen;
|
||||
void (*uicb) (awesome_config *, const char *);
|
||||
void (*uicb) (awesome_config *, int, const char *);
|
||||
|
||||
if(!a_strlen(cmd))
|
||||
return -1;
|
||||
|
@ -131,7 +130,7 @@ run_uicb(char *cmd, awesome_config *awesomeconf)
|
|||
uicb = name_func_lookup(uicb_name, UicbList);
|
||||
|
||||
if(uicb)
|
||||
uicb(&awesomeconf[screen], arg);
|
||||
uicb(awesomeconf, screen, arg);
|
||||
else
|
||||
return -1;
|
||||
|
||||
|
|
4
xutil.c
4
xutil.c
|
@ -7,6 +7,7 @@
|
|||
|
||||
void
|
||||
uicb_exec(awesome_config * awesomeconf,
|
||||
int screen __attribute__ ((unused)),
|
||||
const char *arg)
|
||||
{
|
||||
char path[PATH_MAX];
|
||||
|
@ -19,6 +20,7 @@ uicb_exec(awesome_config * awesomeconf,
|
|||
|
||||
void
|
||||
uicb_spawn(awesome_config * awesomeconf,
|
||||
int screen,
|
||||
const char *arg)
|
||||
{
|
||||
static char *shell = NULL;
|
||||
|
@ -35,7 +37,7 @@ uicb_spawn(awesome_config * awesomeconf,
|
|||
display = a_strdup(tmp);
|
||||
if((tmp = strrchr(display, '.')))
|
||||
*tmp = '\0';
|
||||
snprintf(newdisplay, sizeof(newdisplay), "%s.%d", display, awesomeconf->screen);
|
||||
snprintf(newdisplay, sizeof(newdisplay), "%s.%d", display, screen);
|
||||
setenv("DISPLAY", newdisplay, 1);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue