fix: sync GTK/Qt themes on session start, follow GTK-3 in Qt, and keep anode-lock above systray

This commit is contained in:
Luxferre committed 2026-11-26 16:21:03 +02:00
1 parent 0d8b7994bc
commit c4bee91e6b
11 files changed
+352 -25

No files matched your search

+11 -5
View File
@@ -2363,8 +2363,14 @@ static void updatebars(void) {
CWOverrideRedirect | CWBackPixmap | CWEventMask, &wa);
XDefineCursor(dpy, m->barwin, cursor[CurNormal]->cursor);
if (showsystray && m == systraytomon(m) && systray && getsystraywidth() > 0)
XMapRaised(dpy, systray->win);
XMapRaised(dpy, m->barwin);
XMapWindow(dpy, systray->win);
XMapWindow(dpy, m->barwin);
if (showsystray && m == systraytomon(m) && systray && getsystraywidth() > 0) {
XWindowChanges wc;
wc.stack_mode = Above;
wc.sibling = m->barwin;
XConfigureWindow(dpy, systray->win, CWSibling | CWStackMode, &wc);
}
XSetClassHint(dpy, m->barwin, &ch);
}
}
@@ -2773,12 +2779,12 @@ static void updatesystray(int updatebar) {
w += systrayspacing;
x = (unsigned int)(m->wx + m->ww) - w;
XMoveResizeWindow(dpy, systray->win, (int)x, m->by, w, (unsigned int)bh);
XSetWindowBackground(dpy, systray->win, systray_bg_pixel());
XClearWindow(dpy, systray->win);
XMapWindow(dpy, systray->win);
wc.x = (int)x; wc.y = m->by; wc.width = (int)w; wc.height = bh;
wc.stack_mode = Above; wc.sibling = m->barwin;
XConfigureWindow(dpy, systray->win, CWX | CWY | CWWidth | CWHeight | CWSibling | CWStackMode, &wc);
XSetWindowBackground(dpy, systray->win, systray_bg_pixel());
XClearWindow(dpy, systray->win);
XMapRaised(dpy, systray->win);
if (updatebar) resizebarwin(m);
XSync(dpy, False);
}
+80 -7
View File
@@ -509,6 +509,7 @@ gemui_app_t *gemui_create(const char *res_name, const char *title,
StructureNotifyMask | FocusChangeMask;
if (fullscreen_override) {
swa.override_redirect = True;
swa.event_mask |= VisibilityChangeMask;
}
unsigned long mask = CWBackPixmap | CWEventMask | (fullscreen_override ? CWOverrideRedirect : 0);
@@ -543,7 +544,9 @@ gemui_app_t *gemui_create(const char *res_name, const char *title,
XFree(ch);
}
XSelectInput(dpy, app->root, PropertyChangeMask);
XSelectInput(dpy, app->root,
fullscreen_override ? (PropertyChangeMask | SubstructureNotifyMask)
: PropertyChangeMask);
app->wm_delete = XInternAtom(dpy, "WM_DELETE_WINDOW", False);
app->net_wm_name = XInternAtom(dpy, "_NET_WM_NAME", False);
@@ -779,6 +782,60 @@ void gemui_flush_draw(gemui_app_t *app) {
gemui_render_frame(app);
}
static bool gemui_is_vkbd_win(Display *dpy, Window w) {
if (!dpy || w == None) return false;
int (*old_handler)(Display *, XErrorEvent *) = XSetErrorHandler(gemui_ignore_xerror);
XClassHint ch;
memset(&ch, 0, sizeof(ch));
bool is_vkbd = false;
if (XGetClassHint(dpy, w, &ch)) {
if (ch.res_name && strcmp(ch.res_name, "anode-vkbd") == 0) {
is_vkbd = true;
}
if (ch.res_name) XFree(ch.res_name);
if (ch.res_class) XFree(ch.res_class);
}
XSetErrorHandler(old_handler);
return is_vkbd;
}
static void gemui_keep_fullscreen_on_top(gemui_app_t *app) {
if (!app || !app->fullscreen_override || !app->mapped || !app->dpy || app->win == None) return;
Window root_ret = None, parent_ret = None;
Window *children = NULL;
unsigned int nchildren = 0;
int (*old_handler)(Display *, XErrorEvent *) = XSetErrorHandler(gemui_ignore_xerror);
if (!XQueryTree(app->dpy, app->root, &root_ret, &parent_ret, &children, &nchildren)) {
XSetErrorHandler(old_handler);
return;
}
Window top_non_vkbd = None;
Window top_vkbd = None;
for (int i = (int)nchildren - 1; i >= 0; i--) {
Window cw = children[i];
XWindowAttributes wa;
if (!XGetWindowAttributes(app->dpy, cw, &wa) || wa.map_state != IsViewable) continue;
if (cw == app->win) {
if (top_non_vkbd == None) top_non_vkbd = cw;
break;
}
if (gemui_is_vkbd_win(app->dpy, cw)) {
if (top_vkbd == None) top_vkbd = cw;
} else if (top_non_vkbd == None) {
top_non_vkbd = cw;
}
}
if (top_non_vkbd != app->win) {
XRaiseWindow(app->dpy, app->win);
if (top_vkbd != None) {
XRaiseWindow(app->dpy, top_vkbd);
}
XFlush(app->dpy);
}
if (children) XFree(children);
XSetErrorHandler(old_handler);
}
static void gemui_handle_x_events(gemui_app_t *app) {
while (XPending(app->dpy) > 0 && app->running) {
XEvent ev;
@@ -790,13 +847,29 @@ static void gemui_handle_x_events(gemui_app_t *app) {
if (ev.xexpose.count == 0) app->need_redraw = true;
break;
case ConfigureNotify:
if (ev.xconfigure.width != app->w || ev.xconfigure.height != app->h) {
app->w = ev.xconfigure.width;
app->h = ev.xconfigure.height;
if (app->handlers.on_resize) {
app->handlers.on_resize(app, app->w, app->h, app->userdata);
if (ev.xconfigure.window == app->win) {
if (ev.xconfigure.width != app->w || ev.xconfigure.height != app->h) {
app->w = ev.xconfigure.width;
app->h = ev.xconfigure.height;
if (app->handlers.on_resize) {
app->handlers.on_resize(app, app->w, app->h, app->userdata);
}
app->need_redraw = true;
}
app->need_redraw = true;
} else if (app->fullscreen_override && !gemui_is_vkbd_win(app->dpy, ev.xconfigure.window)) {
gemui_keep_fullscreen_on_top(app);
}
break;
case MapNotify:
if (app->fullscreen_override && ev.xmap.window != app->win &&
!gemui_is_vkbd_win(app->dpy, ev.xmap.window)) {
gemui_keep_fullscreen_on_top(app);
}
break;
case VisibilityNotify:
if (app->fullscreen_override && ev.xvisibility.window == app->win &&
ev.xvisibility.state != VisibilityUnobscured) {
gemui_keep_fullscreen_on_top(app);
}
break;
case ClientMessage: