From: Matthias Kruk Date: Thu, 10 Jun 2021 00:17:46 +0000 (+0900) Subject: monitor: Don't XMapRaise() statusbar every time it is redrawn X-Git-Url: https://git.corax.cc/?a=commitdiff_plain;h=d96be74fae6d6e0dd5bc718fc0f5d3eafb272c94;p=mwm monitor: Don't XMapRaise() statusbar every time it is redrawn The statusbar is mapped raised everytime it is redrawn, even if it is obscured by another window. If the other window is not tiled (that is, its position and size are not controlled by mwm), it will try to bring itself back to the front, and the two windows end up competing to be on top of the stack. This commit makes sure the statusbar is mapped only once, when it is initialized. Since statusbars are never unmapped, there is no need to map them every time they are redrawn. --- diff --git a/monitor.c b/monitor.c index 5ff7352..016ca49 100644 --- a/monitor.c +++ b/monitor.c @@ -209,6 +209,7 @@ int monitor_new(struct mwm *mwm, int id, int x, int y, int w, int h, mon->statusbar = mwm_create_window(mwm, x, y, w, STATUSBAR_HEIGHT); mon->gfx_context = mwm_create_gc(mwm); mon->xft_context = mwm_create_xft_context(mwm, (Drawable)mon->statusbar); + XMapRaised(mwm_get_display(mwm), mon->statusbar); _indicator_update_geometry(mon); @@ -541,8 +542,6 @@ static int _redraw_statusbar(struct monitor *monitor) mwm_render_text(monitor->mwm, monitor->xft_context, dwdata.palette, status, status_x + dwdata.text_padding, dwdata.text_padding); - XMapRaised(display, monitor->statusbar); - return(0); }