1 /* defaults.c - manage configuration through defaults db
3 * Window Maker window manager
5 * Copyright (c) 1997-2003 Alfredo K. Kojima
6 * Copyright (c) 1998-2003 Dan Pascu
7 * Copyright (c) 2014 Window Maker Team
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
35 #include <sys/types.h>
41 #define PATH_MAX DEFAULT_PATH_MAX
45 #include <X11/Xutil.h>
46 #include <X11/keysym.h>
50 #include "WindowMaker.h"
55 #include "resources.h"
58 #include "xmodifier.h"
63 #include "workspace.h"
64 #include "properties.h"
68 #define MAX_SHORTCUT_LENGTH 32
70 #ifndef GLOBAL_DEFAULTS_SUBDIR
71 #define GLOBAL_DEFAULTS_SUBDIR "WindowMaker"
75 typedef struct _WDefaultEntry WDefaultEntry
;
76 typedef int (WDECallbackConvert
) (WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*plvalue
, void *addr
, void **tdata
);
77 typedef int (WDECallbackUpdate
) (WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *extra_data
);
79 struct _WDefaultEntry
{
81 const char *default_value
;
84 WDECallbackConvert
*convert
;
85 WDECallbackUpdate
*update
;
87 WMPropList
*plvalue
; /* default value */
90 /* used to map strings to integers */
98 static WDECallbackConvert getBool
;
99 static WDECallbackConvert getInt
;
100 static WDECallbackConvert getCoord
;
101 static WDECallbackConvert getPathList
;
102 static WDECallbackConvert getEnum
;
103 static WDECallbackConvert getTexture
;
104 static WDECallbackConvert getWSBackground
;
105 static WDECallbackConvert getWSSpecificBackground
;
106 static WDECallbackConvert getFont
;
107 static WDECallbackConvert getColor
;
108 static WDECallbackConvert getKeybind
;
109 static WDECallbackConvert getModMask
;
110 static WDECallbackConvert getPropList
;
112 /* value setting functions */
113 static WDECallbackUpdate setJustify
;
114 static WDECallbackUpdate setClearance
;
115 static WDECallbackUpdate setIfDockPresent
;
116 static WDECallbackUpdate setClipMergedInDock
;
117 static WDECallbackUpdate setWrapAppiconsInDock
;
118 static WDECallbackUpdate setStickyIcons
;
119 static WDECallbackUpdate setWidgetColor
;
120 static WDECallbackUpdate setIconTile
;
121 static WDECallbackUpdate setWinTitleFont
;
122 static WDECallbackUpdate setMenuTitleFont
;
123 static WDECallbackUpdate setMenuTextFont
;
124 static WDECallbackUpdate setIconTitleFont
;
125 static WDECallbackUpdate setIconTitleColor
;
126 static WDECallbackUpdate setIconTitleBack
;
127 static WDECallbackUpdate setFrameBorderWidth
;
128 static WDECallbackUpdate setFrameBorderColor
;
129 static WDECallbackUpdate setFrameFocusedBorderColor
;
130 static WDECallbackUpdate setFrameSelectedBorderColor
;
131 static WDECallbackUpdate setLargeDisplayFont
;
132 static WDECallbackUpdate setWTitleColor
;
133 static WDECallbackUpdate setFTitleBack
;
134 static WDECallbackUpdate setPTitleBack
;
135 static WDECallbackUpdate setUTitleBack
;
136 static WDECallbackUpdate setResizebarBack
;
137 static WDECallbackUpdate setWorkspaceBack
;
138 static WDECallbackUpdate setWorkspaceSpecificBack
;
139 static WDECallbackUpdate setMenuTitleColor
;
140 static WDECallbackUpdate setMenuTextColor
;
141 static WDECallbackUpdate setMenuDisabledColor
;
142 static WDECallbackUpdate setMenuTitleBack
;
143 static WDECallbackUpdate setMenuTextBack
;
144 static WDECallbackUpdate setHightlight
;
145 static WDECallbackUpdate setHightlightText
;
146 static WDECallbackUpdate setKeyGrab
;
147 static WDECallbackUpdate setDoubleClick
;
148 static WDECallbackUpdate setIconPosition
;
149 static WDECallbackUpdate setWorkspaceMapBackground
;
151 static WDECallbackUpdate setClipTitleFont
;
152 static WDECallbackUpdate setClipTitleColor
;
154 static WDECallbackUpdate setMenuStyle
;
155 static WDECallbackUpdate setSwPOptions
;
156 static WDECallbackUpdate updateUsableArea
;
158 static WDECallbackUpdate setModifierKeyLabels
;
160 static WDECallbackConvert getCursor
;
161 static WDECallbackUpdate setCursor
;
164 * Tables to convert strings to enumeration values.
165 * Values stored are char
168 /* WARNING: sum of length of all value strings must not exceed
170 #define TOTAL_VALUES_LENGTH 80
172 #define REFRESH_WINDOW_TEXTURES (1<<0)
173 #define REFRESH_MENU_TEXTURE (1<<1)
174 #define REFRESH_MENU_FONT (1<<2)
175 #define REFRESH_MENU_COLOR (1<<3)
176 #define REFRESH_MENU_TITLE_TEXTURE (1<<4)
177 #define REFRESH_MENU_TITLE_FONT (1<<5)
178 #define REFRESH_MENU_TITLE_COLOR (1<<6)
179 #define REFRESH_WINDOW_TITLE_COLOR (1<<7)
180 #define REFRESH_WINDOW_FONT (1<<8)
181 #define REFRESH_ICON_TILE (1<<9)
182 #define REFRESH_ICON_FONT (1<<10)
183 #define REFRESH_WORKSPACE_BACK (1<<11)
185 #define REFRESH_BUTTON_IMAGES (1<<12)
187 #define REFRESH_ICON_TITLE_COLOR (1<<13)
188 #define REFRESH_ICON_TITLE_BACK (1<<14)
190 #define REFRESH_WORKSPACE_MENU (1<<15)
192 #define REFRESH_FRAME_BORDER REFRESH_MENU_FONT|REFRESH_WINDOW_FONT
194 static WOptionEnumeration seFocusModes
[] = {
195 {"Manual", WKF_CLICK
, 0}, {"ClickToFocus", WKF_CLICK
, 1},
196 {"Sloppy", WKF_SLOPPY
, 0}, {"SemiAuto", WKF_SLOPPY
, 1}, {"Auto", WKF_SLOPPY
, 1},
200 static WOptionEnumeration seTitlebarModes
[] = {
201 {"new", TS_NEW
, 0}, {"old", TS_OLD
, 0},
202 {"next", TS_NEXT
, 0}, {NULL
, 0, 0}
205 static WOptionEnumeration seColormapModes
[] = {
206 {"Manual", WCM_CLICK
, 0}, {"ClickToFocus", WCM_CLICK
, 1},
207 {"Auto", WCM_POINTER
, 0}, {"FocusFollowMouse", WCM_POINTER
, 1},
211 static WOptionEnumeration sePlacements
[] = {
212 {"Auto", WPM_AUTO
, 0},
213 {"Smart", WPM_SMART
, 0},
214 {"Cascade", WPM_CASCADE
, 0},
215 {"Random", WPM_RANDOM
, 0},
216 {"Manual", WPM_MANUAL
, 0},
217 {"Center", WPM_CENTER
, 0},
221 static WOptionEnumeration seGeomDisplays
[] = {
222 {"None", WDIS_NONE
, 0},
223 {"Center", WDIS_CENTER
, 0},
224 {"Corner", WDIS_TOPLEFT
, 0},
225 {"Floating", WDIS_FRAME_CENTER
, 0},
226 {"Line", WDIS_NEW
, 0},
230 static WOptionEnumeration seSpeeds
[] = {
231 {"UltraFast", SPEED_ULTRAFAST
, 0},
232 {"Fast", SPEED_FAST
, 0},
233 {"Medium", SPEED_MEDIUM
, 0},
234 {"Slow", SPEED_SLOW
, 0},
235 {"UltraSlow", SPEED_ULTRASLOW
, 0},
239 static WOptionEnumeration seMouseButtonActions
[] = {
240 {"None", WA_NONE
, 0},
241 {"SelectWindows", WA_SELECT_WINDOWS
, 0},
242 {"OpenApplicationsMenu", WA_OPEN_APPMENU
, 0},
243 {"OpenWindowListMenu", WA_OPEN_WINLISTMENU
, 0},
244 {"MoveToPrevWorkspace", WA_MOVE_PREVWORKSPACE
, 0},
245 {"MoveToNextWorkspace", WA_MOVE_NEXTWORKSPACE
, 0},
246 {"MoveToPrevWindow", WA_MOVE_PREVWINDOW
, 0},
247 {"MoveToNextWindow", WA_MOVE_NEXTWINDOW
, 0},
251 static WOptionEnumeration seMouseWheelActions
[] = {
252 {"None", WA_NONE
, 0},
253 {"SwitchWorkspaces", WA_SWITCH_WORKSPACES
, 0},
254 {"SwitchWindows", WA_SWITCH_WINDOWS
, 0},
258 static WOptionEnumeration seIconificationStyles
[] = {
259 {"Zoom", WIS_ZOOM
, 0},
260 {"Twist", WIS_TWIST
, 0},
261 {"Flip", WIS_FLIP
, 0},
262 {"None", WIS_NONE
, 0},
263 {"random", WIS_RANDOM
, 0},
267 static WOptionEnumeration seJustifications
[] = {
268 {"Left", WTJ_LEFT
, 0},
269 {"Center", WTJ_CENTER
, 0},
270 {"Right", WTJ_RIGHT
, 0},
274 static WOptionEnumeration seIconPositions
[] = {
275 {"blv", IY_BOTTOM
| IY_LEFT
| IY_VERT
, 0},
276 {"blh", IY_BOTTOM
| IY_LEFT
| IY_HORIZ
, 0},
277 {"brv", IY_BOTTOM
| IY_RIGHT
| IY_VERT
, 0},
278 {"brh", IY_BOTTOM
| IY_RIGHT
| IY_HORIZ
, 0},
279 {"tlv", IY_TOP
| IY_LEFT
| IY_VERT
, 0},
280 {"tlh", IY_TOP
| IY_LEFT
| IY_HORIZ
, 0},
281 {"trv", IY_TOP
| IY_RIGHT
| IY_VERT
, 0},
282 {"trh", IY_TOP
| IY_RIGHT
| IY_HORIZ
, 0},
286 static WOptionEnumeration seMenuStyles
[] = {
287 {"normal", MS_NORMAL
, 0},
288 {"singletexture", MS_SINGLE_TEXTURE
, 0},
289 {"flat", MS_FLAT
, 0},
293 static WOptionEnumeration seDisplayPositions
[] = {
294 {"none", WD_NONE
, 0},
295 {"center", WD_CENTER
, 0},
297 {"bottom", WD_BOTTOM
, 0},
298 {"topleft", WD_TOPLEFT
, 0},
299 {"topright", WD_TOPRIGHT
, 0},
300 {"bottomleft", WD_BOTTOMLEFT
, 0},
301 {"bottomright", WD_BOTTOMRIGHT
, 0},
305 static WOptionEnumeration seWorkspaceBorder
[] = {
306 {"None", WB_NONE
, 0},
307 {"LeftRight", WB_LEFTRIGHT
, 0},
308 {"TopBottom", WB_TOPBOTTOM
, 0},
309 {"AllDirections", WB_ALLDIRS
, 0},
313 static WOptionEnumeration seDragMaximizedWindow
[] = {
314 {"Move", DRAGMAX_MOVE
, 0},
315 {"RestoreGeometry", DRAGMAX_RESTORE
, 0},
316 {"Unmaximize", DRAGMAX_UNMAXIMIZE
, 0},
317 {"NoMove", DRAGMAX_NOMOVE
, 0},
322 * Backward Compatibility:
323 * The Mini-Previews were introduced in 0.95.6 under the name "Apercu".
324 * For compatibility, we still support the old names in configuration files,
325 * which are loaded in this structure, so this should stay for at least
326 * 2 years (that means until 2017) */
330 } legacy_minipreview_config
;
333 * ALL entries in the tables bellow, NEED to have a default value
334 * defined, and this value needs to be correct.
337 /* these options will only affect the window manager on startup
339 * static defaults can't access the screen data, because it is
340 * created after these defaults are read
342 WDefaultEntry staticOptionList
[] = {
344 {"ColormapSize", "4", NULL
,
345 &wPreferences
.cmap_size
, getInt
, NULL
, NULL
, NULL
},
346 {"DisableDithering", "NO", NULL
,
347 &wPreferences
.no_dithering
, getBool
, NULL
, NULL
, NULL
},
348 {"IconSize", "64", NULL
,
349 &wPreferences
.icon_size
, getInt
, NULL
, NULL
, NULL
},
350 {"ModifierKey", "Mod1", NULL
,
351 &wPreferences
.modifier_mask
, getModMask
, NULL
, NULL
, NULL
},
352 {"FocusMode", "manual", seFocusModes
, /* have a problem when switching from */
353 &wPreferences
.focus_mode
, getEnum
, NULL
, NULL
, NULL
}, /* manual to sloppy without restart */
354 {"NewStyle", "new", seTitlebarModes
,
355 &wPreferences
.new_style
, getEnum
, NULL
, NULL
, NULL
},
356 {"DisableDock", "NO", (void *)WM_DOCK
,
357 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
358 {"DisableClip", "NO", (void *)WM_CLIP
,
359 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
360 {"DisableDrawers", "NO", (void *)WM_DRAWER
,
361 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
362 {"ClipMergedInDock", "NO", NULL
,
363 NULL
, getBool
, setClipMergedInDock
, NULL
, NULL
},
364 {"DisableMiniwindows", "NO", NULL
,
365 &wPreferences
.disable_miniwindows
, getBool
, NULL
, NULL
, NULL
},
366 {"EnableWorkspacePager", "NO", NULL
,
367 &wPreferences
.enable_workspace_pager
, getBool
, NULL
, NULL
, NULL
}
370 #define NUM2STRING_(x) #x
371 #define NUM2STRING(x) NUM2STRING_(x)
373 WDefaultEntry optionList
[] = {
375 /* dynamic options */
377 {"IconPosition", "blh", seIconPositions
,
378 &wPreferences
.icon_yard
, getEnum
, setIconPosition
, NULL
, NULL
},
379 {"IconificationStyle", "Zoom", seIconificationStyles
,
380 &wPreferences
.iconification_style
, getEnum
, NULL
, NULL
, NULL
},
381 {"DisableWSMouseActions", "NO", NULL
,
382 &wPreferences
.disable_root_mouse
, getBool
, NULL
, NULL
, NULL
},
383 {"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions
,
384 &wPreferences
.mouse_button1
, getEnum
, NULL
, NULL
, NULL
},
385 {"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions
,
386 &wPreferences
.mouse_button2
, getEnum
, NULL
, NULL
, NULL
},
387 {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions
,
388 &wPreferences
.mouse_button3
, getEnum
, NULL
, NULL
, NULL
},
389 {"MouseBackwardButtonAction", "None", seMouseButtonActions
,
390 &wPreferences
.mouse_button8
, getEnum
, NULL
, NULL
, NULL
},
391 {"MouseForwardButtonAction", "None", seMouseButtonActions
,
392 &wPreferences
.mouse_button9
, getEnum
, NULL
, NULL
, NULL
},
393 {"MouseWheelAction", "None", seMouseWheelActions
,
394 &wPreferences
.mouse_wheel_scroll
, getEnum
, NULL
, NULL
, NULL
},
395 {"MouseWheelTiltAction", "None", seMouseWheelActions
,
396 &wPreferences
.mouse_wheel_tilt
, getEnum
, NULL
, NULL
, NULL
},
397 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
398 &wPreferences
.pixmap_path
, getPathList
, NULL
, NULL
, NULL
},
399 {"IconPath", DEF_ICON_PATHS
, NULL
,
400 &wPreferences
.icon_path
, getPathList
, NULL
, NULL
, NULL
},
401 {"ColormapMode", "auto", seColormapModes
,
402 &wPreferences
.colormap_mode
, getEnum
, NULL
, NULL
, NULL
},
403 {"AutoFocus", "NO", NULL
,
404 &wPreferences
.auto_focus
, getBool
, NULL
, NULL
, NULL
},
405 {"RaiseDelay", "0", NULL
,
406 &wPreferences
.raise_delay
, getInt
, NULL
, NULL
, NULL
},
407 {"CirculateRaise", "NO", NULL
,
408 &wPreferences
.circ_raise
, getBool
, NULL
, NULL
, NULL
},
409 {"Superfluous", "NO", NULL
,
410 &wPreferences
.superfluous
, getBool
, NULL
, NULL
, NULL
},
411 {"AdvanceToNewWorkspace", "NO", NULL
,
412 &wPreferences
.ws_advance
, getBool
, NULL
, NULL
, NULL
},
413 {"CycleWorkspaces", "NO", NULL
,
414 &wPreferences
.ws_cycle
, getBool
, NULL
, NULL
, NULL
},
415 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
416 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
, NULL
, NULL
},
417 {"WorkspaceBorder", "None", seWorkspaceBorder
,
418 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
, NULL
, NULL
},
419 {"WorkspaceBorderSize", "0", NULL
,
420 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
, NULL
, NULL
},
421 {"StickyIcons", "NO", NULL
,
422 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
, NULL
, NULL
},
423 {"SaveSessionOnExit", "NO", NULL
,
424 &wPreferences
.save_session_on_exit
, getBool
, NULL
, NULL
, NULL
},
425 {"WrapMenus", "NO", NULL
,
426 &wPreferences
.wrap_menus
, getBool
, NULL
, NULL
, NULL
},
427 {"ScrollableMenus", "NO", NULL
,
428 &wPreferences
.scrollable_menus
, getBool
, NULL
, NULL
, NULL
},
429 {"MenuScrollSpeed", "medium", seSpeeds
,
430 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
, NULL
, NULL
},
431 {"IconSlideSpeed", "medium", seSpeeds
,
432 &wPreferences
.icon_slide_speed
, getEnum
, NULL
, NULL
, NULL
},
433 {"ShadeSpeed", "medium", seSpeeds
,
434 &wPreferences
.shade_speed
, getEnum
, NULL
, NULL
, NULL
},
435 {"BounceAppIconsWhenUrgent", "YES", NULL
,
436 &wPreferences
.bounce_appicons_when_urgent
, getBool
, NULL
, NULL
, NULL
},
437 {"RaiseAppIconsWhenBouncing", "NO", NULL
,
438 &wPreferences
.raise_appicons_when_bouncing
, getBool
, NULL
, NULL
, NULL
},
439 {"DoNotMakeAppIconsBounce", "NO", NULL
,
440 &wPreferences
.do_not_make_appicons_bounce
, getBool
, NULL
, NULL
, NULL
},
441 {"DoubleClickTime", "250", (void *)&wPreferences
.dblclick_time
,
442 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
, NULL
, NULL
},
443 {"ClipAutoraiseDelay", "600", NULL
,
444 &wPreferences
.clip_auto_raise_delay
, getInt
, NULL
, NULL
, NULL
},
445 {"ClipAutolowerDelay", "1000", NULL
,
446 &wPreferences
.clip_auto_lower_delay
, getInt
, NULL
, NULL
, NULL
},
447 {"ClipAutoexpandDelay", "600", NULL
,
448 &wPreferences
.clip_auto_expand_delay
, getInt
, NULL
, NULL
, NULL
},
449 {"ClipAutocollapseDelay", "1000", NULL
,
450 &wPreferences
.clip_auto_collapse_delay
, getInt
, NULL
, NULL
, NULL
},
451 {"WrapAppiconsInDock", "YES", NULL
,
452 NULL
, getBool
, setWrapAppiconsInDock
, NULL
, NULL
},
453 {"AlignSubmenus", "NO", NULL
,
454 &wPreferences
.align_menus
, getBool
, NULL
, NULL
, NULL
},
455 {"ViKeyMenus", "NO", NULL
,
456 &wPreferences
.vi_key_menus
, getBool
, NULL
, NULL
, NULL
},
457 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
458 &wPreferences
.open_transients_with_parent
, getBool
, NULL
, NULL
, NULL
},
459 {"WindowPlacement", "auto", sePlacements
,
460 &wPreferences
.window_placement
, getEnum
, NULL
, NULL
, NULL
},
461 {"IgnoreFocusClick", "NO", NULL
,
462 &wPreferences
.ignore_focus_click
, getBool
, NULL
, NULL
, NULL
},
463 {"UseSaveUnders", "NO", NULL
,
464 &wPreferences
.use_saveunders
, getBool
, NULL
, NULL
, NULL
},
465 {"OpaqueMove", "NO", NULL
,
466 &wPreferences
.opaque_move
, getBool
, NULL
, NULL
, NULL
},
467 {"OpaqueResize", "NO", NULL
,
468 &wPreferences
.opaque_resize
, getBool
, NULL
, NULL
, NULL
},
469 {"OpaqueMoveResizeKeyboard", "NO", NULL
,
470 &wPreferences
.opaque_move_resize_keyboard
, getBool
, NULL
, NULL
, NULL
},
471 {"DisableAnimations", "NO", NULL
,
472 &wPreferences
.no_animations
, getBool
, NULL
, NULL
, NULL
},
473 {"DontLinkWorkspaces", "NO", NULL
,
474 &wPreferences
.no_autowrap
, getBool
, NULL
, NULL
, NULL
},
475 {"WindowSnapping", "NO", NULL
,
476 &wPreferences
.window_snapping
, getBool
, NULL
, NULL
, NULL
},
477 {"SnapEdgeDetect", "1", NULL
,
478 &wPreferences
.snap_edge_detect
, getInt
, NULL
, NULL
, NULL
},
479 {"SnapCornerDetect", "10", NULL
,
480 &wPreferences
.snap_corner_detect
, getInt
, NULL
, NULL
, NULL
},
481 {"SnapToTopMaximizesFullscreen", "NO", NULL
,
482 &wPreferences
.snap_to_top_maximizes_fullscreen
, getBool
, NULL
, NULL
, NULL
},
483 {"DragMaximizedWindow", "Move", seDragMaximizedWindow
,
484 &wPreferences
.drag_maximized_window
, getEnum
, NULL
, NULL
, NULL
},
485 {"HighlightActiveApp", "YES", NULL
,
486 &wPreferences
.highlight_active_app
, getBool
, NULL
, NULL
, NULL
},
487 {"AutoArrangeIcons", "NO", NULL
,
488 &wPreferences
.auto_arrange_icons
, getBool
, NULL
, NULL
, NULL
},
489 {"NoWindowOverDock", "NO", NULL
,
490 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
, NULL
, NULL
},
491 {"NoWindowOverIcons", "NO", NULL
,
492 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
, NULL
, NULL
},
493 {"WindowPlaceOrigin", "(0, 0)", NULL
,
494 &wPreferences
.window_place_origin
, getCoord
, NULL
, NULL
, NULL
},
495 {"ResizeDisplay", "corner", seGeomDisplays
,
496 &wPreferences
.size_display
, getEnum
, NULL
, NULL
, NULL
},
497 {"MoveDisplay", "corner", seGeomDisplays
,
498 &wPreferences
.move_display
, getEnum
, NULL
, NULL
, NULL
},
499 {"DontConfirmKill", "NO", NULL
,
500 &wPreferences
.dont_confirm_kill
, getBool
, NULL
, NULL
, NULL
},
501 {"WindowTitleBalloons", "NO", NULL
,
502 &wPreferences
.window_balloon
, getBool
, NULL
, NULL
, NULL
},
503 {"MiniwindowTitleBalloons", "NO", NULL
,
504 &wPreferences
.miniwin_title_balloon
, getBool
, NULL
, NULL
, NULL
},
505 {"MiniwindowPreviewBalloons", "NO", NULL
,
506 &wPreferences
.miniwin_preview_balloon
, getBool
, NULL
, NULL
, NULL
},
507 {"AppIconBalloons", "NO", NULL
,
508 &wPreferences
.appicon_balloon
, getBool
, NULL
, NULL
, NULL
},
509 {"HelpBalloons", "NO", NULL
,
510 &wPreferences
.help_balloon
, getBool
, NULL
, NULL
, NULL
},
511 {"EdgeResistance", "30", NULL
,
512 &wPreferences
.edge_resistance
, getInt
, NULL
, NULL
, NULL
},
513 {"ResizeIncrement", "0", NULL
,
514 &wPreferences
.resize_increment
, getInt
, NULL
, NULL
, NULL
},
515 {"Attraction", "NO", NULL
,
516 &wPreferences
.attract
, getBool
, NULL
, NULL
, NULL
},
517 {"DisableBlinking", "NO", NULL
,
518 &wPreferences
.dont_blink
, getBool
, NULL
, NULL
, NULL
},
519 {"SingleClickLaunch", "NO", NULL
,
520 &wPreferences
.single_click
, getBool
, NULL
, NULL
, NULL
},
521 {"StrictWindozeCycle", "YES", NULL
,
522 &wPreferences
.strict_windoze_cycle
, getBool
, NULL
, NULL
, NULL
},
523 {"SwitchPanelOnlyOpen", "NO", NULL
,
524 &wPreferences
.panel_only_open
, getBool
, NULL
, NULL
, NULL
},
525 {"MiniPreviewSize", "128", NULL
,
526 &wPreferences
.minipreview_size
, getInt
, NULL
, NULL
, NULL
},
527 {"IgnoreGtkHints", "NO", NULL
,
528 &wPreferences
.ignore_gtk_decoration_hints
, getBool
, NULL
, NULL
, NULL
},
531 * Backward Compatibility:
532 * The Mini-Previews were introduced in 0.95.6 under the name "Apercu".
533 * For compatibility, we still support the old names in configuration files,
534 * so this should stay for at least 2 years (that means until 2017)
536 {"MiniwindowApercuBalloons", "NO", NULL
,
537 &legacy_minipreview_config
.enable
, getBool
, NULL
, NULL
, NULL
},
538 {"ApercuSize", "0", NULL
,
539 &legacy_minipreview_config
.size
, getInt
, NULL
, NULL
, NULL
},
543 {"MenuStyle", "normal", seMenuStyles
,
544 &wPreferences
.menu_style
, getEnum
, setMenuStyle
, NULL
, NULL
},
545 {"WidgetColor", "(solid, gray)", NULL
,
546 NULL
, getTexture
, setWidgetColor
, NULL
, NULL
},
547 {"WorkspaceSpecificBack", "()", NULL
,
548 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
, NULL
, NULL
},
549 /* WorkspaceBack must come after WorkspaceSpecificBack or
550 * WorkspaceBack won't know WorkspaceSpecificBack was also
551 * specified and 2 copies of wmsetbg will be launched */
552 {"WorkspaceBack", "(solid, black)", NULL
,
553 NULL
, getWSBackground
, setWorkspaceBack
, NULL
, NULL
},
554 {"SmoothWorkspaceBack", "NO", NULL
,
555 NULL
, getBool
, NULL
, NULL
, NULL
},
556 {"IconBack", "(solid, gray)", NULL
,
557 NULL
, getTexture
, setIconTile
, NULL
, NULL
},
558 {"TitleJustify", "center", seJustifications
,
559 &wPreferences
.title_justification
, getEnum
, setJustify
, NULL
, NULL
},
560 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
561 NULL
, getFont
, setWinTitleFont
, NULL
, NULL
},
562 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
563 &wPreferences
.window_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
564 {"WindowTitleMinHeight", "0", NULL
,
565 &wPreferences
.window_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
566 {"WindowTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
567 &wPreferences
.window_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
568 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
569 &wPreferences
.menu_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
570 {"MenuTitleMinHeight", "0", NULL
,
571 &wPreferences
.menu_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
572 {"MenuTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
573 &wPreferences
.menu_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
574 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
575 &wPreferences
.menu_text_clearance
, getInt
, setClearance
, NULL
, NULL
},
576 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
577 NULL
, getFont
, setMenuTitleFont
, NULL
, NULL
},
578 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
579 NULL
, getFont
, setMenuTextFont
, NULL
, NULL
},
580 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
581 NULL
, getFont
, setIconTitleFont
, NULL
, NULL
},
582 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
583 NULL
, getFont
, setClipTitleFont
, NULL
, NULL
},
584 {"ShowClipTitle", "YES", NULL
,
585 &wPreferences
.show_clip_title
, getBool
, NULL
, NULL
, NULL
},
586 {"LargeDisplayFont", DEF_WORKSPACE_NAME_FONT
, NULL
,
587 NULL
, getFont
, setLargeDisplayFont
, NULL
, NULL
},
588 {"HighlightColor", "white", NULL
,
589 NULL
, getColor
, setHightlight
, NULL
, NULL
},
590 {"HighlightTextColor", "black", NULL
,
591 NULL
, getColor
, setHightlightText
, NULL
, NULL
},
592 {"ClipTitleColor", "black", (void *)CLIP_NORMAL
,
593 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
594 {"CClipTitleColor", "\"#454045\"", (void *)CLIP_COLLAPSED
,
595 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
596 {"FTitleColor", "white", (void *)WS_FOCUSED
,
597 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
598 {"PTitleColor", "white", (void *)WS_PFOCUSED
,
599 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
600 {"UTitleColor", "black", (void *)WS_UNFOCUSED
,
601 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
602 {"FTitleBack", "(solid, black)", NULL
,
603 NULL
, getTexture
, setFTitleBack
, NULL
, NULL
},
604 {"PTitleBack", "(solid, \"#616161\")", NULL
,
605 NULL
, getTexture
, setPTitleBack
, NULL
, NULL
},
606 {"UTitleBack", "(solid, gray)", NULL
,
607 NULL
, getTexture
, setUTitleBack
, NULL
, NULL
},
608 {"ResizebarBack", "(solid, gray)", NULL
,
609 NULL
, getTexture
, setResizebarBack
, NULL
, NULL
},
610 {"MenuTitleColor", "white", NULL
,
611 NULL
, getColor
, setMenuTitleColor
, NULL
, NULL
},
612 {"MenuTextColor", "black", NULL
,
613 NULL
, getColor
, setMenuTextColor
, NULL
, NULL
},
614 {"MenuDisabledColor", "\"#616161\"", NULL
,
615 NULL
, getColor
, setMenuDisabledColor
, NULL
, NULL
},
616 {"MenuTitleBack", "(solid, black)", NULL
,
617 NULL
, getTexture
, setMenuTitleBack
, NULL
, NULL
},
618 {"MenuTextBack", "(solid, gray)", NULL
,
619 NULL
, getTexture
, setMenuTextBack
, NULL
, NULL
},
620 {"IconTitleColor", "white", NULL
,
621 NULL
, getColor
, setIconTitleColor
, NULL
, NULL
},
622 {"IconTitleBack", "black", NULL
,
623 NULL
, getColor
, setIconTitleBack
, NULL
, NULL
},
624 {"SwitchPanelImages", "(swtile.png, swback.png, 30, 40)", &wPreferences
,
625 NULL
, getPropList
, setSwPOptions
, NULL
, NULL
},
626 {"ModifierKeyLabels", "(\"Shift+\", \"Control+\", \"Mod1+\", \"Mod2+\", \"Mod3+\", \"Mod4+\", \"Mod5+\")", &wPreferences
,
627 NULL
, getPropList
, setModifierKeyLabels
, NULL
, NULL
},
628 {"FrameBorderWidth", "1", NULL
,
629 NULL
, getInt
, setFrameBorderWidth
, NULL
, NULL
},
630 {"FrameBorderColor", "black", NULL
,
631 NULL
, getColor
, setFrameBorderColor
, NULL
, NULL
},
632 {"FrameFocusedBorderColor", "black", NULL
,
633 NULL
, getColor
, setFrameFocusedBorderColor
, NULL
, NULL
},
634 {"FrameSelectedBorderColor", "white", NULL
,
635 NULL
, getColor
, setFrameSelectedBorderColor
, NULL
, NULL
},
636 {"WorkspaceMapBack", "(solid, black)", NULL
,
637 NULL
, getTexture
, setWorkspaceMapBackground
, NULL
, NULL
},
641 {"RootMenuKey", "None", (void *)WKBD_ROOTMENU
,
642 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
643 {"WindowListKey", "None", (void *)WKBD_WINDOWLIST
,
644 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
645 {"WindowMenuKey", "None", (void *)WKBD_WINDOWMENU
,
646 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
647 {"DockRaiseLowerKey", "None", (void*)WKBD_DOCKRAISELOWER
,
648 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
649 {"ClipRaiseLowerKey", "None", (void *)WKBD_CLIPRAISELOWER
,
650 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
651 {"MiniaturizeKey", "None", (void *)WKBD_MINIATURIZE
,
652 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
653 {"MinimizeAllKey", "None", (void *)WKBD_MINIMIZEALL
,
654 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
655 {"HideKey", "None", (void *)WKBD_HIDE
,
656 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
657 {"HideOthersKey", "None", (void *)WKBD_HIDE_OTHERS
,
658 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
659 {"MoveResizeKey", "None", (void *)WKBD_MOVERESIZE
,
660 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
661 {"CloseKey", "None", (void *)WKBD_CLOSE
,
662 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
663 {"MaximizeKey", "None", (void *)WKBD_MAXIMIZE
,
664 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
665 {"VMaximizeKey", "None", (void *)WKBD_VMAXIMIZE
,
666 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
667 {"HMaximizeKey", "None", (void *)WKBD_HMAXIMIZE
,
668 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
669 {"LHMaximizeKey", "None", (void*)WKBD_LHMAXIMIZE
,
670 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
671 {"RHMaximizeKey", "None", (void*)WKBD_RHMAXIMIZE
,
672 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
673 {"THMaximizeKey", "None", (void*)WKBD_THMAXIMIZE
,
674 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
675 {"BHMaximizeKey", "None", (void*)WKBD_BHMAXIMIZE
,
676 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
677 {"LTCMaximizeKey", "None", (void*)WKBD_LTCMAXIMIZE
,
678 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
679 {"RTCMaximizeKey", "None", (void*)WKBD_RTCMAXIMIZE
,
680 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
681 {"LBCMaximizeKey", "None", (void*)WKBD_LBCMAXIMIZE
,
682 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
683 {"RBCMaximizeKey", "None", (void*)WKBD_RBCMAXIMIZE
,
684 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
685 {"MaximusKey", "None", (void*)WKBD_MAXIMUS
,
686 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
687 {"OmnipresentKey", "None", (void *)WKBD_OMNIPRESENT
,
688 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
689 {"RaiseKey", "\"Meta+Up\"", (void *)WKBD_RAISE
,
690 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
691 {"LowerKey", "\"Meta+Down\"", (void *)WKBD_LOWER
,
692 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
693 {"RaiseLowerKey", "None", (void *)WKBD_RAISELOWER
,
694 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
695 {"ShadeKey", "None", (void *)WKBD_SHADE
,
696 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
697 {"SelectKey", "None", (void *)WKBD_SELECT
,
698 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
699 {"WorkspaceMapKey", "None", (void *)WKBD_WORKSPACEMAP
,
700 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
701 {"FocusNextKey", "None", (void *)WKBD_FOCUSNEXT
,
702 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
703 {"FocusPrevKey", "None", (void *)WKBD_FOCUSPREV
,
704 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
705 {"GroupNextKey", "None", (void *)WKBD_GROUPNEXT
,
706 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
707 {"GroupPrevKey", "None", (void *)WKBD_GROUPPREV
,
708 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
709 {"NextWorkspaceKey", "None", (void *)WKBD_NEXTWORKSPACE
,
710 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
711 {"PrevWorkspaceKey", "None", (void *)WKBD_PREVWORKSPACE
,
712 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
713 {"LastWorkspaceKey", "None", (void *)WKBD_LASTWORKSPACE
,
714 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
715 {"NextWorkspaceLayerKey", "None", (void *)WKBD_NEXTWSLAYER
,
716 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
717 {"PrevWorkspaceLayerKey", "None", (void *)WKBD_PREVWSLAYER
,
718 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
719 {"Workspace1Key", "None", (void *)WKBD_WORKSPACE1
,
720 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
721 {"Workspace2Key", "None", (void *)WKBD_WORKSPACE2
,
722 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
723 {"Workspace3Key", "None", (void *)WKBD_WORKSPACE3
,
724 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
725 {"Workspace4Key", "None", (void *)WKBD_WORKSPACE4
,
726 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
727 {"Workspace5Key", "None", (void *)WKBD_WORKSPACE5
,
728 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
729 {"Workspace6Key", "None", (void *)WKBD_WORKSPACE6
,
730 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
731 {"Workspace7Key", "None", (void *)WKBD_WORKSPACE7
,
732 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
733 {"Workspace8Key", "None", (void *)WKBD_WORKSPACE8
,
734 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
735 {"Workspace9Key", "None", (void *)WKBD_WORKSPACE9
,
736 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
737 {"Workspace10Key", "None", (void *)WKBD_WORKSPACE10
,
738 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
739 {"MoveToWorkspace1Key", "None", (void *)WKBD_MOVE_WORKSPACE1
,
740 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
741 {"MoveToWorkspace2Key", "None", (void *)WKBD_MOVE_WORKSPACE2
,
742 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
743 {"MoveToWorkspace3Key", "None", (void *)WKBD_MOVE_WORKSPACE3
,
744 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
745 {"MoveToWorkspace4Key", "None", (void *)WKBD_MOVE_WORKSPACE4
,
746 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
747 {"MoveToWorkspace5Key", "None", (void *)WKBD_MOVE_WORKSPACE5
,
748 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
749 {"MoveToWorkspace6Key", "None", (void *)WKBD_MOVE_WORKSPACE6
,
750 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
751 {"MoveToWorkspace7Key", "None", (void *)WKBD_MOVE_WORKSPACE7
,
752 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
753 {"MoveToWorkspace8Key", "None", (void *)WKBD_MOVE_WORKSPACE8
,
754 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
755 {"MoveToWorkspace9Key", "None", (void *)WKBD_MOVE_WORKSPACE9
,
756 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
757 {"MoveToWorkspace10Key", "None", (void *)WKBD_MOVE_WORKSPACE10
,
758 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
759 {"MoveToNextWorkspaceKey", "None", (void *)WKBD_MOVE_NEXTWORKSPACE
,
760 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
761 {"MoveToPrevWorkspaceKey", "None", (void *)WKBD_MOVE_PREVWORKSPACE
,
762 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
763 {"MoveToLastWorkspaceKey", "None", (void *)WKBD_MOVE_LASTWORKSPACE
,
764 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
765 {"MoveToNextWorkspaceLayerKey", "None", (void *)WKBD_MOVE_NEXTWSLAYER
,
766 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
767 {"MoveToPrevWorkspaceLayerKey", "None", (void *)WKBD_MOVE_PREVWSLAYER
,
768 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
769 {"WindowShortcut1Key", "None", (void *)WKBD_WINDOW1
,
770 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
771 {"WindowShortcut2Key", "None", (void *)WKBD_WINDOW2
,
772 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
773 {"WindowShortcut3Key", "None", (void *)WKBD_WINDOW3
,
774 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
775 {"WindowShortcut4Key", "None", (void *)WKBD_WINDOW4
,
776 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
777 {"WindowShortcut5Key", "None", (void *)WKBD_WINDOW5
,
778 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
779 {"WindowShortcut6Key", "None", (void *)WKBD_WINDOW6
,
780 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
781 {"WindowShortcut7Key", "None", (void *)WKBD_WINDOW7
,
782 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
783 {"WindowShortcut8Key", "None", (void *)WKBD_WINDOW8
,
784 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
785 {"WindowShortcut9Key", "None", (void *)WKBD_WINDOW9
,
786 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
787 {"WindowShortcut10Key", "None", (void *)WKBD_WINDOW10
,
788 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
789 {"WindowRelaunchKey", "None", (void *)WKBD_RELAUNCH
,
790 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
791 {"ScreenSwitchKey", "None", (void *)WKBD_SWITCH_SCREEN
,
792 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
793 {"RunKey", "None", (void *)WKBD_RUN
,
794 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
796 #ifdef KEEP_XKB_LOCK_STATUS
797 {"ToggleKbdModeKey", "None", (void *)WKBD_TOGGLE
,
798 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
799 {"KbdModeLock", "NO", NULL
,
800 &wPreferences
.modelock
, getBool
, NULL
, NULL
, NULL
},
801 #endif /* KEEP_XKB_LOCK_STATUS */
803 {"NormalCursor", "(builtin, left_ptr)", (void *)WCUR_ROOT
,
804 NULL
, getCursor
, setCursor
, NULL
, NULL
},
805 {"ArrowCursor", "(builtin, top_left_arrow)", (void *)WCUR_ARROW
,
806 NULL
, getCursor
, setCursor
, NULL
, NULL
},
807 {"MoveCursor", "(builtin, fleur)", (void *)WCUR_MOVE
,
808 NULL
, getCursor
, setCursor
, NULL
, NULL
},
809 {"ResizeCursor", "(builtin, sizing)", (void *)WCUR_RESIZE
,
810 NULL
, getCursor
, setCursor
, NULL
, NULL
},
811 {"TopLeftResizeCursor", "(builtin, top_left_corner)", (void *)WCUR_TOPLEFTRESIZE
,
812 NULL
, getCursor
, setCursor
, NULL
, NULL
},
813 {"TopRightResizeCursor", "(builtin, top_right_corner)", (void *)WCUR_TOPRIGHTRESIZE
,
814 NULL
, getCursor
, setCursor
, NULL
, NULL
},
815 {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)", (void *)WCUR_BOTTOMLEFTRESIZE
,
816 NULL
, getCursor
, setCursor
, NULL
, NULL
},
817 {"BottomRightResizeCursor", "(builtin, bottom_right_corner)", (void *)WCUR_BOTTOMRIGHTRESIZE
,
818 NULL
, getCursor
, setCursor
, NULL
, NULL
},
819 {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)", (void *)WCUR_VERTICALRESIZE
,
820 NULL
, getCursor
, setCursor
, NULL
, NULL
},
821 {"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)", (void *)WCUR_HORIZONRESIZE
,
822 NULL
, getCursor
, setCursor
, NULL
, NULL
},
823 {"WaitCursor", "(builtin, watch)", (void *)WCUR_WAIT
,
824 NULL
, getCursor
, setCursor
, NULL
, NULL
},
825 {"QuestionCursor", "(builtin, question_arrow)", (void *)WCUR_QUESTION
,
826 NULL
, getCursor
, setCursor
, NULL
, NULL
},
827 {"TextCursor", "(builtin, xterm)", (void *)WCUR_TEXT
,
828 NULL
, getCursor
, setCursor
, NULL
, NULL
},
829 {"SelectCursor", "(builtin, cross)", (void *)WCUR_SELECT
,
830 NULL
, getCursor
, setCursor
, NULL
, NULL
},
831 {"DialogHistoryLines", "500", NULL
,
832 &wPreferences
.history_lines
, getInt
, NULL
, NULL
, NULL
},
833 {"CycleActiveHeadOnly", "NO", NULL
,
834 &wPreferences
.cycle_active_head_only
, getBool
, NULL
, NULL
, NULL
},
835 {"CycleIgnoreMinimized", "NO", NULL
,
836 &wPreferences
.cycle_ignore_minimized
, getBool
, NULL
, NULL
, NULL
}
839 static void initDefaults(void)
842 WDefaultEntry
*entry
;
844 WMPLSetCaseSensitive(False
);
846 for (i
= 0; i
< wlengthof(optionList
); i
++) {
847 entry
= &optionList
[i
];
849 entry
->plkey
= WMCreatePLString(entry
->key
);
850 if (entry
->default_value
)
851 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
853 entry
->plvalue
= NULL
;
856 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
857 entry
= &staticOptionList
[i
];
859 entry
->plkey
= WMCreatePLString(entry
->key
);
860 if (entry
->default_value
)
861 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
863 entry
->plvalue
= NULL
;
867 static WMPropList
*readGlobalDomain(const char *domainName
, Bool requireDictionary
)
869 WMPropList
*globalDict
= NULL
;
873 snprintf(path
, sizeof(path
), "%s/%s/%s", SYSCONFDIR
, GLOBAL_DEFAULTS_SUBDIR
, domainName
);
874 if (stat(path
, &stbuf
) >= 0) {
875 globalDict
= WMReadPropListFromFile(path
);
876 if (globalDict
&& requireDictionary
&& !WMIsPLDictionary(globalDict
)) {
877 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"), domainName
, path
);
878 WMReleasePropList(globalDict
);
880 } else if (!globalDict
) {
881 wwarning(_("could not load domain %s from global defaults database"), domainName
);
888 #if defined(GLOBAL_PREAMBLE_MENU_FILE) || defined(GLOBAL_EPILOGUE_MENU_FILE)
889 static void prependMenu(WMPropList
* destarr
, WMPropList
* array
)
894 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
895 item
= WMGetFromPLArray(array
, i
);
897 WMInsertInPLArray(destarr
, i
+ 1, item
);
901 static void appendMenu(WMPropList
* destarr
, WMPropList
* array
)
906 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
907 item
= WMGetFromPLArray(array
, i
);
909 WMAddToPLArray(destarr
, item
);
914 void wDefaultsMergeGlobalMenus(WDDomain
* menuDomain
)
916 WMPropList
*menu
= menuDomain
->dictionary
;
919 if (!menu
|| !WMIsPLArray(menu
))
922 #ifdef GLOBAL_PREAMBLE_MENU_FILE
923 submenu
= WMReadPropListFromFile(SYSCONFDIR
"/" GLOBAL_DEFAULTS_SUBDIR
"/" GLOBAL_PREAMBLE_MENU_FILE
);
925 if (submenu
&& !WMIsPLArray(submenu
)) {
926 wwarning(_("invalid global menu file %s"), GLOBAL_PREAMBLE_MENU_FILE
);
927 WMReleasePropList(submenu
);
931 prependMenu(menu
, submenu
);
932 WMReleasePropList(submenu
);
936 #ifdef GLOBAL_EPILOGUE_MENU_FILE
937 submenu
= WMReadPropListFromFile(SYSCONFDIR
"/" GLOBAL_DEFAULTS_SUBDIR
"/" GLOBAL_EPILOGUE_MENU_FILE
);
939 if (submenu
&& !WMIsPLArray(submenu
)) {
940 wwarning(_("invalid global menu file %s"), GLOBAL_EPILOGUE_MENU_FILE
);
941 WMReleasePropList(submenu
);
945 appendMenu(menu
, submenu
);
946 WMReleasePropList(submenu
);
950 menuDomain
->dictionary
= menu
;
953 WDDomain
*wDefaultsInitDomain(const char *domain
, Bool requireDictionary
)
957 static int inited
= 0;
958 WMPropList
*shared_dict
= NULL
;
965 db
= wmalloc(sizeof(WDDomain
));
966 db
->domain_name
= domain
;
967 db
->path
= wdefaultspathfordomain(domain
);
969 if (stat(db
->path
, &stbuf
) >= 0) {
970 db
->dictionary
= WMReadPropListFromFile(db
->path
);
971 if (db
->dictionary
) {
972 if (requireDictionary
&& !WMIsPLDictionary(db
->dictionary
)) {
973 WMReleasePropList(db
->dictionary
);
974 db
->dictionary
= NULL
;
975 wwarning(_("Domain %s (%s) of defaults database is corrupted!"), domain
, db
->path
);
977 db
->timestamp
= stbuf
.st_mtime
;
979 wwarning(_("could not load domain %s from user defaults database"), domain
);
983 /* global system dictionary */
984 shared_dict
= readGlobalDomain(domain
, requireDictionary
);
986 if (shared_dict
&& db
->dictionary
&& WMIsPLDictionary(shared_dict
) &&
987 WMIsPLDictionary(db
->dictionary
)) {
988 WMMergePLDictionaries(shared_dict
, db
->dictionary
, True
);
989 WMReleasePropList(db
->dictionary
);
990 db
->dictionary
= shared_dict
;
991 if (stbuf
.st_mtime
> db
->timestamp
)
992 db
->timestamp
= stbuf
.st_mtime
;
993 } else if (!db
->dictionary
) {
994 db
->dictionary
= shared_dict
;
995 if (stbuf
.st_mtime
> db
->timestamp
)
996 db
->timestamp
= stbuf
.st_mtime
;
1002 void wReadStaticDefaults(WMPropList
* dict
)
1004 WMPropList
*plvalue
;
1005 WDefaultEntry
*entry
;
1009 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
1010 entry
= &staticOptionList
[i
];
1013 plvalue
= WMGetFromPLDictionary(dict
, entry
->plkey
);
1017 /* no default in the DB. Use builtin default */
1019 plvalue
= entry
->plvalue
;
1023 (*entry
->convert
) (NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
1025 (*entry
->update
) (NULL
, entry
, tdata
, entry
->extra_data
);
1030 void wDefaultsCheckDomains(void* arg
)
1034 WMPropList
*shared_dict
= NULL
;
1038 /* Parameter not used, but tell the compiler that it is ok */
1041 if (stat(w_global
.domain
.wmaker
->path
, &stbuf
) >= 0 && w_global
.domain
.wmaker
->timestamp
< stbuf
.st_mtime
) {
1042 w_global
.domain
.wmaker
->timestamp
= stbuf
.st_mtime
;
1044 /* Global dictionary */
1045 shared_dict
= readGlobalDomain("WindowMaker", True
);
1047 /* User dictionary */
1048 dict
= WMReadPropListFromFile(w_global
.domain
.wmaker
->path
);
1051 if (!WMIsPLDictionary(dict
)) {
1052 WMReleasePropList(dict
);
1054 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1055 "WindowMaker", w_global
.domain
.wmaker
->path
);
1058 WMMergePLDictionaries(shared_dict
, dict
, True
);
1059 WMReleasePropList(dict
);
1064 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1065 scr
= wScreenWithNumber(i
);
1067 wReadDefaults(scr
, dict
);
1070 if (w_global
.domain
.wmaker
->dictionary
)
1071 WMReleasePropList(w_global
.domain
.wmaker
->dictionary
);
1073 w_global
.domain
.wmaker
->dictionary
= dict
;
1076 wwarning(_("could not load domain %s from user defaults database"), "WindowMaker");
1080 WMReleasePropList(shared_dict
);
1084 if (stat(w_global
.domain
.window_attr
->path
, &stbuf
) >= 0 && w_global
.domain
.window_attr
->timestamp
< stbuf
.st_mtime
) {
1085 /* global dictionary */
1086 shared_dict
= readGlobalDomain("WMWindowAttributes", True
);
1087 /* user dictionary */
1088 dict
= WMReadPropListFromFile(w_global
.domain
.window_attr
->path
);
1090 if (!WMIsPLDictionary(dict
)) {
1091 WMReleasePropList(dict
);
1093 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1094 "WMWindowAttributes", w_global
.domain
.window_attr
->path
);
1097 WMMergePLDictionaries(shared_dict
, dict
, True
);
1098 WMReleasePropList(dict
);
1103 if (w_global
.domain
.window_attr
->dictionary
)
1104 WMReleasePropList(w_global
.domain
.window_attr
->dictionary
);
1106 w_global
.domain
.window_attr
->dictionary
= dict
;
1107 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1108 scr
= wScreenWithNumber(i
);
1110 wDefaultUpdateIcons(scr
);
1112 /* Update the panel image if changed */
1113 /* Don't worry. If the image is the same these
1114 * functions will have no performance impact. */
1115 create_logo_image(scr
);
1120 wwarning(_("could not load domain %s from user defaults database"), "WMWindowAttributes");
1123 w_global
.domain
.window_attr
->timestamp
= stbuf
.st_mtime
;
1125 WMReleasePropList(shared_dict
);
1128 if (stat(w_global
.domain
.root_menu
->path
, &stbuf
) >= 0 && w_global
.domain
.root_menu
->timestamp
< stbuf
.st_mtime
) {
1129 dict
= WMReadPropListFromFile(w_global
.domain
.root_menu
->path
);
1131 if (!WMIsPLArray(dict
) && !WMIsPLString(dict
)) {
1132 WMReleasePropList(dict
);
1134 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1135 "WMRootMenu", w_global
.domain
.root_menu
->path
);
1137 if (w_global
.domain
.root_menu
->dictionary
)
1138 WMReleasePropList(w_global
.domain
.root_menu
->dictionary
);
1140 w_global
.domain
.root_menu
->dictionary
= dict
;
1141 wDefaultsMergeGlobalMenus(w_global
.domain
.root_menu
);
1144 wwarning(_("could not load domain %s from user defaults database"), "WMRootMenu");
1146 w_global
.domain
.root_menu
->timestamp
= stbuf
.st_mtime
;
1148 #ifndef HAVE_INOTIFY
1150 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, arg
);
1154 void wReadDefaults(WScreen
* scr
, WMPropList
* new_dict
)
1156 WMPropList
*plvalue
, *old_value
;
1157 WDefaultEntry
*entry
;
1159 int update_workspace_back
= 0; /* kluge :/ */
1160 unsigned int needs_refresh
;
1162 WMPropList
*old_dict
= (w_global
.domain
.wmaker
->dictionary
!= new_dict
? w_global
.domain
.wmaker
->dictionary
: NULL
);
1166 for (i
= 0; i
< wlengthof(optionList
); i
++) {
1167 entry
= &optionList
[i
];
1170 plvalue
= WMGetFromPLDictionary(new_dict
, entry
->plkey
);
1177 old_value
= WMGetFromPLDictionary(old_dict
, entry
->plkey
);
1179 if (!plvalue
&& !old_value
) {
1180 /* no default in the DB. Use builtin default */
1181 plvalue
= entry
->plvalue
;
1182 if (plvalue
&& new_dict
)
1183 WMPutInPLDictionary(new_dict
, entry
->plkey
, plvalue
);
1185 } else if (!plvalue
) {
1186 /* value was deleted from DB. Keep current value */
1188 } else if (!old_value
) {
1189 /* set value for the 1st time */
1190 } else if (!WMIsPropListEqualTo(plvalue
, old_value
)) {
1191 /* value has changed */
1193 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1194 && update_workspace_back
&& scr
->flags
.backimage_helper_launched
) {
1196 /* value was not changed since last time */
1203 if ((*entry
->convert
) (scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1205 * If the WorkspaceSpecificBack data has been changed
1206 * so that the helper will be launched now, we must be
1207 * sure to send the default background texture config
1210 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0 &&
1211 !scr
->flags
.backimage_helper_launched
)
1212 update_workspace_back
= 1;
1215 needs_refresh
|= (*entry
->update
) (scr
, entry
, tdata
, entry
->extra_data
);
1222 * Backward Compatibility:
1223 * Support the old setting names for Apercu, now called Mini-Preview
1225 * This code should probably stay for at least 2 years, you should not consider removing
1226 * it before year 2017
1228 if (legacy_minipreview_config
.enable
) {
1229 wwarning(_("your configuration is using old syntax for Mini-Preview settings; consider running WPrefs.app to update"));
1230 wPreferences
.miniwin_preview_balloon
= legacy_minipreview_config
.enable
;
1232 if (legacy_minipreview_config
.size
> 0) {
1234 * the option 'ApercuSize' used to be coded as a multiple of the icon size in v0.95.6
1235 * it is now expressed directly in pixels, but to avoid breaking user's setting we check
1236 * for old coding and convert it now.
1238 if (legacy_minipreview_config
.size
< 24) {
1239 /* 24 is the minimum icon size proposed in WPref's settings */
1240 wPreferences
.minipreview_size
= legacy_minipreview_config
.size
* wPreferences
.icon_size
;
1242 wPreferences
.minipreview_size
= legacy_minipreview_config
.size
;
1247 if (needs_refresh
!= 0 && !scr
->flags
.startup
) {
1251 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1252 foo
|= WTextureSettings
;
1253 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1254 foo
|= WFontSettings
;
1255 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1256 foo
|= WColorSettings
;
1258 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1259 (void *)(uintptr_t) foo
);
1262 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1263 foo
|= WTextureSettings
;
1264 if (needs_refresh
& REFRESH_MENU_FONT
)
1265 foo
|= WFontSettings
;
1266 if (needs_refresh
& REFRESH_MENU_COLOR
)
1267 foo
|= WColorSettings
;
1269 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1272 if (needs_refresh
& REFRESH_WINDOW_FONT
)
1273 foo
|= WFontSettings
;
1274 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
)
1275 foo
|= WTextureSettings
;
1276 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
)
1277 foo
|= WColorSettings
;
1279 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1281 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1283 if (needs_refresh
& REFRESH_ICON_FONT
)
1284 foo
|= WFontSettings
;
1285 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
)
1286 foo
|= WTextureSettings
;
1287 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
)
1288 foo
|= WTextureSettings
;
1290 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1291 (void *)(uintptr_t) foo
);
1293 if (needs_refresh
& REFRESH_ICON_TILE
)
1294 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1296 if (needs_refresh
& REFRESH_WORKSPACE_MENU
) {
1297 if (scr
->workspace_menu
)
1298 wWorkspaceMenuUpdate(scr
, scr
->workspace_menu
);
1299 if (scr
->clip_ws_menu
)
1300 wWorkspaceMenuUpdate(scr
, scr
->clip_ws_menu
);
1301 if (scr
->workspace_submenu
)
1302 scr
->workspace_submenu
->flags
.realized
= 0;
1303 if (scr
->clip_submenu
)
1304 scr
->clip_submenu
->flags
.realized
= 0;
1309 void wDefaultUpdateIcons(WScreen
*scr
)
1311 WAppIcon
*aicon
= scr
->app_icon_list
;
1313 WWindow
*wwin
= scr
->focused_window
;
1316 /* Get the application icon, default included */
1317 wIconChangeImageFile(aicon
->icon
, NULL
);
1318 wAppIconPaint(aicon
);
1319 aicon
= aicon
->next
;
1322 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
)
1323 wClipIconPaint(scr
->clip_icon
);
1325 for (dc
= scr
->drawers
; dc
!= NULL
; dc
= dc
->next
)
1326 wDrawerIconPaint(dc
->adrawer
->icon_array
[0]);
1329 if (wwin
->icon
&& wwin
->flags
.miniaturized
)
1330 wIconChangeImageFile(wwin
->icon
, NULL
);
1335 /* --------------------------- Local ----------------------- */
1337 #define GET_STRING_OR_DEFAULT(x, var) if (!WMIsPLString(value)) { \
1338 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1340 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1341 var = entry->default_value;\
1342 } else var = WMGetFromPLString(value)\
1345 static int string2index(WMPropList *key, WMPropList *val, const char *def, WOptionEnumeration * values)
1348 WOptionEnumeration
*v
;
1349 char buffer
[TOTAL_VALUES_LENGTH
];
1351 if (WMIsPLString(val
) && (str
= WMGetFromPLString(val
))) {
1352 for (v
= values
; v
->string
!= NULL
; v
++) {
1353 if (strcasecmp(v
->string
, str
) == 0)
1359 for (v
= values
; v
->string
!= NULL
; v
++) {
1362 strcat(buffer
, ", ");
1363 snprintf(buffer
+strlen(buffer
),
1364 sizeof(buffer
)-strlen(buffer
)-1, "\"%s\"", v
->string
);
1367 wwarning(_("wrong option value for key \"%s\"; got \"%s\", should be one of %s."),
1368 WMGetFromPLString(key
),
1369 WMIsPLString(val
) ? WMGetFromPLString(val
) : "(unknown)",
1373 return string2index(key
, val
, NULL
, values
);
1380 * value - is the value in the defaults DB
1381 * addr - is the address to store the data
1382 * ret - is the address to store a pointer to a temporary buffer. ret
1383 * must not be freed and is used by the set functions
1385 static int getBool(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1389 int second_pass
= 0;
1391 /* Parameter not used, but tell the compiler that it is ok */
1394 GET_STRING_OR_DEFAULT("Boolean", val
);
1397 if ((val
[1] == '\0' && (val
[0] == 'y' || val
[0] == 'Y'))
1398 || strcasecmp(val
, "YES") == 0) {
1401 } else if ((val
[1] == '\0' && (val
[0] == 'n' || val
[0] == 'N'))
1402 || strcasecmp(val
, "NO") == 0) {
1406 if (sscanf(val
, "%i", &i
) == 1) {
1412 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""), val
, entry
->key
);
1413 if (second_pass
== 0) {
1414 val
= WMGetFromPLString(entry
->plvalue
);
1416 wwarning(_("using default \"%s\" instead"), val
);
1426 *(char *)addr
= data
;
1431 static int getInt(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1436 /* Parameter not used, but tell the compiler that it is ok */
1439 GET_STRING_OR_DEFAULT("Integer", val
);
1441 if (sscanf(val
, "%i", &data
) != 1) {
1442 wwarning(_("can't convert \"%s\" to integer for key \"%s\""), val
, entry
->key
);
1443 val
= WMGetFromPLString(entry
->plvalue
);
1444 wwarning(_("using default \"%s\" instead"), val
);
1445 if (sscanf(val
, "%i", &data
) != 1) {
1453 *(int *)addr
= data
;
1458 static int getCoord(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1461 char *val_x
, *val_y
;
1462 int nelem
, changed
= 0;
1463 WMPropList
*elem_x
, *elem_y
;
1466 if (!WMIsPLArray(value
)) {
1467 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Coordinate");
1469 value
= entry
->plvalue
;
1471 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1477 nelem
= WMGetPropListItemCount(value
);
1479 wwarning(_("Incorrect number of elements in array for key \"%s\"."), entry
->key
);
1481 value
= entry
->plvalue
;
1483 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1489 elem_x
= WMGetFromPLArray(value
, 0);
1490 elem_y
= WMGetFromPLArray(value
, 1);
1492 if (!elem_x
|| !elem_y
|| !WMIsPLString(elem_x
) || !WMIsPLString(elem_y
)) {
1493 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."), entry
->key
);
1495 value
= entry
->plvalue
;
1497 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1503 val_x
= WMGetFromPLString(elem_x
);
1504 val_y
= WMGetFromPLString(elem_y
);
1506 if (sscanf(val_x
, "%i", &data
.x
) != 1 || sscanf(val_y
, "%i", &data
.y
) != 1) {
1507 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1509 value
= entry
->plvalue
;
1511 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1519 else if (data
.x
> scr
->scr_width
/ 3)
1520 data
.x
= scr
->scr_width
/ 3;
1523 else if (data
.y
> scr
->scr_height
/ 3)
1524 data
.y
= scr
->scr_height
/ 3;
1529 *(WCoord
*) addr
= data
;
1534 static int getPropList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1536 /* Parameter not used, but tell the compiler that it is ok */
1541 WMRetainPropList(value
);
1548 static int getPathList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1556 /* Parameter not used, but tell the compiler that it is ok */
1561 if (!WMIsPLArray(value
)) {
1562 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "an array of paths");
1564 value
= entry
->plvalue
;
1566 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1573 count
= WMGetPropListItemCount(value
);
1576 value
= entry
->plvalue
;
1578 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1585 for (i
= 0; i
< count
; i
++) {
1586 d
= WMGetFromPLArray(value
, i
);
1587 if (!d
|| !WMIsPLString(d
)) {
1591 len
+= strlen(WMGetFromPLString(d
)) + 1;
1594 ptr
= data
= wmalloc(len
+ 1);
1596 for (i
= 0; i
< count
; i
++) {
1597 d
= WMGetFromPLArray(value
, i
);
1598 if (!d
|| !WMIsPLString(d
)) {
1601 strcpy(ptr
, WMGetFromPLString(d
));
1602 ptr
+= strlen(WMGetFromPLString(d
));
1609 if (*(char **)addr
!= NULL
) {
1610 wfree(*(char **)addr
);
1612 *(char **)addr
= data
;
1617 static int getEnum(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1619 static signed char data
;
1621 /* Parameter not used, but tell the compiler that it is ok */
1624 data
= string2index(entry
->plkey
, value
, entry
->default_value
, (WOptionEnumeration
*) entry
->extra_data
);
1631 *(signed char *)addr
= data
;
1638 * (hgradient <color> <color>)
1639 * (vgradient <color> <color>)
1640 * (dgradient <color> <color>)
1641 * (mhgradient <color> <color> ...)
1642 * (mvgradient <color> <color> ...)
1643 * (mdgradient <color> <color> ...)
1644 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1645 * (tpixmap <file> <color>)
1646 * (spixmap <file> <color>)
1647 * (cpixmap <file> <color>)
1648 * (thgradient <file> <opaqueness> <color> <color>)
1649 * (tvgradient <file> <opaqueness> <color> <color>)
1650 * (tdgradient <file> <opaqueness> <color> <color>)
1651 * (function <lib> <function> ...)
1654 static WTexture
*parse_texture(WScreen
* scr
, WMPropList
* pl
)
1659 WTexture
*texture
= NULL
;
1661 nelem
= WMGetPropListItemCount(pl
);
1665 elem
= WMGetFromPLArray(pl
, 0);
1666 if (!elem
|| !WMIsPLString(elem
))
1668 val
= WMGetFromPLString(elem
);
1670 if (strcasecmp(val
, "solid") == 0) {
1678 elem
= WMGetFromPLArray(pl
, 1);
1679 if (!elem
|| !WMIsPLString(elem
))
1681 val
= WMGetFromPLString(elem
);
1683 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1684 wwarning(_("\"%s\" is not a valid color name"), val
);
1688 texture
= (WTexture
*) wTextureMakeSolid(scr
, &color
);
1689 } else if (strcasecmp(val
, "dgradient") == 0
1690 || strcasecmp(val
, "vgradient") == 0 || strcasecmp(val
, "hgradient") == 0) {
1691 RColor color1
, color2
;
1696 wwarning(_("bad number of arguments in gradient specification"));
1700 if (val
[0] == 'd' || val
[0] == 'D')
1701 type
= WTEX_DGRADIENT
;
1702 else if (val
[0] == 'h' || val
[0] == 'H')
1703 type
= WTEX_HGRADIENT
;
1705 type
= WTEX_VGRADIENT
;
1707 /* get from color */
1708 elem
= WMGetFromPLArray(pl
, 1);
1709 if (!elem
|| !WMIsPLString(elem
))
1711 val
= WMGetFromPLString(elem
);
1713 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1714 wwarning(_("\"%s\" is not a valid color name"), val
);
1718 color1
.red
= xcolor
.red
>> 8;
1719 color1
.green
= xcolor
.green
>> 8;
1720 color1
.blue
= xcolor
.blue
>> 8;
1723 elem
= WMGetFromPLArray(pl
, 2);
1724 if (!elem
|| !WMIsPLString(elem
)) {
1727 val
= WMGetFromPLString(elem
);
1729 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1730 wwarning(_("\"%s\" is not a valid color name"), val
);
1734 color2
.red
= xcolor
.red
>> 8;
1735 color2
.green
= xcolor
.green
>> 8;
1736 color2
.blue
= xcolor
.blue
>> 8;
1738 texture
= (WTexture
*) wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1740 } else if (strcasecmp(val
, "igradient") == 0) {
1741 RColor colors1
[2], colors2
[2];
1747 wwarning(_("bad number of arguments in gradient specification"));
1751 /* get from color */
1752 for (i
= 0; i
< 2; i
++) {
1753 elem
= WMGetFromPLArray(pl
, 1 + i
);
1754 if (!elem
|| !WMIsPLString(elem
))
1756 val
= WMGetFromPLString(elem
);
1758 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1759 wwarning(_("\"%s\" is not a valid color name"), val
);
1762 colors1
[i
].alpha
= 255;
1763 colors1
[i
].red
= xcolor
.red
>> 8;
1764 colors1
[i
].green
= xcolor
.green
>> 8;
1765 colors1
[i
].blue
= xcolor
.blue
>> 8;
1767 elem
= WMGetFromPLArray(pl
, 3);
1768 if (!elem
|| !WMIsPLString(elem
))
1770 val
= WMGetFromPLString(elem
);
1773 /* get from color */
1774 for (i
= 0; i
< 2; i
++) {
1775 elem
= WMGetFromPLArray(pl
, 4 + i
);
1776 if (!elem
|| !WMIsPLString(elem
))
1778 val
= WMGetFromPLString(elem
);
1780 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1781 wwarning(_("\"%s\" is not a valid color name"), val
);
1784 colors2
[i
].alpha
= 255;
1785 colors2
[i
].red
= xcolor
.red
>> 8;
1786 colors2
[i
].green
= xcolor
.green
>> 8;
1787 colors2
[i
].blue
= xcolor
.blue
>> 8;
1789 elem
= WMGetFromPLArray(pl
, 6);
1790 if (!elem
|| !WMIsPLString(elem
))
1792 val
= WMGetFromPLString(elem
);
1795 texture
= (WTexture
*) wTextureMakeIGradient(scr
, th1
, colors1
, th2
, colors2
);
1797 } else if (strcasecmp(val
, "mhgradient") == 0
1798 || strcasecmp(val
, "mvgradient") == 0 || strcasecmp(val
, "mdgradient") == 0) {
1805 wwarning(_("too few arguments in multicolor gradient specification"));
1809 if (val
[1] == 'h' || val
[1] == 'H')
1810 type
= WTEX_MHGRADIENT
;
1811 else if (val
[1] == 'v' || val
[1] == 'V')
1812 type
= WTEX_MVGRADIENT
;
1814 type
= WTEX_MDGRADIENT
;
1818 colors
= wmalloc(sizeof(RColor
*) * (count
+ 1));
1820 for (i
= 0; i
< count
; i
++) {
1821 elem
= WMGetFromPLArray(pl
, i
+ 1);
1822 if (!elem
|| !WMIsPLString(elem
)) {
1823 for (--i
; i
>= 0; --i
) {
1829 val
= WMGetFromPLString(elem
);
1831 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1832 wwarning(_("\"%s\" is not a valid color name"), val
);
1833 for (--i
; i
>= 0; --i
) {
1839 colors
[i
] = wmalloc(sizeof(RColor
));
1840 colors
[i
]->red
= color
.red
>> 8;
1841 colors
[i
]->green
= color
.green
>> 8;
1842 colors
[i
]->blue
= color
.blue
>> 8;
1847 texture
= (WTexture
*) wTextureMakeMGradient(scr
, type
, colors
);
1848 } else if (strcasecmp(val
, "spixmap") == 0 ||
1849 strcasecmp(val
, "cpixmap") == 0 || strcasecmp(val
, "tpixmap") == 0) {
1856 if (val
[0] == 's' || val
[0] == 'S')
1858 else if (val
[0] == 'c' || val
[0] == 'C')
1864 elem
= WMGetFromPLArray(pl
, 2);
1865 if (!elem
|| !WMIsPLString(elem
)) {
1868 val
= WMGetFromPLString(elem
);
1870 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1871 wwarning(_("\"%s\" is not a valid color name"), val
);
1876 elem
= WMGetFromPLArray(pl
, 1);
1877 if (!elem
|| !WMIsPLString(elem
))
1879 val
= WMGetFromPLString(elem
);
1881 texture
= (WTexture
*) wTextureMakePixmap(scr
, type
, val
, &color
);
1882 } else if (strcasecmp(val
, "thgradient") == 0
1883 || strcasecmp(val
, "tvgradient") == 0 || strcasecmp(val
, "tdgradient") == 0) {
1884 RColor color1
, color2
;
1889 if (val
[1] == 'h' || val
[1] == 'H')
1890 style
= WTEX_THGRADIENT
;
1891 else if (val
[1] == 'v' || val
[1] == 'V')
1892 style
= WTEX_TVGRADIENT
;
1894 style
= WTEX_TDGRADIENT
;
1897 wwarning(_("bad number of arguments in textured gradient specification"));
1901 /* get from color */
1902 elem
= WMGetFromPLArray(pl
, 3);
1903 if (!elem
|| !WMIsPLString(elem
))
1905 val
= WMGetFromPLString(elem
);
1907 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1908 wwarning(_("\"%s\" is not a valid color name"), val
);
1912 color1
.red
= xcolor
.red
>> 8;
1913 color1
.green
= xcolor
.green
>> 8;
1914 color1
.blue
= xcolor
.blue
>> 8;
1917 elem
= WMGetFromPLArray(pl
, 4);
1918 if (!elem
|| !WMIsPLString(elem
)) {
1921 val
= WMGetFromPLString(elem
);
1923 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1924 wwarning(_("\"%s\" is not a valid color name"), val
);
1928 color2
.red
= xcolor
.red
>> 8;
1929 color2
.green
= xcolor
.green
>> 8;
1930 color2
.blue
= xcolor
.blue
>> 8;
1933 elem
= WMGetFromPLArray(pl
, 2);
1934 if (!elem
|| !WMIsPLString(elem
))
1937 val
= WMGetFromPLString(elem
);
1939 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
1940 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
1945 elem
= WMGetFromPLArray(pl
, 1);
1946 if (!elem
|| !WMIsPLString(elem
))
1948 val
= WMGetFromPLString(elem
);
1950 texture
= (WTexture
*) wTextureMakeTGradient(scr
, style
, &color1
, &color2
, val
, opacity
);
1951 } else if (strcasecmp(val
, "function") == 0) {
1952 /* Leave this in to handle the unlikely case of
1953 * someone actually having function textures configured */
1954 wwarning("function texture support has been removed");
1957 wwarning(_("invalid texture type %s"), val
);
1963 static int getTexture(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1965 static WTexture
*texture
;
1969 if (!WMIsPLArray(value
)) {
1970 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Texture");
1972 value
= entry
->plvalue
;
1974 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1980 if (strcmp(entry
->key
, "WidgetColor") == 0 && !changed
) {
1983 pl
= WMGetFromPLArray(value
, 0);
1984 if (!pl
|| !WMIsPLString(pl
) || !WMGetFromPLString(pl
)
1985 || strcasecmp(WMGetFromPLString(pl
), "solid") != 0) {
1986 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1987 entry
->key
, "Solid Texture");
1989 value
= entry
->plvalue
;
1991 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1996 texture
= parse_texture(scr
, value
);
1999 wwarning(_("Error in texture specification for key \"%s\""), entry
->key
);
2001 value
= entry
->plvalue
;
2003 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2013 *(WTexture
**) addr
= texture
;
2018 static int getWSBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2025 /* Parameter not used, but tell the compiler that it is ok */
2030 if (!WMIsPLArray(value
)) {
2031 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2032 "WorkspaceBack", "Texture or None");
2034 value
= entry
->plvalue
;
2036 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2042 /* only do basic error checking and verify for None texture */
2044 nelem
= WMGetPropListItemCount(value
);
2046 elem
= WMGetFromPLArray(value
, 0);
2047 if (!elem
|| !WMIsPLString(elem
)) {
2048 wwarning(_("Wrong type for workspace background. Should be a texture type."));
2050 value
= entry
->plvalue
;
2052 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2057 val
= WMGetFromPLString(elem
);
2059 if (strcasecmp(val
, "None") == 0)
2062 *ret
= WMRetainPropList(value
);
2068 getWSSpecificBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2074 /* Parameter not used, but tell the compiler that it is ok */
2079 if (!WMIsPLArray(value
)) {
2080 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2081 "WorkspaceSpecificBack", "an array of textures");
2083 value
= entry
->plvalue
;
2085 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2091 /* only do basic error checking and verify for None texture */
2093 nelem
= WMGetPropListItemCount(value
);
2096 elem
= WMGetFromPLArray(value
, nelem
);
2097 if (!elem
|| !WMIsPLArray(elem
)) {
2098 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2104 *ret
= WMRetainPropList(value
);
2108 * Kluge to force wmsetbg helper to set the default background.
2109 * If the WorkspaceSpecificBack is changed once wmaker has started,
2110 * the WorkspaceBack won't be sent to the helper, unless the user
2111 * changes it's value too. So, we must force this by removing the
2112 * value from the defaults DB.
2114 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2115 WMPropList
*key
= WMCreatePLString("WorkspaceBack");
2117 WMRemoveFromPLDictionary(w_global
.domain
.wmaker
->dictionary
, key
);
2119 WMReleasePropList(key
);
2125 static int getFont(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2127 static WMFont
*font
;
2132 GET_STRING_OR_DEFAULT("Font", val
);
2134 font
= WMCreateFont(scr
->wmscreen
, val
);
2136 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2139 wfatal(_("could not load any usable font!!!"));
2146 /* can't assign font value outside update function */
2147 wassertrv(addr
== NULL
, True
);
2152 static int getColor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2154 static XColor color
;
2156 int second_pass
= 0;
2160 GET_STRING_OR_DEFAULT("Color", val
);
2163 if (!wGetColor(scr
, val
, &color
)) {
2164 wwarning(_("could not get color for key \"%s\""), entry
->key
);
2165 if (second_pass
== 0) {
2166 val
= WMGetFromPLString(entry
->plvalue
);
2168 wwarning(_("using default \"%s\" instead"), val
);
2177 assert(addr
== NULL
);
2180 *(unsigned long*)addr = pixel;
2186 static int getKeybind(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2188 static WShortKey shortcut
;
2192 char buf
[MAX_SHORTCUT_LENGTH
], *b
;
2194 /* Parameter not used, but tell the compiler that it is ok */
2198 GET_STRING_OR_DEFAULT("Key spec", val
);
2200 if (!val
|| strcasecmp(val
, "NONE") == 0) {
2201 shortcut
.keycode
= 0;
2202 shortcut
.modifier
= 0;
2208 wstrlcpy(buf
, val
, MAX_SHORTCUT_LENGTH
);
2213 shortcut
.modifier
= 0;
2214 while ((k
= strchr(b
, '+')) != NULL
) {
2218 mod
= wXModifierFromKey(b
);
2220 wwarning(_("%s: invalid key modifier \"%s\""), entry
->key
, b
);
2223 shortcut
.modifier
|= mod
;
2229 ksym
= XStringToKeysym(b
);
2231 if (ksym
== NoSymbol
) {
2232 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
, val
);
2236 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2237 if (shortcut
.keycode
== 0) {
2238 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2248 static int getModMask(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2253 /* Parameter not used, but tell the compiler that it is ok */
2256 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2261 mask
= wXModifierFromKey(str
);
2263 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2269 *(int *)addr
= mask
;
2277 # include <X11/cursorfont.h>
2283 #define CURSOR_ID_NONE (XC_num_glyphs)
2285 static const WCursorLookup cursor_table
[] = {
2286 {"X_cursor", XC_X_cursor
},
2287 {"arrow", XC_arrow
},
2288 {"based_arrow_down", XC_based_arrow_down
},
2289 {"based_arrow_up", XC_based_arrow_up
},
2291 {"bogosity", XC_bogosity
},
2292 {"bottom_left_corner", XC_bottom_left_corner
},
2293 {"bottom_right_corner", XC_bottom_right_corner
},
2294 {"bottom_side", XC_bottom_side
},
2295 {"bottom_tee", XC_bottom_tee
},
2296 {"box_spiral", XC_box_spiral
},
2297 {"center_ptr", XC_center_ptr
},
2298 {"circle", XC_circle
},
2299 {"clock", XC_clock
},
2300 {"coffee_mug", XC_coffee_mug
},
2301 {"cross", XC_cross
},
2302 {"cross_reverse", XC_cross_reverse
},
2303 {"crosshair", XC_crosshair
},
2304 {"diamond_cross", XC_diamond_cross
},
2306 {"dotbox", XC_dotbox
},
2307 {"double_arrow", XC_double_arrow
},
2308 {"draft_large", XC_draft_large
},
2309 {"draft_small", XC_draft_small
},
2310 {"draped_box", XC_draped_box
},
2311 {"exchange", XC_exchange
},
2312 {"fleur", XC_fleur
},
2313 {"gobbler", XC_gobbler
},
2314 {"gumby", XC_gumby
},
2315 {"hand1", XC_hand1
},
2316 {"hand2", XC_hand2
},
2317 {"heart", XC_heart
},
2319 {"iron_cross", XC_iron_cross
},
2320 {"left_ptr", XC_left_ptr
},
2321 {"left_side", XC_left_side
},
2322 {"left_tee", XC_left_tee
},
2323 {"leftbutton", XC_leftbutton
},
2324 {"ll_angle", XC_ll_angle
},
2325 {"lr_angle", XC_lr_angle
},
2327 {"middlebutton", XC_middlebutton
},
2328 {"mouse", XC_mouse
},
2329 {"pencil", XC_pencil
},
2330 {"pirate", XC_pirate
},
2332 {"question_arrow", XC_question_arrow
},
2333 {"right_ptr", XC_right_ptr
},
2334 {"right_side", XC_right_side
},
2335 {"right_tee", XC_right_tee
},
2336 {"rightbutton", XC_rightbutton
},
2337 {"rtl_logo", XC_rtl_logo
},
2338 {"sailboat", XC_sailboat
},
2339 {"sb_down_arrow", XC_sb_down_arrow
},
2340 {"sb_h_double_arrow", XC_sb_h_double_arrow
},
2341 {"sb_left_arrow", XC_sb_left_arrow
},
2342 {"sb_right_arrow", XC_sb_right_arrow
},
2343 {"sb_up_arrow", XC_sb_up_arrow
},
2344 {"sb_v_double_arrow", XC_sb_v_double_arrow
},
2345 {"shuttle", XC_shuttle
},
2346 {"sizing", XC_sizing
},
2347 {"spider", XC_spider
},
2348 {"spraycan", XC_spraycan
},
2350 {"target", XC_target
},
2351 {"tcross", XC_tcross
},
2352 {"top_left_arrow", XC_top_left_arrow
},
2353 {"top_left_corner", XC_top_left_corner
},
2354 {"top_right_corner", XC_top_right_corner
},
2355 {"top_side", XC_top_side
},
2356 {"top_tee", XC_top_tee
},
2358 {"ul_angle", XC_ul_angle
},
2359 {"umbrella", XC_umbrella
},
2360 {"ur_angle", XC_ur_angle
},
2361 {"watch", XC_watch
},
2362 {"xterm", XC_xterm
},
2363 {NULL
, CURSOR_ID_NONE
}
2366 static void check_bitmap_status(int status
, const char *filename
, Pixmap bitmap
)
2369 case BitmapOpenFailed
:
2370 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2372 case BitmapFileInvalid
:
2373 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2375 case BitmapNoMemory
:
2376 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2379 XFreePixmap(dpy
, bitmap
);
2386 * (builtin, <cursor_name>)
2387 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2389 static int parse_cursor(WScreen
* scr
, WMPropList
* pl
, Cursor
* cursor
)
2396 nelem
= WMGetPropListItemCount(pl
);
2400 elem
= WMGetFromPLArray(pl
, 0);
2401 if (!elem
|| !WMIsPLString(elem
)) {
2404 val
= WMGetFromPLString(elem
);
2406 if (strcasecmp(val
, "none") == 0) {
2409 } else if (strcasecmp(val
, "builtin") == 0) {
2411 int cursor_id
= CURSOR_ID_NONE
;
2414 wwarning(_("bad number of arguments in cursor specification"));
2417 elem
= WMGetFromPLArray(pl
, 1);
2418 if (!elem
|| !WMIsPLString(elem
)) {
2421 val
= WMGetFromPLString(elem
);
2423 for (i
= 0; cursor_table
[i
].name
!= NULL
; i
++) {
2424 if (strcasecmp(val
, cursor_table
[i
].name
) == 0) {
2425 cursor_id
= cursor_table
[i
].id
;
2429 if (CURSOR_ID_NONE
== cursor_id
) {
2430 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2432 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2435 } else if (strcasecmp(val
, "bitmap") == 0) {
2447 wwarning(_("bad number of arguments in cursor specification"));
2450 elem
= WMGetFromPLArray(pl
, 1);
2451 if (!elem
|| !WMIsPLString(elem
)) {
2454 val
= WMGetFromPLString(elem
);
2455 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2457 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2460 elem
= WMGetFromPLArray(pl
, 2);
2461 if (!elem
|| !WMIsPLString(elem
)) {
2465 val
= WMGetFromPLString(elem
);
2466 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2469 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2472 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
, &mask
, &x
, &y
);
2473 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
, &bitmap
, &x
, &y
);
2474 if ((BitmapSuccess
== bitmap_status
) && (BitmapSuccess
== mask_status
)) {
2475 fg
.pixel
= scr
->black_pixel
;
2476 bg
.pixel
= scr
->white_pixel
;
2477 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2478 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2479 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2482 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2483 check_bitmap_status(mask_status
, mask_name
, mask
);
2490 static int getCursor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2492 static Cursor cursor
;
2497 if (!WMIsPLArray(value
)) {
2498 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2499 entry
->key
, "cursor specification");
2501 value
= entry
->plvalue
;
2503 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2508 status
= parse_cursor(scr
, value
, &cursor
);
2510 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2512 value
= entry
->plvalue
;
2514 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2523 *(Cursor
*) addr
= cursor
;
2528 #undef CURSOR_ID_NONE
2530 /* ---------------- value setting functions --------------- */
2531 static int setJustify(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2533 /* Parameter not used, but tell the compiler that it is ok */
2539 return REFRESH_WINDOW_TITLE_COLOR
;
2542 static int setClearance(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2544 /* Parameter not used, but tell the compiler that it is ok */
2550 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
| REFRESH_MENU_TITLE_FONT
| REFRESH_MENU_FONT
;
2553 static int setIfDockPresent(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2556 long which
= (long) extra_data
;
2558 /* Parameter not used, but tell the compiler that it is ok */
2564 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2565 // Drawers require the dock
2566 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| wPreferences
.flags
.nodock
;
2569 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2572 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| *flag
;
2580 static int setClipMergedInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2584 /* Parameter not used, but tell the compiler that it is ok */
2589 wPreferences
.flags
.clip_merged_in_dock
= *flag
;
2590 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2594 static int setWrapAppiconsInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2598 /* Parameter not used, but tell the compiler that it is ok */
2603 wPreferences
.flags
.wrap_appicons_in_dock
= *flag
;
2607 static int setStickyIcons(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2609 /* Parameter not used, but tell the compiler that it is ok */
2614 if (scr
->workspaces
) {
2615 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2616 wArrangeIcons(scr
, False
);
2621 static int setIconTile(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2625 WTexture
** texture
= tdata
;
2628 /* Parameter not used, but tell the compiler that it is ok */
2631 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2632 wPreferences
.icon_size
, ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2633 ? WREL_ICON
: WREL_FLAT
);
2635 wwarning(_("could not render texture for icon background"));
2637 wTextureDestroy(scr
, *texture
);
2640 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2642 if (scr
->icon_tile
) {
2644 RReleaseImage(scr
->icon_tile
);
2645 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2648 scr
->icon_tile
= img
;
2650 /* put the icon in the noticeboard hint */
2651 PropSetIconTileHint(scr
, img
);
2653 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
) {
2654 if (scr
->clip_tile
) {
2655 RReleaseImage(scr
->clip_tile
);
2657 scr
->clip_tile
= wClipMakeTile(img
);
2660 if (!wPreferences
.flags
.nodrawer
) {
2661 if (scr
->drawer_tile
) {
2662 RReleaseImage(scr
->drawer_tile
);
2664 scr
->drawer_tile
= wDrawerMakeTile(scr
, img
);
2667 scr
->icon_tile_pixmap
= pixmap
;
2669 if (scr
->def_icon_rimage
) {
2670 RReleaseImage(scr
->def_icon_rimage
);
2671 scr
->def_icon_rimage
= NULL
;
2674 if (scr
->icon_back_texture
)
2675 wTextureDestroy(scr
, (WTexture
*) scr
->icon_back_texture
);
2677 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2679 /* Free the texture as nobody else will use it, nor refer to it. */
2681 wTextureDestroy(scr
, *texture
);
2683 return (reset
? REFRESH_ICON_TILE
: 0);
2686 static int setWinTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2688 WMFont
*font
= tdata
;
2690 /* Parameter not used, but tell the compiler that it is ok */
2694 if (scr
->title_font
) {
2695 WMReleaseFont(scr
->title_font
);
2697 scr
->title_font
= font
;
2699 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
;
2702 static int setMenuTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2704 WMFont
*font
= tdata
;
2706 /* Parameter not used, but tell the compiler that it is ok */
2710 if (scr
->menu_title_font
) {
2711 WMReleaseFont(scr
->menu_title_font
);
2714 scr
->menu_title_font
= font
;
2716 return REFRESH_MENU_TITLE_FONT
;
2719 static int setMenuTextFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2721 WMFont
*font
= tdata
;
2723 /* Parameter not used, but tell the compiler that it is ok */
2727 if (scr
->menu_entry_font
) {
2728 WMReleaseFont(scr
->menu_entry_font
);
2730 scr
->menu_entry_font
= font
;
2732 return REFRESH_MENU_FONT
;
2735 static int setIconTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2737 WMFont
*font
= tdata
;
2739 /* Parameter not used, but tell the compiler that it is ok */
2743 if (scr
->icon_title_font
) {
2744 WMReleaseFont(scr
->icon_title_font
);
2747 scr
->icon_title_font
= font
;
2749 return REFRESH_ICON_FONT
;
2752 static int setClipTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2754 WMFont
*font
= tdata
;
2756 /* Parameter not used, but tell the compiler that it is ok */
2760 if (scr
->clip_title_font
) {
2761 WMReleaseFont(scr
->clip_title_font
);
2764 scr
->clip_title_font
= font
;
2766 return REFRESH_ICON_FONT
;
2769 static int setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2771 WMFont
*font
= tdata
;
2773 /* Parameter not used, but tell the compiler that it is ok */
2778 if (scr
->workspace_name_font
)
2779 WMReleaseFont(scr
->workspace_name_font
);
2781 scr
->workspace_name_font
= font
;
2786 static int setHightlight(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2788 XColor
*color
= tdata
;
2790 /* Parameter not used, but tell the compiler that it is ok */
2794 if (scr
->select_color
)
2795 WMReleaseColor(scr
->select_color
);
2797 scr
->select_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2799 wFreeColor(scr
, color
->pixel
);
2801 return REFRESH_MENU_COLOR
;
2804 static int setHightlightText(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2806 XColor
*color
= tdata
;
2808 /* Parameter not used, but tell the compiler that it is ok */
2812 if (scr
->select_text_color
)
2813 WMReleaseColor(scr
->select_text_color
);
2815 scr
->select_text_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2817 wFreeColor(scr
, color
->pixel
);
2819 return REFRESH_MENU_COLOR
;
2822 static int setClipTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2824 XColor
*color
= tdata
;
2825 long widx
= (long) extra_data
;
2827 /* Parameter not used, but tell the compiler that it is ok */
2830 if (scr
->clip_title_color
[widx
])
2831 WMReleaseColor(scr
->clip_title_color
[widx
]);
2833 scr
->clip_title_color
[widx
] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2834 wFreeColor(scr
, color
->pixel
);
2836 return REFRESH_ICON_TITLE_COLOR
;
2839 static int setWTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2841 XColor
*color
= tdata
;
2842 long widx
= (long) extra_data
;
2844 /* Parameter not used, but tell the compiler that it is ok */
2847 if (scr
->window_title_color
[widx
])
2848 WMReleaseColor(scr
->window_title_color
[widx
]);
2850 scr
->window_title_color
[widx
] =
2851 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2853 wFreeColor(scr
, color
->pixel
);
2855 return REFRESH_WINDOW_TITLE_COLOR
;
2858 static int setMenuTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2860 XColor
*color
= tdata
;
2862 /* Parameter not used, but tell the compiler that it is ok */
2866 if (scr
->menu_title_color
[0])
2867 WMReleaseColor(scr
->menu_title_color
[0]);
2869 scr
->menu_title_color
[0] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2871 wFreeColor(scr
, color
->pixel
);
2873 return REFRESH_MENU_TITLE_COLOR
;
2876 static int setMenuTextColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2878 XColor
*color
= tdata
;
2880 /* Parameter not used, but tell the compiler that it is ok */
2884 if (scr
->mtext_color
)
2885 WMReleaseColor(scr
->mtext_color
);
2887 scr
->mtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2889 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2890 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2892 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2895 wFreeColor(scr
, color
->pixel
);
2897 return REFRESH_MENU_COLOR
;
2900 static int setMenuDisabledColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2902 XColor
*color
= tdata
;
2904 /* Parameter not used, but tell the compiler that it is ok */
2908 if (scr
->dtext_color
)
2909 WMReleaseColor(scr
->dtext_color
);
2911 scr
->dtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2913 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2914 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2916 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2919 wFreeColor(scr
, color
->pixel
);
2921 return REFRESH_MENU_COLOR
;
2924 static int setIconTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2926 XColor
*color
= tdata
;
2928 /* Parameter not used, but tell the compiler that it is ok */
2932 if (scr
->icon_title_color
)
2933 WMReleaseColor(scr
->icon_title_color
);
2934 scr
->icon_title_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2936 wFreeColor(scr
, color
->pixel
);
2938 return REFRESH_ICON_TITLE_COLOR
;
2941 static int setIconTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2943 XColor
*color
= tdata
;
2945 /* Parameter not used, but tell the compiler that it is ok */
2949 if (scr
->icon_title_texture
) {
2950 wTextureDestroy(scr
, (WTexture
*) scr
->icon_title_texture
);
2952 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
2954 return REFRESH_ICON_TITLE_BACK
;
2957 static int setFrameBorderWidth(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2961 /* Parameter not used, but tell the compiler that it is ok */
2965 scr
->frame_border_width
= *value
;
2967 return REFRESH_FRAME_BORDER
;
2970 static int setFrameBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2972 XColor
*color
= tdata
;
2974 /* Parameter not used, but tell the compiler that it is ok */
2978 if (scr
->frame_border_color
)
2979 WMReleaseColor(scr
->frame_border_color
);
2980 scr
->frame_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2982 wFreeColor(scr
, color
->pixel
);
2984 return REFRESH_FRAME_BORDER
;
2987 static int setFrameFocusedBorderColor(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2989 XColor
*color
= tdata
;
2991 /* Parameter not used, but tell the compiler that it is ok */
2995 if (scr
->frame_focused_border_color
)
2996 WMReleaseColor(scr
->frame_focused_border_color
);
2997 scr
->frame_focused_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2999 wFreeColor(scr
, color
->pixel
);
3001 return REFRESH_FRAME_BORDER
;
3004 static int setFrameSelectedBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3006 XColor
*color
= tdata
;
3008 /* Parameter not used, but tell the compiler that it is ok */
3012 if (scr
->frame_selected_border_color
)
3013 WMReleaseColor(scr
->frame_selected_border_color
);
3014 scr
->frame_selected_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
3016 wFreeColor(scr
, color
->pixel
);
3018 return REFRESH_FRAME_BORDER
;
3021 static int setWorkspaceSpecificBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
3023 WMPropList
*value
= tdata
;
3028 /* Parameter not used, but tell the compiler that it is ok */
3032 if (scr
->flags
.backimage_helper_launched
) {
3033 if (WMGetPropListItemCount(value
) == 0) {
3034 SendHelperMessage(scr
, 'C', 0, NULL
);
3035 SendHelperMessage(scr
, 'K', 0, NULL
);
3037 WMReleasePropList(value
);
3041 if (WMGetPropListItemCount(value
) == 0)
3044 if (!start_bg_helper(scr
)) {
3045 WMReleasePropList(value
);
3049 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3052 for (i
= 0; i
< WMGetPropListItemCount(value
); i
++) {
3053 val
= WMGetFromPLArray(value
, i
);
3054 if (val
&& WMIsPLArray(val
) && WMGetPropListItemCount(val
) > 0) {
3055 str
= WMGetPropListDescription(val
, False
);
3057 SendHelperMessage(scr
, 'S', i
+ 1, str
);
3061 SendHelperMessage(scr
, 'U', i
+ 1, NULL
);
3066 WMReleasePropList(value
);
3070 static int setWorkspaceBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
3072 WMPropList
*value
= tdata
;
3074 /* Parameter not used, but tell the compiler that it is ok */
3078 if (scr
->flags
.backimage_helper_launched
) {
3081 if (WMGetPropListItemCount(value
) == 0) {
3082 SendHelperMessage(scr
, 'U', 0, NULL
);
3084 /* set the default workspace background to this one */
3085 str
= WMGetPropListDescription(value
, False
);
3087 SendHelperMessage(scr
, 'S', 0, str
);
3089 SendHelperMessage(scr
, 'C', scr
->current_workspace
+ 1, NULL
);
3091 SendHelperMessage(scr
, 'U', 0, NULL
);
3094 } else if (WMGetPropListItemCount(value
) > 0) {
3099 text
= WMGetPropListDescription(value
, False
);
3100 len
= strlen(text
) + 40;
3101 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3102 if (!strchr(text
, '\'') && !strchr(text
, '\\')) {
3105 if (wPreferences
.smooth_workspace_back
)
3106 snprintf(command
, len
, "wmsetbg %s -S -p '%s' &", dither
, text
);
3108 snprintf(command
, len
, "wmsetbg %s -p '%s' &", dither
, text
);
3109 ExecuteShellCommand(scr
, command
);
3111 wwarning(_("Invalid arguments for background \"%s\""), text
);
3114 WMReleasePropList(value
);
3119 static int setWidgetColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3121 WTexture
**texture
= tdata
;
3123 /* Parameter not used, but tell the compiler that it is ok */
3127 if (scr
->widget_texture
) {
3128 wTextureDestroy(scr
, (WTexture
*) scr
->widget_texture
);
3130 scr
->widget_texture
= *(WTexSolid
**) texture
;
3135 static int setFTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3137 WTexture
**texture
= tdata
;
3139 /* Parameter not used, but tell the compiler that it is ok */
3143 if (scr
->window_title_texture
[WS_FOCUSED
]) {
3144 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3146 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3148 return REFRESH_WINDOW_TEXTURES
;
3151 static int setPTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3153 WTexture
**texture
= tdata
;
3155 /* Parameter not used, but tell the compiler that it is ok */
3159 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
3160 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3162 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3164 return REFRESH_WINDOW_TEXTURES
;
3167 static int setUTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3169 WTexture
**texture
= tdata
;
3171 /* Parameter not used, but tell the compiler that it is ok */
3175 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
3176 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3178 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3180 return REFRESH_WINDOW_TEXTURES
;
3183 static int setResizebarBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3185 WTexture
**texture
= tdata
;
3187 /* Parameter not used, but tell the compiler that it is ok */
3191 if (scr
->resizebar_texture
[0]) {
3192 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3194 scr
->resizebar_texture
[0] = *texture
;
3196 return REFRESH_WINDOW_TEXTURES
;
3199 static int setMenuTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3201 WTexture
**texture
= tdata
;
3203 /* Parameter not used, but tell the compiler that it is ok */
3207 if (scr
->menu_title_texture
[0]) {
3208 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3210 scr
->menu_title_texture
[0] = *texture
;
3212 return REFRESH_MENU_TITLE_TEXTURE
;
3215 static int setMenuTextBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3217 WTexture
**texture
= tdata
;
3219 /* Parameter not used, but tell the compiler that it is ok */
3223 if (scr
->menu_item_texture
) {
3224 wTextureDestroy(scr
, scr
->menu_item_texture
);
3225 wTextureDestroy(scr
, (WTexture
*) scr
->menu_item_auxtexture
);
3227 scr
->menu_item_texture
= *texture
;
3229 scr
->menu_item_auxtexture
= wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3231 return REFRESH_MENU_TEXTURE
;
3234 static int setKeyGrab(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3236 WShortKey
*shortcut
= tdata
;
3238 long widx
= (long) extra_data
;
3240 /* Parameter not used, but tell the compiler that it is ok */
3243 wKeyBindings
[widx
] = *shortcut
;
3245 wwin
= scr
->focused_window
;
3247 while (wwin
!= NULL
) {
3248 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3250 if (!WFLAGP(wwin
, no_bind_keys
)) {
3251 wWindowSetKeyGrabs(wwin
);
3256 /* do we need to update window menus? */
3257 if (widx
>= WKBD_WORKSPACE1
&& widx
<= WKBD_WORKSPACE10
)
3258 return REFRESH_WORKSPACE_MENU
;
3259 if (widx
== WKBD_LASTWORKSPACE
)
3260 return REFRESH_WORKSPACE_MENU
;
3261 if (widx
>= WKBD_MOVE_WORKSPACE1
&& widx
<= WKBD_MOVE_WORKSPACE10
)
3262 return REFRESH_WORKSPACE_MENU
;
3267 static int setIconPosition(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3269 /* Parameter not used, but tell the compiler that it is ok */
3274 wScreenUpdateUsableArea(scr
);
3275 wArrangeIcons(scr
, True
);
3280 static int updateUsableArea(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3282 /* Parameter not used, but tell the compiler that it is ok */
3287 wScreenUpdateUsableArea(scr
);
3292 static int setWorkspaceMapBackground(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3294 WTexture
**texture
= tdata
;
3296 /* Parameter not used, but tell the compiler that it is ok */
3300 if (wPreferences
.wsmbackTexture
)
3301 wTextureDestroy(scr
, wPreferences
.wsmbackTexture
);
3303 wPreferences
.wsmbackTexture
= *texture
;
3305 return REFRESH_WINDOW_TEXTURES
;
3308 static int setMenuStyle(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3310 /* Parameter not used, but tell the compiler that it is ok */
3316 return REFRESH_MENU_TEXTURE
;
3319 static RImage
*chopOffImage(RImage
* image
, int x
, int y
, int w
, int h
)
3321 RImage
*img
= RCreateImage(w
, h
, image
->format
== RRGBAFormat
);
3323 RCopyArea(img
, image
, x
, y
, w
, h
, 0, 0);
3328 static int setSwPOptions(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3330 WMPropList
*array
= tdata
;
3333 int cwidth
, cheight
;
3334 struct WPreferences
*prefs
= foo
;
3336 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) == 0) {
3337 if (prefs
->swtileImage
)
3338 RReleaseImage(prefs
->swtileImage
);
3339 prefs
->swtileImage
= NULL
;
3341 WMReleasePropList(array
);
3345 switch (WMGetPropListItemCount(array
)) {
3347 if (!WMIsPLString(WMGetFromPLArray(array
, 1))) {
3348 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3351 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 1)));
3354 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3355 WMGetFromPLString(WMGetFromPLArray(array
, 1)), entry
->key
);
3357 bgimage
= RLoadImage(scr
->rcontext
, path
, 0);
3359 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3364 cwidth
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 2)));
3365 cheight
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 3)));
3367 if (cwidth
<= 0 || cheight
<= 0 ||
3368 cwidth
>= bgimage
->width
- 2 || cheight
>= bgimage
->height
- 2)
3369 wwarning(_("Invalid split sizes for switch panel back image."));
3372 int swidth
, theight
;
3373 for (i
= 0; i
< 9; i
++) {
3374 if (prefs
->swbackImage
[i
])
3375 RReleaseImage(prefs
->swbackImage
[i
]);
3376 prefs
->swbackImage
[i
] = NULL
;
3378 swidth
= (bgimage
->width
- cwidth
) / 2;
3379 theight
= (bgimage
->height
- cheight
) / 2;
3381 prefs
->swbackImage
[0] = chopOffImage(bgimage
, 0, 0, swidth
, theight
);
3382 prefs
->swbackImage
[1] = chopOffImage(bgimage
, swidth
, 0, cwidth
, theight
);
3383 prefs
->swbackImage
[2] = chopOffImage(bgimage
, swidth
+ cwidth
, 0,
3386 prefs
->swbackImage
[3] = chopOffImage(bgimage
, 0, theight
, swidth
, cheight
);
3387 prefs
->swbackImage
[4] = chopOffImage(bgimage
, swidth
, theight
,
3389 prefs
->swbackImage
[5] = chopOffImage(bgimage
, swidth
+ cwidth
, theight
,
3392 prefs
->swbackImage
[6] = chopOffImage(bgimage
, 0, theight
+ cheight
,
3394 prefs
->swbackImage
[7] = chopOffImage(bgimage
, swidth
, theight
+ cheight
,
3396 prefs
->swbackImage
[8] =
3397 chopOffImage(bgimage
, swidth
+ cwidth
, theight
+ cheight
, swidth
,
3400 // check if anything failed
3401 for (i
= 0; i
< 9; i
++) {
3402 if (!prefs
->swbackImage
[i
]) {
3403 for (; i
>= 0; --i
) {
3404 RReleaseImage(prefs
->swbackImage
[i
]);
3405 prefs
->swbackImage
[i
] = NULL
;
3411 RReleaseImage(bgimage
);
3416 if (!WMIsPLString(WMGetFromPLArray(array
, 0))) {
3417 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3420 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 0)));
3423 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3424 WMGetFromPLString(WMGetFromPLArray(array
, 0)), entry
->key
);
3426 if (prefs
->swtileImage
)
3427 RReleaseImage(prefs
->swtileImage
);
3429 prefs
->swtileImage
= RLoadImage(scr
->rcontext
, path
, 0);
3430 if (!prefs
->swtileImage
) {
3431 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3438 wwarning(_("Invalid number of arguments for option \"%s\""), entry
->key
);
3442 WMReleasePropList(array
);
3447 static int setModifierKeyLabels(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3449 WMPropList
*array
= tdata
;
3451 struct WPreferences
*prefs
= foo
;
3453 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) != 7) {
3454 wwarning(_("Value for option \"%s\" must be an array of 7 strings"), entry
->key
);
3455 WMReleasePropList(array
);
3459 DestroyWindowMenu(scr
);
3461 for (i
= 0; i
< 7; i
++) {
3462 if (prefs
->modifier_labels
[i
])
3463 wfree(prefs
->modifier_labels
[i
]);
3465 if (WMIsPLString(WMGetFromPLArray(array
, i
))) {
3466 prefs
->modifier_labels
[i
] = wstrdup(WMGetFromPLString(WMGetFromPLArray(array
, i
)));
3468 wwarning(_("Invalid argument for option \"%s\" item %d"), entry
->key
, i
);
3469 prefs
->modifier_labels
[i
] = NULL
;
3473 WMReleasePropList(array
);
3478 static int setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3482 /* Parameter not used, but tell the compiler that it is ok */
3489 W_setconf_doubleClickDelay(*value
);
3494 static int setCursor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3496 Cursor
*cursor
= tdata
;
3497 long widx
= (long) extra_data
;
3499 /* Parameter not used, but tell the compiler that it is ok */
3502 if (wPreferences
.cursor
[widx
] != None
) {
3503 XFreeCursor(dpy
, wPreferences
.cursor
[widx
]);
3506 wPreferences
.cursor
[widx
] = *cursor
;
3508 if (widx
== WCUR_ROOT
&& *cursor
!= None
) {
3509 XDefineCursor(dpy
, scr
->root_win
, *cursor
);