From a8da5066f4cbfb1510645388a4e52153becff7d7 Mon Sep 17 00:00:00 2001 From: Liu Chao Date: Sun, 6 Mar 2016 20:34:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E9=83=A8=E4=BB=B6=E4=BA=8B=E4=BB=B6?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=20screen=5Fx=20=E5=92=8C=20screen=5Fy=20?= =?UTF-8?q?=E5=B1=9E=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- include/LCUI/gui/widget_event.h | 3 ++- src/gui/widget_event.c | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) 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 );