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