improve pointer events

This commit is contained in:
lixianjing 2022-08-20 16:25:23 +08:00
parent 84a01fcc04
commit a5d9453474
4 changed files with 9 additions and 1 deletions

View File

@ -2,6 +2,7 @@
2022/08/20
* 支持gauge_pointer的默认指针的宽度跟随控件宽度改变而改变(感谢智明提供补丁)
* 统一pointer_event的button的属性值 (感谢智明提供补丁)
2022/08/17
* 完善conf\_xml支持通过@text访问文本内容。

View File

@ -133,6 +133,7 @@ event_t* pointer_event_init(pointer_event_t* event, uint32_t type, void* target,
event->e.size = sizeof(*event);
event->x = x;
event->y = y;
event->button = 1;
return (event_t*)event;
}

View File

@ -787,6 +787,9 @@ typedef struct _pointer_event_t {
* @property {uint8_t} button
* @annotation ["readable", "scriptable"]
* button
*
* PC 1 2 3
* 1
*/
xy_t button;
/**

View File

@ -77,7 +77,7 @@ ret_t main_loop_post_pointer_event(main_loop_t* l, bool_t pressed, xy_t x, xy_t
event.x = x;
event.y = y;
event.button = 0;
event.button = 1;
event.e.time = time_now_ms();
event.e.size = sizeof(pointer_event_t);
@ -165,6 +165,9 @@ static ret_t main_loop_dispatch_events(main_loop_simple_t* loop) {
case EVT_POINTER_DOWN:
case EVT_POINTER_MOVE:
case EVT_POINTER_UP:
if (r.pointer_event.button == 0) {
r.pointer_event.button = 1;
}
window_manager_dispatch_input_event(widget, (event_t*)&(r.pointer_event));
break;
case EVT_WHEEL: