mirror of
https://gitlab.freedesktop.org/wayland/wayland.git
synced 2026-03-07 04:34:49 -05:00
Only set pointer image when it changes
This commit is contained in:
parent
acf82a36bb
commit
7d804068b6
1 changed files with 15 additions and 0 deletions
|
|
@ -109,11 +109,17 @@ struct input {
|
||||||
struct wl_input_device *input_device;
|
struct wl_input_device *input_device;
|
||||||
struct window *pointer_focus;
|
struct window *pointer_focus;
|
||||||
struct window *keyboard_focus;
|
struct window *keyboard_focus;
|
||||||
|
uint32_t current_pointer_image;
|
||||||
uint32_t modifiers;
|
uint32_t modifiers;
|
||||||
int32_t x, y, sx, sy;
|
int32_t x, y, sx, sy;
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
POINTER_DEFAULT = 100,
|
||||||
|
POINTER_UNSET
|
||||||
|
};
|
||||||
|
|
||||||
const char *option_xkb_layout = "us";
|
const char *option_xkb_layout = "us";
|
||||||
const char *option_xkb_variant = "";
|
const char *option_xkb_variant = "";
|
||||||
const char *option_xkb_options = "";
|
const char *option_xkb_options = "";
|
||||||
|
|
@ -555,12 +561,20 @@ set_pointer_image(struct input *input, int pointer)
|
||||||
break;
|
break;
|
||||||
case WINDOW_EXTERIOR:
|
case WINDOW_EXTERIOR:
|
||||||
case WINDOW_TITLEBAR:
|
case WINDOW_TITLEBAR:
|
||||||
|
if (input->current_pointer_image == POINTER_DEFAULT)
|
||||||
|
return;
|
||||||
|
|
||||||
wl_input_device_attach(input->input_device, NULL, 0, 0);
|
wl_input_device_attach(input->input_device, NULL, 0, 0);
|
||||||
|
input->current_pointer_image = POINTER_DEFAULT;
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (pointer == input->current_pointer_image)
|
||||||
|
return;
|
||||||
|
|
||||||
|
input->current_pointer_image = pointer;
|
||||||
surface = display->pointer_surfaces[pointer];
|
surface = display->pointer_surfaces[pointer];
|
||||||
buffer = display_get_buffer_for_surface(display, surface);
|
buffer = display_get_buffer_for_surface(display, surface);
|
||||||
wl_input_device_attach(input->input_device, buffer,
|
wl_input_device_attach(input->input_device, buffer,
|
||||||
|
|
@ -692,6 +706,7 @@ window_handle_pointer_focus(void *data,
|
||||||
set_pointer_image(input, pointer);
|
set_pointer_image(input, pointer);
|
||||||
} else {
|
} else {
|
||||||
input->pointer_focus = NULL;
|
input->pointer_focus = NULL;
|
||||||
|
input->current_pointer_image = POINTER_UNSET;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue