summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGraeme Geldenhuys <graeme@mastermaths.co.za>2011-07-25 13:30:25 +0200
committerGraeme Geldenhuys <graeme@mastermaths.co.za>2011-07-25 13:30:25 +0200
commitf54c9412f15f0fe95d5da464fc077b72d5435c04 (patch)
treed1936d9c00f9df1a0b6fcbb43b1ab7e32b0152ca /src
parentb1d219b78781df6b9dea53cde9b152e6d0a4341c (diff)
downloadfpGUI-f54c9412f15f0fe95d5da464fc077b72d5435c04.tar.xz
parameter handling improvements
Old behaviour was that we simply assumed the first parameter will be the X11 -display parameter. This is just WRONG! We now query the parameter list for the value of -display, that's if it exists in the first place.
Diffstat (limited to 'src')
-rw-r--r--src/corelib/fpg_main.pas2
-rw-r--r--src/corelib/x11/fpg_x11.pas12
2 files changed, 12 insertions, 2 deletions
diff --git a/src/corelib/fpg_main.pas b/src/corelib/fpg_main.pas
index 537138fb..ee05655a 100644
--- a/src/corelib/fpg_main.pas
+++ b/src/corelib/fpg_main.pas
@@ -1136,7 +1136,7 @@ end;
function fpgApplication: TfpgApplication;
begin
if not Assigned(uApplication) then
- uApplication := TfpgApplication.Create(ParamStr(1));
+ uApplication := TfpgApplication.Create;
result := uApplication;
end;
diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas
index 8dce37cf..f36b0db4 100644
--- a/src/corelib/x11/fpg_x11.pas
+++ b/src/corelib/x11/fpg_x11.pas
@@ -400,6 +400,7 @@ uses
fpg_stringutils, // used for GetTextWidth
fpg_utils,
fpg_form, // for modal event support
+ fpg_cmdlineparams,
cursorfont,
xatom, // used for XA_WM_NAME
keysym,
@@ -1328,10 +1329,19 @@ begin
end;
constructor TfpgX11Application.Create(const AParams: string);
+var
+ s: string;
begin
inherited Create(AParams);
FIsInitialized := False;
- FDisplay := XOpenDisplay(PChar(aparams));
+
+ if gCommandLineParams.IsParam('display') then
+ begin
+ s := gCommandLineParams.GetParam('display');
+ FDisplay := XOpenDisplay(PChar(s));
+ end
+ else
+ FDisplay := XOpenDisplay('');
if FDisplay = nil then
raise Exception.Create('fpGUI-X11: Could not open the display. Is your X11 server running?');