Skip to content

Commit

Permalink
adding double dash option for x11, quartz and null drivers
Browse files Browse the repository at this point in the history
  • Loading branch information
estebanlm committed Jan 11, 2017
1 parent 7fd52e5 commit e02c546
Show file tree
Hide file tree
Showing 3 changed files with 84 additions and 66 deletions.
30 changes: 18 additions & 12 deletions platforms/unix/vm-display-Quartz/zzz/sqUnixQuartz.m
Expand Up @@ -101,6 +101,12 @@
//
#undef FULLSCREEN_FADE 0.02

#ifdef PharoVM
# define VMOPTION(arg) "--"arg
#else
# define VMOPTION(arg) "-"arg
#endif

///
/// No more user-serviceable parts in this file. Stop Tweaking Now!
///
Expand Down Expand Up @@ -1086,24 +1092,24 @@ static void display_parseEnvironment(void) {}

static int display_parseArgument(int argc, char **argv)
{
if (!strncmp(*argv, "-psn_", 5)) return fromFinder= 1;
else if (!strcmp(*argv, "-quartz")) return 1;
else if (!strcmp(*argv, "-fullscreen")) return fullscreen= 1;
else if (!strcmp(*argv, "-headless")) return headless= 1;
else if (!strcmp(*argv, "-notitle")) return noTitle= 1;
else if (!strcmp(*argv, "-nodock")) return noDock= 1;
else if (!strcmp(*argv, "-swapbtn")) return swapBtn= 1;
if (!strncmp(*argv, VMOPTION("psn_"), strlen(VMOPTION("psn_")))) return fromFinder= 1;
else if (!strcmp(*argv, VMOPTION("quartz"))) return 1;
else if (!strcmp(*argv, VMOPTION("fullscreen"))) return fullscreen= 1;
else if (!strcmp(*argv, VMOPTION("headless"))) return headless= 1;
else if (!strcmp(*argv, VMOPTION("notitle"))) return noTitle= 1;
else if (!strcmp(*argv, VMOPTION("nodock"))) return noDock= 1;
else if (!strcmp(*argv, VMOPTION("swapbtn"))) return swapBtn= 1;
return 0;
}

static void display_printUsage(void)
{
printf("\nQuartz/Aqua <option>s:\n");
printf(" -fullscreen occupy the entire screen\n");
printf(" -headless run in headless (no window) mode\n");
printf(" -nodock don't show Squeak in the dock\n");
printf(" -notitle disable the Squeak window title bar\n");
printf(" -swapbtn swap mouse buttons 2 (yellow) and 3 (blue)\n");
printf(" "VMOPTION("fullscreen")" occupy the entire screen\n");
printf(" "VMOPTION("headless")" run in headless (no window) mode\n");
printf(" "VMOPTION("nodock")" don't show Squeak in the dock\n");
printf(" "VMOPTION("notitle")" disable the Squeak window title bar\n");
printf(" "VMOPTION("swapbtn")" swap mouse buttons 2 (yellow) and 3 (blue)\n");
}

static void display_printUsageNotes(void)
Expand Down
110 changes: 58 additions & 52 deletions platforms/unix/vm-display-X11/sqUnixX11.c
Expand Up @@ -160,6 +160,12 @@
# define xResName "squeak"
#endif

#ifdef PharoVM
# define VMOPTION(arg) "--"arg
#else
# define VMOPTION(arg) "-"arg
#endif

char *displayName= 0; /* name of display, or 0 for $DISPLAY */
Display *stDisplay= null; /* Squeak display */
int isConnectedToXServer=0;/* True when connected to an X server */
Expand Down Expand Up @@ -7381,42 +7387,42 @@ SqDisplayDefine(X11);
static void display_printUsage(void)
{
printf("\nX11 <option>s:\n");
printf(" -browserWindow <wid> run in window <wid>\n");
printf(" -browserPipes <r> <w> run as Browser plugin using descriptors <r> <w>\n");
printf(" -cmdmod <n> map Mod<n> to the Command key\n");
printf(" -compositioninput enable overlay window for composed characters\n");
printf(" -display <dpy> display on <dpy> (default: $DISPLAY)\n");
printf(" -fullscreen occupy the entire screen\n");
printf(" -fullscreenDirect simple window manager support for fullscreen\n");
printf(" "VMOPTION("browserWindow")" <wid> run in window <wid>\n");
printf(" "VMOPTION("browserPipes")" <r> <w> run as Browser plugin using descriptors <r> <w>\n");
printf(" "VMOPTION("cmdmod")" <n> map Mod<n> to the Command key\n");
printf(" "VMOPTION("compositioninput")" enable overlay window for composed characters\n");
printf(" "VMOPTION("display")" <dpy> display on <dpy> (default: $DISPLAY)\n");
printf(" "VMOPTION("fullscreen")" occupy the entire screen\n");
printf(" "VMOPTION("fullscreenDirect")" simple window manager support for fullscreen\n");
#if (USE_X11_GLX)
printf(" -glxdebug <n> set GLX debug verbosity level to <n>\n");
printf(" "VMOPTION("glxdebug")" <n> set GLX debug verbosity level to <n>\n");
#endif
printf(" -headless run in headless (no window) mode\n");
printf(" -iconic start up iconified\n");
printf(" -lazy go to sleep when main window unmapped\n");
printf(" -mapdelbs map Delete key onto Backspace\n");
printf(" -nointl disable international keyboard support\n");
printf(" -notitle disable the " xResName " window title bar\n");
printf(" -title <t> use t as the " xResName " window title instead of the image name\n");
printf(" -ldtoms <n> launch drop timeout milliseconds\n");
printf(" -noxdnd disable X drag-and-drop protocol support\n");
printf(" -optmod <n> map Mod<n> to the Option key\n");
printf(" "VMOPTION("headless")" run in headless (no window) mode\n");
printf(" "VMOPTION("iconic")" start up iconified\n");
printf(" "VMOPTION("lazy")" go to sleep when main window unmapped\n");
printf(" "VMOPTION("mapdelbs")" map Delete key onto Backspace\n");
printf(" "VMOPTION("nointl")" disable international keyboard support\n");
printf(" "VMOPTION("notitle")" disable the " xResName " window title bar\n");
printf(" "VMOPTION("title")" <t> use t as the " xResName " window title instead of the image name\n");
printf(" "VMOPTION("ldtoms")" <n> launch drop timeout milliseconds\n");
printf(" "VMOPTION("noxdnd")" disable X drag-and-drop protocol support\n");
printf(" "VMOPTION("optmod")" <n> map Mod<n> to the Option key\n");
#if defined(SUGAR)
printf(" -sugarBundleId <id> set window property _SUGAR_BUNDLE_ID to <id>\n");
printf(" -sugarActivityId <id> set window property _SUGAR_ACTIVITY_ID to <id>\n");
printf(" "VMOPTION("sugarBundleId")" <id> set window property _SUGAR_BUNDLE_ID to <id>\n");
printf(" "VMOPTION("sugarActivityId")" <id> set window property _SUGAR_ACTIVITY_ID to <id>\n");
#endif
printf(" -swapbtn swap yellow (middle) and blue (right) buttons\n");
printf(" -xasync don't serialize display updates\n");
printf(" "VMOPTION("swapbtn")" swap yellow (middle) and blue (right) buttons\n");
printf(" "VMOPTION("xasync")" don't serialize display updates\n");
#if defined(USE_XICFONT_OPTION)
printf(" -xicfont <f> use font set <f> for the input context overlay\n");
printf(" "VMOPTION("xicfont")" <f> use font set <f> for the input context overlay\n");
#endif
printf(" -xshm use X shared memory extension\n");
printf(" "VMOPTION("xshm")" use X shared memory extension\n");
}

static void display_printUsageNotes(void)
{
printf(" Using `unix:0' for <dpy> may improve local display performance.\n");
printf(" -xshm only works when " xResName " is running on the X server host.\n");
printf(" "VMOPTION("xshm")" only works when " xResName " is running on the X server host.\n");
}


Expand Down Expand Up @@ -7466,47 +7472,47 @@ static int display_parseArgument(int argc, char **argv)
int n= 1;
char *arg= argv[0];

if (!strcmp(arg, "-headless")) headless= 1;
if (!strcmp(arg, VMOPTION("headless"))) headless= 1;
#if defined(USE_XSHM)
else if (!strcmp(arg, "-xshm")) useXshm= 1;
else if (!strcmp(arg, "-xasync")) asyncUpdate= 1;
else if (!strcmp(arg, VMOPTION("xshm"))) useXshm= 1;
else if (!strcmp(arg, VMOPTION("xasync"))) asyncUpdate= 1;
#else
else if (!strcmp(arg, "-xshm") ||
!strcmp(arg, "-xasync")) fprintf(stderr, "ignoring %s (not supported by this VM)\n", arg);
else if (!strcmp(arg, VMOPTION("xshm"))) ||
!strcmp(arg, VMOPTION("xasync"))) fprintf(stderr, "ignoring %s (not supported by this VM)\n", arg);
#endif
else if (!strcmp(arg, "-lazy")) sleepWhenUnmapped= 1;
else if (!strcmp(arg, "-notitle")) noTitle= 1;
else if (!strcmp(arg, "-mapdelbs")) mapDelBs= 1;
else if (!strcmp(arg, "-swapbtn")) swapBtn= 1;
else if (!strcmp(arg, "-fullscreen")) fullScreen= 1;
else if (!strcmp(arg, "-fullscreenDirect")) fullScreenDirect= 1;
else if (!strcmp(arg, "-iconic")) iconified= 1;
else if (!strcmp(arg, VMOPTION("lazy"))) sleepWhenUnmapped= 1;
else if (!strcmp(arg, VMOPTION("notitle"))) noTitle= 1;
else if (!strcmp(arg, VMOPTION("mapdelbs"))) mapDelBs= 1;
else if (!strcmp(arg, VMOPTION("swapbtn"))) swapBtn= 1;
else if (!strcmp(arg, VMOPTION("fullscreen"))) fullScreen= 1;
else if (!strcmp(arg, VMOPTION("fullscreenDirect"))) fullScreenDirect= 1;
else if (!strcmp(arg, VMOPTION("iconic"))) iconified= 1;
#if !defined (INIT_INPUT_WHEN_KEY_PRESSED)
else if (!strcmp(arg, "-nointl")) initInput= initInputNone;
else if (!strcmp(arg, VMOPTION("nointl"))) initInput= initInputNone;
#else
else if (!strcmp(arg, "-nointl")) x2sqKey= x2sqKeyPlain;
else if (!strcmp(arg, VMOPTION("nointl"))) x2sqKey= x2sqKeyPlain;
#endif
else if (!strcmp(arg, "-compositioninput"))
else if (!strcmp(arg, VMOPTION("compositioninput")))
{
compositionInput= 1;
x2sqKey= x2sqKeyCompositionInput;
initInput= initInputI18n;
}
else if (!strcmp(arg, "-noxdnd")) useXdnd= 0;
else if (!strcmp(arg, VMOPTION("noxdnd"))) useXdnd= 0;
else if (argv[1]) /* option requires an argument */
{
n= 2;
if (!strcmp(arg, "-display")) displayName= argv[1];
else if (!strcmp(arg, "-optmod")) optMapIndex= Mod1MapIndex + atoi(argv[1]) - 1;
else if (!strcmp(arg, "-cmdmod")) cmdMapIndex= Mod1MapIndex + atoi(argv[1]) - 1;
if (!strcmp(arg, VMOPTION("display"))) displayName= argv[1];
else if (!strcmp(arg, VMOPTION("optmod"))) optMapIndex= Mod1MapIndex + atoi(argv[1]) - 1;
else if (!strcmp(arg, VMOPTION("cmdmod"))) cmdMapIndex= Mod1MapIndex + atoi(argv[1]) - 1;
# if defined(SUGAR)
else if (!strcmp(arg, "-sugarBundleId")) sugarBundleId= argv[1];
else if (!strcmp(arg, "-sugarActivityId")) sugarActivityId= argv[1];
else if (!strcmp(arg, VMOPTION("sugarBundleId"))) sugarBundleId= argv[1];
else if (!strcmp(arg, VMOPTION("sugarActivityId"))) sugarActivityId= argv[1];
# endif
# if defined(USE_XICFONT_OPTION)
else if (!strcmp(arg, "-xicfont")) inputFontStr= argv[1];
else if (!strcmp(arg, VMOPTION("xicfont"))) inputFontStr= argv[1];
# endif
else if (!strcmp(arg, "-browserWindow"))
else if (!strcmp(arg, VMOPTION("browserWindow")))
{
sscanf(argv[1], "%lu", (unsigned long *)&browserWindow);
if (browserWindow == 0)
Expand All @@ -7515,7 +7521,7 @@ static int display_parseArgument(int argc, char **argv)
exit(1);
}
}
else if (!strcmp(arg, "-browserPipes"))
else if (!strcmp(arg, VMOPTION("browserPipes")))
{
if (!argv[2]) return 0;
sscanf(argv[1], "%i", &browserPipes[0]);
Expand All @@ -7536,13 +7542,13 @@ static int display_parseArgument(int argc, char **argv)
return 3;
}
# if (USE_X11_GLX)
else if (!strcmp(arg, "-glxdebug"))
else if (!strcmp(arg, VMOPTION("glxdebug")))
{
sscanf(argv[1], "%d", &verboseLevel);
}
# endif
else if (!strcmp(arg, "-title")) defaultWindowLabel = argv[1];
else if (!strcmp(arg, "-ldtoms")) launchDropTimeoutMsecs = atol(argv[1]);
else if (!strcmp(arg, VMOPTION("title"))) defaultWindowLabel = argv[1];
else if (!strcmp(arg, VMOPTION("ldtoms"))) launchDropTimeoutMsecs = atol(argv[1]);
else
n= 0; /* not recognised */
}
Expand Down
10 changes: 8 additions & 2 deletions platforms/unix/vm-display-null/sqUnixDisplayNull.c
Expand Up @@ -185,10 +185,16 @@ SqDisplayDefine(null);

static void display_parseEnvironment(void) {}

#ifdef PharoVM
# define VMOPTION(arg) "--"arg
#else
# define VMOPTION(arg) "-"arg
#endif

static int display_parseArgument(int argc, char **argv)
{
if (!strcmp(argv[0], "-nodisplay")) return 1;
if (!strcmp(argv[0], "-headless")) return 1;
if (!strcmp(argv[0], VMOPTION("nodisplay"))) return 1;
if (!strcmp(argv[0], VMOPTION("headless"))) return 1;
return 0;
}

Expand Down

0 comments on commit e02c546

Please sign in to comment.