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 "WindowMaker.h"
60 #include "resources.h"
63 #include "xmodifier.h"
68 #include "workspace.h"
69 #include "properties.h"
75 extern WDDomain
*WDWindowMaker
;
76 extern WDDomain
*WDWindowAttributes
;
77 extern WDDomain
*WDRootMenu
;
79 extern int wScreenCount
;
81 extern Atom _XA_WINDOWMAKER_ICON_SIZE
;
82 extern Atom _XA_WINDOWMAKER_ICON_TILE
;
85 extern WMPropList *wDomainName;
86 extern WMPropList *wAttributeDomainName;
88 extern WPreferences wPreferences
;
90 extern WShortKey wKeyBindings
[WKBD_LAST
];
100 WMPropList
*plvalue
; /* default value */
104 /* used to map strings to integers */
109 } WOptionEnumeration
;
112 /* type converters */
113 static int getBool();
115 static int getCoord();
117 /* this is not used yet */
118 static int getString();
120 static int getPathList();
121 static int getEnum();
122 static int getTexture();
123 static int getWSBackground();
124 static int getWSSpecificBackground();
125 static int getFont();
126 static int getColor();
127 static int getKeybind();
128 static int getModMask();
130 static int getRImage();
134 /* value setting functions */
135 static int setJustify();
136 static int setClearance();
137 static int setIfDockPresent();
138 static int setStickyIcons();
140 static int setPositive();
142 static int setWidgetColor();
143 static int setIconTile();
144 static int setWinTitleFont();
145 static int setMenuTitleFont();
146 static int setMenuTextFont();
147 static int setIconTitleFont();
148 static int setIconTitleColor();
149 static int setIconTitleBack();
150 static int setLargeDisplayFont();
151 static int setWTitleColor();
152 static int setFTitleBack();
153 static int setPTitleBack();
154 static int setUTitleBack();
155 static int setResizebarBack();
156 static int setWorkspaceBack();
157 static int setWorkspaceSpecificBack();
158 static int setMenuTitleColor();
159 static int setMenuTextColor();
160 static int setMenuDisabledColor();
161 static int setMenuTitleBack();
162 static int setMenuTextBack();
163 static int setHightlight();
164 static int setHightlightText();
165 static int setKeyGrab();
166 static int setDoubleClick();
167 static int setIconPosition();
169 static int setClipTitleFont();
170 static int setClipTitleColor();
172 static int setMenuStyle();
174 static int setMultiByte();
176 static int updateUsableArea();
178 extern Cursor wCursor
[WCUR_LAST
];
179 static int getCursor();
180 static int setCursor();
184 * Tables to convert strings to enumeration values.
185 * Values stored are char
189 /* WARNING: sum of length of all value strings must not exceed
191 #define TOTAL_VALUES_LENGTH 80
196 #define REFRESH_WINDOW_TEXTURES (1<<0)
197 #define REFRESH_MENU_TEXTURE (1<<1)
198 #define REFRESH_MENU_FONT (1<<2)
199 #define REFRESH_MENU_COLOR (1<<3)
200 #define REFRESH_MENU_TITLE_TEXTURE (1<<4)
201 #define REFRESH_MENU_TITLE_FONT (1<<5)
202 #define REFRESH_MENU_TITLE_COLOR (1<<6)
203 #define REFRESH_WINDOW_TITLE_COLOR (1<<7)
204 #define REFRESH_WINDOW_FONT (1<<8)
205 #define REFRESH_ICON_TILE (1<<9)
206 #define REFRESH_ICON_FONT (1<<10)
207 #define REFRESH_WORKSPACE_BACK (1<<11)
209 #define REFRESH_BUTTON_IMAGES (1<<12)
211 #define REFRESH_ICON_TITLE_COLOR (1<<13)
212 #define REFRESH_ICON_TITLE_BACK (1<<14)
216 static WOptionEnumeration seFocusModes
[] = {
217 {"Manual", WKF_CLICK
, 0}, {"ClickToFocus", WKF_CLICK
, 1},
218 {"Sloppy", WKF_SLOPPY
, 0}, {"SemiAuto", WKF_SLOPPY
, 1}, {"Auto", WKF_SLOPPY
, 1},
222 static WOptionEnumeration seColormapModes
[] = {
223 {"Manual", WCM_CLICK
, 0}, {"ClickToFocus", WCM_CLICK
, 1},
224 {"Auto", WCM_POINTER
, 0}, {"FocusFollowMouse", WCM_POINTER
, 1},
228 static WOptionEnumeration sePlacements
[] = {
229 {"Auto", WPM_AUTO
, 0},
230 {"Smart", WPM_SMART
, 0},
231 {"Cascade", WPM_CASCADE
, 0},
232 {"Random", WPM_RANDOM
, 0},
233 {"Manual", WPM_MANUAL
, 0},
237 static WOptionEnumeration seGeomDisplays
[] = {
238 {"None", WDIS_NONE
, 0},
239 {"Center", WDIS_CENTER
, 0},
240 {"Corner", WDIS_TOPLEFT
, 0},
241 {"Floating", WDIS_FRAME_CENTER
, 0},
242 {"Line", WDIS_NEW
, 0},
246 static WOptionEnumeration seSpeeds
[] = {
247 {"UltraFast", SPEED_ULTRAFAST
, 0},
248 {"Fast", SPEED_FAST
, 0},
249 {"Medium", SPEED_MEDIUM
, 0},
250 {"Slow", SPEED_SLOW
, 0},
251 {"UltraSlow", SPEED_ULTRASLOW
, 0},
255 static WOptionEnumeration seMouseButtonActions
[] = {
256 {"None", WA_NONE
, 0},
257 {"SelectWindows", WA_SELECT_WINDOWS
, 0},
258 {"OpenApplicationsMenu", WA_OPEN_APPMENU
, 0},
259 {"OpenWindowListMenu", WA_OPEN_WINLISTMENU
, 0},
263 static WOptionEnumeration seMouseWheelActions
[] = {
264 {"None", WA_NONE
, 0},
265 {"SwitchWorkspaces", WA_SWITCH_WORKSPACES
, 0},
269 static WOptionEnumeration seIconificationStyles
[] = {
270 {"Zoom", WIS_ZOOM
, 0},
271 {"Twist", WIS_TWIST
, 0},
272 {"Flip", WIS_FLIP
, 0},
273 {"None", WIS_NONE
, 0},
274 {"random", WIS_RANDOM
, 0},
278 static WOptionEnumeration seJustifications
[] = {
279 {"Left", WTJ_LEFT
, 0},
280 {"Center", WTJ_CENTER
, 0},
281 {"Right", WTJ_RIGHT
, 0},
285 static WOptionEnumeration seIconPositions
[] = {
286 {"blv", IY_BOTTOM
|IY_LEFT
|IY_VERT
, 0},
287 {"blh", IY_BOTTOM
|IY_LEFT
|IY_HORIZ
, 0},
288 {"brv", IY_BOTTOM
|IY_RIGHT
|IY_VERT
, 0},
289 {"brh", IY_BOTTOM
|IY_RIGHT
|IY_HORIZ
, 0},
290 {"tlv", IY_TOP
|IY_LEFT
|IY_VERT
, 0},
291 {"tlh", IY_TOP
|IY_LEFT
|IY_HORIZ
, 0},
292 {"trv", IY_TOP
|IY_RIGHT
|IY_VERT
, 0},
293 {"trh", IY_TOP
|IY_RIGHT
|IY_HORIZ
, 0},
297 static WOptionEnumeration seMenuStyles
[] = {
298 {"normal", MS_NORMAL
, 0},
299 {"singletexture", MS_SINGLE_TEXTURE
, 0},
300 {"flat", MS_FLAT
, 0},
305 static WOptionEnumeration seDisplayPositions
[] = {
306 {"none", WD_NONE
, 0},
307 {"center", WD_CENTER
, 0},
309 {"bottom", WD_BOTTOM
, 0},
310 {"topleft", WD_TOPLEFT
, 0},
311 {"topright", WD_TOPRIGHT
, 0},
312 {"bottomleft", WD_BOTTOMLEFT
, 0},
313 {"bottomright", WD_BOTTOMRIGHT
, 0},
317 static WOptionEnumeration seWorkspaceBorder
[] = {
318 {"None", WB_NONE
, 0},
319 {"LeftRight", WB_LEFTRIGHT
, 0},
320 {"TopBottom", WB_TOPBOTTOM
, 0},
321 {"AllDirections", WB_ALLDIRS
, 0},
327 * ALL entries in the tables bellow, NEED to have a default value
328 * defined, and this value needs to be correct.
331 /* these options will only affect the window manager on startup
333 * static defaults can't access the screen data, because it is
334 * created after these defaults are read
336 WDefaultEntry staticOptionList
[] = {
338 {"ColormapSize", "4", NULL
,
339 &wPreferences
.cmap_size
, getInt
, NULL
341 {"DisableDithering", "NO", NULL
,
342 &wPreferences
.no_dithering
, getBool
, NULL
344 /* static by laziness */
345 {"IconSize", "64", NULL
,
346 &wPreferences
.icon_size
, getInt
, NULL
348 {"ModifierKey", "Mod1", NULL
,
349 &wPreferences
.modifier_mask
, getModMask
, NULL
351 {"DisableWSMouseActions", "NO", NULL
,
352 &wPreferences
.disable_root_mouse
, getBool
, NULL
354 {"FocusMode", "manual", seFocusModes
,
355 &wPreferences
.focus_mode
, getEnum
, NULL
356 }, /* have a problem when switching from manual to sloppy without restart */
357 {"NewStyle", "NO", NULL
,
358 &wPreferences
.new_style
, getBool
, NULL
360 {"DisableDock", "NO", (void*) WM_DOCK
,
361 NULL
, getBool
, setIfDockPresent
363 {"DisableClip", "NO", (void*) WM_CLIP
,
364 NULL
, getBool
, setIfDockPresent
366 {"DisableMiniwindows", "NO", NULL
,
367 &wPreferences
.disable_miniwindows
, getBool
, NULL
370 ,{"MultiByteText", "NO", NULL
,
371 &wPreferences
.multi_byte_text
, getBool
, setMultiByte
378 WDefaultEntry optionList
[] = {
379 /* dynamic options */
380 {"IconPosition", "blh", seIconPositions
,
381 &wPreferences
.icon_yard
, getEnum
, setIconPosition
383 {"IconificationStyle", "Zoom", seIconificationStyles
,
384 &wPreferences
.iconification_style
, getEnum
, NULL
386 {"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions
,
387 &wPreferences
.mouse_button1
, getEnum
, NULL
389 {"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions
,
390 &wPreferences
.mouse_button2
, getEnum
, NULL
392 {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions
,
393 &wPreferences
.mouse_button3
, getEnum
, NULL
395 {"MouseWheelAction", "None", seMouseWheelActions
,
396 &wPreferences
.mouse_wheel
, getEnum
, NULL
398 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
399 &wPreferences
.pixmap_path
, getPathList
, NULL
401 {"IconPath", DEF_ICON_PATHS
, NULL
,
402 &wPreferences
.icon_path
, getPathList
, NULL
404 {"ColormapMode", "auto", seColormapModes
,
405 &wPreferences
.colormap_mode
, getEnum
, NULL
407 {"AutoFocus", "NO", NULL
,
408 &wPreferences
.auto_focus
, getBool
, NULL
410 {"RaiseDelay", "0", NULL
,
411 &wPreferences
.raise_delay
, getInt
, NULL
413 {"WindozeCycling", "NO", NULL
,
414 &wPreferences
.windows_cycling
,getBool
, NULL
416 {"CirculateRaise", "NO", NULL
,
417 &wPreferences
.circ_raise
, getBool
, NULL
419 {"Superfluous", "NO", NULL
,
420 &wPreferences
.superfluous
, getBool
, NULL
422 {"AdvanceToNewWorkspace", "NO", NULL
,
423 &wPreferences
.ws_advance
, getBool
, NULL
425 {"CycleWorkspaces", "NO", NULL
,
426 &wPreferences
.ws_cycle
, getBool
, NULL
428 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
429 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
431 {"WorkspaceBorder", "None", seWorkspaceBorder
,
432 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
434 {"WorkspaceBorderSize", "0", NULL
,
435 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
437 #ifdef VIRTUAL_DESKTOP
438 {"VirtualEdgeThickness", "1", NULL
,
439 &wPreferences
.vedge_thickness
, getInt
, NULL
441 {"VirtualEdgeExtendSpace", "0", NULL
,
442 &wPreferences
.vedge_bordersize
, getInt
, NULL
444 {"VirtualEdgeHorizonScrollSpeed", "1", NULL
,
445 &wPreferences
.vedge_hscrollspeed
, getInt
, NULL
447 {"VirtualEdgeVerticalScrollSpeed", "1", NULL
,
448 &wPreferences
.vedge_vscrollspeed
, getInt
, NULL
450 {"VirtualEdgeMaximumWidth", "3000", NULL
,
451 &wPreferences
.vedge_maxwidth
, getInt
, NULL
453 {"VirtualEdgeMaximumHeight", "3000", NULL
,
454 &wPreferences
.vedge_maxheight
, getInt
, NULL
457 {"StickyIcons", "NO", NULL
,
458 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
460 {"SaveSessionOnExit", "NO", NULL
,
461 &wPreferences
.save_session_on_exit
, getBool
, NULL
463 {"WrapMenus", "NO", NULL
,
464 &wPreferences
.wrap_menus
, getBool
, NULL
466 {"ScrollableMenus", "NO", NULL
,
467 &wPreferences
.scrollable_menus
, getBool
, NULL
469 {"MenuScrollSpeed", "medium", seSpeeds
,
470 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
472 {"IconSlideSpeed", "medium", seSpeeds
,
473 &wPreferences
.icon_slide_speed
, getEnum
, NULL
475 {"ShadeSpeed", "medium", seSpeeds
,
476 &wPreferences
.shade_speed
, getEnum
, NULL
478 {"DoubleClickTime", "250", (void*) &wPreferences
.dblclick_time
,
479 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
,
481 {"AlignSubmenus", "NO", NULL
,
482 &wPreferences
.align_menus
, getBool
, NULL
484 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
485 &wPreferences
.open_transients_with_parent
, getBool
, NULL
487 {"WindowPlacement", "auto", sePlacements
,
488 &wPreferences
.window_placement
, getEnum
, NULL
490 {"IgnoreFocusClick","NO", NULL
,
491 &wPreferences
.ignore_focus_click
, getBool
, NULL
493 {"UseSaveUnders", "NO", NULL
,
494 &wPreferences
.use_saveunders
, getBool
, NULL
496 {"OpaqueMove", "NO", NULL
,
497 &wPreferences
.opaque_move
, getBool
, NULL
499 {"DisableSound", "NO", NULL
,
500 &wPreferences
.no_sound
, getBool
, NULL
502 {"DisableAnimations", "NO", NULL
,
503 &wPreferences
.no_animations
, getBool
, NULL
505 {"DontLinkWorkspaces","NO", NULL
,
506 &wPreferences
.no_autowrap
, getBool
, NULL
508 {"AutoArrangeIcons", "NO", NULL
,
509 &wPreferences
.auto_arrange_icons
, getBool
, NULL
511 {"NoWindowOverDock", "NO", NULL
,
512 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
514 {"NoWindowOverIcons", "NO", NULL
,
515 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
517 {"WindowPlaceOrigin", "(0, 0)", NULL
,
518 &wPreferences
.window_place_origin
, getCoord
, NULL
520 {"ResizeDisplay", "corner", seGeomDisplays
,
521 &wPreferences
.size_display
, getEnum
, NULL
523 {"MoveDisplay", "corner", seGeomDisplays
,
524 &wPreferences
.move_display
, getEnum
, NULL
526 {"DontConfirmKill", "NO", NULL
,
527 &wPreferences
.dont_confirm_kill
, getBool
,NULL
529 {"WindowTitleBalloons", "NO", NULL
,
530 &wPreferences
.window_balloon
, getBool
, NULL
532 {"MiniwindowTitleBalloons", "NO", NULL
,
533 &wPreferences
.miniwin_balloon
,getBool
, NULL
535 {"AppIconBalloons", "NO", NULL
,
536 &wPreferences
.appicon_balloon
,getBool
, NULL
538 {"HelpBalloons", "NO", NULL
,
539 &wPreferences
.help_balloon
, getBool
, NULL
541 {"EdgeResistance", "30", NULL
,
542 &wPreferences
.edge_resistance
,getInt
, NULL
544 {"Attraction", "NO", NULL
,
545 &wPreferences
.attract
, getBool
, NULL
547 {"DisableBlinking", "NO", NULL
,
548 &wPreferences
.dont_blink
, getBool
, NULL
551 {"MenuStyle", "normal", seMenuStyles
,
552 &wPreferences
.menu_style
, getEnum
, setMenuStyle
554 {"WidgetColor", "(solid, gray)", NULL
,
555 NULL
, getTexture
, setWidgetColor
,
557 {"WorkspaceSpecificBack","()", NULL
,
558 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
560 /* WorkspaceBack must come after WorkspaceSpecificBack or
561 * WorkspaceBack wont know WorkspaceSpecificBack was also
562 * specified and 2 copies of wmsetbg will be launched */
563 {"WorkspaceBack", "(solid, black)", NULL
,
564 NULL
, getWSBackground
,setWorkspaceBack
566 {"SmoothWorkspaceBack", "NO", NULL
,
569 {"IconBack", "(solid, gray)", NULL
,
570 NULL
, getTexture
, setIconTile
572 {"TitleJustify", "center", seJustifications
,
573 &wPreferences
.title_justification
, getEnum
, setJustify
575 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
576 NULL
, getFont
, setWinTitleFont
,
578 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
579 &wPreferences
.window_title_clearance
, getInt
, setClearance
581 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
582 &wPreferences
.menu_title_clearance
, getInt
, setClearance
584 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
585 &wPreferences
.menu_text_clearance
, getInt
, setClearance
587 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
588 NULL
, getFont
, setMenuTitleFont
590 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
591 NULL
, getFont
, setMenuTextFont
593 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
594 NULL
, getFont
, setIconTitleFont
596 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
597 NULL
, getFont
, setClipTitleFont
599 {"LargeDisplayFont",DEF_WORKSPACE_NAME_FONT
, NULL
,
600 NULL
, getFont
, setLargeDisplayFont
602 {"HighlightColor", "white", NULL
,
603 NULL
, getColor
, setHightlight
605 {"HighlightTextColor", "black", NULL
,
606 NULL
, getColor
, setHightlightText
608 {"ClipTitleColor", "black", (void*)CLIP_NORMAL
,
609 NULL
, getColor
, setClipTitleColor
611 {"CClipTitleColor", "\"#454045\"", (void*)CLIP_COLLAPSED
,
612 NULL
, getColor
, setClipTitleColor
614 {"FTitleColor", "white", (void*)WS_FOCUSED
,
615 NULL
, getColor
, setWTitleColor
617 {"PTitleColor", "white", (void*)WS_PFOCUSED
,
618 NULL
, getColor
, setWTitleColor
620 {"UTitleColor", "black", (void*)WS_UNFOCUSED
,
621 NULL
, getColor
, setWTitleColor
623 {"FTitleBack", "(solid, black)", NULL
,
624 NULL
, getTexture
, setFTitleBack
626 {"PTitleBack", "(solid, \"#616161\")", NULL
,
627 NULL
, getTexture
, setPTitleBack
629 {"UTitleBack", "(solid, gray)", NULL
,
630 NULL
, getTexture
, setUTitleBack
632 {"ResizebarBack", "(solid, gray)", NULL
,
633 NULL
, getTexture
, setResizebarBack
635 {"MenuTitleColor", "white", NULL
,
636 NULL
, getColor
, setMenuTitleColor
638 {"MenuTextColor", "black", NULL
,
639 NULL
, getColor
, setMenuTextColor
641 {"MenuDisabledColor", "\"#616161\"", NULL
,
642 NULL
, getColor
, setMenuDisabledColor
644 {"MenuTitleBack", "(solid, black)", NULL
,
645 NULL
, getTexture
, setMenuTitleBack
647 {"MenuTextBack", "(solid, gray)", NULL
,
648 NULL
, getTexture
, setMenuTextBack
650 {"IconTitleColor", "white", NULL
,
651 NULL
, getColor
, setIconTitleColor
653 {"IconTitleBack", "black", NULL
,
654 NULL
, getColor
, setIconTitleBack
658 {"RootMenuKey", "None", (void*)WKBD_ROOTMENU
,
659 NULL
, getKeybind
, setKeyGrab
661 {"WindowListKey", "None", (void*)WKBD_WINDOWLIST
,
662 NULL
, getKeybind
, setKeyGrab
665 {"WindowMenuKey", "None", (void*)WKBD_WINDOWMENU
,
666 NULL
, getKeybind
, setKeyGrab
668 {"ClipLowerKey", "None", (void*)WKBD_CLIPLOWER
,
669 NULL
, getKeybind
, setKeyGrab
671 {"ClipRaiseKey", "None", (void*)WKBD_CLIPRAISE
,
672 NULL
, getKeybind
, setKeyGrab
674 {"ClipRaiseLowerKey", "None", (void*)WKBD_CLIPRAISELOWER
,
675 NULL
, getKeybind
, setKeyGrab
677 {"MiniaturizeKey", "None", (void*)WKBD_MINIATURIZE
,
678 NULL
, getKeybind
, setKeyGrab
680 {"HideKey", "None", (void*)WKBD_HIDE
,
681 NULL
, getKeybind
, setKeyGrab
683 {"HideOthersKey", "None", (void*)WKBD_HIDE_OTHERS
,
684 NULL
, getKeybind
, setKeyGrab
686 {"MoveResizeKey", "None", (void*)WKBD_MOVERESIZE
,
687 NULL
, getKeybind
, setKeyGrab
689 {"CloseKey", "None", (void*)WKBD_CLOSE
,
690 NULL
, getKeybind
, setKeyGrab
692 {"MaximizeKey", "None", (void*)WKBD_MAXIMIZE
,
693 NULL
, getKeybind
, setKeyGrab
695 {"VMaximizeKey", "None", (void*)WKBD_VMAXIMIZE
,
696 NULL
, getKeybind
, setKeyGrab
698 {"HMaximizeKey", "None", (void*)WKBD_HMAXIMIZE
,
699 NULL
, getKeybind
, setKeyGrab
701 {"RaiseKey", "\"Meta+Up\"", (void*)WKBD_RAISE
,
702 NULL
, getKeybind
, setKeyGrab
704 {"LowerKey", "\"Meta+Down\"", (void*)WKBD_LOWER
,
705 NULL
, getKeybind
, setKeyGrab
707 {"RaiseLowerKey", "None", (void*)WKBD_RAISELOWER
,
708 NULL
, getKeybind
, setKeyGrab
710 {"ShadeKey", "None", (void*)WKBD_SHADE
,
711 NULL
, getKeybind
, setKeyGrab
713 {"SelectKey", "None", (void*)WKBD_SELECT
,
714 NULL
, getKeybind
, setKeyGrab
716 {"FocusNextKey", "None", (void*)WKBD_FOCUSNEXT
,
717 NULL
, getKeybind
, setKeyGrab
719 {"FocusPrevKey", "None", (void*)WKBD_FOCUSPREV
,
720 NULL
, getKeybind
, setKeyGrab
722 {"NextWorkspaceKey", "None", (void*)WKBD_NEXTWORKSPACE
,
723 NULL
, getKeybind
, setKeyGrab
725 {"PrevWorkspaceKey", "None", (void*)WKBD_PREVWORKSPACE
,
726 NULL
, getKeybind
, setKeyGrab
728 {"NextWorkspaceLayerKey", "None", (void*)WKBD_NEXTWSLAYER
,
729 NULL
, getKeybind
, setKeyGrab
731 {"PrevWorkspaceLayerKey", "None", (void*)WKBD_PREVWSLAYER
,
732 NULL
, getKeybind
, setKeyGrab
734 {"Workspace1Key", "None", (void*)WKBD_WORKSPACE1
,
735 NULL
, getKeybind
, setKeyGrab
737 {"Workspace2Key", "None", (void*)WKBD_WORKSPACE2
,
738 NULL
, getKeybind
, setKeyGrab
740 {"Workspace3Key", "None", (void*)WKBD_WORKSPACE3
,
741 NULL
, getKeybind
, setKeyGrab
743 {"Workspace4Key", "None", (void*)WKBD_WORKSPACE4
,
744 NULL
, getKeybind
, setKeyGrab
746 {"Workspace5Key", "None", (void*)WKBD_WORKSPACE5
,
747 NULL
, getKeybind
, setKeyGrab
749 {"Workspace6Key", "None", (void*)WKBD_WORKSPACE6
,
750 NULL
, getKeybind
, setKeyGrab
752 {"Workspace7Key", "None", (void*)WKBD_WORKSPACE7
,
753 NULL
, getKeybind
, setKeyGrab
755 {"Workspace8Key", "None", (void*)WKBD_WORKSPACE8
,
756 NULL
, getKeybind
, setKeyGrab
758 {"Workspace9Key", "None", (void*)WKBD_WORKSPACE9
,
759 NULL
, getKeybind
, setKeyGrab
761 {"Workspace10Key", "None", (void*)WKBD_WORKSPACE10
,
762 NULL
, getKeybind
, setKeyGrab
764 {"WindowShortcut1Key","None", (void*)WKBD_WINDOW1
,
765 NULL
, getKeybind
, setKeyGrab
767 {"WindowShortcut2Key","None", (void*)WKBD_WINDOW2
,
768 NULL
, getKeybind
, setKeyGrab
770 {"WindowShortcut3Key","None", (void*)WKBD_WINDOW3
,
771 NULL
, getKeybind
, setKeyGrab
773 {"WindowShortcut4Key","None", (void*)WKBD_WINDOW4
,
774 NULL
, getKeybind
, setKeyGrab
776 ,{"WindowShortcut5Key","None", (void*)WKBD_WINDOW5
,
777 NULL
, getKeybind
, setKeyGrab
779 {"WindowShortcut6Key","None", (void*)WKBD_WINDOW6
,
780 NULL
, getKeybind
, setKeyGrab
782 {"WindowShortcut7Key","None", (void*)WKBD_WINDOW7
,
783 NULL
, getKeybind
, setKeyGrab
785 {"WindowShortcut8Key","None", (void*)WKBD_WINDOW8
,
786 NULL
, getKeybind
, setKeyGrab
788 {"WindowShortcut9Key","None", (void*)WKBD_WINDOW9
,
789 NULL
, getKeybind
, setKeyGrab
791 {"WindowShortcut10Key","None", (void*)WKBD_WINDOW10
,
792 NULL
, getKeybind
, setKeyGrab
794 {"ScreenSwitchKey", "None", (void*)WKBD_SWITCH_SCREEN
,
795 NULL
, getKeybind
, setKeyGrab
798 #ifdef KEEP_XKB_LOCK_STATUS
799 {"ToggleKbdModeKey", "None", (void*)WKBD_TOGGLE
,
800 NULL
, getKeybind
, setKeyGrab
802 {"KbdModeLock", "NO", NULL
,
803 &wPreferences
.modelock
, getBool
, NULL
805 #endif /* KEEP_XKB_LOCK_STATUS */
807 {"NormalCursor", "(builtin, left_ptr)", (void*)WCUR_ROOT
,
808 NULL
, getCursor
, setCursor
810 {"ArrowCursor", "(builtin, top_left_arrow)", (void*)WCUR_ARROW
,
811 NULL
, getCursor
, setCursor
813 {"MoveCursor", "(builtin, fleur)", (void*)WCUR_MOVE
,
814 NULL
, getCursor
, setCursor
816 {"ResizeCursor", "(builtin, sizing)", (void*)WCUR_RESIZE
,
817 NULL
, getCursor
, setCursor
819 {"TopLeftResizeCursor", "(builtin, top_left_corner)",
820 (void*)WCUR_TOPLEFTRESIZE
,
821 NULL
, getCursor
, setCursor
823 {"TopRightResizeCursor", "(builtin, top_right_corner)",
824 (void*)WCUR_TOPRIGHTRESIZE
,
825 NULL
, getCursor
, setCursor
827 {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)",
828 (void*)WCUR_BOTTOMLEFTRESIZE
,
829 NULL
, getCursor
, setCursor
831 {"BottomRightResizeCursor", "(builtin, bottom_right_corner)",
832 (void*)WCUR_BOTTOMRIGHTRESIZE
,
833 NULL
, getCursor
, setCursor
835 {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)",
836 (void*)WCUR_VERTICALRESIZE
,
837 NULL
, getCursor
, setCursor
839 {"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)",
840 (void*)WCUR_HORIZONRESIZE
,
841 NULL
, getCursor
, setCursor
843 {"WaitCursor", "(builtin, watch)", (void*)WCUR_WAIT
,
844 NULL
, getCursor
, setCursor
846 {"QuestionCursor", "(builtin, question_arrow)", (void*)WCUR_QUESTION
,
847 NULL
, getCursor
, setCursor
849 {"TextCursor", "(builtin, xterm)", (void*)WCUR_TEXT
,
850 NULL
, getCursor
, setCursor
852 {"SelectCursor", "(builtin, cross)", (void*)WCUR_SELECT
,
853 NULL
, getCursor
, setCursor
859 static void rereadDefaults(void);
866 /* must defer the update because accessing X data from a
867 * signal handler can mess up Xlib */
876 WDefaultEntry
*entry
;
878 WMPLSetCaseSensitive(False
);
880 for (i
=0; i
<sizeof(optionList
)/sizeof(WDefaultEntry
); i
++) {
881 entry
= &optionList
[i
];
883 entry
->plkey
= WMCreatePLString(entry
->key
);
884 if (entry
->default_value
)
885 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
887 entry
->plvalue
= NULL
;
890 for (i
=0; i
<sizeof(staticOptionList
)/sizeof(WDefaultEntry
); i
++) {
891 entry
= &staticOptionList
[i
];
893 entry
->plkey
= WMCreatePLString(entry
->key
);
894 if (entry
->default_value
)
895 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
897 entry
->plvalue
= NULL
;
901 wDomainName = WMCreatePLString(WMDOMAIN_NAME);
902 wAttributeDomainName = WMCreatePLString(WMATTRIBUTE_DOMAIN_NAME);
904 PLRegister(wDomainName, rereadDefaults);
905 PLRegister(wAttributeDomainName, rereadDefaults);
911 readGlobalDomain(char *domainName
, Bool requireDictionary
)
913 WMPropList
*globalDict
= NULL
;
917 snprintf(path
, sizeof(path
), "%s/WindowMaker/%s", SYSCONFDIR
, domainName
);
918 if (stat(path
, &stbuf
)>=0) {
919 globalDict
= WMReadPropListFromFile(path
);
920 if (globalDict
&& requireDictionary
&& !WMIsPLDictionary(globalDict
)) {
921 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
923 WMReleasePropList(globalDict
);
925 } else if (!globalDict
) {
926 wwarning(_("could not load domain %s from global defaults database"),
937 wDefaultsInit(int screen_number
)
939 static int defaults_inited
= 0;
942 if (!defaults_inited
) {
946 dict
= PLGetDomain(wDomainName
);
948 wwarning(_("could not read domain \"%s\" from defaults database"),
949 WMGetFromPLString(wDomainName
));
958 wDefaultsDestroyDomain(WDDomain
*domain
)
960 if (domain
->dictionary
)
961 WMReleasePropList(domain
->dictionary
);
968 wDefaultsInitDomain(char *domain
, Bool requireDictionary
)
972 static int inited
= 0;
975 WMPropList
*shared_dict
=NULL
;
982 db
= wmalloc(sizeof(WDDomain
));
983 memset(db
, 0, sizeof(WDDomain
));
984 db
->domain_name
= domain
;
985 db
->path
= wdefaultspathfordomain(domain
);
988 if (the_path
&& stat(the_path
, &stbuf
)>=0) {
989 db
->dictionary
= WMReadPropListFromFile(the_path
);
990 if (db
->dictionary
) {
991 if (requireDictionary
&& !WMIsPLDictionary(db
->dictionary
)) {
992 WMReleasePropList(db
->dictionary
);
993 db
->dictionary
= NULL
;
994 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
997 db
->timestamp
= stbuf
.st_mtime
;
999 wwarning(_("could not load domain %s from user defaults database"),
1004 /* global system dictionary */
1005 snprintf(path
, sizeof(path
), "%s/WindowMaker/%s", SYSCONFDIR
, domain
);
1006 if (stat(path
, &stbuf
)>=0) {
1007 shared_dict
= WMReadPropListFromFile(path
);
1009 if (requireDictionary
&& !WMIsPLDictionary(shared_dict
)) {
1010 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
1012 WMReleasePropList(shared_dict
);
1015 if (db
->dictionary
&& WMIsPLDictionary(shared_dict
) &&
1016 WMIsPLDictionary(db
->dictionary
)) {
1017 WMMergePLDictionaries(shared_dict
, db
->dictionary
, True
);
1018 WMReleasePropList(db
->dictionary
);
1019 db
->dictionary
= shared_dict
;
1020 if (stbuf
.st_mtime
> db
->timestamp
)
1021 db
->timestamp
= stbuf
.st_mtime
;
1022 } else if (!db
->dictionary
) {
1023 db
->dictionary
= shared_dict
;
1024 if (stbuf
.st_mtime
> db
->timestamp
)
1025 db
->timestamp
= stbuf
.st_mtime
;
1029 wwarning(_("could not load domain %s from global defaults database (%s)"),
1039 wReadStaticDefaults(WMPropList
*dict
)
1041 WMPropList
*plvalue
;
1042 WDefaultEntry
*entry
;
1047 for (i
=0; i
<sizeof(staticOptionList
)/sizeof(WDefaultEntry
); i
++) {
1048 entry
= &staticOptionList
[i
];
1051 plvalue
= WMGetFromPLDictionary(dict
, entry
->plkey
);
1056 /* no default in the DB. Use builtin default */
1057 plvalue
= entry
->plvalue
;
1062 (*entry
->convert
)(NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
1063 if (entry
->update
) {
1064 (*entry
->update
)(NULL
, entry
, tdata
, entry
->extra_data
);
1072 wDefaultsCheckDomains(void *foo
)
1076 WMPropList
*shared_dict
= NULL
;
1081 puts("Checking domains...");
1083 if (stat(WDWindowMaker
->path
, &stbuf
)>=0
1084 && WDWindowMaker
->timestamp
< stbuf
.st_mtime
) {
1086 puts("Checking WindowMaker domain");
1088 WDWindowMaker
->timestamp
= stbuf
.st_mtime
;
1090 /* global dictionary */
1091 shared_dict
= readGlobalDomain("WindowMaker", True
);
1092 /* user dictionary */
1093 dict
= WMReadPropListFromFile(WDWindowMaker
->path
);
1095 if (!WMIsPLDictionary(dict
)) {
1096 WMReleasePropList(dict
);
1098 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1099 "WindowMaker", WDWindowMaker
->path
);
1102 WMMergePLDictionaries(shared_dict
, dict
, True
);
1103 WMReleasePropList(dict
);
1107 for (i
=0; i
<wScreenCount
; i
++) {
1108 scr
= wScreenWithNumber(i
);
1110 wReadDefaults(scr
, dict
);
1112 if (WDWindowMaker
->dictionary
) {
1113 WMReleasePropList(WDWindowMaker
->dictionary
);
1115 WDWindowMaker
->dictionary
= dict
;
1118 wwarning(_("could not load domain %s from user defaults database"),
1122 WMReleasePropList(shared_dict
);
1126 if (stat(WDWindowAttributes
->path
, &stbuf
)>=0
1127 && WDWindowAttributes
->timestamp
< stbuf
.st_mtime
) {
1129 puts("Checking WMWindowAttributes domain");
1131 /* global dictionary */
1132 shared_dict
= readGlobalDomain("WMWindowAttributes", True
);
1133 /* user dictionary */
1134 dict
= WMReadPropListFromFile(WDWindowAttributes
->path
);
1136 if (!WMIsPLDictionary(dict
)) {
1137 WMReleasePropList(dict
);
1139 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1140 "WMWindowAttributes", WDWindowAttributes
->path
);
1143 WMMergePLDictionaries(shared_dict
, dict
, True
);
1144 WMReleasePropList(dict
);
1148 if (WDWindowAttributes
->dictionary
) {
1149 WMReleasePropList(WDWindowAttributes
->dictionary
);
1151 WDWindowAttributes
->dictionary
= dict
;
1152 for (i
=0; i
<wScreenCount
; i
++) {
1153 scr
= wScreenWithNumber(i
);
1157 wDefaultUpdateIcons(scr
);
1159 /* Update the panel image if changed */
1160 /* Don't worry. If the image is the same these
1161 * functions will have no performance impact. */
1162 image
= wDefaultGetImage(scr
, "Logo", "WMPanel");
1165 wwarning(_("could not load logo image for panels: %s"),
1166 RMessageForError(RErrorCode
));
1168 WMSetApplicationIconImage(scr
->wmscreen
, image
);
1169 RReleaseImage(image
);
1175 wwarning(_("could not load domain %s from user defaults database"),
1176 "WMWindowAttributes");
1178 WDWindowAttributes
->timestamp
= stbuf
.st_mtime
;
1180 WMReleasePropList(shared_dict
);
1185 if (stat(WDRootMenu
->path
, &stbuf
)>=0
1186 && WDRootMenu
->timestamp
< stbuf
.st_mtime
) {
1187 dict
= WMReadPropListFromFile(WDRootMenu
->path
);
1189 puts("Checking WMRootMenu domain");
1192 if (!WMIsPLArray(dict
) && !WMIsPLString(dict
)) {
1193 WMReleasePropList(dict
);
1195 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1196 "WMRootMenu", WDRootMenu
->path
);
1198 if (WDRootMenu
->dictionary
) {
1199 WMReleasePropList(WDRootMenu
->dictionary
);
1201 WDRootMenu
->dictionary
= dict
;
1204 wwarning(_("could not load domain %s from user defaults database"),
1207 WDRootMenu
->timestamp
= stbuf
.st_mtime
;
1212 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, foo
);
1217 wReadDefaults(WScreen
*scr
, WMPropList
*new_dict
)
1219 WMPropList
*plvalue
, *old_value
;
1220 WDefaultEntry
*entry
;
1222 int update_workspace_back
= 0; /* kluge :/ */
1225 WMPropList
*old_dict
= (WDWindowMaker
->dictionary
!=new_dict
1226 ? WDWindowMaker
->dictionary
: NULL
);
1232 for (i
=0; i
<sizeof(optionList
)/sizeof(WDefaultEntry
); i
++) {
1233 entry
= &optionList
[i
];
1236 plvalue
= WMGetFromPLDictionary(new_dict
, entry
->plkey
);
1243 old_value
= WMGetFromPLDictionary(old_dict
, entry
->plkey
);
1246 if (!plvalue
&& !old_value
) {
1247 /* no default in the DB. Use builtin default */
1248 plvalue
= entry
->plvalue
;
1249 if (plvalue
&& new_dict
) {
1250 WMPutInPLDictionary(new_dict
, entry
->plkey
, plvalue
);
1253 } else if (!plvalue
) {
1254 /* value was deleted from DB. Keep current value */
1256 } else if (!old_value
) {
1257 /* set value for the 1st time */
1258 } else if (!WMIsPropListEqualTo(plvalue
, old_value
)) {
1259 /* value has changed */
1262 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1263 && update_workspace_back
1264 && scr
->flags
.backimage_helper_launched
) {
1266 /* value was not changed since last time */
1273 printf("Updating %s to %s\n", entry
->key
,
1274 WMGetPropListDescription(plvalue
, False
));
1277 if ((*entry
->convert
)(scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1279 * If the WorkspaceSpecificBack data has been changed
1280 * so that the helper will be launched now, we must be
1281 * sure to send the default background texture config
1284 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0
1285 && !scr
->flags
.backimage_helper_launched
) {
1286 update_workspace_back
= 1;
1288 if (entry
->update
) {
1290 (*entry
->update
)(scr
, entry
, tdata
, entry
->extra_data
);
1296 if (needs_refresh
!=0 && !scr
->flags
.startup
) {
1300 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1301 foo
|= WTextureSettings
;
1302 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1303 foo
|= WFontSettings
;
1304 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1305 foo
|= WColorSettings
;
1307 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1311 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1312 foo
|= WTextureSettings
;
1313 if (needs_refresh
& REFRESH_MENU_FONT
)
1314 foo
|= WFontSettings
;
1315 if (needs_refresh
& REFRESH_MENU_COLOR
)
1316 foo
|= WColorSettings
;
1318 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
,
1322 if (needs_refresh
& REFRESH_WINDOW_FONT
) {
1323 foo
|= WFontSettings
;
1325 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
) {
1326 foo
|= WTextureSettings
;
1328 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
) {
1329 foo
|= WColorSettings
;
1332 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
,
1335 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1337 if (needs_refresh
& REFRESH_ICON_FONT
) {
1338 foo
|= WFontSettings
;
1340 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
) {
1341 foo
|= WTextureSettings
;
1343 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
) {
1344 foo
|= WTextureSettings
;
1347 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1350 if (needs_refresh
& REFRESH_ICON_TILE
)
1351 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1357 wDefaultUpdateIcons(WScreen
*scr
)
1359 WAppIcon
*aicon
= scr
->app_icon_list
;
1360 WWindow
*wwin
= scr
->focused_window
;
1364 file
= wDefaultGetIconFile(scr
, aicon
->wm_instance
, aicon
->wm_class
,
1366 if ((file
&& aicon
->icon
->file
&& strcmp(file
, aicon
->icon
->file
)!=0)
1367 || (file
&& !aicon
->icon
->file
)) {
1370 if (aicon
->icon
->file
)
1371 wfree(aicon
->icon
->file
);
1372 aicon
->icon
->file
= wstrdup(file
);
1374 new_image
= wDefaultGetImage(scr
, aicon
->wm_instance
,
1377 wIconChangeImage(aicon
->icon
, new_image
);
1378 wAppIconPaint(aicon
);
1381 aicon
= aicon
->next
;
1384 if (!wPreferences
.flags
.noclip
)
1385 wClipIconPaint(scr
->clip_icon
);
1388 if (wwin
->icon
&& wwin
->flags
.miniaturized
) {
1389 file
= wDefaultGetIconFile(scr
, wwin
->wm_instance
, wwin
->wm_class
,
1391 if ((file
&& wwin
->icon
->file
&& strcmp(file
, wwin
->icon
->file
)!=0)
1392 || (file
&& !wwin
->icon
->file
)) {
1395 if (wwin
->icon
->file
)
1396 wfree(wwin
->icon
->file
);
1397 wwin
->icon
->file
= wstrdup(file
);
1399 new_image
= wDefaultGetImage(scr
, wwin
->wm_instance
,
1402 wIconChangeImage(wwin
->icon
, new_image
);
1410 /* --------------------------- Local ----------------------- */
1412 #define GET_STRING_OR_DEFAULT(x, var) if (!WMIsPLString(value)) { \
1413 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1415 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1416 var = entry->default_value;\
1417 } else var = WMGetFromPLString(value)\
1424 string2index(WMPropList
*key
, WMPropList
*val
, char *def
,
1425 WOptionEnumeration
*values
)
1428 WOptionEnumeration
*v
;
1429 char buffer
[TOTAL_VALUES_LENGTH
];
1431 if (WMIsPLString(val
) && (str
= WMGetFromPLString(val
))) {
1432 for (v
=values
; v
->string
!=NULL
; v
++) {
1433 if (strcasecmp(v
->string
, str
)==0)
1439 for (v
=values
; v
->string
!=NULL
; v
++) {
1442 strcat(buffer
, ", ");
1443 strcat(buffer
, v
->string
);
1446 wwarning(_("wrong option value for key \"%s\". Should be one of %s"),
1447 WMGetFromPLString(key
), buffer
);
1450 return string2index(key
, val
, NULL
, values
);
1460 * value - is the value in the defaults DB
1461 * addr - is the address to store the data
1462 * ret - is the address to store a pointer to a temporary buffer. ret
1463 * must not be freed and is used by the set functions
1466 getBool(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1473 GET_STRING_OR_DEFAULT("Boolean", val
);
1476 if ((val
[1]=='\0' && (val
[0]=='y' || val
[0]=='Y'))
1477 || strcasecmp(val
, "YES")==0) {
1480 } else if ((val
[1]=='\0' && (val
[0]=='n' || val
[0]=='N'))
1481 || strcasecmp(val
, "NO")==0) {
1485 if (sscanf(val
, "%i", &i
)==1) {
1491 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""),
1493 if (second_pass
==0) {
1494 val
= WMGetFromPLString(entry
->plvalue
);
1496 wwarning(_("using default \"%s\" instead"), val
);
1507 *(char*)addr
= data
;
1515 getInt(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1522 GET_STRING_OR_DEFAULT("Integer", val
);
1524 if (sscanf(val
, "%i", &data
)!=1) {
1525 wwarning(_("can't convert \"%s\" to integer for key \"%s\""),
1527 val
= WMGetFromPLString(entry
->plvalue
);
1528 wwarning(_("using default \"%s\" instead"), val
);
1529 if (sscanf(val
, "%i", &data
)!=1) {
1545 getCoord(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1549 char *val_x
, *val_y
;
1550 int nelem
, changed
=0;
1551 WMPropList
*elem_x
, *elem_y
;
1554 if (!WMIsPLArray(value
)) {
1555 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1556 entry
->key
, "Coordinate");
1558 value
= entry
->plvalue
;
1560 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1566 nelem
= WMGetPropListItemCount(value
);
1568 wwarning(_("Incorrect number of elements in array for key \"%s\"."),
1571 value
= entry
->plvalue
;
1573 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1579 elem_x
= WMGetFromPLArray(value
, 0);
1580 elem_y
= WMGetFromPLArray(value
, 1);
1582 if (!elem_x
|| !elem_y
|| !WMIsPLString(elem_x
) || !WMIsPLString(elem_y
)) {
1583 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."),
1586 value
= entry
->plvalue
;
1588 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1594 val_x
= WMGetFromPLString(elem_x
);
1595 val_y
= WMGetFromPLString(elem_y
);
1597 if (sscanf(val_x
, "%i", &data
.x
)!=1 || sscanf(val_y
, "%i", &data
.y
)!=1) {
1598 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1600 value
= entry
->plvalue
;
1602 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1610 else if (data
.x
> scr
->scr_width
/3)
1611 data
.x
= scr
->scr_width
/3;
1614 else if (data
.y
> scr
->scr_height
/3)
1615 data
.y
= scr
->scr_height
/3;
1621 *(WCoord
*)addr
= data
;
1629 /* This function is not used at the moment. */
1631 getString(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1636 GET_STRING_OR_DEFAULT("String", data
);
1639 data
= WMGetFromPLString(entry
->plvalue
);
1648 *(char**)addr
= wstrdup(data
);
1656 getPathList(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1666 if (!WMIsPLArray(value
)) {
1667 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1668 entry
->key
, "an array of paths");
1670 value
= entry
->plvalue
;
1672 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1679 count
= WMGetPropListItemCount(value
);
1682 value
= entry
->plvalue
;
1684 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1691 for (i
=0; i
<count
; i
++) {
1692 d
= WMGetFromPLArray(value
, i
);
1693 if (!d
|| !WMIsPLString(d
)) {
1697 len
+= strlen(WMGetFromPLString(d
))+1;
1700 ptr
= data
= wmalloc(len
+1);
1702 for (i
=0; i
<count
; i
++) {
1703 d
= WMGetFromPLArray(value
, i
);
1704 if (!d
|| !WMIsPLString(d
)) {
1707 strcpy(ptr
, WMGetFromPLString(d
));
1708 ptr
+= strlen(WMGetFromPLString(d
));
1712 ptr
--; *(ptr
--) = 0;
1714 if (*(char**)addr
!=NULL
) {
1715 wfree(*(char**)addr
);
1717 *(char**)addr
= data
;
1724 getEnum(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1727 static signed char data
;
1729 data
= string2index(entry
->plkey
, value
, entry
->default_value
,
1730 (WOptionEnumeration
*)entry
->extra_data
);
1738 *(signed char*)addr
= data
;
1747 * (hgradient <color> <color>)
1748 * (vgradient <color> <color>)
1749 * (dgradient <color> <color>)
1750 * (mhgradient <color> <color> ...)
1751 * (mvgradient <color> <color> ...)
1752 * (mdgradient <color> <color> ...)
1753 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1754 * (tpixmap <file> <color>)
1755 * (spixmap <file> <color>)
1756 * (cpixmap <file> <color>)
1757 * (thgradient <file> <opaqueness> <color> <color>)
1758 * (tvgradient <file> <opaqueness> <color> <color>)
1759 * (tdgradient <file> <opaqueness> <color> <color>)
1760 * (function <lib> <function> ...)
1764 parse_texture(WScreen
*scr
, WMPropList
*pl
)
1769 WTexture
*texture
=NULL
;
1771 nelem
= WMGetPropListItemCount(pl
);
1776 elem
= WMGetFromPLArray(pl
, 0);
1777 if (!elem
|| !WMIsPLString(elem
))
1779 val
= WMGetFromPLString(elem
);
1782 if (strcasecmp(val
, "solid")==0) {
1790 elem
= WMGetFromPLArray(pl
, 1);
1791 if (!elem
|| !WMIsPLString(elem
))
1793 val
= WMGetFromPLString(elem
);
1795 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1796 wwarning(_("\"%s\" is not a valid color name"), val
);
1800 texture
= (WTexture
*)wTextureMakeSolid(scr
, &color
);
1801 } else if (strcasecmp(val
, "dgradient")==0
1802 || strcasecmp(val
, "vgradient")==0
1803 || strcasecmp(val
, "hgradient")==0) {
1804 RColor color1
, color2
;
1809 wwarning(_("bad number of arguments in gradient specification"));
1813 if (val
[0]=='d' || val
[0]=='D')
1814 type
= WTEX_DGRADIENT
;
1815 else if (val
[0]=='h' || val
[0]=='H')
1816 type
= WTEX_HGRADIENT
;
1818 type
= WTEX_VGRADIENT
;
1821 /* get from color */
1822 elem
= WMGetFromPLArray(pl
, 1);
1823 if (!elem
|| !WMIsPLString(elem
))
1825 val
= WMGetFromPLString(elem
);
1827 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1828 wwarning(_("\"%s\" is not a valid color name"), val
);
1832 color1
.red
= xcolor
.red
>> 8;
1833 color1
.green
= xcolor
.green
>> 8;
1834 color1
.blue
= xcolor
.blue
>> 8;
1837 elem
= WMGetFromPLArray(pl
, 2);
1838 if (!elem
|| !WMIsPLString(elem
)) {
1841 val
= WMGetFromPLString(elem
);
1843 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1844 wwarning(_("\"%s\" is not a valid color name"), val
);
1848 color2
.red
= xcolor
.red
>> 8;
1849 color2
.green
= xcolor
.green
>> 8;
1850 color2
.blue
= xcolor
.blue
>> 8;
1852 texture
= (WTexture
*)wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1854 } else if (strcasecmp(val
, "igradient")==0) {
1855 RColor colors1
[2], colors2
[2];
1861 wwarning(_("bad number of arguments in gradient specification"));
1865 /* get from color */
1866 for (i
= 0; i
< 2; i
++) {
1867 elem
= WMGetFromPLArray(pl
, 1+i
);
1868 if (!elem
|| !WMIsPLString(elem
))
1870 val
= WMGetFromPLString(elem
);
1872 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1873 wwarning(_("\"%s\" is not a valid color name"), val
);
1876 colors1
[i
].alpha
= 255;
1877 colors1
[i
].red
= xcolor
.red
>> 8;
1878 colors1
[i
].green
= xcolor
.green
>> 8;
1879 colors1
[i
].blue
= xcolor
.blue
>> 8;
1881 elem
= WMGetFromPLArray(pl
, 3);
1882 if (!elem
|| !WMIsPLString(elem
))
1884 val
= WMGetFromPLString(elem
);
1888 /* get from color */
1889 for (i
= 0; i
< 2; i
++) {
1890 elem
= WMGetFromPLArray(pl
, 4+i
);
1891 if (!elem
|| !WMIsPLString(elem
))
1893 val
= WMGetFromPLString(elem
);
1895 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1896 wwarning(_("\"%s\" is not a valid color name"), val
);
1899 colors2
[i
].alpha
= 255;
1900 colors2
[i
].red
= xcolor
.red
>> 8;
1901 colors2
[i
].green
= xcolor
.green
>> 8;
1902 colors2
[i
].blue
= xcolor
.blue
>> 8;
1904 elem
= WMGetFromPLArray(pl
, 6);
1905 if (!elem
|| !WMIsPLString(elem
))
1907 val
= WMGetFromPLString(elem
);
1910 texture
= (WTexture
*)wTextureMakeIGradient(scr
, th1
, colors1
,
1913 } else if (strcasecmp(val
, "mhgradient")==0
1914 || strcasecmp(val
, "mvgradient")==0
1915 || strcasecmp(val
, "mdgradient")==0) {
1922 wwarning(_("too few arguments in multicolor gradient specification"));
1926 if (val
[1]=='h' || val
[1]=='H')
1927 type
= WTEX_MHGRADIENT
;
1928 else if (val
[1]=='v' || val
[1]=='V')
1929 type
= WTEX_MVGRADIENT
;
1931 type
= WTEX_MDGRADIENT
;
1935 colors
= wmalloc(sizeof(RColor
*)*(count
+1));
1937 for (i
=0; i
<count
; i
++) {
1938 elem
= WMGetFromPLArray(pl
, i
+1);
1939 if (!elem
|| !WMIsPLString(elem
)) {
1940 for (--i
; i
>=0; --i
) {
1946 val
= WMGetFromPLString(elem
);
1948 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1949 wwarning(_("\"%s\" is not a valid color name"), val
);
1950 for (--i
; i
>=0; --i
) {
1956 colors
[i
] = wmalloc(sizeof(RColor
));
1957 colors
[i
]->red
= color
.red
>> 8;
1958 colors
[i
]->green
= color
.green
>> 8;
1959 colors
[i
]->blue
= color
.blue
>> 8;
1964 texture
= (WTexture
*)wTextureMakeMGradient(scr
, type
, colors
);
1965 } else if (strcasecmp(val
, "spixmap")==0 ||
1966 strcasecmp(val
, "cpixmap")==0 ||
1967 strcasecmp(val
, "tpixmap")==0) {
1974 if (val
[0] == 's' || val
[0] == 'S')
1976 else if (val
[0] == 'c' || val
[0] == 'C')
1982 elem
= WMGetFromPLArray(pl
, 2);
1983 if (!elem
|| !WMIsPLString(elem
)) {
1986 val
= WMGetFromPLString(elem
);
1988 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1989 wwarning(_("\"%s\" is not a valid color name"), val
);
1994 elem
= WMGetFromPLArray(pl
, 1);
1995 if (!elem
|| !WMIsPLString(elem
))
1997 val
= WMGetFromPLString(elem
);
1999 texture
= (WTexture
*)wTextureMakePixmap(scr
, type
, val
, &color
);
2000 } else if (strcasecmp(val
, "thgradient")==0
2001 || strcasecmp(val
, "tvgradient")==0
2002 || strcasecmp(val
, "tdgradient")==0) {
2003 RColor color1
, color2
;
2008 if (val
[1]=='h' || val
[1]=='H')
2009 style
= WTEX_THGRADIENT
;
2010 else if (val
[1]=='v' || val
[1]=='V')
2011 style
= WTEX_TVGRADIENT
;
2013 style
= WTEX_TDGRADIENT
;
2016 wwarning(_("bad number of arguments in textured gradient specification"));
2020 /* get from color */
2021 elem
= WMGetFromPLArray(pl
, 3);
2022 if (!elem
|| !WMIsPLString(elem
))
2024 val
= WMGetFromPLString(elem
);
2026 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
2027 wwarning(_("\"%s\" is not a valid color name"), val
);
2031 color1
.red
= xcolor
.red
>> 8;
2032 color1
.green
= xcolor
.green
>> 8;
2033 color1
.blue
= xcolor
.blue
>> 8;
2036 elem
= WMGetFromPLArray(pl
, 4);
2037 if (!elem
|| !WMIsPLString(elem
)) {
2040 val
= WMGetFromPLString(elem
);
2042 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
2043 wwarning(_("\"%s\" is not a valid color name"), val
);
2047 color2
.red
= xcolor
.red
>> 8;
2048 color2
.green
= xcolor
.green
>> 8;
2049 color2
.blue
= xcolor
.blue
>> 8;
2052 elem
= WMGetFromPLArray(pl
, 2);
2053 if (!elem
|| !WMIsPLString(elem
))
2056 val
= WMGetFromPLString(elem
);
2058 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
2059 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
2064 elem
= WMGetFromPLArray(pl
, 1);
2065 if (!elem
|| !WMIsPLString(elem
))
2067 val
= WMGetFromPLString(elem
);
2069 texture
= (WTexture
*)wTextureMakeTGradient(scr
, style
, &color1
, &color2
,
2072 #ifdef TEXTURE_PLUGIN
2073 else if (strcasecmp(val
, "function")==0) {
2074 WTexFunction
*function
;
2075 void (*initFunc
) (Display
*, Colormap
);
2076 char *lib
, *func
, **argv
;
2082 /* get the library name */
2083 elem
= WMGetFromPLArray(pl
, 1);
2084 if (!elem
|| !WMIsPLString(elem
)) {
2087 lib
= WMGetFromPLString(elem
);
2089 /* get the function name */
2090 elem
= WMGetFromPLArray(pl
, 2);
2091 if (!elem
|| !WMIsPLString(elem
)) {
2094 func
= WMGetFromPLString(elem
);
2097 argv
= (char **)wmalloc(argc
* sizeof(char *));
2099 /* get the parameters */
2100 argv
[0] = wstrdup(func
);
2101 for (i
= 0; i
< argc
- 1; i
++) {
2102 elem
= WMGetFromPLArray(pl
, 3 + i
);
2103 if (!elem
|| !WMIsPLString(elem
)) {
2108 argv
[i
+1] = wstrdup(WMGetFromPLString(elem
));
2111 function
= wTextureMakeFunction(scr
, lib
, func
, argc
, argv
);
2115 initFunc
= dlsym(function
->handle
, "initWindowMaker");
2117 initFunc(dpy
, scr
->w_colormap
);
2119 wwarning(_("could not initialize library %s"), lib
);
2122 wwarning(_("could not find function %s::%s"), lib
, func
);
2124 #endif /* HAVE_DLFCN_H */
2125 texture
= (WTexture
*)function
;
2127 #endif /* TEXTURE_PLUGIN */
2129 wwarning(_("invalid texture type %s"), val
);
2138 getTexture(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2141 static WTexture
*texture
;
2145 if (!WMIsPLArray(value
)) {
2146 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2147 entry
->key
, "Texture");
2149 value
= entry
->plvalue
;
2151 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2157 if (strcmp(entry
->key
, "WidgetColor")==0 && !changed
) {
2160 pl
= WMGetFromPLArray(value
, 0);
2161 if (!pl
|| !WMIsPLString(pl
) || !WMGetFromPLString(pl
)
2162 || strcasecmp(WMGetFromPLString(pl
), "solid")!=0) {
2163 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2164 entry
->key
, "Solid Texture");
2166 value
= entry
->plvalue
;
2168 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2173 texture
= parse_texture(scr
, value
);
2176 wwarning(_("Error in texture specification for key \"%s\""),
2179 value
= entry
->plvalue
;
2181 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2191 *(WTexture
**)addr
= texture
;
2198 getWSBackground(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
2199 void *addr
, void **ret
)
2207 if (!WMIsPLArray(value
)) {
2208 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2209 "WorkspaceBack", "Texture or None");
2211 value
= entry
->plvalue
;
2213 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2219 /* only do basic error checking and verify for None texture */
2221 nelem
= WMGetPropListItemCount(value
);
2223 elem
= WMGetFromPLArray(value
, 0);
2224 if (!elem
|| !WMIsPLString(elem
)) {
2225 wwarning(_("Wrong type for workspace background. Should be a texture type."));
2227 value
= entry
->plvalue
;
2229 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2234 val
= WMGetFromPLString(elem
);
2236 if (strcasecmp(val
, "None")==0)
2239 *ret
= WMRetainPropList(value
);
2246 getWSSpecificBackground(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
2247 void *addr
, void **ret
)
2254 if (!WMIsPLArray(value
)) {
2255 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2256 "WorkspaceSpecificBack", "an array of textures");
2258 value
= entry
->plvalue
;
2260 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2266 /* only do basic error checking and verify for None texture */
2268 nelem
= WMGetPropListItemCount(value
);
2271 elem
= WMGetFromPLArray(value
, nelem
);
2272 if (!elem
|| !WMIsPLArray(elem
)) {
2273 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2279 *ret
= WMRetainPropList(value
);
2283 * Kluge to force wmsetbg helper to set the default background.
2284 * If the WorkspaceSpecificBack is changed once wmaker has started,
2285 * the WorkspaceBack won't be sent to the helper, unless the user
2286 * changes it's value too. So, we must force this by removing the
2287 * value from the defaults DB.
2289 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2290 WMPropList
*key
= WMCreatePLString("WorkspaceBack");
2292 WMRemoveFromPLDictionary(WDWindowMaker
->dictionary
, key
);
2294 WMReleasePropList(key
);
2302 getFont(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2305 static WMFont
*font
;
2308 GET_STRING_OR_DEFAULT("Font", val
);
2310 font
= WMCreateFont(scr
->wmscreen
, val
);
2312 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2315 wfatal(_("could not load any usable font!!!"));
2322 /* can't assign font value outside update function */
2323 wassertrv(addr
== NULL
, True
);
2330 getColor(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2333 static XColor color
;
2337 GET_STRING_OR_DEFAULT("Color", val
);
2341 if (!wGetColor(scr
, val
, &color
)) {
2342 wwarning(_("could not get color for key \"%s\""),
2344 if (second_pass
==0) {
2345 val
= WMGetFromPLString(entry
->plvalue
);
2347 wwarning(_("using default \"%s\" instead"), val
);
2359 *(unsigned long*)addr = pixel;
2368 getKeybind(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2371 static WShortKey shortcut
;
2378 GET_STRING_OR_DEFAULT("Key spec", val
);
2380 if (!val
|| strcasecmp(val
, "NONE")==0) {
2381 shortcut
.keycode
= 0;
2382 shortcut
.modifier
= 0;
2393 shortcut
.modifier
= 0;
2394 while ((k
= strchr(b
, '+'))!=NULL
) {
2398 mod
= wXModifierFromKey(b
);
2400 wwarning(_("%s:invalid key modifier \"%s\""), entry
->key
, b
);
2403 shortcut
.modifier
|= mod
;
2409 ksym
= XStringToKeysym(b
);
2411 if (ksym
==NoSymbol
) {
2412 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
,
2417 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2418 if (shortcut
.keycode
==0) {
2419 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2431 getModMask(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2434 static unsigned int mask
;
2437 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2442 mask
= wXModifierFromKey(str
);
2444 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2450 *(unsigned int*)addr
= mask
;
2461 getRImages(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
2462 void *addr
, void **ret
)
2470 GET_STRING_OR_DEFAULT("Image File Path", str
);
2474 image
= RLoadImage(scr
->rcontext
, str
, 0);
2476 wwarning(_("could not load image in option %s: %s"), entry
->key
,
2477 RMessageForError(RErrorCode
));
2481 if (*(RImage
**)addr
) {
2482 RReleaseImage(*(RImage
**)addr
);
2485 *(RImage
**)addr
= image
;
2487 assert(ret
== NULL
);
2490 *(RImage**)ret = image;
2497 # include <X11/cursorfont.h>
2504 #define CURSOR_ID_NONE (XC_num_glyphs)
2506 static WCursorLookup cursor_table
[] =
2508 { "X_cursor", XC_X_cursor
},
2509 { "arrow", XC_arrow
},
2510 { "based_arrow_down", XC_based_arrow_down
},
2511 { "based_arrow_up", XC_based_arrow_up
},
2512 { "boat", XC_boat
},
2513 { "bogosity", XC_bogosity
},
2514 { "bottom_left_corner", XC_bottom_left_corner
},
2515 { "bottom_right_corner", XC_bottom_right_corner
},
2516 { "bottom_side", XC_bottom_side
},
2517 { "bottom_tee", XC_bottom_tee
},
2518 { "box_spiral", XC_box_spiral
},
2519 { "center_ptr", XC_center_ptr
},
2520 { "circle", XC_circle
},
2521 { "clock", XC_clock
},
2522 { "coffee_mug", XC_coffee_mug
},
2523 { "cross", XC_cross
},
2524 { "cross_reverse", XC_cross_reverse
},
2525 { "crosshair", XC_crosshair
},
2526 { "diamond_cross", XC_diamond_cross
},
2528 { "dotbox", XC_dotbox
},
2529 { "double_arrow", XC_double_arrow
},
2530 { "draft_large", XC_draft_large
},
2531 { "draft_small", XC_draft_small
},
2532 { "draped_box", XC_draped_box
},
2533 { "exchange", XC_exchange
},
2534 { "fleur", XC_fleur
},
2535 { "gobbler", XC_gobbler
},
2536 { "gumby", XC_gumby
},
2537 { "hand1", XC_hand1
},
2538 { "hand2", XC_hand2
},
2539 { "heart", XC_heart
},
2540 { "icon", XC_icon
},
2541 { "iron_cross", XC_iron_cross
},
2542 { "left_ptr", XC_left_ptr
},
2543 { "left_side", XC_left_side
},
2544 { "left_tee", XC_left_tee
},
2545 { "leftbutton", XC_leftbutton
},
2546 { "ll_angle", XC_ll_angle
},
2547 { "lr_angle", XC_lr_angle
},
2549 { "middlebutton", XC_middlebutton
},
2550 { "mouse", XC_mouse
},
2551 { "pencil", XC_pencil
},
2552 { "pirate", XC_pirate
},
2553 { "plus", XC_plus
},
2554 { "question_arrow", XC_question_arrow
},
2555 { "right_ptr", XC_right_ptr
},
2556 { "right_side", XC_right_side
},
2557 { "right_tee", XC_right_tee
},
2558 { "rightbutton", XC_rightbutton
},
2559 { "rtl_logo", XC_rtl_logo
},
2560 { "sailboat", XC_sailboat
},
2561 { "sb_down_arrow", XC_sb_down_arrow
},
2562 { "sb_h_double_arrow", XC_sb_h_double_arrow
},
2563 { "sb_left_arrow", XC_sb_left_arrow
},
2564 { "sb_right_arrow", XC_sb_right_arrow
},
2565 { "sb_up_arrow", XC_sb_up_arrow
},
2566 { "sb_v_double_arrow", XC_sb_v_double_arrow
},
2567 { "shuttle", XC_shuttle
},
2568 { "sizing", XC_sizing
},
2569 { "spider", XC_spider
},
2570 { "spraycan", XC_spraycan
},
2571 { "star", XC_star
},
2572 { "target", XC_target
},
2573 { "tcross", XC_tcross
},
2574 { "top_left_arrow", XC_top_left_arrow
},
2575 { "top_left_corner", XC_top_left_corner
},
2576 { "top_right_corner", XC_top_right_corner
},
2577 { "top_side", XC_top_side
},
2578 { "top_tee", XC_top_tee
},
2579 { "trek", XC_trek
},
2580 { "ul_angle", XC_ul_angle
},
2581 { "umbrella", XC_umbrella
},
2582 { "ur_angle", XC_ur_angle
},
2583 { "watch", XC_watch
},
2584 { "xterm", XC_xterm
},
2585 { NULL
, CURSOR_ID_NONE
}
2589 check_bitmap_status(int status
, char *filename
, Pixmap bitmap
)
2592 case BitmapOpenFailed
:
2593 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2595 case BitmapFileInvalid
:
2596 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2598 case BitmapNoMemory
:
2599 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2602 XFreePixmap(dpy
, bitmap
);
2609 * (builtin, <cursor_name>)
2610 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2613 parse_cursor(WScreen
*scr
, WMPropList
*pl
, Cursor
*cursor
)
2620 nelem
= WMGetPropListItemCount(pl
);
2624 elem
= WMGetFromPLArray(pl
, 0);
2625 if (!elem
|| !WMIsPLString(elem
)) {
2628 val
= WMGetFromPLString(elem
);
2630 if (0 == strcasecmp(val
, "none")) {
2633 } else if (0 == strcasecmp(val
, "builtin")) {
2635 int cursor_id
= CURSOR_ID_NONE
;
2638 wwarning(_("bad number of arguments in cursor specification"));
2641 elem
= WMGetFromPLArray(pl
, 1);
2642 if (!elem
|| !WMIsPLString(elem
)) {
2645 val
= WMGetFromPLString(elem
);
2647 for (i
= 0; NULL
!= cursor_table
[i
].name
; i
++) {
2648 if (0 == strcasecmp(val
, cursor_table
[i
].name
)) {
2649 cursor_id
= cursor_table
[i
].id
;
2653 if (CURSOR_ID_NONE
== cursor_id
) {
2654 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2656 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2659 } else if (0 == strcasecmp(val
, "bitmap")) {
2671 wwarning(_("bad number of arguments in cursor specification"));
2674 elem
= WMGetFromPLArray(pl
, 1);
2675 if (!elem
|| !WMIsPLString(elem
)) {
2678 val
= WMGetFromPLString(elem
);
2679 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2681 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2684 elem
= WMGetFromPLArray(pl
, 2);
2685 if (!elem
|| !WMIsPLString(elem
)) {
2689 val
= WMGetFromPLString(elem
);
2690 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2693 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2696 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
,
2698 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
,
2700 if ((BitmapSuccess
== bitmap_status
) &&
2701 (BitmapSuccess
== mask_status
)) {
2702 fg
.pixel
= scr
->black_pixel
;
2703 bg
.pixel
= scr
->white_pixel
;
2704 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2705 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2706 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2709 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2710 check_bitmap_status(mask_status
, mask_name
, mask
);
2719 getCursor(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2722 static Cursor cursor
;
2727 if (!WMIsPLArray(value
)) {
2728 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2729 entry
->key
, "cursor specification");
2731 value
= entry
->plvalue
;
2733 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2738 status
= parse_cursor(scr
, value
, &cursor
);
2740 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2742 value
= entry
->plvalue
;
2744 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2753 *(Cursor
*)addr
= cursor
;
2757 #undef CURSOR_ID_NONE
2760 /* ---------------- value setting functions --------------- */
2762 setJustify(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
2764 return REFRESH_WINDOW_TITLE_COLOR
;
2768 setClearance(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
2770 return REFRESH_WINDOW_FONT
|REFRESH_BUTTON_IMAGES
|REFRESH_MENU_TITLE_FONT
|REFRESH_MENU_FONT
;
2774 setIfDockPresent(WScreen
*scr
, WDefaultEntry
*entry
, char *flag
, long which
)
2778 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2781 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2791 setStickyIcons(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
2793 if (scr
->workspaces
) {
2794 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2795 wArrangeIcons(scr
, False
);
2802 setPositive(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
2814 setIconTile(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
2820 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2821 wPreferences
.icon_size
,
2822 ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2823 ? WREL_ICON
: WREL_FLAT
);
2825 wwarning(_("could not render texture for icon background"));
2827 wTextureDestroy(scr
, *texture
);
2830 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2832 if (scr
->icon_tile
) {
2834 RReleaseImage(scr
->icon_tile
);
2835 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2838 scr
->icon_tile
= img
;
2841 /* put the icon in the noticeboard hint */
2842 PropSetIconTileHint(scr
, img
);
2845 if (!wPreferences
.flags
.noclip
) {
2846 if (scr
->clip_tile
) {
2847 RReleaseImage(scr
->clip_tile
);
2849 scr
->clip_tile
= wClipMakeTile(scr
, img
);
2852 scr
->icon_tile_pixmap
= pixmap
;
2854 if (scr
->def_icon_pixmap
) {
2855 XFreePixmap(dpy
, scr
->def_icon_pixmap
);
2856 scr
->def_icon_pixmap
= None
;
2858 if (scr
->def_ticon_pixmap
) {
2859 XFreePixmap(dpy
, scr
->def_ticon_pixmap
);
2860 scr
->def_ticon_pixmap
= None
;
2863 if (scr
->icon_back_texture
) {
2864 wTextureDestroy(scr
, (WTexture
*)scr
->icon_back_texture
);
2866 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2868 if (scr
->clip_balloon
)
2869 XSetWindowBackground(dpy
, scr
->clip_balloon
,
2870 (*texture
)->any
.color
.pixel
);
2873 * Free the texture as nobody else will use it, nor refer to it.
2876 wTextureDestroy(scr
, *texture
);
2878 return (reset
? REFRESH_ICON_TILE
: 0);
2884 setWinTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2886 if (scr
->title_font
) {
2887 WMReleaseFont(scr
->title_font
);
2889 scr
->title_font
= font
;
2891 return REFRESH_WINDOW_FONT
|REFRESH_BUTTON_IMAGES
;
2896 setMenuTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2898 if (scr
->menu_title_font
) {
2899 WMReleaseFont(scr
->menu_title_font
);
2902 scr
->menu_title_font
= font
;
2904 return REFRESH_MENU_TITLE_FONT
;
2909 setMenuTextFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2911 if (scr
->menu_entry_font
) {
2912 WMReleaseFont(scr
->menu_entry_font
);
2914 scr
->menu_entry_font
= font
;
2916 return REFRESH_MENU_FONT
;
2922 setIconTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2924 if (scr
->icon_title_font
) {
2925 WMReleaseFont(scr
->icon_title_font
);
2928 scr
->icon_title_font
= font
;
2930 return REFRESH_ICON_FONT
;
2935 setClipTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2937 if (scr
->clip_title_font
) {
2938 WMReleaseFont(scr
->clip_title_font
);
2941 scr
->clip_title_font
= font
;
2943 return REFRESH_ICON_FONT
;
2948 setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2950 if (scr
->workspace_name_font
) {
2951 WMReleaseFont(scr
->workspace_name_font
);
2954 scr
->workspace_name_font
= font
;
2961 setHightlight(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
2963 if (scr
->select_color
)
2964 WMReleaseColor(scr
->select_color
);
2967 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
,
2970 wFreeColor(scr
, color
->pixel
);
2972 return REFRESH_MENU_COLOR
;
2977 setHightlightText(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
2979 if (scr
->select_text_color
)
2980 WMReleaseColor(scr
->select_text_color
);
2982 scr
->select_text_color
=
2983 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
,
2986 wFreeColor(scr
, color
->pixel
);
2988 return REFRESH_MENU_COLOR
;
2993 setClipTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
2995 if (scr
->clip_title_color
[index
])
2996 WMReleaseColor(scr
->clip_title_color
[index
]);
2997 scr
->clip_title_color
[index
] = WMCreateRGBColor(scr
->wmscreen
, color
->red
,
2998 color
->green
, color
->blue
,
3000 #ifdef GRADIENT_CLIP_ARROW
3001 if (index
== CLIP_NORMAL
) {
3003 RColor color1
, color2
;
3004 int pt
= CLIP_BUTTON_SIZE
*wPreferences
.icon_size
/64;
3005 int as
= pt
- 15; /* 15 = 5+5+5 */
3007 FREE_PIXMAP(scr
->clip_arrow_gradient
);
3009 color1
.red
= (color
->red
>> 8)*6/10;
3010 color1
.green
= (color
->green
>> 8)*6/10;
3011 color1
.blue
= (color
->blue
>> 8)*6/10;
3013 color2
.red
= WMIN((color
->red
>> 8)*20/10, 255);
3014 color2
.green
= WMIN((color
->green
>> 8)*20/10, 255);
3015 color2
.blue
= WMIN((color
->blue
>> 8)*20/10, 255);
3017 image
= RRenderGradient(as
+1, as
+1, &color1
, &color2
, RDiagonalGradient
);
3018 RConvertImage(scr
->rcontext
, image
, &scr
->clip_arrow_gradient
);
3019 RReleaseImage(image
);
3021 #endif /* GRADIENT_CLIP_ARROW */
3023 wFreeColor(scr
, color
->pixel
);
3025 return REFRESH_ICON_TITLE_COLOR
;
3030 setWTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3032 if (scr
->window_title_color
[index
])
3033 WMReleaseColor(scr
->window_title_color
[index
]);
3035 scr
->window_title_color
[index
] =
3036 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
,
3039 wFreeColor(scr
, color
->pixel
);
3041 return REFRESH_WINDOW_TITLE_COLOR
;
3046 setMenuTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3048 if (scr
->menu_title_color
[0])
3049 WMReleaseColor(scr
->menu_title_color
[0]);
3051 scr
->menu_title_color
[0] =
3052 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
,
3055 wFreeColor(scr
, color
->pixel
);
3057 return REFRESH_MENU_TITLE_COLOR
;
3062 setMenuTextColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3064 if (scr
->mtext_color
)
3065 WMReleaseColor(scr
->mtext_color
);
3067 scr
->mtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
,
3068 color
->green
, color
->blue
, True
);
3070 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
3071 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
3073 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
3076 wFreeColor(scr
, color
->pixel
);
3078 return REFRESH_MENU_COLOR
;
3083 setMenuDisabledColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3085 if (scr
->dtext_color
)
3086 WMReleaseColor(scr
->dtext_color
);
3088 scr
->dtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
,
3089 color
->green
, color
->blue
, True
);
3091 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
3092 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
3094 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
3097 wFreeColor(scr
, color
->pixel
);
3099 return REFRESH_MENU_COLOR
;
3104 setIconTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3106 if (scr
->icon_title_color
)
3107 WMReleaseColor(scr
->icon_title_color
);
3108 scr
->icon_title_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
,
3109 color
->green
, color
->blue
,
3112 wFreeColor(scr
, color
->pixel
);
3114 return REFRESH_ICON_TITLE_COLOR
;
3119 setIconTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3121 if (scr
->icon_title_texture
) {
3122 wTextureDestroy(scr
, (WTexture
*)scr
->icon_title_texture
);
3124 // ?? why is this necessary? color was already parsed and alloc'ed
3125 XQueryColor (dpy
, scr
->w_colormap
, color
);
3126 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
3128 return REFRESH_ICON_TITLE_BACK
;
3133 trackDeadProcess(pid_t pid
, unsigned char status
, WScreen
*scr
)
3135 close(scr
->helper_fd
);
3137 scr
->helper_pid
= 0;
3138 scr
->flags
.backimage_helper_launched
= 0;
3143 setWorkspaceSpecificBack(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
3150 if (scr
->flags
.backimage_helper_launched
) {
3151 if (WMGetPropListItemCount(value
)==0) {
3152 SendHelperMessage(scr
, 'C', 0, NULL
);
3153 SendHelperMessage(scr
, 'K', 0, NULL
);
3155 WMReleasePropList(value
);
3162 if (WMGetPropListItemCount(value
) == 0)
3165 if (pipe(filedes
) < 0) {
3166 wsyserror("pipe() failed:can't set workspace specific background image");
3168 WMReleasePropList(value
);
3174 wsyserror("fork() failed:can't set workspace specific background image");
3175 if (close(filedes
[0]) < 0)
3176 wsyserror("could not close pipe");
3177 if (close(filedes
[1]) < 0)
3178 wsyserror("could not close pipe");
3180 } else if (pid
== 0) {
3183 SetupEnvironment(scr
);
3186 wsyserror("could not close pipe");
3187 if (dup(filedes
[0]) < 0) {
3188 wsyserror("dup() failed:can't set workspace specific background image");
3190 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3191 if (wPreferences
.smooth_workspace_back
)
3192 execlp("wmsetbg", "wmsetbg", "-helper", "-S", dither
, NULL
);
3194 execlp("wmsetbg", "wmsetbg", "-helper", dither
, NULL
);
3195 wsyserror("could not execute wmsetbg");
3199 if (fcntl(filedes
[0], F_SETFD
, FD_CLOEXEC
) < 0) {
3200 wsyserror("error setting close-on-exec flag");
3202 if (fcntl(filedes
[1], F_SETFD
, FD_CLOEXEC
) < 0) {
3203 wsyserror("error setting close-on-exec flag");
3206 scr
->helper_fd
= filedes
[1];
3207 scr
->helper_pid
= pid
;
3208 scr
->flags
.backimage_helper_launched
= 1;
3210 wAddDeathHandler(pid
, (WDeathHandler
*)trackDeadProcess
, scr
);
3212 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3217 for (i
= 0; i
< WMGetPropListItemCount(value
); i
++) {
3218 val
= WMGetFromPLArray(value
, i
);
3219 if (val
&& WMIsPLArray(val
) && WMGetPropListItemCount(val
)>0) {
3220 str
= WMGetPropListDescription(val
, False
);
3222 SendHelperMessage(scr
, 'S', i
+1, str
);
3226 SendHelperMessage(scr
, 'U', i
+1, NULL
);
3231 WMReleasePropList(value
);
3237 setWorkspaceBack(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
3240 if (scr
->flags
.backimage_helper_launched
) {
3243 if (WMGetPropListItemCount(value
)==0) {
3244 SendHelperMessage(scr
, 'U', 0, NULL
);
3246 /* set the default workspace background to this one */
3247 str
= WMGetPropListDescription(value
, False
);
3249 SendHelperMessage(scr
, 'S', 0, str
);
3251 SendHelperMessage(scr
, 'C', scr
->current_workspace
+1, NULL
);
3253 SendHelperMessage(scr
, 'U', 0, NULL
);
3256 } else if (WMGetPropListItemCount(value
) > 0) {
3262 SetupEnvironment(scr
);
3263 text
= WMGetPropListDescription(value
, False
);
3264 len
= strlen(text
)+40;
3265 command
= wmalloc(len
);
3266 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3267 if (wPreferences
.smooth_workspace_back
)
3268 snprintf(command
, len
, "wmsetbg %s -S -p '%s' &", dither
, text
);
3270 snprintf(command
, len
, "wmsetbg %s -p '%s' &", dither
, text
);
3275 WMReleasePropList(value
);
3282 setWidgetColor(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3284 if (scr
->widget_texture
) {
3285 wTextureDestroy(scr
, (WTexture
*)scr
->widget_texture
);
3287 scr
->widget_texture
= *(WTexSolid
**)texture
;
3294 setFTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3296 if (scr
->window_title_texture
[WS_FOCUSED
]) {
3297 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3299 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3301 return REFRESH_WINDOW_TEXTURES
;
3306 setPTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3308 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
3309 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3311 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3313 return REFRESH_WINDOW_TEXTURES
;
3318 setUTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3320 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
3321 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3323 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3325 return REFRESH_WINDOW_TEXTURES
;
3330 setResizebarBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3332 if (scr
->resizebar_texture
[0]) {
3333 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3335 scr
->resizebar_texture
[0] = *texture
;
3337 return REFRESH_WINDOW_TEXTURES
;
3342 setMenuTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3344 if (scr
->menu_title_texture
[0]) {
3345 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3347 scr
->menu_title_texture
[0] = *texture
;
3349 return REFRESH_MENU_TITLE_TEXTURE
;
3354 setMenuTextBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3356 if (scr
->menu_item_texture
) {
3357 wTextureDestroy(scr
, scr
->menu_item_texture
);
3358 wTextureDestroy(scr
, (WTexture
*)scr
->menu_item_auxtexture
);
3360 scr
->menu_item_texture
= *texture
;
3362 scr
->menu_item_auxtexture
3363 = wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3365 return REFRESH_MENU_TEXTURE
;
3370 setKeyGrab(WScreen
*scr
, WDefaultEntry
*entry
, WShortKey
*shortcut
, long index
)
3373 wKeyBindings
[index
] = *shortcut
;
3375 wwin
= scr
->focused_window
;
3377 while (wwin
!=NULL
) {
3378 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3380 if (!WFLAGP(wwin
, no_bind_keys
)) {
3381 wWindowSetKeyGrabs(wwin
);
3391 setIconPosition(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
3393 wArrangeIcons(scr
, True
);
3400 updateUsableArea(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
3402 wScreenUpdateUsableArea(scr
);
3409 setMenuStyle(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
3411 return REFRESH_MENU_TEXTURE
;
3417 setButtonImages(WScreen *scr, WDefaultEntry *entry, int *value, void *foo)
3419 return REFRESH_BUTTON_IMAGES;
3425 * Need access to the double click variables, so that all widgets in
3426 * wmaker panels will have the same dbl-click values.
3427 * TODO: figure a better way of dealing with it.
3429 #include <WINGs/WINGsP.h>
3432 setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
3434 extern _WINGsConfiguration WINGsConfiguration
;
3439 WINGsConfiguration
.doubleClickDelay
= *value
;
3447 setMultiByte(WScreen
*scr
, WDefaultEntry
*entry
, char *value
, void *foo
)
3449 extern _WINGsConfiguration WINGsConfiguration
;
3451 WINGsConfiguration
.useMultiByte
= *value
;
3459 setCursor(WScreen
*scr
, WDefaultEntry
*entry
, Cursor
*cursor
, long index
)
3461 if (wCursor
[index
] != None
) {
3462 XFreeCursor(dpy
, wCursor
[index
]);
3465 wCursor
[index
] = *cursor
;
3467 if (index
==WCUR_ROOT
&& *cursor
!=None
) {
3468 XDefineCursor(dpy
, scr
->root_win
, *cursor
);