summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrewski207 <drewski207@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-12-09 14:33:57 +0000
committerdrewski207 <drewski207@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-12-09 14:33:57 +0000
commit838792424beb2390dbb30bf786407be9a56b9660 (patch)
treeae14c7f022991a9e06ce45d7a2e76c9d13a1e147
parentc45272d642c7af5a63f471c3319eee213c2be0b0 (diff)
downloadfpGUI-838792424beb2390dbb30bf786407be9a56b9660.tar.xz
* Added fpgApplicationRemoveWindowFromModalStack so windows that are in the stach make sure to remove themselves when destroyed
* Added 2 new attributes to TWindowAttributes waUnblockableMessages, waX11SkipWMHints * waUnblockableMessages is useful for allowing certain windows to still respond when other windows are modal
-rw-r--r--src/corelib/fpg_base.pas10
-rw-r--r--src/corelib/x11/fpg_netlayer_x11.pas2
-rw-r--r--src/corelib/x11/fpg_x11.pas12
-rw-r--r--src/gui/fpg_form.pas9
4 files changed, 25 insertions, 8 deletions
diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas
index 37e19471..979ac61a 100644
--- a/src/corelib/fpg_base.pas
+++ b/src/corelib/fpg_base.pas
@@ -45,7 +45,7 @@ type
TWindowType = (wtChild, wtWindow, wtModalForm, wtPopup);
- TWindowAttribute = (waSizeable, waAutoPos, waScreenCenterPos, waStayOnTop, waFullScreen, waBorderless);
+ TWindowAttribute = (waSizeable, waAutoPos, waScreenCenterPos, waStayOnTop, waFullScreen, waBorderless, waUnblockableMessages, waX11SkipWMHints);
TWindowAttributes = set of TWindowAttribute;
TMouseCursor = (mcDefault, mcArrow, mcCross, mcIBeam, mcSizeEW, mcSizeNS,
@@ -453,6 +453,8 @@ type
end;
+ { TfpgApplicationBase }
+
TfpgApplicationBase = class(TComponent)
private
FMainForm: TfpgWindowBase;
@@ -473,6 +475,7 @@ type
procedure PushModalForm(AForm: TfpgWindowBase);
procedure PopModalForm;
function PrevModalForm: TfpgWindowBase;
+ function RemoveWindowFromModalStack(AForm: TfpgWindowBase): Integer;
procedure CreateForm(AFormClass: TComponentClass; out AForm: TfpgWindowBase);
function GetScreenWidth: TfpgCoord; virtual; abstract;
function GetScreenHeight: TfpgCoord; virtual; abstract;
@@ -2112,6 +2115,11 @@ begin
Result := TfpgWindowBase(FModalFormStack.Items[FModalFormStack.Count-2]);
end;
+function TfpgApplicationBase.RemoveWindowFromModalStack (AForm: TfpgWindowBase): Integer;
+begin
+ Result := FModalFormStack.Remove(AForm);
+end;
+
procedure TfpgApplicationBase.CreateForm(AFormClass: TComponentClass;
out AForm: TfpgWindowBase);
begin
diff --git a/src/corelib/x11/fpg_netlayer_x11.pas b/src/corelib/x11/fpg_netlayer_x11.pas
index b6d0dd70..6a2aeeb6 100644
--- a/src/corelib/x11/fpg_netlayer_x11.pas
+++ b/src/corelib/x11/fpg_netlayer_x11.pas
@@ -317,7 +317,7 @@ var
I: Integer;
ANetAtom: TNetAtomEnum;
begin
- if WindowGetPropertyAtom(FRootWindow, FNetAtoms[naSUPPORTED], AtomCount, Atoms) = False then;// Exit;
+ if WindowGetPropertyAtom(FRootWindow, FNetAtoms[naSUPPORTED], AtomCount, Atoms) = False then Exit;
//WriteLn('RootWindow Atom Count = ',AtomCount);
FillChar(FAtomSupported, SizeOf(Boolean) * Length(FAtomSupported), 0);;
for I := 0 to AtomCount-1 do begin
diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas
index 385b1361..6aad85d0 100644
--- a/src/corelib/x11/fpg_x11.pas
+++ b/src/corelib/x11/fpg_x11.pas
@@ -714,7 +714,7 @@ begin
inherited Create(AParams);
FIsInitialized := False;
FDisplay := XOpenDisplay(PChar(aparams));
-
+
if FDisplay = nil then
raise Exception.Create('fpGUI-X11: Could not open the display. Is your X11 server running?');
@@ -1050,7 +1050,7 @@ begin
if xapplication.TopModalForm <> nil then
begin
ew := TfpgWindowImpl(WidgetParentForm(TfpgWidget(w)));
- if (ew <> nil) and (xapplication.TopModalForm <> ew) then
+ if (ew <> nil) and (xapplication.TopModalForm <> ew) and (waUnblockableMessages in ew.WindowAttributes = False) then
blockmsg := true;
end;
@@ -1128,7 +1128,7 @@ begin
if xapplication.TopModalForm <> nil then
begin
ew := TfpgWindowImpl(WidgetParentForm(TfpgWidget(w)));
- if (ew <> nil) and (xapplication.TopModalForm <> ew) then
+ if (ew <> nil) and (xapplication.TopModalForm <> ew) and (waUnblockableMessages in ew.WindowAttributes = False) then
blockmsg := true;
end;
if not blockmsg then
@@ -1163,7 +1163,7 @@ begin
begin
// This is ugly!!!!!!!!!!!!!!!
ew := TfpgWindowImpl(WidgetParentForm(TfpgWidget(w)));
- if (ew <> nil) and (xapplication.TopModalForm <> ew) then
+ if (ew <> nil) and (xapplication.TopModalForm <> ew) and (waUnblockableMessages in ew.WindowAttributes = False) then
blockmsg := true;
end;
@@ -1372,7 +1372,7 @@ begin
FillChar(attr, sizeof(attr), 0);
mask := 0;
- if FWindowType in [wtPopup] then
+ if (FWindowType in [wtPopup]) or (waX11SkipWMHints in FWindowAttributes) then
begin
attr.Override_Redirect := TBool(True);
mask := CWOverrideRedirect;
@@ -1465,7 +1465,7 @@ begin
fpgApplication.netlayer.WindowSetType(FWinHandle, [nwtSplash]);
// process Borderless forms
- if ((FWindowType = wtWindow) or (FWindowType = wtModalForm)) and (waBorderless in FWindowAttributes) then
+ if ((FWindowType = wtWindow) or (FWindowType = wtModalForm)) and (waBorderless in FWindowAttributes) and not (waX11SkipWMHints in FWindowAttributes) then
begin
prop := X.None;
prop := XInternAtom(xapplication.display, '_MOTIF_WM_INFO', longbool(0));
diff --git a/src/gui/fpg_form.pas b/src/gui/fpg_form.pas
index b95f194a..85ce5b49 100644
--- a/src/gui/fpg_form.pas
+++ b/src/gui/fpg_form.pas
@@ -35,6 +35,8 @@ type
TFormCloseEvent = procedure(Sender: TObject; var CloseAction: TCloseAction) of object;
TFormCloseQueryEvent = procedure(Sender: TObject; var CanClose: boolean) of object;
+ { TfpgBaseForm }
+
TfpgBaseForm = class(TfpgWidget)
private
FFullScreen: boolean;
@@ -83,6 +85,7 @@ type
property OnShow: TNotifyEvent read FOnShow write FOnShow;
public
constructor Create(AOwner: TComponent); override;
+ destructor Destroy; override;
procedure AfterConstruction; override;
procedure BeforeDestruction; override;
procedure AfterCreate; virtual;
@@ -244,6 +247,12 @@ begin
FIsContainer := True;
end;
+destructor TfpgBaseForm.Destroy;
+begin
+ fpgApplication.RemoveWindowFromModalStack(Self);
+ inherited Destroy;
+end;
+
procedure TfpgBaseForm.AfterCreate;
begin
// for the user