]> git.corax.cc Git - mwm/commitdiff
monitor: Don't XMapRaise() statusbar every time it is redrawn
authorMatthias Kruk <m@m10k.eu>
Thu, 10 Jun 2021 00:17:46 +0000 (09:17 +0900)
committerMatthias Kruk <m@m10k.eu>
Thu, 10 Jun 2021 00:17:46 +0000 (09:17 +0900)
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.

monitor.c

index 5ff7352e42bd72530029f8bf038987adfe41262e..016ca496987ce94d7985605d2eca2d1fd72c2efa 100644 (file)
--- 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);
 }