diff --git a/lcl/interfaces/gtk2/gtk2wsforms.pp b/lcl/interfaces/gtk2/gtk2wsforms.pp index 2d78547354..7767f7007c 100644 --- a/lcl/interfaces/gtk2/gtk2wsforms.pp +++ b/lcl/interfaces/gtk2/gtk2wsforms.pp @@ -775,6 +775,16 @@ begin gtk_window_set_keep_above(GtkWindow, True); end; end; + + if AWinControl.HandleObjectShouldBeVisible and + not (csDesigning in AForm.ComponentState) and + not (AForm.FormStyle in fsAllStayOnTop) and + not (fsModal in AForm.FormState) and + (AForm.PopupMode = pmExplicit) and + (AForm.PopupParent = nil) then + begin + SetPopupParent(AForm, AForm.PopupMode, AForm.PopupParent); + end; {$ENDIF} Gtk2WidgetSet.SetVisible(AWinControl, AForm.HandleObjectShouldBeVisible); @@ -846,7 +856,11 @@ begin pmAuto: PopupParent := Screen.ActiveForm; pmExplicit: + begin PopupParent := APopupParent; + if PopupParent = nil then + PopupParent := Application.MainForm; + end; end; if PopupParent <> nil then gtk_window_set_transient_for({%H-}PGtkWindow(ACustomForm.Handle), {%H-}PGtkWindow(PopupParent.Handle)) diff --git a/lcl/interfaces/qt/qtwidgets.pas b/lcl/interfaces/qt/qtwidgets.pas index 55628eba96..e733d602f3 100644 --- a/lcl/interfaces/qt/qtwidgets.pas +++ b/lcl/interfaces/qt/qtwidgets.pas @@ -6696,13 +6696,25 @@ begin if Screen.ActiveForm <> nil then NewParent := TQtWidget(Screen.ActiveForm.Handle).Widget; pmExplicit: + begin // parent is FPopupParent if FPopupParent <> nil then - NewParent := FPopupParent; + NewParent := FPopupParent + {$IFDEF HASX11} + else + begin + if not IsMainForm then + begin + NewParent := TQtMainWindow(Application.MainForm.Handle).Widget; + setWindowFlags(windowFlags or QtSheet); + end; + end; + {$ENDIF} + end; end; - if (NewParent = nil) and not FShowOnTaskBar and not IsMainForm then - NewParent := TQtMainWindow(Application.MainForm.Handle).Widget; - + if (NewParent = nil) and (FPopupMode <> pmNone) and + not FShowOnTaskBar and not IsMainForm then + NewParent := TQtMainWindow(Application.MainForm.Handle).Widget; ChangeParent(NewParent); end;