pax_global_header00006660000000000000000000000064143671446710014527gustar00rootroot0000000000000052 comment=baa949d59ff875b8f9863e26c7b422b6985edff6 9menu-9menu-release-1.11/000077500000000000000000000000001436714467100151575ustar00rootroot000000000000009menu-9menu-release-1.11/9menu.1000066400000000000000000000117371436714467100163070ustar00rootroot00000000000000.TH 9MENU 1 "Feb 3 2023" .SH NAME 9menu \- create a menu to run commands .SH SYNOPSIS .B 9menu [ .BI \-bg " background-color" ] [ .BI \-display " displayname" ] [ .BI \-file " name" ] [ .BI \-fg " foreground-color" ] [ .BI \-font " fname" ] [ .BI \-geometry " geom" ] [ .B \-iconic ] [ .BI \-label " name" ] [ .B \-path ] [ .B \-popdown ] [ .B \-popup ] [ .BI \-shell " prog" ] [ .B \-teleport ] [ .B \-version ] [ .B \-warp ] .IR menuitem [: command ] \&... .SH DESCRIPTION .I 9menu is a simple program that accepts a list of menu item and command pairs on the command line. It creates a window that consists of nothing but a menu. When a particular item is selected, the corresponding command is executed. .PP Either .B Button1 or .B Button3 may be used to select an item. Alternatively, the UP-ARROW and DOWN-ARROW cursor keys may be used to highlight different items, with ENTER used to select the highlighted item. .PP Menu items and commands are separated by a colon. The colon and command are optional. If they are missing, then the menu item is assumed to be a command that can be executed directly. .PP A menu item consisting of the word .B exit causes .I 9menu to exit when it is selected. Otherwise, to stop .IR 9menu , delete it using the window manager. The .B exit menu item can be anywhere in the list, although by convention it is last. If a command is supplied along with the .B exit item, that command is executed before .I 9menu exits. .PP If a menu item's command starts with the word .BR exec , .I 9menu ceases operating after launching it. .PP .I 9menu accepts the following command line options, listed alphabetically: .TP .BI \-bg " background-color" Set the background color to .IR background-color . By default, the background color is white. .TP .BI \-display " displayname" Use the X display .IR displayname , instead of the default display. .TP .BI \-file " filename" Read items to display from .IR filename , in addition to any other command line arguments. This is intended for use with .B #! in scripts. A .I filename of .B - causes .I 9menu to read items from standard input. .TP .BI \-fg " foreground-color" Set the foreground color to .IR foreground-color . By default, the foreground color is black. .TP .BI \-font " fname" Use the font .IR fname , instead of one of the default fonts built into .IR 9wm . .TP .BI \-geometry " geom" Use .I geom (a geometry in standard X format) as the geometry of the menu. This is most useful for specifying the initial location of the menu. Note that .I 9menu overrides the size part of the geometry specification. The window is always just large enough to hold the menu. .TP .B \-iconic Start up in the iconified state. .TP .BI \-label " name" Change both the window and icon labels of the window to .IR name . The default label is the last component of the path used to run .IR 9menu , typically, .BR 9menu . .TP .B \-path Append the current directory to the command search path. .TP .B \-popdown Once an item is selected, automatically iconify the menu window. .TP .B \-popup Act like a pop-up menu. Once a menu item is selected, .I 9menu exits. This option overrides .BR \-popdown . .TP .BI \-shell " prog" Use .I prog as the shell to run commands, instead of .BR /bin/sh . A popular alternative shell is .IR rc (1). If the shell cannot be executed, .I 9menu then .I silently falls back to using .BR /bin/sh . .TP .B \-teleport Move the menu to where the mouse is when the menu is uniconified. This option is particularly useful when combined with .BR \-popdown . .TP .B \-version Print the version of .I 9menu on the standard output, and then exit with an exit value of zero. .TP .B \-warp Warp the mouse to the menu when the menu is uniconified. After the selection is made, restore the mouse to where it was. This option is particularly useful when combined with .BR \-popdown . .PP .I 9menu grabs the focus so that the UP and DOWN arrow keys will work. .SH EXAMPLES .ft B .nf 9menu \-label Remotes xterm 'acme:ssh acme xterm' 'herman:ssh herman 9term' & .sp 9menu \-label 'X progs' gv xdvi xeyes xneko exit & .ft .fi .SH SEE ALSO .IR sam (1), .IR 9term (1), .IR 9wm (1), .IR rc (1). .PP .IR "The Plan 9 Programmer's Manual" . .SH VERSION This man page documents .I 9menu version 1.11. .PP Source code is available from .BR ftp://ftp.freefriends.org/arnold/Source/9menu.shar.gz . .PP The code with full history is also available via Git from .BR http://github.com/arnoldrobbins/9menu . .SH BUGS This program has grown to have too many options. .SH AUTHORS The initial idea for this program was by Arnold Robbins, after having worked with John Mackin's GWM Blit emulation. Matty Farrow wrote a version using libXg, from which some ideas were borrowed. This code was written by David Hogan and Arnold Robbins. Rich Salz motivated the .B \-shell option. Christopher Platt motivated the .B \-teleport option. John O'Donnell supplied the basic code for the .B \-fg and .B \-bg options. Peter Seebach provided the base code for the .B \-file and .B \-path options. Matthias Bauer made it work with the keyboard. 9menu-9menu-release-1.11/9menu.c000066400000000000000000000503261436714467100163660ustar00rootroot00000000000000/* * 9menu.c * * This program puts up a window that is just a menu, and executes * commands that correspond to the items selected. * * Initial idea: Arnold Robbins * Version using libXg: Matty Farrow (some ideas borrowed) * This code by: David Hogan and Arnold Robbins * * Copyright (c), Arnold Robbins and David Hogan * * Arnold Robbins * arnold@skeeve.com * October, 1994 * * Code added to cause pop-up (unIconify) to move menu to mouse. * Christopher Platt * platt@coos.dartmouth.edu * May, 1995 * * Said code moved to -teleport option, and -warp option added. * Arnold Robbins * June, 1995 * * Code added to allow -fg and -bg colors. * John M. O'Donnell * odonnell@stpaul.lampf.lanl.gov * April, 1997 * * Code added for -file and -path options. * Peter Seebach * seebs@plethora.net * October, 2001 * * Code added to allow up and down arrow keys to go up * and down menu and RETURN to select an item. * Matthias Bauer * bauerm@immd1.informatik.uni-erlangen.de * June, 2003 * * spawn() changed to do exec directly if -popup, based on * suggestion from * Andrew Stribblehill * a.d.stribblehill@durham.ac.uk * June, 2004 * * Allow "-" to mean read info from stdin. * suggestion from * Peter Bailey, by way of * Andrew Stribblehill * a.d.stribblehill@durham.ac.uk * August, 2005 * * Fix compile warnings (getcwd and getting a key sym). * Arnold Robbins * January, 2015. * * Let 9menu get the focus so that the arrow keys can be * used. Report and fix from Ullrich Horlacher. * framstag@rus.uni-stuttgart.de * January, 2023. */ #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include char version[] = "9menu version 1.11"; Display *dpy; /* lovely X stuff */ int screen; Window root; Window menuwin; GC gc; unsigned long black; unsigned long white; char *fgcname = NULL; char *bgcname = NULL; Colormap defcmap; XColor color; XFontStruct *font; Atom wm_protocols; Atom wm_delete_window; int g_argc; /* for XSetWMProperties to use */ char **g_argv; int f_argc; /* for labels read from files */ char **f_argv; char *geometry = ""; int savex, savey; Window savewindow; char *fontlist[] = { /* default font list if no -font */ "pelm.latin1.9", "lucm.latin1.9", "blit", "9x15bold", "9x15", "lucidasanstypewriter-12", "fixed", NULL }; /* the 9menu icon, for garish window managers */ #define nine_menu_width 40 #define nine_menu_height 40 static unsigned char nine_menu_bits[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x04, 0x00, 0x80, 0xe0, 0x01, 0x04, 0x00, 0x80, 0xe0, 0x00, 0xfc, 0xff, 0xff, 0xe0, 0x01, 0xfc, 0xff, 0xff, 0x20, 0x03, 0x04, 0x00, 0x80, 0x00, 0x06, 0x04, 0x00, 0x80, 0x00, 0x0c, 0xfc, 0xff, 0xff, 0x00, 0x08, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0x04, 0x00, 0x80, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; /* Modify this to your liking */ #define CONFIG_MENU_UP_KEY XK_Up #define CONFIG_MENU_DOWN_KEY XK_Down #define CONFIG_MENU_SELECT_KEY XK_Return char *progname; /* my name */ char *displayname; /* X display */ char *fontname; /* font */ char *labelname; /* window and icon name */ char *filename; /* file to read options or labels from */ bool popup = false; /* true if we're a popup window */ bool popdown = false; /* autohide after running a command */ bool iconic = false; /* start iconified */ bool teleport = false; /* teleport the menu */ bool warp = false; /* warp the mouse */ char **labels; /* list of labels and commands */ char **commands; int numitems; char *shell = "/bin/sh"; /* default shell */ extern void usage(), run_menu(), spawn(char *com), ask_wm_for_delete(); extern void reap(int sig), set_wm_hints(int wide, int high); extern void redraw(int cur, int high, int wide); extern void teleportmenu(int cur, int wide, int high); extern void warpmouse(int cur, int wide, int high); extern void restoremouse(); extern void memory(char *msg); extern int args(int argc, char **argv); /* memory --- print the out of memory message and die */ void memory(char *s) { fprintf(stderr, "%s: couldn't allocate memory for %s: %s\n", progname, s, strerror(errno)); exit(1); } /* args --- go through the argument list, set options */ int args(int argc, char **argv) { int i; if (argc == 0 || argv == NULL || argv[0][0] == '\0') return -1; for (i = 0; i < argc && argv[i] != NULL; i++) { if (strcmp(argv[i], "-display") == 0) { displayname = argv[i+1]; i++; } else if (strcmp(argv[i], "-file") == 0) { filename = argv[i+1]; i++; } else if (strcmp(argv[i], "-font") == 0) { fontname = argv[i+1]; i++; } else if (strcmp(argv[i], "-geometry") == 0) { geometry = argv[i+1]; i++; } else if (strcmp(argv[i], "-label") == 0) { labelname = argv[i+1]; i++; } else if (strcmp(argv[i], "-shell") == 0) { shell = argv[i+1]; i++; } else if (strcmp(argv[i], "-popup") == 0) popup = true; else if (strcmp(argv[i], "-popdown") == 0) popdown = true; else if (strcmp(argv[i], "-fg") == 0) fgcname = argv[++i]; else if (strcmp(argv[i], "-bg") == 0) bgcname = argv[++i]; else if (strcmp(argv[i], "-iconic") == 0) iconic = true; else if (strcmp(argv[i], "-path") == 0) { char pathbuf[MAXPATHLEN]; char *s, *t; s = getenv("PATH"); if (s != NULL) { /* append current dir to PATH */ char *cp = getcwd(pathbuf, MAXPATHLEN); t = malloc(strlen(s) + strlen(pathbuf) + 7); sprintf(t, "PATH=%s:%s", pathbuf, s); putenv(t); } } else if (strcmp(argv[i], "-teleport") == 0) teleport = true; else if (strcmp(argv[i], "-warp") == 0) warp = true; else if (strcmp(argv[i], "-version") == 0) { printf("%s\n", version); exit(0); } else if (argv[i][0] == '-') usage(); else break; } return i; } /* main --- crack arguments, set up X stuff, run the main menu loop */ int main(int argc, char **argv) { int i, j; char *cp; XGCValues gv; unsigned long mask; int nlabels = 0; g_argc = argc; g_argv = argv; /* set default label name */ if ((cp = strrchr(argv[0], '/')) == NULL) labelname = argv[0]; else labelname = ++cp; ++argv; --argc; /* and program name for diagnostics */ progname = labelname; i = args(argc, argv); numitems = argc - i; if (numitems <= 0 && filename == NULL) usage(); if (filename) { /* Read options and labels from file */ char fbuf[1024]; FILE *fp; if (strcmp(filename, "-") == 0) { fp = stdin; } else { fp = fopen(filename, "r"); } if (fp == NULL) { fprintf(stderr, "%s: couldn't open '%s': %s\n", progname, filename, strerror(errno)); exit(1); } while (fgets(fbuf, sizeof fbuf, fp)) { char *s = fbuf; strtok(s, "\n"); if (s[0] == '-') { char *temp[3]; temp[0] = s; temp[1] = strchr(s, ' '); if (temp[1]) { *(temp[1]++) = '\0'; s = malloc(strlen(temp[1]) + 1); if (s == NULL) memory("temporary argument"); strcpy(s, temp[1]); temp[1] = s; } temp[2] = 0; args(temp[1] ? 2 : 1, temp); continue; } if (s[0] == '#') continue; /* allow - in menu items to be escaped */ if (s[0] == '\\') ++s; /* allocate space */ if (f_argc < nlabels + 1) { int k; char **temp = malloc(sizeof(char *) * (f_argc + 5)); if (temp == 0) memory("temporary item"); for (k = 0; k < nlabels; k++) temp[k] = f_argv[k]; free(f_argv); f_argv = temp; f_argc += 5; } f_argv[nlabels] = malloc(strlen(s) + 1); if (f_argv[nlabels] == NULL) memory("temporary text"); strcpy(f_argv[nlabels], s); ++nlabels; } } labels = (char **) malloc((numitems + nlabels) * sizeof(char *)); commands = (char **) malloc((numitems + nlabels) * sizeof(char *)); if (commands == NULL || labels == NULL) memory("command and label arrays"); for (j = 0; j < numitems; j++) { labels[j] = argv[i + j]; if ((cp = strchr(labels[j], ':')) != NULL) { *cp++ = '\0'; commands[j] = cp; } else commands[j] = labels[j]; } /* * Now we no longer need i (our offset into argv) so we recycle it, * while keeping the old value of j! */ for (i = 0; i < nlabels; i++) { labels[j] = f_argv[i]; if ((cp = strchr(labels[j], ':')) != NULL) { *cp++ = '\0'; commands[j] = cp; } else commands[j] = labels[j]; ++j; } /* And now we merge the totals */ numitems += nlabels; dpy = XOpenDisplay(displayname); if (dpy == NULL) { fprintf(stderr, "%s: cannot open display", progname); if (displayname != NULL) fprintf(stderr, " %s", displayname); fprintf(stderr, "\n"); exit(1); } screen = DefaultScreen(dpy); root = RootWindow(dpy, screen); /* * This used to be * black = BlackPixel(dpy, screen); * white = WhitePixel(dpy, screen); */ defcmap = DefaultColormap(dpy, screen); if (fgcname == NULL || XParseColor(dpy, defcmap, fgcname, &color) == 0 || XAllocColor(dpy, defcmap, &color) == 0) black = BlackPixel(dpy, screen); else black = color.pixel; if (bgcname == NULL || XParseColor(dpy, defcmap, bgcname, &color) == 0 || XAllocColor(dpy, defcmap, &color) == 0) white = WhitePixel(dpy, screen); else white = color.pixel; /* try user's font first */ if (fontname != NULL) { font = XLoadQueryFont(dpy, fontname); if (font == NULL) fprintf(stderr, "%s: warning: can't load font %s\n", progname, fontname); } /* if no user font, try one of our default fonts */ if (font == NULL) { for (i = 0; fontlist[i] != NULL; i++) { font = XLoadQueryFont(dpy, fontlist[i]); if (font != NULL) break; } } if (font == NULL) { fprintf(stderr, "%s: fatal: cannot load a font\n", progname); exit(1); } gv.foreground = black^white; gv.background = white; gv.font = font->fid; gv.function = GXxor; gv.line_width = 0; mask = GCForeground | GCBackground | GCFunction | GCFont | GCLineWidth; gc = XCreateGC(dpy, root, mask, &gv); signal(SIGCHLD, reap); run_menu(); XCloseDisplay(dpy); exit(0); } /* spawn --- run a command */ void spawn(char *com) { int pid; static char *sh_base = NULL; if (sh_base == NULL) { sh_base = strrchr(shell, '/'); if (sh_base != NULL) sh_base++; else sh_base = shell; } /* * Since -popup means run command and exit, just * fall straight into exec code. Thus only fork * if not popup. */ if (! popup) { if (strncmp(com, "exec ", 5) != 0) { pid = fork(); if (pid < 0) { fprintf(stderr, "%s: can't fork: %s\n", progname, strerror(errno)); return; } else if (pid > 0) return; } else { com += 5; } } close(ConnectionNumber(dpy)); execl(shell, sh_base, "-c", com, NULL); execl("/bin/sh", "sh", "-c", com, NULL); _exit(1); } /* reap --- collect dead children */ void reap(int sig) { (void) wait((int *) NULL); signal(sig, reap); } /* usage --- print a usage message and die */ void usage() { fprintf(stderr, "usage: %s [-display displayname] [-font fname] ", progname); fprintf(stderr, "[-file filename] [-path]"); fprintf(stderr, "[-geometry geom] [-shell shell] [-label name] "); fprintf(stderr, "[-popup] [-popdown] [-iconic] [-teleport] "); fprintf(stderr, "[-warp] [-version] menitem:command ...\n"); exit(0); } /* run_menu --- put up the window, execute selected commands */ void run_menu() { XEvent ev; XClientMessageEvent *cmsg; KeySym key; int i, cur, old, wide, high, ico, dx, dy; dx = 0; for (i = 0; i < numitems; i++) { wide = XTextWidth(font, labels[i], strlen(labels[i])) + 4; if (wide > dx) dx = wide; } wide = dx; old = cur = -1; high = font->ascent + font->descent + 1; dy = numitems * high; set_wm_hints(wide, dy); ask_wm_for_delete(); #define MenuMask (ButtonPressMask|ButtonReleaseMask\ |LeaveWindowMask|PointerMotionMask|ButtonMotionMask\ |ExposureMask|StructureNotifyMask|KeyPressMask) XSelectInput(dpy, menuwin, MenuMask); XMapWindow(dpy, menuwin); ico = 1; /* warp to first item */ i = 0; /* save menu Item position */ for (;;) { XNextEvent(dpy, &ev); switch (ev.type) { default: fprintf(stderr, "%s: unknown ev.type %d\n", progname, ev.type); break; case ButtonRelease: /* allow button 1 or button 3 */ if (ev.xbutton.button == Button2) break; i = ev.xbutton.y/high; if (ev.xbutton.x < 0 || ev.xbutton.x > wide) break; else if (i < 0 || i >= numitems) break; if (warp) restoremouse(); if (strcmp(labels[i], "exit") == 0) { if (commands[i] != labels[i]) { spawn(commands[i]); } return; } spawn(commands[i]); if (popup) return; if (cur >= 0 && cur < numitems) XFillRectangle(dpy, menuwin, gc, 0, cur*high, wide, high); if (popdown) XIconifyWindow(dpy, menuwin, screen); cur = -1; break; case ButtonPress: case MotionNotify: old = cur; cur = ev.xbutton.y/high; if (ev.xbutton.x < 0 || ev.xbutton.x > wide) cur = -1; else if (cur < 0 || cur >= numitems) cur = -1; if (cur == old) break; if (old >= 0 && old < numitems) XFillRectangle(dpy, menuwin, gc, 0, old*high, wide, high); if (cur >= 0 && cur < numitems) XFillRectangle(dpy, menuwin, gc, 0, cur*high, wide, high); break; case KeyPress: /* http://stackoverflow.com/questions/9838385/replace-of-xkeycodetokeysym */ key = XkbKeycodeToKeysym(dpy, ev.xkey.keycode, 0, ev.xkey.state & ShiftMask ? 1 : 0); if (key != CONFIG_MENU_UP_KEY && key != CONFIG_MENU_DOWN_KEY && key != CONFIG_MENU_SELECT_KEY) break; /* adjust i so mapping will work */ if (key == CONFIG_MENU_UP_KEY) { old = cur; cur--; i--; } else if (key == CONFIG_MENU_DOWN_KEY) { old = cur; cur++; i++; } while (cur < 0) cur += numitems; cur %= numitems; if (key == CONFIG_MENU_UP_KEY || key == CONFIG_MENU_DOWN_KEY) { if (cur == old) break; if (old >= 0 && old < numitems && cur != -1) XFillRectangle(dpy, menuwin, gc, 0, old*high, wide, high); if (cur >= 0 && cur < numitems && cur != -1) XFillRectangle(dpy, menuwin, gc, 0, cur*high, wide, high); break; } if (warp) restoremouse(); if (key == CONFIG_MENU_SELECT_KEY) { if (strcmp(labels[cur], "exit") == 0) { if (commands[cur] != labels[cur]) { spawn(commands[cur]); } return; } spawn(commands[cur]); } if (popup) return; if (popdown) XIconifyWindow(dpy, menuwin, screen); break; case LeaveNotify: cur = old = -1; XClearWindow(dpy, menuwin); redraw(cur, high, wide); break; case ReparentNotify: case ConfigureNotify: /* * ignore these, they come from XMoveWindow * and are enabled by Struct.. */ break; case UnmapNotify: ico = 1; XClearWindow(dpy, menuwin); break; case MapNotify: if (ico) { if (teleport) teleportmenu(i, wide, high); else if (warp) warpmouse(i, wide, high); } XClearWindow(dpy, menuwin); redraw(cur = i, high, wide); ico = 0; break; case Expose: XClearWindow(dpy, menuwin); redraw(cur, high, wide); break; case ClientMessage: cmsg = &ev.xclient; if (cmsg->message_type == wm_protocols && cmsg->data.l[0] == wm_delete_window) return; case MappingNotify: /* why do we get this? */ break; } } } /* set_wm_hints --- set all the window manager hints */ void set_wm_hints(int wide, int high) { Pixmap iconpixmap; XWMHints *wmhints; XSizeHints *sizehints; XClassHint *classhints; XTextProperty wname, iname; if ((sizehints = XAllocSizeHints()) == NULL) memory("size hints"); if ((wmhints = XAllocWMHints()) == NULL) memory("window manager hints"); if ((classhints = XAllocClassHint()) == NULL) memory("class hints"); /* fill in hints in order to parse geometry spec */ sizehints->width = sizehints->min_width = sizehints->max_width = wide; sizehints->height = sizehints->min_height = sizehints->max_height = high; sizehints->flags = USSize|PSize|PMinSize|PMaxSize; if (XWMGeometry(dpy, screen, geometry, "", 1, sizehints, &sizehints->x, &sizehints->y, &sizehints->width, &sizehints->height, &sizehints->win_gravity) & (XValue|YValue)) sizehints->flags |= USPosition; /* override -geometry for size of window */ sizehints->width = sizehints->min_width = sizehints->max_width = wide; sizehints->height = sizehints->min_height = sizehints->max_height = high; if (XStringListToTextProperty(& labelname, 1, & wname) == 0) memory("window name structure"); if (XStringListToTextProperty(& labelname, 1, & iname) == 0) memory("icon name structure"); menuwin = XCreateSimpleWindow(dpy, root, sizehints->x, sizehints->y, sizehints->width, sizehints->height, 1, black, white); iconpixmap = XCreateBitmapFromData(dpy, menuwin, nine_menu_bits, nine_menu_width, nine_menu_height); wmhints->icon_pixmap = iconpixmap; wmhints->input = True; // grab focus so can use arrow keys if (iconic) wmhints->initial_state = IconicState; else wmhints->initial_state = NormalState; wmhints->flags = IconPixmapHint | StateHint | InputHint; classhints->res_name = progname; classhints->res_class = "9menu"; #ifdef SET_PROPERTIES_MANUALLY /* * For some reason, XSetWMProperties (see below) is failing * John O'Donnell replaces it with the following commands * (this leaves out XSetWMClientMachine, * and also environment variable checking from ClassHint) */ XSetWMName(dpy, menuwin, &wname); XSetWMIconName(dpy, menuwin, &iname); XSetCommand(dpy, menuwin, g_argv, g_argc); XSetWMHints(dpy, menuwin, wmhints); XSetClassHint(dpy, menuwin, classhints); XSetWMNormalHints(dpy, menuwin, sizehints); #else XSetWMProperties(dpy, menuwin, & wname, & iname, g_argv, g_argc, sizehints, wmhints, classhints); #endif } /* ask_wm_for_delete --- jump through hoops to ask WM to delete us */ void ask_wm_for_delete() { int status; wm_protocols = XInternAtom(dpy, "WM_PROTOCOLS", False); wm_delete_window = XInternAtom(dpy, "WM_DELETE_WINDOW", False); status = XSetWMProtocols(dpy, menuwin, & wm_delete_window, 1); if (status != True) fprintf(stderr, "%s: could not ask for clean delete\n", progname); } /* redraw --- actually redraw the menu */ void redraw(int cur, int high, int wide) { int tx, ty, i; for (i = 0; i < numitems; i++) { tx = (wide - XTextWidth(font, labels[i], strlen(labels[i]))) / 2; ty = i*high + font->ascent + 1; XDrawString(dpy, menuwin, gc, tx, ty, labels[i], strlen(labels[i])); } if (cur >= 0 && cur < numitems) XFillRectangle(dpy, menuwin, gc, 0, cur*high, wide, high); } /* teleportmenu --- move the menu to the right place */ void teleportmenu(int cur, int wide, int high) { int x, y, dummy; Window wdummy; if (XQueryPointer(dpy, menuwin, &wdummy, &wdummy, &x, &y, &dummy, &dummy, &dummy)) XMoveWindow(dpy, menuwin, x-wide/2, y-cur*high-high/2); } /* warpmouse --- bring the mouse to the menu */ void warpmouse(int cur, int wide, int high) { int dummy; Window wdummy; int offset; /* move tip of pointer into middle of menu item */ offset = (font->ascent + font->descent + 1) / 2; offset += 6; /* fudge factor */ if (XQueryPointer(dpy, menuwin, &wdummy, &wdummy, &savex, &savey, &dummy, &dummy, &dummy)) XWarpPointer(dpy, None, menuwin, 0, 0, 0, 0, wide/2, cur*high-high/2+offset); } /* restoremouse --- put the mouse back where it was */ void restoremouse() { XWarpPointer(dpy, menuwin, root, 0, 0, 0, 0, savex, savey); } 9menu-9menu-release-1.11/ChangeLog000066400000000000000000000140511436714467100167320ustar00rootroot000000000000002023-02-03 Arnold D. Robbins * 9menu.c (set_wm_hints): Let 9menu get the focus so that the arrow keys can be used. Report and fix from Ullrich Horlacher. (version): Bump to 1.11. 2021-02-04 Anderson Torres * meson.build: New file. For people who prefer meson to make / imake / xmkmf. 2020-07-30 Arnold D. Robbins * 9menu.1: Some minor cleanups in troff usage and in wording. 2020-04-16 Arnold D. Robbins * 9menu.c (version): Bump to 1.10 (finally). (usage): Clean up white space in error messages. (args): Fix comparison in first int. Thanks to GCC. General: Change a number of variables from int to bool, and use . Use strerror(errno) in all relevant error messages. * 9menu.1: Increment the version. 2018-04-25 Arnold D. Robbins Updates suggested by Eric Lindblad . * 9menu.c (version): Remove the @(#) SCCS marker. Hasn't been necessary for decades, really. * 9menu.1: Update the Examples. 2016-01-07 Arnold D. Robbins * 9menu.c: Convert forward declarations to use prototypes. (run_menu): Bug fix. Increment/decrement `i' when keypress moves things up and down so that mouse moves to the right place upon remapping the window. 2015-06-25 Arnold D. Robbins * 9menu.1: Updated. 2015-03-19 Arnold D. Robbins * ChangeLog: Reconstituted from check-in logs and diffs. * 9menu.c: Typo fix. Convert all function signatures to ANSI style. * README: Update the date. 2015-01-14 Arnold D. Robbins * 9menu.c (main): Fix compile warnings. (run_menu): Call XkbKeycodeToKeysym() instead of XKeycodeToKeysym(). 2011-01-13 Arnold D. Robbins Allow - as input filename. Suggestion from Peter Bailey, by way of Andrew Stribblehill . From email August 2005. * 9menu.c (main): Allow - as input filename to mean stdin. (version): Increment to 1.9. * 9menu.1: Document same. * Makefile (CXXDEBUGFLAGS): Add -Wall. * Imakefile: Improved some. 2004-06-01 Arnold D. Robbins * README: Update the date. * 9menu.1: Update version to 1.8. * 9menu.c (main): Fix so -popup execs directly. Suggestion from Andrew Stribblehill . (version): Increment to 1.8. 2003-06-15 Arnold D. Robbins * README: Update the date. * 9menu.1: Update version to 1.7. Lots of editing and cleanup. * 9menu.c (run_menu): Make it work with the up and down arrow keys on the keyboard. Code contributed by Matthias Bauer (version): Increment to 1.7. 2002-04-16 Arnold D. Robbins * README: Update the date. * 9menu.1: Update version to 1.6. Document new options. My email address updated. * 9menu.c (main): New options, -file and -path. Code contributed by Peter Seebach , in October, 2001. My email address updated. (version): Increment to 1.6. * Makefile.noimake: Renamed from Makefile. * Imakefile: Created. * Makefile: Generated via imake. 2001-01-16 Arnold D. Robbins * README: Update the date. My email address updated. * 9menu.1: Update version to 1.5. Document new options. * 9menu.c (main): New options, -fg and -bg. Code supplied by John M. O'Donnell , in April, 1997. (version): Increment to 1.5. 1997-04-27 Arnold D. Robbins * 9menu.c (set_wm_hints): Fix typos in error messages. 1995-06-20 Arnold D. Robbins * README: Update the date. * 9menu.1: Update version to 1.4. Document new options. Option ordering regularized and consistent everywhere. * 9menu.c (main): New options, -warp and -teleport. Christopher Platt motivated the -teleport option. Option ordering regularized and consistent everywhere. (redraw, teleportmenu, warpmouse, restoremouse): New functions. (version): Increment to 1.4. 1995-01-01 Arnold D. Robbins * README: Update the date. * 9menu.c (reap): Portability fix. (usage): Fix typo. (version): Increment to 1.3. 1994-12-25 Arnold D. Robbins * README: Update the date. * 9menu.c (reap): Portability fix. (usage): Update usage. (version): Increment to 1.2. 1994-12-14 Arnold D. Robbins * README: Update the date. * 9wm.DIFF: Removed. * 9menu.c (main): Add -shell option. Motivated by Rich Salz. (run_menu): Use XTextWidth in size calculations per fix for 9wm from Dave Edmondson . Add empty MappingNotify. (version): Increment to 1.1. * 9menu.1: Document -shell option. 1994-11-10 Arnold D. Robbins * 9menu.c: Add copyright line. * README: New file. 1994-11-09 Arnold D. Robbins * 9menu.c (main): Change call to signal(). (reap): New function to reap dead children. 1994-10-31 Arnold D. Robbins * 9menu.c (main): New options -geometry and -version. -iconic changed to -popdown. (nine_menu_bits): Update the icon. (set_wm_hints): New function. (usage): Updated. (version): Increment to 1.0. * 9menu.1: Document the new options, update examples. 1994-10-23 Arnold D. Robbins * 9menu.c (nine_menu_bits): Add an icon. (main): Add -iconic option. Update comments with credits. Use labels to compute menu size. Add comments where needed. Add -popup option. (progname): Use everywhere. (usage): Updated. (run_menu): Do iconifying of menu. * 9menu.1: Created. * Makefile: Created. 1994-10-22 Arnold D. Robbins * 9menu.c: Created. Not sure of exactly when, but first check-in to RCS was on this date. 9menu-9menu-release-1.11/Imakefile000066400000000000000000000003311436714467100167650ustar00rootroot00000000000000 INCLUDES = -I$(TOP) DEPLIBS = $(DEPXLIBONLY) LOCAL_LIBRARIES = $(XLIBONLY) DEFINES = -DSHAPE #-DDEBUG -DDEBUG_EV SRCS = 9menu.c OBJS = 9menu.o ComplexProgramTarget(9menu) 9menu-9menu-release-1.11/Makefile000066400000000000000000000512061436714467100166230ustar00rootroot00000000000000# Makefile generated by imake - do not edit! # $TOG: imake.c /main/104 1998/03/24 12:45:15 kaleb $ # ---------------------------------------------------------------------- # Makefile generated from "Imake.tmpl" and # $TOG: Imake.tmpl /main/249 1997/10/13 15:28:56 kaleb $ # # # # # $XFree86: xc/config/cf/Imake.tmpl,v 3.81 2000/06/25 20:17:28 dawes Exp $ # ---------------------------------------------------------------------- all:: .SUFFIXES: .i # $TOG: Imake.cf /main/30 1998/04/28 13:55:25 barstow $ # $XFree86: xc/config/cf/Imake.cf,v 3.58 2000/06/30 17:15:05 dawes Exp $ # Keep cpp from replacing path elements containing i486/i586/i686 # ----------------------------------------------------------------------- # site-specific configuration parameters that need to come before # the platform-specific parameters - edit site.def to change # site: $TOG: site.sample /main/r64_final/1 1998/02/05 16:28:49 kaleb $ # site: $XFree86: xc/config/cf/site.def,v 3.24 2000/06/25 20:17:29 dawes Exp $ # $XFree86: xc/config/cf/xf86site.def,v 3.162 2000/05/31 07:14:52 eich Exp $ # ---------------------------------------------------------------------- # platform-specific configuration parameters - edit linux.cf to change # platform: $TOG: linux.cf /main/47 1998/04/17 11:32:51 mgreess # platform: $XFree86: xc/config/cf/linux.cf,v 3.130 2000/07/07 20:06:56 tsi Exp $ # operating system: Linux 2.2.16-22 i686 [ELF] (2.2.16) # libc: (6.1.92) # binutils: (30) # $TOG: lnxLib.rules /main/14 1998/03/16 11:15:30 mgreess $ # $XFree86: xc/config/cf/lnxLib.rules,v 3.38 2000/06/15 20:49:56 dawes Exp $ # $XFree86: xc/config/cf/xfree86.cf,v 3.303 2000/08/01 20:52:18 dawes Exp $ # $TOG: xfree86.cf /main/38 1997/10/22 13:01:59 kaleb $ AFB_DEFS = -DUSE_AFB DRIVERSDKDIR = $(USRLIBDIR)/Server DRIVERSDKMODULEDIR = $(USRLIBDIR)/Server/modules DRIVERSDKINCLUDEDIR = $(USRLIBDIR)/Server/include XF86SRC = $(SERVERSRC)/hw/xfree86 XF86COMSRC = $(XF86SRC)/common XF86PARSERSRC = $(XF86SRC)/parser XF86OSSRC = $(XF86SRC)/os-support XF86DRIVERSRC = $(XF86SRC)/drivers DRIVERSRC = $(XF86DRIVERSRC) XFREE86DOCDIR = $(DOCDIR) XFREE86PSDOCDIR = $(DOCPSDIR) XFREE86HTMLDOCDIR = $(DOCHTMLDIR) XFREE86JAPANESEDOCDIR = $(DOCDIR)/Japanese # $XConsortium: xf86.rules /main/9 1996/10/31 14:54:26 kaleb $ # $XFree86: xc/config/cf/xf86.rules,v 3.31 2000/03/31 22:55:15 dawes Exp $ # ---------------------------------------------------------------------- # site-specific configuration parameters that go after # the platform-specific parameters - edit site.def to change # site: $TOG: site.sample /main/r64_final/1 1998/02/05 16:28:49 kaleb $ # site: $XFree86: xc/config/cf/site.def,v 3.24 2000/06/25 20:17:29 dawes Exp $ # --------------------------------------------------------------------- # Imake rules for building libraries, programs, scripts, and data files # rules: $TOG: Imake.rules /main/227 1998/02/02 12:07:57 kaleb $ # # # # # rules: $XFree86: xc/config/cf/Imake.rules,v 3.76 2000/06/15 20:49:55 dawes Exp $ _NULLCMD_ = @ echo -n GLIDE2INCDIR = GLIDE3INCDIR = TKLIBNAME = TKLIBDIR = TCLLIBNAME = TCLIBDIR = PATHSEP = / SHELL = /bin/sh TOP = . CURRENT_DIR = . IMAKE = imake DEPEND = gccmakedep MKDIRHIER = mkdir -p REVPATH = revpath EXPORTLISTGEN = RMAN = rman RMANOPTIONS = -f HTML CONFIGSRC = $(TOP)/config IMAKESRC = $(CONFIGSRC)/imake DEPENDSRC = $(CONFIGSRC)/util INCROOT = /usr/X11R6/include USRLIBDIR = /usr/X11R6/lib VARLIBDIR = /var/lib SYSTEMUSRLIBDIR = /usr/lib SYSTEMUSRINCDIR = /usr/include SHLIBDIR = /usr/X11R6/lib LINTLIBDIR = $(USRLIBDIR)/lint MANPATH = /usr/X11R6/man MANSOURCEPATH = $(MANPATH)/man MANDIR = $(MANSOURCEPATH)1 LIBMANDIR = $(MANSOURCEPATH)3 FILEMANDIR = $(MANSOURCEPATH)5 MISCMANDIR = $(MANSOURCEPATH)$(MISCMANSUFFIX) DRIVERMANDIR = $(MANSOURCEPATH)$(DRIVERMANSUFFIX) LOGDIRECTORY = /var/log VARRUNDIR = /var/run VARDBDIR = /var/lib AR = ar clq BOOTSTRAPCFLAGS = CC = gcc AS = as .SUFFIXES: .cc CXX = c++ CXXFILT = c++filt CXXLIB = CXXDEBUGFLAGS = -O2 -fno-strength-reduce -Wall CXXDEPENDINCLUDES = CXXEXTRA_DEFINES = CXXEXTRA_INCLUDES = CXXSTD_DEFINES = -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE $(CXXPROJECT_DEFINES) CXXOPTIONS = CXXINCLUDES = $(INCLUDES) $(TOP_INCLUDES) $(CXXEXTRA_INCLUDES) CXXDEFINES = $(CXXINCLUDES) $(CXXSTD_DEFINES) $(THREADS_CXXDEFINES) $(CXXEXTRA_DEFINES) $(DEFINES) CXXFLAGS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(THREADS_CXXFLAGS) $(CXXDEFINES) COMPRESS = compress GZIPCMD = gzip CPP = /lib/cpp $(STD_CPP_DEFINES) RAWCPP = /lib/cpp -undef $(STD_CPP_OPTIONS) PREPROCESSCMD = cpp $(STD_CPP_DEFINES) INSTALL = install INSTALLFLAGS = -c LD = ld LEX = flex -l M4 = m4 M4FLAGS = LEXLIB = -lfl YACC = bison -y CCYACC = bison -y LINT = lint LINTLIBFLAG = -C LINTOPTS = -axz LN = ln -s MAKE = make MV = mv -f CP = cp RANLIB = ranlib RANLIBINSTFLAGS = RM = rm -f MANSUFFIX = 1x LIBMANSUFFIX = 3x FILEMANSUFFIX = 5x MISCMANSUFFIX = 7 DRIVERMANSUFFIX = 4 MANDEFS = -D__filemansuffix__=$(FILEMANSUFFIX) -D__miscmansuffix__=$(MISCMANSUFFIX) -D__drivermansuffix__=$(DRIVERMANSUFFIX) -D__projectroot__=$(PROJECTROOT) TROFF = groff -Tps NROFF = nroff MSMACROS = -ms MANMACROS = -man TBL = tbl EQN = eqn NEQN = neqn COL = col COLFLAGS = -b MODCC = gcc MODCPP = /lib/cpp MODCFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(THREAD_CFLAGS) $(ALLDEFINES) MODAS = as MODASFLAGS = MODLD = ld MODLDFLAGS = MODLDCOMBINEFLAGS = -r MODAR = ar clq MODRANLIB = STD_INCLUDES = STD_CPP_OPTIONS = -traditional STD_CPP_DEFINES = -traditional -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE $(PROJECT_DEFINES) STD_DEFINES = -Dlinux -D__i386__ -D_POSIX_C_SOURCE=199309L -D_POSIX_SOURCE -D_XOPEN_SOURCE -D_BSD_SOURCE -D_SVID_SOURCE $(PROJECT_DEFINES) EXTRA_LOAD_FLAGS = EXTRA_LDOPTIONS = EXTRA_LIBRARIES = TAGS = ctags PARALLELMFLAGS = SHAREDCODEDEF = SHLIBDEF = SHLIBLDFLAGS = -shared PICFLAGS = -fPIC CXXPICFLAGS = -fPIC PROTO_DEFINES = -DFUNCPROTO=15 -DNARROWPROTO INSTPGMFLAGS = INSTBINFLAGS = -m 0755 INSTUIDFLAGS = -m 4711 INSTLIBFLAGS = -m 0644 INSTINCFLAGS = -m 0444 INSTMANFLAGS = -m 0444 INSTDATFLAGS = -m 0444 INSTKMEMFLAGS = -m 4711 PROJECTROOT = /usr/X11R6 CDEBUGFLAGS = -O2 -fno-strength-reduce CCOPTIONS = ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(STD_INCLUDES) ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(EXTRA_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(MODULE_DEFINES) $(DEFINES) CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(MODULE_CFLAGS) $(ALLDEFINES) LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) $(DEPEND_DEFINES) LDPRELIB = -L$(USRLIBDIR) LDPOSTLIB = LDOPTIONS = $(CDEBUGFLAGS) $(CCOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_LDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS) CXXLDOPTIONS = $(CXXDEBUGFLAGS) $(CXXOPTIONS) $(EXTRA_LDOPTIONS) $(THREADS_CXXLDFLAGS) $(LOCAL_LDFLAGS) $(LDPRELIBS) LDLIBS = $(LDPOSTLIBS) $(THREADS_LIBS) $(SYS_LIBRARIES) $(EXTRA_LIBRARIES) CCLINK = $(CC) CXXLINK = $(CXX) LDSTRIPFLAGS = -x LDCOMBINEFLAGS = -r DEPENDFLAGS = # Not sure this belongs here TKLIBDIR = TKINCDIR = TKLIBNAME = TKLIBRARY = -L$(TKLIBDIR) -l$(TKLIBNAME) TCLLIBDIR = TCLINCDIR = TCLLIBNAME = TCLLIBRARY = -L$(TCLLIBDIR) -l$(TCLLIBNAME) MACROFILE = linux.cf RM_CMD = $(RM) IMAKE_DEFINES = IRULESRC = $(CONFIGDIR) IMAKE_CMD = $(IMAKE) -DUseInstalled -I$(IRULESRC) $(IMAKE_DEFINES) ICONFIGFILES = $(IRULESRC)/Imake.tmpl $(IRULESRC)/X11.tmpl $(IRULESRC)/site.def $(IRULESRC)/$(MACROFILE) $(IRULESRC)/xfree86.cf $(IRULESRC)/xf86.rules $(IRULESRC)/xf86site.def $(IRULESRC)/host.def $(EXTRA_ICONFIGFILES) # $TOG: X11.rules /main/4 1997/04/30 15:23:24 kaleb $ # $XFree86: xc/config/cf/X11.rules,v 1.4 1997/09/09 11:56:20 hohndel Exp $ # ---------------------------------------------------------------------- # X Window System Build Parameters and Rules # $TOG: X11.tmpl /main/308 1998/06/16 15:14:24 msr $ # # # # # $XFree86: xc/config/cf/X11.tmpl,v 1.72 2000/08/01 20:28:37 dawes Exp $ STICKY_DEFINES = -DHAS_STICKY_DIR_BIT FCHOWN_DEFINES = -DHAS_FCHOWN # ----------------------------------------------------------------------- # X Window System make variables; these need to be coordinated with rules XTOP = $(TOP) BINDIR = /usr/X11R6/bin BUILDINCROOT = $(TOP)/exports BUILDINCDIR = $(BUILDINCROOT)/include BUILDINCTOP = ../.. BUILDLIBDIR = $(TOP)/exports/lib BUILDLIBTOP = ../.. BUILDBINDIR = $(TOP)/exports/bin BUILDBINTOP = ../.. BUILDMODULEDIR = $(BUILDLIBDIR)/modules BUILDMODULETOP = $(BUILDLIBTOP)/.. XBUILDINCROOT = $(XTOP)/exports XBUILDINCDIR = $(XBUILDINCROOT)/include/X11 XBUILDINCTOP = ../../.. XBUILDBINDIR = $(XBUILDINCROOT)/bin INCDIR = $(INCROOT) ADMDIR = /usr/adm LIBDIR = $(USRLIBDIR)/X11 LIBEXECDIR = /usr/X11R6/libexec MODULEDIR = $(USRLIBDIR)/modules TOP_X_INCLUDES = VARDIR = /var/X11 ETCX11DIR = /etc/X11 CONFDIR = $(ETCX11DIR) DOCDIR = $(LIBDIR)/doc DOCHTMLDIR = $(DOCDIR)/html DOCPSDIR = $(DOCDIR)/PostScript FONTDIR = $(LIBDIR)/fonts ENCODINGSDIR = $(FONTDIR)/encodings XINITDIR = $(LIBDIR)/xinit XDMDIR = $(LIBDIR)/xdm XDMVARDIR = $(VARLIBDIR)/xdm TWMDIR = $(LIBDIR)/twm XSMDIR = $(LIBDIR)/xsm NLSDIR = $(LIBDIR)/nls XLOCALEDIR = $(LIBDIR)/locale PEXAPIDIR = $(LIBDIR)/PEX LBXPROXYDIR = $(LIBDIR)/lbxproxy PROXYMANAGERDIR = $(LIBDIR)/proxymngr XPRINTDIR = $(LIBDIR)/xserver XAPPLOADDIR = $(LIBDIR)/app-defaults FONTCFLAGS = -t INSTAPPFLAGS = $(INSTDATFLAGS) RGB = $(BINDIR)/rgb FONTC = $(BINDIR)/bdftopcf MKFONTDIR = $(BINDIR)/mkfontdir MKHTMLINDEX = $(BINDIR)/mkhtmlindex HTMLINDEXCMD = HtmlIndexCmd DOCUTILSRC = $(XTOP)/doc/util CLIENTSRC = $(TOP)/clients DEMOSRC = $(TOP)/demos XDOCMACROS = $(DOCUTILSRC)/macros.t XIDXMACROS = $(DOCUTILSRC)/indexmacros.t PROGRAMSRC = $(TOP)/programs LIBSRC = $(XTOP)/lib FONTSRC = $(XTOP)/fonts ENCODINGSSRC = $(FONTSRC)/encodings INCLUDESRC = $(BUILDINCROOT)/include XINCLUDESRC = $(INCLUDESRC)/X11 SERVERSRC = $(XTOP)/programs/Xserver CONTRIBSRC = $(XTOP)/../contrib UNSUPPORTEDSRC = $(XTOP)/unsupported DOCSRC = $(XTOP)/doc RGBSRC = $(XTOP)/programs/rgb BDFTOPCFSRC = $(PROGRAMSRC)/bdftopcf MKFONTDIRSRC = $(PROGRAMSRC)/mkfontdir FONTSERVERSRC = $(PROGRAMSRC)/xfs FONTINCSRC = $(XTOP)/include/fonts EXTINCSRC = $(XTOP)/include/extensions FTSOURCEDIR = $(TOP)/extras/FreeType XTTSOURCEDIR = $(TOP)/extras/X-TrueType MESASRCDIR = $(TOP)/extras/Mesa PSWRAPSRC = $(XTOP)/config/pswrap TRANSCOMMSRC = $(LIBSRC)/xtrans TRANS_INCLUDES = -I$(TRANSCOMMSRC) CONNECTION_FLAGS = -DUNIXCONN -DTCPCONN $(STICKY_DEFINES) $(FCHOWN_DEFINES) XENVLIBDIR = $(USRLIBDIR) CLIENTENVSETUP = LD_LIBRARY_PATH=$(XENVLIBDIR) # $TOG: lnxLib.tmpl /main/7 1998/03/20 14:26:41 mgreess $ # $XFree86: xc/config/cf/lnxLib.tmpl,v 3.12 1999/06/27 14:07:17 dawes Exp $ XLIBSRC = $(LIBSRC)/X11 SOXLIBREV = 6.1 DEPXONLYLIB = XONLYLIB = -lX11 LINTXONLY = $(LINTLIBDIR)/llib-lX11.ln XLIBONLY = $(XONLYLIB) XEXTLIBSRC = $(LIBSRC)/Xext SOXEXTREV = 6.4 DEPEXTENSIONLIB = EXTENSIONLIB = -lXext LINTEXTENSION = $(LINTLIBDIR)/llib-lXext.ln LINTEXTENSIONLIB = $(LINTEXTENSION) DEPXLIB = $(DEPEXTENSIONLIB) $(DEPXONLYLIB) XLIB = $(EXTENSIONLIB) $(XONLYLIB) LINTXLIB = $(LINTXONLYLIB) XSSLIBSRC = $(LIBSRC)/Xss DEPXSSLIB = $(USRLIBDIR)/libXss.a XSSLIB = -lXss LINTXSS = $(LINTLIBDIR)/llib-lXss.ln XXF86MISCLIBSRC = $(LIBSRC)/Xxf86misc DEPXXF86MISCLIB = $(USRLIBDIR)/libXxf86misc.a XXF86MISCLIB = -lXxf86misc LINTXXF86MISC = $(LINTLIBDIR)/llib-lXxf86misc.ln XXF86VMLIBSRC = $(LIBSRC)/Xxf86vm DEPXXF86VMLIB = $(USRLIBDIR)/libXxf86vm.a XXF86VMLIB = -lXxf86vm LINTXXF86VM = $(LINTLIBDIR)/llib-lXxf86vm.ln XXF86DGALIBSRC = $(LIBSRC)/Xxf86dga DEPXXF86DGALIB = $(USRLIBDIR)/libXxf86dga.a XXF86DGALIB = -lXxf86dga LINTXXF86DGA = $(LINTLIBDIR)/llib-lXxf86dga.ln XXF86RUSHLIBSRC = $(LIBSRC)/Xxf86rush DEPXXF86RUSHLIB = $(USRLIBDIR)/libXxf86rush.a XXF86RUSHLIB = -lXxf86rush LINTXXF86RUSH = $(LINTLIBDIR)/llib-lXxf86rush.ln XVLIBSRC = $(LIBSRC)/Xv DEPXVLIB = $(USRLIBDIR)/libXv.a XVLIB = -lXv LINTXV = $(LINTLIBDIR)/llib-lXv.ln XINERAMALIBSRC = $(LIBSRC)/Xinerama DEPXINERAMALIB = $(USRLIBDIR)/libXinerama.a XINERAMALIB = -lXinerama LINTXINERAMA = $(LINTLIBDIR)/llib-lXinerama.ln XINERAMALIBSRC = $(LIBSRC)/Xinerama DEPXINERAMALIB = $(USRLIBDIR)/libXinerama.a XINERAMALIB = -lXinerama LINTXINERAMA = $(LINTLIBDIR)/llib-lXinerama.ln DPSLIBSRC = $(LIBSRC)/dps SODPSREV = 1.0 DEPDPSLIB = DPSLIB = -ldps LINTDPS = $(LINTLIBDIR)/llib-ldps.ln DPSTKLIBSRC = $(LIBSRC)/dpstk SODPSTKREV = 1.0 DEPDPSTKLIB = DPSTKLIB = -ldpstk LINTDPSTK = $(LINTLIBDIR)/llib-ldpstk.ln PSRESLIBSRC = $(LIBSRC)/psres SOPSRESREV = 1.0 DEPPSRESLIB = PSRESLIB = -lpsres LINTPSRES = $(LINTLIBDIR)/llib-lpsres.ln GLXLIBSRC = $(LIBSRC)/GL SOGLREV = 1.2 DEPGLXLIB = GLXLIB = -lGL LINTGLX = $(LINTLIBDIR)/llib-lGL.ln XFONTCACHELIBSRC = $(LIBSRC)/Xfontcache DEPXFONTCACHELIB = $(USRLIBDIR)/libXfontcache.a XFONTCACHELIB = -lXfontcache LINTXFONTCACHE = $(LINTLIBDIR)/llib-lXfontcache.ln XAUTHSRC = $(LIBSRC)/Xau DEPXAUTHLIB = $(USRLIBDIR)/libXau.a XAUTHLIB = -lXau LINTXAUTH = $(LINTLIBDIR)/llib-lXau.ln XDMCPLIBSRC = $(LIBSRC)/Xdmcp DEPXDMCPLIB = $(USRLIBDIR)/libXdmcp.a XDMCPLIB = -lXdmcp LINTXDMCP = $(LINTLIBDIR)/llib-lXdmcp.ln XMUSRC = $(LIBSRC)/Xmu SOXMUREV = 6.1 DEPXMULIB = XMULIB = -lXmu LINTXMU = $(LINTLIBDIR)/llib-lXmu.ln OLDXLIBSRC = $(LIBSRC)/oldX DEPOLDXLIB = $(USRLIBDIR)/liboldX.a OLDXLIB = -loldX LINTOLDX = $(LINTLIBDIR)/llib-loldX.ln XPLIBSRC = $(LIBSRC)/Xp SOXPREV = 6.2 DEPXPLIB = XPLIB = -lXp LINTXP = $(LINTLIBDIR)/llib-lXp.ln TOOLKITSRC = $(LIBSRC)/Xt SOXTREV = 6.0 DEPXTOOLONLYLIB = XTOOLONLYLIB = -lXt LINTXTOOLONLY = $(LINTLIBDIR)/llib-lXt.ln DEPXTOOLLIB = $(DEPXTOOLONLYLIB) $(DEPSMLIB) $(DEPICELIB) XTOOLLIB = $(XTOOLONLYLIB) $(SMLIB) $(ICELIB) LINTXTOOLLIB = $(LINTXTOOLONLYLIB) XALIBSRC = $(LIBSRC)/Xa SOXAREV = 1.0 DEPXALIB = XALIB = -lXa LINTXA = $(LINTLIBDIR)/llib-lXa.ln AWIDGETSRC = $(LIBSRC)/Xaw SOXAWREV = 7.0 DEPXAWLIB = XAWLIB = -lXaw LINTXAW = $(LINTLIBDIR)/llib-lXaw.ln AWIDGET6SRC = $(LIBSRC)/Xaw6 SOXAW6REV = 6.1 DEPXAW6LIB = XAW6LIB = -lXaw LINTXAW6 = $(LINTLIBDIR)/llib-lXaw.ln XILIBSRC = $(LIBSRC)/Xi SOXINPUTREV = 6.0 DEPXILIB = XILIB = -lXi LINTXI = $(LINTLIBDIR)/llib-lXi.ln XTESTLIBSRC = $(LIBSRC)/Xtst SOXTESTREV = 6.1 DEPXTESTLIB = XTESTLIB = -lXtst LINTXTEST = $(LINTLIBDIR)/llib-lXtst.ln PEXLIBSRC = $(LIBSRC)/PEX5 SOPEXREV = 6.0 DEPPEXLIB = PEXLIB = -lPEX5 LINTPEX = $(LINTLIBDIR)/llib-lPEX5.ln XIELIBSRC = $(LIBSRC)/XIE SOXIEREV = 6.0 DEPXIELIB = XIELIB = -lXIE LINTXIE = $(LINTLIBDIR)/llib-lXIE.ln PHIGSLIBSRC = $(LIBSRC)/PHIGS DEPPHIGSLIB = $(USRLIBDIR)/libphigs.a PHIGSLIB = -lphigs LINTPHIGS = $(LINTLIBDIR)/llib-lphigs.ln DEPXBSDLIB = $(USRLIBDIR)/libXbsd.a XBSDLIB = -lXbsd LINTXBSD = $(LINTLIBDIR)/llib-lXbsd.ln ICESRC = $(LIBSRC)/ICE SOICEREV = 6.3 DEPICELIB = ICELIB = -lICE LINTICE = $(LINTLIBDIR)/llib-lICE.ln SMSRC = $(LIBSRC)/SM SOSMREV = 6.0 DEPSMLIB = SMLIB = -lSM LINTSM = $(LINTLIBDIR)/llib-lSM.ln XKEYSRC = $(LIBSRC)/Xkey SOXKEYREV = 6.0 DEPXKEYLIB = XKEYLIB = -lXkey LINTXKEY = $(LINTLIBDIR)/llib-lXkey.ln FSLIBSRC = $(LIBSRC)/FS DEPFSLIB = $(USRLIBDIR)/libFS.a FSLIB = -lFS LINTFS = $(LINTLIBDIR)/llib-lFS.ln FONTLIBSRC = $(LIBSRC)/font SOFONTREV = 1.3 DEPFONTLIB = FONTLIB = -L$(FREETYPELIBDIR) -L$(FONTLIBSRC) -lXfont LINTXFONT = $(LINTLIBDIR)/llib-lXfont.ln # SOFONTREV = 1.3 DEPXFONTLIB = XFONTLIB = -lXfont LINTXFONT = $(LINTLIBDIR)/llib-lXfont.ln FONTSTUBLIBSRC = $(FONTLIBSRC)/stubs DEPFONTSTUBLIB = $(USRLIBDIR)/libfntstubs.a FONTSTUBLIB = -lfntstubs LINTFONTSTUB = $(LINTLIBDIR)/llib-lfntstubs.ln DEPFONTLIB = $(DEPXFONTLIB) $(DEPFONTSTUBLIB) FONTLIB = $(XFONTLIB) $(FONTSTUBLIB) XPMLIBSRC = $(LIBSRC)/Xpm SOXPMREV = 4.11 DEPXPMLIB = XPMLIB = -lXpm LINTXPM = $(LINTLIBDIR)/llib-lXpm.ln XKBFILELIBSRC = $(LIBSRC)/xkbfile DEPXKBFILELIB = $(USRLIBDIR)/libxkbfile.a XKBFILELIB = -lxkbfile LINTXKBFILE = $(LINTLIBDIR)/llib-lxkbfile.ln XKBCOMPCMD = $(BINDIR)/xkbcomp XKBUILIBSRC = $(LIBSRC)/xkbui DEPXKBUILIB = $(USRLIBDIR)/libxkbui.a XKBUILIB = -lxkbui LINTXKBUI = $(LINTLIBDIR)/llib-lxkbui.ln DEPLIBS = $(DEPXAWLIB) $(DEPXMULIB) $(DEPXTOOLLIB) $(DEPXLIB) DEPLIBS1 = $(DEPLIBS) DEPLIBS2 = $(DEPLIBS) DEPLIBS3 = $(DEPLIBS) DEPLIBS4 = $(DEPLIBS) DEPLIBS5 = $(DEPLIBS) DEPLIBS6 = $(DEPLIBS) DEPLIBS7 = $(DEPLIBS) DEPLIBS8 = $(DEPLIBS) DEPLIBS9 = $(DEPLIBS) DEPLIBS10 = $(DEPLIBS) XMULIBONLY = -lXmu XMULIB = $(XMULIBONLY) $(XTOOLLIB) $(XLIB) CONFIGDIR = $(LIBDIR)/config USRLIBDIRPATH = $(USRLIBDIR) LDPRELIBS = -L$(USRLIBDIR) LDPOSTLIBS = TOP_INCLUDES = -I$(INCROOT) $(TOP_X_INCLUDES) PROJECT_DEFINES = CXXPROJECT_DEFINES = # ---------------------------------------------------------------------- # start of Imakefile INCLUDES = -I$(TOP) DEPLIBS = $(DEPXLIB) LOCAL_LIBRARIES = $(XLIB) DEFINES = -DSHAPE #-DDEBUG -DDEBUG_EV SRCS = 9menu.c OBJS = 9menu.o PROGRAM = 9menu all:: 9menu 9menu: $(OBJS) $(DEPLIBS) $(RM) $@ $(CCLINK) -o $@ $(LDOPTIONS) $(OBJS) $(LOCAL_LIBRARIES) $(LDLIBS) $(EXTRA_LOAD_FLAGS) install:: 9menu @if [ -d $(DESTDIR)$(BINDIR) ]; then set +x; \ else (set -x; $(MKDIRHIER) $(DESTDIR)$(BINDIR)); fi $(INSTALL) $(INSTALLFLAGS) $(INSTPGMFLAGS) 9menu $(DESTDIR)$(BINDIR)/9menu install.man:: 9menu.man @if [ -d $(DESTDIR)$(MANDIR) ]; then set +x; \ else (set -x; $(MKDIRHIER) $(DESTDIR)$(MANDIR)); fi $(INSTALL) $(INSTALLFLAGS) $(INSTMANFLAGS) 9menu.man $(DESTDIR)$(MANDIR)/9menu.$(MANSUFFIX) depend:: $(DEPEND) $(DEPENDFLAGS) -- $(ALLDEFINES) $(DEPEND_DEFINES) -- $(SRCS) lint: $(LINT) $(LINTFLAGS) $(SRCS) $(LINTLIBS) lint1: $(LINT) $(LINTFLAGS) $(FILE) $(LINTLIBS) clean:: $(RM) 9menu # ---------------------------------------------------------------------- # common rules for all Makefiles - do not edit .c.i: $(RM) $@ $(CC) -E $(CFLAGS) $(_NOOP_) $*.c > $@ .SUFFIXES: .s .c.s: $(RM) $@ $(CC) -S $(CFLAGS) $(_NOOP_) $*.c emptyrule:: clean:: $(RM) *.CKP *.ln *.BAK *.bak *.o core errs ,* *~ *.a .emacs_* tags TAGS make.log MakeOut "#"* Makefile:: -@if [ -f Makefile ]; then set -x; \ $(RM) Makefile.bak; $(MV) Makefile Makefile.bak; \ else exit 0; fi $(IMAKE_CMD) -DTOPDIR=$(TOP) -DCURDIR=$(CURRENT_DIR) tags:: $(TAGS) -w *.[ch] $(TAGS) -xw *.[ch] > TAGS man_keywords:: html_index:: # ---------------------------------------------------------------------- # empty rules for directories that do not have SUBDIRS - do not edit install:: @echo "install in $(CURRENT_DIR) done" install.man:: @echo "install.man in $(CURRENT_DIR) done" install.sdk:: @echo "install.sdk in $(CURRENT_DIR) done" Makefiles:: includes:: depend:: # ---------------------------------------------------------------------- # dependencies generated by makedepend 9menu-9menu-release-1.11/Makefile.noimake000066400000000000000000000002651436714467100202440ustar00rootroot00000000000000# Makefile for 9menu. # # Edit to taste # # Arnold Robbins # arnold@skeeve.atl.ga.us CC = gcc CFLAGS = -g -O LIBS = -lX11 9menu: 9menu.c $(CC) $(CFLAGS) 9menu.c $(LIBS) -o 9menu 9menu-9menu-release-1.11/README000066400000000000000000000027061436714467100160440ustar00rootroot00000000000000Wed Feb 24 17:11:01 IST 2021 This is 9menu, a simple program that allows you to create X menus from the shell, where each menu item will run a command. 9menu is intended for use with 9wm, but can be used with any other window manager. The idea of a command line menu generator is from xmenu, but xmenu was exclusively a pop-up menu, not what I wanted. The files are: README --- this file 9menu.1 --- man page for 9menu 9menu.c --- source code Imakefile --- a contributed Imakefile, from Bengt Kleberg Makefile.noimake --- a simple makefile. meson.build --- for people who prefer meson. Licence ======= 9menu is free software, and is Copyright (c) 1994 by David Hogan and Arnold Robbins. Permission is granted to all sentient beings to use this software, to make copies of it, and to distribute those copies, provided that: (1) the copyright and licence notices are left intact (2) the recipients are aware that it is free software (3) any unapproved changes in functionality are either (i) only distributed as patches or (ii) distributed as a new program which is not called 9menu and whose documentation gives credit where it is due (4) the authors are not held responsible for any defects or shortcomings in the software, or damages caused by it. There is no warranty for this software. Have a nice day. -- Arnold Robbins arnold@skeeve.com 9menu-9menu-release-1.11/meson.build000066400000000000000000000004551436714467100173250ustar00rootroot00000000000000# meson.build for 9menu # license: public domain # Contributed by Anderson Torres, February 2021 project ('9menu', 'c') executable ('9menu', '9menu.c', install: true, dependencies: [ dependency('x11'), dependency('xext') ]) install_man ('9menu.1')