mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-16 09:59:23 +02:00
gtk1 intf: workaround for popupmenu of TEdit/TComboBox mouse capture release bug #9452
git-svn-id: trunk@15423 -
This commit is contained in:
parent
e3520a6d50
commit
63efcb6dec
@ -1715,9 +1715,9 @@ begin
|
|||||||
if not TempPopupMenu.AutoPopup then Exit;
|
if not TempPopupMenu.AutoPopup then Exit;
|
||||||
// SendCancelMode(nil);
|
// SendCancelMode(nil);
|
||||||
TempPopupMenu.PopupComponent := Control;
|
TempPopupMenu.PopupComponent := Control;
|
||||||
//DebugLn(['TControl.WMContextMenu ',DbgSName(Self),' Message.pos=',dbgs(P2)]);
|
DebugLn(['TControl.WMContextMenu ',DbgSName(Self),' Message.pos=',dbgs(P2)]);
|
||||||
P2 := ClientToScreen(P2);
|
P2 := ClientToScreen(P2);
|
||||||
//DebugLn(['TControl.WMContextMenu ',DbgSName(Self),' P2=',dbgs(P2)]);
|
DebugLn(['TControl.WMContextMenu ',DbgSName(Self),' P2=',dbgs(P2)]);
|
||||||
TempPopupMenu.Popup(P2.X, P2.Y);
|
TempPopupMenu.Popup(P2.X, P2.Y);
|
||||||
Message.Result:= 1;
|
Message.Result:= 1;
|
||||||
Exit;
|
Exit;
|
||||||
|
@ -1134,6 +1134,7 @@ function gtkMotionNotify(Widget:PGTKWidget; Event: PGDKEventMotion;
|
|||||||
Data: gPointer): GBoolean; cdecl;
|
Data: gPointer): GBoolean; cdecl;
|
||||||
var
|
var
|
||||||
DesignOnlySignal: boolean;
|
DesignOnlySignal: boolean;
|
||||||
|
ShiftState: TShiftState;
|
||||||
begin
|
begin
|
||||||
Result := CallBackDefaultReturn;
|
Result := CallBackDefaultReturn;
|
||||||
MousePositionValid:=false;
|
MousePositionValid:=false;
|
||||||
@ -1149,6 +1150,28 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
UpdateMouseCaptureControl;
|
UpdateMouseCaptureControl;
|
||||||
|
|
||||||
|
ShiftState := GTKEventStateToShiftState(Event^.State);
|
||||||
|
if (MouseCaptureWidget=Widget)
|
||||||
|
and (MouseCaptureType=mctGTK)
|
||||||
|
and ([ssLeft,ssRight,ssMiddle]*ShiftState=[]) then begin
|
||||||
|
{$IFDEF VerboseMouseCapture}
|
||||||
|
DebugLn(['gtkMotionNotify gtk capture without mouse down: ',GetWidgetDebugReport(Widget)]);
|
||||||
|
{$ENDIF}
|
||||||
|
{$IFDEF Gtk1}
|
||||||
|
// workaround for buggy gtk1: release capture and clean up editable
|
||||||
|
// (happens when popupmenu of TEdit/TComboBox closes)
|
||||||
|
gtk_grab_remove(MouseCaptureWidget);
|
||||||
|
if GtkWidgetIsA(MouseCaptureWidget,GTK_TYPE_ENTRY) then begin
|
||||||
|
PGtkEntry(MouseCaptureWidget)^.button:=0;
|
||||||
|
end;
|
||||||
|
if GtkWidgetIsA(MouseCaptureWidget,gtk_editable_get_type) then begin
|
||||||
|
PGtkEditable(MouseCaptureWidget)^.flag0:=
|
||||||
|
PGtkEditable(MouseCaptureWidget)^.flag0 and not bm_TGtkEditable_has_selection;
|
||||||
|
end;
|
||||||
|
UpdateMouseCaptureControl;
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
|
|
||||||
if not (csDesigning in TComponent(Data).ComponentState) then begin
|
if not (csDesigning in TComponent(Data).ComponentState) then begin
|
||||||
DesignOnlySignal:=GetDesignOnlySignalFlag(Widget,dstMouseMotion);
|
DesignOnlySignal:=GetDesignOnlySignalFlag(Widget,dstMouseMotion);
|
||||||
|
@ -45,6 +45,11 @@ type
|
|||||||
mctGTKIntf, // gtk interface has captured the mouse
|
mctGTKIntf, // gtk interface has captured the mouse
|
||||||
mctLCL // a LCL control has captured the mouse
|
mctLCL // a LCL control has captured the mouse
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const
|
||||||
|
MouseCaptureTypeNames: array[TMouseCaptureType] of string = (
|
||||||
|
'GTK','GTKintf','LCL'
|
||||||
|
);
|
||||||
|
|
||||||
var
|
var
|
||||||
//drag icons
|
//drag icons
|
||||||
|
@ -4616,7 +4616,7 @@ end;
|
|||||||
Params: none
|
Params: none
|
||||||
Returns: none
|
Returns: none
|
||||||
|
|
||||||
Sets MCaptureControl to the current capturing widget.
|
Sets MouseCaptureWidget to the current capturing widget.
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
procedure UpdateMouseCaptureControl;
|
procedure UpdateMouseCaptureControl;
|
||||||
var
|
var
|
||||||
@ -4631,11 +4631,10 @@ begin
|
|||||||
// -> this means the gtk itself has changed the mouse grab
|
// -> this means the gtk itself has changed the mouse grab
|
||||||
{$IFDEF VerboseMouseCapture}
|
{$IFDEF VerboseMouseCapture}
|
||||||
DebugLn('UpdateMouseCaptureControl Capture changed from ',
|
DebugLn('UpdateMouseCaptureControl Capture changed from ',
|
||||||
'[',GetWidgetDebugReport(OldMouseCaptureWidget),']',
|
'[',GetWidgetDebugReport(OldMouseCaptureWidget),' type=',MouseCaptureTypeNames[MouseCaptureType],']',
|
||||||
' to [',GetWidgetDebugReport(CurMouseCaptureWidget),']');
|
' to [',GetWidgetDebugReport(CurMouseCaptureWidget),' type=GTK]');
|
||||||
if CurMouseCaptureWidget<>nil then
|
if CurMouseCaptureWidget<>nil then
|
||||||
DebugLn('parent ', GetWidgetDebugReport(CurMouseCaptureWidget^.Parent));
|
DebugLn('parent ', GetWidgetDebugReport(CurMouseCaptureWidget^.Parent));
|
||||||
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
// notify the new capture control
|
// notify the new capture control
|
||||||
|
Loading…
Reference in New Issue
Block a user