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
;
87 extern int wScreenCount
;
89 extern Atom _XA_WINDOWMAKER_ICON_SIZE
;
90 extern Atom _XA_WINDOWMAKER_ICON_TILE
;
93 extern proplist_t wDomainName;
94 extern proplist_t wAttributeDomainName;
96 extern WPreferences wPreferences
;
98 extern WShortKey wKeyBindings
[WKBD_LAST
];
108 proplist_t plvalue
; /* default value */
112 /* used to map strings to integers */
117 } WOptionEnumeration
;
120 /* type converters */
121 static int getBool();
123 static int getCoord();
125 /* this is not used yet */
126 static int getString();
128 static int getPathList();
129 static int getEnum();
130 static int getTexture();
131 #ifdef DRAWSTRING_PLUGIN
132 static int getTextRenderer();
134 static int getWSBackground();
135 static int getWSSpecificBackground();
136 static int getFont();
137 static int getColor();
138 static int getKeybind();
139 static int getModMask();
141 static int getRImage();
145 /* value setting functions */
146 static int setJustify();
147 static int setClearance();
148 static int setIfDockPresent();
149 static int setStickyIcons();
151 static int setPositive();
153 static int setWidgetColor();
154 static int setIconTile();
155 static int setWinTitleFont();
156 static int setMenuTitleFont();
157 static int setMenuTextFont();
158 static int setIconTitleFont();
159 static int setIconTitleColor();
160 static int setIconTitleBack();
161 static int setLargeDisplayFont();
162 static int setWTitleColor();
163 static int setFTitleBack();
164 static int setPTitleBack();
165 static int setUTitleBack();
166 static int setResizebarBack();
167 static int setWorkspaceBack();
168 static int setWorkspaceSpecificBack();
169 static int setMenuTitleColor();
170 static int setMenuTextColor();
171 static int setMenuDisabledColor();
172 static int setMenuTitleBack();
173 static int setMenuTextBack();
174 static int setHightlight();
175 static int setHightlightText();
176 static int setKeyGrab();
177 static int setDoubleClick();
178 static int setIconPosition();
180 static int setClipTitleFont();
181 static int setClipTitleColor();
183 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
379 ,{"MultiByteText", "NO", NULL
,
380 &wPreferences
.multi_byte_text
, getBool
, setMultiByte
387 WDefaultEntry optionList
[] = {
388 /* dynamic options */
389 {"IconPosition", "blh", seIconPositions
,
390 &wPreferences
.icon_yard
, getEnum
, setIconPosition
392 {"IconificationStyle", "Zoom", seIconificationStyles
,
393 &wPreferences
.iconification_style
, getEnum
, NULL
395 {"SelectWindowsMouseButton", "Left", seMouseButtons
,
396 &wPreferences
.select_button
, getEnum
, NULL
398 {"WindowListMouseButton", "Middle", seMouseButtons
,
399 &wPreferences
.windowl_button
, getEnum
, NULL
401 {"ApplicationMenuMouseButton", "Right", seMouseButtons
,
402 &wPreferences
.menu_button
, getEnum
, NULL
404 {"PixmapPath", DEF_PIXMAP_PATHS
, NULL
,
405 &wPreferences
.pixmap_path
, getPathList
, NULL
407 {"IconPath", DEF_ICON_PATHS
, NULL
,
408 &wPreferences
.icon_path
, getPathList
, NULL
410 {"ColormapMode", "auto", seColormapModes
,
411 &wPreferences
.colormap_mode
, getEnum
, NULL
413 {"AutoFocus", "NO", NULL
,
414 &wPreferences
.auto_focus
, getBool
, NULL
416 {"RaiseDelay", "0", NULL
,
417 &wPreferences
.raise_delay
, getInt
, NULL
419 {"WindozeCycling", "YES", NULL
,
420 &wPreferences
.windows_cycling
,getBool
, NULL
422 {"CirculateRaise", "NO", NULL
,
423 &wPreferences
.circ_raise
, getBool
, NULL
425 {"Superfluous", "NO", NULL
,
426 &wPreferences
.superfluous
, getBool
, NULL
428 {"AdvanceToNewWorkspace", "NO", NULL
,
429 &wPreferences
.ws_advance
, getBool
, NULL
431 {"CycleWorkspaces", "NO", NULL
,
432 &wPreferences
.ws_cycle
, getBool
, NULL
434 {"WorkspaceNameDisplayPosition", "center", seDisplayPositions
,
435 &wPreferences
.workspace_name_display_position
, getEnum
, NULL
437 {"WorkspaceBorder", "None", seWorkspaceBorder
,
438 &wPreferences
.workspace_border_position
, getEnum
, updateUsableArea
440 {"WorkspaceBorderSize", "0", NULL
,
441 &wPreferences
.workspace_border_size
, getInt
, updateUsableArea
443 #ifdef VIRTUAL_DESKTOP
444 {"VirtualEdgeThickness", "1", NULL
,
445 &wPreferences
.vedge_thickness
, getInt
, NULL
447 {"VirtualEdgeHorizonScrollSpeed", "1", NULL
,
448 &wPreferences
.vedge_hscrollspeed
, getInt
, NULL
450 {"VirtualEdgeVerticalScrollSpeed", "1", NULL
,
451 &wPreferences
.vedge_vscrollspeed
, getInt
, NULL
453 {"VirtualEdgeWidth", "2000", NULL
,
454 &wPreferences
.vedge_width
, getInt
, NULL
456 {"VirtualEdgeHeight", "2000", NULL
,
457 &wPreferences
.vedge_height
, getInt
, NULL
460 {"StickyIcons", "NO", NULL
,
461 &wPreferences
.sticky_icons
, getBool
, setStickyIcons
463 {"SaveSessionOnExit", "NO", NULL
,
464 &wPreferences
.save_session_on_exit
, getBool
, NULL
466 {"WrapMenus", "NO", NULL
,
467 &wPreferences
.wrap_menus
, getBool
, NULL
469 {"ScrollableMenus", "NO", NULL
,
470 &wPreferences
.scrollable_menus
, getBool
, NULL
472 {"MenuScrollSpeed", "medium", seSpeeds
,
473 &wPreferences
.menu_scroll_speed
, getEnum
, NULL
475 {"IconSlideSpeed", "medium", seSpeeds
,
476 &wPreferences
.icon_slide_speed
, getEnum
, NULL
478 {"ShadeSpeed", "medium", seSpeeds
,
479 &wPreferences
.shade_speed
, getEnum
, NULL
481 {"DoubleClickTime", "250", (void*) &wPreferences
.dblclick_time
,
482 &wPreferences
.dblclick_time
, getInt
, setDoubleClick
,
484 {"AlignSubmenus", "NO", NULL
,
485 &wPreferences
.align_menus
, getBool
, NULL
487 {"OpenTransientOnOwnerWorkspace", "NO", NULL
,
488 &wPreferences
.open_transients_with_parent
, getBool
, NULL
490 {"WindowPlacement", "auto", sePlacements
,
491 &wPreferences
.window_placement
, getEnum
, NULL
493 {"IgnoreFocusClick","NO", NULL
,
494 &wPreferences
.ignore_focus_click
, getBool
, NULL
496 {"UseSaveUnders", "NO", NULL
,
497 &wPreferences
.use_saveunders
, getBool
, NULL
499 {"OpaqueMove", "NO", NULL
,
500 &wPreferences
.opaque_move
, getBool
, NULL
502 {"DisableSound", "NO", NULL
,
503 &wPreferences
.no_sound
, getBool
, NULL
505 {"DisableAnimations", "NO", NULL
,
506 &wPreferences
.no_animations
, getBool
, NULL
508 {"DontLinkWorkspaces","NO", NULL
,
509 &wPreferences
.no_autowrap
, getBool
, NULL
511 {"AutoArrangeIcons", "NO", NULL
,
512 &wPreferences
.auto_arrange_icons
, getBool
, NULL
514 {"NoWindowOverDock", "NO", NULL
,
515 &wPreferences
.no_window_over_dock
, getBool
, updateUsableArea
517 {"NoWindowOverIcons", "NO", NULL
,
518 &wPreferences
.no_window_over_icons
, getBool
, updateUsableArea
520 {"WindowPlaceOrigin", "(0, 0)", NULL
,
521 &wPreferences
.window_place_origin
, getCoord
, NULL
523 {"ResizeDisplay", "corner", seGeomDisplays
,
524 &wPreferences
.size_display
, getEnum
, NULL
526 {"MoveDisplay", "corner", seGeomDisplays
,
527 &wPreferences
.move_display
, getEnum
, NULL
529 {"DontConfirmKill", "NO", NULL
,
530 &wPreferences
.dont_confirm_kill
, getBool
,NULL
532 {"WindowTitleBalloons", "NO", NULL
,
533 &wPreferences
.window_balloon
, getBool
, NULL
535 {"MiniwindowTitleBalloons", "NO", NULL
,
536 &wPreferences
.miniwin_balloon
,getBool
, NULL
538 {"AppIconBalloons", "NO", NULL
,
539 &wPreferences
.appicon_balloon
,getBool
, NULL
541 {"HelpBalloons", "NO", NULL
,
542 &wPreferences
.help_balloon
, getBool
, NULL
544 {"EdgeResistance", "30", NULL
,
545 &wPreferences
.edge_resistance
,getInt
, NULL
547 {"Attraction", "NO", NULL
,
548 &wPreferences
.attract
, getBool
, NULL
550 {"DisableBlinking", "NO", NULL
,
551 &wPreferences
.dont_blink
, getBool
, NULL
554 {"MenuStyle", "normal", seMenuStyles
,
555 &wPreferences
.menu_style
, getEnum
, setMenuStyle
557 {"WidgetColor", "(solid, gray)", NULL
,
558 NULL
, getTexture
, setWidgetColor
,
560 {"WorkspaceSpecificBack","()", NULL
,
561 NULL
, getWSSpecificBackground
, setWorkspaceSpecificBack
563 /* WorkspaceBack must come after WorkspaceSpecificBack or
564 * WorkspaceBack wont know WorkspaceSpecificBack was also
565 * specified and 2 copies of wmsetbg will be launched */
566 {"WorkspaceBack", "(solid, black)", NULL
,
567 NULL
, getWSBackground
,setWorkspaceBack
569 {"SmoothWorkspaceBack", "NO", NULL
,
572 {"IconBack", "(solid, gray)", NULL
,
573 NULL
, getTexture
, setIconTile
575 {"TitleJustify", "center", seJustifications
,
576 &wPreferences
.title_justification
, getEnum
, setJustify
578 {"WindowTitleFont", DEF_TITLE_FONT
, NULL
,
579 NULL
, getFont
, setWinTitleFont
,
581 {"WindowTitleExtendSpace", DEF_WINDOW_TITLE_EXTEND_SPACE
, NULL
,
582 &wPreferences
.window_title_clearance
, getInt
, setClearance
584 {"MenuTitleExtendSpace", DEF_MENU_TITLE_EXTEND_SPACE
, NULL
,
585 &wPreferences
.menu_title_clearance
, getInt
, setClearance
587 {"MenuTextExtendSpace", DEF_MENU_TEXT_EXTEND_SPACE
, NULL
,
588 &wPreferences
.menu_text_clearance
, getInt
, setClearance
590 {"MenuTitleFont", DEF_MENU_TITLE_FONT
, NULL
,
591 NULL
, getFont
, setMenuTitleFont
593 {"MenuTextFont", DEF_MENU_ENTRY_FONT
, NULL
,
594 NULL
, getFont
, setMenuTextFont
596 {"IconTitleFont", DEF_ICON_TITLE_FONT
, NULL
,
597 NULL
, getFont
, setIconTitleFont
599 {"ClipTitleFont", DEF_CLIP_TITLE_FONT
, NULL
,
600 NULL
, getFont
, setClipTitleFont
602 {"LargeDisplayFont",DEF_WORKSPACE_NAME_FONT
, NULL
,
603 NULL
, getFont
, setLargeDisplayFont
605 {"HighlightColor", "white", NULL
,
606 NULL
, getColor
, setHightlight
608 {"HighlightTextColor", "black", NULL
,
609 NULL
, getColor
, setHightlightText
611 {"ClipTitleColor", "black", (void*)CLIP_NORMAL
,
612 NULL
, getColor
, setClipTitleColor
614 {"CClipTitleColor", "\"#454045\"", (void*)CLIP_COLLAPSED
,
615 NULL
, getColor
, setClipTitleColor
617 #ifdef DRAWSTRING_PLUGIN
618 {"FTitleColor", "white", (void*)WS_FOCUSED
,
619 NULL
, getTextRenderer
, setWTitleColor
621 {"PTitleColor", "white", (void*)WS_PFOCUSED
,
622 NULL
, getTextRenderer
, setWTitleColor
624 {"UTitleColor", "black", (void*)WS_UNFOCUSED
,
625 NULL
, getTextRenderer
, setWTitleColor
628 {"FTitleColor", "white", (void*)WS_FOCUSED
,
629 NULL
, getColor
, setWTitleColor
631 {"PTitleColor", "white", (void*)WS_PFOCUSED
,
632 NULL
, getColor
, setWTitleColor
634 {"UTitleColor", "black", (void*)WS_UNFOCUSED
,
635 NULL
, getColor
, setWTitleColor
638 {"FTitleBack", "(solid, black)", NULL
,
639 NULL
, getTexture
, setFTitleBack
641 {"PTitleBack", "(solid, \"#616161\")", NULL
,
642 NULL
, getTexture
, setPTitleBack
644 {"UTitleBack", "(solid, gray)", NULL
,
645 NULL
, getTexture
, setUTitleBack
647 {"ResizebarBack", "(solid, gray)", NULL
,
648 NULL
, getTexture
, setResizebarBack
650 #ifdef DRAWSTRING_PLUGIN
651 {"MenuTitleColor", "white", NULL
,
652 NULL
, getTextRenderer
, setMenuTitleColor
655 {"MenuTitleColor", "white", NULL
,
656 NULL
, getColor
, setMenuTitleColor
659 {"MenuTextColor", "black", NULL
,
660 NULL
, getColor
, setMenuTextColor
662 {"MenuDisabledColor", "\"#616161\"", NULL
,
663 NULL
, getColor
, setMenuDisabledColor
665 {"MenuTitleBack", "(solid, black)", NULL
,
666 NULL
, getTexture
, setMenuTitleBack
668 {"MenuTextBack", "(solid, gray)", NULL
,
669 NULL
, getTexture
, setMenuTextBack
671 {"IconTitleColor", "white", NULL
,
672 NULL
, getColor
, setIconTitleColor
674 {"IconTitleBack", "black", NULL
,
675 NULL
, getColor
, setIconTitleBack
679 {"RootMenuKey", "None", (void*)WKBD_ROOTMENU
,
680 NULL
, getKeybind
, setKeyGrab
682 {"WindowListKey", "None", (void*)WKBD_WINDOWLIST
,
683 NULL
, getKeybind
, setKeyGrab
686 {"WindowMenuKey", "None", (void*)WKBD_WINDOWMENU
,
687 NULL
, getKeybind
, setKeyGrab
689 {"ClipLowerKey", "None", (void*)WKBD_CLIPLOWER
,
690 NULL
, getKeybind
, setKeyGrab
692 {"ClipRaiseKey", "None", (void*)WKBD_CLIPRAISE
,
693 NULL
, getKeybind
, setKeyGrab
695 {"ClipRaiseLowerKey", "None", (void*)WKBD_CLIPRAISELOWER
,
696 NULL
, getKeybind
, setKeyGrab
698 {"MiniaturizeKey", "None", (void*)WKBD_MINIATURIZE
,
699 NULL
, getKeybind
, setKeyGrab
701 {"HideKey", "None", (void*)WKBD_HIDE
,
702 NULL
, getKeybind
, setKeyGrab
704 {"MoveResizeKey", "None", (void*)WKBD_MOVERESIZE
,
705 NULL
, getKeybind
, setKeyGrab
707 {"CloseKey", "None", (void*)WKBD_CLOSE
,
708 NULL
, getKeybind
, setKeyGrab
710 {"MaximizeKey", "None", (void*)WKBD_MAXIMIZE
,
711 NULL
, getKeybind
, setKeyGrab
713 {"VMaximizeKey", "None", (void*)WKBD_VMAXIMIZE
,
714 NULL
, getKeybind
, setKeyGrab
716 {"RaiseKey", "\"Meta+Up\"", (void*)WKBD_RAISE
,
717 NULL
, getKeybind
, setKeyGrab
719 {"LowerKey", "\"Meta+Down\"", (void*)WKBD_LOWER
,
720 NULL
, getKeybind
, setKeyGrab
722 {"RaiseLowerKey", "None", (void*)WKBD_RAISELOWER
,
723 NULL
, getKeybind
, setKeyGrab
725 {"ShadeKey", "None", (void*)WKBD_SHADE
,
726 NULL
, getKeybind
, setKeyGrab
728 {"SelectKey", "None", (void*)WKBD_SELECT
,
729 NULL
, getKeybind
, setKeyGrab
731 {"FocusNextKey", "None", (void*)WKBD_FOCUSNEXT
,
732 NULL
, getKeybind
, setKeyGrab
734 {"FocusPrevKey", "None", (void*)WKBD_FOCUSPREV
,
735 NULL
, getKeybind
, setKeyGrab
737 {"NextWorkspaceKey", "None", (void*)WKBD_NEXTWORKSPACE
,
738 NULL
, getKeybind
, setKeyGrab
740 {"PrevWorkspaceKey", "None", (void*)WKBD_PREVWORKSPACE
,
741 NULL
, getKeybind
, setKeyGrab
743 {"NextWorkspaceLayerKey", "None", (void*)WKBD_NEXTWSLAYER
,
744 NULL
, getKeybind
, setKeyGrab
746 {"PrevWorkspaceLayerKey", "None", (void*)WKBD_PREVWSLAYER
,
747 NULL
, getKeybind
, setKeyGrab
749 {"Workspace1Key", "None", (void*)WKBD_WORKSPACE1
,
750 NULL
, getKeybind
, setKeyGrab
752 {"Workspace2Key", "None", (void*)WKBD_WORKSPACE2
,
753 NULL
, getKeybind
, setKeyGrab
755 {"Workspace3Key", "None", (void*)WKBD_WORKSPACE3
,
756 NULL
, getKeybind
, setKeyGrab
758 {"Workspace4Key", "None", (void*)WKBD_WORKSPACE4
,
759 NULL
, getKeybind
, setKeyGrab
761 {"Workspace5Key", "None", (void*)WKBD_WORKSPACE5
,
762 NULL
, getKeybind
, setKeyGrab
764 {"Workspace6Key", "None", (void*)WKBD_WORKSPACE6
,
765 NULL
, getKeybind
, setKeyGrab
767 {"Workspace7Key", "None", (void*)WKBD_WORKSPACE7
,
768 NULL
, getKeybind
, setKeyGrab
770 {"Workspace8Key", "None", (void*)WKBD_WORKSPACE8
,
771 NULL
, getKeybind
, setKeyGrab
773 {"Workspace9Key", "None", (void*)WKBD_WORKSPACE9
,
774 NULL
, getKeybind
, setKeyGrab
776 {"Workspace10Key", "None", (void*)WKBD_WORKSPACE10
,
777 NULL
, getKeybind
, setKeyGrab
779 {"WindowShortcut1Key","None", (void*)WKBD_WINDOW1
,
780 NULL
, getKeybind
, setKeyGrab
782 {"WindowShortcut2Key","None", (void*)WKBD_WINDOW2
,
783 NULL
, getKeybind
, setKeyGrab
785 {"WindowShortcut3Key","None", (void*)WKBD_WINDOW3
,
786 NULL
, getKeybind
, setKeyGrab
788 {"WindowShortcut4Key","None", (void*)WKBD_WINDOW4
,
789 NULL
, getKeybind
, setKeyGrab
791 ,{"WindowShortcut5Key","None", (void*)WKBD_WINDOW5
,
792 NULL
, getKeybind
, setKeyGrab
794 {"WindowShortcut6Key","None", (void*)WKBD_WINDOW6
,
795 NULL
, getKeybind
, setKeyGrab
797 {"WindowShortcut7Key","None", (void*)WKBD_WINDOW7
,
798 NULL
, getKeybind
, setKeyGrab
800 {"WindowShortcut8Key","None", (void*)WKBD_WINDOW8
,
801 NULL
, getKeybind
, setKeyGrab
803 {"WindowShortcut9Key","None", (void*)WKBD_WINDOW9
,
804 NULL
, getKeybind
, setKeyGrab
806 {"WindowShortcut10Key","None", (void*)WKBD_WINDOW10
,
807 NULL
, getKeybind
, setKeyGrab
809 {"ScreenSwitchKey", "None", (void*)WKBD_SWITCH_SCREEN
,
810 NULL
, getKeybind
, setKeyGrab
813 #ifdef KEEP_XKB_LOCK_STATUS
814 ,{"ToggleKbdModeKey", "None", (void*)WKBD_TOGGLE
,
815 NULL
, getKeybind
, setKeyGrab
817 {"KbdModeLock", "NO", NULL
,
818 &wPreferences
.modelock
, getBool
, NULL
820 #endif /* KEEP_XKB_LOCK_STATUS */
821 #ifdef DEFINABLE_CURSOR
822 ,{"NormalCursor", "(builtin, left_ptr)", (void*)WCUR_ROOT
,
823 NULL
, getCursor
, setCursor
825 ,{"MoveCursor", "(builtin, fleur)", (void*)WCUR_MOVE
,
826 NULL
, getCursor
, setCursor
829 {"TopLeftResizeCursor", "(builtin, sizing)", (void*)WCUR_TOPLEFTRESIZE
,
830 NULL
, getCursor
, setCursor
832 {"TopRightResizeCursor", "(builtin, sizing)", (void*)WCUR_TOPRIGHTRESIZE
,
833 NULL
, getCursor
, setCursor
835 {"BottomLeftResizeCursor", "(builtin, sizing)", (void*)WCUR_BOTTOMLEFTRESIZE
,
836 NULL
, getCursor
, setCursor
838 {"BottomRightResizeCursor", "(builtin, sizing)", (void*)WCUR_BOTTOMRIGHTRESIZE
,
839 NULL
, getCursor
, setCursor
841 {"VerticalResizeCursor", "(builtin, sizing)", (void*)WCUR_VERTICALRESIZE
,
842 NULL
, getCursor
, setCursor
844 {"HorizonResizeCursor", "(builtin, sizing)", (void*)WCUR_HORIZONRESIZE
,
845 NULL
, getCursor
, setCursor
847 {"WaitCursor", "(builtin, watch)", (void*)WCUR_WAIT
,
848 NULL
, getCursor
, setCursor
850 {"ArrowCursor", "(builtin, top_left_arrow)", (void*)WCUR_ARROW
,
851 NULL
, getCursor
, setCursor
854 #endif /* DEFINABLE_CURSOR */
859 static void rereadDefaults(void);
866 /* must defer the update because accessing X data from a
867 * signal handler can mess up Xlib */
876 WDefaultEntry
*entry
;
878 PLSetStringCmpHook(StringCompareHook
);
880 for (i
=0; i
<sizeof(optionList
)/sizeof(WDefaultEntry
); i
++) {
881 entry
= &optionList
[i
];
883 entry
->plkey
= PLMakeString(entry
->key
);
884 if (entry
->default_value
)
885 entry
->plvalue
= PLGetProplistWithDescription(entry
->default_value
);
887 entry
->plvalue
= NULL
;
890 for (i
=0; i
<sizeof(staticOptionList
)/sizeof(WDefaultEntry
); i
++) {
891 entry
= &staticOptionList
[i
];
893 entry
->plkey
= PLMakeString(entry
->key
);
894 if (entry
->default_value
)
895 entry
->plvalue
= PLGetProplistWithDescription(entry
->default_value
);
897 entry
->plvalue
= NULL
;
901 wDomainName = PLMakeString(WMDOMAIN_NAME);
902 wAttributeDomainName = PLMakeString(WMATTRIBUTE_DOMAIN_NAME);
904 PLRegister(wDomainName, rereadDefaults);
905 PLRegister(wAttributeDomainName, rereadDefaults);
914 wDefaultsInit(int screen_number
)
916 static int defaults_inited
= 0;
919 if (!defaults_inited
) {
923 dict
= PLGetDomain(wDomainName
);
925 wwarning(_("could not read domain \"%s\" from defaults database"),
926 PLGetString(wDomainName
));
935 wDefaultsDestroyDomain(WDDomain
*domain
)
937 if (domain
->dictionary
)
938 PLRelease(domain
->dictionary
);
945 wDefaultsInitDomain(char *domain
, Bool requireDictionary
)
949 static int inited
= 0;
952 proplist_t shared_dict
=NULL
;
959 db
= wmalloc(sizeof(WDDomain
));
960 memset(db
, 0, sizeof(WDDomain
));
961 db
->domain_name
= domain
;
962 db
->path
= wdefaultspathfordomain(domain
);
965 if (the_path
&& stat(the_path
, &stbuf
)>=0) {
966 db
->dictionary
= ReadProplistFromFile(the_path
);
967 if (db
->dictionary
) {
968 if (requireDictionary
&& !PLIsDictionary(db
->dictionary
)) {
969 PLRelease(db
->dictionary
);
970 db
->dictionary
= NULL
;
971 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
974 db
->timestamp
= stbuf
.st_mtime
;
976 wwarning(_("could not load domain %s from user defaults database"),
981 /* global system dictionary */
982 sprintf(path
, "%s/WindowMaker/%s", SYSCONFDIR
, domain
);
983 if (stat(path
, &stbuf
)>=0) {
984 shared_dict
= ReadProplistFromFile(path
);
986 if (requireDictionary
&& !PLIsDictionary(shared_dict
)) {
987 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
989 PLRelease(shared_dict
);
992 if (db
->dictionary
&& PLIsDictionary(shared_dict
) &&
993 PLIsDictionary(db
->dictionary
)) {
994 PLMergeDictionaries(shared_dict
, db
->dictionary
);
995 PLRelease(db
->dictionary
);
996 db
->dictionary
= shared_dict
;
997 if (stbuf
.st_mtime
> db
->timestamp
)
998 db
->timestamp
= stbuf
.st_mtime
;
999 } else if (!db
->dictionary
) {
1000 db
->dictionary
= shared_dict
;
1001 if (stbuf
.st_mtime
> db
->timestamp
)
1002 db
->timestamp
= stbuf
.st_mtime
;
1006 wwarning(_("could not load domain %s from global defaults database (%s)"),
1011 /* set to save it in user's directory, no matter from where it was read */
1012 if (db
->dictionary
) {
1013 proplist_t tmp
= PLMakeString(db
->path
);
1015 PLSetFilename(db
->dictionary
, tmp
);
1024 wReadStaticDefaults(proplist_t dict
)
1027 WDefaultEntry
*entry
;
1032 for (i
=0; i
<sizeof(staticOptionList
)/sizeof(WDefaultEntry
); i
++) {
1033 entry
= &staticOptionList
[i
];
1036 plvalue
= PLGetDictionaryEntry(dict
, entry
->plkey
);
1041 /* no default in the DB. Use builtin default */
1042 plvalue
= entry
->plvalue
;
1047 (*entry
->convert
)(NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
1048 if (entry
->update
) {
1049 (*entry
->update
)(NULL
, entry
, tdata
, entry
->extra_data
);
1057 wDefaultsCheckDomains(void *foo
)
1063 char path
[PATH_MAX
];
1066 puts("Checking domains...");
1068 if (stat(WDWindowMaker
->path
, &stbuf
)>=0
1069 && WDWindowMaker
->timestamp
< stbuf
.st_mtime
) {
1070 proplist_t shared_dict
= NULL
;
1072 puts("Checking WindowMaker domain");
1074 WDWindowMaker
->timestamp
= stbuf
.st_mtime
;
1076 /* global dictionary */
1077 sprintf(path
, "%s/WindowMaker/WindowMaker", SYSCONFDIR
);
1078 if (stat(path
, &stbuf
)>=0) {
1079 shared_dict
= ReadProplistFromFile(path
);
1080 if (shared_dict
&& !PLIsDictionary(shared_dict
)) {
1081 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
1082 "WindowMaker", path
);
1083 PLRelease(shared_dict
);
1085 } else if (!shared_dict
) {
1086 wwarning(_("could not load domain %s from global defaults database"),
1090 /* user dictionary */
1091 dict
= ReadProplistFromFile(WDWindowMaker
->path
);
1093 if (!PLIsDictionary(dict
)) {
1096 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1097 "WindowMaker", WDWindowMaker
->path
);
1100 PLSetFilename(shared_dict
, PLGetFilename(dict
));
1101 PLMergeDictionaries(shared_dict
, dict
);
1106 for (i
=0; i
<wScreenCount
; i
++) {
1107 scr
= wScreenWithNumber(i
);
1109 wReadDefaults(scr
, dict
);
1111 if (WDWindowMaker
->dictionary
) {
1112 PLRelease(WDWindowMaker
->dictionary
);
1114 WDWindowMaker
->dictionary
= dict
;
1117 wwarning(_("could not load domain %s from user defaults database"),
1121 PLRelease(shared_dict
);
1125 if (stat(WDWindowAttributes
->path
, &stbuf
)>=0
1126 && WDWindowAttributes
->timestamp
< stbuf
.st_mtime
) {
1128 puts("Checking WMWindowAttributes domain");
1130 dict
= ReadProplistFromFile(WDWindowAttributes
->path
);
1132 if (!PLIsDictionary(dict
)) {
1135 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1136 "WMWindowAttributes", WDWindowAttributes
->path
);
1138 if (WDWindowAttributes
->dictionary
)
1139 PLRelease(WDWindowAttributes
->dictionary
);
1140 WDWindowAttributes
->dictionary
= dict
;
1141 for (i
=0; i
<wScreenCount
; i
++) {
1142 scr
= wScreenWithNumber(i
);
1144 wDefaultUpdateIcons(scr
);
1148 wwarning(_("could not load domain %s from user defaults database"),
1149 "WMWindowAttributes");
1151 WDWindowAttributes
->timestamp
= stbuf
.st_mtime
;
1155 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, foo
);
1160 wReadDefaults(WScreen
*scr
, proplist_t new_dict
)
1162 proplist_t plvalue
, old_value
;
1163 WDefaultEntry
*entry
;
1165 int update_workspace_back
= 0; /* kluge :/ */
1168 proplist_t old_dict
= (WDWindowMaker
->dictionary
!=new_dict
1169 ? WDWindowMaker
->dictionary
: NULL
);
1175 for (i
=0; i
<sizeof(optionList
)/sizeof(WDefaultEntry
); i
++) {
1176 entry
= &optionList
[i
];
1179 plvalue
= PLGetDictionaryEntry(new_dict
, entry
->plkey
);
1186 old_value
= PLGetDictionaryEntry(old_dict
, entry
->plkey
);
1189 if (!plvalue
&& !old_value
) {
1190 /* no default in the DB. Use builtin default */
1191 plvalue
= entry
->plvalue
;
1192 if (plvalue
&& new_dict
) {
1193 PLInsertDictionaryEntry(new_dict
, entry
->plkey
, plvalue
);
1196 } else if (!plvalue
) {
1197 /* value was deleted from DB. Keep current value */
1199 } else if (!old_value
) {
1200 /* set value for the 1st time */
1201 } else if (!PLIsEqual(plvalue
, old_value
)) {
1202 /* value has changed */
1205 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1206 && update_workspace_back
1207 && scr
->flags
.backimage_helper_launched
) {
1209 /* value was not changed since last time */
1216 printf("Updating %s to %s\n", entry
->key
,
1217 PLGetDescription(plvalue
));
1220 if ((*entry
->convert
)(scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1222 * If the WorkspaceSpecificBack data has been changed
1223 * so that the helper will be launched now, we must be
1224 * sure to send the default background texture config
1227 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0
1228 && !scr
->flags
.backimage_helper_launched
) {
1229 update_workspace_back
= 1;
1231 if (entry
->update
) {
1233 (*entry
->update
)(scr
, entry
, tdata
, entry
->extra_data
);
1239 if (needs_refresh
!=0 && !scr
->flags
.startup
) {
1243 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1244 foo
|= WTextureSettings
;
1245 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1246 foo
|= WFontSettings
;
1247 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1248 foo
|= WColorSettings
;
1250 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1254 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1255 foo
|= WTextureSettings
;
1256 if (needs_refresh
& REFRESH_MENU_FONT
)
1257 foo
|= WFontSettings
;
1258 if (needs_refresh
& REFRESH_MENU_COLOR
)
1259 foo
|= WColorSettings
;
1261 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
,
1265 if (needs_refresh
& REFRESH_WINDOW_FONT
) {
1266 foo
|= WFontSettings
;
1268 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
) {
1269 foo
|= WTextureSettings
;
1271 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
) {
1272 foo
|= WColorSettings
;
1275 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
,
1278 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1280 if (needs_refresh
& REFRESH_ICON_FONT
) {
1281 foo
|= WFontSettings
;
1283 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
) {
1284 foo
|= WTextureSettings
;
1286 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
) {
1287 foo
|= WTextureSettings
;
1290 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1293 if (needs_refresh
& REFRESH_ICON_TILE
)
1294 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1300 wDefaultUpdateIcons(WScreen
*scr
)
1302 WAppIcon
*aicon
= scr
->app_icon_list
;
1303 WWindow
*wwin
= scr
->focused_window
;
1307 file
= wDefaultGetIconFile(scr
, aicon
->wm_instance
, aicon
->wm_class
,
1309 if ((file
&& aicon
->icon
->file
&& strcmp(file
, aicon
->icon
->file
)!=0)
1310 || (file
&& !aicon
->icon
->file
)) {
1313 if (aicon
->icon
->file
)
1314 wfree(aicon
->icon
->file
);
1315 aicon
->icon
->file
= wstrdup(file
);
1317 new_image
= wDefaultGetImage(scr
, aicon
->wm_instance
,
1320 wIconChangeImage(aicon
->icon
, new_image
);
1321 wAppIconPaint(aicon
);
1324 aicon
= aicon
->next
;
1327 if (!wPreferences
.flags
.noclip
)
1328 wClipIconPaint(scr
->clip_icon
);
1331 if (wwin
->icon
&& wwin
->flags
.miniaturized
) {
1332 file
= wDefaultGetIconFile(scr
, wwin
->wm_instance
, wwin
->wm_class
,
1334 if ((file
&& wwin
->icon
->file
&& strcmp(file
, wwin
->icon
->file
)!=0)
1335 || (file
&& !wwin
->icon
->file
)) {
1338 if (wwin
->icon
->file
)
1339 wfree(wwin
->icon
->file
);
1340 wwin
->icon
->file
= wstrdup(file
);
1342 new_image
= wDefaultGetImage(scr
, wwin
->wm_instance
,
1345 wIconChangeImage(wwin
->icon
, new_image
);
1353 /* --------------------------- Local ----------------------- */
1355 #define GET_STRING_OR_DEFAULT(x, var) if (!PLIsString(value)) { \
1356 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1358 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1359 var = entry->default_value;\
1360 } else var = PLGetString(value)\
1367 string2index(proplist_t key
, proplist_t val
, proplist_t def
,
1368 WOptionEnumeration
*values
)
1371 WOptionEnumeration
*v
;
1372 char buffer
[TOTAL_VALUES_LENGTH
];
1374 if (PLIsString(val
) && (str
= PLGetString(val
))) {
1375 for (v
=values
; v
->string
!=NULL
; v
++) {
1376 if (strcasecmp(v
->string
, str
)==0)
1382 for (v
=values
; v
->string
!=NULL
; v
++) {
1385 strcat(buffer
, ", ");
1386 strcat(buffer
, v
->string
);
1389 wwarning(_("wrong option value for key \"%s\". Should be one of %s"),
1390 PLGetString(key
), buffer
);
1393 return string2index(key
, val
, NULL
, values
);
1403 * value - is the value in the defaults DB
1404 * addr - is the address to store the data
1405 * ret - is the address to store a pointer to a temporary buffer. ret
1406 * must not be freed and is used by the set functions
1409 getBool(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1416 GET_STRING_OR_DEFAULT("Boolean", val
);
1419 if ((val
[1]=='\0' && (val
[0]=='y' || val
[0]=='Y'))
1420 || strcasecmp(val
, "YES")==0) {
1423 } else if ((val
[1]=='\0' && (val
[0]=='n' || val
[0]=='N'))
1424 || strcasecmp(val
, "NO")==0) {
1428 if (sscanf(val
, "%i", &i
)==1) {
1434 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""),
1436 if (second_pass
==0) {
1437 val
= PLGetString(entry
->plvalue
);
1439 wwarning(_("using default \"%s\" instead"), val
);
1450 *(char*)addr
= data
;
1458 getInt(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1465 GET_STRING_OR_DEFAULT("Integer", val
);
1467 if (sscanf(val
, "%i", &data
)!=1) {
1468 wwarning(_("can't convert \"%s\" to integer for key \"%s\""),
1470 val
= PLGetString(entry
->plvalue
);
1471 wwarning(_("using default \"%s\" instead"), val
);
1472 if (sscanf(val
, "%i", &data
)!=1) {
1488 getCoord(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1492 char *val_x
, *val_y
;
1493 int nelem
, changed
=0;
1494 proplist_t elem_x
, elem_y
;
1497 if (!PLIsArray(value
)) {
1498 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1499 entry
->key
, "Coordinate");
1501 value
= entry
->plvalue
;
1503 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1509 nelem
= PLGetNumberOfElements(value
);
1511 wwarning(_("Incorrect number of elements in array for key \"%s\"."),
1514 value
= entry
->plvalue
;
1516 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1522 elem_x
= PLGetArrayElement(value
, 0);
1523 elem_y
= PLGetArrayElement(value
, 1);
1525 if (!elem_x
|| !elem_y
|| !PLIsString(elem_x
) || !PLIsString(elem_y
)) {
1526 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."),
1529 value
= entry
->plvalue
;
1531 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1537 val_x
= PLGetString(elem_x
);
1538 val_y
= PLGetString(elem_y
);
1540 if (sscanf(val_x
, "%i", &data
.x
)!=1 || sscanf(val_y
, "%i", &data
.y
)!=1) {
1541 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1543 value
= entry
->plvalue
;
1545 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1553 else if (data
.x
> scr
->scr_width
/3)
1554 data
.x
= scr
->scr_width
/3;
1557 else if (data
.y
> scr
->scr_height
/3)
1558 data
.y
= scr
->scr_height
/3;
1564 *(WCoord
*)addr
= data
;
1572 /* This function is not used at the moment. */
1574 getString(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1579 GET_STRING_OR_DEFAULT("String", data
);
1582 data
= PLGetString(entry
->plvalue
);
1591 *(char**)addr
= wstrdup(data
);
1599 getPathList(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1609 if (!PLIsArray(value
)) {
1610 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1611 entry
->key
, "an array of paths");
1613 value
= entry
->plvalue
;
1615 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1622 count
= PLGetNumberOfElements(value
);
1625 value
= entry
->plvalue
;
1627 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1634 for (i
=0; i
<count
; i
++) {
1635 d
= PLGetArrayElement(value
, i
);
1636 if (!d
|| !PLIsString(d
)) {
1640 len
+= strlen(PLGetString(d
))+1;
1643 ptr
= data
= wmalloc(len
+1);
1645 for (i
=0; i
<count
; i
++) {
1646 d
= PLGetArrayElement(value
, i
);
1647 if (!d
|| !PLIsString(d
)) {
1650 strcpy(ptr
, PLGetString(d
));
1651 ptr
+= strlen(PLGetString(d
));
1655 ptr
--; *(ptr
--) = 0;
1657 if (*(char**)addr
!=NULL
) {
1658 wfree(*(char**)addr
);
1660 *(char**)addr
= data
;
1667 getEnum(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1670 static signed char data
;
1672 data
= string2index(entry
->plkey
, value
, entry
->default_value
,
1673 (WOptionEnumeration
*)entry
->extra_data
);
1681 *(signed char*)addr
= data
;
1690 * (hgradient <color> <color>)
1691 * (vgradient <color> <color>)
1692 * (dgradient <color> <color>)
1693 * (mhgradient <color> <color> ...)
1694 * (mvgradient <color> <color> ...)
1695 * (mdgradient <color> <color> ...)
1696 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1697 * (tpixmap <file> <color>)
1698 * (spixmap <file> <color>)
1699 * (cpixmap <file> <color>)
1700 * (thgradient <file> <opaqueness> <color> <color>)
1701 * (tvgradient <file> <opaqueness> <color> <color>)
1702 * (tdgradient <file> <opaqueness> <color> <color>)
1703 * (function <lib> <function> ...)
1707 parse_texture(WScreen
*scr
, proplist_t pl
)
1712 WTexture
*texture
=NULL
;
1714 nelem
= PLGetNumberOfElements(pl
);
1719 elem
= PLGetArrayElement(pl
, 0);
1720 if (!elem
|| !PLIsString(elem
))
1722 val
= PLGetString(elem
);
1725 if (strcasecmp(val
, "solid")==0) {
1733 elem
= PLGetArrayElement(pl
, 1);
1734 if (!elem
|| !PLIsString(elem
))
1736 val
= PLGetString(elem
);
1738 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1739 wwarning(_("\"%s\" is not a valid color name"), val
);
1743 texture
= (WTexture
*)wTextureMakeSolid(scr
, &color
);
1744 } else if (strcasecmp(val
, "dgradient")==0
1745 || strcasecmp(val
, "vgradient")==0
1746 || strcasecmp(val
, "hgradient")==0) {
1747 RColor color1
, color2
;
1752 wwarning(_("bad number of arguments in gradient specification"));
1756 if (val
[0]=='d' || val
[0]=='D')
1757 type
= WTEX_DGRADIENT
;
1758 else if (val
[0]=='h' || val
[0]=='H')
1759 type
= WTEX_HGRADIENT
;
1761 type
= WTEX_VGRADIENT
;
1764 /* get from color */
1765 elem
= PLGetArrayElement(pl
, 1);
1766 if (!elem
|| !PLIsString(elem
))
1768 val
= PLGetString(elem
);
1770 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1771 wwarning(_("\"%s\" is not a valid color name"), val
);
1775 color1
.red
= xcolor
.red
>> 8;
1776 color1
.green
= xcolor
.green
>> 8;
1777 color1
.blue
= xcolor
.blue
>> 8;
1780 elem
= PLGetArrayElement(pl
, 2);
1781 if (!elem
|| !PLIsString(elem
)) {
1784 val
= PLGetString(elem
);
1786 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1787 wwarning(_("\"%s\" is not a valid color name"), val
);
1791 color2
.red
= xcolor
.red
>> 8;
1792 color2
.green
= xcolor
.green
>> 8;
1793 color2
.blue
= xcolor
.blue
>> 8;
1795 texture
= (WTexture
*)wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1797 } else if (strcasecmp(val
, "igradient")==0) {
1798 RColor colors1
[2], colors2
[2];
1804 wwarning(_("bad number of arguments in gradient specification"));
1808 /* get from color */
1809 for (i
= 0; i
< 2; i
++) {
1810 elem
= PLGetArrayElement(pl
, 1+i
);
1811 if (!elem
|| !PLIsString(elem
))
1813 val
= PLGetString(elem
);
1815 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1816 wwarning(_("\"%s\" is not a valid color name"), val
);
1819 colors1
[i
].alpha
= 255;
1820 colors1
[i
].red
= xcolor
.red
>> 8;
1821 colors1
[i
].green
= xcolor
.green
>> 8;
1822 colors1
[i
].blue
= xcolor
.blue
>> 8;
1824 elem
= PLGetArrayElement(pl
, 3);
1825 if (!elem
|| !PLIsString(elem
))
1827 val
= PLGetString(elem
);
1831 /* get from color */
1832 for (i
= 0; i
< 2; i
++) {
1833 elem
= PLGetArrayElement(pl
, 4+i
);
1834 if (!elem
|| !PLIsString(elem
))
1836 val
= PLGetString(elem
);
1838 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1839 wwarning(_("\"%s\" is not a valid color name"), val
);
1842 colors2
[i
].alpha
= 255;
1843 colors2
[i
].red
= xcolor
.red
>> 8;
1844 colors2
[i
].green
= xcolor
.green
>> 8;
1845 colors2
[i
].blue
= xcolor
.blue
>> 8;
1847 elem
= PLGetArrayElement(pl
, 6);
1848 if (!elem
|| !PLIsString(elem
))
1850 val
= PLGetString(elem
);
1853 texture
= (WTexture
*)wTextureMakeIGradient(scr
, th1
, colors1
,
1856 } else if (strcasecmp(val
, "mhgradient")==0
1857 || strcasecmp(val
, "mvgradient")==0
1858 || strcasecmp(val
, "mdgradient")==0) {
1865 wwarning(_("too few arguments in multicolor gradient specification"));
1869 if (val
[1]=='h' || val
[1]=='H')
1870 type
= WTEX_MHGRADIENT
;
1871 else if (val
[1]=='v' || val
[1]=='V')
1872 type
= WTEX_MVGRADIENT
;
1874 type
= WTEX_MDGRADIENT
;
1878 colors
= wmalloc(sizeof(RColor
*)*(count
+1));
1880 for (i
=0; i
<count
; i
++) {
1881 elem
= PLGetArrayElement(pl
, i
+1);
1882 if (!elem
|| !PLIsString(elem
)) {
1883 for (--i
; i
>=0; --i
) {
1889 val
= PLGetString(elem
);
1891 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1892 wwarning(_("\"%s\" is not a valid color name"), val
);
1893 for (--i
; i
>=0; --i
) {
1899 colors
[i
] = wmalloc(sizeof(RColor
));
1900 colors
[i
]->red
= color
.red
>> 8;
1901 colors
[i
]->green
= color
.green
>> 8;
1902 colors
[i
]->blue
= color
.blue
>> 8;
1907 texture
= (WTexture
*)wTextureMakeMGradient(scr
, type
, colors
);
1908 } else if (strcasecmp(val
, "spixmap")==0 ||
1909 strcasecmp(val
, "cpixmap")==0 ||
1910 strcasecmp(val
, "tpixmap")==0) {
1917 if (val
[0] == 's' || val
[0] == 'S')
1919 else if (val
[0] == 'c' || val
[0] == 'C')
1925 elem
= PLGetArrayElement(pl
, 2);
1926 if (!elem
|| !PLIsString(elem
)) {
1929 val
= PLGetString(elem
);
1931 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1932 wwarning(_("\"%s\" is not a valid color name"), val
);
1937 elem
= PLGetArrayElement(pl
, 1);
1938 if (!elem
|| !PLIsString(elem
))
1940 val
= PLGetString(elem
);
1942 texture
= (WTexture
*)wTextureMakePixmap(scr
, type
, val
, &color
);
1943 } else if (strcasecmp(val
, "thgradient")==0
1944 || strcasecmp(val
, "tvgradient")==0
1945 || strcasecmp(val
, "tdgradient")==0) {
1946 RColor color1
, color2
;
1951 if (val
[1]=='h' || val
[1]=='H')
1952 style
= WTEX_THGRADIENT
;
1953 else if (val
[1]=='v' || val
[1]=='V')
1954 style
= WTEX_TVGRADIENT
;
1956 style
= WTEX_TDGRADIENT
;
1959 wwarning(_("bad number of arguments in textured gradient specification"));
1963 /* get from color */
1964 elem
= PLGetArrayElement(pl
, 3);
1965 if (!elem
|| !PLIsString(elem
))
1967 val
= PLGetString(elem
);
1969 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1970 wwarning(_("\"%s\" is not a valid color name"), val
);
1974 color1
.red
= xcolor
.red
>> 8;
1975 color1
.green
= xcolor
.green
>> 8;
1976 color1
.blue
= xcolor
.blue
>> 8;
1979 elem
= PLGetArrayElement(pl
, 4);
1980 if (!elem
|| !PLIsString(elem
)) {
1983 val
= PLGetString(elem
);
1985 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1986 wwarning(_("\"%s\" is not a valid color name"), val
);
1990 color2
.red
= xcolor
.red
>> 8;
1991 color2
.green
= xcolor
.green
>> 8;
1992 color2
.blue
= xcolor
.blue
>> 8;
1995 elem
= PLGetArrayElement(pl
, 2);
1996 if (!elem
|| !PLIsString(elem
))
1999 val
= PLGetString(elem
);
2001 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
2002 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
2007 elem
= PLGetArrayElement(pl
, 1);
2008 if (!elem
|| !PLIsString(elem
))
2010 val
= PLGetString(elem
);
2012 texture
= (WTexture
*)wTextureMakeTGradient(scr
, style
, &color1
, &color2
,
2015 #ifdef TEXTURE_PLUGIN
2016 else if (strcasecmp(val
, "function")==0) {
2017 WTexFunction
*function
;
2018 void (*initFunc
) (Display
*, Colormap
);
2019 char *lib
, *func
, **argv
;
2025 /* get the library name */
2026 elem
= PLGetArrayElement(pl
, 1);
2027 if (!elem
|| !PLIsString(elem
)) {
2030 lib
= PLGetString(elem
);
2032 /* get the function name */
2033 elem
= PLGetArrayElement(pl
, 2);
2034 if (!elem
|| !PLIsString(elem
)) {
2037 func
= PLGetString(elem
);
2040 argv
= (char **)wmalloc(argc
* sizeof(char *));
2042 /* get the parameters */
2043 argv
[0] = wstrdup(func
);
2044 for (i
= 0; i
< argc
- 1; i
++) {
2045 elem
= PLGetArrayElement(pl
, 3 + i
);
2046 if (!elem
|| !PLIsString(elem
)) {
2051 argv
[i
+1] = wstrdup(PLGetString(elem
));
2054 function
= wTextureMakeFunction(scr
, lib
, func
, argc
, argv
);
2058 initFunc
= dlsym(function
->handle
, "initWindowMaker");
2060 initFunc(dpy
, scr
->w_colormap
);
2062 wwarning(_("could not initialize library %s"), lib
);
2065 wwarning(_("could not find function %s::%s"), lib
, func
);
2067 #endif /* HAVE_DLFCN_H */
2068 texture
= (WTexture
*)function
;
2070 #endif /* TEXTURE_PLUGIN */
2072 wwarning(_("invalid texture type %s"), val
);
2081 getTexture(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2084 static WTexture
*texture
;
2088 if (!PLIsArray(value
)) {
2089 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2090 entry
->key
, "Texture");
2092 value
= entry
->plvalue
;
2094 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2100 if (strcmp(entry
->key
, "WidgetColor")==0 && !changed
) {
2103 pl
= PLGetArrayElement(value
, 0);
2104 if (!pl
|| !PLIsString(pl
) || !PLGetString(pl
)
2105 || strcasecmp(PLGetString(pl
), "solid")!=0) {
2106 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2107 entry
->key
, "Solid Texture");
2109 value
= entry
->plvalue
;
2111 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2116 texture
= parse_texture(scr
, value
);
2119 wwarning(_("Error in texture specification for key \"%s\""),
2122 value
= entry
->plvalue
;
2124 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2134 *(WTexture
**)addr
= texture
;
2141 #ifdef DRAWSTRING_PLUGIN
2143 getTextRenderer(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
2144 void *addr
, void **ret
)
2147 char *val
, *lib
, *func
, **argv
;
2150 if (strcmp(entry
->key
, "FTitleColor")==0) {
2151 wPluginDestroyFunction(scr
->drawstring_func
[changed
= W_STRING_FTITLE
]);
2152 scr
->drawstring_func
[W_STRING_FTITLE
] = NULL
;
2153 } else if (strcmp(entry
->key
, "UTitleColor")==0) {
2154 wPluginDestroyFunction(scr
->drawstring_func
[changed
= W_STRING_UTITLE
]);
2155 scr
->drawstring_func
[W_STRING_UTITLE
] = NULL
;
2156 } else if (strcmp(entry
->key
, "PTitleColor")==0) {
2157 wPluginDestroyFunction(scr
->drawstring_func
[changed
= W_STRING_PTITLE
]);
2158 scr
->drawstring_func
[W_STRING_PTITLE
] = NULL
;
2159 } else if (strcmp(entry
->key
, "MenuTitleColor")==0) {
2160 wPluginDestroyFunction(scr
->drawstring_func
[changed
= W_STRING_MTITLE
]);
2161 scr
->drawstring_func
[W_STRING_MTITLE
] = NULL
;
2162 } else if (strcmp(entry
->key
, "MenuPluginColor")==0) {
2163 wPluginDestroyFunction(scr
->drawstring_func
[changed
= W_STRING_MTEXT
]);
2164 scr
->drawstring_func
[W_STRING_MTEXT
] = NULL
;
2167 if (PLIsArray(value
)) {
2168 if ((argc
= PLGetNumberOfElements(value
)) < 4) return False
;
2170 argv
= (char **)wmalloc(argc
* sizeof(char *));
2172 elem
= PLGetArrayElement(value
,0);
2173 if (!elem
|| !PLIsString(elem
)) return False
;
2174 val
= PLGetString(elem
);
2175 if (strcasecmp(val
, "function")==0) {
2176 elem
= PLGetArrayElement(value
, 1); /* library name */
2177 if (!elem
|| !PLIsString(elem
)) return False
;
2178 lib
= PLGetString(elem
);
2179 elem
= PLGetArrayElement(value
, 2); /* function name */
2180 if (!elem
|| !PLIsString(elem
)) return False
;
2181 func
= PLGetString(elem
);
2182 scr
->drawstring_func
[changed
] = wPluginCreateFunction (W_FUNCTION_DRAWSTRING
,
2183 lib
, "initDrawString", func
, NULL
, value
,
2184 wPluginPackInitData(3, dpy
, scr
->w_colormap
,"-DATA-"));
2187 return getColor(scr
, entry
, PLGetArrayElement(value
,3), addr
, ret
);
2188 } else if (PLIsString(value
)) {
2189 return getColor(scr
, entry
, value
, addr
, ret
);
2194 #endif /* DRAWSTRING_PLUGIN */
2199 getWSBackground(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
2200 void *addr
, void **ret
)
2208 if (!PLIsArray(value
)) {
2209 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2210 "WorkspaceBack", "Texture or None");
2212 value
= entry
->plvalue
;
2214 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2220 /* only do basic error checking and verify for None texture */
2222 nelem
= PLGetNumberOfElements(value
);
2224 elem
= PLGetArrayElement(value
, 0);
2225 if (!elem
|| !PLIsString(elem
)) {
2226 wwarning(_("Wrong type for workspace background. Should be a texture type."));
2228 value
= entry
->plvalue
;
2230 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2235 val
= PLGetString(elem
);
2237 if (strcasecmp(val
, "None")==0)
2240 *ret
= PLRetain(value
);
2247 getWSSpecificBackground(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
2248 void *addr
, void **ret
)
2255 if (!PLIsArray(value
)) {
2256 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2257 "WorkspaceSpecificBack", "an array of textures");
2259 value
= entry
->plvalue
;
2261 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2267 /* only do basic error checking and verify for None texture */
2269 nelem
= PLGetNumberOfElements(value
);
2272 elem
= PLGetArrayElement(value
, nelem
);
2273 if (!elem
|| !PLIsArray(elem
)) {
2274 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2280 *ret
= PLRetain(value
);
2284 * Kluge to force wmsetbg helper to set the default background.
2285 * If the WorkspaceSpecificBack is changed once wmaker has started,
2286 * the WorkspaceBack won't be sent to the helper, unless the user
2287 * changes it's value too. So, we must force this by removing the
2288 * value from the defaults DB.
2290 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2291 proplist_t key
= PLMakeString("WorkspaceBack");
2293 PLRemoveDictionaryEntry(WDWindowMaker
->dictionary
, key
);
2303 getFont(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2306 static WMFont
*font
;
2309 GET_STRING_OR_DEFAULT("Font", val
);
2311 font
= WMCreateFont(scr
->wmscreen
, val
);
2313 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2316 wfatal(_("could not load any usable font!!!"));
2323 /* can't assign font value outside update function */
2324 wassertrv(addr
== NULL
, True
);
2331 getColor(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2334 static XColor color
;
2338 GET_STRING_OR_DEFAULT("Color", val
);
2342 if (!wGetColor(scr
, val
, &color
)) {
2343 wwarning(_("could not get color for key \"%s\""),
2345 if (second_pass
==0) {
2346 val
= PLGetString(entry
->plvalue
);
2348 wwarning(_("using default \"%s\" instead"), val
);
2360 *(unsigned long*)addr = pixel;
2369 getKeybind(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2372 static WShortKey shortcut
;
2379 GET_STRING_OR_DEFAULT("Key spec", val
);
2381 if (!val
|| strcasecmp(val
, "NONE")==0) {
2382 shortcut
.keycode
= 0;
2383 shortcut
.modifier
= 0;
2394 shortcut
.modifier
= 0;
2395 while ((k
= strchr(b
, '+'))!=NULL
) {
2399 mod
= wXModifierFromKey(b
);
2401 wwarning(_("%s:invalid key modifier \"%s\""), entry
->key
, b
);
2404 shortcut
.modifier
|= mod
;
2410 ksym
= XStringToKeysym(b
);
2412 if (ksym
==NoSymbol
) {
2413 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
,
2418 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2419 if (shortcut
.keycode
==0) {
2420 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2432 getModMask(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2435 static unsigned int mask
;
2438 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2443 mask
= wXModifierFromKey(str
);
2445 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2451 *(unsigned int*)addr
= mask
;
2462 getRImages(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
2463 void *addr
, void **ret
)
2471 GET_STRING_OR_DEFAULT("Image File Path", str
);
2475 image
= RLoadImage(scr
->rcontext
, str
, 0);
2477 wwarning(_("could not load image in option %s: %s"), entry
->key
,
2478 RMessageForError(RErrorCode
));
2482 if (*(RImage
**)addr
) {
2483 RDestroyImage(*(RImage
**)addr
);
2486 *(RImage
**)addr
= image
;
2488 assert(ret
== NULL
);
2491 *(RImage**)ret = image;
2498 #ifdef DEFINABLE_CURSOR
2500 # include <X11/cursorfont.h>
2507 #define CURSOR_ID_NONE (XC_num_glyphs)
2509 static WCursorLookup cursor_table
[] =
2511 { "X_cursor", XC_X_cursor
},
2512 { "arrow", XC_arrow
},
2513 { "based_arrow_down", XC_based_arrow_down
},
2514 { "based_arrow_up", XC_based_arrow_up
},
2515 { "boat", XC_boat
},
2516 { "bogosity", XC_bogosity
},
2517 { "bottom_left_corner", XC_bottom_left_corner
},
2518 { "bottom_right_corner", XC_bottom_right_corner
},
2519 { "bottom_side", XC_bottom_side
},
2520 { "bottom_tee", XC_bottom_tee
},
2521 { "box_spiral", XC_box_spiral
},
2522 { "center_ptr", XC_center_ptr
},
2523 { "circle", XC_circle
},
2524 { "clock", XC_clock
},
2525 { "coffee_mug", XC_coffee_mug
},
2526 { "cross", XC_cross
},
2527 { "cross_reverse", XC_cross_reverse
},
2528 { "crosshair", XC_crosshair
},
2529 { "diamond_cross", XC_diamond_cross
},
2531 { "dotbox", XC_dotbox
},
2532 { "double_arrow", XC_double_arrow
},
2533 { "draft_large", XC_draft_large
},
2534 { "draft_small", XC_draft_small
},
2535 { "draped_box", XC_draped_box
},
2536 { "exchange", XC_exchange
},
2537 { "fleur", XC_fleur
},
2538 { "gobbler", XC_gobbler
},
2539 { "gumby", XC_gumby
},
2540 { "hand1", XC_hand1
},
2541 { "hand2", XC_hand2
},
2542 { "heart", XC_heart
},
2543 { "icon", XC_icon
},
2544 { "iron_cross", XC_iron_cross
},
2545 { "left_ptr", XC_left_ptr
},
2546 { "left_side", XC_left_side
},
2547 { "left_tee", XC_left_tee
},
2548 { "leftbutton", XC_leftbutton
},
2549 { "ll_angle", XC_ll_angle
},
2550 { "lr_angle", XC_lr_angle
},
2552 { "middlebutton", XC_middlebutton
},
2553 { "mouse", XC_mouse
},
2554 { "pencil", XC_pencil
},
2555 { "pirate", XC_pirate
},
2556 { "plus", XC_plus
},
2557 { "question_arrow", XC_question_arrow
},
2558 { "right_ptr", XC_right_ptr
},
2559 { "right_side", XC_right_side
},
2560 { "right_tee", XC_right_tee
},
2561 { "rightbutton", XC_rightbutton
},
2562 { "rtl_logo", XC_rtl_logo
},
2563 { "sailboat", XC_sailboat
},
2564 { "sb_down_arrow", XC_sb_down_arrow
},
2565 { "sb_h_double_arrow", XC_sb_h_double_arrow
},
2566 { "sb_left_arrow", XC_sb_left_arrow
},
2567 { "sb_right_arrow", XC_sb_right_arrow
},
2568 { "sb_up_arrow", XC_sb_up_arrow
},
2569 { "sb_v_double_arrow", XC_sb_v_double_arrow
},
2570 { "shuttle", XC_shuttle
},
2571 { "sizing", XC_sizing
},
2572 { "spider", XC_spider
},
2573 { "spraycan", XC_spraycan
},
2574 { "star", XC_star
},
2575 { "target", XC_target
},
2576 { "tcross", XC_tcross
},
2577 { "top_left_arrow", XC_top_left_arrow
},
2578 { "top_left_corner", XC_top_left_corner
},
2579 { "top_right_corner", XC_top_right_corner
},
2580 { "top_side", XC_top_side
},
2581 { "top_tee", XC_top_tee
},
2582 { "trek", XC_trek
},
2583 { "ul_angle", XC_ul_angle
},
2584 { "umbrella", XC_umbrella
},
2585 { "ur_angle", XC_ur_angle
},
2586 { "watch", XC_watch
},
2587 { "xterm", XC_xterm
},
2588 { NULL
, CURSOR_ID_NONE
}
2592 check_bitmap_status(int status
, char *filename
, Pixmap bitmap
)
2595 case BitmapOpenFailed
:
2596 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2598 case BitmapFileInvalid
:
2599 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2601 case BitmapNoMemory
:
2602 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2605 XFreePixmap(dpy
, bitmap
);
2612 * (builtin, <cursor_name>)
2613 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2616 parse_cursor(WScreen
*scr
, proplist_t pl
, Cursor
*cursor
)
2623 nelem
= PLGetNumberOfElements(pl
);
2627 elem
= PLGetArrayElement(pl
, 0);
2628 if (!elem
|| !PLIsString(elem
)) {
2631 val
= PLGetString(elem
);
2633 if (0 == strcasecmp(val
, "none")) {
2636 } else if (0 == strcasecmp(val
, "builtin")) {
2638 int cursor_id
= CURSOR_ID_NONE
;
2641 wwarning(_("bad number of arguments in cursor specification"));
2644 elem
= PLGetArrayElement(pl
, 1);
2645 if (!elem
|| !PLIsString(elem
)) {
2648 val
= PLGetString(elem
);
2650 for (i
= 0; NULL
!= cursor_table
[i
].name
; i
++) {
2651 if (0 == strcasecmp(val
, cursor_table
[i
].name
)) {
2652 cursor_id
= cursor_table
[i
].id
;
2656 if (CURSOR_ID_NONE
== cursor_id
) {
2657 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2659 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2662 } else if (0 == strcasecmp(val
, "bitmap")) {
2674 wwarning(_("bad number of arguments in cursor specification"));
2677 elem
= PLGetArrayElement(pl
, 1);
2678 if (!elem
|| !PLIsString(elem
)) {
2681 val
= PLGetString(elem
);
2682 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2684 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2687 elem
= PLGetArrayElement(pl
, 2);
2688 if (!elem
|| !PLIsString(elem
)) {
2692 val
= PLGetString(elem
);
2693 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2696 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2699 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
,
2701 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
,
2703 if ((BitmapSuccess
== bitmap_status
) &&
2704 (BitmapSuccess
== mask_status
)) {
2705 fg
.pixel
= scr
->black_pixel
;
2706 bg
.pixel
= scr
->white_pixel
;
2707 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2708 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2709 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2712 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2713 check_bitmap_status(mask_status
, mask_name
, mask
);
2722 getCursor(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2725 static Cursor cursor
;
2730 if (!PLIsArray(value
)) {
2731 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2732 entry
->key
, "cursor specification");
2734 value
= entry
->plvalue
;
2736 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2741 status
= parse_cursor(scr
, value
, &cursor
);
2743 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2745 value
= entry
->plvalue
;
2747 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2756 *(Cursor
*)addr
= cursor
;
2760 #undef CURSOR_ID_NONE
2762 #endif /* DEFINABLE_CURSOR */
2765 /* ---------------- value setting functions --------------- */
2767 setJustify(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
2769 return REFRESH_WINDOW_TITLE_COLOR
;
2773 setClearance(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
2775 return REFRESH_WINDOW_FONT
|REFRESH_BUTTON_IMAGES
|REFRESH_MENU_TITLE_FONT
|REFRESH_MENU_FONT
;
2779 setIfDockPresent(WScreen
*scr
, WDefaultEntry
*entry
, char *flag
, long which
)
2783 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2786 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2796 setStickyIcons(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
2798 if (scr
->workspaces
) {
2799 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2800 wArrangeIcons(scr
, False
);
2807 setPositive(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
2819 setIconTile(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
2825 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2826 wPreferences
.icon_size
,
2827 ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2828 ? WREL_ICON
: WREL_FLAT
);
2830 wwarning(_("could not render texture for icon background"));
2832 wTextureDestroy(scr
, *texture
);
2835 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2837 if (scr
->icon_tile
) {
2839 RDestroyImage(scr
->icon_tile
);
2840 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2843 scr
->icon_tile
= img
;
2846 /* put the icon in the noticeboard hint */
2847 PropSetIconTileHint(scr
, img
);
2850 if (!wPreferences
.flags
.noclip
) {
2851 if (scr
->clip_tile
) {
2852 RDestroyImage(scr
->clip_tile
);
2854 scr
->clip_tile
= wClipMakeTile(scr
, img
);
2857 scr
->icon_tile_pixmap
= pixmap
;
2859 if (scr
->def_icon_pixmap
) {
2860 XFreePixmap(dpy
, scr
->def_icon_pixmap
);
2861 scr
->def_icon_pixmap
= None
;
2863 if (scr
->def_ticon_pixmap
) {
2864 XFreePixmap(dpy
, scr
->def_ticon_pixmap
);
2865 scr
->def_ticon_pixmap
= None
;
2868 if (scr
->icon_back_texture
) {
2869 wTextureDestroy(scr
, (WTexture
*)scr
->icon_back_texture
);
2871 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2873 if (scr
->clip_balloon
)
2874 XSetWindowBackground(dpy
, scr
->clip_balloon
,
2875 (*texture
)->any
.color
.pixel
);
2878 * Free the texture as nobody else will use it, nor refer to it.
2881 wTextureDestroy(scr
, *texture
);
2883 return (reset
? REFRESH_ICON_TILE
: 0);
2889 setWinTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2891 if (scr
->title_font
) {
2892 WMReleaseFont(scr
->title_font
);
2894 scr
->title_font
= font
;
2896 return REFRESH_WINDOW_FONT
|REFRESH_BUTTON_IMAGES
;
2901 setMenuTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2903 if (scr
->menu_title_font
) {
2904 WMReleaseFont(scr
->menu_title_font
);
2907 scr
->menu_title_font
= font
;
2909 return REFRESH_MENU_TITLE_FONT
;
2914 setMenuTextFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2916 if (scr
->menu_entry_font
) {
2917 WMReleaseFont(scr
->menu_entry_font
);
2919 scr
->menu_entry_font
= font
;
2921 return REFRESH_MENU_FONT
;
2927 setIconTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2929 if (scr
->icon_title_font
) {
2930 WMReleaseFont(scr
->icon_title_font
);
2933 scr
->icon_title_font
= font
;
2935 return REFRESH_ICON_FONT
;
2940 setClipTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2942 if (scr
->clip_title_font
) {
2943 WMReleaseFont(scr
->clip_title_font
);
2946 scr
->clip_title_font
= font
;
2948 return REFRESH_ICON_FONT
;
2953 setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2955 if (scr
->workspace_name_font
) {
2956 WMReleaseFont(scr
->workspace_name_font
);
2959 scr
->workspace_name_font
= font
;
2966 setHightlight(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
2968 if (scr
->select_pixel
!=scr
->white_pixel
&&
2969 scr
->select_pixel
!=scr
->black_pixel
) {
2970 wFreeColor(scr
, scr
->select_pixel
);
2973 scr
->select_pixel
= color
->pixel
;
2975 return REFRESH_MENU_COLOR
;
2980 setHightlightText(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
2982 if (scr
->select_text_pixel
!=scr
->white_pixel
&&
2983 scr
->select_text_pixel
!=scr
->black_pixel
) {
2984 wFreeColor(scr
, scr
->select_text_pixel
);
2987 scr
->select_text_pixel
= color
->pixel
;
2989 return REFRESH_MENU_COLOR
;
2994 setClipTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
2996 if (scr
->clip_title_pixel
[index
]!=scr
->white_pixel
&&
2997 scr
->clip_title_pixel
[index
]!=scr
->black_pixel
) {
2998 wFreeColor(scr
, scr
->clip_title_pixel
[index
]);
3000 scr
->clip_title_pixel
[index
] = color
->pixel
;
3002 #ifdef GRADIENT_CLIP_ARROW
3003 if (index
== CLIP_NORMAL
) {
3005 RColor color1
, color2
;
3006 int pt
= CLIP_BUTTON_SIZE
*wPreferences
.icon_size
/64;
3007 int as
= pt
- 15; /* 15 = 5+5+5 */
3009 FREE_PIXMAP(scr
->clip_arrow_gradient
);
3011 color1
.red
= (color
->red
>> 8)*6/10;
3012 color1
.green
= (color
->green
>> 8)*6/10;
3013 color1
.blue
= (color
->blue
>> 8)*6/10;
3015 color2
.red
= WMIN((color
->red
>> 8)*20/10, 255);
3016 color2
.green
= WMIN((color
->green
>> 8)*20/10, 255);
3017 color2
.blue
= WMIN((color
->blue
>> 8)*20/10, 255);
3019 image
= RRenderGradient(as
+1, as
+1, &color1
, &color2
, RDiagonalGradient
);
3020 RConvertImage(scr
->rcontext
, image
, &scr
->clip_arrow_gradient
);
3021 RDestroyImage(image
);
3023 #endif /* GRADIENT_CLIP_ARROW */
3025 return REFRESH_ICON_TITLE_COLOR
;
3030 setWTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3032 if (scr
->window_title_pixel
[index
]!=scr
->white_pixel
&&
3033 scr
->window_title_pixel
[index
]!=scr
->black_pixel
) {
3034 wFreeColor(scr
, scr
->window_title_pixel
[index
]);
3037 scr
->window_title_pixel
[index
] = color
->pixel
;
3039 if (index
== WS_UNFOCUSED
)
3040 XSetForeground(dpy
, scr
->info_text_gc
, color
->pixel
);
3042 return REFRESH_WINDOW_TITLE_COLOR
;
3047 setMenuTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3049 if (scr
->menu_title_pixel
[0]!=scr
->white_pixel
&&
3050 scr
->menu_title_pixel
[0]!=scr
->black_pixel
) {
3051 #ifdef DRAWSTRING_PLUGIN
3052 if(!scr
->drawstring_func
[W_STRING_MTITLE
])
3054 wFreeColor(scr
, scr
->menu_title_pixel
[0]);
3057 scr
->menu_title_pixel
[0] = color
->pixel
;
3058 XSetForeground(dpy
, scr
->menu_title_gc
, color
->pixel
);
3060 return REFRESH_MENU_TITLE_COLOR
;
3065 setMenuTextColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3068 #define gcm (GCForeground|GCBackground|GCFillStyle)
3070 if (scr
->mtext_pixel
!=scr
->white_pixel
&&
3071 scr
->mtext_pixel
!=scr
->black_pixel
) {
3072 wFreeColor(scr
, scr
->mtext_pixel
);
3075 scr
->mtext_pixel
= color
->pixel
;
3077 XSetForeground(dpy
, scr
->menu_entry_gc
, color
->pixel
);
3080 if (scr
->dtext_pixel
== scr
->mtext_pixel
) {
3081 gcv
.foreground
= scr
->white_pixel
;
3082 gcv
.background
= scr
->black_pixel
;
3083 gcv
.fill_style
= FillStippled
;
3085 gcv
.foreground
= scr
->dtext_pixel
;
3086 gcv
.fill_style
= FillSolid
;
3088 XChangeGC(dpy
, scr
->disabled_menu_entry_gc
, gcm
, &gcv
);
3090 return REFRESH_MENU_COLOR
;
3096 setMenuDisabledColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3099 #define gcm (GCForeground|GCBackground|GCFillStyle)
3101 if (scr
->dtext_pixel
!=scr
->white_pixel
&&
3102 scr
->dtext_pixel
!=scr
->black_pixel
) {
3103 wFreeColor(scr
, scr
->dtext_pixel
);
3106 scr
->dtext_pixel
= color
->pixel
;
3108 if (scr
->dtext_pixel
== scr
->mtext_pixel
) {
3109 gcv
.foreground
= scr
->white_pixel
;
3110 gcv
.background
= scr
->black_pixel
;
3111 gcv
.fill_style
= FillStippled
;
3113 gcv
.foreground
= scr
->dtext_pixel
;
3114 gcv
.fill_style
= FillSolid
;
3116 XChangeGC(dpy
, scr
->disabled_menu_entry_gc
, gcm
, &gcv
);
3118 return REFRESH_MENU_COLOR
;
3123 setIconTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3125 XSetForeground(dpy
, scr
->icon_title_gc
, color
->pixel
);
3127 return REFRESH_ICON_TITLE_COLOR
;
3132 setIconTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3134 if (scr
->icon_title_texture
) {
3135 wTextureDestroy(scr
, (WTexture
*)scr
->icon_title_texture
);
3137 XQueryColor (dpy
, scr
->w_colormap
, color
);
3138 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
3140 return REFRESH_ICON_TITLE_BACK
;
3145 trackDeadProcess(pid_t pid
, unsigned char status
, WScreen
*scr
)
3147 close(scr
->helper_fd
);
3149 scr
->helper_pid
= 0;
3150 scr
->flags
.backimage_helper_launched
= 0;
3155 setWorkspaceSpecificBack(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
3162 if (scr
->flags
.backimage_helper_launched
) {
3163 if (PLGetNumberOfElements(value
)==0) {
3164 SendHelperMessage(scr
, 'C', 0, NULL
);
3165 SendHelperMessage(scr
, 'K', 0, NULL
);
3174 if (PLGetNumberOfElements(value
) == 0)
3177 if (pipe(filedes
) < 0) {
3178 wsyserror("pipe() failed:can't set workspace specific background image");
3186 wsyserror("fork() failed:can't set workspace specific background image");
3187 if (close(filedes
[0]) < 0)
3188 wsyserror("could not close pipe");
3189 if (close(filedes
[1]) < 0)
3190 wsyserror("could not close pipe");
3192 } else if (pid
== 0) {
3193 SetupEnvironment(scr
);
3196 wsyserror("could not close pipe");
3197 if (dup(filedes
[0]) < 0) {
3198 wsyserror("dup() failed:can't set workspace specific background image");
3200 if (wPreferences
.smooth_workspace_back
)
3201 execlp("wmsetbg", "wmsetbg", "-helper", "-S", "-d", NULL
);
3203 execlp("wmsetbg", "wmsetbg", "-helper", "-d", NULL
);
3204 wsyserror("could not execute wmsetbg");
3208 if (fcntl(filedes
[0], F_SETFD
, FD_CLOEXEC
) < 0) {
3209 wsyserror("error setting close-on-exec flag");
3211 if (fcntl(filedes
[1], F_SETFD
, FD_CLOEXEC
) < 0) {
3212 wsyserror("error setting close-on-exec flag");
3215 scr
->helper_fd
= filedes
[1];
3216 scr
->helper_pid
= pid
;
3217 scr
->flags
.backimage_helper_launched
= 1;
3219 wAddDeathHandler(pid
, (WDeathHandler
*)trackDeadProcess
, scr
);
3221 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3226 for (i
= 0; i
< PLGetNumberOfElements(value
); i
++) {
3227 val
= PLGetArrayElement(value
, i
);
3228 if (val
&& PLIsArray(val
) && PLGetNumberOfElements(val
)>0) {
3229 str
= PLGetDescription(val
);
3231 SendHelperMessage(scr
, 'S', i
+1, str
);
3235 SendHelperMessage(scr
, 'U', i
+1, NULL
);
3246 setWorkspaceBack(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
3249 if (scr
->flags
.backimage_helper_launched
) {
3252 if (PLGetNumberOfElements(value
)==0) {
3253 SendHelperMessage(scr
, 'U', 0, NULL
);
3255 /* set the default workspace background to this one */
3256 str
= PLGetDescription(value
);
3258 SendHelperMessage(scr
, 'S', 0, str
);
3260 SendHelperMessage(scr
, 'C', scr
->current_workspace
+1, NULL
);
3262 SendHelperMessage(scr
, 'U', 0, NULL
);
3265 } else if (PLGetNumberOfElements(value
) > 0) {
3269 SetupEnvironment(scr
);
3270 text
= PLGetDescription(value
);
3271 command
= wmalloc(strlen(text
)+40);
3272 if (wPreferences
.smooth_workspace_back
)
3273 sprintf(command
, "wmsetbg -d -S -p '%s' &", text
);
3275 sprintf(command
, "wmsetbg -d -p '%s' &", text
);
3287 setWidgetColor(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3289 if (scr
->widget_texture
) {
3290 wTextureDestroy(scr
, (WTexture
*)scr
->widget_texture
);
3292 scr
->widget_texture
= *(WTexSolid
**)texture
;
3299 setFTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3301 if (scr
->window_title_texture
[WS_FOCUSED
]) {
3302 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3304 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3306 return REFRESH_WINDOW_TEXTURES
;
3311 setPTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3313 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
3314 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3316 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3318 return REFRESH_WINDOW_TEXTURES
;
3323 setUTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3325 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
3326 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3328 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3330 return REFRESH_WINDOW_TEXTURES
;
3335 setResizebarBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3337 if (scr
->resizebar_texture
[0]) {
3338 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3340 scr
->resizebar_texture
[0] = *texture
;
3342 return REFRESH_WINDOW_TEXTURES
;
3347 setMenuTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3349 if (scr
->menu_title_texture
[0]) {
3350 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3352 scr
->menu_title_texture
[0] = *texture
;
3354 return REFRESH_MENU_TITLE_TEXTURE
;
3359 setMenuTextBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3361 if (scr
->menu_item_texture
) {
3362 wTextureDestroy(scr
, scr
->menu_item_texture
);
3363 wTextureDestroy(scr
, (WTexture
*)scr
->menu_item_auxtexture
);
3365 scr
->menu_item_texture
= *texture
;
3367 scr
->menu_item_auxtexture
3368 = wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3370 return REFRESH_MENU_TEXTURE
;
3375 setKeyGrab(WScreen
*scr
, WDefaultEntry
*entry
, WShortKey
*shortcut
, long index
)
3378 wKeyBindings
[index
] = *shortcut
;
3380 wwin
= scr
->focused_window
;
3382 while (wwin
!=NULL
) {
3383 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3385 if (!WFLAGP(wwin
, no_bind_keys
)) {
3386 wWindowSetKeyGrabs(wwin
);
3396 setIconPosition(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
3398 wArrangeIcons(scr
, True
);
3405 updateUsableArea(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
3407 wScreenUpdateUsableArea(scr
);
3414 setMenuStyle(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
3416 return REFRESH_MENU_TEXTURE
;
3422 setButtonImages(WScreen *scr, WDefaultEntry *entry, int *value, void *foo)
3424 return REFRESH_BUTTON_IMAGES;
3430 * Need access to the double click variables, so that all widgets in
3431 * wmaker panels will have the same dbl-click values.
3432 * TODO: figure a better way of dealing with it.
3437 setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
3439 extern _WINGsConfiguration WINGsConfiguration
;
3444 WINGsConfiguration
.doubleClickDelay
= *value
;
3452 setMultiByte(WScreen
*scr
, WDefaultEntry
*entry
, char *value
, void *foo
)
3454 extern _WINGsConfiguration WINGsConfiguration
;
3456 WINGsConfiguration
.useMultiByte
= *value
;
3462 #ifdef DEFINABLE_CURSOR
3464 setCursor(WScreen
*scr
, WDefaultEntry
*entry
, Cursor
*cursor
, long index
)
3466 if (None
!= wCursor
[index
])
3468 XFreeCursor(dpy
, wCursor
[index
]);
3471 wCursor
[index
] = *cursor
;
3473 if ((WCUR_ROOT
== index
) && (None
!= *cursor
))
3475 XDefineCursor(dpy
, scr
->root_win
, *cursor
);
3480 #endif /* DEFINABLE_CURSOR*/