JWM Source Documentation
settings.c
Go to the documentation of this file.
1 
10 #include "jwm.h"
11 #include "settings.h"
12 #include "misc.h"
13 
15 
16 static void FixRange(unsigned int *value,
17  unsigned int min_value,
18  unsigned int max_value,
19  unsigned int def_value);
20 
23 {
24  settings.moveMask = (1 << Mod1MapIndex);
25  settings.doubleClickSpeed = 400;
26  settings.doubleClickDelta = 2;
27  settings.snapMode = SNAP_BORDER;
28  settings.snapDistance = 5;
29  settings.moveMode = MOVE_OPAQUE;
30  settings.moveStatusType = SW_SCREEN;
31  settings.resizeStatusType = SW_SCREEN;
32  settings.focusModel = FOCUS_SLOPPY;
33  settings.resizeMode = RESIZE_OPAQUE;
34  settings.popupDelay = 600;
35  settings.desktopDelay = 1000;
36  settings.trayOpacity = UINT_MAX;
37  settings.popupMask = POPUP_ALL;
38  settings.activeClientOpacity = UINT_MAX;
39  settings.inactiveClientOpacity = (unsigned int)(0.75 * UINT_MAX);
40  settings.borderWidth = 5;
41  settings.titleHeight = 0;
42  settings.titleTextAlignment = ALIGN_LEFT;
43  settings.desktopWidth = 4;
44  settings.desktopHeight = 1;
45  settings.menuOpacity = UINT_MAX;
46  settings.windowDecorations = DECO_FLAT;
47  settings.trayDecorations = DECO_FLAT;
49  settings.menuDecorations = DECO_FLAT;
50  settings.cornerRadius = 4;
51  settings.groupTasks = 0;
52  settings.listAllTasks = 0;
53 }
54 
56 void StartupSettings(void)
57 {
58 
59  FixRange(&settings.cornerRadius, 0, 5, 4);
60 
61  FixRange(&settings.borderWidth, 1, 128, 4);
62  FixRange(&settings.titleHeight, 0, 256, 0);
63 
64  FixRange(&settings.doubleClickDelta, 0, 64, 2);
65  FixRange(&settings.doubleClickSpeed, 1, 2000, 400);
66 
67  FixRange(&settings.desktopWidth, 1, 64, 4);
68  FixRange(&settings.desktopHeight, 1, 64, 1);
69  settings.desktopCount = settings.desktopWidth * settings.desktopHeight;
70 
71  if(settings.taskListDecorations == DECO_UNSET) {
72  settings.taskListDecorations = settings.trayDecorations;
73  }
74 
75 }
76 
78 void SetPathString(char **dest, const char *src)
79 {
80  if(*dest) {
81  Release(*dest);
82  }
83  *dest = CopyString(src);
84  if(JLIKELY(*dest)) {
85  ExpandPath(dest);
86  }
87 }
88 
90 void FixRange(unsigned int *value,
91  unsigned int min_value,
92  unsigned int max_value,
93  unsigned int def_value)
94 {
95  if(JUNLIKELY(*value < min_value || *value > max_value)) {
96  *value = def_value;
97  }
98 }

joewing.net / Projects / JWM