]> git.sur5r.net Git - i3/i3/blobdiff - src/handlers.c
Merge branch 'master' into next
[i3/i3] / src / handlers.c
index a69a62690fc40ba804abd0d4a63e342ee777dedf..4f2d870eb00a9e3ee84503a1f9e6bd0178307e45 100644 (file)
@@ -325,9 +325,21 @@ static void handle_configure_request(xcb_configure_request_event_t *event) {
     }
 
     DLOG("Configure request!\n");
-    if (con_is_floating(con) && con_is_leaf(con)) {
+
+    Con *workspace = con_get_workspace(con),
+        *fullscreen = NULL;
+
+    /* There might not be a corresponding workspace for dock cons, therefore we
+     * have to be careful here. */
+    if (workspace) {
+        fullscreen = con_get_fullscreen_con(workspace, CF_OUTPUT);
+        if (!fullscreen)
+            fullscreen = con_get_fullscreen_con(workspace, CF_GLOBAL);
+    }
+
+    if (fullscreen != con && con_is_floating(con) && con_is_leaf(con)) {
         /* find the height for the decorations */
-        int deco_height = config.font.height + 5;
+        int deco_height = con->deco_rect.height;
         /* we actually need to apply the size/position changes to the *parent*
          * container */
         Rect bsr = con_border_style_rect(con);
@@ -337,6 +349,11 @@ static void handle_configure_request(xcb_configure_request_event_t *event) {
         }
         Con *floatingcon = con->parent;
 
+        if (strcmp(con_get_workspace(floatingcon)->name, "__i3_scratch") == 0) {
+            DLOG("This is a scratchpad container, ignoring ConfigureRequest\n");
+            return;
+        }
+
         Rect newrect = floatingcon->rect;
 
         if (event->value_mask & XCB_CONFIG_WINDOW_X) {
@@ -635,6 +652,15 @@ static void handle_client_message(xcb_client_message_event_t *event) {
             return;
         }
 
+        Con *ws = con_get_workspace(con);
+        if (!workspace_is_visible(ws)) {
+            DLOG("Workspace not visible, ignoring _NET_ACTIVE_WINDOW\n");
+            return;
+        }
+
+        if (ws != con_get_workspace(focused))
+            workspace_show(ws);
+
         con_focus(con);
         tree_render();
     } else if (event->type == A_I3_SYNC) {
@@ -815,7 +841,13 @@ static bool handle_hints(void *data, xcb_connection_t *conn, uint8_t state, xcb_
     }
 
     /* Update the flag on the client directly */
-    con->urgent = (xcb_icccm_wm_hints_get_urgency(&hints) != 0);
+    bool hint_urgent = (xcb_icccm_wm_hints_get_urgency(&hints) != 0);
+
+    if (con->urgency_timer == NULL) {
+        con->urgent = hint_urgent;
+    } else
+        DLOG("Discarding urgency WM_HINT because timer is running\n");
+
     //CLIENT_LOG(con);
     if (con->window) {
         if (con->urgent) {
@@ -825,6 +857,9 @@ static bool handle_hints(void *data, xcb_connection_t *conn, uint8_t state, xcb_
             con->window->urgent.tv_usec = 0;
         }
     }
+
+    con_update_parents_urgency(con);
+
     LOG("Urgency flag changed to %d\n", con->urgent);
 
     Con *ws;
@@ -1024,6 +1059,7 @@ void handle_event(int type, xcb_generic_event_t *event) {
 
     switch (type) {
         case XCB_KEY_PRESS:
+        case XCB_KEY_RELEASE:
             handle_key_press((xcb_key_press_event_t*)event);
             break;