remove some Default{Root,Screen} from event handlers

This commit is contained in:
Julien Danjou 2007-09-16 00:11:10 +02:00
parent cd2c1657f5
commit 024fba4649
1 changed files with 32 additions and 21 deletions

53
event.c
View File

@ -255,23 +255,25 @@ void
handle_event_configurenotify(XEvent * e, awesome_config *awesomeconf) handle_event_configurenotify(XEvent * e, awesome_config *awesomeconf)
{ {
XConfigureEvent *ev = &e->xconfigure; XConfigureEvent *ev = &e->xconfigure;
int screen;
if(ev->window == DefaultRootWindow(e->xany.display) for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
&& (ev->width != DisplayWidth(e->xany.display, DefaultScreen(e->xany.display)) if(ev->window == RootWindow(e->xany.display, screen)
|| ev->height != DisplayHeight(e->xany.display, DefaultScreen(e->xany.display)))) && (ev->width != DisplayWidth(e->xany.display, screen)
{ || ev->height != DisplayHeight(e->xany.display, screen)))
DisplayWidth(e->xany.display, DefaultScreen(e->xany.display)) = ev->width; {
DisplayHeight(e->xany.display, DefaultScreen(e->xany.display)) = ev->height; DisplayWidth(e->xany.display, screen) = ev->width;
XFreePixmap(e->xany.display, awesomeconf->statusbar.drawable); DisplayHeight(e->xany.display, screen) = ev->height;
awesomeconf->statusbar.drawable = XCreatePixmap(e->xany.display, DefaultRootWindow(e->xany.display), XFreePixmap(e->xany.display, awesomeconf->statusbar.drawable);
DisplayWidth(e->xany.display, DefaultScreen(e->xany.display)), awesomeconf->statusbar.drawable = XCreatePixmap(e->xany.display, RootWindow(e->xany.display, screen),
awesomeconf->statusbar.height, DisplayWidth(e->xany.display, screen),
DefaultDepth(e->xany.display, DefaultScreen(e->xany.display))); awesomeconf->statusbar.height,
XResizeWindow(e->xany.display, awesomeconf->statusbar.window, DefaultDepth(e->xany.display, screen));
DisplayWidth(e->xany.display, DefaultScreen(e->xany.display)), awesomeconf->statusbar.height); XResizeWindow(e->xany.display, awesomeconf->statusbar.window,
updatebarpos(e->xany.display, awesomeconf->statusbar); DisplayWidth(e->xany.display, screen), awesomeconf->statusbar.height);
arrange(e->xany.display, DefaultScreen(e->xany.display), &dc, awesomeconf); updatebarpos(e->xany.display, awesomeconf->statusbar);
} arrange(e->xany.display, screen, &dc, awesomeconf);
}
} }
void void
@ -289,13 +291,16 @@ handle_event_enternotify(XEvent * e, awesome_config *awesomeconf)
{ {
Client *c; Client *c;
XCrossingEvent *ev = &e->xcrossing; XCrossingEvent *ev = &e->xcrossing;
int screen;
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, ev->same_screen, awesomeconf);
else if(ev->window == DefaultRootWindow(e->xany.display)) else
focus(e->xany.display, DefaultScreen(e->xany.display), &dc, NULL, True, awesomeconf); 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);
} }
void void
@ -325,9 +330,11 @@ void
handle_event_leavenotify(XEvent * e, awesome_config *awesomeconf) handle_event_leavenotify(XEvent * e, awesome_config *awesomeconf)
{ {
XCrossingEvent *ev = &e->xcrossing; XCrossingEvent *ev = &e->xcrossing;
int screen;
if((ev->window == DefaultRootWindow(e->xany.display)) && !ev->same_screen) for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
focus(e->xany.display, DefaultScreen(e->xany.display), &dc, NULL, ev->same_screen, awesomeconf); if((ev->window == RootWindow(e->xany.display, screen)) && !ev->same_screen)
focus(e->xany.display, screen, &dc, NULL, ev->same_screen, awesomeconf);
} }
void void
@ -345,13 +352,17 @@ handle_event_maprequest(XEvent * e, awesome_config *awesomeconf)
{ {
static XWindowAttributes wa; static XWindowAttributes wa;
XMapRequestEvent *ev = &e->xmaprequest; XMapRequestEvent *ev = &e->xmaprequest;
int screen;
if(!XGetWindowAttributes(e->xany.display, ev->window, &wa)) if(!XGetWindowAttributes(e->xany.display, ev->window, &wa))
return; return;
if(wa.override_redirect) if(wa.override_redirect)
return; return;
if(!getclient(ev->window)) if(!getclient(ev->window))
manage(e->xany.display, DefaultScreen(e->xany.display), &dc, ev->window, &wa, awesomeconf); {
for(screen = 0; wa.screen != ScreenOfDisplay(e->xany.display, screen); screen++);
manage(e->xany.display, screen, &dc, ev->window, &wa, awesomeconf);
}
} }
void void