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 typedef struct _WDefaultEntry WDefaultEntry
;
76 typedef int (WDECallbackConvert
) (WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*plvalue
, void *addr
, void **tdata
);
77 typedef int (WDECallbackUpdate
) (WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *extra_data
);
79 struct _WDefaultEntry
{
81 const char *default_value
;
84 WDECallbackConvert
*convert
;
85 WDECallbackUpdate
*update
;
87 WMPropList
*plvalue
; /* default value */
90 /* used to map strings to integers */
98 static WDECallbackConvert getBool
;
99 static WDECallbackConvert getInt
;
100 static WDECallbackConvert getCoord
;
101 static WDECallbackConvert getPathList
;
102 static WDECallbackConvert getEnum
;
103 static WDECallbackConvert getTexture
;
104 static WDECallbackConvert getWSBackground
;
105 static WDECallbackConvert getWSSpecificBackground
;
106 static WDECallbackConvert getFont
;
107 static WDECallbackConvert getColor
;
108 static WDECallbackConvert getKeybind
;
109 static WDECallbackConvert getModMask
;
110 static WDECallbackConvert getPropList
;
112 /* value setting functions */
113 static WDECallbackUpdate setJustify
;
114 static WDECallbackUpdate setClearance
;
115 static WDECallbackUpdate setIfDockPresent
;
116 static WDECallbackUpdate setClipMergedInDock
;
117 static WDECallbackUpdate setWrapAppiconsInDock
;
118 static WDECallbackUpdate setStickyIcons
;
119 static WDECallbackUpdate setWidgetColor
;
120 static WDECallbackUpdate setIconTile
;
121 static WDECallbackUpdate setWinTitleFont
;
122 static WDECallbackUpdate setMenuTitleFont
;
123 static WDECallbackUpdate setMenuTextFont
;
124 static WDECallbackUpdate setIconTitleFont
;
125 static WDECallbackUpdate setIconTitleColor
;
126 static WDECallbackUpdate setIconTitleBack
;
127 static WDECallbackUpdate setFrameBorderWidth
;
128 static WDECallbackUpdate setFrameBorderColor
;
129 static WDECallbackUpdate setFrameFocusedBorderColor
;
130 static WDECallbackUpdate setFrameSelectedBorderColor
;
131 static WDECallbackUpdate setLargeDisplayFont
;
132 static WDECallbackUpdate setWTitleColor
;
133 static WDECallbackUpdate setFTitleBack
;
134 static WDECallbackUpdate setPTitleBack
;
135 static WDECallbackUpdate setUTitleBack
;
136 static WDECallbackUpdate setResizebarBack
;
137 static WDECallbackUpdate setWorkspaceBack
;
138 static WDECallbackUpdate setWorkspaceSpecificBack
;
139 static WDECallbackUpdate setMenuTitleColor
;
140 static WDECallbackUpdate setMenuTextColor
;
141 static WDECallbackUpdate setMenuDisabledColor
;
142 static WDECallbackUpdate setMenuTitleBack
;
143 static WDECallbackUpdate setMenuTextBack
;
144 static WDECallbackUpdate setHightlight
;
145 static WDECallbackUpdate setHightlightText
;
146 static WDECallbackUpdate setKeyGrab
;
147 static WDECallbackUpdate setDoubleClick
;
148 static WDECallbackUpdate setIconPosition
;
150 static WDECallbackUpdate setClipTitleFont
;
151 static WDECallbackUpdate setClipTitleColor
;
153 static WDECallbackUpdate setMenuStyle
;
154 static WDECallbackUpdate setSwPOptions
;
155 static WDECallbackUpdate updateUsableArea
;
157 static WDECallbackUpdate setModifierKeyLabels
;
159 static WDECallbackConvert getCursor
;
160 static WDECallbackUpdate setCursor
;
163 * Tables to convert strings to enumeration values.
164 * Values stored are char
167 /* WARNING: sum of length of all value strings must not exceed
169 #define TOTAL_VALUES_LENGTH 80
171 #define REFRESH_WINDOW_TEXTURES (1<<0)
172 #define REFRESH_MENU_TEXTURE (1<<1)
173 #define REFRESH_MENU_FONT (1<<2)
174 #define REFRESH_MENU_COLOR (1<<3)
175 #define REFRESH_MENU_TITLE_TEXTURE (1<<4)
176 #define REFRESH_MENU_TITLE_FONT (1<<5)
177 #define REFRESH_MENU_TITLE_COLOR (1<<6)
178 #define REFRESH_WINDOW_TITLE_COLOR (1<<7)
179 #define REFRESH_WINDOW_FONT (1<<8)
180 #define REFRESH_ICON_TILE (1<<9)
181 #define REFRESH_ICON_FONT (1<<10)
182 #define REFRESH_WORKSPACE_BACK (1<<11)
184 #define REFRESH_BUTTON_IMAGES (1<<12)
186 #define REFRESH_ICON_TITLE_COLOR (1<<13)
187 #define REFRESH_ICON_TITLE_BACK (1<<14)
189 #define REFRESH_WORKSPACE_MENU (1<<15)
191 #define REFRESH_FRAME_BORDER REFRESH_MENU_FONT|REFRESH_WINDOW_FONT
193 static WOptionEnumeration seFocusModes
[] = {
194 {"Manual", WKF_CLICK
, 0}, {"ClickToFocus", WKF_CLICK
, 1},
195 {"Sloppy", WKF_SLOPPY
, 0}, {"SemiAuto", WKF_SLOPPY
, 1}, {"Auto", WKF_SLOPPY
, 1},
199 static WOptionEnumeration seTitlebarModes
[] = {
200 {"new", TS_NEW
, 0}, {"old", TS_OLD
, 0},
201 {"next", TS_NEXT
, 0}, {NULL
, 0, 0}
204 static WOptionEnumeration seColormapModes
[] = {
205 {"Manual", WCM_CLICK
, 0}, {"ClickToFocus", WCM_CLICK
, 1},
206 {"Auto", WCM_POINTER
, 0}, {"FocusFollowMouse", WCM_POINTER
, 1},
210 static WOptionEnumeration sePlacements
[] = {
211 {"Auto", WPM_AUTO
, 0},
212 {"Smart", WPM_SMART
, 0},
213 {"Cascade", WPM_CASCADE
, 0},
214 {"Random", WPM_RANDOM
, 0},
215 {"Manual", WPM_MANUAL
, 0},
216 {"Center", WPM_CENTER
, 0},
220 static WOptionEnumeration seGeomDisplays
[] = {
221 {"None", WDIS_NONE
, 0},
222 {"Center", WDIS_CENTER
, 0},
223 {"Corner", WDIS_TOPLEFT
, 0},
224 {"Floating", WDIS_FRAME_CENTER
, 0},
225 {"Line", WDIS_NEW
, 0},
229 static WOptionEnumeration seSpeeds
[] = {
230 {"UltraFast", SPEED_ULTRAFAST
, 0},
231 {"Fast", SPEED_FAST
, 0},
232 {"Medium", SPEED_MEDIUM
, 0},
233 {"Slow", SPEED_SLOW
, 0},
234 {"UltraSlow", SPEED_ULTRASLOW
, 0},
238 static WOptionEnumeration seMouseButtonActions
[] = {
239 {"None", WA_NONE
, 0},
240 {"SelectWindows", WA_SELECT_WINDOWS
, 0},
241 {"OpenApplicationsMenu", WA_OPEN_APPMENU
, 0},
242 {"OpenWindowListMenu", WA_OPEN_WINLISTMENU
, 0},
246 static WOptionEnumeration seMouseWheelActions
[] = {
247 {"None", WA_NONE
, 0},
248 {"SwitchWorkspaces", WA_SWITCH_WORKSPACES
, 0},
252 static WOptionEnumeration seIconificationStyles
[] = {
253 {"Zoom", WIS_ZOOM
, 0},
254 {"Twist", WIS_TWIST
, 0},
255 {"Flip", WIS_FLIP
, 0},
256 {"None", WIS_NONE
, 0},
257 {"random", WIS_RANDOM
, 0},
261 static WOptionEnumeration seJustifications
[] = {
262 {"Left", WTJ_LEFT
, 0},
263 {"Center", WTJ_CENTER
, 0},
264 {"Right", WTJ_RIGHT
, 0},
268 static WOptionEnumeration seIconPositions
[] = {
269 {"blv", IY_BOTTOM
| IY_LEFT
| IY_VERT
, 0},
270 {"blh", IY_BOTTOM
| IY_LEFT
| IY_HORIZ
, 0},
271 {"brv", IY_BOTTOM
| IY_RIGHT
| IY_VERT
, 0},
272 {"brh", IY_BOTTOM
| IY_RIGHT
| IY_HORIZ
, 0},
273 {"tlv", IY_TOP
| IY_LEFT
| IY_VERT
, 0},
274 {"tlh", IY_TOP
| IY_LEFT
| IY_HORIZ
, 0},
275 {"trv", IY_TOP
| IY_RIGHT
| IY_VERT
, 0},
276 {"trh", IY_TOP
| IY_RIGHT
| IY_HORIZ
, 0},
280 static WOptionEnumeration seMenuStyles
[] = {
281 {"normal", MS_NORMAL
, 0},
282 {"singletexture", MS_SINGLE_TEXTURE
, 0},
283 {"flat", MS_FLAT
, 0},
287 static WOptionEnumeration seDisplayPositions
[] = {
288 {"none", WD_NONE
, 0},
289 {"center", WD_CENTER
, 0},
291 {"bottom", WD_BOTTOM
, 0},
292 {"topleft", WD_TOPLEFT
, 0},
293 {"topright", WD_TOPRIGHT
, 0},
294 {"bottomleft", WD_BOTTOMLEFT
, 0},
295 {"bottomright", WD_BOTTOMRIGHT
, 0},
299 static WOptionEnumeration seWorkspaceBorder
[] = {
300 {"None", WB_NONE
, 0},
301 {"LeftRight", WB_LEFTRIGHT
, 0},
302 {"TopBottom", WB_TOPBOTTOM
, 0},
303 {"AllDirections", WB_ALLDIRS
, 0},
308 * ALL entries in the tables bellow, NEED to have a default value
309 * defined, and this value needs to be correct.
312 /* these options will only affect the window manager on startup
314 * static defaults can't access the screen data, because it is
315 * created after these defaults are read
317 WDefaultEntry staticOptionList
[] = {
319 {"ColormapSize", "4", NULL
,
320 &wPreferences
.cmap_size
, getInt
, NULL
, NULL
, NULL
},
321 {"DisableDithering", "NO", NULL
,
322 &wPreferences
.no_dithering
, getBool
, NULL
, NULL
, NULL
},
323 {"IconSize", "64", NULL
,
324 &wPreferences
.icon_size
, getInt
, NULL
, NULL
, NULL
},
325 {"ModifierKey", "Mod1", NULL
,
326 &wPreferences
.modifier_mask
, getModMask
, NULL
, NULL
, NULL
},
327 {"DisableWSMouseActions", "NO", NULL
,
328 &wPreferences
.disable_root_mouse
, getBool
, NULL
, NULL
, NULL
},
329 {"FocusMode", "manual", seFocusModes
, /* have a problem when switching from */
330 &wPreferences
.focus_mode
, getEnum
, NULL
, NULL
, NULL
}, /* manual to sloppy without restart */
331 {"NewStyle", "new", seTitlebarModes
,
332 &wPreferences
.new_style
, getEnum
, NULL
, NULL
, NULL
},
333 {"DisableDock", "NO", (void *)WM_DOCK
,
334 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
335 {"DisableClip", "NO", (void *)WM_CLIP
,
336 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
337 {"DisableDrawers", "NO", (void *)WM_DRAWER
,
338 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
339 {"ClipMergedInDock", "NO", NULL
,
340 NULL
, getBool
, setClipMergedInDock
, NULL
, NULL
},
341 {"DisableMiniwindows", "NO", NULL
,
342 &wPreferences
.disable_miniwindows
, getBool
, NULL
, NULL
, NULL
}
345 #define NUM2STRING_(x) #x
346 #define NUM2STRING(x) NUM2STRING_(x)
348 WDefaultEntry optionList
[] = {
350 /* dynamic options */
352 {"IconPosition", "blh", seIconPositions
,
353 &wPreferences
.icon_yard
, getEnum
, setIconPosition
, NULL
, NULL
},
354 {"IconificationStyle", "Zoom", seIconificationStyles
,
355 &wPreferences
.iconification_style
, getEnum
, NULL
, NULL
, NULL
},
356 {"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions
,
357 &wPreferences
.mouse_button1
, getEnum
, NULL
, NULL
, NULL
},
358 {"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions
,
359 &wPreferences
.mouse_button2
, getEnum
, NULL
, NULL
, NULL
},
360 {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions
,
361 &wPreferences
.mouse_button3
, getEnum
, NULL
, NULL
, NULL
},
362 {"MouseWheelAction", "None", seMouseWheelActions
,
363 &wPreferences
.mouse_wheel
, getEnum
, NULL
, NULL
, NULL
},
364 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
365 &wPreferences
.pixmap_path
, getPathList
, NULL
, NULL
, NULL
},
366 {"IconPath", DEF_ICON_PATHS
, NULL
,
367 &wPreferences
.icon_path
, getPathList
, NULL
, NULL
, NULL
},
368 {"ColormapMode", "auto", seColormapModes
,
369 &wPreferences
.colormap_mode
, getEnum
, NULL
, NULL
, NULL
},
370 {"AutoFocus", "NO", NULL
,
371 &wPreferences
.auto_focus
, getBool
, NULL
, NULL
, NULL
},
372 {"RaiseDelay", "0", NULL
,
373 &wPreferences
.raise_delay
, getInt
, NULL
, NULL
, NULL
},
374 {"CirculateRaise", "NO", NULL
,
375 &wPreferences
.circ_raise
, getBool
, NULL
, NULL
, NULL
},
376 {"Superfluous", "NO", NULL
,
377 &wPreferences
.superfluous
, getBool
, NULL
, NULL
, NULL
},
378 {"AdvanceToNewWorkspace", "NO", NULL
,
379 &wPreferences
.ws_advance
, getBool
, NULL
, NULL
, NULL
},
380 {"CycleWorkspaces", "NO", NULL
,
381 &wPreferences
.ws_cycle
, getBool
, NULL
, NULL
, NULL
},
382 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
383 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
, NULL
, NULL
},
384 {"WorkspaceBorder", "None", seWorkspaceBorder
,
385 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
, NULL
, NULL
},
386 {"WorkspaceBorderSize", "0", NULL
,
387 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
, NULL
, NULL
},
388 {"StickyIcons", "NO", NULL
,
389 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
, NULL
, NULL
},
390 {"SaveSessionOnExit", "NO", NULL
,
391 &wPreferences
.save_session_on_exit
, getBool
, NULL
, NULL
, NULL
},
392 {"WrapMenus", "NO", NULL
,
393 &wPreferences
.wrap_menus
, getBool
, NULL
, NULL
, NULL
},
394 {"ScrollableMenus", "NO", NULL
,
395 &wPreferences
.scrollable_menus
, getBool
, NULL
, NULL
, NULL
},
396 {"MenuScrollSpeed", "medium", seSpeeds
,
397 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
, NULL
, NULL
},
398 {"IconSlideSpeed", "medium", seSpeeds
,
399 &wPreferences
.icon_slide_speed
, getEnum
, NULL
, NULL
, NULL
},
400 {"ShadeSpeed", "medium", seSpeeds
,
401 &wPreferences
.shade_speed
, getEnum
, NULL
, NULL
, NULL
},
402 {"BounceAppIconsWhenUrgent", "YES", NULL
,
403 &wPreferences
.bounce_appicons_when_urgent
, getBool
, NULL
, NULL
, NULL
},
404 {"RaiseAppIconsWhenBouncing", "NO", NULL
,
405 &wPreferences
.raise_appicons_when_bouncing
, getBool
, NULL
, NULL
, NULL
},
406 {"DoNotMakeAppIconsBounce", "NO", NULL
,
407 &wPreferences
.do_not_make_appicons_bounce
, getBool
, NULL
, NULL
, NULL
},
408 {"DoubleClickTime", "250", (void *)&wPreferences
.dblclick_time
,
409 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
, NULL
, NULL
},
410 {"ClipAutoraiseDelay", "600", NULL
,
411 &wPreferences
.clip_auto_raise_delay
, getInt
, NULL
, NULL
, NULL
},
412 {"ClipAutolowerDelay", "1000", NULL
,
413 &wPreferences
.clip_auto_lower_delay
, getInt
, NULL
, NULL
, NULL
},
414 {"ClipAutoexpandDelay", "600", NULL
,
415 &wPreferences
.clip_auto_expand_delay
, getInt
, NULL
, NULL
, NULL
},
416 {"ClipAutocollapseDelay", "1000", NULL
,
417 &wPreferences
.clip_auto_collapse_delay
, getInt
, NULL
, NULL
, NULL
},
418 {"WrapAppiconsInDock", "YES", NULL
,
419 NULL
, getBool
, setWrapAppiconsInDock
, NULL
, NULL
},
420 {"AlignSubmenus", "NO", NULL
,
421 &wPreferences
.align_menus
, getBool
, NULL
, NULL
, NULL
},
422 {"ViKeyMenus", "NO", NULL
,
423 &wPreferences
.vi_key_menus
, getBool
, NULL
, NULL
, NULL
},
424 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
425 &wPreferences
.open_transients_with_parent
, getBool
, NULL
, NULL
, NULL
},
426 {"WindowPlacement", "auto", sePlacements
,
427 &wPreferences
.window_placement
, getEnum
, NULL
, NULL
, NULL
},
428 {"IgnoreFocusClick", "NO", NULL
,
429 &wPreferences
.ignore_focus_click
, getBool
, NULL
, NULL
, NULL
},
430 {"UseSaveUnders", "NO", NULL
,
431 &wPreferences
.use_saveunders
, getBool
, NULL
, NULL
, NULL
},
432 {"OpaqueMove", "NO", NULL
,
433 &wPreferences
.opaque_move
, getBool
, NULL
, NULL
, NULL
},
434 {"OpaqueResize", "NO", NULL
,
435 &wPreferences
.opaque_resize
, getBool
, NULL
, NULL
, NULL
},
436 {"OpaqueMoveResizeKeyboard", "NO", NULL
,
437 &wPreferences
.opaque_move_resize_keyboard
, getBool
, NULL
, NULL
, NULL
},
438 {"DisableAnimations", "NO", NULL
,
439 &wPreferences
.no_animations
, getBool
, NULL
, NULL
, NULL
},
440 {"DontLinkWorkspaces", "NO", NULL
,
441 &wPreferences
.no_autowrap
, getBool
, NULL
, NULL
, NULL
},
442 {"HighlightActiveApp", "YES", NULL
,
443 &wPreferences
.highlight_active_app
, getBool
, NULL
, NULL
, NULL
},
444 {"AutoArrangeIcons", "NO", NULL
,
445 &wPreferences
.auto_arrange_icons
, getBool
, NULL
, NULL
, NULL
},
446 {"NoWindowOverDock", "NO", NULL
,
447 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
, NULL
, NULL
},
448 {"NoWindowOverIcons", "NO", NULL
,
449 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
, NULL
, NULL
},
450 {"WindowPlaceOrigin", "(0, 0)", NULL
,
451 &wPreferences
.window_place_origin
, getCoord
, NULL
, NULL
, NULL
},
452 {"ResizeDisplay", "corner", seGeomDisplays
,
453 &wPreferences
.size_display
, getEnum
, NULL
, NULL
, NULL
},
454 {"MoveDisplay", "corner", seGeomDisplays
,
455 &wPreferences
.move_display
, getEnum
, NULL
, NULL
, NULL
},
456 {"DontConfirmKill", "NO", NULL
,
457 &wPreferences
.dont_confirm_kill
, getBool
, NULL
, NULL
, NULL
},
458 {"WindowTitleBalloons", "NO", NULL
,
459 &wPreferences
.window_balloon
, getBool
, NULL
, NULL
, NULL
},
460 {"MiniwindowTitleBalloons", "NO", NULL
,
461 &wPreferences
.miniwin_title_balloon
, getBool
, NULL
, NULL
, NULL
},
462 {"MiniwindowApercuBalloons", "NO", NULL
,
463 &wPreferences
.miniwin_apercu_balloon
, getBool
, NULL
, NULL
, NULL
},
464 {"AppIconBalloons", "NO", NULL
,
465 &wPreferences
.appicon_balloon
, getBool
, NULL
, NULL
, NULL
},
466 {"HelpBalloons", "NO", NULL
,
467 &wPreferences
.help_balloon
, getBool
, NULL
, NULL
, NULL
},
468 {"EdgeResistance", "30", NULL
,
469 &wPreferences
.edge_resistance
, getInt
, NULL
, NULL
, NULL
},
470 {"ResizeIncrement", "0", NULL
,
471 &wPreferences
.resize_increment
, getInt
, NULL
, NULL
, NULL
},
472 {"Attraction", "NO", NULL
,
473 &wPreferences
.attract
, getBool
, NULL
, NULL
, NULL
},
474 {"DisableBlinking", "NO", NULL
,
475 &wPreferences
.dont_blink
, getBool
, NULL
, NULL
, NULL
},
476 {"SingleClickLaunch", "NO", NULL
,
477 &wPreferences
.single_click
, getBool
, NULL
, NULL
, NULL
},
478 {"StrictWindozeCycle", "YES", NULL
,
479 &wPreferences
.strict_windoze_cycle
, getBool
, NULL
, NULL
, NULL
},
480 {"SwitchPanelOnlyOpen", "NO", NULL
,
481 &wPreferences
.panel_only_open
, getBool
, NULL
, NULL
, NULL
},
485 {"MenuStyle", "normal", seMenuStyles
,
486 &wPreferences
.menu_style
, getEnum
, setMenuStyle
, NULL
, NULL
},
487 {"WidgetColor", "(solid, gray)", NULL
,
488 NULL
, getTexture
, setWidgetColor
, NULL
, NULL
},
489 {"WorkspaceSpecificBack", "()", NULL
,
490 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
, NULL
, NULL
},
491 /* WorkspaceBack must come after WorkspaceSpecificBack or
492 * WorkspaceBack wont know WorkspaceSpecificBack was also
493 * specified and 2 copies of wmsetbg will be launched */
494 {"WorkspaceBack", "(solid, black)", NULL
,
495 NULL
, getWSBackground
, setWorkspaceBack
, NULL
, NULL
},
496 {"SmoothWorkspaceBack", "NO", NULL
,
497 NULL
, getBool
, NULL
, NULL
, NULL
},
498 {"IconBack", "(solid, gray)", NULL
,
499 NULL
, getTexture
, setIconTile
, NULL
, NULL
},
500 {"TitleJustify", "center", seJustifications
,
501 &wPreferences
.title_justification
, getEnum
, setJustify
, NULL
, NULL
},
502 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
503 NULL
, getFont
, setWinTitleFont
, NULL
, NULL
},
504 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
505 &wPreferences
.window_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
506 {"WindowTitleMinHeight", "0", NULL
,
507 &wPreferences
.window_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
508 {"WindowTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
509 &wPreferences
.window_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
510 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
511 &wPreferences
.menu_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
512 {"MenuTitleMinHeight", "0", NULL
,
513 &wPreferences
.menu_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
514 {"MenuTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
515 &wPreferences
.menu_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
516 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
517 &wPreferences
.menu_text_clearance
, getInt
, setClearance
, NULL
, NULL
},
518 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
519 NULL
, getFont
, setMenuTitleFont
, NULL
, NULL
},
520 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
521 NULL
, getFont
, setMenuTextFont
, NULL
, NULL
},
522 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
523 NULL
, getFont
, setIconTitleFont
, NULL
, NULL
},
524 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
525 NULL
, getFont
, setClipTitleFont
, NULL
, NULL
},
526 {"ShowClipTitle", "YES", NULL
,
527 &wPreferences
.show_clip_title
, getBool
, NULL
, NULL
, NULL
},
528 {"LargeDisplayFont", DEF_WORKSPACE_NAME_FONT
, NULL
,
529 NULL
, getFont
, setLargeDisplayFont
, NULL
, NULL
},
530 {"HighlightColor", "white", NULL
,
531 NULL
, getColor
, setHightlight
, NULL
, NULL
},
532 {"HighlightTextColor", "black", NULL
,
533 NULL
, getColor
, setHightlightText
, NULL
, NULL
},
534 {"ClipTitleColor", "black", (void *)CLIP_NORMAL
,
535 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
536 {"CClipTitleColor", "\"#454045\"", (void *)CLIP_COLLAPSED
,
537 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
538 {"FTitleColor", "white", (void *)WS_FOCUSED
,
539 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
540 {"PTitleColor", "white", (void *)WS_PFOCUSED
,
541 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
542 {"UTitleColor", "black", (void *)WS_UNFOCUSED
,
543 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
544 {"FTitleBack", "(solid, black)", NULL
,
545 NULL
, getTexture
, setFTitleBack
, NULL
, NULL
},
546 {"PTitleBack", "(solid, \"#616161\")", NULL
,
547 NULL
, getTexture
, setPTitleBack
, NULL
, NULL
},
548 {"UTitleBack", "(solid, gray)", NULL
,
549 NULL
, getTexture
, setUTitleBack
, NULL
, NULL
},
550 {"ResizebarBack", "(solid, gray)", NULL
,
551 NULL
, getTexture
, setResizebarBack
, NULL
, NULL
},
552 {"MenuTitleColor", "white", NULL
,
553 NULL
, getColor
, setMenuTitleColor
, NULL
, NULL
},
554 {"MenuTextColor", "black", NULL
,
555 NULL
, getColor
, setMenuTextColor
, NULL
, NULL
},
556 {"MenuDisabledColor", "\"#616161\"", NULL
,
557 NULL
, getColor
, setMenuDisabledColor
, NULL
, NULL
},
558 {"MenuTitleBack", "(solid, black)", NULL
,
559 NULL
, getTexture
, setMenuTitleBack
, NULL
, NULL
},
560 {"MenuTextBack", "(solid, gray)", NULL
,
561 NULL
, getTexture
, setMenuTextBack
, NULL
, NULL
},
562 {"IconTitleColor", "white", NULL
,
563 NULL
, getColor
, setIconTitleColor
, NULL
, NULL
},
564 {"IconTitleBack", "black", NULL
,
565 NULL
, getColor
, setIconTitleBack
, NULL
, NULL
},
566 {"SwitchPanelImages", "(swtile.png, swback.png, 30, 40)", &wPreferences
,
567 NULL
, getPropList
, setSwPOptions
, NULL
, NULL
},
568 {"ModifierKeyLabels", "(\"Shift+\", \"Ctrl+\", \"Mod1+\", \"Mod2+\", \"Mod3+\", \"Mod4+\", \"Mod5+\")", &wPreferences
,
569 NULL
, getPropList
, setModifierKeyLabels
, NULL
, NULL
},
570 {"FrameBorderWidth", "1", NULL
,
571 NULL
, getInt
, setFrameBorderWidth
, NULL
, NULL
},
572 {"FrameBorderColor", "black", NULL
,
573 NULL
, getColor
, setFrameBorderColor
, NULL
, NULL
},
574 {"FrameFocusedBorderColor", "black", NULL
,
575 NULL
, getColor
, setFrameFocusedBorderColor
, 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
},
729 {"RunKey", "None", (void *)WKBD_RUN
,
730 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
732 #ifdef KEEP_XKB_LOCK_STATUS
733 {"ToggleKbdModeKey", "None", (void *)WKBD_TOGGLE
,
734 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
735 {"KbdModeLock", "NO", NULL
,
736 &wPreferences
.modelock
, getBool
, NULL
, NULL
, NULL
},
737 #endif /* KEEP_XKB_LOCK_STATUS */
739 {"NormalCursor", "(builtin, left_ptr)", (void *)WCUR_ROOT
,
740 NULL
, getCursor
, setCursor
, NULL
, NULL
},
741 {"ArrowCursor", "(builtin, top_left_arrow)", (void *)WCUR_ARROW
,
742 NULL
, getCursor
, setCursor
, NULL
, NULL
},
743 {"MoveCursor", "(builtin, fleur)", (void *)WCUR_MOVE
,
744 NULL
, getCursor
, setCursor
, NULL
, NULL
},
745 {"ResizeCursor", "(builtin, sizing)", (void *)WCUR_RESIZE
,
746 NULL
, getCursor
, setCursor
, NULL
, NULL
},
747 {"TopLeftResizeCursor", "(builtin, top_left_corner)", (void *)WCUR_TOPLEFTRESIZE
,
748 NULL
, getCursor
, setCursor
, NULL
, NULL
},
749 {"TopRightResizeCursor", "(builtin, top_right_corner)", (void *)WCUR_TOPRIGHTRESIZE
,
750 NULL
, getCursor
, setCursor
, NULL
, NULL
},
751 {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)", (void *)WCUR_BOTTOMLEFTRESIZE
,
752 NULL
, getCursor
, setCursor
, NULL
, NULL
},
753 {"BottomRightResizeCursor", "(builtin, bottom_right_corner)", (void *)WCUR_BOTTOMRIGHTRESIZE
,
754 NULL
, getCursor
, setCursor
, NULL
, NULL
},
755 {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)", (void *)WCUR_VERTICALRESIZE
,
756 NULL
, getCursor
, setCursor
, NULL
, NULL
},
757 {"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)", (void *)WCUR_HORIZONRESIZE
,
758 NULL
, getCursor
, setCursor
, NULL
, NULL
},
759 {"WaitCursor", "(builtin, watch)", (void *)WCUR_WAIT
,
760 NULL
, getCursor
, setCursor
, NULL
, NULL
},
761 {"QuestionCursor", "(builtin, question_arrow)", (void *)WCUR_QUESTION
,
762 NULL
, getCursor
, setCursor
, NULL
, NULL
},
763 {"TextCursor", "(builtin, xterm)", (void *)WCUR_TEXT
,
764 NULL
, getCursor
, setCursor
, NULL
, NULL
},
765 {"SelectCursor", "(builtin, cross)", (void *)WCUR_SELECT
,
766 NULL
, getCursor
, setCursor
, NULL
, NULL
},
767 {"DialogHistoryLines", "500", NULL
,
768 &wPreferences
.history_lines
, getInt
, NULL
, NULL
, NULL
},
769 {"CycleActiveHeadOnly", "NO", NULL
,
770 &wPreferences
.cycle_active_head_only
, getBool
, NULL
, NULL
, NULL
},
771 {"CycleIgnoreMinimized", "NO", NULL
,
772 &wPreferences
.cycle_ignore_minimized
, getBool
, NULL
, NULL
, NULL
}
775 static void initDefaults(void)
778 WDefaultEntry
*entry
;
780 WMPLSetCaseSensitive(False
);
782 for (i
= 0; i
< wlengthof(optionList
); i
++) {
783 entry
= &optionList
[i
];
785 entry
->plkey
= WMCreatePLString(entry
->key
);
786 if (entry
->default_value
)
787 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
789 entry
->plvalue
= NULL
;
792 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
793 entry
= &staticOptionList
[i
];
795 entry
->plkey
= WMCreatePLString(entry
->key
);
796 if (entry
->default_value
)
797 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
799 entry
->plvalue
= NULL
;
803 static WMPropList
*readGlobalDomain(const char *domainName
, Bool requireDictionary
)
805 WMPropList
*globalDict
= NULL
;
809 snprintf(path
, sizeof(path
), "%s/%s/%s", SYSCONFDIR
, GLOBAL_DEFAULTS_SUBDIR
, domainName
);
810 if (stat(path
, &stbuf
) >= 0) {
811 globalDict
= WMReadPropListFromFile(path
);
812 if (globalDict
&& requireDictionary
&& !WMIsPLDictionary(globalDict
)) {
813 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"), domainName
, path
);
814 WMReleasePropList(globalDict
);
816 } else if (!globalDict
) {
817 wwarning(_("could not load domain %s from global defaults database"), domainName
);
824 #if defined(GLOBAL_PREAMBLE_MENU_FILE) || defined(GLOBAL_EPILOGUE_MENU_FILE)
825 static void prependMenu(WMPropList
* destarr
, WMPropList
* array
)
830 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
831 item
= WMGetFromPLArray(array
, i
);
833 WMInsertInPLArray(destarr
, i
+ 1, item
);
837 static void appendMenu(WMPropList
* destarr
, WMPropList
* array
)
842 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
843 item
= WMGetFromPLArray(array
, i
);
845 WMAddToPLArray(destarr
, item
);
850 void wDefaultsMergeGlobalMenus(WDDomain
* menuDomain
)
852 WMPropList
*menu
= menuDomain
->dictionary
;
855 if (!menu
|| !WMIsPLArray(menu
))
858 #ifdef GLOBAL_PREAMBLE_MENU_FILE
859 submenu
= WMReadPropListFromFile(SYSCONFDIR
"/" GLOBAL_DEFAULTS_SUBDIR
"/" GLOBAL_PREAMBLE_MENU_FILE
);
861 if (submenu
&& !WMIsPLArray(submenu
)) {
862 wwarning(_("invalid global menu file %s"), GLOBAL_PREAMBLE_MENU_FILE
);
863 WMReleasePropList(submenu
);
867 prependMenu(menu
, submenu
);
868 WMReleasePropList(submenu
);
872 #ifdef GLOBAL_EPILOGUE_MENU_FILE
873 submenu
= WMReadPropListFromFile(SYSCONFDIR
"/" GLOBAL_DEFAULTS_SUBDIR
"/" GLOBAL_EPILOGUE_MENU_FILE
);
875 if (submenu
&& !WMIsPLArray(submenu
)) {
876 wwarning(_("invalid global menu file %s"), GLOBAL_EPILOGUE_MENU_FILE
);
877 WMReleasePropList(submenu
);
881 appendMenu(menu
, submenu
);
882 WMReleasePropList(submenu
);
886 menuDomain
->dictionary
= menu
;
889 WDDomain
*wDefaultsInitDomain(const char *domain
, Bool requireDictionary
)
893 static int inited
= 0;
894 WMPropList
*shared_dict
= NULL
;
901 db
= wmalloc(sizeof(WDDomain
));
902 db
->domain_name
= domain
;
903 db
->path
= wdefaultspathfordomain(domain
);
905 if (stat(db
->path
, &stbuf
) >= 0) {
906 db
->dictionary
= WMReadPropListFromFile(db
->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
, db
->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
< wlengthof(staticOptionList
); 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 /* Parameter not used, but tell the compiler that it is ok */
977 if (stat(w_global
.domain
.wmaker
->path
, &stbuf
) >= 0 && w_global
.domain
.wmaker
->timestamp
< stbuf
.st_mtime
) {
978 w_global
.domain
.wmaker
->timestamp
= stbuf
.st_mtime
;
980 /* Global dictionary */
981 shared_dict
= readGlobalDomain("WindowMaker", True
);
983 /* User dictionary */
984 dict
= WMReadPropListFromFile(w_global
.domain
.wmaker
->path
);
987 if (!WMIsPLDictionary(dict
)) {
988 WMReleasePropList(dict
);
990 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
991 "WindowMaker", w_global
.domain
.wmaker
->path
);
994 WMMergePLDictionaries(shared_dict
, dict
, True
);
995 WMReleasePropList(dict
);
1000 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1001 scr
= wScreenWithNumber(i
);
1003 wReadDefaults(scr
, dict
);
1006 if (w_global
.domain
.wmaker
->dictionary
)
1007 WMReleasePropList(w_global
.domain
.wmaker
->dictionary
);
1009 w_global
.domain
.wmaker
->dictionary
= dict
;
1012 wwarning(_("could not load domain %s from user defaults database"), "WindowMaker");
1016 WMReleasePropList(shared_dict
);
1020 if (stat(w_global
.domain
.window_attr
->path
, &stbuf
) >= 0 && w_global
.domain
.window_attr
->timestamp
< stbuf
.st_mtime
) {
1021 /* global dictionary */
1022 shared_dict
= readGlobalDomain("WMWindowAttributes", True
);
1023 /* user dictionary */
1024 dict
= WMReadPropListFromFile(w_global
.domain
.window_attr
->path
);
1026 if (!WMIsPLDictionary(dict
)) {
1027 WMReleasePropList(dict
);
1029 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1030 "WMWindowAttributes", w_global
.domain
.window_attr
->path
);
1033 WMMergePLDictionaries(shared_dict
, dict
, True
);
1034 WMReleasePropList(dict
);
1039 if (w_global
.domain
.window_attr
->dictionary
)
1040 WMReleasePropList(w_global
.domain
.window_attr
->dictionary
);
1042 w_global
.domain
.window_attr
->dictionary
= dict
;
1043 for (i
= 0; i
< w_global
.screen_count
; 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 w_global
.domain
.window_attr
->timestamp
= stbuf
.st_mtime
;
1061 WMReleasePropList(shared_dict
);
1064 if (stat(w_global
.domain
.root_menu
->path
, &stbuf
) >= 0 && w_global
.domain
.root_menu
->timestamp
< stbuf
.st_mtime
) {
1065 dict
= WMReadPropListFromFile(w_global
.domain
.root_menu
->path
);
1067 if (!WMIsPLArray(dict
) && !WMIsPLString(dict
)) {
1068 WMReleasePropList(dict
);
1070 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1071 "WMRootMenu", w_global
.domain
.root_menu
->path
);
1073 if (w_global
.domain
.root_menu
->dictionary
)
1074 WMReleasePropList(w_global
.domain
.root_menu
->dictionary
);
1076 w_global
.domain
.root_menu
->dictionary
= dict
;
1077 wDefaultsMergeGlobalMenus(w_global
.domain
.root_menu
);
1080 wwarning(_("could not load domain %s from user defaults database"), "WMRootMenu");
1082 w_global
.domain
.root_menu
->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
= (w_global
.domain
.wmaker
->dictionary
!= new_dict
? w_global
.domain
.wmaker
->dictionary
: NULL
);
1102 for (i
= 0; i
< wlengthof(optionList
); 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 (w_global
.workspace
.menu
)
1208 wWorkspaceMenuUpdate(w_global
.workspace
.menu
);
1209 if (w_global
.clip
.ws_menu
)
1210 wWorkspaceMenuUpdate(w_global
.clip
.ws_menu
);
1211 if (w_global
.workspace
.submenu
)
1212 w_global
.workspace
.submenu
->flags
.realized
= 0;
1213 if (w_global
.clip
.submenu
)
1214 w_global
.clip
.submenu
->flags
.realized
= 0;
1219 void wDefaultUpdateIcons(WScreen
*scr
)
1221 WAppIcon
*aicon
= w_global
.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
)
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 /* Parameter not used, but tell the compiler that it is ok */
1304 GET_STRING_OR_DEFAULT("Boolean", val
);
1307 if ((val
[1] == '\0' && (val
[0] == 'y' || val
[0] == 'Y'))
1308 || strcasecmp(val
, "YES") == 0) {
1311 } else if ((val
[1] == '\0' && (val
[0] == 'n' || val
[0] == 'N'))
1312 || strcasecmp(val
, "NO") == 0) {
1316 if (sscanf(val
, "%i", &i
) == 1) {
1322 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""), val
, entry
->key
);
1323 if (second_pass
== 0) {
1324 val
= WMGetFromPLString(entry
->plvalue
);
1326 wwarning(_("using default \"%s\" instead"), val
);
1336 *(char *)addr
= data
;
1341 static int getInt(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1346 /* Parameter not used, but tell the compiler that it is ok */
1349 GET_STRING_OR_DEFAULT("Integer", val
);
1351 if (sscanf(val
, "%i", &data
) != 1) {
1352 wwarning(_("can't convert \"%s\" to integer for key \"%s\""), val
, entry
->key
);
1353 val
= WMGetFromPLString(entry
->plvalue
);
1354 wwarning(_("using default \"%s\" instead"), val
);
1355 if (sscanf(val
, "%i", &data
) != 1) {
1363 *(int *)addr
= data
;
1368 static int getCoord(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1371 char *val_x
, *val_y
;
1372 int nelem
, changed
= 0;
1373 WMPropList
*elem_x
, *elem_y
;
1376 if (!WMIsPLArray(value
)) {
1377 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Coordinate");
1379 value
= entry
->plvalue
;
1381 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1387 nelem
= WMGetPropListItemCount(value
);
1389 wwarning(_("Incorrect number of elements in array for key \"%s\"."), entry
->key
);
1391 value
= entry
->plvalue
;
1393 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1399 elem_x
= WMGetFromPLArray(value
, 0);
1400 elem_y
= WMGetFromPLArray(value
, 1);
1402 if (!elem_x
|| !elem_y
|| !WMIsPLString(elem_x
) || !WMIsPLString(elem_y
)) {
1403 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."), entry
->key
);
1405 value
= entry
->plvalue
;
1407 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1413 val_x
= WMGetFromPLString(elem_x
);
1414 val_y
= WMGetFromPLString(elem_y
);
1416 if (sscanf(val_x
, "%i", &data
.x
) != 1 || sscanf(val_y
, "%i", &data
.y
) != 1) {
1417 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1419 value
= entry
->plvalue
;
1421 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1429 else if (data
.x
> scr
->scr_width
/ 3)
1430 data
.x
= scr
->scr_width
/ 3;
1433 else if (data
.y
> scr
->scr_height
/ 3)
1434 data
.y
= scr
->scr_height
/ 3;
1439 *(WCoord
*) addr
= data
;
1444 static int getPropList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1446 /* Parameter not used, but tell the compiler that it is ok */
1451 WMRetainPropList(value
);
1458 static int getPathList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1466 /* Parameter not used, but tell the compiler that it is ok */
1471 if (!WMIsPLArray(value
)) {
1472 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "an array of paths");
1474 value
= entry
->plvalue
;
1476 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1483 count
= WMGetPropListItemCount(value
);
1486 value
= entry
->plvalue
;
1488 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1495 for (i
= 0; i
< count
; i
++) {
1496 d
= WMGetFromPLArray(value
, i
);
1497 if (!d
|| !WMIsPLString(d
)) {
1501 len
+= strlen(WMGetFromPLString(d
)) + 1;
1504 ptr
= data
= wmalloc(len
+ 1);
1506 for (i
= 0; i
< count
; i
++) {
1507 d
= WMGetFromPLArray(value
, i
);
1508 if (!d
|| !WMIsPLString(d
)) {
1511 strcpy(ptr
, WMGetFromPLString(d
));
1512 ptr
+= strlen(WMGetFromPLString(d
));
1519 if (*(char **)addr
!= NULL
) {
1520 wfree(*(char **)addr
);
1522 *(char **)addr
= data
;
1527 static int getEnum(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1529 static signed char data
;
1531 /* Parameter not used, but tell the compiler that it is ok */
1534 data
= string2index(entry
->plkey
, value
, entry
->default_value
, (WOptionEnumeration
*) entry
->extra_data
);
1541 *(signed char *)addr
= data
;
1548 * (hgradient <color> <color>)
1549 * (vgradient <color> <color>)
1550 * (dgradient <color> <color>)
1551 * (mhgradient <color> <color> ...)
1552 * (mvgradient <color> <color> ...)
1553 * (mdgradient <color> <color> ...)
1554 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1555 * (tpixmap <file> <color>)
1556 * (spixmap <file> <color>)
1557 * (cpixmap <file> <color>)
1558 * (thgradient <file> <opaqueness> <color> <color>)
1559 * (tvgradient <file> <opaqueness> <color> <color>)
1560 * (tdgradient <file> <opaqueness> <color> <color>)
1561 * (function <lib> <function> ...)
1564 static WTexture
*parse_texture(WScreen
* scr
, WMPropList
* pl
)
1569 WTexture
*texture
= NULL
;
1571 nelem
= WMGetPropListItemCount(pl
);
1575 elem
= WMGetFromPLArray(pl
, 0);
1576 if (!elem
|| !WMIsPLString(elem
))
1578 val
= WMGetFromPLString(elem
);
1580 if (strcasecmp(val
, "solid") == 0) {
1588 elem
= WMGetFromPLArray(pl
, 1);
1589 if (!elem
|| !WMIsPLString(elem
))
1591 val
= WMGetFromPLString(elem
);
1593 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1594 wwarning(_("\"%s\" is not a valid color name"), val
);
1598 texture
= (WTexture
*) wTextureMakeSolid(scr
, &color
);
1599 } else if (strcasecmp(val
, "dgradient") == 0
1600 || strcasecmp(val
, "vgradient") == 0 || strcasecmp(val
, "hgradient") == 0) {
1601 RColor color1
, color2
;
1606 wwarning(_("bad number of arguments in gradient specification"));
1610 if (val
[0] == 'd' || val
[0] == 'D')
1611 type
= WTEX_DGRADIENT
;
1612 else if (val
[0] == 'h' || val
[0] == 'H')
1613 type
= WTEX_HGRADIENT
;
1615 type
= WTEX_VGRADIENT
;
1617 /* get from color */
1618 elem
= WMGetFromPLArray(pl
, 1);
1619 if (!elem
|| !WMIsPLString(elem
))
1621 val
= WMGetFromPLString(elem
);
1623 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1624 wwarning(_("\"%s\" is not a valid color name"), val
);
1628 color1
.red
= xcolor
.red
>> 8;
1629 color1
.green
= xcolor
.green
>> 8;
1630 color1
.blue
= xcolor
.blue
>> 8;
1633 elem
= WMGetFromPLArray(pl
, 2);
1634 if (!elem
|| !WMIsPLString(elem
)) {
1637 val
= WMGetFromPLString(elem
);
1639 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1640 wwarning(_("\"%s\" is not a valid color name"), val
);
1644 color2
.red
= xcolor
.red
>> 8;
1645 color2
.green
= xcolor
.green
>> 8;
1646 color2
.blue
= xcolor
.blue
>> 8;
1648 texture
= (WTexture
*) wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1650 } else if (strcasecmp(val
, "igradient") == 0) {
1651 RColor colors1
[2], colors2
[2];
1657 wwarning(_("bad number of arguments in gradient specification"));
1661 /* get from color */
1662 for (i
= 0; i
< 2; i
++) {
1663 elem
= WMGetFromPLArray(pl
, 1 + i
);
1664 if (!elem
|| !WMIsPLString(elem
))
1666 val
= WMGetFromPLString(elem
);
1668 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1669 wwarning(_("\"%s\" is not a valid color name"), val
);
1672 colors1
[i
].alpha
= 255;
1673 colors1
[i
].red
= xcolor
.red
>> 8;
1674 colors1
[i
].green
= xcolor
.green
>> 8;
1675 colors1
[i
].blue
= xcolor
.blue
>> 8;
1677 elem
= WMGetFromPLArray(pl
, 3);
1678 if (!elem
|| !WMIsPLString(elem
))
1680 val
= WMGetFromPLString(elem
);
1683 /* get from color */
1684 for (i
= 0; i
< 2; i
++) {
1685 elem
= WMGetFromPLArray(pl
, 4 + i
);
1686 if (!elem
|| !WMIsPLString(elem
))
1688 val
= WMGetFromPLString(elem
);
1690 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1691 wwarning(_("\"%s\" is not a valid color name"), val
);
1694 colors2
[i
].alpha
= 255;
1695 colors2
[i
].red
= xcolor
.red
>> 8;
1696 colors2
[i
].green
= xcolor
.green
>> 8;
1697 colors2
[i
].blue
= xcolor
.blue
>> 8;
1699 elem
= WMGetFromPLArray(pl
, 6);
1700 if (!elem
|| !WMIsPLString(elem
))
1702 val
= WMGetFromPLString(elem
);
1705 texture
= (WTexture
*) wTextureMakeIGradient(scr
, th1
, colors1
, th2
, colors2
);
1707 } else if (strcasecmp(val
, "mhgradient") == 0
1708 || strcasecmp(val
, "mvgradient") == 0 || strcasecmp(val
, "mdgradient") == 0) {
1715 wwarning(_("too few arguments in multicolor gradient specification"));
1719 if (val
[1] == 'h' || val
[1] == 'H')
1720 type
= WTEX_MHGRADIENT
;
1721 else if (val
[1] == 'v' || val
[1] == 'V')
1722 type
= WTEX_MVGRADIENT
;
1724 type
= WTEX_MDGRADIENT
;
1728 colors
= wmalloc(sizeof(RColor
*) * (count
+ 1));
1730 for (i
= 0; i
< count
; i
++) {
1731 elem
= WMGetFromPLArray(pl
, i
+ 1);
1732 if (!elem
|| !WMIsPLString(elem
)) {
1733 for (--i
; i
>= 0; --i
) {
1739 val
= WMGetFromPLString(elem
);
1741 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1742 wwarning(_("\"%s\" is not a valid color name"), val
);
1743 for (--i
; i
>= 0; --i
) {
1749 colors
[i
] = wmalloc(sizeof(RColor
));
1750 colors
[i
]->red
= color
.red
>> 8;
1751 colors
[i
]->green
= color
.green
>> 8;
1752 colors
[i
]->blue
= color
.blue
>> 8;
1757 texture
= (WTexture
*) wTextureMakeMGradient(scr
, type
, colors
);
1758 } else if (strcasecmp(val
, "spixmap") == 0 ||
1759 strcasecmp(val
, "cpixmap") == 0 || strcasecmp(val
, "tpixmap") == 0) {
1766 if (val
[0] == 's' || val
[0] == 'S')
1768 else if (val
[0] == 'c' || val
[0] == 'C')
1774 elem
= WMGetFromPLArray(pl
, 2);
1775 if (!elem
|| !WMIsPLString(elem
)) {
1778 val
= WMGetFromPLString(elem
);
1780 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1781 wwarning(_("\"%s\" is not a valid color name"), val
);
1786 elem
= WMGetFromPLArray(pl
, 1);
1787 if (!elem
|| !WMIsPLString(elem
))
1789 val
= WMGetFromPLString(elem
);
1791 texture
= (WTexture
*) wTextureMakePixmap(scr
, type
, val
, &color
);
1792 } else if (strcasecmp(val
, "thgradient") == 0
1793 || strcasecmp(val
, "tvgradient") == 0 || strcasecmp(val
, "tdgradient") == 0) {
1794 RColor color1
, color2
;
1799 if (val
[1] == 'h' || val
[1] == 'H')
1800 style
= WTEX_THGRADIENT
;
1801 else if (val
[1] == 'v' || val
[1] == 'V')
1802 style
= WTEX_TVGRADIENT
;
1804 style
= WTEX_TDGRADIENT
;
1807 wwarning(_("bad number of arguments in textured gradient specification"));
1811 /* get from color */
1812 elem
= WMGetFromPLArray(pl
, 3);
1813 if (!elem
|| !WMIsPLString(elem
))
1815 val
= WMGetFromPLString(elem
);
1817 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1818 wwarning(_("\"%s\" is not a valid color name"), val
);
1822 color1
.red
= xcolor
.red
>> 8;
1823 color1
.green
= xcolor
.green
>> 8;
1824 color1
.blue
= xcolor
.blue
>> 8;
1827 elem
= WMGetFromPLArray(pl
, 4);
1828 if (!elem
|| !WMIsPLString(elem
)) {
1831 val
= WMGetFromPLString(elem
);
1833 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1834 wwarning(_("\"%s\" is not a valid color name"), val
);
1838 color2
.red
= xcolor
.red
>> 8;
1839 color2
.green
= xcolor
.green
>> 8;
1840 color2
.blue
= xcolor
.blue
>> 8;
1843 elem
= WMGetFromPLArray(pl
, 2);
1844 if (!elem
|| !WMIsPLString(elem
))
1847 val
= WMGetFromPLString(elem
);
1849 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
1850 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
1855 elem
= WMGetFromPLArray(pl
, 1);
1856 if (!elem
|| !WMIsPLString(elem
))
1858 val
= WMGetFromPLString(elem
);
1860 texture
= (WTexture
*) wTextureMakeTGradient(scr
, style
, &color1
, &color2
, val
, opacity
);
1861 } else if (strcasecmp(val
, "function") == 0) {
1862 /* Leave this in to handle the unlikely case of
1863 * someone actually having function textures configured */
1864 wwarning("function texture support has been removed");
1867 wwarning(_("invalid texture type %s"), val
);
1873 static int getTexture(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1875 static WTexture
*texture
;
1879 if (!WMIsPLArray(value
)) {
1880 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Texture");
1882 value
= entry
->plvalue
;
1884 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1890 if (strcmp(entry
->key
, "WidgetColor") == 0 && !changed
) {
1893 pl
= WMGetFromPLArray(value
, 0);
1894 if (!pl
|| !WMIsPLString(pl
) || !WMGetFromPLString(pl
)
1895 || strcasecmp(WMGetFromPLString(pl
), "solid") != 0) {
1896 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1897 entry
->key
, "Solid Texture");
1899 value
= entry
->plvalue
;
1901 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1906 texture
= parse_texture(scr
, value
);
1909 wwarning(_("Error in texture specification for key \"%s\""), entry
->key
);
1911 value
= entry
->plvalue
;
1913 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1923 *(WTexture
**) addr
= texture
;
1928 static int getWSBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1935 /* Parameter not used, but tell the compiler that it is ok */
1940 if (!WMIsPLArray(value
)) {
1941 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1942 "WorkspaceBack", "Texture or None");
1944 value
= entry
->plvalue
;
1946 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1952 /* only do basic error checking and verify for None texture */
1954 nelem
= WMGetPropListItemCount(value
);
1956 elem
= WMGetFromPLArray(value
, 0);
1957 if (!elem
|| !WMIsPLString(elem
)) {
1958 wwarning(_("Wrong type for workspace background. Should be a texture type."));
1960 value
= entry
->plvalue
;
1962 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1967 val
= WMGetFromPLString(elem
);
1969 if (strcasecmp(val
, "None") == 0)
1972 *ret
= WMRetainPropList(value
);
1978 getWSSpecificBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1984 /* Parameter not used, but tell the compiler that it is ok */
1989 if (!WMIsPLArray(value
)) {
1990 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1991 "WorkspaceSpecificBack", "an array of textures");
1993 value
= entry
->plvalue
;
1995 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2001 /* only do basic error checking and verify for None texture */
2003 nelem
= WMGetPropListItemCount(value
);
2006 elem
= WMGetFromPLArray(value
, nelem
);
2007 if (!elem
|| !WMIsPLArray(elem
)) {
2008 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2014 *ret
= WMRetainPropList(value
);
2018 * Kluge to force wmsetbg helper to set the default background.
2019 * If the WorkspaceSpecificBack is changed once wmaker has started,
2020 * the WorkspaceBack won't be sent to the helper, unless the user
2021 * changes it's value too. So, we must force this by removing the
2022 * value from the defaults DB.
2024 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2025 WMPropList
*key
= WMCreatePLString("WorkspaceBack");
2027 WMRemoveFromPLDictionary(w_global
.domain
.wmaker
->dictionary
, key
);
2029 WMReleasePropList(key
);
2035 static int getFont(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2037 static WMFont
*font
;
2042 GET_STRING_OR_DEFAULT("Font", val
);
2044 font
= WMCreateFont(scr
->wmscreen
, val
);
2046 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2049 wfatal(_("could not load any usable font!!!"));
2056 /* can't assign font value outside update function */
2057 wassertrv(addr
== NULL
, True
);
2062 static int getColor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2064 static XColor color
;
2066 int second_pass
= 0;
2070 GET_STRING_OR_DEFAULT("Color", val
);
2073 if (!wGetColor(scr
, val
, &color
)) {
2074 wwarning(_("could not get color for key \"%s\""), entry
->key
);
2075 if (second_pass
== 0) {
2076 val
= WMGetFromPLString(entry
->plvalue
);
2078 wwarning(_("using default \"%s\" instead"), val
);
2087 assert(addr
== NULL
);
2090 *(unsigned long*)addr = pixel;
2096 static int getKeybind(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2098 static WShortKey shortcut
;
2102 char buf
[MAX_SHORTCUT_LENGTH
], *b
;
2104 /* Parameter not used, but tell the compiler that it is ok */
2108 GET_STRING_OR_DEFAULT("Key spec", val
);
2110 if (!val
|| strcasecmp(val
, "NONE") == 0) {
2111 shortcut
.keycode
= 0;
2112 shortcut
.modifier
= 0;
2118 wstrlcpy(buf
, val
, MAX_SHORTCUT_LENGTH
);
2123 shortcut
.modifier
= 0;
2124 while ((k
= strchr(b
, '+')) != NULL
) {
2128 mod
= wXModifierFromKey(b
);
2130 wwarning(_("%s: invalid key modifier \"%s\""), entry
->key
, b
);
2133 shortcut
.modifier
|= mod
;
2139 ksym
= XStringToKeysym(b
);
2141 if (ksym
== NoSymbol
) {
2142 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
, val
);
2146 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2147 if (shortcut
.keycode
== 0) {
2148 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2158 static int getModMask(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2163 /* Parameter not used, but tell the compiler that it is ok */
2166 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2171 mask
= wXModifierFromKey(str
);
2173 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2179 *(int *)addr
= mask
;
2187 # include <X11/cursorfont.h>
2193 #define CURSOR_ID_NONE (XC_num_glyphs)
2195 static const WCursorLookup cursor_table
[] = {
2196 {"X_cursor", XC_X_cursor
},
2197 {"arrow", XC_arrow
},
2198 {"based_arrow_down", XC_based_arrow_down
},
2199 {"based_arrow_up", XC_based_arrow_up
},
2201 {"bogosity", XC_bogosity
},
2202 {"bottom_left_corner", XC_bottom_left_corner
},
2203 {"bottom_right_corner", XC_bottom_right_corner
},
2204 {"bottom_side", XC_bottom_side
},
2205 {"bottom_tee", XC_bottom_tee
},
2206 {"box_spiral", XC_box_spiral
},
2207 {"center_ptr", XC_center_ptr
},
2208 {"circle", XC_circle
},
2209 {"clock", XC_clock
},
2210 {"coffee_mug", XC_coffee_mug
},
2211 {"cross", XC_cross
},
2212 {"cross_reverse", XC_cross_reverse
},
2213 {"crosshair", XC_crosshair
},
2214 {"diamond_cross", XC_diamond_cross
},
2216 {"dotbox", XC_dotbox
},
2217 {"double_arrow", XC_double_arrow
},
2218 {"draft_large", XC_draft_large
},
2219 {"draft_small", XC_draft_small
},
2220 {"draped_box", XC_draped_box
},
2221 {"exchange", XC_exchange
},
2222 {"fleur", XC_fleur
},
2223 {"gobbler", XC_gobbler
},
2224 {"gumby", XC_gumby
},
2225 {"hand1", XC_hand1
},
2226 {"hand2", XC_hand2
},
2227 {"heart", XC_heart
},
2229 {"iron_cross", XC_iron_cross
},
2230 {"left_ptr", XC_left_ptr
},
2231 {"left_side", XC_left_side
},
2232 {"left_tee", XC_left_tee
},
2233 {"leftbutton", XC_leftbutton
},
2234 {"ll_angle", XC_ll_angle
},
2235 {"lr_angle", XC_lr_angle
},
2237 {"middlebutton", XC_middlebutton
},
2238 {"mouse", XC_mouse
},
2239 {"pencil", XC_pencil
},
2240 {"pirate", XC_pirate
},
2242 {"question_arrow", XC_question_arrow
},
2243 {"right_ptr", XC_right_ptr
},
2244 {"right_side", XC_right_side
},
2245 {"right_tee", XC_right_tee
},
2246 {"rightbutton", XC_rightbutton
},
2247 {"rtl_logo", XC_rtl_logo
},
2248 {"sailboat", XC_sailboat
},
2249 {"sb_down_arrow", XC_sb_down_arrow
},
2250 {"sb_h_double_arrow", XC_sb_h_double_arrow
},
2251 {"sb_left_arrow", XC_sb_left_arrow
},
2252 {"sb_right_arrow", XC_sb_right_arrow
},
2253 {"sb_up_arrow", XC_sb_up_arrow
},
2254 {"sb_v_double_arrow", XC_sb_v_double_arrow
},
2255 {"shuttle", XC_shuttle
},
2256 {"sizing", XC_sizing
},
2257 {"spider", XC_spider
},
2258 {"spraycan", XC_spraycan
},
2260 {"target", XC_target
},
2261 {"tcross", XC_tcross
},
2262 {"top_left_arrow", XC_top_left_arrow
},
2263 {"top_left_corner", XC_top_left_corner
},
2264 {"top_right_corner", XC_top_right_corner
},
2265 {"top_side", XC_top_side
},
2266 {"top_tee", XC_top_tee
},
2268 {"ul_angle", XC_ul_angle
},
2269 {"umbrella", XC_umbrella
},
2270 {"ur_angle", XC_ur_angle
},
2271 {"watch", XC_watch
},
2272 {"xterm", XC_xterm
},
2273 {NULL
, CURSOR_ID_NONE
}
2276 static void check_bitmap_status(int status
, const char *filename
, Pixmap bitmap
)
2279 case BitmapOpenFailed
:
2280 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2282 case BitmapFileInvalid
:
2283 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2285 case BitmapNoMemory
:
2286 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2289 XFreePixmap(dpy
, bitmap
);
2296 * (builtin, <cursor_name>)
2297 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2299 static int parse_cursor(WScreen
* scr
, WMPropList
* pl
, Cursor
* cursor
)
2306 nelem
= WMGetPropListItemCount(pl
);
2310 elem
= WMGetFromPLArray(pl
, 0);
2311 if (!elem
|| !WMIsPLString(elem
)) {
2314 val
= WMGetFromPLString(elem
);
2316 if (strcasecmp(val
, "none") == 0) {
2319 } else if (strcasecmp(val
, "builtin") == 0) {
2321 int cursor_id
= CURSOR_ID_NONE
;
2324 wwarning(_("bad number of arguments in cursor specification"));
2327 elem
= WMGetFromPLArray(pl
, 1);
2328 if (!elem
|| !WMIsPLString(elem
)) {
2331 val
= WMGetFromPLString(elem
);
2333 for (i
= 0; cursor_table
[i
].name
!= NULL
; i
++) {
2334 if (strcasecmp(val
, cursor_table
[i
].name
) == 0) {
2335 cursor_id
= cursor_table
[i
].id
;
2339 if (CURSOR_ID_NONE
== cursor_id
) {
2340 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2342 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2345 } else if (strcasecmp(val
, "bitmap") == 0) {
2357 wwarning(_("bad number of arguments in cursor specification"));
2360 elem
= WMGetFromPLArray(pl
, 1);
2361 if (!elem
|| !WMIsPLString(elem
)) {
2364 val
= WMGetFromPLString(elem
);
2365 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2367 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2370 elem
= WMGetFromPLArray(pl
, 2);
2371 if (!elem
|| !WMIsPLString(elem
)) {
2375 val
= WMGetFromPLString(elem
);
2376 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2379 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2382 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
, &mask
, &x
, &y
);
2383 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
, &bitmap
, &x
, &y
);
2384 if ((BitmapSuccess
== bitmap_status
) && (BitmapSuccess
== mask_status
)) {
2385 fg
.pixel
= scr
->black_pixel
;
2386 bg
.pixel
= scr
->white_pixel
;
2387 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2388 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2389 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2392 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2393 check_bitmap_status(mask_status
, mask_name
, mask
);
2400 static int getCursor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2402 static Cursor cursor
;
2407 if (!WMIsPLArray(value
)) {
2408 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2409 entry
->key
, "cursor specification");
2411 value
= entry
->plvalue
;
2413 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2418 status
= parse_cursor(scr
, value
, &cursor
);
2420 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2422 value
= entry
->plvalue
;
2424 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2433 *(Cursor
*) addr
= cursor
;
2438 #undef CURSOR_ID_NONE
2440 /* ---------------- value setting functions --------------- */
2441 static int setJustify(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2443 /* Parameter not used, but tell the compiler that it is ok */
2449 return REFRESH_WINDOW_TITLE_COLOR
;
2452 static int setClearance(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2454 /* Parameter not used, but tell the compiler that it is ok */
2460 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
| REFRESH_MENU_TITLE_FONT
| REFRESH_MENU_FONT
;
2463 static int setIfDockPresent(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2466 long which
= (long) extra_data
;
2468 /* Parameter not used, but tell the compiler that it is ok */
2474 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2475 // Drawers require the dock
2476 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| wPreferences
.flags
.nodock
;
2479 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2482 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| *flag
;
2490 static int setClipMergedInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2494 /* Parameter not used, but tell the compiler that it is ok */
2499 wPreferences
.flags
.clip_merged_in_dock
= *flag
;
2500 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2504 static int setWrapAppiconsInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2508 /* Parameter not used, but tell the compiler that it is ok */
2513 wPreferences
.flags
.wrap_appicons_in_dock
= *flag
;
2517 static int setStickyIcons(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2519 /* Parameter not used, but tell the compiler that it is ok */
2524 if (w_global
.workspace
.array
) {
2525 wWorkspaceForceChange(scr
, w_global
.workspace
.current
);
2526 wArrangeIcons(scr
, False
);
2531 static int setIconTile(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2535 WTexture
** texture
= tdata
;
2538 /* Parameter not used, but tell the compiler that it is ok */
2541 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2542 wPreferences
.icon_size
, ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2543 ? WREL_ICON
: WREL_FLAT
);
2545 wwarning(_("could not render texture for icon background"));
2547 wTextureDestroy(scr
, *texture
);
2550 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2552 if (scr
->icon_tile
) {
2554 RReleaseImage(scr
->icon_tile
);
2555 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2558 scr
->icon_tile
= img
;
2560 /* put the icon in the noticeboard hint */
2561 PropSetIconTileHint(scr
, img
);
2563 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
) {
2564 if (scr
->clip_tile
) {
2565 RReleaseImage(scr
->clip_tile
);
2567 scr
->clip_tile
= wClipMakeTile(img
);
2570 if (!wPreferences
.flags
.nodrawer
) {
2571 if (scr
->drawer_tile
) {
2572 RReleaseImage(scr
->drawer_tile
);
2574 scr
->drawer_tile
= wDrawerMakeTile(scr
, img
);
2577 scr
->icon_tile_pixmap
= pixmap
;
2579 if (scr
->def_icon_rimage
) {
2580 RReleaseImage(scr
->def_icon_rimage
);
2581 scr
->def_icon_rimage
= NULL
;
2584 if (scr
->icon_back_texture
)
2585 wTextureDestroy(scr
, (WTexture
*) scr
->icon_back_texture
);
2587 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2589 /* Free the texture as nobody else will use it, nor refer to it. */
2591 wTextureDestroy(scr
, *texture
);
2593 return (reset
? REFRESH_ICON_TILE
: 0);
2596 static int setWinTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2598 WMFont
*font
= tdata
;
2600 /* Parameter not used, but tell the compiler that it is ok */
2604 if (scr
->title_font
) {
2605 WMReleaseFont(scr
->title_font
);
2607 scr
->title_font
= font
;
2609 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
;
2612 static int setMenuTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2614 WMFont
*font
= tdata
;
2616 /* Parameter not used, but tell the compiler that it is ok */
2620 if (scr
->menu_title_font
) {
2621 WMReleaseFont(scr
->menu_title_font
);
2624 scr
->menu_title_font
= font
;
2626 return REFRESH_MENU_TITLE_FONT
;
2629 static int setMenuTextFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2631 WMFont
*font
= tdata
;
2633 /* Parameter not used, but tell the compiler that it is ok */
2637 if (scr
->menu_entry_font
) {
2638 WMReleaseFont(scr
->menu_entry_font
);
2640 scr
->menu_entry_font
= font
;
2642 return REFRESH_MENU_FONT
;
2645 static int setIconTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2647 WMFont
*font
= tdata
;
2649 /* Parameter not used, but tell the compiler that it is ok */
2653 if (scr
->icon_title_font
) {
2654 WMReleaseFont(scr
->icon_title_font
);
2657 scr
->icon_title_font
= font
;
2659 return REFRESH_ICON_FONT
;
2662 static int setClipTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2664 WMFont
*font
= tdata
;
2666 /* Parameter not used, but tell the compiler that it is ok */
2670 if (scr
->clip_title_font
) {
2671 WMReleaseFont(scr
->clip_title_font
);
2674 scr
->clip_title_font
= font
;
2676 return REFRESH_ICON_FONT
;
2679 static int setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2681 WMFont
*font
= tdata
;
2683 /* Parameter not used, but tell the compiler that it is ok */
2688 if (w_global
.workspace
.font_for_name
)
2689 WMReleaseFont(w_global
.workspace
.font_for_name
);
2691 w_global
.workspace
.font_for_name
= font
;
2696 static int setHightlight(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2698 XColor
*color
= tdata
;
2700 /* Parameter not used, but tell the compiler that it is ok */
2704 if (scr
->select_color
)
2705 WMReleaseColor(scr
->select_color
);
2707 scr
->select_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2709 wFreeColor(scr
, color
->pixel
);
2711 return REFRESH_MENU_COLOR
;
2714 static int setHightlightText(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2716 XColor
*color
= tdata
;
2718 /* Parameter not used, but tell the compiler that it is ok */
2722 if (scr
->select_text_color
)
2723 WMReleaseColor(scr
->select_text_color
);
2725 scr
->select_text_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2727 wFreeColor(scr
, color
->pixel
);
2729 return REFRESH_MENU_COLOR
;
2732 static int setClipTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2734 XColor
*color
= tdata
;
2735 long widx
= (long) extra_data
;
2737 /* Parameter not used, but tell the compiler that it is ok */
2740 if (scr
->clip_title_color
[widx
])
2741 WMReleaseColor(scr
->clip_title_color
[widx
]);
2743 scr
->clip_title_color
[widx
] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2744 wFreeColor(scr
, color
->pixel
);
2746 return REFRESH_ICON_TITLE_COLOR
;
2749 static int setWTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2751 XColor
*color
= tdata
;
2752 long widx
= (long) extra_data
;
2754 /* Parameter not used, but tell the compiler that it is ok */
2757 if (scr
->window_title_color
[widx
])
2758 WMReleaseColor(scr
->window_title_color
[widx
]);
2760 scr
->window_title_color
[widx
] =
2761 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2763 wFreeColor(scr
, color
->pixel
);
2765 return REFRESH_WINDOW_TITLE_COLOR
;
2768 static int setMenuTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2770 XColor
*color
= tdata
;
2772 /* Parameter not used, but tell the compiler that it is ok */
2776 if (scr
->menu_title_color
[0])
2777 WMReleaseColor(scr
->menu_title_color
[0]);
2779 scr
->menu_title_color
[0] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2781 wFreeColor(scr
, color
->pixel
);
2783 return REFRESH_MENU_TITLE_COLOR
;
2786 static int setMenuTextColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2788 XColor
*color
= tdata
;
2790 /* Parameter not used, but tell the compiler that it is ok */
2794 if (scr
->mtext_color
)
2795 WMReleaseColor(scr
->mtext_color
);
2797 scr
->mtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2799 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2800 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2802 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2805 wFreeColor(scr
, color
->pixel
);
2807 return REFRESH_MENU_COLOR
;
2810 static int setMenuDisabledColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2812 XColor
*color
= tdata
;
2814 /* Parameter not used, but tell the compiler that it is ok */
2818 if (scr
->dtext_color
)
2819 WMReleaseColor(scr
->dtext_color
);
2821 scr
->dtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2823 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2824 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2826 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2829 wFreeColor(scr
, color
->pixel
);
2831 return REFRESH_MENU_COLOR
;
2834 static int setIconTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2836 XColor
*color
= tdata
;
2838 /* Parameter not used, but tell the compiler that it is ok */
2842 if (scr
->icon_title_color
)
2843 WMReleaseColor(scr
->icon_title_color
);
2844 scr
->icon_title_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2846 wFreeColor(scr
, color
->pixel
);
2848 return REFRESH_ICON_TITLE_COLOR
;
2851 static int setIconTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2853 XColor
*color
= tdata
;
2855 /* Parameter not used, but tell the compiler that it is ok */
2859 if (scr
->icon_title_texture
) {
2860 wTextureDestroy(scr
, (WTexture
*) scr
->icon_title_texture
);
2862 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
2864 return REFRESH_ICON_TITLE_BACK
;
2867 static int setFrameBorderWidth(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2871 /* Parameter not used, but tell the compiler that it is ok */
2875 scr
->frame_border_width
= *value
;
2877 return REFRESH_FRAME_BORDER
;
2880 static int setFrameBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2882 XColor
*color
= tdata
;
2884 /* Parameter not used, but tell the compiler that it is ok */
2888 if (scr
->frame_border_color
)
2889 WMReleaseColor(scr
->frame_border_color
);
2890 scr
->frame_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2892 wFreeColor(scr
, color
->pixel
);
2894 return REFRESH_FRAME_BORDER
;
2897 static int setFrameFocusedBorderColor(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2899 XColor
*color
= tdata
;
2901 /* Parameter not used, but tell the compiler that it is ok */
2905 if (scr
->frame_focused_border_color
)
2906 WMReleaseColor(scr
->frame_focused_border_color
);
2907 scr
->frame_focused_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2909 wFreeColor(scr
, color
->pixel
);
2911 return REFRESH_FRAME_BORDER
;
2914 static int setFrameSelectedBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2916 XColor
*color
= tdata
;
2918 /* Parameter not used, but tell the compiler that it is ok */
2922 if (scr
->frame_selected_border_color
)
2923 WMReleaseColor(scr
->frame_selected_border_color
);
2924 scr
->frame_selected_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2926 wFreeColor(scr
, color
->pixel
);
2928 return REFRESH_FRAME_BORDER
;
2931 static void trackDeadProcess(pid_t pid
, unsigned int status
, void *client_data
)
2933 WScreen
*scr
= (WScreen
*) client_data
;
2935 /* Parameter not used, but tell the compiler that it is ok */
2939 close(scr
->helper_fd
);
2941 scr
->helper_pid
= 0;
2942 scr
->flags
.backimage_helper_launched
= 0;
2945 static int setWorkspaceSpecificBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
2947 WMPropList
*value
= tdata
;
2952 /* Parameter not used, but tell the compiler that it is ok */
2956 if (scr
->flags
.backimage_helper_launched
) {
2957 if (WMGetPropListItemCount(value
) == 0) {
2958 SendHelperMessage(scr
, 'C', 0, NULL
);
2959 SendHelperMessage(scr
, 'K', 0, NULL
);
2961 WMReleasePropList(value
);
2968 if (WMGetPropListItemCount(value
) == 0)
2971 if (pipe(filedes
) < 0) {
2972 werror("pipe() failed:can't set workspace specific background image");
2974 WMReleasePropList(value
);
2980 werror("fork() failed:can't set workspace specific background image");
2981 if (close(filedes
[0]) < 0)
2982 werror("could not close pipe");
2983 if (close(filedes
[1]) < 0)
2984 werror("could not close pipe");
2986 } else if (pid
== 0) {
2989 SetupEnvironment(scr
);
2992 werror("could not close pipe");
2993 if (dup(filedes
[0]) < 0) {
2994 werror("dup() failed:can't set workspace specific background image");
2996 dither
= wPreferences
.no_dithering
? "-m" : "-d";
2997 if (wPreferences
.smooth_workspace_back
)
2998 execlp("wmsetbg", "wmsetbg", "-helper", "-S", dither
, NULL
);
3000 execlp("wmsetbg", "wmsetbg", "-helper", dither
, NULL
);
3001 werror("could not execute wmsetbg");
3005 if (fcntl(filedes
[0], F_SETFD
, FD_CLOEXEC
) < 0) {
3006 werror("error setting close-on-exec flag");
3008 if (fcntl(filedes
[1], F_SETFD
, FD_CLOEXEC
) < 0) {
3009 werror("error setting close-on-exec flag");
3012 scr
->helper_fd
= filedes
[1];
3013 scr
->helper_pid
= pid
;
3014 scr
->flags
.backimage_helper_launched
= 1;
3016 wAddDeathHandler(pid
, trackDeadProcess
, scr
);
3018 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3023 for (i
= 0; i
< WMGetPropListItemCount(value
); i
++) {
3024 val
= WMGetFromPLArray(value
, i
);
3025 if (val
&& WMIsPLArray(val
) && WMGetPropListItemCount(val
) > 0) {
3026 str
= WMGetPropListDescription(val
, False
);
3028 SendHelperMessage(scr
, 'S', i
+ 1, str
);
3032 SendHelperMessage(scr
, 'U', i
+ 1, NULL
);
3037 WMReleasePropList(value
);
3041 static int setWorkspaceBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
3043 WMPropList
*value
= tdata
;
3045 /* Parameter not used, but tell the compiler that it is ok */
3049 if (scr
->flags
.backimage_helper_launched
) {
3052 if (WMGetPropListItemCount(value
) == 0) {
3053 SendHelperMessage(scr
, 'U', 0, NULL
);
3055 /* set the default workspace background to this one */
3056 str
= WMGetPropListDescription(value
, False
);
3058 SendHelperMessage(scr
, 'S', 0, str
);
3060 SendHelperMessage(scr
, 'C', w_global
.workspace
.current
+ 1, NULL
);
3062 SendHelperMessage(scr
, 'U', 0, NULL
);
3065 } else if (WMGetPropListItemCount(value
) > 0) {
3071 text
= WMGetPropListDescription(value
, False
);
3072 len
= strlen(text
) + 40;
3073 command
= wmalloc(len
);
3074 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3075 if (wPreferences
.smooth_workspace_back
)
3076 snprintf(command
, len
, "wmsetbg %s -S -p '%s' &", dither
, text
);
3078 snprintf(command
, len
, "wmsetbg %s -p '%s' &", dither
, text
);
3080 ExecuteShellCommand(scr
, command
);
3083 WMReleasePropList(value
);
3088 static int setWidgetColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3090 WTexture
**texture
= tdata
;
3092 /* Parameter not used, but tell the compiler that it is ok */
3096 if (scr
->widget_texture
) {
3097 wTextureDestroy(scr
, (WTexture
*) scr
->widget_texture
);
3099 scr
->widget_texture
= *(WTexSolid
**) texture
;
3104 static int setFTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3106 WTexture
**texture
= tdata
;
3108 /* Parameter not used, but tell the compiler that it is ok */
3112 if (scr
->window_title_texture
[WS_FOCUSED
]) {
3113 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3115 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3117 return REFRESH_WINDOW_TEXTURES
;
3120 static int setPTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3122 WTexture
**texture
= tdata
;
3124 /* Parameter not used, but tell the compiler that it is ok */
3128 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
3129 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3131 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3133 return REFRESH_WINDOW_TEXTURES
;
3136 static int setUTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3138 WTexture
**texture
= tdata
;
3140 /* Parameter not used, but tell the compiler that it is ok */
3144 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
3145 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3147 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3149 return REFRESH_WINDOW_TEXTURES
;
3152 static int setResizebarBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3154 WTexture
**texture
= tdata
;
3156 /* Parameter not used, but tell the compiler that it is ok */
3160 if (scr
->resizebar_texture
[0]) {
3161 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3163 scr
->resizebar_texture
[0] = *texture
;
3165 return REFRESH_WINDOW_TEXTURES
;
3168 static int setMenuTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3170 WTexture
**texture
= tdata
;
3172 /* Parameter not used, but tell the compiler that it is ok */
3176 if (scr
->menu_title_texture
[0]) {
3177 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3179 scr
->menu_title_texture
[0] = *texture
;
3181 return REFRESH_MENU_TITLE_TEXTURE
;
3184 static int setMenuTextBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3186 WTexture
**texture
= tdata
;
3188 /* Parameter not used, but tell the compiler that it is ok */
3192 if (scr
->menu_item_texture
) {
3193 wTextureDestroy(scr
, scr
->menu_item_texture
);
3194 wTextureDestroy(scr
, (WTexture
*) scr
->menu_item_auxtexture
);
3196 scr
->menu_item_texture
= *texture
;
3198 scr
->menu_item_auxtexture
= wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3200 return REFRESH_MENU_TEXTURE
;
3203 static int setKeyGrab(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3205 WShortKey
*shortcut
= tdata
;
3207 long widx
= (long) extra_data
;
3209 /* Parameter not used, but tell the compiler that it is ok */
3212 wKeyBindings
[widx
] = *shortcut
;
3214 wwin
= scr
->focused_window
;
3216 while (wwin
!= NULL
) {
3217 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3219 if (!WFLAGP(wwin
, no_bind_keys
)) {
3220 wWindowSetKeyGrabs(wwin
);
3225 /* do we need to update window menus? */
3226 if (widx
>= WKBD_WORKSPACE1
&& widx
<= WKBD_WORKSPACE10
)
3227 return REFRESH_WORKSPACE_MENU
;
3228 if (widx
== WKBD_LASTWORKSPACE
)
3229 return REFRESH_WORKSPACE_MENU
;
3230 if (widx
>= WKBD_MOVE_WORKSPACE1
&& widx
<= WKBD_MOVE_WORKSPACE10
)
3231 return REFRESH_WORKSPACE_MENU
;
3236 static int setIconPosition(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3238 /* Parameter not used, but tell the compiler that it is ok */
3243 wScreenUpdateUsableArea(scr
);
3244 wArrangeIcons(scr
, True
);
3249 static int updateUsableArea(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3251 /* Parameter not used, but tell the compiler that it is ok */
3256 wScreenUpdateUsableArea(scr
);
3261 static int setMenuStyle(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3263 /* Parameter not used, but tell the compiler that it is ok */
3269 return REFRESH_MENU_TEXTURE
;
3272 static RImage
*chopOffImage(RImage
* image
, int x
, int y
, int w
, int h
)
3274 RImage
*img
= RCreateImage(w
, h
, image
->format
== RRGBAFormat
);
3276 RCopyArea(img
, image
, x
, y
, w
, h
, 0, 0);
3281 static int setSwPOptions(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3283 WMPropList
*array
= tdata
;
3286 int cwidth
, cheight
;
3287 struct WPreferences
*prefs
= foo
;
3289 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) == 0) {
3290 if (prefs
->swtileImage
)
3291 RReleaseImage(prefs
->swtileImage
);
3292 prefs
->swtileImage
= NULL
;
3294 WMReleasePropList(array
);
3298 switch (WMGetPropListItemCount(array
)) {
3300 if (!WMIsPLString(WMGetFromPLArray(array
, 1))) {
3301 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3304 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 1)));
3307 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3308 WMGetFromPLString(WMGetFromPLArray(array
, 1)), entry
->key
);
3310 bgimage
= RLoadImage(scr
->rcontext
, path
, 0);
3312 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3317 cwidth
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 2)));
3318 cheight
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 3)));
3320 if (cwidth
<= 0 || cheight
<= 0 ||
3321 cwidth
>= bgimage
->width
- 2 || cheight
>= bgimage
->height
- 2)
3322 wwarning(_("Invalid split sizes for switch panel back image."));
3325 int swidth
, theight
;
3326 for (i
= 0; i
< 9; i
++) {
3327 if (prefs
->swbackImage
[i
])
3328 RReleaseImage(prefs
->swbackImage
[i
]);
3329 prefs
->swbackImage
[i
] = NULL
;
3331 swidth
= (bgimage
->width
- cwidth
) / 2;
3332 theight
= (bgimage
->height
- cheight
) / 2;
3334 prefs
->swbackImage
[0] = chopOffImage(bgimage
, 0, 0, swidth
, theight
);
3335 prefs
->swbackImage
[1] = chopOffImage(bgimage
, swidth
, 0, cwidth
, theight
);
3336 prefs
->swbackImage
[2] = chopOffImage(bgimage
, swidth
+ cwidth
, 0,
3339 prefs
->swbackImage
[3] = chopOffImage(bgimage
, 0, theight
, swidth
, cheight
);
3340 prefs
->swbackImage
[4] = chopOffImage(bgimage
, swidth
, theight
,
3342 prefs
->swbackImage
[5] = chopOffImage(bgimage
, swidth
+ cwidth
, theight
,
3345 prefs
->swbackImage
[6] = chopOffImage(bgimage
, 0, theight
+ cheight
,
3347 prefs
->swbackImage
[7] = chopOffImage(bgimage
, swidth
, theight
+ cheight
,
3349 prefs
->swbackImage
[8] =
3350 chopOffImage(bgimage
, swidth
+ cwidth
, theight
+ cheight
, swidth
,
3353 // check if anything failed
3354 for (i
= 0; i
< 9; i
++) {
3355 if (!prefs
->swbackImage
[i
]) {
3356 for (; i
>= 0; --i
) {
3357 RReleaseImage(prefs
->swbackImage
[i
]);
3358 prefs
->swbackImage
[i
] = NULL
;
3364 RReleaseImage(bgimage
);
3369 if (!WMIsPLString(WMGetFromPLArray(array
, 0))) {
3370 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3373 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 0)));
3376 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3377 WMGetFromPLString(WMGetFromPLArray(array
, 0)), entry
->key
);
3379 if (prefs
->swtileImage
)
3380 RReleaseImage(prefs
->swtileImage
);
3382 prefs
->swtileImage
= RLoadImage(scr
->rcontext
, path
, 0);
3383 if (!prefs
->swtileImage
) {
3384 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3391 wwarning(_("Invalid number of arguments for option \"%s\""), entry
->key
);
3395 WMReleasePropList(array
);
3400 static int setModifierKeyLabels(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3402 WMPropList
*array
= tdata
;
3404 struct WPreferences
*prefs
= foo
;
3406 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) != 7) {
3407 wwarning(_("Value for option \"%s\" must be an array of 7 strings"), entry
->key
);
3408 WMReleasePropList(array
);
3412 DestroyWindowMenu(scr
);
3414 for (i
= 0; i
< 7; i
++) {
3415 if (prefs
->modifier_labels
[i
])
3416 wfree(prefs
->modifier_labels
[i
]);
3418 if (WMIsPLString(WMGetFromPLArray(array
, i
))) {
3419 prefs
->modifier_labels
[i
] = wstrdup(WMGetFromPLString(WMGetFromPLArray(array
, i
)));
3421 wwarning(_("Invalid argument for option \"%s\" item %d"), entry
->key
, i
);
3422 prefs
->modifier_labels
[i
] = NULL
;
3426 WMReleasePropList(array
);
3431 static int setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3435 /* Parameter not used, but tell the compiler that it is ok */
3442 W_setconf_doubleClickDelay(*value
);
3447 static int setCursor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3449 Cursor
*cursor
= tdata
;
3450 long widx
= (long) extra_data
;
3452 /* Parameter not used, but tell the compiler that it is ok */
3455 if (wPreferences
.cursor
[widx
] != None
) {
3456 XFreeCursor(dpy
, wPreferences
.cursor
[widx
]);
3459 wPreferences
.cursor
[widx
] = *cursor
;
3461 if (widx
== WCUR_ROOT
&& *cursor
!= None
) {
3462 XDefineCursor(dpy
, scr
->root_win
, *cursor
);