Commit 8c0d27e0 authored by Vlad Zahorodnii's avatar Vlad Zahorodnii
Browse files

Post an error if the client attempts to create input panel surface for surface...

Post an error if the client attempts to create input panel surface for surface that already has role

If a client attempts to create an input panel surface for a wl_surface
that already has a role assigned, we must post a protocol error or else
the behavior of the input panel surface will be undefined.

Posting an error of 0 is not really correct, but on the other hand the
spec has no any error enums.
parent 9b432a51
......@@ -243,6 +243,13 @@ public:
void zwp_input_panel_v1_get_input_panel_surface(Resource *resource, uint32_t id, struct ::wl_resource *surfaceResource) override
{
auto surface = SurfaceInterface::get(surfaceResource);
SurfaceRole *surfaceRole = SurfaceRole::get(surface);
if (surfaceRole) {
wl_resource_post_error(resource->handle, 0, "the surface already has a role assigned");
return;
}
auto interface = new InputPanelSurfaceV1Interface(surface, id, nullptr);
interface->d->init(resource->client(), id, resource->version());
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment