Copy the first 128 colors from the default colormap to Wine's private
[wine.git] / windows / sysmetrics.c
blobcdf59c07a1ab24c69a2f271366fd03849a6f7e9c
1 /*
2 * System metrics functions
4 * Copyright 1994 Alexandre Julliard
6 */
8 #include <stdio.h>
9 #include <assert.h>
11 #include "windef.h"
12 #include "wingdi.h"
13 #include "wine/winuser16.h"
14 #include "winbase.h"
15 #include "winuser.h"
16 #include "options.h"
17 #include "user.h"
18 #include "sysmetrics.h"
20 static int sysMetrics[SM_WINE_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 HDC hdc = CreateDCA( "DISPLAY", NULL, NULL, NULL );
42 assert(hdc);
44 sysMetrics[SM_CXCURSOR] = 32;
45 sysMetrics[SM_CYCURSOR] = 32;
46 sysMetrics[SM_CXSCREEN] = GetDeviceCaps( hdc, HORZRES );
47 sysMetrics[SM_CYSCREEN] = GetDeviceCaps( hdc, VERTRES );
48 sysMetrics[SM_WINE_BPP] = GetDeviceCaps( hdc, BITSPIXEL );
49 if (TWEAK_WineLook > WIN31_LOOK)
50 sysMetrics[SM_CXVSCROLL] =
51 PROFILE_GetWineIniInt("Tweak.Layout", "ScrollBarWidth", 16);
52 else
53 sysMetrics[SM_CXVSCROLL] =
54 PROFILE_GetWineIniInt("Tweak.Layout", "ScrollBarWidth", 17);
55 sysMetrics[SM_CYHSCROLL] = sysMetrics[SM_CXVSCROLL];
56 if (TWEAK_WineLook > WIN31_LOOK)
57 sysMetrics[SM_CYCAPTION] =
58 PROFILE_GetWineIniInt("Tweak.Layout", "CaptionHeight", 19);
59 else
60 sysMetrics[SM_CYCAPTION] =
61 PROFILE_GetWineIniInt("Tweak.Layout", "CaptionHeight", 20);
62 sysMetrics[SM_CXBORDER] = 1;
63 sysMetrics[SM_CYBORDER] = sysMetrics[SM_CXBORDER];
64 sysMetrics[SM_CXDLGFRAME] =
65 PROFILE_GetWineIniInt("Tweak.Layout", "DialogFrameWidth",
66 (TWEAK_WineLook > WIN31_LOOK) ? 3 : 4);
67 sysMetrics[SM_CYDLGFRAME] = sysMetrics[SM_CXDLGFRAME];
68 sysMetrics[SM_CYVTHUMB] = sysMetrics[SM_CXVSCROLL] - 1;
69 sysMetrics[SM_CXHTHUMB] = sysMetrics[SM_CYVTHUMB];
70 sysMetrics[SM_CXICON] = 32;
71 sysMetrics[SM_CYICON] = 32;
72 if (TWEAK_WineLook > WIN31_LOOK)
73 sysMetrics[SM_CYMENU] =
74 PROFILE_GetWineIniInt("Tweak.Layout", "MenuHeight", 19);
75 else
76 sysMetrics[SM_CYMENU] =
77 PROFILE_GetWineIniInt("Tweak.Layout", "MenuHeight", 18);
78 sysMetrics[SM_CXFULLSCREEN] = sysMetrics[SM_CXSCREEN];
79 sysMetrics[SM_CYFULLSCREEN] =
80 sysMetrics[SM_CYSCREEN] - sysMetrics[SM_CYCAPTION];
81 sysMetrics[SM_CYKANJIWINDOW] = 0;
82 sysMetrics[SM_MOUSEPRESENT] = 1;
83 sysMetrics[SM_CYVSCROLL] = sysMetrics[SM_CYVTHUMB];
84 sysMetrics[SM_CXHSCROLL] = sysMetrics[SM_CXHTHUMB];
85 sysMetrics[SM_DEBUG] = 0;
87 /* FIXME: The following should look for the registry key to see if the
88 buttons should be swapped. */
89 sysMetrics[SM_SWAPBUTTON] = 0;
91 sysMetrics[SM_RESERVED1] = 0;
92 sysMetrics[SM_RESERVED2] = 0;
93 sysMetrics[SM_RESERVED3] = 0;
94 sysMetrics[SM_RESERVED4] = 0;
96 /* FIXME: The following two are calculated, but how? */
97 sysMetrics[SM_CXMIN] = (TWEAK_WineLook > WIN31_LOOK) ? 112 : 100;
98 sysMetrics[SM_CYMIN] = (TWEAK_WineLook > WIN31_LOOK) ? 27 : 28;
100 sysMetrics[SM_CXSIZE] = sysMetrics[SM_CYCAPTION] - 2;
101 sysMetrics[SM_CYSIZE] = sysMetrics[SM_CXSIZE];
102 sysMetrics[SM_CXFRAME] = GetProfileIntA("Windows", "BorderWidth", 4) + 1;
103 sysMetrics[SM_CYFRAME] = sysMetrics[SM_CXFRAME];
104 sysMetrics[SM_CXMINTRACK] = sysMetrics[SM_CXMIN];
105 sysMetrics[SM_CYMINTRACK] = sysMetrics[SM_CYMIN];
106 sysMetrics[SM_CXDOUBLECLK] =
107 (GetProfileIntA("Windows", "DoubleClickWidth", 4) + 1) & ~1;
108 sysMetrics[SM_CYDOUBLECLK] =
109 (GetProfileIntA("Windows","DoubleClickHeight", 4) + 1) & ~1;
110 sysMetrics[SM_CXICONSPACING] =
111 GetProfileIntA("Desktop","IconSpacing", 75);
112 sysMetrics[SM_CYICONSPACING] =
113 GetProfileIntA("Desktop", "IconVerticalSpacing", 75);
114 sysMetrics[SM_MENUDROPALIGNMENT] =
115 GetProfileIntA("Windows", "MenuDropAlignment", 0);
116 sysMetrics[SM_PENWINDOWS] = 0;
117 sysMetrics[SM_DBCSENABLED] = 0;
119 /* FIXME: Need to query X for the following */
120 sysMetrics[SM_CMOUSEBUTTONS] = 3;
122 sysMetrics[SM_SECURE] = 0;
123 sysMetrics[SM_CXEDGE] = sysMetrics[SM_CXBORDER] + 1;
124 sysMetrics[SM_CYEDGE] = sysMetrics[SM_CXEDGE];
125 sysMetrics[SM_CXMINSPACING] = 160;
126 sysMetrics[SM_CYMINSPACING] = 24;
127 sysMetrics[SM_CXSMICON] = sysMetrics[SM_CYSIZE] - (sysMetrics[SM_CYSIZE] % 2);
128 sysMetrics[SM_CYSMICON] = sysMetrics[SM_CXSMICON];
129 sysMetrics[SM_CYSMCAPTION] = 16;
130 sysMetrics[SM_CXSMSIZE] = 15;
131 sysMetrics[SM_CYSMSIZE] = sysMetrics[SM_CXSMSIZE];
132 sysMetrics[SM_CXMENUSIZE] = sysMetrics[SM_CYMENU];
133 sysMetrics[SM_CYMENUSIZE] = sysMetrics[SM_CXMENUSIZE];
135 /* FIXME: What do these mean? */
136 sysMetrics[SM_ARRANGE] = ARW_HIDE;
137 sysMetrics[SM_CXMINIMIZED] = 160;
138 sysMetrics[SM_CYMINIMIZED] = 24;
140 /* FIXME: How do I calculate these? */
141 sysMetrics[SM_CXMAXTRACK] =
142 sysMetrics[SM_CXSCREEN] + 4 + 2 * sysMetrics[SM_CXFRAME];
143 sysMetrics[SM_CYMAXTRACK] =
144 sysMetrics[SM_CYSCREEN] + 4 + 2 * sysMetrics[SM_CYFRAME];
145 sysMetrics[SM_CXMAXIMIZED] =
146 sysMetrics[SM_CXSCREEN] + 2 * sysMetrics[SM_CXFRAME];
147 sysMetrics[SM_CYMAXIMIZED] =
148 sysMetrics[SM_CYSCREEN] - 45;
149 sysMetrics[SM_NETWORK] = 3;
151 /* For the following: 0 = ok, 1 = failsafe, 2 = failsafe + network */
152 sysMetrics[SM_CLEANBOOT] = 0;
154 sysMetrics[SM_CXDRAG] = 2;
155 sysMetrics[SM_CYDRAG] = 2;
156 sysMetrics[SM_SHOWSOUNDS] = 0;
157 sysMetrics[SM_CXMENUCHECK] = 14;
158 sysMetrics[SM_CYMENUCHECK] = 14;
160 /* FIXME: Should check the type of processor for the following */
161 sysMetrics[SM_SLOWMACHINE] = 0;
163 /* FIXME: Should perform a check */
164 sysMetrics[SM_MIDEASTENABLED] = 0;
166 sysMetrics[SM_MOUSEWHEELPRESENT] = 0;
168 sysMetrics[SM_CXVIRTUALSCREEN] = sysMetrics[SM_CXSCREEN];
169 sysMetrics[SM_CYVIRTUALSCREEN] = sysMetrics[SM_CYSCREEN];
170 sysMetrics[SM_XVIRTUALSCREEN] = 0;
171 sysMetrics[SM_YVIRTUALSCREEN] = 0;
172 sysMetrics[SM_CMONITORS] = 1;
173 sysMetrics[SM_SAMEDISPLAYFORMAT] = 1;
174 sysMetrics[SM_CMETRICS] = SM_CMETRICS;
176 DeleteDC( hdc );
180 /***********************************************************************
181 * GetSystemMetrics (USER.179)
183 INT16 WINAPI GetSystemMetrics16( INT16 index )
185 return (INT16)GetSystemMetrics(index);
189 /***********************************************************************
190 * GetSystemMetrics (USER32.@)
192 INT WINAPI GetSystemMetrics( INT index )
194 if ((index < 0) || (index > SM_WINE_CMETRICS)) return 0;
195 else return sysMetrics[index];