1 /* defaults.c - manage configuration through defaults db
3 * Window Maker window manager
5 * Copyright (c) 1997-2003 Alfredo K. Kojima
6 * Copyright (c) 1998-2003 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 #ifdef VIRTUAL_DESKTOP
159 static int setVirtualDeskEnable();
161 static int setMenuTitleColor();
162 static int setMenuTextColor();
163 static int setMenuDisabledColor();
164 static int setMenuTitleBack();
165 static int setMenuTextBack();
166 static int setHightlight();
167 static int setHightlightText();
168 static int setKeyGrab();
169 static int setDoubleClick();
170 static int setIconPosition();
172 static int setClipTitleFont();
173 static int setClipTitleColor();
175 static int setMenuStyle();
177 static int setMultiByte();
179 static int updateUsableArea();
181 extern Cursor wCursor
[WCUR_LAST
];
182 static int getCursor();
183 static int setCursor();
187 * Tables to convert strings to enumeration values.
188 * Values stored are char
192 /* WARNING: sum of length of all value strings must not exceed
194 #define TOTAL_VALUES_LENGTH 80
199 #define REFRESH_WINDOW_TEXTURES (1<<0)
200 #define REFRESH_MENU_TEXTURE (1<<1)
201 #define REFRESH_MENU_FONT (1<<2)
202 #define REFRESH_MENU_COLOR (1<<3)
203 #define REFRESH_MENU_TITLE_TEXTURE (1<<4)
204 #define REFRESH_MENU_TITLE_FONT (1<<5)
205 #define REFRESH_MENU_TITLE_COLOR (1<<6)
206 #define REFRESH_WINDOW_TITLE_COLOR (1<<7)
207 #define REFRESH_WINDOW_FONT (1<<8)
208 #define REFRESH_ICON_TILE (1<<9)
209 #define REFRESH_ICON_FONT (1<<10)
210 #define REFRESH_WORKSPACE_BACK (1<<11)
212 #define REFRESH_BUTTON_IMAGES (1<<12)
214 #define REFRESH_ICON_TITLE_COLOR (1<<13)
215 #define REFRESH_ICON_TITLE_BACK (1<<14)
219 static WOptionEnumeration seFocusModes
[] = {
220 {"Manual", WKF_CLICK
, 0}, {"ClickToFocus", WKF_CLICK
, 1},
221 {"Sloppy", WKF_SLOPPY
, 0}, {"SemiAuto", WKF_SLOPPY
, 1}, {"Auto", WKF_SLOPPY
, 1},
225 static WOptionEnumeration seColormapModes
[] = {
226 {"Manual", WCM_CLICK
, 0}, {"ClickToFocus", WCM_CLICK
, 1},
227 {"Auto", WCM_POINTER
, 0}, {"FocusFollowMouse", WCM_POINTER
, 1},
231 static WOptionEnumeration sePlacements
[] = {
232 {"Auto", WPM_AUTO
, 0},
233 {"Smart", WPM_SMART
, 0},
234 {"Cascade", WPM_CASCADE
, 0},
235 {"Random", WPM_RANDOM
, 0},
236 {"Manual", WPM_MANUAL
, 0},
240 static WOptionEnumeration seGeomDisplays
[] = {
241 {"None", WDIS_NONE
, 0},
242 {"Center", WDIS_CENTER
, 0},
243 {"Corner", WDIS_TOPLEFT
, 0},
244 {"Floating", WDIS_FRAME_CENTER
, 0},
245 {"Line", WDIS_NEW
, 0},
249 static WOptionEnumeration seSpeeds
[] = {
250 {"UltraFast", SPEED_ULTRAFAST
, 0},
251 {"Fast", SPEED_FAST
, 0},
252 {"Medium", SPEED_MEDIUM
, 0},
253 {"Slow", SPEED_SLOW
, 0},
254 {"UltraSlow", SPEED_ULTRASLOW
, 0},
258 static WOptionEnumeration seMouseButtonActions
[] = {
259 {"None", WA_NONE
, 0},
260 {"SelectWindows", WA_SELECT_WINDOWS
, 0},
261 {"OpenApplicationsMenu", WA_OPEN_APPMENU
, 0},
262 {"OpenWindowListMenu", WA_OPEN_WINLISTMENU
, 0},
266 static WOptionEnumeration seMouseWheelActions
[] = {
267 {"None", WA_NONE
, 0},
268 {"SwitchWorkspaces", WA_SWITCH_WORKSPACES
, 0},
272 static WOptionEnumeration seIconificationStyles
[] = {
273 {"Zoom", WIS_ZOOM
, 0},
274 {"Twist", WIS_TWIST
, 0},
275 {"Flip", WIS_FLIP
, 0},
276 {"None", WIS_NONE
, 0},
277 {"random", WIS_RANDOM
, 0},
281 static WOptionEnumeration seJustifications
[] = {
282 {"Left", WTJ_LEFT
, 0},
283 {"Center", WTJ_CENTER
, 0},
284 {"Right", WTJ_RIGHT
, 0},
288 static WOptionEnumeration seIconPositions
[] = {
289 {"blv", IY_BOTTOM
|IY_LEFT
|IY_VERT
, 0},
290 {"blh", IY_BOTTOM
|IY_LEFT
|IY_HORIZ
, 0},
291 {"brv", IY_BOTTOM
|IY_RIGHT
|IY_VERT
, 0},
292 {"brh", IY_BOTTOM
|IY_RIGHT
|IY_HORIZ
, 0},
293 {"tlv", IY_TOP
|IY_LEFT
|IY_VERT
, 0},
294 {"tlh", IY_TOP
|IY_LEFT
|IY_HORIZ
, 0},
295 {"trv", IY_TOP
|IY_RIGHT
|IY_VERT
, 0},
296 {"trh", IY_TOP
|IY_RIGHT
|IY_HORIZ
, 0},
300 static WOptionEnumeration seMenuStyles
[] = {
301 {"normal", MS_NORMAL
, 0},
302 {"singletexture", MS_SINGLE_TEXTURE
, 0},
303 {"flat", MS_FLAT
, 0},
308 static WOptionEnumeration seDisplayPositions
[] = {
309 {"none", WD_NONE
, 0},
310 {"center", WD_CENTER
, 0},
312 {"bottom", WD_BOTTOM
, 0},
313 {"topleft", WD_TOPLEFT
, 0},
314 {"topright", WD_TOPRIGHT
, 0},
315 {"bottomleft", WD_BOTTOMLEFT
, 0},
316 {"bottomright", WD_BOTTOMRIGHT
, 0},
320 static WOptionEnumeration seWorkspaceBorder
[] = {
321 {"None", WB_NONE
, 0},
322 {"LeftRight", WB_LEFTRIGHT
, 0},
323 {"TopBottom", WB_TOPBOTTOM
, 0},
324 {"AllDirections", WB_ALLDIRS
, 0},
330 * ALL entries in the tables bellow, NEED to have a default value
331 * defined, and this value needs to be correct.
334 /* these options will only affect the window manager on startup
336 * static defaults can't access the screen data, because it is
337 * created after these defaults are read
339 WDefaultEntry staticOptionList
[] = {
341 {"ColormapSize", "4", NULL
,
342 &wPreferences
.cmap_size
, getInt
, NULL
344 {"DisableDithering", "NO", NULL
,
345 &wPreferences
.no_dithering
, getBool
, NULL
347 /* static by laziness */
348 {"IconSize", "64", NULL
,
349 &wPreferences
.icon_size
, getInt
, NULL
351 {"ModifierKey", "Mod1", NULL
,
352 &wPreferences
.modifier_mask
, getModMask
, NULL
354 {"DisableWSMouseActions", "NO", NULL
,
355 &wPreferences
.disable_root_mouse
, getBool
, NULL
357 {"FocusMode", "manual", seFocusModes
,
358 &wPreferences
.focus_mode
, getEnum
, NULL
359 }, /* have a problem when switching from manual to sloppy without restart */
360 {"NewStyle", "NO", NULL
,
361 &wPreferences
.new_style
, getBool
, NULL
363 {"DisableDock", "NO", (void*) WM_DOCK
,
364 NULL
, getBool
, setIfDockPresent
366 {"DisableClip", "NO", (void*) WM_CLIP
,
367 NULL
, getBool
, setIfDockPresent
369 {"DisableMiniwindows", "NO", NULL
,
370 &wPreferences
.disable_miniwindows
, getBool
, NULL
373 ,{"MultiByteText", "NO", NULL
,
374 &wPreferences
.multi_byte_text
, getBool
, setMultiByte
381 WDefaultEntry optionList
[] = {
382 /* dynamic options */
383 {"IconPosition", "blh", seIconPositions
,
384 &wPreferences
.icon_yard
, getEnum
, setIconPosition
386 {"IconificationStyle", "Zoom", seIconificationStyles
,
387 &wPreferences
.iconification_style
, getEnum
, NULL
389 {"MouseLeftButtonAction", "SelectWindows", seMouseButtonActions
,
390 &wPreferences
.mouse_button1
, getEnum
, NULL
392 {"MouseMiddleButtonAction", "OpenWindowListMenu", seMouseButtonActions
,
393 &wPreferences
.mouse_button2
, getEnum
, NULL
395 {"MouseRightButtonAction", "OpenApplicationsMenu", seMouseButtonActions
,
396 &wPreferences
.mouse_button3
, getEnum
, NULL
398 {"MouseWheelAction", "None", seMouseWheelActions
,
399 &wPreferences
.mouse_wheel
, getEnum
, NULL
401 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
402 &wPreferences
.pixmap_path
, getPathList
, NULL
404 {"IconPath", DEF_ICON_PATHS
, NULL
,
405 &wPreferences
.icon_path
, getPathList
, NULL
407 {"ColormapMode", "auto", seColormapModes
,
408 &wPreferences
.colormap_mode
, getEnum
, NULL
410 {"AutoFocus", "NO", NULL
,
411 &wPreferences
.auto_focus
, getBool
, NULL
413 {"RaiseDelay", "0", NULL
,
414 &wPreferences
.raise_delay
, getInt
, NULL
416 {"WindozeCycling", "NO", NULL
,
417 &wPreferences
.windows_cycling
,getBool
, NULL
419 {"CirculateRaise", "NO", NULL
,
420 &wPreferences
.circ_raise
, getBool
, NULL
422 {"Superfluous", "NO", NULL
,
423 &wPreferences
.superfluous
, getBool
, NULL
425 {"AdvanceToNewWorkspace", "NO", NULL
,
426 &wPreferences
.ws_advance
, getBool
, NULL
428 {"CycleWorkspaces", "NO", NULL
,
429 &wPreferences
.ws_cycle
, getBool
, NULL
431 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
432 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
434 {"WorkspaceBorder", "None", seWorkspaceBorder
,
435 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
437 {"WorkspaceBorderSize", "0", NULL
,
438 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
440 #ifdef VIRTUAL_DESKTOP
441 {"EnableVirtualDesktop", "NO", NULL
,
442 &wPreferences
.vdesk_enable
, getBool
, setVirtualDeskEnable
444 {"VirtualEdgeExtendSpace", "0", NULL
,
445 &wPreferences
.vedge_bordersize
, getInt
, NULL
447 {"VirtualEdgeHorizonScrollSpeed", "30", NULL
,
448 &wPreferences
.vedge_hscrollspeed
, getInt
, NULL
450 {"VirtualEdgeVerticalScrollSpeed", "30", NULL
,
451 &wPreferences
.vedge_vscrollspeed
, getInt
, NULL
453 {"VirtualEdgeResistance", "30", NULL
,
454 &wPreferences
.vedge_resistance
, getInt
, NULL
456 {"VirtualEdgeAttraction", "30", NULL
,
457 &wPreferences
.vedge_attraction
, getInt
, NULL
459 {"VirtualEdgeLeftKey", "None", (void*)WKBD_VDESK_LEFT
,
460 NULL
, getKeybind
, setKeyGrab
462 {"VirtualEdgeRightKey", "None", (void*)WKBD_VDESK_RIGHT
,
463 NULL
, getKeybind
, setKeyGrab
465 {"VirtualEdgeUpKey", "None", (void*)WKBD_VDESK_UP
,
466 NULL
, getKeybind
, setKeyGrab
468 {"VirtualEdgeDownKey", "None", (void*)WKBD_VDESK_DOWN
,
469 NULL
, getKeybind
, setKeyGrab
472 {"StickyIcons", "NO", NULL
,
473 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
475 {"SaveSessionOnExit", "NO", NULL
,
476 &wPreferences
.save_session_on_exit
, getBool
, NULL
478 {"WrapMenus", "NO", NULL
,
479 &wPreferences
.wrap_menus
, getBool
, NULL
481 {"ScrollableMenus", "NO", NULL
,
482 &wPreferences
.scrollable_menus
, getBool
, NULL
484 {"MenuScrollSpeed", "medium", seSpeeds
,
485 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
487 {"IconSlideSpeed", "medium", seSpeeds
,
488 &wPreferences
.icon_slide_speed
, getEnum
, NULL
490 {"ShadeSpeed", "medium", seSpeeds
,
491 &wPreferences
.shade_speed
, getEnum
, NULL
493 {"DoubleClickTime", "250", (void*) &wPreferences
.dblclick_time
,
494 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
,
496 {"AlignSubmenus", "NO", NULL
,
497 &wPreferences
.align_menus
, getBool
, NULL
499 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
500 &wPreferences
.open_transients_with_parent
, getBool
, NULL
502 {"WindowPlacement", "auto", sePlacements
,
503 &wPreferences
.window_placement
, getEnum
, NULL
505 {"IgnoreFocusClick","NO", NULL
,
506 &wPreferences
.ignore_focus_click
, getBool
, NULL
508 {"UseSaveUnders", "NO", NULL
,
509 &wPreferences
.use_saveunders
, getBool
, NULL
511 {"OpaqueMove", "NO", NULL
,
512 &wPreferences
.opaque_move
, getBool
, NULL
514 {"DisableSound", "NO", NULL
,
515 &wPreferences
.no_sound
, getBool
, NULL
517 {"DisableAnimations", "NO", NULL
,
518 &wPreferences
.no_animations
, getBool
, NULL
520 {"DontLinkWorkspaces","NO", NULL
,
521 &wPreferences
.no_autowrap
, getBool
, NULL
523 {"AutoArrangeIcons", "NO", NULL
,
524 &wPreferences
.auto_arrange_icons
, getBool
, NULL
526 {"NoWindowOverDock", "NO", NULL
,
527 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
529 {"NoWindowOverIcons", "NO", NULL
,
530 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
532 {"WindowPlaceOrigin", "(0, 0)", NULL
,
533 &wPreferences
.window_place_origin
, getCoord
, NULL
535 {"ResizeDisplay", "corner", seGeomDisplays
,
536 &wPreferences
.size_display
, getEnum
, NULL
538 {"MoveDisplay", "corner", seGeomDisplays
,
539 &wPreferences
.move_display
, getEnum
, NULL
541 {"DontConfirmKill", "NO", NULL
,
542 &wPreferences
.dont_confirm_kill
, getBool
,NULL
544 {"WindowTitleBalloons", "NO", NULL
,
545 &wPreferences
.window_balloon
, getBool
, NULL
547 {"MiniwindowTitleBalloons", "NO", NULL
,
548 &wPreferences
.miniwin_balloon
,getBool
, NULL
550 {"AppIconBalloons", "NO", NULL
,
551 &wPreferences
.appicon_balloon
,getBool
, NULL
553 {"HelpBalloons", "NO", NULL
,
554 &wPreferences
.help_balloon
, getBool
, NULL
556 {"EdgeResistance", "30", NULL
,
557 &wPreferences
.edge_resistance
,getInt
, NULL
559 {"Attraction", "NO", NULL
,
560 &wPreferences
.attract
, getBool
, NULL
562 {"DisableBlinking", "NO", NULL
,
563 &wPreferences
.dont_blink
, getBool
, NULL
566 {"MenuStyle", "normal", seMenuStyles
,
567 &wPreferences
.menu_style
, getEnum
, setMenuStyle
569 {"WidgetColor", "(solid, gray)", NULL
,
570 NULL
, getTexture
, setWidgetColor
,
572 {"WorkspaceSpecificBack","()", NULL
,
573 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
575 /* WorkspaceBack must come after WorkspaceSpecificBack or
576 * WorkspaceBack wont know WorkspaceSpecificBack was also
577 * specified and 2 copies of wmsetbg will be launched */
578 {"WorkspaceBack", "(solid, black)", NULL
,
579 NULL
, getWSBackground
,setWorkspaceBack
581 {"SmoothWorkspaceBack", "NO", NULL
,
584 {"IconBack", "(solid, gray)", NULL
,
585 NULL
, getTexture
, setIconTile
587 {"TitleJustify", "center", seJustifications
,
588 &wPreferences
.title_justification
, getEnum
, setJustify
590 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
591 NULL
, getFont
, setWinTitleFont
,
593 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
594 &wPreferences
.window_title_clearance
, getInt
, setClearance
596 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
597 &wPreferences
.menu_title_clearance
, getInt
, setClearance
599 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
600 &wPreferences
.menu_text_clearance
, getInt
, setClearance
602 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
603 NULL
, getFont
, setMenuTitleFont
605 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
606 NULL
, getFont
, setMenuTextFont
608 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
609 NULL
, getFont
, setIconTitleFont
611 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
612 NULL
, getFont
, setClipTitleFont
614 {"LargeDisplayFont",DEF_WORKSPACE_NAME_FONT
, NULL
,
615 NULL
, getFont
, setLargeDisplayFont
617 {"HighlightColor", "white", NULL
,
618 NULL
, getColor
, setHightlight
620 {"HighlightTextColor", "black", NULL
,
621 NULL
, getColor
, setHightlightText
623 {"ClipTitleColor", "black", (void*)CLIP_NORMAL
,
624 NULL
, getColor
, setClipTitleColor
626 {"CClipTitleColor", "\"#454045\"", (void*)CLIP_COLLAPSED
,
627 NULL
, getColor
, setClipTitleColor
629 {"FTitleColor", "white", (void*)WS_FOCUSED
,
630 NULL
, getColor
, setWTitleColor
632 {"PTitleColor", "white", (void*)WS_PFOCUSED
,
633 NULL
, getColor
, setWTitleColor
635 {"UTitleColor", "black", (void*)WS_UNFOCUSED
,
636 NULL
, getColor
, setWTitleColor
638 {"FTitleBack", "(solid, black)", NULL
,
639 NULL
, getTexture
, setFTitleBack
641 {"PTitleBack", "(solid, \"#616161\")", NULL
,
642 NULL
, getTexture
, setPTitleBack
644 {"UTitleBack", "(solid, gray)", NULL
,
645 NULL
, getTexture
, setUTitleBack
647 {"ResizebarBack", "(solid, gray)", NULL
,
648 NULL
, getTexture
, setResizebarBack
650 {"MenuTitleColor", "white", NULL
,
651 NULL
, getColor
, setMenuTitleColor
653 {"MenuTextColor", "black", NULL
,
654 NULL
, getColor
, setMenuTextColor
656 {"MenuDisabledColor", "\"#616161\"", NULL
,
657 NULL
, getColor
, setMenuDisabledColor
659 {"MenuTitleBack", "(solid, black)", NULL
,
660 NULL
, getTexture
, setMenuTitleBack
662 {"MenuTextBack", "(solid, gray)", NULL
,
663 NULL
, getTexture
, setMenuTextBack
665 {"IconTitleColor", "white", NULL
,
666 NULL
, getColor
, setIconTitleColor
668 {"IconTitleBack", "black", NULL
,
669 NULL
, getColor
, setIconTitleBack
673 {"RootMenuKey", "None", (void*)WKBD_ROOTMENU
,
674 NULL
, getKeybind
, setKeyGrab
676 {"WindowListKey", "None", (void*)WKBD_WINDOWLIST
,
677 NULL
, getKeybind
, setKeyGrab
680 {"WindowMenuKey", "None", (void*)WKBD_WINDOWMENU
,
681 NULL
, getKeybind
, setKeyGrab
683 {"ClipLowerKey", "None", (void*)WKBD_CLIPLOWER
,
684 NULL
, getKeybind
, setKeyGrab
686 {"ClipRaiseKey", "None", (void*)WKBD_CLIPRAISE
,
687 NULL
, getKeybind
, setKeyGrab
689 {"ClipRaiseLowerKey", "None", (void*)WKBD_CLIPRAISELOWER
,
690 NULL
, getKeybind
, setKeyGrab
692 {"MiniaturizeKey", "None", (void*)WKBD_MINIATURIZE
,
693 NULL
, getKeybind
, setKeyGrab
695 {"HideKey", "None", (void*)WKBD_HIDE
,
696 NULL
, getKeybind
, setKeyGrab
698 {"HideOthersKey", "None", (void*)WKBD_HIDE_OTHERS
,
699 NULL
, getKeybind
, setKeyGrab
701 {"MoveResizeKey", "None", (void*)WKBD_MOVERESIZE
,
702 NULL
, getKeybind
, setKeyGrab
704 {"CloseKey", "None", (void*)WKBD_CLOSE
,
705 NULL
, getKeybind
, setKeyGrab
707 {"MaximizeKey", "None", (void*)WKBD_MAXIMIZE
,
708 NULL
, getKeybind
, setKeyGrab
710 {"VMaximizeKey", "None", (void*)WKBD_VMAXIMIZE
,
711 NULL
, getKeybind
, setKeyGrab
713 {"HMaximizeKey", "None", (void*)WKBD_HMAXIMIZE
,
714 NULL
, getKeybind
, setKeyGrab
716 {"RaiseKey", "\"Meta+Up\"", (void*)WKBD_RAISE
,
717 NULL
, getKeybind
, setKeyGrab
719 {"LowerKey", "\"Meta+Down\"", (void*)WKBD_LOWER
,
720 NULL
, getKeybind
, setKeyGrab
722 {"RaiseLowerKey", "None", (void*)WKBD_RAISELOWER
,
723 NULL
, getKeybind
, setKeyGrab
725 {"ShadeKey", "None", (void*)WKBD_SHADE
,
726 NULL
, getKeybind
, setKeyGrab
728 {"SelectKey", "None", (void*)WKBD_SELECT
,
729 NULL
, getKeybind
, setKeyGrab
731 {"FocusNextKey", "None", (void*)WKBD_FOCUSNEXT
,
732 NULL
, getKeybind
, setKeyGrab
734 {"FocusPrevKey", "None", (void*)WKBD_FOCUSPREV
,
735 NULL
, getKeybind
, setKeyGrab
737 {"NextWorkspaceKey", "None", (void*)WKBD_NEXTWORKSPACE
,
738 NULL
, getKeybind
, setKeyGrab
740 {"PrevWorkspaceKey", "None", (void*)WKBD_PREVWORKSPACE
,
741 NULL
, getKeybind
, setKeyGrab
743 {"NextWorkspaceLayerKey", "None", (void*)WKBD_NEXTWSLAYER
,
744 NULL
, getKeybind
, setKeyGrab
746 {"PrevWorkspaceLayerKey", "None", (void*)WKBD_PREVWSLAYER
,
747 NULL
, getKeybind
, setKeyGrab
749 {"Workspace1Key", "None", (void*)WKBD_WORKSPACE1
,
750 NULL
, getKeybind
, setKeyGrab
752 {"Workspace2Key", "None", (void*)WKBD_WORKSPACE2
,
753 NULL
, getKeybind
, setKeyGrab
755 {"Workspace3Key", "None", (void*)WKBD_WORKSPACE3
,
756 NULL
, getKeybind
, setKeyGrab
758 {"Workspace4Key", "None", (void*)WKBD_WORKSPACE4
,
759 NULL
, getKeybind
, setKeyGrab
761 {"Workspace5Key", "None", (void*)WKBD_WORKSPACE5
,
762 NULL
, getKeybind
, setKeyGrab
764 {"Workspace6Key", "None", (void*)WKBD_WORKSPACE6
,
765 NULL
, getKeybind
, setKeyGrab
767 {"Workspace7Key", "None", (void*)WKBD_WORKSPACE7
,
768 NULL
, getKeybind
, setKeyGrab
770 {"Workspace8Key", "None", (void*)WKBD_WORKSPACE8
,
771 NULL
, getKeybind
, setKeyGrab
773 {"Workspace9Key", "None", (void*)WKBD_WORKSPACE9
,
774 NULL
, getKeybind
, setKeyGrab
776 {"Workspace10Key", "None", (void*)WKBD_WORKSPACE10
,
777 NULL
, getKeybind
, setKeyGrab
779 {"WindowShortcut1Key","None", (void*)WKBD_WINDOW1
,
780 NULL
, getKeybind
, setKeyGrab
782 {"WindowShortcut2Key","None", (void*)WKBD_WINDOW2
,
783 NULL
, getKeybind
, setKeyGrab
785 {"WindowShortcut3Key","None", (void*)WKBD_WINDOW3
,
786 NULL
, getKeybind
, setKeyGrab
788 {"WindowShortcut4Key","None", (void*)WKBD_WINDOW4
,
789 NULL
, getKeybind
, setKeyGrab
791 ,{"WindowShortcut5Key","None", (void*)WKBD_WINDOW5
,
792 NULL
, getKeybind
, setKeyGrab
794 {"WindowShortcut6Key","None", (void*)WKBD_WINDOW6
,
795 NULL
, getKeybind
, setKeyGrab
797 {"WindowShortcut7Key","None", (void*)WKBD_WINDOW7
,
798 NULL
, getKeybind
, setKeyGrab
800 {"WindowShortcut8Key","None", (void*)WKBD_WINDOW8
,
801 NULL
, getKeybind
, setKeyGrab
803 {"WindowShortcut9Key","None", (void*)WKBD_WINDOW9
,
804 NULL
, getKeybind
, setKeyGrab
806 {"WindowShortcut10Key","None", (void*)WKBD_WINDOW10
,
807 NULL
, getKeybind
, setKeyGrab
809 {"ScreenSwitchKey", "None", (void*)WKBD_SWITCH_SCREEN
,
810 NULL
, getKeybind
, setKeyGrab
813 #ifdef KEEP_XKB_LOCK_STATUS
814 {"ToggleKbdModeKey", "None", (void*)WKBD_TOGGLE
,
815 NULL
, getKeybind
, setKeyGrab
817 {"KbdModeLock", "NO", NULL
,
818 &wPreferences
.modelock
, getBool
, NULL
820 #endif /* KEEP_XKB_LOCK_STATUS */
822 {"NormalCursor", "(builtin, left_ptr)", (void*)WCUR_ROOT
,
823 NULL
, getCursor
, setCursor
825 {"ArrowCursor", "(builtin, top_left_arrow)", (void*)WCUR_ARROW
,
826 NULL
, getCursor
, setCursor
828 {"MoveCursor", "(builtin, fleur)", (void*)WCUR_MOVE
,
829 NULL
, getCursor
, setCursor
831 {"ResizeCursor", "(builtin, sizing)", (void*)WCUR_RESIZE
,
832 NULL
, getCursor
, setCursor
834 {"TopLeftResizeCursor", "(builtin, top_left_corner)",
835 (void*)WCUR_TOPLEFTRESIZE
,
836 NULL
, getCursor
, setCursor
838 {"TopRightResizeCursor", "(builtin, top_right_corner)",
839 (void*)WCUR_TOPRIGHTRESIZE
,
840 NULL
, getCursor
, setCursor
842 {"BottomLeftResizeCursor", "(builtin, bottom_left_corner)",
843 (void*)WCUR_BOTTOMLEFTRESIZE
,
844 NULL
, getCursor
, setCursor
846 {"BottomRightResizeCursor", "(builtin, bottom_right_corner)",
847 (void*)WCUR_BOTTOMRIGHTRESIZE
,
848 NULL
, getCursor
, setCursor
850 {"VerticalResizeCursor", "(builtin, sb_v_double_arrow)",
851 (void*)WCUR_VERTICALRESIZE
,
852 NULL
, getCursor
, setCursor
854 {"HorizontalResizeCursor", "(builtin, sb_h_double_arrow)",
855 (void*)WCUR_HORIZONRESIZE
,
856 NULL
, getCursor
, setCursor
858 {"WaitCursor", "(builtin, watch)", (void*)WCUR_WAIT
,
859 NULL
, getCursor
, setCursor
861 {"QuestionCursor", "(builtin, question_arrow)", (void*)WCUR_QUESTION
,
862 NULL
, getCursor
, setCursor
864 {"TextCursor", "(builtin, xterm)", (void*)WCUR_TEXT
,
865 NULL
, getCursor
, setCursor
867 {"SelectCursor", "(builtin, cross)", (void*)WCUR_SELECT
,
868 NULL
, getCursor
, setCursor
874 static void rereadDefaults(void);
881 /* must defer the update because accessing X data from a
882 * signal handler can mess up Xlib */
891 WDefaultEntry
*entry
;
893 WMPLSetCaseSensitive(False
);
895 for (i
=0; i
<sizeof(optionList
)/sizeof(WDefaultEntry
); i
++) {
896 entry
= &optionList
[i
];
898 entry
->plkey
= WMCreatePLString(entry
->key
);
899 if (entry
->default_value
)
900 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
902 entry
->plvalue
= NULL
;
905 for (i
=0; i
<sizeof(staticOptionList
)/sizeof(WDefaultEntry
); i
++) {
906 entry
= &staticOptionList
[i
];
908 entry
->plkey
= WMCreatePLString(entry
->key
);
909 if (entry
->default_value
)
910 entry
->plvalue
= WMCreatePropListFromDescription(entry
->default_value
);
912 entry
->plvalue
= NULL
;
916 wDomainName = WMCreatePLString(WMDOMAIN_NAME);
917 wAttributeDomainName = WMCreatePLString(WMATTRIBUTE_DOMAIN_NAME);
919 PLRegister(wDomainName, rereadDefaults);
920 PLRegister(wAttributeDomainName, rereadDefaults);
926 readGlobalDomain(char *domainName
, Bool requireDictionary
)
928 WMPropList
*globalDict
= NULL
;
932 snprintf(path
, sizeof(path
), "%s/WindowMaker/%s", SYSCONFDIR
, domainName
);
933 if (stat(path
, &stbuf
)>=0) {
934 globalDict
= WMReadPropListFromFile(path
);
935 if (globalDict
&& requireDictionary
&& !WMIsPLDictionary(globalDict
)) {
936 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
938 WMReleasePropList(globalDict
);
940 } else if (!globalDict
) {
941 wwarning(_("could not load domain %s from global defaults database"),
950 #if defined(GLOBAL_PREAMBLE_MENU_FILE) || defined(GLOBAL_EPILOGUE_MENU_FILE)
952 prependMenu(WMPropList
*destarr
, WMPropList
*array
)
957 for (i
=0; i
<WMGetPropListItemCount(array
); i
++) {
958 item
= WMGetFromPLArray(array
, i
);
960 WMInsertInPLArray(destarr
, i
+1, item
);
966 appendMenu(WMPropList
*destarr
, WMPropList
*array
)
971 for (i
=0; i
<WMGetPropListItemCount(array
); i
++) {
972 item
= WMGetFromPLArray(array
, i
);
974 WMAddToPLArray(destarr
, item
);
981 wDefaultsMergeGlobalMenus(WDDomain
*menuDomain
)
983 WMPropList
*menu
= menuDomain
->dictionary
;
986 if (!menu
|| !WMIsPLArray(menu
))
989 #ifdef GLOBAL_PREAMBLE_MENU_FILE
990 submenu
= WMReadPropListFromFile(SYSCONFDIR
"/WindowMaker/"GLOBAL_PREAMBLE_MENU_FILE
);
992 if (submenu
&& !WMIsPLArray(submenu
)) {
993 wwarning(_("invalid global menu file %s"),
994 GLOBAL_PREAMBLE_MENU_FILE
);
995 WMReleasePropList(submenu
);
999 prependMenu(menu
, submenu
);
1000 WMReleasePropList(submenu
);
1004 #ifdef GLOBAL_EPILOGUE_MENU_FILE
1005 submenu
= WMReadPropListFromFile(SYSCONFDIR
"/WindowMaker/"GLOBAL_EPILOGUE_MENU_FILE
);
1007 if (submenu
&& !WMIsPLArray(submenu
)) {
1008 wwarning(_("invalid global menu file %s"),
1009 GLOBAL_EPILOGUE_MENU_FILE
);
1010 WMReleasePropList(submenu
);
1014 appendMenu(menu
, submenu
);
1015 WMReleasePropList(submenu
);
1019 menuDomain
->dictionary
= menu
;
1025 wDefaultsInit(int screen_number
)
1027 static int defaults_inited
= 0;
1030 if (!defaults_inited
) {
1034 dict
= PLGetDomain(wDomainName
);
1036 wwarning(_("could not read domain \"%s\" from defaults database"),
1037 WMGetFromPLString(wDomainName
));
1046 wDefaultsDestroyDomain(WDDomain
*domain
)
1048 if (domain
->dictionary
)
1049 WMReleasePropList(domain
->dictionary
);
1050 wfree(domain
->path
);
1056 wDefaultsInitDomain(char *domain
, Bool requireDictionary
)
1060 static int inited
= 0;
1061 char path
[PATH_MAX
];
1063 WMPropList
*shared_dict
=NULL
;
1070 db
= wmalloc(sizeof(WDDomain
));
1071 memset(db
, 0, sizeof(WDDomain
));
1072 db
->domain_name
= domain
;
1073 db
->path
= wdefaultspathfordomain(domain
);
1074 the_path
= db
->path
;
1076 if (the_path
&& stat(the_path
, &stbuf
)>=0) {
1077 db
->dictionary
= WMReadPropListFromFile(the_path
);
1078 if (db
->dictionary
) {
1079 if (requireDictionary
&& !WMIsPLDictionary(db
->dictionary
)) {
1080 WMReleasePropList(db
->dictionary
);
1081 db
->dictionary
= NULL
;
1082 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1085 db
->timestamp
= stbuf
.st_mtime
;
1087 wwarning(_("could not load domain %s from user defaults database"),
1092 /* global system dictionary */
1093 snprintf(path
, sizeof(path
), "%s/WindowMaker/%s", SYSCONFDIR
, domain
);
1094 if (stat(path
, &stbuf
)>=0) {
1095 shared_dict
= WMReadPropListFromFile(path
);
1097 if (requireDictionary
&& !WMIsPLDictionary(shared_dict
)) {
1098 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
1100 WMReleasePropList(shared_dict
);
1103 if (db
->dictionary
&& WMIsPLDictionary(shared_dict
) &&
1104 WMIsPLDictionary(db
->dictionary
)) {
1105 WMMergePLDictionaries(shared_dict
, db
->dictionary
, True
);
1106 WMReleasePropList(db
->dictionary
);
1107 db
->dictionary
= shared_dict
;
1108 if (stbuf
.st_mtime
> db
->timestamp
)
1109 db
->timestamp
= stbuf
.st_mtime
;
1110 } else if (!db
->dictionary
) {
1111 db
->dictionary
= shared_dict
;
1112 if (stbuf
.st_mtime
> db
->timestamp
)
1113 db
->timestamp
= stbuf
.st_mtime
;
1117 wwarning(_("could not load domain %s from global defaults database (%s)"),
1127 wReadStaticDefaults(WMPropList
*dict
)
1129 WMPropList
*plvalue
;
1130 WDefaultEntry
*entry
;
1135 for (i
=0; i
<sizeof(staticOptionList
)/sizeof(WDefaultEntry
); i
++) {
1136 entry
= &staticOptionList
[i
];
1139 plvalue
= WMGetFromPLDictionary(dict
, entry
->plkey
);
1144 /* no default in the DB. Use builtin default */
1145 plvalue
= entry
->plvalue
;
1150 (*entry
->convert
)(NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
1151 if (entry
->update
) {
1152 (*entry
->update
)(NULL
, entry
, tdata
, entry
->extra_data
);
1161 wDefaultsCheckDomains(void *foo
)
1165 WMPropList
*shared_dict
= NULL
;
1170 puts("Checking domains...");
1172 if (stat(WDWindowMaker
->path
, &stbuf
)>=0
1173 && WDWindowMaker
->timestamp
< stbuf
.st_mtime
) {
1175 puts("Checking WindowMaker domain");
1177 WDWindowMaker
->timestamp
= stbuf
.st_mtime
;
1179 /* global dictionary */
1180 shared_dict
= readGlobalDomain("WindowMaker", True
);
1181 /* user dictionary */
1182 dict
= WMReadPropListFromFile(WDWindowMaker
->path
);
1184 if (!WMIsPLDictionary(dict
)) {
1185 WMReleasePropList(dict
);
1187 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1188 "WindowMaker", WDWindowMaker
->path
);
1191 WMMergePLDictionaries(shared_dict
, dict
, True
);
1192 WMReleasePropList(dict
);
1196 for (i
=0; i
<wScreenCount
; i
++) {
1197 scr
= wScreenWithNumber(i
);
1199 wReadDefaults(scr
, dict
);
1201 if (WDWindowMaker
->dictionary
) {
1202 WMReleasePropList(WDWindowMaker
->dictionary
);
1204 WDWindowMaker
->dictionary
= dict
;
1207 wwarning(_("could not load domain %s from user defaults database"),
1211 WMReleasePropList(shared_dict
);
1215 if (stat(WDWindowAttributes
->path
, &stbuf
)>=0
1216 && WDWindowAttributes
->timestamp
< stbuf
.st_mtime
) {
1218 puts("Checking WMWindowAttributes domain");
1220 /* global dictionary */
1221 shared_dict
= readGlobalDomain("WMWindowAttributes", True
);
1222 /* user dictionary */
1223 dict
= WMReadPropListFromFile(WDWindowAttributes
->path
);
1225 if (!WMIsPLDictionary(dict
)) {
1226 WMReleasePropList(dict
);
1228 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1229 "WMWindowAttributes", WDWindowAttributes
->path
);
1232 WMMergePLDictionaries(shared_dict
, dict
, True
);
1233 WMReleasePropList(dict
);
1237 if (WDWindowAttributes
->dictionary
) {
1238 WMReleasePropList(WDWindowAttributes
->dictionary
);
1240 WDWindowAttributes
->dictionary
= dict
;
1241 for (i
=0; i
<wScreenCount
; i
++) {
1242 scr
= wScreenWithNumber(i
);
1246 wDefaultUpdateIcons(scr
);
1248 /* Update the panel image if changed */
1249 /* Don't worry. If the image is the same these
1250 * functions will have no performance impact. */
1251 image
= wDefaultGetImage(scr
, "Logo", "WMPanel");
1254 wwarning(_("could not load logo image for panels: %s"),
1255 RMessageForError(RErrorCode
));
1257 WMSetApplicationIconImage(scr
->wmscreen
, image
);
1258 RReleaseImage(image
);
1264 wwarning(_("could not load domain %s from user defaults database"),
1265 "WMWindowAttributes");
1267 WDWindowAttributes
->timestamp
= stbuf
.st_mtime
;
1269 WMReleasePropList(shared_dict
);
1274 if (stat(WDRootMenu
->path
, &stbuf
)>=0
1275 && WDRootMenu
->timestamp
< stbuf
.st_mtime
) {
1276 dict
= WMReadPropListFromFile(WDRootMenu
->path
);
1278 puts("Checking WMRootMenu domain");
1281 if (!WMIsPLArray(dict
) && !WMIsPLString(dict
)) {
1282 WMReleasePropList(dict
);
1284 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1285 "WMRootMenu", WDRootMenu
->path
);
1287 if (WDRootMenu
->dictionary
) {
1288 WMReleasePropList(WDRootMenu
->dictionary
);
1290 WDRootMenu
->dictionary
= dict
;
1291 wDefaultsMergeGlobalMenus(WDRootMenu
);
1294 wwarning(_("could not load domain %s from user defaults database"),
1297 WDRootMenu
->timestamp
= stbuf
.st_mtime
;
1302 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, foo
);
1307 wReadDefaults(WScreen
*scr
, WMPropList
*new_dict
)
1309 WMPropList
*plvalue
, *old_value
;
1310 WDefaultEntry
*entry
;
1312 int update_workspace_back
= 0; /* kluge :/ */
1315 WMPropList
*old_dict
= (WDWindowMaker
->dictionary
!=new_dict
1316 ? WDWindowMaker
->dictionary
: NULL
);
1322 for (i
=0; i
<sizeof(optionList
)/sizeof(WDefaultEntry
); i
++) {
1323 entry
= &optionList
[i
];
1326 plvalue
= WMGetFromPLDictionary(new_dict
, entry
->plkey
);
1333 old_value
= WMGetFromPLDictionary(old_dict
, entry
->plkey
);
1336 if (!plvalue
&& !old_value
) {
1337 /* no default in the DB. Use builtin default */
1338 plvalue
= entry
->plvalue
;
1339 if (plvalue
&& new_dict
) {
1340 WMPutInPLDictionary(new_dict
, entry
->plkey
, plvalue
);
1343 } else if (!plvalue
) {
1344 /* value was deleted from DB. Keep current value */
1346 } else if (!old_value
) {
1347 /* set value for the 1st time */
1348 } else if (!WMIsPropListEqualTo(plvalue
, old_value
)) {
1349 /* value has changed */
1352 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1353 && update_workspace_back
1354 && scr
->flags
.backimage_helper_launched
) {
1356 /* value was not changed since last time */
1363 printf("Updating %s to %s\n", entry
->key
,
1364 WMGetPropListDescription(plvalue
, False
));
1367 if ((*entry
->convert
)(scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1369 * If the WorkspaceSpecificBack data has been changed
1370 * so that the helper will be launched now, we must be
1371 * sure to send the default background texture config
1374 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0
1375 && !scr
->flags
.backimage_helper_launched
) {
1376 update_workspace_back
= 1;
1378 if (entry
->update
) {
1380 (*entry
->update
)(scr
, entry
, tdata
, entry
->extra_data
);
1386 if (needs_refresh
!=0 && !scr
->flags
.startup
) {
1390 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1391 foo
|= WTextureSettings
;
1392 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1393 foo
|= WFontSettings
;
1394 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1395 foo
|= WColorSettings
;
1397 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1401 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1402 foo
|= WTextureSettings
;
1403 if (needs_refresh
& REFRESH_MENU_FONT
)
1404 foo
|= WFontSettings
;
1405 if (needs_refresh
& REFRESH_MENU_COLOR
)
1406 foo
|= WColorSettings
;
1408 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
,
1412 if (needs_refresh
& REFRESH_WINDOW_FONT
) {
1413 foo
|= WFontSettings
;
1415 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
) {
1416 foo
|= WTextureSettings
;
1418 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
) {
1419 foo
|= WColorSettings
;
1422 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
,
1425 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1427 if (needs_refresh
& REFRESH_ICON_FONT
) {
1428 foo
|= WFontSettings
;
1430 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
) {
1431 foo
|= WTextureSettings
;
1433 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
) {
1434 foo
|= WTextureSettings
;
1437 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1440 if (needs_refresh
& REFRESH_ICON_TILE
)
1441 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1447 wDefaultUpdateIcons(WScreen
*scr
)
1449 WAppIcon
*aicon
= scr
->app_icon_list
;
1450 WWindow
*wwin
= scr
->focused_window
;
1454 file
= wDefaultGetIconFile(scr
, aicon
->wm_instance
, aicon
->wm_class
,
1456 if ((file
&& aicon
->icon
->file
&& strcmp(file
, aicon
->icon
->file
)!=0)
1457 || (file
&& !aicon
->icon
->file
)) {
1460 if (aicon
->icon
->file
)
1461 wfree(aicon
->icon
->file
);
1462 aicon
->icon
->file
= wstrdup(file
);
1464 new_image
= wDefaultGetImage(scr
, aicon
->wm_instance
,
1467 wIconChangeImage(aicon
->icon
, new_image
);
1468 wAppIconPaint(aicon
);
1471 aicon
= aicon
->next
;
1474 if (!wPreferences
.flags
.noclip
)
1475 wClipIconPaint(scr
->clip_icon
);
1478 if (wwin
->icon
&& wwin
->flags
.miniaturized
) {
1479 file
= wDefaultGetIconFile(scr
, wwin
->wm_instance
, wwin
->wm_class
,
1481 if ((file
&& wwin
->icon
->file
&& strcmp(file
, wwin
->icon
->file
)!=0)
1482 || (file
&& !wwin
->icon
->file
)) {
1485 if (wwin
->icon
->file
)
1486 wfree(wwin
->icon
->file
);
1487 wwin
->icon
->file
= wstrdup(file
);
1489 new_image
= wDefaultGetImage(scr
, wwin
->wm_instance
,
1492 wIconChangeImage(wwin
->icon
, new_image
);
1500 /* --------------------------- Local ----------------------- */
1502 #define GET_STRING_OR_DEFAULT(x, var) if (!WMIsPLString(value)) { \
1503 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1505 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1506 var = entry->default_value;\
1507 } else var = WMGetFromPLString(value)\
1514 string2index(WMPropList
*key
, WMPropList
*val
, char *def
,
1515 WOptionEnumeration
*values
)
1518 WOptionEnumeration
*v
;
1519 char buffer
[TOTAL_VALUES_LENGTH
];
1521 if (WMIsPLString(val
) && (str
= WMGetFromPLString(val
))) {
1522 for (v
=values
; v
->string
!=NULL
; v
++) {
1523 if (strcasecmp(v
->string
, str
)==0)
1529 for (v
=values
; v
->string
!=NULL
; v
++) {
1532 strcat(buffer
, ", ");
1533 strcat(buffer
, v
->string
);
1536 wwarning(_("wrong option value for key \"%s\". Should be one of %s"),
1537 WMGetFromPLString(key
), buffer
);
1540 return string2index(key
, val
, NULL
, values
);
1550 * value - is the value in the defaults DB
1551 * addr - is the address to store the data
1552 * ret - is the address to store a pointer to a temporary buffer. ret
1553 * must not be freed and is used by the set functions
1556 getBool(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1563 GET_STRING_OR_DEFAULT("Boolean", val
);
1566 if ((val
[1]=='\0' && (val
[0]=='y' || val
[0]=='Y'))
1567 || strcasecmp(val
, "YES")==0) {
1570 } else if ((val
[1]=='\0' && (val
[0]=='n' || val
[0]=='N'))
1571 || strcasecmp(val
, "NO")==0) {
1575 if (sscanf(val
, "%i", &i
)==1) {
1581 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""),
1583 if (second_pass
==0) {
1584 val
= WMGetFromPLString(entry
->plvalue
);
1586 wwarning(_("using default \"%s\" instead"), val
);
1596 *(char*)addr
= data
;
1603 getInt(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1610 GET_STRING_OR_DEFAULT("Integer", val
);
1612 if (sscanf(val
, "%i", &data
)!=1) {
1613 wwarning(_("can't convert \"%s\" to integer for key \"%s\""),
1615 val
= WMGetFromPLString(entry
->plvalue
);
1616 wwarning(_("using default \"%s\" instead"), val
);
1617 if (sscanf(val
, "%i", &data
)!=1) {
1632 getCoord(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1636 char *val_x
, *val_y
;
1637 int nelem
, changed
=0;
1638 WMPropList
*elem_x
, *elem_y
;
1641 if (!WMIsPLArray(value
)) {
1642 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1643 entry
->key
, "Coordinate");
1645 value
= entry
->plvalue
;
1647 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1653 nelem
= WMGetPropListItemCount(value
);
1655 wwarning(_("Incorrect number of elements in array for key \"%s\"."),
1658 value
= entry
->plvalue
;
1660 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1666 elem_x
= WMGetFromPLArray(value
, 0);
1667 elem_y
= WMGetFromPLArray(value
, 1);
1669 if (!elem_x
|| !elem_y
|| !WMIsPLString(elem_x
) || !WMIsPLString(elem_y
)) {
1670 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."),
1673 value
= entry
->plvalue
;
1675 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1681 val_x
= WMGetFromPLString(elem_x
);
1682 val_y
= WMGetFromPLString(elem_y
);
1684 if (sscanf(val_x
, "%i", &data
.x
)!=1 || sscanf(val_y
, "%i", &data
.y
)!=1) {
1685 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1687 value
= entry
->plvalue
;
1689 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1697 else if (data
.x
> scr
->scr_width
/3)
1698 data
.x
= scr
->scr_width
/3;
1701 else if (data
.y
> scr
->scr_height
/3)
1702 data
.y
= scr
->scr_height
/3;
1707 *(WCoord
*)addr
= data
;
1714 /* This function is not used at the moment. */
1716 getString(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1721 GET_STRING_OR_DEFAULT("String", data
);
1724 data
= WMGetFromPLString(entry
->plvalue
);
1732 *(char**)addr
= wstrdup(data
);
1740 getPathList(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1750 if (!WMIsPLArray(value
)) {
1751 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1752 entry
->key
, "an array of paths");
1754 value
= entry
->plvalue
;
1756 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1763 count
= WMGetPropListItemCount(value
);
1766 value
= entry
->plvalue
;
1768 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1775 for (i
=0; i
<count
; i
++) {
1776 d
= WMGetFromPLArray(value
, i
);
1777 if (!d
|| !WMIsPLString(d
)) {
1781 len
+= strlen(WMGetFromPLString(d
))+1;
1784 ptr
= data
= wmalloc(len
+1);
1786 for (i
=0; i
<count
; i
++) {
1787 d
= WMGetFromPLArray(value
, i
);
1788 if (!d
|| !WMIsPLString(d
)) {
1791 strcpy(ptr
, WMGetFromPLString(d
));
1792 ptr
+= strlen(WMGetFromPLString(d
));
1796 ptr
--; *(ptr
--) = 0;
1798 if (*(char**)addr
!=NULL
) {
1799 wfree(*(char**)addr
);
1801 *(char**)addr
= data
;
1808 getEnum(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
1811 static signed char data
;
1813 data
= string2index(entry
->plkey
, value
, entry
->default_value
,
1814 (WOptionEnumeration
*)entry
->extra_data
);
1821 *(signed char*)addr
= data
;
1830 * (hgradient <color> <color>)
1831 * (vgradient <color> <color>)
1832 * (dgradient <color> <color>)
1833 * (mhgradient <color> <color> ...)
1834 * (mvgradient <color> <color> ...)
1835 * (mdgradient <color> <color> ...)
1836 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1837 * (tpixmap <file> <color>)
1838 * (spixmap <file> <color>)
1839 * (cpixmap <file> <color>)
1840 * (thgradient <file> <opaqueness> <color> <color>)
1841 * (tvgradient <file> <opaqueness> <color> <color>)
1842 * (tdgradient <file> <opaqueness> <color> <color>)
1843 * (function <lib> <function> ...)
1847 parse_texture(WScreen
*scr
, WMPropList
*pl
)
1852 WTexture
*texture
=NULL
;
1854 nelem
= WMGetPropListItemCount(pl
);
1859 elem
= WMGetFromPLArray(pl
, 0);
1860 if (!elem
|| !WMIsPLString(elem
))
1862 val
= WMGetFromPLString(elem
);
1865 if (strcasecmp(val
, "solid")==0) {
1873 elem
= WMGetFromPLArray(pl
, 1);
1874 if (!elem
|| !WMIsPLString(elem
))
1876 val
= WMGetFromPLString(elem
);
1878 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1879 wwarning(_("\"%s\" is not a valid color name"), val
);
1883 texture
= (WTexture
*)wTextureMakeSolid(scr
, &color
);
1884 } else if (strcasecmp(val
, "dgradient")==0
1885 || strcasecmp(val
, "vgradient")==0
1886 || strcasecmp(val
, "hgradient")==0) {
1887 RColor color1
, color2
;
1892 wwarning(_("bad number of arguments in gradient specification"));
1896 if (val
[0]=='d' || val
[0]=='D')
1897 type
= WTEX_DGRADIENT
;
1898 else if (val
[0]=='h' || val
[0]=='H')
1899 type
= WTEX_HGRADIENT
;
1901 type
= WTEX_VGRADIENT
;
1904 /* get from color */
1905 elem
= WMGetFromPLArray(pl
, 1);
1906 if (!elem
|| !WMIsPLString(elem
))
1908 val
= WMGetFromPLString(elem
);
1910 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1911 wwarning(_("\"%s\" is not a valid color name"), val
);
1915 color1
.red
= xcolor
.red
>> 8;
1916 color1
.green
= xcolor
.green
>> 8;
1917 color1
.blue
= xcolor
.blue
>> 8;
1920 elem
= WMGetFromPLArray(pl
, 2);
1921 if (!elem
|| !WMIsPLString(elem
)) {
1924 val
= WMGetFromPLString(elem
);
1926 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1927 wwarning(_("\"%s\" is not a valid color name"), val
);
1931 color2
.red
= xcolor
.red
>> 8;
1932 color2
.green
= xcolor
.green
>> 8;
1933 color2
.blue
= xcolor
.blue
>> 8;
1935 texture
= (WTexture
*)wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1937 } else if (strcasecmp(val
, "igradient")==0) {
1938 RColor colors1
[2], colors2
[2];
1944 wwarning(_("bad number of arguments in gradient specification"));
1948 /* get from color */
1949 for (i
= 0; i
< 2; i
++) {
1950 elem
= WMGetFromPLArray(pl
, 1+i
);
1951 if (!elem
|| !WMIsPLString(elem
))
1953 val
= WMGetFromPLString(elem
);
1955 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1956 wwarning(_("\"%s\" is not a valid color name"), val
);
1959 colors1
[i
].alpha
= 255;
1960 colors1
[i
].red
= xcolor
.red
>> 8;
1961 colors1
[i
].green
= xcolor
.green
>> 8;
1962 colors1
[i
].blue
= xcolor
.blue
>> 8;
1964 elem
= WMGetFromPLArray(pl
, 3);
1965 if (!elem
|| !WMIsPLString(elem
))
1967 val
= WMGetFromPLString(elem
);
1971 /* get from color */
1972 for (i
= 0; i
< 2; i
++) {
1973 elem
= WMGetFromPLArray(pl
, 4+i
);
1974 if (!elem
|| !WMIsPLString(elem
))
1976 val
= WMGetFromPLString(elem
);
1978 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1979 wwarning(_("\"%s\" is not a valid color name"), val
);
1982 colors2
[i
].alpha
= 255;
1983 colors2
[i
].red
= xcolor
.red
>> 8;
1984 colors2
[i
].green
= xcolor
.green
>> 8;
1985 colors2
[i
].blue
= xcolor
.blue
>> 8;
1987 elem
= WMGetFromPLArray(pl
, 6);
1988 if (!elem
|| !WMIsPLString(elem
))
1990 val
= WMGetFromPLString(elem
);
1993 texture
= (WTexture
*)wTextureMakeIGradient(scr
, th1
, colors1
,
1996 } else if (strcasecmp(val
, "mhgradient")==0
1997 || strcasecmp(val
, "mvgradient")==0
1998 || strcasecmp(val
, "mdgradient")==0) {
2005 wwarning(_("too few arguments in multicolor gradient specification"));
2009 if (val
[1]=='h' || val
[1]=='H')
2010 type
= WTEX_MHGRADIENT
;
2011 else if (val
[1]=='v' || val
[1]=='V')
2012 type
= WTEX_MVGRADIENT
;
2014 type
= WTEX_MDGRADIENT
;
2018 colors
= wmalloc(sizeof(RColor
*)*(count
+1));
2020 for (i
=0; i
<count
; i
++) {
2021 elem
= WMGetFromPLArray(pl
, i
+1);
2022 if (!elem
|| !WMIsPLString(elem
)) {
2023 for (--i
; i
>=0; --i
) {
2029 val
= WMGetFromPLString(elem
);
2031 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
2032 wwarning(_("\"%s\" is not a valid color name"), val
);
2033 for (--i
; i
>=0; --i
) {
2039 colors
[i
] = wmalloc(sizeof(RColor
));
2040 colors
[i
]->red
= color
.red
>> 8;
2041 colors
[i
]->green
= color
.green
>> 8;
2042 colors
[i
]->blue
= color
.blue
>> 8;
2047 texture
= (WTexture
*)wTextureMakeMGradient(scr
, type
, colors
);
2048 } else if (strcasecmp(val
, "spixmap")==0 ||
2049 strcasecmp(val
, "cpixmap")==0 ||
2050 strcasecmp(val
, "tpixmap")==0) {
2057 if (val
[0] == 's' || val
[0] == 'S')
2059 else if (val
[0] == 'c' || val
[0] == 'C')
2065 elem
= WMGetFromPLArray(pl
, 2);
2066 if (!elem
|| !WMIsPLString(elem
)) {
2069 val
= WMGetFromPLString(elem
);
2071 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
2072 wwarning(_("\"%s\" is not a valid color name"), val
);
2077 elem
= WMGetFromPLArray(pl
, 1);
2078 if (!elem
|| !WMIsPLString(elem
))
2080 val
= WMGetFromPLString(elem
);
2082 texture
= (WTexture
*)wTextureMakePixmap(scr
, type
, val
, &color
);
2083 } else if (strcasecmp(val
, "thgradient")==0
2084 || strcasecmp(val
, "tvgradient")==0
2085 || strcasecmp(val
, "tdgradient")==0) {
2086 RColor color1
, color2
;
2091 if (val
[1]=='h' || val
[1]=='H')
2092 style
= WTEX_THGRADIENT
;
2093 else if (val
[1]=='v' || val
[1]=='V')
2094 style
= WTEX_TVGRADIENT
;
2096 style
= WTEX_TDGRADIENT
;
2099 wwarning(_("bad number of arguments in textured gradient specification"));
2103 /* get from color */
2104 elem
= WMGetFromPLArray(pl
, 3);
2105 if (!elem
|| !WMIsPLString(elem
))
2107 val
= WMGetFromPLString(elem
);
2109 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
2110 wwarning(_("\"%s\" is not a valid color name"), val
);
2114 color1
.red
= xcolor
.red
>> 8;
2115 color1
.green
= xcolor
.green
>> 8;
2116 color1
.blue
= xcolor
.blue
>> 8;
2119 elem
= WMGetFromPLArray(pl
, 4);
2120 if (!elem
|| !WMIsPLString(elem
)) {
2123 val
= WMGetFromPLString(elem
);
2125 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
2126 wwarning(_("\"%s\" is not a valid color name"), val
);
2130 color2
.red
= xcolor
.red
>> 8;
2131 color2
.green
= xcolor
.green
>> 8;
2132 color2
.blue
= xcolor
.blue
>> 8;
2135 elem
= WMGetFromPLArray(pl
, 2);
2136 if (!elem
|| !WMIsPLString(elem
))
2139 val
= WMGetFromPLString(elem
);
2141 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
2142 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
2147 elem
= WMGetFromPLArray(pl
, 1);
2148 if (!elem
|| !WMIsPLString(elem
))
2150 val
= WMGetFromPLString(elem
);
2152 texture
= (WTexture
*)wTextureMakeTGradient(scr
, style
, &color1
, &color2
,
2155 #ifdef TEXTURE_PLUGIN
2156 else if (strcasecmp(val
, "function")==0) {
2157 WTexFunction
*function
;
2158 void (*initFunc
) (Display
*, Colormap
);
2159 char *lib
, *func
, **argv
;
2165 /* get the library name */
2166 elem
= WMGetFromPLArray(pl
, 1);
2167 if (!elem
|| !WMIsPLString(elem
)) {
2170 lib
= WMGetFromPLString(elem
);
2172 /* get the function name */
2173 elem
= WMGetFromPLArray(pl
, 2);
2174 if (!elem
|| !WMIsPLString(elem
)) {
2177 func
= WMGetFromPLString(elem
);
2180 argv
= (char **)wmalloc(argc
* sizeof(char *));
2182 /* get the parameters */
2183 argv
[0] = wstrdup(func
);
2184 for (i
= 0; i
< argc
- 1; i
++) {
2185 elem
= WMGetFromPLArray(pl
, 3 + i
);
2186 if (!elem
|| !WMIsPLString(elem
)) {
2191 argv
[i
+1] = wstrdup(WMGetFromPLString(elem
));
2194 function
= wTextureMakeFunction(scr
, lib
, func
, argc
, argv
);
2198 initFunc
= dlsym(function
->handle
, "initWindowMaker");
2200 initFunc(dpy
, scr
->w_colormap
);
2202 wwarning(_("could not initialize library %s"), lib
);
2205 wwarning(_("could not find function %s::%s"), lib
, func
);
2207 #endif /* HAVE_DLFCN_H */
2208 texture
= (WTexture
*)function
;
2210 #endif /* TEXTURE_PLUGIN */
2212 wwarning(_("invalid texture type %s"), val
);
2221 getTexture(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2224 static WTexture
*texture
;
2228 if (!WMIsPLArray(value
)) {
2229 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2230 entry
->key
, "Texture");
2232 value
= entry
->plvalue
;
2234 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2240 if (strcmp(entry
->key
, "WidgetColor")==0 && !changed
) {
2243 pl
= WMGetFromPLArray(value
, 0);
2244 if (!pl
|| !WMIsPLString(pl
) || !WMGetFromPLString(pl
)
2245 || strcasecmp(WMGetFromPLString(pl
), "solid")!=0) {
2246 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2247 entry
->key
, "Solid Texture");
2249 value
= entry
->plvalue
;
2251 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2256 texture
= parse_texture(scr
, value
);
2259 wwarning(_("Error in texture specification for key \"%s\""),
2262 value
= entry
->plvalue
;
2264 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2274 *(WTexture
**)addr
= texture
;
2281 getWSBackground(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
2282 void *addr
, void **ret
)
2290 if (!WMIsPLArray(value
)) {
2291 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2292 "WorkspaceBack", "Texture or None");
2294 value
= entry
->plvalue
;
2296 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2302 /* only do basic error checking and verify for None texture */
2304 nelem
= WMGetPropListItemCount(value
);
2306 elem
= WMGetFromPLArray(value
, 0);
2307 if (!elem
|| !WMIsPLString(elem
)) {
2308 wwarning(_("Wrong type for workspace background. Should be a texture type."));
2310 value
= entry
->plvalue
;
2312 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2317 val
= WMGetFromPLString(elem
);
2319 if (strcasecmp(val
, "None")==0)
2322 *ret
= WMRetainPropList(value
);
2329 getWSSpecificBackground(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
2330 void *addr
, void **ret
)
2337 if (!WMIsPLArray(value
)) {
2338 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2339 "WorkspaceSpecificBack", "an array of textures");
2341 value
= entry
->plvalue
;
2343 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2349 /* only do basic error checking and verify for None texture */
2351 nelem
= WMGetPropListItemCount(value
);
2354 elem
= WMGetFromPLArray(value
, nelem
);
2355 if (!elem
|| !WMIsPLArray(elem
)) {
2356 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2362 *ret
= WMRetainPropList(value
);
2366 * Kluge to force wmsetbg helper to set the default background.
2367 * If the WorkspaceSpecificBack is changed once wmaker has started,
2368 * the WorkspaceBack won't be sent to the helper, unless the user
2369 * changes it's value too. So, we must force this by removing the
2370 * value from the defaults DB.
2372 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2373 WMPropList
*key
= WMCreatePLString("WorkspaceBack");
2375 WMRemoveFromPLDictionary(WDWindowMaker
->dictionary
, key
);
2377 WMReleasePropList(key
);
2385 getFont(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2388 static WMFont
*font
;
2391 GET_STRING_OR_DEFAULT("Font", val
);
2393 font
= WMCreateFont(scr
->wmscreen
, val
);
2395 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2398 wfatal(_("could not load any usable font!!!"));
2405 /* can't assign font value outside update function */
2406 wassertrv(addr
== NULL
, True
);
2413 getColor(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2416 static XColor color
;
2420 GET_STRING_OR_DEFAULT("Color", val
);
2424 if (!wGetColor(scr
, val
, &color
)) {
2425 wwarning(_("could not get color for key \"%s\""),
2427 if (second_pass
==0) {
2428 val
= WMGetFromPLString(entry
->plvalue
);
2430 wwarning(_("using default \"%s\" instead"), val
);
2442 *(unsigned long*)addr = pixel;
2451 getKeybind(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2454 static WShortKey shortcut
;
2461 GET_STRING_OR_DEFAULT("Key spec", val
);
2463 if (!val
|| strcasecmp(val
, "NONE")==0) {
2464 shortcut
.keycode
= 0;
2465 shortcut
.modifier
= 0;
2476 shortcut
.modifier
= 0;
2477 while ((k
= strchr(b
, '+'))!=NULL
) {
2481 mod
= wXModifierFromKey(b
);
2483 wwarning(_("%s:invalid key modifier \"%s\""), entry
->key
, b
);
2486 shortcut
.modifier
|= mod
;
2492 ksym
= XStringToKeysym(b
);
2494 if (ksym
==NoSymbol
) {
2495 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
,
2500 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2501 if (shortcut
.keycode
==0) {
2502 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2514 getModMask(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2517 static unsigned int mask
;
2520 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2525 mask
= wXModifierFromKey(str
);
2527 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2533 *(unsigned int*)addr
= mask
;
2544 getRImages(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
2545 void *addr
, void **ret
)
2553 GET_STRING_OR_DEFAULT("Image File Path", str
);
2557 image
= RLoadImage(scr
->rcontext
, str
, 0);
2559 wwarning(_("could not load image in option %s: %s"), entry
->key
,
2560 RMessageForError(RErrorCode
));
2564 if (*(RImage
**)addr
) {
2565 RReleaseImage(*(RImage
**)addr
);
2568 *(RImage
**)addr
= image
;
2570 assert(ret
== NULL
);
2573 *(RImage**)ret = image;
2580 # include <X11/cursorfont.h>
2587 #define CURSOR_ID_NONE (XC_num_glyphs)
2589 static WCursorLookup cursor_table
[] =
2591 { "X_cursor", XC_X_cursor
},
2592 { "arrow", XC_arrow
},
2593 { "based_arrow_down", XC_based_arrow_down
},
2594 { "based_arrow_up", XC_based_arrow_up
},
2595 { "boat", XC_boat
},
2596 { "bogosity", XC_bogosity
},
2597 { "bottom_left_corner", XC_bottom_left_corner
},
2598 { "bottom_right_corner", XC_bottom_right_corner
},
2599 { "bottom_side", XC_bottom_side
},
2600 { "bottom_tee", XC_bottom_tee
},
2601 { "box_spiral", XC_box_spiral
},
2602 { "center_ptr", XC_center_ptr
},
2603 { "circle", XC_circle
},
2604 { "clock", XC_clock
},
2605 { "coffee_mug", XC_coffee_mug
},
2606 { "cross", XC_cross
},
2607 { "cross_reverse", XC_cross_reverse
},
2608 { "crosshair", XC_crosshair
},
2609 { "diamond_cross", XC_diamond_cross
},
2611 { "dotbox", XC_dotbox
},
2612 { "double_arrow", XC_double_arrow
},
2613 { "draft_large", XC_draft_large
},
2614 { "draft_small", XC_draft_small
},
2615 { "draped_box", XC_draped_box
},
2616 { "exchange", XC_exchange
},
2617 { "fleur", XC_fleur
},
2618 { "gobbler", XC_gobbler
},
2619 { "gumby", XC_gumby
},
2620 { "hand1", XC_hand1
},
2621 { "hand2", XC_hand2
},
2622 { "heart", XC_heart
},
2623 { "icon", XC_icon
},
2624 { "iron_cross", XC_iron_cross
},
2625 { "left_ptr", XC_left_ptr
},
2626 { "left_side", XC_left_side
},
2627 { "left_tee", XC_left_tee
},
2628 { "leftbutton", XC_leftbutton
},
2629 { "ll_angle", XC_ll_angle
},
2630 { "lr_angle", XC_lr_angle
},
2632 { "middlebutton", XC_middlebutton
},
2633 { "mouse", XC_mouse
},
2634 { "pencil", XC_pencil
},
2635 { "pirate", XC_pirate
},
2636 { "plus", XC_plus
},
2637 { "question_arrow", XC_question_arrow
},
2638 { "right_ptr", XC_right_ptr
},
2639 { "right_side", XC_right_side
},
2640 { "right_tee", XC_right_tee
},
2641 { "rightbutton", XC_rightbutton
},
2642 { "rtl_logo", XC_rtl_logo
},
2643 { "sailboat", XC_sailboat
},
2644 { "sb_down_arrow", XC_sb_down_arrow
},
2645 { "sb_h_double_arrow", XC_sb_h_double_arrow
},
2646 { "sb_left_arrow", XC_sb_left_arrow
},
2647 { "sb_right_arrow", XC_sb_right_arrow
},
2648 { "sb_up_arrow", XC_sb_up_arrow
},
2649 { "sb_v_double_arrow", XC_sb_v_double_arrow
},
2650 { "shuttle", XC_shuttle
},
2651 { "sizing", XC_sizing
},
2652 { "spider", XC_spider
},
2653 { "spraycan", XC_spraycan
},
2654 { "star", XC_star
},
2655 { "target", XC_target
},
2656 { "tcross", XC_tcross
},
2657 { "top_left_arrow", XC_top_left_arrow
},
2658 { "top_left_corner", XC_top_left_corner
},
2659 { "top_right_corner", XC_top_right_corner
},
2660 { "top_side", XC_top_side
},
2661 { "top_tee", XC_top_tee
},
2662 { "trek", XC_trek
},
2663 { "ul_angle", XC_ul_angle
},
2664 { "umbrella", XC_umbrella
},
2665 { "ur_angle", XC_ur_angle
},
2666 { "watch", XC_watch
},
2667 { "xterm", XC_xterm
},
2668 { NULL
, CURSOR_ID_NONE
}
2672 check_bitmap_status(int status
, char *filename
, Pixmap bitmap
)
2675 case BitmapOpenFailed
:
2676 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2678 case BitmapFileInvalid
:
2679 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2681 case BitmapNoMemory
:
2682 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2685 XFreePixmap(dpy
, bitmap
);
2692 * (builtin, <cursor_name>)
2693 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2696 parse_cursor(WScreen
*scr
, WMPropList
*pl
, Cursor
*cursor
)
2703 nelem
= WMGetPropListItemCount(pl
);
2707 elem
= WMGetFromPLArray(pl
, 0);
2708 if (!elem
|| !WMIsPLString(elem
)) {
2711 val
= WMGetFromPLString(elem
);
2713 if (0 == strcasecmp(val
, "none")) {
2716 } else if (0 == strcasecmp(val
, "builtin")) {
2718 int cursor_id
= CURSOR_ID_NONE
;
2721 wwarning(_("bad number of arguments in cursor specification"));
2724 elem
= WMGetFromPLArray(pl
, 1);
2725 if (!elem
|| !WMIsPLString(elem
)) {
2728 val
= WMGetFromPLString(elem
);
2730 for (i
= 0; NULL
!= cursor_table
[i
].name
; i
++) {
2731 if (0 == strcasecmp(val
, cursor_table
[i
].name
)) {
2732 cursor_id
= cursor_table
[i
].id
;
2736 if (CURSOR_ID_NONE
== cursor_id
) {
2737 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2739 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2742 } else if (0 == strcasecmp(val
, "bitmap")) {
2754 wwarning(_("bad number of arguments in cursor specification"));
2757 elem
= WMGetFromPLArray(pl
, 1);
2758 if (!elem
|| !WMIsPLString(elem
)) {
2761 val
= WMGetFromPLString(elem
);
2762 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2764 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2767 elem
= WMGetFromPLArray(pl
, 2);
2768 if (!elem
|| !WMIsPLString(elem
)) {
2772 val
= WMGetFromPLString(elem
);
2773 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2776 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2779 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
,
2781 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
,
2783 if ((BitmapSuccess
== bitmap_status
) &&
2784 (BitmapSuccess
== mask_status
)) {
2785 fg
.pixel
= scr
->black_pixel
;
2786 bg
.pixel
= scr
->white_pixel
;
2787 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2788 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2789 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2792 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2793 check_bitmap_status(mask_status
, mask_name
, mask
);
2802 getCursor(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
, void *addr
,
2805 static Cursor cursor
;
2810 if (!WMIsPLArray(value
)) {
2811 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2812 entry
->key
, "cursor specification");
2814 value
= entry
->plvalue
;
2816 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2821 status
= parse_cursor(scr
, value
, &cursor
);
2823 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2825 value
= entry
->plvalue
;
2827 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2836 *(Cursor
*)addr
= cursor
;
2840 #undef CURSOR_ID_NONE
2843 /* ---------------- value setting functions --------------- */
2845 setJustify(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
2847 return REFRESH_WINDOW_TITLE_COLOR
;
2851 setClearance(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
2853 return REFRESH_WINDOW_FONT
|REFRESH_BUTTON_IMAGES
|REFRESH_MENU_TITLE_FONT
|REFRESH_MENU_FONT
;
2857 setIfDockPresent(WScreen
*scr
, WDefaultEntry
*entry
, char *flag
, long which
)
2861 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2864 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2874 setStickyIcons(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
2876 if (scr
->workspaces
) {
2877 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2878 wArrangeIcons(scr
, False
);
2885 setPositive(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
2897 setIconTile(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
2903 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2904 wPreferences
.icon_size
,
2905 ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2906 ? WREL_ICON
: WREL_FLAT
);
2908 wwarning(_("could not render texture for icon background"));
2910 wTextureDestroy(scr
, *texture
);
2913 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2915 if (scr
->icon_tile
) {
2917 RReleaseImage(scr
->icon_tile
);
2918 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2921 scr
->icon_tile
= img
;
2924 /* put the icon in the noticeboard hint */
2925 PropSetIconTileHint(scr
, img
);
2928 if (!wPreferences
.flags
.noclip
) {
2929 if (scr
->clip_tile
) {
2930 RReleaseImage(scr
->clip_tile
);
2932 scr
->clip_tile
= wClipMakeTile(scr
, img
);
2935 scr
->icon_tile_pixmap
= pixmap
;
2937 if (scr
->def_icon_pixmap
) {
2938 XFreePixmap(dpy
, scr
->def_icon_pixmap
);
2939 scr
->def_icon_pixmap
= None
;
2941 if (scr
->def_ticon_pixmap
) {
2942 XFreePixmap(dpy
, scr
->def_ticon_pixmap
);
2943 scr
->def_ticon_pixmap
= None
;
2946 if (scr
->icon_back_texture
) {
2947 wTextureDestroy(scr
, (WTexture
*)scr
->icon_back_texture
);
2949 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2951 if (scr
->clip_balloon
)
2952 XSetWindowBackground(dpy
, scr
->clip_balloon
,
2953 (*texture
)->any
.color
.pixel
);
2956 * Free the texture as nobody else will use it, nor refer to it.
2959 wTextureDestroy(scr
, *texture
);
2961 return (reset
? REFRESH_ICON_TILE
: 0);
2967 setWinTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2969 if (scr
->title_font
) {
2970 WMReleaseFont(scr
->title_font
);
2972 scr
->title_font
= font
;
2974 return REFRESH_WINDOW_FONT
|REFRESH_BUTTON_IMAGES
;
2979 setMenuTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2981 if (scr
->menu_title_font
) {
2982 WMReleaseFont(scr
->menu_title_font
);
2985 scr
->menu_title_font
= font
;
2987 return REFRESH_MENU_TITLE_FONT
;
2992 setMenuTextFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2994 if (scr
->menu_entry_font
) {
2995 WMReleaseFont(scr
->menu_entry_font
);
2997 scr
->menu_entry_font
= font
;
2999 return REFRESH_MENU_FONT
;
3005 setIconTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
3007 if (scr
->icon_title_font
) {
3008 WMReleaseFont(scr
->icon_title_font
);
3011 scr
->icon_title_font
= font
;
3013 return REFRESH_ICON_FONT
;
3018 setClipTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
3020 if (scr
->clip_title_font
) {
3021 WMReleaseFont(scr
->clip_title_font
);
3024 scr
->clip_title_font
= font
;
3026 return REFRESH_ICON_FONT
;
3031 setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
3033 if (scr
->workspace_name_font
) {
3034 WMReleaseFont(scr
->workspace_name_font
);
3037 scr
->workspace_name_font
= font
;
3044 setHightlight(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3046 if (scr
->select_color
)
3047 WMReleaseColor(scr
->select_color
);
3050 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
,
3053 wFreeColor(scr
, color
->pixel
);
3055 return REFRESH_MENU_COLOR
;
3060 setHightlightText(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3062 if (scr
->select_text_color
)
3063 WMReleaseColor(scr
->select_text_color
);
3065 scr
->select_text_color
=
3066 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
,
3069 wFreeColor(scr
, color
->pixel
);
3071 return REFRESH_MENU_COLOR
;
3076 setClipTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3078 if (scr
->clip_title_color
[index
])
3079 WMReleaseColor(scr
->clip_title_color
[index
]);
3080 scr
->clip_title_color
[index
] = WMCreateRGBColor(scr
->wmscreen
, color
->red
,
3081 color
->green
, color
->blue
,
3083 #ifdef GRADIENT_CLIP_ARROW
3084 if (index
== CLIP_NORMAL
) {
3086 RColor color1
, color2
;
3087 int pt
= CLIP_BUTTON_SIZE
*wPreferences
.icon_size
/64;
3088 int as
= pt
- 15; /* 15 = 5+5+5 */
3090 FREE_PIXMAP(scr
->clip_arrow_gradient
);
3092 color1
.red
= (color
->red
>> 8)*6/10;
3093 color1
.green
= (color
->green
>> 8)*6/10;
3094 color1
.blue
= (color
->blue
>> 8)*6/10;
3096 color2
.red
= WMIN((color
->red
>> 8)*20/10, 255);
3097 color2
.green
= WMIN((color
->green
>> 8)*20/10, 255);
3098 color2
.blue
= WMIN((color
->blue
>> 8)*20/10, 255);
3100 image
= RRenderGradient(as
+1, as
+1, &color1
, &color2
, RDiagonalGradient
);
3101 RConvertImage(scr
->rcontext
, image
, &scr
->clip_arrow_gradient
);
3102 RReleaseImage(image
);
3104 #endif /* GRADIENT_CLIP_ARROW */
3106 wFreeColor(scr
, color
->pixel
);
3108 return REFRESH_ICON_TITLE_COLOR
;
3113 setWTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3115 if (scr
->window_title_color
[index
])
3116 WMReleaseColor(scr
->window_title_color
[index
]);
3118 scr
->window_title_color
[index
] =
3119 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
, color
->blue
,
3122 wFreeColor(scr
, color
->pixel
);
3124 return REFRESH_WINDOW_TITLE_COLOR
;
3129 setMenuTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3131 if (scr
->menu_title_color
[0])
3132 WMReleaseColor(scr
->menu_title_color
[0]);
3134 scr
->menu_title_color
[0] =
3135 WMCreateRGBColor(scr
->wmscreen
, color
->red
, color
->green
,
3138 wFreeColor(scr
, color
->pixel
);
3140 return REFRESH_MENU_TITLE_COLOR
;
3145 setMenuTextColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3147 if (scr
->mtext_color
)
3148 WMReleaseColor(scr
->mtext_color
);
3150 scr
->mtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
,
3151 color
->green
, color
->blue
, True
);
3153 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
3154 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
3156 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
3159 wFreeColor(scr
, color
->pixel
);
3161 return REFRESH_MENU_COLOR
;
3166 setMenuDisabledColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3168 if (scr
->dtext_color
)
3169 WMReleaseColor(scr
->dtext_color
);
3171 scr
->dtext_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
,
3172 color
->green
, color
->blue
, True
);
3174 if (WMColorPixel(scr
->dtext_color
) == WMColorPixel(scr
->mtext_color
)) {
3175 WMSetColorAlpha(scr
->dtext_color
, 0x7fff);
3177 WMSetColorAlpha(scr
->dtext_color
, 0xffff);
3180 wFreeColor(scr
, color
->pixel
);
3182 return REFRESH_MENU_COLOR
;
3187 setIconTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3189 if (scr
->icon_title_color
)
3190 WMReleaseColor(scr
->icon_title_color
);
3191 scr
->icon_title_color
= WMCreateRGBColor(scr
->wmscreen
, color
->red
,
3192 color
->green
, color
->blue
,
3195 wFreeColor(scr
, color
->pixel
);
3197 return REFRESH_ICON_TITLE_COLOR
;
3202 setIconTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3204 if (scr
->icon_title_texture
) {
3205 wTextureDestroy(scr
, (WTexture
*)scr
->icon_title_texture
);
3207 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
3209 return REFRESH_ICON_TITLE_BACK
;
3214 trackDeadProcess(pid_t pid
, unsigned char status
, WScreen
*scr
)
3216 close(scr
->helper_fd
);
3218 scr
->helper_pid
= 0;
3219 scr
->flags
.backimage_helper_launched
= 0;
3224 setWorkspaceSpecificBack(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
3231 if (scr
->flags
.backimage_helper_launched
) {
3232 if (WMGetPropListItemCount(value
)==0) {
3233 SendHelperMessage(scr
, 'C', 0, NULL
);
3234 SendHelperMessage(scr
, 'K', 0, NULL
);
3236 WMReleasePropList(value
);
3243 if (WMGetPropListItemCount(value
) == 0)
3246 if (pipe(filedes
) < 0) {
3247 wsyserror("pipe() failed:can't set workspace specific background image");
3249 WMReleasePropList(value
);
3255 wsyserror("fork() failed:can't set workspace specific background image");
3256 if (close(filedes
[0]) < 0)
3257 wsyserror("could not close pipe");
3258 if (close(filedes
[1]) < 0)
3259 wsyserror("could not close pipe");
3261 } else if (pid
== 0) {
3264 SetupEnvironment(scr
);
3267 wsyserror("could not close pipe");
3268 if (dup(filedes
[0]) < 0) {
3269 wsyserror("dup() failed:can't set workspace specific background image");
3271 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3272 if (wPreferences
.smooth_workspace_back
)
3273 execlp("wmsetbg", "wmsetbg", "-helper", "-S", dither
, NULL
);
3275 execlp("wmsetbg", "wmsetbg", "-helper", dither
, NULL
);
3276 wsyserror("could not execute wmsetbg");
3280 if (fcntl(filedes
[0], F_SETFD
, FD_CLOEXEC
) < 0) {
3281 wsyserror("error setting close-on-exec flag");
3283 if (fcntl(filedes
[1], F_SETFD
, FD_CLOEXEC
) < 0) {
3284 wsyserror("error setting close-on-exec flag");
3287 scr
->helper_fd
= filedes
[1];
3288 scr
->helper_pid
= pid
;
3289 scr
->flags
.backimage_helper_launched
= 1;
3291 wAddDeathHandler(pid
, (WDeathHandler
*)trackDeadProcess
, scr
);
3293 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3298 for (i
= 0; i
< WMGetPropListItemCount(value
); i
++) {
3299 val
= WMGetFromPLArray(value
, i
);
3300 if (val
&& WMIsPLArray(val
) && WMGetPropListItemCount(val
)>0) {
3301 str
= WMGetPropListDescription(val
, False
);
3303 SendHelperMessage(scr
, 'S', i
+1, str
);
3307 SendHelperMessage(scr
, 'U', i
+1, NULL
);
3312 WMReleasePropList(value
);
3318 setWorkspaceBack(WScreen
*scr
, WDefaultEntry
*entry
, WMPropList
*value
,
3321 if (scr
->flags
.backimage_helper_launched
) {
3324 if (WMGetPropListItemCount(value
)==0) {
3325 SendHelperMessage(scr
, 'U', 0, NULL
);
3327 /* set the default workspace background to this one */
3328 str
= WMGetPropListDescription(value
, False
);
3330 SendHelperMessage(scr
, 'S', 0, str
);
3332 SendHelperMessage(scr
, 'C', scr
->current_workspace
+1, NULL
);
3334 SendHelperMessage(scr
, 'U', 0, NULL
);
3337 } else if (WMGetPropListItemCount(value
) > 0) {
3343 SetupEnvironment(scr
);
3344 text
= WMGetPropListDescription(value
, False
);
3345 len
= strlen(text
)+40;
3346 command
= wmalloc(len
);
3347 dither
= wPreferences
.no_dithering
? "-m" : "-d";
3348 if (wPreferences
.smooth_workspace_back
)
3349 snprintf(command
, len
, "wmsetbg %s -S -p '%s' &", dither
, text
);
3351 snprintf(command
, len
, "wmsetbg %s -p '%s' &", dither
, text
);
3356 WMReleasePropList(value
);
3362 #ifdef VIRTUAL_DESKTOP
3364 setVirtualDeskEnable(WScreen
*scr
, WDefaultEntry
*entry
, void *foo
, void *bar
)
3366 wWorkspaceUpdateEdge(scr
);
3373 setWidgetColor(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3375 if (scr
->widget_texture
) {
3376 wTextureDestroy(scr
, (WTexture
*)scr
->widget_texture
);
3378 scr
->widget_texture
= *(WTexSolid
**)texture
;
3385 setFTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3387 if (scr
->window_title_texture
[WS_FOCUSED
]) {
3388 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3390 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3392 return REFRESH_WINDOW_TEXTURES
;
3397 setPTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3399 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
3400 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3402 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3404 return REFRESH_WINDOW_TEXTURES
;
3409 setUTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3411 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
3412 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3414 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3416 return REFRESH_WINDOW_TEXTURES
;
3421 setResizebarBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3423 if (scr
->resizebar_texture
[0]) {
3424 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3426 scr
->resizebar_texture
[0] = *texture
;
3428 return REFRESH_WINDOW_TEXTURES
;
3433 setMenuTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3435 if (scr
->menu_title_texture
[0]) {
3436 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3438 scr
->menu_title_texture
[0] = *texture
;
3440 return REFRESH_MENU_TITLE_TEXTURE
;
3445 setMenuTextBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3447 if (scr
->menu_item_texture
) {
3448 wTextureDestroy(scr
, scr
->menu_item_texture
);
3449 wTextureDestroy(scr
, (WTexture
*)scr
->menu_item_auxtexture
);
3451 scr
->menu_item_texture
= *texture
;
3453 scr
->menu_item_auxtexture
3454 = wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3456 return REFRESH_MENU_TEXTURE
;
3461 setKeyGrab(WScreen
*scr
, WDefaultEntry
*entry
, WShortKey
*shortcut
, long index
)
3464 wKeyBindings
[index
] = *shortcut
;
3466 wwin
= scr
->focused_window
;
3468 while (wwin
!=NULL
) {
3469 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3471 if (!WFLAGP(wwin
, no_bind_keys
)) {
3472 wWindowSetKeyGrabs(wwin
);
3482 setIconPosition(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
3484 wScreenUpdateUsableArea(scr
);
3485 wArrangeIcons(scr
, True
);
3492 updateUsableArea(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
3494 wScreenUpdateUsableArea(scr
);
3501 setMenuStyle(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
3503 return REFRESH_MENU_TEXTURE
;
3509 setButtonImages(WScreen *scr, WDefaultEntry *entry, int *value, void *foo)
3511 return REFRESH_BUTTON_IMAGES;
3517 * Need access to the double click variables, so that all widgets in
3518 * wmaker panels will have the same dbl-click values.
3519 * TODO: figure a better way of dealing with it.
3521 #include <WINGs/WINGsP.h>
3524 setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
3526 extern _WINGsConfiguration WINGsConfiguration
;
3531 WINGsConfiguration
.doubleClickDelay
= *value
;
3539 setMultiByte(WScreen
*scr
, WDefaultEntry
*entry
, char *value
, void *foo
)
3541 extern _WINGsConfiguration WINGsConfiguration
;
3543 WINGsConfiguration
.useMultiByte
= *value
;
3551 setCursor(WScreen
*scr
, WDefaultEntry
*entry
, Cursor
*cursor
, long index
)
3553 if (wCursor
[index
] != None
) {
3554 XFreeCursor(dpy
, wCursor
[index
]);
3557 wCursor
[index
] = *cursor
;
3559 if (index
==WCUR_ROOT
&& *cursor
!=None
) {
3560 XDefineCursor(dpy
, scr
->root_win
, *cursor
);