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