From f54c9412f15f0fe95d5da464fc077b72d5435c04 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Mon, 25 Jul 2011 13:30:25 +0200 Subject: 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. --- src/corelib/fpg_main.pas | 2 +- src/corelib/x11/fpg_x11.pas | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src/corelib') 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?'); -- cgit v1.2.3-70-g09d2