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 typedef struct _WDefaultEntry WDefaultEntry
;
71 typedef int (WDECallbackConvert
) (WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*plvalue
, void *addr
, void **tdata
);
72 typedef int (WDECallbackUpdate
) (WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *extra_data
);
74 struct _WDefaultEntry
{
76 const char *default_value
;
79 WDECallbackConvert
*convert
;
80 WDECallbackUpdate
*update
;
82 WMPropList
*plvalue
; /* default value */
85 /* used to map strings to integers */
93 static WDECallbackConvert getBool
;
94 static WDECallbackConvert getInt
;
95 static WDECallbackConvert getCoord
;
96 static WDECallbackConvert getPathList
;
97 static WDECallbackConvert getEnum
;
98 static WDECallbackConvert getTexture
;
99 static WDECallbackConvert getWSBackground
;
100 static WDECallbackConvert getWSSpecificBackground
;
101 static WDECallbackConvert getFont
;
102 static WDECallbackConvert getColor
;
103 static WDECallbackConvert getKeybind
;
104 static WDECallbackConvert getModMask
;
105 static WDECallbackConvert getPropList
;
107 /* value setting functions */
108 static WDECallbackUpdate setJustify
;
109 static WDECallbackUpdate setClearance
;
110 static WDECallbackUpdate setIfDockPresent
;
111 static WDECallbackUpdate setClipMergedInDock
;
112 static WDECallbackUpdate setWrapAppiconsInDock
;
113 static WDECallbackUpdate setStickyIcons
;
114 static WDECallbackUpdate setWidgetColor
;
115 static WDECallbackUpdate setIconTile
;
116 static WDECallbackUpdate setWinTitleFont
;
117 static WDECallbackUpdate setMenuTitleFont
;
118 static WDECallbackUpdate setMenuTextFont
;
119 static WDECallbackUpdate setIconTitleFont
;
120 static WDECallbackUpdate setIconTitleColor
;
121 static WDECallbackUpdate setIconTitleBack
;
122 static WDECallbackUpdate setFrameBorderWidth
;
123 static WDECallbackUpdate setFrameBorderColor
;
124 static WDECallbackUpdate setFrameFocusedBorderColor
;
125 static WDECallbackUpdate setFrameSelectedBorderColor
;
126 static WDECallbackUpdate setLargeDisplayFont
;
127 static WDECallbackUpdate setWTitleColor
;
128 static WDECallbackUpdate setFTitleBack
;
129 static WDECallbackUpdate setPTitleBack
;
130 static WDECallbackUpdate setUTitleBack
;
131 static WDECallbackUpdate setResizebarBack
;
132 static WDECallbackUpdate setWorkspaceBack
;
133 static WDECallbackUpdate setWorkspaceSpecificBack
;
134 static WDECallbackUpdate setMenuTitleColor
;
135 static WDECallbackUpdate setMenuTextColor
;
136 static WDECallbackUpdate setMenuDisabledColor
;
137 static WDECallbackUpdate setMenuTitleBack
;
138 static WDECallbackUpdate setMenuTextBack
;
139 static WDECallbackUpdate setHightlight
;
140 static WDECallbackUpdate setHightlightText
;
141 static WDECallbackUpdate setKeyGrab
;
142 static WDECallbackUpdate setDoubleClick
;
143 static WDECallbackUpdate setIconPosition
;
144 static WDECallbackUpdate setWorkspaceMapBackground
;
146 static WDECallbackUpdate setClipTitleFont
;
147 static WDECallbackUpdate setClipTitleColor
;
149 static WDECallbackUpdate setMenuStyle
;
150 static WDECallbackUpdate setSwPOptions
;
151 static WDECallbackUpdate updateUsableArea
;
153 static WDECallbackUpdate setModifierKeyLabels
;
155 static WDECallbackConvert getCursor
;
156 static WDECallbackUpdate setCursor
;
157 static WDECallbackUpdate updateDock
;
160 * Tables to convert strings to enumeration values.
161 * Values stored are char
164 /* WARNING: sum of length of all value strings must not exceed
166 #define TOTAL_VALUES_LENGTH 80
168 #define REFRESH_WINDOW_TEXTURES (1<<0)
169 #define REFRESH_MENU_TEXTURE (1<<1)
170 #define REFRESH_MENU_FONT (1<<2)
171 #define REFRESH_MENU_COLOR (1<<3)
172 #define REFRESH_MENU_TITLE_TEXTURE (1<<4)
173 #define REFRESH_MENU_TITLE_FONT (1<<5)
174 #define REFRESH_MENU_TITLE_COLOR (1<<6)
175 #define REFRESH_WINDOW_TITLE_COLOR (1<<7)
176 #define REFRESH_WINDOW_FONT (1<<8)
177 #define REFRESH_ICON_TILE (1<<9)
178 #define REFRESH_ICON_FONT (1<<10)
180 #define REFRESH_BUTTON_IMAGES (1<<11)
182 #define REFRESH_ICON_TITLE_COLOR (1<<12)
183 #define REFRESH_ICON_TITLE_BACK (1<<13)
185 #define REFRESH_WORKSPACE_MENU (1<<14)
187 #define REFRESH_FRAME_BORDER REFRESH_MENU_FONT|REFRESH_WINDOW_FONT
189 static WOptionEnumeration seFocusModes
[] = {
190 {"Manual", WKF_CLICK
, 0}, {"ClickToFocus", WKF_CLICK
, 1},
191 {"Sloppy", WKF_SLOPPY
, 0}, {"SemiAuto", WKF_SLOPPY
, 1}, {"Auto", WKF_SLOPPY
, 1},
195 static WOptionEnumeration seTitlebarModes
[] = {
196 {"new", TS_NEW
, 0}, {"old", TS_OLD
, 0},
197 {"next", TS_NEXT
, 0}, {NULL
, 0, 0}
200 static WOptionEnumeration seColormapModes
[] = {
201 {"Manual", WCM_CLICK
, 0}, {"ClickToFocus", WCM_CLICK
, 1},
202 {"Auto", WCM_POINTER
, 0}, {"FocusFollowMouse", WCM_POINTER
, 1},
206 static WOptionEnumeration sePlacements
[] = {
207 {"Auto", WPM_AUTO
, 0},
208 {"Smart", WPM_SMART
, 0},
209 {"Cascade", WPM_CASCADE
, 0},
210 {"Random", WPM_RANDOM
, 0},
211 {"Manual", WPM_MANUAL
, 0},
212 {"Center", WPM_CENTER
, 0},
216 static WOptionEnumeration seGeomDisplays
[] = {
217 {"None", WDIS_NONE
, 0},
218 {"Center", WDIS_CENTER
, 0},
219 {"Corner", WDIS_TOPLEFT
, 0},
220 {"Floating", WDIS_FRAME_CENTER
, 0},
221 {"Line", WDIS_NEW
, 0},
225 static WOptionEnumeration seSpeeds
[] = {
226 {"UltraFast", SPEED_ULTRAFAST
, 0},
227 {"Fast", SPEED_FAST
, 0},
228 {"Medium", SPEED_MEDIUM
, 0},
229 {"Slow", SPEED_SLOW
, 0},
230 {"UltraSlow", SPEED_ULTRASLOW
, 0},
234 static WOptionEnumeration seMouseButtonActions
[] = {
235 {"None", WA_NONE
, 0},
236 {"SelectWindows", WA_SELECT_WINDOWS
, 0},
237 {"OpenApplicationsMenu", WA_OPEN_APPMENU
, 0},
238 {"OpenWindowListMenu", WA_OPEN_WINLISTMENU
, 0},
239 {"MoveToPrevWorkspace", WA_MOVE_PREVWORKSPACE
, 0},
240 {"MoveToNextWorkspace", WA_MOVE_NEXTWORKSPACE
, 0},
241 {"MoveToPrevWindow", WA_MOVE_PREVWINDOW
, 0},
242 {"MoveToNextWindow", WA_MOVE_NEXTWINDOW
, 0},
246 static WOptionEnumeration seMouseWheelActions
[] = {
247 {"None", WA_NONE
, 0},
248 {"SwitchWorkspaces", WA_SWITCH_WORKSPACES
, 0},
249 {"SwitchWindows", WA_SWITCH_WINDOWS
, 0},
253 static WOptionEnumeration seIconificationStyles
[] = {
254 {"Zoom", WIS_ZOOM
, 0},
255 {"Twist", WIS_TWIST
, 0},
256 {"Flip", WIS_FLIP
, 0},
257 {"None", WIS_NONE
, 0},
258 {"random", WIS_RANDOM
, 0},
262 static WOptionEnumeration seJustifications
[] = {
263 {"Left", WTJ_LEFT
, 0},
264 {"Center", WTJ_CENTER
, 0},
265 {"Right", WTJ_RIGHT
, 0},
269 static WOptionEnumeration seIconPositions
[] = {
270 {"blv", IY_BOTTOM
| IY_LEFT
| IY_VERT
, 0},
271 {"blh", IY_BOTTOM
| IY_LEFT
| IY_HORIZ
, 0},
272 {"brv", IY_BOTTOM
| IY_RIGHT
| IY_VERT
, 0},
273 {"brh", IY_BOTTOM
| IY_RIGHT
| IY_HORIZ
, 0},
274 {"tlv", IY_TOP
| IY_LEFT
| IY_VERT
, 0},
275 {"tlh", IY_TOP
| IY_LEFT
| IY_HORIZ
, 0},
276 {"trv", IY_TOP
| IY_RIGHT
| IY_VERT
, 0},
277 {"trh", IY_TOP
| IY_RIGHT
| IY_HORIZ
, 0},
281 static WOptionEnumeration seMenuStyles
[] = {
282 {"normal", MS_NORMAL
, 0},
283 {"singletexture", MS_SINGLE_TEXTURE
, 0},
284 {"flat", MS_FLAT
, 0},
288 static WOptionEnumeration seDisplayPositions
[] = {
289 {"none", WD_NONE
, 0},
290 {"center", WD_CENTER
, 0},
292 {"bottom", WD_BOTTOM
, 0},
293 {"topleft", WD_TOPLEFT
, 0},
294 {"topright", WD_TOPRIGHT
, 0},
295 {"bottomleft", WD_BOTTOMLEFT
, 0},
296 {"bottomright", WD_BOTTOMRIGHT
, 0},
300 static WOptionEnumeration seWorkspaceBorder
[] = {
301 {"None", WB_NONE
, 0},
302 {"LeftRight", WB_LEFTRIGHT
, 0},
303 {"TopBottom", WB_TOPBOTTOM
, 0},
304 {"AllDirections", WB_ALLDIRS
, 0},
308 static WOptionEnumeration seDragMaximizedWindow
[] = {
309 {"Move", DRAGMAX_MOVE
, 0},
310 {"RestoreGeometry", DRAGMAX_RESTORE
, 0},
311 {"Unmaximize", DRAGMAX_UNMAXIMIZE
, 0},
312 {"NoMove", DRAGMAX_NOMOVE
, 0},
317 * ALL entries in the tables below NEED to have a default value
318 * defined, and this value needs to be correct.
320 * Also add the default key/value pair to WindowMaker/Defaults/WindowMaker.in
323 /* these options will only affect the window manager on startup
325 * static defaults can't access the screen data, because it is
326 * created after these defaults are read
328 WDefaultEntry staticOptionList
[] = {
330 {"ColormapSize", "4", NULL
,
331 &wPreferences
.cmap_size
, getInt
, NULL
, NULL
, NULL
},
332 {"DisableDithering", "NO", NULL
,
333 &wPreferences
.no_dithering
, getBool
, NULL
, NULL
, NULL
},
334 {"IconSize", "64", NULL
,
335 &wPreferences
.icon_size
, getInt
, NULL
, NULL
, NULL
},
336 {"ModifierKey", "Mod1", NULL
,
337 &wPreferences
.modifier_mask
, getModMask
, NULL
, NULL
, NULL
},
338 {"FocusMode", "manual", seFocusModes
, /* have a problem when switching from */
339 &wPreferences
.focus_mode
, getEnum
, NULL
, NULL
, NULL
}, /* manual to sloppy without restart */
340 {"NewStyle", "new", seTitlebarModes
,
341 &wPreferences
.new_style
, getEnum
, NULL
, NULL
, NULL
},
342 {"DisableDock", "NO", (void *)WM_DOCK
,
343 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
344 {"DisableClip", "NO", (void *)WM_CLIP
,
345 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
346 {"DisableDrawers", "NO", (void *)WM_DRAWER
,
347 NULL
, getBool
, setIfDockPresent
, NULL
, NULL
},
348 {"ClipMergedInDock", "NO", NULL
,
349 NULL
, getBool
, setClipMergedInDock
, NULL
, NULL
},
350 {"DisableMiniwindows", "NO", NULL
,
351 &wPreferences
.disable_miniwindows
, getBool
, NULL
, NULL
, NULL
},
352 {"EnableWorkspacePager", "NO", NULL
,
353 &wPreferences
.enable_workspace_pager
, getBool
, NULL
, NULL
, NULL
},
354 {"SwitchPanelIconSize", "64", NULL
,
355 &wPreferences
.switch_panel_icon_size
, getInt
, NULL
, NULL
, NULL
},
358 #define NUM2STRING_(x) #x
359 #define NUM2STRING(x) NUM2STRING_(x)
361 WDefaultEntry optionList
[] = {
363 /* dynamic options */
365 {"IconPosition", "blh", seIconPositions
,
366 &wPreferences
.icon_yard
, getEnum
, setIconPosition
, NULL
, NULL
},
367 {"IconificationStyle", "Zoom", seIconificationStyles
,
368 &wPreferences
.iconification_style
, getEnum
, NULL
, NULL
, NULL
},
369 {"EnforceIconMargin", "NO", NULL
,
370 &wPreferences
.enforce_icon_margin
, getBool
, NULL
, NULL
, NULL
},
371 {"DisableWSMouseActions", "NO", NULL
,
372 &wPreferences
.disable_root_mouse
, getBool
, NULL
, NULL
, NULL
},
373 {"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions
,
374 &wPreferences
.mouse_button1
, getEnum
, NULL
, NULL
, NULL
},
375 {"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions
,
376 &wPreferences
.mouse_button2
, getEnum
, NULL
, NULL
, NULL
},
377 {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions
,
378 &wPreferences
.mouse_button3
, getEnum
, NULL
, NULL
, NULL
},
379 {"MouseBackwardButtonAction", "None", seMouseButtonActions
,
380 &wPreferences
.mouse_button8
, getEnum
, NULL
, NULL
, NULL
},
381 {"MouseForwardButtonAction", "None", seMouseButtonActions
,
382 &wPreferences
.mouse_button9
, getEnum
, NULL
, NULL
, NULL
},
383 {"MouseWheelAction", "None", seMouseWheelActions
,
384 &wPreferences
.mouse_wheel_scroll
, getEnum
, NULL
, NULL
, NULL
},
385 {"MouseWheelTiltAction", "None", seMouseWheelActions
,
386 &wPreferences
.mouse_wheel_tilt
, getEnum
, NULL
, NULL
, NULL
},
387 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
388 &wPreferences
.pixmap_path
, getPathList
, NULL
, NULL
, NULL
},
389 {"IconPath", DEF_ICON_PATHS
, NULL
,
390 &wPreferences
.icon_path
, getPathList
, NULL
, NULL
, NULL
},
391 {"ColormapMode", "auto", seColormapModes
,
392 &wPreferences
.colormap_mode
, getEnum
, NULL
, NULL
, NULL
},
393 {"AutoFocus", "YES", NULL
,
394 &wPreferences
.auto_focus
, getBool
, NULL
, NULL
, NULL
},
395 {"RaiseDelay", "0", NULL
,
396 &wPreferences
.raise_delay
, getInt
, NULL
, NULL
, NULL
},
397 {"CirculateRaise", "NO", NULL
,
398 &wPreferences
.circ_raise
, getBool
, NULL
, NULL
, NULL
},
399 {"Superfluous", "YES", NULL
,
400 &wPreferences
.superfluous
, getBool
, NULL
, NULL
, NULL
},
401 {"AdvanceToNewWorkspace", "NO", NULL
,
402 &wPreferences
.ws_advance
, getBool
, NULL
, NULL
, NULL
},
403 {"CycleWorkspaces", "NO", NULL
,
404 &wPreferences
.ws_cycle
, getBool
, NULL
, NULL
, NULL
},
405 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
406 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
, NULL
, NULL
},
407 {"WorkspaceBorder", "None", seWorkspaceBorder
,
408 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
, NULL
, NULL
},
409 {"WorkspaceBorderSize", "0", NULL
,
410 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
, NULL
, NULL
},
411 {"StickyIcons", "NO", NULL
,
412 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
, NULL
, NULL
},
413 {"SaveSessionOnExit", "NO", NULL
,
414 &wPreferences
.save_session_on_exit
, getBool
, NULL
, NULL
, NULL
},
415 {"WrapMenus", "NO", NULL
,
416 &wPreferences
.wrap_menus
, getBool
, NULL
, NULL
, NULL
},
417 {"ScrollableMenus", "YES", NULL
,
418 &wPreferences
.scrollable_menus
, getBool
, NULL
, NULL
, NULL
},
419 {"MenuScrollSpeed", "fast", seSpeeds
,
420 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
, NULL
, NULL
},
421 {"IconSlideSpeed", "fast", seSpeeds
,
422 &wPreferences
.icon_slide_speed
, getEnum
, NULL
, NULL
, NULL
},
423 {"ShadeSpeed", "fast", seSpeeds
,
424 &wPreferences
.shade_speed
, getEnum
, NULL
, NULL
, NULL
},
425 {"BounceAppIconsWhenUrgent", "YES", NULL
,
426 &wPreferences
.bounce_appicons_when_urgent
, getBool
, NULL
, NULL
, NULL
},
427 {"RaiseAppIconsWhenBouncing", "NO", NULL
,
428 &wPreferences
.raise_appicons_when_bouncing
, getBool
, NULL
, NULL
, NULL
},
429 {"DoNotMakeAppIconsBounce", "NO", NULL
,
430 &wPreferences
.do_not_make_appicons_bounce
, getBool
, NULL
, NULL
, NULL
},
431 {"DoubleClickTime", "250", (void *)&wPreferences
.dblclick_time
,
432 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
, NULL
, NULL
},
433 {"ClipAutoraiseDelay", "600", NULL
,
434 &wPreferences
.clip_auto_raise_delay
, getInt
, NULL
, NULL
, NULL
},
435 {"ClipAutolowerDelay", "1000", NULL
,
436 &wPreferences
.clip_auto_lower_delay
, getInt
, NULL
, NULL
, NULL
},
437 {"ClipAutoexpandDelay", "600", NULL
,
438 &wPreferences
.clip_auto_expand_delay
, getInt
, NULL
, NULL
, NULL
},
439 {"ClipAutocollapseDelay", "1000", NULL
,
440 &wPreferences
.clip_auto_collapse_delay
, getInt
, NULL
, NULL
, NULL
},
441 {"WrapAppiconsInDock", "YES", NULL
,
442 NULL
, getBool
, setWrapAppiconsInDock
, NULL
, NULL
},
443 {"AlignSubmenus", "NO", NULL
,
444 &wPreferences
.align_menus
, getBool
, NULL
, NULL
, NULL
},
445 {"ViKeyMenus", "NO", NULL
,
446 &wPreferences
.vi_key_menus
, getBool
, NULL
, NULL
, NULL
},
447 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
448 &wPreferences
.open_transients_with_parent
, getBool
, NULL
, NULL
, NULL
},
449 {"WindowPlacement", "auto", sePlacements
,
450 &wPreferences
.window_placement
, getEnum
, NULL
, NULL
, NULL
},
451 {"IgnoreFocusClick", "NO", NULL
,
452 &wPreferences
.ignore_focus_click
, getBool
, NULL
, NULL
, NULL
},
453 {"UseSaveUnders", "NO", NULL
,
454 &wPreferences
.use_saveunders
, getBool
, NULL
, NULL
, NULL
},
455 {"OpaqueMove", "YES", NULL
,
456 &wPreferences
.opaque_move
, getBool
, NULL
, NULL
, NULL
},
457 {"OpaqueResize", "NO", NULL
,
458 &wPreferences
.opaque_resize
, getBool
, NULL
, NULL
, NULL
},
459 {"OpaqueMoveResizeKeyboard", "NO", NULL
,
460 &wPreferences
.opaque_move_resize_keyboard
, getBool
, NULL
, NULL
, NULL
},
461 {"DisableAnimations", "NO", NULL
,
462 &wPreferences
.no_animations
, getBool
, NULL
, NULL
, NULL
},
463 {"DontLinkWorkspaces", "YES", NULL
,
464 &wPreferences
.no_autowrap
, getBool
, NULL
, NULL
, NULL
},
465 {"WindowSnapping", "NO", NULL
,
466 &wPreferences
.window_snapping
, getBool
, NULL
, NULL
, NULL
},
467 {"SnapEdgeDetect", "1", NULL
,
468 &wPreferences
.snap_edge_detect
, getInt
, NULL
, NULL
, NULL
},
469 {"SnapCornerDetect", "10", NULL
,
470 &wPreferences
.snap_corner_detect
, getInt
, NULL
, NULL
, NULL
},
471 {"SnapToTopMaximizesFullscreen", "NO", NULL
,
472 &wPreferences
.snap_to_top_maximizes_fullscreen
, getBool
, NULL
, NULL
, NULL
},
473 {"DragMaximizedWindow", "Move", seDragMaximizedWindow
,
474 &wPreferences
.drag_maximized_window
, getEnum
, NULL
, NULL
, NULL
},
475 {"MoveHalfMaximizedWindowsBetweenScreens", "NO", NULL
,
476 &wPreferences
.move_half_max_between_heads
, getBool
, NULL
, NULL
, NULL
},
477 {"AlternativeHalfMaximized", "NO", NULL
,
478 &wPreferences
.alt_half_maximize
, getBool
, NULL
, NULL
, NULL
},
479 {"PointerWithHalfMaxWindows", "NO", NULL
,
480 &wPreferences
.pointer_with_half_max_windows
, getBool
, NULL
, NULL
, NULL
},
481 {"HighlightActiveApp", "YES", NULL
,
482 &wPreferences
.highlight_active_app
, getBool
, NULL
, NULL
, NULL
},
483 {"AutoArrangeIcons", "NO", NULL
,
484 &wPreferences
.auto_arrange_icons
, getBool
, NULL
, NULL
, NULL
},
485 {"NoWindowOverDock", "NO", NULL
,
486 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
, NULL
, NULL
},
487 {"NoWindowOverIcons", "NO", NULL
,
488 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
, NULL
, NULL
},
489 {"WindowPlaceOrigin", "(64, 0)", NULL
,
490 &wPreferences
.window_place_origin
, getCoord
, NULL
, NULL
, NULL
},
491 {"ResizeDisplay", "center", seGeomDisplays
,
492 &wPreferences
.size_display
, getEnum
, NULL
, NULL
, NULL
},
493 {"MoveDisplay", "floating", seGeomDisplays
,
494 &wPreferences
.move_display
, getEnum
, NULL
, NULL
, NULL
},
495 {"DontConfirmKill", "NO", NULL
,
496 &wPreferences
.dont_confirm_kill
, getBool
, NULL
, NULL
, NULL
},
497 {"WindowTitleBalloons", "YES", NULL
,
498 &wPreferences
.window_balloon
, getBool
, NULL
, NULL
, NULL
},
499 {"MiniwindowTitleBalloons", "NO", NULL
,
500 &wPreferences
.miniwin_title_balloon
, getBool
, NULL
, NULL
, NULL
},
501 {"MiniwindowPreviewBalloons", "NO", NULL
,
502 &wPreferences
.miniwin_preview_balloon
, getBool
, NULL
, NULL
, NULL
},
503 {"AppIconBalloons", "NO", NULL
,
504 &wPreferences
.appicon_balloon
, getBool
, NULL
, NULL
, NULL
},
505 {"HelpBalloons", "NO", NULL
,
506 &wPreferences
.help_balloon
, getBool
, NULL
, NULL
, NULL
},
507 {"EdgeResistance", "30", NULL
,
508 &wPreferences
.edge_resistance
, getInt
, NULL
, NULL
, NULL
},
509 {"ResizeIncrement", "0", NULL
,
510 &wPreferences
.resize_increment
, getInt
, NULL
, NULL
, NULL
},
511 {"Attraction", "NO", NULL
,
512 &wPreferences
.attract
, getBool
, NULL
, NULL
, NULL
},
513 {"DisableBlinking", "NO", NULL
,
514 &wPreferences
.dont_blink
, getBool
, NULL
, NULL
, NULL
},
515 {"SingleClickLaunch", "NO", NULL
,
516 &wPreferences
.single_click
, getBool
, NULL
, NULL
, NULL
},
517 {"StrictWindozeCycle", "YES", NULL
,
518 &wPreferences
.strict_windoze_cycle
, getBool
, NULL
, NULL
, NULL
},
519 {"SwitchPanelOnlyOpen", "NO", NULL
,
520 &wPreferences
.panel_only_open
, getBool
, NULL
, NULL
, NULL
},
521 {"MiniPreviewSize", "128", NULL
,
522 &wPreferences
.minipreview_size
, getInt
, NULL
, NULL
, NULL
},
523 {"IgnoreGtkHints", "NO", NULL
,
524 &wPreferences
.ignore_gtk_decoration_hints
, getBool
, NULL
, NULL
, NULL
},
525 {"KeepDockOnPrimaryHead", "NO", NULL
,
526 &wPreferences
.keep_dock_on_primary_head
, getBool
, updateDock
,
531 {"MenuStyle", "normal", seMenuStyles
,
532 &wPreferences
.menu_style
, getEnum
, setMenuStyle
, NULL
, NULL
},
533 {"WidgetColor", "(solid, gray)", NULL
,
534 NULL
, getTexture
, setWidgetColor
, NULL
, NULL
},
535 {"WorkspaceSpecificBack", "()", NULL
,
536 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
, NULL
, NULL
},
537 /* WorkspaceBack must come after WorkspaceSpecificBack or
538 * WorkspaceBack won't know WorkspaceSpecificBack was also
539 * specified and 2 copies of wmsetbg will be launched */
540 {"WorkspaceBack", "(solid, \"rgb:50/50/75\")", NULL
,
541 NULL
, getWSBackground
, setWorkspaceBack
, NULL
, NULL
},
542 {"SmoothWorkspaceBack", "NO", NULL
,
543 NULL
, getBool
, NULL
, NULL
, NULL
},
544 {"IconBack", "(dgradient, \"rgb:a6/a6/b6\", \"rgb:51/55/61\")", NULL
,
545 NULL
, getTexture
, setIconTile
, NULL
, NULL
},
546 {"TitleJustify", "center", seJustifications
,
547 &wPreferences
.title_justification
, getEnum
, setJustify
, NULL
, NULL
},
548 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
549 NULL
, getFont
, setWinTitleFont
, NULL
, NULL
},
550 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
551 &wPreferences
.window_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
552 {"WindowTitleMinHeight", "0", NULL
,
553 &wPreferences
.window_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
554 {"WindowTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
555 &wPreferences
.window_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
556 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
557 &wPreferences
.menu_title_clearance
, getInt
, setClearance
, NULL
, NULL
},
558 {"MenuTitleMinHeight", "0", NULL
,
559 &wPreferences
.menu_title_min_height
, getInt
, setClearance
, NULL
, NULL
},
560 {"MenuTitleMaxHeight", NUM2STRING(INT_MAX
), NULL
,
561 &wPreferences
.menu_title_max_height
, getInt
, setClearance
, NULL
, NULL
},
562 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
563 &wPreferences
.menu_text_clearance
, getInt
, setClearance
, NULL
, NULL
},
564 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
565 NULL
, getFont
, setMenuTitleFont
, NULL
, NULL
},
566 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
567 NULL
, getFont
, setMenuTextFont
, NULL
, NULL
},
568 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
569 NULL
, getFont
, setIconTitleFont
, NULL
, NULL
},
570 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
571 NULL
, getFont
, setClipTitleFont
, NULL
, NULL
},
572 {"ShowClipTitle", "YES", NULL
,
573 &wPreferences
.show_clip_title
, getBool
, NULL
, NULL
, NULL
},
574 {"LargeDisplayFont", DEF_WORKSPACE_NAME_FONT
, NULL
,
575 NULL
, getFont
, setLargeDisplayFont
, NULL
, NULL
},
576 {"HighlightColor", "white", NULL
,
577 NULL
, getColor
, setHightlight
, NULL
, NULL
},
578 {"HighlightTextColor", "black", NULL
,
579 NULL
, getColor
, setHightlightText
, NULL
, NULL
},
580 {"ClipTitleColor", "black", (void *)CLIP_NORMAL
,
581 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
582 {"CClipTitleColor", "\"rgb:61/61/61\"", (void *)CLIP_COLLAPSED
,
583 NULL
, getColor
, setClipTitleColor
, NULL
, NULL
},
584 {"FTitleColor", "white", (void *)WS_FOCUSED
,
585 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
586 {"PTitleColor", "white", (void *)WS_PFOCUSED
,
587 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
588 {"UTitleColor", "black", (void *)WS_UNFOCUSED
,
589 NULL
, getColor
, setWTitleColor
, NULL
, NULL
},
590 {"FTitleBack", "(solid, black)", NULL
,
591 NULL
, getTexture
, setFTitleBack
, NULL
, NULL
},
592 {"PTitleBack", "(solid, gray40)", NULL
,
593 NULL
, getTexture
, setPTitleBack
, NULL
, NULL
},
594 {"UTitleBack", "(solid, \"rgb:aa/aa/aa\")", NULL
,
595 NULL
, getTexture
, setUTitleBack
, NULL
, NULL
},
596 {"ResizebarBack", "(solid, \"rgb:aa/aa/aa\")", NULL
,
597 NULL
, getTexture
, setResizebarBack
, NULL
, NULL
},
598 {"MenuTitleColor", "white", NULL
,
599 NULL
, getColor
, setMenuTitleColor
, NULL
, NULL
},
600 {"MenuTextColor", "black", NULL
,
601 NULL
, getColor
, setMenuTextColor
, NULL
, NULL
},
602 {"MenuDisabledColor", "gray50", NULL
,
603 NULL
, getColor
, setMenuDisabledColor
, NULL
, NULL
},
604 {"MenuTitleBack", "(solid, black)", NULL
,
605 NULL
, getTexture
, setMenuTitleBack
, NULL
, NULL
},
606 {"MenuTextBack", "(solid, \"rgb:aa/aa/aa\")", NULL
,
607 NULL
, getTexture
, setMenuTextBack
, NULL
, NULL
},
608 {"IconTitleColor", "white", NULL
,
609 NULL
, getColor
, setIconTitleColor
, NULL
, NULL
},
610 {"IconTitleBack", "black", NULL
,
611 NULL
, getColor
, setIconTitleBack
, NULL
, NULL
},
612 {"SwitchPanelImages", "(swtile.png, swback.png, 30, 40)", &wPreferences
,
613 NULL
, getPropList
, setSwPOptions
, NULL
, NULL
},
614 {"ModifierKeyLabels", "(\"Shift+\", \"Control+\", \"Mod1+\", \"Mod2+\", \"Mod3+\", \"Mod4+\", \"Mod5+\")", &wPreferences
,
615 NULL
, getPropList
, setModifierKeyLabels
, NULL
, NULL
},
616 {"FrameBorderWidth", "1", NULL
,
617 NULL
, getInt
, setFrameBorderWidth
, NULL
, NULL
},
618 {"FrameBorderColor", "black", NULL
,
619 NULL
, getColor
, setFrameBorderColor
, NULL
, NULL
},
620 {"FrameFocusedBorderColor", "black", NULL
,
621 NULL
, getColor
, setFrameFocusedBorderColor
, NULL
, NULL
},
622 {"FrameSelectedBorderColor", "white", NULL
,
623 NULL
, getColor
, setFrameSelectedBorderColor
, NULL
, NULL
},
624 {"WorkspaceMapBack", "(solid, black)", NULL
,
625 NULL
, getTexture
, setWorkspaceMapBackground
, NULL
, NULL
},
629 {"RootMenuKey", "F12", (void *)WKBD_ROOTMENU
,
630 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
631 {"WindowListKey", "F11", (void *)WKBD_WINDOWLIST
,
632 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
633 {"WindowMenuKey", "Control+Escape", (void *)WKBD_WINDOWMENU
,
634 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
635 {"DockRaiseLowerKey", "None", (void*)WKBD_DOCKRAISELOWER
,
636 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
637 {"ClipRaiseLowerKey", "None", (void *)WKBD_CLIPRAISELOWER
,
638 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
639 {"MiniaturizeKey", "Mod1+M", (void *)WKBD_MINIATURIZE
,
640 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
641 {"MinimizeAllKey", "None", (void *)WKBD_MINIMIZEALL
,
642 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
643 {"HideKey", "Mod1+H", (void *)WKBD_HIDE
,
644 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
645 {"HideOthersKey", "None", (void *)WKBD_HIDE_OTHERS
,
646 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
647 {"MoveResizeKey", "None", (void *)WKBD_MOVERESIZE
,
648 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
649 {"CloseKey", "None", (void *)WKBD_CLOSE
,
650 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
651 {"MaximizeKey", "None", (void *)WKBD_MAXIMIZE
,
652 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
653 {"VMaximizeKey", "None", (void *)WKBD_VMAXIMIZE
,
654 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
655 {"HMaximizeKey", "None", (void *)WKBD_HMAXIMIZE
,
656 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
657 {"LHMaximizeKey", "None", (void*)WKBD_LHMAXIMIZE
,
658 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
659 {"RHMaximizeKey", "None", (void*)WKBD_RHMAXIMIZE
,
660 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
661 {"THMaximizeKey", "None", (void*)WKBD_THMAXIMIZE
,
662 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
663 {"BHMaximizeKey", "None", (void*)WKBD_BHMAXIMIZE
,
664 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
665 {"LTCMaximizeKey", "None", (void*)WKBD_LTCMAXIMIZE
,
666 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
667 {"RTCMaximizeKey", "None", (void*)WKBD_RTCMAXIMIZE
,
668 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
669 {"LBCMaximizeKey", "None", (void*)WKBD_LBCMAXIMIZE
,
670 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
671 {"RBCMaximizeKey", "None", (void*)WKBD_RBCMAXIMIZE
,
672 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
673 {"MaximusKey", "None", (void*)WKBD_MAXIMUS
,
674 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
675 {"KeepOnTopKey", "None", (void *)WKBD_KEEP_ON_TOP
,
676 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
677 {"KeepAtBottomKey", "None", (void *)WKBD_KEEP_AT_BOTTOM
,
678 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
679 {"OmnipresentKey", "None", (void *)WKBD_OMNIPRESENT
,
680 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
681 {"RaiseKey", "Mod1+Up", (void *)WKBD_RAISE
,
682 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
683 {"LowerKey", "Mod1+Down", (void *)WKBD_LOWER
,
684 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
685 {"RaiseLowerKey", "None", (void *)WKBD_RAISELOWER
,
686 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
687 {"ShadeKey", "None", (void *)WKBD_SHADE
,
688 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
689 {"SelectKey", "None", (void *)WKBD_SELECT
,
690 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
691 {"WorkspaceMapKey", "None", (void *)WKBD_WORKSPACEMAP
,
692 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
693 {"FocusNextKey", "Mod1+Tab", (void *)WKBD_FOCUSNEXT
,
694 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
695 {"FocusPrevKey", "Mod1+Shift+Tab", (void *)WKBD_FOCUSPREV
,
696 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
697 {"GroupNextKey", "None", (void *)WKBD_GROUPNEXT
,
698 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
699 {"GroupPrevKey", "None", (void *)WKBD_GROUPPREV
,
700 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
701 {"NextWorkspaceKey", "Mod1+Control+Right", (void *)WKBD_NEXTWORKSPACE
,
702 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
703 {"PrevWorkspaceKey", "Mod1+Control+Left", (void *)WKBD_PREVWORKSPACE
,
704 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
705 {"LastWorkspaceKey", "None", (void *)WKBD_LASTWORKSPACE
,
706 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
707 {"NextWorkspaceLayerKey", "None", (void *)WKBD_NEXTWSLAYER
,
708 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
709 {"PrevWorkspaceLayerKey", "None", (void *)WKBD_PREVWSLAYER
,
710 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
711 {"Workspace1Key", "Mod1+1", (void *)WKBD_WORKSPACE1
,
712 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
713 {"Workspace2Key", "Mod1+2", (void *)WKBD_WORKSPACE2
,
714 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
715 {"Workspace3Key", "Mod1+3", (void *)WKBD_WORKSPACE3
,
716 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
717 {"Workspace4Key", "Mod1+4", (void *)WKBD_WORKSPACE4
,
718 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
719 {"Workspace5Key", "Mod1+5", (void *)WKBD_WORKSPACE5
,
720 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
721 {"Workspace6Key", "Mod1+6", (void *)WKBD_WORKSPACE6
,
722 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
723 {"Workspace7Key", "Mod1+7", (void *)WKBD_WORKSPACE7
,
724 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
725 {"Workspace8Key", "Mod1+8", (void *)WKBD_WORKSPACE8
,
726 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
727 {"Workspace9Key", "Mod1+9", (void *)WKBD_WORKSPACE9
,
728 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
729 {"Workspace10Key", "Mod1+0", (void *)WKBD_WORKSPACE10
,
730 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
731 {"MoveToWorkspace1Key", "None", (void *)WKBD_MOVE_WORKSPACE1
,
732 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
733 {"MoveToWorkspace2Key", "None", (void *)WKBD_MOVE_WORKSPACE2
,
734 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
735 {"MoveToWorkspace3Key", "None", (void *)WKBD_MOVE_WORKSPACE3
,
736 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
737 {"MoveToWorkspace4Key", "None", (void *)WKBD_MOVE_WORKSPACE4
,
738 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
739 {"MoveToWorkspace5Key", "None", (void *)WKBD_MOVE_WORKSPACE5
,
740 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
741 {"MoveToWorkspace6Key", "None", (void *)WKBD_MOVE_WORKSPACE6
,
742 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
743 {"MoveToWorkspace7Key", "None", (void *)WKBD_MOVE_WORKSPACE7
,
744 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
745 {"MoveToWorkspace8Key", "None", (void *)WKBD_MOVE_WORKSPACE8
,
746 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
747 {"MoveToWorkspace9Key", "None", (void *)WKBD_MOVE_WORKSPACE9
,
748 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
749 {"MoveToWorkspace10Key", "None", (void *)WKBD_MOVE_WORKSPACE10
,
750 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
751 {"MoveToNextWorkspaceKey", "None", (void *)WKBD_MOVE_NEXTWORKSPACE
,
752 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
753 {"MoveToPrevWorkspaceKey", "None", (void *)WKBD_MOVE_PREVWORKSPACE
,
754 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
755 {"MoveToLastWorkspaceKey", "None", (void *)WKBD_MOVE_LASTWORKSPACE
,
756 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
757 {"MoveToNextWorkspaceLayerKey", "None", (void *)WKBD_MOVE_NEXTWSLAYER
,
758 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
759 {"MoveToPrevWorkspaceLayerKey", "None", (void *)WKBD_MOVE_PREVWSLAYER
,
760 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
761 {"WindowShortcut1Key", "None", (void *)WKBD_WINDOW1
,
762 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
763 {"WindowShortcut2Key", "None", (void *)WKBD_WINDOW2
,
764 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
765 {"WindowShortcut3Key", "None", (void *)WKBD_WINDOW3
,
766 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
767 {"WindowShortcut4Key", "None", (void *)WKBD_WINDOW4
,
768 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
769 {"WindowShortcut5Key", "None", (void *)WKBD_WINDOW5
,
770 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
771 {"WindowShortcut6Key", "None", (void *)WKBD_WINDOW6
,
772 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
773 {"WindowShortcut7Key", "None", (void *)WKBD_WINDOW7
,
774 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
775 {"WindowShortcut8Key", "None", (void *)WKBD_WINDOW8
,
776 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
777 {"WindowShortcut9Key", "None", (void *)WKBD_WINDOW9
,
778 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
779 {"WindowShortcut10Key", "None", (void *)WKBD_WINDOW10
,
780 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
781 {"MoveTo12to6Head", "None", (void *)WKBD_MOVE_12_TO_6_HEAD
,
782 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
783 {"MoveTo6to12Head", "None", (void *)WKBD_MOVE_6_TO_12_HEAD
,
784 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
785 {"WindowRelaunchKey", "None", (void *)WKBD_RELAUNCH
,
786 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
787 {"ScreenSwitchKey", "None", (void *)WKBD_SWITCH_SCREEN
,
788 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
789 {"RunKey", "None", (void *)WKBD_RUN
,
790 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
791 {"ExitKey", "None", (void *)WKBD_EXIT
,
792 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
794 #ifdef KEEP_XKB_LOCK_STATUS
795 {"ToggleKbdModeKey", "None", (void *)WKBD_TOGGLE
,
796 NULL
, getKeybind
, setKeyGrab
, NULL
, NULL
},
797 {"KbdModeLock", "NO", NULL
,
798 &wPreferences
.modelock
, getBool
, NULL
, NULL
, NULL
},
799 #endif /* KEEP_XKB_LOCK_STATUS */
801 {"NormalCursor", "(builtin, left_ptr)", (void *)WCUR_ROOT
,
802 NULL
, getCursor
, setCursor
, NULL
, NULL
},
803 {"ArrowCursor", "(builtin, top_left_arrow)", (void *)WCUR_ARROW
,
804 NULL
, getCursor
, setCursor
, NULL
, NULL
},
805 {"MoveCursor", "(builtin, fleur)", (void *)WCUR_MOVE
,
806 NULL
, getCursor
, setCursor
, NULL
, NULL
},
807 {"ResizeCursor", "(builtin, sizing)", (void *)WCUR_RESIZE
,
808 NULL
, getCursor
, setCursor
, NULL
, NULL
},
809 {"TopLeftResizeCursor", "(builtin, top_left_corner)", (void *)WCUR_TOPLEFTRESIZE
,
810 NULL
, getCursor
, setCursor
, NULL
, NULL
},
811 {"TopRightResizeCursor", "(builtin, top_right_corner)", (void *)WCUR_TOPRIGHTRESIZE
,
812 NULL
, getCursor
, setCursor
, NULL
, NULL
},
813 {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)", (void *)WCUR_BOTTOMLEFTRESIZE
,
814 NULL
, getCursor
, setCursor
, NULL
, NULL
},
815 {"BottomRightResizeCursor", "(builtin, bottom_right_corner)", (void *)WCUR_BOTTOMRIGHTRESIZE
,
816 NULL
, getCursor
, setCursor
, NULL
, NULL
},
817 {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)", (void *)WCUR_VERTICALRESIZE
,
818 NULL
, getCursor
, setCursor
, NULL
, NULL
},
819 {"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)", (void *)WCUR_HORIZONRESIZE
,
820 NULL
, getCursor
, setCursor
, NULL
, NULL
},
821 {"WaitCursor", "(builtin, watch)", (void *)WCUR_WAIT
,
822 NULL
, getCursor
, setCursor
, NULL
, NULL
},
823 {"QuestionCursor", "(builtin, question_arrow)", (void *)WCUR_QUESTION
,
824 NULL
, getCursor
, setCursor
, NULL
, NULL
},
825 {"TextCursor", "(builtin, xterm)", (void *)WCUR_TEXT
,
826 NULL
, getCursor
, setCursor
, NULL
, NULL
},
827 {"SelectCursor", "(builtin, cross)", (void *)WCUR_SELECT
,
828 NULL
, getCursor
, setCursor
, NULL
, NULL
},
829 {"DialogHistoryLines", "500", NULL
,
830 &wPreferences
.history_lines
, getInt
, NULL
, NULL
, NULL
},
831 {"CycleActiveHeadOnly", "NO", NULL
,
832 &wPreferences
.cycle_active_head_only
, getBool
, NULL
, NULL
, NULL
},
833 {"CycleIgnoreMinimized", "NO", NULL
,
834 &wPreferences
.cycle_ignore_minimized
, getBool
, NULL
, NULL
, NULL
},
835 {"DbClickFullScreen", "NO", NULL
,
836 &wPreferences
.double_click_fullscreen
, getBool
, NULL
, NULL
, NULL
},
837 {"CloseRootMenuByLeftOrRightMouseClick", "NO", NULL
,
838 &wPreferences
.close_rootmenu_left_right_click
, getBool
, NULL
, NULL
, NULL
}
841 static void initDefaults(void)
844 WDefaultEntry
*entry
;
846 WMPLSetCaseSensitive(False
);
848 for (i
= 0; i
< wlengthof(optionList
); i
++) {
849 entry
= &optionList
[i
];
851 entry
->plkey
= WMCreatePLString(entry
->key
);
852 if (entry
->default_value
)
853 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
855 entry
->plvalue
= NULL
;
858 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
859 entry
= &staticOptionList
[i
];
861 entry
->plkey
= WMCreatePLString(entry
->key
);
862 if (entry
->default_value
)
863 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
865 entry
->plvalue
= NULL
;
869 static WMPropList
*readGlobalDomain(const char *domainName
, Bool requireDictionary
)
871 WMPropList
*globalDict
= NULL
;
875 snprintf(path
, sizeof(path
), "%s/%s", PKGCONFDIR
, domainName
);
876 if (stat(path
, &stbuf
) >= 0) {
877 globalDict
= WMReadPropListFromFile(path
);
878 if (globalDict
&& requireDictionary
&& !WMIsPLDictionary(globalDict
)) {
879 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"), domainName
, path
);
880 WMReleasePropList(globalDict
);
882 } else if (!globalDict
) {
883 wwarning(_("could not load domain %s from global defaults database"), domainName
);
890 #if defined(GLOBAL_PREAMBLE_MENU_FILE) || defined(GLOBAL_EPILOGUE_MENU_FILE)
891 static void prependMenu(WMPropList
* destarr
, WMPropList
* array
)
896 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
897 item
= WMGetFromPLArray(array
, i
);
899 WMInsertInPLArray(destarr
, i
+ 1, item
);
903 static void appendMenu(WMPropList
* destarr
, WMPropList
* array
)
908 for (i
= 0; i
< WMGetPropListItemCount(array
); i
++) {
909 item
= WMGetFromPLArray(array
, i
);
911 WMAddToPLArray(destarr
, item
);
916 void wDefaultsMergeGlobalMenus(WDDomain
* menuDomain
)
918 WMPropList
*menu
= menuDomain
->dictionary
;
921 if (!menu
|| !WMIsPLArray(menu
))
924 #ifdef GLOBAL_PREAMBLE_MENU_FILE
925 submenu
= WMReadPropListFromFile(PKGCONFDIR
"/" GLOBAL_PREAMBLE_MENU_FILE
);
927 if (submenu
&& !WMIsPLArray(submenu
)) {
928 wwarning(_("invalid global menu file %s"), GLOBAL_PREAMBLE_MENU_FILE
);
929 WMReleasePropList(submenu
);
933 prependMenu(menu
, submenu
);
934 WMReleasePropList(submenu
);
938 #ifdef GLOBAL_EPILOGUE_MENU_FILE
939 submenu
= WMReadPropListFromFile(PKGCONFDIR
"/" GLOBAL_EPILOGUE_MENU_FILE
);
941 if (submenu
&& !WMIsPLArray(submenu
)) {
942 wwarning(_("invalid global menu file %s"), GLOBAL_EPILOGUE_MENU_FILE
);
943 WMReleasePropList(submenu
);
947 appendMenu(menu
, submenu
);
948 WMReleasePropList(submenu
);
952 menuDomain
->dictionary
= menu
;
955 WDDomain
*wDefaultsInitDomain(const char *domain
, Bool requireDictionary
)
959 static int inited
= 0;
960 WMPropList
*shared_dict
= NULL
;
967 db
= wmalloc(sizeof(WDDomain
));
968 db
->domain_name
= domain
;
969 db
->path
= wdefaultspathfordomain(domain
);
971 if (stat(db
->path
, &stbuf
) >= 0) {
972 db
->dictionary
= WMReadPropListFromFile(db
->path
);
973 if (db
->dictionary
) {
974 if (requireDictionary
&& !WMIsPLDictionary(db
->dictionary
)) {
975 WMReleasePropList(db
->dictionary
);
976 db
->dictionary
= NULL
;
977 wwarning(_("Domain %s (%s) of defaults database is corrupted!"), domain
, db
->path
);
979 db
->timestamp
= stbuf
.st_mtime
;
981 wwarning(_("could not load domain %s from user defaults database"), domain
);
985 /* global system dictionary */
986 shared_dict
= readGlobalDomain(domain
, requireDictionary
);
988 if (shared_dict
&& db
->dictionary
&& WMIsPLDictionary(shared_dict
) &&
989 WMIsPLDictionary(db
->dictionary
)) {
990 WMMergePLDictionaries(shared_dict
, db
->dictionary
, True
);
991 WMReleasePropList(db
->dictionary
);
992 db
->dictionary
= shared_dict
;
993 if (stbuf
.st_mtime
> db
->timestamp
)
994 db
->timestamp
= stbuf
.st_mtime
;
995 } else if (!db
->dictionary
) {
996 db
->dictionary
= shared_dict
;
997 if (stbuf
.st_mtime
> db
->timestamp
)
998 db
->timestamp
= stbuf
.st_mtime
;
1004 void wReadStaticDefaults(WMPropList
* dict
)
1006 WMPropList
*plvalue
;
1007 WDefaultEntry
*entry
;
1011 for (i
= 0; i
< wlengthof(staticOptionList
); i
++) {
1012 entry
= &staticOptionList
[i
];
1015 plvalue
= WMGetFromPLDictionary(dict
, entry
->plkey
);
1019 /* no default in the DB. Use builtin default */
1021 plvalue
= entry
->plvalue
;
1025 (*entry
->convert
) (NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
1027 (*entry
->update
) (NULL
, entry
, tdata
, entry
->extra_data
);
1032 void wDefaultsCheckDomains(void* arg
)
1036 WMPropList
*shared_dict
= NULL
;
1040 /* Parameter not used, but tell the compiler that it is ok */
1043 if (stat(w_global
.domain
.wmaker
->path
, &stbuf
) >= 0 && w_global
.domain
.wmaker
->timestamp
< stbuf
.st_mtime
) {
1044 w_global
.domain
.wmaker
->timestamp
= stbuf
.st_mtime
;
1046 /* Global dictionary */
1047 shared_dict
= readGlobalDomain("WindowMaker", True
);
1049 /* User dictionary */
1050 dict
= WMReadPropListFromFile(w_global
.domain
.wmaker
->path
);
1053 if (!WMIsPLDictionary(dict
)) {
1054 WMReleasePropList(dict
);
1056 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1057 "WindowMaker", w_global
.domain
.wmaker
->path
);
1060 WMMergePLDictionaries(shared_dict
, dict
, True
);
1061 WMReleasePropList(dict
);
1066 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1067 scr
= wScreenWithNumber(i
);
1069 wReadDefaults(scr
, dict
);
1072 if (w_global
.domain
.wmaker
->dictionary
)
1073 WMReleasePropList(w_global
.domain
.wmaker
->dictionary
);
1075 w_global
.domain
.wmaker
->dictionary
= dict
;
1078 wwarning(_("could not load domain %s from user defaults database"), "WindowMaker");
1082 WMReleasePropList(shared_dict
);
1086 if (stat(w_global
.domain
.window_attr
->path
, &stbuf
) >= 0 && w_global
.domain
.window_attr
->timestamp
< stbuf
.st_mtime
) {
1087 /* global dictionary */
1088 shared_dict
= readGlobalDomain("WMWindowAttributes", True
);
1089 /* user dictionary */
1090 dict
= WMReadPropListFromFile(w_global
.domain
.window_attr
->path
);
1092 if (!WMIsPLDictionary(dict
)) {
1093 WMReleasePropList(dict
);
1095 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1096 "WMWindowAttributes", w_global
.domain
.window_attr
->path
);
1099 WMMergePLDictionaries(shared_dict
, dict
, True
);
1100 WMReleasePropList(dict
);
1105 if (w_global
.domain
.window_attr
->dictionary
)
1106 WMReleasePropList(w_global
.domain
.window_attr
->dictionary
);
1108 w_global
.domain
.window_attr
->dictionary
= dict
;
1109 for (i
= 0; i
< w_global
.screen_count
; i
++) {
1110 scr
= wScreenWithNumber(i
);
1112 wDefaultUpdateIcons(scr
);
1114 /* Update the panel image if changed */
1115 /* Don't worry. If the image is the same these
1116 * functions will have no performance impact. */
1117 create_logo_image(scr
);
1122 wwarning(_("could not load domain %s from user defaults database"), "WMWindowAttributes");
1125 w_global
.domain
.window_attr
->timestamp
= stbuf
.st_mtime
;
1127 WMReleasePropList(shared_dict
);
1130 if (stat(w_global
.domain
.root_menu
->path
, &stbuf
) >= 0 && w_global
.domain
.root_menu
->timestamp
< stbuf
.st_mtime
) {
1131 dict
= WMReadPropListFromFile(w_global
.domain
.root_menu
->path
);
1133 if (!WMIsPLArray(dict
) && !WMIsPLString(dict
)) {
1134 WMReleasePropList(dict
);
1136 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1137 "WMRootMenu", w_global
.domain
.root_menu
->path
);
1139 if (w_global
.domain
.root_menu
->dictionary
)
1140 WMReleasePropList(w_global
.domain
.root_menu
->dictionary
);
1142 w_global
.domain
.root_menu
->dictionary
= dict
;
1143 wDefaultsMergeGlobalMenus(w_global
.domain
.root_menu
);
1146 wwarning(_("could not load domain %s from user defaults database"), "WMRootMenu");
1148 w_global
.domain
.root_menu
->timestamp
= stbuf
.st_mtime
;
1150 #ifndef HAVE_INOTIFY
1152 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, arg
);
1156 void wReadDefaults(WScreen
* scr
, WMPropList
* new_dict
)
1158 WMPropList
*plvalue
, *old_value
;
1159 WDefaultEntry
*entry
;
1161 int update_workspace_back
= 0; /* kluge :/ */
1162 unsigned int needs_refresh
;
1164 WMPropList
*old_dict
= (w_global
.domain
.wmaker
->dictionary
!= new_dict
? w_global
.domain
.wmaker
->dictionary
: NULL
);
1168 for (i
= 0; i
< wlengthof(optionList
); i
++) {
1169 entry
= &optionList
[i
];
1172 plvalue
= WMGetFromPLDictionary(new_dict
, entry
->plkey
);
1179 old_value
= WMGetFromPLDictionary(old_dict
, entry
->plkey
);
1181 if (!plvalue
&& !old_value
) {
1182 /* no default in the DB. Use builtin default */
1183 plvalue
= entry
->plvalue
;
1184 if (plvalue
&& new_dict
)
1185 WMPutInPLDictionary(new_dict
, entry
->plkey
, plvalue
);
1187 } else if (!plvalue
) {
1188 /* value was deleted from DB. Keep current value */
1190 } else if (!old_value
) {
1191 /* set value for the 1st time */
1192 } else if (!WMIsPropListEqualTo(plvalue
, old_value
)) {
1193 /* value has changed */
1195 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1196 && update_workspace_back
&& scr
->flags
.backimage_helper_launched
) {
1198 /* value was not changed since last time */
1205 if ((*entry
->convert
) (scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1207 * If the WorkspaceSpecificBack data has been changed
1208 * so that the helper will be launched now, we must be
1209 * sure to send the default background texture config
1212 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0 &&
1213 !scr
->flags
.backimage_helper_launched
)
1214 update_workspace_back
= 1;
1217 needs_refresh
|= (*entry
->update
) (scr
, entry
, tdata
, entry
->extra_data
);
1223 if (needs_refresh
!= 0 && !scr
->flags
.startup
) {
1227 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1228 foo
|= WTextureSettings
;
1229 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1230 foo
|= WFontSettings
;
1231 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1232 foo
|= WColorSettings
;
1234 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1235 (void *)(uintptr_t) foo
);
1238 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1239 foo
|= WTextureSettings
;
1240 if (needs_refresh
& REFRESH_MENU_FONT
)
1241 foo
|= WFontSettings
;
1242 if (needs_refresh
& REFRESH_MENU_COLOR
)
1243 foo
|= WColorSettings
;
1245 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1248 if (needs_refresh
& REFRESH_WINDOW_FONT
)
1249 foo
|= WFontSettings
;
1250 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
)
1251 foo
|= WTextureSettings
;
1252 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
)
1253 foo
|= WColorSettings
;
1255 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
, (void *)(uintptr_t) foo
);
1257 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1259 if (needs_refresh
& REFRESH_ICON_FONT
)
1260 foo
|= WFontSettings
;
1261 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
)
1262 foo
|= WTextureSettings
;
1263 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
)
1264 foo
|= WTextureSettings
;
1266 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1267 (void *)(uintptr_t) foo
);
1269 if (needs_refresh
& REFRESH_ICON_TILE
)
1270 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1272 if (needs_refresh
& REFRESH_WORKSPACE_MENU
) {
1273 if (scr
->workspace_menu
)
1274 wWorkspaceMenuUpdate(scr
, scr
->workspace_menu
);
1275 if (scr
->clip_ws_menu
)
1276 wWorkspaceMenuUpdate(scr
, scr
->clip_ws_menu
);
1277 if (scr
->workspace_submenu
)
1278 scr
->workspace_submenu
->flags
.realized
= 0;
1279 if (scr
->clip_submenu
)
1280 scr
->clip_submenu
->flags
.realized
= 0;
1285 void wDefaultUpdateIcons(WScreen
*scr
)
1287 WAppIcon
*aicon
= scr
->app_icon_list
;
1289 WWindow
*wwin
= scr
->focused_window
;
1292 /* Get the application icon, default included */
1293 wIconChangeImageFile(aicon
->icon
, NULL
);
1294 wAppIconPaint(aicon
);
1295 aicon
= aicon
->next
;
1298 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
)
1299 wClipIconPaint(scr
->clip_icon
);
1301 for (dc
= scr
->drawers
; dc
!= NULL
; dc
= dc
->next
)
1302 wDrawerIconPaint(dc
->adrawer
->icon_array
[0]);
1305 if (wwin
->icon
&& wwin
->flags
.miniaturized
)
1306 wIconChangeImageFile(wwin
->icon
, NULL
);
1311 /* --------------------------- Local ----------------------- */
1313 #define GET_STRING_OR_DEFAULT(x, var) if (!WMIsPLString(value)) { \
1314 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1316 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1317 var = entry->default_value;\
1318 } else var = WMGetFromPLString(value)\
1321 static int string2index(WMPropList *key, WMPropList *val, const char *def, WOptionEnumeration * values)
1324 WOptionEnumeration
*v
;
1325 char buffer
[TOTAL_VALUES_LENGTH
];
1327 if (WMIsPLString(val
) && (str
= WMGetFromPLString(val
))) {
1328 for (v
= values
; v
->string
!= NULL
; v
++) {
1329 if (strcasecmp(v
->string
, str
) == 0)
1335 for (v
= values
; v
->string
!= NULL
; v
++) {
1338 strcat(buffer
, ", ");
1339 snprintf(buffer
+strlen(buffer
),
1340 sizeof(buffer
)-strlen(buffer
)-1, "\"%s\"", v
->string
);
1343 wwarning(_("wrong option value for key \"%s\"; got \"%s\", should be one of %s."),
1344 WMGetFromPLString(key
),
1345 WMIsPLString(val
) ? WMGetFromPLString(val
) : "(unknown)",
1349 return string2index(key
, val
, NULL
, values
);
1356 * value - is the value in the defaults DB
1357 * addr - is the address to store the data
1358 * ret - is the address to store a pointer to a temporary buffer. ret
1359 * must not be freed and is used by the set functions
1361 static int getBool(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1365 int second_pass
= 0;
1367 /* Parameter not used, but tell the compiler that it is ok */
1370 GET_STRING_OR_DEFAULT("Boolean", val
);
1373 if ((val
[1] == '\0' && (val
[0] == 'y' || val
[0] == 'Y'))
1374 || strcasecmp(val
, "YES") == 0) {
1377 } else if ((val
[1] == '\0' && (val
[0] == 'n' || val
[0] == 'N'))
1378 || strcasecmp(val
, "NO") == 0) {
1382 if (sscanf(val
, "%i", &i
) == 1) {
1388 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""), val
, entry
->key
);
1389 if (second_pass
== 0) {
1390 val
= WMGetFromPLString(entry
->plvalue
);
1392 wwarning(_("using default \"%s\" instead"), val
);
1402 *(char *)addr
= data
;
1407 static int getInt(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1412 /* Parameter not used, but tell the compiler that it is ok */
1415 GET_STRING_OR_DEFAULT("Integer", val
);
1417 if (sscanf(val
, "%i", &data
) != 1) {
1418 wwarning(_("can't convert \"%s\" to integer for key \"%s\""), val
, entry
->key
);
1419 val
= WMGetFromPLString(entry
->plvalue
);
1420 wwarning(_("using default \"%s\" instead"), val
);
1421 if (sscanf(val
, "%i", &data
) != 1) {
1429 *(int *)addr
= data
;
1434 static int getCoord(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1437 char *val_x
, *val_y
;
1438 int nelem
, changed
= 0;
1439 WMPropList
*elem_x
, *elem_y
;
1442 if (!WMIsPLArray(value
)) {
1443 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Coordinate");
1445 value
= entry
->plvalue
;
1447 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1453 nelem
= WMGetPropListItemCount(value
);
1455 wwarning(_("Incorrect number of elements in array for key \"%s\"."), entry
->key
);
1457 value
= entry
->plvalue
;
1459 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1465 elem_x
= WMGetFromPLArray(value
, 0);
1466 elem_y
= WMGetFromPLArray(value
, 1);
1468 if (!elem_x
|| !elem_y
|| !WMIsPLString(elem_x
) || !WMIsPLString(elem_y
)) {
1469 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."), entry
->key
);
1471 value
= entry
->plvalue
;
1473 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1479 val_x
= WMGetFromPLString(elem_x
);
1480 val_y
= WMGetFromPLString(elem_y
);
1482 if (sscanf(val_x
, "%i", &data
.x
) != 1 || sscanf(val_y
, "%i", &data
.y
) != 1) {
1483 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1485 value
= entry
->plvalue
;
1487 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1495 else if (data
.x
> scr
->scr_width
/ 3)
1496 data
.x
= scr
->scr_width
/ 3;
1499 else if (data
.y
> scr
->scr_height
/ 3)
1500 data
.y
= scr
->scr_height
/ 3;
1505 *(WCoord
*) addr
= data
;
1510 static int getPropList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1512 /* Parameter not used, but tell the compiler that it is ok */
1517 WMRetainPropList(value
);
1524 static int getPathList(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1532 /* Parameter not used, but tell the compiler that it is ok */
1537 if (!WMIsPLArray(value
)) {
1538 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "an array of paths");
1540 value
= entry
->plvalue
;
1542 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1549 count
= WMGetPropListItemCount(value
);
1552 value
= entry
->plvalue
;
1554 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1561 for (i
= 0; i
< count
; i
++) {
1562 d
= WMGetFromPLArray(value
, i
);
1563 if (!d
|| !WMIsPLString(d
)) {
1567 len
+= strlen(WMGetFromPLString(d
)) + 1;
1570 ptr
= data
= wmalloc(len
+ 1);
1572 for (i
= 0; i
< count
; i
++) {
1573 d
= WMGetFromPLArray(value
, i
);
1574 if (!d
|| !WMIsPLString(d
)) {
1577 strcpy(ptr
, WMGetFromPLString(d
));
1578 ptr
+= strlen(WMGetFromPLString(d
));
1585 if (*(char **)addr
!= NULL
) {
1586 wfree(*(char **)addr
);
1588 *(char **)addr
= data
;
1593 static int getEnum(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1595 static signed char data
;
1597 /* Parameter not used, but tell the compiler that it is ok */
1600 data
= string2index(entry
->plkey
, value
, entry
->default_value
, (WOptionEnumeration
*) entry
->extra_data
);
1607 *(signed char *)addr
= data
;
1614 * (hgradient <color> <color>)
1615 * (vgradient <color> <color>)
1616 * (dgradient <color> <color>)
1617 * (mhgradient <color> <color> ...)
1618 * (mvgradient <color> <color> ...)
1619 * (mdgradient <color> <color> ...)
1620 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1621 * (tpixmap <file> <color>)
1622 * (spixmap <file> <color>)
1623 * (cpixmap <file> <color>)
1624 * (thgradient <file> <opaqueness> <color> <color>)
1625 * (tvgradient <file> <opaqueness> <color> <color>)
1626 * (tdgradient <file> <opaqueness> <color> <color>)
1627 * (function <lib> <function> ...)
1630 static WTexture
*parse_texture(WScreen
* scr
, WMPropList
* pl
)
1635 WTexture
*texture
= NULL
;
1637 nelem
= WMGetPropListItemCount(pl
);
1641 elem
= WMGetFromPLArray(pl
, 0);
1642 if (!elem
|| !WMIsPLString(elem
))
1644 val
= WMGetFromPLString(elem
);
1646 if (strcasecmp(val
, "solid") == 0) {
1654 elem
= WMGetFromPLArray(pl
, 1);
1655 if (!elem
|| !WMIsPLString(elem
))
1657 val
= WMGetFromPLString(elem
);
1659 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1660 wwarning(_("\"%s\" is not a valid color name"), val
);
1664 texture
= (WTexture
*) wTextureMakeSolid(scr
, &color
);
1665 } else if (strcasecmp(val
, "dgradient") == 0
1666 || strcasecmp(val
, "vgradient") == 0 || strcasecmp(val
, "hgradient") == 0) {
1667 RColor color1
, color2
;
1672 wwarning(_("bad number of arguments in gradient specification"));
1676 if (val
[0] == 'd' || val
[0] == 'D')
1677 type
= WTEX_DGRADIENT
;
1678 else if (val
[0] == 'h' || val
[0] == 'H')
1679 type
= WTEX_HGRADIENT
;
1681 type
= WTEX_VGRADIENT
;
1683 /* get from color */
1684 elem
= WMGetFromPLArray(pl
, 1);
1685 if (!elem
|| !WMIsPLString(elem
))
1687 val
= WMGetFromPLString(elem
);
1689 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1690 wwarning(_("\"%s\" is not a valid color name"), val
);
1694 color1
.red
= xcolor
.red
>> 8;
1695 color1
.green
= xcolor
.green
>> 8;
1696 color1
.blue
= xcolor
.blue
>> 8;
1699 elem
= WMGetFromPLArray(pl
, 2);
1700 if (!elem
|| !WMIsPLString(elem
)) {
1703 val
= WMGetFromPLString(elem
);
1705 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1706 wwarning(_("\"%s\" is not a valid color name"), val
);
1710 color2
.red
= xcolor
.red
>> 8;
1711 color2
.green
= xcolor
.green
>> 8;
1712 color2
.blue
= xcolor
.blue
>> 8;
1714 texture
= (WTexture
*) wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1716 } else if (strcasecmp(val
, "igradient") == 0) {
1717 RColor colors1
[2], colors2
[2];
1723 wwarning(_("bad number of arguments in gradient specification"));
1727 /* get from color */
1728 for (i
= 0; i
< 2; i
++) {
1729 elem
= WMGetFromPLArray(pl
, 1 + i
);
1730 if (!elem
|| !WMIsPLString(elem
))
1732 val
= WMGetFromPLString(elem
);
1734 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1735 wwarning(_("\"%s\" is not a valid color name"), val
);
1738 colors1
[i
].alpha
= 255;
1739 colors1
[i
].red
= xcolor
.red
>> 8;
1740 colors1
[i
].green
= xcolor
.green
>> 8;
1741 colors1
[i
].blue
= xcolor
.blue
>> 8;
1743 elem
= WMGetFromPLArray(pl
, 3);
1744 if (!elem
|| !WMIsPLString(elem
))
1746 val
= WMGetFromPLString(elem
);
1749 /* get from color */
1750 for (i
= 0; i
< 2; i
++) {
1751 elem
= WMGetFromPLArray(pl
, 4 + i
);
1752 if (!elem
|| !WMIsPLString(elem
))
1754 val
= WMGetFromPLString(elem
);
1756 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1757 wwarning(_("\"%s\" is not a valid color name"), val
);
1760 colors2
[i
].alpha
= 255;
1761 colors2
[i
].red
= xcolor
.red
>> 8;
1762 colors2
[i
].green
= xcolor
.green
>> 8;
1763 colors2
[i
].blue
= xcolor
.blue
>> 8;
1765 elem
= WMGetFromPLArray(pl
, 6);
1766 if (!elem
|| !WMIsPLString(elem
))
1768 val
= WMGetFromPLString(elem
);
1771 texture
= (WTexture
*) wTextureMakeIGradient(scr
, th1
, colors1
, th2
, colors2
);
1773 } else if (strcasecmp(val
, "mhgradient") == 0
1774 || strcasecmp(val
, "mvgradient") == 0 || strcasecmp(val
, "mdgradient") == 0) {
1781 wwarning(_("too few arguments in multicolor gradient specification"));
1785 if (val
[1] == 'h' || val
[1] == 'H')
1786 type
= WTEX_MHGRADIENT
;
1787 else if (val
[1] == 'v' || val
[1] == 'V')
1788 type
= WTEX_MVGRADIENT
;
1790 type
= WTEX_MDGRADIENT
;
1794 colors
= wmalloc(sizeof(RColor
*) * (count
+ 1));
1796 for (i
= 0; i
< count
; i
++) {
1797 elem
= WMGetFromPLArray(pl
, i
+ 1);
1798 if (!elem
|| !WMIsPLString(elem
)) {
1799 for (--i
; i
>= 0; --i
) {
1805 val
= WMGetFromPLString(elem
);
1807 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1808 wwarning(_("\"%s\" is not a valid color name"), val
);
1809 for (--i
; i
>= 0; --i
) {
1815 colors
[i
] = wmalloc(sizeof(RColor
));
1816 colors
[i
]->red
= color
.red
>> 8;
1817 colors
[i
]->green
= color
.green
>> 8;
1818 colors
[i
]->blue
= color
.blue
>> 8;
1823 texture
= (WTexture
*) wTextureMakeMGradient(scr
, type
, colors
);
1824 } else if (strcasecmp(val
, "spixmap") == 0 ||
1825 strcasecmp(val
, "cpixmap") == 0 || strcasecmp(val
, "tpixmap") == 0) {
1832 if (val
[0] == 's' || val
[0] == 'S')
1834 else if (val
[0] == 'c' || val
[0] == 'C')
1840 elem
= WMGetFromPLArray(pl
, 2);
1841 if (!elem
|| !WMIsPLString(elem
)) {
1844 val
= WMGetFromPLString(elem
);
1846 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1847 wwarning(_("\"%s\" is not a valid color name"), val
);
1852 elem
= WMGetFromPLArray(pl
, 1);
1853 if (!elem
|| !WMIsPLString(elem
))
1855 val
= WMGetFromPLString(elem
);
1857 texture
= (WTexture
*) wTextureMakePixmap(scr
, type
, val
, &color
);
1858 } else if (strcasecmp(val
, "thgradient") == 0
1859 || strcasecmp(val
, "tvgradient") == 0 || strcasecmp(val
, "tdgradient") == 0) {
1860 RColor color1
, color2
;
1865 if (val
[1] == 'h' || val
[1] == 'H')
1866 style
= WTEX_THGRADIENT
;
1867 else if (val
[1] == 'v' || val
[1] == 'V')
1868 style
= WTEX_TVGRADIENT
;
1870 style
= WTEX_TDGRADIENT
;
1873 wwarning(_("bad number of arguments in textured gradient specification"));
1877 /* get from color */
1878 elem
= WMGetFromPLArray(pl
, 3);
1879 if (!elem
|| !WMIsPLString(elem
))
1881 val
= WMGetFromPLString(elem
);
1883 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1884 wwarning(_("\"%s\" is not a valid color name"), val
);
1888 color1
.red
= xcolor
.red
>> 8;
1889 color1
.green
= xcolor
.green
>> 8;
1890 color1
.blue
= xcolor
.blue
>> 8;
1893 elem
= WMGetFromPLArray(pl
, 4);
1894 if (!elem
|| !WMIsPLString(elem
)) {
1897 val
= WMGetFromPLString(elem
);
1899 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1900 wwarning(_("\"%s\" is not a valid color name"), val
);
1904 color2
.red
= xcolor
.red
>> 8;
1905 color2
.green
= xcolor
.green
>> 8;
1906 color2
.blue
= xcolor
.blue
>> 8;
1909 elem
= WMGetFromPLArray(pl
, 2);
1910 if (!elem
|| !WMIsPLString(elem
))
1913 val
= WMGetFromPLString(elem
);
1915 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
1916 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
1921 elem
= WMGetFromPLArray(pl
, 1);
1922 if (!elem
|| !WMIsPLString(elem
))
1924 val
= WMGetFromPLString(elem
);
1926 texture
= (WTexture
*) wTextureMakeTGradient(scr
, style
, &color1
, &color2
, val
, opacity
);
1927 } else if (strcasecmp(val
, "function") == 0) {
1928 /* Leave this in to handle the unlikely case of
1929 * someone actually having function textures configured */
1930 wwarning("function texture support has been removed");
1933 wwarning(_("invalid texture type %s"), val
);
1939 static int getTexture(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
1941 static WTexture
*texture
;
1945 if (!WMIsPLArray(value
)) {
1946 wwarning(_("Wrong option format for key \"%s\". Should be %s."), entry
->key
, "Texture");
1948 value
= entry
->plvalue
;
1950 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1956 if (strcmp(entry
->key
, "WidgetColor") == 0 && !changed
) {
1959 pl
= WMGetFromPLArray(value
, 0);
1960 if (!pl
|| !WMIsPLString(pl
) || !WMGetFromPLString(pl
)
1961 || strcasecmp(WMGetFromPLString(pl
), "solid") != 0) {
1962 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1963 entry
->key
, "Solid Texture");
1965 value
= entry
->plvalue
;
1967 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1972 texture
= parse_texture(scr
, value
);
1975 wwarning(_("Error in texture specification for key \"%s\""), entry
->key
);
1977 value
= entry
->plvalue
;
1979 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1989 *(WTexture
**) addr
= texture
;
1994 static int getWSBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2001 /* Parameter not used, but tell the compiler that it is ok */
2006 if (!WMIsPLArray(value
)) {
2007 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2008 "WorkspaceBack", "Texture or None");
2010 value
= entry
->plvalue
;
2012 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2018 /* only do basic error checking and verify for None texture */
2020 nelem
= WMGetPropListItemCount(value
);
2022 elem
= WMGetFromPLArray(value
, 0);
2023 if (!elem
|| !WMIsPLString(elem
)) {
2024 wwarning(_("Wrong type for workspace background. Should be a texture type."));
2026 value
= entry
->plvalue
;
2028 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2033 val
= WMGetFromPLString(elem
);
2035 if (strcasecmp(val
, "None") == 0)
2038 *ret
= WMRetainPropList(value
);
2044 getWSSpecificBackground(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2050 /* Parameter not used, but tell the compiler that it is ok */
2055 if (!WMIsPLArray(value
)) {
2056 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2057 "WorkspaceSpecificBack", "an array of textures");
2059 value
= entry
->plvalue
;
2061 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2067 /* only do basic error checking and verify for None texture */
2069 nelem
= WMGetPropListItemCount(value
);
2072 elem
= WMGetFromPLArray(value
, nelem
);
2073 if (!elem
|| !WMIsPLArray(elem
)) {
2074 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2080 *ret
= WMRetainPropList(value
);
2084 * Kluge to force wmsetbg helper to set the default background.
2085 * If the WorkspaceSpecificBack is changed once wmaker has started,
2086 * the WorkspaceBack won't be sent to the helper, unless the user
2087 * changes its value too. So, we must force this by removing the
2088 * value from the defaults DB.
2090 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2091 WMPropList
*key
= WMCreatePLString("WorkspaceBack");
2093 WMRemoveFromPLDictionary(w_global
.domain
.wmaker
->dictionary
, key
);
2095 WMReleasePropList(key
);
2101 static int getFont(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2103 static WMFont
*font
;
2108 GET_STRING_OR_DEFAULT("Font", val
);
2110 font
= WMCreateFont(scr
->wmscreen
, val
);
2112 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2115 wfatal(_("could not load any usable font!!!"));
2122 /* can't assign font value outside update function */
2123 wassertrv(addr
== NULL
, True
);
2128 static int getColor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2130 static XColor color
;
2132 int second_pass
= 0;
2136 GET_STRING_OR_DEFAULT("Color", val
);
2139 if (!wGetColor(scr
, val
, &color
)) {
2140 wwarning(_("could not get color for key \"%s\""), entry
->key
);
2141 if (second_pass
== 0) {
2142 val
= WMGetFromPLString(entry
->plvalue
);
2144 wwarning(_("using default \"%s\" instead"), val
);
2153 assert(addr
== NULL
);
2156 *(unsigned long*)addr = pixel;
2162 static int getKeybind(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2164 static WShortKey shortcut
;
2168 char buf
[MAX_SHORTCUT_LENGTH
], *b
;
2170 /* Parameter not used, but tell the compiler that it is ok */
2174 GET_STRING_OR_DEFAULT("Key spec", val
);
2176 if (!val
|| strcasecmp(val
, "NONE") == 0) {
2177 shortcut
.keycode
= 0;
2178 shortcut
.modifier
= 0;
2184 wstrlcpy(buf
, val
, MAX_SHORTCUT_LENGTH
);
2189 shortcut
.modifier
= 0;
2190 while ((k
= strchr(b
, '+')) != NULL
) {
2194 mod
= wXModifierFromKey(b
);
2196 wwarning(_("%s: invalid key modifier \"%s\""), entry
->key
, b
);
2199 shortcut
.modifier
|= mod
;
2205 ksym
= XStringToKeysym(b
);
2207 if (ksym
== NoSymbol
) {
2208 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
, val
);
2212 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2213 if (shortcut
.keycode
== 0) {
2214 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2224 static int getModMask(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2229 /* Parameter not used, but tell the compiler that it is ok */
2232 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2237 mask
= wXModifierFromKey(str
);
2239 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2245 *(int *)addr
= mask
;
2253 # include <X11/cursorfont.h>
2259 #define CURSOR_ID_NONE (XC_num_glyphs)
2261 static const WCursorLookup cursor_table
[] = {
2262 {"X_cursor", XC_X_cursor
},
2263 {"arrow", XC_arrow
},
2264 {"based_arrow_down", XC_based_arrow_down
},
2265 {"based_arrow_up", XC_based_arrow_up
},
2267 {"bogosity", XC_bogosity
},
2268 {"bottom_left_corner", XC_bottom_left_corner
},
2269 {"bottom_right_corner", XC_bottom_right_corner
},
2270 {"bottom_side", XC_bottom_side
},
2271 {"bottom_tee", XC_bottom_tee
},
2272 {"box_spiral", XC_box_spiral
},
2273 {"center_ptr", XC_center_ptr
},
2274 {"circle", XC_circle
},
2275 {"clock", XC_clock
},
2276 {"coffee_mug", XC_coffee_mug
},
2277 {"cross", XC_cross
},
2278 {"cross_reverse", XC_cross_reverse
},
2279 {"crosshair", XC_crosshair
},
2280 {"diamond_cross", XC_diamond_cross
},
2282 {"dotbox", XC_dotbox
},
2283 {"double_arrow", XC_double_arrow
},
2284 {"draft_large", XC_draft_large
},
2285 {"draft_small", XC_draft_small
},
2286 {"draped_box", XC_draped_box
},
2287 {"exchange", XC_exchange
},
2288 {"fleur", XC_fleur
},
2289 {"gobbler", XC_gobbler
},
2290 {"gumby", XC_gumby
},
2291 {"hand1", XC_hand1
},
2292 {"hand2", XC_hand2
},
2293 {"heart", XC_heart
},
2295 {"iron_cross", XC_iron_cross
},
2296 {"left_ptr", XC_left_ptr
},
2297 {"left_side", XC_left_side
},
2298 {"left_tee", XC_left_tee
},
2299 {"leftbutton", XC_leftbutton
},
2300 {"ll_angle", XC_ll_angle
},
2301 {"lr_angle", XC_lr_angle
},
2303 {"middlebutton", XC_middlebutton
},
2304 {"mouse", XC_mouse
},
2305 {"pencil", XC_pencil
},
2306 {"pirate", XC_pirate
},
2308 {"question_arrow", XC_question_arrow
},
2309 {"right_ptr", XC_right_ptr
},
2310 {"right_side", XC_right_side
},
2311 {"right_tee", XC_right_tee
},
2312 {"rightbutton", XC_rightbutton
},
2313 {"rtl_logo", XC_rtl_logo
},
2314 {"sailboat", XC_sailboat
},
2315 {"sb_down_arrow", XC_sb_down_arrow
},
2316 {"sb_h_double_arrow", XC_sb_h_double_arrow
},
2317 {"sb_left_arrow", XC_sb_left_arrow
},
2318 {"sb_right_arrow", XC_sb_right_arrow
},
2319 {"sb_up_arrow", XC_sb_up_arrow
},
2320 {"sb_v_double_arrow", XC_sb_v_double_arrow
},
2321 {"shuttle", XC_shuttle
},
2322 {"sizing", XC_sizing
},
2323 {"spider", XC_spider
},
2324 {"spraycan", XC_spraycan
},
2326 {"target", XC_target
},
2327 {"tcross", XC_tcross
},
2328 {"top_left_arrow", XC_top_left_arrow
},
2329 {"top_left_corner", XC_top_left_corner
},
2330 {"top_right_corner", XC_top_right_corner
},
2331 {"top_side", XC_top_side
},
2332 {"top_tee", XC_top_tee
},
2334 {"ul_angle", XC_ul_angle
},
2335 {"umbrella", XC_umbrella
},
2336 {"ur_angle", XC_ur_angle
},
2337 {"watch", XC_watch
},
2338 {"xterm", XC_xterm
},
2339 {NULL
, CURSOR_ID_NONE
}
2342 static void check_bitmap_status(int status
, const char *filename
, Pixmap bitmap
)
2345 case BitmapOpenFailed
:
2346 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2348 case BitmapFileInvalid
:
2349 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2351 case BitmapNoMemory
:
2352 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2355 XFreePixmap(dpy
, bitmap
);
2362 * (builtin, <cursor_name>)
2363 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2365 static int parse_cursor(WScreen
* scr
, WMPropList
* pl
, Cursor
* cursor
)
2372 nelem
= WMGetPropListItemCount(pl
);
2376 elem
= WMGetFromPLArray(pl
, 0);
2377 if (!elem
|| !WMIsPLString(elem
)) {
2380 val
= WMGetFromPLString(elem
);
2382 if (strcasecmp(val
, "none") == 0) {
2385 } else if (strcasecmp(val
, "builtin") == 0) {
2387 int cursor_id
= CURSOR_ID_NONE
;
2390 wwarning(_("bad number of arguments in cursor specification"));
2393 elem
= WMGetFromPLArray(pl
, 1);
2394 if (!elem
|| !WMIsPLString(elem
)) {
2397 val
= WMGetFromPLString(elem
);
2399 for (i
= 0; cursor_table
[i
].name
!= NULL
; i
++) {
2400 if (strcasecmp(val
, cursor_table
[i
].name
) == 0) {
2401 cursor_id
= cursor_table
[i
].id
;
2405 if (CURSOR_ID_NONE
== cursor_id
) {
2406 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2408 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2411 } else if (strcasecmp(val
, "bitmap") == 0) {
2423 wwarning(_("bad number of arguments in cursor specification"));
2426 elem
= WMGetFromPLArray(pl
, 1);
2427 if (!elem
|| !WMIsPLString(elem
)) {
2430 val
= WMGetFromPLString(elem
);
2431 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2433 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2436 elem
= WMGetFromPLArray(pl
, 2);
2437 if (!elem
|| !WMIsPLString(elem
)) {
2441 val
= WMGetFromPLString(elem
);
2442 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2445 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2448 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
, &mask
, &x
, &y
);
2449 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
, &bitmap
, &x
, &y
);
2450 if ((BitmapSuccess
== bitmap_status
) && (BitmapSuccess
== mask_status
)) {
2451 fg
.pixel
= scr
->black_pixel
;
2452 bg
.pixel
= scr
->white_pixel
;
2453 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2454 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2455 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2458 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2459 check_bitmap_status(mask_status
, mask_name
, mask
);
2466 static int getCursor(WScreen
* scr
, WDefaultEntry
* entry
, WMPropList
* value
, void *addr
, void **ret
)
2468 static Cursor cursor
;
2473 if (!WMIsPLArray(value
)) {
2474 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2475 entry
->key
, "cursor specification");
2477 value
= entry
->plvalue
;
2479 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2484 status
= parse_cursor(scr
, value
, &cursor
);
2486 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2488 value
= entry
->plvalue
;
2490 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2499 *(Cursor
*) addr
= cursor
;
2504 #undef CURSOR_ID_NONE
2506 /* ---------------- value setting functions --------------- */
2507 static int setJustify(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2509 /* Parameter not used, but tell the compiler that it is ok */
2515 return REFRESH_WINDOW_TITLE_COLOR
;
2518 static int setClearance(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2520 /* Parameter not used, but tell the compiler that it is ok */
2526 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
| REFRESH_MENU_TITLE_FONT
| REFRESH_MENU_FONT
;
2529 static int setIfDockPresent(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2532 long which
= (long) extra_data
;
2534 /* Parameter not used, but tell the compiler that it is ok */
2540 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2541 // Drawers require the dock
2542 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| wPreferences
.flags
.nodock
;
2545 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2548 wPreferences
.flags
.nodrawer
= wPreferences
.flags
.nodrawer
|| *flag
;
2556 static int setClipMergedInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2560 /* Parameter not used, but tell the compiler that it is ok */
2565 wPreferences
.flags
.clip_merged_in_dock
= *flag
;
2566 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2570 static int setWrapAppiconsInDock(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2574 /* Parameter not used, but tell the compiler that it is ok */
2579 wPreferences
.flags
.wrap_appicons_in_dock
= *flag
;
2583 static int setStickyIcons(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
2585 /* Parameter not used, but tell the compiler that it is ok */
2590 if (scr
->workspaces
) {
2591 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2592 wArrangeIcons(scr
, False
);
2597 static int setIconTile(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2601 WTexture
** texture
= tdata
;
2604 /* Parameter not used, but tell the compiler that it is ok */
2607 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2608 wPreferences
.icon_size
, ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2609 ? WREL_ICON
: WREL_FLAT
);
2611 wwarning(_("could not render texture for icon background"));
2613 wTextureDestroy(scr
, *texture
);
2616 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2618 if (scr
->icon_tile
) {
2620 RReleaseImage(scr
->icon_tile
);
2621 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2624 scr
->icon_tile
= img
;
2626 /* put the icon in the noticeboard hint */
2627 PropSetIconTileHint(scr
, img
);
2629 if (!wPreferences
.flags
.noclip
|| wPreferences
.flags
.clip_merged_in_dock
) {
2630 if (scr
->clip_tile
) {
2631 RReleaseImage(scr
->clip_tile
);
2633 scr
->clip_tile
= wClipMakeTile(img
);
2636 if (!wPreferences
.flags
.nodrawer
) {
2637 if (scr
->drawer_tile
) {
2638 RReleaseImage(scr
->drawer_tile
);
2640 scr
->drawer_tile
= wDrawerMakeTile(scr
, img
);
2643 scr
->icon_tile_pixmap
= pixmap
;
2645 if (scr
->def_icon_rimage
) {
2646 RReleaseImage(scr
->def_icon_rimage
);
2647 scr
->def_icon_rimage
= NULL
;
2650 if (scr
->icon_back_texture
)
2651 wTextureDestroy(scr
, (WTexture
*) scr
->icon_back_texture
);
2653 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2655 /* Free the texture as nobody else will use it, nor refer to it. */
2657 wTextureDestroy(scr
, *texture
);
2659 return (reset
? REFRESH_ICON_TILE
: 0);
2662 static int setWinTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2664 WMFont
*font
= tdata
;
2666 /* Parameter not used, but tell the compiler that it is ok */
2670 if (scr
->title_font
) {
2671 WMReleaseFont(scr
->title_font
);
2673 scr
->title_font
= font
;
2675 return REFRESH_WINDOW_FONT
| REFRESH_BUTTON_IMAGES
;
2678 static int setMenuTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2680 WMFont
*font
= tdata
;
2682 /* Parameter not used, but tell the compiler that it is ok */
2686 if (scr
->menu_title_font
) {
2687 WMReleaseFont(scr
->menu_title_font
);
2690 scr
->menu_title_font
= font
;
2692 return REFRESH_MENU_TITLE_FONT
;
2695 static int setMenuTextFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2697 WMFont
*font
= tdata
;
2699 /* Parameter not used, but tell the compiler that it is ok */
2703 if (scr
->menu_entry_font
) {
2704 WMReleaseFont(scr
->menu_entry_font
);
2706 scr
->menu_entry_font
= font
;
2708 return REFRESH_MENU_FONT
;
2711 static int setIconTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2713 WMFont
*font
= tdata
;
2715 /* Parameter not used, but tell the compiler that it is ok */
2719 if (scr
->icon_title_font
) {
2720 WMReleaseFont(scr
->icon_title_font
);
2723 scr
->icon_title_font
= font
;
2725 return REFRESH_ICON_FONT
;
2728 static int setClipTitleFont(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2730 WMFont
*font
= tdata
;
2732 /* Parameter not used, but tell the compiler that it is ok */
2736 if (scr
->clip_title_font
) {
2737 WMReleaseFont(scr
->clip_title_font
);
2740 scr
->clip_title_font
= font
;
2742 return REFRESH_ICON_FONT
;
2745 static int setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2747 WMFont
*font
= tdata
;
2749 /* Parameter not used, but tell the compiler that it is ok */
2754 if (scr
->workspace_name_font
)
2755 WMReleaseFont(scr
->workspace_name_font
);
2757 scr
->workspace_name_font
= font
;
2762 static int setHightlight(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2764 XColor
*color
= tdata
;
2766 /* Parameter not used, but tell the compiler that it is ok */
2770 if (scr
->select_color
)
2771 WMReleaseColor(scr
->select_color
);
2773 scr
->select_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2775 wFreeColor(scr
, color
->pixel
);
2777 return REFRESH_MENU_COLOR
;
2780 static int setHightlightText(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2782 XColor
*color
= tdata
;
2784 /* Parameter not used, but tell the compiler that it is ok */
2788 if (scr
->select_text_color
)
2789 WMReleaseColor(scr
->select_text_color
);
2791 scr
->select_text_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2793 wFreeColor(scr
, color
->pixel
);
2795 return REFRESH_MENU_COLOR
;
2798 static int setClipTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2800 XColor
*color
= tdata
;
2801 long widx
= (long) extra_data
;
2803 /* Parameter not used, but tell the compiler that it is ok */
2806 if (scr
->clip_title_color
[widx
])
2807 WMReleaseColor(scr
->clip_title_color
[widx
]);
2809 scr
->clip_title_color
[widx
] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2810 wFreeColor(scr
, color
->pixel
);
2812 return REFRESH_ICON_TITLE_COLOR
;
2815 static int setWTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2817 XColor
*color
= tdata
;
2818 long widx
= (long) extra_data
;
2820 /* Parameter not used, but tell the compiler that it is ok */
2823 if (scr
->window_title_color
[widx
])
2824 WMReleaseColor(scr
->window_title_color
[widx
]);
2826 scr
->window_title_color
[widx
] =
2827 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2829 wFreeColor(scr
, color
->pixel
);
2831 return REFRESH_WINDOW_TITLE_COLOR
;
2834 static int setMenuTitleColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
2836 XColor
*color
= tdata
;
2838 /* Parameter not used, but tell the compiler that it is ok */
2842 if (scr
->menu_title_color
[0])
2843 WMReleaseColor(scr
->menu_title_color
[0]);
2845 scr
->menu_title_color
[0] = WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2847 wFreeColor(scr
, color
->pixel
);
2849 return REFRESH_MENU_TITLE_COLOR
;
2852 static int setMenuTextColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2854 XColor
*color
= tdata
;
2856 /* Parameter not used, but tell the compiler that it is ok */
2860 if (scr
->mtext_color
)
2861 WMReleaseColor(scr
->mtext_color
);
2863 scr
->mtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2865 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
2866 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
2868 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
2871 wFreeColor(scr
, color
->pixel
);
2873 return REFRESH_MENU_COLOR
;
2876 static int setMenuDisabledColor(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
->dtext_color
)
2885 WMReleaseColor(scr
->dtext_color
);
2887 scr
->dtext_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 setIconTitleColor(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
->icon_title_color
)
2909 WMReleaseColor(scr
->icon_title_color
);
2910 scr
->icon_title_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2912 wFreeColor(scr
, color
->pixel
);
2914 return REFRESH_ICON_TITLE_COLOR
;
2917 static int setIconTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2919 XColor
*color
= tdata
;
2921 /* Parameter not used, but tell the compiler that it is ok */
2925 if (scr
->icon_title_texture
) {
2926 wTextureDestroy(scr
, (WTexture
*) scr
->icon_title_texture
);
2928 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
2930 return REFRESH_ICON_TITLE_BACK
;
2933 static int setFrameBorderWidth(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2937 /* Parameter not used, but tell the compiler that it is ok */
2941 scr
->frame_border_width
= *value
;
2943 return REFRESH_FRAME_BORDER
;
2946 static int setFrameBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2948 XColor
*color
= tdata
;
2950 /* Parameter not used, but tell the compiler that it is ok */
2954 if (scr
->frame_border_color
)
2955 WMReleaseColor(scr
->frame_border_color
);
2956 scr
->frame_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2958 wFreeColor(scr
, color
->pixel
);
2960 return REFRESH_FRAME_BORDER
;
2963 static int setFrameFocusedBorderColor(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
2965 XColor
*color
= tdata
;
2967 /* Parameter not used, but tell the compiler that it is ok */
2971 if (scr
->frame_focused_border_color
)
2972 WMReleaseColor(scr
->frame_focused_border_color
);
2973 scr
->frame_focused_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2975 wFreeColor(scr
, color
->pixel
);
2977 return REFRESH_FRAME_BORDER
;
2980 static int setFrameSelectedBorderColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
2982 XColor
*color
= tdata
;
2984 /* Parameter not used, but tell the compiler that it is ok */
2988 if (scr
->frame_selected_border_color
)
2989 WMReleaseColor(scr
->frame_selected_border_color
);
2990 scr
->frame_selected_border_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
, True
);
2992 wFreeColor(scr
, color
->pixel
);
2994 return REFRESH_FRAME_BORDER
;
2997 static int setWorkspaceSpecificBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
2999 WMPropList
*value
= tdata
;
3004 /* Parameter not used, but tell the compiler that it is ok */
3008 if (scr
->flags
.backimage_helper_launched
) {
3009 if (WMGetPropListItemCount(value
) == 0) {
3010 SendHelperMessage(scr
, 'C', 0, NULL
);
3011 SendHelperMessage(scr
, 'K', 0, NULL
);
3013 WMReleasePropList(value
);
3017 if (WMGetPropListItemCount(value
) == 0)
3020 if (!start_bg_helper(scr
)) {
3021 WMReleasePropList(value
);
3025 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3028 for (i
= 0; i
< WMGetPropListItemCount(value
); i
++) {
3029 val
= WMGetFromPLArray(value
, i
);
3030 if (val
&& WMIsPLArray(val
) && WMGetPropListItemCount(val
) > 0) {
3031 str
= WMGetPropListDescription(val
, False
);
3033 SendHelperMessage(scr
, 'S', i
+ 1, str
);
3037 SendHelperMessage(scr
, 'U', i
+ 1, NULL
);
3042 WMReleasePropList(value
);
3046 static int setWorkspaceBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *bar
)
3048 WMPropList
*value
= tdata
;
3050 /* Parameter not used, but tell the compiler that it is ok */
3054 if (scr
->flags
.backimage_helper_launched
) {
3057 if (WMGetPropListItemCount(value
) == 0) {
3058 SendHelperMessage(scr
, 'U', 0, NULL
);
3060 /* set the default workspace background to this one */
3061 str
= WMGetPropListDescription(value
, False
);
3063 SendHelperMessage(scr
, 'S', 0, str
);
3065 SendHelperMessage(scr
, 'C', scr
->current_workspace
+ 1, NULL
);
3067 SendHelperMessage(scr
, 'U', 0, NULL
);
3070 } else if (WMGetPropListItemCount(value
) > 0) {
3075 text
= WMGetPropListDescription(value
, False
);
3076 len
= strlen(text
) + 40;
3077 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3078 if (!strchr(text
, '\'') && !strchr(text
, '\\')) {
3081 if (wPreferences
.smooth_workspace_back
)
3082 snprintf(command
, len
, "wmsetbg %s -S -p '%s' &", dither
, text
);
3084 snprintf(command
, len
, "wmsetbg %s -p '%s' &", dither
, text
);
3085 ExecuteShellCommand(scr
, command
);
3087 wwarning(_("Invalid arguments for background \"%s\""), text
);
3090 WMReleasePropList(value
);
3095 static int setWidgetColor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3097 WTexture
**texture
= tdata
;
3099 /* Parameter not used, but tell the compiler that it is ok */
3103 if (scr
->widget_texture
) {
3104 wTextureDestroy(scr
, (WTexture
*) scr
->widget_texture
);
3106 scr
->widget_texture
= *(WTexSolid
**) texture
;
3111 static int setFTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3113 WTexture
**texture
= tdata
;
3115 /* Parameter not used, but tell the compiler that it is ok */
3119 if (scr
->window_title_texture
[WS_FOCUSED
]) {
3120 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3122 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3124 return REFRESH_WINDOW_TEXTURES
;
3127 static int setPTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3129 WTexture
**texture
= tdata
;
3131 /* Parameter not used, but tell the compiler that it is ok */
3135 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
3136 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3138 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3140 return REFRESH_WINDOW_TEXTURES
;
3143 static int setUTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3145 WTexture
**texture
= tdata
;
3147 /* Parameter not used, but tell the compiler that it is ok */
3151 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
3152 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3154 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3156 return REFRESH_WINDOW_TEXTURES
;
3159 static int setResizebarBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3161 WTexture
**texture
= tdata
;
3163 /* Parameter not used, but tell the compiler that it is ok */
3167 if (scr
->resizebar_texture
[0]) {
3168 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3170 scr
->resizebar_texture
[0] = *texture
;
3172 return REFRESH_WINDOW_TEXTURES
;
3175 static int setMenuTitleBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3177 WTexture
**texture
= tdata
;
3179 /* Parameter not used, but tell the compiler that it is ok */
3183 if (scr
->menu_title_texture
[0]) {
3184 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3186 scr
->menu_title_texture
[0] = *texture
;
3188 return REFRESH_MENU_TITLE_TEXTURE
;
3191 static int setMenuTextBack(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3193 WTexture
**texture
= tdata
;
3195 /* Parameter not used, but tell the compiler that it is ok */
3199 if (scr
->menu_item_texture
) {
3200 wTextureDestroy(scr
, scr
->menu_item_texture
);
3201 wTextureDestroy(scr
, (WTexture
*) scr
->menu_item_auxtexture
);
3203 scr
->menu_item_texture
= *texture
;
3205 scr
->menu_item_auxtexture
= wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3207 return REFRESH_MENU_TEXTURE
;
3210 static int setKeyGrab(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3212 WShortKey
*shortcut
= tdata
;
3214 long widx
= (long) extra_data
;
3216 /* Parameter not used, but tell the compiler that it is ok */
3219 wKeyBindings
[widx
] = *shortcut
;
3221 wwin
= scr
->focused_window
;
3223 while (wwin
!= NULL
) {
3224 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3226 if (!WFLAGP(wwin
, no_bind_keys
)) {
3227 wWindowSetKeyGrabs(wwin
);
3232 /* do we need to update window menus? */
3233 if (widx
>= WKBD_WORKSPACE1
&& widx
<= WKBD_WORKSPACE10
)
3234 return REFRESH_WORKSPACE_MENU
;
3235 if (widx
== WKBD_LASTWORKSPACE
)
3236 return REFRESH_WORKSPACE_MENU
;
3237 if (widx
>= WKBD_MOVE_WORKSPACE1
&& widx
<= WKBD_MOVE_WORKSPACE10
)
3238 return REFRESH_WORKSPACE_MENU
;
3243 static int setIconPosition(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3245 /* Parameter not used, but tell the compiler that it is ok */
3250 wScreenUpdateUsableArea(scr
);
3251 wArrangeIcons(scr
, True
);
3256 static int updateUsableArea(WScreen
* scr
, WDefaultEntry
* entry
, void *bar
, void *foo
)
3258 /* Parameter not used, but tell the compiler that it is ok */
3263 wScreenUpdateUsableArea(scr
);
3268 static int setWorkspaceMapBackground(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3270 WTexture
**texture
= tdata
;
3272 /* Parameter not used, but tell the compiler that it is ok */
3276 if (wPreferences
.wsmbackTexture
)
3277 wTextureDestroy(scr
, wPreferences
.wsmbackTexture
);
3279 wPreferences
.wsmbackTexture
= *texture
;
3281 return REFRESH_WINDOW_TEXTURES
;
3284 static int setMenuStyle(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3286 /* Parameter not used, but tell the compiler that it is ok */
3292 return REFRESH_MENU_TEXTURE
;
3295 static RImage
*chopOffImage(RImage
* image
, int x
, int y
, int w
, int h
)
3297 RImage
*img
= RCreateImage(w
, h
, image
->format
== RRGBAFormat
);
3299 RCopyArea(img
, image
, x
, y
, w
, h
, 0, 0);
3304 static int setSwPOptions(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3306 WMPropList
*array
= tdata
;
3309 int cwidth
, cheight
;
3310 struct WPreferences
*prefs
= foo
;
3312 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) == 0) {
3313 if (prefs
->swtileImage
)
3314 RReleaseImage(prefs
->swtileImage
);
3315 prefs
->swtileImage
= NULL
;
3317 WMReleasePropList(array
);
3321 switch (WMGetPropListItemCount(array
)) {
3323 if (!WMIsPLString(WMGetFromPLArray(array
, 1))) {
3324 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3327 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 1)));
3330 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3331 WMGetFromPLString(WMGetFromPLArray(array
, 1)), entry
->key
);
3333 bgimage
= RLoadImage(scr
->rcontext
, path
, 0);
3335 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3340 cwidth
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 2)));
3341 cheight
= atoi(WMGetFromPLString(WMGetFromPLArray(array
, 3)));
3343 if (cwidth
<= 0 || cheight
<= 0 ||
3344 cwidth
>= bgimage
->width
- 2 || cheight
>= bgimage
->height
- 2)
3345 wwarning(_("Invalid split sizes for switch panel back image."));
3348 int swidth
, theight
;
3349 for (i
= 0; i
< 9; i
++) {
3350 if (prefs
->swbackImage
[i
])
3351 RReleaseImage(prefs
->swbackImage
[i
]);
3352 prefs
->swbackImage
[i
] = NULL
;
3354 swidth
= (bgimage
->width
- cwidth
) / 2;
3355 theight
= (bgimage
->height
- cheight
) / 2;
3357 prefs
->swbackImage
[0] = chopOffImage(bgimage
, 0, 0, swidth
, theight
);
3358 prefs
->swbackImage
[1] = chopOffImage(bgimage
, swidth
, 0, cwidth
, theight
);
3359 prefs
->swbackImage
[2] = chopOffImage(bgimage
, swidth
+ cwidth
, 0,
3362 prefs
->swbackImage
[3] = chopOffImage(bgimage
, 0, theight
, swidth
, cheight
);
3363 prefs
->swbackImage
[4] = chopOffImage(bgimage
, swidth
, theight
,
3365 prefs
->swbackImage
[5] = chopOffImage(bgimage
, swidth
+ cwidth
, theight
,
3368 prefs
->swbackImage
[6] = chopOffImage(bgimage
, 0, theight
+ cheight
,
3370 prefs
->swbackImage
[7] = chopOffImage(bgimage
, swidth
, theight
+ cheight
,
3372 prefs
->swbackImage
[8] =
3373 chopOffImage(bgimage
, swidth
+ cwidth
, theight
+ cheight
, swidth
,
3376 // check if anything failed
3377 for (i
= 0; i
< 9; i
++) {
3378 if (!prefs
->swbackImage
[i
]) {
3379 for (; i
>= 0; --i
) {
3380 RReleaseImage(prefs
->swbackImage
[i
]);
3381 prefs
->swbackImage
[i
] = NULL
;
3387 RReleaseImage(bgimage
);
3394 if (!WMIsPLString(WMGetFromPLArray(array
, 0))) {
3395 wwarning(_("Invalid arguments for option \"%s\""), entry
->key
);
3398 path
= FindImage(wPreferences
.pixmap_path
, WMGetFromPLString(WMGetFromPLArray(array
, 0)));
3401 wwarning(_("Could not find image \"%s\" for option \"%s\""),
3402 WMGetFromPLString(WMGetFromPLArray(array
, 0)), entry
->key
);
3404 if (prefs
->swtileImage
)
3405 RReleaseImage(prefs
->swtileImage
);
3407 prefs
->swtileImage
= RLoadImage(scr
->rcontext
, path
, 0);
3408 if (!prefs
->swtileImage
) {
3409 wwarning(_("Could not load image \"%s\" for option \"%s\""), path
, entry
->key
);
3416 wwarning(_("Invalid number of arguments for option \"%s\""), entry
->key
);
3420 WMReleasePropList(array
);
3425 static int setModifierKeyLabels(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *foo
)
3427 WMPropList
*array
= tdata
;
3429 struct WPreferences
*prefs
= foo
;
3431 if (!WMIsPLArray(array
) || WMGetPropListItemCount(array
) != 7) {
3432 wwarning(_("Value for option \"%s\" must be an array of 7 strings"), entry
->key
);
3433 WMReleasePropList(array
);
3437 DestroyWindowMenu(scr
);
3439 for (i
= 0; i
< 7; i
++) {
3440 if (prefs
->modifier_labels
[i
])
3441 wfree(prefs
->modifier_labels
[i
]);
3443 if (WMIsPLString(WMGetFromPLArray(array
, i
))) {
3444 prefs
->modifier_labels
[i
] = wstrdup(WMGetFromPLString(WMGetFromPLArray(array
, i
)));
3446 wwarning(_("Invalid argument for option \"%s\" item %d"), entry
->key
, i
);
3447 prefs
->modifier_labels
[i
] = NULL
;
3451 WMReleasePropList(array
);
3456 static int setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, void *tdata
, void *foo
)
3460 /* Parameter not used, but tell the compiler that it is ok */
3467 W_setconf_doubleClickDelay(*value
);
3472 static int setCursor(WScreen
* scr
, WDefaultEntry
* entry
, void *tdata
, void *extra_data
)
3474 Cursor
*cursor
= tdata
;
3475 long widx
= (long) extra_data
;
3477 /* Parameter not used, but tell the compiler that it is ok */
3480 if (wPreferences
.cursor
[widx
] != None
) {
3481 XFreeCursor(dpy
, wPreferences
.cursor
[widx
]);
3484 wPreferences
.cursor
[widx
] = *cursor
;
3486 if (widx
== WCUR_ROOT
&& *cursor
!= None
) {
3487 XDefineCursor(dpy
, scr
->root_win
, *cursor
);
3493 static int updateDock(WScreen
* scr
, WDefaultEntry
* entry
,
3494 void *tdata
, void *extra_data
) {
3500 wDockSwap(scr
->dock
);