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