fixed gtk capturing setting LCL CaptureControl

git-svn-id: trunk@8247 -
This commit is contained in:
mattias 2005-12-02 12:06:13 +00:00
parent 466590d235
commit 6d975c970d
5 changed files with 25 additions and 6 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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

View File

@ -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

View File

@ -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;