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 WPreferences wPreferences
;
80 extern WShortKey wKeyBindings
[WKBD_LAST
];
82 typedef struct _WDefaultEntry WDefaultEntry
;
83 typedef int (WDECallbackConvert
) (WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*plvalue
, void *addr
, void **tdata
);
84 typedef int (WDECallbackUpdate
) (WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *extra_data
);
86 struct _WDefaultEntry
{
88 const char *default_value
;
91 WDECallbackConvert
*convert
;
92 WDECallbackUpdate
*update
;
94 WMPropList
*plvalue
; /* default value */
97 /* used to map strings to integers */
102 } WOptionEnumeration
;
104 /* type converters */
105 static WDECallbackConvert getBool
;
106 static WDECallbackConvert getInt
;
107 static WDECallbackConvert getCoord
;
108 static WDECallbackConvert getPathList
;
109 static WDECallbackConvert getEnum
;
110 static WDECallbackConvert getTexture
;
111 static WDECallbackConvert getWSBackground
;
112 static WDECallbackConvert getWSSpecificBackground
;
113 static WDECallbackConvert getFont
;
114 static WDECallbackConvert getColor
;
115 static WDECallbackConvert getKeybind
;
116 static WDECallbackConvert getModMask
;
117 static WDECallbackConvert getPropList
;
119 /* value setting functions */
120 static WDECallbackUpdate setJustify
;
121 static WDECallbackUpdate setClearance
;
122 static WDECallbackUpdate setIfDockPresent
;
123 static WDECallbackUpdate setClipMergedInDock
;
124 static WDECallbackUpdate setWrapAppiconsInDock
;
125 static WDECallbackUpdate setStickyIcons
;
126 static WDECallbackUpdate setWidgetColor
;
127 static WDECallbackUpdate setIconTile
;
128 static WDECallbackUpdate setWinTitleFont
;
129 static WDECallbackUpdate setMenuTitleFont
;
130 static WDECallbackUpdate setMenuTextFont
;
131 static WDECallbackUpdate setIconTitleFont
;
132 static WDECallbackUpdate setIconTitleColor
;
133 static WDECallbackUpdate setIconTitleBack
;
134 static WDECallbackUpdate setFrameBorderWidth
;
135 static WDECallbackUpdate setFrameBorderColor
;
136 static WDECallbackUpdate setFrameSelectedBorderColor
;
137 static WDECallbackUpdate setLargeDisplayFont
;
138 static WDECallbackUpdate setWTitleColor
;
139 static WDECallbackUpdate setFTitleBack
;
140 static WDECallbackUpdate setPTitleBack
;
141 static WDECallbackUpdate setUTitleBack
;
142 static WDECallbackUpdate setResizebarBack
;
143 static WDECallbackUpdate setWorkspaceBack
;
144 static WDECallbackUpdate setWorkspaceSpecificBack
;
145 static WDECallbackUpdate setMenuTitleColor
;
146 static WDECallbackUpdate setMenuTextColor
;
147 static WDECallbackUpdate setMenuDisabledColor
;
148 static WDECallbackUpdate setMenuTitleBack
;
149 static WDECallbackUpdate setMenuTextBack
;
150 static WDECallbackUpdate setHightlight
;
151 static WDECallbackUpdate setHightlightText
;
152 static WDECallbackUpdate setKeyGrab
;
153 static WDECallbackUpdate setDoubleClick
;
154 static WDECallbackUpdate setIconPosition
;
156 static WDECallbackUpdate setClipTitleFont
;
157 static WDECallbackUpdate setClipTitleColor
;
159 static WDECallbackUpdate setMenuStyle
;
160 static WDECallbackUpdate setSwPOptions
;
161 static WDECallbackUpdate updateUsableArea
;
163 static WDECallbackUpdate setModifierKeyLabels
;
165 extern Cursor wCursor
[WCUR_LAST
];
166 static WDECallbackConvert getCursor
;
167 static WDECallbackUpdate setCursor
;
170 * Tables to convert strings to enumeration values.
171 * Values stored are char
174 /* WARNING: sum of length of all value strings must not exceed
176 #define TOTAL_VALUES_LENGTH 80
178 #define REFRESH_WINDOW_TEXTURES (1<<0)
179 #define REFRESH_MENU_TEXTURE (1<<1)
180 #define REFRESH_MENU_FONT (1<<2)
181 #define REFRESH_MENU_COLOR (1<<3)
182 #define REFRESH_MENU_TITLE_TEXTURE (1<<4)
183 #define REFRESH_MENU_TITLE_FONT (1<<5)
184 #define REFRESH_MENU_TITLE_COLOR (1<<6)
185 #define REFRESH_WINDOW_TITLE_COLOR (1<<7)
186 #define REFRESH_WINDOW_FONT (1<<8)
187 #define REFRESH_ICON_TILE (1<<9)
188 #define REFRESH_ICON_FONT (1<<10)
189 #define REFRESH_WORKSPACE_BACK (1<<11)
191 #define REFRESH_BUTTON_IMAGES (1<<12)
193 #define REFRESH_ICON_TITLE_COLOR (1<<13)
194 #define REFRESH_ICON_TITLE_BACK (1<<14)
196 #define REFRESH_WORKSPACE_MENU (1<<15)
198 #define REFRESH_FRAME_BORDER REFRESH_MENU_FONT|REFRESH_WINDOW_FONT
200 static WOptionEnumeration seFocusModes
[] = {
201 {"Manual", WKF_CLICK
, 0}, {"ClickToFocus", WKF_CLICK
, 1},
202 {"Sloppy", WKF_SLOPPY
, 0}, {"SemiAuto", WKF_SLOPPY
, 1}, {"Auto", WKF_SLOPPY
, 1},
206 static WOptionEnumeration seTitlebarModes
[] = {
207 {"new", TS_NEW
, 0}, {"old", TS_OLD
, 0},
208 {"next", TS_NEXT
, 0}, {NULL
, 0, 0}
211 static WOptionEnumeration seColormapModes
[] = {
212 {"Manual", WCM_CLICK
, 0}, {"ClickToFocus", WCM_CLICK
, 1},
213 {"Auto", WCM_POINTER
, 0}, {"FocusFollowMouse", WCM_POINTER
, 1},
217 static WOptionEnumeration sePlacements
[] = {
218 {"Auto", WPM_AUTO
, 0},
219 {"Smart", WPM_SMART
, 0},
220 {"Cascade", WPM_CASCADE
, 0},
221 {"Random", WPM_RANDOM
, 0},
222 {"Manual", WPM_MANUAL
, 0},
223 {"Center", WPM_CENTER
, 0},
227 static WOptionEnumeration seGeomDisplays
[] = {
228 {"None", WDIS_NONE
, 0},
229 {"Center", WDIS_CENTER
, 0},
230 {"Corner", WDIS_TOPLEFT
, 0},
231 {"Floating", WDIS_FRAME_CENTER
, 0},
232 {"Line", WDIS_NEW
, 0},
236 static WOptionEnumeration seSpeeds
[] = {
237 {"UltraFast", SPEED_ULTRAFAST
, 0},
238 {"Fast", SPEED_FAST
, 0},
239 {"Medium", SPEED_MEDIUM
, 0},
240 {"Slow", SPEED_SLOW
, 0},
241 {"UltraSlow", SPEED_ULTRASLOW
, 0},
245 static WOptionEnumeration seMouseButtonActions
[] = {
246 {"None", WA_NONE
, 0},
247 {"SelectWindows", WA_SELECT_WINDOWS
, 0},
248 {"OpenApplicationsMenu", WA_OPEN_APPMENU
, 0},
249 {"OpenWindowListMenu", WA_OPEN_WINLISTMENU
, 0},
253 static WOptionEnumeration seMouseWheelActions
[] = {
254 {"None", WA_NONE
, 0},
255 {"SwitchWorkspaces", WA_SWITCH_WORKSPACES
, 0},
259 static WOptionEnumeration seIconificationStyles
[] = {
260 {"Zoom", WIS_ZOOM
, 0},
261 {"Twist", WIS_TWIST
, 0},
262 {"Flip", WIS_FLIP
, 0},
263 {"None", WIS_NONE
, 0},
264 {"random", WIS_RANDOM
, 0},
268 static WOptionEnumeration seJustifications
[] = {
269 {"Left", WTJ_LEFT
, 0},
270 {"Center", WTJ_CENTER
, 0},
271 {"Right", WTJ_RIGHT
, 0},
275 static WOptionEnumeration seIconPositions
[] = {
276 {"blv", IY_BOTTOM
| IY_LEFT
| IY_VERT
, 0},
277 {"blh", IY_BOTTOM
| IY_LEFT
| IY_HORIZ
, 0},
278 {"brv", IY_BOTTOM
| IY_RIGHT
| IY_VERT
, 0},
279 {"brh", IY_BOTTOM
| IY_RIGHT
| IY_HORIZ
, 0},
280 {"tlv", IY_TOP
| IY_LEFT
| IY_VERT
, 0},
281 {"tlh", IY_TOP
| IY_LEFT
| IY_HORIZ
, 0},
282 {"trv", IY_TOP
| IY_RIGHT
| IY_VERT
, 0},
283 {"trh", IY_TOP
| IY_RIGHT
| IY_HORIZ
, 0},
287 static WOptionEnumeration seMenuStyles
[] = {
288 {"normal", MS_NORMAL
, 0},
289 {"singletexture", MS_SINGLE_TEXTURE
, 0},
290 {"flat", MS_FLAT
, 0},
294 static WOptionEnumeration seDisplayPositions
[] = {
295 {"none", WD_NONE
, 0},
296 {"center", WD_CENTER
, 0},
298 {"bottom", WD_BOTTOM
, 0},
299 {"topleft", WD_TOPLEFT
, 0},
300 {"topright", WD_TOPRIGHT
, 0},
301 {"bottomleft", WD_BOTTOMLEFT
, 0},
302 {"bottomright", WD_BOTTOMRIGHT
, 0},
306 static WOptionEnumeration seWorkspaceBorder
[] = {
307 {"None", WB_NONE
, 0},
308 {"LeftRight", WB_LEFTRIGHT
, 0},
309 {"TopBottom", WB_TOPBOTTOM
, 0},
310 {"AllDirections", WB_ALLDIRS
, 0},
315 * ALL entries in the tables bellow, NEED to have a default value
316 * defined, and this value needs to be correct.
319 /* these options will only affect the window manager on startup
321 * static defaults can't access the screen data, because it is
322 * created after these defaults are read
324 WDefaultEntry staticOptionList
[] = {
326 {"ColormapSize", "4", NULL
,
327 &wPreferences
.cmap_size
, getInt
, NULL
, NULL
, NULL
},
328 {"DisableDithering", "NO", NULL
,
329 &wPreferences
.no_dithering
, getBool
, NULL
, NULL
, NULL
},
330 {"IconSize", "64", NULL
,
331 &wPreferences
.icon_size
, getInt
, NULL
, NULL
, NULL
},
332 {"ModifierKey", "Mod1", NULL
,
333 &wPreferences
.modifier_mask
, getModMask
, NULL
, NULL
, NULL
},
334 {"DisableWSMouseActions", "NO", NULL
,
335 &wPreferences
.disable_root_mouse
, getBool
, NULL
, NULL
, NULL
},
336 {"FocusMode", "manual", seFocusModes
, /* have a problem when switching from */
337 &wPreferences
.focus_mode
, getEnum
, NULL
, NULL
, NULL
}, /* manual to sloppy without restart */
338 {"NewStyle", "new", seTitlebarModes
,
339 &wPreferences
.new_style
, getEnum
, NULL
, NULL
, NULL
},
340 {"DisableDock", "NO", (void *)WM_DOCK
,
341 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
342 {"DisableClip", "NO", (void *)WM_CLIP
,
343 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
344 {"DisableDrawers", "NO", (void *)WM_DRAWER
,
345 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
346 {"ClipMergedInDock", "NO", NULL
,
347 NULL
, getBool
, setClipMergedInDock
, NULL
, NULL
},
348 {"DisableMiniwindows", "NO", NULL
,
349 &wPreferences
.disable_miniwindows
, getBool
, NULL
, NULL
, NULL
}
352 #define NUM2STRING_(x) #x
353 #define NUM2STRING(x) NUM2STRING_(x)
355 WDefaultEntry optionList
[] = {
357 /* dynamic options */
359 {"IconPosition", "blh", seIconPositions
,
360 &wPreferences
.icon_yard
, getEnum
, setIconPosition
, NULL
, NULL
},
361 {"IconificationStyle", "Zoom", seIconificationStyles
,
362 &wPreferences
.iconification_style
, getEnum
, NULL
, NULL
, NULL
},
363 {"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions
,
364 &wPreferences
.mouse_button1
, getEnum
, NULL
, NULL
, NULL
},
365 {"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions
,
366 &wPreferences
.mouse_button2
, getEnum
, NULL
, NULL
, NULL
},
367 {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions
,
368 &wPreferences
.mouse_button3
, getEnum
, NULL
, NULL
, NULL
},
369 {"MouseWheelAction", "None", seMouseWheelActions
,
370 &wPreferences
.mouse_wheel
, getEnum
, NULL
, NULL
, NULL
},
371 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
372 &wPreferences
.pixmap_path
, getPathList
, NULL
, NULL
, NULL
},
373 {"IconPath", DEF_ICON_PATHS
, NULL
,
374 &wPreferences
.icon_path
, getPathList
, NULL
, NULL
, NULL
},
375 {"ColormapMode", "auto", seColormapModes
,
376 &wPreferences
.colormap_mode
, getEnum
, NULL
, NULL
, NULL
},
377 {"AutoFocus", "NO", NULL
,
378 &wPreferences
.auto_focus
, getBool
, NULL
, NULL
, NULL
},
379 {"RaiseDelay", "0", NULL
,
380 &wPreferences
.raise_delay
, getInt
, NULL
, NULL
, NULL
},
381 {"CirculateRaise", "NO", NULL
,
382 &wPreferences
.circ_raise
, getBool
, NULL
, NULL
, NULL
},
383 {"Superfluous", "NO", NULL
,
384 &wPreferences
.superfluous
, getBool
, NULL
, NULL
, NULL
},
385 {"AdvanceToNewWorkspace", "NO", NULL
,
386 &wPreferences
.ws_advance
, getBool
, NULL
, NULL
, NULL
},
387 {"CycleWorkspaces", "NO", NULL
,
388 &wPreferences
.ws_cycle
, getBool
, NULL
, NULL
, NULL
},
389 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
390 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
, NULL
, NULL
},
391 {"WorkspaceBorder", "None", seWorkspaceBorder
,
392 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
, NULL
, NULL
},
393 {"WorkspaceBorderSize", "0", NULL
,
394 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
, NULL
, NULL
},
395 {"StickyIcons", "NO", NULL
,
396 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
, NULL
, NULL
},
397 {"SaveSessionOnExit", "NO", NULL
,
398 &wPreferences
.save_session_on_exit
, getBool
, NULL
, NULL
, NULL
},
399 {"WrapMenus", "NO", NULL
,
400 &wPreferences
.wrap_menus
, getBool
, NULL
, NULL
, NULL
},
401 {"ScrollableMenus", "NO", NULL
,
402 &wPreferences
.scrollable_menus
, getBool
, NULL
, NULL
, NULL
},
403 {"MenuScrollSpeed", "medium", seSpeeds
,
404 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
, NULL
, NULL
},
405 {"IconSlideSpeed", "medium", seSpeeds
,
406 &wPreferences
.icon_slide_speed
, getEnum
, NULL
, NULL
, NULL
},
407 {"ShadeSpeed", "medium", seSpeeds
,
408 &wPreferences
.shade_speed
, getEnum
, NULL
, NULL
, NULL
},
409 {"BounceAppIconsWhenUrgent", "YES", NULL
,
410 &wPreferences
.bounce_appicons_when_urgent
, getBool
, NULL
, NULL
, NULL
},
411 {"RaiseAppIconsWhenBouncing", "NO", NULL
,
412 &wPreferences
.raise_appicons_when_bouncing
, getBool
, NULL
, NULL
, NULL
},
413 {"DoNotMakeAppIconsBounce", "NO", NULL
,
414 &wPreferences
.do_not_make_appicons_bounce
, getBool
, NULL
, NULL
, NULL
},
415 {"DoubleClickTime", "250", (void *)&wPreferences
.dblclick_time
,
416 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
, NULL
, NULL
},
417 {"ClipAutoraiseDelay", "600", NULL
,
418 &wPreferences
.clip_auto_raise_delay
, getInt
, NULL
, NULL
, NULL
},
419 {"ClipAutolowerDelay", "1000", NULL
,
420 &wPreferences
.clip_auto_lower_delay
, getInt
, NULL
, NULL
, NULL
},
421 {"ClipAutoexpandDelay", "600", NULL
,
422 &wPreferences
.clip_auto_expand_delay
, getInt
, NULL
, NULL
, NULL
},
423 {"ClipAutocollapseDelay", "1000", NULL
,
424 &wPreferences
.clip_auto_collapse_delay
, getInt
, NULL
, NULL
, NULL
},
425 {"WrapAppiconsInDock", "YES", NULL
,
426 NULL
, getBool
, setWrapAppiconsInDock
, NULL
, NULL
},
427 {"AlignSubmenus", "NO", NULL
,
428 &wPreferences
.align_menus
, getBool
, NULL
, NULL
, NULL
},
429 {"ViKeyMenus", "NO", NULL
,
430 &wPreferences
.vi_key_menus
, getBool
, NULL
, NULL
, NULL
},
431 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
432 &wPreferences
.open_transients_with_parent
, getBool
, NULL
, NULL
, NULL
},
433 {"WindowPlacement", "auto", sePlacements
,
434 &wPreferences
.window_placement
, getEnum
, NULL
, NULL
, NULL
},
435 {"IgnoreFocusClick", "NO", NULL
,
436 &wPreferences
.ignore_focus_click
, getBool
, NULL
, NULL
, NULL
},
437 {"UseSaveUnders", "NO", NULL
,
438 &wPreferences
.use_saveunders
, getBool
, NULL
, NULL
, NULL
},
439 {"OpaqueMove", "NO", NULL
,
440 &wPreferences
.opaque_move
, getBool
, NULL
, NULL
, NULL
},
441 {"OpaqueResize", "NO", NULL
,
442 &wPreferences
.opaque_resize
, getBool
, NULL
, NULL
, NULL
},
443 {"OpaqueMoveResizeKeyboard", "NO", NULL
,
444 &wPreferences
.opaque_move_resize_keyboard
, getBool
, NULL
, NULL
, NULL
},
445 {"DisableAnimations", "NO", NULL
,
446 &wPreferences
.no_animations
, getBool
, NULL
, NULL
, NULL
},
447 {"DontLinkWorkspaces", "NO", NULL
,
448 &wPreferences
.no_autowrap
, getBool
, NULL
, NULL
, NULL
},
449 {"HighlightActiveApp", "YES", NULL
,
450 &wPreferences
.highlight_active_app
, getBool
, NULL
, NULL
, NULL
},
451 {"AutoArrangeIcons", "NO", NULL
,
452 &wPreferences
.auto_arrange_icons
, getBool
, NULL
, NULL
, NULL
},
453 {"NoWindowOverDock", "NO", NULL
,
454 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
, NULL
, NULL
},
455 {"NoWindowOverIcons", "NO", NULL
,
456 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
, NULL
, NULL
},
457 {"WindowPlaceOrigin", "(0, 0)", NULL
,
458 &wPreferences
.window_place_origin
, getCoord
, NULL
, NULL
, NULL
},
459 {"ResizeDisplay", "corner", seGeomDisplays
,
460 &wPreferences
.size_display
, getEnum
, NULL
, NULL
, NULL
},
461 {"MoveDisplay", "corner", seGeomDisplays
,
462 &wPreferences
.move_display
, getEnum
, NULL
, NULL
, NULL
},
463 {"DontConfirmKill", "NO", NULL
,
464 &wPreferences
.dont_confirm_kill
, getBool
, NULL
, NULL
, NULL
},
465 {"WindowTitleBalloons", "NO", NULL
,
466 &wPreferences
.window_balloon
, getBool
, NULL
, NULL
, NULL
},
467 {"MiniwindowTitleBalloons", "NO", NULL
,
468 &wPreferences
.miniwin_balloon
, getBool
, NULL
, NULL
, NULL
},
469 {"AppIconBalloons", "NO", NULL
,
470 &wPreferences
.appicon_balloon
, getBool
, NULL
, NULL
, NULL
},
471 {"HelpBalloons", "NO", NULL
,
472 &wPreferences
.help_balloon
, getBool
, NULL
, NULL
, NULL
},
473 {"EdgeResistance", "30", NULL
,
474 &wPreferences
.edge_resistance
, getInt
, NULL
, NULL
, NULL
},
475 {"ResizeIncrement", "0", NULL
,
476 &wPreferences
.resize_increment
, getInt
, NULL
, NULL
, NULL
},
477 {"Attraction", "NO", NULL
,
478 &wPreferences
.attract
, getBool
, NULL
, NULL
, NULL
},
479 {"DisableBlinking", "NO", NULL
,
480 &wPreferences
.dont_blink
, getBool
, NULL
, NULL
, NULL
},
481 {"SingleClickLaunch", "NO", NULL
,
482 &wPreferences
.single_click
, getBool
, NULL
, NULL
, NULL
},
483 {"StrictWindozeCycle", "YES", NULL
,
484 &wPreferences
.strict_windoze_cycle
, getBool
, NULL
, NULL
, NULL
},
485 {"SwitchPanelOnlyOpen", "NO", NULL
,
486 &wPreferences
.panel_only_open
, getBool
, NULL
, NULL
, NULL
},
490 {"MenuStyle", "normal", seMenuStyles
,
491 &wPreferences
.menu_style
, getEnum
, setMenuStyle
, NULL
, NULL
},
492 {"WidgetColor", "(solid, gray)", NULL
,
493 NULL
, getTexture
, setWidgetColor
, NULL
, NULL
},
494 {"WorkspaceSpecificBack", "()", NULL
,
495 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
, NULL
, NULL
},
496 /* WorkspaceBack must come after WorkspaceSpecificBack or
497 * WorkspaceBack wont know WorkspaceSpecificBack was also
498 * specified and 2 copies of wmsetbg will be launched */
499 {"WorkspaceBack", "(solid, black)", NULL
,
500 NULL
, getWSBackground
, setWorkspaceBack
, NULL
, NULL
},
501 {"SmoothWorkspaceBack", "NO", NULL
,
502 NULL
, getBool
, NULL
, NULL
, NULL
},
503 {"IconBack", "(solid, gray)", NULL
,
504 NULL
, getTexture
, setIconTile
, NULL
, NULL
},
505 {"TitleJustify", "center", seJustifications
,
506 &wPreferences
.title_justification
, getEnum
, setJustify
, NULL
, NULL
},
507 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
508 NULL
, getFont
, setWinTitleFont
, NULL
, NULL
},
509 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
510 &wPreferences
.window_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
511 {"WindowTitleMinHeight", "0", NULL
,
512 &wPreferences
.window_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
513 {"WindowTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
514 &wPreferences
.window_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
515 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
516 &wPreferences
.menu_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
517 {"MenuTitleMinHeight", "0", NULL
,
518 &wPreferences
.menu_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
519 {"MenuTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
520 &wPreferences
.menu_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
521 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
522 &wPreferences
.menu_text_clearance
, getInt
, setClearance
, NULL
, NULL
},
523 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
524 NULL
, getFont
, setMenuTitleFont
, NULL
, NULL
},
525 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
526 NULL
, getFont
, setMenuTextFont
, NULL
, NULL
},
527 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
528 NULL
, getFont
, setIconTitleFont
, NULL
, NULL
},
529 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
530 NULL
, getFont
, setClipTitleFont
, NULL
, NULL
},
531 {"ShowClipTitle", "YES", NULL
,
532 &wPreferences
.show_clip_title
, getBool
, NULL
, NULL
, NULL
},
533 {"LargeDisplayFont", DEF_WORKSPACE_NAME_FONT
, NULL
,
534 NULL
, getFont
, setLargeDisplayFont
, NULL
, NULL
},
535 {"HighlightColor", "white", NULL
,
536 NULL
, getColor
, setHightlight
, NULL
, NULL
},
537 {"HighlightTextColor", "black", NULL
,
538 NULL
, getColor
, setHightlightText
, NULL
, NULL
},
539 {"ClipTitleColor", "black", (void *)CLIP_NORMAL
,
540 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
541 {"CClipTitleColor", "\"#454045\"", (void *)CLIP_COLLAPSED
,
542 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
543 {"FTitleColor", "white", (void *)WS_FOCUSED
,
544 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
545 {"PTitleColor", "white", (void *)WS_PFOCUSED
,
546 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
547 {"UTitleColor", "black", (void *)WS_UNFOCUSED
,
548 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
549 {"FTitleBack", "(solid, black)", NULL
,
550 NULL
, getTexture
, setFTitleBack
, NULL
, NULL
},
551 {"PTitleBack", "(solid, \"#616161\")", NULL
,
552 NULL
, getTexture
, setPTitleBack
, NULL
, NULL
},
553 {"UTitleBack", "(solid, gray)", NULL
,
554 NULL
, getTexture
, setUTitleBack
, NULL
, NULL
},
555 {"ResizebarBack", "(solid, gray)", NULL
,
556 NULL
, getTexture
, setResizebarBack
, NULL
, NULL
},
557 {"MenuTitleColor", "white", NULL
,
558 NULL
, getColor
, setMenuTitleColor
, NULL
, NULL
},
559 {"MenuTextColor", "black", NULL
,
560 NULL
, getColor
, setMenuTextColor
, NULL
, NULL
},
561 {"MenuDisabledColor", "\"#616161\"", NULL
,
562 NULL
, getColor
, setMenuDisabledColor
, NULL
, NULL
},
563 {"MenuTitleBack", "(solid, black)", NULL
,
564 NULL
, getTexture
, setMenuTitleBack
, NULL
, NULL
},
565 {"MenuTextBack", "(solid, gray)", NULL
,
566 NULL
, getTexture
, setMenuTextBack
, NULL
, NULL
},
567 {"IconTitleColor", "white", NULL
,
568 NULL
, getColor
, setIconTitleColor
, NULL
, NULL
},
569 {"IconTitleBack", "black", NULL
,
570 NULL
, getColor
, setIconTitleBack
, NULL
, NULL
},
571 {"SwitchPanelImages", "(swtile.png, swback.png, 30, 40)", &wPreferences
,
572 NULL
, getPropList
, setSwPOptions
, NULL
, NULL
},
573 {"ModifierKeyLabels", "(\"Shift+\", \"Ctrl+\", \"Mod1+\", \"Mod2+\", \"Mod3+\", \"Mod4+\", \"Mod5+\")", &wPreferences
,
574 NULL
, getPropList
, setModifierKeyLabels
, NULL
, NULL
},
575 {"FrameBorderWidth", "1", NULL
,
576 NULL
, getInt
, setFrameBorderWidth
, NULL
, NULL
},
577 {"FrameBorderColor", "black", NULL
,
578 NULL
, getColor
, setFrameBorderColor
, NULL
, NULL
},
579 {"FrameSelectedBorderColor", "white", NULL
,
580 NULL
, getColor
, setFrameSelectedBorderColor
, NULL
, NULL
},
584 {"RootMenuKey", "None", (void *)WKBD_ROOTMENU
,
585 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
586 {"WindowListKey", "None", (void *)WKBD_WINDOWLIST
,
587 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
588 {"WindowMenuKey", "None", (void *)WKBD_WINDOWMENU
,
589 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
590 {"DockRaiseLowerKey", "None", (void*)WKBD_DOCKRAISELOWER
,
591 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
592 {"ClipRaiseLowerKey", "None", (void *)WKBD_CLIPRAISELOWER
,
593 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
594 {"MiniaturizeKey", "None", (void *)WKBD_MINIATURIZE
,
595 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
596 {"MinimizeAllKey", "None", (void *)WKBD_MINIMIZEALL
,
597 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
598 {"HideKey", "None", (void *)WKBD_HIDE
,
599 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
600 {"HideOthersKey", "None", (void *)WKBD_HIDE_OTHERS
,
601 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
602 {"MoveResizeKey", "None", (void *)WKBD_MOVERESIZE
,
603 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
604 {"CloseKey", "None", (void *)WKBD_CLOSE
,
605 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
606 {"MaximizeKey", "None", (void *)WKBD_MAXIMIZE
,
607 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
608 {"VMaximizeKey", "None", (void *)WKBD_VMAXIMIZE
,
609 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
610 {"HMaximizeKey", "None", (void *)WKBD_HMAXIMIZE
,
611 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
612 {"LHMaximizeKey", "None", (void*)WKBD_LHMAXIMIZE
,
613 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
614 {"RHMaximizeKey", "None", (void*)WKBD_RHMAXIMIZE
,
615 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
616 {"THMaximizeKey", "None", (void*)WKBD_THMAXIMIZE
,
617 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
618 {"BHMaximizeKey", "None", (void*)WKBD_BHMAXIMIZE
,
619 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
620 {"LTCMaximizeKey", "None", (void*)WKBD_LTCMAXIMIZE
,
621 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
622 {"RTCMaximizeKey", "None", (void*)WKBD_RTCMAXIMIZE
,
623 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
624 {"LBCMaximizeKey", "None", (void*)WKBD_LBCMAXIMIZE
,
625 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
626 {"RBCMaximizeKey", "None", (void*)WKBD_RBCMAXIMIZE
,
627 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
628 {"MaximusKey", "None", (void*)WKBD_MAXIMUS
,
629 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
630 {"RaiseKey", "\"Meta+Up\"", (void *)WKBD_RAISE
,
631 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
632 {"LowerKey", "\"Meta+Down\"", (void *)WKBD_LOWER
,
633 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
634 {"RaiseLowerKey", "None", (void *)WKBD_RAISELOWER
,
635 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
636 {"ShadeKey", "None", (void *)WKBD_SHADE
,
637 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
638 {"SelectKey", "None", (void *)WKBD_SELECT
,
639 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
640 {"FocusNextKey", "None", (void *)WKBD_FOCUSNEXT
,
641 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
642 {"FocusPrevKey", "None", (void *)WKBD_FOCUSPREV
,
643 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
644 {"GroupNextKey", "None", (void *)WKBD_GROUPNEXT
,
645 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
646 {"GroupPrevKey", "None", (void *)WKBD_GROUPPREV
,
647 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
648 {"NextWorkspaceKey", "None", (void *)WKBD_NEXTWORKSPACE
,
649 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
650 {"PrevWorkspaceKey", "None", (void *)WKBD_PREVWORKSPACE
,
651 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
652 {"LastWorkspaceKey", "None", (void *)WKBD_LASTWORKSPACE
,
653 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
654 {"NextWorkspaceLayerKey", "None", (void *)WKBD_NEXTWSLAYER
,
655 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
656 {"PrevWorkspaceLayerKey", "None", (void *)WKBD_PREVWSLAYER
,
657 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
658 {"Workspace1Key", "None", (void *)WKBD_WORKSPACE1
,
659 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
660 {"Workspace2Key", "None", (void *)WKBD_WORKSPACE2
,
661 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
662 {"Workspace3Key", "None", (void *)WKBD_WORKSPACE3
,
663 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
664 {"Workspace4Key", "None", (void *)WKBD_WORKSPACE4
,
665 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
666 {"Workspace5Key", "None", (void *)WKBD_WORKSPACE5
,
667 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
668 {"Workspace6Key", "None", (void *)WKBD_WORKSPACE6
,
669 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
670 {"Workspace7Key", "None", (void *)WKBD_WORKSPACE7
,
671 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
672 {"Workspace8Key", "None", (void *)WKBD_WORKSPACE8
,
673 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
674 {"Workspace9Key", "None", (void *)WKBD_WORKSPACE9
,
675 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
676 {"Workspace10Key", "None", (void *)WKBD_WORKSPACE10
,
677 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
678 {"MoveToWorkspace1Key", "None", (void *)WKBD_MOVE_WORKSPACE1
,
679 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
680 {"MoveToWorkspace2Key", "None", (void *)WKBD_MOVE_WORKSPACE2
,
681 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
682 {"MoveToWorkspace3Key", "None", (void *)WKBD_MOVE_WORKSPACE3
,
683 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
684 {"MoveToWorkspace4Key", "None", (void *)WKBD_MOVE_WORKSPACE4
,
685 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
686 {"MoveToWorkspace5Key", "None", (void *)WKBD_MOVE_WORKSPACE5
,
687 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
688 {"MoveToWorkspace6Key", "None", (void *)WKBD_MOVE_WORKSPACE6
,
689 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
690 {"MoveToWorkspace7Key", "None", (void *)WKBD_MOVE_WORKSPACE7
,
691 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
692 {"MoveToWorkspace8Key", "None", (void *)WKBD_MOVE_WORKSPACE8
,
693 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
694 {"MoveToWorkspace9Key", "None", (void *)WKBD_MOVE_WORKSPACE9
,
695 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
696 {"MoveToWorkspace10Key", "None", (void *)WKBD_MOVE_WORKSPACE10
,
697 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
698 {"MoveToNextWorkspaceKey", "None", (void *)WKBD_MOVE_NEXTWORKSPACE
,
699 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
700 {"MoveToPrevWorkspaceKey", "None", (void *)WKBD_MOVE_PREVWORKSPACE
,
701 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
702 {"MoveToLastWorkspaceKey", "None", (void *)WKBD_MOVE_LASTWORKSPACE
,
703 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
704 {"MoveToNextWorkspaceLayerKey", "None", (void *)WKBD_MOVE_NEXTWSLAYER
,
705 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
706 {"MoveToPrevWorkspaceLayerKey", "None", (void *)WKBD_MOVE_PREVWSLAYER
,
707 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
708 {"WindowShortcut1Key", "None", (void *)WKBD_WINDOW1
,
709 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
710 {"WindowShortcut2Key", "None", (void *)WKBD_WINDOW2
,
711 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
712 {"WindowShortcut3Key", "None", (void *)WKBD_WINDOW3
,
713 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
714 {"WindowShortcut4Key", "None", (void *)WKBD_WINDOW4
,
715 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
716 {"WindowShortcut5Key", "None", (void *)WKBD_WINDOW5
,
717 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
718 {"WindowShortcut6Key", "None", (void *)WKBD_WINDOW6
,
719 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
720 {"WindowShortcut7Key", "None", (void *)WKBD_WINDOW7
,
721 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
722 {"WindowShortcut8Key", "None", (void *)WKBD_WINDOW8
,
723 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
724 {"WindowShortcut9Key", "None", (void *)WKBD_WINDOW9
,
725 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
726 {"WindowShortcut10Key", "None", (void *)WKBD_WINDOW10
,
727 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
728 {"WindowRelaunchKey", "None", (void *)WKBD_RELAUNCH
,
729 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
730 {"ScreenSwitchKey", "None", (void *)WKBD_SWITCH_SCREEN
,
731 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
733 #ifdef KEEP_XKB_LOCK_STATUS
734 {"ToggleKbdModeKey", "None", (void *)WKBD_TOGGLE
,
735 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
736 {"KbdModeLock", "NO", NULL
,
737 &wPreferences
.modelock
, getBool
, NULL
, NULL
, NULL
},
738 #endif /* KEEP_XKB_LOCK_STATUS */
740 {"NormalCursor", "(builtin, left_ptr)", (void *)WCUR_ROOT
,
741 NULL
, getCursor
, setCursor
, NULL
, NULL
},
742 {"ArrowCursor", "(builtin, top_left_arrow)", (void *)WCUR_ARROW
,
743 NULL
, getCursor
, setCursor
, NULL
, NULL
},
744 {"MoveCursor", "(builtin, fleur)", (void *)WCUR_MOVE
,
745 NULL
, getCursor
, setCursor
, NULL
, NULL
},
746 {"ResizeCursor", "(builtin, sizing)", (void *)WCUR_RESIZE
,
747 NULL
, getCursor
, setCursor
, NULL
, NULL
},
748 {"TopLeftResizeCursor", "(builtin, top_left_corner)", (void *)WCUR_TOPLEFTRESIZE
,
749 NULL
, getCursor
, setCursor
, NULL
, NULL
},
750 {"TopRightResizeCursor", "(builtin, top_right_corner)", (void *)WCUR_TOPRIGHTRESIZE
,
751 NULL
, getCursor
, setCursor
, NULL
, NULL
},
752 {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)", (void *)WCUR_BOTTOMLEFTRESIZE
,
753 NULL
, getCursor
, setCursor
, NULL
, NULL
},
754 {"BottomRightResizeCursor", "(builtin, bottom_right_corner)", (void *)WCUR_BOTTOMRIGHTRESIZE
,
755 NULL
, getCursor
, setCursor
, NULL
, NULL
},
756 {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)", (void *)WCUR_VERTICALRESIZE
,
757 NULL
, getCursor
, setCursor
, NULL
, NULL
},
758 {"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)", (void *)WCUR_HORIZONRESIZE
,
759 NULL
, getCursor
, setCursor
, NULL
, NULL
},
760 {"WaitCursor", "(builtin, watch)", (void *)WCUR_WAIT
,
761 NULL
, getCursor
, setCursor
, NULL
, NULL
},
762 {"QuestionCursor", "(builtin, question_arrow)", (void *)WCUR_QUESTION
,
763 NULL
, getCursor
, setCursor
, NULL
, NULL
},
764 {"TextCursor", "(builtin, xterm)", (void *)WCUR_TEXT
,
765 NULL
, getCursor
, setCursor
, NULL
, NULL
},
766 {"SelectCursor", "(builtin, cross)", (void *)WCUR_SELECT
,
767 NULL
, getCursor
, setCursor
, NULL
, NULL
},
768 {"DialogHistoryLines", "500", NULL
,
769 &wPreferences
.history_lines
, getInt
, NULL
, NULL
, NULL
},
770 {"CycleActiveHeadOnly", "NO", NULL
,
771 &wPreferences
.cycle_active_head_only
, getBool
, NULL
, NULL
, NULL
},
772 {"CycleIgnoreMinimized", "NO", NULL
,
773 &wPreferences
.cycle_ignore_minimized
, getBool
, NULL
, NULL
, NULL
}
776 static void initDefaults(void)
779 WDefaultEntry
*entry
;
781 WMPLSetCaseSensitive(False
);
783 for (i
= 0; i
< sizeof(optionList
) / sizeof(optionList
[0]); i
++) {
784 entry
= &optionList
[i
];
786 entry
->plkey
= WMCreatePLString(entry
->key
);
787 if (entry
->default_value
)
788 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
790 entry
->plvalue
= NULL
;
793 for (i
= 0; i
< sizeof(staticOptionList
) / sizeof(staticOptionList
[0]); i
++) {
794 entry
= &staticOptionList
[i
];
796 entry
->plkey
= WMCreatePLString(entry
->key
);
797 if (entry
->default_value
)
798 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
800 entry
->plvalue
= NULL
;
804 static WMPropList
*readGlobalDomain(const char *domainName
, Bool requireDictionary
)
806 WMPropList
*globalDict
= NULL
;
810 snprintf(path
, sizeof(path
), "%s/%s/%s", SYSCONFDIR
, GLOBAL_DEFAULTS_SUBDIR
, domainName
);
811 if (stat(path
, &stbuf
) >= 0) {
812 globalDict
= WMReadPropListFromFile(path
);
813 if (globalDict
&& requireDictionary
&& !WMIsPLDictionary(globalDict
)) {
814 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"), domainName
, path
);
815 WMReleasePropList(globalDict
);
817 } else if (!globalDict
) {
818 wwarning(_("could not load domain %s from global defaults database"), domainName
);
825 #if defined(GLOBAL_PREAMBLE_MENU_FILE) || defined(GLOBAL_EPILOGUE_MENU_FILE)
826 static void prependMenu(WMPropList
* destarr
, WMPropList
* array
)
831 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
832 item
= WMGetFromPLArray(array
, i
);
834 WMInsertInPLArray(destarr
, i
+ 1, item
);
838 static void appendMenu(WMPropList
* destarr
, WMPropList
* array
)
843 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
844 item
= WMGetFromPLArray(array
, i
);
846 WMAddToPLArray(destarr
, item
);
851 void wDefaultsMergeGlobalMenus(WDDomain
* menuDomain
)
853 WMPropList
*menu
= menuDomain
->dictionary
;
856 if (!menu
|| !WMIsPLArray(menu
))
859 #ifdef GLOBAL_PREAMBLE_MENU_FILE
860 submenu
= WMReadPropListFromFile(SYSCONFDIR
"/" GLOBAL_DEFAULTS_SUBDIR
"/" GLOBAL_PREAMBLE_MENU_FILE
);
862 if (submenu
&& !WMIsPLArray(submenu
)) {
863 wwarning(_("invalid global menu file %s"), GLOBAL_PREAMBLE_MENU_FILE
);
864 WMReleasePropList(submenu
);
868 prependMenu(menu
, submenu
);
869 WMReleasePropList(submenu
);
873 #ifdef GLOBAL_EPILOGUE_MENU_FILE
874 submenu
= WMReadPropListFromFile(SYSCONFDIR
"/" GLOBAL_DEFAULTS_SUBDIR
"/" GLOBAL_EPILOGUE_MENU_FILE
);
876 if (submenu
&& !WMIsPLArray(submenu
)) {
877 wwarning(_("invalid global menu file %s"), GLOBAL_EPILOGUE_MENU_FILE
);
878 WMReleasePropList(submenu
);
882 appendMenu(menu
, submenu
);
883 WMReleasePropList(submenu
);
887 menuDomain
->dictionary
= menu
;
890 WDDomain
*wDefaultsInitDomain(const char *domain
, Bool requireDictionary
)
894 static int inited
= 0;
895 const char *the_path
;
896 WMPropList
*shared_dict
= NULL
;
903 db
= wmalloc(sizeof(WDDomain
));
904 db
->domain_name
= domain
;
905 db
->path
= wdefaultspathfordomain(domain
);
908 if (the_path
&& stat(the_path
, &stbuf
) >= 0) {
909 db
->dictionary
= WMReadPropListFromFile(the_path
);
910 if (db
->dictionary
) {
911 if (requireDictionary
&& !WMIsPLDictionary(db
->dictionary
)) {
912 WMReleasePropList(db
->dictionary
);
913 db
->dictionary
= NULL
;
914 wwarning(_("Domain %s (%s) of defaults database is corrupted!"), domain
, the_path
);
916 db
->timestamp
= stbuf
.st_mtime
;
918 wwarning(_("could not load domain %s from user defaults database"), domain
);
922 /* global system dictionary */
923 shared_dict
= readGlobalDomain(domain
, requireDictionary
);
925 if (shared_dict
&& db
->dictionary
&& WMIsPLDictionary(shared_dict
) &&
926 WMIsPLDictionary(db
->dictionary
)) {
927 WMMergePLDictionaries(shared_dict
, db
->dictionary
, True
);
928 WMReleasePropList(db
->dictionary
);
929 db
->dictionary
= shared_dict
;
930 if (stbuf
.st_mtime
> db
->timestamp
)
931 db
->timestamp
= stbuf
.st_mtime
;
932 } else if (!db
->dictionary
) {
933 db
->dictionary
= shared_dict
;
934 if (stbuf
.st_mtime
> db
->timestamp
)
935 db
->timestamp
= stbuf
.st_mtime
;
941 void wReadStaticDefaults(WMPropList
* dict
)
944 WDefaultEntry
*entry
;
948 for (i
= 0; i
< sizeof(staticOptionList
) / sizeof(staticOptionList
[0]); i
++) {
949 entry
= &staticOptionList
[i
];
952 plvalue
= WMGetFromPLDictionary(dict
, entry
->plkey
);
956 /* no default in the DB. Use builtin default */
958 plvalue
= entry
->plvalue
;
962 (*entry
->convert
) (NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
964 (*entry
->update
) (NULL
, entry
, tdata
, entry
->extra_data
);
969 void wDefaultsCheckDomains(void* arg
)
973 WMPropList
*shared_dict
= NULL
;
977 if (stat(WDWindowMaker
->path
, &stbuf
) >= 0 && WDWindowMaker
->timestamp
< stbuf
.st_mtime
) {
978 WDWindowMaker
->timestamp
= stbuf
.st_mtime
;
980 /* Global dictionary */
981 shared_dict
= readGlobalDomain("WindowMaker", True
);
983 /* User dictionary */
984 dict
= WMReadPropListFromFile(WDWindowMaker
->path
);
987 if (!WMIsPLDictionary(dict
)) {
988 WMReleasePropList(dict
);
990 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
991 "WindowMaker", WDWindowMaker
->path
);
994 WMMergePLDictionaries(shared_dict
, dict
, True
);
995 WMReleasePropList(dict
);
1000 for (i
= 0; i
< wScreenCount
; i
++) {
1001 scr
= wScreenWithNumber(i
);
1003 wReadDefaults(scr
, dict
);
1006 if (WDWindowMaker
->dictionary
)
1007 WMReleasePropList(WDWindowMaker
->dictionary
);
1009 WDWindowMaker
->dictionary
= dict
;
1012 wwarning(_("could not load domain %s from user defaults database"), "WindowMaker");
1016 WMReleasePropList(shared_dict
);
1020 if (stat(WDWindowAttributes
->path
, &stbuf
) >= 0 && WDWindowAttributes
->timestamp
< stbuf
.st_mtime
) {
1021 /* global dictionary */
1022 shared_dict
= readGlobalDomain("WMWindowAttributes", True
);
1023 /* user dictionary */
1024 dict
= WMReadPropListFromFile(WDWindowAttributes
->path
);
1026 if (!WMIsPLDictionary(dict
)) {
1027 WMReleasePropList(dict
);
1029 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1030 "WMWindowAttributes", WDWindowAttributes
->path
);
1033 WMMergePLDictionaries(shared_dict
, dict
, True
);
1034 WMReleasePropList(dict
);
1039 if (WDWindowAttributes
->dictionary
)
1040 WMReleasePropList(WDWindowAttributes
->dictionary
);
1042 WDWindowAttributes
->dictionary
= dict
;
1043 for (i
= 0; i
< wScreenCount
; i
++) {
1044 scr
= wScreenWithNumber(i
);
1046 wDefaultUpdateIcons(scr
);
1048 /* Update the panel image if changed */
1049 /* Don't worry. If the image is the same these
1050 * functions will have no performance impact. */
1051 create_logo_image(scr
);
1056 wwarning(_("could not load domain %s from user defaults database"), "WMWindowAttributes");
1059 WDWindowAttributes
->timestamp
= stbuf
.st_mtime
;
1061 WMReleasePropList(shared_dict
);
1064 if (stat(WDRootMenu
->path
, &stbuf
) >= 0 && WDRootMenu
->timestamp
< stbuf
.st_mtime
) {
1065 dict
= WMReadPropListFromFile(WDRootMenu
->path
);
1067 if (!WMIsPLArray(dict
) && !WMIsPLString(dict
)) {
1068 WMReleasePropList(dict
);
1070 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1071 "WMRootMenu", WDRootMenu
->path
);
1073 if (WDRootMenu
->dictionary
)
1074 WMReleasePropList(WDRootMenu
->dictionary
);
1076 WDRootMenu
->dictionary
= dict
;
1077 wDefaultsMergeGlobalMenus(WDRootMenu
);
1080 wwarning(_("could not load domain %s from user defaults database"), "WMRootMenu");
1082 WDRootMenu
->timestamp
= stbuf
.st_mtime
;
1084 #ifndef HAVE_INOTIFY
1086 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, arg
);
1090 void wReadDefaults(WScreen
* scr
, WMPropList
* new_dict
)
1092 WMPropList
*plvalue
, *old_value
;
1093 WDefaultEntry
*entry
;
1095 int update_workspace_back
= 0; /* kluge :/ */
1096 unsigned int needs_refresh
;
1098 WMPropList
*old_dict
= (WDWindowMaker
->dictionary
!= new_dict
? WDWindowMaker
->dictionary
: NULL
);
1102 for (i
= 0; i
< sizeof(optionList
) / sizeof(optionList
[0]); i
++) {
1103 entry
= &optionList
[i
];
1106 plvalue
= WMGetFromPLDictionary(new_dict
, entry
->plkey
);
1113 old_value
= WMGetFromPLDictionary(old_dict
, entry
->plkey
);
1115 if (!plvalue
&& !old_value
) {
1116 /* no default in the DB. Use builtin default */
1117 plvalue
= entry
->plvalue
;
1118 if (plvalue
&& new_dict
)
1119 WMPutInPLDictionary(new_dict
, entry
->plkey
, plvalue
);
1121 } else if (!plvalue
) {
1122 /* value was deleted from DB. Keep current value */
1124 } else if (!old_value
) {
1125 /* set value for the 1st time */
1126 } else if (!WMIsPropListEqualTo(plvalue
, old_value
)) {
1127 /* value has changed */
1129 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1130 && update_workspace_back
&& scr
->flags
.backimage_helper_launched
) {
1132 /* value was not changed since last time */
1139 if ((*entry
->convert
) (scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1141 * If the WorkspaceSpecificBack data has been changed
1142 * so that the helper will be launched now, we must be
1143 * sure to send the default background texture config
1146 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0 &&
1147 !scr
->flags
.backimage_helper_launched
)
1148 update_workspace_back
= 1;
1151 needs_refresh
|= (*entry
->update
) (scr
, entry
, tdata
, entry
->extra_data
);
1157 if (needs_refresh
!= 0 && !scr
->flags
.startup
) {
1161 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1162 foo
|= WTextureSettings
;
1163 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1164 foo
|= WFontSettings
;
1165 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1166 foo
|= WColorSettings
;
1168 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1169 (void *)(uintptr_t) foo
);
1172 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1173 foo
|= WTextureSettings
;
1174 if (needs_refresh
& REFRESH_MENU_FONT
)
1175 foo
|= WFontSettings
;
1176 if (needs_refresh
& REFRESH_MENU_COLOR
)
1177 foo
|= WColorSettings
;
1179 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1182 if (needs_refresh
& REFRESH_WINDOW_FONT
)
1183 foo
|= WFontSettings
;
1184 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
)
1185 foo
|= WTextureSettings
;
1186 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
)
1187 foo
|= WColorSettings
;
1189 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1191 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1193 if (needs_refresh
& REFRESH_ICON_FONT
)
1194 foo
|= WFontSettings
;
1195 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
)
1196 foo
|= WTextureSettings
;
1197 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
)
1198 foo
|= WTextureSettings
;
1200 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1201 (void *)(uintptr_t) foo
);
1203 if (needs_refresh
& REFRESH_ICON_TILE
)
1204 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1206 if (needs_refresh
& REFRESH_WORKSPACE_MENU
) {
1207 if (scr
->workspace_menu
)
1208 wWorkspaceMenuUpdate(scr
, scr
->workspace_menu
);
1209 if (scr
->clip_ws_menu
)
1210 wWorkspaceMenuUpdate(scr
, scr
->clip_ws_menu
);
1211 if (scr
->workspace_submenu
)
1212 scr
->workspace_submenu
->flags
.realized
= 0;
1213 if (scr
->clip_submenu
)
1214 scr
->clip_submenu
->flags
.realized
= 0;
1219 void wDefaultUpdateIcons(WScreen
*scr
)
1221 WAppIcon
*aicon
= scr
->app_icon_list
;
1223 WWindow
*wwin
= scr
->focused_window
;
1226 /* Get the application icon, default included */
1227 wIconChangeImageFile(aicon
->icon
, NULL
);
1228 wAppIconPaint(aicon
);
1229 aicon
= aicon
->next
;
1232 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
)
1233 wClipIconPaint(scr
->clip_icon
);
1235 for (dc
= scr
->drawers
; dc
!= NULL
; dc
= dc
->next
)
1236 wDrawerIconPaint(dc
->adrawer
->icon_array
[0]);
1239 if (wwin
->icon
&& wwin
->flags
.miniaturized
)
1240 wIconChangeImageFile(wwin
->icon
, NULL
);
1245 /* --------------------------- Local ----------------------- */
1247 #define GET_STRING_OR_DEFAULT(x, var) if (!WMIsPLString(value)) { \
1248 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1250 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1251 var = entry->default_value;\
1252 } else var = WMGetFromPLString(value)\
1255 static int string2index(WMPropList *key, WMPropList *val, const char *def, WOptionEnumeration * values)
1258 WOptionEnumeration
*v
;
1259 char buffer
[TOTAL_VALUES_LENGTH
];
1261 if (WMIsPLString(val
) && (str
= WMGetFromPLString(val
))) {
1262 for (v
= values
; v
->string
!= NULL
; v
++) {
1263 if (strcasecmp(v
->string
, str
) == 0)
1269 for (v
= values
; v
->string
!= NULL
; v
++) {
1272 strcat(buffer
, ", ");
1273 snprintf(buffer
+strlen(buffer
),
1274 sizeof(buffer
)-strlen(buffer
)-1, "\"%s\"", v
->string
);
1277 wwarning(_("wrong option value for key \"%s\"; got \"%s\", should be one of %s."),
1278 WMGetFromPLString(key
),
1279 WMIsPLString(val
) ? WMGetFromPLString(val
) : "(unknown)",
1283 return string2index(key
, val
, NULL
, values
);
1290 * value - is the value in the defaults DB
1291 * addr - is the address to store the data
1292 * ret - is the address to store a pointer to a temporary buffer. ret
1293 * must not be freed and is used by the set functions
1295 static int getBool(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1299 int second_pass
= 0;
1301 GET_STRING_OR_DEFAULT("Boolean", val
);
1304 if ((val
[1] == '\0' && (val
[0] == 'y' || val
[0] == 'Y'))
1305 || strcasecmp(val
, "YES") == 0) {
1308 } else if ((val
[1] == '\0' && (val
[0] == 'n' || val
[0] == 'N'))
1309 || strcasecmp(val
, "NO") == 0) {
1313 if (sscanf(val
, "%i", &i
) == 1) {
1319 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""), val
, entry
->key
);
1320 if (second_pass
== 0) {
1321 val
= WMGetFromPLString(entry
->plvalue
);
1323 wwarning(_("using default \"%s\" instead"), val
);
1333 *(char *)addr
= data
;
1338 static int getInt(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1343 GET_STRING_OR_DEFAULT("Integer", val
);
1345 if (sscanf(val
, "%i", &data
) != 1) {
1346 wwarning(_("can't convert \"%s\" to integer for key \"%s\""), val
, entry
->key
);
1347 val
= WMGetFromPLString(entry
->plvalue
);
1348 wwarning(_("using default \"%s\" instead"), val
);
1349 if (sscanf(val
, "%i", &data
) != 1) {
1357 *(int *)addr
= data
;
1362 static int getCoord(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1365 char *val_x
, *val_y
;
1366 int nelem
, changed
= 0;
1367 WMPropList
*elem_x
, *elem_y
;
1370 if (!WMIsPLArray(value
)) {
1371 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Coordinate");
1373 value
= entry
->plvalue
;
1375 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1381 nelem
= WMGetPropListItemCount(value
);
1383 wwarning(_("Incorrect number of elements in array for key \"%s\"."), entry
->key
);
1385 value
= entry
->plvalue
;
1387 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1393 elem_x
= WMGetFromPLArray(value
, 0);
1394 elem_y
= WMGetFromPLArray(value
, 1);
1396 if (!elem_x
|| !elem_y
|| !WMIsPLString(elem_x
) || !WMIsPLString(elem_y
)) {
1397 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."), entry
->key
);
1399 value
= entry
->plvalue
;
1401 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1407 val_x
= WMGetFromPLString(elem_x
);
1408 val_y
= WMGetFromPLString(elem_y
);
1410 if (sscanf(val_x
, "%i", &data
.x
) != 1 || sscanf(val_y
, "%i", &data
.y
) != 1) {
1411 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1413 value
= entry
->plvalue
;
1415 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1423 else if (data
.x
> scr
->scr_width
/ 3)
1424 data
.x
= scr
->scr_width
/ 3;
1427 else if (data
.y
> scr
->scr_height
/ 3)
1428 data
.y
= scr
->scr_height
/ 3;
1433 *(WCoord
*) addr
= data
;
1438 static int getPropList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1440 WMRetainPropList(value
);
1447 static int getPathList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1456 if (!WMIsPLArray(value
)) {
1457 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "an array of paths");
1459 value
= entry
->plvalue
;
1461 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1468 count
= WMGetPropListItemCount(value
);
1471 value
= entry
->plvalue
;
1473 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1480 for (i
= 0; i
< count
; i
++) {
1481 d
= WMGetFromPLArray(value
, i
);
1482 if (!d
|| !WMIsPLString(d
)) {
1486 len
+= strlen(WMGetFromPLString(d
)) + 1;
1489 ptr
= data
= wmalloc(len
+ 1);
1491 for (i
= 0; i
< count
; i
++) {
1492 d
= WMGetFromPLArray(value
, i
);
1493 if (!d
|| !WMIsPLString(d
)) {
1496 strcpy(ptr
, WMGetFromPLString(d
));
1497 ptr
+= strlen(WMGetFromPLString(d
));
1504 if (*(char **)addr
!= NULL
) {
1505 wfree(*(char **)addr
);
1507 *(char **)addr
= data
;
1512 static int getEnum(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1514 static signed char data
;
1516 data
= string2index(entry
->plkey
, value
, entry
->default_value
, (WOptionEnumeration
*) entry
->extra_data
);
1523 *(signed char *)addr
= data
;
1530 * (hgradient <color> <color>)
1531 * (vgradient <color> <color>)
1532 * (dgradient <color> <color>)
1533 * (mhgradient <color> <color> ...)
1534 * (mvgradient <color> <color> ...)
1535 * (mdgradient <color> <color> ...)
1536 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1537 * (tpixmap <file> <color>)
1538 * (spixmap <file> <color>)
1539 * (cpixmap <file> <color>)
1540 * (thgradient <file> <opaqueness> <color> <color>)
1541 * (tvgradient <file> <opaqueness> <color> <color>)
1542 * (tdgradient <file> <opaqueness> <color> <color>)
1543 * (function <lib> <function> ...)
1546 static WTexture
*parse_texture(WScreen
* scr
, WMPropList
* pl
)
1551 WTexture
*texture
= NULL
;
1553 nelem
= WMGetPropListItemCount(pl
);
1557 elem
= WMGetFromPLArray(pl
, 0);
1558 if (!elem
|| !WMIsPLString(elem
))
1560 val
= WMGetFromPLString(elem
);
1562 if (strcasecmp(val
, "solid") == 0) {
1570 elem
= WMGetFromPLArray(pl
, 1);
1571 if (!elem
|| !WMIsPLString(elem
))
1573 val
= WMGetFromPLString(elem
);
1575 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1576 wwarning(_("\"%s\" is not a valid color name"), val
);
1580 texture
= (WTexture
*) wTextureMakeSolid(scr
, &color
);
1581 } else if (strcasecmp(val
, "dgradient") == 0
1582 || strcasecmp(val
, "vgradient") == 0 || strcasecmp(val
, "hgradient") == 0) {
1583 RColor color1
, color2
;
1588 wwarning(_("bad number of arguments in gradient specification"));
1592 if (val
[0] == 'd' || val
[0] == 'D')
1593 type
= WTEX_DGRADIENT
;
1594 else if (val
[0] == 'h' || val
[0] == 'H')
1595 type
= WTEX_HGRADIENT
;
1597 type
= WTEX_VGRADIENT
;
1599 /* get from color */
1600 elem
= WMGetFromPLArray(pl
, 1);
1601 if (!elem
|| !WMIsPLString(elem
))
1603 val
= WMGetFromPLString(elem
);
1605 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1606 wwarning(_("\"%s\" is not a valid color name"), val
);
1610 color1
.red
= xcolor
.red
>> 8;
1611 color1
.green
= xcolor
.green
>> 8;
1612 color1
.blue
= xcolor
.blue
>> 8;
1615 elem
= WMGetFromPLArray(pl
, 2);
1616 if (!elem
|| !WMIsPLString(elem
)) {
1619 val
= WMGetFromPLString(elem
);
1621 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1622 wwarning(_("\"%s\" is not a valid color name"), val
);
1626 color2
.red
= xcolor
.red
>> 8;
1627 color2
.green
= xcolor
.green
>> 8;
1628 color2
.blue
= xcolor
.blue
>> 8;
1630 texture
= (WTexture
*) wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1632 } else if (strcasecmp(val
, "igradient") == 0) {
1633 RColor colors1
[2], colors2
[2];
1639 wwarning(_("bad number of arguments in gradient specification"));
1643 /* get from color */
1644 for (i
= 0; i
< 2; i
++) {
1645 elem
= WMGetFromPLArray(pl
, 1 + i
);
1646 if (!elem
|| !WMIsPLString(elem
))
1648 val
= WMGetFromPLString(elem
);
1650 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1651 wwarning(_("\"%s\" is not a valid color name"), val
);
1654 colors1
[i
].alpha
= 255;
1655 colors1
[i
].red
= xcolor
.red
>> 8;
1656 colors1
[i
].green
= xcolor
.green
>> 8;
1657 colors1
[i
].blue
= xcolor
.blue
>> 8;
1659 elem
= WMGetFromPLArray(pl
, 3);
1660 if (!elem
|| !WMIsPLString(elem
))
1662 val
= WMGetFromPLString(elem
);
1665 /* get from color */
1666 for (i
= 0; i
< 2; i
++) {
1667 elem
= WMGetFromPLArray(pl
, 4 + i
);
1668 if (!elem
|| !WMIsPLString(elem
))
1670 val
= WMGetFromPLString(elem
);
1672 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1673 wwarning(_("\"%s\" is not a valid color name"), val
);
1676 colors2
[i
].alpha
= 255;
1677 colors2
[i
].red
= xcolor
.red
>> 8;
1678 colors2
[i
].green
= xcolor
.green
>> 8;
1679 colors2
[i
].blue
= xcolor
.blue
>> 8;
1681 elem
= WMGetFromPLArray(pl
, 6);
1682 if (!elem
|| !WMIsPLString(elem
))
1684 val
= WMGetFromPLString(elem
);
1687 texture
= (WTexture
*) wTextureMakeIGradient(scr
, th1
, colors1
, th2
, colors2
);
1689 } else if (strcasecmp(val
, "mhgradient") == 0
1690 || strcasecmp(val
, "mvgradient") == 0 || strcasecmp(val
, "mdgradient") == 0) {
1697 wwarning(_("too few arguments in multicolor gradient specification"));
1701 if (val
[1] == 'h' || val
[1] == 'H')
1702 type
= WTEX_MHGRADIENT
;
1703 else if (val
[1] == 'v' || val
[1] == 'V')
1704 type
= WTEX_MVGRADIENT
;
1706 type
= WTEX_MDGRADIENT
;
1710 colors
= wmalloc(sizeof(RColor
*) * (count
+ 1));
1712 for (i
= 0; i
< count
; i
++) {
1713 elem
= WMGetFromPLArray(pl
, i
+ 1);
1714 if (!elem
|| !WMIsPLString(elem
)) {
1715 for (--i
; i
>= 0; --i
) {
1721 val
= WMGetFromPLString(elem
);
1723 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1724 wwarning(_("\"%s\" is not a valid color name"), val
);
1725 for (--i
; i
>= 0; --i
) {
1731 colors
[i
] = wmalloc(sizeof(RColor
));
1732 colors
[i
]->red
= color
.red
>> 8;
1733 colors
[i
]->green
= color
.green
>> 8;
1734 colors
[i
]->blue
= color
.blue
>> 8;
1739 texture
= (WTexture
*) wTextureMakeMGradient(scr
, type
, colors
);
1740 } else if (strcasecmp(val
, "spixmap") == 0 ||
1741 strcasecmp(val
, "cpixmap") == 0 || strcasecmp(val
, "tpixmap") == 0) {
1748 if (val
[0] == 's' || val
[0] == 'S')
1750 else if (val
[0] == 'c' || val
[0] == 'C')
1756 elem
= WMGetFromPLArray(pl
, 2);
1757 if (!elem
|| !WMIsPLString(elem
)) {
1760 val
= WMGetFromPLString(elem
);
1762 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1763 wwarning(_("\"%s\" is not a valid color name"), val
);
1768 elem
= WMGetFromPLArray(pl
, 1);
1769 if (!elem
|| !WMIsPLString(elem
))
1771 val
= WMGetFromPLString(elem
);
1773 texture
= (WTexture
*) wTextureMakePixmap(scr
, type
, val
, &color
);
1774 } else if (strcasecmp(val
, "thgradient") == 0
1775 || strcasecmp(val
, "tvgradient") == 0 || strcasecmp(val
, "tdgradient") == 0) {
1776 RColor color1
, color2
;
1781 if (val
[1] == 'h' || val
[1] == 'H')
1782 style
= WTEX_THGRADIENT
;
1783 else if (val
[1] == 'v' || val
[1] == 'V')
1784 style
= WTEX_TVGRADIENT
;
1786 style
= WTEX_TDGRADIENT
;
1789 wwarning(_("bad number of arguments in textured gradient specification"));
1793 /* get from color */
1794 elem
= WMGetFromPLArray(pl
, 3);
1795 if (!elem
|| !WMIsPLString(elem
))
1797 val
= WMGetFromPLString(elem
);
1799 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1800 wwarning(_("\"%s\" is not a valid color name"), val
);
1804 color1
.red
= xcolor
.red
>> 8;
1805 color1
.green
= xcolor
.green
>> 8;
1806 color1
.blue
= xcolor
.blue
>> 8;
1809 elem
= WMGetFromPLArray(pl
, 4);
1810 if (!elem
|| !WMIsPLString(elem
)) {
1813 val
= WMGetFromPLString(elem
);
1815 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1816 wwarning(_("\"%s\" is not a valid color name"), val
);
1820 color2
.red
= xcolor
.red
>> 8;
1821 color2
.green
= xcolor
.green
>> 8;
1822 color2
.blue
= xcolor
.blue
>> 8;
1825 elem
= WMGetFromPLArray(pl
, 2);
1826 if (!elem
|| !WMIsPLString(elem
))
1829 val
= WMGetFromPLString(elem
);
1831 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
1832 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
1837 elem
= WMGetFromPLArray(pl
, 1);
1838 if (!elem
|| !WMIsPLString(elem
))
1840 val
= WMGetFromPLString(elem
);
1842 texture
= (WTexture
*) wTextureMakeTGradient(scr
, style
, &color1
, &color2
, val
, opacity
);
1843 } else if (strcasecmp(val
, "function") == 0) {
1844 /* Leave this in to handle the unlikely case of
1845 * someone actually having function textures configured */
1846 wwarning("function texture support has been removed");
1849 wwarning(_("invalid texture type %s"), val
);
1855 static int getTexture(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1857 static WTexture
*texture
;
1861 if (!WMIsPLArray(value
)) {
1862 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Texture");
1864 value
= entry
->plvalue
;
1866 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1872 if (strcmp(entry
->key
, "WidgetColor") == 0 && !changed
) {
1875 pl
= WMGetFromPLArray(value
, 0);
1876 if (!pl
|| !WMIsPLString(pl
) || !WMGetFromPLString(pl
)
1877 || strcasecmp(WMGetFromPLString(pl
), "solid") != 0) {
1878 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1879 entry
->key
, "Solid Texture");
1881 value
= entry
->plvalue
;
1883 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1888 texture
= parse_texture(scr
, value
);
1891 wwarning(_("Error in texture specification for key \"%s\""), entry
->key
);
1893 value
= entry
->plvalue
;
1895 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1905 *(WTexture
**) addr
= texture
;
1910 static int getWSBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1918 if (!WMIsPLArray(value
)) {
1919 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1920 "WorkspaceBack", "Texture or None");
1922 value
= entry
->plvalue
;
1924 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1930 /* only do basic error checking and verify for None texture */
1932 nelem
= WMGetPropListItemCount(value
);
1934 elem
= WMGetFromPLArray(value
, 0);
1935 if (!elem
|| !WMIsPLString(elem
)) {
1936 wwarning(_("Wrong type for workspace background. Should be a texture type."));
1938 value
= entry
->plvalue
;
1940 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1945 val
= WMGetFromPLString(elem
);
1947 if (strcasecmp(val
, "None") == 0)
1950 *ret
= WMRetainPropList(value
);
1956 getWSSpecificBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1963 if (!WMIsPLArray(value
)) {
1964 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1965 "WorkspaceSpecificBack", "an array of textures");
1967 value
= entry
->plvalue
;
1969 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1975 /* only do basic error checking and verify for None texture */
1977 nelem
= WMGetPropListItemCount(value
);
1980 elem
= WMGetFromPLArray(value
, nelem
);
1981 if (!elem
|| !WMIsPLArray(elem
)) {
1982 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
1988 *ret
= WMRetainPropList(value
);
1992 * Kluge to force wmsetbg helper to set the default background.
1993 * If the WorkspaceSpecificBack is changed once wmaker has started,
1994 * the WorkspaceBack won't be sent to the helper, unless the user
1995 * changes it's value too. So, we must force this by removing the
1996 * value from the defaults DB.
1998 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
1999 WMPropList
*key
= WMCreatePLString("WorkspaceBack");
2001 WMRemoveFromPLDictionary(WDWindowMaker
->dictionary
, key
);
2003 WMReleasePropList(key
);
2009 static int getFont(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2011 static WMFont
*font
;
2014 GET_STRING_OR_DEFAULT("Font", val
);
2016 font
= WMCreateFont(scr
->wmscreen
, val
);
2018 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2021 wfatal(_("could not load any usable font!!!"));
2028 /* can't assign font value outside update function */
2029 wassertrv(addr
== NULL
, True
);
2034 static int getColor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2036 static XColor color
;
2038 int second_pass
= 0;
2040 GET_STRING_OR_DEFAULT("Color", val
);
2043 if (!wGetColor(scr
, val
, &color
)) {
2044 wwarning(_("could not get color for key \"%s\""), entry
->key
);
2045 if (second_pass
== 0) {
2046 val
= WMGetFromPLString(entry
->plvalue
);
2048 wwarning(_("using default \"%s\" instead"), val
);
2057 assert(addr
== NULL
);
2060 *(unsigned long*)addr = pixel;
2066 static int getKeybind(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2068 static WShortKey shortcut
;
2072 char buf
[MAX_SHORTCUT_LENGTH
], *b
;
2074 GET_STRING_OR_DEFAULT("Key spec", val
);
2076 if (!val
|| strcasecmp(val
, "NONE") == 0) {
2077 shortcut
.keycode
= 0;
2078 shortcut
.modifier
= 0;
2084 wstrlcpy(buf
, val
, MAX_SHORTCUT_LENGTH
);
2089 shortcut
.modifier
= 0;
2090 while ((k
= strchr(b
, '+')) != NULL
) {
2094 mod
= wXModifierFromKey(b
);
2096 wwarning(_("%s: invalid key modifier \"%s\""), entry
->key
, b
);
2099 shortcut
.modifier
|= mod
;
2105 ksym
= XStringToKeysym(b
);
2107 if (ksym
== NoSymbol
) {
2108 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
, val
);
2112 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2113 if (shortcut
.keycode
== 0) {
2114 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2124 static int getModMask(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2129 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2134 mask
= wXModifierFromKey(str
);
2136 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2142 *(int *)addr
= mask
;
2150 # include <X11/cursorfont.h>
2156 #define CURSOR_ID_NONE (XC_num_glyphs)
2158 static const WCursorLookup cursor_table
[] = {
2159 {"X_cursor", XC_X_cursor
},
2160 {"arrow", XC_arrow
},
2161 {"based_arrow_down", XC_based_arrow_down
},
2162 {"based_arrow_up", XC_based_arrow_up
},
2164 {"bogosity", XC_bogosity
},
2165 {"bottom_left_corner", XC_bottom_left_corner
},
2166 {"bottom_right_corner", XC_bottom_right_corner
},
2167 {"bottom_side", XC_bottom_side
},
2168 {"bottom_tee", XC_bottom_tee
},
2169 {"box_spiral", XC_box_spiral
},
2170 {"center_ptr", XC_center_ptr
},
2171 {"circle", XC_circle
},
2172 {"clock", XC_clock
},
2173 {"coffee_mug", XC_coffee_mug
},
2174 {"cross", XC_cross
},
2175 {"cross_reverse", XC_cross_reverse
},
2176 {"crosshair", XC_crosshair
},
2177 {"diamond_cross", XC_diamond_cross
},
2179 {"dotbox", XC_dotbox
},
2180 {"double_arrow", XC_double_arrow
},
2181 {"draft_large", XC_draft_large
},
2182 {"draft_small", XC_draft_small
},
2183 {"draped_box", XC_draped_box
},
2184 {"exchange", XC_exchange
},
2185 {"fleur", XC_fleur
},
2186 {"gobbler", XC_gobbler
},
2187 {"gumby", XC_gumby
},
2188 {"hand1", XC_hand1
},
2189 {"hand2", XC_hand2
},
2190 {"heart", XC_heart
},
2192 {"iron_cross", XC_iron_cross
},
2193 {"left_ptr", XC_left_ptr
},
2194 {"left_side", XC_left_side
},
2195 {"left_tee", XC_left_tee
},
2196 {"leftbutton", XC_leftbutton
},
2197 {"ll_angle", XC_ll_angle
},
2198 {"lr_angle", XC_lr_angle
},
2200 {"middlebutton", XC_middlebutton
},
2201 {"mouse", XC_mouse
},
2202 {"pencil", XC_pencil
},
2203 {"pirate", XC_pirate
},
2205 {"question_arrow", XC_question_arrow
},
2206 {"right_ptr", XC_right_ptr
},
2207 {"right_side", XC_right_side
},
2208 {"right_tee", XC_right_tee
},
2209 {"rightbutton", XC_rightbutton
},
2210 {"rtl_logo", XC_rtl_logo
},
2211 {"sailboat", XC_sailboat
},
2212 {"sb_down_arrow", XC_sb_down_arrow
},
2213 {"sb_h_double_arrow", XC_sb_h_double_arrow
},
2214 {"sb_left_arrow", XC_sb_left_arrow
},
2215 {"sb_right_arrow", XC_sb_right_arrow
},
2216 {"sb_up_arrow", XC_sb_up_arrow
},
2217 {"sb_v_double_arrow", XC_sb_v_double_arrow
},
2218 {"shuttle", XC_shuttle
},
2219 {"sizing", XC_sizing
},
2220 {"spider", XC_spider
},
2221 {"spraycan", XC_spraycan
},
2223 {"target", XC_target
},
2224 {"tcross", XC_tcross
},
2225 {"top_left_arrow", XC_top_left_arrow
},
2226 {"top_left_corner", XC_top_left_corner
},
2227 {"top_right_corner", XC_top_right_corner
},
2228 {"top_side", XC_top_side
},
2229 {"top_tee", XC_top_tee
},
2231 {"ul_angle", XC_ul_angle
},
2232 {"umbrella", XC_umbrella
},
2233 {"ur_angle", XC_ur_angle
},
2234 {"watch", XC_watch
},
2235 {"xterm", XC_xterm
},
2236 {NULL
, CURSOR_ID_NONE
}
2239 static void check_bitmap_status(int status
, const char *filename
, Pixmap bitmap
)
2242 case BitmapOpenFailed
:
2243 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2245 case BitmapFileInvalid
:
2246 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2248 case BitmapNoMemory
:
2249 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2252 XFreePixmap(dpy
, bitmap
);
2259 * (builtin, <cursor_name>)
2260 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2262 static int parse_cursor(WScreen
* scr
, WMPropList
* pl
, Cursor
* cursor
)
2269 nelem
= WMGetPropListItemCount(pl
);
2273 elem
= WMGetFromPLArray(pl
, 0);
2274 if (!elem
|| !WMIsPLString(elem
)) {
2277 val
= WMGetFromPLString(elem
);
2279 if (strcasecmp(val
, "none") == 0) {
2282 } else if (strcasecmp(val
, "builtin") == 0) {
2284 int cursor_id
= CURSOR_ID_NONE
;
2287 wwarning(_("bad number of arguments in cursor specification"));
2290 elem
= WMGetFromPLArray(pl
, 1);
2291 if (!elem
|| !WMIsPLString(elem
)) {
2294 val
= WMGetFromPLString(elem
);
2296 for (i
= 0; cursor_table
[i
].name
!= NULL
; i
++) {
2297 if (strcasecmp(val
, cursor_table
[i
].name
) == 0) {
2298 cursor_id
= cursor_table
[i
].id
;
2302 if (CURSOR_ID_NONE
== cursor_id
) {
2303 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2305 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2308 } else if (strcasecmp(val
, "bitmap") == 0) {
2320 wwarning(_("bad number of arguments in cursor specification"));
2323 elem
= WMGetFromPLArray(pl
, 1);
2324 if (!elem
|| !WMIsPLString(elem
)) {
2327 val
= WMGetFromPLString(elem
);
2328 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2330 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2333 elem
= WMGetFromPLArray(pl
, 2);
2334 if (!elem
|| !WMIsPLString(elem
)) {
2338 val
= WMGetFromPLString(elem
);
2339 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2342 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2345 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
, &mask
, &x
, &y
);
2346 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
, &bitmap
, &x
, &y
);
2347 if ((BitmapSuccess
== bitmap_status
) && (BitmapSuccess
== mask_status
)) {
2348 fg
.pixel
= scr
->black_pixel
;
2349 bg
.pixel
= scr
->white_pixel
;
2350 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2351 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2352 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2355 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2356 check_bitmap_status(mask_status
, mask_name
, mask
);
2363 static int getCursor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2365 static Cursor cursor
;
2370 if (!WMIsPLArray(value
)) {
2371 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2372 entry
->key
, "cursor specification");
2374 value
= entry
->plvalue
;
2376 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2381 status
= parse_cursor(scr
, value
, &cursor
);
2383 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2385 value
= entry
->plvalue
;
2387 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2396 *(Cursor
*) addr
= cursor
;
2401 #undef CURSOR_ID_NONE
2403 /* ---------------- value setting functions --------------- */
2404 static int setJustify(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2406 return REFRESH_WINDOW_TITLE_COLOR
;
2409 static int setClearance(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2411 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
| REFRESH_MENU_TITLE_FONT
| REFRESH_MENU_FONT
;
2414 static int setIfDockPresent(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2417 long which
= (long) extra_data
;
2421 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2422 // Drawers require the dock
2423 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| wPreferences
.flags
.nodock
;
2426 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2429 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| *flag
;
2437 static int setClipMergedInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2441 wPreferences
.flags
.clip_merged_in_dock
= *flag
;
2442 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2446 static int setWrapAppiconsInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2450 wPreferences
.flags
.wrap_appicons_in_dock
= *flag
;
2454 static int setStickyIcons(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2456 if (scr
->workspaces
) {
2457 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2458 wArrangeIcons(scr
, False
);
2463 static int setIconTile(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2467 WTexture
** texture
= tdata
;
2470 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2471 wPreferences
.icon_size
, ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2472 ? WREL_ICON
: WREL_FLAT
);
2474 wwarning(_("could not render texture for icon background"));
2476 wTextureDestroy(scr
, *texture
);
2479 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2481 if (scr
->icon_tile
) {
2483 RReleaseImage(scr
->icon_tile
);
2484 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2487 scr
->icon_tile
= img
;
2489 /* put the icon in the noticeboard hint */
2490 PropSetIconTileHint(scr
, img
);
2492 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
) {
2493 if (scr
->clip_tile
) {
2494 RReleaseImage(scr
->clip_tile
);
2496 scr
->clip_tile
= wClipMakeTile(scr
, img
);
2499 if (!wPreferences
.flags
.nodrawer
) {
2500 if (scr
->drawer_tile
) {
2501 RReleaseImage(scr
->drawer_tile
);
2503 scr
->drawer_tile
= wDrawerMakeTile(scr
, img
);
2506 scr
->icon_tile_pixmap
= pixmap
;
2508 if (scr
->def_icon_rimage
) {
2509 RReleaseImage(scr
->def_icon_rimage
);
2510 scr
->def_icon_rimage
= NULL
;
2513 if (scr
->icon_back_texture
)
2514 wTextureDestroy(scr
, (WTexture
*) scr
->icon_back_texture
);
2516 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2518 /* Free the texture as nobody else will use it, nor refer to it. */
2520 wTextureDestroy(scr
, *texture
);
2522 return (reset
? REFRESH_ICON_TILE
: 0);
2525 static int setWinTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2527 WMFont
*font
= tdata
;
2529 if (scr
->title_font
) {
2530 WMReleaseFont(scr
->title_font
);
2532 scr
->title_font
= font
;
2534 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
;
2537 static int setMenuTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2539 WMFont
*font
= tdata
;
2541 if (scr
->menu_title_font
) {
2542 WMReleaseFont(scr
->menu_title_font
);
2545 scr
->menu_title_font
= font
;
2547 return REFRESH_MENU_TITLE_FONT
;
2550 static int setMenuTextFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2552 WMFont
*font
= tdata
;
2554 if (scr
->menu_entry_font
) {
2555 WMReleaseFont(scr
->menu_entry_font
);
2557 scr
->menu_entry_font
= font
;
2559 return REFRESH_MENU_FONT
;
2562 static int setIconTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2564 WMFont
*font
= tdata
;
2566 if (scr
->icon_title_font
) {
2567 WMReleaseFont(scr
->icon_title_font
);
2570 scr
->icon_title_font
= font
;
2572 return REFRESH_ICON_FONT
;
2575 static int setClipTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2577 WMFont
*font
= tdata
;
2579 if (scr
->clip_title_font
) {
2580 WMReleaseFont(scr
->clip_title_font
);
2583 scr
->clip_title_font
= font
;
2585 return REFRESH_ICON_FONT
;
2588 static int setLargeDisplayFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2590 WMFont
*font
= tdata
;
2592 if (scr
->workspace_name_font
) {
2593 WMReleaseFont(scr
->workspace_name_font
);
2596 scr
->workspace_name_font
= font
;
2601 static int setHightlight(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2603 XColor
*color
= tdata
;
2605 if (scr
->select_color
)
2606 WMReleaseColor(scr
->select_color
);
2608 scr
->select_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2610 wFreeColor(scr
, color
->pixel
);
2612 return REFRESH_MENU_COLOR
;
2615 static int setHightlightText(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2617 XColor
*color
= tdata
;
2619 if (scr
->select_text_color
)
2620 WMReleaseColor(scr
->select_text_color
);
2622 scr
->select_text_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2624 wFreeColor(scr
, color
->pixel
);
2626 return REFRESH_MENU_COLOR
;
2629 static int setClipTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2631 XColor
*color
= tdata
;
2632 long widx
= (long) extra_data
;
2634 if (scr
->clip_title_color
[widx
])
2635 WMReleaseColor(scr
->clip_title_color
[widx
]);
2637 scr
->clip_title_color
[widx
] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2638 wFreeColor(scr
, color
->pixel
);
2640 return REFRESH_ICON_TITLE_COLOR
;
2643 static int setWTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2645 XColor
*color
= tdata
;
2646 long widx
= (long) extra_data
;
2648 if (scr
->window_title_color
[widx
])
2649 WMReleaseColor(scr
->window_title_color
[widx
]);
2651 scr
->window_title_color
[widx
] =
2652 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2654 wFreeColor(scr
, color
->pixel
);
2656 return REFRESH_WINDOW_TITLE_COLOR
;
2659 static int setMenuTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2661 XColor
*color
= tdata
;
2663 if (scr
->menu_title_color
[0])
2664 WMReleaseColor(scr
->menu_title_color
[0]);
2666 scr
->menu_title_color
[0] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2668 wFreeColor(scr
, color
->pixel
);
2670 return REFRESH_MENU_TITLE_COLOR
;
2673 static int setMenuTextColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2675 XColor
*color
= tdata
;
2677 if (scr
->mtext_color
)
2678 WMReleaseColor(scr
->mtext_color
);
2680 scr
->mtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2682 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2683 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2685 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2688 wFreeColor(scr
, color
->pixel
);
2690 return REFRESH_MENU_COLOR
;
2693 static int setMenuDisabledColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2695 XColor
*color
= tdata
;
2697 if (scr
->dtext_color
)
2698 WMReleaseColor(scr
->dtext_color
);
2700 scr
->dtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2702 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2703 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2705 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2708 wFreeColor(scr
, color
->pixel
);
2710 return REFRESH_MENU_COLOR
;
2713 static int setIconTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2715 XColor
*color
= tdata
;
2717 if (scr
->icon_title_color
)
2718 WMReleaseColor(scr
->icon_title_color
);
2719 scr
->icon_title_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2721 wFreeColor(scr
, color
->pixel
);
2723 return REFRESH_ICON_TITLE_COLOR
;
2726 static int setIconTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2728 XColor
*color
= tdata
;
2730 if (scr
->icon_title_texture
) {
2731 wTextureDestroy(scr
, (WTexture
*) scr
->icon_title_texture
);
2733 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
2735 return REFRESH_ICON_TITLE_BACK
;
2738 static int setFrameBorderWidth(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2742 scr
->frame_border_width
= *value
;
2744 return REFRESH_FRAME_BORDER
;
2747 static int setFrameBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2749 XColor
*color
= tdata
;
2751 if (scr
->frame_border_color
)
2752 WMReleaseColor(scr
->frame_border_color
);
2753 scr
->frame_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2755 wFreeColor(scr
, color
->pixel
);
2757 return REFRESH_FRAME_BORDER
;
2760 static int setFrameSelectedBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2762 XColor
*color
= tdata
;
2764 if (scr
->frame_selected_border_color
)
2765 WMReleaseColor(scr
->frame_selected_border_color
);
2766 scr
->frame_selected_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2768 wFreeColor(scr
, color
->pixel
);
2770 return REFRESH_FRAME_BORDER
;
2773 static void trackDeadProcess(pid_t pid
, unsigned char status
, WScreen
* scr
)
2775 close(scr
->helper_fd
);
2777 scr
->helper_pid
= 0;
2778 scr
->flags
.backimage_helper_launched
= 0;
2781 static int setWorkspaceSpecificBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
2783 WMPropList
*value
= tdata
;
2788 if (scr
->flags
.backimage_helper_launched
) {
2789 if (WMGetPropListItemCount(value
) == 0) {
2790 SendHelperMessage(scr
, 'C', 0, NULL
);
2791 SendHelperMessage(scr
, 'K', 0, NULL
);
2793 WMReleasePropList(value
);
2800 if (WMGetPropListItemCount(value
) == 0)
2803 if (pipe(filedes
) < 0) {
2804 werror("pipe() failed:can't set workspace specific background image");
2806 WMReleasePropList(value
);
2812 werror("fork() failed:can't set workspace specific background image");
2813 if (close(filedes
[0]) < 0)
2814 werror("could not close pipe");
2815 if (close(filedes
[1]) < 0)
2816 werror("could not close pipe");
2818 } else if (pid
== 0) {
2821 SetupEnvironment(scr
);
2824 werror("could not close pipe");
2825 if (dup(filedes
[0]) < 0) {
2826 werror("dup() failed:can't set workspace specific background image");
2828 dither
= wPreferences
.no_dithering
? "-m" : "-d";
2829 if (wPreferences
.smooth_workspace_back
)
2830 execlp("wmsetbg", "wmsetbg", "-helper", "-S", dither
, NULL
);
2832 execlp("wmsetbg", "wmsetbg", "-helper", dither
, NULL
);
2833 werror("could not execute wmsetbg");
2837 if (fcntl(filedes
[0], F_SETFD
, FD_CLOEXEC
) < 0) {
2838 werror("error setting close-on-exec flag");
2840 if (fcntl(filedes
[1], F_SETFD
, FD_CLOEXEC
) < 0) {
2841 werror("error setting close-on-exec flag");
2844 scr
->helper_fd
= filedes
[1];
2845 scr
->helper_pid
= pid
;
2846 scr
->flags
.backimage_helper_launched
= 1;
2848 wAddDeathHandler(pid
, (WDeathHandler
*) trackDeadProcess
, scr
);
2850 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
2855 for (i
= 0; i
< WMGetPropListItemCount(value
); i
++) {
2856 val
= WMGetFromPLArray(value
, i
);
2857 if (val
&& WMIsPLArray(val
) && WMGetPropListItemCount(val
) > 0) {
2858 str
= WMGetPropListDescription(val
, False
);
2860 SendHelperMessage(scr
, 'S', i
+ 1, str
);
2864 SendHelperMessage(scr
, 'U', i
+ 1, NULL
);
2869 WMReleasePropList(value
);
2873 static int setWorkspaceBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
2875 WMPropList
*value
= tdata
;
2877 if (scr
->flags
.backimage_helper_launched
) {
2880 if (WMGetPropListItemCount(value
) == 0) {
2881 SendHelperMessage(scr
, 'U', 0, NULL
);
2883 /* set the default workspace background to this one */
2884 str
= WMGetPropListDescription(value
, False
);
2886 SendHelperMessage(scr
, 'S', 0, str
);
2888 SendHelperMessage(scr
, 'C', scr
->current_workspace
+ 1, NULL
);
2890 SendHelperMessage(scr
, 'U', 0, NULL
);
2893 } else if (WMGetPropListItemCount(value
) > 0) {
2899 text
= WMGetPropListDescription(value
, False
);
2900 len
= strlen(text
) + 40;
2901 command
= wmalloc(len
);
2902 dither
= wPreferences
.no_dithering
? "-m" : "-d";
2903 if (wPreferences
.smooth_workspace_back
)
2904 snprintf(command
, len
, "wmsetbg %s -S -p '%s' &", dither
, text
);
2906 snprintf(command
, len
, "wmsetbg %s -p '%s' &", dither
, text
);
2908 ExecuteShellCommand(scr
, command
);
2911 WMReleasePropList(value
);
2916 static int setWidgetColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2918 WTexture
**texture
= tdata
;
2920 if (scr
->widget_texture
) {
2921 wTextureDestroy(scr
, (WTexture
*) scr
->widget_texture
);
2923 scr
->widget_texture
= *(WTexSolid
**) texture
;
2928 static int setFTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2930 WTexture
**texture
= tdata
;
2932 if (scr
->window_title_texture
[WS_FOCUSED
]) {
2933 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
2935 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
2937 return REFRESH_WINDOW_TEXTURES
;
2940 static int setPTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2942 WTexture
**texture
= tdata
;
2944 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
2945 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
2947 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
2949 return REFRESH_WINDOW_TEXTURES
;
2952 static int setUTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2954 WTexture
**texture
= tdata
;
2956 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
2957 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
2959 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
2961 return REFRESH_WINDOW_TEXTURES
;
2964 static int setResizebarBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2966 WTexture
**texture
= tdata
;
2968 if (scr
->resizebar_texture
[0]) {
2969 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
2971 scr
->resizebar_texture
[0] = *texture
;
2973 return REFRESH_WINDOW_TEXTURES
;
2976 static int setMenuTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2978 WTexture
**texture
= tdata
;
2980 if (scr
->menu_title_texture
[0]) {
2981 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
2983 scr
->menu_title_texture
[0] = *texture
;
2985 return REFRESH_MENU_TITLE_TEXTURE
;
2988 static int setMenuTextBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2990 WTexture
**texture
= tdata
;
2992 if (scr
->menu_item_texture
) {
2993 wTextureDestroy(scr
, scr
->menu_item_texture
);
2994 wTextureDestroy(scr
, (WTexture
*) scr
->menu_item_auxtexture
);
2996 scr
->menu_item_texture
= *texture
;
2998 scr
->menu_item_auxtexture
= wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3000 return REFRESH_MENU_TEXTURE
;
3003 static int setKeyGrab(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3005 WShortKey
*shortcut
= tdata
;
3007 long widx
= (long) extra_data
;
3009 wKeyBindings
[widx
] = *shortcut
;
3011 wwin
= scr
->focused_window
;
3013 while (wwin
!= NULL
) {
3014 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3016 if (!WFLAGP(wwin
, no_bind_keys
)) {
3017 wWindowSetKeyGrabs(wwin
);
3022 /* do we need to update window menus? */
3023 if (widx
>= WKBD_WORKSPACE1
&& widx
<= WKBD_WORKSPACE10
)
3024 return REFRESH_WORKSPACE_MENU
;
3025 if (widx
== WKBD_LASTWORKSPACE
)
3026 return REFRESH_WORKSPACE_MENU
;
3027 if (widx
>= WKBD_MOVE_WORKSPACE1
&& widx
<= WKBD_MOVE_WORKSPACE10
)
3028 return REFRESH_WORKSPACE_MENU
;
3033 static int setIconPosition(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3035 wScreenUpdateUsableArea(scr
);
3036 wArrangeIcons(scr
, True
);
3041 static int updateUsableArea(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3043 wScreenUpdateUsableArea(scr
);
3048 static int setMenuStyle(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3050 return REFRESH_MENU_TEXTURE
;
3053 static RImage
*chopOffImage(RImage
* image
, int x
, int y
, int w
, int h
)
3055 RImage
*img
= RCreateImage(w
, h
, image
->format
== RRGBAFormat
);
3057 RCopyArea(img
, image
, x
, y
, w
, h
, 0, 0);
3062 static int setSwPOptions(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3064 WMPropList
*array
= tdata
;
3067 int cwidth
, cheight
;
3068 WPreferences
*prefs
= foo
;
3070 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) == 0) {
3071 if (prefs
->swtileImage
)
3072 RReleaseImage(prefs
->swtileImage
);
3073 prefs
->swtileImage
= NULL
;
3075 WMReleasePropList(array
);
3079 switch (WMGetPropListItemCount(array
)) {
3081 if (!WMIsPLString(WMGetFromPLArray(array
, 1))) {
3082 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3085 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 1)));
3088 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3089 WMGetFromPLString(WMGetFromPLArray(array
, 1)), entry
->key
);
3091 bgimage
= RLoadImage(scr
->rcontext
, path
, 0);
3093 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3098 cwidth
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 2)));
3099 cheight
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 3)));
3101 if (cwidth
<= 0 || cheight
<= 0 ||
3102 cwidth
>= bgimage
->width
- 2 || cheight
>= bgimage
->height
- 2)
3103 wwarning(_("Invalid split sizes for SwitchPanel back image."));
3106 int swidth
, theight
;
3107 for (i
= 0; i
< 9; i
++) {
3108 if (prefs
->swbackImage
[i
])
3109 RReleaseImage(prefs
->swbackImage
[i
]);
3110 prefs
->swbackImage
[i
] = NULL
;
3112 swidth
= (bgimage
->width
- cwidth
) / 2;
3113 theight
= (bgimage
->height
- cheight
) / 2;
3115 prefs
->swbackImage
[0] = chopOffImage(bgimage
, 0, 0, swidth
, theight
);
3116 prefs
->swbackImage
[1] = chopOffImage(bgimage
, swidth
, 0, cwidth
, theight
);
3117 prefs
->swbackImage
[2] = chopOffImage(bgimage
, swidth
+ cwidth
, 0,
3120 prefs
->swbackImage
[3] = chopOffImage(bgimage
, 0, theight
, swidth
, cheight
);
3121 prefs
->swbackImage
[4] = chopOffImage(bgimage
, swidth
, theight
,
3123 prefs
->swbackImage
[5] = chopOffImage(bgimage
, swidth
+ cwidth
, theight
,
3126 prefs
->swbackImage
[6] = chopOffImage(bgimage
, 0, theight
+ cheight
,
3128 prefs
->swbackImage
[7] = chopOffImage(bgimage
, swidth
, theight
+ cheight
,
3130 prefs
->swbackImage
[8] =
3131 chopOffImage(bgimage
, swidth
+ cwidth
, theight
+ cheight
, swidth
,
3134 // check if anything failed
3135 for (i
= 0; i
< 9; i
++) {
3136 if (!prefs
->swbackImage
[i
]) {
3137 for (; i
>= 0; --i
) {
3138 RReleaseImage(prefs
->swbackImage
[i
]);
3139 prefs
->swbackImage
[i
] = NULL
;
3145 RReleaseImage(bgimage
);
3150 if (!WMIsPLString(WMGetFromPLArray(array
, 0))) {
3151 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3154 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 0)));
3157 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3158 WMGetFromPLString(WMGetFromPLArray(array
, 0)), entry
->key
);
3160 if (prefs
->swtileImage
)
3161 RReleaseImage(prefs
->swtileImage
);
3163 prefs
->swtileImage
= RLoadImage(scr
->rcontext
, path
, 0);
3164 if (!prefs
->swtileImage
) {
3165 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3172 wwarning(_("Invalid number of arguments for option \"%s\""), entry
->key
);
3176 WMReleasePropList(array
);
3181 static int setModifierKeyLabels(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3183 WMPropList
*array
= tdata
;
3185 WPreferences
*prefs
= foo
;
3187 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) != 7) {
3188 wwarning(_("Value for option \"%s\" must be an array of 7 strings"), entry
->key
);
3189 WMReleasePropList(array
);
3193 DestroyWindowMenu(scr
);
3195 for (i
= 0; i
< 7; i
++) {
3196 if (prefs
->modifier_labels
[i
])
3197 wfree(prefs
->modifier_labels
[i
]);
3199 if (WMIsPLString(WMGetFromPLArray(array
, i
))) {
3200 prefs
->modifier_labels
[i
] = wstrdup(WMGetFromPLString(WMGetFromPLArray(array
, i
)));
3202 wwarning(_("Invalid argument for option \"%s\" item %d"), entry
->key
, i
);
3203 prefs
->modifier_labels
[i
] = NULL
;
3207 WMReleasePropList(array
);
3212 static int setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3219 W_setconf_doubleClickDelay(*value
);
3224 static int setCursor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3226 Cursor
*cursor
= tdata
;
3227 long widx
= (long) extra_data
;
3229 if (wCursor
[widx
] != None
) {
3230 XFreeCursor(dpy
, wCursor
[widx
]);
3233 wCursor
[widx
] = *cursor
;
3235 if (widx
== WCUR_ROOT
&& *cursor
!= None
) {
3236 XDefineCursor(dpy
, scr
->root_win
, *cursor
);