1 /* defaults.c - manage configuration through defaults db
3 * Window Maker window manager
5 * Copyright (c) 1997-2002 Alfredo K. Kojima
6 * Copyright (c) 1998-2002 Dan Pascu
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
32 #include <sys/types.h>
45 #define PATH_MAX DEFAULT_PATH_MAX
49 #include <X11/Xutil.h>
50 #include <X11/keysym.h>
55 #include "WindowMaker.h"
61 #include "resources.h"
64 #include "xmodifier.h"
69 #include "workspace.h"
70 #include "properties.h"
76 extern WDDomain
*WDWindowMaker
;
77 extern WDDomain
*WDWindowAttributes
;
78 extern WDDomain
*WDRootMenu
;
80 extern int wScreenCount
;
82 extern Atom _XA_WINDOWMAKER_ICON_SIZE
;
83 extern Atom _XA_WINDOWMAKER_ICON_TILE
;
86 extern WMPropList *wDomainName;
87 extern WMPropList *wAttributeDomainName;
89 extern WPreferences wPreferences
;
91 extern WShortKey wKeyBindings
[WKBD_LAST
];
101 WMPropList
*plvalue
; /* default value */
105 /* used to map strings to integers */
110 } WOptionEnumeration
;
113 /* type converters */
114 static int getBool();
116 static int getCoord();
118 /* this is not used yet */
119 static int getString();
121 static int getPathList();
122 static int getEnum();
123 static int getTexture();
124 static int getWSBackground();
125 static int getWSSpecificBackground();
126 static int getFont();
127 static int getColor();
128 static int getKeybind();
129 static int getModMask();
131 static int getRImage();
135 /* value setting functions */
136 static int setJustify();
137 static int setClearance();
138 static int setIfDockPresent();
139 static int setStickyIcons();
141 static int setPositive();
143 static int setWidgetColor();
144 static int setIconTile();
145 static int setWinTitleFont();
146 static int setMenuTitleFont();
147 static int setMenuTextFont();
148 static int setIconTitleFont();
149 static int setIconTitleColor();
150 static int setIconTitleBack();
151 static int setLargeDisplayFont();
152 static int setWTitleColor();
153 static int setFTitleBack();
154 static int setPTitleBack();
155 static int setUTitleBack();
156 static int setResizebarBack();
157 static int setWorkspaceBack();
158 static int setWorkspaceSpecificBack();
159 static int setMenuTitleColor();
160 static int setMenuTextColor();
161 static int setMenuDisabledColor();
162 static int setMenuTitleBack();
163 static int setMenuTextBack();
164 static int setHightlight();
165 static int setHightlightText();
166 static int setKeyGrab();
167 static int setDoubleClick();
168 static int setIconPosition();
170 static int setClipTitleFont();
171 static int setClipTitleColor();
173 static int setMenuStyle();
175 static int setMultiByte();
177 static int updateUsableArea();
179 extern Cursor wCursor
[WCUR_LAST
];
180 static int getCursor();
181 static int setCursor();
185 * Tables to convert strings to enumeration values.
186 * Values stored are char
190 /* WARNING: sum of length of all value strings must not exceed
192 #define TOTAL_VALUES_LENGTH 80
197 #define REFRESH_WINDOW_TEXTURES (1<<0)
198 #define REFRESH_MENU_TEXTURE (1<<1)
199 #define REFRESH_MENU_FONT (1<<2)
200 #define REFRESH_MENU_COLOR (1<<3)
201 #define REFRESH_MENU_TITLE_TEXTURE (1<<4)
202 #define REFRESH_MENU_TITLE_FONT (1<<5)
203 #define REFRESH_MENU_TITLE_COLOR (1<<6)
204 #define REFRESH_WINDOW_TITLE_COLOR (1<<7)
205 #define REFRESH_WINDOW_FONT (1<<8)
206 #define REFRESH_ICON_TILE (1<<9)
207 #define REFRESH_ICON_FONT (1<<10)
208 #define REFRESH_WORKSPACE_BACK (1<<11)
210 #define REFRESH_BUTTON_IMAGES (1<<12)
212 #define REFRESH_ICON_TITLE_COLOR (1<<13)
213 #define REFRESH_ICON_TITLE_BACK (1<<14)
217 static WOptionEnumeration seFocusModes
[] = {
218 {"Manual", WKF_CLICK
, 0}, {"ClickToFocus", WKF_CLICK
, 1},
219 {"Sloppy", WKF_SLOPPY
, 0}, {"SemiAuto", WKF_SLOPPY
, 1}, {"Auto", WKF_SLOPPY
, 1},
223 static WOptionEnumeration seColormapModes
[] = {
224 {"Manual", WCM_CLICK
, 0}, {"ClickToFocus", WCM_CLICK
, 1},
225 {"Auto", WCM_POINTER
, 0}, {"FocusFollowMouse", WCM_POINTER
, 1},
229 static WOptionEnumeration sePlacements
[] = {
230 {"Auto", WPM_AUTO
, 0},
231 {"Smart", WPM_SMART
, 0},
232 {"Cascade", WPM_CASCADE
, 0},
233 {"Random", WPM_RANDOM
, 0},
234 {"Manual", WPM_MANUAL
, 0},
238 static WOptionEnumeration seGeomDisplays
[] = {
239 {"None", WDIS_NONE
, 0},
240 {"Center", WDIS_CENTER
, 0},
241 {"Corner", WDIS_TOPLEFT
, 0},
242 {"Floating", WDIS_FRAME_CENTER
, 0},
243 {"Line", WDIS_NEW
, 0},
247 static WOptionEnumeration seSpeeds
[] = {
248 {"UltraFast", SPEED_ULTRAFAST
, 0},
249 {"Fast", SPEED_FAST
, 0},
250 {"Medium", SPEED_MEDIUM
, 0},
251 {"Slow", SPEED_SLOW
, 0},
252 {"UltraSlow", SPEED_ULTRASLOW
, 0},
256 static WOptionEnumeration seMouseButtonActions
[] = {
257 {"None", WA_NONE
, 0},
258 {"SelectWindows", WA_SELECT_WINDOWS
, 0},
259 {"OpenApplicationsMenu", WA_OPEN_APPMENU
, 0},
260 {"OpenWindowListMenu", WA_OPEN_WINLISTMENU
, 0},
264 static WOptionEnumeration seMouseWheelActions
[] = {
265 {"None", WA_NONE
, 0},
266 {"SwitchWorkspaces", WA_SWITCH_WORKSPACES
, 0},
270 static WOptionEnumeration seIconificationStyles
[] = {
271 {"Zoom", WIS_ZOOM
, 0},
272 {"Twist", WIS_TWIST
, 0},
273 {"Flip", WIS_FLIP
, 0},
274 {"None", WIS_NONE
, 0},
275 {"random", WIS_RANDOM
, 0},
279 static WOptionEnumeration seJustifications
[] = {
280 {"Left", WTJ_LEFT
, 0},
281 {"Center", WTJ_CENTER
, 0},
282 {"Right", WTJ_RIGHT
, 0},
286 static WOptionEnumeration seIconPositions
[] = {
287 {"blv", IY_BOTTOM
|IY_LEFT
|IY_VERT
, 0},
288 {"blh", IY_BOTTOM
|IY_LEFT
|IY_HORIZ
, 0},
289 {"brv", IY_BOTTOM
|IY_RIGHT
|IY_VERT
, 0},
290 {"brh", IY_BOTTOM
|IY_RIGHT
|IY_HORIZ
, 0},
291 {"tlv", IY_TOP
|IY_LEFT
|IY_VERT
, 0},
292 {"tlh", IY_TOP
|IY_LEFT
|IY_HORIZ
, 0},
293 {"trv", IY_TOP
|IY_RIGHT
|IY_VERT
, 0},
294 {"trh", IY_TOP
|IY_RIGHT
|IY_HORIZ
, 0},
298 static WOptionEnumeration seMenuStyles
[] = {
299 {"normal", MS_NORMAL
, 0},
300 {"singletexture", MS_SINGLE_TEXTURE
, 0},
301 {"flat", MS_FLAT
, 0},
306 static WOptionEnumeration seDisplayPositions
[] = {
307 {"none", WD_NONE
, 0},
308 {"center", WD_CENTER
, 0},
310 {"bottom", WD_BOTTOM
, 0},
311 {"topleft", WD_TOPLEFT
, 0},
312 {"topright", WD_TOPRIGHT
, 0},
313 {"bottomleft", WD_BOTTOMLEFT
, 0},
314 {"bottomright", WD_BOTTOMRIGHT
, 0},
318 static WOptionEnumeration seWorkspaceBorder
[] = {
319 {"None", WB_NONE
, 0},
320 {"LeftRight", WB_LEFTRIGHT
, 0},
321 {"TopBottom", WB_TOPBOTTOM
, 0},
322 {"AllDirections", WB_ALLDIRS
, 0},
328 * ALL entries in the tables bellow, NEED to have a default value
329 * defined, and this value needs to be correct.
332 /* these options will only affect the window manager on startup
334 * static defaults can't access the screen data, because it is
335 * created after these defaults are read
337 WDefaultEntry staticOptionList
[] = {
339 {"ColormapSize", "4", NULL
,
340 &wPreferences
.cmap_size
, getInt
, NULL
342 {"DisableDithering", "NO", NULL
,
343 &wPreferences
.no_dithering
, getBool
, NULL
345 /* static by laziness */
346 {"IconSize", "64", NULL
,
347 &wPreferences
.icon_size
, getInt
, NULL
349 {"ModifierKey", "Mod1", NULL
,
350 &wPreferences
.modifier_mask
, getModMask
, NULL
352 {"DisableWSMouseActions", "NO", NULL
,
353 &wPreferences
.disable_root_mouse
, getBool
, NULL
355 {"FocusMode", "manual", seFocusModes
,
356 &wPreferences
.focus_mode
, getEnum
, NULL
357 }, /* have a problem when switching from manual to sloppy without restart */
358 {"NewStyle", "NO", NULL
,
359 &wPreferences
.new_style
, getBool
, NULL
361 {"DisableDock", "NO", (void*) WM_DOCK
,
362 NULL
, getBool
, setIfDockPresent
364 {"DisableClip", "NO", (void*) WM_CLIP
,
365 NULL
, getBool
, setIfDockPresent
367 {"DisableMiniwindows", "NO", NULL
,
368 &wPreferences
.disable_miniwindows
, getBool
, NULL
371 ,{"MultiByteText", "NO", NULL
,
372 &wPreferences
.multi_byte_text
, getBool
, setMultiByte
379 WDefaultEntry optionList
[] = {
380 /* dynamic options */
381 {"IconPosition", "blh", seIconPositions
,
382 &wPreferences
.icon_yard
, getEnum
, setIconPosition
384 {"IconificationStyle", "Zoom", seIconificationStyles
,
385 &wPreferences
.iconification_style
, getEnum
, NULL
387 {"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions
,
388 &wPreferences
.mouse_button1
, getEnum
, NULL
390 {"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions
,
391 &wPreferences
.mouse_button2
, getEnum
, NULL
393 {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions
,
394 &wPreferences
.mouse_button3
, getEnum
, NULL
396 {"MouseWheelAction", "None", seMouseWheelActions
,
397 &wPreferences
.mouse_wheel
, getEnum
, NULL
399 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
400 &wPreferences
.pixmap_path
, getPathList
, NULL
402 {"IconPath", DEF_ICON_PATHS
, NULL
,
403 &wPreferences
.icon_path
, getPathList
, NULL
405 {"ColormapMode", "auto", seColormapModes
,
406 &wPreferences
.colormap_mode
, getEnum
, NULL
408 {"AutoFocus", "NO", NULL
,
409 &wPreferences
.auto_focus
, getBool
, NULL
411 {"RaiseDelay", "0", NULL
,
412 &wPreferences
.raise_delay
, getInt
, NULL
414 {"WindozeCycling", "NO", NULL
,
415 &wPreferences
.windows_cycling
,getBool
, NULL
417 {"CirculateRaise", "NO", NULL
,
418 &wPreferences
.circ_raise
, getBool
, NULL
420 {"Superfluous", "NO", NULL
,
421 &wPreferences
.superfluous
, getBool
, NULL
423 {"AdvanceToNewWorkspace", "NO", NULL
,
424 &wPreferences
.ws_advance
, getBool
, NULL
426 {"CycleWorkspaces", "NO", NULL
,
427 &wPreferences
.ws_cycle
, getBool
, NULL
429 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
430 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
432 {"WorkspaceBorder", "None", seWorkspaceBorder
,
433 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
435 {"WorkspaceBorderSize", "0", NULL
,
436 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
438 #ifdef VIRTUAL_DESKTOP
439 {"VirtualEdgeThickness", "1", NULL
,
440 &wPreferences
.vedge_thickness
, getInt
, NULL
442 {"VirtualEdgeExtendSpace", "0", NULL
,
443 &wPreferences
.vedge_bordersize
, getInt
, NULL
445 {"VirtualEdgeHorizonScrollSpeed", "1", NULL
,
446 &wPreferences
.vedge_hscrollspeed
, getInt
, NULL
448 {"VirtualEdgeVerticalScrollSpeed", "1", NULL
,
449 &wPreferences
.vedge_vscrollspeed
, getInt
, NULL
451 {"VirtualEdgeMaximumWidth", "3000", NULL
,
452 &wPreferences
.vedge_maxwidth
, getInt
, NULL
454 {"VirtualEdgeMaximumHeight", "3000", NULL
,
455 &wPreferences
.vedge_maxheight
, getInt
, NULL
458 {"StickyIcons", "NO", NULL
,
459 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
461 {"SaveSessionOnExit", "NO", NULL
,
462 &wPreferences
.save_session_on_exit
, getBool
, NULL
464 {"WrapMenus", "NO", NULL
,
465 &wPreferences
.wrap_menus
, getBool
, NULL
467 {"ScrollableMenus", "NO", NULL
,
468 &wPreferences
.scrollable_menus
, getBool
, NULL
470 {"MenuScrollSpeed", "medium", seSpeeds
,
471 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
473 {"IconSlideSpeed", "medium", seSpeeds
,
474 &wPreferences
.icon_slide_speed
, getEnum
, NULL
476 {"ShadeSpeed", "medium", seSpeeds
,
477 &wPreferences
.shade_speed
, getEnum
, NULL
479 {"DoubleClickTime", "250", (void*) &wPreferences
.dblclick_time
,
480 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
,
482 {"AlignSubmenus", "NO", NULL
,
483 &wPreferences
.align_menus
, getBool
, NULL
485 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
486 &wPreferences
.open_transients_with_parent
, getBool
, NULL
488 {"WindowPlacement", "auto", sePlacements
,
489 &wPreferences
.window_placement
, getEnum
, NULL
491 {"IgnoreFocusClick","NO", NULL
,
492 &wPreferences
.ignore_focus_click
, getBool
, NULL
494 {"UseSaveUnders", "NO", NULL
,
495 &wPreferences
.use_saveunders
, getBool
, NULL
497 {"OpaqueMove", "NO", NULL
,
498 &wPreferences
.opaque_move
, getBool
, NULL
500 {"DisableSound", "NO", NULL
,
501 &wPreferences
.no_sound
, getBool
, NULL
503 {"DisableAnimations", "NO", NULL
,
504 &wPreferences
.no_animations
, getBool
, NULL
506 {"DontLinkWorkspaces","NO", NULL
,
507 &wPreferences
.no_autowrap
, getBool
, NULL
509 {"AutoArrangeIcons", "NO", NULL
,
510 &wPreferences
.auto_arrange_icons
, getBool
, NULL
512 {"NoWindowOverDock", "NO", NULL
,
513 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
515 {"NoWindowOverIcons", "NO", NULL
,
516 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
518 {"WindowPlaceOrigin", "(0, 0)", NULL
,
519 &wPreferences
.window_place_origin
, getCoord
, NULL
521 {"ResizeDisplay", "corner", seGeomDisplays
,
522 &wPreferences
.size_display
, getEnum
, NULL
524 {"MoveDisplay", "corner", seGeomDisplays
,
525 &wPreferences
.move_display
, getEnum
, NULL
527 {"DontConfirmKill", "NO", NULL
,
528 &wPreferences
.dont_confirm_kill
, getBool
,NULL
530 {"WindowTitleBalloons", "NO", NULL
,
531 &wPreferences
.window_balloon
, getBool
, NULL
533 {"MiniwindowTitleBalloons", "NO", NULL
,
534 &wPreferences
.miniwin_balloon
,getBool
, NULL
536 {"AppIconBalloons", "NO", NULL
,
537 &wPreferences
.appicon_balloon
,getBool
, NULL
539 {"HelpBalloons", "NO", NULL
,
540 &wPreferences
.help_balloon
, getBool
, NULL
542 {"EdgeResistance", "30", NULL
,
543 &wPreferences
.edge_resistance
,getInt
, NULL
545 {"Attraction", "NO", NULL
,
546 &wPreferences
.attract
, getBool
, NULL
548 {"DisableBlinking", "NO", NULL
,
549 &wPreferences
.dont_blink
, getBool
, NULL
552 {"MenuStyle", "normal", seMenuStyles
,
553 &wPreferences
.menu_style
, getEnum
, setMenuStyle
555 {"WidgetColor", "(solid, gray)", NULL
,
556 NULL
, getTexture
, setWidgetColor
,
558 {"WorkspaceSpecificBack","()", NULL
,
559 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
561 /* WorkspaceBack must come after WorkspaceSpecificBack or
562 * WorkspaceBack wont know WorkspaceSpecificBack was also
563 * specified and 2 copies of wmsetbg will be launched */
564 {"WorkspaceBack", "(solid, black)", NULL
,
565 NULL
, getWSBackground
,setWorkspaceBack
567 {"SmoothWorkspaceBack", "NO", NULL
,
570 {"IconBack", "(solid, gray)", NULL
,
571 NULL
, getTexture
, setIconTile
573 {"TitleJustify", "center", seJustifications
,
574 &wPreferences
.title_justification
, getEnum
, setJustify
576 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
577 NULL
, getFont
, setWinTitleFont
,
579 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
580 &wPreferences
.window_title_clearance
, getInt
, setClearance
582 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
583 &wPreferences
.menu_title_clearance
, getInt
, setClearance
585 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
586 &wPreferences
.menu_text_clearance
, getInt
, setClearance
588 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
589 NULL
, getFont
, setMenuTitleFont
591 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
592 NULL
, getFont
, setMenuTextFont
594 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
595 NULL
, getFont
, setIconTitleFont
597 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
598 NULL
, getFont
, setClipTitleFont
600 {"LargeDisplayFont",DEF_WORKSPACE_NAME_FONT
, NULL
,
601 NULL
, getFont
, setLargeDisplayFont
603 {"HighlightColor", "white", NULL
,
604 NULL
, getColor
, setHightlight
606 {"HighlightTextColor", "black", NULL
,
607 NULL
, getColor
, setHightlightText
609 {"ClipTitleColor", "black", (void*)CLIP_NORMAL
,
610 NULL
, getColor
, setClipTitleColor
612 {"CClipTitleColor", "\"#454045\"", (void*)CLIP_COLLAPSED
,
613 NULL
, getColor
, setClipTitleColor
615 {"FTitleColor", "white", (void*)WS_FOCUSED
,
616 NULL
, getColor
, setWTitleColor
618 {"PTitleColor", "white", (void*)WS_PFOCUSED
,
619 NULL
, getColor
, setWTitleColor
621 {"UTitleColor", "black", (void*)WS_UNFOCUSED
,
622 NULL
, getColor
, setWTitleColor
624 {"FTitleBack", "(solid, black)", NULL
,
625 NULL
, getTexture
, setFTitleBack
627 {"PTitleBack", "(solid, \"#616161\")", NULL
,
628 NULL
, getTexture
, setPTitleBack
630 {"UTitleBack", "(solid, gray)", NULL
,
631 NULL
, getTexture
, setUTitleBack
633 {"ResizebarBack", "(solid, gray)", NULL
,
634 NULL
, getTexture
, setResizebarBack
636 {"MenuTitleColor", "white", NULL
,
637 NULL
, getColor
, setMenuTitleColor
639 {"MenuTextColor", "black", NULL
,
640 NULL
, getColor
, setMenuTextColor
642 {"MenuDisabledColor", "\"#616161\"", NULL
,
643 NULL
, getColor
, setMenuDisabledColor
645 {"MenuTitleBack", "(solid, black)", NULL
,
646 NULL
, getTexture
, setMenuTitleBack
648 {"MenuTextBack", "(solid, gray)", NULL
,
649 NULL
, getTexture
, setMenuTextBack
651 {"IconTitleColor", "white", NULL
,
652 NULL
, getColor
, setIconTitleColor
654 {"IconTitleBack", "black", NULL
,
655 NULL
, getColor
, setIconTitleBack
659 {"RootMenuKey", "None", (void*)WKBD_ROOTMENU
,
660 NULL
, getKeybind
, setKeyGrab
662 {"WindowListKey", "None", (void*)WKBD_WINDOWLIST
,
663 NULL
, getKeybind
, setKeyGrab
666 {"WindowMenuKey", "None", (void*)WKBD_WINDOWMENU
,
667 NULL
, getKeybind
, setKeyGrab
669 {"ClipLowerKey", "None", (void*)WKBD_CLIPLOWER
,
670 NULL
, getKeybind
, setKeyGrab
672 {"ClipRaiseKey", "None", (void*)WKBD_CLIPRAISE
,
673 NULL
, getKeybind
, setKeyGrab
675 {"ClipRaiseLowerKey", "None", (void*)WKBD_CLIPRAISELOWER
,
676 NULL
, getKeybind
, setKeyGrab
678 {"MiniaturizeKey", "None", (void*)WKBD_MINIATURIZE
,
679 NULL
, getKeybind
, setKeyGrab
681 {"HideKey", "None", (void*)WKBD_HIDE
,
682 NULL
, getKeybind
, setKeyGrab
684 {"HideOthersKey", "None", (void*)WKBD_HIDE_OTHERS
,
685 NULL
, getKeybind
, setKeyGrab
687 {"MoveResizeKey", "None", (void*)WKBD_MOVERESIZE
,
688 NULL
, getKeybind
, setKeyGrab
690 {"CloseKey", "None", (void*)WKBD_CLOSE
,
691 NULL
, getKeybind
, setKeyGrab
693 {"MaximizeKey", "None", (void*)WKBD_MAXIMIZE
,
694 NULL
, getKeybind
, setKeyGrab
696 {"VMaximizeKey", "None", (void*)WKBD_VMAXIMIZE
,
697 NULL
, getKeybind
, setKeyGrab
699 {"HMaximizeKey", "None", (void*)WKBD_HMAXIMIZE
,
700 NULL
, getKeybind
, setKeyGrab
702 {"RaiseKey", "\"Meta+Up\"", (void*)WKBD_RAISE
,
703 NULL
, getKeybind
, setKeyGrab
705 {"LowerKey", "\"Meta+Down\"", (void*)WKBD_LOWER
,
706 NULL
, getKeybind
, setKeyGrab
708 {"RaiseLowerKey", "None", (void*)WKBD_RAISELOWER
,
709 NULL
, getKeybind
, setKeyGrab
711 {"ShadeKey", "None", (void*)WKBD_SHADE
,
712 NULL
, getKeybind
, setKeyGrab
714 {"SelectKey", "None", (void*)WKBD_SELECT
,
715 NULL
, getKeybind
, setKeyGrab
717 {"FocusNextKey", "None", (void*)WKBD_FOCUSNEXT
,
718 NULL
, getKeybind
, setKeyGrab
720 {"FocusPrevKey", "None", (void*)WKBD_FOCUSPREV
,
721 NULL
, getKeybind
, setKeyGrab
723 {"NextWorkspaceKey", "None", (void*)WKBD_NEXTWORKSPACE
,
724 NULL
, getKeybind
, setKeyGrab
726 {"PrevWorkspaceKey", "None", (void*)WKBD_PREVWORKSPACE
,
727 NULL
, getKeybind
, setKeyGrab
729 {"NextWorkspaceLayerKey", "None", (void*)WKBD_NEXTWSLAYER
,
730 NULL
, getKeybind
, setKeyGrab
732 {"PrevWorkspaceLayerKey", "None", (void*)WKBD_PREVWSLAYER
,
733 NULL
, getKeybind
, setKeyGrab
735 {"Workspace1Key", "None", (void*)WKBD_WORKSPACE1
,
736 NULL
, getKeybind
, setKeyGrab
738 {"Workspace2Key", "None", (void*)WKBD_WORKSPACE2
,
739 NULL
, getKeybind
, setKeyGrab
741 {"Workspace3Key", "None", (void*)WKBD_WORKSPACE3
,
742 NULL
, getKeybind
, setKeyGrab
744 {"Workspace4Key", "None", (void*)WKBD_WORKSPACE4
,
745 NULL
, getKeybind
, setKeyGrab
747 {"Workspace5Key", "None", (void*)WKBD_WORKSPACE5
,
748 NULL
, getKeybind
, setKeyGrab
750 {"Workspace6Key", "None", (void*)WKBD_WORKSPACE6
,
751 NULL
, getKeybind
, setKeyGrab
753 {"Workspace7Key", "None", (void*)WKBD_WORKSPACE7
,
754 NULL
, getKeybind
, setKeyGrab
756 {"Workspace8Key", "None", (void*)WKBD_WORKSPACE8
,
757 NULL
, getKeybind
, setKeyGrab
759 {"Workspace9Key", "None", (void*)WKBD_WORKSPACE9
,
760 NULL
, getKeybind
, setKeyGrab
762 {"Workspace10Key", "None", (void*)WKBD_WORKSPACE10
,
763 NULL
, getKeybind
, setKeyGrab
765 {"WindowShortcut1Key","None", (void*)WKBD_WINDOW1
,
766 NULL
, getKeybind
, setKeyGrab
768 {"WindowShortcut2Key","None", (void*)WKBD_WINDOW2
,
769 NULL
, getKeybind
, setKeyGrab
771 {"WindowShortcut3Key","None", (void*)WKBD_WINDOW3
,
772 NULL
, getKeybind
, setKeyGrab
774 {"WindowShortcut4Key","None", (void*)WKBD_WINDOW4
,
775 NULL
, getKeybind
, setKeyGrab
777 ,{"WindowShortcut5Key","None", (void*)WKBD_WINDOW5
,
778 NULL
, getKeybind
, setKeyGrab
780 {"WindowShortcut6Key","None", (void*)WKBD_WINDOW6
,
781 NULL
, getKeybind
, setKeyGrab
783 {"WindowShortcut7Key","None", (void*)WKBD_WINDOW7
,
784 NULL
, getKeybind
, setKeyGrab
786 {"WindowShortcut8Key","None", (void*)WKBD_WINDOW8
,
787 NULL
, getKeybind
, setKeyGrab
789 {"WindowShortcut9Key","None", (void*)WKBD_WINDOW9
,
790 NULL
, getKeybind
, setKeyGrab
792 {"WindowShortcut10Key","None", (void*)WKBD_WINDOW10
,
793 NULL
, getKeybind
, setKeyGrab
795 {"ScreenSwitchKey", "None", (void*)WKBD_SWITCH_SCREEN
,
796 NULL
, getKeybind
, setKeyGrab
799 #ifdef KEEP_XKB_LOCK_STATUS
800 {"ToggleKbdModeKey", "None", (void*)WKBD_TOGGLE
,
801 NULL
, getKeybind
, setKeyGrab
803 {"KbdModeLock", "NO", NULL
,
804 &wPreferences
.modelock
, getBool
, NULL
806 #endif /* KEEP_XKB_LOCK_STATUS */
808 {"NormalCursor", "(builtin, left_ptr)", (void*)WCUR_ROOT
,
809 NULL
, getCursor
, setCursor
811 {"ArrowCursor", "(builtin, top_left_arrow)", (void*)WCUR_ARROW
,
812 NULL
, getCursor
, setCursor
814 {"MoveCursor", "(builtin, fleur)", (void*)WCUR_MOVE
,
815 NULL
, getCursor
, setCursor
817 {"ResizeCursor", "(builtin, sizing)", (void*)WCUR_RESIZE
,
818 NULL
, getCursor
, setCursor
820 {"TopLeftResizeCursor", "(builtin, top_left_corner)",
821 (void*)WCUR_TOPLEFTRESIZE
,
822 NULL
, getCursor
, setCursor
824 {"TopRightResizeCursor", "(builtin, top_right_corner)",
825 (void*)WCUR_TOPRIGHTRESIZE
,
826 NULL
, getCursor
, setCursor
828 {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)",
829 (void*)WCUR_BOTTOMLEFTRESIZE
,
830 NULL
, getCursor
, setCursor
832 {"BottomRightResizeCursor", "(builtin, bottom_right_corner)",
833 (void*)WCUR_BOTTOMRIGHTRESIZE
,
834 NULL
, getCursor
, setCursor
836 {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)",
837 (void*)WCUR_VERTICALRESIZE
,
838 NULL
, getCursor
, setCursor
840 {"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)",
841 (void*)WCUR_HORIZONRESIZE
,
842 NULL
, getCursor
, setCursor
844 {"WaitCursor", "(builtin, watch)", (void*)WCUR_WAIT
,
845 NULL
, getCursor
, setCursor
847 {"QuestionCursor", "(builtin, question_arrow)", (void*)WCUR_QUESTION
,
848 NULL
, getCursor
, setCursor
850 {"TextCursor", "(builtin, xterm)", (void*)WCUR_TEXT
,
851 NULL
, getCursor
, setCursor
853 {"SelectCursor", "(builtin, cross)", (void*)WCUR_SELECT
,
854 NULL
, getCursor
, setCursor
860 static void rereadDefaults(void);
867 /* must defer the update because accessing X data from a
868 * signal handler can mess up Xlib */
877 WDefaultEntry
*entry
;
879 WMPLSetCaseSensitive(False
);
881 for (i
=0; i
<sizeof(optionList
)/sizeof(WDefaultEntry
); i
++) {
882 entry
= &optionList
[i
];
884 entry
->plkey
= WMCreatePLString(entry
->key
);
885 if (entry
->default_value
)
886 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
888 entry
->plvalue
= NULL
;
891 for (i
=0; i
<sizeof(staticOptionList
)/sizeof(WDefaultEntry
); i
++) {
892 entry
= &staticOptionList
[i
];
894 entry
->plkey
= WMCreatePLString(entry
->key
);
895 if (entry
->default_value
)
896 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
898 entry
->plvalue
= NULL
;
902 wDomainName = WMCreatePLString(WMDOMAIN_NAME);
903 wAttributeDomainName = WMCreatePLString(WMATTRIBUTE_DOMAIN_NAME);
905 PLRegister(wDomainName, rereadDefaults);
906 PLRegister(wAttributeDomainName, rereadDefaults);
912 readGlobalDomain(char *domainName
, Bool requireDictionary
)
914 WMPropList
*globalDict
= NULL
;
918 snprintf(path
, sizeof(path
), "%s/WindowMaker/%s", SYSCONFDIR
, domainName
);
919 if (stat(path
, &stbuf
)>=0) {
920 globalDict
= WMReadPropListFromFile(path
);
921 if (globalDict
&& requireDictionary
&& !WMIsPLDictionary(globalDict
)) {
922 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
924 WMReleasePropList(globalDict
);
926 } else if (!globalDict
) {
927 wwarning(_("could not load domain %s from global defaults database"),
938 wDefaultsInit(int screen_number
)
940 static int defaults_inited
= 0;
943 if (!defaults_inited
) {
947 dict
= PLGetDomain(wDomainName
);
949 wwarning(_("could not read domain \"%s\" from defaults database"),
950 WMGetFromPLString(wDomainName
));
959 wDefaultsDestroyDomain(WDDomain
*domain
)
961 if (domain
->dictionary
)
962 WMReleasePropList(domain
->dictionary
);
969 wDefaultsInitDomain(char *domain
, Bool requireDictionary
)
973 static int inited
= 0;
976 WMPropList
*shared_dict
=NULL
;
983 db
= wmalloc(sizeof(WDDomain
));
984 memset(db
, 0, sizeof(WDDomain
));
985 db
->domain_name
= domain
;
986 db
->path
= wdefaultspathfordomain(domain
);
989 if (the_path
&& stat(the_path
, &stbuf
)>=0) {
990 db
->dictionary
= WMReadPropListFromFile(the_path
);
991 if (db
->dictionary
) {
992 if (requireDictionary
&& !WMIsPLDictionary(db
->dictionary
)) {
993 WMReleasePropList(db
->dictionary
);
994 db
->dictionary
= NULL
;
995 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
998 db
->timestamp
= stbuf
.st_mtime
;
1000 wwarning(_("could not load domain %s from user defaults database"),
1005 /* global system dictionary */
1006 snprintf(path
, sizeof(path
), "%s/WindowMaker/%s", SYSCONFDIR
, domain
);
1007 if (stat(path
, &stbuf
)>=0) {
1008 shared_dict
= WMReadPropListFromFile(path
);
1010 if (requireDictionary
&& !WMIsPLDictionary(shared_dict
)) {
1011 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
1013 WMReleasePropList(shared_dict
);
1016 if (db
->dictionary
&& WMIsPLDictionary(shared_dict
) &&
1017 WMIsPLDictionary(db
->dictionary
)) {
1018 WMMergePLDictionaries(shared_dict
, db
->dictionary
, True
);
1019 WMReleasePropList(db
->dictionary
);
1020 db
->dictionary
= shared_dict
;
1021 if (stbuf
.st_mtime
> db
->timestamp
)
1022 db
->timestamp
= stbuf
.st_mtime
;
1023 } else if (!db
->dictionary
) {
1024 db
->dictionary
= shared_dict
;
1025 if (stbuf
.st_mtime
> db
->timestamp
)
1026 db
->timestamp
= stbuf
.st_mtime
;
1030 wwarning(_("could not load domain %s from global defaults database (%s)"),
1040 wReadStaticDefaults(WMPropList
*dict
)
1042 WMPropList
*plvalue
;
1043 WDefaultEntry
*entry
;
1048 for (i
=0; i
<sizeof(staticOptionList
)/sizeof(WDefaultEntry
); i
++) {
1049 entry
= &staticOptionList
[i
];
1052 plvalue
= WMGetFromPLDictionary(dict
, entry
->plkey
);
1057 /* no default in the DB. Use builtin default */
1058 plvalue
= entry
->plvalue
;
1063 (*entry
->convert
)(NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
1064 if (entry
->update
) {
1065 (*entry
->update
)(NULL
, entry
, tdata
, entry
->extra_data
);
1073 wDefaultsCheckDomains(void *foo
)
1077 WMPropList
*shared_dict
= NULL
;
1082 puts("Checking domains...");
1084 if (stat(WDWindowMaker
->path
, &stbuf
)>=0
1085 && WDWindowMaker
->timestamp
< stbuf
.st_mtime
) {
1087 puts("Checking WindowMaker domain");
1089 WDWindowMaker
->timestamp
= stbuf
.st_mtime
;
1091 /* global dictionary */
1092 shared_dict
= readGlobalDomain("WindowMaker", True
);
1093 /* user dictionary */
1094 dict
= WMReadPropListFromFile(WDWindowMaker
->path
);
1096 if (!WMIsPLDictionary(dict
)) {
1097 WMReleasePropList(dict
);
1099 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1100 "WindowMaker", WDWindowMaker
->path
);
1103 WMMergePLDictionaries(shared_dict
, dict
, True
);
1104 WMReleasePropList(dict
);
1108 for (i
=0; i
<wScreenCount
; i
++) {
1109 scr
= wScreenWithNumber(i
);
1111 wReadDefaults(scr
, dict
);
1113 if (WDWindowMaker
->dictionary
) {
1114 WMReleasePropList(WDWindowMaker
->dictionary
);
1116 WDWindowMaker
->dictionary
= dict
;
1119 wwarning(_("could not load domain %s from user defaults database"),
1123 WMReleasePropList(shared_dict
);
1127 if (stat(WDWindowAttributes
->path
, &stbuf
)>=0
1128 && WDWindowAttributes
->timestamp
< stbuf
.st_mtime
) {
1130 puts("Checking WMWindowAttributes domain");
1132 /* global dictionary */
1133 shared_dict
= readGlobalDomain("WMWindowAttributes", True
);
1134 /* user dictionary */
1135 dict
= WMReadPropListFromFile(WDWindowAttributes
->path
);
1137 if (!WMIsPLDictionary(dict
)) {
1138 WMReleasePropList(dict
);
1140 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1141 "WMWindowAttributes", WDWindowAttributes
->path
);
1144 WMMergePLDictionaries(shared_dict
, dict
, True
);
1145 WMReleasePropList(dict
);
1149 if (WDWindowAttributes
->dictionary
) {
1150 WMReleasePropList(WDWindowAttributes
->dictionary
);
1152 WDWindowAttributes
->dictionary
= dict
;
1153 for (i
=0; i
<wScreenCount
; i
++) {
1154 scr
= wScreenWithNumber(i
);
1158 wDefaultUpdateIcons(scr
);
1160 /* Update the panel image if changed */
1161 /* Don't worry. If the image is the same these
1162 * functions will have no performance impact. */
1163 image
= wDefaultGetImage(scr
, "Logo", "WMPanel");
1166 wwarning(_("could not load logo image for panels: %s"),
1167 RMessageForError(RErrorCode
));
1169 WMSetApplicationIconImage(scr
->wmscreen
, image
);
1170 RReleaseImage(image
);
1176 wwarning(_("could not load domain %s from user defaults database"),
1177 "WMWindowAttributes");
1179 WDWindowAttributes
->timestamp
= stbuf
.st_mtime
;
1181 WMReleasePropList(shared_dict
);
1186 if (stat(WDRootMenu
->path
, &stbuf
)>=0
1187 && WDRootMenu
->timestamp
< stbuf
.st_mtime
) {
1188 dict
= WMReadPropListFromFile(WDRootMenu
->path
);
1190 puts("Checking WMRootMenu domain");
1193 if (!WMIsPLArray(dict
) && !WMIsPLString(dict
)) {
1194 WMReleasePropList(dict
);
1196 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1197 "WMRootMenu", WDRootMenu
->path
);
1199 if (WDRootMenu
->dictionary
) {
1200 WMReleasePropList(WDRootMenu
->dictionary
);
1202 WDRootMenu
->dictionary
= dict
;
1205 wwarning(_("could not load domain %s from user defaults database"),
1208 WDRootMenu
->timestamp
= stbuf
.st_mtime
;
1213 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, foo
);
1218 wReadDefaults(WScreen
*scr
, WMPropList
*new_dict
)
1220 WMPropList
*plvalue
, *old_value
;
1221 WDefaultEntry
*entry
;
1223 int update_workspace_back
= 0; /* kluge :/ */
1226 WMPropList
*old_dict
= (WDWindowMaker
->dictionary
!=new_dict
1227 ? WDWindowMaker
->dictionary
: NULL
);
1233 for (i
=0; i
<sizeof(optionList
)/sizeof(WDefaultEntry
); i
++) {
1234 entry
= &optionList
[i
];
1237 plvalue
= WMGetFromPLDictionary(new_dict
, entry
->plkey
);
1244 old_value
= WMGetFromPLDictionary(old_dict
, entry
->plkey
);
1247 if (!plvalue
&& !old_value
) {
1248 /* no default in the DB. Use builtin default */
1249 plvalue
= entry
->plvalue
;
1250 if (plvalue
&& new_dict
) {
1251 WMPutInPLDictionary(new_dict
, entry
->plkey
, plvalue
);
1254 } else if (!plvalue
) {
1255 /* value was deleted from DB. Keep current value */
1257 } else if (!old_value
) {
1258 /* set value for the 1st time */
1259 } else if (!WMIsPropListEqualTo(plvalue
, old_value
)) {
1260 /* value has changed */
1263 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1264 && update_workspace_back
1265 && scr
->flags
.backimage_helper_launched
) {
1267 /* value was not changed since last time */
1274 printf("Updating %s to %s\n", entry
->key
,
1275 WMGetPropListDescription(plvalue
, False
));
1278 if ((*entry
->convert
)(scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1280 * If the WorkspaceSpecificBack data has been changed
1281 * so that the helper will be launched now, we must be
1282 * sure to send the default background texture config
1285 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0
1286 && !scr
->flags
.backimage_helper_launched
) {
1287 update_workspace_back
= 1;
1289 if (entry
->update
) {
1291 (*entry
->update
)(scr
, entry
, tdata
, entry
->extra_data
);
1297 if (needs_refresh
!=0 && !scr
->flags
.startup
) {
1301 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1302 foo
|= WTextureSettings
;
1303 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1304 foo
|= WFontSettings
;
1305 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1306 foo
|= WColorSettings
;
1308 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1312 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1313 foo
|= WTextureSettings
;
1314 if (needs_refresh
& REFRESH_MENU_FONT
)
1315 foo
|= WFontSettings
;
1316 if (needs_refresh
& REFRESH_MENU_COLOR
)
1317 foo
|= WColorSettings
;
1319 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
,
1323 if (needs_refresh
& REFRESH_WINDOW_FONT
) {
1324 foo
|= WFontSettings
;
1326 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
) {
1327 foo
|= WTextureSettings
;
1329 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
) {
1330 foo
|= WColorSettings
;
1333 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
,
1336 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1338 if (needs_refresh
& REFRESH_ICON_FONT
) {
1339 foo
|= WFontSettings
;
1341 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
) {
1342 foo
|= WTextureSettings
;
1344 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
) {
1345 foo
|= WTextureSettings
;
1348 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1351 if (needs_refresh
& REFRESH_ICON_TILE
)
1352 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1358 wDefaultUpdateIcons(WScreen
*scr
)
1360 WAppIcon
*aicon
= scr
->app_icon_list
;
1361 WWindow
*wwin
= scr
->focused_window
;
1365 file
= wDefaultGetIconFile(scr
, aicon
->wm_instance
, aicon
->wm_class
,
1367 if ((file
&& aicon
->icon
->file
&& strcmp(file
, aicon
->icon
->file
)!=0)
1368 || (file
&& !aicon
->icon
->file
)) {
1371 if (aicon
->icon
->file
)
1372 wfree(aicon
->icon
->file
);
1373 aicon
->icon
->file
= wstrdup(file
);
1375 new_image
= wDefaultGetImage(scr
, aicon
->wm_instance
,
1378 wIconChangeImage(aicon
->icon
, new_image
);
1379 wAppIconPaint(aicon
);
1382 aicon
= aicon
->next
;
1385 if (!wPreferences
.flags
.noclip
)
1386 wClipIconPaint(scr
->clip_icon
);
1389 if (wwin
->icon
&& wwin
->flags
.miniaturized
) {
1390 file
= wDefaultGetIconFile(scr
, wwin
->wm_instance
, wwin
->wm_class
,
1392 if ((file
&& wwin
->icon
->file
&& strcmp(file
, wwin
->icon
->file
)!=0)
1393 || (file
&& !wwin
->icon
->file
)) {
1396 if (wwin
->icon
->file
)
1397 wfree(wwin
->icon
->file
);
1398 wwin
->icon
->file
= wstrdup(file
);
1400 new_image
= wDefaultGetImage(scr
, wwin
->wm_instance
,
1403 wIconChangeImage(wwin
->icon
, new_image
);
1411 /* --------------------------- Local ----------------------- */
1413 #define GET_STRING_OR_DEFAULT(x, var) if (!WMIsPLString(value)) { \
1414 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1416 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1417 var = entry->default_value;\
1418 } else var = WMGetFromPLString(value)\
1425 string2index(WMPropList
*key
, WMPropList
*val
, char *def
,
1426 WOptionEnumeration
*values
)
1429 WOptionEnumeration
*v
;
1430 char buffer
[TOTAL_VALUES_LENGTH
];
1432 if (WMIsPLString(val
) && (str
= WMGetFromPLString(val
))) {
1433 for (v
=values
; v
->string
!=NULL
; v
++) {
1434 if (strcasecmp(v
->string
, str
)==0)
1440 for (v
=values
; v
->string
!=NULL
; v
++) {
1443 strcat(buffer
, ", ");
1444 strcat(buffer
, v
->string
);
1447 wwarning(_("wrong option value for key \"%s\". Should be one of %s"),
1448 WMGetFromPLString(key
), buffer
);
1451 return string2index(key
, val
, NULL
, values
);
1461 * value - is the value in the defaults DB
1462 * addr - is the address to store the data
1463 * ret - is the address to store a pointer to a temporary buffer. ret
1464 * must not be freed and is used by the set functions
1467 getBool(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1474 GET_STRING_OR_DEFAULT("Boolean", val
);
1477 if ((val
[1]=='\0' && (val
[0]=='y' || val
[0]=='Y'))
1478 || strcasecmp(val
, "YES")==0) {
1481 } else if ((val
[1]=='\0' && (val
[0]=='n' || val
[0]=='N'))
1482 || strcasecmp(val
, "NO")==0) {
1486 if (sscanf(val
, "%i", &i
)==1) {
1492 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""),
1494 if (second_pass
==0) {
1495 val
= WMGetFromPLString(entry
->plvalue
);
1497 wwarning(_("using default \"%s\" instead"), val
);
1508 *(char*)addr
= data
;
1516 getInt(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1523 GET_STRING_OR_DEFAULT("Integer", val
);
1525 if (sscanf(val
, "%i", &data
)!=1) {
1526 wwarning(_("can't convert \"%s\" to integer for key \"%s\""),
1528 val
= WMGetFromPLString(entry
->plvalue
);
1529 wwarning(_("using default \"%s\" instead"), val
);
1530 if (sscanf(val
, "%i", &data
)!=1) {
1546 getCoord(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1550 char *val_x
, *val_y
;
1551 int nelem
, changed
=0;
1552 WMPropList
*elem_x
, *elem_y
;
1555 if (!WMIsPLArray(value
)) {
1556 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1557 entry
->key
, "Coordinate");
1559 value
= entry
->plvalue
;
1561 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1567 nelem
= WMGetPropListItemCount(value
);
1569 wwarning(_("Incorrect number of elements in array for key \"%s\"."),
1572 value
= entry
->plvalue
;
1574 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1580 elem_x
= WMGetFromPLArray(value
, 0);
1581 elem_y
= WMGetFromPLArray(value
, 1);
1583 if (!elem_x
|| !elem_y
|| !WMIsPLString(elem_x
) || !WMIsPLString(elem_y
)) {
1584 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."),
1587 value
= entry
->plvalue
;
1589 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1595 val_x
= WMGetFromPLString(elem_x
);
1596 val_y
= WMGetFromPLString(elem_y
);
1598 if (sscanf(val_x
, "%i", &data
.x
)!=1 || sscanf(val_y
, "%i", &data
.y
)!=1) {
1599 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1601 value
= entry
->plvalue
;
1603 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1611 else if (data
.x
> scr
->scr_width
/3)
1612 data
.x
= scr
->scr_width
/3;
1615 else if (data
.y
> scr
->scr_height
/3)
1616 data
.y
= scr
->scr_height
/3;
1622 *(WCoord
*)addr
= data
;
1630 /* This function is not used at the moment. */
1632 getString(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1637 GET_STRING_OR_DEFAULT("String", data
);
1640 data
= WMGetFromPLString(entry
->plvalue
);
1649 *(char**)addr
= wstrdup(data
);
1657 getPathList(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1667 if (!WMIsPLArray(value
)) {
1668 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1669 entry
->key
, "an array of paths");
1671 value
= entry
->plvalue
;
1673 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1680 count
= WMGetPropListItemCount(value
);
1683 value
= entry
->plvalue
;
1685 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1692 for (i
=0; i
<count
; i
++) {
1693 d
= WMGetFromPLArray(value
, i
);
1694 if (!d
|| !WMIsPLString(d
)) {
1698 len
+= strlen(WMGetFromPLString(d
))+1;
1701 ptr
= data
= wmalloc(len
+1);
1703 for (i
=0; i
<count
; i
++) {
1704 d
= WMGetFromPLArray(value
, i
);
1705 if (!d
|| !WMIsPLString(d
)) {
1708 strcpy(ptr
, WMGetFromPLString(d
));
1709 ptr
+= strlen(WMGetFromPLString(d
));
1713 ptr
--; *(ptr
--) = 0;
1715 if (*(char**)addr
!=NULL
) {
1716 wfree(*(char**)addr
);
1718 *(char**)addr
= data
;
1725 getEnum(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1728 static signed char data
;
1730 data
= string2index(entry
->plkey
, value
, entry
->default_value
,
1731 (WOptionEnumeration
*)entry
->extra_data
);
1739 *(signed char*)addr
= data
;
1748 * (hgradient <color> <color>)
1749 * (vgradient <color> <color>)
1750 * (dgradient <color> <color>)
1751 * (mhgradient <color> <color> ...)
1752 * (mvgradient <color> <color> ...)
1753 * (mdgradient <color> <color> ...)
1754 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1755 * (tpixmap <file> <color>)
1756 * (spixmap <file> <color>)
1757 * (cpixmap <file> <color>)
1758 * (thgradient <file> <opaqueness> <color> <color>)
1759 * (tvgradient <file> <opaqueness> <color> <color>)
1760 * (tdgradient <file> <opaqueness> <color> <color>)
1761 * (function <lib> <function> ...)
1765 parse_texture(WScreen
*scr
, WMPropList
*pl
)
1770 WTexture
*texture
=NULL
;
1772 nelem
= WMGetPropListItemCount(pl
);
1777 elem
= WMGetFromPLArray(pl
, 0);
1778 if (!elem
|| !WMIsPLString(elem
))
1780 val
= WMGetFromPLString(elem
);
1783 if (strcasecmp(val
, "solid")==0) {
1791 elem
= WMGetFromPLArray(pl
, 1);
1792 if (!elem
|| !WMIsPLString(elem
))
1794 val
= WMGetFromPLString(elem
);
1796 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1797 wwarning(_("\"%s\" is not a valid color name"), val
);
1801 texture
= (WTexture
*)wTextureMakeSolid(scr
, &color
);
1802 } else if (strcasecmp(val
, "dgradient")==0
1803 || strcasecmp(val
, "vgradient")==0
1804 || strcasecmp(val
, "hgradient")==0) {
1805 RColor color1
, color2
;
1810 wwarning(_("bad number of arguments in gradient specification"));
1814 if (val
[0]=='d' || val
[0]=='D')
1815 type
= WTEX_DGRADIENT
;
1816 else if (val
[0]=='h' || val
[0]=='H')
1817 type
= WTEX_HGRADIENT
;
1819 type
= WTEX_VGRADIENT
;
1822 /* get from color */
1823 elem
= WMGetFromPLArray(pl
, 1);
1824 if (!elem
|| !WMIsPLString(elem
))
1826 val
= WMGetFromPLString(elem
);
1828 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1829 wwarning(_("\"%s\" is not a valid color name"), val
);
1833 color1
.red
= xcolor
.red
>> 8;
1834 color1
.green
= xcolor
.green
>> 8;
1835 color1
.blue
= xcolor
.blue
>> 8;
1838 elem
= WMGetFromPLArray(pl
, 2);
1839 if (!elem
|| !WMIsPLString(elem
)) {
1842 val
= WMGetFromPLString(elem
);
1844 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1845 wwarning(_("\"%s\" is not a valid color name"), val
);
1849 color2
.red
= xcolor
.red
>> 8;
1850 color2
.green
= xcolor
.green
>> 8;
1851 color2
.blue
= xcolor
.blue
>> 8;
1853 texture
= (WTexture
*)wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1855 } else if (strcasecmp(val
, "igradient")==0) {
1856 RColor colors1
[2], colors2
[2];
1862 wwarning(_("bad number of arguments in gradient specification"));
1866 /* get from color */
1867 for (i
= 0; i
< 2; i
++) {
1868 elem
= WMGetFromPLArray(pl
, 1+i
);
1869 if (!elem
|| !WMIsPLString(elem
))
1871 val
= WMGetFromPLString(elem
);
1873 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1874 wwarning(_("\"%s\" is not a valid color name"), val
);
1877 colors1
[i
].alpha
= 255;
1878 colors1
[i
].red
= xcolor
.red
>> 8;
1879 colors1
[i
].green
= xcolor
.green
>> 8;
1880 colors1
[i
].blue
= xcolor
.blue
>> 8;
1882 elem
= WMGetFromPLArray(pl
, 3);
1883 if (!elem
|| !WMIsPLString(elem
))
1885 val
= WMGetFromPLString(elem
);
1889 /* get from color */
1890 for (i
= 0; i
< 2; i
++) {
1891 elem
= WMGetFromPLArray(pl
, 4+i
);
1892 if (!elem
|| !WMIsPLString(elem
))
1894 val
= WMGetFromPLString(elem
);
1896 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1897 wwarning(_("\"%s\" is not a valid color name"), val
);
1900 colors2
[i
].alpha
= 255;
1901 colors2
[i
].red
= xcolor
.red
>> 8;
1902 colors2
[i
].green
= xcolor
.green
>> 8;
1903 colors2
[i
].blue
= xcolor
.blue
>> 8;
1905 elem
= WMGetFromPLArray(pl
, 6);
1906 if (!elem
|| !WMIsPLString(elem
))
1908 val
= WMGetFromPLString(elem
);
1911 texture
= (WTexture
*)wTextureMakeIGradient(scr
, th1
, colors1
,
1914 } else if (strcasecmp(val
, "mhgradient")==0
1915 || strcasecmp(val
, "mvgradient")==0
1916 || strcasecmp(val
, "mdgradient")==0) {
1923 wwarning(_("too few arguments in multicolor gradient specification"));
1927 if (val
[1]=='h' || val
[1]=='H')
1928 type
= WTEX_MHGRADIENT
;
1929 else if (val
[1]=='v' || val
[1]=='V')
1930 type
= WTEX_MVGRADIENT
;
1932 type
= WTEX_MDGRADIENT
;
1936 colors
= wmalloc(sizeof(RColor
*)*(count
+1));
1938 for (i
=0; i
<count
; i
++) {
1939 elem
= WMGetFromPLArray(pl
, i
+1);
1940 if (!elem
|| !WMIsPLString(elem
)) {
1941 for (--i
; i
>=0; --i
) {
1947 val
= WMGetFromPLString(elem
);
1949 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1950 wwarning(_("\"%s\" is not a valid color name"), val
);
1951 for (--i
; i
>=0; --i
) {
1957 colors
[i
] = wmalloc(sizeof(RColor
));
1958 colors
[i
]->red
= color
.red
>> 8;
1959 colors
[i
]->green
= color
.green
>> 8;
1960 colors
[i
]->blue
= color
.blue
>> 8;
1965 texture
= (WTexture
*)wTextureMakeMGradient(scr
, type
, colors
);
1966 } else if (strcasecmp(val
, "spixmap")==0 ||
1967 strcasecmp(val
, "cpixmap")==0 ||
1968 strcasecmp(val
, "tpixmap")==0) {
1975 if (val
[0] == 's' || val
[0] == 'S')
1977 else if (val
[0] == 'c' || val
[0] == 'C')
1983 elem
= WMGetFromPLArray(pl
, 2);
1984 if (!elem
|| !WMIsPLString(elem
)) {
1987 val
= WMGetFromPLString(elem
);
1989 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1990 wwarning(_("\"%s\" is not a valid color name"), val
);
1995 elem
= WMGetFromPLArray(pl
, 1);
1996 if (!elem
|| !WMIsPLString(elem
))
1998 val
= WMGetFromPLString(elem
);
2000 texture
= (WTexture
*)wTextureMakePixmap(scr
, type
, val
, &color
);
2001 } else if (strcasecmp(val
, "thgradient")==0
2002 || strcasecmp(val
, "tvgradient")==0
2003 || strcasecmp(val
, "tdgradient")==0) {
2004 RColor color1
, color2
;
2009 if (val
[1]=='h' || val
[1]=='H')
2010 style
= WTEX_THGRADIENT
;
2011 else if (val
[1]=='v' || val
[1]=='V')
2012 style
= WTEX_TVGRADIENT
;
2014 style
= WTEX_TDGRADIENT
;
2017 wwarning(_("bad number of arguments in textured gradient specification"));
2021 /* get from color */
2022 elem
= WMGetFromPLArray(pl
, 3);
2023 if (!elem
|| !WMIsPLString(elem
))
2025 val
= WMGetFromPLString(elem
);
2027 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
2028 wwarning(_("\"%s\" is not a valid color name"), val
);
2032 color1
.red
= xcolor
.red
>> 8;
2033 color1
.green
= xcolor
.green
>> 8;
2034 color1
.blue
= xcolor
.blue
>> 8;
2037 elem
= WMGetFromPLArray(pl
, 4);
2038 if (!elem
|| !WMIsPLString(elem
)) {
2041 val
= WMGetFromPLString(elem
);
2043 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
2044 wwarning(_("\"%s\" is not a valid color name"), val
);
2048 color2
.red
= xcolor
.red
>> 8;
2049 color2
.green
= xcolor
.green
>> 8;
2050 color2
.blue
= xcolor
.blue
>> 8;
2053 elem
= WMGetFromPLArray(pl
, 2);
2054 if (!elem
|| !WMIsPLString(elem
))
2057 val
= WMGetFromPLString(elem
);
2059 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
2060 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
2065 elem
= WMGetFromPLArray(pl
, 1);
2066 if (!elem
|| !WMIsPLString(elem
))
2068 val
= WMGetFromPLString(elem
);
2070 texture
= (WTexture
*)wTextureMakeTGradient(scr
, style
, &color1
, &color2
,
2073 #ifdef TEXTURE_PLUGIN
2074 else if (strcasecmp(val
, "function")==0) {
2075 WTexFunction
*function
;
2076 void (*initFunc
) (Display
*, Colormap
);
2077 char *lib
, *func
, **argv
;
2083 /* get the library name */
2084 elem
= WMGetFromPLArray(pl
, 1);
2085 if (!elem
|| !WMIsPLString(elem
)) {
2088 lib
= WMGetFromPLString(elem
);
2090 /* get the function name */
2091 elem
= WMGetFromPLArray(pl
, 2);
2092 if (!elem
|| !WMIsPLString(elem
)) {
2095 func
= WMGetFromPLString(elem
);
2098 argv
= (char **)wmalloc(argc
* sizeof(char *));
2100 /* get the parameters */
2101 argv
[0] = wstrdup(func
);
2102 for (i
= 0; i
< argc
- 1; i
++) {
2103 elem
= WMGetFromPLArray(pl
, 3 + i
);
2104 if (!elem
|| !WMIsPLString(elem
)) {
2109 argv
[i
+1] = wstrdup(WMGetFromPLString(elem
));
2112 function
= wTextureMakeFunction(scr
, lib
, func
, argc
, argv
);
2116 initFunc
= dlsym(function
->handle
, "initWindowMaker");
2118 initFunc(dpy
, scr
->w_colormap
);
2120 wwarning(_("could not initialize library %s"), lib
);
2123 wwarning(_("could not find function %s::%s"), lib
, func
);
2125 #endif /* HAVE_DLFCN_H */
2126 texture
= (WTexture
*)function
;
2128 #endif /* TEXTURE_PLUGIN */
2130 wwarning(_("invalid texture type %s"), val
);
2139 getTexture(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2142 static WTexture
*texture
;
2146 if (!WMIsPLArray(value
)) {
2147 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2148 entry
->key
, "Texture");
2150 value
= entry
->plvalue
;
2152 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2158 if (strcmp(entry
->key
, "WidgetColor")==0 && !changed
) {
2161 pl
= WMGetFromPLArray(value
, 0);
2162 if (!pl
|| !WMIsPLString(pl
) || !WMGetFromPLString(pl
)
2163 || strcasecmp(WMGetFromPLString(pl
), "solid")!=0) {
2164 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2165 entry
->key
, "Solid Texture");
2167 value
= entry
->plvalue
;
2169 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2174 texture
= parse_texture(scr
, value
);
2177 wwarning(_("Error in texture specification for key \"%s\""),
2180 value
= entry
->plvalue
;
2182 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2192 *(WTexture
**)addr
= texture
;
2199 getWSBackground(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
2200 void *addr
, void **ret
)
2208 if (!WMIsPLArray(value
)) {
2209 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2210 "WorkspaceBack", "Texture or None");
2212 value
= entry
->plvalue
;
2214 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2220 /* only do basic error checking and verify for None texture */
2222 nelem
= WMGetPropListItemCount(value
);
2224 elem
= WMGetFromPLArray(value
, 0);
2225 if (!elem
|| !WMIsPLString(elem
)) {
2226 wwarning(_("Wrong type for workspace background. Should be a texture type."));
2228 value
= entry
->plvalue
;
2230 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2235 val
= WMGetFromPLString(elem
);
2237 if (strcasecmp(val
, "None")==0)
2240 *ret
= WMRetainPropList(value
);
2247 getWSSpecificBackground(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
2248 void *addr
, void **ret
)
2255 if (!WMIsPLArray(value
)) {
2256 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2257 "WorkspaceSpecificBack", "an array of textures");
2259 value
= entry
->plvalue
;
2261 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2267 /* only do basic error checking and verify for None texture */
2269 nelem
= WMGetPropListItemCount(value
);
2272 elem
= WMGetFromPLArray(value
, nelem
);
2273 if (!elem
|| !WMIsPLArray(elem
)) {
2274 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2280 *ret
= WMRetainPropList(value
);
2284 * Kluge to force wmsetbg helper to set the default background.
2285 * If the WorkspaceSpecificBack is changed once wmaker has started,
2286 * the WorkspaceBack won't be sent to the helper, unless the user
2287 * changes it's value too. So, we must force this by removing the
2288 * value from the defaults DB.
2290 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2291 WMPropList
*key
= WMCreatePLString("WorkspaceBack");
2293 WMRemoveFromPLDictionary(WDWindowMaker
->dictionary
, key
);
2295 WMReleasePropList(key
);
2303 getFont(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2306 static WMFont
*font
;
2309 GET_STRING_OR_DEFAULT("Font", val
);
2311 font
= WMCreateFont(scr
->wmscreen
, val
);
2313 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2316 wfatal(_("could not load any usable font!!!"));
2323 /* can't assign font value outside update function */
2324 wassertrv(addr
== NULL
, True
);
2331 getColor(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2334 static XColor color
;
2338 GET_STRING_OR_DEFAULT("Color", val
);
2342 if (!wGetColor(scr
, val
, &color
)) {
2343 wwarning(_("could not get color for key \"%s\""),
2345 if (second_pass
==0) {
2346 val
= WMGetFromPLString(entry
->plvalue
);
2348 wwarning(_("using default \"%s\" instead"), val
);
2360 *(unsigned long*)addr = pixel;
2369 getKeybind(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2372 static WShortKey shortcut
;
2379 GET_STRING_OR_DEFAULT("Key spec", val
);
2381 if (!val
|| strcasecmp(val
, "NONE")==0) {
2382 shortcut
.keycode
= 0;
2383 shortcut
.modifier
= 0;
2394 shortcut
.modifier
= 0;
2395 while ((k
= strchr(b
, '+'))!=NULL
) {
2399 mod
= wXModifierFromKey(b
);
2401 wwarning(_("%s:invalid key modifier \"%s\""), entry
->key
, b
);
2404 shortcut
.modifier
|= mod
;
2410 ksym
= XStringToKeysym(b
);
2412 if (ksym
==NoSymbol
) {
2413 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
,
2418 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2419 if (shortcut
.keycode
==0) {
2420 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2432 getModMask(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2435 static unsigned int mask
;
2438 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2443 mask
= wXModifierFromKey(str
);
2445 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2451 *(unsigned int*)addr
= mask
;
2462 getRImages(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
2463 void *addr
, void **ret
)
2471 GET_STRING_OR_DEFAULT("Image File Path", str
);
2475 image
= RLoadImage(scr
->rcontext
, str
, 0);
2477 wwarning(_("could not load image in option %s: %s"), entry
->key
,
2478 RMessageForError(RErrorCode
));
2482 if (*(RImage
**)addr
) {
2483 RReleaseImage(*(RImage
**)addr
);
2486 *(RImage
**)addr
= image
;
2488 assert(ret
== NULL
);
2491 *(RImage**)ret = image;
2498 # include <X11/cursorfont.h>
2505 #define CURSOR_ID_NONE (XC_num_glyphs)
2507 static WCursorLookup cursor_table
[] =
2509 { "X_cursor", XC_X_cursor
},
2510 { "arrow", XC_arrow
},
2511 { "based_arrow_down", XC_based_arrow_down
},
2512 { "based_arrow_up", XC_based_arrow_up
},
2513 { "boat", XC_boat
},
2514 { "bogosity", XC_bogosity
},
2515 { "bottom_left_corner", XC_bottom_left_corner
},
2516 { "bottom_right_corner", XC_bottom_right_corner
},
2517 { "bottom_side", XC_bottom_side
},
2518 { "bottom_tee", XC_bottom_tee
},
2519 { "box_spiral", XC_box_spiral
},
2520 { "center_ptr", XC_center_ptr
},
2521 { "circle", XC_circle
},
2522 { "clock", XC_clock
},
2523 { "coffee_mug", XC_coffee_mug
},
2524 { "cross", XC_cross
},
2525 { "cross_reverse", XC_cross_reverse
},
2526 { "crosshair", XC_crosshair
},
2527 { "diamond_cross", XC_diamond_cross
},
2529 { "dotbox", XC_dotbox
},
2530 { "double_arrow", XC_double_arrow
},
2531 { "draft_large", XC_draft_large
},
2532 { "draft_small", XC_draft_small
},
2533 { "draped_box", XC_draped_box
},
2534 { "exchange", XC_exchange
},
2535 { "fleur", XC_fleur
},
2536 { "gobbler", XC_gobbler
},
2537 { "gumby", XC_gumby
},
2538 { "hand1", XC_hand1
},
2539 { "hand2", XC_hand2
},
2540 { "heart", XC_heart
},
2541 { "icon", XC_icon
},
2542 { "iron_cross", XC_iron_cross
},
2543 { "left_ptr", XC_left_ptr
},
2544 { "left_side", XC_left_side
},
2545 { "left_tee", XC_left_tee
},
2546 { "leftbutton", XC_leftbutton
},
2547 { "ll_angle", XC_ll_angle
},
2548 { "lr_angle", XC_lr_angle
},
2550 { "middlebutton", XC_middlebutton
},
2551 { "mouse", XC_mouse
},
2552 { "pencil", XC_pencil
},
2553 { "pirate", XC_pirate
},
2554 { "plus", XC_plus
},
2555 { "question_arrow", XC_question_arrow
},
2556 { "right_ptr", XC_right_ptr
},
2557 { "right_side", XC_right_side
},
2558 { "right_tee", XC_right_tee
},
2559 { "rightbutton", XC_rightbutton
},
2560 { "rtl_logo", XC_rtl_logo
},
2561 { "sailboat", XC_sailboat
},
2562 { "sb_down_arrow", XC_sb_down_arrow
},
2563 { "sb_h_double_arrow", XC_sb_h_double_arrow
},
2564 { "sb_left_arrow", XC_sb_left_arrow
},
2565 { "sb_right_arrow", XC_sb_right_arrow
},
2566 { "sb_up_arrow", XC_sb_up_arrow
},
2567 { "sb_v_double_arrow", XC_sb_v_double_arrow
},
2568 { "shuttle", XC_shuttle
},
2569 { "sizing", XC_sizing
},
2570 { "spider", XC_spider
},
2571 { "spraycan", XC_spraycan
},
2572 { "star", XC_star
},
2573 { "target", XC_target
},
2574 { "tcross", XC_tcross
},
2575 { "top_left_arrow", XC_top_left_arrow
},
2576 { "top_left_corner", XC_top_left_corner
},
2577 { "top_right_corner", XC_top_right_corner
},
2578 { "top_side", XC_top_side
},
2579 { "top_tee", XC_top_tee
},
2580 { "trek", XC_trek
},
2581 { "ul_angle", XC_ul_angle
},
2582 { "umbrella", XC_umbrella
},
2583 { "ur_angle", XC_ur_angle
},
2584 { "watch", XC_watch
},
2585 { "xterm", XC_xterm
},
2586 { NULL
, CURSOR_ID_NONE
}
2590 check_bitmap_status(int status
, char *filename
, Pixmap bitmap
)
2593 case BitmapOpenFailed
:
2594 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2596 case BitmapFileInvalid
:
2597 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2599 case BitmapNoMemory
:
2600 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2603 XFreePixmap(dpy
, bitmap
);
2610 * (builtin, <cursor_name>)
2611 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2614 parse_cursor(WScreen
*scr
, WMPropList
*pl
, Cursor
*cursor
)
2621 nelem
= WMGetPropListItemCount(pl
);
2625 elem
= WMGetFromPLArray(pl
, 0);
2626 if (!elem
|| !WMIsPLString(elem
)) {
2629 val
= WMGetFromPLString(elem
);
2631 if (0 == strcasecmp(val
, "none")) {
2634 } else if (0 == strcasecmp(val
, "builtin")) {
2636 int cursor_id
= CURSOR_ID_NONE
;
2639 wwarning(_("bad number of arguments in cursor specification"));
2642 elem
= WMGetFromPLArray(pl
, 1);
2643 if (!elem
|| !WMIsPLString(elem
)) {
2646 val
= WMGetFromPLString(elem
);
2648 for (i
= 0; NULL
!= cursor_table
[i
].name
; i
++) {
2649 if (0 == strcasecmp(val
, cursor_table
[i
].name
)) {
2650 cursor_id
= cursor_table
[i
].id
;
2654 if (CURSOR_ID_NONE
== cursor_id
) {
2655 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2657 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2660 } else if (0 == strcasecmp(val
, "bitmap")) {
2672 wwarning(_("bad number of arguments in cursor specification"));
2675 elem
= WMGetFromPLArray(pl
, 1);
2676 if (!elem
|| !WMIsPLString(elem
)) {
2679 val
= WMGetFromPLString(elem
);
2680 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2682 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2685 elem
= WMGetFromPLArray(pl
, 2);
2686 if (!elem
|| !WMIsPLString(elem
)) {
2690 val
= WMGetFromPLString(elem
);
2691 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2694 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2697 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
,
2699 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
,
2701 if ((BitmapSuccess
== bitmap_status
) &&
2702 (BitmapSuccess
== mask_status
)) {
2703 fg
.pixel
= scr
->black_pixel
;
2704 bg
.pixel
= scr
->white_pixel
;
2705 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2706 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2707 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2710 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2711 check_bitmap_status(mask_status
, mask_name
, mask
);
2720 getCursor(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2723 static Cursor cursor
;
2728 if (!WMIsPLArray(value
)) {
2729 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2730 entry
->key
, "cursor specification");
2732 value
= entry
->plvalue
;
2734 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2739 status
= parse_cursor(scr
, value
, &cursor
);
2741 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2743 value
= entry
->plvalue
;
2745 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2754 *(Cursor
*)addr
= cursor
;
2758 #undef CURSOR_ID_NONE
2761 /* ---------------- value setting functions --------------- */
2763 setJustify(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
2765 return REFRESH_WINDOW_TITLE_COLOR
;
2769 setClearance(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
2771 return REFRESH_WINDOW_FONT
|REFRESH_BUTTON_IMAGES
|REFRESH_MENU_TITLE_FONT
|REFRESH_MENU_FONT
;
2775 setIfDockPresent(WScreen
*scr
, WDefaultEntry
*entry
, char *flag
, long which
)
2779 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2782 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2792 setStickyIcons(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
2794 if (scr
->workspaces
) {
2795 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2796 wArrangeIcons(scr
, False
);
2803 setPositive(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
2815 setIconTile(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
2821 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2822 wPreferences
.icon_size
,
2823 ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2824 ? WREL_ICON
: WREL_FLAT
);
2826 wwarning(_("could not render texture for icon background"));
2828 wTextureDestroy(scr
, *texture
);
2831 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2833 if (scr
->icon_tile
) {
2835 RReleaseImage(scr
->icon_tile
);
2836 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2839 scr
->icon_tile
= img
;
2842 /* put the icon in the noticeboard hint */
2843 PropSetIconTileHint(scr
, img
);
2846 if (!wPreferences
.flags
.noclip
) {
2847 if (scr
->clip_tile
) {
2848 RReleaseImage(scr
->clip_tile
);
2850 scr
->clip_tile
= wClipMakeTile(scr
, img
);
2853 scr
->icon_tile_pixmap
= pixmap
;
2855 if (scr
->def_icon_pixmap
) {
2856 XFreePixmap(dpy
, scr
->def_icon_pixmap
);
2857 scr
->def_icon_pixmap
= None
;
2859 if (scr
->def_ticon_pixmap
) {
2860 XFreePixmap(dpy
, scr
->def_ticon_pixmap
);
2861 scr
->def_ticon_pixmap
= None
;
2864 if (scr
->icon_back_texture
) {
2865 wTextureDestroy(scr
, (WTexture
*)scr
->icon_back_texture
);
2867 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2869 if (scr
->clip_balloon
)
2870 XSetWindowBackground(dpy
, scr
->clip_balloon
,
2871 (*texture
)->any
.color
.pixel
);
2874 * Free the texture as nobody else will use it, nor refer to it.
2877 wTextureDestroy(scr
, *texture
);
2879 return (reset
? REFRESH_ICON_TILE
: 0);
2885 setWinTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2887 if (scr
->title_font
) {
2888 WMReleaseFont(scr
->title_font
);
2890 scr
->title_font
= font
;
2892 return REFRESH_WINDOW_FONT
|REFRESH_BUTTON_IMAGES
;
2897 setMenuTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2899 if (scr
->menu_title_font
) {
2900 WMReleaseFont(scr
->menu_title_font
);
2903 scr
->menu_title_font
= font
;
2905 return REFRESH_MENU_TITLE_FONT
;
2910 setMenuTextFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2912 if (scr
->menu_entry_font
) {
2913 WMReleaseFont(scr
->menu_entry_font
);
2915 scr
->menu_entry_font
= font
;
2917 return REFRESH_MENU_FONT
;
2923 setIconTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2925 if (scr
->icon_title_font
) {
2926 WMReleaseFont(scr
->icon_title_font
);
2929 scr
->icon_title_font
= font
;
2931 return REFRESH_ICON_FONT
;
2936 setClipTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2938 if (scr
->clip_title_font
) {
2939 WMReleaseFont(scr
->clip_title_font
);
2942 scr
->clip_title_font
= font
;
2944 return REFRESH_ICON_FONT
;
2949 setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2951 if (scr
->workspace_name_font
) {
2952 WMReleaseFont(scr
->workspace_name_font
);
2955 scr
->workspace_name_font
= font
;
2962 setHightlight(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
2964 if (scr
->select_pixel
!=scr
->white_pixel
&&
2965 scr
->select_pixel
!=scr
->black_pixel
) {
2966 wFreeColor(scr
, scr
->select_pixel
);
2969 scr
->select_pixel
= color
->pixel
;
2971 return REFRESH_MENU_COLOR
;
2976 setHightlightText(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
2978 if (scr
->select_text_pixel
!=scr
->white_pixel
&&
2979 scr
->select_text_pixel
!=scr
->black_pixel
) {
2980 wFreeColor(scr
, scr
->select_text_pixel
);
2983 scr
->select_text_pixel
= color
->pixel
;
2985 return REFRESH_MENU_COLOR
;
2990 setClipTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
2992 if (scr
->clip_title_pixel
[index
]!=scr
->white_pixel
&&
2993 scr
->clip_title_pixel
[index
]!=scr
->black_pixel
) {
2994 wFreeColor(scr
, scr
->clip_title_pixel
[index
]);
2996 scr
->clip_title_pixel
[index
] = color
->pixel
;
2998 #ifdef GRADIENT_CLIP_ARROW
2999 if (index
== CLIP_NORMAL
) {
3001 RColor color1
, color2
;
3002 int pt
= CLIP_BUTTON_SIZE
*wPreferences
.icon_size
/64;
3003 int as
= pt
- 15; /* 15 = 5+5+5 */
3005 FREE_PIXMAP(scr
->clip_arrow_gradient
);
3007 color1
.red
= (color
->red
>> 8)*6/10;
3008 color1
.green
= (color
->green
>> 8)*6/10;
3009 color1
.blue
= (color
->blue
>> 8)*6/10;
3011 color2
.red
= WMIN((color
->red
>> 8)*20/10, 255);
3012 color2
.green
= WMIN((color
->green
>> 8)*20/10, 255);
3013 color2
.blue
= WMIN((color
->blue
>> 8)*20/10, 255);
3015 image
= RRenderGradient(as
+1, as
+1, &color1
, &color2
, RDiagonalGradient
);
3016 RConvertImage(scr
->rcontext
, image
, &scr
->clip_arrow_gradient
);
3017 RReleaseImage(image
);
3019 #endif /* GRADIENT_CLIP_ARROW */
3021 return REFRESH_ICON_TITLE_COLOR
;
3026 setWTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3028 if (scr
->window_title_pixel
[index
]!=scr
->white_pixel
&&
3029 scr
->window_title_pixel
[index
]!=scr
->black_pixel
) {
3030 wFreeColor(scr
, scr
->window_title_pixel
[index
]);
3033 scr
->window_title_pixel
[index
] = color
->pixel
;
3035 if (index
== WS_UNFOCUSED
)
3036 XSetForeground(dpy
, scr
->info_text_gc
, color
->pixel
);
3038 return REFRESH_WINDOW_TITLE_COLOR
;
3043 setMenuTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3045 if (scr
->menu_title_pixel
[0]!=scr
->white_pixel
&&
3046 scr
->menu_title_pixel
[0]!=scr
->black_pixel
) {
3047 wFreeColor(scr
, scr
->menu_title_pixel
[0]);
3050 scr
->menu_title_pixel
[0] = color
->pixel
;
3051 XSetForeground(dpy
, scr
->menu_title_gc
, color
->pixel
);
3053 return REFRESH_MENU_TITLE_COLOR
;
3058 setMenuTextColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3061 #define gcm (GCForeground|GCBackground|GCFillStyle)
3063 if (scr
->mtext_pixel
!=scr
->white_pixel
&&
3064 scr
->mtext_pixel
!=scr
->black_pixel
) {
3065 wFreeColor(scr
, scr
->mtext_pixel
);
3068 scr
->mtext_pixel
= color
->pixel
;
3070 XSetForeground(dpy
, scr
->menu_entry_gc
, color
->pixel
);
3073 if (scr
->dtext_pixel
== scr
->mtext_pixel
) {
3074 gcv
.foreground
= scr
->white_pixel
;
3075 gcv
.background
= scr
->black_pixel
;
3076 gcv
.fill_style
= FillStippled
;
3078 gcv
.foreground
= scr
->dtext_pixel
;
3079 gcv
.fill_style
= FillSolid
;
3081 XChangeGC(dpy
, scr
->disabled_menu_entry_gc
, gcm
, &gcv
);
3083 return REFRESH_MENU_COLOR
;
3089 setMenuDisabledColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3092 #define gcm (GCForeground|GCBackground|GCFillStyle)
3094 if (scr
->dtext_pixel
!=scr
->white_pixel
&&
3095 scr
->dtext_pixel
!=scr
->black_pixel
) {
3096 wFreeColor(scr
, scr
->dtext_pixel
);
3099 scr
->dtext_pixel
= color
->pixel
;
3101 if (scr
->dtext_pixel
== scr
->mtext_pixel
) {
3102 gcv
.foreground
= scr
->white_pixel
;
3103 gcv
.background
= scr
->black_pixel
;
3104 gcv
.fill_style
= FillStippled
;
3106 gcv
.foreground
= scr
->dtext_pixel
;
3107 gcv
.fill_style
= FillSolid
;
3109 XChangeGC(dpy
, scr
->disabled_menu_entry_gc
, gcm
, &gcv
);
3111 return REFRESH_MENU_COLOR
;
3116 setIconTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3118 XSetForeground(dpy
, scr
->icon_title_gc
, color
->pixel
);
3120 return REFRESH_ICON_TITLE_COLOR
;
3125 setIconTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3127 if (scr
->icon_title_texture
) {
3128 wTextureDestroy(scr
, (WTexture
*)scr
->icon_title_texture
);
3130 XQueryColor (dpy
, scr
->w_colormap
, color
);
3131 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
3133 return REFRESH_ICON_TITLE_BACK
;
3138 trackDeadProcess(pid_t pid
, unsigned char status
, WScreen
*scr
)
3140 close(scr
->helper_fd
);
3142 scr
->helper_pid
= 0;
3143 scr
->flags
.backimage_helper_launched
= 0;
3148 setWorkspaceSpecificBack(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
3155 if (scr
->flags
.backimage_helper_launched
) {
3156 if (WMGetPropListItemCount(value
)==0) {
3157 SendHelperMessage(scr
, 'C', 0, NULL
);
3158 SendHelperMessage(scr
, 'K', 0, NULL
);
3160 WMReleasePropList(value
);
3167 if (WMGetPropListItemCount(value
) == 0)
3170 if (pipe(filedes
) < 0) {
3171 wsyserror("pipe() failed:can't set workspace specific background image");
3173 WMReleasePropList(value
);
3179 wsyserror("fork() failed:can't set workspace specific background image");
3180 if (close(filedes
[0]) < 0)
3181 wsyserror("could not close pipe");
3182 if (close(filedes
[1]) < 0)
3183 wsyserror("could not close pipe");
3185 } else if (pid
== 0) {
3188 SetupEnvironment(scr
);
3191 wsyserror("could not close pipe");
3192 if (dup(filedes
[0]) < 0) {
3193 wsyserror("dup() failed:can't set workspace specific background image");
3195 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3196 if (wPreferences
.smooth_workspace_back
)
3197 execlp("wmsetbg", "wmsetbg", "-helper", "-S", dither
, NULL
);
3199 execlp("wmsetbg", "wmsetbg", "-helper", dither
, NULL
);
3200 wsyserror("could not execute wmsetbg");
3204 if (fcntl(filedes
[0], F_SETFD
, FD_CLOEXEC
) < 0) {
3205 wsyserror("error setting close-on-exec flag");
3207 if (fcntl(filedes
[1], F_SETFD
, FD_CLOEXEC
) < 0) {
3208 wsyserror("error setting close-on-exec flag");
3211 scr
->helper_fd
= filedes
[1];
3212 scr
->helper_pid
= pid
;
3213 scr
->flags
.backimage_helper_launched
= 1;
3215 wAddDeathHandler(pid
, (WDeathHandler
*)trackDeadProcess
, scr
);
3217 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3222 for (i
= 0; i
< WMGetPropListItemCount(value
); i
++) {
3223 val
= WMGetFromPLArray(value
, i
);
3224 if (val
&& WMIsPLArray(val
) && WMGetPropListItemCount(val
)>0) {
3225 str
= WMGetPropListDescription(val
, False
);
3227 SendHelperMessage(scr
, 'S', i
+1, str
);
3231 SendHelperMessage(scr
, 'U', i
+1, NULL
);
3236 WMReleasePropList(value
);
3242 setWorkspaceBack(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
3245 if (scr
->flags
.backimage_helper_launched
) {
3248 if (WMGetPropListItemCount(value
)==0) {
3249 SendHelperMessage(scr
, 'U', 0, NULL
);
3251 /* set the default workspace background to this one */
3252 str
= WMGetPropListDescription(value
, False
);
3254 SendHelperMessage(scr
, 'S', 0, str
);
3256 SendHelperMessage(scr
, 'C', scr
->current_workspace
+1, NULL
);
3258 SendHelperMessage(scr
, 'U', 0, NULL
);
3261 } else if (WMGetPropListItemCount(value
) > 0) {
3267 SetupEnvironment(scr
);
3268 text
= WMGetPropListDescription(value
, False
);
3269 len
= strlen(text
)+40;
3270 command
= wmalloc(len
);
3271 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3272 if (wPreferences
.smooth_workspace_back
)
3273 snprintf(command
, len
, "wmsetbg %s -S -p '%s' &", dither
, text
);
3275 snprintf(command
, len
, "wmsetbg %s -p '%s' &", dither
, text
);
3280 WMReleasePropList(value
);
3287 setWidgetColor(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3289 if (scr
->widget_texture
) {
3290 wTextureDestroy(scr
, (WTexture
*)scr
->widget_texture
);
3292 scr
->widget_texture
= *(WTexSolid
**)texture
;
3299 setFTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3301 if (scr
->window_title_texture
[WS_FOCUSED
]) {
3302 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3304 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3306 return REFRESH_WINDOW_TEXTURES
;
3311 setPTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3313 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
3314 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3316 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3318 return REFRESH_WINDOW_TEXTURES
;
3323 setUTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3325 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
3326 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3328 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3330 return REFRESH_WINDOW_TEXTURES
;
3335 setResizebarBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3337 if (scr
->resizebar_texture
[0]) {
3338 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3340 scr
->resizebar_texture
[0] = *texture
;
3342 return REFRESH_WINDOW_TEXTURES
;
3347 setMenuTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3349 if (scr
->menu_title_texture
[0]) {
3350 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3352 scr
->menu_title_texture
[0] = *texture
;
3354 return REFRESH_MENU_TITLE_TEXTURE
;
3359 setMenuTextBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3361 if (scr
->menu_item_texture
) {
3362 wTextureDestroy(scr
, scr
->menu_item_texture
);
3363 wTextureDestroy(scr
, (WTexture
*)scr
->menu_item_auxtexture
);
3365 scr
->menu_item_texture
= *texture
;
3367 scr
->menu_item_auxtexture
3368 = wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3370 return REFRESH_MENU_TEXTURE
;
3375 setKeyGrab(WScreen
*scr
, WDefaultEntry
*entry
, WShortKey
*shortcut
, long index
)
3378 wKeyBindings
[index
] = *shortcut
;
3380 wwin
= scr
->focused_window
;
3382 while (wwin
!=NULL
) {
3383 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3385 if (!WFLAGP(wwin
, no_bind_keys
)) {
3386 wWindowSetKeyGrabs(wwin
);
3396 setIconPosition(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
3398 wArrangeIcons(scr
, True
);
3405 updateUsableArea(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
3407 wScreenUpdateUsableArea(scr
);
3414 setMenuStyle(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
3416 return REFRESH_MENU_TEXTURE
;
3422 setButtonImages(WScreen *scr, WDefaultEntry *entry, int *value, void *foo)
3424 return REFRESH_BUTTON_IMAGES;
3430 * Need access to the double click variables, so that all widgets in
3431 * wmaker panels will have the same dbl-click values.
3432 * TODO: figure a better way of dealing with it.
3434 #include <WINGs/WINGsP.h>
3437 setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
3439 extern _WINGsConfiguration WINGsConfiguration
;
3444 WINGsConfiguration
.doubleClickDelay
= *value
;
3452 setMultiByte(WScreen
*scr
, WDefaultEntry
*entry
, char *value
, void *foo
)
3454 extern _WINGsConfiguration WINGsConfiguration
;
3456 WINGsConfiguration
.useMultiByte
= *value
;
3464 setCursor(WScreen
*scr
, WDefaultEntry
*entry
, Cursor
*cursor
, long index
)
3466 if (wCursor
[index
] != None
) {
3467 XFreeCursor(dpy
, wCursor
[index
]);
3470 wCursor
[index
] = *cursor
;
3472 if (index
==WCUR_ROOT
&& *cursor
!=None
) {
3473 XDefineCursor(dpy
, scr
->root_win
, *cursor
);