]> git.sur5r.net Git - i3/i3/blobdiff - src/window.c
window.c: Reduce code in window_update_* functions
[i3/i3] / src / window.c
index bec4c691cf7d142a945e8a885e0bb4a0b2a969d7..8c3ae8502a937acc378fdad73d505fcc2c547038 100644 (file)
@@ -51,14 +51,10 @@ void window_update_class(i3Window *win, xcb_get_property_reply_t *prop, bool bef
     LOG("WM_CLASS changed to %s (instance), %s (class)\n",
         win->class_instance, win->class_class);
 
-    if (before_mgmt) {
-        free(prop);
-        return;
-    }
-
-    run_assignments(win);
-
     free(prop);
+    if (!before_mgmt) {
+        run_assignments(win);
+    }
 }
 
 /*
@@ -92,14 +88,10 @@ void window_update_name(i3Window *win, xcb_get_property_reply_t *prop, bool befo
 
     win->uses_net_wm_name = true;
 
-    if (before_mgmt) {
-        free(prop);
-        return;
-    }
-
-    run_assignments(win);
-
     free(prop);
+    if (!before_mgmt) {
+        run_assignments(win);
+    }
 }
 
 /*
@@ -141,14 +133,10 @@ void window_update_name_legacy(i3Window *win, xcb_get_property_reply_t *prop, bo
 
     win->name_x_changed = true;
 
-    if (before_mgmt) {
-        free(prop);
-        return;
-    }
-
-    run_assignments(win);
-
     free(prop);
+    if (!before_mgmt) {
+        run_assignments(win);
+    }
 }
 
 /*
@@ -244,14 +232,10 @@ void window_update_role(i3Window *win, xcb_get_property_reply_t *prop, bool befo
     win->role = new_role;
     LOG("WM_WINDOW_ROLE changed to \"%s\"\n", win->role);
 
-    if (before_mgmt) {
-        free(prop);
-        return;
-    }
-
-    run_assignments(win);
-
     free(prop);
+    if (!before_mgmt) {
+        run_assignments(win);
+    }
 }
 
 /*
@@ -439,7 +423,7 @@ void window_update_hints(i3Window *win, xcb_get_property_reply_t *prop, bool *ur
  *
  */
 void window_update_motif_hints(i3Window *win, xcb_get_property_reply_t *prop, border_style_t *motif_border_style) {
-/* This implementation simply mirrors Gnome's Metacity. Official
+    /* This implementation simply mirrors Gnome's Metacity. Official
      * documentation of this hint is nowhere to be found.
      * For more information see:
      * https://people.gnome.org/~tthurman/docs/metacity/xprops_8h-source.html