2 * System parameters functions
4 * Copyright 1994 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
29 #define NONAMELESSUNION
30 #define NONAMELESSSTRUCT
37 #include "wine/winuser16.h"
41 #include "user_private.h"
42 #include "wine/unicode.h"
43 #include "wine/debug.h"
45 WINE_DEFAULT_DEBUG_CHANNEL(system
);
47 /* System parameter indexes */
53 SPI_SETKEYBOARDSPEED_IDX
,
54 SPI_ICONHORIZONTALSPACING_IDX
,
55 SPI_SETSCREENSAVETIMEOUT_IDX
,
56 SPI_SETGRIDGRANULARITY_IDX
,
57 SPI_SETKEYBOARDDELAY_IDX
,
58 SPI_ICONVERTICALSPACING_IDX
,
59 SPI_SETICONTITLEWRAP_IDX
,
60 SPI_SETMENUDROPALIGNMENT_IDX
,
61 SPI_SETDOUBLECLKWIDTH_IDX
,
62 SPI_SETDOUBLECLKHEIGHT_IDX
,
63 SPI_SETDOUBLECLICKTIME_IDX
,
64 SPI_SETMOUSEBUTTONSWAP_IDX
,
65 SPI_SETDRAGFULLWINDOWS_IDX
,
67 SPI_SETSHOWSOUNDS_IDX
,
68 SPI_SETKEYBOARDPREF_IDX
,
69 SPI_SETSCREENREADER_IDX
,
70 SPI_SETSCREENSAVERRUNNING_IDX
,
71 SPI_SETFONTSMOOTHING_IDX
,
72 SPI_SETLISTBOXSMOOTHSCROLLING_IDX
,
73 SPI_SETMOUSEHOVERWIDTH_IDX
,
74 SPI_SETMOUSEHOVERHEIGHT_IDX
,
75 SPI_SETMOUSEHOVERTIME_IDX
,
76 SPI_SETMOUSESCROLLCHARS_IDX
,
77 SPI_SETMOUSESCROLLLINES_IDX
,
78 SPI_SETMENUSHOWDELAY_IDX
,
79 SPI_SETICONTITLELOGFONT_IDX
,
80 SPI_SETLOWPOWERACTIVE_IDX
,
81 SPI_SETSNAPTODEFBUTTON_IDX
,
82 SPI_SETPOWEROFFACTIVE_IDX
,
83 SPI_USERPREFERENCEMASK_IDX
,
84 SPI_NONCLIENTMETRICS_IDX
,
85 SPI_MINIMIZEDMETRICS_IDX
,
86 SPI_SETFOREGROUNDLOCKTIMEOUT_IDX
,
88 SPI_SETMOUSESPEED_IDX
,
89 SPI_SETFONTSMOOTHINGTYPE_IDX
,
90 SPI_SETFONTSMOOTHINGCONTRAST_IDX
,
91 SPI_SETFONTSMOOTHINGORIENTATION_IDX
,
95 static const char * const DefSysColors
[] =
97 "Scrollbar", "212 208 200", /* COLOR_SCROLLBAR */
98 "Background", "58 110 165", /* COLOR_BACKGROUND */
99 "ActiveTitle", "10 36 106", /* COLOR_ACTIVECAPTION */
100 "InactiveTitle", "128 128 128", /* COLOR_INACTIVECAPTION */
101 "Menu", "212 208 200", /* COLOR_MENU */
102 "Window", "255 255 255", /* COLOR_WINDOW */
103 "WindowFrame", "0 0 0", /* COLOR_WINDOWFRAME */
104 "MenuText", "0 0 0", /* COLOR_MENUTEXT */
105 "WindowText", "0 0 0", /* COLOR_WINDOWTEXT */
106 "TitleText", "255 255 255", /* COLOR_CAPTIONTEXT */
107 "ActiveBorder", "212 208 200", /* COLOR_ACTIVEBORDER */
108 "InactiveBorder", "212 208 200", /* COLOR_INACTIVEBORDER */
109 "AppWorkSpace", "128 128 128", /* COLOR_APPWORKSPACE */
110 "Hilight", "10 36 106", /* COLOR_HIGHLIGHT */
111 "HilightText", "255 255 255", /* COLOR_HIGHLIGHTTEXT */
112 "ButtonFace", "212 208 200", /* COLOR_BTNFACE */
113 "ButtonShadow", "128 128 128", /* COLOR_BTNSHADOW */
114 "GrayText", "128 128 128", /* COLOR_GRAYTEXT */
115 "ButtonText", "0 0 0", /* COLOR_BTNTEXT */
116 "InactiveTitleText", "212 208 200", /* COLOR_INACTIVECAPTIONTEXT */
117 "ButtonHilight", "255 255 255", /* COLOR_BTNHIGHLIGHT */
118 "ButtonDkShadow", "64 64 64", /* COLOR_3DDKSHADOW */
119 "ButtonLight", "212 208 200", /* COLOR_3DLIGHT */
120 "InfoText", "0 0 0", /* COLOR_INFOTEXT */
121 "InfoWindow", "255 255 225", /* COLOR_INFOBK */
122 "ButtonAlternateFace", "181 181 181", /* COLOR_ALTERNATEBTNFACE */
123 "HotTrackingColor", "0 0 128", /* COLOR_HOTLIGHT */
124 "GradientActiveTitle", "166 202 240", /* COLOR_GRADIENTACTIVECAPTION */
125 "GradientInactiveTitle", "192 192 192", /* COLOR_GRADIENTINACTIVECAPTION */
126 "MenuHilight", "10 36 106", /* COLOR_MENUHILIGHT */
127 "MenuBar", "212 208 200" /* COLOR_MENUBAR */
131 * Names of the registry subkeys of HKEY_CURRENT_USER key and value names
132 * for the system parameters.
133 * Names of the keys are created by adding string "_REGKEY" to
134 * "SET" action names, value names are created by adding "_REG_NAME"
135 * to the "SET" action name.
137 static const WCHAR SPI_SETBEEP_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','S','o','u','n','d',0};
138 static const WCHAR SPI_SETBEEP_VALNAME
[]= {'B','e','e','p',0};
139 static const WCHAR SPI_SETMOUSE_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
140 static const WCHAR SPI_SETMOUSE_VALNAME1
[]= {'M','o','u','s','e','T','h','r','e','s','h','o','l','d','1',0};
141 static const WCHAR SPI_SETMOUSE_VALNAME2
[]= {'M','o','u','s','e','T','h','r','e','s','h','o','l','d','2',0};
142 static const WCHAR SPI_SETMOUSE_VALNAME3
[]= {'M','o','u','s','e','S','p','e','e','d',0};
143 static const WCHAR SPI_SETBORDER_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\\',
144 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
145 static const WCHAR SPI_SETBORDER_VALNAME
[]= {'B','o','r','d','e','r','W','i','d','t','h',0};
146 static const WCHAR SPI_SETKEYBOARDSPEED_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','K','e','y','b','o','a','r','d',0};
147 static const WCHAR SPI_SETKEYBOARDSPEED_VALNAME
[]= {'K','e','y','b','o','a','r','d','S','p','e','e','d',0};
148 static const WCHAR SPI_ICONHORIZONTALSPACING_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\\',
149 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
150 static const WCHAR SPI_ICONHORIZONTALSPACING_VALNAME
[]= {'I','c','o','n','S','p','a','c','i','n','g',0};
151 static const WCHAR SPI_SETSCREENSAVETIMEOUT_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
152 static const WCHAR SPI_SETSCREENSAVETIMEOUT_VALNAME
[]= {'S','c','r','e','e','n','S','a','v','e','T','i','m','e','O','u','t',0};
153 static const WCHAR SPI_SETSCREENSAVEACTIVE_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
154 static const WCHAR SPI_SETSCREENSAVEACTIVE_VALNAME
[]= {'S','c','r','e','e','n','S','a','v','e','A','c','t','i','v','e',0};
155 static const WCHAR SPI_SETGRIDGRANULARITY_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
156 static const WCHAR SPI_SETGRIDGRANULARITY_VALNAME
[]= {'G','r','i','d','G','r','a','n','u','l','a','r','i','t','y',0};
157 static const WCHAR SPI_SETKEYBOARDDELAY_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','K','e','y','b','o','a','r','d',0};
158 static const WCHAR SPI_SETKEYBOARDDELAY_VALNAME
[]= {'K','e','y','b','o','a','r','d','D','e','l','a','y',0};
159 static const WCHAR SPI_ICONVERTICALSPACING_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\\',
160 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
161 static const WCHAR SPI_ICONVERTICALSPACING_VALNAME
[]= {'I','c','o','n','V','e','r','t','i','c','a','l','S','p','a','c','i','n','g',0};
162 static const WCHAR SPI_SETICONTITLEWRAP_REGKEY1
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\\',
163 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
164 static const WCHAR SPI_SETICONTITLEWRAP_REGKEY2
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
165 static const WCHAR SPI_SETICONTITLEWRAP_VALNAME
[]= {'I','c','o','n','T','i','t','l','e','W','r','a','p',0};
166 static const WCHAR SPI_SETICONTITLELOGFONT_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\\',
167 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
168 static const WCHAR SPI_SETICONTITLELOGFONT_VALNAME
[]= {'I','c','o','n','F','o','n','t',0};
169 static const WCHAR SPI_SETMENUDROPALIGNMENT_REGKEY1
[]= {'S','o','f','t','w','a','r','e','\\',
170 'M','i','c','r','o','s','o','f','t','\\',
171 'W','i','n','d','o','w','s',' ','N','T','\\',
172 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
173 'W','i','n','d','o','w','s',0};
174 static const WCHAR SPI_SETMENUDROPALIGNMENT_REGKEY2
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
175 static const WCHAR SPI_SETMENUDROPALIGNMENT_VALNAME
[]= {'M','e','n','u','D','r','o','p','A','l','i','g','n','m','e','n','t',0};
176 static const WCHAR SPI_SETSNAPTODEFBUTTON_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
177 static const WCHAR SPI_SETSNAPTODEFBUTTON_VALNAME
[]= {'S','n','a','p','T','o','D','e','f','a','u','l','t','B','u','t','t','o','n',0};
178 static const WCHAR SPI_SETDOUBLECLKWIDTH_REGKEY1
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
179 static const WCHAR SPI_SETDOUBLECLKWIDTH_REGKEY2
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
180 static const WCHAR SPI_SETDOUBLECLKWIDTH_VALNAME
[]= {'D','o','u','b','l','e','C','l','i','c','k','W','i','d','t','h',0};
181 static const WCHAR SPI_SETDOUBLECLKHEIGHT_REGKEY1
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
182 static const WCHAR SPI_SETDOUBLECLKHEIGHT_REGKEY2
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
183 static const WCHAR SPI_SETDOUBLECLKHEIGHT_VALNAME
[]= {'D','o','u','b','l','e','C','l','i','c','k','H','e','i','g','h','t',0};
184 static const WCHAR SPI_SETDOUBLECLICKTIME_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
185 static const WCHAR SPI_SETDOUBLECLICKTIME_VALNAME
[]= {'D','o','u','b','l','e','C','l','i','c','k','S','p','e','e','d',0};
186 static const WCHAR SPI_SETMOUSEBUTTONSWAP_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
187 static const WCHAR SPI_SETMOUSEBUTTONSWAP_VALNAME
[]= {'S','w','a','p','M','o','u','s','e','B','u','t','t','o','n','s',0};
188 static const WCHAR SPI_SETDRAGFULLWINDOWS_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
189 static const WCHAR SPI_SETDRAGFULLWINDOWS_VALNAME
[]= {'D','r','a','g','F','u','l','l','W','i','n','d','o','w','s',0};
190 static const WCHAR SPI_SETSHOWSOUNDS_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
191 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
192 'S','h','o','w','S','o','u','n','d','s',0};
193 static const WCHAR SPI_SETSHOWSOUNDS_VALNAME
[]= {'O','n',0};
194 static const WCHAR SPI_SETKEYBOARDPREF_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
195 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
196 'K','e','y','b','o','a','r','d',' ','P','r','e','f','e','r','e','n','c','e',0};
197 static const WCHAR SPI_SETKEYBOARDPREF_VALNAME
[]= {'O','n',0};
198 static const WCHAR SPI_SETSCREENREADER_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
199 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
200 'B','l','i','n','d',' ','A','c','c','e','s','s',0};
201 static const WCHAR SPI_SETSCREENREADER_VALNAME
[]= {'O','n',0};
202 static const WCHAR SPI_SETDESKWALLPAPER_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
203 static const WCHAR SPI_SETDESKWALLPAPER_VALNAME
[]= {'W','a','l','l','p','a','p','e','r',0};
204 static const WCHAR SPI_SETFONTSMOOTHING_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
205 static const WCHAR SPI_SETFONTSMOOTHING_VALNAME
[]= {'F','o','n','t','S','m','o','o','t','h','i','n','g',0};
206 static const WCHAR SPI_SETLOWPOWERACTIVE_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
207 static const WCHAR SPI_SETLOWPOWERACTIVE_VALNAME
[]= {'L','o','w','P','o','w','e','r','A','c','t','i','v','e',0};
208 static const WCHAR SPI_SETPOWEROFFACTIVE_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
209 static const WCHAR SPI_SETPOWEROFFACTIVE_VALNAME
[]= {'P','o','w','e','r','O','f','f','A','c','t','i','v','e',0};
210 static const WCHAR SPI_USERPREFERENCEMASK_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
211 static const WCHAR SPI_USERPREFERENCEMASK_VALNAME
[]= {'U','s','e','r','P','r','e','f','e','r','e','n','c','e','m','a','s','k',0};
212 static const WCHAR SPI_SETMOUSEHOVERWIDTH_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
213 static const WCHAR SPI_SETMOUSEHOVERWIDTH_VALNAME
[]= {'M','o','u','s','e','H','o','v','e','r','W','i','d','t','h',0};
214 static const WCHAR SPI_SETMOUSEHOVERHEIGHT_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
215 static const WCHAR SPI_SETMOUSEHOVERHEIGHT_VALNAME
[]= {'M','o','u','s','e','H','o','v','e','r','H','e','i','g','h','t',0};
216 static const WCHAR SPI_SETMOUSEHOVERTIME_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
217 static const WCHAR SPI_SETMOUSEHOVERTIME_VALNAME
[]= {'M','o','u','s','e','H','o','v','e','r','T','i','m','e',0};
218 static const WCHAR SPI_SETMOUSESCROLLCHARS_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
219 static const WCHAR SPI_SETMOUSESCROLLCHARS_VALNAME
[]= {'W','h','e','e','l','S','c','r','o','l','l','C','h','a','r','s',0};
220 static const WCHAR SPI_SETMOUSESCROLLLINES_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
221 static const WCHAR SPI_SETMOUSESCROLLLINES_VALNAME
[]= {'W','h','e','e','l','S','c','r','o','l','l','L','i','n','e','s',0};
222 static const WCHAR SPI_SETMENUSHOWDELAY_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
223 static const WCHAR SPI_SETMENUSHOWDELAY_VALNAME
[]= {'M','e','n','u','S','h','o','w','D','e','l','a','y',0};
224 static const WCHAR SPI_SETFOREGROUNDLOCKTIMEOUT_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
225 static const WCHAR SPI_SETFOREGROUNDLOCKTIMEOUT_VALNAME
[]= {'F','o','r','e','g','r','o','u','n','d','L','o','c','k','T','i','m','e','o','u','t',0};
226 static const WCHAR SPI_CARETWIDTH_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
227 static const WCHAR SPI_CARETWIDTH_VALNAME
[]= {'C','a','r','e','t','W','i','d','t','h',0};
228 static const WCHAR SPI_SETMOUSESPEED_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
229 static const WCHAR SPI_SETMOUSESPEED_VALNAME
[]= {'M','o','u','s','e','S','e','n','s','i','t','i','v','i','t','y',0};
230 static const WCHAR SPI_SETFONTSMOOTHINGTYPE_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
231 static const WCHAR SPI_SETFONTSMOOTHINGTYPE_VALNAME
[]= {'F','o','n','t','S','m','o','o','t','h','i','n','g','T','y','p','e',0};
232 static const WCHAR SPI_SETFONTSMOOTHINGCONTRAST_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
233 static const WCHAR SPI_SETFONTSMOOTHINGCONTRAST_VALNAME
[]= {'F','o','n','t','S','m','o','o','t','h','i','n','g','G','a','m','m','a',0};
234 static const WCHAR SPI_SETFONTSMOOTHINGORIENTATION_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
235 static const WCHAR SPI_SETFONTSMOOTHINGORIENTATION_VALNAME
[]= {'F','o','n','t','S','m','o','o','t','h','i','n','g','O','r','i','e','n','t','a','t','i','o','n',0};
237 /* FIXME - real values */
238 static const WCHAR SPI_SETSCREENSAVERRUNNING_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
239 static const WCHAR SPI_SETSCREENSAVERRUNNING_VALNAME
[]= {'W','I','N','E','_','S','c','r','e','e','n','S','a','v','e','r','R','u','n','n','i','n','g',0};
241 static const WCHAR METRICS_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\\',
242 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
243 static const WCHAR METRICS_SCROLLWIDTH_VALNAME
[]= {'S','c','r','o','l','l','W','i','d','t','h',0};
244 static const WCHAR METRICS_SCROLLHEIGHT_VALNAME
[]= {'S','c','r','o','l','l','H','e','i','g','h','t',0};
245 static const WCHAR METRICS_CAPTIONWIDTH_VALNAME
[]= {'C','a','p','t','i','o','n','W','i','d','t','h',0};
246 static const WCHAR METRICS_CAPTIONHEIGHT_VALNAME
[]= {'C','a','p','t','i','o','n','H','e','i','g','h','t',0};
247 static const WCHAR METRICS_SMCAPTIONWIDTH_VALNAME
[]= {'S','m','C','a','p','t','i','o','n','W','i','d','t','h',0};
248 static const WCHAR METRICS_SMCAPTIONHEIGHT_VALNAME
[]= {'S','m','C','a','p','t','i','o','n','H','e','i','g','h','t',0};
249 static const WCHAR METRICS_MENUWIDTH_VALNAME
[]= {'M','e','n','u','W','i','d','t','h',0};
250 static const WCHAR METRICS_MENUHEIGHT_VALNAME
[]= {'M','e','n','u','H','e','i','g','h','t',0};
251 static const WCHAR METRICS_ICONSIZE_VALNAME
[]= {'S','h','e','l','l',' ','I','c','o','n',' ','S','i','z','e',0};
252 static const WCHAR METRICS_BORDERWIDTH_VALNAME
[]= {'B','o','r','d','e','r','W','i','d','t','h',0};
253 static const WCHAR METRICS_CAPTIONLOGFONT_VALNAME
[]= {'C','a','p','t','i','o','n','F','o','n','t',0};
254 static const WCHAR METRICS_SMCAPTIONLOGFONT_VALNAME
[]={'S','m','C','a','p','t','i','o','n','F','o','n','t',0};
255 static const WCHAR METRICS_MENULOGFONT_VALNAME
[]= {'M','e','n','u','F','o','n','t',0};
256 static const WCHAR METRICS_MESSAGELOGFONT_VALNAME
[]= {'M','e','s','s','a','g','e','F','o','n','t',0};
257 static const WCHAR METRICS_STATUSLOGFONT_VALNAME
[]= {'S','t','a','t','u','s','F','o','n','t',0};
258 /* minimized metrics */
259 static const WCHAR METRICS_MINWIDTH_VALNAME
[] = {'M','i','n','W','i','d','t','h','\0'};
260 static const WCHAR METRICS_MINHORZGAP_VALNAME
[] = {'M','i','n','H','o','r','z','G','a','p','\0'};
261 static const WCHAR METRICS_MINVERTGAP_VALNAME
[] = {'M','i','n','V','e','r','t','G','a','p','\0'};
262 static const WCHAR METRICS_MINARRANGE_VALNAME
[] = {'M','i','n','A','r','r','a','n','g','e','\0'};
264 static const WCHAR WINE_CURRENT_USER_REGKEY
[] = {'S','o','f','t','w','a','r','e','\\',
267 /* volatile registry branch under WINE_CURRENT_USER_REGKEY for temporary values storage */
268 static const WCHAR WINE_CURRENT_USER_REGKEY_TEMP_PARAMS
[] = {'T','e','m','p','o','r','a','r','y',' ',
269 'S','y','s','t','e','m',' ',
270 'P','a','r','a','m','e','t','e','r','s',0};
272 static const WCHAR Yes
[]= {'Y','e','s',0};
273 static const WCHAR No
[]= {'N','o',0};
274 static const WCHAR Desktop
[]= {'D','e','s','k','t','o','p',0};
275 static const WCHAR Pattern
[]= {'P','a','t','t','e','r','n',0};
276 static const WCHAR MenuFont
[]= {'M','e','n','u','F','o','n','t',0};
277 static const WCHAR MenuFontSize
[]= {'M','e','n','u','F','o','n','t','S','i','z','e',0};
278 static const WCHAR StatusFont
[]= {'S','t','a','t','u','s','F','o','n','t',0};
279 static const WCHAR StatusFontSize
[]= {'S','t','a','t','u','s','F','o','n','t','S','i','z','e',0};
280 static const WCHAR MessageFont
[]= {'M','e','s','s','a','g','e','F','o','n','t',0};
281 static const WCHAR MessageFontSize
[]= {'M','e','s','s','a','g','e','F','o','n','t','S','i','z','e',0};
282 static const WCHAR System
[]= {'S','y','s','t','e','m',0};
283 static const WCHAR IconTitleSize
[]= {'I','c','o','n','T','i','t','l','e','S','i','z','e',0};
284 static const WCHAR IconTitleFaceName
[]= {'I','c','o','n','T','i','t','l','e','F','a','c','e','N','a','m','e',0};
285 static const WCHAR defPattern
[]= {'0',' ','0',' ','0',' ','0',' ','0',' ','0',' ','0',' ','0',0};
286 static const WCHAR CSu
[]= {'%','u',0};
287 static const WCHAR CSd
[]= {'%','d',0};
289 /* Indicators whether system parameter value is loaded */
290 static char spi_loaded
[SPI_INDEX_COUNT
];
292 static BOOL notify_change
= TRUE
;
294 /* System parameters storage */
295 static BOOL beep_active
= TRUE
;
296 static int mouse_threshold1
= 6;
297 static int mouse_threshold2
= 10;
298 static int mouse_speed
= 1;
299 static UINT border
= 1;
300 static UINT keyboard_speed
= 31;
301 static UINT screensave_timeout
= 300;
302 static UINT grid_granularity
= 0;
303 static UINT keyboard_delay
= 1;
304 static UINT double_click_width
= 4;
305 static UINT double_click_height
= 4;
306 static UINT double_click_time
= 500;
307 static BOOL drag_full_windows
= FALSE
;
308 static RECT work_area
;
309 static BOOL keyboard_pref
= TRUE
;
310 static BOOL screen_reader
= FALSE
;
311 static UINT mouse_hover_width
= 4;
312 static UINT mouse_hover_height
= 4;
313 static UINT mouse_hover_time
= 400;
314 static UINT mouse_scroll_chars
= 3;
315 static UINT mouse_scroll_lines
= 3;
316 static UINT menu_show_delay
= 400;
317 static UINT menu_drop_alignment
= 0;
318 static BOOL screensaver_running
= FALSE
;
319 static UINT font_smoothing
= 0; /* 0x01 for 95/98/NT, 0x02 for 98/ME/2k/XP */
320 static BOOL lowpoweractive
= FALSE
;
321 static BOOL poweroffactive
= FALSE
;
322 static BOOL show_sounds
= FALSE
;
323 static BOOL snap_to_default_button
= FALSE
;
324 static BOOL swap_buttons
= FALSE
;
325 static UINT foreground_lock_timeout
= 0;
326 static UINT caret_width
= 1;
327 static UINT mouse_sensitivity
= 10;
328 static UINT font_smoothing_type
= 0;
329 static UINT font_smoothing_contrast
= 0;
330 static UINT font_smoothing_orientation
= 0;
331 static BYTE user_prefs
[4];
333 static MINIMIZEDMETRICS minimized_metrics
=
335 sizeof(MINIMIZEDMETRICS
),
339 ARW_HIDE
/* iArrange */
342 static ICONMETRICSW icon_metrics
=
344 sizeof(ICONMETRICSW
),
345 75, /* iHorzSpacing */
346 75, /* iVertSpacing */
347 TRUE
, /* iTitleWrap */
348 { -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, DEFAULT_CHARSET
,
349 OUT_DEFAULT_PRECIS
, CLIP_DEFAULT_PRECIS
, DEFAULT_QUALITY
, DEFAULT_PITCH
} /* lfFont */
352 static NONCLIENTMETRICSW nonclient_metrics
=
354 sizeof(NONCLIENTMETRICSW
),
355 1, /* iBorderWidth */
356 16, /* iScrollWidth */
357 16, /* iScrollHeight */
358 18, /* iCaptionWidth */
359 18, /* iCaptionHeight */
360 { 0 }, /* lfCaptionFont */
361 13, /* iSmCaptionWidth */
362 15, /* iSmCaptionHeight */
363 { 0 }, /* lfSmCaptionFont */
365 18, /* iMenuHeight */
366 { 0 }, /* lfMenuFont */
367 { 0 }, /* lfStatusFont */
368 { 0 } /* lfMessageFont */
371 /* some additional non client metric info */
372 static TEXTMETRICW tmMenuFont
;
373 static UINT CaptionFontAvCharWidth
;
375 static SIZE icon_size
= { 32, 32 };
377 #define NUM_SYS_COLORS (COLOR_MENUBAR+1)
379 static COLORREF SysColors
[NUM_SYS_COLORS
];
380 static HBRUSH SysColorBrushes
[NUM_SYS_COLORS
];
381 static HPEN SysColorPens
[NUM_SYS_COLORS
];
383 static const WORD wPattern55AA
[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa };
385 HBRUSH SYSCOLOR_55AABrush
= 0;
387 extern void CDECL
__wine_make_gdi_object_system( HGDIOBJ handle
, BOOL set
);
390 /* This function is a copy of the one in objects/font.c */
391 static void SYSPARAMS_LogFont32ATo16( const LOGFONTA
* font32
, LPLOGFONT16 font16
)
393 font16
->lfHeight
= font32
->lfHeight
;
394 font16
->lfWidth
= font32
->lfWidth
;
395 font16
->lfEscapement
= font32
->lfEscapement
;
396 font16
->lfOrientation
= font32
->lfOrientation
;
397 font16
->lfWeight
= font32
->lfWeight
;
398 font16
->lfItalic
= font32
->lfItalic
;
399 font16
->lfUnderline
= font32
->lfUnderline
;
400 font16
->lfStrikeOut
= font32
->lfStrikeOut
;
401 font16
->lfCharSet
= font32
->lfCharSet
;
402 font16
->lfOutPrecision
= font32
->lfOutPrecision
;
403 font16
->lfClipPrecision
= font32
->lfClipPrecision
;
404 font16
->lfQuality
= font32
->lfQuality
;
405 font16
->lfPitchAndFamily
= font32
->lfPitchAndFamily
;
406 lstrcpynA( font16
->lfFaceName
, font32
->lfFaceName
, LF_FACESIZE
);
409 static void SYSPARAMS_LogFont16To32W( const LOGFONT16
*font16
, LPLOGFONTW font32
)
411 font32
->lfHeight
= font16
->lfHeight
;
412 font32
->lfWidth
= font16
->lfWidth
;
413 font32
->lfEscapement
= font16
->lfEscapement
;
414 font32
->lfOrientation
= font16
->lfOrientation
;
415 font32
->lfWeight
= font16
->lfWeight
;
416 font32
->lfItalic
= font16
->lfItalic
;
417 font32
->lfUnderline
= font16
->lfUnderline
;
418 font32
->lfStrikeOut
= font16
->lfStrikeOut
;
419 font32
->lfCharSet
= font16
->lfCharSet
;
420 font32
->lfOutPrecision
= font16
->lfOutPrecision
;
421 font32
->lfClipPrecision
= font16
->lfClipPrecision
;
422 font32
->lfQuality
= font16
->lfQuality
;
423 font32
->lfPitchAndFamily
= font16
->lfPitchAndFamily
;
424 MultiByteToWideChar( CP_ACP
, 0, font16
->lfFaceName
, -1, font32
->lfFaceName
, LF_FACESIZE
);
425 font32
->lfFaceName
[LF_FACESIZE
-1] = 0;
428 static void SYSPARAMS_LogFont32WTo32A( const LOGFONTW
* font32W
, LPLOGFONTA font32A
)
430 font32A
->lfHeight
= font32W
->lfHeight
;
431 font32A
->lfWidth
= font32W
->lfWidth
;
432 font32A
->lfEscapement
= font32W
->lfEscapement
;
433 font32A
->lfOrientation
= font32W
->lfOrientation
;
434 font32A
->lfWeight
= font32W
->lfWeight
;
435 font32A
->lfItalic
= font32W
->lfItalic
;
436 font32A
->lfUnderline
= font32W
->lfUnderline
;
437 font32A
->lfStrikeOut
= font32W
->lfStrikeOut
;
438 font32A
->lfCharSet
= font32W
->lfCharSet
;
439 font32A
->lfOutPrecision
= font32W
->lfOutPrecision
;
440 font32A
->lfClipPrecision
= font32W
->lfClipPrecision
;
441 font32A
->lfQuality
= font32W
->lfQuality
;
442 font32A
->lfPitchAndFamily
= font32W
->lfPitchAndFamily
;
443 WideCharToMultiByte( CP_ACP
, 0, font32W
->lfFaceName
, -1, font32A
->lfFaceName
, LF_FACESIZE
, NULL
, NULL
);
444 font32A
->lfFaceName
[LF_FACESIZE
-1] = 0;
447 static void SYSPARAMS_LogFont32ATo32W( const LOGFONTA
* font32A
, LPLOGFONTW font32W
)
449 font32W
->lfHeight
= font32A
->lfHeight
;
450 font32W
->lfWidth
= font32A
->lfWidth
;
451 font32W
->lfEscapement
= font32A
->lfEscapement
;
452 font32W
->lfOrientation
= font32A
->lfOrientation
;
453 font32W
->lfWeight
= font32A
->lfWeight
;
454 font32W
->lfItalic
= font32A
->lfItalic
;
455 font32W
->lfUnderline
= font32A
->lfUnderline
;
456 font32W
->lfStrikeOut
= font32A
->lfStrikeOut
;
457 font32W
->lfCharSet
= font32A
->lfCharSet
;
458 font32W
->lfOutPrecision
= font32A
->lfOutPrecision
;
459 font32W
->lfClipPrecision
= font32A
->lfClipPrecision
;
460 font32W
->lfQuality
= font32A
->lfQuality
;
461 font32W
->lfPitchAndFamily
= font32A
->lfPitchAndFamily
;
462 MultiByteToWideChar( CP_ACP
, 0, font32A
->lfFaceName
, -1, font32W
->lfFaceName
, LF_FACESIZE
);
463 font32W
->lfFaceName
[LF_FACESIZE
-1] = 0;
466 static void SYSPARAMS_NonClientMetrics32ATo16( const NONCLIENTMETRICSA
* lpnm32
, LPNONCLIENTMETRICS16 lpnm16
)
468 lpnm16
->iBorderWidth
= lpnm32
->iBorderWidth
;
469 lpnm16
->iScrollWidth
= lpnm32
->iScrollWidth
;
470 lpnm16
->iScrollHeight
= lpnm32
->iScrollHeight
;
471 lpnm16
->iCaptionWidth
= lpnm32
->iCaptionWidth
;
472 lpnm16
->iCaptionHeight
= lpnm32
->iCaptionHeight
;
473 SYSPARAMS_LogFont32ATo16( &lpnm32
->lfCaptionFont
, &lpnm16
->lfCaptionFont
);
474 lpnm16
->iSmCaptionWidth
= lpnm32
->iSmCaptionWidth
;
475 lpnm16
->iSmCaptionHeight
= lpnm32
->iSmCaptionHeight
;
476 SYSPARAMS_LogFont32ATo16( &lpnm32
->lfSmCaptionFont
, &lpnm16
->lfSmCaptionFont
);
477 lpnm16
->iMenuWidth
= lpnm32
->iMenuWidth
;
478 lpnm16
->iMenuHeight
= lpnm32
->iMenuHeight
;
479 SYSPARAMS_LogFont32ATo16( &lpnm32
->lfMenuFont
, &lpnm16
->lfMenuFont
);
480 SYSPARAMS_LogFont32ATo16( &lpnm32
->lfStatusFont
, &lpnm16
->lfStatusFont
);
481 SYSPARAMS_LogFont32ATo16( &lpnm32
->lfMessageFont
, &lpnm16
->lfMessageFont
);
484 static void SYSPARAMS_NonClientMetrics32WTo32A( const NONCLIENTMETRICSW
* lpnm32W
, LPNONCLIENTMETRICSA lpnm32A
)
486 lpnm32A
->iBorderWidth
= lpnm32W
->iBorderWidth
;
487 lpnm32A
->iScrollWidth
= lpnm32W
->iScrollWidth
;
488 lpnm32A
->iScrollHeight
= lpnm32W
->iScrollHeight
;
489 lpnm32A
->iCaptionWidth
= lpnm32W
->iCaptionWidth
;
490 lpnm32A
->iCaptionHeight
= lpnm32W
->iCaptionHeight
;
491 SYSPARAMS_LogFont32WTo32A( &lpnm32W
->lfCaptionFont
, &lpnm32A
->lfCaptionFont
);
492 lpnm32A
->iSmCaptionWidth
= lpnm32W
->iSmCaptionWidth
;
493 lpnm32A
->iSmCaptionHeight
= lpnm32W
->iSmCaptionHeight
;
494 SYSPARAMS_LogFont32WTo32A( &lpnm32W
->lfSmCaptionFont
, &lpnm32A
->lfSmCaptionFont
);
495 lpnm32A
->iMenuWidth
= lpnm32W
->iMenuWidth
;
496 lpnm32A
->iMenuHeight
= lpnm32W
->iMenuHeight
;
497 SYSPARAMS_LogFont32WTo32A( &lpnm32W
->lfMenuFont
, &lpnm32A
->lfMenuFont
);
498 SYSPARAMS_LogFont32WTo32A( &lpnm32W
->lfStatusFont
, &lpnm32A
->lfStatusFont
);
499 SYSPARAMS_LogFont32WTo32A( &lpnm32W
->lfMessageFont
, &lpnm32A
->lfMessageFont
);
502 static void SYSPARAMS_NonClientMetrics32ATo32W( const NONCLIENTMETRICSA
* lpnm32A
, LPNONCLIENTMETRICSW lpnm32W
)
504 lpnm32W
->iBorderWidth
= lpnm32A
->iBorderWidth
;
505 lpnm32W
->iScrollWidth
= lpnm32A
->iScrollWidth
;
506 lpnm32W
->iScrollHeight
= lpnm32A
->iScrollHeight
;
507 lpnm32W
->iCaptionWidth
= lpnm32A
->iCaptionWidth
;
508 lpnm32W
->iCaptionHeight
= lpnm32A
->iCaptionHeight
;
509 SYSPARAMS_LogFont32ATo32W( &lpnm32A
->lfCaptionFont
, &lpnm32W
->lfCaptionFont
);
510 lpnm32W
->iSmCaptionWidth
= lpnm32A
->iSmCaptionWidth
;
511 lpnm32W
->iSmCaptionHeight
= lpnm32A
->iSmCaptionHeight
;
512 SYSPARAMS_LogFont32ATo32W( &lpnm32A
->lfSmCaptionFont
, &lpnm32W
->lfSmCaptionFont
);
513 lpnm32W
->iMenuWidth
= lpnm32A
->iMenuWidth
;
514 lpnm32W
->iMenuHeight
= lpnm32A
->iMenuHeight
;
515 SYSPARAMS_LogFont32ATo32W( &lpnm32A
->lfMenuFont
, &lpnm32W
->lfMenuFont
);
516 SYSPARAMS_LogFont32ATo32W( &lpnm32A
->lfStatusFont
, &lpnm32W
->lfStatusFont
);
517 SYSPARAMS_LogFont32ATo32W( &lpnm32A
->lfMessageFont
, &lpnm32W
->lfMessageFont
);
521 /* Helper functions to retrieve monitors info */
529 static BOOL CALLBACK
monitor_info_proc( HMONITOR monitor
, HDC hdc
, LPRECT rect
, LPARAM lp
)
531 struct monitor_info
*info
= (struct monitor_info
*)lp
;
533 UnionRect( &info
->virtual_rect
, &info
->virtual_rect
, rect
);
537 static void get_monitors_info( struct monitor_info
*info
)
540 SetRectEmpty( &info
->virtual_rect
);
541 EnumDisplayMonitors( 0, NULL
, monitor_info_proc
, (LPARAM
)info
);
545 /* get text metrics and/or "average" char width of the specified logfont
546 * for the specified dc */
547 static void get_text_metr_size( HDC hdc
, LOGFONTW
*plf
, TEXTMETRICW
* ptm
, UINT
*psz
)
549 HFONT hfont
, hfontsav
;
552 hfont
= CreateFontIndirectW( plf
);
553 if( !hfont
|| ( hfontsav
= SelectObject( hdc
, hfont
)) == NULL
) {
556 if( hfont
) DeleteObject( hfont
);
559 GetTextMetricsW( hdc
, ptm
);
561 if( !(*psz
= GdiGetCharDimensions( hdc
, ptm
, NULL
)))
563 SelectObject( hdc
, hfontsav
);
564 DeleteObject( hfont
);
567 /***********************************************************************
568 * get_volatile_regkey
570 * Return a handle to the volatile registry key used to store
571 * non-permanently modified parameters.
573 static HKEY
get_volatile_regkey(void)
575 static HKEY volatile_key
;
580 /* This must be non-volatile! */
581 if (RegCreateKeyExW( HKEY_CURRENT_USER
, WINE_CURRENT_USER_REGKEY
,
582 0, 0, REG_OPTION_NON_VOLATILE
, KEY_ALL_ACCESS
, 0,
583 &key
, 0 ) != ERROR_SUCCESS
)
585 ERR("Can't create wine registry branch\n");
589 /* @@ Wine registry key: HKCU\Software\Wine\Temporary System Parameters */
590 if (RegCreateKeyExW( key
, WINE_CURRENT_USER_REGKEY_TEMP_PARAMS
,
591 0, 0, REG_OPTION_VOLATILE
, KEY_ALL_ACCESS
, 0,
592 &volatile_key
, 0 ) != ERROR_SUCCESS
)
593 ERR("Can't create non-permanent wine registry branch\n");
601 /***********************************************************************
602 * SYSPARAMS_NotifyChange
604 * Sends notification about system parameter update.
606 static void SYSPARAMS_NotifyChange( UINT uiAction
, UINT fWinIni
)
608 static const WCHAR emptyW
[1];
612 if (fWinIni
& SPIF_UPDATEINIFILE
)
614 if (fWinIni
& (SPIF_SENDWININICHANGE
| SPIF_SENDCHANGE
))
615 SendMessageTimeoutW(HWND_BROADCAST
, WM_SETTINGCHANGE
,
616 uiAction
, (LPARAM
) emptyW
,
617 SMTO_ABORTIFHUNG
, 2000, NULL
);
621 /* FIXME notify other wine processes with internal message */
627 /***********************************************************************
628 * Loads system parameter from user profile.
630 static BOOL
SYSPARAMS_LoadRaw( LPCWSTR lpRegKey
, LPCWSTR lpValName
, LPBYTE lpBuf
, DWORD count
)
636 memset( lpBuf
, 0, count
);
637 if ((RegOpenKeyW( get_volatile_regkey(), lpRegKey
, &hKey
) == ERROR_SUCCESS
) ||
638 (RegOpenKeyW( HKEY_CURRENT_USER
, lpRegKey
, &hKey
) == ERROR_SUCCESS
))
640 ret
= !RegQueryValueExW( hKey
, lpValName
, NULL
, &type
, lpBuf
, &count
);
646 static BOOL
SYSPARAMS_Load( LPCWSTR lpRegKey
, LPCWSTR lpValName
, LPWSTR lpBuf
, DWORD count
)
648 return SYSPARAMS_LoadRaw( lpRegKey
, lpValName
, (LPBYTE
)lpBuf
, count
);
651 /***********************************************************************
652 * Saves system parameter to user profile.
655 /* Save data as-is */
656 static BOOL
SYSPARAMS_SaveRaw( LPCWSTR lpRegKey
, LPCWSTR lpValName
,
657 const BYTE
* lpValue
, DWORD valueSize
,
658 DWORD type
, UINT fWinIni
)
665 if (fWinIni
& SPIF_UPDATEINIFILE
)
667 hBaseKey
= HKEY_CURRENT_USER
;
672 hBaseKey
= get_volatile_regkey();
673 dwOptions
= REG_OPTION_VOLATILE
;
676 if (RegCreateKeyExW( hBaseKey
, lpRegKey
,
677 0, 0, dwOptions
, KEY_ALL_ACCESS
,
678 0, &hKey
, 0 ) == ERROR_SUCCESS
)
680 if (RegSetValueExW( hKey
, lpValName
, 0, type
,
681 lpValue
, valueSize
) == ERROR_SUCCESS
)
684 if (hBaseKey
== HKEY_CURRENT_USER
)
685 RegDeleteKeyW( get_volatile_regkey(), lpRegKey
);
692 /* Convenience function to save strings */
693 static BOOL
SYSPARAMS_Save( LPCWSTR lpRegKey
, LPCWSTR lpValName
, LPCWSTR lpValue
,
696 return SYSPARAMS_SaveRaw( lpRegKey
, lpValName
, (const BYTE
*)lpValue
,
697 (strlenW(lpValue
) + 1)*sizeof(WCHAR
), REG_SZ
, fWinIni
);
700 /* Convenience function to save logical fonts */
701 static BOOL
SYSPARAMS_SaveLogFont( LPCWSTR lpRegKey
, LPCWSTR lpValName
,
702 LPLOGFONTW plf
, UINT fWinIni
)
704 return SYSPARAMS_SaveRaw( lpRegKey
, lpValName
, (const BYTE
*)plf
,
705 sizeof( LOGFONTW
), REG_BINARY
, fWinIni
);
709 static inline HDC
get_display_dc(void)
711 static const WCHAR DISPLAY
[] = {'D','I','S','P','L','A','Y',0};
712 static HDC display_dc
;
715 display_dc
= CreateICW( DISPLAY
, NULL
, NULL
, NULL
);
716 __wine_make_gdi_object_system( display_dc
, TRUE
);
721 static inline int get_display_dpi(void)
723 static int display_dpi
;
724 if (!display_dpi
) display_dpi
= GetDeviceCaps( get_display_dc(), LOGPIXELSY
);
728 /***********************************************************************
729 * SYSPARAMS_Twips2Pixels
731 * Convert a dimension value that was obtained from the registry. These are
732 * quoted as being "twips" values if negative and pixels if positive.
733 * One inch is 1440 twips. So to convert, divide by 1440 to get inches and
734 * multiply that by the dots-per-inch to get the size in pixels.
736 * MSDN Library - April 2001 -> Resource Kits ->
737 * Windows 2000 Resource Kit Reference ->
738 * Technical Reference to the Windows 2000 Registry ->
739 * HKEY_CURRENT_USER -> Control Panel -> Desktop -> WindowMetrics
741 static inline int SYSPARAMS_Twips2Pixels(int x
)
744 x
= (-x
* get_display_dpi() + 720) / 1440;
748 /***********************************************************************
751 * Get a registry entry from the already open key. This allows us to open the
752 * section once and read several values.
754 * Of course this function belongs somewhere more usable but here will do
757 static int get_reg_metric( HKEY hkey
, LPCWSTR lpValName
, int default_value
)
759 int value
= default_value
;
763 DWORD type
, count
= sizeof(buffer
);
764 if(!RegQueryValueExW( hkey
, lpValName
, NULL
, &type
, (LPBYTE
)buffer
, &count
) )
768 /* Are there any utilities for converting registry entries
771 /* FIXME_(reg)("We need reg format converter\n"); */
774 value
= atoiW(buffer
);
777 return SYSPARAMS_Twips2Pixels(value
);
781 /*************************************************************************
782 * SYSPARAMS_SetSysColor
784 static void SYSPARAMS_SetSysColor( int index
, COLORREF color
)
786 if (index
< 0 || index
>= NUM_SYS_COLORS
) return;
787 SysColors
[index
] = color
;
788 if (SysColorBrushes
[index
])
790 __wine_make_gdi_object_system( SysColorBrushes
[index
], FALSE
);
791 DeleteObject( SysColorBrushes
[index
] );
793 SysColorBrushes
[index
] = CreateSolidBrush( color
);
794 __wine_make_gdi_object_system( SysColorBrushes
[index
], TRUE
);
796 if (SysColorPens
[index
])
798 __wine_make_gdi_object_system( SysColorPens
[index
], FALSE
);
799 DeleteObject( SysColorPens
[index
] );
801 SysColorPens
[index
] = CreatePen( PS_SOLID
, 1, color
);
802 __wine_make_gdi_object_system( SysColorPens
[index
], TRUE
);
805 /* load a uint parameter from the registry */
806 static BOOL
get_uint_param( unsigned int idx
, LPCWSTR regkey
, LPCWSTR value
,
807 UINT
*value_ptr
, UINT
*ret_ptr
)
809 if (!ret_ptr
) return FALSE
;
810 if (!spi_loaded
[idx
])
814 if (SYSPARAMS_Load( regkey
, value
, buf
, sizeof(buf
) )) *value_ptr
= atoiW( buf
);
815 spi_loaded
[idx
] = TRUE
;
817 *ret_ptr
= *value_ptr
;
821 /* load a twips parameter from the registry */
822 static BOOL
get_twips_param( unsigned int idx
, LPCWSTR regkey
, LPCWSTR value
,
823 UINT
*value_ptr
, UINT
*ret_ptr
)
825 if (!ret_ptr
) return FALSE
;
826 if (!spi_loaded
[idx
])
830 if (SYSPARAMS_Load( regkey
, value
, buf
, sizeof(buf
) ))
831 *value_ptr
= SYSPARAMS_Twips2Pixels( atoiW(buf
) );
832 spi_loaded
[idx
] = TRUE
;
834 *ret_ptr
= *value_ptr
;
838 /* load a boolean parameter from the registry */
839 static inline BOOL
get_bool_param( unsigned int idx
, LPCWSTR regkey
, LPCWSTR value
,
840 BOOL
*value_ptr
, BOOL
*ret_ptr
)
842 return get_uint_param( idx
, regkey
, value
, (UINT
*)value_ptr
, (UINT
*)ret_ptr
);
845 /* set a uint parameter that is mirrored in two different registry locations */
846 static BOOL
set_uint_param_mirrored( unsigned int idx
, LPCWSTR regkey
, LPCWSTR regkey_mirror
,
847 LPCWSTR value
, UINT
*value_ptr
, UINT new_val
, UINT fWinIni
)
851 wsprintfW(buf
, CSu
, new_val
);
852 if (!SYSPARAMS_Save( regkey
, value
, buf
, fWinIni
)) return FALSE
;
853 if (regkey_mirror
) SYSPARAMS_Save( regkey_mirror
, value
, buf
, fWinIni
);
854 *value_ptr
= new_val
;
855 spi_loaded
[idx
] = TRUE
;
859 /* save an int parameter in registry */
860 static BOOL
save_int_param( LPCWSTR regkey
, LPCWSTR value
, INT
*value_ptr
,
861 INT new_val
, UINT fWinIni
)
865 wsprintfW(buf
, CSd
, new_val
);
866 if (!SYSPARAMS_Save( regkey
, value
, buf
, fWinIni
)) return FALSE
;
867 if( value_ptr
) *value_ptr
= new_val
;
871 /* set an int parameter in the registry */
872 static inline BOOL
set_int_param( unsigned int idx
, LPCWSTR regkey
, LPCWSTR value
,
873 INT
*value_ptr
, INT new_val
, UINT fWinIni
)
875 BOOL ret
= save_int_param( regkey
, value
, value_ptr
, new_val
, fWinIni
);
876 if (ret
) spi_loaded
[idx
] = TRUE
;
880 /* set a uint parameter in the registry */
881 static inline BOOL
set_uint_param( unsigned int idx
, LPCWSTR regkey
, LPCWSTR value
,
882 UINT
*value_ptr
, UINT new_val
, UINT fWinIni
)
884 return set_uint_param_mirrored( idx
, regkey
, NULL
, value
, value_ptr
, new_val
, fWinIni
);
887 /* set a boolean parameter that is mirrored in two different registry locations */
888 static inline BOOL
set_bool_param_mirrored( unsigned int idx
, LPCWSTR regkey
, LPCWSTR regkey_mirror
,
889 LPCWSTR value
, BOOL
*value_ptr
, BOOL new_val
, UINT fWinIni
)
891 return set_uint_param_mirrored( idx
, regkey
, regkey_mirror
, value
,
892 (UINT
*)value_ptr
, new_val
, fWinIni
);
895 /* set a boolean parameter in the registry */
896 static inline BOOL
set_bool_param( unsigned int idx
, LPCWSTR regkey
, LPCWSTR value
,
897 BOOL
*value_ptr
, BOOL new_val
, UINT fWinIni
)
899 return set_uint_param( idx
, regkey
, value
, (UINT
*)value_ptr
, new_val
, fWinIni
);
902 /* load a boolean parameter from the user preference key */
903 static BOOL
get_user_pref_param( UINT offset
, UINT mask
, BOOL
*ret_ptr
)
905 if (!ret_ptr
) return FALSE
;
907 if (!spi_loaded
[SPI_USERPREFERENCEMASK_IDX
])
909 SYSPARAMS_LoadRaw( SPI_USERPREFERENCEMASK_REGKEY
,
910 SPI_USERPREFERENCEMASK_VALNAME
,
911 user_prefs
, sizeof(user_prefs
) );
912 spi_loaded
[SPI_USERPREFERENCEMASK_IDX
] = TRUE
;
914 *ret_ptr
= (user_prefs
[offset
] & mask
) != 0;
918 /* set a boolean parameter in the user preference key */
919 static BOOL
set_user_pref_param( UINT offset
, UINT mask
, BOOL value
, BOOL fWinIni
)
921 SYSPARAMS_LoadRaw( SPI_USERPREFERENCEMASK_REGKEY
,
922 SPI_USERPREFERENCEMASK_VALNAME
,
923 user_prefs
, sizeof(user_prefs
) );
924 spi_loaded
[SPI_USERPREFERENCEMASK_IDX
] = TRUE
;
926 if (value
) user_prefs
[offset
] |= mask
;
927 else user_prefs
[offset
] &= ~mask
;
929 SYSPARAMS_SaveRaw( SPI_USERPREFERENCEMASK_REGKEY
,
930 SPI_USERPREFERENCEMASK_VALNAME
,
931 user_prefs
, sizeof(user_prefs
), REG_BINARY
, fWinIni
);
935 /***********************************************************************
938 * Initialisation of the system metrics array.
940 void SYSPARAMS_Init(void)
942 HKEY hkey
; /* key to the window metrics area of the registry */
947 /* initialize system colors */
949 if (RegCreateKeyExA(HKEY_CURRENT_USER
, "Control Panel\\Colors", 0, 0, 0, KEY_ALL_ACCESS
, 0, &hkey
, 0))
951 for (i
= 0; i
< NUM_SYS_COLORS
; i
++)
955 /* first try, registry */
958 DWORD dwDataSize
= sizeof(buffer
);
959 if (!(RegQueryValueExA(hkey
,DefSysColors
[i
*2], 0, 0, (LPBYTE
) buffer
, &dwDataSize
)))
960 if (sscanf( buffer
, "%d %d %d", &r
, &g
, &b
) == 3) bOk
= TRUE
;
963 /* second try, win.ini */
966 GetProfileStringA( "colors", DefSysColors
[i
*2], DefSysColors
[i
*2+1], buffer
, 100 );
967 if (sscanf( buffer
, " %d %d %d", &r
, &g
, &b
) == 3) bOk
= TRUE
;
970 /* last chance, take the default */
973 int iNumColors
= sscanf( DefSysColors
[i
*2+1], " %d %d %d", &r
, &g
, &b
);
974 assert (iNumColors
==3);
977 SYSPARAMS_SetSysColor( i
, RGB(r
,g
,b
) );
979 if (hkey
) RegCloseKey( hkey
);
981 /* create 55AA bitmap */
983 h55AABitmap
= CreateBitmap( 8, 8, 1, 1, wPattern55AA
);
984 SYSCOLOR_55AABrush
= CreatePatternBrush( h55AABitmap
);
985 __wine_make_gdi_object_system( SYSCOLOR_55AABrush
, TRUE
);
989 /***********************************************************************
992 * Tries to retrieve logfont info from the specified key and value
994 static BOOL
reg_get_logfont(LPCWSTR key
, LPCWSTR value
, LOGFONTW
*lf
)
1003 base_keys
[0] = get_volatile_regkey();
1004 base_keys
[1] = HKEY_CURRENT_USER
;
1006 for(i
= 0; i
< 2 && !found
; i
++)
1008 if(RegOpenKeyW(base_keys
[i
], key
, &hkey
) == ERROR_SUCCESS
)
1010 size
= sizeof(lfbuf
);
1011 if(RegQueryValueExW(hkey
, value
, NULL
, &type
, (LPBYTE
)&lfbuf
, &size
) == ERROR_SUCCESS
&&
1014 if( size
== sizeof(lfbuf
))
1017 memcpy(lf
, &lfbuf
, size
);
1018 } else if( size
== sizeof( LOGFONT16
))
1019 { /* win9x-winME format */
1021 SYSPARAMS_LogFont16To32W( (LOGFONT16
*) &lfbuf
, lf
);
1023 WARN("Unknown format in key %s value %s, size is %d\n",
1024 debugstr_w( key
), debugstr_w( value
), size
);
1029 if( found
&& lf
->lfHeight
> 0) {
1030 /* positive height value means points ( inch/72 ) */
1031 lf
->lfHeight
= -MulDiv( lf
->lfHeight
, get_display_dpi(), 72);
1036 /* load all the minimized metrics */
1037 static void load_minimized_metrics(void)
1040 if (RegOpenKeyExW (HKEY_CURRENT_USER
, METRICS_REGKEY
,
1041 0, KEY_QUERY_VALUE
, &hkey
) != ERROR_SUCCESS
) hkey
= 0;
1043 minimized_metrics
.iWidth
= max( get_reg_metric(hkey
,
1044 METRICS_MINWIDTH_VALNAME
, minimized_metrics
.iWidth
), 0);
1045 minimized_metrics
.iHorzGap
= max( get_reg_metric(hkey
,
1046 METRICS_MINHORZGAP_VALNAME
, minimized_metrics
.iHorzGap
), 0);
1047 minimized_metrics
.iVertGap
= max( get_reg_metric(hkey
,
1048 METRICS_MINVERTGAP_VALNAME
, minimized_metrics
.iVertGap
), 0);
1049 minimized_metrics
.iArrange
= 0x0f & get_reg_metric(hkey
,
1050 METRICS_MINARRANGE_VALNAME
, minimized_metrics
.iArrange
);
1052 if (hkey
) RegCloseKey( hkey
);
1053 spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
] = TRUE
;
1056 /* adjust some of the raw values found in the registry */
1057 static void normalize_nonclientmetrics( NONCLIENTMETRICSW
*pncm
)
1060 if( pncm
->iBorderWidth
< 1) pncm
->iBorderWidth
= 1;
1061 if( pncm
->iCaptionWidth
< 8) pncm
->iCaptionWidth
= 8;
1062 if( pncm
->iScrollWidth
< 8) pncm
->iScrollWidth
= 8;
1063 if( pncm
->iScrollHeight
< 8) pncm
->iScrollHeight
= 8;
1065 /* get some extra metrics */
1066 get_text_metr_size( get_display_dc(), &pncm
->lfMenuFont
,
1068 get_text_metr_size( get_display_dc(), &pncm
->lfCaptionFont
,
1069 NULL
, &CaptionFontAvCharWidth
);
1071 /* adjust some heights to the corresponding font */
1072 pncm
->iMenuHeight
= max( pncm
->iMenuHeight
,
1073 2 + tmMenuFont
.tmHeight
+ tmMenuFont
.tmExternalLeading
);
1074 get_text_metr_size( get_display_dc(), &pncm
->lfCaptionFont
, &tm
, NULL
);
1075 pncm
->iCaptionHeight
= max( pncm
->iCaptionHeight
, 2 + tm
.tmHeight
);
1076 get_text_metr_size( get_display_dc(), &pncm
->lfSmCaptionFont
, &tm
, NULL
);
1077 pncm
->iSmCaptionHeight
= max( pncm
->iSmCaptionHeight
, 2 + tm
.tmHeight
);
1080 /* load all the non-client metrics */
1081 static void load_nonclient_metrics(void)
1084 NONCLIENTMETRICSW ncm
;
1087 ncm
.cbSize
= sizeof (ncm
);
1088 if (RegOpenKeyExW (HKEY_CURRENT_USER
, METRICS_REGKEY
,
1089 0, KEY_QUERY_VALUE
, &hkey
) != ERROR_SUCCESS
) hkey
= 0;
1091 /* initialize geometry entries */
1092 ncm
.iBorderWidth
= get_reg_metric(hkey
, METRICS_BORDERWIDTH_VALNAME
, 1);
1093 ncm
.iScrollWidth
= get_reg_metric(hkey
, METRICS_SCROLLWIDTH_VALNAME
, 16);
1094 ncm
.iScrollHeight
= get_reg_metric(hkey
, METRICS_SCROLLHEIGHT_VALNAME
, 16);
1096 /* size of the normal caption buttons */
1097 ncm
.iCaptionHeight
= get_reg_metric(hkey
, METRICS_CAPTIONHEIGHT_VALNAME
, 18);
1098 ncm
.iCaptionWidth
= get_reg_metric(hkey
, METRICS_CAPTIONWIDTH_VALNAME
, ncm
.iCaptionHeight
);
1100 /* caption font metrics */
1101 if (!reg_get_logfont(METRICS_REGKEY
, METRICS_CAPTIONLOGFONT_VALNAME
, &ncm
.lfCaptionFont
))
1103 SystemParametersInfoW( SPI_GETICONTITLELOGFONT
, 0, &ncm
.lfCaptionFont
, 0 );
1104 ncm
.lfCaptionFont
.lfWeight
= FW_BOLD
;
1107 /* size of the small caption buttons */
1108 ncm
.iSmCaptionWidth
= get_reg_metric(hkey
, METRICS_SMCAPTIONWIDTH_VALNAME
, 13);
1109 ncm
.iSmCaptionHeight
= get_reg_metric(hkey
, METRICS_SMCAPTIONHEIGHT_VALNAME
, 15);
1111 /* small caption font metrics */
1112 if (!reg_get_logfont(METRICS_REGKEY
, METRICS_SMCAPTIONLOGFONT_VALNAME
, &ncm
.lfSmCaptionFont
))
1113 SystemParametersInfoW( SPI_GETICONTITLELOGFONT
, 0, &ncm
.lfSmCaptionFont
, 0 );
1115 /* menus, FIXME: names of wine.conf entries are bogus */
1117 /* size of the menu (MDI) buttons */
1118 ncm
.iMenuHeight
= get_reg_metric(hkey
, METRICS_MENUHEIGHT_VALNAME
, 18);
1119 ncm
.iMenuWidth
= get_reg_metric(hkey
, METRICS_MENUWIDTH_VALNAME
, ncm
.iMenuHeight
);
1121 /* menu font metrics */
1122 if (!reg_get_logfont(METRICS_REGKEY
, METRICS_MENULOGFONT_VALNAME
, &ncm
.lfMenuFont
))
1124 SystemParametersInfoW( SPI_GETICONTITLELOGFONT
, 0, &ncm
.lfMenuFont
, 0 );
1125 GetProfileStringW( Desktop
, MenuFont
, ncm
.lfCaptionFont
.lfFaceName
,
1126 ncm
.lfMenuFont
.lfFaceName
, LF_FACESIZE
);
1127 r
= GetProfileIntW( Desktop
, MenuFontSize
, 0 );
1129 ncm
.lfMenuFont
.lfHeight
= -r
;
1130 ncm
.lfMenuFont
.lfWeight
= FW_NORMAL
;
1133 /* status bar font metrics */
1134 if (!reg_get_logfont(METRICS_REGKEY
, METRICS_STATUSLOGFONT_VALNAME
, &ncm
.lfStatusFont
))
1136 SystemParametersInfoW( SPI_GETICONTITLELOGFONT
, 0, &ncm
.lfStatusFont
, 0 );
1137 GetProfileStringW( Desktop
, StatusFont
, ncm
.lfCaptionFont
.lfFaceName
,
1138 ncm
.lfStatusFont
.lfFaceName
, LF_FACESIZE
);
1139 r
= GetProfileIntW( Desktop
, StatusFontSize
, 0 );
1141 ncm
.lfStatusFont
.lfHeight
= -r
;
1142 ncm
.lfStatusFont
.lfWeight
= FW_NORMAL
;
1145 /* message font metrics */
1146 if (!reg_get_logfont(METRICS_REGKEY
, METRICS_MESSAGELOGFONT_VALNAME
, &ncm
.lfMessageFont
))
1148 SystemParametersInfoW( SPI_GETICONTITLELOGFONT
, 0, &ncm
.lfMessageFont
, 0 );
1149 GetProfileStringW( Desktop
, MessageFont
, ncm
.lfCaptionFont
.lfFaceName
,
1150 ncm
.lfMessageFont
.lfFaceName
, LF_FACESIZE
);
1151 r
= GetProfileIntW( Desktop
, MessageFontSize
, 0 );
1153 ncm
.lfMessageFont
.lfHeight
= -r
;
1154 ncm
.lfMessageFont
.lfWeight
= FW_NORMAL
;
1157 /* some extra fields not in the nonclient structure */
1158 icon_size
.cx
= icon_size
.cy
= get_reg_metric( hkey
, METRICS_ICONSIZE_VALNAME
, 32 );
1160 if (hkey
) RegCloseKey( hkey
);
1161 normalize_nonclientmetrics( &ncm
);
1162 nonclient_metrics
= ncm
;
1163 spi_loaded
[SPI_NONCLIENTMETRICS_IDX
] = TRUE
;
1166 static BOOL CALLBACK
enum_monitors( HMONITOR monitor
, HDC hdc
, LPRECT rect
, LPARAM lp
)
1170 mi
.cbSize
= sizeof(mi
);
1171 if (GetMonitorInfoW( monitor
, &mi
) && (mi
.dwFlags
& MONITORINFOF_PRIMARY
))
1173 LPRECT work
= (LPRECT
)lp
;
1180 /***********************************************************************
1181 * SystemParametersInfoW (USER32.@)
1183 * Each system parameter has flag which shows whether the parameter
1184 * is loaded or not. Parameters, stored directly in SysParametersInfo are
1185 * loaded from registry only when they are requested and the flag is
1186 * "false", after the loading the flag is set to "true". On interprocess
1187 * notification of the parameter change the corresponding parameter flag is
1188 * set to "false". The parameter value will be reloaded when it is requested
1190 * Parameters, backed by or depend on GetSystemMetrics are processed
1191 * differently. These parameters are always loaded. They are reloaded right
1192 * away on interprocess change notification. We can't do lazy loading because
1193 * we don't want to complicate GetSystemMetrics.
1194 * Parameters, backed by X settings are read from corresponding setting.
1195 * On the parameter change request the setting is changed. Interprocess change
1196 * notifications are ignored.
1197 * When parameter value is updated the changed value is stored in permanent
1198 * registry branch if saving is requested. Otherwise it is stored
1199 * in temporary branch
1201 * Some SPI values can also be stored as Twips values in the registry,
1202 * don't forget the conversion!
1204 BOOL WINAPI
SystemParametersInfoW( UINT uiAction
, UINT uiParam
,
1205 PVOID pvParam
, UINT fWinIni
)
1207 #define WINE_SPI_FIXME(x) \
1210 static BOOL warn = TRUE; \
1214 FIXME( "Unimplemented action: %u (%s)\n", x, #x ); \
1217 SetLastError( ERROR_INVALID_SPI_VALUE ); \
1220 #define WINE_SPI_WARN(x) \
1222 WARN( "Ignored action: %u (%s)\n", x, #x ); \
1226 unsigned spi_idx
= 0;
1230 case SPI_GETBEEP
: /* 1 */
1231 if (!pvParam
) return FALSE
;
1233 spi_idx
= SPI_SETBEEP_IDX
;
1234 if (!spi_loaded
[spi_idx
])
1238 if (SYSPARAMS_Load( SPI_SETBEEP_REGKEY
, SPI_SETBEEP_VALNAME
, buf
, sizeof(buf
) ))
1239 beep_active
= !lstrcmpiW( Yes
, buf
);
1240 spi_loaded
[spi_idx
] = TRUE
;
1243 *(BOOL
*)pvParam
= beep_active
;
1246 case SPI_SETBEEP
: /* 2 */
1247 spi_idx
= SPI_SETBEEP_IDX
;
1248 if (SYSPARAMS_Save( SPI_SETBEEP_REGKEY
, SPI_SETBEEP_VALNAME
,
1249 (uiParam
? Yes
: No
), fWinIni
))
1251 beep_active
= uiParam
;
1252 spi_loaded
[spi_idx
] = TRUE
;
1258 case SPI_GETMOUSE
: /* 3 */
1259 if (!pvParam
) return FALSE
;
1261 spi_idx
= SPI_SETMOUSE_IDX
;
1262 if (!spi_loaded
[spi_idx
])
1266 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY
, SPI_SETMOUSE_VALNAME1
,
1268 mouse_threshold1
= atoiW( buf
);
1269 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY
, SPI_SETMOUSE_VALNAME2
,
1271 mouse_threshold2
= atoiW( buf
);
1272 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY
, SPI_SETMOUSE_VALNAME3
,
1274 mouse_speed
= atoiW( buf
);
1275 spi_loaded
[spi_idx
] = TRUE
;
1277 ((INT
*)pvParam
)[0] = mouse_threshold1
;
1278 ((INT
*)pvParam
)[1] = mouse_threshold2
;
1279 ((INT
*)pvParam
)[2] = mouse_speed
;
1282 case SPI_SETMOUSE
: /* 4 */
1284 if (!pvParam
) return FALSE
;
1285 ret
= set_int_param( SPI_SETMOUSE_IDX
, SPI_SETMOUSE_REGKEY
, SPI_SETMOUSE_VALNAME1
,
1286 &mouse_threshold1
, ((INT
*)pvParam
)[0], fWinIni
);
1288 save_int_param( SPI_SETMOUSE_REGKEY
, SPI_SETMOUSE_VALNAME2
,
1289 &mouse_threshold2
, ((INT
*)pvParam
)[1], fWinIni
);
1290 save_int_param( SPI_SETMOUSE_REGKEY
, SPI_SETMOUSE_VALNAME3
,
1291 &mouse_speed
, ((INT
*)pvParam
)[2], fWinIni
);
1297 ret
= get_twips_param( SPI_SETBORDER_IDX
,
1298 SPI_SETBORDER_REGKEY
,
1299 SPI_SETBORDER_VALNAME
,
1301 if( *(INT
*)pvParam
< 1) *(INT
*)pvParam
= 1;
1305 nonclient_metrics
.iBorderWidth
= uiParam
> 0 ? uiParam
: 1;
1306 /* raw value goes to registry */
1307 ret
= set_uint_param( SPI_SETBORDER_IDX
,
1308 SPI_SETBORDER_REGKEY
,
1309 SPI_SETBORDER_VALNAME
,
1310 &border
, uiParam
, fWinIni
);
1313 case SPI_GETKEYBOARDSPEED
:
1314 ret
= get_uint_param( SPI_SETKEYBOARDSPEED_IDX
,
1315 SPI_SETKEYBOARDSPEED_REGKEY
,
1316 SPI_SETKEYBOARDSPEED_VALNAME
,
1317 &keyboard_speed
, pvParam
);
1320 case SPI_SETKEYBOARDSPEED
:
1321 if (uiParam
> 31) uiParam
= 31;
1322 ret
= set_uint_param( SPI_SETKEYBOARDSPEED_IDX
,
1323 SPI_SETKEYBOARDSPEED_REGKEY
,
1324 SPI_SETKEYBOARDSPEED_VALNAME
,
1325 &keyboard_speed
, uiParam
, fWinIni
);
1328 /* not implemented in Windows */
1329 WINE_SPI_WARN(SPI_LANGDRIVER
); /* 12 */
1331 case SPI_ICONHORIZONTALSPACING
:
1332 if (pvParam
!= NULL
)
1334 ret
= get_twips_param( SPI_ICONHORIZONTALSPACING_IDX
,
1335 SPI_ICONHORIZONTALSPACING_REGKEY
,
1336 SPI_ICONHORIZONTALSPACING_VALNAME
,
1337 (UINT
*)&icon_metrics
.iHorzSpacing
, pvParam
);
1341 if (uiParam
< 32) uiParam
= 32;
1342 ret
= set_uint_param( SPI_ICONHORIZONTALSPACING_IDX
,
1343 SPI_ICONHORIZONTALSPACING_REGKEY
,
1344 SPI_ICONHORIZONTALSPACING_VALNAME
,
1345 (UINT
*)&icon_metrics
.iHorzSpacing
, uiParam
, fWinIni
);
1349 case SPI_GETSCREENSAVETIMEOUT
:
1350 ret
= get_uint_param( SPI_SETSCREENSAVETIMEOUT_IDX
,
1351 SPI_SETSCREENSAVETIMEOUT_REGKEY
,
1352 SPI_SETSCREENSAVETIMEOUT_VALNAME
,
1353 &screensave_timeout
, pvParam
);
1356 case SPI_SETSCREENSAVETIMEOUT
:
1357 ret
= set_uint_param( SPI_SETSCREENSAVETIMEOUT_IDX
,
1358 SPI_SETSCREENSAVETIMEOUT_REGKEY
,
1359 SPI_SETSCREENSAVETIMEOUT_VALNAME
,
1360 &screensave_timeout
, uiParam
, fWinIni
);
1363 case SPI_GETSCREENSAVEACTIVE
: /* 16 */
1364 if (!pvParam
) return FALSE
;
1365 *(BOOL
*)pvParam
= USER_Driver
->pGetScreenSaveActive();
1368 case SPI_SETSCREENSAVEACTIVE
: /* 17 */
1372 wsprintfW(buf
, CSu
, uiParam
);
1373 USER_Driver
->pSetScreenSaveActive( uiParam
);
1374 /* saved value does not affect Wine */
1375 SYSPARAMS_Save( SPI_SETSCREENSAVEACTIVE_REGKEY
,
1376 SPI_SETSCREENSAVEACTIVE_VALNAME
,
1381 case SPI_GETGRIDGRANULARITY
:
1382 ret
= get_uint_param( SPI_SETGRIDGRANULARITY_IDX
,
1383 SPI_SETGRIDGRANULARITY_REGKEY
,
1384 SPI_SETGRIDGRANULARITY_VALNAME
,
1385 &grid_granularity
, pvParam
);
1388 case SPI_SETGRIDGRANULARITY
:
1389 ret
= set_uint_param( SPI_SETGRIDGRANULARITY_IDX
,
1390 SPI_SETGRIDGRANULARITY_REGKEY
,
1391 SPI_SETGRIDGRANULARITY_VALNAME
,
1392 &grid_granularity
, uiParam
, fWinIni
);
1395 case SPI_SETDESKWALLPAPER
: /* 20 */
1396 if (!pvParam
|| !SetDeskWallPaper( pvParam
)) return FALSE
;
1397 SYSPARAMS_Save(SPI_SETDESKWALLPAPER_REGKEY
, SPI_SETDESKWALLPAPER_VALNAME
, pvParam
, fWinIni
);
1400 case SPI_SETDESKPATTERN
: /* 21 */
1401 /* FIXME: the ability to specify a pattern in pvParam
1402 doesn't seem to be documented for Win32 */
1403 if ((INT16
)uiParam
== -1)
1406 GetProfileStringW( Desktop
, Pattern
,
1408 buf
, sizeof(buf
)/sizeof(WCHAR
) );
1409 ret
= DESKTOP_SetPattern( buf
);
1411 ret
= DESKTOP_SetPattern( pvParam
);
1414 case SPI_GETKEYBOARDDELAY
:
1415 ret
= get_uint_param( SPI_SETKEYBOARDDELAY_IDX
,
1416 SPI_SETKEYBOARDDELAY_REGKEY
,
1417 SPI_SETKEYBOARDDELAY_VALNAME
,
1418 &keyboard_delay
, pvParam
);
1421 case SPI_SETKEYBOARDDELAY
:
1422 ret
= set_uint_param( SPI_SETKEYBOARDDELAY_IDX
,
1423 SPI_SETKEYBOARDDELAY_REGKEY
,
1424 SPI_SETKEYBOARDDELAY_VALNAME
,
1425 &keyboard_delay
, uiParam
, fWinIni
);
1428 case SPI_ICONVERTICALSPACING
:
1429 if (pvParam
!= NULL
)
1431 ret
= get_twips_param( SPI_ICONVERTICALSPACING_IDX
,
1432 SPI_ICONVERTICALSPACING_REGKEY
,
1433 SPI_ICONVERTICALSPACING_VALNAME
,
1434 (UINT
*)&icon_metrics
.iVertSpacing
, pvParam
);
1435 if( icon_metrics
.iVertSpacing
< 32)
1436 icon_metrics
.iVertSpacing
= 32;
1440 if (uiParam
< 32) uiParam
= 32;
1441 ret
= set_uint_param( SPI_ICONVERTICALSPACING_IDX
,
1442 SPI_ICONVERTICALSPACING_REGKEY
,
1443 SPI_ICONVERTICALSPACING_VALNAME
,
1444 (UINT
*)&icon_metrics
.iVertSpacing
, uiParam
, fWinIni
);
1448 case SPI_GETICONTITLEWRAP
:
1449 ret
= get_bool_param( SPI_SETICONTITLEWRAP_IDX
,
1450 SPI_SETICONTITLEWRAP_REGKEY1
,
1451 SPI_SETICONTITLEWRAP_VALNAME
,
1452 &icon_metrics
.iTitleWrap
, pvParam
);
1455 case SPI_SETICONTITLEWRAP
:
1456 ret
= set_bool_param_mirrored( SPI_SETICONTITLEWRAP_IDX
,
1457 SPI_SETICONTITLEWRAP_REGKEY1
,
1458 SPI_SETICONTITLEWRAP_REGKEY2
,
1459 SPI_SETICONTITLEWRAP_VALNAME
,
1460 &icon_metrics
.iTitleWrap
, uiParam
, fWinIni
);
1463 case SPI_GETMENUDROPALIGNMENT
:
1464 ret
= get_uint_param( SPI_SETMENUDROPALIGNMENT_IDX
,
1465 SPI_SETMENUDROPALIGNMENT_REGKEY1
,
1466 SPI_SETMENUDROPALIGNMENT_VALNAME
,
1467 &menu_drop_alignment
, pvParam
);
1470 case SPI_SETMENUDROPALIGNMENT
:
1471 ret
= set_uint_param_mirrored( SPI_SETMENUDROPALIGNMENT_IDX
,
1472 SPI_SETMENUDROPALIGNMENT_REGKEY1
,
1473 SPI_SETMENUDROPALIGNMENT_REGKEY2
,
1474 SPI_SETMENUDROPALIGNMENT_VALNAME
,
1475 &menu_drop_alignment
, uiParam
, fWinIni
);
1478 case SPI_SETDOUBLECLKWIDTH
:
1479 ret
= set_uint_param_mirrored( SPI_SETDOUBLECLKWIDTH_IDX
,
1480 SPI_SETDOUBLECLKWIDTH_REGKEY1
,
1481 SPI_SETDOUBLECLKWIDTH_REGKEY2
,
1482 SPI_SETDOUBLECLKWIDTH_VALNAME
,
1483 &double_click_width
, uiParam
, fWinIni
);
1486 case SPI_SETDOUBLECLKHEIGHT
:
1487 ret
= set_uint_param_mirrored( SPI_SETDOUBLECLKHEIGHT_IDX
,
1488 SPI_SETDOUBLECLKHEIGHT_REGKEY1
,
1489 SPI_SETDOUBLECLKHEIGHT_REGKEY2
,
1490 SPI_SETDOUBLECLKHEIGHT_VALNAME
,
1491 &double_click_height
, uiParam
, fWinIni
);
1494 case SPI_GETICONTITLELOGFONT
:
1498 if (!pvParam
) return FALSE
;
1500 spi_idx
= SPI_SETICONTITLELOGFONT_IDX
;
1501 if (!spi_loaded
[spi_idx
])
1503 if (!reg_get_logfont( SPI_SETICONTITLELOGFONT_REGKEY
,
1504 SPI_SETICONTITLELOGFONT_VALNAME
, &icon_metrics
.lfFont
))
1509 * The 'default GDI fonts' seems to be returned.
1510 * If a returned font is not a correct font in your environment,
1511 * please try to fix objects/gdiobj.c at first.
1513 GetObjectW( GetStockObject( DEFAULT_GUI_FONT
), sizeof(LOGFONTW
), &lfDefault
);
1515 GetProfileStringW( Desktop
, IconTitleFaceName
,
1516 lfDefault
.lfFaceName
,
1517 icon_metrics
.lfFont
.lfFaceName
,
1520 r
= GetProfileIntW( Desktop
, IconTitleSize
, 0 );
1522 icon_metrics
.lfFont
.lfHeight
= -r
;
1524 icon_metrics
.lfFont
.lfHeight
= lfDefault
.lfHeight
;
1526 icon_metrics
.lfFont
.lfWidth
= 0;
1527 icon_metrics
.lfFont
.lfEscapement
= icon_metrics
.lfFont
.lfOrientation
= 0;
1528 icon_metrics
.lfFont
.lfWeight
= FW_NORMAL
;
1529 icon_metrics
.lfFont
.lfItalic
= FALSE
;
1530 icon_metrics
.lfFont
.lfStrikeOut
= FALSE
;
1531 icon_metrics
.lfFont
.lfUnderline
= FALSE
;
1532 icon_metrics
.lfFont
.lfCharSet
= lfDefault
.lfCharSet
; /* at least 'charset' should not be hard-coded */
1533 icon_metrics
.lfFont
.lfOutPrecision
= OUT_DEFAULT_PRECIS
;
1534 icon_metrics
.lfFont
.lfClipPrecision
= CLIP_DEFAULT_PRECIS
;
1535 icon_metrics
.lfFont
.lfQuality
= DEFAULT_QUALITY
;
1536 icon_metrics
.lfFont
.lfPitchAndFamily
= DEFAULT_PITCH
;
1537 spi_loaded
[spi_idx
] = TRUE
;
1540 *(LOGFONTW
*)pvParam
= icon_metrics
.lfFont
;
1544 case SPI_SETDOUBLECLICKTIME
:
1545 ret
= set_uint_param( SPI_SETDOUBLECLICKTIME_IDX
,
1546 SPI_SETDOUBLECLICKTIME_REGKEY
,
1547 SPI_SETDOUBLECLICKTIME_VALNAME
,
1548 &double_click_time
, uiParam
, fWinIni
);
1551 case SPI_SETMOUSEBUTTONSWAP
:
1552 ret
= set_bool_param( SPI_SETMOUSEBUTTONSWAP_IDX
,
1553 SPI_SETMOUSEBUTTONSWAP_REGKEY
,
1554 SPI_SETMOUSEBUTTONSWAP_VALNAME
,
1555 &swap_buttons
, uiParam
, fWinIni
);
1558 case SPI_SETICONTITLELOGFONT
: /* 34 */
1559 if( uiParam
== sizeof(LOGFONTW
)) {
1560 ret
= SYSPARAMS_SaveLogFont( SPI_SETICONTITLELOGFONT_REGKEY
,
1561 SPI_SETICONTITLELOGFONT_VALNAME
, pvParam
, fWinIni
);
1563 icon_metrics
.lfFont
= *(LOGFONTW
*)pvParam
;
1564 spi_loaded
[SPI_SETICONTITLELOGFONT_IDX
] = TRUE
;
1570 case SPI_GETFASTTASKSWITCH
: /* 35 */
1571 if (!pvParam
) return FALSE
;
1572 *(BOOL
*)pvParam
= 1;
1575 case SPI_SETFASTTASKSWITCH
: /* 36 */
1576 /* the action is disabled */
1580 case SPI_SETDRAGFULLWINDOWS
:
1581 ret
= set_bool_param( SPI_SETDRAGFULLWINDOWS_IDX
,
1582 SPI_SETDRAGFULLWINDOWS_REGKEY
,
1583 SPI_SETDRAGFULLWINDOWS_VALNAME
,
1584 &drag_full_windows
, uiParam
, fWinIni
);
1587 case SPI_GETDRAGFULLWINDOWS
:
1588 ret
= get_bool_param( SPI_SETDRAGFULLWINDOWS_IDX
,
1589 SPI_SETDRAGFULLWINDOWS_REGKEY
,
1590 SPI_SETDRAGFULLWINDOWS_VALNAME
,
1591 &drag_full_windows
, pvParam
);
1594 case SPI_GETNONCLIENTMETRICS
:
1596 LPNONCLIENTMETRICSW lpnm
= pvParam
;
1598 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
1600 if (lpnm
&& lpnm
->cbSize
== sizeof(NONCLIENTMETRICSW
))
1601 *lpnm
= nonclient_metrics
;
1607 case SPI_SETNONCLIENTMETRICS
:
1609 LPNONCLIENTMETRICSW lpnm
= pvParam
;
1611 if (lpnm
&& lpnm
->cbSize
== sizeof(NONCLIENTMETRICSW
))
1613 NONCLIENTMETRICSW ncm
;
1614 ret
= set_uint_param( SPI_SETBORDER_IDX
,
1615 SPI_SETBORDER_REGKEY
, SPI_SETBORDER_VALNAME
,
1616 &border
, lpnm
->iBorderWidth
, fWinIni
);
1617 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1618 METRICS_SCROLLWIDTH_VALNAME
, NULL
,
1619 lpnm
->iScrollWidth
, fWinIni
);
1620 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1621 METRICS_SCROLLHEIGHT_VALNAME
, NULL
,
1622 lpnm
->iScrollHeight
, fWinIni
);
1623 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1624 METRICS_CAPTIONWIDTH_VALNAME
, NULL
,
1625 lpnm
->iCaptionWidth
, fWinIni
);
1626 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1627 METRICS_CAPTIONHEIGHT_VALNAME
, NULL
,
1628 lpnm
->iCaptionHeight
, fWinIni
);
1629 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1630 METRICS_SMCAPTIONWIDTH_VALNAME
, NULL
,
1631 lpnm
->iSmCaptionWidth
, fWinIni
);
1632 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1633 METRICS_SMCAPTIONHEIGHT_VALNAME
, NULL
,
1634 lpnm
->iSmCaptionHeight
, fWinIni
);
1635 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1636 METRICS_MENUWIDTH_VALNAME
, NULL
,
1637 lpnm
->iMenuWidth
, fWinIni
);
1638 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1639 METRICS_MENUHEIGHT_VALNAME
, NULL
,
1640 lpnm
->iMenuHeight
, fWinIni
);
1641 if( ret
) ret
= SYSPARAMS_SaveLogFont(
1642 METRICS_REGKEY
, METRICS_MENULOGFONT_VALNAME
,
1643 &lpnm
->lfMenuFont
, fWinIni
);
1644 if( ret
) ret
= SYSPARAMS_SaveLogFont(
1645 METRICS_REGKEY
, METRICS_CAPTIONLOGFONT_VALNAME
,
1646 &lpnm
->lfCaptionFont
, fWinIni
);
1647 if( ret
) ret
= SYSPARAMS_SaveLogFont(
1648 METRICS_REGKEY
, METRICS_SMCAPTIONLOGFONT_VALNAME
,
1649 &lpnm
->lfSmCaptionFont
, fWinIni
);
1650 if( ret
) ret
= SYSPARAMS_SaveLogFont(
1651 METRICS_REGKEY
, METRICS_STATUSLOGFONT_VALNAME
,
1652 &lpnm
->lfStatusFont
, fWinIni
);
1653 if( ret
) ret
= SYSPARAMS_SaveLogFont(
1654 METRICS_REGKEY
, METRICS_MESSAGELOGFONT_VALNAME
,
1655 &lpnm
->lfMessageFont
, fWinIni
);
1658 normalize_nonclientmetrics( &ncm
);
1659 nonclient_metrics
= ncm
;
1660 spi_loaded
[SPI_NONCLIENTMETRICS_IDX
] = TRUE
;
1666 case SPI_GETMINIMIZEDMETRICS
:
1668 MINIMIZEDMETRICS
* lpMm
= pvParam
;
1669 if (lpMm
&& lpMm
->cbSize
== sizeof(*lpMm
)) {
1670 if( spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
]) load_minimized_metrics();
1671 *lpMm
= minimized_metrics
;
1677 case SPI_SETMINIMIZEDMETRICS
:
1679 MINIMIZEDMETRICS
* lpMm
= pvParam
;
1680 if (lpMm
&& lpMm
->cbSize
== sizeof(*lpMm
)) {
1681 ret
= save_int_param( METRICS_REGKEY
, METRICS_MINWIDTH_VALNAME
,
1682 &minimized_metrics
.iWidth
, max( lpMm
->iWidth
, 0), fWinIni
);
1683 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1684 METRICS_MINHORZGAP_VALNAME
, &minimized_metrics
.iHorzGap
,
1685 max( lpMm
->iHorzGap
, 0), fWinIni
);
1686 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1687 METRICS_MINVERTGAP_VALNAME
, &minimized_metrics
.iVertGap
,
1688 max( lpMm
->iVertGap
, 0), fWinIni
);
1689 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1690 METRICS_MINARRANGE_VALNAME
, &minimized_metrics
.iArrange
,
1691 0x0f & lpMm
->iArrange
, fWinIni
);
1692 if( ret
) spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
] = TRUE
;
1698 case SPI_GETICONMETRICS
:
1700 LPICONMETRICSW lpIcon
= pvParam
;
1701 if(lpIcon
&& lpIcon
->cbSize
== sizeof(*lpIcon
))
1703 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING
, 0,
1704 &lpIcon
->iHorzSpacing
, FALSE
);
1705 SystemParametersInfoW( SPI_ICONVERTICALSPACING
, 0,
1706 &lpIcon
->iVertSpacing
, FALSE
);
1707 SystemParametersInfoW( SPI_GETICONTITLEWRAP
, 0,
1708 &lpIcon
->iTitleWrap
, FALSE
);
1709 SystemParametersInfoW( SPI_GETICONTITLELOGFONT
, 0,
1710 &lpIcon
->lfFont
, FALSE
);
1719 case SPI_SETICONMETRICS
:
1721 LPICONMETRICSW lpIcon
= pvParam
;
1722 if (lpIcon
&& lpIcon
->cbSize
== sizeof(*lpIcon
)) {
1723 ret
= set_int_param( SPI_ICONVERTICALSPACING_IDX
,
1724 SPI_ICONVERTICALSPACING_REGKEY
,
1725 SPI_ICONVERTICALSPACING_VALNAME
,
1726 &icon_metrics
.iVertSpacing
,
1727 lpIcon
->iVertSpacing
, fWinIni
);
1729 ret
= set_int_param( SPI_ICONHORIZONTALSPACING_IDX
,
1730 SPI_ICONHORIZONTALSPACING_REGKEY
,
1731 SPI_ICONHORIZONTALSPACING_VALNAME
,
1732 &icon_metrics
.iHorzSpacing
,
1733 lpIcon
->iHorzSpacing
, fWinIni
);
1736 ret
= set_bool_param_mirrored( SPI_SETICONTITLEWRAP_IDX
,
1737 SPI_SETICONTITLEWRAP_REGKEY1
, SPI_SETICONTITLEWRAP_REGKEY2
,
1738 SPI_SETICONTITLEWRAP_VALNAME
, &icon_metrics
.iTitleWrap
,
1739 lpIcon
->iTitleWrap
, fWinIni
);
1741 if( ret
) ret
= SYSPARAMS_SaveLogFont( SPI_SETICONTITLELOGFONT_REGKEY
,
1742 SPI_SETICONTITLELOGFONT_VALNAME
, &lpIcon
->lfFont
, fWinIni
);
1744 icon_metrics
.lfFont
= lpIcon
->lfFont
;
1745 spi_loaded
[SPI_SETICONTITLELOGFONT_IDX
] = TRUE
;
1752 case SPI_SETWORKAREA
: /* 47 WINVER >= 0x400 */
1754 if (!pvParam
) return FALSE
;
1756 spi_idx
= SPI_SETWORKAREA_IDX
;
1757 CopyRect( &work_area
, pvParam
);
1758 spi_loaded
[spi_idx
] = TRUE
;
1762 case SPI_GETWORKAREA
: /* 48 WINVER >= 0x400 */
1764 if (!pvParam
) return FALSE
;
1766 spi_idx
= SPI_SETWORKAREA_IDX
;
1767 if (!spi_loaded
[spi_idx
])
1769 SetRect( &work_area
, 0, 0,
1770 GetSystemMetrics( SM_CXSCREEN
),
1771 GetSystemMetrics( SM_CYSCREEN
) );
1772 EnumDisplayMonitors( 0, NULL
, enum_monitors
, (LPARAM
)&work_area
);
1773 spi_loaded
[spi_idx
] = TRUE
;
1775 CopyRect( pvParam
, &work_area
);
1776 TRACE("work area %s\n", wine_dbgstr_rect( &work_area
));
1780 WINE_SPI_FIXME(SPI_SETPENWINDOWS
); /* 49 WINVER >= 0x400 */
1782 case SPI_GETFILTERKEYS
: /* 50 */
1784 LPFILTERKEYS lpFilterKeys
= pvParam
;
1785 WARN("SPI_GETFILTERKEYS not fully implemented\n");
1786 if (lpFilterKeys
&& lpFilterKeys
->cbSize
== sizeof(FILTERKEYS
))
1788 /* Indicate that no FilterKeys feature available */
1789 lpFilterKeys
->dwFlags
= 0;
1790 lpFilterKeys
->iWaitMSec
= 0;
1791 lpFilterKeys
->iDelayMSec
= 0;
1792 lpFilterKeys
->iRepeatMSec
= 0;
1793 lpFilterKeys
->iBounceMSec
= 0;
1801 WINE_SPI_FIXME(SPI_SETFILTERKEYS
); /* 51 */
1803 case SPI_GETTOGGLEKEYS
: /* 52 */
1805 LPTOGGLEKEYS lpToggleKeys
= pvParam
;
1806 WARN("SPI_GETTOGGLEKEYS not fully implemented\n");
1807 if (lpToggleKeys
&& lpToggleKeys
->cbSize
== sizeof(TOGGLEKEYS
))
1809 /* Indicate that no ToggleKeys feature available */
1810 lpToggleKeys
->dwFlags
= 0;
1818 WINE_SPI_FIXME(SPI_SETTOGGLEKEYS
); /* 53 */
1820 case SPI_GETMOUSEKEYS
: /* 54 */
1822 LPMOUSEKEYS lpMouseKeys
= pvParam
;
1823 WARN("SPI_GETMOUSEKEYS not fully implemented\n");
1824 if (lpMouseKeys
&& lpMouseKeys
->cbSize
== sizeof(MOUSEKEYS
))
1826 /* Indicate that no MouseKeys feature available */
1827 lpMouseKeys
->dwFlags
= 0;
1828 lpMouseKeys
->iMaxSpeed
= 360;
1829 lpMouseKeys
->iTimeToMaxSpeed
= 1000;
1830 lpMouseKeys
->iCtrlSpeed
= 0;
1831 lpMouseKeys
->dwReserved1
= 0;
1832 lpMouseKeys
->dwReserved2
= 0;
1840 WINE_SPI_FIXME(SPI_SETMOUSEKEYS
); /* 55 */
1842 case SPI_GETSHOWSOUNDS
:
1843 ret
= get_bool_param( SPI_SETSHOWSOUNDS_IDX
,
1844 SPI_SETSHOWSOUNDS_REGKEY
,
1845 SPI_SETSHOWSOUNDS_VALNAME
,
1846 &show_sounds
, pvParam
);
1849 case SPI_SETSHOWSOUNDS
:
1850 ret
= set_bool_param( SPI_SETSHOWSOUNDS_IDX
,
1851 SPI_SETSHOWSOUNDS_REGKEY
,
1852 SPI_SETSHOWSOUNDS_VALNAME
,
1853 &show_sounds
, uiParam
, fWinIni
);
1856 case SPI_GETSTICKYKEYS
: /* 58 */
1858 LPSTICKYKEYS lpStickyKeys
= pvParam
;
1859 WARN("SPI_GETSTICKYKEYS not fully implemented\n");
1860 if (lpStickyKeys
&& lpStickyKeys
->cbSize
== sizeof(STICKYKEYS
))
1862 /* Indicate that no StickyKeys feature available */
1863 lpStickyKeys
->dwFlags
= 0;
1871 WINE_SPI_FIXME(SPI_SETSTICKYKEYS
); /* 59 */
1873 case SPI_GETACCESSTIMEOUT
: /* 60 */
1875 LPACCESSTIMEOUT lpAccessTimeout
= pvParam
;
1876 WARN("SPI_GETACCESSTIMEOUT not fully implemented\n");
1877 if (lpAccessTimeout
&& lpAccessTimeout
->cbSize
== sizeof(ACCESSTIMEOUT
))
1879 /* Indicate that no accessibility features timeout is available */
1880 lpAccessTimeout
->dwFlags
= 0;
1881 lpAccessTimeout
->iTimeOutMSec
= 0;
1889 WINE_SPI_FIXME(SPI_SETACCESSTIMEOUT
); /* 61 */
1891 case SPI_GETSERIALKEYS
: /* 62 WINVER >= 0x400 */
1893 LPSERIALKEYSW lpSerialKeysW
= pvParam
;
1894 WARN("SPI_GETSERIALKEYS not fully implemented\n");
1895 if (lpSerialKeysW
&& lpSerialKeysW
->cbSize
== sizeof(SERIALKEYSW
))
1897 /* Indicate that no SerialKeys feature available */
1898 lpSerialKeysW
->dwFlags
= 0;
1899 lpSerialKeysW
->lpszActivePort
= NULL
;
1900 lpSerialKeysW
->lpszPort
= NULL
;
1901 lpSerialKeysW
->iBaudRate
= 0;
1902 lpSerialKeysW
->iPortState
= 0;
1910 WINE_SPI_FIXME(SPI_SETSERIALKEYS
); /* 63 WINVER >= 0x400 */
1912 case SPI_GETSOUNDSENTRY
: /* 64 */
1914 LPSOUNDSENTRYW lpSoundSentryW
= pvParam
;
1915 WARN("SPI_GETSOUNDSENTRY not fully implemented\n");
1916 if (lpSoundSentryW
&& lpSoundSentryW
->cbSize
== sizeof(SOUNDSENTRYW
))
1918 /* Indicate that no SoundSentry feature available */
1919 lpSoundSentryW
->dwFlags
= 0;
1920 lpSoundSentryW
->iFSTextEffect
= 0;
1921 lpSoundSentryW
->iFSTextEffectMSec
= 0;
1922 lpSoundSentryW
->iFSTextEffectColorBits
= 0;
1923 lpSoundSentryW
->iFSGrafEffect
= 0;
1924 lpSoundSentryW
->iFSGrafEffectMSec
= 0;
1925 lpSoundSentryW
->iFSGrafEffectColor
= 0;
1926 lpSoundSentryW
->iWindowsEffect
= 0;
1927 lpSoundSentryW
->iWindowsEffectMSec
= 0;
1928 lpSoundSentryW
->lpszWindowsEffectDLL
= 0;
1929 lpSoundSentryW
->iWindowsEffectOrdinal
= 0;
1937 WINE_SPI_FIXME(SPI_SETSOUNDSENTRY
); /* 65 */
1939 case SPI_GETHIGHCONTRAST
: /* 66 WINVER >= 0x400 */
1941 LPHIGHCONTRASTW lpHighContrastW
= pvParam
;
1942 WARN("SPI_GETHIGHCONTRAST not fully implemented\n");
1943 if (lpHighContrastW
&& lpHighContrastW
->cbSize
== sizeof(HIGHCONTRASTW
))
1945 /* Indicate that no high contrast feature available */
1946 lpHighContrastW
->dwFlags
= 0;
1947 lpHighContrastW
->lpszDefaultScheme
= NULL
;
1955 WINE_SPI_FIXME(SPI_SETHIGHCONTRAST
); /* 67 WINVER >= 0x400 */
1957 case SPI_GETKEYBOARDPREF
:
1958 ret
= get_bool_param( SPI_SETKEYBOARDPREF_IDX
,
1959 SPI_SETKEYBOARDPREF_REGKEY
,
1960 SPI_SETKEYBOARDPREF_VALNAME
,
1961 &keyboard_pref
, pvParam
);
1964 case SPI_SETKEYBOARDPREF
:
1965 ret
= set_bool_param( SPI_SETKEYBOARDPREF_IDX
,
1966 SPI_SETKEYBOARDPREF_REGKEY
,
1967 SPI_SETKEYBOARDPREF_VALNAME
,
1968 &keyboard_pref
, uiParam
, fWinIni
);
1971 case SPI_GETSCREENREADER
:
1972 ret
= get_bool_param( SPI_SETSCREENREADER_IDX
,
1973 SPI_SETSCREENREADER_REGKEY
,
1974 SPI_SETSCREENREADER_VALNAME
,
1975 &screen_reader
, pvParam
);
1978 case SPI_SETSCREENREADER
:
1979 ret
= set_bool_param( SPI_SETSCREENREADER_IDX
,
1980 SPI_SETSCREENREADER_REGKEY
,
1981 SPI_SETSCREENREADER_VALNAME
,
1982 &screen_reader
, uiParam
, fWinIni
);
1985 case SPI_GETANIMATION
: /* 72 WINVER >= 0x400 */
1987 LPANIMATIONINFO lpAnimInfo
= pvParam
;
1989 /* Tell it "disabled" */
1990 if (lpAnimInfo
&& lpAnimInfo
->cbSize
== sizeof(ANIMATIONINFO
))
1991 lpAnimInfo
->iMinAnimate
= 0; /* Minimise and restore animation is disabled (nonzero == enabled) */
1996 WINE_SPI_WARN(SPI_SETANIMATION
); /* 73 WINVER >= 0x400 */
1998 case SPI_GETFONTSMOOTHING
:
2001 ret
= get_uint_param( SPI_SETFONTSMOOTHING_IDX
,
2002 SPI_SETFONTSMOOTHING_REGKEY
,
2003 SPI_SETFONTSMOOTHING_VALNAME
,
2004 &font_smoothing
, &tmpval
);
2005 if (!pvParam
) ret
= FALSE
;
2008 *(UINT
*) pvParam
= ( tmpval
!= 0);
2011 case SPI_SETFONTSMOOTHING
:
2012 uiParam
= uiParam
? 2 : 0; /* Win NT4/2k/XP behavior */
2013 ret
= set_uint_param( SPI_SETFONTSMOOTHING_IDX
,
2014 SPI_SETFONTSMOOTHING_REGKEY
,
2015 SPI_SETFONTSMOOTHING_VALNAME
,
2016 &font_smoothing
, uiParam
, fWinIni
);
2019 WINE_SPI_FIXME(SPI_SETDRAGWIDTH
); /* 76 WINVER >= 0x400 */
2020 WINE_SPI_FIXME(SPI_SETDRAGHEIGHT
); /* 77 WINVER >= 0x400 */
2022 WINE_SPI_FIXME(SPI_SETHANDHELD
); /* 78 WINVER >= 0x400 */
2024 WINE_SPI_FIXME(SPI_GETLOWPOWERTIMEOUT
); /* 79 WINVER >= 0x400 */
2025 WINE_SPI_FIXME(SPI_GETPOWEROFFTIMEOUT
); /* 80 WINVER >= 0x400 */
2026 WINE_SPI_FIXME(SPI_SETLOWPOWERTIMEOUT
); /* 81 WINVER >= 0x400 */
2027 WINE_SPI_FIXME(SPI_SETPOWEROFFTIMEOUT
); /* 82 WINVER >= 0x400 */
2029 case SPI_GETLOWPOWERACTIVE
:
2030 ret
= get_bool_param( SPI_SETLOWPOWERACTIVE_IDX
,
2031 SPI_SETLOWPOWERACTIVE_REGKEY
,
2032 SPI_SETLOWPOWERACTIVE_VALNAME
,
2033 &lowpoweractive
, pvParam
);
2036 case SPI_GETPOWEROFFACTIVE
:
2037 ret
= get_bool_param( SPI_SETPOWEROFFACTIVE_IDX
,
2038 SPI_SETPOWEROFFACTIVE_REGKEY
,
2039 SPI_SETPOWEROFFACTIVE_VALNAME
,
2040 &poweroffactive
, pvParam
);
2043 case SPI_SETLOWPOWERACTIVE
:
2044 ret
= set_bool_param( SPI_SETLOWPOWERACTIVE_IDX
,
2045 SPI_SETLOWPOWERACTIVE_REGKEY
,
2046 SPI_SETLOWPOWERACTIVE_VALNAME
,
2047 &lowpoweractive
, uiParam
, fWinIni
);
2050 case SPI_SETPOWEROFFACTIVE
:
2051 ret
= set_bool_param( SPI_SETPOWEROFFACTIVE_IDX
,
2052 SPI_SETPOWEROFFACTIVE_REGKEY
,
2053 SPI_SETPOWEROFFACTIVE_VALNAME
,
2054 &poweroffactive
, uiParam
, fWinIni
);
2057 WINE_SPI_FIXME(SPI_SETCURSORS
); /* 87 WINVER >= 0x400 */
2058 WINE_SPI_FIXME(SPI_SETICONS
); /* 88 WINVER >= 0x400 */
2060 case SPI_GETDEFAULTINPUTLANG
: /* 89 WINVER >= 0x400 */
2061 ret
= GetKeyboardLayout(0) ? TRUE
: FALSE
;
2064 WINE_SPI_FIXME(SPI_SETDEFAULTINPUTLANG
); /* 90 WINVER >= 0x400 */
2066 WINE_SPI_FIXME(SPI_SETLANGTOGGLE
); /* 91 WINVER >= 0x400 */
2068 case SPI_GETWINDOWSEXTENSION
: /* 92 WINVER >= 0x400 */
2069 WARN("pretend no support for Win9x Plus! for now.\n");
2070 ret
= FALSE
; /* yes, this is the result value */
2073 WINE_SPI_FIXME(SPI_SETMOUSETRAILS
); /* 93 WINVER >= 0x400 */
2074 WINE_SPI_FIXME(SPI_GETMOUSETRAILS
); /* 94 WINVER >= 0x400 */
2076 case SPI_GETSNAPTODEFBUTTON
: /* 95 WINVER >= 0x400 */
2077 ret
= get_bool_param( SPI_SETSNAPTODEFBUTTON_IDX
,
2078 SPI_SETSNAPTODEFBUTTON_REGKEY
,
2079 SPI_SETSNAPTODEFBUTTON_VALNAME
,
2080 &snap_to_default_button
, pvParam
);
2083 case SPI_SETSNAPTODEFBUTTON
: /* 96 WINVER >= 0x400 */
2084 ret
= set_bool_param( SPI_SETSNAPTODEFBUTTON_IDX
,
2085 SPI_SETSNAPTODEFBUTTON_REGKEY
,
2086 SPI_SETSNAPTODEFBUTTON_VALNAME
,
2087 &snap_to_default_button
, uiParam
, fWinIni
);
2090 case SPI_SETSCREENSAVERRUNNING
:
2091 ret
= set_bool_param( SPI_SETSCREENSAVERRUNNING_IDX
,
2092 SPI_SETSCREENSAVERRUNNING_REGKEY
,
2093 SPI_SETSCREENSAVERRUNNING_VALNAME
,
2094 &screensaver_running
, uiParam
, fWinIni
);
2097 case SPI_GETMOUSEHOVERWIDTH
:
2098 ret
= get_uint_param( SPI_SETMOUSEHOVERWIDTH_IDX
,
2099 SPI_SETMOUSEHOVERWIDTH_REGKEY
,
2100 SPI_SETMOUSEHOVERWIDTH_VALNAME
,
2101 &mouse_hover_width
, pvParam
);
2104 case SPI_SETMOUSEHOVERWIDTH
:
2105 ret
= set_uint_param( SPI_SETMOUSEHOVERWIDTH_IDX
,
2106 SPI_SETMOUSEHOVERWIDTH_REGKEY
,
2107 SPI_SETMOUSEHOVERWIDTH_VALNAME
,
2108 &mouse_hover_width
, uiParam
, fWinIni
);
2111 case SPI_GETMOUSEHOVERHEIGHT
:
2112 ret
= get_uint_param( SPI_SETMOUSEHOVERHEIGHT_IDX
,
2113 SPI_SETMOUSEHOVERHEIGHT_REGKEY
,
2114 SPI_SETMOUSEHOVERHEIGHT_VALNAME
,
2115 &mouse_hover_height
, pvParam
);
2118 case SPI_SETMOUSEHOVERHEIGHT
:
2119 ret
= set_uint_param( SPI_SETMOUSEHOVERHEIGHT_IDX
,
2120 SPI_SETMOUSEHOVERHEIGHT_REGKEY
,
2121 SPI_SETMOUSEHOVERHEIGHT_VALNAME
,
2122 &mouse_hover_height
, uiParam
, fWinIni
);
2125 case SPI_GETMOUSEHOVERTIME
:
2126 ret
= get_uint_param( SPI_SETMOUSEHOVERTIME_IDX
,
2127 SPI_SETMOUSEHOVERTIME_REGKEY
,
2128 SPI_SETMOUSEHOVERTIME_VALNAME
,
2129 &mouse_hover_time
, pvParam
);
2132 case SPI_SETMOUSEHOVERTIME
:
2133 ret
= set_uint_param( SPI_SETMOUSEHOVERTIME_IDX
,
2134 SPI_SETMOUSEHOVERTIME_REGKEY
,
2135 SPI_SETMOUSEHOVERTIME_VALNAME
,
2136 &mouse_hover_time
, uiParam
, fWinIni
);
2139 case SPI_GETWHEELSCROLLLINES
:
2140 ret
= get_uint_param( SPI_SETMOUSESCROLLLINES_IDX
,
2141 SPI_SETMOUSESCROLLLINES_REGKEY
,
2142 SPI_SETMOUSESCROLLLINES_VALNAME
,
2143 &mouse_scroll_lines
, pvParam
);
2146 case SPI_SETWHEELSCROLLLINES
:
2147 ret
= set_uint_param( SPI_SETMOUSESCROLLLINES_IDX
,
2148 SPI_SETMOUSESCROLLLINES_REGKEY
,
2149 SPI_SETMOUSESCROLLLINES_VALNAME
,
2150 &mouse_scroll_lines
, uiParam
, fWinIni
);
2153 case SPI_GETMENUSHOWDELAY
:
2154 ret
= get_uint_param( SPI_SETMENUSHOWDELAY_IDX
,
2155 SPI_SETMENUSHOWDELAY_REGKEY
,
2156 SPI_SETMENUSHOWDELAY_VALNAME
,
2157 &menu_show_delay
, pvParam
);
2160 case SPI_SETMENUSHOWDELAY
:
2161 ret
= set_uint_param( SPI_SETMENUSHOWDELAY_IDX
,
2162 SPI_SETMENUSHOWDELAY_REGKEY
,
2163 SPI_SETMENUSHOWDELAY_VALNAME
,
2164 &menu_show_delay
, uiParam
, fWinIni
);
2167 case SPI_GETWHEELSCROLLCHARS
: /* 108 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2168 ret
= get_uint_param( SPI_SETMOUSESCROLLCHARS_IDX
,
2169 SPI_SETMOUSESCROLLCHARS_REGKEY
,
2170 SPI_SETMOUSESCROLLCHARS_VALNAME
,
2171 &mouse_scroll_chars
, pvParam
);
2174 case SPI_SETWHEELSCROLLCHARS
: /* 109 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2175 ret
= set_uint_param( SPI_SETMOUSESCROLLCHARS_IDX
,
2176 SPI_SETMOUSESCROLLCHARS_REGKEY
,
2177 SPI_SETMOUSESCROLLCHARS_VALNAME
,
2178 &mouse_scroll_chars
, uiParam
, fWinIni
);
2181 WINE_SPI_FIXME(SPI_GETSHOWIMEUI
); /* 110 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2182 WINE_SPI_FIXME(SPI_SETSHOWIMEUI
); /* 111 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2184 case SPI_GETMOUSESPEED
: /* 112 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2185 ret
= get_uint_param( SPI_SETMOUSESPEED_IDX
,
2186 SPI_SETMOUSESPEED_REGKEY
,
2187 SPI_SETMOUSESPEED_VALNAME
,
2188 &mouse_sensitivity
, pvParam
);
2191 case SPI_SETMOUSESPEED
: /* 113 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2192 ret
= set_uint_param( SPI_SETMOUSESPEED_IDX
,
2193 SPI_SETMOUSESPEED_REGKEY
,
2194 SPI_SETMOUSESPEED_VALNAME
,
2195 &mouse_sensitivity
, PtrToInt(pvParam
), fWinIni
);
2199 case SPI_GETSCREENSAVERRUNNING
:
2200 ret
= get_bool_param( SPI_SETSCREENSAVERRUNNING_IDX
,
2201 SPI_SETSCREENSAVERRUNNING_REGKEY
,
2202 SPI_SETSCREENSAVERRUNNING_VALNAME
,
2203 &screensaver_running
, pvParam
);
2206 case SPI_GETDESKWALLPAPER
: /* 115 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2208 WCHAR buf
[MAX_PATH
];
2210 if (!pvParam
) return FALSE
;
2212 if (uiParam
> MAX_PATH
)
2217 if (SYSPARAMS_Load(SPI_SETDESKWALLPAPER_REGKEY
, SPI_SETDESKWALLPAPER_VALNAME
, buf
, sizeof(buf
)))
2219 lstrcpynW(pvParam
, buf
, uiParam
);
2223 /* Return an empty string */
2224 memset(pvParam
, 0, uiParam
);
2230 WINE_SPI_FIXME(SPI_GETACTIVEWINDOWTRACKING
);/* 0x1000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2231 WINE_SPI_FIXME(SPI_SETACTIVEWINDOWTRACKING
);/* 0x1001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2232 case SPI_GETMENUANIMATION
: /* 0x1002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2233 ret
= get_user_pref_param( 0, 0x02, pvParam
);
2236 case SPI_SETMENUANIMATION
: /* 0x1003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2237 ret
= set_user_pref_param( 0, 0x02, PtrToUlong(pvParam
), fWinIni
);
2240 case SPI_GETCOMBOBOXANIMATION
: /* 0x1004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2241 ret
= get_user_pref_param( 0, 0x04, pvParam
);
2244 case SPI_SETCOMBOBOXANIMATION
: /* 0x1005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2245 ret
= set_user_pref_param( 0, 0x04, PtrToUlong(pvParam
), fWinIni
);
2248 case SPI_GETLISTBOXSMOOTHSCROLLING
: /* 0x1006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2249 ret
= get_user_pref_param( 0, 0x08, pvParam
);
2252 case SPI_SETLISTBOXSMOOTHSCROLLING
: /* 0x1007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2253 ret
= set_user_pref_param( 0, 0x08, PtrToUlong(pvParam
), fWinIni
);
2256 case SPI_GETGRADIENTCAPTIONS
:
2257 ret
= get_user_pref_param( 0, 0x10, pvParam
);
2260 case SPI_SETGRADIENTCAPTIONS
:
2261 ret
= set_user_pref_param( 0, 0x10, PtrToUlong(pvParam
), fWinIni
);
2264 case SPI_GETKEYBOARDCUES
:
2265 ret
= get_user_pref_param( 0, 0x20, pvParam
);
2268 case SPI_SETKEYBOARDCUES
:
2269 ret
= set_user_pref_param( 0, 0x20, PtrToUlong(pvParam
), fWinIni
);
2272 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKZORDER
); /* 0x100C _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2273 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKZORDER
); /* 0x100D _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2274 case SPI_GETHOTTRACKING
:
2275 ret
= get_user_pref_param( 0, 0x80, pvParam
);
2278 case SPI_SETHOTTRACKING
:
2279 ret
= set_user_pref_param( 0, 0x80, PtrToUlong(pvParam
), fWinIni
);
2282 WINE_SPI_FIXME(SPI_GETMENUFADE
); /* 0x1012 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2283 WINE_SPI_FIXME(SPI_SETMENUFADE
); /* 0x1013 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2284 case SPI_GETSELECTIONFADE
: /* 0x1014 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2285 ret
= get_user_pref_param( 1, 0x04, pvParam
);
2288 case SPI_SETSELECTIONFADE
: /* 0x1015 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2289 ret
= set_user_pref_param( 1, 0x04, PtrToUlong(pvParam
), fWinIni
);
2292 case SPI_GETTOOLTIPANIMATION
: /* 0x1016 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2293 ret
= get_user_pref_param( 1, 0x08, pvParam
);
2296 case SPI_SETTOOLTIPANIMATION
: /* 0x1017 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2297 ret
= set_user_pref_param( 1, 0x08, PtrToUlong(pvParam
), fWinIni
);
2300 case SPI_GETTOOLTIPFADE
: /* 0x1018 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2301 ret
= get_user_pref_param( 1, 0x10, pvParam
);
2304 case SPI_SETTOOLTIPFADE
: /* 0x1019 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2305 ret
= set_user_pref_param( 1, 0x10, PtrToUlong(pvParam
), fWinIni
);
2308 case SPI_GETCURSORSHADOW
: /* 0x101A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2309 ret
= get_user_pref_param( 1, 0x20, pvParam
);
2312 case SPI_SETCURSORSHADOW
: /* 0x101B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2313 ret
= set_user_pref_param( 1, 0x20, PtrToUlong(pvParam
), fWinIni
);
2316 WINE_SPI_FIXME(SPI_GETMOUSESONAR
); /* 0x101C _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2317 WINE_SPI_FIXME(SPI_SETMOUSESONAR
); /* 0x101D _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2318 WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCK
); /* 0x101E _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2319 WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCK
); /* 0x101F _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2321 case SPI_GETMOUSEVANISH
:
2322 ret
= get_user_pref_param( 2, 0x01, pvParam
);
2325 case SPI_SETMOUSEVANISH
:
2326 ret
= set_user_pref_param( 2, 0x01, PtrToUlong(pvParam
), fWinIni
);
2329 case SPI_GETFLATMENU
:
2330 ret
= get_user_pref_param( 2, 0x02, pvParam
);
2333 case SPI_SETFLATMENU
:
2334 ret
= set_user_pref_param( 2, 0x02, PtrToUlong(pvParam
), fWinIni
);
2337 case SPI_GETDROPSHADOW
:
2338 ret
= get_user_pref_param( 2, 0x04, pvParam
);
2341 case SPI_SETDROPSHADOW
:
2342 ret
= set_user_pref_param( 2, 0x04, PtrToUlong(pvParam
), fWinIni
);
2345 WINE_SPI_FIXME(SPI_GETBLOCKSENDINPUTRESETS
);
2346 WINE_SPI_FIXME(SPI_SETBLOCKSENDINPUTRESETS
);
2347 case SPI_GETUIEFFECTS
:
2348 ret
= get_user_pref_param( 3, 0x80, pvParam
);
2351 case SPI_SETUIEFFECTS
:
2352 /* FIXME: this probably should mask other UI effect values when unset */
2353 ret
= set_user_pref_param( 3, 0x80, PtrToUlong(pvParam
), fWinIni
);
2356 case SPI_GETFOREGROUNDLOCKTIMEOUT
: /* 0x2000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2357 ret
= get_uint_param( SPI_SETFOREGROUNDLOCKTIMEOUT_IDX
,
2358 SPI_SETFOREGROUNDLOCKTIMEOUT_REGKEY
,
2359 SPI_SETFOREGROUNDLOCKTIMEOUT_VALNAME
,
2360 &foreground_lock_timeout
, pvParam
);
2363 case SPI_SETFOREGROUNDLOCKTIMEOUT
: /* 0x2001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2364 /* FIXME: this should check that the calling thread
2365 * is able to change the foreground window */
2366 ret
= set_uint_param( SPI_SETFOREGROUNDLOCKTIMEOUT_IDX
,
2367 SPI_SETFOREGROUNDLOCKTIMEOUT_REGKEY
,
2368 SPI_SETFOREGROUNDLOCKTIMEOUT_VALNAME
,
2369 &foreground_lock_timeout
, PtrToUlong(pvParam
), fWinIni
);
2372 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKTIMEOUT
); /* 0x2002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2373 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKTIMEOUT
); /* 0x2003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2374 WINE_SPI_FIXME(SPI_GETFOREGROUNDFLASHCOUNT
);/* 0x2004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2375 WINE_SPI_FIXME(SPI_SETFOREGROUNDFLASHCOUNT
);/* 0x2005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2376 case SPI_GETCARETWIDTH
: /* 0x2006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2377 ret
= get_uint_param( SPI_CARETWIDTH_IDX
,
2378 SPI_CARETWIDTH_REGKEY
,
2379 SPI_CARETWIDTH_VALNAME
,
2380 &caret_width
, pvParam
);
2383 case SPI_SETCARETWIDTH
: /* 0x2007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2384 ret
= set_uint_param( SPI_CARETWIDTH_IDX
,
2385 SPI_CARETWIDTH_REGKEY
,
2386 SPI_CARETWIDTH_VALNAME
,
2387 &caret_width
, uiParam
, fWinIni
);
2390 WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCKTIME
); /* 0x2008 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2391 WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCKTIME
); /* 0x2009 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2392 case SPI_GETFONTSMOOTHINGTYPE
: /* 0x200A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2393 spi_idx
= SPI_SETFONTSMOOTHINGTYPE_IDX
;
2394 if (!spi_loaded
[spi_idx
])
2396 ret
= SYSPARAMS_Load( SPI_SETFONTSMOOTHINGTYPE_REGKEY
,
2397 SPI_SETFONTSMOOTHINGTYPE_VALNAME
,
2398 (LPWSTR
)&font_smoothing_type
,
2399 sizeof(font_smoothing_type
) );
2400 if ( ret
) spi_loaded
[spi_idx
] = TRUE
;
2402 if (!pvParam
) ret
= FALSE
;
2405 *(UINT
*)pvParam
= font_smoothing_type
;
2408 case SPI_SETFONTSMOOTHINGTYPE
: /* 0x200B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2409 spi_idx
= SPI_SETFONTSMOOTHINGTYPE_IDX
;
2410 if (SYSPARAMS_SaveRaw( SPI_SETFONTSMOOTHINGTYPE_REGKEY
,
2411 SPI_SETFONTSMOOTHINGTYPE_VALNAME
,
2412 (LPBYTE
)&pvParam
, sizeof(UINT
), REG_DWORD
, fWinIni
))
2414 font_smoothing_type
= PtrToUlong(pvParam
);
2415 spi_loaded
[spi_idx
] = TRUE
;
2421 case SPI_GETFONTSMOOTHINGCONTRAST
: /* 0x200C _WIN32_WINNT >= 0x510 */
2422 spi_idx
= SPI_SETFONTSMOOTHINGCONTRAST_IDX
;
2423 if (!spi_loaded
[spi_idx
])
2425 ret
= SYSPARAMS_Load( SPI_SETFONTSMOOTHINGCONTRAST_REGKEY
,
2426 SPI_SETFONTSMOOTHINGCONTRAST_VALNAME
,
2427 (LPWSTR
)&font_smoothing_contrast
,
2428 sizeof(font_smoothing_contrast
) );
2430 spi_loaded
[spi_idx
] = TRUE
;
2432 if (!pvParam
) ret
= FALSE
;
2435 *(UINT
*)pvParam
= font_smoothing_contrast
;
2438 case SPI_SETFONTSMOOTHINGCONTRAST
: /* 0x200D _WIN32_WINNT >= 0x510 */
2439 spi_idx
= SPI_SETFONTSMOOTHINGCONTRAST_IDX
;
2440 if (SYSPARAMS_SaveRaw( SPI_SETFONTSMOOTHINGCONTRAST_REGKEY
,
2441 SPI_SETFONTSMOOTHINGCONTRAST_VALNAME
,
2442 (LPBYTE
)&pvParam
, sizeof(UINT
), REG_DWORD
, fWinIni
))
2444 font_smoothing_contrast
= PtrToUlong(pvParam
);
2445 spi_loaded
[spi_idx
] = TRUE
;
2451 case SPI_GETFOCUSBORDERWIDTH
: /* 0x200E _WIN32_WINNT >= 0x510 */
2452 case SPI_GETFOCUSBORDERHEIGHT
: /* 0x200F _WIN32_WINNT >= 0x510 */
2456 *(UINT
*)pvParam
= 1;
2459 WINE_SPI_FIXME(SPI_SETFOCUSBORDERWIDTH
); /* 0x2010 _WIN32_WINNT >= 0x510 */
2460 WINE_SPI_FIXME(SPI_SETFOCUSBORDERHEIGHT
); /* 0x2011 _WIN32_WINNT >= 0x510 */
2462 case SPI_GETFONTSMOOTHINGORIENTATION
: /* 0x2012 */
2463 spi_idx
= SPI_SETFONTSMOOTHINGORIENTATION_IDX
;
2464 if (!spi_loaded
[spi_idx
])
2466 ret
= SYSPARAMS_Load( SPI_SETFONTSMOOTHINGORIENTATION_REGKEY
,
2467 SPI_SETFONTSMOOTHINGORIENTATION_VALNAME
,
2468 (LPWSTR
)&font_smoothing_orientation
,
2469 sizeof(font_smoothing_orientation
) );
2471 spi_loaded
[spi_idx
] = TRUE
;
2473 if (!pvParam
) ret
= FALSE
;
2476 *(UINT
*)pvParam
= font_smoothing_orientation
;
2479 case SPI_SETFONTSMOOTHINGORIENTATION
: /* 0x2013 */
2480 spi_idx
= SPI_SETFONTSMOOTHINGORIENTATION_IDX
;
2481 if (SYSPARAMS_SaveRaw( SPI_SETFONTSMOOTHINGORIENTATION_REGKEY
,
2482 SPI_SETFONTSMOOTHINGORIENTATION_VALNAME
,
2483 (LPBYTE
)&pvParam
, sizeof(UINT
), REG_DWORD
, fWinIni
))
2485 font_smoothing_orientation
= PtrToUlong(pvParam
);
2486 spi_loaded
[spi_idx
] = TRUE
;
2493 FIXME( "Unknown action: %u\n", uiAction
);
2494 SetLastError( ERROR_INVALID_SPI_VALUE
);
2500 SYSPARAMS_NotifyChange( uiAction
, fWinIni
);
2501 TRACE("(%u, %u, %p, %u) ret %d\n",
2502 uiAction
, uiParam
, pvParam
, fWinIni
, ret
);
2505 #undef WINE_SPI_FIXME
2506 #undef WINE_SPI_WARN
2510 /***********************************************************************
2511 * SystemParametersInfo (USER.483)
2513 BOOL16 WINAPI
SystemParametersInfo16( UINT16 uAction
, UINT16 uParam
,
2514 LPVOID lpvParam
, UINT16 fuWinIni
)
2518 TRACE("(%u, %u, %p, %u)\n", uAction
, uParam
, lpvParam
, fuWinIni
);
2522 case SPI_GETBEEP
: /* 1 */
2523 case SPI_GETSCREENSAVEACTIVE
: /* 16 */
2524 case SPI_GETICONTITLEWRAP
: /* 25 */
2525 case SPI_GETMENUDROPALIGNMENT
: /* 27 */
2526 case SPI_GETFASTTASKSWITCH
: /* 35 */
2527 case SPI_GETDRAGFULLWINDOWS
: /* 38 WINVER >= 0x0400 */
2530 ret
= SystemParametersInfoA( uAction
, uParam
, lpvParam
? &tmp
: NULL
, fuWinIni
);
2531 if (ret
&& lpvParam
)
2532 *(BOOL16
*)lpvParam
= tmp
;
2536 case SPI_GETBORDER
: /* 5 */
2537 case SPI_ICONHORIZONTALSPACING
: /* 13 */
2538 case SPI_GETSCREENSAVETIMEOUT
: /* 14 */
2539 case SPI_GETGRIDGRANULARITY
: /* 18 */
2540 case SPI_GETKEYBOARDDELAY
: /* 22 */
2541 case SPI_ICONVERTICALSPACING
: /* 24 */
2544 ret
= SystemParametersInfoA( uAction
, uParam
, lpvParam
? &tmp
: NULL
, fuWinIni
);
2545 if (ret
&& lpvParam
)
2546 *(INT16
*)lpvParam
= tmp
;
2550 case SPI_GETKEYBOARDSPEED
: /* 10 */
2553 ret
= SystemParametersInfoA( uAction
, uParam
, lpvParam
? &tmp
: NULL
, fuWinIni
);
2554 if (ret
&& lpvParam
)
2555 *(WORD
*)lpvParam
= tmp
;
2559 case SPI_GETICONTITLELOGFONT
: /* 31 */
2562 ret
= SystemParametersInfoA( uAction
, uParam
, lpvParam
? &tmp
: NULL
, fuWinIni
);
2563 if (ret
&& lpvParam
)
2564 SYSPARAMS_LogFont32ATo16( &tmp
, (LPLOGFONT16
)lpvParam
);
2568 case SPI_GETNONCLIENTMETRICS
: /* 41 WINVER >= 0x400 */
2570 NONCLIENTMETRICSA tmp
;
2571 LPNONCLIENTMETRICS16 lpnm16
= (LPNONCLIENTMETRICS16
)lpvParam
;
2572 if (lpnm16
&& lpnm16
->cbSize
== sizeof(NONCLIENTMETRICS16
))
2574 tmp
.cbSize
= sizeof(NONCLIENTMETRICSA
);
2575 ret
= SystemParametersInfoA( uAction
, uParam
, &tmp
, fuWinIni
);
2577 SYSPARAMS_NonClientMetrics32ATo16( &tmp
, lpnm16
);
2579 else /* winfile 95 sets cbSize to 340 */
2580 ret
= SystemParametersInfoA( uAction
, uParam
, lpvParam
, fuWinIni
);
2584 case SPI_GETWORKAREA
: /* 48 WINVER >= 0x400 */
2587 ret
= SystemParametersInfoA( uAction
, uParam
, lpvParam
? &tmp
: NULL
, fuWinIni
);
2588 if (ret
&& lpvParam
)
2590 RECT16
*r16
= lpvParam
;
2591 r16
->left
= tmp
.left
;
2593 r16
->right
= tmp
.right
;
2594 r16
->bottom
= tmp
.bottom
;
2599 case SPI_GETMOUSEHOVERWIDTH
: /* 98 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2600 case SPI_GETMOUSEHOVERHEIGHT
: /* 100 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2601 case SPI_GETMOUSEHOVERTIME
: /* 102 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2604 ret
= SystemParametersInfoA( uAction
, uParam
, lpvParam
? &tmp
: NULL
, fuWinIni
);
2605 if (ret
&& lpvParam
)
2606 *(UINT16
*)lpvParam
= tmp
;
2611 ret
= SystemParametersInfoA( uAction
, uParam
, lpvParam
, fuWinIni
);
2617 /***********************************************************************
2618 * SystemParametersInfoA (USER32.@)
2620 BOOL WINAPI
SystemParametersInfoA( UINT uiAction
, UINT uiParam
,
2621 PVOID pvParam
, UINT fuWinIni
)
2625 TRACE("(%u, %u, %p, %u)\n", uiAction
, uiParam
, pvParam
, fuWinIni
);
2629 case SPI_SETDESKWALLPAPER
: /* 20 */
2630 case SPI_SETDESKPATTERN
: /* 21 */
2634 if (!MultiByteToWideChar( CP_ACP
, 0, pvParam
, -1, buffer
,
2635 sizeof(buffer
)/sizeof(WCHAR
) ))
2636 buffer
[sizeof(buffer
)/sizeof(WCHAR
)-1] = 0;
2637 ret
= SystemParametersInfoW( uiAction
, uiParam
, pvParam
? buffer
: NULL
, fuWinIni
);
2641 case SPI_GETICONTITLELOGFONT
: /* 31 */
2644 ret
= SystemParametersInfoW( uiAction
, uiParam
, pvParam
? &tmp
: NULL
, fuWinIni
);
2646 SYSPARAMS_LogFont32WTo32A( &tmp
, pvParam
);
2650 case SPI_GETNONCLIENTMETRICS
: /* 41 WINVER >= 0x400 */
2652 NONCLIENTMETRICSW tmp
;
2653 LPNONCLIENTMETRICSA lpnmA
= pvParam
;
2654 if (lpnmA
&& lpnmA
->cbSize
== sizeof(NONCLIENTMETRICSA
))
2656 tmp
.cbSize
= sizeof(NONCLIENTMETRICSW
);
2657 ret
= SystemParametersInfoW( uiAction
, uiParam
, &tmp
, fuWinIni
);
2659 SYSPARAMS_NonClientMetrics32WTo32A( &tmp
, lpnmA
);
2666 case SPI_SETNONCLIENTMETRICS
: /* 42 WINVER >= 0x400 */
2668 NONCLIENTMETRICSW tmp
;
2669 LPNONCLIENTMETRICSA lpnmA
= pvParam
;
2670 if (lpnmA
&& lpnmA
->cbSize
== sizeof(NONCLIENTMETRICSA
))
2672 tmp
.cbSize
= sizeof(NONCLIENTMETRICSW
);
2673 SYSPARAMS_NonClientMetrics32ATo32W( lpnmA
, &tmp
);
2674 ret
= SystemParametersInfoW( uiAction
, uiParam
, &tmp
, fuWinIni
);
2681 case SPI_GETICONMETRICS
: /* 45 WINVER >= 0x400 */
2684 LPICONMETRICSA lpimA
= pvParam
;
2685 if (lpimA
&& lpimA
->cbSize
== sizeof(ICONMETRICSA
))
2687 tmp
.cbSize
= sizeof(ICONMETRICSW
);
2688 ret
= SystemParametersInfoW( uiAction
, uiParam
, &tmp
, fuWinIni
);
2691 lpimA
->iHorzSpacing
= tmp
.iHorzSpacing
;
2692 lpimA
->iVertSpacing
= tmp
.iVertSpacing
;
2693 lpimA
->iTitleWrap
= tmp
.iTitleWrap
;
2694 SYSPARAMS_LogFont32WTo32A( &tmp
.lfFont
, &lpimA
->lfFont
);
2702 case SPI_SETICONMETRICS
: /* 46 WINVER >= 0x400 */
2705 LPICONMETRICSA lpimA
= pvParam
;
2706 if (lpimA
&& lpimA
->cbSize
== sizeof(ICONMETRICSA
))
2708 tmp
.cbSize
= sizeof(ICONMETRICSW
);
2709 tmp
.iHorzSpacing
= lpimA
->iHorzSpacing
;
2710 tmp
.iVertSpacing
= lpimA
->iVertSpacing
;
2711 tmp
.iTitleWrap
= lpimA
->iTitleWrap
;
2712 SYSPARAMS_LogFont32ATo32W( &lpimA
->lfFont
, &tmp
.lfFont
);
2713 ret
= SystemParametersInfoW( uiAction
, uiParam
, &tmp
, fuWinIni
);
2720 case SPI_GETHIGHCONTRAST
: /* 66 WINVER >= 0x400 */
2723 LPHIGHCONTRASTA lphcA
= pvParam
;
2724 if (lphcA
&& lphcA
->cbSize
== sizeof(HIGHCONTRASTA
))
2726 tmp
.cbSize
= sizeof(HIGHCONTRASTW
);
2727 ret
= SystemParametersInfoW( uiAction
, uiParam
, &tmp
, fuWinIni
);
2730 lphcA
->dwFlags
= tmp
.dwFlags
;
2731 lphcA
->lpszDefaultScheme
= NULL
; /* FIXME? */
2739 case SPI_GETDESKWALLPAPER
: /* 115 */
2741 WCHAR buffer
[MAX_PATH
];
2742 ret
= (SystemParametersInfoW( SPI_GETDESKWALLPAPER
, uiParam
, buffer
, fuWinIni
) &&
2743 WideCharToMultiByte(CP_ACP
, 0, buffer
, -1, pvParam
, uiParam
, NULL
, NULL
));
2748 ret
= SystemParametersInfoW( uiAction
, uiParam
, pvParam
, fuWinIni
);
2755 /***********************************************************************
2756 * GetSystemMetrics (USER32.@)
2758 INT WINAPI
GetSystemMetrics( INT index
)
2762 /* some metrics are dynamic */
2766 return GetDeviceCaps( get_display_dc(), HORZRES
);
2768 return GetDeviceCaps( get_display_dc(), VERTRES
);
2770 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2771 return nonclient_metrics
.iScrollWidth
;
2773 return GetSystemMetrics(SM_CXVSCROLL
);
2775 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2776 return nonclient_metrics
.iCaptionHeight
+ 1;
2779 /* SM_C{X,Y}BORDER always returns 1 regardless of 'BorderWidth' value in registry */
2785 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2786 return nonclient_metrics
.iScrollHeight
;
2788 return GetSystemMetrics(SM_CYVTHUMB
);
2790 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2791 return icon_size
.cx
;
2793 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2794 return icon_size
.cy
;
2799 return GetSystemMetrics(SM_CYMENUSIZE
) + 1;
2800 case SM_CXFULLSCREEN
:
2801 /* see the remark for SM_CXMAXIMIZED, at least this formulation is
2803 return GetSystemMetrics( SM_CXMAXIMIZED
) - 2 * GetSystemMetrics( SM_CXFRAME
);
2804 case SM_CYFULLSCREEN
:
2805 /* see the remark for SM_CYMAXIMIZED, at least this formulation is
2807 return GetSystemMetrics( SM_CYMAXIMIZED
) - GetSystemMetrics( SM_CYMIN
);
2808 case SM_CYKANJIWINDOW
:
2810 case SM_MOUSEPRESENT
:
2813 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2814 return nonclient_metrics
.iScrollHeight
;
2816 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2817 return nonclient_metrics
.iScrollHeight
;
2821 get_bool_param( SPI_SETMOUSEBUTTONSWAP_IDX
, SPI_SETMOUSEBUTTONSWAP_REGKEY
,
2822 SPI_SETMOUSEBUTTONSWAP_VALNAME
, &swap_buttons
, (BOOL
*)&ret
);
2830 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2831 return 3 * nonclient_metrics
.iCaptionWidth
+ GetSystemMetrics( SM_CYSIZE
) +
2832 4 * CaptionFontAvCharWidth
+ 2 * GetSystemMetrics( SM_CXFRAME
) + 4;
2834 return GetSystemMetrics( SM_CYCAPTION
) + 2 * GetSystemMetrics( SM_CYFRAME
);
2836 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2837 return nonclient_metrics
.iCaptionWidth
;
2839 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2840 return nonclient_metrics
.iCaptionHeight
;
2842 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2843 return GetSystemMetrics(SM_CXDLGFRAME
) + nonclient_metrics
.iBorderWidth
;
2845 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2846 return GetSystemMetrics(SM_CYDLGFRAME
) + nonclient_metrics
.iBorderWidth
;
2848 return GetSystemMetrics(SM_CXMIN
);
2850 return GetSystemMetrics(SM_CYMIN
);
2851 case SM_CXDOUBLECLK
:
2852 get_uint_param( SPI_SETDOUBLECLKWIDTH_IDX
, SPI_SETDOUBLECLKWIDTH_REGKEY1
,
2853 SPI_SETDOUBLECLKWIDTH_VALNAME
, &double_click_width
, &ret
);
2855 case SM_CYDOUBLECLK
:
2856 get_uint_param( SPI_SETDOUBLECLKHEIGHT_IDX
, SPI_SETDOUBLECLKHEIGHT_REGKEY1
,
2857 SPI_SETDOUBLECLKHEIGHT_VALNAME
, &double_click_height
, &ret
);
2859 case SM_CXICONSPACING
:
2860 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING
, 0, &ret
, 0 );
2862 case SM_CYICONSPACING
:
2863 SystemParametersInfoW( SPI_ICONVERTICALSPACING
, 0, &ret
, 0 );
2865 case SM_MENUDROPALIGNMENT
:
2866 SystemParametersInfoW( SPI_GETMENUDROPALIGNMENT
, 0, &ret
, 0 );
2870 case SM_DBCSENABLED
:
2873 GetCPInfo( CP_ACP
, &cpinfo
);
2874 return (cpinfo
.MaxCharSize
> 1);
2876 case SM_CMOUSEBUTTONS
:
2881 return GetSystemMetrics(SM_CXBORDER
) + 1;
2883 return GetSystemMetrics(SM_CYBORDER
) + 1;
2884 case SM_CXMINSPACING
:
2885 if( spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
]) load_minimized_metrics();
2886 return GetSystemMetrics(SM_CXMINIMIZED
) + minimized_metrics
.iHorzGap
;
2887 case SM_CYMINSPACING
:
2888 if( spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
]) load_minimized_metrics();
2889 return GetSystemMetrics(SM_CYMINIMIZED
) + minimized_metrics
.iVertGap
;
2893 case SM_CYSMCAPTION
:
2894 return GetSystemMetrics(SM_CYSMSIZE
) + 1;
2896 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2897 return nonclient_metrics
.iSmCaptionWidth
;
2899 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2900 return nonclient_metrics
.iSmCaptionHeight
;
2902 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2903 return nonclient_metrics
.iMenuWidth
;
2905 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2906 return nonclient_metrics
.iMenuHeight
;
2908 if( spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
]) load_minimized_metrics();
2909 return minimized_metrics
.iArrange
;
2910 case SM_CXMINIMIZED
:
2911 if( spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
]) load_minimized_metrics();
2912 return minimized_metrics
.iWidth
+ 6;
2913 case SM_CYMINIMIZED
:
2914 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2915 return nonclient_metrics
.iCaptionHeight
+ 6;
2917 return GetSystemMetrics(SM_CXVIRTUALSCREEN
) + 4 + 2 * GetSystemMetrics(SM_CXFRAME
);
2919 return GetSystemMetrics(SM_CYVIRTUALSCREEN
) + 4 + 2 * GetSystemMetrics(SM_CYFRAME
);
2920 case SM_CXMAXIMIZED
:
2921 /* FIXME: subtract the width of any vertical application toolbars*/
2922 return GetSystemMetrics(SM_CXSCREEN
) + 2 * GetSystemMetrics(SM_CXFRAME
);
2923 case SM_CYMAXIMIZED
:
2924 /* FIXME: subtract the width of any horizontal application toolbars*/
2925 return GetSystemMetrics(SM_CYSCREEN
) + 2 * GetSystemMetrics(SM_CYCAPTION
);
2927 return 3; /* FIXME */
2929 return 0; /* 0 = ok, 1 = failsafe, 2 = failsafe + network */
2934 SystemParametersInfoW( SPI_GETSHOWSOUNDS
, 0, &ret
, 0 );
2936 case SM_CXMENUCHECK
:
2937 case SM_CYMENUCHECK
:
2938 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2939 return tmMenuFont
.tmHeight
<= 0 ? 13 :
2940 ((tmMenuFont
.tmHeight
+ tmMenuFont
.tmExternalLeading
+ 1) / 2) * 2 - 1;
2941 case SM_SLOWMACHINE
:
2942 return 0; /* Never true */
2943 case SM_MIDEASTENABLED
:
2944 return 0; /* FIXME */
2945 case SM_MOUSEWHEELPRESENT
:
2947 case SM_XVIRTUALSCREEN
:
2949 struct monitor_info info
;
2950 get_monitors_info( &info
);
2951 return info
.virtual_rect
.left
;
2953 case SM_YVIRTUALSCREEN
:
2955 struct monitor_info info
;
2956 get_monitors_info( &info
);
2957 return info
.virtual_rect
.top
;
2959 case SM_CXVIRTUALSCREEN
:
2961 struct monitor_info info
;
2962 get_monitors_info( &info
);
2963 return info
.virtual_rect
.right
- info
.virtual_rect
.left
;
2965 case SM_CYVIRTUALSCREEN
:
2967 struct monitor_info info
;
2968 get_monitors_info( &info
);
2969 return info
.virtual_rect
.bottom
- info
.virtual_rect
.top
;
2973 struct monitor_info info
;
2974 get_monitors_info( &info
);
2977 case SM_SAMEDISPLAYFORMAT
:
2980 return 0; /* FIXME */
2981 case SM_CXFOCUSBORDER
:
2982 case SM_CYFOCUSBORDER
:
2985 case SM_MEDIACENTER
:
2995 /***********************************************************************
2996 * SwapMouseButton (USER32.@)
2997 * Reverse or restore the meaning of the left and right mouse buttons
2998 * fSwap [I ] TRUE - reverse, FALSE - original
3002 BOOL WINAPI
SwapMouseButton( BOOL fSwap
)
3004 BOOL prev
= GetSystemMetrics(SM_SWAPBUTTON
);
3005 SystemParametersInfoW(SPI_SETMOUSEBUTTONSWAP
, fSwap
, 0, 0);
3010 /**********************************************************************
3011 * SetDoubleClickTime (USER32.@)
3013 BOOL WINAPI
SetDoubleClickTime( UINT interval
)
3015 return SystemParametersInfoW(SPI_SETDOUBLECLICKTIME
, interval
, 0, 0);
3019 /**********************************************************************
3020 * GetDoubleClickTime (USER32.@)
3022 UINT WINAPI
GetDoubleClickTime(void)
3026 get_uint_param( SPI_SETDOUBLECLICKTIME_IDX
,
3027 SPI_SETDOUBLECLICKTIME_REGKEY
,
3028 SPI_SETDOUBLECLICKTIME_VALNAME
,
3029 &double_click_time
, &time
);
3030 if (!time
) time
= 500;
3035 /*************************************************************************
3036 * GetSysColor (USER32.@)
3038 COLORREF WINAPI
GetSysColor( INT nIndex
)
3040 if (nIndex
>= 0 && nIndex
< NUM_SYS_COLORS
)
3041 return SysColors
[nIndex
];
3047 /*************************************************************************
3048 * SetSysColors (USER32.@)
3050 BOOL WINAPI
SetSysColors( INT nChanges
, const INT
*lpSysColor
,
3051 const COLORREF
*lpColorValues
)
3055 for (i
= 0; i
< nChanges
; i
++) SYSPARAMS_SetSysColor( lpSysColor
[i
], lpColorValues
[i
] );
3057 /* Send WM_SYSCOLORCHANGE message to all windows */
3059 SendMessageTimeoutW( HWND_BROADCAST
, WM_SYSCOLORCHANGE
, 0, 0, SMTO_ABORTIFHUNG
, 2000, NULL
);
3061 /* Repaint affected portions of all visible windows */
3063 RedrawWindow( GetDesktopWindow(), NULL
, 0,
3064 RDW_INVALIDATE
| RDW_ERASE
| RDW_UPDATENOW
| RDW_ALLCHILDREN
);
3069 /*************************************************************************
3070 * SetSysColorsTemp (USER32.@)
3074 * Called by W98SE desk.cpl Control Panel Applet:
3075 * handle = SetSysColorsTemp(ptr, ptr, nCount); ("set" call)
3076 * result = SetSysColorsTemp(NULL, NULL, handle); ("restore" call)
3078 * pPens is an array of COLORREF values, which seems to be used
3079 * to indicate the color values to create new pens with.
3081 * pBrushes is an array of solid brush handles (returned by a previous
3082 * CreateSolidBrush), which seems to contain the brush handles to set
3083 * for the system colors.
3085 * n seems to be used for
3086 * a) indicating the number of entries to operate on (length of pPens,
3088 * b) passing the handle that points to the previously used color settings.
3089 * I couldn't figure out in hell what kind of handle this is on
3090 * Windows. I just use a heap handle instead. Shouldn't matter anyway.
3093 * heap handle of our own copy of the current syscolors in case of
3094 * "set" call, i.e. pPens, pBrushes != NULL.
3095 * TRUE (unconditionally !) in case of "restore" call,
3096 * i.e. pPens, pBrushes == NULL.
3097 * FALSE in case of either pPens != NULL and pBrushes == NULL
3098 * or pPens == NULL and pBrushes != NULL.
3100 * I'm not sure whether this implementation is 100% correct. [AM]
3102 DWORD WINAPI
SetSysColorsTemp( const COLORREF
*pPens
, const HBRUSH
*pBrushes
, DWORD n
)
3106 if (pPens
&& pBrushes
) /* "set" call */
3108 /* allocate our structure to remember old colors */
3109 LPVOID pOldCol
= HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD
)+n
*sizeof(HPEN
)+n
*sizeof(HBRUSH
));
3111 *(DWORD
*)p
= n
; p
= (char*)p
+ sizeof(DWORD
);
3112 memcpy(p
, SysColorPens
, n
*sizeof(HPEN
)); p
= (char*)p
+ n
*sizeof(HPEN
);
3113 memcpy(p
, SysColorBrushes
, n
*sizeof(HBRUSH
)); p
= (char*)p
+ n
*sizeof(HBRUSH
);
3115 for (i
=0; i
< n
; i
++)
3117 SysColorPens
[i
] = CreatePen( PS_SOLID
, 1, pPens
[i
] );
3118 SysColorBrushes
[i
] = pBrushes
[i
];
3121 return (DWORD
)pOldCol
; /* FIXME: pointer truncation */
3123 if (!pPens
&& !pBrushes
) /* "restore" call */
3125 LPVOID pOldCol
= (LPVOID
)n
; /* FIXME: not 64-bit safe */
3127 DWORD nCount
= *(DWORD
*)p
;
3128 p
= (char*)p
+ sizeof(DWORD
);
3130 for (i
=0; i
< nCount
; i
++)
3132 DeleteObject(SysColorPens
[i
]);
3133 SysColorPens
[i
] = *(HPEN
*)p
; p
= (char*)p
+ sizeof(HPEN
);
3135 for (i
=0; i
< nCount
; i
++)
3137 SysColorBrushes
[i
] = *(HBRUSH
*)p
; p
= (char*)p
+ sizeof(HBRUSH
);
3139 /* get rid of storage structure */
3140 HeapFree(GetProcessHeap(), 0, pOldCol
);
3148 /***********************************************************************
3149 * GetSysColorBrush (USER32.@)
3151 HBRUSH WINAPI
GetSysColorBrush( INT index
)
3153 if (0 <= index
&& index
< NUM_SYS_COLORS
) return SysColorBrushes
[index
];
3154 WARN("Unknown index(%d)\n", index
);
3155 return GetStockObject(LTGRAY_BRUSH
);
3159 /***********************************************************************
3162 HPEN
SYSCOLOR_GetPen( INT index
)
3164 /* We can assert here, because this function is internal to Wine */
3165 assert (0 <= index
&& index
< NUM_SYS_COLORS
);
3166 return SysColorPens
[index
];
3170 /***********************************************************************
3171 * ChangeDisplaySettingsA (USER32.@)
3173 LONG WINAPI
ChangeDisplaySettingsA( LPDEVMODEA devmode
, DWORD flags
)
3175 if (devmode
) devmode
->dmDriverExtra
= 0;
3177 return ChangeDisplaySettingsExA(NULL
,devmode
,NULL
,flags
,NULL
);
3181 /***********************************************************************
3182 * ChangeDisplaySettingsW (USER32.@)
3184 LONG WINAPI
ChangeDisplaySettingsW( LPDEVMODEW devmode
, DWORD flags
)
3186 if (devmode
) devmode
->dmDriverExtra
= 0;
3188 return ChangeDisplaySettingsExW(NULL
,devmode
,NULL
,flags
,NULL
);
3192 /***********************************************************************
3193 * ChangeDisplaySettingsExA (USER32.@)
3195 LONG WINAPI
ChangeDisplaySettingsExA( LPCSTR devname
, LPDEVMODEA devmode
, HWND hwnd
,
3196 DWORD flags
, LPVOID lparam
)
3199 UNICODE_STRING nameW
;
3201 if (devname
) RtlCreateUnicodeStringFromAsciiz(&nameW
, devname
);
3202 else nameW
.Buffer
= NULL
;
3208 devmodeW
= GdiConvertToDevmodeW(devmode
);
3211 ret
= ChangeDisplaySettingsExW(nameW
.Buffer
, devmodeW
, hwnd
, flags
, lparam
);
3212 HeapFree(GetProcessHeap(), 0, devmodeW
);
3215 ret
= DISP_CHANGE_SUCCESSFUL
;
3219 ret
= ChangeDisplaySettingsExW(nameW
.Buffer
, NULL
, hwnd
, flags
, lparam
);
3222 if (devname
) RtlFreeUnicodeString(&nameW
);
3227 /***********************************************************************
3228 * ChangeDisplaySettingsExW (USER32.@)
3230 LONG WINAPI
ChangeDisplaySettingsExW( LPCWSTR devname
, LPDEVMODEW devmode
, HWND hwnd
,
3231 DWORD flags
, LPVOID lparam
)
3233 /* make sure the desktop window is created before mode changing */
3236 return USER_Driver
->pChangeDisplaySettingsEx( devname
, devmode
, hwnd
, flags
, lparam
);
3240 /***********************************************************************
3241 * EnumDisplaySettingsW (USER32.@)
3244 * TRUE if nth setting exists found (described in the LPDEVMODEW struct)
3245 * FALSE if we do not have the nth setting
3247 BOOL WINAPI
EnumDisplaySettingsW( LPCWSTR name
, DWORD n
, LPDEVMODEW devmode
)
3249 return EnumDisplaySettingsExW(name
, n
, devmode
, 0);
3253 /***********************************************************************
3254 * EnumDisplaySettingsA (USER32.@)
3256 BOOL WINAPI
EnumDisplaySettingsA(LPCSTR name
,DWORD n
,LPDEVMODEA devmode
)
3258 return EnumDisplaySettingsExA(name
, n
, devmode
, 0);
3262 /***********************************************************************
3263 * EnumDisplaySettingsExA (USER32.@)
3265 BOOL WINAPI
EnumDisplaySettingsExA(LPCSTR lpszDeviceName
, DWORD iModeNum
,
3266 LPDEVMODEA lpDevMode
, DWORD dwFlags
)
3270 UNICODE_STRING nameW
;
3272 if (lpszDeviceName
) RtlCreateUnicodeStringFromAsciiz(&nameW
, lpszDeviceName
);
3273 else nameW
.Buffer
= NULL
;
3275 ret
= EnumDisplaySettingsExW(nameW
.Buffer
,iModeNum
,&devmodeW
,dwFlags
);
3278 lpDevMode
->dmSize
= FIELD_OFFSET(DEVMODEA
, dmICMMethod
);
3279 lpDevMode
->dmSpecVersion
= devmodeW
.dmSpecVersion
;
3280 lpDevMode
->dmDriverVersion
= devmodeW
.dmDriverVersion
;
3281 WideCharToMultiByte(CP_ACP
, 0, devmodeW
.dmDeviceName
, -1,
3282 (LPSTR
)lpDevMode
->dmDeviceName
, CCHDEVICENAME
, NULL
, NULL
);
3283 lpDevMode
->dmDriverExtra
= 0; /* FIXME */
3284 lpDevMode
->dmBitsPerPel
= devmodeW
.dmBitsPerPel
;
3285 lpDevMode
->dmPelsHeight
= devmodeW
.dmPelsHeight
;
3286 lpDevMode
->dmPelsWidth
= devmodeW
.dmPelsWidth
;
3287 lpDevMode
->u2
.dmDisplayFlags
= devmodeW
.u2
.dmDisplayFlags
;
3288 lpDevMode
->dmDisplayFrequency
= devmodeW
.dmDisplayFrequency
;
3289 lpDevMode
->dmFields
= devmodeW
.dmFields
;
3291 lpDevMode
->u1
.s2
.dmPosition
.x
= devmodeW
.u1
.s2
.dmPosition
.x
;
3292 lpDevMode
->u1
.s2
.dmPosition
.y
= devmodeW
.u1
.s2
.dmPosition
.y
;
3293 lpDevMode
->u1
.s2
.dmDisplayOrientation
= devmodeW
.u1
.s2
.dmDisplayOrientation
;
3294 lpDevMode
->u1
.s2
.dmDisplayFixedOutput
= devmodeW
.u1
.s2
.dmDisplayFixedOutput
;
3296 if (lpszDeviceName
) RtlFreeUnicodeString(&nameW
);
3301 /***********************************************************************
3302 * EnumDisplaySettingsExW (USER32.@)
3304 BOOL WINAPI
EnumDisplaySettingsExW(LPCWSTR lpszDeviceName
, DWORD iModeNum
,
3305 LPDEVMODEW lpDevMode
, DWORD dwFlags
)
3307 /* make sure the desktop window is created before mode enumeration */
3310 return USER_Driver
->pEnumDisplaySettingsEx(lpszDeviceName
, iModeNum
, lpDevMode
, dwFlags
);
3313 /***********************************************************************
3314 * SetProcessDPIAware (USER32.@)
3316 BOOL WINAPI
SetProcessDPIAware( VOID
)