]> git.sur5r.net Git - i3/i3/commitdiff
Merge pull request #1657 from Georgiy-Tugai/fix-flickering-shortened
authorMichael Stapelberg <stapelberg@users.noreply.github.com>
Sun, 26 Apr 2015 21:38:27 +0000 (23:38 +0200)
committerMichael Stapelberg <stapelberg@users.noreply.github.com>
Sun, 26 Apr 2015 21:38:27 +0000 (23:38 +0200)
i3bar: fix flickering shortened status bar on other output(s)

1  2 
i3bar/src/xcb.c

diff --combined i3bar/src/xcb.c
index a2f1be9a1964e6ef1f66b482fb64dc914f8a0aff,45705c078428d3a09a3fbdbf9cfa7486a6536229..11a017cf386224be3054596692a48ea1eb120b99
@@@ -2,7 -2,7 +2,7 @@@
   * vim:ts=4:sw=4:expandtab
   *
   * i3bar - an xcb-based status- and ws-bar for i3
 - * © 2010-2012 Axel Wagner and contributors (see also: LICENSE)
 + * © 2010 Axel Wagner and contributors (see also: LICENSE)
   *
   * xcb.c: Communicating with X
   *
@@@ -420,7 -420,7 +420,7 @@@ void handle_button(xcb_button_press_eve
          int offset = walk->rect.w - statusline_width - tray_width - logical_px(sb_hoff_px);
  
          x = original_x - offset;
 -        if (x >= 0) {
 +        if (x >= 0 && (size_t)x < statusline_width) {
              struct status_block *block;
              int sep_offset_remainder = 0;
  
@@@ -1792,6 -1792,8 +1792,8 @@@ void reconfig_windows(bool redraw_bars
  void draw_bars(bool unhide) {
      DLOG("Drawing bars...\n");
      int workspace_width = 0;
+     /* Is the currently-rendered statusline using short_text items? */
+     bool rendered_statusline_is_short = false;
  
      refresh_statusline(false);
  
              uint32_t max_statusline_width = outputs_walk->rect.w - workspace_width - tray_width - 2 * logical_px(sb_hoff_px);
  
              /* If the statusline is too long, try to use short texts. */
-             if (statusline_width > max_statusline_width)
+             if (statusline_width > max_statusline_width) {
+                 /* If the currently rendered statusline is long, render a short status line */
                  refresh_statusline(true);
+                 rendered_statusline_is_short = true;
+             } else if (rendered_statusline_is_short) {
+                 /* If the currently rendered statusline is short, render a long status line */
+                 refresh_statusline(false);
+                 rendered_statusline_is_short = false;
+             }
  
              /* Luckily we already prepared a seperate pixmap containing the rendered
               * statusline, we just have to copy the relevant parts to the relevant