Fixed some warnings.
[wine.git] / windows / sysmetrics.c
blob8180718e442addd76b29ebe27ae568f8e313d1ec
1 /*
2 * System metrics functions
4 * Copyright 1994 Alexandre Julliard
6 */
8 #include <stdio.h>
10 #include "windef.h"
11 #include "wingdi.h"
12 #include "wine/winuser16.h"
13 #include "winbase.h"
14 #include "winuser.h"
15 #include "monitor.h"
16 #include "options.h"
17 #include "sysmetrics.h"
18 #include "tweak.h"
20 static short sysMetrics[SM_CMETRICS+1];
22 /***********************************************************************
23 * SYSMETRICS_Init
25 * Initialisation of the system metrics array.
27 * Differences in return values between 3.1 and 95 apps under Win95 (FIXME ?):
28 * SM_CXVSCROLL x+1 x Fixed May 24, 1999 - Ronald B. Cemer
29 * SM_CYHSCROLL x+1 x Fixed May 24, 1999 - Ronald B. Cemer
30 * SM_CXDLGFRAME x-1 x Already fixed
31 * SM_CYDLGFRAME x-1 x Already fixed
32 * SM_CYCAPTION x+1 x Fixed May 24, 1999 - Ronald B. Cemer
33 * SM_CYMENU x-1 x Already fixed
34 * SM_CYFULLSCREEN x-1 x
36 * (collides with TWEAK_WineLook sometimes,
37 * so changing anything might be difficult)
39 void SYSMETRICS_Init(void)
41 sysMetrics[SM_CXCURSOR] = 32;
42 sysMetrics[SM_CYCURSOR] = 32;
43 sysMetrics[SM_CXSCREEN] = MONITOR_GetWidth(&MONITOR_PrimaryMonitor);
44 sysMetrics[SM_CYSCREEN] = MONITOR_GetHeight(&MONITOR_PrimaryMonitor);
45 if (TWEAK_WineLook > WIN31_LOOK)
46 sysMetrics[SM_CXVSCROLL] =
47 PROFILE_GetWineIniInt("Tweak.Layout", "ScrollBarWidth", 16);
48 else
49 sysMetrics[SM_CXVSCROLL] =
50 PROFILE_GetWineIniInt("Tweak.Layout", "ScrollBarWidth", 17);
51 sysMetrics[SM_CYHSCROLL] = sysMetrics[SM_CXVSCROLL];
52 if (TWEAK_WineLook > WIN31_LOOK)
53 sysMetrics[SM_CYCAPTION] =
54 PROFILE_GetWineIniInt("Tweak.Layout", "CaptionHeight", 19);
55 else
56 sysMetrics[SM_CYCAPTION] =
57 PROFILE_GetWineIniInt("Tweak.Layout", "CaptionHeight", 20);
58 sysMetrics[SM_CXBORDER] = 1;
59 sysMetrics[SM_CYBORDER] = sysMetrics[SM_CXBORDER];
60 sysMetrics[SM_CXDLGFRAME] =
61 PROFILE_GetWineIniInt("Tweak.Layout", "DialogFrameWidth",
62 (TWEAK_WineLook > WIN31_LOOK) ? 3 : 4);
63 sysMetrics[SM_CYDLGFRAME] = sysMetrics[SM_CXDLGFRAME];
64 sysMetrics[SM_CYVTHUMB] = sysMetrics[SM_CXVSCROLL] - 1;
65 sysMetrics[SM_CXHTHUMB] = sysMetrics[SM_CYVTHUMB];
66 sysMetrics[SM_CXICON] = 32;
67 sysMetrics[SM_CYICON] = 32;
68 if (TWEAK_WineLook > WIN31_LOOK)
69 sysMetrics[SM_CYMENU] =
70 PROFILE_GetWineIniInt("Tweak.Layout", "MenuHeight", 19);
71 else
72 sysMetrics[SM_CYMENU] =
73 PROFILE_GetWineIniInt("Tweak.Layout", "MenuHeight", 18);
74 sysMetrics[SM_CXFULLSCREEN] = sysMetrics[SM_CXSCREEN];
75 sysMetrics[SM_CYFULLSCREEN] =
76 sysMetrics[SM_CYSCREEN] - sysMetrics[SM_CYCAPTION];
77 sysMetrics[SM_CYKANJIWINDOW] = 0;
78 sysMetrics[SM_MOUSEPRESENT] = 1;
79 sysMetrics[SM_CYVSCROLL] = sysMetrics[SM_CYVTHUMB];
80 sysMetrics[SM_CXHSCROLL] = sysMetrics[SM_CXHTHUMB];
81 sysMetrics[SM_DEBUG] = 0;
83 /* FIXME: The following should look for the registry key to see if the
84 buttons should be swapped. */
85 sysMetrics[SM_SWAPBUTTON] = 0;
87 sysMetrics[SM_RESERVED1] = 0;
88 sysMetrics[SM_RESERVED2] = 0;
89 sysMetrics[SM_RESERVED3] = 0;
90 sysMetrics[SM_RESERVED4] = 0;
92 /* FIXME: The following two are calculated, but how? */
93 sysMetrics[SM_CXMIN] = (TWEAK_WineLook > WIN31_LOOK) ? 112 : 100;
94 sysMetrics[SM_CYMIN] = (TWEAK_WineLook > WIN31_LOOK) ? 27 : 28;
96 sysMetrics[SM_CXSIZE] = sysMetrics[SM_CYCAPTION] - 2;
97 sysMetrics[SM_CYSIZE] = sysMetrics[SM_CXSIZE];
98 sysMetrics[SM_CXFRAME] = GetProfileIntA("Windows", "BorderWidth", 4) + 1;
99 sysMetrics[SM_CYFRAME] = sysMetrics[SM_CXFRAME];
100 sysMetrics[SM_CXMINTRACK] = sysMetrics[SM_CXMIN];
101 sysMetrics[SM_CYMINTRACK] = sysMetrics[SM_CYMIN];
102 sysMetrics[SM_CXDOUBLECLK] =
103 (GetProfileIntA("Windows", "DoubleClickWidth", 4) + 1) & ~1;
104 sysMetrics[SM_CYDOUBLECLK] =
105 (GetProfileIntA("Windows","DoubleClickHeight", 4) + 1) & ~1;
106 sysMetrics[SM_CXICONSPACING] =
107 GetProfileIntA("Desktop","IconSpacing", 75);
108 sysMetrics[SM_CYICONSPACING] =
109 GetProfileIntA("Desktop", "IconVerticalSpacing", 75);
110 sysMetrics[SM_MENUDROPALIGNMENT] =
111 GetProfileIntA("Windows", "MenuDropAlignment", 0);
112 sysMetrics[SM_PENWINDOWS] = 0;
113 sysMetrics[SM_DBCSENABLED] = 0;
115 /* FIXME: Need to query X for the following */
116 sysMetrics[SM_CMOUSEBUTTONS] = 3;
118 sysMetrics[SM_SECURE] = 0;
119 sysMetrics[SM_CXEDGE] = sysMetrics[SM_CXBORDER] + 1;
120 sysMetrics[SM_CYEDGE] = sysMetrics[SM_CXEDGE];
121 sysMetrics[SM_CXMINSPACING] = 160;
122 sysMetrics[SM_CYMINSPACING] = 24;
123 sysMetrics[SM_CXSMICON] = sysMetrics[SM_CYSIZE] - (sysMetrics[SM_CYSIZE] % 2);
124 sysMetrics[SM_CYSMICON] = sysMetrics[SM_CXSMICON];
125 sysMetrics[SM_CYSMCAPTION] = 16;
126 sysMetrics[SM_CXSMSIZE] = 15;
127 sysMetrics[SM_CYSMSIZE] = sysMetrics[SM_CXSMSIZE];
128 sysMetrics[SM_CXMENUSIZE] = sysMetrics[SM_CYMENU];
129 sysMetrics[SM_CYMENUSIZE] = sysMetrics[SM_CXMENUSIZE];
131 /* FIXME: What do these mean? */
132 sysMetrics[SM_ARRANGE] = 8;
133 sysMetrics[SM_CXMINIMIZED] = 160;
134 sysMetrics[SM_CYMINIMIZED] = 24;
136 /* FIXME: How do I calculate these? */
137 sysMetrics[SM_CXMAXTRACK] =
138 sysMetrics[SM_CXSCREEN] + 4 + 2 * sysMetrics[SM_CXFRAME];
139 sysMetrics[SM_CYMAXTRACK] =
140 sysMetrics[SM_CYSCREEN] + 4 + 2 * sysMetrics[SM_CYFRAME];
141 sysMetrics[SM_CXMAXIMIZED] =
142 sysMetrics[SM_CXSCREEN] + 2 * sysMetrics[SM_CXFRAME];
143 sysMetrics[SM_CYMAXIMIZED] =
144 sysMetrics[SM_CYSCREEN] - 45;
145 sysMetrics[SM_NETWORK] = 3;
147 /* For the following: 0 = ok, 1 = failsafe, 2 = failsafe + network */
148 sysMetrics[SM_CLEANBOOT] = 0;
150 sysMetrics[SM_CXDRAG] = 2;
151 sysMetrics[SM_CYDRAG] = 2;
152 sysMetrics[SM_SHOWSOUNDS] = 0;
153 sysMetrics[SM_CXMENUCHECK] = 2;
154 sysMetrics[SM_CYMENUCHECK] = 2;
156 /* FIXME: Should check the type of processor for the following */
157 sysMetrics[SM_SLOWMACHINE] = 0;
159 /* FIXME: Should perform a check */
160 sysMetrics[SM_MIDEASTENABLED] = 0;
162 sysMetrics[SM_MOUSEWHEELPRESENT] = 0;
164 sysMetrics[SM_CXVIRTUALSCREEN] = sysMetrics[SM_CXSCREEN];
165 sysMetrics[SM_CYVIRTUALSCREEN] = sysMetrics[SM_CYSCREEN];
166 sysMetrics[SM_XVIRTUALSCREEN] = 0;
167 sysMetrics[SM_YVIRTUALSCREEN] = 0;
168 sysMetrics[SM_CMONITORS] = 1;
169 sysMetrics[SM_SAMEDISPLAYFORMAT] = 1;
170 sysMetrics[SM_CMETRICS] = SM_CMETRICS;
174 /***********************************************************************
175 * GetSystemMetrics16 (USER.179)
177 INT16 WINAPI GetSystemMetrics16( INT16 index )
179 return (INT16)GetSystemMetrics(index);
183 /***********************************************************************
184 * GetSystemMetrics (USER32.292)
186 INT WINAPI GetSystemMetrics( INT index )
188 if ((index < 0) || (index > SM_CMETRICS)) return 0;
189 else return sysMetrics[index];