]> git.sur5r.net Git - i3/i3/commitdiff
Merge branch 'master' into next
authorMichael Stapelberg <michael@stapelberg.de>
Sat, 17 Dec 2011 18:48:14 +0000 (18:48 +0000)
committerMichael Stapelberg <michael@stapelberg.de>
Sat, 17 Dec 2011 18:48:14 +0000 (18:48 +0000)
include/x.h
src/resize.c
src/x.c

index 2d41b4373a1586d22b7e360145e4b4577beff182..afc1645cd2044683991502d5bbc541da3bcd7e8b 100644 (file)
@@ -117,4 +117,12 @@ void x_set_i3_atoms();
  */
 void x_set_warp_to(Rect *rect);
 
+/**
+ * Applies the given mask to the event mask of every i3 window decoration X11
+ * window. This is useful to disable EnterNotify while resizing so that focus
+ * is untouched.
+ *
+ */
+void x_mask_event_mask(uint32_t mask);
+
 #endif
index a4e4dfa0b83066dc461f638bce5bf62741ed2354..a1897b6c2349cb3b62e0ff2a187d9b5f4c9f8895 100644 (file)
@@ -58,6 +58,9 @@ int resize_graphical_handler(Con *first, Con *second, orientation_t orientation,
     Con *output = con_get_output(first);
     DLOG("x = %d, width = %d\n", output->rect.x, output->rect.width);
 
+    x_mask_event_mask(~XCB_EVENT_MASK_ENTER_WINDOW);
+    xcb_flush(conn);
+
     uint32_t mask = 0;
     uint32_t values[2];
 
diff --git a/src/x.c b/src/x.c
index 070fae91b1e74097e9caf910099ad7c4302aec41..6c5a11ecaf9cd22fd7e73284fa8d21c769a1f19d 100644 (file)
--- a/src/x.c
+++ b/src/x.c
@@ -939,3 +939,19 @@ void x_set_warp_to(Rect *rect)
 {
     warp_to = rect;
 }
+
+/*
+ * Applies the given mask to the event mask of every i3 window decoration X11
+ * window. This is useful to disable EnterNotify while resizing so that focus
+ * is untouched.
+ *
+ */
+void x_mask_event_mask(uint32_t mask) {
+    uint32_t values[] = { FRAME_EVENT_MASK & mask };
+
+    con_state *state;
+    CIRCLEQ_FOREACH_REVERSE(state, &state_head, state) {
+        if (state->mapped)
+            xcb_change_window_attributes(conn, state->id, XCB_CW_EVENT_MASK, values);
+    }
+}