Browse Source

Remove user defined function feature

After the previous commit there's no need. The only place
they were of use now has builtins for the same purpose.
master
Mike Small 1 year ago
parent
commit
39038bddb6
  1. 10
      ChangeLog
  2. 3
      README
  3. 14
      man/twmruined.man
  4. 2
      src/gram.h
  5. 17
      src/gram.y
  6. 26
      src/menus.cc
  7. 2
      src/parse.c
  8. 1
      src/parse.h

10
ChangeLog

@ -1,3 +1,13 @@
2021-04-03 Mike Small <smallm@sdf.org>
* src/parse.c (keytable): remove function keyword form parse table
* src/menus.cc (ExecuteFunction): don't look for custom functions to run
* src/gram.y: remove function token and grammar production
* man/twmruined.man: remove mention of user-defined functions
2021-02-15 Mike Small <smallm@sdf.org>
* man/twmruined.man: replace a reference to move-or-lower,

3
README

@ -9,7 +9,8 @@ Features removed...
Zoom, MoveDelta
2. builtin functions: DeltaStop
3. default user defined functions: move-or-lower, move-or-raise,
and move-or-iconify (changed to builtins).
and move-or-iconify (changed to builtins) and the ability to define
user defined functions.
Changes ...

14
man/twmruined.man

@ -46,7 +46,7 @@ twmruined \- No longer quite the Tab Window Manager
.SH DESCRIPTION
\fITwmruined\fP is a window manager for the X Window System based on twm. It provides
titlebars, shaped windows,
several forms of icon management, user-defined macro functions,
several forms of icon management,
click-to-type and pointer-driven keyboard focus, and user-specified
key and pointer button bindings.
.PP
@ -666,19 +666,9 @@ conveniently stored in a titlebar, menu, or set of key bindings. Although
a small set of defaults are supplied (unless the \fBNoDefaults\fP is
specified), most users will want to have their most common operations
bound to key and button strokes. To do this, \fItwmruined\fP associates names
with each of the primitives and provides \fIuser-defined functions\fP for
building higher level primitives and \fImenus\fP for interactively selecting
with each of the builtin functions and \fImenus\fP for interactively selecting
among groups of functions.
.PP
User-defined functions contain the name by which they are referenced in
calls to \fBf.function\fP and a list of other functions to execute. For
example:
.EX 0
Function "restore-colormap" { f.colormap "default" f.lower }
.EE
The function name must be used in \fBf.function\fP exactly as it appears in
the function specification.
.PP
In the descriptions below, if the function is said to operate on the selected
window, but is invoked from a root menu, the cursor will be changed to
the \fBSelect\fP cursor and the next window to receive a button press will

2
src/gram.h

@ -62,7 +62,6 @@ extern int yydebug;
COLOR = 272,
SAVECOLOR = 273,
MONOCHROME = 274,
FUNCTION = 275,
WINDOW_FUNCTION = 276,
MAKE_TITLE = 277,
GRAYSCALE = 278,
@ -122,7 +121,6 @@ extern int yydebug;
#define COLOR 272
#define SAVECOLOR 273
#define MONOCHROME 274
#define FUNCTION 275
#define WINDOW_FUNCTION 276
#define MAKE_TITLE 277
#define GRAYSCALE 278

17
src/gram.y

@ -109,7 +109,7 @@ static void yyerror ( const char *s );
};
%token <num> LB RB LP RP MENUS MENU BUTTON DEFAULT_FUNCTION PLUS MINUS
%token <num> ALL OR CURSORS ICONS COLOR SAVECOLOR MONOCHROME FUNCTION
%token <num> ALL OR CURSORS ICONS COLOR SAVECOLOR MONOCHROME
%token <num> WINDOW_FUNCTION
%token <num> MAKE_TITLE GRAYSCALE
%token <num> NO_TITLE AUTO_RAISE
@ -189,8 +189,6 @@ stmt : error
menu { root->real_menu = TRUE;}
| MENU string { root = GetRoot($2, NULLSTR, NULLSTR); }
menu { root->real_menu = TRUE; }
| FUNCTION string { root = GetRoot($2, NULLSTR, NULLSTR); }
function
| ICONS { list = &Scr->IconNames; }
icon_list
| COLOR { color = COLOR; }
@ -453,19 +451,6 @@ icon_entries : /* Empty */
icon_entry : string string { if (Scr->FirstTime) AddToList(list, $1, $2); }
;
function : LB function_entries RB
;
function_entries: /* Empty */
| function_entries function_entry
;
function_entry : action { AddToMenu(root, "", Action, NULL, $1,
NULLSTR, NULLSTR);
Action = "";
}
;
menu : LB menu_entries RB
;

26
src/menus.cc

@ -1712,32 +1712,6 @@ ExecuteFunction(int func, const char *action, Window w, TwmWindow *tmp_win,
break;
case F_FUNCTION:
{
MenuRoot *mroot;
MenuItem *mitem;
if ((mroot = FindMenuRoot(action)) == NULL)
{
fprintf (stderr, "%s: couldn't find function \"%s\"\n",
ProgramName, action);
return TRUE;
}
if (NeedToDefer(mroot) && DeferExecution(context, func, Scr->SelectCursor))
return true;
else
{
for (mitem = mroot->first; mitem != NULL; mitem = mitem->next)
{
if (!ExecuteFunction (mitem->func, mitem->action, w,
tmp_win, eventp, context, pulldown))
break;
}
}
}
break;
case F_DEICONIFY:
case F_ICONIFY:
if (DeferExecution(context, func, Scr->SelectCursor))

2
src/parse.c

@ -405,7 +405,6 @@ static TwmKeyword keytable[] = {
{ "f.focus", FKEYWORD, F_FOCUS },
{ "f.forcemove", FKEYWORD, F_FORCEMOVE },
{ "f.fullzoom", FKEYWORD, F_FULLZOOM },
{ "f.function", FSKEYWORD, F_FUNCTION },
{ "f.hbzoom", FKEYWORD, F_BOTTOMZOOM },
{ "f.horizoom", FKEYWORD, F_HORIZOOM },
{ "f.htzoom", FKEYWORD, F_TOPZOOM },
@ -448,7 +447,6 @@ static TwmKeyword keytable[] = {
{ "forceicons", KEYWORD, kw0_ForceIcons },
{ "frame", FRAME, 0 },
{ "framepadding", NKEYWORD, kwn_FramePadding },
{ "function", FUNCTION, 0 },
{ "grayscale", GRAYSCALE, 0 },
{ "greyscale", GRAYSCALE, 0 },
{ "i", ICON, 0 },

1
src/parse.h

@ -131,7 +131,6 @@ extern int mods;
#define F_FILE 105 /* string */
#define F_EXEC 106 /* string */
#define F_CUT 107 /* string */
#define F_FUNCTION 108 /* string */
#define F_WARPTOSCREEN 109 /* string */
#define F_COLORMAP 110 /* string */
#define F_PRIORITY 111 /* string */

Loading…
Cancel
Save