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 {"WindowRelaunchKey", "None", (void *)WKBD_RELAUNCH
,
774 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
775 {"ScreenSwitchKey", "None", (void *)WKBD_SWITCH_SCREEN
,
776 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
777 {"RunKey", "None", (void *)WKBD_RUN
,
778 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
780 #ifdef KEEP_XKB_LOCK_STATUS
781 {"ToggleKbdModeKey", "None", (void *)WKBD_TOGGLE
,
782 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
783 {"KbdModeLock", "NO", NULL
,
784 &wPreferences
.modelock
, getBool
, NULL
, NULL
, NULL
},
785 #endif /* KEEP_XKB_LOCK_STATUS */
787 {"NormalCursor", "(builtin, left_ptr)", (void *)WCUR_ROOT
,
788 NULL
, getCursor
, setCursor
, NULL
, NULL
},
789 {"ArrowCursor", "(builtin, top_left_arrow)", (void *)WCUR_ARROW
,
790 NULL
, getCursor
, setCursor
, NULL
, NULL
},
791 {"MoveCursor", "(builtin, fleur)", (void *)WCUR_MOVE
,
792 NULL
, getCursor
, setCursor
, NULL
, NULL
},
793 {"ResizeCursor", "(builtin, sizing)", (void *)WCUR_RESIZE
,
794 NULL
, getCursor
, setCursor
, NULL
, NULL
},
795 {"TopLeftResizeCursor", "(builtin, top_left_corner)", (void *)WCUR_TOPLEFTRESIZE
,
796 NULL
, getCursor
, setCursor
, NULL
, NULL
},
797 {"TopRightResizeCursor", "(builtin, top_right_corner)", (void *)WCUR_TOPRIGHTRESIZE
,
798 NULL
, getCursor
, setCursor
, NULL
, NULL
},
799 {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)", (void *)WCUR_BOTTOMLEFTRESIZE
,
800 NULL
, getCursor
, setCursor
, NULL
, NULL
},
801 {"BottomRightResizeCursor", "(builtin, bottom_right_corner)", (void *)WCUR_BOTTOMRIGHTRESIZE
,
802 NULL
, getCursor
, setCursor
, NULL
, NULL
},
803 {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)", (void *)WCUR_VERTICALRESIZE
,
804 NULL
, getCursor
, setCursor
, NULL
, NULL
},
805 {"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)", (void *)WCUR_HORIZONRESIZE
,
806 NULL
, getCursor
, setCursor
, NULL
, NULL
},
807 {"WaitCursor", "(builtin, watch)", (void *)WCUR_WAIT
,
808 NULL
, getCursor
, setCursor
, NULL
, NULL
},
809 {"QuestionCursor", "(builtin, question_arrow)", (void *)WCUR_QUESTION
,
810 NULL
, getCursor
, setCursor
, NULL
, NULL
},
811 {"TextCursor", "(builtin, xterm)", (void *)WCUR_TEXT
,
812 NULL
, getCursor
, setCursor
, NULL
, NULL
},
813 {"SelectCursor", "(builtin, cross)", (void *)WCUR_SELECT
,
814 NULL
, getCursor
, setCursor
, NULL
, NULL
},
815 {"DialogHistoryLines", "500", NULL
,
816 &wPreferences
.history_lines
, getInt
, NULL
, NULL
, NULL
},
817 {"CycleActiveHeadOnly", "NO", NULL
,
818 &wPreferences
.cycle_active_head_only
, getBool
, NULL
, NULL
, NULL
},
819 {"CycleIgnoreMinimized", "NO", NULL
,
820 &wPreferences
.cycle_ignore_minimized
, getBool
, NULL
, NULL
, NULL
}
823 static void initDefaults(void)
826 WDefaultEntry
*entry
;
828 WMPLSetCaseSensitive(False
);
830 for (i
= 0; i
< wlengthof(optionList
); i
++) {
831 entry
= &optionList
[i
];
833 entry
->plkey
= WMCreatePLString(entry
->key
);
834 if (entry
->default_value
)
835 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
837 entry
->plvalue
= NULL
;
840 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
841 entry
= &staticOptionList
[i
];
843 entry
->plkey
= WMCreatePLString(entry
->key
);
844 if (entry
->default_value
)
845 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
847 entry
->plvalue
= NULL
;
851 static WMPropList
*readGlobalDomain(const char *domainName
, Bool requireDictionary
)
853 WMPropList
*globalDict
= NULL
;
857 snprintf(path
, sizeof(path
), "%s/%s", DEFSDATADIR
, domainName
);
858 if (stat(path
, &stbuf
) >= 0) {
859 globalDict
= WMReadPropListFromFile(path
);
860 if (globalDict
&& requireDictionary
&& !WMIsPLDictionary(globalDict
)) {
861 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"), domainName
, path
);
862 WMReleasePropList(globalDict
);
864 } else if (!globalDict
) {
865 wwarning(_("could not load domain %s from global defaults database"), domainName
);
872 #if defined(GLOBAL_PREAMBLE_MENU_FILE) || defined(GLOBAL_EPILOGUE_MENU_FILE)
873 static void prependMenu(WMPropList
* destarr
, WMPropList
* array
)
878 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
879 item
= WMGetFromPLArray(array
, i
);
881 WMInsertInPLArray(destarr
, i
+ 1, item
);
885 static void appendMenu(WMPropList
* destarr
, WMPropList
* array
)
890 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
891 item
= WMGetFromPLArray(array
, i
);
893 WMAddToPLArray(destarr
, item
);
898 void wDefaultsMergeGlobalMenus(WDDomain
* menuDomain
)
900 WMPropList
*menu
= menuDomain
->dictionary
;
903 if (!menu
|| !WMIsPLArray(menu
))
906 #ifdef GLOBAL_PREAMBLE_MENU_FILE
907 submenu
= WMReadPropListFromFile(DEFSDATADIR
"/" GLOBAL_PREAMBLE_MENU_FILE
);
909 if (submenu
&& !WMIsPLArray(submenu
)) {
910 wwarning(_("invalid global menu file %s"), GLOBAL_PREAMBLE_MENU_FILE
);
911 WMReleasePropList(submenu
);
915 prependMenu(menu
, submenu
);
916 WMReleasePropList(submenu
);
920 #ifdef GLOBAL_EPILOGUE_MENU_FILE
921 submenu
= WMReadPropListFromFile(DEFSDATADIR
"/" GLOBAL_EPILOGUE_MENU_FILE
);
923 if (submenu
&& !WMIsPLArray(submenu
)) {
924 wwarning(_("invalid global menu file %s"), GLOBAL_EPILOGUE_MENU_FILE
);
925 WMReleasePropList(submenu
);
929 appendMenu(menu
, submenu
);
930 WMReleasePropList(submenu
);
934 menuDomain
->dictionary
= menu
;
937 WDDomain
*wDefaultsInitDomain(const char *domain
, Bool requireDictionary
)
941 static int inited
= 0;
942 WMPropList
*shared_dict
= NULL
;
949 db
= wmalloc(sizeof(WDDomain
));
950 db
->domain_name
= domain
;
951 db
->path
= wdefaultspathfordomain(domain
);
953 if (stat(db
->path
, &stbuf
) >= 0) {
954 db
->dictionary
= WMReadPropListFromFile(db
->path
);
955 if (db
->dictionary
) {
956 if (requireDictionary
&& !WMIsPLDictionary(db
->dictionary
)) {
957 WMReleasePropList(db
->dictionary
);
958 db
->dictionary
= NULL
;
959 wwarning(_("Domain %s (%s) of defaults database is corrupted!"), domain
, db
->path
);
961 db
->timestamp
= stbuf
.st_mtime
;
963 wwarning(_("could not load domain %s from user defaults database"), domain
);
967 /* global system dictionary */
968 shared_dict
= readGlobalDomain(domain
, requireDictionary
);
970 if (shared_dict
&& db
->dictionary
&& WMIsPLDictionary(shared_dict
) &&
971 WMIsPLDictionary(db
->dictionary
)) {
972 WMMergePLDictionaries(shared_dict
, db
->dictionary
, True
);
973 WMReleasePropList(db
->dictionary
);
974 db
->dictionary
= shared_dict
;
975 if (stbuf
.st_mtime
> db
->timestamp
)
976 db
->timestamp
= stbuf
.st_mtime
;
977 } else if (!db
->dictionary
) {
978 db
->dictionary
= shared_dict
;
979 if (stbuf
.st_mtime
> db
->timestamp
)
980 db
->timestamp
= stbuf
.st_mtime
;
986 void wReadStaticDefaults(WMPropList
* dict
)
989 WDefaultEntry
*entry
;
993 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
994 entry
= &staticOptionList
[i
];
997 plvalue
= WMGetFromPLDictionary(dict
, entry
->plkey
);
1001 /* no default in the DB. Use builtin default */
1003 plvalue
= entry
->plvalue
;
1007 (*entry
->convert
) (NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
1009 (*entry
->update
) (NULL
, entry
, tdata
, entry
->extra_data
);
1014 void wDefaultsCheckDomains(void* arg
)
1018 WMPropList
*shared_dict
= NULL
;
1022 /* Parameter not used, but tell the compiler that it is ok */
1025 if (stat(w_global
.domain
.wmaker
->path
, &stbuf
) >= 0 && w_global
.domain
.wmaker
->timestamp
< stbuf
.st_mtime
) {
1026 w_global
.domain
.wmaker
->timestamp
= stbuf
.st_mtime
;
1028 /* Global dictionary */
1029 shared_dict
= readGlobalDomain("WindowMaker", True
);
1031 /* User dictionary */
1032 dict
= WMReadPropListFromFile(w_global
.domain
.wmaker
->path
);
1035 if (!WMIsPLDictionary(dict
)) {
1036 WMReleasePropList(dict
);
1038 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1039 "WindowMaker", w_global
.domain
.wmaker
->path
);
1042 WMMergePLDictionaries(shared_dict
, dict
, True
);
1043 WMReleasePropList(dict
);
1048 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1049 scr
= wScreenWithNumber(i
);
1051 wReadDefaults(scr
, dict
);
1054 if (w_global
.domain
.wmaker
->dictionary
)
1055 WMReleasePropList(w_global
.domain
.wmaker
->dictionary
);
1057 w_global
.domain
.wmaker
->dictionary
= dict
;
1060 wwarning(_("could not load domain %s from user defaults database"), "WindowMaker");
1064 WMReleasePropList(shared_dict
);
1068 if (stat(w_global
.domain
.window_attr
->path
, &stbuf
) >= 0 && w_global
.domain
.window_attr
->timestamp
< stbuf
.st_mtime
) {
1069 /* global dictionary */
1070 shared_dict
= readGlobalDomain("WMWindowAttributes", True
);
1071 /* user dictionary */
1072 dict
= WMReadPropListFromFile(w_global
.domain
.window_attr
->path
);
1074 if (!WMIsPLDictionary(dict
)) {
1075 WMReleasePropList(dict
);
1077 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1078 "WMWindowAttributes", w_global
.domain
.window_attr
->path
);
1081 WMMergePLDictionaries(shared_dict
, dict
, True
);
1082 WMReleasePropList(dict
);
1087 if (w_global
.domain
.window_attr
->dictionary
)
1088 WMReleasePropList(w_global
.domain
.window_attr
->dictionary
);
1090 w_global
.domain
.window_attr
->dictionary
= dict
;
1091 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1092 scr
= wScreenWithNumber(i
);
1094 wDefaultUpdateIcons(scr
);
1096 /* Update the panel image if changed */
1097 /* Don't worry. If the image is the same these
1098 * functions will have no performance impact. */
1099 create_logo_image(scr
);
1104 wwarning(_("could not load domain %s from user defaults database"), "WMWindowAttributes");
1107 w_global
.domain
.window_attr
->timestamp
= stbuf
.st_mtime
;
1109 WMReleasePropList(shared_dict
);
1112 if (stat(w_global
.domain
.root_menu
->path
, &stbuf
) >= 0 && w_global
.domain
.root_menu
->timestamp
< stbuf
.st_mtime
) {
1113 dict
= WMReadPropListFromFile(w_global
.domain
.root_menu
->path
);
1115 if (!WMIsPLArray(dict
) && !WMIsPLString(dict
)) {
1116 WMReleasePropList(dict
);
1118 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1119 "WMRootMenu", w_global
.domain
.root_menu
->path
);
1121 if (w_global
.domain
.root_menu
->dictionary
)
1122 WMReleasePropList(w_global
.domain
.root_menu
->dictionary
);
1124 w_global
.domain
.root_menu
->dictionary
= dict
;
1125 wDefaultsMergeGlobalMenus(w_global
.domain
.root_menu
);
1128 wwarning(_("could not load domain %s from user defaults database"), "WMRootMenu");
1130 w_global
.domain
.root_menu
->timestamp
= stbuf
.st_mtime
;
1132 #ifndef HAVE_INOTIFY
1134 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, arg
);
1138 void wReadDefaults(WScreen
* scr
, WMPropList
* new_dict
)
1140 WMPropList
*plvalue
, *old_value
;
1141 WDefaultEntry
*entry
;
1143 int update_workspace_back
= 0; /* kluge :/ */
1144 unsigned int needs_refresh
;
1146 WMPropList
*old_dict
= (w_global
.domain
.wmaker
->dictionary
!= new_dict
? w_global
.domain
.wmaker
->dictionary
: NULL
);
1150 for (i
= 0; i
< wlengthof(optionList
); i
++) {
1151 entry
= &optionList
[i
];
1154 plvalue
= WMGetFromPLDictionary(new_dict
, entry
->plkey
);
1161 old_value
= WMGetFromPLDictionary(old_dict
, entry
->plkey
);
1163 if (!plvalue
&& !old_value
) {
1164 /* no default in the DB. Use builtin default */
1165 plvalue
= entry
->plvalue
;
1166 if (plvalue
&& new_dict
)
1167 WMPutInPLDictionary(new_dict
, entry
->plkey
, plvalue
);
1169 } else if (!plvalue
) {
1170 /* value was deleted from DB. Keep current value */
1172 } else if (!old_value
) {
1173 /* set value for the 1st time */
1174 } else if (!WMIsPropListEqualTo(plvalue
, old_value
)) {
1175 /* value has changed */
1177 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1178 && update_workspace_back
&& scr
->flags
.backimage_helper_launched
) {
1180 /* value was not changed since last time */
1187 if ((*entry
->convert
) (scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1189 * If the WorkspaceSpecificBack data has been changed
1190 * so that the helper will be launched now, we must be
1191 * sure to send the default background texture config
1194 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0 &&
1195 !scr
->flags
.backimage_helper_launched
)
1196 update_workspace_back
= 1;
1199 needs_refresh
|= (*entry
->update
) (scr
, entry
, tdata
, entry
->extra_data
);
1205 if (needs_refresh
!= 0 && !scr
->flags
.startup
) {
1209 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1210 foo
|= WTextureSettings
;
1211 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1212 foo
|= WFontSettings
;
1213 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1214 foo
|= WColorSettings
;
1216 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1217 (void *)(uintptr_t) foo
);
1220 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1221 foo
|= WTextureSettings
;
1222 if (needs_refresh
& REFRESH_MENU_FONT
)
1223 foo
|= WFontSettings
;
1224 if (needs_refresh
& REFRESH_MENU_COLOR
)
1225 foo
|= WColorSettings
;
1227 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1230 if (needs_refresh
& REFRESH_WINDOW_FONT
)
1231 foo
|= WFontSettings
;
1232 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
)
1233 foo
|= WTextureSettings
;
1234 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
)
1235 foo
|= WColorSettings
;
1237 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1239 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1241 if (needs_refresh
& REFRESH_ICON_FONT
)
1242 foo
|= WFontSettings
;
1243 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
)
1244 foo
|= WTextureSettings
;
1245 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
)
1246 foo
|= WTextureSettings
;
1248 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1249 (void *)(uintptr_t) foo
);
1251 if (needs_refresh
& REFRESH_ICON_TILE
)
1252 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1254 if (needs_refresh
& REFRESH_WORKSPACE_MENU
) {
1255 if (scr
->workspace_menu
)
1256 wWorkspaceMenuUpdate(scr
, scr
->workspace_menu
);
1257 if (scr
->clip_ws_menu
)
1258 wWorkspaceMenuUpdate(scr
, scr
->clip_ws_menu
);
1259 if (scr
->workspace_submenu
)
1260 scr
->workspace_submenu
->flags
.realized
= 0;
1261 if (scr
->clip_submenu
)
1262 scr
->clip_submenu
->flags
.realized
= 0;
1267 void wDefaultUpdateIcons(WScreen
*scr
)
1269 WAppIcon
*aicon
= scr
->app_icon_list
;
1271 WWindow
*wwin
= scr
->focused_window
;
1274 /* Get the application icon, default included */
1275 wIconChangeImageFile(aicon
->icon
, NULL
);
1276 wAppIconPaint(aicon
);
1277 aicon
= aicon
->next
;
1280 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
)
1281 wClipIconPaint(scr
->clip_icon
);
1283 for (dc
= scr
->drawers
; dc
!= NULL
; dc
= dc
->next
)
1284 wDrawerIconPaint(dc
->adrawer
->icon_array
[0]);
1287 if (wwin
->icon
&& wwin
->flags
.miniaturized
)
1288 wIconChangeImageFile(wwin
->icon
, NULL
);
1293 /* --------------------------- Local ----------------------- */
1295 #define GET_STRING_OR_DEFAULT(x, var) if (!WMIsPLString(value)) { \
1296 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1298 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1299 var = entry->default_value;\
1300 } else var = WMGetFromPLString(value)\
1303 static int string2index(WMPropList *key, WMPropList *val, const char *def, WOptionEnumeration * values)
1306 WOptionEnumeration
*v
;
1307 char buffer
[TOTAL_VALUES_LENGTH
];
1309 if (WMIsPLString(val
) && (str
= WMGetFromPLString(val
))) {
1310 for (v
= values
; v
->string
!= NULL
; v
++) {
1311 if (strcasecmp(v
->string
, str
) == 0)
1317 for (v
= values
; v
->string
!= NULL
; v
++) {
1320 strcat(buffer
, ", ");
1321 snprintf(buffer
+strlen(buffer
),
1322 sizeof(buffer
)-strlen(buffer
)-1, "\"%s\"", v
->string
);
1325 wwarning(_("wrong option value for key \"%s\"; got \"%s\", should be one of %s."),
1326 WMGetFromPLString(key
),
1327 WMIsPLString(val
) ? WMGetFromPLString(val
) : "(unknown)",
1331 return string2index(key
, val
, NULL
, values
);
1338 * value - is the value in the defaults DB
1339 * addr - is the address to store the data
1340 * ret - is the address to store a pointer to a temporary buffer. ret
1341 * must not be freed and is used by the set functions
1343 static int getBool(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1347 int second_pass
= 0;
1349 /* Parameter not used, but tell the compiler that it is ok */
1352 GET_STRING_OR_DEFAULT("Boolean", val
);
1355 if ((val
[1] == '\0' && (val
[0] == 'y' || val
[0] == 'Y'))
1356 || strcasecmp(val
, "YES") == 0) {
1359 } else if ((val
[1] == '\0' && (val
[0] == 'n' || val
[0] == 'N'))
1360 || strcasecmp(val
, "NO") == 0) {
1364 if (sscanf(val
, "%i", &i
) == 1) {
1370 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""), val
, entry
->key
);
1371 if (second_pass
== 0) {
1372 val
= WMGetFromPLString(entry
->plvalue
);
1374 wwarning(_("using default \"%s\" instead"), val
);
1384 *(char *)addr
= data
;
1389 static int getInt(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1394 /* Parameter not used, but tell the compiler that it is ok */
1397 GET_STRING_OR_DEFAULT("Integer", val
);
1399 if (sscanf(val
, "%i", &data
) != 1) {
1400 wwarning(_("can't convert \"%s\" to integer for key \"%s\""), val
, entry
->key
);
1401 val
= WMGetFromPLString(entry
->plvalue
);
1402 wwarning(_("using default \"%s\" instead"), val
);
1403 if (sscanf(val
, "%i", &data
) != 1) {
1411 *(int *)addr
= data
;
1416 static int getCoord(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1419 char *val_x
, *val_y
;
1420 int nelem
, changed
= 0;
1421 WMPropList
*elem_x
, *elem_y
;
1424 if (!WMIsPLArray(value
)) {
1425 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Coordinate");
1427 value
= entry
->plvalue
;
1429 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1435 nelem
= WMGetPropListItemCount(value
);
1437 wwarning(_("Incorrect number of elements in array for key \"%s\"."), entry
->key
);
1439 value
= entry
->plvalue
;
1441 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1447 elem_x
= WMGetFromPLArray(value
, 0);
1448 elem_y
= WMGetFromPLArray(value
, 1);
1450 if (!elem_x
|| !elem_y
|| !WMIsPLString(elem_x
) || !WMIsPLString(elem_y
)) {
1451 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."), entry
->key
);
1453 value
= entry
->plvalue
;
1455 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1461 val_x
= WMGetFromPLString(elem_x
);
1462 val_y
= WMGetFromPLString(elem_y
);
1464 if (sscanf(val_x
, "%i", &data
.x
) != 1 || sscanf(val_y
, "%i", &data
.y
) != 1) {
1465 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1467 value
= entry
->plvalue
;
1469 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1477 else if (data
.x
> scr
->scr_width
/ 3)
1478 data
.x
= scr
->scr_width
/ 3;
1481 else if (data
.y
> scr
->scr_height
/ 3)
1482 data
.y
= scr
->scr_height
/ 3;
1487 *(WCoord
*) addr
= data
;
1492 static int getPropList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1494 /* Parameter not used, but tell the compiler that it is ok */
1499 WMRetainPropList(value
);
1506 static int getPathList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1514 /* Parameter not used, but tell the compiler that it is ok */
1519 if (!WMIsPLArray(value
)) {
1520 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "an array of paths");
1522 value
= entry
->plvalue
;
1524 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1531 count
= WMGetPropListItemCount(value
);
1534 value
= entry
->plvalue
;
1536 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1543 for (i
= 0; i
< count
; i
++) {
1544 d
= WMGetFromPLArray(value
, i
);
1545 if (!d
|| !WMIsPLString(d
)) {
1549 len
+= strlen(WMGetFromPLString(d
)) + 1;
1552 ptr
= data
= wmalloc(len
+ 1);
1554 for (i
= 0; i
< count
; i
++) {
1555 d
= WMGetFromPLArray(value
, i
);
1556 if (!d
|| !WMIsPLString(d
)) {
1559 strcpy(ptr
, WMGetFromPLString(d
));
1560 ptr
+= strlen(WMGetFromPLString(d
));
1567 if (*(char **)addr
!= NULL
) {
1568 wfree(*(char **)addr
);
1570 *(char **)addr
= data
;
1575 static int getEnum(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1577 static signed char data
;
1579 /* Parameter not used, but tell the compiler that it is ok */
1582 data
= string2index(entry
->plkey
, value
, entry
->default_value
, (WOptionEnumeration
*) entry
->extra_data
);
1589 *(signed char *)addr
= data
;
1596 * (hgradient <color> <color>)
1597 * (vgradient <color> <color>)
1598 * (dgradient <color> <color>)
1599 * (mhgradient <color> <color> ...)
1600 * (mvgradient <color> <color> ...)
1601 * (mdgradient <color> <color> ...)
1602 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1603 * (tpixmap <file> <color>)
1604 * (spixmap <file> <color>)
1605 * (cpixmap <file> <color>)
1606 * (thgradient <file> <opaqueness> <color> <color>)
1607 * (tvgradient <file> <opaqueness> <color> <color>)
1608 * (tdgradient <file> <opaqueness> <color> <color>)
1609 * (function <lib> <function> ...)
1612 static WTexture
*parse_texture(WScreen
* scr
, WMPropList
* pl
)
1617 WTexture
*texture
= NULL
;
1619 nelem
= WMGetPropListItemCount(pl
);
1623 elem
= WMGetFromPLArray(pl
, 0);
1624 if (!elem
|| !WMIsPLString(elem
))
1626 val
= WMGetFromPLString(elem
);
1628 if (strcasecmp(val
, "solid") == 0) {
1636 elem
= WMGetFromPLArray(pl
, 1);
1637 if (!elem
|| !WMIsPLString(elem
))
1639 val
= WMGetFromPLString(elem
);
1641 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1642 wwarning(_("\"%s\" is not a valid color name"), val
);
1646 texture
= (WTexture
*) wTextureMakeSolid(scr
, &color
);
1647 } else if (strcasecmp(val
, "dgradient") == 0
1648 || strcasecmp(val
, "vgradient") == 0 || strcasecmp(val
, "hgradient") == 0) {
1649 RColor color1
, color2
;
1654 wwarning(_("bad number of arguments in gradient specification"));
1658 if (val
[0] == 'd' || val
[0] == 'D')
1659 type
= WTEX_DGRADIENT
;
1660 else if (val
[0] == 'h' || val
[0] == 'H')
1661 type
= WTEX_HGRADIENT
;
1663 type
= WTEX_VGRADIENT
;
1665 /* get from color */
1666 elem
= WMGetFromPLArray(pl
, 1);
1667 if (!elem
|| !WMIsPLString(elem
))
1669 val
= WMGetFromPLString(elem
);
1671 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1672 wwarning(_("\"%s\" is not a valid color name"), val
);
1676 color1
.red
= xcolor
.red
>> 8;
1677 color1
.green
= xcolor
.green
>> 8;
1678 color1
.blue
= xcolor
.blue
>> 8;
1681 elem
= WMGetFromPLArray(pl
, 2);
1682 if (!elem
|| !WMIsPLString(elem
)) {
1685 val
= WMGetFromPLString(elem
);
1687 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1688 wwarning(_("\"%s\" is not a valid color name"), val
);
1692 color2
.red
= xcolor
.red
>> 8;
1693 color2
.green
= xcolor
.green
>> 8;
1694 color2
.blue
= xcolor
.blue
>> 8;
1696 texture
= (WTexture
*) wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1698 } else if (strcasecmp(val
, "igradient") == 0) {
1699 RColor colors1
[2], colors2
[2];
1705 wwarning(_("bad number of arguments in gradient specification"));
1709 /* get from color */
1710 for (i
= 0; i
< 2; i
++) {
1711 elem
= WMGetFromPLArray(pl
, 1 + i
);
1712 if (!elem
|| !WMIsPLString(elem
))
1714 val
= WMGetFromPLString(elem
);
1716 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1717 wwarning(_("\"%s\" is not a valid color name"), val
);
1720 colors1
[i
].alpha
= 255;
1721 colors1
[i
].red
= xcolor
.red
>> 8;
1722 colors1
[i
].green
= xcolor
.green
>> 8;
1723 colors1
[i
].blue
= xcolor
.blue
>> 8;
1725 elem
= WMGetFromPLArray(pl
, 3);
1726 if (!elem
|| !WMIsPLString(elem
))
1728 val
= WMGetFromPLString(elem
);
1731 /* get from color */
1732 for (i
= 0; i
< 2; i
++) {
1733 elem
= WMGetFromPLArray(pl
, 4 + i
);
1734 if (!elem
|| !WMIsPLString(elem
))
1736 val
= WMGetFromPLString(elem
);
1738 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1739 wwarning(_("\"%s\" is not a valid color name"), val
);
1742 colors2
[i
].alpha
= 255;
1743 colors2
[i
].red
= xcolor
.red
>> 8;
1744 colors2
[i
].green
= xcolor
.green
>> 8;
1745 colors2
[i
].blue
= xcolor
.blue
>> 8;
1747 elem
= WMGetFromPLArray(pl
, 6);
1748 if (!elem
|| !WMIsPLString(elem
))
1750 val
= WMGetFromPLString(elem
);
1753 texture
= (WTexture
*) wTextureMakeIGradient(scr
, th1
, colors1
, th2
, colors2
);
1755 } else if (strcasecmp(val
, "mhgradient") == 0
1756 || strcasecmp(val
, "mvgradient") == 0 || strcasecmp(val
, "mdgradient") == 0) {
1763 wwarning(_("too few arguments in multicolor gradient specification"));
1767 if (val
[1] == 'h' || val
[1] == 'H')
1768 type
= WTEX_MHGRADIENT
;
1769 else if (val
[1] == 'v' || val
[1] == 'V')
1770 type
= WTEX_MVGRADIENT
;
1772 type
= WTEX_MDGRADIENT
;
1776 colors
= wmalloc(sizeof(RColor
*) * (count
+ 1));
1778 for (i
= 0; i
< count
; i
++) {
1779 elem
= WMGetFromPLArray(pl
, i
+ 1);
1780 if (!elem
|| !WMIsPLString(elem
)) {
1781 for (--i
; i
>= 0; --i
) {
1787 val
= WMGetFromPLString(elem
);
1789 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1790 wwarning(_("\"%s\" is not a valid color name"), val
);
1791 for (--i
; i
>= 0; --i
) {
1797 colors
[i
] = wmalloc(sizeof(RColor
));
1798 colors
[i
]->red
= color
.red
>> 8;
1799 colors
[i
]->green
= color
.green
>> 8;
1800 colors
[i
]->blue
= color
.blue
>> 8;
1805 texture
= (WTexture
*) wTextureMakeMGradient(scr
, type
, colors
);
1806 } else if (strcasecmp(val
, "spixmap") == 0 ||
1807 strcasecmp(val
, "cpixmap") == 0 || strcasecmp(val
, "tpixmap") == 0) {
1814 if (val
[0] == 's' || val
[0] == 'S')
1816 else if (val
[0] == 'c' || val
[0] == 'C')
1822 elem
= WMGetFromPLArray(pl
, 2);
1823 if (!elem
|| !WMIsPLString(elem
)) {
1826 val
= WMGetFromPLString(elem
);
1828 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1829 wwarning(_("\"%s\" is not a valid color name"), val
);
1834 elem
= WMGetFromPLArray(pl
, 1);
1835 if (!elem
|| !WMIsPLString(elem
))
1837 val
= WMGetFromPLString(elem
);
1839 texture
= (WTexture
*) wTextureMakePixmap(scr
, type
, val
, &color
);
1840 } else if (strcasecmp(val
, "thgradient") == 0
1841 || strcasecmp(val
, "tvgradient") == 0 || strcasecmp(val
, "tdgradient") == 0) {
1842 RColor color1
, color2
;
1847 if (val
[1] == 'h' || val
[1] == 'H')
1848 style
= WTEX_THGRADIENT
;
1849 else if (val
[1] == 'v' || val
[1] == 'V')
1850 style
= WTEX_TVGRADIENT
;
1852 style
= WTEX_TDGRADIENT
;
1855 wwarning(_("bad number of arguments in textured gradient specification"));
1859 /* get from color */
1860 elem
= WMGetFromPLArray(pl
, 3);
1861 if (!elem
|| !WMIsPLString(elem
))
1863 val
= WMGetFromPLString(elem
);
1865 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1866 wwarning(_("\"%s\" is not a valid color name"), val
);
1870 color1
.red
= xcolor
.red
>> 8;
1871 color1
.green
= xcolor
.green
>> 8;
1872 color1
.blue
= xcolor
.blue
>> 8;
1875 elem
= WMGetFromPLArray(pl
, 4);
1876 if (!elem
|| !WMIsPLString(elem
)) {
1879 val
= WMGetFromPLString(elem
);
1881 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1882 wwarning(_("\"%s\" is not a valid color name"), val
);
1886 color2
.red
= xcolor
.red
>> 8;
1887 color2
.green
= xcolor
.green
>> 8;
1888 color2
.blue
= xcolor
.blue
>> 8;
1891 elem
= WMGetFromPLArray(pl
, 2);
1892 if (!elem
|| !WMIsPLString(elem
))
1895 val
= WMGetFromPLString(elem
);
1897 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
1898 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
1903 elem
= WMGetFromPLArray(pl
, 1);
1904 if (!elem
|| !WMIsPLString(elem
))
1906 val
= WMGetFromPLString(elem
);
1908 texture
= (WTexture
*) wTextureMakeTGradient(scr
, style
, &color1
, &color2
, val
, opacity
);
1909 } else if (strcasecmp(val
, "function") == 0) {
1910 /* Leave this in to handle the unlikely case of
1911 * someone actually having function textures configured */
1912 wwarning("function texture support has been removed");
1915 wwarning(_("invalid texture type %s"), val
);
1921 static int getTexture(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1923 static WTexture
*texture
;
1927 if (!WMIsPLArray(value
)) {
1928 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Texture");
1930 value
= entry
->plvalue
;
1932 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1938 if (strcmp(entry
->key
, "WidgetColor") == 0 && !changed
) {
1941 pl
= WMGetFromPLArray(value
, 0);
1942 if (!pl
|| !WMIsPLString(pl
) || !WMGetFromPLString(pl
)
1943 || strcasecmp(WMGetFromPLString(pl
), "solid") != 0) {
1944 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1945 entry
->key
, "Solid Texture");
1947 value
= entry
->plvalue
;
1949 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1954 texture
= parse_texture(scr
, value
);
1957 wwarning(_("Error in texture specification for key \"%s\""), entry
->key
);
1959 value
= entry
->plvalue
;
1961 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1971 *(WTexture
**) addr
= texture
;
1976 static int getWSBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1983 /* Parameter not used, but tell the compiler that it is ok */
1988 if (!WMIsPLArray(value
)) {
1989 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1990 "WorkspaceBack", "Texture or None");
1992 value
= entry
->plvalue
;
1994 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2000 /* only do basic error checking and verify for None texture */
2002 nelem
= WMGetPropListItemCount(value
);
2004 elem
= WMGetFromPLArray(value
, 0);
2005 if (!elem
|| !WMIsPLString(elem
)) {
2006 wwarning(_("Wrong type for workspace background. Should be a texture type."));
2008 value
= entry
->plvalue
;
2010 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2015 val
= WMGetFromPLString(elem
);
2017 if (strcasecmp(val
, "None") == 0)
2020 *ret
= WMRetainPropList(value
);
2026 getWSSpecificBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2032 /* Parameter not used, but tell the compiler that it is ok */
2037 if (!WMIsPLArray(value
)) {
2038 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2039 "WorkspaceSpecificBack", "an array of textures");
2041 value
= entry
->plvalue
;
2043 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2049 /* only do basic error checking and verify for None texture */
2051 nelem
= WMGetPropListItemCount(value
);
2054 elem
= WMGetFromPLArray(value
, nelem
);
2055 if (!elem
|| !WMIsPLArray(elem
)) {
2056 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2062 *ret
= WMRetainPropList(value
);
2066 * Kluge to force wmsetbg helper to set the default background.
2067 * If the WorkspaceSpecificBack is changed once wmaker has started,
2068 * the WorkspaceBack won't be sent to the helper, unless the user
2069 * changes it's value too. So, we must force this by removing the
2070 * value from the defaults DB.
2072 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2073 WMPropList
*key
= WMCreatePLString("WorkspaceBack");
2075 WMRemoveFromPLDictionary(w_global
.domain
.wmaker
->dictionary
, key
);
2077 WMReleasePropList(key
);
2083 static int getFont(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2085 static WMFont
*font
;
2090 GET_STRING_OR_DEFAULT("Font", val
);
2092 font
= WMCreateFont(scr
->wmscreen
, val
);
2094 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2097 wfatal(_("could not load any usable font!!!"));
2104 /* can't assign font value outside update function */
2105 wassertrv(addr
== NULL
, True
);
2110 static int getColor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2112 static XColor color
;
2114 int second_pass
= 0;
2118 GET_STRING_OR_DEFAULT("Color", val
);
2121 if (!wGetColor(scr
, val
, &color
)) {
2122 wwarning(_("could not get color for key \"%s\""), entry
->key
);
2123 if (second_pass
== 0) {
2124 val
= WMGetFromPLString(entry
->plvalue
);
2126 wwarning(_("using default \"%s\" instead"), val
);
2135 assert(addr
== NULL
);
2138 *(unsigned long*)addr = pixel;
2144 static int getKeybind(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2146 static WShortKey shortcut
;
2150 char buf
[MAX_SHORTCUT_LENGTH
], *b
;
2152 /* Parameter not used, but tell the compiler that it is ok */
2156 GET_STRING_OR_DEFAULT("Key spec", val
);
2158 if (!val
|| strcasecmp(val
, "NONE") == 0) {
2159 shortcut
.keycode
= 0;
2160 shortcut
.modifier
= 0;
2166 wstrlcpy(buf
, val
, MAX_SHORTCUT_LENGTH
);
2171 shortcut
.modifier
= 0;
2172 while ((k
= strchr(b
, '+')) != NULL
) {
2176 mod
= wXModifierFromKey(b
);
2178 wwarning(_("%s: invalid key modifier \"%s\""), entry
->key
, b
);
2181 shortcut
.modifier
|= mod
;
2187 ksym
= XStringToKeysym(b
);
2189 if (ksym
== NoSymbol
) {
2190 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
, val
);
2194 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2195 if (shortcut
.keycode
== 0) {
2196 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2206 static int getModMask(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2211 /* Parameter not used, but tell the compiler that it is ok */
2214 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2219 mask
= wXModifierFromKey(str
);
2221 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2227 *(int *)addr
= mask
;
2235 # include <X11/cursorfont.h>
2241 #define CURSOR_ID_NONE (XC_num_glyphs)
2243 static const WCursorLookup cursor_table
[] = {
2244 {"X_cursor", XC_X_cursor
},
2245 {"arrow", XC_arrow
},
2246 {"based_arrow_down", XC_based_arrow_down
},
2247 {"based_arrow_up", XC_based_arrow_up
},
2249 {"bogosity", XC_bogosity
},
2250 {"bottom_left_corner", XC_bottom_left_corner
},
2251 {"bottom_right_corner", XC_bottom_right_corner
},
2252 {"bottom_side", XC_bottom_side
},
2253 {"bottom_tee", XC_bottom_tee
},
2254 {"box_spiral", XC_box_spiral
},
2255 {"center_ptr", XC_center_ptr
},
2256 {"circle", XC_circle
},
2257 {"clock", XC_clock
},
2258 {"coffee_mug", XC_coffee_mug
},
2259 {"cross", XC_cross
},
2260 {"cross_reverse", XC_cross_reverse
},
2261 {"crosshair", XC_crosshair
},
2262 {"diamond_cross", XC_diamond_cross
},
2264 {"dotbox", XC_dotbox
},
2265 {"double_arrow", XC_double_arrow
},
2266 {"draft_large", XC_draft_large
},
2267 {"draft_small", XC_draft_small
},
2268 {"draped_box", XC_draped_box
},
2269 {"exchange", XC_exchange
},
2270 {"fleur", XC_fleur
},
2271 {"gobbler", XC_gobbler
},
2272 {"gumby", XC_gumby
},
2273 {"hand1", XC_hand1
},
2274 {"hand2", XC_hand2
},
2275 {"heart", XC_heart
},
2277 {"iron_cross", XC_iron_cross
},
2278 {"left_ptr", XC_left_ptr
},
2279 {"left_side", XC_left_side
},
2280 {"left_tee", XC_left_tee
},
2281 {"leftbutton", XC_leftbutton
},
2282 {"ll_angle", XC_ll_angle
},
2283 {"lr_angle", XC_lr_angle
},
2285 {"middlebutton", XC_middlebutton
},
2286 {"mouse", XC_mouse
},
2287 {"pencil", XC_pencil
},
2288 {"pirate", XC_pirate
},
2290 {"question_arrow", XC_question_arrow
},
2291 {"right_ptr", XC_right_ptr
},
2292 {"right_side", XC_right_side
},
2293 {"right_tee", XC_right_tee
},
2294 {"rightbutton", XC_rightbutton
},
2295 {"rtl_logo", XC_rtl_logo
},
2296 {"sailboat", XC_sailboat
},
2297 {"sb_down_arrow", XC_sb_down_arrow
},
2298 {"sb_h_double_arrow", XC_sb_h_double_arrow
},
2299 {"sb_left_arrow", XC_sb_left_arrow
},
2300 {"sb_right_arrow", XC_sb_right_arrow
},
2301 {"sb_up_arrow", XC_sb_up_arrow
},
2302 {"sb_v_double_arrow", XC_sb_v_double_arrow
},
2303 {"shuttle", XC_shuttle
},
2304 {"sizing", XC_sizing
},
2305 {"spider", XC_spider
},
2306 {"spraycan", XC_spraycan
},
2308 {"target", XC_target
},
2309 {"tcross", XC_tcross
},
2310 {"top_left_arrow", XC_top_left_arrow
},
2311 {"top_left_corner", XC_top_left_corner
},
2312 {"top_right_corner", XC_top_right_corner
},
2313 {"top_side", XC_top_side
},
2314 {"top_tee", XC_top_tee
},
2316 {"ul_angle", XC_ul_angle
},
2317 {"umbrella", XC_umbrella
},
2318 {"ur_angle", XC_ur_angle
},
2319 {"watch", XC_watch
},
2320 {"xterm", XC_xterm
},
2321 {NULL
, CURSOR_ID_NONE
}
2324 static void check_bitmap_status(int status
, const char *filename
, Pixmap bitmap
)
2327 case BitmapOpenFailed
:
2328 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2330 case BitmapFileInvalid
:
2331 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2333 case BitmapNoMemory
:
2334 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2337 XFreePixmap(dpy
, bitmap
);
2344 * (builtin, <cursor_name>)
2345 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2347 static int parse_cursor(WScreen
* scr
, WMPropList
* pl
, Cursor
* cursor
)
2354 nelem
= WMGetPropListItemCount(pl
);
2358 elem
= WMGetFromPLArray(pl
, 0);
2359 if (!elem
|| !WMIsPLString(elem
)) {
2362 val
= WMGetFromPLString(elem
);
2364 if (strcasecmp(val
, "none") == 0) {
2367 } else if (strcasecmp(val
, "builtin") == 0) {
2369 int cursor_id
= CURSOR_ID_NONE
;
2372 wwarning(_("bad number of arguments in cursor specification"));
2375 elem
= WMGetFromPLArray(pl
, 1);
2376 if (!elem
|| !WMIsPLString(elem
)) {
2379 val
= WMGetFromPLString(elem
);
2381 for (i
= 0; cursor_table
[i
].name
!= NULL
; i
++) {
2382 if (strcasecmp(val
, cursor_table
[i
].name
) == 0) {
2383 cursor_id
= cursor_table
[i
].id
;
2387 if (CURSOR_ID_NONE
== cursor_id
) {
2388 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2390 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2393 } else if (strcasecmp(val
, "bitmap") == 0) {
2405 wwarning(_("bad number of arguments in cursor specification"));
2408 elem
= WMGetFromPLArray(pl
, 1);
2409 if (!elem
|| !WMIsPLString(elem
)) {
2412 val
= WMGetFromPLString(elem
);
2413 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2415 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2418 elem
= WMGetFromPLArray(pl
, 2);
2419 if (!elem
|| !WMIsPLString(elem
)) {
2423 val
= WMGetFromPLString(elem
);
2424 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2427 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2430 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
, &mask
, &x
, &y
);
2431 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
, &bitmap
, &x
, &y
);
2432 if ((BitmapSuccess
== bitmap_status
) && (BitmapSuccess
== mask_status
)) {
2433 fg
.pixel
= scr
->black_pixel
;
2434 bg
.pixel
= scr
->white_pixel
;
2435 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2436 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2437 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2440 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2441 check_bitmap_status(mask_status
, mask_name
, mask
);
2448 static int getCursor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2450 static Cursor cursor
;
2455 if (!WMIsPLArray(value
)) {
2456 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2457 entry
->key
, "cursor specification");
2459 value
= entry
->plvalue
;
2461 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2466 status
= parse_cursor(scr
, value
, &cursor
);
2468 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2470 value
= entry
->plvalue
;
2472 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2481 *(Cursor
*) addr
= cursor
;
2486 #undef CURSOR_ID_NONE
2488 /* ---------------- value setting functions --------------- */
2489 static int setJustify(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2491 /* Parameter not used, but tell the compiler that it is ok */
2497 return REFRESH_WINDOW_TITLE_COLOR
;
2500 static int setClearance(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2502 /* Parameter not used, but tell the compiler that it is ok */
2508 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
| REFRESH_MENU_TITLE_FONT
| REFRESH_MENU_FONT
;
2511 static int setIfDockPresent(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2514 long which
= (long) extra_data
;
2516 /* Parameter not used, but tell the compiler that it is ok */
2522 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2523 // Drawers require the dock
2524 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| wPreferences
.flags
.nodock
;
2527 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2530 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| *flag
;
2538 static int setClipMergedInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2542 /* Parameter not used, but tell the compiler that it is ok */
2547 wPreferences
.flags
.clip_merged_in_dock
= *flag
;
2548 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2552 static int setWrapAppiconsInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2556 /* Parameter not used, but tell the compiler that it is ok */
2561 wPreferences
.flags
.wrap_appicons_in_dock
= *flag
;
2565 static int setStickyIcons(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2567 /* Parameter not used, but tell the compiler that it is ok */
2572 if (scr
->workspaces
) {
2573 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2574 wArrangeIcons(scr
, False
);
2579 static int setIconTile(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2583 WTexture
** texture
= tdata
;
2586 /* Parameter not used, but tell the compiler that it is ok */
2589 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2590 wPreferences
.icon_size
, ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2591 ? WREL_ICON
: WREL_FLAT
);
2593 wwarning(_("could not render texture for icon background"));
2595 wTextureDestroy(scr
, *texture
);
2598 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2600 if (scr
->icon_tile
) {
2602 RReleaseImage(scr
->icon_tile
);
2603 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2606 scr
->icon_tile
= img
;
2608 /* put the icon in the noticeboard hint */
2609 PropSetIconTileHint(scr
, img
);
2611 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
) {
2612 if (scr
->clip_tile
) {
2613 RReleaseImage(scr
->clip_tile
);
2615 scr
->clip_tile
= wClipMakeTile(img
);
2618 if (!wPreferences
.flags
.nodrawer
) {
2619 if (scr
->drawer_tile
) {
2620 RReleaseImage(scr
->drawer_tile
);
2622 scr
->drawer_tile
= wDrawerMakeTile(scr
, img
);
2625 scr
->icon_tile_pixmap
= pixmap
;
2627 if (scr
->def_icon_rimage
) {
2628 RReleaseImage(scr
->def_icon_rimage
);
2629 scr
->def_icon_rimage
= NULL
;
2632 if (scr
->icon_back_texture
)
2633 wTextureDestroy(scr
, (WTexture
*) scr
->icon_back_texture
);
2635 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2637 /* Free the texture as nobody else will use it, nor refer to it. */
2639 wTextureDestroy(scr
, *texture
);
2641 return (reset
? REFRESH_ICON_TILE
: 0);
2644 static int setWinTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2646 WMFont
*font
= tdata
;
2648 /* Parameter not used, but tell the compiler that it is ok */
2652 if (scr
->title_font
) {
2653 WMReleaseFont(scr
->title_font
);
2655 scr
->title_font
= font
;
2657 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
;
2660 static int setMenuTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2662 WMFont
*font
= tdata
;
2664 /* Parameter not used, but tell the compiler that it is ok */
2668 if (scr
->menu_title_font
) {
2669 WMReleaseFont(scr
->menu_title_font
);
2672 scr
->menu_title_font
= font
;
2674 return REFRESH_MENU_TITLE_FONT
;
2677 static int setMenuTextFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2679 WMFont
*font
= tdata
;
2681 /* Parameter not used, but tell the compiler that it is ok */
2685 if (scr
->menu_entry_font
) {
2686 WMReleaseFont(scr
->menu_entry_font
);
2688 scr
->menu_entry_font
= font
;
2690 return REFRESH_MENU_FONT
;
2693 static int setIconTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2695 WMFont
*font
= tdata
;
2697 /* Parameter not used, but tell the compiler that it is ok */
2701 if (scr
->icon_title_font
) {
2702 WMReleaseFont(scr
->icon_title_font
);
2705 scr
->icon_title_font
= font
;
2707 return REFRESH_ICON_FONT
;
2710 static int setClipTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2712 WMFont
*font
= tdata
;
2714 /* Parameter not used, but tell the compiler that it is ok */
2718 if (scr
->clip_title_font
) {
2719 WMReleaseFont(scr
->clip_title_font
);
2722 scr
->clip_title_font
= font
;
2724 return REFRESH_ICON_FONT
;
2727 static int setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2729 WMFont
*font
= tdata
;
2731 /* Parameter not used, but tell the compiler that it is ok */
2736 if (scr
->workspace_name_font
)
2737 WMReleaseFont(scr
->workspace_name_font
);
2739 scr
->workspace_name_font
= font
;
2744 static int setHightlight(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2746 XColor
*color
= tdata
;
2748 /* Parameter not used, but tell the compiler that it is ok */
2752 if (scr
->select_color
)
2753 WMReleaseColor(scr
->select_color
);
2755 scr
->select_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2757 wFreeColor(scr
, color
->pixel
);
2759 return REFRESH_MENU_COLOR
;
2762 static int setHightlightText(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2764 XColor
*color
= tdata
;
2766 /* Parameter not used, but tell the compiler that it is ok */
2770 if (scr
->select_text_color
)
2771 WMReleaseColor(scr
->select_text_color
);
2773 scr
->select_text_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2775 wFreeColor(scr
, color
->pixel
);
2777 return REFRESH_MENU_COLOR
;
2780 static int setClipTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2782 XColor
*color
= tdata
;
2783 long widx
= (long) extra_data
;
2785 /* Parameter not used, but tell the compiler that it is ok */
2788 if (scr
->clip_title_color
[widx
])
2789 WMReleaseColor(scr
->clip_title_color
[widx
]);
2791 scr
->clip_title_color
[widx
] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2792 wFreeColor(scr
, color
->pixel
);
2794 return REFRESH_ICON_TITLE_COLOR
;
2797 static int setWTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2799 XColor
*color
= tdata
;
2800 long widx
= (long) extra_data
;
2802 /* Parameter not used, but tell the compiler that it is ok */
2805 if (scr
->window_title_color
[widx
])
2806 WMReleaseColor(scr
->window_title_color
[widx
]);
2808 scr
->window_title_color
[widx
] =
2809 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2811 wFreeColor(scr
, color
->pixel
);
2813 return REFRESH_WINDOW_TITLE_COLOR
;
2816 static int setMenuTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2818 XColor
*color
= tdata
;
2820 /* Parameter not used, but tell the compiler that it is ok */
2824 if (scr
->menu_title_color
[0])
2825 WMReleaseColor(scr
->menu_title_color
[0]);
2827 scr
->menu_title_color
[0] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2829 wFreeColor(scr
, color
->pixel
);
2831 return REFRESH_MENU_TITLE_COLOR
;
2834 static int setMenuTextColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2836 XColor
*color
= tdata
;
2838 /* Parameter not used, but tell the compiler that it is ok */
2842 if (scr
->mtext_color
)
2843 WMReleaseColor(scr
->mtext_color
);
2845 scr
->mtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2847 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2848 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2850 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2853 wFreeColor(scr
, color
->pixel
);
2855 return REFRESH_MENU_COLOR
;
2858 static int setMenuDisabledColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2860 XColor
*color
= tdata
;
2862 /* Parameter not used, but tell the compiler that it is ok */
2866 if (scr
->dtext_color
)
2867 WMReleaseColor(scr
->dtext_color
);
2869 scr
->dtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2871 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2872 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2874 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2877 wFreeColor(scr
, color
->pixel
);
2879 return REFRESH_MENU_COLOR
;
2882 static int setIconTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2884 XColor
*color
= tdata
;
2886 /* Parameter not used, but tell the compiler that it is ok */
2890 if (scr
->icon_title_color
)
2891 WMReleaseColor(scr
->icon_title_color
);
2892 scr
->icon_title_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2894 wFreeColor(scr
, color
->pixel
);
2896 return REFRESH_ICON_TITLE_COLOR
;
2899 static int setIconTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2901 XColor
*color
= tdata
;
2903 /* Parameter not used, but tell the compiler that it is ok */
2907 if (scr
->icon_title_texture
) {
2908 wTextureDestroy(scr
, (WTexture
*) scr
->icon_title_texture
);
2910 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
2912 return REFRESH_ICON_TITLE_BACK
;
2915 static int setFrameBorderWidth(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2919 /* Parameter not used, but tell the compiler that it is ok */
2923 scr
->frame_border_width
= *value
;
2925 return REFRESH_FRAME_BORDER
;
2928 static int setFrameBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2930 XColor
*color
= tdata
;
2932 /* Parameter not used, but tell the compiler that it is ok */
2936 if (scr
->frame_border_color
)
2937 WMReleaseColor(scr
->frame_border_color
);
2938 scr
->frame_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2940 wFreeColor(scr
, color
->pixel
);
2942 return REFRESH_FRAME_BORDER
;
2945 static int setFrameFocusedBorderColor(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2947 XColor
*color
= tdata
;
2949 /* Parameter not used, but tell the compiler that it is ok */
2953 if (scr
->frame_focused_border_color
)
2954 WMReleaseColor(scr
->frame_focused_border_color
);
2955 scr
->frame_focused_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2957 wFreeColor(scr
, color
->pixel
);
2959 return REFRESH_FRAME_BORDER
;
2962 static int setFrameSelectedBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2964 XColor
*color
= tdata
;
2966 /* Parameter not used, but tell the compiler that it is ok */
2970 if (scr
->frame_selected_border_color
)
2971 WMReleaseColor(scr
->frame_selected_border_color
);
2972 scr
->frame_selected_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2974 wFreeColor(scr
, color
->pixel
);
2976 return REFRESH_FRAME_BORDER
;
2979 static int setWorkspaceSpecificBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
2981 WMPropList
*value
= tdata
;
2986 /* Parameter not used, but tell the compiler that it is ok */
2990 if (scr
->flags
.backimage_helper_launched
) {
2991 if (WMGetPropListItemCount(value
) == 0) {
2992 SendHelperMessage(scr
, 'C', 0, NULL
);
2993 SendHelperMessage(scr
, 'K', 0, NULL
);
2995 WMReleasePropList(value
);
2999 if (WMGetPropListItemCount(value
) == 0)
3002 if (!start_bg_helper(scr
)) {
3003 WMReleasePropList(value
);
3007 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3010 for (i
= 0; i
< WMGetPropListItemCount(value
); i
++) {
3011 val
= WMGetFromPLArray(value
, i
);
3012 if (val
&& WMIsPLArray(val
) && WMGetPropListItemCount(val
) > 0) {
3013 str
= WMGetPropListDescription(val
, False
);
3015 SendHelperMessage(scr
, 'S', i
+ 1, str
);
3019 SendHelperMessage(scr
, 'U', i
+ 1, NULL
);
3024 WMReleasePropList(value
);
3028 static int setWorkspaceBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
3030 WMPropList
*value
= tdata
;
3032 /* Parameter not used, but tell the compiler that it is ok */
3036 if (scr
->flags
.backimage_helper_launched
) {
3039 if (WMGetPropListItemCount(value
) == 0) {
3040 SendHelperMessage(scr
, 'U', 0, NULL
);
3042 /* set the default workspace background to this one */
3043 str
= WMGetPropListDescription(value
, False
);
3045 SendHelperMessage(scr
, 'S', 0, str
);
3047 SendHelperMessage(scr
, 'C', scr
->current_workspace
+ 1, NULL
);
3049 SendHelperMessage(scr
, 'U', 0, NULL
);
3052 } else if (WMGetPropListItemCount(value
) > 0) {
3057 text
= WMGetPropListDescription(value
, False
);
3058 len
= strlen(text
) + 40;
3059 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3060 if (!strchr(text
, '\'') && !strchr(text
, '\\')) {
3063 if (wPreferences
.smooth_workspace_back
)
3064 snprintf(command
, len
, "wmsetbg %s -S -p '%s' &", dither
, text
);
3066 snprintf(command
, len
, "wmsetbg %s -p '%s' &", dither
, text
);
3067 ExecuteShellCommand(scr
, command
);
3069 wwarning(_("Invalid arguments for background \"%s\""), text
);
3072 WMReleasePropList(value
);
3077 static int setWidgetColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3079 WTexture
**texture
= tdata
;
3081 /* Parameter not used, but tell the compiler that it is ok */
3085 if (scr
->widget_texture
) {
3086 wTextureDestroy(scr
, (WTexture
*) scr
->widget_texture
);
3088 scr
->widget_texture
= *(WTexSolid
**) texture
;
3093 static int setFTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3095 WTexture
**texture
= tdata
;
3097 /* Parameter not used, but tell the compiler that it is ok */
3101 if (scr
->window_title_texture
[WS_FOCUSED
]) {
3102 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3104 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3106 return REFRESH_WINDOW_TEXTURES
;
3109 static int setPTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3111 WTexture
**texture
= tdata
;
3113 /* Parameter not used, but tell the compiler that it is ok */
3117 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
3118 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3120 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3122 return REFRESH_WINDOW_TEXTURES
;
3125 static int setUTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3127 WTexture
**texture
= tdata
;
3129 /* Parameter not used, but tell the compiler that it is ok */
3133 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
3134 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3136 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3138 return REFRESH_WINDOW_TEXTURES
;
3141 static int setResizebarBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3143 WTexture
**texture
= tdata
;
3145 /* Parameter not used, but tell the compiler that it is ok */
3149 if (scr
->resizebar_texture
[0]) {
3150 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3152 scr
->resizebar_texture
[0] = *texture
;
3154 return REFRESH_WINDOW_TEXTURES
;
3157 static int setMenuTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3159 WTexture
**texture
= tdata
;
3161 /* Parameter not used, but tell the compiler that it is ok */
3165 if (scr
->menu_title_texture
[0]) {
3166 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3168 scr
->menu_title_texture
[0] = *texture
;
3170 return REFRESH_MENU_TITLE_TEXTURE
;
3173 static int setMenuTextBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3175 WTexture
**texture
= tdata
;
3177 /* Parameter not used, but tell the compiler that it is ok */
3181 if (scr
->menu_item_texture
) {
3182 wTextureDestroy(scr
, scr
->menu_item_texture
);
3183 wTextureDestroy(scr
, (WTexture
*) scr
->menu_item_auxtexture
);
3185 scr
->menu_item_texture
= *texture
;
3187 scr
->menu_item_auxtexture
= wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3189 return REFRESH_MENU_TEXTURE
;
3192 static int setKeyGrab(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3194 WShortKey
*shortcut
= tdata
;
3196 long widx
= (long) extra_data
;
3198 /* Parameter not used, but tell the compiler that it is ok */
3201 wKeyBindings
[widx
] = *shortcut
;
3203 wwin
= scr
->focused_window
;
3205 while (wwin
!= NULL
) {
3206 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3208 if (!WFLAGP(wwin
, no_bind_keys
)) {
3209 wWindowSetKeyGrabs(wwin
);
3214 /* do we need to update window menus? */
3215 if (widx
>= WKBD_WORKSPACE1
&& widx
<= WKBD_WORKSPACE10
)
3216 return REFRESH_WORKSPACE_MENU
;
3217 if (widx
== WKBD_LASTWORKSPACE
)
3218 return REFRESH_WORKSPACE_MENU
;
3219 if (widx
>= WKBD_MOVE_WORKSPACE1
&& widx
<= WKBD_MOVE_WORKSPACE10
)
3220 return REFRESH_WORKSPACE_MENU
;
3225 static int setIconPosition(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3227 /* Parameter not used, but tell the compiler that it is ok */
3232 wScreenUpdateUsableArea(scr
);
3233 wArrangeIcons(scr
, True
);
3238 static int updateUsableArea(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3240 /* Parameter not used, but tell the compiler that it is ok */
3245 wScreenUpdateUsableArea(scr
);
3250 static int setWorkspaceMapBackground(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3252 WTexture
**texture
= tdata
;
3254 /* Parameter not used, but tell the compiler that it is ok */
3258 if (wPreferences
.wsmbackTexture
)
3259 wTextureDestroy(scr
, wPreferences
.wsmbackTexture
);
3261 wPreferences
.wsmbackTexture
= *texture
;
3263 return REFRESH_WINDOW_TEXTURES
;
3266 static int setMenuStyle(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3268 /* Parameter not used, but tell the compiler that it is ok */
3274 return REFRESH_MENU_TEXTURE
;
3277 static RImage
*chopOffImage(RImage
* image
, int x
, int y
, int w
, int h
)
3279 RImage
*img
= RCreateImage(w
, h
, image
->format
== RRGBAFormat
);
3281 RCopyArea(img
, image
, x
, y
, w
, h
, 0, 0);
3286 static int setSwPOptions(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3288 WMPropList
*array
= tdata
;
3291 int cwidth
, cheight
;
3292 struct WPreferences
*prefs
= foo
;
3294 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) == 0) {
3295 if (prefs
->swtileImage
)
3296 RReleaseImage(prefs
->swtileImage
);
3297 prefs
->swtileImage
= NULL
;
3299 WMReleasePropList(array
);
3303 switch (WMGetPropListItemCount(array
)) {
3305 if (!WMIsPLString(WMGetFromPLArray(array
, 1))) {
3306 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3309 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 1)));
3312 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3313 WMGetFromPLString(WMGetFromPLArray(array
, 1)), entry
->key
);
3315 bgimage
= RLoadImage(scr
->rcontext
, path
, 0);
3317 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3322 cwidth
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 2)));
3323 cheight
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 3)));
3325 if (cwidth
<= 0 || cheight
<= 0 ||
3326 cwidth
>= bgimage
->width
- 2 || cheight
>= bgimage
->height
- 2)
3327 wwarning(_("Invalid split sizes for switch panel back image."));
3330 int swidth
, theight
;
3331 for (i
= 0; i
< 9; i
++) {
3332 if (prefs
->swbackImage
[i
])
3333 RReleaseImage(prefs
->swbackImage
[i
]);
3334 prefs
->swbackImage
[i
] = NULL
;
3336 swidth
= (bgimage
->width
- cwidth
) / 2;
3337 theight
= (bgimage
->height
- cheight
) / 2;
3339 prefs
->swbackImage
[0] = chopOffImage(bgimage
, 0, 0, swidth
, theight
);
3340 prefs
->swbackImage
[1] = chopOffImage(bgimage
, swidth
, 0, cwidth
, theight
);
3341 prefs
->swbackImage
[2] = chopOffImage(bgimage
, swidth
+ cwidth
, 0,
3344 prefs
->swbackImage
[3] = chopOffImage(bgimage
, 0, theight
, swidth
, cheight
);
3345 prefs
->swbackImage
[4] = chopOffImage(bgimage
, swidth
, theight
,
3347 prefs
->swbackImage
[5] = chopOffImage(bgimage
, swidth
+ cwidth
, theight
,
3350 prefs
->swbackImage
[6] = chopOffImage(bgimage
, 0, theight
+ cheight
,
3352 prefs
->swbackImage
[7] = chopOffImage(bgimage
, swidth
, theight
+ cheight
,
3354 prefs
->swbackImage
[8] =
3355 chopOffImage(bgimage
, swidth
+ cwidth
, theight
+ cheight
, swidth
,
3358 // check if anything failed
3359 for (i
= 0; i
< 9; i
++) {
3360 if (!prefs
->swbackImage
[i
]) {
3361 for (; i
>= 0; --i
) {
3362 RReleaseImage(prefs
->swbackImage
[i
]);
3363 prefs
->swbackImage
[i
] = NULL
;
3369 RReleaseImage(bgimage
);
3374 if (!WMIsPLString(WMGetFromPLArray(array
, 0))) {
3375 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3378 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 0)));
3381 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3382 WMGetFromPLString(WMGetFromPLArray(array
, 0)), entry
->key
);
3384 if (prefs
->swtileImage
)
3385 RReleaseImage(prefs
->swtileImage
);
3387 prefs
->swtileImage
= RLoadImage(scr
->rcontext
, path
, 0);
3388 if (!prefs
->swtileImage
) {
3389 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3396 wwarning(_("Invalid number of arguments for option \"%s\""), entry
->key
);
3400 WMReleasePropList(array
);
3405 static int setModifierKeyLabels(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3407 WMPropList
*array
= tdata
;
3409 struct WPreferences
*prefs
= foo
;
3411 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) != 7) {
3412 wwarning(_("Value for option \"%s\" must be an array of 7 strings"), entry
->key
);
3413 WMReleasePropList(array
);
3417 DestroyWindowMenu(scr
);
3419 for (i
= 0; i
< 7; i
++) {
3420 if (prefs
->modifier_labels
[i
])
3421 wfree(prefs
->modifier_labels
[i
]);
3423 if (WMIsPLString(WMGetFromPLArray(array
, i
))) {
3424 prefs
->modifier_labels
[i
] = wstrdup(WMGetFromPLString(WMGetFromPLArray(array
, i
)));
3426 wwarning(_("Invalid argument for option \"%s\" item %d"), entry
->key
, i
);
3427 prefs
->modifier_labels
[i
] = NULL
;
3431 WMReleasePropList(array
);
3436 static int setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3440 /* Parameter not used, but tell the compiler that it is ok */
3447 W_setconf_doubleClickDelay(*value
);
3452 static int setCursor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3454 Cursor
*cursor
= tdata
;
3455 long widx
= (long) extra_data
;
3457 /* Parameter not used, but tell the compiler that it is ok */
3460 if (wPreferences
.cursor
[widx
] != None
) {
3461 XFreeCursor(dpy
, wPreferences
.cursor
[widx
]);
3464 wPreferences
.cursor
[widx
] = *cursor
;
3466 if (widx
== WCUR_ROOT
&& *cursor
!= None
) {
3467 XDefineCursor(dpy
, scr
->root_win
, *cursor
);