]> git.sur5r.net Git - i3/i3/blobdiff - src/handlers.c
Implement Xinerama (workspaces have a specific screen)
[i3/i3] / src / handlers.c
index 6de25e73e21cc8e6f034d4a686a43289ebe02b3c..5aef05e975ab1f5e3d2ac326c10b7db1cfe075a9 100644 (file)
@@ -26,6 +26,7 @@
 #include "font.h"
 #include "xcb.h"
 #include "util.h"
+#include "xinerama.h"
 
 /*
  * Due to bindings like Mode_switch + <a>, we need to bind some keys in XCB_GRAB_MODE_SYNC.
@@ -105,9 +106,16 @@ int handle_enter_notify(void *ignored, xcb_connection_t *conn, xcb_enter_notify_
         if (client == NULL)
                 client = table_get(byChild, event->event);
 
-        /* If not, then this event is not interesting. This should not happen */
+        /* If not, then the user moved his cursor to the root window. In that case, we adjust c_ws */
         if (client == NULL) {
-                printf("DEBUG: Uninteresting enter_notify-event?\n");
+                printf("Getting screen at %d x %d\n", event->root_x, event->root_y);
+                i3Screen *screen = get_screen_containing(event->root_x, event->root_y);
+                if (screen == NULL) {
+                        printf("ERROR: No such screen\n");
+                        return 0;
+                }
+                c_ws = &workspaces[screen->current_workspace];
+                printf("We're now on virtual screen number %d\n", screen->num);
                 return 1;
         }