Gtk3: fixed issue when hide mapped container. issue #41387

This commit is contained in:
zeljan1 2025-01-31 18:26:07 +01:00
parent 46fad95a74
commit 95786ee691
3 changed files with 17 additions and 2 deletions

View File

@ -86,7 +86,6 @@ type
function GetVisible: Boolean;
procedure SetEnabled(AValue: Boolean);
procedure SetFont(AValue: PPangoFontDescription);
procedure SetVisible(AValue: Boolean);
procedure SetStyleContext({%H-}AValue: PGtkStyleContext);
class procedure DestroyWidgetEvent({%H-}w: PGtkWidget;{%H-}data:gpointer); cdecl; static;
class function DrawWidget(AWidget: PGtkWidget; AContext: Pcairo_t; Data: gpointer): gboolean; cdecl; static;
@ -124,6 +123,7 @@ type
procedure SetFontColor(AValue: TColor); virtual;
function GetWidget:PGtkWidget;
procedure ConnectSizeAllocateSignal(ToWidget: PGtkWidget); virtual;
procedure SetVisible(AValue: Boolean); virtual;
public
LCLObject: TWinControl;
LCLWidth: integer; {setted up only TWSControl.SetBounds}
@ -391,6 +391,8 @@ type
{ TGtk3Container }
TGtk3Container = class(TGtk3Widget)
protected
procedure SetVisible(AValue: Boolean); override;
public
procedure InitializeWidget; override;
procedure AddChild(AWidget: PGtkWidget; const ALeft, ATop: Integer); virtual;
@ -4785,6 +4787,16 @@ begin
Result := True;
end;
procedure TGtk3Container.SetVisible(AValue: Boolean);
begin
if not AValue then
begin
Widget^.set_no_show_all(True);
Widget^.hide;
end;
inherited SetVisible(AValue);
end;
procedure TGtk3Container.InitializeWidget;
begin
inherited InitializeWidget;

View File

@ -509,6 +509,7 @@ begin
DebugLn('TGtk3WSWinControl.ShowHide ',dbgsName(AWinControl));
{$ENDIF}
wgt:=TGtk3Widget(AWinControl.Handle);
wgt.BeginUpdate;
wgt.Visible := AWinControl.HandleObjectShouldBeVisible;
if wgt.Visible then
begin
@ -520,6 +521,7 @@ begin
wgt.GetContainerWidget^.realize;
end;
end;
wgt.EndUpdate;
end;
class procedure TGtk3WSWinControl.ScrollBy(const AWinControl: TWinControl;

View File

@ -298,7 +298,7 @@ begin
AWindow^.realize;
end;
AGtk3Widget.BeginUpdate;
AGtk3Widget.Visible := ShouldBeVisible;
if AGtk3Widget.Visible then
@ -337,6 +337,7 @@ begin
AWindow^.set_transient_for(nil);
end;
end;
AGtk3Widget.EndUpdate;
end;
class procedure TGtk3WSCustomForm.CloseModal(const ACustomForm: TCustomForm);