~ctwm/ctwm/trunk

431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1
/*
2
 * Parser backend routines.
3
 *
4
 * Roughly, these are the routines that the lex/yacc output calls to do
5
 * its work.
435.1.2 by Matthew Fuller
Leave some comments on these files to point at their minor redundancy
6
 *
7
 * This is very similar to the meaning of parse_yacc.c; the two may be
8
 * merged at some point.
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
9
 */
10
11
#include "ctwm.h"
12
13
#include <stdio.h>
491.1.14 by Matthew Fuller
Remove incorrect pre-ANSI potential override prototypes for malloc()
14
#include <stdlib.h>
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
15
#include <string.h>
16
#include <strings.h>
492.2.17 by Matthew Fuller
Cleanup some unneeded X headers and canoncalize ordering. In
17
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
18
#include <X11/Xatom.h>
19
20
#include "ctwm_atoms.h"
21
#include "screen.h"
22
#include "util.h"
481.1.5 by Matthew Fuller
Pull the animation funcs/vars out into their own file.
23
#include "animate.h"
528.1.63 by Matthew Fuller
#if 0 out the old function #define's in parse.h, and add
24
#include "functions_defs.h"
481.1.13 by Matthew Fuller
GetUnknownIcon() was a 1-line function used in 1 place, so just expand
25
#include "image.h"
524.1.5 by Matthew Fuller
Pull list.h out of screen.h and #include it in the places that need
26
#include "list.h"
524.1.1 by Matthew Fuller
Pull occupation.h out of screen.h, and include it directly in the
27
#include "occupation.h"
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
28
#include "parse.h"
431.1.27 by Matthew Fuller
Break out a parse_be.h for the stuff that should only be
29
#include "parse_be.h"
435.1.5 by Matthew Fuller
Turn the defstring var into a #define, and switch to using the #define
30
#include "parse_yacc.h"
656.2.4 by Matthew Fuller
Implement the parsing and storing of override layouts.
31
#include "r_area.h"
32
#include "r_area_list.h"
33
#include "r_layout.h"
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
34
#ifdef SOUNDS
35
#  include "sound.h"
36
#endif
37
492.2.33 by Matthew Fuller
Do some more cleanup of headers including headers.
38
#include "gram.tab.h"
39
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
40
497.1.1 by Matthew Fuller
enum-ify Screen->RandomPlacement.
41
static int ParseRandomPlacement(const char *s);
497.1.5 by Matthew Fuller
const-ify arg on this last Parse func here, making it consistent with
42
static int ParseButtonStyle(const char *s);
497.1.2 by Matthew Fuller
enum-ise Screen->UsePPosition.
43
static int ParseUsePPosition(const char *s);
497.1.4 by Matthew Fuller
enum-ify IconifyStyle. Move parsing the options into a helper
44
static int ParseIconifyStyle(const char *s);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
45
46
47
48
/**********************************************************************
49
 *
50
 *  Parsing table and routines
51
 *
52
 ***********************************************************************/
53
54
typedef struct _TwmKeyword {
55
	const char *name;
56
	int value;
57
	int subnum;
58
} TwmKeyword;
59
60
#define kw0_NoDefaults                  1
61
#define kw0_AutoRelativeResize          2
62
#define kw0_ForceIcons                  3
63
#define kw0_NoIconManagers              4
64
#define kw0_InterpolateMenuColors       6
65
//#define kw0_NoVersion                 7
66
#define kw0_SortIconManager             8
67
#define kw0_NoGrabServer                9
68
#define kw0_NoMenuShadows               10
69
#define kw0_NoRaiseOnMove               11
70
#define kw0_NoRaiseOnResize             12
71
#define kw0_NoRaiseOnDeiconify          13
72
#define kw0_DontMoveOff                 14
73
#define kw0_NoBackingStore              15
74
#define kw0_NoSaveUnders                16
75
#define kw0_RestartPreviousState        17
76
#define kw0_ClientBorderWidth           18
77
#define kw0_NoTitleFocus                19
78
#define kw0_DecorateTransients          21
79
#define kw0_ShowIconManager             22
80
#define kw0_NoCaseSensitive             23
81
#define kw0_NoRaiseOnWarp               24
82
#define kw0_WarpUnmapped                25
83
#define kw0_ShowWorkspaceManager        27
84
#define kw0_StartInMapState             28
85
#define kw0_NoShowOccupyAll             29
86
#define kw0_AutoOccupy                  30
87
#define kw0_TransientHasOccupation      31
88
#define kw0_DontPaintRootWindow         32
89
#define kw0_Use3DMenus                  33
90
#define kw0_Use3DTitles                 34
91
#define kw0_Use3DIconManagers           35
92
#define kw0_Use3DBorders                36
93
#define kw0_SunkFocusWindowTitle        37
94
#define kw0_BeNiceToColormap            38
95
#define kw0_WarpRingOnScreen            40
96
#define kw0_NoIconManagerFocus          41
97
#define kw0_StayUpMenus                 42
98
#define kw0_ClickToFocus                43
99
#define kw0_BorderResizeCursors         44
100
#define kw0_ReallyMoveInWorkspaceManager 45
101
#define kw0_ShowWinWhenMovingInWmgr     46
102
#define kw0_Use3DWMap                   47
103
#define kw0_ReverseCurrentWorkspace     48
104
#define kw0_DontWarpCursorInWMap        49
105
#define kw0_CenterFeedbackWindow        50
106
#define kw0_WarpToDefaultMenuEntry      51
107
#define kw0_ShrinkIconTitles            52
108
#define kw0_AutoRaiseIcons              53
604.1.18 by Matthew Fuller
We don't need this #define anymore either, now that the var is gone.
109
//#define kw0_use3DIconBorders            54
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
110
#define kw0_UseSunkTitlePixmap          55
111
#define kw0_ShortAllWindowsMenus        56
112
#define kw0_RaiseWhenAutoUnSqueeze      57
113
#define kw0_RaiseOnClick                58
114
#define kw0_IgnoreLockModifier          59
115
#define kw0_AutoFocusToTransients       60 /* kai */
116
#define kw0_PackNewWindows              61
117
#define kw0_IgnoreCaseInMenuSelection   62
118
#define kw0_SloppyFocus                 63
119
#define kw0_NoImagesInWorkSpaceManager  64
120
#define kw0_NoWarpToMenuTitle           65
121
#define kw0_SaveWorkspaceFocus          66 /* blais */
122
#define kw0_RaiseOnWarp                 67
123
#define kw0_DontShowWelcomeWindow       68
124
#define kw0_AutoPriority                69
125
#define kw0_DontToggleWorkspacemanagerState 70
572.1.1 by Matthew Fuller
Add BackingStore config flag.
126
#define kw0_BackingStore                71
572.1.5 by Matthew Fuller
Add StartInButtonState keyword.
127
#define kw0_StartInButtonState          72
572.1.9 by Matthew Fuller
Add NoSortIconManager config var.
128
#define kw0_NoSortIconManager           73
572.1.10 by Matthew Fuller
Add and document NoRestartPreviousState.
129
#define kw0_NoRestartPreviousState      74
572.1.11 by Matthew Fuller
Add and document NoDecorateTransients.
130
#define kw0_NoDecorateTransients        75
572.1.12 by Matthew Fuller
Add and document GrabServer config var.
131
#define kw0_GrabServer                  76
602.1.1 by Matthew Fuller
Add DontNameDecorations config var.
132
#define kw0_DontNameDecorations         77
615.1.21 by Matthew Fuller
Add StrictWinNameEncoding config var, to allow restoring historical
133
#define kw0_StrictWinNameEncoding       78
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
134
135
#define kws_UsePPosition                1
136
#define kws_IconFont                    2
137
#define kws_ResizeFont                  3
138
#define kws_MenuFont                    4
139
#define kws_TitleFont                   5
140
#define kws_IconManagerFont             6
141
#define kws_UnknownIcon                 7
142
#define kws_IconDirectory               8
143
#define kws_MaxWindowSize               9
144
#define kws_PixmapDirectory             10
145
/* RandomPlacement moved because it's now a string string keyword */
146
#define kws_IconJustification           12
147
#define kws_TitleJustification          13
148
#define kws_IconRegionJustification     14
149
#define kws_IconRegionAlignement        15
150
#define kws_SoundHost                   16
151
#define kws_WMgrButtonStyle             17
152
#define kws_WorkSpaceFont               18
153
#define kws_IconifyStyle                19
154
#define kws_IconSize                    20
463.1.22 by Matthew Fuller
Add RplaySoundHost as an alias for SoundHost, with the intention of
155
#define kws_RplaySoundHost              21
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
156
157
#define kwss_RandomPlacement            1
158
159
#define kwn_ConstrainedMoveTime         1
160
#define kwn_MoveDelta                   2
161
#define kwn_XorValue                    3
162
#define kwn_FramePadding                4
163
#define kwn_TitlePadding                5
164
#define kwn_ButtonIndent                6
165
#define kwn_BorderWidth                 7
166
#define kwn_IconBorderWidth             8
167
#define kwn_TitleButtonBorderWidth      9
168
#define kwn_RaiseDelay                  10
169
#define kwn_TransientOnTop              11
170
#define kwn_OpaqueMoveThreshold         12
171
#define kwn_OpaqueResizeThreshold       13
172
#define kwn_WMgrVertButtonIndent        14
173
#define kwn_WMgrHorizButtonIndent       15
174
#define kwn_ClearShadowContrast         16
175
#define kwn_DarkShadowContrast          17
176
#define kwn_WMgrButtonShadowDepth       18
177
#define kwn_MaxIconTitleWidth           19
178
#define kwn_AnimationSpeed              20
179
#define kwn_ThreeDBorderWidth           21
180
#define kwn_MoveOffResistance           22
181
#define kwn_BorderShadowDepth           23
182
#define kwn_TitleShadowDepth            24
183
#define kwn_TitleButtonShadowDepth      25
184
#define kwn_MenuShadowDepth             26
185
#define kwn_IconManagerShadowDepth      27
186
#define kwn_MovePackResistance          28
187
#define kwn_XMoveGrid                   29
188
#define kwn_YMoveGrid                   30
189
#define kwn_OpenWindowTimeout           31
190
#define kwn_RaiseOnClickButton          32
191
192
#define kwn_BorderTop                   33
193
#define kwn_BorderBottom                34
194
#define kwn_BorderLeft                  35
195
#define kwn_BorderRight                 36
196
197
#define kwcl_BorderColor                1
198
#define kwcl_IconManagerHighlight       2
199
#define kwcl_BorderTileForeground       3
200
#define kwcl_BorderTileBackground       4
201
#define kwcl_TitleForeground            5
202
#define kwcl_TitleBackground            6
203
#define kwcl_IconForeground             7
204
#define kwcl_IconBackground             8
205
#define kwcl_IconBorderColor            9
206
#define kwcl_IconManagerForeground      10
207
#define kwcl_IconManagerBackground      11
208
#define kwcl_MapWindowBackground        12
209
#define kwcl_MapWindowForeground        13
210
211
#define kwc_DefaultForeground           1
212
#define kwc_DefaultBackground           2
213
#define kwc_MenuForeground              3
214
#define kwc_MenuBackground              4
215
#define kwc_MenuTitleForeground         5
216
#define kwc_MenuTitleBackground         6
217
#define kwc_MenuShadowColor             7
218
219
220
/*
221
 * The following is sorted alphabetically according to name (which must be
222
 * in lowercase and only contain the letters a-z).  It is fed to a binary
223
 * search to parse keywords.
224
 */
528.1.46 by Matthew Fuller
const-ify these tables.
225
static const TwmKeyword keytable[] = {
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
226
	{ "a",                      ALTER, 0 },
227
	{ "all",                    ALL, 0 },
228
	{ "alter",                  ALTER, 0 },
229
	{ "alwaysontop",            ALWAYS_ON_TOP, 0 },
230
	{ "alwaysshowwindowwhenmovingfromworkspacemanager", KEYWORD, kw0_ShowWinWhenMovingInWmgr },
231
	{ "alwayssqueezetogravity", ALWAYSSQUEEZETOGRAVITY, 0 },
232
	{ "animationspeed",         NKEYWORD, kwn_AnimationSpeed },
233
	{ "autofocustotransients",  KEYWORD, kw0_AutoFocusToTransients }, /* kai */
234
	{ "autolower",              AUTO_LOWER, 0 },
235
	{ "autooccupy",             KEYWORD, kw0_AutoOccupy },
236
	{ "autopopup",              AUTO_POPUP, 0 },
237
	{ "autopriority",           KEYWORD, kw0_AutoPriority },
238
	{ "autoraise",              AUTO_RAISE, 0 },
239
	{ "autoraiseicons",         KEYWORD, kw0_AutoRaiseIcons },
240
	{ "autorelativeresize",     KEYWORD, kw0_AutoRelativeResize },
241
	{ "autosqueeze",            AUTOSQUEEZE, 0 },
572.1.1 by Matthew Fuller
Add BackingStore config flag.
242
	{ "backingstore",           KEYWORD, kw0_BackingStore },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
243
	{ "benicetocolormap",       KEYWORD, kw0_BeNiceToColormap },
244
	{ "borderbottom",           NKEYWORD, kwn_BorderBottom },
245
	{ "bordercolor",            CLKEYWORD, kwcl_BorderColor },
246
	{ "borderleft",             NKEYWORD, kwn_BorderLeft },
247
	{ "borderresizecursors",    KEYWORD, kw0_BorderResizeCursors },
248
	{ "borderright",            NKEYWORD, kwn_BorderRight },
249
	{ "bordershadowdepth",      NKEYWORD, kwn_BorderShadowDepth },
250
	{ "bordertilebackground",   CLKEYWORD, kwcl_BorderTileBackground },
251
	{ "bordertileforeground",   CLKEYWORD, kwcl_BorderTileForeground },
252
	{ "bordertop",              NKEYWORD, kwn_BorderTop },
253
	{ "borderwidth",            NKEYWORD, kwn_BorderWidth },
254
	{ "button",                 BUTTON, 0 },
255
	{ "buttonindent",           NKEYWORD, kwn_ButtonIndent },
256
	{ "c",                      CONTROL, 0 },
496.1.24 by Matthew Fuller
Rename the parser name for the lef/center/right keywords used in
257
	{ "center",                 SIJENUM, SIJ_CENTER },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
258
	{ "centerfeedbackwindow",   KEYWORD, kw0_CenterFeedbackWindow },
259
	{ "changeworkspacefunction", CHANGE_WORKSPACE_FUNCTION, 0 },
260
	{ "clearshadowcontrast",    NKEYWORD, kwn_ClearShadowContrast },
261
	{ "clicktofocus",           KEYWORD, kw0_ClickToFocus },
262
	{ "clientborderwidth",      KEYWORD, kw0_ClientBorderWidth },
263
	{ "color",                  COLOR, 0 },
264
	{ "constrainedmovetime",    NKEYWORD, kwn_ConstrainedMoveTime },
265
	{ "control",                CONTROL, 0 },
266
	{ "cursors",                CURSORS, 0 },
267
	{ "darkshadowcontrast",     NKEYWORD, kwn_DarkShadowContrast },
268
	{ "decoratetransients",     KEYWORD, kw0_DecorateTransients },
269
	{ "defaultbackground",      CKEYWORD, kwc_DefaultBackground },
270
	{ "defaultforeground",      CKEYWORD, kwc_DefaultForeground },
271
	{ "defaultfunction",        DEFAULT_FUNCTION, 0 },
272
	{ "deiconifyfunction",      DEICONIFY_FUNCTION, 0 },
273
	{ "destroy",                KILL, 0 },
274
	{ "donticonifybyunmapping", DONT_ICONIFY_BY_UNMAPPING, 0 },
275
	{ "dontmoveoff",            KEYWORD, kw0_DontMoveOff },
602.1.1 by Matthew Fuller
Add DontNameDecorations config var.
276
	{ "dontnamedecorations",    KEYWORD, kw0_DontNameDecorations },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
277
	{ "dontpaintrootwindow",    KEYWORD, kw0_DontPaintRootWindow },
278
	{ "dontsave",               DONT_SAVE, 0 },
279
	{ "dontsetinactive",        DONTSETINACTIVE, 0 },
280
	{ "dontshowwelcomewindow",  KEYWORD, kw0_DontShowWelcomeWindow },
281
	{ "dontsqueezetitle",       DONT_SQUEEZE_TITLE, 0 },
282
	{ "donttoggleworkspacemanagerstate", KEYWORD, kw0_DontToggleWorkspacemanagerState},
283
	{ "dontwarpcursorinwmap",   KEYWORD, kw0_DontWarpCursorInWMap },
513.1.8 by Matthew Fuller
Swap to the new enum for these gravity values, and retire the old
284
	{ "east",                   GRAVITY, GRAV_EAST },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
285
	{ "ewmhignore",             EWMH_IGNORE, 0 },
286
	{ "f",                      FRAME, 0 },
567.2.3 by Matthew Fuller
Add ForceFocus config param.
287
	{ "forcefocus",             FORCE_FOCUS, 0 },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
288
	{ "forceicons",             KEYWORD, kw0_ForceIcons },
289
	{ "frame",                  FRAME, 0 },
290
	{ "framepadding",           NKEYWORD, kwn_FramePadding },
291
	{ "function",               FUNCTION, 0 },
572.1.12 by Matthew Fuller
Add and document GrabServer config var.
292
	{ "grabserver",             KEYWORD, kw0_GrabServer },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
293
	{ "i",                      ICON, 0 },
294
	{ "icon",                   ICON, 0 },
295
	{ "iconbackground",         CLKEYWORD, kwcl_IconBackground },
296
	{ "iconbordercolor",        CLKEYWORD, kwcl_IconBorderColor },
297
	{ "iconborderwidth",        NKEYWORD, kwn_IconBorderWidth },
298
	{ "icondirectory",          SKEYWORD, kws_IconDirectory },
299
	{ "iconfont",               SKEYWORD, kws_IconFont },
300
	{ "iconforeground",         CLKEYWORD, kwcl_IconForeground },
301
	{ "iconifybyunmapping",     ICONIFY_BY_UNMAPPING, 0 },
302
	{ "iconifyfunction",        ICONIFY_FUNCTION, 0 },
303
	{ "iconifystyle",           SKEYWORD, kws_IconifyStyle },
304
	{ "iconjustification",      SKEYWORD, kws_IconJustification },
305
	{ "iconmanagerbackground",  CLKEYWORD, kwcl_IconManagerBackground },
306
	{ "iconmanagerdontshow",    ICONMGR_NOSHOW, 0 },
307
	{ "iconmanagerfont",        SKEYWORD, kws_IconManagerFont },
308
	{ "iconmanagerforeground",  CLKEYWORD, kwcl_IconManagerForeground },
309
	{ "iconmanagergeometry",    ICONMGR_GEOMETRY, 0 },
310
	{ "iconmanagerhighlight",   CLKEYWORD, kwcl_IconManagerHighlight },
311
	{ "iconmanagers",           ICONMGRS, 0 },
312
	{ "iconmanagershadowdepth", NKEYWORD, kwn_IconManagerShadowDepth },
313
	{ "iconmanagershow",        ICONMGR_SHOW, 0 },
314
	{ "iconmenudontshow",       ICONMENU_DONTSHOW, 0 },
315
	{ "iconmgr",                ICONMGR, 0 },
316
	{ "iconregion",             ICON_REGION, 0 },
317
	{ "iconregionalignement",   SKEYWORD, kws_IconRegionAlignement },
318
	{ "iconregionjustification", SKEYWORD, kws_IconRegionJustification },
319
	{ "icons",                  ICONS, 0 },
320
	{ "iconsize",               SKEYWORD, kws_IconSize },
321
	{ "ignorecaseinmenuselection",      KEYWORD, kw0_IgnoreCaseInMenuSelection },
322
	{ "ignorelockmodifier",     KEYWORD, kw0_IgnoreLockModifier },
323
	{ "ignoremodifier",         IGNOREMODIFIER, 0 },
324
	{ "ignoretransient",        IGNORE_TRANSIENT, 0 },
325
	{ "interpolatemenucolors",  KEYWORD, kw0_InterpolateMenuColors },
326
	{ "l",                      LOCK, 0 },
496.1.24 by Matthew Fuller
Rename the parser name for the lef/center/right keywords used in
327
	{ "left",                   SIJENUM, SIJ_LEFT },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
328
	{ "lefttitlebutton",        LEFT_TITLEBUTTON, 0 },
329
	{ "lock",                   LOCK, 0 },
330
	{ "m",                      META, 0 },
331
	{ "maketitle",              MAKE_TITLE, 0 },
332
	{ "mapwindowbackground",    CLKEYWORD, kwcl_MapWindowBackground },
333
	{ "mapwindowcurrentworkspace", MAPWINDOWCURRENTWORKSPACE, 0},
334
	{ "mapwindowdefaultworkspace", MAPWINDOWDEFAULTWORKSPACE, 0},
335
	{ "mapwindowforeground",    CLKEYWORD, kwcl_MapWindowForeground },
336
	{ "maxicontitlewidth",      NKEYWORD, kwn_MaxIconTitleWidth },
337
	{ "maxwindowsize",          SKEYWORD, kws_MaxWindowSize },
338
	{ "menu",                   MENU, 0 },
339
	{ "menubackground",         CKEYWORD, kwc_MenuBackground },
340
	{ "menufont",               SKEYWORD, kws_MenuFont },
341
	{ "menuforeground",         CKEYWORD, kwc_MenuForeground },
342
	{ "menushadowcolor",        CKEYWORD, kwc_MenuShadowColor },
343
	{ "menushadowdepth",        NKEYWORD, kwn_MenuShadowDepth },
344
	{ "menutitlebackground",    CKEYWORD, kwc_MenuTitleBackground },
345
	{ "menutitleforeground",    CKEYWORD, kwc_MenuTitleForeground },
346
	{ "meta",                   META, 0 },
347
	{ "mod",                    META, 0 },  /* fake it */
656.2.3 by Matthew Fuller
Skeletonize in code for MonitorLayout {} parsing. Doesn't do
348
	{ "monitorlayout",          MONITOR_LAYOUT, 0 },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
349
	{ "monochrome",             MONOCHROME, 0 },
350
	{ "move",                   MOVE, 0 },
351
	{ "movedelta",              NKEYWORD, kwn_MoveDelta },
352
	{ "moveoffresistance",      NKEYWORD, kwn_MoveOffResistance },
353
	{ "movepackresistance",     NKEYWORD, kwn_MovePackResistance },
473.1.6 by Matthew Fuller
Add a config entry to hold bits for ignoring MWM hints.
354
	{ "mwmignore",              MWM_IGNORE, 0 },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
355
	{ "nobackingstore",         KEYWORD, kw0_NoBackingStore },
356
	{ "noborder",               NO_BORDER, 0 },
357
	{ "nocasesensitive",        KEYWORD, kw0_NoCaseSensitive },
572.1.11 by Matthew Fuller
Add and document NoDecorateTransients.
358
	{ "nodecoratetransients",   KEYWORD, kw0_NoDecorateTransients },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
359
	{ "nodefaults",             KEYWORD, kw0_NoDefaults },
360
	{ "nograbserver",           KEYWORD, kw0_NoGrabServer },
361
	{ "nohighlight",            NO_HILITE, 0 },
362
	{ "noiconmanagerfocus",     KEYWORD, kw0_NoIconManagerFocus },
363
	{ "noiconmanagers",         KEYWORD, kw0_NoIconManagers },
364
	{ "noicontitle",            NO_ICON_TITLE, 0  },
365
	{ "noimagesinworkspacemanager", KEYWORD, kw0_NoImagesInWorkSpaceManager },
366
	{ "nomenushadows",          KEYWORD, kw0_NoMenuShadows },
367
	{ "noopaquemove",           NOOPAQUEMOVE, 0 },
368
	{ "noopaqueresize",         NOOPAQUERESIZE, 0 },
369
	{ "noraiseondeiconify",     KEYWORD, kw0_NoRaiseOnDeiconify },
370
	{ "noraiseonmove",          KEYWORD, kw0_NoRaiseOnMove },
371
	{ "noraiseonresize",        KEYWORD, kw0_NoRaiseOnResize },
372
	{ "noraiseonwarp",          KEYWORD, kw0_NoRaiseOnWarp },
572.1.10 by Matthew Fuller
Add and document NoRestartPreviousState.
373
	{ "norestartpreviousstate", KEYWORD, kw0_NoRestartPreviousState },
513.1.8 by Matthew Fuller
Swap to the new enum for these gravity values, and retire the old
374
	{ "north",                  GRAVITY, GRAV_NORTH },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
375
	{ "nosaveunders",           KEYWORD, kw0_NoSaveUnders },
376
	{ "noshowoccupyall",        KEYWORD, kw0_NoShowOccupyAll },
572.1.9 by Matthew Fuller
Add NoSortIconManager config var.
377
	{ "nosorticonmanager",      KEYWORD, kw0_NoSortIconManager },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
378
	{ "nostackmode",            NO_STACKMODE, 0 },
379
	{ "notitle",                NO_TITLE, 0 },
380
	{ "notitlefocus",           KEYWORD, kw0_NoTitleFocus },
381
	{ "notitlehighlight",       NO_TITLE_HILITE, 0 },
382
	{ "nowarptomenutitle",      KEYWORD, kw0_NoWarpToMenuTitle },
383
	{ "occupy",                 OCCUPYLIST, 0 },
384
	{ "occupyall",              OCCUPYALL, 0 },
385
	{ "ontoppriority",          ON_TOP_PRIORITY, 0 },
386
	{ "opaquemove",             OPAQUEMOVE, 0 },
387
	{ "opaquemovethreshold",    NKEYWORD, kwn_OpaqueMoveThreshold },
388
	{ "opaqueresize",           OPAQUERESIZE, 0 },
389
	{ "opaqueresizethreshold",  NKEYWORD, kwn_OpaqueResizeThreshold },
390
	{ "openwindowtimeout",      NKEYWORD, kwn_OpenWindowTimeout },
391
	{ "packnewwindows",         KEYWORD, kw0_PackNewWindows },
392
	{ "pixmapdirectory",        SKEYWORD, kws_PixmapDirectory },
393
	{ "pixmaps",                PIXMAPS, 0 },
394
	{ "prioritynotswitching",   PRIORITY_NOT_SWITCHING, 0 },
395
	{ "priorityswitching",      PRIORITY_SWITCHING, 0 },
396
	{ "r",                      ROOT, 0 },
397
	{ "raisedelay",             NKEYWORD, kwn_RaiseDelay },
398
	{ "raiseonclick",           KEYWORD, kw0_RaiseOnClick },
399
	{ "raiseonclickbutton",     NKEYWORD, kwn_RaiseOnClickButton },
400
	{ "raiseonwarp",            KEYWORD, kw0_RaiseOnWarp },
401
	{ "raisewhenautounsqueeze", KEYWORD, kw0_RaiseWhenAutoUnSqueeze },
402
	{ "randomplacement",        SSKEYWORD, kwss_RandomPlacement },
403
	{ "reallymoveinworkspacemanager",   KEYWORD, kw0_ReallyMoveInWorkspaceManager },
404
	{ "resize",                 RESIZE, 0 },
405
	{ "resizefont",             SKEYWORD, kws_ResizeFont },
406
	{ "restartpreviousstate",   KEYWORD, kw0_RestartPreviousState },
407
	{ "reversecurrentworkspace", KEYWORD, kw0_ReverseCurrentWorkspace },
496.1.24 by Matthew Fuller
Rename the parser name for the lef/center/right keywords used in
408
	{ "right",                  SIJENUM, SIJ_RIGHT },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
409
	{ "righttitlebutton",       RIGHT_TITLEBUTTON, 0 },
410
	{ "root",                   ROOT, 0 },
463.1.22 by Matthew Fuller
Add RplaySoundHost as an alias for SoundHost, with the intention of
411
	{ "rplaysoundhost",         SKEYWORD, kws_RplaySoundHost },
463.1.7 by Matthew Fuller
Add RplaySounds {} config block for setting sounds in the config file.
412
	{ "rplaysounds",            RPLAY_SOUNDS, 0 },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
413
	{ "s",                      SHIFT, 0 },
414
	{ "savecolor",              SAVECOLOR, 0},
415
	{ "saveworkspacefocus",     KEYWORD, kw0_SaveWorkspaceFocus },
416
	{ "schrinkicontitles",      KEYWORD, kw0_ShrinkIconTitles },
417
	{ "select",                 SELECT, 0 },
418
	{ "shift",                  SHIFT, 0 },
419
	{ "shortallwindowsmenus",   KEYWORD, kw0_ShortAllWindowsMenus },
420
	{ "showiconmanager",        KEYWORD, kw0_ShowIconManager },
421
	{ "showworkspacemanager",   KEYWORD, kw0_ShowWorkspaceManager },
422
	{ "shrinkicontitles",       KEYWORD, kw0_ShrinkIconTitles },
423
	{ "sloppyfocus",            KEYWORD, kw0_SloppyFocus },
424
	{ "sorticonmanager",        KEYWORD, kw0_SortIconManager },
425
	{ "soundhost",              SKEYWORD, kws_SoundHost },
513.1.8 by Matthew Fuller
Swap to the new enum for these gravity values, and retire the old
426
	{ "south",                  GRAVITY, GRAV_SOUTH },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
427
	{ "squeezetitle",           SQUEEZE_TITLE, 0 },
428
	{ "starticonified",         START_ICONIFIED, 0 },
572.1.5 by Matthew Fuller
Add StartInButtonState keyword.
429
	{ "startinbuttonstate",     KEYWORD, kw0_StartInButtonState },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
430
	{ "startinmapstate",        KEYWORD, kw0_StartInMapState },
431
	{ "startsqueezed",          STARTSQUEEZED, 0 },
432
	{ "stayupmenus",            KEYWORD, kw0_StayUpMenus },
615.1.21 by Matthew Fuller
Add StrictWinNameEncoding config var, to allow restoring historical
433
	{ "strictwinnameencoding",  KEYWORD, kw0_StrictWinNameEncoding  },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
434
	{ "sunkfocuswindowtitle",   KEYWORD, kw0_SunkFocusWindowTitle },
435
	{ "t",                      TITLE, 0 },
436
	{ "threedborderwidth",      NKEYWORD, kwn_ThreeDBorderWidth },
437
	{ "title",                  TITLE, 0 },
438
	{ "titlebackground",        CLKEYWORD, kwcl_TitleBackground },
439
	{ "titlebuttonborderwidth", NKEYWORD, kwn_TitleButtonBorderWidth },
440
	{ "titlebuttonshadowdepth", NKEYWORD, kwn_TitleButtonShadowDepth },
441
	{ "titlefont",              SKEYWORD, kws_TitleFont },
442
	{ "titleforeground",        CLKEYWORD, kwcl_TitleForeground },
443
	{ "titlehighlight",         TITLE_HILITE, 0 },
444
	{ "titlejustification",     SKEYWORD, kws_TitleJustification },
445
	{ "titlepadding",           NKEYWORD, kwn_TitlePadding },
446
	{ "titleshadowdepth",       NKEYWORD, kwn_TitleShadowDepth },
447
	{ "transienthasoccupation", KEYWORD, kw0_TransientHasOccupation },
448
	{ "transientontop",         NKEYWORD, kwn_TransientOnTop },
449
	{ "unknownicon",            SKEYWORD, kws_UnknownIcon },
450
	{ "unmapbymovingfaraway",   UNMAPBYMOVINGFARAWAY, 0 },
451
	{ "usepposition",           SKEYWORD, kws_UsePPosition },
452
	{ "usesunktitlepixmap",     KEYWORD, kw0_UseSunkTitlePixmap },
453
	{ "usethreedborders",       KEYWORD, kw0_Use3DBorders },
454
	{ "usethreediconmanagers",  KEYWORD, kw0_Use3DIconManagers },
455
	{ "usethreedmenus",         KEYWORD, kw0_Use3DMenus },
456
	{ "usethreedtitles",        KEYWORD, kw0_Use3DTitles },
457
	{ "usethreedwmap",          KEYWORD, kw0_Use3DWMap },
696.1.2 by Matthew Fuller
Conditionalize parsing the VirtualScreens config param wholly on the
458
#ifdef VSCREEN
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
459
	{ "virtualscreens",         VIRTUAL_SCREENS, 0 },
696.1.2 by Matthew Fuller
Conditionalize parsing the VirtualScreens config param wholly on the
460
#endif
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
461
	{ "w",                      WINDOW, 0 },
462
	{ "wait",                   WAITC, 0 },
463
	{ "warpcursor",             WARP_CURSOR, 0 },
464
	{ "warpondeiconify",        WARP_ON_DEICONIFY, 0 },
465
	{ "warpringonscreen",       KEYWORD, kw0_WarpRingOnScreen },
466
	{ "warptodefaultmenuentry", KEYWORD, kw0_WarpToDefaultMenuEntry },
467
	{ "warpunmapped",           KEYWORD, kw0_WarpUnmapped },
513.1.8 by Matthew Fuller
Swap to the new enum for these gravity values, and retire the old
468
	{ "west",                   GRAVITY, GRAV_WEST },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
469
	{ "window",                 WINDOW, 0 },
470
	{ "windowbox",              WINDOW_BOX, 0 },
471
	{ "windowfunction",         WINDOW_FUNCTION, 0 },
472
	{ "windowgeometries",       WINDOW_GEOMETRIES, 0 },
473
	{ "windowregion",           WINDOW_REGION, 0 },
474
	{ "windowring",             WINDOW_RING, 0 },
475
	{ "windowringexclude",      WINDOW_RING_EXCLUDE, 0},
476
	{ "wmgrbuttonshadowdepth",  NKEYWORD, kwn_WMgrButtonShadowDepth },
477
	{ "wmgrbuttonstyle",        SKEYWORD, kws_WMgrButtonStyle },
478
	{ "wmgrhorizbuttonindent",  NKEYWORD, kwn_WMgrHorizButtonIndent },
479
	{ "wmgrvertbuttonindent",   NKEYWORD, kwn_WMgrVertButtonIndent },
480
	{ "workspace",              WORKSPACE, 0 },
481
	{ "workspacefont",          SKEYWORD, kws_WorkSpaceFont },
482
	{ "workspacemanagergeometry", WORKSPCMGR_GEOMETRY, 0 },
483
	{ "workspaces",             WORKSPACES, 0},
484
	{ "xmovegrid",              NKEYWORD, kwn_XMoveGrid },
485
	{ "xorvalue",               NKEYWORD, kwn_XorValue },
486
	{ "xpmicondirectory",       SKEYWORD, kws_PixmapDirectory },
487
	{ "ymovegrid",              NKEYWORD, kwn_YMoveGrid },
488
	{ "zoom",                   ZOOM, 0 },
489
};
490
534.1.25 by Matthew Fuller
Use size_t for these array sizes; it's a tad more idiomatic.
491
static const size_t numkeywords = (sizeof(keytable) / sizeof(keytable[0]));
534.1.23 by Matthew Fuller
Switch over to #include'ing the generated parse table, replacing the
492
493
494
/*
495
 * The lookup table for functions is generated.
496
 */
497
#include "functions_parse_table.h"
498
499
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
500
531.1.1 by Matthew Fuller
Replace hand-rolled binary search of the keyword table with
501
static int
502
kt_compare(const void *lhs, const void *rhs)
503
{
504
	const TwmKeyword *l = lhs;
505
	const TwmKeyword *r = rhs;
506
	return strcasecmp(l->name, r->name);
507
}
508
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
509
int
501.1.8 by Matthew Fuller
Do easy const-ifications. The _string and _string_string funcs wind
510
parse_keyword(const char *s, int *nump)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
511
{
528.1.47 by Matthew Fuller
Might as well const-ify this as well, for consistency.
512
	const TwmKeyword srch = { .name = s };
531.1.1 by Matthew Fuller
Replace hand-rolled binary search of the keyword table with
513
	TwmKeyword *ret;
528.1.46 by Matthew Fuller
const-ify these tables.
514
	const TwmKeyword *srchtab;
528.1.44 by Matthew Fuller
Update parse_keyword() to look in the functions table for f.stuff.
515
	size_t nstab;
516
517
	/* Guard; nothing can't be a valid keyword */
518
	if(s == NULL || strlen(s) < 1) {
519
		return ERRORTOKEN;
520
	}
521
522
	/*
523
	 * Functions are in their own table, so check for them there.
524
	 *
525
	 * This is safe as long as (strlen >= 1), which we already checked.
526
	 */
527
	if(s[0] == 'f' && s[1] == '.') {
528
		srchtab = funckeytable;
529
		nstab = numfunckeywords;
530
	}
531
	else {
532
		srchtab = keytable;
533
		nstab = numkeywords;
534
	}
531.1.1 by Matthew Fuller
Replace hand-rolled binary search of the keyword table with
535
536
	/* Find it */
528.1.44 by Matthew Fuller
Update parse_keyword() to look in the functions table for f.stuff.
537
	ret = bsearch(&srch, srchtab, nstab, sizeof(TwmKeyword), kt_compare);
531.1.1 by Matthew Fuller
Replace hand-rolled binary search of the keyword table with
538
	if(ret) {
539
		*nump = ret->subnum;
540
		return ret->value;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
541
	}
531.1.1 by Matthew Fuller
Replace hand-rolled binary search of the keyword table with
542
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
543
	return ERRORTOKEN;
544
}
545
546
488 by Matthew Fuller
Add a func to check the order of the entries in our keyword lookup
547
/*
548
 * Simple tester function
549
 */
550
void
551
chk_keytable_order(void)
552
{
553
	int i;
554
555
	for(i = 0 ; i < (numkeywords - 1) ; i++) {
489 by Matthew Fuller
make indent
556
		if(strcasecmp(keytable[i].name, keytable[i + 1].name) >= 0) {
488 by Matthew Fuller
Add a func to check the order of the entries in our keyword lookup
557
			fprintf(stderr, "%s: INTERNAL ERROR: keytable sorting: "
489 by Matthew Fuller
make indent
558
			        "'%s' >= '%s'\n", ProgramName,
559
			        keytable[i].name, keytable[i + 1].name);
488 by Matthew Fuller
Add a func to check the order of the entries in our keyword lookup
560
		}
561
	}
528.1.43 by Matthew Fuller
Copy out the functions in keytable into a separate TwmKeyword array,
562
563
	for(i = 0 ; i < (numfunckeywords - 1) ; i++) {
564
		if(strcasecmp(funckeytable[i].name, funckeytable[i + 1].name) >= 0) {
565
			fprintf(stderr, "%s: INTERNAL ERROR: funckeytable sorting: "
566
			        "'%s' >= '%s'\n", ProgramName,
567
			        funckeytable[i].name, funckeytable[i + 1].name);
568
		}
569
	}
488 by Matthew Fuller
Add a func to check the order of the entries in our keyword lookup
570
}
571
572
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
573
574
/*
575
 * action routines called by grammar
576
 */
577
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
578
bool
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
579
do_single_keyword(int keyword)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
580
{
581
	switch(keyword) {
582
		case kw0_NoDefaults:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
583
			Scr->NoDefaults = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
584
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
585
586
		case kw0_AutoRelativeResize:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
587
			Scr->AutoRelativeResize = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
588
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
589
590
		case kw0_ForceIcons:
591
			if(Scr->FirstTime) {
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
592
				Scr->ForceIcon = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
593
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
594
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
595
596
		case kw0_NoIconManagers:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
597
			Scr->NoIconManagers = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
598
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
599
600
		case kw0_InterpolateMenuColors:
601
			if(Scr->FirstTime) {
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
602
				Scr->InterpolateMenuColors = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
603
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
604
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
605
606
		case kw0_SortIconManager:
607
			if(Scr->FirstTime) {
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
608
				Scr->SortIconMgr = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
609
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
610
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
611
572.1.9 by Matthew Fuller
Add NoSortIconManager config var.
612
		case kw0_NoSortIconManager:
613
			if(Scr->FirstTime) {
614
				Scr->SortIconMgr = false;
615
			}
616
			return true;
617
572.1.12 by Matthew Fuller
Add and document GrabServer config var.
618
		case kw0_GrabServer:
619
			Scr->NoGrabServer = false;
620
			return true;
621
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
622
		case kw0_NoGrabServer:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
623
			Scr->NoGrabServer = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
624
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
625
626
		case kw0_NoMenuShadows:
627
			if(Scr->FirstTime) {
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
628
				Scr->Shadow = false;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
629
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
630
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
631
632
		case kw0_NoRaiseOnMove:
633
			if(Scr->FirstTime) {
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
634
				Scr->NoRaiseMove = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
635
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
636
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
637
638
		case kw0_NoRaiseOnResize:
639
			if(Scr->FirstTime) {
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
640
				Scr->NoRaiseResize = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
641
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
642
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
643
644
		case kw0_NoRaiseOnDeiconify:
645
			if(Scr->FirstTime) {
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
646
				Scr->NoRaiseDeicon = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
647
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
648
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
649
650
		case kw0_DontMoveOff:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
651
			Scr->DontMoveOff = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
652
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
653
654
		case kw0_NoBackingStore:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
655
			Scr->BackingStore = false;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
656
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
657
572.1.1 by Matthew Fuller
Add BackingStore config flag.
658
		case kw0_BackingStore:
659
			Scr->BackingStore = true;
660
			return true;
661
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
662
		case kw0_NoSaveUnders:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
663
			Scr->SaveUnder = false;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
664
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
665
641.1.8 by Matthew Fuller
Add various narrative comments through the startup process (outside of
666
		// XXX Shouldn't these be in Scr too?
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
667
		case kw0_RestartPreviousState:
492.2.48 by Matthew Fuller
Some more Bool->bool conversions.
668
			RestartPreviousState = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
669
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
670
572.1.10 by Matthew Fuller
Add and document NoRestartPreviousState.
671
		case kw0_NoRestartPreviousState:
672
			RestartPreviousState = false;
673
			return true;
674
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
675
		case kw0_ClientBorderWidth:
676
			if(Scr->FirstTime) {
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
677
				Scr->ClientBorderWidth = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
678
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
679
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
680
681
		case kw0_NoTitleFocus:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
682
			Scr->TitleFocus = false;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
683
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
684
685
		case kw0_DecorateTransients:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
686
			Scr->DecorateTransients = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
687
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
688
572.1.11 by Matthew Fuller
Add and document NoDecorateTransients.
689
		case kw0_NoDecorateTransients:
690
			Scr->DecorateTransients = false;
691
			return true;
692
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
693
		case kw0_ShowIconManager:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
694
			Scr->ShowIconManager = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
695
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
696
697
		case kw0_ShowWorkspaceManager:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
698
			Scr->ShowWorkspaceManager = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
699
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
700
572.1.5 by Matthew Fuller
Add StartInButtonState keyword.
701
		case kw0_StartInButtonState:
702
			Scr->workSpaceMgr.initialstate = WMS_buttons;
703
			return true;
704
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
705
		case kw0_StartInMapState:
497.1.7 by Matthew Fuller
enum-ify the WorkSpaceMgr state.
706
			Scr->workSpaceMgr.initialstate = WMS_map;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
707
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
708
709
		case kw0_NoShowOccupyAll:
492.2.85 by Matthew Fuller
int->bool.
710
			Scr->workSpaceMgr.noshowoccupyall = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
711
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
712
713
		case kw0_AutoOccupy:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
714
			Scr->AutoOccupy = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
715
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
716
717
		case kw0_AutoPriority:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
718
			Scr->AutoPriority = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
719
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
720
721
		case kw0_TransientHasOccupation:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
722
			Scr->TransientHasOccupation = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
723
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
724
725
		case kw0_DontPaintRootWindow:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
726
			Scr->DontPaintRootWindow = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
727
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
728
729
		case kw0_UseSunkTitlePixmap:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
730
			Scr->UseSunkTitlePixmap = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
731
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
732
733
		case kw0_Use3DBorders:
492.2.116 by Matthew Fuller
Some similar missed TRUE->true updates.
734
			Scr->use3Dborders = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
735
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
736
737
		case kw0_Use3DIconManagers:
492.2.116 by Matthew Fuller
Some similar missed TRUE->true updates.
738
			Scr->use3Diconmanagers = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
739
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
740
741
		case kw0_Use3DMenus:
492.2.116 by Matthew Fuller
Some similar missed TRUE->true updates.
742
			Scr->use3Dmenus = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
743
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
744
745
		case kw0_Use3DTitles:
492.2.116 by Matthew Fuller
Some similar missed TRUE->true updates.
746
			Scr->use3Dtitles = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
747
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
748
749
		case kw0_Use3DWMap:
492.2.116 by Matthew Fuller
Some similar missed TRUE->true updates.
750
			Scr->use3Dwmap = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
751
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
752
753
		case kw0_SunkFocusWindowTitle:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
754
			Scr->SunkFocusWindowTitle = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
755
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
756
757
		case kw0_BeNiceToColormap:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
758
			Scr->BeNiceToColormap = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
759
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
760
761
		case kw0_BorderResizeCursors:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
762
			Scr->BorderCursors = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
763
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
764
765
		case kw0_NoCaseSensitive:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
766
			Scr->CaseSensitive = false;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
767
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
768
769
		case kw0_NoRaiseOnWarp:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
770
			Scr->RaiseOnWarp = false;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
771
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
772
773
		case kw0_RaiseOnWarp:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
774
			Scr->RaiseOnWarp = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
775
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
776
777
		case kw0_WarpUnmapped:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
778
			Scr->WarpUnmapped = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
779
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
780
781
		case kw0_WarpRingOnScreen:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
782
			Scr->WarpRingAnyWhere = false;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
783
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
784
785
		case kw0_NoIconManagerFocus:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
786
			Scr->IconManagerFocus = false;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
787
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
788
789
		case kw0_StayUpMenus:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
790
			Scr->StayUpMenus = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
791
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
792
793
		case kw0_ClickToFocus:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
794
			Scr->ClickToFocus = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
795
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
796
797
		case kw0_ReallyMoveInWorkspaceManager:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
798
			Scr->ReallyMoveInWorkspaceManager = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
799
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
800
801
		case kw0_ShowWinWhenMovingInWmgr:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
802
			Scr->ShowWinWhenMovingInWmgr = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
803
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
804
805
		case kw0_ReverseCurrentWorkspace:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
806
			Scr->ReverseCurrentWorkspace = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
807
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
808
809
		case kw0_DontWarpCursorInWMap:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
810
			Scr->DontWarpCursorInWMap = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
811
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
812
813
		case kw0_CenterFeedbackWindow:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
814
			Scr->CenterFeedbackWindow = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
815
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
816
817
		case kw0_WarpToDefaultMenuEntry:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
818
			Scr->WarpToDefaultMenuEntry = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
819
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
820
821
		case kw0_ShrinkIconTitles:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
822
			Scr->ShrinkIconTitles = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
823
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
824
825
		case kw0_AutoRaiseIcons:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
826
			Scr->AutoRaiseIcons = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
827
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
828
829
		/* kai */
830
		case kw0_AutoFocusToTransients:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
831
			Scr->AutoFocusToTransients = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
832
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
833
834
		case kw0_ShortAllWindowsMenus:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
835
			Scr->ShortAllWindowsMenus = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
836
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
837
838
		case kw0_RaiseWhenAutoUnSqueeze:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
839
			Scr->RaiseWhenAutoUnSqueeze = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
840
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
841
842
		case kw0_RaiseOnClick:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
843
			Scr->RaiseOnClick = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
844
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
845
846
		case kw0_IgnoreLockModifier:
847
			Scr->IgnoreModifier |= LockMask;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
848
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
849
850
		case kw0_PackNewWindows:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
851
			Scr->PackNewWindows = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
852
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
853
854
		case kw0_IgnoreCaseInMenuSelection:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
855
			Scr->IgnoreCaseInMenuSelection = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
856
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
857
858
		case kw0_SloppyFocus:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
859
			Scr->SloppyFocus = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
860
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
861
862
		case kw0_SaveWorkspaceFocus:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
863
			Scr->SaveWorkspaceFocus = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
864
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
865
866
		case kw0_NoImagesInWorkSpaceManager:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
867
			Scr->NoImagesInWorkSpaceManager = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
868
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
869
870
		case kw0_NoWarpToMenuTitle:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
871
			Scr->NoWarpToMenuTitle = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
872
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
873
874
		case kw0_DontShowWelcomeWindow:
492.2.70 by Matthew Fuller
Convert WelcomeWindow conditionals (in multiple structs) to bool.
875
			Scr->ShowWelcomeWindow = false;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
876
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
877
878
		case kw0_DontToggleWorkspacemanagerState:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
879
			Scr->DontToggleWorkspaceManagerState = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
880
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
881
602.1.1 by Matthew Fuller
Add DontNameDecorations config var.
882
		case kw0_DontNameDecorations:
883
			Scr->NameDecorations = false;
884
			return true;
885
615.1.21 by Matthew Fuller
Add StrictWinNameEncoding config var, to allow restoring historical
886
		case kw0_StrictWinNameEncoding:
887
			Scr->StrictWinNameEncoding = true;
888
			return true;
889
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
890
	}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
891
	return false;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
892
}
893
894
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
895
bool
501.1.8 by Matthew Fuller
Do easy const-ifications. The _string and _string_string funcs wind
896
do_string_string_keyword(int keyword, const char *s1, const char *s2)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
897
{
898
	switch(keyword) {
899
		case kwss_RandomPlacement: {
502.1.1 by Matthew Fuller
Add some whitespace/comments through the RandomPlacement config
900
			/* RandomPlacement {on,off,all,unmapped} [displacement geom] */
502.1.2 by Matthew Fuller
Switch to using local vars rather than the global Junk's in this
901
			int rp;
902
			int gmask, gx, gy;     // Geometry mask/x/y values
903
			unsigned int gjw, gjh; // width/height (ignored)
904
			int exmask = (XValue | YValue); // Bits we need in the mask
502.1.1 by Matthew Fuller
Add some whitespace/comments through the RandomPlacement config
905
502.1.2 by Matthew Fuller
Switch to using local vars rather than the global Junk's in this
906
			rp = ParseRandomPlacement(s1);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
907
			if(rp < 0) {
908
				twmrc_error_prefix();
909
				fprintf(stderr,
502.1.1 by Matthew Fuller
Add some whitespace/comments through the RandomPlacement config
910
				        "ignoring invalid RandomPlacement argument 1 \"%s\"\n",
911
				        s1);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
912
			}
913
			else {
914
				Scr->RandomPlacement = rp;
915
			}
502.1.1 by Matthew Fuller
Add some whitespace/comments through the RandomPlacement config
916
917
			/* If no geom, we're done */
435.1.4 by Matthew Fuller
Eliminate the need for defstring in do_string_string_keyword() by just
918
			if(s2 == NULL) {
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
919
				return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
920
			}
502.1.1 by Matthew Fuller
Add some whitespace/comments through the RandomPlacement config
921
922
			/*
923
			 * Figure what the geom means.  We actually don't care about
502.1.2 by Matthew Fuller
Switch to using local vars rather than the global Junk's in this
924
			 * the size (it probably won't even be provided), so the
925
			 * width/height are junk.  The X/Y offsets are what we need.
926
			 * But we do need them.
502.1.1 by Matthew Fuller
Add some whitespace/comments through the RandomPlacement config
927
			 */
502.1.2 by Matthew Fuller
Switch to using local vars rather than the global Junk's in this
928
			gmask = XParseGeometry(s2, &gx, &gy, &gjw, &gjh);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
929
#ifdef DEBUG
502.1.2 by Matthew Fuller
Switch to using local vars rather than the global Junk's in this
930
			fprintf(stderr, "DEBUG:: Mask = %x, Width = %d, Height = %d\n",
931
			        gmask, gjw, gjh);
932
			fprintf(stderr, "DEBUG:: X = %d, Y = %d\n", gx, gy);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
933
#endif
502.1.2 by Matthew Fuller
Switch to using local vars rather than the global Junk's in this
934
			if((gmask & exmask) != exmask) {
935
				/* Didn't get X and Y */
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
936
				twmrc_error_prefix();
937
				fprintf(stderr,
938
				        "ignoring invalid RandomPlacement displacement \"%s\"\n", s2);
939
			}
940
			else {
502.1.2 by Matthew Fuller
Switch to using local vars rather than the global Junk's in this
941
				Scr->RandomDisplacementX = gx;
942
				Scr->RandomDisplacementY = gy;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
943
			}
502.1.1 by Matthew Fuller
Add some whitespace/comments through the RandomPlacement config
944
945
			/* Done */
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
946
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
947
		}
948
	}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
949
	return false;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
950
}
951
952
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
953
bool
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
954
do_string_keyword(int keyword, char *s)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
955
{
956
	switch(keyword) {
957
		case kws_UsePPosition: {
958
			int ppos = ParseUsePPosition(s);
959
			if(ppos < 0) {
960
				twmrc_error_prefix();
961
				fprintf(stderr,
962
				        "ignoring invalid UsePPosition argument \"%s\"\n", s);
963
			}
964
			else {
965
				Scr->UsePPosition = ppos;
966
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
967
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
968
		}
969
970
		case kws_IconFont:
971
			if(!Scr->HaveFonts) {
972
				Scr->IconFont.basename = s;
973
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
974
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
975
976
		case kws_ResizeFont:
977
			if(!Scr->HaveFonts) {
978
				Scr->SizeFont.basename = s;
979
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
980
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
981
982
		case kws_MenuFont:
983
			if(!Scr->HaveFonts) {
984
				Scr->MenuFont.basename = s;
985
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
986
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
987
988
		case kws_WorkSpaceFont:
989
			if(!Scr->HaveFonts) {
990
				Scr->workSpaceMgr.windowFont.basename = s;
991
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
992
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
993
994
		case kws_TitleFont:
995
			if(!Scr->HaveFonts) {
996
				Scr->TitleBarFont.basename = s;
997
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
998
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
999
1000
		case kws_IconManagerFont:
1001
			if(!Scr->HaveFonts) {
1002
				Scr->IconManagerFont.basename = s;
1003
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1004
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1005
1006
		case kws_UnknownIcon:
1007
			if(Scr->FirstTime) {
481.1.13 by Matthew Fuller
GetUnknownIcon() was a 1-line function used in 1 place, so just expand
1008
				Scr->UnknownImage = GetImage(s, Scr->IconC);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1009
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1010
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1011
1012
		case kws_IconDirectory:
1013
			if(Scr->FirstTime) {
1014
				Scr->IconDirectory = ExpandFilePath(s);
1015
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1016
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1017
1018
		case kws_PixmapDirectory:
1019
			if(Scr->FirstTime) {
1020
				Scr->PixmapDirectory = ExpandFilePath(s);
1021
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1022
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1023
502.1.3 by Matthew Fuller
Switch to local geometry vars and an intermediate for the
1024
		case kws_MaxWindowSize: {
1025
			int gmask;
1026
			int exmask = (WidthValue | HeightValue);
1027
			unsigned int gw, gh; // Stuff we care about
1028
			int gjx, gjy;        // Stuff we don't
1029
1030
			gmask = XParseGeometry(s, &gjx, &gjy, &gw, &gh);
1031
			if((gmask & exmask) != exmask) {
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1032
				twmrc_error_prefix();
1033
				fprintf(stderr, "bad MaxWindowSize \"%s\"\n", s);
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1034
				return false;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1035
			}
502.1.3 by Matthew Fuller
Switch to local geometry vars and an intermediate for the
1036
			if(gw == 0 || gh == 0) {
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1037
				twmrc_error_prefix();
1038
				fprintf(stderr, "MaxWindowSize \"%s\" must be non-zero\n", s);
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1039
				return false;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1040
			}
502.1.3 by Matthew Fuller
Switch to local geometry vars and an intermediate for the
1041
			Scr->MaxWindowWidth = gw;
1042
			Scr->MaxWindowHeight = gh;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1043
			return true;
502.1.3 by Matthew Fuller
Switch to local geometry vars and an intermediate for the
1044
		}
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1045
1046
		case kws_IconJustification: {
496.1.16 by Matthew Fuller
Convert TitleJustification elements to their own enum type, and fixup
1047
			int just = ParseTitleJustification(s);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1048
496.1.16 by Matthew Fuller
Convert TitleJustification elements to their own enum type, and fixup
1049
			if((just < 0) || (just == TJ_UNDEF)) {
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1050
				twmrc_error_prefix();
1051
				fprintf(stderr,
1052
				        "ignoring invalid IconJustification argument \"%s\"\n", s);
1053
			}
1054
			else {
1055
				Scr->IconJustification = just;
1056
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1057
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1058
		}
1059
		case kws_IconRegionJustification: {
496.1.17 by Matthew Fuller
Convert IconRegion Justification to its own enum type too. This is
1060
			int just = ParseIRJustification(s);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1061
496.1.17 by Matthew Fuller
Convert IconRegion Justification to its own enum type too. This is
1062
			if(just < 0 || (just == IRJ_UNDEF)) {
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1063
				twmrc_error_prefix();
1064
				fprintf(stderr,
1065
				        "ignoring invalid IconRegionJustification argument \"%s\"\n", s);
1066
			}
1067
			else {
1068
				Scr->IconRegionJustification = just;
1069
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1070
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1071
		}
1072
		case kws_IconRegionAlignement: {
1073
			int just = ParseAlignement(s);
1074
1075
			if(just < 0) {
1076
				twmrc_error_prefix();
1077
				fprintf(stderr,
1078
				        "ignoring invalid IconRegionAlignement argument \"%s\"\n", s);
1079
			}
1080
			else {
1081
				Scr->IconRegionAlignement = just;
1082
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1083
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1084
		}
1085
1086
		case kws_TitleJustification: {
496.1.16 by Matthew Fuller
Convert TitleJustification elements to their own enum type, and fixup
1087
			int just = ParseTitleJustification(s);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1088
496.1.16 by Matthew Fuller
Convert TitleJustification elements to their own enum type, and fixup
1089
			if((just < 0) || (just == TJ_UNDEF)) {
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1090
				twmrc_error_prefix();
1091
				fprintf(stderr,
1092
				        "ignoring invalid TitleJustification argument \"%s\"\n", s);
1093
			}
1094
			else {
1095
				Scr->TitleJustification = just;
1096
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1097
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1098
		}
463.1.22 by Matthew Fuller
Add RplaySoundHost as an alias for SoundHost, with the intention of
1099
		case kws_RplaySoundHost:
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1100
		case kws_SoundHost:
1101
			if(Scr->FirstTime) {
463.1.22 by Matthew Fuller
Add RplaySoundHost as an alias for SoundHost, with the intention of
1102
				/* Warning to be enabled in the future before removal */
1103
				if(0 && keyword == kws_SoundHost) {
1104
					twmrc_error_prefix();
1105
					fprintf(stderr, "SoundHost is deprecated, please "
463.1.33 by Matthew Fuller
make indent.
1106
					        "use RplaySoundHost instead.\n");
463.1.22 by Matthew Fuller
Add RplaySoundHost as an alias for SoundHost, with the intention of
1107
				}
463.1.20 by Matthew Fuller
Accept SoundHost config param even if we're built without sound, and
1108
#ifdef SOUNDS
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1109
				set_sound_host(s);
463.1.20 by Matthew Fuller
Accept SoundHost config param even if we're built without sound, and
1110
#else
1111
				twmrc_error_prefix();
463.1.22 by Matthew Fuller
Add RplaySoundHost as an alias for SoundHost, with the intention of
1112
				fprintf(stderr, "Ignoring %sSoundHost; rplay not ronfigured.\n",
463.1.33 by Matthew Fuller
make indent.
1113
				        (keyword == kws_RplaySoundHost ? "Rplay" : ""));
463.1.20 by Matthew Fuller
Accept SoundHost config param even if we're built without sound, and
1114
#endif
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1115
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1116
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1117
1118
		case kws_WMgrButtonStyle: {
1119
			int style = ParseButtonStyle(s);
1120
1121
			if(style < 0) {
1122
				twmrc_error_prefix();
1123
				fprintf(stderr,
1124
				        "ignoring invalid WMgrButtonStyle argument \"%s\"\n", s);
1125
			}
1126
			else {
1127
				Scr->workSpaceMgr.buttonStyle = style;
1128
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1129
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1130
		}
1131
1132
		case kws_IconifyStyle: {
497.1.4 by Matthew Fuller
enum-ify IconifyStyle. Move parsing the options into a helper
1133
			int style = ParseIconifyStyle(s);
1134
1135
			if(style < 0) {
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1136
				twmrc_error_prefix();
1137
				fprintf(stderr, "ignoring invalid IconifyStyle argument \"%s\"\n", s);
1138
			}
497.1.4 by Matthew Fuller
enum-ify IconifyStyle. Move parsing the options into a helper
1139
			else {
1140
				Scr->IconifyStyle = style;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1141
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1142
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1143
		}
1144
1145
#ifdef EWMH
1146
		case kws_IconSize:
1147
			if(sscanf(s, "%dx%d", &Scr->PreferredIconWidth,
1148
			                &Scr->PreferredIconHeight) == 2) {
1149
				/* ok */
1150
			}
1151
			else if(sscanf(s, "%d", &Scr->PreferredIconWidth) == 1) {
1152
				Scr->PreferredIconHeight = Scr->PreferredIconWidth;
1153
			}
1154
			else {
1155
				Scr->PreferredIconHeight = Scr->PreferredIconWidth = 48;
1156
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1157
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1158
#endif
1159
	}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1160
	return false;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1161
}
1162
1163
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1164
bool
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1165
do_number_keyword(int keyword, int num)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1166
{
1167
	switch(keyword) {
1168
		case kwn_ConstrainedMoveTime:
1169
			ConstrainedMoveTime = num;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1170
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1171
1172
		case kwn_MoveDelta:
1173
			Scr->MoveDelta = num;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1174
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1175
1176
		case kwn_MoveOffResistance:
1177
			Scr->MoveOffResistance = num;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1178
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1179
1180
		case kwn_MovePackResistance:
1181
			if(num < 0) {
1182
				num = 20;
1183
			}
1184
			Scr->MovePackResistance = num;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1185
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1186
1187
		case kwn_XMoveGrid:
501.1.3 by Matthew Fuller
Take out some unnecessary whitespace, that probably served for visual
1188
			if(num < 1) {
1189
				num = 1;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1190
			}
1191
			if(num > 100) {
1192
				num = 100;
1193
			}
1194
			Scr->XMoveGrid = num;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1195
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1196
1197
		case kwn_YMoveGrid:
501.1.3 by Matthew Fuller
Take out some unnecessary whitespace, that probably served for visual
1198
			if(num < 1) {
1199
				num = 1;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1200
			}
1201
			if(num > 100) {
1202
				num = 100;
1203
			}
1204
			Scr->YMoveGrid = num;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1205
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1206
1207
		case kwn_XorValue:
1208
			if(Scr->FirstTime) {
1209
				Scr->XORvalue = num;
1210
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1211
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1212
1213
		case kwn_FramePadding:
1214
			if(Scr->FirstTime) {
1215
				Scr->FramePadding = num;
1216
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1217
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1218
1219
		case kwn_TitlePadding:
1220
			if(Scr->FirstTime) {
1221
				Scr->TitlePadding = num;
1222
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1223
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1224
1225
		case kwn_ButtonIndent:
1226
			if(Scr->FirstTime) {
1227
				Scr->ButtonIndent = num;
1228
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1229
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1230
1231
		case kwn_ThreeDBorderWidth:
1232
			if(Scr->FirstTime) {
1233
				Scr->ThreeDBorderWidth = num;
1234
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1235
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1236
1237
		case kwn_BorderWidth:
1238
			if(Scr->FirstTime) {
1239
				Scr->BorderWidth = num;
1240
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1241
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1242
1243
		case kwn_IconBorderWidth:
1244
			if(Scr->FirstTime) {
1245
				Scr->IconBorderWidth = num;
1246
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1247
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1248
1249
		case kwn_TitleButtonBorderWidth:
1250
			if(Scr->FirstTime) {
1251
				Scr->TBInfo.border = num;
1252
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1253
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1254
1255
		case kwn_RaiseDelay:
1256
			RaiseDelay = num;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1257
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1258
1259
		case kwn_TransientOnTop:
1260
			if(Scr->FirstTime) {
1261
				Scr->TransientOnTop = num;
1262
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1263
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1264
1265
		case kwn_OpaqueMoveThreshold:
1266
			if(Scr->FirstTime) {
1267
				Scr->OpaqueMoveThreshold = num;
1268
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1269
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1270
1271
		case kwn_OpaqueResizeThreshold:
1272
			if(Scr->FirstTime) {
1273
				Scr->OpaqueResizeThreshold = num;
1274
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1275
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1276
1277
		case kwn_WMgrVertButtonIndent:
1278
			if(Scr->FirstTime) {
1279
				Scr->WMgrVertButtonIndent = num;
1280
			}
1281
			if(Scr->WMgrVertButtonIndent < 0) {
1282
				Scr->WMgrVertButtonIndent = 0;
1283
			}
1284
			Scr->workSpaceMgr.vspace = Scr->WMgrVertButtonIndent;
1285
			Scr->workSpaceMgr.occupyWindow->vspace = Scr->WMgrVertButtonIndent;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1286
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1287
1288
		case kwn_WMgrHorizButtonIndent:
1289
			if(Scr->FirstTime) {
1290
				Scr->WMgrHorizButtonIndent = num;
1291
			}
1292
			if(Scr->WMgrHorizButtonIndent < 0) {
1293
				Scr->WMgrHorizButtonIndent = 0;
1294
			}
1295
			Scr->workSpaceMgr.hspace = Scr->WMgrHorizButtonIndent;
1296
			Scr->workSpaceMgr.occupyWindow->hspace = Scr->WMgrHorizButtonIndent;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1297
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1298
1299
		case kwn_WMgrButtonShadowDepth:
1300
			if(Scr->FirstTime) {
1301
				Scr->WMgrButtonShadowDepth = num;
1302
			}
1303
			if(Scr->WMgrButtonShadowDepth < 1) {
1304
				Scr->WMgrButtonShadowDepth = 1;
1305
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1306
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1307
1308
		case kwn_MaxIconTitleWidth:
1309
			if(Scr->FirstTime) {
1310
				Scr->MaxIconTitleWidth = num;
1311
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1312
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1313
1314
		case kwn_ClearShadowContrast:
1315
			if(Scr->FirstTime) {
1316
				Scr->ClearShadowContrast = num;
1317
			}
501.1.3 by Matthew Fuller
Take out some unnecessary whitespace, that probably served for visual
1318
			if(Scr->ClearShadowContrast < 0) {
1319
				Scr->ClearShadowContrast = 0;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1320
			}
1321
			if(Scr->ClearShadowContrast > 100) {
1322
				Scr->ClearShadowContrast = 100;
1323
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1324
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1325
1326
		case kwn_DarkShadowContrast:
1327
			if(Scr->FirstTime) {
1328
				Scr->DarkShadowContrast = num;
1329
			}
501.1.3 by Matthew Fuller
Take out some unnecessary whitespace, that probably served for visual
1330
			if(Scr->DarkShadowContrast < 0) {
1331
				Scr->DarkShadowContrast = 0;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1332
			}
1333
			if(Scr->DarkShadowContrast > 100) {
1334
				Scr->DarkShadowContrast = 100;
1335
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1336
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1337
1338
		case kwn_AnimationSpeed:
1339
			if(num < 0) {
1340
				num = 0;
1341
			}
1342
			SetAnimationSpeed(num);
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1343
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1344
1345
		case kwn_BorderShadowDepth:
1346
			if(Scr->FirstTime) {
1347
				Scr->BorderShadowDepth = num;
1348
			}
1349
			if(Scr->BorderShadowDepth < 0) {
1350
				Scr->BorderShadowDepth = 2;
1351
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1352
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1353
1354
		case kwn_BorderLeft:
1355
			if(Scr->FirstTime) {
1356
				Scr->BorderLeft = num;
1357
			}
1358
			if(Scr->BorderLeft < 0) {
1359
				Scr->BorderLeft = 0;
1360
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1361
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1362
1363
		case kwn_BorderRight:
1364
			if(Scr->FirstTime) {
1365
				Scr->BorderRight = num;
1366
			}
1367
			if(Scr->BorderRight < 0) {
1368
				Scr->BorderRight = 0;
1369
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1370
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1371
1372
		case kwn_BorderTop:
1373
			if(Scr->FirstTime) {
1374
				Scr->BorderTop = num;
1375
			}
1376
			if(Scr->BorderTop < 0) {
1377
				Scr->BorderTop = 0;
1378
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1379
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1380
1381
		case kwn_BorderBottom:
1382
			if(Scr->FirstTime) {
1383
				Scr->BorderBottom = num;
1384
			}
1385
			if(Scr->BorderBottom < 0) {
1386
				Scr->BorderBottom = 0;
1387
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1388
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1389
1390
		case kwn_TitleButtonShadowDepth:
1391
			if(Scr->FirstTime) {
1392
				Scr->TitleButtonShadowDepth = num;
1393
			}
1394
			if(Scr->TitleButtonShadowDepth < 0) {
1395
				Scr->TitleButtonShadowDepth = 2;
1396
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1397
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1398
1399
		case kwn_TitleShadowDepth:
1400
			if(Scr->FirstTime) {
1401
				Scr->TitleShadowDepth = num;
1402
			}
1403
			if(Scr->TitleShadowDepth < 0) {
1404
				Scr->TitleShadowDepth = 2;
1405
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1406
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1407
1408
		case kwn_IconManagerShadowDepth:
1409
			if(Scr->FirstTime) {
1410
				Scr->IconManagerShadowDepth = num;
1411
			}
1412
			if(Scr->IconManagerShadowDepth < 0) {
1413
				Scr->IconManagerShadowDepth = 2;
1414
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1415
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1416
1417
		case kwn_MenuShadowDepth:
1418
			if(Scr->FirstTime) {
1419
				Scr->MenuShadowDepth = num;
1420
			}
1421
			if(Scr->MenuShadowDepth < 0) {
1422
				Scr->MenuShadowDepth = 2;
1423
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1424
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1425
1426
		case kwn_OpenWindowTimeout:
1427
			if(Scr->FirstTime) {
1428
				Scr->OpenWindowTimeout = num;
1429
			}
1430
			if(Scr->OpenWindowTimeout < 0) {
1431
				Scr->OpenWindowTimeout = 0;
1432
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1433
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1434
1435
		case kwn_RaiseOnClickButton:
1436
			if(Scr->FirstTime) {
1437
				Scr->RaiseOnClickButton = num;
1438
			}
1439
			if(Scr->RaiseOnClickButton < 1) {
1440
				Scr->RaiseOnClickButton = 1;
1441
			}
1442
			if(Scr->RaiseOnClickButton > MAX_BUTTONS) {
1443
				Scr->RaiseOnClickButton = MAX_BUTTONS;
1444
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1445
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1446
1447
1448
	}
1449
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1450
	return false;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1451
}
1452
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1453
name_list **
1454
do_colorlist_keyword(int keyword, int colormode, char *s)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1455
{
1456
	switch(keyword) {
1457
		case kwcl_BorderColor:
1458
			GetColor(colormode, &Scr->BorderColorC.back, s);
1459
			return &Scr->BorderColorL;
1460
1461
		case kwcl_IconManagerHighlight:
1462
			GetColor(colormode, &Scr->IconManagerHighlight, s);
1463
			return &Scr->IconManagerHighlightL;
1464
1465
		case kwcl_BorderTileForeground:
1466
			GetColor(colormode, &Scr->BorderTileC.fore, s);
1467
			return &Scr->BorderTileForegroundL;
1468
1469
		case kwcl_BorderTileBackground:
1470
			GetColor(colormode, &Scr->BorderTileC.back, s);
1471
			return &Scr->BorderTileBackgroundL;
1472
1473
		case kwcl_TitleForeground:
1474
			GetColor(colormode, &Scr->TitleC.fore, s);
1475
			return &Scr->TitleForegroundL;
1476
1477
		case kwcl_TitleBackground:
1478
			GetColor(colormode, &Scr->TitleC.back, s);
1479
			return &Scr->TitleBackgroundL;
1480
1481
		case kwcl_IconForeground:
1482
			GetColor(colormode, &Scr->IconC.fore, s);
1483
			return &Scr->IconForegroundL;
1484
1485
		case kwcl_IconBackground:
1486
			GetColor(colormode, &Scr->IconC.back, s);
1487
			return &Scr->IconBackgroundL;
1488
1489
		case kwcl_IconBorderColor:
1490
			GetColor(colormode, &Scr->IconBorderColor, s);
1491
			return &Scr->IconBorderColorL;
1492
1493
		case kwcl_IconManagerForeground:
1494
			GetColor(colormode, &Scr->IconManagerC.fore, s);
1495
			return &Scr->IconManagerFL;
1496
1497
		case kwcl_IconManagerBackground:
1498
			GetColor(colormode, &Scr->IconManagerC.back, s);
1499
			return &Scr->IconManagerBL;
1500
1501
		case kwcl_MapWindowBackground:
1502
			GetColor(colormode, &Scr->workSpaceMgr.windowcp.back, s);
492.2.63 by Matthew Fuller
boolify these struct members.
1503
			Scr->workSpaceMgr.windowcpgiven = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1504
			return &Scr->workSpaceMgr.windowBackgroundL;
1505
1506
		case kwcl_MapWindowForeground:
1507
			GetColor(colormode, &Scr->workSpaceMgr.windowcp.fore, s);
492.2.63 by Matthew Fuller
boolify these struct members.
1508
			Scr->workSpaceMgr.windowcpgiven = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1509
			return &Scr->workSpaceMgr.windowForegroundL;
1510
	}
1511
	return NULL;
1512
}
1513
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1514
bool
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1515
do_color_keyword(int keyword, int colormode, char *s)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1516
{
1517
	switch(keyword) {
1518
		case kwc_DefaultForeground:
1519
			GetColor(colormode, &Scr->DefaultC.fore, s);
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1520
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1521
1522
		case kwc_DefaultBackground:
1523
			GetColor(colormode, &Scr->DefaultC.back, s);
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1524
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1525
1526
		case kwc_MenuForeground:
1527
			GetColor(colormode, &Scr->MenuC.fore, s);
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1528
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1529
1530
		case kwc_MenuBackground:
1531
			GetColor(colormode, &Scr->MenuC.back, s);
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1532
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1533
1534
		case kwc_MenuTitleForeground:
1535
			GetColor(colormode, &Scr->MenuTitleC.fore, s);
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1536
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1537
1538
		case kwc_MenuTitleBackground:
1539
			GetColor(colormode, &Scr->MenuTitleC.back, s);
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1540
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1541
1542
		case kwc_MenuShadowColor:
1543
			GetColor(colormode, &Scr->MenuShadowColor, s);
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1544
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1545
1546
	}
1547
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1548
	return false;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1549
}
1550
1551
/*
1552
 * put_pixel_on_root() Save a pixel value in twm root window color property.
1553
 */
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1554
static void
1555
put_pixel_on_root(Pixel pixel)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1556
{
644.2.14 by Matthew Fuller
Few comments, limit scope of a var, and use a bool for a flag.
1557
	bool addone = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1558
	Atom          retAtom;
1559
	int           retFormat;
1560
	unsigned long nPixels, retAfter;
1561
	Pixel        *retProp;
1562
644.2.14 by Matthew Fuller
Few comments, limit scope of a var, and use a bool for a flag.
1563
	// Get current list
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1564
	if(XGetWindowProperty(dpy, Scr->Root, XA__MIT_PRIORITY_COLORS, 0, 8192,
1565
	                      False, XA_CARDINAL, &retAtom,
1566
	                      &retFormat, &nPixels, &retAfter,
1567
	                      (unsigned char **)&retProp) != Success || !retProp) {
1568
		return;
1569
	}
1570
644.2.14 by Matthew Fuller
Few comments, limit scope of a var, and use a bool for a flag.
1571
	// See if we already have this one
1572
	for(int i = 0; i < nPixels; i++) {
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1573
		if(pixel == retProp[i]) {
644.2.14 by Matthew Fuller
Few comments, limit scope of a var, and use a bool for a flag.
1574
			addone = false;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1575
		}
644.2.14 by Matthew Fuller
Few comments, limit scope of a var, and use a bool for a flag.
1576
	}
503.1.18 by Matthew Fuller
Stop casting XFree() arg; it's now spec'd to take a void * anyway.
1577
	XFree(retProp);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1578
644.2.14 by Matthew Fuller
Few comments, limit scope of a var, and use a bool for a flag.
1579
	// If not, append it
1580
	if(addone) {
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1581
		XChangeProperty(dpy, Scr->Root, XA__MIT_PRIORITY_COLORS,
1582
		                XA_CARDINAL, 32, PropModeAppend,
1583
		                (unsigned char *)&pixel, 1);
644.2.14 by Matthew Fuller
Few comments, limit scope of a var, and use a bool for a flag.
1584
	}
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1585
}
1586
1587
/*
644.2.10 by Matthew Fuller
Move this def up a few lines in anticipation of using it more
1588
 * Stash for SaveColor{} values during config parsing.
1589
 */
1590
typedef struct _cnode {
1591
	int i;
644.2.12 by Matthew Fuller
Use our stash for the named-color saves as well as the var-color
1592
	int cmode;
644.2.10 by Matthew Fuller
Move this def up a few lines in anticipation of using it more
1593
	char *sname;
1594
	struct _cnode *next;
1595
} Cnode;
1596
static Cnode *chead = NULL;
1597
644.2.11 by Matthew Fuller
Wrap up making/stashing this into a function.
1598
/**
1599
 * Add a SaveColor{} entry to our stash.
1600
 */
1601
static void
644.2.12 by Matthew Fuller
Use our stash for the named-color saves as well as the var-color
1602
add_cnode(int kwcl, int cmode, char *colname)
644.2.11 by Matthew Fuller
Wrap up making/stashing this into a function.
1603
{
1604
	Cnode *cnew;
1605
1606
	cnew = calloc(1, sizeof(Cnode));
1607
	cnew->i     = kwcl;
644.2.12 by Matthew Fuller
Use our stash for the named-color saves as well as the var-color
1608
	cnew->cmode = cmode;
644.2.11 by Matthew Fuller
Wrap up making/stashing this into a function.
1609
	cnew->sname = colname;
1610
1611
	if(!chead) {
1612
		chead = cnew;
1613
	}
1614
	else {
1615
		cnew->next = chead;
1616
		chead = cnew;
1617
	}
1618
1619
	return;
1620
}
1621
644.2.10 by Matthew Fuller
Move this def up a few lines in anticipation of using it more
1622
1623
/*
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1624
 * do_string_savecolor() save a color from a string in the twmrc file.
1625
 */
501.1.4 by Matthew Fuller
These functions only ever return a meaningless value, and never have
1626
void
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1627
do_string_savecolor(int colormode, char *s)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1628
{
644.2.12 by Matthew Fuller
Use our stash for the named-color saves as well as the var-color
1629
	add_cnode(0, colormode, s);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1630
}
1631
1632
/*
1633
 * do_var_savecolor() save a color from a var in the twmrc file.
1634
 */
501.1.4 by Matthew Fuller
These functions only ever return a meaningless value, and never have
1635
void
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1636
do_var_savecolor(int key)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1637
{
644.2.12 by Matthew Fuller
Use our stash for the named-color saves as well as the var-color
1638
	add_cnode(key, 0, NULL);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1639
}
1640
1641
/*
1642
 * assign_var_savecolor() traverse the var save color list placeing the pixels
1643
 *                        in the root window property.
1644
 */
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1645
void
1646
assign_var_savecolor(void)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1647
{
644.2.7 by Matthew Fuller
Having an extra typedef for the pointer variant of this is a little
1648
	Cnode *cp = chead;
644.2.15 by Matthew Fuller
Now we can move initializing this property down into the function that
1649
1650
	// Start with an empty property
1651
	XChangeProperty(dpy, Scr->Root, XA__MIT_PRIORITY_COLORS,
1652
	                XA_CARDINAL, 32, PropModeReplace, NULL, 0);
1653
1654
	// Loop over, stash 'em, and clean up
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1655
	while(cp != NULL) {
644.2.9 by Matthew Fuller
Avoid memory leak by freeing _all_ of these, not just the head of the
1656
		Cnode *tmp_cp = cp;
1657
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1658
		switch(cp->i) {
1659
			case kwcl_BorderColor:
1660
				put_pixel_on_root(Scr->BorderColorC.back);
1661
				break;
1662
			case kwcl_IconManagerHighlight:
1663
				put_pixel_on_root(Scr->IconManagerHighlight);
1664
				break;
1665
			case kwcl_BorderTileForeground:
1666
				put_pixel_on_root(Scr->BorderTileC.fore);
1667
				break;
1668
			case kwcl_BorderTileBackground:
1669
				put_pixel_on_root(Scr->BorderTileC.back);
1670
				break;
1671
			case kwcl_TitleForeground:
1672
				put_pixel_on_root(Scr->TitleC.fore);
1673
				break;
1674
			case kwcl_TitleBackground:
1675
				put_pixel_on_root(Scr->TitleC.back);
1676
				break;
1677
			case kwcl_IconForeground:
1678
				put_pixel_on_root(Scr->IconC.fore);
1679
				break;
1680
			case kwcl_IconBackground:
1681
				put_pixel_on_root(Scr->IconC.back);
1682
				break;
1683
			case kwcl_IconBorderColor:
1684
				put_pixel_on_root(Scr->IconBorderColor);
1685
				break;
1686
			case kwcl_IconManagerForeground:
1687
				put_pixel_on_root(Scr->IconManagerC.fore);
1688
				break;
1689
			case kwcl_IconManagerBackground:
1690
				put_pixel_on_root(Scr->IconManagerC.back);
1691
				break;
1692
			case kwcl_MapWindowForeground:
1693
				put_pixel_on_root(Scr->workSpaceMgr.windowcp.fore);
1694
				break;
1695
			case kwcl_MapWindowBackground:
1696
				put_pixel_on_root(Scr->workSpaceMgr.windowcp.back);
1697
				break;
644.2.12 by Matthew Fuller
Use our stash for the named-color saves as well as the var-color
1698
			case 0: {
1699
				// This means it's a string, not one of our keywords
1700
				Pixel p;
1701
				GetColor(cp->cmode, &p, cp->sname);
1702
				put_pixel_on_root(p);
1703
			}
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1704
		}
644.2.9 by Matthew Fuller
Avoid memory leak by freeing _all_ of these, not just the head of the
1705
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1706
		cp = cp->next;
644.2.9 by Matthew Fuller
Avoid memory leak by freeing _all_ of these, not just the head of the
1707
		free(tmp_cp);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1708
	}
1709
	if(chead) {
1710
		chead = NULL;
1711
	}
1712
}
1713
497.1.1 by Matthew Fuller
enum-ify Screen->RandomPlacement.
1714
1715
/*
1716
 * RandomPlacement [...] parse
1717
 */
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1718
static int
497.1.1 by Matthew Fuller
enum-ify Screen->RandomPlacement.
1719
ParseRandomPlacement(const char *s)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1720
{
497.1.1 by Matthew Fuller
enum-ify Screen->RandomPlacement.
1721
	/* No first arg -> 'all' */
435.1.4 by Matthew Fuller
Eliminate the need for defstring in do_string_string_keyword() by just
1722
	if(s == NULL) {
1723
		return RP_ALL;
1724
	}
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1725
	if(strlen(s) == 0) {
1726
		return RP_ALL;
1727
	}
497.1.1 by Matthew Fuller
enum-ify Screen->RandomPlacement.
1728
1729
#define CHK(str, ret) if(strcasecmp(s, str) == 0) { return RP_##ret; }
1730
	CHK(DEFSTRING,  ALL);
1731
	CHK("on",       ALL);
1732
	CHK("all",      ALL);
1733
	CHK("off",      OFF);
1734
	CHK("unmapped", UNMAPPED);
1735
#undef CHK
1736
501.1.5 by Matthew Fuller
Drop parens for consistency.
1737
	return -1;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1738
}
1739
496.1.17 by Matthew Fuller
Convert IconRegion Justification to its own enum type too. This is
1740
1741
/*
1742
 * Parse out IconRegionJustification string.
1743
 *
1744
 * X-ref comment on ParseAlignement about return value.
1745
 */
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1746
int
496.1.23 by Matthew Fuller
constify args to these functions, just for cleanliness.
1747
ParseIRJustification(const char *s)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1748
{
1749
	if(strlen(s) == 0) {
496.1.17 by Matthew Fuller
Convert IconRegion Justification to its own enum type too. This is
1750
		return -1;
1751
	}
1752
1753
#define CHK(str, ret) if(strcasecmp(s, str) == 0) { return IRJ_##ret; }
1754
	CHK(DEFSTRING, CENTER);
1755
	CHK("undef",   UNDEF);
1756
	CHK("left",    LEFT);
1757
	CHK("center",  CENTER);
1758
	CHK("right",   RIGHT);
1759
	CHK("border",  BORDER);
1760
#undef CHK
1761
1762
	return -1;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1763
}
1764
496.1.15 by Matthew Fuller
Add comment explaining the almost-right return type.
1765
1766
/*
496.1.16 by Matthew Fuller
Convert TitleJustification elements to their own enum type, and fixup
1767
 * Parse out string for title justification.  From TitleJustification,
1768
 * IconJustification, iconjust arg to IconRegion.
1769
 *
1770
 * X-ref comment on ParseAlignement about return value.
1771
 */
1772
int
496.1.23 by Matthew Fuller
constify args to these functions, just for cleanliness.
1773
ParseTitleJustification(const char *s)
496.1.16 by Matthew Fuller
Convert TitleJustification elements to their own enum type, and fixup
1774
{
1775
	if(strlen(s) == 0) {
1776
		return -1;
1777
	}
1778
1779
#define CHK(str, ret) if(strcasecmp(s, str) == 0) { return TJ_##ret; }
1780
	/* XXX Different uses really have different defaults... */
1781
	CHK(DEFSTRING, CENTER);
1782
	CHK("undef",   UNDEF);
1783
	CHK("left",    LEFT);
1784
	CHK("center",  CENTER);
1785
	CHK("right",   RIGHT);
1786
#undef CHK
1787
1788
	return -1;
1789
}
1790
1791
1792
/*
496.1.15 by Matthew Fuller
Add comment explaining the almost-right return type.
1793
 * Parse out the string specifier for IconRegion Alignement[sic].
1794
 * Strictly speaking, this [almost always] returns an IRAlignement enum
1795
 * value.  However, it's specified as int to allow the -1 return for
1796
 * invalid values.  enum's start numbering from 0 (unless specific values
1797
 * are given), so that's a safe out-of-bounds value.  And making an
1798
 * IRA_INVALID value would just add unnecessary complication, since
1799
 * during parsing is the only time it makes sense.
1800
 */
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1801
int
496.1.23 by Matthew Fuller
constify args to these functions, just for cleanliness.
1802
ParseAlignement(const char *s)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1803
{
1804
	if(strlen(s) == 0) {
496.1.14 by Matthew Fuller
Create an enum for the IconRegion Alignement (misspelling preserved
1805
		return -1;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1806
	}
496.1.13 by Matthew Fuller
Macro-ify ParseAlignement().
1807
496.1.14 by Matthew Fuller
Create an enum for the IconRegion Alignement (misspelling preserved
1808
#define CHK(str, ret) if(strcasecmp(s, str) == 0) { return IRA_##ret; }
496.1.13 by Matthew Fuller
Macro-ify ParseAlignement().
1809
	CHK(DEFSTRING, CENTER);
1810
	CHK("center",  CENTER);
1811
	CHK("top",     TOP);
1812
	CHK("bottom",  BOTTOM);
1813
	CHK("border",  BORDER);
1814
	CHK("undef",   UNDEF);
1815
#undef CHK
1816
496.1.14 by Matthew Fuller
Create an enum for the IconRegion Alignement (misspelling preserved
1817
	return -1;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1818
}
1819
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1820
static int
497.1.2 by Matthew Fuller
enum-ise Screen->UsePPosition.
1821
ParseUsePPosition(const char *s)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1822
{
1823
	if(strlen(s) == 0) {
497.1.2 by Matthew Fuller
enum-ise Screen->UsePPosition.
1824
		return -1;
1825
	}
1826
1827
#define CHK(str, ret) if(strcasecmp(s, str) == 0) { return PPOS_##ret; }
1828
	CHK(DEFSTRING,  OFF);
1829
	CHK("off",      OFF);
1830
	CHK("on",       ON);
1831
	CHK("non-zero", NON_ZERO);
1832
	CHK("nonzero",  NON_ZERO);
1833
#undef CHK
1834
1835
	return -1;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1836
}
1837
496.1.26 by Matthew Fuller
Ditch this STYLE_UNKNOWN value (which actually wouldn't wind up
1838
static int
497.1.5 by Matthew Fuller
const-ify arg on this last Parse func here, making it consistent with
1839
ParseButtonStyle(const char *s)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1840
{
496.1.3 by Matthew Fuller
Minor tweaks to ParseButtonStyle. Add an extra NULL check just in
1841
	if(s == NULL || strlen(s) == 0) {
496.1.26 by Matthew Fuller
Ditch this STYLE_UNKNOWN value (which actually wouldn't wind up
1842
		return -1;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1843
	}
496.1.3 by Matthew Fuller
Minor tweaks to ParseButtonStyle. Add an extra NULL check just in
1844
1845
#define CHK(str, ret) if(strcasecmp(s, str) == 0) { return STYLE_##ret; }
1846
	CHK(DEFSTRING, NORMAL);
1847
	CHK("normal",  NORMAL);
1848
	CHK("style1",  STYLE1);
1849
	CHK("style2",  STYLE2);
1850
	CHK("style3",  STYLE3);
1851
#undef CHK
1852
496.1.26 by Matthew Fuller
Ditch this STYLE_UNKNOWN value (which actually wouldn't wind up
1853
	return -1;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1854
}
1855
497.1.4 by Matthew Fuller
enum-ify IconifyStyle. Move parsing the options into a helper
1856
static int
1857
ParseIconifyStyle(const char *s)
1858
{
1859
	if(s == NULL || strlen(s) == 0) {
1860
		return -1;
1861
	}
1862
1863
#define CHK(str, ret) if(strcasecmp(s, str) == 0) { return ICONIFY_##ret; }
1864
	CHK(DEFSTRING, NORMAL);
1865
	CHK("normal",  NORMAL);
1866
	CHK("mosaic",  MOSAIC);
1867
	CHK("zoomin",  ZOOMIN);
1868
	CHK("zoomout", ZOOMOUT);
1869
	CHK("fade",    FADE);
497.2.1 by Matthew Fuller
Parse the right spelling of this param.
1870
	CHK("sweep",   SWEEP);
497.1.4 by Matthew Fuller
enum-ify IconifyStyle. Move parsing the options into a helper
1871
#undef CHK
1872
1873
	return -1;
1874
}
1875
501.1.7 by Matthew Fuller
do_squeeze_entry()'s return is never checked, so just make it void.
1876
void
501.1.13 by Matthew Fuller
Fixup EOL comment alignment, and convert to // as long as I'm changing
1877
do_squeeze_entry(name_list **slist, // squeeze or dont-squeeze list
1878
                 const char *name,  // window name
1879
                 SIJust justify,    // left, center, right
1880
                 int num,           // signed num
1881
                 int denom)         // 0 or indicates fraction denom
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1882
{
1883
	int absnum = (num < 0 ? -num : num);
1884
1885
	if(denom < 0) {
1886
		twmrc_error_prefix();
1887
		fprintf(stderr, "negative SqueezeTitle denominator %d\n", denom);
501.1.7 by Matthew Fuller
do_squeeze_entry()'s return is never checked, so just make it void.
1888
		ParseError = true;
1889
		return;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1890
	}
1891
	if(absnum > denom && denom != 0) {
1892
		twmrc_error_prefix();
1893
		fprintf(stderr, "SqueezeTitle fraction %d/%d outside window\n",
1894
		        num, denom);
501.1.7 by Matthew Fuller
do_squeeze_entry()'s return is never checked, so just make it void.
1895
		ParseError = true;
1896
		return;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1897
	}
1898
	/* Process the special cases from the manual here rather than
1899
	 * each time we calculate the position of the title bar
488.1.2 by Matthew Fuller
Move a bunch of funcs relating to titlebar setup from add_window.c
1900
	 * in ComputeTitleLocation().
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1901
	 * In fact, it's better to get rid of them entirely, but we
1902
	 * probably should not do that for compatibility's sake.
1903
	 * By using a non-zero denominator the position will be relative.
1904
	 */
1905
	if(denom == 0 && num == 0) {
496.1.20 by Matthew Fuller
Create and use an enum type for SqueezeInfo.justify.
1906
		if(justify == SIJ_CENTER) {
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1907
			num = 1;
1908
			denom = 2;
1909
		}
496.1.20 by Matthew Fuller
Create and use an enum type for SqueezeInfo.justify.
1910
		else if(justify == SIJ_RIGHT) {
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1911
			num = 2;
1912
			denom = 2;
1913
		}
1914
		twmrc_error_prefix();
1915
		fprintf(stderr, "deprecated SqueezeTitle faction 0/0, assuming %d/%d\n",
1916
		        num, denom);
1917
	}
1918
1919
	if(HasShape) {
1920
		SqueezeInfo *sinfo;
491.1.8 by Matthew Fuller
Stop casting return values of [mc]alloc(). void * has existed for 27
1921
		sinfo = malloc(sizeof(SqueezeInfo));
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1922
1923
		if(!sinfo) {
1924
			twmrc_error_prefix();
1925
			fprintf(stderr, "unable to allocate %lu bytes for squeeze info\n",
1926
			        (unsigned long) sizeof(SqueezeInfo));
501.1.7 by Matthew Fuller
do_squeeze_entry()'s return is never checked, so just make it void.
1927
			ParseError = true;
1928
			return;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1929
		}
1930
		sinfo->justify = justify;
1931
		sinfo->num = num;
1932
		sinfo->denom = denom;
435.1.6 by Matthew Fuller
Avoid shadowing a global.
1933
		AddToList(slist, name, sinfo);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1934
	}
501.1.7 by Matthew Fuller
do_squeeze_entry()'s return is never checked, so just make it void.
1935
	return;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1936
}
1937
1938
1939
/*
1940
 * Parsing for EWMHIgnore { } lists
1941
 */
1942
void
1943
proc_ewmh_ignore(void)
1944
{
1945
#ifndef EWMH
1946
	twmrc_error_prefix();
1947
	fprintf(stderr, "EWMH not enabled, EWMHIgnore { } ignored.\n");
492.2.97 by Matthew Fuller
bool-ify flags and return values related to config file parsing.
1948
	ParseError = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1949
	return;
1950
#endif
1951
	/* else nada */
1952
	return;
1953
}
1954
void
1955
add_ewmh_ignore(char *s)
1956
{
1957
#ifndef EWMH
1958
	return;
1959
#else
1960
1961
#define HANDLE(x) \
1962
        if(strcasecmp(s, (x)) == 0) { \
1963
                AddToList(&Scr->EWMHIgnore, (x), ""); \
1964
                return; \
1965
        }
1966
	HANDLE("STATE_MAXIMIZED_VERT");
1967
	HANDLE("STATE_MAXIMIZED_HORZ");
1968
	HANDLE("STATE_FULLSCREEN");
1969
	HANDLE("STATE_SHADED");
1970
	HANDLE("STATE_ABOVE");
1971
	HANDLE("STATE_BELOW");
1972
#undef HANDLE
1973
1974
	twmrc_error_prefix();
1975
	fprintf(stderr, "Unexpected EWMHIgnore value '%s'\n", s);
492.2.97 by Matthew Fuller
bool-ify flags and return values related to config file parsing.
1976
	ParseError = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1977
	return;
1978
#endif /* EWMH */
1979
}
473.1.6 by Matthew Fuller
Add a config entry to hold bits for ignoring MWM hints.
1980
1981
1982
/*
1983
 * Parsing for MWMIgnore { } lists
1984
 */
1985
void
1986
proc_mwm_ignore(void)
1987
{
1988
	/* Nothing to do */
1989
	return;
1990
}
1991
void
1992
add_mwm_ignore(char *s)
1993
{
1994
#define HANDLE(x) \
1995
        if(strcasecmp(s, (x)) == 0) { \
1996
                AddToList(&Scr->MWMIgnore, (x), ""); \
1997
                return; \
1998
        }
1999
	HANDLE("DECOR_BORDER");
2000
	HANDLE("DECOR_TITLE");
2001
#undef HANDLE
2002
2003
	twmrc_error_prefix();
2004
	fprintf(stderr, "Unexpected MWMIgnore value '%s'\n", s);
492.2.97 by Matthew Fuller
bool-ify flags and return values related to config file parsing.
2005
	ParseError = true;
473.1.6 by Matthew Fuller
Add a config entry to hold bits for ignoring MWM hints.
2006
	return;
2007
}
656.2.3 by Matthew Fuller
Skeletonize in code for MonitorLayout {} parsing. Doesn't do
2008
2009
2010
/*
2011
 * Parsing for Layout { } lists, to override the monitor layout we
2012
 * assumed or got from RANDR.
2013
 */
656.2.4 by Matthew Fuller
Implement the parsing and storing of override layouts.
2014
static RAreaList *override_monitors;
656.2.7 by Matthew Fuller
Parse and set the "monitor" names properly for MonitorLayout.
2015
static struct {
2016
	char **names;
2017
	int len;
2018
	int cap;
2019
} override_monitors_names;
656.2.4 by Matthew Fuller
Implement the parsing and storing of override layouts.
2020
2021
2022
/**
2023
 * Allocate space for our monitor override list.
2024
 */
656.2.3 by Matthew Fuller
Skeletonize in code for MonitorLayout {} parsing. Doesn't do
2025
void
2026
init_layout_override(void)
2027
{
656.2.4 by Matthew Fuller
Implement the parsing and storing of override layouts.
2028
	// 4 seems like a good guess.  If we're doing this, we're probably
2029
	// making at least 2 monitors, and >4 is gonna be pretty rare, so...
656.2.7 by Matthew Fuller
Parse and set the "monitor" names properly for MonitorLayout.
2030
	const int initsz = 4;
2031
2032
	override_monitors = RAreaListNew(initsz, NULL);
656.2.4 by Matthew Fuller
Implement the parsing and storing of override layouts.
2033
	if(override_monitors == NULL) {
2034
		twmrc_error_prefix();
2035
		fprintf(stderr, "Failed allocating RAreaList for monitors.\n");
2036
		ParseError = true;
2037
		return;
2038
		// Maybe we should just abort(); if malloc failed allocating a
2039
		// few dozen bytes this early, we're _screwed_.
2040
	}
2041
656.2.7 by Matthew Fuller
Parse and set the "monitor" names properly for MonitorLayout.
2042
	override_monitors_names.names = calloc(initsz, sizeof(char *));
2043
	override_monitors_names.len = 0;
2044
	override_monitors_names.cap = initsz;
2045
656.2.4 by Matthew Fuller
Implement the parsing and storing of override layouts.
2046
	return;
656.2.3 by Matthew Fuller
Skeletonize in code for MonitorLayout {} parsing. Doesn't do
2047
}
2048
656.2.4 by Matthew Fuller
Implement the parsing and storing of override layouts.
2049
/**
2050
 * Add an entry to our monitor list
656.2.7 by Matthew Fuller
Parse and set the "monitor" names properly for MonitorLayout.
2051
 *
2052
 * Expecting: [Name:]WxH[+X[+Y]]
656.2.4 by Matthew Fuller
Implement the parsing and storing of override layouts.
2053
 */
656.2.3 by Matthew Fuller
Skeletonize in code for MonitorLayout {} parsing. Doesn't do
2054
void
2055
add_layout_override_entry(const char *s)
2056
{
656.2.4 by Matthew Fuller
Implement the parsing and storing of override layouts.
2057
	const char *tmp;
2058
	int xpgret;
2059
	int x, y;
2060
	unsigned int width, height;
2061
2062
	if(override_monitors == NULL) {
2063
		// alloc failed, so just give up; we'll fail in the end anyway...
2064
		return;
2065
	}
2066
656.2.7 by Matthew Fuller
Parse and set the "monitor" names properly for MonitorLayout.
2067
	// Got a name?
656.2.4 by Matthew Fuller
Implement the parsing and storing of override layouts.
2068
	tmp = strchr(s, ':');
2069
	if(tmp != NULL && tmp != s) {
656.2.7 by Matthew Fuller
Parse and set the "monitor" names properly for MonitorLayout.
2070
		// Stash the name
2071
		override_monitors_names.names[override_monitors_names.len]
656.2.8 by Matthew Fuller
make indent
2072
		        = strndup(s, tmp - s);
656.2.7 by Matthew Fuller
Parse and set the "monitor" names properly for MonitorLayout.
2073
		// len advances below
656.2.4 by Matthew Fuller
Implement the parsing and storing of override layouts.
2074
656.2.7 by Matthew Fuller
Parse and set the "monitor" names properly for MonitorLayout.
2075
		// Advance to geom
656.2.4 by Matthew Fuller
Implement the parsing and storing of override layouts.
2076
		s = tmp + 1;
2077
	}
656.2.7 by Matthew Fuller
Parse and set the "monitor" names properly for MonitorLayout.
2078
	// Advance whether we got a name or not, to keep in sync.
2079
	override_monitors_names.len++;
2080
656.2.4 by Matthew Fuller
Implement the parsing and storing of override layouts.
2081
2082
	// Either way, s points at the geom now
2083
	xpgret = XParseGeometry(s, &x, &y, &width, &height);
2084
2085
	// Width and height are non-optional.  If x/y aren't given, we assume
2086
	// +0+0.  If we're given -0's, well, we don't _support_ that, but
2087
	// XPG() turns them into positives for us, so just accept it...
2088
	const int has_hw = (WidthValue | HeightValue);
2089
	if((xpgret & has_hw) != has_hw) {
2090
		twmrc_error_prefix();
2091
		fprintf(stderr, "Need both height and width in '%s'\n", s);
2092
		ParseError = true;
656.2.7 by Matthew Fuller
Parse and set the "monitor" names properly for MonitorLayout.
2093
		// Don't bother free()'ing stuff, we're going to exit after
2094
		// parse completes
656.2.4 by Matthew Fuller
Implement the parsing and storing of override layouts.
2095
		return;
2096
	}
2097
	if(!(xpgret & XValue)) {
2098
		x = 0;
2099
	}
2100
	if(!(xpgret & YValue)) {
2101
		y = 0;
2102
	}
2103
656.2.7 by Matthew Fuller
Parse and set the "monitor" names properly for MonitorLayout.
2104
656.2.4 by Matthew Fuller
Implement the parsing and storing of override layouts.
2105
	// And stash it
2106
	RAreaListAdd(override_monitors, RAreaNewStatic(x, y, width, height));
656.2.7 by Matthew Fuller
Parse and set the "monitor" names properly for MonitorLayout.
2107
2108
	// Whether we had a name for this 'monitor' or not, we need to
2109
	// possibly grow the names list, since it has to stay in lockstep
2110
	// with the areas as we add 'em.
2111
	{
2112
		char ***names = &override_monitors_names.names;
2113
		int len = override_monitors_names.len;
2114
2115
		if(len == override_monitors_names.cap) {
2116
			char **tnames = realloc(*names, (len + 1) * sizeof(char *));
2117
			if(tnames == NULL) {
2118
				abort();
2119
			}
2120
			*names = tnames;
2121
			override_monitors_names.cap++;
2122
		}
2123
	}
2124
656.2.4 by Matthew Fuller
Implement the parsing and storing of override layouts.
2125
	return;
656.2.3 by Matthew Fuller
Skeletonize in code for MonitorLayout {} parsing. Doesn't do
2126
}
2127
656.2.4 by Matthew Fuller
Implement the parsing and storing of override layouts.
2128
/**
2129
 * Finalize the override layout and store it up globally.
2130
 */
656.2.3 by Matthew Fuller
Skeletonize in code for MonitorLayout {} parsing. Doesn't do
2131
void
2132
proc_layout_override(void)
2133
{
656.2.4 by Matthew Fuller
Implement the parsing and storing of override layouts.
2134
	RLayout *new_layout;
2135
656.2.6 by Matthew Fuller
Guard against an empty specified layout.
2136
	// Guard
2137
	if(RAreaListLen(override_monitors) < 1) {
2138
		// Make this non-fatal, so an empty spec not-quite-quietly does
2139
		// nothing.
2140
		twmrc_error_prefix();
2141
		fprintf(stderr, "no monitors specified, ignoring MonitorLayout\n");
656.2.7 by Matthew Fuller
Parse and set the "monitor" names properly for MonitorLayout.
2142
2143
		// Since it's non-fatal, we _do_ need to cleanup more
2144
		// carefully...
656.2.6 by Matthew Fuller
Guard against an empty specified layout.
2145
		RAreaListFree(override_monitors);
656.2.7 by Matthew Fuller
Parse and set the "monitor" names properly for MonitorLayout.
2146
		for(int i = 0; i < override_monitors_names.len ; i++) {
2147
			free(override_monitors_names.names[i]);
2148
		}
2149
		free(override_monitors_names.names);
656.2.6 by Matthew Fuller
Guard against an empty specified layout.
2150
		return;
2151
	}
2152
656.2.4 by Matthew Fuller
Implement the parsing and storing of override layouts.
2153
	new_layout = RLayoutNew(override_monitors);
656.2.7 by Matthew Fuller
Parse and set the "monitor" names properly for MonitorLayout.
2154
	RLayoutSetMonitorsNames(new_layout, override_monitors_names.names);
2155
	// Silently stop paying attention to o_m_n.  Don't free() anything,
2156
	// since new_layout now owns it.  If we get another MonitorLayout{}
2157
	// block, it'll start over again with init(), and allocate new space.
2158
656.2.4 by Matthew Fuller
Implement the parsing and storing of override layouts.
2159
#ifdef DEBUG
2160
	fprintf(stderr, "Overridden layout: ");
2161
	RLayoutPrint(new_layout);
2162
#endif
2163
2164
	RLayoutFree(Scr->Layout);
2165
	Scr->Layout = new_layout;
2166
	return;
656.2.3 by Matthew Fuller
Skeletonize in code for MonitorLayout {} parsing. Doesn't do
2167
}