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},
313 * ALL entries in the tables bellow, NEED to have a default value
314 * defined, and this value needs to be correct.
317 /* these options will only affect the window manager on startup
319 * static defaults can't access the screen data, because it is
320 * created after these defaults are read
322 WDefaultEntry staticOptionList
[] = {
324 {"ColormapSize", "4", NULL
,
325 &wPreferences
.cmap_size
, getInt
, NULL
, NULL
, NULL
},
326 {"DisableDithering", "NO", NULL
,
327 &wPreferences
.no_dithering
, getBool
, NULL
, NULL
, NULL
},
328 {"IconSize", "64", NULL
,
329 &wPreferences
.icon_size
, getInt
, NULL
, NULL
, NULL
},
330 {"ModifierKey", "Mod1", NULL
,
331 &wPreferences
.modifier_mask
, getModMask
, NULL
, NULL
, NULL
},
332 {"FocusMode", "manual", seFocusModes
, /* have a problem when switching from */
333 &wPreferences
.focus_mode
, getEnum
, NULL
, NULL
, NULL
}, /* manual to sloppy without restart */
334 {"NewStyle", "new", seTitlebarModes
,
335 &wPreferences
.new_style
, getEnum
, NULL
, NULL
, NULL
},
336 {"DisableDock", "NO", (void *)WM_DOCK
,
337 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
338 {"DisableClip", "NO", (void *)WM_CLIP
,
339 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
340 {"DisableDrawers", "NO", (void *)WM_DRAWER
,
341 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
342 {"ClipMergedInDock", "NO", NULL
,
343 NULL
, getBool
, setClipMergedInDock
, NULL
, NULL
},
344 {"DisableMiniwindows", "NO", NULL
,
345 &wPreferences
.disable_miniwindows
, getBool
, NULL
, NULL
, NULL
}
348 #define NUM2STRING_(x) #x
349 #define NUM2STRING(x) NUM2STRING_(x)
351 WDefaultEntry optionList
[] = {
353 /* dynamic options */
355 {"IconPosition", "blh", seIconPositions
,
356 &wPreferences
.icon_yard
, getEnum
, setIconPosition
, NULL
, NULL
},
357 {"IconificationStyle", "Zoom", seIconificationStyles
,
358 &wPreferences
.iconification_style
, getEnum
, NULL
, NULL
, NULL
},
359 {"DisableWSMouseActions", "NO", NULL
,
360 &wPreferences
.disable_root_mouse
, getBool
, NULL
, NULL
, NULL
},
361 {"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions
,
362 &wPreferences
.mouse_button1
, getEnum
, NULL
, NULL
, NULL
},
363 {"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions
,
364 &wPreferences
.mouse_button2
, getEnum
, NULL
, NULL
, NULL
},
365 {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions
,
366 &wPreferences
.mouse_button3
, getEnum
, NULL
, NULL
, NULL
},
367 {"MouseBackwardButtonAction", "None", seMouseButtonActions
,
368 &wPreferences
.mouse_button8
, getEnum
, NULL
, NULL
, NULL
},
369 {"MouseForwardButtonAction", "None", seMouseButtonActions
,
370 &wPreferences
.mouse_button9
, getEnum
, NULL
, NULL
, NULL
},
371 {"MouseWheelAction", "None", seMouseWheelActions
,
372 &wPreferences
.mouse_wheel_scroll
, getEnum
, NULL
, NULL
, NULL
},
373 {"MouseWheelTiltAction", "None", seMouseWheelActions
,
374 &wPreferences
.mouse_wheel_tilt
, getEnum
, NULL
, NULL
, NULL
},
375 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
376 &wPreferences
.pixmap_path
, getPathList
, NULL
, NULL
, NULL
},
377 {"IconPath", DEF_ICON_PATHS
, NULL
,
378 &wPreferences
.icon_path
, getPathList
, NULL
, NULL
, NULL
},
379 {"ColormapMode", "auto", seColormapModes
,
380 &wPreferences
.colormap_mode
, getEnum
, NULL
, NULL
, NULL
},
381 {"AutoFocus", "NO", NULL
,
382 &wPreferences
.auto_focus
, getBool
, NULL
, NULL
, NULL
},
383 {"RaiseDelay", "0", NULL
,
384 &wPreferences
.raise_delay
, getInt
, NULL
, NULL
, NULL
},
385 {"CirculateRaise", "NO", NULL
,
386 &wPreferences
.circ_raise
, getBool
, NULL
, NULL
, NULL
},
387 {"Superfluous", "NO", NULL
,
388 &wPreferences
.superfluous
, getBool
, NULL
, NULL
, NULL
},
389 {"AdvanceToNewWorkspace", "NO", NULL
,
390 &wPreferences
.ws_advance
, getBool
, NULL
, NULL
, NULL
},
391 {"CycleWorkspaces", "NO", NULL
,
392 &wPreferences
.ws_cycle
, getBool
, NULL
, NULL
, NULL
},
393 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
394 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
, NULL
, NULL
},
395 {"WorkspaceBorder", "None", seWorkspaceBorder
,
396 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
, NULL
, NULL
},
397 {"WorkspaceBorderSize", "0", NULL
,
398 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
, NULL
, NULL
},
399 {"StickyIcons", "NO", NULL
,
400 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
, NULL
, NULL
},
401 {"SaveSessionOnExit", "NO", NULL
,
402 &wPreferences
.save_session_on_exit
, getBool
, NULL
, NULL
, NULL
},
403 {"WrapMenus", "NO", NULL
,
404 &wPreferences
.wrap_menus
, getBool
, NULL
, NULL
, NULL
},
405 {"ScrollableMenus", "NO", NULL
,
406 &wPreferences
.scrollable_menus
, getBool
, NULL
, NULL
, NULL
},
407 {"MenuScrollSpeed", "medium", seSpeeds
,
408 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
, NULL
, NULL
},
409 {"IconSlideSpeed", "medium", seSpeeds
,
410 &wPreferences
.icon_slide_speed
, getEnum
, NULL
, NULL
, NULL
},
411 {"ShadeSpeed", "medium", seSpeeds
,
412 &wPreferences
.shade_speed
, getEnum
, NULL
, NULL
, NULL
},
413 {"BounceAppIconsWhenUrgent", "YES", NULL
,
414 &wPreferences
.bounce_appicons_when_urgent
, getBool
, NULL
, NULL
, NULL
},
415 {"RaiseAppIconsWhenBouncing", "NO", NULL
,
416 &wPreferences
.raise_appicons_when_bouncing
, getBool
, NULL
, NULL
, NULL
},
417 {"DoNotMakeAppIconsBounce", "NO", NULL
,
418 &wPreferences
.do_not_make_appicons_bounce
, getBool
, NULL
, NULL
, NULL
},
419 {"DoubleClickTime", "250", (void *)&wPreferences
.dblclick_time
,
420 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
, NULL
, NULL
},
421 {"ClipAutoraiseDelay", "600", NULL
,
422 &wPreferences
.clip_auto_raise_delay
, getInt
, NULL
, NULL
, NULL
},
423 {"ClipAutolowerDelay", "1000", NULL
,
424 &wPreferences
.clip_auto_lower_delay
, getInt
, NULL
, NULL
, NULL
},
425 {"ClipAutoexpandDelay", "600", NULL
,
426 &wPreferences
.clip_auto_expand_delay
, getInt
, NULL
, NULL
, NULL
},
427 {"ClipAutocollapseDelay", "1000", NULL
,
428 &wPreferences
.clip_auto_collapse_delay
, getInt
, NULL
, NULL
, NULL
},
429 {"WrapAppiconsInDock", "YES", NULL
,
430 NULL
, getBool
, setWrapAppiconsInDock
, NULL
, NULL
},
431 {"AlignSubmenus", "NO", NULL
,
432 &wPreferences
.align_menus
, getBool
, NULL
, NULL
, NULL
},
433 {"ViKeyMenus", "NO", NULL
,
434 &wPreferences
.vi_key_menus
, getBool
, NULL
, NULL
, NULL
},
435 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
436 &wPreferences
.open_transients_with_parent
, getBool
, NULL
, NULL
, NULL
},
437 {"WindowPlacement", "auto", sePlacements
,
438 &wPreferences
.window_placement
, getEnum
, NULL
, NULL
, NULL
},
439 {"IgnoreFocusClick", "NO", NULL
,
440 &wPreferences
.ignore_focus_click
, getBool
, NULL
, NULL
, NULL
},
441 {"UseSaveUnders", "NO", NULL
,
442 &wPreferences
.use_saveunders
, getBool
, NULL
, NULL
, NULL
},
443 {"OpaqueMove", "NO", NULL
,
444 &wPreferences
.opaque_move
, getBool
, NULL
, NULL
, NULL
},
445 {"OpaqueResize", "NO", NULL
,
446 &wPreferences
.opaque_resize
, getBool
, NULL
, NULL
, NULL
},
447 {"OpaqueMoveResizeKeyboard", "NO", NULL
,
448 &wPreferences
.opaque_move_resize_keyboard
, getBool
, NULL
, NULL
, NULL
},
449 {"DisableAnimations", "NO", NULL
,
450 &wPreferences
.no_animations
, getBool
, NULL
, NULL
, NULL
},
451 {"DontLinkWorkspaces", "NO", NULL
,
452 &wPreferences
.no_autowrap
, getBool
, NULL
, NULL
, NULL
},
453 {"HighlightActiveApp", "YES", NULL
,
454 &wPreferences
.highlight_active_app
, getBool
, NULL
, NULL
, NULL
},
455 {"AutoArrangeIcons", "NO", NULL
,
456 &wPreferences
.auto_arrange_icons
, getBool
, NULL
, NULL
, NULL
},
457 {"NoWindowOverDock", "NO", NULL
,
458 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
, NULL
, NULL
},
459 {"NoWindowOverIcons", "NO", NULL
,
460 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
, NULL
, NULL
},
461 {"WindowPlaceOrigin", "(0, 0)", NULL
,
462 &wPreferences
.window_place_origin
, getCoord
, NULL
, NULL
, NULL
},
463 {"ResizeDisplay", "corner", seGeomDisplays
,
464 &wPreferences
.size_display
, getEnum
, NULL
, NULL
, NULL
},
465 {"MoveDisplay", "corner", seGeomDisplays
,
466 &wPreferences
.move_display
, getEnum
, NULL
, NULL
, NULL
},
467 {"DontConfirmKill", "NO", NULL
,
468 &wPreferences
.dont_confirm_kill
, getBool
, NULL
, NULL
, NULL
},
469 {"WindowTitleBalloons", "NO", NULL
,
470 &wPreferences
.window_balloon
, getBool
, NULL
, NULL
, NULL
},
471 {"MiniwindowTitleBalloons", "NO", NULL
,
472 &wPreferences
.miniwin_title_balloon
, getBool
, NULL
, NULL
, NULL
},
473 {"MiniwindowApercuBalloons", "NO", NULL
,
474 &wPreferences
.miniwin_apercu_balloon
, getBool
, NULL
, NULL
, NULL
},
475 {"AppIconBalloons", "NO", NULL
,
476 &wPreferences
.appicon_balloon
, getBool
, NULL
, NULL
, NULL
},
477 {"HelpBalloons", "NO", NULL
,
478 &wPreferences
.help_balloon
, getBool
, NULL
, NULL
, NULL
},
479 {"EdgeResistance", "30", NULL
,
480 &wPreferences
.edge_resistance
, getInt
, NULL
, NULL
, NULL
},
481 {"ResizeIncrement", "0", NULL
,
482 &wPreferences
.resize_increment
, getInt
, NULL
, NULL
, NULL
},
483 {"Attraction", "NO", NULL
,
484 &wPreferences
.attract
, getBool
, NULL
, NULL
, NULL
},
485 {"DisableBlinking", "NO", NULL
,
486 &wPreferences
.dont_blink
, getBool
, NULL
, NULL
, NULL
},
487 {"SingleClickLaunch", "NO", NULL
,
488 &wPreferences
.single_click
, getBool
, NULL
, NULL
, NULL
},
489 {"StrictWindozeCycle", "YES", NULL
,
490 &wPreferences
.strict_windoze_cycle
, getBool
, NULL
, NULL
, NULL
},
491 {"SwitchPanelOnlyOpen", "NO", NULL
,
492 &wPreferences
.panel_only_open
, getBool
, NULL
, NULL
, NULL
},
493 {"ApercuSize", "2", NULL
,
494 &wPreferences
.apercu_size
, getInt
, NULL
, NULL
, NULL
},
498 {"MenuStyle", "normal", seMenuStyles
,
499 &wPreferences
.menu_style
, getEnum
, setMenuStyle
, NULL
, NULL
},
500 {"WidgetColor", "(solid, gray)", NULL
,
501 NULL
, getTexture
, setWidgetColor
, NULL
, NULL
},
502 {"WorkspaceSpecificBack", "()", NULL
,
503 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
, NULL
, NULL
},
504 /* WorkspaceBack must come after WorkspaceSpecificBack or
505 * WorkspaceBack wont know WorkspaceSpecificBack was also
506 * specified and 2 copies of wmsetbg will be launched */
507 {"WorkspaceBack", "(solid, black)", NULL
,
508 NULL
, getWSBackground
, setWorkspaceBack
, NULL
, NULL
},
509 {"SmoothWorkspaceBack", "NO", NULL
,
510 NULL
, getBool
, NULL
, NULL
, NULL
},
511 {"IconBack", "(solid, gray)", NULL
,
512 NULL
, getTexture
, setIconTile
, NULL
, NULL
},
513 {"TitleJustify", "center", seJustifications
,
514 &wPreferences
.title_justification
, getEnum
, setJustify
, NULL
, NULL
},
515 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
516 NULL
, getFont
, setWinTitleFont
, NULL
, NULL
},
517 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
518 &wPreferences
.window_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
519 {"WindowTitleMinHeight", "0", NULL
,
520 &wPreferences
.window_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
521 {"WindowTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
522 &wPreferences
.window_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
523 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
524 &wPreferences
.menu_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
525 {"MenuTitleMinHeight", "0", NULL
,
526 &wPreferences
.menu_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
527 {"MenuTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
528 &wPreferences
.menu_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
529 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
530 &wPreferences
.menu_text_clearance
, getInt
, setClearance
, NULL
, NULL
},
531 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
532 NULL
, getFont
, setMenuTitleFont
, NULL
, NULL
},
533 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
534 NULL
, getFont
, setMenuTextFont
, NULL
, NULL
},
535 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
536 NULL
, getFont
, setIconTitleFont
, NULL
, NULL
},
537 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
538 NULL
, getFont
, setClipTitleFont
, NULL
, NULL
},
539 {"ShowClipTitle", "YES", NULL
,
540 &wPreferences
.show_clip_title
, getBool
, NULL
, NULL
, NULL
},
541 {"LargeDisplayFont", DEF_WORKSPACE_NAME_FONT
, NULL
,
542 NULL
, getFont
, setLargeDisplayFont
, NULL
, NULL
},
543 {"HighlightColor", "white", NULL
,
544 NULL
, getColor
, setHightlight
, NULL
, NULL
},
545 {"HighlightTextColor", "black", NULL
,
546 NULL
, getColor
, setHightlightText
, NULL
, NULL
},
547 {"ClipTitleColor", "black", (void *)CLIP_NORMAL
,
548 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
549 {"CClipTitleColor", "\"#454045\"", (void *)CLIP_COLLAPSED
,
550 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
551 {"FTitleColor", "white", (void *)WS_FOCUSED
,
552 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
553 {"PTitleColor", "white", (void *)WS_PFOCUSED
,
554 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
555 {"UTitleColor", "black", (void *)WS_UNFOCUSED
,
556 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
557 {"FTitleBack", "(solid, black)", NULL
,
558 NULL
, getTexture
, setFTitleBack
, NULL
, NULL
},
559 {"PTitleBack", "(solid, \"#616161\")", NULL
,
560 NULL
, getTexture
, setPTitleBack
, NULL
, NULL
},
561 {"UTitleBack", "(solid, gray)", NULL
,
562 NULL
, getTexture
, setUTitleBack
, NULL
, NULL
},
563 {"ResizebarBack", "(solid, gray)", NULL
,
564 NULL
, getTexture
, setResizebarBack
, NULL
, NULL
},
565 {"MenuTitleColor", "white", NULL
,
566 NULL
, getColor
, setMenuTitleColor
, NULL
, NULL
},
567 {"MenuTextColor", "black", NULL
,
568 NULL
, getColor
, setMenuTextColor
, NULL
, NULL
},
569 {"MenuDisabledColor", "\"#616161\"", NULL
,
570 NULL
, getColor
, setMenuDisabledColor
, NULL
, NULL
},
571 {"MenuTitleBack", "(solid, black)", NULL
,
572 NULL
, getTexture
, setMenuTitleBack
, NULL
, NULL
},
573 {"MenuTextBack", "(solid, gray)", NULL
,
574 NULL
, getTexture
, setMenuTextBack
, NULL
, NULL
},
575 {"IconTitleColor", "white", NULL
,
576 NULL
, getColor
, setIconTitleColor
, NULL
, NULL
},
577 {"IconTitleBack", "black", NULL
,
578 NULL
, getColor
, setIconTitleBack
, NULL
, NULL
},
579 {"SwitchPanelImages", "(swtile.png, swback.png, 30, 40)", &wPreferences
,
580 NULL
, getPropList
, setSwPOptions
, NULL
, NULL
},
581 {"ModifierKeyLabels", "(\"Shift+\", \"Control+\", \"Mod1+\", \"Mod2+\", \"Mod3+\", \"Mod4+\", \"Mod5+\")", &wPreferences
,
582 NULL
, getPropList
, setModifierKeyLabels
, NULL
, NULL
},
583 {"FrameBorderWidth", "1", NULL
,
584 NULL
, getInt
, setFrameBorderWidth
, NULL
, NULL
},
585 {"FrameBorderColor", "black", NULL
,
586 NULL
, getColor
, setFrameBorderColor
, NULL
, NULL
},
587 {"FrameFocusedBorderColor", "black", NULL
,
588 NULL
, getColor
, setFrameFocusedBorderColor
, NULL
, NULL
},
589 {"FrameSelectedBorderColor", "white", NULL
,
590 NULL
, getColor
, setFrameSelectedBorderColor
, NULL
, NULL
},
594 {"RootMenuKey", "None", (void *)WKBD_ROOTMENU
,
595 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
596 {"WindowListKey", "None", (void *)WKBD_WINDOWLIST
,
597 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
598 {"WindowMenuKey", "None", (void *)WKBD_WINDOWMENU
,
599 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
600 {"DockRaiseLowerKey", "None", (void*)WKBD_DOCKRAISELOWER
,
601 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
602 {"ClipRaiseLowerKey", "None", (void *)WKBD_CLIPRAISELOWER
,
603 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
604 {"MiniaturizeKey", "None", (void *)WKBD_MINIATURIZE
,
605 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
606 {"MinimizeAllKey", "None", (void *)WKBD_MINIMIZEALL
,
607 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
608 {"HideKey", "None", (void *)WKBD_HIDE
,
609 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
610 {"HideOthersKey", "None", (void *)WKBD_HIDE_OTHERS
,
611 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
612 {"MoveResizeKey", "None", (void *)WKBD_MOVERESIZE
,
613 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
614 {"CloseKey", "None", (void *)WKBD_CLOSE
,
615 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
616 {"MaximizeKey", "None", (void *)WKBD_MAXIMIZE
,
617 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
618 {"VMaximizeKey", "None", (void *)WKBD_VMAXIMIZE
,
619 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
620 {"HMaximizeKey", "None", (void *)WKBD_HMAXIMIZE
,
621 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
622 {"LHMaximizeKey", "None", (void*)WKBD_LHMAXIMIZE
,
623 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
624 {"RHMaximizeKey", "None", (void*)WKBD_RHMAXIMIZE
,
625 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
626 {"THMaximizeKey", "None", (void*)WKBD_THMAXIMIZE
,
627 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
628 {"BHMaximizeKey", "None", (void*)WKBD_BHMAXIMIZE
,
629 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
630 {"LTCMaximizeKey", "None", (void*)WKBD_LTCMAXIMIZE
,
631 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
632 {"RTCMaximizeKey", "None", (void*)WKBD_RTCMAXIMIZE
,
633 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
634 {"LBCMaximizeKey", "None", (void*)WKBD_LBCMAXIMIZE
,
635 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
636 {"RBCMaximizeKey", "None", (void*)WKBD_RBCMAXIMIZE
,
637 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
638 {"MaximusKey", "None", (void*)WKBD_MAXIMUS
,
639 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
640 {"RaiseKey", "\"Meta+Up\"", (void *)WKBD_RAISE
,
641 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
642 {"LowerKey", "\"Meta+Down\"", (void *)WKBD_LOWER
,
643 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
644 {"RaiseLowerKey", "None", (void *)WKBD_RAISELOWER
,
645 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
646 {"ShadeKey", "None", (void *)WKBD_SHADE
,
647 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
648 {"SelectKey", "None", (void *)WKBD_SELECT
,
649 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
650 {"FocusNextKey", "None", (void *)WKBD_FOCUSNEXT
,
651 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
652 {"FocusPrevKey", "None", (void *)WKBD_FOCUSPREV
,
653 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
654 {"GroupNextKey", "None", (void *)WKBD_GROUPNEXT
,
655 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
656 {"GroupPrevKey", "None", (void *)WKBD_GROUPPREV
,
657 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
658 {"NextWorkspaceKey", "None", (void *)WKBD_NEXTWORKSPACE
,
659 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
660 {"PrevWorkspaceKey", "None", (void *)WKBD_PREVWORKSPACE
,
661 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
662 {"LastWorkspaceKey", "None", (void *)WKBD_LASTWORKSPACE
,
663 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
664 {"NextWorkspaceLayerKey", "None", (void *)WKBD_NEXTWSLAYER
,
665 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
666 {"PrevWorkspaceLayerKey", "None", (void *)WKBD_PREVWSLAYER
,
667 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
668 {"Workspace1Key", "None", (void *)WKBD_WORKSPACE1
,
669 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
670 {"Workspace2Key", "None", (void *)WKBD_WORKSPACE2
,
671 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
672 {"Workspace3Key", "None", (void *)WKBD_WORKSPACE3
,
673 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
674 {"Workspace4Key", "None", (void *)WKBD_WORKSPACE4
,
675 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
676 {"Workspace5Key", "None", (void *)WKBD_WORKSPACE5
,
677 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
678 {"Workspace6Key", "None", (void *)WKBD_WORKSPACE6
,
679 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
680 {"Workspace7Key", "None", (void *)WKBD_WORKSPACE7
,
681 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
682 {"Workspace8Key", "None", (void *)WKBD_WORKSPACE8
,
683 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
684 {"Workspace9Key", "None", (void *)WKBD_WORKSPACE9
,
685 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
686 {"Workspace10Key", "None", (void *)WKBD_WORKSPACE10
,
687 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
688 {"MoveToWorkspace1Key", "None", (void *)WKBD_MOVE_WORKSPACE1
,
689 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
690 {"MoveToWorkspace2Key", "None", (void *)WKBD_MOVE_WORKSPACE2
,
691 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
692 {"MoveToWorkspace3Key", "None", (void *)WKBD_MOVE_WORKSPACE3
,
693 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
694 {"MoveToWorkspace4Key", "None", (void *)WKBD_MOVE_WORKSPACE4
,
695 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
696 {"MoveToWorkspace5Key", "None", (void *)WKBD_MOVE_WORKSPACE5
,
697 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
698 {"MoveToWorkspace6Key", "None", (void *)WKBD_MOVE_WORKSPACE6
,
699 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
700 {"MoveToWorkspace7Key", "None", (void *)WKBD_MOVE_WORKSPACE7
,
701 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
702 {"MoveToWorkspace8Key", "None", (void *)WKBD_MOVE_WORKSPACE8
,
703 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
704 {"MoveToWorkspace9Key", "None", (void *)WKBD_MOVE_WORKSPACE9
,
705 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
706 {"MoveToWorkspace10Key", "None", (void *)WKBD_MOVE_WORKSPACE10
,
707 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
708 {"MoveToNextWorkspaceKey", "None", (void *)WKBD_MOVE_NEXTWORKSPACE
,
709 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
710 {"MoveToPrevWorkspaceKey", "None", (void *)WKBD_MOVE_PREVWORKSPACE
,
711 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
712 {"MoveToLastWorkspaceKey", "None", (void *)WKBD_MOVE_LASTWORKSPACE
,
713 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
714 {"MoveToNextWorkspaceLayerKey", "None", (void *)WKBD_MOVE_NEXTWSLAYER
,
715 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
716 {"MoveToPrevWorkspaceLayerKey", "None", (void *)WKBD_MOVE_PREVWSLAYER
,
717 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
718 {"WindowShortcut1Key", "None", (void *)WKBD_WINDOW1
,
719 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
720 {"WindowShortcut2Key", "None", (void *)WKBD_WINDOW2
,
721 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
722 {"WindowShortcut3Key", "None", (void *)WKBD_WINDOW3
,
723 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
724 {"WindowShortcut4Key", "None", (void *)WKBD_WINDOW4
,
725 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
726 {"WindowShortcut5Key", "None", (void *)WKBD_WINDOW5
,
727 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
728 {"WindowShortcut6Key", "None", (void *)WKBD_WINDOW6
,
729 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
730 {"WindowShortcut7Key", "None", (void *)WKBD_WINDOW7
,
731 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
732 {"WindowShortcut8Key", "None", (void *)WKBD_WINDOW8
,
733 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
734 {"WindowShortcut9Key", "None", (void *)WKBD_WINDOW9
,
735 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
736 {"WindowShortcut10Key", "None", (void *)WKBD_WINDOW10
,
737 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
738 {"WindowRelaunchKey", "None", (void *)WKBD_RELAUNCH
,
739 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
740 {"ScreenSwitchKey", "None", (void *)WKBD_SWITCH_SCREEN
,
741 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
742 {"RunKey", "None", (void *)WKBD_RUN
,
743 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
745 #ifdef KEEP_XKB_LOCK_STATUS
746 {"ToggleKbdModeKey", "None", (void *)WKBD_TOGGLE
,
747 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
748 {"KbdModeLock", "NO", NULL
,
749 &wPreferences
.modelock
, getBool
, NULL
, NULL
, NULL
},
750 #endif /* KEEP_XKB_LOCK_STATUS */
752 {"NormalCursor", "(builtin, left_ptr)", (void *)WCUR_ROOT
,
753 NULL
, getCursor
, setCursor
, NULL
, NULL
},
754 {"ArrowCursor", "(builtin, top_left_arrow)", (void *)WCUR_ARROW
,
755 NULL
, getCursor
, setCursor
, NULL
, NULL
},
756 {"MoveCursor", "(builtin, fleur)", (void *)WCUR_MOVE
,
757 NULL
, getCursor
, setCursor
, NULL
, NULL
},
758 {"ResizeCursor", "(builtin, sizing)", (void *)WCUR_RESIZE
,
759 NULL
, getCursor
, setCursor
, NULL
, NULL
},
760 {"TopLeftResizeCursor", "(builtin, top_left_corner)", (void *)WCUR_TOPLEFTRESIZE
,
761 NULL
, getCursor
, setCursor
, NULL
, NULL
},
762 {"TopRightResizeCursor", "(builtin, top_right_corner)", (void *)WCUR_TOPRIGHTRESIZE
,
763 NULL
, getCursor
, setCursor
, NULL
, NULL
},
764 {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)", (void *)WCUR_BOTTOMLEFTRESIZE
,
765 NULL
, getCursor
, setCursor
, NULL
, NULL
},
766 {"BottomRightResizeCursor", "(builtin, bottom_right_corner)", (void *)WCUR_BOTTOMRIGHTRESIZE
,
767 NULL
, getCursor
, setCursor
, NULL
, NULL
},
768 {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)", (void *)WCUR_VERTICALRESIZE
,
769 NULL
, getCursor
, setCursor
, NULL
, NULL
},
770 {"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)", (void *)WCUR_HORIZONRESIZE
,
771 NULL
, getCursor
, setCursor
, NULL
, NULL
},
772 {"WaitCursor", "(builtin, watch)", (void *)WCUR_WAIT
,
773 NULL
, getCursor
, setCursor
, NULL
, NULL
},
774 {"QuestionCursor", "(builtin, question_arrow)", (void *)WCUR_QUESTION
,
775 NULL
, getCursor
, setCursor
, NULL
, NULL
},
776 {"TextCursor", "(builtin, xterm)", (void *)WCUR_TEXT
,
777 NULL
, getCursor
, setCursor
, NULL
, NULL
},
778 {"SelectCursor", "(builtin, cross)", (void *)WCUR_SELECT
,
779 NULL
, getCursor
, setCursor
, NULL
, NULL
},
780 {"DialogHistoryLines", "500", NULL
,
781 &wPreferences
.history_lines
, getInt
, NULL
, NULL
, NULL
},
782 {"CycleActiveHeadOnly", "NO", NULL
,
783 &wPreferences
.cycle_active_head_only
, getBool
, NULL
, NULL
, NULL
},
784 {"CycleIgnoreMinimized", "NO", NULL
,
785 &wPreferences
.cycle_ignore_minimized
, getBool
, NULL
, NULL
, NULL
}
788 static void initDefaults(void)
791 WDefaultEntry
*entry
;
793 WMPLSetCaseSensitive(False
);
795 for (i
= 0; i
< wlengthof(optionList
); i
++) {
796 entry
= &optionList
[i
];
798 entry
->plkey
= WMCreatePLString(entry
->key
);
799 if (entry
->default_value
)
800 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
802 entry
->plvalue
= NULL
;
805 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
806 entry
= &staticOptionList
[i
];
808 entry
->plkey
= WMCreatePLString(entry
->key
);
809 if (entry
->default_value
)
810 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
812 entry
->plvalue
= NULL
;
816 static WMPropList
*readGlobalDomain(const char *domainName
, Bool requireDictionary
)
818 WMPropList
*globalDict
= NULL
;
822 snprintf(path
, sizeof(path
), "%s/%s/%s", SYSCONFDIR
, GLOBAL_DEFAULTS_SUBDIR
, domainName
);
823 if (stat(path
, &stbuf
) >= 0) {
824 globalDict
= WMReadPropListFromFile(path
);
825 if (globalDict
&& requireDictionary
&& !WMIsPLDictionary(globalDict
)) {
826 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"), domainName
, path
);
827 WMReleasePropList(globalDict
);
829 } else if (!globalDict
) {
830 wwarning(_("could not load domain %s from global defaults database"), domainName
);
837 #if defined(GLOBAL_PREAMBLE_MENU_FILE) || defined(GLOBAL_EPILOGUE_MENU_FILE)
838 static void prependMenu(WMPropList
* destarr
, WMPropList
* array
)
843 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
844 item
= WMGetFromPLArray(array
, i
);
846 WMInsertInPLArray(destarr
, i
+ 1, item
);
850 static void appendMenu(WMPropList
* destarr
, WMPropList
* array
)
855 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
856 item
= WMGetFromPLArray(array
, i
);
858 WMAddToPLArray(destarr
, item
);
863 void wDefaultsMergeGlobalMenus(WDDomain
* menuDomain
)
865 WMPropList
*menu
= menuDomain
->dictionary
;
868 if (!menu
|| !WMIsPLArray(menu
))
871 #ifdef GLOBAL_PREAMBLE_MENU_FILE
872 submenu
= WMReadPropListFromFile(SYSCONFDIR
"/" GLOBAL_DEFAULTS_SUBDIR
"/" GLOBAL_PREAMBLE_MENU_FILE
);
874 if (submenu
&& !WMIsPLArray(submenu
)) {
875 wwarning(_("invalid global menu file %s"), GLOBAL_PREAMBLE_MENU_FILE
);
876 WMReleasePropList(submenu
);
880 prependMenu(menu
, submenu
);
881 WMReleasePropList(submenu
);
885 #ifdef GLOBAL_EPILOGUE_MENU_FILE
886 submenu
= WMReadPropListFromFile(SYSCONFDIR
"/" GLOBAL_DEFAULTS_SUBDIR
"/" GLOBAL_EPILOGUE_MENU_FILE
);
888 if (submenu
&& !WMIsPLArray(submenu
)) {
889 wwarning(_("invalid global menu file %s"), GLOBAL_EPILOGUE_MENU_FILE
);
890 WMReleasePropList(submenu
);
894 appendMenu(menu
, submenu
);
895 WMReleasePropList(submenu
);
899 menuDomain
->dictionary
= menu
;
902 WDDomain
*wDefaultsInitDomain(const char *domain
, Bool requireDictionary
)
906 static int inited
= 0;
907 WMPropList
*shared_dict
= NULL
;
914 db
= wmalloc(sizeof(WDDomain
));
915 db
->domain_name
= domain
;
916 db
->path
= wdefaultspathfordomain(domain
);
918 if (stat(db
->path
, &stbuf
) >= 0) {
919 db
->dictionary
= WMReadPropListFromFile(db
->path
);
920 if (db
->dictionary
) {
921 if (requireDictionary
&& !WMIsPLDictionary(db
->dictionary
)) {
922 WMReleasePropList(db
->dictionary
);
923 db
->dictionary
= NULL
;
924 wwarning(_("Domain %s (%s) of defaults database is corrupted!"), domain
, db
->path
);
926 db
->timestamp
= stbuf
.st_mtime
;
928 wwarning(_("could not load domain %s from user defaults database"), domain
);
932 /* global system dictionary */
933 shared_dict
= readGlobalDomain(domain
, requireDictionary
);
935 if (shared_dict
&& db
->dictionary
&& WMIsPLDictionary(shared_dict
) &&
936 WMIsPLDictionary(db
->dictionary
)) {
937 WMMergePLDictionaries(shared_dict
, db
->dictionary
, True
);
938 WMReleasePropList(db
->dictionary
);
939 db
->dictionary
= shared_dict
;
940 if (stbuf
.st_mtime
> db
->timestamp
)
941 db
->timestamp
= stbuf
.st_mtime
;
942 } else if (!db
->dictionary
) {
943 db
->dictionary
= shared_dict
;
944 if (stbuf
.st_mtime
> db
->timestamp
)
945 db
->timestamp
= stbuf
.st_mtime
;
951 void wReadStaticDefaults(WMPropList
* dict
)
954 WDefaultEntry
*entry
;
958 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
959 entry
= &staticOptionList
[i
];
962 plvalue
= WMGetFromPLDictionary(dict
, entry
->plkey
);
966 /* no default in the DB. Use builtin default */
968 plvalue
= entry
->plvalue
;
972 (*entry
->convert
) (NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
974 (*entry
->update
) (NULL
, entry
, tdata
, entry
->extra_data
);
979 void wDefaultsCheckDomains(void* arg
)
983 WMPropList
*shared_dict
= NULL
;
987 /* Parameter not used, but tell the compiler that it is ok */
990 if (stat(w_global
.domain
.wmaker
->path
, &stbuf
) >= 0 && w_global
.domain
.wmaker
->timestamp
< stbuf
.st_mtime
) {
991 w_global
.domain
.wmaker
->timestamp
= stbuf
.st_mtime
;
993 /* Global dictionary */
994 shared_dict
= readGlobalDomain("WindowMaker", True
);
996 /* User dictionary */
997 dict
= WMReadPropListFromFile(w_global
.domain
.wmaker
->path
);
1000 if (!WMIsPLDictionary(dict
)) {
1001 WMReleasePropList(dict
);
1003 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1004 "WindowMaker", w_global
.domain
.wmaker
->path
);
1007 WMMergePLDictionaries(shared_dict
, dict
, True
);
1008 WMReleasePropList(dict
);
1013 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1014 scr
= wScreenWithNumber(i
);
1016 wReadDefaults(scr
, dict
);
1019 if (w_global
.domain
.wmaker
->dictionary
)
1020 WMReleasePropList(w_global
.domain
.wmaker
->dictionary
);
1022 w_global
.domain
.wmaker
->dictionary
= dict
;
1025 wwarning(_("could not load domain %s from user defaults database"), "WindowMaker");
1029 WMReleasePropList(shared_dict
);
1033 if (stat(w_global
.domain
.window_attr
->path
, &stbuf
) >= 0 && w_global
.domain
.window_attr
->timestamp
< stbuf
.st_mtime
) {
1034 /* global dictionary */
1035 shared_dict
= readGlobalDomain("WMWindowAttributes", True
);
1036 /* user dictionary */
1037 dict
= WMReadPropListFromFile(w_global
.domain
.window_attr
->path
);
1039 if (!WMIsPLDictionary(dict
)) {
1040 WMReleasePropList(dict
);
1042 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1043 "WMWindowAttributes", w_global
.domain
.window_attr
->path
);
1046 WMMergePLDictionaries(shared_dict
, dict
, True
);
1047 WMReleasePropList(dict
);
1052 if (w_global
.domain
.window_attr
->dictionary
)
1053 WMReleasePropList(w_global
.domain
.window_attr
->dictionary
);
1055 w_global
.domain
.window_attr
->dictionary
= dict
;
1056 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1057 scr
= wScreenWithNumber(i
);
1059 wDefaultUpdateIcons(scr
);
1061 /* Update the panel image if changed */
1062 /* Don't worry. If the image is the same these
1063 * functions will have no performance impact. */
1064 create_logo_image(scr
);
1069 wwarning(_("could not load domain %s from user defaults database"), "WMWindowAttributes");
1072 w_global
.domain
.window_attr
->timestamp
= stbuf
.st_mtime
;
1074 WMReleasePropList(shared_dict
);
1077 if (stat(w_global
.domain
.root_menu
->path
, &stbuf
) >= 0 && w_global
.domain
.root_menu
->timestamp
< stbuf
.st_mtime
) {
1078 dict
= WMReadPropListFromFile(w_global
.domain
.root_menu
->path
);
1080 if (!WMIsPLArray(dict
) && !WMIsPLString(dict
)) {
1081 WMReleasePropList(dict
);
1083 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1084 "WMRootMenu", w_global
.domain
.root_menu
->path
);
1086 if (w_global
.domain
.root_menu
->dictionary
)
1087 WMReleasePropList(w_global
.domain
.root_menu
->dictionary
);
1089 w_global
.domain
.root_menu
->dictionary
= dict
;
1090 wDefaultsMergeGlobalMenus(w_global
.domain
.root_menu
);
1093 wwarning(_("could not load domain %s from user defaults database"), "WMRootMenu");
1095 w_global
.domain
.root_menu
->timestamp
= stbuf
.st_mtime
;
1097 #ifndef HAVE_INOTIFY
1099 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, arg
);
1103 void wReadDefaults(WScreen
* scr
, WMPropList
* new_dict
)
1105 WMPropList
*plvalue
, *old_value
;
1106 WDefaultEntry
*entry
;
1108 int update_workspace_back
= 0; /* kluge :/ */
1109 unsigned int needs_refresh
;
1111 WMPropList
*old_dict
= (w_global
.domain
.wmaker
->dictionary
!= new_dict
? w_global
.domain
.wmaker
->dictionary
: NULL
);
1115 for (i
= 0; i
< wlengthof(optionList
); i
++) {
1116 entry
= &optionList
[i
];
1119 plvalue
= WMGetFromPLDictionary(new_dict
, entry
->plkey
);
1126 old_value
= WMGetFromPLDictionary(old_dict
, entry
->plkey
);
1128 if (!plvalue
&& !old_value
) {
1129 /* no default in the DB. Use builtin default */
1130 plvalue
= entry
->plvalue
;
1131 if (plvalue
&& new_dict
)
1132 WMPutInPLDictionary(new_dict
, entry
->plkey
, plvalue
);
1134 } else if (!plvalue
) {
1135 /* value was deleted from DB. Keep current value */
1137 } else if (!old_value
) {
1138 /* set value for the 1st time */
1139 } else if (!WMIsPropListEqualTo(plvalue
, old_value
)) {
1140 /* value has changed */
1142 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1143 && update_workspace_back
&& scr
->flags
.backimage_helper_launched
) {
1145 /* value was not changed since last time */
1152 if ((*entry
->convert
) (scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1154 * If the WorkspaceSpecificBack data has been changed
1155 * so that the helper will be launched now, we must be
1156 * sure to send the default background texture config
1159 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0 &&
1160 !scr
->flags
.backimage_helper_launched
)
1161 update_workspace_back
= 1;
1164 needs_refresh
|= (*entry
->update
) (scr
, entry
, tdata
, entry
->extra_data
);
1170 if (needs_refresh
!= 0 && !scr
->flags
.startup
) {
1174 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1175 foo
|= WTextureSettings
;
1176 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1177 foo
|= WFontSettings
;
1178 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1179 foo
|= WColorSettings
;
1181 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1182 (void *)(uintptr_t) foo
);
1185 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1186 foo
|= WTextureSettings
;
1187 if (needs_refresh
& REFRESH_MENU_FONT
)
1188 foo
|= WFontSettings
;
1189 if (needs_refresh
& REFRESH_MENU_COLOR
)
1190 foo
|= WColorSettings
;
1192 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1195 if (needs_refresh
& REFRESH_WINDOW_FONT
)
1196 foo
|= WFontSettings
;
1197 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
)
1198 foo
|= WTextureSettings
;
1199 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
)
1200 foo
|= WColorSettings
;
1202 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1204 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1206 if (needs_refresh
& REFRESH_ICON_FONT
)
1207 foo
|= WFontSettings
;
1208 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
)
1209 foo
|= WTextureSettings
;
1210 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
)
1211 foo
|= WTextureSettings
;
1213 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1214 (void *)(uintptr_t) foo
);
1216 if (needs_refresh
& REFRESH_ICON_TILE
)
1217 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1219 if (needs_refresh
& REFRESH_WORKSPACE_MENU
) {
1220 if (w_global
.workspace
.menu
)
1221 wWorkspaceMenuUpdate(w_global
.workspace
.menu
);
1222 if (w_global
.clip
.ws_menu
)
1223 wWorkspaceMenuUpdate(w_global
.clip
.ws_menu
);
1224 if (w_global
.workspace
.submenu
)
1225 w_global
.workspace
.submenu
->flags
.realized
= 0;
1226 if (w_global
.clip
.submenu
)
1227 w_global
.clip
.submenu
->flags
.realized
= 0;
1232 void wDefaultUpdateIcons(WScreen
*scr
)
1234 WAppIcon
*aicon
= w_global
.app_icon_list
;
1236 WWindow
*wwin
= scr
->focused_window
;
1239 /* Get the application icon, default included */
1240 wIconChangeImageFile(aicon
->icon
, NULL
);
1241 wAppIconPaint(aicon
);
1242 aicon
= aicon
->next
;
1245 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
)
1248 for (dc
= scr
->drawers
; dc
!= NULL
; dc
= dc
->next
)
1249 wDrawerIconPaint(dc
->adrawer
->icon_array
[0]);
1252 if (wwin
->icon
&& wwin
->flags
.miniaturized
)
1253 wIconChangeImageFile(wwin
->icon
, NULL
);
1258 /* --------------------------- Local ----------------------- */
1260 #define GET_STRING_OR_DEFAULT(x, var) if (!WMIsPLString(value)) { \
1261 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1263 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1264 var = entry->default_value;\
1265 } else var = WMGetFromPLString(value)\
1268 static int string2index(WMPropList *key, WMPropList *val, const char *def, WOptionEnumeration * values)
1271 WOptionEnumeration
*v
;
1272 char buffer
[TOTAL_VALUES_LENGTH
];
1274 if (WMIsPLString(val
) && (str
= WMGetFromPLString(val
))) {
1275 for (v
= values
; v
->string
!= NULL
; v
++) {
1276 if (strcasecmp(v
->string
, str
) == 0)
1282 for (v
= values
; v
->string
!= NULL
; v
++) {
1285 strcat(buffer
, ", ");
1286 snprintf(buffer
+strlen(buffer
),
1287 sizeof(buffer
)-strlen(buffer
)-1, "\"%s\"", v
->string
);
1290 wwarning(_("wrong option value for key \"%s\"; got \"%s\", should be one of %s."),
1291 WMGetFromPLString(key
),
1292 WMIsPLString(val
) ? WMGetFromPLString(val
) : "(unknown)",
1296 return string2index(key
, val
, NULL
, values
);
1303 * value - is the value in the defaults DB
1304 * addr - is the address to store the data
1305 * ret - is the address to store a pointer to a temporary buffer. ret
1306 * must not be freed and is used by the set functions
1308 static int getBool(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1312 int second_pass
= 0;
1314 /* Parameter not used, but tell the compiler that it is ok */
1317 GET_STRING_OR_DEFAULT("Boolean", val
);
1320 if ((val
[1] == '\0' && (val
[0] == 'y' || val
[0] == 'Y'))
1321 || strcasecmp(val
, "YES") == 0) {
1324 } else if ((val
[1] == '\0' && (val
[0] == 'n' || val
[0] == 'N'))
1325 || strcasecmp(val
, "NO") == 0) {
1329 if (sscanf(val
, "%i", &i
) == 1) {
1335 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""), val
, entry
->key
);
1336 if (second_pass
== 0) {
1337 val
= WMGetFromPLString(entry
->plvalue
);
1339 wwarning(_("using default \"%s\" instead"), val
);
1349 *(char *)addr
= data
;
1354 static int getInt(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1359 /* Parameter not used, but tell the compiler that it is ok */
1362 GET_STRING_OR_DEFAULT("Integer", val
);
1364 if (sscanf(val
, "%i", &data
) != 1) {
1365 wwarning(_("can't convert \"%s\" to integer for key \"%s\""), val
, entry
->key
);
1366 val
= WMGetFromPLString(entry
->plvalue
);
1367 wwarning(_("using default \"%s\" instead"), val
);
1368 if (sscanf(val
, "%i", &data
) != 1) {
1376 *(int *)addr
= data
;
1381 static int getCoord(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1384 char *val_x
, *val_y
;
1385 int nelem
, changed
= 0;
1386 WMPropList
*elem_x
, *elem_y
;
1389 if (!WMIsPLArray(value
)) {
1390 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Coordinate");
1392 value
= entry
->plvalue
;
1394 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1400 nelem
= WMGetPropListItemCount(value
);
1402 wwarning(_("Incorrect number of elements in array for key \"%s\"."), entry
->key
);
1404 value
= entry
->plvalue
;
1406 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1412 elem_x
= WMGetFromPLArray(value
, 0);
1413 elem_y
= WMGetFromPLArray(value
, 1);
1415 if (!elem_x
|| !elem_y
|| !WMIsPLString(elem_x
) || !WMIsPLString(elem_y
)) {
1416 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."), entry
->key
);
1418 value
= entry
->plvalue
;
1420 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1426 val_x
= WMGetFromPLString(elem_x
);
1427 val_y
= WMGetFromPLString(elem_y
);
1429 if (sscanf(val_x
, "%i", &data
.x
) != 1 || sscanf(val_y
, "%i", &data
.y
) != 1) {
1430 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1432 value
= entry
->plvalue
;
1434 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1442 else if (data
.x
> scr
->scr_width
/ 3)
1443 data
.x
= scr
->scr_width
/ 3;
1446 else if (data
.y
> scr
->scr_height
/ 3)
1447 data
.y
= scr
->scr_height
/ 3;
1452 *(WCoord
*) addr
= data
;
1457 static int getPropList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1459 /* Parameter not used, but tell the compiler that it is ok */
1464 WMRetainPropList(value
);
1471 static int getPathList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1479 /* Parameter not used, but tell the compiler that it is ok */
1484 if (!WMIsPLArray(value
)) {
1485 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "an array of paths");
1487 value
= entry
->plvalue
;
1489 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1496 count
= WMGetPropListItemCount(value
);
1499 value
= entry
->plvalue
;
1501 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1508 for (i
= 0; i
< count
; i
++) {
1509 d
= WMGetFromPLArray(value
, i
);
1510 if (!d
|| !WMIsPLString(d
)) {
1514 len
+= strlen(WMGetFromPLString(d
)) + 1;
1517 ptr
= data
= wmalloc(len
+ 1);
1519 for (i
= 0; i
< count
; i
++) {
1520 d
= WMGetFromPLArray(value
, i
);
1521 if (!d
|| !WMIsPLString(d
)) {
1524 strcpy(ptr
, WMGetFromPLString(d
));
1525 ptr
+= strlen(WMGetFromPLString(d
));
1532 if (*(char **)addr
!= NULL
) {
1533 wfree(*(char **)addr
);
1535 *(char **)addr
= data
;
1540 static int getEnum(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1542 static signed char data
;
1544 /* Parameter not used, but tell the compiler that it is ok */
1547 data
= string2index(entry
->plkey
, value
, entry
->default_value
, (WOptionEnumeration
*) entry
->extra_data
);
1554 *(signed char *)addr
= data
;
1561 * (hgradient <color> <color>)
1562 * (vgradient <color> <color>)
1563 * (dgradient <color> <color>)
1564 * (mhgradient <color> <color> ...)
1565 * (mvgradient <color> <color> ...)
1566 * (mdgradient <color> <color> ...)
1567 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1568 * (tpixmap <file> <color>)
1569 * (spixmap <file> <color>)
1570 * (cpixmap <file> <color>)
1571 * (thgradient <file> <opaqueness> <color> <color>)
1572 * (tvgradient <file> <opaqueness> <color> <color>)
1573 * (tdgradient <file> <opaqueness> <color> <color>)
1574 * (function <lib> <function> ...)
1577 static WTexture
*parse_texture(WScreen
* scr
, WMPropList
* pl
)
1582 WTexture
*texture
= NULL
;
1584 nelem
= WMGetPropListItemCount(pl
);
1588 elem
= WMGetFromPLArray(pl
, 0);
1589 if (!elem
|| !WMIsPLString(elem
))
1591 val
= WMGetFromPLString(elem
);
1593 if (strcasecmp(val
, "solid") == 0) {
1601 elem
= WMGetFromPLArray(pl
, 1);
1602 if (!elem
|| !WMIsPLString(elem
))
1604 val
= WMGetFromPLString(elem
);
1606 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1607 wwarning(_("\"%s\" is not a valid color name"), val
);
1611 texture
= (WTexture
*) wTextureMakeSolid(scr
, &color
);
1612 } else if (strcasecmp(val
, "dgradient") == 0
1613 || strcasecmp(val
, "vgradient") == 0 || strcasecmp(val
, "hgradient") == 0) {
1614 RColor color1
, color2
;
1619 wwarning(_("bad number of arguments in gradient specification"));
1623 if (val
[0] == 'd' || val
[0] == 'D')
1624 type
= WTEX_DGRADIENT
;
1625 else if (val
[0] == 'h' || val
[0] == 'H')
1626 type
= WTEX_HGRADIENT
;
1628 type
= WTEX_VGRADIENT
;
1630 /* get from color */
1631 elem
= WMGetFromPLArray(pl
, 1);
1632 if (!elem
|| !WMIsPLString(elem
))
1634 val
= WMGetFromPLString(elem
);
1636 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1637 wwarning(_("\"%s\" is not a valid color name"), val
);
1641 color1
.red
= xcolor
.red
>> 8;
1642 color1
.green
= xcolor
.green
>> 8;
1643 color1
.blue
= xcolor
.blue
>> 8;
1646 elem
= WMGetFromPLArray(pl
, 2);
1647 if (!elem
|| !WMIsPLString(elem
)) {
1650 val
= WMGetFromPLString(elem
);
1652 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1653 wwarning(_("\"%s\" is not a valid color name"), val
);
1657 color2
.red
= xcolor
.red
>> 8;
1658 color2
.green
= xcolor
.green
>> 8;
1659 color2
.blue
= xcolor
.blue
>> 8;
1661 texture
= (WTexture
*) wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1663 } else if (strcasecmp(val
, "igradient") == 0) {
1664 RColor colors1
[2], colors2
[2];
1670 wwarning(_("bad number of arguments in gradient specification"));
1674 /* get from color */
1675 for (i
= 0; i
< 2; i
++) {
1676 elem
= WMGetFromPLArray(pl
, 1 + i
);
1677 if (!elem
|| !WMIsPLString(elem
))
1679 val
= WMGetFromPLString(elem
);
1681 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1682 wwarning(_("\"%s\" is not a valid color name"), val
);
1685 colors1
[i
].alpha
= 255;
1686 colors1
[i
].red
= xcolor
.red
>> 8;
1687 colors1
[i
].green
= xcolor
.green
>> 8;
1688 colors1
[i
].blue
= xcolor
.blue
>> 8;
1690 elem
= WMGetFromPLArray(pl
, 3);
1691 if (!elem
|| !WMIsPLString(elem
))
1693 val
= WMGetFromPLString(elem
);
1696 /* get from color */
1697 for (i
= 0; i
< 2; i
++) {
1698 elem
= WMGetFromPLArray(pl
, 4 + i
);
1699 if (!elem
|| !WMIsPLString(elem
))
1701 val
= WMGetFromPLString(elem
);
1703 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1704 wwarning(_("\"%s\" is not a valid color name"), val
);
1707 colors2
[i
].alpha
= 255;
1708 colors2
[i
].red
= xcolor
.red
>> 8;
1709 colors2
[i
].green
= xcolor
.green
>> 8;
1710 colors2
[i
].blue
= xcolor
.blue
>> 8;
1712 elem
= WMGetFromPLArray(pl
, 6);
1713 if (!elem
|| !WMIsPLString(elem
))
1715 val
= WMGetFromPLString(elem
);
1718 texture
= (WTexture
*) wTextureMakeIGradient(scr
, th1
, colors1
, th2
, colors2
);
1720 } else if (strcasecmp(val
, "mhgradient") == 0
1721 || strcasecmp(val
, "mvgradient") == 0 || strcasecmp(val
, "mdgradient") == 0) {
1728 wwarning(_("too few arguments in multicolor gradient specification"));
1732 if (val
[1] == 'h' || val
[1] == 'H')
1733 type
= WTEX_MHGRADIENT
;
1734 else if (val
[1] == 'v' || val
[1] == 'V')
1735 type
= WTEX_MVGRADIENT
;
1737 type
= WTEX_MDGRADIENT
;
1741 colors
= wmalloc(sizeof(RColor
*) * (count
+ 1));
1743 for (i
= 0; i
< count
; i
++) {
1744 elem
= WMGetFromPLArray(pl
, i
+ 1);
1745 if (!elem
|| !WMIsPLString(elem
)) {
1746 for (--i
; i
>= 0; --i
) {
1752 val
= WMGetFromPLString(elem
);
1754 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1755 wwarning(_("\"%s\" is not a valid color name"), val
);
1756 for (--i
; i
>= 0; --i
) {
1762 colors
[i
] = wmalloc(sizeof(RColor
));
1763 colors
[i
]->red
= color
.red
>> 8;
1764 colors
[i
]->green
= color
.green
>> 8;
1765 colors
[i
]->blue
= color
.blue
>> 8;
1770 texture
= (WTexture
*) wTextureMakeMGradient(scr
, type
, colors
);
1771 } else if (strcasecmp(val
, "spixmap") == 0 ||
1772 strcasecmp(val
, "cpixmap") == 0 || strcasecmp(val
, "tpixmap") == 0) {
1779 if (val
[0] == 's' || val
[0] == 'S')
1781 else if (val
[0] == 'c' || val
[0] == 'C')
1787 elem
= WMGetFromPLArray(pl
, 2);
1788 if (!elem
|| !WMIsPLString(elem
)) {
1791 val
= WMGetFromPLString(elem
);
1793 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1794 wwarning(_("\"%s\" is not a valid color name"), val
);
1799 elem
= WMGetFromPLArray(pl
, 1);
1800 if (!elem
|| !WMIsPLString(elem
))
1802 val
= WMGetFromPLString(elem
);
1804 texture
= (WTexture
*) wTextureMakePixmap(scr
, type
, val
, &color
);
1805 } else if (strcasecmp(val
, "thgradient") == 0
1806 || strcasecmp(val
, "tvgradient") == 0 || strcasecmp(val
, "tdgradient") == 0) {
1807 RColor color1
, color2
;
1812 if (val
[1] == 'h' || val
[1] == 'H')
1813 style
= WTEX_THGRADIENT
;
1814 else if (val
[1] == 'v' || val
[1] == 'V')
1815 style
= WTEX_TVGRADIENT
;
1817 style
= WTEX_TDGRADIENT
;
1820 wwarning(_("bad number of arguments in textured gradient specification"));
1824 /* get from color */
1825 elem
= WMGetFromPLArray(pl
, 3);
1826 if (!elem
|| !WMIsPLString(elem
))
1828 val
= WMGetFromPLString(elem
);
1830 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1831 wwarning(_("\"%s\" is not a valid color name"), val
);
1835 color1
.red
= xcolor
.red
>> 8;
1836 color1
.green
= xcolor
.green
>> 8;
1837 color1
.blue
= xcolor
.blue
>> 8;
1840 elem
= WMGetFromPLArray(pl
, 4);
1841 if (!elem
|| !WMIsPLString(elem
)) {
1844 val
= WMGetFromPLString(elem
);
1846 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1847 wwarning(_("\"%s\" is not a valid color name"), val
);
1851 color2
.red
= xcolor
.red
>> 8;
1852 color2
.green
= xcolor
.green
>> 8;
1853 color2
.blue
= xcolor
.blue
>> 8;
1856 elem
= WMGetFromPLArray(pl
, 2);
1857 if (!elem
|| !WMIsPLString(elem
))
1860 val
= WMGetFromPLString(elem
);
1862 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
1863 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
1868 elem
= WMGetFromPLArray(pl
, 1);
1869 if (!elem
|| !WMIsPLString(elem
))
1871 val
= WMGetFromPLString(elem
);
1873 texture
= (WTexture
*) wTextureMakeTGradient(scr
, style
, &color1
, &color2
, val
, opacity
);
1874 } else if (strcasecmp(val
, "function") == 0) {
1875 /* Leave this in to handle the unlikely case of
1876 * someone actually having function textures configured */
1877 wwarning("function texture support has been removed");
1880 wwarning(_("invalid texture type %s"), val
);
1886 static int getTexture(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1888 static WTexture
*texture
;
1892 if (!WMIsPLArray(value
)) {
1893 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Texture");
1895 value
= entry
->plvalue
;
1897 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1903 if (strcmp(entry
->key
, "WidgetColor") == 0 && !changed
) {
1906 pl
= WMGetFromPLArray(value
, 0);
1907 if (!pl
|| !WMIsPLString(pl
) || !WMGetFromPLString(pl
)
1908 || strcasecmp(WMGetFromPLString(pl
), "solid") != 0) {
1909 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1910 entry
->key
, "Solid Texture");
1912 value
= entry
->plvalue
;
1914 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1919 texture
= parse_texture(scr
, value
);
1922 wwarning(_("Error in texture specification for key \"%s\""), entry
->key
);
1924 value
= entry
->plvalue
;
1926 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1936 *(WTexture
**) addr
= texture
;
1941 static int getWSBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1948 /* Parameter not used, but tell the compiler that it is ok */
1953 if (!WMIsPLArray(value
)) {
1954 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1955 "WorkspaceBack", "Texture or None");
1957 value
= entry
->plvalue
;
1959 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1965 /* only do basic error checking and verify for None texture */
1967 nelem
= WMGetPropListItemCount(value
);
1969 elem
= WMGetFromPLArray(value
, 0);
1970 if (!elem
|| !WMIsPLString(elem
)) {
1971 wwarning(_("Wrong type for workspace background. Should be a texture type."));
1973 value
= entry
->plvalue
;
1975 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1980 val
= WMGetFromPLString(elem
);
1982 if (strcasecmp(val
, "None") == 0)
1985 *ret
= WMRetainPropList(value
);
1991 getWSSpecificBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1997 /* Parameter not used, but tell the compiler that it is ok */
2002 if (!WMIsPLArray(value
)) {
2003 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2004 "WorkspaceSpecificBack", "an array of textures");
2006 value
= entry
->plvalue
;
2008 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2014 /* only do basic error checking and verify for None texture */
2016 nelem
= WMGetPropListItemCount(value
);
2019 elem
= WMGetFromPLArray(value
, nelem
);
2020 if (!elem
|| !WMIsPLArray(elem
)) {
2021 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2027 *ret
= WMRetainPropList(value
);
2031 * Kluge to force wmsetbg helper to set the default background.
2032 * If the WorkspaceSpecificBack is changed once wmaker has started,
2033 * the WorkspaceBack won't be sent to the helper, unless the user
2034 * changes it's value too. So, we must force this by removing the
2035 * value from the defaults DB.
2037 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2038 WMPropList
*key
= WMCreatePLString("WorkspaceBack");
2040 WMRemoveFromPLDictionary(w_global
.domain
.wmaker
->dictionary
, key
);
2042 WMReleasePropList(key
);
2048 static int getFont(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2050 static WMFont
*font
;
2055 GET_STRING_OR_DEFAULT("Font", val
);
2057 font
= WMCreateFont(scr
->wmscreen
, val
);
2059 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2062 wfatal(_("could not load any usable font!!!"));
2069 /* can't assign font value outside update function */
2070 wassertrv(addr
== NULL
, True
);
2075 static int getColor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2077 static XColor color
;
2079 int second_pass
= 0;
2083 GET_STRING_OR_DEFAULT("Color", val
);
2086 if (!wGetColor(scr
, val
, &color
)) {
2087 wwarning(_("could not get color for key \"%s\""), entry
->key
);
2088 if (second_pass
== 0) {
2089 val
= WMGetFromPLString(entry
->plvalue
);
2091 wwarning(_("using default \"%s\" instead"), val
);
2100 assert(addr
== NULL
);
2103 *(unsigned long*)addr = pixel;
2109 static int getKeybind(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2111 static WShortKey shortcut
;
2115 char buf
[MAX_SHORTCUT_LENGTH
], *b
;
2117 /* Parameter not used, but tell the compiler that it is ok */
2121 GET_STRING_OR_DEFAULT("Key spec", val
);
2123 if (!val
|| strcasecmp(val
, "NONE") == 0) {
2124 shortcut
.keycode
= 0;
2125 shortcut
.modifier
= 0;
2131 wstrlcpy(buf
, val
, MAX_SHORTCUT_LENGTH
);
2136 shortcut
.modifier
= 0;
2137 while ((k
= strchr(b
, '+')) != NULL
) {
2141 mod
= wXModifierFromKey(b
);
2143 wwarning(_("%s: invalid key modifier \"%s\""), entry
->key
, b
);
2146 shortcut
.modifier
|= mod
;
2152 ksym
= XStringToKeysym(b
);
2154 if (ksym
== NoSymbol
) {
2155 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
, val
);
2159 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2160 if (shortcut
.keycode
== 0) {
2161 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2171 static int getModMask(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2176 /* Parameter not used, but tell the compiler that it is ok */
2179 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2184 mask
= wXModifierFromKey(str
);
2186 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2192 *(int *)addr
= mask
;
2200 # include <X11/cursorfont.h>
2206 #define CURSOR_ID_NONE (XC_num_glyphs)
2208 static const WCursorLookup cursor_table
[] = {
2209 {"X_cursor", XC_X_cursor
},
2210 {"arrow", XC_arrow
},
2211 {"based_arrow_down", XC_based_arrow_down
},
2212 {"based_arrow_up", XC_based_arrow_up
},
2214 {"bogosity", XC_bogosity
},
2215 {"bottom_left_corner", XC_bottom_left_corner
},
2216 {"bottom_right_corner", XC_bottom_right_corner
},
2217 {"bottom_side", XC_bottom_side
},
2218 {"bottom_tee", XC_bottom_tee
},
2219 {"box_spiral", XC_box_spiral
},
2220 {"center_ptr", XC_center_ptr
},
2221 {"circle", XC_circle
},
2222 {"clock", XC_clock
},
2223 {"coffee_mug", XC_coffee_mug
},
2224 {"cross", XC_cross
},
2225 {"cross_reverse", XC_cross_reverse
},
2226 {"crosshair", XC_crosshair
},
2227 {"diamond_cross", XC_diamond_cross
},
2229 {"dotbox", XC_dotbox
},
2230 {"double_arrow", XC_double_arrow
},
2231 {"draft_large", XC_draft_large
},
2232 {"draft_small", XC_draft_small
},
2233 {"draped_box", XC_draped_box
},
2234 {"exchange", XC_exchange
},
2235 {"fleur", XC_fleur
},
2236 {"gobbler", XC_gobbler
},
2237 {"gumby", XC_gumby
},
2238 {"hand1", XC_hand1
},
2239 {"hand2", XC_hand2
},
2240 {"heart", XC_heart
},
2242 {"iron_cross", XC_iron_cross
},
2243 {"left_ptr", XC_left_ptr
},
2244 {"left_side", XC_left_side
},
2245 {"left_tee", XC_left_tee
},
2246 {"leftbutton", XC_leftbutton
},
2247 {"ll_angle", XC_ll_angle
},
2248 {"lr_angle", XC_lr_angle
},
2250 {"middlebutton", XC_middlebutton
},
2251 {"mouse", XC_mouse
},
2252 {"pencil", XC_pencil
},
2253 {"pirate", XC_pirate
},
2255 {"question_arrow", XC_question_arrow
},
2256 {"right_ptr", XC_right_ptr
},
2257 {"right_side", XC_right_side
},
2258 {"right_tee", XC_right_tee
},
2259 {"rightbutton", XC_rightbutton
},
2260 {"rtl_logo", XC_rtl_logo
},
2261 {"sailboat", XC_sailboat
},
2262 {"sb_down_arrow", XC_sb_down_arrow
},
2263 {"sb_h_double_arrow", XC_sb_h_double_arrow
},
2264 {"sb_left_arrow", XC_sb_left_arrow
},
2265 {"sb_right_arrow", XC_sb_right_arrow
},
2266 {"sb_up_arrow", XC_sb_up_arrow
},
2267 {"sb_v_double_arrow", XC_sb_v_double_arrow
},
2268 {"shuttle", XC_shuttle
},
2269 {"sizing", XC_sizing
},
2270 {"spider", XC_spider
},
2271 {"spraycan", XC_spraycan
},
2273 {"target", XC_target
},
2274 {"tcross", XC_tcross
},
2275 {"top_left_arrow", XC_top_left_arrow
},
2276 {"top_left_corner", XC_top_left_corner
},
2277 {"top_right_corner", XC_top_right_corner
},
2278 {"top_side", XC_top_side
},
2279 {"top_tee", XC_top_tee
},
2281 {"ul_angle", XC_ul_angle
},
2282 {"umbrella", XC_umbrella
},
2283 {"ur_angle", XC_ur_angle
},
2284 {"watch", XC_watch
},
2285 {"xterm", XC_xterm
},
2286 {NULL
, CURSOR_ID_NONE
}
2289 static void check_bitmap_status(int status
, const char *filename
, Pixmap bitmap
)
2292 case BitmapOpenFailed
:
2293 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2295 case BitmapFileInvalid
:
2296 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2298 case BitmapNoMemory
:
2299 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2302 XFreePixmap(dpy
, bitmap
);
2309 * (builtin, <cursor_name>)
2310 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2312 static int parse_cursor(WScreen
* scr
, WMPropList
* pl
, Cursor
* cursor
)
2319 nelem
= WMGetPropListItemCount(pl
);
2323 elem
= WMGetFromPLArray(pl
, 0);
2324 if (!elem
|| !WMIsPLString(elem
)) {
2327 val
= WMGetFromPLString(elem
);
2329 if (strcasecmp(val
, "none") == 0) {
2332 } else if (strcasecmp(val
, "builtin") == 0) {
2334 int cursor_id
= CURSOR_ID_NONE
;
2337 wwarning(_("bad number of arguments in cursor specification"));
2340 elem
= WMGetFromPLArray(pl
, 1);
2341 if (!elem
|| !WMIsPLString(elem
)) {
2344 val
= WMGetFromPLString(elem
);
2346 for (i
= 0; cursor_table
[i
].name
!= NULL
; i
++) {
2347 if (strcasecmp(val
, cursor_table
[i
].name
) == 0) {
2348 cursor_id
= cursor_table
[i
].id
;
2352 if (CURSOR_ID_NONE
== cursor_id
) {
2353 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2355 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2358 } else if (strcasecmp(val
, "bitmap") == 0) {
2370 wwarning(_("bad number of arguments in cursor specification"));
2373 elem
= WMGetFromPLArray(pl
, 1);
2374 if (!elem
|| !WMIsPLString(elem
)) {
2377 val
= WMGetFromPLString(elem
);
2378 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2380 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2383 elem
= WMGetFromPLArray(pl
, 2);
2384 if (!elem
|| !WMIsPLString(elem
)) {
2388 val
= WMGetFromPLString(elem
);
2389 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2392 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2395 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
, &mask
, &x
, &y
);
2396 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
, &bitmap
, &x
, &y
);
2397 if ((BitmapSuccess
== bitmap_status
) && (BitmapSuccess
== mask_status
)) {
2398 fg
.pixel
= scr
->black_pixel
;
2399 bg
.pixel
= scr
->white_pixel
;
2400 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2401 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2402 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2405 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2406 check_bitmap_status(mask_status
, mask_name
, mask
);
2413 static int getCursor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2415 static Cursor cursor
;
2420 if (!WMIsPLArray(value
)) {
2421 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2422 entry
->key
, "cursor specification");
2424 value
= entry
->plvalue
;
2426 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2431 status
= parse_cursor(scr
, value
, &cursor
);
2433 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2435 value
= entry
->plvalue
;
2437 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2446 *(Cursor
*) addr
= cursor
;
2451 #undef CURSOR_ID_NONE
2453 /* ---------------- value setting functions --------------- */
2454 static int setJustify(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2456 /* Parameter not used, but tell the compiler that it is ok */
2462 return REFRESH_WINDOW_TITLE_COLOR
;
2465 static int setClearance(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2467 /* Parameter not used, but tell the compiler that it is ok */
2473 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
| REFRESH_MENU_TITLE_FONT
| REFRESH_MENU_FONT
;
2476 static int setIfDockPresent(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2479 long which
= (long) extra_data
;
2481 /* Parameter not used, but tell the compiler that it is ok */
2487 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2488 // Drawers require the dock
2489 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| wPreferences
.flags
.nodock
;
2492 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2495 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| *flag
;
2503 static int setClipMergedInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2507 /* Parameter not used, but tell the compiler that it is ok */
2512 wPreferences
.flags
.clip_merged_in_dock
= *flag
;
2513 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2517 static int setWrapAppiconsInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2521 /* Parameter not used, but tell the compiler that it is ok */
2526 wPreferences
.flags
.wrap_appicons_in_dock
= *flag
;
2530 static int setStickyIcons(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2532 /* Parameter not used, but tell the compiler that it is ok */
2537 if (w_global
.workspace
.array
) {
2538 wWorkspaceForceChange(scr
, w_global
.workspace
.current
);
2539 wArrangeIcons(scr
, False
);
2544 static int setIconTile(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2548 WTexture
** texture
= tdata
;
2551 /* Parameter not used, but tell the compiler that it is ok */
2554 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2555 wPreferences
.icon_size
, ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2556 ? WREL_ICON
: WREL_FLAT
);
2558 wwarning(_("could not render texture for icon background"));
2560 wTextureDestroy(scr
, *texture
);
2563 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2565 if (scr
->icon_tile
) {
2567 RReleaseImage(scr
->icon_tile
);
2568 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2571 scr
->icon_tile
= img
;
2573 /* put the icon in the noticeboard hint */
2574 PropSetIconTileHint(scr
, img
);
2576 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
) {
2577 if (scr
->clip_tile
) {
2578 RReleaseImage(scr
->clip_tile
);
2580 scr
->clip_tile
= wClipMakeTile(img
);
2583 if (!wPreferences
.flags
.nodrawer
) {
2584 if (scr
->drawer_tile
) {
2585 RReleaseImage(scr
->drawer_tile
);
2587 scr
->drawer_tile
= wDrawerMakeTile(scr
, img
);
2590 scr
->icon_tile_pixmap
= pixmap
;
2592 if (scr
->def_icon_rimage
) {
2593 RReleaseImage(scr
->def_icon_rimage
);
2594 scr
->def_icon_rimage
= NULL
;
2597 if (scr
->icon_back_texture
)
2598 wTextureDestroy(scr
, (WTexture
*) scr
->icon_back_texture
);
2600 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2602 /* Free the texture as nobody else will use it, nor refer to it. */
2604 wTextureDestroy(scr
, *texture
);
2606 return (reset
? REFRESH_ICON_TILE
: 0);
2609 static int setWinTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2611 WMFont
*font
= tdata
;
2613 /* Parameter not used, but tell the compiler that it is ok */
2617 if (scr
->title_font
) {
2618 WMReleaseFont(scr
->title_font
);
2620 scr
->title_font
= font
;
2622 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
;
2625 static int setMenuTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2627 WMFont
*font
= tdata
;
2629 /* Parameter not used, but tell the compiler that it is ok */
2633 if (scr
->menu_title_font
) {
2634 WMReleaseFont(scr
->menu_title_font
);
2637 scr
->menu_title_font
= font
;
2639 return REFRESH_MENU_TITLE_FONT
;
2642 static int setMenuTextFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2644 WMFont
*font
= tdata
;
2646 /* Parameter not used, but tell the compiler that it is ok */
2650 if (scr
->menu_entry_font
) {
2651 WMReleaseFont(scr
->menu_entry_font
);
2653 scr
->menu_entry_font
= font
;
2655 return REFRESH_MENU_FONT
;
2658 static int setIconTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2660 WMFont
*font
= tdata
;
2662 /* Parameter not used, but tell the compiler that it is ok */
2666 if (scr
->icon_title_font
) {
2667 WMReleaseFont(scr
->icon_title_font
);
2670 scr
->icon_title_font
= font
;
2672 return REFRESH_ICON_FONT
;
2675 static int setClipTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2677 WMFont
*font
= tdata
;
2679 /* Parameter not used, but tell the compiler that it is ok */
2683 if (scr
->clip_title_font
) {
2684 WMReleaseFont(scr
->clip_title_font
);
2687 scr
->clip_title_font
= font
;
2689 return REFRESH_ICON_FONT
;
2692 static int setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2694 WMFont
*font
= tdata
;
2696 /* Parameter not used, but tell the compiler that it is ok */
2701 if (w_global
.workspace
.font_for_name
)
2702 WMReleaseFont(w_global
.workspace
.font_for_name
);
2704 w_global
.workspace
.font_for_name
= font
;
2709 static int setHightlight(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2711 XColor
*color
= tdata
;
2713 /* Parameter not used, but tell the compiler that it is ok */
2717 if (scr
->select_color
)
2718 WMReleaseColor(scr
->select_color
);
2720 scr
->select_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2722 wFreeColor(scr
, color
->pixel
);
2724 return REFRESH_MENU_COLOR
;
2727 static int setHightlightText(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2729 XColor
*color
= tdata
;
2731 /* Parameter not used, but tell the compiler that it is ok */
2735 if (scr
->select_text_color
)
2736 WMReleaseColor(scr
->select_text_color
);
2738 scr
->select_text_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2740 wFreeColor(scr
, color
->pixel
);
2742 return REFRESH_MENU_COLOR
;
2745 static int setClipTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2747 XColor
*color
= tdata
;
2748 long widx
= (long) extra_data
;
2750 /* Parameter not used, but tell the compiler that it is ok */
2753 if (scr
->clip_title_color
[widx
])
2754 WMReleaseColor(scr
->clip_title_color
[widx
]);
2756 scr
->clip_title_color
[widx
] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2757 wFreeColor(scr
, color
->pixel
);
2759 return REFRESH_ICON_TITLE_COLOR
;
2762 static int setWTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2764 XColor
*color
= tdata
;
2765 long widx
= (long) extra_data
;
2767 /* Parameter not used, but tell the compiler that it is ok */
2770 if (scr
->window_title_color
[widx
])
2771 WMReleaseColor(scr
->window_title_color
[widx
]);
2773 scr
->window_title_color
[widx
] =
2774 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2776 wFreeColor(scr
, color
->pixel
);
2778 return REFRESH_WINDOW_TITLE_COLOR
;
2781 static int setMenuTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2783 XColor
*color
= tdata
;
2785 /* Parameter not used, but tell the compiler that it is ok */
2789 if (scr
->menu_title_color
[0])
2790 WMReleaseColor(scr
->menu_title_color
[0]);
2792 scr
->menu_title_color
[0] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2794 wFreeColor(scr
, color
->pixel
);
2796 return REFRESH_MENU_TITLE_COLOR
;
2799 static int setMenuTextColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2801 XColor
*color
= tdata
;
2803 /* Parameter not used, but tell the compiler that it is ok */
2807 if (scr
->mtext_color
)
2808 WMReleaseColor(scr
->mtext_color
);
2810 scr
->mtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2812 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2813 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2815 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2818 wFreeColor(scr
, color
->pixel
);
2820 return REFRESH_MENU_COLOR
;
2823 static int setMenuDisabledColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2825 XColor
*color
= tdata
;
2827 /* Parameter not used, but tell the compiler that it is ok */
2831 if (scr
->dtext_color
)
2832 WMReleaseColor(scr
->dtext_color
);
2834 scr
->dtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2836 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2837 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2839 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2842 wFreeColor(scr
, color
->pixel
);
2844 return REFRESH_MENU_COLOR
;
2847 static int setIconTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2849 XColor
*color
= tdata
;
2851 /* Parameter not used, but tell the compiler that it is ok */
2855 if (scr
->icon_title_color
)
2856 WMReleaseColor(scr
->icon_title_color
);
2857 scr
->icon_title_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2859 wFreeColor(scr
, color
->pixel
);
2861 return REFRESH_ICON_TITLE_COLOR
;
2864 static int setIconTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2866 XColor
*color
= tdata
;
2868 /* Parameter not used, but tell the compiler that it is ok */
2872 if (scr
->icon_title_texture
) {
2873 wTextureDestroy(scr
, (WTexture
*) scr
->icon_title_texture
);
2875 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
2877 return REFRESH_ICON_TITLE_BACK
;
2880 static int setFrameBorderWidth(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2884 /* Parameter not used, but tell the compiler that it is ok */
2888 scr
->frame_border_width
= *value
;
2890 return REFRESH_FRAME_BORDER
;
2893 static int setFrameBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2895 XColor
*color
= tdata
;
2897 /* Parameter not used, but tell the compiler that it is ok */
2901 if (scr
->frame_border_color
)
2902 WMReleaseColor(scr
->frame_border_color
);
2903 scr
->frame_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2905 wFreeColor(scr
, color
->pixel
);
2907 return REFRESH_FRAME_BORDER
;
2910 static int setFrameFocusedBorderColor(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2912 XColor
*color
= tdata
;
2914 /* Parameter not used, but tell the compiler that it is ok */
2918 if (scr
->frame_focused_border_color
)
2919 WMReleaseColor(scr
->frame_focused_border_color
);
2920 scr
->frame_focused_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2922 wFreeColor(scr
, color
->pixel
);
2924 return REFRESH_FRAME_BORDER
;
2927 static int setFrameSelectedBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2929 XColor
*color
= tdata
;
2931 /* Parameter not used, but tell the compiler that it is ok */
2935 if (scr
->frame_selected_border_color
)
2936 WMReleaseColor(scr
->frame_selected_border_color
);
2937 scr
->frame_selected_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2939 wFreeColor(scr
, color
->pixel
);
2941 return REFRESH_FRAME_BORDER
;
2944 static void trackDeadProcess(pid_t pid
, unsigned int status
, void *client_data
)
2946 WScreen
*scr
= (WScreen
*) client_data
;
2948 /* Parameter not used, but tell the compiler that it is ok */
2952 close(scr
->helper_fd
);
2954 scr
->helper_pid
= 0;
2955 scr
->flags
.backimage_helper_launched
= 0;
2958 static int setWorkspaceSpecificBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
2960 WMPropList
*value
= tdata
;
2965 /* Parameter not used, but tell the compiler that it is ok */
2969 if (scr
->flags
.backimage_helper_launched
) {
2970 if (WMGetPropListItemCount(value
) == 0) {
2971 SendHelperMessage(scr
, 'C', 0, NULL
);
2972 SendHelperMessage(scr
, 'K', 0, NULL
);
2974 WMReleasePropList(value
);
2981 if (WMGetPropListItemCount(value
) == 0)
2984 if (pipe(filedes
) < 0) {
2985 werror("pipe() failed:can't set workspace specific background image");
2987 WMReleasePropList(value
);
2993 werror("fork() failed:can't set workspace specific background image");
2994 if (close(filedes
[0]) < 0)
2995 werror("could not close pipe");
2996 if (close(filedes
[1]) < 0)
2997 werror("could not close pipe");
2999 } else if (pid
== 0) {
3002 SetupEnvironment(scr
);
3005 werror("could not close pipe");
3006 if (dup(filedes
[0]) < 0) {
3007 werror("dup() failed:can't set workspace specific background image");
3009 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3010 if (wPreferences
.smooth_workspace_back
)
3011 execlp("wmsetbg", "wmsetbg", "-helper", "-S", dither
, NULL
);
3013 execlp("wmsetbg", "wmsetbg", "-helper", dither
, NULL
);
3014 werror("could not execute wmsetbg");
3018 if (fcntl(filedes
[0], F_SETFD
, FD_CLOEXEC
) < 0) {
3019 werror("error setting close-on-exec flag");
3021 if (fcntl(filedes
[1], F_SETFD
, FD_CLOEXEC
) < 0) {
3022 werror("error setting close-on-exec flag");
3025 scr
->helper_fd
= filedes
[1];
3026 scr
->helper_pid
= pid
;
3027 scr
->flags
.backimage_helper_launched
= 1;
3029 wAddDeathHandler(pid
, trackDeadProcess
, scr
);
3031 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3036 for (i
= 0; i
< WMGetPropListItemCount(value
); i
++) {
3037 val
= WMGetFromPLArray(value
, i
);
3038 if (val
&& WMIsPLArray(val
) && WMGetPropListItemCount(val
) > 0) {
3039 str
= WMGetPropListDescription(val
, False
);
3041 SendHelperMessage(scr
, 'S', i
+ 1, str
);
3045 SendHelperMessage(scr
, 'U', i
+ 1, NULL
);
3050 WMReleasePropList(value
);
3054 static int setWorkspaceBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
3056 WMPropList
*value
= tdata
;
3058 /* Parameter not used, but tell the compiler that it is ok */
3062 if (scr
->flags
.backimage_helper_launched
) {
3065 if (WMGetPropListItemCount(value
) == 0) {
3066 SendHelperMessage(scr
, 'U', 0, NULL
);
3068 /* set the default workspace background to this one */
3069 str
= WMGetPropListDescription(value
, False
);
3071 SendHelperMessage(scr
, 'S', 0, str
);
3073 SendHelperMessage(scr
, 'C', w_global
.workspace
.current
+ 1, NULL
);
3075 SendHelperMessage(scr
, 'U', 0, NULL
);
3078 } else if (WMGetPropListItemCount(value
) > 0) {
3084 text
= WMGetPropListDescription(value
, False
);
3085 len
= strlen(text
) + 40;
3086 command
= wmalloc(len
);
3087 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3088 if (wPreferences
.smooth_workspace_back
)
3089 snprintf(command
, len
, "wmsetbg %s -S -p '%s' &", dither
, text
);
3091 snprintf(command
, len
, "wmsetbg %s -p '%s' &", dither
, text
);
3093 ExecuteShellCommand(scr
, command
);
3096 WMReleasePropList(value
);
3101 static int setWidgetColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3103 WTexture
**texture
= tdata
;
3105 /* Parameter not used, but tell the compiler that it is ok */
3109 if (scr
->widget_texture
) {
3110 wTextureDestroy(scr
, (WTexture
*) scr
->widget_texture
);
3112 scr
->widget_texture
= *(WTexSolid
**) texture
;
3117 static int setFTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3119 WTexture
**texture
= tdata
;
3121 /* Parameter not used, but tell the compiler that it is ok */
3125 if (scr
->window_title_texture
[WS_FOCUSED
]) {
3126 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3128 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3130 return REFRESH_WINDOW_TEXTURES
;
3133 static int setPTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3135 WTexture
**texture
= tdata
;
3137 /* Parameter not used, but tell the compiler that it is ok */
3141 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
3142 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3144 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3146 return REFRESH_WINDOW_TEXTURES
;
3149 static int setUTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3151 WTexture
**texture
= tdata
;
3153 /* Parameter not used, but tell the compiler that it is ok */
3157 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
3158 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3160 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3162 return REFRESH_WINDOW_TEXTURES
;
3165 static int setResizebarBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3167 WTexture
**texture
= tdata
;
3169 /* Parameter not used, but tell the compiler that it is ok */
3173 if (scr
->resizebar_texture
[0]) {
3174 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3176 scr
->resizebar_texture
[0] = *texture
;
3178 return REFRESH_WINDOW_TEXTURES
;
3181 static int setMenuTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3183 WTexture
**texture
= tdata
;
3185 /* Parameter not used, but tell the compiler that it is ok */
3189 if (scr
->menu_title_texture
[0]) {
3190 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3192 scr
->menu_title_texture
[0] = *texture
;
3194 return REFRESH_MENU_TITLE_TEXTURE
;
3197 static int setMenuTextBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3199 WTexture
**texture
= tdata
;
3201 /* Parameter not used, but tell the compiler that it is ok */
3205 if (scr
->menu_item_texture
) {
3206 wTextureDestroy(scr
, scr
->menu_item_texture
);
3207 wTextureDestroy(scr
, (WTexture
*) scr
->menu_item_auxtexture
);
3209 scr
->menu_item_texture
= *texture
;
3211 scr
->menu_item_auxtexture
= wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3213 return REFRESH_MENU_TEXTURE
;
3216 static int setKeyGrab(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3218 WShortKey
*shortcut
= tdata
;
3220 long widx
= (long) extra_data
;
3222 /* Parameter not used, but tell the compiler that it is ok */
3225 wKeyBindings
[widx
] = *shortcut
;
3227 wwin
= scr
->focused_window
;
3229 while (wwin
!= NULL
) {
3230 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3232 if (!WFLAGP(wwin
, no_bind_keys
)) {
3233 wWindowSetKeyGrabs(wwin
);
3238 /* do we need to update window menus? */
3239 if (widx
>= WKBD_WORKSPACE1
&& widx
<= WKBD_WORKSPACE10
)
3240 return REFRESH_WORKSPACE_MENU
;
3241 if (widx
== WKBD_LASTWORKSPACE
)
3242 return REFRESH_WORKSPACE_MENU
;
3243 if (widx
>= WKBD_MOVE_WORKSPACE1
&& widx
<= WKBD_MOVE_WORKSPACE10
)
3244 return REFRESH_WORKSPACE_MENU
;
3249 static int setIconPosition(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3251 /* Parameter not used, but tell the compiler that it is ok */
3256 wScreenUpdateUsableArea(scr
);
3257 wArrangeIcons(scr
, True
);
3262 static int updateUsableArea(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3264 /* Parameter not used, but tell the compiler that it is ok */
3269 wScreenUpdateUsableArea(scr
);
3274 static int setMenuStyle(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3276 /* Parameter not used, but tell the compiler that it is ok */
3282 return REFRESH_MENU_TEXTURE
;
3285 static RImage
*chopOffImage(RImage
* image
, int x
, int y
, int w
, int h
)
3287 RImage
*img
= RCreateImage(w
, h
, image
->format
== RRGBAFormat
);
3289 RCopyArea(img
, image
, x
, y
, w
, h
, 0, 0);
3294 static int setSwPOptions(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3296 WMPropList
*array
= tdata
;
3299 int cwidth
, cheight
;
3300 struct WPreferences
*prefs
= foo
;
3302 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) == 0) {
3303 if (prefs
->swtileImage
)
3304 RReleaseImage(prefs
->swtileImage
);
3305 prefs
->swtileImage
= NULL
;
3307 WMReleasePropList(array
);
3311 switch (WMGetPropListItemCount(array
)) {
3313 if (!WMIsPLString(WMGetFromPLArray(array
, 1))) {
3314 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3317 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 1)));
3320 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3321 WMGetFromPLString(WMGetFromPLArray(array
, 1)), entry
->key
);
3323 bgimage
= RLoadImage(scr
->rcontext
, path
, 0);
3325 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3330 cwidth
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 2)));
3331 cheight
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 3)));
3333 if (cwidth
<= 0 || cheight
<= 0 ||
3334 cwidth
>= bgimage
->width
- 2 || cheight
>= bgimage
->height
- 2)
3335 wwarning(_("Invalid split sizes for switch panel back image."));
3338 int swidth
, theight
;
3339 for (i
= 0; i
< 9; i
++) {
3340 if (prefs
->swbackImage
[i
])
3341 RReleaseImage(prefs
->swbackImage
[i
]);
3342 prefs
->swbackImage
[i
] = NULL
;
3344 swidth
= (bgimage
->width
- cwidth
) / 2;
3345 theight
= (bgimage
->height
- cheight
) / 2;
3347 prefs
->swbackImage
[0] = chopOffImage(bgimage
, 0, 0, swidth
, theight
);
3348 prefs
->swbackImage
[1] = chopOffImage(bgimage
, swidth
, 0, cwidth
, theight
);
3349 prefs
->swbackImage
[2] = chopOffImage(bgimage
, swidth
+ cwidth
, 0,
3352 prefs
->swbackImage
[3] = chopOffImage(bgimage
, 0, theight
, swidth
, cheight
);
3353 prefs
->swbackImage
[4] = chopOffImage(bgimage
, swidth
, theight
,
3355 prefs
->swbackImage
[5] = chopOffImage(bgimage
, swidth
+ cwidth
, theight
,
3358 prefs
->swbackImage
[6] = chopOffImage(bgimage
, 0, theight
+ cheight
,
3360 prefs
->swbackImage
[7] = chopOffImage(bgimage
, swidth
, theight
+ cheight
,
3362 prefs
->swbackImage
[8] =
3363 chopOffImage(bgimage
, swidth
+ cwidth
, theight
+ cheight
, swidth
,
3366 // check if anything failed
3367 for (i
= 0; i
< 9; i
++) {
3368 if (!prefs
->swbackImage
[i
]) {
3369 for (; i
>= 0; --i
) {
3370 RReleaseImage(prefs
->swbackImage
[i
]);
3371 prefs
->swbackImage
[i
] = NULL
;
3377 RReleaseImage(bgimage
);
3382 if (!WMIsPLString(WMGetFromPLArray(array
, 0))) {
3383 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3386 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 0)));
3389 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3390 WMGetFromPLString(WMGetFromPLArray(array
, 0)), entry
->key
);
3392 if (prefs
->swtileImage
)
3393 RReleaseImage(prefs
->swtileImage
);
3395 prefs
->swtileImage
= RLoadImage(scr
->rcontext
, path
, 0);
3396 if (!prefs
->swtileImage
) {
3397 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3404 wwarning(_("Invalid number of arguments for option \"%s\""), entry
->key
);
3408 WMReleasePropList(array
);
3413 static int setModifierKeyLabels(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3415 WMPropList
*array
= tdata
;
3417 struct WPreferences
*prefs
= foo
;
3419 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) != 7) {
3420 wwarning(_("Value for option \"%s\" must be an array of 7 strings"), entry
->key
);
3421 WMReleasePropList(array
);
3425 DestroyWindowMenu(scr
);
3427 for (i
= 0; i
< 7; i
++) {
3428 if (prefs
->modifier_labels
[i
])
3429 wfree(prefs
->modifier_labels
[i
]);
3431 if (WMIsPLString(WMGetFromPLArray(array
, i
))) {
3432 prefs
->modifier_labels
[i
] = wstrdup(WMGetFromPLString(WMGetFromPLArray(array
, i
)));
3434 wwarning(_("Invalid argument for option \"%s\" item %d"), entry
->key
, i
);
3435 prefs
->modifier_labels
[i
] = NULL
;
3439 WMReleasePropList(array
);
3444 static int setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3448 /* Parameter not used, but tell the compiler that it is ok */
3455 W_setconf_doubleClickDelay(*value
);
3460 static int setCursor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3462 Cursor
*cursor
= tdata
;
3463 long widx
= (long) extra_data
;
3465 /* Parameter not used, but tell the compiler that it is ok */
3468 if (wPreferences
.cursor
[widx
] != None
) {
3469 XFreeCursor(dpy
, wPreferences
.cursor
[widx
]);
3472 wPreferences
.cursor
[widx
] = *cursor
;
3474 if (widx
== WCUR_ROOT
&& *cursor
!= None
) {
3475 XDefineCursor(dpy
, scr
->root_win
, *cursor
);