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
}
355 #define NUM2STRING_(x) #x
356 #define NUM2STRING(x) NUM2STRING_(x)
358 WDefaultEntry optionList
[] = {
360 /* dynamic options */
362 {"IconPosition", "blh", seIconPositions
,
363 &wPreferences
.icon_yard
, getEnum
, setIconPosition
, NULL
, NULL
},
364 {"IconificationStyle", "Zoom", seIconificationStyles
,
365 &wPreferences
.iconification_style
, getEnum
, NULL
, NULL
, NULL
},
366 {"DisableWSMouseActions", "NO", NULL
,
367 &wPreferences
.disable_root_mouse
, getBool
, NULL
, NULL
, NULL
},
368 {"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions
,
369 &wPreferences
.mouse_button1
, getEnum
, NULL
, NULL
, NULL
},
370 {"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions
,
371 &wPreferences
.mouse_button2
, getEnum
, NULL
, NULL
, NULL
},
372 {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions
,
373 &wPreferences
.mouse_button3
, getEnum
, NULL
, NULL
, NULL
},
374 {"MouseBackwardButtonAction", "None", seMouseButtonActions
,
375 &wPreferences
.mouse_button8
, getEnum
, NULL
, NULL
, NULL
},
376 {"MouseForwardButtonAction", "None", seMouseButtonActions
,
377 &wPreferences
.mouse_button9
, getEnum
, NULL
, NULL
, NULL
},
378 {"MouseWheelAction", "None", seMouseWheelActions
,
379 &wPreferences
.mouse_wheel_scroll
, getEnum
, NULL
, NULL
, NULL
},
380 {"MouseWheelTiltAction", "None", seMouseWheelActions
,
381 &wPreferences
.mouse_wheel_tilt
, getEnum
, NULL
, NULL
, NULL
},
382 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
383 &wPreferences
.pixmap_path
, getPathList
, NULL
, NULL
, NULL
},
384 {"IconPath", DEF_ICON_PATHS
, NULL
,
385 &wPreferences
.icon_path
, getPathList
, NULL
, NULL
, NULL
},
386 {"ColormapMode", "auto", seColormapModes
,
387 &wPreferences
.colormap_mode
, getEnum
, NULL
, NULL
, NULL
},
388 {"AutoFocus", "YES", NULL
,
389 &wPreferences
.auto_focus
, getBool
, NULL
, NULL
, NULL
},
390 {"RaiseDelay", "0", NULL
,
391 &wPreferences
.raise_delay
, getInt
, NULL
, NULL
, NULL
},
392 {"CirculateRaise", "NO", NULL
,
393 &wPreferences
.circ_raise
, getBool
, NULL
, NULL
, NULL
},
394 {"Superfluous", "YES", NULL
,
395 &wPreferences
.superfluous
, getBool
, NULL
, NULL
, NULL
},
396 {"AdvanceToNewWorkspace", "NO", NULL
,
397 &wPreferences
.ws_advance
, getBool
, NULL
, NULL
, NULL
},
398 {"CycleWorkspaces", "NO", NULL
,
399 &wPreferences
.ws_cycle
, getBool
, NULL
, NULL
, NULL
},
400 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
401 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
, NULL
, NULL
},
402 {"WorkspaceBorder", "None", seWorkspaceBorder
,
403 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
, NULL
, NULL
},
404 {"WorkspaceBorderSize", "0", NULL
,
405 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
, NULL
, NULL
},
406 {"StickyIcons", "NO", NULL
,
407 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
, NULL
, NULL
},
408 {"SaveSessionOnExit", "NO", NULL
,
409 &wPreferences
.save_session_on_exit
, getBool
, NULL
, NULL
, NULL
},
410 {"WrapMenus", "NO", NULL
,
411 &wPreferences
.wrap_menus
, getBool
, NULL
, NULL
, NULL
},
412 {"ScrollableMenus", "YES", NULL
,
413 &wPreferences
.scrollable_menus
, getBool
, NULL
, NULL
, NULL
},
414 {"MenuScrollSpeed", "fast", seSpeeds
,
415 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
, NULL
, NULL
},
416 {"IconSlideSpeed", "fast", seSpeeds
,
417 &wPreferences
.icon_slide_speed
, getEnum
, NULL
, NULL
, NULL
},
418 {"ShadeSpeed", "fast", seSpeeds
,
419 &wPreferences
.shade_speed
, getEnum
, NULL
, NULL
, NULL
},
420 {"BounceAppIconsWhenUrgent", "YES", NULL
,
421 &wPreferences
.bounce_appicons_when_urgent
, getBool
, NULL
, NULL
, NULL
},
422 {"RaiseAppIconsWhenBouncing", "NO", NULL
,
423 &wPreferences
.raise_appicons_when_bouncing
, getBool
, NULL
, NULL
, NULL
},
424 {"DoNotMakeAppIconsBounce", "NO", NULL
,
425 &wPreferences
.do_not_make_appicons_bounce
, getBool
, NULL
, NULL
, NULL
},
426 {"DoubleClickTime", "250", (void *)&wPreferences
.dblclick_time
,
427 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
, NULL
, NULL
},
428 {"ClipAutoraiseDelay", "600", NULL
,
429 &wPreferences
.clip_auto_raise_delay
, getInt
, NULL
, NULL
, NULL
},
430 {"ClipAutolowerDelay", "1000", NULL
,
431 &wPreferences
.clip_auto_lower_delay
, getInt
, NULL
, NULL
, NULL
},
432 {"ClipAutoexpandDelay", "600", NULL
,
433 &wPreferences
.clip_auto_expand_delay
, getInt
, NULL
, NULL
, NULL
},
434 {"ClipAutocollapseDelay", "1000", NULL
,
435 &wPreferences
.clip_auto_collapse_delay
, getInt
, NULL
, NULL
, NULL
},
436 {"WrapAppiconsInDock", "YES", NULL
,
437 NULL
, getBool
, setWrapAppiconsInDock
, NULL
, NULL
},
438 {"AlignSubmenus", "NO", NULL
,
439 &wPreferences
.align_menus
, getBool
, NULL
, NULL
, NULL
},
440 {"ViKeyMenus", "NO", NULL
,
441 &wPreferences
.vi_key_menus
, getBool
, NULL
, NULL
, NULL
},
442 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
443 &wPreferences
.open_transients_with_parent
, getBool
, NULL
, NULL
, NULL
},
444 {"WindowPlacement", "auto", sePlacements
,
445 &wPreferences
.window_placement
, getEnum
, NULL
, NULL
, NULL
},
446 {"IgnoreFocusClick", "NO", NULL
,
447 &wPreferences
.ignore_focus_click
, getBool
, NULL
, NULL
, NULL
},
448 {"UseSaveUnders", "NO", NULL
,
449 &wPreferences
.use_saveunders
, getBool
, NULL
, NULL
, NULL
},
450 {"OpaqueMove", "YES", NULL
,
451 &wPreferences
.opaque_move
, getBool
, NULL
, NULL
, NULL
},
452 {"OpaqueResize", "NO", NULL
,
453 &wPreferences
.opaque_resize
, getBool
, NULL
, NULL
, NULL
},
454 {"OpaqueMoveResizeKeyboard", "NO", NULL
,
455 &wPreferences
.opaque_move_resize_keyboard
, getBool
, NULL
, NULL
, NULL
},
456 {"DisableAnimations", "NO", NULL
,
457 &wPreferences
.no_animations
, getBool
, NULL
, NULL
, NULL
},
458 {"DontLinkWorkspaces", "YES", NULL
,
459 &wPreferences
.no_autowrap
, getBool
, NULL
, NULL
, NULL
},
460 {"WindowSnapping", "NO", NULL
,
461 &wPreferences
.window_snapping
, getBool
, NULL
, NULL
, NULL
},
462 {"SnapEdgeDetect", "1", NULL
,
463 &wPreferences
.snap_edge_detect
, getInt
, NULL
, NULL
, NULL
},
464 {"SnapCornerDetect", "10", NULL
,
465 &wPreferences
.snap_corner_detect
, getInt
, NULL
, NULL
, NULL
},
466 {"SnapToTopMaximizesFullscreen", "NO", NULL
,
467 &wPreferences
.snap_to_top_maximizes_fullscreen
, getBool
, NULL
, NULL
, NULL
},
468 {"DragMaximizedWindow", "Move", seDragMaximizedWindow
,
469 &wPreferences
.drag_maximized_window
, getEnum
, NULL
, NULL
, NULL
},
470 {"MoveHalfMaximizedWindowsBetweenScreens", "NO", NULL
,
471 &wPreferences
.move_half_max_between_heads
, getBool
, NULL
, NULL
, NULL
},
472 {"AlternativeHalfMaximized", "NO", NULL
,
473 &wPreferences
.alt_half_maximize
, getBool
, NULL
, NULL
, NULL
},
474 {"PointerWithHalfMaxWindows", "NO", NULL
,
475 &wPreferences
.pointer_with_half_max_windows
, getBool
, NULL
, NULL
, NULL
},
476 {"HighlightActiveApp", "YES", NULL
,
477 &wPreferences
.highlight_active_app
, getBool
, NULL
, NULL
, NULL
},
478 {"AutoArrangeIcons", "NO", NULL
,
479 &wPreferences
.auto_arrange_icons
, getBool
, NULL
, NULL
, NULL
},
480 {"NoWindowOverDock", "NO", NULL
,
481 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
, NULL
, NULL
},
482 {"NoWindowOverIcons", "NO", NULL
,
483 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
, NULL
, NULL
},
484 {"WindowPlaceOrigin", "(64, 0)", NULL
,
485 &wPreferences
.window_place_origin
, getCoord
, NULL
, NULL
, NULL
},
486 {"ResizeDisplay", "center", seGeomDisplays
,
487 &wPreferences
.size_display
, getEnum
, NULL
, NULL
, NULL
},
488 {"MoveDisplay", "floating", seGeomDisplays
,
489 &wPreferences
.move_display
, getEnum
, NULL
, NULL
, NULL
},
490 {"DontConfirmKill", "NO", NULL
,
491 &wPreferences
.dont_confirm_kill
, getBool
, NULL
, NULL
, NULL
},
492 {"WindowTitleBalloons", "YES", NULL
,
493 &wPreferences
.window_balloon
, getBool
, NULL
, NULL
, NULL
},
494 {"MiniwindowTitleBalloons", "NO", NULL
,
495 &wPreferences
.miniwin_title_balloon
, getBool
, NULL
, NULL
, NULL
},
496 {"MiniwindowPreviewBalloons", "NO", NULL
,
497 &wPreferences
.miniwin_preview_balloon
, getBool
, NULL
, NULL
, NULL
},
498 {"AppIconBalloons", "NO", NULL
,
499 &wPreferences
.appicon_balloon
, getBool
, NULL
, NULL
, NULL
},
500 {"HelpBalloons", "NO", NULL
,
501 &wPreferences
.help_balloon
, getBool
, NULL
, NULL
, NULL
},
502 {"EdgeResistance", "30", NULL
,
503 &wPreferences
.edge_resistance
, getInt
, NULL
, NULL
, NULL
},
504 {"ResizeIncrement", "0", NULL
,
505 &wPreferences
.resize_increment
, getInt
, NULL
, NULL
, NULL
},
506 {"Attraction", "NO", NULL
,
507 &wPreferences
.attract
, getBool
, NULL
, NULL
, NULL
},
508 {"DisableBlinking", "NO", NULL
,
509 &wPreferences
.dont_blink
, getBool
, NULL
, NULL
, NULL
},
510 {"SingleClickLaunch", "NO", NULL
,
511 &wPreferences
.single_click
, getBool
, NULL
, NULL
, NULL
},
512 {"StrictWindozeCycle", "YES", NULL
,
513 &wPreferences
.strict_windoze_cycle
, getBool
, NULL
, NULL
, NULL
},
514 {"SwitchPanelOnlyOpen", "NO", NULL
,
515 &wPreferences
.panel_only_open
, getBool
, NULL
, NULL
, NULL
},
516 {"MiniPreviewSize", "128", NULL
,
517 &wPreferences
.minipreview_size
, getInt
, NULL
, NULL
, NULL
},
518 {"IgnoreGtkHints", "NO", NULL
,
519 &wPreferences
.ignore_gtk_decoration_hints
, getBool
, NULL
, NULL
, NULL
},
523 {"MenuStyle", "normal", seMenuStyles
,
524 &wPreferences
.menu_style
, getEnum
, setMenuStyle
, NULL
, NULL
},
525 {"WidgetColor", "(solid, gray)", NULL
,
526 NULL
, getTexture
, setWidgetColor
, NULL
, NULL
},
527 {"WorkspaceSpecificBack", "()", NULL
,
528 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
, NULL
, NULL
},
529 /* WorkspaceBack must come after WorkspaceSpecificBack or
530 * WorkspaceBack won't know WorkspaceSpecificBack was also
531 * specified and 2 copies of wmsetbg will be launched */
532 {"WorkspaceBack", "(solid, \"rgb:50/50/75\")", NULL
,
533 NULL
, getWSBackground
, setWorkspaceBack
, NULL
, NULL
},
534 {"SmoothWorkspaceBack", "NO", NULL
,
535 NULL
, getBool
, NULL
, NULL
, NULL
},
536 {"IconBack", "(dgradient, \"rgb:a6/a6/b6\", \"rgb:51/55/61\")", NULL
,
537 NULL
, getTexture
, setIconTile
, NULL
, NULL
},
538 {"TitleJustify", "center", seJustifications
,
539 &wPreferences
.title_justification
, getEnum
, setJustify
, NULL
, NULL
},
540 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
541 NULL
, getFont
, setWinTitleFont
, NULL
, NULL
},
542 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
543 &wPreferences
.window_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
544 {"WindowTitleMinHeight", "0", NULL
,
545 &wPreferences
.window_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
546 {"WindowTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
547 &wPreferences
.window_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
548 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
549 &wPreferences
.menu_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
550 {"MenuTitleMinHeight", "0", NULL
,
551 &wPreferences
.menu_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
552 {"MenuTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
553 &wPreferences
.menu_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
554 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
555 &wPreferences
.menu_text_clearance
, getInt
, setClearance
, NULL
, NULL
},
556 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
557 NULL
, getFont
, setMenuTitleFont
, NULL
, NULL
},
558 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
559 NULL
, getFont
, setMenuTextFont
, NULL
, NULL
},
560 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
561 NULL
, getFont
, setIconTitleFont
, NULL
, NULL
},
562 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
563 NULL
, getFont
, setClipTitleFont
, NULL
, NULL
},
564 {"ShowClipTitle", "YES", NULL
,
565 &wPreferences
.show_clip_title
, getBool
, NULL
, NULL
, NULL
},
566 {"LargeDisplayFont", DEF_WORKSPACE_NAME_FONT
, NULL
,
567 NULL
, getFont
, setLargeDisplayFont
, NULL
, NULL
},
568 {"HighlightColor", "white", NULL
,
569 NULL
, getColor
, setHightlight
, NULL
, NULL
},
570 {"HighlightTextColor", "black", NULL
,
571 NULL
, getColor
, setHightlightText
, NULL
, NULL
},
572 {"ClipTitleColor", "black", (void *)CLIP_NORMAL
,
573 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
574 {"CClipTitleColor", "\"rgb:61/61/61\"", (void *)CLIP_COLLAPSED
,
575 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
576 {"FTitleColor", "white", (void *)WS_FOCUSED
,
577 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
578 {"PTitleColor", "white", (void *)WS_PFOCUSED
,
579 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
580 {"UTitleColor", "black", (void *)WS_UNFOCUSED
,
581 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
582 {"FTitleBack", "(solid, black)", NULL
,
583 NULL
, getTexture
, setFTitleBack
, NULL
, NULL
},
584 {"PTitleBack", "(solid, gray40)", NULL
,
585 NULL
, getTexture
, setPTitleBack
, NULL
, NULL
},
586 {"UTitleBack", "(solid, \"rgb:aa/aa/aa\")", NULL
,
587 NULL
, getTexture
, setUTitleBack
, NULL
, NULL
},
588 {"ResizebarBack", "(solid, \"rgb:aa/aa/aa\")", NULL
,
589 NULL
, getTexture
, setResizebarBack
, NULL
, NULL
},
590 {"MenuTitleColor", "white", NULL
,
591 NULL
, getColor
, setMenuTitleColor
, NULL
, NULL
},
592 {"MenuTextColor", "black", NULL
,
593 NULL
, getColor
, setMenuTextColor
, NULL
, NULL
},
594 {"MenuDisabledColor", "gray50", NULL
,
595 NULL
, getColor
, setMenuDisabledColor
, NULL
, NULL
},
596 {"MenuTitleBack", "(solid, black)", NULL
,
597 NULL
, getTexture
, setMenuTitleBack
, NULL
, NULL
},
598 {"MenuTextBack", "(solid, \"rgb:aa/aa/aa\")", NULL
,
599 NULL
, getTexture
, setMenuTextBack
, NULL
, NULL
},
600 {"IconTitleColor", "white", NULL
,
601 NULL
, getColor
, setIconTitleColor
, NULL
, NULL
},
602 {"IconTitleBack", "black", NULL
,
603 NULL
, getColor
, setIconTitleBack
, NULL
, NULL
},
604 {"SwitchPanelImages", "(swtile.png, swback.png, 30, 40)", &wPreferences
,
605 NULL
, getPropList
, setSwPOptions
, NULL
, NULL
},
606 {"ModifierKeyLabels", "(\"Shift+\", \"Control+\", \"Mod1+\", \"Mod2+\", \"Mod3+\", \"Mod4+\", \"Mod5+\")", &wPreferences
,
607 NULL
, getPropList
, setModifierKeyLabels
, NULL
, NULL
},
608 {"FrameBorderWidth", "1", NULL
,
609 NULL
, getInt
, setFrameBorderWidth
, NULL
, NULL
},
610 {"FrameBorderColor", "black", NULL
,
611 NULL
, getColor
, setFrameBorderColor
, NULL
, NULL
},
612 {"FrameFocusedBorderColor", "black", NULL
,
613 NULL
, getColor
, setFrameFocusedBorderColor
, NULL
, NULL
},
614 {"FrameSelectedBorderColor", "white", NULL
,
615 NULL
, getColor
, setFrameSelectedBorderColor
, NULL
, NULL
},
616 {"WorkspaceMapBack", "(solid, black)", NULL
,
617 NULL
, getTexture
, setWorkspaceMapBackground
, NULL
, NULL
},
621 {"RootMenuKey", "F12", (void *)WKBD_ROOTMENU
,
622 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
623 {"WindowListKey", "F11", (void *)WKBD_WINDOWLIST
,
624 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
625 {"WindowMenuKey", "Control+Escape", (void *)WKBD_WINDOWMENU
,
626 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
627 {"DockRaiseLowerKey", "None", (void*)WKBD_DOCKRAISELOWER
,
628 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
629 {"ClipRaiseLowerKey", "None", (void *)WKBD_CLIPRAISELOWER
,
630 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
631 {"MiniaturizeKey", "Mod1+M", (void *)WKBD_MINIATURIZE
,
632 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
633 {"MinimizeAllKey", "None", (void *)WKBD_MINIMIZEALL
,
634 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
635 {"HideKey", "Mod1+H", (void *)WKBD_HIDE
,
636 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
637 {"HideOthersKey", "None", (void *)WKBD_HIDE_OTHERS
,
638 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
639 {"MoveResizeKey", "None", (void *)WKBD_MOVERESIZE
,
640 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
641 {"CloseKey", "None", (void *)WKBD_CLOSE
,
642 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
643 {"MaximizeKey", "None", (void *)WKBD_MAXIMIZE
,
644 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
645 {"VMaximizeKey", "None", (void *)WKBD_VMAXIMIZE
,
646 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
647 {"HMaximizeKey", "None", (void *)WKBD_HMAXIMIZE
,
648 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
649 {"LHMaximizeKey", "None", (void*)WKBD_LHMAXIMIZE
,
650 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
651 {"RHMaximizeKey", "None", (void*)WKBD_RHMAXIMIZE
,
652 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
653 {"THMaximizeKey", "None", (void*)WKBD_THMAXIMIZE
,
654 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
655 {"BHMaximizeKey", "None", (void*)WKBD_BHMAXIMIZE
,
656 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
657 {"LTCMaximizeKey", "None", (void*)WKBD_LTCMAXIMIZE
,
658 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
659 {"RTCMaximizeKey", "None", (void*)WKBD_RTCMAXIMIZE
,
660 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
661 {"LBCMaximizeKey", "None", (void*)WKBD_LBCMAXIMIZE
,
662 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
663 {"RBCMaximizeKey", "None", (void*)WKBD_RBCMAXIMIZE
,
664 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
665 {"MaximusKey", "None", (void*)WKBD_MAXIMUS
,
666 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
667 {"KeepOnTopKey", "None", (void *)WKBD_KEEP_ON_TOP
,
668 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
669 {"KeepAtBottomKey", "None", (void *)WKBD_KEEP_AT_BOTTOM
,
670 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
671 {"OmnipresentKey", "None", (void *)WKBD_OMNIPRESENT
,
672 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
673 {"RaiseKey", "Mod1+Up", (void *)WKBD_RAISE
,
674 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
675 {"LowerKey", "Mod1+Down", (void *)WKBD_LOWER
,
676 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
677 {"RaiseLowerKey", "None", (void *)WKBD_RAISELOWER
,
678 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
679 {"ShadeKey", "None", (void *)WKBD_SHADE
,
680 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
681 {"SelectKey", "None", (void *)WKBD_SELECT
,
682 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
683 {"WorkspaceMapKey", "None", (void *)WKBD_WORKSPACEMAP
,
684 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
685 {"FocusNextKey", "Mod1+Tab", (void *)WKBD_FOCUSNEXT
,
686 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
687 {"FocusPrevKey", "Mod1+Shift+Tab", (void *)WKBD_FOCUSPREV
,
688 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
689 {"GroupNextKey", "None", (void *)WKBD_GROUPNEXT
,
690 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
691 {"GroupPrevKey", "None", (void *)WKBD_GROUPPREV
,
692 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
693 {"NextWorkspaceKey", "Mod1+Control+Right", (void *)WKBD_NEXTWORKSPACE
,
694 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
695 {"PrevWorkspaceKey", "Mod1+Control+Left", (void *)WKBD_PREVWORKSPACE
,
696 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
697 {"LastWorkspaceKey", "None", (void *)WKBD_LASTWORKSPACE
,
698 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
699 {"NextWorkspaceLayerKey", "None", (void *)WKBD_NEXTWSLAYER
,
700 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
701 {"PrevWorkspaceLayerKey", "None", (void *)WKBD_PREVWSLAYER
,
702 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
703 {"Workspace1Key", "Mod1+1", (void *)WKBD_WORKSPACE1
,
704 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
705 {"Workspace2Key", "Mod1+2", (void *)WKBD_WORKSPACE2
,
706 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
707 {"Workspace3Key", "Mod1+3", (void *)WKBD_WORKSPACE3
,
708 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
709 {"Workspace4Key", "Mod1+4", (void *)WKBD_WORKSPACE4
,
710 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
711 {"Workspace5Key", "Mod1+5", (void *)WKBD_WORKSPACE5
,
712 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
713 {"Workspace6Key", "Mod1+6", (void *)WKBD_WORKSPACE6
,
714 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
715 {"Workspace7Key", "Mod1+7", (void *)WKBD_WORKSPACE7
,
716 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
717 {"Workspace8Key", "Mod1+8", (void *)WKBD_WORKSPACE8
,
718 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
719 {"Workspace9Key", "Mod1+9", (void *)WKBD_WORKSPACE9
,
720 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
721 {"Workspace10Key", "Mod1+0", (void *)WKBD_WORKSPACE10
,
722 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
723 {"MoveToWorkspace1Key", "None", (void *)WKBD_MOVE_WORKSPACE1
,
724 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
725 {"MoveToWorkspace2Key", "None", (void *)WKBD_MOVE_WORKSPACE2
,
726 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
727 {"MoveToWorkspace3Key", "None", (void *)WKBD_MOVE_WORKSPACE3
,
728 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
729 {"MoveToWorkspace4Key", "None", (void *)WKBD_MOVE_WORKSPACE4
,
730 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
731 {"MoveToWorkspace5Key", "None", (void *)WKBD_MOVE_WORKSPACE5
,
732 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
733 {"MoveToWorkspace6Key", "None", (void *)WKBD_MOVE_WORKSPACE6
,
734 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
735 {"MoveToWorkspace7Key", "None", (void *)WKBD_MOVE_WORKSPACE7
,
736 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
737 {"MoveToWorkspace8Key", "None", (void *)WKBD_MOVE_WORKSPACE8
,
738 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
739 {"MoveToWorkspace9Key", "None", (void *)WKBD_MOVE_WORKSPACE9
,
740 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
741 {"MoveToWorkspace10Key", "None", (void *)WKBD_MOVE_WORKSPACE10
,
742 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
743 {"MoveToNextWorkspaceKey", "None", (void *)WKBD_MOVE_NEXTWORKSPACE
,
744 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
745 {"MoveToPrevWorkspaceKey", "None", (void *)WKBD_MOVE_PREVWORKSPACE
,
746 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
747 {"MoveToLastWorkspaceKey", "None", (void *)WKBD_MOVE_LASTWORKSPACE
,
748 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
749 {"MoveToNextWorkspaceLayerKey", "None", (void *)WKBD_MOVE_NEXTWSLAYER
,
750 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
751 {"MoveToPrevWorkspaceLayerKey", "None", (void *)WKBD_MOVE_PREVWSLAYER
,
752 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
753 {"WindowShortcut1Key", "None", (void *)WKBD_WINDOW1
,
754 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
755 {"WindowShortcut2Key", "None", (void *)WKBD_WINDOW2
,
756 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
757 {"WindowShortcut3Key", "None", (void *)WKBD_WINDOW3
,
758 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
759 {"WindowShortcut4Key", "None", (void *)WKBD_WINDOW4
,
760 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
761 {"WindowShortcut5Key", "None", (void *)WKBD_WINDOW5
,
762 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
763 {"WindowShortcut6Key", "None", (void *)WKBD_WINDOW6
,
764 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
765 {"WindowShortcut7Key", "None", (void *)WKBD_WINDOW7
,
766 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
767 {"WindowShortcut8Key", "None", (void *)WKBD_WINDOW8
,
768 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
769 {"WindowShortcut9Key", "None", (void *)WKBD_WINDOW9
,
770 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
771 {"WindowShortcut10Key", "None", (void *)WKBD_WINDOW10
,
772 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
773 {"MoveTo12to6Head", "None", (void *)WKBD_MOVE_12_TO_6_HEAD
,
774 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
775 {"MoveTo6to12Head", "None", (void *)WKBD_MOVE_6_TO_12_HEAD
,
776 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
777 {"WindowRelaunchKey", "None", (void *)WKBD_RELAUNCH
,
778 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
779 {"ScreenSwitchKey", "None", (void *)WKBD_SWITCH_SCREEN
,
780 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
781 {"RunKey", "None", (void *)WKBD_RUN
,
782 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
784 #ifdef KEEP_XKB_LOCK_STATUS
785 {"ToggleKbdModeKey", "None", (void *)WKBD_TOGGLE
,
786 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
787 {"KbdModeLock", "NO", NULL
,
788 &wPreferences
.modelock
, getBool
, NULL
, NULL
, NULL
},
789 #endif /* KEEP_XKB_LOCK_STATUS */
791 {"NormalCursor", "(builtin, left_ptr)", (void *)WCUR_ROOT
,
792 NULL
, getCursor
, setCursor
, NULL
, NULL
},
793 {"ArrowCursor", "(builtin, top_left_arrow)", (void *)WCUR_ARROW
,
794 NULL
, getCursor
, setCursor
, NULL
, NULL
},
795 {"MoveCursor", "(builtin, fleur)", (void *)WCUR_MOVE
,
796 NULL
, getCursor
, setCursor
, NULL
, NULL
},
797 {"ResizeCursor", "(builtin, sizing)", (void *)WCUR_RESIZE
,
798 NULL
, getCursor
, setCursor
, NULL
, NULL
},
799 {"TopLeftResizeCursor", "(builtin, top_left_corner)", (void *)WCUR_TOPLEFTRESIZE
,
800 NULL
, getCursor
, setCursor
, NULL
, NULL
},
801 {"TopRightResizeCursor", "(builtin, top_right_corner)", (void *)WCUR_TOPRIGHTRESIZE
,
802 NULL
, getCursor
, setCursor
, NULL
, NULL
},
803 {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)", (void *)WCUR_BOTTOMLEFTRESIZE
,
804 NULL
, getCursor
, setCursor
, NULL
, NULL
},
805 {"BottomRightResizeCursor", "(builtin, bottom_right_corner)", (void *)WCUR_BOTTOMRIGHTRESIZE
,
806 NULL
, getCursor
, setCursor
, NULL
, NULL
},
807 {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)", (void *)WCUR_VERTICALRESIZE
,
808 NULL
, getCursor
, setCursor
, NULL
, NULL
},
809 {"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)", (void *)WCUR_HORIZONRESIZE
,
810 NULL
, getCursor
, setCursor
, NULL
, NULL
},
811 {"WaitCursor", "(builtin, watch)", (void *)WCUR_WAIT
,
812 NULL
, getCursor
, setCursor
, NULL
, NULL
},
813 {"QuestionCursor", "(builtin, question_arrow)", (void *)WCUR_QUESTION
,
814 NULL
, getCursor
, setCursor
, NULL
, NULL
},
815 {"TextCursor", "(builtin, xterm)", (void *)WCUR_TEXT
,
816 NULL
, getCursor
, setCursor
, NULL
, NULL
},
817 {"SelectCursor", "(builtin, cross)", (void *)WCUR_SELECT
,
818 NULL
, getCursor
, setCursor
, NULL
, NULL
},
819 {"DialogHistoryLines", "500", NULL
,
820 &wPreferences
.history_lines
, getInt
, NULL
, NULL
, NULL
},
821 {"CycleActiveHeadOnly", "NO", NULL
,
822 &wPreferences
.cycle_active_head_only
, getBool
, NULL
, NULL
, NULL
},
823 {"CycleIgnoreMinimized", "NO", NULL
,
824 &wPreferences
.cycle_ignore_minimized
, getBool
, NULL
, NULL
, NULL
}
827 static void initDefaults(void)
830 WDefaultEntry
*entry
;
832 WMPLSetCaseSensitive(False
);
834 for (i
= 0; i
< wlengthof(optionList
); i
++) {
835 entry
= &optionList
[i
];
837 entry
->plkey
= WMCreatePLString(entry
->key
);
838 if (entry
->default_value
)
839 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
841 entry
->plvalue
= NULL
;
844 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
845 entry
= &staticOptionList
[i
];
847 entry
->plkey
= WMCreatePLString(entry
->key
);
848 if (entry
->default_value
)
849 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
851 entry
->plvalue
= NULL
;
855 static WMPropList
*readGlobalDomain(const char *domainName
, Bool requireDictionary
)
857 WMPropList
*globalDict
= NULL
;
861 snprintf(path
, sizeof(path
), "%s/%s", DEFSDATADIR
, domainName
);
862 if (stat(path
, &stbuf
) >= 0) {
863 globalDict
= WMReadPropListFromFile(path
);
864 if (globalDict
&& requireDictionary
&& !WMIsPLDictionary(globalDict
)) {
865 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"), domainName
, path
);
866 WMReleasePropList(globalDict
);
868 } else if (!globalDict
) {
869 wwarning(_("could not load domain %s from global defaults database"), domainName
);
876 #if defined(GLOBAL_PREAMBLE_MENU_FILE) || defined(GLOBAL_EPILOGUE_MENU_FILE)
877 static void prependMenu(WMPropList
* destarr
, WMPropList
* array
)
882 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
883 item
= WMGetFromPLArray(array
, i
);
885 WMInsertInPLArray(destarr
, i
+ 1, item
);
889 static void appendMenu(WMPropList
* destarr
, WMPropList
* array
)
894 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
895 item
= WMGetFromPLArray(array
, i
);
897 WMAddToPLArray(destarr
, item
);
902 void wDefaultsMergeGlobalMenus(WDDomain
* menuDomain
)
904 WMPropList
*menu
= menuDomain
->dictionary
;
907 if (!menu
|| !WMIsPLArray(menu
))
910 #ifdef GLOBAL_PREAMBLE_MENU_FILE
911 submenu
= WMReadPropListFromFile(DEFSDATADIR
"/" GLOBAL_PREAMBLE_MENU_FILE
);
913 if (submenu
&& !WMIsPLArray(submenu
)) {
914 wwarning(_("invalid global menu file %s"), GLOBAL_PREAMBLE_MENU_FILE
);
915 WMReleasePropList(submenu
);
919 prependMenu(menu
, submenu
);
920 WMReleasePropList(submenu
);
924 #ifdef GLOBAL_EPILOGUE_MENU_FILE
925 submenu
= WMReadPropListFromFile(DEFSDATADIR
"/" GLOBAL_EPILOGUE_MENU_FILE
);
927 if (submenu
&& !WMIsPLArray(submenu
)) {
928 wwarning(_("invalid global menu file %s"), GLOBAL_EPILOGUE_MENU_FILE
);
929 WMReleasePropList(submenu
);
933 appendMenu(menu
, submenu
);
934 WMReleasePropList(submenu
);
938 menuDomain
->dictionary
= menu
;
941 WDDomain
*wDefaultsInitDomain(const char *domain
, Bool requireDictionary
)
945 static int inited
= 0;
946 WMPropList
*shared_dict
= NULL
;
953 db
= wmalloc(sizeof(WDDomain
));
954 db
->domain_name
= domain
;
955 db
->path
= wdefaultspathfordomain(domain
);
957 if (stat(db
->path
, &stbuf
) >= 0) {
958 db
->dictionary
= WMReadPropListFromFile(db
->path
);
959 if (db
->dictionary
) {
960 if (requireDictionary
&& !WMIsPLDictionary(db
->dictionary
)) {
961 WMReleasePropList(db
->dictionary
);
962 db
->dictionary
= NULL
;
963 wwarning(_("Domain %s (%s) of defaults database is corrupted!"), domain
, db
->path
);
965 db
->timestamp
= stbuf
.st_mtime
;
967 wwarning(_("could not load domain %s from user defaults database"), domain
);
971 /* global system dictionary */
972 shared_dict
= readGlobalDomain(domain
, requireDictionary
);
974 if (shared_dict
&& db
->dictionary
&& WMIsPLDictionary(shared_dict
) &&
975 WMIsPLDictionary(db
->dictionary
)) {
976 WMMergePLDictionaries(shared_dict
, db
->dictionary
, True
);
977 WMReleasePropList(db
->dictionary
);
978 db
->dictionary
= shared_dict
;
979 if (stbuf
.st_mtime
> db
->timestamp
)
980 db
->timestamp
= stbuf
.st_mtime
;
981 } else if (!db
->dictionary
) {
982 db
->dictionary
= shared_dict
;
983 if (stbuf
.st_mtime
> db
->timestamp
)
984 db
->timestamp
= stbuf
.st_mtime
;
990 void wReadStaticDefaults(WMPropList
* dict
)
993 WDefaultEntry
*entry
;
997 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
998 entry
= &staticOptionList
[i
];
1001 plvalue
= WMGetFromPLDictionary(dict
, entry
->plkey
);
1005 /* no default in the DB. Use builtin default */
1007 plvalue
= entry
->plvalue
;
1011 (*entry
->convert
) (NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
1013 (*entry
->update
) (NULL
, entry
, tdata
, entry
->extra_data
);
1018 void wDefaultsCheckDomains(void* arg
)
1022 WMPropList
*shared_dict
= NULL
;
1026 /* Parameter not used, but tell the compiler that it is ok */
1029 if (stat(w_global
.domain
.wmaker
->path
, &stbuf
) >= 0 && w_global
.domain
.wmaker
->timestamp
< stbuf
.st_mtime
) {
1030 w_global
.domain
.wmaker
->timestamp
= stbuf
.st_mtime
;
1032 /* Global dictionary */
1033 shared_dict
= readGlobalDomain("WindowMaker", True
);
1035 /* User dictionary */
1036 dict
= WMReadPropListFromFile(w_global
.domain
.wmaker
->path
);
1039 if (!WMIsPLDictionary(dict
)) {
1040 WMReleasePropList(dict
);
1042 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1043 "WindowMaker", w_global
.domain
.wmaker
->path
);
1046 WMMergePLDictionaries(shared_dict
, dict
, True
);
1047 WMReleasePropList(dict
);
1052 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1053 scr
= wScreenWithNumber(i
);
1055 wReadDefaults(scr
, dict
);
1058 if (w_global
.domain
.wmaker
->dictionary
)
1059 WMReleasePropList(w_global
.domain
.wmaker
->dictionary
);
1061 w_global
.domain
.wmaker
->dictionary
= dict
;
1064 wwarning(_("could not load domain %s from user defaults database"), "WindowMaker");
1068 WMReleasePropList(shared_dict
);
1072 if (stat(w_global
.domain
.window_attr
->path
, &stbuf
) >= 0 && w_global
.domain
.window_attr
->timestamp
< stbuf
.st_mtime
) {
1073 /* global dictionary */
1074 shared_dict
= readGlobalDomain("WMWindowAttributes", True
);
1075 /* user dictionary */
1076 dict
= WMReadPropListFromFile(w_global
.domain
.window_attr
->path
);
1078 if (!WMIsPLDictionary(dict
)) {
1079 WMReleasePropList(dict
);
1081 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1082 "WMWindowAttributes", w_global
.domain
.window_attr
->path
);
1085 WMMergePLDictionaries(shared_dict
, dict
, True
);
1086 WMReleasePropList(dict
);
1091 if (w_global
.domain
.window_attr
->dictionary
)
1092 WMReleasePropList(w_global
.domain
.window_attr
->dictionary
);
1094 w_global
.domain
.window_attr
->dictionary
= dict
;
1095 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1096 scr
= wScreenWithNumber(i
);
1098 wDefaultUpdateIcons(scr
);
1100 /* Update the panel image if changed */
1101 /* Don't worry. If the image is the same these
1102 * functions will have no performance impact. */
1103 create_logo_image(scr
);
1108 wwarning(_("could not load domain %s from user defaults database"), "WMWindowAttributes");
1111 w_global
.domain
.window_attr
->timestamp
= stbuf
.st_mtime
;
1113 WMReleasePropList(shared_dict
);
1116 if (stat(w_global
.domain
.root_menu
->path
, &stbuf
) >= 0 && w_global
.domain
.root_menu
->timestamp
< stbuf
.st_mtime
) {
1117 dict
= WMReadPropListFromFile(w_global
.domain
.root_menu
->path
);
1119 if (!WMIsPLArray(dict
) && !WMIsPLString(dict
)) {
1120 WMReleasePropList(dict
);
1122 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1123 "WMRootMenu", w_global
.domain
.root_menu
->path
);
1125 if (w_global
.domain
.root_menu
->dictionary
)
1126 WMReleasePropList(w_global
.domain
.root_menu
->dictionary
);
1128 w_global
.domain
.root_menu
->dictionary
= dict
;
1129 wDefaultsMergeGlobalMenus(w_global
.domain
.root_menu
);
1132 wwarning(_("could not load domain %s from user defaults database"), "WMRootMenu");
1134 w_global
.domain
.root_menu
->timestamp
= stbuf
.st_mtime
;
1136 #ifndef HAVE_INOTIFY
1138 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, arg
);
1142 void wReadDefaults(WScreen
* scr
, WMPropList
* new_dict
)
1144 WMPropList
*plvalue
, *old_value
;
1145 WDefaultEntry
*entry
;
1147 int update_workspace_back
= 0; /* kluge :/ */
1148 unsigned int needs_refresh
;
1150 WMPropList
*old_dict
= (w_global
.domain
.wmaker
->dictionary
!= new_dict
? w_global
.domain
.wmaker
->dictionary
: NULL
);
1154 for (i
= 0; i
< wlengthof(optionList
); i
++) {
1155 entry
= &optionList
[i
];
1158 plvalue
= WMGetFromPLDictionary(new_dict
, entry
->plkey
);
1165 old_value
= WMGetFromPLDictionary(old_dict
, entry
->plkey
);
1167 if (!plvalue
&& !old_value
) {
1168 /* no default in the DB. Use builtin default */
1169 plvalue
= entry
->plvalue
;
1170 if (plvalue
&& new_dict
)
1171 WMPutInPLDictionary(new_dict
, entry
->plkey
, plvalue
);
1173 } else if (!plvalue
) {
1174 /* value was deleted from DB. Keep current value */
1176 } else if (!old_value
) {
1177 /* set value for the 1st time */
1178 } else if (!WMIsPropListEqualTo(plvalue
, old_value
)) {
1179 /* value has changed */
1181 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1182 && update_workspace_back
&& scr
->flags
.backimage_helper_launched
) {
1184 /* value was not changed since last time */
1191 if ((*entry
->convert
) (scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1193 * If the WorkspaceSpecificBack data has been changed
1194 * so that the helper will be launched now, we must be
1195 * sure to send the default background texture config
1198 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0 &&
1199 !scr
->flags
.backimage_helper_launched
)
1200 update_workspace_back
= 1;
1203 needs_refresh
|= (*entry
->update
) (scr
, entry
, tdata
, entry
->extra_data
);
1209 if (needs_refresh
!= 0 && !scr
->flags
.startup
) {
1213 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1214 foo
|= WTextureSettings
;
1215 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1216 foo
|= WFontSettings
;
1217 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1218 foo
|= WColorSettings
;
1220 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1221 (void *)(uintptr_t) foo
);
1224 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1225 foo
|= WTextureSettings
;
1226 if (needs_refresh
& REFRESH_MENU_FONT
)
1227 foo
|= WFontSettings
;
1228 if (needs_refresh
& REFRESH_MENU_COLOR
)
1229 foo
|= WColorSettings
;
1231 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1234 if (needs_refresh
& REFRESH_WINDOW_FONT
)
1235 foo
|= WFontSettings
;
1236 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
)
1237 foo
|= WTextureSettings
;
1238 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
)
1239 foo
|= WColorSettings
;
1241 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1243 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1245 if (needs_refresh
& REFRESH_ICON_FONT
)
1246 foo
|= WFontSettings
;
1247 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
)
1248 foo
|= WTextureSettings
;
1249 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
)
1250 foo
|= WTextureSettings
;
1252 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1253 (void *)(uintptr_t) foo
);
1255 if (needs_refresh
& REFRESH_ICON_TILE
)
1256 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1258 if (needs_refresh
& REFRESH_WORKSPACE_MENU
) {
1259 if (scr
->workspace_menu
)
1260 wWorkspaceMenuUpdate(scr
, scr
->workspace_menu
);
1261 if (scr
->clip_ws_menu
)
1262 wWorkspaceMenuUpdate(scr
, scr
->clip_ws_menu
);
1263 if (scr
->workspace_submenu
)
1264 scr
->workspace_submenu
->flags
.realized
= 0;
1265 if (scr
->clip_submenu
)
1266 scr
->clip_submenu
->flags
.realized
= 0;
1271 void wDefaultUpdateIcons(WScreen
*scr
)
1273 WAppIcon
*aicon
= scr
->app_icon_list
;
1275 WWindow
*wwin
= scr
->focused_window
;
1278 /* Get the application icon, default included */
1279 wIconChangeImageFile(aicon
->icon
, NULL
);
1280 wAppIconPaint(aicon
);
1281 aicon
= aicon
->next
;
1284 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
)
1285 wClipIconPaint(scr
->clip_icon
);
1287 for (dc
= scr
->drawers
; dc
!= NULL
; dc
= dc
->next
)
1288 wDrawerIconPaint(dc
->adrawer
->icon_array
[0]);
1291 if (wwin
->icon
&& wwin
->flags
.miniaturized
)
1292 wIconChangeImageFile(wwin
->icon
, NULL
);
1297 /* --------------------------- Local ----------------------- */
1299 #define GET_STRING_OR_DEFAULT(x, var) if (!WMIsPLString(value)) { \
1300 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1302 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1303 var = entry->default_value;\
1304 } else var = WMGetFromPLString(value)\
1307 static int string2index(WMPropList *key, WMPropList *val, const char *def, WOptionEnumeration * values)
1310 WOptionEnumeration
*v
;
1311 char buffer
[TOTAL_VALUES_LENGTH
];
1313 if (WMIsPLString(val
) && (str
= WMGetFromPLString(val
))) {
1314 for (v
= values
; v
->string
!= NULL
; v
++) {
1315 if (strcasecmp(v
->string
, str
) == 0)
1321 for (v
= values
; v
->string
!= NULL
; v
++) {
1324 strcat(buffer
, ", ");
1325 snprintf(buffer
+strlen(buffer
),
1326 sizeof(buffer
)-strlen(buffer
)-1, "\"%s\"", v
->string
);
1329 wwarning(_("wrong option value for key \"%s\"; got \"%s\", should be one of %s."),
1330 WMGetFromPLString(key
),
1331 WMIsPLString(val
) ? WMGetFromPLString(val
) : "(unknown)",
1335 return string2index(key
, val
, NULL
, values
);
1342 * value - is the value in the defaults DB
1343 * addr - is the address to store the data
1344 * ret - is the address to store a pointer to a temporary buffer. ret
1345 * must not be freed and is used by the set functions
1347 static int getBool(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1351 int second_pass
= 0;
1353 /* Parameter not used, but tell the compiler that it is ok */
1356 GET_STRING_OR_DEFAULT("Boolean", val
);
1359 if ((val
[1] == '\0' && (val
[0] == 'y' || val
[0] == 'Y'))
1360 || strcasecmp(val
, "YES") == 0) {
1363 } else if ((val
[1] == '\0' && (val
[0] == 'n' || val
[0] == 'N'))
1364 || strcasecmp(val
, "NO") == 0) {
1368 if (sscanf(val
, "%i", &i
) == 1) {
1374 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""), val
, entry
->key
);
1375 if (second_pass
== 0) {
1376 val
= WMGetFromPLString(entry
->plvalue
);
1378 wwarning(_("using default \"%s\" instead"), val
);
1388 *(char *)addr
= data
;
1393 static int getInt(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1398 /* Parameter not used, but tell the compiler that it is ok */
1401 GET_STRING_OR_DEFAULT("Integer", val
);
1403 if (sscanf(val
, "%i", &data
) != 1) {
1404 wwarning(_("can't convert \"%s\" to integer for key \"%s\""), val
, entry
->key
);
1405 val
= WMGetFromPLString(entry
->plvalue
);
1406 wwarning(_("using default \"%s\" instead"), val
);
1407 if (sscanf(val
, "%i", &data
) != 1) {
1415 *(int *)addr
= data
;
1420 static int getCoord(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1423 char *val_x
, *val_y
;
1424 int nelem
, changed
= 0;
1425 WMPropList
*elem_x
, *elem_y
;
1428 if (!WMIsPLArray(value
)) {
1429 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Coordinate");
1431 value
= entry
->plvalue
;
1433 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1439 nelem
= WMGetPropListItemCount(value
);
1441 wwarning(_("Incorrect number of elements in array for key \"%s\"."), entry
->key
);
1443 value
= entry
->plvalue
;
1445 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1451 elem_x
= WMGetFromPLArray(value
, 0);
1452 elem_y
= WMGetFromPLArray(value
, 1);
1454 if (!elem_x
|| !elem_y
|| !WMIsPLString(elem_x
) || !WMIsPLString(elem_y
)) {
1455 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."), entry
->key
);
1457 value
= entry
->plvalue
;
1459 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1465 val_x
= WMGetFromPLString(elem_x
);
1466 val_y
= WMGetFromPLString(elem_y
);
1468 if (sscanf(val_x
, "%i", &data
.x
) != 1 || sscanf(val_y
, "%i", &data
.y
) != 1) {
1469 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1471 value
= entry
->plvalue
;
1473 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1481 else if (data
.x
> scr
->scr_width
/ 3)
1482 data
.x
= scr
->scr_width
/ 3;
1485 else if (data
.y
> scr
->scr_height
/ 3)
1486 data
.y
= scr
->scr_height
/ 3;
1491 *(WCoord
*) addr
= data
;
1496 static int getPropList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1498 /* Parameter not used, but tell the compiler that it is ok */
1503 WMRetainPropList(value
);
1510 static int getPathList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1518 /* Parameter not used, but tell the compiler that it is ok */
1523 if (!WMIsPLArray(value
)) {
1524 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "an array of paths");
1526 value
= entry
->plvalue
;
1528 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1535 count
= WMGetPropListItemCount(value
);
1538 value
= entry
->plvalue
;
1540 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1547 for (i
= 0; i
< count
; i
++) {
1548 d
= WMGetFromPLArray(value
, i
);
1549 if (!d
|| !WMIsPLString(d
)) {
1553 len
+= strlen(WMGetFromPLString(d
)) + 1;
1556 ptr
= data
= wmalloc(len
+ 1);
1558 for (i
= 0; i
< count
; i
++) {
1559 d
= WMGetFromPLArray(value
, i
);
1560 if (!d
|| !WMIsPLString(d
)) {
1563 strcpy(ptr
, WMGetFromPLString(d
));
1564 ptr
+= strlen(WMGetFromPLString(d
));
1571 if (*(char **)addr
!= NULL
) {
1572 wfree(*(char **)addr
);
1574 *(char **)addr
= data
;
1579 static int getEnum(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1581 static signed char data
;
1583 /* Parameter not used, but tell the compiler that it is ok */
1586 data
= string2index(entry
->plkey
, value
, entry
->default_value
, (WOptionEnumeration
*) entry
->extra_data
);
1593 *(signed char *)addr
= data
;
1600 * (hgradient <color> <color>)
1601 * (vgradient <color> <color>)
1602 * (dgradient <color> <color>)
1603 * (mhgradient <color> <color> ...)
1604 * (mvgradient <color> <color> ...)
1605 * (mdgradient <color> <color> ...)
1606 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1607 * (tpixmap <file> <color>)
1608 * (spixmap <file> <color>)
1609 * (cpixmap <file> <color>)
1610 * (thgradient <file> <opaqueness> <color> <color>)
1611 * (tvgradient <file> <opaqueness> <color> <color>)
1612 * (tdgradient <file> <opaqueness> <color> <color>)
1613 * (function <lib> <function> ...)
1616 static WTexture
*parse_texture(WScreen
* scr
, WMPropList
* pl
)
1621 WTexture
*texture
= NULL
;
1623 nelem
= WMGetPropListItemCount(pl
);
1627 elem
= WMGetFromPLArray(pl
, 0);
1628 if (!elem
|| !WMIsPLString(elem
))
1630 val
= WMGetFromPLString(elem
);
1632 if (strcasecmp(val
, "solid") == 0) {
1640 elem
= WMGetFromPLArray(pl
, 1);
1641 if (!elem
|| !WMIsPLString(elem
))
1643 val
= WMGetFromPLString(elem
);
1645 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1646 wwarning(_("\"%s\" is not a valid color name"), val
);
1650 texture
= (WTexture
*) wTextureMakeSolid(scr
, &color
);
1651 } else if (strcasecmp(val
, "dgradient") == 0
1652 || strcasecmp(val
, "vgradient") == 0 || strcasecmp(val
, "hgradient") == 0) {
1653 RColor color1
, color2
;
1658 wwarning(_("bad number of arguments in gradient specification"));
1662 if (val
[0] == 'd' || val
[0] == 'D')
1663 type
= WTEX_DGRADIENT
;
1664 else if (val
[0] == 'h' || val
[0] == 'H')
1665 type
= WTEX_HGRADIENT
;
1667 type
= WTEX_VGRADIENT
;
1669 /* get from color */
1670 elem
= WMGetFromPLArray(pl
, 1);
1671 if (!elem
|| !WMIsPLString(elem
))
1673 val
= WMGetFromPLString(elem
);
1675 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1676 wwarning(_("\"%s\" is not a valid color name"), val
);
1680 color1
.red
= xcolor
.red
>> 8;
1681 color1
.green
= xcolor
.green
>> 8;
1682 color1
.blue
= xcolor
.blue
>> 8;
1685 elem
= WMGetFromPLArray(pl
, 2);
1686 if (!elem
|| !WMIsPLString(elem
)) {
1689 val
= WMGetFromPLString(elem
);
1691 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1692 wwarning(_("\"%s\" is not a valid color name"), val
);
1696 color2
.red
= xcolor
.red
>> 8;
1697 color2
.green
= xcolor
.green
>> 8;
1698 color2
.blue
= xcolor
.blue
>> 8;
1700 texture
= (WTexture
*) wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1702 } else if (strcasecmp(val
, "igradient") == 0) {
1703 RColor colors1
[2], colors2
[2];
1709 wwarning(_("bad number of arguments in gradient specification"));
1713 /* get from color */
1714 for (i
= 0; i
< 2; i
++) {
1715 elem
= WMGetFromPLArray(pl
, 1 + i
);
1716 if (!elem
|| !WMIsPLString(elem
))
1718 val
= WMGetFromPLString(elem
);
1720 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1721 wwarning(_("\"%s\" is not a valid color name"), val
);
1724 colors1
[i
].alpha
= 255;
1725 colors1
[i
].red
= xcolor
.red
>> 8;
1726 colors1
[i
].green
= xcolor
.green
>> 8;
1727 colors1
[i
].blue
= xcolor
.blue
>> 8;
1729 elem
= WMGetFromPLArray(pl
, 3);
1730 if (!elem
|| !WMIsPLString(elem
))
1732 val
= WMGetFromPLString(elem
);
1735 /* get from color */
1736 for (i
= 0; i
< 2; i
++) {
1737 elem
= WMGetFromPLArray(pl
, 4 + i
);
1738 if (!elem
|| !WMIsPLString(elem
))
1740 val
= WMGetFromPLString(elem
);
1742 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1743 wwarning(_("\"%s\" is not a valid color name"), val
);
1746 colors2
[i
].alpha
= 255;
1747 colors2
[i
].red
= xcolor
.red
>> 8;
1748 colors2
[i
].green
= xcolor
.green
>> 8;
1749 colors2
[i
].blue
= xcolor
.blue
>> 8;
1751 elem
= WMGetFromPLArray(pl
, 6);
1752 if (!elem
|| !WMIsPLString(elem
))
1754 val
= WMGetFromPLString(elem
);
1757 texture
= (WTexture
*) wTextureMakeIGradient(scr
, th1
, colors1
, th2
, colors2
);
1759 } else if (strcasecmp(val
, "mhgradient") == 0
1760 || strcasecmp(val
, "mvgradient") == 0 || strcasecmp(val
, "mdgradient") == 0) {
1767 wwarning(_("too few arguments in multicolor gradient specification"));
1771 if (val
[1] == 'h' || val
[1] == 'H')
1772 type
= WTEX_MHGRADIENT
;
1773 else if (val
[1] == 'v' || val
[1] == 'V')
1774 type
= WTEX_MVGRADIENT
;
1776 type
= WTEX_MDGRADIENT
;
1780 colors
= wmalloc(sizeof(RColor
*) * (count
+ 1));
1782 for (i
= 0; i
< count
; i
++) {
1783 elem
= WMGetFromPLArray(pl
, i
+ 1);
1784 if (!elem
|| !WMIsPLString(elem
)) {
1785 for (--i
; i
>= 0; --i
) {
1791 val
= WMGetFromPLString(elem
);
1793 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1794 wwarning(_("\"%s\" is not a valid color name"), val
);
1795 for (--i
; i
>= 0; --i
) {
1801 colors
[i
] = wmalloc(sizeof(RColor
));
1802 colors
[i
]->red
= color
.red
>> 8;
1803 colors
[i
]->green
= color
.green
>> 8;
1804 colors
[i
]->blue
= color
.blue
>> 8;
1809 texture
= (WTexture
*) wTextureMakeMGradient(scr
, type
, colors
);
1810 } else if (strcasecmp(val
, "spixmap") == 0 ||
1811 strcasecmp(val
, "cpixmap") == 0 || strcasecmp(val
, "tpixmap") == 0) {
1818 if (val
[0] == 's' || val
[0] == 'S')
1820 else if (val
[0] == 'c' || val
[0] == 'C')
1826 elem
= WMGetFromPLArray(pl
, 2);
1827 if (!elem
|| !WMIsPLString(elem
)) {
1830 val
= WMGetFromPLString(elem
);
1832 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1833 wwarning(_("\"%s\" is not a valid color name"), val
);
1838 elem
= WMGetFromPLArray(pl
, 1);
1839 if (!elem
|| !WMIsPLString(elem
))
1841 val
= WMGetFromPLString(elem
);
1843 texture
= (WTexture
*) wTextureMakePixmap(scr
, type
, val
, &color
);
1844 } else if (strcasecmp(val
, "thgradient") == 0
1845 || strcasecmp(val
, "tvgradient") == 0 || strcasecmp(val
, "tdgradient") == 0) {
1846 RColor color1
, color2
;
1851 if (val
[1] == 'h' || val
[1] == 'H')
1852 style
= WTEX_THGRADIENT
;
1853 else if (val
[1] == 'v' || val
[1] == 'V')
1854 style
= WTEX_TVGRADIENT
;
1856 style
= WTEX_TDGRADIENT
;
1859 wwarning(_("bad number of arguments in textured gradient specification"));
1863 /* get from color */
1864 elem
= WMGetFromPLArray(pl
, 3);
1865 if (!elem
|| !WMIsPLString(elem
))
1867 val
= WMGetFromPLString(elem
);
1869 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1870 wwarning(_("\"%s\" is not a valid color name"), val
);
1874 color1
.red
= xcolor
.red
>> 8;
1875 color1
.green
= xcolor
.green
>> 8;
1876 color1
.blue
= xcolor
.blue
>> 8;
1879 elem
= WMGetFromPLArray(pl
, 4);
1880 if (!elem
|| !WMIsPLString(elem
)) {
1883 val
= WMGetFromPLString(elem
);
1885 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1886 wwarning(_("\"%s\" is not a valid color name"), val
);
1890 color2
.red
= xcolor
.red
>> 8;
1891 color2
.green
= xcolor
.green
>> 8;
1892 color2
.blue
= xcolor
.blue
>> 8;
1895 elem
= WMGetFromPLArray(pl
, 2);
1896 if (!elem
|| !WMIsPLString(elem
))
1899 val
= WMGetFromPLString(elem
);
1901 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
1902 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
1907 elem
= WMGetFromPLArray(pl
, 1);
1908 if (!elem
|| !WMIsPLString(elem
))
1910 val
= WMGetFromPLString(elem
);
1912 texture
= (WTexture
*) wTextureMakeTGradient(scr
, style
, &color1
, &color2
, val
, opacity
);
1913 } else if (strcasecmp(val
, "function") == 0) {
1914 /* Leave this in to handle the unlikely case of
1915 * someone actually having function textures configured */
1916 wwarning("function texture support has been removed");
1919 wwarning(_("invalid texture type %s"), val
);
1925 static int getTexture(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1927 static WTexture
*texture
;
1931 if (!WMIsPLArray(value
)) {
1932 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Texture");
1934 value
= entry
->plvalue
;
1936 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1942 if (strcmp(entry
->key
, "WidgetColor") == 0 && !changed
) {
1945 pl
= WMGetFromPLArray(value
, 0);
1946 if (!pl
|| !WMIsPLString(pl
) || !WMGetFromPLString(pl
)
1947 || strcasecmp(WMGetFromPLString(pl
), "solid") != 0) {
1948 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1949 entry
->key
, "Solid Texture");
1951 value
= entry
->plvalue
;
1953 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1958 texture
= parse_texture(scr
, value
);
1961 wwarning(_("Error in texture specification for key \"%s\""), entry
->key
);
1963 value
= entry
->plvalue
;
1965 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1975 *(WTexture
**) addr
= texture
;
1980 static int getWSBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1987 /* Parameter not used, but tell the compiler that it is ok */
1992 if (!WMIsPLArray(value
)) {
1993 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1994 "WorkspaceBack", "Texture or None");
1996 value
= entry
->plvalue
;
1998 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2004 /* only do basic error checking and verify for None texture */
2006 nelem
= WMGetPropListItemCount(value
);
2008 elem
= WMGetFromPLArray(value
, 0);
2009 if (!elem
|| !WMIsPLString(elem
)) {
2010 wwarning(_("Wrong type for workspace background. Should be a texture type."));
2012 value
= entry
->plvalue
;
2014 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2019 val
= WMGetFromPLString(elem
);
2021 if (strcasecmp(val
, "None") == 0)
2024 *ret
= WMRetainPropList(value
);
2030 getWSSpecificBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2036 /* Parameter not used, but tell the compiler that it is ok */
2041 if (!WMIsPLArray(value
)) {
2042 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2043 "WorkspaceSpecificBack", "an array of textures");
2045 value
= entry
->plvalue
;
2047 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2053 /* only do basic error checking and verify for None texture */
2055 nelem
= WMGetPropListItemCount(value
);
2058 elem
= WMGetFromPLArray(value
, nelem
);
2059 if (!elem
|| !WMIsPLArray(elem
)) {
2060 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2066 *ret
= WMRetainPropList(value
);
2070 * Kluge to force wmsetbg helper to set the default background.
2071 * If the WorkspaceSpecificBack is changed once wmaker has started,
2072 * the WorkspaceBack won't be sent to the helper, unless the user
2073 * changes it's value too. So, we must force this by removing the
2074 * value from the defaults DB.
2076 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2077 WMPropList
*key
= WMCreatePLString("WorkspaceBack");
2079 WMRemoveFromPLDictionary(w_global
.domain
.wmaker
->dictionary
, key
);
2081 WMReleasePropList(key
);
2087 static int getFont(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2089 static WMFont
*font
;
2094 GET_STRING_OR_DEFAULT("Font", val
);
2096 font
= WMCreateFont(scr
->wmscreen
, val
);
2098 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2101 wfatal(_("could not load any usable font!!!"));
2108 /* can't assign font value outside update function */
2109 wassertrv(addr
== NULL
, True
);
2114 static int getColor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2116 static XColor color
;
2118 int second_pass
= 0;
2122 GET_STRING_OR_DEFAULT("Color", val
);
2125 if (!wGetColor(scr
, val
, &color
)) {
2126 wwarning(_("could not get color for key \"%s\""), entry
->key
);
2127 if (second_pass
== 0) {
2128 val
= WMGetFromPLString(entry
->plvalue
);
2130 wwarning(_("using default \"%s\" instead"), val
);
2139 assert(addr
== NULL
);
2142 *(unsigned long*)addr = pixel;
2148 static int getKeybind(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2150 static WShortKey shortcut
;
2154 char buf
[MAX_SHORTCUT_LENGTH
], *b
;
2156 /* Parameter not used, but tell the compiler that it is ok */
2160 GET_STRING_OR_DEFAULT("Key spec", val
);
2162 if (!val
|| strcasecmp(val
, "NONE") == 0) {
2163 shortcut
.keycode
= 0;
2164 shortcut
.modifier
= 0;
2170 wstrlcpy(buf
, val
, MAX_SHORTCUT_LENGTH
);
2175 shortcut
.modifier
= 0;
2176 while ((k
= strchr(b
, '+')) != NULL
) {
2180 mod
= wXModifierFromKey(b
);
2182 wwarning(_("%s: invalid key modifier \"%s\""), entry
->key
, b
);
2185 shortcut
.modifier
|= mod
;
2191 ksym
= XStringToKeysym(b
);
2193 if (ksym
== NoSymbol
) {
2194 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
, val
);
2198 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2199 if (shortcut
.keycode
== 0) {
2200 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2210 static int getModMask(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2215 /* Parameter not used, but tell the compiler that it is ok */
2218 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2223 mask
= wXModifierFromKey(str
);
2225 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2231 *(int *)addr
= mask
;
2239 # include <X11/cursorfont.h>
2245 #define CURSOR_ID_NONE (XC_num_glyphs)
2247 static const WCursorLookup cursor_table
[] = {
2248 {"X_cursor", XC_X_cursor
},
2249 {"arrow", XC_arrow
},
2250 {"based_arrow_down", XC_based_arrow_down
},
2251 {"based_arrow_up", XC_based_arrow_up
},
2253 {"bogosity", XC_bogosity
},
2254 {"bottom_left_corner", XC_bottom_left_corner
},
2255 {"bottom_right_corner", XC_bottom_right_corner
},
2256 {"bottom_side", XC_bottom_side
},
2257 {"bottom_tee", XC_bottom_tee
},
2258 {"box_spiral", XC_box_spiral
},
2259 {"center_ptr", XC_center_ptr
},
2260 {"circle", XC_circle
},
2261 {"clock", XC_clock
},
2262 {"coffee_mug", XC_coffee_mug
},
2263 {"cross", XC_cross
},
2264 {"cross_reverse", XC_cross_reverse
},
2265 {"crosshair", XC_crosshair
},
2266 {"diamond_cross", XC_diamond_cross
},
2268 {"dotbox", XC_dotbox
},
2269 {"double_arrow", XC_double_arrow
},
2270 {"draft_large", XC_draft_large
},
2271 {"draft_small", XC_draft_small
},
2272 {"draped_box", XC_draped_box
},
2273 {"exchange", XC_exchange
},
2274 {"fleur", XC_fleur
},
2275 {"gobbler", XC_gobbler
},
2276 {"gumby", XC_gumby
},
2277 {"hand1", XC_hand1
},
2278 {"hand2", XC_hand2
},
2279 {"heart", XC_heart
},
2281 {"iron_cross", XC_iron_cross
},
2282 {"left_ptr", XC_left_ptr
},
2283 {"left_side", XC_left_side
},
2284 {"left_tee", XC_left_tee
},
2285 {"leftbutton", XC_leftbutton
},
2286 {"ll_angle", XC_ll_angle
},
2287 {"lr_angle", XC_lr_angle
},
2289 {"middlebutton", XC_middlebutton
},
2290 {"mouse", XC_mouse
},
2291 {"pencil", XC_pencil
},
2292 {"pirate", XC_pirate
},
2294 {"question_arrow", XC_question_arrow
},
2295 {"right_ptr", XC_right_ptr
},
2296 {"right_side", XC_right_side
},
2297 {"right_tee", XC_right_tee
},
2298 {"rightbutton", XC_rightbutton
},
2299 {"rtl_logo", XC_rtl_logo
},
2300 {"sailboat", XC_sailboat
},
2301 {"sb_down_arrow", XC_sb_down_arrow
},
2302 {"sb_h_double_arrow", XC_sb_h_double_arrow
},
2303 {"sb_left_arrow", XC_sb_left_arrow
},
2304 {"sb_right_arrow", XC_sb_right_arrow
},
2305 {"sb_up_arrow", XC_sb_up_arrow
},
2306 {"sb_v_double_arrow", XC_sb_v_double_arrow
},
2307 {"shuttle", XC_shuttle
},
2308 {"sizing", XC_sizing
},
2309 {"spider", XC_spider
},
2310 {"spraycan", XC_spraycan
},
2312 {"target", XC_target
},
2313 {"tcross", XC_tcross
},
2314 {"top_left_arrow", XC_top_left_arrow
},
2315 {"top_left_corner", XC_top_left_corner
},
2316 {"top_right_corner", XC_top_right_corner
},
2317 {"top_side", XC_top_side
},
2318 {"top_tee", XC_top_tee
},
2320 {"ul_angle", XC_ul_angle
},
2321 {"umbrella", XC_umbrella
},
2322 {"ur_angle", XC_ur_angle
},
2323 {"watch", XC_watch
},
2324 {"xterm", XC_xterm
},
2325 {NULL
, CURSOR_ID_NONE
}
2328 static void check_bitmap_status(int status
, const char *filename
, Pixmap bitmap
)
2331 case BitmapOpenFailed
:
2332 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2334 case BitmapFileInvalid
:
2335 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2337 case BitmapNoMemory
:
2338 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2341 XFreePixmap(dpy
, bitmap
);
2348 * (builtin, <cursor_name>)
2349 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2351 static int parse_cursor(WScreen
* scr
, WMPropList
* pl
, Cursor
* cursor
)
2358 nelem
= WMGetPropListItemCount(pl
);
2362 elem
= WMGetFromPLArray(pl
, 0);
2363 if (!elem
|| !WMIsPLString(elem
)) {
2366 val
= WMGetFromPLString(elem
);
2368 if (strcasecmp(val
, "none") == 0) {
2371 } else if (strcasecmp(val
, "builtin") == 0) {
2373 int cursor_id
= CURSOR_ID_NONE
;
2376 wwarning(_("bad number of arguments in cursor specification"));
2379 elem
= WMGetFromPLArray(pl
, 1);
2380 if (!elem
|| !WMIsPLString(elem
)) {
2383 val
= WMGetFromPLString(elem
);
2385 for (i
= 0; cursor_table
[i
].name
!= NULL
; i
++) {
2386 if (strcasecmp(val
, cursor_table
[i
].name
) == 0) {
2387 cursor_id
= cursor_table
[i
].id
;
2391 if (CURSOR_ID_NONE
== cursor_id
) {
2392 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2394 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2397 } else if (strcasecmp(val
, "bitmap") == 0) {
2409 wwarning(_("bad number of arguments in cursor specification"));
2412 elem
= WMGetFromPLArray(pl
, 1);
2413 if (!elem
|| !WMIsPLString(elem
)) {
2416 val
= WMGetFromPLString(elem
);
2417 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2419 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2422 elem
= WMGetFromPLArray(pl
, 2);
2423 if (!elem
|| !WMIsPLString(elem
)) {
2427 val
= WMGetFromPLString(elem
);
2428 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2431 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2434 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
, &mask
, &x
, &y
);
2435 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
, &bitmap
, &x
, &y
);
2436 if ((BitmapSuccess
== bitmap_status
) && (BitmapSuccess
== mask_status
)) {
2437 fg
.pixel
= scr
->black_pixel
;
2438 bg
.pixel
= scr
->white_pixel
;
2439 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2440 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2441 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2444 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2445 check_bitmap_status(mask_status
, mask_name
, mask
);
2452 static int getCursor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2454 static Cursor cursor
;
2459 if (!WMIsPLArray(value
)) {
2460 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2461 entry
->key
, "cursor specification");
2463 value
= entry
->plvalue
;
2465 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2470 status
= parse_cursor(scr
, value
, &cursor
);
2472 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2474 value
= entry
->plvalue
;
2476 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2485 *(Cursor
*) addr
= cursor
;
2490 #undef CURSOR_ID_NONE
2492 /* ---------------- value setting functions --------------- */
2493 static int setJustify(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2495 /* Parameter not used, but tell the compiler that it is ok */
2501 return REFRESH_WINDOW_TITLE_COLOR
;
2504 static int setClearance(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2506 /* Parameter not used, but tell the compiler that it is ok */
2512 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
| REFRESH_MENU_TITLE_FONT
| REFRESH_MENU_FONT
;
2515 static int setIfDockPresent(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2518 long which
= (long) extra_data
;
2520 /* Parameter not used, but tell the compiler that it is ok */
2526 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2527 // Drawers require the dock
2528 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| wPreferences
.flags
.nodock
;
2531 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2534 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| *flag
;
2542 static int setClipMergedInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2546 /* Parameter not used, but tell the compiler that it is ok */
2551 wPreferences
.flags
.clip_merged_in_dock
= *flag
;
2552 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2556 static int setWrapAppiconsInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2560 /* Parameter not used, but tell the compiler that it is ok */
2565 wPreferences
.flags
.wrap_appicons_in_dock
= *flag
;
2569 static int setStickyIcons(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2571 /* Parameter not used, but tell the compiler that it is ok */
2576 if (scr
->workspaces
) {
2577 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2578 wArrangeIcons(scr
, False
);
2583 static int setIconTile(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2587 WTexture
** texture
= tdata
;
2590 /* Parameter not used, but tell the compiler that it is ok */
2593 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2594 wPreferences
.icon_size
, ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2595 ? WREL_ICON
: WREL_FLAT
);
2597 wwarning(_("could not render texture for icon background"));
2599 wTextureDestroy(scr
, *texture
);
2602 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2604 if (scr
->icon_tile
) {
2606 RReleaseImage(scr
->icon_tile
);
2607 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2610 scr
->icon_tile
= img
;
2612 /* put the icon in the noticeboard hint */
2613 PropSetIconTileHint(scr
, img
);
2615 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
) {
2616 if (scr
->clip_tile
) {
2617 RReleaseImage(scr
->clip_tile
);
2619 scr
->clip_tile
= wClipMakeTile(img
);
2622 if (!wPreferences
.flags
.nodrawer
) {
2623 if (scr
->drawer_tile
) {
2624 RReleaseImage(scr
->drawer_tile
);
2626 scr
->drawer_tile
= wDrawerMakeTile(scr
, img
);
2629 scr
->icon_tile_pixmap
= pixmap
;
2631 if (scr
->def_icon_rimage
) {
2632 RReleaseImage(scr
->def_icon_rimage
);
2633 scr
->def_icon_rimage
= NULL
;
2636 if (scr
->icon_back_texture
)
2637 wTextureDestroy(scr
, (WTexture
*) scr
->icon_back_texture
);
2639 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2641 /* Free the texture as nobody else will use it, nor refer to it. */
2643 wTextureDestroy(scr
, *texture
);
2645 return (reset
? REFRESH_ICON_TILE
: 0);
2648 static int setWinTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2650 WMFont
*font
= tdata
;
2652 /* Parameter not used, but tell the compiler that it is ok */
2656 if (scr
->title_font
) {
2657 WMReleaseFont(scr
->title_font
);
2659 scr
->title_font
= font
;
2661 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
;
2664 static int setMenuTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2666 WMFont
*font
= tdata
;
2668 /* Parameter not used, but tell the compiler that it is ok */
2672 if (scr
->menu_title_font
) {
2673 WMReleaseFont(scr
->menu_title_font
);
2676 scr
->menu_title_font
= font
;
2678 return REFRESH_MENU_TITLE_FONT
;
2681 static int setMenuTextFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2683 WMFont
*font
= tdata
;
2685 /* Parameter not used, but tell the compiler that it is ok */
2689 if (scr
->menu_entry_font
) {
2690 WMReleaseFont(scr
->menu_entry_font
);
2692 scr
->menu_entry_font
= font
;
2694 return REFRESH_MENU_FONT
;
2697 static int setIconTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2699 WMFont
*font
= tdata
;
2701 /* Parameter not used, but tell the compiler that it is ok */
2705 if (scr
->icon_title_font
) {
2706 WMReleaseFont(scr
->icon_title_font
);
2709 scr
->icon_title_font
= font
;
2711 return REFRESH_ICON_FONT
;
2714 static int setClipTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2716 WMFont
*font
= tdata
;
2718 /* Parameter not used, but tell the compiler that it is ok */
2722 if (scr
->clip_title_font
) {
2723 WMReleaseFont(scr
->clip_title_font
);
2726 scr
->clip_title_font
= font
;
2728 return REFRESH_ICON_FONT
;
2731 static int setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2733 WMFont
*font
= tdata
;
2735 /* Parameter not used, but tell the compiler that it is ok */
2740 if (scr
->workspace_name_font
)
2741 WMReleaseFont(scr
->workspace_name_font
);
2743 scr
->workspace_name_font
= font
;
2748 static int setHightlight(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2750 XColor
*color
= tdata
;
2752 /* Parameter not used, but tell the compiler that it is ok */
2756 if (scr
->select_color
)
2757 WMReleaseColor(scr
->select_color
);
2759 scr
->select_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2761 wFreeColor(scr
, color
->pixel
);
2763 return REFRESH_MENU_COLOR
;
2766 static int setHightlightText(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2768 XColor
*color
= tdata
;
2770 /* Parameter not used, but tell the compiler that it is ok */
2774 if (scr
->select_text_color
)
2775 WMReleaseColor(scr
->select_text_color
);
2777 scr
->select_text_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2779 wFreeColor(scr
, color
->pixel
);
2781 return REFRESH_MENU_COLOR
;
2784 static int setClipTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2786 XColor
*color
= tdata
;
2787 long widx
= (long) extra_data
;
2789 /* Parameter not used, but tell the compiler that it is ok */
2792 if (scr
->clip_title_color
[widx
])
2793 WMReleaseColor(scr
->clip_title_color
[widx
]);
2795 scr
->clip_title_color
[widx
] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2796 wFreeColor(scr
, color
->pixel
);
2798 return REFRESH_ICON_TITLE_COLOR
;
2801 static int setWTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2803 XColor
*color
= tdata
;
2804 long widx
= (long) extra_data
;
2806 /* Parameter not used, but tell the compiler that it is ok */
2809 if (scr
->window_title_color
[widx
])
2810 WMReleaseColor(scr
->window_title_color
[widx
]);
2812 scr
->window_title_color
[widx
] =
2813 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2815 wFreeColor(scr
, color
->pixel
);
2817 return REFRESH_WINDOW_TITLE_COLOR
;
2820 static int setMenuTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2822 XColor
*color
= tdata
;
2824 /* Parameter not used, but tell the compiler that it is ok */
2828 if (scr
->menu_title_color
[0])
2829 WMReleaseColor(scr
->menu_title_color
[0]);
2831 scr
->menu_title_color
[0] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2833 wFreeColor(scr
, color
->pixel
);
2835 return REFRESH_MENU_TITLE_COLOR
;
2838 static int setMenuTextColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2840 XColor
*color
= tdata
;
2842 /* Parameter not used, but tell the compiler that it is ok */
2846 if (scr
->mtext_color
)
2847 WMReleaseColor(scr
->mtext_color
);
2849 scr
->mtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2851 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2852 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2854 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2857 wFreeColor(scr
, color
->pixel
);
2859 return REFRESH_MENU_COLOR
;
2862 static int setMenuDisabledColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2864 XColor
*color
= tdata
;
2866 /* Parameter not used, but tell the compiler that it is ok */
2870 if (scr
->dtext_color
)
2871 WMReleaseColor(scr
->dtext_color
);
2873 scr
->dtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2875 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2876 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2878 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2881 wFreeColor(scr
, color
->pixel
);
2883 return REFRESH_MENU_COLOR
;
2886 static int setIconTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2888 XColor
*color
= tdata
;
2890 /* Parameter not used, but tell the compiler that it is ok */
2894 if (scr
->icon_title_color
)
2895 WMReleaseColor(scr
->icon_title_color
);
2896 scr
->icon_title_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2898 wFreeColor(scr
, color
->pixel
);
2900 return REFRESH_ICON_TITLE_COLOR
;
2903 static int setIconTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2905 XColor
*color
= tdata
;
2907 /* Parameter not used, but tell the compiler that it is ok */
2911 if (scr
->icon_title_texture
) {
2912 wTextureDestroy(scr
, (WTexture
*) scr
->icon_title_texture
);
2914 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
2916 return REFRESH_ICON_TITLE_BACK
;
2919 static int setFrameBorderWidth(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2923 /* Parameter not used, but tell the compiler that it is ok */
2927 scr
->frame_border_width
= *value
;
2929 return REFRESH_FRAME_BORDER
;
2932 static int setFrameBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2934 XColor
*color
= tdata
;
2936 /* Parameter not used, but tell the compiler that it is ok */
2940 if (scr
->frame_border_color
)
2941 WMReleaseColor(scr
->frame_border_color
);
2942 scr
->frame_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2944 wFreeColor(scr
, color
->pixel
);
2946 return REFRESH_FRAME_BORDER
;
2949 static int setFrameFocusedBorderColor(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2951 XColor
*color
= tdata
;
2953 /* Parameter not used, but tell the compiler that it is ok */
2957 if (scr
->frame_focused_border_color
)
2958 WMReleaseColor(scr
->frame_focused_border_color
);
2959 scr
->frame_focused_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2961 wFreeColor(scr
, color
->pixel
);
2963 return REFRESH_FRAME_BORDER
;
2966 static int setFrameSelectedBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2968 XColor
*color
= tdata
;
2970 /* Parameter not used, but tell the compiler that it is ok */
2974 if (scr
->frame_selected_border_color
)
2975 WMReleaseColor(scr
->frame_selected_border_color
);
2976 scr
->frame_selected_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2978 wFreeColor(scr
, color
->pixel
);
2980 return REFRESH_FRAME_BORDER
;
2983 static int setWorkspaceSpecificBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
2985 WMPropList
*value
= tdata
;
2990 /* Parameter not used, but tell the compiler that it is ok */
2994 if (scr
->flags
.backimage_helper_launched
) {
2995 if (WMGetPropListItemCount(value
) == 0) {
2996 SendHelperMessage(scr
, 'C', 0, NULL
);
2997 SendHelperMessage(scr
, 'K', 0, NULL
);
2999 WMReleasePropList(value
);
3003 if (WMGetPropListItemCount(value
) == 0)
3006 if (!start_bg_helper(scr
)) {
3007 WMReleasePropList(value
);
3011 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3014 for (i
= 0; i
< WMGetPropListItemCount(value
); i
++) {
3015 val
= WMGetFromPLArray(value
, i
);
3016 if (val
&& WMIsPLArray(val
) && WMGetPropListItemCount(val
) > 0) {
3017 str
= WMGetPropListDescription(val
, False
);
3019 SendHelperMessage(scr
, 'S', i
+ 1, str
);
3023 SendHelperMessage(scr
, 'U', i
+ 1, NULL
);
3028 WMReleasePropList(value
);
3032 static int setWorkspaceBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
3034 WMPropList
*value
= tdata
;
3036 /* Parameter not used, but tell the compiler that it is ok */
3040 if (scr
->flags
.backimage_helper_launched
) {
3043 if (WMGetPropListItemCount(value
) == 0) {
3044 SendHelperMessage(scr
, 'U', 0, NULL
);
3046 /* set the default workspace background to this one */
3047 str
= WMGetPropListDescription(value
, False
);
3049 SendHelperMessage(scr
, 'S', 0, str
);
3051 SendHelperMessage(scr
, 'C', scr
->current_workspace
+ 1, NULL
);
3053 SendHelperMessage(scr
, 'U', 0, NULL
);
3056 } else if (WMGetPropListItemCount(value
) > 0) {
3061 text
= WMGetPropListDescription(value
, False
);
3062 len
= strlen(text
) + 40;
3063 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3064 if (!strchr(text
, '\'') && !strchr(text
, '\\')) {
3067 if (wPreferences
.smooth_workspace_back
)
3068 snprintf(command
, len
, "wmsetbg %s -S -p '%s' &", dither
, text
);
3070 snprintf(command
, len
, "wmsetbg %s -p '%s' &", dither
, text
);
3071 ExecuteShellCommand(scr
, command
);
3073 wwarning(_("Invalid arguments for background \"%s\""), text
);
3076 WMReleasePropList(value
);
3081 static int setWidgetColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3083 WTexture
**texture
= tdata
;
3085 /* Parameter not used, but tell the compiler that it is ok */
3089 if (scr
->widget_texture
) {
3090 wTextureDestroy(scr
, (WTexture
*) scr
->widget_texture
);
3092 scr
->widget_texture
= *(WTexSolid
**) texture
;
3097 static int setFTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3099 WTexture
**texture
= tdata
;
3101 /* Parameter not used, but tell the compiler that it is ok */
3105 if (scr
->window_title_texture
[WS_FOCUSED
]) {
3106 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3108 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3110 return REFRESH_WINDOW_TEXTURES
;
3113 static int setPTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3115 WTexture
**texture
= tdata
;
3117 /* Parameter not used, but tell the compiler that it is ok */
3121 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
3122 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3124 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3126 return REFRESH_WINDOW_TEXTURES
;
3129 static int setUTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3131 WTexture
**texture
= tdata
;
3133 /* Parameter not used, but tell the compiler that it is ok */
3137 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
3138 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3140 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3142 return REFRESH_WINDOW_TEXTURES
;
3145 static int setResizebarBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3147 WTexture
**texture
= tdata
;
3149 /* Parameter not used, but tell the compiler that it is ok */
3153 if (scr
->resizebar_texture
[0]) {
3154 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3156 scr
->resizebar_texture
[0] = *texture
;
3158 return REFRESH_WINDOW_TEXTURES
;
3161 static int setMenuTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3163 WTexture
**texture
= tdata
;
3165 /* Parameter not used, but tell the compiler that it is ok */
3169 if (scr
->menu_title_texture
[0]) {
3170 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3172 scr
->menu_title_texture
[0] = *texture
;
3174 return REFRESH_MENU_TITLE_TEXTURE
;
3177 static int setMenuTextBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3179 WTexture
**texture
= tdata
;
3181 /* Parameter not used, but tell the compiler that it is ok */
3185 if (scr
->menu_item_texture
) {
3186 wTextureDestroy(scr
, scr
->menu_item_texture
);
3187 wTextureDestroy(scr
, (WTexture
*) scr
->menu_item_auxtexture
);
3189 scr
->menu_item_texture
= *texture
;
3191 scr
->menu_item_auxtexture
= wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3193 return REFRESH_MENU_TEXTURE
;
3196 static int setKeyGrab(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3198 WShortKey
*shortcut
= tdata
;
3200 long widx
= (long) extra_data
;
3202 /* Parameter not used, but tell the compiler that it is ok */
3205 wKeyBindings
[widx
] = *shortcut
;
3207 wwin
= scr
->focused_window
;
3209 while (wwin
!= NULL
) {
3210 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3212 if (!WFLAGP(wwin
, no_bind_keys
)) {
3213 wWindowSetKeyGrabs(wwin
);
3218 /* do we need to update window menus? */
3219 if (widx
>= WKBD_WORKSPACE1
&& widx
<= WKBD_WORKSPACE10
)
3220 return REFRESH_WORKSPACE_MENU
;
3221 if (widx
== WKBD_LASTWORKSPACE
)
3222 return REFRESH_WORKSPACE_MENU
;
3223 if (widx
>= WKBD_MOVE_WORKSPACE1
&& widx
<= WKBD_MOVE_WORKSPACE10
)
3224 return REFRESH_WORKSPACE_MENU
;
3229 static int setIconPosition(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3231 /* Parameter not used, but tell the compiler that it is ok */
3236 wScreenUpdateUsableArea(scr
);
3237 wArrangeIcons(scr
, True
);
3242 static int updateUsableArea(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3244 /* Parameter not used, but tell the compiler that it is ok */
3249 wScreenUpdateUsableArea(scr
);
3254 static int setWorkspaceMapBackground(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3256 WTexture
**texture
= tdata
;
3258 /* Parameter not used, but tell the compiler that it is ok */
3262 if (wPreferences
.wsmbackTexture
)
3263 wTextureDestroy(scr
, wPreferences
.wsmbackTexture
);
3265 wPreferences
.wsmbackTexture
= *texture
;
3267 return REFRESH_WINDOW_TEXTURES
;
3270 static int setMenuStyle(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3272 /* Parameter not used, but tell the compiler that it is ok */
3278 return REFRESH_MENU_TEXTURE
;
3281 static RImage
*chopOffImage(RImage
* image
, int x
, int y
, int w
, int h
)
3283 RImage
*img
= RCreateImage(w
, h
, image
->format
== RRGBAFormat
);
3285 RCopyArea(img
, image
, x
, y
, w
, h
, 0, 0);
3290 static int setSwPOptions(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3292 WMPropList
*array
= tdata
;
3295 int cwidth
, cheight
;
3296 struct WPreferences
*prefs
= foo
;
3298 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) == 0) {
3299 if (prefs
->swtileImage
)
3300 RReleaseImage(prefs
->swtileImage
);
3301 prefs
->swtileImage
= NULL
;
3303 WMReleasePropList(array
);
3307 switch (WMGetPropListItemCount(array
)) {
3309 if (!WMIsPLString(WMGetFromPLArray(array
, 1))) {
3310 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3313 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 1)));
3316 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3317 WMGetFromPLString(WMGetFromPLArray(array
, 1)), entry
->key
);
3319 bgimage
= RLoadImage(scr
->rcontext
, path
, 0);
3321 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3326 cwidth
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 2)));
3327 cheight
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 3)));
3329 if (cwidth
<= 0 || cheight
<= 0 ||
3330 cwidth
>= bgimage
->width
- 2 || cheight
>= bgimage
->height
- 2)
3331 wwarning(_("Invalid split sizes for switch panel back image."));
3334 int swidth
, theight
;
3335 for (i
= 0; i
< 9; i
++) {
3336 if (prefs
->swbackImage
[i
])
3337 RReleaseImage(prefs
->swbackImage
[i
]);
3338 prefs
->swbackImage
[i
] = NULL
;
3340 swidth
= (bgimage
->width
- cwidth
) / 2;
3341 theight
= (bgimage
->height
- cheight
) / 2;
3343 prefs
->swbackImage
[0] = chopOffImage(bgimage
, 0, 0, swidth
, theight
);
3344 prefs
->swbackImage
[1] = chopOffImage(bgimage
, swidth
, 0, cwidth
, theight
);
3345 prefs
->swbackImage
[2] = chopOffImage(bgimage
, swidth
+ cwidth
, 0,
3348 prefs
->swbackImage
[3] = chopOffImage(bgimage
, 0, theight
, swidth
, cheight
);
3349 prefs
->swbackImage
[4] = chopOffImage(bgimage
, swidth
, theight
,
3351 prefs
->swbackImage
[5] = chopOffImage(bgimage
, swidth
+ cwidth
, theight
,
3354 prefs
->swbackImage
[6] = chopOffImage(bgimage
, 0, theight
+ cheight
,
3356 prefs
->swbackImage
[7] = chopOffImage(bgimage
, swidth
, theight
+ cheight
,
3358 prefs
->swbackImage
[8] =
3359 chopOffImage(bgimage
, swidth
+ cwidth
, theight
+ cheight
, swidth
,
3362 // check if anything failed
3363 for (i
= 0; i
< 9; i
++) {
3364 if (!prefs
->swbackImage
[i
]) {
3365 for (; i
>= 0; --i
) {
3366 RReleaseImage(prefs
->swbackImage
[i
]);
3367 prefs
->swbackImage
[i
] = NULL
;
3373 RReleaseImage(bgimage
);
3378 if (!WMIsPLString(WMGetFromPLArray(array
, 0))) {
3379 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3382 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 0)));
3385 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3386 WMGetFromPLString(WMGetFromPLArray(array
, 0)), entry
->key
);
3388 if (prefs
->swtileImage
)
3389 RReleaseImage(prefs
->swtileImage
);
3391 prefs
->swtileImage
= RLoadImage(scr
->rcontext
, path
, 0);
3392 if (!prefs
->swtileImage
) {
3393 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3400 wwarning(_("Invalid number of arguments for option \"%s\""), entry
->key
);
3404 WMReleasePropList(array
);
3409 static int setModifierKeyLabels(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3411 WMPropList
*array
= tdata
;
3413 struct WPreferences
*prefs
= foo
;
3415 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) != 7) {
3416 wwarning(_("Value for option \"%s\" must be an array of 7 strings"), entry
->key
);
3417 WMReleasePropList(array
);
3421 DestroyWindowMenu(scr
);
3423 for (i
= 0; i
< 7; i
++) {
3424 if (prefs
->modifier_labels
[i
])
3425 wfree(prefs
->modifier_labels
[i
]);
3427 if (WMIsPLString(WMGetFromPLArray(array
, i
))) {
3428 prefs
->modifier_labels
[i
] = wstrdup(WMGetFromPLString(WMGetFromPLArray(array
, i
)));
3430 wwarning(_("Invalid argument for option \"%s\" item %d"), entry
->key
, i
);
3431 prefs
->modifier_labels
[i
] = NULL
;
3435 WMReleasePropList(array
);
3440 static int setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3444 /* Parameter not used, but tell the compiler that it is ok */
3451 W_setconf_doubleClickDelay(*value
);
3456 static int setCursor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3458 Cursor
*cursor
= tdata
;
3459 long widx
= (long) extra_data
;
3461 /* Parameter not used, but tell the compiler that it is ok */
3464 if (wPreferences
.cursor
[widx
] != None
) {
3465 XFreeCursor(dpy
, wPreferences
.cursor
[widx
]);
3468 wPreferences
.cursor
[widx
] = *cursor
;
3470 if (widx
== WCUR_ROOT
&& *cursor
!= None
) {
3471 XDefineCursor(dpy
, scr
->root_win
, *cursor
);