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