]> git.sur5r.net Git - i3/i3/blobdiff - src/handlers.c
Revert "Bugfix: Ignore enter_notify when warping pointer (makes "goto" work correctly)"
[i3/i3] / src / handlers.c
index b5c1cf1b30e08a4905c1bd90c4f801bf8bb19cb9..624c34305d5bd78caa9bcdbe89ab6291ad0e5095 100644 (file)
@@ -447,6 +447,8 @@ int handle_screen_change(void *prophs, xcb_connection_t *conn,
 
         randr_query_outputs(conn);
 
+        ipc_send_event("output", I3_IPC_EVENT_OUTPUT, "{\"change\":\"unspecified\"}");
+
         return 1;
 }
 
@@ -529,17 +531,12 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_noti
 
         /* Let’s see how many clients there are left on the workspace to delete it if it’s empty */
         bool workspace_empty = SLIST_EMPTY(&(client->workspace->focus_stack));
-        bool workspace_active = false;
+        bool workspace_focused = (c_ws == client->workspace);
         Client *to_focus = (!workspace_empty ? SLIST_FIRST(&(client->workspace->focus_stack)) : NULL);
 
-        /* If this workspace is currently active, we don’t delete it */
-        Output *screen;
-        TAILQ_FOREACH(screen, &outputs, outputs)
-                if (screen->current_workspace == client->workspace) {
-                        workspace_active = true;
-                        workspace_empty = false;
-                        break;
-                }
+        /* If this workspace is currently visible, we don’t delete it */
+        if (workspace_is_visible(client->workspace))
+                workspace_empty = false;
 
         if (workspace_empty) {
                 client->workspace->output = NULL;
@@ -561,7 +558,7 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_noti
          * the screen itself (if we do not focus the screen, it can happen that
          * the focus is "nowhere" and thus keypress events will not be received
          * by i3, thus the user cannot use any hotkeys). */
-        if (workspace_active) {
+        if (workspace_focused) {
                 if (to_focus != NULL)
                         set_focus(conn, to_focus, true);
                 else {
@@ -574,6 +571,26 @@ int handle_unmap_notify_event(void *data, xcb_connection_t *conn, xcb_unmap_noti
         return 1;
 }
 
+/*
+ * A destroy notify event is sent when the window is not unmapped, but
+ * immediately destroyed (for example when starting a window and immediately
+ * killing the program which started it).
+ *
+ * We just pass on the event to the unmap notify handler (by copying the
+ * important fields in the event data structure).
+ *
+ */
+int handle_destroy_notify_event(void *data, xcb_connection_t *conn, xcb_destroy_notify_event_t *event) {
+        DLOG("destroy notify for 0x%08x, 0x%08x\n", event->event, event->window);
+
+        xcb_unmap_notify_event_t unmap;
+        unmap.sequence = event->sequence;
+        unmap.event = event->event;
+        unmap.window = event->window;
+
+        return handle_unmap_notify_event(NULL, conn, &unmap);
+}
+
 /*
  * Called when a window changes its title
  *