Skip to content

Commit 3a59811

Browse files
committed
Assure Popup Windows (override-redirect) open over parent
The problem and solution is reported by `vx-sec` on Github. It was found on Xmonad WM. The fix simply raises the override-redirect window to top, flushes display events and the restack windows for "Keep-on-top" windows to work properly Also tested on the default XFCE on r4.3 resolves: QubesOS/qubes-issues#9935
1 parent cd00839 commit 3a59811

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
*.dep
33
tags
44
pkgs/
5+
gui-daemon/qubes-guid

gui-daemon/xside.c

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3357,8 +3357,8 @@ static bool should_keep_on_top(Ghandles *g, Window window) {
33573357

33583358

33593359
/* Move a newly mapped override_redirect window below windows that need to be
3360-
* kept on top, i.e. screen lockers. */
3361-
static void restack_windows(Ghandles *g, struct windowdata *vm_window)
3360+
* kept on top, i.e. screen lockers. Returns new index (-1 == top of all) */
3361+
static int restack_windows(Ghandles *g, struct windowdata *vm_window)
33623362
{
33633363
Window root;
33643364
Window parent;
@@ -3372,7 +3372,7 @@ static void restack_windows(Ghandles *g, struct windowdata *vm_window)
33723372

33733373
if (!children_list) {
33743374
fprintf(stderr, "XQueryTree returned an empty list\n");
3375-
return;
3375+
return 0;
33763376
}
33773377

33783378
/* Traverse children_list, looking for bottom-most window that
@@ -3408,6 +3408,7 @@ static void restack_windows(Ghandles *g, struct windowdata *vm_window)
34083408
}
34093409

34103410
XFree(children_list);
3411+
return goal_pos;
34113412
}
34123413

34133414

@@ -3466,7 +3467,12 @@ static void handle_map(Ghandles * g, struct windowdata *vm_window)
34663467
(void) XMapWindow(g->display, vm_window->local_winid);
34673468

34683469
if (vm_window->override_redirect) {
3469-
restack_windows(g, vm_window);
3470+
if (restack_windows(g, vm_window) == -1) {
3471+
// Ensure override redirect window is raised after mapping
3472+
// But only if no screensaver is active
3473+
XRaiseWindow(g->display, vm_window->local_winid);
3474+
XFlush(g->display); // Ensure raise takes effect immediately
3475+
}
34703476
}
34713477
}
34723478

0 commit comments

Comments
 (0)