From 9ae4e45e9414549c2efb9797f3fdf82b7eca9228 Mon Sep 17 00:00:00 2001 From: Changyeon Lee Date: Mon, 16 Sep 2019 18:25:40 +0900 Subject: [PATCH] e_hwc_window: compare cursor buffer instead image pointer Change-Id: I862e3422443d646db0a2fc94d0124b5725ec9b2e --- src/bin/e_hwc_window.c | 35 +++++++++++++++++++++++++++++++---- src/bin/e_hwc_window.h | 2 ++ 2 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/bin/e_hwc_window.c b/src/bin/e_hwc_window.c index 951b8d9..83aa0a7 100644 --- a/src/bin/e_hwc_window.c +++ b/src/bin/e_hwc_window.c @@ -457,6 +457,22 @@ _e_hwc_window_client_surface_acquire(E_Hwc_Window *hwc_window) return tsurface; } +static void +_e_hwc_window_cb_cursor_buffer_destroy(struct wl_listener *listener, void *data) +{ + E_Hwc_Window *hwc_window = NULL; + + hwc_window = container_of(listener, E_Hwc_Window, cursor_buffer_destroy_listener); + EINA_SAFETY_ON_NULL_RETURN(hwc_window); + + if ((E_Comp_Wl_Buffer *)data != hwc_window->cursor.buffer) return; + + if (hwc_window->cursor.buffer) + wl_list_remove(&hwc_window->cursor_buffer_destroy_listener.link); + + hwc_window->cursor.buffer = NULL; +} + static Eina_Bool _e_hwc_window_cursor_image_update(E_Hwc_Window *hwc_window) { @@ -468,10 +484,8 @@ _e_hwc_window_cursor_image_update(E_Hwc_Window *hwc_window) tdm_error error; pointer = e_pointer_get(ec); - if (!pointer) return EINA_FALSE; - buffer = _e_hwc_window_comp_wl_buffer_get(hwc_window); - if (!buffer) + if (!buffer || !pointer) { if (hwc_window->cursor.img_ptr) { @@ -482,6 +496,10 @@ _e_hwc_window_cursor_image_update(E_Hwc_Window *hwc_window) return EINA_FALSE; } + if (hwc_window->cursor.buffer) + wl_list_remove(&hwc_window->cursor_buffer_destroy_listener.link); + + hwc_window->cursor.buffer = NULL; hwc_window->cursor.rotation = 0; hwc_window->cursor.img_ptr = NULL; hwc_window->cursor.img_w = 0; @@ -514,7 +532,7 @@ _e_hwc_window_cursor_image_update(E_Hwc_Window *hwc_window) } /* no changes, no need to update the cursor image */ - if ((hwc_window->cursor.img_ptr == img_ptr) && + if ((hwc_window->cursor.buffer == buffer) && (hwc_window->cursor.rotation == pointer->rotation)) return EINA_FALSE; @@ -525,6 +543,12 @@ _e_hwc_window_cursor_image_update(E_Hwc_Window *hwc_window) return EINA_FALSE; } + if (hwc_window->cursor.buffer) + wl_list_remove(&hwc_window->cursor_buffer_destroy_listener.link); + + hwc_window->cursor.buffer = buffer; + wl_signal_add(&buffer->destroy_signal, &hwc_window->cursor_buffer_destroy_listener); + hwc_window->cursor_buffer_destroy_listener.notify = _e_hwc_window_cb_cursor_buffer_destroy; hwc_window->cursor.rotation = pointer->rotation; hwc_window->cursor.img_ptr = img_ptr; hwc_window->cursor.img_w = img_w; @@ -629,6 +653,9 @@ _e_hwc_window_free(E_Hwc_Window *hwc_window) EHWINF("Free", NULL, hwc_window->hwc, hwc_window); done: + if (hwc_window->cursor.buffer) + wl_list_remove(&hwc_window->cursor_buffer_destroy_listener.link); + if (hwc_window->queue) wl_list_remove(&hwc_window->queue_destroy_listener.link); diff --git a/src/bin/e_hwc_window.h b/src/bin/e_hwc_window.h index ba87f04..496d422 100644 --- a/src/bin/e_hwc_window.h +++ b/src/bin/e_hwc_window.h @@ -112,11 +112,13 @@ struct _E_Hwc_Window struct { int rotation; + E_Comp_Wl_Buffer *buffer; void *img_ptr; int img_w; int img_h; int img_stride; } cursor; + struct wl_listener cursor_buffer_destroy_listener; struct { -- 2.7.4