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 15:56:19 +01:00
parent f399c3ef9d
commit 3d13d53ae7
4 changed files with 25 additions and 23 deletions

View File

@ -122,7 +122,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 */