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,
33 #include <sys/types.h>
46 #define PATH_MAX DEFAULT_PATH_MAX
50 #include <X11/Xutil.h>
51 #include <X11/keysym.h>
56 #include "WindowMaker.h"
62 #include "resources.h"
65 #include "xmodifier.h"
70 #include "workspace.h"
71 #include "properties.h"
75 * Our own proplist reader parser. This one will not accept any
76 * syntax errors and is more descriptive in the error messages.
77 * It also doesn't seem to crash.
79 extern proplist_t
ReadProplistFromFile(char *file
);
84 extern WDDomain
*WDWindowMaker
;
85 extern WDDomain
*WDWindowAttributes
;
86 extern WDDomain
*WDRootMenu
;
88 extern int wScreenCount
;
90 extern Atom _XA_WINDOWMAKER_ICON_SIZE
;
91 extern Atom _XA_WINDOWMAKER_ICON_TILE
;
94 extern proplist_t wDomainName;
95 extern proplist_t wAttributeDomainName;
97 extern WPreferences wPreferences
;
99 extern WShortKey wKeyBindings
[WKBD_LAST
];
109 proplist_t plvalue
; /* default value */
113 /* used to map strings to integers */
118 } WOptionEnumeration
;
121 /* type converters */
122 static int getBool();
124 static int getCoord();
126 /* this is not used yet */
127 static int getString();
129 static int getPathList();
130 static int getEnum();
131 static int getTexture();
132 #ifdef DRAWSTRING_PLUGIN
133 static int getTextRenderer();
135 static int getWSBackground();
136 static int getWSSpecificBackground();
137 static int getFont();
138 static int getColor();
139 static int getKeybind();
140 static int getModMask();
142 static int getRImage();
146 /* value setting functions */
147 static int setJustify();
148 static int setClearance();
149 static int setIfDockPresent();
150 static int setStickyIcons();
152 static int setPositive();
154 static int setWidgetColor();
155 static int setIconTile();
156 static int setWinTitleFont();
157 static int setMenuTitleFont();
158 static int setMenuTextFont();
159 static int setIconTitleFont();
160 static int setIconTitleColor();
161 static int setIconTitleBack();
162 static int setLargeDisplayFont();
163 static int setWTitleColor();
164 static int setFTitleBack();
165 static int setPTitleBack();
166 static int setUTitleBack();
167 static int setResizebarBack();
168 static int setWorkspaceBack();
169 static int setWorkspaceSpecificBack();
170 static int setMenuTitleColor();
171 static int setMenuTextColor();
172 static int setMenuDisabledColor();
173 static int setMenuTitleBack();
174 static int setMenuTextBack();
175 static int setHightlight();
176 static int setHightlightText();
177 static int setKeyGrab();
178 static int setDoubleClick();
179 static int setIconPosition();
181 static int setClipTitleFont();
182 static int setClipTitleColor();
184 static int setMenuStyle();
185 static int setMultiByte();
187 static int updateUsableArea();
189 #ifdef DEFINABLE_CURSOR
190 extern Cursor wCursor
[WCUR_LAST
];
191 static int getCursor();
192 static int setCursor();
197 * Tables to convert strings to enumeration values.
198 * Values stored are char
202 /* WARNING: sum of length of all value strings must not exceed
204 #define TOTAL_VALUES_LENGTH 80
209 #define REFRESH_WINDOW_TEXTURES (1<<0)
210 #define REFRESH_MENU_TEXTURE (1<<1)
211 #define REFRESH_MENU_FONT (1<<2)
212 #define REFRESH_MENU_COLOR (1<<3)
213 #define REFRESH_MENU_TITLE_TEXTURE (1<<4)
214 #define REFRESH_MENU_TITLE_FONT (1<<5)
215 #define REFRESH_MENU_TITLE_COLOR (1<<6)
216 #define REFRESH_WINDOW_TITLE_COLOR (1<<7)
217 #define REFRESH_WINDOW_FONT (1<<8)
218 #define REFRESH_ICON_TILE (1<<9)
219 #define REFRESH_ICON_FONT (1<<10)
220 #define REFRESH_WORKSPACE_BACK (1<<11)
222 #define REFRESH_BUTTON_IMAGES (1<<12)
224 #define REFRESH_ICON_TITLE_COLOR (1<<13)
225 #define REFRESH_ICON_TITLE_BACK (1<<14)
229 static WOptionEnumeration seFocusModes
[] = {
230 {"Manual", WKF_CLICK
, 0}, {"ClickToFocus", WKF_CLICK
, 1},
231 {"Auto", WKF_POINTER
, 0}, {"FocusFollowMouse", WKF_POINTER
, 1},
232 {"Sloppy", WKF_SLOPPY
, 0}, {"SemiAuto", WKF_SLOPPY
, 1},
236 static WOptionEnumeration seColormapModes
[] = {
237 {"Manual", WKF_CLICK
, 0}, {"ClickToFocus", WKF_CLICK
, 1},
238 {"Auto", WKF_POINTER
, 0}, {"FocusFollowMouse", WKF_POINTER
, 1},
242 static WOptionEnumeration sePlacements
[] = {
243 {"Auto", WPM_AUTO
, 0},
244 {"Smart", WPM_SMART
, 0},
245 {"Cascade", WPM_CASCADE
, 0},
246 {"Random", WPM_RANDOM
, 0},
247 {"Manual", WPM_MANUAL
, 0},
251 static WOptionEnumeration seGeomDisplays
[] = {
252 {"Center", WDIS_CENTER
, 0},
253 {"Corner", WDIS_TOPLEFT
, 0},
254 {"Floating", WDIS_FRAME_CENTER
, 0},
255 {"Line", WDIS_NEW
, 0},
259 static WOptionEnumeration seSpeeds
[] = {
260 {"UltraFast", SPEED_ULTRAFAST
, 0},
261 {"Fast", SPEED_FAST
, 0},
262 {"Medium", SPEED_MEDIUM
, 0},
263 {"Slow", SPEED_SLOW
, 0},
264 {"UltraSlow", SPEED_ULTRASLOW
, 0},
268 static WOptionEnumeration seMouseButtons
[] = {
270 {"Left", Button1
, 0}, {"Button1", Button1
, 1},
271 {"Middle", Button2
, 0}, {"Button2", Button2
, 1},
272 {"Right", Button3
, 0}, {"Button3", Button3
, 1},
273 {"Button4", Button4
, 0},
274 {"Button5", Button5
, 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
378 {"MultiByteText", "NO", NULL
,
379 &wPreferences
.multi_byte_text
, getBool
, setMultiByte
385 WDefaultEntry optionList
[] = {
386 /* dynamic options */
387 {"IconPosition", "blh", seIconPositions
,
388 &wPreferences
.icon_yard
, getEnum
, setIconPosition
390 {"IconificationStyle", "Zoom", seIconificationStyles
,
391 &wPreferences
.iconification_style
, getEnum
, NULL
393 {"SelectWindowsMouseButton", "Left", seMouseButtons
,
394 &wPreferences
.select_button
, getEnum
, NULL
396 {"WindowListMouseButton", "Middle", seMouseButtons
,
397 &wPreferences
.windowl_button
, getEnum
, NULL
399 {"ApplicationMenuMouseButton", "Right", seMouseButtons
,
400 &wPreferences
.menu_button
, getEnum
, NULL
402 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
403 &wPreferences
.pixmap_path
, getPathList
, NULL
405 {"IconPath", DEF_ICON_PATHS
, NULL
,
406 &wPreferences
.icon_path
, getPathList
, NULL
408 {"ColormapMode", "auto", seColormapModes
,
409 &wPreferences
.colormap_mode
, getEnum
, NULL
411 {"AutoFocus", "NO", NULL
,
412 &wPreferences
.auto_focus
, getBool
, NULL
414 {"RaiseDelay", "0", NULL
,
415 &wPreferences
.raise_delay
, getInt
, NULL
417 {"WindozeCycling", "YES", NULL
,
418 &wPreferences
.windows_cycling
,getBool
, NULL
420 {"CirculateRaise", "NO", NULL
,
421 &wPreferences
.circ_raise
, getBool
, NULL
423 {"Superfluous", "NO", NULL
,
424 &wPreferences
.superfluous
, getBool
, NULL
426 {"AdvanceToNewWorkspace", "NO", NULL
,
427 &wPreferences
.ws_advance
, getBool
, NULL
429 {"CycleWorkspaces", "NO", NULL
,
430 &wPreferences
.ws_cycle
, getBool
, NULL
432 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
433 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
435 {"WorkspaceBorder", "None", seWorkspaceBorder
,
436 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
438 {"WorkspaceBorderSize", "0", NULL
,
439 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
441 #ifdef VIRTUAL_DESKTOP
442 {"VirtualEdgeThickness", "1", NULL
,
443 &wPreferences
.vedge_thickness
, getInt
, NULL
445 {"VirtualEdgeHorizonScrollSpeed", "1", NULL
,
446 &wPreferences
.vedge_hscrollspeed
, getInt
, NULL
448 {"VirtualEdgeVerticalScrollSpeed", "1", NULL
,
449 &wPreferences
.vedge_vscrollspeed
, getInt
, NULL
451 {"VirtualEdgeWidth", "2000", NULL
,
452 &wPreferences
.vedge_width
, getInt
, NULL
454 {"VirtualEdgeHeight", "2000", NULL
,
455 &wPreferences
.vedge_height
, getInt
, NULL
458 {"StickyIcons", "NO", NULL
,
459 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
461 {"SaveSessionOnExit", "NO", NULL
,
462 &wPreferences
.save_session_on_exit
, getBool
, NULL
464 {"WrapMenus", "NO", NULL
,
465 &wPreferences
.wrap_menus
, getBool
, NULL
467 {"ScrollableMenus", "NO", NULL
,
468 &wPreferences
.scrollable_menus
, getBool
, NULL
470 {"MenuScrollSpeed", "medium", seSpeeds
,
471 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
473 {"IconSlideSpeed", "medium", seSpeeds
,
474 &wPreferences
.icon_slide_speed
, getEnum
, NULL
476 {"ShadeSpeed", "medium", seSpeeds
,
477 &wPreferences
.shade_speed
, getEnum
, NULL
479 {"DoubleClickTime", "250", (void*) &wPreferences
.dblclick_time
,
480 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
,
482 {"AlignSubmenus", "NO", NULL
,
483 &wPreferences
.align_menus
, getBool
, NULL
485 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
486 &wPreferences
.open_transients_with_parent
, getBool
, NULL
488 {"WindowPlacement", "auto", sePlacements
,
489 &wPreferences
.window_placement
, getEnum
, NULL
491 {"IgnoreFocusClick","NO", NULL
,
492 &wPreferences
.ignore_focus_click
, getBool
, NULL
494 {"UseSaveUnders", "NO", NULL
,
495 &wPreferences
.use_saveunders
, getBool
, NULL
497 {"OpaqueMove", "NO", NULL
,
498 &wPreferences
.opaque_move
, getBool
, NULL
500 {"DisableSound", "NO", NULL
,
501 &wPreferences
.no_sound
, getBool
, NULL
503 {"DisableAnimations", "NO", NULL
,
504 &wPreferences
.no_animations
, getBool
, NULL
506 {"DontLinkWorkspaces","NO", NULL
,
507 &wPreferences
.no_autowrap
, getBool
, NULL
509 {"AutoArrangeIcons", "NO", NULL
,
510 &wPreferences
.auto_arrange_icons
, getBool
, NULL
512 {"NoWindowOverDock", "NO", NULL
,
513 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
515 {"NoWindowOverIcons", "NO", NULL
,
516 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
518 {"WindowPlaceOrigin", "(0, 0)", NULL
,
519 &wPreferences
.window_place_origin
, getCoord
, NULL
521 {"ResizeDisplay", "corner", seGeomDisplays
,
522 &wPreferences
.size_display
, getEnum
, NULL
524 {"MoveDisplay", "corner", seGeomDisplays
,
525 &wPreferences
.move_display
, getEnum
, NULL
527 {"DontConfirmKill", "NO", NULL
,
528 &wPreferences
.dont_confirm_kill
, getBool
,NULL
530 {"WindowTitleBalloons", "NO", NULL
,
531 &wPreferences
.window_balloon
, getBool
, NULL
533 {"MiniwindowTitleBalloons", "NO", NULL
,
534 &wPreferences
.miniwin_balloon
,getBool
, NULL
536 {"AppIconBalloons", "NO", NULL
,
537 &wPreferences
.appicon_balloon
,getBool
, NULL
539 {"HelpBalloons", "NO", NULL
,
540 &wPreferences
.help_balloon
, getBool
, NULL
542 {"EdgeResistance", "30", NULL
,
543 &wPreferences
.edge_resistance
,getInt
, NULL
545 {"Attraction", "NO", NULL
,
546 &wPreferences
.attract
, getBool
, NULL
548 {"DisableBlinking", "NO", NULL
,
549 &wPreferences
.dont_blink
, getBool
, NULL
552 {"MenuStyle", "normal", seMenuStyles
,
553 &wPreferences
.menu_style
, getEnum
, setMenuStyle
555 {"WidgetColor", "(solid, gray)", NULL
,
556 NULL
, getTexture
, setWidgetColor
,
558 {"WorkspaceSpecificBack","()", NULL
,
559 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
561 /* WorkspaceBack must come after WorkspaceSpecificBack or
562 * WorkspaceBack wont know WorkspaceSpecificBack was also
563 * specified and 2 copies of wmsetbg will be launched */
564 {"WorkspaceBack", "(solid, black)", NULL
,
565 NULL
, getWSBackground
,setWorkspaceBack
567 {"SmoothWorkspaceBack", "NO", NULL
,
570 {"IconBack", "(solid, gray)", NULL
,
571 NULL
, getTexture
, setIconTile
573 {"TitleJustify", "center", seJustifications
,
574 &wPreferences
.title_justification
, getEnum
, setJustify
576 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
577 NULL
, getFont
, setWinTitleFont
,
579 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
580 &wPreferences
.window_title_clearance
, getInt
, setClearance
582 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
583 &wPreferences
.menu_title_clearance
, getInt
, setClearance
585 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
586 &wPreferences
.menu_text_clearance
, getInt
, setClearance
588 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
589 NULL
, getFont
, setMenuTitleFont
591 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
592 NULL
, getFont
, setMenuTextFont
594 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
595 NULL
, getFont
, setIconTitleFont
597 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
598 NULL
, getFont
, setClipTitleFont
600 {"LargeDisplayFont",DEF_WORKSPACE_NAME_FONT
, NULL
,
601 NULL
, getFont
, setLargeDisplayFont
603 {"HighlightColor", "white", NULL
,
604 NULL
, getColor
, setHightlight
606 {"HighlightTextColor", "black", NULL
,
607 NULL
, getColor
, setHightlightText
609 {"ClipTitleColor", "black", (void*)CLIP_NORMAL
,
610 NULL
, getColor
, setClipTitleColor
612 {"CClipTitleColor", "\"#454045\"", (void*)CLIP_COLLAPSED
,
613 NULL
, getColor
, setClipTitleColor
615 #ifdef DRAWSTRING_PLUGIN
616 {"FTitleColor", "white", (void*)WS_FOCUSED
,
617 NULL
, getTextRenderer
, setWTitleColor
619 {"PTitleColor", "white", (void*)WS_PFOCUSED
,
620 NULL
, getTextRenderer
, setWTitleColor
622 {"UTitleColor", "black", (void*)WS_UNFOCUSED
,
623 NULL
, getTextRenderer
, setWTitleColor
626 {"FTitleColor", "white", (void*)WS_FOCUSED
,
627 NULL
, getColor
, setWTitleColor
629 {"PTitleColor", "white", (void*)WS_PFOCUSED
,
630 NULL
, getColor
, setWTitleColor
632 {"UTitleColor", "black", (void*)WS_UNFOCUSED
,
633 NULL
, getColor
, setWTitleColor
636 {"FTitleBack", "(solid, black)", NULL
,
637 NULL
, getTexture
, setFTitleBack
639 {"PTitleBack", "(solid, \"#616161\")", NULL
,
640 NULL
, getTexture
, setPTitleBack
642 {"UTitleBack", "(solid, gray)", NULL
,
643 NULL
, getTexture
, setUTitleBack
645 {"ResizebarBack", "(solid, gray)", NULL
,
646 NULL
, getTexture
, setResizebarBack
648 #ifdef DRAWSTRING_PLUGIN
649 {"MenuTitleColor", "white", NULL
,
650 NULL
, getTextRenderer
, setMenuTitleColor
653 {"MenuTitleColor", "white", NULL
,
654 NULL
, getColor
, setMenuTitleColor
657 {"MenuTextColor", "black", NULL
,
658 NULL
, getColor
, setMenuTextColor
660 {"MenuDisabledColor", "\"#616161\"", NULL
,
661 NULL
, getColor
, setMenuDisabledColor
663 {"MenuTitleBack", "(solid, black)", NULL
,
664 NULL
, getTexture
, setMenuTitleBack
666 {"MenuTextBack", "(solid, gray)", NULL
,
667 NULL
, getTexture
, setMenuTextBack
669 {"IconTitleColor", "white", NULL
,
670 NULL
, getColor
, setIconTitleColor
672 {"IconTitleBack", "black", NULL
,
673 NULL
, getColor
, setIconTitleBack
677 {"RootMenuKey", "None", (void*)WKBD_ROOTMENU
,
678 NULL
, getKeybind
, setKeyGrab
680 {"WindowListKey", "None", (void*)WKBD_WINDOWLIST
,
681 NULL
, getKeybind
, setKeyGrab
684 {"WindowMenuKey", "None", (void*)WKBD_WINDOWMENU
,
685 NULL
, getKeybind
, setKeyGrab
687 {"ClipLowerKey", "None", (void*)WKBD_CLIPLOWER
,
688 NULL
, getKeybind
, setKeyGrab
690 {"ClipRaiseKey", "None", (void*)WKBD_CLIPRAISE
,
691 NULL
, getKeybind
, setKeyGrab
693 {"ClipRaiseLowerKey", "None", (void*)WKBD_CLIPRAISELOWER
,
694 NULL
, getKeybind
, setKeyGrab
696 {"MiniaturizeKey", "None", (void*)WKBD_MINIATURIZE
,
697 NULL
, getKeybind
, setKeyGrab
699 {"HideKey", "None", (void*)WKBD_HIDE
,
700 NULL
, getKeybind
, setKeyGrab
702 {"MoveResizeKey", "None", (void*)WKBD_MOVERESIZE
,
703 NULL
, getKeybind
, setKeyGrab
705 {"CloseKey", "None", (void*)WKBD_CLOSE
,
706 NULL
, getKeybind
, setKeyGrab
708 {"MaximizeKey", "None", (void*)WKBD_MAXIMIZE
,
709 NULL
, getKeybind
, setKeyGrab
711 {"VMaximizeKey", "None", (void*)WKBD_VMAXIMIZE
,
712 NULL
, getKeybind
, setKeyGrab
714 {"RaiseKey", "\"Meta+Up\"", (void*)WKBD_RAISE
,
715 NULL
, getKeybind
, setKeyGrab
717 {"LowerKey", "\"Meta+Down\"", (void*)WKBD_LOWER
,
718 NULL
, getKeybind
, setKeyGrab
720 {"RaiseLowerKey", "None", (void*)WKBD_RAISELOWER
,
721 NULL
, getKeybind
, setKeyGrab
723 {"ShadeKey", "None", (void*)WKBD_SHADE
,
724 NULL
, getKeybind
, setKeyGrab
726 {"SelectKey", "None", (void*)WKBD_SELECT
,
727 NULL
, getKeybind
, setKeyGrab
729 {"FocusNextKey", "None", (void*)WKBD_FOCUSNEXT
,
730 NULL
, getKeybind
, setKeyGrab
732 {"FocusPrevKey", "None", (void*)WKBD_FOCUSPREV
,
733 NULL
, getKeybind
, setKeyGrab
735 {"NextWorkspaceKey", "None", (void*)WKBD_NEXTWORKSPACE
,
736 NULL
, getKeybind
, setKeyGrab
738 {"PrevWorkspaceKey", "None", (void*)WKBD_PREVWORKSPACE
,
739 NULL
, getKeybind
, setKeyGrab
741 {"NextWorkspaceLayerKey", "None", (void*)WKBD_NEXTWSLAYER
,
742 NULL
, getKeybind
, setKeyGrab
744 {"PrevWorkspaceLayerKey", "None", (void*)WKBD_PREVWSLAYER
,
745 NULL
, getKeybind
, setKeyGrab
747 {"Workspace1Key", "None", (void*)WKBD_WORKSPACE1
,
748 NULL
, getKeybind
, setKeyGrab
750 {"Workspace2Key", "None", (void*)WKBD_WORKSPACE2
,
751 NULL
, getKeybind
, setKeyGrab
753 {"Workspace3Key", "None", (void*)WKBD_WORKSPACE3
,
754 NULL
, getKeybind
, setKeyGrab
756 {"Workspace4Key", "None", (void*)WKBD_WORKSPACE4
,
757 NULL
, getKeybind
, setKeyGrab
759 {"Workspace5Key", "None", (void*)WKBD_WORKSPACE5
,
760 NULL
, getKeybind
, setKeyGrab
762 {"Workspace6Key", "None", (void*)WKBD_WORKSPACE6
,
763 NULL
, getKeybind
, setKeyGrab
765 {"Workspace7Key", "None", (void*)WKBD_WORKSPACE7
,
766 NULL
, getKeybind
, setKeyGrab
768 {"Workspace8Key", "None", (void*)WKBD_WORKSPACE8
,
769 NULL
, getKeybind
, setKeyGrab
771 {"Workspace9Key", "None", (void*)WKBD_WORKSPACE9
,
772 NULL
, getKeybind
, setKeyGrab
774 {"Workspace10Key", "None", (void*)WKBD_WORKSPACE10
,
775 NULL
, getKeybind
, setKeyGrab
777 {"WindowShortcut1Key","None", (void*)WKBD_WINDOW1
,
778 NULL
, getKeybind
, setKeyGrab
780 {"WindowShortcut2Key","None", (void*)WKBD_WINDOW2
,
781 NULL
, getKeybind
, setKeyGrab
783 {"WindowShortcut3Key","None", (void*)WKBD_WINDOW3
,
784 NULL
, getKeybind
, setKeyGrab
786 {"WindowShortcut4Key","None", (void*)WKBD_WINDOW4
,
787 NULL
, getKeybind
, setKeyGrab
789 #ifdef EXTEND_WINDOWSHORTCUT
790 ,{"WindowShortcut5Key","None", (void*)WKBD_WINDOW5
,
791 NULL
, getKeybind
, setKeyGrab
793 {"WindowShortcut6Key","None", (void*)WKBD_WINDOW6
,
794 NULL
, getKeybind
, setKeyGrab
796 {"WindowShortcut7Key","None", (void*)WKBD_WINDOW7
,
797 NULL
, getKeybind
, setKeyGrab
799 {"WindowShortcut8Key","None", (void*)WKBD_WINDOW8
,
800 NULL
, getKeybind
, setKeyGrab
802 {"WindowShortcut9Key","None", (void*)WKBD_WINDOW9
,
803 NULL
, getKeybind
, setKeyGrab
805 {"WindowShortcut10Key","None", (void*)WKBD_WINDOW10
,
806 NULL
, getKeybind
, setKeyGrab
808 #endif /* EXTEND_WINDOWSHORTCUT */
810 #ifdef KEEP_XKB_LOCK_STATUS
811 ,{"ToggleKbdModeKey", "None", (void*)WKBD_TOGGLE
,
812 NULL
, getKeybind
, setKeyGrab
814 {"KbdModeLock", "NO", NULL
,
815 &wPreferences
.modelock
, getBool
, NULL
817 #endif /* KEEP_XKB_LOCK_STATUS */
818 #ifdef DEFINABLE_CURSOR
819 ,{"NormalCursor", "(builtin, left_ptr)", (void*)WCUR_ROOT
,
820 NULL
, getCursor
, setCursor
822 ,{"MoveCursor", "(builtin, fleur)", (void*)WCUR_MOVE
,
823 NULL
, getCursor
, setCursor
826 {"TopLeftResizeCursor", "(builtin, sizing)", (void*)WCUR_TOPLEFTRESIZE
,
827 NULL
, getCursor
, setCursor
829 {"TopRightResizeCursor", "(builtin, sizing)", (void*)WCUR_TOPRIGHTRESIZE
,
830 NULL
, getCursor
, setCursor
832 {"BottomLeftResizeCursor", "(builtin, sizing)", (void*)WCUR_BOTTOMLEFTRESIZE
,
833 NULL
, getCursor
, setCursor
835 {"BottomRightResizeCursor", "(builtin, sizing)", (void*)WCUR_BOTTOMRIGHTRESIZE
,
836 NULL
, getCursor
, setCursor
838 {"VerticalResizeCursor", "(builtin, sizing)", (void*)WCUR_VERTICALRESIZE
,
839 NULL
, getCursor
, setCursor
841 {"HorizonResizeCursor", "(builtin, sizing)", (void*)WCUR_HORIZONRESIZE
,
842 NULL
, getCursor
, setCursor
844 {"WaitCursor", "(builtin, watch)", (void*)WCUR_WAIT
,
845 NULL
, getCursor
, setCursor
847 {"ArrowCursor", "(builtin, top_left_arrow)", (void*)WCUR_ARROW
,
848 NULL
, getCursor
, setCursor
851 #endif /* DEFINABLE_CURSOR */
856 static void rereadDefaults(void);
863 /* must defer the update because accessing X data from a
864 * signal handler can mess up Xlib */
873 WDefaultEntry
*entry
;
875 PLSetStringCmpHook(StringCompareHook
);
877 for (i
=0; i
<sizeof(optionList
)/sizeof(WDefaultEntry
); i
++) {
878 entry
= &optionList
[i
];
880 entry
->plkey
= PLMakeString(entry
->key
);
881 if (entry
->default_value
)
882 entry
->plvalue
= PLGetProplistWithDescription(entry
->default_value
);
884 entry
->plvalue
= NULL
;
887 for (i
=0; i
<sizeof(staticOptionList
)/sizeof(WDefaultEntry
); i
++) {
888 entry
= &staticOptionList
[i
];
890 entry
->plkey
= PLMakeString(entry
->key
);
891 if (entry
->default_value
)
892 entry
->plvalue
= PLGetProplistWithDescription(entry
->default_value
);
894 entry
->plvalue
= NULL
;
898 wDomainName = PLMakeString(WMDOMAIN_NAME);
899 wAttributeDomainName = PLMakeString(WMATTRIBUTE_DOMAIN_NAME);
901 PLRegister(wDomainName, rereadDefaults);
902 PLRegister(wAttributeDomainName, rereadDefaults);
911 wDefaultsInit(int screen_number
)
913 static int defaults_inited
= 0;
916 if (!defaults_inited
) {
920 dict
= PLGetDomain(wDomainName
);
922 wwarning(_("could not read domain \"%s\" from defaults database"),
923 PLGetString(wDomainName
));
932 wDefaultsDestroyDomain(WDDomain
*domain
)
934 if (domain
->dictionary
)
935 PLRelease(domain
->dictionary
);
942 wDefaultsInitDomain(char *domain
, Bool requireDictionary
)
946 static int inited
= 0;
949 proplist_t shared_dict
=NULL
;
956 db
= wmalloc(sizeof(WDDomain
));
957 memset(db
, 0, sizeof(WDDomain
));
958 db
->domain_name
= domain
;
959 db
->path
= wdefaultspathfordomain(domain
);
962 if (the_path
&& stat(the_path
, &stbuf
)>=0) {
963 db
->dictionary
= ReadProplistFromFile(the_path
);
964 if (db
->dictionary
) {
965 if (requireDictionary
&& !PLIsDictionary(db
->dictionary
)) {
966 PLRelease(db
->dictionary
);
967 db
->dictionary
= NULL
;
968 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
971 db
->timestamp
= stbuf
.st_mtime
;
973 wwarning(_("could not load domain %s from user defaults database"),
978 /* global system dictionary */
979 sprintf(path
, "%s/WindowMaker/%s", SYSCONFDIR
, domain
);
980 if (stat(path
, &stbuf
)>=0) {
981 shared_dict
= ReadProplistFromFile(path
);
983 if (requireDictionary
&& !PLIsDictionary(shared_dict
)) {
984 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
986 PLRelease(shared_dict
);
989 if (db
->dictionary
&& PLIsDictionary(shared_dict
) &&
990 PLIsDictionary(db
->dictionary
)) {
991 PLMergeDictionaries(shared_dict
, db
->dictionary
);
992 PLRelease(db
->dictionary
);
993 db
->dictionary
= shared_dict
;
994 if (stbuf
.st_mtime
> db
->timestamp
)
995 db
->timestamp
= stbuf
.st_mtime
;
996 } else if (!db
->dictionary
) {
997 db
->dictionary
= shared_dict
;
998 if (stbuf
.st_mtime
> db
->timestamp
)
999 db
->timestamp
= stbuf
.st_mtime
;
1003 wwarning(_("could not load domain %s from global defaults database (%s)"),
1008 /* set to save it in user's directory, no matter from where it was read */
1009 if (db
->dictionary
) {
1010 proplist_t tmp
= PLMakeString(db
->path
);
1012 PLSetFilename(db
->dictionary
, tmp
);
1021 wReadStaticDefaults(proplist_t dict
)
1024 WDefaultEntry
*entry
;
1029 for (i
=0; i
<sizeof(staticOptionList
)/sizeof(WDefaultEntry
); i
++) {
1030 entry
= &staticOptionList
[i
];
1033 plvalue
= PLGetDictionaryEntry(dict
, entry
->plkey
);
1038 /* no default in the DB. Use builtin default */
1039 plvalue
= entry
->plvalue
;
1044 (*entry
->convert
)(NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
1045 if (entry
->update
) {
1046 (*entry
->update
)(NULL
, entry
, tdata
, entry
->extra_data
);
1054 wDefaultsCheckDomains(void *foo
)
1060 char path
[PATH_MAX
];
1063 puts("Checking domains...");
1065 if (stat(WDWindowMaker
->path
, &stbuf
)>=0
1066 && WDWindowMaker
->timestamp
< stbuf
.st_mtime
) {
1067 proplist_t shared_dict
= NULL
;
1069 puts("Checking WindowMaker domain");
1071 WDWindowMaker
->timestamp
= stbuf
.st_mtime
;
1073 /* global dictionary */
1074 sprintf(path
, "%s/WindowMaker/WindowMaker", SYSCONFDIR
);
1075 if (stat(path
, &stbuf
)>=0) {
1076 shared_dict
= ReadProplistFromFile(path
);
1077 if (shared_dict
&& !PLIsDictionary(shared_dict
)) {
1078 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
1079 "WindowMaker", path
);
1080 PLRelease(shared_dict
);
1082 } else if (!shared_dict
) {
1083 wwarning(_("could not load domain %s from global defaults database"),
1087 /* user dictionary */
1088 dict
= ReadProplistFromFile(WDWindowMaker
->path
);
1090 if (!PLIsDictionary(dict
)) {
1093 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1094 "WindowMaker", WDWindowMaker
->path
);
1097 PLSetFilename(shared_dict
, PLGetFilename(dict
));
1098 PLMergeDictionaries(shared_dict
, dict
);
1103 for (i
=0; i
<wScreenCount
; i
++) {
1104 scr
= wScreenWithNumber(i
);
1106 wReadDefaults(scr
, dict
);
1108 if (WDWindowMaker
->dictionary
) {
1109 PLRelease(WDWindowMaker
->dictionary
);
1111 WDWindowMaker
->dictionary
= dict
;
1114 wwarning(_("could not load domain %s from user defaults database"),
1118 PLRelease(shared_dict
);
1122 if (stat(WDWindowAttributes
->path
, &stbuf
)>=0
1123 && WDWindowAttributes
->timestamp
< stbuf
.st_mtime
) {
1125 puts("Checking WMWindowAttributes domain");
1127 dict
= ReadProplistFromFile(WDWindowAttributes
->path
);
1129 if (!PLIsDictionary(dict
)) {
1132 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1133 "WMWindowAttributes", WDWindowAttributes
->path
);
1135 if (WDWindowAttributes
->dictionary
)
1136 PLRelease(WDWindowAttributes
->dictionary
);
1137 WDWindowAttributes
->dictionary
= dict
;
1138 for (i
=0; i
<wScreenCount
; i
++) {
1139 scr
= wScreenWithNumber(i
);
1141 wDefaultUpdateIcons(scr
);
1145 wwarning(_("could not load domain %s from user defaults database"),
1146 "WMWindowAttributes");
1148 WDWindowAttributes
->timestamp
= stbuf
.st_mtime
;
1152 if (stat(WDRootMenu
->path
, &stbuf
)>=0
1153 && WDRootMenu
->timestamp
< stbuf
.st_mtime
) {
1154 dict
= ReadProplistFromFile(WDRootMenu
->path
);
1156 puts("Checking WMRootMenu domain");
1159 if (!PLIsArray(dict
) && !PLIsString(dict
)) {
1162 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1163 "WMRootMenu", WDRootMenu
->path
);
1165 if (WDRootMenu
->dictionary
) {
1166 PLRelease(WDRootMenu
->dictionary
);
1168 WDRootMenu
->dictionary
= dict
;
1171 wwarning(_("could not load domain %s from user defaults database"),
1174 WDRootMenu
->timestamp
= stbuf
.st_mtime
;
1179 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, foo
);
1184 wReadDefaults(WScreen
*scr
, proplist_t new_dict
)
1186 proplist_t plvalue
, old_value
;
1187 WDefaultEntry
*entry
;
1189 int update_workspace_back
= 0; /* kluge :/ */
1192 proplist_t old_dict
= (WDWindowMaker
->dictionary
!=new_dict
1193 ? WDWindowMaker
->dictionary
: NULL
);
1199 for (i
=0; i
<sizeof(optionList
)/sizeof(WDefaultEntry
); i
++) {
1200 entry
= &optionList
[i
];
1203 plvalue
= PLGetDictionaryEntry(new_dict
, entry
->plkey
);
1210 old_value
= PLGetDictionaryEntry(old_dict
, entry
->plkey
);
1213 if (!plvalue
&& !old_value
) {
1214 /* no default in the DB. Use builtin default */
1215 plvalue
= entry
->plvalue
;
1216 if (plvalue
&& new_dict
) {
1217 PLInsertDictionaryEntry(new_dict
, entry
->plkey
, plvalue
);
1220 } else if (!plvalue
) {
1221 /* value was deleted from DB. Keep current value */
1223 } else if (!old_value
) {
1224 /* set value for the 1st time */
1225 } else if (!PLIsEqual(plvalue
, old_value
)) {
1226 /* value has changed */
1229 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1230 && update_workspace_back
1231 && scr
->flags
.backimage_helper_launched
) {
1233 /* value was not changed since last time */
1240 printf("Updating %s to %s\n", entry
->key
,
1241 PLGetDescription(plvalue
));
1244 if ((*entry
->convert
)(scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1246 * If the WorkspaceSpecificBack data has been changed
1247 * so that the helper will be launched now, we must be
1248 * sure to send the default background texture config
1251 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0
1252 && !scr
->flags
.backimage_helper_launched
) {
1253 update_workspace_back
= 1;
1255 if (entry
->update
) {
1257 (*entry
->update
)(scr
, entry
, tdata
, entry
->extra_data
);
1263 if (needs_refresh
!=0 && !scr
->flags
.startup
) {
1267 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1268 foo
|= WTextureSettings
;
1269 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1270 foo
|= WFontSettings
;
1271 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1272 foo
|= WColorSettings
;
1274 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1278 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1279 foo
|= WTextureSettings
;
1280 if (needs_refresh
& REFRESH_MENU_FONT
)
1281 foo
|= WFontSettings
;
1282 if (needs_refresh
& REFRESH_MENU_COLOR
)
1283 foo
|= WColorSettings
;
1285 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
,
1289 if (needs_refresh
& REFRESH_WINDOW_FONT
) {
1290 foo
|= WFontSettings
;
1292 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
) {
1293 foo
|= WTextureSettings
;
1295 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
) {
1296 foo
|= WColorSettings
;
1299 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
,
1302 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1304 if (needs_refresh
& REFRESH_ICON_FONT
) {
1305 foo
|= WFontSettings
;
1307 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
) {
1308 foo
|= WTextureSettings
;
1310 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
) {
1311 foo
|= WTextureSettings
;
1314 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1317 if (needs_refresh
& REFRESH_ICON_TILE
)
1318 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1324 wDefaultUpdateIcons(WScreen
*scr
)
1326 WAppIcon
*aicon
= scr
->app_icon_list
;
1327 WWindow
*wwin
= scr
->focused_window
;
1331 file
= wDefaultGetIconFile(scr
, aicon
->wm_instance
, aicon
->wm_class
,
1333 if ((file
&& aicon
->icon
->file
&& strcmp(file
, aicon
->icon
->file
)!=0)
1334 || (file
&& !aicon
->icon
->file
)) {
1337 if (aicon
->icon
->file
)
1338 free(aicon
->icon
->file
);
1339 aicon
->icon
->file
= wstrdup(file
);
1341 new_image
= wDefaultGetImage(scr
, aicon
->wm_instance
,
1344 wIconChangeImage(aicon
->icon
, new_image
);
1345 wAppIconPaint(aicon
);
1348 aicon
= aicon
->next
;
1351 if (!wPreferences
.flags
.noclip
)
1352 wClipIconPaint(scr
->clip_icon
);
1355 if (wwin
->icon
&& wwin
->flags
.miniaturized
) {
1356 file
= wDefaultGetIconFile(scr
, wwin
->wm_instance
, wwin
->wm_class
,
1358 if ((file
&& wwin
->icon
->file
&& strcmp(file
, wwin
->icon
->file
)!=0)
1359 || (file
&& !wwin
->icon
->file
)) {
1362 if (wwin
->icon
->file
)
1363 free(wwin
->icon
->file
);
1364 wwin
->icon
->file
= wstrdup(file
);
1366 new_image
= wDefaultGetImage(scr
, wwin
->wm_instance
,
1369 wIconChangeImage(wwin
->icon
, new_image
);
1377 /* --------------------------- Local ----------------------- */
1379 #define GET_STRING_OR_DEFAULT(x, var) if (!PLIsString(value)) { \
1380 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1382 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1383 var = entry->default_value;\
1384 } else var = PLGetString(value)\
1391 string2index(proplist_t key
, proplist_t val
, proplist_t def
,
1392 WOptionEnumeration
*values
)
1395 WOptionEnumeration
*v
;
1396 char buffer
[TOTAL_VALUES_LENGTH
];
1398 if (PLIsString(val
) && (str
= PLGetString(val
))) {
1399 for (v
=values
; v
->string
!=NULL
; v
++) {
1400 if (strcasecmp(v
->string
, str
)==0)
1406 for (v
=values
; v
->string
!=NULL
; v
++) {
1409 strcat(buffer
, ", ");
1410 strcat(buffer
, v
->string
);
1413 wwarning(_("wrong option value for key \"%s\". Should be one of %s"),
1414 PLGetString(key
), buffer
);
1417 return string2index(key
, val
, NULL
, values
);
1427 * value - is the value in the defaults DB
1428 * addr - is the address to store the data
1429 * ret - is the address to store a pointer to a temporary buffer. ret
1430 * must not be freed and is used by the set functions
1433 getBool(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1440 GET_STRING_OR_DEFAULT("Boolean", val
);
1443 if ((val
[1]=='\0' && (val
[0]=='y' || val
[0]=='Y'))
1444 || strcasecmp(val
, "YES")==0) {
1447 } else if ((val
[1]=='\0' && (val
[0]=='n' || val
[0]=='N'))
1448 || strcasecmp(val
, "NO")==0) {
1452 if (sscanf(val
, "%i", &i
)==1) {
1458 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""),
1460 if (second_pass
==0) {
1461 val
= PLGetString(entry
->plvalue
);
1463 wwarning(_("using default \"%s\" instead"), val
);
1474 *(char*)addr
= data
;
1482 getInt(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1489 GET_STRING_OR_DEFAULT("Integer", val
);
1491 if (sscanf(val
, "%i", &data
)!=1) {
1492 wwarning(_("can't convert \"%s\" to integer for key \"%s\""),
1494 val
= PLGetString(entry
->plvalue
);
1495 wwarning(_("using default \"%s\" instead"), val
);
1496 if (sscanf(val
, "%i", &data
)!=1) {
1512 getCoord(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1516 char *val_x
, *val_y
;
1517 int nelem
, changed
=0;
1518 proplist_t elem_x
, elem_y
;
1521 if (!PLIsArray(value
)) {
1522 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1523 entry
->key
, "Coordinate");
1525 value
= entry
->plvalue
;
1527 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1533 nelem
= PLGetNumberOfElements(value
);
1535 wwarning(_("Incorrect number of elements in array for key \"%s\"."),
1538 value
= entry
->plvalue
;
1540 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1546 elem_x
= PLGetArrayElement(value
, 0);
1547 elem_y
= PLGetArrayElement(value
, 1);
1549 if (!elem_x
|| !elem_y
|| !PLIsString(elem_x
) || !PLIsString(elem_y
)) {
1550 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."),
1553 value
= entry
->plvalue
;
1555 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1561 val_x
= PLGetString(elem_x
);
1562 val_y
= PLGetString(elem_y
);
1564 if (sscanf(val_x
, "%i", &data
.x
)!=1 || sscanf(val_y
, "%i", &data
.y
)!=1) {
1565 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1567 value
= entry
->plvalue
;
1569 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1577 else if (data
.x
> scr
->scr_width
/3)
1578 data
.x
= scr
->scr_width
/3;
1581 else if (data
.y
> scr
->scr_height
/3)
1582 data
.y
= scr
->scr_height
/3;
1588 *(WCoord
*)addr
= data
;
1596 /* This function is not used at the moment. */
1598 getString(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1603 GET_STRING_OR_DEFAULT("String", data
);
1606 data
= PLGetString(entry
->plvalue
);
1615 *(char**)addr
= wstrdup(data
);
1623 getPathList(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1633 if (!PLIsArray(value
)) {
1634 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1635 entry
->key
, "an array of paths");
1637 value
= entry
->plvalue
;
1639 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1646 count
= PLGetNumberOfElements(value
);
1649 value
= entry
->plvalue
;
1651 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1658 for (i
=0; i
<count
; i
++) {
1659 d
= PLGetArrayElement(value
, i
);
1660 if (!d
|| !PLIsString(d
)) {
1664 len
+= strlen(PLGetString(d
))+1;
1667 ptr
= data
= wmalloc(len
+1);
1669 for (i
=0; i
<count
; i
++) {
1670 d
= PLGetArrayElement(value
, i
);
1671 if (!d
|| !PLIsString(d
)) {
1674 strcpy(ptr
, PLGetString(d
));
1675 ptr
+= strlen(PLGetString(d
));
1679 ptr
--; *(ptr
--) = 0;
1681 if (*(char**)addr
!=NULL
) {
1682 free(*(char**)addr
);
1684 *(char**)addr
= data
;
1691 getEnum(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1694 static signed char data
;
1696 data
= string2index(entry
->plkey
, value
, entry
->default_value
,
1697 (WOptionEnumeration
*)entry
->extra_data
);
1705 *(signed char*)addr
= data
;
1714 * (hgradient <color> <color>)
1715 * (vgradient <color> <color>)
1716 * (dgradient <color> <color>)
1717 * (mhgradient <color> <color> ...)
1718 * (mvgradient <color> <color> ...)
1719 * (mdgradient <color> <color> ...)
1720 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1721 * (tpixmap <file> <color>)
1722 * (spixmap <file> <color>)
1723 * (cpixmap <file> <color>)
1724 * (thgradient <file> <opaqueness> <color> <color>)
1725 * (tvgradient <file> <opaqueness> <color> <color>)
1726 * (tdgradient <file> <opaqueness> <color> <color>)
1727 * (function <lib> <function> ...)
1731 parse_texture(WScreen
*scr
, proplist_t pl
)
1736 WTexture
*texture
=NULL
;
1738 nelem
= PLGetNumberOfElements(pl
);
1743 elem
= PLGetArrayElement(pl
, 0);
1744 if (!elem
|| !PLIsString(elem
))
1746 val
= PLGetString(elem
);
1749 if (strcasecmp(val
, "solid")==0) {
1757 elem
= PLGetArrayElement(pl
, 1);
1758 if (!elem
|| !PLIsString(elem
))
1760 val
= PLGetString(elem
);
1762 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1763 wwarning(_("\"%s\" is not a valid color name"), val
);
1767 texture
= (WTexture
*)wTextureMakeSolid(scr
, &color
);
1768 } else if (strcasecmp(val
, "dgradient")==0
1769 || strcasecmp(val
, "vgradient")==0
1770 || strcasecmp(val
, "hgradient")==0) {
1771 RColor color1
, color2
;
1776 wwarning(_("bad number of arguments in gradient specification"));
1780 if (val
[0]=='d' || val
[0]=='D')
1781 type
= WTEX_DGRADIENT
;
1782 else if (val
[0]=='h' || val
[0]=='H')
1783 type
= WTEX_HGRADIENT
;
1785 type
= WTEX_VGRADIENT
;
1788 /* get from color */
1789 elem
= PLGetArrayElement(pl
, 1);
1790 if (!elem
|| !PLIsString(elem
))
1792 val
= PLGetString(elem
);
1794 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1795 wwarning(_("\"%s\" is not a valid color name"), val
);
1799 color1
.red
= xcolor
.red
>> 8;
1800 color1
.green
= xcolor
.green
>> 8;
1801 color1
.blue
= xcolor
.blue
>> 8;
1804 elem
= PLGetArrayElement(pl
, 2);
1805 if (!elem
|| !PLIsString(elem
)) {
1808 val
= PLGetString(elem
);
1810 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1811 wwarning(_("\"%s\" is not a valid color name"), val
);
1815 color2
.red
= xcolor
.red
>> 8;
1816 color2
.green
= xcolor
.green
>> 8;
1817 color2
.blue
= xcolor
.blue
>> 8;
1819 texture
= (WTexture
*)wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1821 } else if (strcasecmp(val
, "igradient")==0) {
1822 RColor colors1
[2], colors2
[2];
1828 wwarning(_("bad number of arguments in gradient specification"));
1832 /* get from color */
1833 for (i
= 0; i
< 2; i
++) {
1834 elem
= PLGetArrayElement(pl
, 1+i
);
1835 if (!elem
|| !PLIsString(elem
))
1837 val
= PLGetString(elem
);
1839 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1840 wwarning(_("\"%s\" is not a valid color name"), val
);
1843 colors1
[i
].alpha
= 255;
1844 colors1
[i
].red
= xcolor
.red
>> 8;
1845 colors1
[i
].green
= xcolor
.green
>> 8;
1846 colors1
[i
].blue
= xcolor
.blue
>> 8;
1848 elem
= PLGetArrayElement(pl
, 3);
1849 if (!elem
|| !PLIsString(elem
))
1851 val
= PLGetString(elem
);
1855 /* get from color */
1856 for (i
= 0; i
< 2; i
++) {
1857 elem
= PLGetArrayElement(pl
, 4+i
);
1858 if (!elem
|| !PLIsString(elem
))
1860 val
= PLGetString(elem
);
1862 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1863 wwarning(_("\"%s\" is not a valid color name"), val
);
1866 colors2
[i
].alpha
= 255;
1867 colors2
[i
].red
= xcolor
.red
>> 8;
1868 colors2
[i
].green
= xcolor
.green
>> 8;
1869 colors2
[i
].blue
= xcolor
.blue
>> 8;
1871 elem
= PLGetArrayElement(pl
, 6);
1872 if (!elem
|| !PLIsString(elem
))
1874 val
= PLGetString(elem
);
1877 texture
= (WTexture
*)wTextureMakeIGradient(scr
, th1
, colors1
,
1880 } else if (strcasecmp(val
, "mhgradient")==0
1881 || strcasecmp(val
, "mvgradient")==0
1882 || strcasecmp(val
, "mdgradient")==0) {
1889 wwarning(_("too few arguments in multicolor gradient specification"));
1893 if (val
[1]=='h' || val
[1]=='H')
1894 type
= WTEX_MHGRADIENT
;
1895 else if (val
[1]=='v' || val
[1]=='V')
1896 type
= WTEX_MVGRADIENT
;
1898 type
= WTEX_MDGRADIENT
;
1902 colors
= wmalloc(sizeof(RColor
*)*(count
+1));
1904 for (i
=0; i
<count
; i
++) {
1905 elem
= PLGetArrayElement(pl
, i
+1);
1906 if (!elem
|| !PLIsString(elem
)) {
1907 for (--i
; i
>=0; --i
) {
1913 val
= PLGetString(elem
);
1915 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1916 wwarning(_("\"%s\" is not a valid color name"), val
);
1917 for (--i
; i
>=0; --i
) {
1923 colors
[i
] = wmalloc(sizeof(RColor
));
1924 colors
[i
]->red
= color
.red
>> 8;
1925 colors
[i
]->green
= color
.green
>> 8;
1926 colors
[i
]->blue
= color
.blue
>> 8;
1931 texture
= (WTexture
*)wTextureMakeMGradient(scr
, type
, colors
);
1932 } else if (strcasecmp(val
, "spixmap")==0 ||
1933 strcasecmp(val
, "cpixmap")==0 ||
1934 strcasecmp(val
, "tpixmap")==0) {
1941 if (val
[0] == 's' || val
[0] == 'S')
1943 else if (val
[0] == 'c' || val
[0] == 'C')
1949 elem
= PLGetArrayElement(pl
, 2);
1950 if (!elem
|| !PLIsString(elem
)) {
1953 val
= PLGetString(elem
);
1955 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1956 wwarning(_("\"%s\" is not a valid color name"), val
);
1961 elem
= PLGetArrayElement(pl
, 1);
1962 if (!elem
|| !PLIsString(elem
))
1964 val
= PLGetString(elem
);
1966 texture
= (WTexture
*)wTextureMakePixmap(scr
, type
, val
, &color
);
1967 } else if (strcasecmp(val
, "thgradient")==0
1968 || strcasecmp(val
, "tvgradient")==0
1969 || strcasecmp(val
, "tdgradient")==0) {
1970 RColor color1
, color2
;
1975 if (val
[1]=='h' || val
[1]=='H')
1976 style
= WTEX_THGRADIENT
;
1977 else if (val
[1]=='v' || val
[1]=='V')
1978 style
= WTEX_TVGRADIENT
;
1980 style
= WTEX_TDGRADIENT
;
1983 wwarning(_("bad number of arguments in textured gradient specification"));
1987 /* get from color */
1988 elem
= PLGetArrayElement(pl
, 3);
1989 if (!elem
|| !PLIsString(elem
))
1991 val
= PLGetString(elem
);
1993 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1994 wwarning(_("\"%s\" is not a valid color name"), val
);
1998 color1
.red
= xcolor
.red
>> 8;
1999 color1
.green
= xcolor
.green
>> 8;
2000 color1
.blue
= xcolor
.blue
>> 8;
2003 elem
= PLGetArrayElement(pl
, 4);
2004 if (!elem
|| !PLIsString(elem
)) {
2007 val
= PLGetString(elem
);
2009 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
2010 wwarning(_("\"%s\" is not a valid color name"), val
);
2014 color2
.red
= xcolor
.red
>> 8;
2015 color2
.green
= xcolor
.green
>> 8;
2016 color2
.blue
= xcolor
.blue
>> 8;
2019 elem
= PLGetArrayElement(pl
, 2);
2020 if (!elem
|| !PLIsString(elem
))
2023 val
= PLGetString(elem
);
2025 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
2026 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
2031 elem
= PLGetArrayElement(pl
, 1);
2032 if (!elem
|| !PLIsString(elem
))
2034 val
= PLGetString(elem
);
2036 texture
= (WTexture
*)wTextureMakeTGradient(scr
, style
, &color1
, &color2
,
2039 #ifdef TEXTURE_PLUGIN
2040 else if (strcasecmp(val
, "function")==0) {
2041 WTexFunction
*function
;
2042 void (*initFunc
) (Display
*, Colormap
);
2043 char *lib
, *func
, **argv
;
2049 /* get the library name */
2050 elem
= PLGetArrayElement(pl
, 1);
2051 if (!elem
|| !PLIsString(elem
)) {
2054 lib
= PLGetString(elem
);
2056 /* get the function name */
2057 elem
= PLGetArrayElement(pl
, 2);
2058 if (!elem
|| !PLIsString(elem
)) {
2061 func
= PLGetString(elem
);
2064 argv
= (char **)wmalloc(argc
* sizeof(char *));
2066 /* get the parameters */
2067 argv
[0] = wstrdup(func
);
2068 for (i
= 0; i
< argc
- 1; i
++) {
2069 elem
= PLGetArrayElement(pl
, 3 + i
);
2070 if (!elem
|| !PLIsString(elem
)) {
2075 argv
[i
+1] = wstrdup(PLGetString(elem
));
2078 function
= wTextureMakeFunction(scr
, lib
, func
, argc
, argv
);
2082 initFunc
= dlsym(function
->handle
, "initWindowMaker");
2084 initFunc(dpy
, scr
->w_colormap
);
2086 wwarning(_("could not initialize library %s"), lib
);
2089 wwarning(_("could not find function %s::%s"), lib
, func
);
2091 #endif /* HAVE_DLFCN_H */
2092 texture
= (WTexture
*)function
;
2094 #endif /* TEXTURE_PLUGIN */
2096 wwarning(_("invalid texture type %s"), val
);
2105 getTexture(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2108 static WTexture
*texture
;
2112 if (!PLIsArray(value
)) {
2113 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2114 entry
->key
, "Texture");
2116 value
= entry
->plvalue
;
2118 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2124 if (strcmp(entry
->key
, "WidgetColor")==0 && !changed
) {
2127 pl
= PLGetArrayElement(value
, 0);
2128 if (!pl
|| !PLIsString(pl
) || !PLGetString(pl
)
2129 || strcasecmp(PLGetString(pl
), "solid")!=0) {
2130 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2131 entry
->key
, "Solid Texture");
2133 value
= entry
->plvalue
;
2135 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2140 texture
= parse_texture(scr
, value
);
2143 wwarning(_("Error in texture specification for key \"%s\""),
2146 value
= entry
->plvalue
;
2148 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2158 *(WTexture
**)addr
= texture
;
2165 #ifdef DRAWSTRING_PLUGIN
2167 getTextRenderer(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
2168 void *addr
, void **ret
)
2171 char *val
, *lib
, *func
, **argv
;
2174 if (strcmp(entry
->key
, "FTitleColor")==0) {
2175 wPluginDestroyFunction(scr
->drawstring_func
[changed
= W_STRING_FTITLE
]);
2176 scr
->drawstring_func
[W_STRING_FTITLE
] = NULL
;
2177 } else if (strcmp(entry
->key
, "UTitleColor")==0) {
2178 wPluginDestroyFunction(scr
->drawstring_func
[changed
= W_STRING_UTITLE
]);
2179 scr
->drawstring_func
[W_STRING_UTITLE
] = NULL
;
2180 } else if (strcmp(entry
->key
, "PTitleColor")==0) {
2181 wPluginDestroyFunction(scr
->drawstring_func
[changed
= W_STRING_PTITLE
]);
2182 scr
->drawstring_func
[W_STRING_PTITLE
] = NULL
;
2183 } else if (strcmp(entry
->key
, "MenuTitleColor")==0) {
2184 wPluginDestroyFunction(scr
->drawstring_func
[changed
= W_STRING_MTITLE
]);
2185 scr
->drawstring_func
[W_STRING_MTITLE
] = NULL
;
2186 } else if (strcmp(entry
->key
, "MenuPluginColor")==0) {
2187 wPluginDestroyFunction(scr
->drawstring_func
[changed
= W_STRING_MTEXT
]);
2188 scr
->drawstring_func
[W_STRING_MTEXT
] = NULL
;
2191 if (PLIsArray(value
)) {
2192 if ((argc
= PLGetNumberOfElements(value
)) < 4) return False
;
2194 argv
= (char **)wmalloc(argc
* sizeof(char *));
2196 elem
= PLGetArrayElement(value
,0);
2197 if (!elem
|| !PLIsString(elem
)) return False
;
2198 val
= PLGetString(elem
);
2199 if (strcasecmp(val
, "function")==0) {
2200 elem
= PLGetArrayElement(value
, 1); /* library name */
2201 if (!elem
|| !PLIsString(elem
)) return False
;
2202 lib
= PLGetString(elem
);
2203 elem
= PLGetArrayElement(value
, 2); /* function name */
2204 if (!elem
|| !PLIsString(elem
)) return False
;
2205 func
= PLGetString(elem
);
2206 scr
->drawstring_func
[changed
] = wPluginCreateFunction (W_FUNCTION_DRAWSTRING
,
2207 lib
, "initDrawString", func
, NULL
, value
,
2208 wPluginPackInitData(3, dpy
, scr
->w_colormap
,"-DATA-"));
2211 return getColor(scr
, entry
, PLGetArrayElement(value
,3), addr
, ret
);
2212 } else if (PLIsString(value
)) {
2213 return getColor(scr
, entry
, value
, addr
, ret
);
2218 #endif /* DRAWSTRING_PLUGIN */
2223 getWSBackground(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
2224 void *addr
, void **ret
)
2232 if (!PLIsArray(value
)) {
2233 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2234 "WorkspaceBack", "Texture or None");
2236 value
= entry
->plvalue
;
2238 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2244 /* only do basic error checking and verify for None texture */
2246 nelem
= PLGetNumberOfElements(value
);
2248 elem
= PLGetArrayElement(value
, 0);
2249 if (!elem
|| !PLIsString(elem
)) {
2250 wwarning(_("Wrong type for workspace background. Should be a texture type."));
2252 value
= entry
->plvalue
;
2254 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2259 val
= PLGetString(elem
);
2261 if (strcasecmp(val
, "None")==0)
2264 *ret
= PLRetain(value
);
2271 getWSSpecificBackground(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
2272 void *addr
, void **ret
)
2279 if (!PLIsArray(value
)) {
2280 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2281 "WorkspaceSpecificBack", "an array of textures");
2283 value
= entry
->plvalue
;
2285 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2291 /* only do basic error checking and verify for None texture */
2293 nelem
= PLGetNumberOfElements(value
);
2296 elem
= PLGetArrayElement(value
, nelem
);
2297 if (!elem
|| !PLIsArray(elem
)) {
2298 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2304 *ret
= PLRetain(value
);
2308 * Kluge to force wmsetbg helper to set the default background.
2309 * If the WorkspaceSpecificBack is changed once wmaker has started,
2310 * the WorkspaceBack won't be sent to the helper, unless the user
2311 * changes it's value too. So, we must force this by removing the
2312 * value from the defaults DB.
2314 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2315 proplist_t key
= PLMakeString("WorkspaceBack");
2317 PLRemoveDictionaryEntry(WDWindowMaker
->dictionary
, key
);
2327 getFont(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2330 static WMFont
*font
;
2333 GET_STRING_OR_DEFAULT("Font", val
);
2335 font
= WMCreateFont(scr
->wmscreen
, val
);
2337 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2340 wfatal(_("could not load any usable font!!!"));
2347 /* can't assign font value outside update function */
2348 wassertrv(addr
== NULL
, True
);
2355 getColor(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2358 static XColor color
;
2362 GET_STRING_OR_DEFAULT("Color", val
);
2366 if (!wGetColor(scr
, val
, &color
)) {
2367 wwarning(_("could not get color for key \"%s\""),
2369 if (second_pass
==0) {
2370 val
= PLGetString(entry
->plvalue
);
2372 wwarning(_("using default \"%s\" instead"), val
);
2384 *(unsigned long*)addr = pixel;
2393 getKeybind(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2396 static WShortKey shortcut
;
2403 GET_STRING_OR_DEFAULT("Key spec", val
);
2405 if (!val
|| strcasecmp(val
, "NONE")==0) {
2406 shortcut
.keycode
= 0;
2407 shortcut
.modifier
= 0;
2418 shortcut
.modifier
= 0;
2419 while ((k
= strchr(b
, '+'))!=NULL
) {
2423 mod
= wXModifierFromKey(b
);
2425 wwarning(_("%s:invalid key modifier \"%s\""), entry
->key
, b
);
2428 shortcut
.modifier
|= mod
;
2434 ksym
= XStringToKeysym(b
);
2436 if (ksym
==NoSymbol
) {
2437 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
,
2442 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2443 if (shortcut
.keycode
==0) {
2444 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2456 getModMask(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2459 static unsigned int mask
;
2462 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2467 mask
= wXModifierFromKey(str
);
2469 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2475 *(unsigned int*)addr
= mask
;
2486 getRImages(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
2487 void *addr
, void **ret
)
2495 GET_STRING_OR_DEFAULT("Image File Path", str
);
2499 image
= RLoadImage(scr
->rcontext
, str
, 0);
2501 wwarning(_("could not load image in option %s: %s"), entry
->key
,
2502 RMessageForError(RErrorCode
));
2506 if (*(RImage
**)addr
) {
2507 RDestroyImage(*(RImage
**)addr
);
2510 *(RImage
**)addr
= image
;
2512 assert(ret
== NULL
);
2515 *(RImage**)ret = image;
2522 #ifdef DEFINABLE_CURSOR
2524 # include <X11/cursorfont.h>
2531 #define CURSOR_ID_NONE (XC_num_glyphs)
2533 static WCursorLookup cursor_table
[] =
2535 { "X_cursor", XC_X_cursor
},
2536 { "arrow", XC_arrow
},
2537 { "based_arrow_down", XC_based_arrow_down
},
2538 { "based_arrow_up", XC_based_arrow_up
},
2539 { "boat", XC_boat
},
2540 { "bogosity", XC_bogosity
},
2541 { "bottom_left_corner", XC_bottom_left_corner
},
2542 { "bottom_right_corner", XC_bottom_right_corner
},
2543 { "bottom_side", XC_bottom_side
},
2544 { "bottom_tee", XC_bottom_tee
},
2545 { "box_spiral", XC_box_spiral
},
2546 { "center_ptr", XC_center_ptr
},
2547 { "circle", XC_circle
},
2548 { "clock", XC_clock
},
2549 { "coffee_mug", XC_coffee_mug
},
2550 { "cross", XC_cross
},
2551 { "cross_reverse", XC_cross_reverse
},
2552 { "crosshair", XC_crosshair
},
2553 { "diamond_cross", XC_diamond_cross
},
2555 { "dotbox", XC_dotbox
},
2556 { "double_arrow", XC_double_arrow
},
2557 { "draft_large", XC_draft_large
},
2558 { "draft_small", XC_draft_small
},
2559 { "draped_box", XC_draped_box
},
2560 { "exchange", XC_exchange
},
2561 { "fleur", XC_fleur
},
2562 { "gobbler", XC_gobbler
},
2563 { "gumby", XC_gumby
},
2564 { "hand1", XC_hand1
},
2565 { "hand2", XC_hand2
},
2566 { "heart", XC_heart
},
2567 { "icon", XC_icon
},
2568 { "iron_cross", XC_iron_cross
},
2569 { "left_ptr", XC_left_ptr
},
2570 { "left_side", XC_left_side
},
2571 { "left_tee", XC_left_tee
},
2572 { "leftbutton", XC_leftbutton
},
2573 { "ll_angle", XC_ll_angle
},
2574 { "lr_angle", XC_lr_angle
},
2576 { "middlebutton", XC_middlebutton
},
2577 { "mouse", XC_mouse
},
2578 { "pencil", XC_pencil
},
2579 { "pirate", XC_pirate
},
2580 { "plus", XC_plus
},
2581 { "question_arrow", XC_question_arrow
},
2582 { "right_ptr", XC_right_ptr
},
2583 { "right_side", XC_right_side
},
2584 { "right_tee", XC_right_tee
},
2585 { "rightbutton", XC_rightbutton
},
2586 { "rtl_logo", XC_rtl_logo
},
2587 { "sailboat", XC_sailboat
},
2588 { "sb_down_arrow", XC_sb_down_arrow
},
2589 { "sb_h_double_arrow", XC_sb_h_double_arrow
},
2590 { "sb_left_arrow", XC_sb_left_arrow
},
2591 { "sb_right_arrow", XC_sb_right_arrow
},
2592 { "sb_up_arrow", XC_sb_up_arrow
},
2593 { "sb_v_double_arrow", XC_sb_v_double_arrow
},
2594 { "shuttle", XC_shuttle
},
2595 { "sizing", XC_sizing
},
2596 { "spider", XC_spider
},
2597 { "spraycan", XC_spraycan
},
2598 { "star", XC_star
},
2599 { "target", XC_target
},
2600 { "tcross", XC_tcross
},
2601 { "top_left_arrow", XC_top_left_arrow
},
2602 { "top_left_corner", XC_top_left_corner
},
2603 { "top_right_corner", XC_top_right_corner
},
2604 { "top_side", XC_top_side
},
2605 { "top_tee", XC_top_tee
},
2606 { "trek", XC_trek
},
2607 { "ul_angle", XC_ul_angle
},
2608 { "umbrella", XC_umbrella
},
2609 { "ur_angle", XC_ur_angle
},
2610 { "watch", XC_watch
},
2611 { "xterm", XC_xterm
},
2612 { NULL
, CURSOR_ID_NONE
}
2616 check_bitmap_status(int status
, char *filename
, Pixmap bitmap
)
2619 case BitmapOpenFailed
:
2620 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2622 case BitmapFileInvalid
:
2623 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2625 case BitmapNoMemory
:
2626 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2629 XFreePixmap(dpy
, bitmap
);
2636 * (builtin, <cursor_name>)
2637 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2640 parse_cursor(WScreen
*scr
, proplist_t pl
, Cursor
*cursor
)
2647 nelem
= PLGetNumberOfElements(pl
);
2651 elem
= PLGetArrayElement(pl
, 0);
2652 if (!elem
|| !PLIsString(elem
)) {
2655 val
= PLGetString(elem
);
2657 if (0 == strcasecmp(val
, "none")) {
2660 } else if (0 == strcasecmp(val
, "builtin")) {
2662 int cursor_id
= CURSOR_ID_NONE
;
2665 wwarning(_("bad number of arguments in cursor specification"));
2668 elem
= PLGetArrayElement(pl
, 1);
2669 if (!elem
|| !PLIsString(elem
)) {
2672 val
= PLGetString(elem
);
2674 for (i
= 0; NULL
!= cursor_table
[i
].name
; i
++) {
2675 if (0 == strcasecmp(val
, cursor_table
[i
].name
)) {
2676 cursor_id
= cursor_table
[i
].id
;
2680 if (CURSOR_ID_NONE
== cursor_id
) {
2681 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2683 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2686 } else if (0 == strcasecmp(val
, "bitmap")) {
2698 wwarning(_("bad number of arguments in cursor specification"));
2701 elem
= PLGetArrayElement(pl
, 1);
2702 if (!elem
|| !PLIsString(elem
)) {
2705 val
= PLGetString(elem
);
2706 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2708 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2711 elem
= PLGetArrayElement(pl
, 2);
2712 if (!elem
|| !PLIsString(elem
)) {
2716 val
= PLGetString(elem
);
2717 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2720 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2723 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
,
2725 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
,
2727 if ((BitmapSuccess
== bitmap_status
) &&
2728 (BitmapSuccess
== mask_status
)) {
2729 fg
.pixel
= scr
->black_pixel
;
2730 bg
.pixel
= scr
->white_pixel
;
2731 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2732 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2733 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2736 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2737 check_bitmap_status(mask_status
, mask_name
, mask
);
2746 getCursor(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2749 static Cursor cursor
;
2754 if (!PLIsArray(value
)) {
2755 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2756 entry
->key
, "cursor specification");
2758 value
= entry
->plvalue
;
2760 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2765 status
= parse_cursor(scr
, value
, &cursor
);
2767 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2769 value
= entry
->plvalue
;
2771 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2780 *(Cursor
*)addr
= cursor
;
2784 #undef CURSOR_ID_NONE
2786 #endif /* DEFINABLE_CURSOR */
2789 /* ---------------- value setting functions --------------- */
2791 setJustify(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
2793 return REFRESH_WINDOW_TITLE_COLOR
;
2797 setClearance(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
2799 return REFRESH_WINDOW_FONT
|REFRESH_BUTTON_IMAGES
|REFRESH_MENU_TITLE_FONT
|REFRESH_MENU_FONT
;
2803 setIfDockPresent(WScreen
*scr
, WDefaultEntry
*entry
, char *flag
, long which
)
2807 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2810 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2820 setStickyIcons(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
2822 if (scr
->workspaces
) {
2823 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2824 wArrangeIcons(scr
, False
);
2831 setPositive(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
2843 setIconTile(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
2849 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2850 wPreferences
.icon_size
,
2851 ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2852 ? WREL_ICON
: WREL_FLAT
);
2854 wwarning(_("could not render texture for icon background"));
2856 wTextureDestroy(scr
, *texture
);
2859 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2861 if (scr
->icon_tile
) {
2863 RDestroyImage(scr
->icon_tile
);
2864 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2867 scr
->icon_tile
= img
;
2870 /* put the icon in the noticeboard hint */
2871 PropSetIconTileHint(scr
, img
);
2874 if (!wPreferences
.flags
.noclip
) {
2875 if (scr
->clip_tile
) {
2876 RDestroyImage(scr
->clip_tile
);
2878 scr
->clip_tile
= wClipMakeTile(scr
, img
);
2881 scr
->icon_tile_pixmap
= pixmap
;
2883 if (scr
->def_icon_pixmap
) {
2884 XFreePixmap(dpy
, scr
->def_icon_pixmap
);
2885 scr
->def_icon_pixmap
= None
;
2887 if (scr
->def_ticon_pixmap
) {
2888 XFreePixmap(dpy
, scr
->def_ticon_pixmap
);
2889 scr
->def_ticon_pixmap
= None
;
2892 if (scr
->icon_back_texture
) {
2893 wTextureDestroy(scr
, (WTexture
*)scr
->icon_back_texture
);
2895 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2897 if (scr
->clip_balloon
)
2898 XSetWindowBackground(dpy
, scr
->clip_balloon
,
2899 (*texture
)->any
.color
.pixel
);
2902 * Free the texture as nobody else will use it, nor refer to it.
2905 wTextureDestroy(scr
, *texture
);
2907 return (reset
? REFRESH_ICON_TILE
: 0);
2913 setWinTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2915 if (scr
->title_font
) {
2916 WMReleaseFont(scr
->title_font
);
2918 scr
->title_font
= font
;
2920 return REFRESH_WINDOW_FONT
|REFRESH_BUTTON_IMAGES
;
2925 setMenuTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2927 if (scr
->menu_title_font
) {
2928 WMReleaseFont(scr
->menu_title_font
);
2931 scr
->menu_title_font
= font
;
2933 return REFRESH_MENU_TITLE_FONT
;
2938 setMenuTextFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2940 if (scr
->menu_entry_font
) {
2941 WMReleaseFont(scr
->menu_entry_font
);
2943 scr
->menu_entry_font
= font
;
2945 return REFRESH_MENU_FONT
;
2951 setIconTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2953 if (scr
->icon_title_font
) {
2954 WMReleaseFont(scr
->icon_title_font
);
2957 scr
->icon_title_font
= font
;
2959 return REFRESH_ICON_FONT
;
2964 setClipTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2966 if (scr
->clip_title_font
) {
2967 WMReleaseFont(scr
->clip_title_font
);
2970 scr
->clip_title_font
= font
;
2972 return REFRESH_ICON_FONT
;
2977 setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2979 if (scr
->workspace_name_font
) {
2980 WMReleaseFont(scr
->workspace_name_font
);
2983 scr
->workspace_name_font
= font
;
2990 setHightlight(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
2992 if (scr
->select_pixel
!=scr
->white_pixel
&&
2993 scr
->select_pixel
!=scr
->black_pixel
) {
2994 wFreeColor(scr
, scr
->select_pixel
);
2997 scr
->select_pixel
= color
->pixel
;
2999 return REFRESH_MENU_COLOR
;
3004 setHightlightText(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3006 if (scr
->select_text_pixel
!=scr
->white_pixel
&&
3007 scr
->select_text_pixel
!=scr
->black_pixel
) {
3008 wFreeColor(scr
, scr
->select_text_pixel
);
3011 scr
->select_text_pixel
= color
->pixel
;
3013 return REFRESH_MENU_COLOR
;
3018 setClipTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3020 if (scr
->clip_title_pixel
[index
]!=scr
->white_pixel
&&
3021 scr
->clip_title_pixel
[index
]!=scr
->black_pixel
) {
3022 wFreeColor(scr
, scr
->clip_title_pixel
[index
]);
3024 scr
->clip_title_pixel
[index
] = color
->pixel
;
3026 #ifdef GRADIENT_CLIP_ARROW
3027 if (index
== CLIP_NORMAL
) {
3029 RColor color1
, color2
;
3030 int pt
= CLIP_BUTTON_SIZE
*wPreferences
.icon_size
/64;
3031 int as
= pt
- 15; /* 15 = 5+5+5 */
3033 FREE_PIXMAP(scr
->clip_arrow_gradient
);
3035 color1
.red
= (color
->red
>> 8)*6/10;
3036 color1
.green
= (color
->green
>> 8)*6/10;
3037 color1
.blue
= (color
->blue
>> 8)*6/10;
3039 color2
.red
= WMIN((color
->red
>> 8)*20/10, 255);
3040 color2
.green
= WMIN((color
->green
>> 8)*20/10, 255);
3041 color2
.blue
= WMIN((color
->blue
>> 8)*20/10, 255);
3043 image
= RRenderGradient(as
+1, as
+1, &color1
, &color2
, RDiagonalGradient
);
3044 RConvertImage(scr
->rcontext
, image
, &scr
->clip_arrow_gradient
);
3045 RDestroyImage(image
);
3047 #endif /* GRADIENT_CLIP_ARROW */
3049 return REFRESH_ICON_TITLE_COLOR
;
3054 setWTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3056 if (scr
->window_title_pixel
[index
]!=scr
->white_pixel
&&
3057 scr
->window_title_pixel
[index
]!=scr
->black_pixel
) {
3058 wFreeColor(scr
, scr
->window_title_pixel
[index
]);
3061 scr
->window_title_pixel
[index
] = color
->pixel
;
3063 if (index
== WS_UNFOCUSED
)
3064 XSetForeground(dpy
, scr
->info_text_gc
, color
->pixel
);
3066 return REFRESH_WINDOW_TITLE_COLOR
;
3071 setMenuTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3073 if (scr
->menu_title_pixel
[0]!=scr
->white_pixel
&&
3074 scr
->menu_title_pixel
[0]!=scr
->black_pixel
) {
3075 #ifdef DRAWSTRING_PLUGIN
3076 if(!scr
->drawstring_func
[W_STRING_MTITLE
])
3078 wFreeColor(scr
, scr
->menu_title_pixel
[0]);
3081 scr
->menu_title_pixel
[0] = color
->pixel
;
3082 XSetForeground(dpy
, scr
->menu_title_gc
, color
->pixel
);
3084 return REFRESH_MENU_TITLE_COLOR
;
3089 setMenuTextColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3092 #define gcm (GCForeground|GCBackground|GCFillStyle)
3094 if (scr
->mtext_pixel
!=scr
->white_pixel
&&
3095 scr
->mtext_pixel
!=scr
->black_pixel
) {
3096 wFreeColor(scr
, scr
->mtext_pixel
);
3099 scr
->mtext_pixel
= color
->pixel
;
3101 XSetForeground(dpy
, scr
->menu_entry_gc
, color
->pixel
);
3104 if (scr
->dtext_pixel
== scr
->mtext_pixel
) {
3105 gcv
.foreground
= scr
->white_pixel
;
3106 gcv
.background
= scr
->black_pixel
;
3107 gcv
.fill_style
= FillStippled
;
3109 gcv
.foreground
= scr
->dtext_pixel
;
3110 gcv
.fill_style
= FillSolid
;
3112 XChangeGC(dpy
, scr
->disabled_menu_entry_gc
, gcm
, &gcv
);
3114 return REFRESH_MENU_COLOR
;
3120 setMenuDisabledColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3123 #define gcm (GCForeground|GCBackground|GCFillStyle)
3125 if (scr
->dtext_pixel
!=scr
->white_pixel
&&
3126 scr
->dtext_pixel
!=scr
->black_pixel
) {
3127 wFreeColor(scr
, scr
->dtext_pixel
);
3130 scr
->dtext_pixel
= color
->pixel
;
3132 if (scr
->dtext_pixel
== scr
->mtext_pixel
) {
3133 gcv
.foreground
= scr
->white_pixel
;
3134 gcv
.background
= scr
->black_pixel
;
3135 gcv
.fill_style
= FillStippled
;
3137 gcv
.foreground
= scr
->dtext_pixel
;
3138 gcv
.fill_style
= FillSolid
;
3140 XChangeGC(dpy
, scr
->disabled_menu_entry_gc
, gcm
, &gcv
);
3142 return REFRESH_MENU_COLOR
;
3147 setIconTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3149 XSetForeground(dpy
, scr
->icon_title_gc
, color
->pixel
);
3151 return REFRESH_ICON_TITLE_COLOR
;
3156 setIconTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3158 if (scr
->icon_title_texture
) {
3159 wTextureDestroy(scr
, (WTexture
*)scr
->icon_title_texture
);
3161 XQueryColor (dpy
, scr
->w_colormap
, color
);
3162 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
3164 return REFRESH_ICON_TITLE_BACK
;
3169 trackDeadProcess(pid_t pid
, unsigned char status
, WScreen
*scr
)
3171 close(scr
->helper_fd
);
3173 scr
->helper_pid
= 0;
3174 scr
->flags
.backimage_helper_launched
= 0;
3179 setWorkspaceSpecificBack(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
3186 if (scr
->flags
.backimage_helper_launched
) {
3187 if (PLGetNumberOfElements(value
)==0) {
3188 SendHelperMessage(scr
, 'C', 0, NULL
);
3189 SendHelperMessage(scr
, 'K', 0, NULL
);
3198 if (PLGetNumberOfElements(value
) == 0)
3201 if (pipe(filedes
) < 0) {
3202 wsyserror("pipe() failed:can't set workspace specific background image");
3210 wsyserror("fork() failed:can't set workspace specific background image");
3211 if (close(filedes
[0]) < 0)
3212 wsyserror("could not close pipe");
3213 if (close(filedes
[1]) < 0)
3214 wsyserror("could not close pipe");
3216 } else if (pid
== 0) {
3217 SetupEnvironment(scr
);
3220 wsyserror("could not close pipe");
3221 if (dup(filedes
[0]) < 0) {
3222 wsyserror("dup() failed:can't set workspace specific background image");
3224 if (wPreferences
.smooth_workspace_back
)
3225 execlp("wmsetbg", "wmsetbg", "-helper", "-S", "-d", NULL
);
3227 execlp("wmsetbg", "wmsetbg", "-helper", "-d", NULL
);
3228 wsyserror("could not execute wmsetbg");
3232 if (fcntl(filedes
[0], F_SETFD
, FD_CLOEXEC
) < 0) {
3233 wsyserror("error setting close-on-exec flag");
3235 if (fcntl(filedes
[1], F_SETFD
, FD_CLOEXEC
) < 0) {
3236 wsyserror("error setting close-on-exec flag");
3239 scr
->helper_fd
= filedes
[1];
3240 scr
->helper_pid
= pid
;
3241 scr
->flags
.backimage_helper_launched
= 1;
3243 wAddDeathHandler(pid
, (WDeathHandler
*)trackDeadProcess
, scr
);
3245 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3250 for (i
= 0; i
< PLGetNumberOfElements(value
); i
++) {
3251 val
= PLGetArrayElement(value
, i
);
3252 if (val
&& PLIsArray(val
) && PLGetNumberOfElements(val
)>0) {
3253 str
= PLGetDescription(val
);
3255 SendHelperMessage(scr
, 'S', i
+1, str
);
3259 SendHelperMessage(scr
, 'U', i
+1, NULL
);
3270 setWorkspaceBack(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
3273 if (scr
->flags
.backimage_helper_launched
) {
3276 if (PLGetNumberOfElements(value
)==0) {
3277 SendHelperMessage(scr
, 'U', 0, NULL
);
3279 /* set the default workspace background to this one */
3280 str
= PLGetDescription(value
);
3282 SendHelperMessage(scr
, 'S', 0, str
);
3284 SendHelperMessage(scr
, 'C', scr
->current_workspace
+1, NULL
);
3286 SendHelperMessage(scr
, 'U', 0, NULL
);
3289 } else if (PLGetNumberOfElements(value
) > 0) {
3293 SetupEnvironment(scr
);
3294 text
= PLGetDescription(value
);
3295 command
= wmalloc(strlen(text
)+40);
3296 if (wPreferences
.smooth_workspace_back
)
3297 sprintf(command
, "wmsetbg -d -S -p '%s' &", text
);
3299 sprintf(command
, "wmsetbg -d -p '%s' &", text
);
3311 setWidgetColor(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3313 if (scr
->widget_texture
) {
3314 wTextureDestroy(scr
, (WTexture
*)scr
->widget_texture
);
3316 scr
->widget_texture
= *(WTexSolid
**)texture
;
3323 setFTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3325 if (scr
->window_title_texture
[WS_FOCUSED
]) {
3326 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3328 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3330 return REFRESH_WINDOW_TEXTURES
;
3335 setPTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3337 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
3338 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3340 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3342 return REFRESH_WINDOW_TEXTURES
;
3347 setUTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3349 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
3350 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3352 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3354 return REFRESH_WINDOW_TEXTURES
;
3359 setResizebarBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3361 if (scr
->resizebar_texture
[0]) {
3362 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3364 scr
->resizebar_texture
[0] = *texture
;
3366 return REFRESH_WINDOW_TEXTURES
;
3371 setMenuTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3373 if (scr
->menu_title_texture
[0]) {
3374 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3376 scr
->menu_title_texture
[0] = *texture
;
3378 return REFRESH_MENU_TITLE_TEXTURE
;
3383 setMenuTextBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3385 if (scr
->menu_item_texture
) {
3386 wTextureDestroy(scr
, scr
->menu_item_texture
);
3387 wTextureDestroy(scr
, (WTexture
*)scr
->menu_item_auxtexture
);
3389 scr
->menu_item_texture
= *texture
;
3391 scr
->menu_item_auxtexture
3392 = wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3394 return REFRESH_MENU_TEXTURE
;
3399 setKeyGrab(WScreen
*scr
, WDefaultEntry
*entry
, WShortKey
*shortcut
, long index
)
3402 wKeyBindings
[index
] = *shortcut
;
3404 wwin
= scr
->focused_window
;
3406 while (wwin
!=NULL
) {
3407 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3409 if (!WFLAGP(wwin
, no_bind_keys
)) {
3410 wWindowSetKeyGrabs(wwin
);
3420 setIconPosition(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
3422 wArrangeIcons(scr
, True
);
3429 updateUsableArea(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
3431 wScreenUpdateUsableArea(scr
);
3438 setMenuStyle(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
3440 return REFRESH_MENU_TEXTURE
;
3446 setButtonImages(WScreen *scr, WDefaultEntry *entry, int *value, void *foo)
3448 return REFRESH_BUTTON_IMAGES;
3454 * Need access to the double click variables, so that all widgets in
3455 * wmaker panels will have the same dbl-click values.
3456 * TODO: figure a better way of dealing with it.
3461 setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
3463 extern _WINGsConfiguration WINGsConfiguration
;
3468 WINGsConfiguration
.doubleClickDelay
= *value
;
3476 setMultiByte(WScreen
*scr
, WDefaultEntry
*entry
, char *value
, void *foo
)
3478 extern _WINGsConfiguration WINGsConfiguration
;
3480 WINGsConfiguration
.useMultiByte
= *value
;
3486 #ifdef DEFINABLE_CURSOR
3488 setCursor(WScreen
*scr
, WDefaultEntry
*entry
, Cursor
*cursor
, long index
)
3490 if (None
!= wCursor
[index
])
3492 XFreeCursor(dpy
, wCursor
[index
]);
3495 wCursor
[index
] = *cursor
;
3497 if ((WCUR_ROOT
== index
) && (None
!= *cursor
))
3499 XDefineCursor(dpy
, scr
->root_win
, *cursor
);
3504 #endif /* DEFINABLE_CURSOR*/