From 0735fd9e1bf48c30043da4101b15102b78091efa Mon Sep 17 00:00:00 2001 From: "Sergey Semyonov (Serge)" Date: Tue, 28 Feb 2012 08:36:15 +0000 Subject: [PATCH] fn.40: ebx bit 30 - do not send mouse events if cursor outside window git-svn-id: svn://kolibrios.org@2414 a494cfbc-eb01-0410-851d-a64ba20cac60 --- kernel/trunk/const.inc | 3 ++- kernel/trunk/core/memory.inc | 1 + kernel/trunk/docs/sysfuncs.txt | 11 ++++++++--- kernel/trunk/gui/event.inc | 18 +++++++++--------- kernel/trunk/kernel.asm | 28 ++++++++++++++++++++++++++-- 5 files changed, 46 insertions(+), 15 deletions(-) diff --git a/kernel/trunk/const.inc b/kernel/trunk/const.inc index 81395aa27a..dd0ef8b025 100644 --- a/kernel/trunk/const.inc +++ b/kernel/trunk/const.inc @@ -513,6 +513,7 @@ struct display_t move_cursor dd ? restore_cursor dd ? disable_mouse dd ? + mask_seqno dd ? ends struct BOOT_DATA @@ -647,4 +648,4 @@ struct IRQH list LHEAD handler dd ? ;handler roututine data dd ? ;user-specific data -ends \ No newline at end of file +ends diff --git a/kernel/trunk/core/memory.inc b/kernel/trunk/core/memory.inc index 54e57ec1a4..4e9b9603e0 100644 --- a/kernel/trunk/core/memory.inc +++ b/kernel/trunk/core/memory.inc @@ -166,6 +166,7 @@ proc free_page ret endp +align 4 proc map_io_mem stdcall, base:dword, size:dword, flags:dword push ebx diff --git a/kernel/trunk/docs/sysfuncs.txt b/kernel/trunk/docs/sysfuncs.txt index 845ad1791a..e17462ea6a 100644 --- a/kernel/trunk/docs/sysfuncs.txt +++ b/kernel/trunk/docs/sysfuncs.txt @@ -1878,9 +1878,14 @@ Parameters: * eax = 40 - function number * ebx = mask: bit i corresponds to event i+1 (see list of events) (set bit permits notice on event) - bit 31: mouse events filtration - bit 31 = 1 - inactive window do not receive mouse events - bit 31 = 0 - windows always recievs mouse events + bit 31: active/inactive filter + bit 31 = 0 - inactive window receive mouse events + bit 31 = 1 - inactive window does not receive mouse events + bit 30: cursor position filter + bit 30 = 0 = the window receive mouse events if cursor + outside window + bit 30 = 1 - the window does not receive mouse events if cursor + outside window Returned value: * eax = previous value of mask Remarks: diff --git a/kernel/trunk/gui/event.inc b/kernel/trunk/gui/event.inc index 6ce19f90b9..496deddce5 100644 --- a/kernel/trunk/gui/event.inc +++ b/kernel/trunk/gui/event.inc @@ -463,16 +463,16 @@ get_event_for_app: ;; used from f10,f11,f23 ret .FlagAutoReset: ; retvals: BgrRedraw=5, Mouse=6, IPC=7, Stack=8, Debug=9 - cmp eax, 5; Mouse 5+1=6 - jne @f - push eax +; cmp eax, 5; Mouse 5+1=6 +; jne @f +; push eax ; If the window is captured and moved by the user, then no mouse events!!! - mov al, [mouse.active_sys_window.action] - and al, WINDOW_MOVE_AND_RESIZE_FLAGS - test al, al - pop eax - jnz .loop -@@: +; mov al, [mouse.active_sys_window.action] +; and al, WINDOW_MOVE_AND_RESIZE_FLAGS +; test al, al +; pop eax +; jnz .loop +;@@: btr [ebx+APPDATA.event_mask], eax jnc .loop .result: ; retval = eax+1 diff --git a/kernel/trunk/kernel.asm b/kernel/trunk/kernel.asm index 9ad55e0f72..3c6e18b460 100644 --- a/kernel/trunk/kernel.asm +++ b/kernel/trunk/kernel.asm @@ -3086,21 +3086,45 @@ nocpustart: mov ecx, [TASK_COUNT] movzx eax, word [WIN_POS + ecx*2] ; active window shl eax, 8 + push eax + + movzx eax, word [MOUSE_X] + movzx edx, word [MOUSE_Y] align 4 .set_mouse_event: add edi, 256 add ebx, 32 test [ebx+TASKDATA.event_mask], 0x80000000 + jz .pos_filter + + cmp edi, [esp] ; skip if filtration active + jne .skip + +.pos_filter: + test [ebx+TASKDATA.event_mask], 0x40000000 jz .set - cmp eax, edi ; skip if filtration active - jne .skip + mov esi, [ebx-twdw+WDATA.box.left] + cmp eax, esi + jb .skip + add esi, [ebx-twdw+WDATA.box.width] + cmp eax, esi + ja .skip + + mov esi, [ebx-twdw+WDATA.box.top] + cmp edx, esi + jb .skip + add esi, [ebx-twdw+WDATA.box.height] + cmp edx, esi + ja .skip .set: or [edi+SLOT_BASE+APPDATA.event_mask], 100000b .skip: loop .set_mouse_event + pop eax + mouse_not_active: cmp byte[BACKGROUND_CHANGED], 0 jz no_set_bgr_event