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();
186 static int setMultiByte();
188 static int updateUsableArea();
190 #ifdef DEFINABLE_CURSOR
191 extern Cursor wCursor
[WCUR_LAST
];
192 static int getCursor();
193 static int setCursor();
198 * Tables to convert strings to enumeration values.
199 * Values stored are char
203 /* WARNING: sum of length of all value strings must not exceed
205 #define TOTAL_VALUES_LENGTH 80
210 #define REFRESH_WINDOW_TEXTURES (1<<0)
211 #define REFRESH_MENU_TEXTURE (1<<1)
212 #define REFRESH_MENU_FONT (1<<2)
213 #define REFRESH_MENU_COLOR (1<<3)
214 #define REFRESH_MENU_TITLE_TEXTURE (1<<4)
215 #define REFRESH_MENU_TITLE_FONT (1<<5)
216 #define REFRESH_MENU_TITLE_COLOR (1<<6)
217 #define REFRESH_WINDOW_TITLE_COLOR (1<<7)
218 #define REFRESH_WINDOW_FONT (1<<8)
219 #define REFRESH_ICON_TILE (1<<9)
220 #define REFRESH_ICON_FONT (1<<10)
221 #define REFRESH_WORKSPACE_BACK (1<<11)
223 #define REFRESH_BUTTON_IMAGES (1<<12)
225 #define REFRESH_ICON_TITLE_COLOR (1<<13)
226 #define REFRESH_ICON_TITLE_BACK (1<<14)
230 static WOptionEnumeration seFocusModes
[] = {
231 {"Manual", WKF_CLICK
, 0}, {"ClickToFocus", WKF_CLICK
, 1},
232 {"Auto", WKF_POINTER
, 0}, {"FocusFollowMouse", WKF_POINTER
, 1},
233 {"Sloppy", WKF_SLOPPY
, 0}, {"SemiAuto", WKF_SLOPPY
, 1},
237 static WOptionEnumeration seColormapModes
[] = {
238 {"Manual", WKF_CLICK
, 0}, {"ClickToFocus", WKF_CLICK
, 1},
239 {"Auto", WKF_POINTER
, 0}, {"FocusFollowMouse", WKF_POINTER
, 1},
243 static WOptionEnumeration sePlacements
[] = {
244 {"Auto", WPM_AUTO
, 0},
245 {"Smart", WPM_SMART
, 0},
246 {"Cascade", WPM_CASCADE
, 0},
247 {"Random", WPM_RANDOM
, 0},
248 {"Manual", WPM_MANUAL
, 0},
252 static WOptionEnumeration seGeomDisplays
[] = {
253 {"Center", WDIS_CENTER
, 0},
254 {"Corner", WDIS_TOPLEFT
, 0},
255 {"Floating", WDIS_FRAME_CENTER
, 0},
256 {"Line", WDIS_NEW
, 0},
260 static WOptionEnumeration seSpeeds
[] = {
261 {"UltraFast", SPEED_ULTRAFAST
, 0},
262 {"Fast", SPEED_FAST
, 0},
263 {"Medium", SPEED_MEDIUM
, 0},
264 {"Slow", SPEED_SLOW
, 0},
265 {"UltraSlow", SPEED_ULTRASLOW
, 0},
269 static WOptionEnumeration seMouseButtons
[] = {
271 {"Left", Button1
, 0}, {"Button1", Button1
, 1},
272 {"Middle", Button2
, 0}, {"Button2", Button2
, 1},
273 {"Right", Button3
, 0}, {"Button3", Button3
, 1},
274 {"Button4", Button4
, 0},
275 {"Button5", Button5
, 0},
279 static WOptionEnumeration seIconificationStyles
[] = {
280 {"Zoom", WIS_ZOOM
, 0},
281 {"Twist", WIS_TWIST
, 0},
282 {"Flip", WIS_FLIP
, 0},
283 {"None", WIS_NONE
, 0},
284 {"random", WIS_RANDOM
, 0},
288 static WOptionEnumeration seJustifications
[] = {
289 {"Left", WTJ_LEFT
, 0},
290 {"Center", WTJ_CENTER
, 0},
291 {"Right", WTJ_RIGHT
, 0},
295 static WOptionEnumeration seIconPositions
[] = {
296 {"blv", IY_BOTTOM
|IY_LEFT
|IY_VERT
, 0},
297 {"blh", IY_BOTTOM
|IY_LEFT
|IY_HORIZ
, 0},
298 {"brv", IY_BOTTOM
|IY_RIGHT
|IY_VERT
, 0},
299 {"brh", IY_BOTTOM
|IY_RIGHT
|IY_HORIZ
, 0},
300 {"tlv", IY_TOP
|IY_LEFT
|IY_VERT
, 0},
301 {"tlh", IY_TOP
|IY_LEFT
|IY_HORIZ
, 0},
302 {"trv", IY_TOP
|IY_RIGHT
|IY_VERT
, 0},
303 {"trh", IY_TOP
|IY_RIGHT
|IY_HORIZ
, 0},
307 static WOptionEnumeration seMenuStyles
[] = {
308 {"normal", MS_NORMAL
, 0},
309 {"singletexture", MS_SINGLE_TEXTURE
, 0},
310 {"flat", MS_FLAT
, 0},
315 static WOptionEnumeration seDisplayPositions
[] = {
316 {"none", WD_NONE
, 0},
317 {"center", WD_CENTER
, 0},
319 {"bottom", WD_BOTTOM
, 0},
320 {"topleft", WD_TOPLEFT
, 0},
321 {"topright", WD_TOPRIGHT
, 0},
322 {"bottomleft", WD_BOTTOMLEFT
, 0},
323 {"bottomright", WD_BOTTOMRIGHT
, 0},
327 static WOptionEnumeration seWorkspaceBorder
[] = {
328 {"None", WB_NONE
, 0},
329 {"LeftRight", WB_LEFTRIGHT
, 0},
330 {"TopBottom", WB_TOPBOTTOM
, 0},
331 {"AllDirections", WB_ALLDIRS
, 0},
337 * ALL entries in the tables bellow, NEED to have a default value
338 * defined, and this value needs to be correct.
341 /* these options will only affect the window manager on startup
343 * static defaults can't access the screen data, because it is
344 * created after these defaults are read
346 WDefaultEntry staticOptionList
[] = {
348 {"ColormapSize", "4", NULL
,
349 &wPreferences
.cmap_size
, getInt
, NULL
351 {"DisableDithering", "NO", NULL
,
352 &wPreferences
.no_dithering
, getBool
, NULL
354 /* static by laziness */
355 {"IconSize", "64", NULL
,
356 &wPreferences
.icon_size
, getInt
, NULL
358 {"ModifierKey", "Mod1", NULL
,
359 &wPreferences
.modifier_mask
, getModMask
, NULL
361 {"DisableWSMouseActions", "NO", NULL
,
362 &wPreferences
.disable_root_mouse
, getBool
, NULL
364 {"FocusMode", "manual", seFocusModes
,
365 &wPreferences
.focus_mode
, getEnum
, NULL
366 }, /* have a problem when switching from manual to sloppy without restart */
367 {"NewStyle", "NO", NULL
,
368 &wPreferences
.new_style
, getBool
, NULL
370 {"DisableDock", "NO", (void*) WM_DOCK
,
371 NULL
, getBool
, setIfDockPresent
373 {"DisableClip", "NO", (void*) WM_CLIP
,
374 NULL
, getBool
, setIfDockPresent
376 {"DisableMiniwindows", "NO", NULL
,
377 &wPreferences
.disable_miniwindows
, getBool
, NULL
380 ,{"MultiByteText", "NO", NULL
,
381 &wPreferences
.multi_byte_text
, getBool
, setMultiByte
388 WDefaultEntry optionList
[] = {
389 /* dynamic options */
390 {"IconPosition", "blh", seIconPositions
,
391 &wPreferences
.icon_yard
, getEnum
, setIconPosition
393 {"IconificationStyle", "Zoom", seIconificationStyles
,
394 &wPreferences
.iconification_style
, getEnum
, NULL
396 {"SelectWindowsMouseButton", "Left", seMouseButtons
,
397 &wPreferences
.select_button
, getEnum
, NULL
399 {"WindowListMouseButton", "Middle", seMouseButtons
,
400 &wPreferences
.windowl_button
, getEnum
, NULL
402 {"ApplicationMenuMouseButton", "Right", seMouseButtons
,
403 &wPreferences
.menu_button
, getEnum
, NULL
405 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
406 &wPreferences
.pixmap_path
, getPathList
, NULL
408 {"IconPath", DEF_ICON_PATHS
, NULL
,
409 &wPreferences
.icon_path
, getPathList
, NULL
411 {"ColormapMode", "auto", seColormapModes
,
412 &wPreferences
.colormap_mode
, getEnum
, NULL
414 {"AutoFocus", "NO", NULL
,
415 &wPreferences
.auto_focus
, getBool
, NULL
417 {"RaiseDelay", "0", NULL
,
418 &wPreferences
.raise_delay
, getInt
, NULL
420 {"WindozeCycling", "YES", NULL
,
421 &wPreferences
.windows_cycling
,getBool
, NULL
423 {"CirculateRaise", "NO", NULL
,
424 &wPreferences
.circ_raise
, getBool
, NULL
426 {"Superfluous", "NO", NULL
,
427 &wPreferences
.superfluous
, getBool
, NULL
429 {"AdvanceToNewWorkspace", "NO", NULL
,
430 &wPreferences
.ws_advance
, getBool
, NULL
432 {"CycleWorkspaces", "NO", NULL
,
433 &wPreferences
.ws_cycle
, getBool
, NULL
435 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
436 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
438 {"WorkspaceBorder", "None", seWorkspaceBorder
,
439 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
441 {"WorkspaceBorderSize", "0", NULL
,
442 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
444 #ifdef VIRTUAL_DESKTOP
445 {"VirtualEdgeThickness", "1", NULL
,
446 &wPreferences
.vedge_thickness
, getInt
, NULL
448 {"VirtualEdgeHorizonScrollSpeed", "1", NULL
,
449 &wPreferences
.vedge_hscrollspeed
, getInt
, NULL
451 {"VirtualEdgeVerticalScrollSpeed", "1", NULL
,
452 &wPreferences
.vedge_vscrollspeed
, getInt
, NULL
454 {"VirtualEdgeMaximumWidth", "3000", NULL
,
455 &wPreferences
.vedge_maxwidth
, getInt
, NULL
457 {"VirtualEdgeMaximumHeight", "3000", NULL
,
458 &wPreferences
.vedge_maxheight
, getInt
, NULL
461 {"StickyIcons", "NO", NULL
,
462 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
464 {"SaveSessionOnExit", "NO", NULL
,
465 &wPreferences
.save_session_on_exit
, getBool
, NULL
467 {"WrapMenus", "NO", NULL
,
468 &wPreferences
.wrap_menus
, getBool
, NULL
470 {"ScrollableMenus", "NO", NULL
,
471 &wPreferences
.scrollable_menus
, getBool
, NULL
473 {"MenuScrollSpeed", "medium", seSpeeds
,
474 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
476 {"IconSlideSpeed", "medium", seSpeeds
,
477 &wPreferences
.icon_slide_speed
, getEnum
, NULL
479 {"ShadeSpeed", "medium", seSpeeds
,
480 &wPreferences
.shade_speed
, getEnum
, NULL
482 {"DoubleClickTime", "250", (void*) &wPreferences
.dblclick_time
,
483 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
,
485 {"AlignSubmenus", "NO", NULL
,
486 &wPreferences
.align_menus
, getBool
, NULL
488 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
489 &wPreferences
.open_transients_with_parent
, getBool
, NULL
491 {"WindowPlacement", "auto", sePlacements
,
492 &wPreferences
.window_placement
, getEnum
, NULL
494 {"IgnoreFocusClick","NO", NULL
,
495 &wPreferences
.ignore_focus_click
, getBool
, NULL
497 {"UseSaveUnders", "NO", NULL
,
498 &wPreferences
.use_saveunders
, getBool
, NULL
500 {"OpaqueMove", "NO", NULL
,
501 &wPreferences
.opaque_move
, getBool
, NULL
503 {"DisableSound", "NO", NULL
,
504 &wPreferences
.no_sound
, getBool
, NULL
506 {"DisableAnimations", "NO", NULL
,
507 &wPreferences
.no_animations
, getBool
, NULL
509 {"DontLinkWorkspaces","NO", NULL
,
510 &wPreferences
.no_autowrap
, getBool
, NULL
512 {"AutoArrangeIcons", "NO", NULL
,
513 &wPreferences
.auto_arrange_icons
, getBool
, NULL
515 {"NoWindowOverDock", "NO", NULL
,
516 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
518 {"NoWindowOverIcons", "NO", NULL
,
519 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
521 {"WindowPlaceOrigin", "(0, 0)", NULL
,
522 &wPreferences
.window_place_origin
, getCoord
, NULL
524 {"ResizeDisplay", "corner", seGeomDisplays
,
525 &wPreferences
.size_display
, getEnum
, NULL
527 {"MoveDisplay", "corner", seGeomDisplays
,
528 &wPreferences
.move_display
, getEnum
, NULL
530 {"DontConfirmKill", "NO", NULL
,
531 &wPreferences
.dont_confirm_kill
, getBool
,NULL
533 {"WindowTitleBalloons", "NO", NULL
,
534 &wPreferences
.window_balloon
, getBool
, NULL
536 {"MiniwindowTitleBalloons", "NO", NULL
,
537 &wPreferences
.miniwin_balloon
,getBool
, NULL
539 {"AppIconBalloons", "NO", NULL
,
540 &wPreferences
.appicon_balloon
,getBool
, NULL
542 {"HelpBalloons", "NO", NULL
,
543 &wPreferences
.help_balloon
, getBool
, NULL
545 {"EdgeResistance", "30", NULL
,
546 &wPreferences
.edge_resistance
,getInt
, NULL
548 {"Attraction", "NO", NULL
,
549 &wPreferences
.attract
, getBool
, NULL
551 {"DisableBlinking", "NO", NULL
,
552 &wPreferences
.dont_blink
, getBool
, NULL
555 {"MenuStyle", "normal", seMenuStyles
,
556 &wPreferences
.menu_style
, getEnum
, setMenuStyle
558 {"WidgetColor", "(solid, gray)", NULL
,
559 NULL
, getTexture
, setWidgetColor
,
561 {"WorkspaceSpecificBack","()", NULL
,
562 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
564 /* WorkspaceBack must come after WorkspaceSpecificBack or
565 * WorkspaceBack wont know WorkspaceSpecificBack was also
566 * specified and 2 copies of wmsetbg will be launched */
567 {"WorkspaceBack", "(solid, black)", NULL
,
568 NULL
, getWSBackground
,setWorkspaceBack
570 {"SmoothWorkspaceBack", "NO", NULL
,
573 {"IconBack", "(solid, gray)", NULL
,
574 NULL
, getTexture
, setIconTile
576 {"TitleJustify", "center", seJustifications
,
577 &wPreferences
.title_justification
, getEnum
, setJustify
579 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
580 NULL
, getFont
, setWinTitleFont
,
582 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
583 &wPreferences
.window_title_clearance
, getInt
, setClearance
585 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
586 &wPreferences
.menu_title_clearance
, getInt
, setClearance
588 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
589 &wPreferences
.menu_text_clearance
, getInt
, setClearance
591 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
592 NULL
, getFont
, setMenuTitleFont
594 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
595 NULL
, getFont
, setMenuTextFont
597 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
598 NULL
, getFont
, setIconTitleFont
600 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
601 NULL
, getFont
, setClipTitleFont
603 {"LargeDisplayFont",DEF_WORKSPACE_NAME_FONT
, NULL
,
604 NULL
, getFont
, setLargeDisplayFont
606 {"HighlightColor", "white", NULL
,
607 NULL
, getColor
, setHightlight
609 {"HighlightTextColor", "black", NULL
,
610 NULL
, getColor
, setHightlightText
612 {"ClipTitleColor", "black", (void*)CLIP_NORMAL
,
613 NULL
, getColor
, setClipTitleColor
615 {"CClipTitleColor", "\"#454045\"", (void*)CLIP_COLLAPSED
,
616 NULL
, getColor
, setClipTitleColor
618 #ifdef DRAWSTRING_PLUGIN
619 {"FTitleColor", "white", (void*)WS_FOCUSED
,
620 NULL
, getTextRenderer
, setWTitleColor
622 {"PTitleColor", "white", (void*)WS_PFOCUSED
,
623 NULL
, getTextRenderer
, setWTitleColor
625 {"UTitleColor", "black", (void*)WS_UNFOCUSED
,
626 NULL
, getTextRenderer
, setWTitleColor
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
639 {"FTitleBack", "(solid, black)", NULL
,
640 NULL
, getTexture
, setFTitleBack
642 {"PTitleBack", "(solid, \"#616161\")", NULL
,
643 NULL
, getTexture
, setPTitleBack
645 {"UTitleBack", "(solid, gray)", NULL
,
646 NULL
, getTexture
, setUTitleBack
648 {"ResizebarBack", "(solid, gray)", NULL
,
649 NULL
, getTexture
, setResizebarBack
651 #ifdef DRAWSTRING_PLUGIN
652 {"MenuTitleColor", "white", NULL
,
653 NULL
, getTextRenderer
, setMenuTitleColor
656 {"MenuTitleColor", "white", NULL
,
657 NULL
, getColor
, setMenuTitleColor
660 {"MenuTextColor", "black", NULL
,
661 NULL
, getColor
, setMenuTextColor
663 {"MenuDisabledColor", "\"#616161\"", NULL
,
664 NULL
, getColor
, setMenuDisabledColor
666 {"MenuTitleBack", "(solid, black)", NULL
,
667 NULL
, getTexture
, setMenuTitleBack
669 {"MenuTextBack", "(solid, gray)", NULL
,
670 NULL
, getTexture
, setMenuTextBack
672 {"IconTitleColor", "white", NULL
,
673 NULL
, getColor
, setIconTitleColor
675 {"IconTitleBack", "black", NULL
,
676 NULL
, getColor
, setIconTitleBack
680 {"RootMenuKey", "None", (void*)WKBD_ROOTMENU
,
681 NULL
, getKeybind
, setKeyGrab
683 {"WindowListKey", "None", (void*)WKBD_WINDOWLIST
,
684 NULL
, getKeybind
, setKeyGrab
687 {"WindowMenuKey", "None", (void*)WKBD_WINDOWMENU
,
688 NULL
, getKeybind
, setKeyGrab
690 {"ClipLowerKey", "None", (void*)WKBD_CLIPLOWER
,
691 NULL
, getKeybind
, setKeyGrab
693 {"ClipRaiseKey", "None", (void*)WKBD_CLIPRAISE
,
694 NULL
, getKeybind
, setKeyGrab
696 {"ClipRaiseLowerKey", "None", (void*)WKBD_CLIPRAISELOWER
,
697 NULL
, getKeybind
, setKeyGrab
699 {"MiniaturizeKey", "None", (void*)WKBD_MINIATURIZE
,
700 NULL
, getKeybind
, setKeyGrab
702 {"HideKey", "None", (void*)WKBD_HIDE
,
703 NULL
, getKeybind
, setKeyGrab
705 {"MoveResizeKey", "None", (void*)WKBD_MOVERESIZE
,
706 NULL
, getKeybind
, setKeyGrab
708 {"CloseKey", "None", (void*)WKBD_CLOSE
,
709 NULL
, getKeybind
, setKeyGrab
711 {"MaximizeKey", "None", (void*)WKBD_MAXIMIZE
,
712 NULL
, getKeybind
, setKeyGrab
714 {"VMaximizeKey", "None", (void*)WKBD_VMAXIMIZE
,
715 NULL
, getKeybind
, setKeyGrab
717 {"RaiseKey", "\"Meta+Up\"", (void*)WKBD_RAISE
,
718 NULL
, getKeybind
, setKeyGrab
720 {"LowerKey", "\"Meta+Down\"", (void*)WKBD_LOWER
,
721 NULL
, getKeybind
, setKeyGrab
723 {"RaiseLowerKey", "None", (void*)WKBD_RAISELOWER
,
724 NULL
, getKeybind
, setKeyGrab
726 {"ShadeKey", "None", (void*)WKBD_SHADE
,
727 NULL
, getKeybind
, setKeyGrab
729 {"SelectKey", "None", (void*)WKBD_SELECT
,
730 NULL
, getKeybind
, setKeyGrab
732 {"FocusNextKey", "None", (void*)WKBD_FOCUSNEXT
,
733 NULL
, getKeybind
, setKeyGrab
735 {"FocusPrevKey", "None", (void*)WKBD_FOCUSPREV
,
736 NULL
, getKeybind
, setKeyGrab
738 {"NextWorkspaceKey", "None", (void*)WKBD_NEXTWORKSPACE
,
739 NULL
, getKeybind
, setKeyGrab
741 {"PrevWorkspaceKey", "None", (void*)WKBD_PREVWORKSPACE
,
742 NULL
, getKeybind
, setKeyGrab
744 {"NextWorkspaceLayerKey", "None", (void*)WKBD_NEXTWSLAYER
,
745 NULL
, getKeybind
, setKeyGrab
747 {"PrevWorkspaceLayerKey", "None", (void*)WKBD_PREVWSLAYER
,
748 NULL
, getKeybind
, setKeyGrab
750 {"Workspace1Key", "None", (void*)WKBD_WORKSPACE1
,
751 NULL
, getKeybind
, setKeyGrab
753 {"Workspace2Key", "None", (void*)WKBD_WORKSPACE2
,
754 NULL
, getKeybind
, setKeyGrab
756 {"Workspace3Key", "None", (void*)WKBD_WORKSPACE3
,
757 NULL
, getKeybind
, setKeyGrab
759 {"Workspace4Key", "None", (void*)WKBD_WORKSPACE4
,
760 NULL
, getKeybind
, setKeyGrab
762 {"Workspace5Key", "None", (void*)WKBD_WORKSPACE5
,
763 NULL
, getKeybind
, setKeyGrab
765 {"Workspace6Key", "None", (void*)WKBD_WORKSPACE6
,
766 NULL
, getKeybind
, setKeyGrab
768 {"Workspace7Key", "None", (void*)WKBD_WORKSPACE7
,
769 NULL
, getKeybind
, setKeyGrab
771 {"Workspace8Key", "None", (void*)WKBD_WORKSPACE8
,
772 NULL
, getKeybind
, setKeyGrab
774 {"Workspace9Key", "None", (void*)WKBD_WORKSPACE9
,
775 NULL
, getKeybind
, setKeyGrab
777 {"Workspace10Key", "None", (void*)WKBD_WORKSPACE10
,
778 NULL
, getKeybind
, setKeyGrab
780 {"WindowShortcut1Key","None", (void*)WKBD_WINDOW1
,
781 NULL
, getKeybind
, setKeyGrab
783 {"WindowShortcut2Key","None", (void*)WKBD_WINDOW2
,
784 NULL
, getKeybind
, setKeyGrab
786 {"WindowShortcut3Key","None", (void*)WKBD_WINDOW3
,
787 NULL
, getKeybind
, setKeyGrab
789 {"WindowShortcut4Key","None", (void*)WKBD_WINDOW4
,
790 NULL
, getKeybind
, setKeyGrab
792 ,{"WindowShortcut5Key","None", (void*)WKBD_WINDOW5
,
793 NULL
, getKeybind
, setKeyGrab
795 {"WindowShortcut6Key","None", (void*)WKBD_WINDOW6
,
796 NULL
, getKeybind
, setKeyGrab
798 {"WindowShortcut7Key","None", (void*)WKBD_WINDOW7
,
799 NULL
, getKeybind
, setKeyGrab
801 {"WindowShortcut8Key","None", (void*)WKBD_WINDOW8
,
802 NULL
, getKeybind
, setKeyGrab
804 {"WindowShortcut9Key","None", (void*)WKBD_WINDOW9
,
805 NULL
, getKeybind
, setKeyGrab
807 {"WindowShortcut10Key","None", (void*)WKBD_WINDOW10
,
808 NULL
, getKeybind
, setKeyGrab
810 {"ScreenSwitchKey", "None", (void*)WKBD_SWITCH_SCREEN
,
811 NULL
, getKeybind
, setKeyGrab
814 #ifdef KEEP_XKB_LOCK_STATUS
815 {"ToggleKbdModeKey", "None", (void*)WKBD_TOGGLE
,
816 NULL
, getKeybind
, setKeyGrab
818 {"KbdModeLock", "NO", NULL
,
819 &wPreferences
.modelock
, getBool
, NULL
821 #endif /* KEEP_XKB_LOCK_STATUS */
822 #ifdef DEFINABLE_CURSOR
823 {"NormalCursor", "(builtin, left_ptr)", (void*)WCUR_ROOT
,
824 NULL
, getCursor
, setCursor
826 {"MoveCursor", "(builtin, fleur)", (void*)WCUR_MOVE
,
827 NULL
, getCursor
, setCursor
830 {"TopLeftResizeCursor", "(builtin, sizing)", (void*)WCUR_TOPLEFTRESIZE
,
831 NULL
, getCursor
, setCursor
833 {"TopRightResizeCursor", "(builtin, sizing)", (void*)WCUR_TOPRIGHTRESIZE
,
834 NULL
, getCursor
, setCursor
836 {"BottomLeftResizeCursor", "(builtin, sizing)", (void*)WCUR_BOTTOMLEFTRESIZE
,
837 NULL
, getCursor
, setCursor
839 {"BottomRightResizeCursor", "(builtin, sizing)", (void*)WCUR_BOTTOMRIGHTRESIZE
,
840 NULL
, getCursor
, setCursor
842 {"VerticalResizeCursor", "(builtin, sizing)", (void*)WCUR_VERTICALRESIZE
,
843 NULL
, getCursor
, setCursor
845 {"HorizonResizeCursor", "(builtin, sizing)", (void*)WCUR_HORIZONRESIZE
,
846 NULL
, getCursor
, setCursor
848 {"WaitCursor", "(builtin, watch)", (void*)WCUR_WAIT
,
849 NULL
, getCursor
, setCursor
851 {"ArrowCursor", "(builtin, top_left_arrow)", (void*)WCUR_ARROW
,
852 NULL
, getCursor
, setCursor
855 #endif /* DEFINABLE_CURSOR */
860 static void rereadDefaults(void);
867 /* must defer the update because accessing X data from a
868 * signal handler can mess up Xlib */
877 WDefaultEntry
*entry
;
879 PLSetStringCmpHook(StringCompareHook
);
881 for (i
=0; i
<sizeof(optionList
)/sizeof(WDefaultEntry
); i
++) {
882 entry
= &optionList
[i
];
884 entry
->plkey
= PLMakeString(entry
->key
);
885 if (entry
->default_value
)
886 entry
->plvalue
= PLGetProplistWithDescription(entry
->default_value
);
888 entry
->plvalue
= NULL
;
891 for (i
=0; i
<sizeof(staticOptionList
)/sizeof(WDefaultEntry
); i
++) {
892 entry
= &staticOptionList
[i
];
894 entry
->plkey
= PLMakeString(entry
->key
);
895 if (entry
->default_value
)
896 entry
->plvalue
= PLGetProplistWithDescription(entry
->default_value
);
898 entry
->plvalue
= NULL
;
902 wDomainName = PLMakeString(WMDOMAIN_NAME);
903 wAttributeDomainName = PLMakeString(WMATTRIBUTE_DOMAIN_NAME);
905 PLRegister(wDomainName, rereadDefaults);
906 PLRegister(wAttributeDomainName, rereadDefaults);
915 wDefaultsInit(int screen_number
)
917 static int defaults_inited
= 0;
920 if (!defaults_inited
) {
924 dict
= PLGetDomain(wDomainName
);
926 wwarning(_("could not read domain \"%s\" from defaults database"),
927 PLGetString(wDomainName
));
936 wDefaultsDestroyDomain(WDDomain
*domain
)
938 if (domain
->dictionary
)
939 PLRelease(domain
->dictionary
);
946 wDefaultsInitDomain(char *domain
, Bool requireDictionary
)
950 static int inited
= 0;
953 proplist_t shared_dict
=NULL
;
960 db
= wmalloc(sizeof(WDDomain
));
961 memset(db
, 0, sizeof(WDDomain
));
962 db
->domain_name
= domain
;
963 db
->path
= wdefaultspathfordomain(domain
);
966 if (the_path
&& stat(the_path
, &stbuf
)>=0) {
967 db
->dictionary
= ReadProplistFromFile(the_path
);
968 if (db
->dictionary
) {
969 if (requireDictionary
&& !PLIsDictionary(db
->dictionary
)) {
970 PLRelease(db
->dictionary
);
971 db
->dictionary
= NULL
;
972 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
975 db
->timestamp
= stbuf
.st_mtime
;
977 wwarning(_("could not load domain %s from user defaults database"),
982 /* global system dictionary */
983 sprintf(path
, "%s/WindowMaker/%s", SYSCONFDIR
, domain
);
984 if (stat(path
, &stbuf
)>=0) {
985 shared_dict
= ReadProplistFromFile(path
);
987 if (requireDictionary
&& !PLIsDictionary(shared_dict
)) {
988 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
990 PLRelease(shared_dict
);
993 if (db
->dictionary
&& PLIsDictionary(shared_dict
) &&
994 PLIsDictionary(db
->dictionary
)) {
995 PLMergeDictionaries(shared_dict
, db
->dictionary
);
996 PLRelease(db
->dictionary
);
997 db
->dictionary
= shared_dict
;
998 if (stbuf
.st_mtime
> db
->timestamp
)
999 db
->timestamp
= stbuf
.st_mtime
;
1000 } else if (!db
->dictionary
) {
1001 db
->dictionary
= shared_dict
;
1002 if (stbuf
.st_mtime
> db
->timestamp
)
1003 db
->timestamp
= stbuf
.st_mtime
;
1007 wwarning(_("could not load domain %s from global defaults database (%s)"),
1012 /* set to save it in user's directory, no matter from where it was read */
1013 if (db
->dictionary
) {
1014 proplist_t tmp
= PLMakeString(db
->path
);
1016 PLSetFilename(db
->dictionary
, tmp
);
1025 wReadStaticDefaults(proplist_t dict
)
1028 WDefaultEntry
*entry
;
1033 for (i
=0; i
<sizeof(staticOptionList
)/sizeof(WDefaultEntry
); i
++) {
1034 entry
= &staticOptionList
[i
];
1037 plvalue
= PLGetDictionaryEntry(dict
, entry
->plkey
);
1042 /* no default in the DB. Use builtin default */
1043 plvalue
= entry
->plvalue
;
1048 (*entry
->convert
)(NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
1049 if (entry
->update
) {
1050 (*entry
->update
)(NULL
, entry
, tdata
, entry
->extra_data
);
1058 wDefaultsCheckDomains(void *foo
)
1064 char path
[PATH_MAX
];
1067 puts("Checking domains...");
1069 if (stat(WDWindowMaker
->path
, &stbuf
)>=0
1070 && WDWindowMaker
->timestamp
< stbuf
.st_mtime
) {
1071 proplist_t shared_dict
= NULL
;
1073 puts("Checking WindowMaker domain");
1075 WDWindowMaker
->timestamp
= stbuf
.st_mtime
;
1077 /* global dictionary */
1078 sprintf(path
, "%s/WindowMaker/WindowMaker", SYSCONFDIR
);
1079 if (stat(path
, &stbuf
)>=0) {
1080 shared_dict
= ReadProplistFromFile(path
);
1081 if (shared_dict
&& !PLIsDictionary(shared_dict
)) {
1082 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
1083 "WindowMaker", path
);
1084 PLRelease(shared_dict
);
1086 } else if (!shared_dict
) {
1087 wwarning(_("could not load domain %s from global defaults database"),
1091 /* user dictionary */
1092 dict
= ReadProplistFromFile(WDWindowMaker
->path
);
1094 if (!PLIsDictionary(dict
)) {
1097 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1098 "WindowMaker", WDWindowMaker
->path
);
1101 PLSetFilename(shared_dict
, PLGetFilename(dict
));
1102 PLMergeDictionaries(shared_dict
, dict
);
1107 for (i
=0; i
<wScreenCount
; i
++) {
1108 scr
= wScreenWithNumber(i
);
1110 wReadDefaults(scr
, dict
);
1112 if (WDWindowMaker
->dictionary
) {
1113 PLRelease(WDWindowMaker
->dictionary
);
1115 WDWindowMaker
->dictionary
= dict
;
1118 wwarning(_("could not load domain %s from user defaults database"),
1122 PLRelease(shared_dict
);
1126 if (stat(WDWindowAttributes
->path
, &stbuf
)>=0
1127 && WDWindowAttributes
->timestamp
< stbuf
.st_mtime
) {
1129 puts("Checking WMWindowAttributes domain");
1131 dict
= ReadProplistFromFile(WDWindowAttributes
->path
);
1133 if (!PLIsDictionary(dict
)) {
1136 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1137 "WMWindowAttributes", WDWindowAttributes
->path
);
1139 if (WDWindowAttributes
->dictionary
)
1140 PLRelease(WDWindowAttributes
->dictionary
);
1141 WDWindowAttributes
->dictionary
= dict
;
1142 for (i
=0; i
<wScreenCount
; i
++) {
1143 scr
= wScreenWithNumber(i
);
1145 wDefaultUpdateIcons(scr
);
1149 wwarning(_("could not load domain %s from user defaults database"),
1150 "WMWindowAttributes");
1152 WDWindowAttributes
->timestamp
= stbuf
.st_mtime
;
1156 if (stat(WDRootMenu
->path
, &stbuf
)>=0
1157 && WDRootMenu
->timestamp
< stbuf
.st_mtime
) {
1158 dict
= ReadProplistFromFile(WDRootMenu
->path
);
1160 puts("Checking WMRootMenu domain");
1163 if (!PLIsArray(dict
) && !PLIsString(dict
)) {
1166 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1167 "WMRootMenu", WDRootMenu
->path
);
1169 if (WDRootMenu
->dictionary
) {
1170 PLRelease(WDRootMenu
->dictionary
);
1172 WDRootMenu
->dictionary
= dict
;
1175 wwarning(_("could not load domain %s from user defaults database"),
1178 WDRootMenu
->timestamp
= stbuf
.st_mtime
;
1183 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, foo
);
1188 wReadDefaults(WScreen
*scr
, proplist_t new_dict
)
1190 proplist_t plvalue
, old_value
;
1191 WDefaultEntry
*entry
;
1193 int update_workspace_back
= 0; /* kluge :/ */
1196 proplist_t old_dict
= (WDWindowMaker
->dictionary
!=new_dict
1197 ? WDWindowMaker
->dictionary
: NULL
);
1203 for (i
=0; i
<sizeof(optionList
)/sizeof(WDefaultEntry
); i
++) {
1204 entry
= &optionList
[i
];
1207 plvalue
= PLGetDictionaryEntry(new_dict
, entry
->plkey
);
1214 old_value
= PLGetDictionaryEntry(old_dict
, entry
->plkey
);
1217 if (!plvalue
&& !old_value
) {
1218 /* no default in the DB. Use builtin default */
1219 plvalue
= entry
->plvalue
;
1220 if (plvalue
&& new_dict
) {
1221 PLInsertDictionaryEntry(new_dict
, entry
->plkey
, plvalue
);
1224 } else if (!plvalue
) {
1225 /* value was deleted from DB. Keep current value */
1227 } else if (!old_value
) {
1228 /* set value for the 1st time */
1229 } else if (!PLIsEqual(plvalue
, old_value
)) {
1230 /* value has changed */
1233 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1234 && update_workspace_back
1235 && scr
->flags
.backimage_helper_launched
) {
1237 /* value was not changed since last time */
1244 printf("Updating %s to %s\n", entry
->key
,
1245 PLGetDescription(plvalue
));
1248 if ((*entry
->convert
)(scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1250 * If the WorkspaceSpecificBack data has been changed
1251 * so that the helper will be launched now, we must be
1252 * sure to send the default background texture config
1255 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0
1256 && !scr
->flags
.backimage_helper_launched
) {
1257 update_workspace_back
= 1;
1259 if (entry
->update
) {
1261 (*entry
->update
)(scr
, entry
, tdata
, entry
->extra_data
);
1267 if (needs_refresh
!=0 && !scr
->flags
.startup
) {
1271 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1272 foo
|= WTextureSettings
;
1273 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1274 foo
|= WFontSettings
;
1275 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1276 foo
|= WColorSettings
;
1278 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1282 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1283 foo
|= WTextureSettings
;
1284 if (needs_refresh
& REFRESH_MENU_FONT
)
1285 foo
|= WFontSettings
;
1286 if (needs_refresh
& REFRESH_MENU_COLOR
)
1287 foo
|= WColorSettings
;
1289 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
,
1293 if (needs_refresh
& REFRESH_WINDOW_FONT
) {
1294 foo
|= WFontSettings
;
1296 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
) {
1297 foo
|= WTextureSettings
;
1299 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
) {
1300 foo
|= WColorSettings
;
1303 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
,
1306 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1308 if (needs_refresh
& REFRESH_ICON_FONT
) {
1309 foo
|= WFontSettings
;
1311 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
) {
1312 foo
|= WTextureSettings
;
1314 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
) {
1315 foo
|= WTextureSettings
;
1318 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1321 if (needs_refresh
& REFRESH_ICON_TILE
)
1322 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1328 wDefaultUpdateIcons(WScreen
*scr
)
1330 WAppIcon
*aicon
= scr
->app_icon_list
;
1331 WWindow
*wwin
= scr
->focused_window
;
1335 file
= wDefaultGetIconFile(scr
, aicon
->wm_instance
, aicon
->wm_class
,
1337 if ((file
&& aicon
->icon
->file
&& strcmp(file
, aicon
->icon
->file
)!=0)
1338 || (file
&& !aicon
->icon
->file
)) {
1341 if (aicon
->icon
->file
)
1342 wfree(aicon
->icon
->file
);
1343 aicon
->icon
->file
= wstrdup(file
);
1345 new_image
= wDefaultGetImage(scr
, aicon
->wm_instance
,
1348 wIconChangeImage(aicon
->icon
, new_image
);
1349 wAppIconPaint(aicon
);
1352 aicon
= aicon
->next
;
1355 if (!wPreferences
.flags
.noclip
)
1356 wClipIconPaint(scr
->clip_icon
);
1359 if (wwin
->icon
&& wwin
->flags
.miniaturized
) {
1360 file
= wDefaultGetIconFile(scr
, wwin
->wm_instance
, wwin
->wm_class
,
1362 if ((file
&& wwin
->icon
->file
&& strcmp(file
, wwin
->icon
->file
)!=0)
1363 || (file
&& !wwin
->icon
->file
)) {
1366 if (wwin
->icon
->file
)
1367 wfree(wwin
->icon
->file
);
1368 wwin
->icon
->file
= wstrdup(file
);
1370 new_image
= wDefaultGetImage(scr
, wwin
->wm_instance
,
1373 wIconChangeImage(wwin
->icon
, new_image
);
1381 /* --------------------------- Local ----------------------- */
1383 #define GET_STRING_OR_DEFAULT(x, var) if (!PLIsString(value)) { \
1384 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1386 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1387 var = entry->default_value;\
1388 } else var = PLGetString(value)\
1395 string2index(proplist_t key
, proplist_t val
, proplist_t def
,
1396 WOptionEnumeration
*values
)
1399 WOptionEnumeration
*v
;
1400 char buffer
[TOTAL_VALUES_LENGTH
];
1402 if (PLIsString(val
) && (str
= PLGetString(val
))) {
1403 for (v
=values
; v
->string
!=NULL
; v
++) {
1404 if (strcasecmp(v
->string
, str
)==0)
1410 for (v
=values
; v
->string
!=NULL
; v
++) {
1413 strcat(buffer
, ", ");
1414 strcat(buffer
, v
->string
);
1417 wwarning(_("wrong option value for key \"%s\". Should be one of %s"),
1418 PLGetString(key
), buffer
);
1421 return string2index(key
, val
, NULL
, values
);
1431 * value - is the value in the defaults DB
1432 * addr - is the address to store the data
1433 * ret - is the address to store a pointer to a temporary buffer. ret
1434 * must not be freed and is used by the set functions
1437 getBool(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1444 GET_STRING_OR_DEFAULT("Boolean", val
);
1447 if ((val
[1]=='\0' && (val
[0]=='y' || val
[0]=='Y'))
1448 || strcasecmp(val
, "YES")==0) {
1451 } else if ((val
[1]=='\0' && (val
[0]=='n' || val
[0]=='N'))
1452 || strcasecmp(val
, "NO")==0) {
1456 if (sscanf(val
, "%i", &i
)==1) {
1462 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""),
1464 if (second_pass
==0) {
1465 val
= PLGetString(entry
->plvalue
);
1467 wwarning(_("using default \"%s\" instead"), val
);
1478 *(char*)addr
= data
;
1486 getInt(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1493 GET_STRING_OR_DEFAULT("Integer", val
);
1495 if (sscanf(val
, "%i", &data
)!=1) {
1496 wwarning(_("can't convert \"%s\" to integer for key \"%s\""),
1498 val
= PLGetString(entry
->plvalue
);
1499 wwarning(_("using default \"%s\" instead"), val
);
1500 if (sscanf(val
, "%i", &data
)!=1) {
1516 getCoord(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1520 char *val_x
, *val_y
;
1521 int nelem
, changed
=0;
1522 proplist_t elem_x
, elem_y
;
1525 if (!PLIsArray(value
)) {
1526 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1527 entry
->key
, "Coordinate");
1529 value
= entry
->plvalue
;
1531 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1537 nelem
= PLGetNumberOfElements(value
);
1539 wwarning(_("Incorrect number of elements in array for key \"%s\"."),
1542 value
= entry
->plvalue
;
1544 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1550 elem_x
= PLGetArrayElement(value
, 0);
1551 elem_y
= PLGetArrayElement(value
, 1);
1553 if (!elem_x
|| !elem_y
|| !PLIsString(elem_x
) || !PLIsString(elem_y
)) {
1554 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."),
1557 value
= entry
->plvalue
;
1559 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1565 val_x
= PLGetString(elem_x
);
1566 val_y
= PLGetString(elem_y
);
1568 if (sscanf(val_x
, "%i", &data
.x
)!=1 || sscanf(val_y
, "%i", &data
.y
)!=1) {
1569 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1571 value
= entry
->plvalue
;
1573 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1581 else if (data
.x
> scr
->scr_width
/3)
1582 data
.x
= scr
->scr_width
/3;
1585 else if (data
.y
> scr
->scr_height
/3)
1586 data
.y
= scr
->scr_height
/3;
1592 *(WCoord
*)addr
= data
;
1600 /* This function is not used at the moment. */
1602 getString(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1607 GET_STRING_OR_DEFAULT("String", data
);
1610 data
= PLGetString(entry
->plvalue
);
1619 *(char**)addr
= wstrdup(data
);
1627 getPathList(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1637 if (!PLIsArray(value
)) {
1638 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1639 entry
->key
, "an array of paths");
1641 value
= entry
->plvalue
;
1643 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1650 count
= PLGetNumberOfElements(value
);
1653 value
= entry
->plvalue
;
1655 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1662 for (i
=0; i
<count
; i
++) {
1663 d
= PLGetArrayElement(value
, i
);
1664 if (!d
|| !PLIsString(d
)) {
1668 len
+= strlen(PLGetString(d
))+1;
1671 ptr
= data
= wmalloc(len
+1);
1673 for (i
=0; i
<count
; i
++) {
1674 d
= PLGetArrayElement(value
, i
);
1675 if (!d
|| !PLIsString(d
)) {
1678 strcpy(ptr
, PLGetString(d
));
1679 ptr
+= strlen(PLGetString(d
));
1683 ptr
--; *(ptr
--) = 0;
1685 if (*(char**)addr
!=NULL
) {
1686 wfree(*(char**)addr
);
1688 *(char**)addr
= data
;
1695 getEnum(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1698 static signed char data
;
1700 data
= string2index(entry
->plkey
, value
, entry
->default_value
,
1701 (WOptionEnumeration
*)entry
->extra_data
);
1709 *(signed char*)addr
= data
;
1718 * (hgradient <color> <color>)
1719 * (vgradient <color> <color>)
1720 * (dgradient <color> <color>)
1721 * (mhgradient <color> <color> ...)
1722 * (mvgradient <color> <color> ...)
1723 * (mdgradient <color> <color> ...)
1724 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1725 * (tpixmap <file> <color>)
1726 * (spixmap <file> <color>)
1727 * (cpixmap <file> <color>)
1728 * (thgradient <file> <opaqueness> <color> <color>)
1729 * (tvgradient <file> <opaqueness> <color> <color>)
1730 * (tdgradient <file> <opaqueness> <color> <color>)
1731 * (function <lib> <function> ...)
1735 parse_texture(WScreen
*scr
, proplist_t pl
)
1740 WTexture
*texture
=NULL
;
1742 nelem
= PLGetNumberOfElements(pl
);
1747 elem
= PLGetArrayElement(pl
, 0);
1748 if (!elem
|| !PLIsString(elem
))
1750 val
= PLGetString(elem
);
1753 if (strcasecmp(val
, "solid")==0) {
1761 elem
= PLGetArrayElement(pl
, 1);
1762 if (!elem
|| !PLIsString(elem
))
1764 val
= PLGetString(elem
);
1766 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1767 wwarning(_("\"%s\" is not a valid color name"), val
);
1771 texture
= (WTexture
*)wTextureMakeSolid(scr
, &color
);
1772 } else if (strcasecmp(val
, "dgradient")==0
1773 || strcasecmp(val
, "vgradient")==0
1774 || strcasecmp(val
, "hgradient")==0) {
1775 RColor color1
, color2
;
1780 wwarning(_("bad number of arguments in gradient specification"));
1784 if (val
[0]=='d' || val
[0]=='D')
1785 type
= WTEX_DGRADIENT
;
1786 else if (val
[0]=='h' || val
[0]=='H')
1787 type
= WTEX_HGRADIENT
;
1789 type
= WTEX_VGRADIENT
;
1792 /* get from color */
1793 elem
= PLGetArrayElement(pl
, 1);
1794 if (!elem
|| !PLIsString(elem
))
1796 val
= PLGetString(elem
);
1798 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1799 wwarning(_("\"%s\" is not a valid color name"), val
);
1803 color1
.red
= xcolor
.red
>> 8;
1804 color1
.green
= xcolor
.green
>> 8;
1805 color1
.blue
= xcolor
.blue
>> 8;
1808 elem
= PLGetArrayElement(pl
, 2);
1809 if (!elem
|| !PLIsString(elem
)) {
1812 val
= PLGetString(elem
);
1814 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1815 wwarning(_("\"%s\" is not a valid color name"), val
);
1819 color2
.red
= xcolor
.red
>> 8;
1820 color2
.green
= xcolor
.green
>> 8;
1821 color2
.blue
= xcolor
.blue
>> 8;
1823 texture
= (WTexture
*)wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1825 } else if (strcasecmp(val
, "igradient")==0) {
1826 RColor colors1
[2], colors2
[2];
1832 wwarning(_("bad number of arguments in gradient specification"));
1836 /* get from color */
1837 for (i
= 0; i
< 2; i
++) {
1838 elem
= PLGetArrayElement(pl
, 1+i
);
1839 if (!elem
|| !PLIsString(elem
))
1841 val
= PLGetString(elem
);
1843 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1844 wwarning(_("\"%s\" is not a valid color name"), val
);
1847 colors1
[i
].alpha
= 255;
1848 colors1
[i
].red
= xcolor
.red
>> 8;
1849 colors1
[i
].green
= xcolor
.green
>> 8;
1850 colors1
[i
].blue
= xcolor
.blue
>> 8;
1852 elem
= PLGetArrayElement(pl
, 3);
1853 if (!elem
|| !PLIsString(elem
))
1855 val
= PLGetString(elem
);
1859 /* get from color */
1860 for (i
= 0; i
< 2; i
++) {
1861 elem
= PLGetArrayElement(pl
, 4+i
);
1862 if (!elem
|| !PLIsString(elem
))
1864 val
= PLGetString(elem
);
1866 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1867 wwarning(_("\"%s\" is not a valid color name"), val
);
1870 colors2
[i
].alpha
= 255;
1871 colors2
[i
].red
= xcolor
.red
>> 8;
1872 colors2
[i
].green
= xcolor
.green
>> 8;
1873 colors2
[i
].blue
= xcolor
.blue
>> 8;
1875 elem
= PLGetArrayElement(pl
, 6);
1876 if (!elem
|| !PLIsString(elem
))
1878 val
= PLGetString(elem
);
1881 texture
= (WTexture
*)wTextureMakeIGradient(scr
, th1
, colors1
,
1884 } else if (strcasecmp(val
, "mhgradient")==0
1885 || strcasecmp(val
, "mvgradient")==0
1886 || strcasecmp(val
, "mdgradient")==0) {
1893 wwarning(_("too few arguments in multicolor gradient specification"));
1897 if (val
[1]=='h' || val
[1]=='H')
1898 type
= WTEX_MHGRADIENT
;
1899 else if (val
[1]=='v' || val
[1]=='V')
1900 type
= WTEX_MVGRADIENT
;
1902 type
= WTEX_MDGRADIENT
;
1906 colors
= wmalloc(sizeof(RColor
*)*(count
+1));
1908 for (i
=0; i
<count
; i
++) {
1909 elem
= PLGetArrayElement(pl
, i
+1);
1910 if (!elem
|| !PLIsString(elem
)) {
1911 for (--i
; i
>=0; --i
) {
1917 val
= PLGetString(elem
);
1919 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1920 wwarning(_("\"%s\" is not a valid color name"), val
);
1921 for (--i
; i
>=0; --i
) {
1927 colors
[i
] = wmalloc(sizeof(RColor
));
1928 colors
[i
]->red
= color
.red
>> 8;
1929 colors
[i
]->green
= color
.green
>> 8;
1930 colors
[i
]->blue
= color
.blue
>> 8;
1935 texture
= (WTexture
*)wTextureMakeMGradient(scr
, type
, colors
);
1936 } else if (strcasecmp(val
, "spixmap")==0 ||
1937 strcasecmp(val
, "cpixmap")==0 ||
1938 strcasecmp(val
, "tpixmap")==0) {
1945 if (val
[0] == 's' || val
[0] == 'S')
1947 else if (val
[0] == 'c' || val
[0] == 'C')
1953 elem
= PLGetArrayElement(pl
, 2);
1954 if (!elem
|| !PLIsString(elem
)) {
1957 val
= PLGetString(elem
);
1959 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1960 wwarning(_("\"%s\" is not a valid color name"), val
);
1965 elem
= PLGetArrayElement(pl
, 1);
1966 if (!elem
|| !PLIsString(elem
))
1968 val
= PLGetString(elem
);
1970 texture
= (WTexture
*)wTextureMakePixmap(scr
, type
, val
, &color
);
1971 } else if (strcasecmp(val
, "thgradient")==0
1972 || strcasecmp(val
, "tvgradient")==0
1973 || strcasecmp(val
, "tdgradient")==0) {
1974 RColor color1
, color2
;
1979 if (val
[1]=='h' || val
[1]=='H')
1980 style
= WTEX_THGRADIENT
;
1981 else if (val
[1]=='v' || val
[1]=='V')
1982 style
= WTEX_TVGRADIENT
;
1984 style
= WTEX_TDGRADIENT
;
1987 wwarning(_("bad number of arguments in textured gradient specification"));
1991 /* get from color */
1992 elem
= PLGetArrayElement(pl
, 3);
1993 if (!elem
|| !PLIsString(elem
))
1995 val
= PLGetString(elem
);
1997 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1998 wwarning(_("\"%s\" is not a valid color name"), val
);
2002 color1
.red
= xcolor
.red
>> 8;
2003 color1
.green
= xcolor
.green
>> 8;
2004 color1
.blue
= xcolor
.blue
>> 8;
2007 elem
= PLGetArrayElement(pl
, 4);
2008 if (!elem
|| !PLIsString(elem
)) {
2011 val
= PLGetString(elem
);
2013 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
2014 wwarning(_("\"%s\" is not a valid color name"), val
);
2018 color2
.red
= xcolor
.red
>> 8;
2019 color2
.green
= xcolor
.green
>> 8;
2020 color2
.blue
= xcolor
.blue
>> 8;
2023 elem
= PLGetArrayElement(pl
, 2);
2024 if (!elem
|| !PLIsString(elem
))
2027 val
= PLGetString(elem
);
2029 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
2030 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
2035 elem
= PLGetArrayElement(pl
, 1);
2036 if (!elem
|| !PLIsString(elem
))
2038 val
= PLGetString(elem
);
2040 texture
= (WTexture
*)wTextureMakeTGradient(scr
, style
, &color1
, &color2
,
2043 #ifdef TEXTURE_PLUGIN
2044 else if (strcasecmp(val
, "function")==0) {
2045 WTexFunction
*function
;
2046 void (*initFunc
) (Display
*, Colormap
);
2047 char *lib
, *func
, **argv
;
2053 /* get the library name */
2054 elem
= PLGetArrayElement(pl
, 1);
2055 if (!elem
|| !PLIsString(elem
)) {
2058 lib
= PLGetString(elem
);
2060 /* get the function name */
2061 elem
= PLGetArrayElement(pl
, 2);
2062 if (!elem
|| !PLIsString(elem
)) {
2065 func
= PLGetString(elem
);
2068 argv
= (char **)wmalloc(argc
* sizeof(char *));
2070 /* get the parameters */
2071 argv
[0] = wstrdup(func
);
2072 for (i
= 0; i
< argc
- 1; i
++) {
2073 elem
= PLGetArrayElement(pl
, 3 + i
);
2074 if (!elem
|| !PLIsString(elem
)) {
2079 argv
[i
+1] = wstrdup(PLGetString(elem
));
2082 function
= wTextureMakeFunction(scr
, lib
, func
, argc
, argv
);
2086 initFunc
= dlsym(function
->handle
, "initWindowMaker");
2088 initFunc(dpy
, scr
->w_colormap
);
2090 wwarning(_("could not initialize library %s"), lib
);
2093 wwarning(_("could not find function %s::%s"), lib
, func
);
2095 #endif /* HAVE_DLFCN_H */
2096 texture
= (WTexture
*)function
;
2098 #endif /* TEXTURE_PLUGIN */
2100 wwarning(_("invalid texture type %s"), val
);
2109 getTexture(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2112 static WTexture
*texture
;
2116 if (!PLIsArray(value
)) {
2117 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2118 entry
->key
, "Texture");
2120 value
= entry
->plvalue
;
2122 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2128 if (strcmp(entry
->key
, "WidgetColor")==0 && !changed
) {
2131 pl
= PLGetArrayElement(value
, 0);
2132 if (!pl
|| !PLIsString(pl
) || !PLGetString(pl
)
2133 || strcasecmp(PLGetString(pl
), "solid")!=0) {
2134 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2135 entry
->key
, "Solid Texture");
2137 value
= entry
->plvalue
;
2139 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2144 texture
= parse_texture(scr
, value
);
2147 wwarning(_("Error in texture specification for key \"%s\""),
2150 value
= entry
->plvalue
;
2152 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2162 *(WTexture
**)addr
= texture
;
2169 #ifdef DRAWSTRING_PLUGIN
2171 getTextRenderer(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
2172 void *addr
, void **ret
)
2175 char *val
, *lib
, *func
, **argv
;
2178 /* Destroying functions if they are already loaded. */
2179 /* The function will auto-check NULL, does this break any ethic? */
2180 if (strcmp(entry
->key
, "FTitleColor")==0) {
2181 wPluginDestroyFunction(scr
->drawstring_func
[changed
= W_STRING_FTITLE
]);
2182 scr
->drawstring_func
[W_STRING_FTITLE
] = NULL
;
2183 } else if (strcmp(entry
->key
, "UTitleColor")==0) {
2184 wPluginDestroyFunction(scr
->drawstring_func
[changed
= W_STRING_UTITLE
]);
2185 scr
->drawstring_func
[W_STRING_UTITLE
] = NULL
;
2186 } else if (strcmp(entry
->key
, "PTitleColor")==0) {
2187 wPluginDestroyFunction(scr
->drawstring_func
[changed
= W_STRING_PTITLE
]);
2188 scr
->drawstring_func
[W_STRING_PTITLE
] = NULL
;
2189 } else if (strcmp(entry
->key
, "MenuTitleColor")==0) {
2190 wPluginDestroyFunction(scr
->drawstring_func
[changed
= W_STRING_MTITLE
]);
2191 scr
->drawstring_func
[W_STRING_MTITLE
] = NULL
;
2192 } else if (strcmp(entry
->key
, "MenuTextColor")==0) { /* problemssss */
2193 wPluginDestroyFunction(scr
->drawstring_func
[changed
= W_STRING_MTEXT
]);
2194 scr
->drawstring_func
[W_STRING_MTEXT
] = NULL
;
2197 if (PLIsArray(value
)) {
2198 if ((argc
= PLGetNumberOfElements(value
)) < 4) return False
;
2200 argv
= (char **)wmalloc(argc
* sizeof(char *));
2202 elem
= PLGetArrayElement(value
,0);
2203 if (!elem
|| !PLIsString(elem
)) return False
;
2204 val
= PLGetString(elem
);
2205 if (strcasecmp(val
, "function")==0) {
2206 elem
= PLGetArrayElement(value
, 1); /* library name */
2207 if (!elem
|| !PLIsString(elem
)) return False
;
2208 lib
= PLGetString(elem
);
2209 elem
= PLGetArrayElement(value
, 2); /* function name */
2210 if (!elem
|| !PLIsString(elem
)) return False
;
2211 func
= PLGetString(elem
);
2212 scr
->drawstring_func
[changed
] = wPluginCreateFunction (W_FUNCTION_DRAWSTRING
,
2213 lib
, "initDrawString", func
, "destroyDrawString", value
,
2214 wPluginPackInitData(3, dpy
, scr
->w_colormap
,"-DATA-"));
2217 return getColor(scr
, entry
, PLGetArrayElement(value
,3), addr
, ret
);
2218 } else if (PLIsString(value
)) {
2219 return getColor(scr
, entry
, value
, addr
, ret
);
2224 #endif /* DRAWSTRING_PLUGIN */
2229 getWSBackground(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
2230 void *addr
, void **ret
)
2238 if (!PLIsArray(value
)) {
2239 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2240 "WorkspaceBack", "Texture or None");
2242 value
= entry
->plvalue
;
2244 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2250 /* only do basic error checking and verify for None texture */
2252 nelem
= PLGetNumberOfElements(value
);
2254 elem
= PLGetArrayElement(value
, 0);
2255 if (!elem
|| !PLIsString(elem
)) {
2256 wwarning(_("Wrong type for workspace background. Should be a texture type."));
2258 value
= entry
->plvalue
;
2260 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2265 val
= PLGetString(elem
);
2267 if (strcasecmp(val
, "None")==0)
2270 *ret
= PLRetain(value
);
2277 getWSSpecificBackground(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
2278 void *addr
, void **ret
)
2285 if (!PLIsArray(value
)) {
2286 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2287 "WorkspaceSpecificBack", "an array of textures");
2289 value
= entry
->plvalue
;
2291 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2297 /* only do basic error checking and verify for None texture */
2299 nelem
= PLGetNumberOfElements(value
);
2302 elem
= PLGetArrayElement(value
, nelem
);
2303 if (!elem
|| !PLIsArray(elem
)) {
2304 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2310 *ret
= PLRetain(value
);
2314 * Kluge to force wmsetbg helper to set the default background.
2315 * If the WorkspaceSpecificBack is changed once wmaker has started,
2316 * the WorkspaceBack won't be sent to the helper, unless the user
2317 * changes it's value too. So, we must force this by removing the
2318 * value from the defaults DB.
2320 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2321 proplist_t key
= PLMakeString("WorkspaceBack");
2323 PLRemoveDictionaryEntry(WDWindowMaker
->dictionary
, key
);
2333 getFont(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2336 static WMFont
*font
;
2339 GET_STRING_OR_DEFAULT("Font", val
);
2341 font
= WMCreateFont(scr
->wmscreen
, val
);
2343 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2346 wfatal(_("could not load any usable font!!!"));
2353 /* can't assign font value outside update function */
2354 wassertrv(addr
== NULL
, True
);
2361 getColor(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2364 static XColor color
;
2368 GET_STRING_OR_DEFAULT("Color", val
);
2372 if (!wGetColor(scr
, val
, &color
)) {
2373 wwarning(_("could not get color for key \"%s\""),
2375 if (second_pass
==0) {
2376 val
= PLGetString(entry
->plvalue
);
2378 wwarning(_("using default \"%s\" instead"), val
);
2390 *(unsigned long*)addr = pixel;
2399 getKeybind(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2402 static WShortKey shortcut
;
2409 GET_STRING_OR_DEFAULT("Key spec", val
);
2411 if (!val
|| strcasecmp(val
, "NONE")==0) {
2412 shortcut
.keycode
= 0;
2413 shortcut
.modifier
= 0;
2424 shortcut
.modifier
= 0;
2425 while ((k
= strchr(b
, '+'))!=NULL
) {
2429 mod
= wXModifierFromKey(b
);
2431 wwarning(_("%s:invalid key modifier \"%s\""), entry
->key
, b
);
2434 shortcut
.modifier
|= mod
;
2440 ksym
= XStringToKeysym(b
);
2442 if (ksym
==NoSymbol
) {
2443 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
,
2448 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2449 if (shortcut
.keycode
==0) {
2450 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2462 getModMask(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2465 static unsigned int mask
;
2468 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2473 mask
= wXModifierFromKey(str
);
2475 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2481 *(unsigned int*)addr
= mask
;
2492 getRImages(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
2493 void *addr
, void **ret
)
2501 GET_STRING_OR_DEFAULT("Image File Path", str
);
2505 image
= RLoadImage(scr
->rcontext
, str
, 0);
2507 wwarning(_("could not load image in option %s: %s"), entry
->key
,
2508 RMessageForError(RErrorCode
));
2512 if (*(RImage
**)addr
) {
2513 RDestroyImage(*(RImage
**)addr
);
2516 *(RImage
**)addr
= image
;
2518 assert(ret
== NULL
);
2521 *(RImage**)ret = image;
2528 #ifdef DEFINABLE_CURSOR
2530 # include <X11/cursorfont.h>
2537 #define CURSOR_ID_NONE (XC_num_glyphs)
2539 static WCursorLookup cursor_table
[] =
2541 { "X_cursor", XC_X_cursor
},
2542 { "arrow", XC_arrow
},
2543 { "based_arrow_down", XC_based_arrow_down
},
2544 { "based_arrow_up", XC_based_arrow_up
},
2545 { "boat", XC_boat
},
2546 { "bogosity", XC_bogosity
},
2547 { "bottom_left_corner", XC_bottom_left_corner
},
2548 { "bottom_right_corner", XC_bottom_right_corner
},
2549 { "bottom_side", XC_bottom_side
},
2550 { "bottom_tee", XC_bottom_tee
},
2551 { "box_spiral", XC_box_spiral
},
2552 { "center_ptr", XC_center_ptr
},
2553 { "circle", XC_circle
},
2554 { "clock", XC_clock
},
2555 { "coffee_mug", XC_coffee_mug
},
2556 { "cross", XC_cross
},
2557 { "cross_reverse", XC_cross_reverse
},
2558 { "crosshair", XC_crosshair
},
2559 { "diamond_cross", XC_diamond_cross
},
2561 { "dotbox", XC_dotbox
},
2562 { "double_arrow", XC_double_arrow
},
2563 { "draft_large", XC_draft_large
},
2564 { "draft_small", XC_draft_small
},
2565 { "draped_box", XC_draped_box
},
2566 { "exchange", XC_exchange
},
2567 { "fleur", XC_fleur
},
2568 { "gobbler", XC_gobbler
},
2569 { "gumby", XC_gumby
},
2570 { "hand1", XC_hand1
},
2571 { "hand2", XC_hand2
},
2572 { "heart", XC_heart
},
2573 { "icon", XC_icon
},
2574 { "iron_cross", XC_iron_cross
},
2575 { "left_ptr", XC_left_ptr
},
2576 { "left_side", XC_left_side
},
2577 { "left_tee", XC_left_tee
},
2578 { "leftbutton", XC_leftbutton
},
2579 { "ll_angle", XC_ll_angle
},
2580 { "lr_angle", XC_lr_angle
},
2582 { "middlebutton", XC_middlebutton
},
2583 { "mouse", XC_mouse
},
2584 { "pencil", XC_pencil
},
2585 { "pirate", XC_pirate
},
2586 { "plus", XC_plus
},
2587 { "question_arrow", XC_question_arrow
},
2588 { "right_ptr", XC_right_ptr
},
2589 { "right_side", XC_right_side
},
2590 { "right_tee", XC_right_tee
},
2591 { "rightbutton", XC_rightbutton
},
2592 { "rtl_logo", XC_rtl_logo
},
2593 { "sailboat", XC_sailboat
},
2594 { "sb_down_arrow", XC_sb_down_arrow
},
2595 { "sb_h_double_arrow", XC_sb_h_double_arrow
},
2596 { "sb_left_arrow", XC_sb_left_arrow
},
2597 { "sb_right_arrow", XC_sb_right_arrow
},
2598 { "sb_up_arrow", XC_sb_up_arrow
},
2599 { "sb_v_double_arrow", XC_sb_v_double_arrow
},
2600 { "shuttle", XC_shuttle
},
2601 { "sizing", XC_sizing
},
2602 { "spider", XC_spider
},
2603 { "spraycan", XC_spraycan
},
2604 { "star", XC_star
},
2605 { "target", XC_target
},
2606 { "tcross", XC_tcross
},
2607 { "top_left_arrow", XC_top_left_arrow
},
2608 { "top_left_corner", XC_top_left_corner
},
2609 { "top_right_corner", XC_top_right_corner
},
2610 { "top_side", XC_top_side
},
2611 { "top_tee", XC_top_tee
},
2612 { "trek", XC_trek
},
2613 { "ul_angle", XC_ul_angle
},
2614 { "umbrella", XC_umbrella
},
2615 { "ur_angle", XC_ur_angle
},
2616 { "watch", XC_watch
},
2617 { "xterm", XC_xterm
},
2618 { NULL
, CURSOR_ID_NONE
}
2622 check_bitmap_status(int status
, char *filename
, Pixmap bitmap
)
2625 case BitmapOpenFailed
:
2626 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2628 case BitmapFileInvalid
:
2629 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2631 case BitmapNoMemory
:
2632 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2635 XFreePixmap(dpy
, bitmap
);
2642 * (builtin, <cursor_name>)
2643 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2646 parse_cursor(WScreen
*scr
, proplist_t pl
, Cursor
*cursor
)
2653 nelem
= PLGetNumberOfElements(pl
);
2657 elem
= PLGetArrayElement(pl
, 0);
2658 if (!elem
|| !PLIsString(elem
)) {
2661 val
= PLGetString(elem
);
2663 if (0 == strcasecmp(val
, "none")) {
2666 } else if (0 == strcasecmp(val
, "builtin")) {
2668 int cursor_id
= CURSOR_ID_NONE
;
2671 wwarning(_("bad number of arguments in cursor specification"));
2674 elem
= PLGetArrayElement(pl
, 1);
2675 if (!elem
|| !PLIsString(elem
)) {
2678 val
= PLGetString(elem
);
2680 for (i
= 0; NULL
!= cursor_table
[i
].name
; i
++) {
2681 if (0 == strcasecmp(val
, cursor_table
[i
].name
)) {
2682 cursor_id
= cursor_table
[i
].id
;
2686 if (CURSOR_ID_NONE
== cursor_id
) {
2687 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2689 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2692 } else if (0 == strcasecmp(val
, "bitmap")) {
2704 wwarning(_("bad number of arguments in cursor specification"));
2707 elem
= PLGetArrayElement(pl
, 1);
2708 if (!elem
|| !PLIsString(elem
)) {
2711 val
= PLGetString(elem
);
2712 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2714 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2717 elem
= PLGetArrayElement(pl
, 2);
2718 if (!elem
|| !PLIsString(elem
)) {
2722 val
= PLGetString(elem
);
2723 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2726 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2729 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
,
2731 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
,
2733 if ((BitmapSuccess
== bitmap_status
) &&
2734 (BitmapSuccess
== mask_status
)) {
2735 fg
.pixel
= scr
->black_pixel
;
2736 bg
.pixel
= scr
->white_pixel
;
2737 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2738 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2739 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2742 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2743 check_bitmap_status(mask_status
, mask_name
, mask
);
2752 getCursor(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2755 static Cursor cursor
;
2760 if (!PLIsArray(value
)) {
2761 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2762 entry
->key
, "cursor specification");
2764 value
= entry
->plvalue
;
2766 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2771 status
= parse_cursor(scr
, value
, &cursor
);
2773 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2775 value
= entry
->plvalue
;
2777 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2786 *(Cursor
*)addr
= cursor
;
2790 #undef CURSOR_ID_NONE
2792 #endif /* DEFINABLE_CURSOR */
2795 /* ---------------- value setting functions --------------- */
2797 setJustify(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
2799 return REFRESH_WINDOW_TITLE_COLOR
;
2803 setClearance(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
2805 return REFRESH_WINDOW_FONT
|REFRESH_BUTTON_IMAGES
|REFRESH_MENU_TITLE_FONT
|REFRESH_MENU_FONT
;
2809 setIfDockPresent(WScreen
*scr
, WDefaultEntry
*entry
, char *flag
, long which
)
2813 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2816 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2826 setStickyIcons(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
2828 if (scr
->workspaces
) {
2829 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2830 wArrangeIcons(scr
, False
);
2837 setPositive(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
2849 setIconTile(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
2855 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2856 wPreferences
.icon_size
,
2857 ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2858 ? WREL_ICON
: WREL_FLAT
);
2860 wwarning(_("could not render texture for icon background"));
2862 wTextureDestroy(scr
, *texture
);
2865 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2867 if (scr
->icon_tile
) {
2869 RDestroyImage(scr
->icon_tile
);
2870 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2873 scr
->icon_tile
= img
;
2876 /* put the icon in the noticeboard hint */
2877 PropSetIconTileHint(scr
, img
);
2880 if (!wPreferences
.flags
.noclip
) {
2881 if (scr
->clip_tile
) {
2882 RDestroyImage(scr
->clip_tile
);
2884 scr
->clip_tile
= wClipMakeTile(scr
, img
);
2887 scr
->icon_tile_pixmap
= pixmap
;
2889 if (scr
->def_icon_pixmap
) {
2890 XFreePixmap(dpy
, scr
->def_icon_pixmap
);
2891 scr
->def_icon_pixmap
= None
;
2893 if (scr
->def_ticon_pixmap
) {
2894 XFreePixmap(dpy
, scr
->def_ticon_pixmap
);
2895 scr
->def_ticon_pixmap
= None
;
2898 if (scr
->icon_back_texture
) {
2899 wTextureDestroy(scr
, (WTexture
*)scr
->icon_back_texture
);
2901 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2903 if (scr
->clip_balloon
)
2904 XSetWindowBackground(dpy
, scr
->clip_balloon
,
2905 (*texture
)->any
.color
.pixel
);
2908 * Free the texture as nobody else will use it, nor refer to it.
2911 wTextureDestroy(scr
, *texture
);
2913 return (reset
? REFRESH_ICON_TILE
: 0);
2919 setWinTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2921 if (scr
->title_font
) {
2922 WMReleaseFont(scr
->title_font
);
2924 scr
->title_font
= font
;
2926 return REFRESH_WINDOW_FONT
|REFRESH_BUTTON_IMAGES
;
2931 setMenuTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2933 if (scr
->menu_title_font
) {
2934 WMReleaseFont(scr
->menu_title_font
);
2937 scr
->menu_title_font
= font
;
2939 return REFRESH_MENU_TITLE_FONT
;
2944 setMenuTextFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2946 if (scr
->menu_entry_font
) {
2947 WMReleaseFont(scr
->menu_entry_font
);
2949 scr
->menu_entry_font
= font
;
2951 return REFRESH_MENU_FONT
;
2957 setIconTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2959 if (scr
->icon_title_font
) {
2960 WMReleaseFont(scr
->icon_title_font
);
2963 scr
->icon_title_font
= font
;
2965 return REFRESH_ICON_FONT
;
2970 setClipTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2972 if (scr
->clip_title_font
) {
2973 WMReleaseFont(scr
->clip_title_font
);
2976 scr
->clip_title_font
= font
;
2978 return REFRESH_ICON_FONT
;
2983 setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2985 if (scr
->workspace_name_font
) {
2986 WMReleaseFont(scr
->workspace_name_font
);
2989 scr
->workspace_name_font
= font
;
2996 setHightlight(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
2998 if (scr
->select_pixel
!=scr
->white_pixel
&&
2999 scr
->select_pixel
!=scr
->black_pixel
) {
3000 wFreeColor(scr
, scr
->select_pixel
);
3003 scr
->select_pixel
= color
->pixel
;
3005 return REFRESH_MENU_COLOR
;
3010 setHightlightText(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3012 if (scr
->select_text_pixel
!=scr
->white_pixel
&&
3013 scr
->select_text_pixel
!=scr
->black_pixel
) {
3014 wFreeColor(scr
, scr
->select_text_pixel
);
3017 scr
->select_text_pixel
= color
->pixel
;
3019 return REFRESH_MENU_COLOR
;
3024 setClipTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3026 if (scr
->clip_title_pixel
[index
]!=scr
->white_pixel
&&
3027 scr
->clip_title_pixel
[index
]!=scr
->black_pixel
) {
3028 wFreeColor(scr
, scr
->clip_title_pixel
[index
]);
3030 scr
->clip_title_pixel
[index
] = color
->pixel
;
3032 #ifdef GRADIENT_CLIP_ARROW
3033 if (index
== CLIP_NORMAL
) {
3035 RColor color1
, color2
;
3036 int pt
= CLIP_BUTTON_SIZE
*wPreferences
.icon_size
/64;
3037 int as
= pt
- 15; /* 15 = 5+5+5 */
3039 FREE_PIXMAP(scr
->clip_arrow_gradient
);
3041 color1
.red
= (color
->red
>> 8)*6/10;
3042 color1
.green
= (color
->green
>> 8)*6/10;
3043 color1
.blue
= (color
->blue
>> 8)*6/10;
3045 color2
.red
= WMIN((color
->red
>> 8)*20/10, 255);
3046 color2
.green
= WMIN((color
->green
>> 8)*20/10, 255);
3047 color2
.blue
= WMIN((color
->blue
>> 8)*20/10, 255);
3049 image
= RRenderGradient(as
+1, as
+1, &color1
, &color2
, RDiagonalGradient
);
3050 RConvertImage(scr
->rcontext
, image
, &scr
->clip_arrow_gradient
);
3051 RDestroyImage(image
);
3053 #endif /* GRADIENT_CLIP_ARROW */
3055 return REFRESH_ICON_TITLE_COLOR
;
3060 setWTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3062 if (scr
->window_title_pixel
[index
]!=scr
->white_pixel
&&
3063 scr
->window_title_pixel
[index
]!=scr
->black_pixel
) {
3064 wFreeColor(scr
, scr
->window_title_pixel
[index
]);
3067 scr
->window_title_pixel
[index
] = color
->pixel
;
3069 if (index
== WS_UNFOCUSED
)
3070 XSetForeground(dpy
, scr
->info_text_gc
, color
->pixel
);
3072 return REFRESH_WINDOW_TITLE_COLOR
;
3077 setMenuTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3079 if (scr
->menu_title_pixel
[0]!=scr
->white_pixel
&&
3080 scr
->menu_title_pixel
[0]!=scr
->black_pixel
) {
3081 #ifdef DRAWSTRING_PLUGIN
3082 if(!scr
->drawstring_func
[W_STRING_MTITLE
])
3084 wFreeColor(scr
, scr
->menu_title_pixel
[0]);
3087 scr
->menu_title_pixel
[0] = color
->pixel
;
3088 XSetForeground(dpy
, scr
->menu_title_gc
, color
->pixel
);
3090 return REFRESH_MENU_TITLE_COLOR
;
3095 setMenuTextColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3098 #define gcm (GCForeground|GCBackground|GCFillStyle)
3100 if (scr
->mtext_pixel
!=scr
->white_pixel
&&
3101 scr
->mtext_pixel
!=scr
->black_pixel
) {
3102 wFreeColor(scr
, scr
->mtext_pixel
);
3105 scr
->mtext_pixel
= color
->pixel
;
3107 XSetForeground(dpy
, scr
->menu_entry_gc
, color
->pixel
);
3110 if (scr
->dtext_pixel
== scr
->mtext_pixel
) {
3111 gcv
.foreground
= scr
->white_pixel
;
3112 gcv
.background
= scr
->black_pixel
;
3113 gcv
.fill_style
= FillStippled
;
3115 gcv
.foreground
= scr
->dtext_pixel
;
3116 gcv
.fill_style
= FillSolid
;
3118 XChangeGC(dpy
, scr
->disabled_menu_entry_gc
, gcm
, &gcv
);
3120 return REFRESH_MENU_COLOR
;
3126 setMenuDisabledColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3129 #define gcm (GCForeground|GCBackground|GCFillStyle)
3131 if (scr
->dtext_pixel
!=scr
->white_pixel
&&
3132 scr
->dtext_pixel
!=scr
->black_pixel
) {
3133 wFreeColor(scr
, scr
->dtext_pixel
);
3136 scr
->dtext_pixel
= color
->pixel
;
3138 if (scr
->dtext_pixel
== scr
->mtext_pixel
) {
3139 gcv
.foreground
= scr
->white_pixel
;
3140 gcv
.background
= scr
->black_pixel
;
3141 gcv
.fill_style
= FillStippled
;
3143 gcv
.foreground
= scr
->dtext_pixel
;
3144 gcv
.fill_style
= FillSolid
;
3146 XChangeGC(dpy
, scr
->disabled_menu_entry_gc
, gcm
, &gcv
);
3148 return REFRESH_MENU_COLOR
;
3153 setIconTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3155 XSetForeground(dpy
, scr
->icon_title_gc
, color
->pixel
);
3157 return REFRESH_ICON_TITLE_COLOR
;
3162 setIconTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3164 if (scr
->icon_title_texture
) {
3165 wTextureDestroy(scr
, (WTexture
*)scr
->icon_title_texture
);
3167 XQueryColor (dpy
, scr
->w_colormap
, color
);
3168 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
3170 return REFRESH_ICON_TITLE_BACK
;
3175 trackDeadProcess(pid_t pid
, unsigned char status
, WScreen
*scr
)
3177 close(scr
->helper_fd
);
3179 scr
->helper_pid
= 0;
3180 scr
->flags
.backimage_helper_launched
= 0;
3185 setWorkspaceSpecificBack(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
3192 if (scr
->flags
.backimage_helper_launched
) {
3193 if (PLGetNumberOfElements(value
)==0) {
3194 SendHelperMessage(scr
, 'C', 0, NULL
);
3195 SendHelperMessage(scr
, 'K', 0, NULL
);
3204 if (PLGetNumberOfElements(value
) == 0)
3207 if (pipe(filedes
) < 0) {
3208 wsyserror("pipe() failed:can't set workspace specific background image");
3216 wsyserror("fork() failed:can't set workspace specific background image");
3217 if (close(filedes
[0]) < 0)
3218 wsyserror("could not close pipe");
3219 if (close(filedes
[1]) < 0)
3220 wsyserror("could not close pipe");
3222 } else if (pid
== 0) {
3223 SetupEnvironment(scr
);
3226 wsyserror("could not close pipe");
3227 if (dup(filedes
[0]) < 0) {
3228 wsyserror("dup() failed:can't set workspace specific background image");
3230 if (wPreferences
.smooth_workspace_back
)
3231 execlp("wmsetbg", "wmsetbg", "-helper", "-S", "-d", NULL
);
3233 execlp("wmsetbg", "wmsetbg", "-helper", "-d", NULL
);
3234 wsyserror("could not execute wmsetbg");
3238 if (fcntl(filedes
[0], F_SETFD
, FD_CLOEXEC
) < 0) {
3239 wsyserror("error setting close-on-exec flag");
3241 if (fcntl(filedes
[1], F_SETFD
, FD_CLOEXEC
) < 0) {
3242 wsyserror("error setting close-on-exec flag");
3245 scr
->helper_fd
= filedes
[1];
3246 scr
->helper_pid
= pid
;
3247 scr
->flags
.backimage_helper_launched
= 1;
3249 wAddDeathHandler(pid
, (WDeathHandler
*)trackDeadProcess
, scr
);
3251 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3256 for (i
= 0; i
< PLGetNumberOfElements(value
); i
++) {
3257 val
= PLGetArrayElement(value
, i
);
3258 if (val
&& PLIsArray(val
) && PLGetNumberOfElements(val
)>0) {
3259 str
= PLGetDescription(val
);
3261 SendHelperMessage(scr
, 'S', i
+1, str
);
3265 SendHelperMessage(scr
, 'U', i
+1, NULL
);
3276 setWorkspaceBack(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
3279 if (scr
->flags
.backimage_helper_launched
) {
3282 if (PLGetNumberOfElements(value
)==0) {
3283 SendHelperMessage(scr
, 'U', 0, NULL
);
3285 /* set the default workspace background to this one */
3286 str
= PLGetDescription(value
);
3288 SendHelperMessage(scr
, 'S', 0, str
);
3290 SendHelperMessage(scr
, 'C', scr
->current_workspace
+1, NULL
);
3292 SendHelperMessage(scr
, 'U', 0, NULL
);
3295 } else if (PLGetNumberOfElements(value
) > 0) {
3299 SetupEnvironment(scr
);
3300 text
= PLGetDescription(value
);
3301 command
= wmalloc(strlen(text
)+40);
3302 if (wPreferences
.smooth_workspace_back
)
3303 sprintf(command
, "wmsetbg -d -S -p '%s' &", text
);
3305 sprintf(command
, "wmsetbg -d -p '%s' &", text
);
3317 setWidgetColor(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3319 if (scr
->widget_texture
) {
3320 wTextureDestroy(scr
, (WTexture
*)scr
->widget_texture
);
3322 scr
->widget_texture
= *(WTexSolid
**)texture
;
3329 setFTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3331 if (scr
->window_title_texture
[WS_FOCUSED
]) {
3332 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3334 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3336 return REFRESH_WINDOW_TEXTURES
;
3341 setPTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3343 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
3344 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3346 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3348 return REFRESH_WINDOW_TEXTURES
;
3353 setUTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3355 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
3356 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3358 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3360 return REFRESH_WINDOW_TEXTURES
;
3365 setResizebarBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3367 if (scr
->resizebar_texture
[0]) {
3368 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3370 scr
->resizebar_texture
[0] = *texture
;
3372 return REFRESH_WINDOW_TEXTURES
;
3377 setMenuTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3379 if (scr
->menu_title_texture
[0]) {
3380 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3382 scr
->menu_title_texture
[0] = *texture
;
3384 return REFRESH_MENU_TITLE_TEXTURE
;
3389 setMenuTextBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3391 if (scr
->menu_item_texture
) {
3392 wTextureDestroy(scr
, scr
->menu_item_texture
);
3393 wTextureDestroy(scr
, (WTexture
*)scr
->menu_item_auxtexture
);
3395 scr
->menu_item_texture
= *texture
;
3397 scr
->menu_item_auxtexture
3398 = wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3400 return REFRESH_MENU_TEXTURE
;
3405 setKeyGrab(WScreen
*scr
, WDefaultEntry
*entry
, WShortKey
*shortcut
, long index
)
3408 wKeyBindings
[index
] = *shortcut
;
3410 wwin
= scr
->focused_window
;
3412 while (wwin
!=NULL
) {
3413 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3415 if (!WFLAGP(wwin
, no_bind_keys
)) {
3416 wWindowSetKeyGrabs(wwin
);
3426 setIconPosition(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
3428 wArrangeIcons(scr
, True
);
3435 updateUsableArea(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
3437 wScreenUpdateUsableArea(scr
);
3444 setMenuStyle(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
3446 return REFRESH_MENU_TEXTURE
;
3452 setButtonImages(WScreen *scr, WDefaultEntry *entry, int *value, void *foo)
3454 return REFRESH_BUTTON_IMAGES;
3460 * Need access to the double click variables, so that all widgets in
3461 * wmaker panels will have the same dbl-click values.
3462 * TODO: figure a better way of dealing with it.
3467 setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
3469 extern _WINGsConfiguration WINGsConfiguration
;
3474 WINGsConfiguration
.doubleClickDelay
= *value
;
3482 setMultiByte(WScreen
*scr
, WDefaultEntry
*entry
, char *value
, void *foo
)
3484 extern _WINGsConfiguration WINGsConfiguration
;
3486 WINGsConfiguration
.useMultiByte
= *value
;
3492 #ifdef DEFINABLE_CURSOR
3494 setCursor(WScreen
*scr
, WDefaultEntry
*entry
, Cursor
*cursor
, long index
)
3496 if (None
!= wCursor
[index
])
3498 XFreeCursor(dpy
, wCursor
[index
]);
3501 wCursor
[index
] = *cursor
;
3503 if ((WCUR_ROOT
== index
) && (None
!= *cursor
))
3505 XDefineCursor(dpy
, scr
->root_win
, *cursor
);
3510 #endif /* DEFINABLE_CURSOR*/