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 below NEED to have a default value
317 * defined, and this value needs to be correct.
319 * Also add the default key/value pair to WindowMaker/Defaults/WindowMaker.in
322 /* these options will only affect the window manager on startup
324 * static defaults can't access the screen data, because it is
325 * created after these defaults are read
327 WDefaultEntry staticOptionList
[] = {
329 {"ColormapSize", "4", NULL
,
330 &wPreferences
.cmap_size
, getInt
, NULL
, NULL
, NULL
},
331 {"DisableDithering", "NO", NULL
,
332 &wPreferences
.no_dithering
, getBool
, NULL
, NULL
, NULL
},
333 {"IconSize", "64", NULL
,
334 &wPreferences
.icon_size
, getInt
, NULL
, NULL
, NULL
},
335 {"ModifierKey", "Mod1", NULL
,
336 &wPreferences
.modifier_mask
, getModMask
, NULL
, NULL
, NULL
},
337 {"FocusMode", "manual", seFocusModes
, /* have a problem when switching from */
338 &wPreferences
.focus_mode
, getEnum
, NULL
, NULL
, NULL
}, /* manual to sloppy without restart */
339 {"NewStyle", "new", seTitlebarModes
,
340 &wPreferences
.new_style
, getEnum
, NULL
, NULL
, NULL
},
341 {"DisableDock", "NO", (void *)WM_DOCK
,
342 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
343 {"DisableClip", "NO", (void *)WM_CLIP
,
344 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
345 {"DisableDrawers", "NO", (void *)WM_DRAWER
,
346 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
347 {"ClipMergedInDock", "NO", NULL
,
348 NULL
, getBool
, setClipMergedInDock
, NULL
, NULL
},
349 {"DisableMiniwindows", "NO", NULL
,
350 &wPreferences
.disable_miniwindows
, getBool
, NULL
, NULL
, NULL
},
351 {"EnableWorkspacePager", "NO", NULL
,
352 &wPreferences
.enable_workspace_pager
, getBool
, NULL
, NULL
, NULL
},
353 {"SwitchPanelIconSize", "64", NULL
,
354 &wPreferences
.switch_panel_icon_size
, getInt
, NULL
, NULL
, NULL
},
357 #define NUM2STRING_(x) #x
358 #define NUM2STRING(x) NUM2STRING_(x)
360 WDefaultEntry optionList
[] = {
362 /* dynamic options */
364 {"IconPosition", "blh", seIconPositions
,
365 &wPreferences
.icon_yard
, getEnum
, setIconPosition
, NULL
, NULL
},
366 {"IconificationStyle", "Zoom", seIconificationStyles
,
367 &wPreferences
.iconification_style
, getEnum
, NULL
, NULL
, NULL
},
368 {"EnforceIconMargin", "NO", NULL
,
369 &wPreferences
.enforce_icon_margin
, getBool
, NULL
, NULL
, NULL
},
370 {"DisableWSMouseActions", "NO", NULL
,
371 &wPreferences
.disable_root_mouse
, getBool
, NULL
, NULL
, NULL
},
372 {"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions
,
373 &wPreferences
.mouse_button1
, getEnum
, NULL
, NULL
, NULL
},
374 {"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions
,
375 &wPreferences
.mouse_button2
, getEnum
, NULL
, NULL
, NULL
},
376 {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions
,
377 &wPreferences
.mouse_button3
, getEnum
, NULL
, NULL
, NULL
},
378 {"MouseBackwardButtonAction", "None", seMouseButtonActions
,
379 &wPreferences
.mouse_button8
, getEnum
, NULL
, NULL
, NULL
},
380 {"MouseForwardButtonAction", "None", seMouseButtonActions
,
381 &wPreferences
.mouse_button9
, getEnum
, NULL
, NULL
, NULL
},
382 {"MouseWheelAction", "None", seMouseWheelActions
,
383 &wPreferences
.mouse_wheel_scroll
, getEnum
, NULL
, NULL
, NULL
},
384 {"MouseWheelTiltAction", "None", seMouseWheelActions
,
385 &wPreferences
.mouse_wheel_tilt
, getEnum
, NULL
, NULL
, NULL
},
386 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
387 &wPreferences
.pixmap_path
, getPathList
, NULL
, NULL
, NULL
},
388 {"IconPath", DEF_ICON_PATHS
, NULL
,
389 &wPreferences
.icon_path
, getPathList
, NULL
, NULL
, NULL
},
390 {"ColormapMode", "auto", seColormapModes
,
391 &wPreferences
.colormap_mode
, getEnum
, NULL
, NULL
, NULL
},
392 {"AutoFocus", "YES", NULL
,
393 &wPreferences
.auto_focus
, getBool
, NULL
, NULL
, NULL
},
394 {"RaiseDelay", "0", NULL
,
395 &wPreferences
.raise_delay
, getInt
, NULL
, NULL
, NULL
},
396 {"CirculateRaise", "NO", NULL
,
397 &wPreferences
.circ_raise
, getBool
, NULL
, NULL
, NULL
},
398 {"Superfluous", "YES", NULL
,
399 &wPreferences
.superfluous
, getBool
, NULL
, NULL
, NULL
},
400 {"AdvanceToNewWorkspace", "NO", NULL
,
401 &wPreferences
.ws_advance
, getBool
, NULL
, NULL
, NULL
},
402 {"CycleWorkspaces", "NO", NULL
,
403 &wPreferences
.ws_cycle
, getBool
, NULL
, NULL
, NULL
},
404 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
405 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
, NULL
, NULL
},
406 {"WorkspaceBorder", "None", seWorkspaceBorder
,
407 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
, NULL
, NULL
},
408 {"WorkspaceBorderSize", "0", NULL
,
409 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
, NULL
, NULL
},
410 {"StickyIcons", "NO", NULL
,
411 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
, NULL
, NULL
},
412 {"SaveSessionOnExit", "NO", NULL
,
413 &wPreferences
.save_session_on_exit
, getBool
, NULL
, NULL
, NULL
},
414 {"WrapMenus", "NO", NULL
,
415 &wPreferences
.wrap_menus
, getBool
, NULL
, NULL
, NULL
},
416 {"ScrollableMenus", "YES", NULL
,
417 &wPreferences
.scrollable_menus
, getBool
, NULL
, NULL
, NULL
},
418 {"MenuScrollSpeed", "fast", seSpeeds
,
419 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
, NULL
, NULL
},
420 {"IconSlideSpeed", "fast", seSpeeds
,
421 &wPreferences
.icon_slide_speed
, getEnum
, NULL
, NULL
, NULL
},
422 {"ShadeSpeed", "fast", seSpeeds
,
423 &wPreferences
.shade_speed
, getEnum
, NULL
, NULL
, NULL
},
424 {"BounceAppIconsWhenUrgent", "YES", NULL
,
425 &wPreferences
.bounce_appicons_when_urgent
, getBool
, NULL
, NULL
, NULL
},
426 {"RaiseAppIconsWhenBouncing", "NO", NULL
,
427 &wPreferences
.raise_appicons_when_bouncing
, getBool
, NULL
, NULL
, NULL
},
428 {"DoNotMakeAppIconsBounce", "NO", NULL
,
429 &wPreferences
.do_not_make_appicons_bounce
, getBool
, NULL
, NULL
, NULL
},
430 {"DoubleClickTime", "250", (void *)&wPreferences
.dblclick_time
,
431 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
, NULL
, NULL
},
432 {"ClipAutoraiseDelay", "600", NULL
,
433 &wPreferences
.clip_auto_raise_delay
, getInt
, NULL
, NULL
, NULL
},
434 {"ClipAutolowerDelay", "1000", NULL
,
435 &wPreferences
.clip_auto_lower_delay
, getInt
, NULL
, NULL
, NULL
},
436 {"ClipAutoexpandDelay", "600", NULL
,
437 &wPreferences
.clip_auto_expand_delay
, getInt
, NULL
, NULL
, NULL
},
438 {"ClipAutocollapseDelay", "1000", NULL
,
439 &wPreferences
.clip_auto_collapse_delay
, getInt
, NULL
, NULL
, NULL
},
440 {"WrapAppiconsInDock", "YES", NULL
,
441 NULL
, getBool
, setWrapAppiconsInDock
, NULL
, NULL
},
442 {"AlignSubmenus", "NO", NULL
,
443 &wPreferences
.align_menus
, getBool
, NULL
, NULL
, NULL
},
444 {"ViKeyMenus", "NO", NULL
,
445 &wPreferences
.vi_key_menus
, getBool
, NULL
, NULL
, NULL
},
446 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
447 &wPreferences
.open_transients_with_parent
, getBool
, NULL
, NULL
, NULL
},
448 {"WindowPlacement", "auto", sePlacements
,
449 &wPreferences
.window_placement
, getEnum
, NULL
, NULL
, NULL
},
450 {"IgnoreFocusClick", "NO", NULL
,
451 &wPreferences
.ignore_focus_click
, getBool
, NULL
, NULL
, NULL
},
452 {"UseSaveUnders", "NO", NULL
,
453 &wPreferences
.use_saveunders
, getBool
, NULL
, NULL
, NULL
},
454 {"OpaqueMove", "YES", NULL
,
455 &wPreferences
.opaque_move
, getBool
, NULL
, NULL
, NULL
},
456 {"OpaqueResize", "NO", NULL
,
457 &wPreferences
.opaque_resize
, getBool
, NULL
, NULL
, NULL
},
458 {"OpaqueMoveResizeKeyboard", "NO", NULL
,
459 &wPreferences
.opaque_move_resize_keyboard
, getBool
, NULL
, NULL
, NULL
},
460 {"DisableAnimations", "NO", NULL
,
461 &wPreferences
.no_animations
, getBool
, NULL
, NULL
, NULL
},
462 {"DontLinkWorkspaces", "YES", NULL
,
463 &wPreferences
.no_autowrap
, getBool
, NULL
, NULL
, NULL
},
464 {"WindowSnapping", "NO", NULL
,
465 &wPreferences
.window_snapping
, getBool
, NULL
, NULL
, NULL
},
466 {"SnapEdgeDetect", "1", NULL
,
467 &wPreferences
.snap_edge_detect
, getInt
, NULL
, NULL
, NULL
},
468 {"SnapCornerDetect", "10", NULL
,
469 &wPreferences
.snap_corner_detect
, getInt
, NULL
, NULL
, NULL
},
470 {"SnapToTopMaximizesFullscreen", "NO", NULL
,
471 &wPreferences
.snap_to_top_maximizes_fullscreen
, getBool
, NULL
, NULL
, NULL
},
472 {"DragMaximizedWindow", "Move", seDragMaximizedWindow
,
473 &wPreferences
.drag_maximized_window
, getEnum
, NULL
, NULL
, NULL
},
474 {"MoveHalfMaximizedWindowsBetweenScreens", "NO", NULL
,
475 &wPreferences
.move_half_max_between_heads
, getBool
, NULL
, NULL
, NULL
},
476 {"AlternativeHalfMaximized", "NO", NULL
,
477 &wPreferences
.alt_half_maximize
, getBool
, NULL
, NULL
, NULL
},
478 {"PointerWithHalfMaxWindows", "NO", NULL
,
479 &wPreferences
.pointer_with_half_max_windows
, getBool
, NULL
, NULL
, NULL
},
480 {"HighlightActiveApp", "YES", NULL
,
481 &wPreferences
.highlight_active_app
, getBool
, NULL
, NULL
, NULL
},
482 {"AutoArrangeIcons", "NO", NULL
,
483 &wPreferences
.auto_arrange_icons
, getBool
, NULL
, NULL
, NULL
},
484 {"NoWindowOverDock", "NO", NULL
,
485 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
, NULL
, NULL
},
486 {"NoWindowOverIcons", "NO", NULL
,
487 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
, NULL
, NULL
},
488 {"WindowPlaceOrigin", "(64, 0)", NULL
,
489 &wPreferences
.window_place_origin
, getCoord
, NULL
, NULL
, NULL
},
490 {"ResizeDisplay", "center", seGeomDisplays
,
491 &wPreferences
.size_display
, getEnum
, NULL
, NULL
, NULL
},
492 {"MoveDisplay", "floating", seGeomDisplays
,
493 &wPreferences
.move_display
, getEnum
, NULL
, NULL
, NULL
},
494 {"DontConfirmKill", "NO", NULL
,
495 &wPreferences
.dont_confirm_kill
, getBool
, NULL
, NULL
, NULL
},
496 {"WindowTitleBalloons", "YES", NULL
,
497 &wPreferences
.window_balloon
, getBool
, NULL
, NULL
, NULL
},
498 {"MiniwindowTitleBalloons", "NO", NULL
,
499 &wPreferences
.miniwin_title_balloon
, getBool
, NULL
, NULL
, NULL
},
500 {"MiniwindowPreviewBalloons", "NO", NULL
,
501 &wPreferences
.miniwin_preview_balloon
, getBool
, NULL
, NULL
, NULL
},
502 {"AppIconBalloons", "NO", NULL
,
503 &wPreferences
.appicon_balloon
, getBool
, NULL
, NULL
, NULL
},
504 {"HelpBalloons", "NO", NULL
,
505 &wPreferences
.help_balloon
, getBool
, NULL
, NULL
, NULL
},
506 {"EdgeResistance", "30", NULL
,
507 &wPreferences
.edge_resistance
, getInt
, NULL
, NULL
, NULL
},
508 {"ResizeIncrement", "0", NULL
,
509 &wPreferences
.resize_increment
, getInt
, NULL
, NULL
, NULL
},
510 {"Attraction", "NO", NULL
,
511 &wPreferences
.attract
, getBool
, NULL
, NULL
, NULL
},
512 {"DisableBlinking", "NO", NULL
,
513 &wPreferences
.dont_blink
, getBool
, NULL
, NULL
, NULL
},
514 {"SingleClickLaunch", "NO", NULL
,
515 &wPreferences
.single_click
, getBool
, NULL
, NULL
, NULL
},
516 {"StrictWindozeCycle", "YES", NULL
,
517 &wPreferences
.strict_windoze_cycle
, getBool
, NULL
, NULL
, NULL
},
518 {"SwitchPanelOnlyOpen", "NO", NULL
,
519 &wPreferences
.panel_only_open
, getBool
, NULL
, NULL
, NULL
},
520 {"MiniPreviewSize", "128", NULL
,
521 &wPreferences
.minipreview_size
, getInt
, NULL
, NULL
, NULL
},
522 {"IgnoreGtkHints", "NO", NULL
,
523 &wPreferences
.ignore_gtk_decoration_hints
, getBool
, NULL
, NULL
, NULL
},
527 {"MenuStyle", "normal", seMenuStyles
,
528 &wPreferences
.menu_style
, getEnum
, setMenuStyle
, NULL
, NULL
},
529 {"WidgetColor", "(solid, gray)", NULL
,
530 NULL
, getTexture
, setWidgetColor
, NULL
, NULL
},
531 {"WorkspaceSpecificBack", "()", NULL
,
532 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
, NULL
, NULL
},
533 /* WorkspaceBack must come after WorkspaceSpecificBack or
534 * WorkspaceBack won't know WorkspaceSpecificBack was also
535 * specified and 2 copies of wmsetbg will be launched */
536 {"WorkspaceBack", "(solid, \"rgb:50/50/75\")", NULL
,
537 NULL
, getWSBackground
, setWorkspaceBack
, NULL
, NULL
},
538 {"SmoothWorkspaceBack", "NO", NULL
,
539 NULL
, getBool
, NULL
, NULL
, NULL
},
540 {"IconBack", "(dgradient, \"rgb:a6/a6/b6\", \"rgb:51/55/61\")", NULL
,
541 NULL
, getTexture
, setIconTile
, NULL
, NULL
},
542 {"TitleJustify", "center", seJustifications
,
543 &wPreferences
.title_justification
, getEnum
, setJustify
, NULL
, NULL
},
544 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
545 NULL
, getFont
, setWinTitleFont
, NULL
, NULL
},
546 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
547 &wPreferences
.window_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
548 {"WindowTitleMinHeight", "0", NULL
,
549 &wPreferences
.window_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
550 {"WindowTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
551 &wPreferences
.window_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
552 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
553 &wPreferences
.menu_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
554 {"MenuTitleMinHeight", "0", NULL
,
555 &wPreferences
.menu_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
556 {"MenuTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
557 &wPreferences
.menu_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
558 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
559 &wPreferences
.menu_text_clearance
, getInt
, setClearance
, NULL
, NULL
},
560 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
561 NULL
, getFont
, setMenuTitleFont
, NULL
, NULL
},
562 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
563 NULL
, getFont
, setMenuTextFont
, NULL
, NULL
},
564 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
565 NULL
, getFont
, setIconTitleFont
, NULL
, NULL
},
566 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
567 NULL
, getFont
, setClipTitleFont
, NULL
, NULL
},
568 {"ShowClipTitle", "YES", NULL
,
569 &wPreferences
.show_clip_title
, getBool
, NULL
, NULL
, NULL
},
570 {"LargeDisplayFont", DEF_WORKSPACE_NAME_FONT
, NULL
,
571 NULL
, getFont
, setLargeDisplayFont
, NULL
, NULL
},
572 {"HighlightColor", "white", NULL
,
573 NULL
, getColor
, setHightlight
, NULL
, NULL
},
574 {"HighlightTextColor", "black", NULL
,
575 NULL
, getColor
, setHightlightText
, NULL
, NULL
},
576 {"ClipTitleColor", "black", (void *)CLIP_NORMAL
,
577 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
578 {"CClipTitleColor", "\"rgb:61/61/61\"", (void *)CLIP_COLLAPSED
,
579 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
580 {"FTitleColor", "white", (void *)WS_FOCUSED
,
581 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
582 {"PTitleColor", "white", (void *)WS_PFOCUSED
,
583 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
584 {"UTitleColor", "black", (void *)WS_UNFOCUSED
,
585 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
586 {"FTitleBack", "(solid, black)", NULL
,
587 NULL
, getTexture
, setFTitleBack
, NULL
, NULL
},
588 {"PTitleBack", "(solid, gray40)", NULL
,
589 NULL
, getTexture
, setPTitleBack
, NULL
, NULL
},
590 {"UTitleBack", "(solid, \"rgb:aa/aa/aa\")", NULL
,
591 NULL
, getTexture
, setUTitleBack
, NULL
, NULL
},
592 {"ResizebarBack", "(solid, \"rgb:aa/aa/aa\")", NULL
,
593 NULL
, getTexture
, setResizebarBack
, NULL
, NULL
},
594 {"MenuTitleColor", "white", NULL
,
595 NULL
, getColor
, setMenuTitleColor
, NULL
, NULL
},
596 {"MenuTextColor", "black", NULL
,
597 NULL
, getColor
, setMenuTextColor
, NULL
, NULL
},
598 {"MenuDisabledColor", "gray50", NULL
,
599 NULL
, getColor
, setMenuDisabledColor
, NULL
, NULL
},
600 {"MenuTitleBack", "(solid, black)", NULL
,
601 NULL
, getTexture
, setMenuTitleBack
, NULL
, NULL
},
602 {"MenuTextBack", "(solid, \"rgb:aa/aa/aa\")", NULL
,
603 NULL
, getTexture
, setMenuTextBack
, NULL
, NULL
},
604 {"IconTitleColor", "white", NULL
,
605 NULL
, getColor
, setIconTitleColor
, NULL
, NULL
},
606 {"IconTitleBack", "black", NULL
,
607 NULL
, getColor
, setIconTitleBack
, NULL
, NULL
},
608 {"SwitchPanelImages", "(swtile.png, swback.png, 30, 40)", &wPreferences
,
609 NULL
, getPropList
, setSwPOptions
, NULL
, NULL
},
610 {"ModifierKeyLabels", "(\"Shift+\", \"Control+\", \"Mod1+\", \"Mod2+\", \"Mod3+\", \"Mod4+\", \"Mod5+\")", &wPreferences
,
611 NULL
, getPropList
, setModifierKeyLabels
, NULL
, NULL
},
612 {"FrameBorderWidth", "1", NULL
,
613 NULL
, getInt
, setFrameBorderWidth
, NULL
, NULL
},
614 {"FrameBorderColor", "black", NULL
,
615 NULL
, getColor
, setFrameBorderColor
, NULL
, NULL
},
616 {"FrameFocusedBorderColor", "black", NULL
,
617 NULL
, getColor
, setFrameFocusedBorderColor
, NULL
, NULL
},
618 {"FrameSelectedBorderColor", "white", NULL
,
619 NULL
, getColor
, setFrameSelectedBorderColor
, NULL
, NULL
},
620 {"WorkspaceMapBack", "(solid, black)", NULL
,
621 NULL
, getTexture
, setWorkspaceMapBackground
, NULL
, NULL
},
625 {"RootMenuKey", "F12", (void *)WKBD_ROOTMENU
,
626 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
627 {"WindowListKey", "F11", (void *)WKBD_WINDOWLIST
,
628 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
629 {"WindowMenuKey", "Control+Escape", (void *)WKBD_WINDOWMENU
,
630 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
631 {"DockRaiseLowerKey", "None", (void*)WKBD_DOCKRAISELOWER
,
632 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
633 {"ClipRaiseLowerKey", "None", (void *)WKBD_CLIPRAISELOWER
,
634 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
635 {"MiniaturizeKey", "Mod1+M", (void *)WKBD_MINIATURIZE
,
636 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
637 {"MinimizeAllKey", "None", (void *)WKBD_MINIMIZEALL
,
638 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
639 {"HideKey", "Mod1+H", (void *)WKBD_HIDE
,
640 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
641 {"HideOthersKey", "None", (void *)WKBD_HIDE_OTHERS
,
642 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
643 {"MoveResizeKey", "None", (void *)WKBD_MOVERESIZE
,
644 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
645 {"CloseKey", "None", (void *)WKBD_CLOSE
,
646 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
647 {"MaximizeKey", "None", (void *)WKBD_MAXIMIZE
,
648 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
649 {"VMaximizeKey", "None", (void *)WKBD_VMAXIMIZE
,
650 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
651 {"HMaximizeKey", "None", (void *)WKBD_HMAXIMIZE
,
652 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
653 {"LHMaximizeKey", "None", (void*)WKBD_LHMAXIMIZE
,
654 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
655 {"RHMaximizeKey", "None", (void*)WKBD_RHMAXIMIZE
,
656 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
657 {"THMaximizeKey", "None", (void*)WKBD_THMAXIMIZE
,
658 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
659 {"BHMaximizeKey", "None", (void*)WKBD_BHMAXIMIZE
,
660 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
661 {"LTCMaximizeKey", "None", (void*)WKBD_LTCMAXIMIZE
,
662 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
663 {"RTCMaximizeKey", "None", (void*)WKBD_RTCMAXIMIZE
,
664 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
665 {"LBCMaximizeKey", "None", (void*)WKBD_LBCMAXIMIZE
,
666 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
667 {"RBCMaximizeKey", "None", (void*)WKBD_RBCMAXIMIZE
,
668 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
669 {"MaximusKey", "None", (void*)WKBD_MAXIMUS
,
670 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
671 {"KeepOnTopKey", "None", (void *)WKBD_KEEP_ON_TOP
,
672 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
673 {"KeepAtBottomKey", "None", (void *)WKBD_KEEP_AT_BOTTOM
,
674 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
675 {"OmnipresentKey", "None", (void *)WKBD_OMNIPRESENT
,
676 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
677 {"RaiseKey", "Mod1+Up", (void *)WKBD_RAISE
,
678 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
679 {"LowerKey", "Mod1+Down", (void *)WKBD_LOWER
,
680 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
681 {"RaiseLowerKey", "None", (void *)WKBD_RAISELOWER
,
682 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
683 {"ShadeKey", "None", (void *)WKBD_SHADE
,
684 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
685 {"SelectKey", "None", (void *)WKBD_SELECT
,
686 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
687 {"WorkspaceMapKey", "None", (void *)WKBD_WORKSPACEMAP
,
688 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
689 {"FocusNextKey", "Mod1+Tab", (void *)WKBD_FOCUSNEXT
,
690 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
691 {"FocusPrevKey", "Mod1+Shift+Tab", (void *)WKBD_FOCUSPREV
,
692 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
693 {"GroupNextKey", "None", (void *)WKBD_GROUPNEXT
,
694 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
695 {"GroupPrevKey", "None", (void *)WKBD_GROUPPREV
,
696 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
697 {"NextWorkspaceKey", "Mod1+Control+Right", (void *)WKBD_NEXTWORKSPACE
,
698 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
699 {"PrevWorkspaceKey", "Mod1+Control+Left", (void *)WKBD_PREVWORKSPACE
,
700 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
701 {"LastWorkspaceKey", "None", (void *)WKBD_LASTWORKSPACE
,
702 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
703 {"NextWorkspaceLayerKey", "None", (void *)WKBD_NEXTWSLAYER
,
704 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
705 {"PrevWorkspaceLayerKey", "None", (void *)WKBD_PREVWSLAYER
,
706 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
707 {"Workspace1Key", "Mod1+1", (void *)WKBD_WORKSPACE1
,
708 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
709 {"Workspace2Key", "Mod1+2", (void *)WKBD_WORKSPACE2
,
710 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
711 {"Workspace3Key", "Mod1+3", (void *)WKBD_WORKSPACE3
,
712 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
713 {"Workspace4Key", "Mod1+4", (void *)WKBD_WORKSPACE4
,
714 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
715 {"Workspace5Key", "Mod1+5", (void *)WKBD_WORKSPACE5
,
716 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
717 {"Workspace6Key", "Mod1+6", (void *)WKBD_WORKSPACE6
,
718 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
719 {"Workspace7Key", "Mod1+7", (void *)WKBD_WORKSPACE7
,
720 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
721 {"Workspace8Key", "Mod1+8", (void *)WKBD_WORKSPACE8
,
722 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
723 {"Workspace9Key", "Mod1+9", (void *)WKBD_WORKSPACE9
,
724 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
725 {"Workspace10Key", "Mod1+0", (void *)WKBD_WORKSPACE10
,
726 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
727 {"MoveToWorkspace1Key", "None", (void *)WKBD_MOVE_WORKSPACE1
,
728 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
729 {"MoveToWorkspace2Key", "None", (void *)WKBD_MOVE_WORKSPACE2
,
730 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
731 {"MoveToWorkspace3Key", "None", (void *)WKBD_MOVE_WORKSPACE3
,
732 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
733 {"MoveToWorkspace4Key", "None", (void *)WKBD_MOVE_WORKSPACE4
,
734 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
735 {"MoveToWorkspace5Key", "None", (void *)WKBD_MOVE_WORKSPACE5
,
736 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
737 {"MoveToWorkspace6Key", "None", (void *)WKBD_MOVE_WORKSPACE6
,
738 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
739 {"MoveToWorkspace7Key", "None", (void *)WKBD_MOVE_WORKSPACE7
,
740 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
741 {"MoveToWorkspace8Key", "None", (void *)WKBD_MOVE_WORKSPACE8
,
742 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
743 {"MoveToWorkspace9Key", "None", (void *)WKBD_MOVE_WORKSPACE9
,
744 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
745 {"MoveToWorkspace10Key", "None", (void *)WKBD_MOVE_WORKSPACE10
,
746 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
747 {"MoveToNextWorkspaceKey", "None", (void *)WKBD_MOVE_NEXTWORKSPACE
,
748 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
749 {"MoveToPrevWorkspaceKey", "None", (void *)WKBD_MOVE_PREVWORKSPACE
,
750 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
751 {"MoveToLastWorkspaceKey", "None", (void *)WKBD_MOVE_LASTWORKSPACE
,
752 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
753 {"MoveToNextWorkspaceLayerKey", "None", (void *)WKBD_MOVE_NEXTWSLAYER
,
754 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
755 {"MoveToPrevWorkspaceLayerKey", "None", (void *)WKBD_MOVE_PREVWSLAYER
,
756 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
757 {"WindowShortcut1Key", "None", (void *)WKBD_WINDOW1
,
758 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
759 {"WindowShortcut2Key", "None", (void *)WKBD_WINDOW2
,
760 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
761 {"WindowShortcut3Key", "None", (void *)WKBD_WINDOW3
,
762 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
763 {"WindowShortcut4Key", "None", (void *)WKBD_WINDOW4
,
764 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
765 {"WindowShortcut5Key", "None", (void *)WKBD_WINDOW5
,
766 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
767 {"WindowShortcut6Key", "None", (void *)WKBD_WINDOW6
,
768 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
769 {"WindowShortcut7Key", "None", (void *)WKBD_WINDOW7
,
770 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
771 {"WindowShortcut8Key", "None", (void *)WKBD_WINDOW8
,
772 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
773 {"WindowShortcut9Key", "None", (void *)WKBD_WINDOW9
,
774 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
775 {"WindowShortcut10Key", "None", (void *)WKBD_WINDOW10
,
776 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
777 {"MoveTo12to6Head", "None", (void *)WKBD_MOVE_12_TO_6_HEAD
,
778 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
779 {"MoveTo6to12Head", "None", (void *)WKBD_MOVE_6_TO_12_HEAD
,
780 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
781 {"WindowRelaunchKey", "None", (void *)WKBD_RELAUNCH
,
782 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
783 {"ScreenSwitchKey", "None", (void *)WKBD_SWITCH_SCREEN
,
784 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
785 {"RunKey", "None", (void *)WKBD_RUN
,
786 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
788 #ifdef KEEP_XKB_LOCK_STATUS
789 {"ToggleKbdModeKey", "None", (void *)WKBD_TOGGLE
,
790 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
791 {"KbdModeLock", "NO", NULL
,
792 &wPreferences
.modelock
, getBool
, NULL
, NULL
, NULL
},
793 #endif /* KEEP_XKB_LOCK_STATUS */
795 {"NormalCursor", "(builtin, left_ptr)", (void *)WCUR_ROOT
,
796 NULL
, getCursor
, setCursor
, NULL
, NULL
},
797 {"ArrowCursor", "(builtin, top_left_arrow)", (void *)WCUR_ARROW
,
798 NULL
, getCursor
, setCursor
, NULL
, NULL
},
799 {"MoveCursor", "(builtin, fleur)", (void *)WCUR_MOVE
,
800 NULL
, getCursor
, setCursor
, NULL
, NULL
},
801 {"ResizeCursor", "(builtin, sizing)", (void *)WCUR_RESIZE
,
802 NULL
, getCursor
, setCursor
, NULL
, NULL
},
803 {"TopLeftResizeCursor", "(builtin, top_left_corner)", (void *)WCUR_TOPLEFTRESIZE
,
804 NULL
, getCursor
, setCursor
, NULL
, NULL
},
805 {"TopRightResizeCursor", "(builtin, top_right_corner)", (void *)WCUR_TOPRIGHTRESIZE
,
806 NULL
, getCursor
, setCursor
, NULL
, NULL
},
807 {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)", (void *)WCUR_BOTTOMLEFTRESIZE
,
808 NULL
, getCursor
, setCursor
, NULL
, NULL
},
809 {"BottomRightResizeCursor", "(builtin, bottom_right_corner)", (void *)WCUR_BOTTOMRIGHTRESIZE
,
810 NULL
, getCursor
, setCursor
, NULL
, NULL
},
811 {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)", (void *)WCUR_VERTICALRESIZE
,
812 NULL
, getCursor
, setCursor
, NULL
, NULL
},
813 {"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)", (void *)WCUR_HORIZONRESIZE
,
814 NULL
, getCursor
, setCursor
, NULL
, NULL
},
815 {"WaitCursor", "(builtin, watch)", (void *)WCUR_WAIT
,
816 NULL
, getCursor
, setCursor
, NULL
, NULL
},
817 {"QuestionCursor", "(builtin, question_arrow)", (void *)WCUR_QUESTION
,
818 NULL
, getCursor
, setCursor
, NULL
, NULL
},
819 {"TextCursor", "(builtin, xterm)", (void *)WCUR_TEXT
,
820 NULL
, getCursor
, setCursor
, NULL
, NULL
},
821 {"SelectCursor", "(builtin, cross)", (void *)WCUR_SELECT
,
822 NULL
, getCursor
, setCursor
, NULL
, NULL
},
823 {"DialogHistoryLines", "500", NULL
,
824 &wPreferences
.history_lines
, getInt
, NULL
, NULL
, NULL
},
825 {"CycleActiveHeadOnly", "NO", NULL
,
826 &wPreferences
.cycle_active_head_only
, getBool
, NULL
, NULL
, NULL
},
827 {"CycleIgnoreMinimized", "NO", NULL
,
828 &wPreferences
.cycle_ignore_minimized
, getBool
, NULL
, NULL
, NULL
}
831 static void initDefaults(void)
834 WDefaultEntry
*entry
;
836 WMPLSetCaseSensitive(False
);
838 for (i
= 0; i
< wlengthof(optionList
); i
++) {
839 entry
= &optionList
[i
];
841 entry
->plkey
= WMCreatePLString(entry
->key
);
842 if (entry
->default_value
)
843 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
845 entry
->plvalue
= NULL
;
848 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
849 entry
= &staticOptionList
[i
];
851 entry
->plkey
= WMCreatePLString(entry
->key
);
852 if (entry
->default_value
)
853 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
855 entry
->plvalue
= NULL
;
859 static WMPropList
*readGlobalDomain(const char *domainName
, Bool requireDictionary
)
861 WMPropList
*globalDict
= NULL
;
865 snprintf(path
, sizeof(path
), "%s/%s", DEFSDATADIR
, domainName
);
866 if (stat(path
, &stbuf
) >= 0) {
867 globalDict
= WMReadPropListFromFile(path
);
868 if (globalDict
&& requireDictionary
&& !WMIsPLDictionary(globalDict
)) {
869 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"), domainName
, path
);
870 WMReleasePropList(globalDict
);
872 } else if (!globalDict
) {
873 wwarning(_("could not load domain %s from global defaults database"), domainName
);
880 #if defined(GLOBAL_PREAMBLE_MENU_FILE) || defined(GLOBAL_EPILOGUE_MENU_FILE)
881 static void prependMenu(WMPropList
* destarr
, WMPropList
* array
)
886 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
887 item
= WMGetFromPLArray(array
, i
);
889 WMInsertInPLArray(destarr
, i
+ 1, item
);
893 static void appendMenu(WMPropList
* destarr
, WMPropList
* array
)
898 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
899 item
= WMGetFromPLArray(array
, i
);
901 WMAddToPLArray(destarr
, item
);
906 void wDefaultsMergeGlobalMenus(WDDomain
* menuDomain
)
908 WMPropList
*menu
= menuDomain
->dictionary
;
911 if (!menu
|| !WMIsPLArray(menu
))
914 #ifdef GLOBAL_PREAMBLE_MENU_FILE
915 submenu
= WMReadPropListFromFile(DEFSDATADIR
"/" GLOBAL_PREAMBLE_MENU_FILE
);
917 if (submenu
&& !WMIsPLArray(submenu
)) {
918 wwarning(_("invalid global menu file %s"), GLOBAL_PREAMBLE_MENU_FILE
);
919 WMReleasePropList(submenu
);
923 prependMenu(menu
, submenu
);
924 WMReleasePropList(submenu
);
928 #ifdef GLOBAL_EPILOGUE_MENU_FILE
929 submenu
= WMReadPropListFromFile(DEFSDATADIR
"/" GLOBAL_EPILOGUE_MENU_FILE
);
931 if (submenu
&& !WMIsPLArray(submenu
)) {
932 wwarning(_("invalid global menu file %s"), GLOBAL_EPILOGUE_MENU_FILE
);
933 WMReleasePropList(submenu
);
937 appendMenu(menu
, submenu
);
938 WMReleasePropList(submenu
);
942 menuDomain
->dictionary
= menu
;
945 WDDomain
*wDefaultsInitDomain(const char *domain
, Bool requireDictionary
)
949 static int inited
= 0;
950 WMPropList
*shared_dict
= NULL
;
957 db
= wmalloc(sizeof(WDDomain
));
958 db
->domain_name
= domain
;
959 db
->path
= wdefaultspathfordomain(domain
);
961 if (stat(db
->path
, &stbuf
) >= 0) {
962 db
->dictionary
= WMReadPropListFromFile(db
->path
);
963 if (db
->dictionary
) {
964 if (requireDictionary
&& !WMIsPLDictionary(db
->dictionary
)) {
965 WMReleasePropList(db
->dictionary
);
966 db
->dictionary
= NULL
;
967 wwarning(_("Domain %s (%s) of defaults database is corrupted!"), domain
, db
->path
);
969 db
->timestamp
= stbuf
.st_mtime
;
971 wwarning(_("could not load domain %s from user defaults database"), domain
);
975 /* global system dictionary */
976 shared_dict
= readGlobalDomain(domain
, requireDictionary
);
978 if (shared_dict
&& db
->dictionary
&& WMIsPLDictionary(shared_dict
) &&
979 WMIsPLDictionary(db
->dictionary
)) {
980 WMMergePLDictionaries(shared_dict
, db
->dictionary
, True
);
981 WMReleasePropList(db
->dictionary
);
982 db
->dictionary
= shared_dict
;
983 if (stbuf
.st_mtime
> db
->timestamp
)
984 db
->timestamp
= stbuf
.st_mtime
;
985 } else if (!db
->dictionary
) {
986 db
->dictionary
= shared_dict
;
987 if (stbuf
.st_mtime
> db
->timestamp
)
988 db
->timestamp
= stbuf
.st_mtime
;
994 void wReadStaticDefaults(WMPropList
* dict
)
997 WDefaultEntry
*entry
;
1001 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
1002 entry
= &staticOptionList
[i
];
1005 plvalue
= WMGetFromPLDictionary(dict
, entry
->plkey
);
1009 /* no default in the DB. Use builtin default */
1011 plvalue
= entry
->plvalue
;
1015 (*entry
->convert
) (NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
1017 (*entry
->update
) (NULL
, entry
, tdata
, entry
->extra_data
);
1022 void wDefaultsCheckDomains(void* arg
)
1026 WMPropList
*shared_dict
= NULL
;
1030 /* Parameter not used, but tell the compiler that it is ok */
1033 if (stat(w_global
.domain
.wmaker
->path
, &stbuf
) >= 0 && w_global
.domain
.wmaker
->timestamp
< stbuf
.st_mtime
) {
1034 w_global
.domain
.wmaker
->timestamp
= stbuf
.st_mtime
;
1036 /* Global dictionary */
1037 shared_dict
= readGlobalDomain("WindowMaker", True
);
1039 /* User dictionary */
1040 dict
= WMReadPropListFromFile(w_global
.domain
.wmaker
->path
);
1043 if (!WMIsPLDictionary(dict
)) {
1044 WMReleasePropList(dict
);
1046 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1047 "WindowMaker", w_global
.domain
.wmaker
->path
);
1050 WMMergePLDictionaries(shared_dict
, dict
, True
);
1051 WMReleasePropList(dict
);
1056 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1057 scr
= wScreenWithNumber(i
);
1059 wReadDefaults(scr
, dict
);
1062 if (w_global
.domain
.wmaker
->dictionary
)
1063 WMReleasePropList(w_global
.domain
.wmaker
->dictionary
);
1065 w_global
.domain
.wmaker
->dictionary
= dict
;
1068 wwarning(_("could not load domain %s from user defaults database"), "WindowMaker");
1072 WMReleasePropList(shared_dict
);
1076 if (stat(w_global
.domain
.window_attr
->path
, &stbuf
) >= 0 && w_global
.domain
.window_attr
->timestamp
< stbuf
.st_mtime
) {
1077 /* global dictionary */
1078 shared_dict
= readGlobalDomain("WMWindowAttributes", True
);
1079 /* user dictionary */
1080 dict
= WMReadPropListFromFile(w_global
.domain
.window_attr
->path
);
1082 if (!WMIsPLDictionary(dict
)) {
1083 WMReleasePropList(dict
);
1085 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1086 "WMWindowAttributes", w_global
.domain
.window_attr
->path
);
1089 WMMergePLDictionaries(shared_dict
, dict
, True
);
1090 WMReleasePropList(dict
);
1095 if (w_global
.domain
.window_attr
->dictionary
)
1096 WMReleasePropList(w_global
.domain
.window_attr
->dictionary
);
1098 w_global
.domain
.window_attr
->dictionary
= dict
;
1099 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1100 scr
= wScreenWithNumber(i
);
1102 wDefaultUpdateIcons(scr
);
1104 /* Update the panel image if changed */
1105 /* Don't worry. If the image is the same these
1106 * functions will have no performance impact. */
1107 create_logo_image(scr
);
1112 wwarning(_("could not load domain %s from user defaults database"), "WMWindowAttributes");
1115 w_global
.domain
.window_attr
->timestamp
= stbuf
.st_mtime
;
1117 WMReleasePropList(shared_dict
);
1120 if (stat(w_global
.domain
.root_menu
->path
, &stbuf
) >= 0 && w_global
.domain
.root_menu
->timestamp
< stbuf
.st_mtime
) {
1121 dict
= WMReadPropListFromFile(w_global
.domain
.root_menu
->path
);
1123 if (!WMIsPLArray(dict
) && !WMIsPLString(dict
)) {
1124 WMReleasePropList(dict
);
1126 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1127 "WMRootMenu", w_global
.domain
.root_menu
->path
);
1129 if (w_global
.domain
.root_menu
->dictionary
)
1130 WMReleasePropList(w_global
.domain
.root_menu
->dictionary
);
1132 w_global
.domain
.root_menu
->dictionary
= dict
;
1133 wDefaultsMergeGlobalMenus(w_global
.domain
.root_menu
);
1136 wwarning(_("could not load domain %s from user defaults database"), "WMRootMenu");
1138 w_global
.domain
.root_menu
->timestamp
= stbuf
.st_mtime
;
1140 #ifndef HAVE_INOTIFY
1142 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, arg
);
1146 void wReadDefaults(WScreen
* scr
, WMPropList
* new_dict
)
1148 WMPropList
*plvalue
, *old_value
;
1149 WDefaultEntry
*entry
;
1151 int update_workspace_back
= 0; /* kluge :/ */
1152 unsigned int needs_refresh
;
1154 WMPropList
*old_dict
= (w_global
.domain
.wmaker
->dictionary
!= new_dict
? w_global
.domain
.wmaker
->dictionary
: NULL
);
1158 for (i
= 0; i
< wlengthof(optionList
); i
++) {
1159 entry
= &optionList
[i
];
1162 plvalue
= WMGetFromPLDictionary(new_dict
, entry
->plkey
);
1169 old_value
= WMGetFromPLDictionary(old_dict
, entry
->plkey
);
1171 if (!plvalue
&& !old_value
) {
1172 /* no default in the DB. Use builtin default */
1173 plvalue
= entry
->plvalue
;
1174 if (plvalue
&& new_dict
)
1175 WMPutInPLDictionary(new_dict
, entry
->plkey
, plvalue
);
1177 } else if (!plvalue
) {
1178 /* value was deleted from DB. Keep current value */
1180 } else if (!old_value
) {
1181 /* set value for the 1st time */
1182 } else if (!WMIsPropListEqualTo(plvalue
, old_value
)) {
1183 /* value has changed */
1185 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1186 && update_workspace_back
&& scr
->flags
.backimage_helper_launched
) {
1188 /* value was not changed since last time */
1195 if ((*entry
->convert
) (scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1197 * If the WorkspaceSpecificBack data has been changed
1198 * so that the helper will be launched now, we must be
1199 * sure to send the default background texture config
1202 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0 &&
1203 !scr
->flags
.backimage_helper_launched
)
1204 update_workspace_back
= 1;
1207 needs_refresh
|= (*entry
->update
) (scr
, entry
, tdata
, entry
->extra_data
);
1213 if (needs_refresh
!= 0 && !scr
->flags
.startup
) {
1217 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1218 foo
|= WTextureSettings
;
1219 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1220 foo
|= WFontSettings
;
1221 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1222 foo
|= WColorSettings
;
1224 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1225 (void *)(uintptr_t) foo
);
1228 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1229 foo
|= WTextureSettings
;
1230 if (needs_refresh
& REFRESH_MENU_FONT
)
1231 foo
|= WFontSettings
;
1232 if (needs_refresh
& REFRESH_MENU_COLOR
)
1233 foo
|= WColorSettings
;
1235 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1238 if (needs_refresh
& REFRESH_WINDOW_FONT
)
1239 foo
|= WFontSettings
;
1240 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
)
1241 foo
|= WTextureSettings
;
1242 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
)
1243 foo
|= WColorSettings
;
1245 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1247 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1249 if (needs_refresh
& REFRESH_ICON_FONT
)
1250 foo
|= WFontSettings
;
1251 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
)
1252 foo
|= WTextureSettings
;
1253 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
)
1254 foo
|= WTextureSettings
;
1256 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1257 (void *)(uintptr_t) foo
);
1259 if (needs_refresh
& REFRESH_ICON_TILE
)
1260 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1262 if (needs_refresh
& REFRESH_WORKSPACE_MENU
) {
1263 if (scr
->workspace_menu
)
1264 wWorkspaceMenuUpdate(scr
, scr
->workspace_menu
);
1265 if (scr
->clip_ws_menu
)
1266 wWorkspaceMenuUpdate(scr
, scr
->clip_ws_menu
);
1267 if (scr
->workspace_submenu
)
1268 scr
->workspace_submenu
->flags
.realized
= 0;
1269 if (scr
->clip_submenu
)
1270 scr
->clip_submenu
->flags
.realized
= 0;
1275 void wDefaultUpdateIcons(WScreen
*scr
)
1277 WAppIcon
*aicon
= scr
->app_icon_list
;
1279 WWindow
*wwin
= scr
->focused_window
;
1282 /* Get the application icon, default included */
1283 wIconChangeImageFile(aicon
->icon
, NULL
);
1284 wAppIconPaint(aicon
);
1285 aicon
= aicon
->next
;
1288 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
)
1289 wClipIconPaint(scr
->clip_icon
);
1291 for (dc
= scr
->drawers
; dc
!= NULL
; dc
= dc
->next
)
1292 wDrawerIconPaint(dc
->adrawer
->icon_array
[0]);
1295 if (wwin
->icon
&& wwin
->flags
.miniaturized
)
1296 wIconChangeImageFile(wwin
->icon
, NULL
);
1301 /* --------------------------- Local ----------------------- */
1303 #define GET_STRING_OR_DEFAULT(x, var) if (!WMIsPLString(value)) { \
1304 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1306 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1307 var = entry->default_value;\
1308 } else var = WMGetFromPLString(value)\
1311 static int string2index(WMPropList *key, WMPropList *val, const char *def, WOptionEnumeration * values)
1314 WOptionEnumeration
*v
;
1315 char buffer
[TOTAL_VALUES_LENGTH
];
1317 if (WMIsPLString(val
) && (str
= WMGetFromPLString(val
))) {
1318 for (v
= values
; v
->string
!= NULL
; v
++) {
1319 if (strcasecmp(v
->string
, str
) == 0)
1325 for (v
= values
; v
->string
!= NULL
; v
++) {
1328 strcat(buffer
, ", ");
1329 snprintf(buffer
+strlen(buffer
),
1330 sizeof(buffer
)-strlen(buffer
)-1, "\"%s\"", v
->string
);
1333 wwarning(_("wrong option value for key \"%s\"; got \"%s\", should be one of %s."),
1334 WMGetFromPLString(key
),
1335 WMIsPLString(val
) ? WMGetFromPLString(val
) : "(unknown)",
1339 return string2index(key
, val
, NULL
, values
);
1346 * value - is the value in the defaults DB
1347 * addr - is the address to store the data
1348 * ret - is the address to store a pointer to a temporary buffer. ret
1349 * must not be freed and is used by the set functions
1351 static int getBool(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1355 int second_pass
= 0;
1357 /* Parameter not used, but tell the compiler that it is ok */
1360 GET_STRING_OR_DEFAULT("Boolean", val
);
1363 if ((val
[1] == '\0' && (val
[0] == 'y' || val
[0] == 'Y'))
1364 || strcasecmp(val
, "YES") == 0) {
1367 } else if ((val
[1] == '\0' && (val
[0] == 'n' || val
[0] == 'N'))
1368 || strcasecmp(val
, "NO") == 0) {
1372 if (sscanf(val
, "%i", &i
) == 1) {
1378 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""), val
, entry
->key
);
1379 if (second_pass
== 0) {
1380 val
= WMGetFromPLString(entry
->plvalue
);
1382 wwarning(_("using default \"%s\" instead"), val
);
1392 *(char *)addr
= data
;
1397 static int getInt(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1402 /* Parameter not used, but tell the compiler that it is ok */
1405 GET_STRING_OR_DEFAULT("Integer", val
);
1407 if (sscanf(val
, "%i", &data
) != 1) {
1408 wwarning(_("can't convert \"%s\" to integer for key \"%s\""), val
, entry
->key
);
1409 val
= WMGetFromPLString(entry
->plvalue
);
1410 wwarning(_("using default \"%s\" instead"), val
);
1411 if (sscanf(val
, "%i", &data
) != 1) {
1419 *(int *)addr
= data
;
1424 static int getCoord(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1427 char *val_x
, *val_y
;
1428 int nelem
, changed
= 0;
1429 WMPropList
*elem_x
, *elem_y
;
1432 if (!WMIsPLArray(value
)) {
1433 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Coordinate");
1435 value
= entry
->plvalue
;
1437 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1443 nelem
= WMGetPropListItemCount(value
);
1445 wwarning(_("Incorrect number of elements in array for key \"%s\"."), entry
->key
);
1447 value
= entry
->plvalue
;
1449 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1455 elem_x
= WMGetFromPLArray(value
, 0);
1456 elem_y
= WMGetFromPLArray(value
, 1);
1458 if (!elem_x
|| !elem_y
|| !WMIsPLString(elem_x
) || !WMIsPLString(elem_y
)) {
1459 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."), entry
->key
);
1461 value
= entry
->plvalue
;
1463 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1469 val_x
= WMGetFromPLString(elem_x
);
1470 val_y
= WMGetFromPLString(elem_y
);
1472 if (sscanf(val_x
, "%i", &data
.x
) != 1 || sscanf(val_y
, "%i", &data
.y
) != 1) {
1473 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1475 value
= entry
->plvalue
;
1477 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1485 else if (data
.x
> scr
->scr_width
/ 3)
1486 data
.x
= scr
->scr_width
/ 3;
1489 else if (data
.y
> scr
->scr_height
/ 3)
1490 data
.y
= scr
->scr_height
/ 3;
1495 *(WCoord
*) addr
= data
;
1500 static int getPropList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1502 /* Parameter not used, but tell the compiler that it is ok */
1507 WMRetainPropList(value
);
1514 static int getPathList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1522 /* Parameter not used, but tell the compiler that it is ok */
1527 if (!WMIsPLArray(value
)) {
1528 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "an array of paths");
1530 value
= entry
->plvalue
;
1532 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1539 count
= WMGetPropListItemCount(value
);
1542 value
= entry
->plvalue
;
1544 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1551 for (i
= 0; i
< count
; i
++) {
1552 d
= WMGetFromPLArray(value
, i
);
1553 if (!d
|| !WMIsPLString(d
)) {
1557 len
+= strlen(WMGetFromPLString(d
)) + 1;
1560 ptr
= data
= wmalloc(len
+ 1);
1562 for (i
= 0; i
< count
; i
++) {
1563 d
= WMGetFromPLArray(value
, i
);
1564 if (!d
|| !WMIsPLString(d
)) {
1567 strcpy(ptr
, WMGetFromPLString(d
));
1568 ptr
+= strlen(WMGetFromPLString(d
));
1575 if (*(char **)addr
!= NULL
) {
1576 wfree(*(char **)addr
);
1578 *(char **)addr
= data
;
1583 static int getEnum(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1585 static signed char data
;
1587 /* Parameter not used, but tell the compiler that it is ok */
1590 data
= string2index(entry
->plkey
, value
, entry
->default_value
, (WOptionEnumeration
*) entry
->extra_data
);
1597 *(signed char *)addr
= data
;
1604 * (hgradient <color> <color>)
1605 * (vgradient <color> <color>)
1606 * (dgradient <color> <color>)
1607 * (mhgradient <color> <color> ...)
1608 * (mvgradient <color> <color> ...)
1609 * (mdgradient <color> <color> ...)
1610 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1611 * (tpixmap <file> <color>)
1612 * (spixmap <file> <color>)
1613 * (cpixmap <file> <color>)
1614 * (thgradient <file> <opaqueness> <color> <color>)
1615 * (tvgradient <file> <opaqueness> <color> <color>)
1616 * (tdgradient <file> <opaqueness> <color> <color>)
1617 * (function <lib> <function> ...)
1620 static WTexture
*parse_texture(WScreen
* scr
, WMPropList
* pl
)
1625 WTexture
*texture
= NULL
;
1627 nelem
= WMGetPropListItemCount(pl
);
1631 elem
= WMGetFromPLArray(pl
, 0);
1632 if (!elem
|| !WMIsPLString(elem
))
1634 val
= WMGetFromPLString(elem
);
1636 if (strcasecmp(val
, "solid") == 0) {
1644 elem
= WMGetFromPLArray(pl
, 1);
1645 if (!elem
|| !WMIsPLString(elem
))
1647 val
= WMGetFromPLString(elem
);
1649 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1650 wwarning(_("\"%s\" is not a valid color name"), val
);
1654 texture
= (WTexture
*) wTextureMakeSolid(scr
, &color
);
1655 } else if (strcasecmp(val
, "dgradient") == 0
1656 || strcasecmp(val
, "vgradient") == 0 || strcasecmp(val
, "hgradient") == 0) {
1657 RColor color1
, color2
;
1662 wwarning(_("bad number of arguments in gradient specification"));
1666 if (val
[0] == 'd' || val
[0] == 'D')
1667 type
= WTEX_DGRADIENT
;
1668 else if (val
[0] == 'h' || val
[0] == 'H')
1669 type
= WTEX_HGRADIENT
;
1671 type
= WTEX_VGRADIENT
;
1673 /* get from color */
1674 elem
= WMGetFromPLArray(pl
, 1);
1675 if (!elem
|| !WMIsPLString(elem
))
1677 val
= WMGetFromPLString(elem
);
1679 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1680 wwarning(_("\"%s\" is not a valid color name"), val
);
1684 color1
.red
= xcolor
.red
>> 8;
1685 color1
.green
= xcolor
.green
>> 8;
1686 color1
.blue
= xcolor
.blue
>> 8;
1689 elem
= WMGetFromPLArray(pl
, 2);
1690 if (!elem
|| !WMIsPLString(elem
)) {
1693 val
= WMGetFromPLString(elem
);
1695 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1696 wwarning(_("\"%s\" is not a valid color name"), val
);
1700 color2
.red
= xcolor
.red
>> 8;
1701 color2
.green
= xcolor
.green
>> 8;
1702 color2
.blue
= xcolor
.blue
>> 8;
1704 texture
= (WTexture
*) wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1706 } else if (strcasecmp(val
, "igradient") == 0) {
1707 RColor colors1
[2], colors2
[2];
1713 wwarning(_("bad number of arguments in gradient specification"));
1717 /* get from color */
1718 for (i
= 0; i
< 2; i
++) {
1719 elem
= WMGetFromPLArray(pl
, 1 + i
);
1720 if (!elem
|| !WMIsPLString(elem
))
1722 val
= WMGetFromPLString(elem
);
1724 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1725 wwarning(_("\"%s\" is not a valid color name"), val
);
1728 colors1
[i
].alpha
= 255;
1729 colors1
[i
].red
= xcolor
.red
>> 8;
1730 colors1
[i
].green
= xcolor
.green
>> 8;
1731 colors1
[i
].blue
= xcolor
.blue
>> 8;
1733 elem
= WMGetFromPLArray(pl
, 3);
1734 if (!elem
|| !WMIsPLString(elem
))
1736 val
= WMGetFromPLString(elem
);
1739 /* get from color */
1740 for (i
= 0; i
< 2; i
++) {
1741 elem
= WMGetFromPLArray(pl
, 4 + i
);
1742 if (!elem
|| !WMIsPLString(elem
))
1744 val
= WMGetFromPLString(elem
);
1746 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1747 wwarning(_("\"%s\" is not a valid color name"), val
);
1750 colors2
[i
].alpha
= 255;
1751 colors2
[i
].red
= xcolor
.red
>> 8;
1752 colors2
[i
].green
= xcolor
.green
>> 8;
1753 colors2
[i
].blue
= xcolor
.blue
>> 8;
1755 elem
= WMGetFromPLArray(pl
, 6);
1756 if (!elem
|| !WMIsPLString(elem
))
1758 val
= WMGetFromPLString(elem
);
1761 texture
= (WTexture
*) wTextureMakeIGradient(scr
, th1
, colors1
, th2
, colors2
);
1763 } else if (strcasecmp(val
, "mhgradient") == 0
1764 || strcasecmp(val
, "mvgradient") == 0 || strcasecmp(val
, "mdgradient") == 0) {
1771 wwarning(_("too few arguments in multicolor gradient specification"));
1775 if (val
[1] == 'h' || val
[1] == 'H')
1776 type
= WTEX_MHGRADIENT
;
1777 else if (val
[1] == 'v' || val
[1] == 'V')
1778 type
= WTEX_MVGRADIENT
;
1780 type
= WTEX_MDGRADIENT
;
1784 colors
= wmalloc(sizeof(RColor
*) * (count
+ 1));
1786 for (i
= 0; i
< count
; i
++) {
1787 elem
= WMGetFromPLArray(pl
, i
+ 1);
1788 if (!elem
|| !WMIsPLString(elem
)) {
1789 for (--i
; i
>= 0; --i
) {
1795 val
= WMGetFromPLString(elem
);
1797 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1798 wwarning(_("\"%s\" is not a valid color name"), val
);
1799 for (--i
; i
>= 0; --i
) {
1805 colors
[i
] = wmalloc(sizeof(RColor
));
1806 colors
[i
]->red
= color
.red
>> 8;
1807 colors
[i
]->green
= color
.green
>> 8;
1808 colors
[i
]->blue
= color
.blue
>> 8;
1813 texture
= (WTexture
*) wTextureMakeMGradient(scr
, type
, colors
);
1814 } else if (strcasecmp(val
, "spixmap") == 0 ||
1815 strcasecmp(val
, "cpixmap") == 0 || strcasecmp(val
, "tpixmap") == 0) {
1822 if (val
[0] == 's' || val
[0] == 'S')
1824 else if (val
[0] == 'c' || val
[0] == 'C')
1830 elem
= WMGetFromPLArray(pl
, 2);
1831 if (!elem
|| !WMIsPLString(elem
)) {
1834 val
= WMGetFromPLString(elem
);
1836 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1837 wwarning(_("\"%s\" is not a valid color name"), val
);
1842 elem
= WMGetFromPLArray(pl
, 1);
1843 if (!elem
|| !WMIsPLString(elem
))
1845 val
= WMGetFromPLString(elem
);
1847 texture
= (WTexture
*) wTextureMakePixmap(scr
, type
, val
, &color
);
1848 } else if (strcasecmp(val
, "thgradient") == 0
1849 || strcasecmp(val
, "tvgradient") == 0 || strcasecmp(val
, "tdgradient") == 0) {
1850 RColor color1
, color2
;
1855 if (val
[1] == 'h' || val
[1] == 'H')
1856 style
= WTEX_THGRADIENT
;
1857 else if (val
[1] == 'v' || val
[1] == 'V')
1858 style
= WTEX_TVGRADIENT
;
1860 style
= WTEX_TDGRADIENT
;
1863 wwarning(_("bad number of arguments in textured gradient specification"));
1867 /* get from color */
1868 elem
= WMGetFromPLArray(pl
, 3);
1869 if (!elem
|| !WMIsPLString(elem
))
1871 val
= WMGetFromPLString(elem
);
1873 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1874 wwarning(_("\"%s\" is not a valid color name"), val
);
1878 color1
.red
= xcolor
.red
>> 8;
1879 color1
.green
= xcolor
.green
>> 8;
1880 color1
.blue
= xcolor
.blue
>> 8;
1883 elem
= WMGetFromPLArray(pl
, 4);
1884 if (!elem
|| !WMIsPLString(elem
)) {
1887 val
= WMGetFromPLString(elem
);
1889 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1890 wwarning(_("\"%s\" is not a valid color name"), val
);
1894 color2
.red
= xcolor
.red
>> 8;
1895 color2
.green
= xcolor
.green
>> 8;
1896 color2
.blue
= xcolor
.blue
>> 8;
1899 elem
= WMGetFromPLArray(pl
, 2);
1900 if (!elem
|| !WMIsPLString(elem
))
1903 val
= WMGetFromPLString(elem
);
1905 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
1906 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
1911 elem
= WMGetFromPLArray(pl
, 1);
1912 if (!elem
|| !WMIsPLString(elem
))
1914 val
= WMGetFromPLString(elem
);
1916 texture
= (WTexture
*) wTextureMakeTGradient(scr
, style
, &color1
, &color2
, val
, opacity
);
1917 } else if (strcasecmp(val
, "function") == 0) {
1918 /* Leave this in to handle the unlikely case of
1919 * someone actually having function textures configured */
1920 wwarning("function texture support has been removed");
1923 wwarning(_("invalid texture type %s"), val
);
1929 static int getTexture(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1931 static WTexture
*texture
;
1935 if (!WMIsPLArray(value
)) {
1936 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Texture");
1938 value
= entry
->plvalue
;
1940 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1946 if (strcmp(entry
->key
, "WidgetColor") == 0 && !changed
) {
1949 pl
= WMGetFromPLArray(value
, 0);
1950 if (!pl
|| !WMIsPLString(pl
) || !WMGetFromPLString(pl
)
1951 || strcasecmp(WMGetFromPLString(pl
), "solid") != 0) {
1952 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1953 entry
->key
, "Solid Texture");
1955 value
= entry
->plvalue
;
1957 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1962 texture
= parse_texture(scr
, value
);
1965 wwarning(_("Error in texture specification for key \"%s\""), entry
->key
);
1967 value
= entry
->plvalue
;
1969 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1979 *(WTexture
**) addr
= texture
;
1984 static int getWSBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1991 /* Parameter not used, but tell the compiler that it is ok */
1996 if (!WMIsPLArray(value
)) {
1997 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1998 "WorkspaceBack", "Texture or None");
2000 value
= entry
->plvalue
;
2002 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2008 /* only do basic error checking and verify for None texture */
2010 nelem
= WMGetPropListItemCount(value
);
2012 elem
= WMGetFromPLArray(value
, 0);
2013 if (!elem
|| !WMIsPLString(elem
)) {
2014 wwarning(_("Wrong type for workspace background. Should be a texture type."));
2016 value
= entry
->plvalue
;
2018 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2023 val
= WMGetFromPLString(elem
);
2025 if (strcasecmp(val
, "None") == 0)
2028 *ret
= WMRetainPropList(value
);
2034 getWSSpecificBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2040 /* Parameter not used, but tell the compiler that it is ok */
2045 if (!WMIsPLArray(value
)) {
2046 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2047 "WorkspaceSpecificBack", "an array of textures");
2049 value
= entry
->plvalue
;
2051 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2057 /* only do basic error checking and verify for None texture */
2059 nelem
= WMGetPropListItemCount(value
);
2062 elem
= WMGetFromPLArray(value
, nelem
);
2063 if (!elem
|| !WMIsPLArray(elem
)) {
2064 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2070 *ret
= WMRetainPropList(value
);
2074 * Kluge to force wmsetbg helper to set the default background.
2075 * If the WorkspaceSpecificBack is changed once wmaker has started,
2076 * the WorkspaceBack won't be sent to the helper, unless the user
2077 * changes it's value too. So, we must force this by removing the
2078 * value from the defaults DB.
2080 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2081 WMPropList
*key
= WMCreatePLString("WorkspaceBack");
2083 WMRemoveFromPLDictionary(w_global
.domain
.wmaker
->dictionary
, key
);
2085 WMReleasePropList(key
);
2091 static int getFont(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2093 static WMFont
*font
;
2098 GET_STRING_OR_DEFAULT("Font", val
);
2100 font
= WMCreateFont(scr
->wmscreen
, val
);
2102 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2105 wfatal(_("could not load any usable font!!!"));
2112 /* can't assign font value outside update function */
2113 wassertrv(addr
== NULL
, True
);
2118 static int getColor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2120 static XColor color
;
2122 int second_pass
= 0;
2126 GET_STRING_OR_DEFAULT("Color", val
);
2129 if (!wGetColor(scr
, val
, &color
)) {
2130 wwarning(_("could not get color for key \"%s\""), entry
->key
);
2131 if (second_pass
== 0) {
2132 val
= WMGetFromPLString(entry
->plvalue
);
2134 wwarning(_("using default \"%s\" instead"), val
);
2143 assert(addr
== NULL
);
2146 *(unsigned long*)addr = pixel;
2152 static int getKeybind(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2154 static WShortKey shortcut
;
2158 char buf
[MAX_SHORTCUT_LENGTH
], *b
;
2160 /* Parameter not used, but tell the compiler that it is ok */
2164 GET_STRING_OR_DEFAULT("Key spec", val
);
2166 if (!val
|| strcasecmp(val
, "NONE") == 0) {
2167 shortcut
.keycode
= 0;
2168 shortcut
.modifier
= 0;
2174 wstrlcpy(buf
, val
, MAX_SHORTCUT_LENGTH
);
2179 shortcut
.modifier
= 0;
2180 while ((k
= strchr(b
, '+')) != NULL
) {
2184 mod
= wXModifierFromKey(b
);
2186 wwarning(_("%s: invalid key modifier \"%s\""), entry
->key
, b
);
2189 shortcut
.modifier
|= mod
;
2195 ksym
= XStringToKeysym(b
);
2197 if (ksym
== NoSymbol
) {
2198 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
, val
);
2202 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2203 if (shortcut
.keycode
== 0) {
2204 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2214 static int getModMask(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2219 /* Parameter not used, but tell the compiler that it is ok */
2222 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2227 mask
= wXModifierFromKey(str
);
2229 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2235 *(int *)addr
= mask
;
2243 # include <X11/cursorfont.h>
2249 #define CURSOR_ID_NONE (XC_num_glyphs)
2251 static const WCursorLookup cursor_table
[] = {
2252 {"X_cursor", XC_X_cursor
},
2253 {"arrow", XC_arrow
},
2254 {"based_arrow_down", XC_based_arrow_down
},
2255 {"based_arrow_up", XC_based_arrow_up
},
2257 {"bogosity", XC_bogosity
},
2258 {"bottom_left_corner", XC_bottom_left_corner
},
2259 {"bottom_right_corner", XC_bottom_right_corner
},
2260 {"bottom_side", XC_bottom_side
},
2261 {"bottom_tee", XC_bottom_tee
},
2262 {"box_spiral", XC_box_spiral
},
2263 {"center_ptr", XC_center_ptr
},
2264 {"circle", XC_circle
},
2265 {"clock", XC_clock
},
2266 {"coffee_mug", XC_coffee_mug
},
2267 {"cross", XC_cross
},
2268 {"cross_reverse", XC_cross_reverse
},
2269 {"crosshair", XC_crosshair
},
2270 {"diamond_cross", XC_diamond_cross
},
2272 {"dotbox", XC_dotbox
},
2273 {"double_arrow", XC_double_arrow
},
2274 {"draft_large", XC_draft_large
},
2275 {"draft_small", XC_draft_small
},
2276 {"draped_box", XC_draped_box
},
2277 {"exchange", XC_exchange
},
2278 {"fleur", XC_fleur
},
2279 {"gobbler", XC_gobbler
},
2280 {"gumby", XC_gumby
},
2281 {"hand1", XC_hand1
},
2282 {"hand2", XC_hand2
},
2283 {"heart", XC_heart
},
2285 {"iron_cross", XC_iron_cross
},
2286 {"left_ptr", XC_left_ptr
},
2287 {"left_side", XC_left_side
},
2288 {"left_tee", XC_left_tee
},
2289 {"leftbutton", XC_leftbutton
},
2290 {"ll_angle", XC_ll_angle
},
2291 {"lr_angle", XC_lr_angle
},
2293 {"middlebutton", XC_middlebutton
},
2294 {"mouse", XC_mouse
},
2295 {"pencil", XC_pencil
},
2296 {"pirate", XC_pirate
},
2298 {"question_arrow", XC_question_arrow
},
2299 {"right_ptr", XC_right_ptr
},
2300 {"right_side", XC_right_side
},
2301 {"right_tee", XC_right_tee
},
2302 {"rightbutton", XC_rightbutton
},
2303 {"rtl_logo", XC_rtl_logo
},
2304 {"sailboat", XC_sailboat
},
2305 {"sb_down_arrow", XC_sb_down_arrow
},
2306 {"sb_h_double_arrow", XC_sb_h_double_arrow
},
2307 {"sb_left_arrow", XC_sb_left_arrow
},
2308 {"sb_right_arrow", XC_sb_right_arrow
},
2309 {"sb_up_arrow", XC_sb_up_arrow
},
2310 {"sb_v_double_arrow", XC_sb_v_double_arrow
},
2311 {"shuttle", XC_shuttle
},
2312 {"sizing", XC_sizing
},
2313 {"spider", XC_spider
},
2314 {"spraycan", XC_spraycan
},
2316 {"target", XC_target
},
2317 {"tcross", XC_tcross
},
2318 {"top_left_arrow", XC_top_left_arrow
},
2319 {"top_left_corner", XC_top_left_corner
},
2320 {"top_right_corner", XC_top_right_corner
},
2321 {"top_side", XC_top_side
},
2322 {"top_tee", XC_top_tee
},
2324 {"ul_angle", XC_ul_angle
},
2325 {"umbrella", XC_umbrella
},
2326 {"ur_angle", XC_ur_angle
},
2327 {"watch", XC_watch
},
2328 {"xterm", XC_xterm
},
2329 {NULL
, CURSOR_ID_NONE
}
2332 static void check_bitmap_status(int status
, const char *filename
, Pixmap bitmap
)
2335 case BitmapOpenFailed
:
2336 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2338 case BitmapFileInvalid
:
2339 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2341 case BitmapNoMemory
:
2342 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2345 XFreePixmap(dpy
, bitmap
);
2352 * (builtin, <cursor_name>)
2353 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2355 static int parse_cursor(WScreen
* scr
, WMPropList
* pl
, Cursor
* cursor
)
2362 nelem
= WMGetPropListItemCount(pl
);
2366 elem
= WMGetFromPLArray(pl
, 0);
2367 if (!elem
|| !WMIsPLString(elem
)) {
2370 val
= WMGetFromPLString(elem
);
2372 if (strcasecmp(val
, "none") == 0) {
2375 } else if (strcasecmp(val
, "builtin") == 0) {
2377 int cursor_id
= CURSOR_ID_NONE
;
2380 wwarning(_("bad number of arguments in cursor specification"));
2383 elem
= WMGetFromPLArray(pl
, 1);
2384 if (!elem
|| !WMIsPLString(elem
)) {
2387 val
= WMGetFromPLString(elem
);
2389 for (i
= 0; cursor_table
[i
].name
!= NULL
; i
++) {
2390 if (strcasecmp(val
, cursor_table
[i
].name
) == 0) {
2391 cursor_id
= cursor_table
[i
].id
;
2395 if (CURSOR_ID_NONE
== cursor_id
) {
2396 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2398 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2401 } else if (strcasecmp(val
, "bitmap") == 0) {
2413 wwarning(_("bad number of arguments in cursor specification"));
2416 elem
= WMGetFromPLArray(pl
, 1);
2417 if (!elem
|| !WMIsPLString(elem
)) {
2420 val
= WMGetFromPLString(elem
);
2421 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2423 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2426 elem
= WMGetFromPLArray(pl
, 2);
2427 if (!elem
|| !WMIsPLString(elem
)) {
2431 val
= WMGetFromPLString(elem
);
2432 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2435 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2438 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
, &mask
, &x
, &y
);
2439 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
, &bitmap
, &x
, &y
);
2440 if ((BitmapSuccess
== bitmap_status
) && (BitmapSuccess
== mask_status
)) {
2441 fg
.pixel
= scr
->black_pixel
;
2442 bg
.pixel
= scr
->white_pixel
;
2443 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2444 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2445 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2448 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2449 check_bitmap_status(mask_status
, mask_name
, mask
);
2456 static int getCursor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2458 static Cursor cursor
;
2463 if (!WMIsPLArray(value
)) {
2464 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2465 entry
->key
, "cursor specification");
2467 value
= entry
->plvalue
;
2469 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2474 status
= parse_cursor(scr
, value
, &cursor
);
2476 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2478 value
= entry
->plvalue
;
2480 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2489 *(Cursor
*) addr
= cursor
;
2494 #undef CURSOR_ID_NONE
2496 /* ---------------- value setting functions --------------- */
2497 static int setJustify(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2499 /* Parameter not used, but tell the compiler that it is ok */
2505 return REFRESH_WINDOW_TITLE_COLOR
;
2508 static int setClearance(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2510 /* Parameter not used, but tell the compiler that it is ok */
2516 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
| REFRESH_MENU_TITLE_FONT
| REFRESH_MENU_FONT
;
2519 static int setIfDockPresent(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2522 long which
= (long) extra_data
;
2524 /* Parameter not used, but tell the compiler that it is ok */
2530 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2531 // Drawers require the dock
2532 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| wPreferences
.flags
.nodock
;
2535 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2538 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| *flag
;
2546 static int setClipMergedInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2550 /* Parameter not used, but tell the compiler that it is ok */
2555 wPreferences
.flags
.clip_merged_in_dock
= *flag
;
2556 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2560 static int setWrapAppiconsInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2564 /* Parameter not used, but tell the compiler that it is ok */
2569 wPreferences
.flags
.wrap_appicons_in_dock
= *flag
;
2573 static int setStickyIcons(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2575 /* Parameter not used, but tell the compiler that it is ok */
2580 if (scr
->workspaces
) {
2581 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2582 wArrangeIcons(scr
, False
);
2587 static int setIconTile(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2591 WTexture
** texture
= tdata
;
2594 /* Parameter not used, but tell the compiler that it is ok */
2597 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2598 wPreferences
.icon_size
, ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2599 ? WREL_ICON
: WREL_FLAT
);
2601 wwarning(_("could not render texture for icon background"));
2603 wTextureDestroy(scr
, *texture
);
2606 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2608 if (scr
->icon_tile
) {
2610 RReleaseImage(scr
->icon_tile
);
2611 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2614 scr
->icon_tile
= img
;
2616 /* put the icon in the noticeboard hint */
2617 PropSetIconTileHint(scr
, img
);
2619 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
) {
2620 if (scr
->clip_tile
) {
2621 RReleaseImage(scr
->clip_tile
);
2623 scr
->clip_tile
= wClipMakeTile(img
);
2626 if (!wPreferences
.flags
.nodrawer
) {
2627 if (scr
->drawer_tile
) {
2628 RReleaseImage(scr
->drawer_tile
);
2630 scr
->drawer_tile
= wDrawerMakeTile(scr
, img
);
2633 scr
->icon_tile_pixmap
= pixmap
;
2635 if (scr
->def_icon_rimage
) {
2636 RReleaseImage(scr
->def_icon_rimage
);
2637 scr
->def_icon_rimage
= NULL
;
2640 if (scr
->icon_back_texture
)
2641 wTextureDestroy(scr
, (WTexture
*) scr
->icon_back_texture
);
2643 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2645 /* Free the texture as nobody else will use it, nor refer to it. */
2647 wTextureDestroy(scr
, *texture
);
2649 return (reset
? REFRESH_ICON_TILE
: 0);
2652 static int setWinTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2654 WMFont
*font
= tdata
;
2656 /* Parameter not used, but tell the compiler that it is ok */
2660 if (scr
->title_font
) {
2661 WMReleaseFont(scr
->title_font
);
2663 scr
->title_font
= font
;
2665 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
;
2668 static int setMenuTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2670 WMFont
*font
= tdata
;
2672 /* Parameter not used, but tell the compiler that it is ok */
2676 if (scr
->menu_title_font
) {
2677 WMReleaseFont(scr
->menu_title_font
);
2680 scr
->menu_title_font
= font
;
2682 return REFRESH_MENU_TITLE_FONT
;
2685 static int setMenuTextFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2687 WMFont
*font
= tdata
;
2689 /* Parameter not used, but tell the compiler that it is ok */
2693 if (scr
->menu_entry_font
) {
2694 WMReleaseFont(scr
->menu_entry_font
);
2696 scr
->menu_entry_font
= font
;
2698 return REFRESH_MENU_FONT
;
2701 static int setIconTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2703 WMFont
*font
= tdata
;
2705 /* Parameter not used, but tell the compiler that it is ok */
2709 if (scr
->icon_title_font
) {
2710 WMReleaseFont(scr
->icon_title_font
);
2713 scr
->icon_title_font
= font
;
2715 return REFRESH_ICON_FONT
;
2718 static int setClipTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2720 WMFont
*font
= tdata
;
2722 /* Parameter not used, but tell the compiler that it is ok */
2726 if (scr
->clip_title_font
) {
2727 WMReleaseFont(scr
->clip_title_font
);
2730 scr
->clip_title_font
= font
;
2732 return REFRESH_ICON_FONT
;
2735 static int setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2737 WMFont
*font
= tdata
;
2739 /* Parameter not used, but tell the compiler that it is ok */
2744 if (scr
->workspace_name_font
)
2745 WMReleaseFont(scr
->workspace_name_font
);
2747 scr
->workspace_name_font
= font
;
2752 static int setHightlight(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2754 XColor
*color
= tdata
;
2756 /* Parameter not used, but tell the compiler that it is ok */
2760 if (scr
->select_color
)
2761 WMReleaseColor(scr
->select_color
);
2763 scr
->select_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2765 wFreeColor(scr
, color
->pixel
);
2767 return REFRESH_MENU_COLOR
;
2770 static int setHightlightText(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2772 XColor
*color
= tdata
;
2774 /* Parameter not used, but tell the compiler that it is ok */
2778 if (scr
->select_text_color
)
2779 WMReleaseColor(scr
->select_text_color
);
2781 scr
->select_text_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2783 wFreeColor(scr
, color
->pixel
);
2785 return REFRESH_MENU_COLOR
;
2788 static int setClipTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2790 XColor
*color
= tdata
;
2791 long widx
= (long) extra_data
;
2793 /* Parameter not used, but tell the compiler that it is ok */
2796 if (scr
->clip_title_color
[widx
])
2797 WMReleaseColor(scr
->clip_title_color
[widx
]);
2799 scr
->clip_title_color
[widx
] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2800 wFreeColor(scr
, color
->pixel
);
2802 return REFRESH_ICON_TITLE_COLOR
;
2805 static int setWTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2807 XColor
*color
= tdata
;
2808 long widx
= (long) extra_data
;
2810 /* Parameter not used, but tell the compiler that it is ok */
2813 if (scr
->window_title_color
[widx
])
2814 WMReleaseColor(scr
->window_title_color
[widx
]);
2816 scr
->window_title_color
[widx
] =
2817 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2819 wFreeColor(scr
, color
->pixel
);
2821 return REFRESH_WINDOW_TITLE_COLOR
;
2824 static int setMenuTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2826 XColor
*color
= tdata
;
2828 /* Parameter not used, but tell the compiler that it is ok */
2832 if (scr
->menu_title_color
[0])
2833 WMReleaseColor(scr
->menu_title_color
[0]);
2835 scr
->menu_title_color
[0] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2837 wFreeColor(scr
, color
->pixel
);
2839 return REFRESH_MENU_TITLE_COLOR
;
2842 static int setMenuTextColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2844 XColor
*color
= tdata
;
2846 /* Parameter not used, but tell the compiler that it is ok */
2850 if (scr
->mtext_color
)
2851 WMReleaseColor(scr
->mtext_color
);
2853 scr
->mtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2855 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2856 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2858 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2861 wFreeColor(scr
, color
->pixel
);
2863 return REFRESH_MENU_COLOR
;
2866 static int setMenuDisabledColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2868 XColor
*color
= tdata
;
2870 /* Parameter not used, but tell the compiler that it is ok */
2874 if (scr
->dtext_color
)
2875 WMReleaseColor(scr
->dtext_color
);
2877 scr
->dtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2879 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2880 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2882 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2885 wFreeColor(scr
, color
->pixel
);
2887 return REFRESH_MENU_COLOR
;
2890 static int setIconTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2892 XColor
*color
= tdata
;
2894 /* Parameter not used, but tell the compiler that it is ok */
2898 if (scr
->icon_title_color
)
2899 WMReleaseColor(scr
->icon_title_color
);
2900 scr
->icon_title_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2902 wFreeColor(scr
, color
->pixel
);
2904 return REFRESH_ICON_TITLE_COLOR
;
2907 static int setIconTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2909 XColor
*color
= tdata
;
2911 /* Parameter not used, but tell the compiler that it is ok */
2915 if (scr
->icon_title_texture
) {
2916 wTextureDestroy(scr
, (WTexture
*) scr
->icon_title_texture
);
2918 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
2920 return REFRESH_ICON_TITLE_BACK
;
2923 static int setFrameBorderWidth(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2927 /* Parameter not used, but tell the compiler that it is ok */
2931 scr
->frame_border_width
= *value
;
2933 return REFRESH_FRAME_BORDER
;
2936 static int setFrameBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2938 XColor
*color
= tdata
;
2940 /* Parameter not used, but tell the compiler that it is ok */
2944 if (scr
->frame_border_color
)
2945 WMReleaseColor(scr
->frame_border_color
);
2946 scr
->frame_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2948 wFreeColor(scr
, color
->pixel
);
2950 return REFRESH_FRAME_BORDER
;
2953 static int setFrameFocusedBorderColor(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2955 XColor
*color
= tdata
;
2957 /* Parameter not used, but tell the compiler that it is ok */
2961 if (scr
->frame_focused_border_color
)
2962 WMReleaseColor(scr
->frame_focused_border_color
);
2963 scr
->frame_focused_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2965 wFreeColor(scr
, color
->pixel
);
2967 return REFRESH_FRAME_BORDER
;
2970 static int setFrameSelectedBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2972 XColor
*color
= tdata
;
2974 /* Parameter not used, but tell the compiler that it is ok */
2978 if (scr
->frame_selected_border_color
)
2979 WMReleaseColor(scr
->frame_selected_border_color
);
2980 scr
->frame_selected_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2982 wFreeColor(scr
, color
->pixel
);
2984 return REFRESH_FRAME_BORDER
;
2987 static int setWorkspaceSpecificBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
2989 WMPropList
*value
= tdata
;
2994 /* Parameter not used, but tell the compiler that it is ok */
2998 if (scr
->flags
.backimage_helper_launched
) {
2999 if (WMGetPropListItemCount(value
) == 0) {
3000 SendHelperMessage(scr
, 'C', 0, NULL
);
3001 SendHelperMessage(scr
, 'K', 0, NULL
);
3003 WMReleasePropList(value
);
3007 if (WMGetPropListItemCount(value
) == 0)
3010 if (!start_bg_helper(scr
)) {
3011 WMReleasePropList(value
);
3015 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3018 for (i
= 0; i
< WMGetPropListItemCount(value
); i
++) {
3019 val
= WMGetFromPLArray(value
, i
);
3020 if (val
&& WMIsPLArray(val
) && WMGetPropListItemCount(val
) > 0) {
3021 str
= WMGetPropListDescription(val
, False
);
3023 SendHelperMessage(scr
, 'S', i
+ 1, str
);
3027 SendHelperMessage(scr
, 'U', i
+ 1, NULL
);
3032 WMReleasePropList(value
);
3036 static int setWorkspaceBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
3038 WMPropList
*value
= tdata
;
3040 /* Parameter not used, but tell the compiler that it is ok */
3044 if (scr
->flags
.backimage_helper_launched
) {
3047 if (WMGetPropListItemCount(value
) == 0) {
3048 SendHelperMessage(scr
, 'U', 0, NULL
);
3050 /* set the default workspace background to this one */
3051 str
= WMGetPropListDescription(value
, False
);
3053 SendHelperMessage(scr
, 'S', 0, str
);
3055 SendHelperMessage(scr
, 'C', scr
->current_workspace
+ 1, NULL
);
3057 SendHelperMessage(scr
, 'U', 0, NULL
);
3060 } else if (WMGetPropListItemCount(value
) > 0) {
3065 text
= WMGetPropListDescription(value
, False
);
3066 len
= strlen(text
) + 40;
3067 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3068 if (!strchr(text
, '\'') && !strchr(text
, '\\')) {
3071 if (wPreferences
.smooth_workspace_back
)
3072 snprintf(command
, len
, "wmsetbg %s -S -p '%s' &", dither
, text
);
3074 snprintf(command
, len
, "wmsetbg %s -p '%s' &", dither
, text
);
3075 ExecuteShellCommand(scr
, command
);
3077 wwarning(_("Invalid arguments for background \"%s\""), text
);
3080 WMReleasePropList(value
);
3085 static int setWidgetColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3087 WTexture
**texture
= tdata
;
3089 /* Parameter not used, but tell the compiler that it is ok */
3093 if (scr
->widget_texture
) {
3094 wTextureDestroy(scr
, (WTexture
*) scr
->widget_texture
);
3096 scr
->widget_texture
= *(WTexSolid
**) texture
;
3101 static int setFTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3103 WTexture
**texture
= tdata
;
3105 /* Parameter not used, but tell the compiler that it is ok */
3109 if (scr
->window_title_texture
[WS_FOCUSED
]) {
3110 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3112 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3114 return REFRESH_WINDOW_TEXTURES
;
3117 static int setPTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3119 WTexture
**texture
= tdata
;
3121 /* Parameter not used, but tell the compiler that it is ok */
3125 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
3126 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3128 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3130 return REFRESH_WINDOW_TEXTURES
;
3133 static int setUTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3135 WTexture
**texture
= tdata
;
3137 /* Parameter not used, but tell the compiler that it is ok */
3141 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
3142 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3144 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3146 return REFRESH_WINDOW_TEXTURES
;
3149 static int setResizebarBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3151 WTexture
**texture
= tdata
;
3153 /* Parameter not used, but tell the compiler that it is ok */
3157 if (scr
->resizebar_texture
[0]) {
3158 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3160 scr
->resizebar_texture
[0] = *texture
;
3162 return REFRESH_WINDOW_TEXTURES
;
3165 static int setMenuTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3167 WTexture
**texture
= tdata
;
3169 /* Parameter not used, but tell the compiler that it is ok */
3173 if (scr
->menu_title_texture
[0]) {
3174 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3176 scr
->menu_title_texture
[0] = *texture
;
3178 return REFRESH_MENU_TITLE_TEXTURE
;
3181 static int setMenuTextBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3183 WTexture
**texture
= tdata
;
3185 /* Parameter not used, but tell the compiler that it is ok */
3189 if (scr
->menu_item_texture
) {
3190 wTextureDestroy(scr
, scr
->menu_item_texture
);
3191 wTextureDestroy(scr
, (WTexture
*) scr
->menu_item_auxtexture
);
3193 scr
->menu_item_texture
= *texture
;
3195 scr
->menu_item_auxtexture
= wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3197 return REFRESH_MENU_TEXTURE
;
3200 static int setKeyGrab(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3202 WShortKey
*shortcut
= tdata
;
3204 long widx
= (long) extra_data
;
3206 /* Parameter not used, but tell the compiler that it is ok */
3209 wKeyBindings
[widx
] = *shortcut
;
3211 wwin
= scr
->focused_window
;
3213 while (wwin
!= NULL
) {
3214 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3216 if (!WFLAGP(wwin
, no_bind_keys
)) {
3217 wWindowSetKeyGrabs(wwin
);
3222 /* do we need to update window menus? */
3223 if (widx
>= WKBD_WORKSPACE1
&& widx
<= WKBD_WORKSPACE10
)
3224 return REFRESH_WORKSPACE_MENU
;
3225 if (widx
== WKBD_LASTWORKSPACE
)
3226 return REFRESH_WORKSPACE_MENU
;
3227 if (widx
>= WKBD_MOVE_WORKSPACE1
&& widx
<= WKBD_MOVE_WORKSPACE10
)
3228 return REFRESH_WORKSPACE_MENU
;
3233 static int setIconPosition(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3235 /* Parameter not used, but tell the compiler that it is ok */
3240 wScreenUpdateUsableArea(scr
);
3241 wArrangeIcons(scr
, True
);
3246 static int updateUsableArea(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3248 /* Parameter not used, but tell the compiler that it is ok */
3253 wScreenUpdateUsableArea(scr
);
3258 static int setWorkspaceMapBackground(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3260 WTexture
**texture
= tdata
;
3262 /* Parameter not used, but tell the compiler that it is ok */
3266 if (wPreferences
.wsmbackTexture
)
3267 wTextureDestroy(scr
, wPreferences
.wsmbackTexture
);
3269 wPreferences
.wsmbackTexture
= *texture
;
3271 return REFRESH_WINDOW_TEXTURES
;
3274 static int setMenuStyle(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3276 /* Parameter not used, but tell the compiler that it is ok */
3282 return REFRESH_MENU_TEXTURE
;
3285 static RImage
*chopOffImage(RImage
* image
, int x
, int y
, int w
, int h
)
3287 RImage
*img
= RCreateImage(w
, h
, image
->format
== RRGBAFormat
);
3289 RCopyArea(img
, image
, x
, y
, w
, h
, 0, 0);
3294 static int setSwPOptions(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3296 WMPropList
*array
= tdata
;
3299 int cwidth
, cheight
;
3300 struct WPreferences
*prefs
= foo
;
3302 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) == 0) {
3303 if (prefs
->swtileImage
)
3304 RReleaseImage(prefs
->swtileImage
);
3305 prefs
->swtileImage
= NULL
;
3307 WMReleasePropList(array
);
3311 switch (WMGetPropListItemCount(array
)) {
3313 if (!WMIsPLString(WMGetFromPLArray(array
, 1))) {
3314 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3317 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 1)));
3320 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3321 WMGetFromPLString(WMGetFromPLArray(array
, 1)), entry
->key
);
3323 bgimage
= RLoadImage(scr
->rcontext
, path
, 0);
3325 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3330 cwidth
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 2)));
3331 cheight
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 3)));
3333 if (cwidth
<= 0 || cheight
<= 0 ||
3334 cwidth
>= bgimage
->width
- 2 || cheight
>= bgimage
->height
- 2)
3335 wwarning(_("Invalid split sizes for switch panel back image."));
3338 int swidth
, theight
;
3339 for (i
= 0; i
< 9; i
++) {
3340 if (prefs
->swbackImage
[i
])
3341 RReleaseImage(prefs
->swbackImage
[i
]);
3342 prefs
->swbackImage
[i
] = NULL
;
3344 swidth
= (bgimage
->width
- cwidth
) / 2;
3345 theight
= (bgimage
->height
- cheight
) / 2;
3347 prefs
->swbackImage
[0] = chopOffImage(bgimage
, 0, 0, swidth
, theight
);
3348 prefs
->swbackImage
[1] = chopOffImage(bgimage
, swidth
, 0, cwidth
, theight
);
3349 prefs
->swbackImage
[2] = chopOffImage(bgimage
, swidth
+ cwidth
, 0,
3352 prefs
->swbackImage
[3] = chopOffImage(bgimage
, 0, theight
, swidth
, cheight
);
3353 prefs
->swbackImage
[4] = chopOffImage(bgimage
, swidth
, theight
,
3355 prefs
->swbackImage
[5] = chopOffImage(bgimage
, swidth
+ cwidth
, theight
,
3358 prefs
->swbackImage
[6] = chopOffImage(bgimage
, 0, theight
+ cheight
,
3360 prefs
->swbackImage
[7] = chopOffImage(bgimage
, swidth
, theight
+ cheight
,
3362 prefs
->swbackImage
[8] =
3363 chopOffImage(bgimage
, swidth
+ cwidth
, theight
+ cheight
, swidth
,
3366 // check if anything failed
3367 for (i
= 0; i
< 9; i
++) {
3368 if (!prefs
->swbackImage
[i
]) {
3369 for (; i
>= 0; --i
) {
3370 RReleaseImage(prefs
->swbackImage
[i
]);
3371 prefs
->swbackImage
[i
] = NULL
;
3377 RReleaseImage(bgimage
);
3384 if (!WMIsPLString(WMGetFromPLArray(array
, 0))) {
3385 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3388 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 0)));
3391 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3392 WMGetFromPLString(WMGetFromPLArray(array
, 0)), entry
->key
);
3394 if (prefs
->swtileImage
)
3395 RReleaseImage(prefs
->swtileImage
);
3397 prefs
->swtileImage
= RLoadImage(scr
->rcontext
, path
, 0);
3398 if (!prefs
->swtileImage
) {
3399 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3406 wwarning(_("Invalid number of arguments for option \"%s\""), entry
->key
);
3410 WMReleasePropList(array
);
3415 static int setModifierKeyLabels(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3417 WMPropList
*array
= tdata
;
3419 struct WPreferences
*prefs
= foo
;
3421 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) != 7) {
3422 wwarning(_("Value for option \"%s\" must be an array of 7 strings"), entry
->key
);
3423 WMReleasePropList(array
);
3427 DestroyWindowMenu(scr
);
3429 for (i
= 0; i
< 7; i
++) {
3430 if (prefs
->modifier_labels
[i
])
3431 wfree(prefs
->modifier_labels
[i
]);
3433 if (WMIsPLString(WMGetFromPLArray(array
, i
))) {
3434 prefs
->modifier_labels
[i
] = wstrdup(WMGetFromPLString(WMGetFromPLArray(array
, i
)));
3436 wwarning(_("Invalid argument for option \"%s\" item %d"), entry
->key
, i
);
3437 prefs
->modifier_labels
[i
] = NULL
;
3441 WMReleasePropList(array
);
3446 static int setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3450 /* Parameter not used, but tell the compiler that it is ok */
3457 W_setconf_doubleClickDelay(*value
);
3462 static int setCursor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3464 Cursor
*cursor
= tdata
;
3465 long widx
= (long) extra_data
;
3467 /* Parameter not used, but tell the compiler that it is ok */
3470 if (wPreferences
.cursor
[widx
] != None
) {
3471 XFreeCursor(dpy
, wPreferences
.cursor
[widx
]);
3474 wPreferences
.cursor
[widx
] = *cursor
;
3476 if (widx
== WCUR_ROOT
&& *cursor
!= None
) {
3477 XDefineCursor(dpy
, scr
->root_win
, *cursor
);