use get_screen_count instead of ScreenCount where needed

This commit is contained in:
Julien Danjou 2007-09-27 16:34:51 +02:00
parent 4662cf109e
commit bdd408cd6c
2 changed files with 21 additions and 10 deletions

View File

@ -66,7 +66,7 @@ cleanup(Display *disp, DC *drawcontext, awesome_config *awesomeconf)
unmanage(stack, drawcontext, NormalState, awesomeconf); unmanage(stack, drawcontext, NormalState, awesomeconf);
} }
for(screen = 0; screen < ScreenCount(disp); screen++) for(screen = 0; screen < get_screen_count(disp); screen++)
{ {
if(drawcontext[screen].font.set) if(drawcontext[screen].font.set)
XFreeFontSet(disp, drawcontext[screen].font.set); XFreeFontSet(disp, drawcontext[screen].font.set);
@ -323,10 +323,10 @@ main(int argc, char *argv[])
netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False); netatom[NetWMName] = XInternAtom(dpy, "_NET_WM_NAME", False);
/* allocate stuff */ /* allocate stuff */
dc = p_new(DC, ScreenCount(dpy)); dc = p_new(DC, get_screen_count(dpy));
awesomeconf = p_new(awesome_config, ScreenCount(dpy)); awesomeconf = p_new(awesome_config, get_screen_count(dpy));
for(screen = 0; screen < ScreenCount(dpy); screen++) for(screen = 0; screen < get_screen_count(dpy); screen++)
{ {
parse_config(dpy, screen, &dc[screen], confpath, &awesomeconf[screen]); parse_config(dpy, screen, &dc[screen], confpath, &awesomeconf[screen]);
setup(dpy, screen, &dc[screen], &awesomeconf[screen]); setup(dpy, screen, &dc[screen], &awesomeconf[screen]);
@ -363,13 +363,15 @@ main(int argc, char *argv[])
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 < ScreenCount(dpy); screen++) for(screen = 0; screen < get_screen_count(dpy); screen++)
{ {
awesomeconf[screen].have_shape = awesomeconf[0].have_shape; awesomeconf[screen].have_shape = awesomeconf[0].have_shape;
awesomeconf[screen].have_randr = awesomeconf[0].have_randr; awesomeconf[screen].have_randr = awesomeconf[0].have_randr;
scan(dpy, screen, &dc[screen], &awesomeconf[screen]);
} }
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 */

17
event.c
View File

@ -148,7 +148,7 @@ handle_event_buttonpress(XEvent * e, awesome_config *awesomeconf)
Client *c; Client *c;
XButtonPressedEvent *ev = &e->xbutton; XButtonPressedEvent *ev = &e->xbutton;
for(screen = 0; screen < ScreenCount(e->xany.display); screen++) for(screen = 0; screen < get_screen_count(e->xany.display); screen++)
if(awesomeconf[screen].statusbar.window == ev->window) if(awesomeconf[screen].statusbar.window == ev->window)
{ {
int x = 0; int x = 0;
@ -326,7 +326,7 @@ handle_event_expose(XEvent * e, awesome_config *awesomeconf)
int screen; int screen;
if(!ev->count) if(!ev->count)
for(screen = 0; screen < ScreenCount(e->xany.display); screen++) for(screen = 0; screen < get_screen_count(e->xany.display); screen++)
if(awesomeconf[screen].statusbar.window == ev->window) if(awesomeconf[screen].statusbar.window == ev->window)
drawstatusbar(e->xany.display, &dc[screen], &awesomeconf[screen]); drawstatusbar(e->xany.display, &dc[screen], &awesomeconf[screen]);
} }
@ -346,8 +346,17 @@ handle_event_keypress(XEvent * e, awesome_config *awesomeconf)
if(sel) if(sel)
screen = sel->screen; screen = sel->screen;
else else
for(screen = 0; screen < ScreenCount(e->xany.display) && for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
!XQueryPointer(e->xany.display, RootWindow(e->xany.display, screen), &dummy, &dummy, &y, &x, &d, &d, &m); screen++); if(XQueryPointer(e->xany.display, RootWindow(e->xany.display, screen), &dummy, &dummy, &x, &y, &d, &d, &m))
{
/* if screen is 0, we are on first Zaphod screen or on the
* only screen in Xinerama, so we can ask for a better screen
* number with get_screen_bycoord: we'll get 0 in Zaphod mode
* so it's the same, or maybe the real Xinerama screen */
if(screen == 0)
screen = get_screen_bycoord(e->xany.display, x, y);
break;
}
for(i = 0; i < awesomeconf[screen].nkeys; i++) for(i = 0; i < awesomeconf[screen].nkeys; i++)
if(keysym == awesomeconf[screen].keys[i].keysym if(keysym == awesomeconf[screen].keys[i].keysym