mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2024-11-25 08:32:30 +00:00
output: extract hardware cursor disabling logic
This commit is contained in:
parent
9c50cd71b6
commit
f534434be6
@ -34,6 +34,16 @@ static bool output_set_hardware_cursor(struct wlr_output *output,
|
||||
|
||||
static void output_cursor_damage_whole(struct wlr_output_cursor *cursor);
|
||||
|
||||
static void output_disable_hardware_cursor(struct wlr_output *output) {
|
||||
if (output->hardware_cursor == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
output_set_hardware_cursor(output, NULL, 0, 0);
|
||||
output_cursor_damage_whole(output->hardware_cursor);
|
||||
output->hardware_cursor = NULL;
|
||||
}
|
||||
|
||||
void wlr_output_lock_software_cursors(struct wlr_output *output, bool lock) {
|
||||
if (lock) {
|
||||
++output->software_cursor_locks;
|
||||
@ -45,10 +55,8 @@ void wlr_output_lock_software_cursors(struct wlr_output *output, bool lock) {
|
||||
lock ? "Disabling" : "Enabling", output->name,
|
||||
output->software_cursor_locks);
|
||||
|
||||
if (output->software_cursor_locks > 0 && output->hardware_cursor != NULL) {
|
||||
output_set_hardware_cursor(output, NULL, 0, 0);
|
||||
output_cursor_damage_whole(output->hardware_cursor);
|
||||
output->hardware_cursor = NULL;
|
||||
if (output->software_cursor_locks > 0) {
|
||||
output_disable_hardware_cursor(output);
|
||||
}
|
||||
|
||||
// If it's possible to use hardware cursors again, don't switch immediately
|
||||
@ -441,8 +449,7 @@ void wlr_output_cursor_destroy(struct wlr_output_cursor *cursor) {
|
||||
output_cursor_reset(cursor);
|
||||
if (cursor->output->hardware_cursor == cursor) {
|
||||
// If this cursor was the hardware cursor, disable it
|
||||
output_set_hardware_cursor(cursor->output, NULL, 0, 0);
|
||||
cursor->output->hardware_cursor = NULL;
|
||||
output_disable_hardware_cursor(cursor->output);
|
||||
}
|
||||
wl_list_remove(&cursor->renderer_destroy.link);
|
||||
if (cursor->own_texture) {
|
||||
|
Loading…
Reference in New Issue
Block a user