X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fopenbox;a=blobdiff_plain;f=openbox%2Factions%2Fif.c;h=a083d4853b23d0747d80dac20fe64590590e9d7a;hp=3d9f0e7f89e66e683dbf665909a4deea18f2b027;hb=0a7ff45e4930a72968911325a019f0ea64b62a43;hpb=1d1fe5e6cc7afd8db05be7d4938ca87ba621dc94 diff --git a/openbox/actions/if.c b/openbox/actions/if.c index 3d9f0e7f..a083d485 100644 --- a/openbox/actions/if.c +++ b/openbox/actions/if.c @@ -75,6 +75,7 @@ typedef struct { TypedMatch class; TypedMatch name; TypedMatch role; + TypedMatch type; } Query; typedef struct { @@ -153,7 +154,7 @@ static void free_typed_match(TypedMatch *tm) } } -static gboolean check_typed_match(TypedMatch *tm, gchar *s) +static gboolean check_typed_match(TypedMatch *tm, const gchar *s) { switch (tm->type) { case MATCH_TYPE_PATTERN: @@ -212,6 +213,9 @@ static void setup_query(Options* o, xmlNodePtr node, QueryTarget target) { if ((n = obt_xml_find_node(node, "role"))) { setup_typed_match(&q->role, n); } + if ((n = obt_xml_find_node(node, "type"))) { + setup_typed_match(&q->type, n); + } if ((n = obt_xml_find_node(node, "monitor"))) { q->client_monitor = obt_xml_node_int(n); } @@ -283,6 +287,7 @@ static void free_func(gpointer options) free_typed_match(&q->class); free_typed_match(&q->name); free_typed_match(&q->role); + free_typed_match(&q->type); g_slice_free(Query, q); } @@ -398,6 +403,8 @@ static gboolean run_func_if(ObActionsData *data, gpointer options) 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); + is_true &= check_typed_match(&q->type, + client_type_to_string(query_target)); if (q->client_monitor) is_true &= client_monitor(query_target) == q->client_monitor - 1;