-
- if ((app->name && !app->class && !strcmp(app->name, self->name))
- || (app->class && !app->name && !strcmp(app->class, self->class))
- || (app->class && app->name && !strcmp(app->class, self->class)
- && !strcmp(app->name, self->name)))
- {
- /* Match if no role was specified in the per app setting, or if the
- * string matches the beginning of the role, since apps like to set
- * the role to things like browser-window-23c4b2f */
- if (!app->role
- || !strncmp(app->role, self->role, strlen(app->role)))
- {
- ob_debug("Window matching: %s\n", app->name);
- /* use this one */
- settings = app;
- break;
- }
- }
+ gboolean match = TRUE;
+
+ g_assert(app->name != NULL || app->class != NULL);
+
+ /* we know that either name or class is not NULL so it will have to
+ match to use the rule */
+ if (app->name &&
+ !g_pattern_match(app->name, strlen(self->name), self->name, NULL))
+ match = FALSE;
+ else if (app->class &&
+ !g_pattern_match(app->class,
+ strlen(self->class), self->class, NULL))
+ match = FALSE;
+ else if (app->role &&
+ !g_pattern_match(app->role,
+ strlen(self->role), self->role, NULL))
+ match = FALSE;
+
+ if (match) {
+ ob_debug("Window matching: %s\n", app->name);
+
+ /* copy the settings to our struct, overriding the existing
+ settings if they are not defaults */
+ config_app_settings_copy_non_defaults(app, settings);
+ }
+ }
+
+ if (settings->shade != -1)
+ self->shaded = !!settings->shade;
+ if (settings->decor != -1)
+ self->undecorated = !settings->decor;
+ if (settings->iconic != -1)
+ self->iconic = !!settings->iconic;
+ if (settings->skip_pager != -1)
+ self->skip_pager = !!settings->skip_pager;
+ if (settings->skip_taskbar != -1)
+ self->skip_taskbar = !!settings->skip_taskbar;
+
+ if (settings->max_vert != -1)
+ self->max_vert = !!settings->max_vert;
+ if (settings->max_horz != -1)
+ self->max_horz = !!settings->max_horz;
+
+ if (settings->fullscreen != -1)
+ self->fullscreen = !!settings->fullscreen;
+
+ if (settings->desktop) {
+ if (settings->desktop == DESKTOP_ALL)
+ self->desktop = settings->desktop;
+ else if (settings->desktop > 0 &&
+ settings->desktop <= screen_num_desktops)
+ self->desktop = settings->desktop - 1;
+ }
+
+ if (settings->layer == -1) {
+ self->below = TRUE;
+ self->above = FALSE;