]> git.sur5r.net Git - i3/i3/blobdiff - src/handlers.c
Implement RandR 1.5 support (#2580)
[i3/i3] / src / handlers.c
index 7dfacef78f5b56a6c17e5481dbc81a5e6f117956..5e589e9c91b51697d8e8c347dbebf9daf6c54217 100644 (file)
@@ -1150,6 +1150,21 @@ static void handle_focus_in(xcb_focus_in_event_t *event) {
     return;
 }
 
+/*
+ * Handles ConfigureNotify events for the root window, which are generated when
+ * the monitor configuration changed.
+ *
+ */
+static void handle_configure_notify(xcb_configure_notify_event_t *event) {
+    if (event->event != root) {
+        DLOG("ConfigureNotify for non-root window 0x%08x, ignoring\n", event->event);
+        return;
+    }
+    DLOG("ConfigureNotify for root window 0x%08x\n", event->event);
+
+    randr_query_outputs();
+}
+
 /*
  * Handles the WM_CLASS property for assignments and criteria selection.
  *
@@ -1476,6 +1491,10 @@ void handle_event(int type, xcb_generic_event_t *event) {
             break;
         }
 
+        case XCB_CONFIGURE_NOTIFY:
+            handle_configure_notify((xcb_configure_notify_event_t *)event);
+            break;
+
         default:
             //DLOG("Unhandled event of type %d\n", type);
             break;