From 21223bf6d1c3ff209673c65c26e7934a82c8375d Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 25 Oct 2011 12:19:36 +0100 Subject: [PATCH 1/4] window: Report an error if we cannot load the pointer files --- clients/window.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clients/window.c b/clients/window.c index 57e27b84f..e192ead7b 100644 --- a/clients/window.c +++ b/clients/window.c @@ -671,6 +671,10 @@ create_pointer_surfaces(struct display *display) display_create_surface_from_file(display, pointer_images[i].filename, &rect); + if (!display->pointer_surfaces[i]) { + fprintf(stderr, "Error loading pointer image: %s\n", + pointer_images[i].filename); + } } } From 8bd35c777064dd48aa3e30f8b9b676cd454d45e6 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 25 Oct 2011 12:20:51 +0100 Subject: [PATCH 2/4] window: Avoid setting an invalid surface for the pointer If we failed to load the pointer image to the surface then do not create a buffer from a NULL surface and do not attach that to the device. --- clients/window.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/clients/window.c b/clients/window.c index e192ead7b..d75a0ac8c 100644 --- a/clients/window.c +++ b/clients/window.c @@ -1176,6 +1176,10 @@ set_pointer_image(struct input *input, uint32_t time, int pointer) input->current_pointer_image = pointer; surface = display->pointer_surfaces[pointer]; + + if (!surface) + return; + buffer = display_get_buffer_for_surface(display, surface); wl_input_device_attach(input->input_device, time, buffer, pointer_images[pointer].hotspot_x, From d354711fc70c1b693498528dd0ccca62013b04ec Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 25 Oct 2011 13:38:31 +0100 Subject: [PATCH 3/4] compositor: Don't try and use a NULL sprite for the device pointer If loading the pointer images to the sprites fails then do not try and use those NULL sprites for the pointer. --- compositor/compositor.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/compositor/compositor.c b/compositor/compositor.c index 5690efe46..e0d7b32bc 100644 --- a/compositor/compositor.c +++ b/compositor/compositor.c @@ -1160,6 +1160,9 @@ static void wlsc_input_device_attach_sprite(struct wlsc_input_device *device, struct wlsc_sprite *sprite, int x, int y) { + if (!sprite) + return; + wlsc_sprite_attach(sprite, &device->sprite->surface); wlsc_input_device_attach(device, x, y, sprite->width, sprite->height); } From 1d72447d9bd54b4bb226695c603c447e055299a6 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Tue, 25 Oct 2011 13:43:44 +0100 Subject: [PATCH 4/4] compositor: Report an error if we cannot the load the pointer image files --- compositor/compositor.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/compositor/compositor.c b/compositor/compositor.c index e0d7b32bc..d3908b5ce 100644 --- a/compositor/compositor.c +++ b/compositor/compositor.c @@ -552,6 +552,10 @@ create_pointer_images(struct wlsc_compositor *ec) create_sprite_from_png(ec, pointer_images[i].filename, SPRITE_USE_CURSOR); + if (!ec->pointer_sprites[i]) { + fprintf(stderr, "Error loading pointer image: %s\n", + pointer_images[i].filename); + } } }