mirror of
https://github.com/awesomeWM/awesome
synced 2024-11-17 07:47:41 +01:00
enhance multihead support, with N conf/dc
This commit is contained in:
parent
d900fc1773
commit
1ca3c565ee
2 changed files with 144 additions and 134 deletions
143
awesome.c
143
awesome.c
|
@ -43,7 +43,7 @@
|
|||
Client *clients = NULL;
|
||||
Client *sel = NULL;
|
||||
Client *stack = NULL;
|
||||
DC dc;
|
||||
DC *dc;
|
||||
|
||||
/* static */
|
||||
|
||||
|
@ -63,20 +63,22 @@ cleanup(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
|
|||
unmanage(stack, drawcontext, NormalState, awesomeconf);
|
||||
}
|
||||
|
||||
if(drawcontext->font.set)
|
||||
XFreeFontSet(disp, drawcontext->font.set);
|
||||
else
|
||||
XFreeFont(disp, drawcontext->font.xfont);
|
||||
for(screen = 0; screen < ScreenCount(disp); screen++)
|
||||
{
|
||||
if(drawcontext[screen].font.set)
|
||||
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);
|
||||
XFreeGC(disp, drawcontext->gc);
|
||||
XDestroyWindow(disp, awesomeconf->statusbar.window);
|
||||
XFreeCursor(disp, drawcontext->cursor[CurNormal]);
|
||||
XFreeCursor(disp, drawcontext->cursor[CurResize]);
|
||||
XFreeCursor(disp, drawcontext->cursor[CurMove]);
|
||||
XFreePixmap(disp, awesomeconf[screen].statusbar.drawable);
|
||||
XFreeGC(disp, drawcontext[screen].gc);
|
||||
XDestroyWindow(disp, awesomeconf[screen].statusbar.window);
|
||||
XFreeCursor(disp, drawcontext[screen].cursor[CurNormal]);
|
||||
XFreeCursor(disp, drawcontext[screen].cursor[CurResize]);
|
||||
XFreeCursor(disp, drawcontext[screen].cursor[CurMove]);
|
||||
}
|
||||
XSetInputFocus(disp, PointerRoot, RevertToPointerRoot, CurrentTime);
|
||||
XSync(disp, False);
|
||||
}
|
||||
|
@ -101,36 +103,32 @@ getstate(Display *disp, Window w)
|
|||
}
|
||||
|
||||
static void
|
||||
scan(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
|
||||
scan(Display *disp, int screen, DC *drawcontext, awesome_config *awesomeconf)
|
||||
{
|
||||
unsigned int i, num;
|
||||
int screen;
|
||||
Window *wins, d1, d2;
|
||||
XWindowAttributes wa;
|
||||
|
||||
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
|
||||
|| XGetTransientForHint(disp, wins[i], &d1))
|
||||
continue;
|
||||
if(!XGetWindowAttributes(disp, wins[i], &wa)
|
||||
|| wa.override_redirect
|
||||
|| XGetTransientForHint(disp, wins[i], &d1))
|
||||
continue;
|
||||
if(wa.map_state == IsViewable || getstate(disp, wins[i]) == IconicState)
|
||||
manage(disp, screen, drawcontext, wins[i], &wa, awesomeconf);
|
||||
}
|
||||
/* now the transients */
|
||||
for(i = 0; i < num; i++)
|
||||
{
|
||||
if(!XGetWindowAttributes(disp, wins[i], &wa))
|
||||
continue;
|
||||
if(XGetTransientForHint(disp, wins[i], &d1)
|
||||
&& (wa.map_state == IsViewable || getstate(disp, wins[i]) == IconicState))
|
||||
manage(disp, screen, drawcontext, wins[i], &wa, awesomeconf);
|
||||
}
|
||||
}
|
||||
/* now the transients */
|
||||
for(i = 0; i < num; i++)
|
||||
{
|
||||
if(!XGetWindowAttributes(disp, wins[i], &wa))
|
||||
continue;
|
||||
if(XGetTransientForHint(disp, wins[i], &d1)
|
||||
&& (wa.map_state == IsViewable || getstate(disp, wins[i]) == IconicState))
|
||||
manage(disp, screen, drawcontext, wins[i], &wa, awesomeconf);
|
||||
}
|
||||
}
|
||||
if(wins)
|
||||
|
@ -143,20 +141,15 @@ enum { NetSupported, NetWMName, NetLast }; /* EWMH atoms */
|
|||
Atom netatom[NetWMName];
|
||||
/** Setup everything before running
|
||||
* \param disp Display ref
|
||||
* \param screen Screen number
|
||||
* \param awesomeconf awesome config ref
|
||||
* \todo clean things...
|
||||
*/
|
||||
static void
|
||||
setup(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
|
||||
setup(Display *disp, int screen, DC *drawcontext, awesome_config *awesomeconf)
|
||||
{
|
||||
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 */
|
||||
drawcontext->cursor[CurNormal] = XCreateFontCursor(disp, XC_left_ptr);
|
||||
drawcontext->cursor[CurResize] = XCreateFontCursor(disp, XC_sizing);
|
||||
|
@ -165,22 +158,22 @@ setup(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
|
|||
wa.event_mask = SubstructureRedirectMask | SubstructureNotifyMask
|
||||
| EnterWindowMask | LeaveWindowMask | StructureNotifyMask;
|
||||
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);
|
||||
grabkeys(disp, screen, awesomeconf);
|
||||
}
|
||||
XChangeWindowAttributes(disp, RootWindow(disp, screen), CWEventMask | CWCursor, &wa);
|
||||
XSelectInput(disp, RootWindow(disp, screen), wa.event_mask);
|
||||
grabkeys(disp, screen, awesomeconf);
|
||||
compileregs(awesomeconf->rules, awesomeconf->nrules);
|
||||
/* bar */
|
||||
drawcontext->h = awesomeconf->statusbar.height = drawcontext->font.height + 2;
|
||||
initstatusbar(disp, DefaultScreen(disp), drawcontext, &awesomeconf->statusbar);
|
||||
drawcontext->gc = XCreateGC(disp, DefaultRootWindow(disp), 0, 0);
|
||||
initstatusbar(disp, screen, drawcontext, &awesomeconf->statusbar);
|
||||
drawcontext->gc = XCreateGC(disp, RootWindow(disp, screen), 0, 0);
|
||||
XSetLineAttributes(disp, drawcontext->gc, 1, LineSolid, CapButt, JoinMiter);
|
||||
if(!drawcontext->font.set)
|
||||
XSetFont(disp, drawcontext->gc, drawcontext->font.xfont->fid);
|
||||
for(screen = 0; screen < ScreenCount(disp); screen++)
|
||||
loadawesomeprops(disp, screen, awesomeconf);
|
||||
// netatom[NetSupported] = XInternAtom(disp, "_NET_SUPPORTED", False);
|
||||
// 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;
|
||||
XEvent ev;
|
||||
Display * dpy;
|
||||
awesome_config awesomeconf;
|
||||
awesome_config *awesomeconf;
|
||||
int shape_event, randr_event_base;
|
||||
int screen;
|
||||
|
||||
|
@ -288,13 +281,20 @@ main(int argc, char *argv[])
|
|||
for(screen = 0; screen < ScreenCount(dpy); screen++)
|
||||
XSelectInput(dpy, RootWindow(dpy, screen), SubstructureRedirectMask);
|
||||
|
||||
|
||||
XSync(dpy, False);
|
||||
XSetErrorHandler(NULL);
|
||||
xerrorxlib = XSetErrorHandler(xerror);
|
||||
XSync(dpy, False);
|
||||
parse_config(dpy, DefaultScreen(dpy), &dc, &awesomeconf);
|
||||
setup(dpy, &dc, &awesomeconf);
|
||||
drawstatusbar(dpy, DefaultScreen(dpy), &dc, &awesomeconf);
|
||||
|
||||
awesomeconf = p_new(awesome_config, ScreenCount(dpy));
|
||||
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 *) =
|
||||
{
|
||||
|
@ -312,15 +312,16 @@ main(int argc, char *argv[])
|
|||
[UnmapNotify] = handle_event_unmapnotify,
|
||||
};
|
||||
|
||||
/* check for shape extension */
|
||||
if((awesomeconf.have_shape = XShapeQueryExtension(dpy, &shape_event, &e_dummy)))
|
||||
/* XXX check for shape extension */
|
||||
if((awesomeconf[0].have_shape = XShapeQueryExtension(dpy, &shape_event, &e_dummy)))
|
||||
handler[shape_event] = handle_event_shape;
|
||||
|
||||
/* check for randr extension */
|
||||
if((awesomeconf.have_randr = XRRQueryExtension(dpy, &randr_event_base, &e_dummy)))
|
||||
/* XXX check for randr extension */
|
||||
if((awesomeconf[0].have_randr = XRRQueryExtension(dpy, &randr_event_base, &e_dummy)))
|
||||
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);
|
||||
|
||||
/* main event loop, also reads status text from stdin */
|
||||
|
@ -338,35 +339,35 @@ main(int argc, char *argv[])
|
|||
}
|
||||
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:
|
||||
strncpy(awesomeconf.statustext, strerror(errno), sizeof(awesomeconf.statustext) - 1);
|
||||
awesomeconf.statustext[sizeof(awesomeconf.statustext) - 1] = '\0';
|
||||
strncpy(awesomeconf[0].statustext, strerror(errno), sizeof(awesomeconf[0].statustext) - 1);
|
||||
awesomeconf[0].statustext[sizeof(awesomeconf[0].statustext) - 1] = '\0';
|
||||
readin = False;
|
||||
break;
|
||||
case 0:
|
||||
strncpy(awesomeconf.statustext, "EOF", 4);
|
||||
strncpy(awesomeconf[0].statustext, "EOF", 4);
|
||||
readin = False;
|
||||
break;
|
||||
default:
|
||||
for(awesomeconf.statustext[r] = '\0', p = awesomeconf.statustext + a_strlen(awesomeconf.statustext) - 1;
|
||||
p >= awesomeconf.statustext && *p == '\n'; *p-- = '\0');
|
||||
for(; p >= awesomeconf.statustext && *p != '\n'; --p);
|
||||
if(p > awesomeconf.statustext)
|
||||
strncpy(awesomeconf.statustext, p + 1, sizeof(awesomeconf.statustext));
|
||||
for(awesomeconf[0].statustext[r] = '\0', p = awesomeconf[0].statustext + a_strlen(awesomeconf[0].statustext) - 1;
|
||||
p >= awesomeconf[0].statustext && *p == '\n'; *p-- = '\0');
|
||||
for(; p >= awesomeconf[0].statustext && *p != '\n'; --p);
|
||||
if(p > awesomeconf[0].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))
|
||||
{
|
||||
XNextEvent(dpy, &ev);
|
||||
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);
|
||||
|
||||
return 0;
|
||||
|
|
135
event.c
135
event.c
|
@ -36,11 +36,11 @@
|
|||
#include "layouts/floating.h"
|
||||
|
||||
/* extern */
|
||||
extern DC dc; /* global draw context */
|
||||
extern DC *dc; /* global draw context */
|
||||
extern Client *clients, *sel; /* global client list */
|
||||
|
||||
#define CLEANMASK(mask) (mask & ~(awesomeconf->numlockmask | LockMask))
|
||||
#define MOUSEMASK (BUTTONMASK | PointerMotionMask)
|
||||
#define CLEANMASK(mask, screen) (mask & ~(awesomeconf[screen].numlockmask | LockMask))
|
||||
#define MOUSEMASK (BUTTONMASK | PointerMotionMask)
|
||||
|
||||
static Client *
|
||||
getclient(Window w)
|
||||
|
@ -65,7 +65,7 @@ movemouse(Client * c, awesome_config *awesomeconf)
|
|||
ocx = nx = c->x;
|
||||
ocy = ny = c->y;
|
||||
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;
|
||||
XQueryPointer(c->display, RootWindow(c->display, c->screen), &dummy, &dummy, &x1, &y1, &di, &di, &dui);
|
||||
for(;;)
|
||||
|
@ -110,7 +110,7 @@ resizemouse(Client * c, awesome_config *awesomeconf)
|
|||
ocx = c->x;
|
||||
ocy = c->y;
|
||||
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;
|
||||
c->ismax = False;
|
||||
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
|
||||
handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
|
||||
{
|
||||
int i;
|
||||
int i, screen;
|
||||
Client *c;
|
||||
XButtonPressedEvent *ev = &e->xbutton;
|
||||
|
||||
if(awesomeconf->statusbar.window == ev->window)
|
||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||
{
|
||||
int x = 0;
|
||||
for(i = 0; i < awesomeconf->ntags; i++)
|
||||
if(awesomeconf[screen].statusbar.window == ev->window)
|
||||
{
|
||||
x += textw(dc.font.set, dc.font.xfont, awesomeconf->tags[i], dc.font.height);
|
||||
if(ev->x < x)
|
||||
int x = 0;
|
||||
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)
|
||||
uicb_tag(e->xany.display, awesomeconf->statusbar.screen, &dc, awesomeconf, awesomeconf->tags[i]);
|
||||
else
|
||||
uicb_view(e->xany.display, awesomeconf->statusbar.screen, &dc, awesomeconf, awesomeconf->tags[i]);
|
||||
if(ev->button == Button1)
|
||||
{
|
||||
if(ev->state & awesomeconf[screen].modkey)
|
||||
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)
|
||||
uicb_setlayout(e->xany.display, awesomeconf->statusbar.screen, &dc, awesomeconf, NULL);
|
||||
return;
|
||||
}
|
||||
else if((c = getclient(ev->window)))
|
||||
|
||||
if((c = getclient(ev->window)))
|
||||
{
|
||||
focus(c->display, c->screen, &dc, c, ev->same_screen, awesomeconf);
|
||||
if(CLEANMASK(ev->state) != awesomeconf->modkey)
|
||||
focus(c->display, c->screen, &dc[c->screen], c, ev->same_screen, &awesomeconf[screen]);
|
||||
if(CLEANMASK(ev->state, c->screen) != awesomeconf[c->screen].modkey)
|
||||
return;
|
||||
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);
|
||||
}
|
||||
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)
|
||||
{
|
||||
restack(e->xany.display, c->screen, &dc, awesomeconf);
|
||||
restack(e->xany.display, c->screen, &dc[c->screen], &awesomeconf[c->screen]);
|
||||
resizemouse(c, awesomeconf);
|
||||
}
|
||||
}
|
||||
else if(!sel)
|
||||
for(i = 0; i < ScreenCount(e->xany.display); i++)
|
||||
if(RootWindow(e->xany.display, i) == ev->window)
|
||||
for(screen = 0; screen < ScreenCount(e->xany.display); i++)
|
||||
if(RootWindow(e->xany.display, screen) == ev->window)
|
||||
{
|
||||
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)
|
||||
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 */
|
||||
if((ev->value_mask & (CWX | CWY)) && !(ev->value_mask & (CWWidth | CWHeight)))
|
||||
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);
|
||||
}
|
||||
else
|
||||
|
@ -266,15 +271,15 @@ handle_event_configurenotify(XEvent * e, awesome_config *awesomeconf)
|
|||
{
|
||||
DisplayWidth(e->xany.display, screen) = ev->width;
|
||||
DisplayHeight(e->xany.display, screen) = ev->height;
|
||||
XFreePixmap(e->xany.display, awesomeconf->statusbar.drawable);
|
||||
awesomeconf->statusbar.drawable = XCreatePixmap(e->xany.display, RootWindow(e->xany.display, screen),
|
||||
DisplayWidth(e->xany.display, screen),
|
||||
awesomeconf->statusbar.height,
|
||||
DefaultDepth(e->xany.display, screen));
|
||||
XResizeWindow(e->xany.display, awesomeconf->statusbar.window,
|
||||
DisplayWidth(e->xany.display, screen), awesomeconf->statusbar.height);
|
||||
updatebarpos(e->xany.display, awesomeconf->statusbar);
|
||||
arrange(e->xany.display, screen, &dc, awesomeconf);
|
||||
XFreePixmap(e->xany.display, awesomeconf[screen].statusbar.drawable);
|
||||
awesomeconf[screen].statusbar.drawable = XCreatePixmap(e->xany.display, RootWindow(e->xany.display, screen),
|
||||
DisplayWidth(e->xany.display, screen),
|
||||
awesomeconf[screen].statusbar.height,
|
||||
DefaultDepth(e->xany.display, screen));
|
||||
XResizeWindow(e->xany.display, awesomeconf[screen].statusbar.window,
|
||||
DisplayWidth(e->xany.display, screen), awesomeconf[screen].statusbar.height);
|
||||
updatebarpos(e->xany.display, awesomeconf[screen].statusbar);
|
||||
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;
|
||||
|
||||
if((c = getclient(ev->window)))
|
||||
unmanage(c, &dc, WithdrawnState, awesomeconf);
|
||||
unmanage(c, &dc[c->screen], WithdrawnState, &awesomeconf[c->screen]);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -298,20 +303,23 @@ handle_event_enternotify(XEvent * e, awesome_config *awesomeconf)
|
|||
if(ev->mode != NotifyNormal || ev->detail == NotifyInferior)
|
||||
return;
|
||||
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
|
||||
for(screen = 0; screen < ScreenCount(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
|
||||
handle_event_expose(XEvent * e, awesome_config *awesomeconf)
|
||||
{
|
||||
XExposeEvent *ev = &e->xexpose;
|
||||
int screen;
|
||||
|
||||
if(!ev->count && awesomeconf->statusbar.window == ev->window)
|
||||
drawstatusbar(e->xany.display, awesomeconf->statusbar.screen, &dc, awesomeconf);
|
||||
if(!ev->count)
|
||||
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
|
||||
|
@ -324,12 +332,13 @@ handle_event_keypress(XEvent * e, awesome_config *awesomeconf)
|
|||
Window dummy;
|
||||
|
||||
keysym = XKeycodeToKeysym(e->xany.display, (KeyCode) ev->keycode, 0);
|
||||
for(i = 0; i < awesomeconf->nkeys; i++)
|
||||
if(keysym == awesomeconf->keys[i].keysym
|
||||
&& CLEANMASK(awesomeconf->keys[i].mod) == CLEANMASK(ev->state) && awesomeconf->keys[i].func)
|
||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||
if(XQueryPointer(e->xany.display, RootWindow(e->xany.display, screen), &dummy, &dummy, &y, &x, &d, &d, &m))
|
||||
awesomeconf->keys[i].func(e->xany.display, screen, &dc, awesomeconf, awesomeconf->keys[i].arg);
|
||||
|
||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||
if(XQueryPointer(e->xany.display, RootWindow(e->xany.display, screen), &dummy, &dummy, &y, &x, &d, &d, &m))
|
||||
for(i = 0; i < awesomeconf[screen].nkeys; i++)
|
||||
if(keysym == awesomeconf[screen].keys[i].keysym
|
||||
&& 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
|
||||
|
@ -340,7 +349,7 @@ handle_event_leavenotify(XEvent * e, awesome_config *awesomeconf)
|
|||
|
||||
for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
|
||||
if((ev->window == RootWindow(e->xany.display, screen)) && !ev->same_screen)
|
||||
focus(e->xany.display, screen, &dc, NULL, ev->same_screen, awesomeconf);
|
||||
focus(e->xany.display, screen, &dc[screen], NULL, ev->same_screen, &awesomeconf[screen]);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -350,7 +359,7 @@ handle_event_mappingnotify(XEvent * e, awesome_config *awesomeconf)
|
|||
|
||||
XRefreshKeyboardMapping(ev);
|
||||
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
|
||||
|
@ -367,7 +376,7 @@ handle_event_maprequest(XEvent * e, awesome_config *awesomeconf)
|
|||
if(!getclient(ev->window))
|
||||
{
|
||||
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:
|
||||
XGetTransientForHint(e->xany.display, c->win, &trans);
|
||||
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;
|
||||
case XA_WM_NORMAL_HINTS:
|
||||
updatesizehints(c);
|
||||
|
@ -397,7 +406,7 @@ handle_event_propertynotify(XEvent * e, awesome_config *awesomeconf)
|
|||
{
|
||||
updatetitle(c);
|
||||
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))
|
||||
&& 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
|
||||
|
|
Loading…
Reference in a new issue