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>
39 #define PATH_MAX DEFAULT_PATH_MAX
43 #include <X11/Xutil.h>
44 #include <X11/keysym.h>
48 #include "WindowMaker.h"
53 #include "resources.h"
56 #include "xmodifier.h"
61 #include "workspace.h"
62 #include "properties.h"
66 #define MAX_SHORTCUT_LENGTH 32
68 #ifndef GLOBAL_DEFAULTS_SUBDIR
69 #define GLOBAL_DEFAULTS_SUBDIR "WindowMaker"
73 typedef struct _WDefaultEntry WDefaultEntry
;
74 typedef int (WDECallbackConvert
) (WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*plvalue
, void *addr
, void **tdata
);
75 typedef int (WDECallbackUpdate
) (WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *extra_data
);
77 struct _WDefaultEntry
{
79 const char *default_value
;
82 WDECallbackConvert
*convert
;
83 WDECallbackUpdate
*update
;
85 WMPropList
*plvalue
; /* default value */
88 /* used to map strings to integers */
96 static WDECallbackConvert getBool
;
97 static WDECallbackConvert getInt
;
98 static WDECallbackConvert getCoord
;
99 static WDECallbackConvert getPathList
;
100 static WDECallbackConvert getEnum
;
101 static WDECallbackConvert getTexture
;
102 static WDECallbackConvert getWSBackground
;
103 static WDECallbackConvert getWSSpecificBackground
;
104 static WDECallbackConvert getFont
;
105 static WDECallbackConvert getColor
;
106 static WDECallbackConvert getKeybind
;
107 static WDECallbackConvert getModMask
;
108 static WDECallbackConvert getPropList
;
110 /* value setting functions */
111 static WDECallbackUpdate setJustify
;
112 static WDECallbackUpdate setClearance
;
113 static WDECallbackUpdate setIfDockPresent
;
114 static WDECallbackUpdate setClipMergedInDock
;
115 static WDECallbackUpdate setWrapAppiconsInDock
;
116 static WDECallbackUpdate setStickyIcons
;
117 static WDECallbackUpdate setWidgetColor
;
118 static WDECallbackUpdate setIconTile
;
119 static WDECallbackUpdate setWinTitleFont
;
120 static WDECallbackUpdate setMenuTitleFont
;
121 static WDECallbackUpdate setMenuTextFont
;
122 static WDECallbackUpdate setIconTitleFont
;
123 static WDECallbackUpdate setIconTitleColor
;
124 static WDECallbackUpdate setIconTitleBack
;
125 static WDECallbackUpdate setFrameBorderWidth
;
126 static WDECallbackUpdate setFrameBorderColor
;
127 static WDECallbackUpdate setFrameFocusedBorderColor
;
128 static WDECallbackUpdate setFrameSelectedBorderColor
;
129 static WDECallbackUpdate setLargeDisplayFont
;
130 static WDECallbackUpdate setWTitleColor
;
131 static WDECallbackUpdate setFTitleBack
;
132 static WDECallbackUpdate setPTitleBack
;
133 static WDECallbackUpdate setUTitleBack
;
134 static WDECallbackUpdate setResizebarBack
;
135 static WDECallbackUpdate setWorkspaceBack
;
136 static WDECallbackUpdate setWorkspaceSpecificBack
;
137 static WDECallbackUpdate setMenuTitleColor
;
138 static WDECallbackUpdate setMenuTextColor
;
139 static WDECallbackUpdate setMenuDisabledColor
;
140 static WDECallbackUpdate setMenuTitleBack
;
141 static WDECallbackUpdate setMenuTextBack
;
142 static WDECallbackUpdate setHightlight
;
143 static WDECallbackUpdate setHightlightText
;
144 static WDECallbackUpdate setKeyGrab
;
145 static WDECallbackUpdate setDoubleClick
;
146 static WDECallbackUpdate setIconPosition
;
148 static WDECallbackUpdate setClipTitleFont
;
149 static WDECallbackUpdate setClipTitleColor
;
151 static WDECallbackUpdate setMenuStyle
;
152 static WDECallbackUpdate setSwPOptions
;
153 static WDECallbackUpdate updateUsableArea
;
155 static WDECallbackUpdate setModifierKeyLabels
;
157 static WDECallbackConvert getCursor
;
158 static WDECallbackUpdate setCursor
;
161 * Tables to convert strings to enumeration values.
162 * Values stored are char
165 /* WARNING: sum of length of all value strings must not exceed
167 #define TOTAL_VALUES_LENGTH 80
169 #define REFRESH_WINDOW_TEXTURES (1<<0)
170 #define REFRESH_MENU_TEXTURE (1<<1)
171 #define REFRESH_MENU_FONT (1<<2)
172 #define REFRESH_MENU_COLOR (1<<3)
173 #define REFRESH_MENU_TITLE_TEXTURE (1<<4)
174 #define REFRESH_MENU_TITLE_FONT (1<<5)
175 #define REFRESH_MENU_TITLE_COLOR (1<<6)
176 #define REFRESH_WINDOW_TITLE_COLOR (1<<7)
177 #define REFRESH_WINDOW_FONT (1<<8)
178 #define REFRESH_ICON_TILE (1<<9)
179 #define REFRESH_ICON_FONT (1<<10)
180 #define REFRESH_WORKSPACE_BACK (1<<11)
182 #define REFRESH_BUTTON_IMAGES (1<<12)
184 #define REFRESH_ICON_TITLE_COLOR (1<<13)
185 #define REFRESH_ICON_TITLE_BACK (1<<14)
187 #define REFRESH_WORKSPACE_MENU (1<<15)
189 #define REFRESH_FRAME_BORDER REFRESH_MENU_FONT|REFRESH_WINDOW_FONT
191 static WOptionEnumeration seFocusModes
[] = {
192 {"Manual", WKF_CLICK
, 0}, {"ClickToFocus", WKF_CLICK
, 1},
193 {"Sloppy", WKF_SLOPPY
, 0}, {"SemiAuto", WKF_SLOPPY
, 1}, {"Auto", WKF_SLOPPY
, 1},
197 static WOptionEnumeration seTitlebarModes
[] = {
198 {"new", TS_NEW
, 0}, {"old", TS_OLD
, 0},
199 {"next", TS_NEXT
, 0}, {NULL
, 0, 0}
202 static WOptionEnumeration seColormapModes
[] = {
203 {"Manual", WCM_CLICK
, 0}, {"ClickToFocus", WCM_CLICK
, 1},
204 {"Auto", WCM_POINTER
, 0}, {"FocusFollowMouse", WCM_POINTER
, 1},
208 static WOptionEnumeration sePlacements
[] = {
209 {"Auto", WPM_AUTO
, 0},
210 {"Smart", WPM_SMART
, 0},
211 {"Cascade", WPM_CASCADE
, 0},
212 {"Random", WPM_RANDOM
, 0},
213 {"Manual", WPM_MANUAL
, 0},
214 {"Center", WPM_CENTER
, 0},
218 static WOptionEnumeration seGeomDisplays
[] = {
219 {"None", WDIS_NONE
, 0},
220 {"Center", WDIS_CENTER
, 0},
221 {"Corner", WDIS_TOPLEFT
, 0},
222 {"Floating", WDIS_FRAME_CENTER
, 0},
223 {"Line", WDIS_NEW
, 0},
227 static WOptionEnumeration seSpeeds
[] = {
228 {"UltraFast", SPEED_ULTRAFAST
, 0},
229 {"Fast", SPEED_FAST
, 0},
230 {"Medium", SPEED_MEDIUM
, 0},
231 {"Slow", SPEED_SLOW
, 0},
232 {"UltraSlow", SPEED_ULTRASLOW
, 0},
236 static WOptionEnumeration seMouseButtonActions
[] = {
237 {"None", WA_NONE
, 0},
238 {"SelectWindows", WA_SELECT_WINDOWS
, 0},
239 {"OpenApplicationsMenu", WA_OPEN_APPMENU
, 0},
240 {"OpenWindowListMenu", WA_OPEN_WINLISTMENU
, 0},
241 {"MoveToPrevWorkspace", WA_MOVE_PREVWORKSPACE
, 0},
242 {"MoveToNextWorkspace", WA_MOVE_NEXTWORKSPACE
, 0},
243 {"MoveToPrevWindow", WA_MOVE_PREVWINDOW
, 0},
244 {"MoveToNextWindow", WA_MOVE_NEXTWINDOW
, 0},
248 static WOptionEnumeration seMouseWheelActions
[] = {
249 {"None", WA_NONE
, 0},
250 {"SwitchWorkspaces", WA_SWITCH_WORKSPACES
, 0},
251 {"SwitchWindows", WA_SWITCH_WINDOWS
, 0},
255 static WOptionEnumeration seIconificationStyles
[] = {
256 {"Zoom", WIS_ZOOM
, 0},
257 {"Twist", WIS_TWIST
, 0},
258 {"Flip", WIS_FLIP
, 0},
259 {"None", WIS_NONE
, 0},
260 {"random", WIS_RANDOM
, 0},
264 static WOptionEnumeration seJustifications
[] = {
265 {"Left", WTJ_LEFT
, 0},
266 {"Center", WTJ_CENTER
, 0},
267 {"Right", WTJ_RIGHT
, 0},
271 static WOptionEnumeration seIconPositions
[] = {
272 {"blv", IY_BOTTOM
| IY_LEFT
| IY_VERT
, 0},
273 {"blh", IY_BOTTOM
| IY_LEFT
| IY_HORIZ
, 0},
274 {"brv", IY_BOTTOM
| IY_RIGHT
| IY_VERT
, 0},
275 {"brh", IY_BOTTOM
| IY_RIGHT
| IY_HORIZ
, 0},
276 {"tlv", IY_TOP
| IY_LEFT
| IY_VERT
, 0},
277 {"tlh", IY_TOP
| IY_LEFT
| IY_HORIZ
, 0},
278 {"trv", IY_TOP
| IY_RIGHT
| IY_VERT
, 0},
279 {"trh", IY_TOP
| IY_RIGHT
| IY_HORIZ
, 0},
283 static WOptionEnumeration seMenuStyles
[] = {
284 {"normal", MS_NORMAL
, 0},
285 {"singletexture", MS_SINGLE_TEXTURE
, 0},
286 {"flat", MS_FLAT
, 0},
290 static WOptionEnumeration seDisplayPositions
[] = {
291 {"none", WD_NONE
, 0},
292 {"center", WD_CENTER
, 0},
294 {"bottom", WD_BOTTOM
, 0},
295 {"topleft", WD_TOPLEFT
, 0},
296 {"topright", WD_TOPRIGHT
, 0},
297 {"bottomleft", WD_BOTTOMLEFT
, 0},
298 {"bottomright", WD_BOTTOMRIGHT
, 0},
302 static WOptionEnumeration seWorkspaceBorder
[] = {
303 {"None", WB_NONE
, 0},
304 {"LeftRight", WB_LEFTRIGHT
, 0},
305 {"TopBottom", WB_TOPBOTTOM
, 0},
306 {"AllDirections", WB_ALLDIRS
, 0},
310 static WOptionEnumeration seDragMaximizedWindow
[] = {
311 {"Move", DRAGMAX_MOVE
, 0},
312 {"RestoreGeometry", DRAGMAX_RESTORE
, 0},
313 {"Unmaximize", DRAGMAX_UNMAXIMIZE
, 0},
314 {"NoMove", DRAGMAX_NOMOVE
, 0},
319 * ALL entries in the tables bellow, NEED to have a default value
320 * defined, and this value needs to be correct.
323 /* these options will only affect the window manager on startup
325 * static defaults can't access the screen data, because it is
326 * created after these defaults are read
328 WDefaultEntry staticOptionList
[] = {
330 {"ColormapSize", "4", NULL
,
331 &wPreferences
.cmap_size
, getInt
, NULL
, NULL
, NULL
},
332 {"DisableDithering", "NO", NULL
,
333 &wPreferences
.no_dithering
, getBool
, NULL
, NULL
, NULL
},
334 {"IconSize", "64", NULL
,
335 &wPreferences
.icon_size
, getInt
, NULL
, NULL
, NULL
},
336 {"ModifierKey", "Mod1", NULL
,
337 &wPreferences
.modifier_mask
, getModMask
, NULL
, NULL
, NULL
},
338 {"FocusMode", "manual", seFocusModes
, /* have a problem when switching from */
339 &wPreferences
.focus_mode
, getEnum
, NULL
, NULL
, NULL
}, /* manual to sloppy without restart */
340 {"NewStyle", "new", seTitlebarModes
,
341 &wPreferences
.new_style
, getEnum
, NULL
, NULL
, NULL
},
342 {"DisableDock", "NO", (void *)WM_DOCK
,
343 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
344 {"DisableClip", "NO", (void *)WM_CLIP
,
345 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
346 {"DisableDrawers", "NO", (void *)WM_DRAWER
,
347 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
348 {"ClipMergedInDock", "NO", NULL
,
349 NULL
, getBool
, setClipMergedInDock
, NULL
, NULL
},
350 {"DisableMiniwindows", "NO", NULL
,
351 &wPreferences
.disable_miniwindows
, getBool
, NULL
, NULL
, NULL
}
354 #define NUM2STRING_(x) #x
355 #define NUM2STRING(x) NUM2STRING_(x)
357 WDefaultEntry optionList
[] = {
359 /* dynamic options */
361 {"IconPosition", "blh", seIconPositions
,
362 &wPreferences
.icon_yard
, getEnum
, setIconPosition
, NULL
, NULL
},
363 {"IconificationStyle", "Zoom", seIconificationStyles
,
364 &wPreferences
.iconification_style
, getEnum
, NULL
, NULL
, NULL
},
365 {"DisableWSMouseActions", "NO", NULL
,
366 &wPreferences
.disable_root_mouse
, getBool
, NULL
, NULL
, NULL
},
367 {"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions
,
368 &wPreferences
.mouse_button1
, getEnum
, NULL
, NULL
, NULL
},
369 {"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions
,
370 &wPreferences
.mouse_button2
, getEnum
, NULL
, NULL
, NULL
},
371 {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions
,
372 &wPreferences
.mouse_button3
, getEnum
, NULL
, NULL
, NULL
},
373 {"MouseBackwardButtonAction", "None", seMouseButtonActions
,
374 &wPreferences
.mouse_button8
, getEnum
, NULL
, NULL
, NULL
},
375 {"MouseForwardButtonAction", "None", seMouseButtonActions
,
376 &wPreferences
.mouse_button9
, getEnum
, NULL
, NULL
, NULL
},
377 {"MouseWheelAction", "None", seMouseWheelActions
,
378 &wPreferences
.mouse_wheel_scroll
, getEnum
, NULL
, NULL
, NULL
},
379 {"MouseWheelTiltAction", "None", seMouseWheelActions
,
380 &wPreferences
.mouse_wheel_tilt
, getEnum
, NULL
, NULL
, NULL
},
381 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
382 &wPreferences
.pixmap_path
, getPathList
, NULL
, NULL
, NULL
},
383 {"IconPath", DEF_ICON_PATHS
, NULL
,
384 &wPreferences
.icon_path
, getPathList
, NULL
, NULL
, NULL
},
385 {"ColormapMode", "auto", seColormapModes
,
386 &wPreferences
.colormap_mode
, getEnum
, NULL
, NULL
, NULL
},
387 {"AutoFocus", "NO", NULL
,
388 &wPreferences
.auto_focus
, getBool
, NULL
, NULL
, NULL
},
389 {"RaiseDelay", "0", NULL
,
390 &wPreferences
.raise_delay
, getInt
, NULL
, NULL
, NULL
},
391 {"CirculateRaise", "NO", NULL
,
392 &wPreferences
.circ_raise
, getBool
, NULL
, NULL
, NULL
},
393 {"Superfluous", "NO", NULL
,
394 &wPreferences
.superfluous
, getBool
, NULL
, NULL
, NULL
},
395 {"AdvanceToNewWorkspace", "NO", NULL
,
396 &wPreferences
.ws_advance
, getBool
, NULL
, NULL
, NULL
},
397 {"CycleWorkspaces", "NO", NULL
,
398 &wPreferences
.ws_cycle
, getBool
, NULL
, NULL
, NULL
},
399 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
400 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
, NULL
, NULL
},
401 {"WorkspaceBorder", "None", seWorkspaceBorder
,
402 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
, NULL
, NULL
},
403 {"WorkspaceBorderSize", "0", NULL
,
404 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
, NULL
, NULL
},
405 {"StickyIcons", "NO", NULL
,
406 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
, NULL
, NULL
},
407 {"SaveSessionOnExit", "NO", NULL
,
408 &wPreferences
.save_session_on_exit
, getBool
, NULL
, NULL
, NULL
},
409 {"WrapMenus", "NO", NULL
,
410 &wPreferences
.wrap_menus
, getBool
, NULL
, NULL
, NULL
},
411 {"ScrollableMenus", "NO", NULL
,
412 &wPreferences
.scrollable_menus
, getBool
, NULL
, NULL
, NULL
},
413 {"MenuScrollSpeed", "medium", seSpeeds
,
414 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
, NULL
, NULL
},
415 {"IconSlideSpeed", "medium", seSpeeds
,
416 &wPreferences
.icon_slide_speed
, getEnum
, NULL
, NULL
, NULL
},
417 {"ShadeSpeed", "medium", seSpeeds
,
418 &wPreferences
.shade_speed
, getEnum
, NULL
, NULL
, NULL
},
419 {"BounceAppIconsWhenUrgent", "YES", NULL
,
420 &wPreferences
.bounce_appicons_when_urgent
, getBool
, NULL
, NULL
, NULL
},
421 {"RaiseAppIconsWhenBouncing", "NO", NULL
,
422 &wPreferences
.raise_appicons_when_bouncing
, getBool
, NULL
, NULL
, NULL
},
423 {"DoNotMakeAppIconsBounce", "NO", NULL
,
424 &wPreferences
.do_not_make_appicons_bounce
, getBool
, NULL
, NULL
, NULL
},
425 {"DoubleClickTime", "250", (void *)&wPreferences
.dblclick_time
,
426 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
, NULL
, NULL
},
427 {"ClipAutoraiseDelay", "600", NULL
,
428 &wPreferences
.clip_auto_raise_delay
, getInt
, NULL
, NULL
, NULL
},
429 {"ClipAutolowerDelay", "1000", NULL
,
430 &wPreferences
.clip_auto_lower_delay
, getInt
, NULL
, NULL
, NULL
},
431 {"ClipAutoexpandDelay", "600", NULL
,
432 &wPreferences
.clip_auto_expand_delay
, getInt
, NULL
, NULL
, NULL
},
433 {"ClipAutocollapseDelay", "1000", NULL
,
434 &wPreferences
.clip_auto_collapse_delay
, getInt
, NULL
, NULL
, NULL
},
435 {"WrapAppiconsInDock", "YES", NULL
,
436 NULL
, getBool
, setWrapAppiconsInDock
, NULL
, NULL
},
437 {"AlignSubmenus", "NO", NULL
,
438 &wPreferences
.align_menus
, getBool
, NULL
, NULL
, NULL
},
439 {"ViKeyMenus", "NO", NULL
,
440 &wPreferences
.vi_key_menus
, getBool
, NULL
, NULL
, NULL
},
441 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
442 &wPreferences
.open_transients_with_parent
, getBool
, NULL
, NULL
, NULL
},
443 {"WindowPlacement", "auto", sePlacements
,
444 &wPreferences
.window_placement
, getEnum
, NULL
, NULL
, NULL
},
445 {"IgnoreFocusClick", "NO", NULL
,
446 &wPreferences
.ignore_focus_click
, getBool
, NULL
, NULL
, NULL
},
447 {"UseSaveUnders", "NO", NULL
,
448 &wPreferences
.use_saveunders
, getBool
, NULL
, NULL
, NULL
},
449 {"OpaqueMove", "NO", NULL
,
450 &wPreferences
.opaque_move
, getBool
, NULL
, NULL
, NULL
},
451 {"OpaqueResize", "NO", NULL
,
452 &wPreferences
.opaque_resize
, getBool
, NULL
, NULL
, NULL
},
453 {"OpaqueMoveResizeKeyboard", "NO", NULL
,
454 &wPreferences
.opaque_move_resize_keyboard
, getBool
, NULL
, NULL
, NULL
},
455 {"DisableAnimations", "NO", NULL
,
456 &wPreferences
.no_animations
, getBool
, NULL
, NULL
, NULL
},
457 {"DontLinkWorkspaces", "NO", NULL
,
458 &wPreferences
.no_autowrap
, getBool
, NULL
, NULL
, NULL
},
459 {"WindowSnapping", "NO", NULL
,
460 &wPreferences
.window_snapping
, getBool
, NULL
, NULL
, NULL
},
461 {"DragMaximizedWindow", "Move", seDragMaximizedWindow
,
462 &wPreferences
.drag_maximized_window
, getEnum
, NULL
, NULL
, NULL
},
463 {"HighlightActiveApp", "YES", NULL
,
464 &wPreferences
.highlight_active_app
, getBool
, NULL
, NULL
, NULL
},
465 {"AutoArrangeIcons", "NO", NULL
,
466 &wPreferences
.auto_arrange_icons
, getBool
, NULL
, NULL
, NULL
},
467 {"NoWindowOverDock", "NO", NULL
,
468 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
, NULL
, NULL
},
469 {"NoWindowOverIcons", "NO", NULL
,
470 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
, NULL
, NULL
},
471 {"WindowPlaceOrigin", "(0, 0)", NULL
,
472 &wPreferences
.window_place_origin
, getCoord
, NULL
, NULL
, NULL
},
473 {"ResizeDisplay", "corner", seGeomDisplays
,
474 &wPreferences
.size_display
, getEnum
, NULL
, NULL
, NULL
},
475 {"MoveDisplay", "corner", seGeomDisplays
,
476 &wPreferences
.move_display
, getEnum
, NULL
, NULL
, NULL
},
477 {"DontConfirmKill", "NO", NULL
,
478 &wPreferences
.dont_confirm_kill
, getBool
, NULL
, NULL
, NULL
},
479 {"WindowTitleBalloons", "NO", NULL
,
480 &wPreferences
.window_balloon
, getBool
, NULL
, NULL
, NULL
},
481 {"MiniwindowTitleBalloons", "NO", NULL
,
482 &wPreferences
.miniwin_title_balloon
, getBool
, NULL
, NULL
, NULL
},
483 {"MiniwindowApercuBalloons", "NO", NULL
,
484 &wPreferences
.miniwin_apercu_balloon
, getBool
, NULL
, NULL
, NULL
},
485 {"AppIconBalloons", "NO", NULL
,
486 &wPreferences
.appicon_balloon
, getBool
, NULL
, NULL
, NULL
},
487 {"HelpBalloons", "NO", NULL
,
488 &wPreferences
.help_balloon
, getBool
, NULL
, NULL
, NULL
},
489 {"EdgeResistance", "30", NULL
,
490 &wPreferences
.edge_resistance
, getInt
, NULL
, NULL
, NULL
},
491 {"ResizeIncrement", "0", NULL
,
492 &wPreferences
.resize_increment
, getInt
, NULL
, NULL
, NULL
},
493 {"Attraction", "NO", NULL
,
494 &wPreferences
.attract
, getBool
, NULL
, NULL
, NULL
},
495 {"DisableBlinking", "NO", NULL
,
496 &wPreferences
.dont_blink
, getBool
, NULL
, NULL
, NULL
},
497 {"SingleClickLaunch", "NO", NULL
,
498 &wPreferences
.single_click
, getBool
, NULL
, NULL
, NULL
},
499 {"StrictWindozeCycle", "YES", NULL
,
500 &wPreferences
.strict_windoze_cycle
, getBool
, NULL
, NULL
, NULL
},
501 {"SwitchPanelOnlyOpen", "NO", NULL
,
502 &wPreferences
.panel_only_open
, getBool
, NULL
, NULL
, NULL
},
503 {"ApercuSize", "128", NULL
,
504 &wPreferences
.apercu_size
, getInt
, NULL
, NULL
, NULL
},
508 {"MenuStyle", "normal", seMenuStyles
,
509 &wPreferences
.menu_style
, getEnum
, setMenuStyle
, NULL
, NULL
},
510 {"WidgetColor", "(solid, gray)", NULL
,
511 NULL
, getTexture
, setWidgetColor
, NULL
, NULL
},
512 {"WorkspaceSpecificBack", "()", NULL
,
513 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
, NULL
, NULL
},
514 /* WorkspaceBack must come after WorkspaceSpecificBack or
515 * WorkspaceBack wont know WorkspaceSpecificBack was also
516 * specified and 2 copies of wmsetbg will be launched */
517 {"WorkspaceBack", "(solid, black)", NULL
,
518 NULL
, getWSBackground
, setWorkspaceBack
, NULL
, NULL
},
519 {"SmoothWorkspaceBack", "NO", NULL
,
520 NULL
, getBool
, NULL
, NULL
, NULL
},
521 {"IconBack", "(solid, gray)", NULL
,
522 NULL
, getTexture
, setIconTile
, NULL
, NULL
},
523 {"TitleJustify", "center", seJustifications
,
524 &wPreferences
.title_justification
, getEnum
, setJustify
, NULL
, NULL
},
525 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
526 NULL
, getFont
, setWinTitleFont
, NULL
, NULL
},
527 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
528 &wPreferences
.window_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
529 {"WindowTitleMinHeight", "0", NULL
,
530 &wPreferences
.window_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
531 {"WindowTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
532 &wPreferences
.window_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
533 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
534 &wPreferences
.menu_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
535 {"MenuTitleMinHeight", "0", NULL
,
536 &wPreferences
.menu_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
537 {"MenuTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
538 &wPreferences
.menu_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
539 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
540 &wPreferences
.menu_text_clearance
, getInt
, setClearance
, NULL
, NULL
},
541 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
542 NULL
, getFont
, setMenuTitleFont
, NULL
, NULL
},
543 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
544 NULL
, getFont
, setMenuTextFont
, NULL
, NULL
},
545 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
546 NULL
, getFont
, setIconTitleFont
, NULL
, NULL
},
547 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
548 NULL
, getFont
, setClipTitleFont
, NULL
, NULL
},
549 {"ShowClipTitle", "YES", NULL
,
550 &wPreferences
.show_clip_title
, getBool
, NULL
, NULL
, NULL
},
551 {"LargeDisplayFont", DEF_WORKSPACE_NAME_FONT
, NULL
,
552 NULL
, getFont
, setLargeDisplayFont
, NULL
, NULL
},
553 {"HighlightColor", "white", NULL
,
554 NULL
, getColor
, setHightlight
, NULL
, NULL
},
555 {"HighlightTextColor", "black", NULL
,
556 NULL
, getColor
, setHightlightText
, NULL
, NULL
},
557 {"ClipTitleColor", "black", (void *)CLIP_NORMAL
,
558 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
559 {"CClipTitleColor", "\"#454045\"", (void *)CLIP_COLLAPSED
,
560 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
561 {"FTitleColor", "white", (void *)WS_FOCUSED
,
562 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
563 {"PTitleColor", "white", (void *)WS_PFOCUSED
,
564 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
565 {"UTitleColor", "black", (void *)WS_UNFOCUSED
,
566 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
567 {"FTitleBack", "(solid, black)", NULL
,
568 NULL
, getTexture
, setFTitleBack
, NULL
, NULL
},
569 {"PTitleBack", "(solid, \"#616161\")", NULL
,
570 NULL
, getTexture
, setPTitleBack
, NULL
, NULL
},
571 {"UTitleBack", "(solid, gray)", NULL
,
572 NULL
, getTexture
, setUTitleBack
, NULL
, NULL
},
573 {"ResizebarBack", "(solid, gray)", NULL
,
574 NULL
, getTexture
, setResizebarBack
, NULL
, NULL
},
575 {"MenuTitleColor", "white", NULL
,
576 NULL
, getColor
, setMenuTitleColor
, NULL
, NULL
},
577 {"MenuTextColor", "black", NULL
,
578 NULL
, getColor
, setMenuTextColor
, NULL
, NULL
},
579 {"MenuDisabledColor", "\"#616161\"", NULL
,
580 NULL
, getColor
, setMenuDisabledColor
, NULL
, NULL
},
581 {"MenuTitleBack", "(solid, black)", NULL
,
582 NULL
, getTexture
, setMenuTitleBack
, NULL
, NULL
},
583 {"MenuTextBack", "(solid, gray)", NULL
,
584 NULL
, getTexture
, setMenuTextBack
, NULL
, NULL
},
585 {"IconTitleColor", "white", NULL
,
586 NULL
, getColor
, setIconTitleColor
, NULL
, NULL
},
587 {"IconTitleBack", "black", NULL
,
588 NULL
, getColor
, setIconTitleBack
, NULL
, NULL
},
589 {"SwitchPanelImages", "(swtile.png, swback.png, 30, 40)", &wPreferences
,
590 NULL
, getPropList
, setSwPOptions
, NULL
, NULL
},
591 {"ModifierKeyLabels", "(\"Shift+\", \"Control+\", \"Mod1+\", \"Mod2+\", \"Mod3+\", \"Mod4+\", \"Mod5+\")", &wPreferences
,
592 NULL
, getPropList
, setModifierKeyLabels
, NULL
, NULL
},
593 {"FrameBorderWidth", "1", NULL
,
594 NULL
, getInt
, setFrameBorderWidth
, NULL
, NULL
},
595 {"FrameBorderColor", "black", NULL
,
596 NULL
, getColor
, setFrameBorderColor
, NULL
, NULL
},
597 {"FrameFocusedBorderColor", "black", NULL
,
598 NULL
, getColor
, setFrameFocusedBorderColor
, NULL
, NULL
},
599 {"FrameSelectedBorderColor", "white", NULL
,
600 NULL
, getColor
, setFrameSelectedBorderColor
, NULL
, NULL
},
604 {"RootMenuKey", "None", (void *)WKBD_ROOTMENU
,
605 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
606 {"WindowListKey", "None", (void *)WKBD_WINDOWLIST
,
607 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
608 {"WindowMenuKey", "None", (void *)WKBD_WINDOWMENU
,
609 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
610 {"DockRaiseLowerKey", "None", (void*)WKBD_DOCKRAISELOWER
,
611 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
612 {"ClipRaiseLowerKey", "None", (void *)WKBD_CLIPRAISELOWER
,
613 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
614 {"MiniaturizeKey", "None", (void *)WKBD_MINIATURIZE
,
615 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
616 {"MinimizeAllKey", "None", (void *)WKBD_MINIMIZEALL
,
617 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
618 {"HideKey", "None", (void *)WKBD_HIDE
,
619 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
620 {"HideOthersKey", "None", (void *)WKBD_HIDE_OTHERS
,
621 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
622 {"MoveResizeKey", "None", (void *)WKBD_MOVERESIZE
,
623 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
624 {"CloseKey", "None", (void *)WKBD_CLOSE
,
625 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
626 {"MaximizeKey", "None", (void *)WKBD_MAXIMIZE
,
627 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
628 {"VMaximizeKey", "None", (void *)WKBD_VMAXIMIZE
,
629 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
630 {"HMaximizeKey", "None", (void *)WKBD_HMAXIMIZE
,
631 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
632 {"LHMaximizeKey", "None", (void*)WKBD_LHMAXIMIZE
,
633 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
634 {"RHMaximizeKey", "None", (void*)WKBD_RHMAXIMIZE
,
635 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
636 {"THMaximizeKey", "None", (void*)WKBD_THMAXIMIZE
,
637 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
638 {"BHMaximizeKey", "None", (void*)WKBD_BHMAXIMIZE
,
639 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
640 {"LTCMaximizeKey", "None", (void*)WKBD_LTCMAXIMIZE
,
641 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
642 {"RTCMaximizeKey", "None", (void*)WKBD_RTCMAXIMIZE
,
643 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
644 {"LBCMaximizeKey", "None", (void*)WKBD_LBCMAXIMIZE
,
645 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
646 {"RBCMaximizeKey", "None", (void*)WKBD_RBCMAXIMIZE
,
647 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
648 {"MaximusKey", "None", (void*)WKBD_MAXIMUS
,
649 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
650 {"OmnipresentKey", "None", (void *)WKBD_OMNIPRESENT
,
651 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
652 {"RaiseKey", "\"Meta+Up\"", (void *)WKBD_RAISE
,
653 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
654 {"LowerKey", "\"Meta+Down\"", (void *)WKBD_LOWER
,
655 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
656 {"RaiseLowerKey", "None", (void *)WKBD_RAISELOWER
,
657 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
658 {"ShadeKey", "None", (void *)WKBD_SHADE
,
659 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
660 {"SelectKey", "None", (void *)WKBD_SELECT
,
661 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
662 {"FocusNextKey", "None", (void *)WKBD_FOCUSNEXT
,
663 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
664 {"FocusPrevKey", "None", (void *)WKBD_FOCUSPREV
,
665 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
666 {"GroupNextKey", "None", (void *)WKBD_GROUPNEXT
,
667 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
668 {"GroupPrevKey", "None", (void *)WKBD_GROUPPREV
,
669 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
670 {"NextWorkspaceKey", "None", (void *)WKBD_NEXTWORKSPACE
,
671 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
672 {"PrevWorkspaceKey", "None", (void *)WKBD_PREVWORKSPACE
,
673 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
674 {"LastWorkspaceKey", "None", (void *)WKBD_LASTWORKSPACE
,
675 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
676 {"NextWorkspaceLayerKey", "None", (void *)WKBD_NEXTWSLAYER
,
677 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
678 {"PrevWorkspaceLayerKey", "None", (void *)WKBD_PREVWSLAYER
,
679 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
680 {"Workspace1Key", "None", (void *)WKBD_WORKSPACE1
,
681 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
682 {"Workspace2Key", "None", (void *)WKBD_WORKSPACE2
,
683 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
684 {"Workspace3Key", "None", (void *)WKBD_WORKSPACE3
,
685 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
686 {"Workspace4Key", "None", (void *)WKBD_WORKSPACE4
,
687 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
688 {"Workspace5Key", "None", (void *)WKBD_WORKSPACE5
,
689 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
690 {"Workspace6Key", "None", (void *)WKBD_WORKSPACE6
,
691 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
692 {"Workspace7Key", "None", (void *)WKBD_WORKSPACE7
,
693 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
694 {"Workspace8Key", "None", (void *)WKBD_WORKSPACE8
,
695 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
696 {"Workspace9Key", "None", (void *)WKBD_WORKSPACE9
,
697 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
698 {"Workspace10Key", "None", (void *)WKBD_WORKSPACE10
,
699 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
700 {"MoveToWorkspace1Key", "None", (void *)WKBD_MOVE_WORKSPACE1
,
701 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
702 {"MoveToWorkspace2Key", "None", (void *)WKBD_MOVE_WORKSPACE2
,
703 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
704 {"MoveToWorkspace3Key", "None", (void *)WKBD_MOVE_WORKSPACE3
,
705 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
706 {"MoveToWorkspace4Key", "None", (void *)WKBD_MOVE_WORKSPACE4
,
707 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
708 {"MoveToWorkspace5Key", "None", (void *)WKBD_MOVE_WORKSPACE5
,
709 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
710 {"MoveToWorkspace6Key", "None", (void *)WKBD_MOVE_WORKSPACE6
,
711 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
712 {"MoveToWorkspace7Key", "None", (void *)WKBD_MOVE_WORKSPACE7
,
713 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
714 {"MoveToWorkspace8Key", "None", (void *)WKBD_MOVE_WORKSPACE8
,
715 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
716 {"MoveToWorkspace9Key", "None", (void *)WKBD_MOVE_WORKSPACE9
,
717 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
718 {"MoveToWorkspace10Key", "None", (void *)WKBD_MOVE_WORKSPACE10
,
719 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
720 {"MoveToNextWorkspaceKey", "None", (void *)WKBD_MOVE_NEXTWORKSPACE
,
721 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
722 {"MoveToPrevWorkspaceKey", "None", (void *)WKBD_MOVE_PREVWORKSPACE
,
723 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
724 {"MoveToLastWorkspaceKey", "None", (void *)WKBD_MOVE_LASTWORKSPACE
,
725 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
726 {"MoveToNextWorkspaceLayerKey", "None", (void *)WKBD_MOVE_NEXTWSLAYER
,
727 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
728 {"MoveToPrevWorkspaceLayerKey", "None", (void *)WKBD_MOVE_PREVWSLAYER
,
729 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
730 {"WindowShortcut1Key", "None", (void *)WKBD_WINDOW1
,
731 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
732 {"WindowShortcut2Key", "None", (void *)WKBD_WINDOW2
,
733 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
734 {"WindowShortcut3Key", "None", (void *)WKBD_WINDOW3
,
735 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
736 {"WindowShortcut4Key", "None", (void *)WKBD_WINDOW4
,
737 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
738 {"WindowShortcut5Key", "None", (void *)WKBD_WINDOW5
,
739 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
740 {"WindowShortcut6Key", "None", (void *)WKBD_WINDOW6
,
741 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
742 {"WindowShortcut7Key", "None", (void *)WKBD_WINDOW7
,
743 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
744 {"WindowShortcut8Key", "None", (void *)WKBD_WINDOW8
,
745 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
746 {"WindowShortcut9Key", "None", (void *)WKBD_WINDOW9
,
747 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
748 {"WindowShortcut10Key", "None", (void *)WKBD_WINDOW10
,
749 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
750 {"WindowRelaunchKey", "None", (void *)WKBD_RELAUNCH
,
751 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
752 {"ScreenSwitchKey", "None", (void *)WKBD_SWITCH_SCREEN
,
753 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
754 {"RunKey", "None", (void *)WKBD_RUN
,
755 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
757 #ifdef KEEP_XKB_LOCK_STATUS
758 {"ToggleKbdModeKey", "None", (void *)WKBD_TOGGLE
,
759 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
760 {"KbdModeLock", "NO", NULL
,
761 &wPreferences
.modelock
, getBool
, NULL
, NULL
, NULL
},
762 #endif /* KEEP_XKB_LOCK_STATUS */
764 {"NormalCursor", "(builtin, left_ptr)", (void *)WCUR_ROOT
,
765 NULL
, getCursor
, setCursor
, NULL
, NULL
},
766 {"ArrowCursor", "(builtin, top_left_arrow)", (void *)WCUR_ARROW
,
767 NULL
, getCursor
, setCursor
, NULL
, NULL
},
768 {"MoveCursor", "(builtin, fleur)", (void *)WCUR_MOVE
,
769 NULL
, getCursor
, setCursor
, NULL
, NULL
},
770 {"ResizeCursor", "(builtin, sizing)", (void *)WCUR_RESIZE
,
771 NULL
, getCursor
, setCursor
, NULL
, NULL
},
772 {"TopLeftResizeCursor", "(builtin, top_left_corner)", (void *)WCUR_TOPLEFTRESIZE
,
773 NULL
, getCursor
, setCursor
, NULL
, NULL
},
774 {"TopRightResizeCursor", "(builtin, top_right_corner)", (void *)WCUR_TOPRIGHTRESIZE
,
775 NULL
, getCursor
, setCursor
, NULL
, NULL
},
776 {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)", (void *)WCUR_BOTTOMLEFTRESIZE
,
777 NULL
, getCursor
, setCursor
, NULL
, NULL
},
778 {"BottomRightResizeCursor", "(builtin, bottom_right_corner)", (void *)WCUR_BOTTOMRIGHTRESIZE
,
779 NULL
, getCursor
, setCursor
, NULL
, NULL
},
780 {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)", (void *)WCUR_VERTICALRESIZE
,
781 NULL
, getCursor
, setCursor
, NULL
, NULL
},
782 {"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)", (void *)WCUR_HORIZONRESIZE
,
783 NULL
, getCursor
, setCursor
, NULL
, NULL
},
784 {"WaitCursor", "(builtin, watch)", (void *)WCUR_WAIT
,
785 NULL
, getCursor
, setCursor
, NULL
, NULL
},
786 {"QuestionCursor", "(builtin, question_arrow)", (void *)WCUR_QUESTION
,
787 NULL
, getCursor
, setCursor
, NULL
, NULL
},
788 {"TextCursor", "(builtin, xterm)", (void *)WCUR_TEXT
,
789 NULL
, getCursor
, setCursor
, NULL
, NULL
},
790 {"SelectCursor", "(builtin, cross)", (void *)WCUR_SELECT
,
791 NULL
, getCursor
, setCursor
, NULL
, NULL
},
792 {"DialogHistoryLines", "500", NULL
,
793 &wPreferences
.history_lines
, getInt
, NULL
, NULL
, NULL
},
794 {"CycleActiveHeadOnly", "NO", NULL
,
795 &wPreferences
.cycle_active_head_only
, getBool
, NULL
, NULL
, NULL
},
796 {"CycleIgnoreMinimized", "NO", NULL
,
797 &wPreferences
.cycle_ignore_minimized
, getBool
, NULL
, NULL
, NULL
}
800 static void initDefaults(void)
803 WDefaultEntry
*entry
;
805 WMPLSetCaseSensitive(False
);
807 for (i
= 0; i
< wlengthof(optionList
); i
++) {
808 entry
= &optionList
[i
];
810 entry
->plkey
= WMCreatePLString(entry
->key
);
811 if (entry
->default_value
)
812 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
814 entry
->plvalue
= NULL
;
817 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
818 entry
= &staticOptionList
[i
];
820 entry
->plkey
= WMCreatePLString(entry
->key
);
821 if (entry
->default_value
)
822 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
824 entry
->plvalue
= NULL
;
828 static WMPropList
*readGlobalDomain(const char *domainName
, Bool requireDictionary
)
830 WMPropList
*globalDict
= NULL
;
834 snprintf(path
, sizeof(path
), "%s/%s/%s", SYSCONFDIR
, GLOBAL_DEFAULTS_SUBDIR
, domainName
);
835 if (stat(path
, &stbuf
) >= 0) {
836 globalDict
= WMReadPropListFromFile(path
);
837 if (globalDict
&& requireDictionary
&& !WMIsPLDictionary(globalDict
)) {
838 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"), domainName
, path
);
839 WMReleasePropList(globalDict
);
841 } else if (!globalDict
) {
842 wwarning(_("could not load domain %s from global defaults database"), domainName
);
849 #if defined(GLOBAL_PREAMBLE_MENU_FILE) || defined(GLOBAL_EPILOGUE_MENU_FILE)
850 static void prependMenu(WMPropList
* destarr
, WMPropList
* array
)
855 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
856 item
= WMGetFromPLArray(array
, i
);
858 WMInsertInPLArray(destarr
, i
+ 1, item
);
862 static void appendMenu(WMPropList
* destarr
, WMPropList
* array
)
867 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
868 item
= WMGetFromPLArray(array
, i
);
870 WMAddToPLArray(destarr
, item
);
875 void wDefaultsMergeGlobalMenus(WDDomain
* menuDomain
)
877 WMPropList
*menu
= menuDomain
->dictionary
;
880 if (!menu
|| !WMIsPLArray(menu
))
883 #ifdef GLOBAL_PREAMBLE_MENU_FILE
884 submenu
= WMReadPropListFromFile(SYSCONFDIR
"/" GLOBAL_DEFAULTS_SUBDIR
"/" GLOBAL_PREAMBLE_MENU_FILE
);
886 if (submenu
&& !WMIsPLArray(submenu
)) {
887 wwarning(_("invalid global menu file %s"), GLOBAL_PREAMBLE_MENU_FILE
);
888 WMReleasePropList(submenu
);
892 prependMenu(menu
, submenu
);
893 WMReleasePropList(submenu
);
897 #ifdef GLOBAL_EPILOGUE_MENU_FILE
898 submenu
= WMReadPropListFromFile(SYSCONFDIR
"/" GLOBAL_DEFAULTS_SUBDIR
"/" GLOBAL_EPILOGUE_MENU_FILE
);
900 if (submenu
&& !WMIsPLArray(submenu
)) {
901 wwarning(_("invalid global menu file %s"), GLOBAL_EPILOGUE_MENU_FILE
);
902 WMReleasePropList(submenu
);
906 appendMenu(menu
, submenu
);
907 WMReleasePropList(submenu
);
911 menuDomain
->dictionary
= menu
;
914 WDDomain
*wDefaultsInitDomain(const char *domain
, Bool requireDictionary
)
918 static int inited
= 0;
919 WMPropList
*shared_dict
= NULL
;
926 db
= wmalloc(sizeof(WDDomain
));
927 db
->domain_name
= domain
;
928 db
->path
= wdefaultspathfordomain(domain
);
930 if (stat(db
->path
, &stbuf
) >= 0) {
931 db
->dictionary
= WMReadPropListFromFile(db
->path
);
932 if (db
->dictionary
) {
933 if (requireDictionary
&& !WMIsPLDictionary(db
->dictionary
)) {
934 WMReleasePropList(db
->dictionary
);
935 db
->dictionary
= NULL
;
936 wwarning(_("Domain %s (%s) of defaults database is corrupted!"), domain
, db
->path
);
938 db
->timestamp
= stbuf
.st_mtime
;
940 wwarning(_("could not load domain %s from user defaults database"), domain
);
944 /* global system dictionary */
945 shared_dict
= readGlobalDomain(domain
, requireDictionary
);
947 if (shared_dict
&& db
->dictionary
&& WMIsPLDictionary(shared_dict
) &&
948 WMIsPLDictionary(db
->dictionary
)) {
949 WMMergePLDictionaries(shared_dict
, db
->dictionary
, True
);
950 WMReleasePropList(db
->dictionary
);
951 db
->dictionary
= shared_dict
;
952 if (stbuf
.st_mtime
> db
->timestamp
)
953 db
->timestamp
= stbuf
.st_mtime
;
954 } else if (!db
->dictionary
) {
955 db
->dictionary
= shared_dict
;
956 if (stbuf
.st_mtime
> db
->timestamp
)
957 db
->timestamp
= stbuf
.st_mtime
;
963 void wReadStaticDefaults(WMPropList
* dict
)
966 WDefaultEntry
*entry
;
970 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
971 entry
= &staticOptionList
[i
];
974 plvalue
= WMGetFromPLDictionary(dict
, entry
->plkey
);
978 /* no default in the DB. Use builtin default */
980 plvalue
= entry
->plvalue
;
984 (*entry
->convert
) (NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
986 (*entry
->update
) (NULL
, entry
, tdata
, entry
->extra_data
);
991 void wDefaultsCheckDomains(void* arg
)
995 WMPropList
*shared_dict
= NULL
;
999 /* Parameter not used, but tell the compiler that it is ok */
1002 if (stat(w_global
.domain
.wmaker
->path
, &stbuf
) >= 0 && w_global
.domain
.wmaker
->timestamp
< stbuf
.st_mtime
) {
1003 w_global
.domain
.wmaker
->timestamp
= stbuf
.st_mtime
;
1005 /* Global dictionary */
1006 shared_dict
= readGlobalDomain("WindowMaker", True
);
1008 /* User dictionary */
1009 dict
= WMReadPropListFromFile(w_global
.domain
.wmaker
->path
);
1012 if (!WMIsPLDictionary(dict
)) {
1013 WMReleasePropList(dict
);
1015 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1016 "WindowMaker", w_global
.domain
.wmaker
->path
);
1019 WMMergePLDictionaries(shared_dict
, dict
, True
);
1020 WMReleasePropList(dict
);
1025 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1026 scr
= wScreenWithNumber(i
);
1028 wReadDefaults(scr
, dict
);
1031 if (w_global
.domain
.wmaker
->dictionary
)
1032 WMReleasePropList(w_global
.domain
.wmaker
->dictionary
);
1034 w_global
.domain
.wmaker
->dictionary
= dict
;
1037 wwarning(_("could not load domain %s from user defaults database"), "WindowMaker");
1041 WMReleasePropList(shared_dict
);
1045 if (stat(w_global
.domain
.window_attr
->path
, &stbuf
) >= 0 && w_global
.domain
.window_attr
->timestamp
< stbuf
.st_mtime
) {
1046 /* global dictionary */
1047 shared_dict
= readGlobalDomain("WMWindowAttributes", True
);
1048 /* user dictionary */
1049 dict
= WMReadPropListFromFile(w_global
.domain
.window_attr
->path
);
1051 if (!WMIsPLDictionary(dict
)) {
1052 WMReleasePropList(dict
);
1054 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1055 "WMWindowAttributes", w_global
.domain
.window_attr
->path
);
1058 WMMergePLDictionaries(shared_dict
, dict
, True
);
1059 WMReleasePropList(dict
);
1064 if (w_global
.domain
.window_attr
->dictionary
)
1065 WMReleasePropList(w_global
.domain
.window_attr
->dictionary
);
1067 w_global
.domain
.window_attr
->dictionary
= dict
;
1068 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1069 scr
= wScreenWithNumber(i
);
1071 wDefaultUpdateIcons(scr
);
1073 /* Update the panel image if changed */
1074 /* Don't worry. If the image is the same these
1075 * functions will have no performance impact. */
1076 create_logo_image(scr
);
1081 wwarning(_("could not load domain %s from user defaults database"), "WMWindowAttributes");
1084 w_global
.domain
.window_attr
->timestamp
= stbuf
.st_mtime
;
1086 WMReleasePropList(shared_dict
);
1089 if (stat(w_global
.domain
.root_menu
->path
, &stbuf
) >= 0 && w_global
.domain
.root_menu
->timestamp
< stbuf
.st_mtime
) {
1090 dict
= WMReadPropListFromFile(w_global
.domain
.root_menu
->path
);
1092 if (!WMIsPLArray(dict
) && !WMIsPLString(dict
)) {
1093 WMReleasePropList(dict
);
1095 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1096 "WMRootMenu", w_global
.domain
.root_menu
->path
);
1098 if (w_global
.domain
.root_menu
->dictionary
)
1099 WMReleasePropList(w_global
.domain
.root_menu
->dictionary
);
1101 w_global
.domain
.root_menu
->dictionary
= dict
;
1102 wDefaultsMergeGlobalMenus(w_global
.domain
.root_menu
);
1105 wwarning(_("could not load domain %s from user defaults database"), "WMRootMenu");
1107 w_global
.domain
.root_menu
->timestamp
= stbuf
.st_mtime
;
1109 #ifndef HAVE_INOTIFY
1111 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, arg
);
1115 void wReadDefaults(WScreen
* scr
, WMPropList
* new_dict
)
1117 WMPropList
*plvalue
, *old_value
;
1118 WDefaultEntry
*entry
;
1120 int update_workspace_back
= 0; /* kluge :/ */
1121 unsigned int needs_refresh
;
1123 WMPropList
*old_dict
= (w_global
.domain
.wmaker
->dictionary
!= new_dict
? w_global
.domain
.wmaker
->dictionary
: NULL
);
1127 for (i
= 0; i
< wlengthof(optionList
); i
++) {
1128 entry
= &optionList
[i
];
1131 plvalue
= WMGetFromPLDictionary(new_dict
, entry
->plkey
);
1138 old_value
= WMGetFromPLDictionary(old_dict
, entry
->plkey
);
1140 if (!plvalue
&& !old_value
) {
1141 /* no default in the DB. Use builtin default */
1142 plvalue
= entry
->plvalue
;
1143 if (plvalue
&& new_dict
)
1144 WMPutInPLDictionary(new_dict
, entry
->plkey
, plvalue
);
1146 } else if (!plvalue
) {
1147 /* value was deleted from DB. Keep current value */
1149 } else if (!old_value
) {
1150 /* set value for the 1st time */
1151 } else if (!WMIsPropListEqualTo(plvalue
, old_value
)) {
1152 /* value has changed */
1154 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1155 && update_workspace_back
&& scr
->flags
.backimage_helper_launched
) {
1157 /* value was not changed since last time */
1164 if ((*entry
->convert
) (scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1166 * If the WorkspaceSpecificBack data has been changed
1167 * so that the helper will be launched now, we must be
1168 * sure to send the default background texture config
1171 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0 &&
1172 !scr
->flags
.backimage_helper_launched
)
1173 update_workspace_back
= 1;
1176 needs_refresh
|= (*entry
->update
) (scr
, entry
, tdata
, entry
->extra_data
);
1183 * Backward Compatibility:
1184 * the option 'apercu_size' used to be coded as a multiple of the icon size in v0.95.6
1185 * it is now expressed directly in pixels, but to avoid breaking user's setting we check
1186 * for old coding and convert it now.
1187 * This code should probably stay for at least 2 years, you should not consider removing
1188 * it before year 2017
1190 if (wPreferences
.apercu_size
< 24) {
1191 /* 24 is the minimum icon size proposed in WPref's settings */
1192 wPreferences
.apercu_size
*= wPreferences
.icon_size
;
1193 if (wPreferences
.miniwin_apercu_balloon
)
1194 wwarning(_("your ApercuSize setting is using old syntax, it is converted to %d pixels; consider running WPrefs.app to update your settings"),
1195 wPreferences
.apercu_size
);
1198 if (needs_refresh
!= 0 && !scr
->flags
.startup
) {
1202 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1203 foo
|= WTextureSettings
;
1204 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1205 foo
|= WFontSettings
;
1206 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1207 foo
|= WColorSettings
;
1209 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1210 (void *)(uintptr_t) foo
);
1213 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1214 foo
|= WTextureSettings
;
1215 if (needs_refresh
& REFRESH_MENU_FONT
)
1216 foo
|= WFontSettings
;
1217 if (needs_refresh
& REFRESH_MENU_COLOR
)
1218 foo
|= WColorSettings
;
1220 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1223 if (needs_refresh
& REFRESH_WINDOW_FONT
)
1224 foo
|= WFontSettings
;
1225 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
)
1226 foo
|= WTextureSettings
;
1227 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
)
1228 foo
|= WColorSettings
;
1230 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1232 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1234 if (needs_refresh
& REFRESH_ICON_FONT
)
1235 foo
|= WFontSettings
;
1236 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
)
1237 foo
|= WTextureSettings
;
1238 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
)
1239 foo
|= WTextureSettings
;
1241 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1242 (void *)(uintptr_t) foo
);
1244 if (needs_refresh
& REFRESH_ICON_TILE
)
1245 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1247 if (needs_refresh
& REFRESH_WORKSPACE_MENU
) {
1248 if (scr
->workspace_menu
)
1249 wWorkspaceMenuUpdate(scr
, scr
->workspace_menu
);
1250 if (scr
->clip_ws_menu
)
1251 wWorkspaceMenuUpdate(scr
, scr
->clip_ws_menu
);
1252 if (scr
->workspace_submenu
)
1253 scr
->workspace_submenu
->flags
.realized
= 0;
1254 if (scr
->clip_submenu
)
1255 scr
->clip_submenu
->flags
.realized
= 0;
1260 void wDefaultUpdateIcons(WScreen
*scr
)
1262 WAppIcon
*aicon
= scr
->app_icon_list
;
1264 WWindow
*wwin
= scr
->focused_window
;
1267 /* Get the application icon, default included */
1268 wIconChangeImageFile(aicon
->icon
, NULL
);
1269 wAppIconPaint(aicon
);
1270 aicon
= aicon
->next
;
1273 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
)
1274 wClipIconPaint(scr
->clip_icon
);
1276 for (dc
= scr
->drawers
; dc
!= NULL
; dc
= dc
->next
)
1277 wDrawerIconPaint(dc
->adrawer
->icon_array
[0]);
1280 if (wwin
->icon
&& wwin
->flags
.miniaturized
)
1281 wIconChangeImageFile(wwin
->icon
, NULL
);
1286 /* --------------------------- Local ----------------------- */
1288 #define GET_STRING_OR_DEFAULT(x, var) if (!WMIsPLString(value)) { \
1289 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1291 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1292 var = entry->default_value;\
1293 } else var = WMGetFromPLString(value)\
1296 static int string2index(WMPropList *key, WMPropList *val, const char *def, WOptionEnumeration * values)
1299 WOptionEnumeration
*v
;
1300 char buffer
[TOTAL_VALUES_LENGTH
];
1302 if (WMIsPLString(val
) && (str
= WMGetFromPLString(val
))) {
1303 for (v
= values
; v
->string
!= NULL
; v
++) {
1304 if (strcasecmp(v
->string
, str
) == 0)
1310 for (v
= values
; v
->string
!= NULL
; v
++) {
1313 strcat(buffer
, ", ");
1314 snprintf(buffer
+strlen(buffer
),
1315 sizeof(buffer
)-strlen(buffer
)-1, "\"%s\"", v
->string
);
1318 wwarning(_("wrong option value for key \"%s\"; got \"%s\", should be one of %s."),
1319 WMGetFromPLString(key
),
1320 WMIsPLString(val
) ? WMGetFromPLString(val
) : "(unknown)",
1324 return string2index(key
, val
, NULL
, values
);
1331 * value - is the value in the defaults DB
1332 * addr - is the address to store the data
1333 * ret - is the address to store a pointer to a temporary buffer. ret
1334 * must not be freed and is used by the set functions
1336 static int getBool(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1340 int second_pass
= 0;
1342 /* Parameter not used, but tell the compiler that it is ok */
1345 GET_STRING_OR_DEFAULT("Boolean", val
);
1348 if ((val
[1] == '\0' && (val
[0] == 'y' || val
[0] == 'Y'))
1349 || strcasecmp(val
, "YES") == 0) {
1352 } else if ((val
[1] == '\0' && (val
[0] == 'n' || val
[0] == 'N'))
1353 || strcasecmp(val
, "NO") == 0) {
1357 if (sscanf(val
, "%i", &i
) == 1) {
1363 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""), val
, entry
->key
);
1364 if (second_pass
== 0) {
1365 val
= WMGetFromPLString(entry
->plvalue
);
1367 wwarning(_("using default \"%s\" instead"), val
);
1377 *(char *)addr
= data
;
1382 static int getInt(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1387 /* Parameter not used, but tell the compiler that it is ok */
1390 GET_STRING_OR_DEFAULT("Integer", val
);
1392 if (sscanf(val
, "%i", &data
) != 1) {
1393 wwarning(_("can't convert \"%s\" to integer for key \"%s\""), val
, entry
->key
);
1394 val
= WMGetFromPLString(entry
->plvalue
);
1395 wwarning(_("using default \"%s\" instead"), val
);
1396 if (sscanf(val
, "%i", &data
) != 1) {
1404 *(int *)addr
= data
;
1409 static int getCoord(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1412 char *val_x
, *val_y
;
1413 int nelem
, changed
= 0;
1414 WMPropList
*elem_x
, *elem_y
;
1417 if (!WMIsPLArray(value
)) {
1418 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Coordinate");
1420 value
= entry
->plvalue
;
1422 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1428 nelem
= WMGetPropListItemCount(value
);
1430 wwarning(_("Incorrect number of elements in array for key \"%s\"."), entry
->key
);
1432 value
= entry
->plvalue
;
1434 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1440 elem_x
= WMGetFromPLArray(value
, 0);
1441 elem_y
= WMGetFromPLArray(value
, 1);
1443 if (!elem_x
|| !elem_y
|| !WMIsPLString(elem_x
) || !WMIsPLString(elem_y
)) {
1444 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."), entry
->key
);
1446 value
= entry
->plvalue
;
1448 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1454 val_x
= WMGetFromPLString(elem_x
);
1455 val_y
= WMGetFromPLString(elem_y
);
1457 if (sscanf(val_x
, "%i", &data
.x
) != 1 || sscanf(val_y
, "%i", &data
.y
) != 1) {
1458 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1460 value
= entry
->plvalue
;
1462 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1470 else if (data
.x
> scr
->scr_width
/ 3)
1471 data
.x
= scr
->scr_width
/ 3;
1474 else if (data
.y
> scr
->scr_height
/ 3)
1475 data
.y
= scr
->scr_height
/ 3;
1480 *(WCoord
*) addr
= data
;
1485 static int getPropList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1487 /* Parameter not used, but tell the compiler that it is ok */
1492 WMRetainPropList(value
);
1499 static int getPathList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1507 /* Parameter not used, but tell the compiler that it is ok */
1512 if (!WMIsPLArray(value
)) {
1513 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "an array of paths");
1515 value
= entry
->plvalue
;
1517 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1524 count
= WMGetPropListItemCount(value
);
1527 value
= entry
->plvalue
;
1529 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1536 for (i
= 0; i
< count
; i
++) {
1537 d
= WMGetFromPLArray(value
, i
);
1538 if (!d
|| !WMIsPLString(d
)) {
1542 len
+= strlen(WMGetFromPLString(d
)) + 1;
1545 ptr
= data
= wmalloc(len
+ 1);
1547 for (i
= 0; i
< count
; i
++) {
1548 d
= WMGetFromPLArray(value
, i
);
1549 if (!d
|| !WMIsPLString(d
)) {
1552 strcpy(ptr
, WMGetFromPLString(d
));
1553 ptr
+= strlen(WMGetFromPLString(d
));
1560 if (*(char **)addr
!= NULL
) {
1561 wfree(*(char **)addr
);
1563 *(char **)addr
= data
;
1568 static int getEnum(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1570 static signed char data
;
1572 /* Parameter not used, but tell the compiler that it is ok */
1575 data
= string2index(entry
->plkey
, value
, entry
->default_value
, (WOptionEnumeration
*) entry
->extra_data
);
1582 *(signed char *)addr
= data
;
1589 * (hgradient <color> <color>)
1590 * (vgradient <color> <color>)
1591 * (dgradient <color> <color>)
1592 * (mhgradient <color> <color> ...)
1593 * (mvgradient <color> <color> ...)
1594 * (mdgradient <color> <color> ...)
1595 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1596 * (tpixmap <file> <color>)
1597 * (spixmap <file> <color>)
1598 * (cpixmap <file> <color>)
1599 * (thgradient <file> <opaqueness> <color> <color>)
1600 * (tvgradient <file> <opaqueness> <color> <color>)
1601 * (tdgradient <file> <opaqueness> <color> <color>)
1602 * (function <lib> <function> ...)
1605 static WTexture
*parse_texture(WScreen
* scr
, WMPropList
* pl
)
1610 WTexture
*texture
= NULL
;
1612 nelem
= WMGetPropListItemCount(pl
);
1616 elem
= WMGetFromPLArray(pl
, 0);
1617 if (!elem
|| !WMIsPLString(elem
))
1619 val
= WMGetFromPLString(elem
);
1621 if (strcasecmp(val
, "solid") == 0) {
1629 elem
= WMGetFromPLArray(pl
, 1);
1630 if (!elem
|| !WMIsPLString(elem
))
1632 val
= WMGetFromPLString(elem
);
1634 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1635 wwarning(_("\"%s\" is not a valid color name"), val
);
1639 texture
= (WTexture
*) wTextureMakeSolid(scr
, &color
);
1640 } else if (strcasecmp(val
, "dgradient") == 0
1641 || strcasecmp(val
, "vgradient") == 0 || strcasecmp(val
, "hgradient") == 0) {
1642 RColor color1
, color2
;
1647 wwarning(_("bad number of arguments in gradient specification"));
1651 if (val
[0] == 'd' || val
[0] == 'D')
1652 type
= WTEX_DGRADIENT
;
1653 else if (val
[0] == 'h' || val
[0] == 'H')
1654 type
= WTEX_HGRADIENT
;
1656 type
= WTEX_VGRADIENT
;
1658 /* get from color */
1659 elem
= WMGetFromPLArray(pl
, 1);
1660 if (!elem
|| !WMIsPLString(elem
))
1662 val
= WMGetFromPLString(elem
);
1664 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1665 wwarning(_("\"%s\" is not a valid color name"), val
);
1669 color1
.red
= xcolor
.red
>> 8;
1670 color1
.green
= xcolor
.green
>> 8;
1671 color1
.blue
= xcolor
.blue
>> 8;
1674 elem
= WMGetFromPLArray(pl
, 2);
1675 if (!elem
|| !WMIsPLString(elem
)) {
1678 val
= WMGetFromPLString(elem
);
1680 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1681 wwarning(_("\"%s\" is not a valid color name"), val
);
1685 color2
.red
= xcolor
.red
>> 8;
1686 color2
.green
= xcolor
.green
>> 8;
1687 color2
.blue
= xcolor
.blue
>> 8;
1689 texture
= (WTexture
*) wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1691 } else if (strcasecmp(val
, "igradient") == 0) {
1692 RColor colors1
[2], colors2
[2];
1698 wwarning(_("bad number of arguments in gradient specification"));
1702 /* get from color */
1703 for (i
= 0; i
< 2; i
++) {
1704 elem
= WMGetFromPLArray(pl
, 1 + i
);
1705 if (!elem
|| !WMIsPLString(elem
))
1707 val
= WMGetFromPLString(elem
);
1709 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1710 wwarning(_("\"%s\" is not a valid color name"), val
);
1713 colors1
[i
].alpha
= 255;
1714 colors1
[i
].red
= xcolor
.red
>> 8;
1715 colors1
[i
].green
= xcolor
.green
>> 8;
1716 colors1
[i
].blue
= xcolor
.blue
>> 8;
1718 elem
= WMGetFromPLArray(pl
, 3);
1719 if (!elem
|| !WMIsPLString(elem
))
1721 val
= WMGetFromPLString(elem
);
1724 /* get from color */
1725 for (i
= 0; i
< 2; i
++) {
1726 elem
= WMGetFromPLArray(pl
, 4 + i
);
1727 if (!elem
|| !WMIsPLString(elem
))
1729 val
= WMGetFromPLString(elem
);
1731 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1732 wwarning(_("\"%s\" is not a valid color name"), val
);
1735 colors2
[i
].alpha
= 255;
1736 colors2
[i
].red
= xcolor
.red
>> 8;
1737 colors2
[i
].green
= xcolor
.green
>> 8;
1738 colors2
[i
].blue
= xcolor
.blue
>> 8;
1740 elem
= WMGetFromPLArray(pl
, 6);
1741 if (!elem
|| !WMIsPLString(elem
))
1743 val
= WMGetFromPLString(elem
);
1746 texture
= (WTexture
*) wTextureMakeIGradient(scr
, th1
, colors1
, th2
, colors2
);
1748 } else if (strcasecmp(val
, "mhgradient") == 0
1749 || strcasecmp(val
, "mvgradient") == 0 || strcasecmp(val
, "mdgradient") == 0) {
1756 wwarning(_("too few arguments in multicolor gradient specification"));
1760 if (val
[1] == 'h' || val
[1] == 'H')
1761 type
= WTEX_MHGRADIENT
;
1762 else if (val
[1] == 'v' || val
[1] == 'V')
1763 type
= WTEX_MVGRADIENT
;
1765 type
= WTEX_MDGRADIENT
;
1769 colors
= wmalloc(sizeof(RColor
*) * (count
+ 1));
1771 for (i
= 0; i
< count
; i
++) {
1772 elem
= WMGetFromPLArray(pl
, i
+ 1);
1773 if (!elem
|| !WMIsPLString(elem
)) {
1774 for (--i
; i
>= 0; --i
) {
1780 val
= WMGetFromPLString(elem
);
1782 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1783 wwarning(_("\"%s\" is not a valid color name"), val
);
1784 for (--i
; i
>= 0; --i
) {
1790 colors
[i
] = wmalloc(sizeof(RColor
));
1791 colors
[i
]->red
= color
.red
>> 8;
1792 colors
[i
]->green
= color
.green
>> 8;
1793 colors
[i
]->blue
= color
.blue
>> 8;
1798 texture
= (WTexture
*) wTextureMakeMGradient(scr
, type
, colors
);
1799 } else if (strcasecmp(val
, "spixmap") == 0 ||
1800 strcasecmp(val
, "cpixmap") == 0 || strcasecmp(val
, "tpixmap") == 0) {
1807 if (val
[0] == 's' || val
[0] == 'S')
1809 else if (val
[0] == 'c' || val
[0] == 'C')
1815 elem
= WMGetFromPLArray(pl
, 2);
1816 if (!elem
|| !WMIsPLString(elem
)) {
1819 val
= WMGetFromPLString(elem
);
1821 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1822 wwarning(_("\"%s\" is not a valid color name"), val
);
1827 elem
= WMGetFromPLArray(pl
, 1);
1828 if (!elem
|| !WMIsPLString(elem
))
1830 val
= WMGetFromPLString(elem
);
1832 texture
= (WTexture
*) wTextureMakePixmap(scr
, type
, val
, &color
);
1833 } else if (strcasecmp(val
, "thgradient") == 0
1834 || strcasecmp(val
, "tvgradient") == 0 || strcasecmp(val
, "tdgradient") == 0) {
1835 RColor color1
, color2
;
1840 if (val
[1] == 'h' || val
[1] == 'H')
1841 style
= WTEX_THGRADIENT
;
1842 else if (val
[1] == 'v' || val
[1] == 'V')
1843 style
= WTEX_TVGRADIENT
;
1845 style
= WTEX_TDGRADIENT
;
1848 wwarning(_("bad number of arguments in textured gradient specification"));
1852 /* get from color */
1853 elem
= WMGetFromPLArray(pl
, 3);
1854 if (!elem
|| !WMIsPLString(elem
))
1856 val
= WMGetFromPLString(elem
);
1858 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1859 wwarning(_("\"%s\" is not a valid color name"), val
);
1863 color1
.red
= xcolor
.red
>> 8;
1864 color1
.green
= xcolor
.green
>> 8;
1865 color1
.blue
= xcolor
.blue
>> 8;
1868 elem
= WMGetFromPLArray(pl
, 4);
1869 if (!elem
|| !WMIsPLString(elem
)) {
1872 val
= WMGetFromPLString(elem
);
1874 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1875 wwarning(_("\"%s\" is not a valid color name"), val
);
1879 color2
.red
= xcolor
.red
>> 8;
1880 color2
.green
= xcolor
.green
>> 8;
1881 color2
.blue
= xcolor
.blue
>> 8;
1884 elem
= WMGetFromPLArray(pl
, 2);
1885 if (!elem
|| !WMIsPLString(elem
))
1888 val
= WMGetFromPLString(elem
);
1890 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
1891 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
1896 elem
= WMGetFromPLArray(pl
, 1);
1897 if (!elem
|| !WMIsPLString(elem
))
1899 val
= WMGetFromPLString(elem
);
1901 texture
= (WTexture
*) wTextureMakeTGradient(scr
, style
, &color1
, &color2
, val
, opacity
);
1902 } else if (strcasecmp(val
, "function") == 0) {
1903 /* Leave this in to handle the unlikely case of
1904 * someone actually having function textures configured */
1905 wwarning("function texture support has been removed");
1908 wwarning(_("invalid texture type %s"), val
);
1914 static int getTexture(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1916 static WTexture
*texture
;
1920 if (!WMIsPLArray(value
)) {
1921 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Texture");
1923 value
= entry
->plvalue
;
1925 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1931 if (strcmp(entry
->key
, "WidgetColor") == 0 && !changed
) {
1934 pl
= WMGetFromPLArray(value
, 0);
1935 if (!pl
|| !WMIsPLString(pl
) || !WMGetFromPLString(pl
)
1936 || strcasecmp(WMGetFromPLString(pl
), "solid") != 0) {
1937 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1938 entry
->key
, "Solid Texture");
1940 value
= entry
->plvalue
;
1942 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1947 texture
= parse_texture(scr
, value
);
1950 wwarning(_("Error in texture specification for key \"%s\""), entry
->key
);
1952 value
= entry
->plvalue
;
1954 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1964 *(WTexture
**) addr
= texture
;
1969 static int getWSBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1976 /* Parameter not used, but tell the compiler that it is ok */
1981 if (!WMIsPLArray(value
)) {
1982 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1983 "WorkspaceBack", "Texture or None");
1985 value
= entry
->plvalue
;
1987 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1993 /* only do basic error checking and verify for None texture */
1995 nelem
= WMGetPropListItemCount(value
);
1997 elem
= WMGetFromPLArray(value
, 0);
1998 if (!elem
|| !WMIsPLString(elem
)) {
1999 wwarning(_("Wrong type for workspace background. Should be a texture type."));
2001 value
= entry
->plvalue
;
2003 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2008 val
= WMGetFromPLString(elem
);
2010 if (strcasecmp(val
, "None") == 0)
2013 *ret
= WMRetainPropList(value
);
2019 getWSSpecificBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2025 /* Parameter not used, but tell the compiler that it is ok */
2030 if (!WMIsPLArray(value
)) {
2031 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2032 "WorkspaceSpecificBack", "an array of textures");
2034 value
= entry
->plvalue
;
2036 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2042 /* only do basic error checking and verify for None texture */
2044 nelem
= WMGetPropListItemCount(value
);
2047 elem
= WMGetFromPLArray(value
, nelem
);
2048 if (!elem
|| !WMIsPLArray(elem
)) {
2049 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2055 *ret
= WMRetainPropList(value
);
2059 * Kluge to force wmsetbg helper to set the default background.
2060 * If the WorkspaceSpecificBack is changed once wmaker has started,
2061 * the WorkspaceBack won't be sent to the helper, unless the user
2062 * changes it's value too. So, we must force this by removing the
2063 * value from the defaults DB.
2065 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2066 WMPropList
*key
= WMCreatePLString("WorkspaceBack");
2068 WMRemoveFromPLDictionary(w_global
.domain
.wmaker
->dictionary
, key
);
2070 WMReleasePropList(key
);
2076 static int getFont(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2078 static WMFont
*font
;
2083 GET_STRING_OR_DEFAULT("Font", val
);
2085 font
= WMCreateFont(scr
->wmscreen
, val
);
2087 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2090 wfatal(_("could not load any usable font!!!"));
2097 /* can't assign font value outside update function */
2098 wassertrv(addr
== NULL
, True
);
2103 static int getColor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2105 static XColor color
;
2107 int second_pass
= 0;
2111 GET_STRING_OR_DEFAULT("Color", val
);
2114 if (!wGetColor(scr
, val
, &color
)) {
2115 wwarning(_("could not get color for key \"%s\""), entry
->key
);
2116 if (second_pass
== 0) {
2117 val
= WMGetFromPLString(entry
->plvalue
);
2119 wwarning(_("using default \"%s\" instead"), val
);
2128 assert(addr
== NULL
);
2131 *(unsigned long*)addr = pixel;
2137 static int getKeybind(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2139 static WShortKey shortcut
;
2143 char buf
[MAX_SHORTCUT_LENGTH
], *b
;
2145 /* Parameter not used, but tell the compiler that it is ok */
2149 GET_STRING_OR_DEFAULT("Key spec", val
);
2151 if (!val
|| strcasecmp(val
, "NONE") == 0) {
2152 shortcut
.keycode
= 0;
2153 shortcut
.modifier
= 0;
2159 wstrlcpy(buf
, val
, MAX_SHORTCUT_LENGTH
);
2164 shortcut
.modifier
= 0;
2165 while ((k
= strchr(b
, '+')) != NULL
) {
2169 mod
= wXModifierFromKey(b
);
2171 wwarning(_("%s: invalid key modifier \"%s\""), entry
->key
, b
);
2174 shortcut
.modifier
|= mod
;
2180 ksym
= XStringToKeysym(b
);
2182 if (ksym
== NoSymbol
) {
2183 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
, val
);
2187 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2188 if (shortcut
.keycode
== 0) {
2189 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2199 static int getModMask(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2204 /* Parameter not used, but tell the compiler that it is ok */
2207 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2212 mask
= wXModifierFromKey(str
);
2214 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2220 *(int *)addr
= mask
;
2228 # include <X11/cursorfont.h>
2234 #define CURSOR_ID_NONE (XC_num_glyphs)
2236 static const WCursorLookup cursor_table
[] = {
2237 {"X_cursor", XC_X_cursor
},
2238 {"arrow", XC_arrow
},
2239 {"based_arrow_down", XC_based_arrow_down
},
2240 {"based_arrow_up", XC_based_arrow_up
},
2242 {"bogosity", XC_bogosity
},
2243 {"bottom_left_corner", XC_bottom_left_corner
},
2244 {"bottom_right_corner", XC_bottom_right_corner
},
2245 {"bottom_side", XC_bottom_side
},
2246 {"bottom_tee", XC_bottom_tee
},
2247 {"box_spiral", XC_box_spiral
},
2248 {"center_ptr", XC_center_ptr
},
2249 {"circle", XC_circle
},
2250 {"clock", XC_clock
},
2251 {"coffee_mug", XC_coffee_mug
},
2252 {"cross", XC_cross
},
2253 {"cross_reverse", XC_cross_reverse
},
2254 {"crosshair", XC_crosshair
},
2255 {"diamond_cross", XC_diamond_cross
},
2257 {"dotbox", XC_dotbox
},
2258 {"double_arrow", XC_double_arrow
},
2259 {"draft_large", XC_draft_large
},
2260 {"draft_small", XC_draft_small
},
2261 {"draped_box", XC_draped_box
},
2262 {"exchange", XC_exchange
},
2263 {"fleur", XC_fleur
},
2264 {"gobbler", XC_gobbler
},
2265 {"gumby", XC_gumby
},
2266 {"hand1", XC_hand1
},
2267 {"hand2", XC_hand2
},
2268 {"heart", XC_heart
},
2270 {"iron_cross", XC_iron_cross
},
2271 {"left_ptr", XC_left_ptr
},
2272 {"left_side", XC_left_side
},
2273 {"left_tee", XC_left_tee
},
2274 {"leftbutton", XC_leftbutton
},
2275 {"ll_angle", XC_ll_angle
},
2276 {"lr_angle", XC_lr_angle
},
2278 {"middlebutton", XC_middlebutton
},
2279 {"mouse", XC_mouse
},
2280 {"pencil", XC_pencil
},
2281 {"pirate", XC_pirate
},
2283 {"question_arrow", XC_question_arrow
},
2284 {"right_ptr", XC_right_ptr
},
2285 {"right_side", XC_right_side
},
2286 {"right_tee", XC_right_tee
},
2287 {"rightbutton", XC_rightbutton
},
2288 {"rtl_logo", XC_rtl_logo
},
2289 {"sailboat", XC_sailboat
},
2290 {"sb_down_arrow", XC_sb_down_arrow
},
2291 {"sb_h_double_arrow", XC_sb_h_double_arrow
},
2292 {"sb_left_arrow", XC_sb_left_arrow
},
2293 {"sb_right_arrow", XC_sb_right_arrow
},
2294 {"sb_up_arrow", XC_sb_up_arrow
},
2295 {"sb_v_double_arrow", XC_sb_v_double_arrow
},
2296 {"shuttle", XC_shuttle
},
2297 {"sizing", XC_sizing
},
2298 {"spider", XC_spider
},
2299 {"spraycan", XC_spraycan
},
2301 {"target", XC_target
},
2302 {"tcross", XC_tcross
},
2303 {"top_left_arrow", XC_top_left_arrow
},
2304 {"top_left_corner", XC_top_left_corner
},
2305 {"top_right_corner", XC_top_right_corner
},
2306 {"top_side", XC_top_side
},
2307 {"top_tee", XC_top_tee
},
2309 {"ul_angle", XC_ul_angle
},
2310 {"umbrella", XC_umbrella
},
2311 {"ur_angle", XC_ur_angle
},
2312 {"watch", XC_watch
},
2313 {"xterm", XC_xterm
},
2314 {NULL
, CURSOR_ID_NONE
}
2317 static void check_bitmap_status(int status
, const char *filename
, Pixmap bitmap
)
2320 case BitmapOpenFailed
:
2321 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2323 case BitmapFileInvalid
:
2324 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2326 case BitmapNoMemory
:
2327 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2330 XFreePixmap(dpy
, bitmap
);
2337 * (builtin, <cursor_name>)
2338 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2340 static int parse_cursor(WScreen
* scr
, WMPropList
* pl
, Cursor
* cursor
)
2347 nelem
= WMGetPropListItemCount(pl
);
2351 elem
= WMGetFromPLArray(pl
, 0);
2352 if (!elem
|| !WMIsPLString(elem
)) {
2355 val
= WMGetFromPLString(elem
);
2357 if (strcasecmp(val
, "none") == 0) {
2360 } else if (strcasecmp(val
, "builtin") == 0) {
2362 int cursor_id
= CURSOR_ID_NONE
;
2365 wwarning(_("bad number of arguments in cursor specification"));
2368 elem
= WMGetFromPLArray(pl
, 1);
2369 if (!elem
|| !WMIsPLString(elem
)) {
2372 val
= WMGetFromPLString(elem
);
2374 for (i
= 0; cursor_table
[i
].name
!= NULL
; i
++) {
2375 if (strcasecmp(val
, cursor_table
[i
].name
) == 0) {
2376 cursor_id
= cursor_table
[i
].id
;
2380 if (CURSOR_ID_NONE
== cursor_id
) {
2381 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2383 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2386 } else if (strcasecmp(val
, "bitmap") == 0) {
2398 wwarning(_("bad number of arguments in cursor specification"));
2401 elem
= WMGetFromPLArray(pl
, 1);
2402 if (!elem
|| !WMIsPLString(elem
)) {
2405 val
= WMGetFromPLString(elem
);
2406 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2408 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2411 elem
= WMGetFromPLArray(pl
, 2);
2412 if (!elem
|| !WMIsPLString(elem
)) {
2416 val
= WMGetFromPLString(elem
);
2417 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2420 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2423 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
, &mask
, &x
, &y
);
2424 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
, &bitmap
, &x
, &y
);
2425 if ((BitmapSuccess
== bitmap_status
) && (BitmapSuccess
== mask_status
)) {
2426 fg
.pixel
= scr
->black_pixel
;
2427 bg
.pixel
= scr
->white_pixel
;
2428 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2429 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2430 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2433 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2434 check_bitmap_status(mask_status
, mask_name
, mask
);
2441 static int getCursor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2443 static Cursor cursor
;
2448 if (!WMIsPLArray(value
)) {
2449 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2450 entry
->key
, "cursor specification");
2452 value
= entry
->plvalue
;
2454 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2459 status
= parse_cursor(scr
, value
, &cursor
);
2461 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2463 value
= entry
->plvalue
;
2465 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2474 *(Cursor
*) addr
= cursor
;
2479 #undef CURSOR_ID_NONE
2481 /* ---------------- value setting functions --------------- */
2482 static int setJustify(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2484 /* Parameter not used, but tell the compiler that it is ok */
2490 return REFRESH_WINDOW_TITLE_COLOR
;
2493 static int setClearance(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2495 /* Parameter not used, but tell the compiler that it is ok */
2501 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
| REFRESH_MENU_TITLE_FONT
| REFRESH_MENU_FONT
;
2504 static int setIfDockPresent(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2507 long which
= (long) extra_data
;
2509 /* Parameter not used, but tell the compiler that it is ok */
2515 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2516 // Drawers require the dock
2517 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| wPreferences
.flags
.nodock
;
2520 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2523 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| *flag
;
2531 static int setClipMergedInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2535 /* Parameter not used, but tell the compiler that it is ok */
2540 wPreferences
.flags
.clip_merged_in_dock
= *flag
;
2541 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2545 static int setWrapAppiconsInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2549 /* Parameter not used, but tell the compiler that it is ok */
2554 wPreferences
.flags
.wrap_appicons_in_dock
= *flag
;
2558 static int setStickyIcons(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2560 /* Parameter not used, but tell the compiler that it is ok */
2565 if (scr
->workspaces
) {
2566 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2567 wArrangeIcons(scr
, False
);
2572 static int setIconTile(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2576 WTexture
** texture
= tdata
;
2579 /* Parameter not used, but tell the compiler that it is ok */
2582 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2583 wPreferences
.icon_size
, ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2584 ? WREL_ICON
: WREL_FLAT
);
2586 wwarning(_("could not render texture for icon background"));
2588 wTextureDestroy(scr
, *texture
);
2591 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2593 if (scr
->icon_tile
) {
2595 RReleaseImage(scr
->icon_tile
);
2596 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2599 scr
->icon_tile
= img
;
2601 /* put the icon in the noticeboard hint */
2602 PropSetIconTileHint(scr
, img
);
2604 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
) {
2605 if (scr
->clip_tile
) {
2606 RReleaseImage(scr
->clip_tile
);
2608 scr
->clip_tile
= wClipMakeTile(img
);
2611 if (!wPreferences
.flags
.nodrawer
) {
2612 if (scr
->drawer_tile
) {
2613 RReleaseImage(scr
->drawer_tile
);
2615 scr
->drawer_tile
= wDrawerMakeTile(scr
, img
);
2618 scr
->icon_tile_pixmap
= pixmap
;
2620 if (scr
->def_icon_rimage
) {
2621 RReleaseImage(scr
->def_icon_rimage
);
2622 scr
->def_icon_rimage
= NULL
;
2625 if (scr
->icon_back_texture
)
2626 wTextureDestroy(scr
, (WTexture
*) scr
->icon_back_texture
);
2628 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2630 /* Free the texture as nobody else will use it, nor refer to it. */
2632 wTextureDestroy(scr
, *texture
);
2634 return (reset
? REFRESH_ICON_TILE
: 0);
2637 static int setWinTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2639 WMFont
*font
= tdata
;
2641 /* Parameter not used, but tell the compiler that it is ok */
2645 if (scr
->title_font
) {
2646 WMReleaseFont(scr
->title_font
);
2648 scr
->title_font
= font
;
2650 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
;
2653 static int setMenuTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2655 WMFont
*font
= tdata
;
2657 /* Parameter not used, but tell the compiler that it is ok */
2661 if (scr
->menu_title_font
) {
2662 WMReleaseFont(scr
->menu_title_font
);
2665 scr
->menu_title_font
= font
;
2667 return REFRESH_MENU_TITLE_FONT
;
2670 static int setMenuTextFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2672 WMFont
*font
= tdata
;
2674 /* Parameter not used, but tell the compiler that it is ok */
2678 if (scr
->menu_entry_font
) {
2679 WMReleaseFont(scr
->menu_entry_font
);
2681 scr
->menu_entry_font
= font
;
2683 return REFRESH_MENU_FONT
;
2686 static int setIconTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2688 WMFont
*font
= tdata
;
2690 /* Parameter not used, but tell the compiler that it is ok */
2694 if (scr
->icon_title_font
) {
2695 WMReleaseFont(scr
->icon_title_font
);
2698 scr
->icon_title_font
= font
;
2700 return REFRESH_ICON_FONT
;
2703 static int setClipTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2705 WMFont
*font
= tdata
;
2707 /* Parameter not used, but tell the compiler that it is ok */
2711 if (scr
->clip_title_font
) {
2712 WMReleaseFont(scr
->clip_title_font
);
2715 scr
->clip_title_font
= font
;
2717 return REFRESH_ICON_FONT
;
2720 static int setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2722 WMFont
*font
= tdata
;
2724 /* Parameter not used, but tell the compiler that it is ok */
2729 if (scr
->workspace_name_font
)
2730 WMReleaseFont(scr
->workspace_name_font
);
2732 scr
->workspace_name_font
= font
;
2737 static int setHightlight(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2739 XColor
*color
= tdata
;
2741 /* Parameter not used, but tell the compiler that it is ok */
2745 if (scr
->select_color
)
2746 WMReleaseColor(scr
->select_color
);
2748 scr
->select_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2750 wFreeColor(scr
, color
->pixel
);
2752 return REFRESH_MENU_COLOR
;
2755 static int setHightlightText(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2757 XColor
*color
= tdata
;
2759 /* Parameter not used, but tell the compiler that it is ok */
2763 if (scr
->select_text_color
)
2764 WMReleaseColor(scr
->select_text_color
);
2766 scr
->select_text_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2768 wFreeColor(scr
, color
->pixel
);
2770 return REFRESH_MENU_COLOR
;
2773 static int setClipTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2775 XColor
*color
= tdata
;
2776 long widx
= (long) extra_data
;
2778 /* Parameter not used, but tell the compiler that it is ok */
2781 if (scr
->clip_title_color
[widx
])
2782 WMReleaseColor(scr
->clip_title_color
[widx
]);
2784 scr
->clip_title_color
[widx
] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2785 wFreeColor(scr
, color
->pixel
);
2787 return REFRESH_ICON_TITLE_COLOR
;
2790 static int setWTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2792 XColor
*color
= tdata
;
2793 long widx
= (long) extra_data
;
2795 /* Parameter not used, but tell the compiler that it is ok */
2798 if (scr
->window_title_color
[widx
])
2799 WMReleaseColor(scr
->window_title_color
[widx
]);
2801 scr
->window_title_color
[widx
] =
2802 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2804 wFreeColor(scr
, color
->pixel
);
2806 return REFRESH_WINDOW_TITLE_COLOR
;
2809 static int setMenuTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2811 XColor
*color
= tdata
;
2813 /* Parameter not used, but tell the compiler that it is ok */
2817 if (scr
->menu_title_color
[0])
2818 WMReleaseColor(scr
->menu_title_color
[0]);
2820 scr
->menu_title_color
[0] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2822 wFreeColor(scr
, color
->pixel
);
2824 return REFRESH_MENU_TITLE_COLOR
;
2827 static int setMenuTextColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2829 XColor
*color
= tdata
;
2831 /* Parameter not used, but tell the compiler that it is ok */
2835 if (scr
->mtext_color
)
2836 WMReleaseColor(scr
->mtext_color
);
2838 scr
->mtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2840 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2841 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2843 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2846 wFreeColor(scr
, color
->pixel
);
2848 return REFRESH_MENU_COLOR
;
2851 static int setMenuDisabledColor(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
->dtext_color
)
2860 WMReleaseColor(scr
->dtext_color
);
2862 scr
->dtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2864 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2865 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2867 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2870 wFreeColor(scr
, color
->pixel
);
2872 return REFRESH_MENU_COLOR
;
2875 static int setIconTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2877 XColor
*color
= tdata
;
2879 /* Parameter not used, but tell the compiler that it is ok */
2883 if (scr
->icon_title_color
)
2884 WMReleaseColor(scr
->icon_title_color
);
2885 scr
->icon_title_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2887 wFreeColor(scr
, color
->pixel
);
2889 return REFRESH_ICON_TITLE_COLOR
;
2892 static int setIconTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2894 XColor
*color
= tdata
;
2896 /* Parameter not used, but tell the compiler that it is ok */
2900 if (scr
->icon_title_texture
) {
2901 wTextureDestroy(scr
, (WTexture
*) scr
->icon_title_texture
);
2903 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
2905 return REFRESH_ICON_TITLE_BACK
;
2908 static int setFrameBorderWidth(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2912 /* Parameter not used, but tell the compiler that it is ok */
2916 scr
->frame_border_width
= *value
;
2918 return REFRESH_FRAME_BORDER
;
2921 static int setFrameBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2923 XColor
*color
= tdata
;
2925 /* Parameter not used, but tell the compiler that it is ok */
2929 if (scr
->frame_border_color
)
2930 WMReleaseColor(scr
->frame_border_color
);
2931 scr
->frame_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2933 wFreeColor(scr
, color
->pixel
);
2935 return REFRESH_FRAME_BORDER
;
2938 static int setFrameFocusedBorderColor(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2940 XColor
*color
= tdata
;
2942 /* Parameter not used, but tell the compiler that it is ok */
2946 if (scr
->frame_focused_border_color
)
2947 WMReleaseColor(scr
->frame_focused_border_color
);
2948 scr
->frame_focused_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2950 wFreeColor(scr
, color
->pixel
);
2952 return REFRESH_FRAME_BORDER
;
2955 static int setFrameSelectedBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2957 XColor
*color
= tdata
;
2959 /* Parameter not used, but tell the compiler that it is ok */
2963 if (scr
->frame_selected_border_color
)
2964 WMReleaseColor(scr
->frame_selected_border_color
);
2965 scr
->frame_selected_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2967 wFreeColor(scr
, color
->pixel
);
2969 return REFRESH_FRAME_BORDER
;
2972 static int setWorkspaceSpecificBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
2974 WMPropList
*value
= tdata
;
2979 /* Parameter not used, but tell the compiler that it is ok */
2983 if (scr
->flags
.backimage_helper_launched
) {
2984 if (WMGetPropListItemCount(value
) == 0) {
2985 SendHelperMessage(scr
, 'C', 0, NULL
);
2986 SendHelperMessage(scr
, 'K', 0, NULL
);
2988 WMReleasePropList(value
);
2992 if (WMGetPropListItemCount(value
) == 0)
2995 if (!start_bg_helper(scr
)) {
2996 WMReleasePropList(value
);
3000 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3003 for (i
= 0; i
< WMGetPropListItemCount(value
); i
++) {
3004 val
= WMGetFromPLArray(value
, i
);
3005 if (val
&& WMIsPLArray(val
) && WMGetPropListItemCount(val
) > 0) {
3006 str
= WMGetPropListDescription(val
, False
);
3008 SendHelperMessage(scr
, 'S', i
+ 1, str
);
3012 SendHelperMessage(scr
, 'U', i
+ 1, NULL
);
3017 WMReleasePropList(value
);
3021 static int setWorkspaceBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
3023 WMPropList
*value
= tdata
;
3025 /* Parameter not used, but tell the compiler that it is ok */
3029 if (scr
->flags
.backimage_helper_launched
) {
3032 if (WMGetPropListItemCount(value
) == 0) {
3033 SendHelperMessage(scr
, 'U', 0, NULL
);
3035 /* set the default workspace background to this one */
3036 str
= WMGetPropListDescription(value
, False
);
3038 SendHelperMessage(scr
, 'S', 0, str
);
3040 SendHelperMessage(scr
, 'C', scr
->current_workspace
+ 1, NULL
);
3042 SendHelperMessage(scr
, 'U', 0, NULL
);
3045 } else if (WMGetPropListItemCount(value
) > 0) {
3051 text
= WMGetPropListDescription(value
, False
);
3052 len
= strlen(text
) + 40;
3053 command
= wmalloc(len
);
3054 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3055 if (!strchr(text
, '\'') && !strchr(text
, '\\')) {
3056 command
= wmalloc(len
);
3057 if (wPreferences
.smooth_workspace_back
)
3058 snprintf(command
, len
, "wmsetbg %s -S -p '%s' &", dither
, text
);
3060 snprintf(command
, len
, "wmsetbg %s -p '%s' &", dither
, text
);
3061 ExecuteShellCommand(scr
, command
);
3064 wwarning(_("Invalid arguments for background \"%s\""), text
);
3067 WMReleasePropList(value
);
3072 static int setWidgetColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3074 WTexture
**texture
= tdata
;
3076 /* Parameter not used, but tell the compiler that it is ok */
3080 if (scr
->widget_texture
) {
3081 wTextureDestroy(scr
, (WTexture
*) scr
->widget_texture
);
3083 scr
->widget_texture
= *(WTexSolid
**) texture
;
3088 static int setFTitleBack(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
->window_title_texture
[WS_FOCUSED
]) {
3097 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3099 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3101 return REFRESH_WINDOW_TEXTURES
;
3104 static int setPTitleBack(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_PFOCUSED
]) {
3113 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3115 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3117 return REFRESH_WINDOW_TEXTURES
;
3120 static int setUTitleBack(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_UNFOCUSED
]) {
3129 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3131 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3133 return REFRESH_WINDOW_TEXTURES
;
3136 static int setResizebarBack(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
->resizebar_texture
[0]) {
3145 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3147 scr
->resizebar_texture
[0] = *texture
;
3149 return REFRESH_WINDOW_TEXTURES
;
3152 static int setMenuTitleBack(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
->menu_title_texture
[0]) {
3161 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3163 scr
->menu_title_texture
[0] = *texture
;
3165 return REFRESH_MENU_TITLE_TEXTURE
;
3168 static int setMenuTextBack(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_item_texture
) {
3177 wTextureDestroy(scr
, scr
->menu_item_texture
);
3178 wTextureDestroy(scr
, (WTexture
*) scr
->menu_item_auxtexture
);
3180 scr
->menu_item_texture
= *texture
;
3182 scr
->menu_item_auxtexture
= wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3184 return REFRESH_MENU_TEXTURE
;
3187 static int setKeyGrab(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3189 WShortKey
*shortcut
= tdata
;
3191 long widx
= (long) extra_data
;
3193 /* Parameter not used, but tell the compiler that it is ok */
3196 wKeyBindings
[widx
] = *shortcut
;
3198 wwin
= scr
->focused_window
;
3200 while (wwin
!= NULL
) {
3201 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3203 if (!WFLAGP(wwin
, no_bind_keys
)) {
3204 wWindowSetKeyGrabs(wwin
);
3209 /* do we need to update window menus? */
3210 if (widx
>= WKBD_WORKSPACE1
&& widx
<= WKBD_WORKSPACE10
)
3211 return REFRESH_WORKSPACE_MENU
;
3212 if (widx
== WKBD_LASTWORKSPACE
)
3213 return REFRESH_WORKSPACE_MENU
;
3214 if (widx
>= WKBD_MOVE_WORKSPACE1
&& widx
<= WKBD_MOVE_WORKSPACE10
)
3215 return REFRESH_WORKSPACE_MENU
;
3220 static int setIconPosition(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3222 /* Parameter not used, but tell the compiler that it is ok */
3227 wScreenUpdateUsableArea(scr
);
3228 wArrangeIcons(scr
, True
);
3233 static int updateUsableArea(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3235 /* Parameter not used, but tell the compiler that it is ok */
3240 wScreenUpdateUsableArea(scr
);
3245 static int setMenuStyle(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3247 /* Parameter not used, but tell the compiler that it is ok */
3253 return REFRESH_MENU_TEXTURE
;
3256 static RImage
*chopOffImage(RImage
* image
, int x
, int y
, int w
, int h
)
3258 RImage
*img
= RCreateImage(w
, h
, image
->format
== RRGBAFormat
);
3260 RCopyArea(img
, image
, x
, y
, w
, h
, 0, 0);
3265 static int setSwPOptions(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3267 WMPropList
*array
= tdata
;
3270 int cwidth
, cheight
;
3271 struct WPreferences
*prefs
= foo
;
3273 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) == 0) {
3274 if (prefs
->swtileImage
)
3275 RReleaseImage(prefs
->swtileImage
);
3276 prefs
->swtileImage
= NULL
;
3278 WMReleasePropList(array
);
3282 switch (WMGetPropListItemCount(array
)) {
3284 if (!WMIsPLString(WMGetFromPLArray(array
, 1))) {
3285 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3288 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 1)));
3291 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3292 WMGetFromPLString(WMGetFromPLArray(array
, 1)), entry
->key
);
3294 bgimage
= RLoadImage(scr
->rcontext
, path
, 0);
3296 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3301 cwidth
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 2)));
3302 cheight
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 3)));
3304 if (cwidth
<= 0 || cheight
<= 0 ||
3305 cwidth
>= bgimage
->width
- 2 || cheight
>= bgimage
->height
- 2)
3306 wwarning(_("Invalid split sizes for switch panel back image."));
3309 int swidth
, theight
;
3310 for (i
= 0; i
< 9; i
++) {
3311 if (prefs
->swbackImage
[i
])
3312 RReleaseImage(prefs
->swbackImage
[i
]);
3313 prefs
->swbackImage
[i
] = NULL
;
3315 swidth
= (bgimage
->width
- cwidth
) / 2;
3316 theight
= (bgimage
->height
- cheight
) / 2;
3318 prefs
->swbackImage
[0] = chopOffImage(bgimage
, 0, 0, swidth
, theight
);
3319 prefs
->swbackImage
[1] = chopOffImage(bgimage
, swidth
, 0, cwidth
, theight
);
3320 prefs
->swbackImage
[2] = chopOffImage(bgimage
, swidth
+ cwidth
, 0,
3323 prefs
->swbackImage
[3] = chopOffImage(bgimage
, 0, theight
, swidth
, cheight
);
3324 prefs
->swbackImage
[4] = chopOffImage(bgimage
, swidth
, theight
,
3326 prefs
->swbackImage
[5] = chopOffImage(bgimage
, swidth
+ cwidth
, theight
,
3329 prefs
->swbackImage
[6] = chopOffImage(bgimage
, 0, theight
+ cheight
,
3331 prefs
->swbackImage
[7] = chopOffImage(bgimage
, swidth
, theight
+ cheight
,
3333 prefs
->swbackImage
[8] =
3334 chopOffImage(bgimage
, swidth
+ cwidth
, theight
+ cheight
, swidth
,
3337 // check if anything failed
3338 for (i
= 0; i
< 9; i
++) {
3339 if (!prefs
->swbackImage
[i
]) {
3340 for (; i
>= 0; --i
) {
3341 RReleaseImage(prefs
->swbackImage
[i
]);
3342 prefs
->swbackImage
[i
] = NULL
;
3348 RReleaseImage(bgimage
);
3353 if (!WMIsPLString(WMGetFromPLArray(array
, 0))) {
3354 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3357 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 0)));
3360 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3361 WMGetFromPLString(WMGetFromPLArray(array
, 0)), entry
->key
);
3363 if (prefs
->swtileImage
)
3364 RReleaseImage(prefs
->swtileImage
);
3366 prefs
->swtileImage
= RLoadImage(scr
->rcontext
, path
, 0);
3367 if (!prefs
->swtileImage
) {
3368 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3375 wwarning(_("Invalid number of arguments for option \"%s\""), entry
->key
);
3379 WMReleasePropList(array
);
3384 static int setModifierKeyLabels(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3386 WMPropList
*array
= tdata
;
3388 struct WPreferences
*prefs
= foo
;
3390 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) != 7) {
3391 wwarning(_("Value for option \"%s\" must be an array of 7 strings"), entry
->key
);
3392 WMReleasePropList(array
);
3396 DestroyWindowMenu(scr
);
3398 for (i
= 0; i
< 7; i
++) {
3399 if (prefs
->modifier_labels
[i
])
3400 wfree(prefs
->modifier_labels
[i
]);
3402 if (WMIsPLString(WMGetFromPLArray(array
, i
))) {
3403 prefs
->modifier_labels
[i
] = wstrdup(WMGetFromPLString(WMGetFromPLArray(array
, i
)));
3405 wwarning(_("Invalid argument for option \"%s\" item %d"), entry
->key
, i
);
3406 prefs
->modifier_labels
[i
] = NULL
;
3410 WMReleasePropList(array
);
3415 static int setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3419 /* Parameter not used, but tell the compiler that it is ok */
3426 W_setconf_doubleClickDelay(*value
);
3431 static int setCursor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3433 Cursor
*cursor
= tdata
;
3434 long widx
= (long) extra_data
;
3436 /* Parameter not used, but tell the compiler that it is ok */
3439 if (wPreferences
.cursor
[widx
] != None
) {
3440 XFreeCursor(dpy
, wPreferences
.cursor
[widx
]);
3443 wPreferences
.cursor
[widx
] = *cursor
;
3445 if (widx
== WCUR_ROOT
&& *cursor
!= None
) {
3446 XDefineCursor(dpy
, scr
->root_win
, *cursor
);