+ ObClient *action_target = data->client;
+ gboolean is_true = TRUE;
+
+ guint i;
+ for (i = 0; i < o->queries->len; ++i) {
+ Query *q = g_array_index(o->queries, Query*, i);
+ ObClient *query_target = NULL;
+
+ switch (q->target) {
+ case QUERY_TARGET_IS_ACTION_TARGET:
+ query_target = data->client;
+ break;
+ case QUERY_TARGET_IS_FOCUS_TARGET:
+ query_target = focus_client;
+ break;
+ }
+
+ /* If there's no client to query, then false. */
+ is_true &= query_target != NULL;
+
+ if (q->shaded_on)
+ is_true &= query_target->shaded;
+ if (q->shaded_off)
+ is_true &= !query_target->shaded;
+
+ if (q->iconic_on)
+ is_true &= query_target->iconic;
+ if (q->iconic_off)
+ is_true &= !query_target->iconic;
+
+ if (q->maxhorz_on)
+ is_true &= query_target->max_horz;
+ if (q->maxhorz_off)
+ is_true &= !query_target->max_horz;
+
+ if (q->maxvert_on)
+ is_true &= query_target->max_vert;
+ if (q->maxvert_off)
+ is_true &= !query_target->max_vert;
+
+ gboolean is_max_full =
+ query_target->max_vert && query_target->max_horz;
+ if (q->maxfull_on)
+ is_true &= is_max_full;
+ if (q->maxfull_off)
+ is_true &= !is_max_full;
+
+ if (q->focused)
+ is_true &= query_target == focus_client;
+ if (q->unfocused)
+ is_true &= query_target != focus_client;
+
+ gboolean is_urgent =
+ query_target->urgent || query_target->demands_attention;
+ if (q->urgent_on)
+ is_true &= is_urgent;
+ if (q->urgent_off)
+ is_true &= !is_urgent;
+
+ gboolean has_visible_title_bar =
+ !query_target->undecorated &&
+ (query_target->decorations & OB_FRAME_DECOR_TITLEBAR);
+ if (q->decor_on)
+ is_true &= has_visible_title_bar;
+ if (q->decor_off)
+ is_true &= !has_visible_title_bar;
+
+ if (q->omnipresent_on)
+ is_true &= query_target->desktop == DESKTOP_ALL;
+ if (q->omnipresent_off)
+ is_true &= query_target->desktop != DESKTOP_ALL;
+
+ gboolean is_on_current_desktop =
+ query_target->desktop == screen_desktop ||
+ query_target->desktop == DESKTOP_ALL;
+ if (q->desktop_current)
+ is_true &= is_on_current_desktop;
+ if (q->desktop_other)
+ is_true &= !is_on_current_desktop;
+
+ if (q->desktop_number) {
+ gboolean is_on_desktop =
+ query_target->desktop == q->desktop_number - 1 ||
+ query_target->desktop == DESKTOP_ALL;
+ is_true &= is_on_desktop;
+ }
+
+ if (q->screendesktop_number)
+ is_true &= screen_desktop == q->screendesktop_number - 1;
+
+ is_true &= check_typed_match(&q->title, query_target->original_title);
+ is_true &= check_typed_match(&q->class, query_target->class);
+ is_true &= check_typed_match(&q->name, query_target->name);
+ is_true &= check_typed_match(&q->role, query_target->role);
+
+ if (q->client_monitor)
+ is_true &= client_monitor(query_target) == q->client_monitor - 1;
+
+ }
+