mirror of
https://gitee.com/zlgopen/awtk.git
synced 2024-11-30 02:58:26 +08:00
improve widget_update_pointer_cursor
This commit is contained in:
parent
08a55a347d
commit
878a3333e5
@ -2,6 +2,7 @@
|
||||
|
||||
2024/04/17
|
||||
* 修复fdb文档((感谢朝泽提供补丁)
|
||||
* 修改widget\_update\_pointer\_cursor,增加鼠标位置判断(感谢颖健提供补丁)
|
||||
|
||||
2024/04/15
|
||||
* 增加文档 [如何使用 CMake 构建 AWTK 应用](how_to_use_cmake_to_build_awtk_app.md)
|
||||
|
@ -1325,10 +1325,22 @@ static const char* widget_get_pointer_cursor(widget_t* widget) {
|
||||
}
|
||||
|
||||
ret_t widget_update_pointer_cursor(widget_t* widget) {
|
||||
point_t p = {0, 0};
|
||||
xy_t pointer_x = 0;
|
||||
xy_t pointer_y = 0;
|
||||
widget_t* wm = widget_get_window_manager(widget);
|
||||
return_value_if_fail(wm != NULL, RET_BAD_PARAMS);
|
||||
|
||||
return window_manager_set_cursor(wm, widget_get_pointer_cursor(widget));
|
||||
widget_to_global(widget, &p);
|
||||
pointer_x = window_manager_get_pointer_x(wm);
|
||||
pointer_y = window_manager_get_pointer_y(wm);
|
||||
|
||||
if (pointer_x >= p.x && pointer_x <= (p.x + widget->w) &&
|
||||
pointer_y >= p.y && pointer_y <= (p.y + widget->h)) {
|
||||
return window_manager_set_cursor(wm, widget_get_pointer_cursor(widget));
|
||||
}
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
ret_t widget_dispatch(widget_t* widget, event_t* e) {
|
||||
|
Loading…
Reference in New Issue
Block a user