1
0
mirror of https://github.com/Interlisp/maiko.git synced 2026-02-01 06:12:31 +00:00

Allow choice of foreground and background colors for Medley X11/SDL display (#511)

* Allow choice of foreground and background colors for Medley X11 display

lde/ldex Accepts -fg/-foreground <color> and -bg/-background <color>,
or the corresponding X resources ldex*foreground and ldex*background
to specify the colors that will represent the monochrome Medley display
pixels.

* Extend screen foreground/background color selection to SDL display subsystem (ldesdl)
This commit is contained in:
Nick Briggs
2024-09-09 12:56:18 -07:00
committed by GitHub
parent aa4df518a1
commit 4ad14fa832
4 changed files with 894 additions and 43 deletions

View File

@@ -288,6 +288,8 @@ const char *helpstring =
-info Print general info about the system\n\
-help Print this message\n\
-pixelscale <n> The amount of pixels to show for one Medley screen pixel.\n\
-fg/-foreground <color> Screen foreground color, default Black. X color name or #RRBBGG hex\n\
-bg/-background <color> Screen background color, default White. X color name or #RRBBGG hex\n\
-sc[reen] <w>x<h>] The Medley screen geometry\n\
-t <title> The window title\n\
-title <title> The window title\n";
@@ -316,6 +318,12 @@ const char *nethubHelpstring = "";
extern int insnsCountdownForTimerAsyncEmulation;
#endif
#if defined(XWINDOW) || defined(SDL)
char foregroundColorName[64] = {0};
extern char foregroundColorName[64];
char backgroundColorName[64] = {0};
extern char backgroundColorName[64];
#endif
/************************************************************************/
/* */
/* M A I N E N T R Y P O I N T */
@@ -488,8 +496,21 @@ int main(int argc, char *argv[])
(void)fprintf(stderr, "Missing argument after -title\n");
exit(1);
}
} else if (strcmp(argv[i], "-fg") == 0 || strcmp(argv[i], "-foreground") == 0) {
if (argc > ++i) {
strncpy(foregroundColorName, argv[i], sizeof(foregroundColorName) - 1);
} else {
(void)fprintf(stderr, "Missing argument after -fg/-foreground\n");
exit(1);
}
} else if (strcmp(argv[i], "-bg") == 0 || strcmp(argv[i], "-background") == 0) {
if (argc > ++i) {
strncpy(backgroundColorName, argv[i], sizeof(backgroundColorName) - 1);
} else {
(void)fprintf(stderr, "Missing argument after -bg/-background\n");
exit(1);
}
}
#endif /* SDL */
/* Can only do this under SUNOs, for now */
else if (!strcmp(argv[i], "-E")) { /**** ethernet info ****/