summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-07-11 13:59:56 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-07-11 13:59:56 +0000
commit9aa35c9c0a5220af1bdc7493d4caf418664d8af7 (patch)
treea3e68f4cc6b5e354f120a979a1a98e7fb8f00b62 /src
parentba6dd3be462fac8b944ecf436be4f70ce33e5cb8 (diff)
downloadfpGUI-9aa35c9c0a5220af1bdc7493d4caf418664d8af7.tar.xz
Applied mousevents patch from Vladimir.
Diffstat (limited to 'src')
-rw-r--r--src/corelib/gdi/gfx_gdi.pas23
-rw-r--r--src/corelib/x11/gfx_x11.pas3
-rw-r--r--src/gui/gui_splitter.pas3
3 files changed, 16 insertions, 13 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;
diff --git a/src/corelib/x11/gfx_x11.pas b/src/corelib/x11/gfx_x11.pas
index d485762c..c62413f3 100644
--- a/src/corelib/x11/gfx_x11.pas
+++ b/src/corelib/x11/gfx_x11.pas
@@ -1609,7 +1609,8 @@ procedure TfpgWindowImpl.CaptureMouse;
begin
XGrabPointer(xapplication.Display, FWinHandle,
TBool(False),
- ButtonPressMask or ButtonReleaseMask or ButtonMotionMask or PointerMotionMask,
+ ButtonPressMask or ButtonReleaseMask or ButtonMotionMask or PointerMotionMask
+ or EnterWindowMask or LeaveWindowMask,
GrabModeAsync,
GrabModeAsync,
None,
diff --git a/src/gui/gui_splitter.pas b/src/gui/gui_splitter.pas
index 949262b8..ed0b6039 100644
--- a/src/gui/gui_splitter.pas
+++ b/src/gui/gui_splitter.pas
@@ -257,9 +257,6 @@ begin
if Assigned(FControl) then
begin
ReleaseMouse;
- // vvzh: Maybe the following check should be done by ReleaseMouse?
- if not PtInRect(GetClientBounds, Point(x, y)) then
- HandleMouseExit;
// if ResizeStyle in [rsLine, rsPattern] then DrawLine;
UpdateControlSize;
{writeln('LT: ', FControl.Left, ':', FControl.Width, ' ', Self.Left, ':', Self.Width);