~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"
481.1.13 by Matthew Fuller
GetUnknownIcon() was a 1-line function used in 1 place, so just expand
24
#include "image.h"
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
25
#include "parse.h"
431.1.27 by Matthew Fuller
Break out a parse_be.h for the stuff that should only be
26
#include "parse_be.h"
435.1.5 by Matthew Fuller
Turn the defstring var into a #define, and switch to using the #define
27
#include "parse_yacc.h"
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
28
#ifdef SOUNDS
29
#  include "sound.h"
30
#endif
31
492.2.33 by Matthew Fuller
Do some more cleanup of headers including headers.
32
#include "gram.tab.h"
33
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
34
497.1.1 by Matthew Fuller
enum-ify Screen->RandomPlacement.
35
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
36
static int ParseButtonStyle(const char *s);
497.1.2 by Matthew Fuller
enum-ise Screen->UsePPosition.
37
static int ParseUsePPosition(const char *s);
497.1.4 by Matthew Fuller
enum-ify IconifyStyle. Move parsing the options into a helper
38
static int ParseIconifyStyle(const char *s);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
39
40
41
42
/**********************************************************************
43
 *
44
 *  Parsing table and routines
45
 *
46
 ***********************************************************************/
47
48
typedef struct _TwmKeyword {
49
	const char *name;
50
	int value;
51
	int subnum;
52
} TwmKeyword;
53
54
#define kw0_NoDefaults                  1
55
#define kw0_AutoRelativeResize          2
56
#define kw0_ForceIcons                  3
57
#define kw0_NoIconManagers              4
58
#define kw0_InterpolateMenuColors       6
59
//#define kw0_NoVersion                 7
60
#define kw0_SortIconManager             8
61
#define kw0_NoGrabServer                9
62
#define kw0_NoMenuShadows               10
63
#define kw0_NoRaiseOnMove               11
64
#define kw0_NoRaiseOnResize             12
65
#define kw0_NoRaiseOnDeiconify          13
66
#define kw0_DontMoveOff                 14
67
#define kw0_NoBackingStore              15
68
#define kw0_NoSaveUnders                16
69
#define kw0_RestartPreviousState        17
70
#define kw0_ClientBorderWidth           18
71
#define kw0_NoTitleFocus                19
72
#define kw0_DecorateTransients          21
73
#define kw0_ShowIconManager             22
74
#define kw0_NoCaseSensitive             23
75
#define kw0_NoRaiseOnWarp               24
76
#define kw0_WarpUnmapped                25
77
#define kw0_ShowWorkspaceManager        27
78
#define kw0_StartInMapState             28
79
#define kw0_NoShowOccupyAll             29
80
#define kw0_AutoOccupy                  30
81
#define kw0_TransientHasOccupation      31
82
#define kw0_DontPaintRootWindow         32
83
#define kw0_Use3DMenus                  33
84
#define kw0_Use3DTitles                 34
85
#define kw0_Use3DIconManagers           35
86
#define kw0_Use3DBorders                36
87
#define kw0_SunkFocusWindowTitle        37
88
#define kw0_BeNiceToColormap            38
89
#define kw0_WarpRingOnScreen            40
90
#define kw0_NoIconManagerFocus          41
91
#define kw0_StayUpMenus                 42
92
#define kw0_ClickToFocus                43
93
#define kw0_BorderResizeCursors         44
94
#define kw0_ReallyMoveInWorkspaceManager 45
95
#define kw0_ShowWinWhenMovingInWmgr     46
96
#define kw0_Use3DWMap                   47
97
#define kw0_ReverseCurrentWorkspace     48
98
#define kw0_DontWarpCursorInWMap        49
99
#define kw0_CenterFeedbackWindow        50
100
#define kw0_WarpToDefaultMenuEntry      51
101
#define kw0_ShrinkIconTitles            52
102
#define kw0_AutoRaiseIcons              53
103
#define kw0_use3DIconBorders            54
104
#define kw0_UseSunkTitlePixmap          55
105
#define kw0_ShortAllWindowsMenus        56
106
#define kw0_RaiseWhenAutoUnSqueeze      57
107
#define kw0_RaiseOnClick                58
108
#define kw0_IgnoreLockModifier          59
109
#define kw0_AutoFocusToTransients       60 /* kai */
110
#define kw0_PackNewWindows              61
111
#define kw0_IgnoreCaseInMenuSelection   62
112
#define kw0_SloppyFocus                 63
113
#define kw0_NoImagesInWorkSpaceManager  64
114
#define kw0_NoWarpToMenuTitle           65
115
#define kw0_SaveWorkspaceFocus          66 /* blais */
116
#define kw0_RaiseOnWarp                 67
117
#define kw0_DontShowWelcomeWindow       68
118
#define kw0_AutoPriority                69
119
#define kw0_DontToggleWorkspacemanagerState 70
120
121
#define kws_UsePPosition                1
122
#define kws_IconFont                    2
123
#define kws_ResizeFont                  3
124
#define kws_MenuFont                    4
125
#define kws_TitleFont                   5
126
#define kws_IconManagerFont             6
127
#define kws_UnknownIcon                 7
128
#define kws_IconDirectory               8
129
#define kws_MaxWindowSize               9
130
#define kws_PixmapDirectory             10
131
/* RandomPlacement moved because it's now a string string keyword */
132
#define kws_IconJustification           12
133
#define kws_TitleJustification          13
134
#define kws_IconRegionJustification     14
135
#define kws_IconRegionAlignement        15
136
#define kws_SoundHost                   16
137
#define kws_WMgrButtonStyle             17
138
#define kws_WorkSpaceFont               18
139
#define kws_IconifyStyle                19
140
#define kws_IconSize                    20
463.1.22 by Matthew Fuller
Add RplaySoundHost as an alias for SoundHost, with the intention of
141
#define kws_RplaySoundHost              21
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
142
143
#define kwss_RandomPlacement            1
144
145
#define kwn_ConstrainedMoveTime         1
146
#define kwn_MoveDelta                   2
147
#define kwn_XorValue                    3
148
#define kwn_FramePadding                4
149
#define kwn_TitlePadding                5
150
#define kwn_ButtonIndent                6
151
#define kwn_BorderWidth                 7
152
#define kwn_IconBorderWidth             8
153
#define kwn_TitleButtonBorderWidth      9
154
#define kwn_RaiseDelay                  10
155
#define kwn_TransientOnTop              11
156
#define kwn_OpaqueMoveThreshold         12
157
#define kwn_OpaqueResizeThreshold       13
158
#define kwn_WMgrVertButtonIndent        14
159
#define kwn_WMgrHorizButtonIndent       15
160
#define kwn_ClearShadowContrast         16
161
#define kwn_DarkShadowContrast          17
162
#define kwn_WMgrButtonShadowDepth       18
163
#define kwn_MaxIconTitleWidth           19
164
#define kwn_AnimationSpeed              20
165
#define kwn_ThreeDBorderWidth           21
166
#define kwn_MoveOffResistance           22
167
#define kwn_BorderShadowDepth           23
168
#define kwn_TitleShadowDepth            24
169
#define kwn_TitleButtonShadowDepth      25
170
#define kwn_MenuShadowDepth             26
171
#define kwn_IconManagerShadowDepth      27
172
#define kwn_MovePackResistance          28
173
#define kwn_XMoveGrid                   29
174
#define kwn_YMoveGrid                   30
175
#define kwn_OpenWindowTimeout           31
176
#define kwn_RaiseOnClickButton          32
177
178
#define kwn_BorderTop                   33
179
#define kwn_BorderBottom                34
180
#define kwn_BorderLeft                  35
181
#define kwn_BorderRight                 36
182
183
#define kwcl_BorderColor                1
184
#define kwcl_IconManagerHighlight       2
185
#define kwcl_BorderTileForeground       3
186
#define kwcl_BorderTileBackground       4
187
#define kwcl_TitleForeground            5
188
#define kwcl_TitleBackground            6
189
#define kwcl_IconForeground             7
190
#define kwcl_IconBackground             8
191
#define kwcl_IconBorderColor            9
192
#define kwcl_IconManagerForeground      10
193
#define kwcl_IconManagerBackground      11
194
#define kwcl_MapWindowBackground        12
195
#define kwcl_MapWindowForeground        13
196
197
#define kwc_DefaultForeground           1
198
#define kwc_DefaultBackground           2
199
#define kwc_MenuForeground              3
200
#define kwc_MenuBackground              4
201
#define kwc_MenuTitleForeground         5
202
#define kwc_MenuTitleBackground         6
203
#define kwc_MenuShadowColor             7
204
205
206
/*
207
 * The following is sorted alphabetically according to name (which must be
208
 * in lowercase and only contain the letters a-z).  It is fed to a binary
209
 * search to parse keywords.
210
 */
211
static TwmKeyword keytable[] = {
212
	{ "a",                      ALTER, 0 },
213
	{ "all",                    ALL, 0 },
214
	{ "alter",                  ALTER, 0 },
215
	{ "alwaysontop",            ALWAYS_ON_TOP, 0 },
216
	{ "alwaysshowwindowwhenmovingfromworkspacemanager", KEYWORD, kw0_ShowWinWhenMovingInWmgr },
217
	{ "alwayssqueezetogravity", ALWAYSSQUEEZETOGRAVITY, 0 },
218
	{ "animationspeed",         NKEYWORD, kwn_AnimationSpeed },
219
	{ "autofocustotransients",  KEYWORD, kw0_AutoFocusToTransients }, /* kai */
220
	{ "autolower",              AUTO_LOWER, 0 },
221
	{ "autooccupy",             KEYWORD, kw0_AutoOccupy },
222
	{ "autopopup",              AUTO_POPUP, 0 },
223
	{ "autopriority",           KEYWORD, kw0_AutoPriority },
224
	{ "autoraise",              AUTO_RAISE, 0 },
225
	{ "autoraiseicons",         KEYWORD, kw0_AutoRaiseIcons },
226
	{ "autorelativeresize",     KEYWORD, kw0_AutoRelativeResize },
227
	{ "autosqueeze",            AUTOSQUEEZE, 0 },
228
	{ "benicetocolormap",       KEYWORD, kw0_BeNiceToColormap },
229
	{ "borderbottom",           NKEYWORD, kwn_BorderBottom },
230
	{ "bordercolor",            CLKEYWORD, kwcl_BorderColor },
231
	{ "borderleft",             NKEYWORD, kwn_BorderLeft },
232
	{ "borderresizecursors",    KEYWORD, kw0_BorderResizeCursors },
233
	{ "borderright",            NKEYWORD, kwn_BorderRight },
234
	{ "bordershadowdepth",      NKEYWORD, kwn_BorderShadowDepth },
235
	{ "bordertilebackground",   CLKEYWORD, kwcl_BorderTileBackground },
236
	{ "bordertileforeground",   CLKEYWORD, kwcl_BorderTileForeground },
237
	{ "bordertop",              NKEYWORD, kwn_BorderTop },
238
	{ "borderwidth",            NKEYWORD, kwn_BorderWidth },
239
	{ "button",                 BUTTON, 0 },
240
	{ "buttonindent",           NKEYWORD, kwn_ButtonIndent },
241
	{ "c",                      CONTROL, 0 },
496.1.24 by Matthew Fuller
Rename the parser name for the lef/center/right keywords used in
242
	{ "center",                 SIJENUM, SIJ_CENTER },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
243
	{ "centerfeedbackwindow",   KEYWORD, kw0_CenterFeedbackWindow },
244
	{ "changeworkspacefunction", CHANGE_WORKSPACE_FUNCTION, 0 },
245
	{ "clearshadowcontrast",    NKEYWORD, kwn_ClearShadowContrast },
246
	{ "clicktofocus",           KEYWORD, kw0_ClickToFocus },
247
	{ "clientborderwidth",      KEYWORD, kw0_ClientBorderWidth },
248
	{ "color",                  COLOR, 0 },
249
	{ "constrainedmovetime",    NKEYWORD, kwn_ConstrainedMoveTime },
250
	{ "control",                CONTROL, 0 },
251
	{ "cursors",                CURSORS, 0 },
252
	{ "darkshadowcontrast",     NKEYWORD, kwn_DarkShadowContrast },
253
	{ "decoratetransients",     KEYWORD, kw0_DecorateTransients },
254
	{ "defaultbackground",      CKEYWORD, kwc_DefaultBackground },
255
	{ "defaultforeground",      CKEYWORD, kwc_DefaultForeground },
256
	{ "defaultfunction",        DEFAULT_FUNCTION, 0 },
257
	{ "deiconifyfunction",      DEICONIFY_FUNCTION, 0 },
258
	{ "destroy",                KILL, 0 },
259
	{ "donticonifybyunmapping", DONT_ICONIFY_BY_UNMAPPING, 0 },
260
	{ "dontmoveoff",            KEYWORD, kw0_DontMoveOff },
261
	{ "dontpaintrootwindow",    KEYWORD, kw0_DontPaintRootWindow },
262
	{ "dontsave",               DONT_SAVE, 0 },
263
	{ "dontsetinactive",        DONTSETINACTIVE, 0 },
264
	{ "dontshowwelcomewindow",  KEYWORD, kw0_DontShowWelcomeWindow },
265
	{ "dontsqueezetitle",       DONT_SQUEEZE_TITLE, 0 },
266
	{ "donttoggleworkspacemanagerstate", KEYWORD, kw0_DontToggleWorkspacemanagerState},
267
	{ "dontwarpcursorinwmap",   KEYWORD, kw0_DontWarpCursorInWMap },
268
	{ "east",                   DKEYWORD, D_EAST },
269
	{ "ewmhignore",             EWMH_IGNORE, 0 },
270
	{ "f",                      FRAME, 0 },
271
	{ "f.addtoworkspace",       FSKEYWORD, F_ADDTOWORKSPACE },
272
	{ "f.adoptwindow",          FKEYWORD, F_ADOPTWINDOW },
273
	{ "f.altcontext",           FKEYWORD, F_ALTCONTEXT },
274
	{ "f.altkeymap",            FSKEYWORD, F_ALTKEYMAP },
275
	{ "f.autolower",            FKEYWORD, F_AUTOLOWER },
276
	{ "f.autoraise",            FKEYWORD, F_AUTORAISE },
277
	{ "f.backiconmgr",          FKEYWORD, F_BACKICONMGR },
278
	{ "f.backmapiconmgr",       FKEYWORD, F_BACKMAPICONMGR },
279
	{ "f.beep",                 FKEYWORD, F_BEEP },
280
	{ "f.bottomzoom",           FKEYWORD, F_BOTTOMZOOM },
281
	{ "f.changepriority",       FSKEYWORD, F_CHANGEPRIORITY },
282
	{ "f.changesize",           FSKEYWORD, F_CHANGESIZE },
283
	{ "f.circledown",           FKEYWORD, F_CIRCLEDOWN },
284
	{ "f.circleup",             FKEYWORD, F_CIRCLEUP },
285
	{ "f.colormap",             FSKEYWORD, F_COLORMAP },
286
	{ "f.deiconify",            FKEYWORD, F_DEICONIFY },
287
	{ "f.delete",               FKEYWORD, F_DELETE },
288
	{ "f.deleteordestroy",      FKEYWORD, F_DELETEORDESTROY },
289
	{ "f.deltastop",            FKEYWORD, F_DELTASTOP },
290
	{ "f.destroy",              FKEYWORD, F_DESTROY },
291
	{ "f.downiconmgr",          FKEYWORD, F_DOWNICONMGR },
292
	{ "f.downworkspace",        FKEYWORD, F_DOWNWORKSPACE },
293
	{ "f.exec",                 FSKEYWORD, F_EXEC },
294
	{ "f.fill",                 FSKEYWORD, F_FILL },
295
	{ "f.fittocontent",         FKEYWORD, F_FITTOCONTENT },
296
	{ "f.focus",                FKEYWORD, F_FOCUS },
297
	{ "f.forcemove",            FKEYWORD, F_FORCEMOVE },
298
	{ "f.forwiconmgr",          FKEYWORD, F_FORWICONMGR },
299
	{ "f.forwmapiconmgr",       FKEYWORD, F_FORWMAPICONMGR },
300
	{ "f.fullscreenzoom",       FKEYWORD, F_FULLSCREENZOOM },
301
	{ "f.fullzoom",             FKEYWORD, F_FULLZOOM },
302
	{ "f.function",             FSKEYWORD, F_FUNCTION },
303
	{ "f.gotoworkspace",        FSKEYWORD, F_GOTOWORKSPACE },
304
	{ "f.hbzoom",               FKEYWORD, F_BOTTOMZOOM },
305
	{ "f.hideiconmgr",          FKEYWORD, F_HIDELIST },
306
	{ "f.hideworkspacemgr",     FKEYWORD, F_HIDEWORKMGR },
307
	{ "f.horizoom",             FKEYWORD, F_HORIZOOM },
308
	{ "f.htzoom",               FKEYWORD, F_TOPZOOM },
309
	{ "f.hypermove",            FKEYWORD, F_HYPERMOVE },
310
	{ "f.hzoom",                FKEYWORD, F_HORIZOOM },
311
	{ "f.iconify",              FKEYWORD, F_ICONIFY },
312
	{ "f.identify",             FKEYWORD, F_IDENTIFY },
313
	{ "f.initsize",             FKEYWORD, F_INITSIZE },
314
	{ "f.jumpdown",             FSKEYWORD, F_JUMPDOWN },
315
	{ "f.jumpleft",             FSKEYWORD, F_JUMPLEFT },
316
	{ "f.jumpright",            FSKEYWORD, F_JUMPRIGHT },
317
	{ "f.jumpup",               FSKEYWORD, F_JUMPUP },
318
	{ "f.lefticonmgr",          FKEYWORD, F_LEFTICONMGR },
319
	{ "f.leftworkspace",        FKEYWORD, F_LEFTWORKSPACE },
320
	{ "f.leftzoom",             FKEYWORD, F_LEFTZOOM },
321
	{ "f.lower",                FKEYWORD, F_LOWER },
322
	{ "f.menu",                 FSKEYWORD, F_MENU },
323
	{ "f.move",                 FKEYWORD, F_MOVE },
324
	{ "f.movemenu",             FKEYWORD, F_MOVEMENU },
325
	{ "f.movepack",             FKEYWORD, F_MOVEPACK },
326
	{ "f.movepush",             FKEYWORD, F_MOVEPUSH },
327
	{ "f.moveresize",           FSKEYWORD, F_MOVERESIZE },
328
	{ "f.movetitlebar",         FKEYWORD, F_MOVETITLEBAR },
329
	{ "f.movetonextworkspace",  FKEYWORD, F_MOVETONEXTWORKSPACE },
330
	{ "f.movetonextworkspaceandfollow",  FKEYWORD, F_MOVETONEXTWORKSPACEANDFOLLOW },
331
	{ "f.movetoprevworkspace",  FKEYWORD, F_MOVETOPREVWORKSPACE },
332
	{ "f.movetoprevworkspaceandfollow",  FKEYWORD, F_MOVETOPREVWORKSPACEANDFOLLOW },
333
	{ "f.nexticonmgr",          FKEYWORD, F_NEXTICONMGR },
334
	{ "f.nextworkspace",        FKEYWORD, F_NEXTWORKSPACE },
335
	{ "f.nop",                  FKEYWORD, F_NOP },
336
	{ "f.occupy",               FKEYWORD, F_OCCUPY },
337
	{ "f.occupyall",            FKEYWORD, F_OCCUPYALL },
338
	{ "f.pack",                 FSKEYWORD, F_PACK },
339
	{ "f.pin",                  FKEYWORD, F_PIN },
340
	{ "f.previconmgr",          FKEYWORD, F_PREVICONMGR },
341
	{ "f.prevworkspace",        FKEYWORD, F_PREVWORKSPACE },
342
	{ "f.priorityswitching",    FKEYWORD, F_PRIORITYSWITCHING },
343
	{ "f.quit",                 FKEYWORD, F_QUIT },
344
	{ "f.raise",                FKEYWORD, F_RAISE },
345
	{ "f.raiseicons",           FKEYWORD, F_RAISEICONS },
346
	{ "f.raiselower",           FKEYWORD, F_RAISELOWER },
347
	{ "f.raiseorsqueeze",       FKEYWORD, F_RAISEORSQUEEZE },
348
	{ "f.refresh",              FKEYWORD, F_REFRESH },
349
	{ "f.removefromworkspace",  FSKEYWORD, F_REMOVEFROMWORKSPACE },
350
#ifdef SOUNDS
351
	{ "f.rereadsounds",         FKEYWORD, F_REREADSOUNDS },
352
#endif
353
	{ "f.rescuewindows",        FKEYWORD, F_RESCUE_WINDOWS },
354
	{ "f.resize",               FKEYWORD, F_RESIZE },
355
	{ "f.restart",              FKEYWORD, F_RESTART },
356
	{ "f.restoregeometry",      FKEYWORD, F_RESTOREGEOMETRY },
357
	{ "f.righticonmgr",         FKEYWORD, F_RIGHTICONMGR },
358
	{ "f.rightworkspace",       FKEYWORD, F_RIGHTWORKSPACE },
359
	{ "f.rightzoom",            FKEYWORD, F_RIGHTZOOM },
360
	{ "f.ring",                 FKEYWORD, F_RING },
361
	{ "f.savegeometry",         FKEYWORD, F_SAVEGEOMETRY },
362
	{ "f.saveyourself",         FKEYWORD, F_SAVEYOURSELF },
363
	{ "f.separator",            FKEYWORD, F_SEPARATOR },
364
	{ "f.setbuttonsstate",      FKEYWORD, F_SETBUTTONSTATE },
365
	{ "f.setmapstate",          FKEYWORD, F_SETMAPSTATE },
366
	{ "f.setpriority",          FSKEYWORD, F_SETPRIORITY },
367
	{ "f.showbackground",       FKEYWORD, F_SHOWBGRD },
368
	{ "f.showiconmgr",          FKEYWORD, F_SHOWLIST },
369
	{ "f.showworkspacemgr",     FKEYWORD, F_SHOWWORKMGR },
370
	{ "f.slowdownanimation",    FKEYWORD, F_SLOWDOWNANIMATION },
371
	{ "f.sorticonmgr",          FKEYWORD, F_SORTICONMGR },
372
	{ "f.speedupanimation",     FKEYWORD, F_SPEEDUPANIMATION },
373
	{ "f.squeeze",              FKEYWORD, F_SQUEEZE },
374
	{ "f.startanimation",       FKEYWORD, F_STARTANIMATION },
375
	{ "f.stopanimation",        FKEYWORD, F_STOPANIMATION },
376
	{ "f.switchpriority",       FKEYWORD, F_SWITCHPRIORITY },
377
	{ "f.tinylower",            FKEYWORD, F_TINYLOWER },
378
	{ "f.tinyraise",            FKEYWORD, F_TINYRAISE },
379
	{ "f.title",                FKEYWORD, F_TITLE },
380
	{ "f.toggleoccupation",     FSKEYWORD, F_TOGGLEOCCUPATION },
381
#ifdef SOUNDS
382
	{ "f.togglesound",          FKEYWORD, F_TOGGLESOUND },
383
#endif
384
	{ "f.togglestate",          FKEYWORD, F_TOGGLESTATE },
385
	{ "f.toggleworkspacemgr",   FKEYWORD, F_TOGGLEWORKMGR },
386
	{ "f.topzoom",              FKEYWORD, F_TOPZOOM },
387
	{ "f.trace",                FSKEYWORD, F_TRACE },
388
	{ "f.twmrc",                FKEYWORD, F_RESTART },
389
	{ "f.unfocus",              FKEYWORD, F_UNFOCUS },
390
	{ "f.unsqueeze",            FKEYWORD, F_UNSQUEEZE },
391
	{ "f.upiconmgr",            FKEYWORD, F_UPICONMGR },
392
	{ "f.upworkspace",          FKEYWORD, F_UPWORKSPACE },
393
	{ "f.vanish",               FKEYWORD, F_VANISH },
394
	{ "f.version",              FKEYWORD, F_VERSION },
395
	{ "f.vlzoom",               FKEYWORD, F_LEFTZOOM },
396
	{ "f.vrzoom",               FKEYWORD, F_RIGHTZOOM },
397
	{ "f.warphere",             FSKEYWORD, F_WARPHERE },
398
	{ "f.warpring",             FSKEYWORD, F_WARPRING },
399
	{ "f.warpto",               FSKEYWORD, F_WARPTO },
400
	{ "f.warptoiconmgr",        FSKEYWORD, F_WARPTOICONMGR },
401
	{ "f.warptoscreen",         FSKEYWORD, F_WARPTOSCREEN },
402
	{ "f.winrefresh",           FKEYWORD, F_WINREFRESH },
403
	{ "f.zoom",                 FKEYWORD, F_VERTZOOM },
404
	{ "forceicons",             KEYWORD, kw0_ForceIcons },
405
	{ "frame",                  FRAME, 0 },
406
	{ "framepadding",           NKEYWORD, kwn_FramePadding },
407
	{ "function",               FUNCTION, 0 },
408
	{ "i",                      ICON, 0 },
409
	{ "icon",                   ICON, 0 },
410
	{ "iconbackground",         CLKEYWORD, kwcl_IconBackground },
411
	{ "iconbordercolor",        CLKEYWORD, kwcl_IconBorderColor },
412
	{ "iconborderwidth",        NKEYWORD, kwn_IconBorderWidth },
413
	{ "icondirectory",          SKEYWORD, kws_IconDirectory },
414
	{ "iconfont",               SKEYWORD, kws_IconFont },
415
	{ "iconforeground",         CLKEYWORD, kwcl_IconForeground },
416
	{ "iconifybyunmapping",     ICONIFY_BY_UNMAPPING, 0 },
417
	{ "iconifyfunction",        ICONIFY_FUNCTION, 0 },
418
	{ "iconifystyle",           SKEYWORD, kws_IconifyStyle },
419
	{ "iconjustification",      SKEYWORD, kws_IconJustification },
420
	{ "iconmanagerbackground",  CLKEYWORD, kwcl_IconManagerBackground },
421
	{ "iconmanagerdontshow",    ICONMGR_NOSHOW, 0 },
422
	{ "iconmanagerfont",        SKEYWORD, kws_IconManagerFont },
423
	{ "iconmanagerforeground",  CLKEYWORD, kwcl_IconManagerForeground },
424
	{ "iconmanagergeometry",    ICONMGR_GEOMETRY, 0 },
425
	{ "iconmanagerhighlight",   CLKEYWORD, kwcl_IconManagerHighlight },
426
	{ "iconmanagers",           ICONMGRS, 0 },
427
	{ "iconmanagershadowdepth", NKEYWORD, kwn_IconManagerShadowDepth },
428
	{ "iconmanagershow",        ICONMGR_SHOW, 0 },
429
	{ "iconmenudontshow",       ICONMENU_DONTSHOW, 0 },
430
	{ "iconmgr",                ICONMGR, 0 },
431
	{ "iconregion",             ICON_REGION, 0 },
432
	{ "iconregionalignement",   SKEYWORD, kws_IconRegionAlignement },
433
	{ "iconregionjustification", SKEYWORD, kws_IconRegionJustification },
434
	{ "icons",                  ICONS, 0 },
435
	{ "iconsize",               SKEYWORD, kws_IconSize },
436
	{ "ignorecaseinmenuselection",      KEYWORD, kw0_IgnoreCaseInMenuSelection },
437
	{ "ignorelockmodifier",     KEYWORD, kw0_IgnoreLockModifier },
438
	{ "ignoremodifier",         IGNOREMODIFIER, 0 },
439
	{ "ignoretransient",        IGNORE_TRANSIENT, 0 },
440
	{ "interpolatemenucolors",  KEYWORD, kw0_InterpolateMenuColors },
441
	{ "l",                      LOCK, 0 },
496.1.24 by Matthew Fuller
Rename the parser name for the lef/center/right keywords used in
442
	{ "left",                   SIJENUM, SIJ_LEFT },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
443
	{ "lefttitlebutton",        LEFT_TITLEBUTTON, 0 },
444
	{ "lock",                   LOCK, 0 },
445
	{ "m",                      META, 0 },
446
	{ "maketitle",              MAKE_TITLE, 0 },
447
	{ "mapwindowbackground",    CLKEYWORD, kwcl_MapWindowBackground },
448
	{ "mapwindowcurrentworkspace", MAPWINDOWCURRENTWORKSPACE, 0},
449
	{ "mapwindowdefaultworkspace", MAPWINDOWDEFAULTWORKSPACE, 0},
450
	{ "mapwindowforeground",    CLKEYWORD, kwcl_MapWindowForeground },
451
	{ "maxicontitlewidth",      NKEYWORD, kwn_MaxIconTitleWidth },
452
	{ "maxwindowsize",          SKEYWORD, kws_MaxWindowSize },
453
	{ "menu",                   MENU, 0 },
454
	{ "menubackground",         CKEYWORD, kwc_MenuBackground },
455
	{ "menufont",               SKEYWORD, kws_MenuFont },
456
	{ "menuforeground",         CKEYWORD, kwc_MenuForeground },
457
	{ "menushadowcolor",        CKEYWORD, kwc_MenuShadowColor },
458
	{ "menushadowdepth",        NKEYWORD, kwn_MenuShadowDepth },
459
	{ "menutitlebackground",    CKEYWORD, kwc_MenuTitleBackground },
460
	{ "menutitleforeground",    CKEYWORD, kwc_MenuTitleForeground },
461
	{ "meta",                   META, 0 },
462
	{ "mod",                    META, 0 },  /* fake it */
463
	{ "monochrome",             MONOCHROME, 0 },
464
	{ "move",                   MOVE, 0 },
465
	{ "movedelta",              NKEYWORD, kwn_MoveDelta },
466
	{ "moveoffresistance",      NKEYWORD, kwn_MoveOffResistance },
467
	{ "movepackresistance",     NKEYWORD, kwn_MovePackResistance },
473.1.6 by Matthew Fuller
Add a config entry to hold bits for ignoring MWM hints.
468
	{ "mwmignore",              MWM_IGNORE, 0 },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
469
	{ "nobackingstore",         KEYWORD, kw0_NoBackingStore },
470
	{ "noborder",               NO_BORDER, 0 },
471
	{ "nocasesensitive",        KEYWORD, kw0_NoCaseSensitive },
472
	{ "nodefaults",             KEYWORD, kw0_NoDefaults },
473
	{ "nograbserver",           KEYWORD, kw0_NoGrabServer },
474
	{ "nohighlight",            NO_HILITE, 0 },
475
	{ "noiconmanagerfocus",     KEYWORD, kw0_NoIconManagerFocus },
476
	{ "noiconmanagers",         KEYWORD, kw0_NoIconManagers },
477
	{ "noicontitle",            NO_ICON_TITLE, 0  },
478
	{ "noimagesinworkspacemanager", KEYWORD, kw0_NoImagesInWorkSpaceManager },
479
	{ "nomenushadows",          KEYWORD, kw0_NoMenuShadows },
480
	{ "noopaquemove",           NOOPAQUEMOVE, 0 },
481
	{ "noopaqueresize",         NOOPAQUERESIZE, 0 },
482
	{ "noraiseondeiconify",     KEYWORD, kw0_NoRaiseOnDeiconify },
483
	{ "noraiseonmove",          KEYWORD, kw0_NoRaiseOnMove },
484
	{ "noraiseonresize",        KEYWORD, kw0_NoRaiseOnResize },
485
	{ "noraiseonwarp",          KEYWORD, kw0_NoRaiseOnWarp },
486
	{ "north",                  DKEYWORD, D_NORTH },
487
	{ "nosaveunders",           KEYWORD, kw0_NoSaveUnders },
488
	{ "noshowoccupyall",        KEYWORD, kw0_NoShowOccupyAll },
489
	{ "nostackmode",            NO_STACKMODE, 0 },
490
	{ "notitle",                NO_TITLE, 0 },
491
	{ "notitlefocus",           KEYWORD, kw0_NoTitleFocus },
492
	{ "notitlehighlight",       NO_TITLE_HILITE, 0 },
493
	{ "nowarptomenutitle",      KEYWORD, kw0_NoWarpToMenuTitle },
494
	{ "occupy",                 OCCUPYLIST, 0 },
495
	{ "occupyall",              OCCUPYALL, 0 },
496
	{ "ontoppriority",          ON_TOP_PRIORITY, 0 },
497
	{ "opaquemove",             OPAQUEMOVE, 0 },
498
	{ "opaquemovethreshold",    NKEYWORD, kwn_OpaqueMoveThreshold },
499
	{ "opaqueresize",           OPAQUERESIZE, 0 },
500
	{ "opaqueresizethreshold",  NKEYWORD, kwn_OpaqueResizeThreshold },
501
	{ "openwindowtimeout",      NKEYWORD, kwn_OpenWindowTimeout },
502
	{ "packnewwindows",         KEYWORD, kw0_PackNewWindows },
503
	{ "pixmapdirectory",        SKEYWORD, kws_PixmapDirectory },
504
	{ "pixmaps",                PIXMAPS, 0 },
505
	{ "prioritynotswitching",   PRIORITY_NOT_SWITCHING, 0 },
506
	{ "priorityswitching",      PRIORITY_SWITCHING, 0 },
507
	{ "r",                      ROOT, 0 },
508
	{ "raisedelay",             NKEYWORD, kwn_RaiseDelay },
509
	{ "raiseonclick",           KEYWORD, kw0_RaiseOnClick },
510
	{ "raiseonclickbutton",     NKEYWORD, kwn_RaiseOnClickButton },
511
	{ "raiseonwarp",            KEYWORD, kw0_RaiseOnWarp },
512
	{ "raisewhenautounsqueeze", KEYWORD, kw0_RaiseWhenAutoUnSqueeze },
513
	{ "randomplacement",        SSKEYWORD, kwss_RandomPlacement },
514
	{ "reallymoveinworkspacemanager",   KEYWORD, kw0_ReallyMoveInWorkspaceManager },
515
	{ "resize",                 RESIZE, 0 },
516
	{ "resizefont",             SKEYWORD, kws_ResizeFont },
517
	{ "restartpreviousstate",   KEYWORD, kw0_RestartPreviousState },
518
	{ "reversecurrentworkspace", KEYWORD, kw0_ReverseCurrentWorkspace },
496.1.24 by Matthew Fuller
Rename the parser name for the lef/center/right keywords used in
519
	{ "right",                  SIJENUM, SIJ_RIGHT },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
520
	{ "righttitlebutton",       RIGHT_TITLEBUTTON, 0 },
521
	{ "root",                   ROOT, 0 },
463.1.22 by Matthew Fuller
Add RplaySoundHost as an alias for SoundHost, with the intention of
522
	{ "rplaysoundhost",         SKEYWORD, kws_RplaySoundHost },
463.1.7 by Matthew Fuller
Add RplaySounds {} config block for setting sounds in the config file.
523
	{ "rplaysounds",            RPLAY_SOUNDS, 0 },
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
524
	{ "s",                      SHIFT, 0 },
525
	{ "savecolor",              SAVECOLOR, 0},
526
	{ "saveworkspacefocus",     KEYWORD, kw0_SaveWorkspaceFocus },
527
	{ "schrinkicontitles",      KEYWORD, kw0_ShrinkIconTitles },
528
	{ "select",                 SELECT, 0 },
529
	{ "shift",                  SHIFT, 0 },
530
	{ "shortallwindowsmenus",   KEYWORD, kw0_ShortAllWindowsMenus },
531
	{ "showiconmanager",        KEYWORD, kw0_ShowIconManager },
532
	{ "showworkspacemanager",   KEYWORD, kw0_ShowWorkspaceManager },
533
	{ "shrinkicontitles",       KEYWORD, kw0_ShrinkIconTitles },
534
	{ "sloppyfocus",            KEYWORD, kw0_SloppyFocus },
535
	{ "sorticonmanager",        KEYWORD, kw0_SortIconManager },
536
	{ "soundhost",              SKEYWORD, kws_SoundHost },
537
	{ "south",                  DKEYWORD, D_SOUTH },
538
	{ "squeezetitle",           SQUEEZE_TITLE, 0 },
539
	{ "starticonified",         START_ICONIFIED, 0 },
540
	{ "startinmapstate",        KEYWORD, kw0_StartInMapState },
541
	{ "startsqueezed",          STARTSQUEEZED, 0 },
542
	{ "stayupmenus",            KEYWORD, kw0_StayUpMenus },
543
	{ "sunkfocuswindowtitle",   KEYWORD, kw0_SunkFocusWindowTitle },
544
	{ "t",                      TITLE, 0 },
545
	{ "threedborderwidth",      NKEYWORD, kwn_ThreeDBorderWidth },
546
	{ "title",                  TITLE, 0 },
547
	{ "titlebackground",        CLKEYWORD, kwcl_TitleBackground },
548
	{ "titlebuttonborderwidth", NKEYWORD, kwn_TitleButtonBorderWidth },
549
	{ "titlebuttonshadowdepth", NKEYWORD, kwn_TitleButtonShadowDepth },
550
	{ "titlefont",              SKEYWORD, kws_TitleFont },
551
	{ "titleforeground",        CLKEYWORD, kwcl_TitleForeground },
552
	{ "titlehighlight",         TITLE_HILITE, 0 },
553
	{ "titlejustification",     SKEYWORD, kws_TitleJustification },
554
	{ "titlepadding",           NKEYWORD, kwn_TitlePadding },
555
	{ "titleshadowdepth",       NKEYWORD, kwn_TitleShadowDepth },
556
	{ "transienthasoccupation", KEYWORD, kw0_TransientHasOccupation },
557
	{ "transientontop",         NKEYWORD, kwn_TransientOnTop },
558
	{ "unknownicon",            SKEYWORD, kws_UnknownIcon },
559
	{ "unmapbymovingfaraway",   UNMAPBYMOVINGFARAWAY, 0 },
560
	{ "usepposition",           SKEYWORD, kws_UsePPosition },
561
	{ "usesunktitlepixmap",     KEYWORD, kw0_UseSunkTitlePixmap },
562
	{ "usethreedborders",       KEYWORD, kw0_Use3DBorders },
563
	{ "usethreediconborders",   KEYWORD, kw0_use3DIconBorders },
564
	{ "usethreediconmanagers",  KEYWORD, kw0_Use3DIconManagers },
565
	{ "usethreedmenus",         KEYWORD, kw0_Use3DMenus },
566
	{ "usethreedtitles",        KEYWORD, kw0_Use3DTitles },
567
	{ "usethreedwmap",          KEYWORD, kw0_Use3DWMap },
568
	{ "virtualscreens",         VIRTUAL_SCREENS, 0 },
569
	{ "w",                      WINDOW, 0 },
570
	{ "wait",                   WAITC, 0 },
571
	{ "warpcursor",             WARP_CURSOR, 0 },
572
	{ "warpondeiconify",        WARP_ON_DEICONIFY, 0 },
573
	{ "warpringonscreen",       KEYWORD, kw0_WarpRingOnScreen },
574
	{ "warptodefaultmenuentry", KEYWORD, kw0_WarpToDefaultMenuEntry },
575
	{ "warpunmapped",           KEYWORD, kw0_WarpUnmapped },
576
	{ "west",                   DKEYWORD, D_WEST },
577
	{ "window",                 WINDOW, 0 },
578
	{ "windowbox",              WINDOW_BOX, 0 },
579
	{ "windowfunction",         WINDOW_FUNCTION, 0 },
580
	{ "windowgeometries",       WINDOW_GEOMETRIES, 0 },
581
	{ "windowregion",           WINDOW_REGION, 0 },
582
	{ "windowring",             WINDOW_RING, 0 },
583
	{ "windowringexclude",      WINDOW_RING_EXCLUDE, 0},
584
	{ "wmgrbuttonshadowdepth",  NKEYWORD, kwn_WMgrButtonShadowDepth },
585
	{ "wmgrbuttonstyle",        SKEYWORD, kws_WMgrButtonStyle },
586
	{ "wmgrhorizbuttonindent",  NKEYWORD, kwn_WMgrHorizButtonIndent },
587
	{ "wmgrvertbuttonindent",   NKEYWORD, kwn_WMgrVertButtonIndent },
588
	{ "workspace",              WORKSPACE, 0 },
589
	{ "workspacefont",          SKEYWORD, kws_WorkSpaceFont },
590
	{ "workspacemanagergeometry", WORKSPCMGR_GEOMETRY, 0 },
591
	{ "workspaces",             WORKSPACES, 0},
592
	{ "xmovegrid",              NKEYWORD, kwn_XMoveGrid },
593
	{ "xorvalue",               NKEYWORD, kwn_XorValue },
594
	{ "xpmicondirectory",       SKEYWORD, kws_PixmapDirectory },
595
	{ "ymovegrid",              NKEYWORD, kwn_YMoveGrid },
596
	{ "zoom",                   ZOOM, 0 },
597
};
598
599
static int numkeywords = (sizeof(keytable) / sizeof(keytable[0]));
600
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
601
int
501.1.8 by Matthew Fuller
Do easy const-ifications. The _string and _string_string funcs wind
602
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
603
{
434 by Matthew Fuller
Eliminate register qualifiers. The judgements of even very smart
604
	int lower = 0, upper = numkeywords - 1;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
605
606
	while(lower <= upper) {
607
		int middle = (lower + upper) / 2;
608
		TwmKeyword *p = &keytable[middle];
609
		int res = strcasecmp(p->name, s);
610
611
		if(res < 0) {
612
			lower = middle + 1;
613
		}
614
		else if(res == 0) {
615
			*nump = p->subnum;
616
			return p->value;
617
		}
618
		else {
619
			upper = middle - 1;
620
		}
621
	}
622
	return ERRORTOKEN;
623
}
624
625
488 by Matthew Fuller
Add a func to check the order of the entries in our keyword lookup
626
/*
627
 * Simple tester function
628
 */
629
void
630
chk_keytable_order(void)
631
{
632
	int i;
633
634
	for(i = 0 ; i < (numkeywords - 1) ; i++) {
489 by Matthew Fuller
make indent
635
		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
636
			fprintf(stderr, "%s: INTERNAL ERROR: keytable sorting: "
489 by Matthew Fuller
make indent
637
			        "'%s' >= '%s'\n", ProgramName,
638
			        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
639
		}
640
	}
641
}
642
643
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
644
645
/*
646
 * action routines called by grammar
647
 */
648
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
649
bool
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
650
do_single_keyword(int keyword)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
651
{
652
	switch(keyword) {
653
		case kw0_NoDefaults:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
654
			Scr->NoDefaults = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
655
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
656
657
		case kw0_AutoRelativeResize:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
658
			Scr->AutoRelativeResize = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
659
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
660
661
		case kw0_ForceIcons:
662
			if(Scr->FirstTime) {
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
663
				Scr->ForceIcon = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
664
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
665
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
666
667
		case kw0_NoIconManagers:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
668
			Scr->NoIconManagers = 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
671
		case kw0_InterpolateMenuColors:
672
			if(Scr->FirstTime) {
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
673
				Scr->InterpolateMenuColors = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
674
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
675
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
676
677
		case kw0_SortIconManager:
678
			if(Scr->FirstTime) {
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
679
				Scr->SortIconMgr = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
680
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
681
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
682
683
		case kw0_NoGrabServer:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
684
			Scr->NoGrabServer = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
685
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
686
687
		case kw0_NoMenuShadows:
688
			if(Scr->FirstTime) {
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
689
				Scr->Shadow = false;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
690
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
691
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
692
693
		case kw0_NoRaiseOnMove:
694
			if(Scr->FirstTime) {
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
695
				Scr->NoRaiseMove = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
696
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
697
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
698
699
		case kw0_NoRaiseOnResize:
700
			if(Scr->FirstTime) {
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
701
				Scr->NoRaiseResize = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
702
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
703
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
704
705
		case kw0_NoRaiseOnDeiconify:
706
			if(Scr->FirstTime) {
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
707
				Scr->NoRaiseDeicon = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
708
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
709
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
710
711
		case kw0_DontMoveOff:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
712
			Scr->DontMoveOff = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
713
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
714
715
		case kw0_NoBackingStore:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
716
			Scr->BackingStore = false;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
717
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
718
719
		case kw0_NoSaveUnders:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
720
			Scr->SaveUnder = false;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
721
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
722
723
		case kw0_RestartPreviousState:
492.2.48 by Matthew Fuller
Some more Bool->bool conversions.
724
			RestartPreviousState = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
725
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
726
727
		case kw0_ClientBorderWidth:
728
			if(Scr->FirstTime) {
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
729
				Scr->ClientBorderWidth = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
730
			}
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_NoTitleFocus:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
734
			Scr->TitleFocus = false;
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_DecorateTransients:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
738
			Scr->DecorateTransients = 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_ShowIconManager:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
742
			Scr->ShowIconManager = 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_ShowWorkspaceManager:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
746
			Scr->ShowWorkspaceManager = 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_StartInMapState:
497.1.7 by Matthew Fuller
enum-ify the WorkSpaceMgr state.
750
			Scr->workSpaceMgr.initialstate = WMS_map;
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_NoShowOccupyAll:
492.2.85 by Matthew Fuller
int->bool.
754
			Scr->workSpaceMgr.noshowoccupyall = 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_AutoOccupy:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
758
			Scr->AutoOccupy = 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_AutoPriority:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
762
			Scr->AutoPriority = 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_TransientHasOccupation:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
766
			Scr->TransientHasOccupation = true;
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_DontPaintRootWindow:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
770
			Scr->DontPaintRootWindow = true;
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_UseSunkTitlePixmap:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
774
			Scr->UseSunkTitlePixmap = 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_Use3DBorders:
492.2.116 by Matthew Fuller
Some similar missed TRUE->true updates.
778
			Scr->use3Dborders = 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_Use3DIconManagers:
492.2.116 by Matthew Fuller
Some similar missed TRUE->true updates.
782
			Scr->use3Diconmanagers = true;
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_Use3DMenus:
492.2.116 by Matthew Fuller
Some similar missed TRUE->true updates.
786
			Scr->use3Dmenus = true;
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_Use3DTitles:
492.2.116 by Matthew Fuller
Some similar missed TRUE->true updates.
790
			Scr->use3Dtitles = 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_Use3DWMap:
492.2.116 by Matthew Fuller
Some similar missed TRUE->true updates.
794
			Scr->use3Dwmap = 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_SunkFocusWindowTitle:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
798
			Scr->SunkFocusWindowTitle = 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_BeNiceToColormap:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
802
			Scr->BeNiceToColormap = 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_BorderResizeCursors:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
806
			Scr->BorderCursors = 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_NoCaseSensitive:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
810
			Scr->CaseSensitive = false;
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_NoRaiseOnWarp:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
814
			Scr->RaiseOnWarp = false;
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_RaiseOnWarp:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
818
			Scr->RaiseOnWarp = 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_WarpUnmapped:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
822
			Scr->WarpUnmapped = 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_WarpRingOnScreen:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
826
			Scr->WarpRingAnyWhere = false;
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
		case kw0_NoIconManagerFocus:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
830
			Scr->IconManagerFocus = false;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
831
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
832
833
		case kw0_StayUpMenus:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
834
			Scr->StayUpMenus = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
835
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
836
837
		case kw0_ClickToFocus:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
838
			Scr->ClickToFocus = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
839
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
840
841
		case kw0_ReallyMoveInWorkspaceManager:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
842
			Scr->ReallyMoveInWorkspaceManager = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
843
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
844
845
		case kw0_ShowWinWhenMovingInWmgr:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
846
			Scr->ShowWinWhenMovingInWmgr = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
847
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
848
849
		case kw0_ReverseCurrentWorkspace:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
850
			Scr->ReverseCurrentWorkspace = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
851
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
852
853
		case kw0_DontWarpCursorInWMap:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
854
			Scr->DontWarpCursorInWMap = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
855
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
856
857
		case kw0_CenterFeedbackWindow:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
858
			Scr->CenterFeedbackWindow = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
859
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
860
861
		case kw0_WarpToDefaultMenuEntry:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
862
			Scr->WarpToDefaultMenuEntry = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
863
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
864
865
		case kw0_ShrinkIconTitles:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
866
			Scr->ShrinkIconTitles = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
867
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
868
869
		case kw0_AutoRaiseIcons:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
870
			Scr->AutoRaiseIcons = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
871
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
872
873
		/* kai */
874
		case kw0_AutoFocusToTransients:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
875
			Scr->AutoFocusToTransients = true;
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_use3DIconBorders:
492.2.116 by Matthew Fuller
Some similar missed TRUE->true updates.
879
			Scr->use3Diconborders = 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
882
		case kw0_ShortAllWindowsMenus:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
883
			Scr->ShortAllWindowsMenus = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
884
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
885
886
		case kw0_RaiseWhenAutoUnSqueeze:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
887
			Scr->RaiseWhenAutoUnSqueeze = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
888
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
889
890
		case kw0_RaiseOnClick:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
891
			Scr->RaiseOnClick = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
892
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
893
894
		case kw0_IgnoreLockModifier:
895
			Scr->IgnoreModifier |= LockMask;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
896
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
897
898
		case kw0_PackNewWindows:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
899
			Scr->PackNewWindows = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
900
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
901
902
		case kw0_IgnoreCaseInMenuSelection:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
903
			Scr->IgnoreCaseInMenuSelection = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
904
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
905
906
		case kw0_SloppyFocus:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
907
			Scr->SloppyFocus = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
908
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
909
910
		case kw0_SaveWorkspaceFocus:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
911
			Scr->SaveWorkspaceFocus = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
912
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
913
914
		case kw0_NoImagesInWorkSpaceManager:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
915
			Scr->NoImagesInWorkSpaceManager = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
916
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
917
918
		case kw0_NoWarpToMenuTitle:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
919
			Scr->NoWarpToMenuTitle = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
920
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
921
922
		case kw0_DontShowWelcomeWindow:
492.2.70 by Matthew Fuller
Convert WelcomeWindow conditionals (in multiple structs) to bool.
923
			Scr->ShowWelcomeWindow = false;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
924
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
925
926
		case kw0_DontToggleWorkspacemanagerState:
492.2.104 by Matthew Fuller
Massive rewrite of various struct Screen config params that are
927
			Scr->DontToggleWorkspaceManagerState = true;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
928
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
929
930
	}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
931
	return false;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
932
}
933
934
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
935
bool
501.1.8 by Matthew Fuller
Do easy const-ifications. The _string and _string_string funcs wind
936
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
937
{
938
	switch(keyword) {
939
		case kwss_RandomPlacement: {
502.1.1 by Matthew Fuller
Add some whitespace/comments through the RandomPlacement config
940
			/* 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
941
			int rp;
942
			int gmask, gx, gy;     // Geometry mask/x/y values
943
			unsigned int gjw, gjh; // width/height (ignored)
944
			int exmask = (XValue | YValue); // Bits we need in the mask
502.1.1 by Matthew Fuller
Add some whitespace/comments through the RandomPlacement config
945
502.1.2 by Matthew Fuller
Switch to using local vars rather than the global Junk's in this
946
			rp = ParseRandomPlacement(s1);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
947
			if(rp < 0) {
948
				twmrc_error_prefix();
949
				fprintf(stderr,
502.1.1 by Matthew Fuller
Add some whitespace/comments through the RandomPlacement config
950
				        "ignoring invalid RandomPlacement argument 1 \"%s\"\n",
951
				        s1);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
952
			}
953
			else {
954
				Scr->RandomPlacement = rp;
955
			}
502.1.1 by Matthew Fuller
Add some whitespace/comments through the RandomPlacement config
956
957
			/* If no geom, we're done */
435.1.4 by Matthew Fuller
Eliminate the need for defstring in do_string_string_keyword() by just
958
			if(s2 == NULL) {
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
959
				return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
960
			}
502.1.1 by Matthew Fuller
Add some whitespace/comments through the RandomPlacement config
961
962
			/*
963
			 * 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
964
			 * the size (it probably won't even be provided), so the
965
			 * width/height are junk.  The X/Y offsets are what we need.
966
			 * But we do need them.
502.1.1 by Matthew Fuller
Add some whitespace/comments through the RandomPlacement config
967
			 */
502.1.2 by Matthew Fuller
Switch to using local vars rather than the global Junk's in this
968
			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
969
#ifdef DEBUG
502.1.2 by Matthew Fuller
Switch to using local vars rather than the global Junk's in this
970
			fprintf(stderr, "DEBUG:: Mask = %x, Width = %d, Height = %d\n",
971
			        gmask, gjw, gjh);
972
			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
973
#endif
502.1.2 by Matthew Fuller
Switch to using local vars rather than the global Junk's in this
974
			if((gmask & exmask) != exmask) {
975
				/* Didn't get X and Y */
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
976
				twmrc_error_prefix();
977
				fprintf(stderr,
978
				        "ignoring invalid RandomPlacement displacement \"%s\"\n", s2);
979
			}
980
			else {
502.1.2 by Matthew Fuller
Switch to using local vars rather than the global Junk's in this
981
				Scr->RandomDisplacementX = gx;
982
				Scr->RandomDisplacementY = gy;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
983
			}
502.1.1 by Matthew Fuller
Add some whitespace/comments through the RandomPlacement config
984
985
			/* Done */
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
	}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
989
	return false;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
990
}
991
992
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
993
bool
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
994
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
995
{
996
	switch(keyword) {
997
		case kws_UsePPosition: {
998
			int ppos = ParseUsePPosition(s);
999
			if(ppos < 0) {
1000
				twmrc_error_prefix();
1001
				fprintf(stderr,
1002
				        "ignoring invalid UsePPosition argument \"%s\"\n", s);
1003
			}
1004
			else {
1005
				Scr->UsePPosition = ppos;
1006
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1007
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1008
		}
1009
1010
		case kws_IconFont:
1011
			if(!Scr->HaveFonts) {
1012
				Scr->IconFont.basename = s;
1013
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1014
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1015
1016
		case kws_ResizeFont:
1017
			if(!Scr->HaveFonts) {
1018
				Scr->SizeFont.basename = s;
1019
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1020
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1021
1022
		case kws_MenuFont:
1023
			if(!Scr->HaveFonts) {
1024
				Scr->MenuFont.basename = s;
1025
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1026
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1027
1028
		case kws_WorkSpaceFont:
1029
			if(!Scr->HaveFonts) {
1030
				Scr->workSpaceMgr.windowFont.basename = s;
1031
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1032
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1033
1034
		case kws_TitleFont:
1035
			if(!Scr->HaveFonts) {
1036
				Scr->TitleBarFont.basename = s;
1037
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1038
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1039
1040
		case kws_IconManagerFont:
1041
			if(!Scr->HaveFonts) {
1042
				Scr->IconManagerFont.basename = s;
1043
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1044
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1045
1046
		case kws_UnknownIcon:
1047
			if(Scr->FirstTime) {
481.1.13 by Matthew Fuller
GetUnknownIcon() was a 1-line function used in 1 place, so just expand
1048
				Scr->UnknownImage = GetImage(s, Scr->IconC);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1049
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1050
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1051
1052
		case kws_IconDirectory:
1053
			if(Scr->FirstTime) {
1054
				Scr->IconDirectory = ExpandFilePath(s);
1055
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1056
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1057
1058
		case kws_PixmapDirectory:
1059
			if(Scr->FirstTime) {
1060
				Scr->PixmapDirectory = ExpandFilePath(s);
1061
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1062
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1063
502.1.3 by Matthew Fuller
Switch to local geometry vars and an intermediate for the
1064
		case kws_MaxWindowSize: {
1065
			int gmask;
1066
			int exmask = (WidthValue | HeightValue);
1067
			unsigned int gw, gh; // Stuff we care about
1068
			int gjx, gjy;        // Stuff we don't
1069
1070
			gmask = XParseGeometry(s, &gjx, &gjy, &gw, &gh);
1071
			if((gmask & exmask) != exmask) {
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1072
				twmrc_error_prefix();
1073
				fprintf(stderr, "bad MaxWindowSize \"%s\"\n", s);
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1074
				return false;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1075
			}
502.1.3 by Matthew Fuller
Switch to local geometry vars and an intermediate for the
1076
			if(gw == 0 || gh == 0) {
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1077
				twmrc_error_prefix();
1078
				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
1079
				return false;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1080
			}
502.1.3 by Matthew Fuller
Switch to local geometry vars and an intermediate for the
1081
			Scr->MaxWindowWidth = gw;
1082
			Scr->MaxWindowHeight = gh;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1083
			return true;
502.1.3 by Matthew Fuller
Switch to local geometry vars and an intermediate for the
1084
		}
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1085
1086
		case kws_IconJustification: {
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 IconJustification argument \"%s\"\n", s);
1093
			}
1094
			else {
1095
				Scr->IconJustification = 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
		}
1099
		case kws_IconRegionJustification: {
496.1.17 by Matthew Fuller
Convert IconRegion Justification to its own enum type too. This is
1100
			int just = ParseIRJustification(s);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1101
496.1.17 by Matthew Fuller
Convert IconRegion Justification to its own enum type too. This is
1102
			if(just < 0 || (just == IRJ_UNDEF)) {
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1103
				twmrc_error_prefix();
1104
				fprintf(stderr,
1105
				        "ignoring invalid IconRegionJustification argument \"%s\"\n", s);
1106
			}
1107
			else {
1108
				Scr->IconRegionJustification = just;
1109
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1110
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1111
		}
1112
		case kws_IconRegionAlignement: {
1113
			int just = ParseAlignement(s);
1114
1115
			if(just < 0) {
1116
				twmrc_error_prefix();
1117
				fprintf(stderr,
1118
				        "ignoring invalid IconRegionAlignement argument \"%s\"\n", s);
1119
			}
1120
			else {
1121
				Scr->IconRegionAlignement = just;
1122
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1123
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1124
		}
1125
1126
		case kws_TitleJustification: {
496.1.16 by Matthew Fuller
Convert TitleJustification elements to their own enum type, and fixup
1127
			int just = ParseTitleJustification(s);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1128
496.1.16 by Matthew Fuller
Convert TitleJustification elements to their own enum type, and fixup
1129
			if((just < 0) || (just == TJ_UNDEF)) {
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1130
				twmrc_error_prefix();
1131
				fprintf(stderr,
1132
				        "ignoring invalid TitleJustification argument \"%s\"\n", s);
1133
			}
1134
			else {
1135
				Scr->TitleJustification = just;
1136
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1137
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1138
		}
463.1.22 by Matthew Fuller
Add RplaySoundHost as an alias for SoundHost, with the intention of
1139
		case kws_RplaySoundHost:
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1140
		case kws_SoundHost:
1141
			if(Scr->FirstTime) {
463.1.22 by Matthew Fuller
Add RplaySoundHost as an alias for SoundHost, with the intention of
1142
				/* Warning to be enabled in the future before removal */
1143
				if(0 && keyword == kws_SoundHost) {
1144
					twmrc_error_prefix();
1145
					fprintf(stderr, "SoundHost is deprecated, please "
463.1.33 by Matthew Fuller
make indent.
1146
					        "use RplaySoundHost instead.\n");
463.1.22 by Matthew Fuller
Add RplaySoundHost as an alias for SoundHost, with the intention of
1147
				}
463.1.20 by Matthew Fuller
Accept SoundHost config param even if we're built without sound, and
1148
#ifdef SOUNDS
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1149
				set_sound_host(s);
463.1.20 by Matthew Fuller
Accept SoundHost config param even if we're built without sound, and
1150
#else
1151
				twmrc_error_prefix();
463.1.22 by Matthew Fuller
Add RplaySoundHost as an alias for SoundHost, with the intention of
1152
				fprintf(stderr, "Ignoring %sSoundHost; rplay not ronfigured.\n",
463.1.33 by Matthew Fuller
make indent.
1153
				        (keyword == kws_RplaySoundHost ? "Rplay" : ""));
463.1.20 by Matthew Fuller
Accept SoundHost config param even if we're built without sound, and
1154
#endif
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1155
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1156
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1157
1158
		case kws_WMgrButtonStyle: {
1159
			int style = ParseButtonStyle(s);
1160
1161
			if(style < 0) {
1162
				twmrc_error_prefix();
1163
				fprintf(stderr,
1164
				        "ignoring invalid WMgrButtonStyle argument \"%s\"\n", s);
1165
			}
1166
			else {
1167
				Scr->workSpaceMgr.buttonStyle = style;
1168
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1169
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1170
		}
1171
1172
		case kws_IconifyStyle: {
497.1.4 by Matthew Fuller
enum-ify IconifyStyle. Move parsing the options into a helper
1173
			int style = ParseIconifyStyle(s);
1174
1175
			if(style < 0) {
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1176
				twmrc_error_prefix();
1177
				fprintf(stderr, "ignoring invalid IconifyStyle argument \"%s\"\n", s);
1178
			}
497.1.4 by Matthew Fuller
enum-ify IconifyStyle. Move parsing the options into a helper
1179
			else {
1180
				Scr->IconifyStyle = style;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1181
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1182
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1183
		}
1184
1185
#ifdef EWMH
1186
		case kws_IconSize:
1187
			if(sscanf(s, "%dx%d", &Scr->PreferredIconWidth,
1188
			                &Scr->PreferredIconHeight) == 2) {
1189
				/* ok */
1190
			}
1191
			else if(sscanf(s, "%d", &Scr->PreferredIconWidth) == 1) {
1192
				Scr->PreferredIconHeight = Scr->PreferredIconWidth;
1193
			}
1194
			else {
1195
				Scr->PreferredIconHeight = Scr->PreferredIconWidth = 48;
1196
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1197
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1198
#endif
1199
	}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1200
	return false;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1201
}
1202
1203
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1204
bool
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1205
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
1206
{
1207
	switch(keyword) {
1208
		case kwn_ConstrainedMoveTime:
1209
			ConstrainedMoveTime = num;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1210
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1211
1212
		case kwn_MoveDelta:
1213
			Scr->MoveDelta = num;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1214
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1215
1216
		case kwn_MoveOffResistance:
1217
			Scr->MoveOffResistance = num;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1218
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1219
1220
		case kwn_MovePackResistance:
1221
			if(num < 0) {
1222
				num = 20;
1223
			}
1224
			Scr->MovePackResistance = num;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1225
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1226
1227
		case kwn_XMoveGrid:
501.1.3 by Matthew Fuller
Take out some unnecessary whitespace, that probably served for visual
1228
			if(num < 1) {
1229
				num = 1;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1230
			}
1231
			if(num > 100) {
1232
				num = 100;
1233
			}
1234
			Scr->XMoveGrid = num;
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_YMoveGrid:
501.1.3 by Matthew Fuller
Take out some unnecessary whitespace, that probably served for visual
1238
			if(num < 1) {
1239
				num = 1;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1240
			}
1241
			if(num > 100) {
1242
				num = 100;
1243
			}
1244
			Scr->YMoveGrid = num;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1245
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1246
1247
		case kwn_XorValue:
1248
			if(Scr->FirstTime) {
1249
				Scr->XORvalue = num;
1250
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1251
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1252
1253
		case kwn_FramePadding:
1254
			if(Scr->FirstTime) {
1255
				Scr->FramePadding = num;
1256
			}
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_TitlePadding:
1260
			if(Scr->FirstTime) {
1261
				Scr->TitlePadding = 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_ButtonIndent:
1266
			if(Scr->FirstTime) {
1267
				Scr->ButtonIndent = 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_ThreeDBorderWidth:
1272
			if(Scr->FirstTime) {
1273
				Scr->ThreeDBorderWidth = 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_BorderWidth:
1278
			if(Scr->FirstTime) {
1279
				Scr->BorderWidth = num;
1280
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1281
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1282
1283
		case kwn_IconBorderWidth:
1284
			if(Scr->FirstTime) {
1285
				Scr->IconBorderWidth = num;
1286
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1287
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1288
1289
		case kwn_TitleButtonBorderWidth:
1290
			if(Scr->FirstTime) {
1291
				Scr->TBInfo.border = num;
1292
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1293
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1294
1295
		case kwn_RaiseDelay:
1296
			RaiseDelay = num;
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_TransientOnTop:
1300
			if(Scr->FirstTime) {
1301
				Scr->TransientOnTop = num;
1302
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1303
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1304
1305
		case kwn_OpaqueMoveThreshold:
1306
			if(Scr->FirstTime) {
1307
				Scr->OpaqueMoveThreshold = num;
1308
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1309
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1310
1311
		case kwn_OpaqueResizeThreshold:
1312
			if(Scr->FirstTime) {
1313
				Scr->OpaqueResizeThreshold = num;
1314
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1315
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1316
1317
		case kwn_WMgrVertButtonIndent:
1318
			if(Scr->FirstTime) {
1319
				Scr->WMgrVertButtonIndent = num;
1320
			}
1321
			if(Scr->WMgrVertButtonIndent < 0) {
1322
				Scr->WMgrVertButtonIndent = 0;
1323
			}
1324
			Scr->workSpaceMgr.vspace = Scr->WMgrVertButtonIndent;
1325
			Scr->workSpaceMgr.occupyWindow->vspace = Scr->WMgrVertButtonIndent;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1326
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1327
1328
		case kwn_WMgrHorizButtonIndent:
1329
			if(Scr->FirstTime) {
1330
				Scr->WMgrHorizButtonIndent = num;
1331
			}
1332
			if(Scr->WMgrHorizButtonIndent < 0) {
1333
				Scr->WMgrHorizButtonIndent = 0;
1334
			}
1335
			Scr->workSpaceMgr.hspace = Scr->WMgrHorizButtonIndent;
1336
			Scr->workSpaceMgr.occupyWindow->hspace = Scr->WMgrHorizButtonIndent;
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1337
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1338
1339
		case kwn_WMgrButtonShadowDepth:
1340
			if(Scr->FirstTime) {
1341
				Scr->WMgrButtonShadowDepth = num;
1342
			}
1343
			if(Scr->WMgrButtonShadowDepth < 1) {
1344
				Scr->WMgrButtonShadowDepth = 1;
1345
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1346
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1347
1348
		case kwn_MaxIconTitleWidth:
1349
			if(Scr->FirstTime) {
1350
				Scr->MaxIconTitleWidth = num;
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_ClearShadowContrast:
1355
			if(Scr->FirstTime) {
1356
				Scr->ClearShadowContrast = num;
1357
			}
501.1.3 by Matthew Fuller
Take out some unnecessary whitespace, that probably served for visual
1358
			if(Scr->ClearShadowContrast < 0) {
1359
				Scr->ClearShadowContrast = 0;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1360
			}
1361
			if(Scr->ClearShadowContrast > 100) {
1362
				Scr->ClearShadowContrast = 100;
1363
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1364
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1365
1366
		case kwn_DarkShadowContrast:
1367
			if(Scr->FirstTime) {
1368
				Scr->DarkShadowContrast = num;
1369
			}
501.1.3 by Matthew Fuller
Take out some unnecessary whitespace, that probably served for visual
1370
			if(Scr->DarkShadowContrast < 0) {
1371
				Scr->DarkShadowContrast = 0;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1372
			}
1373
			if(Scr->DarkShadowContrast > 100) {
1374
				Scr->DarkShadowContrast = 100;
1375
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1376
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1377
1378
		case kwn_AnimationSpeed:
1379
			if(num < 0) {
1380
				num = 0;
1381
			}
1382
			SetAnimationSpeed(num);
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1383
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1384
1385
		case kwn_BorderShadowDepth:
1386
			if(Scr->FirstTime) {
1387
				Scr->BorderShadowDepth = num;
1388
			}
1389
			if(Scr->BorderShadowDepth < 0) {
1390
				Scr->BorderShadowDepth = 2;
1391
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1392
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1393
1394
		case kwn_BorderLeft:
1395
			if(Scr->FirstTime) {
1396
				Scr->BorderLeft = num;
1397
			}
1398
			if(Scr->BorderLeft < 0) {
1399
				Scr->BorderLeft = 0;
1400
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1401
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1402
1403
		case kwn_BorderRight:
1404
			if(Scr->FirstTime) {
1405
				Scr->BorderRight = num;
1406
			}
1407
			if(Scr->BorderRight < 0) {
1408
				Scr->BorderRight = 0;
1409
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1410
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1411
1412
		case kwn_BorderTop:
1413
			if(Scr->FirstTime) {
1414
				Scr->BorderTop = num;
1415
			}
1416
			if(Scr->BorderTop < 0) {
1417
				Scr->BorderTop = 0;
1418
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1419
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1420
1421
		case kwn_BorderBottom:
1422
			if(Scr->FirstTime) {
1423
				Scr->BorderBottom = num;
1424
			}
1425
			if(Scr->BorderBottom < 0) {
1426
				Scr->BorderBottom = 0;
1427
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1428
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1429
1430
		case kwn_TitleButtonShadowDepth:
1431
			if(Scr->FirstTime) {
1432
				Scr->TitleButtonShadowDepth = num;
1433
			}
1434
			if(Scr->TitleButtonShadowDepth < 0) {
1435
				Scr->TitleButtonShadowDepth = 2;
1436
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1437
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1438
1439
		case kwn_TitleShadowDepth:
1440
			if(Scr->FirstTime) {
1441
				Scr->TitleShadowDepth = num;
1442
			}
1443
			if(Scr->TitleShadowDepth < 0) {
1444
				Scr->TitleShadowDepth = 2;
1445
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1446
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1447
1448
		case kwn_IconManagerShadowDepth:
1449
			if(Scr->FirstTime) {
1450
				Scr->IconManagerShadowDepth = num;
1451
			}
1452
			if(Scr->IconManagerShadowDepth < 0) {
1453
				Scr->IconManagerShadowDepth = 2;
1454
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1455
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1456
1457
		case kwn_MenuShadowDepth:
1458
			if(Scr->FirstTime) {
1459
				Scr->MenuShadowDepth = num;
1460
			}
1461
			if(Scr->MenuShadowDepth < 0) {
1462
				Scr->MenuShadowDepth = 2;
1463
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1464
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1465
1466
		case kwn_OpenWindowTimeout:
1467
			if(Scr->FirstTime) {
1468
				Scr->OpenWindowTimeout = num;
1469
			}
1470
			if(Scr->OpenWindowTimeout < 0) {
1471
				Scr->OpenWindowTimeout = 0;
1472
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1473
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1474
1475
		case kwn_RaiseOnClickButton:
1476
			if(Scr->FirstTime) {
1477
				Scr->RaiseOnClickButton = num;
1478
			}
1479
			if(Scr->RaiseOnClickButton < 1) {
1480
				Scr->RaiseOnClickButton = 1;
1481
			}
1482
			if(Scr->RaiseOnClickButton > MAX_BUTTONS) {
1483
				Scr->RaiseOnClickButton = MAX_BUTTONS;
1484
			}
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1485
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1486
1487
1488
	}
1489
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1490
	return false;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1491
}
1492
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1493
name_list **
1494
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
1495
{
1496
	switch(keyword) {
1497
		case kwcl_BorderColor:
1498
			GetColor(colormode, &Scr->BorderColorC.back, s);
1499
			return &Scr->BorderColorL;
1500
1501
		case kwcl_IconManagerHighlight:
1502
			GetColor(colormode, &Scr->IconManagerHighlight, s);
1503
			return &Scr->IconManagerHighlightL;
1504
1505
		case kwcl_BorderTileForeground:
1506
			GetColor(colormode, &Scr->BorderTileC.fore, s);
1507
			return &Scr->BorderTileForegroundL;
1508
1509
		case kwcl_BorderTileBackground:
1510
			GetColor(colormode, &Scr->BorderTileC.back, s);
1511
			return &Scr->BorderTileBackgroundL;
1512
1513
		case kwcl_TitleForeground:
1514
			GetColor(colormode, &Scr->TitleC.fore, s);
1515
			return &Scr->TitleForegroundL;
1516
1517
		case kwcl_TitleBackground:
1518
			GetColor(colormode, &Scr->TitleC.back, s);
1519
			return &Scr->TitleBackgroundL;
1520
1521
		case kwcl_IconForeground:
1522
			GetColor(colormode, &Scr->IconC.fore, s);
1523
			return &Scr->IconForegroundL;
1524
1525
		case kwcl_IconBackground:
1526
			GetColor(colormode, &Scr->IconC.back, s);
1527
			return &Scr->IconBackgroundL;
1528
1529
		case kwcl_IconBorderColor:
1530
			GetColor(colormode, &Scr->IconBorderColor, s);
1531
			return &Scr->IconBorderColorL;
1532
1533
		case kwcl_IconManagerForeground:
1534
			GetColor(colormode, &Scr->IconManagerC.fore, s);
1535
			return &Scr->IconManagerFL;
1536
1537
		case kwcl_IconManagerBackground:
1538
			GetColor(colormode, &Scr->IconManagerC.back, s);
1539
			return &Scr->IconManagerBL;
1540
1541
		case kwcl_MapWindowBackground:
1542
			GetColor(colormode, &Scr->workSpaceMgr.windowcp.back, s);
492.2.63 by Matthew Fuller
boolify these struct members.
1543
			Scr->workSpaceMgr.windowcpgiven = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1544
			return &Scr->workSpaceMgr.windowBackgroundL;
1545
1546
		case kwcl_MapWindowForeground:
1547
			GetColor(colormode, &Scr->workSpaceMgr.windowcp.fore, s);
492.2.63 by Matthew Fuller
boolify these struct members.
1548
			Scr->workSpaceMgr.windowcpgiven = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1549
			return &Scr->workSpaceMgr.windowForegroundL;
1550
	}
1551
	return NULL;
1552
}
1553
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1554
bool
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1555
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
1556
{
1557
	switch(keyword) {
1558
		case kwc_DefaultForeground:
1559
			GetColor(colormode, &Scr->DefaultC.fore, s);
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1560
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1561
1562
		case kwc_DefaultBackground:
1563
			GetColor(colormode, &Scr->DefaultC.back, s);
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1564
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1565
1566
		case kwc_MenuForeground:
1567
			GetColor(colormode, &Scr->MenuC.fore, s);
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1568
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1569
1570
		case kwc_MenuBackground:
1571
			GetColor(colormode, &Scr->MenuC.back, s);
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1572
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1573
1574
		case kwc_MenuTitleForeground:
1575
			GetColor(colormode, &Scr->MenuTitleC.fore, s);
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1576
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1577
1578
		case kwc_MenuTitleBackground:
1579
			GetColor(colormode, &Scr->MenuTitleC.back, s);
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1580
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1581
1582
		case kwc_MenuShadowColor:
1583
			GetColor(colormode, &Scr->MenuShadowColor, s);
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1584
			return true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1585
1586
	}
1587
501.1.6 by Matthew Fuller
bool-ify these parser routines, that are already being boolean with
1588
	return false;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1589
}
1590
1591
/*
1592
 * put_pixel_on_root() Save a pixel value in twm root window color property.
1593
 */
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1594
static void
1595
put_pixel_on_root(Pixel pixel)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1596
{
1597
	int           i, addPixel = 1;
1598
	Atom          retAtom;
1599
	int           retFormat;
1600
	unsigned long nPixels, retAfter;
1601
	Pixel        *retProp;
1602
1603
	if(XGetWindowProperty(dpy, Scr->Root, XA__MIT_PRIORITY_COLORS, 0, 8192,
1604
	                      False, XA_CARDINAL, &retAtom,
1605
	                      &retFormat, &nPixels, &retAfter,
1606
	                      (unsigned char **)&retProp) != Success || !retProp) {
1607
		return;
1608
	}
1609
1610
	for(i = 0; i < nPixels; i++)
1611
		if(pixel == retProp[i]) {
1612
			addPixel = 0;
1613
		}
1614
503.1.18 by Matthew Fuller
Stop casting XFree() arg; it's now spec'd to take a void * anyway.
1615
	XFree(retProp);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1616
1617
	if(addPixel)
1618
		XChangeProperty(dpy, Scr->Root, XA__MIT_PRIORITY_COLORS,
1619
		                XA_CARDINAL, 32, PropModeAppend,
1620
		                (unsigned char *)&pixel, 1);
1621
}
1622
1623
/*
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
{
1629
	Pixel p;
1630
	GetColor(colormode, &p, s);
1631
	put_pixel_on_root(p);
501.1.4 by Matthew Fuller
These functions only ever return a meaningless value, and never have
1632
	return;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1633
}
1634
1635
/*
1636
 * do_var_savecolor() save a color from a var in the twmrc file.
1637
 */
1638
typedef struct _cnode {
1639
	int i;
1640
	struct _cnode *next;
1641
} Cnode, *Cptr;
1642
static Cptr chead = NULL;
1643
501.1.4 by Matthew Fuller
These functions only ever return a meaningless value, and never have
1644
void
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1645
do_var_savecolor(int key)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1646
{
1647
	Cptr cptrav, cpnew;
1648
	if(!chead) {
491.1.8 by Matthew Fuller
Stop casting return values of [mc]alloc(). void * has existed for 27
1649
		chead = malloc(sizeof(Cnode));
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1650
		chead->i = key;
1651
		chead->next = NULL;
1652
	}
1653
	else {
1654
		cptrav = chead;
1655
		while(cptrav->next != NULL) {
1656
			cptrav = cptrav->next;
1657
		}
491.1.8 by Matthew Fuller
Stop casting return values of [mc]alloc(). void * has existed for 27
1658
		cpnew = malloc(sizeof(Cnode));
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1659
		cpnew->i = key;
1660
		cpnew->next = NULL;
1661
		cptrav->next = cpnew;
1662
	}
501.1.4 by Matthew Fuller
These functions only ever return a meaningless value, and never have
1663
	return;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1664
}
1665
1666
/*
1667
 * assign_var_savecolor() traverse the var save color list placeing the pixels
1668
 *                        in the root window property.
1669
 */
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1670
void
1671
assign_var_savecolor(void)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1672
{
1673
	Cptr cp = chead;
1674
	while(cp != NULL) {
1675
		switch(cp->i) {
1676
			case kwcl_BorderColor:
1677
				put_pixel_on_root(Scr->BorderColorC.back);
1678
				break;
1679
			case kwcl_IconManagerHighlight:
1680
				put_pixel_on_root(Scr->IconManagerHighlight);
1681
				break;
1682
			case kwcl_BorderTileForeground:
1683
				put_pixel_on_root(Scr->BorderTileC.fore);
1684
				break;
1685
			case kwcl_BorderTileBackground:
1686
				put_pixel_on_root(Scr->BorderTileC.back);
1687
				break;
1688
			case kwcl_TitleForeground:
1689
				put_pixel_on_root(Scr->TitleC.fore);
1690
				break;
1691
			case kwcl_TitleBackground:
1692
				put_pixel_on_root(Scr->TitleC.back);
1693
				break;
1694
			case kwcl_IconForeground:
1695
				put_pixel_on_root(Scr->IconC.fore);
1696
				break;
1697
			case kwcl_IconBackground:
1698
				put_pixel_on_root(Scr->IconC.back);
1699
				break;
1700
			case kwcl_IconBorderColor:
1701
				put_pixel_on_root(Scr->IconBorderColor);
1702
				break;
1703
			case kwcl_IconManagerForeground:
1704
				put_pixel_on_root(Scr->IconManagerC.fore);
1705
				break;
1706
			case kwcl_IconManagerBackground:
1707
				put_pixel_on_root(Scr->IconManagerC.back);
1708
				break;
1709
			case kwcl_MapWindowForeground:
1710
				put_pixel_on_root(Scr->workSpaceMgr.windowcp.fore);
1711
				break;
1712
			case kwcl_MapWindowBackground:
1713
				put_pixel_on_root(Scr->workSpaceMgr.windowcp.back);
1714
				break;
1715
		}
1716
		cp = cp->next;
1717
	}
1718
	if(chead) {
1719
		free(chead);
1720
		chead = NULL;
1721
	}
1722
}
1723
497.1.1 by Matthew Fuller
enum-ify Screen->RandomPlacement.
1724
1725
/*
1726
 * RandomPlacement [...] parse
1727
 */
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1728
static int
497.1.1 by Matthew Fuller
enum-ify Screen->RandomPlacement.
1729
ParseRandomPlacement(const char *s)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1730
{
497.1.1 by Matthew Fuller
enum-ify Screen->RandomPlacement.
1731
	/* No first arg -> 'all' */
435.1.4 by Matthew Fuller
Eliminate the need for defstring in do_string_string_keyword() by just
1732
	if(s == NULL) {
1733
		return RP_ALL;
1734
	}
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1735
	if(strlen(s) == 0) {
1736
		return RP_ALL;
1737
	}
497.1.1 by Matthew Fuller
enum-ify Screen->RandomPlacement.
1738
1739
#define CHK(str, ret) if(strcasecmp(s, str) == 0) { return RP_##ret; }
1740
	CHK(DEFSTRING,  ALL);
1741
	CHK("on",       ALL);
1742
	CHK("all",      ALL);
1743
	CHK("off",      OFF);
1744
	CHK("unmapped", UNMAPPED);
1745
#undef CHK
1746
501.1.5 by Matthew Fuller
Drop parens for consistency.
1747
	return -1;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1748
}
1749
496.1.17 by Matthew Fuller
Convert IconRegion Justification to its own enum type too. This is
1750
1751
/*
1752
 * Parse out IconRegionJustification string.
1753
 *
1754
 * X-ref comment on ParseAlignement about return value.
1755
 */
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1756
int
496.1.23 by Matthew Fuller
constify args to these functions, just for cleanliness.
1757
ParseIRJustification(const char *s)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1758
{
1759
	if(strlen(s) == 0) {
496.1.17 by Matthew Fuller
Convert IconRegion Justification to its own enum type too. This is
1760
		return -1;
1761
	}
1762
1763
#define CHK(str, ret) if(strcasecmp(s, str) == 0) { return IRJ_##ret; }
1764
	CHK(DEFSTRING, CENTER);
1765
	CHK("undef",   UNDEF);
1766
	CHK("left",    LEFT);
1767
	CHK("center",  CENTER);
1768
	CHK("right",   RIGHT);
1769
	CHK("border",  BORDER);
1770
#undef CHK
1771
1772
	return -1;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1773
}
1774
496.1.15 by Matthew Fuller
Add comment explaining the almost-right return type.
1775
1776
/*
496.1.16 by Matthew Fuller
Convert TitleJustification elements to their own enum type, and fixup
1777
 * Parse out string for title justification.  From TitleJustification,
1778
 * IconJustification, iconjust arg to IconRegion.
1779
 *
1780
 * X-ref comment on ParseAlignement about return value.
1781
 */
1782
int
496.1.23 by Matthew Fuller
constify args to these functions, just for cleanliness.
1783
ParseTitleJustification(const char *s)
496.1.16 by Matthew Fuller
Convert TitleJustification elements to their own enum type, and fixup
1784
{
1785
	if(strlen(s) == 0) {
1786
		return -1;
1787
	}
1788
1789
#define CHK(str, ret) if(strcasecmp(s, str) == 0) { return TJ_##ret; }
1790
	/* XXX Different uses really have different defaults... */
1791
	CHK(DEFSTRING, CENTER);
1792
	CHK("undef",   UNDEF);
1793
	CHK("left",    LEFT);
1794
	CHK("center",  CENTER);
1795
	CHK("right",   RIGHT);
1796
#undef CHK
1797
1798
	return -1;
1799
}
1800
1801
1802
/*
496.1.15 by Matthew Fuller
Add comment explaining the almost-right return type.
1803
 * Parse out the string specifier for IconRegion Alignement[sic].
1804
 * Strictly speaking, this [almost always] returns an IRAlignement enum
1805
 * value.  However, it's specified as int to allow the -1 return for
1806
 * invalid values.  enum's start numbering from 0 (unless specific values
1807
 * are given), so that's a safe out-of-bounds value.  And making an
1808
 * IRA_INVALID value would just add unnecessary complication, since
1809
 * during parsing is the only time it makes sense.
1810
 */
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1811
int
496.1.23 by Matthew Fuller
constify args to these functions, just for cleanliness.
1812
ParseAlignement(const char *s)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1813
{
1814
	if(strlen(s) == 0) {
496.1.14 by Matthew Fuller
Create an enum for the IconRegion Alignement (misspelling preserved
1815
		return -1;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1816
	}
496.1.13 by Matthew Fuller
Macro-ify ParseAlignement().
1817
496.1.14 by Matthew Fuller
Create an enum for the IconRegion Alignement (misspelling preserved
1818
#define CHK(str, ret) if(strcasecmp(s, str) == 0) { return IRA_##ret; }
496.1.13 by Matthew Fuller
Macro-ify ParseAlignement().
1819
	CHK(DEFSTRING, CENTER);
1820
	CHK("center",  CENTER);
1821
	CHK("top",     TOP);
1822
	CHK("bottom",  BOTTOM);
1823
	CHK("border",  BORDER);
1824
	CHK("undef",   UNDEF);
1825
#undef CHK
1826
496.1.14 by Matthew Fuller
Create an enum for the IconRegion Alignement (misspelling preserved
1827
	return -1;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1828
}
1829
431.1.19 by Matthew Fuller
Linebreak these function defs as long as I'm breaking annotate for the
1830
static int
497.1.2 by Matthew Fuller
enum-ise Screen->UsePPosition.
1831
ParseUsePPosition(const char *s)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1832
{
1833
	if(strlen(s) == 0) {
497.1.2 by Matthew Fuller
enum-ise Screen->UsePPosition.
1834
		return -1;
1835
	}
1836
1837
#define CHK(str, ret) if(strcasecmp(s, str) == 0) { return PPOS_##ret; }
1838
	CHK(DEFSTRING,  OFF);
1839
	CHK("off",      OFF);
1840
	CHK("on",       ON);
1841
	CHK("non-zero", NON_ZERO);
1842
	CHK("nonzero",  NON_ZERO);
1843
#undef CHK
1844
1845
	return -1;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1846
}
1847
496.1.26 by Matthew Fuller
Ditch this STYLE_UNKNOWN value (which actually wouldn't wind up
1848
static int
497.1.5 by Matthew Fuller
const-ify arg on this last Parse func here, making it consistent with
1849
ParseButtonStyle(const char *s)
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1850
{
496.1.3 by Matthew Fuller
Minor tweaks to ParseButtonStyle. Add an extra NULL check just in
1851
	if(s == NULL || strlen(s) == 0) {
496.1.26 by Matthew Fuller
Ditch this STYLE_UNKNOWN value (which actually wouldn't wind up
1852
		return -1;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1853
	}
496.1.3 by Matthew Fuller
Minor tweaks to ParseButtonStyle. Add an extra NULL check just in
1854
1855
#define CHK(str, ret) if(strcasecmp(s, str) == 0) { return STYLE_##ret; }
1856
	CHK(DEFSTRING, NORMAL);
1857
	CHK("normal",  NORMAL);
1858
	CHK("style1",  STYLE1);
1859
	CHK("style2",  STYLE2);
1860
	CHK("style3",  STYLE3);
1861
#undef CHK
1862
496.1.26 by Matthew Fuller
Ditch this STYLE_UNKNOWN value (which actually wouldn't wind up
1863
	return -1;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1864
}
1865
497.1.4 by Matthew Fuller
enum-ify IconifyStyle. Move parsing the options into a helper
1866
static int
1867
ParseIconifyStyle(const char *s)
1868
{
1869
	if(s == NULL || strlen(s) == 0) {
1870
		return -1;
1871
	}
1872
1873
#define CHK(str, ret) if(strcasecmp(s, str) == 0) { return ICONIFY_##ret; }
1874
	CHK(DEFSTRING, NORMAL);
1875
	CHK("normal",  NORMAL);
1876
	CHK("mosaic",  MOSAIC);
1877
	CHK("zoomin",  ZOOMIN);
1878
	CHK("zoomout", ZOOMOUT);
1879
	CHK("fade",    FADE);
1880
	CHK("sweet",   SWEEP);
1881
#undef CHK
1882
1883
	return -1;
1884
}
1885
501.1.7 by Matthew Fuller
do_squeeze_entry()'s return is never checked, so just make it void.
1886
void
501.1.13 by Matthew Fuller
Fixup EOL comment alignment, and convert to // as long as I'm changing
1887
do_squeeze_entry(name_list **slist, // squeeze or dont-squeeze list
1888
                 const char *name,  // window name
1889
                 SIJust justify,    // left, center, right
1890
                 int num,           // signed num
1891
                 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
1892
{
1893
	int absnum = (num < 0 ? -num : num);
1894
1895
	if(denom < 0) {
1896
		twmrc_error_prefix();
1897
		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.
1898
		ParseError = true;
1899
		return;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1900
	}
1901
	if(absnum > denom && denom != 0) {
1902
		twmrc_error_prefix();
1903
		fprintf(stderr, "SqueezeTitle fraction %d/%d outside window\n",
1904
		        num, denom);
501.1.7 by Matthew Fuller
do_squeeze_entry()'s return is never checked, so just make it void.
1905
		ParseError = true;
1906
		return;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1907
	}
1908
	/* Process the special cases from the manual here rather than
1909
	 * 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
1910
	 * in ComputeTitleLocation().
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1911
	 * In fact, it's better to get rid of them entirely, but we
1912
	 * probably should not do that for compatibility's sake.
1913
	 * By using a non-zero denominator the position will be relative.
1914
	 */
1915
	if(denom == 0 && num == 0) {
496.1.20 by Matthew Fuller
Create and use an enum type for SqueezeInfo.justify.
1916
		if(justify == SIJ_CENTER) {
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1917
			num = 1;
1918
			denom = 2;
1919
		}
496.1.20 by Matthew Fuller
Create and use an enum type for SqueezeInfo.justify.
1920
		else if(justify == SIJ_RIGHT) {
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1921
			num = 2;
1922
			denom = 2;
1923
		}
1924
		twmrc_error_prefix();
1925
		fprintf(stderr, "deprecated SqueezeTitle faction 0/0, assuming %d/%d\n",
1926
		        num, denom);
1927
	}
1928
1929
	if(HasShape) {
1930
		SqueezeInfo *sinfo;
491.1.8 by Matthew Fuller
Stop casting return values of [mc]alloc(). void * has existed for 27
1931
		sinfo = malloc(sizeof(SqueezeInfo));
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1932
1933
		if(!sinfo) {
1934
			twmrc_error_prefix();
1935
			fprintf(stderr, "unable to allocate %lu bytes for squeeze info\n",
1936
			        (unsigned long) sizeof(SqueezeInfo));
501.1.7 by Matthew Fuller
do_squeeze_entry()'s return is never checked, so just make it void.
1937
			ParseError = true;
1938
			return;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1939
		}
1940
		sinfo->justify = justify;
1941
		sinfo->num = num;
1942
		sinfo->denom = denom;
435.1.6 by Matthew Fuller
Avoid shadowing a global.
1943
		AddToList(slist, name, sinfo);
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1944
	}
501.1.7 by Matthew Fuller
do_squeeze_entry()'s return is never checked, so just make it void.
1945
	return;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1946
}
1947
1948
1949
/*
1950
 * Parsing for EWMHIgnore { } lists
1951
 */
1952
void
1953
proc_ewmh_ignore(void)
1954
{
1955
#ifndef EWMH
1956
	twmrc_error_prefix();
1957
	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.
1958
	ParseError = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1959
	return;
1960
#endif
1961
	/* else nada */
1962
	return;
1963
}
1964
void
1965
add_ewmh_ignore(char *s)
1966
{
1967
#ifndef EWMH
1968
	return;
1969
#else
1970
1971
#define HANDLE(x) \
1972
        if(strcasecmp(s, (x)) == 0) { \
1973
                AddToList(&Scr->EWMHIgnore, (x), ""); \
1974
                return; \
1975
        }
1976
	HANDLE("STATE_MAXIMIZED_VERT");
1977
	HANDLE("STATE_MAXIMIZED_HORZ");
1978
	HANDLE("STATE_FULLSCREEN");
1979
	HANDLE("STATE_SHADED");
1980
	HANDLE("STATE_ABOVE");
1981
	HANDLE("STATE_BELOW");
1982
#undef HANDLE
1983
1984
	twmrc_error_prefix();
1985
	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.
1986
	ParseError = true;
431.1.18 by Matthew Fuller
Pull the backend parsing table and routines the parser calls off into
1987
	return;
1988
#endif /* EWMH */
1989
}
473.1.6 by Matthew Fuller
Add a config entry to hold bits for ignoring MWM hints.
1990
1991
1992
/*
1993
 * Parsing for MWMIgnore { } lists
1994
 */
1995
void
1996
proc_mwm_ignore(void)
1997
{
1998
	/* Nothing to do */
1999
	return;
2000
}
2001
void
2002
add_mwm_ignore(char *s)
2003
{
2004
#define HANDLE(x) \
2005
        if(strcasecmp(s, (x)) == 0) { \
2006
                AddToList(&Scr->MWMIgnore, (x), ""); \
2007
                return; \
2008
        }
2009
	HANDLE("DECOR_BORDER");
2010
	HANDLE("DECOR_TITLE");
2011
#undef HANDLE
2012
2013
	twmrc_error_prefix();
2014
	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.
2015
	ParseError = true;
473.1.6 by Matthew Fuller
Add a config entry to hold bits for ignoring MWM hints.
2016
	return;
2017
}