diff --git a/include/LCUI/gui/widget_event.h b/include/LCUI/gui/widget_event.h index 1eed8c07..3b3438ec 100644 --- a/include/LCUI/gui/widget_event.h +++ b/include/LCUI/gui/widget_event.h @@ -74,7 +74,8 @@ typedef struct LCUI_WidgetEvent { int type; /**< 事件类型标识号 */ const char *type_name; /**< 事件类型名称 */ int which; /**< 指示按了哪个键或按钮 */ - int x, y; /**< 鼠标的坐标(相对于当前部件的边框盒) */ + int x, y; /**< 事件触发时鼠标的坐标(相对于当前部件的边框盒) */ + int screen_x, screen_y; /**< 事件触发时鼠标的屏幕坐标 */ void *data; /**< 附加数据 */ LCUI_Widget target; /**< 触发事件的部件 */ LCUI_BOOL cancel_bubble; /**< 是否取消事件冒泡 */ diff --git a/src/gui/widget_event.c b/src/gui/widget_event.c index 05391410..ad1d11dc 100644 --- a/src/gui/widget_event.c +++ b/src/gui/widget_event.c @@ -348,6 +348,8 @@ static void OnMouseEvent( LCUI_SystemEvent *e, void *arg ) ebuff.cancel_bubble = FALSE; ebuff.x = pos.x - ebuff.x; ebuff.y = pos.y - ebuff.y; + ebuff.screen_x = pos.x; + ebuff.screen_y = pos.y; ebuff.target = target; ebuff.which = 0; switch( e->type ) { @@ -361,10 +363,9 @@ static void OnMouseEvent( LCUI_SystemEvent *e, void *arg ) ebuff.type = WET_MOUSEUP; ebuff.type_name = "mouseup"; Widget_PostEvent( target, &ebuff, NULL ); - _DEBUG_MSG( "target: %s, prev: %s\n", target->type, + DEBUG_MSG( "target: %s, prev: %s\n", target->type, self.targets[WST_ACTIVE] ? self.targets[WST_ACTIVE]->type :"null" ); if( self.targets[WST_ACTIVE] == target ) { - _DEBUG_MSG("post click event\n"); ebuff.type = WET_CLICK; ebuff.type_name = "click"; Widget_PostEvent( target, &ebuff, NULL );