[PATCH weston] input: check if the focus surface has a valid resource

Giulio Camuffo giuliocamuffo at gmail.com
Thu Jun 20 09:08:48 PDT 2013


the resource can be NULL in some cases, like when the focus is
taken by the black_surface used in shell.c as fullscreen background.
---
 src/input.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/input.c b/src/input.c
index e670eb6..9f241d5 100644
--- a/src/input.c
+++ b/src/input.c
@@ -1108,7 +1108,12 @@ pointer_set_cursor(struct wl_client *client, struct wl_resource *resource,
 	if (surface_resource)
 		surface = wl_resource_get_user_data(surface_resource);
 
-	if (pointer->focus == NULL)
+    if (pointer->focus == NULL)
+        return;
+    /* pointer->focus->resource can be NULL. Surfaces like the
+       black_surface used in shell.c for fullscreen don't have
+       a resource, but can still have focus */
+	if (pointer->focus->resource == NULL)
 		return;
 	if (wl_resource_get_client(pointer->focus->resource) != client)
 		return;
-- 
1.8.3.1



More information about the wayland-devel mailing list