1 /* defaults.c - manage configuration through defaults db
3 * Window Maker window manager
5 * Copyright (c) 1997-2003 Alfredo K. Kojima
6 * Copyright (c) 1998-2003 Dan Pascu
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
33 #include <sys/types.h>
40 #define PATH_MAX DEFAULT_PATH_MAX
44 #include <X11/Xutil.h>
45 #include <X11/keysym.h>
49 #include "WindowMaker.h"
54 #include "resources.h"
57 #include "xmodifier.h"
62 #include "workspace.h"
63 #include "properties.h"
68 #define MAX_SHORTCUT_LENGTH 32
70 #ifndef GLOBAL_DEFAULTS_SUBDIR
71 #define GLOBAL_DEFAULTS_SUBDIR "WindowMaker"
75 extern WDDomain
*WDWindowMaker
;
76 extern WDDomain
*WDWindowAttributes
;
77 extern WDDomain
*WDRootMenu
;
78 extern int wScreenCount
;
79 extern WShortKey wKeyBindings
[WKBD_LAST
];
81 typedef struct _WDefaultEntry WDefaultEntry
;
82 typedef int (WDECallbackConvert
) (WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*plvalue
, void *addr
, void **tdata
);
83 typedef int (WDECallbackUpdate
) (WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *extra_data
);
85 struct _WDefaultEntry
{
87 const char *default_value
;
90 WDECallbackConvert
*convert
;
91 WDECallbackUpdate
*update
;
93 WMPropList
*plvalue
; /* default value */
96 /* used to map strings to integers */
101 } WOptionEnumeration
;
103 /* type converters */
104 static WDECallbackConvert getBool
;
105 static WDECallbackConvert getInt
;
106 static WDECallbackConvert getCoord
;
107 static WDECallbackConvert getPathList
;
108 static WDECallbackConvert getEnum
;
109 static WDECallbackConvert getTexture
;
110 static WDECallbackConvert getWSBackground
;
111 static WDECallbackConvert getWSSpecificBackground
;
112 static WDECallbackConvert getFont
;
113 static WDECallbackConvert getColor
;
114 static WDECallbackConvert getKeybind
;
115 static WDECallbackConvert getModMask
;
116 static WDECallbackConvert getPropList
;
118 /* value setting functions */
119 static WDECallbackUpdate setJustify
;
120 static WDECallbackUpdate setClearance
;
121 static WDECallbackUpdate setIfDockPresent
;
122 static WDECallbackUpdate setClipMergedInDock
;
123 static WDECallbackUpdate setWrapAppiconsInDock
;
124 static WDECallbackUpdate setStickyIcons
;
125 static WDECallbackUpdate setWidgetColor
;
126 static WDECallbackUpdate setIconTile
;
127 static WDECallbackUpdate setWinTitleFont
;
128 static WDECallbackUpdate setMenuTitleFont
;
129 static WDECallbackUpdate setMenuTextFont
;
130 static WDECallbackUpdate setIconTitleFont
;
131 static WDECallbackUpdate setIconTitleColor
;
132 static WDECallbackUpdate setIconTitleBack
;
133 static WDECallbackUpdate setFrameBorderWidth
;
134 static WDECallbackUpdate setFrameBorderColor
;
135 static WDECallbackUpdate setFrameSelectedBorderColor
;
136 static WDECallbackUpdate setLargeDisplayFont
;
137 static WDECallbackUpdate setWTitleColor
;
138 static WDECallbackUpdate setFTitleBack
;
139 static WDECallbackUpdate setPTitleBack
;
140 static WDECallbackUpdate setUTitleBack
;
141 static WDECallbackUpdate setResizebarBack
;
142 static WDECallbackUpdate setWorkspaceBack
;
143 static WDECallbackUpdate setWorkspaceSpecificBack
;
144 static WDECallbackUpdate setMenuTitleColor
;
145 static WDECallbackUpdate setMenuTextColor
;
146 static WDECallbackUpdate setMenuDisabledColor
;
147 static WDECallbackUpdate setMenuTitleBack
;
148 static WDECallbackUpdate setMenuTextBack
;
149 static WDECallbackUpdate setHightlight
;
150 static WDECallbackUpdate setHightlightText
;
151 static WDECallbackUpdate setKeyGrab
;
152 static WDECallbackUpdate setDoubleClick
;
153 static WDECallbackUpdate setIconPosition
;
155 static WDECallbackUpdate setClipTitleFont
;
156 static WDECallbackUpdate setClipTitleColor
;
158 static WDECallbackUpdate setMenuStyle
;
159 static WDECallbackUpdate setSwPOptions
;
160 static WDECallbackUpdate updateUsableArea
;
162 static WDECallbackUpdate setModifierKeyLabels
;
164 static WDECallbackConvert getCursor
;
165 static WDECallbackUpdate setCursor
;
168 * Tables to convert strings to enumeration values.
169 * Values stored are char
172 /* WARNING: sum of length of all value strings must not exceed
174 #define TOTAL_VALUES_LENGTH 80
176 #define REFRESH_WINDOW_TEXTURES (1<<0)
177 #define REFRESH_MENU_TEXTURE (1<<1)
178 #define REFRESH_MENU_FONT (1<<2)
179 #define REFRESH_MENU_COLOR (1<<3)
180 #define REFRESH_MENU_TITLE_TEXTURE (1<<4)
181 #define REFRESH_MENU_TITLE_FONT (1<<5)
182 #define REFRESH_MENU_TITLE_COLOR (1<<6)
183 #define REFRESH_WINDOW_TITLE_COLOR (1<<7)
184 #define REFRESH_WINDOW_FONT (1<<8)
185 #define REFRESH_ICON_TILE (1<<9)
186 #define REFRESH_ICON_FONT (1<<10)
187 #define REFRESH_WORKSPACE_BACK (1<<11)
189 #define REFRESH_BUTTON_IMAGES (1<<12)
191 #define REFRESH_ICON_TITLE_COLOR (1<<13)
192 #define REFRESH_ICON_TITLE_BACK (1<<14)
194 #define REFRESH_WORKSPACE_MENU (1<<15)
196 #define REFRESH_FRAME_BORDER REFRESH_MENU_FONT|REFRESH_WINDOW_FONT
198 static WOptionEnumeration seFocusModes
[] = {
199 {"Manual", WKF_CLICK
, 0}, {"ClickToFocus", WKF_CLICK
, 1},
200 {"Sloppy", WKF_SLOPPY
, 0}, {"SemiAuto", WKF_SLOPPY
, 1}, {"Auto", WKF_SLOPPY
, 1},
204 static WOptionEnumeration seTitlebarModes
[] = {
205 {"new", TS_NEW
, 0}, {"old", TS_OLD
, 0},
206 {"next", TS_NEXT
, 0}, {NULL
, 0, 0}
209 static WOptionEnumeration seColormapModes
[] = {
210 {"Manual", WCM_CLICK
, 0}, {"ClickToFocus", WCM_CLICK
, 1},
211 {"Auto", WCM_POINTER
, 0}, {"FocusFollowMouse", WCM_POINTER
, 1},
215 static WOptionEnumeration sePlacements
[] = {
216 {"Auto", WPM_AUTO
, 0},
217 {"Smart", WPM_SMART
, 0},
218 {"Cascade", WPM_CASCADE
, 0},
219 {"Random", WPM_RANDOM
, 0},
220 {"Manual", WPM_MANUAL
, 0},
221 {"Center", WPM_CENTER
, 0},
225 static WOptionEnumeration seGeomDisplays
[] = {
226 {"None", WDIS_NONE
, 0},
227 {"Center", WDIS_CENTER
, 0},
228 {"Corner", WDIS_TOPLEFT
, 0},
229 {"Floating", WDIS_FRAME_CENTER
, 0},
230 {"Line", WDIS_NEW
, 0},
234 static WOptionEnumeration seSpeeds
[] = {
235 {"UltraFast", SPEED_ULTRAFAST
, 0},
236 {"Fast", SPEED_FAST
, 0},
237 {"Medium", SPEED_MEDIUM
, 0},
238 {"Slow", SPEED_SLOW
, 0},
239 {"UltraSlow", SPEED_ULTRASLOW
, 0},
243 static WOptionEnumeration seMouseButtonActions
[] = {
244 {"None", WA_NONE
, 0},
245 {"SelectWindows", WA_SELECT_WINDOWS
, 0},
246 {"OpenApplicationsMenu", WA_OPEN_APPMENU
, 0},
247 {"OpenWindowListMenu", WA_OPEN_WINLISTMENU
, 0},
251 static WOptionEnumeration seMouseWheelActions
[] = {
252 {"None", WA_NONE
, 0},
253 {"SwitchWorkspaces", WA_SWITCH_WORKSPACES
, 0},
257 static WOptionEnumeration seIconificationStyles
[] = {
258 {"Zoom", WIS_ZOOM
, 0},
259 {"Twist", WIS_TWIST
, 0},
260 {"Flip", WIS_FLIP
, 0},
261 {"None", WIS_NONE
, 0},
262 {"random", WIS_RANDOM
, 0},
266 static WOptionEnumeration seJustifications
[] = {
267 {"Left", WTJ_LEFT
, 0},
268 {"Center", WTJ_CENTER
, 0},
269 {"Right", WTJ_RIGHT
, 0},
273 static WOptionEnumeration seIconPositions
[] = {
274 {"blv", IY_BOTTOM
| IY_LEFT
| IY_VERT
, 0},
275 {"blh", IY_BOTTOM
| IY_LEFT
| IY_HORIZ
, 0},
276 {"brv", IY_BOTTOM
| IY_RIGHT
| IY_VERT
, 0},
277 {"brh", IY_BOTTOM
| IY_RIGHT
| IY_HORIZ
, 0},
278 {"tlv", IY_TOP
| IY_LEFT
| IY_VERT
, 0},
279 {"tlh", IY_TOP
| IY_LEFT
| IY_HORIZ
, 0},
280 {"trv", IY_TOP
| IY_RIGHT
| IY_VERT
, 0},
281 {"trh", IY_TOP
| IY_RIGHT
| IY_HORIZ
, 0},
285 static WOptionEnumeration seMenuStyles
[] = {
286 {"normal", MS_NORMAL
, 0},
287 {"singletexture", MS_SINGLE_TEXTURE
, 0},
288 {"flat", MS_FLAT
, 0},
292 static WOptionEnumeration seDisplayPositions
[] = {
293 {"none", WD_NONE
, 0},
294 {"center", WD_CENTER
, 0},
296 {"bottom", WD_BOTTOM
, 0},
297 {"topleft", WD_TOPLEFT
, 0},
298 {"topright", WD_TOPRIGHT
, 0},
299 {"bottomleft", WD_BOTTOMLEFT
, 0},
300 {"bottomright", WD_BOTTOMRIGHT
, 0},
304 static WOptionEnumeration seWorkspaceBorder
[] = {
305 {"None", WB_NONE
, 0},
306 {"LeftRight", WB_LEFTRIGHT
, 0},
307 {"TopBottom", WB_TOPBOTTOM
, 0},
308 {"AllDirections", WB_ALLDIRS
, 0},
313 * ALL entries in the tables bellow, NEED to have a default value
314 * defined, and this value needs to be correct.
317 /* these options will only affect the window manager on startup
319 * static defaults can't access the screen data, because it is
320 * created after these defaults are read
322 WDefaultEntry staticOptionList
[] = {
324 {"ColormapSize", "4", NULL
,
325 &wPreferences
.cmap_size
, getInt
, NULL
, NULL
, NULL
},
326 {"DisableDithering", "NO", NULL
,
327 &wPreferences
.no_dithering
, getBool
, NULL
, NULL
, NULL
},
328 {"IconSize", "64", NULL
,
329 &wPreferences
.icon_size
, getInt
, NULL
, NULL
, NULL
},
330 {"ModifierKey", "Mod1", NULL
,
331 &wPreferences
.modifier_mask
, getModMask
, NULL
, NULL
, NULL
},
332 {"DisableWSMouseActions", "NO", NULL
,
333 &wPreferences
.disable_root_mouse
, getBool
, NULL
, NULL
, NULL
},
334 {"FocusMode", "manual", seFocusModes
, /* have a problem when switching from */
335 &wPreferences
.focus_mode
, getEnum
, NULL
, NULL
, NULL
}, /* manual to sloppy without restart */
336 {"NewStyle", "new", seTitlebarModes
,
337 &wPreferences
.new_style
, getEnum
, NULL
, NULL
, NULL
},
338 {"DisableDock", "NO", (void *)WM_DOCK
,
339 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
340 {"DisableClip", "NO", (void *)WM_CLIP
,
341 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
342 {"DisableDrawers", "NO", (void *)WM_DRAWER
,
343 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
344 {"ClipMergedInDock", "NO", NULL
,
345 NULL
, getBool
, setClipMergedInDock
, NULL
, NULL
},
346 {"DisableMiniwindows", "NO", NULL
,
347 &wPreferences
.disable_miniwindows
, getBool
, NULL
, NULL
, NULL
}
350 #define NUM2STRING_(x) #x
351 #define NUM2STRING(x) NUM2STRING_(x)
353 WDefaultEntry optionList
[] = {
355 /* dynamic options */
357 {"IconPosition", "blh", seIconPositions
,
358 &wPreferences
.icon_yard
, getEnum
, setIconPosition
, NULL
, NULL
},
359 {"IconificationStyle", "Zoom", seIconificationStyles
,
360 &wPreferences
.iconification_style
, getEnum
, NULL
, NULL
, NULL
},
361 {"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions
,
362 &wPreferences
.mouse_button1
, getEnum
, NULL
, NULL
, NULL
},
363 {"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions
,
364 &wPreferences
.mouse_button2
, getEnum
, NULL
, NULL
, NULL
},
365 {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions
,
366 &wPreferences
.mouse_button3
, getEnum
, NULL
, NULL
, NULL
},
367 {"MouseWheelAction", "None", seMouseWheelActions
,
368 &wPreferences
.mouse_wheel
, getEnum
, NULL
, NULL
, NULL
},
369 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
370 &wPreferences
.pixmap_path
, getPathList
, NULL
, NULL
, NULL
},
371 {"IconPath", DEF_ICON_PATHS
, NULL
,
372 &wPreferences
.icon_path
, getPathList
, NULL
, NULL
, NULL
},
373 {"ColormapMode", "auto", seColormapModes
,
374 &wPreferences
.colormap_mode
, getEnum
, NULL
, NULL
, NULL
},
375 {"AutoFocus", "NO", NULL
,
376 &wPreferences
.auto_focus
, getBool
, NULL
, NULL
, NULL
},
377 {"RaiseDelay", "0", NULL
,
378 &wPreferences
.raise_delay
, getInt
, NULL
, NULL
, NULL
},
379 {"CirculateRaise", "NO", NULL
,
380 &wPreferences
.circ_raise
, getBool
, NULL
, NULL
, NULL
},
381 {"Superfluous", "NO", NULL
,
382 &wPreferences
.superfluous
, getBool
, NULL
, NULL
, NULL
},
383 {"AdvanceToNewWorkspace", "NO", NULL
,
384 &wPreferences
.ws_advance
, getBool
, NULL
, NULL
, NULL
},
385 {"CycleWorkspaces", "NO", NULL
,
386 &wPreferences
.ws_cycle
, getBool
, NULL
, NULL
, NULL
},
387 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
388 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
, NULL
, NULL
},
389 {"WorkspaceBorder", "None", seWorkspaceBorder
,
390 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
, NULL
, NULL
},
391 {"WorkspaceBorderSize", "0", NULL
,
392 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
, NULL
, NULL
},
393 {"StickyIcons", "NO", NULL
,
394 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
, NULL
, NULL
},
395 {"SaveSessionOnExit", "NO", NULL
,
396 &wPreferences
.save_session_on_exit
, getBool
, NULL
, NULL
, NULL
},
397 {"WrapMenus", "NO", NULL
,
398 &wPreferences
.wrap_menus
, getBool
, NULL
, NULL
, NULL
},
399 {"ScrollableMenus", "NO", NULL
,
400 &wPreferences
.scrollable_menus
, getBool
, NULL
, NULL
, NULL
},
401 {"MenuScrollSpeed", "medium", seSpeeds
,
402 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
, NULL
, NULL
},
403 {"IconSlideSpeed", "medium", seSpeeds
,
404 &wPreferences
.icon_slide_speed
, getEnum
, NULL
, NULL
, NULL
},
405 {"ShadeSpeed", "medium", seSpeeds
,
406 &wPreferences
.shade_speed
, getEnum
, NULL
, NULL
, NULL
},
407 {"BounceAppIconsWhenUrgent", "YES", NULL
,
408 &wPreferences
.bounce_appicons_when_urgent
, getBool
, NULL
, NULL
, NULL
},
409 {"RaiseAppIconsWhenBouncing", "NO", NULL
,
410 &wPreferences
.raise_appicons_when_bouncing
, getBool
, NULL
, NULL
, NULL
},
411 {"DoNotMakeAppIconsBounce", "NO", NULL
,
412 &wPreferences
.do_not_make_appicons_bounce
, getBool
, NULL
, NULL
, NULL
},
413 {"DoubleClickTime", "250", (void *)&wPreferences
.dblclick_time
,
414 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
, NULL
, NULL
},
415 {"ClipAutoraiseDelay", "600", NULL
,
416 &wPreferences
.clip_auto_raise_delay
, getInt
, NULL
, NULL
, NULL
},
417 {"ClipAutolowerDelay", "1000", NULL
,
418 &wPreferences
.clip_auto_lower_delay
, getInt
, NULL
, NULL
, NULL
},
419 {"ClipAutoexpandDelay", "600", NULL
,
420 &wPreferences
.clip_auto_expand_delay
, getInt
, NULL
, NULL
, NULL
},
421 {"ClipAutocollapseDelay", "1000", NULL
,
422 &wPreferences
.clip_auto_collapse_delay
, getInt
, NULL
, NULL
, NULL
},
423 {"WrapAppiconsInDock", "YES", NULL
,
424 NULL
, getBool
, setWrapAppiconsInDock
, NULL
, NULL
},
425 {"AlignSubmenus", "NO", NULL
,
426 &wPreferences
.align_menus
, getBool
, NULL
, NULL
, NULL
},
427 {"ViKeyMenus", "NO", NULL
,
428 &wPreferences
.vi_key_menus
, getBool
, NULL
, NULL
, NULL
},
429 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
430 &wPreferences
.open_transients_with_parent
, getBool
, NULL
, NULL
, NULL
},
431 {"WindowPlacement", "auto", sePlacements
,
432 &wPreferences
.window_placement
, getEnum
, NULL
, NULL
, NULL
},
433 {"IgnoreFocusClick", "NO", NULL
,
434 &wPreferences
.ignore_focus_click
, getBool
, NULL
, NULL
, NULL
},
435 {"UseSaveUnders", "NO", NULL
,
436 &wPreferences
.use_saveunders
, getBool
, NULL
, NULL
, NULL
},
437 {"OpaqueMove", "NO", NULL
,
438 &wPreferences
.opaque_move
, getBool
, NULL
, NULL
, NULL
},
439 {"OpaqueResize", "NO", NULL
,
440 &wPreferences
.opaque_resize
, getBool
, NULL
, NULL
, NULL
},
441 {"OpaqueMoveResizeKeyboard", "NO", NULL
,
442 &wPreferences
.opaque_move_resize_keyboard
, getBool
, NULL
, NULL
, NULL
},
443 {"DisableAnimations", "NO", NULL
,
444 &wPreferences
.no_animations
, getBool
, NULL
, NULL
, NULL
},
445 {"DontLinkWorkspaces", "NO", NULL
,
446 &wPreferences
.no_autowrap
, getBool
, NULL
, NULL
, NULL
},
447 {"HighlightActiveApp", "YES", NULL
,
448 &wPreferences
.highlight_active_app
, getBool
, NULL
, NULL
, NULL
},
449 {"AutoArrangeIcons", "NO", NULL
,
450 &wPreferences
.auto_arrange_icons
, getBool
, NULL
, NULL
, NULL
},
451 {"NoWindowOverDock", "NO", NULL
,
452 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
, NULL
, NULL
},
453 {"NoWindowOverIcons", "NO", NULL
,
454 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
, NULL
, NULL
},
455 {"WindowPlaceOrigin", "(0, 0)", NULL
,
456 &wPreferences
.window_place_origin
, getCoord
, NULL
, NULL
, NULL
},
457 {"ResizeDisplay", "corner", seGeomDisplays
,
458 &wPreferences
.size_display
, getEnum
, NULL
, NULL
, NULL
},
459 {"MoveDisplay", "corner", seGeomDisplays
,
460 &wPreferences
.move_display
, getEnum
, NULL
, NULL
, NULL
},
461 {"DontConfirmKill", "NO", NULL
,
462 &wPreferences
.dont_confirm_kill
, getBool
, NULL
, NULL
, NULL
},
463 {"WindowTitleBalloons", "NO", NULL
,
464 &wPreferences
.window_balloon
, getBool
, NULL
, NULL
, NULL
},
465 {"MiniwindowTitleBalloons", "NO", NULL
,
466 &wPreferences
.miniwin_balloon
, getBool
, NULL
, NULL
, NULL
},
467 {"AppIconBalloons", "NO", NULL
,
468 &wPreferences
.appicon_balloon
, getBool
, NULL
, NULL
, NULL
},
469 {"HelpBalloons", "NO", NULL
,
470 &wPreferences
.help_balloon
, getBool
, NULL
, NULL
, NULL
},
471 {"EdgeResistance", "30", NULL
,
472 &wPreferences
.edge_resistance
, getInt
, NULL
, NULL
, NULL
},
473 {"ResizeIncrement", "0", NULL
,
474 &wPreferences
.resize_increment
, getInt
, NULL
, NULL
, NULL
},
475 {"Attraction", "NO", NULL
,
476 &wPreferences
.attract
, getBool
, NULL
, NULL
, NULL
},
477 {"DisableBlinking", "NO", NULL
,
478 &wPreferences
.dont_blink
, getBool
, NULL
, NULL
, NULL
},
479 {"SingleClickLaunch", "NO", NULL
,
480 &wPreferences
.single_click
, getBool
, NULL
, NULL
, NULL
},
481 {"StrictWindozeCycle", "YES", NULL
,
482 &wPreferences
.strict_windoze_cycle
, getBool
, NULL
, NULL
, NULL
},
483 {"SwitchPanelOnlyOpen", "NO", NULL
,
484 &wPreferences
.panel_only_open
, getBool
, NULL
, NULL
, NULL
},
488 {"MenuStyle", "normal", seMenuStyles
,
489 &wPreferences
.menu_style
, getEnum
, setMenuStyle
, NULL
, NULL
},
490 {"WidgetColor", "(solid, gray)", NULL
,
491 NULL
, getTexture
, setWidgetColor
, NULL
, NULL
},
492 {"WorkspaceSpecificBack", "()", NULL
,
493 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
, NULL
, NULL
},
494 /* WorkspaceBack must come after WorkspaceSpecificBack or
495 * WorkspaceBack wont know WorkspaceSpecificBack was also
496 * specified and 2 copies of wmsetbg will be launched */
497 {"WorkspaceBack", "(solid, black)", NULL
,
498 NULL
, getWSBackground
, setWorkspaceBack
, NULL
, NULL
},
499 {"SmoothWorkspaceBack", "NO", NULL
,
500 NULL
, getBool
, NULL
, NULL
, NULL
},
501 {"IconBack", "(solid, gray)", NULL
,
502 NULL
, getTexture
, setIconTile
, NULL
, NULL
},
503 {"TitleJustify", "center", seJustifications
,
504 &wPreferences
.title_justification
, getEnum
, setJustify
, NULL
, NULL
},
505 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
506 NULL
, getFont
, setWinTitleFont
, NULL
, NULL
},
507 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
508 &wPreferences
.window_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
509 {"WindowTitleMinHeight", "0", NULL
,
510 &wPreferences
.window_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
511 {"WindowTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
512 &wPreferences
.window_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
513 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
514 &wPreferences
.menu_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
515 {"MenuTitleMinHeight", "0", NULL
,
516 &wPreferences
.menu_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
517 {"MenuTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
518 &wPreferences
.menu_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
519 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
520 &wPreferences
.menu_text_clearance
, getInt
, setClearance
, NULL
, NULL
},
521 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
522 NULL
, getFont
, setMenuTitleFont
, NULL
, NULL
},
523 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
524 NULL
, getFont
, setMenuTextFont
, NULL
, NULL
},
525 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
526 NULL
, getFont
, setIconTitleFont
, NULL
, NULL
},
527 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
528 NULL
, getFont
, setClipTitleFont
, NULL
, NULL
},
529 {"ShowClipTitle", "YES", NULL
,
530 &wPreferences
.show_clip_title
, getBool
, NULL
, NULL
, NULL
},
531 {"LargeDisplayFont", DEF_WORKSPACE_NAME_FONT
, NULL
,
532 NULL
, getFont
, setLargeDisplayFont
, NULL
, NULL
},
533 {"HighlightColor", "white", NULL
,
534 NULL
, getColor
, setHightlight
, NULL
, NULL
},
535 {"HighlightTextColor", "black", NULL
,
536 NULL
, getColor
, setHightlightText
, NULL
, NULL
},
537 {"ClipTitleColor", "black", (void *)CLIP_NORMAL
,
538 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
539 {"CClipTitleColor", "\"#454045\"", (void *)CLIP_COLLAPSED
,
540 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
541 {"FTitleColor", "white", (void *)WS_FOCUSED
,
542 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
543 {"PTitleColor", "white", (void *)WS_PFOCUSED
,
544 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
545 {"UTitleColor", "black", (void *)WS_UNFOCUSED
,
546 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
547 {"FTitleBack", "(solid, black)", NULL
,
548 NULL
, getTexture
, setFTitleBack
, NULL
, NULL
},
549 {"PTitleBack", "(solid, \"#616161\")", NULL
,
550 NULL
, getTexture
, setPTitleBack
, NULL
, NULL
},
551 {"UTitleBack", "(solid, gray)", NULL
,
552 NULL
, getTexture
, setUTitleBack
, NULL
, NULL
},
553 {"ResizebarBack", "(solid, gray)", NULL
,
554 NULL
, getTexture
, setResizebarBack
, NULL
, NULL
},
555 {"MenuTitleColor", "white", NULL
,
556 NULL
, getColor
, setMenuTitleColor
, NULL
, NULL
},
557 {"MenuTextColor", "black", NULL
,
558 NULL
, getColor
, setMenuTextColor
, NULL
, NULL
},
559 {"MenuDisabledColor", "\"#616161\"", NULL
,
560 NULL
, getColor
, setMenuDisabledColor
, NULL
, NULL
},
561 {"MenuTitleBack", "(solid, black)", NULL
,
562 NULL
, getTexture
, setMenuTitleBack
, NULL
, NULL
},
563 {"MenuTextBack", "(solid, gray)", NULL
,
564 NULL
, getTexture
, setMenuTextBack
, NULL
, NULL
},
565 {"IconTitleColor", "white", NULL
,
566 NULL
, getColor
, setIconTitleColor
, NULL
, NULL
},
567 {"IconTitleBack", "black", NULL
,
568 NULL
, getColor
, setIconTitleBack
, NULL
, NULL
},
569 {"SwitchPanelImages", "(swtile.png, swback.png, 30, 40)", &wPreferences
,
570 NULL
, getPropList
, setSwPOptions
, NULL
, NULL
},
571 {"ModifierKeyLabels", "(\"Shift+\", \"Ctrl+\", \"Mod1+\", \"Mod2+\", \"Mod3+\", \"Mod4+\", \"Mod5+\")", &wPreferences
,
572 NULL
, getPropList
, setModifierKeyLabels
, NULL
, NULL
},
573 {"FrameBorderWidth", "1", NULL
,
574 NULL
, getInt
, setFrameBorderWidth
, NULL
, NULL
},
575 {"FrameBorderColor", "black", NULL
,
576 NULL
, getColor
, setFrameBorderColor
, NULL
, NULL
},
577 {"FrameSelectedBorderColor", "white", NULL
,
578 NULL
, getColor
, setFrameSelectedBorderColor
, NULL
, NULL
},
582 {"RootMenuKey", "None", (void *)WKBD_ROOTMENU
,
583 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
584 {"WindowListKey", "None", (void *)WKBD_WINDOWLIST
,
585 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
586 {"WindowMenuKey", "None", (void *)WKBD_WINDOWMENU
,
587 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
588 {"DockRaiseLowerKey", "None", (void*)WKBD_DOCKRAISELOWER
,
589 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
590 {"ClipRaiseLowerKey", "None", (void *)WKBD_CLIPRAISELOWER
,
591 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
592 {"MiniaturizeKey", "None", (void *)WKBD_MINIATURIZE
,
593 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
594 {"MinimizeAllKey", "None", (void *)WKBD_MINIMIZEALL
,
595 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
596 {"HideKey", "None", (void *)WKBD_HIDE
,
597 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
598 {"HideOthersKey", "None", (void *)WKBD_HIDE_OTHERS
,
599 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
600 {"MoveResizeKey", "None", (void *)WKBD_MOVERESIZE
,
601 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
602 {"CloseKey", "None", (void *)WKBD_CLOSE
,
603 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
604 {"MaximizeKey", "None", (void *)WKBD_MAXIMIZE
,
605 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
606 {"VMaximizeKey", "None", (void *)WKBD_VMAXIMIZE
,
607 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
608 {"HMaximizeKey", "None", (void *)WKBD_HMAXIMIZE
,
609 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
610 {"LHMaximizeKey", "None", (void*)WKBD_LHMAXIMIZE
,
611 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
612 {"RHMaximizeKey", "None", (void*)WKBD_RHMAXIMIZE
,
613 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
614 {"THMaximizeKey", "None", (void*)WKBD_THMAXIMIZE
,
615 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
616 {"BHMaximizeKey", "None", (void*)WKBD_BHMAXIMIZE
,
617 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
618 {"LTCMaximizeKey", "None", (void*)WKBD_LTCMAXIMIZE
,
619 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
620 {"RTCMaximizeKey", "None", (void*)WKBD_RTCMAXIMIZE
,
621 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
622 {"LBCMaximizeKey", "None", (void*)WKBD_LBCMAXIMIZE
,
623 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
624 {"RBCMaximizeKey", "None", (void*)WKBD_RBCMAXIMIZE
,
625 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
626 {"MaximusKey", "None", (void*)WKBD_MAXIMUS
,
627 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
628 {"RaiseKey", "\"Meta+Up\"", (void *)WKBD_RAISE
,
629 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
630 {"LowerKey", "\"Meta+Down\"", (void *)WKBD_LOWER
,
631 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
632 {"RaiseLowerKey", "None", (void *)WKBD_RAISELOWER
,
633 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
634 {"ShadeKey", "None", (void *)WKBD_SHADE
,
635 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
636 {"SelectKey", "None", (void *)WKBD_SELECT
,
637 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
638 {"FocusNextKey", "None", (void *)WKBD_FOCUSNEXT
,
639 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
640 {"FocusPrevKey", "None", (void *)WKBD_FOCUSPREV
,
641 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
642 {"GroupNextKey", "None", (void *)WKBD_GROUPNEXT
,
643 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
644 {"GroupPrevKey", "None", (void *)WKBD_GROUPPREV
,
645 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
646 {"NextWorkspaceKey", "None", (void *)WKBD_NEXTWORKSPACE
,
647 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
648 {"PrevWorkspaceKey", "None", (void *)WKBD_PREVWORKSPACE
,
649 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
650 {"LastWorkspaceKey", "None", (void *)WKBD_LASTWORKSPACE
,
651 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
652 {"NextWorkspaceLayerKey", "None", (void *)WKBD_NEXTWSLAYER
,
653 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
654 {"PrevWorkspaceLayerKey", "None", (void *)WKBD_PREVWSLAYER
,
655 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
656 {"Workspace1Key", "None", (void *)WKBD_WORKSPACE1
,
657 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
658 {"Workspace2Key", "None", (void *)WKBD_WORKSPACE2
,
659 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
660 {"Workspace3Key", "None", (void *)WKBD_WORKSPACE3
,
661 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
662 {"Workspace4Key", "None", (void *)WKBD_WORKSPACE4
,
663 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
664 {"Workspace5Key", "None", (void *)WKBD_WORKSPACE5
,
665 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
666 {"Workspace6Key", "None", (void *)WKBD_WORKSPACE6
,
667 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
668 {"Workspace7Key", "None", (void *)WKBD_WORKSPACE7
,
669 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
670 {"Workspace8Key", "None", (void *)WKBD_WORKSPACE8
,
671 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
672 {"Workspace9Key", "None", (void *)WKBD_WORKSPACE9
,
673 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
674 {"Workspace10Key", "None", (void *)WKBD_WORKSPACE10
,
675 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
676 {"MoveToWorkspace1Key", "None", (void *)WKBD_MOVE_WORKSPACE1
,
677 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
678 {"MoveToWorkspace2Key", "None", (void *)WKBD_MOVE_WORKSPACE2
,
679 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
680 {"MoveToWorkspace3Key", "None", (void *)WKBD_MOVE_WORKSPACE3
,
681 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
682 {"MoveToWorkspace4Key", "None", (void *)WKBD_MOVE_WORKSPACE4
,
683 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
684 {"MoveToWorkspace5Key", "None", (void *)WKBD_MOVE_WORKSPACE5
,
685 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
686 {"MoveToWorkspace6Key", "None", (void *)WKBD_MOVE_WORKSPACE6
,
687 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
688 {"MoveToWorkspace7Key", "None", (void *)WKBD_MOVE_WORKSPACE7
,
689 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
690 {"MoveToWorkspace8Key", "None", (void *)WKBD_MOVE_WORKSPACE8
,
691 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
692 {"MoveToWorkspace9Key", "None", (void *)WKBD_MOVE_WORKSPACE9
,
693 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
694 {"MoveToWorkspace10Key", "None", (void *)WKBD_MOVE_WORKSPACE10
,
695 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
696 {"MoveToNextWorkspaceKey", "None", (void *)WKBD_MOVE_NEXTWORKSPACE
,
697 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
698 {"MoveToPrevWorkspaceKey", "None", (void *)WKBD_MOVE_PREVWORKSPACE
,
699 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
700 {"MoveToLastWorkspaceKey", "None", (void *)WKBD_MOVE_LASTWORKSPACE
,
701 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
702 {"MoveToNextWorkspaceLayerKey", "None", (void *)WKBD_MOVE_NEXTWSLAYER
,
703 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
704 {"MoveToPrevWorkspaceLayerKey", "None", (void *)WKBD_MOVE_PREVWSLAYER
,
705 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
706 {"WindowShortcut1Key", "None", (void *)WKBD_WINDOW1
,
707 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
708 {"WindowShortcut2Key", "None", (void *)WKBD_WINDOW2
,
709 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
710 {"WindowShortcut3Key", "None", (void *)WKBD_WINDOW3
,
711 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
712 {"WindowShortcut4Key", "None", (void *)WKBD_WINDOW4
,
713 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
714 {"WindowShortcut5Key", "None", (void *)WKBD_WINDOW5
,
715 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
716 {"WindowShortcut6Key", "None", (void *)WKBD_WINDOW6
,
717 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
718 {"WindowShortcut7Key", "None", (void *)WKBD_WINDOW7
,
719 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
720 {"WindowShortcut8Key", "None", (void *)WKBD_WINDOW8
,
721 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
722 {"WindowShortcut9Key", "None", (void *)WKBD_WINDOW9
,
723 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
724 {"WindowShortcut10Key", "None", (void *)WKBD_WINDOW10
,
725 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
726 {"WindowRelaunchKey", "None", (void *)WKBD_RELAUNCH
,
727 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
728 {"ScreenSwitchKey", "None", (void *)WKBD_SWITCH_SCREEN
,
729 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
731 #ifdef KEEP_XKB_LOCK_STATUS
732 {"ToggleKbdModeKey", "None", (void *)WKBD_TOGGLE
,
733 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
734 {"KbdModeLock", "NO", NULL
,
735 &wPreferences
.modelock
, getBool
, NULL
, NULL
, NULL
},
736 #endif /* KEEP_XKB_LOCK_STATUS */
738 {"NormalCursor", "(builtin, left_ptr)", (void *)WCUR_ROOT
,
739 NULL
, getCursor
, setCursor
, NULL
, NULL
},
740 {"ArrowCursor", "(builtin, top_left_arrow)", (void *)WCUR_ARROW
,
741 NULL
, getCursor
, setCursor
, NULL
, NULL
},
742 {"MoveCursor", "(builtin, fleur)", (void *)WCUR_MOVE
,
743 NULL
, getCursor
, setCursor
, NULL
, NULL
},
744 {"ResizeCursor", "(builtin, sizing)", (void *)WCUR_RESIZE
,
745 NULL
, getCursor
, setCursor
, NULL
, NULL
},
746 {"TopLeftResizeCursor", "(builtin, top_left_corner)", (void *)WCUR_TOPLEFTRESIZE
,
747 NULL
, getCursor
, setCursor
, NULL
, NULL
},
748 {"TopRightResizeCursor", "(builtin, top_right_corner)", (void *)WCUR_TOPRIGHTRESIZE
,
749 NULL
, getCursor
, setCursor
, NULL
, NULL
},
750 {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)", (void *)WCUR_BOTTOMLEFTRESIZE
,
751 NULL
, getCursor
, setCursor
, NULL
, NULL
},
752 {"BottomRightResizeCursor", "(builtin, bottom_right_corner)", (void *)WCUR_BOTTOMRIGHTRESIZE
,
753 NULL
, getCursor
, setCursor
, NULL
, NULL
},
754 {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)", (void *)WCUR_VERTICALRESIZE
,
755 NULL
, getCursor
, setCursor
, NULL
, NULL
},
756 {"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)", (void *)WCUR_HORIZONRESIZE
,
757 NULL
, getCursor
, setCursor
, NULL
, NULL
},
758 {"WaitCursor", "(builtin, watch)", (void *)WCUR_WAIT
,
759 NULL
, getCursor
, setCursor
, NULL
, NULL
},
760 {"QuestionCursor", "(builtin, question_arrow)", (void *)WCUR_QUESTION
,
761 NULL
, getCursor
, setCursor
, NULL
, NULL
},
762 {"TextCursor", "(builtin, xterm)", (void *)WCUR_TEXT
,
763 NULL
, getCursor
, setCursor
, NULL
, NULL
},
764 {"SelectCursor", "(builtin, cross)", (void *)WCUR_SELECT
,
765 NULL
, getCursor
, setCursor
, NULL
, NULL
},
766 {"DialogHistoryLines", "500", NULL
,
767 &wPreferences
.history_lines
, getInt
, NULL
, NULL
, NULL
},
768 {"CycleActiveHeadOnly", "NO", NULL
,
769 &wPreferences
.cycle_active_head_only
, getBool
, NULL
, NULL
, NULL
},
770 {"CycleIgnoreMinimized", "NO", NULL
,
771 &wPreferences
.cycle_ignore_minimized
, getBool
, NULL
, NULL
, NULL
}
774 static void initDefaults(void)
777 WDefaultEntry
*entry
;
779 WMPLSetCaseSensitive(False
);
781 for (i
= 0; i
< sizeof(optionList
) / sizeof(optionList
[0]); i
++) {
782 entry
= &optionList
[i
];
784 entry
->plkey
= WMCreatePLString(entry
->key
);
785 if (entry
->default_value
)
786 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
788 entry
->plvalue
= NULL
;
791 for (i
= 0; i
< sizeof(staticOptionList
) / sizeof(staticOptionList
[0]); i
++) {
792 entry
= &staticOptionList
[i
];
794 entry
->plkey
= WMCreatePLString(entry
->key
);
795 if (entry
->default_value
)
796 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
798 entry
->plvalue
= NULL
;
802 static WMPropList
*readGlobalDomain(const char *domainName
, Bool requireDictionary
)
804 WMPropList
*globalDict
= NULL
;
808 snprintf(path
, sizeof(path
), "%s/%s/%s", SYSCONFDIR
, GLOBAL_DEFAULTS_SUBDIR
, domainName
);
809 if (stat(path
, &stbuf
) >= 0) {
810 globalDict
= WMReadPropListFromFile(path
);
811 if (globalDict
&& requireDictionary
&& !WMIsPLDictionary(globalDict
)) {
812 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"), domainName
, path
);
813 WMReleasePropList(globalDict
);
815 } else if (!globalDict
) {
816 wwarning(_("could not load domain %s from global defaults database"), domainName
);
823 #if defined(GLOBAL_PREAMBLE_MENU_FILE) || defined(GLOBAL_EPILOGUE_MENU_FILE)
824 static void prependMenu(WMPropList
* destarr
, WMPropList
* array
)
829 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
830 item
= WMGetFromPLArray(array
, i
);
832 WMInsertInPLArray(destarr
, i
+ 1, item
);
836 static void appendMenu(WMPropList
* destarr
, WMPropList
* array
)
841 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
842 item
= WMGetFromPLArray(array
, i
);
844 WMAddToPLArray(destarr
, item
);
849 void wDefaultsMergeGlobalMenus(WDDomain
* menuDomain
)
851 WMPropList
*menu
= menuDomain
->dictionary
;
854 if (!menu
|| !WMIsPLArray(menu
))
857 #ifdef GLOBAL_PREAMBLE_MENU_FILE
858 submenu
= WMReadPropListFromFile(SYSCONFDIR
"/" GLOBAL_DEFAULTS_SUBDIR
"/" GLOBAL_PREAMBLE_MENU_FILE
);
860 if (submenu
&& !WMIsPLArray(submenu
)) {
861 wwarning(_("invalid global menu file %s"), GLOBAL_PREAMBLE_MENU_FILE
);
862 WMReleasePropList(submenu
);
866 prependMenu(menu
, submenu
);
867 WMReleasePropList(submenu
);
871 #ifdef GLOBAL_EPILOGUE_MENU_FILE
872 submenu
= WMReadPropListFromFile(SYSCONFDIR
"/" GLOBAL_DEFAULTS_SUBDIR
"/" GLOBAL_EPILOGUE_MENU_FILE
);
874 if (submenu
&& !WMIsPLArray(submenu
)) {
875 wwarning(_("invalid global menu file %s"), GLOBAL_EPILOGUE_MENU_FILE
);
876 WMReleasePropList(submenu
);
880 appendMenu(menu
, submenu
);
881 WMReleasePropList(submenu
);
885 menuDomain
->dictionary
= menu
;
888 WDDomain
*wDefaultsInitDomain(const char *domain
, Bool requireDictionary
)
892 static int inited
= 0;
893 const char *the_path
;
894 WMPropList
*shared_dict
= NULL
;
901 db
= wmalloc(sizeof(WDDomain
));
902 db
->domain_name
= domain
;
903 db
->path
= wdefaultspathfordomain(domain
);
906 if (the_path
&& stat(the_path
, &stbuf
) >= 0) {
907 db
->dictionary
= WMReadPropListFromFile(the_path
);
908 if (db
->dictionary
) {
909 if (requireDictionary
&& !WMIsPLDictionary(db
->dictionary
)) {
910 WMReleasePropList(db
->dictionary
);
911 db
->dictionary
= NULL
;
912 wwarning(_("Domain %s (%s) of defaults database is corrupted!"), domain
, the_path
);
914 db
->timestamp
= stbuf
.st_mtime
;
916 wwarning(_("could not load domain %s from user defaults database"), domain
);
920 /* global system dictionary */
921 shared_dict
= readGlobalDomain(domain
, requireDictionary
);
923 if (shared_dict
&& db
->dictionary
&& WMIsPLDictionary(shared_dict
) &&
924 WMIsPLDictionary(db
->dictionary
)) {
925 WMMergePLDictionaries(shared_dict
, db
->dictionary
, True
);
926 WMReleasePropList(db
->dictionary
);
927 db
->dictionary
= shared_dict
;
928 if (stbuf
.st_mtime
> db
->timestamp
)
929 db
->timestamp
= stbuf
.st_mtime
;
930 } else if (!db
->dictionary
) {
931 db
->dictionary
= shared_dict
;
932 if (stbuf
.st_mtime
> db
->timestamp
)
933 db
->timestamp
= stbuf
.st_mtime
;
939 void wReadStaticDefaults(WMPropList
* dict
)
942 WDefaultEntry
*entry
;
946 for (i
= 0; i
< sizeof(staticOptionList
) / sizeof(staticOptionList
[0]); i
++) {
947 entry
= &staticOptionList
[i
];
950 plvalue
= WMGetFromPLDictionary(dict
, entry
->plkey
);
954 /* no default in the DB. Use builtin default */
956 plvalue
= entry
->plvalue
;
960 (*entry
->convert
) (NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
962 (*entry
->update
) (NULL
, entry
, tdata
, entry
->extra_data
);
967 void wDefaultsCheckDomains(void* arg
)
971 WMPropList
*shared_dict
= NULL
;
975 if (stat(WDWindowMaker
->path
, &stbuf
) >= 0 && WDWindowMaker
->timestamp
< stbuf
.st_mtime
) {
976 WDWindowMaker
->timestamp
= stbuf
.st_mtime
;
978 /* Global dictionary */
979 shared_dict
= readGlobalDomain("WindowMaker", True
);
981 /* User dictionary */
982 dict
= WMReadPropListFromFile(WDWindowMaker
->path
);
985 if (!WMIsPLDictionary(dict
)) {
986 WMReleasePropList(dict
);
988 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
989 "WindowMaker", WDWindowMaker
->path
);
992 WMMergePLDictionaries(shared_dict
, dict
, True
);
993 WMReleasePropList(dict
);
998 for (i
= 0; i
< wScreenCount
; i
++) {
999 scr
= wScreenWithNumber(i
);
1001 wReadDefaults(scr
, dict
);
1004 if (WDWindowMaker
->dictionary
)
1005 WMReleasePropList(WDWindowMaker
->dictionary
);
1007 WDWindowMaker
->dictionary
= dict
;
1010 wwarning(_("could not load domain %s from user defaults database"), "WindowMaker");
1014 WMReleasePropList(shared_dict
);
1018 if (stat(WDWindowAttributes
->path
, &stbuf
) >= 0 && WDWindowAttributes
->timestamp
< stbuf
.st_mtime
) {
1019 /* global dictionary */
1020 shared_dict
= readGlobalDomain("WMWindowAttributes", True
);
1021 /* user dictionary */
1022 dict
= WMReadPropListFromFile(WDWindowAttributes
->path
);
1024 if (!WMIsPLDictionary(dict
)) {
1025 WMReleasePropList(dict
);
1027 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1028 "WMWindowAttributes", WDWindowAttributes
->path
);
1031 WMMergePLDictionaries(shared_dict
, dict
, True
);
1032 WMReleasePropList(dict
);
1037 if (WDWindowAttributes
->dictionary
)
1038 WMReleasePropList(WDWindowAttributes
->dictionary
);
1040 WDWindowAttributes
->dictionary
= dict
;
1041 for (i
= 0; i
< wScreenCount
; i
++) {
1042 scr
= wScreenWithNumber(i
);
1044 wDefaultUpdateIcons(scr
);
1046 /* Update the panel image if changed */
1047 /* Don't worry. If the image is the same these
1048 * functions will have no performance impact. */
1049 create_logo_image(scr
);
1054 wwarning(_("could not load domain %s from user defaults database"), "WMWindowAttributes");
1057 WDWindowAttributes
->timestamp
= stbuf
.st_mtime
;
1059 WMReleasePropList(shared_dict
);
1062 if (stat(WDRootMenu
->path
, &stbuf
) >= 0 && WDRootMenu
->timestamp
< stbuf
.st_mtime
) {
1063 dict
= WMReadPropListFromFile(WDRootMenu
->path
);
1065 if (!WMIsPLArray(dict
) && !WMIsPLString(dict
)) {
1066 WMReleasePropList(dict
);
1068 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1069 "WMRootMenu", WDRootMenu
->path
);
1071 if (WDRootMenu
->dictionary
)
1072 WMReleasePropList(WDRootMenu
->dictionary
);
1074 WDRootMenu
->dictionary
= dict
;
1075 wDefaultsMergeGlobalMenus(WDRootMenu
);
1078 wwarning(_("could not load domain %s from user defaults database"), "WMRootMenu");
1080 WDRootMenu
->timestamp
= stbuf
.st_mtime
;
1082 #ifndef HAVE_INOTIFY
1084 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, arg
);
1088 void wReadDefaults(WScreen
* scr
, WMPropList
* new_dict
)
1090 WMPropList
*plvalue
, *old_value
;
1091 WDefaultEntry
*entry
;
1093 int update_workspace_back
= 0; /* kluge :/ */
1094 unsigned int needs_refresh
;
1096 WMPropList
*old_dict
= (WDWindowMaker
->dictionary
!= new_dict
? WDWindowMaker
->dictionary
: NULL
);
1100 for (i
= 0; i
< sizeof(optionList
) / sizeof(optionList
[0]); i
++) {
1101 entry
= &optionList
[i
];
1104 plvalue
= WMGetFromPLDictionary(new_dict
, entry
->plkey
);
1111 old_value
= WMGetFromPLDictionary(old_dict
, entry
->plkey
);
1113 if (!plvalue
&& !old_value
) {
1114 /* no default in the DB. Use builtin default */
1115 plvalue
= entry
->plvalue
;
1116 if (plvalue
&& new_dict
)
1117 WMPutInPLDictionary(new_dict
, entry
->plkey
, plvalue
);
1119 } else if (!plvalue
) {
1120 /* value was deleted from DB. Keep current value */
1122 } else if (!old_value
) {
1123 /* set value for the 1st time */
1124 } else if (!WMIsPropListEqualTo(plvalue
, old_value
)) {
1125 /* value has changed */
1127 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1128 && update_workspace_back
&& scr
->flags
.backimage_helper_launched
) {
1130 /* value was not changed since last time */
1137 if ((*entry
->convert
) (scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1139 * If the WorkspaceSpecificBack data has been changed
1140 * so that the helper will be launched now, we must be
1141 * sure to send the default background texture config
1144 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0 &&
1145 !scr
->flags
.backimage_helper_launched
)
1146 update_workspace_back
= 1;
1149 needs_refresh
|= (*entry
->update
) (scr
, entry
, tdata
, entry
->extra_data
);
1155 if (needs_refresh
!= 0 && !scr
->flags
.startup
) {
1159 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1160 foo
|= WTextureSettings
;
1161 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1162 foo
|= WFontSettings
;
1163 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1164 foo
|= WColorSettings
;
1166 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1167 (void *)(uintptr_t) foo
);
1170 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1171 foo
|= WTextureSettings
;
1172 if (needs_refresh
& REFRESH_MENU_FONT
)
1173 foo
|= WFontSettings
;
1174 if (needs_refresh
& REFRESH_MENU_COLOR
)
1175 foo
|= WColorSettings
;
1177 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1180 if (needs_refresh
& REFRESH_WINDOW_FONT
)
1181 foo
|= WFontSettings
;
1182 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
)
1183 foo
|= WTextureSettings
;
1184 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
)
1185 foo
|= WColorSettings
;
1187 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1189 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1191 if (needs_refresh
& REFRESH_ICON_FONT
)
1192 foo
|= WFontSettings
;
1193 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
)
1194 foo
|= WTextureSettings
;
1195 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
)
1196 foo
|= WTextureSettings
;
1198 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1199 (void *)(uintptr_t) foo
);
1201 if (needs_refresh
& REFRESH_ICON_TILE
)
1202 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1204 if (needs_refresh
& REFRESH_WORKSPACE_MENU
) {
1205 if (scr
->workspace_menu
)
1206 wWorkspaceMenuUpdate(scr
, scr
->workspace_menu
);
1207 if (scr
->clip_ws_menu
)
1208 wWorkspaceMenuUpdate(scr
, scr
->clip_ws_menu
);
1209 if (scr
->workspace_submenu
)
1210 scr
->workspace_submenu
->flags
.realized
= 0;
1211 if (scr
->clip_submenu
)
1212 scr
->clip_submenu
->flags
.realized
= 0;
1217 void wDefaultUpdateIcons(WScreen
*scr
)
1219 WAppIcon
*aicon
= scr
->app_icon_list
;
1221 WWindow
*wwin
= scr
->focused_window
;
1224 /* Get the application icon, default included */
1225 wIconChangeImageFile(aicon
->icon
, NULL
);
1226 wAppIconPaint(aicon
);
1227 aicon
= aicon
->next
;
1230 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
)
1231 wClipIconPaint(scr
->clip_icon
);
1233 for (dc
= scr
->drawers
; dc
!= NULL
; dc
= dc
->next
)
1234 wDrawerIconPaint(dc
->adrawer
->icon_array
[0]);
1237 if (wwin
->icon
&& wwin
->flags
.miniaturized
)
1238 wIconChangeImageFile(wwin
->icon
, NULL
);
1243 /* --------------------------- Local ----------------------- */
1245 #define GET_STRING_OR_DEFAULT(x, var) if (!WMIsPLString(value)) { \
1246 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1248 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1249 var = entry->default_value;\
1250 } else var = WMGetFromPLString(value)\
1253 static int string2index(WMPropList *key, WMPropList *val, const char *def, WOptionEnumeration * values)
1256 WOptionEnumeration
*v
;
1257 char buffer
[TOTAL_VALUES_LENGTH
];
1259 if (WMIsPLString(val
) && (str
= WMGetFromPLString(val
))) {
1260 for (v
= values
; v
->string
!= NULL
; v
++) {
1261 if (strcasecmp(v
->string
, str
) == 0)
1267 for (v
= values
; v
->string
!= NULL
; v
++) {
1270 strcat(buffer
, ", ");
1271 snprintf(buffer
+strlen(buffer
),
1272 sizeof(buffer
)-strlen(buffer
)-1, "\"%s\"", v
->string
);
1275 wwarning(_("wrong option value for key \"%s\"; got \"%s\", should be one of %s."),
1276 WMGetFromPLString(key
),
1277 WMIsPLString(val
) ? WMGetFromPLString(val
) : "(unknown)",
1281 return string2index(key
, val
, NULL
, values
);
1288 * value - is the value in the defaults DB
1289 * addr - is the address to store the data
1290 * ret - is the address to store a pointer to a temporary buffer. ret
1291 * must not be freed and is used by the set functions
1293 static int getBool(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1297 int second_pass
= 0;
1299 GET_STRING_OR_DEFAULT("Boolean", val
);
1302 if ((val
[1] == '\0' && (val
[0] == 'y' || val
[0] == 'Y'))
1303 || strcasecmp(val
, "YES") == 0) {
1306 } else if ((val
[1] == '\0' && (val
[0] == 'n' || val
[0] == 'N'))
1307 || strcasecmp(val
, "NO") == 0) {
1311 if (sscanf(val
, "%i", &i
) == 1) {
1317 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""), val
, entry
->key
);
1318 if (second_pass
== 0) {
1319 val
= WMGetFromPLString(entry
->plvalue
);
1321 wwarning(_("using default \"%s\" instead"), val
);
1331 *(char *)addr
= data
;
1336 static int getInt(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1341 GET_STRING_OR_DEFAULT("Integer", val
);
1343 if (sscanf(val
, "%i", &data
) != 1) {
1344 wwarning(_("can't convert \"%s\" to integer for key \"%s\""), val
, entry
->key
);
1345 val
= WMGetFromPLString(entry
->plvalue
);
1346 wwarning(_("using default \"%s\" instead"), val
);
1347 if (sscanf(val
, "%i", &data
) != 1) {
1355 *(int *)addr
= data
;
1360 static int getCoord(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1363 char *val_x
, *val_y
;
1364 int nelem
, changed
= 0;
1365 WMPropList
*elem_x
, *elem_y
;
1368 if (!WMIsPLArray(value
)) {
1369 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Coordinate");
1371 value
= entry
->plvalue
;
1373 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1379 nelem
= WMGetPropListItemCount(value
);
1381 wwarning(_("Incorrect number of elements in array for key \"%s\"."), entry
->key
);
1383 value
= entry
->plvalue
;
1385 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1391 elem_x
= WMGetFromPLArray(value
, 0);
1392 elem_y
= WMGetFromPLArray(value
, 1);
1394 if (!elem_x
|| !elem_y
|| !WMIsPLString(elem_x
) || !WMIsPLString(elem_y
)) {
1395 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."), entry
->key
);
1397 value
= entry
->plvalue
;
1399 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1405 val_x
= WMGetFromPLString(elem_x
);
1406 val_y
= WMGetFromPLString(elem_y
);
1408 if (sscanf(val_x
, "%i", &data
.x
) != 1 || sscanf(val_y
, "%i", &data
.y
) != 1) {
1409 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1411 value
= entry
->plvalue
;
1413 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1421 else if (data
.x
> scr
->scr_width
/ 3)
1422 data
.x
= scr
->scr_width
/ 3;
1425 else if (data
.y
> scr
->scr_height
/ 3)
1426 data
.y
= scr
->scr_height
/ 3;
1431 *(WCoord
*) addr
= data
;
1436 static int getPropList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1438 WMRetainPropList(value
);
1445 static int getPathList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1454 if (!WMIsPLArray(value
)) {
1455 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "an array of paths");
1457 value
= entry
->plvalue
;
1459 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1466 count
= WMGetPropListItemCount(value
);
1469 value
= entry
->plvalue
;
1471 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1478 for (i
= 0; i
< count
; i
++) {
1479 d
= WMGetFromPLArray(value
, i
);
1480 if (!d
|| !WMIsPLString(d
)) {
1484 len
+= strlen(WMGetFromPLString(d
)) + 1;
1487 ptr
= data
= wmalloc(len
+ 1);
1489 for (i
= 0; i
< count
; i
++) {
1490 d
= WMGetFromPLArray(value
, i
);
1491 if (!d
|| !WMIsPLString(d
)) {
1494 strcpy(ptr
, WMGetFromPLString(d
));
1495 ptr
+= strlen(WMGetFromPLString(d
));
1502 if (*(char **)addr
!= NULL
) {
1503 wfree(*(char **)addr
);
1505 *(char **)addr
= data
;
1510 static int getEnum(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1512 static signed char data
;
1514 data
= string2index(entry
->plkey
, value
, entry
->default_value
, (WOptionEnumeration
*) entry
->extra_data
);
1521 *(signed char *)addr
= data
;
1528 * (hgradient <color> <color>)
1529 * (vgradient <color> <color>)
1530 * (dgradient <color> <color>)
1531 * (mhgradient <color> <color> ...)
1532 * (mvgradient <color> <color> ...)
1533 * (mdgradient <color> <color> ...)
1534 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1535 * (tpixmap <file> <color>)
1536 * (spixmap <file> <color>)
1537 * (cpixmap <file> <color>)
1538 * (thgradient <file> <opaqueness> <color> <color>)
1539 * (tvgradient <file> <opaqueness> <color> <color>)
1540 * (tdgradient <file> <opaqueness> <color> <color>)
1541 * (function <lib> <function> ...)
1544 static WTexture
*parse_texture(WScreen
* scr
, WMPropList
* pl
)
1549 WTexture
*texture
= NULL
;
1551 nelem
= WMGetPropListItemCount(pl
);
1555 elem
= WMGetFromPLArray(pl
, 0);
1556 if (!elem
|| !WMIsPLString(elem
))
1558 val
= WMGetFromPLString(elem
);
1560 if (strcasecmp(val
, "solid") == 0) {
1568 elem
= WMGetFromPLArray(pl
, 1);
1569 if (!elem
|| !WMIsPLString(elem
))
1571 val
= WMGetFromPLString(elem
);
1573 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1574 wwarning(_("\"%s\" is not a valid color name"), val
);
1578 texture
= (WTexture
*) wTextureMakeSolid(scr
, &color
);
1579 } else if (strcasecmp(val
, "dgradient") == 0
1580 || strcasecmp(val
, "vgradient") == 0 || strcasecmp(val
, "hgradient") == 0) {
1581 RColor color1
, color2
;
1586 wwarning(_("bad number of arguments in gradient specification"));
1590 if (val
[0] == 'd' || val
[0] == 'D')
1591 type
= WTEX_DGRADIENT
;
1592 else if (val
[0] == 'h' || val
[0] == 'H')
1593 type
= WTEX_HGRADIENT
;
1595 type
= WTEX_VGRADIENT
;
1597 /* get from color */
1598 elem
= WMGetFromPLArray(pl
, 1);
1599 if (!elem
|| !WMIsPLString(elem
))
1601 val
= WMGetFromPLString(elem
);
1603 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1604 wwarning(_("\"%s\" is not a valid color name"), val
);
1608 color1
.red
= xcolor
.red
>> 8;
1609 color1
.green
= xcolor
.green
>> 8;
1610 color1
.blue
= xcolor
.blue
>> 8;
1613 elem
= WMGetFromPLArray(pl
, 2);
1614 if (!elem
|| !WMIsPLString(elem
)) {
1617 val
= WMGetFromPLString(elem
);
1619 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1620 wwarning(_("\"%s\" is not a valid color name"), val
);
1624 color2
.red
= xcolor
.red
>> 8;
1625 color2
.green
= xcolor
.green
>> 8;
1626 color2
.blue
= xcolor
.blue
>> 8;
1628 texture
= (WTexture
*) wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1630 } else if (strcasecmp(val
, "igradient") == 0) {
1631 RColor colors1
[2], colors2
[2];
1637 wwarning(_("bad number of arguments in gradient specification"));
1641 /* get from color */
1642 for (i
= 0; i
< 2; i
++) {
1643 elem
= WMGetFromPLArray(pl
, 1 + i
);
1644 if (!elem
|| !WMIsPLString(elem
))
1646 val
= WMGetFromPLString(elem
);
1648 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1649 wwarning(_("\"%s\" is not a valid color name"), val
);
1652 colors1
[i
].alpha
= 255;
1653 colors1
[i
].red
= xcolor
.red
>> 8;
1654 colors1
[i
].green
= xcolor
.green
>> 8;
1655 colors1
[i
].blue
= xcolor
.blue
>> 8;
1657 elem
= WMGetFromPLArray(pl
, 3);
1658 if (!elem
|| !WMIsPLString(elem
))
1660 val
= WMGetFromPLString(elem
);
1663 /* get from color */
1664 for (i
= 0; i
< 2; i
++) {
1665 elem
= WMGetFromPLArray(pl
, 4 + i
);
1666 if (!elem
|| !WMIsPLString(elem
))
1668 val
= WMGetFromPLString(elem
);
1670 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1671 wwarning(_("\"%s\" is not a valid color name"), val
);
1674 colors2
[i
].alpha
= 255;
1675 colors2
[i
].red
= xcolor
.red
>> 8;
1676 colors2
[i
].green
= xcolor
.green
>> 8;
1677 colors2
[i
].blue
= xcolor
.blue
>> 8;
1679 elem
= WMGetFromPLArray(pl
, 6);
1680 if (!elem
|| !WMIsPLString(elem
))
1682 val
= WMGetFromPLString(elem
);
1685 texture
= (WTexture
*) wTextureMakeIGradient(scr
, th1
, colors1
, th2
, colors2
);
1687 } else if (strcasecmp(val
, "mhgradient") == 0
1688 || strcasecmp(val
, "mvgradient") == 0 || strcasecmp(val
, "mdgradient") == 0) {
1695 wwarning(_("too few arguments in multicolor gradient specification"));
1699 if (val
[1] == 'h' || val
[1] == 'H')
1700 type
= WTEX_MHGRADIENT
;
1701 else if (val
[1] == 'v' || val
[1] == 'V')
1702 type
= WTEX_MVGRADIENT
;
1704 type
= WTEX_MDGRADIENT
;
1708 colors
= wmalloc(sizeof(RColor
*) * (count
+ 1));
1710 for (i
= 0; i
< count
; i
++) {
1711 elem
= WMGetFromPLArray(pl
, i
+ 1);
1712 if (!elem
|| !WMIsPLString(elem
)) {
1713 for (--i
; i
>= 0; --i
) {
1719 val
= WMGetFromPLString(elem
);
1721 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1722 wwarning(_("\"%s\" is not a valid color name"), val
);
1723 for (--i
; i
>= 0; --i
) {
1729 colors
[i
] = wmalloc(sizeof(RColor
));
1730 colors
[i
]->red
= color
.red
>> 8;
1731 colors
[i
]->green
= color
.green
>> 8;
1732 colors
[i
]->blue
= color
.blue
>> 8;
1737 texture
= (WTexture
*) wTextureMakeMGradient(scr
, type
, colors
);
1738 } else if (strcasecmp(val
, "spixmap") == 0 ||
1739 strcasecmp(val
, "cpixmap") == 0 || strcasecmp(val
, "tpixmap") == 0) {
1746 if (val
[0] == 's' || val
[0] == 'S')
1748 else if (val
[0] == 'c' || val
[0] == 'C')
1754 elem
= WMGetFromPLArray(pl
, 2);
1755 if (!elem
|| !WMIsPLString(elem
)) {
1758 val
= WMGetFromPLString(elem
);
1760 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1761 wwarning(_("\"%s\" is not a valid color name"), val
);
1766 elem
= WMGetFromPLArray(pl
, 1);
1767 if (!elem
|| !WMIsPLString(elem
))
1769 val
= WMGetFromPLString(elem
);
1771 texture
= (WTexture
*) wTextureMakePixmap(scr
, type
, val
, &color
);
1772 } else if (strcasecmp(val
, "thgradient") == 0
1773 || strcasecmp(val
, "tvgradient") == 0 || strcasecmp(val
, "tdgradient") == 0) {
1774 RColor color1
, color2
;
1779 if (val
[1] == 'h' || val
[1] == 'H')
1780 style
= WTEX_THGRADIENT
;
1781 else if (val
[1] == 'v' || val
[1] == 'V')
1782 style
= WTEX_TVGRADIENT
;
1784 style
= WTEX_TDGRADIENT
;
1787 wwarning(_("bad number of arguments in textured gradient specification"));
1791 /* get from color */
1792 elem
= WMGetFromPLArray(pl
, 3);
1793 if (!elem
|| !WMIsPLString(elem
))
1795 val
= WMGetFromPLString(elem
);
1797 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1798 wwarning(_("\"%s\" is not a valid color name"), val
);
1802 color1
.red
= xcolor
.red
>> 8;
1803 color1
.green
= xcolor
.green
>> 8;
1804 color1
.blue
= xcolor
.blue
>> 8;
1807 elem
= WMGetFromPLArray(pl
, 4);
1808 if (!elem
|| !WMIsPLString(elem
)) {
1811 val
= WMGetFromPLString(elem
);
1813 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1814 wwarning(_("\"%s\" is not a valid color name"), val
);
1818 color2
.red
= xcolor
.red
>> 8;
1819 color2
.green
= xcolor
.green
>> 8;
1820 color2
.blue
= xcolor
.blue
>> 8;
1823 elem
= WMGetFromPLArray(pl
, 2);
1824 if (!elem
|| !WMIsPLString(elem
))
1827 val
= WMGetFromPLString(elem
);
1829 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
1830 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
1835 elem
= WMGetFromPLArray(pl
, 1);
1836 if (!elem
|| !WMIsPLString(elem
))
1838 val
= WMGetFromPLString(elem
);
1840 texture
= (WTexture
*) wTextureMakeTGradient(scr
, style
, &color1
, &color2
, val
, opacity
);
1841 } else if (strcasecmp(val
, "function") == 0) {
1842 /* Leave this in to handle the unlikely case of
1843 * someone actually having function textures configured */
1844 wwarning("function texture support has been removed");
1847 wwarning(_("invalid texture type %s"), val
);
1853 static int getTexture(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1855 static WTexture
*texture
;
1859 if (!WMIsPLArray(value
)) {
1860 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Texture");
1862 value
= entry
->plvalue
;
1864 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1870 if (strcmp(entry
->key
, "WidgetColor") == 0 && !changed
) {
1873 pl
= WMGetFromPLArray(value
, 0);
1874 if (!pl
|| !WMIsPLString(pl
) || !WMGetFromPLString(pl
)
1875 || strcasecmp(WMGetFromPLString(pl
), "solid") != 0) {
1876 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1877 entry
->key
, "Solid Texture");
1879 value
= entry
->plvalue
;
1881 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1886 texture
= parse_texture(scr
, value
);
1889 wwarning(_("Error in texture specification for key \"%s\""), entry
->key
);
1891 value
= entry
->plvalue
;
1893 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1903 *(WTexture
**) addr
= texture
;
1908 static int getWSBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1916 if (!WMIsPLArray(value
)) {
1917 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1918 "WorkspaceBack", "Texture or None");
1920 value
= entry
->plvalue
;
1922 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1928 /* only do basic error checking and verify for None texture */
1930 nelem
= WMGetPropListItemCount(value
);
1932 elem
= WMGetFromPLArray(value
, 0);
1933 if (!elem
|| !WMIsPLString(elem
)) {
1934 wwarning(_("Wrong type for workspace background. Should be a texture type."));
1936 value
= entry
->plvalue
;
1938 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1943 val
= WMGetFromPLString(elem
);
1945 if (strcasecmp(val
, "None") == 0)
1948 *ret
= WMRetainPropList(value
);
1954 getWSSpecificBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1961 if (!WMIsPLArray(value
)) {
1962 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1963 "WorkspaceSpecificBack", "an array of textures");
1965 value
= entry
->plvalue
;
1967 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1973 /* only do basic error checking and verify for None texture */
1975 nelem
= WMGetPropListItemCount(value
);
1978 elem
= WMGetFromPLArray(value
, nelem
);
1979 if (!elem
|| !WMIsPLArray(elem
)) {
1980 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
1986 *ret
= WMRetainPropList(value
);
1990 * Kluge to force wmsetbg helper to set the default background.
1991 * If the WorkspaceSpecificBack is changed once wmaker has started,
1992 * the WorkspaceBack won't be sent to the helper, unless the user
1993 * changes it's value too. So, we must force this by removing the
1994 * value from the defaults DB.
1996 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
1997 WMPropList
*key
= WMCreatePLString("WorkspaceBack");
1999 WMRemoveFromPLDictionary(WDWindowMaker
->dictionary
, key
);
2001 WMReleasePropList(key
);
2007 static int getFont(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2009 static WMFont
*font
;
2012 GET_STRING_OR_DEFAULT("Font", val
);
2014 font
= WMCreateFont(scr
->wmscreen
, val
);
2016 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2019 wfatal(_("could not load any usable font!!!"));
2026 /* can't assign font value outside update function */
2027 wassertrv(addr
== NULL
, True
);
2032 static int getColor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2034 static XColor color
;
2036 int second_pass
= 0;
2038 GET_STRING_OR_DEFAULT("Color", val
);
2041 if (!wGetColor(scr
, val
, &color
)) {
2042 wwarning(_("could not get color for key \"%s\""), entry
->key
);
2043 if (second_pass
== 0) {
2044 val
= WMGetFromPLString(entry
->plvalue
);
2046 wwarning(_("using default \"%s\" instead"), val
);
2055 assert(addr
== NULL
);
2058 *(unsigned long*)addr = pixel;
2064 static int getKeybind(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2066 static WShortKey shortcut
;
2070 char buf
[MAX_SHORTCUT_LENGTH
], *b
;
2072 GET_STRING_OR_DEFAULT("Key spec", val
);
2074 if (!val
|| strcasecmp(val
, "NONE") == 0) {
2075 shortcut
.keycode
= 0;
2076 shortcut
.modifier
= 0;
2082 wstrlcpy(buf
, val
, MAX_SHORTCUT_LENGTH
);
2087 shortcut
.modifier
= 0;
2088 while ((k
= strchr(b
, '+')) != NULL
) {
2092 mod
= wXModifierFromKey(b
);
2094 wwarning(_("%s: invalid key modifier \"%s\""), entry
->key
, b
);
2097 shortcut
.modifier
|= mod
;
2103 ksym
= XStringToKeysym(b
);
2105 if (ksym
== NoSymbol
) {
2106 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
, val
);
2110 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2111 if (shortcut
.keycode
== 0) {
2112 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2122 static int getModMask(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2127 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2132 mask
= wXModifierFromKey(str
);
2134 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2140 *(int *)addr
= mask
;
2148 # include <X11/cursorfont.h>
2154 #define CURSOR_ID_NONE (XC_num_glyphs)
2156 static const WCursorLookup cursor_table
[] = {
2157 {"X_cursor", XC_X_cursor
},
2158 {"arrow", XC_arrow
},
2159 {"based_arrow_down", XC_based_arrow_down
},
2160 {"based_arrow_up", XC_based_arrow_up
},
2162 {"bogosity", XC_bogosity
},
2163 {"bottom_left_corner", XC_bottom_left_corner
},
2164 {"bottom_right_corner", XC_bottom_right_corner
},
2165 {"bottom_side", XC_bottom_side
},
2166 {"bottom_tee", XC_bottom_tee
},
2167 {"box_spiral", XC_box_spiral
},
2168 {"center_ptr", XC_center_ptr
},
2169 {"circle", XC_circle
},
2170 {"clock", XC_clock
},
2171 {"coffee_mug", XC_coffee_mug
},
2172 {"cross", XC_cross
},
2173 {"cross_reverse", XC_cross_reverse
},
2174 {"crosshair", XC_crosshair
},
2175 {"diamond_cross", XC_diamond_cross
},
2177 {"dotbox", XC_dotbox
},
2178 {"double_arrow", XC_double_arrow
},
2179 {"draft_large", XC_draft_large
},
2180 {"draft_small", XC_draft_small
},
2181 {"draped_box", XC_draped_box
},
2182 {"exchange", XC_exchange
},
2183 {"fleur", XC_fleur
},
2184 {"gobbler", XC_gobbler
},
2185 {"gumby", XC_gumby
},
2186 {"hand1", XC_hand1
},
2187 {"hand2", XC_hand2
},
2188 {"heart", XC_heart
},
2190 {"iron_cross", XC_iron_cross
},
2191 {"left_ptr", XC_left_ptr
},
2192 {"left_side", XC_left_side
},
2193 {"left_tee", XC_left_tee
},
2194 {"leftbutton", XC_leftbutton
},
2195 {"ll_angle", XC_ll_angle
},
2196 {"lr_angle", XC_lr_angle
},
2198 {"middlebutton", XC_middlebutton
},
2199 {"mouse", XC_mouse
},
2200 {"pencil", XC_pencil
},
2201 {"pirate", XC_pirate
},
2203 {"question_arrow", XC_question_arrow
},
2204 {"right_ptr", XC_right_ptr
},
2205 {"right_side", XC_right_side
},
2206 {"right_tee", XC_right_tee
},
2207 {"rightbutton", XC_rightbutton
},
2208 {"rtl_logo", XC_rtl_logo
},
2209 {"sailboat", XC_sailboat
},
2210 {"sb_down_arrow", XC_sb_down_arrow
},
2211 {"sb_h_double_arrow", XC_sb_h_double_arrow
},
2212 {"sb_left_arrow", XC_sb_left_arrow
},
2213 {"sb_right_arrow", XC_sb_right_arrow
},
2214 {"sb_up_arrow", XC_sb_up_arrow
},
2215 {"sb_v_double_arrow", XC_sb_v_double_arrow
},
2216 {"shuttle", XC_shuttle
},
2217 {"sizing", XC_sizing
},
2218 {"spider", XC_spider
},
2219 {"spraycan", XC_spraycan
},
2221 {"target", XC_target
},
2222 {"tcross", XC_tcross
},
2223 {"top_left_arrow", XC_top_left_arrow
},
2224 {"top_left_corner", XC_top_left_corner
},
2225 {"top_right_corner", XC_top_right_corner
},
2226 {"top_side", XC_top_side
},
2227 {"top_tee", XC_top_tee
},
2229 {"ul_angle", XC_ul_angle
},
2230 {"umbrella", XC_umbrella
},
2231 {"ur_angle", XC_ur_angle
},
2232 {"watch", XC_watch
},
2233 {"xterm", XC_xterm
},
2234 {NULL
, CURSOR_ID_NONE
}
2237 static void check_bitmap_status(int status
, const char *filename
, Pixmap bitmap
)
2240 case BitmapOpenFailed
:
2241 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2243 case BitmapFileInvalid
:
2244 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2246 case BitmapNoMemory
:
2247 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2250 XFreePixmap(dpy
, bitmap
);
2257 * (builtin, <cursor_name>)
2258 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2260 static int parse_cursor(WScreen
* scr
, WMPropList
* pl
, Cursor
* cursor
)
2267 nelem
= WMGetPropListItemCount(pl
);
2271 elem
= WMGetFromPLArray(pl
, 0);
2272 if (!elem
|| !WMIsPLString(elem
)) {
2275 val
= WMGetFromPLString(elem
);
2277 if (strcasecmp(val
, "none") == 0) {
2280 } else if (strcasecmp(val
, "builtin") == 0) {
2282 int cursor_id
= CURSOR_ID_NONE
;
2285 wwarning(_("bad number of arguments in cursor specification"));
2288 elem
= WMGetFromPLArray(pl
, 1);
2289 if (!elem
|| !WMIsPLString(elem
)) {
2292 val
= WMGetFromPLString(elem
);
2294 for (i
= 0; cursor_table
[i
].name
!= NULL
; i
++) {
2295 if (strcasecmp(val
, cursor_table
[i
].name
) == 0) {
2296 cursor_id
= cursor_table
[i
].id
;
2300 if (CURSOR_ID_NONE
== cursor_id
) {
2301 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2303 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2306 } else if (strcasecmp(val
, "bitmap") == 0) {
2318 wwarning(_("bad number of arguments in cursor specification"));
2321 elem
= WMGetFromPLArray(pl
, 1);
2322 if (!elem
|| !WMIsPLString(elem
)) {
2325 val
= WMGetFromPLString(elem
);
2326 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2328 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2331 elem
= WMGetFromPLArray(pl
, 2);
2332 if (!elem
|| !WMIsPLString(elem
)) {
2336 val
= WMGetFromPLString(elem
);
2337 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2340 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2343 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
, &mask
, &x
, &y
);
2344 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
, &bitmap
, &x
, &y
);
2345 if ((BitmapSuccess
== bitmap_status
) && (BitmapSuccess
== mask_status
)) {
2346 fg
.pixel
= scr
->black_pixel
;
2347 bg
.pixel
= scr
->white_pixel
;
2348 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2349 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2350 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2353 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2354 check_bitmap_status(mask_status
, mask_name
, mask
);
2361 static int getCursor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2363 static Cursor cursor
;
2368 if (!WMIsPLArray(value
)) {
2369 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2370 entry
->key
, "cursor specification");
2372 value
= entry
->plvalue
;
2374 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2379 status
= parse_cursor(scr
, value
, &cursor
);
2381 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2383 value
= entry
->plvalue
;
2385 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2394 *(Cursor
*) addr
= cursor
;
2399 #undef CURSOR_ID_NONE
2401 /* ---------------- value setting functions --------------- */
2402 static int setJustify(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2404 return REFRESH_WINDOW_TITLE_COLOR
;
2407 static int setClearance(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2409 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
| REFRESH_MENU_TITLE_FONT
| REFRESH_MENU_FONT
;
2412 static int setIfDockPresent(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2415 long which
= (long) extra_data
;
2419 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2420 // Drawers require the dock
2421 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| wPreferences
.flags
.nodock
;
2424 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2427 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| *flag
;
2435 static int setClipMergedInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2439 wPreferences
.flags
.clip_merged_in_dock
= *flag
;
2440 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2444 static int setWrapAppiconsInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2448 wPreferences
.flags
.wrap_appicons_in_dock
= *flag
;
2452 static int setStickyIcons(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2454 if (scr
->workspaces
) {
2455 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2456 wArrangeIcons(scr
, False
);
2461 static int setIconTile(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2465 WTexture
** texture
= tdata
;
2468 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2469 wPreferences
.icon_size
, ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2470 ? WREL_ICON
: WREL_FLAT
);
2472 wwarning(_("could not render texture for icon background"));
2474 wTextureDestroy(scr
, *texture
);
2477 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2479 if (scr
->icon_tile
) {
2481 RReleaseImage(scr
->icon_tile
);
2482 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2485 scr
->icon_tile
= img
;
2487 /* put the icon in the noticeboard hint */
2488 PropSetIconTileHint(scr
, img
);
2490 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
) {
2491 if (scr
->clip_tile
) {
2492 RReleaseImage(scr
->clip_tile
);
2494 scr
->clip_tile
= wClipMakeTile(scr
, img
);
2497 if (!wPreferences
.flags
.nodrawer
) {
2498 if (scr
->drawer_tile
) {
2499 RReleaseImage(scr
->drawer_tile
);
2501 scr
->drawer_tile
= wDrawerMakeTile(scr
, img
);
2504 scr
->icon_tile_pixmap
= pixmap
;
2506 if (scr
->def_icon_rimage
) {
2507 RReleaseImage(scr
->def_icon_rimage
);
2508 scr
->def_icon_rimage
= NULL
;
2511 if (scr
->icon_back_texture
)
2512 wTextureDestroy(scr
, (WTexture
*) scr
->icon_back_texture
);
2514 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2516 /* Free the texture as nobody else will use it, nor refer to it. */
2518 wTextureDestroy(scr
, *texture
);
2520 return (reset
? REFRESH_ICON_TILE
: 0);
2523 static int setWinTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2525 WMFont
*font
= tdata
;
2527 if (scr
->title_font
) {
2528 WMReleaseFont(scr
->title_font
);
2530 scr
->title_font
= font
;
2532 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
;
2535 static int setMenuTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2537 WMFont
*font
= tdata
;
2539 if (scr
->menu_title_font
) {
2540 WMReleaseFont(scr
->menu_title_font
);
2543 scr
->menu_title_font
= font
;
2545 return REFRESH_MENU_TITLE_FONT
;
2548 static int setMenuTextFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2550 WMFont
*font
= tdata
;
2552 if (scr
->menu_entry_font
) {
2553 WMReleaseFont(scr
->menu_entry_font
);
2555 scr
->menu_entry_font
= font
;
2557 return REFRESH_MENU_FONT
;
2560 static int setIconTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2562 WMFont
*font
= tdata
;
2564 if (scr
->icon_title_font
) {
2565 WMReleaseFont(scr
->icon_title_font
);
2568 scr
->icon_title_font
= font
;
2570 return REFRESH_ICON_FONT
;
2573 static int setClipTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2575 WMFont
*font
= tdata
;
2577 if (scr
->clip_title_font
) {
2578 WMReleaseFont(scr
->clip_title_font
);
2581 scr
->clip_title_font
= font
;
2583 return REFRESH_ICON_FONT
;
2586 static int setLargeDisplayFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2588 WMFont
*font
= tdata
;
2590 if (scr
->workspace_name_font
) {
2591 WMReleaseFont(scr
->workspace_name_font
);
2594 scr
->workspace_name_font
= font
;
2599 static int setHightlight(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2601 XColor
*color
= tdata
;
2603 if (scr
->select_color
)
2604 WMReleaseColor(scr
->select_color
);
2606 scr
->select_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2608 wFreeColor(scr
, color
->pixel
);
2610 return REFRESH_MENU_COLOR
;
2613 static int setHightlightText(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2615 XColor
*color
= tdata
;
2617 if (scr
->select_text_color
)
2618 WMReleaseColor(scr
->select_text_color
);
2620 scr
->select_text_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2622 wFreeColor(scr
, color
->pixel
);
2624 return REFRESH_MENU_COLOR
;
2627 static int setClipTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2629 XColor
*color
= tdata
;
2630 long widx
= (long) extra_data
;
2632 if (scr
->clip_title_color
[widx
])
2633 WMReleaseColor(scr
->clip_title_color
[widx
]);
2635 scr
->clip_title_color
[widx
] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2636 wFreeColor(scr
, color
->pixel
);
2638 return REFRESH_ICON_TITLE_COLOR
;
2641 static int setWTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2643 XColor
*color
= tdata
;
2644 long widx
= (long) extra_data
;
2646 if (scr
->window_title_color
[widx
])
2647 WMReleaseColor(scr
->window_title_color
[widx
]);
2649 scr
->window_title_color
[widx
] =
2650 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2652 wFreeColor(scr
, color
->pixel
);
2654 return REFRESH_WINDOW_TITLE_COLOR
;
2657 static int setMenuTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2659 XColor
*color
= tdata
;
2661 if (scr
->menu_title_color
[0])
2662 WMReleaseColor(scr
->menu_title_color
[0]);
2664 scr
->menu_title_color
[0] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2666 wFreeColor(scr
, color
->pixel
);
2668 return REFRESH_MENU_TITLE_COLOR
;
2671 static int setMenuTextColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2673 XColor
*color
= tdata
;
2675 if (scr
->mtext_color
)
2676 WMReleaseColor(scr
->mtext_color
);
2678 scr
->mtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2680 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2681 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2683 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2686 wFreeColor(scr
, color
->pixel
);
2688 return REFRESH_MENU_COLOR
;
2691 static int setMenuDisabledColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2693 XColor
*color
= tdata
;
2695 if (scr
->dtext_color
)
2696 WMReleaseColor(scr
->dtext_color
);
2698 scr
->dtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2700 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2701 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2703 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2706 wFreeColor(scr
, color
->pixel
);
2708 return REFRESH_MENU_COLOR
;
2711 static int setIconTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2713 XColor
*color
= tdata
;
2715 if (scr
->icon_title_color
)
2716 WMReleaseColor(scr
->icon_title_color
);
2717 scr
->icon_title_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2719 wFreeColor(scr
, color
->pixel
);
2721 return REFRESH_ICON_TITLE_COLOR
;
2724 static int setIconTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2726 XColor
*color
= tdata
;
2728 if (scr
->icon_title_texture
) {
2729 wTextureDestroy(scr
, (WTexture
*) scr
->icon_title_texture
);
2731 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
2733 return REFRESH_ICON_TITLE_BACK
;
2736 static int setFrameBorderWidth(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2740 scr
->frame_border_width
= *value
;
2742 return REFRESH_FRAME_BORDER
;
2745 static int setFrameBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2747 XColor
*color
= tdata
;
2749 if (scr
->frame_border_color
)
2750 WMReleaseColor(scr
->frame_border_color
);
2751 scr
->frame_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2753 wFreeColor(scr
, color
->pixel
);
2755 return REFRESH_FRAME_BORDER
;
2758 static int setFrameSelectedBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2760 XColor
*color
= tdata
;
2762 if (scr
->frame_selected_border_color
)
2763 WMReleaseColor(scr
->frame_selected_border_color
);
2764 scr
->frame_selected_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2766 wFreeColor(scr
, color
->pixel
);
2768 return REFRESH_FRAME_BORDER
;
2771 static void trackDeadProcess(pid_t pid
, unsigned char status
, WScreen
* scr
)
2773 close(scr
->helper_fd
);
2775 scr
->helper_pid
= 0;
2776 scr
->flags
.backimage_helper_launched
= 0;
2779 static int setWorkspaceSpecificBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
2781 WMPropList
*value
= tdata
;
2786 if (scr
->flags
.backimage_helper_launched
) {
2787 if (WMGetPropListItemCount(value
) == 0) {
2788 SendHelperMessage(scr
, 'C', 0, NULL
);
2789 SendHelperMessage(scr
, 'K', 0, NULL
);
2791 WMReleasePropList(value
);
2798 if (WMGetPropListItemCount(value
) == 0)
2801 if (pipe(filedes
) < 0) {
2802 werror("pipe() failed:can't set workspace specific background image");
2804 WMReleasePropList(value
);
2810 werror("fork() failed:can't set workspace specific background image");
2811 if (close(filedes
[0]) < 0)
2812 werror("could not close pipe");
2813 if (close(filedes
[1]) < 0)
2814 werror("could not close pipe");
2816 } else if (pid
== 0) {
2819 SetupEnvironment(scr
);
2822 werror("could not close pipe");
2823 if (dup(filedes
[0]) < 0) {
2824 werror("dup() failed:can't set workspace specific background image");
2826 dither
= wPreferences
.no_dithering
? "-m" : "-d";
2827 if (wPreferences
.smooth_workspace_back
)
2828 execlp("wmsetbg", "wmsetbg", "-helper", "-S", dither
, NULL
);
2830 execlp("wmsetbg", "wmsetbg", "-helper", dither
, NULL
);
2831 werror("could not execute wmsetbg");
2835 if (fcntl(filedes
[0], F_SETFD
, FD_CLOEXEC
) < 0) {
2836 werror("error setting close-on-exec flag");
2838 if (fcntl(filedes
[1], F_SETFD
, FD_CLOEXEC
) < 0) {
2839 werror("error setting close-on-exec flag");
2842 scr
->helper_fd
= filedes
[1];
2843 scr
->helper_pid
= pid
;
2844 scr
->flags
.backimage_helper_launched
= 1;
2846 wAddDeathHandler(pid
, (WDeathHandler
*) trackDeadProcess
, scr
);
2848 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
2853 for (i
= 0; i
< WMGetPropListItemCount(value
); i
++) {
2854 val
= WMGetFromPLArray(value
, i
);
2855 if (val
&& WMIsPLArray(val
) && WMGetPropListItemCount(val
) > 0) {
2856 str
= WMGetPropListDescription(val
, False
);
2858 SendHelperMessage(scr
, 'S', i
+ 1, str
);
2862 SendHelperMessage(scr
, 'U', i
+ 1, NULL
);
2867 WMReleasePropList(value
);
2871 static int setWorkspaceBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
2873 WMPropList
*value
= tdata
;
2875 if (scr
->flags
.backimage_helper_launched
) {
2878 if (WMGetPropListItemCount(value
) == 0) {
2879 SendHelperMessage(scr
, 'U', 0, NULL
);
2881 /* set the default workspace background to this one */
2882 str
= WMGetPropListDescription(value
, False
);
2884 SendHelperMessage(scr
, 'S', 0, str
);
2886 SendHelperMessage(scr
, 'C', scr
->current_workspace
+ 1, NULL
);
2888 SendHelperMessage(scr
, 'U', 0, NULL
);
2891 } else if (WMGetPropListItemCount(value
) > 0) {
2897 text
= WMGetPropListDescription(value
, False
);
2898 len
= strlen(text
) + 40;
2899 command
= wmalloc(len
);
2900 dither
= wPreferences
.no_dithering
? "-m" : "-d";
2901 if (wPreferences
.smooth_workspace_back
)
2902 snprintf(command
, len
, "wmsetbg %s -S -p '%s' &", dither
, text
);
2904 snprintf(command
, len
, "wmsetbg %s -p '%s' &", dither
, text
);
2906 ExecuteShellCommand(scr
, command
);
2909 WMReleasePropList(value
);
2914 static int setWidgetColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2916 WTexture
**texture
= tdata
;
2918 if (scr
->widget_texture
) {
2919 wTextureDestroy(scr
, (WTexture
*) scr
->widget_texture
);
2921 scr
->widget_texture
= *(WTexSolid
**) texture
;
2926 static int setFTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2928 WTexture
**texture
= tdata
;
2930 if (scr
->window_title_texture
[WS_FOCUSED
]) {
2931 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
2933 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
2935 return REFRESH_WINDOW_TEXTURES
;
2938 static int setPTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2940 WTexture
**texture
= tdata
;
2942 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
2943 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
2945 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
2947 return REFRESH_WINDOW_TEXTURES
;
2950 static int setUTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2952 WTexture
**texture
= tdata
;
2954 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
2955 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
2957 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
2959 return REFRESH_WINDOW_TEXTURES
;
2962 static int setResizebarBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2964 WTexture
**texture
= tdata
;
2966 if (scr
->resizebar_texture
[0]) {
2967 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
2969 scr
->resizebar_texture
[0] = *texture
;
2971 return REFRESH_WINDOW_TEXTURES
;
2974 static int setMenuTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2976 WTexture
**texture
= tdata
;
2978 if (scr
->menu_title_texture
[0]) {
2979 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
2981 scr
->menu_title_texture
[0] = *texture
;
2983 return REFRESH_MENU_TITLE_TEXTURE
;
2986 static int setMenuTextBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2988 WTexture
**texture
= tdata
;
2990 if (scr
->menu_item_texture
) {
2991 wTextureDestroy(scr
, scr
->menu_item_texture
);
2992 wTextureDestroy(scr
, (WTexture
*) scr
->menu_item_auxtexture
);
2994 scr
->menu_item_texture
= *texture
;
2996 scr
->menu_item_auxtexture
= wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
2998 return REFRESH_MENU_TEXTURE
;
3001 static int setKeyGrab(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3003 WShortKey
*shortcut
= tdata
;
3005 long widx
= (long) extra_data
;
3007 wKeyBindings
[widx
] = *shortcut
;
3009 wwin
= scr
->focused_window
;
3011 while (wwin
!= NULL
) {
3012 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3014 if (!WFLAGP(wwin
, no_bind_keys
)) {
3015 wWindowSetKeyGrabs(wwin
);
3020 /* do we need to update window menus? */
3021 if (widx
>= WKBD_WORKSPACE1
&& widx
<= WKBD_WORKSPACE10
)
3022 return REFRESH_WORKSPACE_MENU
;
3023 if (widx
== WKBD_LASTWORKSPACE
)
3024 return REFRESH_WORKSPACE_MENU
;
3025 if (widx
>= WKBD_MOVE_WORKSPACE1
&& widx
<= WKBD_MOVE_WORKSPACE10
)
3026 return REFRESH_WORKSPACE_MENU
;
3031 static int setIconPosition(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3033 wScreenUpdateUsableArea(scr
);
3034 wArrangeIcons(scr
, True
);
3039 static int updateUsableArea(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3041 wScreenUpdateUsableArea(scr
);
3046 static int setMenuStyle(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3048 return REFRESH_MENU_TEXTURE
;
3051 static RImage
*chopOffImage(RImage
* image
, int x
, int y
, int w
, int h
)
3053 RImage
*img
= RCreateImage(w
, h
, image
->format
== RRGBAFormat
);
3055 RCopyArea(img
, image
, x
, y
, w
, h
, 0, 0);
3060 static int setSwPOptions(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3062 WMPropList
*array
= tdata
;
3065 int cwidth
, cheight
;
3066 struct WPreferences
*prefs
= foo
;
3068 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) == 0) {
3069 if (prefs
->swtileImage
)
3070 RReleaseImage(prefs
->swtileImage
);
3071 prefs
->swtileImage
= NULL
;
3073 WMReleasePropList(array
);
3077 switch (WMGetPropListItemCount(array
)) {
3079 if (!WMIsPLString(WMGetFromPLArray(array
, 1))) {
3080 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3083 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 1)));
3086 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3087 WMGetFromPLString(WMGetFromPLArray(array
, 1)), entry
->key
);
3089 bgimage
= RLoadImage(scr
->rcontext
, path
, 0);
3091 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3096 cwidth
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 2)));
3097 cheight
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 3)));
3099 if (cwidth
<= 0 || cheight
<= 0 ||
3100 cwidth
>= bgimage
->width
- 2 || cheight
>= bgimage
->height
- 2)
3101 wwarning(_("Invalid split sizes for SwitchPanel back image."));
3104 int swidth
, theight
;
3105 for (i
= 0; i
< 9; i
++) {
3106 if (prefs
->swbackImage
[i
])
3107 RReleaseImage(prefs
->swbackImage
[i
]);
3108 prefs
->swbackImage
[i
] = NULL
;
3110 swidth
= (bgimage
->width
- cwidth
) / 2;
3111 theight
= (bgimage
->height
- cheight
) / 2;
3113 prefs
->swbackImage
[0] = chopOffImage(bgimage
, 0, 0, swidth
, theight
);
3114 prefs
->swbackImage
[1] = chopOffImage(bgimage
, swidth
, 0, cwidth
, theight
);
3115 prefs
->swbackImage
[2] = chopOffImage(bgimage
, swidth
+ cwidth
, 0,
3118 prefs
->swbackImage
[3] = chopOffImage(bgimage
, 0, theight
, swidth
, cheight
);
3119 prefs
->swbackImage
[4] = chopOffImage(bgimage
, swidth
, theight
,
3121 prefs
->swbackImage
[5] = chopOffImage(bgimage
, swidth
+ cwidth
, theight
,
3124 prefs
->swbackImage
[6] = chopOffImage(bgimage
, 0, theight
+ cheight
,
3126 prefs
->swbackImage
[7] = chopOffImage(bgimage
, swidth
, theight
+ cheight
,
3128 prefs
->swbackImage
[8] =
3129 chopOffImage(bgimage
, swidth
+ cwidth
, theight
+ cheight
, swidth
,
3132 // check if anything failed
3133 for (i
= 0; i
< 9; i
++) {
3134 if (!prefs
->swbackImage
[i
]) {
3135 for (; i
>= 0; --i
) {
3136 RReleaseImage(prefs
->swbackImage
[i
]);
3137 prefs
->swbackImage
[i
] = NULL
;
3143 RReleaseImage(bgimage
);
3148 if (!WMIsPLString(WMGetFromPLArray(array
, 0))) {
3149 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3152 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 0)));
3155 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3156 WMGetFromPLString(WMGetFromPLArray(array
, 0)), entry
->key
);
3158 if (prefs
->swtileImage
)
3159 RReleaseImage(prefs
->swtileImage
);
3161 prefs
->swtileImage
= RLoadImage(scr
->rcontext
, path
, 0);
3162 if (!prefs
->swtileImage
) {
3163 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3170 wwarning(_("Invalid number of arguments for option \"%s\""), entry
->key
);
3174 WMReleasePropList(array
);
3179 static int setModifierKeyLabels(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3181 WMPropList
*array
= tdata
;
3183 struct WPreferences
*prefs
= foo
;
3185 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) != 7) {
3186 wwarning(_("Value for option \"%s\" must be an array of 7 strings"), entry
->key
);
3187 WMReleasePropList(array
);
3191 DestroyWindowMenu(scr
);
3193 for (i
= 0; i
< 7; i
++) {
3194 if (prefs
->modifier_labels
[i
])
3195 wfree(prefs
->modifier_labels
[i
]);
3197 if (WMIsPLString(WMGetFromPLArray(array
, i
))) {
3198 prefs
->modifier_labels
[i
] = wstrdup(WMGetFromPLString(WMGetFromPLArray(array
, i
)));
3200 wwarning(_("Invalid argument for option \"%s\" item %d"), entry
->key
, i
);
3201 prefs
->modifier_labels
[i
] = NULL
;
3205 WMReleasePropList(array
);
3210 static int setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3217 W_setconf_doubleClickDelay(*value
);
3222 static int setCursor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3224 Cursor
*cursor
= tdata
;
3225 long widx
= (long) extra_data
;
3227 if (wPreferences
.cursor
[widx
] != None
) {
3228 XFreeCursor(dpy
, wPreferences
.cursor
[widx
]);
3231 wPreferences
.cursor
[widx
] = *cursor
;
3233 if (widx
== WCUR_ROOT
&& *cursor
!= None
) {
3234 XDefineCursor(dpy
, scr
->root_win
, *cursor
);