1 /* defaults.c - manage configuration through defaults db
3 * Window Maker window manager
5 * Copyright (c) 1997-2003 Alfredo K. Kojima
6 * Copyright (c) 1998-2003 Dan Pascu
7 * Copyright (c) 2014 Window Maker Team
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
35 #include <sys/types.h>
41 #define PATH_MAX DEFAULT_PATH_MAX
45 #include <X11/Xutil.h>
46 #include <X11/keysym.h>
50 #include "WindowMaker.h"
55 #include "resources.h"
58 #include "xmodifier.h"
63 #include "workspace.h"
64 #include "properties.h"
68 #define MAX_SHORTCUT_LENGTH 32
70 #ifndef GLOBAL_DEFAULTS_SUBDIR
71 #define GLOBAL_DEFAULTS_SUBDIR "WindowMaker"
75 typedef struct _WDefaultEntry WDefaultEntry
;
76 typedef int (WDECallbackConvert
) (WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*plvalue
, void *addr
, void **tdata
);
77 typedef int (WDECallbackUpdate
) (WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *extra_data
);
79 struct _WDefaultEntry
{
81 const char *default_value
;
84 WDECallbackConvert
*convert
;
85 WDECallbackUpdate
*update
;
87 WMPropList
*plvalue
; /* default value */
90 /* used to map strings to integers */
98 static WDECallbackConvert getBool
;
99 static WDECallbackConvert getInt
;
100 static WDECallbackConvert getCoord
;
101 static WDECallbackConvert getPathList
;
102 static WDECallbackConvert getEnum
;
103 static WDECallbackConvert getTexture
;
104 static WDECallbackConvert getWSBackground
;
105 static WDECallbackConvert getWSSpecificBackground
;
106 static WDECallbackConvert getFont
;
107 static WDECallbackConvert getColor
;
108 static WDECallbackConvert getKeybind
;
109 static WDECallbackConvert getModMask
;
110 static WDECallbackConvert getPropList
;
112 /* value setting functions */
113 static WDECallbackUpdate setJustify
;
114 static WDECallbackUpdate setClearance
;
115 static WDECallbackUpdate setIfDockPresent
;
116 static WDECallbackUpdate setClipMergedInDock
;
117 static WDECallbackUpdate setWrapAppiconsInDock
;
118 static WDECallbackUpdate setStickyIcons
;
119 static WDECallbackUpdate setWidgetColor
;
120 static WDECallbackUpdate setIconTile
;
121 static WDECallbackUpdate setWinTitleFont
;
122 static WDECallbackUpdate setMenuTitleFont
;
123 static WDECallbackUpdate setMenuTextFont
;
124 static WDECallbackUpdate setIconTitleFont
;
125 static WDECallbackUpdate setIconTitleColor
;
126 static WDECallbackUpdate setIconTitleBack
;
127 static WDECallbackUpdate setFrameBorderWidth
;
128 static WDECallbackUpdate setFrameBorderColor
;
129 static WDECallbackUpdate setFrameFocusedBorderColor
;
130 static WDECallbackUpdate setFrameSelectedBorderColor
;
131 static WDECallbackUpdate setLargeDisplayFont
;
132 static WDECallbackUpdate setWTitleColor
;
133 static WDECallbackUpdate setFTitleBack
;
134 static WDECallbackUpdate setPTitleBack
;
135 static WDECallbackUpdate setUTitleBack
;
136 static WDECallbackUpdate setResizebarBack
;
137 static WDECallbackUpdate setWorkspaceBack
;
138 static WDECallbackUpdate setWorkspaceSpecificBack
;
139 static WDECallbackUpdate setMenuTitleColor
;
140 static WDECallbackUpdate setMenuTextColor
;
141 static WDECallbackUpdate setMenuDisabledColor
;
142 static WDECallbackUpdate setMenuTitleBack
;
143 static WDECallbackUpdate setMenuTextBack
;
144 static WDECallbackUpdate setHightlight
;
145 static WDECallbackUpdate setHightlightText
;
146 static WDECallbackUpdate setKeyGrab
;
147 static WDECallbackUpdate setDoubleClick
;
148 static WDECallbackUpdate setIconPosition
;
149 static WDECallbackUpdate setWorkspaceMapBackground
;
151 static WDECallbackUpdate setClipTitleFont
;
152 static WDECallbackUpdate setClipTitleColor
;
154 static WDECallbackUpdate setMenuStyle
;
155 static WDECallbackUpdate setSwPOptions
;
156 static WDECallbackUpdate updateUsableArea
;
158 static WDECallbackUpdate setModifierKeyLabels
;
160 static WDECallbackConvert getCursor
;
161 static WDECallbackUpdate setCursor
;
164 * Tables to convert strings to enumeration values.
165 * Values stored are char
168 /* WARNING: sum of length of all value strings must not exceed
170 #define TOTAL_VALUES_LENGTH 80
172 #define REFRESH_WINDOW_TEXTURES (1<<0)
173 #define REFRESH_MENU_TEXTURE (1<<1)
174 #define REFRESH_MENU_FONT (1<<2)
175 #define REFRESH_MENU_COLOR (1<<3)
176 #define REFRESH_MENU_TITLE_TEXTURE (1<<4)
177 #define REFRESH_MENU_TITLE_FONT (1<<5)
178 #define REFRESH_MENU_TITLE_COLOR (1<<6)
179 #define REFRESH_WINDOW_TITLE_COLOR (1<<7)
180 #define REFRESH_WINDOW_FONT (1<<8)
181 #define REFRESH_ICON_TILE (1<<9)
182 #define REFRESH_ICON_FONT (1<<10)
183 #define REFRESH_WORKSPACE_BACK (1<<11)
185 #define REFRESH_BUTTON_IMAGES (1<<12)
187 #define REFRESH_ICON_TITLE_COLOR (1<<13)
188 #define REFRESH_ICON_TITLE_BACK (1<<14)
190 #define REFRESH_WORKSPACE_MENU (1<<15)
192 #define REFRESH_FRAME_BORDER REFRESH_MENU_FONT|REFRESH_WINDOW_FONT
194 static WOptionEnumeration seFocusModes
[] = {
195 {"Manual", WKF_CLICK
, 0}, {"ClickToFocus", WKF_CLICK
, 1},
196 {"Sloppy", WKF_SLOPPY
, 0}, {"SemiAuto", WKF_SLOPPY
, 1}, {"Auto", WKF_SLOPPY
, 1},
200 static WOptionEnumeration seTitlebarModes
[] = {
201 {"new", TS_NEW
, 0}, {"old", TS_OLD
, 0},
202 {"next", TS_NEXT
, 0}, {NULL
, 0, 0}
205 static WOptionEnumeration seColormapModes
[] = {
206 {"Manual", WCM_CLICK
, 0}, {"ClickToFocus", WCM_CLICK
, 1},
207 {"Auto", WCM_POINTER
, 0}, {"FocusFollowMouse", WCM_POINTER
, 1},
211 static WOptionEnumeration sePlacements
[] = {
212 {"Auto", WPM_AUTO
, 0},
213 {"Smart", WPM_SMART
, 0},
214 {"Cascade", WPM_CASCADE
, 0},
215 {"Random", WPM_RANDOM
, 0},
216 {"Manual", WPM_MANUAL
, 0},
217 {"Center", WPM_CENTER
, 0},
221 static WOptionEnumeration seGeomDisplays
[] = {
222 {"None", WDIS_NONE
, 0},
223 {"Center", WDIS_CENTER
, 0},
224 {"Corner", WDIS_TOPLEFT
, 0},
225 {"Floating", WDIS_FRAME_CENTER
, 0},
226 {"Line", WDIS_NEW
, 0},
230 static WOptionEnumeration seSpeeds
[] = {
231 {"UltraFast", SPEED_ULTRAFAST
, 0},
232 {"Fast", SPEED_FAST
, 0},
233 {"Medium", SPEED_MEDIUM
, 0},
234 {"Slow", SPEED_SLOW
, 0},
235 {"UltraSlow", SPEED_ULTRASLOW
, 0},
239 static WOptionEnumeration seMouseButtonActions
[] = {
240 {"None", WA_NONE
, 0},
241 {"SelectWindows", WA_SELECT_WINDOWS
, 0},
242 {"OpenApplicationsMenu", WA_OPEN_APPMENU
, 0},
243 {"OpenWindowListMenu", WA_OPEN_WINLISTMENU
, 0},
244 {"MoveToPrevWorkspace", WA_MOVE_PREVWORKSPACE
, 0},
245 {"MoveToNextWorkspace", WA_MOVE_NEXTWORKSPACE
, 0},
246 {"MoveToPrevWindow", WA_MOVE_PREVWINDOW
, 0},
247 {"MoveToNextWindow", WA_MOVE_NEXTWINDOW
, 0},
251 static WOptionEnumeration seMouseWheelActions
[] = {
252 {"None", WA_NONE
, 0},
253 {"SwitchWorkspaces", WA_SWITCH_WORKSPACES
, 0},
254 {"SwitchWindows", WA_SWITCH_WINDOWS
, 0},
258 static WOptionEnumeration seIconificationStyles
[] = {
259 {"Zoom", WIS_ZOOM
, 0},
260 {"Twist", WIS_TWIST
, 0},
261 {"Flip", WIS_FLIP
, 0},
262 {"None", WIS_NONE
, 0},
263 {"random", WIS_RANDOM
, 0},
267 static WOptionEnumeration seJustifications
[] = {
268 {"Left", WTJ_LEFT
, 0},
269 {"Center", WTJ_CENTER
, 0},
270 {"Right", WTJ_RIGHT
, 0},
274 static WOptionEnumeration seIconPositions
[] = {
275 {"blv", IY_BOTTOM
| IY_LEFT
| IY_VERT
, 0},
276 {"blh", IY_BOTTOM
| IY_LEFT
| IY_HORIZ
, 0},
277 {"brv", IY_BOTTOM
| IY_RIGHT
| IY_VERT
, 0},
278 {"brh", IY_BOTTOM
| IY_RIGHT
| IY_HORIZ
, 0},
279 {"tlv", IY_TOP
| IY_LEFT
| IY_VERT
, 0},
280 {"tlh", IY_TOP
| IY_LEFT
| IY_HORIZ
, 0},
281 {"trv", IY_TOP
| IY_RIGHT
| IY_VERT
, 0},
282 {"trh", IY_TOP
| IY_RIGHT
| IY_HORIZ
, 0},
286 static WOptionEnumeration seMenuStyles
[] = {
287 {"normal", MS_NORMAL
, 0},
288 {"singletexture", MS_SINGLE_TEXTURE
, 0},
289 {"flat", MS_FLAT
, 0},
293 static WOptionEnumeration seDisplayPositions
[] = {
294 {"none", WD_NONE
, 0},
295 {"center", WD_CENTER
, 0},
297 {"bottom", WD_BOTTOM
, 0},
298 {"topleft", WD_TOPLEFT
, 0},
299 {"topright", WD_TOPRIGHT
, 0},
300 {"bottomleft", WD_BOTTOMLEFT
, 0},
301 {"bottomright", WD_BOTTOMRIGHT
, 0},
305 static WOptionEnumeration seWorkspaceBorder
[] = {
306 {"None", WB_NONE
, 0},
307 {"LeftRight", WB_LEFTRIGHT
, 0},
308 {"TopBottom", WB_TOPBOTTOM
, 0},
309 {"AllDirections", WB_ALLDIRS
, 0},
313 static WOptionEnumeration seDragMaximizedWindow
[] = {
314 {"Move", DRAGMAX_MOVE
, 0},
315 {"RestoreGeometry", DRAGMAX_RESTORE
, 0},
316 {"Unmaximize", DRAGMAX_UNMAXIMIZE
, 0},
317 {"NoMove", DRAGMAX_NOMOVE
, 0},
322 * ALL entries in the tables bellow, NEED to have a default value
323 * defined, and this value needs to be correct.
326 /* these options will only affect the window manager on startup
328 * static defaults can't access the screen data, because it is
329 * created after these defaults are read
331 WDefaultEntry staticOptionList
[] = {
333 {"ColormapSize", "4", NULL
,
334 &wPreferences
.cmap_size
, getInt
, NULL
, NULL
, NULL
},
335 {"DisableDithering", "NO", NULL
,
336 &wPreferences
.no_dithering
, getBool
, NULL
, NULL
, NULL
},
337 {"IconSize", "64", NULL
,
338 &wPreferences
.icon_size
, getInt
, NULL
, NULL
, NULL
},
339 {"ModifierKey", "Mod1", NULL
,
340 &wPreferences
.modifier_mask
, getModMask
, NULL
, NULL
, NULL
},
341 {"FocusMode", "manual", seFocusModes
, /* have a problem when switching from */
342 &wPreferences
.focus_mode
, getEnum
, NULL
, NULL
, NULL
}, /* manual to sloppy without restart */
343 {"NewStyle", "new", seTitlebarModes
,
344 &wPreferences
.new_style
, getEnum
, NULL
, NULL
, NULL
},
345 {"DisableDock", "NO", (void *)WM_DOCK
,
346 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
347 {"DisableClip", "NO", (void *)WM_CLIP
,
348 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
349 {"DisableDrawers", "NO", (void *)WM_DRAWER
,
350 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
351 {"ClipMergedInDock", "NO", NULL
,
352 NULL
, getBool
, setClipMergedInDock
, NULL
, NULL
},
353 {"DisableMiniwindows", "NO", NULL
,
354 &wPreferences
.disable_miniwindows
, getBool
, NULL
, NULL
, NULL
},
355 {"DisableWorkspacePager", "NO", NULL
,
356 &wPreferences
.disable_workspace_pager
, getBool
, 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 {"DisableWSMouseActions", "NO", NULL
,
371 &wPreferences
.disable_root_mouse
, getBool
, NULL
, NULL
, NULL
},
372 {"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions
,
373 &wPreferences
.mouse_button1
, getEnum
, NULL
, NULL
, NULL
},
374 {"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions
,
375 &wPreferences
.mouse_button2
, getEnum
, NULL
, NULL
, NULL
},
376 {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions
,
377 &wPreferences
.mouse_button3
, getEnum
, NULL
, NULL
, NULL
},
378 {"MouseBackwardButtonAction", "None", seMouseButtonActions
,
379 &wPreferences
.mouse_button8
, getEnum
, NULL
, NULL
, NULL
},
380 {"MouseForwardButtonAction", "None", seMouseButtonActions
,
381 &wPreferences
.mouse_button9
, getEnum
, NULL
, NULL
, NULL
},
382 {"MouseWheelAction", "None", seMouseWheelActions
,
383 &wPreferences
.mouse_wheel_scroll
, getEnum
, NULL
, NULL
, NULL
},
384 {"MouseWheelTiltAction", "None", seMouseWheelActions
,
385 &wPreferences
.mouse_wheel_tilt
, getEnum
, NULL
, NULL
, NULL
},
386 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
387 &wPreferences
.pixmap_path
, getPathList
, NULL
, NULL
, NULL
},
388 {"IconPath", DEF_ICON_PATHS
, NULL
,
389 &wPreferences
.icon_path
, getPathList
, NULL
, NULL
, NULL
},
390 {"ColormapMode", "auto", seColormapModes
,
391 &wPreferences
.colormap_mode
, getEnum
, NULL
, NULL
, NULL
},
392 {"AutoFocus", "NO", NULL
,
393 &wPreferences
.auto_focus
, getBool
, NULL
, NULL
, NULL
},
394 {"RaiseDelay", "0", NULL
,
395 &wPreferences
.raise_delay
, getInt
, NULL
, NULL
, NULL
},
396 {"CirculateRaise", "NO", NULL
,
397 &wPreferences
.circ_raise
, getBool
, NULL
, NULL
, NULL
},
398 {"Superfluous", "NO", NULL
,
399 &wPreferences
.superfluous
, getBool
, NULL
, NULL
, NULL
},
400 {"AdvanceToNewWorkspace", "NO", NULL
,
401 &wPreferences
.ws_advance
, getBool
, NULL
, NULL
, NULL
},
402 {"CycleWorkspaces", "NO", NULL
,
403 &wPreferences
.ws_cycle
, getBool
, NULL
, NULL
, NULL
},
404 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
405 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
, NULL
, NULL
},
406 {"WorkspaceBorder", "None", seWorkspaceBorder
,
407 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
, NULL
, NULL
},
408 {"WorkspaceBorderSize", "0", NULL
,
409 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
, NULL
, NULL
},
410 {"StickyIcons", "NO", NULL
,
411 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
, NULL
, NULL
},
412 {"SaveSessionOnExit", "NO", NULL
,
413 &wPreferences
.save_session_on_exit
, getBool
, NULL
, NULL
, NULL
},
414 {"WrapMenus", "NO", NULL
,
415 &wPreferences
.wrap_menus
, getBool
, NULL
, NULL
, NULL
},
416 {"ScrollableMenus", "NO", NULL
,
417 &wPreferences
.scrollable_menus
, getBool
, NULL
, NULL
, NULL
},
418 {"MenuScrollSpeed", "medium", seSpeeds
,
419 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
, NULL
, NULL
},
420 {"IconSlideSpeed", "medium", seSpeeds
,
421 &wPreferences
.icon_slide_speed
, getEnum
, NULL
, NULL
, NULL
},
422 {"ShadeSpeed", "medium", seSpeeds
,
423 &wPreferences
.shade_speed
, getEnum
, NULL
, NULL
, NULL
},
424 {"BounceAppIconsWhenUrgent", "YES", NULL
,
425 &wPreferences
.bounce_appicons_when_urgent
, getBool
, NULL
, NULL
, NULL
},
426 {"RaiseAppIconsWhenBouncing", "NO", NULL
,
427 &wPreferences
.raise_appicons_when_bouncing
, getBool
, NULL
, NULL
, NULL
},
428 {"DoNotMakeAppIconsBounce", "NO", NULL
,
429 &wPreferences
.do_not_make_appicons_bounce
, getBool
, NULL
, NULL
, NULL
},
430 {"DoubleClickTime", "250", (void *)&wPreferences
.dblclick_time
,
431 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
, NULL
, NULL
},
432 {"ClipAutoraiseDelay", "600", NULL
,
433 &wPreferences
.clip_auto_raise_delay
, getInt
, NULL
, NULL
, NULL
},
434 {"ClipAutolowerDelay", "1000", NULL
,
435 &wPreferences
.clip_auto_lower_delay
, getInt
, NULL
, NULL
, NULL
},
436 {"ClipAutoexpandDelay", "600", NULL
,
437 &wPreferences
.clip_auto_expand_delay
, getInt
, NULL
, NULL
, NULL
},
438 {"ClipAutocollapseDelay", "1000", NULL
,
439 &wPreferences
.clip_auto_collapse_delay
, getInt
, NULL
, NULL
, NULL
},
440 {"WrapAppiconsInDock", "YES", NULL
,
441 NULL
, getBool
, setWrapAppiconsInDock
, NULL
, NULL
},
442 {"AlignSubmenus", "NO", NULL
,
443 &wPreferences
.align_menus
, getBool
, NULL
, NULL
, NULL
},
444 {"ViKeyMenus", "NO", NULL
,
445 &wPreferences
.vi_key_menus
, getBool
, NULL
, NULL
, NULL
},
446 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
447 &wPreferences
.open_transients_with_parent
, getBool
, NULL
, NULL
, NULL
},
448 {"WindowPlacement", "auto", sePlacements
,
449 &wPreferences
.window_placement
, getEnum
, NULL
, NULL
, NULL
},
450 {"IgnoreFocusClick", "NO", NULL
,
451 &wPreferences
.ignore_focus_click
, getBool
, NULL
, NULL
, NULL
},
452 {"UseSaveUnders", "NO", NULL
,
453 &wPreferences
.use_saveunders
, getBool
, NULL
, NULL
, NULL
},
454 {"OpaqueMove", "NO", NULL
,
455 &wPreferences
.opaque_move
, getBool
, NULL
, NULL
, NULL
},
456 {"OpaqueResize", "NO", NULL
,
457 &wPreferences
.opaque_resize
, getBool
, NULL
, NULL
, NULL
},
458 {"OpaqueMoveResizeKeyboard", "NO", NULL
,
459 &wPreferences
.opaque_move_resize_keyboard
, getBool
, NULL
, NULL
, NULL
},
460 {"DisableAnimations", "NO", NULL
,
461 &wPreferences
.no_animations
, getBool
, NULL
, NULL
, NULL
},
462 {"DontLinkWorkspaces", "NO", NULL
,
463 &wPreferences
.no_autowrap
, getBool
, NULL
, NULL
, NULL
},
464 {"WindowSnapping", "NO", NULL
,
465 &wPreferences
.window_snapping
, getBool
, NULL
, NULL
, NULL
},
466 {"DragMaximizedWindow", "Move", seDragMaximizedWindow
,
467 &wPreferences
.drag_maximized_window
, getEnum
, NULL
, NULL
, NULL
},
468 {"HighlightActiveApp", "YES", NULL
,
469 &wPreferences
.highlight_active_app
, getBool
, NULL
, NULL
, NULL
},
470 {"AutoArrangeIcons", "NO", NULL
,
471 &wPreferences
.auto_arrange_icons
, getBool
, NULL
, NULL
, NULL
},
472 {"NoWindowOverDock", "NO", NULL
,
473 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
, NULL
, NULL
},
474 {"NoWindowOverIcons", "NO", NULL
,
475 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
, NULL
, NULL
},
476 {"WindowPlaceOrigin", "(0, 0)", NULL
,
477 &wPreferences
.window_place_origin
, getCoord
, NULL
, NULL
, NULL
},
478 {"ResizeDisplay", "corner", seGeomDisplays
,
479 &wPreferences
.size_display
, getEnum
, NULL
, NULL
, NULL
},
480 {"MoveDisplay", "corner", seGeomDisplays
,
481 &wPreferences
.move_display
, getEnum
, NULL
, NULL
, NULL
},
482 {"DontConfirmKill", "NO", NULL
,
483 &wPreferences
.dont_confirm_kill
, getBool
, NULL
, NULL
, NULL
},
484 {"WindowTitleBalloons", "NO", NULL
,
485 &wPreferences
.window_balloon
, getBool
, NULL
, NULL
, NULL
},
486 {"MiniwindowTitleBalloons", "NO", NULL
,
487 &wPreferences
.miniwin_title_balloon
, getBool
, NULL
, NULL
, NULL
},
488 {"MiniwindowApercuBalloons", "NO", NULL
,
489 &wPreferences
.miniwin_apercu_balloon
, getBool
, NULL
, NULL
, NULL
},
490 {"AppIconBalloons", "NO", NULL
,
491 &wPreferences
.appicon_balloon
, getBool
, NULL
, NULL
, NULL
},
492 {"HelpBalloons", "NO", NULL
,
493 &wPreferences
.help_balloon
, getBool
, NULL
, NULL
, NULL
},
494 {"EdgeResistance", "30", NULL
,
495 &wPreferences
.edge_resistance
, getInt
, NULL
, NULL
, NULL
},
496 {"ResizeIncrement", "0", NULL
,
497 &wPreferences
.resize_increment
, getInt
, NULL
, NULL
, NULL
},
498 {"Attraction", "NO", NULL
,
499 &wPreferences
.attract
, getBool
, NULL
, NULL
, NULL
},
500 {"DisableBlinking", "NO", NULL
,
501 &wPreferences
.dont_blink
, getBool
, NULL
, NULL
, NULL
},
502 {"SingleClickLaunch", "NO", NULL
,
503 &wPreferences
.single_click
, getBool
, NULL
, NULL
, NULL
},
504 {"StrictWindozeCycle", "YES", NULL
,
505 &wPreferences
.strict_windoze_cycle
, getBool
, NULL
, NULL
, NULL
},
506 {"SwitchPanelOnlyOpen", "NO", NULL
,
507 &wPreferences
.panel_only_open
, getBool
, NULL
, NULL
, NULL
},
508 {"ApercuSize", "128", NULL
,
509 &wPreferences
.apercu_size
, getInt
, NULL
, NULL
, NULL
},
513 {"MenuStyle", "normal", seMenuStyles
,
514 &wPreferences
.menu_style
, getEnum
, setMenuStyle
, NULL
, NULL
},
515 {"WidgetColor", "(solid, gray)", NULL
,
516 NULL
, getTexture
, setWidgetColor
, NULL
, NULL
},
517 {"WorkspaceSpecificBack", "()", NULL
,
518 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
, NULL
, NULL
},
519 /* WorkspaceBack must come after WorkspaceSpecificBack or
520 * WorkspaceBack wont know WorkspaceSpecificBack was also
521 * specified and 2 copies of wmsetbg will be launched */
522 {"WorkspaceBack", "(solid, black)", NULL
,
523 NULL
, getWSBackground
, setWorkspaceBack
, NULL
, NULL
},
524 {"SmoothWorkspaceBack", "NO", NULL
,
525 NULL
, getBool
, NULL
, NULL
, NULL
},
526 {"IconBack", "(solid, gray)", NULL
,
527 NULL
, getTexture
, setIconTile
, NULL
, NULL
},
528 {"TitleJustify", "center", seJustifications
,
529 &wPreferences
.title_justification
, getEnum
, setJustify
, NULL
, NULL
},
530 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
531 NULL
, getFont
, setWinTitleFont
, NULL
, NULL
},
532 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
533 &wPreferences
.window_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
534 {"WindowTitleMinHeight", "0", NULL
,
535 &wPreferences
.window_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
536 {"WindowTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
537 &wPreferences
.window_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
538 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
539 &wPreferences
.menu_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
540 {"MenuTitleMinHeight", "0", NULL
,
541 &wPreferences
.menu_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
542 {"MenuTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
543 &wPreferences
.menu_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
544 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
545 &wPreferences
.menu_text_clearance
, getInt
, setClearance
, NULL
, NULL
},
546 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
547 NULL
, getFont
, setMenuTitleFont
, NULL
, NULL
},
548 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
549 NULL
, getFont
, setMenuTextFont
, NULL
, NULL
},
550 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
551 NULL
, getFont
, setIconTitleFont
, NULL
, NULL
},
552 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
553 NULL
, getFont
, setClipTitleFont
, NULL
, NULL
},
554 {"ShowClipTitle", "YES", NULL
,
555 &wPreferences
.show_clip_title
, getBool
, NULL
, NULL
, NULL
},
556 {"LargeDisplayFont", DEF_WORKSPACE_NAME_FONT
, NULL
,
557 NULL
, getFont
, setLargeDisplayFont
, NULL
, NULL
},
558 {"HighlightColor", "white", NULL
,
559 NULL
, getColor
, setHightlight
, NULL
, NULL
},
560 {"HighlightTextColor", "black", NULL
,
561 NULL
, getColor
, setHightlightText
, NULL
, NULL
},
562 {"ClipTitleColor", "black", (void *)CLIP_NORMAL
,
563 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
564 {"CClipTitleColor", "\"#454045\"", (void *)CLIP_COLLAPSED
,
565 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
566 {"FTitleColor", "white", (void *)WS_FOCUSED
,
567 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
568 {"PTitleColor", "white", (void *)WS_PFOCUSED
,
569 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
570 {"UTitleColor", "black", (void *)WS_UNFOCUSED
,
571 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
572 {"FTitleBack", "(solid, black)", NULL
,
573 NULL
, getTexture
, setFTitleBack
, NULL
, NULL
},
574 {"PTitleBack", "(solid, \"#616161\")", NULL
,
575 NULL
, getTexture
, setPTitleBack
, NULL
, NULL
},
576 {"UTitleBack", "(solid, gray)", NULL
,
577 NULL
, getTexture
, setUTitleBack
, NULL
, NULL
},
578 {"ResizebarBack", "(solid, gray)", NULL
,
579 NULL
, getTexture
, setResizebarBack
, NULL
, NULL
},
580 {"MenuTitleColor", "white", NULL
,
581 NULL
, getColor
, setMenuTitleColor
, NULL
, NULL
},
582 {"MenuTextColor", "black", NULL
,
583 NULL
, getColor
, setMenuTextColor
, NULL
, NULL
},
584 {"MenuDisabledColor", "\"#616161\"", NULL
,
585 NULL
, getColor
, setMenuDisabledColor
, NULL
, NULL
},
586 {"MenuTitleBack", "(solid, black)", NULL
,
587 NULL
, getTexture
, setMenuTitleBack
, NULL
, NULL
},
588 {"MenuTextBack", "(solid, gray)", NULL
,
589 NULL
, getTexture
, setMenuTextBack
, NULL
, NULL
},
590 {"IconTitleColor", "white", NULL
,
591 NULL
, getColor
, setIconTitleColor
, NULL
, NULL
},
592 {"IconTitleBack", "black", NULL
,
593 NULL
, getColor
, setIconTitleBack
, NULL
, NULL
},
594 {"SwitchPanelImages", "(swtile.png, swback.png, 30, 40)", &wPreferences
,
595 NULL
, getPropList
, setSwPOptions
, NULL
, NULL
},
596 {"ModifierKeyLabels", "(\"Shift+\", \"Control+\", \"Mod1+\", \"Mod2+\", \"Mod3+\", \"Mod4+\", \"Mod5+\")", &wPreferences
,
597 NULL
, getPropList
, setModifierKeyLabels
, NULL
, NULL
},
598 {"FrameBorderWidth", "1", NULL
,
599 NULL
, getInt
, setFrameBorderWidth
, NULL
, NULL
},
600 {"FrameBorderColor", "black", NULL
,
601 NULL
, getColor
, setFrameBorderColor
, NULL
, NULL
},
602 {"FrameFocusedBorderColor", "black", NULL
,
603 NULL
, getColor
, setFrameFocusedBorderColor
, NULL
, NULL
},
604 {"FrameSelectedBorderColor", "white", NULL
,
605 NULL
, getColor
, setFrameSelectedBorderColor
, NULL
, NULL
},
606 {"WorkspaceMapBack", "(solid, black)", NULL
,
607 NULL
, getTexture
, setWorkspaceMapBackground
, NULL
, NULL
},
611 {"RootMenuKey", "None", (void *)WKBD_ROOTMENU
,
612 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
613 {"WindowListKey", "None", (void *)WKBD_WINDOWLIST
,
614 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
615 {"WindowMenuKey", "None", (void *)WKBD_WINDOWMENU
,
616 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
617 {"DockRaiseLowerKey", "None", (void*)WKBD_DOCKRAISELOWER
,
618 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
619 {"ClipRaiseLowerKey", "None", (void *)WKBD_CLIPRAISELOWER
,
620 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
621 {"MiniaturizeKey", "None", (void *)WKBD_MINIATURIZE
,
622 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
623 {"MinimizeAllKey", "None", (void *)WKBD_MINIMIZEALL
,
624 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
625 {"HideKey", "None", (void *)WKBD_HIDE
,
626 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
627 {"HideOthersKey", "None", (void *)WKBD_HIDE_OTHERS
,
628 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
629 {"MoveResizeKey", "None", (void *)WKBD_MOVERESIZE
,
630 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
631 {"CloseKey", "None", (void *)WKBD_CLOSE
,
632 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
633 {"MaximizeKey", "None", (void *)WKBD_MAXIMIZE
,
634 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
635 {"VMaximizeKey", "None", (void *)WKBD_VMAXIMIZE
,
636 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
637 {"HMaximizeKey", "None", (void *)WKBD_HMAXIMIZE
,
638 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
639 {"LHMaximizeKey", "None", (void*)WKBD_LHMAXIMIZE
,
640 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
641 {"RHMaximizeKey", "None", (void*)WKBD_RHMAXIMIZE
,
642 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
643 {"THMaximizeKey", "None", (void*)WKBD_THMAXIMIZE
,
644 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
645 {"BHMaximizeKey", "None", (void*)WKBD_BHMAXIMIZE
,
646 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
647 {"LTCMaximizeKey", "None", (void*)WKBD_LTCMAXIMIZE
,
648 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
649 {"RTCMaximizeKey", "None", (void*)WKBD_RTCMAXIMIZE
,
650 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
651 {"LBCMaximizeKey", "None", (void*)WKBD_LBCMAXIMIZE
,
652 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
653 {"RBCMaximizeKey", "None", (void*)WKBD_RBCMAXIMIZE
,
654 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
655 {"MaximusKey", "None", (void*)WKBD_MAXIMUS
,
656 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
657 {"OmnipresentKey", "None", (void *)WKBD_OMNIPRESENT
,
658 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
659 {"RaiseKey", "\"Meta+Up\"", (void *)WKBD_RAISE
,
660 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
661 {"LowerKey", "\"Meta+Down\"", (void *)WKBD_LOWER
,
662 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
663 {"RaiseLowerKey", "None", (void *)WKBD_RAISELOWER
,
664 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
665 {"ShadeKey", "None", (void *)WKBD_SHADE
,
666 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
667 {"SelectKey", "None", (void *)WKBD_SELECT
,
668 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
669 {"WorkspaceMapKey", "None", (void *)WKBD_WORKSPACEMAP
,
670 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
671 {"FocusNextKey", "None", (void *)WKBD_FOCUSNEXT
,
672 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
673 {"FocusPrevKey", "None", (void *)WKBD_FOCUSPREV
,
674 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
675 {"GroupNextKey", "None", (void *)WKBD_GROUPNEXT
,
676 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
677 {"GroupPrevKey", "None", (void *)WKBD_GROUPPREV
,
678 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
679 {"NextWorkspaceKey", "None", (void *)WKBD_NEXTWORKSPACE
,
680 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
681 {"PrevWorkspaceKey", "None", (void *)WKBD_PREVWORKSPACE
,
682 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
683 {"LastWorkspaceKey", "None", (void *)WKBD_LASTWORKSPACE
,
684 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
685 {"NextWorkspaceLayerKey", "None", (void *)WKBD_NEXTWSLAYER
,
686 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
687 {"PrevWorkspaceLayerKey", "None", (void *)WKBD_PREVWSLAYER
,
688 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
689 {"Workspace1Key", "None", (void *)WKBD_WORKSPACE1
,
690 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
691 {"Workspace2Key", "None", (void *)WKBD_WORKSPACE2
,
692 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
693 {"Workspace3Key", "None", (void *)WKBD_WORKSPACE3
,
694 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
695 {"Workspace4Key", "None", (void *)WKBD_WORKSPACE4
,
696 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
697 {"Workspace5Key", "None", (void *)WKBD_WORKSPACE5
,
698 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
699 {"Workspace6Key", "None", (void *)WKBD_WORKSPACE6
,
700 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
701 {"Workspace7Key", "None", (void *)WKBD_WORKSPACE7
,
702 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
703 {"Workspace8Key", "None", (void *)WKBD_WORKSPACE8
,
704 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
705 {"Workspace9Key", "None", (void *)WKBD_WORKSPACE9
,
706 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
707 {"Workspace10Key", "None", (void *)WKBD_WORKSPACE10
,
708 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
709 {"MoveToWorkspace1Key", "None", (void *)WKBD_MOVE_WORKSPACE1
,
710 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
711 {"MoveToWorkspace2Key", "None", (void *)WKBD_MOVE_WORKSPACE2
,
712 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
713 {"MoveToWorkspace3Key", "None", (void *)WKBD_MOVE_WORKSPACE3
,
714 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
715 {"MoveToWorkspace4Key", "None", (void *)WKBD_MOVE_WORKSPACE4
,
716 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
717 {"MoveToWorkspace5Key", "None", (void *)WKBD_MOVE_WORKSPACE5
,
718 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
719 {"MoveToWorkspace6Key", "None", (void *)WKBD_MOVE_WORKSPACE6
,
720 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
721 {"MoveToWorkspace7Key", "None", (void *)WKBD_MOVE_WORKSPACE7
,
722 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
723 {"MoveToWorkspace8Key", "None", (void *)WKBD_MOVE_WORKSPACE8
,
724 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
725 {"MoveToWorkspace9Key", "None", (void *)WKBD_MOVE_WORKSPACE9
,
726 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
727 {"MoveToWorkspace10Key", "None", (void *)WKBD_MOVE_WORKSPACE10
,
728 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
729 {"MoveToNextWorkspaceKey", "None", (void *)WKBD_MOVE_NEXTWORKSPACE
,
730 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
731 {"MoveToPrevWorkspaceKey", "None", (void *)WKBD_MOVE_PREVWORKSPACE
,
732 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
733 {"MoveToLastWorkspaceKey", "None", (void *)WKBD_MOVE_LASTWORKSPACE
,
734 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
735 {"MoveToNextWorkspaceLayerKey", "None", (void *)WKBD_MOVE_NEXTWSLAYER
,
736 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
737 {"MoveToPrevWorkspaceLayerKey", "None", (void *)WKBD_MOVE_PREVWSLAYER
,
738 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
739 {"WindowShortcut1Key", "None", (void *)WKBD_WINDOW1
,
740 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
741 {"WindowShortcut2Key", "None", (void *)WKBD_WINDOW2
,
742 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
743 {"WindowShortcut3Key", "None", (void *)WKBD_WINDOW3
,
744 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
745 {"WindowShortcut4Key", "None", (void *)WKBD_WINDOW4
,
746 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
747 {"WindowShortcut5Key", "None", (void *)WKBD_WINDOW5
,
748 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
749 {"WindowShortcut6Key", "None", (void *)WKBD_WINDOW6
,
750 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
751 {"WindowShortcut7Key", "None", (void *)WKBD_WINDOW7
,
752 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
753 {"WindowShortcut8Key", "None", (void *)WKBD_WINDOW8
,
754 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
755 {"WindowShortcut9Key", "None", (void *)WKBD_WINDOW9
,
756 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
757 {"WindowShortcut10Key", "None", (void *)WKBD_WINDOW10
,
758 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
759 {"WindowRelaunchKey", "None", (void *)WKBD_RELAUNCH
,
760 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
761 {"ScreenSwitchKey", "None", (void *)WKBD_SWITCH_SCREEN
,
762 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
763 {"RunKey", "None", (void *)WKBD_RUN
,
764 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
766 #ifdef KEEP_XKB_LOCK_STATUS
767 {"ToggleKbdModeKey", "None", (void *)WKBD_TOGGLE
,
768 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
769 {"KbdModeLock", "NO", NULL
,
770 &wPreferences
.modelock
, getBool
, NULL
, NULL
, NULL
},
771 #endif /* KEEP_XKB_LOCK_STATUS */
773 {"NormalCursor", "(builtin, left_ptr)", (void *)WCUR_ROOT
,
774 NULL
, getCursor
, setCursor
, NULL
, NULL
},
775 {"ArrowCursor", "(builtin, top_left_arrow)", (void *)WCUR_ARROW
,
776 NULL
, getCursor
, setCursor
, NULL
, NULL
},
777 {"MoveCursor", "(builtin, fleur)", (void *)WCUR_MOVE
,
778 NULL
, getCursor
, setCursor
, NULL
, NULL
},
779 {"ResizeCursor", "(builtin, sizing)", (void *)WCUR_RESIZE
,
780 NULL
, getCursor
, setCursor
, NULL
, NULL
},
781 {"TopLeftResizeCursor", "(builtin, top_left_corner)", (void *)WCUR_TOPLEFTRESIZE
,
782 NULL
, getCursor
, setCursor
, NULL
, NULL
},
783 {"TopRightResizeCursor", "(builtin, top_right_corner)", (void *)WCUR_TOPRIGHTRESIZE
,
784 NULL
, getCursor
, setCursor
, NULL
, NULL
},
785 {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)", (void *)WCUR_BOTTOMLEFTRESIZE
,
786 NULL
, getCursor
, setCursor
, NULL
, NULL
},
787 {"BottomRightResizeCursor", "(builtin, bottom_right_corner)", (void *)WCUR_BOTTOMRIGHTRESIZE
,
788 NULL
, getCursor
, setCursor
, NULL
, NULL
},
789 {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)", (void *)WCUR_VERTICALRESIZE
,
790 NULL
, getCursor
, setCursor
, NULL
, NULL
},
791 {"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)", (void *)WCUR_HORIZONRESIZE
,
792 NULL
, getCursor
, setCursor
, NULL
, NULL
},
793 {"WaitCursor", "(builtin, watch)", (void *)WCUR_WAIT
,
794 NULL
, getCursor
, setCursor
, NULL
, NULL
},
795 {"QuestionCursor", "(builtin, question_arrow)", (void *)WCUR_QUESTION
,
796 NULL
, getCursor
, setCursor
, NULL
, NULL
},
797 {"TextCursor", "(builtin, xterm)", (void *)WCUR_TEXT
,
798 NULL
, getCursor
, setCursor
, NULL
, NULL
},
799 {"SelectCursor", "(builtin, cross)", (void *)WCUR_SELECT
,
800 NULL
, getCursor
, setCursor
, NULL
, NULL
},
801 {"DialogHistoryLines", "500", NULL
,
802 &wPreferences
.history_lines
, getInt
, NULL
, NULL
, NULL
},
803 {"CycleActiveHeadOnly", "NO", NULL
,
804 &wPreferences
.cycle_active_head_only
, getBool
, NULL
, NULL
, NULL
},
805 {"CycleIgnoreMinimized", "NO", NULL
,
806 &wPreferences
.cycle_ignore_minimized
, getBool
, NULL
, NULL
, NULL
}
809 static void initDefaults(void)
812 WDefaultEntry
*entry
;
814 WMPLSetCaseSensitive(False
);
816 for (i
= 0; i
< wlengthof(optionList
); i
++) {
817 entry
= &optionList
[i
];
819 entry
->plkey
= WMCreatePLString(entry
->key
);
820 if (entry
->default_value
)
821 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
823 entry
->plvalue
= NULL
;
826 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
827 entry
= &staticOptionList
[i
];
829 entry
->plkey
= WMCreatePLString(entry
->key
);
830 if (entry
->default_value
)
831 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
833 entry
->plvalue
= NULL
;
837 static WMPropList
*readGlobalDomain(const char *domainName
, Bool requireDictionary
)
839 WMPropList
*globalDict
= NULL
;
843 snprintf(path
, sizeof(path
), "%s/%s/%s", SYSCONFDIR
, GLOBAL_DEFAULTS_SUBDIR
, domainName
);
844 if (stat(path
, &stbuf
) >= 0) {
845 globalDict
= WMReadPropListFromFile(path
);
846 if (globalDict
&& requireDictionary
&& !WMIsPLDictionary(globalDict
)) {
847 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"), domainName
, path
);
848 WMReleasePropList(globalDict
);
850 } else if (!globalDict
) {
851 wwarning(_("could not load domain %s from global defaults database"), domainName
);
858 #if defined(GLOBAL_PREAMBLE_MENU_FILE) || defined(GLOBAL_EPILOGUE_MENU_FILE)
859 static void prependMenu(WMPropList
* destarr
, WMPropList
* array
)
864 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
865 item
= WMGetFromPLArray(array
, i
);
867 WMInsertInPLArray(destarr
, i
+ 1, item
);
871 static void appendMenu(WMPropList
* destarr
, WMPropList
* array
)
876 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
877 item
= WMGetFromPLArray(array
, i
);
879 WMAddToPLArray(destarr
, item
);
884 void wDefaultsMergeGlobalMenus(WDDomain
* menuDomain
)
886 WMPropList
*menu
= menuDomain
->dictionary
;
889 if (!menu
|| !WMIsPLArray(menu
))
892 #ifdef GLOBAL_PREAMBLE_MENU_FILE
893 submenu
= WMReadPropListFromFile(SYSCONFDIR
"/" GLOBAL_DEFAULTS_SUBDIR
"/" GLOBAL_PREAMBLE_MENU_FILE
);
895 if (submenu
&& !WMIsPLArray(submenu
)) {
896 wwarning(_("invalid global menu file %s"), GLOBAL_PREAMBLE_MENU_FILE
);
897 WMReleasePropList(submenu
);
901 prependMenu(menu
, submenu
);
902 WMReleasePropList(submenu
);
906 #ifdef GLOBAL_EPILOGUE_MENU_FILE
907 submenu
= WMReadPropListFromFile(SYSCONFDIR
"/" GLOBAL_DEFAULTS_SUBDIR
"/" GLOBAL_EPILOGUE_MENU_FILE
);
909 if (submenu
&& !WMIsPLArray(submenu
)) {
910 wwarning(_("invalid global menu file %s"), GLOBAL_EPILOGUE_MENU_FILE
);
911 WMReleasePropList(submenu
);
915 appendMenu(menu
, submenu
);
916 WMReleasePropList(submenu
);
920 menuDomain
->dictionary
= menu
;
923 WDDomain
*wDefaultsInitDomain(const char *domain
, Bool requireDictionary
)
927 static int inited
= 0;
928 WMPropList
*shared_dict
= NULL
;
935 db
= wmalloc(sizeof(WDDomain
));
936 db
->domain_name
= domain
;
937 db
->path
= wdefaultspathfordomain(domain
);
939 if (stat(db
->path
, &stbuf
) >= 0) {
940 db
->dictionary
= WMReadPropListFromFile(db
->path
);
941 if (db
->dictionary
) {
942 if (requireDictionary
&& !WMIsPLDictionary(db
->dictionary
)) {
943 WMReleasePropList(db
->dictionary
);
944 db
->dictionary
= NULL
;
945 wwarning(_("Domain %s (%s) of defaults database is corrupted!"), domain
, db
->path
);
947 db
->timestamp
= stbuf
.st_mtime
;
949 wwarning(_("could not load domain %s from user defaults database"), domain
);
953 /* global system dictionary */
954 shared_dict
= readGlobalDomain(domain
, requireDictionary
);
956 if (shared_dict
&& db
->dictionary
&& WMIsPLDictionary(shared_dict
) &&
957 WMIsPLDictionary(db
->dictionary
)) {
958 WMMergePLDictionaries(shared_dict
, db
->dictionary
, True
);
959 WMReleasePropList(db
->dictionary
);
960 db
->dictionary
= shared_dict
;
961 if (stbuf
.st_mtime
> db
->timestamp
)
962 db
->timestamp
= stbuf
.st_mtime
;
963 } else if (!db
->dictionary
) {
964 db
->dictionary
= shared_dict
;
965 if (stbuf
.st_mtime
> db
->timestamp
)
966 db
->timestamp
= stbuf
.st_mtime
;
972 void wReadStaticDefaults(WMPropList
* dict
)
975 WDefaultEntry
*entry
;
979 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
980 entry
= &staticOptionList
[i
];
983 plvalue
= WMGetFromPLDictionary(dict
, entry
->plkey
);
987 /* no default in the DB. Use builtin default */
989 plvalue
= entry
->plvalue
;
993 (*entry
->convert
) (NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
995 (*entry
->update
) (NULL
, entry
, tdata
, entry
->extra_data
);
1000 void wDefaultsCheckDomains(void* arg
)
1004 WMPropList
*shared_dict
= NULL
;
1008 /* Parameter not used, but tell the compiler that it is ok */
1011 if (stat(w_global
.domain
.wmaker
->path
, &stbuf
) >= 0 && w_global
.domain
.wmaker
->timestamp
< stbuf
.st_mtime
) {
1012 w_global
.domain
.wmaker
->timestamp
= stbuf
.st_mtime
;
1014 /* Global dictionary */
1015 shared_dict
= readGlobalDomain("WindowMaker", True
);
1017 /* User dictionary */
1018 dict
= WMReadPropListFromFile(w_global
.domain
.wmaker
->path
);
1021 if (!WMIsPLDictionary(dict
)) {
1022 WMReleasePropList(dict
);
1024 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1025 "WindowMaker", w_global
.domain
.wmaker
->path
);
1028 WMMergePLDictionaries(shared_dict
, dict
, True
);
1029 WMReleasePropList(dict
);
1034 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1035 scr
= wScreenWithNumber(i
);
1037 wReadDefaults(scr
, dict
);
1040 if (w_global
.domain
.wmaker
->dictionary
)
1041 WMReleasePropList(w_global
.domain
.wmaker
->dictionary
);
1043 w_global
.domain
.wmaker
->dictionary
= dict
;
1046 wwarning(_("could not load domain %s from user defaults database"), "WindowMaker");
1050 WMReleasePropList(shared_dict
);
1054 if (stat(w_global
.domain
.window_attr
->path
, &stbuf
) >= 0 && w_global
.domain
.window_attr
->timestamp
< stbuf
.st_mtime
) {
1055 /* global dictionary */
1056 shared_dict
= readGlobalDomain("WMWindowAttributes", True
);
1057 /* user dictionary */
1058 dict
= WMReadPropListFromFile(w_global
.domain
.window_attr
->path
);
1060 if (!WMIsPLDictionary(dict
)) {
1061 WMReleasePropList(dict
);
1063 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1064 "WMWindowAttributes", w_global
.domain
.window_attr
->path
);
1067 WMMergePLDictionaries(shared_dict
, dict
, True
);
1068 WMReleasePropList(dict
);
1073 if (w_global
.domain
.window_attr
->dictionary
)
1074 WMReleasePropList(w_global
.domain
.window_attr
->dictionary
);
1076 w_global
.domain
.window_attr
->dictionary
= dict
;
1077 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1078 scr
= wScreenWithNumber(i
);
1080 wDefaultUpdateIcons(scr
);
1082 /* Update the panel image if changed */
1083 /* Don't worry. If the image is the same these
1084 * functions will have no performance impact. */
1085 create_logo_image(scr
);
1090 wwarning(_("could not load domain %s from user defaults database"), "WMWindowAttributes");
1093 w_global
.domain
.window_attr
->timestamp
= stbuf
.st_mtime
;
1095 WMReleasePropList(shared_dict
);
1098 if (stat(w_global
.domain
.root_menu
->path
, &stbuf
) >= 0 && w_global
.domain
.root_menu
->timestamp
< stbuf
.st_mtime
) {
1099 dict
= WMReadPropListFromFile(w_global
.domain
.root_menu
->path
);
1101 if (!WMIsPLArray(dict
) && !WMIsPLString(dict
)) {
1102 WMReleasePropList(dict
);
1104 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1105 "WMRootMenu", w_global
.domain
.root_menu
->path
);
1107 if (w_global
.domain
.root_menu
->dictionary
)
1108 WMReleasePropList(w_global
.domain
.root_menu
->dictionary
);
1110 w_global
.domain
.root_menu
->dictionary
= dict
;
1111 wDefaultsMergeGlobalMenus(w_global
.domain
.root_menu
);
1114 wwarning(_("could not load domain %s from user defaults database"), "WMRootMenu");
1116 w_global
.domain
.root_menu
->timestamp
= stbuf
.st_mtime
;
1118 #ifndef HAVE_INOTIFY
1120 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, arg
);
1124 void wReadDefaults(WScreen
* scr
, WMPropList
* new_dict
)
1126 WMPropList
*plvalue
, *old_value
;
1127 WDefaultEntry
*entry
;
1129 int update_workspace_back
= 0; /* kluge :/ */
1130 unsigned int needs_refresh
;
1132 WMPropList
*old_dict
= (w_global
.domain
.wmaker
->dictionary
!= new_dict
? w_global
.domain
.wmaker
->dictionary
: NULL
);
1136 for (i
= 0; i
< wlengthof(optionList
); i
++) {
1137 entry
= &optionList
[i
];
1140 plvalue
= WMGetFromPLDictionary(new_dict
, entry
->plkey
);
1147 old_value
= WMGetFromPLDictionary(old_dict
, entry
->plkey
);
1149 if (!plvalue
&& !old_value
) {
1150 /* no default in the DB. Use builtin default */
1151 plvalue
= entry
->plvalue
;
1152 if (plvalue
&& new_dict
)
1153 WMPutInPLDictionary(new_dict
, entry
->plkey
, plvalue
);
1155 } else if (!plvalue
) {
1156 /* value was deleted from DB. Keep current value */
1158 } else if (!old_value
) {
1159 /* set value for the 1st time */
1160 } else if (!WMIsPropListEqualTo(plvalue
, old_value
)) {
1161 /* value has changed */
1163 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1164 && update_workspace_back
&& scr
->flags
.backimage_helper_launched
) {
1166 /* value was not changed since last time */
1173 if ((*entry
->convert
) (scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1175 * If the WorkspaceSpecificBack data has been changed
1176 * so that the helper will be launched now, we must be
1177 * sure to send the default background texture config
1180 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0 &&
1181 !scr
->flags
.backimage_helper_launched
)
1182 update_workspace_back
= 1;
1185 needs_refresh
|= (*entry
->update
) (scr
, entry
, tdata
, entry
->extra_data
);
1192 * Backward Compatibility:
1193 * the option 'apercu_size' used to be coded as a multiple of the icon size in v0.95.6
1194 * it is now expressed directly in pixels, but to avoid breaking user's setting we check
1195 * for old coding and convert it now.
1196 * This code should probably stay for at least 2 years, you should not consider removing
1197 * it before year 2017
1199 if (wPreferences
.apercu_size
< 24) {
1200 /* 24 is the minimum icon size proposed in WPref's settings */
1201 wPreferences
.apercu_size
*= wPreferences
.icon_size
;
1202 if (wPreferences
.miniwin_apercu_balloon
)
1203 wwarning(_("your ApercuSize setting is using old syntax, it is converted to %d pixels; consider running WPrefs.app to update your settings"),
1204 wPreferences
.apercu_size
);
1207 if (needs_refresh
!= 0 && !scr
->flags
.startup
) {
1211 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1212 foo
|= WTextureSettings
;
1213 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1214 foo
|= WFontSettings
;
1215 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1216 foo
|= WColorSettings
;
1218 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1219 (void *)(uintptr_t) foo
);
1222 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1223 foo
|= WTextureSettings
;
1224 if (needs_refresh
& REFRESH_MENU_FONT
)
1225 foo
|= WFontSettings
;
1226 if (needs_refresh
& REFRESH_MENU_COLOR
)
1227 foo
|= WColorSettings
;
1229 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1232 if (needs_refresh
& REFRESH_WINDOW_FONT
)
1233 foo
|= WFontSettings
;
1234 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
)
1235 foo
|= WTextureSettings
;
1236 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
)
1237 foo
|= WColorSettings
;
1239 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1241 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1243 if (needs_refresh
& REFRESH_ICON_FONT
)
1244 foo
|= WFontSettings
;
1245 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
)
1246 foo
|= WTextureSettings
;
1247 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
)
1248 foo
|= WTextureSettings
;
1250 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1251 (void *)(uintptr_t) foo
);
1253 if (needs_refresh
& REFRESH_ICON_TILE
)
1254 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1256 if (needs_refresh
& REFRESH_WORKSPACE_MENU
) {
1257 if (scr
->workspace_menu
)
1258 wWorkspaceMenuUpdate(scr
, scr
->workspace_menu
);
1259 if (scr
->clip_ws_menu
)
1260 wWorkspaceMenuUpdate(scr
, scr
->clip_ws_menu
);
1261 if (scr
->workspace_submenu
)
1262 scr
->workspace_submenu
->flags
.realized
= 0;
1263 if (scr
->clip_submenu
)
1264 scr
->clip_submenu
->flags
.realized
= 0;
1269 void wDefaultUpdateIcons(WScreen
*scr
)
1271 WAppIcon
*aicon
= scr
->app_icon_list
;
1273 WWindow
*wwin
= scr
->focused_window
;
1276 /* Get the application icon, default included */
1277 wIconChangeImageFile(aicon
->icon
, NULL
);
1278 wAppIconPaint(aicon
);
1279 aicon
= aicon
->next
;
1282 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
)
1283 wClipIconPaint(scr
->clip_icon
);
1285 for (dc
= scr
->drawers
; dc
!= NULL
; dc
= dc
->next
)
1286 wDrawerIconPaint(dc
->adrawer
->icon_array
[0]);
1289 if (wwin
->icon
&& wwin
->flags
.miniaturized
)
1290 wIconChangeImageFile(wwin
->icon
, NULL
);
1295 /* --------------------------- Local ----------------------- */
1297 #define GET_STRING_OR_DEFAULT(x, var) if (!WMIsPLString(value)) { \
1298 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1300 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1301 var = entry->default_value;\
1302 } else var = WMGetFromPLString(value)\
1305 static int string2index(WMPropList *key, WMPropList *val, const char *def, WOptionEnumeration * values)
1308 WOptionEnumeration
*v
;
1309 char buffer
[TOTAL_VALUES_LENGTH
];
1311 if (WMIsPLString(val
) && (str
= WMGetFromPLString(val
))) {
1312 for (v
= values
; v
->string
!= NULL
; v
++) {
1313 if (strcasecmp(v
->string
, str
) == 0)
1319 for (v
= values
; v
->string
!= NULL
; v
++) {
1322 strcat(buffer
, ", ");
1323 snprintf(buffer
+strlen(buffer
),
1324 sizeof(buffer
)-strlen(buffer
)-1, "\"%s\"", v
->string
);
1327 wwarning(_("wrong option value for key \"%s\"; got \"%s\", should be one of %s."),
1328 WMGetFromPLString(key
),
1329 WMIsPLString(val
) ? WMGetFromPLString(val
) : "(unknown)",
1333 return string2index(key
, val
, NULL
, values
);
1340 * value - is the value in the defaults DB
1341 * addr - is the address to store the data
1342 * ret - is the address to store a pointer to a temporary buffer. ret
1343 * must not be freed and is used by the set functions
1345 static int getBool(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1349 int second_pass
= 0;
1351 /* Parameter not used, but tell the compiler that it is ok */
1354 GET_STRING_OR_DEFAULT("Boolean", val
);
1357 if ((val
[1] == '\0' && (val
[0] == 'y' || val
[0] == 'Y'))
1358 || strcasecmp(val
, "YES") == 0) {
1361 } else if ((val
[1] == '\0' && (val
[0] == 'n' || val
[0] == 'N'))
1362 || strcasecmp(val
, "NO") == 0) {
1366 if (sscanf(val
, "%i", &i
) == 1) {
1372 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""), val
, entry
->key
);
1373 if (second_pass
== 0) {
1374 val
= WMGetFromPLString(entry
->plvalue
);
1376 wwarning(_("using default \"%s\" instead"), val
);
1386 *(char *)addr
= data
;
1391 static int getInt(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1396 /* Parameter not used, but tell the compiler that it is ok */
1399 GET_STRING_OR_DEFAULT("Integer", val
);
1401 if (sscanf(val
, "%i", &data
) != 1) {
1402 wwarning(_("can't convert \"%s\" to integer for key \"%s\""), val
, entry
->key
);
1403 val
= WMGetFromPLString(entry
->plvalue
);
1404 wwarning(_("using default \"%s\" instead"), val
);
1405 if (sscanf(val
, "%i", &data
) != 1) {
1413 *(int *)addr
= data
;
1418 static int getCoord(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1421 char *val_x
, *val_y
;
1422 int nelem
, changed
= 0;
1423 WMPropList
*elem_x
, *elem_y
;
1426 if (!WMIsPLArray(value
)) {
1427 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Coordinate");
1429 value
= entry
->plvalue
;
1431 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1437 nelem
= WMGetPropListItemCount(value
);
1439 wwarning(_("Incorrect number of elements in array for key \"%s\"."), entry
->key
);
1441 value
= entry
->plvalue
;
1443 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1449 elem_x
= WMGetFromPLArray(value
, 0);
1450 elem_y
= WMGetFromPLArray(value
, 1);
1452 if (!elem_x
|| !elem_y
|| !WMIsPLString(elem_x
) || !WMIsPLString(elem_y
)) {
1453 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."), entry
->key
);
1455 value
= entry
->plvalue
;
1457 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1463 val_x
= WMGetFromPLString(elem_x
);
1464 val_y
= WMGetFromPLString(elem_y
);
1466 if (sscanf(val_x
, "%i", &data
.x
) != 1 || sscanf(val_y
, "%i", &data
.y
) != 1) {
1467 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1469 value
= entry
->plvalue
;
1471 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1479 else if (data
.x
> scr
->scr_width
/ 3)
1480 data
.x
= scr
->scr_width
/ 3;
1483 else if (data
.y
> scr
->scr_height
/ 3)
1484 data
.y
= scr
->scr_height
/ 3;
1489 *(WCoord
*) addr
= data
;
1494 static int getPropList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1496 /* Parameter not used, but tell the compiler that it is ok */
1501 WMRetainPropList(value
);
1508 static int getPathList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1516 /* Parameter not used, but tell the compiler that it is ok */
1521 if (!WMIsPLArray(value
)) {
1522 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "an array of paths");
1524 value
= entry
->plvalue
;
1526 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1533 count
= WMGetPropListItemCount(value
);
1536 value
= entry
->plvalue
;
1538 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1545 for (i
= 0; i
< count
; i
++) {
1546 d
= WMGetFromPLArray(value
, i
);
1547 if (!d
|| !WMIsPLString(d
)) {
1551 len
+= strlen(WMGetFromPLString(d
)) + 1;
1554 ptr
= data
= wmalloc(len
+ 1);
1556 for (i
= 0; i
< count
; i
++) {
1557 d
= WMGetFromPLArray(value
, i
);
1558 if (!d
|| !WMIsPLString(d
)) {
1561 strcpy(ptr
, WMGetFromPLString(d
));
1562 ptr
+= strlen(WMGetFromPLString(d
));
1569 if (*(char **)addr
!= NULL
) {
1570 wfree(*(char **)addr
);
1572 *(char **)addr
= data
;
1577 static int getEnum(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1579 static signed char data
;
1581 /* Parameter not used, but tell the compiler that it is ok */
1584 data
= string2index(entry
->plkey
, value
, entry
->default_value
, (WOptionEnumeration
*) entry
->extra_data
);
1591 *(signed char *)addr
= data
;
1598 * (hgradient <color> <color>)
1599 * (vgradient <color> <color>)
1600 * (dgradient <color> <color>)
1601 * (mhgradient <color> <color> ...)
1602 * (mvgradient <color> <color> ...)
1603 * (mdgradient <color> <color> ...)
1604 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1605 * (tpixmap <file> <color>)
1606 * (spixmap <file> <color>)
1607 * (cpixmap <file> <color>)
1608 * (thgradient <file> <opaqueness> <color> <color>)
1609 * (tvgradient <file> <opaqueness> <color> <color>)
1610 * (tdgradient <file> <opaqueness> <color> <color>)
1611 * (function <lib> <function> ...)
1614 static WTexture
*parse_texture(WScreen
* scr
, WMPropList
* pl
)
1619 WTexture
*texture
= NULL
;
1621 nelem
= WMGetPropListItemCount(pl
);
1625 elem
= WMGetFromPLArray(pl
, 0);
1626 if (!elem
|| !WMIsPLString(elem
))
1628 val
= WMGetFromPLString(elem
);
1630 if (strcasecmp(val
, "solid") == 0) {
1638 elem
= WMGetFromPLArray(pl
, 1);
1639 if (!elem
|| !WMIsPLString(elem
))
1641 val
= WMGetFromPLString(elem
);
1643 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1644 wwarning(_("\"%s\" is not a valid color name"), val
);
1648 texture
= (WTexture
*) wTextureMakeSolid(scr
, &color
);
1649 } else if (strcasecmp(val
, "dgradient") == 0
1650 || strcasecmp(val
, "vgradient") == 0 || strcasecmp(val
, "hgradient") == 0) {
1651 RColor color1
, color2
;
1656 wwarning(_("bad number of arguments in gradient specification"));
1660 if (val
[0] == 'd' || val
[0] == 'D')
1661 type
= WTEX_DGRADIENT
;
1662 else if (val
[0] == 'h' || val
[0] == 'H')
1663 type
= WTEX_HGRADIENT
;
1665 type
= WTEX_VGRADIENT
;
1667 /* get from color */
1668 elem
= WMGetFromPLArray(pl
, 1);
1669 if (!elem
|| !WMIsPLString(elem
))
1671 val
= WMGetFromPLString(elem
);
1673 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1674 wwarning(_("\"%s\" is not a valid color name"), val
);
1678 color1
.red
= xcolor
.red
>> 8;
1679 color1
.green
= xcolor
.green
>> 8;
1680 color1
.blue
= xcolor
.blue
>> 8;
1683 elem
= WMGetFromPLArray(pl
, 2);
1684 if (!elem
|| !WMIsPLString(elem
)) {
1687 val
= WMGetFromPLString(elem
);
1689 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1690 wwarning(_("\"%s\" is not a valid color name"), val
);
1694 color2
.red
= xcolor
.red
>> 8;
1695 color2
.green
= xcolor
.green
>> 8;
1696 color2
.blue
= xcolor
.blue
>> 8;
1698 texture
= (WTexture
*) wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1700 } else if (strcasecmp(val
, "igradient") == 0) {
1701 RColor colors1
[2], colors2
[2];
1707 wwarning(_("bad number of arguments in gradient specification"));
1711 /* get from color */
1712 for (i
= 0; i
< 2; i
++) {
1713 elem
= WMGetFromPLArray(pl
, 1 + i
);
1714 if (!elem
|| !WMIsPLString(elem
))
1716 val
= WMGetFromPLString(elem
);
1718 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1719 wwarning(_("\"%s\" is not a valid color name"), val
);
1722 colors1
[i
].alpha
= 255;
1723 colors1
[i
].red
= xcolor
.red
>> 8;
1724 colors1
[i
].green
= xcolor
.green
>> 8;
1725 colors1
[i
].blue
= xcolor
.blue
>> 8;
1727 elem
= WMGetFromPLArray(pl
, 3);
1728 if (!elem
|| !WMIsPLString(elem
))
1730 val
= WMGetFromPLString(elem
);
1733 /* get from color */
1734 for (i
= 0; i
< 2; i
++) {
1735 elem
= WMGetFromPLArray(pl
, 4 + i
);
1736 if (!elem
|| !WMIsPLString(elem
))
1738 val
= WMGetFromPLString(elem
);
1740 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1741 wwarning(_("\"%s\" is not a valid color name"), val
);
1744 colors2
[i
].alpha
= 255;
1745 colors2
[i
].red
= xcolor
.red
>> 8;
1746 colors2
[i
].green
= xcolor
.green
>> 8;
1747 colors2
[i
].blue
= xcolor
.blue
>> 8;
1749 elem
= WMGetFromPLArray(pl
, 6);
1750 if (!elem
|| !WMIsPLString(elem
))
1752 val
= WMGetFromPLString(elem
);
1755 texture
= (WTexture
*) wTextureMakeIGradient(scr
, th1
, colors1
, th2
, colors2
);
1757 } else if (strcasecmp(val
, "mhgradient") == 0
1758 || strcasecmp(val
, "mvgradient") == 0 || strcasecmp(val
, "mdgradient") == 0) {
1765 wwarning(_("too few arguments in multicolor gradient specification"));
1769 if (val
[1] == 'h' || val
[1] == 'H')
1770 type
= WTEX_MHGRADIENT
;
1771 else if (val
[1] == 'v' || val
[1] == 'V')
1772 type
= WTEX_MVGRADIENT
;
1774 type
= WTEX_MDGRADIENT
;
1778 colors
= wmalloc(sizeof(RColor
*) * (count
+ 1));
1780 for (i
= 0; i
< count
; i
++) {
1781 elem
= WMGetFromPLArray(pl
, i
+ 1);
1782 if (!elem
|| !WMIsPLString(elem
)) {
1783 for (--i
; i
>= 0; --i
) {
1789 val
= WMGetFromPLString(elem
);
1791 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1792 wwarning(_("\"%s\" is not a valid color name"), val
);
1793 for (--i
; i
>= 0; --i
) {
1799 colors
[i
] = wmalloc(sizeof(RColor
));
1800 colors
[i
]->red
= color
.red
>> 8;
1801 colors
[i
]->green
= color
.green
>> 8;
1802 colors
[i
]->blue
= color
.blue
>> 8;
1807 texture
= (WTexture
*) wTextureMakeMGradient(scr
, type
, colors
);
1808 } else if (strcasecmp(val
, "spixmap") == 0 ||
1809 strcasecmp(val
, "cpixmap") == 0 || strcasecmp(val
, "tpixmap") == 0) {
1816 if (val
[0] == 's' || val
[0] == 'S')
1818 else if (val
[0] == 'c' || val
[0] == 'C')
1824 elem
= WMGetFromPLArray(pl
, 2);
1825 if (!elem
|| !WMIsPLString(elem
)) {
1828 val
= WMGetFromPLString(elem
);
1830 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1831 wwarning(_("\"%s\" is not a valid color name"), val
);
1836 elem
= WMGetFromPLArray(pl
, 1);
1837 if (!elem
|| !WMIsPLString(elem
))
1839 val
= WMGetFromPLString(elem
);
1841 texture
= (WTexture
*) wTextureMakePixmap(scr
, type
, val
, &color
);
1842 } else if (strcasecmp(val
, "thgradient") == 0
1843 || strcasecmp(val
, "tvgradient") == 0 || strcasecmp(val
, "tdgradient") == 0) {
1844 RColor color1
, color2
;
1849 if (val
[1] == 'h' || val
[1] == 'H')
1850 style
= WTEX_THGRADIENT
;
1851 else if (val
[1] == 'v' || val
[1] == 'V')
1852 style
= WTEX_TVGRADIENT
;
1854 style
= WTEX_TDGRADIENT
;
1857 wwarning(_("bad number of arguments in textured gradient specification"));
1861 /* get from color */
1862 elem
= WMGetFromPLArray(pl
, 3);
1863 if (!elem
|| !WMIsPLString(elem
))
1865 val
= WMGetFromPLString(elem
);
1867 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1868 wwarning(_("\"%s\" is not a valid color name"), val
);
1872 color1
.red
= xcolor
.red
>> 8;
1873 color1
.green
= xcolor
.green
>> 8;
1874 color1
.blue
= xcolor
.blue
>> 8;
1877 elem
= WMGetFromPLArray(pl
, 4);
1878 if (!elem
|| !WMIsPLString(elem
)) {
1881 val
= WMGetFromPLString(elem
);
1883 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1884 wwarning(_("\"%s\" is not a valid color name"), val
);
1888 color2
.red
= xcolor
.red
>> 8;
1889 color2
.green
= xcolor
.green
>> 8;
1890 color2
.blue
= xcolor
.blue
>> 8;
1893 elem
= WMGetFromPLArray(pl
, 2);
1894 if (!elem
|| !WMIsPLString(elem
))
1897 val
= WMGetFromPLString(elem
);
1899 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
1900 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
1905 elem
= WMGetFromPLArray(pl
, 1);
1906 if (!elem
|| !WMIsPLString(elem
))
1908 val
= WMGetFromPLString(elem
);
1910 texture
= (WTexture
*) wTextureMakeTGradient(scr
, style
, &color1
, &color2
, val
, opacity
);
1911 } else if (strcasecmp(val
, "function") == 0) {
1912 /* Leave this in to handle the unlikely case of
1913 * someone actually having function textures configured */
1914 wwarning("function texture support has been removed");
1917 wwarning(_("invalid texture type %s"), val
);
1923 static int getTexture(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1925 static WTexture
*texture
;
1929 if (!WMIsPLArray(value
)) {
1930 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Texture");
1932 value
= entry
->plvalue
;
1934 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1940 if (strcmp(entry
->key
, "WidgetColor") == 0 && !changed
) {
1943 pl
= WMGetFromPLArray(value
, 0);
1944 if (!pl
|| !WMIsPLString(pl
) || !WMGetFromPLString(pl
)
1945 || strcasecmp(WMGetFromPLString(pl
), "solid") != 0) {
1946 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1947 entry
->key
, "Solid Texture");
1949 value
= entry
->plvalue
;
1951 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1956 texture
= parse_texture(scr
, value
);
1959 wwarning(_("Error in texture specification for key \"%s\""), entry
->key
);
1961 value
= entry
->plvalue
;
1963 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1973 *(WTexture
**) addr
= texture
;
1978 static int getWSBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1985 /* Parameter not used, but tell the compiler that it is ok */
1990 if (!WMIsPLArray(value
)) {
1991 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1992 "WorkspaceBack", "Texture or None");
1994 value
= entry
->plvalue
;
1996 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2002 /* only do basic error checking and verify for None texture */
2004 nelem
= WMGetPropListItemCount(value
);
2006 elem
= WMGetFromPLArray(value
, 0);
2007 if (!elem
|| !WMIsPLString(elem
)) {
2008 wwarning(_("Wrong type for workspace background. Should be a texture type."));
2010 value
= entry
->plvalue
;
2012 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2017 val
= WMGetFromPLString(elem
);
2019 if (strcasecmp(val
, "None") == 0)
2022 *ret
= WMRetainPropList(value
);
2028 getWSSpecificBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2034 /* Parameter not used, but tell the compiler that it is ok */
2039 if (!WMIsPLArray(value
)) {
2040 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2041 "WorkspaceSpecificBack", "an array of textures");
2043 value
= entry
->plvalue
;
2045 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2051 /* only do basic error checking and verify for None texture */
2053 nelem
= WMGetPropListItemCount(value
);
2056 elem
= WMGetFromPLArray(value
, nelem
);
2057 if (!elem
|| !WMIsPLArray(elem
)) {
2058 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2064 *ret
= WMRetainPropList(value
);
2068 * Kluge to force wmsetbg helper to set the default background.
2069 * If the WorkspaceSpecificBack is changed once wmaker has started,
2070 * the WorkspaceBack won't be sent to the helper, unless the user
2071 * changes it's value too. So, we must force this by removing the
2072 * value from the defaults DB.
2074 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2075 WMPropList
*key
= WMCreatePLString("WorkspaceBack");
2077 WMRemoveFromPLDictionary(w_global
.domain
.wmaker
->dictionary
, key
);
2079 WMReleasePropList(key
);
2085 static int getFont(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2087 static WMFont
*font
;
2092 GET_STRING_OR_DEFAULT("Font", val
);
2094 font
= WMCreateFont(scr
->wmscreen
, val
);
2096 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2099 wfatal(_("could not load any usable font!!!"));
2106 /* can't assign font value outside update function */
2107 wassertrv(addr
== NULL
, True
);
2112 static int getColor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2114 static XColor color
;
2116 int second_pass
= 0;
2120 GET_STRING_OR_DEFAULT("Color", val
);
2123 if (!wGetColor(scr
, val
, &color
)) {
2124 wwarning(_("could not get color for key \"%s\""), entry
->key
);
2125 if (second_pass
== 0) {
2126 val
= WMGetFromPLString(entry
->plvalue
);
2128 wwarning(_("using default \"%s\" instead"), val
);
2137 assert(addr
== NULL
);
2140 *(unsigned long*)addr = pixel;
2146 static int getKeybind(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2148 static WShortKey shortcut
;
2152 char buf
[MAX_SHORTCUT_LENGTH
], *b
;
2154 /* Parameter not used, but tell the compiler that it is ok */
2158 GET_STRING_OR_DEFAULT("Key spec", val
);
2160 if (!val
|| strcasecmp(val
, "NONE") == 0) {
2161 shortcut
.keycode
= 0;
2162 shortcut
.modifier
= 0;
2168 wstrlcpy(buf
, val
, MAX_SHORTCUT_LENGTH
);
2173 shortcut
.modifier
= 0;
2174 while ((k
= strchr(b
, '+')) != NULL
) {
2178 mod
= wXModifierFromKey(b
);
2180 wwarning(_("%s: invalid key modifier \"%s\""), entry
->key
, b
);
2183 shortcut
.modifier
|= mod
;
2189 ksym
= XStringToKeysym(b
);
2191 if (ksym
== NoSymbol
) {
2192 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
, val
);
2196 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2197 if (shortcut
.keycode
== 0) {
2198 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2208 static int getModMask(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2213 /* Parameter not used, but tell the compiler that it is ok */
2216 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2221 mask
= wXModifierFromKey(str
);
2223 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2229 *(int *)addr
= mask
;
2237 # include <X11/cursorfont.h>
2243 #define CURSOR_ID_NONE (XC_num_glyphs)
2245 static const WCursorLookup cursor_table
[] = {
2246 {"X_cursor", XC_X_cursor
},
2247 {"arrow", XC_arrow
},
2248 {"based_arrow_down", XC_based_arrow_down
},
2249 {"based_arrow_up", XC_based_arrow_up
},
2251 {"bogosity", XC_bogosity
},
2252 {"bottom_left_corner", XC_bottom_left_corner
},
2253 {"bottom_right_corner", XC_bottom_right_corner
},
2254 {"bottom_side", XC_bottom_side
},
2255 {"bottom_tee", XC_bottom_tee
},
2256 {"box_spiral", XC_box_spiral
},
2257 {"center_ptr", XC_center_ptr
},
2258 {"circle", XC_circle
},
2259 {"clock", XC_clock
},
2260 {"coffee_mug", XC_coffee_mug
},
2261 {"cross", XC_cross
},
2262 {"cross_reverse", XC_cross_reverse
},
2263 {"crosshair", XC_crosshair
},
2264 {"diamond_cross", XC_diamond_cross
},
2266 {"dotbox", XC_dotbox
},
2267 {"double_arrow", XC_double_arrow
},
2268 {"draft_large", XC_draft_large
},
2269 {"draft_small", XC_draft_small
},
2270 {"draped_box", XC_draped_box
},
2271 {"exchange", XC_exchange
},
2272 {"fleur", XC_fleur
},
2273 {"gobbler", XC_gobbler
},
2274 {"gumby", XC_gumby
},
2275 {"hand1", XC_hand1
},
2276 {"hand2", XC_hand2
},
2277 {"heart", XC_heart
},
2279 {"iron_cross", XC_iron_cross
},
2280 {"left_ptr", XC_left_ptr
},
2281 {"left_side", XC_left_side
},
2282 {"left_tee", XC_left_tee
},
2283 {"leftbutton", XC_leftbutton
},
2284 {"ll_angle", XC_ll_angle
},
2285 {"lr_angle", XC_lr_angle
},
2287 {"middlebutton", XC_middlebutton
},
2288 {"mouse", XC_mouse
},
2289 {"pencil", XC_pencil
},
2290 {"pirate", XC_pirate
},
2292 {"question_arrow", XC_question_arrow
},
2293 {"right_ptr", XC_right_ptr
},
2294 {"right_side", XC_right_side
},
2295 {"right_tee", XC_right_tee
},
2296 {"rightbutton", XC_rightbutton
},
2297 {"rtl_logo", XC_rtl_logo
},
2298 {"sailboat", XC_sailboat
},
2299 {"sb_down_arrow", XC_sb_down_arrow
},
2300 {"sb_h_double_arrow", XC_sb_h_double_arrow
},
2301 {"sb_left_arrow", XC_sb_left_arrow
},
2302 {"sb_right_arrow", XC_sb_right_arrow
},
2303 {"sb_up_arrow", XC_sb_up_arrow
},
2304 {"sb_v_double_arrow", XC_sb_v_double_arrow
},
2305 {"shuttle", XC_shuttle
},
2306 {"sizing", XC_sizing
},
2307 {"spider", XC_spider
},
2308 {"spraycan", XC_spraycan
},
2310 {"target", XC_target
},
2311 {"tcross", XC_tcross
},
2312 {"top_left_arrow", XC_top_left_arrow
},
2313 {"top_left_corner", XC_top_left_corner
},
2314 {"top_right_corner", XC_top_right_corner
},
2315 {"top_side", XC_top_side
},
2316 {"top_tee", XC_top_tee
},
2318 {"ul_angle", XC_ul_angle
},
2319 {"umbrella", XC_umbrella
},
2320 {"ur_angle", XC_ur_angle
},
2321 {"watch", XC_watch
},
2322 {"xterm", XC_xterm
},
2323 {NULL
, CURSOR_ID_NONE
}
2326 static void check_bitmap_status(int status
, const char *filename
, Pixmap bitmap
)
2329 case BitmapOpenFailed
:
2330 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2332 case BitmapFileInvalid
:
2333 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2335 case BitmapNoMemory
:
2336 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2339 XFreePixmap(dpy
, bitmap
);
2346 * (builtin, <cursor_name>)
2347 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2349 static int parse_cursor(WScreen
* scr
, WMPropList
* pl
, Cursor
* cursor
)
2356 nelem
= WMGetPropListItemCount(pl
);
2360 elem
= WMGetFromPLArray(pl
, 0);
2361 if (!elem
|| !WMIsPLString(elem
)) {
2364 val
= WMGetFromPLString(elem
);
2366 if (strcasecmp(val
, "none") == 0) {
2369 } else if (strcasecmp(val
, "builtin") == 0) {
2371 int cursor_id
= CURSOR_ID_NONE
;
2374 wwarning(_("bad number of arguments in cursor specification"));
2377 elem
= WMGetFromPLArray(pl
, 1);
2378 if (!elem
|| !WMIsPLString(elem
)) {
2381 val
= WMGetFromPLString(elem
);
2383 for (i
= 0; cursor_table
[i
].name
!= NULL
; i
++) {
2384 if (strcasecmp(val
, cursor_table
[i
].name
) == 0) {
2385 cursor_id
= cursor_table
[i
].id
;
2389 if (CURSOR_ID_NONE
== cursor_id
) {
2390 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2392 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2395 } else if (strcasecmp(val
, "bitmap") == 0) {
2407 wwarning(_("bad number of arguments in cursor specification"));
2410 elem
= WMGetFromPLArray(pl
, 1);
2411 if (!elem
|| !WMIsPLString(elem
)) {
2414 val
= WMGetFromPLString(elem
);
2415 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2417 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2420 elem
= WMGetFromPLArray(pl
, 2);
2421 if (!elem
|| !WMIsPLString(elem
)) {
2425 val
= WMGetFromPLString(elem
);
2426 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2429 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2432 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
, &mask
, &x
, &y
);
2433 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
, &bitmap
, &x
, &y
);
2434 if ((BitmapSuccess
== bitmap_status
) && (BitmapSuccess
== mask_status
)) {
2435 fg
.pixel
= scr
->black_pixel
;
2436 bg
.pixel
= scr
->white_pixel
;
2437 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2438 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2439 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2442 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2443 check_bitmap_status(mask_status
, mask_name
, mask
);
2450 static int getCursor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2452 static Cursor cursor
;
2457 if (!WMIsPLArray(value
)) {
2458 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2459 entry
->key
, "cursor specification");
2461 value
= entry
->plvalue
;
2463 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2468 status
= parse_cursor(scr
, value
, &cursor
);
2470 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2472 value
= entry
->plvalue
;
2474 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2483 *(Cursor
*) addr
= cursor
;
2488 #undef CURSOR_ID_NONE
2490 /* ---------------- value setting functions --------------- */
2491 static int setJustify(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2493 /* Parameter not used, but tell the compiler that it is ok */
2499 return REFRESH_WINDOW_TITLE_COLOR
;
2502 static int setClearance(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2504 /* Parameter not used, but tell the compiler that it is ok */
2510 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
| REFRESH_MENU_TITLE_FONT
| REFRESH_MENU_FONT
;
2513 static int setIfDockPresent(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2516 long which
= (long) extra_data
;
2518 /* Parameter not used, but tell the compiler that it is ok */
2524 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2525 // Drawers require the dock
2526 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| wPreferences
.flags
.nodock
;
2529 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2532 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| *flag
;
2540 static int setClipMergedInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2544 /* Parameter not used, but tell the compiler that it is ok */
2549 wPreferences
.flags
.clip_merged_in_dock
= *flag
;
2550 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2554 static int setWrapAppiconsInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2558 /* Parameter not used, but tell the compiler that it is ok */
2563 wPreferences
.flags
.wrap_appicons_in_dock
= *flag
;
2567 static int setStickyIcons(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2569 /* Parameter not used, but tell the compiler that it is ok */
2574 if (scr
->workspaces
) {
2575 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2576 wArrangeIcons(scr
, False
);
2581 static int setIconTile(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2585 WTexture
** texture
= tdata
;
2588 /* Parameter not used, but tell the compiler that it is ok */
2591 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2592 wPreferences
.icon_size
, ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2593 ? WREL_ICON
: WREL_FLAT
);
2595 wwarning(_("could not render texture for icon background"));
2597 wTextureDestroy(scr
, *texture
);
2600 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2602 if (scr
->icon_tile
) {
2604 RReleaseImage(scr
->icon_tile
);
2605 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2608 scr
->icon_tile
= img
;
2610 /* put the icon in the noticeboard hint */
2611 PropSetIconTileHint(scr
, img
);
2613 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
) {
2614 if (scr
->clip_tile
) {
2615 RReleaseImage(scr
->clip_tile
);
2617 scr
->clip_tile
= wClipMakeTile(img
);
2620 if (!wPreferences
.flags
.nodrawer
) {
2621 if (scr
->drawer_tile
) {
2622 RReleaseImage(scr
->drawer_tile
);
2624 scr
->drawer_tile
= wDrawerMakeTile(scr
, img
);
2627 scr
->icon_tile_pixmap
= pixmap
;
2629 if (scr
->def_icon_rimage
) {
2630 RReleaseImage(scr
->def_icon_rimage
);
2631 scr
->def_icon_rimage
= NULL
;
2634 if (scr
->icon_back_texture
)
2635 wTextureDestroy(scr
, (WTexture
*) scr
->icon_back_texture
);
2637 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2639 /* Free the texture as nobody else will use it, nor refer to it. */
2641 wTextureDestroy(scr
, *texture
);
2643 return (reset
? REFRESH_ICON_TILE
: 0);
2646 static int setWinTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2648 WMFont
*font
= tdata
;
2650 /* Parameter not used, but tell the compiler that it is ok */
2654 if (scr
->title_font
) {
2655 WMReleaseFont(scr
->title_font
);
2657 scr
->title_font
= font
;
2659 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
;
2662 static int setMenuTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2664 WMFont
*font
= tdata
;
2666 /* Parameter not used, but tell the compiler that it is ok */
2670 if (scr
->menu_title_font
) {
2671 WMReleaseFont(scr
->menu_title_font
);
2674 scr
->menu_title_font
= font
;
2676 return REFRESH_MENU_TITLE_FONT
;
2679 static int setMenuTextFont(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
->menu_entry_font
) {
2688 WMReleaseFont(scr
->menu_entry_font
);
2690 scr
->menu_entry_font
= font
;
2692 return REFRESH_MENU_FONT
;
2695 static int setIconTitleFont(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
->icon_title_font
) {
2704 WMReleaseFont(scr
->icon_title_font
);
2707 scr
->icon_title_font
= font
;
2709 return REFRESH_ICON_FONT
;
2712 static int setClipTitleFont(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
->clip_title_font
) {
2721 WMReleaseFont(scr
->clip_title_font
);
2724 scr
->clip_title_font
= font
;
2726 return REFRESH_ICON_FONT
;
2729 static int setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2731 WMFont
*font
= tdata
;
2733 /* Parameter not used, but tell the compiler that it is ok */
2738 if (scr
->workspace_name_font
)
2739 WMReleaseFont(scr
->workspace_name_font
);
2741 scr
->workspace_name_font
= font
;
2746 static int setHightlight(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2748 XColor
*color
= tdata
;
2750 /* Parameter not used, but tell the compiler that it is ok */
2754 if (scr
->select_color
)
2755 WMReleaseColor(scr
->select_color
);
2757 scr
->select_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2759 wFreeColor(scr
, color
->pixel
);
2761 return REFRESH_MENU_COLOR
;
2764 static int setHightlightText(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2766 XColor
*color
= tdata
;
2768 /* Parameter not used, but tell the compiler that it is ok */
2772 if (scr
->select_text_color
)
2773 WMReleaseColor(scr
->select_text_color
);
2775 scr
->select_text_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2777 wFreeColor(scr
, color
->pixel
);
2779 return REFRESH_MENU_COLOR
;
2782 static int setClipTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2784 XColor
*color
= tdata
;
2785 long widx
= (long) extra_data
;
2787 /* Parameter not used, but tell the compiler that it is ok */
2790 if (scr
->clip_title_color
[widx
])
2791 WMReleaseColor(scr
->clip_title_color
[widx
]);
2793 scr
->clip_title_color
[widx
] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2794 wFreeColor(scr
, color
->pixel
);
2796 return REFRESH_ICON_TITLE_COLOR
;
2799 static int setWTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2801 XColor
*color
= tdata
;
2802 long widx
= (long) extra_data
;
2804 /* Parameter not used, but tell the compiler that it is ok */
2807 if (scr
->window_title_color
[widx
])
2808 WMReleaseColor(scr
->window_title_color
[widx
]);
2810 scr
->window_title_color
[widx
] =
2811 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2813 wFreeColor(scr
, color
->pixel
);
2815 return REFRESH_WINDOW_TITLE_COLOR
;
2818 static int setMenuTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2820 XColor
*color
= tdata
;
2822 /* Parameter not used, but tell the compiler that it is ok */
2826 if (scr
->menu_title_color
[0])
2827 WMReleaseColor(scr
->menu_title_color
[0]);
2829 scr
->menu_title_color
[0] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2831 wFreeColor(scr
, color
->pixel
);
2833 return REFRESH_MENU_TITLE_COLOR
;
2836 static int setMenuTextColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2838 XColor
*color
= tdata
;
2840 /* Parameter not used, but tell the compiler that it is ok */
2844 if (scr
->mtext_color
)
2845 WMReleaseColor(scr
->mtext_color
);
2847 scr
->mtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2849 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2850 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2852 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2855 wFreeColor(scr
, color
->pixel
);
2857 return REFRESH_MENU_COLOR
;
2860 static int setMenuDisabledColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2862 XColor
*color
= tdata
;
2864 /* Parameter not used, but tell the compiler that it is ok */
2868 if (scr
->dtext_color
)
2869 WMReleaseColor(scr
->dtext_color
);
2871 scr
->dtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2873 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2874 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2876 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2879 wFreeColor(scr
, color
->pixel
);
2881 return REFRESH_MENU_COLOR
;
2884 static int setIconTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2886 XColor
*color
= tdata
;
2888 /* Parameter not used, but tell the compiler that it is ok */
2892 if (scr
->icon_title_color
)
2893 WMReleaseColor(scr
->icon_title_color
);
2894 scr
->icon_title_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2896 wFreeColor(scr
, color
->pixel
);
2898 return REFRESH_ICON_TITLE_COLOR
;
2901 static int setIconTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2903 XColor
*color
= tdata
;
2905 /* Parameter not used, but tell the compiler that it is ok */
2909 if (scr
->icon_title_texture
) {
2910 wTextureDestroy(scr
, (WTexture
*) scr
->icon_title_texture
);
2912 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
2914 return REFRESH_ICON_TITLE_BACK
;
2917 static int setFrameBorderWidth(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2921 /* Parameter not used, but tell the compiler that it is ok */
2925 scr
->frame_border_width
= *value
;
2927 return REFRESH_FRAME_BORDER
;
2930 static int setFrameBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2932 XColor
*color
= tdata
;
2934 /* Parameter not used, but tell the compiler that it is ok */
2938 if (scr
->frame_border_color
)
2939 WMReleaseColor(scr
->frame_border_color
);
2940 scr
->frame_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2942 wFreeColor(scr
, color
->pixel
);
2944 return REFRESH_FRAME_BORDER
;
2947 static int setFrameFocusedBorderColor(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2949 XColor
*color
= tdata
;
2951 /* Parameter not used, but tell the compiler that it is ok */
2955 if (scr
->frame_focused_border_color
)
2956 WMReleaseColor(scr
->frame_focused_border_color
);
2957 scr
->frame_focused_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2959 wFreeColor(scr
, color
->pixel
);
2961 return REFRESH_FRAME_BORDER
;
2964 static int setFrameSelectedBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2966 XColor
*color
= tdata
;
2968 /* Parameter not used, but tell the compiler that it is ok */
2972 if (scr
->frame_selected_border_color
)
2973 WMReleaseColor(scr
->frame_selected_border_color
);
2974 scr
->frame_selected_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2976 wFreeColor(scr
, color
->pixel
);
2978 return REFRESH_FRAME_BORDER
;
2981 static int setWorkspaceSpecificBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
2983 WMPropList
*value
= tdata
;
2988 /* Parameter not used, but tell the compiler that it is ok */
2992 if (scr
->flags
.backimage_helper_launched
) {
2993 if (WMGetPropListItemCount(value
) == 0) {
2994 SendHelperMessage(scr
, 'C', 0, NULL
);
2995 SendHelperMessage(scr
, 'K', 0, NULL
);
2997 WMReleasePropList(value
);
3001 if (WMGetPropListItemCount(value
) == 0)
3004 if (!start_bg_helper(scr
)) {
3005 WMReleasePropList(value
);
3009 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3012 for (i
= 0; i
< WMGetPropListItemCount(value
); i
++) {
3013 val
= WMGetFromPLArray(value
, i
);
3014 if (val
&& WMIsPLArray(val
) && WMGetPropListItemCount(val
) > 0) {
3015 str
= WMGetPropListDescription(val
, False
);
3017 SendHelperMessage(scr
, 'S', i
+ 1, str
);
3021 SendHelperMessage(scr
, 'U', i
+ 1, NULL
);
3026 WMReleasePropList(value
);
3030 static int setWorkspaceBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
3032 WMPropList
*value
= tdata
;
3034 /* Parameter not used, but tell the compiler that it is ok */
3038 if (scr
->flags
.backimage_helper_launched
) {
3041 if (WMGetPropListItemCount(value
) == 0) {
3042 SendHelperMessage(scr
, 'U', 0, NULL
);
3044 /* set the default workspace background to this one */
3045 str
= WMGetPropListDescription(value
, False
);
3047 SendHelperMessage(scr
, 'S', 0, str
);
3049 SendHelperMessage(scr
, 'C', scr
->current_workspace
+ 1, NULL
);
3051 SendHelperMessage(scr
, 'U', 0, NULL
);
3054 } else if (WMGetPropListItemCount(value
) > 0) {
3060 text
= WMGetPropListDescription(value
, False
);
3061 len
= strlen(text
) + 40;
3062 command
= wmalloc(len
);
3063 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3064 if (!strchr(text
, '\'') && !strchr(text
, '\\')) {
3065 command
= wmalloc(len
);
3066 if (wPreferences
.smooth_workspace_back
)
3067 snprintf(command
, len
, "wmsetbg %s -S -p '%s' &", dither
, text
);
3069 snprintf(command
, len
, "wmsetbg %s -p '%s' &", dither
, text
);
3070 ExecuteShellCommand(scr
, command
);
3073 wwarning(_("Invalid arguments for background \"%s\""), text
);
3076 WMReleasePropList(value
);
3081 static int setWidgetColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3083 WTexture
**texture
= tdata
;
3085 /* Parameter not used, but tell the compiler that it is ok */
3089 if (scr
->widget_texture
) {
3090 wTextureDestroy(scr
, (WTexture
*) scr
->widget_texture
);
3092 scr
->widget_texture
= *(WTexSolid
**) texture
;
3097 static int setFTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3099 WTexture
**texture
= tdata
;
3101 /* Parameter not used, but tell the compiler that it is ok */
3105 if (scr
->window_title_texture
[WS_FOCUSED
]) {
3106 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3108 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3110 return REFRESH_WINDOW_TEXTURES
;
3113 static int setPTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3115 WTexture
**texture
= tdata
;
3117 /* Parameter not used, but tell the compiler that it is ok */
3121 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
3122 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3124 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3126 return REFRESH_WINDOW_TEXTURES
;
3129 static int setUTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3131 WTexture
**texture
= tdata
;
3133 /* Parameter not used, but tell the compiler that it is ok */
3137 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
3138 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3140 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3142 return REFRESH_WINDOW_TEXTURES
;
3145 static int setResizebarBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3147 WTexture
**texture
= tdata
;
3149 /* Parameter not used, but tell the compiler that it is ok */
3153 if (scr
->resizebar_texture
[0]) {
3154 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3156 scr
->resizebar_texture
[0] = *texture
;
3158 return REFRESH_WINDOW_TEXTURES
;
3161 static int setMenuTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3163 WTexture
**texture
= tdata
;
3165 /* Parameter not used, but tell the compiler that it is ok */
3169 if (scr
->menu_title_texture
[0]) {
3170 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3172 scr
->menu_title_texture
[0] = *texture
;
3174 return REFRESH_MENU_TITLE_TEXTURE
;
3177 static int setMenuTextBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3179 WTexture
**texture
= tdata
;
3181 /* Parameter not used, but tell the compiler that it is ok */
3185 if (scr
->menu_item_texture
) {
3186 wTextureDestroy(scr
, scr
->menu_item_texture
);
3187 wTextureDestroy(scr
, (WTexture
*) scr
->menu_item_auxtexture
);
3189 scr
->menu_item_texture
= *texture
;
3191 scr
->menu_item_auxtexture
= wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3193 return REFRESH_MENU_TEXTURE
;
3196 static int setKeyGrab(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3198 WShortKey
*shortcut
= tdata
;
3200 long widx
= (long) extra_data
;
3202 /* Parameter not used, but tell the compiler that it is ok */
3205 wKeyBindings
[widx
] = *shortcut
;
3207 wwin
= scr
->focused_window
;
3209 while (wwin
!= NULL
) {
3210 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3212 if (!WFLAGP(wwin
, no_bind_keys
)) {
3213 wWindowSetKeyGrabs(wwin
);
3218 /* do we need to update window menus? */
3219 if (widx
>= WKBD_WORKSPACE1
&& widx
<= WKBD_WORKSPACE10
)
3220 return REFRESH_WORKSPACE_MENU
;
3221 if (widx
== WKBD_LASTWORKSPACE
)
3222 return REFRESH_WORKSPACE_MENU
;
3223 if (widx
>= WKBD_MOVE_WORKSPACE1
&& widx
<= WKBD_MOVE_WORKSPACE10
)
3224 return REFRESH_WORKSPACE_MENU
;
3229 static int setIconPosition(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3231 /* Parameter not used, but tell the compiler that it is ok */
3236 wScreenUpdateUsableArea(scr
);
3237 wArrangeIcons(scr
, True
);
3242 static int updateUsableArea(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3244 /* Parameter not used, but tell the compiler that it is ok */
3249 wScreenUpdateUsableArea(scr
);
3254 static int setWorkspaceMapBackground(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3256 WTexture
**texture
= tdata
;
3258 /* Parameter not used, but tell the compiler that it is ok */
3262 if (wPreferences
.wsmbackTexture
)
3263 wTextureDestroy(scr
, wPreferences
.wsmbackTexture
);
3265 wPreferences
.wsmbackTexture
= *texture
;
3267 return REFRESH_WINDOW_TEXTURES
;
3270 static int setMenuStyle(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3272 /* Parameter not used, but tell the compiler that it is ok */
3278 return REFRESH_MENU_TEXTURE
;
3281 static RImage
*chopOffImage(RImage
* image
, int x
, int y
, int w
, int h
)
3283 RImage
*img
= RCreateImage(w
, h
, image
->format
== RRGBAFormat
);
3285 RCopyArea(img
, image
, x
, y
, w
, h
, 0, 0);
3290 static int setSwPOptions(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3292 WMPropList
*array
= tdata
;
3295 int cwidth
, cheight
;
3296 struct WPreferences
*prefs
= foo
;
3298 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) == 0) {
3299 if (prefs
->swtileImage
)
3300 RReleaseImage(prefs
->swtileImage
);
3301 prefs
->swtileImage
= NULL
;
3303 WMReleasePropList(array
);
3307 switch (WMGetPropListItemCount(array
)) {
3309 if (!WMIsPLString(WMGetFromPLArray(array
, 1))) {
3310 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3313 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 1)));
3316 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3317 WMGetFromPLString(WMGetFromPLArray(array
, 1)), entry
->key
);
3319 bgimage
= RLoadImage(scr
->rcontext
, path
, 0);
3321 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3326 cwidth
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 2)));
3327 cheight
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 3)));
3329 if (cwidth
<= 0 || cheight
<= 0 ||
3330 cwidth
>= bgimage
->width
- 2 || cheight
>= bgimage
->height
- 2)
3331 wwarning(_("Invalid split sizes for switch panel back image."));
3334 int swidth
, theight
;
3335 for (i
= 0; i
< 9; i
++) {
3336 if (prefs
->swbackImage
[i
])
3337 RReleaseImage(prefs
->swbackImage
[i
]);
3338 prefs
->swbackImage
[i
] = NULL
;
3340 swidth
= (bgimage
->width
- cwidth
) / 2;
3341 theight
= (bgimage
->height
- cheight
) / 2;
3343 prefs
->swbackImage
[0] = chopOffImage(bgimage
, 0, 0, swidth
, theight
);
3344 prefs
->swbackImage
[1] = chopOffImage(bgimage
, swidth
, 0, cwidth
, theight
);
3345 prefs
->swbackImage
[2] = chopOffImage(bgimage
, swidth
+ cwidth
, 0,
3348 prefs
->swbackImage
[3] = chopOffImage(bgimage
, 0, theight
, swidth
, cheight
);
3349 prefs
->swbackImage
[4] = chopOffImage(bgimage
, swidth
, theight
,
3351 prefs
->swbackImage
[5] = chopOffImage(bgimage
, swidth
+ cwidth
, theight
,
3354 prefs
->swbackImage
[6] = chopOffImage(bgimage
, 0, theight
+ cheight
,
3356 prefs
->swbackImage
[7] = chopOffImage(bgimage
, swidth
, theight
+ cheight
,
3358 prefs
->swbackImage
[8] =
3359 chopOffImage(bgimage
, swidth
+ cwidth
, theight
+ cheight
, swidth
,
3362 // check if anything failed
3363 for (i
= 0; i
< 9; i
++) {
3364 if (!prefs
->swbackImage
[i
]) {
3365 for (; i
>= 0; --i
) {
3366 RReleaseImage(prefs
->swbackImage
[i
]);
3367 prefs
->swbackImage
[i
] = NULL
;
3373 RReleaseImage(bgimage
);
3378 if (!WMIsPLString(WMGetFromPLArray(array
, 0))) {
3379 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3382 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 0)));
3385 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3386 WMGetFromPLString(WMGetFromPLArray(array
, 0)), entry
->key
);
3388 if (prefs
->swtileImage
)
3389 RReleaseImage(prefs
->swtileImage
);
3391 prefs
->swtileImage
= RLoadImage(scr
->rcontext
, path
, 0);
3392 if (!prefs
->swtileImage
) {
3393 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3400 wwarning(_("Invalid number of arguments for option \"%s\""), entry
->key
);
3404 WMReleasePropList(array
);
3409 static int setModifierKeyLabels(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3411 WMPropList
*array
= tdata
;
3413 struct WPreferences
*prefs
= foo
;
3415 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) != 7) {
3416 wwarning(_("Value for option \"%s\" must be an array of 7 strings"), entry
->key
);
3417 WMReleasePropList(array
);
3421 DestroyWindowMenu(scr
);
3423 for (i
= 0; i
< 7; i
++) {
3424 if (prefs
->modifier_labels
[i
])
3425 wfree(prefs
->modifier_labels
[i
]);
3427 if (WMIsPLString(WMGetFromPLArray(array
, i
))) {
3428 prefs
->modifier_labels
[i
] = wstrdup(WMGetFromPLString(WMGetFromPLArray(array
, i
)));
3430 wwarning(_("Invalid argument for option \"%s\" item %d"), entry
->key
, i
);
3431 prefs
->modifier_labels
[i
] = NULL
;
3435 WMReleasePropList(array
);
3440 static int setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3444 /* Parameter not used, but tell the compiler that it is ok */
3451 W_setconf_doubleClickDelay(*value
);
3456 static int setCursor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3458 Cursor
*cursor
= tdata
;
3459 long widx
= (long) extra_data
;
3461 /* Parameter not used, but tell the compiler that it is ok */
3464 if (wPreferences
.cursor
[widx
] != None
) {
3465 XFreeCursor(dpy
, wPreferences
.cursor
[widx
]);
3468 wPreferences
.cursor
[widx
] = *cursor
;
3470 if (widx
== WCUR_ROOT
&& *cursor
!= None
) {
3471 XDefineCursor(dpy
, scr
->root_win
, *cursor
);