1 /* defaults.c - manage configuration through defaults db
3 * Window Maker window manager
5 * Copyright (c) 1997, 1998 Alfredo K. Kojima
6 * Copyright (c) 1998 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 {"MoveResizeKey", "None", (void*)WKBD_MOVERESIZE
,
685 NULL
, getKeybind
, setKeyGrab
687 {"CloseKey", "None", (void*)WKBD_CLOSE
,
688 NULL
, getKeybind
, setKeyGrab
690 {"MaximizeKey", "None", (void*)WKBD_MAXIMIZE
,
691 NULL
, getKeybind
, setKeyGrab
693 {"VMaximizeKey", "None", (void*)WKBD_VMAXIMIZE
,
694 NULL
, getKeybind
, setKeyGrab
696 {"HMaximizeKey", "None", (void*)WKBD_HMAXIMIZE
,
697 NULL
, getKeybind
, setKeyGrab
699 {"RaiseKey", "\"Meta+Up\"", (void*)WKBD_RAISE
,
700 NULL
, getKeybind
, setKeyGrab
702 {"LowerKey", "\"Meta+Down\"", (void*)WKBD_LOWER
,
703 NULL
, getKeybind
, setKeyGrab
705 {"RaiseLowerKey", "None", (void*)WKBD_RAISELOWER
,
706 NULL
, getKeybind
, setKeyGrab
708 {"ShadeKey", "None", (void*)WKBD_SHADE
,
709 NULL
, getKeybind
, setKeyGrab
711 {"SelectKey", "None", (void*)WKBD_SELECT
,
712 NULL
, getKeybind
, setKeyGrab
714 {"FocusNextKey", "None", (void*)WKBD_FOCUSNEXT
,
715 NULL
, getKeybind
, setKeyGrab
717 {"FocusPrevKey", "None", (void*)WKBD_FOCUSPREV
,
718 NULL
, getKeybind
, setKeyGrab
720 {"NextWorkspaceKey", "None", (void*)WKBD_NEXTWORKSPACE
,
721 NULL
, getKeybind
, setKeyGrab
723 {"PrevWorkspaceKey", "None", (void*)WKBD_PREVWORKSPACE
,
724 NULL
, getKeybind
, setKeyGrab
726 {"NextWorkspaceLayerKey", "None", (void*)WKBD_NEXTWSLAYER
,
727 NULL
, getKeybind
, setKeyGrab
729 {"PrevWorkspaceLayerKey", "None", (void*)WKBD_PREVWSLAYER
,
730 NULL
, getKeybind
, setKeyGrab
732 {"Workspace1Key", "None", (void*)WKBD_WORKSPACE1
,
733 NULL
, getKeybind
, setKeyGrab
735 {"Workspace2Key", "None", (void*)WKBD_WORKSPACE2
,
736 NULL
, getKeybind
, setKeyGrab
738 {"Workspace3Key", "None", (void*)WKBD_WORKSPACE3
,
739 NULL
, getKeybind
, setKeyGrab
741 {"Workspace4Key", "None", (void*)WKBD_WORKSPACE4
,
742 NULL
, getKeybind
, setKeyGrab
744 {"Workspace5Key", "None", (void*)WKBD_WORKSPACE5
,
745 NULL
, getKeybind
, setKeyGrab
747 {"Workspace6Key", "None", (void*)WKBD_WORKSPACE6
,
748 NULL
, getKeybind
, setKeyGrab
750 {"Workspace7Key", "None", (void*)WKBD_WORKSPACE7
,
751 NULL
, getKeybind
, setKeyGrab
753 {"Workspace8Key", "None", (void*)WKBD_WORKSPACE8
,
754 NULL
, getKeybind
, setKeyGrab
756 {"Workspace9Key", "None", (void*)WKBD_WORKSPACE9
,
757 NULL
, getKeybind
, setKeyGrab
759 {"Workspace10Key", "None", (void*)WKBD_WORKSPACE10
,
760 NULL
, getKeybind
, setKeyGrab
762 {"WindowShortcut1Key","None", (void*)WKBD_WINDOW1
,
763 NULL
, getKeybind
, setKeyGrab
765 {"WindowShortcut2Key","None", (void*)WKBD_WINDOW2
,
766 NULL
, getKeybind
, setKeyGrab
768 {"WindowShortcut3Key","None", (void*)WKBD_WINDOW3
,
769 NULL
, getKeybind
, setKeyGrab
771 {"WindowShortcut4Key","None", (void*)WKBD_WINDOW4
,
772 NULL
, getKeybind
, setKeyGrab
774 ,{"WindowShortcut5Key","None", (void*)WKBD_WINDOW5
,
775 NULL
, getKeybind
, setKeyGrab
777 {"WindowShortcut6Key","None", (void*)WKBD_WINDOW6
,
778 NULL
, getKeybind
, setKeyGrab
780 {"WindowShortcut7Key","None", (void*)WKBD_WINDOW7
,
781 NULL
, getKeybind
, setKeyGrab
783 {"WindowShortcut8Key","None", (void*)WKBD_WINDOW8
,
784 NULL
, getKeybind
, setKeyGrab
786 {"WindowShortcut9Key","None", (void*)WKBD_WINDOW9
,
787 NULL
, getKeybind
, setKeyGrab
789 {"WindowShortcut10Key","None", (void*)WKBD_WINDOW10
,
790 NULL
, getKeybind
, setKeyGrab
792 {"ScreenSwitchKey", "None", (void*)WKBD_SWITCH_SCREEN
,
793 NULL
, getKeybind
, setKeyGrab
796 #ifdef KEEP_XKB_LOCK_STATUS
797 ,{"ToggleKbdModeKey", "None", (void*)WKBD_TOGGLE
,
798 NULL
, getKeybind
, setKeyGrab
800 {"KbdModeLock", "NO", NULL
,
801 &wPreferences
.modelock
, getBool
, NULL
803 #endif /* KEEP_XKB_LOCK_STATUS */
805 ,{"NormalCursor", "(builtin, left_ptr)", (void*)WCUR_ROOT
,
806 NULL
, getCursor
, setCursor
808 {"ArrowCursor", "(builtin, top_left_arrow)", (void*)WCUR_ARROW
,
809 NULL
, getCursor
, setCursor
811 {"MoveCursor", "(builtin, fleur)", (void*)WCUR_MOVE
,
812 NULL
, getCursor
, setCursor
814 {"ResizeCursor", "(builtin, sizing)", (void*)WCUR_RESIZE
,
815 NULL
, getCursor
, setCursor
817 {"TopLeftResizeCursor", "(builtin, top_left_corner)",
818 (void*)WCUR_TOPLEFTRESIZE
,
819 NULL
, getCursor
, setCursor
821 {"TopRightResizeCursor", "(builtin, top_right_corner)",
822 (void*)WCUR_TOPRIGHTRESIZE
,
823 NULL
, getCursor
, setCursor
825 {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)",
826 (void*)WCUR_BOTTOMLEFTRESIZE
,
827 NULL
, getCursor
, setCursor
829 {"BottomRightResizeCursor", "(builtin, bottom_right_corner)",
830 (void*)WCUR_BOTTOMRIGHTRESIZE
,
831 NULL
, getCursor
, setCursor
833 {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)",
834 (void*)WCUR_VERTICALRESIZE
,
835 NULL
, getCursor
, setCursor
837 {"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)",
838 (void*)WCUR_HORIZONRESIZE
,
839 NULL
, getCursor
, setCursor
841 {"WaitCursor", "(builtin, watch)", (void*)WCUR_WAIT
,
842 NULL
, getCursor
, setCursor
844 {"QuestionCursor", "(builtin, question_arrow)", (void*)WCUR_QUESTION
,
845 NULL
, getCursor
, setCursor
847 {"TextCursor", "(builtin, xterm)", (void*)WCUR_TEXT
,
848 NULL
, getCursor
, setCursor
850 {"SelectCursor", "(builtin, cross)", (void*)WCUR_SELECT
,
851 NULL
, getCursor
, setCursor
857 static void rereadDefaults(void);
864 /* must defer the update because accessing X data from a
865 * signal handler can mess up Xlib */
874 WDefaultEntry
*entry
;
876 WMPLSetCaseSensitive(False
);
878 for (i
=0; i
<sizeof(optionList
)/sizeof(WDefaultEntry
); i
++) {
879 entry
= &optionList
[i
];
881 entry
->plkey
= WMCreatePLString(entry
->key
);
882 if (entry
->default_value
)
883 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
885 entry
->plvalue
= NULL
;
888 for (i
=0; i
<sizeof(staticOptionList
)/sizeof(WDefaultEntry
); i
++) {
889 entry
= &staticOptionList
[i
];
891 entry
->plkey
= WMCreatePLString(entry
->key
);
892 if (entry
->default_value
)
893 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
895 entry
->plvalue
= NULL
;
899 wDomainName = WMCreatePLString(WMDOMAIN_NAME);
900 wAttributeDomainName = WMCreatePLString(WMATTRIBUTE_DOMAIN_NAME);
902 PLRegister(wDomainName, rereadDefaults);
903 PLRegister(wAttributeDomainName, rereadDefaults);
912 wDefaultsInit(int screen_number
)
914 static int defaults_inited
= 0;
917 if (!defaults_inited
) {
921 dict
= PLGetDomain(wDomainName
);
923 wwarning(_("could not read domain \"%s\" from defaults database"),
924 WMGetFromPLString(wDomainName
));
933 wDefaultsDestroyDomain(WDDomain
*domain
)
935 if (domain
->dictionary
)
936 WMReleasePropList(domain
->dictionary
);
943 wDefaultsInitDomain(char *domain
, Bool requireDictionary
)
947 static int inited
= 0;
950 WMPropList
*shared_dict
=NULL
;
957 db
= wmalloc(sizeof(WDDomain
));
958 memset(db
, 0, sizeof(WDDomain
));
959 db
->domain_name
= domain
;
960 db
->path
= wdefaultspathfordomain(domain
);
963 if (the_path
&& stat(the_path
, &stbuf
)>=0) {
964 db
->dictionary
= WMReadPropListFromFile(the_path
);
965 if (db
->dictionary
) {
966 if (requireDictionary
&& !WMIsPLDictionary(db
->dictionary
)) {
967 WMReleasePropList(db
->dictionary
);
968 db
->dictionary
= NULL
;
969 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
972 db
->timestamp
= stbuf
.st_mtime
;
974 wwarning(_("could not load domain %s from user defaults database"),
979 /* global system dictionary */
980 snprintf(path
, sizeof(path
), "%s/WindowMaker/%s", SYSCONFDIR
, domain
);
981 if (stat(path
, &stbuf
)>=0) {
982 shared_dict
= WMReadPropListFromFile(path
);
984 if (requireDictionary
&& !WMIsPLDictionary(shared_dict
)) {
985 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
987 WMReleasePropList(shared_dict
);
990 if (db
->dictionary
&& WMIsPLDictionary(shared_dict
) &&
991 WMIsPLDictionary(db
->dictionary
)) {
992 WMMergePLDictionaries(shared_dict
, db
->dictionary
, True
);
993 WMReleasePropList(db
->dictionary
);
994 db
->dictionary
= shared_dict
;
995 if (stbuf
.st_mtime
> db
->timestamp
)
996 db
->timestamp
= stbuf
.st_mtime
;
997 } else if (!db
->dictionary
) {
998 db
->dictionary
= shared_dict
;
999 if (stbuf
.st_mtime
> db
->timestamp
)
1000 db
->timestamp
= stbuf
.st_mtime
;
1004 wwarning(_("could not load domain %s from global defaults database (%s)"),
1014 wReadStaticDefaults(WMPropList
*dict
)
1016 WMPropList
*plvalue
;
1017 WDefaultEntry
*entry
;
1022 for (i
=0; i
<sizeof(staticOptionList
)/sizeof(WDefaultEntry
); i
++) {
1023 entry
= &staticOptionList
[i
];
1026 plvalue
= WMGetFromPLDictionary(dict
, entry
->plkey
);
1031 /* no default in the DB. Use builtin default */
1032 plvalue
= entry
->plvalue
;
1037 (*entry
->convert
)(NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
1038 if (entry
->update
) {
1039 (*entry
->update
)(NULL
, entry
, tdata
, entry
->extra_data
);
1047 wDefaultsCheckDomains(void *foo
)
1053 char path
[PATH_MAX
];
1056 puts("Checking domains...");
1058 if (stat(WDWindowMaker
->path
, &stbuf
)>=0
1059 && WDWindowMaker
->timestamp
< stbuf
.st_mtime
) {
1060 WMPropList
*shared_dict
= NULL
;
1062 puts("Checking WindowMaker domain");
1064 WDWindowMaker
->timestamp
= stbuf
.st_mtime
;
1066 /* global dictionary */
1067 snprintf(path
, sizeof(path
), "%s/WindowMaker/WindowMaker", SYSCONFDIR
);
1068 if (stat(path
, &stbuf
)>=0) {
1069 shared_dict
= WMReadPropListFromFile(path
);
1070 if (shared_dict
&& !WMIsPLDictionary(shared_dict
)) {
1071 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
1072 "WindowMaker", path
);
1073 WMReleasePropList(shared_dict
);
1075 } else if (!shared_dict
) {
1076 wwarning(_("could not load domain %s from global defaults database"),
1080 /* user dictionary */
1081 dict
= WMReadPropListFromFile(WDWindowMaker
->path
);
1083 if (!WMIsPLDictionary(dict
)) {
1084 WMReleasePropList(dict
);
1086 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1087 "WindowMaker", WDWindowMaker
->path
);
1090 WMMergePLDictionaries(shared_dict
, dict
, True
);
1091 WMReleasePropList(dict
);
1095 for (i
=0; i
<wScreenCount
; i
++) {
1096 scr
= wScreenWithNumber(i
);
1098 wReadDefaults(scr
, dict
);
1100 if (WDWindowMaker
->dictionary
) {
1101 WMReleasePropList(WDWindowMaker
->dictionary
);
1103 WDWindowMaker
->dictionary
= dict
;
1106 wwarning(_("could not load domain %s from user defaults database"),
1110 WMReleasePropList(shared_dict
);
1114 if (stat(WDWindowAttributes
->path
, &stbuf
)>=0
1115 && WDWindowAttributes
->timestamp
< stbuf
.st_mtime
) {
1117 puts("Checking WMWindowAttributes domain");
1119 dict
= WMReadPropListFromFile(WDWindowAttributes
->path
);
1121 if (!WMIsPLDictionary(dict
)) {
1122 WMReleasePropList(dict
);
1124 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1125 "WMWindowAttributes", WDWindowAttributes
->path
);
1127 if (WDWindowAttributes
->dictionary
)
1128 WMReleasePropList(WDWindowAttributes
->dictionary
);
1129 WDWindowAttributes
->dictionary
= dict
;
1130 for (i
=0; i
<wScreenCount
; i
++) {
1131 scr
= wScreenWithNumber(i
);
1135 wDefaultUpdateIcons(scr
);
1137 /* Update the panel image if changed */
1138 /* Don't worry. If the image is the same these
1139 * functions will have no performance impact. */
1140 image
= wDefaultGetImage(scr
, "Logo", "WMPanel");
1143 wwarning(_("could not load logo image for panels: %s"),
1144 RMessageForError(RErrorCode
));
1146 WMSetApplicationIconImage(scr
->wmscreen
, image
);
1147 RReleaseImage(image
);
1153 wwarning(_("could not load domain %s from user defaults database"),
1154 "WMWindowAttributes");
1156 WDWindowAttributes
->timestamp
= stbuf
.st_mtime
;
1160 if (stat(WDRootMenu
->path
, &stbuf
)>=0
1161 && WDRootMenu
->timestamp
< stbuf
.st_mtime
) {
1162 dict
= WMReadPropListFromFile(WDRootMenu
->path
);
1164 puts("Checking WMRootMenu domain");
1167 if (!WMIsPLArray(dict
) && !WMIsPLString(dict
)) {
1168 WMReleasePropList(dict
);
1170 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1171 "WMRootMenu", WDRootMenu
->path
);
1173 if (WDRootMenu
->dictionary
) {
1174 WMReleasePropList(WDRootMenu
->dictionary
);
1176 WDRootMenu
->dictionary
= dict
;
1179 wwarning(_("could not load domain %s from user defaults database"),
1182 WDRootMenu
->timestamp
= stbuf
.st_mtime
;
1187 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, foo
);
1192 wReadDefaults(WScreen
*scr
, WMPropList
*new_dict
)
1194 WMPropList
*plvalue
, *old_value
;
1195 WDefaultEntry
*entry
;
1197 int update_workspace_back
= 0; /* kluge :/ */
1200 WMPropList
*old_dict
= (WDWindowMaker
->dictionary
!=new_dict
1201 ? WDWindowMaker
->dictionary
: NULL
);
1207 for (i
=0; i
<sizeof(optionList
)/sizeof(WDefaultEntry
); i
++) {
1208 entry
= &optionList
[i
];
1211 plvalue
= WMGetFromPLDictionary(new_dict
, entry
->plkey
);
1218 old_value
= WMGetFromPLDictionary(old_dict
, entry
->plkey
);
1221 if (!plvalue
&& !old_value
) {
1222 /* no default in the DB. Use builtin default */
1223 plvalue
= entry
->plvalue
;
1224 if (plvalue
&& new_dict
) {
1225 WMPutInPLDictionary(new_dict
, entry
->plkey
, plvalue
);
1228 } else if (!plvalue
) {
1229 /* value was deleted from DB. Keep current value */
1231 } else if (!old_value
) {
1232 /* set value for the 1st time */
1233 } else if (!WMIsPropListEqualTo(plvalue
, old_value
)) {
1234 /* value has changed */
1237 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1238 && update_workspace_back
1239 && scr
->flags
.backimage_helper_launched
) {
1241 /* value was not changed since last time */
1248 printf("Updating %s to %s\n", entry
->key
,
1249 WMGetPropListDescription(plvalue
, False
));
1252 if ((*entry
->convert
)(scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1254 * If the WorkspaceSpecificBack data has been changed
1255 * so that the helper will be launched now, we must be
1256 * sure to send the default background texture config
1259 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0
1260 && !scr
->flags
.backimage_helper_launched
) {
1261 update_workspace_back
= 1;
1263 if (entry
->update
) {
1265 (*entry
->update
)(scr
, entry
, tdata
, entry
->extra_data
);
1271 if (needs_refresh
!=0 && !scr
->flags
.startup
) {
1275 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1276 foo
|= WTextureSettings
;
1277 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1278 foo
|= WFontSettings
;
1279 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1280 foo
|= WColorSettings
;
1282 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1286 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1287 foo
|= WTextureSettings
;
1288 if (needs_refresh
& REFRESH_MENU_FONT
)
1289 foo
|= WFontSettings
;
1290 if (needs_refresh
& REFRESH_MENU_COLOR
)
1291 foo
|= WColorSettings
;
1293 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
,
1297 if (needs_refresh
& REFRESH_WINDOW_FONT
) {
1298 foo
|= WFontSettings
;
1300 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
) {
1301 foo
|= WTextureSettings
;
1303 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
) {
1304 foo
|= WColorSettings
;
1307 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
,
1310 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1312 if (needs_refresh
& REFRESH_ICON_FONT
) {
1313 foo
|= WFontSettings
;
1315 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
) {
1316 foo
|= WTextureSettings
;
1318 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
) {
1319 foo
|= WTextureSettings
;
1322 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1325 if (needs_refresh
& REFRESH_ICON_TILE
)
1326 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1332 wDefaultUpdateIcons(WScreen
*scr
)
1334 WAppIcon
*aicon
= scr
->app_icon_list
;
1335 WWindow
*wwin
= scr
->focused_window
;
1339 file
= wDefaultGetIconFile(scr
, aicon
->wm_instance
, aicon
->wm_class
,
1341 if ((file
&& aicon
->icon
->file
&& strcmp(file
, aicon
->icon
->file
)!=0)
1342 || (file
&& !aicon
->icon
->file
)) {
1345 if (aicon
->icon
->file
)
1346 wfree(aicon
->icon
->file
);
1347 aicon
->icon
->file
= wstrdup(file
);
1349 new_image
= wDefaultGetImage(scr
, aicon
->wm_instance
,
1352 wIconChangeImage(aicon
->icon
, new_image
);
1353 wAppIconPaint(aicon
);
1356 aicon
= aicon
->next
;
1359 if (!wPreferences
.flags
.noclip
)
1360 wClipIconPaint(scr
->clip_icon
);
1363 if (wwin
->icon
&& wwin
->flags
.miniaturized
) {
1364 file
= wDefaultGetIconFile(scr
, wwin
->wm_instance
, wwin
->wm_class
,
1366 if ((file
&& wwin
->icon
->file
&& strcmp(file
, wwin
->icon
->file
)!=0)
1367 || (file
&& !wwin
->icon
->file
)) {
1370 if (wwin
->icon
->file
)
1371 wfree(wwin
->icon
->file
);
1372 wwin
->icon
->file
= wstrdup(file
);
1374 new_image
= wDefaultGetImage(scr
, wwin
->wm_instance
,
1377 wIconChangeImage(wwin
->icon
, new_image
);
1385 /* --------------------------- Local ----------------------- */
1387 #define GET_STRING_OR_DEFAULT(x, var) if (!WMIsPLString(value)) { \
1388 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1390 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1391 var = entry->default_value;\
1392 } else var = WMGetFromPLString(value)\
1399 string2index(WMPropList
*key
, WMPropList
*val
, char *def
,
1400 WOptionEnumeration
*values
)
1403 WOptionEnumeration
*v
;
1404 char buffer
[TOTAL_VALUES_LENGTH
];
1406 if (WMIsPLString(val
) && (str
= WMGetFromPLString(val
))) {
1407 for (v
=values
; v
->string
!=NULL
; v
++) {
1408 if (strcasecmp(v
->string
, str
)==0)
1414 for (v
=values
; v
->string
!=NULL
; v
++) {
1417 strcat(buffer
, ", ");
1418 strcat(buffer
, v
->string
);
1421 wwarning(_("wrong option value for key \"%s\". Should be one of %s"),
1422 WMGetFromPLString(key
), buffer
);
1425 return string2index(key
, val
, NULL
, values
);
1435 * value - is the value in the defaults DB
1436 * addr - is the address to store the data
1437 * ret - is the address to store a pointer to a temporary buffer. ret
1438 * must not be freed and is used by the set functions
1441 getBool(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1448 GET_STRING_OR_DEFAULT("Boolean", val
);
1451 if ((val
[1]=='\0' && (val
[0]=='y' || val
[0]=='Y'))
1452 || strcasecmp(val
, "YES")==0) {
1455 } else if ((val
[1]=='\0' && (val
[0]=='n' || val
[0]=='N'))
1456 || strcasecmp(val
, "NO")==0) {
1460 if (sscanf(val
, "%i", &i
)==1) {
1466 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""),
1468 if (second_pass
==0) {
1469 val
= WMGetFromPLString(entry
->plvalue
);
1471 wwarning(_("using default \"%s\" instead"), val
);
1482 *(char*)addr
= data
;
1490 getInt(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1497 GET_STRING_OR_DEFAULT("Integer", val
);
1499 if (sscanf(val
, "%i", &data
)!=1) {
1500 wwarning(_("can't convert \"%s\" to integer for key \"%s\""),
1502 val
= WMGetFromPLString(entry
->plvalue
);
1503 wwarning(_("using default \"%s\" instead"), val
);
1504 if (sscanf(val
, "%i", &data
)!=1) {
1520 getCoord(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1524 char *val_x
, *val_y
;
1525 int nelem
, changed
=0;
1526 WMPropList
*elem_x
, *elem_y
;
1529 if (!WMIsPLArray(value
)) {
1530 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1531 entry
->key
, "Coordinate");
1533 value
= entry
->plvalue
;
1535 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1541 nelem
= WMGetPropListItemCount(value
);
1543 wwarning(_("Incorrect number of elements in array for key \"%s\"."),
1546 value
= entry
->plvalue
;
1548 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1554 elem_x
= WMGetFromPLArray(value
, 0);
1555 elem_y
= WMGetFromPLArray(value
, 1);
1557 if (!elem_x
|| !elem_y
|| !WMIsPLString(elem_x
) || !WMIsPLString(elem_y
)) {
1558 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."),
1561 value
= entry
->plvalue
;
1563 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1569 val_x
= WMGetFromPLString(elem_x
);
1570 val_y
= WMGetFromPLString(elem_y
);
1572 if (sscanf(val_x
, "%i", &data
.x
)!=1 || sscanf(val_y
, "%i", &data
.y
)!=1) {
1573 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1575 value
= entry
->plvalue
;
1577 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1585 else if (data
.x
> scr
->scr_width
/3)
1586 data
.x
= scr
->scr_width
/3;
1589 else if (data
.y
> scr
->scr_height
/3)
1590 data
.y
= scr
->scr_height
/3;
1596 *(WCoord
*)addr
= data
;
1604 /* This function is not used at the moment. */
1606 getString(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1611 GET_STRING_OR_DEFAULT("String", data
);
1614 data
= WMGetFromPLString(entry
->plvalue
);
1623 *(char**)addr
= wstrdup(data
);
1631 getPathList(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1641 if (!WMIsPLArray(value
)) {
1642 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1643 entry
->key
, "an array of paths");
1645 value
= entry
->plvalue
;
1647 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1654 count
= WMGetPropListItemCount(value
);
1657 value
= entry
->plvalue
;
1659 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1666 for (i
=0; i
<count
; i
++) {
1667 d
= WMGetFromPLArray(value
, i
);
1668 if (!d
|| !WMIsPLString(d
)) {
1672 len
+= strlen(WMGetFromPLString(d
))+1;
1675 ptr
= data
= wmalloc(len
+1);
1677 for (i
=0; i
<count
; i
++) {
1678 d
= WMGetFromPLArray(value
, i
);
1679 if (!d
|| !WMIsPLString(d
)) {
1682 strcpy(ptr
, WMGetFromPLString(d
));
1683 ptr
+= strlen(WMGetFromPLString(d
));
1687 ptr
--; *(ptr
--) = 0;
1689 if (*(char**)addr
!=NULL
) {
1690 wfree(*(char**)addr
);
1692 *(char**)addr
= data
;
1699 getEnum(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1702 static signed char data
;
1704 data
= string2index(entry
->plkey
, value
, entry
->default_value
,
1705 (WOptionEnumeration
*)entry
->extra_data
);
1713 *(signed char*)addr
= data
;
1722 * (hgradient <color> <color>)
1723 * (vgradient <color> <color>)
1724 * (dgradient <color> <color>)
1725 * (mhgradient <color> <color> ...)
1726 * (mvgradient <color> <color> ...)
1727 * (mdgradient <color> <color> ...)
1728 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1729 * (tpixmap <file> <color>)
1730 * (spixmap <file> <color>)
1731 * (cpixmap <file> <color>)
1732 * (thgradient <file> <opaqueness> <color> <color>)
1733 * (tvgradient <file> <opaqueness> <color> <color>)
1734 * (tdgradient <file> <opaqueness> <color> <color>)
1735 * (function <lib> <function> ...)
1739 parse_texture(WScreen
*scr
, WMPropList
*pl
)
1744 WTexture
*texture
=NULL
;
1746 nelem
= WMGetPropListItemCount(pl
);
1751 elem
= WMGetFromPLArray(pl
, 0);
1752 if (!elem
|| !WMIsPLString(elem
))
1754 val
= WMGetFromPLString(elem
);
1757 if (strcasecmp(val
, "solid")==0) {
1765 elem
= WMGetFromPLArray(pl
, 1);
1766 if (!elem
|| !WMIsPLString(elem
))
1768 val
= WMGetFromPLString(elem
);
1770 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1771 wwarning(_("\"%s\" is not a valid color name"), val
);
1775 texture
= (WTexture
*)wTextureMakeSolid(scr
, &color
);
1776 } else if (strcasecmp(val
, "dgradient")==0
1777 || strcasecmp(val
, "vgradient")==0
1778 || strcasecmp(val
, "hgradient")==0) {
1779 RColor color1
, color2
;
1784 wwarning(_("bad number of arguments in gradient specification"));
1788 if (val
[0]=='d' || val
[0]=='D')
1789 type
= WTEX_DGRADIENT
;
1790 else if (val
[0]=='h' || val
[0]=='H')
1791 type
= WTEX_HGRADIENT
;
1793 type
= WTEX_VGRADIENT
;
1796 /* get from color */
1797 elem
= WMGetFromPLArray(pl
, 1);
1798 if (!elem
|| !WMIsPLString(elem
))
1800 val
= WMGetFromPLString(elem
);
1802 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1803 wwarning(_("\"%s\" is not a valid color name"), val
);
1807 color1
.red
= xcolor
.red
>> 8;
1808 color1
.green
= xcolor
.green
>> 8;
1809 color1
.blue
= xcolor
.blue
>> 8;
1812 elem
= WMGetFromPLArray(pl
, 2);
1813 if (!elem
|| !WMIsPLString(elem
)) {
1816 val
= WMGetFromPLString(elem
);
1818 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1819 wwarning(_("\"%s\" is not a valid color name"), val
);
1823 color2
.red
= xcolor
.red
>> 8;
1824 color2
.green
= xcolor
.green
>> 8;
1825 color2
.blue
= xcolor
.blue
>> 8;
1827 texture
= (WTexture
*)wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1829 } else if (strcasecmp(val
, "igradient")==0) {
1830 RColor colors1
[2], colors2
[2];
1836 wwarning(_("bad number of arguments in gradient specification"));
1840 /* get from color */
1841 for (i
= 0; i
< 2; i
++) {
1842 elem
= WMGetFromPLArray(pl
, 1+i
);
1843 if (!elem
|| !WMIsPLString(elem
))
1845 val
= WMGetFromPLString(elem
);
1847 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1848 wwarning(_("\"%s\" is not a valid color name"), val
);
1851 colors1
[i
].alpha
= 255;
1852 colors1
[i
].red
= xcolor
.red
>> 8;
1853 colors1
[i
].green
= xcolor
.green
>> 8;
1854 colors1
[i
].blue
= xcolor
.blue
>> 8;
1856 elem
= WMGetFromPLArray(pl
, 3);
1857 if (!elem
|| !WMIsPLString(elem
))
1859 val
= WMGetFromPLString(elem
);
1863 /* get from color */
1864 for (i
= 0; i
< 2; i
++) {
1865 elem
= WMGetFromPLArray(pl
, 4+i
);
1866 if (!elem
|| !WMIsPLString(elem
))
1868 val
= WMGetFromPLString(elem
);
1870 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1871 wwarning(_("\"%s\" is not a valid color name"), val
);
1874 colors2
[i
].alpha
= 255;
1875 colors2
[i
].red
= xcolor
.red
>> 8;
1876 colors2
[i
].green
= xcolor
.green
>> 8;
1877 colors2
[i
].blue
= xcolor
.blue
>> 8;
1879 elem
= WMGetFromPLArray(pl
, 6);
1880 if (!elem
|| !WMIsPLString(elem
))
1882 val
= WMGetFromPLString(elem
);
1885 texture
= (WTexture
*)wTextureMakeIGradient(scr
, th1
, colors1
,
1888 } else if (strcasecmp(val
, "mhgradient")==0
1889 || strcasecmp(val
, "mvgradient")==0
1890 || strcasecmp(val
, "mdgradient")==0) {
1897 wwarning(_("too few arguments in multicolor gradient specification"));
1901 if (val
[1]=='h' || val
[1]=='H')
1902 type
= WTEX_MHGRADIENT
;
1903 else if (val
[1]=='v' || val
[1]=='V')
1904 type
= WTEX_MVGRADIENT
;
1906 type
= WTEX_MDGRADIENT
;
1910 colors
= wmalloc(sizeof(RColor
*)*(count
+1));
1912 for (i
=0; i
<count
; i
++) {
1913 elem
= WMGetFromPLArray(pl
, i
+1);
1914 if (!elem
|| !WMIsPLString(elem
)) {
1915 for (--i
; i
>=0; --i
) {
1921 val
= WMGetFromPLString(elem
);
1923 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1924 wwarning(_("\"%s\" is not a valid color name"), val
);
1925 for (--i
; i
>=0; --i
) {
1931 colors
[i
] = wmalloc(sizeof(RColor
));
1932 colors
[i
]->red
= color
.red
>> 8;
1933 colors
[i
]->green
= color
.green
>> 8;
1934 colors
[i
]->blue
= color
.blue
>> 8;
1939 texture
= (WTexture
*)wTextureMakeMGradient(scr
, type
, colors
);
1940 } else if (strcasecmp(val
, "spixmap")==0 ||
1941 strcasecmp(val
, "cpixmap")==0 ||
1942 strcasecmp(val
, "tpixmap")==0) {
1949 if (val
[0] == 's' || val
[0] == 'S')
1951 else if (val
[0] == 'c' || val
[0] == 'C')
1957 elem
= WMGetFromPLArray(pl
, 2);
1958 if (!elem
|| !WMIsPLString(elem
)) {
1961 val
= WMGetFromPLString(elem
);
1963 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1964 wwarning(_("\"%s\" is not a valid color name"), val
);
1969 elem
= WMGetFromPLArray(pl
, 1);
1970 if (!elem
|| !WMIsPLString(elem
))
1972 val
= WMGetFromPLString(elem
);
1974 texture
= (WTexture
*)wTextureMakePixmap(scr
, type
, val
, &color
);
1975 } else if (strcasecmp(val
, "thgradient")==0
1976 || strcasecmp(val
, "tvgradient")==0
1977 || strcasecmp(val
, "tdgradient")==0) {
1978 RColor color1
, color2
;
1983 if (val
[1]=='h' || val
[1]=='H')
1984 style
= WTEX_THGRADIENT
;
1985 else if (val
[1]=='v' || val
[1]=='V')
1986 style
= WTEX_TVGRADIENT
;
1988 style
= WTEX_TDGRADIENT
;
1991 wwarning(_("bad number of arguments in textured gradient specification"));
1995 /* get from color */
1996 elem
= WMGetFromPLArray(pl
, 3);
1997 if (!elem
|| !WMIsPLString(elem
))
1999 val
= WMGetFromPLString(elem
);
2001 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
2002 wwarning(_("\"%s\" is not a valid color name"), val
);
2006 color1
.red
= xcolor
.red
>> 8;
2007 color1
.green
= xcolor
.green
>> 8;
2008 color1
.blue
= xcolor
.blue
>> 8;
2011 elem
= WMGetFromPLArray(pl
, 4);
2012 if (!elem
|| !WMIsPLString(elem
)) {
2015 val
= WMGetFromPLString(elem
);
2017 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
2018 wwarning(_("\"%s\" is not a valid color name"), val
);
2022 color2
.red
= xcolor
.red
>> 8;
2023 color2
.green
= xcolor
.green
>> 8;
2024 color2
.blue
= xcolor
.blue
>> 8;
2027 elem
= WMGetFromPLArray(pl
, 2);
2028 if (!elem
|| !WMIsPLString(elem
))
2031 val
= WMGetFromPLString(elem
);
2033 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
2034 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
2039 elem
= WMGetFromPLArray(pl
, 1);
2040 if (!elem
|| !WMIsPLString(elem
))
2042 val
= WMGetFromPLString(elem
);
2044 texture
= (WTexture
*)wTextureMakeTGradient(scr
, style
, &color1
, &color2
,
2047 #ifdef TEXTURE_PLUGIN
2048 else if (strcasecmp(val
, "function")==0) {
2049 WTexFunction
*function
;
2050 void (*initFunc
) (Display
*, Colormap
);
2051 char *lib
, *func
, **argv
;
2057 /* get the library name */
2058 elem
= WMGetFromPLArray(pl
, 1);
2059 if (!elem
|| !WMIsPLString(elem
)) {
2062 lib
= WMGetFromPLString(elem
);
2064 /* get the function name */
2065 elem
= WMGetFromPLArray(pl
, 2);
2066 if (!elem
|| !WMIsPLString(elem
)) {
2069 func
= WMGetFromPLString(elem
);
2072 argv
= (char **)wmalloc(argc
* sizeof(char *));
2074 /* get the parameters */
2075 argv
[0] = wstrdup(func
);
2076 for (i
= 0; i
< argc
- 1; i
++) {
2077 elem
= WMGetFromPLArray(pl
, 3 + i
);
2078 if (!elem
|| !WMIsPLString(elem
)) {
2083 argv
[i
+1] = wstrdup(WMGetFromPLString(elem
));
2086 function
= wTextureMakeFunction(scr
, lib
, func
, argc
, argv
);
2090 initFunc
= dlsym(function
->handle
, "initWindowMaker");
2092 initFunc(dpy
, scr
->w_colormap
);
2094 wwarning(_("could not initialize library %s"), lib
);
2097 wwarning(_("could not find function %s::%s"), lib
, func
);
2099 #endif /* HAVE_DLFCN_H */
2100 texture
= (WTexture
*)function
;
2102 #endif /* TEXTURE_PLUGIN */
2104 wwarning(_("invalid texture type %s"), val
);
2113 getTexture(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2116 static WTexture
*texture
;
2120 if (!WMIsPLArray(value
)) {
2121 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2122 entry
->key
, "Texture");
2124 value
= entry
->plvalue
;
2126 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2132 if (strcmp(entry
->key
, "WidgetColor")==0 && !changed
) {
2135 pl
= WMGetFromPLArray(value
, 0);
2136 if (!pl
|| !WMIsPLString(pl
) || !WMGetFromPLString(pl
)
2137 || strcasecmp(WMGetFromPLString(pl
), "solid")!=0) {
2138 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2139 entry
->key
, "Solid Texture");
2141 value
= entry
->plvalue
;
2143 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2148 texture
= parse_texture(scr
, value
);
2151 wwarning(_("Error in texture specification for key \"%s\""),
2154 value
= entry
->plvalue
;
2156 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2166 *(WTexture
**)addr
= texture
;
2173 getWSBackground(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
2174 void *addr
, void **ret
)
2182 if (!WMIsPLArray(value
)) {
2183 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2184 "WorkspaceBack", "Texture or None");
2186 value
= entry
->plvalue
;
2188 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2194 /* only do basic error checking and verify for None texture */
2196 nelem
= WMGetPropListItemCount(value
);
2198 elem
= WMGetFromPLArray(value
, 0);
2199 if (!elem
|| !WMIsPLString(elem
)) {
2200 wwarning(_("Wrong type for workspace background. Should be a texture type."));
2202 value
= entry
->plvalue
;
2204 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2209 val
= WMGetFromPLString(elem
);
2211 if (strcasecmp(val
, "None")==0)
2214 *ret
= WMRetainPropList(value
);
2221 getWSSpecificBackground(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
2222 void *addr
, void **ret
)
2229 if (!WMIsPLArray(value
)) {
2230 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2231 "WorkspaceSpecificBack", "an array of textures");
2233 value
= entry
->plvalue
;
2235 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2241 /* only do basic error checking and verify for None texture */
2243 nelem
= WMGetPropListItemCount(value
);
2246 elem
= WMGetFromPLArray(value
, nelem
);
2247 if (!elem
|| !WMIsPLArray(elem
)) {
2248 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2254 *ret
= WMRetainPropList(value
);
2258 * Kluge to force wmsetbg helper to set the default background.
2259 * If the WorkspaceSpecificBack is changed once wmaker has started,
2260 * the WorkspaceBack won't be sent to the helper, unless the user
2261 * changes it's value too. So, we must force this by removing the
2262 * value from the defaults DB.
2264 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2265 WMPropList
*key
= WMCreatePLString("WorkspaceBack");
2267 WMRemoveFromPLDictionary(WDWindowMaker
->dictionary
, key
);
2269 WMReleasePropList(key
);
2277 getFont(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2280 static WMFont
*font
;
2283 GET_STRING_OR_DEFAULT("Font", val
);
2285 font
= WMCreateFont(scr
->wmscreen
, val
);
2287 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2290 wfatal(_("could not load any usable font!!!"));
2297 /* can't assign font value outside update function */
2298 wassertrv(addr
== NULL
, True
);
2305 getColor(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2308 static XColor color
;
2312 GET_STRING_OR_DEFAULT("Color", val
);
2316 if (!wGetColor(scr
, val
, &color
)) {
2317 wwarning(_("could not get color for key \"%s\""),
2319 if (second_pass
==0) {
2320 val
= WMGetFromPLString(entry
->plvalue
);
2322 wwarning(_("using default \"%s\" instead"), val
);
2334 *(unsigned long*)addr = pixel;
2343 getKeybind(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2346 static WShortKey shortcut
;
2353 GET_STRING_OR_DEFAULT("Key spec", val
);
2355 if (!val
|| strcasecmp(val
, "NONE")==0) {
2356 shortcut
.keycode
= 0;
2357 shortcut
.modifier
= 0;
2368 shortcut
.modifier
= 0;
2369 while ((k
= strchr(b
, '+'))!=NULL
) {
2373 mod
= wXModifierFromKey(b
);
2375 wwarning(_("%s:invalid key modifier \"%s\""), entry
->key
, b
);
2378 shortcut
.modifier
|= mod
;
2384 ksym
= XStringToKeysym(b
);
2386 if (ksym
==NoSymbol
) {
2387 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
,
2392 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2393 if (shortcut
.keycode
==0) {
2394 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2406 getModMask(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2409 static unsigned int mask
;
2412 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2417 mask
= wXModifierFromKey(str
);
2419 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2425 *(unsigned int*)addr
= mask
;
2436 getRImages(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
2437 void *addr
, void **ret
)
2445 GET_STRING_OR_DEFAULT("Image File Path", str
);
2449 image
= RLoadImage(scr
->rcontext
, str
, 0);
2451 wwarning(_("could not load image in option %s: %s"), entry
->key
,
2452 RMessageForError(RErrorCode
));
2456 if (*(RImage
**)addr
) {
2457 RReleaseImage(*(RImage
**)addr
);
2460 *(RImage
**)addr
= image
;
2462 assert(ret
== NULL
);
2465 *(RImage**)ret = image;
2472 # include <X11/cursorfont.h>
2479 #define CURSOR_ID_NONE (XC_num_glyphs)
2481 static WCursorLookup cursor_table
[] =
2483 { "X_cursor", XC_X_cursor
},
2484 { "arrow", XC_arrow
},
2485 { "based_arrow_down", XC_based_arrow_down
},
2486 { "based_arrow_up", XC_based_arrow_up
},
2487 { "boat", XC_boat
},
2488 { "bogosity", XC_bogosity
},
2489 { "bottom_left_corner", XC_bottom_left_corner
},
2490 { "bottom_right_corner", XC_bottom_right_corner
},
2491 { "bottom_side", XC_bottom_side
},
2492 { "bottom_tee", XC_bottom_tee
},
2493 { "box_spiral", XC_box_spiral
},
2494 { "center_ptr", XC_center_ptr
},
2495 { "circle", XC_circle
},
2496 { "clock", XC_clock
},
2497 { "coffee_mug", XC_coffee_mug
},
2498 { "cross", XC_cross
},
2499 { "cross_reverse", XC_cross_reverse
},
2500 { "crosshair", XC_crosshair
},
2501 { "diamond_cross", XC_diamond_cross
},
2503 { "dotbox", XC_dotbox
},
2504 { "double_arrow", XC_double_arrow
},
2505 { "draft_large", XC_draft_large
},
2506 { "draft_small", XC_draft_small
},
2507 { "draped_box", XC_draped_box
},
2508 { "exchange", XC_exchange
},
2509 { "fleur", XC_fleur
},
2510 { "gobbler", XC_gobbler
},
2511 { "gumby", XC_gumby
},
2512 { "hand1", XC_hand1
},
2513 { "hand2", XC_hand2
},
2514 { "heart", XC_heart
},
2515 { "icon", XC_icon
},
2516 { "iron_cross", XC_iron_cross
},
2517 { "left_ptr", XC_left_ptr
},
2518 { "left_side", XC_left_side
},
2519 { "left_tee", XC_left_tee
},
2520 { "leftbutton", XC_leftbutton
},
2521 { "ll_angle", XC_ll_angle
},
2522 { "lr_angle", XC_lr_angle
},
2524 { "middlebutton", XC_middlebutton
},
2525 { "mouse", XC_mouse
},
2526 { "pencil", XC_pencil
},
2527 { "pirate", XC_pirate
},
2528 { "plus", XC_plus
},
2529 { "question_arrow", XC_question_arrow
},
2530 { "right_ptr", XC_right_ptr
},
2531 { "right_side", XC_right_side
},
2532 { "right_tee", XC_right_tee
},
2533 { "rightbutton", XC_rightbutton
},
2534 { "rtl_logo", XC_rtl_logo
},
2535 { "sailboat", XC_sailboat
},
2536 { "sb_down_arrow", XC_sb_down_arrow
},
2537 { "sb_h_double_arrow", XC_sb_h_double_arrow
},
2538 { "sb_left_arrow", XC_sb_left_arrow
},
2539 { "sb_right_arrow", XC_sb_right_arrow
},
2540 { "sb_up_arrow", XC_sb_up_arrow
},
2541 { "sb_v_double_arrow", XC_sb_v_double_arrow
},
2542 { "shuttle", XC_shuttle
},
2543 { "sizing", XC_sizing
},
2544 { "spider", XC_spider
},
2545 { "spraycan", XC_spraycan
},
2546 { "star", XC_star
},
2547 { "target", XC_target
},
2548 { "tcross", XC_tcross
},
2549 { "top_left_arrow", XC_top_left_arrow
},
2550 { "top_left_corner", XC_top_left_corner
},
2551 { "top_right_corner", XC_top_right_corner
},
2552 { "top_side", XC_top_side
},
2553 { "top_tee", XC_top_tee
},
2554 { "trek", XC_trek
},
2555 { "ul_angle", XC_ul_angle
},
2556 { "umbrella", XC_umbrella
},
2557 { "ur_angle", XC_ur_angle
},
2558 { "watch", XC_watch
},
2559 { "xterm", XC_xterm
},
2560 { NULL
, CURSOR_ID_NONE
}
2564 check_bitmap_status(int status
, char *filename
, Pixmap bitmap
)
2567 case BitmapOpenFailed
:
2568 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2570 case BitmapFileInvalid
:
2571 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2573 case BitmapNoMemory
:
2574 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2577 XFreePixmap(dpy
, bitmap
);
2584 * (builtin, <cursor_name>)
2585 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2588 parse_cursor(WScreen
*scr
, WMPropList
*pl
, Cursor
*cursor
)
2595 nelem
= WMGetPropListItemCount(pl
);
2599 elem
= WMGetFromPLArray(pl
, 0);
2600 if (!elem
|| !WMIsPLString(elem
)) {
2603 val
= WMGetFromPLString(elem
);
2605 if (0 == strcasecmp(val
, "none")) {
2608 } else if (0 == strcasecmp(val
, "builtin")) {
2610 int cursor_id
= CURSOR_ID_NONE
;
2613 wwarning(_("bad number of arguments in cursor specification"));
2616 elem
= WMGetFromPLArray(pl
, 1);
2617 if (!elem
|| !WMIsPLString(elem
)) {
2620 val
= WMGetFromPLString(elem
);
2622 for (i
= 0; NULL
!= cursor_table
[i
].name
; i
++) {
2623 if (0 == strcasecmp(val
, cursor_table
[i
].name
)) {
2624 cursor_id
= cursor_table
[i
].id
;
2628 if (CURSOR_ID_NONE
== cursor_id
) {
2629 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2631 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2634 } else if (0 == strcasecmp(val
, "bitmap")) {
2646 wwarning(_("bad number of arguments in cursor specification"));
2649 elem
= WMGetFromPLArray(pl
, 1);
2650 if (!elem
|| !WMIsPLString(elem
)) {
2653 val
= WMGetFromPLString(elem
);
2654 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2656 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2659 elem
= WMGetFromPLArray(pl
, 2);
2660 if (!elem
|| !WMIsPLString(elem
)) {
2664 val
= WMGetFromPLString(elem
);
2665 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2668 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2671 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
,
2673 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
,
2675 if ((BitmapSuccess
== bitmap_status
) &&
2676 (BitmapSuccess
== mask_status
)) {
2677 fg
.pixel
= scr
->black_pixel
;
2678 bg
.pixel
= scr
->white_pixel
;
2679 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2680 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2681 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2684 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2685 check_bitmap_status(mask_status
, mask_name
, mask
);
2694 getCursor(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2697 static Cursor cursor
;
2702 if (!WMIsPLArray(value
)) {
2703 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2704 entry
->key
, "cursor specification");
2706 value
= entry
->plvalue
;
2708 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2713 status
= parse_cursor(scr
, value
, &cursor
);
2715 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2717 value
= entry
->plvalue
;
2719 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2728 *(Cursor
*)addr
= cursor
;
2732 #undef CURSOR_ID_NONE
2735 /* ---------------- value setting functions --------------- */
2737 setJustify(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
2739 return REFRESH_WINDOW_TITLE_COLOR
;
2743 setClearance(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
2745 return REFRESH_WINDOW_FONT
|REFRESH_BUTTON_IMAGES
|REFRESH_MENU_TITLE_FONT
|REFRESH_MENU_FONT
;
2749 setIfDockPresent(WScreen
*scr
, WDefaultEntry
*entry
, char *flag
, long which
)
2753 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2756 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2766 setStickyIcons(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
2768 if (scr
->workspaces
) {
2769 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2770 wArrangeIcons(scr
, False
);
2777 setPositive(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
2789 setIconTile(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
2795 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2796 wPreferences
.icon_size
,
2797 ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2798 ? WREL_ICON
: WREL_FLAT
);
2800 wwarning(_("could not render texture for icon background"));
2802 wTextureDestroy(scr
, *texture
);
2805 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2807 if (scr
->icon_tile
) {
2809 RReleaseImage(scr
->icon_tile
);
2810 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2813 scr
->icon_tile
= img
;
2816 /* put the icon in the noticeboard hint */
2817 PropSetIconTileHint(scr
, img
);
2820 if (!wPreferences
.flags
.noclip
) {
2821 if (scr
->clip_tile
) {
2822 RReleaseImage(scr
->clip_tile
);
2824 scr
->clip_tile
= wClipMakeTile(scr
, img
);
2827 scr
->icon_tile_pixmap
= pixmap
;
2829 if (scr
->def_icon_pixmap
) {
2830 XFreePixmap(dpy
, scr
->def_icon_pixmap
);
2831 scr
->def_icon_pixmap
= None
;
2833 if (scr
->def_ticon_pixmap
) {
2834 XFreePixmap(dpy
, scr
->def_ticon_pixmap
);
2835 scr
->def_ticon_pixmap
= None
;
2838 if (scr
->icon_back_texture
) {
2839 wTextureDestroy(scr
, (WTexture
*)scr
->icon_back_texture
);
2841 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2843 if (scr
->clip_balloon
)
2844 XSetWindowBackground(dpy
, scr
->clip_balloon
,
2845 (*texture
)->any
.color
.pixel
);
2848 * Free the texture as nobody else will use it, nor refer to it.
2851 wTextureDestroy(scr
, *texture
);
2853 return (reset
? REFRESH_ICON_TILE
: 0);
2859 setWinTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2861 if (scr
->title_font
) {
2862 WMReleaseFont(scr
->title_font
);
2864 scr
->title_font
= font
;
2866 return REFRESH_WINDOW_FONT
|REFRESH_BUTTON_IMAGES
;
2871 setMenuTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2873 if (scr
->menu_title_font
) {
2874 WMReleaseFont(scr
->menu_title_font
);
2877 scr
->menu_title_font
= font
;
2879 return REFRESH_MENU_TITLE_FONT
;
2884 setMenuTextFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2886 if (scr
->menu_entry_font
) {
2887 WMReleaseFont(scr
->menu_entry_font
);
2889 scr
->menu_entry_font
= font
;
2891 return REFRESH_MENU_FONT
;
2897 setIconTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2899 if (scr
->icon_title_font
) {
2900 WMReleaseFont(scr
->icon_title_font
);
2903 scr
->icon_title_font
= font
;
2905 return REFRESH_ICON_FONT
;
2910 setClipTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2912 if (scr
->clip_title_font
) {
2913 WMReleaseFont(scr
->clip_title_font
);
2916 scr
->clip_title_font
= font
;
2918 return REFRESH_ICON_FONT
;
2923 setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2925 if (scr
->workspace_name_font
) {
2926 WMReleaseFont(scr
->workspace_name_font
);
2929 scr
->workspace_name_font
= font
;
2936 setHightlight(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
2938 if (scr
->select_pixel
!=scr
->white_pixel
&&
2939 scr
->select_pixel
!=scr
->black_pixel
) {
2940 wFreeColor(scr
, scr
->select_pixel
);
2943 scr
->select_pixel
= color
->pixel
;
2945 return REFRESH_MENU_COLOR
;
2950 setHightlightText(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
2952 if (scr
->select_text_pixel
!=scr
->white_pixel
&&
2953 scr
->select_text_pixel
!=scr
->black_pixel
) {
2954 wFreeColor(scr
, scr
->select_text_pixel
);
2957 scr
->select_text_pixel
= color
->pixel
;
2959 return REFRESH_MENU_COLOR
;
2964 setClipTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
2966 if (scr
->clip_title_pixel
[index
]!=scr
->white_pixel
&&
2967 scr
->clip_title_pixel
[index
]!=scr
->black_pixel
) {
2968 wFreeColor(scr
, scr
->clip_title_pixel
[index
]);
2970 scr
->clip_title_pixel
[index
] = color
->pixel
;
2972 #ifdef GRADIENT_CLIP_ARROW
2973 if (index
== CLIP_NORMAL
) {
2975 RColor color1
, color2
;
2976 int pt
= CLIP_BUTTON_SIZE
*wPreferences
.icon_size
/64;
2977 int as
= pt
- 15; /* 15 = 5+5+5 */
2979 FREE_PIXMAP(scr
->clip_arrow_gradient
);
2981 color1
.red
= (color
->red
>> 8)*6/10;
2982 color1
.green
= (color
->green
>> 8)*6/10;
2983 color1
.blue
= (color
->blue
>> 8)*6/10;
2985 color2
.red
= WMIN((color
->red
>> 8)*20/10, 255);
2986 color2
.green
= WMIN((color
->green
>> 8)*20/10, 255);
2987 color2
.blue
= WMIN((color
->blue
>> 8)*20/10, 255);
2989 image
= RRenderGradient(as
+1, as
+1, &color1
, &color2
, RDiagonalGradient
);
2990 RConvertImage(scr
->rcontext
, image
, &scr
->clip_arrow_gradient
);
2991 RReleaseImage(image
);
2993 #endif /* GRADIENT_CLIP_ARROW */
2995 return REFRESH_ICON_TITLE_COLOR
;
3000 setWTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3002 if (scr
->window_title_pixel
[index
]!=scr
->white_pixel
&&
3003 scr
->window_title_pixel
[index
]!=scr
->black_pixel
) {
3004 wFreeColor(scr
, scr
->window_title_pixel
[index
]);
3007 scr
->window_title_pixel
[index
] = color
->pixel
;
3009 if (index
== WS_UNFOCUSED
)
3010 XSetForeground(dpy
, scr
->info_text_gc
, color
->pixel
);
3012 return REFRESH_WINDOW_TITLE_COLOR
;
3017 setMenuTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3019 if (scr
->menu_title_pixel
[0]!=scr
->white_pixel
&&
3020 scr
->menu_title_pixel
[0]!=scr
->black_pixel
) {
3021 wFreeColor(scr
, scr
->menu_title_pixel
[0]);
3024 scr
->menu_title_pixel
[0] = color
->pixel
;
3025 XSetForeground(dpy
, scr
->menu_title_gc
, color
->pixel
);
3027 return REFRESH_MENU_TITLE_COLOR
;
3032 setMenuTextColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3035 #define gcm (GCForeground|GCBackground|GCFillStyle)
3037 if (scr
->mtext_pixel
!=scr
->white_pixel
&&
3038 scr
->mtext_pixel
!=scr
->black_pixel
) {
3039 wFreeColor(scr
, scr
->mtext_pixel
);
3042 scr
->mtext_pixel
= color
->pixel
;
3044 XSetForeground(dpy
, scr
->menu_entry_gc
, color
->pixel
);
3047 if (scr
->dtext_pixel
== scr
->mtext_pixel
) {
3048 gcv
.foreground
= scr
->white_pixel
;
3049 gcv
.background
= scr
->black_pixel
;
3050 gcv
.fill_style
= FillStippled
;
3052 gcv
.foreground
= scr
->dtext_pixel
;
3053 gcv
.fill_style
= FillSolid
;
3055 XChangeGC(dpy
, scr
->disabled_menu_entry_gc
, gcm
, &gcv
);
3057 return REFRESH_MENU_COLOR
;
3063 setMenuDisabledColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3066 #define gcm (GCForeground|GCBackground|GCFillStyle)
3068 if (scr
->dtext_pixel
!=scr
->white_pixel
&&
3069 scr
->dtext_pixel
!=scr
->black_pixel
) {
3070 wFreeColor(scr
, scr
->dtext_pixel
);
3073 scr
->dtext_pixel
= color
->pixel
;
3075 if (scr
->dtext_pixel
== scr
->mtext_pixel
) {
3076 gcv
.foreground
= scr
->white_pixel
;
3077 gcv
.background
= scr
->black_pixel
;
3078 gcv
.fill_style
= FillStippled
;
3080 gcv
.foreground
= scr
->dtext_pixel
;
3081 gcv
.fill_style
= FillSolid
;
3083 XChangeGC(dpy
, scr
->disabled_menu_entry_gc
, gcm
, &gcv
);
3085 return REFRESH_MENU_COLOR
;
3090 setIconTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3092 XSetForeground(dpy
, scr
->icon_title_gc
, color
->pixel
);
3094 return REFRESH_ICON_TITLE_COLOR
;
3099 setIconTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3101 if (scr
->icon_title_texture
) {
3102 wTextureDestroy(scr
, (WTexture
*)scr
->icon_title_texture
);
3104 XQueryColor (dpy
, scr
->w_colormap
, color
);
3105 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
3107 return REFRESH_ICON_TITLE_BACK
;
3112 trackDeadProcess(pid_t pid
, unsigned char status
, WScreen
*scr
)
3114 close(scr
->helper_fd
);
3116 scr
->helper_pid
= 0;
3117 scr
->flags
.backimage_helper_launched
= 0;
3122 setWorkspaceSpecificBack(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
3129 if (scr
->flags
.backimage_helper_launched
) {
3130 if (WMGetPropListItemCount(value
)==0) {
3131 SendHelperMessage(scr
, 'C', 0, NULL
);
3132 SendHelperMessage(scr
, 'K', 0, NULL
);
3134 WMReleasePropList(value
);
3141 if (WMGetPropListItemCount(value
) == 0)
3144 if (pipe(filedes
) < 0) {
3145 wsyserror("pipe() failed:can't set workspace specific background image");
3147 WMReleasePropList(value
);
3153 wsyserror("fork() failed:can't set workspace specific background image");
3154 if (close(filedes
[0]) < 0)
3155 wsyserror("could not close pipe");
3156 if (close(filedes
[1]) < 0)
3157 wsyserror("could not close pipe");
3159 } else if (pid
== 0) {
3162 SetupEnvironment(scr
);
3165 wsyserror("could not close pipe");
3166 if (dup(filedes
[0]) < 0) {
3167 wsyserror("dup() failed:can't set workspace specific background image");
3169 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3170 if (wPreferences
.smooth_workspace_back
)
3171 execlp("wmsetbg", "wmsetbg", "-helper", "-S", dither
, NULL
);
3173 execlp("wmsetbg", "wmsetbg", "-helper", dither
, NULL
);
3174 wsyserror("could not execute wmsetbg");
3178 if (fcntl(filedes
[0], F_SETFD
, FD_CLOEXEC
) < 0) {
3179 wsyserror("error setting close-on-exec flag");
3181 if (fcntl(filedes
[1], F_SETFD
, FD_CLOEXEC
) < 0) {
3182 wsyserror("error setting close-on-exec flag");
3185 scr
->helper_fd
= filedes
[1];
3186 scr
->helper_pid
= pid
;
3187 scr
->flags
.backimage_helper_launched
= 1;
3189 wAddDeathHandler(pid
, (WDeathHandler
*)trackDeadProcess
, scr
);
3191 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3196 for (i
= 0; i
< WMGetPropListItemCount(value
); i
++) {
3197 val
= WMGetFromPLArray(value
, i
);
3198 if (val
&& WMIsPLArray(val
) && WMGetPropListItemCount(val
)>0) {
3199 str
= WMGetPropListDescription(val
, False
);
3201 SendHelperMessage(scr
, 'S', i
+1, str
);
3205 SendHelperMessage(scr
, 'U', i
+1, NULL
);
3210 WMReleasePropList(value
);
3216 setWorkspaceBack(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
3219 if (scr
->flags
.backimage_helper_launched
) {
3222 if (WMGetPropListItemCount(value
)==0) {
3223 SendHelperMessage(scr
, 'U', 0, NULL
);
3225 /* set the default workspace background to this one */
3226 str
= WMGetPropListDescription(value
, False
);
3228 SendHelperMessage(scr
, 'S', 0, str
);
3230 SendHelperMessage(scr
, 'C', scr
->current_workspace
+1, NULL
);
3232 SendHelperMessage(scr
, 'U', 0, NULL
);
3235 } else if (WMGetPropListItemCount(value
) > 0) {
3241 SetupEnvironment(scr
);
3242 text
= WMGetPropListDescription(value
, False
);
3243 len
= strlen(text
)+40;
3244 command
= wmalloc(len
);
3245 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3246 if (wPreferences
.smooth_workspace_back
)
3247 snprintf(command
, len
, "wmsetbg %s -S -p '%s' &", dither
, text
);
3249 snprintf(command
, len
, "wmsetbg %s -p '%s' &", dither
, text
);
3254 WMReleasePropList(value
);
3261 setWidgetColor(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3263 if (scr
->widget_texture
) {
3264 wTextureDestroy(scr
, (WTexture
*)scr
->widget_texture
);
3266 scr
->widget_texture
= *(WTexSolid
**)texture
;
3273 setFTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3275 if (scr
->window_title_texture
[WS_FOCUSED
]) {
3276 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3278 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3280 return REFRESH_WINDOW_TEXTURES
;
3285 setPTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3287 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
3288 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3290 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3292 return REFRESH_WINDOW_TEXTURES
;
3297 setUTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3299 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
3300 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3302 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3304 return REFRESH_WINDOW_TEXTURES
;
3309 setResizebarBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3311 if (scr
->resizebar_texture
[0]) {
3312 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3314 scr
->resizebar_texture
[0] = *texture
;
3316 return REFRESH_WINDOW_TEXTURES
;
3321 setMenuTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3323 if (scr
->menu_title_texture
[0]) {
3324 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3326 scr
->menu_title_texture
[0] = *texture
;
3328 return REFRESH_MENU_TITLE_TEXTURE
;
3333 setMenuTextBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3335 if (scr
->menu_item_texture
) {
3336 wTextureDestroy(scr
, scr
->menu_item_texture
);
3337 wTextureDestroy(scr
, (WTexture
*)scr
->menu_item_auxtexture
);
3339 scr
->menu_item_texture
= *texture
;
3341 scr
->menu_item_auxtexture
3342 = wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3344 return REFRESH_MENU_TEXTURE
;
3349 setKeyGrab(WScreen
*scr
, WDefaultEntry
*entry
, WShortKey
*shortcut
, long index
)
3352 wKeyBindings
[index
] = *shortcut
;
3354 wwin
= scr
->focused_window
;
3356 while (wwin
!=NULL
) {
3357 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3359 if (!WFLAGP(wwin
, no_bind_keys
)) {
3360 wWindowSetKeyGrabs(wwin
);
3370 setIconPosition(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
3372 wArrangeIcons(scr
, True
);
3379 updateUsableArea(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
3381 wScreenUpdateUsableArea(scr
);
3388 setMenuStyle(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
3390 return REFRESH_MENU_TEXTURE
;
3396 setButtonImages(WScreen *scr, WDefaultEntry *entry, int *value, void *foo)
3398 return REFRESH_BUTTON_IMAGES;
3404 * Need access to the double click variables, so that all widgets in
3405 * wmaker panels will have the same dbl-click values.
3406 * TODO: figure a better way of dealing with it.
3408 #include <WINGs/WINGsP.h>
3411 setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
3413 extern _WINGsConfiguration WINGsConfiguration
;
3418 WINGsConfiguration
.doubleClickDelay
= *value
;
3426 setMultiByte(WScreen
*scr
, WDefaultEntry
*entry
, char *value
, void *foo
)
3428 extern _WINGsConfiguration WINGsConfiguration
;
3430 WINGsConfiguration
.useMultiByte
= *value
;
3438 setCursor(WScreen
*scr
, WDefaultEntry
*entry
, Cursor
*cursor
, long index
)
3440 if (None
!= wCursor
[index
]) {
3441 XFreeCursor(dpy
, wCursor
[index
]);
3444 wCursor
[index
] = *cursor
;
3446 if ((WCUR_ROOT
== index
) && (None
!= *cursor
)) {
3447 XDefineCursor(dpy
, scr
->root_win
, *cursor
);