summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/fpg_main.pas11
-rw-r--r--src/corelib/fpg_widget.pas2
-rw-r--r--src/corelib/x11/fpg_x11.pas10
-rw-r--r--src/gui/fpg_dialogs.pas2
-rw-r--r--src/gui/fpg_form.pas2
-rw-r--r--src/gui/fpg_menu.pas1
6 files changed, 20 insertions, 8 deletions
diff --git a/src/corelib/fpg_main.pas b/src/corelib/fpg_main.pas
index 2e255923..df9a78e7 100644
--- a/src/corelib/fpg_main.pas
+++ b/src/corelib/fpg_main.pas
@@ -2015,10 +2015,13 @@ begin
FModalForWin := nil;
- if (AOwner <> nil) and (AOwner is TfpgWindow) then
- FWindowType := wtChild
- else
- FWindowType := wtWindow;
+ if not (FWindowType in [wtModalForm, wtPopup]) then
+ begin
+ if (AOwner <> nil) and (AOwner is TfpgWindow) then
+ FWindowType := wtChild
+ else
+ FWindowType := wtWindow;
+ end;
FCanvas := CreateCanvas;
end;
diff --git a/src/corelib/fpg_widget.pas b/src/corelib/fpg_widget.pas
index 8fb68a04..1f9bda21 100644
--- a/src/corelib/fpg_widget.pas
+++ b/src/corelib/fpg_widget.pas
@@ -503,7 +503,7 @@ begin
inherited Create(AOwner);
- if (AOwner <> nil) and (AOwner is TfpgWidget) then
+ if (AOwner <> nil) and (AOwner is TfpgWidget) and (not (WindowType in [wtModalForm, wtPopup])) {and not InheritsFrom(TfpgForm)} then
begin
Parent := TfpgWidget(AOwner);
FTabOrder := AOwner.ComponentCount;
diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas
index bc9c9dbd..bae72c40 100644
--- a/src/corelib/x11/fpg_x11.pas
+++ b/src/corelib/x11/fpg_x11.pas
@@ -2271,11 +2271,13 @@ var
WMHints: PXWMHints;
prop: TAtom;
mwmhints: TMWMHints;
+ IsToplevel: Boolean;
begin
if HandleIsValid then
Exit; //==>
- if AParent <> nil then
+ IsToplevel := (AParent = nil) or (FWindowType in [wtModalForm, wtPopup]);
+ if not IsToplevel then
pwh := TfpgX11Window(AParent).WinHandle
else
pwh := xapplication.RootWindow;
@@ -2314,7 +2316,7 @@ begin
FWinHandle := wh;
FBackupWinHandle := wh;
- if AParent = nil then // is a toplevel window
+ if IsToplevel then // is a toplevel window
begin
{ setup a window icon }
IconPixMap := XCreateBitmapFromData(fpgApplication.Display, FWinHandle,
@@ -2400,11 +2402,13 @@ begin
// for modal windows, this is necessary
if FWindowType = wtModalForm then
begin
- if Parent = nil then
+ if IsToplevel then
begin
lmwh := 0;
if fpgApplication.PrevModalForm <> nil then
lmwh := TfpgX11Window(fpgApplication.PrevModalForm).WinHandle
+ {else if AParent <> nil then
+ lmwh := TfpgX11Window(AParent).WinHandle}
{ 2011-03-24: Graeme Geldenhuys
I commented code this code because it caused more problems that it solved
when multiple modal dialogs or prompts are shown in succession.
diff --git a/src/gui/fpg_dialogs.pas b/src/gui/fpg_dialogs.pas
index 8f3639e6..99c5b208 100644
--- a/src/gui/fpg_dialogs.pas
+++ b/src/gui/fpg_dialogs.pas
@@ -577,6 +577,8 @@ end;
constructor TfpgBaseDialog.Create(AOwner: TComponent);
begin
+ // WindowType must be set before inherited or our parent property will be set
+ WindowType:=wtModalForm;
inherited Create(AOwner);
Width := 500;
Height := 400;
diff --git a/src/gui/fpg_form.pas b/src/gui/fpg_form.pas
index 7d5fe042..c80a1e53 100644
--- a/src/gui/fpg_form.pas
+++ b/src/gui/fpg_form.pas
@@ -342,6 +342,8 @@ function TfpgBaseForm.ShowModal: TfpgModalResult;
var
lCloseAction: TCloseAction;
begin
+ if HasHandle and (FWindowType <> wtModalForm) then
+ HandleHide;
FWindowType := wtModalForm;
fpgApplication.PushModalForm(self);
ModalResult := mrNone;
diff --git a/src/gui/fpg_menu.pas b/src/gui/fpg_menu.pas
index ee345927..3310db48 100644
--- a/src/gui/fpg_menu.pas
+++ b/src/gui/fpg_menu.pas
@@ -1341,6 +1341,7 @@ end;
constructor TfpgPopupMenu.Create(AOwner: TComponent);
begin
+ FWindowType:=wtPopup;
inherited Create(AOwner);
FMargin := 3;
FTextMargin := 3;