enhance multihead support, with N conf/dc
This commit is contained in:
parent
d900fc1773
commit
1ca3c565ee
143
awesome.c
143
awesome.c
|
@ -43,7 +43,7 @@
|
||||||
Client *clients = NULL;
|
Client *clients = NULL;
|
||||||
Client *sel = NULL;
|
Client *sel = NULL;
|
||||||
Client *stack = NULL;
|
Client *stack = NULL;
|
||||||
DC dc;
|
DC *dc;
|
||||||
|
|
||||||
/* static */
|
/* static */
|
||||||
|
|
||||||
|
@ -63,20 +63,22 @@ cleanup(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
|
||||||
unmanage(stack, drawcontext, NormalState, awesomeconf);
|
unmanage(stack, drawcontext, NormalState, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(drawcontext->font.set)
|
for(screen = 0; screen < ScreenCount(disp); screen++)
|
||||||
XFreeFontSet(disp, drawcontext->font.set);
|
{
|
||||||
else
|
if(drawcontext[screen].font.set)
|
||||||
XFreeFont(disp, drawcontext->font.xfont);
|
XFreeFontSet(disp, drawcontext[screen].font.set);
|
||||||
|
else
|
||||||
|
XFreeFont(disp, drawcontext[screen].font.xfont);
|
||||||
|
|
||||||
for(screen = 0; screen < ScreenCount(disp); screen++);
|
XUngrabKey(disp, AnyKey, AnyModifier, RootWindow(disp, screen));
|
||||||
XUngrabKey(disp, AnyKey, AnyModifier, RootWindow(disp, screen));
|
|
||||||
|
|
||||||
XFreePixmap(disp, awesomeconf->statusbar.drawable);
|
XFreePixmap(disp, awesomeconf[screen].statusbar.drawable);
|
||||||
XFreeGC(disp, drawcontext->gc);
|
XFreeGC(disp, drawcontext[screen].gc);
|
||||||
XDestroyWindow(disp, awesomeconf->statusbar.window);
|
XDestroyWindow(disp, awesomeconf[screen].statusbar.window);
|
||||||
XFreeCursor(disp, drawcontext->cursor[CurNormal]);
|
XFreeCursor(disp, drawcontext[screen].cursor[CurNormal]);
|
||||||
XFreeCursor(disp, drawcontext->cursor[CurResize]);
|
XFreeCursor(disp, drawcontext[screen].cursor[CurResize]);
|
||||||
XFreeCursor(disp, drawcontext->cursor[CurMove]);
|
XFreeCursor(disp, drawcontext[screen].cursor[CurMove]);
|
||||||
|
}
|
||||||
XSetInputFocus(disp, PointerRoot, RevertToPointerRoot, CurrentTime);
|
XSetInputFocus(disp, PointerRoot, RevertToPointerRoot, CurrentTime);
|
||||||
XSync(disp, False);
|
XSync(disp, False);
|
||||||
}
|
}
|
||||||
|
@ -101,36 +103,32 @@ getstate(Display *disp, Window w)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
scan(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
|
scan(Display *disp, int screen, DC *drawcontext, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
unsigned int i, num;
|
unsigned int i, num;
|
||||||
int screen;
|
|
||||||
Window *wins, d1, d2;
|
Window *wins, d1, d2;
|
||||||
XWindowAttributes wa;
|
XWindowAttributes wa;
|
||||||
|
|
||||||
wins = NULL;
|
wins = NULL;
|
||||||
for(screen = 0; screen < ScreenCount(disp); screen++)
|
if(XQueryTree(disp, RootWindow(disp, screen), &d1, &d2, &wins, &num))
|
||||||
{
|
{
|
||||||
if(XQueryTree(disp, RootWindow(disp, screen), &d1, &d2, &wins, &num))
|
for(i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
for(i = 0; i < num; i++)
|
if(!XGetWindowAttributes(disp, wins[i], &wa)
|
||||||
{
|
|| wa.override_redirect
|
||||||
if(!XGetWindowAttributes(disp, wins[i], &wa)
|
|| XGetTransientForHint(disp, wins[i], &d1))
|
||||||
|| wa.override_redirect
|
continue;
|
||||||
|| XGetTransientForHint(disp, wins[i], &d1))
|
|
||||||
continue;
|
|
||||||
if(wa.map_state == IsViewable || getstate(disp, wins[i]) == IconicState)
|
if(wa.map_state == IsViewable || getstate(disp, wins[i]) == IconicState)
|
||||||
manage(disp, screen, drawcontext, wins[i], &wa, awesomeconf);
|
manage(disp, screen, drawcontext, wins[i], &wa, awesomeconf);
|
||||||
}
|
}
|
||||||
/* now the transients */
|
/* now the transients */
|
||||||
for(i = 0; i < num; i++)
|
for(i = 0; i < num; i++)
|
||||||
{
|
{
|
||||||
if(!XGetWindowAttributes(disp, wins[i], &wa))
|
if(!XGetWindowAttributes(disp, wins[i], &wa))
|
||||||
continue;
|
continue;
|
||||||
if(XGetTransientForHint(disp, wins[i], &d1)
|
if(XGetTransientForHint(disp, wins[i], &d1)
|
||||||
&& (wa.map_state == IsViewable || getstate(disp, wins[i]) == IconicState))
|
&& (wa.map_state == IsViewable || getstate(disp, wins[i]) == IconicState))
|
||||||
manage(disp, screen, drawcontext, wins[i], &wa, awesomeconf);
|
manage(disp, screen, drawcontext, wins[i], &wa, awesomeconf);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(wins)
|
if(wins)
|
||||||
|
@ -143,20 +141,15 @@ enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
|
||||||
Atom netatom[NetWMName];
|
Atom netatom[NetWMName];
|
||||||
/** Setup everything before running
|
/** Setup everything before running
|
||||||
* \param disp Display ref
|
* \param disp Display ref
|
||||||
|
* \param screen Screen number
|
||||||
* \param awesomeconf awesome config ref
|
* \param awesomeconf awesome config ref
|
||||||
* \todo clean things...
|
* \todo clean things...
|
||||||
*/
|
*/
|
||||||
static void
|
static void
|
||||||
setup(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
|
setup(Display *disp, int screen, DC *drawcontext, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
XSetWindowAttributes wa;
|
XSetWindowAttributes wa;
|
||||||
int screen;
|
|
||||||
|
|
||||||
netatom[NetSupported] = XInternAtom(disp, "_NET_SUPPORTED", False);
|
|
||||||
netatom[NetWMName] = XInternAtom(disp, "_NET_WM_NAME", False);
|
|
||||||
for(screen = 0; screen < ScreenCount(disp); screen++)
|
|
||||||
XChangeProperty(disp, RootWindow(disp, screen), netatom[NetSupported],
|
|
||||||
XA_ATOM, 32, PropModeReplace, (unsigned char *) netatom, NetLast);
|
|
||||||
/* init cursors */
|
/* init cursors */
|
||||||
drawcontext->cursor[CurNormal] = XCreateFontCursor(disp, XC_left_ptr);
|
drawcontext->cursor[CurNormal] = XCreateFontCursor(disp, XC_left_ptr);
|
||||||
drawcontext->cursor[CurResize] = XCreateFontCursor(disp, XC_sizing);
|
drawcontext->cursor[CurResize] = XCreateFontCursor(disp, XC_sizing);
|
||||||
|
@ -165,22 +158,22 @@ setup(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
|
||||||
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
|
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
|
||||||
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
|
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
|
||||||
wa.cursor = drawcontext->cursor[CurNormal];
|
wa.cursor = drawcontext->cursor[CurNormal];
|
||||||
for(screen = 0; screen < ScreenCount(disp); screen++)
|
XChangeWindowAttributes(disp, RootWindow(disp, screen), CWEventMask | CWCursor, &wa);
|
||||||
{
|
XSelectInput(disp, RootWindow(disp, screen), wa.event_mask);
|
||||||
XChangeWindowAttributes(disp, RootWindow(disp, screen), CWEventMask | CWCursor, &wa);
|
grabkeys(disp, screen, awesomeconf);
|
||||||
XSelectInput(disp, RootWindow(disp, screen), wa.event_mask);
|
|
||||||
grabkeys(disp, screen, awesomeconf);
|
|
||||||
}
|
|
||||||
compileregs(awesomeconf->rules, awesomeconf->nrules);
|
compileregs(awesomeconf->rules, awesomeconf->nrules);
|
||||||
/* bar */
|
/* bar */
|
||||||
drawcontext->h = awesomeconf->statusbar.height = drawcontext->font.height + 2;
|
drawcontext->h = awesomeconf->statusbar.height = drawcontext->font.height + 2;
|
||||||
initstatusbar(disp, DefaultScreen(disp), drawcontext, &awesomeconf->statusbar);
|
initstatusbar(disp, screen, drawcontext, &awesomeconf->statusbar);
|
||||||
drawcontext->gc = XCreateGC(disp, DefaultRootWindow(disp), 0, 0);
|
drawcontext->gc = XCreateGC(disp, RootWindow(disp, screen), 0, 0);
|
||||||
XSetLineAttributes(disp, drawcontext->gc, 1, LineSolid, CapButt, JoinMiter);
|
XSetLineAttributes(disp, drawcontext->gc, 1, LineSolid, CapButt, JoinMiter);
|
||||||
if(!drawcontext->font.set)
|
if(!drawcontext->font.set)
|
||||||
XSetFont(disp, drawcontext->gc, drawcontext->font.xfont->fid);
|
XSetFont(disp, drawcontext->gc, drawcontext->font.xfont->fid);
|
||||||
for(screen = 0; screen < ScreenCount(disp); screen++)
|
// netatom[NetSupported] = XInternAtom(disp, "_NET_SUPPORTED", False);
|
||||||
loadawesomeprops(disp, screen, awesomeconf);
|
// netatom[NetWMName] = XInternAtom(disp, "_NET_WM_NAME", False);
|
||||||
|
// XChangeProperty(disp, RootWindow(disp, screen), netatom[NetSupported],
|
||||||
|
// XA_ATOM, 32, PropModeReplace, (unsigned char *) netatom, NetLast);
|
||||||
|
loadawesomeprops(disp, screen, awesomeconf);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -268,7 +261,7 @@ main(int argc, char *argv[])
|
||||||
fd_set rd;
|
fd_set rd;
|
||||||
XEvent ev;
|
XEvent ev;
|
||||||
Display * dpy;
|
Display * dpy;
|
||||||
awesome_config awesomeconf;
|
awesome_config *awesomeconf;
|
||||||
int shape_event, randr_event_base;
|
int shape_event, randr_event_base;
|
||||||
int screen;
|
int screen;
|
||||||
|
|
||||||
|
@ -288,13 +281,20 @@ main(int argc, char *argv[])
|
||||||
for(screen = 0; screen < ScreenCount(dpy); screen++)
|
for(screen = 0; screen < ScreenCount(dpy); screen++)
|
||||||
XSelectInput(dpy, RootWindow(dpy, screen), SubstructureRedirectMask);
|
XSelectInput(dpy, RootWindow(dpy, screen), SubstructureRedirectMask);
|
||||||
|
|
||||||
|
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
XSetErrorHandler(NULL);
|
XSetErrorHandler(NULL);
|
||||||
xerrorxlib = XSetErrorHandler(xerror);
|
xerrorxlib = XSetErrorHandler(xerror);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
parse_config(dpy, DefaultScreen(dpy), &dc, &awesomeconf);
|
|
||||||
setup(dpy, &dc, &awesomeconf);
|
awesomeconf = p_new(awesome_config, ScreenCount(dpy));
|
||||||
drawstatusbar(dpy, DefaultScreen(dpy), &dc, &awesomeconf);
|
dc = p_new(DC, ScreenCount(dpy));
|
||||||
|
for(screen = 0; screen < ScreenCount(dpy); screen++)
|
||||||
|
{
|
||||||
|
parse_config(dpy, screen, &dc[screen], &awesomeconf[screen]);
|
||||||
|
setup(dpy, screen, &dc[screen], &awesomeconf[screen]);
|
||||||
|
drawstatusbar(dpy, screen, &dc[screen], &awesomeconf[screen]);
|
||||||
|
}
|
||||||
|
|
||||||
void (*handler[LASTEvent]) (XEvent *, awesome_config *) =
|
void (*handler[LASTEvent]) (XEvent *, awesome_config *) =
|
||||||
{
|
{
|
||||||
|
@ -312,15 +312,16 @@ main(int argc, char *argv[])
|
||||||
[UnmapNotify] = handle_event_unmapnotify,
|
[UnmapNotify] = handle_event_unmapnotify,
|
||||||
};
|
};
|
||||||
|
|
||||||
/* check for shape extension */
|
/* XXX check for shape extension */
|
||||||
if((awesomeconf.have_shape = XShapeQueryExtension(dpy, &shape_event, &e_dummy)))
|
if((awesomeconf[0].have_shape = XShapeQueryExtension(dpy, &shape_event, &e_dummy)))
|
||||||
handler[shape_event] = handle_event_shape;
|
handler[shape_event] = handle_event_shape;
|
||||||
|
|
||||||
/* check for randr extension */
|
/* XXX check for randr extension */
|
||||||
if((awesomeconf.have_randr = XRRQueryExtension(dpy, &randr_event_base, &e_dummy)))
|
if((awesomeconf[0].have_randr = XRRQueryExtension(dpy, &randr_event_base, &e_dummy)))
|
||||||
handler[randr_event_base + RRScreenChangeNotify] = handle_event_randr_screen_change_notify;
|
handler[randr_event_base + RRScreenChangeNotify] = handle_event_randr_screen_change_notify;
|
||||||
|
|
||||||
scan(dpy, &dc, &awesomeconf);
|
for(screen = 0; screen < ScreenCount(dpy); screen++)
|
||||||
|
scan(dpy, screen, &dc[screen], &awesomeconf[screen]);
|
||||||
XSync(dpy, False);
|
XSync(dpy, False);
|
||||||
|
|
||||||
/* main event loop, also reads status text from stdin */
|
/* main event loop, also reads status text from stdin */
|
||||||
|
@ -338,35 +339,35 @@ main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
if(FD_ISSET(STDIN_FILENO, &rd))
|
if(FD_ISSET(STDIN_FILENO, &rd))
|
||||||
{
|
{
|
||||||
switch (r = read(STDIN_FILENO, awesomeconf.statustext, sizeof(awesomeconf.statustext) - 1))
|
switch (r = read(STDIN_FILENO, awesomeconf[0].statustext, sizeof(awesomeconf[0].statustext) - 1))
|
||||||
{
|
{
|
||||||
case -1:
|
case -1:
|
||||||
strncpy(awesomeconf.statustext, strerror(errno), sizeof(awesomeconf.statustext) - 1);
|
strncpy(awesomeconf[0].statustext, strerror(errno), sizeof(awesomeconf[0].statustext) - 1);
|
||||||
awesomeconf.statustext[sizeof(awesomeconf.statustext) - 1] = '\0';
|
awesomeconf[0].statustext[sizeof(awesomeconf[0].statustext) - 1] = '\0';
|
||||||
readin = False;
|
readin = False;
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
strncpy(awesomeconf.statustext, "EOF", 4);
|
strncpy(awesomeconf[0].statustext, "EOF", 4);
|
||||||
readin = False;
|
readin = False;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
for(awesomeconf.statustext[r] = '\0', p = awesomeconf.statustext + a_strlen(awesomeconf.statustext) - 1;
|
for(awesomeconf[0].statustext[r] = '\0', p = awesomeconf[0].statustext + a_strlen(awesomeconf[0].statustext) - 1;
|
||||||
p >= awesomeconf.statustext && *p == '\n'; *p-- = '\0');
|
p >= awesomeconf[0].statustext && *p == '\n'; *p-- = '\0');
|
||||||
for(; p >= awesomeconf.statustext && *p != '\n'; --p);
|
for(; p >= awesomeconf[0].statustext && *p != '\n'; --p);
|
||||||
if(p > awesomeconf.statustext)
|
if(p > awesomeconf[0].statustext)
|
||||||
strncpy(awesomeconf.statustext, p + 1, sizeof(awesomeconf.statustext));
|
strncpy(awesomeconf[0].statustext, p + 1, sizeof(awesomeconf[0].statustext));
|
||||||
}
|
}
|
||||||
drawstatusbar(dpy, DefaultScreen(dpy), &dc, &awesomeconf);
|
drawstatusbar(dpy, 0, &dc[0], &awesomeconf[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
while(XPending(dpy))
|
while(XPending(dpy))
|
||||||
{
|
{
|
||||||
XNextEvent(dpy, &ev);
|
XNextEvent(dpy, &ev);
|
||||||
if(handler[ev.type])
|
if(handler[ev.type])
|
||||||
(handler[ev.type]) (&ev, &awesomeconf); /* call handler */
|
(handler[ev.type]) (&ev, awesomeconf); /* call handler */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cleanup(dpy, &dc, &awesomeconf);
|
cleanup(dpy, dc, awesomeconf);
|
||||||
XCloseDisplay(dpy);
|
XCloseDisplay(dpy);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
135
event.c
135
event.c
|
@ -36,11 +36,11 @@
|
||||||
#include "layouts/floating.h"
|
#include "layouts/floating.h"
|
||||||
|
|
||||||
/* extern */
|
/* extern */
|
||||||
extern DC dc; /* global draw context */
|
extern DC *dc; /* global draw context */
|
||||||
extern Client *clients, *sel; /* global client list */
|
extern Client *clients, *sel; /* global client list */
|
||||||
|
|
||||||
#define CLEANMASK(mask) (mask & ~(awesomeconf->numlockmask | LockMask))
|
#define CLEANMASK(mask, screen) (mask & ~(awesomeconf[screen].numlockmask | LockMask))
|
||||||
#define MOUSEMASK (BUTTONMASK | PointerMotionMask)
|
#define MOUSEMASK (BUTTONMASK | PointerMotionMask)
|
||||||
|
|
||||||
static Client *
|
static Client *
|
||||||
getclient(Window w)
|
getclient(Window w)
|
||||||
|
@ -65,7 +65,7 @@ movemouse(Client * c, awesome_config *awesomeconf)
|
||||||
ocx = nx = c->x;
|
ocx = nx = c->x;
|
||||||
ocy = ny = c->y;
|
ocy = ny = c->y;
|
||||||
if(XGrabPointer(c->display, RootWindow(c->display, c->screen), False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
if(XGrabPointer(c->display, RootWindow(c->display, c->screen), False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
||||||
None, dc.cursor[CurMove], CurrentTime) != GrabSuccess)
|
None, dc[c->screen].cursor[CurMove], CurrentTime) != GrabSuccess)
|
||||||
return;
|
return;
|
||||||
XQueryPointer(c->display, RootWindow(c->display, c->screen), &dummy, &dummy, &x1, &y1, &di, &di, &dui);
|
XQueryPointer(c->display, RootWindow(c->display, c->screen), &dummy, &dummy, &x1, &y1, &di, &di, &dui);
|
||||||
for(;;)
|
for(;;)
|
||||||
|
@ -110,7 +110,7 @@ resizemouse(Client * c, awesome_config *awesomeconf)
|
||||||
ocx = c->x;
|
ocx = c->x;
|
||||||
ocy = c->y;
|
ocy = c->y;
|
||||||
if(XGrabPointer(c->display, RootWindow(c->display, c->screen), False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
if(XGrabPointer(c->display, RootWindow(c->display, c->screen), False, MOUSEMASK, GrabModeAsync, GrabModeAsync,
|
||||||
None, dc.cursor[CurResize], CurrentTime) != GrabSuccess)
|
None, dc[c->screen].cursor[CurResize], CurrentTime) != GrabSuccess)
|
||||||
return;
|
return;
|
||||||
c->ismax = False;
|
c->ismax = False;
|
||||||
XWarpPointer(c->display, None, c->win, 0, 0, 0, 0, c->w + c->border - 1, c->h + c->border - 1);
|
XWarpPointer(c->display, None, c->win, 0, 0, 0, 0, c->w + c->border - 1, c->h + c->border - 1);
|
||||||
|
@ -144,64 +144,69 @@ resizemouse(Client * c, awesome_config *awesomeconf)
|
||||||
void
|
void
|
||||||
handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
|
handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
int i;
|
int i, screen;
|
||||||
Client *c;
|
Client *c;
|
||||||
XButtonPressedEvent *ev = &e->xbutton;
|
XButtonPressedEvent *ev = &e->xbutton;
|
||||||
|
|
||||||
if(awesomeconf->statusbar.window == ev->window)
|
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||||
{
|
{
|
||||||
int x = 0;
|
if(awesomeconf[screen].statusbar.window == ev->window)
|
||||||
for(i = 0; i < awesomeconf->ntags; i++)
|
|
||||||
{
|
{
|
||||||
x += textw(dc.font.set, dc.font.xfont, awesomeconf->tags[i], dc.font.height);
|
int x = 0;
|
||||||
if(ev->x < x)
|
for(i = 0; i < awesomeconf[screen].ntags; i++)
|
||||||
{
|
{
|
||||||
if(ev->button == Button1)
|
x += textw(dc[screen].font.set, dc[screen].font.xfont, awesomeconf[screen].tags[i], dc[screen].font.height);
|
||||||
|
if(ev->x < x)
|
||||||
{
|
{
|
||||||
if(ev->state & awesomeconf->modkey)
|
if(ev->button == Button1)
|
||||||
uicb_tag(e->xany.display, awesomeconf->statusbar.screen, &dc, awesomeconf, awesomeconf->tags[i]);
|
{
|
||||||
else
|
if(ev->state & awesomeconf[screen].modkey)
|
||||||
uicb_view(e->xany.display, awesomeconf->statusbar.screen, &dc, awesomeconf, awesomeconf->tags[i]);
|
uicb_tag(e->xany.display, screen, &dc[screen], &awesomeconf[screen], awesomeconf[screen].tags[i]);
|
||||||
|
else
|
||||||
|
uicb_view(e->xany.display, screen, &dc[screen], &awesomeconf[screen], awesomeconf[screen].tags[i]);
|
||||||
|
}
|
||||||
|
else if(ev->button == Button3)
|
||||||
|
{
|
||||||
|
if(ev->state & awesomeconf[screen].modkey)
|
||||||
|
uicb_toggletag(e->xany.display, screen, &dc[screen], &awesomeconf[screen], awesomeconf[screen].tags[i]);
|
||||||
|
else
|
||||||
|
uicb_toggleview(e->xany.display, screen, &dc[screen], &awesomeconf[screen], awesomeconf[screen].tags[i]);
|
||||||
|
}
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if(ev->button == Button3)
|
|
||||||
{
|
|
||||||
if(ev->state & awesomeconf->modkey)
|
|
||||||
uicb_toggletag(e->xany.display, awesomeconf->statusbar.screen, &dc, awesomeconf, awesomeconf->tags[i]);
|
|
||||||
else
|
|
||||||
uicb_toggleview(e->xany.display, awesomeconf->statusbar.screen, &dc, awesomeconf, awesomeconf->tags[i]);
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
if((ev->x < x + awesomeconf[screen].statusbar.width) && ev->button == Button1)
|
||||||
|
uicb_setlayout(e->xany.display, screen, &dc[screen], &awesomeconf[screen], NULL);
|
||||||
}
|
}
|
||||||
if((ev->x < x + awesomeconf->statusbar.width) && ev->button == Button1)
|
return;
|
||||||
uicb_setlayout(e->xany.display, awesomeconf->statusbar.screen, &dc, awesomeconf, NULL);
|
|
||||||
}
|
}
|
||||||
else if((c = getclient(ev->window)))
|
|
||||||
|
if((c = getclient(ev->window)))
|
||||||
{
|
{
|
||||||
focus(c->display, c->screen, &dc, c, ev->same_screen, awesomeconf);
|
focus(c->display, c->screen, &dc[c->screen], c, ev->same_screen, &awesomeconf[screen]);
|
||||||
if(CLEANMASK(ev->state) != awesomeconf->modkey)
|
if(CLEANMASK(ev->state, c->screen) != awesomeconf[c->screen].modkey)
|
||||||
return;
|
return;
|
||||||
if(ev->button == Button1 && (IS_ARRANGE(floating) || c->isfloating))
|
if(ev->button == Button1 && (IS_ARRANGE(floating) || c->isfloating))
|
||||||
{
|
{
|
||||||
restack(e->xany.display, c->screen, &dc, awesomeconf);
|
restack(e->xany.display, c->screen, &dc[c->screen], &awesomeconf[c->screen]);
|
||||||
movemouse(c, awesomeconf);
|
movemouse(c, awesomeconf);
|
||||||
}
|
}
|
||||||
else if(ev->button == Button2)
|
else if(ev->button == Button2)
|
||||||
uicb_zoom(e->xany.display, c->screen, &dc, awesomeconf, NULL);
|
uicb_zoom(e->xany.display, c->screen, &dc[c->screen], &awesomeconf[c->screen], NULL);
|
||||||
else if(ev->button == Button3 && (IS_ARRANGE(floating) || c->isfloating) && !c->isfixed)
|
else if(ev->button == Button3 && (IS_ARRANGE(floating) || c->isfloating) && !c->isfixed)
|
||||||
{
|
{
|
||||||
restack(e->xany.display, c->screen, &dc, awesomeconf);
|
restack(e->xany.display, c->screen, &dc[c->screen], &awesomeconf[c->screen]);
|
||||||
resizemouse(c, awesomeconf);
|
resizemouse(c, awesomeconf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if(!sel)
|
else if(!sel)
|
||||||
for(i = 0; i < ScreenCount(e->xany.display); i++)
|
for(screen = 0; screen < ScreenCount(e->xany.display); i++)
|
||||||
if(RootWindow(e->xany.display, i) == ev->window)
|
if(RootWindow(e->xany.display, screen) == ev->window)
|
||||||
{
|
{
|
||||||
if(ev->button == Button4)
|
if(ev->button == Button4)
|
||||||
uicb_tag_viewnext(e->xany.display, i, &dc, awesomeconf, NULL);
|
uicb_tag_viewnext(e->xany.display, screen, &dc[screen], &awesomeconf[screen], NULL);
|
||||||
else if(ev->button == Button5)
|
else if(ev->button == Button5)
|
||||||
uicb_tag_viewprev(e->xany.display, i, &dc, awesomeconf, NULL);
|
uicb_tag_viewprev(e->xany.display, screen, &dc[screen], &awesomeconf[screen], NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -233,7 +238,7 @@ handle_event_configurerequest(XEvent * e, awesome_config *awesomeconf __attribut
|
||||||
c->y = DisplayHeight(c->display, c->screen) / 2 - c->h / 2; /* center in y direction */
|
c->y = DisplayHeight(c->display, c->screen) / 2 - c->h / 2; /* center in y direction */
|
||||||
if((ev->value_mask & (CWX | CWY)) && !(ev->value_mask & (CWWidth | CWHeight)))
|
if((ev->value_mask & (CWX | CWY)) && !(ev->value_mask & (CWWidth | CWHeight)))
|
||||||
configure(c);
|
configure(c);
|
||||||
if(isvisible(c, awesomeconf->selected_tags, awesomeconf->ntags))
|
if(isvisible(c, awesomeconf[c->screen].selected_tags, awesomeconf[c->screen].ntags))
|
||||||
XMoveResizeWindow(e->xany.display, c->win, c->x, c->y, c->w, c->h);
|
XMoveResizeWindow(e->xany.display, c->win, c->x, c->y, c->w, c->h);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -266,15 +271,15 @@ handle_event_configurenotify(XEvent * e, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
DisplayWidth(e->xany.display, screen) = ev->width;
|
DisplayWidth(e->xany.display, screen) = ev->width;
|
||||||
DisplayHeight(e->xany.display, screen) = ev->height;
|
DisplayHeight(e->xany.display, screen) = ev->height;
|
||||||
XFreePixmap(e->xany.display, awesomeconf->statusbar.drawable);
|
XFreePixmap(e->xany.display, awesomeconf[screen].statusbar.drawable);
|
||||||
awesomeconf->statusbar.drawable = XCreatePixmap(e->xany.display, RootWindow(e->xany.display, screen),
|
awesomeconf[screen].statusbar.drawable = XCreatePixmap(e->xany.display, RootWindow(e->xany.display, screen),
|
||||||
DisplayWidth(e->xany.display, screen),
|
DisplayWidth(e->xany.display, screen),
|
||||||
awesomeconf->statusbar.height,
|
awesomeconf[screen].statusbar.height,
|
||||||
DefaultDepth(e->xany.display, screen));
|
DefaultDepth(e->xany.display, screen));
|
||||||
XResizeWindow(e->xany.display, awesomeconf->statusbar.window,
|
XResizeWindow(e->xany.display, awesomeconf[screen].statusbar.window,
|
||||||
DisplayWidth(e->xany.display, screen), awesomeconf->statusbar.height);
|
DisplayWidth(e->xany.display, screen), awesomeconf[screen].statusbar.height);
|
||||||
updatebarpos(e->xany.display, awesomeconf->statusbar);
|
updatebarpos(e->xany.display, awesomeconf[screen].statusbar);
|
||||||
arrange(e->xany.display, screen, &dc, awesomeconf);
|
arrange(e->xany.display, screen, &dc[screen], &awesomeconf[screen]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,7 +290,7 @@ handle_event_destroynotify(XEvent * e, awesome_config *awesomeconf)
|
||||||
XDestroyWindowEvent *ev = &e->xdestroywindow;
|
XDestroyWindowEvent *ev = &e->xdestroywindow;
|
||||||
|
|
||||||
if((c = getclient(ev->window)))
|
if((c = getclient(ev->window)))
|
||||||
unmanage(c, &dc, WithdrawnState, awesomeconf);
|
unmanage(c, &dc[c->screen], WithdrawnState, &awesomeconf[c->screen]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -298,20 +303,23 @@ 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 = getclient(ev->window)))
|
if((c = getclient(ev->window)))
|
||||||
focus(c->display, c->screen, &dc, c, ev->same_screen, awesomeconf);
|
focus(c->display, c->screen, &dc[c->screen], c, ev->same_screen, &awesomeconf[c->screen]);
|
||||||
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(e->xany.display, screen, &dc, NULL, True, awesomeconf);
|
focus(e->xany.display, screen, &dc[screen], NULL, True, &awesomeconf[screen]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
handle_event_expose(XEvent * e, awesome_config *awesomeconf)
|
handle_event_expose(XEvent * e, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
XExposeEvent *ev = &e->xexpose;
|
XExposeEvent *ev = &e->xexpose;
|
||||||
|
int screen;
|
||||||
|
|
||||||
if(!ev->count && awesomeconf->statusbar.window == ev->window)
|
if(!ev->count)
|
||||||
drawstatusbar(e->xany.display, awesomeconf->statusbar.screen, &dc, awesomeconf);
|
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||||
|
if(awesomeconf[screen].statusbar.window == ev->window)
|
||||||
|
drawstatusbar(e->xany.display, screen, &dc[screen], &awesomeconf[screen]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -324,12 +332,13 @@ handle_event_keypress(XEvent * e, awesome_config *awesomeconf)
|
||||||
Window dummy;
|
Window dummy;
|
||||||
|
|
||||||
keysym = XKeycodeToKeysym(e->xany.display, (KeyCode) ev->keycode, 0);
|
keysym = XKeycodeToKeysym(e->xany.display, (KeyCode) ev->keycode, 0);
|
||||||
for(i = 0; i < awesomeconf->nkeys; i++)
|
|
||||||
if(keysym == awesomeconf->keys[i].keysym
|
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||||
&& CLEANMASK(awesomeconf->keys[i].mod) == CLEANMASK(ev->state) && awesomeconf->keys[i].func)
|
if(XQueryPointer(e->xany.display, RootWindow(e->xany.display, screen), &dummy, &dummy, &y, &x, &d, &d, &m))
|
||||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
for(i = 0; i < awesomeconf[screen].nkeys; i++)
|
||||||
if(XQueryPointer(e->xany.display, RootWindow(e->xany.display, screen), &dummy, &dummy, &y, &x, &d, &d, &m))
|
if(keysym == awesomeconf[screen].keys[i].keysym
|
||||||
awesomeconf->keys[i].func(e->xany.display, screen, &dc, awesomeconf, awesomeconf->keys[i].arg);
|
&& CLEANMASK(awesomeconf[screen].keys[i].mod, screen) == CLEANMASK(ev->state, screen) && awesomeconf[screen].keys[i].func)
|
||||||
|
awesomeconf[screen].keys[i].func(e->xany.display, screen, &dc[screen], &awesomeconf[screen], awesomeconf[screen].keys[i].arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -340,7 +349,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(e->xany.display, screen, &dc, NULL, ev->same_screen, awesomeconf);
|
focus(e->xany.display, screen, &dc[screen], NULL, ev->same_screen, &awesomeconf[screen]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -350,7 +359,7 @@ handle_event_mappingnotify(XEvent * e, awesome_config *awesomeconf)
|
||||||
|
|
||||||
XRefreshKeyboardMapping(ev);
|
XRefreshKeyboardMapping(ev);
|
||||||
if(ev->request == MappingKeyboard)
|
if(ev->request == MappingKeyboard)
|
||||||
grabkeys(e->xany.display, DefaultScreen(e->xany.display), awesomeconf);
|
grabkeys(e->xany.display, DefaultScreen(e->xany.display), &awesomeconf[DefaultScreen(e->xany.display)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -367,7 +376,7 @@ handle_event_maprequest(XEvent * e, awesome_config *awesomeconf)
|
||||||
if(!getclient(ev->window))
|
if(!getclient(ev->window))
|
||||||
{
|
{
|
||||||
for(screen = 0; wa.screen != ScreenOfDisplay(e->xany.display, screen); screen++);
|
for(screen = 0; wa.screen != ScreenOfDisplay(e->xany.display, screen); screen++);
|
||||||
manage(e->xany.display, screen, &dc, ev->window, &wa, awesomeconf);
|
manage(e->xany.display, screen, &dc[screen], ev->window, &wa, &awesomeconf[screen]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,7 +396,7 @@ handle_event_propertynotify(XEvent * e, awesome_config *awesomeconf)
|
||||||
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 = (getclient(trans) != NULL)))
|
if(!c->isfloating && (c->isfloating = (getclient(trans) != NULL)))
|
||||||
arrange(e->xany.display, c->screen, &dc, awesomeconf);
|
arrange(e->xany.display, c->screen, &dc[c->screen], &awesomeconf[c->screen]);
|
||||||
break;
|
break;
|
||||||
case XA_WM_NORMAL_HINTS:
|
case XA_WM_NORMAL_HINTS:
|
||||||
updatesizehints(c);
|
updatesizehints(c);
|
||||||
|
@ -397,7 +406,7 @@ handle_event_propertynotify(XEvent * e, awesome_config *awesomeconf)
|
||||||
{
|
{
|
||||||
updatetitle(c);
|
updatetitle(c);
|
||||||
if(c == sel)
|
if(c == sel)
|
||||||
drawstatusbar(e->xany.display, c->screen, &dc, awesomeconf);
|
drawstatusbar(e->xany.display, c->screen, &dc[c->screen], &awesomeconf[c->screen]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -410,7 +419,7 @@ handle_event_unmapnotify(XEvent * e, awesome_config *awesomeconf)
|
||||||
|
|
||||||
if((c = getclient(ev->window))
|
if((c = getclient(ev->window))
|
||||||
&& ev->event == RootWindow(e->xany.display, c->screen) && (ev->send_event || !c->unmapped--))
|
&& ev->event == RootWindow(e->xany.display, c->screen) && (ev->send_event || !c->unmapped--))
|
||||||
unmanage(c, &dc, WithdrawnState, awesomeconf);
|
unmanage(c, &dc[c->screen], WithdrawnState, &awesomeconf[c->screen]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue