commit fe0a062

Michael Forney  ·  2020-01-28 22:16:25 +0000 UTC
parent 5d81837
xdg_decoration: Set the implementation, even though it is just empty handlers

Otherwise, if a client makes these requests, libwayland-server crashes.
1 files changed,  +16, -0
+16, -0
 1@@ -27,6 +27,21 @@
 2 #include <wayland-server.h>
 3 #include "xdg-decoration-unstable-v1-server-protocol.h"
 4 
 5+static void
 6+set_mode(struct wl_client *client, struct wl_resource *resource, uint32_t mode)
 7+{
 8+}
 9+
10+static void
11+unset_mode(struct wl_client *client, struct wl_resource *resource)
12+{
13+}
14+
15+static const struct zxdg_toplevel_decoration_v1_interface decoration_impl = {
16+	.set_mode = set_mode,
17+	.unset_mode = unset_mode,
18+};
19+
20 static void
21 get_toplevel_decoration(struct wl_client *client, struct wl_resource *resource, uint32_t id, struct wl_resource *toplevel_resource)
22 {
23@@ -37,6 +52,7 @@ get_toplevel_decoration(struct wl_client *client, struct wl_resource *resource,
24 		wl_resource_post_no_memory(resource);
25 		return;
26 	}
27+	wl_resource_set_implementation(decoration, &decoration_impl, NULL, NULL);
28 	zxdg_toplevel_decoration_v1_send_configure(decoration, ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
29 }
30