mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-11-02 09:01:38 -05:00
output: extract hardware cursor disabling logic
(cherry picked from commit f534434be6)
This commit is contained in:
parent
a1b3be49c5
commit
13a2020334
1 changed files with 13 additions and 6 deletions
|
|
@ -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
|
||||
|
|
@ -512,8 +520,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);
|
||||
}
|
||||
if (cursor->own_texture) {
|
||||
wlr_texture_destroy(cursor->texture);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue