mountoperation: Survive on Wayland

The code was assuming it is dealing with an
X11 display, and trigger assertions. Fix that
to make it work at least as well as it does
on Windows.
This commit is contained in:
Matthias Clasen 2022-10-04 20:15:43 -04:00
parent 9f4baac5a2
commit 55dd442955

View File

@ -543,6 +543,8 @@ _gtk_mount_operation_lookup_context_get (GdkDisplay *display)
context->pid_to_window = g_hash_table_new (g_direct_hash, g_direct_equal);
context->display = display;
if (GDK_IS_X11_DISPLAY (display))
{
mapping = NULL;
mapping_length = 0;
get_window_list (context->display,
@ -569,6 +571,7 @@ _gtk_mount_operation_lookup_context_get (GdkDisplay *display)
GINT_TO_POINTER ((int) mapping[n]));
}
g_free (mapping);
}
return context;
}
@ -1001,6 +1004,9 @@ _gtk_mount_operation_lookup_info (GtkMountOperationLookupContext *context,
g_return_val_if_fail (out_command_line != NULL && *out_command_line == NULL, FALSE);
g_return_val_if_fail (out_texture != NULL && *out_texture == NULL, FALSE);
if (!GDK_IS_X11_DISPLAY (context->display))
return FALSE;
/* We perform two different lookups for name and icon size.. this is
* because we want the name from the window with WINDOWID and this
* normally does not give you an icon