diff options
author | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-07-11 13:59:56 +0000 |
---|---|---|
committer | graemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf> | 2008-07-11 13:59:56 +0000 |
commit | 9aa35c9c0a5220af1bdc7493d4caf418664d8af7 (patch) | |
tree | a3e68f4cc6b5e354f120a979a1a98e7fb8f00b62 /src/corelib/gdi | |
parent | ba6dd3be462fac8b944ecf436be4f70ce33e5cb8 (diff) | |
download | fpGUI-9aa35c9c0a5220af1bdc7493d4caf418664d8af7.tar.xz |
Applied mousevents patch from Vladimir.
Diffstat (limited to 'src/corelib/gdi')
-rw-r--r-- | src/corelib/gdi/gfx_gdi.pas | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/corelib/gdi/gfx_gdi.pas b/src/corelib/gdi/gfx_gdi.pas index e912de95..74bb1b60 100644 --- a/src/corelib/gdi/gfx_gdi.pas +++ b/src/corelib/gdi/gfx_gdi.pas @@ -1056,8 +1056,9 @@ var msgp: TfpgMessageParams; CursorInDifferentWindow: boolean; CurrentWindowHndl: TfpgWinHandle; + MouseCaptureWHndl: TfpgWinHandle; LastWindow: TfpgWindowImpl; - + CurrentWindow: TfpgWindowImpl; begin // vvzh: this method currently cannot receive mouse events when mouse pointer // is outside of the application window. We could try to play with @@ -1071,9 +1072,9 @@ begin // tme.dwFlags := TME_LEAVE or TME_HOVER; // tme.dwHoverTime := 1; // TrackMouseEvent(tme); - - pt.x := LoWord(lParam); - pt.y := HiWord(lParam); + + pt.x := GET_X_LPARAM(lParam); + pt.y := GET_Y_LPARAM(lParam); spt := pt; // only WM_MOUSEWHEEL uses screen coordinates!!! if uMsg = WM_MOUSEWHEEL then @@ -1092,14 +1093,18 @@ begin LastWindow := GetMyWidgetFromHandle(uLastWindowHndl); // check if last window still exits. eg: Dialog window could be closed. if LastWindow <> nil then - begin -// writeln('GFX: MouseExit detected'); fpgSendMessage(nil, LastWindow, FPGM_MOUSEEXIT, msgp); + + // if some window captured mouse input, we should not send mouse events to other windows + MouseCaptureWHndl := GetCapture; + if (MouseCaptureWHndl = 0) or (MouseCaptureWHndl = CurrentWindowHndl) then + begin + CurrentWindow := GetMyWidgetFromHandle(CurrentWindowHndl); + if (CurrentWindow <> nil) then + fpgSendMessage(nil, CurrentWindow, FPGM_MOUSEENTER, msgp); end; -// writeln('GFX: MouseEnter detected'); - fpgSendMessage(nil, AWindow, FPGM_MOUSEENTER, msgp); end; - + uLastWindowHndl := CurrentWindowHndl; end; |