i3 - improved tiling WM


Rerender on button press only when focus changes

Patch status: merged

Patch by Tony Crisci

Long description:

On button press events, the only change in state that would presently
require rerendering the tree is when the focused window changes.

To apply this patch, use:
curl http://cr.i3wm.org/patch/539/raw.patch | git am

b/src/click.c

15
@@ -171,6 +171,9 @@ static int route_click(Con *con, xcb_button_press_event_t *event, const bool mod
16
     DLOG("--> OUTCOME = %p\n", con);
17
     DLOG("type = %d, name = %s\n", con->type, con->name);
18
 
19
+    /* if focus changes, we must rerender */
20
+    Con *initially_focused = focused;
21
+
22
     /* don’t handle dockarea cons, they must not be focused */
23
     if (con->parent->type == CT_DOCKAREA)
24
         goto done;
25
@@ -297,7 +300,10 @@ static int route_click(Con *con, xcb_button_press_event_t *event, const bool mod
26
 done:
27
     xcb_allow_events(conn, XCB_ALLOW_REPLAY_POINTER, event->time);
28
     xcb_flush(conn);
29
-    tree_render();
30
+
31
+    if (initially_focused != focused)
32
+        tree_render();
33
+
34
     return 0;
35
 }
36