mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 07:11:42 +02:00
fixed gtk capturing setting LCL CaptureControl
git-svn-id: trunk@8247 -
This commit is contained in:
parent
466590d235
commit
6d975c970d
@ -2037,6 +2037,7 @@ procedure RecreateWnd(const AWinControl:TWinControl);
|
|||||||
var
|
var
|
||||||
DefaultDockTreeClass: TDockTreeClass;
|
DefaultDockTreeClass: TDockTreeClass;
|
||||||
|
|
||||||
|
procedure SetCaptureControl(AWinControl: TWinControl; const Position: TPoint);
|
||||||
procedure SetCaptureControl(Control: TControl);
|
procedure SetCaptureControl(Control: TControl);
|
||||||
function GetCaptureControl: TControl;
|
function GetCaptureControl: TControl;
|
||||||
procedure CancelDrag;
|
procedure CancelDrag;
|
||||||
@ -2335,6 +2336,19 @@ begin
|
|||||||
then Result := CaptureControl;
|
then Result := CaptureControl;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure SetCaptureControl(AWinControl: TWinControl; const Position: TPoint);
|
||||||
|
var
|
||||||
|
Control: TControl;
|
||||||
|
begin
|
||||||
|
Control:=AWinControl;
|
||||||
|
if (AWinControl<>nil) then begin
|
||||||
|
Control:=AWinControl.ControlAtPos(Position,false,true,false);
|
||||||
|
if Control=nil then
|
||||||
|
Control:=AWinControl;
|
||||||
|
end;
|
||||||
|
SetCaptureControl(Control);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure SetCaptureControl(Control: TControl);
|
procedure SetCaptureControl(Control: TControl);
|
||||||
var
|
var
|
||||||
OldCaptureWinControl: TWinControl;
|
OldCaptureWinControl: TWinControl;
|
||||||
|
@ -1547,8 +1547,8 @@ end;
|
|||||||
procedure TControl.DoMouseDown(var Message: TLMMouse; Button: TMouseButton;
|
procedure TControl.DoMouseDown(var Message: TLMMouse; Button: TMouseButton;
|
||||||
Shift: TShiftState);
|
Shift: TShiftState);
|
||||||
begin
|
begin
|
||||||
if not (csNoStdEvents in ControlStyle) then
|
//DebugLn('TControl.DoMouseDown ',DbgSName(Self),' ');
|
||||||
Begin
|
if not (csNoStdEvents in ControlStyle) then begin
|
||||||
with Message do
|
with Message do
|
||||||
MouseDown(Button, KeysToShiftState(Keys) + Shift, XPos, YPos);
|
MouseDown(Button, KeysToShiftState(Keys) + Shift, XPos, YPos);
|
||||||
end;
|
end;
|
||||||
|
@ -2500,6 +2500,7 @@ begin
|
|||||||
Control := ControlAtPos(SmallPointToPoint(TheMessage.Pos),False,True,False);
|
Control := ControlAtPos(SmallPointToPoint(TheMessage.Pos),False,True,False);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
//DebugLn('TWinControl.IsControlMouseMsg ',DbgSName(Self),' Control=',DbgSName(Control));
|
||||||
Result := False;
|
Result := False;
|
||||||
if Control <> nil then
|
if Control <> nil then
|
||||||
begin
|
begin
|
||||||
|
@ -1132,7 +1132,7 @@ begin
|
|||||||
EventXY:=Point(TruncToInt(Event^.X),TruncToInt(Event^.Y));
|
EventXY:=Point(TruncToInt(Event^.X),TruncToInt(Event^.Y));
|
||||||
ShiftState := GTKEventState2ShiftState(Event^.State);
|
ShiftState := GTKEventState2ShiftState(Event^.State);
|
||||||
MappedXY:=TranslateGdkPointToClientArea(Event^.Window,EventXY,
|
MappedXY:=TranslateGdkPointToClientArea(Event^.Window,EventXY,
|
||||||
PGtkWidget(AWinControl.Handle));
|
PGtkWidget(AWinControl.Handle));
|
||||||
//DebugLn('DeliverMouseDownMessage ',DbgSName(AWinControl),' Mapped=',dbgs(MappedXY.X),',',dbgs(MappedXY.Y),' Event=',dbgs(EventXY.X),',',dbgs(EventXY.Y));
|
//DebugLn('DeliverMouseDownMessage ',DbgSName(AWinControl),' Mapped=',dbgs(MappedXY.X),',',dbgs(MappedXY.Y),' Event=',dbgs(EventXY.X),',',dbgs(EventXY.Y));
|
||||||
|
|
||||||
if event^.Button in [4,5] then begin
|
if event^.Button in [4,5] then begin
|
||||||
@ -1241,6 +1241,8 @@ function gtkMouseBtnPress(widget: PGtkWidget; event: pgdkEventButton;
|
|||||||
var
|
var
|
||||||
DesignOnlySignal: boolean;
|
DesignOnlySignal: boolean;
|
||||||
CaptureWidget: PGtkWidget;
|
CaptureWidget: PGtkWidget;
|
||||||
|
EventXY: TPoint;
|
||||||
|
MappedXY: TPoint;
|
||||||
begin
|
begin
|
||||||
Result := CallBackDefaultReturn;
|
Result := CallBackDefaultReturn;
|
||||||
|
|
||||||
@ -1278,8 +1280,10 @@ begin
|
|||||||
|
|
||||||
CaptureWidget:=PGtkWidget(TWinControl(Data).Handle);
|
CaptureWidget:=PGtkWidget(TWinControl(Data).Handle);
|
||||||
if Event^.button=1 then begin
|
if Event^.button=1 then begin
|
||||||
CaptureMouseForWidget(CaptureWidget,mctGTKIntf);
|
EventXY:=Point(TruncToInt(Event^.X),TruncToInt(Event^.Y));
|
||||||
//Result := not CallBackDefaultReturn;
|
MappedXY:=TranslateGdkPointToClientArea(Event^.Window,EventXY,CaptureWidget);
|
||||||
|
SetCaptureControl(TWinControl(Data),MappedXY);
|
||||||
|
//CaptureMouseForWidget(CaptureWidget,mctGTKIntf);
|
||||||
end;
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
// stop the signal, so that the widget does not auto react
|
// stop the signal, so that the widget does not auto react
|
||||||
|
@ -4474,7 +4474,7 @@ var
|
|||||||
OldMouseCaptureWidget: PGtkWidget;
|
OldMouseCaptureWidget: PGtkWidget;
|
||||||
begin
|
begin
|
||||||
{$IFDEF VerboseMouseCapture}
|
{$IFDEF VerboseMouseCapture}
|
||||||
DebugLn('ReleaseMouseCapture ',ord(MouseCaptureType),' MouseCaptureWidget=[',GetWidgetDebugReport(MouseCaptureWidget),']');
|
DebugLn('ReleaseMouseCapture ',dbgs(ord(MouseCaptureType)),' MouseCaptureWidget=[',GetWidgetDebugReport(MouseCaptureWidget),']');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if MouseCaptureType=mctGTK then exit;
|
if MouseCaptureType=mctGTK then exit;
|
||||||
OldMouseCaptureWidget:=MouseCaptureWidget;
|
OldMouseCaptureWidget:=MouseCaptureWidget;
|
||||||
|
Loading…
Reference in New Issue
Block a user