From: haptix@web.de Date: Thu, 11 Apr 2013 22:09:40 +0000 (+0200) Subject: unhide hidden i3bar when mode is active X-Git-Tag: 4.6~48 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a9aad872ee3933e24e9c6343e1e451f725e94652;p=i3%2Fi3 unhide hidden i3bar when mode is active This patch also handles unhiding of i3bar in case the i3bar modifier key is pressed for activating a new binding mode. --- diff --git a/i3bar/src/xcb.c b/i3bar/src/xcb.c index bfe393b4..7cc955b9 100644 --- a/i3bar/src/xcb.c +++ b/i3bar/src/xcb.c @@ -80,6 +80,9 @@ ev_io *xkb_io; /* The name of current binding mode */ static mode binding; +/* Indicates whether a new binding mode was recently activated */ +bool activated_mode = false; + /* The parsed colors */ struct xcb_colors_t { uint32_t bar_fg; @@ -843,7 +846,7 @@ void xkb_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) { modstate = mods & config.modifier; } -#define DLOGMOD(modmask, status, barfunc) \ +#define DLOGMOD(modmask, status) \ do { \ switch (modmask) { \ case ShiftMask: \ @@ -868,14 +871,17 @@ void xkb_io_cb(struct ev_loop *loop, ev_io *watcher, int revents) { DLOG("Mod5Mask got " #status "!\n"); \ break; \ } \ - barfunc(); \ } while (0) if (modstate != mod_pressed) { if (modstate == 0) { - DLOGMOD(config.modifier, released, hide_bars); + DLOGMOD(config.modifier, released); + if (!activated_mode) + hide_bars(); } else { - DLOGMOD(config.modifier, pressed, unhide_bars); + DLOGMOD(config.modifier, pressed); + activated_mode = false; + unhide_bars(); } mod_pressed = modstate; } @@ -1752,5 +1758,6 @@ void redraw_bars(void) { void set_current_mode(struct mode *current) { I3STRING_FREE(binding.name); binding = *current; + activated_mode = binding.name != NULL; return; }