1 /* defaults.c - manage configuration through defaults db
3 * Window Maker window manager
5 * Copyright (c) 1997, 1998 Alfredo K. Kojima
6 * Copyright (c) 1998 Dan Pascu
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
32 #include <sys/types.h>
45 #define PATH_MAX DEFAULT_PATH_MAX
49 #include <X11/Xutil.h>
50 #include <X11/keysym.h>
55 #include "WindowMaker.h"
61 #include "resources.h"
64 #include "xmodifier.h"
69 #include "workspace.h"
70 #include "properties.h"
74 * Our own proplist reader parser. This one will not accept any
75 * syntax errors and is more descriptive in the error messages.
76 * It also doesn't seem to crash.
78 extern proplist_t
ReadProplistFromFile(char *file
);
83 extern WDDomain
*WDWindowMaker
;
84 extern WDDomain
*WDWindowAttributes
;
85 extern WDDomain
*WDRootMenu
;
87 extern int wScreenCount
;
89 extern Atom _XA_WINDOWMAKER_ICON_SIZE
;
90 extern Atom _XA_WINDOWMAKER_ICON_TILE
;
93 extern proplist_t wDomainName;
94 extern proplist_t wAttributeDomainName;
96 extern WPreferences wPreferences
;
98 extern WShortKey wKeyBindings
[WKBD_LAST
];
108 proplist_t plvalue
; /* default value */
112 /* used to map strings to integers */
117 } WOptionEnumeration
;
120 /* type converters */
121 static int getBool();
123 static int getCoord();
125 /* this is not used yet */
126 static int getString();
128 static int getPathList();
129 static int getEnum();
130 static int getTexture();
131 static int getWSBackground();
132 static int getWSSpecificBackground();
133 static int getFont();
134 static int getColor();
135 static int getKeybind();
136 static int getModMask();
138 static int getRImage();
142 /* value setting functions */
143 static int setJustify();
144 static int setClearance();
145 static int setIfDockPresent();
146 static int setStickyIcons();
148 static int setPositive();
150 static int setWidgetColor();
151 static int setIconTile();
152 static int setWinTitleFont();
153 static int setMenuTitleFont();
154 static int setMenuTextFont();
155 static int setIconTitleFont();
156 static int setIconTitleColor();
157 static int setIconTitleBack();
158 static int setLargeDisplayFont();
159 static int setWTitleColor();
160 static int setFTitleBack();
161 static int setPTitleBack();
162 static int setUTitleBack();
163 static int setResizebarBack();
164 static int setWorkspaceBack();
165 static int setWorkspaceSpecificBack();
166 static int setMenuTitleColor();
167 static int setMenuTextColor();
168 static int setMenuDisabledColor();
169 static int setMenuTitleBack();
170 static int setMenuTextBack();
171 static int setHightlight();
172 static int setHightlightText();
173 static int setKeyGrab();
174 static int setDoubleClick();
175 static int setIconPosition();
177 static int setClipTitleFont();
178 static int setClipTitleColor();
180 static int setMenuStyle();
182 static int setMultiByte();
184 static int updateUsableArea();
186 #ifdef DEFINABLE_CURSOR
187 extern Cursor wCursor
[WCUR_LAST
];
188 static int getCursor();
189 static int setCursor();
194 * Tables to convert strings to enumeration values.
195 * Values stored are char
199 /* WARNING: sum of length of all value strings must not exceed
201 #define TOTAL_VALUES_LENGTH 80
206 #define REFRESH_WINDOW_TEXTURES (1<<0)
207 #define REFRESH_MENU_TEXTURE (1<<1)
208 #define REFRESH_MENU_FONT (1<<2)
209 #define REFRESH_MENU_COLOR (1<<3)
210 #define REFRESH_MENU_TITLE_TEXTURE (1<<4)
211 #define REFRESH_MENU_TITLE_FONT (1<<5)
212 #define REFRESH_MENU_TITLE_COLOR (1<<6)
213 #define REFRESH_WINDOW_TITLE_COLOR (1<<7)
214 #define REFRESH_WINDOW_FONT (1<<8)
215 #define REFRESH_ICON_TILE (1<<9)
216 #define REFRESH_ICON_FONT (1<<10)
217 #define REFRESH_WORKSPACE_BACK (1<<11)
219 #define REFRESH_BUTTON_IMAGES (1<<12)
221 #define REFRESH_ICON_TITLE_COLOR (1<<13)
222 #define REFRESH_ICON_TITLE_BACK (1<<14)
226 static WOptionEnumeration seFocusModes
[] = {
227 {"Manual", WKF_CLICK
, 0}, {"ClickToFocus", WKF_CLICK
, 1},
228 {"Sloppy", WKF_SLOPPY
, 0}, {"SemiAuto", WKF_SLOPPY
, 1}, {"Auto", WKF_SLOPPY
, 1},
232 static WOptionEnumeration seColormapModes
[] = {
233 {"Manual", WCM_CLICK
, 0}, {"ClickToFocus", WCM_CLICK
, 1},
234 {"Auto", WCM_POINTER
, 0}, {"FocusFollowMouse", WCM_POINTER
, 1},
238 static WOptionEnumeration sePlacements
[] = {
239 {"Auto", WPM_AUTO
, 0},
240 {"Smart", WPM_SMART
, 0},
241 {"Cascade", WPM_CASCADE
, 0},
242 {"Random", WPM_RANDOM
, 0},
243 {"Manual", WPM_MANUAL
, 0},
247 static WOptionEnumeration seGeomDisplays
[] = {
248 {"Center", WDIS_CENTER
, 0},
249 {"Corner", WDIS_TOPLEFT
, 0},
250 {"Floating", WDIS_FRAME_CENTER
, 0},
251 {"Line", WDIS_NEW
, 0},
255 static WOptionEnumeration seSpeeds
[] = {
256 {"UltraFast", SPEED_ULTRAFAST
, 0},
257 {"Fast", SPEED_FAST
, 0},
258 {"Medium", SPEED_MEDIUM
, 0},
259 {"Slow", SPEED_SLOW
, 0},
260 {"UltraSlow", SPEED_ULTRASLOW
, 0},
264 static WOptionEnumeration seMouseButtonActions
[] = {
265 {"None", WA_NONE
, 0},
266 {"SelectWindows", WA_SELECT_WINDOWS
, 0},
267 {"OpenApplicationsMenu", WA_OPEN_APPMENU
, 0},
268 {"OpenWindowListMenu", WA_OPEN_WINLISTMENU
, 0},
272 static WOptionEnumeration seMouseWheelActions
[] = {
273 {"None", WA_NONE
, 0},
274 {"SwitchWorkspaces", WA_SWITCH_WORKSPACES
, 0},
278 static WOptionEnumeration seIconificationStyles
[] = {
279 {"Zoom", WIS_ZOOM
, 0},
280 {"Twist", WIS_TWIST
, 0},
281 {"Flip", WIS_FLIP
, 0},
282 {"None", WIS_NONE
, 0},
283 {"random", WIS_RANDOM
, 0},
287 static WOptionEnumeration seJustifications
[] = {
288 {"Left", WTJ_LEFT
, 0},
289 {"Center", WTJ_CENTER
, 0},
290 {"Right", WTJ_RIGHT
, 0},
294 static WOptionEnumeration seIconPositions
[] = {
295 {"blv", IY_BOTTOM
|IY_LEFT
|IY_VERT
, 0},
296 {"blh", IY_BOTTOM
|IY_LEFT
|IY_HORIZ
, 0},
297 {"brv", IY_BOTTOM
|IY_RIGHT
|IY_VERT
, 0},
298 {"brh", IY_BOTTOM
|IY_RIGHT
|IY_HORIZ
, 0},
299 {"tlv", IY_TOP
|IY_LEFT
|IY_VERT
, 0},
300 {"tlh", IY_TOP
|IY_LEFT
|IY_HORIZ
, 0},
301 {"trv", IY_TOP
|IY_RIGHT
|IY_VERT
, 0},
302 {"trh", IY_TOP
|IY_RIGHT
|IY_HORIZ
, 0},
306 static WOptionEnumeration seMenuStyles
[] = {
307 {"normal", MS_NORMAL
, 0},
308 {"singletexture", MS_SINGLE_TEXTURE
, 0},
309 {"flat", MS_FLAT
, 0},
314 static WOptionEnumeration seDisplayPositions
[] = {
315 {"none", WD_NONE
, 0},
316 {"center", WD_CENTER
, 0},
318 {"bottom", WD_BOTTOM
, 0},
319 {"topleft", WD_TOPLEFT
, 0},
320 {"topright", WD_TOPRIGHT
, 0},
321 {"bottomleft", WD_BOTTOMLEFT
, 0},
322 {"bottomright", WD_BOTTOMRIGHT
, 0},
326 static WOptionEnumeration seWorkspaceBorder
[] = {
327 {"None", WB_NONE
, 0},
328 {"LeftRight", WB_LEFTRIGHT
, 0},
329 {"TopBottom", WB_TOPBOTTOM
, 0},
330 {"AllDirections", WB_ALLDIRS
, 0},
336 * ALL entries in the tables bellow, NEED to have a default value
337 * defined, and this value needs to be correct.
340 /* these options will only affect the window manager on startup
342 * static defaults can't access the screen data, because it is
343 * created after these defaults are read
345 WDefaultEntry staticOptionList
[] = {
347 {"ColormapSize", "4", NULL
,
348 &wPreferences
.cmap_size
, getInt
, NULL
350 {"DisableDithering", "NO", NULL
,
351 &wPreferences
.no_dithering
, getBool
, NULL
353 /* static by laziness */
354 {"IconSize", "64", NULL
,
355 &wPreferences
.icon_size
, getInt
, NULL
357 {"ModifierKey", "Mod1", NULL
,
358 &wPreferences
.modifier_mask
, getModMask
, NULL
360 {"DisableWSMouseActions", "NO", NULL
,
361 &wPreferences
.disable_root_mouse
, getBool
, NULL
363 {"FocusMode", "manual", seFocusModes
,
364 &wPreferences
.focus_mode
, getEnum
, NULL
365 }, /* have a problem when switching from manual to sloppy without restart */
366 {"NewStyle", "NO", NULL
,
367 &wPreferences
.new_style
, getBool
, NULL
369 {"DisableDock", "NO", (void*) WM_DOCK
,
370 NULL
, getBool
, setIfDockPresent
372 {"DisableClip", "NO", (void*) WM_CLIP
,
373 NULL
, getBool
, setIfDockPresent
375 {"DisableMiniwindows", "NO", NULL
,
376 &wPreferences
.disable_miniwindows
, getBool
, NULL
379 ,{"MultiByteText", "NO", NULL
,
380 &wPreferences
.multi_byte_text
, getBool
, setMultiByte
387 WDefaultEntry optionList
[] = {
388 /* dynamic options */
389 {"IconPosition", "blh", seIconPositions
,
390 &wPreferences
.icon_yard
, getEnum
, setIconPosition
392 {"IconificationStyle", "Zoom", seIconificationStyles
,
393 &wPreferences
.iconification_style
, getEnum
, NULL
395 {"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions
,
396 &wPreferences
.mouse_button1
, getEnum
, NULL
398 {"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions
,
399 &wPreferences
.mouse_button2
, getEnum
, NULL
401 {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions
,
402 &wPreferences
.mouse_button3
, getEnum
, NULL
404 {"MouseWheelAction", "None", seMouseWheelActions
,
405 &wPreferences
.mouse_wheel
, getEnum
, NULL
407 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
408 &wPreferences
.pixmap_path
, getPathList
, NULL
410 {"IconPath", DEF_ICON_PATHS
, NULL
,
411 &wPreferences
.icon_path
, getPathList
, NULL
413 {"ColormapMode", "auto", seColormapModes
,
414 &wPreferences
.colormap_mode
, getEnum
, NULL
416 {"AutoFocus", "NO", NULL
,
417 &wPreferences
.auto_focus
, getBool
, NULL
419 {"RaiseDelay", "0", NULL
,
420 &wPreferences
.raise_delay
, getInt
, NULL
422 {"WindozeCycling", "NO", NULL
,
423 &wPreferences
.windows_cycling
,getBool
, NULL
425 {"CirculateRaise", "NO", NULL
,
426 &wPreferences
.circ_raise
, getBool
, NULL
428 {"Superfluous", "NO", NULL
,
429 &wPreferences
.superfluous
, getBool
, NULL
431 {"AdvanceToNewWorkspace", "NO", NULL
,
432 &wPreferences
.ws_advance
, getBool
, NULL
434 {"CycleWorkspaces", "NO", NULL
,
435 &wPreferences
.ws_cycle
, getBool
, NULL
437 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
438 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
440 {"WorkspaceBorder", "None", seWorkspaceBorder
,
441 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
443 {"WorkspaceBorderSize", "0", NULL
,
444 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
446 #ifdef VIRTUAL_DESKTOP
447 {"VirtualEdgeThickness", "1", NULL
,
448 &wPreferences
.vedge_thickness
, getInt
, NULL
450 {"VirtualEdgeExtendSpace", "0", NULL
,
451 &wPreferences
.vedge_bordersize
, getInt
, NULL
453 {"VirtualEdgeHorizonScrollSpeed", "1", NULL
,
454 &wPreferences
.vedge_hscrollspeed
, getInt
, NULL
456 {"VirtualEdgeVerticalScrollSpeed", "1", NULL
,
457 &wPreferences
.vedge_vscrollspeed
, getInt
, NULL
459 {"VirtualEdgeMaximumWidth", "3000", NULL
,
460 &wPreferences
.vedge_maxwidth
, getInt
, NULL
462 {"VirtualEdgeMaximumHeight", "3000", NULL
,
463 &wPreferences
.vedge_maxheight
, getInt
, NULL
466 {"StickyIcons", "NO", NULL
,
467 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
469 {"SaveSessionOnExit", "NO", NULL
,
470 &wPreferences
.save_session_on_exit
, getBool
, NULL
472 {"WrapMenus", "NO", NULL
,
473 &wPreferences
.wrap_menus
, getBool
, NULL
475 {"ScrollableMenus", "NO", NULL
,
476 &wPreferences
.scrollable_menus
, getBool
, NULL
478 {"MenuScrollSpeed", "medium", seSpeeds
,
479 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
481 {"IconSlideSpeed", "medium", seSpeeds
,
482 &wPreferences
.icon_slide_speed
, getEnum
, NULL
484 {"ShadeSpeed", "medium", seSpeeds
,
485 &wPreferences
.shade_speed
, getEnum
, NULL
487 {"DoubleClickTime", "250", (void*) &wPreferences
.dblclick_time
,
488 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
,
490 {"AlignSubmenus", "NO", NULL
,
491 &wPreferences
.align_menus
, getBool
, NULL
493 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
494 &wPreferences
.open_transients_with_parent
, getBool
, NULL
496 {"WindowPlacement", "auto", sePlacements
,
497 &wPreferences
.window_placement
, getEnum
, NULL
499 {"IgnoreFocusClick","NO", NULL
,
500 &wPreferences
.ignore_focus_click
, getBool
, NULL
502 {"UseSaveUnders", "NO", NULL
,
503 &wPreferences
.use_saveunders
, getBool
, NULL
505 {"OpaqueMove", "NO", NULL
,
506 &wPreferences
.opaque_move
, getBool
, NULL
508 {"DisableSound", "NO", NULL
,
509 &wPreferences
.no_sound
, getBool
, NULL
511 {"DisableAnimations", "NO", NULL
,
512 &wPreferences
.no_animations
, getBool
, NULL
514 {"DontLinkWorkspaces","NO", NULL
,
515 &wPreferences
.no_autowrap
, getBool
, NULL
517 {"AutoArrangeIcons", "NO", NULL
,
518 &wPreferences
.auto_arrange_icons
, getBool
, NULL
520 {"NoWindowOverDock", "NO", NULL
,
521 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
523 {"NoWindowOverIcons", "NO", NULL
,
524 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
526 {"WindowPlaceOrigin", "(0, 0)", NULL
,
527 &wPreferences
.window_place_origin
, getCoord
, NULL
529 {"ResizeDisplay", "corner", seGeomDisplays
,
530 &wPreferences
.size_display
, getEnum
, NULL
532 {"MoveDisplay", "corner", seGeomDisplays
,
533 &wPreferences
.move_display
, getEnum
, NULL
535 {"DontConfirmKill", "NO", NULL
,
536 &wPreferences
.dont_confirm_kill
, getBool
,NULL
538 {"WindowTitleBalloons", "NO", NULL
,
539 &wPreferences
.window_balloon
, getBool
, NULL
541 {"MiniwindowTitleBalloons", "NO", NULL
,
542 &wPreferences
.miniwin_balloon
,getBool
, NULL
544 {"AppIconBalloons", "NO", NULL
,
545 &wPreferences
.appicon_balloon
,getBool
, NULL
547 {"HelpBalloons", "NO", NULL
,
548 &wPreferences
.help_balloon
, getBool
, NULL
550 {"EdgeResistance", "30", NULL
,
551 &wPreferences
.edge_resistance
,getInt
, NULL
553 {"Attraction", "NO", NULL
,
554 &wPreferences
.attract
, getBool
, NULL
556 {"DisableBlinking", "NO", NULL
,
557 &wPreferences
.dont_blink
, getBool
, NULL
560 {"MenuStyle", "normal", seMenuStyles
,
561 &wPreferences
.menu_style
, getEnum
, setMenuStyle
563 {"WidgetColor", "(solid, gray)", NULL
,
564 NULL
, getTexture
, setWidgetColor
,
566 {"WorkspaceSpecificBack","()", NULL
,
567 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
569 /* WorkspaceBack must come after WorkspaceSpecificBack or
570 * WorkspaceBack wont know WorkspaceSpecificBack was also
571 * specified and 2 copies of wmsetbg will be launched */
572 {"WorkspaceBack", "(solid, black)", NULL
,
573 NULL
, getWSBackground
,setWorkspaceBack
575 {"SmoothWorkspaceBack", "NO", NULL
,
578 {"IconBack", "(solid, gray)", NULL
,
579 NULL
, getTexture
, setIconTile
581 {"TitleJustify", "center", seJustifications
,
582 &wPreferences
.title_justification
, getEnum
, setJustify
584 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
585 NULL
, getFont
, setWinTitleFont
,
587 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
588 &wPreferences
.window_title_clearance
, getInt
, setClearance
590 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
591 &wPreferences
.menu_title_clearance
, getInt
, setClearance
593 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
594 &wPreferences
.menu_text_clearance
, getInt
, setClearance
596 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
597 NULL
, getFont
, setMenuTitleFont
599 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
600 NULL
, getFont
, setMenuTextFont
602 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
603 NULL
, getFont
, setIconTitleFont
605 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
606 NULL
, getFont
, setClipTitleFont
608 {"LargeDisplayFont",DEF_WORKSPACE_NAME_FONT
, NULL
,
609 NULL
, getFont
, setLargeDisplayFont
611 {"HighlightColor", "white", NULL
,
612 NULL
, getColor
, setHightlight
614 {"HighlightTextColor", "black", NULL
,
615 NULL
, getColor
, setHightlightText
617 {"ClipTitleColor", "black", (void*)CLIP_NORMAL
,
618 NULL
, getColor
, setClipTitleColor
620 {"CClipTitleColor", "\"#454045\"", (void*)CLIP_COLLAPSED
,
621 NULL
, getColor
, setClipTitleColor
623 {"FTitleColor", "white", (void*)WS_FOCUSED
,
624 NULL
, getColor
, setWTitleColor
626 {"PTitleColor", "white", (void*)WS_PFOCUSED
,
627 NULL
, getColor
, setWTitleColor
629 {"UTitleColor", "black", (void*)WS_UNFOCUSED
,
630 NULL
, getColor
, setWTitleColor
632 {"FTitleBack", "(solid, black)", NULL
,
633 NULL
, getTexture
, setFTitleBack
635 {"PTitleBack", "(solid, \"#616161\")", NULL
,
636 NULL
, getTexture
, setPTitleBack
638 {"UTitleBack", "(solid, gray)", NULL
,
639 NULL
, getTexture
, setUTitleBack
641 {"ResizebarBack", "(solid, gray)", NULL
,
642 NULL
, getTexture
, setResizebarBack
644 {"MenuTitleColor", "white", NULL
,
645 NULL
, getColor
, setMenuTitleColor
647 {"MenuTextColor", "black", NULL
,
648 NULL
, getColor
, setMenuTextColor
650 {"MenuDisabledColor", "\"#616161\"", NULL
,
651 NULL
, getColor
, setMenuDisabledColor
653 {"MenuTitleBack", "(solid, black)", NULL
,
654 NULL
, getTexture
, setMenuTitleBack
656 {"MenuTextBack", "(solid, gray)", NULL
,
657 NULL
, getTexture
, setMenuTextBack
659 {"IconTitleColor", "white", NULL
,
660 NULL
, getColor
, setIconTitleColor
662 {"IconTitleBack", "black", NULL
,
663 NULL
, getColor
, setIconTitleBack
667 {"RootMenuKey", "None", (void*)WKBD_ROOTMENU
,
668 NULL
, getKeybind
, setKeyGrab
670 {"WindowListKey", "None", (void*)WKBD_WINDOWLIST
,
671 NULL
, getKeybind
, setKeyGrab
674 {"WindowMenuKey", "None", (void*)WKBD_WINDOWMENU
,
675 NULL
, getKeybind
, setKeyGrab
677 {"ClipLowerKey", "None", (void*)WKBD_CLIPLOWER
,
678 NULL
, getKeybind
, setKeyGrab
680 {"ClipRaiseKey", "None", (void*)WKBD_CLIPRAISE
,
681 NULL
, getKeybind
, setKeyGrab
683 {"ClipRaiseLowerKey", "None", (void*)WKBD_CLIPRAISELOWER
,
684 NULL
, getKeybind
, setKeyGrab
686 {"MiniaturizeKey", "None", (void*)WKBD_MINIATURIZE
,
687 NULL
, getKeybind
, setKeyGrab
689 {"HideKey", "None", (void*)WKBD_HIDE
,
690 NULL
, getKeybind
, setKeyGrab
692 {"MoveResizeKey", "None", (void*)WKBD_MOVERESIZE
,
693 NULL
, getKeybind
, setKeyGrab
695 {"CloseKey", "None", (void*)WKBD_CLOSE
,
696 NULL
, getKeybind
, setKeyGrab
698 {"MaximizeKey", "None", (void*)WKBD_MAXIMIZE
,
699 NULL
, getKeybind
, setKeyGrab
701 {"VMaximizeKey", "None", (void*)WKBD_VMAXIMIZE
,
702 NULL
, getKeybind
, setKeyGrab
704 {"RaiseKey", "\"Meta+Up\"", (void*)WKBD_RAISE
,
705 NULL
, getKeybind
, setKeyGrab
707 {"LowerKey", "\"Meta+Down\"", (void*)WKBD_LOWER
,
708 NULL
, getKeybind
, setKeyGrab
710 {"RaiseLowerKey", "None", (void*)WKBD_RAISELOWER
,
711 NULL
, getKeybind
, setKeyGrab
713 {"ShadeKey", "None", (void*)WKBD_SHADE
,
714 NULL
, getKeybind
, setKeyGrab
716 {"SelectKey", "None", (void*)WKBD_SELECT
,
717 NULL
, getKeybind
, setKeyGrab
719 {"FocusNextKey", "None", (void*)WKBD_FOCUSNEXT
,
720 NULL
, getKeybind
, setKeyGrab
722 {"FocusPrevKey", "None", (void*)WKBD_FOCUSPREV
,
723 NULL
, getKeybind
, setKeyGrab
725 {"NextWorkspaceKey", "None", (void*)WKBD_NEXTWORKSPACE
,
726 NULL
, getKeybind
, setKeyGrab
728 {"PrevWorkspaceKey", "None", (void*)WKBD_PREVWORKSPACE
,
729 NULL
, getKeybind
, setKeyGrab
731 {"NextWorkspaceLayerKey", "None", (void*)WKBD_NEXTWSLAYER
,
732 NULL
, getKeybind
, setKeyGrab
734 {"PrevWorkspaceLayerKey", "None", (void*)WKBD_PREVWSLAYER
,
735 NULL
, getKeybind
, setKeyGrab
737 {"Workspace1Key", "None", (void*)WKBD_WORKSPACE1
,
738 NULL
, getKeybind
, setKeyGrab
740 {"Workspace2Key", "None", (void*)WKBD_WORKSPACE2
,
741 NULL
, getKeybind
, setKeyGrab
743 {"Workspace3Key", "None", (void*)WKBD_WORKSPACE3
,
744 NULL
, getKeybind
, setKeyGrab
746 {"Workspace4Key", "None", (void*)WKBD_WORKSPACE4
,
747 NULL
, getKeybind
, setKeyGrab
749 {"Workspace5Key", "None", (void*)WKBD_WORKSPACE5
,
750 NULL
, getKeybind
, setKeyGrab
752 {"Workspace6Key", "None", (void*)WKBD_WORKSPACE6
,
753 NULL
, getKeybind
, setKeyGrab
755 {"Workspace7Key", "None", (void*)WKBD_WORKSPACE7
,
756 NULL
, getKeybind
, setKeyGrab
758 {"Workspace8Key", "None", (void*)WKBD_WORKSPACE8
,
759 NULL
, getKeybind
, setKeyGrab
761 {"Workspace9Key", "None", (void*)WKBD_WORKSPACE9
,
762 NULL
, getKeybind
, setKeyGrab
764 {"Workspace10Key", "None", (void*)WKBD_WORKSPACE10
,
765 NULL
, getKeybind
, setKeyGrab
767 {"WindowShortcut1Key","None", (void*)WKBD_WINDOW1
,
768 NULL
, getKeybind
, setKeyGrab
770 {"WindowShortcut2Key","None", (void*)WKBD_WINDOW2
,
771 NULL
, getKeybind
, setKeyGrab
773 {"WindowShortcut3Key","None", (void*)WKBD_WINDOW3
,
774 NULL
, getKeybind
, setKeyGrab
776 {"WindowShortcut4Key","None", (void*)WKBD_WINDOW4
,
777 NULL
, getKeybind
, setKeyGrab
779 ,{"WindowShortcut5Key","None", (void*)WKBD_WINDOW5
,
780 NULL
, getKeybind
, setKeyGrab
782 {"WindowShortcut6Key","None", (void*)WKBD_WINDOW6
,
783 NULL
, getKeybind
, setKeyGrab
785 {"WindowShortcut7Key","None", (void*)WKBD_WINDOW7
,
786 NULL
, getKeybind
, setKeyGrab
788 {"WindowShortcut8Key","None", (void*)WKBD_WINDOW8
,
789 NULL
, getKeybind
, setKeyGrab
791 {"WindowShortcut9Key","None", (void*)WKBD_WINDOW9
,
792 NULL
, getKeybind
, setKeyGrab
794 {"WindowShortcut10Key","None", (void*)WKBD_WINDOW10
,
795 NULL
, getKeybind
, setKeyGrab
797 {"ScreenSwitchKey", "None", (void*)WKBD_SWITCH_SCREEN
,
798 NULL
, getKeybind
, setKeyGrab
801 #ifdef KEEP_XKB_LOCK_STATUS
802 ,{"ToggleKbdModeKey", "None", (void*)WKBD_TOGGLE
,
803 NULL
, getKeybind
, setKeyGrab
805 {"KbdModeLock", "NO", NULL
,
806 &wPreferences
.modelock
, getBool
, NULL
808 #endif /* KEEP_XKB_LOCK_STATUS */
809 #ifdef DEFINABLE_CURSOR
810 ,{"NormalCursor", "(builtin, left_ptr)", (void*)WCUR_ROOT
,
811 NULL
, getCursor
, setCursor
813 {"MoveCursor", "(builtin, fleur)", (void*)WCUR_MOVE
,
814 NULL
, getCursor
, setCursor
817 {"TopLeftResizeCursor", "(builtin, sizing)", (void*)WCUR_TOPLEFTRESIZE
,
818 NULL
, getCursor
, setCursor
820 {"TopRightResizeCursor", "(builtin, sizing)", (void*)WCUR_TOPRIGHTRESIZE
,
821 NULL
, getCursor
, setCursor
823 {"BottomLeftResizeCursor", "(builtin, sizing)", (void*)WCUR_BOTTOMLEFTRESIZE
,
824 NULL
, getCursor
, setCursor
826 {"BottomRightResizeCursor", "(builtin, sizing)", (void*)WCUR_BOTTOMRIGHTRESIZE
,
827 NULL
, getCursor
, setCursor
829 {"VerticalResizeCursor", "(builtin, sizing)", (void*)WCUR_VERTICALRESIZE
,
830 NULL
, getCursor
, setCursor
832 {"HorizonResizeCursor", "(builtin, sizing)", (void*)WCUR_HORIZONRESIZE
,
833 NULL
, getCursor
, setCursor
835 {"WaitCursor", "(builtin, watch)", (void*)WCUR_WAIT
,
836 NULL
, getCursor
, setCursor
838 {"ArrowCursor", "(builtin, top_left_arrow)", (void*)WCUR_ARROW
,
839 NULL
, getCursor
, setCursor
842 #endif /* DEFINABLE_CURSOR */
847 static void rereadDefaults(void);
854 /* must defer the update because accessing X data from a
855 * signal handler can mess up Xlib */
864 WDefaultEntry
*entry
;
866 PLSetStringCmpHook(StringCompareHook
);
868 for (i
=0; i
<sizeof(optionList
)/sizeof(WDefaultEntry
); i
++) {
869 entry
= &optionList
[i
];
871 entry
->plkey
= PLMakeString(entry
->key
);
872 if (entry
->default_value
)
873 entry
->plvalue
= PLGetProplistWithDescription(entry
->default_value
);
875 entry
->plvalue
= NULL
;
878 for (i
=0; i
<sizeof(staticOptionList
)/sizeof(WDefaultEntry
); i
++) {
879 entry
= &staticOptionList
[i
];
881 entry
->plkey
= PLMakeString(entry
->key
);
882 if (entry
->default_value
)
883 entry
->plvalue
= PLGetProplistWithDescription(entry
->default_value
);
885 entry
->plvalue
= NULL
;
889 wDomainName = PLMakeString(WMDOMAIN_NAME);
890 wAttributeDomainName = PLMakeString(WMATTRIBUTE_DOMAIN_NAME);
892 PLRegister(wDomainName, rereadDefaults);
893 PLRegister(wAttributeDomainName, rereadDefaults);
902 wDefaultsInit(int screen_number
)
904 static int defaults_inited
= 0;
907 if (!defaults_inited
) {
911 dict
= PLGetDomain(wDomainName
);
913 wwarning(_("could not read domain \"%s\" from defaults database"),
914 PLGetString(wDomainName
));
923 wDefaultsDestroyDomain(WDDomain
*domain
)
925 if (domain
->dictionary
)
926 PLRelease(domain
->dictionary
);
933 wDefaultsInitDomain(char *domain
, Bool requireDictionary
)
937 static int inited
= 0;
940 proplist_t shared_dict
=NULL
;
947 db
= wmalloc(sizeof(WDDomain
));
948 memset(db
, 0, sizeof(WDDomain
));
949 db
->domain_name
= domain
;
950 db
->path
= wdefaultspathfordomain(domain
);
953 if (the_path
&& stat(the_path
, &stbuf
)>=0) {
954 db
->dictionary
= ReadProplistFromFile(the_path
);
955 if (db
->dictionary
) {
956 if (requireDictionary
&& !PLIsDictionary(db
->dictionary
)) {
957 PLRelease(db
->dictionary
);
958 db
->dictionary
= NULL
;
959 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
962 db
->timestamp
= stbuf
.st_mtime
;
964 wwarning(_("could not load domain %s from user defaults database"),
969 /* global system dictionary */
970 sprintf(path
, "%s/WindowMaker/%s", SYSCONFDIR
, domain
);
971 if (stat(path
, &stbuf
)>=0) {
972 shared_dict
= ReadProplistFromFile(path
);
974 if (requireDictionary
&& !PLIsDictionary(shared_dict
)) {
975 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
977 PLRelease(shared_dict
);
980 if (db
->dictionary
&& PLIsDictionary(shared_dict
) &&
981 PLIsDictionary(db
->dictionary
)) {
982 PLMergeDictionaries(shared_dict
, db
->dictionary
);
983 PLRelease(db
->dictionary
);
984 db
->dictionary
= shared_dict
;
985 if (stbuf
.st_mtime
> db
->timestamp
)
986 db
->timestamp
= stbuf
.st_mtime
;
987 } else if (!db
->dictionary
) {
988 db
->dictionary
= shared_dict
;
989 if (stbuf
.st_mtime
> db
->timestamp
)
990 db
->timestamp
= stbuf
.st_mtime
;
994 wwarning(_("could not load domain %s from global defaults database (%s)"),
999 /* set to save it in user's directory, no matter from where it was read */
1000 if (db
->dictionary
) {
1001 proplist_t tmp
= PLMakeString(db
->path
);
1003 PLSetFilename(db
->dictionary
, tmp
);
1012 wReadStaticDefaults(proplist_t dict
)
1015 WDefaultEntry
*entry
;
1020 for (i
=0; i
<sizeof(staticOptionList
)/sizeof(WDefaultEntry
); i
++) {
1021 entry
= &staticOptionList
[i
];
1024 plvalue
= PLGetDictionaryEntry(dict
, entry
->plkey
);
1029 /* no default in the DB. Use builtin default */
1030 plvalue
= entry
->plvalue
;
1035 (*entry
->convert
)(NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
1036 if (entry
->update
) {
1037 (*entry
->update
)(NULL
, entry
, tdata
, entry
->extra_data
);
1045 wDefaultsCheckDomains(void *foo
)
1051 char path
[PATH_MAX
];
1054 puts("Checking domains...");
1056 if (stat(WDWindowMaker
->path
, &stbuf
)>=0
1057 && WDWindowMaker
->timestamp
< stbuf
.st_mtime
) {
1058 proplist_t shared_dict
= NULL
;
1060 puts("Checking WindowMaker domain");
1062 WDWindowMaker
->timestamp
= stbuf
.st_mtime
;
1064 /* global dictionary */
1065 sprintf(path
, "%s/WindowMaker/WindowMaker", SYSCONFDIR
);
1066 if (stat(path
, &stbuf
)>=0) {
1067 shared_dict
= ReadProplistFromFile(path
);
1068 if (shared_dict
&& !PLIsDictionary(shared_dict
)) {
1069 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
1070 "WindowMaker", path
);
1071 PLRelease(shared_dict
);
1073 } else if (!shared_dict
) {
1074 wwarning(_("could not load domain %s from global defaults database"),
1078 /* user dictionary */
1079 dict
= ReadProplistFromFile(WDWindowMaker
->path
);
1081 if (!PLIsDictionary(dict
)) {
1084 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1085 "WindowMaker", WDWindowMaker
->path
);
1088 PLSetFilename(shared_dict
, PLGetFilename(dict
));
1089 PLMergeDictionaries(shared_dict
, dict
);
1094 for (i
=0; i
<wScreenCount
; i
++) {
1095 scr
= wScreenWithNumber(i
);
1097 wReadDefaults(scr
, dict
);
1099 if (WDWindowMaker
->dictionary
) {
1100 PLRelease(WDWindowMaker
->dictionary
);
1102 WDWindowMaker
->dictionary
= dict
;
1105 wwarning(_("could not load domain %s from user defaults database"),
1109 PLRelease(shared_dict
);
1113 if (stat(WDWindowAttributes
->path
, &stbuf
)>=0
1114 && WDWindowAttributes
->timestamp
< stbuf
.st_mtime
) {
1116 puts("Checking WMWindowAttributes domain");
1118 dict
= ReadProplistFromFile(WDWindowAttributes
->path
);
1120 if (!PLIsDictionary(dict
)) {
1123 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1124 "WMWindowAttributes", WDWindowAttributes
->path
);
1126 if (WDWindowAttributes
->dictionary
)
1127 PLRelease(WDWindowAttributes
->dictionary
);
1128 WDWindowAttributes
->dictionary
= dict
;
1129 for (i
=0; i
<wScreenCount
; i
++) {
1130 scr
= wScreenWithNumber(i
);
1134 wDefaultUpdateIcons(scr
);
1136 /* Update the panel image if changed */
1137 /* Don't worry. If the image is the same these
1138 * functions will have no performance impact. */
1139 image
= wDefaultGetImage(scr
, "Logo", "WMPanel");
1142 wwarning(_("could not load logo image for panels: %s"),
1143 RMessageForError(RErrorCode
));
1145 WMSetApplicationIconImage(scr
->wmscreen
, image
);
1146 RReleaseImage(image
);
1152 wwarning(_("could not load domain %s from user defaults database"),
1153 "WMWindowAttributes");
1155 WDWindowAttributes
->timestamp
= stbuf
.st_mtime
;
1159 if (stat(WDRootMenu
->path
, &stbuf
)>=0
1160 && WDRootMenu
->timestamp
< stbuf
.st_mtime
) {
1161 dict
= ReadProplistFromFile(WDRootMenu
->path
);
1163 puts("Checking WMRootMenu domain");
1166 if (!PLIsArray(dict
) && !PLIsString(dict
)) {
1169 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1170 "WMRootMenu", WDRootMenu
->path
);
1172 if (WDRootMenu
->dictionary
) {
1173 PLRelease(WDRootMenu
->dictionary
);
1175 WDRootMenu
->dictionary
= dict
;
1178 wwarning(_("could not load domain %s from user defaults database"),
1181 WDRootMenu
->timestamp
= stbuf
.st_mtime
;
1186 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, foo
);
1191 wReadDefaults(WScreen
*scr
, proplist_t new_dict
)
1193 proplist_t plvalue
, old_value
;
1194 WDefaultEntry
*entry
;
1196 int update_workspace_back
= 0; /* kluge :/ */
1199 proplist_t old_dict
= (WDWindowMaker
->dictionary
!=new_dict
1200 ? WDWindowMaker
->dictionary
: NULL
);
1206 for (i
=0; i
<sizeof(optionList
)/sizeof(WDefaultEntry
); i
++) {
1207 entry
= &optionList
[i
];
1210 plvalue
= PLGetDictionaryEntry(new_dict
, entry
->plkey
);
1217 old_value
= PLGetDictionaryEntry(old_dict
, entry
->plkey
);
1220 if (!plvalue
&& !old_value
) {
1221 /* no default in the DB. Use builtin default */
1222 plvalue
= entry
->plvalue
;
1223 if (plvalue
&& new_dict
) {
1224 PLInsertDictionaryEntry(new_dict
, entry
->plkey
, plvalue
);
1227 } else if (!plvalue
) {
1228 /* value was deleted from DB. Keep current value */
1230 } else if (!old_value
) {
1231 /* set value for the 1st time */
1232 } else if (!PLIsEqual(plvalue
, old_value
)) {
1233 /* value has changed */
1236 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1237 && update_workspace_back
1238 && scr
->flags
.backimage_helper_launched
) {
1240 /* value was not changed since last time */
1247 printf("Updating %s to %s\n", entry
->key
,
1248 PLGetDescription(plvalue
));
1251 if ((*entry
->convert
)(scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1253 * If the WorkspaceSpecificBack data has been changed
1254 * so that the helper will be launched now, we must be
1255 * sure to send the default background texture config
1258 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0
1259 && !scr
->flags
.backimage_helper_launched
) {
1260 update_workspace_back
= 1;
1262 if (entry
->update
) {
1264 (*entry
->update
)(scr
, entry
, tdata
, entry
->extra_data
);
1270 if (needs_refresh
!=0 && !scr
->flags
.startup
) {
1274 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1275 foo
|= WTextureSettings
;
1276 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1277 foo
|= WFontSettings
;
1278 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1279 foo
|= WColorSettings
;
1281 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1285 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1286 foo
|= WTextureSettings
;
1287 if (needs_refresh
& REFRESH_MENU_FONT
)
1288 foo
|= WFontSettings
;
1289 if (needs_refresh
& REFRESH_MENU_COLOR
)
1290 foo
|= WColorSettings
;
1292 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
,
1296 if (needs_refresh
& REFRESH_WINDOW_FONT
) {
1297 foo
|= WFontSettings
;
1299 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
) {
1300 foo
|= WTextureSettings
;
1302 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
) {
1303 foo
|= WColorSettings
;
1306 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
,
1309 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1311 if (needs_refresh
& REFRESH_ICON_FONT
) {
1312 foo
|= WFontSettings
;
1314 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
) {
1315 foo
|= WTextureSettings
;
1317 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
) {
1318 foo
|= WTextureSettings
;
1321 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1324 if (needs_refresh
& REFRESH_ICON_TILE
)
1325 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1331 wDefaultUpdateIcons(WScreen
*scr
)
1333 WAppIcon
*aicon
= scr
->app_icon_list
;
1334 WWindow
*wwin
= scr
->focused_window
;
1338 file
= wDefaultGetIconFile(scr
, aicon
->wm_instance
, aicon
->wm_class
,
1340 if ((file
&& aicon
->icon
->file
&& strcmp(file
, aicon
->icon
->file
)!=0)
1341 || (file
&& !aicon
->icon
->file
)) {
1344 if (aicon
->icon
->file
)
1345 wfree(aicon
->icon
->file
);
1346 aicon
->icon
->file
= wstrdup(file
);
1348 new_image
= wDefaultGetImage(scr
, aicon
->wm_instance
,
1351 wIconChangeImage(aicon
->icon
, new_image
);
1352 wAppIconPaint(aicon
);
1355 aicon
= aicon
->next
;
1358 if (!wPreferences
.flags
.noclip
)
1359 wClipIconPaint(scr
->clip_icon
);
1362 if (wwin
->icon
&& wwin
->flags
.miniaturized
) {
1363 file
= wDefaultGetIconFile(scr
, wwin
->wm_instance
, wwin
->wm_class
,
1365 if ((file
&& wwin
->icon
->file
&& strcmp(file
, wwin
->icon
->file
)!=0)
1366 || (file
&& !wwin
->icon
->file
)) {
1369 if (wwin
->icon
->file
)
1370 wfree(wwin
->icon
->file
);
1371 wwin
->icon
->file
= wstrdup(file
);
1373 new_image
= wDefaultGetImage(scr
, wwin
->wm_instance
,
1376 wIconChangeImage(wwin
->icon
, new_image
);
1384 /* --------------------------- Local ----------------------- */
1386 #define GET_STRING_OR_DEFAULT(x, var) if (!PLIsString(value)) { \
1387 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1389 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1390 var = entry->default_value;\
1391 } else var = PLGetString(value)\
1398 string2index(proplist_t key
, proplist_t val
, proplist_t def
,
1399 WOptionEnumeration
*values
)
1402 WOptionEnumeration
*v
;
1403 char buffer
[TOTAL_VALUES_LENGTH
];
1405 if (PLIsString(val
) && (str
= PLGetString(val
))) {
1406 for (v
=values
; v
->string
!=NULL
; v
++) {
1407 if (strcasecmp(v
->string
, str
)==0)
1413 for (v
=values
; v
->string
!=NULL
; v
++) {
1416 strcat(buffer
, ", ");
1417 strcat(buffer
, v
->string
);
1420 wwarning(_("wrong option value for key \"%s\". Should be one of %s"),
1421 PLGetString(key
), buffer
);
1424 return string2index(key
, val
, NULL
, values
);
1434 * value - is the value in the defaults DB
1435 * addr - is the address to store the data
1436 * ret - is the address to store a pointer to a temporary buffer. ret
1437 * must not be freed and is used by the set functions
1440 getBool(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1447 GET_STRING_OR_DEFAULT("Boolean", val
);
1450 if ((val
[1]=='\0' && (val
[0]=='y' || val
[0]=='Y'))
1451 || strcasecmp(val
, "YES")==0) {
1454 } else if ((val
[1]=='\0' && (val
[0]=='n' || val
[0]=='N'))
1455 || strcasecmp(val
, "NO")==0) {
1459 if (sscanf(val
, "%i", &i
)==1) {
1465 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""),
1467 if (second_pass
==0) {
1468 val
= PLGetString(entry
->plvalue
);
1470 wwarning(_("using default \"%s\" instead"), val
);
1481 *(char*)addr
= data
;
1489 getInt(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1496 GET_STRING_OR_DEFAULT("Integer", val
);
1498 if (sscanf(val
, "%i", &data
)!=1) {
1499 wwarning(_("can't convert \"%s\" to integer for key \"%s\""),
1501 val
= PLGetString(entry
->plvalue
);
1502 wwarning(_("using default \"%s\" instead"), val
);
1503 if (sscanf(val
, "%i", &data
)!=1) {
1519 getCoord(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1523 char *val_x
, *val_y
;
1524 int nelem
, changed
=0;
1525 proplist_t elem_x
, elem_y
;
1528 if (!PLIsArray(value
)) {
1529 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1530 entry
->key
, "Coordinate");
1532 value
= entry
->plvalue
;
1534 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1540 nelem
= PLGetNumberOfElements(value
);
1542 wwarning(_("Incorrect number of elements in array for key \"%s\"."),
1545 value
= entry
->plvalue
;
1547 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1553 elem_x
= PLGetArrayElement(value
, 0);
1554 elem_y
= PLGetArrayElement(value
, 1);
1556 if (!elem_x
|| !elem_y
|| !PLIsString(elem_x
) || !PLIsString(elem_y
)) {
1557 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."),
1560 value
= entry
->plvalue
;
1562 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1568 val_x
= PLGetString(elem_x
);
1569 val_y
= PLGetString(elem_y
);
1571 if (sscanf(val_x
, "%i", &data
.x
)!=1 || sscanf(val_y
, "%i", &data
.y
)!=1) {
1572 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1574 value
= entry
->plvalue
;
1576 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1584 else if (data
.x
> scr
->scr_width
/3)
1585 data
.x
= scr
->scr_width
/3;
1588 else if (data
.y
> scr
->scr_height
/3)
1589 data
.y
= scr
->scr_height
/3;
1595 *(WCoord
*)addr
= data
;
1603 /* This function is not used at the moment. */
1605 getString(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1610 GET_STRING_OR_DEFAULT("String", data
);
1613 data
= PLGetString(entry
->plvalue
);
1622 *(char**)addr
= wstrdup(data
);
1630 getPathList(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1640 if (!PLIsArray(value
)) {
1641 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1642 entry
->key
, "an array of paths");
1644 value
= entry
->plvalue
;
1646 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1653 count
= PLGetNumberOfElements(value
);
1656 value
= entry
->plvalue
;
1658 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1665 for (i
=0; i
<count
; i
++) {
1666 d
= PLGetArrayElement(value
, i
);
1667 if (!d
|| !PLIsString(d
)) {
1671 len
+= strlen(PLGetString(d
))+1;
1674 ptr
= data
= wmalloc(len
+1);
1676 for (i
=0; i
<count
; i
++) {
1677 d
= PLGetArrayElement(value
, i
);
1678 if (!d
|| !PLIsString(d
)) {
1681 strcpy(ptr
, PLGetString(d
));
1682 ptr
+= strlen(PLGetString(d
));
1686 ptr
--; *(ptr
--) = 0;
1688 if (*(char**)addr
!=NULL
) {
1689 wfree(*(char**)addr
);
1691 *(char**)addr
= data
;
1698 getEnum(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1701 static signed char data
;
1703 data
= string2index(entry
->plkey
, value
, entry
->default_value
,
1704 (WOptionEnumeration
*)entry
->extra_data
);
1712 *(signed char*)addr
= data
;
1721 * (hgradient <color> <color>)
1722 * (vgradient <color> <color>)
1723 * (dgradient <color> <color>)
1724 * (mhgradient <color> <color> ...)
1725 * (mvgradient <color> <color> ...)
1726 * (mdgradient <color> <color> ...)
1727 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1728 * (tpixmap <file> <color>)
1729 * (spixmap <file> <color>)
1730 * (cpixmap <file> <color>)
1731 * (thgradient <file> <opaqueness> <color> <color>)
1732 * (tvgradient <file> <opaqueness> <color> <color>)
1733 * (tdgradient <file> <opaqueness> <color> <color>)
1734 * (function <lib> <function> ...)
1738 parse_texture(WScreen
*scr
, proplist_t pl
)
1743 WTexture
*texture
=NULL
;
1745 nelem
= PLGetNumberOfElements(pl
);
1750 elem
= PLGetArrayElement(pl
, 0);
1751 if (!elem
|| !PLIsString(elem
))
1753 val
= PLGetString(elem
);
1756 if (strcasecmp(val
, "solid")==0) {
1764 elem
= PLGetArrayElement(pl
, 1);
1765 if (!elem
|| !PLIsString(elem
))
1767 val
= PLGetString(elem
);
1769 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1770 wwarning(_("\"%s\" is not a valid color name"), val
);
1774 texture
= (WTexture
*)wTextureMakeSolid(scr
, &color
);
1775 } else if (strcasecmp(val
, "dgradient")==0
1776 || strcasecmp(val
, "vgradient")==0
1777 || strcasecmp(val
, "hgradient")==0) {
1778 RColor color1
, color2
;
1783 wwarning(_("bad number of arguments in gradient specification"));
1787 if (val
[0]=='d' || val
[0]=='D')
1788 type
= WTEX_DGRADIENT
;
1789 else if (val
[0]=='h' || val
[0]=='H')
1790 type
= WTEX_HGRADIENT
;
1792 type
= WTEX_VGRADIENT
;
1795 /* get from color */
1796 elem
= PLGetArrayElement(pl
, 1);
1797 if (!elem
|| !PLIsString(elem
))
1799 val
= PLGetString(elem
);
1801 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1802 wwarning(_("\"%s\" is not a valid color name"), val
);
1806 color1
.red
= xcolor
.red
>> 8;
1807 color1
.green
= xcolor
.green
>> 8;
1808 color1
.blue
= xcolor
.blue
>> 8;
1811 elem
= PLGetArrayElement(pl
, 2);
1812 if (!elem
|| !PLIsString(elem
)) {
1815 val
= PLGetString(elem
);
1817 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1818 wwarning(_("\"%s\" is not a valid color name"), val
);
1822 color2
.red
= xcolor
.red
>> 8;
1823 color2
.green
= xcolor
.green
>> 8;
1824 color2
.blue
= xcolor
.blue
>> 8;
1826 texture
= (WTexture
*)wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1828 } else if (strcasecmp(val
, "igradient")==0) {
1829 RColor colors1
[2], colors2
[2];
1835 wwarning(_("bad number of arguments in gradient specification"));
1839 /* get from color */
1840 for (i
= 0; i
< 2; i
++) {
1841 elem
= PLGetArrayElement(pl
, 1+i
);
1842 if (!elem
|| !PLIsString(elem
))
1844 val
= PLGetString(elem
);
1846 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1847 wwarning(_("\"%s\" is not a valid color name"), val
);
1850 colors1
[i
].alpha
= 255;
1851 colors1
[i
].red
= xcolor
.red
>> 8;
1852 colors1
[i
].green
= xcolor
.green
>> 8;
1853 colors1
[i
].blue
= xcolor
.blue
>> 8;
1855 elem
= PLGetArrayElement(pl
, 3);
1856 if (!elem
|| !PLIsString(elem
))
1858 val
= PLGetString(elem
);
1862 /* get from color */
1863 for (i
= 0; i
< 2; i
++) {
1864 elem
= PLGetArrayElement(pl
, 4+i
);
1865 if (!elem
|| !PLIsString(elem
))
1867 val
= PLGetString(elem
);
1869 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1870 wwarning(_("\"%s\" is not a valid color name"), val
);
1873 colors2
[i
].alpha
= 255;
1874 colors2
[i
].red
= xcolor
.red
>> 8;
1875 colors2
[i
].green
= xcolor
.green
>> 8;
1876 colors2
[i
].blue
= xcolor
.blue
>> 8;
1878 elem
= PLGetArrayElement(pl
, 6);
1879 if (!elem
|| !PLIsString(elem
))
1881 val
= PLGetString(elem
);
1884 texture
= (WTexture
*)wTextureMakeIGradient(scr
, th1
, colors1
,
1887 } else if (strcasecmp(val
, "mhgradient")==0
1888 || strcasecmp(val
, "mvgradient")==0
1889 || strcasecmp(val
, "mdgradient")==0) {
1896 wwarning(_("too few arguments in multicolor gradient specification"));
1900 if (val
[1]=='h' || val
[1]=='H')
1901 type
= WTEX_MHGRADIENT
;
1902 else if (val
[1]=='v' || val
[1]=='V')
1903 type
= WTEX_MVGRADIENT
;
1905 type
= WTEX_MDGRADIENT
;
1909 colors
= wmalloc(sizeof(RColor
*)*(count
+1));
1911 for (i
=0; i
<count
; i
++) {
1912 elem
= PLGetArrayElement(pl
, i
+1);
1913 if (!elem
|| !PLIsString(elem
)) {
1914 for (--i
; i
>=0; --i
) {
1920 val
= PLGetString(elem
);
1922 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1923 wwarning(_("\"%s\" is not a valid color name"), val
);
1924 for (--i
; i
>=0; --i
) {
1930 colors
[i
] = wmalloc(sizeof(RColor
));
1931 colors
[i
]->red
= color
.red
>> 8;
1932 colors
[i
]->green
= color
.green
>> 8;
1933 colors
[i
]->blue
= color
.blue
>> 8;
1938 texture
= (WTexture
*)wTextureMakeMGradient(scr
, type
, colors
);
1939 } else if (strcasecmp(val
, "spixmap")==0 ||
1940 strcasecmp(val
, "cpixmap")==0 ||
1941 strcasecmp(val
, "tpixmap")==0) {
1948 if (val
[0] == 's' || val
[0] == 'S')
1950 else if (val
[0] == 'c' || val
[0] == 'C')
1956 elem
= PLGetArrayElement(pl
, 2);
1957 if (!elem
|| !PLIsString(elem
)) {
1960 val
= PLGetString(elem
);
1962 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1963 wwarning(_("\"%s\" is not a valid color name"), val
);
1968 elem
= PLGetArrayElement(pl
, 1);
1969 if (!elem
|| !PLIsString(elem
))
1971 val
= PLGetString(elem
);
1973 texture
= (WTexture
*)wTextureMakePixmap(scr
, type
, val
, &color
);
1974 } else if (strcasecmp(val
, "thgradient")==0
1975 || strcasecmp(val
, "tvgradient")==0
1976 || strcasecmp(val
, "tdgradient")==0) {
1977 RColor color1
, color2
;
1982 if (val
[1]=='h' || val
[1]=='H')
1983 style
= WTEX_THGRADIENT
;
1984 else if (val
[1]=='v' || val
[1]=='V')
1985 style
= WTEX_TVGRADIENT
;
1987 style
= WTEX_TDGRADIENT
;
1990 wwarning(_("bad number of arguments in textured gradient specification"));
1994 /* get from color */
1995 elem
= PLGetArrayElement(pl
, 3);
1996 if (!elem
|| !PLIsString(elem
))
1998 val
= PLGetString(elem
);
2000 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
2001 wwarning(_("\"%s\" is not a valid color name"), val
);
2005 color1
.red
= xcolor
.red
>> 8;
2006 color1
.green
= xcolor
.green
>> 8;
2007 color1
.blue
= xcolor
.blue
>> 8;
2010 elem
= PLGetArrayElement(pl
, 4);
2011 if (!elem
|| !PLIsString(elem
)) {
2014 val
= PLGetString(elem
);
2016 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
2017 wwarning(_("\"%s\" is not a valid color name"), val
);
2021 color2
.red
= xcolor
.red
>> 8;
2022 color2
.green
= xcolor
.green
>> 8;
2023 color2
.blue
= xcolor
.blue
>> 8;
2026 elem
= PLGetArrayElement(pl
, 2);
2027 if (!elem
|| !PLIsString(elem
))
2030 val
= PLGetString(elem
);
2032 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
2033 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
2038 elem
= PLGetArrayElement(pl
, 1);
2039 if (!elem
|| !PLIsString(elem
))
2041 val
= PLGetString(elem
);
2043 texture
= (WTexture
*)wTextureMakeTGradient(scr
, style
, &color1
, &color2
,
2046 #ifdef TEXTURE_PLUGIN
2047 else if (strcasecmp(val
, "function")==0) {
2048 WTexFunction
*function
;
2049 void (*initFunc
) (Display
*, Colormap
);
2050 char *lib
, *func
, **argv
;
2056 /* get the library name */
2057 elem
= PLGetArrayElement(pl
, 1);
2058 if (!elem
|| !PLIsString(elem
)) {
2061 lib
= PLGetString(elem
);
2063 /* get the function name */
2064 elem
= PLGetArrayElement(pl
, 2);
2065 if (!elem
|| !PLIsString(elem
)) {
2068 func
= PLGetString(elem
);
2071 argv
= (char **)wmalloc(argc
* sizeof(char *));
2073 /* get the parameters */
2074 argv
[0] = wstrdup(func
);
2075 for (i
= 0; i
< argc
- 1; i
++) {
2076 elem
= PLGetArrayElement(pl
, 3 + i
);
2077 if (!elem
|| !PLIsString(elem
)) {
2082 argv
[i
+1] = wstrdup(PLGetString(elem
));
2085 function
= wTextureMakeFunction(scr
, lib
, func
, argc
, argv
);
2089 initFunc
= dlsym(function
->handle
, "initWindowMaker");
2091 initFunc(dpy
, scr
->w_colormap
);
2093 wwarning(_("could not initialize library %s"), lib
);
2096 wwarning(_("could not find function %s::%s"), lib
, func
);
2098 #endif /* HAVE_DLFCN_H */
2099 texture
= (WTexture
*)function
;
2101 #endif /* TEXTURE_PLUGIN */
2103 wwarning(_("invalid texture type %s"), val
);
2112 getTexture(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2115 static WTexture
*texture
;
2119 if (!PLIsArray(value
)) {
2120 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2121 entry
->key
, "Texture");
2123 value
= entry
->plvalue
;
2125 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2131 if (strcmp(entry
->key
, "WidgetColor")==0 && !changed
) {
2134 pl
= PLGetArrayElement(value
, 0);
2135 if (!pl
|| !PLIsString(pl
) || !PLGetString(pl
)
2136 || strcasecmp(PLGetString(pl
), "solid")!=0) {
2137 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2138 entry
->key
, "Solid Texture");
2140 value
= entry
->plvalue
;
2142 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2147 texture
= parse_texture(scr
, value
);
2150 wwarning(_("Error in texture specification for key \"%s\""),
2153 value
= entry
->plvalue
;
2155 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2165 *(WTexture
**)addr
= texture
;
2172 getWSBackground(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
2173 void *addr
, void **ret
)
2181 if (!PLIsArray(value
)) {
2182 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2183 "WorkspaceBack", "Texture or None");
2185 value
= entry
->plvalue
;
2187 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2193 /* only do basic error checking and verify for None texture */
2195 nelem
= PLGetNumberOfElements(value
);
2197 elem
= PLGetArrayElement(value
, 0);
2198 if (!elem
|| !PLIsString(elem
)) {
2199 wwarning(_("Wrong type for workspace background. Should be a texture type."));
2201 value
= entry
->plvalue
;
2203 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2208 val
= PLGetString(elem
);
2210 if (strcasecmp(val
, "None")==0)
2213 *ret
= PLRetain(value
);
2220 getWSSpecificBackground(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
2221 void *addr
, void **ret
)
2228 if (!PLIsArray(value
)) {
2229 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2230 "WorkspaceSpecificBack", "an array of textures");
2232 value
= entry
->plvalue
;
2234 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2240 /* only do basic error checking and verify for None texture */
2242 nelem
= PLGetNumberOfElements(value
);
2245 elem
= PLGetArrayElement(value
, nelem
);
2246 if (!elem
|| !PLIsArray(elem
)) {
2247 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2253 *ret
= PLRetain(value
);
2257 * Kluge to force wmsetbg helper to set the default background.
2258 * If the WorkspaceSpecificBack is changed once wmaker has started,
2259 * the WorkspaceBack won't be sent to the helper, unless the user
2260 * changes it's value too. So, we must force this by removing the
2261 * value from the defaults DB.
2263 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2264 proplist_t key
= PLMakeString("WorkspaceBack");
2266 PLRemoveDictionaryEntry(WDWindowMaker
->dictionary
, key
);
2276 getFont(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2279 static WMFont
*font
;
2282 GET_STRING_OR_DEFAULT("Font", val
);
2284 font
= WMCreateFont(scr
->wmscreen
, val
);
2286 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2289 wfatal(_("could not load any usable font!!!"));
2296 /* can't assign font value outside update function */
2297 wassertrv(addr
== NULL
, True
);
2304 getColor(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2307 static XColor color
;
2311 GET_STRING_OR_DEFAULT("Color", val
);
2315 if (!wGetColor(scr
, val
, &color
)) {
2316 wwarning(_("could not get color for key \"%s\""),
2318 if (second_pass
==0) {
2319 val
= PLGetString(entry
->plvalue
);
2321 wwarning(_("using default \"%s\" instead"), val
);
2333 *(unsigned long*)addr = pixel;
2342 getKeybind(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2345 static WShortKey shortcut
;
2352 GET_STRING_OR_DEFAULT("Key spec", val
);
2354 if (!val
|| strcasecmp(val
, "NONE")==0) {
2355 shortcut
.keycode
= 0;
2356 shortcut
.modifier
= 0;
2367 shortcut
.modifier
= 0;
2368 while ((k
= strchr(b
, '+'))!=NULL
) {
2372 mod
= wXModifierFromKey(b
);
2374 wwarning(_("%s:invalid key modifier \"%s\""), entry
->key
, b
);
2377 shortcut
.modifier
|= mod
;
2383 ksym
= XStringToKeysym(b
);
2385 if (ksym
==NoSymbol
) {
2386 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
,
2391 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2392 if (shortcut
.keycode
==0) {
2393 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2405 getModMask(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2408 static unsigned int mask
;
2411 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2416 mask
= wXModifierFromKey(str
);
2418 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2424 *(unsigned int*)addr
= mask
;
2435 getRImages(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
2436 void *addr
, void **ret
)
2444 GET_STRING_OR_DEFAULT("Image File Path", str
);
2448 image
= RLoadImage(scr
->rcontext
, str
, 0);
2450 wwarning(_("could not load image in option %s: %s"), entry
->key
,
2451 RMessageForError(RErrorCode
));
2455 if (*(RImage
**)addr
) {
2456 RReleaseImage(*(RImage
**)addr
);
2459 *(RImage
**)addr
= image
;
2461 assert(ret
== NULL
);
2464 *(RImage**)ret = image;
2471 #ifdef DEFINABLE_CURSOR
2473 # include <X11/cursorfont.h>
2480 #define CURSOR_ID_NONE (XC_num_glyphs)
2482 static WCursorLookup cursor_table
[] =
2484 { "X_cursor", XC_X_cursor
},
2485 { "arrow", XC_arrow
},
2486 { "based_arrow_down", XC_based_arrow_down
},
2487 { "based_arrow_up", XC_based_arrow_up
},
2488 { "boat", XC_boat
},
2489 { "bogosity", XC_bogosity
},
2490 { "bottom_left_corner", XC_bottom_left_corner
},
2491 { "bottom_right_corner", XC_bottom_right_corner
},
2492 { "bottom_side", XC_bottom_side
},
2493 { "bottom_tee", XC_bottom_tee
},
2494 { "box_spiral", XC_box_spiral
},
2495 { "center_ptr", XC_center_ptr
},
2496 { "circle", XC_circle
},
2497 { "clock", XC_clock
},
2498 { "coffee_mug", XC_coffee_mug
},
2499 { "cross", XC_cross
},
2500 { "cross_reverse", XC_cross_reverse
},
2501 { "crosshair", XC_crosshair
},
2502 { "diamond_cross", XC_diamond_cross
},
2504 { "dotbox", XC_dotbox
},
2505 { "double_arrow", XC_double_arrow
},
2506 { "draft_large", XC_draft_large
},
2507 { "draft_small", XC_draft_small
},
2508 { "draped_box", XC_draped_box
},
2509 { "exchange", XC_exchange
},
2510 { "fleur", XC_fleur
},
2511 { "gobbler", XC_gobbler
},
2512 { "gumby", XC_gumby
},
2513 { "hand1", XC_hand1
},
2514 { "hand2", XC_hand2
},
2515 { "heart", XC_heart
},
2516 { "icon", XC_icon
},
2517 { "iron_cross", XC_iron_cross
},
2518 { "left_ptr", XC_left_ptr
},
2519 { "left_side", XC_left_side
},
2520 { "left_tee", XC_left_tee
},
2521 { "leftbutton", XC_leftbutton
},
2522 { "ll_angle", XC_ll_angle
},
2523 { "lr_angle", XC_lr_angle
},
2525 { "middlebutton", XC_middlebutton
},
2526 { "mouse", XC_mouse
},
2527 { "pencil", XC_pencil
},
2528 { "pirate", XC_pirate
},
2529 { "plus", XC_plus
},
2530 { "question_arrow", XC_question_arrow
},
2531 { "right_ptr", XC_right_ptr
},
2532 { "right_side", XC_right_side
},
2533 { "right_tee", XC_right_tee
},
2534 { "rightbutton", XC_rightbutton
},
2535 { "rtl_logo", XC_rtl_logo
},
2536 { "sailboat", XC_sailboat
},
2537 { "sb_down_arrow", XC_sb_down_arrow
},
2538 { "sb_h_double_arrow", XC_sb_h_double_arrow
},
2539 { "sb_left_arrow", XC_sb_left_arrow
},
2540 { "sb_right_arrow", XC_sb_right_arrow
},
2541 { "sb_up_arrow", XC_sb_up_arrow
},
2542 { "sb_v_double_arrow", XC_sb_v_double_arrow
},
2543 { "shuttle", XC_shuttle
},
2544 { "sizing", XC_sizing
},
2545 { "spider", XC_spider
},
2546 { "spraycan", XC_spraycan
},
2547 { "star", XC_star
},
2548 { "target", XC_target
},
2549 { "tcross", XC_tcross
},
2550 { "top_left_arrow", XC_top_left_arrow
},
2551 { "top_left_corner", XC_top_left_corner
},
2552 { "top_right_corner", XC_top_right_corner
},
2553 { "top_side", XC_top_side
},
2554 { "top_tee", XC_top_tee
},
2555 { "trek", XC_trek
},
2556 { "ul_angle", XC_ul_angle
},
2557 { "umbrella", XC_umbrella
},
2558 { "ur_angle", XC_ur_angle
},
2559 { "watch", XC_watch
},
2560 { "xterm", XC_xterm
},
2561 { NULL
, CURSOR_ID_NONE
}
2565 check_bitmap_status(int status
, char *filename
, Pixmap bitmap
)
2568 case BitmapOpenFailed
:
2569 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2571 case BitmapFileInvalid
:
2572 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2574 case BitmapNoMemory
:
2575 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2578 XFreePixmap(dpy
, bitmap
);
2585 * (builtin, <cursor_name>)
2586 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2589 parse_cursor(WScreen
*scr
, proplist_t pl
, Cursor
*cursor
)
2596 nelem
= PLGetNumberOfElements(pl
);
2600 elem
= PLGetArrayElement(pl
, 0);
2601 if (!elem
|| !PLIsString(elem
)) {
2604 val
= PLGetString(elem
);
2606 if (0 == strcasecmp(val
, "none")) {
2609 } else if (0 == strcasecmp(val
, "builtin")) {
2611 int cursor_id
= CURSOR_ID_NONE
;
2614 wwarning(_("bad number of arguments in cursor specification"));
2617 elem
= PLGetArrayElement(pl
, 1);
2618 if (!elem
|| !PLIsString(elem
)) {
2621 val
= PLGetString(elem
);
2623 for (i
= 0; NULL
!= cursor_table
[i
].name
; i
++) {
2624 if (0 == strcasecmp(val
, cursor_table
[i
].name
)) {
2625 cursor_id
= cursor_table
[i
].id
;
2629 if (CURSOR_ID_NONE
== cursor_id
) {
2630 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2632 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2635 } else if (0 == strcasecmp(val
, "bitmap")) {
2647 wwarning(_("bad number of arguments in cursor specification"));
2650 elem
= PLGetArrayElement(pl
, 1);
2651 if (!elem
|| !PLIsString(elem
)) {
2654 val
= PLGetString(elem
);
2655 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2657 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2660 elem
= PLGetArrayElement(pl
, 2);
2661 if (!elem
|| !PLIsString(elem
)) {
2665 val
= PLGetString(elem
);
2666 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2669 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2672 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
,
2674 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
,
2676 if ((BitmapSuccess
== bitmap_status
) &&
2677 (BitmapSuccess
== mask_status
)) {
2678 fg
.pixel
= scr
->black_pixel
;
2679 bg
.pixel
= scr
->white_pixel
;
2680 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2681 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2682 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2685 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2686 check_bitmap_status(mask_status
, mask_name
, mask
);
2695 getCursor(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2698 static Cursor cursor
;
2703 if (!PLIsArray(value
)) {
2704 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2705 entry
->key
, "cursor specification");
2707 value
= entry
->plvalue
;
2709 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2714 status
= parse_cursor(scr
, value
, &cursor
);
2716 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2718 value
= entry
->plvalue
;
2720 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2729 *(Cursor
*)addr
= cursor
;
2733 #undef CURSOR_ID_NONE
2735 #endif /* DEFINABLE_CURSOR */
2738 /* ---------------- value setting functions --------------- */
2740 setJustify(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
2742 return REFRESH_WINDOW_TITLE_COLOR
;
2746 setClearance(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
2748 return REFRESH_WINDOW_FONT
|REFRESH_BUTTON_IMAGES
|REFRESH_MENU_TITLE_FONT
|REFRESH_MENU_FONT
;
2752 setIfDockPresent(WScreen
*scr
, WDefaultEntry
*entry
, char *flag
, long which
)
2756 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2759 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2769 setStickyIcons(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
2771 if (scr
->workspaces
) {
2772 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2773 wArrangeIcons(scr
, False
);
2780 setPositive(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
2792 setIconTile(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
2798 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2799 wPreferences
.icon_size
,
2800 ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2801 ? WREL_ICON
: WREL_FLAT
);
2803 wwarning(_("could not render texture for icon background"));
2805 wTextureDestroy(scr
, *texture
);
2808 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2810 if (scr
->icon_tile
) {
2812 RReleaseImage(scr
->icon_tile
);
2813 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2816 scr
->icon_tile
= img
;
2819 /* put the icon in the noticeboard hint */
2820 PropSetIconTileHint(scr
, img
);
2823 if (!wPreferences
.flags
.noclip
) {
2824 if (scr
->clip_tile
) {
2825 RReleaseImage(scr
->clip_tile
);
2827 scr
->clip_tile
= wClipMakeTile(scr
, img
);
2830 scr
->icon_tile_pixmap
= pixmap
;
2832 if (scr
->def_icon_pixmap
) {
2833 XFreePixmap(dpy
, scr
->def_icon_pixmap
);
2834 scr
->def_icon_pixmap
= None
;
2836 if (scr
->def_ticon_pixmap
) {
2837 XFreePixmap(dpy
, scr
->def_ticon_pixmap
);
2838 scr
->def_ticon_pixmap
= None
;
2841 if (scr
->icon_back_texture
) {
2842 wTextureDestroy(scr
, (WTexture
*)scr
->icon_back_texture
);
2844 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2846 if (scr
->clip_balloon
)
2847 XSetWindowBackground(dpy
, scr
->clip_balloon
,
2848 (*texture
)->any
.color
.pixel
);
2851 * Free the texture as nobody else will use it, nor refer to it.
2854 wTextureDestroy(scr
, *texture
);
2856 return (reset
? REFRESH_ICON_TILE
: 0);
2862 setWinTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2864 if (scr
->title_font
) {
2865 WMReleaseFont(scr
->title_font
);
2867 scr
->title_font
= font
;
2869 return REFRESH_WINDOW_FONT
|REFRESH_BUTTON_IMAGES
;
2874 setMenuTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2876 if (scr
->menu_title_font
) {
2877 WMReleaseFont(scr
->menu_title_font
);
2880 scr
->menu_title_font
= font
;
2882 return REFRESH_MENU_TITLE_FONT
;
2887 setMenuTextFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2889 if (scr
->menu_entry_font
) {
2890 WMReleaseFont(scr
->menu_entry_font
);
2892 scr
->menu_entry_font
= font
;
2894 return REFRESH_MENU_FONT
;
2900 setIconTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2902 if (scr
->icon_title_font
) {
2903 WMReleaseFont(scr
->icon_title_font
);
2906 scr
->icon_title_font
= font
;
2908 return REFRESH_ICON_FONT
;
2913 setClipTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2915 if (scr
->clip_title_font
) {
2916 WMReleaseFont(scr
->clip_title_font
);
2919 scr
->clip_title_font
= font
;
2921 return REFRESH_ICON_FONT
;
2926 setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2928 if (scr
->workspace_name_font
) {
2929 WMReleaseFont(scr
->workspace_name_font
);
2932 scr
->workspace_name_font
= font
;
2939 setHightlight(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
2941 if (scr
->select_pixel
!=scr
->white_pixel
&&
2942 scr
->select_pixel
!=scr
->black_pixel
) {
2943 wFreeColor(scr
, scr
->select_pixel
);
2946 scr
->select_pixel
= color
->pixel
;
2948 return REFRESH_MENU_COLOR
;
2953 setHightlightText(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
2955 if (scr
->select_text_pixel
!=scr
->white_pixel
&&
2956 scr
->select_text_pixel
!=scr
->black_pixel
) {
2957 wFreeColor(scr
, scr
->select_text_pixel
);
2960 scr
->select_text_pixel
= color
->pixel
;
2962 return REFRESH_MENU_COLOR
;
2967 setClipTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
2969 if (scr
->clip_title_pixel
[index
]!=scr
->white_pixel
&&
2970 scr
->clip_title_pixel
[index
]!=scr
->black_pixel
) {
2971 wFreeColor(scr
, scr
->clip_title_pixel
[index
]);
2973 scr
->clip_title_pixel
[index
] = color
->pixel
;
2975 #ifdef GRADIENT_CLIP_ARROW
2976 if (index
== CLIP_NORMAL
) {
2978 RColor color1
, color2
;
2979 int pt
= CLIP_BUTTON_SIZE
*wPreferences
.icon_size
/64;
2980 int as
= pt
- 15; /* 15 = 5+5+5 */
2982 FREE_PIXMAP(scr
->clip_arrow_gradient
);
2984 color1
.red
= (color
->red
>> 8)*6/10;
2985 color1
.green
= (color
->green
>> 8)*6/10;
2986 color1
.blue
= (color
->blue
>> 8)*6/10;
2988 color2
.red
= WMIN((color
->red
>> 8)*20/10, 255);
2989 color2
.green
= WMIN((color
->green
>> 8)*20/10, 255);
2990 color2
.blue
= WMIN((color
->blue
>> 8)*20/10, 255);
2992 image
= RRenderGradient(as
+1, as
+1, &color1
, &color2
, RDiagonalGradient
);
2993 RConvertImage(scr
->rcontext
, image
, &scr
->clip_arrow_gradient
);
2994 RReleaseImage(image
);
2996 #endif /* GRADIENT_CLIP_ARROW */
2998 return REFRESH_ICON_TITLE_COLOR
;
3003 setWTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3005 if (scr
->window_title_pixel
[index
]!=scr
->white_pixel
&&
3006 scr
->window_title_pixel
[index
]!=scr
->black_pixel
) {
3007 wFreeColor(scr
, scr
->window_title_pixel
[index
]);
3010 scr
->window_title_pixel
[index
] = color
->pixel
;
3012 if (index
== WS_UNFOCUSED
)
3013 XSetForeground(dpy
, scr
->info_text_gc
, color
->pixel
);
3015 return REFRESH_WINDOW_TITLE_COLOR
;
3020 setMenuTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3022 if (scr
->menu_title_pixel
[0]!=scr
->white_pixel
&&
3023 scr
->menu_title_pixel
[0]!=scr
->black_pixel
) {
3024 wFreeColor(scr
, scr
->menu_title_pixel
[0]);
3027 scr
->menu_title_pixel
[0] = color
->pixel
;
3028 XSetForeground(dpy
, scr
->menu_title_gc
, color
->pixel
);
3030 return REFRESH_MENU_TITLE_COLOR
;
3035 setMenuTextColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3038 #define gcm (GCForeground|GCBackground|GCFillStyle)
3040 if (scr
->mtext_pixel
!=scr
->white_pixel
&&
3041 scr
->mtext_pixel
!=scr
->black_pixel
) {
3042 wFreeColor(scr
, scr
->mtext_pixel
);
3045 scr
->mtext_pixel
= color
->pixel
;
3047 XSetForeground(dpy
, scr
->menu_entry_gc
, color
->pixel
);
3050 if (scr
->dtext_pixel
== scr
->mtext_pixel
) {
3051 gcv
.foreground
= scr
->white_pixel
;
3052 gcv
.background
= scr
->black_pixel
;
3053 gcv
.fill_style
= FillStippled
;
3055 gcv
.foreground
= scr
->dtext_pixel
;
3056 gcv
.fill_style
= FillSolid
;
3058 XChangeGC(dpy
, scr
->disabled_menu_entry_gc
, gcm
, &gcv
);
3060 return REFRESH_MENU_COLOR
;
3066 setMenuDisabledColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3069 #define gcm (GCForeground|GCBackground|GCFillStyle)
3071 if (scr
->dtext_pixel
!=scr
->white_pixel
&&
3072 scr
->dtext_pixel
!=scr
->black_pixel
) {
3073 wFreeColor(scr
, scr
->dtext_pixel
);
3076 scr
->dtext_pixel
= color
->pixel
;
3078 if (scr
->dtext_pixel
== scr
->mtext_pixel
) {
3079 gcv
.foreground
= scr
->white_pixel
;
3080 gcv
.background
= scr
->black_pixel
;
3081 gcv
.fill_style
= FillStippled
;
3083 gcv
.foreground
= scr
->dtext_pixel
;
3084 gcv
.fill_style
= FillSolid
;
3086 XChangeGC(dpy
, scr
->disabled_menu_entry_gc
, gcm
, &gcv
);
3088 return REFRESH_MENU_COLOR
;
3093 setIconTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3095 XSetForeground(dpy
, scr
->icon_title_gc
, color
->pixel
);
3097 return REFRESH_ICON_TITLE_COLOR
;
3102 setIconTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3104 if (scr
->icon_title_texture
) {
3105 wTextureDestroy(scr
, (WTexture
*)scr
->icon_title_texture
);
3107 XQueryColor (dpy
, scr
->w_colormap
, color
);
3108 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
3110 return REFRESH_ICON_TITLE_BACK
;
3115 trackDeadProcess(pid_t pid
, unsigned char status
, WScreen
*scr
)
3117 close(scr
->helper_fd
);
3119 scr
->helper_pid
= 0;
3120 scr
->flags
.backimage_helper_launched
= 0;
3125 setWorkspaceSpecificBack(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
3132 if (scr
->flags
.backimage_helper_launched
) {
3133 if (PLGetNumberOfElements(value
)==0) {
3134 SendHelperMessage(scr
, 'C', 0, NULL
);
3135 SendHelperMessage(scr
, 'K', 0, NULL
);
3144 if (PLGetNumberOfElements(value
) == 0)
3147 if (pipe(filedes
) < 0) {
3148 wsyserror("pipe() failed:can't set workspace specific background image");
3156 wsyserror("fork() failed:can't set workspace specific background image");
3157 if (close(filedes
[0]) < 0)
3158 wsyserror("could not close pipe");
3159 if (close(filedes
[1]) < 0)
3160 wsyserror("could not close pipe");
3162 } else if (pid
== 0) {
3165 SetupEnvironment(scr
);
3168 wsyserror("could not close pipe");
3169 if (dup(filedes
[0]) < 0) {
3170 wsyserror("dup() failed:can't set workspace specific background image");
3172 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3173 if (wPreferences
.smooth_workspace_back
)
3174 execlp("wmsetbg", "wmsetbg", "-helper", "-S", dither
, NULL
);
3176 execlp("wmsetbg", "wmsetbg", "-helper", dither
, NULL
);
3177 wsyserror("could not execute wmsetbg");
3181 if (fcntl(filedes
[0], F_SETFD
, FD_CLOEXEC
) < 0) {
3182 wsyserror("error setting close-on-exec flag");
3184 if (fcntl(filedes
[1], F_SETFD
, FD_CLOEXEC
) < 0) {
3185 wsyserror("error setting close-on-exec flag");
3188 scr
->helper_fd
= filedes
[1];
3189 scr
->helper_pid
= pid
;
3190 scr
->flags
.backimage_helper_launched
= 1;
3192 wAddDeathHandler(pid
, (WDeathHandler
*)trackDeadProcess
, scr
);
3194 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3199 for (i
= 0; i
< PLGetNumberOfElements(value
); i
++) {
3200 val
= PLGetArrayElement(value
, i
);
3201 if (val
&& PLIsArray(val
) && PLGetNumberOfElements(val
)>0) {
3202 str
= PLGetDescription(val
);
3204 SendHelperMessage(scr
, 'S', i
+1, str
);
3208 SendHelperMessage(scr
, 'U', i
+1, NULL
);
3219 setWorkspaceBack(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
3222 if (scr
->flags
.backimage_helper_launched
) {
3225 if (PLGetNumberOfElements(value
)==0) {
3226 SendHelperMessage(scr
, 'U', 0, NULL
);
3228 /* set the default workspace background to this one */
3229 str
= PLGetDescription(value
);
3231 SendHelperMessage(scr
, 'S', 0, str
);
3233 SendHelperMessage(scr
, 'C', scr
->current_workspace
+1, NULL
);
3235 SendHelperMessage(scr
, 'U', 0, NULL
);
3238 } else if (PLGetNumberOfElements(value
) > 0) {
3243 SetupEnvironment(scr
);
3244 text
= PLGetDescription(value
);
3245 command
= wmalloc(strlen(text
)+40);
3246 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3247 if (wPreferences
.smooth_workspace_back
)
3248 sprintf(command
, "wmsetbg %s -S -p '%s' &", dither
, text
);
3250 sprintf(command
, "wmsetbg %s -p '%s' &", dither
, text
);
3262 setWidgetColor(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3264 if (scr
->widget_texture
) {
3265 wTextureDestroy(scr
, (WTexture
*)scr
->widget_texture
);
3267 scr
->widget_texture
= *(WTexSolid
**)texture
;
3274 setFTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3276 if (scr
->window_title_texture
[WS_FOCUSED
]) {
3277 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3279 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3281 return REFRESH_WINDOW_TEXTURES
;
3286 setPTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3288 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
3289 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3291 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3293 return REFRESH_WINDOW_TEXTURES
;
3298 setUTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3300 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
3301 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3303 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3305 return REFRESH_WINDOW_TEXTURES
;
3310 setResizebarBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3312 if (scr
->resizebar_texture
[0]) {
3313 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3315 scr
->resizebar_texture
[0] = *texture
;
3317 return REFRESH_WINDOW_TEXTURES
;
3322 setMenuTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3324 if (scr
->menu_title_texture
[0]) {
3325 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3327 scr
->menu_title_texture
[0] = *texture
;
3329 return REFRESH_MENU_TITLE_TEXTURE
;
3334 setMenuTextBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3336 if (scr
->menu_item_texture
) {
3337 wTextureDestroy(scr
, scr
->menu_item_texture
);
3338 wTextureDestroy(scr
, (WTexture
*)scr
->menu_item_auxtexture
);
3340 scr
->menu_item_texture
= *texture
;
3342 scr
->menu_item_auxtexture
3343 = wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3345 return REFRESH_MENU_TEXTURE
;
3350 setKeyGrab(WScreen
*scr
, WDefaultEntry
*entry
, WShortKey
*shortcut
, long index
)
3353 wKeyBindings
[index
] = *shortcut
;
3355 wwin
= scr
->focused_window
;
3357 while (wwin
!=NULL
) {
3358 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3360 if (!WFLAGP(wwin
, no_bind_keys
)) {
3361 wWindowSetKeyGrabs(wwin
);
3371 setIconPosition(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
3373 wArrangeIcons(scr
, True
);
3380 updateUsableArea(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
3382 wScreenUpdateUsableArea(scr
);
3389 setMenuStyle(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
3391 return REFRESH_MENU_TEXTURE
;
3397 setButtonImages(WScreen *scr, WDefaultEntry *entry, int *value, void *foo)
3399 return REFRESH_BUTTON_IMAGES;
3405 * Need access to the double click variables, so that all widgets in
3406 * wmaker panels will have the same dbl-click values.
3407 * TODO: figure a better way of dealing with it.
3409 #include <WINGs/WINGsP.h>
3412 setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
3414 extern _WINGsConfiguration WINGsConfiguration
;
3419 WINGsConfiguration
.doubleClickDelay
= *value
;
3427 setMultiByte(WScreen
*scr
, WDefaultEntry
*entry
, char *value
, void *foo
)
3429 extern _WINGsConfiguration WINGsConfiguration
;
3431 WINGsConfiguration
.useMultiByte
= *value
;
3437 #ifdef DEFINABLE_CURSOR
3439 setCursor(WScreen
*scr
, WDefaultEntry
*entry
, Cursor
*cursor
, long index
)
3441 if (None
!= wCursor
[index
])
3443 XFreeCursor(dpy
, wCursor
[index
]);
3446 wCursor
[index
] = *cursor
;
3448 if ((WCUR_ROOT
== index
) && (None
!= *cursor
))
3450 XDefineCursor(dpy
, scr
->root_win
, *cursor
);
3455 #endif /* DEFINABLE_CURSOR*/