mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-28 22:40:56 +02:00
MG: fixed uncapturing of mouse
git-svn-id: trunk@1160 -
This commit is contained in:
parent
9fe5a56c15
commit
1fbe65619e
@ -981,23 +981,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
|
||||||
procedure Uncapturehandle;
|
|
||||||
|
|
||||||
Frees the CaptureHandle
|
|
||||||
------------------------------------------------------------------------------}
|
|
||||||
procedure UncaptureHandle;
|
|
||||||
begin
|
|
||||||
if MCaptureHandle <> 0 then begin
|
|
||||||
{$IfDef VerboseMouseCapture}
|
|
||||||
writeln('UncaptureHandle ',HexStr(Cardinal(MCaptureHandle),8));
|
|
||||||
{$ENDIF}
|
|
||||||
//gdk_pointer_ungrab(0);
|
|
||||||
gtk_grab_remove(pgtkwidget(MCaptureHandle));
|
|
||||||
MCaptureHandle:=0;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Procedure: StoreCommonDialogSetup
|
Procedure: StoreCommonDialogSetup
|
||||||
Params: ADialog: TCommonDialog
|
Params: ADialog: TCommonDialog
|
||||||
@ -1494,59 +1477,18 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure UpdateMouseCaptureControl;
|
procedure UpdateMouseCaptureControl;
|
||||||
var
|
var
|
||||||
OldMouseCaptureHandle,
|
OldMouseCaptureWidget,
|
||||||
CurMouseCaptureHandle: PGtkWidget;
|
CurMouseCaptureWidget: PGtkWidget;
|
||||||
|
|
||||||
procedure NotifyCurCaptureControl;
|
|
||||||
var
|
|
||||||
CurControl: TObject;
|
|
||||||
CaptureChangedMsg: TLMessage;
|
|
||||||
begin
|
|
||||||
if CurMouseCaptureHandle=nil then exit;
|
|
||||||
CurControl:=GetLCLObject(CurMouseCaptureHandle);
|
|
||||||
if CurControl=nil then begin
|
|
||||||
MCaptureHandle:=0;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
with CaptureChangedMsg do begin
|
|
||||||
Msg := Msg;
|
|
||||||
WParam := LM_CAPTURECHANGED;
|
|
||||||
LParam := 0;
|
|
||||||
Result := longint(OldMouseCaptureHandle); // ToDo: 64bit faulty
|
|
||||||
end;
|
|
||||||
{$IFDEF VerboseMouseCapture}
|
|
||||||
writeln('UpdateMouseCaptureControl NotifyCurCaptureControl',
|
|
||||||
' Old=',HexStr(Cardinal(OldMouseCaptureHandle),8),
|
|
||||||
' New=',HexStr(Cardinal(MCaptureHandle),8)
|
|
||||||
);
|
|
||||||
{$ENDIF}
|
|
||||||
DeliverMessage(CurControl,CaptureChangedMsg);
|
|
||||||
end;
|
|
||||||
|
|
||||||
begin
|
begin
|
||||||
OldMouseCaptureHandle:=PGtkWidget(MCaptureHandle);
|
OldMouseCaptureWidget:=MouseCaptureWidget;
|
||||||
CurMouseCaptureHandle:=gtk_grab_get_current;
|
CurMouseCaptureWidget:=gtk_grab_get_current;
|
||||||
if OldMouseCaptureHandle<>CurMouseCaptureHandle then begin
|
|
||||||
// mouse capture widget has changed
|
|
||||||
UncaptureHandle;
|
|
||||||
MCaptureHandle:=integer(CurMouseCaptureHandle); // ToDo: 64bit faulty
|
|
||||||
NotifyCurCaptureControl;
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{-------------------------------------------------------------------------------
|
if OldMouseCaptureWidget<>CurMouseCaptureWidget then begin
|
||||||
procedure CheckMouseCaptureHandle(CurrentInputWidget: PGtkWidget);
|
// notify the new capture control
|
||||||
|
MouseCaptureWidget:=CurMouseCaptureWidget;
|
||||||
Compares CurrentInputWidget with cached capture widget
|
if MouseCaptureWidget<>nil then
|
||||||
and updates if necessary.
|
SendMessage(HWnd(MouseCaptureWidget), LM_CAPTURECHANGED, 0,
|
||||||
-------------------------------------------------------------------------------}
|
HWnd(OldMouseCaptureWidget));
|
||||||
procedure CheckMouseCaptureHandle(CurrentInputWidget: PGtkWidget);
|
|
||||||
begin
|
|
||||||
if (MCaptureHandle <> 0)
|
|
||||||
and (Pointer(MCaptureHandle) <> CurrentInputWidget) then begin
|
|
||||||
// capture differs. => gtk forgot to tell, that the capturing has changed
|
|
||||||
// -> update
|
|
||||||
UpdateMouseCaptureControl;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -3560,6 +3502,9 @@ end;
|
|||||||
{ =============================================================================
|
{ =============================================================================
|
||||||
|
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.129 2002/10/17 21:00:18 lazarus
|
||||||
|
MG: fixed uncapturing of mouse
|
||||||
|
|
||||||
Revision 1.128 2002/10/17 15:09:33 lazarus
|
Revision 1.128 2002/10/17 15:09:33 lazarus
|
||||||
MG: made mouse capturing more strict
|
MG: made mouse capturing more strict
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user