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)
{
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)
{
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;
}
/* 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;
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;
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);