diff options
-rw-r--r-- | dmenu.c | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -484,7 +484,7 @@ void | |||
484 | setup(void) { | 484 | setup(void) { |
485 | int x, y, screen = DefaultScreen(dc->dpy); | 485 | int x, y, screen = DefaultScreen(dc->dpy); |
486 | Window root = RootWindow(dc->dpy, screen); | 486 | Window root = RootWindow(dc->dpy, screen); |
487 | XSetWindowAttributes wa; | 487 | XSetWindowAttributes swa; |
488 | #ifdef XINERAMA | 488 | #ifdef XINERAMA |
489 | int n; | 489 | int n; |
490 | XineramaScreenInfo *info; | 490 | XineramaScreenInfo *info; |
@@ -505,9 +505,14 @@ setup(void) { | |||
505 | if((info = XineramaQueryScreens(dc->dpy, &n))) { | 505 | if((info = XineramaQueryScreens(dc->dpy, &n))) { |
506 | int i, di; | 506 | int i, di; |
507 | unsigned int du; | 507 | unsigned int du; |
508 | Window dw; | 508 | Window w, dw; |
509 | XWindowAttributes wa; | ||
509 | 510 | ||
510 | XQueryPointer(dc->dpy, root, &dw, &dw, &x, &y, &di, &di, &du); | 511 | XGetInputFocus(dc->dpy, &w, &di); |
512 | if(w != root && XGetWindowAttributes(dc->dpy, w, &wa)) | ||
513 | XTranslateCoordinates(dc->dpy, root, root, wa.x, wa.y, &x, &y, &dw); | ||
514 | else | ||
515 | XQueryPointer(dc->dpy, root, &dw, &dw, &x, &y, &di, &di, &du); | ||
511 | for(i = 0; i < n-1; i++) | 516 | for(i = 0; i < n-1; i++) |
512 | if(INRECT(x, y, info[i].x_org, info[i].y_org, info[i].width, info[i].height)) | 517 | if(INRECT(x, y, info[i].x_org, info[i].y_org, info[i].width, info[i].height)) |
513 | break; | 518 | break; |
@@ -528,13 +533,13 @@ setup(void) { | |||
528 | match(); | 533 | match(); |
529 | 534 | ||
530 | /* menu window */ | 535 | /* menu window */ |
531 | wa.override_redirect = True; | 536 | swa.override_redirect = True; |
532 | wa.background_pixmap = ParentRelative; | 537 | swa.background_pixmap = ParentRelative; |
533 | wa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask; | 538 | swa.event_mask = ExposureMask | KeyPressMask | VisibilityChangeMask; |
534 | win = XCreateWindow(dc->dpy, root, x, y, mw, mh, 0, | 539 | win = XCreateWindow(dc->dpy, root, x, y, mw, mh, 0, |
535 | DefaultDepth(dc->dpy, screen), CopyFromParent, | 540 | DefaultDepth(dc->dpy, screen), CopyFromParent, |
536 | DefaultVisual(dc->dpy, screen), | 541 | DefaultVisual(dc->dpy, screen), |
537 | CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa); | 542 | CWOverrideRedirect | CWBackPixmap | CWEventMask, &swa); |
538 | 543 | ||
539 | XMapRaised(dc->dpy, win); | 544 | XMapRaised(dc->dpy, win); |
540 | resizedc(dc, mw, mh); | 545 | resizedc(dc, mw, mh); |