Bugfix: Use both parts of WM_CLASS (it contains instance and class) (Thanks fallen)

Actually, WM_CLASS contains two null-terminated strings, so we cannot
use asprintf() to get its value but rather use strdup() to get both
of them. Both values are compared when a client is matched against
a wm_class/title combination (for assignments for example).
This commit is contained in:
Michael Stapelberg
2010-02-12 12:12:25 +01:00
parent 9568836e12
commit 0b6b8e8380
4 changed files with 25 additions and 23 deletions

View File

@ -124,7 +124,10 @@ void client_kill(xcb_connection_t *conn, Client *window) {
bool client_matches_class_name(Client *client, char *to_class, char *to_title,
char *to_title_ucs, int to_title_ucs_len) {
/* Check if the given class is part of the window class */
if (client->window_class == NULL || strcasestr(client->window_class, to_class) == NULL)
if ((client->window_class_instance == NULL ||
strcasestr(client->window_class_instance, to_class) == NULL) &&
(client->window_class_class == NULL ||
strcasestr(client->window_class_class, to_class) == NULL))
return false;
/* If no title was given, were done */