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>
54 #include <WINGs/WINGsP.h>
56 #include "WindowMaker.h"
62 #include "resources.h"
65 #include "xmodifier.h"
70 #include "workspace.h"
71 #include "properties.h"
77 extern WDDomain
*WDWindowMaker
;
78 extern WDDomain
*WDWindowAttributes
;
79 extern WDDomain
*WDRootMenu
;
81 extern int wScreenCount
;
83 extern Atom _XA_WINDOWMAKER_ICON_SIZE
;
84 extern Atom _XA_WINDOWMAKER_ICON_TILE
;
87 extern WMPropList *wDomainName;
88 extern WMPropList *wAttributeDomainName;
90 extern WPreferences wPreferences
;
92 extern WShortKey wKeyBindings
[WKBD_LAST
];
102 WMPropList
*plvalue
; /* default value */
106 /* used to map strings to integers */
111 } WOptionEnumeration
;
114 /* type converters */
115 static int getBool();
117 static int getCoord();
119 /* this is not used yet */
120 static int getString();
122 static int getPathList();
123 static int getEnum();
124 static int getTexture();
125 static int getWSBackground();
126 static int getWSSpecificBackground();
127 static int getFont();
128 static int getColor();
129 static int getKeybind();
130 static int getModMask();
132 static int getRImage();
136 /* value setting functions */
137 static int setJustify();
138 static int setClearance();
139 static int setIfDockPresent();
140 static int setStickyIcons();
142 static int setPositive();
144 static int setWidgetColor();
145 static int setIconTile();
146 static int setWinTitleFont();
147 static int setMenuTitleFont();
148 static int setMenuTextFont();
149 static int setIconTitleFont();
150 static int setIconTitleColor();
151 static int setIconTitleBack();
152 static int setLargeDisplayFont();
153 static int setWTitleColor();
154 static int setFTitleBack();
155 static int setPTitleBack();
156 static int setUTitleBack();
157 static int setResizebarBack();
158 static int setWorkspaceBack();
159 static int setWorkspaceSpecificBack();
160 static int setMenuTitleColor();
161 static int setMenuTextColor();
162 static int setMenuDisabledColor();
163 static int setMenuTitleBack();
164 static int setMenuTextBack();
165 static int setHightlight();
166 static int setHightlightText();
167 static int setKeyGrab();
168 static int setDoubleClick();
169 static int setIconPosition();
171 static int setClipTitleFont();
172 static int setClipTitleColor();
174 static int setMenuStyle();
176 static int setMultiByte();
178 static int updateUsableArea();
180 extern Cursor wCursor
[WCUR_LAST
];
181 static int getCursor();
182 static int setCursor();
186 * Tables to convert strings to enumeration values.
187 * Values stored are char
191 /* WARNING: sum of length of all value strings must not exceed
193 #define TOTAL_VALUES_LENGTH 80
198 #define REFRESH_WINDOW_TEXTURES (1<<0)
199 #define REFRESH_MENU_TEXTURE (1<<1)
200 #define REFRESH_MENU_FONT (1<<2)
201 #define REFRESH_MENU_COLOR (1<<3)
202 #define REFRESH_MENU_TITLE_TEXTURE (1<<4)
203 #define REFRESH_MENU_TITLE_FONT (1<<5)
204 #define REFRESH_MENU_TITLE_COLOR (1<<6)
205 #define REFRESH_WINDOW_TITLE_COLOR (1<<7)
206 #define REFRESH_WINDOW_FONT (1<<8)
207 #define REFRESH_ICON_TILE (1<<9)
208 #define REFRESH_ICON_FONT (1<<10)
209 #define REFRESH_WORKSPACE_BACK (1<<11)
211 #define REFRESH_BUTTON_IMAGES (1<<12)
213 #define REFRESH_ICON_TITLE_COLOR (1<<13)
214 #define REFRESH_ICON_TITLE_BACK (1<<14)
218 static WOptionEnumeration seFocusModes
[] = {
219 {"Manual", WKF_CLICK
, 0}, {"ClickToFocus", WKF_CLICK
, 1},
220 {"Sloppy", WKF_SLOPPY
, 0}, {"SemiAuto", WKF_SLOPPY
, 1}, {"Auto", WKF_SLOPPY
, 1},
224 static WOptionEnumeration seColormapModes
[] = {
225 {"Manual", WCM_CLICK
, 0}, {"ClickToFocus", WCM_CLICK
, 1},
226 {"Auto", WCM_POINTER
, 0}, {"FocusFollowMouse", WCM_POINTER
, 1},
230 static WOptionEnumeration sePlacements
[] = {
231 {"Auto", WPM_AUTO
, 0},
232 {"Smart", WPM_SMART
, 0},
233 {"Cascade", WPM_CASCADE
, 0},
234 {"Random", WPM_RANDOM
, 0},
235 {"Manual", WPM_MANUAL
, 0},
239 static WOptionEnumeration seGeomDisplays
[] = {
240 {"None", WDIS_NONE
, 0},
241 {"Center", WDIS_CENTER
, 0},
242 {"Corner", WDIS_TOPLEFT
, 0},
243 {"Floating", WDIS_FRAME_CENTER
, 0},
244 {"Line", WDIS_NEW
, 0},
248 static WOptionEnumeration seSpeeds
[] = {
249 {"UltraFast", SPEED_ULTRAFAST
, 0},
250 {"Fast", SPEED_FAST
, 0},
251 {"Medium", SPEED_MEDIUM
, 0},
252 {"Slow", SPEED_SLOW
, 0},
253 {"UltraSlow", SPEED_ULTRASLOW
, 0},
257 static WOptionEnumeration seMouseButtonActions
[] = {
258 {"None", WA_NONE
, 0},
259 {"SelectWindows", WA_SELECT_WINDOWS
, 0},
260 {"OpenApplicationsMenu", WA_OPEN_APPMENU
, 0},
261 {"OpenWindowListMenu", WA_OPEN_WINLISTMENU
, 0},
265 static WOptionEnumeration seMouseWheelActions
[] = {
266 {"None", WA_NONE
, 0},
267 {"SwitchWorkspaces", WA_SWITCH_WORKSPACES
, 0},
271 static WOptionEnumeration seIconificationStyles
[] = {
272 {"Zoom", WIS_ZOOM
, 0},
273 {"Twist", WIS_TWIST
, 0},
274 {"Flip", WIS_FLIP
, 0},
275 {"None", WIS_NONE
, 0},
276 {"random", WIS_RANDOM
, 0},
280 static WOptionEnumeration seJustifications
[] = {
281 {"Left", WTJ_LEFT
, 0},
282 {"Center", WTJ_CENTER
, 0},
283 {"Right", WTJ_RIGHT
, 0},
287 static WOptionEnumeration seIconPositions
[] = {
288 {"blv", IY_BOTTOM
|IY_LEFT
|IY_VERT
, 0},
289 {"blh", IY_BOTTOM
|IY_LEFT
|IY_HORIZ
, 0},
290 {"brv", IY_BOTTOM
|IY_RIGHT
|IY_VERT
, 0},
291 {"brh", IY_BOTTOM
|IY_RIGHT
|IY_HORIZ
, 0},
292 {"tlv", IY_TOP
|IY_LEFT
|IY_VERT
, 0},
293 {"tlh", IY_TOP
|IY_LEFT
|IY_HORIZ
, 0},
294 {"trv", IY_TOP
|IY_RIGHT
|IY_VERT
, 0},
295 {"trh", IY_TOP
|IY_RIGHT
|IY_HORIZ
, 0},
299 static WOptionEnumeration seMenuStyles
[] = {
300 {"normal", MS_NORMAL
, 0},
301 {"singletexture", MS_SINGLE_TEXTURE
, 0},
302 {"flat", MS_FLAT
, 0},
307 static WOptionEnumeration seDisplayPositions
[] = {
308 {"none", WD_NONE
, 0},
309 {"center", WD_CENTER
, 0},
311 {"bottom", WD_BOTTOM
, 0},
312 {"topleft", WD_TOPLEFT
, 0},
313 {"topright", WD_TOPRIGHT
, 0},
314 {"bottomleft", WD_BOTTOMLEFT
, 0},
315 {"bottomright", WD_BOTTOMRIGHT
, 0},
319 static WOptionEnumeration seWorkspaceBorder
[] = {
320 {"None", WB_NONE
, 0},
321 {"LeftRight", WB_LEFTRIGHT
, 0},
322 {"TopBottom", WB_TOPBOTTOM
, 0},
323 {"AllDirections", WB_ALLDIRS
, 0},
329 * ALL entries in the tables bellow, NEED to have a default value
330 * defined, and this value needs to be correct.
333 /* these options will only affect the window manager on startup
335 * static defaults can't access the screen data, because it is
336 * created after these defaults are read
338 WDefaultEntry staticOptionList
[] = {
340 {"ColormapSize", "4", NULL
,
341 &wPreferences
.cmap_size
, getInt
, NULL
343 {"DisableDithering", "NO", NULL
,
344 &wPreferences
.no_dithering
, getBool
, NULL
346 /* static by laziness */
347 {"IconSize", "64", NULL
,
348 &wPreferences
.icon_size
, getInt
, NULL
350 {"ModifierKey", "Mod1", NULL
,
351 &wPreferences
.modifier_mask
, getModMask
, NULL
353 {"DisableWSMouseActions", "NO", NULL
,
354 &wPreferences
.disable_root_mouse
, getBool
, NULL
356 {"FocusMode", "manual", seFocusModes
,
357 &wPreferences
.focus_mode
, getEnum
, NULL
358 }, /* have a problem when switching from manual to sloppy without restart */
359 {"NewStyle", "NO", NULL
,
360 &wPreferences
.new_style
, getBool
, NULL
362 {"DisableDock", "NO", (void*) WM_DOCK
,
363 NULL
, getBool
, setIfDockPresent
365 {"DisableClip", "NO", (void*) WM_CLIP
,
366 NULL
, getBool
, setIfDockPresent
368 {"DisableMiniwindows", "NO", NULL
,
369 &wPreferences
.disable_miniwindows
, getBool
, NULL
372 ,{"MultiByteText", "NO", NULL
,
373 &wPreferences
.multi_byte_text
, getBool
, setMultiByte
380 WDefaultEntry optionList
[] = {
381 /* dynamic options */
382 {"IconPosition", "blh", seIconPositions
,
383 &wPreferences
.icon_yard
, getEnum
, setIconPosition
385 {"IconificationStyle", "Zoom", seIconificationStyles
,
386 &wPreferences
.iconification_style
, getEnum
, NULL
388 {"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions
,
389 &wPreferences
.mouse_button1
, getEnum
, NULL
391 {"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions
,
392 &wPreferences
.mouse_button2
, getEnum
, NULL
394 {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions
,
395 &wPreferences
.mouse_button3
, getEnum
, NULL
397 {"MouseWheelAction", "None", seMouseWheelActions
,
398 &wPreferences
.mouse_wheel
, getEnum
, NULL
400 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
401 &wPreferences
.pixmap_path
, getPathList
, NULL
403 {"IconPath", DEF_ICON_PATHS
, NULL
,
404 &wPreferences
.icon_path
, getPathList
, NULL
406 {"ColormapMode", "auto", seColormapModes
,
407 &wPreferences
.colormap_mode
, getEnum
, NULL
409 {"AutoFocus", "NO", NULL
,
410 &wPreferences
.auto_focus
, getBool
, NULL
412 {"RaiseDelay", "0", NULL
,
413 &wPreferences
.raise_delay
, getInt
, NULL
415 {"WindozeCycling", "NO", NULL
,
416 &wPreferences
.windows_cycling
,getBool
, NULL
418 {"CirculateRaise", "NO", NULL
,
419 &wPreferences
.circ_raise
, getBool
, NULL
421 {"Superfluous", "NO", NULL
,
422 &wPreferences
.superfluous
, getBool
, NULL
424 {"AdvanceToNewWorkspace", "NO", NULL
,
425 &wPreferences
.ws_advance
, getBool
, NULL
427 {"CycleWorkspaces", "NO", NULL
,
428 &wPreferences
.ws_cycle
, getBool
, NULL
430 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
431 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
433 {"WorkspaceBorder", "None", seWorkspaceBorder
,
434 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
436 {"WorkspaceBorderSize", "0", NULL
,
437 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
439 #ifdef VIRTUAL_DESKTOP
440 {"VirtualEdgeThickness", "1", NULL
,
441 &wPreferences
.vedge_thickness
, getInt
, NULL
443 {"VirtualEdgeExtendSpace", "0", NULL
,
444 &wPreferences
.vedge_bordersize
, getInt
, NULL
446 {"VirtualEdgeHorizonScrollSpeed", "1", NULL
,
447 &wPreferences
.vedge_hscrollspeed
, getInt
, NULL
449 {"VirtualEdgeVerticalScrollSpeed", "1", NULL
,
450 &wPreferences
.vedge_vscrollspeed
, getInt
, NULL
452 {"VirtualEdgeMaximumWidth", "3000", NULL
,
453 &wPreferences
.vedge_maxwidth
, getInt
, NULL
455 {"VirtualEdgeMaximumHeight", "3000", NULL
,
456 &wPreferences
.vedge_maxheight
, getInt
, NULL
459 {"StickyIcons", "NO", NULL
,
460 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
462 {"SaveSessionOnExit", "NO", NULL
,
463 &wPreferences
.save_session_on_exit
, getBool
, NULL
465 {"WrapMenus", "NO", NULL
,
466 &wPreferences
.wrap_menus
, getBool
, NULL
468 {"ScrollableMenus", "NO", NULL
,
469 &wPreferences
.scrollable_menus
, getBool
, NULL
471 {"MenuScrollSpeed", "medium", seSpeeds
,
472 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
474 {"IconSlideSpeed", "medium", seSpeeds
,
475 &wPreferences
.icon_slide_speed
, getEnum
, NULL
477 {"ShadeSpeed", "medium", seSpeeds
,
478 &wPreferences
.shade_speed
, getEnum
, NULL
480 {"DoubleClickTime", "250", (void*) &wPreferences
.dblclick_time
,
481 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
,
483 {"AlignSubmenus", "NO", NULL
,
484 &wPreferences
.align_menus
, getBool
, NULL
486 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
487 &wPreferences
.open_transients_with_parent
, getBool
, NULL
489 {"WindowPlacement", "auto", sePlacements
,
490 &wPreferences
.window_placement
, getEnum
, NULL
492 {"IgnoreFocusClick","NO", NULL
,
493 &wPreferences
.ignore_focus_click
, getBool
, NULL
495 {"UseSaveUnders", "NO", NULL
,
496 &wPreferences
.use_saveunders
, getBool
, NULL
498 {"OpaqueMove", "NO", NULL
,
499 &wPreferences
.opaque_move
, getBool
, NULL
501 {"DisableSound", "NO", NULL
,
502 &wPreferences
.no_sound
, getBool
, NULL
504 {"DisableAnimations", "NO", NULL
,
505 &wPreferences
.no_animations
, getBool
, NULL
507 {"DontLinkWorkspaces","NO", NULL
,
508 &wPreferences
.no_autowrap
, getBool
, NULL
510 {"AutoArrangeIcons", "NO", NULL
,
511 &wPreferences
.auto_arrange_icons
, getBool
, NULL
513 {"NoWindowOverDock", "NO", NULL
,
514 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
516 {"NoWindowOverIcons", "NO", NULL
,
517 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
519 {"WindowPlaceOrigin", "(0, 0)", NULL
,
520 &wPreferences
.window_place_origin
, getCoord
, NULL
522 {"ResizeDisplay", "corner", seGeomDisplays
,
523 &wPreferences
.size_display
, getEnum
, NULL
525 {"MoveDisplay", "corner", seGeomDisplays
,
526 &wPreferences
.move_display
, getEnum
, NULL
528 {"DontConfirmKill", "NO", NULL
,
529 &wPreferences
.dont_confirm_kill
, getBool
,NULL
531 {"WindowTitleBalloons", "NO", NULL
,
532 &wPreferences
.window_balloon
, getBool
, NULL
534 {"MiniwindowTitleBalloons", "NO", NULL
,
535 &wPreferences
.miniwin_balloon
,getBool
, NULL
537 {"AppIconBalloons", "NO", NULL
,
538 &wPreferences
.appicon_balloon
,getBool
, NULL
540 {"HelpBalloons", "NO", NULL
,
541 &wPreferences
.help_balloon
, getBool
, NULL
543 {"EdgeResistance", "30", NULL
,
544 &wPreferences
.edge_resistance
,getInt
, NULL
546 {"Attraction", "NO", NULL
,
547 &wPreferences
.attract
, getBool
, NULL
549 {"DisableBlinking", "NO", NULL
,
550 &wPreferences
.dont_blink
, getBool
, NULL
553 {"MenuStyle", "normal", seMenuStyles
,
554 &wPreferences
.menu_style
, getEnum
, setMenuStyle
556 {"WidgetColor", "(solid, gray)", NULL
,
557 NULL
, getTexture
, setWidgetColor
,
559 {"WorkspaceSpecificBack","()", NULL
,
560 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
562 /* WorkspaceBack must come after WorkspaceSpecificBack or
563 * WorkspaceBack wont know WorkspaceSpecificBack was also
564 * specified and 2 copies of wmsetbg will be launched */
565 {"WorkspaceBack", "(solid, black)", NULL
,
566 NULL
, getWSBackground
,setWorkspaceBack
568 {"SmoothWorkspaceBack", "NO", NULL
,
571 {"IconBack", "(solid, gray)", NULL
,
572 NULL
, getTexture
, setIconTile
574 {"TitleJustify", "center", seJustifications
,
575 &wPreferences
.title_justification
, getEnum
, setJustify
577 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
578 NULL
, getFont
, setWinTitleFont
,
580 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
581 &wPreferences
.window_title_clearance
, getInt
, setClearance
583 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
584 &wPreferences
.menu_title_clearance
, getInt
, setClearance
586 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
587 &wPreferences
.menu_text_clearance
, getInt
, setClearance
589 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
590 NULL
, getFont
, setMenuTitleFont
592 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
593 NULL
, getFont
, setMenuTextFont
595 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
596 NULL
, getFont
, setIconTitleFont
598 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
599 NULL
, getFont
, setClipTitleFont
601 {"LargeDisplayFont",DEF_WORKSPACE_NAME_FONT
, NULL
,
602 NULL
, getFont
, setLargeDisplayFont
604 {"HighlightColor", "white", NULL
,
605 NULL
, getColor
, setHightlight
607 {"HighlightTextColor", "black", NULL
,
608 NULL
, getColor
, setHightlightText
610 {"ClipTitleColor", "black", (void*)CLIP_NORMAL
,
611 NULL
, getColor
, setClipTitleColor
613 {"CClipTitleColor", "\"#454045\"", (void*)CLIP_COLLAPSED
,
614 NULL
, getColor
, setClipTitleColor
616 {"FTitleColor", "white", (void*)WS_FOCUSED
,
617 NULL
, getColor
, setWTitleColor
619 {"PTitleColor", "white", (void*)WS_PFOCUSED
,
620 NULL
, getColor
, setWTitleColor
622 {"UTitleColor", "black", (void*)WS_UNFOCUSED
,
623 NULL
, getColor
, setWTitleColor
625 {"FTitleBack", "(solid, black)", NULL
,
626 NULL
, getTexture
, setFTitleBack
628 {"PTitleBack", "(solid, \"#616161\")", NULL
,
629 NULL
, getTexture
, setPTitleBack
631 {"UTitleBack", "(solid, gray)", NULL
,
632 NULL
, getTexture
, setUTitleBack
634 {"ResizebarBack", "(solid, gray)", NULL
,
635 NULL
, getTexture
, setResizebarBack
637 {"MenuTitleColor", "white", NULL
,
638 NULL
, getColor
, setMenuTitleColor
640 {"MenuTextColor", "black", NULL
,
641 NULL
, getColor
, setMenuTextColor
643 {"MenuDisabledColor", "\"#616161\"", NULL
,
644 NULL
, getColor
, setMenuDisabledColor
646 {"MenuTitleBack", "(solid, black)", NULL
,
647 NULL
, getTexture
, setMenuTitleBack
649 {"MenuTextBack", "(solid, gray)", NULL
,
650 NULL
, getTexture
, setMenuTextBack
652 {"IconTitleColor", "white", NULL
,
653 NULL
, getColor
, setIconTitleColor
655 {"IconTitleBack", "black", NULL
,
656 NULL
, getColor
, setIconTitleBack
660 {"RootMenuKey", "None", (void*)WKBD_ROOTMENU
,
661 NULL
, getKeybind
, setKeyGrab
663 {"WindowListKey", "None", (void*)WKBD_WINDOWLIST
,
664 NULL
, getKeybind
, setKeyGrab
667 {"WindowMenuKey", "None", (void*)WKBD_WINDOWMENU
,
668 NULL
, getKeybind
, setKeyGrab
670 {"ClipLowerKey", "None", (void*)WKBD_CLIPLOWER
,
671 NULL
, getKeybind
, setKeyGrab
673 {"ClipRaiseKey", "None", (void*)WKBD_CLIPRAISE
,
674 NULL
, getKeybind
, setKeyGrab
676 {"ClipRaiseLowerKey", "None", (void*)WKBD_CLIPRAISELOWER
,
677 NULL
, getKeybind
, setKeyGrab
679 {"MiniaturizeKey", "None", (void*)WKBD_MINIATURIZE
,
680 NULL
, getKeybind
, setKeyGrab
682 {"HideKey", "None", (void*)WKBD_HIDE
,
683 NULL
, getKeybind
, setKeyGrab
685 {"HideOthersKey", "None", (void*)WKBD_HIDE_OTHERS
,
686 NULL
, getKeybind
, setKeyGrab
688 {"MoveResizeKey", "None", (void*)WKBD_MOVERESIZE
,
689 NULL
, getKeybind
, setKeyGrab
691 {"CloseKey", "None", (void*)WKBD_CLOSE
,
692 NULL
, getKeybind
, setKeyGrab
694 {"MaximizeKey", "None", (void*)WKBD_MAXIMIZE
,
695 NULL
, getKeybind
, setKeyGrab
697 {"VMaximizeKey", "None", (void*)WKBD_VMAXIMIZE
,
698 NULL
, getKeybind
, setKeyGrab
700 {"HMaximizeKey", "None", (void*)WKBD_HMAXIMIZE
,
701 NULL
, getKeybind
, setKeyGrab
703 {"RaiseKey", "\"Meta+Up\"", (void*)WKBD_RAISE
,
704 NULL
, getKeybind
, setKeyGrab
706 {"LowerKey", "\"Meta+Down\"", (void*)WKBD_LOWER
,
707 NULL
, getKeybind
, setKeyGrab
709 {"RaiseLowerKey", "None", (void*)WKBD_RAISELOWER
,
710 NULL
, getKeybind
, setKeyGrab
712 {"ShadeKey", "None", (void*)WKBD_SHADE
,
713 NULL
, getKeybind
, setKeyGrab
715 {"SelectKey", "None", (void*)WKBD_SELECT
,
716 NULL
, getKeybind
, setKeyGrab
718 {"FocusNextKey", "None", (void*)WKBD_FOCUSNEXT
,
719 NULL
, getKeybind
, setKeyGrab
721 {"FocusPrevKey", "None", (void*)WKBD_FOCUSPREV
,
722 NULL
, getKeybind
, setKeyGrab
724 {"NextWorkspaceKey", "None", (void*)WKBD_NEXTWORKSPACE
,
725 NULL
, getKeybind
, setKeyGrab
727 {"PrevWorkspaceKey", "None", (void*)WKBD_PREVWORKSPACE
,
728 NULL
, getKeybind
, setKeyGrab
730 {"NextWorkspaceLayerKey", "None", (void*)WKBD_NEXTWSLAYER
,
731 NULL
, getKeybind
, setKeyGrab
733 {"PrevWorkspaceLayerKey", "None", (void*)WKBD_PREVWSLAYER
,
734 NULL
, getKeybind
, setKeyGrab
736 {"Workspace1Key", "None", (void*)WKBD_WORKSPACE1
,
737 NULL
, getKeybind
, setKeyGrab
739 {"Workspace2Key", "None", (void*)WKBD_WORKSPACE2
,
740 NULL
, getKeybind
, setKeyGrab
742 {"Workspace3Key", "None", (void*)WKBD_WORKSPACE3
,
743 NULL
, getKeybind
, setKeyGrab
745 {"Workspace4Key", "None", (void*)WKBD_WORKSPACE4
,
746 NULL
, getKeybind
, setKeyGrab
748 {"Workspace5Key", "None", (void*)WKBD_WORKSPACE5
,
749 NULL
, getKeybind
, setKeyGrab
751 {"Workspace6Key", "None", (void*)WKBD_WORKSPACE6
,
752 NULL
, getKeybind
, setKeyGrab
754 {"Workspace7Key", "None", (void*)WKBD_WORKSPACE7
,
755 NULL
, getKeybind
, setKeyGrab
757 {"Workspace8Key", "None", (void*)WKBD_WORKSPACE8
,
758 NULL
, getKeybind
, setKeyGrab
760 {"Workspace9Key", "None", (void*)WKBD_WORKSPACE9
,
761 NULL
, getKeybind
, setKeyGrab
763 {"Workspace10Key", "None", (void*)WKBD_WORKSPACE10
,
764 NULL
, getKeybind
, setKeyGrab
766 {"WindowShortcut1Key","None", (void*)WKBD_WINDOW1
,
767 NULL
, getKeybind
, setKeyGrab
769 {"WindowShortcut2Key","None", (void*)WKBD_WINDOW2
,
770 NULL
, getKeybind
, setKeyGrab
772 {"WindowShortcut3Key","None", (void*)WKBD_WINDOW3
,
773 NULL
, getKeybind
, setKeyGrab
775 {"WindowShortcut4Key","None", (void*)WKBD_WINDOW4
,
776 NULL
, getKeybind
, setKeyGrab
778 ,{"WindowShortcut5Key","None", (void*)WKBD_WINDOW5
,
779 NULL
, getKeybind
, setKeyGrab
781 {"WindowShortcut6Key","None", (void*)WKBD_WINDOW6
,
782 NULL
, getKeybind
, setKeyGrab
784 {"WindowShortcut7Key","None", (void*)WKBD_WINDOW7
,
785 NULL
, getKeybind
, setKeyGrab
787 {"WindowShortcut8Key","None", (void*)WKBD_WINDOW8
,
788 NULL
, getKeybind
, setKeyGrab
790 {"WindowShortcut9Key","None", (void*)WKBD_WINDOW9
,
791 NULL
, getKeybind
, setKeyGrab
793 {"WindowShortcut10Key","None", (void*)WKBD_WINDOW10
,
794 NULL
, getKeybind
, setKeyGrab
796 {"ScreenSwitchKey", "None", (void*)WKBD_SWITCH_SCREEN
,
797 NULL
, getKeybind
, setKeyGrab
800 #ifdef KEEP_XKB_LOCK_STATUS
801 {"ToggleKbdModeKey", "None", (void*)WKBD_TOGGLE
,
802 NULL
, getKeybind
, setKeyGrab
804 {"KbdModeLock", "NO", NULL
,
805 &wPreferences
.modelock
, getBool
, NULL
807 #endif /* KEEP_XKB_LOCK_STATUS */
809 {"NormalCursor", "(builtin, left_ptr)", (void*)WCUR_ROOT
,
810 NULL
, getCursor
, setCursor
812 {"ArrowCursor", "(builtin, top_left_arrow)", (void*)WCUR_ARROW
,
813 NULL
, getCursor
, setCursor
815 {"MoveCursor", "(builtin, fleur)", (void*)WCUR_MOVE
,
816 NULL
, getCursor
, setCursor
818 {"ResizeCursor", "(builtin, sizing)", (void*)WCUR_RESIZE
,
819 NULL
, getCursor
, setCursor
821 {"TopLeftResizeCursor", "(builtin, top_left_corner)",
822 (void*)WCUR_TOPLEFTRESIZE
,
823 NULL
, getCursor
, setCursor
825 {"TopRightResizeCursor", "(builtin, top_right_corner)",
826 (void*)WCUR_TOPRIGHTRESIZE
,
827 NULL
, getCursor
, setCursor
829 {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)",
830 (void*)WCUR_BOTTOMLEFTRESIZE
,
831 NULL
, getCursor
, setCursor
833 {"BottomRightResizeCursor", "(builtin, bottom_right_corner)",
834 (void*)WCUR_BOTTOMRIGHTRESIZE
,
835 NULL
, getCursor
, setCursor
837 {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)",
838 (void*)WCUR_VERTICALRESIZE
,
839 NULL
, getCursor
, setCursor
841 {"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)",
842 (void*)WCUR_HORIZONRESIZE
,
843 NULL
, getCursor
, setCursor
845 {"WaitCursor", "(builtin, watch)", (void*)WCUR_WAIT
,
846 NULL
, getCursor
, setCursor
848 {"QuestionCursor", "(builtin, question_arrow)", (void*)WCUR_QUESTION
,
849 NULL
, getCursor
, setCursor
851 {"TextCursor", "(builtin, xterm)", (void*)WCUR_TEXT
,
852 NULL
, getCursor
, setCursor
854 {"SelectCursor", "(builtin, cross)", (void*)WCUR_SELECT
,
855 NULL
, getCursor
, setCursor
861 static void rereadDefaults(void);
868 /* must defer the update because accessing X data from a
869 * signal handler can mess up Xlib */
878 WDefaultEntry
*entry
;
880 WMPLSetCaseSensitive(False
);
882 for (i
=0; i
<sizeof(optionList
)/sizeof(WDefaultEntry
); i
++) {
883 entry
= &optionList
[i
];
885 entry
->plkey
= WMCreatePLString(entry
->key
);
886 if (entry
->default_value
)
887 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
889 entry
->plvalue
= NULL
;
892 for (i
=0; i
<sizeof(staticOptionList
)/sizeof(WDefaultEntry
); i
++) {
893 entry
= &staticOptionList
[i
];
895 entry
->plkey
= WMCreatePLString(entry
->key
);
896 if (entry
->default_value
)
897 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
899 entry
->plvalue
= NULL
;
903 wDomainName = WMCreatePLString(WMDOMAIN_NAME);
904 wAttributeDomainName = WMCreatePLString(WMATTRIBUTE_DOMAIN_NAME);
906 PLRegister(wDomainName, rereadDefaults);
907 PLRegister(wAttributeDomainName, rereadDefaults);
913 readGlobalDomain(char *domainName
, Bool requireDictionary
)
915 WMPropList
*globalDict
= NULL
;
919 snprintf(path
, sizeof(path
), "%s/WindowMaker/%s", SYSCONFDIR
, domainName
);
920 if (stat(path
, &stbuf
)>=0) {
921 globalDict
= WMReadPropListFromFile(path
);
922 if (globalDict
&& requireDictionary
&& !WMIsPLDictionary(globalDict
)) {
923 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
925 WMReleasePropList(globalDict
);
927 } else if (!globalDict
) {
928 wwarning(_("could not load domain %s from global defaults database"),
939 wDefaultsInit(int screen_number
)
941 static int defaults_inited
= 0;
944 if (!defaults_inited
) {
948 dict
= PLGetDomain(wDomainName
);
950 wwarning(_("could not read domain \"%s\" from defaults database"),
951 WMGetFromPLString(wDomainName
));
960 wDefaultsDestroyDomain(WDDomain
*domain
)
962 if (domain
->dictionary
)
963 WMReleasePropList(domain
->dictionary
);
970 wDefaultsInitDomain(char *domain
, Bool requireDictionary
)
974 static int inited
= 0;
977 WMPropList
*shared_dict
=NULL
;
984 db
= wmalloc(sizeof(WDDomain
));
985 memset(db
, 0, sizeof(WDDomain
));
986 db
->domain_name
= domain
;
987 db
->path
= wdefaultspathfordomain(domain
);
990 if (the_path
&& stat(the_path
, &stbuf
)>=0) {
991 db
->dictionary
= WMReadPropListFromFile(the_path
);
992 if (db
->dictionary
) {
993 if (requireDictionary
&& !WMIsPLDictionary(db
->dictionary
)) {
994 WMReleasePropList(db
->dictionary
);
995 db
->dictionary
= NULL
;
996 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
999 db
->timestamp
= stbuf
.st_mtime
;
1001 wwarning(_("could not load domain %s from user defaults database"),
1006 /* global system dictionary */
1007 snprintf(path
, sizeof(path
), "%s/WindowMaker/%s", SYSCONFDIR
, domain
);
1008 if (stat(path
, &stbuf
)>=0) {
1009 shared_dict
= WMReadPropListFromFile(path
);
1011 if (requireDictionary
&& !WMIsPLDictionary(shared_dict
)) {
1012 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
1014 WMReleasePropList(shared_dict
);
1017 if (db
->dictionary
&& WMIsPLDictionary(shared_dict
) &&
1018 WMIsPLDictionary(db
->dictionary
)) {
1019 WMMergePLDictionaries(shared_dict
, db
->dictionary
, True
);
1020 WMReleasePropList(db
->dictionary
);
1021 db
->dictionary
= shared_dict
;
1022 if (stbuf
.st_mtime
> db
->timestamp
)
1023 db
->timestamp
= stbuf
.st_mtime
;
1024 } else if (!db
->dictionary
) {
1025 db
->dictionary
= shared_dict
;
1026 if (stbuf
.st_mtime
> db
->timestamp
)
1027 db
->timestamp
= stbuf
.st_mtime
;
1031 wwarning(_("could not load domain %s from global defaults database (%s)"),
1041 wReadStaticDefaults(WMPropList
*dict
)
1043 WMPropList
*plvalue
;
1044 WDefaultEntry
*entry
;
1049 for (i
=0; i
<sizeof(staticOptionList
)/sizeof(WDefaultEntry
); i
++) {
1050 entry
= &staticOptionList
[i
];
1053 plvalue
= WMGetFromPLDictionary(dict
, entry
->plkey
);
1058 /* no default in the DB. Use builtin default */
1059 plvalue
= entry
->plvalue
;
1064 (*entry
->convert
)(NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
1065 if (entry
->update
) {
1066 (*entry
->update
)(NULL
, entry
, tdata
, entry
->extra_data
);
1074 wDefaultsCheckDomains(void *foo
)
1078 WMPropList
*shared_dict
= NULL
;
1083 puts("Checking domains...");
1085 if (stat(WDWindowMaker
->path
, &stbuf
)>=0
1086 && WDWindowMaker
->timestamp
< stbuf
.st_mtime
) {
1088 puts("Checking WindowMaker domain");
1090 WDWindowMaker
->timestamp
= stbuf
.st_mtime
;
1092 /* global dictionary */
1093 shared_dict
= readGlobalDomain("WindowMaker", True
);
1094 /* user dictionary */
1095 dict
= WMReadPropListFromFile(WDWindowMaker
->path
);
1097 if (!WMIsPLDictionary(dict
)) {
1098 WMReleasePropList(dict
);
1100 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1101 "WindowMaker", WDWindowMaker
->path
);
1104 WMMergePLDictionaries(shared_dict
, dict
, True
);
1105 WMReleasePropList(dict
);
1109 for (i
=0; i
<wScreenCount
; i
++) {
1110 scr
= wScreenWithNumber(i
);
1112 wReadDefaults(scr
, dict
);
1114 if (WDWindowMaker
->dictionary
) {
1115 WMReleasePropList(WDWindowMaker
->dictionary
);
1117 WDWindowMaker
->dictionary
= dict
;
1120 wwarning(_("could not load domain %s from user defaults database"),
1124 WMReleasePropList(shared_dict
);
1128 if (stat(WDWindowAttributes
->path
, &stbuf
)>=0
1129 && WDWindowAttributes
->timestamp
< stbuf
.st_mtime
) {
1131 puts("Checking WMWindowAttributes domain");
1133 /* global dictionary */
1134 shared_dict
= readGlobalDomain("WMWindowAttributes", True
);
1135 /* user dictionary */
1136 dict
= WMReadPropListFromFile(WDWindowAttributes
->path
);
1138 if (!WMIsPLDictionary(dict
)) {
1139 WMReleasePropList(dict
);
1141 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1142 "WMWindowAttributes", WDWindowAttributes
->path
);
1145 WMMergePLDictionaries(shared_dict
, dict
, True
);
1146 WMReleasePropList(dict
);
1150 if (WDWindowAttributes
->dictionary
) {
1151 WMReleasePropList(WDWindowAttributes
->dictionary
);
1153 WDWindowAttributes
->dictionary
= dict
;
1154 for (i
=0; i
<wScreenCount
; i
++) {
1155 scr
= wScreenWithNumber(i
);
1159 wDefaultUpdateIcons(scr
);
1161 /* Update the panel image if changed */
1162 /* Don't worry. If the image is the same these
1163 * functions will have no performance impact. */
1164 image
= wDefaultGetImage(scr
, "Logo", "WMPanel");
1167 wwarning(_("could not load logo image for panels: %s"),
1168 RMessageForError(RErrorCode
));
1170 WMSetApplicationIconImage(scr
->wmscreen
, image
);
1171 RReleaseImage(image
);
1177 wwarning(_("could not load domain %s from user defaults database"),
1178 "WMWindowAttributes");
1180 WDWindowAttributes
->timestamp
= stbuf
.st_mtime
;
1182 WMReleasePropList(shared_dict
);
1187 if (stat(WDRootMenu
->path
, &stbuf
)>=0
1188 && WDRootMenu
->timestamp
< stbuf
.st_mtime
) {
1189 dict
= WMReadPropListFromFile(WDRootMenu
->path
);
1191 puts("Checking WMRootMenu domain");
1194 if (!WMIsPLArray(dict
) && !WMIsPLString(dict
)) {
1195 WMReleasePropList(dict
);
1197 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1198 "WMRootMenu", WDRootMenu
->path
);
1200 if (WDRootMenu
->dictionary
) {
1201 WMReleasePropList(WDRootMenu
->dictionary
);
1203 WDRootMenu
->dictionary
= dict
;
1206 wwarning(_("could not load domain %s from user defaults database"),
1209 WDRootMenu
->timestamp
= stbuf
.st_mtime
;
1214 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, foo
);
1219 wReadDefaults(WScreen
*scr
, WMPropList
*new_dict
)
1221 WMPropList
*plvalue
, *old_value
;
1222 WDefaultEntry
*entry
;
1224 int update_workspace_back
= 0; /* kluge :/ */
1227 WMPropList
*old_dict
= (WDWindowMaker
->dictionary
!=new_dict
1228 ? WDWindowMaker
->dictionary
: NULL
);
1234 for (i
=0; i
<sizeof(optionList
)/sizeof(WDefaultEntry
); i
++) {
1235 entry
= &optionList
[i
];
1238 plvalue
= WMGetFromPLDictionary(new_dict
, entry
->plkey
);
1245 old_value
= WMGetFromPLDictionary(old_dict
, entry
->plkey
);
1248 if (!plvalue
&& !old_value
) {
1249 /* no default in the DB. Use builtin default */
1250 plvalue
= entry
->plvalue
;
1251 if (plvalue
&& new_dict
) {
1252 WMPutInPLDictionary(new_dict
, entry
->plkey
, plvalue
);
1255 } else if (!plvalue
) {
1256 /* value was deleted from DB. Keep current value */
1258 } else if (!old_value
) {
1259 /* set value for the 1st time */
1260 } else if (!WMIsPropListEqualTo(plvalue
, old_value
)) {
1261 /* value has changed */
1264 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1265 && update_workspace_back
1266 && scr
->flags
.backimage_helper_launched
) {
1268 /* value was not changed since last time */
1275 printf("Updating %s to %s\n", entry
->key
,
1276 WMGetPropListDescription(plvalue
, False
));
1279 if ((*entry
->convert
)(scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1281 * If the WorkspaceSpecificBack data has been changed
1282 * so that the helper will be launched now, we must be
1283 * sure to send the default background texture config
1286 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0
1287 && !scr
->flags
.backimage_helper_launched
) {
1288 update_workspace_back
= 1;
1290 if (entry
->update
) {
1292 (*entry
->update
)(scr
, entry
, tdata
, entry
->extra_data
);
1298 if (needs_refresh
!=0 && !scr
->flags
.startup
) {
1302 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1303 foo
|= WTextureSettings
;
1304 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1305 foo
|= WFontSettings
;
1306 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1307 foo
|= WColorSettings
;
1309 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1313 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1314 foo
|= WTextureSettings
;
1315 if (needs_refresh
& REFRESH_MENU_FONT
)
1316 foo
|= WFontSettings
;
1317 if (needs_refresh
& REFRESH_MENU_COLOR
)
1318 foo
|= WColorSettings
;
1320 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
,
1324 if (needs_refresh
& REFRESH_WINDOW_FONT
) {
1325 foo
|= WFontSettings
;
1327 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
) {
1328 foo
|= WTextureSettings
;
1330 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
) {
1331 foo
|= WColorSettings
;
1334 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
,
1337 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1339 if (needs_refresh
& REFRESH_ICON_FONT
) {
1340 foo
|= WFontSettings
;
1342 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
) {
1343 foo
|= WTextureSettings
;
1345 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
) {
1346 foo
|= WTextureSettings
;
1349 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1352 if (needs_refresh
& REFRESH_ICON_TILE
)
1353 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1359 wDefaultUpdateIcons(WScreen
*scr
)
1361 WAppIcon
*aicon
= scr
->app_icon_list
;
1362 WWindow
*wwin
= scr
->focused_window
;
1366 file
= wDefaultGetIconFile(scr
, aicon
->wm_instance
, aicon
->wm_class
,
1368 if ((file
&& aicon
->icon
->file
&& strcmp(file
, aicon
->icon
->file
)!=0)
1369 || (file
&& !aicon
->icon
->file
)) {
1372 if (aicon
->icon
->file
)
1373 wfree(aicon
->icon
->file
);
1374 aicon
->icon
->file
= wstrdup(file
);
1376 new_image
= wDefaultGetImage(scr
, aicon
->wm_instance
,
1379 wIconChangeImage(aicon
->icon
, new_image
);
1380 wAppIconPaint(aicon
);
1383 aicon
= aicon
->next
;
1386 if (!wPreferences
.flags
.noclip
)
1387 wClipIconPaint(scr
->clip_icon
);
1390 if (wwin
->icon
&& wwin
->flags
.miniaturized
) {
1391 file
= wDefaultGetIconFile(scr
, wwin
->wm_instance
, wwin
->wm_class
,
1393 if ((file
&& wwin
->icon
->file
&& strcmp(file
, wwin
->icon
->file
)!=0)
1394 || (file
&& !wwin
->icon
->file
)) {
1397 if (wwin
->icon
->file
)
1398 wfree(wwin
->icon
->file
);
1399 wwin
->icon
->file
= wstrdup(file
);
1401 new_image
= wDefaultGetImage(scr
, wwin
->wm_instance
,
1404 wIconChangeImage(wwin
->icon
, new_image
);
1412 /* --------------------------- Local ----------------------- */
1414 #define GET_STRING_OR_DEFAULT(x, var) if (!WMIsPLString(value)) { \
1415 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1417 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1418 var = entry->default_value;\
1419 } else var = WMGetFromPLString(value)\
1426 string2index(WMPropList
*key
, WMPropList
*val
, char *def
,
1427 WOptionEnumeration
*values
)
1430 WOptionEnumeration
*v
;
1431 char buffer
[TOTAL_VALUES_LENGTH
];
1433 if (WMIsPLString(val
) && (str
= WMGetFromPLString(val
))) {
1434 for (v
=values
; v
->string
!=NULL
; v
++) {
1435 if (strcasecmp(v
->string
, str
)==0)
1441 for (v
=values
; v
->string
!=NULL
; v
++) {
1444 strcat(buffer
, ", ");
1445 strcat(buffer
, v
->string
);
1448 wwarning(_("wrong option value for key \"%s\". Should be one of %s"),
1449 WMGetFromPLString(key
), buffer
);
1452 return string2index(key
, val
, NULL
, values
);
1462 * value - is the value in the defaults DB
1463 * addr - is the address to store the data
1464 * ret - is the address to store a pointer to a temporary buffer. ret
1465 * must not be freed and is used by the set functions
1468 getBool(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1475 GET_STRING_OR_DEFAULT("Boolean", val
);
1478 if ((val
[1]=='\0' && (val
[0]=='y' || val
[0]=='Y'))
1479 || strcasecmp(val
, "YES")==0) {
1482 } else if ((val
[1]=='\0' && (val
[0]=='n' || val
[0]=='N'))
1483 || strcasecmp(val
, "NO")==0) {
1487 if (sscanf(val
, "%i", &i
)==1) {
1493 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""),
1495 if (second_pass
==0) {
1496 val
= WMGetFromPLString(entry
->plvalue
);
1498 wwarning(_("using default \"%s\" instead"), val
);
1509 *(char*)addr
= data
;
1517 getInt(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1524 GET_STRING_OR_DEFAULT("Integer", val
);
1526 if (sscanf(val
, "%i", &data
)!=1) {
1527 wwarning(_("can't convert \"%s\" to integer for key \"%s\""),
1529 val
= WMGetFromPLString(entry
->plvalue
);
1530 wwarning(_("using default \"%s\" instead"), val
);
1531 if (sscanf(val
, "%i", &data
)!=1) {
1547 getCoord(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1551 char *val_x
, *val_y
;
1552 int nelem
, changed
=0;
1553 WMPropList
*elem_x
, *elem_y
;
1556 if (!WMIsPLArray(value
)) {
1557 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1558 entry
->key
, "Coordinate");
1560 value
= entry
->plvalue
;
1562 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1568 nelem
= WMGetPropListItemCount(value
);
1570 wwarning(_("Incorrect number of elements in array for key \"%s\"."),
1573 value
= entry
->plvalue
;
1575 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1581 elem_x
= WMGetFromPLArray(value
, 0);
1582 elem_y
= WMGetFromPLArray(value
, 1);
1584 if (!elem_x
|| !elem_y
|| !WMIsPLString(elem_x
) || !WMIsPLString(elem_y
)) {
1585 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."),
1588 value
= entry
->plvalue
;
1590 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1596 val_x
= WMGetFromPLString(elem_x
);
1597 val_y
= WMGetFromPLString(elem_y
);
1599 if (sscanf(val_x
, "%i", &data
.x
)!=1 || sscanf(val_y
, "%i", &data
.y
)!=1) {
1600 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1602 value
= entry
->plvalue
;
1604 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1612 else if (data
.x
> scr
->scr_width
/3)
1613 data
.x
= scr
->scr_width
/3;
1616 else if (data
.y
> scr
->scr_height
/3)
1617 data
.y
= scr
->scr_height
/3;
1623 *(WCoord
*)addr
= data
;
1631 /* This function is not used at the moment. */
1633 getString(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1638 GET_STRING_OR_DEFAULT("String", data
);
1641 data
= WMGetFromPLString(entry
->plvalue
);
1650 *(char**)addr
= wstrdup(data
);
1658 getPathList(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1668 if (!WMIsPLArray(value
)) {
1669 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1670 entry
->key
, "an array of paths");
1672 value
= entry
->plvalue
;
1674 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1681 count
= WMGetPropListItemCount(value
);
1684 value
= entry
->plvalue
;
1686 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1693 for (i
=0; i
<count
; i
++) {
1694 d
= WMGetFromPLArray(value
, i
);
1695 if (!d
|| !WMIsPLString(d
)) {
1699 len
+= strlen(WMGetFromPLString(d
))+1;
1702 ptr
= data
= wmalloc(len
+1);
1704 for (i
=0; i
<count
; i
++) {
1705 d
= WMGetFromPLArray(value
, i
);
1706 if (!d
|| !WMIsPLString(d
)) {
1709 strcpy(ptr
, WMGetFromPLString(d
));
1710 ptr
+= strlen(WMGetFromPLString(d
));
1714 ptr
--; *(ptr
--) = 0;
1716 if (*(char**)addr
!=NULL
) {
1717 wfree(*(char**)addr
);
1719 *(char**)addr
= data
;
1726 getEnum(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1729 static signed char data
;
1731 data
= string2index(entry
->plkey
, value
, entry
->default_value
,
1732 (WOptionEnumeration
*)entry
->extra_data
);
1740 *(signed char*)addr
= data
;
1749 * (hgradient <color> <color>)
1750 * (vgradient <color> <color>)
1751 * (dgradient <color> <color>)
1752 * (mhgradient <color> <color> ...)
1753 * (mvgradient <color> <color> ...)
1754 * (mdgradient <color> <color> ...)
1755 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1756 * (tpixmap <file> <color>)
1757 * (spixmap <file> <color>)
1758 * (cpixmap <file> <color>)
1759 * (thgradient <file> <opaqueness> <color> <color>)
1760 * (tvgradient <file> <opaqueness> <color> <color>)
1761 * (tdgradient <file> <opaqueness> <color> <color>)
1762 * (function <lib> <function> ...)
1766 parse_texture(WScreen
*scr
, WMPropList
*pl
)
1771 WTexture
*texture
=NULL
;
1773 nelem
= WMGetPropListItemCount(pl
);
1778 elem
= WMGetFromPLArray(pl
, 0);
1779 if (!elem
|| !WMIsPLString(elem
))
1781 val
= WMGetFromPLString(elem
);
1784 if (strcasecmp(val
, "solid")==0) {
1792 elem
= WMGetFromPLArray(pl
, 1);
1793 if (!elem
|| !WMIsPLString(elem
))
1795 val
= WMGetFromPLString(elem
);
1797 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1798 wwarning(_("\"%s\" is not a valid color name"), val
);
1802 texture
= (WTexture
*)wTextureMakeSolid(scr
, &color
);
1803 } else if (strcasecmp(val
, "dgradient")==0
1804 || strcasecmp(val
, "vgradient")==0
1805 || strcasecmp(val
, "hgradient")==0) {
1806 RColor color1
, color2
;
1811 wwarning(_("bad number of arguments in gradient specification"));
1815 if (val
[0]=='d' || val
[0]=='D')
1816 type
= WTEX_DGRADIENT
;
1817 else if (val
[0]=='h' || val
[0]=='H')
1818 type
= WTEX_HGRADIENT
;
1820 type
= WTEX_VGRADIENT
;
1823 /* get from color */
1824 elem
= WMGetFromPLArray(pl
, 1);
1825 if (!elem
|| !WMIsPLString(elem
))
1827 val
= WMGetFromPLString(elem
);
1829 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1830 wwarning(_("\"%s\" is not a valid color name"), val
);
1834 color1
.red
= xcolor
.red
>> 8;
1835 color1
.green
= xcolor
.green
>> 8;
1836 color1
.blue
= xcolor
.blue
>> 8;
1839 elem
= WMGetFromPLArray(pl
, 2);
1840 if (!elem
|| !WMIsPLString(elem
)) {
1843 val
= WMGetFromPLString(elem
);
1845 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1846 wwarning(_("\"%s\" is not a valid color name"), val
);
1850 color2
.red
= xcolor
.red
>> 8;
1851 color2
.green
= xcolor
.green
>> 8;
1852 color2
.blue
= xcolor
.blue
>> 8;
1854 texture
= (WTexture
*)wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1856 } else if (strcasecmp(val
, "igradient")==0) {
1857 RColor colors1
[2], colors2
[2];
1863 wwarning(_("bad number of arguments in gradient specification"));
1867 /* get from color */
1868 for (i
= 0; i
< 2; i
++) {
1869 elem
= WMGetFromPLArray(pl
, 1+i
);
1870 if (!elem
|| !WMIsPLString(elem
))
1872 val
= WMGetFromPLString(elem
);
1874 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1875 wwarning(_("\"%s\" is not a valid color name"), val
);
1878 colors1
[i
].alpha
= 255;
1879 colors1
[i
].red
= xcolor
.red
>> 8;
1880 colors1
[i
].green
= xcolor
.green
>> 8;
1881 colors1
[i
].blue
= xcolor
.blue
>> 8;
1883 elem
= WMGetFromPLArray(pl
, 3);
1884 if (!elem
|| !WMIsPLString(elem
))
1886 val
= WMGetFromPLString(elem
);
1890 /* get from color */
1891 for (i
= 0; i
< 2; i
++) {
1892 elem
= WMGetFromPLArray(pl
, 4+i
);
1893 if (!elem
|| !WMIsPLString(elem
))
1895 val
= WMGetFromPLString(elem
);
1897 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1898 wwarning(_("\"%s\" is not a valid color name"), val
);
1901 colors2
[i
].alpha
= 255;
1902 colors2
[i
].red
= xcolor
.red
>> 8;
1903 colors2
[i
].green
= xcolor
.green
>> 8;
1904 colors2
[i
].blue
= xcolor
.blue
>> 8;
1906 elem
= WMGetFromPLArray(pl
, 6);
1907 if (!elem
|| !WMIsPLString(elem
))
1909 val
= WMGetFromPLString(elem
);
1912 texture
= (WTexture
*)wTextureMakeIGradient(scr
, th1
, colors1
,
1915 } else if (strcasecmp(val
, "mhgradient")==0
1916 || strcasecmp(val
, "mvgradient")==0
1917 || strcasecmp(val
, "mdgradient")==0) {
1924 wwarning(_("too few arguments in multicolor gradient specification"));
1928 if (val
[1]=='h' || val
[1]=='H')
1929 type
= WTEX_MHGRADIENT
;
1930 else if (val
[1]=='v' || val
[1]=='V')
1931 type
= WTEX_MVGRADIENT
;
1933 type
= WTEX_MDGRADIENT
;
1937 colors
= wmalloc(sizeof(RColor
*)*(count
+1));
1939 for (i
=0; i
<count
; i
++) {
1940 elem
= WMGetFromPLArray(pl
, i
+1);
1941 if (!elem
|| !WMIsPLString(elem
)) {
1942 for (--i
; i
>=0; --i
) {
1948 val
= WMGetFromPLString(elem
);
1950 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1951 wwarning(_("\"%s\" is not a valid color name"), val
);
1952 for (--i
; i
>=0; --i
) {
1958 colors
[i
] = wmalloc(sizeof(RColor
));
1959 colors
[i
]->red
= color
.red
>> 8;
1960 colors
[i
]->green
= color
.green
>> 8;
1961 colors
[i
]->blue
= color
.blue
>> 8;
1966 texture
= (WTexture
*)wTextureMakeMGradient(scr
, type
, colors
);
1967 } else if (strcasecmp(val
, "spixmap")==0 ||
1968 strcasecmp(val
, "cpixmap")==0 ||
1969 strcasecmp(val
, "tpixmap")==0) {
1976 if (val
[0] == 's' || val
[0] == 'S')
1978 else if (val
[0] == 'c' || val
[0] == 'C')
1984 elem
= WMGetFromPLArray(pl
, 2);
1985 if (!elem
|| !WMIsPLString(elem
)) {
1988 val
= WMGetFromPLString(elem
);
1990 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1991 wwarning(_("\"%s\" is not a valid color name"), val
);
1996 elem
= WMGetFromPLArray(pl
, 1);
1997 if (!elem
|| !WMIsPLString(elem
))
1999 val
= WMGetFromPLString(elem
);
2001 texture
= (WTexture
*)wTextureMakePixmap(scr
, type
, val
, &color
);
2002 } else if (strcasecmp(val
, "thgradient")==0
2003 || strcasecmp(val
, "tvgradient")==0
2004 || strcasecmp(val
, "tdgradient")==0) {
2005 RColor color1
, color2
;
2010 if (val
[1]=='h' || val
[1]=='H')
2011 style
= WTEX_THGRADIENT
;
2012 else if (val
[1]=='v' || val
[1]=='V')
2013 style
= WTEX_TVGRADIENT
;
2015 style
= WTEX_TDGRADIENT
;
2018 wwarning(_("bad number of arguments in textured gradient specification"));
2022 /* get from color */
2023 elem
= WMGetFromPLArray(pl
, 3);
2024 if (!elem
|| !WMIsPLString(elem
))
2026 val
= WMGetFromPLString(elem
);
2028 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
2029 wwarning(_("\"%s\" is not a valid color name"), val
);
2033 color1
.red
= xcolor
.red
>> 8;
2034 color1
.green
= xcolor
.green
>> 8;
2035 color1
.blue
= xcolor
.blue
>> 8;
2038 elem
= WMGetFromPLArray(pl
, 4);
2039 if (!elem
|| !WMIsPLString(elem
)) {
2042 val
= WMGetFromPLString(elem
);
2044 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
2045 wwarning(_("\"%s\" is not a valid color name"), val
);
2049 color2
.red
= xcolor
.red
>> 8;
2050 color2
.green
= xcolor
.green
>> 8;
2051 color2
.blue
= xcolor
.blue
>> 8;
2054 elem
= WMGetFromPLArray(pl
, 2);
2055 if (!elem
|| !WMIsPLString(elem
))
2058 val
= WMGetFromPLString(elem
);
2060 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
2061 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
2066 elem
= WMGetFromPLArray(pl
, 1);
2067 if (!elem
|| !WMIsPLString(elem
))
2069 val
= WMGetFromPLString(elem
);
2071 texture
= (WTexture
*)wTextureMakeTGradient(scr
, style
, &color1
, &color2
,
2074 #ifdef TEXTURE_PLUGIN
2075 else if (strcasecmp(val
, "function")==0) {
2076 WTexFunction
*function
;
2077 void (*initFunc
) (Display
*, Colormap
);
2078 char *lib
, *func
, **argv
;
2084 /* get the library name */
2085 elem
= WMGetFromPLArray(pl
, 1);
2086 if (!elem
|| !WMIsPLString(elem
)) {
2089 lib
= WMGetFromPLString(elem
);
2091 /* get the function name */
2092 elem
= WMGetFromPLArray(pl
, 2);
2093 if (!elem
|| !WMIsPLString(elem
)) {
2096 func
= WMGetFromPLString(elem
);
2099 argv
= (char **)wmalloc(argc
* sizeof(char *));
2101 /* get the parameters */
2102 argv
[0] = wstrdup(func
);
2103 for (i
= 0; i
< argc
- 1; i
++) {
2104 elem
= WMGetFromPLArray(pl
, 3 + i
);
2105 if (!elem
|| !WMIsPLString(elem
)) {
2110 argv
[i
+1] = wstrdup(WMGetFromPLString(elem
));
2113 function
= wTextureMakeFunction(scr
, lib
, func
, argc
, argv
);
2117 initFunc
= dlsym(function
->handle
, "initWindowMaker");
2119 initFunc(dpy
, scr
->w_colormap
);
2121 wwarning(_("could not initialize library %s"), lib
);
2124 wwarning(_("could not find function %s::%s"), lib
, func
);
2126 #endif /* HAVE_DLFCN_H */
2127 texture
= (WTexture
*)function
;
2129 #endif /* TEXTURE_PLUGIN */
2131 wwarning(_("invalid texture type %s"), val
);
2140 getTexture(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2143 static WTexture
*texture
;
2147 if (!WMIsPLArray(value
)) {
2148 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2149 entry
->key
, "Texture");
2151 value
= entry
->plvalue
;
2153 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2159 if (strcmp(entry
->key
, "WidgetColor")==0 && !changed
) {
2162 pl
= WMGetFromPLArray(value
, 0);
2163 if (!pl
|| !WMIsPLString(pl
) || !WMGetFromPLString(pl
)
2164 || strcasecmp(WMGetFromPLString(pl
), "solid")!=0) {
2165 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2166 entry
->key
, "Solid Texture");
2168 value
= entry
->plvalue
;
2170 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2175 texture
= parse_texture(scr
, value
);
2178 wwarning(_("Error in texture specification for key \"%s\""),
2181 value
= entry
->plvalue
;
2183 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2193 *(WTexture
**)addr
= texture
;
2200 getWSBackground(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
2201 void *addr
, void **ret
)
2209 if (!WMIsPLArray(value
)) {
2210 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2211 "WorkspaceBack", "Texture or None");
2213 value
= entry
->plvalue
;
2215 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2221 /* only do basic error checking and verify for None texture */
2223 nelem
= WMGetPropListItemCount(value
);
2225 elem
= WMGetFromPLArray(value
, 0);
2226 if (!elem
|| !WMIsPLString(elem
)) {
2227 wwarning(_("Wrong type for workspace background. Should be a texture type."));
2229 value
= entry
->plvalue
;
2231 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2236 val
= WMGetFromPLString(elem
);
2238 if (strcasecmp(val
, "None")==0)
2241 *ret
= WMRetainPropList(value
);
2248 getWSSpecificBackground(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
2249 void *addr
, void **ret
)
2256 if (!WMIsPLArray(value
)) {
2257 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2258 "WorkspaceSpecificBack", "an array of textures");
2260 value
= entry
->plvalue
;
2262 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2268 /* only do basic error checking and verify for None texture */
2270 nelem
= WMGetPropListItemCount(value
);
2273 elem
= WMGetFromPLArray(value
, nelem
);
2274 if (!elem
|| !WMIsPLArray(elem
)) {
2275 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2281 *ret
= WMRetainPropList(value
);
2285 * Kluge to force wmsetbg helper to set the default background.
2286 * If the WorkspaceSpecificBack is changed once wmaker has started,
2287 * the WorkspaceBack won't be sent to the helper, unless the user
2288 * changes it's value too. So, we must force this by removing the
2289 * value from the defaults DB.
2291 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2292 WMPropList
*key
= WMCreatePLString("WorkspaceBack");
2294 WMRemoveFromPLDictionary(WDWindowMaker
->dictionary
, key
);
2296 WMReleasePropList(key
);
2304 getFont(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2307 static WMFont
*font
;
2310 GET_STRING_OR_DEFAULT("Font", val
);
2312 font
= WMCreateFont(scr
->wmscreen
, val
);
2314 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2317 wfatal(_("could not load any usable font!!!"));
2324 /* can't assign font value outside update function */
2325 wassertrv(addr
== NULL
, True
);
2332 getColor(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2335 static XColor color
;
2339 GET_STRING_OR_DEFAULT("Color", val
);
2343 if (!wGetColor(scr
, val
, &color
)) {
2344 wwarning(_("could not get color for key \"%s\""),
2346 if (second_pass
==0) {
2347 val
= WMGetFromPLString(entry
->plvalue
);
2349 wwarning(_("using default \"%s\" instead"), val
);
2361 *(unsigned long*)addr = pixel;
2370 getKeybind(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2373 static WShortKey shortcut
;
2380 GET_STRING_OR_DEFAULT("Key spec", val
);
2382 if (!val
|| strcasecmp(val
, "NONE")==0) {
2383 shortcut
.keycode
= 0;
2384 shortcut
.modifier
= 0;
2395 shortcut
.modifier
= 0;
2396 while ((k
= strchr(b
, '+'))!=NULL
) {
2400 mod
= wXModifierFromKey(b
);
2402 wwarning(_("%s:invalid key modifier \"%s\""), entry
->key
, b
);
2405 shortcut
.modifier
|= mod
;
2411 ksym
= XStringToKeysym(b
);
2413 if (ksym
==NoSymbol
) {
2414 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
,
2419 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2420 if (shortcut
.keycode
==0) {
2421 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2433 getModMask(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2436 static unsigned int mask
;
2439 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2444 mask
= wXModifierFromKey(str
);
2446 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2452 *(unsigned int*)addr
= mask
;
2463 getRImages(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
2464 void *addr
, void **ret
)
2472 GET_STRING_OR_DEFAULT("Image File Path", str
);
2476 image
= RLoadImage(scr
->rcontext
, str
, 0);
2478 wwarning(_("could not load image in option %s: %s"), entry
->key
,
2479 RMessageForError(RErrorCode
));
2483 if (*(RImage
**)addr
) {
2484 RReleaseImage(*(RImage
**)addr
);
2487 *(RImage
**)addr
= image
;
2489 assert(ret
== NULL
);
2492 *(RImage**)ret = image;
2499 # include <X11/cursorfont.h>
2506 #define CURSOR_ID_NONE (XC_num_glyphs)
2508 static WCursorLookup cursor_table
[] =
2510 { "X_cursor", XC_X_cursor
},
2511 { "arrow", XC_arrow
},
2512 { "based_arrow_down", XC_based_arrow_down
},
2513 { "based_arrow_up", XC_based_arrow_up
},
2514 { "boat", XC_boat
},
2515 { "bogosity", XC_bogosity
},
2516 { "bottom_left_corner", XC_bottom_left_corner
},
2517 { "bottom_right_corner", XC_bottom_right_corner
},
2518 { "bottom_side", XC_bottom_side
},
2519 { "bottom_tee", XC_bottom_tee
},
2520 { "box_spiral", XC_box_spiral
},
2521 { "center_ptr", XC_center_ptr
},
2522 { "circle", XC_circle
},
2523 { "clock", XC_clock
},
2524 { "coffee_mug", XC_coffee_mug
},
2525 { "cross", XC_cross
},
2526 { "cross_reverse", XC_cross_reverse
},
2527 { "crosshair", XC_crosshair
},
2528 { "diamond_cross", XC_diamond_cross
},
2530 { "dotbox", XC_dotbox
},
2531 { "double_arrow", XC_double_arrow
},
2532 { "draft_large", XC_draft_large
},
2533 { "draft_small", XC_draft_small
},
2534 { "draped_box", XC_draped_box
},
2535 { "exchange", XC_exchange
},
2536 { "fleur", XC_fleur
},
2537 { "gobbler", XC_gobbler
},
2538 { "gumby", XC_gumby
},
2539 { "hand1", XC_hand1
},
2540 { "hand2", XC_hand2
},
2541 { "heart", XC_heart
},
2542 { "icon", XC_icon
},
2543 { "iron_cross", XC_iron_cross
},
2544 { "left_ptr", XC_left_ptr
},
2545 { "left_side", XC_left_side
},
2546 { "left_tee", XC_left_tee
},
2547 { "leftbutton", XC_leftbutton
},
2548 { "ll_angle", XC_ll_angle
},
2549 { "lr_angle", XC_lr_angle
},
2551 { "middlebutton", XC_middlebutton
},
2552 { "mouse", XC_mouse
},
2553 { "pencil", XC_pencil
},
2554 { "pirate", XC_pirate
},
2555 { "plus", XC_plus
},
2556 { "question_arrow", XC_question_arrow
},
2557 { "right_ptr", XC_right_ptr
},
2558 { "right_side", XC_right_side
},
2559 { "right_tee", XC_right_tee
},
2560 { "rightbutton", XC_rightbutton
},
2561 { "rtl_logo", XC_rtl_logo
},
2562 { "sailboat", XC_sailboat
},
2563 { "sb_down_arrow", XC_sb_down_arrow
},
2564 { "sb_h_double_arrow", XC_sb_h_double_arrow
},
2565 { "sb_left_arrow", XC_sb_left_arrow
},
2566 { "sb_right_arrow", XC_sb_right_arrow
},
2567 { "sb_up_arrow", XC_sb_up_arrow
},
2568 { "sb_v_double_arrow", XC_sb_v_double_arrow
},
2569 { "shuttle", XC_shuttle
},
2570 { "sizing", XC_sizing
},
2571 { "spider", XC_spider
},
2572 { "spraycan", XC_spraycan
},
2573 { "star", XC_star
},
2574 { "target", XC_target
},
2575 { "tcross", XC_tcross
},
2576 { "top_left_arrow", XC_top_left_arrow
},
2577 { "top_left_corner", XC_top_left_corner
},
2578 { "top_right_corner", XC_top_right_corner
},
2579 { "top_side", XC_top_side
},
2580 { "top_tee", XC_top_tee
},
2581 { "trek", XC_trek
},
2582 { "ul_angle", XC_ul_angle
},
2583 { "umbrella", XC_umbrella
},
2584 { "ur_angle", XC_ur_angle
},
2585 { "watch", XC_watch
},
2586 { "xterm", XC_xterm
},
2587 { NULL
, CURSOR_ID_NONE
}
2591 check_bitmap_status(int status
, char *filename
, Pixmap bitmap
)
2594 case BitmapOpenFailed
:
2595 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2597 case BitmapFileInvalid
:
2598 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2600 case BitmapNoMemory
:
2601 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2604 XFreePixmap(dpy
, bitmap
);
2611 * (builtin, <cursor_name>)
2612 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2615 parse_cursor(WScreen
*scr
, WMPropList
*pl
, Cursor
*cursor
)
2622 nelem
= WMGetPropListItemCount(pl
);
2626 elem
= WMGetFromPLArray(pl
, 0);
2627 if (!elem
|| !WMIsPLString(elem
)) {
2630 val
= WMGetFromPLString(elem
);
2632 if (0 == strcasecmp(val
, "none")) {
2635 } else if (0 == strcasecmp(val
, "builtin")) {
2637 int cursor_id
= CURSOR_ID_NONE
;
2640 wwarning(_("bad number of arguments in cursor specification"));
2643 elem
= WMGetFromPLArray(pl
, 1);
2644 if (!elem
|| !WMIsPLString(elem
)) {
2647 val
= WMGetFromPLString(elem
);
2649 for (i
= 0; NULL
!= cursor_table
[i
].name
; i
++) {
2650 if (0 == strcasecmp(val
, cursor_table
[i
].name
)) {
2651 cursor_id
= cursor_table
[i
].id
;
2655 if (CURSOR_ID_NONE
== cursor_id
) {
2656 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2658 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2661 } else if (0 == strcasecmp(val
, "bitmap")) {
2673 wwarning(_("bad number of arguments in cursor specification"));
2676 elem
= WMGetFromPLArray(pl
, 1);
2677 if (!elem
|| !WMIsPLString(elem
)) {
2680 val
= WMGetFromPLString(elem
);
2681 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2683 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2686 elem
= WMGetFromPLArray(pl
, 2);
2687 if (!elem
|| !WMIsPLString(elem
)) {
2691 val
= WMGetFromPLString(elem
);
2692 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2695 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2698 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
,
2700 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
,
2702 if ((BitmapSuccess
== bitmap_status
) &&
2703 (BitmapSuccess
== mask_status
)) {
2704 fg
.pixel
= scr
->black_pixel
;
2705 bg
.pixel
= scr
->white_pixel
;
2706 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2707 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2708 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2711 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2712 check_bitmap_status(mask_status
, mask_name
, mask
);
2721 getCursor(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2724 static Cursor cursor
;
2729 if (!WMIsPLArray(value
)) {
2730 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2731 entry
->key
, "cursor specification");
2733 value
= entry
->plvalue
;
2735 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2740 status
= parse_cursor(scr
, value
, &cursor
);
2742 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2744 value
= entry
->plvalue
;
2746 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2755 *(Cursor
*)addr
= cursor
;
2759 #undef CURSOR_ID_NONE
2762 /* ---------------- value setting functions --------------- */
2764 setJustify(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
2766 return REFRESH_WINDOW_TITLE_COLOR
;
2770 setClearance(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
2772 return REFRESH_WINDOW_FONT
|REFRESH_BUTTON_IMAGES
|REFRESH_MENU_TITLE_FONT
|REFRESH_MENU_FONT
;
2776 setIfDockPresent(WScreen
*scr
, WDefaultEntry
*entry
, char *flag
, long which
)
2780 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2783 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2793 setStickyIcons(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
2795 if (scr
->workspaces
) {
2796 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2797 wArrangeIcons(scr
, False
);
2804 setPositive(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
2816 setIconTile(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
2822 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2823 wPreferences
.icon_size
,
2824 ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2825 ? WREL_ICON
: WREL_FLAT
);
2827 wwarning(_("could not render texture for icon background"));
2829 wTextureDestroy(scr
, *texture
);
2832 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2834 if (scr
->icon_tile
) {
2836 RReleaseImage(scr
->icon_tile
);
2837 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2840 scr
->icon_tile
= img
;
2843 /* put the icon in the noticeboard hint */
2844 PropSetIconTileHint(scr
, img
);
2847 if (!wPreferences
.flags
.noclip
) {
2848 if (scr
->clip_tile
) {
2849 RReleaseImage(scr
->clip_tile
);
2851 scr
->clip_tile
= wClipMakeTile(scr
, img
);
2854 scr
->icon_tile_pixmap
= pixmap
;
2856 if (scr
->def_icon_pixmap
) {
2857 XFreePixmap(dpy
, scr
->def_icon_pixmap
);
2858 scr
->def_icon_pixmap
= None
;
2860 if (scr
->def_ticon_pixmap
) {
2861 XFreePixmap(dpy
, scr
->def_ticon_pixmap
);
2862 scr
->def_ticon_pixmap
= None
;
2865 if (scr
->icon_back_texture
) {
2866 wTextureDestroy(scr
, (WTexture
*)scr
->icon_back_texture
);
2868 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2870 if (scr
->clip_balloon
)
2871 XSetWindowBackground(dpy
, scr
->clip_balloon
,
2872 (*texture
)->any
.color
.pixel
);
2875 * Free the texture as nobody else will use it, nor refer to it.
2878 wTextureDestroy(scr
, *texture
);
2880 return (reset
? REFRESH_ICON_TILE
: 0);
2886 setWinTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2888 if (scr
->title_font
) {
2889 WMReleaseFont(scr
->title_font
);
2891 scr
->title_font
= font
;
2893 return REFRESH_WINDOW_FONT
|REFRESH_BUTTON_IMAGES
;
2898 setMenuTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2900 if (scr
->menu_title_font
) {
2901 WMReleaseFont(scr
->menu_title_font
);
2904 scr
->menu_title_font
= font
;
2906 return REFRESH_MENU_TITLE_FONT
;
2911 setMenuTextFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2913 if (scr
->menu_entry_font
) {
2914 WMReleaseFont(scr
->menu_entry_font
);
2916 scr
->menu_entry_font
= font
;
2918 return REFRESH_MENU_FONT
;
2924 setIconTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2926 if (scr
->icon_title_font
) {
2927 WMReleaseFont(scr
->icon_title_font
);
2930 scr
->icon_title_font
= font
;
2932 return REFRESH_ICON_FONT
;
2937 setClipTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2939 if (scr
->clip_title_font
) {
2940 WMReleaseFont(scr
->clip_title_font
);
2943 scr
->clip_title_font
= font
;
2945 return REFRESH_ICON_FONT
;
2950 setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2952 if (scr
->workspace_name_font
) {
2953 WMReleaseFont(scr
->workspace_name_font
);
2956 scr
->workspace_name_font
= font
;
2963 setHightlight(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
2965 if (scr
->select_color
)
2966 WMReleaseColor(scr
->select_color
);
2969 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
,
2972 wFreeColor(scr
, color
->pixel
);
2974 return REFRESH_MENU_COLOR
;
2979 setHightlightText(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
2981 if (scr
->select_text_color
)
2982 WMReleaseColor(scr
->select_text_color
);
2984 scr
->select_text_color
=
2985 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
,
2988 wFreeColor(scr
, color
->pixel
);
2990 return REFRESH_MENU_COLOR
;
2995 setClipTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
2997 if (scr
->clip_title_color
[index
])
2998 WMReleaseColor(scr
->clip_title_color
[index
]);
2999 scr
->clip_title_color
[index
] = WMCreateRGBColor(scr
->wmscreen
, color
->red
,
3000 color
->green
, color
->blue
,
3002 #ifdef GRADIENT_CLIP_ARROW
3003 if (index
== CLIP_NORMAL
) {
3005 RColor color1
, color2
;
3006 int pt
= CLIP_BUTTON_SIZE
*wPreferences
.icon_size
/64;
3007 int as
= pt
- 15; /* 15 = 5+5+5 */
3009 FREE_PIXMAP(scr
->clip_arrow_gradient
);
3011 color1
.red
= (color
->red
>> 8)*6/10;
3012 color1
.green
= (color
->green
>> 8)*6/10;
3013 color1
.blue
= (color
->blue
>> 8)*6/10;
3015 color2
.red
= WMIN((color
->red
>> 8)*20/10, 255);
3016 color2
.green
= WMIN((color
->green
>> 8)*20/10, 255);
3017 color2
.blue
= WMIN((color
->blue
>> 8)*20/10, 255);
3019 image
= RRenderGradient(as
+1, as
+1, &color1
, &color2
, RDiagonalGradient
);
3020 RConvertImage(scr
->rcontext
, image
, &scr
->clip_arrow_gradient
);
3021 RReleaseImage(image
);
3023 #endif /* GRADIENT_CLIP_ARROW */
3025 wFreeColor(scr
, color
->pixel
);
3027 return REFRESH_ICON_TITLE_COLOR
;
3032 setWTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3034 if (scr
->window_title_color
[index
])
3035 WMReleaseColor(scr
->window_title_color
[index
]);
3037 scr
->window_title_color
[index
] =
3038 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
,
3041 wFreeColor(scr
, color
->pixel
);
3043 return REFRESH_WINDOW_TITLE_COLOR
;
3048 setMenuTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3050 if (scr
->menu_title_color
[0])
3051 WMReleaseColor(scr
->menu_title_color
[0]);
3053 scr
->menu_title_color
[0] =
3054 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
,
3057 wFreeColor(scr
, color
->pixel
);
3059 return REFRESH_MENU_TITLE_COLOR
;
3064 setMenuTextColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3066 if (scr
->mtext_color
)
3067 WMReleaseColor(scr
->mtext_color
);
3069 scr
->mtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
,
3070 color
->green
, color
->blue
, True
);
3072 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
3073 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
3075 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
3078 wFreeColor(scr
, color
->pixel
);
3080 return REFRESH_MENU_COLOR
;
3085 setMenuDisabledColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3087 if (scr
->dtext_color
)
3088 WMReleaseColor(scr
->dtext_color
);
3090 scr
->dtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
,
3091 color
->green
, color
->blue
, True
);
3093 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
3094 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
3096 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
3099 wFreeColor(scr
, color
->pixel
);
3101 return REFRESH_MENU_COLOR
;
3106 setIconTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3108 if (scr
->icon_title_color
)
3109 WMReleaseColor(scr
->icon_title_color
);
3110 scr
->icon_title_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
,
3111 color
->green
, color
->blue
,
3114 wFreeColor(scr
, color
->pixel
);
3116 return REFRESH_ICON_TITLE_COLOR
;
3121 setIconTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3123 if (scr
->icon_title_texture
) {
3124 wTextureDestroy(scr
, (WTexture
*)scr
->icon_title_texture
);
3126 // ?? why is this necessary? color was already parsed and alloced
3127 XQueryColor (dpy
, scr
->w_colormap
, color
);
3128 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
3130 return REFRESH_ICON_TITLE_BACK
;
3135 trackDeadProcess(pid_t pid
, unsigned char status
, WScreen
*scr
)
3137 close(scr
->helper_fd
);
3139 scr
->helper_pid
= 0;
3140 scr
->flags
.backimage_helper_launched
= 0;
3145 setWorkspaceSpecificBack(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
3152 if (scr
->flags
.backimage_helper_launched
) {
3153 if (WMGetPropListItemCount(value
)==0) {
3154 SendHelperMessage(scr
, 'C', 0, NULL
);
3155 SendHelperMessage(scr
, 'K', 0, NULL
);
3157 WMReleasePropList(value
);
3164 if (WMGetPropListItemCount(value
) == 0)
3167 if (pipe(filedes
) < 0) {
3168 wsyserror("pipe() failed:can't set workspace specific background image");
3170 WMReleasePropList(value
);
3176 wsyserror("fork() failed:can't set workspace specific background image");
3177 if (close(filedes
[0]) < 0)
3178 wsyserror("could not close pipe");
3179 if (close(filedes
[1]) < 0)
3180 wsyserror("could not close pipe");
3182 } else if (pid
== 0) {
3185 SetupEnvironment(scr
);
3188 wsyserror("could not close pipe");
3189 if (dup(filedes
[0]) < 0) {
3190 wsyserror("dup() failed:can't set workspace specific background image");
3192 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3193 if (wPreferences
.smooth_workspace_back
)
3194 execlp("wmsetbg", "wmsetbg", "-helper", "-S", dither
, NULL
);
3196 execlp("wmsetbg", "wmsetbg", "-helper", dither
, NULL
);
3197 wsyserror("could not execute wmsetbg");
3201 if (fcntl(filedes
[0], F_SETFD
, FD_CLOEXEC
) < 0) {
3202 wsyserror("error setting close-on-exec flag");
3204 if (fcntl(filedes
[1], F_SETFD
, FD_CLOEXEC
) < 0) {
3205 wsyserror("error setting close-on-exec flag");
3208 scr
->helper_fd
= filedes
[1];
3209 scr
->helper_pid
= pid
;
3210 scr
->flags
.backimage_helper_launched
= 1;
3212 wAddDeathHandler(pid
, (WDeathHandler
*)trackDeadProcess
, scr
);
3214 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3219 for (i
= 0; i
< WMGetPropListItemCount(value
); i
++) {
3220 val
= WMGetFromPLArray(value
, i
);
3221 if (val
&& WMIsPLArray(val
) && WMGetPropListItemCount(val
)>0) {
3222 str
= WMGetPropListDescription(val
, False
);
3224 SendHelperMessage(scr
, 'S', i
+1, str
);
3228 SendHelperMessage(scr
, 'U', i
+1, NULL
);
3233 WMReleasePropList(value
);
3239 setWorkspaceBack(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
3242 if (scr
->flags
.backimage_helper_launched
) {
3245 if (WMGetPropListItemCount(value
)==0) {
3246 SendHelperMessage(scr
, 'U', 0, NULL
);
3248 /* set the default workspace background to this one */
3249 str
= WMGetPropListDescription(value
, False
);
3251 SendHelperMessage(scr
, 'S', 0, str
);
3253 SendHelperMessage(scr
, 'C', scr
->current_workspace
+1, NULL
);
3255 SendHelperMessage(scr
, 'U', 0, NULL
);
3258 } else if (WMGetPropListItemCount(value
) > 0) {
3264 SetupEnvironment(scr
);
3265 text
= WMGetPropListDescription(value
, False
);
3266 len
= strlen(text
)+40;
3267 command
= wmalloc(len
);
3268 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3269 if (wPreferences
.smooth_workspace_back
)
3270 snprintf(command
, len
, "wmsetbg %s -S -p '%s' &", dither
, text
);
3272 snprintf(command
, len
, "wmsetbg %s -p '%s' &", dither
, text
);
3277 WMReleasePropList(value
);
3284 setWidgetColor(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3286 if (scr
->widget_texture
) {
3287 wTextureDestroy(scr
, (WTexture
*)scr
->widget_texture
);
3289 scr
->widget_texture
= *(WTexSolid
**)texture
;
3296 setFTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3298 if (scr
->window_title_texture
[WS_FOCUSED
]) {
3299 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3301 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3303 return REFRESH_WINDOW_TEXTURES
;
3308 setPTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3310 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
3311 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3313 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3315 return REFRESH_WINDOW_TEXTURES
;
3320 setUTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3322 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
3323 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3325 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3327 return REFRESH_WINDOW_TEXTURES
;
3332 setResizebarBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3334 if (scr
->resizebar_texture
[0]) {
3335 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3337 scr
->resizebar_texture
[0] = *texture
;
3339 return REFRESH_WINDOW_TEXTURES
;
3344 setMenuTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3346 if (scr
->menu_title_texture
[0]) {
3347 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3349 scr
->menu_title_texture
[0] = *texture
;
3351 return REFRESH_MENU_TITLE_TEXTURE
;
3356 setMenuTextBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3358 if (scr
->menu_item_texture
) {
3359 wTextureDestroy(scr
, scr
->menu_item_texture
);
3360 wTextureDestroy(scr
, (WTexture
*)scr
->menu_item_auxtexture
);
3362 scr
->menu_item_texture
= *texture
;
3364 scr
->menu_item_auxtexture
3365 = wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3367 return REFRESH_MENU_TEXTURE
;
3372 setKeyGrab(WScreen
*scr
, WDefaultEntry
*entry
, WShortKey
*shortcut
, long index
)
3375 wKeyBindings
[index
] = *shortcut
;
3377 wwin
= scr
->focused_window
;
3379 while (wwin
!=NULL
) {
3380 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3382 if (!WFLAGP(wwin
, no_bind_keys
)) {
3383 wWindowSetKeyGrabs(wwin
);
3393 setIconPosition(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
3395 wArrangeIcons(scr
, True
);
3402 updateUsableArea(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
3404 wScreenUpdateUsableArea(scr
);
3411 setMenuStyle(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
3413 return REFRESH_MENU_TEXTURE
;
3419 setButtonImages(WScreen *scr, WDefaultEntry *entry, int *value, void *foo)
3421 return REFRESH_BUTTON_IMAGES;
3427 * Need access to the double click variables, so that all widgets in
3428 * wmaker panels will have the same dbl-click values.
3429 * TODO: figure a better way of dealing with it.
3431 #include <WINGs/WINGsP.h>
3434 setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
3436 extern _WINGsConfiguration WINGsConfiguration
;
3441 WINGsConfiguration
.doubleClickDelay
= *value
;
3449 setMultiByte(WScreen
*scr
, WDefaultEntry
*entry
, char *value
, void *foo
)
3451 extern _WINGsConfiguration WINGsConfiguration
;
3453 WINGsConfiguration
.useMultiByte
= *value
;
3461 setCursor(WScreen
*scr
, WDefaultEntry
*entry
, Cursor
*cursor
, long index
)
3463 if (wCursor
[index
] != None
) {
3464 XFreeCursor(dpy
, wCursor
[index
]);
3467 wCursor
[index
] = *cursor
;
3469 if (index
==WCUR_ROOT
&& *cursor
!=None
) {
3470 XDefineCursor(dpy
, scr
->root_win
, *cursor
);