skip unknown types for netwmtypes (as primary type)

SVN revision: 35197
This commit is contained in:
Carsten Haitzler 2008-07-23 21:54:42 +00:00
parent 6cd1cf0900
commit 8b3b21eaeb
1 changed files with 16 additions and 10 deletions

View File

@ -698,7 +698,7 @@ EAPI void
e_hints_window_type_get(E_Border *bd) e_hints_window_type_get(E_Border *bd)
{ {
Ecore_X_Window_Type *types = NULL; Ecore_X_Window_Type *types = NULL;
int num, i; int num, i, j;
num = ecore_x_netwm_window_types_get(bd->client.win, &types); num = ecore_x_netwm_window_types_get(bd->client.win, &types);
if (bd->client.netwm.extra_types) if (bd->client.netwm.extra_types)
@ -708,21 +708,27 @@ e_hints_window_type_get(E_Border *bd)
bd->client.netwm.extra_types_num = 0; bd->client.netwm.extra_types_num = 0;
} }
if (num == 0) if (num == 0)
{
bd->client.netwm.type = ECORE_X_WINDOW_TYPE_UNKNOWN; bd->client.netwm.type = ECORE_X_WINDOW_TYPE_UNKNOWN;
}
else else
{ {
bd->client.netwm.type = types[0]; j = 0;
if (num > 1) bd->client.netwm.type = types[j];
j++;
while ((j < num) &&
(bd->client.netwm.type == ECORE_X_WINDOW_TYPE_UNKNOWN))
{
j++;
bd->client.netwm.type = types[j];
}
if (num > j)
{ {
bd->client.netwm.extra_types = bd->client.netwm.extra_types =
malloc((num - 1) * sizeof(Ecore_X_Window_Type)); malloc((num - j) * sizeof(Ecore_X_Window_Type));
if (bd->client.netwm.extra_types) if (bd->client.netwm.extra_types)
{ {
for (i = 1; i < num; i++) for (i = j + 1; i < num; i++)
bd->client.netwm.extra_types[i - 1] = types[i]; bd->client.netwm.extra_types[i - (j + 1)] = types[i];
bd->client.netwm.extra_types_num = num - 1; bd->client.netwm.extra_types_num = num - j;
} }
} }
free(types); free(types);