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
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
33 #include <sys/types.h>
40 #define PATH_MAX DEFAULT_PATH_MAX
44 #include <X11/Xutil.h>
45 #include <X11/keysym.h>
49 #include "WindowMaker.h"
54 #include "resources.h"
57 #include "xmodifier.h"
62 #include "workspace.h"
63 #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
;
150 static WDECallbackUpdate setClipTitleFont
;
151 static WDECallbackUpdate setClipTitleColor
;
153 static WDECallbackUpdate setMenuStyle
;
154 static WDECallbackUpdate setSwPOptions
;
155 static WDECallbackUpdate updateUsableArea
;
157 static WDECallbackUpdate setModifierKeyLabels
;
159 static WDECallbackConvert getCursor
;
160 static WDECallbackUpdate setCursor
;
163 * Tables to convert strings to enumeration values.
164 * Values stored are char
167 /* WARNING: sum of length of all value strings must not exceed
169 #define TOTAL_VALUES_LENGTH 80
171 #define REFRESH_WINDOW_TEXTURES (1<<0)
172 #define REFRESH_MENU_TEXTURE (1<<1)
173 #define REFRESH_MENU_FONT (1<<2)
174 #define REFRESH_MENU_COLOR (1<<3)
175 #define REFRESH_MENU_TITLE_TEXTURE (1<<4)
176 #define REFRESH_MENU_TITLE_FONT (1<<5)
177 #define REFRESH_MENU_TITLE_COLOR (1<<6)
178 #define REFRESH_WINDOW_TITLE_COLOR (1<<7)
179 #define REFRESH_WINDOW_FONT (1<<8)
180 #define REFRESH_ICON_TILE (1<<9)
181 #define REFRESH_ICON_FONT (1<<10)
182 #define REFRESH_WORKSPACE_BACK (1<<11)
184 #define REFRESH_BUTTON_IMAGES (1<<12)
186 #define REFRESH_ICON_TITLE_COLOR (1<<13)
187 #define REFRESH_ICON_TITLE_BACK (1<<14)
189 #define REFRESH_WORKSPACE_MENU (1<<15)
191 #define REFRESH_FRAME_BORDER REFRESH_MENU_FONT|REFRESH_WINDOW_FONT
193 static WOptionEnumeration seFocusModes
[] = {
194 {"Manual", WKF_CLICK
, 0}, {"ClickToFocus", WKF_CLICK
, 1},
195 {"Sloppy", WKF_SLOPPY
, 0}, {"SemiAuto", WKF_SLOPPY
, 1}, {"Auto", WKF_SLOPPY
, 1},
199 static WOptionEnumeration seTitlebarModes
[] = {
200 {"new", TS_NEW
, 0}, {"old", TS_OLD
, 0},
201 {"next", TS_NEXT
, 0}, {NULL
, 0, 0}
204 static WOptionEnumeration seColormapModes
[] = {
205 {"Manual", WCM_CLICK
, 0}, {"ClickToFocus", WCM_CLICK
, 1},
206 {"Auto", WCM_POINTER
, 0}, {"FocusFollowMouse", WCM_POINTER
, 1},
210 static WOptionEnumeration sePlacements
[] = {
211 {"Auto", WPM_AUTO
, 0},
212 {"Smart", WPM_SMART
, 0},
213 {"Cascade", WPM_CASCADE
, 0},
214 {"Random", WPM_RANDOM
, 0},
215 {"Manual", WPM_MANUAL
, 0},
216 {"Center", WPM_CENTER
, 0},
220 static WOptionEnumeration seGeomDisplays
[] = {
221 {"None", WDIS_NONE
, 0},
222 {"Center", WDIS_CENTER
, 0},
223 {"Corner", WDIS_TOPLEFT
, 0},
224 {"Floating", WDIS_FRAME_CENTER
, 0},
225 {"Line", WDIS_NEW
, 0},
229 static WOptionEnumeration seSpeeds
[] = {
230 {"UltraFast", SPEED_ULTRAFAST
, 0},
231 {"Fast", SPEED_FAST
, 0},
232 {"Medium", SPEED_MEDIUM
, 0},
233 {"Slow", SPEED_SLOW
, 0},
234 {"UltraSlow", SPEED_ULTRASLOW
, 0},
238 static WOptionEnumeration seMouseButtonActions
[] = {
239 {"None", WA_NONE
, 0},
240 {"SelectWindows", WA_SELECT_WINDOWS
, 0},
241 {"OpenApplicationsMenu", WA_OPEN_APPMENU
, 0},
242 {"OpenWindowListMenu", WA_OPEN_WINLISTMENU
, 0},
243 {"MoveToPrevWorkspace", WA_MOVE_PREVWORKSPACE
, 0},
244 {"MoveToNextWorkspace", WA_MOVE_NEXTWORKSPACE
, 0},
245 {"MoveToPrevWindow", WA_MOVE_PREVWINDOW
, 0},
246 {"MoveToNextWindow", WA_MOVE_NEXTWINDOW
, 0},
250 static WOptionEnumeration seMouseWheelActions
[] = {
251 {"None", WA_NONE
, 0},
252 {"SwitchWorkspaces", WA_SWITCH_WORKSPACES
, 0},
253 {"SwitchWindows", WA_SWITCH_WINDOWS
, 0},
257 static WOptionEnumeration seIconificationStyles
[] = {
258 {"Zoom", WIS_ZOOM
, 0},
259 {"Twist", WIS_TWIST
, 0},
260 {"Flip", WIS_FLIP
, 0},
261 {"None", WIS_NONE
, 0},
262 {"random", WIS_RANDOM
, 0},
266 static WOptionEnumeration seJustifications
[] = {
267 {"Left", WTJ_LEFT
, 0},
268 {"Center", WTJ_CENTER
, 0},
269 {"Right", WTJ_RIGHT
, 0},
273 static WOptionEnumeration seIconPositions
[] = {
274 {"blv", IY_BOTTOM
| IY_LEFT
| IY_VERT
, 0},
275 {"blh", IY_BOTTOM
| IY_LEFT
| IY_HORIZ
, 0},
276 {"brv", IY_BOTTOM
| IY_RIGHT
| IY_VERT
, 0},
277 {"brh", IY_BOTTOM
| IY_RIGHT
| IY_HORIZ
, 0},
278 {"tlv", IY_TOP
| IY_LEFT
| IY_VERT
, 0},
279 {"tlh", IY_TOP
| IY_LEFT
| IY_HORIZ
, 0},
280 {"trv", IY_TOP
| IY_RIGHT
| IY_VERT
, 0},
281 {"trh", IY_TOP
| IY_RIGHT
| IY_HORIZ
, 0},
285 static WOptionEnumeration seMenuStyles
[] = {
286 {"normal", MS_NORMAL
, 0},
287 {"singletexture", MS_SINGLE_TEXTURE
, 0},
288 {"flat", MS_FLAT
, 0},
292 static WOptionEnumeration seDisplayPositions
[] = {
293 {"none", WD_NONE
, 0},
294 {"center", WD_CENTER
, 0},
296 {"bottom", WD_BOTTOM
, 0},
297 {"topleft", WD_TOPLEFT
, 0},
298 {"topright", WD_TOPRIGHT
, 0},
299 {"bottomleft", WD_BOTTOMLEFT
, 0},
300 {"bottomright", WD_BOTTOMRIGHT
, 0},
304 static WOptionEnumeration seWorkspaceBorder
[] = {
305 {"None", WB_NONE
, 0},
306 {"LeftRight", WB_LEFTRIGHT
, 0},
307 {"TopBottom", WB_TOPBOTTOM
, 0},
308 {"AllDirections", WB_ALLDIRS
, 0},
312 static WOptionEnumeration seDragMaximizedWindow
[] = {
313 {"Move", DRAGMAX_MOVE
, 0},
314 {"RestoreGeometry", DRAGMAX_RESTORE
, 0},
315 {"Unmaximize", DRAGMAX_UNMAXIMIZE
, 0},
316 {"NoMove", DRAGMAX_NOMOVE
, 0},
321 * ALL entries in the tables bellow, NEED to have a default value
322 * defined, and this value needs to be correct.
325 /* these options will only affect the window manager on startup
327 * static defaults can't access the screen data, because it is
328 * created after these defaults are read
330 WDefaultEntry staticOptionList
[] = {
332 {"ColormapSize", "4", NULL
,
333 &wPreferences
.cmap_size
, getInt
, NULL
, NULL
, NULL
},
334 {"DisableDithering", "NO", NULL
,
335 &wPreferences
.no_dithering
, getBool
, NULL
, NULL
, NULL
},
336 {"IconSize", "64", NULL
,
337 &wPreferences
.icon_size
, getInt
, NULL
, NULL
, NULL
},
338 {"ModifierKey", "Mod1", NULL
,
339 &wPreferences
.modifier_mask
, getModMask
, NULL
, NULL
, NULL
},
340 {"FocusMode", "manual", seFocusModes
, /* have a problem when switching from */
341 &wPreferences
.focus_mode
, getEnum
, NULL
, NULL
, NULL
}, /* manual to sloppy without restart */
342 {"NewStyle", "new", seTitlebarModes
,
343 &wPreferences
.new_style
, getEnum
, NULL
, NULL
, NULL
},
344 {"DisableDock", "NO", (void *)WM_DOCK
,
345 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
346 {"DisableClip", "NO", (void *)WM_CLIP
,
347 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
348 {"DisableDrawers", "NO", (void *)WM_DRAWER
,
349 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
350 {"ClipMergedInDock", "NO", NULL
,
351 NULL
, getBool
, setClipMergedInDock
, NULL
, NULL
},
352 {"DisableMiniwindows", "NO", NULL
,
353 &wPreferences
.disable_miniwindows
, getBool
, NULL
, NULL
, NULL
}
356 #define NUM2STRING_(x) #x
357 #define NUM2STRING(x) NUM2STRING_(x)
359 WDefaultEntry optionList
[] = {
361 /* dynamic options */
363 {"IconPosition", "blh", seIconPositions
,
364 &wPreferences
.icon_yard
, getEnum
, setIconPosition
, NULL
, NULL
},
365 {"IconificationStyle", "Zoom", seIconificationStyles
,
366 &wPreferences
.iconification_style
, getEnum
, NULL
, NULL
, NULL
},
367 {"DisableWSMouseActions", "NO", NULL
,
368 &wPreferences
.disable_root_mouse
, getBool
, NULL
, NULL
, NULL
},
369 {"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions
,
370 &wPreferences
.mouse_button1
, getEnum
, NULL
, NULL
, NULL
},
371 {"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions
,
372 &wPreferences
.mouse_button2
, getEnum
, NULL
, NULL
, NULL
},
373 {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions
,
374 &wPreferences
.mouse_button3
, getEnum
, NULL
, NULL
, NULL
},
375 {"MouseBackwardButtonAction", "None", seMouseButtonActions
,
376 &wPreferences
.mouse_button8
, getEnum
, NULL
, NULL
, NULL
},
377 {"MouseForwardButtonAction", "None", seMouseButtonActions
,
378 &wPreferences
.mouse_button9
, getEnum
, NULL
, NULL
, NULL
},
379 {"MouseWheelAction", "None", seMouseWheelActions
,
380 &wPreferences
.mouse_wheel_scroll
, getEnum
, NULL
, NULL
, NULL
},
381 {"MouseWheelTiltAction", "None", seMouseWheelActions
,
382 &wPreferences
.mouse_wheel_tilt
, getEnum
, NULL
, NULL
, NULL
},
383 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
384 &wPreferences
.pixmap_path
, getPathList
, NULL
, NULL
, NULL
},
385 {"IconPath", DEF_ICON_PATHS
, NULL
,
386 &wPreferences
.icon_path
, getPathList
, NULL
, NULL
, NULL
},
387 {"ColormapMode", "auto", seColormapModes
,
388 &wPreferences
.colormap_mode
, getEnum
, NULL
, NULL
, NULL
},
389 {"AutoFocus", "NO", NULL
,
390 &wPreferences
.auto_focus
, getBool
, NULL
, NULL
, NULL
},
391 {"RaiseDelay", "0", NULL
,
392 &wPreferences
.raise_delay
, getInt
, NULL
, NULL
, NULL
},
393 {"CirculateRaise", "NO", NULL
,
394 &wPreferences
.circ_raise
, getBool
, NULL
, NULL
, NULL
},
395 {"Superfluous", "NO", NULL
,
396 &wPreferences
.superfluous
, getBool
, NULL
, NULL
, NULL
},
397 {"AdvanceToNewWorkspace", "NO", NULL
,
398 &wPreferences
.ws_advance
, getBool
, NULL
, NULL
, NULL
},
399 {"CycleWorkspaces", "NO", NULL
,
400 &wPreferences
.ws_cycle
, getBool
, NULL
, NULL
, NULL
},
401 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
402 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
, NULL
, NULL
},
403 {"WorkspaceBorder", "None", seWorkspaceBorder
,
404 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
, NULL
, NULL
},
405 {"WorkspaceBorderSize", "0", NULL
,
406 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
, NULL
, NULL
},
407 {"StickyIcons", "NO", NULL
,
408 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
, NULL
, NULL
},
409 {"SaveSessionOnExit", "NO", NULL
,
410 &wPreferences
.save_session_on_exit
, getBool
, NULL
, NULL
, NULL
},
411 {"WrapMenus", "NO", NULL
,
412 &wPreferences
.wrap_menus
, getBool
, NULL
, NULL
, NULL
},
413 {"ScrollableMenus", "NO", NULL
,
414 &wPreferences
.scrollable_menus
, getBool
, NULL
, NULL
, NULL
},
415 {"MenuScrollSpeed", "medium", seSpeeds
,
416 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
, NULL
, NULL
},
417 {"IconSlideSpeed", "medium", seSpeeds
,
418 &wPreferences
.icon_slide_speed
, getEnum
, NULL
, NULL
, NULL
},
419 {"ShadeSpeed", "medium", seSpeeds
,
420 &wPreferences
.shade_speed
, getEnum
, NULL
, NULL
, NULL
},
421 {"BounceAppIconsWhenUrgent", "YES", NULL
,
422 &wPreferences
.bounce_appicons_when_urgent
, getBool
, NULL
, NULL
, NULL
},
423 {"RaiseAppIconsWhenBouncing", "NO", NULL
,
424 &wPreferences
.raise_appicons_when_bouncing
, getBool
, NULL
, NULL
, NULL
},
425 {"DoNotMakeAppIconsBounce", "NO", NULL
,
426 &wPreferences
.do_not_make_appicons_bounce
, getBool
, NULL
, NULL
, NULL
},
427 {"DoubleClickTime", "250", (void *)&wPreferences
.dblclick_time
,
428 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
, NULL
, NULL
},
429 {"ClipAutoraiseDelay", "600", NULL
,
430 &wPreferences
.clip_auto_raise_delay
, getInt
, NULL
, NULL
, NULL
},
431 {"ClipAutolowerDelay", "1000", NULL
,
432 &wPreferences
.clip_auto_lower_delay
, getInt
, NULL
, NULL
, NULL
},
433 {"ClipAutoexpandDelay", "600", NULL
,
434 &wPreferences
.clip_auto_expand_delay
, getInt
, NULL
, NULL
, NULL
},
435 {"ClipAutocollapseDelay", "1000", NULL
,
436 &wPreferences
.clip_auto_collapse_delay
, getInt
, NULL
, NULL
, NULL
},
437 {"WrapAppiconsInDock", "YES", NULL
,
438 NULL
, getBool
, setWrapAppiconsInDock
, NULL
, NULL
},
439 {"AlignSubmenus", "NO", NULL
,
440 &wPreferences
.align_menus
, getBool
, NULL
, NULL
, NULL
},
441 {"ViKeyMenus", "NO", NULL
,
442 &wPreferences
.vi_key_menus
, getBool
, NULL
, NULL
, NULL
},
443 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
444 &wPreferences
.open_transients_with_parent
, getBool
, NULL
, NULL
, NULL
},
445 {"WindowPlacement", "auto", sePlacements
,
446 &wPreferences
.window_placement
, getEnum
, NULL
, NULL
, NULL
},
447 {"IgnoreFocusClick", "NO", NULL
,
448 &wPreferences
.ignore_focus_click
, getBool
, NULL
, NULL
, NULL
},
449 {"UseSaveUnders", "NO", NULL
,
450 &wPreferences
.use_saveunders
, getBool
, NULL
, NULL
, NULL
},
451 {"OpaqueMove", "NO", NULL
,
452 &wPreferences
.opaque_move
, getBool
, NULL
, NULL
, NULL
},
453 {"OpaqueResize", "NO", NULL
,
454 &wPreferences
.opaque_resize
, getBool
, NULL
, NULL
, NULL
},
455 {"OpaqueMoveResizeKeyboard", "NO", NULL
,
456 &wPreferences
.opaque_move_resize_keyboard
, getBool
, NULL
, NULL
, NULL
},
457 {"DisableAnimations", "NO", NULL
,
458 &wPreferences
.no_animations
, getBool
, NULL
, NULL
, NULL
},
459 {"DontLinkWorkspaces", "NO", NULL
,
460 &wPreferences
.no_autowrap
, getBool
, NULL
, NULL
, NULL
},
461 {"WindowSnapping", "NO", NULL
,
462 &wPreferences
.window_snapping
, getBool
, NULL
, NULL
, NULL
},
463 {"DragMaximizedWindow", "Move", seDragMaximizedWindow
,
464 &wPreferences
.drag_maximized_window
, getEnum
, NULL
, NULL
, NULL
},
465 {"HighlightActiveApp", "YES", NULL
,
466 &wPreferences
.highlight_active_app
, getBool
, NULL
, NULL
, NULL
},
467 {"AutoArrangeIcons", "NO", NULL
,
468 &wPreferences
.auto_arrange_icons
, getBool
, NULL
, NULL
, NULL
},
469 {"NoWindowOverDock", "NO", NULL
,
470 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
, NULL
, NULL
},
471 {"NoWindowOverIcons", "NO", NULL
,
472 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
, NULL
, NULL
},
473 {"WindowPlaceOrigin", "(0, 0)", NULL
,
474 &wPreferences
.window_place_origin
, getCoord
, NULL
, NULL
, NULL
},
475 {"ResizeDisplay", "corner", seGeomDisplays
,
476 &wPreferences
.size_display
, getEnum
, NULL
, NULL
, NULL
},
477 {"MoveDisplay", "corner", seGeomDisplays
,
478 &wPreferences
.move_display
, getEnum
, NULL
, NULL
, NULL
},
479 {"DontConfirmKill", "NO", NULL
,
480 &wPreferences
.dont_confirm_kill
, getBool
, NULL
, NULL
, NULL
},
481 {"WindowTitleBalloons", "NO", NULL
,
482 &wPreferences
.window_balloon
, getBool
, NULL
, NULL
, NULL
},
483 {"MiniwindowTitleBalloons", "NO", NULL
,
484 &wPreferences
.miniwin_title_balloon
, getBool
, NULL
, NULL
, NULL
},
485 {"MiniwindowApercuBalloons", "NO", NULL
,
486 &wPreferences
.miniwin_apercu_balloon
, getBool
, NULL
, NULL
, NULL
},
487 {"AppIconBalloons", "NO", NULL
,
488 &wPreferences
.appicon_balloon
, getBool
, NULL
, NULL
, NULL
},
489 {"HelpBalloons", "NO", NULL
,
490 &wPreferences
.help_balloon
, getBool
, NULL
, NULL
, NULL
},
491 {"EdgeResistance", "30", NULL
,
492 &wPreferences
.edge_resistance
, getInt
, NULL
, NULL
, NULL
},
493 {"ResizeIncrement", "0", NULL
,
494 &wPreferences
.resize_increment
, getInt
, NULL
, NULL
, NULL
},
495 {"Attraction", "NO", NULL
,
496 &wPreferences
.attract
, getBool
, NULL
, NULL
, NULL
},
497 {"DisableBlinking", "NO", NULL
,
498 &wPreferences
.dont_blink
, getBool
, NULL
, NULL
, NULL
},
499 {"SingleClickLaunch", "NO", NULL
,
500 &wPreferences
.single_click
, getBool
, NULL
, NULL
, NULL
},
501 {"StrictWindozeCycle", "YES", NULL
,
502 &wPreferences
.strict_windoze_cycle
, getBool
, NULL
, NULL
, NULL
},
503 {"SwitchPanelOnlyOpen", "NO", NULL
,
504 &wPreferences
.panel_only_open
, getBool
, NULL
, NULL
, NULL
},
505 {"ApercuSize", "2", NULL
,
506 &wPreferences
.apercu_size
, getInt
, NULL
, NULL
, NULL
},
510 {"MenuStyle", "normal", seMenuStyles
,
511 &wPreferences
.menu_style
, getEnum
, setMenuStyle
, NULL
, NULL
},
512 {"WidgetColor", "(solid, gray)", NULL
,
513 NULL
, getTexture
, setWidgetColor
, NULL
, NULL
},
514 {"WorkspaceSpecificBack", "()", NULL
,
515 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
, NULL
, NULL
},
516 /* WorkspaceBack must come after WorkspaceSpecificBack or
517 * WorkspaceBack wont know WorkspaceSpecificBack was also
518 * specified and 2 copies of wmsetbg will be launched */
519 {"WorkspaceBack", "(solid, black)", NULL
,
520 NULL
, getWSBackground
, setWorkspaceBack
, NULL
, NULL
},
521 {"SmoothWorkspaceBack", "NO", NULL
,
522 NULL
, getBool
, NULL
, NULL
, NULL
},
523 {"IconBack", "(solid, gray)", NULL
,
524 NULL
, getTexture
, setIconTile
, NULL
, NULL
},
525 {"TitleJustify", "center", seJustifications
,
526 &wPreferences
.title_justification
, getEnum
, setJustify
, NULL
, NULL
},
527 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
528 NULL
, getFont
, setWinTitleFont
, NULL
, NULL
},
529 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
530 &wPreferences
.window_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
531 {"WindowTitleMinHeight", "0", NULL
,
532 &wPreferences
.window_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
533 {"WindowTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
534 &wPreferences
.window_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
535 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
536 &wPreferences
.menu_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
537 {"MenuTitleMinHeight", "0", NULL
,
538 &wPreferences
.menu_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
539 {"MenuTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
540 &wPreferences
.menu_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
541 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
542 &wPreferences
.menu_text_clearance
, getInt
, setClearance
, NULL
, NULL
},
543 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
544 NULL
, getFont
, setMenuTitleFont
, NULL
, NULL
},
545 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
546 NULL
, getFont
, setMenuTextFont
, NULL
, NULL
},
547 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
548 NULL
, getFont
, setIconTitleFont
, NULL
, NULL
},
549 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
550 NULL
, getFont
, setClipTitleFont
, NULL
, NULL
},
551 {"ShowClipTitle", "YES", NULL
,
552 &wPreferences
.show_clip_title
, getBool
, NULL
, NULL
, NULL
},
553 {"LargeDisplayFont", DEF_WORKSPACE_NAME_FONT
, NULL
,
554 NULL
, getFont
, setLargeDisplayFont
, NULL
, NULL
},
555 {"HighlightColor", "white", NULL
,
556 NULL
, getColor
, setHightlight
, NULL
, NULL
},
557 {"HighlightTextColor", "black", NULL
,
558 NULL
, getColor
, setHightlightText
, NULL
, NULL
},
559 {"ClipTitleColor", "black", (void *)CLIP_NORMAL
,
560 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
561 {"CClipTitleColor", "\"#454045\"", (void *)CLIP_COLLAPSED
,
562 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
563 {"FTitleColor", "white", (void *)WS_FOCUSED
,
564 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
565 {"PTitleColor", "white", (void *)WS_PFOCUSED
,
566 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
567 {"UTitleColor", "black", (void *)WS_UNFOCUSED
,
568 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
569 {"FTitleBack", "(solid, black)", NULL
,
570 NULL
, getTexture
, setFTitleBack
, NULL
, NULL
},
571 {"PTitleBack", "(solid, \"#616161\")", NULL
,
572 NULL
, getTexture
, setPTitleBack
, NULL
, NULL
},
573 {"UTitleBack", "(solid, gray)", NULL
,
574 NULL
, getTexture
, setUTitleBack
, NULL
, NULL
},
575 {"ResizebarBack", "(solid, gray)", NULL
,
576 NULL
, getTexture
, setResizebarBack
, NULL
, NULL
},
577 {"MenuTitleColor", "white", NULL
,
578 NULL
, getColor
, setMenuTitleColor
, NULL
, NULL
},
579 {"MenuTextColor", "black", NULL
,
580 NULL
, getColor
, setMenuTextColor
, NULL
, NULL
},
581 {"MenuDisabledColor", "\"#616161\"", NULL
,
582 NULL
, getColor
, setMenuDisabledColor
, NULL
, NULL
},
583 {"MenuTitleBack", "(solid, black)", NULL
,
584 NULL
, getTexture
, setMenuTitleBack
, NULL
, NULL
},
585 {"MenuTextBack", "(solid, gray)", NULL
,
586 NULL
, getTexture
, setMenuTextBack
, NULL
, NULL
},
587 {"IconTitleColor", "white", NULL
,
588 NULL
, getColor
, setIconTitleColor
, NULL
, NULL
},
589 {"IconTitleBack", "black", NULL
,
590 NULL
, getColor
, setIconTitleBack
, NULL
, NULL
},
591 {"SwitchPanelImages", "(swtile.png, swback.png, 30, 40)", &wPreferences
,
592 NULL
, getPropList
, setSwPOptions
, NULL
, NULL
},
593 {"ModifierKeyLabels", "(\"Shift+\", \"Control+\", \"Mod1+\", \"Mod2+\", \"Mod3+\", \"Mod4+\", \"Mod5+\")", &wPreferences
,
594 NULL
, getPropList
, setModifierKeyLabels
, NULL
, NULL
},
595 {"FrameBorderWidth", "1", NULL
,
596 NULL
, getInt
, setFrameBorderWidth
, NULL
, NULL
},
597 {"FrameBorderColor", "black", NULL
,
598 NULL
, getColor
, setFrameBorderColor
, NULL
, NULL
},
599 {"FrameFocusedBorderColor", "black", NULL
,
600 NULL
, getColor
, setFrameFocusedBorderColor
, NULL
, NULL
},
601 {"FrameSelectedBorderColor", "white", NULL
,
602 NULL
, getColor
, setFrameSelectedBorderColor
, NULL
, NULL
},
606 {"RootMenuKey", "None", (void *)WKBD_ROOTMENU
,
607 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
608 {"WindowListKey", "None", (void *)WKBD_WINDOWLIST
,
609 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
610 {"WindowMenuKey", "None", (void *)WKBD_WINDOWMENU
,
611 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
612 {"DockRaiseLowerKey", "None", (void*)WKBD_DOCKRAISELOWER
,
613 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
614 {"ClipRaiseLowerKey", "None", (void *)WKBD_CLIPRAISELOWER
,
615 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
616 {"MiniaturizeKey", "None", (void *)WKBD_MINIATURIZE
,
617 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
618 {"MinimizeAllKey", "None", (void *)WKBD_MINIMIZEALL
,
619 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
620 {"HideKey", "None", (void *)WKBD_HIDE
,
621 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
622 {"HideOthersKey", "None", (void *)WKBD_HIDE_OTHERS
,
623 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
624 {"MoveResizeKey", "None", (void *)WKBD_MOVERESIZE
,
625 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
626 {"CloseKey", "None", (void *)WKBD_CLOSE
,
627 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
628 {"MaximizeKey", "None", (void *)WKBD_MAXIMIZE
,
629 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
630 {"VMaximizeKey", "None", (void *)WKBD_VMAXIMIZE
,
631 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
632 {"HMaximizeKey", "None", (void *)WKBD_HMAXIMIZE
,
633 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
634 {"LHMaximizeKey", "None", (void*)WKBD_LHMAXIMIZE
,
635 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
636 {"RHMaximizeKey", "None", (void*)WKBD_RHMAXIMIZE
,
637 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
638 {"THMaximizeKey", "None", (void*)WKBD_THMAXIMIZE
,
639 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
640 {"BHMaximizeKey", "None", (void*)WKBD_BHMAXIMIZE
,
641 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
642 {"LTCMaximizeKey", "None", (void*)WKBD_LTCMAXIMIZE
,
643 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
644 {"RTCMaximizeKey", "None", (void*)WKBD_RTCMAXIMIZE
,
645 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
646 {"LBCMaximizeKey", "None", (void*)WKBD_LBCMAXIMIZE
,
647 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
648 {"RBCMaximizeKey", "None", (void*)WKBD_RBCMAXIMIZE
,
649 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
650 {"MaximusKey", "None", (void*)WKBD_MAXIMUS
,
651 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
652 {"RaiseKey", "\"Meta+Up\"", (void *)WKBD_RAISE
,
653 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
654 {"LowerKey", "\"Meta+Down\"", (void *)WKBD_LOWER
,
655 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
656 {"RaiseLowerKey", "None", (void *)WKBD_RAISELOWER
,
657 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
658 {"ShadeKey", "None", (void *)WKBD_SHADE
,
659 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
660 {"SelectKey", "None", (void *)WKBD_SELECT
,
661 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
662 {"FocusNextKey", "None", (void *)WKBD_FOCUSNEXT
,
663 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
664 {"FocusPrevKey", "None", (void *)WKBD_FOCUSPREV
,
665 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
666 {"GroupNextKey", "None", (void *)WKBD_GROUPNEXT
,
667 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
668 {"GroupPrevKey", "None", (void *)WKBD_GROUPPREV
,
669 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
670 {"NextWorkspaceKey", "None", (void *)WKBD_NEXTWORKSPACE
,
671 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
672 {"PrevWorkspaceKey", "None", (void *)WKBD_PREVWORKSPACE
,
673 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
674 {"LastWorkspaceKey", "None", (void *)WKBD_LASTWORKSPACE
,
675 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
676 {"NextWorkspaceLayerKey", "None", (void *)WKBD_NEXTWSLAYER
,
677 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
678 {"PrevWorkspaceLayerKey", "None", (void *)WKBD_PREVWSLAYER
,
679 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
680 {"Workspace1Key", "None", (void *)WKBD_WORKSPACE1
,
681 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
682 {"Workspace2Key", "None", (void *)WKBD_WORKSPACE2
,
683 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
684 {"Workspace3Key", "None", (void *)WKBD_WORKSPACE3
,
685 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
686 {"Workspace4Key", "None", (void *)WKBD_WORKSPACE4
,
687 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
688 {"Workspace5Key", "None", (void *)WKBD_WORKSPACE5
,
689 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
690 {"Workspace6Key", "None", (void *)WKBD_WORKSPACE6
,
691 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
692 {"Workspace7Key", "None", (void *)WKBD_WORKSPACE7
,
693 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
694 {"Workspace8Key", "None", (void *)WKBD_WORKSPACE8
,
695 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
696 {"Workspace9Key", "None", (void *)WKBD_WORKSPACE9
,
697 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
698 {"Workspace10Key", "None", (void *)WKBD_WORKSPACE10
,
699 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
700 {"MoveToWorkspace1Key", "None", (void *)WKBD_MOVE_WORKSPACE1
,
701 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
702 {"MoveToWorkspace2Key", "None", (void *)WKBD_MOVE_WORKSPACE2
,
703 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
704 {"MoveToWorkspace3Key", "None", (void *)WKBD_MOVE_WORKSPACE3
,
705 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
706 {"MoveToWorkspace4Key", "None", (void *)WKBD_MOVE_WORKSPACE4
,
707 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
708 {"MoveToWorkspace5Key", "None", (void *)WKBD_MOVE_WORKSPACE5
,
709 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
710 {"MoveToWorkspace6Key", "None", (void *)WKBD_MOVE_WORKSPACE6
,
711 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
712 {"MoveToWorkspace7Key", "None", (void *)WKBD_MOVE_WORKSPACE7
,
713 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
714 {"MoveToWorkspace8Key", "None", (void *)WKBD_MOVE_WORKSPACE8
,
715 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
716 {"MoveToWorkspace9Key", "None", (void *)WKBD_MOVE_WORKSPACE9
,
717 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
718 {"MoveToWorkspace10Key", "None", (void *)WKBD_MOVE_WORKSPACE10
,
719 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
720 {"MoveToNextWorkspaceKey", "None", (void *)WKBD_MOVE_NEXTWORKSPACE
,
721 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
722 {"MoveToPrevWorkspaceKey", "None", (void *)WKBD_MOVE_PREVWORKSPACE
,
723 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
724 {"MoveToLastWorkspaceKey", "None", (void *)WKBD_MOVE_LASTWORKSPACE
,
725 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
726 {"MoveToNextWorkspaceLayerKey", "None", (void *)WKBD_MOVE_NEXTWSLAYER
,
727 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
728 {"MoveToPrevWorkspaceLayerKey", "None", (void *)WKBD_MOVE_PREVWSLAYER
,
729 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
730 {"WindowShortcut1Key", "None", (void *)WKBD_WINDOW1
,
731 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
732 {"WindowShortcut2Key", "None", (void *)WKBD_WINDOW2
,
733 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
734 {"WindowShortcut3Key", "None", (void *)WKBD_WINDOW3
,
735 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
736 {"WindowShortcut4Key", "None", (void *)WKBD_WINDOW4
,
737 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
738 {"WindowShortcut5Key", "None", (void *)WKBD_WINDOW5
,
739 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
740 {"WindowShortcut6Key", "None", (void *)WKBD_WINDOW6
,
741 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
742 {"WindowShortcut7Key", "None", (void *)WKBD_WINDOW7
,
743 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
744 {"WindowShortcut8Key", "None", (void *)WKBD_WINDOW8
,
745 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
746 {"WindowShortcut9Key", "None", (void *)WKBD_WINDOW9
,
747 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
748 {"WindowShortcut10Key", "None", (void *)WKBD_WINDOW10
,
749 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
750 {"WindowRelaunchKey", "None", (void *)WKBD_RELAUNCH
,
751 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
752 {"ScreenSwitchKey", "None", (void *)WKBD_SWITCH_SCREEN
,
753 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
754 {"RunKey", "None", (void *)WKBD_RUN
,
755 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
757 #ifdef KEEP_XKB_LOCK_STATUS
758 {"ToggleKbdModeKey", "None", (void *)WKBD_TOGGLE
,
759 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
760 {"KbdModeLock", "NO", NULL
,
761 &wPreferences
.modelock
, getBool
, NULL
, NULL
, NULL
},
762 #endif /* KEEP_XKB_LOCK_STATUS */
764 {"NormalCursor", "(builtin, left_ptr)", (void *)WCUR_ROOT
,
765 NULL
, getCursor
, setCursor
, NULL
, NULL
},
766 {"ArrowCursor", "(builtin, top_left_arrow)", (void *)WCUR_ARROW
,
767 NULL
, getCursor
, setCursor
, NULL
, NULL
},
768 {"MoveCursor", "(builtin, fleur)", (void *)WCUR_MOVE
,
769 NULL
, getCursor
, setCursor
, NULL
, NULL
},
770 {"ResizeCursor", "(builtin, sizing)", (void *)WCUR_RESIZE
,
771 NULL
, getCursor
, setCursor
, NULL
, NULL
},
772 {"TopLeftResizeCursor", "(builtin, top_left_corner)", (void *)WCUR_TOPLEFTRESIZE
,
773 NULL
, getCursor
, setCursor
, NULL
, NULL
},
774 {"TopRightResizeCursor", "(builtin, top_right_corner)", (void *)WCUR_TOPRIGHTRESIZE
,
775 NULL
, getCursor
, setCursor
, NULL
, NULL
},
776 {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)", (void *)WCUR_BOTTOMLEFTRESIZE
,
777 NULL
, getCursor
, setCursor
, NULL
, NULL
},
778 {"BottomRightResizeCursor", "(builtin, bottom_right_corner)", (void *)WCUR_BOTTOMRIGHTRESIZE
,
779 NULL
, getCursor
, setCursor
, NULL
, NULL
},
780 {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)", (void *)WCUR_VERTICALRESIZE
,
781 NULL
, getCursor
, setCursor
, NULL
, NULL
},
782 {"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)", (void *)WCUR_HORIZONRESIZE
,
783 NULL
, getCursor
, setCursor
, NULL
, NULL
},
784 {"WaitCursor", "(builtin, watch)", (void *)WCUR_WAIT
,
785 NULL
, getCursor
, setCursor
, NULL
, NULL
},
786 {"QuestionCursor", "(builtin, question_arrow)", (void *)WCUR_QUESTION
,
787 NULL
, getCursor
, setCursor
, NULL
, NULL
},
788 {"TextCursor", "(builtin, xterm)", (void *)WCUR_TEXT
,
789 NULL
, getCursor
, setCursor
, NULL
, NULL
},
790 {"SelectCursor", "(builtin, cross)", (void *)WCUR_SELECT
,
791 NULL
, getCursor
, setCursor
, NULL
, NULL
},
792 {"DialogHistoryLines", "500", NULL
,
793 &wPreferences
.history_lines
, getInt
, NULL
, NULL
, NULL
},
794 {"CycleActiveHeadOnly", "NO", NULL
,
795 &wPreferences
.cycle_active_head_only
, getBool
, NULL
, NULL
, NULL
},
796 {"CycleIgnoreMinimized", "NO", NULL
,
797 &wPreferences
.cycle_ignore_minimized
, getBool
, NULL
, NULL
, NULL
}
800 static void initDefaults(void)
803 WDefaultEntry
*entry
;
805 WMPLSetCaseSensitive(False
);
807 for (i
= 0; i
< wlengthof(optionList
); i
++) {
808 entry
= &optionList
[i
];
810 entry
->plkey
= WMCreatePLString(entry
->key
);
811 if (entry
->default_value
)
812 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
814 entry
->plvalue
= NULL
;
817 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
818 entry
= &staticOptionList
[i
];
820 entry
->plkey
= WMCreatePLString(entry
->key
);
821 if (entry
->default_value
)
822 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
824 entry
->plvalue
= NULL
;
828 static WMPropList
*readGlobalDomain(const char *domainName
, Bool requireDictionary
)
830 WMPropList
*globalDict
= NULL
;
834 snprintf(path
, sizeof(path
), "%s/%s/%s", SYSCONFDIR
, GLOBAL_DEFAULTS_SUBDIR
, domainName
);
835 if (stat(path
, &stbuf
) >= 0) {
836 globalDict
= WMReadPropListFromFile(path
);
837 if (globalDict
&& requireDictionary
&& !WMIsPLDictionary(globalDict
)) {
838 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"), domainName
, path
);
839 WMReleasePropList(globalDict
);
841 } else if (!globalDict
) {
842 wwarning(_("could not load domain %s from global defaults database"), domainName
);
849 #if defined(GLOBAL_PREAMBLE_MENU_FILE) || defined(GLOBAL_EPILOGUE_MENU_FILE)
850 static void prependMenu(WMPropList
* destarr
, WMPropList
* array
)
855 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
856 item
= WMGetFromPLArray(array
, i
);
858 WMInsertInPLArray(destarr
, i
+ 1, item
);
862 static void appendMenu(WMPropList
* destarr
, WMPropList
* array
)
867 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
868 item
= WMGetFromPLArray(array
, i
);
870 WMAddToPLArray(destarr
, item
);
875 void wDefaultsMergeGlobalMenus(WDDomain
* menuDomain
)
877 WMPropList
*menu
= menuDomain
->dictionary
;
880 if (!menu
|| !WMIsPLArray(menu
))
883 #ifdef GLOBAL_PREAMBLE_MENU_FILE
884 submenu
= WMReadPropListFromFile(SYSCONFDIR
"/" GLOBAL_DEFAULTS_SUBDIR
"/" GLOBAL_PREAMBLE_MENU_FILE
);
886 if (submenu
&& !WMIsPLArray(submenu
)) {
887 wwarning(_("invalid global menu file %s"), GLOBAL_PREAMBLE_MENU_FILE
);
888 WMReleasePropList(submenu
);
892 prependMenu(menu
, submenu
);
893 WMReleasePropList(submenu
);
897 #ifdef GLOBAL_EPILOGUE_MENU_FILE
898 submenu
= WMReadPropListFromFile(SYSCONFDIR
"/" GLOBAL_DEFAULTS_SUBDIR
"/" GLOBAL_EPILOGUE_MENU_FILE
);
900 if (submenu
&& !WMIsPLArray(submenu
)) {
901 wwarning(_("invalid global menu file %s"), GLOBAL_EPILOGUE_MENU_FILE
);
902 WMReleasePropList(submenu
);
906 appendMenu(menu
, submenu
);
907 WMReleasePropList(submenu
);
911 menuDomain
->dictionary
= menu
;
914 WDDomain
*wDefaultsInitDomain(const char *domain
, Bool requireDictionary
)
918 static int inited
= 0;
919 WMPropList
*shared_dict
= NULL
;
926 db
= wmalloc(sizeof(WDDomain
));
927 db
->domain_name
= domain
;
928 db
->path
= wdefaultspathfordomain(domain
);
930 if (stat(db
->path
, &stbuf
) >= 0) {
931 db
->dictionary
= WMReadPropListFromFile(db
->path
);
932 if (db
->dictionary
) {
933 if (requireDictionary
&& !WMIsPLDictionary(db
->dictionary
)) {
934 WMReleasePropList(db
->dictionary
);
935 db
->dictionary
= NULL
;
936 wwarning(_("Domain %s (%s) of defaults database is corrupted!"), domain
, db
->path
);
938 db
->timestamp
= stbuf
.st_mtime
;
940 wwarning(_("could not load domain %s from user defaults database"), domain
);
944 /* global system dictionary */
945 shared_dict
= readGlobalDomain(domain
, requireDictionary
);
947 if (shared_dict
&& db
->dictionary
&& WMIsPLDictionary(shared_dict
) &&
948 WMIsPLDictionary(db
->dictionary
)) {
949 WMMergePLDictionaries(shared_dict
, db
->dictionary
, True
);
950 WMReleasePropList(db
->dictionary
);
951 db
->dictionary
= shared_dict
;
952 if (stbuf
.st_mtime
> db
->timestamp
)
953 db
->timestamp
= stbuf
.st_mtime
;
954 } else if (!db
->dictionary
) {
955 db
->dictionary
= shared_dict
;
956 if (stbuf
.st_mtime
> db
->timestamp
)
957 db
->timestamp
= stbuf
.st_mtime
;
963 void wReadStaticDefaults(WMPropList
* dict
)
966 WDefaultEntry
*entry
;
970 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
971 entry
= &staticOptionList
[i
];
974 plvalue
= WMGetFromPLDictionary(dict
, entry
->plkey
);
978 /* no default in the DB. Use builtin default */
980 plvalue
= entry
->plvalue
;
984 (*entry
->convert
) (NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
986 (*entry
->update
) (NULL
, entry
, tdata
, entry
->extra_data
);
991 void wDefaultsCheckDomains(void* arg
)
995 WMPropList
*shared_dict
= NULL
;
999 /* Parameter not used, but tell the compiler that it is ok */
1002 if (stat(w_global
.domain
.wmaker
->path
, &stbuf
) >= 0 && w_global
.domain
.wmaker
->timestamp
< stbuf
.st_mtime
) {
1003 w_global
.domain
.wmaker
->timestamp
= stbuf
.st_mtime
;
1005 /* Global dictionary */
1006 shared_dict
= readGlobalDomain("WindowMaker", True
);
1008 /* User dictionary */
1009 dict
= WMReadPropListFromFile(w_global
.domain
.wmaker
->path
);
1012 if (!WMIsPLDictionary(dict
)) {
1013 WMReleasePropList(dict
);
1015 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1016 "WindowMaker", w_global
.domain
.wmaker
->path
);
1019 WMMergePLDictionaries(shared_dict
, dict
, True
);
1020 WMReleasePropList(dict
);
1025 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1026 scr
= wScreenWithNumber(i
);
1028 wReadDefaults(scr
, dict
);
1031 if (w_global
.domain
.wmaker
->dictionary
)
1032 WMReleasePropList(w_global
.domain
.wmaker
->dictionary
);
1034 w_global
.domain
.wmaker
->dictionary
= dict
;
1037 wwarning(_("could not load domain %s from user defaults database"), "WindowMaker");
1041 WMReleasePropList(shared_dict
);
1045 if (stat(w_global
.domain
.window_attr
->path
, &stbuf
) >= 0 && w_global
.domain
.window_attr
->timestamp
< stbuf
.st_mtime
) {
1046 /* global dictionary */
1047 shared_dict
= readGlobalDomain("WMWindowAttributes", True
);
1048 /* user dictionary */
1049 dict
= WMReadPropListFromFile(w_global
.domain
.window_attr
->path
);
1051 if (!WMIsPLDictionary(dict
)) {
1052 WMReleasePropList(dict
);
1054 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1055 "WMWindowAttributes", w_global
.domain
.window_attr
->path
);
1058 WMMergePLDictionaries(shared_dict
, dict
, True
);
1059 WMReleasePropList(dict
);
1064 if (w_global
.domain
.window_attr
->dictionary
)
1065 WMReleasePropList(w_global
.domain
.window_attr
->dictionary
);
1067 w_global
.domain
.window_attr
->dictionary
= dict
;
1068 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1069 scr
= wScreenWithNumber(i
);
1071 wDefaultUpdateIcons(scr
);
1073 /* Update the panel image if changed */
1074 /* Don't worry. If the image is the same these
1075 * functions will have no performance impact. */
1076 create_logo_image(scr
);
1081 wwarning(_("could not load domain %s from user defaults database"), "WMWindowAttributes");
1084 w_global
.domain
.window_attr
->timestamp
= stbuf
.st_mtime
;
1086 WMReleasePropList(shared_dict
);
1089 if (stat(w_global
.domain
.root_menu
->path
, &stbuf
) >= 0 && w_global
.domain
.root_menu
->timestamp
< stbuf
.st_mtime
) {
1090 dict
= WMReadPropListFromFile(w_global
.domain
.root_menu
->path
);
1092 if (!WMIsPLArray(dict
) && !WMIsPLString(dict
)) {
1093 WMReleasePropList(dict
);
1095 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1096 "WMRootMenu", w_global
.domain
.root_menu
->path
);
1098 if (w_global
.domain
.root_menu
->dictionary
)
1099 WMReleasePropList(w_global
.domain
.root_menu
->dictionary
);
1101 w_global
.domain
.root_menu
->dictionary
= dict
;
1102 wDefaultsMergeGlobalMenus(w_global
.domain
.root_menu
);
1105 wwarning(_("could not load domain %s from user defaults database"), "WMRootMenu");
1107 w_global
.domain
.root_menu
->timestamp
= stbuf
.st_mtime
;
1109 #ifndef HAVE_INOTIFY
1111 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, arg
);
1115 void wReadDefaults(WScreen
* scr
, WMPropList
* new_dict
)
1117 WMPropList
*plvalue
, *old_value
;
1118 WDefaultEntry
*entry
;
1120 int update_workspace_back
= 0; /* kluge :/ */
1121 unsigned int needs_refresh
;
1123 WMPropList
*old_dict
= (w_global
.domain
.wmaker
->dictionary
!= new_dict
? w_global
.domain
.wmaker
->dictionary
: NULL
);
1127 for (i
= 0; i
< wlengthof(optionList
); i
++) {
1128 entry
= &optionList
[i
];
1131 plvalue
= WMGetFromPLDictionary(new_dict
, entry
->plkey
);
1138 old_value
= WMGetFromPLDictionary(old_dict
, entry
->plkey
);
1140 if (!plvalue
&& !old_value
) {
1141 /* no default in the DB. Use builtin default */
1142 plvalue
= entry
->plvalue
;
1143 if (plvalue
&& new_dict
)
1144 WMPutInPLDictionary(new_dict
, entry
->plkey
, plvalue
);
1146 } else if (!plvalue
) {
1147 /* value was deleted from DB. Keep current value */
1149 } else if (!old_value
) {
1150 /* set value for the 1st time */
1151 } else if (!WMIsPropListEqualTo(plvalue
, old_value
)) {
1152 /* value has changed */
1154 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1155 && update_workspace_back
&& scr
->flags
.backimage_helper_launched
) {
1157 /* value was not changed since last time */
1164 if ((*entry
->convert
) (scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1166 * If the WorkspaceSpecificBack data has been changed
1167 * so that the helper will be launched now, we must be
1168 * sure to send the default background texture config
1171 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0 &&
1172 !scr
->flags
.backimage_helper_launched
)
1173 update_workspace_back
= 1;
1176 needs_refresh
|= (*entry
->update
) (scr
, entry
, tdata
, entry
->extra_data
);
1182 if (needs_refresh
!= 0 && !scr
->flags
.startup
) {
1186 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1187 foo
|= WTextureSettings
;
1188 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1189 foo
|= WFontSettings
;
1190 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1191 foo
|= WColorSettings
;
1193 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1194 (void *)(uintptr_t) foo
);
1197 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1198 foo
|= WTextureSettings
;
1199 if (needs_refresh
& REFRESH_MENU_FONT
)
1200 foo
|= WFontSettings
;
1201 if (needs_refresh
& REFRESH_MENU_COLOR
)
1202 foo
|= WColorSettings
;
1204 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1207 if (needs_refresh
& REFRESH_WINDOW_FONT
)
1208 foo
|= WFontSettings
;
1209 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
)
1210 foo
|= WTextureSettings
;
1211 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
)
1212 foo
|= WColorSettings
;
1214 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1216 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1218 if (needs_refresh
& REFRESH_ICON_FONT
)
1219 foo
|= WFontSettings
;
1220 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
)
1221 foo
|= WTextureSettings
;
1222 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
)
1223 foo
|= WTextureSettings
;
1225 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1226 (void *)(uintptr_t) foo
);
1228 if (needs_refresh
& REFRESH_ICON_TILE
)
1229 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1231 if (needs_refresh
& REFRESH_WORKSPACE_MENU
) {
1232 if (w_global
.workspace
.menu
)
1233 wWorkspaceMenuUpdate(w_global
.workspace
.menu
);
1234 if (w_global
.clip
.ws_menu
)
1235 wWorkspaceMenuUpdate(w_global
.clip
.ws_menu
);
1236 if (w_global
.workspace
.submenu
)
1237 w_global
.workspace
.submenu
->flags
.realized
= 0;
1238 if (w_global
.clip
.submenu
)
1239 w_global
.clip
.submenu
->flags
.realized
= 0;
1244 void wDefaultUpdateIcons(WScreen
*scr
)
1246 WAppIcon
*aicon
= w_global
.app_icon_list
;
1248 WWindow
*wwin
= scr
->focused_window
;
1251 /* Get the application icon, default included */
1252 wIconChangeImageFile(aicon
->icon
, NULL
);
1253 wAppIconPaint(aicon
);
1254 aicon
= aicon
->next
;
1257 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
)
1260 for (dc
= scr
->drawers
; dc
!= NULL
; dc
= dc
->next
)
1261 wDrawerIconPaint(dc
->adrawer
->icon_array
[0]);
1264 if (wwin
->icon
&& wwin
->flags
.miniaturized
)
1265 wIconChangeImageFile(wwin
->icon
, NULL
);
1270 /* --------------------------- Local ----------------------- */
1272 #define GET_STRING_OR_DEFAULT(x, var) if (!WMIsPLString(value)) { \
1273 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1275 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1276 var = entry->default_value;\
1277 } else var = WMGetFromPLString(value)\
1280 static int string2index(WMPropList *key, WMPropList *val, const char *def, WOptionEnumeration * values)
1283 WOptionEnumeration
*v
;
1284 char buffer
[TOTAL_VALUES_LENGTH
];
1286 if (WMIsPLString(val
) && (str
= WMGetFromPLString(val
))) {
1287 for (v
= values
; v
->string
!= NULL
; v
++) {
1288 if (strcasecmp(v
->string
, str
) == 0)
1294 for (v
= values
; v
->string
!= NULL
; v
++) {
1297 strcat(buffer
, ", ");
1298 snprintf(buffer
+strlen(buffer
),
1299 sizeof(buffer
)-strlen(buffer
)-1, "\"%s\"", v
->string
);
1302 wwarning(_("wrong option value for key \"%s\"; got \"%s\", should be one of %s."),
1303 WMGetFromPLString(key
),
1304 WMIsPLString(val
) ? WMGetFromPLString(val
) : "(unknown)",
1308 return string2index(key
, val
, NULL
, values
);
1315 * value - is the value in the defaults DB
1316 * addr - is the address to store the data
1317 * ret - is the address to store a pointer to a temporary buffer. ret
1318 * must not be freed and is used by the set functions
1320 static int getBool(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1324 int second_pass
= 0;
1326 /* Parameter not used, but tell the compiler that it is ok */
1329 GET_STRING_OR_DEFAULT("Boolean", val
);
1332 if ((val
[1] == '\0' && (val
[0] == 'y' || val
[0] == 'Y'))
1333 || strcasecmp(val
, "YES") == 0) {
1336 } else if ((val
[1] == '\0' && (val
[0] == 'n' || val
[0] == 'N'))
1337 || strcasecmp(val
, "NO") == 0) {
1341 if (sscanf(val
, "%i", &i
) == 1) {
1347 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""), val
, entry
->key
);
1348 if (second_pass
== 0) {
1349 val
= WMGetFromPLString(entry
->plvalue
);
1351 wwarning(_("using default \"%s\" instead"), val
);
1361 *(char *)addr
= data
;
1366 static int getInt(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1371 /* Parameter not used, but tell the compiler that it is ok */
1374 GET_STRING_OR_DEFAULT("Integer", val
);
1376 if (sscanf(val
, "%i", &data
) != 1) {
1377 wwarning(_("can't convert \"%s\" to integer for key \"%s\""), val
, entry
->key
);
1378 val
= WMGetFromPLString(entry
->plvalue
);
1379 wwarning(_("using default \"%s\" instead"), val
);
1380 if (sscanf(val
, "%i", &data
) != 1) {
1388 *(int *)addr
= data
;
1393 static int getCoord(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1396 char *val_x
, *val_y
;
1397 int nelem
, changed
= 0;
1398 WMPropList
*elem_x
, *elem_y
;
1401 if (!WMIsPLArray(value
)) {
1402 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Coordinate");
1404 value
= entry
->plvalue
;
1406 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1412 nelem
= WMGetPropListItemCount(value
);
1414 wwarning(_("Incorrect number of elements in array for key \"%s\"."), entry
->key
);
1416 value
= entry
->plvalue
;
1418 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1424 elem_x
= WMGetFromPLArray(value
, 0);
1425 elem_y
= WMGetFromPLArray(value
, 1);
1427 if (!elem_x
|| !elem_y
|| !WMIsPLString(elem_x
) || !WMIsPLString(elem_y
)) {
1428 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."), entry
->key
);
1430 value
= entry
->plvalue
;
1432 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1438 val_x
= WMGetFromPLString(elem_x
);
1439 val_y
= WMGetFromPLString(elem_y
);
1441 if (sscanf(val_x
, "%i", &data
.x
) != 1 || sscanf(val_y
, "%i", &data
.y
) != 1) {
1442 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1444 value
= entry
->plvalue
;
1446 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1454 else if (data
.x
> scr
->scr_width
/ 3)
1455 data
.x
= scr
->scr_width
/ 3;
1458 else if (data
.y
> scr
->scr_height
/ 3)
1459 data
.y
= scr
->scr_height
/ 3;
1464 *(WCoord
*) addr
= data
;
1469 static int getPropList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1471 /* Parameter not used, but tell the compiler that it is ok */
1476 WMRetainPropList(value
);
1483 static int getPathList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1491 /* Parameter not used, but tell the compiler that it is ok */
1496 if (!WMIsPLArray(value
)) {
1497 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "an array of paths");
1499 value
= entry
->plvalue
;
1501 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1508 count
= WMGetPropListItemCount(value
);
1511 value
= entry
->plvalue
;
1513 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1520 for (i
= 0; i
< count
; i
++) {
1521 d
= WMGetFromPLArray(value
, i
);
1522 if (!d
|| !WMIsPLString(d
)) {
1526 len
+= strlen(WMGetFromPLString(d
)) + 1;
1529 ptr
= data
= wmalloc(len
+ 1);
1531 for (i
= 0; i
< count
; i
++) {
1532 d
= WMGetFromPLArray(value
, i
);
1533 if (!d
|| !WMIsPLString(d
)) {
1536 strcpy(ptr
, WMGetFromPLString(d
));
1537 ptr
+= strlen(WMGetFromPLString(d
));
1544 if (*(char **)addr
!= NULL
) {
1545 wfree(*(char **)addr
);
1547 *(char **)addr
= data
;
1552 static int getEnum(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1554 static signed char data
;
1556 /* Parameter not used, but tell the compiler that it is ok */
1559 data
= string2index(entry
->plkey
, value
, entry
->default_value
, (WOptionEnumeration
*) entry
->extra_data
);
1566 *(signed char *)addr
= data
;
1573 * (hgradient <color> <color>)
1574 * (vgradient <color> <color>)
1575 * (dgradient <color> <color>)
1576 * (mhgradient <color> <color> ...)
1577 * (mvgradient <color> <color> ...)
1578 * (mdgradient <color> <color> ...)
1579 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1580 * (tpixmap <file> <color>)
1581 * (spixmap <file> <color>)
1582 * (cpixmap <file> <color>)
1583 * (thgradient <file> <opaqueness> <color> <color>)
1584 * (tvgradient <file> <opaqueness> <color> <color>)
1585 * (tdgradient <file> <opaqueness> <color> <color>)
1586 * (function <lib> <function> ...)
1589 static WTexture
*parse_texture(WScreen
* scr
, WMPropList
* pl
)
1594 WTexture
*texture
= NULL
;
1596 nelem
= WMGetPropListItemCount(pl
);
1600 elem
= WMGetFromPLArray(pl
, 0);
1601 if (!elem
|| !WMIsPLString(elem
))
1603 val
= WMGetFromPLString(elem
);
1605 if (strcasecmp(val
, "solid") == 0) {
1613 elem
= WMGetFromPLArray(pl
, 1);
1614 if (!elem
|| !WMIsPLString(elem
))
1616 val
= WMGetFromPLString(elem
);
1618 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1619 wwarning(_("\"%s\" is not a valid color name"), val
);
1623 texture
= (WTexture
*) wTextureMakeSolid(scr
, &color
);
1624 } else if (strcasecmp(val
, "dgradient") == 0
1625 || strcasecmp(val
, "vgradient") == 0 || strcasecmp(val
, "hgradient") == 0) {
1626 RColor color1
, color2
;
1631 wwarning(_("bad number of arguments in gradient specification"));
1635 if (val
[0] == 'd' || val
[0] == 'D')
1636 type
= WTEX_DGRADIENT
;
1637 else if (val
[0] == 'h' || val
[0] == 'H')
1638 type
= WTEX_HGRADIENT
;
1640 type
= WTEX_VGRADIENT
;
1642 /* get from color */
1643 elem
= WMGetFromPLArray(pl
, 1);
1644 if (!elem
|| !WMIsPLString(elem
))
1646 val
= WMGetFromPLString(elem
);
1648 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1649 wwarning(_("\"%s\" is not a valid color name"), val
);
1653 color1
.red
= xcolor
.red
>> 8;
1654 color1
.green
= xcolor
.green
>> 8;
1655 color1
.blue
= xcolor
.blue
>> 8;
1658 elem
= WMGetFromPLArray(pl
, 2);
1659 if (!elem
|| !WMIsPLString(elem
)) {
1662 val
= WMGetFromPLString(elem
);
1664 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1665 wwarning(_("\"%s\" is not a valid color name"), val
);
1669 color2
.red
= xcolor
.red
>> 8;
1670 color2
.green
= xcolor
.green
>> 8;
1671 color2
.blue
= xcolor
.blue
>> 8;
1673 texture
= (WTexture
*) wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1675 } else if (strcasecmp(val
, "igradient") == 0) {
1676 RColor colors1
[2], colors2
[2];
1682 wwarning(_("bad number of arguments in gradient specification"));
1686 /* get from color */
1687 for (i
= 0; i
< 2; i
++) {
1688 elem
= WMGetFromPLArray(pl
, 1 + i
);
1689 if (!elem
|| !WMIsPLString(elem
))
1691 val
= WMGetFromPLString(elem
);
1693 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1694 wwarning(_("\"%s\" is not a valid color name"), val
);
1697 colors1
[i
].alpha
= 255;
1698 colors1
[i
].red
= xcolor
.red
>> 8;
1699 colors1
[i
].green
= xcolor
.green
>> 8;
1700 colors1
[i
].blue
= xcolor
.blue
>> 8;
1702 elem
= WMGetFromPLArray(pl
, 3);
1703 if (!elem
|| !WMIsPLString(elem
))
1705 val
= WMGetFromPLString(elem
);
1708 /* get from color */
1709 for (i
= 0; i
< 2; i
++) {
1710 elem
= WMGetFromPLArray(pl
, 4 + i
);
1711 if (!elem
|| !WMIsPLString(elem
))
1713 val
= WMGetFromPLString(elem
);
1715 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1716 wwarning(_("\"%s\" is not a valid color name"), val
);
1719 colors2
[i
].alpha
= 255;
1720 colors2
[i
].red
= xcolor
.red
>> 8;
1721 colors2
[i
].green
= xcolor
.green
>> 8;
1722 colors2
[i
].blue
= xcolor
.blue
>> 8;
1724 elem
= WMGetFromPLArray(pl
, 6);
1725 if (!elem
|| !WMIsPLString(elem
))
1727 val
= WMGetFromPLString(elem
);
1730 texture
= (WTexture
*) wTextureMakeIGradient(scr
, th1
, colors1
, th2
, colors2
);
1732 } else if (strcasecmp(val
, "mhgradient") == 0
1733 || strcasecmp(val
, "mvgradient") == 0 || strcasecmp(val
, "mdgradient") == 0) {
1740 wwarning(_("too few arguments in multicolor gradient specification"));
1744 if (val
[1] == 'h' || val
[1] == 'H')
1745 type
= WTEX_MHGRADIENT
;
1746 else if (val
[1] == 'v' || val
[1] == 'V')
1747 type
= WTEX_MVGRADIENT
;
1749 type
= WTEX_MDGRADIENT
;
1753 colors
= wmalloc(sizeof(RColor
*) * (count
+ 1));
1755 for (i
= 0; i
< count
; i
++) {
1756 elem
= WMGetFromPLArray(pl
, i
+ 1);
1757 if (!elem
|| !WMIsPLString(elem
)) {
1758 for (--i
; i
>= 0; --i
) {
1764 val
= WMGetFromPLString(elem
);
1766 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1767 wwarning(_("\"%s\" is not a valid color name"), val
);
1768 for (--i
; i
>= 0; --i
) {
1774 colors
[i
] = wmalloc(sizeof(RColor
));
1775 colors
[i
]->red
= color
.red
>> 8;
1776 colors
[i
]->green
= color
.green
>> 8;
1777 colors
[i
]->blue
= color
.blue
>> 8;
1782 texture
= (WTexture
*) wTextureMakeMGradient(scr
, type
, colors
);
1783 } else if (strcasecmp(val
, "spixmap") == 0 ||
1784 strcasecmp(val
, "cpixmap") == 0 || strcasecmp(val
, "tpixmap") == 0) {
1791 if (val
[0] == 's' || val
[0] == 'S')
1793 else if (val
[0] == 'c' || val
[0] == 'C')
1799 elem
= WMGetFromPLArray(pl
, 2);
1800 if (!elem
|| !WMIsPLString(elem
)) {
1803 val
= WMGetFromPLString(elem
);
1805 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1806 wwarning(_("\"%s\" is not a valid color name"), val
);
1811 elem
= WMGetFromPLArray(pl
, 1);
1812 if (!elem
|| !WMIsPLString(elem
))
1814 val
= WMGetFromPLString(elem
);
1816 texture
= (WTexture
*) wTextureMakePixmap(scr
, type
, val
, &color
);
1817 } else if (strcasecmp(val
, "thgradient") == 0
1818 || strcasecmp(val
, "tvgradient") == 0 || strcasecmp(val
, "tdgradient") == 0) {
1819 RColor color1
, color2
;
1824 if (val
[1] == 'h' || val
[1] == 'H')
1825 style
= WTEX_THGRADIENT
;
1826 else if (val
[1] == 'v' || val
[1] == 'V')
1827 style
= WTEX_TVGRADIENT
;
1829 style
= WTEX_TDGRADIENT
;
1832 wwarning(_("bad number of arguments in textured gradient specification"));
1836 /* get from color */
1837 elem
= WMGetFromPLArray(pl
, 3);
1838 if (!elem
|| !WMIsPLString(elem
))
1840 val
= WMGetFromPLString(elem
);
1842 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1843 wwarning(_("\"%s\" is not a valid color name"), val
);
1847 color1
.red
= xcolor
.red
>> 8;
1848 color1
.green
= xcolor
.green
>> 8;
1849 color1
.blue
= xcolor
.blue
>> 8;
1852 elem
= WMGetFromPLArray(pl
, 4);
1853 if (!elem
|| !WMIsPLString(elem
)) {
1856 val
= WMGetFromPLString(elem
);
1858 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1859 wwarning(_("\"%s\" is not a valid color name"), val
);
1863 color2
.red
= xcolor
.red
>> 8;
1864 color2
.green
= xcolor
.green
>> 8;
1865 color2
.blue
= xcolor
.blue
>> 8;
1868 elem
= WMGetFromPLArray(pl
, 2);
1869 if (!elem
|| !WMIsPLString(elem
))
1872 val
= WMGetFromPLString(elem
);
1874 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
1875 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
1880 elem
= WMGetFromPLArray(pl
, 1);
1881 if (!elem
|| !WMIsPLString(elem
))
1883 val
= WMGetFromPLString(elem
);
1885 texture
= (WTexture
*) wTextureMakeTGradient(scr
, style
, &color1
, &color2
, val
, opacity
);
1886 } else if (strcasecmp(val
, "function") == 0) {
1887 /* Leave this in to handle the unlikely case of
1888 * someone actually having function textures configured */
1889 wwarning("function texture support has been removed");
1892 wwarning(_("invalid texture type %s"), val
);
1898 static int getTexture(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1900 static WTexture
*texture
;
1904 if (!WMIsPLArray(value
)) {
1905 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Texture");
1907 value
= entry
->plvalue
;
1909 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1915 if (strcmp(entry
->key
, "WidgetColor") == 0 && !changed
) {
1918 pl
= WMGetFromPLArray(value
, 0);
1919 if (!pl
|| !WMIsPLString(pl
) || !WMGetFromPLString(pl
)
1920 || strcasecmp(WMGetFromPLString(pl
), "solid") != 0) {
1921 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1922 entry
->key
, "Solid Texture");
1924 value
= entry
->plvalue
;
1926 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1931 texture
= parse_texture(scr
, value
);
1934 wwarning(_("Error in texture specification for key \"%s\""), entry
->key
);
1936 value
= entry
->plvalue
;
1938 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1948 *(WTexture
**) addr
= texture
;
1953 static int getWSBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1960 /* Parameter not used, but tell the compiler that it is ok */
1965 if (!WMIsPLArray(value
)) {
1966 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1967 "WorkspaceBack", "Texture or None");
1969 value
= entry
->plvalue
;
1971 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1977 /* only do basic error checking and verify for None texture */
1979 nelem
= WMGetPropListItemCount(value
);
1981 elem
= WMGetFromPLArray(value
, 0);
1982 if (!elem
|| !WMIsPLString(elem
)) {
1983 wwarning(_("Wrong type for workspace background. Should be a texture type."));
1985 value
= entry
->plvalue
;
1987 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1992 val
= WMGetFromPLString(elem
);
1994 if (strcasecmp(val
, "None") == 0)
1997 *ret
= WMRetainPropList(value
);
2003 getWSSpecificBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2009 /* Parameter not used, but tell the compiler that it is ok */
2014 if (!WMIsPLArray(value
)) {
2015 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2016 "WorkspaceSpecificBack", "an array of textures");
2018 value
= entry
->plvalue
;
2020 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2026 /* only do basic error checking and verify for None texture */
2028 nelem
= WMGetPropListItemCount(value
);
2031 elem
= WMGetFromPLArray(value
, nelem
);
2032 if (!elem
|| !WMIsPLArray(elem
)) {
2033 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2039 *ret
= WMRetainPropList(value
);
2043 * Kluge to force wmsetbg helper to set the default background.
2044 * If the WorkspaceSpecificBack is changed once wmaker has started,
2045 * the WorkspaceBack won't be sent to the helper, unless the user
2046 * changes it's value too. So, we must force this by removing the
2047 * value from the defaults DB.
2049 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2050 WMPropList
*key
= WMCreatePLString("WorkspaceBack");
2052 WMRemoveFromPLDictionary(w_global
.domain
.wmaker
->dictionary
, key
);
2054 WMReleasePropList(key
);
2060 static int getFont(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2062 static WMFont
*font
;
2067 GET_STRING_OR_DEFAULT("Font", val
);
2069 font
= WMCreateFont(scr
->wmscreen
, val
);
2071 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2074 wfatal(_("could not load any usable font!!!"));
2081 /* can't assign font value outside update function */
2082 wassertrv(addr
== NULL
, True
);
2087 static int getColor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2089 static XColor color
;
2091 int second_pass
= 0;
2095 GET_STRING_OR_DEFAULT("Color", val
);
2098 if (!wGetColor(scr
, val
, &color
)) {
2099 wwarning(_("could not get color for key \"%s\""), entry
->key
);
2100 if (second_pass
== 0) {
2101 val
= WMGetFromPLString(entry
->plvalue
);
2103 wwarning(_("using default \"%s\" instead"), val
);
2112 assert(addr
== NULL
);
2115 *(unsigned long*)addr = pixel;
2121 static int getKeybind(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2123 static WShortKey shortcut
;
2127 char buf
[MAX_SHORTCUT_LENGTH
], *b
;
2129 /* Parameter not used, but tell the compiler that it is ok */
2133 GET_STRING_OR_DEFAULT("Key spec", val
);
2135 if (!val
|| strcasecmp(val
, "NONE") == 0) {
2136 shortcut
.keycode
= 0;
2137 shortcut
.modifier
= 0;
2143 wstrlcpy(buf
, val
, MAX_SHORTCUT_LENGTH
);
2148 shortcut
.modifier
= 0;
2149 while ((k
= strchr(b
, '+')) != NULL
) {
2153 mod
= wXModifierFromKey(b
);
2155 wwarning(_("%s: invalid key modifier \"%s\""), entry
->key
, b
);
2158 shortcut
.modifier
|= mod
;
2164 ksym
= XStringToKeysym(b
);
2166 if (ksym
== NoSymbol
) {
2167 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
, val
);
2171 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2172 if (shortcut
.keycode
== 0) {
2173 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2183 static int getModMask(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2188 /* Parameter not used, but tell the compiler that it is ok */
2191 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2196 mask
= wXModifierFromKey(str
);
2198 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2204 *(int *)addr
= mask
;
2212 # include <X11/cursorfont.h>
2218 #define CURSOR_ID_NONE (XC_num_glyphs)
2220 static const WCursorLookup cursor_table
[] = {
2221 {"X_cursor", XC_X_cursor
},
2222 {"arrow", XC_arrow
},
2223 {"based_arrow_down", XC_based_arrow_down
},
2224 {"based_arrow_up", XC_based_arrow_up
},
2226 {"bogosity", XC_bogosity
},
2227 {"bottom_left_corner", XC_bottom_left_corner
},
2228 {"bottom_right_corner", XC_bottom_right_corner
},
2229 {"bottom_side", XC_bottom_side
},
2230 {"bottom_tee", XC_bottom_tee
},
2231 {"box_spiral", XC_box_spiral
},
2232 {"center_ptr", XC_center_ptr
},
2233 {"circle", XC_circle
},
2234 {"clock", XC_clock
},
2235 {"coffee_mug", XC_coffee_mug
},
2236 {"cross", XC_cross
},
2237 {"cross_reverse", XC_cross_reverse
},
2238 {"crosshair", XC_crosshair
},
2239 {"diamond_cross", XC_diamond_cross
},
2241 {"dotbox", XC_dotbox
},
2242 {"double_arrow", XC_double_arrow
},
2243 {"draft_large", XC_draft_large
},
2244 {"draft_small", XC_draft_small
},
2245 {"draped_box", XC_draped_box
},
2246 {"exchange", XC_exchange
},
2247 {"fleur", XC_fleur
},
2248 {"gobbler", XC_gobbler
},
2249 {"gumby", XC_gumby
},
2250 {"hand1", XC_hand1
},
2251 {"hand2", XC_hand2
},
2252 {"heart", XC_heart
},
2254 {"iron_cross", XC_iron_cross
},
2255 {"left_ptr", XC_left_ptr
},
2256 {"left_side", XC_left_side
},
2257 {"left_tee", XC_left_tee
},
2258 {"leftbutton", XC_leftbutton
},
2259 {"ll_angle", XC_ll_angle
},
2260 {"lr_angle", XC_lr_angle
},
2262 {"middlebutton", XC_middlebutton
},
2263 {"mouse", XC_mouse
},
2264 {"pencil", XC_pencil
},
2265 {"pirate", XC_pirate
},
2267 {"question_arrow", XC_question_arrow
},
2268 {"right_ptr", XC_right_ptr
},
2269 {"right_side", XC_right_side
},
2270 {"right_tee", XC_right_tee
},
2271 {"rightbutton", XC_rightbutton
},
2272 {"rtl_logo", XC_rtl_logo
},
2273 {"sailboat", XC_sailboat
},
2274 {"sb_down_arrow", XC_sb_down_arrow
},
2275 {"sb_h_double_arrow", XC_sb_h_double_arrow
},
2276 {"sb_left_arrow", XC_sb_left_arrow
},
2277 {"sb_right_arrow", XC_sb_right_arrow
},
2278 {"sb_up_arrow", XC_sb_up_arrow
},
2279 {"sb_v_double_arrow", XC_sb_v_double_arrow
},
2280 {"shuttle", XC_shuttle
},
2281 {"sizing", XC_sizing
},
2282 {"spider", XC_spider
},
2283 {"spraycan", XC_spraycan
},
2285 {"target", XC_target
},
2286 {"tcross", XC_tcross
},
2287 {"top_left_arrow", XC_top_left_arrow
},
2288 {"top_left_corner", XC_top_left_corner
},
2289 {"top_right_corner", XC_top_right_corner
},
2290 {"top_side", XC_top_side
},
2291 {"top_tee", XC_top_tee
},
2293 {"ul_angle", XC_ul_angle
},
2294 {"umbrella", XC_umbrella
},
2295 {"ur_angle", XC_ur_angle
},
2296 {"watch", XC_watch
},
2297 {"xterm", XC_xterm
},
2298 {NULL
, CURSOR_ID_NONE
}
2301 static void check_bitmap_status(int status
, const char *filename
, Pixmap bitmap
)
2304 case BitmapOpenFailed
:
2305 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2307 case BitmapFileInvalid
:
2308 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2310 case BitmapNoMemory
:
2311 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2314 XFreePixmap(dpy
, bitmap
);
2321 * (builtin, <cursor_name>)
2322 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2324 static int parse_cursor(WScreen
* scr
, WMPropList
* pl
, Cursor
* cursor
)
2331 nelem
= WMGetPropListItemCount(pl
);
2335 elem
= WMGetFromPLArray(pl
, 0);
2336 if (!elem
|| !WMIsPLString(elem
)) {
2339 val
= WMGetFromPLString(elem
);
2341 if (strcasecmp(val
, "none") == 0) {
2344 } else if (strcasecmp(val
, "builtin") == 0) {
2346 int cursor_id
= CURSOR_ID_NONE
;
2349 wwarning(_("bad number of arguments in cursor specification"));
2352 elem
= WMGetFromPLArray(pl
, 1);
2353 if (!elem
|| !WMIsPLString(elem
)) {
2356 val
= WMGetFromPLString(elem
);
2358 for (i
= 0; cursor_table
[i
].name
!= NULL
; i
++) {
2359 if (strcasecmp(val
, cursor_table
[i
].name
) == 0) {
2360 cursor_id
= cursor_table
[i
].id
;
2364 if (CURSOR_ID_NONE
== cursor_id
) {
2365 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2367 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2370 } else if (strcasecmp(val
, "bitmap") == 0) {
2382 wwarning(_("bad number of arguments in cursor specification"));
2385 elem
= WMGetFromPLArray(pl
, 1);
2386 if (!elem
|| !WMIsPLString(elem
)) {
2389 val
= WMGetFromPLString(elem
);
2390 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2392 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2395 elem
= WMGetFromPLArray(pl
, 2);
2396 if (!elem
|| !WMIsPLString(elem
)) {
2400 val
= WMGetFromPLString(elem
);
2401 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2404 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2407 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
, &mask
, &x
, &y
);
2408 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
, &bitmap
, &x
, &y
);
2409 if ((BitmapSuccess
== bitmap_status
) && (BitmapSuccess
== mask_status
)) {
2410 fg
.pixel
= scr
->black_pixel
;
2411 bg
.pixel
= scr
->white_pixel
;
2412 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2413 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2414 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2417 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2418 check_bitmap_status(mask_status
, mask_name
, mask
);
2425 static int getCursor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2427 static Cursor cursor
;
2432 if (!WMIsPLArray(value
)) {
2433 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2434 entry
->key
, "cursor specification");
2436 value
= entry
->plvalue
;
2438 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2443 status
= parse_cursor(scr
, value
, &cursor
);
2445 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2447 value
= entry
->plvalue
;
2449 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2458 *(Cursor
*) addr
= cursor
;
2463 #undef CURSOR_ID_NONE
2465 /* ---------------- value setting functions --------------- */
2466 static int setJustify(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2468 /* Parameter not used, but tell the compiler that it is ok */
2474 return REFRESH_WINDOW_TITLE_COLOR
;
2477 static int setClearance(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2479 /* Parameter not used, but tell the compiler that it is ok */
2485 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
| REFRESH_MENU_TITLE_FONT
| REFRESH_MENU_FONT
;
2488 static int setIfDockPresent(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2491 long which
= (long) extra_data
;
2493 /* Parameter not used, but tell the compiler that it is ok */
2499 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2500 // Drawers require the dock
2501 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| wPreferences
.flags
.nodock
;
2504 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2507 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| *flag
;
2515 static int setClipMergedInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2519 /* Parameter not used, but tell the compiler that it is ok */
2524 wPreferences
.flags
.clip_merged_in_dock
= *flag
;
2525 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2529 static int setWrapAppiconsInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2533 /* Parameter not used, but tell the compiler that it is ok */
2538 wPreferences
.flags
.wrap_appicons_in_dock
= *flag
;
2542 static int setStickyIcons(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2544 /* Parameter not used, but tell the compiler that it is ok */
2549 if (w_global
.workspace
.array
) {
2550 wWorkspaceForceChange(scr
, w_global
.workspace
.current
);
2551 wArrangeIcons(scr
, False
);
2556 static int setIconTile(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2560 WTexture
** texture
= tdata
;
2563 /* Parameter not used, but tell the compiler that it is ok */
2566 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2567 wPreferences
.icon_size
, ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2568 ? WREL_ICON
: WREL_FLAT
);
2570 wwarning(_("could not render texture for icon background"));
2572 wTextureDestroy(scr
, *texture
);
2575 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2577 if (scr
->icon_tile
) {
2579 RReleaseImage(scr
->icon_tile
);
2580 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2583 scr
->icon_tile
= img
;
2585 /* put the icon in the noticeboard hint */
2586 PropSetIconTileHint(scr
, img
);
2588 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
) {
2589 if (scr
->clip_tile
) {
2590 RReleaseImage(scr
->clip_tile
);
2592 scr
->clip_tile
= wClipMakeTile(img
);
2595 if (!wPreferences
.flags
.nodrawer
) {
2596 if (scr
->drawer_tile
) {
2597 RReleaseImage(scr
->drawer_tile
);
2599 scr
->drawer_tile
= wDrawerMakeTile(scr
, img
);
2602 scr
->icon_tile_pixmap
= pixmap
;
2604 if (scr
->def_icon_rimage
) {
2605 RReleaseImage(scr
->def_icon_rimage
);
2606 scr
->def_icon_rimage
= NULL
;
2609 if (scr
->icon_back_texture
)
2610 wTextureDestroy(scr
, (WTexture
*) scr
->icon_back_texture
);
2612 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2614 /* Free the texture as nobody else will use it, nor refer to it. */
2616 wTextureDestroy(scr
, *texture
);
2618 return (reset
? REFRESH_ICON_TILE
: 0);
2621 static int setWinTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2623 WMFont
*font
= tdata
;
2625 /* Parameter not used, but tell the compiler that it is ok */
2629 if (scr
->title_font
) {
2630 WMReleaseFont(scr
->title_font
);
2632 scr
->title_font
= font
;
2634 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
;
2637 static int setMenuTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2639 WMFont
*font
= tdata
;
2641 /* Parameter not used, but tell the compiler that it is ok */
2645 if (scr
->menu_title_font
) {
2646 WMReleaseFont(scr
->menu_title_font
);
2649 scr
->menu_title_font
= font
;
2651 return REFRESH_MENU_TITLE_FONT
;
2654 static int setMenuTextFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2656 WMFont
*font
= tdata
;
2658 /* Parameter not used, but tell the compiler that it is ok */
2662 if (scr
->menu_entry_font
) {
2663 WMReleaseFont(scr
->menu_entry_font
);
2665 scr
->menu_entry_font
= font
;
2667 return REFRESH_MENU_FONT
;
2670 static int setIconTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2672 WMFont
*font
= tdata
;
2674 /* Parameter not used, but tell the compiler that it is ok */
2678 if (scr
->icon_title_font
) {
2679 WMReleaseFont(scr
->icon_title_font
);
2682 scr
->icon_title_font
= font
;
2684 return REFRESH_ICON_FONT
;
2687 static int setClipTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2689 WMFont
*font
= tdata
;
2691 /* Parameter not used, but tell the compiler that it is ok */
2695 if (scr
->clip_title_font
) {
2696 WMReleaseFont(scr
->clip_title_font
);
2699 scr
->clip_title_font
= font
;
2701 return REFRESH_ICON_FONT
;
2704 static int setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2706 WMFont
*font
= tdata
;
2708 /* Parameter not used, but tell the compiler that it is ok */
2713 if (w_global
.workspace
.font_for_name
)
2714 WMReleaseFont(w_global
.workspace
.font_for_name
);
2716 w_global
.workspace
.font_for_name
= font
;
2721 static int setHightlight(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2723 XColor
*color
= tdata
;
2725 /* Parameter not used, but tell the compiler that it is ok */
2729 if (scr
->select_color
)
2730 WMReleaseColor(scr
->select_color
);
2732 scr
->select_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2734 wFreeColor(scr
, color
->pixel
);
2736 return REFRESH_MENU_COLOR
;
2739 static int setHightlightText(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2741 XColor
*color
= tdata
;
2743 /* Parameter not used, but tell the compiler that it is ok */
2747 if (scr
->select_text_color
)
2748 WMReleaseColor(scr
->select_text_color
);
2750 scr
->select_text_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2752 wFreeColor(scr
, color
->pixel
);
2754 return REFRESH_MENU_COLOR
;
2757 static int setClipTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2759 XColor
*color
= tdata
;
2760 long widx
= (long) extra_data
;
2762 /* Parameter not used, but tell the compiler that it is ok */
2765 if (scr
->clip_title_color
[widx
])
2766 WMReleaseColor(scr
->clip_title_color
[widx
]);
2768 scr
->clip_title_color
[widx
] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2769 wFreeColor(scr
, color
->pixel
);
2771 return REFRESH_ICON_TITLE_COLOR
;
2774 static int setWTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2776 XColor
*color
= tdata
;
2777 long widx
= (long) extra_data
;
2779 /* Parameter not used, but tell the compiler that it is ok */
2782 if (scr
->window_title_color
[widx
])
2783 WMReleaseColor(scr
->window_title_color
[widx
]);
2785 scr
->window_title_color
[widx
] =
2786 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2788 wFreeColor(scr
, color
->pixel
);
2790 return REFRESH_WINDOW_TITLE_COLOR
;
2793 static int setMenuTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2795 XColor
*color
= tdata
;
2797 /* Parameter not used, but tell the compiler that it is ok */
2801 if (scr
->menu_title_color
[0])
2802 WMReleaseColor(scr
->menu_title_color
[0]);
2804 scr
->menu_title_color
[0] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2806 wFreeColor(scr
, color
->pixel
);
2808 return REFRESH_MENU_TITLE_COLOR
;
2811 static int setMenuTextColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2813 XColor
*color
= tdata
;
2815 /* Parameter not used, but tell the compiler that it is ok */
2819 if (scr
->mtext_color
)
2820 WMReleaseColor(scr
->mtext_color
);
2822 scr
->mtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2824 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2825 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2827 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2830 wFreeColor(scr
, color
->pixel
);
2832 return REFRESH_MENU_COLOR
;
2835 static int setMenuDisabledColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2837 XColor
*color
= tdata
;
2839 /* Parameter not used, but tell the compiler that it is ok */
2843 if (scr
->dtext_color
)
2844 WMReleaseColor(scr
->dtext_color
);
2846 scr
->dtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2848 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2849 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2851 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2854 wFreeColor(scr
, color
->pixel
);
2856 return REFRESH_MENU_COLOR
;
2859 static int setIconTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2861 XColor
*color
= tdata
;
2863 /* Parameter not used, but tell the compiler that it is ok */
2867 if (scr
->icon_title_color
)
2868 WMReleaseColor(scr
->icon_title_color
);
2869 scr
->icon_title_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2871 wFreeColor(scr
, color
->pixel
);
2873 return REFRESH_ICON_TITLE_COLOR
;
2876 static int setIconTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2878 XColor
*color
= tdata
;
2880 /* Parameter not used, but tell the compiler that it is ok */
2884 if (scr
->icon_title_texture
) {
2885 wTextureDestroy(scr
, (WTexture
*) scr
->icon_title_texture
);
2887 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
2889 return REFRESH_ICON_TITLE_BACK
;
2892 static int setFrameBorderWidth(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2896 /* Parameter not used, but tell the compiler that it is ok */
2900 scr
->frame_border_width
= *value
;
2902 return REFRESH_FRAME_BORDER
;
2905 static int setFrameBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2907 XColor
*color
= tdata
;
2909 /* Parameter not used, but tell the compiler that it is ok */
2913 if (scr
->frame_border_color
)
2914 WMReleaseColor(scr
->frame_border_color
);
2915 scr
->frame_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2917 wFreeColor(scr
, color
->pixel
);
2919 return REFRESH_FRAME_BORDER
;
2922 static int setFrameFocusedBorderColor(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2924 XColor
*color
= tdata
;
2926 /* Parameter not used, but tell the compiler that it is ok */
2930 if (scr
->frame_focused_border_color
)
2931 WMReleaseColor(scr
->frame_focused_border_color
);
2932 scr
->frame_focused_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2934 wFreeColor(scr
, color
->pixel
);
2936 return REFRESH_FRAME_BORDER
;
2939 static int setFrameSelectedBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2941 XColor
*color
= tdata
;
2943 /* Parameter not used, but tell the compiler that it is ok */
2947 if (scr
->frame_selected_border_color
)
2948 WMReleaseColor(scr
->frame_selected_border_color
);
2949 scr
->frame_selected_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2951 wFreeColor(scr
, color
->pixel
);
2953 return REFRESH_FRAME_BORDER
;
2956 static void trackDeadProcess(pid_t pid
, unsigned int status
, void *client_data
)
2958 WScreen
*scr
= (WScreen
*) client_data
;
2960 /* Parameter not used, but tell the compiler that it is ok */
2964 close(scr
->helper_fd
);
2966 scr
->helper_pid
= 0;
2967 scr
->flags
.backimage_helper_launched
= 0;
2970 static int setWorkspaceSpecificBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
2972 WMPropList
*value
= tdata
;
2977 /* Parameter not used, but tell the compiler that it is ok */
2981 if (scr
->flags
.backimage_helper_launched
) {
2982 if (WMGetPropListItemCount(value
) == 0) {
2983 SendHelperMessage(scr
, 'C', 0, NULL
);
2984 SendHelperMessage(scr
, 'K', 0, NULL
);
2986 WMReleasePropList(value
);
2993 if (WMGetPropListItemCount(value
) == 0)
2996 if (pipe(filedes
) < 0) {
2997 werror("pipe() failed:can't set workspace specific background image");
2999 WMReleasePropList(value
);
3005 werror("fork() failed:can't set workspace specific background image");
3006 if (close(filedes
[0]) < 0)
3007 werror("could not close pipe");
3008 if (close(filedes
[1]) < 0)
3009 werror("could not close pipe");
3011 } else if (pid
== 0) {
3014 SetupEnvironment(scr
);
3017 werror("could not close pipe");
3018 if (dup(filedes
[0]) < 0) {
3019 werror("dup() failed:can't set workspace specific background image");
3021 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3022 if (wPreferences
.smooth_workspace_back
)
3023 execlp("wmsetbg", "wmsetbg", "-helper", "-S", dither
, NULL
);
3025 execlp("wmsetbg", "wmsetbg", "-helper", dither
, NULL
);
3026 werror("could not execute wmsetbg");
3030 if (fcntl(filedes
[0], F_SETFD
, FD_CLOEXEC
) < 0) {
3031 werror("error setting close-on-exec flag");
3033 if (fcntl(filedes
[1], F_SETFD
, FD_CLOEXEC
) < 0) {
3034 werror("error setting close-on-exec flag");
3037 scr
->helper_fd
= filedes
[1];
3038 scr
->helper_pid
= pid
;
3039 scr
->flags
.backimage_helper_launched
= 1;
3041 wAddDeathHandler(pid
, trackDeadProcess
, scr
);
3043 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3048 for (i
= 0; i
< WMGetPropListItemCount(value
); i
++) {
3049 val
= WMGetFromPLArray(value
, i
);
3050 if (val
&& WMIsPLArray(val
) && WMGetPropListItemCount(val
) > 0) {
3051 str
= WMGetPropListDescription(val
, False
);
3053 SendHelperMessage(scr
, 'S', i
+ 1, str
);
3057 SendHelperMessage(scr
, 'U', i
+ 1, NULL
);
3062 WMReleasePropList(value
);
3066 static int setWorkspaceBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
3068 WMPropList
*value
= tdata
;
3070 /* Parameter not used, but tell the compiler that it is ok */
3074 if (scr
->flags
.backimage_helper_launched
) {
3077 if (WMGetPropListItemCount(value
) == 0) {
3078 SendHelperMessage(scr
, 'U', 0, NULL
);
3080 /* set the default workspace background to this one */
3081 str
= WMGetPropListDescription(value
, False
);
3083 SendHelperMessage(scr
, 'S', 0, str
);
3085 SendHelperMessage(scr
, 'C', w_global
.workspace
.current
+ 1, NULL
);
3087 SendHelperMessage(scr
, 'U', 0, NULL
);
3090 } else if (WMGetPropListItemCount(value
) > 0) {
3096 text
= WMGetPropListDescription(value
, False
);
3097 len
= strlen(text
) + 40;
3098 command
= wmalloc(len
);
3099 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3100 if (wPreferences
.smooth_workspace_back
)
3101 snprintf(command
, len
, "wmsetbg %s -S -p '%s' &", dither
, text
);
3103 snprintf(command
, len
, "wmsetbg %s -p '%s' &", dither
, text
);
3105 ExecuteShellCommand(scr
, command
);
3108 WMReleasePropList(value
);
3113 static int setWidgetColor(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
->widget_texture
) {
3122 wTextureDestroy(scr
, (WTexture
*) scr
->widget_texture
);
3124 scr
->widget_texture
= *(WTexSolid
**) texture
;
3129 static int setFTitleBack(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_FOCUSED
]) {
3138 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3140 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3142 return REFRESH_WINDOW_TEXTURES
;
3145 static int setPTitleBack(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
->window_title_texture
[WS_PFOCUSED
]) {
3154 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3156 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3158 return REFRESH_WINDOW_TEXTURES
;
3161 static int setUTitleBack(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
->window_title_texture
[WS_UNFOCUSED
]) {
3170 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3172 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3174 return REFRESH_WINDOW_TEXTURES
;
3177 static int setResizebarBack(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
->resizebar_texture
[0]) {
3186 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3188 scr
->resizebar_texture
[0] = *texture
;
3190 return REFRESH_WINDOW_TEXTURES
;
3193 static int setMenuTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3195 WTexture
**texture
= tdata
;
3197 /* Parameter not used, but tell the compiler that it is ok */
3201 if (scr
->menu_title_texture
[0]) {
3202 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3204 scr
->menu_title_texture
[0] = *texture
;
3206 return REFRESH_MENU_TITLE_TEXTURE
;
3209 static int setMenuTextBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3211 WTexture
**texture
= tdata
;
3213 /* Parameter not used, but tell the compiler that it is ok */
3217 if (scr
->menu_item_texture
) {
3218 wTextureDestroy(scr
, scr
->menu_item_texture
);
3219 wTextureDestroy(scr
, (WTexture
*) scr
->menu_item_auxtexture
);
3221 scr
->menu_item_texture
= *texture
;
3223 scr
->menu_item_auxtexture
= wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3225 return REFRESH_MENU_TEXTURE
;
3228 static int setKeyGrab(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3230 WShortKey
*shortcut
= tdata
;
3232 long widx
= (long) extra_data
;
3234 /* Parameter not used, but tell the compiler that it is ok */
3237 wKeyBindings
[widx
] = *shortcut
;
3239 wwin
= scr
->focused_window
;
3241 while (wwin
!= NULL
) {
3242 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3244 if (!WFLAGP(wwin
, no_bind_keys
)) {
3245 wWindowSetKeyGrabs(wwin
);
3250 /* do we need to update window menus? */
3251 if (widx
>= WKBD_WORKSPACE1
&& widx
<= WKBD_WORKSPACE10
)
3252 return REFRESH_WORKSPACE_MENU
;
3253 if (widx
== WKBD_LASTWORKSPACE
)
3254 return REFRESH_WORKSPACE_MENU
;
3255 if (widx
>= WKBD_MOVE_WORKSPACE1
&& widx
<= WKBD_MOVE_WORKSPACE10
)
3256 return REFRESH_WORKSPACE_MENU
;
3261 static int setIconPosition(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3263 /* Parameter not used, but tell the compiler that it is ok */
3268 wScreenUpdateUsableArea(scr
);
3269 wArrangeIcons(scr
, True
);
3274 static int updateUsableArea(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3276 /* Parameter not used, but tell the compiler that it is ok */
3281 wScreenUpdateUsableArea(scr
);
3286 static int setMenuStyle(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3288 /* Parameter not used, but tell the compiler that it is ok */
3294 return REFRESH_MENU_TEXTURE
;
3297 static RImage
*chopOffImage(RImage
* image
, int x
, int y
, int w
, int h
)
3299 RImage
*img
= RCreateImage(w
, h
, image
->format
== RRGBAFormat
);
3301 RCopyArea(img
, image
, x
, y
, w
, h
, 0, 0);
3306 static int setSwPOptions(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3308 WMPropList
*array
= tdata
;
3311 int cwidth
, cheight
;
3312 struct WPreferences
*prefs
= foo
;
3314 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) == 0) {
3315 if (prefs
->swtileImage
)
3316 RReleaseImage(prefs
->swtileImage
);
3317 prefs
->swtileImage
= NULL
;
3319 WMReleasePropList(array
);
3323 switch (WMGetPropListItemCount(array
)) {
3325 if (!WMIsPLString(WMGetFromPLArray(array
, 1))) {
3326 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3329 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 1)));
3332 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3333 WMGetFromPLString(WMGetFromPLArray(array
, 1)), entry
->key
);
3335 bgimage
= RLoadImage(scr
->rcontext
, path
, 0);
3337 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3342 cwidth
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 2)));
3343 cheight
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 3)));
3345 if (cwidth
<= 0 || cheight
<= 0 ||
3346 cwidth
>= bgimage
->width
- 2 || cheight
>= bgimage
->height
- 2)
3347 wwarning(_("Invalid split sizes for switch panel back image."));
3350 int swidth
, theight
;
3351 for (i
= 0; i
< 9; i
++) {
3352 if (prefs
->swbackImage
[i
])
3353 RReleaseImage(prefs
->swbackImage
[i
]);
3354 prefs
->swbackImage
[i
] = NULL
;
3356 swidth
= (bgimage
->width
- cwidth
) / 2;
3357 theight
= (bgimage
->height
- cheight
) / 2;
3359 prefs
->swbackImage
[0] = chopOffImage(bgimage
, 0, 0, swidth
, theight
);
3360 prefs
->swbackImage
[1] = chopOffImage(bgimage
, swidth
, 0, cwidth
, theight
);
3361 prefs
->swbackImage
[2] = chopOffImage(bgimage
, swidth
+ cwidth
, 0,
3364 prefs
->swbackImage
[3] = chopOffImage(bgimage
, 0, theight
, swidth
, cheight
);
3365 prefs
->swbackImage
[4] = chopOffImage(bgimage
, swidth
, theight
,
3367 prefs
->swbackImage
[5] = chopOffImage(bgimage
, swidth
+ cwidth
, theight
,
3370 prefs
->swbackImage
[6] = chopOffImage(bgimage
, 0, theight
+ cheight
,
3372 prefs
->swbackImage
[7] = chopOffImage(bgimage
, swidth
, theight
+ cheight
,
3374 prefs
->swbackImage
[8] =
3375 chopOffImage(bgimage
, swidth
+ cwidth
, theight
+ cheight
, swidth
,
3378 // check if anything failed
3379 for (i
= 0; i
< 9; i
++) {
3380 if (!prefs
->swbackImage
[i
]) {
3381 for (; i
>= 0; --i
) {
3382 RReleaseImage(prefs
->swbackImage
[i
]);
3383 prefs
->swbackImage
[i
] = NULL
;
3389 RReleaseImage(bgimage
);
3394 if (!WMIsPLString(WMGetFromPLArray(array
, 0))) {
3395 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3398 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 0)));
3401 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3402 WMGetFromPLString(WMGetFromPLArray(array
, 0)), entry
->key
);
3404 if (prefs
->swtileImage
)
3405 RReleaseImage(prefs
->swtileImage
);
3407 prefs
->swtileImage
= RLoadImage(scr
->rcontext
, path
, 0);
3408 if (!prefs
->swtileImage
) {
3409 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3416 wwarning(_("Invalid number of arguments for option \"%s\""), entry
->key
);
3420 WMReleasePropList(array
);
3425 static int setModifierKeyLabels(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3427 WMPropList
*array
= tdata
;
3429 struct WPreferences
*prefs
= foo
;
3431 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) != 7) {
3432 wwarning(_("Value for option \"%s\" must be an array of 7 strings"), entry
->key
);
3433 WMReleasePropList(array
);
3437 DestroyWindowMenu(scr
);
3439 for (i
= 0; i
< 7; i
++) {
3440 if (prefs
->modifier_labels
[i
])
3441 wfree(prefs
->modifier_labels
[i
]);
3443 if (WMIsPLString(WMGetFromPLArray(array
, i
))) {
3444 prefs
->modifier_labels
[i
] = wstrdup(WMGetFromPLString(WMGetFromPLArray(array
, i
)));
3446 wwarning(_("Invalid argument for option \"%s\" item %d"), entry
->key
, i
);
3447 prefs
->modifier_labels
[i
] = NULL
;
3451 WMReleasePropList(array
);
3456 static int setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3460 /* Parameter not used, but tell the compiler that it is ok */
3467 W_setconf_doubleClickDelay(*value
);
3472 static int setCursor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3474 Cursor
*cursor
= tdata
;
3475 long widx
= (long) extra_data
;
3477 /* Parameter not used, but tell the compiler that it is ok */
3480 if (wPreferences
.cursor
[widx
] != None
) {
3481 XFreeCursor(dpy
, wPreferences
.cursor
[widx
]);
3484 wPreferences
.cursor
[widx
] = *cursor
;
3486 if (widx
== WCUR_ROOT
&& *cursor
!= None
) {
3487 XDefineCursor(dpy
, scr
->root_win
, *cursor
);