diff options
| -rw-r--r-- | dmenu.c | 19 |
1 files changed, 12 insertions, 7 deletions
| @@ -473,7 +473,7 @@ void | |||
| 473 | setup(void) { | 473 | setup(void) { |
| 474 | int x, y, screen = DefaultScreen(dc->dpy); | 474 | int x, y, screen = DefaultScreen(dc->dpy); |
| 475 | Window root = RootWindow(dc->dpy, screen); | 475 | Window root = RootWindow(dc->dpy, screen); |
| 476 | XSetWindowAttributes wa; | 476 | XSetWindowAttributes swa; |
| 477 | #ifdef XINERAMA | 477 | #ifdef XINERAMA |
| 478 | int n; | 478 | int n; |
| 479 | XineramaScreenInfo *info; | 479 | XineramaScreenInfo *info; |
| @@ -494,9 +494,14 @@ setup(void) { | |||
| 494 | if((info = XineramaQueryScreens(dc->dpy, &n))) { | 494 | if((info = XineramaQueryScreens(dc->dpy, &n))) { |
| 495 | int i, di; | 495 | int i, di; |
| 496 | unsigned int du; | 496 | unsigned int du; |
| 497 | Window dw; | 497 | Window w, dw; |
| 498 | XWindowAttributes wa; | ||
| 498 | 499 | ||
| 499 | XQueryPointer(dc->dpy, root, &dw, &dw, &x, &y, &di, &di, &du); | 500 | XGetInputFocus(dc->dpy, &w, &di); |
| 501 | if(w != root && XGetWindowAttributes(dc->dpy, w, &wa)) | ||
| 502 | XTranslateCoordinates(dc->dpy, root, root, wa.x, wa.y, &x, &y, &dw); | ||
| 503 | else | ||
| 504 | XQueryPointer(dc->dpy, root, &dw, &dw, &x, &y, &di, &di, &du); | ||
| 500 | for(i = 0; i < n-1; i++) | 505 | for(i = 0; i < n-1; i++) |
| 501 | if(INRECT(x, y, info[i].x_org, info[i].y_org, info[i].width, info[i].height)) | 506 | if(INRECT(x, y, info[i].x_org, info[i].y_org, info[i].width, info[i].height)) |
| 502 | break; | 507 | break; |
| @@ -517,13 +522,13 @@ setup(void) { | |||
| 517 | match(False); | 522 | match(False); |
| 518 | 523 | ||
| 519 | /* menu window */ | 524 | /* menu window */ |
| 520 | wa.override_redirect = True; | 525 | swa.override_redirect = True; |
| 521 | wa.background_pixmap = ParentRelative; | 526 | swa.background_pixmap = ParentRelative; |
| 522 | wa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask; | 527 | swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask; |
| 523 | win = XCreateWindow(dc->dpy, root, x, y, mw, mh, 0, | 528 | win = XCreateWindow(dc->dpy, root, x, y, mw, mh, 0, |
| 524 | DefaultDepth(dc->dpy, screen), CopyFromParent, | 529 | DefaultDepth(dc->dpy, screen), CopyFromParent, |
| 525 | DefaultVisual(dc->dpy, screen), | 530 | DefaultVisual(dc->dpy, screen), |
| 526 | CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); | 531 | CWOverrideRedirect | CWBackPixmap | CWEventMask, &swa); |
| 527 | 532 | ||
| 528 | XMapRaised(dc->dpy, win); | 533 | XMapRaised(dc->dpy, win); |
| 529 | resizedc(dc, mw, mh); | 534 | resizedc(dc, mw, mh); |
