Fix screen detection in keypress for supporting Xinerama

This commit is contained in:
Julien Danjou 2007-09-27 17:53:01 +02:00
parent 3bba90fa38
commit 491b5611c2
1 changed files with 11 additions and 14 deletions

25
event.c
View File

@ -343,20 +343,17 @@ handle_event_keypress(XEvent * e, awesome_config *awesomeconf)
keysym = XKeycodeToKeysym(e->xany.display, (KeyCode) ev->keycode, 0); keysym = XKeycodeToKeysym(e->xany.display, (KeyCode) ev->keycode, 0);
/* find the right screen for this event */ /* find the right screen for this event */
if(sel) for(screen = 0; screen < ScreenCount(e->xany.display); screen++)
screen = sel->screen; if(XQueryPointer(e->xany.display, RootWindow(e->xany.display, screen), &dummy, &dummy, &x, &y, &d, &d, &m))
else {
for(screen = 0; screen < ScreenCount(e->xany.display); screen++) /* if screen is 0, we are on first Zaphod screen or on the
if(XQueryPointer(e->xany.display, RootWindow(e->xany.display, screen), &dummy, &dummy, &x, &y, &d, &d, &m)) * only screen in Xinerama, so we can ask for a better screen
{ * number with get_screen_bycoord: we'll get 0 in Zaphod mode
/* if screen is 0, we are on first Zaphod screen or on the * so it's the same, or maybe the real Xinerama screen */
* only screen in Xinerama, so we can ask for a better screen if(screen == 0)
* number with get_screen_bycoord: we'll get 0 in Zaphod mode screen = get_screen_bycoord(e->xany.display, x, y);
* so it's the same, or maybe the real Xinerama screen */ break;
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