shell: Handle wl_shell surfaces created by xwayland correctly
When xwayland creates a shell surface we don't have a resource. The recently added shell_surface_is_wl_shell/xdg_surface() tests don't handle that very well. For now, we assume that a surface without a resource is created from xwayland and is a wl_shell surface. We'll want to modify that to be a xdg surface eventually, but for now this stops weston from crashing.
This commit is contained in:
+11
-6
@@ -3138,9 +3138,13 @@ shell_get_shell_surface(struct wl_client *client,
|
|||||||
static bool
|
static bool
|
||||||
shell_surface_is_wl_shell_surface(struct shell_surface *shsurf)
|
shell_surface_is_wl_shell_surface(struct shell_surface *shsurf)
|
||||||
{
|
{
|
||||||
return wl_resource_instance_of(shsurf->resource,
|
/* A shell surface without a resource is created from xwayland
|
||||||
&wl_shell_surface_interface,
|
* and is considered a wl_shell surface for now. */
|
||||||
&shell_surface_implementation);
|
|
||||||
|
return shsurf->resource == NULL ||
|
||||||
|
wl_resource_instance_of(shsurf->resource,
|
||||||
|
&wl_shell_surface_interface,
|
||||||
|
&shell_surface_implementation);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct wl_shell_interface shell_implementation = {
|
static const struct wl_shell_interface shell_implementation = {
|
||||||
@@ -3395,9 +3399,10 @@ xdg_get_xdg_surface(struct wl_client *client,
|
|||||||
static bool
|
static bool
|
||||||
shell_surface_is_xdg_surface(struct shell_surface *shsurf)
|
shell_surface_is_xdg_surface(struct shell_surface *shsurf)
|
||||||
{
|
{
|
||||||
return wl_resource_instance_of(shsurf->resource,
|
return shsurf->resource &&
|
||||||
&xdg_surface_interface,
|
wl_resource_instance_of(shsurf->resource,
|
||||||
&xdg_surface_implementation);
|
&xdg_surface_interface,
|
||||||
|
&xdg_surface_implementation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* xdg-popup implementation */
|
/* xdg-popup implementation */
|
||||||
|
|||||||
Reference in New Issue
Block a user