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
655 {"MenuTextColor", "black", NULL
,
656 NULL
, getTextRenderer
, setMenuTextColor
659 {"MenuTitleColor", "white", NULL
,
660 NULL
, getColor
, setMenuTitleColor
662 {"MenuTextColor", "black", NULL
,
663 NULL
, getColor
, setMenuTextColor
666 {"MenuDisabledColor", "\"#616161\"", NULL
,
667 NULL
, getColor
, setMenuDisabledColor
669 {"MenuTitleBack", "(solid, black)", NULL
,
670 NULL
, getTexture
, setMenuTitleBack
672 {"MenuTextBack", "(solid, gray)", NULL
,
673 NULL
, getTexture
, setMenuTextBack
675 {"IconTitleColor", "white", NULL
,
676 NULL
, getColor
, setIconTitleColor
678 {"IconTitleBack", "black", NULL
,
679 NULL
, getColor
, setIconTitleBack
683 {"RootMenuKey", "None", (void*)WKBD_ROOTMENU
,
684 NULL
, getKeybind
, setKeyGrab
686 {"WindowListKey", "None", (void*)WKBD_WINDOWLIST
,
687 NULL
, getKeybind
, setKeyGrab
690 {"WindowMenuKey", "None", (void*)WKBD_WINDOWMENU
,
691 NULL
, getKeybind
, setKeyGrab
693 {"ClipLowerKey", "None", (void*)WKBD_CLIPLOWER
,
694 NULL
, getKeybind
, setKeyGrab
696 {"ClipRaiseKey", "None", (void*)WKBD_CLIPRAISE
,
697 NULL
, getKeybind
, setKeyGrab
699 {"ClipRaiseLowerKey", "None", (void*)WKBD_CLIPRAISELOWER
,
700 NULL
, getKeybind
, setKeyGrab
702 {"MiniaturizeKey", "None", (void*)WKBD_MINIATURIZE
,
703 NULL
, getKeybind
, setKeyGrab
705 {"HideKey", "None", (void*)WKBD_HIDE
,
706 NULL
, getKeybind
, setKeyGrab
708 {"MoveResizeKey", "None", (void*)WKBD_MOVERESIZE
,
709 NULL
, getKeybind
, setKeyGrab
711 {"CloseKey", "None", (void*)WKBD_CLOSE
,
712 NULL
, getKeybind
, setKeyGrab
714 {"MaximizeKey", "None", (void*)WKBD_MAXIMIZE
,
715 NULL
, getKeybind
, setKeyGrab
717 {"VMaximizeKey", "None", (void*)WKBD_VMAXIMIZE
,
718 NULL
, getKeybind
, setKeyGrab
720 {"RaiseKey", "\"Meta+Up\"", (void*)WKBD_RAISE
,
721 NULL
, getKeybind
, setKeyGrab
723 {"LowerKey", "\"Meta+Down\"", (void*)WKBD_LOWER
,
724 NULL
, getKeybind
, setKeyGrab
726 {"RaiseLowerKey", "None", (void*)WKBD_RAISELOWER
,
727 NULL
, getKeybind
, setKeyGrab
729 {"ShadeKey", "None", (void*)WKBD_SHADE
,
730 NULL
, getKeybind
, setKeyGrab
732 {"SelectKey", "None", (void*)WKBD_SELECT
,
733 NULL
, getKeybind
, setKeyGrab
735 {"FocusNextKey", "None", (void*)WKBD_FOCUSNEXT
,
736 NULL
, getKeybind
, setKeyGrab
738 {"FocusPrevKey", "None", (void*)WKBD_FOCUSPREV
,
739 NULL
, getKeybind
, setKeyGrab
741 {"NextWorkspaceKey", "None", (void*)WKBD_NEXTWORKSPACE
,
742 NULL
, getKeybind
, setKeyGrab
744 {"PrevWorkspaceKey", "None", (void*)WKBD_PREVWORKSPACE
,
745 NULL
, getKeybind
, setKeyGrab
747 {"NextWorkspaceLayerKey", "None", (void*)WKBD_NEXTWSLAYER
,
748 NULL
, getKeybind
, setKeyGrab
750 {"PrevWorkspaceLayerKey", "None", (void*)WKBD_PREVWSLAYER
,
751 NULL
, getKeybind
, setKeyGrab
753 {"Workspace1Key", "None", (void*)WKBD_WORKSPACE1
,
754 NULL
, getKeybind
, setKeyGrab
756 {"Workspace2Key", "None", (void*)WKBD_WORKSPACE2
,
757 NULL
, getKeybind
, setKeyGrab
759 {"Workspace3Key", "None", (void*)WKBD_WORKSPACE3
,
760 NULL
, getKeybind
, setKeyGrab
762 {"Workspace4Key", "None", (void*)WKBD_WORKSPACE4
,
763 NULL
, getKeybind
, setKeyGrab
765 {"Workspace5Key", "None", (void*)WKBD_WORKSPACE5
,
766 NULL
, getKeybind
, setKeyGrab
768 {"Workspace6Key", "None", (void*)WKBD_WORKSPACE6
,
769 NULL
, getKeybind
, setKeyGrab
771 {"Workspace7Key", "None", (void*)WKBD_WORKSPACE7
,
772 NULL
, getKeybind
, setKeyGrab
774 {"Workspace8Key", "None", (void*)WKBD_WORKSPACE8
,
775 NULL
, getKeybind
, setKeyGrab
777 {"Workspace9Key", "None", (void*)WKBD_WORKSPACE9
,
778 NULL
, getKeybind
, setKeyGrab
780 {"Workspace10Key", "None", (void*)WKBD_WORKSPACE10
,
781 NULL
, getKeybind
, setKeyGrab
783 {"WindowShortcut1Key","None", (void*)WKBD_WINDOW1
,
784 NULL
, getKeybind
, setKeyGrab
786 {"WindowShortcut2Key","None", (void*)WKBD_WINDOW2
,
787 NULL
, getKeybind
, setKeyGrab
789 {"WindowShortcut3Key","None", (void*)WKBD_WINDOW3
,
790 NULL
, getKeybind
, setKeyGrab
792 {"WindowShortcut4Key","None", (void*)WKBD_WINDOW4
,
793 NULL
, getKeybind
, setKeyGrab
795 ,{"WindowShortcut5Key","None", (void*)WKBD_WINDOW5
,
796 NULL
, getKeybind
, setKeyGrab
798 {"WindowShortcut6Key","None", (void*)WKBD_WINDOW6
,
799 NULL
, getKeybind
, setKeyGrab
801 {"WindowShortcut7Key","None", (void*)WKBD_WINDOW7
,
802 NULL
, getKeybind
, setKeyGrab
804 {"WindowShortcut8Key","None", (void*)WKBD_WINDOW8
,
805 NULL
, getKeybind
, setKeyGrab
807 {"WindowShortcut9Key","None", (void*)WKBD_WINDOW9
,
808 NULL
, getKeybind
, setKeyGrab
810 {"WindowShortcut10Key","None", (void*)WKBD_WINDOW10
,
811 NULL
, getKeybind
, setKeyGrab
813 {"ScreenSwitchKey", "None", (void*)WKBD_SWITCH_SCREEN
,
814 NULL
, getKeybind
, setKeyGrab
817 #ifdef KEEP_XKB_LOCK_STATUS
818 {"ToggleKbdModeKey", "None", (void*)WKBD_TOGGLE
,
819 NULL
, getKeybind
, setKeyGrab
821 {"KbdModeLock", "NO", NULL
,
822 &wPreferences
.modelock
, getBool
, NULL
824 #endif /* KEEP_XKB_LOCK_STATUS */
825 #ifdef DEFINABLE_CURSOR
826 {"NormalCursor", "(builtin, left_ptr)", (void*)WCUR_ROOT
,
827 NULL
, getCursor
, setCursor
829 {"MoveCursor", "(builtin, fleur)", (void*)WCUR_MOVE
,
830 NULL
, getCursor
, setCursor
833 {"TopLeftResizeCursor", "(builtin, sizing)", (void*)WCUR_TOPLEFTRESIZE
,
834 NULL
, getCursor
, setCursor
836 {"TopRightResizeCursor", "(builtin, sizing)", (void*)WCUR_TOPRIGHTRESIZE
,
837 NULL
, getCursor
, setCursor
839 {"BottomLeftResizeCursor", "(builtin, sizing)", (void*)WCUR_BOTTOMLEFTRESIZE
,
840 NULL
, getCursor
, setCursor
842 {"BottomRightResizeCursor", "(builtin, sizing)", (void*)WCUR_BOTTOMRIGHTRESIZE
,
843 NULL
, getCursor
, setCursor
845 {"VerticalResizeCursor", "(builtin, sizing)", (void*)WCUR_VERTICALRESIZE
,
846 NULL
, getCursor
, setCursor
848 {"HorizonResizeCursor", "(builtin, sizing)", (void*)WCUR_HORIZONRESIZE
,
849 NULL
, getCursor
, setCursor
851 {"WaitCursor", "(builtin, watch)", (void*)WCUR_WAIT
,
852 NULL
, getCursor
, setCursor
854 {"ArrowCursor", "(builtin, top_left_arrow)", (void*)WCUR_ARROW
,
855 NULL
, getCursor
, setCursor
858 #endif /* DEFINABLE_CURSOR */
863 static void rereadDefaults(void);
870 /* must defer the update because accessing X data from a
871 * signal handler can mess up Xlib */
880 WDefaultEntry
*entry
;
882 PLSetStringCmpHook(StringCompareHook
);
884 for (i
=0; i
<sizeof(optionList
)/sizeof(WDefaultEntry
); i
++) {
885 entry
= &optionList
[i
];
887 entry
->plkey
= PLMakeString(entry
->key
);
888 if (entry
->default_value
)
889 entry
->plvalue
= PLGetProplistWithDescription(entry
->default_value
);
891 entry
->plvalue
= NULL
;
894 for (i
=0; i
<sizeof(staticOptionList
)/sizeof(WDefaultEntry
); i
++) {
895 entry
= &staticOptionList
[i
];
897 entry
->plkey
= PLMakeString(entry
->key
);
898 if (entry
->default_value
)
899 entry
->plvalue
= PLGetProplistWithDescription(entry
->default_value
);
901 entry
->plvalue
= NULL
;
905 wDomainName = PLMakeString(WMDOMAIN_NAME);
906 wAttributeDomainName = PLMakeString(WMATTRIBUTE_DOMAIN_NAME);
908 PLRegister(wDomainName, rereadDefaults);
909 PLRegister(wAttributeDomainName, rereadDefaults);
918 wDefaultsInit(int screen_number
)
920 static int defaults_inited
= 0;
923 if (!defaults_inited
) {
927 dict
= PLGetDomain(wDomainName
);
929 wwarning(_("could not read domain \"%s\" from defaults database"),
930 PLGetString(wDomainName
));
939 wDefaultsDestroyDomain(WDDomain
*domain
)
941 if (domain
->dictionary
)
942 PLRelease(domain
->dictionary
);
949 wDefaultsInitDomain(char *domain
, Bool requireDictionary
)
953 static int inited
= 0;
956 proplist_t shared_dict
=NULL
;
963 db
= wmalloc(sizeof(WDDomain
));
964 memset(db
, 0, sizeof(WDDomain
));
965 db
->domain_name
= domain
;
966 db
->path
= wdefaultspathfordomain(domain
);
969 if (the_path
&& stat(the_path
, &stbuf
)>=0) {
970 db
->dictionary
= ReadProplistFromFile(the_path
);
971 if (db
->dictionary
) {
972 if (requireDictionary
&& !PLIsDictionary(db
->dictionary
)) {
973 PLRelease(db
->dictionary
);
974 db
->dictionary
= NULL
;
975 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
978 db
->timestamp
= stbuf
.st_mtime
;
980 wwarning(_("could not load domain %s from user defaults database"),
985 /* global system dictionary */
986 sprintf(path
, "%s/WindowMaker/%s", SYSCONFDIR
, domain
);
987 if (stat(path
, &stbuf
)>=0) {
988 shared_dict
= ReadProplistFromFile(path
);
990 if (requireDictionary
&& !PLIsDictionary(shared_dict
)) {
991 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
993 PLRelease(shared_dict
);
996 if (db
->dictionary
&& PLIsDictionary(shared_dict
) &&
997 PLIsDictionary(db
->dictionary
)) {
998 PLMergeDictionaries(shared_dict
, db
->dictionary
);
999 PLRelease(db
->dictionary
);
1000 db
->dictionary
= shared_dict
;
1001 if (stbuf
.st_mtime
> db
->timestamp
)
1002 db
->timestamp
= stbuf
.st_mtime
;
1003 } else if (!db
->dictionary
) {
1004 db
->dictionary
= shared_dict
;
1005 if (stbuf
.st_mtime
> db
->timestamp
)
1006 db
->timestamp
= stbuf
.st_mtime
;
1010 wwarning(_("could not load domain %s from global defaults database (%s)"),
1015 /* set to save it in user's directory, no matter from where it was read */
1016 if (db
->dictionary
) {
1017 proplist_t tmp
= PLMakeString(db
->path
);
1019 PLSetFilename(db
->dictionary
, tmp
);
1028 wReadStaticDefaults(proplist_t dict
)
1031 WDefaultEntry
*entry
;
1036 for (i
=0; i
<sizeof(staticOptionList
)/sizeof(WDefaultEntry
); i
++) {
1037 entry
= &staticOptionList
[i
];
1040 plvalue
= PLGetDictionaryEntry(dict
, entry
->plkey
);
1045 /* no default in the DB. Use builtin default */
1046 plvalue
= entry
->plvalue
;
1051 (*entry
->convert
)(NULL
, entry
, plvalue
, entry
->addr
, &tdata
);
1052 if (entry
->update
) {
1053 (*entry
->update
)(NULL
, entry
, tdata
, entry
->extra_data
);
1061 wDefaultsCheckDomains(void *foo
)
1067 char path
[PATH_MAX
];
1070 puts("Checking domains...");
1072 if (stat(WDWindowMaker
->path
, &stbuf
)>=0
1073 && WDWindowMaker
->timestamp
< stbuf
.st_mtime
) {
1074 proplist_t shared_dict
= NULL
;
1076 puts("Checking WindowMaker domain");
1078 WDWindowMaker
->timestamp
= stbuf
.st_mtime
;
1080 /* global dictionary */
1081 sprintf(path
, "%s/WindowMaker/WindowMaker", SYSCONFDIR
);
1082 if (stat(path
, &stbuf
)>=0) {
1083 shared_dict
= ReadProplistFromFile(path
);
1084 if (shared_dict
&& !PLIsDictionary(shared_dict
)) {
1085 wwarning(_("Domain %s (%s) of global defaults database is corrupted!"),
1086 "WindowMaker", path
);
1087 PLRelease(shared_dict
);
1089 } else if (!shared_dict
) {
1090 wwarning(_("could not load domain %s from global defaults database"),
1094 /* user dictionary */
1095 dict
= ReadProplistFromFile(WDWindowMaker
->path
);
1097 if (!PLIsDictionary(dict
)) {
1100 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1101 "WindowMaker", WDWindowMaker
->path
);
1104 PLSetFilename(shared_dict
, PLGetFilename(dict
));
1105 PLMergeDictionaries(shared_dict
, dict
);
1110 for (i
=0; i
<wScreenCount
; i
++) {
1111 scr
= wScreenWithNumber(i
);
1113 wReadDefaults(scr
, dict
);
1115 if (WDWindowMaker
->dictionary
) {
1116 PLRelease(WDWindowMaker
->dictionary
);
1118 WDWindowMaker
->dictionary
= dict
;
1121 wwarning(_("could not load domain %s from user defaults database"),
1125 PLRelease(shared_dict
);
1129 if (stat(WDWindowAttributes
->path
, &stbuf
)>=0
1130 && WDWindowAttributes
->timestamp
< stbuf
.st_mtime
) {
1132 puts("Checking WMWindowAttributes domain");
1134 dict
= ReadProplistFromFile(WDWindowAttributes
->path
);
1136 if (!PLIsDictionary(dict
)) {
1139 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1140 "WMWindowAttributes", WDWindowAttributes
->path
);
1142 if (WDWindowAttributes
->dictionary
)
1143 PLRelease(WDWindowAttributes
->dictionary
);
1144 WDWindowAttributes
->dictionary
= dict
;
1145 for (i
=0; i
<wScreenCount
; i
++) {
1146 scr
= wScreenWithNumber(i
);
1148 wDefaultUpdateIcons(scr
);
1152 wwarning(_("could not load domain %s from user defaults database"),
1153 "WMWindowAttributes");
1155 WDWindowAttributes
->timestamp
= stbuf
.st_mtime
;
1159 if (stat(WDRootMenu
->path
, &stbuf
)>=0
1160 && WDRootMenu
->timestamp
< stbuf
.st_mtime
) {
1161 dict
= ReadProplistFromFile(WDRootMenu
->path
);
1163 puts("Checking WMRootMenu domain");
1166 if (!PLIsArray(dict
) && !PLIsString(dict
)) {
1169 wwarning(_("Domain %s (%s) of defaults database is corrupted!"),
1170 "WMRootMenu", WDRootMenu
->path
);
1172 if (WDRootMenu
->dictionary
) {
1173 PLRelease(WDRootMenu
->dictionary
);
1175 WDRootMenu
->dictionary
= dict
;
1178 wwarning(_("could not load domain %s from user defaults database"),
1181 WDRootMenu
->timestamp
= stbuf
.st_mtime
;
1186 WMAddTimerHandler(DEFAULTS_CHECK_INTERVAL
, wDefaultsCheckDomains
, foo
);
1191 wReadDefaults(WScreen
*scr
, proplist_t new_dict
)
1193 proplist_t plvalue
, old_value
;
1194 WDefaultEntry
*entry
;
1196 int update_workspace_back
= 0; /* kluge :/ */
1199 proplist_t old_dict
= (WDWindowMaker
->dictionary
!=new_dict
1200 ? WDWindowMaker
->dictionary
: NULL
);
1206 for (i
=0; i
<sizeof(optionList
)/sizeof(WDefaultEntry
); i
++) {
1207 entry
= &optionList
[i
];
1210 plvalue
= PLGetDictionaryEntry(new_dict
, entry
->plkey
);
1217 old_value
= PLGetDictionaryEntry(old_dict
, entry
->plkey
);
1220 if (!plvalue
&& !old_value
) {
1221 /* no default in the DB. Use builtin default */
1222 plvalue
= entry
->plvalue
;
1223 if (plvalue
&& new_dict
) {
1224 PLInsertDictionaryEntry(new_dict
, entry
->plkey
, plvalue
);
1227 } else if (!plvalue
) {
1228 /* value was deleted from DB. Keep current value */
1230 } else if (!old_value
) {
1231 /* set value for the 1st time */
1232 } else if (!PLIsEqual(plvalue
, old_value
)) {
1233 /* value has changed */
1236 if (strcmp(entry
->key
, "WorkspaceBack") == 0
1237 && update_workspace_back
1238 && scr
->flags
.backimage_helper_launched
) {
1240 /* value was not changed since last time */
1247 printf("Updating %s to %s\n", entry
->key
,
1248 PLGetDescription(plvalue
));
1251 if ((*entry
->convert
)(scr
, entry
, plvalue
, entry
->addr
, &tdata
)) {
1253 * If the WorkspaceSpecificBack data has been changed
1254 * so that the helper will be launched now, we must be
1255 * sure to send the default background texture config
1258 if (strcmp(entry
->key
, "WorkspaceSpecificBack") == 0
1259 && !scr
->flags
.backimage_helper_launched
) {
1260 update_workspace_back
= 1;
1262 if (entry
->update
) {
1264 (*entry
->update
)(scr
, entry
, tdata
, entry
->extra_data
);
1270 if (needs_refresh
!=0 && !scr
->flags
.startup
) {
1274 if (needs_refresh
& REFRESH_MENU_TITLE_TEXTURE
)
1275 foo
|= WTextureSettings
;
1276 if (needs_refresh
& REFRESH_MENU_TITLE_FONT
)
1277 foo
|= WFontSettings
;
1278 if (needs_refresh
& REFRESH_MENU_TITLE_COLOR
)
1279 foo
|= WColorSettings
;
1281 WMPostNotificationName(WNMenuTitleAppearanceSettingsChanged
, NULL
,
1285 if (needs_refresh
& REFRESH_MENU_TEXTURE
)
1286 foo
|= WTextureSettings
;
1287 if (needs_refresh
& REFRESH_MENU_FONT
)
1288 foo
|= WFontSettings
;
1289 if (needs_refresh
& REFRESH_MENU_COLOR
)
1290 foo
|= WColorSettings
;
1292 WMPostNotificationName(WNMenuAppearanceSettingsChanged
, NULL
,
1296 if (needs_refresh
& REFRESH_WINDOW_FONT
) {
1297 foo
|= WFontSettings
;
1299 if (needs_refresh
& REFRESH_WINDOW_TEXTURES
) {
1300 foo
|= WTextureSettings
;
1302 if (needs_refresh
& REFRESH_WINDOW_TITLE_COLOR
) {
1303 foo
|= WColorSettings
;
1306 WMPostNotificationName(WNWindowAppearanceSettingsChanged
, NULL
,
1309 if (!(needs_refresh
& REFRESH_ICON_TILE
)) {
1311 if (needs_refresh
& REFRESH_ICON_FONT
) {
1312 foo
|= WFontSettings
;
1314 if (needs_refresh
& REFRESH_ICON_TITLE_COLOR
) {
1315 foo
|= WTextureSettings
;
1317 if (needs_refresh
& REFRESH_ICON_TITLE_BACK
) {
1318 foo
|= WTextureSettings
;
1321 WMPostNotificationName(WNIconAppearanceSettingsChanged
, NULL
,
1324 if (needs_refresh
& REFRESH_ICON_TILE
)
1325 WMPostNotificationName(WNIconTileSettingsChanged
, NULL
, NULL
);
1331 wDefaultUpdateIcons(WScreen
*scr
)
1333 WAppIcon
*aicon
= scr
->app_icon_list
;
1334 WWindow
*wwin
= scr
->focused_window
;
1338 file
= wDefaultGetIconFile(scr
, aicon
->wm_instance
, aicon
->wm_class
,
1340 if ((file
&& aicon
->icon
->file
&& strcmp(file
, aicon
->icon
->file
)!=0)
1341 || (file
&& !aicon
->icon
->file
)) {
1344 if (aicon
->icon
->file
)
1345 wfree(aicon
->icon
->file
);
1346 aicon
->icon
->file
= wstrdup(file
);
1348 new_image
= wDefaultGetImage(scr
, aicon
->wm_instance
,
1351 wIconChangeImage(aicon
->icon
, new_image
);
1352 wAppIconPaint(aicon
);
1355 aicon
= aicon
->next
;
1358 if (!wPreferences
.flags
.noclip
)
1359 wClipIconPaint(scr
->clip_icon
);
1362 if (wwin
->icon
&& wwin
->flags
.miniaturized
) {
1363 file
= wDefaultGetIconFile(scr
, wwin
->wm_instance
, wwin
->wm_class
,
1365 if ((file
&& wwin
->icon
->file
&& strcmp(file
, wwin
->icon
->file
)!=0)
1366 || (file
&& !wwin
->icon
->file
)) {
1369 if (wwin
->icon
->file
)
1370 wfree(wwin
->icon
->file
);
1371 wwin
->icon
->file
= wstrdup(file
);
1373 new_image
= wDefaultGetImage(scr
, wwin
->wm_instance
,
1376 wIconChangeImage(wwin
->icon
, new_image
);
1384 /* --------------------------- Local ----------------------- */
1386 #define GET_STRING_OR_DEFAULT(x, var) if (!PLIsString(value)) { \
1387 wwarning(_("Wrong option format for key \"%s\". Should be %s."), \
1389 wwarning(_("using default \"%s\" instead"), entry->default_value); \
1390 var = entry->default_value;\
1391 } else var = PLGetString(value)\
1398 string2index(proplist_t key
, proplist_t val
, proplist_t def
,
1399 WOptionEnumeration
*values
)
1402 WOptionEnumeration
*v
;
1403 char buffer
[TOTAL_VALUES_LENGTH
];
1405 if (PLIsString(val
) && (str
= PLGetString(val
))) {
1406 for (v
=values
; v
->string
!=NULL
; v
++) {
1407 if (strcasecmp(v
->string
, str
)==0)
1413 for (v
=values
; v
->string
!=NULL
; v
++) {
1416 strcat(buffer
, ", ");
1417 strcat(buffer
, v
->string
);
1420 wwarning(_("wrong option value for key \"%s\". Should be one of %s"),
1421 PLGetString(key
), buffer
);
1424 return string2index(key
, val
, NULL
, values
);
1434 * value - is the value in the defaults DB
1435 * addr - is the address to store the data
1436 * ret - is the address to store a pointer to a temporary buffer. ret
1437 * must not be freed and is used by the set functions
1440 getBool(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1447 GET_STRING_OR_DEFAULT("Boolean", val
);
1450 if ((val
[1]=='\0' && (val
[0]=='y' || val
[0]=='Y'))
1451 || strcasecmp(val
, "YES")==0) {
1454 } else if ((val
[1]=='\0' && (val
[0]=='n' || val
[0]=='N'))
1455 || strcasecmp(val
, "NO")==0) {
1459 if (sscanf(val
, "%i", &i
)==1) {
1465 wwarning(_("can't convert \"%s\" to boolean for key \"%s\""),
1467 if (second_pass
==0) {
1468 val
= PLGetString(entry
->plvalue
);
1470 wwarning(_("using default \"%s\" instead"), val
);
1481 *(char*)addr
= data
;
1489 getInt(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1496 GET_STRING_OR_DEFAULT("Integer", val
);
1498 if (sscanf(val
, "%i", &data
)!=1) {
1499 wwarning(_("can't convert \"%s\" to integer for key \"%s\""),
1501 val
= PLGetString(entry
->plvalue
);
1502 wwarning(_("using default \"%s\" instead"), val
);
1503 if (sscanf(val
, "%i", &data
)!=1) {
1519 getCoord(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1523 char *val_x
, *val_y
;
1524 int nelem
, changed
=0;
1525 proplist_t elem_x
, elem_y
;
1528 if (!PLIsArray(value
)) {
1529 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1530 entry
->key
, "Coordinate");
1532 value
= entry
->plvalue
;
1534 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1540 nelem
= PLGetNumberOfElements(value
);
1542 wwarning(_("Incorrect number of elements in array for key \"%s\"."),
1545 value
= entry
->plvalue
;
1547 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1553 elem_x
= PLGetArrayElement(value
, 0);
1554 elem_y
= PLGetArrayElement(value
, 1);
1556 if (!elem_x
|| !elem_y
|| !PLIsString(elem_x
) || !PLIsString(elem_y
)) {
1557 wwarning(_("Wrong value for key \"%s\". Should be Coordinate."),
1560 value
= entry
->plvalue
;
1562 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1568 val_x
= PLGetString(elem_x
);
1569 val_y
= PLGetString(elem_y
);
1571 if (sscanf(val_x
, "%i", &data
.x
)!=1 || sscanf(val_y
, "%i", &data
.y
)!=1) {
1572 wwarning(_("can't convert array to integers for \"%s\"."), entry
->key
);
1574 value
= entry
->plvalue
;
1576 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1584 else if (data
.x
> scr
->scr_width
/3)
1585 data
.x
= scr
->scr_width
/3;
1588 else if (data
.y
> scr
->scr_height
/3)
1589 data
.y
= scr
->scr_height
/3;
1595 *(WCoord
*)addr
= data
;
1603 /* This function is not used at the moment. */
1605 getString(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1610 GET_STRING_OR_DEFAULT("String", data
);
1613 data
= PLGetString(entry
->plvalue
);
1622 *(char**)addr
= wstrdup(data
);
1630 getPathList(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1640 if (!PLIsArray(value
)) {
1641 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
1642 entry
->key
, "an array of paths");
1644 value
= entry
->plvalue
;
1646 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1653 count
= PLGetNumberOfElements(value
);
1656 value
= entry
->plvalue
;
1658 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
1665 for (i
=0; i
<count
; i
++) {
1666 d
= PLGetArrayElement(value
, i
);
1667 if (!d
|| !PLIsString(d
)) {
1671 len
+= strlen(PLGetString(d
))+1;
1674 ptr
= data
= wmalloc(len
+1);
1676 for (i
=0; i
<count
; i
++) {
1677 d
= PLGetArrayElement(value
, i
);
1678 if (!d
|| !PLIsString(d
)) {
1681 strcpy(ptr
, PLGetString(d
));
1682 ptr
+= strlen(PLGetString(d
));
1686 ptr
--; *(ptr
--) = 0;
1688 if (*(char**)addr
!=NULL
) {
1689 wfree(*(char**)addr
);
1691 *(char**)addr
= data
;
1698 getEnum(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
1701 static signed char data
;
1703 data
= string2index(entry
->plkey
, value
, entry
->default_value
,
1704 (WOptionEnumeration
*)entry
->extra_data
);
1712 *(signed char*)addr
= data
;
1721 * (hgradient <color> <color>)
1722 * (vgradient <color> <color>)
1723 * (dgradient <color> <color>)
1724 * (mhgradient <color> <color> ...)
1725 * (mvgradient <color> <color> ...)
1726 * (mdgradient <color> <color> ...)
1727 * (igradient <color1> <color1> <thickness1> <color2> <color2> <thickness2>)
1728 * (tpixmap <file> <color>)
1729 * (spixmap <file> <color>)
1730 * (cpixmap <file> <color>)
1731 * (thgradient <file> <opaqueness> <color> <color>)
1732 * (tvgradient <file> <opaqueness> <color> <color>)
1733 * (tdgradient <file> <opaqueness> <color> <color>)
1734 * (function <lib> <function> ...)
1738 parse_texture(WScreen
*scr
, proplist_t pl
)
1743 WTexture
*texture
=NULL
;
1745 nelem
= PLGetNumberOfElements(pl
);
1750 elem
= PLGetArrayElement(pl
, 0);
1751 if (!elem
|| !PLIsString(elem
))
1753 val
= PLGetString(elem
);
1756 if (strcasecmp(val
, "solid")==0) {
1764 elem
= PLGetArrayElement(pl
, 1);
1765 if (!elem
|| !PLIsString(elem
))
1767 val
= PLGetString(elem
);
1769 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1770 wwarning(_("\"%s\" is not a valid color name"), val
);
1774 texture
= (WTexture
*)wTextureMakeSolid(scr
, &color
);
1775 } else if (strcasecmp(val
, "dgradient")==0
1776 || strcasecmp(val
, "vgradient")==0
1777 || strcasecmp(val
, "hgradient")==0) {
1778 RColor color1
, color2
;
1783 wwarning(_("bad number of arguments in gradient specification"));
1787 if (val
[0]=='d' || val
[0]=='D')
1788 type
= WTEX_DGRADIENT
;
1789 else if (val
[0]=='h' || val
[0]=='H')
1790 type
= WTEX_HGRADIENT
;
1792 type
= WTEX_VGRADIENT
;
1795 /* get from color */
1796 elem
= PLGetArrayElement(pl
, 1);
1797 if (!elem
|| !PLIsString(elem
))
1799 val
= PLGetString(elem
);
1801 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1802 wwarning(_("\"%s\" is not a valid color name"), val
);
1806 color1
.red
= xcolor
.red
>> 8;
1807 color1
.green
= xcolor
.green
>> 8;
1808 color1
.blue
= xcolor
.blue
>> 8;
1811 elem
= PLGetArrayElement(pl
, 2);
1812 if (!elem
|| !PLIsString(elem
)) {
1815 val
= PLGetString(elem
);
1817 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1818 wwarning(_("\"%s\" is not a valid color name"), val
);
1822 color2
.red
= xcolor
.red
>> 8;
1823 color2
.green
= xcolor
.green
>> 8;
1824 color2
.blue
= xcolor
.blue
>> 8;
1826 texture
= (WTexture
*)wTextureMakeGradient(scr
, type
, &color1
, &color2
);
1828 } else if (strcasecmp(val
, "igradient")==0) {
1829 RColor colors1
[2], colors2
[2];
1835 wwarning(_("bad number of arguments in gradient specification"));
1839 /* get from color */
1840 for (i
= 0; i
< 2; i
++) {
1841 elem
= PLGetArrayElement(pl
, 1+i
);
1842 if (!elem
|| !PLIsString(elem
))
1844 val
= PLGetString(elem
);
1846 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1847 wwarning(_("\"%s\" is not a valid color name"), val
);
1850 colors1
[i
].alpha
= 255;
1851 colors1
[i
].red
= xcolor
.red
>> 8;
1852 colors1
[i
].green
= xcolor
.green
>> 8;
1853 colors1
[i
].blue
= xcolor
.blue
>> 8;
1855 elem
= PLGetArrayElement(pl
, 3);
1856 if (!elem
|| !PLIsString(elem
))
1858 val
= PLGetString(elem
);
1862 /* get from color */
1863 for (i
= 0; i
< 2; i
++) {
1864 elem
= PLGetArrayElement(pl
, 4+i
);
1865 if (!elem
|| !PLIsString(elem
))
1867 val
= PLGetString(elem
);
1869 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
1870 wwarning(_("\"%s\" is not a valid color name"), val
);
1873 colors2
[i
].alpha
= 255;
1874 colors2
[i
].red
= xcolor
.red
>> 8;
1875 colors2
[i
].green
= xcolor
.green
>> 8;
1876 colors2
[i
].blue
= xcolor
.blue
>> 8;
1878 elem
= PLGetArrayElement(pl
, 6);
1879 if (!elem
|| !PLIsString(elem
))
1881 val
= PLGetString(elem
);
1884 texture
= (WTexture
*)wTextureMakeIGradient(scr
, th1
, colors1
,
1887 } else if (strcasecmp(val
, "mhgradient")==0
1888 || strcasecmp(val
, "mvgradient")==0
1889 || strcasecmp(val
, "mdgradient")==0) {
1896 wwarning(_("too few arguments in multicolor gradient specification"));
1900 if (val
[1]=='h' || val
[1]=='H')
1901 type
= WTEX_MHGRADIENT
;
1902 else if (val
[1]=='v' || val
[1]=='V')
1903 type
= WTEX_MVGRADIENT
;
1905 type
= WTEX_MDGRADIENT
;
1909 colors
= wmalloc(sizeof(RColor
*)*(count
+1));
1911 for (i
=0; i
<count
; i
++) {
1912 elem
= PLGetArrayElement(pl
, i
+1);
1913 if (!elem
|| !PLIsString(elem
)) {
1914 for (--i
; i
>=0; --i
) {
1920 val
= PLGetString(elem
);
1922 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1923 wwarning(_("\"%s\" is not a valid color name"), val
);
1924 for (--i
; i
>=0; --i
) {
1930 colors
[i
] = wmalloc(sizeof(RColor
));
1931 colors
[i
]->red
= color
.red
>> 8;
1932 colors
[i
]->green
= color
.green
>> 8;
1933 colors
[i
]->blue
= color
.blue
>> 8;
1938 texture
= (WTexture
*)wTextureMakeMGradient(scr
, type
, colors
);
1939 } else if (strcasecmp(val
, "spixmap")==0 ||
1940 strcasecmp(val
, "cpixmap")==0 ||
1941 strcasecmp(val
, "tpixmap")==0) {
1948 if (val
[0] == 's' || val
[0] == 'S')
1950 else if (val
[0] == 'c' || val
[0] == 'C')
1956 elem
= PLGetArrayElement(pl
, 2);
1957 if (!elem
|| !PLIsString(elem
)) {
1960 val
= PLGetString(elem
);
1962 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &color
)) {
1963 wwarning(_("\"%s\" is not a valid color name"), val
);
1968 elem
= PLGetArrayElement(pl
, 1);
1969 if (!elem
|| !PLIsString(elem
))
1971 val
= PLGetString(elem
);
1973 texture
= (WTexture
*)wTextureMakePixmap(scr
, type
, val
, &color
);
1974 } else if (strcasecmp(val
, "thgradient")==0
1975 || strcasecmp(val
, "tvgradient")==0
1976 || strcasecmp(val
, "tdgradient")==0) {
1977 RColor color1
, color2
;
1982 if (val
[1]=='h' || val
[1]=='H')
1983 style
= WTEX_THGRADIENT
;
1984 else if (val
[1]=='v' || val
[1]=='V')
1985 style
= WTEX_TVGRADIENT
;
1987 style
= WTEX_TDGRADIENT
;
1990 wwarning(_("bad number of arguments in textured gradient specification"));
1994 /* get from color */
1995 elem
= PLGetArrayElement(pl
, 3);
1996 if (!elem
|| !PLIsString(elem
))
1998 val
= PLGetString(elem
);
2000 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
2001 wwarning(_("\"%s\" is not a valid color name"), val
);
2005 color1
.red
= xcolor
.red
>> 8;
2006 color1
.green
= xcolor
.green
>> 8;
2007 color1
.blue
= xcolor
.blue
>> 8;
2010 elem
= PLGetArrayElement(pl
, 4);
2011 if (!elem
|| !PLIsString(elem
)) {
2014 val
= PLGetString(elem
);
2016 if (!XParseColor(dpy
, scr
->w_colormap
, val
, &xcolor
)) {
2017 wwarning(_("\"%s\" is not a valid color name"), val
);
2021 color2
.red
= xcolor
.red
>> 8;
2022 color2
.green
= xcolor
.green
>> 8;
2023 color2
.blue
= xcolor
.blue
>> 8;
2026 elem
= PLGetArrayElement(pl
, 2);
2027 if (!elem
|| !PLIsString(elem
))
2030 val
= PLGetString(elem
);
2032 if (!val
|| (opacity
= atoi(val
)) < 0 || opacity
> 255) {
2033 wwarning(_("bad opacity value for tgradient texture \"%s\". Should be [0..255]"), val
);
2038 elem
= PLGetArrayElement(pl
, 1);
2039 if (!elem
|| !PLIsString(elem
))
2041 val
= PLGetString(elem
);
2043 texture
= (WTexture
*)wTextureMakeTGradient(scr
, style
, &color1
, &color2
,
2046 #ifdef TEXTURE_PLUGIN
2047 else if (strcasecmp(val
, "function")==0) {
2048 WTexFunction
*function
;
2049 void (*initFunc
) (Display
*, Colormap
);
2050 char *lib
, *func
, **argv
;
2056 /* get the library name */
2057 elem
= PLGetArrayElement(pl
, 1);
2058 if (!elem
|| !PLIsString(elem
)) {
2061 lib
= PLGetString(elem
);
2063 /* get the function name */
2064 elem
= PLGetArrayElement(pl
, 2);
2065 if (!elem
|| !PLIsString(elem
)) {
2068 func
= PLGetString(elem
);
2071 argv
= (char **)wmalloc(argc
* sizeof(char *));
2073 /* get the parameters */
2074 argv
[0] = wstrdup(func
);
2075 for (i
= 0; i
< argc
- 1; i
++) {
2076 elem
= PLGetArrayElement(pl
, 3 + i
);
2077 if (!elem
|| !PLIsString(elem
)) {
2082 argv
[i
+1] = wstrdup(PLGetString(elem
));
2085 function
= wTextureMakeFunction(scr
, lib
, func
, argc
, argv
);
2089 initFunc
= dlsym(function
->handle
, "initWindowMaker");
2091 initFunc(dpy
, scr
->w_colormap
);
2093 wwarning(_("could not initialize library %s"), lib
);
2096 wwarning(_("could not find function %s::%s"), lib
, func
);
2098 #endif /* HAVE_DLFCN_H */
2099 texture
= (WTexture
*)function
;
2101 #endif /* TEXTURE_PLUGIN */
2103 wwarning(_("invalid texture type %s"), val
);
2112 getTexture(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2115 static WTexture
*texture
;
2119 if (!PLIsArray(value
)) {
2120 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2121 entry
->key
, "Texture");
2123 value
= entry
->plvalue
;
2125 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2131 if (strcmp(entry
->key
, "WidgetColor")==0 && !changed
) {
2134 pl
= PLGetArrayElement(value
, 0);
2135 if (!pl
|| !PLIsString(pl
) || !PLGetString(pl
)
2136 || strcasecmp(PLGetString(pl
), "solid")!=0) {
2137 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2138 entry
->key
, "Solid Texture");
2140 value
= entry
->plvalue
;
2142 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2147 texture
= parse_texture(scr
, value
);
2150 wwarning(_("Error in texture specification for key \"%s\""),
2153 value
= entry
->plvalue
;
2155 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2165 *(WTexture
**)addr
= texture
;
2172 #ifdef DRAWSTRING_PLUGIN
2174 getTextRenderer(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
2175 void *addr
, void **ret
)
2178 char *val
, *lib
, *func
, **argv
;
2181 /* Destroying functions if they are already loaded. */
2182 /* The function will auto-check NULL, does this break any ethic? */
2183 if (strcmp(entry
->key
, "FTitleColor")==0) {
2184 wPluginDestroyFunction(scr
->drawstring_func
[changed
= W_STRING_FTITLE
]);
2185 scr
->drawstring_func
[W_STRING_FTITLE
] = NULL
;
2186 } else if (strcmp(entry
->key
, "UTitleColor")==0) {
2187 wPluginDestroyFunction(scr
->drawstring_func
[changed
= W_STRING_UTITLE
]);
2188 scr
->drawstring_func
[W_STRING_UTITLE
] = NULL
;
2189 } else if (strcmp(entry
->key
, "PTitleColor")==0) {
2190 wPluginDestroyFunction(scr
->drawstring_func
[changed
= W_STRING_PTITLE
]);
2191 scr
->drawstring_func
[W_STRING_PTITLE
] = NULL
;
2192 } else if (strcmp(entry
->key
, "MenuTitleColor")==0) {
2193 wPluginDestroyFunction(scr
->drawstring_func
[changed
= W_STRING_MTITLE
]);
2194 scr
->drawstring_func
[W_STRING_MTITLE
] = NULL
;
2195 } else if (strcmp(entry
->key
, "MenuTextColor")==0) { /* problemssss */
2196 wPluginDestroyFunction(scr
->drawstring_func
[changed
= W_STRING_MTEXT
]);
2197 scr
->drawstring_func
[W_STRING_MTEXT
] = NULL
;
2200 if (PLIsArray(value
)) {
2201 if ((argc
= PLGetNumberOfElements(value
)) < 4) return False
;
2203 argv
= (char **)wmalloc(argc
* sizeof(char *));
2205 elem
= PLGetArrayElement(value
,0);
2206 if (!elem
|| !PLIsString(elem
)) return False
;
2207 val
= PLGetString(elem
);
2208 if (strcasecmp(val
, "function")==0) {
2209 elem
= PLGetArrayElement(value
, 1); /* library name */
2210 if (!elem
|| !PLIsString(elem
)) return False
;
2211 lib
= PLGetString(elem
);
2212 elem
= PLGetArrayElement(value
, 2); /* function name */
2213 if (!elem
|| !PLIsString(elem
)) return False
;
2214 func
= PLGetString(elem
);
2215 scr
->drawstring_func
[changed
] = wPluginCreateFunction(W_FUNCTION_DRAWSTRING
,
2216 lib
, "initDrawString",
2217 wPluginPackData(2, func
, "widthOfString"),
2218 "destroyDrawString", value
,
2219 wPluginPackData(3, dpy
, &scr
->w_colormap
, "dummy"));
2222 return getColor(scr
, entry
, PLGetArrayElement(value
,3), addr
, ret
);
2223 } else if (PLIsString(value
)) {
2224 return getColor(scr
, entry
, value
, addr
, ret
);
2229 #endif /* DRAWSTRING_PLUGIN */
2234 getWSBackground(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
2235 void *addr
, void **ret
)
2243 if (!PLIsArray(value
)) {
2244 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2245 "WorkspaceBack", "Texture or None");
2247 value
= entry
->plvalue
;
2249 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2255 /* only do basic error checking and verify for None texture */
2257 nelem
= PLGetNumberOfElements(value
);
2259 elem
= PLGetArrayElement(value
, 0);
2260 if (!elem
|| !PLIsString(elem
)) {
2261 wwarning(_("Wrong type for workspace background. Should be a texture type."));
2263 value
= entry
->plvalue
;
2265 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2270 val
= PLGetString(elem
);
2272 if (strcasecmp(val
, "None")==0)
2275 *ret
= PLRetain(value
);
2282 getWSSpecificBackground(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
2283 void *addr
, void **ret
)
2290 if (!PLIsArray(value
)) {
2291 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2292 "WorkspaceSpecificBack", "an array of textures");
2294 value
= entry
->plvalue
;
2296 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2302 /* only do basic error checking and verify for None texture */
2304 nelem
= PLGetNumberOfElements(value
);
2307 elem
= PLGetArrayElement(value
, nelem
);
2308 if (!elem
|| !PLIsArray(elem
)) {
2309 wwarning(_("Wrong type for background of workspace %i. Should be a texture."),
2315 *ret
= PLRetain(value
);
2319 * Kluge to force wmsetbg helper to set the default background.
2320 * If the WorkspaceSpecificBack is changed once wmaker has started,
2321 * the WorkspaceBack won't be sent to the helper, unless the user
2322 * changes it's value too. So, we must force this by removing the
2323 * value from the defaults DB.
2325 if (!scr
->flags
.backimage_helper_launched
&& !scr
->flags
.startup
) {
2326 proplist_t key
= PLMakeString("WorkspaceBack");
2328 PLRemoveDictionaryEntry(WDWindowMaker
->dictionary
, key
);
2338 getFont(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2341 static WMFont
*font
;
2344 GET_STRING_OR_DEFAULT("Font", val
);
2346 font
= WMCreateFont(scr
->wmscreen
, val
);
2348 font
= WMCreateFont(scr
->wmscreen
, "fixed");
2351 wfatal(_("could not load any usable font!!!"));
2358 /* can't assign font value outside update function */
2359 wassertrv(addr
== NULL
, True
);
2366 getColor(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2369 static XColor color
;
2373 GET_STRING_OR_DEFAULT("Color", val
);
2377 if (!wGetColor(scr
, val
, &color
)) {
2378 wwarning(_("could not get color for key \"%s\""),
2380 if (second_pass
==0) {
2381 val
= PLGetString(entry
->plvalue
);
2383 wwarning(_("using default \"%s\" instead"), val
);
2395 *(unsigned long*)addr = pixel;
2404 getKeybind(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2407 static WShortKey shortcut
;
2414 GET_STRING_OR_DEFAULT("Key spec", val
);
2416 if (!val
|| strcasecmp(val
, "NONE")==0) {
2417 shortcut
.keycode
= 0;
2418 shortcut
.modifier
= 0;
2429 shortcut
.modifier
= 0;
2430 while ((k
= strchr(b
, '+'))!=NULL
) {
2434 mod
= wXModifierFromKey(b
);
2436 wwarning(_("%s:invalid key modifier \"%s\""), entry
->key
, b
);
2439 shortcut
.modifier
|= mod
;
2445 ksym
= XStringToKeysym(b
);
2447 if (ksym
==NoSymbol
) {
2448 wwarning(_("%s:invalid kbd shortcut specification \"%s\""), entry
->key
,
2453 shortcut
.keycode
= XKeysymToKeycode(dpy
, ksym
);
2454 if (shortcut
.keycode
==0) {
2455 wwarning(_("%s:invalid key in shortcut \"%s\""), entry
->key
, val
);
2467 getModMask(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2470 static unsigned int mask
;
2473 GET_STRING_OR_DEFAULT("Modifier Key", str
);
2478 mask
= wXModifierFromKey(str
);
2480 wwarning(_("%s: modifier key %s is not valid"), entry
->key
, str
);
2486 *(unsigned int*)addr
= mask
;
2497 getRImages(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
2498 void *addr
, void **ret
)
2506 GET_STRING_OR_DEFAULT("Image File Path", str
);
2510 image
= RLoadImage(scr
->rcontext
, str
, 0);
2512 wwarning(_("could not load image in option %s: %s"), entry
->key
,
2513 RMessageForError(RErrorCode
));
2517 if (*(RImage
**)addr
) {
2518 RDestroyImage(*(RImage
**)addr
);
2521 *(RImage
**)addr
= image
;
2523 assert(ret
== NULL
);
2526 *(RImage**)ret = image;
2533 #ifdef DEFINABLE_CURSOR
2535 # include <X11/cursorfont.h>
2542 #define CURSOR_ID_NONE (XC_num_glyphs)
2544 static WCursorLookup cursor_table
[] =
2546 { "X_cursor", XC_X_cursor
},
2547 { "arrow", XC_arrow
},
2548 { "based_arrow_down", XC_based_arrow_down
},
2549 { "based_arrow_up", XC_based_arrow_up
},
2550 { "boat", XC_boat
},
2551 { "bogosity", XC_bogosity
},
2552 { "bottom_left_corner", XC_bottom_left_corner
},
2553 { "bottom_right_corner", XC_bottom_right_corner
},
2554 { "bottom_side", XC_bottom_side
},
2555 { "bottom_tee", XC_bottom_tee
},
2556 { "box_spiral", XC_box_spiral
},
2557 { "center_ptr", XC_center_ptr
},
2558 { "circle", XC_circle
},
2559 { "clock", XC_clock
},
2560 { "coffee_mug", XC_coffee_mug
},
2561 { "cross", XC_cross
},
2562 { "cross_reverse", XC_cross_reverse
},
2563 { "crosshair", XC_crosshair
},
2564 { "diamond_cross", XC_diamond_cross
},
2566 { "dotbox", XC_dotbox
},
2567 { "double_arrow", XC_double_arrow
},
2568 { "draft_large", XC_draft_large
},
2569 { "draft_small", XC_draft_small
},
2570 { "draped_box", XC_draped_box
},
2571 { "exchange", XC_exchange
},
2572 { "fleur", XC_fleur
},
2573 { "gobbler", XC_gobbler
},
2574 { "gumby", XC_gumby
},
2575 { "hand1", XC_hand1
},
2576 { "hand2", XC_hand2
},
2577 { "heart", XC_heart
},
2578 { "icon", XC_icon
},
2579 { "iron_cross", XC_iron_cross
},
2580 { "left_ptr", XC_left_ptr
},
2581 { "left_side", XC_left_side
},
2582 { "left_tee", XC_left_tee
},
2583 { "leftbutton", XC_leftbutton
},
2584 { "ll_angle", XC_ll_angle
},
2585 { "lr_angle", XC_lr_angle
},
2587 { "middlebutton", XC_middlebutton
},
2588 { "mouse", XC_mouse
},
2589 { "pencil", XC_pencil
},
2590 { "pirate", XC_pirate
},
2591 { "plus", XC_plus
},
2592 { "question_arrow", XC_question_arrow
},
2593 { "right_ptr", XC_right_ptr
},
2594 { "right_side", XC_right_side
},
2595 { "right_tee", XC_right_tee
},
2596 { "rightbutton", XC_rightbutton
},
2597 { "rtl_logo", XC_rtl_logo
},
2598 { "sailboat", XC_sailboat
},
2599 { "sb_down_arrow", XC_sb_down_arrow
},
2600 { "sb_h_double_arrow", XC_sb_h_double_arrow
},
2601 { "sb_left_arrow", XC_sb_left_arrow
},
2602 { "sb_right_arrow", XC_sb_right_arrow
},
2603 { "sb_up_arrow", XC_sb_up_arrow
},
2604 { "sb_v_double_arrow", XC_sb_v_double_arrow
},
2605 { "shuttle", XC_shuttle
},
2606 { "sizing", XC_sizing
},
2607 { "spider", XC_spider
},
2608 { "spraycan", XC_spraycan
},
2609 { "star", XC_star
},
2610 { "target", XC_target
},
2611 { "tcross", XC_tcross
},
2612 { "top_left_arrow", XC_top_left_arrow
},
2613 { "top_left_corner", XC_top_left_corner
},
2614 { "top_right_corner", XC_top_right_corner
},
2615 { "top_side", XC_top_side
},
2616 { "top_tee", XC_top_tee
},
2617 { "trek", XC_trek
},
2618 { "ul_angle", XC_ul_angle
},
2619 { "umbrella", XC_umbrella
},
2620 { "ur_angle", XC_ur_angle
},
2621 { "watch", XC_watch
},
2622 { "xterm", XC_xterm
},
2623 { NULL
, CURSOR_ID_NONE
}
2627 check_bitmap_status(int status
, char *filename
, Pixmap bitmap
)
2630 case BitmapOpenFailed
:
2631 wwarning(_("failed to open bitmap file \"%s\""), filename
);
2633 case BitmapFileInvalid
:
2634 wwarning(_("\"%s\" is not a valid bitmap file"), filename
);
2636 case BitmapNoMemory
:
2637 wwarning(_("out of memory reading bitmap file \"%s\""), filename
);
2640 XFreePixmap(dpy
, bitmap
);
2647 * (builtin, <cursor_name>)
2648 * (bitmap, <cursor_bitmap>, <cursor_mask>)
2651 parse_cursor(WScreen
*scr
, proplist_t pl
, Cursor
*cursor
)
2658 nelem
= PLGetNumberOfElements(pl
);
2662 elem
= PLGetArrayElement(pl
, 0);
2663 if (!elem
|| !PLIsString(elem
)) {
2666 val
= PLGetString(elem
);
2668 if (0 == strcasecmp(val
, "none")) {
2671 } else if (0 == strcasecmp(val
, "builtin")) {
2673 int cursor_id
= CURSOR_ID_NONE
;
2676 wwarning(_("bad number of arguments in cursor specification"));
2679 elem
= PLGetArrayElement(pl
, 1);
2680 if (!elem
|| !PLIsString(elem
)) {
2683 val
= PLGetString(elem
);
2685 for (i
= 0; NULL
!= cursor_table
[i
].name
; i
++) {
2686 if (0 == strcasecmp(val
, cursor_table
[i
].name
)) {
2687 cursor_id
= cursor_table
[i
].id
;
2691 if (CURSOR_ID_NONE
== cursor_id
) {
2692 wwarning(_("unknown builtin cursor name \"%s\""), val
);
2694 *cursor
= XCreateFontCursor(dpy
, cursor_id
);
2697 } else if (0 == strcasecmp(val
, "bitmap")) {
2709 wwarning(_("bad number of arguments in cursor specification"));
2712 elem
= PLGetArrayElement(pl
, 1);
2713 if (!elem
|| !PLIsString(elem
)) {
2716 val
= PLGetString(elem
);
2717 bitmap_name
= FindImage(wPreferences
.pixmap_path
, val
);
2719 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2722 elem
= PLGetArrayElement(pl
, 2);
2723 if (!elem
|| !PLIsString(elem
)) {
2727 val
= PLGetString(elem
);
2728 mask_name
= FindImage(wPreferences
.pixmap_path
, val
);
2731 wwarning(_("could not find cursor bitmap file \"%s\""), val
);
2734 mask_status
= XReadBitmapFile(dpy
, scr
->w_win
, mask_name
, &w
, &h
,
2736 bitmap_status
= XReadBitmapFile(dpy
, scr
->w_win
, bitmap_name
, &w
, &h
,
2738 if ((BitmapSuccess
== bitmap_status
) &&
2739 (BitmapSuccess
== mask_status
)) {
2740 fg
.pixel
= scr
->black_pixel
;
2741 bg
.pixel
= scr
->white_pixel
;
2742 XQueryColor(dpy
, scr
->w_colormap
, &fg
);
2743 XQueryColor(dpy
, scr
->w_colormap
, &bg
);
2744 *cursor
= XCreatePixmapCursor(dpy
, bitmap
, mask
, &fg
, &bg
, x
, y
);
2747 check_bitmap_status(bitmap_status
, bitmap_name
, bitmap
);
2748 check_bitmap_status(mask_status
, mask_name
, mask
);
2757 getCursor(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
, void *addr
,
2760 static Cursor cursor
;
2765 if (!PLIsArray(value
)) {
2766 wwarning(_("Wrong option format for key \"%s\". Should be %s."),
2767 entry
->key
, "cursor specification");
2769 value
= entry
->plvalue
;
2771 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2776 status
= parse_cursor(scr
, value
, &cursor
);
2778 wwarning(_("Error in cursor specification for key \"%s\""), entry
->key
);
2780 value
= entry
->plvalue
;
2782 wwarning(_("using default \"%s\" instead"), entry
->default_value
);
2791 *(Cursor
*)addr
= cursor
;
2795 #undef CURSOR_ID_NONE
2797 #endif /* DEFINABLE_CURSOR */
2800 /* ---------------- value setting functions --------------- */
2802 setJustify(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
2804 return REFRESH_WINDOW_TITLE_COLOR
;
2808 setClearance(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
2810 return REFRESH_WINDOW_FONT
|REFRESH_BUTTON_IMAGES
|REFRESH_MENU_TITLE_FONT
|REFRESH_MENU_FONT
;
2814 setIfDockPresent(WScreen
*scr
, WDefaultEntry
*entry
, char *flag
, long which
)
2818 wPreferences
.flags
.nodock
= wPreferences
.flags
.nodock
|| *flag
;
2821 wPreferences
.flags
.noclip
= wPreferences
.flags
.noclip
|| *flag
;
2831 setStickyIcons(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
2833 if (scr
->workspaces
) {
2834 wWorkspaceForceChange(scr
, scr
->current_workspace
);
2835 wArrangeIcons(scr
, False
);
2842 setPositive(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
2854 setIconTile(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
2860 img
= wTextureRenderImage(*texture
, wPreferences
.icon_size
,
2861 wPreferences
.icon_size
,
2862 ((*texture
)->any
.type
& WREL_BORDER_MASK
)
2863 ? WREL_ICON
: WREL_FLAT
);
2865 wwarning(_("could not render texture for icon background"));
2867 wTextureDestroy(scr
, *texture
);
2870 RConvertImage(scr
->rcontext
, img
, &pixmap
);
2872 if (scr
->icon_tile
) {
2874 RDestroyImage(scr
->icon_tile
);
2875 XFreePixmap(dpy
, scr
->icon_tile_pixmap
);
2878 scr
->icon_tile
= img
;
2881 /* put the icon in the noticeboard hint */
2882 PropSetIconTileHint(scr
, img
);
2885 if (!wPreferences
.flags
.noclip
) {
2886 if (scr
->clip_tile
) {
2887 RDestroyImage(scr
->clip_tile
);
2889 scr
->clip_tile
= wClipMakeTile(scr
, img
);
2892 scr
->icon_tile_pixmap
= pixmap
;
2894 if (scr
->def_icon_pixmap
) {
2895 XFreePixmap(dpy
, scr
->def_icon_pixmap
);
2896 scr
->def_icon_pixmap
= None
;
2898 if (scr
->def_ticon_pixmap
) {
2899 XFreePixmap(dpy
, scr
->def_ticon_pixmap
);
2900 scr
->def_ticon_pixmap
= None
;
2903 if (scr
->icon_back_texture
) {
2904 wTextureDestroy(scr
, (WTexture
*)scr
->icon_back_texture
);
2906 scr
->icon_back_texture
= wTextureMakeSolid(scr
, &((*texture
)->any
.color
));
2908 if (scr
->clip_balloon
)
2909 XSetWindowBackground(dpy
, scr
->clip_balloon
,
2910 (*texture
)->any
.color
.pixel
);
2913 * Free the texture as nobody else will use it, nor refer to it.
2916 wTextureDestroy(scr
, *texture
);
2918 return (reset
? REFRESH_ICON_TILE
: 0);
2924 setWinTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2926 if (scr
->title_font
) {
2927 WMReleaseFont(scr
->title_font
);
2929 scr
->title_font
= font
;
2931 return REFRESH_WINDOW_FONT
|REFRESH_BUTTON_IMAGES
;
2936 setMenuTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2938 if (scr
->menu_title_font
) {
2939 WMReleaseFont(scr
->menu_title_font
);
2942 scr
->menu_title_font
= font
;
2944 return REFRESH_MENU_TITLE_FONT
;
2949 setMenuTextFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2951 if (scr
->menu_entry_font
) {
2952 WMReleaseFont(scr
->menu_entry_font
);
2954 scr
->menu_entry_font
= font
;
2956 return REFRESH_MENU_FONT
;
2962 setIconTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2964 if (scr
->icon_title_font
) {
2965 WMReleaseFont(scr
->icon_title_font
);
2968 scr
->icon_title_font
= font
;
2970 return REFRESH_ICON_FONT
;
2975 setClipTitleFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2977 if (scr
->clip_title_font
) {
2978 WMReleaseFont(scr
->clip_title_font
);
2981 scr
->clip_title_font
= font
;
2983 return REFRESH_ICON_FONT
;
2988 setLargeDisplayFont(WScreen
*scr
, WDefaultEntry
*entry
, WMFont
*font
, void *foo
)
2990 if (scr
->workspace_name_font
) {
2991 WMReleaseFont(scr
->workspace_name_font
);
2994 scr
->workspace_name_font
= font
;
3001 setHightlight(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3003 if (scr
->select_pixel
!=scr
->white_pixel
&&
3004 scr
->select_pixel
!=scr
->black_pixel
) {
3005 wFreeColor(scr
, scr
->select_pixel
);
3008 scr
->select_pixel
= color
->pixel
;
3010 return REFRESH_MENU_COLOR
;
3015 setHightlightText(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3017 if (scr
->select_text_pixel
!=scr
->white_pixel
&&
3018 scr
->select_text_pixel
!=scr
->black_pixel
) {
3019 wFreeColor(scr
, scr
->select_text_pixel
);
3022 scr
->select_text_pixel
= color
->pixel
;
3024 return REFRESH_MENU_COLOR
;
3029 setClipTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3031 if (scr
->clip_title_pixel
[index
]!=scr
->white_pixel
&&
3032 scr
->clip_title_pixel
[index
]!=scr
->black_pixel
) {
3033 wFreeColor(scr
, scr
->clip_title_pixel
[index
]);
3035 scr
->clip_title_pixel
[index
] = color
->pixel
;
3037 #ifdef GRADIENT_CLIP_ARROW
3038 if (index
== CLIP_NORMAL
) {
3040 RColor color1
, color2
;
3041 int pt
= CLIP_BUTTON_SIZE
*wPreferences
.icon_size
/64;
3042 int as
= pt
- 15; /* 15 = 5+5+5 */
3044 FREE_PIXMAP(scr
->clip_arrow_gradient
);
3046 color1
.red
= (color
->red
>> 8)*6/10;
3047 color1
.green
= (color
->green
>> 8)*6/10;
3048 color1
.blue
= (color
->blue
>> 8)*6/10;
3050 color2
.red
= WMIN((color
->red
>> 8)*20/10, 255);
3051 color2
.green
= WMIN((color
->green
>> 8)*20/10, 255);
3052 color2
.blue
= WMIN((color
->blue
>> 8)*20/10, 255);
3054 image
= RRenderGradient(as
+1, as
+1, &color1
, &color2
, RDiagonalGradient
);
3055 RConvertImage(scr
->rcontext
, image
, &scr
->clip_arrow_gradient
);
3056 RDestroyImage(image
);
3058 #endif /* GRADIENT_CLIP_ARROW */
3060 return REFRESH_ICON_TITLE_COLOR
;
3065 setWTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3067 if (scr
->window_title_pixel
[index
]!=scr
->white_pixel
&&
3068 scr
->window_title_pixel
[index
]!=scr
->black_pixel
) {
3069 wFreeColor(scr
, scr
->window_title_pixel
[index
]);
3072 scr
->window_title_pixel
[index
] = color
->pixel
;
3074 if (index
== WS_UNFOCUSED
)
3075 XSetForeground(dpy
, scr
->info_text_gc
, color
->pixel
);
3077 return REFRESH_WINDOW_TITLE_COLOR
;
3082 setMenuTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, long index
)
3084 if (scr
->menu_title_pixel
[0]!=scr
->white_pixel
&&
3085 scr
->menu_title_pixel
[0]!=scr
->black_pixel
) {
3086 #ifdef DRAWSTRING_PLUGIN
3087 if(!scr
->drawstring_func
[W_STRING_MTITLE
])
3089 wFreeColor(scr
, scr
->menu_title_pixel
[0]);
3092 scr
->menu_title_pixel
[0] = color
->pixel
;
3093 XSetForeground(dpy
, scr
->menu_title_gc
, color
->pixel
);
3095 return REFRESH_MENU_TITLE_COLOR
;
3100 setMenuTextColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3103 #define gcm (GCForeground|GCBackground|GCFillStyle)
3105 if (scr
->mtext_pixel
!=scr
->white_pixel
&&
3106 scr
->mtext_pixel
!=scr
->black_pixel
) {
3107 wFreeColor(scr
, scr
->mtext_pixel
);
3110 scr
->mtext_pixel
= color
->pixel
;
3112 XSetForeground(dpy
, scr
->menu_entry_gc
, color
->pixel
);
3115 if (scr
->dtext_pixel
== scr
->mtext_pixel
) {
3116 gcv
.foreground
= scr
->white_pixel
;
3117 gcv
.background
= scr
->black_pixel
;
3118 gcv
.fill_style
= FillStippled
;
3120 gcv
.foreground
= scr
->dtext_pixel
;
3121 gcv
.fill_style
= FillSolid
;
3123 XChangeGC(dpy
, scr
->disabled_menu_entry_gc
, gcm
, &gcv
);
3125 return REFRESH_MENU_COLOR
;
3131 setMenuDisabledColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3134 #define gcm (GCForeground|GCBackground|GCFillStyle)
3136 if (scr
->dtext_pixel
!=scr
->white_pixel
&&
3137 scr
->dtext_pixel
!=scr
->black_pixel
) {
3138 wFreeColor(scr
, scr
->dtext_pixel
);
3141 scr
->dtext_pixel
= color
->pixel
;
3143 if (scr
->dtext_pixel
== scr
->mtext_pixel
) {
3144 gcv
.foreground
= scr
->white_pixel
;
3145 gcv
.background
= scr
->black_pixel
;
3146 gcv
.fill_style
= FillStippled
;
3148 gcv
.foreground
= scr
->dtext_pixel
;
3149 gcv
.fill_style
= FillSolid
;
3151 XChangeGC(dpy
, scr
->disabled_menu_entry_gc
, gcm
, &gcv
);
3153 return REFRESH_MENU_COLOR
;
3158 setIconTitleColor(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3160 XSetForeground(dpy
, scr
->icon_title_gc
, color
->pixel
);
3162 return REFRESH_ICON_TITLE_COLOR
;
3167 setIconTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, XColor
*color
, void *foo
)
3169 if (scr
->icon_title_texture
) {
3170 wTextureDestroy(scr
, (WTexture
*)scr
->icon_title_texture
);
3172 XQueryColor (dpy
, scr
->w_colormap
, color
);
3173 scr
->icon_title_texture
= wTextureMakeSolid(scr
, color
);
3175 return REFRESH_ICON_TITLE_BACK
;
3180 trackDeadProcess(pid_t pid
, unsigned char status
, WScreen
*scr
)
3182 close(scr
->helper_fd
);
3184 scr
->helper_pid
= 0;
3185 scr
->flags
.backimage_helper_launched
= 0;
3190 setWorkspaceSpecificBack(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
3197 if (scr
->flags
.backimage_helper_launched
) {
3198 if (PLGetNumberOfElements(value
)==0) {
3199 SendHelperMessage(scr
, 'C', 0, NULL
);
3200 SendHelperMessage(scr
, 'K', 0, NULL
);
3209 if (PLGetNumberOfElements(value
) == 0)
3212 if (pipe(filedes
) < 0) {
3213 wsyserror("pipe() failed:can't set workspace specific background image");
3221 wsyserror("fork() failed:can't set workspace specific background image");
3222 if (close(filedes
[0]) < 0)
3223 wsyserror("could not close pipe");
3224 if (close(filedes
[1]) < 0)
3225 wsyserror("could not close pipe");
3227 } else if (pid
== 0) {
3228 SetupEnvironment(scr
);
3231 wsyserror("could not close pipe");
3232 if (dup(filedes
[0]) < 0) {
3233 wsyserror("dup() failed:can't set workspace specific background image");
3235 if (wPreferences
.smooth_workspace_back
)
3236 execlp("wmsetbg", "wmsetbg", "-helper", "-S", "-d", NULL
);
3238 execlp("wmsetbg", "wmsetbg", "-helper", "-d", NULL
);
3239 wsyserror("could not execute wmsetbg");
3243 if (fcntl(filedes
[0], F_SETFD
, FD_CLOEXEC
) < 0) {
3244 wsyserror("error setting close-on-exec flag");
3246 if (fcntl(filedes
[1], F_SETFD
, FD_CLOEXEC
) < 0) {
3247 wsyserror("error setting close-on-exec flag");
3250 scr
->helper_fd
= filedes
[1];
3251 scr
->helper_pid
= pid
;
3252 scr
->flags
.backimage_helper_launched
= 1;
3254 wAddDeathHandler(pid
, (WDeathHandler
*)trackDeadProcess
, scr
);
3256 SendHelperMessage(scr
, 'P', -1, wPreferences
.pixmap_path
);
3261 for (i
= 0; i
< PLGetNumberOfElements(value
); i
++) {
3262 val
= PLGetArrayElement(value
, i
);
3263 if (val
&& PLIsArray(val
) && PLGetNumberOfElements(val
)>0) {
3264 str
= PLGetDescription(val
);
3266 SendHelperMessage(scr
, 'S', i
+1, str
);
3270 SendHelperMessage(scr
, 'U', i
+1, NULL
);
3281 setWorkspaceBack(WScreen
*scr
, WDefaultEntry
*entry
, proplist_t value
,
3284 if (scr
->flags
.backimage_helper_launched
) {
3287 if (PLGetNumberOfElements(value
)==0) {
3288 SendHelperMessage(scr
, 'U', 0, NULL
);
3290 /* set the default workspace background to this one */
3291 str
= PLGetDescription(value
);
3293 SendHelperMessage(scr
, 'S', 0, str
);
3295 SendHelperMessage(scr
, 'C', scr
->current_workspace
+1, NULL
);
3297 SendHelperMessage(scr
, 'U', 0, NULL
);
3300 } else if (PLGetNumberOfElements(value
) > 0) {
3304 SetupEnvironment(scr
);
3305 text
= PLGetDescription(value
);
3306 command
= wmalloc(strlen(text
)+40);
3307 if (wPreferences
.smooth_workspace_back
)
3308 sprintf(command
, "wmsetbg -d -S -p '%s' &", text
);
3310 sprintf(command
, "wmsetbg -d -p '%s' &", text
);
3322 setWidgetColor(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3324 if (scr
->widget_texture
) {
3325 wTextureDestroy(scr
, (WTexture
*)scr
->widget_texture
);
3327 scr
->widget_texture
= *(WTexSolid
**)texture
;
3334 setFTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3336 if (scr
->window_title_texture
[WS_FOCUSED
]) {
3337 wTextureDestroy(scr
, scr
->window_title_texture
[WS_FOCUSED
]);
3339 scr
->window_title_texture
[WS_FOCUSED
] = *texture
;
3341 return REFRESH_WINDOW_TEXTURES
;
3346 setPTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3348 if (scr
->window_title_texture
[WS_PFOCUSED
]) {
3349 wTextureDestroy(scr
, scr
->window_title_texture
[WS_PFOCUSED
]);
3351 scr
->window_title_texture
[WS_PFOCUSED
] = *texture
;
3353 return REFRESH_WINDOW_TEXTURES
;
3358 setUTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3360 if (scr
->window_title_texture
[WS_UNFOCUSED
]) {
3361 wTextureDestroy(scr
, scr
->window_title_texture
[WS_UNFOCUSED
]);
3363 scr
->window_title_texture
[WS_UNFOCUSED
] = *texture
;
3365 return REFRESH_WINDOW_TEXTURES
;
3370 setResizebarBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3372 if (scr
->resizebar_texture
[0]) {
3373 wTextureDestroy(scr
, scr
->resizebar_texture
[0]);
3375 scr
->resizebar_texture
[0] = *texture
;
3377 return REFRESH_WINDOW_TEXTURES
;
3382 setMenuTitleBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3384 if (scr
->menu_title_texture
[0]) {
3385 wTextureDestroy(scr
, scr
->menu_title_texture
[0]);
3387 scr
->menu_title_texture
[0] = *texture
;
3389 return REFRESH_MENU_TITLE_TEXTURE
;
3394 setMenuTextBack(WScreen
*scr
, WDefaultEntry
*entry
, WTexture
**texture
, void *foo
)
3396 if (scr
->menu_item_texture
) {
3397 wTextureDestroy(scr
, scr
->menu_item_texture
);
3398 wTextureDestroy(scr
, (WTexture
*)scr
->menu_item_auxtexture
);
3400 scr
->menu_item_texture
= *texture
;
3402 scr
->menu_item_auxtexture
3403 = wTextureMakeSolid(scr
, &scr
->menu_item_texture
->any
.color
);
3405 return REFRESH_MENU_TEXTURE
;
3410 setKeyGrab(WScreen
*scr
, WDefaultEntry
*entry
, WShortKey
*shortcut
, long index
)
3413 wKeyBindings
[index
] = *shortcut
;
3415 wwin
= scr
->focused_window
;
3417 while (wwin
!=NULL
) {
3418 XUngrabKey(dpy
, AnyKey
, AnyModifier
, wwin
->frame
->core
->window
);
3420 if (!WFLAGP(wwin
, no_bind_keys
)) {
3421 wWindowSetKeyGrabs(wwin
);
3431 setIconPosition(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
3433 wArrangeIcons(scr
, True
);
3440 updateUsableArea(WScreen
*scr
, WDefaultEntry
*entry
, void *bar
, void *foo
)
3442 wScreenUpdateUsableArea(scr
);
3449 setMenuStyle(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
3451 return REFRESH_MENU_TEXTURE
;
3457 setButtonImages(WScreen *scr, WDefaultEntry *entry, int *value, void *foo)
3459 return REFRESH_BUTTON_IMAGES;
3465 * Need access to the double click variables, so that all widgets in
3466 * wmaker panels will have the same dbl-click values.
3467 * TODO: figure a better way of dealing with it.
3472 setDoubleClick(WScreen
*scr
, WDefaultEntry
*entry
, int *value
, void *foo
)
3474 extern _WINGsConfiguration WINGsConfiguration
;
3479 WINGsConfiguration
.doubleClickDelay
= *value
;
3487 setMultiByte(WScreen
*scr
, WDefaultEntry
*entry
, char *value
, void *foo
)
3489 extern _WINGsConfiguration WINGsConfiguration
;
3491 WINGsConfiguration
.useMultiByte
= *value
;
3497 #ifdef DEFINABLE_CURSOR
3499 setCursor(WScreen
*scr
, WDefaultEntry
*entry
, Cursor
*cursor
, long index
)
3501 if (None
!= wCursor
[index
])
3503 XFreeCursor(dpy
, wCursor
[index
]);
3506 wCursor
[index
] = *cursor
;
3508 if ((WCUR_ROOT
== index
) && (None
!= *cursor
))
3510 XDefineCursor(dpy
, scr
->root_win
, *cursor
);
3515 #endif /* DEFINABLE_CURSOR*/