mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-12-01 16:56:34 +01:00
为部件事件添加 screen_x 和 screen_y 属性
This commit is contained in:
@@ -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; /**< 是否取消事件冒泡 */
|
||||
|
||||
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user