mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-13 12:19:16 +02:00
LCL-Gtk2: Keep window stack relationship when a modal/hint window is closed. Patch by Alexander (Rouse_) Bagel, issue #41731.
This commit is contained in:
parent
854bdb0007
commit
e43acbc75e
@ -493,6 +493,7 @@ type
|
|||||||
FormBorderStyle: Integer; // used only by forms
|
FormBorderStyle: Integer; // used only by forms
|
||||||
FormWindowState: TGdkEventWindowState; // used only by forms to stop infinite loops eg. issue #16505
|
FormWindowState: TGdkEventWindowState; // used only by forms to stop infinite loops eg. issue #16505
|
||||||
FirstPaint: boolean; // for accurate frame - forms only
|
FirstPaint: boolean; // for accurate frame - forms only
|
||||||
|
WndParent: HWnd;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//TODO: remove
|
//TODO: remove
|
||||||
|
@ -4176,6 +4176,7 @@ begin
|
|||||||
Result^.Style := AParams.Style;
|
Result^.Style := AParams.Style;
|
||||||
Result^.ExStyle := AParams.ExStyle;
|
Result^.ExStyle := AParams.ExStyle;
|
||||||
Result^.WndProc := {%H-}PtrUInt(AParams.WindowClass.lpfnWndProc);
|
Result^.WndProc := {%H-}PtrUInt(AParams.WindowClass.lpfnWndProc);
|
||||||
|
Result^.WndParent := AParams.WndParent;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function GetWidgetInfo(const AWidget: Pointer): PWidgetInfo;
|
function GetWidgetInfo(const AWidget: Pointer): PWidgetInfo;
|
||||||
|
@ -2073,6 +2073,8 @@ var
|
|||||||
ATransientWindow2: PTransientWindow;
|
ATransientWindow2: PTransientWindow;
|
||||||
ParentTransientWindow: PTransientWindow;
|
ParentTransientWindow: PTransientWindow;
|
||||||
OldTransientParent: PGtkWindow;
|
OldTransientParent: PGtkWindow;
|
||||||
|
WidgetInfo: PWidgetInfo;
|
||||||
|
WndParentPresent: Boolean;
|
||||||
begin
|
begin
|
||||||
if (not UseTransientForModalWindows) then exit;
|
if (not UseTransientForModalWindows) then exit;
|
||||||
if UpdatingTransientWindows then begin
|
if UpdatingTransientWindows then begin
|
||||||
@ -2161,11 +2163,44 @@ begin
|
|||||||
// there is no modal window
|
// there is no modal window
|
||||||
// -> break all transient window relation ships
|
// -> break all transient window relation ships
|
||||||
for i:=AllWindows.Count-1 downto 0 do begin
|
for i:=AllWindows.Count-1 downto 0 do begin
|
||||||
ATransientWindow:=PTransientWindow(AllWindows[i]);
|
ATransientWindow := PTransientWindow(AllWindows[i]);
|
||||||
{$IFDEF VerboseTransient}
|
{$IFDEF VerboseTransient}
|
||||||
debugln(['TGtk2WidgetSet.UpdateTransientWindows Untransient ',i,
|
debugln(['TGtk2WidgetSet.UpdateTransientWindows Untransient ',i,
|
||||||
' ',dbgsname(ATransientWindow^.Component)]);
|
' ',dbgsname(ATransientWindow^.Component)]);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
LCLObject := ATransientWindow^.Component;
|
||||||
|
if LCLObject is TCustomForm then
|
||||||
|
begin
|
||||||
|
if TCustomForm(LCLObject).PopupParent <> nil then
|
||||||
|
begin
|
||||||
|
gtk_window_set_transient_for(ATransientWindow^.GtkWindow,
|
||||||
|
{%H-}PGtkWindow(TCustomForm(LCLObject).PopupParent.Handle));
|
||||||
|
Continue;
|
||||||
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
|
WidgetInfo := GetWidgetInfo(ATransientWindow^.GtkWindow);
|
||||||
|
Window := {%H-}PGtkWindow(WidgetInfo^.WndParent);
|
||||||
|
if Window <> nil then
|
||||||
|
begin
|
||||||
|
WndParentPresent := False;
|
||||||
|
for j := 0 to AllWindows.Count - 1 do
|
||||||
|
begin
|
||||||
|
ATransientWindow2 := PTransientWindow(AllWindows[j]);
|
||||||
|
if ATransientWindow2^.GtkWindow = Window then
|
||||||
|
begin
|
||||||
|
WndParentPresent := True;
|
||||||
|
gtk_window_set_transient_for(ATransientWindow^.GtkWindow, Window);
|
||||||
|
Break;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
if WndParentPresent then
|
||||||
|
Continue
|
||||||
|
else
|
||||||
|
WidgetInfo^.WndParent := 0;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
gtk_window_set_transient_for(ATransientWindow^.GtkWindow,nil);
|
gtk_window_set_transient_for(ATransientWindow^.GtkWindow,nil);
|
||||||
end;
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
|
Loading…
Reference in New Issue
Block a user