]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
add role matching to per app settings and fix a small memleak in the code that frees...
[chaz/openbox] / openbox / client.c
index e7af04b85270e97d115683a6c3b1f3bbd71fe338..cfcc7da22c4241e28d31835717509dd907fba3de 100644 (file)
@@ -40,7 +40,6 @@
 #include "keyboard.h"
 #include "mouse.h"
 #include "render/render.h"
-#include "per_app_settings.h"
 
 #include <glib.h>
 #include <X11/Xutil.h>
@@ -205,6 +204,26 @@ void client_manage_all()
     XFree(children);
 }
 
+/* This should possibly do something more interesting than just match
+ * against WM_CLASS literally. */
+static ObAppSettings *get_settings(ObClient *client)
+{
+    GSList *a = config_per_app_settings;
+
+    while (a) {
+        ObAppSettings *app = (ObAppSettings *) a->data;
+        
+        if (!strcmp(app->name, client->name)) {
+            ob_debug("Window matching: %s\n", app->name);
+            if (!app->role || !strcmp(app->role, client->role))
+                return app;
+        }
+
+        a = a->next;
+    }
+    return NULL;
+}
+
 void client_manage(Window window)
 {
     ObClient *self;
@@ -213,7 +232,7 @@ void client_manage(Window window)
     XSetWindowAttributes attrib_set;
     XWMHints *wmhint;
     gboolean activate = FALSE;
-    ObAppSetting *settings;
+    ObAppSettings *settings;
 
     grab_server(TRUE);
 
@@ -295,8 +314,7 @@ void client_manage(Window window)
     client_apply_startup_state(self);
 
     /* get and set application level settings */
-    /* XXX move that function here */
-    settings = (ObAppSetting *) get_client_settings(self);
+    settings = get_settings(self);
 
     if (settings) {
         if (settings->shade && !settings->decor)
@@ -362,11 +380,7 @@ void client_manage(Window window)
         gint x = self->area.x, ox = x;
         gint y = self->area.y, oy = y;
 
-        if (settings)
-            /* XXX put this in place.c */
-            place_window_from_settings(settings, self, &x, &y);
-        else
-            place_client(self, &x, &y);
+        place_client(self, &x, &y, settings);
 
         /* make sure the window is visible. */
         client_find_onscreen(self, &x, &y,
This page took 0.027311 seconds and 4 git commands to generate.