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