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
7 * Copyright (c) 2014 Window Maker Team
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
35 #include <sys/types.h>
41 #define PATH_MAX DEFAULT_PATH_MAX
45 #include <X11/Xutil.h>
46 #include <X11/keysym.h>
50 #include "WindowMaker.h"
55 #include "resources.h"
58 #include "xmodifier.h"
63 #include "workspace.h"
64 #include "properties.h"
68 #define MAX_SHORTCUT_LENGTH 32
70 typedef struct _WDefaultEntry WDefaultEntry
;
71 typedef int (WDECallbackConvert
) (WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*plvalue
, void *addr
, void **tdata
);
72 typedef int (WDECallbackUpdate
) (WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *extra_data
);
74 struct _WDefaultEntry
{
76 const char *default_value
;
79 WDECallbackConvert
*convert
;
80 WDECallbackUpdate
*update
;
82 WMPropList
*plvalue
; /* default value */
85 /* used to map strings to integers */
93 static WDECallbackConvert getBool
;
94 static WDECallbackConvert getInt
;
95 static WDECallbackConvert getCoord
;
96 static WDECallbackConvert getPathList
;
97 static WDECallbackConvert getEnum
;
98 static WDECallbackConvert getTexture
;
99 static WDECallbackConvert getWSBackground
;
100 static WDECallbackConvert getWSSpecificBackground
;
101 static WDECallbackConvert getFont
;
102 static WDECallbackConvert getColor
;
103 static WDECallbackConvert getKeybind
;
104 static WDECallbackConvert getModMask
;
105 static WDECallbackConvert getPropList
;
107 /* value setting functions */
108 static WDECallbackUpdate setJustify
;
109 static WDECallbackUpdate setClearance
;
110 static WDECallbackUpdate setIfDockPresent
;
111 static WDECallbackUpdate setClipMergedInDock
;
112 static WDECallbackUpdate setWrapAppiconsInDock
;
113 static WDECallbackUpdate setStickyIcons
;
114 static WDECallbackUpdate setWidgetColor
;
115 static WDECallbackUpdate setIconTile
;
116 static WDECallbackUpdate setWinTitleFont
;
117 static WDECallbackUpdate setMenuTitleFont
;
118 static WDECallbackUpdate setMenuTextFont
;
119 static WDECallbackUpdate setIconTitleFont
;
120 static WDECallbackUpdate setIconTitleColor
;
121 static WDECallbackUpdate setIconTitleBack
;
122 static WDECallbackUpdate setFrameBorderWidth
;
123 static WDECallbackUpdate setFrameBorderColor
;
124 static WDECallbackUpdate setFrameFocusedBorderColor
;
125 static WDECallbackUpdate setFrameSelectedBorderColor
;
126 static WDECallbackUpdate setLargeDisplayFont
;
127 static WDECallbackUpdate setWTitleColor
;
128 static WDECallbackUpdate setFTitleBack
;
129 static WDECallbackUpdate setPTitleBack
;
130 static WDECallbackUpdate setUTitleBack
;
131 static WDECallbackUpdate setResizebarBack
;
132 static WDECallbackUpdate setWorkspaceBack
;
133 static WDECallbackUpdate setWorkspaceSpecificBack
;
134 static WDECallbackUpdate setMenuTitleColor
;
135 static WDECallbackUpdate setMenuTextColor
;
136 static WDECallbackUpdate setMenuDisabledColor
;
137 static WDECallbackUpdate setMenuTitleBack
;
138 static WDECallbackUpdate setMenuTextBack
;
139 static WDECallbackUpdate setHightlight
;
140 static WDECallbackUpdate setHightlightText
;
141 static WDECallbackUpdate setKeyGrab
;
142 static WDECallbackUpdate setDoubleClick
;
143 static WDECallbackUpdate setIconPosition
;
144 static WDECallbackUpdate setWorkspaceMapBackground
;
146 static WDECallbackUpdate setClipTitleFont
;
147 static WDECallbackUpdate setClipTitleColor
;
149 static WDECallbackUpdate setMenuStyle
;
150 static WDECallbackUpdate setSwPOptions
;
151 static WDECallbackUpdate updateUsableArea
;
153 static WDECallbackUpdate setModifierKeyLabels
;
155 static WDECallbackConvert getCursor
;
156 static WDECallbackUpdate setCursor
;
159 * Tables to convert strings to enumeration values.
160 * Values stored are char
163 /* WARNING: sum of length of all value strings must not exceed
165 #define TOTAL_VALUES_LENGTH 80
167 #define REFRESH_WINDOW_TEXTURES (1<<0)
168 #define REFRESH_MENU_TEXTURE (1<<1)
169 #define REFRESH_MENU_FONT (1<<2)
170 #define REFRESH_MENU_COLOR (1<<3)
171 #define REFRESH_MENU_TITLE_TEXTURE (1<<4)
172 #define REFRESH_MENU_TITLE_FONT (1<<5)
173 #define REFRESH_MENU_TITLE_COLOR (1<<6)
174 #define REFRESH_WINDOW_TITLE_COLOR (1<<7)
175 #define REFRESH_WINDOW_FONT (1<<8)
176 #define REFRESH_ICON_TILE (1<<9)
177 #define REFRESH_ICON_FONT (1<<10)
179 #define REFRESH_BUTTON_IMAGES (1<<11)
181 #define REFRESH_ICON_TITLE_COLOR (1<<12)
182 #define REFRESH_ICON_TITLE_BACK (1<<13)
184 #define REFRESH_WORKSPACE_MENU (1<<14)
186 #define REFRESH_FRAME_BORDER REFRESH_MENU_FONT|REFRESH_WINDOW_FONT
188 static WOptionEnumeration seFocusModes
[] = {
189 {"Manual", WKF_CLICK
, 0}, {"ClickToFocus", WKF_CLICK
, 1},
190 {"Sloppy", WKF_SLOPPY
, 0}, {"SemiAuto", WKF_SLOPPY
, 1}, {"Auto", WKF_SLOPPY
, 1},
194 static WOptionEnumeration seTitlebarModes
[] = {
195 {"new", TS_NEW
, 0}, {"old", TS_OLD
, 0},
196 {"next", TS_NEXT
, 0}, {NULL
, 0, 0}
199 static WOptionEnumeration seColormapModes
[] = {
200 {"Manual", WCM_CLICK
, 0}, {"ClickToFocus", WCM_CLICK
, 1},
201 {"Auto", WCM_POINTER
, 0}, {"FocusFollowMouse", WCM_POINTER
, 1},
205 static WOptionEnumeration sePlacements
[] = {
206 {"Auto", WPM_AUTO
, 0},
207 {"Smart", WPM_SMART
, 0},
208 {"Cascade", WPM_CASCADE
, 0},
209 {"Random", WPM_RANDOM
, 0},
210 {"Manual", WPM_MANUAL
, 0},
211 {"Center", WPM_CENTER
, 0},
215 static WOptionEnumeration seGeomDisplays
[] = {
216 {"None", WDIS_NONE
, 0},
217 {"Center", WDIS_CENTER
, 0},
218 {"Corner", WDIS_TOPLEFT
, 0},
219 {"Floating", WDIS_FRAME_CENTER
, 0},
220 {"Line", WDIS_NEW
, 0},
224 static WOptionEnumeration seSpeeds
[] = {
225 {"UltraFast", SPEED_ULTRAFAST
, 0},
226 {"Fast", SPEED_FAST
, 0},
227 {"Medium", SPEED_MEDIUM
, 0},
228 {"Slow", SPEED_SLOW
, 0},
229 {"UltraSlow", SPEED_ULTRASLOW
, 0},
233 static WOptionEnumeration seMouseButtonActions
[] = {
234 {"None", WA_NONE
, 0},
235 {"SelectWindows", WA_SELECT_WINDOWS
, 0},
236 {"OpenApplicationsMenu", WA_OPEN_APPMENU
, 0},
237 {"OpenWindowListMenu", WA_OPEN_WINLISTMENU
, 0},
238 {"MoveToPrevWorkspace", WA_MOVE_PREVWORKSPACE
, 0},
239 {"MoveToNextWorkspace", WA_MOVE_NEXTWORKSPACE
, 0},
240 {"MoveToPrevWindow", WA_MOVE_PREVWINDOW
, 0},
241 {"MoveToNextWindow", WA_MOVE_NEXTWINDOW
, 0},
245 static WOptionEnumeration seMouseWheelActions
[] = {
246 {"None", WA_NONE
, 0},
247 {"SwitchWorkspaces", WA_SWITCH_WORKSPACES
, 0},
248 {"SwitchWindows", WA_SWITCH_WINDOWS
, 0},
252 static WOptionEnumeration seIconificationStyles
[] = {
253 {"Zoom", WIS_ZOOM
, 0},
254 {"Twist", WIS_TWIST
, 0},
255 {"Flip", WIS_FLIP
, 0},
256 {"None", WIS_NONE
, 0},
257 {"random", WIS_RANDOM
, 0},
261 static WOptionEnumeration seJustifications
[] = {
262 {"Left", WTJ_LEFT
, 0},
263 {"Center", WTJ_CENTER
, 0},
264 {"Right", WTJ_RIGHT
, 0},
268 static WOptionEnumeration seIconPositions
[] = {
269 {"blv", IY_BOTTOM
| IY_LEFT
| IY_VERT
, 0},
270 {"blh", IY_BOTTOM
| IY_LEFT
| IY_HORIZ
, 0},
271 {"brv", IY_BOTTOM
| IY_RIGHT
| IY_VERT
, 0},
272 {"brh", IY_BOTTOM
| IY_RIGHT
| IY_HORIZ
, 0},
273 {"tlv", IY_TOP
| IY_LEFT
| IY_VERT
, 0},
274 {"tlh", IY_TOP
| IY_LEFT
| IY_HORIZ
, 0},
275 {"trv", IY_TOP
| IY_RIGHT
| IY_VERT
, 0},
276 {"trh", IY_TOP
| IY_RIGHT
| IY_HORIZ
, 0},
280 static WOptionEnumeration seMenuStyles
[] = {
281 {"normal", MS_NORMAL
, 0},
282 {"singletexture", MS_SINGLE_TEXTURE
, 0},
283 {"flat", MS_FLAT
, 0},
287 static WOptionEnumeration seDisplayPositions
[] = {
288 {"none", WD_NONE
, 0},
289 {"center", WD_CENTER
, 0},
291 {"bottom", WD_BOTTOM
, 0},
292 {"topleft", WD_TOPLEFT
, 0},
293 {"topright", WD_TOPRIGHT
, 0},
294 {"bottomleft", WD_BOTTOMLEFT
, 0},
295 {"bottomright", WD_BOTTOMRIGHT
, 0},
299 static WOptionEnumeration seWorkspaceBorder
[] = {
300 {"None", WB_NONE
, 0},
301 {"LeftRight", WB_LEFTRIGHT
, 0},
302 {"TopBottom", WB_TOPBOTTOM
, 0},
303 {"AllDirections", WB_ALLDIRS
, 0},
307 static WOptionEnumeration seDragMaximizedWindow
[] = {
308 {"Move", DRAGMAX_MOVE
, 0},
309 {"RestoreGeometry", DRAGMAX_RESTORE
, 0},
310 {"Unmaximize", DRAGMAX_UNMAXIMIZE
, 0},
311 {"NoMove", DRAGMAX_NOMOVE
, 0},
316 * ALL entries in the tables bellow, NEED to have a default value
317 * defined, and this value needs to be correct.
320 /* these options will only affect the window manager on startup
322 * static defaults can't access the screen data, because it is
323 * created after these defaults are read
325 WDefaultEntry staticOptionList
[] = {
327 {"ColormapSize", "4", NULL
,
328 &wPreferences
.cmap_size
, getInt
, NULL
, NULL
, NULL
},
329 {"DisableDithering", "NO", NULL
,
330 &wPreferences
.no_dithering
, getBool
, NULL
, NULL
, NULL
},
331 {"IconSize", "64", NULL
,
332 &wPreferences
.icon_size
, getInt
, NULL
, NULL
, NULL
},
333 {"ModifierKey", "Mod1", NULL
,
334 &wPreferences
.modifier_mask
, getModMask
, NULL
, NULL
, NULL
},
335 {"FocusMode", "manual", seFocusModes
, /* have a problem when switching from */
336 &wPreferences
.focus_mode
, getEnum
, NULL
, NULL
, NULL
}, /* manual to sloppy without restart */
337 {"NewStyle", "new", seTitlebarModes
,
338 &wPreferences
.new_style
, getEnum
, NULL
, NULL
, NULL
},
339 {"DisableDock", "NO", (void *)WM_DOCK
,
340 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
341 {"DisableClip", "NO", (void *)WM_CLIP
,
342 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
343 {"DisableDrawers", "NO", (void *)WM_DRAWER
,
344 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
345 {"ClipMergedInDock", "NO", NULL
,
346 NULL
, getBool
, setClipMergedInDock
, NULL
, NULL
},
347 {"DisableMiniwindows", "NO", NULL
,
348 &wPreferences
.disable_miniwindows
, getBool
, NULL
, NULL
, NULL
},
349 {"EnableWorkspacePager", "NO", NULL
,
350 &wPreferences
.enable_workspace_pager
, getBool
, NULL
, NULL
, NULL
}
353 #define NUM2STRING_(x) #x
354 #define NUM2STRING(x) NUM2STRING_(x)
356 WDefaultEntry optionList
[] = {
358 /* dynamic options */
360 {"IconPosition", "blh", seIconPositions
,
361 &wPreferences
.icon_yard
, getEnum
, setIconPosition
, NULL
, NULL
},
362 {"IconificationStyle", "Zoom", seIconificationStyles
,
363 &wPreferences
.iconification_style
, getEnum
, NULL
, NULL
, NULL
},
364 {"DisableWSMouseActions", "NO", NULL
,
365 &wPreferences
.disable_root_mouse
, getBool
, NULL
, NULL
, NULL
},
366 {"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions
,
367 &wPreferences
.mouse_button1
, getEnum
, NULL
, NULL
, NULL
},
368 {"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions
,
369 &wPreferences
.mouse_button2
, getEnum
, NULL
, NULL
, NULL
},
370 {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions
,
371 &wPreferences
.mouse_button3
, getEnum
, NULL
, NULL
, NULL
},
372 {"MouseBackwardButtonAction", "None", seMouseButtonActions
,
373 &wPreferences
.mouse_button8
, getEnum
, NULL
, NULL
, NULL
},
374 {"MouseForwardButtonAction", "None", seMouseButtonActions
,
375 &wPreferences
.mouse_button9
, getEnum
, NULL
, NULL
, NULL
},
376 {"MouseWheelAction", "None", seMouseWheelActions
,
377 &wPreferences
.mouse_wheel_scroll
, getEnum
, NULL
, NULL
, NULL
},
378 {"MouseWheelTiltAction", "None", seMouseWheelActions
,
379 &wPreferences
.mouse_wheel_tilt
, getEnum
, NULL
, NULL
, NULL
},
380 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
381 &wPreferences
.pixmap_path
, getPathList
, NULL
, NULL
, NULL
},
382 {"IconPath", DEF_ICON_PATHS
, NULL
,
383 &wPreferences
.icon_path
, getPathList
, NULL
, NULL
, NULL
},
384 {"ColormapMode", "auto", seColormapModes
,
385 &wPreferences
.colormap_mode
, getEnum
, NULL
, NULL
, NULL
},
386 {"AutoFocus", "NO", NULL
,
387 &wPreferences
.auto_focus
, getBool
, NULL
, NULL
, NULL
},
388 {"RaiseDelay", "0", NULL
,
389 &wPreferences
.raise_delay
, getInt
, NULL
, NULL
, NULL
},
390 {"CirculateRaise", "NO", NULL
,
391 &wPreferences
.circ_raise
, getBool
, NULL
, NULL
, NULL
},
392 {"Superfluous", "NO", NULL
,
393 &wPreferences
.superfluous
, getBool
, NULL
, NULL
, NULL
},
394 {"AdvanceToNewWorkspace", "NO", NULL
,
395 &wPreferences
.ws_advance
, getBool
, NULL
, NULL
, NULL
},
396 {"CycleWorkspaces", "NO", NULL
,
397 &wPreferences
.ws_cycle
, getBool
, NULL
, NULL
, NULL
},
398 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
399 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
, NULL
, NULL
},
400 {"WorkspaceBorder", "None", seWorkspaceBorder
,
401 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
, NULL
, NULL
},
402 {"WorkspaceBorderSize", "0", NULL
,
403 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
, NULL
, NULL
},
404 {"StickyIcons", "NO", NULL
,
405 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
, NULL
, NULL
},
406 {"SaveSessionOnExit", "NO", NULL
,
407 &wPreferences
.save_session_on_exit
, getBool
, NULL
, NULL
, NULL
},
408 {"WrapMenus", "NO", NULL
,
409 &wPreferences
.wrap_menus
, getBool
, NULL
, NULL
, NULL
},
410 {"ScrollableMenus", "NO", NULL
,
411 &wPreferences
.scrollable_menus
, getBool
, NULL
, NULL
, NULL
},
412 {"MenuScrollSpeed", "medium", seSpeeds
,
413 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
, NULL
, NULL
},
414 {"IconSlideSpeed", "medium", seSpeeds
,
415 &wPreferences
.icon_slide_speed
, getEnum
, NULL
, NULL
, NULL
},
416 {"ShadeSpeed", "medium", seSpeeds
,
417 &wPreferences
.shade_speed
, getEnum
, NULL
, NULL
, NULL
},
418 {"BounceAppIconsWhenUrgent", "YES", NULL
,
419 &wPreferences
.bounce_appicons_when_urgent
, getBool
, NULL
, NULL
, NULL
},
420 {"RaiseAppIconsWhenBouncing", "NO", NULL
,
421 &wPreferences
.raise_appicons_when_bouncing
, getBool
, NULL
, NULL
, NULL
},
422 {"DoNotMakeAppIconsBounce", "NO", NULL
,
423 &wPreferences
.do_not_make_appicons_bounce
, getBool
, NULL
, NULL
, NULL
},
424 {"DoubleClickTime", "250", (void *)&wPreferences
.dblclick_time
,
425 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
, NULL
, NULL
},
426 {"ClipAutoraiseDelay", "600", NULL
,
427 &wPreferences
.clip_auto_raise_delay
, getInt
, NULL
, NULL
, NULL
},
428 {"ClipAutolowerDelay", "1000", NULL
,
429 &wPreferences
.clip_auto_lower_delay
, getInt
, NULL
, NULL
, NULL
},
430 {"ClipAutoexpandDelay", "600", NULL
,
431 &wPreferences
.clip_auto_expand_delay
, getInt
, NULL
, NULL
, NULL
},
432 {"ClipAutocollapseDelay", "1000", NULL
,
433 &wPreferences
.clip_auto_collapse_delay
, getInt
, NULL
, NULL
, NULL
},
434 {"WrapAppiconsInDock", "YES", NULL
,
435 NULL
, getBool
, setWrapAppiconsInDock
, NULL
, NULL
},
436 {"AlignSubmenus", "NO", NULL
,
437 &wPreferences
.align_menus
, getBool
, NULL
, NULL
, NULL
},
438 {"ViKeyMenus", "NO", NULL
,
439 &wPreferences
.vi_key_menus
, getBool
, NULL
, NULL
, NULL
},
440 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
441 &wPreferences
.open_transients_with_parent
, getBool
, NULL
, NULL
, NULL
},
442 {"WindowPlacement", "auto", sePlacements
,
443 &wPreferences
.window_placement
, getEnum
, NULL
, NULL
, NULL
},
444 {"IgnoreFocusClick", "NO", NULL
,
445 &wPreferences
.ignore_focus_click
, getBool
, NULL
, NULL
, NULL
},
446 {"UseSaveUnders", "NO", NULL
,
447 &wPreferences
.use_saveunders
, getBool
, NULL
, NULL
, NULL
},
448 {"OpaqueMove", "NO", NULL
,
449 &wPreferences
.opaque_move
, getBool
, NULL
, NULL
, NULL
},
450 {"OpaqueResize", "NO", NULL
,
451 &wPreferences
.opaque_resize
, getBool
, NULL
, NULL
, NULL
},
452 {"OpaqueMoveResizeKeyboard", "NO", NULL
,
453 &wPreferences
.opaque_move_resize_keyboard
, getBool
, NULL
, NULL
, NULL
},
454 {"DisableAnimations", "NO", NULL
,
455 &wPreferences
.no_animations
, getBool
, NULL
, NULL
, NULL
},
456 {"DontLinkWorkspaces", "NO", NULL
,
457 &wPreferences
.no_autowrap
, getBool
, NULL
, NULL
, NULL
},
458 {"WindowSnapping", "NO", NULL
,
459 &wPreferences
.window_snapping
, getBool
, NULL
, NULL
, NULL
},
460 {"SnapEdgeDetect", "1", NULL
,
461 &wPreferences
.snap_edge_detect
, getInt
, NULL
, NULL
, NULL
},
462 {"SnapCornerDetect", "10", NULL
,
463 &wPreferences
.snap_corner_detect
, getInt
, NULL
, NULL
, NULL
},
464 {"SnapToTopMaximizesFullscreen", "NO", NULL
,
465 &wPreferences
.snap_to_top_maximizes_fullscreen
, getBool
, NULL
, NULL
, NULL
},
466 {"DragMaximizedWindow", "Move", seDragMaximizedWindow
,
467 &wPreferences
.drag_maximized_window
, getEnum
, NULL
, NULL
, NULL
},
468 {"MoveHalfMaximizedWindowsBetweenScreens", "NO", NULL
,
469 &wPreferences
.move_half_max_between_heads
, getBool
, NULL
, NULL
, NULL
},
470 {"AlternativeHalfMaximized", "NO", NULL
,
471 &wPreferences
.alt_half_maximize
, getBool
, NULL
, NULL
, NULL
},
472 {"PointerWithHalfMaxWindows", "NO", NULL
,
473 &wPreferences
.pointer_with_half_max_windows
, getBool
, NULL
, NULL
, NULL
},
474 {"HighlightActiveApp", "YES", NULL
,
475 &wPreferences
.highlight_active_app
, getBool
, NULL
, NULL
, NULL
},
476 {"AutoArrangeIcons", "NO", NULL
,
477 &wPreferences
.auto_arrange_icons
, getBool
, NULL
, NULL
, NULL
},
478 {"NoWindowOverDock", "NO", NULL
,
479 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
, NULL
, NULL
},
480 {"NoWindowOverIcons", "NO", NULL
,
481 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
, NULL
, NULL
},
482 {"WindowPlaceOrigin", "(0, 0)", NULL
,
483 &wPreferences
.window_place_origin
, getCoord
, NULL
, NULL
, NULL
},
484 {"ResizeDisplay", "corner", seGeomDisplays
,
485 &wPreferences
.size_display
, getEnum
, NULL
, NULL
, NULL
},
486 {"MoveDisplay", "corner", seGeomDisplays
,
487 &wPreferences
.move_display
, getEnum
, NULL
, NULL
, NULL
},
488 {"DontConfirmKill", "NO", NULL
,
489 &wPreferences
.dont_confirm_kill
, getBool
, NULL
, NULL
, NULL
},
490 {"WindowTitleBalloons", "NO", NULL
,
491 &wPreferences
.window_balloon
, getBool
, NULL
, NULL
, NULL
},
492 {"MiniwindowTitleBalloons", "NO", NULL
,
493 &wPreferences
.miniwin_title_balloon
, getBool
, NULL
, NULL
, NULL
},
494 {"MiniwindowPreviewBalloons", "NO", NULL
,
495 &wPreferences
.miniwin_preview_balloon
, getBool
, NULL
, NULL
, NULL
},
496 {"AppIconBalloons", "NO", NULL
,
497 &wPreferences
.appicon_balloon
, getBool
, NULL
, NULL
, NULL
},
498 {"HelpBalloons", "NO", NULL
,
499 &wPreferences
.help_balloon
, getBool
, NULL
, NULL
, NULL
},
500 {"EdgeResistance", "30", NULL
,
501 &wPreferences
.edge_resistance
, getInt
, NULL
, NULL
, NULL
},
502 {"ResizeIncrement", "0", NULL
,
503 &wPreferences
.resize_increment
, getInt
, NULL
, NULL
, NULL
},
504 {"Attraction", "NO", NULL
,
505 &wPreferences
.attract
, getBool
, NULL
, NULL
, NULL
},
506 {"DisableBlinking", "NO", NULL
,
507 &wPreferences
.dont_blink
, getBool
, NULL
, NULL
, NULL
},
508 {"SingleClickLaunch", "NO", NULL
,
509 &wPreferences
.single_click
, getBool
, NULL
, NULL
, NULL
},
510 {"StrictWindozeCycle", "YES", NULL
,
511 &wPreferences
.strict_windoze_cycle
, getBool
, NULL
, NULL
, NULL
},
512 {"SwitchPanelOnlyOpen", "NO", NULL
,
513 &wPreferences
.panel_only_open
, getBool
, NULL
, NULL
, NULL
},
514 {"MiniPreviewSize", "128", NULL
,
515 &wPreferences
.minipreview_size
, getInt
, NULL
, NULL
, NULL
},
516 {"IgnoreGtkHints", "NO", NULL
,
517 &wPreferences
.ignore_gtk_decoration_hints
, getBool
, NULL
, NULL
, NULL
},
521 {"MenuStyle", "normal", seMenuStyles
,
522 &wPreferences
.menu_style
, getEnum
, setMenuStyle
, NULL
, NULL
},
523 {"WidgetColor", "(solid, gray)", NULL
,
524 NULL
, getTexture
, setWidgetColor
, NULL
, NULL
},
525 {"WorkspaceSpecificBack", "()", NULL
,
526 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
, NULL
, NULL
},
527 /* WorkspaceBack must come after WorkspaceSpecificBack or
528 * WorkspaceBack won't know WorkspaceSpecificBack was also
529 * specified and 2 copies of wmsetbg will be launched */
530 {"WorkspaceBack", "(solid, black)", NULL
,
531 NULL
, getWSBackground
, setWorkspaceBack
, NULL
, NULL
},
532 {"SmoothWorkspaceBack", "NO", NULL
,
533 NULL
, getBool
, NULL
, NULL
, NULL
},
534 {"IconBack", "(solid, gray)", NULL
,
535 NULL
, getTexture
, setIconTile
, NULL
, NULL
},
536 {"TitleJustify", "center", seJustifications
,
537 &wPreferences
.title_justification
, getEnum
, setJustify
, NULL
, NULL
},
538 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
539 NULL
, getFont
, setWinTitleFont
, NULL
, NULL
},
540 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
541 &wPreferences
.window_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
542 {"WindowTitleMinHeight", "0", NULL
,
543 &wPreferences
.window_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
544 {"WindowTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
545 &wPreferences
.window_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
546 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
547 &wPreferences
.menu_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
548 {"MenuTitleMinHeight", "0", NULL
,
549 &wPreferences
.menu_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
550 {"MenuTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
551 &wPreferences
.menu_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
552 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
553 &wPreferences
.menu_text_clearance
, getInt
, setClearance
, NULL
, NULL
},
554 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
555 NULL
, getFont
, setMenuTitleFont
, NULL
, NULL
},
556 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
557 NULL
, getFont
, setMenuTextFont
, NULL
, NULL
},
558 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
559 NULL
, getFont
, setIconTitleFont
, NULL
, NULL
},
560 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
561 NULL
, getFont
, setClipTitleFont
, NULL
, NULL
},
562 {"ShowClipTitle", "YES", NULL
,
563 &wPreferences
.show_clip_title
, getBool
, NULL
, NULL
, NULL
},
564 {"LargeDisplayFont", DEF_WORKSPACE_NAME_FONT
, NULL
,
565 NULL
, getFont
, setLargeDisplayFont
, NULL
, NULL
},
566 {"HighlightColor", "white", NULL
,
567 NULL
, getColor
, setHightlight
, NULL
, NULL
},
568 {"HighlightTextColor", "black", NULL
,
569 NULL
, getColor
, setHightlightText
, NULL
, NULL
},
570 {"ClipTitleColor", "black", (void *)CLIP_NORMAL
,
571 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
572 {"CClipTitleColor", "\"#454045\"", (void *)CLIP_COLLAPSED
,
573 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
574 {"FTitleColor", "white", (void *)WS_FOCUSED
,
575 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
576 {"PTitleColor", "white", (void *)WS_PFOCUSED
,
577 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
578 {"UTitleColor", "black", (void *)WS_UNFOCUSED
,
579 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
580 {"FTitleBack", "(solid, black)", NULL
,
581 NULL
, getTexture
, setFTitleBack
, NULL
, NULL
},
582 {"PTitleBack", "(solid, \"#616161\")", NULL
,
583 NULL
, getTexture
, setPTitleBack
, NULL
, NULL
},
584 {"UTitleBack", "(solid, gray)", NULL
,
585 NULL
, getTexture
, setUTitleBack
, NULL
, NULL
},
586 {"ResizebarBack", "(solid, gray)", NULL
,
587 NULL
, getTexture
, setResizebarBack
, NULL
, NULL
},
588 {"MenuTitleColor", "white", NULL
,
589 NULL
, getColor
, setMenuTitleColor
, NULL
, NULL
},
590 {"MenuTextColor", "black", NULL
,
591 NULL
, getColor
, setMenuTextColor
, NULL
, NULL
},
592 {"MenuDisabledColor", "\"#616161\"", NULL
,
593 NULL
, getColor
, setMenuDisabledColor
, NULL
, NULL
},
594 {"MenuTitleBack", "(solid, black)", NULL
,
595 NULL
, getTexture
, setMenuTitleBack
, NULL
, NULL
},
596 {"MenuTextBack", "(solid, gray)", NULL
,
597 NULL
, getTexture
, setMenuTextBack
, NULL
, NULL
},
598 {"IconTitleColor", "white", NULL
,
599 NULL
, getColor
, setIconTitleColor
, NULL
, NULL
},
600 {"IconTitleBack", "black", NULL
,
601 NULL
, getColor
, setIconTitleBack
, NULL
, NULL
},
602 {"SwitchPanelImages", "(swtile.png, swback.png, 30, 40)", &wPreferences
,
603 NULL
, getPropList
, setSwPOptions
, NULL
, NULL
},
604 {"ModifierKeyLabels", "(\"Shift+\", \"Control+\", \"Mod1+\", \"Mod2+\", \"Mod3+\", \"Mod4+\", \"Mod5+\")", &wPreferences
,
605 NULL
, getPropList
, setModifierKeyLabels
, NULL
, NULL
},
606 {"FrameBorderWidth", "1", NULL
,
607 NULL
, getInt
, setFrameBorderWidth
, NULL
, NULL
},
608 {"FrameBorderColor", "black", NULL
,
609 NULL
, getColor
, setFrameBorderColor
, NULL
, NULL
},
610 {"FrameFocusedBorderColor", "black", NULL
,
611 NULL
, getColor
, setFrameFocusedBorderColor
, NULL
, NULL
},
612 {"FrameSelectedBorderColor", "white", NULL
,
613 NULL
, getColor
, setFrameSelectedBorderColor
, NULL
, NULL
},
614 {"WorkspaceMapBack", "(solid, black)", NULL
,
615 NULL
, getTexture
, setWorkspaceMapBackground
, NULL
, NULL
},
619 {"RootMenuKey", "None", (void *)WKBD_ROOTMENU
,
620 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
621 {"WindowListKey", "None", (void *)WKBD_WINDOWLIST
,
622 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
623 {"WindowMenuKey", "None", (void *)WKBD_WINDOWMENU
,
624 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
625 {"DockRaiseLowerKey", "None", (void*)WKBD_DOCKRAISELOWER
,
626 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
627 {"ClipRaiseLowerKey", "None", (void *)WKBD_CLIPRAISELOWER
,
628 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
629 {"MiniaturizeKey", "None", (void *)WKBD_MINIATURIZE
,
630 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
631 {"MinimizeAllKey", "None", (void *)WKBD_MINIMIZEALL
,
632 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
633 {"HideKey", "None", (void *)WKBD_HIDE
,
634 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
635 {"HideOthersKey", "None", (void *)WKBD_HIDE_OTHERS
,
636 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
637 {"MoveResizeKey", "None", (void *)WKBD_MOVERESIZE
,
638 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
639 {"CloseKey", "None", (void *)WKBD_CLOSE
,
640 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
641 {"MaximizeKey", "None", (void *)WKBD_MAXIMIZE
,
642 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
643 {"VMaximizeKey", "None", (void *)WKBD_VMAXIMIZE
,
644 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
645 {"HMaximizeKey", "None", (void *)WKBD_HMAXIMIZE
,
646 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
647 {"LHMaximizeKey", "None", (void*)WKBD_LHMAXIMIZE
,
648 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
649 {"RHMaximizeKey", "None", (void*)WKBD_RHMAXIMIZE
,
650 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
651 {"THMaximizeKey", "None", (void*)WKBD_THMAXIMIZE
,
652 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
653 {"BHMaximizeKey", "None", (void*)WKBD_BHMAXIMIZE
,
654 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
655 {"LTCMaximizeKey", "None", (void*)WKBD_LTCMAXIMIZE
,
656 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
657 {"RTCMaximizeKey", "None", (void*)WKBD_RTCMAXIMIZE
,
658 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
659 {"LBCMaximizeKey", "None", (void*)WKBD_LBCMAXIMIZE
,
660 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
661 {"RBCMaximizeKey", "None", (void*)WKBD_RBCMAXIMIZE
,
662 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
663 {"MaximusKey", "None", (void*)WKBD_MAXIMUS
,
664 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
665 {"KeepOnTopKey", "None", (void *)WKBD_KEEP_ON_TOP
,
666 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
667 {"KeepAtBottomKey", "None", (void *)WKBD_KEEP_AT_BOTTOM
,
668 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
669 {"OmnipresentKey", "None", (void *)WKBD_OMNIPRESENT
,
670 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
671 {"RaiseKey", "\"Meta+Up\"", (void *)WKBD_RAISE
,
672 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
673 {"LowerKey", "\"Meta+Down\"", (void *)WKBD_LOWER
,
674 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
675 {"RaiseLowerKey", "None", (void *)WKBD_RAISELOWER
,
676 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
677 {"ShadeKey", "None", (void *)WKBD_SHADE
,
678 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
679 {"SelectKey", "None", (void *)WKBD_SELECT
,
680 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
681 {"WorkspaceMapKey", "None", (void *)WKBD_WORKSPACEMAP
,
682 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
683 {"FocusNextKey", "None", (void *)WKBD_FOCUSNEXT
,
684 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
685 {"FocusPrevKey", "None", (void *)WKBD_FOCUSPREV
,
686 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
687 {"GroupNextKey", "None", (void *)WKBD_GROUPNEXT
,
688 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
689 {"GroupPrevKey", "None", (void *)WKBD_GROUPPREV
,
690 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
691 {"NextWorkspaceKey", "None", (void *)WKBD_NEXTWORKSPACE
,
692 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
693 {"PrevWorkspaceKey", "None", (void *)WKBD_PREVWORKSPACE
,
694 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
695 {"LastWorkspaceKey", "None", (void *)WKBD_LASTWORKSPACE
,
696 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
697 {"NextWorkspaceLayerKey", "None", (void *)WKBD_NEXTWSLAYER
,
698 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
699 {"PrevWorkspaceLayerKey", "None", (void *)WKBD_PREVWSLAYER
,
700 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
701 {"Workspace1Key", "None", (void *)WKBD_WORKSPACE1
,
702 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
703 {"Workspace2Key", "None", (void *)WKBD_WORKSPACE2
,
704 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
705 {"Workspace3Key", "None", (void *)WKBD_WORKSPACE3
,
706 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
707 {"Workspace4Key", "None", (void *)WKBD_WORKSPACE4
,
708 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
709 {"Workspace5Key", "None", (void *)WKBD_WORKSPACE5
,
710 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
711 {"Workspace6Key", "None", (void *)WKBD_WORKSPACE6
,
712 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
713 {"Workspace7Key", "None", (void *)WKBD_WORKSPACE7
,
714 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
715 {"Workspace8Key", "None", (void *)WKBD_WORKSPACE8
,
716 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
717 {"Workspace9Key", "None", (void *)WKBD_WORKSPACE9
,
718 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
719 {"Workspace10Key", "None", (void *)WKBD_WORKSPACE10
,
720 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
721 {"MoveToWorkspace1Key", "None", (void *)WKBD_MOVE_WORKSPACE1
,
722 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
723 {"MoveToWorkspace2Key", "None", (void *)WKBD_MOVE_WORKSPACE2
,
724 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
725 {"MoveToWorkspace3Key", "None", (void *)WKBD_MOVE_WORKSPACE3
,
726 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
727 {"MoveToWorkspace4Key", "None", (void *)WKBD_MOVE_WORKSPACE4
,
728 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
729 {"MoveToWorkspace5Key", "None", (void *)WKBD_MOVE_WORKSPACE5
,
730 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
731 {"MoveToWorkspace6Key", "None", (void *)WKBD_MOVE_WORKSPACE6
,
732 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
733 {"MoveToWorkspace7Key", "None", (void *)WKBD_MOVE_WORKSPACE7
,
734 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
735 {"MoveToWorkspace8Key", "None", (void *)WKBD_MOVE_WORKSPACE8
,
736 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
737 {"MoveToWorkspace9Key", "None", (void *)WKBD_MOVE_WORKSPACE9
,
738 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
739 {"MoveToWorkspace10Key", "None", (void *)WKBD_MOVE_WORKSPACE10
,
740 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
741 {"MoveToNextWorkspaceKey", "None", (void *)WKBD_MOVE_NEXTWORKSPACE
,
742 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
743 {"MoveToPrevWorkspaceKey", "None", (void *)WKBD_MOVE_PREVWORKSPACE
,
744 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
745 {"MoveToLastWorkspaceKey", "None", (void *)WKBD_MOVE_LASTWORKSPACE
,
746 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
747 {"MoveToNextWorkspaceLayerKey", "None", (void *)WKBD_MOVE_NEXTWSLAYER
,
748 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
749 {"MoveToPrevWorkspaceLayerKey", "None", (void *)WKBD_MOVE_PREVWSLAYER
,
750 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
751 {"WindowShortcut1Key", "None", (void *)WKBD_WINDOW1
,
752 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
753 {"WindowShortcut2Key", "None", (void *)WKBD_WINDOW2
,
754 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
755 {"WindowShortcut3Key", "None", (void *)WKBD_WINDOW3
,
756 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
757 {"WindowShortcut4Key", "None", (void *)WKBD_WINDOW4
,
758 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
759 {"WindowShortcut5Key", "None", (void *)WKBD_WINDOW5
,
760 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
761 {"WindowShortcut6Key", "None", (void *)WKBD_WINDOW6
,
762 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
763 {"WindowShortcut7Key", "None", (void *)WKBD_WINDOW7
,
764 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
765 {"WindowShortcut8Key", "None", (void *)WKBD_WINDOW8
,
766 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
767 {"WindowShortcut9Key", "None", (void *)WKBD_WINDOW9
,
768 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
769 {"WindowShortcut10Key", "None", (void *)WKBD_WINDOW10
,
770 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
771 {"WindowRelaunchKey", "None", (void *)WKBD_RELAUNCH
,
772 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
773 {"ScreenSwitchKey", "None", (void *)WKBD_SWITCH_SCREEN
,
774 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
775 {"RunKey", "None", (void *)WKBD_RUN
,
776 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
778 #ifdef KEEP_XKB_LOCK_STATUS
779 {"ToggleKbdModeKey", "None", (void *)WKBD_TOGGLE
,
780 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
781 {"KbdModeLock", "NO", NULL
,
782 &wPreferences
.modelock
, getBool
, NULL
, NULL
, NULL
},
783 #endif /* KEEP_XKB_LOCK_STATUS */
785 {"NormalCursor", "(builtin, left_ptr)", (void *)WCUR_ROOT
,
786 NULL
, getCursor
, setCursor
, NULL
, NULL
},
787 {"ArrowCursor", "(builtin, top_left_arrow)", (void *)WCUR_ARROW
,
788 NULL
, getCursor
, setCursor
, NULL
, NULL
},
789 {"MoveCursor", "(builtin, fleur)", (void *)WCUR_MOVE
,
790 NULL
, getCursor
, setCursor
, NULL
, NULL
},
791 {"ResizeCursor", "(builtin, sizing)", (void *)WCUR_RESIZE
,
792 NULL
, getCursor
, setCursor
, NULL
, NULL
},
793 {"TopLeftResizeCursor", "(builtin, top_left_corner)", (void *)WCUR_TOPLEFTRESIZE
,
794 NULL
, getCursor
, setCursor
, NULL
, NULL
},
795 {"TopRightResizeCursor", "(builtin, top_right_corner)", (void *)WCUR_TOPRIGHTRESIZE
,
796 NULL
, getCursor
, setCursor
, NULL
, NULL
},
797 {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)", (void *)WCUR_BOTTOMLEFTRESIZE
,
798 NULL
, getCursor
, setCursor
, NULL
, NULL
},
799 {"BottomRightResizeCursor", "(builtin, bottom_right_corner)", (void *)WCUR_BOTTOMRIGHTRESIZE
,
800 NULL
, getCursor
, setCursor
, NULL
, NULL
},
801 {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)", (void *)WCUR_VERTICALRESIZE
,
802 NULL
, getCursor
, setCursor
, NULL
, NULL
},
803 {"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)", (void *)WCUR_HORIZONRESIZE
,
804 NULL
, getCursor
, setCursor
, NULL
, NULL
},
805 {"WaitCursor", "(builtin, watch)", (void *)WCUR_WAIT
,
806 NULL
, getCursor
, setCursor
, NULL
, NULL
},
807 {"QuestionCursor", "(builtin, question_arrow)", (void *)WCUR_QUESTION
,
808 NULL
, getCursor
, setCursor
, NULL
, NULL
},
809 {"TextCursor", "(builtin, xterm)", (void *)WCUR_TEXT
,
810 NULL
, getCursor
, setCursor
, NULL
, NULL
},
811 {"SelectCursor", "(builtin, cross)", (void *)WCUR_SELECT
,
812 NULL
, getCursor
, setCursor
, NULL
, NULL
},
813 {"DialogHistoryLines", "500", NULL
,
814 &wPreferences
.history_lines
, getInt
, NULL
, NULL
, NULL
},
815 {"CycleActiveHeadOnly", "NO", NULL
,
816 &wPreferences
.cycle_active_head_only
, getBool
, NULL
, NULL
, NULL
},
817 {"CycleIgnoreMinimized", "NO", NULL
,
818 &wPreferences
.cycle_ignore_minimized
, getBool
, NULL
, NULL
, NULL
}
821 static void initDefaults(void)
824 WDefaultEntry
*entry
;
826 WMPLSetCaseSensitive(False
);
828 for (i
= 0; i
< wlengthof(optionList
); i
++) {
829 entry
= &optionList
[i
];
831 entry
->plkey
= WMCreatePLString(entry
->key
);
832 if (entry
->default_value
)
833 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
835 entry
->plvalue
= NULL
;
838 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
839 entry
= &staticOptionList
[i
];
841 entry
->plkey
= WMCreatePLString(entry
->key
);
842 if (entry
->default_value
)
843 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
845 entry
->plvalue
= NULL
;
849 static WMPropList
*readGlobalDomain(const char *domainName
, Bool requireDictionary
)
851 WMPropList
*globalDict
= NULL
;
855 snprintf(path
, sizeof(path
), "%s/%s", DEFSDATADIR
, domainName
);
856 if (stat(path
, &stbuf
) >= 0) {
857 globalDict
= WMReadPropListFromFile(path
);
858 if (globalDict
&& requireDictionary
&& !WMIsPLDictionary(globalDict
)) {
859 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"), domainName
, path
);
860 WMReleasePropList(globalDict
);
862 } else if (!globalDict
) {
863 wwarning(_("could not load domain %s from global defaults database"), domainName
);
870 #if defined(GLOBAL_PREAMBLE_MENU_FILE) || defined(GLOBAL_EPILOGUE_MENU_FILE)
871 static void prependMenu(WMPropList
* destarr
, WMPropList
* array
)
876 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
877 item
= WMGetFromPLArray(array
, i
);
879 WMInsertInPLArray(destarr
, i
+ 1, item
);
883 static void appendMenu(WMPropList
* destarr
, WMPropList
* array
)
888 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
889 item
= WMGetFromPLArray(array
, i
);
891 WMAddToPLArray(destarr
, item
);
896 void wDefaultsMergeGlobalMenus(WDDomain
* menuDomain
)
898 WMPropList
*menu
= menuDomain
->dictionary
;
901 if (!menu
|| !WMIsPLArray(menu
))
904 #ifdef GLOBAL_PREAMBLE_MENU_FILE
905 submenu
= WMReadPropListFromFile(DEFSDATADIR
"/" GLOBAL_PREAMBLE_MENU_FILE
);
907 if (submenu
&& !WMIsPLArray(submenu
)) {
908 wwarning(_("invalid global menu file %s"), GLOBAL_PREAMBLE_MENU_FILE
);
909 WMReleasePropList(submenu
);
913 prependMenu(menu
, submenu
);
914 WMReleasePropList(submenu
);
918 #ifdef GLOBAL_EPILOGUE_MENU_FILE
919 submenu
= WMReadPropListFromFile(DEFSDATADIR
"/" GLOBAL_EPILOGUE_MENU_FILE
);
921 if (submenu
&& !WMIsPLArray(submenu
)) {
922 wwarning(_("invalid global menu file %s"), GLOBAL_EPILOGUE_MENU_FILE
);
923 WMReleasePropList(submenu
);
927 appendMenu(menu
, submenu
);
928 WMReleasePropList(submenu
);
932 menuDomain
->dictionary
= menu
;
935 WDDomain
*wDefaultsInitDomain(const char *domain
, Bool requireDictionary
)
939 static int inited
= 0;
940 WMPropList
*shared_dict
= NULL
;
947 db
= wmalloc(sizeof(WDDomain
));
948 db
->domain_name
= domain
;
949 db
->path
= wdefaultspathfordomain(domain
);
951 if (stat(db
->path
, &stbuf
) >= 0) {
952 db
->dictionary
= WMReadPropListFromFile(db
->path
);
953 if (db
->dictionary
) {
954 if (requireDictionary
&& !WMIsPLDictionary(db
->dictionary
)) {
955 WMReleasePropList(db
->dictionary
);
956 db
->dictionary
= NULL
;
957 wwarning(_("Domain %s (%s) of defaults database is corrupted!"), domain
, db
->path
);
959 db
->timestamp
= stbuf
.st_mtime
;
961 wwarning(_("could not load domain %s from user defaults database"), domain
);
965 /* global system dictionary */
966 shared_dict
= readGlobalDomain(domain
, requireDictionary
);
968 if (shared_dict
&& db
->dictionary
&& WMIsPLDictionary(shared_dict
) &&
969 WMIsPLDictionary(db
->dictionary
)) {
970 WMMergePLDictionaries(shared_dict
, db
->dictionary
, True
);
971 WMReleasePropList(db
->dictionary
);
972 db
->dictionary
= shared_dict
;
973 if (stbuf
.st_mtime
> db
->timestamp
)
974 db
->timestamp
= stbuf
.st_mtime
;
975 } else if (!db
->dictionary
) {
976 db
->dictionary
= shared_dict
;
977 if (stbuf
.st_mtime
> db
->timestamp
)
978 db
->timestamp
= stbuf
.st_mtime
;
984 void wReadStaticDefaults(WMPropList
* dict
)
987 WDefaultEntry
*entry
;
991 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
992 entry
= &staticOptionList
[i
];
995 plvalue
= WMGetFromPLDictionary(dict
, entry
->plkey
);
999 /* no default in the DB. Use builtin default */
1001 plvalue
= entry
->plvalue
;
1005 (*entry
->convert
) (NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
1007 (*entry
->update
) (NULL
, entry
, tdata
, entry
->extra_data
);
1012 void wDefaultsCheckDomains(void* arg
)
1016 WMPropList
*shared_dict
= NULL
;
1020 /* Parameter not used, but tell the compiler that it is ok */
1023 if (stat(w_global
.domain
.wmaker
->path
, &stbuf
) >= 0 && w_global
.domain
.wmaker
->timestamp
< stbuf
.st_mtime
) {
1024 w_global
.domain
.wmaker
->timestamp
= stbuf
.st_mtime
;
1026 /* Global dictionary */
1027 shared_dict
= readGlobalDomain("WindowMaker", True
);
1029 /* User dictionary */
1030 dict
= WMReadPropListFromFile(w_global
.domain
.wmaker
->path
);
1033 if (!WMIsPLDictionary(dict
)) {
1034 WMReleasePropList(dict
);
1036 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1037 "WindowMaker", w_global
.domain
.wmaker
->path
);
1040 WMMergePLDictionaries(shared_dict
, dict
, True
);
1041 WMReleasePropList(dict
);
1046 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1047 scr
= wScreenWithNumber(i
);
1049 wReadDefaults(scr
, dict
);
1052 if (w_global
.domain
.wmaker
->dictionary
)
1053 WMReleasePropList(w_global
.domain
.wmaker
->dictionary
);
1055 w_global
.domain
.wmaker
->dictionary
= dict
;
1058 wwarning(_("could not load domain %s from user defaults database"), "WindowMaker");
1062 WMReleasePropList(shared_dict
);
1066 if (stat(w_global
.domain
.window_attr
->path
, &stbuf
) >= 0 && w_global
.domain
.window_attr
->timestamp
< stbuf
.st_mtime
) {
1067 /* global dictionary */
1068 shared_dict
= readGlobalDomain("WMWindowAttributes", True
);
1069 /* user dictionary */
1070 dict
= WMReadPropListFromFile(w_global
.domain
.window_attr
->path
);
1072 if (!WMIsPLDictionary(dict
)) {
1073 WMReleasePropList(dict
);
1075 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1076 "WMWindowAttributes", w_global
.domain
.window_attr
->path
);
1079 WMMergePLDictionaries(shared_dict
, dict
, True
);
1080 WMReleasePropList(dict
);
1085 if (w_global
.domain
.window_attr
->dictionary
)
1086 WMReleasePropList(w_global
.domain
.window_attr
->dictionary
);
1088 w_global
.domain
.window_attr
->dictionary
= dict
;
1089 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1090 scr
= wScreenWithNumber(i
);
1092 wDefaultUpdateIcons(scr
);
1094 /* Update the panel image if changed */
1095 /* Don't worry. If the image is the same these
1096 * functions will have no performance impact. */
1097 create_logo_image(scr
);
1102 wwarning(_("could not load domain %s from user defaults database"), "WMWindowAttributes");
1105 w_global
.domain
.window_attr
->timestamp
= stbuf
.st_mtime
;
1107 WMReleasePropList(shared_dict
);
1110 if (stat(w_global
.domain
.root_menu
->path
, &stbuf
) >= 0 && w_global
.domain
.root_menu
->timestamp
< stbuf
.st_mtime
) {
1111 dict
= WMReadPropListFromFile(w_global
.domain
.root_menu
->path
);
1113 if (!WMIsPLArray(dict
) && !WMIsPLString(dict
)) {
1114 WMReleasePropList(dict
);
1116 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1117 "WMRootMenu", w_global
.domain
.root_menu
->path
);
1119 if (w_global
.domain
.root_menu
->dictionary
)
1120 WMReleasePropList(w_global
.domain
.root_menu
->dictionary
);
1122 w_global
.domain
.root_menu
->dictionary
= dict
;
1123 wDefaultsMergeGlobalMenus(w_global
.domain
.root_menu
);
1126 wwarning(_("could not load domain %s from user defaults database"), "WMRootMenu");
1128 w_global
.domain
.root_menu
->timestamp
= stbuf
.st_mtime
;
1130 #ifndef HAVE_INOTIFY
1132 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, arg
);
1136 void wReadDefaults(WScreen
* scr
, WMPropList
* new_dict
)
1138 WMPropList
*plvalue
, *old_value
;
1139 WDefaultEntry
*entry
;
1141 int update_workspace_back
= 0; /* kluge :/ */
1142 unsigned int needs_refresh
;
1144 WMPropList
*old_dict
= (w_global
.domain
.wmaker
->dictionary
!= new_dict
? w_global
.domain
.wmaker
->dictionary
: NULL
);
1148 for (i
= 0; i
< wlengthof(optionList
); i
++) {
1149 entry
= &optionList
[i
];
1152 plvalue
= WMGetFromPLDictionary(new_dict
, entry
->plkey
);
1159 old_value
= WMGetFromPLDictionary(old_dict
, entry
->plkey
);
1161 if (!plvalue
&& !old_value
) {
1162 /* no default in the DB. Use builtin default */
1163 plvalue
= entry
->plvalue
;
1164 if (plvalue
&& new_dict
)
1165 WMPutInPLDictionary(new_dict
, entry
->plkey
, plvalue
);
1167 } else if (!plvalue
) {
1168 /* value was deleted from DB. Keep current value */
1170 } else if (!old_value
) {
1171 /* set value for the 1st time */
1172 } else if (!WMIsPropListEqualTo(plvalue
, old_value
)) {
1173 /* value has changed */
1175 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1176 && update_workspace_back
&& scr
->flags
.backimage_helper_launched
) {
1178 /* value was not changed since last time */
1185 if ((*entry
->convert
) (scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1187 * If the WorkspaceSpecificBack data has been changed
1188 * so that the helper will be launched now, we must be
1189 * sure to send the default background texture config
1192 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0 &&
1193 !scr
->flags
.backimage_helper_launched
)
1194 update_workspace_back
= 1;
1197 needs_refresh
|= (*entry
->update
) (scr
, entry
, tdata
, entry
->extra_data
);
1203 if (needs_refresh
!= 0 && !scr
->flags
.startup
) {
1207 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1208 foo
|= WTextureSettings
;
1209 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1210 foo
|= WFontSettings
;
1211 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1212 foo
|= WColorSettings
;
1214 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1215 (void *)(uintptr_t) foo
);
1218 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1219 foo
|= WTextureSettings
;
1220 if (needs_refresh
& REFRESH_MENU_FONT
)
1221 foo
|= WFontSettings
;
1222 if (needs_refresh
& REFRESH_MENU_COLOR
)
1223 foo
|= WColorSettings
;
1225 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1228 if (needs_refresh
& REFRESH_WINDOW_FONT
)
1229 foo
|= WFontSettings
;
1230 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
)
1231 foo
|= WTextureSettings
;
1232 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
)
1233 foo
|= WColorSettings
;
1235 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1237 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1239 if (needs_refresh
& REFRESH_ICON_FONT
)
1240 foo
|= WFontSettings
;
1241 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
)
1242 foo
|= WTextureSettings
;
1243 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
)
1244 foo
|= WTextureSettings
;
1246 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1247 (void *)(uintptr_t) foo
);
1249 if (needs_refresh
& REFRESH_ICON_TILE
)
1250 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1252 if (needs_refresh
& REFRESH_WORKSPACE_MENU
) {
1253 if (scr
->workspace_menu
)
1254 wWorkspaceMenuUpdate(scr
, scr
->workspace_menu
);
1255 if (scr
->clip_ws_menu
)
1256 wWorkspaceMenuUpdate(scr
, scr
->clip_ws_menu
);
1257 if (scr
->workspace_submenu
)
1258 scr
->workspace_submenu
->flags
.realized
= 0;
1259 if (scr
->clip_submenu
)
1260 scr
->clip_submenu
->flags
.realized
= 0;
1265 void wDefaultUpdateIcons(WScreen
*scr
)
1267 WAppIcon
*aicon
= scr
->app_icon_list
;
1269 WWindow
*wwin
= scr
->focused_window
;
1272 /* Get the application icon, default included */
1273 wIconChangeImageFile(aicon
->icon
, NULL
);
1274 wAppIconPaint(aicon
);
1275 aicon
= aicon
->next
;
1278 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
)
1279 wClipIconPaint(scr
->clip_icon
);
1281 for (dc
= scr
->drawers
; dc
!= NULL
; dc
= dc
->next
)
1282 wDrawerIconPaint(dc
->adrawer
->icon_array
[0]);
1285 if (wwin
->icon
&& wwin
->flags
.miniaturized
)
1286 wIconChangeImageFile(wwin
->icon
, NULL
);
1291 /* --------------------------- Local ----------------------- */
1293 #define GET_STRING_OR_DEFAULT(x, var) if (!WMIsPLString(value)) { \
1294 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1296 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1297 var = entry->default_value;\
1298 } else var = WMGetFromPLString(value)\
1301 static int string2index(WMPropList *key, WMPropList *val, const char *def, WOptionEnumeration * values)
1304 WOptionEnumeration
*v
;
1305 char buffer
[TOTAL_VALUES_LENGTH
];
1307 if (WMIsPLString(val
) && (str
= WMGetFromPLString(val
))) {
1308 for (v
= values
; v
->string
!= NULL
; v
++) {
1309 if (strcasecmp(v
->string
, str
) == 0)
1315 for (v
= values
; v
->string
!= NULL
; v
++) {
1318 strcat(buffer
, ", ");
1319 snprintf(buffer
+strlen(buffer
),
1320 sizeof(buffer
)-strlen(buffer
)-1, "\"%s\"", v
->string
);
1323 wwarning(_("wrong option value for key \"%s\"; got \"%s\", should be one of %s."),
1324 WMGetFromPLString(key
),
1325 WMIsPLString(val
) ? WMGetFromPLString(val
) : "(unknown)",
1329 return string2index(key
, val
, NULL
, values
);
1336 * value - is the value in the defaults DB
1337 * addr - is the address to store the data
1338 * ret - is the address to store a pointer to a temporary buffer. ret
1339 * must not be freed and is used by the set functions
1341 static int getBool(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1345 int second_pass
= 0;
1347 /* Parameter not used, but tell the compiler that it is ok */
1350 GET_STRING_OR_DEFAULT("Boolean", val
);
1353 if ((val
[1] == '\0' && (val
[0] == 'y' || val
[0] == 'Y'))
1354 || strcasecmp(val
, "YES") == 0) {
1357 } else if ((val
[1] == '\0' && (val
[0] == 'n' || val
[0] == 'N'))
1358 || strcasecmp(val
, "NO") == 0) {
1362 if (sscanf(val
, "%i", &i
) == 1) {
1368 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""), val
, entry
->key
);
1369 if (second_pass
== 0) {
1370 val
= WMGetFromPLString(entry
->plvalue
);
1372 wwarning(_("using default \"%s\" instead"), val
);
1382 *(char *)addr
= data
;
1387 static int getInt(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1392 /* Parameter not used, but tell the compiler that it is ok */
1395 GET_STRING_OR_DEFAULT("Integer", val
);
1397 if (sscanf(val
, "%i", &data
) != 1) {
1398 wwarning(_("can't convert \"%s\" to integer for key \"%s\""), val
, entry
->key
);
1399 val
= WMGetFromPLString(entry
->plvalue
);
1400 wwarning(_("using default \"%s\" instead"), val
);
1401 if (sscanf(val
, "%i", &data
) != 1) {
1409 *(int *)addr
= data
;
1414 static int getCoord(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1417 char *val_x
, *val_y
;
1418 int nelem
, changed
= 0;
1419 WMPropList
*elem_x
, *elem_y
;
1422 if (!WMIsPLArray(value
)) {
1423 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Coordinate");
1425 value
= entry
->plvalue
;
1427 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1433 nelem
= WMGetPropListItemCount(value
);
1435 wwarning(_("Incorrect number of elements in array for key \"%s\"."), entry
->key
);
1437 value
= entry
->plvalue
;
1439 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1445 elem_x
= WMGetFromPLArray(value
, 0);
1446 elem_y
= WMGetFromPLArray(value
, 1);
1448 if (!elem_x
|| !elem_y
|| !WMIsPLString(elem_x
) || !WMIsPLString(elem_y
)) {
1449 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."), entry
->key
);
1451 value
= entry
->plvalue
;
1453 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1459 val_x
= WMGetFromPLString(elem_x
);
1460 val_y
= WMGetFromPLString(elem_y
);
1462 if (sscanf(val_x
, "%i", &data
.x
) != 1 || sscanf(val_y
, "%i", &data
.y
) != 1) {
1463 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1465 value
= entry
->plvalue
;
1467 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1475 else if (data
.x
> scr
->scr_width
/ 3)
1476 data
.x
= scr
->scr_width
/ 3;
1479 else if (data
.y
> scr
->scr_height
/ 3)
1480 data
.y
= scr
->scr_height
/ 3;
1485 *(WCoord
*) addr
= data
;
1490 static int getPropList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1492 /* Parameter not used, but tell the compiler that it is ok */
1497 WMRetainPropList(value
);
1504 static int getPathList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1512 /* Parameter not used, but tell the compiler that it is ok */
1517 if (!WMIsPLArray(value
)) {
1518 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "an array of paths");
1520 value
= entry
->plvalue
;
1522 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1529 count
= WMGetPropListItemCount(value
);
1532 value
= entry
->plvalue
;
1534 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1541 for (i
= 0; i
< count
; i
++) {
1542 d
= WMGetFromPLArray(value
, i
);
1543 if (!d
|| !WMIsPLString(d
)) {
1547 len
+= strlen(WMGetFromPLString(d
)) + 1;
1550 ptr
= data
= wmalloc(len
+ 1);
1552 for (i
= 0; i
< count
; i
++) {
1553 d
= WMGetFromPLArray(value
, i
);
1554 if (!d
|| !WMIsPLString(d
)) {
1557 strcpy(ptr
, WMGetFromPLString(d
));
1558 ptr
+= strlen(WMGetFromPLString(d
));
1565 if (*(char **)addr
!= NULL
) {
1566 wfree(*(char **)addr
);
1568 *(char **)addr
= data
;
1573 static int getEnum(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1575 static signed char data
;
1577 /* Parameter not used, but tell the compiler that it is ok */
1580 data
= string2index(entry
->plkey
, value
, entry
->default_value
, (WOptionEnumeration
*) entry
->extra_data
);
1587 *(signed char *)addr
= data
;
1594 * (hgradient <color> <color>)
1595 * (vgradient <color> <color>)
1596 * (dgradient <color> <color>)
1597 * (mhgradient <color> <color> ...)
1598 * (mvgradient <color> <color> ...)
1599 * (mdgradient <color> <color> ...)
1600 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1601 * (tpixmap <file> <color>)
1602 * (spixmap <file> <color>)
1603 * (cpixmap <file> <color>)
1604 * (thgradient <file> <opaqueness> <color> <color>)
1605 * (tvgradient <file> <opaqueness> <color> <color>)
1606 * (tdgradient <file> <opaqueness> <color> <color>)
1607 * (function <lib> <function> ...)
1610 static WTexture
*parse_texture(WScreen
* scr
, WMPropList
* pl
)
1615 WTexture
*texture
= NULL
;
1617 nelem
= WMGetPropListItemCount(pl
);
1621 elem
= WMGetFromPLArray(pl
, 0);
1622 if (!elem
|| !WMIsPLString(elem
))
1624 val
= WMGetFromPLString(elem
);
1626 if (strcasecmp(val
, "solid") == 0) {
1634 elem
= WMGetFromPLArray(pl
, 1);
1635 if (!elem
|| !WMIsPLString(elem
))
1637 val
= WMGetFromPLString(elem
);
1639 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1640 wwarning(_("\"%s\" is not a valid color name"), val
);
1644 texture
= (WTexture
*) wTextureMakeSolid(scr
, &color
);
1645 } else if (strcasecmp(val
, "dgradient") == 0
1646 || strcasecmp(val
, "vgradient") == 0 || strcasecmp(val
, "hgradient") == 0) {
1647 RColor color1
, color2
;
1652 wwarning(_("bad number of arguments in gradient specification"));
1656 if (val
[0] == 'd' || val
[0] == 'D')
1657 type
= WTEX_DGRADIENT
;
1658 else if (val
[0] == 'h' || val
[0] == 'H')
1659 type
= WTEX_HGRADIENT
;
1661 type
= WTEX_VGRADIENT
;
1663 /* get from color */
1664 elem
= WMGetFromPLArray(pl
, 1);
1665 if (!elem
|| !WMIsPLString(elem
))
1667 val
= WMGetFromPLString(elem
);
1669 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1670 wwarning(_("\"%s\" is not a valid color name"), val
);
1674 color1
.red
= xcolor
.red
>> 8;
1675 color1
.green
= xcolor
.green
>> 8;
1676 color1
.blue
= xcolor
.blue
>> 8;
1679 elem
= WMGetFromPLArray(pl
, 2);
1680 if (!elem
|| !WMIsPLString(elem
)) {
1683 val
= WMGetFromPLString(elem
);
1685 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1686 wwarning(_("\"%s\" is not a valid color name"), val
);
1690 color2
.red
= xcolor
.red
>> 8;
1691 color2
.green
= xcolor
.green
>> 8;
1692 color2
.blue
= xcolor
.blue
>> 8;
1694 texture
= (WTexture
*) wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1696 } else if (strcasecmp(val
, "igradient") == 0) {
1697 RColor colors1
[2], colors2
[2];
1703 wwarning(_("bad number of arguments in gradient specification"));
1707 /* get from color */
1708 for (i
= 0; i
< 2; i
++) {
1709 elem
= WMGetFromPLArray(pl
, 1 + i
);
1710 if (!elem
|| !WMIsPLString(elem
))
1712 val
= WMGetFromPLString(elem
);
1714 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1715 wwarning(_("\"%s\" is not a valid color name"), val
);
1718 colors1
[i
].alpha
= 255;
1719 colors1
[i
].red
= xcolor
.red
>> 8;
1720 colors1
[i
].green
= xcolor
.green
>> 8;
1721 colors1
[i
].blue
= xcolor
.blue
>> 8;
1723 elem
= WMGetFromPLArray(pl
, 3);
1724 if (!elem
|| !WMIsPLString(elem
))
1726 val
= WMGetFromPLString(elem
);
1729 /* get from color */
1730 for (i
= 0; i
< 2; i
++) {
1731 elem
= WMGetFromPLArray(pl
, 4 + i
);
1732 if (!elem
|| !WMIsPLString(elem
))
1734 val
= WMGetFromPLString(elem
);
1736 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1737 wwarning(_("\"%s\" is not a valid color name"), val
);
1740 colors2
[i
].alpha
= 255;
1741 colors2
[i
].red
= xcolor
.red
>> 8;
1742 colors2
[i
].green
= xcolor
.green
>> 8;
1743 colors2
[i
].blue
= xcolor
.blue
>> 8;
1745 elem
= WMGetFromPLArray(pl
, 6);
1746 if (!elem
|| !WMIsPLString(elem
))
1748 val
= WMGetFromPLString(elem
);
1751 texture
= (WTexture
*) wTextureMakeIGradient(scr
, th1
, colors1
, th2
, colors2
);
1753 } else if (strcasecmp(val
, "mhgradient") == 0
1754 || strcasecmp(val
, "mvgradient") == 0 || strcasecmp(val
, "mdgradient") == 0) {
1761 wwarning(_("too few arguments in multicolor gradient specification"));
1765 if (val
[1] == 'h' || val
[1] == 'H')
1766 type
= WTEX_MHGRADIENT
;
1767 else if (val
[1] == 'v' || val
[1] == 'V')
1768 type
= WTEX_MVGRADIENT
;
1770 type
= WTEX_MDGRADIENT
;
1774 colors
= wmalloc(sizeof(RColor
*) * (count
+ 1));
1776 for (i
= 0; i
< count
; i
++) {
1777 elem
= WMGetFromPLArray(pl
, i
+ 1);
1778 if (!elem
|| !WMIsPLString(elem
)) {
1779 for (--i
; i
>= 0; --i
) {
1785 val
= WMGetFromPLString(elem
);
1787 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1788 wwarning(_("\"%s\" is not a valid color name"), val
);
1789 for (--i
; i
>= 0; --i
) {
1795 colors
[i
] = wmalloc(sizeof(RColor
));
1796 colors
[i
]->red
= color
.red
>> 8;
1797 colors
[i
]->green
= color
.green
>> 8;
1798 colors
[i
]->blue
= color
.blue
>> 8;
1803 texture
= (WTexture
*) wTextureMakeMGradient(scr
, type
, colors
);
1804 } else if (strcasecmp(val
, "spixmap") == 0 ||
1805 strcasecmp(val
, "cpixmap") == 0 || strcasecmp(val
, "tpixmap") == 0) {
1812 if (val
[0] == 's' || val
[0] == 'S')
1814 else if (val
[0] == 'c' || val
[0] == 'C')
1820 elem
= WMGetFromPLArray(pl
, 2);
1821 if (!elem
|| !WMIsPLString(elem
)) {
1824 val
= WMGetFromPLString(elem
);
1826 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1827 wwarning(_("\"%s\" is not a valid color name"), val
);
1832 elem
= WMGetFromPLArray(pl
, 1);
1833 if (!elem
|| !WMIsPLString(elem
))
1835 val
= WMGetFromPLString(elem
);
1837 texture
= (WTexture
*) wTextureMakePixmap(scr
, type
, val
, &color
);
1838 } else if (strcasecmp(val
, "thgradient") == 0
1839 || strcasecmp(val
, "tvgradient") == 0 || strcasecmp(val
, "tdgradient") == 0) {
1840 RColor color1
, color2
;
1845 if (val
[1] == 'h' || val
[1] == 'H')
1846 style
= WTEX_THGRADIENT
;
1847 else if (val
[1] == 'v' || val
[1] == 'V')
1848 style
= WTEX_TVGRADIENT
;
1850 style
= WTEX_TDGRADIENT
;
1853 wwarning(_("bad number of arguments in textured gradient specification"));
1857 /* get from color */
1858 elem
= WMGetFromPLArray(pl
, 3);
1859 if (!elem
|| !WMIsPLString(elem
))
1861 val
= WMGetFromPLString(elem
);
1863 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1864 wwarning(_("\"%s\" is not a valid color name"), val
);
1868 color1
.red
= xcolor
.red
>> 8;
1869 color1
.green
= xcolor
.green
>> 8;
1870 color1
.blue
= xcolor
.blue
>> 8;
1873 elem
= WMGetFromPLArray(pl
, 4);
1874 if (!elem
|| !WMIsPLString(elem
)) {
1877 val
= WMGetFromPLString(elem
);
1879 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1880 wwarning(_("\"%s\" is not a valid color name"), val
);
1884 color2
.red
= xcolor
.red
>> 8;
1885 color2
.green
= xcolor
.green
>> 8;
1886 color2
.blue
= xcolor
.blue
>> 8;
1889 elem
= WMGetFromPLArray(pl
, 2);
1890 if (!elem
|| !WMIsPLString(elem
))
1893 val
= WMGetFromPLString(elem
);
1895 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
1896 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
1901 elem
= WMGetFromPLArray(pl
, 1);
1902 if (!elem
|| !WMIsPLString(elem
))
1904 val
= WMGetFromPLString(elem
);
1906 texture
= (WTexture
*) wTextureMakeTGradient(scr
, style
, &color1
, &color2
, val
, opacity
);
1907 } else if (strcasecmp(val
, "function") == 0) {
1908 /* Leave this in to handle the unlikely case of
1909 * someone actually having function textures configured */
1910 wwarning("function texture support has been removed");
1913 wwarning(_("invalid texture type %s"), val
);
1919 static int getTexture(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1921 static WTexture
*texture
;
1925 if (!WMIsPLArray(value
)) {
1926 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Texture");
1928 value
= entry
->plvalue
;
1930 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1936 if (strcmp(entry
->key
, "WidgetColor") == 0 && !changed
) {
1939 pl
= WMGetFromPLArray(value
, 0);
1940 if (!pl
|| !WMIsPLString(pl
) || !WMGetFromPLString(pl
)
1941 || strcasecmp(WMGetFromPLString(pl
), "solid") != 0) {
1942 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1943 entry
->key
, "Solid Texture");
1945 value
= entry
->plvalue
;
1947 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1952 texture
= parse_texture(scr
, value
);
1955 wwarning(_("Error in texture specification for key \"%s\""), entry
->key
);
1957 value
= entry
->plvalue
;
1959 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1969 *(WTexture
**) addr
= texture
;
1974 static int getWSBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1981 /* Parameter not used, but tell the compiler that it is ok */
1986 if (!WMIsPLArray(value
)) {
1987 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1988 "WorkspaceBack", "Texture or None");
1990 value
= entry
->plvalue
;
1992 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1998 /* only do basic error checking and verify for None texture */
2000 nelem
= WMGetPropListItemCount(value
);
2002 elem
= WMGetFromPLArray(value
, 0);
2003 if (!elem
|| !WMIsPLString(elem
)) {
2004 wwarning(_("Wrong type for workspace background. Should be a texture type."));
2006 value
= entry
->plvalue
;
2008 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2013 val
= WMGetFromPLString(elem
);
2015 if (strcasecmp(val
, "None") == 0)
2018 *ret
= WMRetainPropList(value
);
2024 getWSSpecificBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2030 /* Parameter not used, but tell the compiler that it is ok */
2035 if (!WMIsPLArray(value
)) {
2036 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2037 "WorkspaceSpecificBack", "an array of textures");
2039 value
= entry
->plvalue
;
2041 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2047 /* only do basic error checking and verify for None texture */
2049 nelem
= WMGetPropListItemCount(value
);
2052 elem
= WMGetFromPLArray(value
, nelem
);
2053 if (!elem
|| !WMIsPLArray(elem
)) {
2054 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2060 *ret
= WMRetainPropList(value
);
2064 * Kluge to force wmsetbg helper to set the default background.
2065 * If the WorkspaceSpecificBack is changed once wmaker has started,
2066 * the WorkspaceBack won't be sent to the helper, unless the user
2067 * changes it's value too. So, we must force this by removing the
2068 * value from the defaults DB.
2070 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2071 WMPropList
*key
= WMCreatePLString("WorkspaceBack");
2073 WMRemoveFromPLDictionary(w_global
.domain
.wmaker
->dictionary
, key
);
2075 WMReleasePropList(key
);
2081 static int getFont(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2083 static WMFont
*font
;
2088 GET_STRING_OR_DEFAULT("Font", val
);
2090 font
= WMCreateFont(scr
->wmscreen
, val
);
2092 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2095 wfatal(_("could not load any usable font!!!"));
2102 /* can't assign font value outside update function */
2103 wassertrv(addr
== NULL
, True
);
2108 static int getColor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2110 static XColor color
;
2112 int second_pass
= 0;
2116 GET_STRING_OR_DEFAULT("Color", val
);
2119 if (!wGetColor(scr
, val
, &color
)) {
2120 wwarning(_("could not get color for key \"%s\""), entry
->key
);
2121 if (second_pass
== 0) {
2122 val
= WMGetFromPLString(entry
->plvalue
);
2124 wwarning(_("using default \"%s\" instead"), val
);
2133 assert(addr
== NULL
);
2136 *(unsigned long*)addr = pixel;
2142 static int getKeybind(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2144 static WShortKey shortcut
;
2148 char buf
[MAX_SHORTCUT_LENGTH
], *b
;
2150 /* Parameter not used, but tell the compiler that it is ok */
2154 GET_STRING_OR_DEFAULT("Key spec", val
);
2156 if (!val
|| strcasecmp(val
, "NONE") == 0) {
2157 shortcut
.keycode
= 0;
2158 shortcut
.modifier
= 0;
2164 wstrlcpy(buf
, val
, MAX_SHORTCUT_LENGTH
);
2169 shortcut
.modifier
= 0;
2170 while ((k
= strchr(b
, '+')) != NULL
) {
2174 mod
= wXModifierFromKey(b
);
2176 wwarning(_("%s: invalid key modifier \"%s\""), entry
->key
, b
);
2179 shortcut
.modifier
|= mod
;
2185 ksym
= XStringToKeysym(b
);
2187 if (ksym
== NoSymbol
) {
2188 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
, val
);
2192 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2193 if (shortcut
.keycode
== 0) {
2194 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2204 static int getModMask(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2209 /* Parameter not used, but tell the compiler that it is ok */
2212 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2217 mask
= wXModifierFromKey(str
);
2219 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2225 *(int *)addr
= mask
;
2233 # include <X11/cursorfont.h>
2239 #define CURSOR_ID_NONE (XC_num_glyphs)
2241 static const WCursorLookup cursor_table
[] = {
2242 {"X_cursor", XC_X_cursor
},
2243 {"arrow", XC_arrow
},
2244 {"based_arrow_down", XC_based_arrow_down
},
2245 {"based_arrow_up", XC_based_arrow_up
},
2247 {"bogosity", XC_bogosity
},
2248 {"bottom_left_corner", XC_bottom_left_corner
},
2249 {"bottom_right_corner", XC_bottom_right_corner
},
2250 {"bottom_side", XC_bottom_side
},
2251 {"bottom_tee", XC_bottom_tee
},
2252 {"box_spiral", XC_box_spiral
},
2253 {"center_ptr", XC_center_ptr
},
2254 {"circle", XC_circle
},
2255 {"clock", XC_clock
},
2256 {"coffee_mug", XC_coffee_mug
},
2257 {"cross", XC_cross
},
2258 {"cross_reverse", XC_cross_reverse
},
2259 {"crosshair", XC_crosshair
},
2260 {"diamond_cross", XC_diamond_cross
},
2262 {"dotbox", XC_dotbox
},
2263 {"double_arrow", XC_double_arrow
},
2264 {"draft_large", XC_draft_large
},
2265 {"draft_small", XC_draft_small
},
2266 {"draped_box", XC_draped_box
},
2267 {"exchange", XC_exchange
},
2268 {"fleur", XC_fleur
},
2269 {"gobbler", XC_gobbler
},
2270 {"gumby", XC_gumby
},
2271 {"hand1", XC_hand1
},
2272 {"hand2", XC_hand2
},
2273 {"heart", XC_heart
},
2275 {"iron_cross", XC_iron_cross
},
2276 {"left_ptr", XC_left_ptr
},
2277 {"left_side", XC_left_side
},
2278 {"left_tee", XC_left_tee
},
2279 {"leftbutton", XC_leftbutton
},
2280 {"ll_angle", XC_ll_angle
},
2281 {"lr_angle", XC_lr_angle
},
2283 {"middlebutton", XC_middlebutton
},
2284 {"mouse", XC_mouse
},
2285 {"pencil", XC_pencil
},
2286 {"pirate", XC_pirate
},
2288 {"question_arrow", XC_question_arrow
},
2289 {"right_ptr", XC_right_ptr
},
2290 {"right_side", XC_right_side
},
2291 {"right_tee", XC_right_tee
},
2292 {"rightbutton", XC_rightbutton
},
2293 {"rtl_logo", XC_rtl_logo
},
2294 {"sailboat", XC_sailboat
},
2295 {"sb_down_arrow", XC_sb_down_arrow
},
2296 {"sb_h_double_arrow", XC_sb_h_double_arrow
},
2297 {"sb_left_arrow", XC_sb_left_arrow
},
2298 {"sb_right_arrow", XC_sb_right_arrow
},
2299 {"sb_up_arrow", XC_sb_up_arrow
},
2300 {"sb_v_double_arrow", XC_sb_v_double_arrow
},
2301 {"shuttle", XC_shuttle
},
2302 {"sizing", XC_sizing
},
2303 {"spider", XC_spider
},
2304 {"spraycan", XC_spraycan
},
2306 {"target", XC_target
},
2307 {"tcross", XC_tcross
},
2308 {"top_left_arrow", XC_top_left_arrow
},
2309 {"top_left_corner", XC_top_left_corner
},
2310 {"top_right_corner", XC_top_right_corner
},
2311 {"top_side", XC_top_side
},
2312 {"top_tee", XC_top_tee
},
2314 {"ul_angle", XC_ul_angle
},
2315 {"umbrella", XC_umbrella
},
2316 {"ur_angle", XC_ur_angle
},
2317 {"watch", XC_watch
},
2318 {"xterm", XC_xterm
},
2319 {NULL
, CURSOR_ID_NONE
}
2322 static void check_bitmap_status(int status
, const char *filename
, Pixmap bitmap
)
2325 case BitmapOpenFailed
:
2326 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2328 case BitmapFileInvalid
:
2329 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2331 case BitmapNoMemory
:
2332 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2335 XFreePixmap(dpy
, bitmap
);
2342 * (builtin, <cursor_name>)
2343 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2345 static int parse_cursor(WScreen
* scr
, WMPropList
* pl
, Cursor
* cursor
)
2352 nelem
= WMGetPropListItemCount(pl
);
2356 elem
= WMGetFromPLArray(pl
, 0);
2357 if (!elem
|| !WMIsPLString(elem
)) {
2360 val
= WMGetFromPLString(elem
);
2362 if (strcasecmp(val
, "none") == 0) {
2365 } else if (strcasecmp(val
, "builtin") == 0) {
2367 int cursor_id
= CURSOR_ID_NONE
;
2370 wwarning(_("bad number of arguments in cursor specification"));
2373 elem
= WMGetFromPLArray(pl
, 1);
2374 if (!elem
|| !WMIsPLString(elem
)) {
2377 val
= WMGetFromPLString(elem
);
2379 for (i
= 0; cursor_table
[i
].name
!= NULL
; i
++) {
2380 if (strcasecmp(val
, cursor_table
[i
].name
) == 0) {
2381 cursor_id
= cursor_table
[i
].id
;
2385 if (CURSOR_ID_NONE
== cursor_id
) {
2386 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2388 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2391 } else if (strcasecmp(val
, "bitmap") == 0) {
2403 wwarning(_("bad number of arguments in cursor specification"));
2406 elem
= WMGetFromPLArray(pl
, 1);
2407 if (!elem
|| !WMIsPLString(elem
)) {
2410 val
= WMGetFromPLString(elem
);
2411 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2413 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2416 elem
= WMGetFromPLArray(pl
, 2);
2417 if (!elem
|| !WMIsPLString(elem
)) {
2421 val
= WMGetFromPLString(elem
);
2422 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2425 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2428 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
, &mask
, &x
, &y
);
2429 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
, &bitmap
, &x
, &y
);
2430 if ((BitmapSuccess
== bitmap_status
) && (BitmapSuccess
== mask_status
)) {
2431 fg
.pixel
= scr
->black_pixel
;
2432 bg
.pixel
= scr
->white_pixel
;
2433 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2434 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2435 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2438 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2439 check_bitmap_status(mask_status
, mask_name
, mask
);
2446 static int getCursor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2448 static Cursor cursor
;
2453 if (!WMIsPLArray(value
)) {
2454 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2455 entry
->key
, "cursor specification");
2457 value
= entry
->plvalue
;
2459 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2464 status
= parse_cursor(scr
, value
, &cursor
);
2466 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2468 value
= entry
->plvalue
;
2470 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2479 *(Cursor
*) addr
= cursor
;
2484 #undef CURSOR_ID_NONE
2486 /* ---------------- value setting functions --------------- */
2487 static int setJustify(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2489 /* Parameter not used, but tell the compiler that it is ok */
2495 return REFRESH_WINDOW_TITLE_COLOR
;
2498 static int setClearance(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2500 /* Parameter not used, but tell the compiler that it is ok */
2506 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
| REFRESH_MENU_TITLE_FONT
| REFRESH_MENU_FONT
;
2509 static int setIfDockPresent(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2512 long which
= (long) extra_data
;
2514 /* Parameter not used, but tell the compiler that it is ok */
2520 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2521 // Drawers require the dock
2522 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| wPreferences
.flags
.nodock
;
2525 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2528 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| *flag
;
2536 static int setClipMergedInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2540 /* Parameter not used, but tell the compiler that it is ok */
2545 wPreferences
.flags
.clip_merged_in_dock
= *flag
;
2546 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2550 static int setWrapAppiconsInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2554 /* Parameter not used, but tell the compiler that it is ok */
2559 wPreferences
.flags
.wrap_appicons_in_dock
= *flag
;
2563 static int setStickyIcons(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2565 /* Parameter not used, but tell the compiler that it is ok */
2570 if (scr
->workspaces
) {
2571 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2572 wArrangeIcons(scr
, False
);
2577 static int setIconTile(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2581 WTexture
** texture
= tdata
;
2584 /* Parameter not used, but tell the compiler that it is ok */
2587 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2588 wPreferences
.icon_size
, ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2589 ? WREL_ICON
: WREL_FLAT
);
2591 wwarning(_("could not render texture for icon background"));
2593 wTextureDestroy(scr
, *texture
);
2596 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2598 if (scr
->icon_tile
) {
2600 RReleaseImage(scr
->icon_tile
);
2601 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2604 scr
->icon_tile
= img
;
2606 /* put the icon in the noticeboard hint */
2607 PropSetIconTileHint(scr
, img
);
2609 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
) {
2610 if (scr
->clip_tile
) {
2611 RReleaseImage(scr
->clip_tile
);
2613 scr
->clip_tile
= wClipMakeTile(img
);
2616 if (!wPreferences
.flags
.nodrawer
) {
2617 if (scr
->drawer_tile
) {
2618 RReleaseImage(scr
->drawer_tile
);
2620 scr
->drawer_tile
= wDrawerMakeTile(scr
, img
);
2623 scr
->icon_tile_pixmap
= pixmap
;
2625 if (scr
->def_icon_rimage
) {
2626 RReleaseImage(scr
->def_icon_rimage
);
2627 scr
->def_icon_rimage
= NULL
;
2630 if (scr
->icon_back_texture
)
2631 wTextureDestroy(scr
, (WTexture
*) scr
->icon_back_texture
);
2633 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2635 /* Free the texture as nobody else will use it, nor refer to it. */
2637 wTextureDestroy(scr
, *texture
);
2639 return (reset
? REFRESH_ICON_TILE
: 0);
2642 static int setWinTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2644 WMFont
*font
= tdata
;
2646 /* Parameter not used, but tell the compiler that it is ok */
2650 if (scr
->title_font
) {
2651 WMReleaseFont(scr
->title_font
);
2653 scr
->title_font
= font
;
2655 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
;
2658 static int setMenuTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2660 WMFont
*font
= tdata
;
2662 /* Parameter not used, but tell the compiler that it is ok */
2666 if (scr
->menu_title_font
) {
2667 WMReleaseFont(scr
->menu_title_font
);
2670 scr
->menu_title_font
= font
;
2672 return REFRESH_MENU_TITLE_FONT
;
2675 static int setMenuTextFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2677 WMFont
*font
= tdata
;
2679 /* Parameter not used, but tell the compiler that it is ok */
2683 if (scr
->menu_entry_font
) {
2684 WMReleaseFont(scr
->menu_entry_font
);
2686 scr
->menu_entry_font
= font
;
2688 return REFRESH_MENU_FONT
;
2691 static int setIconTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2693 WMFont
*font
= tdata
;
2695 /* Parameter not used, but tell the compiler that it is ok */
2699 if (scr
->icon_title_font
) {
2700 WMReleaseFont(scr
->icon_title_font
);
2703 scr
->icon_title_font
= font
;
2705 return REFRESH_ICON_FONT
;
2708 static int setClipTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2710 WMFont
*font
= tdata
;
2712 /* Parameter not used, but tell the compiler that it is ok */
2716 if (scr
->clip_title_font
) {
2717 WMReleaseFont(scr
->clip_title_font
);
2720 scr
->clip_title_font
= font
;
2722 return REFRESH_ICON_FONT
;
2725 static int setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2727 WMFont
*font
= tdata
;
2729 /* Parameter not used, but tell the compiler that it is ok */
2734 if (scr
->workspace_name_font
)
2735 WMReleaseFont(scr
->workspace_name_font
);
2737 scr
->workspace_name_font
= font
;
2742 static int setHightlight(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2744 XColor
*color
= tdata
;
2746 /* Parameter not used, but tell the compiler that it is ok */
2750 if (scr
->select_color
)
2751 WMReleaseColor(scr
->select_color
);
2753 scr
->select_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2755 wFreeColor(scr
, color
->pixel
);
2757 return REFRESH_MENU_COLOR
;
2760 static int setHightlightText(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2762 XColor
*color
= tdata
;
2764 /* Parameter not used, but tell the compiler that it is ok */
2768 if (scr
->select_text_color
)
2769 WMReleaseColor(scr
->select_text_color
);
2771 scr
->select_text_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2773 wFreeColor(scr
, color
->pixel
);
2775 return REFRESH_MENU_COLOR
;
2778 static int setClipTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2780 XColor
*color
= tdata
;
2781 long widx
= (long) extra_data
;
2783 /* Parameter not used, but tell the compiler that it is ok */
2786 if (scr
->clip_title_color
[widx
])
2787 WMReleaseColor(scr
->clip_title_color
[widx
]);
2789 scr
->clip_title_color
[widx
] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2790 wFreeColor(scr
, color
->pixel
);
2792 return REFRESH_ICON_TITLE_COLOR
;
2795 static int setWTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2797 XColor
*color
= tdata
;
2798 long widx
= (long) extra_data
;
2800 /* Parameter not used, but tell the compiler that it is ok */
2803 if (scr
->window_title_color
[widx
])
2804 WMReleaseColor(scr
->window_title_color
[widx
]);
2806 scr
->window_title_color
[widx
] =
2807 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2809 wFreeColor(scr
, color
->pixel
);
2811 return REFRESH_WINDOW_TITLE_COLOR
;
2814 static int setMenuTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2816 XColor
*color
= tdata
;
2818 /* Parameter not used, but tell the compiler that it is ok */
2822 if (scr
->menu_title_color
[0])
2823 WMReleaseColor(scr
->menu_title_color
[0]);
2825 scr
->menu_title_color
[0] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2827 wFreeColor(scr
, color
->pixel
);
2829 return REFRESH_MENU_TITLE_COLOR
;
2832 static int setMenuTextColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2834 XColor
*color
= tdata
;
2836 /* Parameter not used, but tell the compiler that it is ok */
2840 if (scr
->mtext_color
)
2841 WMReleaseColor(scr
->mtext_color
);
2843 scr
->mtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2845 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2846 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2848 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2851 wFreeColor(scr
, color
->pixel
);
2853 return REFRESH_MENU_COLOR
;
2856 static int setMenuDisabledColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2858 XColor
*color
= tdata
;
2860 /* Parameter not used, but tell the compiler that it is ok */
2864 if (scr
->dtext_color
)
2865 WMReleaseColor(scr
->dtext_color
);
2867 scr
->dtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2869 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2870 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2872 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2875 wFreeColor(scr
, color
->pixel
);
2877 return REFRESH_MENU_COLOR
;
2880 static int setIconTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2882 XColor
*color
= tdata
;
2884 /* Parameter not used, but tell the compiler that it is ok */
2888 if (scr
->icon_title_color
)
2889 WMReleaseColor(scr
->icon_title_color
);
2890 scr
->icon_title_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2892 wFreeColor(scr
, color
->pixel
);
2894 return REFRESH_ICON_TITLE_COLOR
;
2897 static int setIconTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2899 XColor
*color
= tdata
;
2901 /* Parameter not used, but tell the compiler that it is ok */
2905 if (scr
->icon_title_texture
) {
2906 wTextureDestroy(scr
, (WTexture
*) scr
->icon_title_texture
);
2908 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
2910 return REFRESH_ICON_TITLE_BACK
;
2913 static int setFrameBorderWidth(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2917 /* Parameter not used, but tell the compiler that it is ok */
2921 scr
->frame_border_width
= *value
;
2923 return REFRESH_FRAME_BORDER
;
2926 static int setFrameBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2928 XColor
*color
= tdata
;
2930 /* Parameter not used, but tell the compiler that it is ok */
2934 if (scr
->frame_border_color
)
2935 WMReleaseColor(scr
->frame_border_color
);
2936 scr
->frame_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2938 wFreeColor(scr
, color
->pixel
);
2940 return REFRESH_FRAME_BORDER
;
2943 static int setFrameFocusedBorderColor(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2945 XColor
*color
= tdata
;
2947 /* Parameter not used, but tell the compiler that it is ok */
2951 if (scr
->frame_focused_border_color
)
2952 WMReleaseColor(scr
->frame_focused_border_color
);
2953 scr
->frame_focused_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2955 wFreeColor(scr
, color
->pixel
);
2957 return REFRESH_FRAME_BORDER
;
2960 static int setFrameSelectedBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2962 XColor
*color
= tdata
;
2964 /* Parameter not used, but tell the compiler that it is ok */
2968 if (scr
->frame_selected_border_color
)
2969 WMReleaseColor(scr
->frame_selected_border_color
);
2970 scr
->frame_selected_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2972 wFreeColor(scr
, color
->pixel
);
2974 return REFRESH_FRAME_BORDER
;
2977 static int setWorkspaceSpecificBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
2979 WMPropList
*value
= tdata
;
2984 /* Parameter not used, but tell the compiler that it is ok */
2988 if (scr
->flags
.backimage_helper_launched
) {
2989 if (WMGetPropListItemCount(value
) == 0) {
2990 SendHelperMessage(scr
, 'C', 0, NULL
);
2991 SendHelperMessage(scr
, 'K', 0, NULL
);
2993 WMReleasePropList(value
);
2997 if (WMGetPropListItemCount(value
) == 0)
3000 if (!start_bg_helper(scr
)) {
3001 WMReleasePropList(value
);
3005 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3008 for (i
= 0; i
< WMGetPropListItemCount(value
); i
++) {
3009 val
= WMGetFromPLArray(value
, i
);
3010 if (val
&& WMIsPLArray(val
) && WMGetPropListItemCount(val
) > 0) {
3011 str
= WMGetPropListDescription(val
, False
);
3013 SendHelperMessage(scr
, 'S', i
+ 1, str
);
3017 SendHelperMessage(scr
, 'U', i
+ 1, NULL
);
3022 WMReleasePropList(value
);
3026 static int setWorkspaceBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
3028 WMPropList
*value
= tdata
;
3030 /* Parameter not used, but tell the compiler that it is ok */
3034 if (scr
->flags
.backimage_helper_launched
) {
3037 if (WMGetPropListItemCount(value
) == 0) {
3038 SendHelperMessage(scr
, 'U', 0, NULL
);
3040 /* set the default workspace background to this one */
3041 str
= WMGetPropListDescription(value
, False
);
3043 SendHelperMessage(scr
, 'S', 0, str
);
3045 SendHelperMessage(scr
, 'C', scr
->current_workspace
+ 1, NULL
);
3047 SendHelperMessage(scr
, 'U', 0, NULL
);
3050 } else if (WMGetPropListItemCount(value
) > 0) {
3055 text
= WMGetPropListDescription(value
, False
);
3056 len
= strlen(text
) + 40;
3057 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3058 if (!strchr(text
, '\'') && !strchr(text
, '\\')) {
3061 if (wPreferences
.smooth_workspace_back
)
3062 snprintf(command
, len
, "wmsetbg %s -S -p '%s' &", dither
, text
);
3064 snprintf(command
, len
, "wmsetbg %s -p '%s' &", dither
, text
);
3065 ExecuteShellCommand(scr
, command
);
3067 wwarning(_("Invalid arguments for background \"%s\""), text
);
3070 WMReleasePropList(value
);
3075 static int setWidgetColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3077 WTexture
**texture
= tdata
;
3079 /* Parameter not used, but tell the compiler that it is ok */
3083 if (scr
->widget_texture
) {
3084 wTextureDestroy(scr
, (WTexture
*) scr
->widget_texture
);
3086 scr
->widget_texture
= *(WTexSolid
**) texture
;
3091 static int setFTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3093 WTexture
**texture
= tdata
;
3095 /* Parameter not used, but tell the compiler that it is ok */
3099 if (scr
->window_title_texture
[WS_FOCUSED
]) {
3100 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3102 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3104 return REFRESH_WINDOW_TEXTURES
;
3107 static int setPTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3109 WTexture
**texture
= tdata
;
3111 /* Parameter not used, but tell the compiler that it is ok */
3115 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
3116 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3118 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3120 return REFRESH_WINDOW_TEXTURES
;
3123 static int setUTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3125 WTexture
**texture
= tdata
;
3127 /* Parameter not used, but tell the compiler that it is ok */
3131 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
3132 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3134 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3136 return REFRESH_WINDOW_TEXTURES
;
3139 static int setResizebarBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3141 WTexture
**texture
= tdata
;
3143 /* Parameter not used, but tell the compiler that it is ok */
3147 if (scr
->resizebar_texture
[0]) {
3148 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3150 scr
->resizebar_texture
[0] = *texture
;
3152 return REFRESH_WINDOW_TEXTURES
;
3155 static int setMenuTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3157 WTexture
**texture
= tdata
;
3159 /* Parameter not used, but tell the compiler that it is ok */
3163 if (scr
->menu_title_texture
[0]) {
3164 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3166 scr
->menu_title_texture
[0] = *texture
;
3168 return REFRESH_MENU_TITLE_TEXTURE
;
3171 static int setMenuTextBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3173 WTexture
**texture
= tdata
;
3175 /* Parameter not used, but tell the compiler that it is ok */
3179 if (scr
->menu_item_texture
) {
3180 wTextureDestroy(scr
, scr
->menu_item_texture
);
3181 wTextureDestroy(scr
, (WTexture
*) scr
->menu_item_auxtexture
);
3183 scr
->menu_item_texture
= *texture
;
3185 scr
->menu_item_auxtexture
= wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3187 return REFRESH_MENU_TEXTURE
;
3190 static int setKeyGrab(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3192 WShortKey
*shortcut
= tdata
;
3194 long widx
= (long) extra_data
;
3196 /* Parameter not used, but tell the compiler that it is ok */
3199 wKeyBindings
[widx
] = *shortcut
;
3201 wwin
= scr
->focused_window
;
3203 while (wwin
!= NULL
) {
3204 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3206 if (!WFLAGP(wwin
, no_bind_keys
)) {
3207 wWindowSetKeyGrabs(wwin
);
3212 /* do we need to update window menus? */
3213 if (widx
>= WKBD_WORKSPACE1
&& widx
<= WKBD_WORKSPACE10
)
3214 return REFRESH_WORKSPACE_MENU
;
3215 if (widx
== WKBD_LASTWORKSPACE
)
3216 return REFRESH_WORKSPACE_MENU
;
3217 if (widx
>= WKBD_MOVE_WORKSPACE1
&& widx
<= WKBD_MOVE_WORKSPACE10
)
3218 return REFRESH_WORKSPACE_MENU
;
3223 static int setIconPosition(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3225 /* Parameter not used, but tell the compiler that it is ok */
3230 wScreenUpdateUsableArea(scr
);
3231 wArrangeIcons(scr
, True
);
3236 static int updateUsableArea(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3238 /* Parameter not used, but tell the compiler that it is ok */
3243 wScreenUpdateUsableArea(scr
);
3248 static int setWorkspaceMapBackground(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3250 WTexture
**texture
= tdata
;
3252 /* Parameter not used, but tell the compiler that it is ok */
3256 if (wPreferences
.wsmbackTexture
)
3257 wTextureDestroy(scr
, wPreferences
.wsmbackTexture
);
3259 wPreferences
.wsmbackTexture
= *texture
;
3261 return REFRESH_WINDOW_TEXTURES
;
3264 static int setMenuStyle(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3266 /* Parameter not used, but tell the compiler that it is ok */
3272 return REFRESH_MENU_TEXTURE
;
3275 static RImage
*chopOffImage(RImage
* image
, int x
, int y
, int w
, int h
)
3277 RImage
*img
= RCreateImage(w
, h
, image
->format
== RRGBAFormat
);
3279 RCopyArea(img
, image
, x
, y
, w
, h
, 0, 0);
3284 static int setSwPOptions(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3286 WMPropList
*array
= tdata
;
3289 int cwidth
, cheight
;
3290 struct WPreferences
*prefs
= foo
;
3292 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) == 0) {
3293 if (prefs
->swtileImage
)
3294 RReleaseImage(prefs
->swtileImage
);
3295 prefs
->swtileImage
= NULL
;
3297 WMReleasePropList(array
);
3301 switch (WMGetPropListItemCount(array
)) {
3303 if (!WMIsPLString(WMGetFromPLArray(array
, 1))) {
3304 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3307 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 1)));
3310 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3311 WMGetFromPLString(WMGetFromPLArray(array
, 1)), entry
->key
);
3313 bgimage
= RLoadImage(scr
->rcontext
, path
, 0);
3315 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3320 cwidth
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 2)));
3321 cheight
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 3)));
3323 if (cwidth
<= 0 || cheight
<= 0 ||
3324 cwidth
>= bgimage
->width
- 2 || cheight
>= bgimage
->height
- 2)
3325 wwarning(_("Invalid split sizes for switch panel back image."));
3328 int swidth
, theight
;
3329 for (i
= 0; i
< 9; i
++) {
3330 if (prefs
->swbackImage
[i
])
3331 RReleaseImage(prefs
->swbackImage
[i
]);
3332 prefs
->swbackImage
[i
] = NULL
;
3334 swidth
= (bgimage
->width
- cwidth
) / 2;
3335 theight
= (bgimage
->height
- cheight
) / 2;
3337 prefs
->swbackImage
[0] = chopOffImage(bgimage
, 0, 0, swidth
, theight
);
3338 prefs
->swbackImage
[1] = chopOffImage(bgimage
, swidth
, 0, cwidth
, theight
);
3339 prefs
->swbackImage
[2] = chopOffImage(bgimage
, swidth
+ cwidth
, 0,
3342 prefs
->swbackImage
[3] = chopOffImage(bgimage
, 0, theight
, swidth
, cheight
);
3343 prefs
->swbackImage
[4] = chopOffImage(bgimage
, swidth
, theight
,
3345 prefs
->swbackImage
[5] = chopOffImage(bgimage
, swidth
+ cwidth
, theight
,
3348 prefs
->swbackImage
[6] = chopOffImage(bgimage
, 0, theight
+ cheight
,
3350 prefs
->swbackImage
[7] = chopOffImage(bgimage
, swidth
, theight
+ cheight
,
3352 prefs
->swbackImage
[8] =
3353 chopOffImage(bgimage
, swidth
+ cwidth
, theight
+ cheight
, swidth
,
3356 // check if anything failed
3357 for (i
= 0; i
< 9; i
++) {
3358 if (!prefs
->swbackImage
[i
]) {
3359 for (; i
>= 0; --i
) {
3360 RReleaseImage(prefs
->swbackImage
[i
]);
3361 prefs
->swbackImage
[i
] = NULL
;
3367 RReleaseImage(bgimage
);
3372 if (!WMIsPLString(WMGetFromPLArray(array
, 0))) {
3373 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3376 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 0)));
3379 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3380 WMGetFromPLString(WMGetFromPLArray(array
, 0)), entry
->key
);
3382 if (prefs
->swtileImage
)
3383 RReleaseImage(prefs
->swtileImage
);
3385 prefs
->swtileImage
= RLoadImage(scr
->rcontext
, path
, 0);
3386 if (!prefs
->swtileImage
) {
3387 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3394 wwarning(_("Invalid number of arguments for option \"%s\""), entry
->key
);
3398 WMReleasePropList(array
);
3403 static int setModifierKeyLabels(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3405 WMPropList
*array
= tdata
;
3407 struct WPreferences
*prefs
= foo
;
3409 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) != 7) {
3410 wwarning(_("Value for option \"%s\" must be an array of 7 strings"), entry
->key
);
3411 WMReleasePropList(array
);
3415 DestroyWindowMenu(scr
);
3417 for (i
= 0; i
< 7; i
++) {
3418 if (prefs
->modifier_labels
[i
])
3419 wfree(prefs
->modifier_labels
[i
]);
3421 if (WMIsPLString(WMGetFromPLArray(array
, i
))) {
3422 prefs
->modifier_labels
[i
] = wstrdup(WMGetFromPLString(WMGetFromPLArray(array
, i
)));
3424 wwarning(_("Invalid argument for option \"%s\" item %d"), entry
->key
, i
);
3425 prefs
->modifier_labels
[i
] = NULL
;
3429 WMReleasePropList(array
);
3434 static int setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3438 /* Parameter not used, but tell the compiler that it is ok */
3445 W_setconf_doubleClickDelay(*value
);
3450 static int setCursor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3452 Cursor
*cursor
= tdata
;
3453 long widx
= (long) extra_data
;
3455 /* Parameter not used, but tell the compiler that it is ok */
3458 if (wPreferences
.cursor
[widx
] != None
) {
3459 XFreeCursor(dpy
, wPreferences
.cursor
[widx
]);
3462 wPreferences
.cursor
[widx
] = *cursor
;
3464 if (widx
== WCUR_ROOT
&& *cursor
!= None
) {
3465 XDefineCursor(dpy
, scr
->root_win
, *cursor
);