From 7d804068b67b8d05db366b1fbb593f65ccbbc4ae Mon Sep 17 00:00:00 2001 From: =?utf8?q?Kristian=20H=C3=B8gsberg?= Date: Tue, 7 Sep 2010 21:50:06 -0400 Subject: [PATCH] Only set pointer image when it changes --- clients/window.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/clients/window.c b/clients/window.c index 0aa319d..9354f18 100644 --- a/clients/window.c +++ b/clients/window.c @@ -109,11 +109,17 @@ struct input { struct wl_input_device *input_device; struct window *pointer_focus; struct window *keyboard_focus; + uint32_t current_pointer_image; uint32_t modifiers; int32_t x, y, sx, sy; struct wl_list link; }; +enum { + POINTER_DEFAULT = 100, + POINTER_UNSET +}; + const char *option_xkb_layout = "us"; const char *option_xkb_variant = ""; const char *option_xkb_options = ""; @@ -555,12 +561,20 @@ set_pointer_image(struct input *input, int pointer) break; case WINDOW_EXTERIOR: case WINDOW_TITLEBAR: + if (input->current_pointer_image == POINTER_DEFAULT) + return; + wl_input_device_attach(input->input_device, NULL, 0, 0); + input->current_pointer_image = POINTER_DEFAULT; return; default: break; } + if (pointer == input->current_pointer_image) + return; + + input->current_pointer_image = pointer; surface = display->pointer_surfaces[pointer]; buffer = display_get_buffer_for_surface(display, surface); wl_input_device_attach(input->input_device, buffer, @@ -692,6 +706,7 @@ window_handle_pointer_focus(void *data, set_pointer_image(input, pointer); } else { input->pointer_focus = NULL; + input->current_pointer_image = POINTER_UNSET; } } -- 2.7.4