]> git.sur5r.net Git - i3/i3/blobdiff - src/handlers.c
Automatically call the migration script when the config does not look like v4
[i3/i3] / src / handlers.c
index c63f236c1c8510571d82dd824c257f578ac6fa1f..583b0c5a46443ab45c0be6be14c94a7f64eb0ebc 100644 (file)
@@ -106,7 +106,6 @@ static int handle_key_press(xcb_key_press_event_t *event) {
     }
 
     parse_cmd(bind->command);
-    tree_render();
     return 1;
 }
 
@@ -440,9 +439,10 @@ static int handle_screen_change(xcb_generic_event_t *e) {
  *
  */
 static int handle_unmap_notify_event(xcb_unmap_notify_event_t *event) {
+    // XXX: this is commented out because in src/x.c we disable EnterNotify events
     /* we need to ignore EnterNotify events which will be generated because a
      * different window is visible now */
-    add_ignore_event(event->sequence, XCB_ENTER_NOTIFY);
+    //add_ignore_event(event->sequence, XCB_ENTER_NOTIFY);
 
     DLOG("UnmapNotify for 0x%08x (received from 0x%08x), serial %d\n", event->window, event->event, event->sequence);
     Con *con = con_by_window_id(event->window);
@@ -466,7 +466,7 @@ static int handle_unmap_notify_event(xcb_unmap_notify_event_t *event) {
         return 1;
     }
 
-    tree_close(con, false, false);
+    tree_close(con, DONT_KILL_WINDOW, false);
     tree_render();
     x_push_changes(croot);
     return 1;
@@ -541,7 +541,7 @@ static int handle_windowname_change(void *data, xcb_connection_t *conn, uint8_t
     if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
         return 1;
 
-    window_update_name(con->window, prop);
+    window_update_name(con->window, prop, false);
 
     x_push_changes(croot);
 
@@ -559,7 +559,7 @@ static int handle_windowname_change_legacy(void *data, xcb_connection_t *conn, u
     if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
         return 1;
 
-    window_update_name_legacy(con->window, prop);
+    window_update_name_legacy(con->window, prop, false);
 
     x_push_changes(croot);
 
@@ -576,7 +576,7 @@ static int handle_windowclass_change(void *data, xcb_connection_t *conn, uint8_t
     if ((con = con_by_window_id(window)) == NULL || con->window == NULL)
         return 1;
 
-    window_update_class(con->window, prop);
+    window_update_class(con->window, prop, false);
 
     return 0;
 }
@@ -649,7 +649,7 @@ static int handle_client_message(xcb_client_message_event_t *event) {
              (event->data.data32[0] == _NET_WM_STATE_ADD ||
               event->data.data32[0] == _NET_WM_STATE_TOGGLE))) {
             DLOG("toggling fullscreen\n");
-            con_toggle_fullscreen(con);
+            con_toggle_fullscreen(con, CF_OUTPUT);
         }
 
         tree_render();
@@ -739,6 +739,7 @@ static int handle_normal_hints(void *data, xcb_connection_t *conn, uint8_t state
         con->base_height = base_height;
         DLOG("client's base_height changed to %d\n", base_height);
         DLOG("client's base_width changed to %d\n", base_width);
+        changed = true;
     }
 
     /* If no aspect ratio was set or if it was invalid, we ignore the hints */
@@ -764,15 +765,24 @@ static int handle_normal_hints(void *data, xcb_connection_t *conn, uint8_t state
 
     /* Check if we need to set proportional_* variables using the correct ratio */
     if ((width / height) < min_aspect) {
-        con->proportional_width = width;
-        con->proportional_height = width / min_aspect;
+        if (con->proportional_width != width ||
+            con->proportional_height != (width / min_aspect)) {
+            con->proportional_width = width;
+            con->proportional_height = width / min_aspect;
+            changed = true;
+        }
     } else if ((width / height) > max_aspect) {
-        con->proportional_width = width;
-        con->proportional_height = width / max_aspect;
+        if (con->proportional_width != width ||
+            con->proportional_height != (width / max_aspect)) {
+            con->proportional_width = width;
+            con->proportional_height = width / max_aspect;
+            changed = true;
+        }
     } else goto render_and_return;
 
 render_and_return:
-    tree_render();
+    if (changed)
+        tree_render();
     return 1;
 }