From 8af51d8a1be9c3cb9d89d1d8378de72f42599760 Mon Sep 17 00:00:00 2001 From: Mikael Magnusson Date: Fri, 9 Jun 2006 12:47:48 +0000 Subject: [PATCH] add role matching to per app settings and fix a small memleak in the code that frees the per app list --- openbox/client.c | 4 ++-- openbox/client.h | 1 + openbox/config.c | 8 +++++++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/openbox/client.c b/openbox/client.c index a912acb4..cfcc7da2 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -215,8 +215,8 @@ static ObAppSettings *get_settings(ObClient *client) if (!strcmp(app->name, client->name)) { ob_debug("Window matching: %s\n", app->name); - - return app; + if (!app->role || !strcmp(app->role, client->role)) + return app; } a = a->next; diff --git a/openbox/client.h b/openbox/client.h index e2193e98..ab1c830c 100644 --- a/openbox/client.h +++ b/openbox/client.h @@ -273,6 +273,7 @@ struct _ObClient struct _ObAppSettings { gchar *name; + gchar *role; gboolean decor; gboolean shade; gboolean focus; diff --git a/openbox/config.c b/openbox/config.c index e117de27..5b669685 100644 --- a/openbox/config.c +++ b/openbox/config.c @@ -124,6 +124,8 @@ static void parse_per_app_settings(ObParseInst *i, xmlDocPtr doc, xmlNodePtr n, c; ObAppSettings *settings = g_new0(ObAppSettings, 1); settings->name = name; + if (!parse_attr_string("role", app, &settings->role)) + settings->role = NULL; settings->decor = TRUE; if ((n = parse_find_node("decor", app->children))) @@ -755,7 +757,11 @@ void config_shutdown() g_free(it->data); g_slist_free(config_menu_files); - for (it = config_per_app_settings; it; it = g_slist_next(it)) + for (it = config_per_app_settings; it; it = g_slist_next(it)) { + ObAppSettings *itd = (ObAppSettings *)it->data; + g_free(itd->name); + g_free(itd->role); g_free(it->data); + } g_slist_free(config_per_app_settings); } -- 2.45.2