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 WShortKey wKeyBindings
[WKBD_LAST
];
80 typedef struct _WDefaultEntry WDefaultEntry
;
81 typedef int (WDECallbackConvert
) (WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*plvalue
, void *addr
, void **tdata
);
82 typedef int (WDECallbackUpdate
) (WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *extra_data
);
84 struct _WDefaultEntry
{
86 const char *default_value
;
89 WDECallbackConvert
*convert
;
90 WDECallbackUpdate
*update
;
92 WMPropList
*plvalue
; /* default value */
95 /* used to map strings to integers */
100 } WOptionEnumeration
;
102 /* type converters */
103 static WDECallbackConvert getBool
;
104 static WDECallbackConvert getInt
;
105 static WDECallbackConvert getCoord
;
106 static WDECallbackConvert getPathList
;
107 static WDECallbackConvert getEnum
;
108 static WDECallbackConvert getTexture
;
109 static WDECallbackConvert getWSBackground
;
110 static WDECallbackConvert getWSSpecificBackground
;
111 static WDECallbackConvert getFont
;
112 static WDECallbackConvert getColor
;
113 static WDECallbackConvert getKeybind
;
114 static WDECallbackConvert getModMask
;
115 static WDECallbackConvert getPropList
;
117 /* value setting functions */
118 static WDECallbackUpdate setJustify
;
119 static WDECallbackUpdate setClearance
;
120 static WDECallbackUpdate setIfDockPresent
;
121 static WDECallbackUpdate setClipMergedInDock
;
122 static WDECallbackUpdate setWrapAppiconsInDock
;
123 static WDECallbackUpdate setStickyIcons
;
124 static WDECallbackUpdate setWidgetColor
;
125 static WDECallbackUpdate setIconTile
;
126 static WDECallbackUpdate setWinTitleFont
;
127 static WDECallbackUpdate setMenuTitleFont
;
128 static WDECallbackUpdate setMenuTextFont
;
129 static WDECallbackUpdate setIconTitleFont
;
130 static WDECallbackUpdate setIconTitleColor
;
131 static WDECallbackUpdate setIconTitleBack
;
132 static WDECallbackUpdate setFrameBorderWidth
;
133 static WDECallbackUpdate setFrameBorderColor
;
134 static WDECallbackUpdate setFrameSelectedBorderColor
;
135 static WDECallbackUpdate setLargeDisplayFont
;
136 static WDECallbackUpdate setWTitleColor
;
137 static WDECallbackUpdate setFTitleBack
;
138 static WDECallbackUpdate setPTitleBack
;
139 static WDECallbackUpdate setUTitleBack
;
140 static WDECallbackUpdate setResizebarBack
;
141 static WDECallbackUpdate setWorkspaceBack
;
142 static WDECallbackUpdate setWorkspaceSpecificBack
;
143 static WDECallbackUpdate setMenuTitleColor
;
144 static WDECallbackUpdate setMenuTextColor
;
145 static WDECallbackUpdate setMenuDisabledColor
;
146 static WDECallbackUpdate setMenuTitleBack
;
147 static WDECallbackUpdate setMenuTextBack
;
148 static WDECallbackUpdate setHightlight
;
149 static WDECallbackUpdate setHightlightText
;
150 static WDECallbackUpdate setKeyGrab
;
151 static WDECallbackUpdate setDoubleClick
;
152 static WDECallbackUpdate setIconPosition
;
154 static WDECallbackUpdate setClipTitleFont
;
155 static WDECallbackUpdate setClipTitleColor
;
157 static WDECallbackUpdate setMenuStyle
;
158 static WDECallbackUpdate setSwPOptions
;
159 static WDECallbackUpdate updateUsableArea
;
161 static WDECallbackUpdate setModifierKeyLabels
;
163 static WDECallbackConvert getCursor
;
164 static WDECallbackUpdate setCursor
;
167 * Tables to convert strings to enumeration values.
168 * Values stored are char
171 /* WARNING: sum of length of all value strings must not exceed
173 #define TOTAL_VALUES_LENGTH 80
175 #define REFRESH_WINDOW_TEXTURES (1<<0)
176 #define REFRESH_MENU_TEXTURE (1<<1)
177 #define REFRESH_MENU_FONT (1<<2)
178 #define REFRESH_MENU_COLOR (1<<3)
179 #define REFRESH_MENU_TITLE_TEXTURE (1<<4)
180 #define REFRESH_MENU_TITLE_FONT (1<<5)
181 #define REFRESH_MENU_TITLE_COLOR (1<<6)
182 #define REFRESH_WINDOW_TITLE_COLOR (1<<7)
183 #define REFRESH_WINDOW_FONT (1<<8)
184 #define REFRESH_ICON_TILE (1<<9)
185 #define REFRESH_ICON_FONT (1<<10)
186 #define REFRESH_WORKSPACE_BACK (1<<11)
188 #define REFRESH_BUTTON_IMAGES (1<<12)
190 #define REFRESH_ICON_TITLE_COLOR (1<<13)
191 #define REFRESH_ICON_TITLE_BACK (1<<14)
193 #define REFRESH_WORKSPACE_MENU (1<<15)
195 #define REFRESH_FRAME_BORDER REFRESH_MENU_FONT|REFRESH_WINDOW_FONT
197 static WOptionEnumeration seFocusModes
[] = {
198 {"Manual", WKF_CLICK
, 0}, {"ClickToFocus", WKF_CLICK
, 1},
199 {"Sloppy", WKF_SLOPPY
, 0}, {"SemiAuto", WKF_SLOPPY
, 1}, {"Auto", WKF_SLOPPY
, 1},
203 static WOptionEnumeration seTitlebarModes
[] = {
204 {"new", TS_NEW
, 0}, {"old", TS_OLD
, 0},
205 {"next", TS_NEXT
, 0}, {NULL
, 0, 0}
208 static WOptionEnumeration seColormapModes
[] = {
209 {"Manual", WCM_CLICK
, 0}, {"ClickToFocus", WCM_CLICK
, 1},
210 {"Auto", WCM_POINTER
, 0}, {"FocusFollowMouse", WCM_POINTER
, 1},
214 static WOptionEnumeration sePlacements
[] = {
215 {"Auto", WPM_AUTO
, 0},
216 {"Smart", WPM_SMART
, 0},
217 {"Cascade", WPM_CASCADE
, 0},
218 {"Random", WPM_RANDOM
, 0},
219 {"Manual", WPM_MANUAL
, 0},
220 {"Center", WPM_CENTER
, 0},
224 static WOptionEnumeration seGeomDisplays
[] = {
225 {"None", WDIS_NONE
, 0},
226 {"Center", WDIS_CENTER
, 0},
227 {"Corner", WDIS_TOPLEFT
, 0},
228 {"Floating", WDIS_FRAME_CENTER
, 0},
229 {"Line", WDIS_NEW
, 0},
233 static WOptionEnumeration seSpeeds
[] = {
234 {"UltraFast", SPEED_ULTRAFAST
, 0},
235 {"Fast", SPEED_FAST
, 0},
236 {"Medium", SPEED_MEDIUM
, 0},
237 {"Slow", SPEED_SLOW
, 0},
238 {"UltraSlow", SPEED_ULTRASLOW
, 0},
242 static WOptionEnumeration seMouseButtonActions
[] = {
243 {"None", WA_NONE
, 0},
244 {"SelectWindows", WA_SELECT_WINDOWS
, 0},
245 {"OpenApplicationsMenu", WA_OPEN_APPMENU
, 0},
246 {"OpenWindowListMenu", WA_OPEN_WINLISTMENU
, 0},
250 static WOptionEnumeration seMouseWheelActions
[] = {
251 {"None", WA_NONE
, 0},
252 {"SwitchWorkspaces", WA_SWITCH_WORKSPACES
, 0},
256 static WOptionEnumeration seIconificationStyles
[] = {
257 {"Zoom", WIS_ZOOM
, 0},
258 {"Twist", WIS_TWIST
, 0},
259 {"Flip", WIS_FLIP
, 0},
260 {"None", WIS_NONE
, 0},
261 {"random", WIS_RANDOM
, 0},
265 static WOptionEnumeration seJustifications
[] = {
266 {"Left", WTJ_LEFT
, 0},
267 {"Center", WTJ_CENTER
, 0},
268 {"Right", WTJ_RIGHT
, 0},
272 static WOptionEnumeration seIconPositions
[] = {
273 {"blv", IY_BOTTOM
| IY_LEFT
| IY_VERT
, 0},
274 {"blh", IY_BOTTOM
| IY_LEFT
| IY_HORIZ
, 0},
275 {"brv", IY_BOTTOM
| IY_RIGHT
| IY_VERT
, 0},
276 {"brh", IY_BOTTOM
| IY_RIGHT
| IY_HORIZ
, 0},
277 {"tlv", IY_TOP
| IY_LEFT
| IY_VERT
, 0},
278 {"tlh", IY_TOP
| IY_LEFT
| IY_HORIZ
, 0},
279 {"trv", IY_TOP
| IY_RIGHT
| IY_VERT
, 0},
280 {"trh", IY_TOP
| IY_RIGHT
| IY_HORIZ
, 0},
284 static WOptionEnumeration seMenuStyles
[] = {
285 {"normal", MS_NORMAL
, 0},
286 {"singletexture", MS_SINGLE_TEXTURE
, 0},
287 {"flat", MS_FLAT
, 0},
291 static WOptionEnumeration seDisplayPositions
[] = {
292 {"none", WD_NONE
, 0},
293 {"center", WD_CENTER
, 0},
295 {"bottom", WD_BOTTOM
, 0},
296 {"topleft", WD_TOPLEFT
, 0},
297 {"topright", WD_TOPRIGHT
, 0},
298 {"bottomleft", WD_BOTTOMLEFT
, 0},
299 {"bottomright", WD_BOTTOMRIGHT
, 0},
303 static WOptionEnumeration seWorkspaceBorder
[] = {
304 {"None", WB_NONE
, 0},
305 {"LeftRight", WB_LEFTRIGHT
, 0},
306 {"TopBottom", WB_TOPBOTTOM
, 0},
307 {"AllDirections", WB_ALLDIRS
, 0},
312 * ALL entries in the tables bellow, NEED to have a default value
313 * defined, and this value needs to be correct.
316 /* these options will only affect the window manager on startup
318 * static defaults can't access the screen data, because it is
319 * created after these defaults are read
321 WDefaultEntry staticOptionList
[] = {
323 {"ColormapSize", "4", NULL
,
324 &wPreferences
.cmap_size
, getInt
, NULL
, NULL
, NULL
},
325 {"DisableDithering", "NO", NULL
,
326 &wPreferences
.no_dithering
, getBool
, NULL
, NULL
, NULL
},
327 {"IconSize", "64", NULL
,
328 &wPreferences
.icon_size
, getInt
, NULL
, NULL
, NULL
},
329 {"ModifierKey", "Mod1", NULL
,
330 &wPreferences
.modifier_mask
, getModMask
, NULL
, NULL
, NULL
},
331 {"DisableWSMouseActions", "NO", NULL
,
332 &wPreferences
.disable_root_mouse
, getBool
, NULL
, NULL
, NULL
},
333 {"FocusMode", "manual", seFocusModes
, /* have a problem when switching from */
334 &wPreferences
.focus_mode
, getEnum
, NULL
, NULL
, NULL
}, /* manual to sloppy without restart */
335 {"NewStyle", "new", seTitlebarModes
,
336 &wPreferences
.new_style
, getEnum
, NULL
, NULL
, NULL
},
337 {"DisableDock", "NO", (void *)WM_DOCK
,
338 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
339 {"DisableClip", "NO", (void *)WM_CLIP
,
340 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
341 {"DisableDrawers", "NO", (void *)WM_DRAWER
,
342 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
343 {"ClipMergedInDock", "NO", NULL
,
344 NULL
, getBool
, setClipMergedInDock
, NULL
, NULL
},
345 {"DisableMiniwindows", "NO", NULL
,
346 &wPreferences
.disable_miniwindows
, getBool
, NULL
, NULL
, NULL
}
349 #define NUM2STRING_(x) #x
350 #define NUM2STRING(x) NUM2STRING_(x)
352 WDefaultEntry optionList
[] = {
354 /* dynamic options */
356 {"IconPosition", "blh", seIconPositions
,
357 &wPreferences
.icon_yard
, getEnum
, setIconPosition
, NULL
, NULL
},
358 {"IconificationStyle", "Zoom", seIconificationStyles
,
359 &wPreferences
.iconification_style
, getEnum
, NULL
, NULL
, NULL
},
360 {"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions
,
361 &wPreferences
.mouse_button1
, getEnum
, NULL
, NULL
, NULL
},
362 {"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions
,
363 &wPreferences
.mouse_button2
, getEnum
, NULL
, NULL
, NULL
},
364 {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions
,
365 &wPreferences
.mouse_button3
, getEnum
, NULL
, NULL
, NULL
},
366 {"MouseWheelAction", "None", seMouseWheelActions
,
367 &wPreferences
.mouse_wheel
, getEnum
, NULL
, NULL
, NULL
},
368 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
369 &wPreferences
.pixmap_path
, getPathList
, NULL
, NULL
, NULL
},
370 {"IconPath", DEF_ICON_PATHS
, NULL
,
371 &wPreferences
.icon_path
, getPathList
, NULL
, NULL
, NULL
},
372 {"ColormapMode", "auto", seColormapModes
,
373 &wPreferences
.colormap_mode
, getEnum
, NULL
, NULL
, NULL
},
374 {"AutoFocus", "NO", NULL
,
375 &wPreferences
.auto_focus
, getBool
, NULL
, NULL
, NULL
},
376 {"RaiseDelay", "0", NULL
,
377 &wPreferences
.raise_delay
, getInt
, NULL
, NULL
, NULL
},
378 {"CirculateRaise", "NO", NULL
,
379 &wPreferences
.circ_raise
, getBool
, NULL
, NULL
, NULL
},
380 {"Superfluous", "NO", NULL
,
381 &wPreferences
.superfluous
, getBool
, NULL
, NULL
, NULL
},
382 {"AdvanceToNewWorkspace", "NO", NULL
,
383 &wPreferences
.ws_advance
, getBool
, NULL
, NULL
, NULL
},
384 {"CycleWorkspaces", "NO", NULL
,
385 &wPreferences
.ws_cycle
, getBool
, NULL
, NULL
, NULL
},
386 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
387 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
, NULL
, NULL
},
388 {"WorkspaceBorder", "None", seWorkspaceBorder
,
389 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
, NULL
, NULL
},
390 {"WorkspaceBorderSize", "0", NULL
,
391 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
, NULL
, NULL
},
392 {"StickyIcons", "NO", NULL
,
393 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
, NULL
, NULL
},
394 {"SaveSessionOnExit", "NO", NULL
,
395 &wPreferences
.save_session_on_exit
, getBool
, NULL
, NULL
, NULL
},
396 {"WrapMenus", "NO", NULL
,
397 &wPreferences
.wrap_menus
, getBool
, NULL
, NULL
, NULL
},
398 {"ScrollableMenus", "NO", NULL
,
399 &wPreferences
.scrollable_menus
, getBool
, NULL
, NULL
, NULL
},
400 {"MenuScrollSpeed", "medium", seSpeeds
,
401 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
, NULL
, NULL
},
402 {"IconSlideSpeed", "medium", seSpeeds
,
403 &wPreferences
.icon_slide_speed
, getEnum
, NULL
, NULL
, NULL
},
404 {"ShadeSpeed", "medium", seSpeeds
,
405 &wPreferences
.shade_speed
, getEnum
, NULL
, NULL
, NULL
},
406 {"BounceAppIconsWhenUrgent", "YES", NULL
,
407 &wPreferences
.bounce_appicons_when_urgent
, getBool
, NULL
, NULL
, NULL
},
408 {"RaiseAppIconsWhenBouncing", "NO", NULL
,
409 &wPreferences
.raise_appicons_when_bouncing
, getBool
, NULL
, NULL
, NULL
},
410 {"DoNotMakeAppIconsBounce", "NO", NULL
,
411 &wPreferences
.do_not_make_appicons_bounce
, getBool
, NULL
, NULL
, NULL
},
412 {"DoubleClickTime", "250", (void *)&wPreferences
.dblclick_time
,
413 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
, NULL
, NULL
},
414 {"ClipAutoraiseDelay", "600", NULL
,
415 &wPreferences
.clip_auto_raise_delay
, getInt
, NULL
, NULL
, NULL
},
416 {"ClipAutolowerDelay", "1000", NULL
,
417 &wPreferences
.clip_auto_lower_delay
, getInt
, NULL
, NULL
, NULL
},
418 {"ClipAutoexpandDelay", "600", NULL
,
419 &wPreferences
.clip_auto_expand_delay
, getInt
, NULL
, NULL
, NULL
},
420 {"ClipAutocollapseDelay", "1000", NULL
,
421 &wPreferences
.clip_auto_collapse_delay
, getInt
, NULL
, NULL
, NULL
},
422 {"WrapAppiconsInDock", "YES", NULL
,
423 NULL
, getBool
, setWrapAppiconsInDock
, NULL
, NULL
},
424 {"AlignSubmenus", "NO", NULL
,
425 &wPreferences
.align_menus
, getBool
, NULL
, NULL
, NULL
},
426 {"ViKeyMenus", "NO", NULL
,
427 &wPreferences
.vi_key_menus
, getBool
, NULL
, NULL
, NULL
},
428 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
429 &wPreferences
.open_transients_with_parent
, getBool
, NULL
, NULL
, NULL
},
430 {"WindowPlacement", "auto", sePlacements
,
431 &wPreferences
.window_placement
, getEnum
, NULL
, NULL
, NULL
},
432 {"IgnoreFocusClick", "NO", NULL
,
433 &wPreferences
.ignore_focus_click
, getBool
, NULL
, NULL
, NULL
},
434 {"UseSaveUnders", "NO", NULL
,
435 &wPreferences
.use_saveunders
, getBool
, NULL
, NULL
, NULL
},
436 {"OpaqueMove", "NO", NULL
,
437 &wPreferences
.opaque_move
, getBool
, NULL
, NULL
, NULL
},
438 {"OpaqueResize", "NO", NULL
,
439 &wPreferences
.opaque_resize
, getBool
, NULL
, NULL
, NULL
},
440 {"OpaqueMoveResizeKeyboard", "NO", NULL
,
441 &wPreferences
.opaque_move_resize_keyboard
, getBool
, NULL
, NULL
, NULL
},
442 {"DisableAnimations", "NO", NULL
,
443 &wPreferences
.no_animations
, getBool
, NULL
, NULL
, NULL
},
444 {"DontLinkWorkspaces", "NO", NULL
,
445 &wPreferences
.no_autowrap
, getBool
, NULL
, NULL
, NULL
},
446 {"HighlightActiveApp", "YES", NULL
,
447 &wPreferences
.highlight_active_app
, getBool
, NULL
, NULL
, NULL
},
448 {"AutoArrangeIcons", "NO", NULL
,
449 &wPreferences
.auto_arrange_icons
, getBool
, NULL
, NULL
, NULL
},
450 {"NoWindowOverDock", "NO", NULL
,
451 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
, NULL
, NULL
},
452 {"NoWindowOverIcons", "NO", NULL
,
453 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
, NULL
, NULL
},
454 {"WindowPlaceOrigin", "(0, 0)", NULL
,
455 &wPreferences
.window_place_origin
, getCoord
, NULL
, NULL
, NULL
},
456 {"ResizeDisplay", "corner", seGeomDisplays
,
457 &wPreferences
.size_display
, getEnum
, NULL
, NULL
, NULL
},
458 {"MoveDisplay", "corner", seGeomDisplays
,
459 &wPreferences
.move_display
, getEnum
, NULL
, NULL
, NULL
},
460 {"DontConfirmKill", "NO", NULL
,
461 &wPreferences
.dont_confirm_kill
, getBool
, NULL
, NULL
, NULL
},
462 {"WindowTitleBalloons", "NO", NULL
,
463 &wPreferences
.window_balloon
, getBool
, NULL
, NULL
, NULL
},
464 {"MiniwindowTitleBalloons", "NO", NULL
,
465 &wPreferences
.miniwin_balloon
, getBool
, NULL
, NULL
, NULL
},
466 {"AppIconBalloons", "NO", NULL
,
467 &wPreferences
.appicon_balloon
, getBool
, NULL
, NULL
, NULL
},
468 {"HelpBalloons", "NO", NULL
,
469 &wPreferences
.help_balloon
, getBool
, NULL
, NULL
, NULL
},
470 {"EdgeResistance", "30", NULL
,
471 &wPreferences
.edge_resistance
, getInt
, NULL
, NULL
, NULL
},
472 {"ResizeIncrement", "0", NULL
,
473 &wPreferences
.resize_increment
, getInt
, NULL
, NULL
, NULL
},
474 {"Attraction", "NO", NULL
,
475 &wPreferences
.attract
, getBool
, NULL
, NULL
, NULL
},
476 {"DisableBlinking", "NO", NULL
,
477 &wPreferences
.dont_blink
, getBool
, NULL
, NULL
, NULL
},
478 {"SingleClickLaunch", "NO", NULL
,
479 &wPreferences
.single_click
, getBool
, NULL
, NULL
, NULL
},
480 {"StrictWindozeCycle", "YES", NULL
,
481 &wPreferences
.strict_windoze_cycle
, getBool
, NULL
, NULL
, NULL
},
482 {"SwitchPanelOnlyOpen", "NO", NULL
,
483 &wPreferences
.panel_only_open
, getBool
, NULL
, NULL
, NULL
},
487 {"MenuStyle", "normal", seMenuStyles
,
488 &wPreferences
.menu_style
, getEnum
, setMenuStyle
, NULL
, NULL
},
489 {"WidgetColor", "(solid, gray)", NULL
,
490 NULL
, getTexture
, setWidgetColor
, NULL
, NULL
},
491 {"WorkspaceSpecificBack", "()", NULL
,
492 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
, NULL
, NULL
},
493 /* WorkspaceBack must come after WorkspaceSpecificBack or
494 * WorkspaceBack wont know WorkspaceSpecificBack was also
495 * specified and 2 copies of wmsetbg will be launched */
496 {"WorkspaceBack", "(solid, black)", NULL
,
497 NULL
, getWSBackground
, setWorkspaceBack
, NULL
, NULL
},
498 {"SmoothWorkspaceBack", "NO", NULL
,
499 NULL
, getBool
, NULL
, NULL
, NULL
},
500 {"IconBack", "(solid, gray)", NULL
,
501 NULL
, getTexture
, setIconTile
, NULL
, NULL
},
502 {"TitleJustify", "center", seJustifications
,
503 &wPreferences
.title_justification
, getEnum
, setJustify
, NULL
, NULL
},
504 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
505 NULL
, getFont
, setWinTitleFont
, NULL
, NULL
},
506 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
507 &wPreferences
.window_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
508 {"WindowTitleMinHeight", "0", NULL
,
509 &wPreferences
.window_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
510 {"WindowTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
511 &wPreferences
.window_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
512 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
513 &wPreferences
.menu_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
514 {"MenuTitleMinHeight", "0", NULL
,
515 &wPreferences
.menu_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
516 {"MenuTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
517 &wPreferences
.menu_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
518 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
519 &wPreferences
.menu_text_clearance
, getInt
, setClearance
, NULL
, NULL
},
520 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
521 NULL
, getFont
, setMenuTitleFont
, NULL
, NULL
},
522 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
523 NULL
, getFont
, setMenuTextFont
, NULL
, NULL
},
524 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
525 NULL
, getFont
, setIconTitleFont
, NULL
, NULL
},
526 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
527 NULL
, getFont
, setClipTitleFont
, NULL
, NULL
},
528 {"ShowClipTitle", "YES", NULL
,
529 &wPreferences
.show_clip_title
, getBool
, NULL
, NULL
, NULL
},
530 {"LargeDisplayFont", DEF_WORKSPACE_NAME_FONT
, NULL
,
531 NULL
, getFont
, setLargeDisplayFont
, NULL
, NULL
},
532 {"HighlightColor", "white", NULL
,
533 NULL
, getColor
, setHightlight
, NULL
, NULL
},
534 {"HighlightTextColor", "black", NULL
,
535 NULL
, getColor
, setHightlightText
, NULL
, NULL
},
536 {"ClipTitleColor", "black", (void *)CLIP_NORMAL
,
537 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
538 {"CClipTitleColor", "\"#454045\"", (void *)CLIP_COLLAPSED
,
539 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
540 {"FTitleColor", "white", (void *)WS_FOCUSED
,
541 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
542 {"PTitleColor", "white", (void *)WS_PFOCUSED
,
543 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
544 {"UTitleColor", "black", (void *)WS_UNFOCUSED
,
545 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
546 {"FTitleBack", "(solid, black)", NULL
,
547 NULL
, getTexture
, setFTitleBack
, NULL
, NULL
},
548 {"PTitleBack", "(solid, \"#616161\")", NULL
,
549 NULL
, getTexture
, setPTitleBack
, NULL
, NULL
},
550 {"UTitleBack", "(solid, gray)", NULL
,
551 NULL
, getTexture
, setUTitleBack
, NULL
, NULL
},
552 {"ResizebarBack", "(solid, gray)", NULL
,
553 NULL
, getTexture
, setResizebarBack
, NULL
, NULL
},
554 {"MenuTitleColor", "white", NULL
,
555 NULL
, getColor
, setMenuTitleColor
, NULL
, NULL
},
556 {"MenuTextColor", "black", NULL
,
557 NULL
, getColor
, setMenuTextColor
, NULL
, NULL
},
558 {"MenuDisabledColor", "\"#616161\"", NULL
,
559 NULL
, getColor
, setMenuDisabledColor
, NULL
, NULL
},
560 {"MenuTitleBack", "(solid, black)", NULL
,
561 NULL
, getTexture
, setMenuTitleBack
, NULL
, NULL
},
562 {"MenuTextBack", "(solid, gray)", NULL
,
563 NULL
, getTexture
, setMenuTextBack
, NULL
, NULL
},
564 {"IconTitleColor", "white", NULL
,
565 NULL
, getColor
, setIconTitleColor
, NULL
, NULL
},
566 {"IconTitleBack", "black", NULL
,
567 NULL
, getColor
, setIconTitleBack
, NULL
, NULL
},
568 {"SwitchPanelImages", "(swtile.png, swback.png, 30, 40)", &wPreferences
,
569 NULL
, getPropList
, setSwPOptions
, NULL
, NULL
},
570 {"ModifierKeyLabels", "(\"Shift+\", \"Ctrl+\", \"Mod1+\", \"Mod2+\", \"Mod3+\", \"Mod4+\", \"Mod5+\")", &wPreferences
,
571 NULL
, getPropList
, setModifierKeyLabels
, NULL
, NULL
},
572 {"FrameBorderWidth", "1", NULL
,
573 NULL
, getInt
, setFrameBorderWidth
, NULL
, NULL
},
574 {"FrameBorderColor", "black", NULL
,
575 NULL
, getColor
, setFrameBorderColor
, NULL
, NULL
},
576 {"FrameSelectedBorderColor", "white", NULL
,
577 NULL
, getColor
, setFrameSelectedBorderColor
, NULL
, NULL
},
581 {"RootMenuKey", "None", (void *)WKBD_ROOTMENU
,
582 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
583 {"WindowListKey", "None", (void *)WKBD_WINDOWLIST
,
584 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
585 {"WindowMenuKey", "None", (void *)WKBD_WINDOWMENU
,
586 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
587 {"DockRaiseLowerKey", "None", (void*)WKBD_DOCKRAISELOWER
,
588 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
589 {"ClipRaiseLowerKey", "None", (void *)WKBD_CLIPRAISELOWER
,
590 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
591 {"MiniaturizeKey", "None", (void *)WKBD_MINIATURIZE
,
592 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
593 {"MinimizeAllKey", "None", (void *)WKBD_MINIMIZEALL
,
594 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
595 {"HideKey", "None", (void *)WKBD_HIDE
,
596 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
597 {"HideOthersKey", "None", (void *)WKBD_HIDE_OTHERS
,
598 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
599 {"MoveResizeKey", "None", (void *)WKBD_MOVERESIZE
,
600 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
601 {"CloseKey", "None", (void *)WKBD_CLOSE
,
602 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
603 {"MaximizeKey", "None", (void *)WKBD_MAXIMIZE
,
604 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
605 {"VMaximizeKey", "None", (void *)WKBD_VMAXIMIZE
,
606 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
607 {"HMaximizeKey", "None", (void *)WKBD_HMAXIMIZE
,
608 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
609 {"LHMaximizeKey", "None", (void*)WKBD_LHMAXIMIZE
,
610 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
611 {"RHMaximizeKey", "None", (void*)WKBD_RHMAXIMIZE
,
612 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
613 {"THMaximizeKey", "None", (void*)WKBD_THMAXIMIZE
,
614 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
615 {"BHMaximizeKey", "None", (void*)WKBD_BHMAXIMIZE
,
616 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
617 {"LTCMaximizeKey", "None", (void*)WKBD_LTCMAXIMIZE
,
618 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
619 {"RTCMaximizeKey", "None", (void*)WKBD_RTCMAXIMIZE
,
620 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
621 {"LBCMaximizeKey", "None", (void*)WKBD_LBCMAXIMIZE
,
622 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
623 {"RBCMaximizeKey", "None", (void*)WKBD_RBCMAXIMIZE
,
624 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
625 {"MaximusKey", "None", (void*)WKBD_MAXIMUS
,
626 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
627 {"RaiseKey", "\"Meta+Up\"", (void *)WKBD_RAISE
,
628 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
629 {"LowerKey", "\"Meta+Down\"", (void *)WKBD_LOWER
,
630 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
631 {"RaiseLowerKey", "None", (void *)WKBD_RAISELOWER
,
632 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
633 {"ShadeKey", "None", (void *)WKBD_SHADE
,
634 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
635 {"SelectKey", "None", (void *)WKBD_SELECT
,
636 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
637 {"FocusNextKey", "None", (void *)WKBD_FOCUSNEXT
,
638 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
639 {"FocusPrevKey", "None", (void *)WKBD_FOCUSPREV
,
640 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
641 {"GroupNextKey", "None", (void *)WKBD_GROUPNEXT
,
642 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
643 {"GroupPrevKey", "None", (void *)WKBD_GROUPPREV
,
644 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
645 {"NextWorkspaceKey", "None", (void *)WKBD_NEXTWORKSPACE
,
646 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
647 {"PrevWorkspaceKey", "None", (void *)WKBD_PREVWORKSPACE
,
648 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
649 {"LastWorkspaceKey", "None", (void *)WKBD_LASTWORKSPACE
,
650 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
651 {"NextWorkspaceLayerKey", "None", (void *)WKBD_NEXTWSLAYER
,
652 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
653 {"PrevWorkspaceLayerKey", "None", (void *)WKBD_PREVWSLAYER
,
654 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
655 {"Workspace1Key", "None", (void *)WKBD_WORKSPACE1
,
656 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
657 {"Workspace2Key", "None", (void *)WKBD_WORKSPACE2
,
658 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
659 {"Workspace3Key", "None", (void *)WKBD_WORKSPACE3
,
660 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
661 {"Workspace4Key", "None", (void *)WKBD_WORKSPACE4
,
662 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
663 {"Workspace5Key", "None", (void *)WKBD_WORKSPACE5
,
664 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
665 {"Workspace6Key", "None", (void *)WKBD_WORKSPACE6
,
666 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
667 {"Workspace7Key", "None", (void *)WKBD_WORKSPACE7
,
668 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
669 {"Workspace8Key", "None", (void *)WKBD_WORKSPACE8
,
670 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
671 {"Workspace9Key", "None", (void *)WKBD_WORKSPACE9
,
672 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
673 {"Workspace10Key", "None", (void *)WKBD_WORKSPACE10
,
674 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
675 {"MoveToWorkspace1Key", "None", (void *)WKBD_MOVE_WORKSPACE1
,
676 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
677 {"MoveToWorkspace2Key", "None", (void *)WKBD_MOVE_WORKSPACE2
,
678 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
679 {"MoveToWorkspace3Key", "None", (void *)WKBD_MOVE_WORKSPACE3
,
680 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
681 {"MoveToWorkspace4Key", "None", (void *)WKBD_MOVE_WORKSPACE4
,
682 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
683 {"MoveToWorkspace5Key", "None", (void *)WKBD_MOVE_WORKSPACE5
,
684 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
685 {"MoveToWorkspace6Key", "None", (void *)WKBD_MOVE_WORKSPACE6
,
686 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
687 {"MoveToWorkspace7Key", "None", (void *)WKBD_MOVE_WORKSPACE7
,
688 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
689 {"MoveToWorkspace8Key", "None", (void *)WKBD_MOVE_WORKSPACE8
,
690 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
691 {"MoveToWorkspace9Key", "None", (void *)WKBD_MOVE_WORKSPACE9
,
692 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
693 {"MoveToWorkspace10Key", "None", (void *)WKBD_MOVE_WORKSPACE10
,
694 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
695 {"MoveToNextWorkspaceKey", "None", (void *)WKBD_MOVE_NEXTWORKSPACE
,
696 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
697 {"MoveToPrevWorkspaceKey", "None", (void *)WKBD_MOVE_PREVWORKSPACE
,
698 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
699 {"MoveToLastWorkspaceKey", "None", (void *)WKBD_MOVE_LASTWORKSPACE
,
700 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
701 {"MoveToNextWorkspaceLayerKey", "None", (void *)WKBD_MOVE_NEXTWSLAYER
,
702 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
703 {"MoveToPrevWorkspaceLayerKey", "None", (void *)WKBD_MOVE_PREVWSLAYER
,
704 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
705 {"WindowShortcut1Key", "None", (void *)WKBD_WINDOW1
,
706 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
707 {"WindowShortcut2Key", "None", (void *)WKBD_WINDOW2
,
708 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
709 {"WindowShortcut3Key", "None", (void *)WKBD_WINDOW3
,
710 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
711 {"WindowShortcut4Key", "None", (void *)WKBD_WINDOW4
,
712 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
713 {"WindowShortcut5Key", "None", (void *)WKBD_WINDOW5
,
714 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
715 {"WindowShortcut6Key", "None", (void *)WKBD_WINDOW6
,
716 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
717 {"WindowShortcut7Key", "None", (void *)WKBD_WINDOW7
,
718 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
719 {"WindowShortcut8Key", "None", (void *)WKBD_WINDOW8
,
720 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
721 {"WindowShortcut9Key", "None", (void *)WKBD_WINDOW9
,
722 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
723 {"WindowShortcut10Key", "None", (void *)WKBD_WINDOW10
,
724 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
725 {"WindowRelaunchKey", "None", (void *)WKBD_RELAUNCH
,
726 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
727 {"ScreenSwitchKey", "None", (void *)WKBD_SWITCH_SCREEN
,
728 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
730 #ifdef KEEP_XKB_LOCK_STATUS
731 {"ToggleKbdModeKey", "None", (void *)WKBD_TOGGLE
,
732 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
733 {"KbdModeLock", "NO", NULL
,
734 &wPreferences
.modelock
, getBool
, NULL
, NULL
, NULL
},
735 #endif /* KEEP_XKB_LOCK_STATUS */
737 {"NormalCursor", "(builtin, left_ptr)", (void *)WCUR_ROOT
,
738 NULL
, getCursor
, setCursor
, NULL
, NULL
},
739 {"ArrowCursor", "(builtin, top_left_arrow)", (void *)WCUR_ARROW
,
740 NULL
, getCursor
, setCursor
, NULL
, NULL
},
741 {"MoveCursor", "(builtin, fleur)", (void *)WCUR_MOVE
,
742 NULL
, getCursor
, setCursor
, NULL
, NULL
},
743 {"ResizeCursor", "(builtin, sizing)", (void *)WCUR_RESIZE
,
744 NULL
, getCursor
, setCursor
, NULL
, NULL
},
745 {"TopLeftResizeCursor", "(builtin, top_left_corner)", (void *)WCUR_TOPLEFTRESIZE
,
746 NULL
, getCursor
, setCursor
, NULL
, NULL
},
747 {"TopRightResizeCursor", "(builtin, top_right_corner)", (void *)WCUR_TOPRIGHTRESIZE
,
748 NULL
, getCursor
, setCursor
, NULL
, NULL
},
749 {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)", (void *)WCUR_BOTTOMLEFTRESIZE
,
750 NULL
, getCursor
, setCursor
, NULL
, NULL
},
751 {"BottomRightResizeCursor", "(builtin, bottom_right_corner)", (void *)WCUR_BOTTOMRIGHTRESIZE
,
752 NULL
, getCursor
, setCursor
, NULL
, NULL
},
753 {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)", (void *)WCUR_VERTICALRESIZE
,
754 NULL
, getCursor
, setCursor
, NULL
, NULL
},
755 {"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)", (void *)WCUR_HORIZONRESIZE
,
756 NULL
, getCursor
, setCursor
, NULL
, NULL
},
757 {"WaitCursor", "(builtin, watch)", (void *)WCUR_WAIT
,
758 NULL
, getCursor
, setCursor
, NULL
, NULL
},
759 {"QuestionCursor", "(builtin, question_arrow)", (void *)WCUR_QUESTION
,
760 NULL
, getCursor
, setCursor
, NULL
, NULL
},
761 {"TextCursor", "(builtin, xterm)", (void *)WCUR_TEXT
,
762 NULL
, getCursor
, setCursor
, NULL
, NULL
},
763 {"SelectCursor", "(builtin, cross)", (void *)WCUR_SELECT
,
764 NULL
, getCursor
, setCursor
, NULL
, NULL
},
765 {"DialogHistoryLines", "500", NULL
,
766 &wPreferences
.history_lines
, getInt
, NULL
, NULL
, NULL
},
767 {"CycleActiveHeadOnly", "NO", NULL
,
768 &wPreferences
.cycle_active_head_only
, getBool
, NULL
, NULL
, NULL
},
769 {"CycleIgnoreMinimized", "NO", NULL
,
770 &wPreferences
.cycle_ignore_minimized
, getBool
, NULL
, NULL
, NULL
}
773 static void initDefaults(void)
776 WDefaultEntry
*entry
;
778 WMPLSetCaseSensitive(False
);
780 for (i
= 0; i
< sizeof(optionList
) / sizeof(optionList
[0]); i
++) {
781 entry
= &optionList
[i
];
783 entry
->plkey
= WMCreatePLString(entry
->key
);
784 if (entry
->default_value
)
785 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
787 entry
->plvalue
= NULL
;
790 for (i
= 0; i
< sizeof(staticOptionList
) / sizeof(staticOptionList
[0]); i
++) {
791 entry
= &staticOptionList
[i
];
793 entry
->plkey
= WMCreatePLString(entry
->key
);
794 if (entry
->default_value
)
795 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
797 entry
->plvalue
= NULL
;
801 static WMPropList
*readGlobalDomain(const char *domainName
, Bool requireDictionary
)
803 WMPropList
*globalDict
= NULL
;
807 snprintf(path
, sizeof(path
), "%s/%s/%s", SYSCONFDIR
, GLOBAL_DEFAULTS_SUBDIR
, domainName
);
808 if (stat(path
, &stbuf
) >= 0) {
809 globalDict
= WMReadPropListFromFile(path
);
810 if (globalDict
&& requireDictionary
&& !WMIsPLDictionary(globalDict
)) {
811 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"), domainName
, path
);
812 WMReleasePropList(globalDict
);
814 } else if (!globalDict
) {
815 wwarning(_("could not load domain %s from global defaults database"), domainName
);
822 #if defined(GLOBAL_PREAMBLE_MENU_FILE) || defined(GLOBAL_EPILOGUE_MENU_FILE)
823 static void prependMenu(WMPropList
* destarr
, WMPropList
* array
)
828 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
829 item
= WMGetFromPLArray(array
, i
);
831 WMInsertInPLArray(destarr
, i
+ 1, item
);
835 static void appendMenu(WMPropList
* destarr
, WMPropList
* array
)
840 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
841 item
= WMGetFromPLArray(array
, i
);
843 WMAddToPLArray(destarr
, item
);
848 void wDefaultsMergeGlobalMenus(WDDomain
* menuDomain
)
850 WMPropList
*menu
= menuDomain
->dictionary
;
853 if (!menu
|| !WMIsPLArray(menu
))
856 #ifdef GLOBAL_PREAMBLE_MENU_FILE
857 submenu
= WMReadPropListFromFile(SYSCONFDIR
"/" GLOBAL_DEFAULTS_SUBDIR
"/" GLOBAL_PREAMBLE_MENU_FILE
);
859 if (submenu
&& !WMIsPLArray(submenu
)) {
860 wwarning(_("invalid global menu file %s"), GLOBAL_PREAMBLE_MENU_FILE
);
861 WMReleasePropList(submenu
);
865 prependMenu(menu
, submenu
);
866 WMReleasePropList(submenu
);
870 #ifdef GLOBAL_EPILOGUE_MENU_FILE
871 submenu
= WMReadPropListFromFile(SYSCONFDIR
"/" GLOBAL_DEFAULTS_SUBDIR
"/" GLOBAL_EPILOGUE_MENU_FILE
);
873 if (submenu
&& !WMIsPLArray(submenu
)) {
874 wwarning(_("invalid global menu file %s"), GLOBAL_EPILOGUE_MENU_FILE
);
875 WMReleasePropList(submenu
);
879 appendMenu(menu
, submenu
);
880 WMReleasePropList(submenu
);
884 menuDomain
->dictionary
= menu
;
887 WDDomain
*wDefaultsInitDomain(const char *domain
, Bool requireDictionary
)
891 static int inited
= 0;
892 const char *the_path
;
893 WMPropList
*shared_dict
= NULL
;
900 db
= wmalloc(sizeof(WDDomain
));
901 db
->domain_name
= domain
;
902 db
->path
= wdefaultspathfordomain(domain
);
905 if (the_path
&& stat(the_path
, &stbuf
) >= 0) {
906 db
->dictionary
= WMReadPropListFromFile(the_path
);
907 if (db
->dictionary
) {
908 if (requireDictionary
&& !WMIsPLDictionary(db
->dictionary
)) {
909 WMReleasePropList(db
->dictionary
);
910 db
->dictionary
= NULL
;
911 wwarning(_("Domain %s (%s) of defaults database is corrupted!"), domain
, the_path
);
913 db
->timestamp
= stbuf
.st_mtime
;
915 wwarning(_("could not load domain %s from user defaults database"), domain
);
919 /* global system dictionary */
920 shared_dict
= readGlobalDomain(domain
, requireDictionary
);
922 if (shared_dict
&& db
->dictionary
&& WMIsPLDictionary(shared_dict
) &&
923 WMIsPLDictionary(db
->dictionary
)) {
924 WMMergePLDictionaries(shared_dict
, db
->dictionary
, True
);
925 WMReleasePropList(db
->dictionary
);
926 db
->dictionary
= shared_dict
;
927 if (stbuf
.st_mtime
> db
->timestamp
)
928 db
->timestamp
= stbuf
.st_mtime
;
929 } else if (!db
->dictionary
) {
930 db
->dictionary
= shared_dict
;
931 if (stbuf
.st_mtime
> db
->timestamp
)
932 db
->timestamp
= stbuf
.st_mtime
;
938 void wReadStaticDefaults(WMPropList
* dict
)
941 WDefaultEntry
*entry
;
945 for (i
= 0; i
< sizeof(staticOptionList
) / sizeof(staticOptionList
[0]); i
++) {
946 entry
= &staticOptionList
[i
];
949 plvalue
= WMGetFromPLDictionary(dict
, entry
->plkey
);
953 /* no default in the DB. Use builtin default */
955 plvalue
= entry
->plvalue
;
959 (*entry
->convert
) (NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
961 (*entry
->update
) (NULL
, entry
, tdata
, entry
->extra_data
);
966 void wDefaultsCheckDomains(void* arg
)
970 WMPropList
*shared_dict
= NULL
;
974 if (stat(WDWindowMaker
->path
, &stbuf
) >= 0 && WDWindowMaker
->timestamp
< stbuf
.st_mtime
) {
975 WDWindowMaker
->timestamp
= stbuf
.st_mtime
;
977 /* Global dictionary */
978 shared_dict
= readGlobalDomain("WindowMaker", True
);
980 /* User dictionary */
981 dict
= WMReadPropListFromFile(WDWindowMaker
->path
);
984 if (!WMIsPLDictionary(dict
)) {
985 WMReleasePropList(dict
);
987 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
988 "WindowMaker", WDWindowMaker
->path
);
991 WMMergePLDictionaries(shared_dict
, dict
, True
);
992 WMReleasePropList(dict
);
997 for (i
= 0; i
< w_global
.screen_count
; i
++) {
998 scr
= wScreenWithNumber(i
);
1000 wReadDefaults(scr
, dict
);
1003 if (WDWindowMaker
->dictionary
)
1004 WMReleasePropList(WDWindowMaker
->dictionary
);
1006 WDWindowMaker
->dictionary
= dict
;
1009 wwarning(_("could not load domain %s from user defaults database"), "WindowMaker");
1013 WMReleasePropList(shared_dict
);
1017 if (stat(WDWindowAttributes
->path
, &stbuf
) >= 0 && WDWindowAttributes
->timestamp
< stbuf
.st_mtime
) {
1018 /* global dictionary */
1019 shared_dict
= readGlobalDomain("WMWindowAttributes", True
);
1020 /* user dictionary */
1021 dict
= WMReadPropListFromFile(WDWindowAttributes
->path
);
1023 if (!WMIsPLDictionary(dict
)) {
1024 WMReleasePropList(dict
);
1026 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1027 "WMWindowAttributes", WDWindowAttributes
->path
);
1030 WMMergePLDictionaries(shared_dict
, dict
, True
);
1031 WMReleasePropList(dict
);
1036 if (WDWindowAttributes
->dictionary
)
1037 WMReleasePropList(WDWindowAttributes
->dictionary
);
1039 WDWindowAttributes
->dictionary
= dict
;
1040 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1041 scr
= wScreenWithNumber(i
);
1043 wDefaultUpdateIcons(scr
);
1045 /* Update the panel image if changed */
1046 /* Don't worry. If the image is the same these
1047 * functions will have no performance impact. */
1048 create_logo_image(scr
);
1053 wwarning(_("could not load domain %s from user defaults database"), "WMWindowAttributes");
1056 WDWindowAttributes
->timestamp
= stbuf
.st_mtime
;
1058 WMReleasePropList(shared_dict
);
1061 if (stat(WDRootMenu
->path
, &stbuf
) >= 0 && WDRootMenu
->timestamp
< stbuf
.st_mtime
) {
1062 dict
= WMReadPropListFromFile(WDRootMenu
->path
);
1064 if (!WMIsPLArray(dict
) && !WMIsPLString(dict
)) {
1065 WMReleasePropList(dict
);
1067 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1068 "WMRootMenu", WDRootMenu
->path
);
1070 if (WDRootMenu
->dictionary
)
1071 WMReleasePropList(WDRootMenu
->dictionary
);
1073 WDRootMenu
->dictionary
= dict
;
1074 wDefaultsMergeGlobalMenus(WDRootMenu
);
1077 wwarning(_("could not load domain %s from user defaults database"), "WMRootMenu");
1079 WDRootMenu
->timestamp
= stbuf
.st_mtime
;
1081 #ifndef HAVE_INOTIFY
1083 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, arg
);
1087 void wReadDefaults(WScreen
* scr
, WMPropList
* new_dict
)
1089 WMPropList
*plvalue
, *old_value
;
1090 WDefaultEntry
*entry
;
1092 int update_workspace_back
= 0; /* kluge :/ */
1093 unsigned int needs_refresh
;
1095 WMPropList
*old_dict
= (WDWindowMaker
->dictionary
!= new_dict
? WDWindowMaker
->dictionary
: NULL
);
1099 for (i
= 0; i
< sizeof(optionList
) / sizeof(optionList
[0]); i
++) {
1100 entry
= &optionList
[i
];
1103 plvalue
= WMGetFromPLDictionary(new_dict
, entry
->plkey
);
1110 old_value
= WMGetFromPLDictionary(old_dict
, entry
->plkey
);
1112 if (!plvalue
&& !old_value
) {
1113 /* no default in the DB. Use builtin default */
1114 plvalue
= entry
->plvalue
;
1115 if (plvalue
&& new_dict
)
1116 WMPutInPLDictionary(new_dict
, entry
->plkey
, plvalue
);
1118 } else if (!plvalue
) {
1119 /* value was deleted from DB. Keep current value */
1121 } else if (!old_value
) {
1122 /* set value for the 1st time */
1123 } else if (!WMIsPropListEqualTo(plvalue
, old_value
)) {
1124 /* value has changed */
1126 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1127 && update_workspace_back
&& scr
->flags
.backimage_helper_launched
) {
1129 /* value was not changed since last time */
1136 if ((*entry
->convert
) (scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1138 * If the WorkspaceSpecificBack data has been changed
1139 * so that the helper will be launched now, we must be
1140 * sure to send the default background texture config
1143 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0 &&
1144 !scr
->flags
.backimage_helper_launched
)
1145 update_workspace_back
= 1;
1148 needs_refresh
|= (*entry
->update
) (scr
, entry
, tdata
, entry
->extra_data
);
1154 if (needs_refresh
!= 0 && !scr
->flags
.startup
) {
1158 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1159 foo
|= WTextureSettings
;
1160 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1161 foo
|= WFontSettings
;
1162 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1163 foo
|= WColorSettings
;
1165 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1166 (void *)(uintptr_t) foo
);
1169 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1170 foo
|= WTextureSettings
;
1171 if (needs_refresh
& REFRESH_MENU_FONT
)
1172 foo
|= WFontSettings
;
1173 if (needs_refresh
& REFRESH_MENU_COLOR
)
1174 foo
|= WColorSettings
;
1176 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1179 if (needs_refresh
& REFRESH_WINDOW_FONT
)
1180 foo
|= WFontSettings
;
1181 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
)
1182 foo
|= WTextureSettings
;
1183 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
)
1184 foo
|= WColorSettings
;
1186 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1188 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1190 if (needs_refresh
& REFRESH_ICON_FONT
)
1191 foo
|= WFontSettings
;
1192 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
)
1193 foo
|= WTextureSettings
;
1194 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
)
1195 foo
|= WTextureSettings
;
1197 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1198 (void *)(uintptr_t) foo
);
1200 if (needs_refresh
& REFRESH_ICON_TILE
)
1201 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1203 if (needs_refresh
& REFRESH_WORKSPACE_MENU
) {
1204 if (w_global
.workspace
.menu
)
1205 wWorkspaceMenuUpdate(w_global
.workspace
.menu
);
1206 if (w_global
.clip
.ws_menu
)
1207 wWorkspaceMenuUpdate(w_global
.clip
.ws_menu
);
1208 if (w_global
.workspace
.submenu
)
1209 w_global
.workspace
.submenu
->flags
.realized
= 0;
1210 if (w_global
.clip
.submenu
)
1211 w_global
.clip
.submenu
->flags
.realized
= 0;
1216 void wDefaultUpdateIcons(WScreen
*scr
)
1218 WAppIcon
*aicon
= w_global
.app_icon_list
;
1220 WWindow
*wwin
= scr
->focused_window
;
1223 /* Get the application icon, default included */
1224 wIconChangeImageFile(aicon
->icon
, NULL
);
1225 wAppIconPaint(aicon
);
1226 aicon
= aicon
->next
;
1229 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
)
1232 for (dc
= scr
->drawers
; dc
!= NULL
; dc
= dc
->next
)
1233 wDrawerIconPaint(dc
->adrawer
->icon_array
[0]);
1236 if (wwin
->icon
&& wwin
->flags
.miniaturized
)
1237 wIconChangeImageFile(wwin
->icon
, NULL
);
1242 /* --------------------------- Local ----------------------- */
1244 #define GET_STRING_OR_DEFAULT(x, var) if (!WMIsPLString(value)) { \
1245 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1247 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1248 var = entry->default_value;\
1249 } else var = WMGetFromPLString(value)\
1252 static int string2index(WMPropList *key, WMPropList *val, const char *def, WOptionEnumeration * values)
1255 WOptionEnumeration
*v
;
1256 char buffer
[TOTAL_VALUES_LENGTH
];
1258 if (WMIsPLString(val
) && (str
= WMGetFromPLString(val
))) {
1259 for (v
= values
; v
->string
!= NULL
; v
++) {
1260 if (strcasecmp(v
->string
, str
) == 0)
1266 for (v
= values
; v
->string
!= NULL
; v
++) {
1269 strcat(buffer
, ", ");
1270 snprintf(buffer
+strlen(buffer
),
1271 sizeof(buffer
)-strlen(buffer
)-1, "\"%s\"", v
->string
);
1274 wwarning(_("wrong option value for key \"%s\"; got \"%s\", should be one of %s."),
1275 WMGetFromPLString(key
),
1276 WMIsPLString(val
) ? WMGetFromPLString(val
) : "(unknown)",
1280 return string2index(key
, val
, NULL
, values
);
1287 * value - is the value in the defaults DB
1288 * addr - is the address to store the data
1289 * ret - is the address to store a pointer to a temporary buffer. ret
1290 * must not be freed and is used by the set functions
1292 static int getBool(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1296 int second_pass
= 0;
1298 GET_STRING_OR_DEFAULT("Boolean", val
);
1301 if ((val
[1] == '\0' && (val
[0] == 'y' || val
[0] == 'Y'))
1302 || strcasecmp(val
, "YES") == 0) {
1305 } else if ((val
[1] == '\0' && (val
[0] == 'n' || val
[0] == 'N'))
1306 || strcasecmp(val
, "NO") == 0) {
1310 if (sscanf(val
, "%i", &i
) == 1) {
1316 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""), val
, entry
->key
);
1317 if (second_pass
== 0) {
1318 val
= WMGetFromPLString(entry
->plvalue
);
1320 wwarning(_("using default \"%s\" instead"), val
);
1330 *(char *)addr
= data
;
1335 static int getInt(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1340 GET_STRING_OR_DEFAULT("Integer", val
);
1342 if (sscanf(val
, "%i", &data
) != 1) {
1343 wwarning(_("can't convert \"%s\" to integer for key \"%s\""), val
, entry
->key
);
1344 val
= WMGetFromPLString(entry
->plvalue
);
1345 wwarning(_("using default \"%s\" instead"), val
);
1346 if (sscanf(val
, "%i", &data
) != 1) {
1354 *(int *)addr
= data
;
1359 static int getCoord(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1362 char *val_x
, *val_y
;
1363 int nelem
, changed
= 0;
1364 WMPropList
*elem_x
, *elem_y
;
1367 if (!WMIsPLArray(value
)) {
1368 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Coordinate");
1370 value
= entry
->plvalue
;
1372 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1378 nelem
= WMGetPropListItemCount(value
);
1380 wwarning(_("Incorrect number of elements in array for key \"%s\"."), entry
->key
);
1382 value
= entry
->plvalue
;
1384 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1390 elem_x
= WMGetFromPLArray(value
, 0);
1391 elem_y
= WMGetFromPLArray(value
, 1);
1393 if (!elem_x
|| !elem_y
|| !WMIsPLString(elem_x
) || !WMIsPLString(elem_y
)) {
1394 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."), entry
->key
);
1396 value
= entry
->plvalue
;
1398 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1404 val_x
= WMGetFromPLString(elem_x
);
1405 val_y
= WMGetFromPLString(elem_y
);
1407 if (sscanf(val_x
, "%i", &data
.x
) != 1 || sscanf(val_y
, "%i", &data
.y
) != 1) {
1408 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1410 value
= entry
->plvalue
;
1412 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1420 else if (data
.x
> scr
->scr_width
/ 3)
1421 data
.x
= scr
->scr_width
/ 3;
1424 else if (data
.y
> scr
->scr_height
/ 3)
1425 data
.y
= scr
->scr_height
/ 3;
1430 *(WCoord
*) addr
= data
;
1435 static int getPropList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1437 WMRetainPropList(value
);
1444 static int getPathList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1453 if (!WMIsPLArray(value
)) {
1454 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "an array of paths");
1456 value
= entry
->plvalue
;
1458 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1465 count
= WMGetPropListItemCount(value
);
1468 value
= entry
->plvalue
;
1470 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1477 for (i
= 0; i
< count
; i
++) {
1478 d
= WMGetFromPLArray(value
, i
);
1479 if (!d
|| !WMIsPLString(d
)) {
1483 len
+= strlen(WMGetFromPLString(d
)) + 1;
1486 ptr
= data
= wmalloc(len
+ 1);
1488 for (i
= 0; i
< count
; i
++) {
1489 d
= WMGetFromPLArray(value
, i
);
1490 if (!d
|| !WMIsPLString(d
)) {
1493 strcpy(ptr
, WMGetFromPLString(d
));
1494 ptr
+= strlen(WMGetFromPLString(d
));
1501 if (*(char **)addr
!= NULL
) {
1502 wfree(*(char **)addr
);
1504 *(char **)addr
= data
;
1509 static int getEnum(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1511 static signed char data
;
1513 data
= string2index(entry
->plkey
, value
, entry
->default_value
, (WOptionEnumeration
*) entry
->extra_data
);
1520 *(signed char *)addr
= data
;
1527 * (hgradient <color> <color>)
1528 * (vgradient <color> <color>)
1529 * (dgradient <color> <color>)
1530 * (mhgradient <color> <color> ...)
1531 * (mvgradient <color> <color> ...)
1532 * (mdgradient <color> <color> ...)
1533 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1534 * (tpixmap <file> <color>)
1535 * (spixmap <file> <color>)
1536 * (cpixmap <file> <color>)
1537 * (thgradient <file> <opaqueness> <color> <color>)
1538 * (tvgradient <file> <opaqueness> <color> <color>)
1539 * (tdgradient <file> <opaqueness> <color> <color>)
1540 * (function <lib> <function> ...)
1543 static WTexture
*parse_texture(WScreen
* scr
, WMPropList
* pl
)
1548 WTexture
*texture
= NULL
;
1550 nelem
= WMGetPropListItemCount(pl
);
1554 elem
= WMGetFromPLArray(pl
, 0);
1555 if (!elem
|| !WMIsPLString(elem
))
1557 val
= WMGetFromPLString(elem
);
1559 if (strcasecmp(val
, "solid") == 0) {
1567 elem
= WMGetFromPLArray(pl
, 1);
1568 if (!elem
|| !WMIsPLString(elem
))
1570 val
= WMGetFromPLString(elem
);
1572 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1573 wwarning(_("\"%s\" is not a valid color name"), val
);
1577 texture
= (WTexture
*) wTextureMakeSolid(scr
, &color
);
1578 } else if (strcasecmp(val
, "dgradient") == 0
1579 || strcasecmp(val
, "vgradient") == 0 || strcasecmp(val
, "hgradient") == 0) {
1580 RColor color1
, color2
;
1585 wwarning(_("bad number of arguments in gradient specification"));
1589 if (val
[0] == 'd' || val
[0] == 'D')
1590 type
= WTEX_DGRADIENT
;
1591 else if (val
[0] == 'h' || val
[0] == 'H')
1592 type
= WTEX_HGRADIENT
;
1594 type
= WTEX_VGRADIENT
;
1596 /* get from color */
1597 elem
= WMGetFromPLArray(pl
, 1);
1598 if (!elem
|| !WMIsPLString(elem
))
1600 val
= WMGetFromPLString(elem
);
1602 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1603 wwarning(_("\"%s\" is not a valid color name"), val
);
1607 color1
.red
= xcolor
.red
>> 8;
1608 color1
.green
= xcolor
.green
>> 8;
1609 color1
.blue
= xcolor
.blue
>> 8;
1612 elem
= WMGetFromPLArray(pl
, 2);
1613 if (!elem
|| !WMIsPLString(elem
)) {
1616 val
= WMGetFromPLString(elem
);
1618 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1619 wwarning(_("\"%s\" is not a valid color name"), val
);
1623 color2
.red
= xcolor
.red
>> 8;
1624 color2
.green
= xcolor
.green
>> 8;
1625 color2
.blue
= xcolor
.blue
>> 8;
1627 texture
= (WTexture
*) wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1629 } else if (strcasecmp(val
, "igradient") == 0) {
1630 RColor colors1
[2], colors2
[2];
1636 wwarning(_("bad number of arguments in gradient specification"));
1640 /* get from color */
1641 for (i
= 0; i
< 2; i
++) {
1642 elem
= WMGetFromPLArray(pl
, 1 + i
);
1643 if (!elem
|| !WMIsPLString(elem
))
1645 val
= WMGetFromPLString(elem
);
1647 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1648 wwarning(_("\"%s\" is not a valid color name"), val
);
1651 colors1
[i
].alpha
= 255;
1652 colors1
[i
].red
= xcolor
.red
>> 8;
1653 colors1
[i
].green
= xcolor
.green
>> 8;
1654 colors1
[i
].blue
= xcolor
.blue
>> 8;
1656 elem
= WMGetFromPLArray(pl
, 3);
1657 if (!elem
|| !WMIsPLString(elem
))
1659 val
= WMGetFromPLString(elem
);
1662 /* get from color */
1663 for (i
= 0; i
< 2; i
++) {
1664 elem
= WMGetFromPLArray(pl
, 4 + i
);
1665 if (!elem
|| !WMIsPLString(elem
))
1667 val
= WMGetFromPLString(elem
);
1669 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1670 wwarning(_("\"%s\" is not a valid color name"), val
);
1673 colors2
[i
].alpha
= 255;
1674 colors2
[i
].red
= xcolor
.red
>> 8;
1675 colors2
[i
].green
= xcolor
.green
>> 8;
1676 colors2
[i
].blue
= xcolor
.blue
>> 8;
1678 elem
= WMGetFromPLArray(pl
, 6);
1679 if (!elem
|| !WMIsPLString(elem
))
1681 val
= WMGetFromPLString(elem
);
1684 texture
= (WTexture
*) wTextureMakeIGradient(scr
, th1
, colors1
, th2
, colors2
);
1686 } else if (strcasecmp(val
, "mhgradient") == 0
1687 || strcasecmp(val
, "mvgradient") == 0 || strcasecmp(val
, "mdgradient") == 0) {
1694 wwarning(_("too few arguments in multicolor gradient specification"));
1698 if (val
[1] == 'h' || val
[1] == 'H')
1699 type
= WTEX_MHGRADIENT
;
1700 else if (val
[1] == 'v' || val
[1] == 'V')
1701 type
= WTEX_MVGRADIENT
;
1703 type
= WTEX_MDGRADIENT
;
1707 colors
= wmalloc(sizeof(RColor
*) * (count
+ 1));
1709 for (i
= 0; i
< count
; i
++) {
1710 elem
= WMGetFromPLArray(pl
, i
+ 1);
1711 if (!elem
|| !WMIsPLString(elem
)) {
1712 for (--i
; i
>= 0; --i
) {
1718 val
= WMGetFromPLString(elem
);
1720 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1721 wwarning(_("\"%s\" is not a valid color name"), val
);
1722 for (--i
; i
>= 0; --i
) {
1728 colors
[i
] = wmalloc(sizeof(RColor
));
1729 colors
[i
]->red
= color
.red
>> 8;
1730 colors
[i
]->green
= color
.green
>> 8;
1731 colors
[i
]->blue
= color
.blue
>> 8;
1736 texture
= (WTexture
*) wTextureMakeMGradient(scr
, type
, colors
);
1737 } else if (strcasecmp(val
, "spixmap") == 0 ||
1738 strcasecmp(val
, "cpixmap") == 0 || strcasecmp(val
, "tpixmap") == 0) {
1745 if (val
[0] == 's' || val
[0] == 'S')
1747 else if (val
[0] == 'c' || val
[0] == 'C')
1753 elem
= WMGetFromPLArray(pl
, 2);
1754 if (!elem
|| !WMIsPLString(elem
)) {
1757 val
= WMGetFromPLString(elem
);
1759 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1760 wwarning(_("\"%s\" is not a valid color name"), val
);
1765 elem
= WMGetFromPLArray(pl
, 1);
1766 if (!elem
|| !WMIsPLString(elem
))
1768 val
= WMGetFromPLString(elem
);
1770 texture
= (WTexture
*) wTextureMakePixmap(scr
, type
, val
, &color
);
1771 } else if (strcasecmp(val
, "thgradient") == 0
1772 || strcasecmp(val
, "tvgradient") == 0 || strcasecmp(val
, "tdgradient") == 0) {
1773 RColor color1
, color2
;
1778 if (val
[1] == 'h' || val
[1] == 'H')
1779 style
= WTEX_THGRADIENT
;
1780 else if (val
[1] == 'v' || val
[1] == 'V')
1781 style
= WTEX_TVGRADIENT
;
1783 style
= WTEX_TDGRADIENT
;
1786 wwarning(_("bad number of arguments in textured gradient specification"));
1790 /* get from color */
1791 elem
= WMGetFromPLArray(pl
, 3);
1792 if (!elem
|| !WMIsPLString(elem
))
1794 val
= WMGetFromPLString(elem
);
1796 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1797 wwarning(_("\"%s\" is not a valid color name"), val
);
1801 color1
.red
= xcolor
.red
>> 8;
1802 color1
.green
= xcolor
.green
>> 8;
1803 color1
.blue
= xcolor
.blue
>> 8;
1806 elem
= WMGetFromPLArray(pl
, 4);
1807 if (!elem
|| !WMIsPLString(elem
)) {
1810 val
= WMGetFromPLString(elem
);
1812 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1813 wwarning(_("\"%s\" is not a valid color name"), val
);
1817 color2
.red
= xcolor
.red
>> 8;
1818 color2
.green
= xcolor
.green
>> 8;
1819 color2
.blue
= xcolor
.blue
>> 8;
1822 elem
= WMGetFromPLArray(pl
, 2);
1823 if (!elem
|| !WMIsPLString(elem
))
1826 val
= WMGetFromPLString(elem
);
1828 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
1829 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
1834 elem
= WMGetFromPLArray(pl
, 1);
1835 if (!elem
|| !WMIsPLString(elem
))
1837 val
= WMGetFromPLString(elem
);
1839 texture
= (WTexture
*) wTextureMakeTGradient(scr
, style
, &color1
, &color2
, val
, opacity
);
1840 } else if (strcasecmp(val
, "function") == 0) {
1841 /* Leave this in to handle the unlikely case of
1842 * someone actually having function textures configured */
1843 wwarning("function texture support has been removed");
1846 wwarning(_("invalid texture type %s"), val
);
1852 static int getTexture(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1854 static WTexture
*texture
;
1858 if (!WMIsPLArray(value
)) {
1859 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Texture");
1861 value
= entry
->plvalue
;
1863 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1869 if (strcmp(entry
->key
, "WidgetColor") == 0 && !changed
) {
1872 pl
= WMGetFromPLArray(value
, 0);
1873 if (!pl
|| !WMIsPLString(pl
) || !WMGetFromPLString(pl
)
1874 || strcasecmp(WMGetFromPLString(pl
), "solid") != 0) {
1875 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1876 entry
->key
, "Solid Texture");
1878 value
= entry
->plvalue
;
1880 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1885 texture
= parse_texture(scr
, value
);
1888 wwarning(_("Error in texture specification for key \"%s\""), entry
->key
);
1890 value
= entry
->plvalue
;
1892 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1902 *(WTexture
**) addr
= texture
;
1907 static int getWSBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1915 if (!WMIsPLArray(value
)) {
1916 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1917 "WorkspaceBack", "Texture or None");
1919 value
= entry
->plvalue
;
1921 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1927 /* only do basic error checking and verify for None texture */
1929 nelem
= WMGetPropListItemCount(value
);
1931 elem
= WMGetFromPLArray(value
, 0);
1932 if (!elem
|| !WMIsPLString(elem
)) {
1933 wwarning(_("Wrong type for workspace background. Should be a texture type."));
1935 value
= entry
->plvalue
;
1937 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1942 val
= WMGetFromPLString(elem
);
1944 if (strcasecmp(val
, "None") == 0)
1947 *ret
= WMRetainPropList(value
);
1953 getWSSpecificBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1960 if (!WMIsPLArray(value
)) {
1961 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1962 "WorkspaceSpecificBack", "an array of textures");
1964 value
= entry
->plvalue
;
1966 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1972 /* only do basic error checking and verify for None texture */
1974 nelem
= WMGetPropListItemCount(value
);
1977 elem
= WMGetFromPLArray(value
, nelem
);
1978 if (!elem
|| !WMIsPLArray(elem
)) {
1979 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
1985 *ret
= WMRetainPropList(value
);
1989 * Kluge to force wmsetbg helper to set the default background.
1990 * If the WorkspaceSpecificBack is changed once wmaker has started,
1991 * the WorkspaceBack won't be sent to the helper, unless the user
1992 * changes it's value too. So, we must force this by removing the
1993 * value from the defaults DB.
1995 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
1996 WMPropList
*key
= WMCreatePLString("WorkspaceBack");
1998 WMRemoveFromPLDictionary(WDWindowMaker
->dictionary
, key
);
2000 WMReleasePropList(key
);
2006 static int getFont(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2008 static WMFont
*font
;
2011 GET_STRING_OR_DEFAULT("Font", val
);
2013 font
= WMCreateFont(scr
->wmscreen
, val
);
2015 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2018 wfatal(_("could not load any usable font!!!"));
2025 /* can't assign font value outside update function */
2026 wassertrv(addr
== NULL
, True
);
2031 static int getColor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2033 static XColor color
;
2035 int second_pass
= 0;
2037 GET_STRING_OR_DEFAULT("Color", val
);
2040 if (!wGetColor(scr
, val
, &color
)) {
2041 wwarning(_("could not get color for key \"%s\""), entry
->key
);
2042 if (second_pass
== 0) {
2043 val
= WMGetFromPLString(entry
->plvalue
);
2045 wwarning(_("using default \"%s\" instead"), val
);
2054 assert(addr
== NULL
);
2057 *(unsigned long*)addr = pixel;
2063 static int getKeybind(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2065 static WShortKey shortcut
;
2069 char buf
[MAX_SHORTCUT_LENGTH
], *b
;
2071 GET_STRING_OR_DEFAULT("Key spec", val
);
2073 if (!val
|| strcasecmp(val
, "NONE") == 0) {
2074 shortcut
.keycode
= 0;
2075 shortcut
.modifier
= 0;
2081 wstrlcpy(buf
, val
, MAX_SHORTCUT_LENGTH
);
2086 shortcut
.modifier
= 0;
2087 while ((k
= strchr(b
, '+')) != NULL
) {
2091 mod
= wXModifierFromKey(b
);
2093 wwarning(_("%s: invalid key modifier \"%s\""), entry
->key
, b
);
2096 shortcut
.modifier
|= mod
;
2102 ksym
= XStringToKeysym(b
);
2104 if (ksym
== NoSymbol
) {
2105 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
, val
);
2109 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2110 if (shortcut
.keycode
== 0) {
2111 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2121 static int getModMask(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2126 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2131 mask
= wXModifierFromKey(str
);
2133 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2139 *(int *)addr
= mask
;
2147 # include <X11/cursorfont.h>
2153 #define CURSOR_ID_NONE (XC_num_glyphs)
2155 static const WCursorLookup cursor_table
[] = {
2156 {"X_cursor", XC_X_cursor
},
2157 {"arrow", XC_arrow
},
2158 {"based_arrow_down", XC_based_arrow_down
},
2159 {"based_arrow_up", XC_based_arrow_up
},
2161 {"bogosity", XC_bogosity
},
2162 {"bottom_left_corner", XC_bottom_left_corner
},
2163 {"bottom_right_corner", XC_bottom_right_corner
},
2164 {"bottom_side", XC_bottom_side
},
2165 {"bottom_tee", XC_bottom_tee
},
2166 {"box_spiral", XC_box_spiral
},
2167 {"center_ptr", XC_center_ptr
},
2168 {"circle", XC_circle
},
2169 {"clock", XC_clock
},
2170 {"coffee_mug", XC_coffee_mug
},
2171 {"cross", XC_cross
},
2172 {"cross_reverse", XC_cross_reverse
},
2173 {"crosshair", XC_crosshair
},
2174 {"diamond_cross", XC_diamond_cross
},
2176 {"dotbox", XC_dotbox
},
2177 {"double_arrow", XC_double_arrow
},
2178 {"draft_large", XC_draft_large
},
2179 {"draft_small", XC_draft_small
},
2180 {"draped_box", XC_draped_box
},
2181 {"exchange", XC_exchange
},
2182 {"fleur", XC_fleur
},
2183 {"gobbler", XC_gobbler
},
2184 {"gumby", XC_gumby
},
2185 {"hand1", XC_hand1
},
2186 {"hand2", XC_hand2
},
2187 {"heart", XC_heart
},
2189 {"iron_cross", XC_iron_cross
},
2190 {"left_ptr", XC_left_ptr
},
2191 {"left_side", XC_left_side
},
2192 {"left_tee", XC_left_tee
},
2193 {"leftbutton", XC_leftbutton
},
2194 {"ll_angle", XC_ll_angle
},
2195 {"lr_angle", XC_lr_angle
},
2197 {"middlebutton", XC_middlebutton
},
2198 {"mouse", XC_mouse
},
2199 {"pencil", XC_pencil
},
2200 {"pirate", XC_pirate
},
2202 {"question_arrow", XC_question_arrow
},
2203 {"right_ptr", XC_right_ptr
},
2204 {"right_side", XC_right_side
},
2205 {"right_tee", XC_right_tee
},
2206 {"rightbutton", XC_rightbutton
},
2207 {"rtl_logo", XC_rtl_logo
},
2208 {"sailboat", XC_sailboat
},
2209 {"sb_down_arrow", XC_sb_down_arrow
},
2210 {"sb_h_double_arrow", XC_sb_h_double_arrow
},
2211 {"sb_left_arrow", XC_sb_left_arrow
},
2212 {"sb_right_arrow", XC_sb_right_arrow
},
2213 {"sb_up_arrow", XC_sb_up_arrow
},
2214 {"sb_v_double_arrow", XC_sb_v_double_arrow
},
2215 {"shuttle", XC_shuttle
},
2216 {"sizing", XC_sizing
},
2217 {"spider", XC_spider
},
2218 {"spraycan", XC_spraycan
},
2220 {"target", XC_target
},
2221 {"tcross", XC_tcross
},
2222 {"top_left_arrow", XC_top_left_arrow
},
2223 {"top_left_corner", XC_top_left_corner
},
2224 {"top_right_corner", XC_top_right_corner
},
2225 {"top_side", XC_top_side
},
2226 {"top_tee", XC_top_tee
},
2228 {"ul_angle", XC_ul_angle
},
2229 {"umbrella", XC_umbrella
},
2230 {"ur_angle", XC_ur_angle
},
2231 {"watch", XC_watch
},
2232 {"xterm", XC_xterm
},
2233 {NULL
, CURSOR_ID_NONE
}
2236 static void check_bitmap_status(int status
, const char *filename
, Pixmap bitmap
)
2239 case BitmapOpenFailed
:
2240 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2242 case BitmapFileInvalid
:
2243 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2245 case BitmapNoMemory
:
2246 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2249 XFreePixmap(dpy
, bitmap
);
2256 * (builtin, <cursor_name>)
2257 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2259 static int parse_cursor(WScreen
* scr
, WMPropList
* pl
, Cursor
* cursor
)
2266 nelem
= WMGetPropListItemCount(pl
);
2270 elem
= WMGetFromPLArray(pl
, 0);
2271 if (!elem
|| !WMIsPLString(elem
)) {
2274 val
= WMGetFromPLString(elem
);
2276 if (strcasecmp(val
, "none") == 0) {
2279 } else if (strcasecmp(val
, "builtin") == 0) {
2281 int cursor_id
= CURSOR_ID_NONE
;
2284 wwarning(_("bad number of arguments in cursor specification"));
2287 elem
= WMGetFromPLArray(pl
, 1);
2288 if (!elem
|| !WMIsPLString(elem
)) {
2291 val
= WMGetFromPLString(elem
);
2293 for (i
= 0; cursor_table
[i
].name
!= NULL
; i
++) {
2294 if (strcasecmp(val
, cursor_table
[i
].name
) == 0) {
2295 cursor_id
= cursor_table
[i
].id
;
2299 if (CURSOR_ID_NONE
== cursor_id
) {
2300 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2302 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2305 } else if (strcasecmp(val
, "bitmap") == 0) {
2317 wwarning(_("bad number of arguments in cursor specification"));
2320 elem
= WMGetFromPLArray(pl
, 1);
2321 if (!elem
|| !WMIsPLString(elem
)) {
2324 val
= WMGetFromPLString(elem
);
2325 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2327 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2330 elem
= WMGetFromPLArray(pl
, 2);
2331 if (!elem
|| !WMIsPLString(elem
)) {
2335 val
= WMGetFromPLString(elem
);
2336 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2339 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2342 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
, &mask
, &x
, &y
);
2343 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
, &bitmap
, &x
, &y
);
2344 if ((BitmapSuccess
== bitmap_status
) && (BitmapSuccess
== mask_status
)) {
2345 fg
.pixel
= scr
->black_pixel
;
2346 bg
.pixel
= scr
->white_pixel
;
2347 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2348 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2349 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2352 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2353 check_bitmap_status(mask_status
, mask_name
, mask
);
2360 static int getCursor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2362 static Cursor cursor
;
2367 if (!WMIsPLArray(value
)) {
2368 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2369 entry
->key
, "cursor specification");
2371 value
= entry
->plvalue
;
2373 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2378 status
= parse_cursor(scr
, value
, &cursor
);
2380 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2382 value
= entry
->plvalue
;
2384 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2393 *(Cursor
*) addr
= cursor
;
2398 #undef CURSOR_ID_NONE
2400 /* ---------------- value setting functions --------------- */
2401 static int setJustify(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2403 return REFRESH_WINDOW_TITLE_COLOR
;
2406 static int setClearance(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2408 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
| REFRESH_MENU_TITLE_FONT
| REFRESH_MENU_FONT
;
2411 static int setIfDockPresent(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2414 long which
= (long) extra_data
;
2418 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2419 // Drawers require the dock
2420 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| wPreferences
.flags
.nodock
;
2423 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2426 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| *flag
;
2434 static int setClipMergedInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2438 wPreferences
.flags
.clip_merged_in_dock
= *flag
;
2439 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2443 static int setWrapAppiconsInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2447 wPreferences
.flags
.wrap_appicons_in_dock
= *flag
;
2451 static int setStickyIcons(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2453 if (w_global
.workspace
.array
) {
2454 wWorkspaceForceChange(scr
, w_global
.workspace
.current
);
2455 wArrangeIcons(scr
, False
);
2460 static int setIconTile(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2464 WTexture
** texture
= tdata
;
2467 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2468 wPreferences
.icon_size
, ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2469 ? WREL_ICON
: WREL_FLAT
);
2471 wwarning(_("could not render texture for icon background"));
2473 wTextureDestroy(scr
, *texture
);
2476 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2478 if (scr
->icon_tile
) {
2480 RReleaseImage(scr
->icon_tile
);
2481 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2484 scr
->icon_tile
= img
;
2486 /* put the icon in the noticeboard hint */
2487 PropSetIconTileHint(scr
, img
);
2489 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
) {
2490 if (scr
->clip_tile
) {
2491 RReleaseImage(scr
->clip_tile
);
2493 scr
->clip_tile
= wClipMakeTile(scr
, img
);
2496 if (!wPreferences
.flags
.nodrawer
) {
2497 if (scr
->drawer_tile
) {
2498 RReleaseImage(scr
->drawer_tile
);
2500 scr
->drawer_tile
= wDrawerMakeTile(scr
, img
);
2503 scr
->icon_tile_pixmap
= pixmap
;
2505 if (scr
->def_icon_rimage
) {
2506 RReleaseImage(scr
->def_icon_rimage
);
2507 scr
->def_icon_rimage
= NULL
;
2510 if (scr
->icon_back_texture
)
2511 wTextureDestroy(scr
, (WTexture
*) scr
->icon_back_texture
);
2513 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2515 /* Free the texture as nobody else will use it, nor refer to it. */
2517 wTextureDestroy(scr
, *texture
);
2519 return (reset
? REFRESH_ICON_TILE
: 0);
2522 static int setWinTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2524 WMFont
*font
= tdata
;
2526 if (scr
->title_font
) {
2527 WMReleaseFont(scr
->title_font
);
2529 scr
->title_font
= font
;
2531 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
;
2534 static int setMenuTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2536 WMFont
*font
= tdata
;
2538 if (scr
->menu_title_font
) {
2539 WMReleaseFont(scr
->menu_title_font
);
2542 scr
->menu_title_font
= font
;
2544 return REFRESH_MENU_TITLE_FONT
;
2547 static int setMenuTextFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2549 WMFont
*font
= tdata
;
2551 if (scr
->menu_entry_font
) {
2552 WMReleaseFont(scr
->menu_entry_font
);
2554 scr
->menu_entry_font
= font
;
2556 return REFRESH_MENU_FONT
;
2559 static int setIconTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2561 WMFont
*font
= tdata
;
2563 if (scr
->icon_title_font
) {
2564 WMReleaseFont(scr
->icon_title_font
);
2567 scr
->icon_title_font
= font
;
2569 return REFRESH_ICON_FONT
;
2572 static int setClipTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2574 WMFont
*font
= tdata
;
2576 if (scr
->clip_title_font
) {
2577 WMReleaseFont(scr
->clip_title_font
);
2580 scr
->clip_title_font
= font
;
2582 return REFRESH_ICON_FONT
;
2585 static int setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2587 WMFont
*font
= tdata
;
2589 if (w_global
.workspace
.font_for_name
)
2590 WMReleaseFont(w_global
.workspace
.font_for_name
);
2592 w_global
.workspace
.font_for_name
= font
;
2597 static int setHightlight(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2599 XColor
*color
= tdata
;
2601 if (scr
->select_color
)
2602 WMReleaseColor(scr
->select_color
);
2604 scr
->select_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2606 wFreeColor(scr
, color
->pixel
);
2608 return REFRESH_MENU_COLOR
;
2611 static int setHightlightText(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2613 XColor
*color
= tdata
;
2615 if (scr
->select_text_color
)
2616 WMReleaseColor(scr
->select_text_color
);
2618 scr
->select_text_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2620 wFreeColor(scr
, color
->pixel
);
2622 return REFRESH_MENU_COLOR
;
2625 static int setClipTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2627 XColor
*color
= tdata
;
2628 long widx
= (long) extra_data
;
2630 if (scr
->clip_title_color
[widx
])
2631 WMReleaseColor(scr
->clip_title_color
[widx
]);
2633 scr
->clip_title_color
[widx
] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2634 wFreeColor(scr
, color
->pixel
);
2636 return REFRESH_ICON_TITLE_COLOR
;
2639 static int setWTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2641 XColor
*color
= tdata
;
2642 long widx
= (long) extra_data
;
2644 if (scr
->window_title_color
[widx
])
2645 WMReleaseColor(scr
->window_title_color
[widx
]);
2647 scr
->window_title_color
[widx
] =
2648 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2650 wFreeColor(scr
, color
->pixel
);
2652 return REFRESH_WINDOW_TITLE_COLOR
;
2655 static int setMenuTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2657 XColor
*color
= tdata
;
2659 if (scr
->menu_title_color
[0])
2660 WMReleaseColor(scr
->menu_title_color
[0]);
2662 scr
->menu_title_color
[0] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2664 wFreeColor(scr
, color
->pixel
);
2666 return REFRESH_MENU_TITLE_COLOR
;
2669 static int setMenuTextColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2671 XColor
*color
= tdata
;
2673 if (scr
->mtext_color
)
2674 WMReleaseColor(scr
->mtext_color
);
2676 scr
->mtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2678 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2679 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2681 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2684 wFreeColor(scr
, color
->pixel
);
2686 return REFRESH_MENU_COLOR
;
2689 static int setMenuDisabledColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2691 XColor
*color
= tdata
;
2693 if (scr
->dtext_color
)
2694 WMReleaseColor(scr
->dtext_color
);
2696 scr
->dtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2698 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2699 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2701 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2704 wFreeColor(scr
, color
->pixel
);
2706 return REFRESH_MENU_COLOR
;
2709 static int setIconTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2711 XColor
*color
= tdata
;
2713 if (scr
->icon_title_color
)
2714 WMReleaseColor(scr
->icon_title_color
);
2715 scr
->icon_title_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2717 wFreeColor(scr
, color
->pixel
);
2719 return REFRESH_ICON_TITLE_COLOR
;
2722 static int setIconTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2724 XColor
*color
= tdata
;
2726 if (scr
->icon_title_texture
) {
2727 wTextureDestroy(scr
, (WTexture
*) scr
->icon_title_texture
);
2729 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
2731 return REFRESH_ICON_TITLE_BACK
;
2734 static int setFrameBorderWidth(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2738 scr
->frame_border_width
= *value
;
2740 return REFRESH_FRAME_BORDER
;
2743 static int setFrameBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2745 XColor
*color
= tdata
;
2747 if (scr
->frame_border_color
)
2748 WMReleaseColor(scr
->frame_border_color
);
2749 scr
->frame_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2751 wFreeColor(scr
, color
->pixel
);
2753 return REFRESH_FRAME_BORDER
;
2756 static int setFrameSelectedBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2758 XColor
*color
= tdata
;
2760 if (scr
->frame_selected_border_color
)
2761 WMReleaseColor(scr
->frame_selected_border_color
);
2762 scr
->frame_selected_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2764 wFreeColor(scr
, color
->pixel
);
2766 return REFRESH_FRAME_BORDER
;
2769 static void trackDeadProcess(pid_t pid
, unsigned char status
, WScreen
* scr
)
2771 close(scr
->helper_fd
);
2773 scr
->helper_pid
= 0;
2774 scr
->flags
.backimage_helper_launched
= 0;
2777 static int setWorkspaceSpecificBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
2779 WMPropList
*value
= tdata
;
2784 if (scr
->flags
.backimage_helper_launched
) {
2785 if (WMGetPropListItemCount(value
) == 0) {
2786 SendHelperMessage(scr
, 'C', 0, NULL
);
2787 SendHelperMessage(scr
, 'K', 0, NULL
);
2789 WMReleasePropList(value
);
2796 if (WMGetPropListItemCount(value
) == 0)
2799 if (pipe(filedes
) < 0) {
2800 werror("pipe() failed:can't set workspace specific background image");
2802 WMReleasePropList(value
);
2808 werror("fork() failed:can't set workspace specific background image");
2809 if (close(filedes
[0]) < 0)
2810 werror("could not close pipe");
2811 if (close(filedes
[1]) < 0)
2812 werror("could not close pipe");
2814 } else if (pid
== 0) {
2817 SetupEnvironment(scr
);
2820 werror("could not close pipe");
2821 if (dup(filedes
[0]) < 0) {
2822 werror("dup() failed:can't set workspace specific background image");
2824 dither
= wPreferences
.no_dithering
? "-m" : "-d";
2825 if (wPreferences
.smooth_workspace_back
)
2826 execlp("wmsetbg", "wmsetbg", "-helper", "-S", dither
, NULL
);
2828 execlp("wmsetbg", "wmsetbg", "-helper", dither
, NULL
);
2829 werror("could not execute wmsetbg");
2833 if (fcntl(filedes
[0], F_SETFD
, FD_CLOEXEC
) < 0) {
2834 werror("error setting close-on-exec flag");
2836 if (fcntl(filedes
[1], F_SETFD
, FD_CLOEXEC
) < 0) {
2837 werror("error setting close-on-exec flag");
2840 scr
->helper_fd
= filedes
[1];
2841 scr
->helper_pid
= pid
;
2842 scr
->flags
.backimage_helper_launched
= 1;
2844 wAddDeathHandler(pid
, (WDeathHandler
*) trackDeadProcess
, scr
);
2846 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
2851 for (i
= 0; i
< WMGetPropListItemCount(value
); i
++) {
2852 val
= WMGetFromPLArray(value
, i
);
2853 if (val
&& WMIsPLArray(val
) && WMGetPropListItemCount(val
) > 0) {
2854 str
= WMGetPropListDescription(val
, False
);
2856 SendHelperMessage(scr
, 'S', i
+ 1, str
);
2860 SendHelperMessage(scr
, 'U', i
+ 1, NULL
);
2865 WMReleasePropList(value
);
2869 static int setWorkspaceBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
2871 WMPropList
*value
= tdata
;
2873 if (scr
->flags
.backimage_helper_launched
) {
2876 if (WMGetPropListItemCount(value
) == 0) {
2877 SendHelperMessage(scr
, 'U', 0, NULL
);
2879 /* set the default workspace background to this one */
2880 str
= WMGetPropListDescription(value
, False
);
2882 SendHelperMessage(scr
, 'S', 0, str
);
2884 SendHelperMessage(scr
, 'C', w_global
.workspace
.current
+ 1, NULL
);
2886 SendHelperMessage(scr
, 'U', 0, NULL
);
2889 } else if (WMGetPropListItemCount(value
) > 0) {
2895 text
= WMGetPropListDescription(value
, False
);
2896 len
= strlen(text
) + 40;
2897 command
= wmalloc(len
);
2898 dither
= wPreferences
.no_dithering
? "-m" : "-d";
2899 if (wPreferences
.smooth_workspace_back
)
2900 snprintf(command
, len
, "wmsetbg %s -S -p '%s' &", dither
, text
);
2902 snprintf(command
, len
, "wmsetbg %s -p '%s' &", dither
, text
);
2904 ExecuteShellCommand(scr
, command
);
2907 WMReleasePropList(value
);
2912 static int setWidgetColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2914 WTexture
**texture
= tdata
;
2916 if (scr
->widget_texture
) {
2917 wTextureDestroy(scr
, (WTexture
*) scr
->widget_texture
);
2919 scr
->widget_texture
= *(WTexSolid
**) texture
;
2924 static int setFTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2926 WTexture
**texture
= tdata
;
2928 if (scr
->window_title_texture
[WS_FOCUSED
]) {
2929 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
2931 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
2933 return REFRESH_WINDOW_TEXTURES
;
2936 static int setPTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2938 WTexture
**texture
= tdata
;
2940 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
2941 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
2943 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
2945 return REFRESH_WINDOW_TEXTURES
;
2948 static int setUTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2950 WTexture
**texture
= tdata
;
2952 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
2953 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
2955 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
2957 return REFRESH_WINDOW_TEXTURES
;
2960 static int setResizebarBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2962 WTexture
**texture
= tdata
;
2964 if (scr
->resizebar_texture
[0]) {
2965 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
2967 scr
->resizebar_texture
[0] = *texture
;
2969 return REFRESH_WINDOW_TEXTURES
;
2972 static int setMenuTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2974 WTexture
**texture
= tdata
;
2976 if (scr
->menu_title_texture
[0]) {
2977 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
2979 scr
->menu_title_texture
[0] = *texture
;
2981 return REFRESH_MENU_TITLE_TEXTURE
;
2984 static int setMenuTextBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2986 WTexture
**texture
= tdata
;
2988 if (scr
->menu_item_texture
) {
2989 wTextureDestroy(scr
, scr
->menu_item_texture
);
2990 wTextureDestroy(scr
, (WTexture
*) scr
->menu_item_auxtexture
);
2992 scr
->menu_item_texture
= *texture
;
2994 scr
->menu_item_auxtexture
= wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
2996 return REFRESH_MENU_TEXTURE
;
2999 static int setKeyGrab(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3001 WShortKey
*shortcut
= tdata
;
3003 long widx
= (long) extra_data
;
3005 wKeyBindings
[widx
] = *shortcut
;
3007 wwin
= scr
->focused_window
;
3009 while (wwin
!= NULL
) {
3010 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3012 if (!WFLAGP(wwin
, no_bind_keys
)) {
3013 wWindowSetKeyGrabs(wwin
);
3018 /* do we need to update window menus? */
3019 if (widx
>= WKBD_WORKSPACE1
&& widx
<= WKBD_WORKSPACE10
)
3020 return REFRESH_WORKSPACE_MENU
;
3021 if (widx
== WKBD_LASTWORKSPACE
)
3022 return REFRESH_WORKSPACE_MENU
;
3023 if (widx
>= WKBD_MOVE_WORKSPACE1
&& widx
<= WKBD_MOVE_WORKSPACE10
)
3024 return REFRESH_WORKSPACE_MENU
;
3029 static int setIconPosition(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3031 wScreenUpdateUsableArea(scr
);
3032 wArrangeIcons(scr
, True
);
3037 static int updateUsableArea(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3039 wScreenUpdateUsableArea(scr
);
3044 static int setMenuStyle(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3046 return REFRESH_MENU_TEXTURE
;
3049 static RImage
*chopOffImage(RImage
* image
, int x
, int y
, int w
, int h
)
3051 RImage
*img
= RCreateImage(w
, h
, image
->format
== RRGBAFormat
);
3053 RCopyArea(img
, image
, x
, y
, w
, h
, 0, 0);
3058 static int setSwPOptions(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3060 WMPropList
*array
= tdata
;
3063 int cwidth
, cheight
;
3064 struct WPreferences
*prefs
= foo
;
3066 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) == 0) {
3067 if (prefs
->swtileImage
)
3068 RReleaseImage(prefs
->swtileImage
);
3069 prefs
->swtileImage
= NULL
;
3071 WMReleasePropList(array
);
3075 switch (WMGetPropListItemCount(array
)) {
3077 if (!WMIsPLString(WMGetFromPLArray(array
, 1))) {
3078 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3081 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 1)));
3084 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3085 WMGetFromPLString(WMGetFromPLArray(array
, 1)), entry
->key
);
3087 bgimage
= RLoadImage(scr
->rcontext
, path
, 0);
3089 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3094 cwidth
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 2)));
3095 cheight
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 3)));
3097 if (cwidth
<= 0 || cheight
<= 0 ||
3098 cwidth
>= bgimage
->width
- 2 || cheight
>= bgimage
->height
- 2)
3099 wwarning(_("Invalid split sizes for SwitchPanel back image."));
3102 int swidth
, theight
;
3103 for (i
= 0; i
< 9; i
++) {
3104 if (prefs
->swbackImage
[i
])
3105 RReleaseImage(prefs
->swbackImage
[i
]);
3106 prefs
->swbackImage
[i
] = NULL
;
3108 swidth
= (bgimage
->width
- cwidth
) / 2;
3109 theight
= (bgimage
->height
- cheight
) / 2;
3111 prefs
->swbackImage
[0] = chopOffImage(bgimage
, 0, 0, swidth
, theight
);
3112 prefs
->swbackImage
[1] = chopOffImage(bgimage
, swidth
, 0, cwidth
, theight
);
3113 prefs
->swbackImage
[2] = chopOffImage(bgimage
, swidth
+ cwidth
, 0,
3116 prefs
->swbackImage
[3] = chopOffImage(bgimage
, 0, theight
, swidth
, cheight
);
3117 prefs
->swbackImage
[4] = chopOffImage(bgimage
, swidth
, theight
,
3119 prefs
->swbackImage
[5] = chopOffImage(bgimage
, swidth
+ cwidth
, theight
,
3122 prefs
->swbackImage
[6] = chopOffImage(bgimage
, 0, theight
+ cheight
,
3124 prefs
->swbackImage
[7] = chopOffImage(bgimage
, swidth
, theight
+ cheight
,
3126 prefs
->swbackImage
[8] =
3127 chopOffImage(bgimage
, swidth
+ cwidth
, theight
+ cheight
, swidth
,
3130 // check if anything failed
3131 for (i
= 0; i
< 9; i
++) {
3132 if (!prefs
->swbackImage
[i
]) {
3133 for (; i
>= 0; --i
) {
3134 RReleaseImage(prefs
->swbackImage
[i
]);
3135 prefs
->swbackImage
[i
] = NULL
;
3141 RReleaseImage(bgimage
);
3146 if (!WMIsPLString(WMGetFromPLArray(array
, 0))) {
3147 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3150 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 0)));
3153 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3154 WMGetFromPLString(WMGetFromPLArray(array
, 0)), entry
->key
);
3156 if (prefs
->swtileImage
)
3157 RReleaseImage(prefs
->swtileImage
);
3159 prefs
->swtileImage
= RLoadImage(scr
->rcontext
, path
, 0);
3160 if (!prefs
->swtileImage
) {
3161 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3168 wwarning(_("Invalid number of arguments for option \"%s\""), entry
->key
);
3172 WMReleasePropList(array
);
3177 static int setModifierKeyLabels(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3179 WMPropList
*array
= tdata
;
3181 struct WPreferences
*prefs
= foo
;
3183 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) != 7) {
3184 wwarning(_("Value for option \"%s\" must be an array of 7 strings"), entry
->key
);
3185 WMReleasePropList(array
);
3189 DestroyWindowMenu(scr
);
3191 for (i
= 0; i
< 7; i
++) {
3192 if (prefs
->modifier_labels
[i
])
3193 wfree(prefs
->modifier_labels
[i
]);
3195 if (WMIsPLString(WMGetFromPLArray(array
, i
))) {
3196 prefs
->modifier_labels
[i
] = wstrdup(WMGetFromPLString(WMGetFromPLArray(array
, i
)));
3198 wwarning(_("Invalid argument for option \"%s\" item %d"), entry
->key
, i
);
3199 prefs
->modifier_labels
[i
] = NULL
;
3203 WMReleasePropList(array
);
3208 static int setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3215 W_setconf_doubleClickDelay(*value
);
3220 static int setCursor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3222 Cursor
*cursor
= tdata
;
3223 long widx
= (long) extra_data
;
3225 if (wPreferences
.cursor
[widx
] != None
) {
3226 XFreeCursor(dpy
, wPreferences
.cursor
[widx
]);
3229 wPreferences
.cursor
[widx
] = *cursor
;
3231 if (widx
== WCUR_ROOT
&& *cursor
!= None
) {
3232 XDefineCursor(dpy
, scr
->root_win
, *cursor
);