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-2023 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
;
154 static WDECallbackUpdate setHotCornerActions
;
156 static WDECallbackConvert getCursor
;
157 static WDECallbackUpdate setCursor
;
158 static WDECallbackUpdate updateDock
;
161 * Tables to convert strings to enumeration values.
162 * Values stored are char
165 /* WARNING: sum of length of all value strings must not exceed
167 #define TOTAL_VALUES_LENGTH 80
169 #define REFRESH_WINDOW_TEXTURES (1<<0)
170 #define REFRESH_MENU_TEXTURE (1<<1)
171 #define REFRESH_MENU_FONT (1<<2)
172 #define REFRESH_MENU_COLOR (1<<3)
173 #define REFRESH_MENU_TITLE_TEXTURE (1<<4)
174 #define REFRESH_MENU_TITLE_FONT (1<<5)
175 #define REFRESH_MENU_TITLE_COLOR (1<<6)
176 #define REFRESH_WINDOW_TITLE_COLOR (1<<7)
177 #define REFRESH_WINDOW_FONT (1<<8)
178 #define REFRESH_ICON_TILE (1<<9)
179 #define REFRESH_ICON_FONT (1<<10)
181 #define REFRESH_BUTTON_IMAGES (1<<11)
183 #define REFRESH_ICON_TITLE_COLOR (1<<12)
184 #define REFRESH_ICON_TITLE_BACK (1<<13)
186 #define REFRESH_WORKSPACE_MENU (1<<14)
188 #define REFRESH_FRAME_BORDER REFRESH_MENU_FONT|REFRESH_WINDOW_FONT
190 static WOptionEnumeration seFocusModes
[] = {
191 {"Manual", WKF_CLICK
, 0}, {"ClickToFocus", WKF_CLICK
, 1},
192 {"Sloppy", WKF_SLOPPY
, 0}, {"SemiAuto", WKF_SLOPPY
, 1}, {"Auto", WKF_SLOPPY
, 1},
196 static WOptionEnumeration seTitlebarModes
[] = {
197 {"new", TS_NEW
, 0}, {"old", TS_OLD
, 0},
198 {"next", TS_NEXT
, 0}, {NULL
, 0, 0}
201 static WOptionEnumeration seColormapModes
[] = {
202 {"Manual", WCM_CLICK
, 0}, {"ClickToFocus", WCM_CLICK
, 1},
203 {"Auto", WCM_POINTER
, 0}, {"FocusFollowMouse", WCM_POINTER
, 1},
207 static WOptionEnumeration sePlacements
[] = {
208 {"Auto", WPM_AUTO
, 0},
209 {"Smart", WPM_SMART
, 0},
210 {"Cascade", WPM_CASCADE
, 0},
211 {"Random", WPM_RANDOM
, 0},
212 {"Manual", WPM_MANUAL
, 0},
213 {"Center", WPM_CENTER
, 0},
217 static WOptionEnumeration seGeomDisplays
[] = {
218 {"None", WDIS_NONE
, 0},
219 {"Center", WDIS_CENTER
, 0},
220 {"Corner", WDIS_TOPLEFT
, 0},
221 {"Floating", WDIS_FRAME_CENTER
, 0},
222 {"Line", WDIS_NEW
, 0},
226 static WOptionEnumeration seSpeeds
[] = {
227 {"UltraFast", SPEED_ULTRAFAST
, 0},
228 {"Fast", SPEED_FAST
, 0},
229 {"Medium", SPEED_MEDIUM
, 0},
230 {"Slow", SPEED_SLOW
, 0},
231 {"UltraSlow", SPEED_ULTRASLOW
, 0},
235 static WOptionEnumeration seMouseButtonActions
[] = {
236 {"None", WA_NONE
, 0},
237 {"SelectWindows", WA_SELECT_WINDOWS
, 0},
238 {"OpenApplicationsMenu", WA_OPEN_APPMENU
, 0},
239 {"OpenWindowListMenu", WA_OPEN_WINLISTMENU
, 0},
240 {"MoveToPrevWorkspace", WA_MOVE_PREVWORKSPACE
, 0},
241 {"MoveToNextWorkspace", WA_MOVE_NEXTWORKSPACE
, 0},
242 {"MoveToPrevWindow", WA_MOVE_PREVWINDOW
, 0},
243 {"MoveToNextWindow", WA_MOVE_NEXTWINDOW
, 0},
247 static WOptionEnumeration seMouseWheelActions
[] = {
248 {"None", WA_NONE
, 0},
249 {"SwitchWorkspaces", WA_SWITCH_WORKSPACES
, 0},
250 {"SwitchWindows", WA_SWITCH_WINDOWS
, 0},
254 static WOptionEnumeration seIconificationStyles
[] = {
255 {"Zoom", WIS_ZOOM
, 0},
256 {"Twist", WIS_TWIST
, 0},
257 {"Flip", WIS_FLIP
, 0},
258 {"None", WIS_NONE
, 0},
259 {"random", WIS_RANDOM
, 0},
263 static WOptionEnumeration seJustifications
[] = {
264 {"Left", WTJ_LEFT
, 0},
265 {"Center", WTJ_CENTER
, 0},
266 {"Right", WTJ_RIGHT
, 0},
270 static WOptionEnumeration seIconPositions
[] = {
271 {"blv", IY_BOTTOM
| IY_LEFT
| IY_VERT
, 0},
272 {"blh", IY_BOTTOM
| IY_LEFT
| IY_HORIZ
, 0},
273 {"brv", IY_BOTTOM
| IY_RIGHT
| IY_VERT
, 0},
274 {"brh", IY_BOTTOM
| IY_RIGHT
| IY_HORIZ
, 0},
275 {"tlv", IY_TOP
| IY_LEFT
| IY_VERT
, 0},
276 {"tlh", IY_TOP
| IY_LEFT
| IY_HORIZ
, 0},
277 {"trv", IY_TOP
| IY_RIGHT
| IY_VERT
, 0},
278 {"trh", IY_TOP
| IY_RIGHT
| IY_HORIZ
, 0},
282 static WOptionEnumeration seMenuStyles
[] = {
283 {"normal", MS_NORMAL
, 0},
284 {"singletexture", MS_SINGLE_TEXTURE
, 0},
285 {"flat", MS_FLAT
, 0},
289 static WOptionEnumeration seDisplayPositions
[] = {
290 {"none", WD_NONE
, 0},
291 {"center", WD_CENTER
, 0},
293 {"bottom", WD_BOTTOM
, 0},
294 {"topleft", WD_TOPLEFT
, 0},
295 {"topright", WD_TOPRIGHT
, 0},
296 {"bottomleft", WD_BOTTOMLEFT
, 0},
297 {"bottomright", WD_BOTTOMRIGHT
, 0},
301 static WOptionEnumeration seWorkspaceBorder
[] = {
302 {"None", WB_NONE
, 0},
303 {"LeftRight", WB_LEFTRIGHT
, 0},
304 {"TopBottom", WB_TOPBOTTOM
, 0},
305 {"AllDirections", WB_ALLDIRS
, 0},
309 static WOptionEnumeration seDragMaximizedWindow
[] = {
310 {"Move", DRAGMAX_MOVE
, 0},
311 {"RestoreGeometry", DRAGMAX_RESTORE
, 0},
312 {"Unmaximize", DRAGMAX_UNMAXIMIZE
, 0},
313 {"NoMove", DRAGMAX_NOMOVE
, 0},
318 * ALL entries in the tables below NEED to have a default value
319 * defined, and this value needs to be correct.
321 * Also add the default key/value pair to WindowMaker/Defaults/WindowMaker.in
324 /* these options will only affect the window manager on startup
326 * static defaults can't access the screen data, because it is
327 * created after these defaults are read
329 WDefaultEntry staticOptionList
[] = {
331 {"ColormapSize", "4", NULL
,
332 &wPreferences
.cmap_size
, getInt
, NULL
, NULL
, NULL
},
333 {"DisableDithering", "NO", NULL
,
334 &wPreferences
.no_dithering
, getBool
, NULL
, NULL
, NULL
},
335 {"IconSize", "64", NULL
,
336 &wPreferences
.icon_size
, getInt
, NULL
, NULL
, NULL
},
337 {"ModifierKey", "Mod1", NULL
,
338 &wPreferences
.modifier_mask
, getModMask
, NULL
, NULL
, NULL
},
339 {"FocusMode", "manual", seFocusModes
, /* have a problem when switching from */
340 &wPreferences
.focus_mode
, getEnum
, NULL
, NULL
, NULL
}, /* manual to sloppy without restart */
341 {"NewStyle", "new", seTitlebarModes
,
342 &wPreferences
.new_style
, getEnum
, NULL
, NULL
, NULL
},
343 {"DisableDock", "NO", (void *)WM_DOCK
,
344 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
345 {"DisableClip", "NO", (void *)WM_CLIP
,
346 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
347 {"DisableDrawers", "NO", (void *)WM_DRAWER
,
348 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
349 {"ClipMergedInDock", "NO", NULL
,
350 NULL
, getBool
, setClipMergedInDock
, NULL
, NULL
},
351 {"DisableMiniwindows", "NO", NULL
,
352 &wPreferences
.disable_miniwindows
, getBool
, NULL
, NULL
, NULL
},
353 {"EnableWorkspacePager", "NO", NULL
,
354 &wPreferences
.enable_workspace_pager
, getBool
, NULL
, NULL
, NULL
},
355 {"SwitchPanelIconSize", "64", NULL
,
356 &wPreferences
.switch_panel_icon_size
, getInt
, NULL
, NULL
, NULL
},
359 #define NUM2STRING_(x) #x
360 #define NUM2STRING(x) NUM2STRING_(x)
362 WDefaultEntry optionList
[] = {
364 /* dynamic options */
366 {"IconPosition", "blh", seIconPositions
,
367 &wPreferences
.icon_yard
, getEnum
, setIconPosition
, NULL
, NULL
},
368 {"IconificationStyle", "Zoom", seIconificationStyles
,
369 &wPreferences
.iconification_style
, getEnum
, NULL
, NULL
, NULL
},
370 {"EnforceIconMargin", "NO", NULL
,
371 &wPreferences
.enforce_icon_margin
, getBool
, NULL
, NULL
, NULL
},
372 {"DisableWSMouseActions", "NO", NULL
,
373 &wPreferences
.disable_root_mouse
, getBool
, NULL
, NULL
, NULL
},
374 {"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions
,
375 &wPreferences
.mouse_button1
, getEnum
, NULL
, NULL
, NULL
},
376 {"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions
,
377 &wPreferences
.mouse_button2
, getEnum
, NULL
, NULL
, NULL
},
378 {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions
,
379 &wPreferences
.mouse_button3
, getEnum
, NULL
, NULL
, NULL
},
380 {"MouseBackwardButtonAction", "None", seMouseButtonActions
,
381 &wPreferences
.mouse_button8
, getEnum
, NULL
, NULL
, NULL
},
382 {"MouseForwardButtonAction", "None", seMouseButtonActions
,
383 &wPreferences
.mouse_button9
, getEnum
, NULL
, NULL
, NULL
},
384 {"MouseWheelAction", "None", seMouseWheelActions
,
385 &wPreferences
.mouse_wheel_scroll
, getEnum
, NULL
, NULL
, NULL
},
386 {"MouseWheelTiltAction", "None", seMouseWheelActions
,
387 &wPreferences
.mouse_wheel_tilt
, getEnum
, NULL
, NULL
, NULL
},
388 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
389 &wPreferences
.pixmap_path
, getPathList
, NULL
, NULL
, NULL
},
390 {"IconPath", DEF_ICON_PATHS
, NULL
,
391 &wPreferences
.icon_path
, getPathList
, NULL
, NULL
, NULL
},
392 {"ColormapMode", "auto", seColormapModes
,
393 &wPreferences
.colormap_mode
, getEnum
, NULL
, NULL
, NULL
},
394 {"AutoFocus", "YES", NULL
,
395 &wPreferences
.auto_focus
, getBool
, NULL
, NULL
, NULL
},
396 {"RaiseDelay", "0", NULL
,
397 &wPreferences
.raise_delay
, getInt
, NULL
, NULL
, NULL
},
398 {"CirculateRaise", "NO", NULL
,
399 &wPreferences
.circ_raise
, getBool
, NULL
, NULL
, NULL
},
400 {"Superfluous", "YES", NULL
,
401 &wPreferences
.superfluous
, getBool
, NULL
, NULL
, NULL
},
402 {"AdvanceToNewWorkspace", "NO", NULL
,
403 &wPreferences
.ws_advance
, getBool
, NULL
, NULL
, NULL
},
404 {"CycleWorkspaces", "NO", NULL
,
405 &wPreferences
.ws_cycle
, getBool
, NULL
, NULL
, NULL
},
406 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
407 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
, NULL
, NULL
},
408 {"WorkspaceBorder", "None", seWorkspaceBorder
,
409 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
, NULL
, NULL
},
410 {"WorkspaceBorderSize", "0", NULL
,
411 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
, NULL
, NULL
},
412 {"StickyIcons", "NO", NULL
,
413 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
, NULL
, NULL
},
414 {"SaveSessionOnExit", "NO", NULL
,
415 &wPreferences
.save_session_on_exit
, getBool
, NULL
, NULL
, NULL
},
416 {"WrapMenus", "NO", NULL
,
417 &wPreferences
.wrap_menus
, getBool
, NULL
, NULL
, NULL
},
418 {"ScrollableMenus", "YES", NULL
,
419 &wPreferences
.scrollable_menus
, getBool
, NULL
, NULL
, NULL
},
420 {"MenuScrollSpeed", "fast", seSpeeds
,
421 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
, NULL
, NULL
},
422 {"IconSlideSpeed", "fast", seSpeeds
,
423 &wPreferences
.icon_slide_speed
, getEnum
, NULL
, NULL
, NULL
},
424 {"ShadeSpeed", "fast", seSpeeds
,
425 &wPreferences
.shade_speed
, getEnum
, NULL
, NULL
, NULL
},
426 {"BounceAppIconsWhenUrgent", "YES", NULL
,
427 &wPreferences
.bounce_appicons_when_urgent
, getBool
, NULL
, NULL
, NULL
},
428 {"RaiseAppIconsWhenBouncing", "NO", NULL
,
429 &wPreferences
.raise_appicons_when_bouncing
, getBool
, NULL
, NULL
, NULL
},
430 {"DoNotMakeAppIconsBounce", "NO", NULL
,
431 &wPreferences
.do_not_make_appicons_bounce
, getBool
, NULL
, NULL
, NULL
},
432 {"DoubleClickTime", "250", (void *)&wPreferences
.dblclick_time
,
433 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
, NULL
, NULL
},
434 {"ClipAutoraiseDelay", "600", NULL
,
435 &wPreferences
.clip_auto_raise_delay
, getInt
, NULL
, NULL
, NULL
},
436 {"ClipAutolowerDelay", "1000", NULL
,
437 &wPreferences
.clip_auto_lower_delay
, getInt
, NULL
, NULL
, NULL
},
438 {"ClipAutoexpandDelay", "600", NULL
,
439 &wPreferences
.clip_auto_expand_delay
, getInt
, NULL
, NULL
, NULL
},
440 {"ClipAutocollapseDelay", "1000", NULL
,
441 &wPreferences
.clip_auto_collapse_delay
, getInt
, NULL
, NULL
, NULL
},
442 {"WrapAppiconsInDock", "YES", NULL
,
443 NULL
, getBool
, setWrapAppiconsInDock
, NULL
, NULL
},
444 {"AlignSubmenus", "NO", NULL
,
445 &wPreferences
.align_menus
, getBool
, NULL
, NULL
, NULL
},
446 {"ViKeyMenus", "NO", NULL
,
447 &wPreferences
.vi_key_menus
, getBool
, NULL
, NULL
, NULL
},
448 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
449 &wPreferences
.open_transients_with_parent
, getBool
, NULL
, NULL
, NULL
},
450 {"WindowPlacement", "auto", sePlacements
,
451 &wPreferences
.window_placement
, getEnum
, NULL
, NULL
, NULL
},
452 {"IgnoreFocusClick", "NO", NULL
,
453 &wPreferences
.ignore_focus_click
, getBool
, NULL
, NULL
, NULL
},
454 {"UseSaveUnders", "NO", NULL
,
455 &wPreferences
.use_saveunders
, getBool
, NULL
, NULL
, NULL
},
456 {"OpaqueMove", "YES", NULL
,
457 &wPreferences
.opaque_move
, getBool
, NULL
, NULL
, NULL
},
458 {"OpaqueResize", "NO", NULL
,
459 &wPreferences
.opaque_resize
, getBool
, NULL
, NULL
, NULL
},
460 {"OpaqueMoveResizeKeyboard", "NO", NULL
,
461 &wPreferences
.opaque_move_resize_keyboard
, getBool
, NULL
, NULL
, NULL
},
462 {"DisableAnimations", "NO", NULL
,
463 &wPreferences
.no_animations
, getBool
, NULL
, NULL
, NULL
},
464 {"DontLinkWorkspaces", "YES", NULL
,
465 &wPreferences
.no_autowrap
, getBool
, NULL
, NULL
, NULL
},
466 {"WindowSnapping", "NO", NULL
,
467 &wPreferences
.window_snapping
, getBool
, NULL
, NULL
, NULL
},
468 {"SnapEdgeDetect", "1", NULL
,
469 &wPreferences
.snap_edge_detect
, getInt
, NULL
, NULL
, NULL
},
470 {"SnapCornerDetect", "10", NULL
,
471 &wPreferences
.snap_corner_detect
, getInt
, NULL
, NULL
, NULL
},
472 {"SnapToTopMaximizesFullscreen", "NO", NULL
,
473 &wPreferences
.snap_to_top_maximizes_fullscreen
, getBool
, NULL
, NULL
, NULL
},
474 {"DragMaximizedWindow", "Move", seDragMaximizedWindow
,
475 &wPreferences
.drag_maximized_window
, getEnum
, NULL
, NULL
, NULL
},
476 {"MoveHalfMaximizedWindowsBetweenScreens", "NO", NULL
,
477 &wPreferences
.move_half_max_between_heads
, getBool
, NULL
, NULL
, NULL
},
478 {"AlternativeHalfMaximized", "NO", NULL
,
479 &wPreferences
.alt_half_maximize
, getBool
, NULL
, NULL
, NULL
},
480 {"PointerWithHalfMaxWindows", "NO", NULL
,
481 &wPreferences
.pointer_with_half_max_windows
, getBool
, NULL
, NULL
, NULL
},
482 {"HighlightActiveApp", "YES", NULL
,
483 &wPreferences
.highlight_active_app
, getBool
, NULL
, NULL
, NULL
},
484 {"AutoArrangeIcons", "NO", NULL
,
485 &wPreferences
.auto_arrange_icons
, getBool
, NULL
, NULL
, NULL
},
486 {"NoWindowOverDock", "NO", NULL
,
487 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
, NULL
, NULL
},
488 {"NoWindowOverIcons", "NO", NULL
,
489 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
, NULL
, NULL
},
490 {"WindowPlaceOrigin", "(64, 0)", NULL
,
491 &wPreferences
.window_place_origin
, getCoord
, NULL
, NULL
, NULL
},
492 {"ResizeDisplay", "center", seGeomDisplays
,
493 &wPreferences
.size_display
, getEnum
, NULL
, NULL
, NULL
},
494 {"MoveDisplay", "floating", seGeomDisplays
,
495 &wPreferences
.move_display
, getEnum
, NULL
, NULL
, NULL
},
496 {"DontConfirmKill", "NO", NULL
,
497 &wPreferences
.dont_confirm_kill
, getBool
, NULL
, NULL
, NULL
},
498 {"WindowTitleBalloons", "YES", NULL
,
499 &wPreferences
.window_balloon
, getBool
, NULL
, NULL
, NULL
},
500 {"MiniwindowTitleBalloons", "NO", NULL
,
501 &wPreferences
.miniwin_title_balloon
, getBool
, NULL
, NULL
, NULL
},
502 {"MiniwindowPreviewBalloons", "NO", NULL
,
503 &wPreferences
.miniwin_preview_balloon
, getBool
, NULL
, NULL
, NULL
},
504 {"AppIconBalloons", "NO", NULL
,
505 &wPreferences
.appicon_balloon
, getBool
, NULL
, NULL
, NULL
},
506 {"HelpBalloons", "NO", NULL
,
507 &wPreferences
.help_balloon
, getBool
, NULL
, NULL
, NULL
},
508 {"EdgeResistance", "30", NULL
,
509 &wPreferences
.edge_resistance
, getInt
, NULL
, NULL
, NULL
},
510 {"ResizeIncrement", "0", NULL
,
511 &wPreferences
.resize_increment
, getInt
, NULL
, NULL
, NULL
},
512 {"Attraction", "NO", NULL
,
513 &wPreferences
.attract
, getBool
, NULL
, NULL
, NULL
},
514 {"DisableBlinking", "NO", NULL
,
515 &wPreferences
.dont_blink
, getBool
, NULL
, NULL
, NULL
},
516 {"SingleClickLaunch", "NO", NULL
,
517 &wPreferences
.single_click
, getBool
, NULL
, NULL
, NULL
},
518 {"StrictWindozeCycle", "YES", NULL
,
519 &wPreferences
.strict_windoze_cycle
, getBool
, NULL
, NULL
, NULL
},
520 {"SwitchPanelOnlyOpen", "NO", NULL
,
521 &wPreferences
.panel_only_open
, getBool
, NULL
, NULL
, NULL
},
522 {"MiniPreviewSize", "128", NULL
,
523 &wPreferences
.minipreview_size
, getInt
, NULL
, NULL
, NULL
},
524 {"IgnoreGtkHints", "NO", NULL
,
525 &wPreferences
.ignore_gtk_decoration_hints
, getBool
, NULL
, NULL
, NULL
},
526 {"KeepDockOnPrimaryHead", "NO", NULL
,
527 &wPreferences
.keep_dock_on_primary_head
, getBool
, updateDock
,
529 {"HotCorners", "NO", NULL
,
530 &wPreferences
.hot_corners
, getBool
, NULL
, NULL
, NULL
},
531 {"HotCornerDelay", "250", (void *)&wPreferences
.hot_corner_delay
,
532 &wPreferences
.hot_corner_delay
, getInt
, NULL
, NULL
, NULL
},
533 {"HotCornerEdge", "2", (void *)&wPreferences
.hot_corner_edge
,
534 &wPreferences
.hot_corner_edge
, getInt
, NULL
, NULL
, NULL
},
535 {"HotCornerActions", "(\"None\", \"None\", \"None\", \"None\")", &wPreferences
,
536 NULL
, getPropList
, setHotCornerActions
, NULL
, NULL
},
540 {"MenuStyle", "normal", seMenuStyles
,
541 &wPreferences
.menu_style
, getEnum
, setMenuStyle
, NULL
, NULL
},
542 {"WidgetColor", "(solid, gray)", NULL
,
543 NULL
, getTexture
, setWidgetColor
, NULL
, NULL
},
544 {"WorkspaceSpecificBack", "()", NULL
,
545 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
, NULL
, NULL
},
546 /* WorkspaceBack must come after WorkspaceSpecificBack or
547 * WorkspaceBack won't know WorkspaceSpecificBack was also
548 * specified and 2 copies of wmsetbg will be launched */
549 {"WorkspaceBack", "(solid, \"rgb:50/50/75\")", NULL
,
550 NULL
, getWSBackground
, setWorkspaceBack
, NULL
, NULL
},
551 {"SmoothWorkspaceBack", "NO", NULL
,
552 NULL
, getBool
, NULL
, NULL
, NULL
},
553 {"IconBack", "(dgradient, \"rgb:a6/a6/b6\", \"rgb:51/55/61\")", NULL
,
554 NULL
, getTexture
, setIconTile
, NULL
, NULL
},
555 {"TitleJustify", "center", seJustifications
,
556 &wPreferences
.title_justification
, getEnum
, setJustify
, NULL
, NULL
},
557 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
558 NULL
, getFont
, setWinTitleFont
, NULL
, NULL
},
559 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
560 &wPreferences
.window_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
561 {"WindowTitleMinHeight", "0", NULL
,
562 &wPreferences
.window_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
563 {"WindowTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
564 &wPreferences
.window_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
565 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
566 &wPreferences
.menu_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
567 {"MenuTitleMinHeight", "0", NULL
,
568 &wPreferences
.menu_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
569 {"MenuTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
570 &wPreferences
.menu_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
571 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
572 &wPreferences
.menu_text_clearance
, getInt
, setClearance
, NULL
, NULL
},
573 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
574 NULL
, getFont
, setMenuTitleFont
, NULL
, NULL
},
575 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
576 NULL
, getFont
, setMenuTextFont
, NULL
, NULL
},
577 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
578 NULL
, getFont
, setIconTitleFont
, NULL
, NULL
},
579 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
580 NULL
, getFont
, setClipTitleFont
, NULL
, NULL
},
581 {"ShowClipTitle", "YES", NULL
,
582 &wPreferences
.show_clip_title
, getBool
, NULL
, NULL
, NULL
},
583 {"LargeDisplayFont", DEF_WORKSPACE_NAME_FONT
, NULL
,
584 NULL
, getFont
, setLargeDisplayFont
, NULL
, NULL
},
585 {"HighlightColor", "white", NULL
,
586 NULL
, getColor
, setHightlight
, NULL
, NULL
},
587 {"HighlightTextColor", "black", NULL
,
588 NULL
, getColor
, setHightlightText
, NULL
, NULL
},
589 {"ClipTitleColor", "black", (void *)CLIP_NORMAL
,
590 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
591 {"CClipTitleColor", "\"rgb:61/61/61\"", (void *)CLIP_COLLAPSED
,
592 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
593 {"FTitleColor", "white", (void *)WS_FOCUSED
,
594 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
595 {"PTitleColor", "white", (void *)WS_PFOCUSED
,
596 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
597 {"UTitleColor", "black", (void *)WS_UNFOCUSED
,
598 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
599 {"FTitleBack", "(solid, black)", NULL
,
600 NULL
, getTexture
, setFTitleBack
, NULL
, NULL
},
601 {"PTitleBack", "(solid, gray40)", NULL
,
602 NULL
, getTexture
, setPTitleBack
, NULL
, NULL
},
603 {"UTitleBack", "(solid, \"rgb:aa/aa/aa\")", NULL
,
604 NULL
, getTexture
, setUTitleBack
, NULL
, NULL
},
605 {"ResizebarBack", "(solid, \"rgb:aa/aa/aa\")", NULL
,
606 NULL
, getTexture
, setResizebarBack
, NULL
, NULL
},
607 {"MenuTitleColor", "white", NULL
,
608 NULL
, getColor
, setMenuTitleColor
, NULL
, NULL
},
609 {"MenuTextColor", "black", NULL
,
610 NULL
, getColor
, setMenuTextColor
, NULL
, NULL
},
611 {"MenuDisabledColor", "gray50", NULL
,
612 NULL
, getColor
, setMenuDisabledColor
, NULL
, NULL
},
613 {"MenuTitleBack", "(solid, black)", NULL
,
614 NULL
, getTexture
, setMenuTitleBack
, NULL
, NULL
},
615 {"MenuTextBack", "(solid, \"rgb:aa/aa/aa\")", NULL
,
616 NULL
, getTexture
, setMenuTextBack
, NULL
, NULL
},
617 {"IconTitleColor", "white", NULL
,
618 NULL
, getColor
, setIconTitleColor
, NULL
, NULL
},
619 {"IconTitleBack", "black", NULL
,
620 NULL
, getColor
, setIconTitleBack
, NULL
, NULL
},
621 {"SwitchPanelImages", "(swtile.png, swback.png, 30, 40)", &wPreferences
,
622 NULL
, getPropList
, setSwPOptions
, NULL
, NULL
},
623 {"ModifierKeyLabels", "(\"Shift+\", \"Control+\", \"Mod1+\", \"Mod2+\", \"Mod3+\", \"Mod4+\", \"Mod5+\")", &wPreferences
,
624 NULL
, getPropList
, setModifierKeyLabels
, NULL
, NULL
},
625 {"FrameBorderWidth", "1", NULL
,
626 NULL
, getInt
, setFrameBorderWidth
, NULL
, NULL
},
627 {"FrameBorderColor", "black", NULL
,
628 NULL
, getColor
, setFrameBorderColor
, NULL
, NULL
},
629 {"FrameFocusedBorderColor", "black", NULL
,
630 NULL
, getColor
, setFrameFocusedBorderColor
, NULL
, NULL
},
631 {"FrameSelectedBorderColor", "white", NULL
,
632 NULL
, getColor
, setFrameSelectedBorderColor
, NULL
, NULL
},
633 {"WorkspaceMapBack", "(solid, black)", NULL
,
634 NULL
, getTexture
, setWorkspaceMapBackground
, NULL
, NULL
},
638 {"RootMenuKey", "F12", (void *)WKBD_ROOTMENU
,
639 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
640 {"WindowListKey", "F11", (void *)WKBD_WINDOWLIST
,
641 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
642 {"WindowMenuKey", "Control+Escape", (void *)WKBD_WINDOWMENU
,
643 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
644 {"DockRaiseLowerKey", "None", (void*)WKBD_DOCKRAISELOWER
,
645 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
646 {"ClipRaiseLowerKey", "None", (void *)WKBD_CLIPRAISELOWER
,
647 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
648 {"MiniaturizeKey", "Mod1+M", (void *)WKBD_MINIATURIZE
,
649 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
650 {"MinimizeAllKey", "None", (void *)WKBD_MINIMIZEALL
,
651 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
652 {"HideKey", "Mod1+H", (void *)WKBD_HIDE
,
653 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
654 {"HideOthersKey", "None", (void *)WKBD_HIDE_OTHERS
,
655 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
656 {"MoveResizeKey", "None", (void *)WKBD_MOVERESIZE
,
657 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
658 {"CloseKey", "None", (void *)WKBD_CLOSE
,
659 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
660 {"MaximizeKey", "None", (void *)WKBD_MAXIMIZE
,
661 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
662 {"VMaximizeKey", "None", (void *)WKBD_VMAXIMIZE
,
663 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
664 {"HMaximizeKey", "None", (void *)WKBD_HMAXIMIZE
,
665 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
666 {"LHMaximizeKey", "None", (void*)WKBD_LHMAXIMIZE
,
667 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
668 {"RHMaximizeKey", "None", (void*)WKBD_RHMAXIMIZE
,
669 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
670 {"THMaximizeKey", "None", (void*)WKBD_THMAXIMIZE
,
671 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
672 {"BHMaximizeKey", "None", (void*)WKBD_BHMAXIMIZE
,
673 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
674 {"TLCMaximizeKey", "None", (void*)WKBD_LTCMAXIMIZE
,
675 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
676 {"TRCMaximizeKey", "None", (void*)WKBD_RTCMAXIMIZE
,
677 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
678 {"BLCMaximizeKey", "None", (void*)WKBD_LBCMAXIMIZE
,
679 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
680 {"BRCMaximizeKey", "None", (void*)WKBD_RBCMAXIMIZE
,
681 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
682 {"MaximusKey", "None", (void*)WKBD_MAXIMUS
,
683 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
684 {"KeepOnTopKey", "None", (void *)WKBD_KEEP_ON_TOP
,
685 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
686 {"KeepAtBottomKey", "None", (void *)WKBD_KEEP_AT_BOTTOM
,
687 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
688 {"OmnipresentKey", "None", (void *)WKBD_OMNIPRESENT
,
689 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
690 {"RaiseKey", "Mod1+Up", (void *)WKBD_RAISE
,
691 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
692 {"LowerKey", "Mod1+Down", (void *)WKBD_LOWER
,
693 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
694 {"RaiseLowerKey", "None", (void *)WKBD_RAISELOWER
,
695 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
696 {"ShadeKey", "None", (void *)WKBD_SHADE
,
697 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
698 {"SelectKey", "None", (void *)WKBD_SELECT
,
699 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
700 {"WorkspaceMapKey", "None", (void *)WKBD_WORKSPACEMAP
,
701 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
702 {"FocusNextKey", "Mod1+Tab", (void *)WKBD_FOCUSNEXT
,
703 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
704 {"FocusPrevKey", "Mod1+Shift+Tab", (void *)WKBD_FOCUSPREV
,
705 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
706 {"GroupNextKey", "None", (void *)WKBD_GROUPNEXT
,
707 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
708 {"GroupPrevKey", "None", (void *)WKBD_GROUPPREV
,
709 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
710 {"NextWorkspaceKey", "Mod1+Control+Right", (void *)WKBD_NEXTWORKSPACE
,
711 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
712 {"PrevWorkspaceKey", "Mod1+Control+Left", (void *)WKBD_PREVWORKSPACE
,
713 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
714 {"LastWorkspaceKey", "None", (void *)WKBD_LASTWORKSPACE
,
715 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
716 {"NextWorkspaceLayerKey", "None", (void *)WKBD_NEXTWSLAYER
,
717 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
718 {"PrevWorkspaceLayerKey", "None", (void *)WKBD_PREVWSLAYER
,
719 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
720 {"Workspace1Key", "Mod1+1", (void *)WKBD_WORKSPACE1
,
721 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
722 {"Workspace2Key", "Mod1+2", (void *)WKBD_WORKSPACE2
,
723 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
724 {"Workspace3Key", "Mod1+3", (void *)WKBD_WORKSPACE3
,
725 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
726 {"Workspace4Key", "Mod1+4", (void *)WKBD_WORKSPACE4
,
727 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
728 {"Workspace5Key", "Mod1+5", (void *)WKBD_WORKSPACE5
,
729 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
730 {"Workspace6Key", "Mod1+6", (void *)WKBD_WORKSPACE6
,
731 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
732 {"Workspace7Key", "Mod1+7", (void *)WKBD_WORKSPACE7
,
733 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
734 {"Workspace8Key", "Mod1+8", (void *)WKBD_WORKSPACE8
,
735 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
736 {"Workspace9Key", "Mod1+9", (void *)WKBD_WORKSPACE9
,
737 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
738 {"Workspace10Key", "Mod1+0", (void *)WKBD_WORKSPACE10
,
739 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
740 {"MoveToWorkspace1Key", "None", (void *)WKBD_MOVE_WORKSPACE1
,
741 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
742 {"MoveToWorkspace2Key", "None", (void *)WKBD_MOVE_WORKSPACE2
,
743 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
744 {"MoveToWorkspace3Key", "None", (void *)WKBD_MOVE_WORKSPACE3
,
745 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
746 {"MoveToWorkspace4Key", "None", (void *)WKBD_MOVE_WORKSPACE4
,
747 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
748 {"MoveToWorkspace5Key", "None", (void *)WKBD_MOVE_WORKSPACE5
,
749 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
750 {"MoveToWorkspace6Key", "None", (void *)WKBD_MOVE_WORKSPACE6
,
751 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
752 {"MoveToWorkspace7Key", "None", (void *)WKBD_MOVE_WORKSPACE7
,
753 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
754 {"MoveToWorkspace8Key", "None", (void *)WKBD_MOVE_WORKSPACE8
,
755 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
756 {"MoveToWorkspace9Key", "None", (void *)WKBD_MOVE_WORKSPACE9
,
757 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
758 {"MoveToWorkspace10Key", "None", (void *)WKBD_MOVE_WORKSPACE10
,
759 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
760 {"MoveToNextWorkspaceKey", "None", (void *)WKBD_MOVE_NEXTWORKSPACE
,
761 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
762 {"MoveToPrevWorkspaceKey", "None", (void *)WKBD_MOVE_PREVWORKSPACE
,
763 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
764 {"MoveToLastWorkspaceKey", "None", (void *)WKBD_MOVE_LASTWORKSPACE
,
765 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
766 {"MoveToNextWorkspaceLayerKey", "None", (void *)WKBD_MOVE_NEXTWSLAYER
,
767 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
768 {"MoveToPrevWorkspaceLayerKey", "None", (void *)WKBD_MOVE_PREVWSLAYER
,
769 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
770 {"WindowShortcut1Key", "None", (void *)WKBD_WINDOW1
,
771 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
772 {"WindowShortcut2Key", "None", (void *)WKBD_WINDOW2
,
773 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
774 {"WindowShortcut3Key", "None", (void *)WKBD_WINDOW3
,
775 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
776 {"WindowShortcut4Key", "None", (void *)WKBD_WINDOW4
,
777 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
778 {"WindowShortcut5Key", "None", (void *)WKBD_WINDOW5
,
779 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
780 {"WindowShortcut6Key", "None", (void *)WKBD_WINDOW6
,
781 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
782 {"WindowShortcut7Key", "None", (void *)WKBD_WINDOW7
,
783 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
784 {"WindowShortcut8Key", "None", (void *)WKBD_WINDOW8
,
785 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
786 {"WindowShortcut9Key", "None", (void *)WKBD_WINDOW9
,
787 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
788 {"WindowShortcut10Key", "None", (void *)WKBD_WINDOW10
,
789 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
790 {"MoveTo12to6Head", "None", (void *)WKBD_MOVE_12_TO_6_HEAD
,
791 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
792 {"MoveTo6to12Head", "None", (void *)WKBD_MOVE_6_TO_12_HEAD
,
793 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
794 {"WindowRelaunchKey", "None", (void *)WKBD_RELAUNCH
,
795 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
796 {"ScreenSwitchKey", "None", (void *)WKBD_SWITCH_SCREEN
,
797 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
798 {"RunKey", "None", (void *)WKBD_RUN
,
799 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
800 {"ExitKey", "None", (void *)WKBD_EXIT
,
801 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
802 {"ScreenCaptureKey", "None", (void *)WKBD_PRINTS
,
803 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
804 {"WindowCaptureKey", "None", (void *)WKBD_PRINTW
,
805 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
806 {"PartialCaptureKey", "None", (void *)WKBD_PRINTP
,
807 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
809 #ifdef KEEP_XKB_LOCK_STATUS
810 {"ToggleKbdModeKey", "None", (void *)WKBD_TOGGLE
,
811 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
812 {"KbdModeLock", "NO", NULL
,
813 &wPreferences
.modelock
, getBool
, NULL
, NULL
, NULL
},
814 #endif /* KEEP_XKB_LOCK_STATUS */
816 {"NormalCursor", "(builtin, left_ptr)", (void *)WCUR_ROOT
,
817 NULL
, getCursor
, setCursor
, NULL
, NULL
},
818 {"ArrowCursor", "(builtin, top_left_arrow)", (void *)WCUR_ARROW
,
819 NULL
, getCursor
, setCursor
, NULL
, NULL
},
820 {"MoveCursor", "(builtin, fleur)", (void *)WCUR_MOVE
,
821 NULL
, getCursor
, setCursor
, NULL
, NULL
},
822 {"ResizeCursor", "(builtin, sizing)", (void *)WCUR_RESIZE
,
823 NULL
, getCursor
, setCursor
, NULL
, NULL
},
824 {"TopLeftResizeCursor", "(builtin, top_left_corner)", (void *)WCUR_TOPLEFTRESIZE
,
825 NULL
, getCursor
, setCursor
, NULL
, NULL
},
826 {"TopRightResizeCursor", "(builtin, top_right_corner)", (void *)WCUR_TOPRIGHTRESIZE
,
827 NULL
, getCursor
, setCursor
, NULL
, NULL
},
828 {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)", (void *)WCUR_BOTTOMLEFTRESIZE
,
829 NULL
, getCursor
, setCursor
, NULL
, NULL
},
830 {"BottomRightResizeCursor", "(builtin, bottom_right_corner)", (void *)WCUR_BOTTOMRIGHTRESIZE
,
831 NULL
, getCursor
, setCursor
, NULL
, NULL
},
832 {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)", (void *)WCUR_VERTICALRESIZE
,
833 NULL
, getCursor
, setCursor
, NULL
, NULL
},
834 {"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)", (void *)WCUR_HORIZONRESIZE
,
835 NULL
, getCursor
, setCursor
, NULL
, NULL
},
836 {"WaitCursor", "(builtin, watch)", (void *)WCUR_WAIT
,
837 NULL
, getCursor
, setCursor
, NULL
, NULL
},
838 {"QuestionCursor", "(builtin, question_arrow)", (void *)WCUR_QUESTION
,
839 NULL
, getCursor
, setCursor
, NULL
, NULL
},
840 {"TextCursor", "(builtin, xterm)", (void *)WCUR_TEXT
,
841 NULL
, getCursor
, setCursor
, NULL
, NULL
},
842 {"SelectCursor", "(builtin, cross)", (void *)WCUR_SELECT
,
843 NULL
, getCursor
, setCursor
, NULL
, NULL
},
844 {"CaptureCursor", "(builtin, crosshair)", (void *)WCUR_CAPTURE
,
845 NULL
, getCursor
, setCursor
, NULL
, NULL
},
846 {"DialogHistoryLines", "500", NULL
,
847 &wPreferences
.history_lines
, getInt
, NULL
, NULL
, NULL
},
848 {"CycleActiveHeadOnly", "NO", NULL
,
849 &wPreferences
.cycle_active_head_only
, getBool
, NULL
, NULL
, NULL
},
850 {"CycleIgnoreMinimized", "NO", NULL
,
851 &wPreferences
.cycle_ignore_minimized
, getBool
, NULL
, NULL
, NULL
},
852 {"DbClickFullScreen", "NO", NULL
,
853 &wPreferences
.double_click_fullscreen
, getBool
, NULL
, NULL
, NULL
},
854 {"CloseRootMenuByLeftOrRightMouseClick", "NO", NULL
,
855 &wPreferences
.close_rootmenu_left_right_click
, getBool
, NULL
, NULL
, NULL
}
858 static void initDefaults(void)
861 WDefaultEntry
*entry
;
863 WMPLSetCaseSensitive(False
);
865 for (i
= 0; i
< wlengthof(optionList
); i
++) {
866 entry
= &optionList
[i
];
868 entry
->plkey
= WMCreatePLString(entry
->key
);
869 if (entry
->default_value
)
870 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
872 entry
->plvalue
= NULL
;
875 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
876 entry
= &staticOptionList
[i
];
878 entry
->plkey
= WMCreatePLString(entry
->key
);
879 if (entry
->default_value
)
880 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
882 entry
->plvalue
= NULL
;
886 static WMPropList
*readGlobalDomain(const char *domainName
, Bool requireDictionary
)
888 WMPropList
*globalDict
= NULL
;
892 snprintf(path
, sizeof(path
), "%s/%s", PKGCONFDIR
, domainName
);
893 if (stat(path
, &stbuf
) >= 0) {
894 globalDict
= WMReadPropListFromFile(path
);
895 if (globalDict
&& requireDictionary
&& !WMIsPLDictionary(globalDict
)) {
896 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"), domainName
, path
);
897 WMReleasePropList(globalDict
);
899 } else if (!globalDict
) {
900 wwarning(_("could not load domain %s from global defaults database"), domainName
);
907 #if defined(GLOBAL_PREAMBLE_MENU_FILE) || defined(GLOBAL_EPILOGUE_MENU_FILE)
908 static void prependMenu(WMPropList
* destarr
, WMPropList
* array
)
913 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
914 item
= WMGetFromPLArray(array
, i
);
916 WMInsertInPLArray(destarr
, i
+ 1, item
);
920 static void appendMenu(WMPropList
* destarr
, WMPropList
* array
)
925 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
926 item
= WMGetFromPLArray(array
, i
);
928 WMAddToPLArray(destarr
, item
);
933 void wDefaultsMergeGlobalMenus(WDDomain
* menuDomain
)
935 WMPropList
*menu
= menuDomain
->dictionary
;
938 if (!menu
|| !WMIsPLArray(menu
))
941 #ifdef GLOBAL_PREAMBLE_MENU_FILE
942 submenu
= WMReadPropListFromFile(PKGCONFDIR
"/" GLOBAL_PREAMBLE_MENU_FILE
);
944 if (submenu
&& !WMIsPLArray(submenu
)) {
945 wwarning(_("invalid global menu file %s"), GLOBAL_PREAMBLE_MENU_FILE
);
946 WMReleasePropList(submenu
);
950 prependMenu(menu
, submenu
);
951 WMReleasePropList(submenu
);
955 #ifdef GLOBAL_EPILOGUE_MENU_FILE
956 submenu
= WMReadPropListFromFile(PKGCONFDIR
"/" GLOBAL_EPILOGUE_MENU_FILE
);
958 if (submenu
&& !WMIsPLArray(submenu
)) {
959 wwarning(_("invalid global menu file %s"), GLOBAL_EPILOGUE_MENU_FILE
);
960 WMReleasePropList(submenu
);
964 appendMenu(menu
, submenu
);
965 WMReleasePropList(submenu
);
969 menuDomain
->dictionary
= menu
;
972 WDDomain
*wDefaultsInitDomain(const char *domain
, Bool requireDictionary
)
976 static int inited
= 0;
977 WMPropList
*shared_dict
= NULL
;
984 db
= wmalloc(sizeof(WDDomain
));
985 db
->domain_name
= domain
;
986 db
->path
= wdefaultspathfordomain(domain
);
988 if (stat(db
->path
, &stbuf
) >= 0) {
989 db
->dictionary
= WMReadPropListFromFile(db
->path
);
990 if (db
->dictionary
) {
991 if (requireDictionary
&& !WMIsPLDictionary(db
->dictionary
)) {
992 WMReleasePropList(db
->dictionary
);
993 db
->dictionary
= NULL
;
994 wwarning(_("Domain %s (%s) of defaults database is corrupted!"), domain
, db
->path
);
996 db
->timestamp
= stbuf
.st_mtime
;
998 wwarning(_("could not load domain %s from user defaults database"), domain
);
1002 /* global system dictionary */
1003 shared_dict
= readGlobalDomain(domain
, requireDictionary
);
1005 if (shared_dict
&& db
->dictionary
&& WMIsPLDictionary(shared_dict
) &&
1006 WMIsPLDictionary(db
->dictionary
)) {
1007 WMMergePLDictionaries(shared_dict
, db
->dictionary
, True
);
1008 WMReleasePropList(db
->dictionary
);
1009 db
->dictionary
= shared_dict
;
1010 if (stbuf
.st_mtime
> db
->timestamp
)
1011 db
->timestamp
= stbuf
.st_mtime
;
1012 } else if (!db
->dictionary
) {
1013 db
->dictionary
= shared_dict
;
1014 if (stbuf
.st_mtime
> db
->timestamp
)
1015 db
->timestamp
= stbuf
.st_mtime
;
1021 void wReadStaticDefaults(WMPropList
* dict
)
1023 WMPropList
*plvalue
;
1024 WDefaultEntry
*entry
;
1028 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
1029 entry
= &staticOptionList
[i
];
1032 plvalue
= WMGetFromPLDictionary(dict
, entry
->plkey
);
1036 /* no default in the DB. Use builtin default */
1038 plvalue
= entry
->plvalue
;
1042 (*entry
->convert
) (NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
1044 (*entry
->update
) (NULL
, entry
, tdata
, entry
->extra_data
);
1049 void wDefaultsCheckDomains(void* arg
)
1053 WMPropList
*shared_dict
= NULL
;
1057 /* Parameter not used, but tell the compiler that it is ok */
1060 if (stat(w_global
.domain
.wmaker
->path
, &stbuf
) >= 0 && w_global
.domain
.wmaker
->timestamp
< stbuf
.st_mtime
) {
1061 w_global
.domain
.wmaker
->timestamp
= stbuf
.st_mtime
;
1063 /* Global dictionary */
1064 shared_dict
= readGlobalDomain("WindowMaker", True
);
1066 /* User dictionary */
1067 dict
= WMReadPropListFromFile(w_global
.domain
.wmaker
->path
);
1070 if (!WMIsPLDictionary(dict
)) {
1071 WMReleasePropList(dict
);
1073 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1074 "WindowMaker", w_global
.domain
.wmaker
->path
);
1077 WMMergePLDictionaries(shared_dict
, dict
, True
);
1078 WMReleasePropList(dict
);
1083 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1084 scr
= wScreenWithNumber(i
);
1086 wReadDefaults(scr
, dict
);
1089 if (w_global
.domain
.wmaker
->dictionary
)
1090 WMReleasePropList(w_global
.domain
.wmaker
->dictionary
);
1092 w_global
.domain
.wmaker
->dictionary
= dict
;
1095 wwarning(_("could not load domain %s from user defaults database"), "WindowMaker");
1099 WMReleasePropList(shared_dict
);
1103 if (stat(w_global
.domain
.window_attr
->path
, &stbuf
) >= 0 && w_global
.domain
.window_attr
->timestamp
< stbuf
.st_mtime
) {
1104 /* global dictionary */
1105 shared_dict
= readGlobalDomain("WMWindowAttributes", True
);
1106 /* user dictionary */
1107 dict
= WMReadPropListFromFile(w_global
.domain
.window_attr
->path
);
1109 if (!WMIsPLDictionary(dict
)) {
1110 WMReleasePropList(dict
);
1112 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1113 "WMWindowAttributes", w_global
.domain
.window_attr
->path
);
1116 WMMergePLDictionaries(shared_dict
, dict
, True
);
1117 WMReleasePropList(dict
);
1122 if (w_global
.domain
.window_attr
->dictionary
)
1123 WMReleasePropList(w_global
.domain
.window_attr
->dictionary
);
1125 w_global
.domain
.window_attr
->dictionary
= dict
;
1126 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1127 scr
= wScreenWithNumber(i
);
1129 wDefaultUpdateIcons(scr
);
1131 /* Update the panel image if changed */
1132 /* Don't worry. If the image is the same these
1133 * functions will have no performance impact. */
1134 create_logo_image(scr
);
1139 wwarning(_("could not load domain %s from user defaults database"), "WMWindowAttributes");
1142 w_global
.domain
.window_attr
->timestamp
= stbuf
.st_mtime
;
1144 WMReleasePropList(shared_dict
);
1147 if (stat(w_global
.domain
.root_menu
->path
, &stbuf
) >= 0 && w_global
.domain
.root_menu
->timestamp
< stbuf
.st_mtime
) {
1148 dict
= WMReadPropListFromFile(w_global
.domain
.root_menu
->path
);
1150 if (!WMIsPLArray(dict
) && !WMIsPLString(dict
)) {
1151 WMReleasePropList(dict
);
1153 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1154 "WMRootMenu", w_global
.domain
.root_menu
->path
);
1156 if (w_global
.domain
.root_menu
->dictionary
)
1157 WMReleasePropList(w_global
.domain
.root_menu
->dictionary
);
1159 w_global
.domain
.root_menu
->dictionary
= dict
;
1160 wDefaultsMergeGlobalMenus(w_global
.domain
.root_menu
);
1163 wwarning(_("could not load domain %s from user defaults database"), "WMRootMenu");
1165 w_global
.domain
.root_menu
->timestamp
= stbuf
.st_mtime
;
1167 #ifndef HAVE_INOTIFY
1169 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, arg
);
1173 void wReadDefaults(WScreen
* scr
, WMPropList
* new_dict
)
1175 WMPropList
*plvalue
, *old_value
;
1176 WDefaultEntry
*entry
;
1178 int update_workspace_back
= 0; /* kluge :/ */
1179 unsigned int needs_refresh
;
1181 WMPropList
*old_dict
= (w_global
.domain
.wmaker
->dictionary
!= new_dict
? w_global
.domain
.wmaker
->dictionary
: NULL
);
1185 for (i
= 0; i
< wlengthof(optionList
); i
++) {
1186 entry
= &optionList
[i
];
1189 plvalue
= WMGetFromPLDictionary(new_dict
, entry
->plkey
);
1196 old_value
= WMGetFromPLDictionary(old_dict
, entry
->plkey
);
1198 if (!plvalue
&& !old_value
) {
1199 /* no default in the DB. Use builtin default */
1200 plvalue
= entry
->plvalue
;
1201 if (plvalue
&& new_dict
)
1202 WMPutInPLDictionary(new_dict
, entry
->plkey
, plvalue
);
1204 } else if (!plvalue
) {
1205 /* value was deleted from DB. Keep current value */
1207 } else if (!old_value
) {
1208 /* set value for the 1st time */
1209 } else if (!WMIsPropListEqualTo(plvalue
, old_value
)) {
1210 /* value has changed */
1212 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1213 && update_workspace_back
&& scr
->flags
.backimage_helper_launched
) {
1215 /* value was not changed since last time */
1222 if ((*entry
->convert
) (scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1224 * If the WorkspaceSpecificBack data has been changed
1225 * so that the helper will be launched now, we must be
1226 * sure to send the default background texture config
1229 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0 &&
1230 !scr
->flags
.backimage_helper_launched
)
1231 update_workspace_back
= 1;
1234 needs_refresh
|= (*entry
->update
) (scr
, entry
, tdata
, entry
->extra_data
);
1240 if (needs_refresh
!= 0 && !scr
->flags
.startup
) {
1244 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1245 foo
|= WTextureSettings
;
1246 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1247 foo
|= WFontSettings
;
1248 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1249 foo
|= WColorSettings
;
1251 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1252 (void *)(uintptr_t) foo
);
1255 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1256 foo
|= WTextureSettings
;
1257 if (needs_refresh
& REFRESH_MENU_FONT
)
1258 foo
|= WFontSettings
;
1259 if (needs_refresh
& REFRESH_MENU_COLOR
)
1260 foo
|= WColorSettings
;
1262 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1265 if (needs_refresh
& REFRESH_WINDOW_FONT
)
1266 foo
|= WFontSettings
;
1267 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
)
1268 foo
|= WTextureSettings
;
1269 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
)
1270 foo
|= WColorSettings
;
1272 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1274 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1276 if (needs_refresh
& REFRESH_ICON_FONT
)
1277 foo
|= WFontSettings
;
1278 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
)
1279 foo
|= WTextureSettings
;
1280 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
)
1281 foo
|= WTextureSettings
;
1283 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1284 (void *)(uintptr_t) foo
);
1286 if (needs_refresh
& REFRESH_ICON_TILE
)
1287 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1289 if (needs_refresh
& REFRESH_WORKSPACE_MENU
) {
1290 if (scr
->workspace_menu
)
1291 wWorkspaceMenuUpdate(scr
, scr
->workspace_menu
);
1292 if (scr
->clip_ws_menu
)
1293 wWorkspaceMenuUpdate(scr
, scr
->clip_ws_menu
);
1294 if (scr
->workspace_submenu
)
1295 scr
->workspace_submenu
->flags
.realized
= 0;
1296 if (scr
->clip_submenu
)
1297 scr
->clip_submenu
->flags
.realized
= 0;
1302 void wDefaultUpdateIcons(WScreen
*scr
)
1304 WAppIcon
*aicon
= scr
->app_icon_list
;
1306 WWindow
*wwin
= scr
->focused_window
;
1309 /* Get the application icon, default included */
1310 wIconChangeImageFile(aicon
->icon
, NULL
);
1311 wAppIconPaint(aicon
);
1312 aicon
= aicon
->next
;
1315 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
)
1316 wClipIconPaint(scr
->clip_icon
);
1318 for (dc
= scr
->drawers
; dc
!= NULL
; dc
= dc
->next
)
1319 wDrawerIconPaint(dc
->adrawer
->icon_array
[0]);
1322 if (wwin
->icon
&& wwin
->flags
.miniaturized
)
1323 wIconChangeImageFile(wwin
->icon
, NULL
);
1328 /* --------------------------- Local ----------------------- */
1330 #define GET_STRING_OR_DEFAULT(x, var) if (!WMIsPLString(value)) { \
1331 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1333 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1334 var = entry->default_value;\
1335 } else var = WMGetFromPLString(value)\
1338 static int string2index(WMPropList *key, WMPropList *val, const char *def, WOptionEnumeration * values)
1341 WOptionEnumeration
*v
;
1342 char buffer
[TOTAL_VALUES_LENGTH
];
1344 if (WMIsPLString(val
) && (str
= WMGetFromPLString(val
))) {
1345 for (v
= values
; v
->string
!= NULL
; v
++) {
1346 if (strcasecmp(v
->string
, str
) == 0)
1352 for (v
= values
; v
->string
!= NULL
; v
++) {
1355 strcat(buffer
, ", ");
1356 snprintf(buffer
+strlen(buffer
),
1357 sizeof(buffer
)-strlen(buffer
)-1, "\"%s\"", v
->string
);
1360 wwarning(_("wrong option value for key \"%s\"; got \"%s\", should be one of %s."),
1361 WMGetFromPLString(key
),
1362 WMIsPLString(val
) ? WMGetFromPLString(val
) : "(unknown)",
1366 return string2index(key
, val
, NULL
, values
);
1373 * value - is the value in the defaults DB
1374 * addr - is the address to store the data
1375 * ret - is the address to store a pointer to a temporary buffer. ret
1376 * must not be freed and is used by the set functions
1378 static int getBool(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1382 int second_pass
= 0;
1384 /* Parameter not used, but tell the compiler that it is ok */
1387 GET_STRING_OR_DEFAULT("Boolean", val
);
1390 if ((val
[1] == '\0' && (val
[0] == 'y' || val
[0] == 'Y'))
1391 || strcasecmp(val
, "YES") == 0) {
1394 } else if ((val
[1] == '\0' && (val
[0] == 'n' || val
[0] == 'N'))
1395 || strcasecmp(val
, "NO") == 0) {
1399 if (sscanf(val
, "%i", &i
) == 1) {
1405 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""), val
, entry
->key
);
1406 if (second_pass
== 0) {
1407 val
= WMGetFromPLString(entry
->plvalue
);
1409 wwarning(_("using default \"%s\" instead"), val
);
1419 *(char *)addr
= data
;
1424 static int getInt(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1429 /* Parameter not used, but tell the compiler that it is ok */
1432 GET_STRING_OR_DEFAULT("Integer", val
);
1434 if (sscanf(val
, "%i", &data
) != 1) {
1435 wwarning(_("can't convert \"%s\" to integer for key \"%s\""), val
, entry
->key
);
1436 val
= WMGetFromPLString(entry
->plvalue
);
1437 wwarning(_("using default \"%s\" instead"), val
);
1438 if (sscanf(val
, "%i", &data
) != 1) {
1446 *(int *)addr
= data
;
1451 static int getCoord(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1454 char *val_x
, *val_y
;
1455 int nelem
, changed
= 0;
1456 WMPropList
*elem_x
, *elem_y
;
1459 if (!WMIsPLArray(value
)) {
1460 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Coordinate");
1462 value
= entry
->plvalue
;
1464 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1470 nelem
= WMGetPropListItemCount(value
);
1472 wwarning(_("Incorrect number of elements in array for key \"%s\"."), entry
->key
);
1474 value
= entry
->plvalue
;
1476 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1482 elem_x
= WMGetFromPLArray(value
, 0);
1483 elem_y
= WMGetFromPLArray(value
, 1);
1485 if (!elem_x
|| !elem_y
|| !WMIsPLString(elem_x
) || !WMIsPLString(elem_y
)) {
1486 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."), entry
->key
);
1488 value
= entry
->plvalue
;
1490 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1496 val_x
= WMGetFromPLString(elem_x
);
1497 val_y
= WMGetFromPLString(elem_y
);
1499 if (sscanf(val_x
, "%i", &data
.x
) != 1 || sscanf(val_y
, "%i", &data
.y
) != 1) {
1500 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1502 value
= entry
->plvalue
;
1504 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1512 else if (data
.x
> scr
->scr_width
/ 3)
1513 data
.x
= scr
->scr_width
/ 3;
1516 else if (data
.y
> scr
->scr_height
/ 3)
1517 data
.y
= scr
->scr_height
/ 3;
1522 *(WCoord
*) addr
= data
;
1527 static int getPropList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1529 /* Parameter not used, but tell the compiler that it is ok */
1534 WMRetainPropList(value
);
1541 static int getPathList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1549 /* Parameter not used, but tell the compiler that it is ok */
1554 if (!WMIsPLArray(value
)) {
1555 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "an array of paths");
1557 value
= entry
->plvalue
;
1559 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1566 count
= WMGetPropListItemCount(value
);
1569 value
= entry
->plvalue
;
1571 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1578 for (i
= 0; i
< count
; i
++) {
1579 d
= WMGetFromPLArray(value
, i
);
1580 if (!d
|| !WMIsPLString(d
)) {
1584 len
+= strlen(WMGetFromPLString(d
)) + 1;
1587 ptr
= data
= wmalloc(len
+ 1);
1589 for (i
= 0; i
< count
; i
++) {
1590 d
= WMGetFromPLArray(value
, i
);
1591 if (!d
|| !WMIsPLString(d
)) {
1594 strcpy(ptr
, WMGetFromPLString(d
));
1595 ptr
+= strlen(WMGetFromPLString(d
));
1602 if (*(char **)addr
!= NULL
) {
1603 wfree(*(char **)addr
);
1605 *(char **)addr
= data
;
1610 static int getEnum(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1612 static signed char data
;
1614 /* Parameter not used, but tell the compiler that it is ok */
1617 data
= string2index(entry
->plkey
, value
, entry
->default_value
, (WOptionEnumeration
*) entry
->extra_data
);
1624 *(signed char *)addr
= data
;
1631 * (hgradient <color> <color>)
1632 * (vgradient <color> <color>)
1633 * (dgradient <color> <color>)
1634 * (mhgradient <color> <color> ...)
1635 * (mvgradient <color> <color> ...)
1636 * (mdgradient <color> <color> ...)
1637 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1638 * (tpixmap <file> <color>)
1639 * (spixmap <file> <color>)
1640 * (cpixmap <file> <color>)
1641 * (thgradient <file> <opaqueness> <color> <color>)
1642 * (tvgradient <file> <opaqueness> <color> <color>)
1643 * (tdgradient <file> <opaqueness> <color> <color>)
1644 * (function <lib> <function> ...)
1647 static WTexture
*parse_texture(WScreen
* scr
, WMPropList
* pl
)
1652 WTexture
*texture
= NULL
;
1654 nelem
= WMGetPropListItemCount(pl
);
1658 elem
= WMGetFromPLArray(pl
, 0);
1659 if (!elem
|| !WMIsPLString(elem
))
1661 val
= WMGetFromPLString(elem
);
1663 if (strcasecmp(val
, "solid") == 0) {
1671 elem
= WMGetFromPLArray(pl
, 1);
1672 if (!elem
|| !WMIsPLString(elem
))
1674 val
= WMGetFromPLString(elem
);
1676 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1677 wwarning(_("\"%s\" is not a valid color name"), val
);
1681 texture
= (WTexture
*) wTextureMakeSolid(scr
, &color
);
1682 } else if (strcasecmp(val
, "dgradient") == 0
1683 || strcasecmp(val
, "vgradient") == 0 || strcasecmp(val
, "hgradient") == 0) {
1684 RColor color1
, color2
;
1689 wwarning(_("bad number of arguments in gradient specification"));
1693 if (val
[0] == 'd' || val
[0] == 'D')
1694 type
= WTEX_DGRADIENT
;
1695 else if (val
[0] == 'h' || val
[0] == 'H')
1696 type
= WTEX_HGRADIENT
;
1698 type
= WTEX_VGRADIENT
;
1700 /* get from color */
1701 elem
= WMGetFromPLArray(pl
, 1);
1702 if (!elem
|| !WMIsPLString(elem
))
1704 val
= WMGetFromPLString(elem
);
1706 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1707 wwarning(_("\"%s\" is not a valid color name"), val
);
1711 color1
.red
= xcolor
.red
>> 8;
1712 color1
.green
= xcolor
.green
>> 8;
1713 color1
.blue
= xcolor
.blue
>> 8;
1716 elem
= WMGetFromPLArray(pl
, 2);
1717 if (!elem
|| !WMIsPLString(elem
)) {
1720 val
= WMGetFromPLString(elem
);
1722 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1723 wwarning(_("\"%s\" is not a valid color name"), val
);
1727 color2
.red
= xcolor
.red
>> 8;
1728 color2
.green
= xcolor
.green
>> 8;
1729 color2
.blue
= xcolor
.blue
>> 8;
1731 texture
= (WTexture
*) wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1733 } else if (strcasecmp(val
, "igradient") == 0) {
1734 RColor colors1
[2], colors2
[2];
1740 wwarning(_("bad number of arguments in gradient specification"));
1744 /* get from color */
1745 for (i
= 0; i
< 2; i
++) {
1746 elem
= WMGetFromPLArray(pl
, 1 + i
);
1747 if (!elem
|| !WMIsPLString(elem
))
1749 val
= WMGetFromPLString(elem
);
1751 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1752 wwarning(_("\"%s\" is not a valid color name"), val
);
1755 colors1
[i
].alpha
= 255;
1756 colors1
[i
].red
= xcolor
.red
>> 8;
1757 colors1
[i
].green
= xcolor
.green
>> 8;
1758 colors1
[i
].blue
= xcolor
.blue
>> 8;
1760 elem
= WMGetFromPLArray(pl
, 3);
1761 if (!elem
|| !WMIsPLString(elem
))
1763 val
= WMGetFromPLString(elem
);
1766 /* get from color */
1767 for (i
= 0; i
< 2; i
++) {
1768 elem
= WMGetFromPLArray(pl
, 4 + i
);
1769 if (!elem
|| !WMIsPLString(elem
))
1771 val
= WMGetFromPLString(elem
);
1773 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1774 wwarning(_("\"%s\" is not a valid color name"), val
);
1777 colors2
[i
].alpha
= 255;
1778 colors2
[i
].red
= xcolor
.red
>> 8;
1779 colors2
[i
].green
= xcolor
.green
>> 8;
1780 colors2
[i
].blue
= xcolor
.blue
>> 8;
1782 elem
= WMGetFromPLArray(pl
, 6);
1783 if (!elem
|| !WMIsPLString(elem
))
1785 val
= WMGetFromPLString(elem
);
1788 texture
= (WTexture
*) wTextureMakeIGradient(scr
, th1
, colors1
, th2
, colors2
);
1790 } else if (strcasecmp(val
, "mhgradient") == 0
1791 || strcasecmp(val
, "mvgradient") == 0 || strcasecmp(val
, "mdgradient") == 0) {
1798 wwarning(_("too few arguments in multicolor gradient specification"));
1802 if (val
[1] == 'h' || val
[1] == 'H')
1803 type
= WTEX_MHGRADIENT
;
1804 else if (val
[1] == 'v' || val
[1] == 'V')
1805 type
= WTEX_MVGRADIENT
;
1807 type
= WTEX_MDGRADIENT
;
1811 colors
= wmalloc(sizeof(RColor
*) * (count
+ 1));
1813 for (i
= 0; i
< count
; i
++) {
1814 elem
= WMGetFromPLArray(pl
, i
+ 1);
1815 if (!elem
|| !WMIsPLString(elem
)) {
1816 for (--i
; i
>= 0; --i
) {
1822 val
= WMGetFromPLString(elem
);
1824 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1825 wwarning(_("\"%s\" is not a valid color name"), val
);
1826 for (--i
; i
>= 0; --i
) {
1832 colors
[i
] = wmalloc(sizeof(RColor
));
1833 colors
[i
]->red
= color
.red
>> 8;
1834 colors
[i
]->green
= color
.green
>> 8;
1835 colors
[i
]->blue
= color
.blue
>> 8;
1840 texture
= (WTexture
*) wTextureMakeMGradient(scr
, type
, colors
);
1841 } else if (strcasecmp(val
, "spixmap") == 0 ||
1842 strcasecmp(val
, "cpixmap") == 0 || strcasecmp(val
, "tpixmap") == 0) {
1849 if (val
[0] == 's' || val
[0] == 'S')
1851 else if (val
[0] == 'c' || val
[0] == 'C')
1857 elem
= WMGetFromPLArray(pl
, 2);
1858 if (!elem
|| !WMIsPLString(elem
)) {
1861 val
= WMGetFromPLString(elem
);
1863 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1864 wwarning(_("\"%s\" is not a valid color name"), val
);
1869 elem
= WMGetFromPLArray(pl
, 1);
1870 if (!elem
|| !WMIsPLString(elem
))
1872 val
= WMGetFromPLString(elem
);
1874 texture
= (WTexture
*) wTextureMakePixmap(scr
, type
, val
, &color
);
1875 } else if (strcasecmp(val
, "thgradient") == 0
1876 || strcasecmp(val
, "tvgradient") == 0 || strcasecmp(val
, "tdgradient") == 0) {
1877 RColor color1
, color2
;
1882 if (val
[1] == 'h' || val
[1] == 'H')
1883 style
= WTEX_THGRADIENT
;
1884 else if (val
[1] == 'v' || val
[1] == 'V')
1885 style
= WTEX_TVGRADIENT
;
1887 style
= WTEX_TDGRADIENT
;
1890 wwarning(_("bad number of arguments in textured gradient specification"));
1894 /* get from color */
1895 elem
= WMGetFromPLArray(pl
, 3);
1896 if (!elem
|| !WMIsPLString(elem
))
1898 val
= WMGetFromPLString(elem
);
1900 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1901 wwarning(_("\"%s\" is not a valid color name"), val
);
1905 color1
.red
= xcolor
.red
>> 8;
1906 color1
.green
= xcolor
.green
>> 8;
1907 color1
.blue
= xcolor
.blue
>> 8;
1910 elem
= WMGetFromPLArray(pl
, 4);
1911 if (!elem
|| !WMIsPLString(elem
)) {
1914 val
= WMGetFromPLString(elem
);
1916 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1917 wwarning(_("\"%s\" is not a valid color name"), val
);
1921 color2
.red
= xcolor
.red
>> 8;
1922 color2
.green
= xcolor
.green
>> 8;
1923 color2
.blue
= xcolor
.blue
>> 8;
1926 elem
= WMGetFromPLArray(pl
, 2);
1927 if (!elem
|| !WMIsPLString(elem
))
1930 val
= WMGetFromPLString(elem
);
1932 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
1933 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
1938 elem
= WMGetFromPLArray(pl
, 1);
1939 if (!elem
|| !WMIsPLString(elem
))
1941 val
= WMGetFromPLString(elem
);
1943 texture
= (WTexture
*) wTextureMakeTGradient(scr
, style
, &color1
, &color2
, val
, opacity
);
1944 } else if (strcasecmp(val
, "function") == 0) {
1945 /* Leave this in to handle the unlikely case of
1946 * someone actually having function textures configured */
1947 wwarning("function texture support has been removed");
1950 wwarning(_("invalid texture type %s"), val
);
1956 static int getTexture(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1958 static WTexture
*texture
;
1962 if (!WMIsPLArray(value
)) {
1963 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Texture");
1965 value
= entry
->plvalue
;
1967 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1973 if (strcmp(entry
->key
, "WidgetColor") == 0 && !changed
) {
1976 pl
= WMGetFromPLArray(value
, 0);
1977 if (!pl
|| !WMIsPLString(pl
) || !WMGetFromPLString(pl
)
1978 || strcasecmp(WMGetFromPLString(pl
), "solid") != 0) {
1979 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1980 entry
->key
, "Solid Texture");
1982 value
= entry
->plvalue
;
1984 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1989 texture
= parse_texture(scr
, value
);
1992 wwarning(_("Error in texture specification for key \"%s\""), entry
->key
);
1994 value
= entry
->plvalue
;
1996 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2006 *(WTexture
**) addr
= texture
;
2011 static int getWSBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2018 /* Parameter not used, but tell the compiler that it is ok */
2023 if (!WMIsPLArray(value
)) {
2024 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2025 "WorkspaceBack", "Texture or None");
2027 value
= entry
->plvalue
;
2029 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2035 /* only do basic error checking and verify for None texture */
2037 nelem
= WMGetPropListItemCount(value
);
2039 elem
= WMGetFromPLArray(value
, 0);
2040 if (!elem
|| !WMIsPLString(elem
)) {
2041 wwarning(_("Wrong type for workspace background. Should be a texture type."));
2043 value
= entry
->plvalue
;
2045 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2050 val
= WMGetFromPLString(elem
);
2052 if (strcasecmp(val
, "None") == 0)
2055 *ret
= WMRetainPropList(value
);
2061 getWSSpecificBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2067 /* Parameter not used, but tell the compiler that it is ok */
2072 if (!WMIsPLArray(value
)) {
2073 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2074 "WorkspaceSpecificBack", "an array of textures");
2076 value
= entry
->plvalue
;
2078 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2084 /* only do basic error checking and verify for None texture */
2086 nelem
= WMGetPropListItemCount(value
);
2089 elem
= WMGetFromPLArray(value
, nelem
);
2090 if (!elem
|| !WMIsPLArray(elem
)) {
2091 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2097 *ret
= WMRetainPropList(value
);
2101 * Kluge to force wmsetbg helper to set the default background.
2102 * If the WorkspaceSpecificBack is changed once wmaker has started,
2103 * the WorkspaceBack won't be sent to the helper, unless the user
2104 * changes its value too. So, we must force this by removing the
2105 * value from the defaults DB.
2107 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2108 WMPropList
*key
= WMCreatePLString("WorkspaceBack");
2110 WMRemoveFromPLDictionary(w_global
.domain
.wmaker
->dictionary
, key
);
2112 WMReleasePropList(key
);
2118 static int getFont(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2120 static WMFont
*font
;
2125 GET_STRING_OR_DEFAULT("Font", val
);
2127 font
= WMCreateFont(scr
->wmscreen
, val
);
2129 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2132 wfatal(_("could not load any usable font!!!"));
2139 /* can't assign font value outside update function */
2140 wassertrv(addr
== NULL
, True
);
2145 static int getColor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2147 static XColor color
;
2149 int second_pass
= 0;
2153 GET_STRING_OR_DEFAULT("Color", val
);
2156 if (!wGetColor(scr
, val
, &color
)) {
2157 wwarning(_("could not get color for key \"%s\""), entry
->key
);
2158 if (second_pass
== 0) {
2159 val
= WMGetFromPLString(entry
->plvalue
);
2161 wwarning(_("using default \"%s\" instead"), val
);
2170 assert(addr
== NULL
);
2173 *(unsigned long*)addr = pixel;
2179 static int getKeybind(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2181 static WShortKey shortcut
;
2185 char buf
[MAX_SHORTCUT_LENGTH
], *b
;
2187 /* Parameter not used, but tell the compiler that it is ok */
2191 GET_STRING_OR_DEFAULT("Key spec", val
);
2193 if (!val
|| strcasecmp(val
, "NONE") == 0) {
2194 shortcut
.keycode
= 0;
2195 shortcut
.modifier
= 0;
2201 wstrlcpy(buf
, val
, MAX_SHORTCUT_LENGTH
);
2206 shortcut
.modifier
= 0;
2207 while ((k
= strchr(b
, '+')) != NULL
) {
2211 mod
= wXModifierFromKey(b
);
2213 wwarning(_("%s: invalid key modifier \"%s\""), entry
->key
, b
);
2216 shortcut
.modifier
|= mod
;
2222 ksym
= XStringToKeysym(b
);
2224 if (ksym
== NoSymbol
) {
2225 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
, val
);
2229 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2230 if (shortcut
.keycode
== 0) {
2231 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2241 static int getModMask(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2246 /* Parameter not used, but tell the compiler that it is ok */
2249 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2254 mask
= wXModifierFromKey(str
);
2256 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2262 *(int *)addr
= mask
;
2270 # include <X11/cursorfont.h>
2276 #define CURSOR_ID_NONE (XC_num_glyphs)
2278 static const WCursorLookup cursor_table
[] = {
2279 {"X_cursor", XC_X_cursor
},
2280 {"arrow", XC_arrow
},
2281 {"based_arrow_down", XC_based_arrow_down
},
2282 {"based_arrow_up", XC_based_arrow_up
},
2284 {"bogosity", XC_bogosity
},
2285 {"bottom_left_corner", XC_bottom_left_corner
},
2286 {"bottom_right_corner", XC_bottom_right_corner
},
2287 {"bottom_side", XC_bottom_side
},
2288 {"bottom_tee", XC_bottom_tee
},
2289 {"box_spiral", XC_box_spiral
},
2290 {"center_ptr", XC_center_ptr
},
2291 {"circle", XC_circle
},
2292 {"clock", XC_clock
},
2293 {"coffee_mug", XC_coffee_mug
},
2294 {"cross", XC_cross
},
2295 {"cross_reverse", XC_cross_reverse
},
2296 {"crosshair", XC_crosshair
},
2297 {"diamond_cross", XC_diamond_cross
},
2299 {"dotbox", XC_dotbox
},
2300 {"double_arrow", XC_double_arrow
},
2301 {"draft_large", XC_draft_large
},
2302 {"draft_small", XC_draft_small
},
2303 {"draped_box", XC_draped_box
},
2304 {"exchange", XC_exchange
},
2305 {"fleur", XC_fleur
},
2306 {"gobbler", XC_gobbler
},
2307 {"gumby", XC_gumby
},
2308 {"hand1", XC_hand1
},
2309 {"hand2", XC_hand2
},
2310 {"heart", XC_heart
},
2312 {"iron_cross", XC_iron_cross
},
2313 {"left_ptr", XC_left_ptr
},
2314 {"left_side", XC_left_side
},
2315 {"left_tee", XC_left_tee
},
2316 {"leftbutton", XC_leftbutton
},
2317 {"ll_angle", XC_ll_angle
},
2318 {"lr_angle", XC_lr_angle
},
2320 {"middlebutton", XC_middlebutton
},
2321 {"mouse", XC_mouse
},
2322 {"pencil", XC_pencil
},
2323 {"pirate", XC_pirate
},
2325 {"question_arrow", XC_question_arrow
},
2326 {"right_ptr", XC_right_ptr
},
2327 {"right_side", XC_right_side
},
2328 {"right_tee", XC_right_tee
},
2329 {"rightbutton", XC_rightbutton
},
2330 {"rtl_logo", XC_rtl_logo
},
2331 {"sailboat", XC_sailboat
},
2332 {"sb_down_arrow", XC_sb_down_arrow
},
2333 {"sb_h_double_arrow", XC_sb_h_double_arrow
},
2334 {"sb_left_arrow", XC_sb_left_arrow
},
2335 {"sb_right_arrow", XC_sb_right_arrow
},
2336 {"sb_up_arrow", XC_sb_up_arrow
},
2337 {"sb_v_double_arrow", XC_sb_v_double_arrow
},
2338 {"shuttle", XC_shuttle
},
2339 {"sizing", XC_sizing
},
2340 {"spider", XC_spider
},
2341 {"spraycan", XC_spraycan
},
2343 {"target", XC_target
},
2344 {"tcross", XC_tcross
},
2345 {"top_left_arrow", XC_top_left_arrow
},
2346 {"top_left_corner", XC_top_left_corner
},
2347 {"top_right_corner", XC_top_right_corner
},
2348 {"top_side", XC_top_side
},
2349 {"top_tee", XC_top_tee
},
2351 {"ul_angle", XC_ul_angle
},
2352 {"umbrella", XC_umbrella
},
2353 {"ur_angle", XC_ur_angle
},
2354 {"watch", XC_watch
},
2355 {"xterm", XC_xterm
},
2356 {NULL
, CURSOR_ID_NONE
}
2359 static void check_bitmap_status(int status
, const char *filename
, Pixmap bitmap
)
2362 case BitmapOpenFailed
:
2363 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2365 case BitmapFileInvalid
:
2366 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2368 case BitmapNoMemory
:
2369 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2372 XFreePixmap(dpy
, bitmap
);
2379 * (builtin, <cursor_name>)
2380 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2382 static int parse_cursor(WScreen
* scr
, WMPropList
* pl
, Cursor
* cursor
)
2389 nelem
= WMGetPropListItemCount(pl
);
2393 elem
= WMGetFromPLArray(pl
, 0);
2394 if (!elem
|| !WMIsPLString(elem
)) {
2397 val
= WMGetFromPLString(elem
);
2399 if (strcasecmp(val
, "none") == 0) {
2402 } else if (strcasecmp(val
, "builtin") == 0) {
2404 int cursor_id
= CURSOR_ID_NONE
;
2407 wwarning(_("bad number of arguments in cursor specification"));
2410 elem
= WMGetFromPLArray(pl
, 1);
2411 if (!elem
|| !WMIsPLString(elem
)) {
2414 val
= WMGetFromPLString(elem
);
2416 for (i
= 0; cursor_table
[i
].name
!= NULL
; i
++) {
2417 if (strcasecmp(val
, cursor_table
[i
].name
) == 0) {
2418 cursor_id
= cursor_table
[i
].id
;
2422 if (CURSOR_ID_NONE
== cursor_id
) {
2423 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2425 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2428 } else if (strcasecmp(val
, "bitmap") == 0) {
2440 wwarning(_("bad number of arguments in cursor specification"));
2443 elem
= WMGetFromPLArray(pl
, 1);
2444 if (!elem
|| !WMIsPLString(elem
)) {
2447 val
= WMGetFromPLString(elem
);
2448 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2450 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2453 elem
= WMGetFromPLArray(pl
, 2);
2454 if (!elem
|| !WMIsPLString(elem
)) {
2458 val
= WMGetFromPLString(elem
);
2459 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2462 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2465 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
, &mask
, &x
, &y
);
2466 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
, &bitmap
, &x
, &y
);
2467 if ((BitmapSuccess
== bitmap_status
) && (BitmapSuccess
== mask_status
)) {
2468 fg
.pixel
= scr
->black_pixel
;
2469 bg
.pixel
= scr
->white_pixel
;
2470 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2471 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2472 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2475 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2476 check_bitmap_status(mask_status
, mask_name
, mask
);
2483 static int getCursor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2485 static Cursor cursor
;
2490 if (!WMIsPLArray(value
)) {
2491 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2492 entry
->key
, "cursor specification");
2494 value
= entry
->plvalue
;
2496 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2501 status
= parse_cursor(scr
, value
, &cursor
);
2503 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2505 value
= entry
->plvalue
;
2507 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2516 *(Cursor
*) addr
= cursor
;
2521 #undef CURSOR_ID_NONE
2523 /* ---------------- value setting functions --------------- */
2524 static int setJustify(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2526 /* Parameter not used, but tell the compiler that it is ok */
2532 return REFRESH_WINDOW_TITLE_COLOR
;
2535 static int setClearance(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2537 /* Parameter not used, but tell the compiler that it is ok */
2543 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
| REFRESH_MENU_TITLE_FONT
| REFRESH_MENU_FONT
;
2546 static int setIfDockPresent(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2549 long which
= (long) extra_data
;
2551 /* Parameter not used, but tell the compiler that it is ok */
2557 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2558 // Drawers require the dock
2559 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| wPreferences
.flags
.nodock
;
2562 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2565 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| *flag
;
2573 static int setClipMergedInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2577 /* Parameter not used, but tell the compiler that it is ok */
2582 wPreferences
.flags
.clip_merged_in_dock
= *flag
;
2583 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2587 static int setWrapAppiconsInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2591 /* Parameter not used, but tell the compiler that it is ok */
2596 wPreferences
.flags
.wrap_appicons_in_dock
= *flag
;
2600 static int setStickyIcons(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2602 /* Parameter not used, but tell the compiler that it is ok */
2607 if (scr
->workspaces
) {
2608 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2609 wArrangeIcons(scr
, False
);
2614 static int setIconTile(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2618 WTexture
** texture
= tdata
;
2621 /* Parameter not used, but tell the compiler that it is ok */
2624 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2625 wPreferences
.icon_size
, ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2626 ? WREL_ICON
: WREL_FLAT
);
2628 wwarning(_("could not render texture for icon background"));
2630 wTextureDestroy(scr
, *texture
);
2633 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2635 if (scr
->icon_tile
) {
2637 RReleaseImage(scr
->icon_tile
);
2638 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2641 scr
->icon_tile
= img
;
2643 /* put the icon in the noticeboard hint */
2644 PropSetIconTileHint(scr
, img
);
2646 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
) {
2647 if (scr
->clip_tile
) {
2648 RReleaseImage(scr
->clip_tile
);
2650 scr
->clip_tile
= wClipMakeTile(img
);
2653 if (!wPreferences
.flags
.nodrawer
) {
2654 if (scr
->drawer_tile
) {
2655 RReleaseImage(scr
->drawer_tile
);
2657 scr
->drawer_tile
= wDrawerMakeTile(scr
, img
);
2660 scr
->icon_tile_pixmap
= pixmap
;
2662 if (scr
->def_icon_rimage
) {
2663 RReleaseImage(scr
->def_icon_rimage
);
2664 scr
->def_icon_rimage
= NULL
;
2667 if (scr
->icon_back_texture
)
2668 wTextureDestroy(scr
, (WTexture
*) scr
->icon_back_texture
);
2670 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2672 /* Free the texture as nobody else will use it, nor refer to it. */
2674 wTextureDestroy(scr
, *texture
);
2676 return (reset
? REFRESH_ICON_TILE
: 0);
2679 static int setWinTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2681 WMFont
*font
= tdata
;
2683 /* Parameter not used, but tell the compiler that it is ok */
2687 if (scr
->title_font
) {
2688 WMReleaseFont(scr
->title_font
);
2690 scr
->title_font
= font
;
2692 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
;
2695 static int setMenuTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2697 WMFont
*font
= tdata
;
2699 /* Parameter not used, but tell the compiler that it is ok */
2703 if (scr
->menu_title_font
) {
2704 WMReleaseFont(scr
->menu_title_font
);
2707 scr
->menu_title_font
= font
;
2709 return REFRESH_MENU_TITLE_FONT
;
2712 static int setMenuTextFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2714 WMFont
*font
= tdata
;
2716 /* Parameter not used, but tell the compiler that it is ok */
2720 if (scr
->menu_entry_font
) {
2721 WMReleaseFont(scr
->menu_entry_font
);
2723 scr
->menu_entry_font
= font
;
2725 return REFRESH_MENU_FONT
;
2728 static int setIconTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2730 WMFont
*font
= tdata
;
2732 /* Parameter not used, but tell the compiler that it is ok */
2736 if (scr
->icon_title_font
) {
2737 WMReleaseFont(scr
->icon_title_font
);
2740 scr
->icon_title_font
= font
;
2742 return REFRESH_ICON_FONT
;
2745 static int setClipTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2747 WMFont
*font
= tdata
;
2749 /* Parameter not used, but tell the compiler that it is ok */
2753 if (scr
->clip_title_font
) {
2754 WMReleaseFont(scr
->clip_title_font
);
2757 scr
->clip_title_font
= font
;
2759 return REFRESH_ICON_FONT
;
2762 static int setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2764 WMFont
*font
= tdata
;
2766 /* Parameter not used, but tell the compiler that it is ok */
2771 if (scr
->workspace_name_font
)
2772 WMReleaseFont(scr
->workspace_name_font
);
2774 scr
->workspace_name_font
= font
;
2779 static int setHightlight(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2781 XColor
*color
= tdata
;
2783 /* Parameter not used, but tell the compiler that it is ok */
2787 if (scr
->select_color
)
2788 WMReleaseColor(scr
->select_color
);
2790 scr
->select_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2792 wFreeColor(scr
, color
->pixel
);
2794 return REFRESH_MENU_COLOR
;
2797 static int setHightlightText(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2799 XColor
*color
= tdata
;
2801 /* Parameter not used, but tell the compiler that it is ok */
2805 if (scr
->select_text_color
)
2806 WMReleaseColor(scr
->select_text_color
);
2808 scr
->select_text_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2810 wFreeColor(scr
, color
->pixel
);
2812 return REFRESH_MENU_COLOR
;
2815 static int setClipTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2817 XColor
*color
= tdata
;
2818 long widx
= (long) extra_data
;
2820 /* Parameter not used, but tell the compiler that it is ok */
2823 if (scr
->clip_title_color
[widx
])
2824 WMReleaseColor(scr
->clip_title_color
[widx
]);
2826 scr
->clip_title_color
[widx
] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2827 wFreeColor(scr
, color
->pixel
);
2829 return REFRESH_ICON_TITLE_COLOR
;
2832 static int setWTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2834 XColor
*color
= tdata
;
2835 long widx
= (long) extra_data
;
2837 /* Parameter not used, but tell the compiler that it is ok */
2840 if (scr
->window_title_color
[widx
])
2841 WMReleaseColor(scr
->window_title_color
[widx
]);
2843 scr
->window_title_color
[widx
] =
2844 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2846 wFreeColor(scr
, color
->pixel
);
2848 return REFRESH_WINDOW_TITLE_COLOR
;
2851 static int setMenuTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2853 XColor
*color
= tdata
;
2855 /* Parameter not used, but tell the compiler that it is ok */
2859 if (scr
->menu_title_color
[0])
2860 WMReleaseColor(scr
->menu_title_color
[0]);
2862 scr
->menu_title_color
[0] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2864 wFreeColor(scr
, color
->pixel
);
2866 return REFRESH_MENU_TITLE_COLOR
;
2869 static int setMenuTextColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2871 XColor
*color
= tdata
;
2873 /* Parameter not used, but tell the compiler that it is ok */
2877 if (scr
->mtext_color
)
2878 WMReleaseColor(scr
->mtext_color
);
2880 scr
->mtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2882 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2883 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2885 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2888 wFreeColor(scr
, color
->pixel
);
2890 return REFRESH_MENU_COLOR
;
2893 static int setMenuDisabledColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2895 XColor
*color
= tdata
;
2897 /* Parameter not used, but tell the compiler that it is ok */
2901 if (scr
->dtext_color
)
2902 WMReleaseColor(scr
->dtext_color
);
2904 scr
->dtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2906 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2907 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2909 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2912 wFreeColor(scr
, color
->pixel
);
2914 return REFRESH_MENU_COLOR
;
2917 static int setIconTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2919 XColor
*color
= tdata
;
2921 /* Parameter not used, but tell the compiler that it is ok */
2925 if (scr
->icon_title_color
)
2926 WMReleaseColor(scr
->icon_title_color
);
2927 scr
->icon_title_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2929 wFreeColor(scr
, color
->pixel
);
2931 return REFRESH_ICON_TITLE_COLOR
;
2934 static int setIconTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2936 XColor
*color
= tdata
;
2938 /* Parameter not used, but tell the compiler that it is ok */
2942 if (scr
->icon_title_texture
) {
2943 wTextureDestroy(scr
, (WTexture
*) scr
->icon_title_texture
);
2945 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
2947 return REFRESH_ICON_TITLE_BACK
;
2950 static int setFrameBorderWidth(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2954 /* Parameter not used, but tell the compiler that it is ok */
2958 scr
->frame_border_width
= *value
;
2960 return REFRESH_FRAME_BORDER
;
2963 static int setFrameBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2965 XColor
*color
= tdata
;
2967 /* Parameter not used, but tell the compiler that it is ok */
2971 if (scr
->frame_border_color
)
2972 WMReleaseColor(scr
->frame_border_color
);
2973 scr
->frame_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2975 wFreeColor(scr
, color
->pixel
);
2977 return REFRESH_FRAME_BORDER
;
2980 static int setFrameFocusedBorderColor(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2982 XColor
*color
= tdata
;
2984 /* Parameter not used, but tell the compiler that it is ok */
2988 if (scr
->frame_focused_border_color
)
2989 WMReleaseColor(scr
->frame_focused_border_color
);
2990 scr
->frame_focused_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2992 wFreeColor(scr
, color
->pixel
);
2994 return REFRESH_FRAME_BORDER
;
2997 static int setFrameSelectedBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2999 XColor
*color
= tdata
;
3001 /* Parameter not used, but tell the compiler that it is ok */
3005 if (scr
->frame_selected_border_color
)
3006 WMReleaseColor(scr
->frame_selected_border_color
);
3007 scr
->frame_selected_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
3009 wFreeColor(scr
, color
->pixel
);
3011 return REFRESH_FRAME_BORDER
;
3014 static int setWorkspaceSpecificBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
3016 WMPropList
*value
= tdata
;
3021 /* Parameter not used, but tell the compiler that it is ok */
3025 if (scr
->flags
.backimage_helper_launched
) {
3026 if (WMGetPropListItemCount(value
) == 0) {
3027 SendHelperMessage(scr
, 'C', 0, NULL
);
3028 SendHelperMessage(scr
, 'K', 0, NULL
);
3030 WMReleasePropList(value
);
3034 if (WMGetPropListItemCount(value
) == 0)
3037 if (!start_bg_helper(scr
)) {
3038 WMReleasePropList(value
);
3042 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3045 for (i
= 0; i
< WMGetPropListItemCount(value
); i
++) {
3046 val
= WMGetFromPLArray(value
, i
);
3047 if (val
&& WMIsPLArray(val
) && WMGetPropListItemCount(val
) > 0) {
3048 str
= WMGetPropListDescription(val
, False
);
3050 SendHelperMessage(scr
, 'S', i
+ 1, str
);
3054 SendHelperMessage(scr
, 'U', i
+ 1, NULL
);
3059 WMReleasePropList(value
);
3063 static int setWorkspaceBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
3065 WMPropList
*value
= tdata
;
3067 /* Parameter not used, but tell the compiler that it is ok */
3071 if (scr
->flags
.backimage_helper_launched
) {
3074 if (WMGetPropListItemCount(value
) == 0) {
3075 SendHelperMessage(scr
, 'U', 0, NULL
);
3077 /* set the default workspace background to this one */
3078 str
= WMGetPropListDescription(value
, False
);
3080 SendHelperMessage(scr
, 'S', 0, str
);
3082 SendHelperMessage(scr
, 'C', scr
->current_workspace
+ 1, NULL
);
3084 SendHelperMessage(scr
, 'U', 0, NULL
);
3087 } else if (WMGetPropListItemCount(value
) > 0) {
3092 text
= WMGetPropListDescription(value
, False
);
3093 len
= strlen(text
) + 40;
3094 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3095 if (!strchr(text
, '\'') && !strchr(text
, '\\')) {
3098 if (wPreferences
.smooth_workspace_back
)
3099 snprintf(command
, len
, "wmsetbg %s -S -p '%s' &", dither
, text
);
3101 snprintf(command
, len
, "wmsetbg %s -p '%s' &", dither
, text
);
3102 ExecuteShellCommand(scr
, command
);
3104 wwarning(_("Invalid arguments for background \"%s\""), text
);
3107 WMReleasePropList(value
);
3112 static int setWidgetColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3114 WTexture
**texture
= tdata
;
3116 /* Parameter not used, but tell the compiler that it is ok */
3120 if (scr
->widget_texture
) {
3121 wTextureDestroy(scr
, (WTexture
*) scr
->widget_texture
);
3123 scr
->widget_texture
= *(WTexSolid
**) texture
;
3128 static int setFTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3130 WTexture
**texture
= tdata
;
3132 /* Parameter not used, but tell the compiler that it is ok */
3136 if (scr
->window_title_texture
[WS_FOCUSED
]) {
3137 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3139 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3141 return REFRESH_WINDOW_TEXTURES
;
3144 static int setPTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3146 WTexture
**texture
= tdata
;
3148 /* Parameter not used, but tell the compiler that it is ok */
3152 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
3153 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3155 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3157 return REFRESH_WINDOW_TEXTURES
;
3160 static int setUTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3162 WTexture
**texture
= tdata
;
3164 /* Parameter not used, but tell the compiler that it is ok */
3168 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
3169 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3171 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3173 return REFRESH_WINDOW_TEXTURES
;
3176 static int setResizebarBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3178 WTexture
**texture
= tdata
;
3180 /* Parameter not used, but tell the compiler that it is ok */
3184 if (scr
->resizebar_texture
[0]) {
3185 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3187 scr
->resizebar_texture
[0] = *texture
;
3189 return REFRESH_WINDOW_TEXTURES
;
3192 static int setMenuTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3194 WTexture
**texture
= tdata
;
3196 /* Parameter not used, but tell the compiler that it is ok */
3200 if (scr
->menu_title_texture
[0]) {
3201 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3203 scr
->menu_title_texture
[0] = *texture
;
3205 return REFRESH_MENU_TITLE_TEXTURE
;
3208 static int setMenuTextBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3210 WTexture
**texture
= tdata
;
3212 /* Parameter not used, but tell the compiler that it is ok */
3216 if (scr
->menu_item_texture
) {
3217 wTextureDestroy(scr
, scr
->menu_item_texture
);
3218 wTextureDestroy(scr
, (WTexture
*) scr
->menu_item_auxtexture
);
3220 scr
->menu_item_texture
= *texture
;
3222 scr
->menu_item_auxtexture
= wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3224 return REFRESH_MENU_TEXTURE
;
3227 static int setKeyGrab(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3229 WShortKey
*shortcut
= tdata
;
3231 long widx
= (long) extra_data
;
3233 /* Parameter not used, but tell the compiler that it is ok */
3236 wKeyBindings
[widx
] = *shortcut
;
3238 wwin
= scr
->focused_window
;
3240 while (wwin
!= NULL
) {
3241 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3243 if (!WFLAGP(wwin
, no_bind_keys
)) {
3244 wWindowSetKeyGrabs(wwin
);
3249 /* do we need to update window menus? */
3250 if (widx
>= WKBD_WORKSPACE1
&& widx
<= WKBD_WORKSPACE10
)
3251 return REFRESH_WORKSPACE_MENU
;
3252 if (widx
== WKBD_LASTWORKSPACE
)
3253 return REFRESH_WORKSPACE_MENU
;
3254 if (widx
>= WKBD_MOVE_WORKSPACE1
&& widx
<= WKBD_MOVE_WORKSPACE10
)
3255 return REFRESH_WORKSPACE_MENU
;
3260 static int setIconPosition(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3262 /* Parameter not used, but tell the compiler that it is ok */
3267 wScreenUpdateUsableArea(scr
);
3268 wArrangeIcons(scr
, True
);
3273 static int updateUsableArea(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3275 /* Parameter not used, but tell the compiler that it is ok */
3280 wScreenUpdateUsableArea(scr
);
3285 static int setWorkspaceMapBackground(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3287 WTexture
**texture
= tdata
;
3289 /* Parameter not used, but tell the compiler that it is ok */
3293 if (wPreferences
.wsmbackTexture
)
3294 wTextureDestroy(scr
, wPreferences
.wsmbackTexture
);
3296 wPreferences
.wsmbackTexture
= *texture
;
3298 return REFRESH_WINDOW_TEXTURES
;
3301 static int setMenuStyle(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3303 /* Parameter not used, but tell the compiler that it is ok */
3309 return REFRESH_MENU_TEXTURE
;
3312 static RImage
*chopOffImage(RImage
* image
, int x
, int y
, int w
, int h
)
3314 RImage
*img
= RCreateImage(w
, h
, image
->format
== RRGBAFormat
);
3316 RCopyArea(img
, image
, x
, y
, w
, h
, 0, 0);
3321 static int setSwPOptions(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3323 WMPropList
*array
= tdata
;
3326 int cwidth
, cheight
;
3327 struct WPreferences
*prefs
= foo
;
3329 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) == 0) {
3330 if (prefs
->swtileImage
)
3331 RReleaseImage(prefs
->swtileImage
);
3332 prefs
->swtileImage
= NULL
;
3334 WMReleasePropList(array
);
3338 switch (WMGetPropListItemCount(array
)) {
3340 if (!WMIsPLString(WMGetFromPLArray(array
, 1))) {
3341 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3344 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 1)));
3347 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3348 WMGetFromPLString(WMGetFromPLArray(array
, 1)), entry
->key
);
3350 bgimage
= RLoadImage(scr
->rcontext
, path
, 0);
3352 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3357 cwidth
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 2)));
3358 cheight
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 3)));
3360 if (cwidth
<= 0 || cheight
<= 0 ||
3361 cwidth
>= bgimage
->width
- 2 || cheight
>= bgimage
->height
- 2)
3362 wwarning(_("Invalid split sizes for switch panel back image."));
3365 int swidth
, theight
;
3366 for (i
= 0; i
< 9; i
++) {
3367 if (prefs
->swbackImage
[i
])
3368 RReleaseImage(prefs
->swbackImage
[i
]);
3369 prefs
->swbackImage
[i
] = NULL
;
3371 swidth
= (bgimage
->width
- cwidth
) / 2;
3372 theight
= (bgimage
->height
- cheight
) / 2;
3374 prefs
->swbackImage
[0] = chopOffImage(bgimage
, 0, 0, swidth
, theight
);
3375 prefs
->swbackImage
[1] = chopOffImage(bgimage
, swidth
, 0, cwidth
, theight
);
3376 prefs
->swbackImage
[2] = chopOffImage(bgimage
, swidth
+ cwidth
, 0,
3379 prefs
->swbackImage
[3] = chopOffImage(bgimage
, 0, theight
, swidth
, cheight
);
3380 prefs
->swbackImage
[4] = chopOffImage(bgimage
, swidth
, theight
,
3382 prefs
->swbackImage
[5] = chopOffImage(bgimage
, swidth
+ cwidth
, theight
,
3385 prefs
->swbackImage
[6] = chopOffImage(bgimage
, 0, theight
+ cheight
,
3387 prefs
->swbackImage
[7] = chopOffImage(bgimage
, swidth
, theight
+ cheight
,
3389 prefs
->swbackImage
[8] =
3390 chopOffImage(bgimage
, swidth
+ cwidth
, theight
+ cheight
, swidth
,
3393 // check if anything failed
3394 for (i
= 0; i
< 9; i
++) {
3395 if (!prefs
->swbackImage
[i
]) {
3396 for (; i
>= 0; --i
) {
3397 RReleaseImage(prefs
->swbackImage
[i
]);
3398 prefs
->swbackImage
[i
] = NULL
;
3404 RReleaseImage(bgimage
);
3411 if (!WMIsPLString(WMGetFromPLArray(array
, 0))) {
3412 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3415 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 0)));
3418 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3419 WMGetFromPLString(WMGetFromPLArray(array
, 0)), entry
->key
);
3421 if (prefs
->swtileImage
)
3422 RReleaseImage(prefs
->swtileImage
);
3424 prefs
->swtileImage
= RLoadImage(scr
->rcontext
, path
, 0);
3425 if (!prefs
->swtileImage
) {
3426 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3433 wwarning(_("Invalid number of arguments for option \"%s\""), entry
->key
);
3437 WMReleasePropList(array
);
3442 static int setModifierKeyLabels(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3444 WMPropList
*array
= tdata
;
3446 struct WPreferences
*prefs
= foo
;
3448 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) != 7) {
3449 wwarning(_("Value for option \"%s\" must be an array of 7 strings"), entry
->key
);
3450 WMReleasePropList(array
);
3454 DestroyWindowMenu(scr
);
3456 for (i
= 0; i
< 7; i
++) {
3457 if (prefs
->modifier_labels
[i
])
3458 wfree(prefs
->modifier_labels
[i
]);
3460 if (WMIsPLString(WMGetFromPLArray(array
, i
))) {
3461 prefs
->modifier_labels
[i
] = wstrdup(WMGetFromPLString(WMGetFromPLArray(array
, i
)));
3463 wwarning(_("Invalid argument for option \"%s\" item %d"), entry
->key
, i
);
3464 prefs
->modifier_labels
[i
] = NULL
;
3468 WMReleasePropList(array
);
3473 static int setHotCornerActions(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3475 WMPropList
*array
= tdata
;
3477 struct WPreferences
*prefs
= foo
;
3479 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) != 4) {
3480 wwarning(_("Value for option \"%s\" must be an array of 4 strings"), entry
->key
);
3481 WMReleasePropList(array
);
3485 DestroyWindowMenu(scr
);
3487 for (i
= 0; i
< 4; i
++) {
3488 if (prefs
->hot_corner_actions
[i
])
3489 wfree(prefs
->hot_corner_actions
[i
]);
3491 if (WMIsPLString(WMGetFromPLArray(array
, i
))) {
3493 val
= WMGetFromPLString(WMGetFromPLArray(array
, i
));
3494 if (strcasecmp(val
, "NONE") != 0)
3495 prefs
->hot_corner_actions
[i
] = wstrdup(val
);
3497 prefs
->hot_corner_actions
[i
] = NULL
;
3499 wwarning(_("Invalid argument for option \"%s\" item %d"), entry
->key
, i
);
3500 prefs
->hot_corner_actions
[i
] = NULL
;
3504 WMReleasePropList(array
);
3510 static int setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3514 /* Parameter not used, but tell the compiler that it is ok */
3521 W_setconf_doubleClickDelay(*value
);
3526 static int setCursor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3528 Cursor
*cursor
= tdata
;
3529 long widx
= (long) extra_data
;
3531 /* Parameter not used, but tell the compiler that it is ok */
3534 if (wPreferences
.cursor
[widx
] != None
) {
3535 XFreeCursor(dpy
, wPreferences
.cursor
[widx
]);
3538 wPreferences
.cursor
[widx
] = *cursor
;
3540 if (widx
== WCUR_ROOT
&& *cursor
!= None
) {
3541 XDefineCursor(dpy
, scr
->root_win
, *cursor
);
3547 static int updateDock(WScreen
* scr
, WDefaultEntry
* entry
,
3548 void *tdata
, void *extra_data
) {
3554 wDockSwap(scr
->dock
);