diff --git a/lcl/interfaces/gtk2/gtk2callback.inc b/lcl/interfaces/gtk2/gtk2callback.inc index f3ca7be97f..998bdc2ffc 100644 --- a/lcl/interfaces/gtk2/gtk2callback.inc +++ b/lcl/interfaces/gtk2/gtk2callback.inc @@ -714,7 +714,6 @@ begin if (Widget=nil) or (Event=nil) then ; ResetDefaultIMContext; - UpdateMouseCaptureControl; FillChar(Mess{%H-},SizeOf(Mess),#0); {$IFDEF VerboseFocus} @@ -791,7 +790,6 @@ begin DebugLn(' LCLObject=nil'); {$ENDIF} ResetDefaultIMContext; - UpdateMouseCaptureControl; Info := GetWidgetInfo(Widget,false); try @@ -962,7 +960,6 @@ begin end; ResetDefaultIMContext; - UpdateMouseCaptureControl; //TODO: fill in old focus FillChar(Mess{%H-}, SizeOf(Mess), 0); @@ -1069,7 +1066,6 @@ begin {$ENDIF} ResetDefaultIMContext; - UpdateMouseCaptureControl; FillChar(Mess{%H-},SizeOf(Mess),0); Mess.msg := LM_KILLFOCUS; @@ -1445,8 +1441,6 @@ begin ); {$ENDIF} - UpdateMouseCaptureControl; - ShiftState := GTKEventStateToShiftState(Event^.State); if (ShiftState*[ssShift, ssCtrl, ssAlt, ssSuper] <> LastModifierKeys) or NeedShiftUpdateAfternFocus @@ -1518,8 +1512,6 @@ begin // stop the signal, so that it is not sent to the parent widgets g_signal_stop_emission_by_name(PGTKObject(Widget),'motion-notify-event'); - UpdateMouseCaptureControl; - if (csDesigning in TComponent(Data).ComponentState) then exit; if ControlGetsMouseMoveBefore(TControl(Data), True, Event) then exit; @@ -1782,7 +1774,6 @@ begin {$ENDIF} ResetDefaultIMContext; - UpdateMouseCaptureControl; //debugln('[gtkMouseBtnPress] calling DeliverMouseDownMessage Result=',dbgs(Result)); {$IFDEF Gtk2CallMouseDownBeforeContext} @@ -2108,7 +2099,6 @@ begin {$ENDIF} ResetDefaultIMContext; - UpdateMouseCaptureControl; // stop the signal, so that it is not sent to the parent widgets g_signal_stop_emission_by_name(PGTKObject(Widget), 'button-press-event'); @@ -2242,7 +2232,6 @@ begin //' GDK_BUTTON_RELEASE_MASK=',DbgS(GDK_BUTTON_RELEASE_MASK)); ResetDefaultIMContext; - UpdateMouseCaptureControl; if not (csDesigning in TComponent(Data).ComponentState) then begin @@ -2301,7 +2290,6 @@ begin g_signal_stop_emission_by_name(PGTKObject(Widget),'button-release-event'); ResetDefaultIMContext; - UpdateMouseCaptureControl; if (csDesigning in TComponent(Data).ComponentState) then exit; if ControlGetsMouseUpBefore(TControl(Data)) then exit; diff --git a/lcl/interfaces/gtk2/gtk2proc.inc b/lcl/interfaces/gtk2/gtk2proc.inc index a54514a0fc..2a15682533 100644 --- a/lcl/interfaces/gtk2/gtk2proc.inc +++ b/lcl/interfaces/gtk2/gtk2proc.inc @@ -4566,46 +4566,6 @@ begin end; end; -{------------------------------------------------------------------------------ - Function: UpdateMouseCaptureControl - Params: none - Returns: none - - Sets MouseCaptureWidget to the current capturing widget. - ------------------------------------------------------------------------------} -procedure UpdateMouseCaptureControl; -var - OldMouseCaptureWidget, - CurMouseCaptureWidget: PGtkWidget; -begin - {$IFNDEF GTK2_USE_OLD_CAPTURE} - exit; - {$ENDIF} - OldMouseCaptureWidget:=MouseCaptureWidget; - CurMouseCaptureWidget:=gtk_grab_get_current; - - if OldMouseCaptureWidget<>CurMouseCaptureWidget then begin - // the mouse grab changed - // -> this means the gtk itself has changed the mouse grab - {$IFDEF VerboseMouseCapture} - DebugLn('UpdateMouseCaptureControl Capture changed from ', - '[',GetWidgetDebugReport(OldMouseCaptureWidget),' type=',MouseCaptureTypeNames[MouseCaptureType],']', - ' to [',GetWidgetDebugReport(CurMouseCaptureWidget),' type=GTK]'); - if CurMouseCaptureWidget<>nil then - DebugLn('parent ', GetWidgetDebugReport(CurMouseCaptureWidget^.Parent)); - {$ENDIF} - - // notify the new capture control - MouseCaptureWidget:=CurMouseCaptureWidget; - MouseCaptureType:=mctGTK; - if MouseCaptureWidget<>nil then begin - // the MouseCaptureWidget is probably not a main widget - SendMessage(HWnd({%H-}PtrUInt(MouseCaptureWidget)), LM_CAPTURECHANGED, 0, - HWnd({%H-}PtrUInt(OldMouseCaptureWidget))); - end; - end; -end; - procedure IncreaseMouseCaptureIndex; begin if MouseCaptureIndex<$ffffffff then @@ -4614,49 +4574,6 @@ begin MouseCaptureIndex:=0; end; -{$IFDEF GTK2_USE_OLD_CAPTURE} -procedure CaptureMouseForWidget(Widget: PGtkWidget; Owner: TMouseCaptureType); -var - CaptureWidget: PGtkWidget; - NowIndex: Cardinal; -begin - {$IFDEF VerboseMouseCapture} - DebugLn('CaptureMouseForWidget START ',GetWidgetDebugReport(Widget)); - {$ENDIF} - if not (Owner in [mctGTKIntf,mctLCL]) then exit; - // not every widget can capture the mouse - CaptureWidget := GetDefaultMouseCaptureWidget(Widget); - if CaptureWidget=nil then exit; - - UpdateMouseCaptureControl; - if (MouseCaptureType<>mctGTK) then begin - // we are capturing - if (MouseCaptureWidget=CaptureWidget) then begin - // we are already capturing this widget - exit; - end; - // release old capture - ReleaseMouseCapture; - end; - - {$IFDEF VerboseMouseCapture} - DebugLn('CaptureMouseForWidget Start Capturing for ',GetWidgetDebugReport(CaptureWidget)); - {$ENDIF} - IncreaseMouseCaptureIndex; - NowIndex:=MouseCaptureIndex; - if not gtk_widget_has_focus(CaptureWidget) then - gtk_widget_grab_focus(CaptureWidget); - if NowIndex=MouseCaptureIndex then begin - {$IFDEF VerboseMouseCapture} - DebugLn('CaptureMouseForWidget Commit Capturing for ',GetWidgetDebugReport(CaptureWidget)); - {$ENDIF} - MouseCaptureWidget:=CaptureWidget; - MouseCaptureType:=Owner; - gtk_grab_add(CaptureWidget); - end; -end; -{$ENDIF} - function GetDefaultMouseCaptureWidget(Widget: PGtkWidget ): PGtkWidget; var @@ -4717,9 +4634,6 @@ begin Result := WidgetInfo^.ClientWidget else Result := WidgetInfo^.CoreWidget; - {$IFDEF GTK2_USE_OLD_CAPTURE} - end; - {$ELSE} end else if GTK_IS_SCROLLED_WINDOW(Widget) and (GTK_IS_BIN(Widget)) then begin @@ -4728,7 +4642,6 @@ begin {$ENDIF} Result := gtk_bin_get_child(PGtkBin(Widget)); end; - {$ENDIF} end; end; end; diff --git a/lcl/interfaces/gtk2/gtk2proc.pp b/lcl/interfaces/gtk2/gtk2proc.pp index ddaa07a9fd..f0b8b88865 100644 --- a/lcl/interfaces/gtk2/gtk2proc.pp +++ b/lcl/interfaces/gtk2/gtk2proc.pp @@ -470,13 +470,9 @@ function TranslateGdkPointToClientArea(SourceWindow: PGdkWindow; function SubtractScoll(AWidget: PGtkWidget; APosition: TPoint): TPoint; // mouse capturing -{$IFDEF GTK2_USE_OLD_CAPTURE} -procedure CaptureMouseForWidget(Widget: PGtkWidget; Owner: TMouseCaptureType); -{$ENDIF} function GetDefaultMouseCaptureWidget(Widget: PGtkWidget): PGtkWidget; procedure ReleaseMouseCapture; procedure ReleaseCaptureWidget(Widget : PGtkWidget); -procedure UpdateMouseCaptureControl; const diff --git a/lcl/interfaces/gtk2/gtk2winapi.inc b/lcl/interfaces/gtk2/gtk2winapi.inc index 0c3d673c76..a2c220380e 100644 --- a/lcl/interfaces/gtk2/gtk2winapi.inc +++ b/lcl/interfaces/gtk2/gtk2winapi.inc @@ -8275,9 +8275,7 @@ end; function TGtk2WidgetSet.SetCapture(AHandle: HWND): HWND; var Widget: PGtkWidget; - {$IFNDEF GTK2_USE_OLD_CAPTURE} CaptureWidget: PGtkWidget; - {$ENDIF} begin Widget := {%H-}PGtkWidget(AHandle); {$IfDef VerboseMouseCapture} @@ -8287,11 +8285,6 @@ begin // return old capture handle Result := GetCapture; - {$IFDEF GTK2_USE_OLD_CAPTURE} - // capture - CaptureMouseForWidget(Widget, mctLCL); - {$ELSE} - if Result <> 0 then gtk_grab_remove(gtk_grab_get_current); @@ -8307,7 +8300,6 @@ begin MouseCaptureWidget := CaptureWidget; if MouseCaptureWidget<>nil then SendMessage(HWnd({%H-}PtrUInt(MouseCaptureWidget)), LM_CAPTURECHANGED, 0, Result); - {$ENDIF} end; {------------------------------------------------------------------------------