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/wingdi16.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 static void SYSPARAMS_LogFont16To32W( const LOGFONT16
*font16
, LPLOGFONTW font32
)
392 font32
->lfHeight
= font16
->lfHeight
;
393 font32
->lfWidth
= font16
->lfWidth
;
394 font32
->lfEscapement
= font16
->lfEscapement
;
395 font32
->lfOrientation
= font16
->lfOrientation
;
396 font32
->lfWeight
= font16
->lfWeight
;
397 font32
->lfItalic
= font16
->lfItalic
;
398 font32
->lfUnderline
= font16
->lfUnderline
;
399 font32
->lfStrikeOut
= font16
->lfStrikeOut
;
400 font32
->lfCharSet
= font16
->lfCharSet
;
401 font32
->lfOutPrecision
= font16
->lfOutPrecision
;
402 font32
->lfClipPrecision
= font16
->lfClipPrecision
;
403 font32
->lfQuality
= font16
->lfQuality
;
404 font32
->lfPitchAndFamily
= font16
->lfPitchAndFamily
;
405 MultiByteToWideChar( CP_ACP
, 0, font16
->lfFaceName
, -1, font32
->lfFaceName
, LF_FACESIZE
);
406 font32
->lfFaceName
[LF_FACESIZE
-1] = 0;
409 static void SYSPARAMS_LogFont32WTo32A( const LOGFONTW
* font32W
, LPLOGFONTA font32A
)
411 font32A
->lfHeight
= font32W
->lfHeight
;
412 font32A
->lfWidth
= font32W
->lfWidth
;
413 font32A
->lfEscapement
= font32W
->lfEscapement
;
414 font32A
->lfOrientation
= font32W
->lfOrientation
;
415 font32A
->lfWeight
= font32W
->lfWeight
;
416 font32A
->lfItalic
= font32W
->lfItalic
;
417 font32A
->lfUnderline
= font32W
->lfUnderline
;
418 font32A
->lfStrikeOut
= font32W
->lfStrikeOut
;
419 font32A
->lfCharSet
= font32W
->lfCharSet
;
420 font32A
->lfOutPrecision
= font32W
->lfOutPrecision
;
421 font32A
->lfClipPrecision
= font32W
->lfClipPrecision
;
422 font32A
->lfQuality
= font32W
->lfQuality
;
423 font32A
->lfPitchAndFamily
= font32W
->lfPitchAndFamily
;
424 WideCharToMultiByte( CP_ACP
, 0, font32W
->lfFaceName
, -1, font32A
->lfFaceName
, LF_FACESIZE
, NULL
, NULL
);
425 font32A
->lfFaceName
[LF_FACESIZE
-1] = 0;
428 static void SYSPARAMS_LogFont32ATo32W( const LOGFONTA
* font32A
, LPLOGFONTW font32W
)
430 font32W
->lfHeight
= font32A
->lfHeight
;
431 font32W
->lfWidth
= font32A
->lfWidth
;
432 font32W
->lfEscapement
= font32A
->lfEscapement
;
433 font32W
->lfOrientation
= font32A
->lfOrientation
;
434 font32W
->lfWeight
= font32A
->lfWeight
;
435 font32W
->lfItalic
= font32A
->lfItalic
;
436 font32W
->lfUnderline
= font32A
->lfUnderline
;
437 font32W
->lfStrikeOut
= font32A
->lfStrikeOut
;
438 font32W
->lfCharSet
= font32A
->lfCharSet
;
439 font32W
->lfOutPrecision
= font32A
->lfOutPrecision
;
440 font32W
->lfClipPrecision
= font32A
->lfClipPrecision
;
441 font32W
->lfQuality
= font32A
->lfQuality
;
442 font32W
->lfPitchAndFamily
= font32A
->lfPitchAndFamily
;
443 MultiByteToWideChar( CP_ACP
, 0, font32A
->lfFaceName
, -1, font32W
->lfFaceName
, LF_FACESIZE
);
444 font32W
->lfFaceName
[LF_FACESIZE
-1] = 0;
447 static void SYSPARAMS_NonClientMetrics32WTo32A( const NONCLIENTMETRICSW
* lpnm32W
, LPNONCLIENTMETRICSA lpnm32A
)
449 lpnm32A
->iBorderWidth
= lpnm32W
->iBorderWidth
;
450 lpnm32A
->iScrollWidth
= lpnm32W
->iScrollWidth
;
451 lpnm32A
->iScrollHeight
= lpnm32W
->iScrollHeight
;
452 lpnm32A
->iCaptionWidth
= lpnm32W
->iCaptionWidth
;
453 lpnm32A
->iCaptionHeight
= lpnm32W
->iCaptionHeight
;
454 SYSPARAMS_LogFont32WTo32A( &lpnm32W
->lfCaptionFont
, &lpnm32A
->lfCaptionFont
);
455 lpnm32A
->iSmCaptionWidth
= lpnm32W
->iSmCaptionWidth
;
456 lpnm32A
->iSmCaptionHeight
= lpnm32W
->iSmCaptionHeight
;
457 SYSPARAMS_LogFont32WTo32A( &lpnm32W
->lfSmCaptionFont
, &lpnm32A
->lfSmCaptionFont
);
458 lpnm32A
->iMenuWidth
= lpnm32W
->iMenuWidth
;
459 lpnm32A
->iMenuHeight
= lpnm32W
->iMenuHeight
;
460 SYSPARAMS_LogFont32WTo32A( &lpnm32W
->lfMenuFont
, &lpnm32A
->lfMenuFont
);
461 SYSPARAMS_LogFont32WTo32A( &lpnm32W
->lfStatusFont
, &lpnm32A
->lfStatusFont
);
462 SYSPARAMS_LogFont32WTo32A( &lpnm32W
->lfMessageFont
, &lpnm32A
->lfMessageFont
);
465 static void SYSPARAMS_NonClientMetrics32ATo32W( const NONCLIENTMETRICSA
* lpnm32A
, LPNONCLIENTMETRICSW lpnm32W
)
467 lpnm32W
->iBorderWidth
= lpnm32A
->iBorderWidth
;
468 lpnm32W
->iScrollWidth
= lpnm32A
->iScrollWidth
;
469 lpnm32W
->iScrollHeight
= lpnm32A
->iScrollHeight
;
470 lpnm32W
->iCaptionWidth
= lpnm32A
->iCaptionWidth
;
471 lpnm32W
->iCaptionHeight
= lpnm32A
->iCaptionHeight
;
472 SYSPARAMS_LogFont32ATo32W( &lpnm32A
->lfCaptionFont
, &lpnm32W
->lfCaptionFont
);
473 lpnm32W
->iSmCaptionWidth
= lpnm32A
->iSmCaptionWidth
;
474 lpnm32W
->iSmCaptionHeight
= lpnm32A
->iSmCaptionHeight
;
475 SYSPARAMS_LogFont32ATo32W( &lpnm32A
->lfSmCaptionFont
, &lpnm32W
->lfSmCaptionFont
);
476 lpnm32W
->iMenuWidth
= lpnm32A
->iMenuWidth
;
477 lpnm32W
->iMenuHeight
= lpnm32A
->iMenuHeight
;
478 SYSPARAMS_LogFont32ATo32W( &lpnm32A
->lfMenuFont
, &lpnm32W
->lfMenuFont
);
479 SYSPARAMS_LogFont32ATo32W( &lpnm32A
->lfStatusFont
, &lpnm32W
->lfStatusFont
);
480 SYSPARAMS_LogFont32ATo32W( &lpnm32A
->lfMessageFont
, &lpnm32W
->lfMessageFont
);
484 /* Helper functions to retrieve monitors info */
492 static BOOL CALLBACK
monitor_info_proc( HMONITOR monitor
, HDC hdc
, LPRECT rect
, LPARAM lp
)
494 struct monitor_info
*info
= (struct monitor_info
*)lp
;
496 UnionRect( &info
->virtual_rect
, &info
->virtual_rect
, rect
);
500 static void get_monitors_info( struct monitor_info
*info
)
503 SetRectEmpty( &info
->virtual_rect
);
504 EnumDisplayMonitors( 0, NULL
, monitor_info_proc
, (LPARAM
)info
);
508 /* get text metrics and/or "average" char width of the specified logfont
509 * for the specified dc */
510 static void get_text_metr_size( HDC hdc
, LOGFONTW
*plf
, TEXTMETRICW
* ptm
, UINT
*psz
)
512 HFONT hfont
, hfontsav
;
515 hfont
= CreateFontIndirectW( plf
);
516 if( !hfont
|| ( hfontsav
= SelectObject( hdc
, hfont
)) == NULL
) {
519 if( hfont
) DeleteObject( hfont
);
522 GetTextMetricsW( hdc
, ptm
);
524 if( !(*psz
= GdiGetCharDimensions( hdc
, ptm
, NULL
)))
526 SelectObject( hdc
, hfontsav
);
527 DeleteObject( hfont
);
530 /***********************************************************************
531 * get_volatile_regkey
533 * Return a handle to the volatile registry key used to store
534 * non-permanently modified parameters.
536 static HKEY
get_volatile_regkey(void)
538 static HKEY volatile_key
;
543 /* This must be non-volatile! */
544 if (RegCreateKeyExW( HKEY_CURRENT_USER
, WINE_CURRENT_USER_REGKEY
,
545 0, 0, REG_OPTION_NON_VOLATILE
, KEY_ALL_ACCESS
, 0,
546 &key
, 0 ) != ERROR_SUCCESS
)
548 ERR("Can't create wine registry branch\n");
552 /* @@ Wine registry key: HKCU\Software\Wine\Temporary System Parameters */
553 if (RegCreateKeyExW( key
, WINE_CURRENT_USER_REGKEY_TEMP_PARAMS
,
554 0, 0, REG_OPTION_VOLATILE
, KEY_ALL_ACCESS
, 0,
555 &volatile_key
, 0 ) != ERROR_SUCCESS
)
556 ERR("Can't create non-permanent wine registry branch\n");
564 /***********************************************************************
565 * SYSPARAMS_NotifyChange
567 * Sends notification about system parameter update.
569 static void SYSPARAMS_NotifyChange( UINT uiAction
, UINT fWinIni
)
571 static const WCHAR emptyW
[1];
575 if (fWinIni
& SPIF_UPDATEINIFILE
)
577 if (fWinIni
& (SPIF_SENDWININICHANGE
| SPIF_SENDCHANGE
))
578 SendMessageTimeoutW(HWND_BROADCAST
, WM_SETTINGCHANGE
,
579 uiAction
, (LPARAM
) emptyW
,
580 SMTO_ABORTIFHUNG
, 2000, NULL
);
584 /* FIXME notify other wine processes with internal message */
590 /***********************************************************************
591 * Loads system parameter from user profile.
593 static BOOL
SYSPARAMS_LoadRaw( LPCWSTR lpRegKey
, LPCWSTR lpValName
, LPBYTE lpBuf
, DWORD count
)
599 memset( lpBuf
, 0, count
);
600 if ((RegOpenKeyW( get_volatile_regkey(), lpRegKey
, &hKey
) == ERROR_SUCCESS
) ||
601 (RegOpenKeyW( HKEY_CURRENT_USER
, lpRegKey
, &hKey
) == ERROR_SUCCESS
))
603 ret
= !RegQueryValueExW( hKey
, lpValName
, NULL
, &type
, lpBuf
, &count
);
609 static BOOL
SYSPARAMS_Load( LPCWSTR lpRegKey
, LPCWSTR lpValName
, LPWSTR lpBuf
, DWORD count
)
611 return SYSPARAMS_LoadRaw( lpRegKey
, lpValName
, (LPBYTE
)lpBuf
, count
);
614 /***********************************************************************
615 * Saves system parameter to user profile.
618 /* Save data as-is */
619 static BOOL
SYSPARAMS_SaveRaw( LPCWSTR lpRegKey
, LPCWSTR lpValName
,
620 const BYTE
* lpValue
, DWORD valueSize
,
621 DWORD type
, UINT fWinIni
)
628 if (fWinIni
& SPIF_UPDATEINIFILE
)
630 hBaseKey
= HKEY_CURRENT_USER
;
635 hBaseKey
= get_volatile_regkey();
636 dwOptions
= REG_OPTION_VOLATILE
;
639 if (RegCreateKeyExW( hBaseKey
, lpRegKey
,
640 0, 0, dwOptions
, KEY_ALL_ACCESS
,
641 0, &hKey
, 0 ) == ERROR_SUCCESS
)
643 if (RegSetValueExW( hKey
, lpValName
, 0, type
,
644 lpValue
, valueSize
) == ERROR_SUCCESS
)
647 if (hBaseKey
== HKEY_CURRENT_USER
)
648 RegDeleteKeyW( get_volatile_regkey(), lpRegKey
);
655 /* Convenience function to save strings */
656 static BOOL
SYSPARAMS_Save( LPCWSTR lpRegKey
, LPCWSTR lpValName
, LPCWSTR lpValue
,
659 return SYSPARAMS_SaveRaw( lpRegKey
, lpValName
, (const BYTE
*)lpValue
,
660 (strlenW(lpValue
) + 1)*sizeof(WCHAR
), REG_SZ
, fWinIni
);
663 /* Convenience function to save logical fonts */
664 static BOOL
SYSPARAMS_SaveLogFont( LPCWSTR lpRegKey
, LPCWSTR lpValName
,
665 const LOGFONTW
*plf
, UINT fWinIni
)
670 /* Zero pad the end of lfFaceName so we don't write uninitialised
671 data to the registry */
672 lf
.lfFaceName
[LF_FACESIZE
-1] = 0;
673 len
= strlenW(lf
.lfFaceName
);
674 if(len
< LF_FACESIZE
-1)
675 memset(lf
.lfFaceName
+ len
, 0, (LF_FACESIZE
- 1 - len
) * sizeof(WCHAR
));
677 return SYSPARAMS_SaveRaw( lpRegKey
, lpValName
, (const BYTE
*)&lf
,
678 sizeof(LOGFONTW
), REG_BINARY
, fWinIni
);
682 static inline HDC
get_display_dc(void)
684 static const WCHAR DISPLAY
[] = {'D','I','S','P','L','A','Y',0};
685 static HDC display_dc
;
688 display_dc
= CreateICW( DISPLAY
, NULL
, NULL
, NULL
);
689 __wine_make_gdi_object_system( display_dc
, TRUE
);
694 static inline int get_display_dpi(void)
696 static int display_dpi
;
697 if (!display_dpi
) display_dpi
= GetDeviceCaps( get_display_dc(), LOGPIXELSY
);
701 /***********************************************************************
702 * SYSPARAMS_Twips2Pixels
704 * Convert a dimension value that was obtained from the registry. These are
705 * quoted as being "twips" values if negative and pixels if positive.
706 * One inch is 1440 twips. So to convert, divide by 1440 to get inches and
707 * multiply that by the dots-per-inch to get the size in pixels.
709 * MSDN Library - April 2001 -> Resource Kits ->
710 * Windows 2000 Resource Kit Reference ->
711 * Technical Reference to the Windows 2000 Registry ->
712 * HKEY_CURRENT_USER -> Control Panel -> Desktop -> WindowMetrics
714 static inline int SYSPARAMS_Twips2Pixels(int x
)
717 x
= (-x
* get_display_dpi() + 720) / 1440;
721 /***********************************************************************
724 * Get a registry entry from the already open key. This allows us to open the
725 * section once and read several values.
727 * Of course this function belongs somewhere more usable but here will do
730 static int get_reg_metric( HKEY hkey
, LPCWSTR lpValName
, int default_value
)
732 int value
= default_value
;
736 DWORD type
, count
= sizeof(buffer
);
737 if(!RegQueryValueExW( hkey
, lpValName
, NULL
, &type
, (LPBYTE
)buffer
, &count
) )
741 /* Are there any utilities for converting registry entries
744 /* FIXME_(reg)("We need reg format converter\n"); */
747 value
= atoiW(buffer
);
750 return SYSPARAMS_Twips2Pixels(value
);
754 /*************************************************************************
755 * SYSPARAMS_SetSysColor
757 static void SYSPARAMS_SetSysColor( int index
, COLORREF color
)
759 if (index
< 0 || index
>= NUM_SYS_COLORS
) return;
760 SysColors
[index
] = color
;
761 if (SysColorBrushes
[index
])
763 __wine_make_gdi_object_system( SysColorBrushes
[index
], FALSE
);
764 DeleteObject( SysColorBrushes
[index
] );
766 SysColorBrushes
[index
] = CreateSolidBrush( color
);
767 __wine_make_gdi_object_system( SysColorBrushes
[index
], TRUE
);
769 if (SysColorPens
[index
])
771 __wine_make_gdi_object_system( SysColorPens
[index
], FALSE
);
772 DeleteObject( SysColorPens
[index
] );
774 SysColorPens
[index
] = CreatePen( PS_SOLID
, 1, color
);
775 __wine_make_gdi_object_system( SysColorPens
[index
], TRUE
);
778 /* load a uint parameter from the registry */
779 static BOOL
get_uint_param( unsigned int idx
, LPCWSTR regkey
, LPCWSTR value
,
780 UINT
*value_ptr
, UINT
*ret_ptr
)
782 if (!ret_ptr
) return FALSE
;
783 if (!spi_loaded
[idx
])
787 if (SYSPARAMS_Load( regkey
, value
, buf
, sizeof(buf
) )) *value_ptr
= atoiW( buf
);
788 spi_loaded
[idx
] = TRUE
;
790 *ret_ptr
= *value_ptr
;
794 /* load a twips parameter from the registry */
795 static BOOL
get_twips_param( unsigned int idx
, LPCWSTR regkey
, LPCWSTR value
,
796 UINT
*value_ptr
, UINT
*ret_ptr
)
798 if (!ret_ptr
) return FALSE
;
799 if (!spi_loaded
[idx
])
803 if (SYSPARAMS_Load( regkey
, value
, buf
, sizeof(buf
) ))
804 *value_ptr
= SYSPARAMS_Twips2Pixels( atoiW(buf
) );
805 spi_loaded
[idx
] = TRUE
;
807 *ret_ptr
= *value_ptr
;
811 /* load a boolean parameter from the registry */
812 static inline BOOL
get_bool_param( unsigned int idx
, LPCWSTR regkey
, LPCWSTR value
,
813 BOOL
*value_ptr
, BOOL
*ret_ptr
)
815 return get_uint_param( idx
, regkey
, value
, (UINT
*)value_ptr
, (UINT
*)ret_ptr
);
818 /* set a uint parameter that is mirrored in two different registry locations */
819 static BOOL
set_uint_param_mirrored( unsigned int idx
, LPCWSTR regkey
, LPCWSTR regkey_mirror
,
820 LPCWSTR value
, UINT
*value_ptr
, UINT new_val
, UINT fWinIni
)
824 wsprintfW(buf
, CSu
, new_val
);
825 if (!SYSPARAMS_Save( regkey
, value
, buf
, fWinIni
)) return FALSE
;
826 if (regkey_mirror
) SYSPARAMS_Save( regkey_mirror
, value
, buf
, fWinIni
);
827 *value_ptr
= new_val
;
828 spi_loaded
[idx
] = TRUE
;
832 /* save an int parameter in registry */
833 static BOOL
save_int_param( LPCWSTR regkey
, LPCWSTR value
, INT
*value_ptr
,
834 INT new_val
, UINT fWinIni
)
838 wsprintfW(buf
, CSd
, new_val
);
839 if (!SYSPARAMS_Save( regkey
, value
, buf
, fWinIni
)) return FALSE
;
840 if( value_ptr
) *value_ptr
= new_val
;
844 /* set an int parameter in the registry */
845 static inline BOOL
set_int_param( unsigned int idx
, LPCWSTR regkey
, LPCWSTR value
,
846 INT
*value_ptr
, INT new_val
, UINT fWinIni
)
848 BOOL ret
= save_int_param( regkey
, value
, value_ptr
, new_val
, fWinIni
);
849 if (ret
) spi_loaded
[idx
] = TRUE
;
853 /* set a uint parameter in the registry */
854 static inline BOOL
set_uint_param( unsigned int idx
, LPCWSTR regkey
, LPCWSTR value
,
855 UINT
*value_ptr
, UINT new_val
, UINT fWinIni
)
857 return set_uint_param_mirrored( idx
, regkey
, NULL
, value
, value_ptr
, new_val
, fWinIni
);
860 /* set a boolean parameter that is mirrored in two different registry locations */
861 static inline BOOL
set_bool_param_mirrored( unsigned int idx
, LPCWSTR regkey
, LPCWSTR regkey_mirror
,
862 LPCWSTR value
, BOOL
*value_ptr
, BOOL new_val
, UINT fWinIni
)
864 return set_uint_param_mirrored( idx
, regkey
, regkey_mirror
, value
,
865 (UINT
*)value_ptr
, new_val
, fWinIni
);
868 /* set a boolean parameter in the registry */
869 static inline BOOL
set_bool_param( unsigned int idx
, LPCWSTR regkey
, LPCWSTR value
,
870 BOOL
*value_ptr
, BOOL new_val
, UINT fWinIni
)
872 return set_uint_param( idx
, regkey
, value
, (UINT
*)value_ptr
, new_val
, fWinIni
);
875 /* load a boolean parameter from the user preference key */
876 static BOOL
get_user_pref_param( UINT offset
, UINT mask
, BOOL
*ret_ptr
)
878 if (!ret_ptr
) return FALSE
;
880 if (!spi_loaded
[SPI_USERPREFERENCEMASK_IDX
])
882 SYSPARAMS_LoadRaw( SPI_USERPREFERENCEMASK_REGKEY
,
883 SPI_USERPREFERENCEMASK_VALNAME
,
884 user_prefs
, sizeof(user_prefs
) );
885 spi_loaded
[SPI_USERPREFERENCEMASK_IDX
] = TRUE
;
887 *ret_ptr
= (user_prefs
[offset
] & mask
) != 0;
891 /* set a boolean parameter in the user preference key */
892 static BOOL
set_user_pref_param( UINT offset
, UINT mask
, BOOL value
, BOOL fWinIni
)
894 SYSPARAMS_LoadRaw( SPI_USERPREFERENCEMASK_REGKEY
,
895 SPI_USERPREFERENCEMASK_VALNAME
,
896 user_prefs
, sizeof(user_prefs
) );
897 spi_loaded
[SPI_USERPREFERENCEMASK_IDX
] = TRUE
;
899 if (value
) user_prefs
[offset
] |= mask
;
900 else user_prefs
[offset
] &= ~mask
;
902 SYSPARAMS_SaveRaw( SPI_USERPREFERENCEMASK_REGKEY
,
903 SPI_USERPREFERENCEMASK_VALNAME
,
904 user_prefs
, sizeof(user_prefs
), REG_BINARY
, fWinIni
);
908 /***********************************************************************
911 * Initialisation of the system metrics array.
913 void SYSPARAMS_Init(void)
915 HKEY hkey
; /* key to the window metrics area of the registry */
920 /* initialize system colors */
922 if (RegCreateKeyExA(HKEY_CURRENT_USER
, "Control Panel\\Colors", 0, 0, 0, KEY_ALL_ACCESS
, 0, &hkey
, 0))
924 for (i
= 0; i
< NUM_SYS_COLORS
; i
++)
928 /* first try, registry */
931 DWORD dwDataSize
= sizeof(buffer
);
932 if (!(RegQueryValueExA(hkey
,DefSysColors
[i
*2], 0, 0, (LPBYTE
) buffer
, &dwDataSize
)))
933 if (sscanf( buffer
, "%d %d %d", &r
, &g
, &b
) == 3) bOk
= TRUE
;
936 /* second try, win.ini */
939 GetProfileStringA( "colors", DefSysColors
[i
*2], DefSysColors
[i
*2+1], buffer
, 100 );
940 if (sscanf( buffer
, " %d %d %d", &r
, &g
, &b
) == 3) bOk
= TRUE
;
943 /* last chance, take the default */
944 if (!bOk
) sscanf( DefSysColors
[i
*2+1], " %d %d %d", &r
, &g
, &b
);
946 SYSPARAMS_SetSysColor( i
, RGB(r
,g
,b
) );
948 if (hkey
) RegCloseKey( hkey
);
950 /* create 55AA bitmap */
952 h55AABitmap
= CreateBitmap( 8, 8, 1, 1, wPattern55AA
);
953 SYSCOLOR_55AABrush
= CreatePatternBrush( h55AABitmap
);
954 __wine_make_gdi_object_system( SYSCOLOR_55AABrush
, TRUE
);
958 /***********************************************************************
961 * Tries to retrieve logfont info from the specified key and value
963 static BOOL
reg_get_logfont(LPCWSTR key
, LPCWSTR value
, LOGFONTW
*lf
)
972 base_keys
[0] = get_volatile_regkey();
973 base_keys
[1] = HKEY_CURRENT_USER
;
975 for(i
= 0; i
< 2 && !found
; i
++)
977 if(RegOpenKeyW(base_keys
[i
], key
, &hkey
) == ERROR_SUCCESS
)
979 size
= sizeof(lfbuf
);
980 if(RegQueryValueExW(hkey
, value
, NULL
, &type
, (LPBYTE
)&lfbuf
, &size
) == ERROR_SUCCESS
&&
983 if( size
== sizeof(lfbuf
))
986 memcpy(lf
, &lfbuf
, size
);
987 } else if( size
== sizeof( LOGFONT16
))
988 { /* win9x-winME format */
990 SYSPARAMS_LogFont16To32W( (LOGFONT16
*) &lfbuf
, lf
);
992 WARN("Unknown format in key %s value %s, size is %d\n",
993 debugstr_w( key
), debugstr_w( value
), size
);
998 if( found
&& lf
->lfHeight
> 0) {
999 /* positive height value means points ( inch/72 ) */
1000 lf
->lfHeight
= -MulDiv( lf
->lfHeight
, get_display_dpi(), 72);
1005 /* load all the minimized metrics */
1006 static void load_minimized_metrics(void)
1009 if (RegOpenKeyExW (HKEY_CURRENT_USER
, METRICS_REGKEY
,
1010 0, KEY_QUERY_VALUE
, &hkey
) != ERROR_SUCCESS
) hkey
= 0;
1012 minimized_metrics
.iWidth
= max( get_reg_metric(hkey
,
1013 METRICS_MINWIDTH_VALNAME
, minimized_metrics
.iWidth
), 0);
1014 minimized_metrics
.iHorzGap
= max( get_reg_metric(hkey
,
1015 METRICS_MINHORZGAP_VALNAME
, minimized_metrics
.iHorzGap
), 0);
1016 minimized_metrics
.iVertGap
= max( get_reg_metric(hkey
,
1017 METRICS_MINVERTGAP_VALNAME
, minimized_metrics
.iVertGap
), 0);
1018 minimized_metrics
.iArrange
= 0x0f & get_reg_metric(hkey
,
1019 METRICS_MINARRANGE_VALNAME
, minimized_metrics
.iArrange
);
1021 if (hkey
) RegCloseKey( hkey
);
1022 spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
] = TRUE
;
1025 /* adjust some of the raw values found in the registry */
1026 static void normalize_nonclientmetrics( NONCLIENTMETRICSW
*pncm
)
1029 if( pncm
->iBorderWidth
< 1) pncm
->iBorderWidth
= 1;
1030 if( pncm
->iCaptionWidth
< 8) pncm
->iCaptionWidth
= 8;
1031 if( pncm
->iScrollWidth
< 8) pncm
->iScrollWidth
= 8;
1032 if( pncm
->iScrollHeight
< 8) pncm
->iScrollHeight
= 8;
1034 /* get some extra metrics */
1035 get_text_metr_size( get_display_dc(), &pncm
->lfMenuFont
,
1037 get_text_metr_size( get_display_dc(), &pncm
->lfCaptionFont
,
1038 NULL
, &CaptionFontAvCharWidth
);
1040 /* adjust some heights to the corresponding font */
1041 pncm
->iMenuHeight
= max( pncm
->iMenuHeight
,
1042 2 + tmMenuFont
.tmHeight
+ tmMenuFont
.tmExternalLeading
);
1043 get_text_metr_size( get_display_dc(), &pncm
->lfCaptionFont
, &tm
, NULL
);
1044 pncm
->iCaptionHeight
= max( pncm
->iCaptionHeight
, 2 + tm
.tmHeight
);
1045 get_text_metr_size( get_display_dc(), &pncm
->lfSmCaptionFont
, &tm
, NULL
);
1046 pncm
->iSmCaptionHeight
= max( pncm
->iSmCaptionHeight
, 2 + tm
.tmHeight
);
1049 /* load all the non-client metrics */
1050 static void load_nonclient_metrics(void)
1053 NONCLIENTMETRICSW ncm
;
1056 ncm
.cbSize
= sizeof (ncm
);
1057 if (RegOpenKeyExW (HKEY_CURRENT_USER
, METRICS_REGKEY
,
1058 0, KEY_QUERY_VALUE
, &hkey
) != ERROR_SUCCESS
) hkey
= 0;
1060 /* initialize geometry entries */
1061 ncm
.iBorderWidth
= get_reg_metric(hkey
, METRICS_BORDERWIDTH_VALNAME
, 1);
1062 ncm
.iScrollWidth
= get_reg_metric(hkey
, METRICS_SCROLLWIDTH_VALNAME
, 16);
1063 ncm
.iScrollHeight
= get_reg_metric(hkey
, METRICS_SCROLLHEIGHT_VALNAME
, 16);
1065 /* size of the normal caption buttons */
1066 ncm
.iCaptionHeight
= get_reg_metric(hkey
, METRICS_CAPTIONHEIGHT_VALNAME
, 18);
1067 ncm
.iCaptionWidth
= get_reg_metric(hkey
, METRICS_CAPTIONWIDTH_VALNAME
, ncm
.iCaptionHeight
);
1069 /* caption font metrics */
1070 if (!reg_get_logfont(METRICS_REGKEY
, METRICS_CAPTIONLOGFONT_VALNAME
, &ncm
.lfCaptionFont
))
1072 SystemParametersInfoW( SPI_GETICONTITLELOGFONT
, 0, &ncm
.lfCaptionFont
, 0 );
1073 ncm
.lfCaptionFont
.lfWeight
= FW_BOLD
;
1076 /* size of the small caption buttons */
1077 ncm
.iSmCaptionWidth
= get_reg_metric(hkey
, METRICS_SMCAPTIONWIDTH_VALNAME
, 13);
1078 ncm
.iSmCaptionHeight
= get_reg_metric(hkey
, METRICS_SMCAPTIONHEIGHT_VALNAME
, 15);
1080 /* small caption font metrics */
1081 if (!reg_get_logfont(METRICS_REGKEY
, METRICS_SMCAPTIONLOGFONT_VALNAME
, &ncm
.lfSmCaptionFont
))
1082 SystemParametersInfoW( SPI_GETICONTITLELOGFONT
, 0, &ncm
.lfSmCaptionFont
, 0 );
1084 /* menus, FIXME: names of registry entries are bogus */
1086 /* size of the menu (MDI) buttons */
1087 ncm
.iMenuHeight
= get_reg_metric(hkey
, METRICS_MENUHEIGHT_VALNAME
, 18);
1088 ncm
.iMenuWidth
= get_reg_metric(hkey
, METRICS_MENUWIDTH_VALNAME
, ncm
.iMenuHeight
);
1090 /* menu font metrics */
1091 if (!reg_get_logfont(METRICS_REGKEY
, METRICS_MENULOGFONT_VALNAME
, &ncm
.lfMenuFont
))
1093 SystemParametersInfoW( SPI_GETICONTITLELOGFONT
, 0, &ncm
.lfMenuFont
, 0 );
1094 GetProfileStringW( Desktop
, MenuFont
, ncm
.lfCaptionFont
.lfFaceName
,
1095 ncm
.lfMenuFont
.lfFaceName
, LF_FACESIZE
);
1096 r
= GetProfileIntW( Desktop
, MenuFontSize
, 0 );
1098 ncm
.lfMenuFont
.lfHeight
= -r
;
1099 ncm
.lfMenuFont
.lfWeight
= FW_NORMAL
;
1102 /* status bar font metrics */
1103 if (!reg_get_logfont(METRICS_REGKEY
, METRICS_STATUSLOGFONT_VALNAME
, &ncm
.lfStatusFont
))
1105 SystemParametersInfoW( SPI_GETICONTITLELOGFONT
, 0, &ncm
.lfStatusFont
, 0 );
1106 GetProfileStringW( Desktop
, StatusFont
, ncm
.lfCaptionFont
.lfFaceName
,
1107 ncm
.lfStatusFont
.lfFaceName
, LF_FACESIZE
);
1108 r
= GetProfileIntW( Desktop
, StatusFontSize
, 0 );
1110 ncm
.lfStatusFont
.lfHeight
= -r
;
1111 ncm
.lfStatusFont
.lfWeight
= FW_NORMAL
;
1114 /* message font metrics */
1115 if (!reg_get_logfont(METRICS_REGKEY
, METRICS_MESSAGELOGFONT_VALNAME
, &ncm
.lfMessageFont
))
1117 SystemParametersInfoW( SPI_GETICONTITLELOGFONT
, 0, &ncm
.lfMessageFont
, 0 );
1118 GetProfileStringW( Desktop
, MessageFont
, ncm
.lfCaptionFont
.lfFaceName
,
1119 ncm
.lfMessageFont
.lfFaceName
, LF_FACESIZE
);
1120 r
= GetProfileIntW( Desktop
, MessageFontSize
, 0 );
1122 ncm
.lfMessageFont
.lfHeight
= -r
;
1123 ncm
.lfMessageFont
.lfWeight
= FW_NORMAL
;
1126 /* some extra fields not in the nonclient structure */
1127 icon_size
.cx
= icon_size
.cy
= get_reg_metric( hkey
, METRICS_ICONSIZE_VALNAME
, 32 );
1129 if (hkey
) RegCloseKey( hkey
);
1130 normalize_nonclientmetrics( &ncm
);
1131 nonclient_metrics
= ncm
;
1132 spi_loaded
[SPI_NONCLIENTMETRICS_IDX
] = TRUE
;
1135 static BOOL CALLBACK
enum_monitors( HMONITOR monitor
, HDC hdc
, LPRECT rect
, LPARAM lp
)
1139 mi
.cbSize
= sizeof(mi
);
1140 if (GetMonitorInfoW( monitor
, &mi
) && (mi
.dwFlags
& MONITORINFOF_PRIMARY
))
1142 LPRECT work
= (LPRECT
)lp
;
1149 /***********************************************************************
1150 * SystemParametersInfoW (USER32.@)
1152 * Each system parameter has flag which shows whether the parameter
1153 * is loaded or not. Parameters, stored directly in SysParametersInfo are
1154 * loaded from registry only when they are requested and the flag is
1155 * "false", after the loading the flag is set to "true". On interprocess
1156 * notification of the parameter change the corresponding parameter flag is
1157 * set to "false". The parameter value will be reloaded when it is requested
1159 * Parameters, backed by or depend on GetSystemMetrics are processed
1160 * differently. These parameters are always loaded. They are reloaded right
1161 * away on interprocess change notification. We can't do lazy loading because
1162 * we don't want to complicate GetSystemMetrics.
1163 * Parameters, backed by X settings are read from corresponding setting.
1164 * On the parameter change request the setting is changed. Interprocess change
1165 * notifications are ignored.
1166 * When parameter value is updated the changed value is stored in permanent
1167 * registry branch if saving is requested. Otherwise it is stored
1168 * in temporary branch
1170 * Some SPI values can also be stored as Twips values in the registry,
1171 * don't forget the conversion!
1173 BOOL WINAPI
SystemParametersInfoW( UINT uiAction
, UINT uiParam
,
1174 PVOID pvParam
, UINT fWinIni
)
1176 #define WINE_SPI_FIXME(x) \
1179 static BOOL warn = TRUE; \
1183 FIXME( "Unimplemented action: %u (%s)\n", x, #x ); \
1186 SetLastError( ERROR_INVALID_SPI_VALUE ); \
1189 #define WINE_SPI_WARN(x) \
1191 WARN( "Ignored action: %u (%s)\n", x, #x ); \
1195 unsigned spi_idx
= 0;
1199 case SPI_GETBEEP
: /* 1 */
1200 if (!pvParam
) return FALSE
;
1202 spi_idx
= SPI_SETBEEP_IDX
;
1203 if (!spi_loaded
[spi_idx
])
1207 if (SYSPARAMS_Load( SPI_SETBEEP_REGKEY
, SPI_SETBEEP_VALNAME
, buf
, sizeof(buf
) ))
1208 beep_active
= !lstrcmpiW( Yes
, buf
);
1209 spi_loaded
[spi_idx
] = TRUE
;
1212 *(BOOL
*)pvParam
= beep_active
;
1215 case SPI_SETBEEP
: /* 2 */
1216 spi_idx
= SPI_SETBEEP_IDX
;
1217 if (SYSPARAMS_Save( SPI_SETBEEP_REGKEY
, SPI_SETBEEP_VALNAME
,
1218 (uiParam
? Yes
: No
), fWinIni
))
1220 beep_active
= uiParam
;
1221 spi_loaded
[spi_idx
] = TRUE
;
1227 case SPI_GETMOUSE
: /* 3 */
1228 if (!pvParam
) return FALSE
;
1230 spi_idx
= SPI_SETMOUSE_IDX
;
1231 if (!spi_loaded
[spi_idx
])
1235 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY
, SPI_SETMOUSE_VALNAME1
,
1237 mouse_threshold1
= atoiW( buf
);
1238 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY
, SPI_SETMOUSE_VALNAME2
,
1240 mouse_threshold2
= atoiW( buf
);
1241 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY
, SPI_SETMOUSE_VALNAME3
,
1243 mouse_speed
= atoiW( buf
);
1244 spi_loaded
[spi_idx
] = TRUE
;
1246 ((INT
*)pvParam
)[0] = mouse_threshold1
;
1247 ((INT
*)pvParam
)[1] = mouse_threshold2
;
1248 ((INT
*)pvParam
)[2] = mouse_speed
;
1251 case SPI_SETMOUSE
: /* 4 */
1253 if (!pvParam
) return FALSE
;
1254 ret
= set_int_param( SPI_SETMOUSE_IDX
, SPI_SETMOUSE_REGKEY
, SPI_SETMOUSE_VALNAME1
,
1255 &mouse_threshold1
, ((INT
*)pvParam
)[0], fWinIni
);
1257 save_int_param( SPI_SETMOUSE_REGKEY
, SPI_SETMOUSE_VALNAME2
,
1258 &mouse_threshold2
, ((INT
*)pvParam
)[1], fWinIni
);
1259 save_int_param( SPI_SETMOUSE_REGKEY
, SPI_SETMOUSE_VALNAME3
,
1260 &mouse_speed
, ((INT
*)pvParam
)[2], fWinIni
);
1266 ret
= get_twips_param( SPI_SETBORDER_IDX
,
1267 SPI_SETBORDER_REGKEY
,
1268 SPI_SETBORDER_VALNAME
,
1270 if( *(INT
*)pvParam
< 1) *(INT
*)pvParam
= 1;
1274 nonclient_metrics
.iBorderWidth
= uiParam
> 0 ? uiParam
: 1;
1275 /* raw value goes to registry */
1276 ret
= set_uint_param( SPI_SETBORDER_IDX
,
1277 SPI_SETBORDER_REGKEY
,
1278 SPI_SETBORDER_VALNAME
,
1279 &border
, uiParam
, fWinIni
);
1282 case SPI_GETKEYBOARDSPEED
:
1283 ret
= get_uint_param( SPI_SETKEYBOARDSPEED_IDX
,
1284 SPI_SETKEYBOARDSPEED_REGKEY
,
1285 SPI_SETKEYBOARDSPEED_VALNAME
,
1286 &keyboard_speed
, pvParam
);
1289 case SPI_SETKEYBOARDSPEED
:
1290 if (uiParam
> 31) uiParam
= 31;
1291 ret
= set_uint_param( SPI_SETKEYBOARDSPEED_IDX
,
1292 SPI_SETKEYBOARDSPEED_REGKEY
,
1293 SPI_SETKEYBOARDSPEED_VALNAME
,
1294 &keyboard_speed
, uiParam
, fWinIni
);
1297 /* not implemented in Windows */
1298 WINE_SPI_WARN(SPI_LANGDRIVER
); /* 12 */
1300 case SPI_ICONHORIZONTALSPACING
:
1301 if (pvParam
!= NULL
)
1303 ret
= get_twips_param( SPI_ICONHORIZONTALSPACING_IDX
,
1304 SPI_ICONHORIZONTALSPACING_REGKEY
,
1305 SPI_ICONHORIZONTALSPACING_VALNAME
,
1306 (UINT
*)&icon_metrics
.iHorzSpacing
, pvParam
);
1310 if (uiParam
< 32) uiParam
= 32;
1311 ret
= set_uint_param( SPI_ICONHORIZONTALSPACING_IDX
,
1312 SPI_ICONHORIZONTALSPACING_REGKEY
,
1313 SPI_ICONHORIZONTALSPACING_VALNAME
,
1314 (UINT
*)&icon_metrics
.iHorzSpacing
, uiParam
, fWinIni
);
1318 case SPI_GETSCREENSAVETIMEOUT
:
1319 ret
= get_uint_param( SPI_SETSCREENSAVETIMEOUT_IDX
,
1320 SPI_SETSCREENSAVETIMEOUT_REGKEY
,
1321 SPI_SETSCREENSAVETIMEOUT_VALNAME
,
1322 &screensave_timeout
, pvParam
);
1325 case SPI_SETSCREENSAVETIMEOUT
:
1326 ret
= set_uint_param( SPI_SETSCREENSAVETIMEOUT_IDX
,
1327 SPI_SETSCREENSAVETIMEOUT_REGKEY
,
1328 SPI_SETSCREENSAVETIMEOUT_VALNAME
,
1329 &screensave_timeout
, uiParam
, fWinIni
);
1332 case SPI_GETSCREENSAVEACTIVE
: /* 16 */
1333 if (!pvParam
) return FALSE
;
1334 *(BOOL
*)pvParam
= USER_Driver
->pGetScreenSaveActive();
1337 case SPI_SETSCREENSAVEACTIVE
: /* 17 */
1341 wsprintfW(buf
, CSu
, uiParam
);
1342 USER_Driver
->pSetScreenSaveActive( uiParam
);
1343 /* saved value does not affect Wine */
1344 SYSPARAMS_Save( SPI_SETSCREENSAVEACTIVE_REGKEY
,
1345 SPI_SETSCREENSAVEACTIVE_VALNAME
,
1350 case SPI_GETGRIDGRANULARITY
:
1351 ret
= get_uint_param( SPI_SETGRIDGRANULARITY_IDX
,
1352 SPI_SETGRIDGRANULARITY_REGKEY
,
1353 SPI_SETGRIDGRANULARITY_VALNAME
,
1354 &grid_granularity
, pvParam
);
1357 case SPI_SETGRIDGRANULARITY
:
1358 ret
= set_uint_param( SPI_SETGRIDGRANULARITY_IDX
,
1359 SPI_SETGRIDGRANULARITY_REGKEY
,
1360 SPI_SETGRIDGRANULARITY_VALNAME
,
1361 &grid_granularity
, uiParam
, fWinIni
);
1364 case SPI_SETDESKWALLPAPER
: /* 20 */
1365 if (!pvParam
|| !SetDeskWallPaper( pvParam
)) return FALSE
;
1366 SYSPARAMS_Save(SPI_SETDESKWALLPAPER_REGKEY
, SPI_SETDESKWALLPAPER_VALNAME
, pvParam
, fWinIni
);
1369 case SPI_SETDESKPATTERN
: /* 21 */
1370 /* FIXME: the ability to specify a pattern in pvParam
1371 doesn't seem to be documented for Win32 */
1372 if ((INT16
)uiParam
== -1)
1375 GetProfileStringW( Desktop
, Pattern
,
1377 buf
, sizeof(buf
)/sizeof(WCHAR
) );
1378 ret
= DESKTOP_SetPattern( buf
);
1380 ret
= DESKTOP_SetPattern( pvParam
);
1383 case SPI_GETKEYBOARDDELAY
:
1384 ret
= get_uint_param( SPI_SETKEYBOARDDELAY_IDX
,
1385 SPI_SETKEYBOARDDELAY_REGKEY
,
1386 SPI_SETKEYBOARDDELAY_VALNAME
,
1387 &keyboard_delay
, pvParam
);
1390 case SPI_SETKEYBOARDDELAY
:
1391 ret
= set_uint_param( SPI_SETKEYBOARDDELAY_IDX
,
1392 SPI_SETKEYBOARDDELAY_REGKEY
,
1393 SPI_SETKEYBOARDDELAY_VALNAME
,
1394 &keyboard_delay
, uiParam
, fWinIni
);
1397 case SPI_ICONVERTICALSPACING
:
1398 if (pvParam
!= NULL
)
1400 ret
= get_twips_param( SPI_ICONVERTICALSPACING_IDX
,
1401 SPI_ICONVERTICALSPACING_REGKEY
,
1402 SPI_ICONVERTICALSPACING_VALNAME
,
1403 (UINT
*)&icon_metrics
.iVertSpacing
, pvParam
);
1404 if( icon_metrics
.iVertSpacing
< 32)
1405 icon_metrics
.iVertSpacing
= 32;
1409 if (uiParam
< 32) uiParam
= 32;
1410 ret
= set_uint_param( SPI_ICONVERTICALSPACING_IDX
,
1411 SPI_ICONVERTICALSPACING_REGKEY
,
1412 SPI_ICONVERTICALSPACING_VALNAME
,
1413 (UINT
*)&icon_metrics
.iVertSpacing
, uiParam
, fWinIni
);
1417 case SPI_GETICONTITLEWRAP
:
1418 ret
= get_bool_param( SPI_SETICONTITLEWRAP_IDX
,
1419 SPI_SETICONTITLEWRAP_REGKEY1
,
1420 SPI_SETICONTITLEWRAP_VALNAME
,
1421 &icon_metrics
.iTitleWrap
, pvParam
);
1424 case SPI_SETICONTITLEWRAP
:
1425 ret
= set_bool_param_mirrored( SPI_SETICONTITLEWRAP_IDX
,
1426 SPI_SETICONTITLEWRAP_REGKEY1
,
1427 SPI_SETICONTITLEWRAP_REGKEY2
,
1428 SPI_SETICONTITLEWRAP_VALNAME
,
1429 &icon_metrics
.iTitleWrap
, uiParam
, fWinIni
);
1432 case SPI_GETMENUDROPALIGNMENT
:
1433 ret
= get_uint_param( SPI_SETMENUDROPALIGNMENT_IDX
,
1434 SPI_SETMENUDROPALIGNMENT_REGKEY1
,
1435 SPI_SETMENUDROPALIGNMENT_VALNAME
,
1436 &menu_drop_alignment
, pvParam
);
1439 case SPI_SETMENUDROPALIGNMENT
:
1440 ret
= set_uint_param_mirrored( SPI_SETMENUDROPALIGNMENT_IDX
,
1441 SPI_SETMENUDROPALIGNMENT_REGKEY1
,
1442 SPI_SETMENUDROPALIGNMENT_REGKEY2
,
1443 SPI_SETMENUDROPALIGNMENT_VALNAME
,
1444 &menu_drop_alignment
, uiParam
, fWinIni
);
1447 case SPI_SETDOUBLECLKWIDTH
:
1448 ret
= set_uint_param_mirrored( SPI_SETDOUBLECLKWIDTH_IDX
,
1449 SPI_SETDOUBLECLKWIDTH_REGKEY1
,
1450 SPI_SETDOUBLECLKWIDTH_REGKEY2
,
1451 SPI_SETDOUBLECLKWIDTH_VALNAME
,
1452 &double_click_width
, uiParam
, fWinIni
);
1455 case SPI_SETDOUBLECLKHEIGHT
:
1456 ret
= set_uint_param_mirrored( SPI_SETDOUBLECLKHEIGHT_IDX
,
1457 SPI_SETDOUBLECLKHEIGHT_REGKEY1
,
1458 SPI_SETDOUBLECLKHEIGHT_REGKEY2
,
1459 SPI_SETDOUBLECLKHEIGHT_VALNAME
,
1460 &double_click_height
, uiParam
, fWinIni
);
1463 case SPI_GETICONTITLELOGFONT
:
1467 if (!pvParam
) return FALSE
;
1469 spi_idx
= SPI_SETICONTITLELOGFONT_IDX
;
1470 if (!spi_loaded
[spi_idx
])
1472 if (!reg_get_logfont( SPI_SETICONTITLELOGFONT_REGKEY
,
1473 SPI_SETICONTITLELOGFONT_VALNAME
, &icon_metrics
.lfFont
))
1478 * The 'default GDI fonts' seems to be returned.
1479 * If a returned font is not a correct font in your environment,
1480 * please try to fix objects/gdiobj.c at first.
1482 GetObjectW( GetStockObject( DEFAULT_GUI_FONT
), sizeof(LOGFONTW
), &lfDefault
);
1484 GetProfileStringW( Desktop
, IconTitleFaceName
,
1485 lfDefault
.lfFaceName
,
1486 icon_metrics
.lfFont
.lfFaceName
,
1489 r
= GetProfileIntW( Desktop
, IconTitleSize
, 0 );
1491 icon_metrics
.lfFont
.lfHeight
= -r
;
1493 icon_metrics
.lfFont
.lfHeight
= lfDefault
.lfHeight
;
1495 icon_metrics
.lfFont
.lfWidth
= 0;
1496 icon_metrics
.lfFont
.lfEscapement
= icon_metrics
.lfFont
.lfOrientation
= 0;
1497 icon_metrics
.lfFont
.lfWeight
= FW_NORMAL
;
1498 icon_metrics
.lfFont
.lfItalic
= FALSE
;
1499 icon_metrics
.lfFont
.lfStrikeOut
= FALSE
;
1500 icon_metrics
.lfFont
.lfUnderline
= FALSE
;
1501 icon_metrics
.lfFont
.lfCharSet
= lfDefault
.lfCharSet
; /* at least 'charset' should not be hard-coded */
1502 icon_metrics
.lfFont
.lfOutPrecision
= OUT_DEFAULT_PRECIS
;
1503 icon_metrics
.lfFont
.lfClipPrecision
= CLIP_DEFAULT_PRECIS
;
1504 icon_metrics
.lfFont
.lfQuality
= DEFAULT_QUALITY
;
1505 icon_metrics
.lfFont
.lfPitchAndFamily
= DEFAULT_PITCH
;
1506 spi_loaded
[spi_idx
] = TRUE
;
1509 *(LOGFONTW
*)pvParam
= icon_metrics
.lfFont
;
1513 case SPI_SETDOUBLECLICKTIME
:
1514 ret
= set_uint_param( SPI_SETDOUBLECLICKTIME_IDX
,
1515 SPI_SETDOUBLECLICKTIME_REGKEY
,
1516 SPI_SETDOUBLECLICKTIME_VALNAME
,
1517 &double_click_time
, uiParam
, fWinIni
);
1520 case SPI_SETMOUSEBUTTONSWAP
:
1521 ret
= set_bool_param( SPI_SETMOUSEBUTTONSWAP_IDX
,
1522 SPI_SETMOUSEBUTTONSWAP_REGKEY
,
1523 SPI_SETMOUSEBUTTONSWAP_VALNAME
,
1524 &swap_buttons
, uiParam
, fWinIni
);
1527 case SPI_SETICONTITLELOGFONT
: /* 34 */
1528 if( uiParam
== sizeof(LOGFONTW
)) {
1529 ret
= SYSPARAMS_SaveLogFont( SPI_SETICONTITLELOGFONT_REGKEY
,
1530 SPI_SETICONTITLELOGFONT_VALNAME
, pvParam
, fWinIni
);
1532 icon_metrics
.lfFont
= *(LOGFONTW
*)pvParam
;
1533 spi_loaded
[SPI_SETICONTITLELOGFONT_IDX
] = TRUE
;
1539 case SPI_GETFASTTASKSWITCH
: /* 35 */
1540 if (!pvParam
) return FALSE
;
1541 *(BOOL
*)pvParam
= 1;
1544 case SPI_SETFASTTASKSWITCH
: /* 36 */
1545 /* the action is disabled */
1549 case SPI_SETDRAGFULLWINDOWS
:
1550 ret
= set_bool_param( SPI_SETDRAGFULLWINDOWS_IDX
,
1551 SPI_SETDRAGFULLWINDOWS_REGKEY
,
1552 SPI_SETDRAGFULLWINDOWS_VALNAME
,
1553 &drag_full_windows
, uiParam
, fWinIni
);
1556 case SPI_GETDRAGFULLWINDOWS
:
1557 ret
= get_bool_param( SPI_SETDRAGFULLWINDOWS_IDX
,
1558 SPI_SETDRAGFULLWINDOWS_REGKEY
,
1559 SPI_SETDRAGFULLWINDOWS_VALNAME
,
1560 &drag_full_windows
, pvParam
);
1563 case SPI_GETNONCLIENTMETRICS
:
1565 LPNONCLIENTMETRICSW lpnm
= pvParam
;
1567 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
1569 if (lpnm
&& lpnm
->cbSize
== sizeof(NONCLIENTMETRICSW
))
1570 *lpnm
= nonclient_metrics
;
1576 case SPI_SETNONCLIENTMETRICS
:
1578 LPNONCLIENTMETRICSW lpnm
= pvParam
;
1580 if (lpnm
&& lpnm
->cbSize
== sizeof(NONCLIENTMETRICSW
))
1582 NONCLIENTMETRICSW ncm
;
1583 ret
= set_uint_param( SPI_SETBORDER_IDX
,
1584 SPI_SETBORDER_REGKEY
, SPI_SETBORDER_VALNAME
,
1585 &border
, lpnm
->iBorderWidth
, fWinIni
);
1586 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1587 METRICS_SCROLLWIDTH_VALNAME
, NULL
,
1588 lpnm
->iScrollWidth
, fWinIni
);
1589 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1590 METRICS_SCROLLHEIGHT_VALNAME
, NULL
,
1591 lpnm
->iScrollHeight
, fWinIni
);
1592 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1593 METRICS_CAPTIONWIDTH_VALNAME
, NULL
,
1594 lpnm
->iCaptionWidth
, fWinIni
);
1595 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1596 METRICS_CAPTIONHEIGHT_VALNAME
, NULL
,
1597 lpnm
->iCaptionHeight
, fWinIni
);
1598 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1599 METRICS_SMCAPTIONWIDTH_VALNAME
, NULL
,
1600 lpnm
->iSmCaptionWidth
, fWinIni
);
1601 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1602 METRICS_SMCAPTIONHEIGHT_VALNAME
, NULL
,
1603 lpnm
->iSmCaptionHeight
, fWinIni
);
1604 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1605 METRICS_MENUWIDTH_VALNAME
, NULL
,
1606 lpnm
->iMenuWidth
, fWinIni
);
1607 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1608 METRICS_MENUHEIGHT_VALNAME
, NULL
,
1609 lpnm
->iMenuHeight
, fWinIni
);
1610 if( ret
) ret
= SYSPARAMS_SaveLogFont(
1611 METRICS_REGKEY
, METRICS_MENULOGFONT_VALNAME
,
1612 &lpnm
->lfMenuFont
, fWinIni
);
1613 if( ret
) ret
= SYSPARAMS_SaveLogFont(
1614 METRICS_REGKEY
, METRICS_CAPTIONLOGFONT_VALNAME
,
1615 &lpnm
->lfCaptionFont
, fWinIni
);
1616 if( ret
) ret
= SYSPARAMS_SaveLogFont(
1617 METRICS_REGKEY
, METRICS_SMCAPTIONLOGFONT_VALNAME
,
1618 &lpnm
->lfSmCaptionFont
, fWinIni
);
1619 if( ret
) ret
= SYSPARAMS_SaveLogFont(
1620 METRICS_REGKEY
, METRICS_STATUSLOGFONT_VALNAME
,
1621 &lpnm
->lfStatusFont
, fWinIni
);
1622 if( ret
) ret
= SYSPARAMS_SaveLogFont(
1623 METRICS_REGKEY
, METRICS_MESSAGELOGFONT_VALNAME
,
1624 &lpnm
->lfMessageFont
, fWinIni
);
1627 normalize_nonclientmetrics( &ncm
);
1628 nonclient_metrics
= ncm
;
1629 spi_loaded
[SPI_NONCLIENTMETRICS_IDX
] = TRUE
;
1635 case SPI_GETMINIMIZEDMETRICS
:
1637 MINIMIZEDMETRICS
* lpMm
= pvParam
;
1638 if (lpMm
&& lpMm
->cbSize
== sizeof(*lpMm
)) {
1639 if( spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
]) load_minimized_metrics();
1640 *lpMm
= minimized_metrics
;
1646 case SPI_SETMINIMIZEDMETRICS
:
1648 MINIMIZEDMETRICS
* lpMm
= pvParam
;
1649 if (lpMm
&& lpMm
->cbSize
== sizeof(*lpMm
)) {
1650 ret
= save_int_param( METRICS_REGKEY
, METRICS_MINWIDTH_VALNAME
,
1651 &minimized_metrics
.iWidth
, max( lpMm
->iWidth
, 0), fWinIni
);
1652 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1653 METRICS_MINHORZGAP_VALNAME
, &minimized_metrics
.iHorzGap
,
1654 max( lpMm
->iHorzGap
, 0), fWinIni
);
1655 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1656 METRICS_MINVERTGAP_VALNAME
, &minimized_metrics
.iVertGap
,
1657 max( lpMm
->iVertGap
, 0), fWinIni
);
1658 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1659 METRICS_MINARRANGE_VALNAME
, &minimized_metrics
.iArrange
,
1660 0x0f & lpMm
->iArrange
, fWinIni
);
1661 if( ret
) spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
] = TRUE
;
1667 case SPI_GETICONMETRICS
:
1669 LPICONMETRICSW lpIcon
= pvParam
;
1670 if(lpIcon
&& lpIcon
->cbSize
== sizeof(*lpIcon
))
1672 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING
, 0,
1673 &lpIcon
->iHorzSpacing
, FALSE
);
1674 SystemParametersInfoW( SPI_ICONVERTICALSPACING
, 0,
1675 &lpIcon
->iVertSpacing
, FALSE
);
1676 SystemParametersInfoW( SPI_GETICONTITLEWRAP
, 0,
1677 &lpIcon
->iTitleWrap
, FALSE
);
1678 SystemParametersInfoW( SPI_GETICONTITLELOGFONT
, 0,
1679 &lpIcon
->lfFont
, FALSE
);
1688 case SPI_SETICONMETRICS
:
1690 LPICONMETRICSW lpIcon
= pvParam
;
1691 if (lpIcon
&& lpIcon
->cbSize
== sizeof(*lpIcon
)) {
1692 ret
= set_int_param( SPI_ICONVERTICALSPACING_IDX
,
1693 SPI_ICONVERTICALSPACING_REGKEY
,
1694 SPI_ICONVERTICALSPACING_VALNAME
,
1695 &icon_metrics
.iVertSpacing
,
1696 lpIcon
->iVertSpacing
, fWinIni
);
1698 ret
= set_int_param( SPI_ICONHORIZONTALSPACING_IDX
,
1699 SPI_ICONHORIZONTALSPACING_REGKEY
,
1700 SPI_ICONHORIZONTALSPACING_VALNAME
,
1701 &icon_metrics
.iHorzSpacing
,
1702 lpIcon
->iHorzSpacing
, fWinIni
);
1705 ret
= set_bool_param_mirrored( SPI_SETICONTITLEWRAP_IDX
,
1706 SPI_SETICONTITLEWRAP_REGKEY1
, SPI_SETICONTITLEWRAP_REGKEY2
,
1707 SPI_SETICONTITLEWRAP_VALNAME
, &icon_metrics
.iTitleWrap
,
1708 lpIcon
->iTitleWrap
, fWinIni
);
1710 if( ret
) ret
= SYSPARAMS_SaveLogFont( SPI_SETICONTITLELOGFONT_REGKEY
,
1711 SPI_SETICONTITLELOGFONT_VALNAME
, &lpIcon
->lfFont
, fWinIni
);
1713 icon_metrics
.lfFont
= lpIcon
->lfFont
;
1714 spi_loaded
[SPI_SETICONTITLELOGFONT_IDX
] = TRUE
;
1721 case SPI_SETWORKAREA
: /* 47 WINVER >= 0x400 */
1723 if (!pvParam
) return FALSE
;
1725 spi_idx
= SPI_SETWORKAREA_IDX
;
1726 CopyRect( &work_area
, pvParam
);
1727 spi_loaded
[spi_idx
] = TRUE
;
1731 case SPI_GETWORKAREA
: /* 48 WINVER >= 0x400 */
1733 if (!pvParam
) return FALSE
;
1735 spi_idx
= SPI_SETWORKAREA_IDX
;
1736 if (!spi_loaded
[spi_idx
])
1738 SetRect( &work_area
, 0, 0,
1739 GetSystemMetrics( SM_CXSCREEN
),
1740 GetSystemMetrics( SM_CYSCREEN
) );
1741 EnumDisplayMonitors( 0, NULL
, enum_monitors
, (LPARAM
)&work_area
);
1742 spi_loaded
[spi_idx
] = TRUE
;
1744 CopyRect( pvParam
, &work_area
);
1745 TRACE("work area %s\n", wine_dbgstr_rect( &work_area
));
1749 WINE_SPI_FIXME(SPI_SETPENWINDOWS
); /* 49 WINVER >= 0x400 */
1751 case SPI_GETFILTERKEYS
: /* 50 */
1753 LPFILTERKEYS lpFilterKeys
= pvParam
;
1754 WARN("SPI_GETFILTERKEYS not fully implemented\n");
1755 if (lpFilterKeys
&& lpFilterKeys
->cbSize
== sizeof(FILTERKEYS
))
1757 /* Indicate that no FilterKeys feature available */
1758 lpFilterKeys
->dwFlags
= 0;
1759 lpFilterKeys
->iWaitMSec
= 0;
1760 lpFilterKeys
->iDelayMSec
= 0;
1761 lpFilterKeys
->iRepeatMSec
= 0;
1762 lpFilterKeys
->iBounceMSec
= 0;
1770 WINE_SPI_FIXME(SPI_SETFILTERKEYS
); /* 51 */
1772 case SPI_GETTOGGLEKEYS
: /* 52 */
1774 LPTOGGLEKEYS lpToggleKeys
= pvParam
;
1775 WARN("SPI_GETTOGGLEKEYS not fully implemented\n");
1776 if (lpToggleKeys
&& lpToggleKeys
->cbSize
== sizeof(TOGGLEKEYS
))
1778 /* Indicate that no ToggleKeys feature available */
1779 lpToggleKeys
->dwFlags
= 0;
1787 WINE_SPI_FIXME(SPI_SETTOGGLEKEYS
); /* 53 */
1789 case SPI_GETMOUSEKEYS
: /* 54 */
1791 LPMOUSEKEYS lpMouseKeys
= pvParam
;
1792 WARN("SPI_GETMOUSEKEYS not fully implemented\n");
1793 if (lpMouseKeys
&& lpMouseKeys
->cbSize
== sizeof(MOUSEKEYS
))
1795 /* Indicate that no MouseKeys feature available */
1796 lpMouseKeys
->dwFlags
= 0;
1797 lpMouseKeys
->iMaxSpeed
= 360;
1798 lpMouseKeys
->iTimeToMaxSpeed
= 1000;
1799 lpMouseKeys
->iCtrlSpeed
= 0;
1800 lpMouseKeys
->dwReserved1
= 0;
1801 lpMouseKeys
->dwReserved2
= 0;
1809 WINE_SPI_FIXME(SPI_SETMOUSEKEYS
); /* 55 */
1811 case SPI_GETSHOWSOUNDS
:
1812 ret
= get_bool_param( SPI_SETSHOWSOUNDS_IDX
,
1813 SPI_SETSHOWSOUNDS_REGKEY
,
1814 SPI_SETSHOWSOUNDS_VALNAME
,
1815 &show_sounds
, pvParam
);
1818 case SPI_SETSHOWSOUNDS
:
1819 ret
= set_bool_param( SPI_SETSHOWSOUNDS_IDX
,
1820 SPI_SETSHOWSOUNDS_REGKEY
,
1821 SPI_SETSHOWSOUNDS_VALNAME
,
1822 &show_sounds
, uiParam
, fWinIni
);
1825 case SPI_GETSTICKYKEYS
: /* 58 */
1827 LPSTICKYKEYS lpStickyKeys
= pvParam
;
1828 WARN("SPI_GETSTICKYKEYS not fully implemented\n");
1829 if (lpStickyKeys
&& lpStickyKeys
->cbSize
== sizeof(STICKYKEYS
))
1831 /* Indicate that no StickyKeys feature available */
1832 lpStickyKeys
->dwFlags
= 0;
1840 WINE_SPI_FIXME(SPI_SETSTICKYKEYS
); /* 59 */
1842 case SPI_GETACCESSTIMEOUT
: /* 60 */
1844 LPACCESSTIMEOUT lpAccessTimeout
= pvParam
;
1845 WARN("SPI_GETACCESSTIMEOUT not fully implemented\n");
1846 if (lpAccessTimeout
&& lpAccessTimeout
->cbSize
== sizeof(ACCESSTIMEOUT
))
1848 /* Indicate that no accessibility features timeout is available */
1849 lpAccessTimeout
->dwFlags
= 0;
1850 lpAccessTimeout
->iTimeOutMSec
= 0;
1858 WINE_SPI_FIXME(SPI_SETACCESSTIMEOUT
); /* 61 */
1860 case SPI_GETSERIALKEYS
: /* 62 WINVER >= 0x400 */
1862 LPSERIALKEYSW lpSerialKeysW
= pvParam
;
1863 WARN("SPI_GETSERIALKEYS not fully implemented\n");
1864 if (lpSerialKeysW
&& lpSerialKeysW
->cbSize
== sizeof(SERIALKEYSW
))
1866 /* Indicate that no SerialKeys feature available */
1867 lpSerialKeysW
->dwFlags
= 0;
1868 lpSerialKeysW
->lpszActivePort
= NULL
;
1869 lpSerialKeysW
->lpszPort
= NULL
;
1870 lpSerialKeysW
->iBaudRate
= 0;
1871 lpSerialKeysW
->iPortState
= 0;
1879 WINE_SPI_FIXME(SPI_SETSERIALKEYS
); /* 63 WINVER >= 0x400 */
1881 case SPI_GETSOUNDSENTRY
: /* 64 */
1883 LPSOUNDSENTRYW lpSoundSentryW
= pvParam
;
1884 WARN("SPI_GETSOUNDSENTRY not fully implemented\n");
1885 if (lpSoundSentryW
&& lpSoundSentryW
->cbSize
== sizeof(SOUNDSENTRYW
))
1887 /* Indicate that no SoundSentry feature available */
1888 lpSoundSentryW
->dwFlags
= 0;
1889 lpSoundSentryW
->iFSTextEffect
= 0;
1890 lpSoundSentryW
->iFSTextEffectMSec
= 0;
1891 lpSoundSentryW
->iFSTextEffectColorBits
= 0;
1892 lpSoundSentryW
->iFSGrafEffect
= 0;
1893 lpSoundSentryW
->iFSGrafEffectMSec
= 0;
1894 lpSoundSentryW
->iFSGrafEffectColor
= 0;
1895 lpSoundSentryW
->iWindowsEffect
= 0;
1896 lpSoundSentryW
->iWindowsEffectMSec
= 0;
1897 lpSoundSentryW
->lpszWindowsEffectDLL
= 0;
1898 lpSoundSentryW
->iWindowsEffectOrdinal
= 0;
1906 WINE_SPI_FIXME(SPI_SETSOUNDSENTRY
); /* 65 */
1908 case SPI_GETHIGHCONTRAST
: /* 66 WINVER >= 0x400 */
1910 LPHIGHCONTRASTW lpHighContrastW
= pvParam
;
1911 WARN("SPI_GETHIGHCONTRAST not fully implemented\n");
1912 if (lpHighContrastW
&& lpHighContrastW
->cbSize
== sizeof(HIGHCONTRASTW
))
1914 /* Indicate that no high contrast feature available */
1915 lpHighContrastW
->dwFlags
= 0;
1916 lpHighContrastW
->lpszDefaultScheme
= NULL
;
1924 WINE_SPI_FIXME(SPI_SETHIGHCONTRAST
); /* 67 WINVER >= 0x400 */
1926 case SPI_GETKEYBOARDPREF
:
1927 ret
= get_bool_param( SPI_SETKEYBOARDPREF_IDX
,
1928 SPI_SETKEYBOARDPREF_REGKEY
,
1929 SPI_SETKEYBOARDPREF_VALNAME
,
1930 &keyboard_pref
, pvParam
);
1933 case SPI_SETKEYBOARDPREF
:
1934 ret
= set_bool_param( SPI_SETKEYBOARDPREF_IDX
,
1935 SPI_SETKEYBOARDPREF_REGKEY
,
1936 SPI_SETKEYBOARDPREF_VALNAME
,
1937 &keyboard_pref
, uiParam
, fWinIni
);
1940 case SPI_GETSCREENREADER
:
1941 ret
= get_bool_param( SPI_SETSCREENREADER_IDX
,
1942 SPI_SETSCREENREADER_REGKEY
,
1943 SPI_SETSCREENREADER_VALNAME
,
1944 &screen_reader
, pvParam
);
1947 case SPI_SETSCREENREADER
:
1948 ret
= set_bool_param( SPI_SETSCREENREADER_IDX
,
1949 SPI_SETSCREENREADER_REGKEY
,
1950 SPI_SETSCREENREADER_VALNAME
,
1951 &screen_reader
, uiParam
, fWinIni
);
1954 case SPI_GETANIMATION
: /* 72 WINVER >= 0x400 */
1956 LPANIMATIONINFO lpAnimInfo
= pvParam
;
1958 /* Tell it "disabled" */
1959 if (lpAnimInfo
&& lpAnimInfo
->cbSize
== sizeof(ANIMATIONINFO
))
1960 lpAnimInfo
->iMinAnimate
= 0; /* Minimise and restore animation is disabled (nonzero == enabled) */
1965 WINE_SPI_WARN(SPI_SETANIMATION
); /* 73 WINVER >= 0x400 */
1967 case SPI_GETFONTSMOOTHING
:
1970 ret
= get_uint_param( SPI_SETFONTSMOOTHING_IDX
,
1971 SPI_SETFONTSMOOTHING_REGKEY
,
1972 SPI_SETFONTSMOOTHING_VALNAME
,
1973 &font_smoothing
, &tmpval
);
1974 if (!pvParam
) ret
= FALSE
;
1977 *(UINT
*) pvParam
= ( tmpval
!= 0);
1980 case SPI_SETFONTSMOOTHING
:
1981 uiParam
= uiParam
? 2 : 0; /* Win NT4/2k/XP behavior */
1982 ret
= set_uint_param( SPI_SETFONTSMOOTHING_IDX
,
1983 SPI_SETFONTSMOOTHING_REGKEY
,
1984 SPI_SETFONTSMOOTHING_VALNAME
,
1985 &font_smoothing
, uiParam
, fWinIni
);
1988 WINE_SPI_FIXME(SPI_SETDRAGWIDTH
); /* 76 WINVER >= 0x400 */
1989 WINE_SPI_FIXME(SPI_SETDRAGHEIGHT
); /* 77 WINVER >= 0x400 */
1991 WINE_SPI_FIXME(SPI_SETHANDHELD
); /* 78 WINVER >= 0x400 */
1993 WINE_SPI_FIXME(SPI_GETLOWPOWERTIMEOUT
); /* 79 WINVER >= 0x400 */
1994 WINE_SPI_FIXME(SPI_GETPOWEROFFTIMEOUT
); /* 80 WINVER >= 0x400 */
1995 WINE_SPI_FIXME(SPI_SETLOWPOWERTIMEOUT
); /* 81 WINVER >= 0x400 */
1996 WINE_SPI_FIXME(SPI_SETPOWEROFFTIMEOUT
); /* 82 WINVER >= 0x400 */
1998 case SPI_GETLOWPOWERACTIVE
:
1999 ret
= get_bool_param( SPI_SETLOWPOWERACTIVE_IDX
,
2000 SPI_SETLOWPOWERACTIVE_REGKEY
,
2001 SPI_SETLOWPOWERACTIVE_VALNAME
,
2002 &lowpoweractive
, pvParam
);
2005 case SPI_GETPOWEROFFACTIVE
:
2006 ret
= get_bool_param( SPI_SETPOWEROFFACTIVE_IDX
,
2007 SPI_SETPOWEROFFACTIVE_REGKEY
,
2008 SPI_SETPOWEROFFACTIVE_VALNAME
,
2009 &poweroffactive
, pvParam
);
2012 case SPI_SETLOWPOWERACTIVE
:
2013 ret
= set_bool_param( SPI_SETLOWPOWERACTIVE_IDX
,
2014 SPI_SETLOWPOWERACTIVE_REGKEY
,
2015 SPI_SETLOWPOWERACTIVE_VALNAME
,
2016 &lowpoweractive
, uiParam
, fWinIni
);
2019 case SPI_SETPOWEROFFACTIVE
:
2020 ret
= set_bool_param( SPI_SETPOWEROFFACTIVE_IDX
,
2021 SPI_SETPOWEROFFACTIVE_REGKEY
,
2022 SPI_SETPOWEROFFACTIVE_VALNAME
,
2023 &poweroffactive
, uiParam
, fWinIni
);
2026 WINE_SPI_FIXME(SPI_SETCURSORS
); /* 87 WINVER >= 0x400 */
2027 WINE_SPI_FIXME(SPI_SETICONS
); /* 88 WINVER >= 0x400 */
2029 case SPI_GETDEFAULTINPUTLANG
: /* 89 WINVER >= 0x400 */
2030 ret
= GetKeyboardLayout(0) ? TRUE
: FALSE
;
2033 WINE_SPI_FIXME(SPI_SETDEFAULTINPUTLANG
); /* 90 WINVER >= 0x400 */
2035 WINE_SPI_FIXME(SPI_SETLANGTOGGLE
); /* 91 WINVER >= 0x400 */
2037 case SPI_GETWINDOWSEXTENSION
: /* 92 WINVER >= 0x400 */
2038 WARN("pretend no support for Win9x Plus! for now.\n");
2039 ret
= FALSE
; /* yes, this is the result value */
2042 WINE_SPI_FIXME(SPI_SETMOUSETRAILS
); /* 93 WINVER >= 0x400 */
2043 WINE_SPI_FIXME(SPI_GETMOUSETRAILS
); /* 94 WINVER >= 0x400 */
2045 case SPI_GETSNAPTODEFBUTTON
: /* 95 WINVER >= 0x400 */
2046 ret
= get_bool_param( SPI_SETSNAPTODEFBUTTON_IDX
,
2047 SPI_SETSNAPTODEFBUTTON_REGKEY
,
2048 SPI_SETSNAPTODEFBUTTON_VALNAME
,
2049 &snap_to_default_button
, pvParam
);
2052 case SPI_SETSNAPTODEFBUTTON
: /* 96 WINVER >= 0x400 */
2053 ret
= set_bool_param( SPI_SETSNAPTODEFBUTTON_IDX
,
2054 SPI_SETSNAPTODEFBUTTON_REGKEY
,
2055 SPI_SETSNAPTODEFBUTTON_VALNAME
,
2056 &snap_to_default_button
, uiParam
, fWinIni
);
2059 case SPI_SETSCREENSAVERRUNNING
:
2060 ret
= set_bool_param( SPI_SETSCREENSAVERRUNNING_IDX
,
2061 SPI_SETSCREENSAVERRUNNING_REGKEY
,
2062 SPI_SETSCREENSAVERRUNNING_VALNAME
,
2063 &screensaver_running
, uiParam
, fWinIni
);
2066 case SPI_GETMOUSEHOVERWIDTH
:
2067 ret
= get_uint_param( SPI_SETMOUSEHOVERWIDTH_IDX
,
2068 SPI_SETMOUSEHOVERWIDTH_REGKEY
,
2069 SPI_SETMOUSEHOVERWIDTH_VALNAME
,
2070 &mouse_hover_width
, pvParam
);
2073 case SPI_SETMOUSEHOVERWIDTH
:
2074 ret
= set_uint_param( SPI_SETMOUSEHOVERWIDTH_IDX
,
2075 SPI_SETMOUSEHOVERWIDTH_REGKEY
,
2076 SPI_SETMOUSEHOVERWIDTH_VALNAME
,
2077 &mouse_hover_width
, uiParam
, fWinIni
);
2080 case SPI_GETMOUSEHOVERHEIGHT
:
2081 ret
= get_uint_param( SPI_SETMOUSEHOVERHEIGHT_IDX
,
2082 SPI_SETMOUSEHOVERHEIGHT_REGKEY
,
2083 SPI_SETMOUSEHOVERHEIGHT_VALNAME
,
2084 &mouse_hover_height
, pvParam
);
2087 case SPI_SETMOUSEHOVERHEIGHT
:
2088 ret
= set_uint_param( SPI_SETMOUSEHOVERHEIGHT_IDX
,
2089 SPI_SETMOUSEHOVERHEIGHT_REGKEY
,
2090 SPI_SETMOUSEHOVERHEIGHT_VALNAME
,
2091 &mouse_hover_height
, uiParam
, fWinIni
);
2094 case SPI_GETMOUSEHOVERTIME
:
2095 ret
= get_uint_param( SPI_SETMOUSEHOVERTIME_IDX
,
2096 SPI_SETMOUSEHOVERTIME_REGKEY
,
2097 SPI_SETMOUSEHOVERTIME_VALNAME
,
2098 &mouse_hover_time
, pvParam
);
2101 case SPI_SETMOUSEHOVERTIME
:
2102 ret
= set_uint_param( SPI_SETMOUSEHOVERTIME_IDX
,
2103 SPI_SETMOUSEHOVERTIME_REGKEY
,
2104 SPI_SETMOUSEHOVERTIME_VALNAME
,
2105 &mouse_hover_time
, uiParam
, fWinIni
);
2108 case SPI_GETWHEELSCROLLLINES
:
2109 ret
= get_uint_param( SPI_SETMOUSESCROLLLINES_IDX
,
2110 SPI_SETMOUSESCROLLLINES_REGKEY
,
2111 SPI_SETMOUSESCROLLLINES_VALNAME
,
2112 &mouse_scroll_lines
, pvParam
);
2115 case SPI_SETWHEELSCROLLLINES
:
2116 ret
= set_uint_param( SPI_SETMOUSESCROLLLINES_IDX
,
2117 SPI_SETMOUSESCROLLLINES_REGKEY
,
2118 SPI_SETMOUSESCROLLLINES_VALNAME
,
2119 &mouse_scroll_lines
, uiParam
, fWinIni
);
2122 case SPI_GETMENUSHOWDELAY
:
2123 ret
= get_uint_param( SPI_SETMENUSHOWDELAY_IDX
,
2124 SPI_SETMENUSHOWDELAY_REGKEY
,
2125 SPI_SETMENUSHOWDELAY_VALNAME
,
2126 &menu_show_delay
, pvParam
);
2129 case SPI_SETMENUSHOWDELAY
:
2130 ret
= set_uint_param( SPI_SETMENUSHOWDELAY_IDX
,
2131 SPI_SETMENUSHOWDELAY_REGKEY
,
2132 SPI_SETMENUSHOWDELAY_VALNAME
,
2133 &menu_show_delay
, uiParam
, fWinIni
);
2136 case SPI_GETWHEELSCROLLCHARS
: /* 108 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2137 ret
= get_uint_param( SPI_SETMOUSESCROLLCHARS_IDX
,
2138 SPI_SETMOUSESCROLLCHARS_REGKEY
,
2139 SPI_SETMOUSESCROLLCHARS_VALNAME
,
2140 &mouse_scroll_chars
, pvParam
);
2143 case SPI_SETWHEELSCROLLCHARS
: /* 109 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2144 ret
= set_uint_param( SPI_SETMOUSESCROLLCHARS_IDX
,
2145 SPI_SETMOUSESCROLLCHARS_REGKEY
,
2146 SPI_SETMOUSESCROLLCHARS_VALNAME
,
2147 &mouse_scroll_chars
, uiParam
, fWinIni
);
2150 WINE_SPI_FIXME(SPI_GETSHOWIMEUI
); /* 110 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2151 WINE_SPI_FIXME(SPI_SETSHOWIMEUI
); /* 111 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2153 case SPI_GETMOUSESPEED
: /* 112 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2154 ret
= get_uint_param( SPI_SETMOUSESPEED_IDX
,
2155 SPI_SETMOUSESPEED_REGKEY
,
2156 SPI_SETMOUSESPEED_VALNAME
,
2157 &mouse_sensitivity
, pvParam
);
2160 case SPI_SETMOUSESPEED
: /* 113 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2161 ret
= set_uint_param( SPI_SETMOUSESPEED_IDX
,
2162 SPI_SETMOUSESPEED_REGKEY
,
2163 SPI_SETMOUSESPEED_VALNAME
,
2164 &mouse_sensitivity
, PtrToInt(pvParam
), fWinIni
);
2168 case SPI_GETSCREENSAVERRUNNING
:
2169 ret
= get_bool_param( SPI_SETSCREENSAVERRUNNING_IDX
,
2170 SPI_SETSCREENSAVERRUNNING_REGKEY
,
2171 SPI_SETSCREENSAVERRUNNING_VALNAME
,
2172 &screensaver_running
, pvParam
);
2175 case SPI_GETDESKWALLPAPER
: /* 115 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2177 WCHAR buf
[MAX_PATH
];
2179 if (!pvParam
) return FALSE
;
2181 if (uiParam
> MAX_PATH
)
2186 if (SYSPARAMS_Load(SPI_SETDESKWALLPAPER_REGKEY
, SPI_SETDESKWALLPAPER_VALNAME
, buf
, sizeof(buf
)))
2188 lstrcpynW(pvParam
, buf
, uiParam
);
2192 /* Return an empty string */
2193 memset(pvParam
, 0, uiParam
);
2199 WINE_SPI_FIXME(SPI_GETACTIVEWINDOWTRACKING
);/* 0x1000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2200 WINE_SPI_FIXME(SPI_SETACTIVEWINDOWTRACKING
);/* 0x1001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2201 case SPI_GETMENUANIMATION
: /* 0x1002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2202 ret
= get_user_pref_param( 0, 0x02, pvParam
);
2205 case SPI_SETMENUANIMATION
: /* 0x1003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2206 ret
= set_user_pref_param( 0, 0x02, PtrToUlong(pvParam
), fWinIni
);
2209 case SPI_GETCOMBOBOXANIMATION
: /* 0x1004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2210 ret
= get_user_pref_param( 0, 0x04, pvParam
);
2213 case SPI_SETCOMBOBOXANIMATION
: /* 0x1005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2214 ret
= set_user_pref_param( 0, 0x04, PtrToUlong(pvParam
), fWinIni
);
2217 case SPI_GETLISTBOXSMOOTHSCROLLING
: /* 0x1006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2218 ret
= get_user_pref_param( 0, 0x08, pvParam
);
2221 case SPI_SETLISTBOXSMOOTHSCROLLING
: /* 0x1007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2222 ret
= set_user_pref_param( 0, 0x08, PtrToUlong(pvParam
), fWinIni
);
2225 case SPI_GETGRADIENTCAPTIONS
:
2226 ret
= get_user_pref_param( 0, 0x10, pvParam
);
2229 case SPI_SETGRADIENTCAPTIONS
:
2230 ret
= set_user_pref_param( 0, 0x10, PtrToUlong(pvParam
), fWinIni
);
2233 case SPI_GETKEYBOARDCUES
:
2234 ret
= get_user_pref_param( 0, 0x20, pvParam
);
2237 case SPI_SETKEYBOARDCUES
:
2238 ret
= set_user_pref_param( 0, 0x20, PtrToUlong(pvParam
), fWinIni
);
2241 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKZORDER
); /* 0x100C _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2242 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKZORDER
); /* 0x100D _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2243 case SPI_GETHOTTRACKING
:
2244 ret
= get_user_pref_param( 0, 0x80, pvParam
);
2247 case SPI_SETHOTTRACKING
:
2248 ret
= set_user_pref_param( 0, 0x80, PtrToUlong(pvParam
), fWinIni
);
2251 WINE_SPI_FIXME(SPI_GETMENUFADE
); /* 0x1012 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2252 WINE_SPI_FIXME(SPI_SETMENUFADE
); /* 0x1013 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2253 case SPI_GETSELECTIONFADE
: /* 0x1014 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2254 ret
= get_user_pref_param( 1, 0x04, pvParam
);
2257 case SPI_SETSELECTIONFADE
: /* 0x1015 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2258 ret
= set_user_pref_param( 1, 0x04, PtrToUlong(pvParam
), fWinIni
);
2261 case SPI_GETTOOLTIPANIMATION
: /* 0x1016 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2262 ret
= get_user_pref_param( 1, 0x08, pvParam
);
2265 case SPI_SETTOOLTIPANIMATION
: /* 0x1017 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2266 ret
= set_user_pref_param( 1, 0x08, PtrToUlong(pvParam
), fWinIni
);
2269 case SPI_GETTOOLTIPFADE
: /* 0x1018 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2270 ret
= get_user_pref_param( 1, 0x10, pvParam
);
2273 case SPI_SETTOOLTIPFADE
: /* 0x1019 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2274 ret
= set_user_pref_param( 1, 0x10, PtrToUlong(pvParam
), fWinIni
);
2277 case SPI_GETCURSORSHADOW
: /* 0x101A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2278 ret
= get_user_pref_param( 1, 0x20, pvParam
);
2281 case SPI_SETCURSORSHADOW
: /* 0x101B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2282 ret
= set_user_pref_param( 1, 0x20, PtrToUlong(pvParam
), fWinIni
);
2285 WINE_SPI_FIXME(SPI_GETMOUSESONAR
); /* 0x101C _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2286 WINE_SPI_FIXME(SPI_SETMOUSESONAR
); /* 0x101D _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2287 WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCK
); /* 0x101E _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2288 WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCK
); /* 0x101F _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2290 case SPI_GETMOUSEVANISH
:
2291 ret
= get_user_pref_param( 2, 0x01, pvParam
);
2294 case SPI_SETMOUSEVANISH
:
2295 ret
= set_user_pref_param( 2, 0x01, PtrToUlong(pvParam
), fWinIni
);
2298 case SPI_GETFLATMENU
:
2299 ret
= get_user_pref_param( 2, 0x02, pvParam
);
2302 case SPI_SETFLATMENU
:
2303 ret
= set_user_pref_param( 2, 0x02, PtrToUlong(pvParam
), fWinIni
);
2306 case SPI_GETDROPSHADOW
:
2307 ret
= get_user_pref_param( 2, 0x04, pvParam
);
2310 case SPI_SETDROPSHADOW
:
2311 ret
= set_user_pref_param( 2, 0x04, PtrToUlong(pvParam
), fWinIni
);
2314 WINE_SPI_FIXME(SPI_GETBLOCKSENDINPUTRESETS
);
2315 WINE_SPI_FIXME(SPI_SETBLOCKSENDINPUTRESETS
);
2316 case SPI_GETUIEFFECTS
:
2317 ret
= get_user_pref_param( 3, 0x80, pvParam
);
2320 case SPI_SETUIEFFECTS
:
2321 /* FIXME: this probably should mask other UI effect values when unset */
2322 ret
= set_user_pref_param( 3, 0x80, PtrToUlong(pvParam
), fWinIni
);
2325 /* _WIN32_WINNT >= 0x600 */
2326 WINE_SPI_FIXME(SPI_GETDISABLEOVERLAPPEDCONTENT
);
2327 WINE_SPI_FIXME(SPI_SETDISABLEOVERLAPPEDCONTENT
);
2328 WINE_SPI_FIXME(SPI_GETCLIENTAREAANIMATION
);
2329 WINE_SPI_FIXME(SPI_SETCLIENTAREAANIMATION
);
2330 WINE_SPI_FIXME(SPI_GETCLEARTYPE
);
2331 WINE_SPI_FIXME(SPI_SETCLEARTYPE
);
2332 WINE_SPI_FIXME(SPI_GETSPEECHRECOGNITION
);
2333 WINE_SPI_FIXME(SPI_SETSPEECHRECOGNITION
);
2335 case SPI_GETFOREGROUNDLOCKTIMEOUT
: /* 0x2000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2336 ret
= get_uint_param( SPI_SETFOREGROUNDLOCKTIMEOUT_IDX
,
2337 SPI_SETFOREGROUNDLOCKTIMEOUT_REGKEY
,
2338 SPI_SETFOREGROUNDLOCKTIMEOUT_VALNAME
,
2339 &foreground_lock_timeout
, pvParam
);
2342 case SPI_SETFOREGROUNDLOCKTIMEOUT
: /* 0x2001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2343 /* FIXME: this should check that the calling thread
2344 * is able to change the foreground window */
2345 ret
= set_uint_param( SPI_SETFOREGROUNDLOCKTIMEOUT_IDX
,
2346 SPI_SETFOREGROUNDLOCKTIMEOUT_REGKEY
,
2347 SPI_SETFOREGROUNDLOCKTIMEOUT_VALNAME
,
2348 &foreground_lock_timeout
, PtrToUlong(pvParam
), fWinIni
);
2351 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKTIMEOUT
); /* 0x2002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2352 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKTIMEOUT
); /* 0x2003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2353 WINE_SPI_FIXME(SPI_GETFOREGROUNDFLASHCOUNT
);/* 0x2004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2354 WINE_SPI_FIXME(SPI_SETFOREGROUNDFLASHCOUNT
);/* 0x2005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2355 case SPI_GETCARETWIDTH
: /* 0x2006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2356 ret
= get_uint_param( SPI_CARETWIDTH_IDX
,
2357 SPI_CARETWIDTH_REGKEY
,
2358 SPI_CARETWIDTH_VALNAME
,
2359 &caret_width
, pvParam
);
2362 case SPI_SETCARETWIDTH
: /* 0x2007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2363 ret
= set_uint_param( SPI_CARETWIDTH_IDX
,
2364 SPI_CARETWIDTH_REGKEY
,
2365 SPI_CARETWIDTH_VALNAME
,
2366 &caret_width
, uiParam
, fWinIni
);
2369 WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCKTIME
); /* 0x2008 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2370 WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCKTIME
); /* 0x2009 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2371 case SPI_GETFONTSMOOTHINGTYPE
: /* 0x200A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2372 spi_idx
= SPI_SETFONTSMOOTHINGTYPE_IDX
;
2373 if (!spi_loaded
[spi_idx
])
2375 ret
= SYSPARAMS_Load( SPI_SETFONTSMOOTHINGTYPE_REGKEY
,
2376 SPI_SETFONTSMOOTHINGTYPE_VALNAME
,
2377 (LPWSTR
)&font_smoothing_type
,
2378 sizeof(font_smoothing_type
) );
2379 if ( ret
) spi_loaded
[spi_idx
] = TRUE
;
2381 if (!pvParam
) ret
= FALSE
;
2384 *(UINT
*)pvParam
= font_smoothing_type
;
2387 case SPI_SETFONTSMOOTHINGTYPE
: /* 0x200B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2388 spi_idx
= SPI_SETFONTSMOOTHINGTYPE_IDX
;
2389 if (SYSPARAMS_SaveRaw( SPI_SETFONTSMOOTHINGTYPE_REGKEY
,
2390 SPI_SETFONTSMOOTHINGTYPE_VALNAME
,
2391 (LPBYTE
)&pvParam
, sizeof(UINT
), REG_DWORD
, fWinIni
))
2393 font_smoothing_type
= PtrToUlong(pvParam
);
2394 spi_loaded
[spi_idx
] = TRUE
;
2400 case SPI_GETFONTSMOOTHINGCONTRAST
: /* 0x200C _WIN32_WINNT >= 0x510 */
2401 spi_idx
= SPI_SETFONTSMOOTHINGCONTRAST_IDX
;
2402 if (!spi_loaded
[spi_idx
])
2404 ret
= SYSPARAMS_Load( SPI_SETFONTSMOOTHINGCONTRAST_REGKEY
,
2405 SPI_SETFONTSMOOTHINGCONTRAST_VALNAME
,
2406 (LPWSTR
)&font_smoothing_contrast
,
2407 sizeof(font_smoothing_contrast
) );
2409 spi_loaded
[spi_idx
] = TRUE
;
2411 if (!pvParam
) ret
= FALSE
;
2414 *(UINT
*)pvParam
= font_smoothing_contrast
;
2417 case SPI_SETFONTSMOOTHINGCONTRAST
: /* 0x200D _WIN32_WINNT >= 0x510 */
2418 spi_idx
= SPI_SETFONTSMOOTHINGCONTRAST_IDX
;
2419 if (SYSPARAMS_SaveRaw( SPI_SETFONTSMOOTHINGCONTRAST_REGKEY
,
2420 SPI_SETFONTSMOOTHINGCONTRAST_VALNAME
,
2421 (LPBYTE
)&pvParam
, sizeof(UINT
), REG_DWORD
, fWinIni
))
2423 font_smoothing_contrast
= PtrToUlong(pvParam
);
2424 spi_loaded
[spi_idx
] = TRUE
;
2430 case SPI_GETFOCUSBORDERWIDTH
: /* 0x200E _WIN32_WINNT >= 0x510 */
2431 case SPI_GETFOCUSBORDERHEIGHT
: /* 0x200F _WIN32_WINNT >= 0x510 */
2435 *(UINT
*)pvParam
= 1;
2438 WINE_SPI_FIXME(SPI_SETFOCUSBORDERWIDTH
); /* 0x2010 _WIN32_WINNT >= 0x510 */
2439 WINE_SPI_FIXME(SPI_SETFOCUSBORDERHEIGHT
); /* 0x2011 _WIN32_WINNT >= 0x510 */
2441 case SPI_GETFONTSMOOTHINGORIENTATION
: /* 0x2012 */
2442 spi_idx
= SPI_SETFONTSMOOTHINGORIENTATION_IDX
;
2443 if (!spi_loaded
[spi_idx
])
2445 ret
= SYSPARAMS_Load( SPI_SETFONTSMOOTHINGORIENTATION_REGKEY
,
2446 SPI_SETFONTSMOOTHINGORIENTATION_VALNAME
,
2447 (LPWSTR
)&font_smoothing_orientation
,
2448 sizeof(font_smoothing_orientation
) );
2450 spi_loaded
[spi_idx
] = TRUE
;
2452 if (!pvParam
) ret
= FALSE
;
2455 *(UINT
*)pvParam
= font_smoothing_orientation
;
2458 case SPI_SETFONTSMOOTHINGORIENTATION
: /* 0x2013 */
2459 spi_idx
= SPI_SETFONTSMOOTHINGORIENTATION_IDX
;
2460 if (SYSPARAMS_SaveRaw( SPI_SETFONTSMOOTHINGORIENTATION_REGKEY
,
2461 SPI_SETFONTSMOOTHINGORIENTATION_VALNAME
,
2462 (LPBYTE
)&pvParam
, sizeof(UINT
), REG_DWORD
, fWinIni
))
2464 font_smoothing_orientation
= PtrToUlong(pvParam
);
2465 spi_loaded
[spi_idx
] = TRUE
;
2472 FIXME( "Unknown action: %u\n", uiAction
);
2473 SetLastError( ERROR_INVALID_SPI_VALUE
);
2479 SYSPARAMS_NotifyChange( uiAction
, fWinIni
);
2480 TRACE("(%u, %u, %p, %u) ret %d\n",
2481 uiAction
, uiParam
, pvParam
, fWinIni
, ret
);
2484 #undef WINE_SPI_FIXME
2485 #undef WINE_SPI_WARN
2489 /***********************************************************************
2490 * SystemParametersInfoA (USER32.@)
2492 BOOL WINAPI
SystemParametersInfoA( UINT uiAction
, UINT uiParam
,
2493 PVOID pvParam
, UINT fuWinIni
)
2497 TRACE("(%u, %u, %p, %u)\n", uiAction
, uiParam
, pvParam
, fuWinIni
);
2501 case SPI_SETDESKWALLPAPER
: /* 20 */
2502 case SPI_SETDESKPATTERN
: /* 21 */
2506 if (!MultiByteToWideChar( CP_ACP
, 0, pvParam
, -1, buffer
,
2507 sizeof(buffer
)/sizeof(WCHAR
) ))
2508 buffer
[sizeof(buffer
)/sizeof(WCHAR
)-1] = 0;
2509 ret
= SystemParametersInfoW( uiAction
, uiParam
, pvParam
? buffer
: NULL
, fuWinIni
);
2513 case SPI_GETICONTITLELOGFONT
: /* 31 */
2516 ret
= SystemParametersInfoW( uiAction
, uiParam
, pvParam
? &tmp
: NULL
, fuWinIni
);
2518 SYSPARAMS_LogFont32WTo32A( &tmp
, pvParam
);
2522 case SPI_GETNONCLIENTMETRICS
: /* 41 WINVER >= 0x400 */
2524 NONCLIENTMETRICSW tmp
;
2525 LPNONCLIENTMETRICSA lpnmA
= pvParam
;
2526 if (lpnmA
&& lpnmA
->cbSize
== sizeof(NONCLIENTMETRICSA
))
2528 tmp
.cbSize
= sizeof(NONCLIENTMETRICSW
);
2529 ret
= SystemParametersInfoW( uiAction
, uiParam
, &tmp
, fuWinIni
);
2531 SYSPARAMS_NonClientMetrics32WTo32A( &tmp
, lpnmA
);
2538 case SPI_SETNONCLIENTMETRICS
: /* 42 WINVER >= 0x400 */
2540 NONCLIENTMETRICSW tmp
;
2541 LPNONCLIENTMETRICSA lpnmA
= pvParam
;
2542 if (lpnmA
&& lpnmA
->cbSize
== sizeof(NONCLIENTMETRICSA
))
2544 tmp
.cbSize
= sizeof(NONCLIENTMETRICSW
);
2545 SYSPARAMS_NonClientMetrics32ATo32W( lpnmA
, &tmp
);
2546 ret
= SystemParametersInfoW( uiAction
, uiParam
, &tmp
, fuWinIni
);
2553 case SPI_GETICONMETRICS
: /* 45 WINVER >= 0x400 */
2556 LPICONMETRICSA lpimA
= pvParam
;
2557 if (lpimA
&& lpimA
->cbSize
== sizeof(ICONMETRICSA
))
2559 tmp
.cbSize
= sizeof(ICONMETRICSW
);
2560 ret
= SystemParametersInfoW( uiAction
, uiParam
, &tmp
, fuWinIni
);
2563 lpimA
->iHorzSpacing
= tmp
.iHorzSpacing
;
2564 lpimA
->iVertSpacing
= tmp
.iVertSpacing
;
2565 lpimA
->iTitleWrap
= tmp
.iTitleWrap
;
2566 SYSPARAMS_LogFont32WTo32A( &tmp
.lfFont
, &lpimA
->lfFont
);
2574 case SPI_SETICONMETRICS
: /* 46 WINVER >= 0x400 */
2577 LPICONMETRICSA lpimA
= pvParam
;
2578 if (lpimA
&& lpimA
->cbSize
== sizeof(ICONMETRICSA
))
2580 tmp
.cbSize
= sizeof(ICONMETRICSW
);
2581 tmp
.iHorzSpacing
= lpimA
->iHorzSpacing
;
2582 tmp
.iVertSpacing
= lpimA
->iVertSpacing
;
2583 tmp
.iTitleWrap
= lpimA
->iTitleWrap
;
2584 SYSPARAMS_LogFont32ATo32W( &lpimA
->lfFont
, &tmp
.lfFont
);
2585 ret
= SystemParametersInfoW( uiAction
, uiParam
, &tmp
, fuWinIni
);
2592 case SPI_GETHIGHCONTRAST
: /* 66 WINVER >= 0x400 */
2595 LPHIGHCONTRASTA lphcA
= pvParam
;
2596 if (lphcA
&& lphcA
->cbSize
== sizeof(HIGHCONTRASTA
))
2598 tmp
.cbSize
= sizeof(HIGHCONTRASTW
);
2599 ret
= SystemParametersInfoW( uiAction
, uiParam
, &tmp
, fuWinIni
);
2602 lphcA
->dwFlags
= tmp
.dwFlags
;
2603 lphcA
->lpszDefaultScheme
= NULL
; /* FIXME? */
2611 case SPI_GETDESKWALLPAPER
: /* 115 */
2613 WCHAR buffer
[MAX_PATH
];
2614 ret
= (SystemParametersInfoW( SPI_GETDESKWALLPAPER
, uiParam
, buffer
, fuWinIni
) &&
2615 WideCharToMultiByte(CP_ACP
, 0, buffer
, -1, pvParam
, uiParam
, NULL
, NULL
));
2620 ret
= SystemParametersInfoW( uiAction
, uiParam
, pvParam
, fuWinIni
);
2627 /***********************************************************************
2628 * GetSystemMetrics (USER32.@)
2630 INT WINAPI
GetSystemMetrics( INT index
)
2634 /* some metrics are dynamic */
2638 return GetDeviceCaps( get_display_dc(), HORZRES
);
2640 return GetDeviceCaps( get_display_dc(), VERTRES
);
2642 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2643 return nonclient_metrics
.iScrollWidth
;
2645 return GetSystemMetrics(SM_CXVSCROLL
);
2647 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2648 return nonclient_metrics
.iCaptionHeight
+ 1;
2651 /* SM_C{X,Y}BORDER always returns 1 regardless of 'BorderWidth' value in registry */
2657 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2658 return nonclient_metrics
.iScrollHeight
;
2660 return GetSystemMetrics(SM_CYVTHUMB
);
2662 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2663 return icon_size
.cx
;
2665 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2666 return icon_size
.cy
;
2671 return GetSystemMetrics(SM_CYMENUSIZE
) + 1;
2672 case SM_CXFULLSCREEN
:
2673 /* see the remark for SM_CXMAXIMIZED, at least this formulation is
2675 return GetSystemMetrics( SM_CXMAXIMIZED
) - 2 * GetSystemMetrics( SM_CXFRAME
);
2676 case SM_CYFULLSCREEN
:
2677 /* see the remark for SM_CYMAXIMIZED, at least this formulation is
2679 return GetSystemMetrics( SM_CYMAXIMIZED
) - GetSystemMetrics( SM_CYMIN
);
2680 case SM_CYKANJIWINDOW
:
2682 case SM_MOUSEPRESENT
:
2685 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2686 return nonclient_metrics
.iScrollHeight
;
2688 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2689 return nonclient_metrics
.iScrollHeight
;
2693 get_bool_param( SPI_SETMOUSEBUTTONSWAP_IDX
, SPI_SETMOUSEBUTTONSWAP_REGKEY
,
2694 SPI_SETMOUSEBUTTONSWAP_VALNAME
, &swap_buttons
, (BOOL
*)&ret
);
2702 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2703 return 3 * nonclient_metrics
.iCaptionWidth
+ GetSystemMetrics( SM_CYSIZE
) +
2704 4 * CaptionFontAvCharWidth
+ 2 * GetSystemMetrics( SM_CXFRAME
) + 4;
2706 return GetSystemMetrics( SM_CYCAPTION
) + 2 * GetSystemMetrics( SM_CYFRAME
);
2708 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2709 return nonclient_metrics
.iCaptionWidth
;
2711 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2712 return nonclient_metrics
.iCaptionHeight
;
2714 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2715 return GetSystemMetrics(SM_CXDLGFRAME
) + nonclient_metrics
.iBorderWidth
;
2717 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2718 return GetSystemMetrics(SM_CYDLGFRAME
) + nonclient_metrics
.iBorderWidth
;
2720 return GetSystemMetrics(SM_CXMIN
);
2722 return GetSystemMetrics(SM_CYMIN
);
2723 case SM_CXDOUBLECLK
:
2724 get_uint_param( SPI_SETDOUBLECLKWIDTH_IDX
, SPI_SETDOUBLECLKWIDTH_REGKEY1
,
2725 SPI_SETDOUBLECLKWIDTH_VALNAME
, &double_click_width
, &ret
);
2727 case SM_CYDOUBLECLK
:
2728 get_uint_param( SPI_SETDOUBLECLKHEIGHT_IDX
, SPI_SETDOUBLECLKHEIGHT_REGKEY1
,
2729 SPI_SETDOUBLECLKHEIGHT_VALNAME
, &double_click_height
, &ret
);
2731 case SM_CXICONSPACING
:
2732 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING
, 0, &ret
, 0 );
2734 case SM_CYICONSPACING
:
2735 SystemParametersInfoW( SPI_ICONVERTICALSPACING
, 0, &ret
, 0 );
2737 case SM_MENUDROPALIGNMENT
:
2738 SystemParametersInfoW( SPI_GETMENUDROPALIGNMENT
, 0, &ret
, 0 );
2742 case SM_DBCSENABLED
:
2745 GetCPInfo( CP_ACP
, &cpinfo
);
2746 return (cpinfo
.MaxCharSize
> 1);
2748 case SM_CMOUSEBUTTONS
:
2753 return GetSystemMetrics(SM_CXBORDER
) + 1;
2755 return GetSystemMetrics(SM_CYBORDER
) + 1;
2756 case SM_CXMINSPACING
:
2757 if( spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
]) load_minimized_metrics();
2758 return GetSystemMetrics(SM_CXMINIMIZED
) + minimized_metrics
.iHorzGap
;
2759 case SM_CYMINSPACING
:
2760 if( spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
]) load_minimized_metrics();
2761 return GetSystemMetrics(SM_CYMINIMIZED
) + minimized_metrics
.iVertGap
;
2765 case SM_CYSMCAPTION
:
2766 return GetSystemMetrics(SM_CYSMSIZE
) + 1;
2768 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2769 return nonclient_metrics
.iSmCaptionWidth
;
2771 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2772 return nonclient_metrics
.iSmCaptionHeight
;
2774 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2775 return nonclient_metrics
.iMenuWidth
;
2777 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2778 return nonclient_metrics
.iMenuHeight
;
2780 if( spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
]) load_minimized_metrics();
2781 return minimized_metrics
.iArrange
;
2782 case SM_CXMINIMIZED
:
2783 if( spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
]) load_minimized_metrics();
2784 return minimized_metrics
.iWidth
+ 6;
2785 case SM_CYMINIMIZED
:
2786 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2787 return nonclient_metrics
.iCaptionHeight
+ 6;
2789 return GetSystemMetrics(SM_CXVIRTUALSCREEN
) + 4 + 2 * GetSystemMetrics(SM_CXFRAME
);
2791 return GetSystemMetrics(SM_CYVIRTUALSCREEN
) + 4 + 2 * GetSystemMetrics(SM_CYFRAME
);
2792 case SM_CXMAXIMIZED
:
2793 /* FIXME: subtract the width of any vertical application toolbars*/
2794 return GetSystemMetrics(SM_CXSCREEN
) + 2 * GetSystemMetrics(SM_CXFRAME
);
2795 case SM_CYMAXIMIZED
:
2796 /* FIXME: subtract the width of any horizontal application toolbars*/
2797 return GetSystemMetrics(SM_CYSCREEN
) + 2 * GetSystemMetrics(SM_CYCAPTION
);
2799 return 3; /* FIXME */
2801 return 0; /* 0 = ok, 1 = failsafe, 2 = failsafe + network */
2806 SystemParametersInfoW( SPI_GETSHOWSOUNDS
, 0, &ret
, 0 );
2808 case SM_CXMENUCHECK
:
2809 case SM_CYMENUCHECK
:
2810 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2811 return tmMenuFont
.tmHeight
<= 0 ? 13 :
2812 ((tmMenuFont
.tmHeight
+ tmMenuFont
.tmExternalLeading
+ 1) / 2) * 2 - 1;
2813 case SM_SLOWMACHINE
:
2814 return 0; /* Never true */
2815 case SM_MIDEASTENABLED
:
2816 return 0; /* FIXME */
2817 case SM_MOUSEWHEELPRESENT
:
2819 case SM_XVIRTUALSCREEN
:
2821 struct monitor_info info
;
2822 get_monitors_info( &info
);
2823 return info
.virtual_rect
.left
;
2825 case SM_YVIRTUALSCREEN
:
2827 struct monitor_info info
;
2828 get_monitors_info( &info
);
2829 return info
.virtual_rect
.top
;
2831 case SM_CXVIRTUALSCREEN
:
2833 struct monitor_info info
;
2834 get_monitors_info( &info
);
2835 return info
.virtual_rect
.right
- info
.virtual_rect
.left
;
2837 case SM_CYVIRTUALSCREEN
:
2839 struct monitor_info info
;
2840 get_monitors_info( &info
);
2841 return info
.virtual_rect
.bottom
- info
.virtual_rect
.top
;
2845 struct monitor_info info
;
2846 get_monitors_info( &info
);
2849 case SM_SAMEDISPLAYFORMAT
:
2852 return 0; /* FIXME */
2853 case SM_CXFOCUSBORDER
:
2854 case SM_CYFOCUSBORDER
:
2857 case SM_MEDIACENTER
:
2867 /***********************************************************************
2868 * SwapMouseButton (USER32.@)
2869 * Reverse or restore the meaning of the left and right mouse buttons
2870 * fSwap [I ] TRUE - reverse, FALSE - original
2874 BOOL WINAPI
SwapMouseButton( BOOL fSwap
)
2876 BOOL prev
= GetSystemMetrics(SM_SWAPBUTTON
);
2877 SystemParametersInfoW(SPI_SETMOUSEBUTTONSWAP
, fSwap
, 0, 0);
2882 /**********************************************************************
2883 * SetDoubleClickTime (USER32.@)
2885 BOOL WINAPI
SetDoubleClickTime( UINT interval
)
2887 return SystemParametersInfoW(SPI_SETDOUBLECLICKTIME
, interval
, 0, 0);
2891 /**********************************************************************
2892 * GetDoubleClickTime (USER32.@)
2894 UINT WINAPI
GetDoubleClickTime(void)
2898 get_uint_param( SPI_SETDOUBLECLICKTIME_IDX
,
2899 SPI_SETDOUBLECLICKTIME_REGKEY
,
2900 SPI_SETDOUBLECLICKTIME_VALNAME
,
2901 &double_click_time
, &time
);
2902 if (!time
) time
= 500;
2907 /*************************************************************************
2908 * GetSysColor (USER32.@)
2910 COLORREF WINAPI
GetSysColor( INT nIndex
)
2912 if (nIndex
>= 0 && nIndex
< NUM_SYS_COLORS
)
2913 return SysColors
[nIndex
];
2919 /*************************************************************************
2920 * SetSysColors (USER32.@)
2922 BOOL WINAPI
SetSysColors( INT nChanges
, const INT
*lpSysColor
,
2923 const COLORREF
*lpColorValues
)
2927 for (i
= 0; i
< nChanges
; i
++) SYSPARAMS_SetSysColor( lpSysColor
[i
], lpColorValues
[i
] );
2929 /* Send WM_SYSCOLORCHANGE message to all windows */
2931 SendMessageTimeoutW( HWND_BROADCAST
, WM_SYSCOLORCHANGE
, 0, 0, SMTO_ABORTIFHUNG
, 2000, NULL
);
2933 /* Repaint affected portions of all visible windows */
2935 RedrawWindow( GetDesktopWindow(), NULL
, 0,
2936 RDW_INVALIDATE
| RDW_ERASE
| RDW_UPDATENOW
| RDW_ALLCHILDREN
);
2941 /*************************************************************************
2942 * SetSysColorsTemp (USER32.@)
2946 * Called by W98SE desk.cpl Control Panel Applet:
2947 * handle = SetSysColorsTemp(ptr, ptr, nCount); ("set" call)
2948 * result = SetSysColorsTemp(NULL, NULL, handle); ("restore" call)
2950 * pPens is an array of COLORREF values, which seems to be used
2951 * to indicate the color values to create new pens with.
2953 * pBrushes is an array of solid brush handles (returned by a previous
2954 * CreateSolidBrush), which seems to contain the brush handles to set
2955 * for the system colors.
2957 * n seems to be used for
2958 * a) indicating the number of entries to operate on (length of pPens,
2960 * b) passing the handle that points to the previously used color settings.
2961 * I couldn't figure out in hell what kind of handle this is on
2962 * Windows. I just use a heap handle instead. Shouldn't matter anyway.
2965 * heap handle of our own copy of the current syscolors in case of
2966 * "set" call, i.e. pPens, pBrushes != NULL.
2967 * TRUE (unconditionally !) in case of "restore" call,
2968 * i.e. pPens, pBrushes == NULL.
2969 * FALSE in case of either pPens != NULL and pBrushes == NULL
2970 * or pPens == NULL and pBrushes != NULL.
2972 * I'm not sure whether this implementation is 100% correct. [AM]
2974 DWORD_PTR WINAPI
SetSysColorsTemp( const COLORREF
*pPens
, const HBRUSH
*pBrushes
, DWORD_PTR n
)
2978 if (pPens
&& pBrushes
) /* "set" call */
2980 /* allocate our structure to remember old colors */
2981 LPVOID pOldCol
= HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD
)+n
*sizeof(HPEN
)+n
*sizeof(HBRUSH
));
2983 *(DWORD
*)p
= n
; p
= (char*)p
+ sizeof(DWORD
);
2984 memcpy(p
, SysColorPens
, n
*sizeof(HPEN
)); p
= (char*)p
+ n
*sizeof(HPEN
);
2985 memcpy(p
, SysColorBrushes
, n
*sizeof(HBRUSH
)); p
= (char*)p
+ n
*sizeof(HBRUSH
);
2987 for (i
=0; i
< n
; i
++)
2989 SysColorPens
[i
] = CreatePen( PS_SOLID
, 1, pPens
[i
] );
2990 SysColorBrushes
[i
] = pBrushes
[i
];
2993 return (DWORD_PTR
)pOldCol
;
2995 if (!pPens
&& !pBrushes
) /* "restore" call */
2997 LPVOID pOldCol
= (LPVOID
)n
; /* FIXME: not 64-bit safe */
2999 DWORD nCount
= *(DWORD
*)p
;
3000 p
= (char*)p
+ sizeof(DWORD
);
3002 for (i
=0; i
< nCount
; i
++)
3004 DeleteObject(SysColorPens
[i
]);
3005 SysColorPens
[i
] = *(HPEN
*)p
; p
= (char*)p
+ sizeof(HPEN
);
3007 for (i
=0; i
< nCount
; i
++)
3009 SysColorBrushes
[i
] = *(HBRUSH
*)p
; p
= (char*)p
+ sizeof(HBRUSH
);
3011 /* get rid of storage structure */
3012 HeapFree(GetProcessHeap(), 0, pOldCol
);
3020 /***********************************************************************
3021 * GetSysColorBrush (USER32.@)
3023 HBRUSH WINAPI
GetSysColorBrush( INT index
)
3025 if (0 <= index
&& index
< NUM_SYS_COLORS
) return SysColorBrushes
[index
];
3026 WARN("Unknown index(%d)\n", index
);
3031 /***********************************************************************
3034 HPEN
SYSCOLOR_GetPen( INT index
)
3036 /* We can assert here, because this function is internal to Wine */
3037 assert (0 <= index
&& index
< NUM_SYS_COLORS
);
3038 return SysColorPens
[index
];
3042 /***********************************************************************
3043 * ChangeDisplaySettingsA (USER32.@)
3045 LONG WINAPI
ChangeDisplaySettingsA( LPDEVMODEA devmode
, DWORD flags
)
3047 if (devmode
) devmode
->dmDriverExtra
= 0;
3049 return ChangeDisplaySettingsExA(NULL
,devmode
,NULL
,flags
,NULL
);
3053 /***********************************************************************
3054 * ChangeDisplaySettingsW (USER32.@)
3056 LONG WINAPI
ChangeDisplaySettingsW( LPDEVMODEW devmode
, DWORD flags
)
3058 if (devmode
) devmode
->dmDriverExtra
= 0;
3060 return ChangeDisplaySettingsExW(NULL
,devmode
,NULL
,flags
,NULL
);
3064 /***********************************************************************
3065 * ChangeDisplaySettingsExA (USER32.@)
3067 LONG WINAPI
ChangeDisplaySettingsExA( LPCSTR devname
, LPDEVMODEA devmode
, HWND hwnd
,
3068 DWORD flags
, LPVOID lparam
)
3071 UNICODE_STRING nameW
;
3073 if (devname
) RtlCreateUnicodeStringFromAsciiz(&nameW
, devname
);
3074 else nameW
.Buffer
= NULL
;
3080 devmodeW
= GdiConvertToDevmodeW(devmode
);
3083 ret
= ChangeDisplaySettingsExW(nameW
.Buffer
, devmodeW
, hwnd
, flags
, lparam
);
3084 HeapFree(GetProcessHeap(), 0, devmodeW
);
3087 ret
= DISP_CHANGE_SUCCESSFUL
;
3091 ret
= ChangeDisplaySettingsExW(nameW
.Buffer
, NULL
, hwnd
, flags
, lparam
);
3094 if (devname
) RtlFreeUnicodeString(&nameW
);
3099 /***********************************************************************
3100 * ChangeDisplaySettingsExW (USER32.@)
3102 LONG WINAPI
ChangeDisplaySettingsExW( LPCWSTR devname
, LPDEVMODEW devmode
, HWND hwnd
,
3103 DWORD flags
, LPVOID lparam
)
3105 /* make sure the desktop window is created before mode changing */
3108 return USER_Driver
->pChangeDisplaySettingsEx( devname
, devmode
, hwnd
, flags
, lparam
);
3112 /***********************************************************************
3113 * EnumDisplaySettingsW (USER32.@)
3116 * TRUE if nth setting exists found (described in the LPDEVMODEW struct)
3117 * FALSE if we do not have the nth setting
3119 BOOL WINAPI
EnumDisplaySettingsW( LPCWSTR name
, DWORD n
, LPDEVMODEW devmode
)
3121 return EnumDisplaySettingsExW(name
, n
, devmode
, 0);
3125 /***********************************************************************
3126 * EnumDisplaySettingsA (USER32.@)
3128 BOOL WINAPI
EnumDisplaySettingsA(LPCSTR name
,DWORD n
,LPDEVMODEA devmode
)
3130 return EnumDisplaySettingsExA(name
, n
, devmode
, 0);
3134 /***********************************************************************
3135 * EnumDisplaySettingsExA (USER32.@)
3137 BOOL WINAPI
EnumDisplaySettingsExA(LPCSTR lpszDeviceName
, DWORD iModeNum
,
3138 LPDEVMODEA lpDevMode
, DWORD dwFlags
)
3142 UNICODE_STRING nameW
;
3144 if (lpszDeviceName
) RtlCreateUnicodeStringFromAsciiz(&nameW
, lpszDeviceName
);
3145 else nameW
.Buffer
= NULL
;
3147 ret
= EnumDisplaySettingsExW(nameW
.Buffer
,iModeNum
,&devmodeW
,dwFlags
);
3150 lpDevMode
->dmSize
= FIELD_OFFSET(DEVMODEA
, dmICMMethod
);
3151 lpDevMode
->dmSpecVersion
= devmodeW
.dmSpecVersion
;
3152 lpDevMode
->dmDriverVersion
= devmodeW
.dmDriverVersion
;
3153 WideCharToMultiByte(CP_ACP
, 0, devmodeW
.dmDeviceName
, -1,
3154 (LPSTR
)lpDevMode
->dmDeviceName
, CCHDEVICENAME
, NULL
, NULL
);
3155 lpDevMode
->dmDriverExtra
= 0; /* FIXME */
3156 lpDevMode
->dmBitsPerPel
= devmodeW
.dmBitsPerPel
;
3157 lpDevMode
->dmPelsHeight
= devmodeW
.dmPelsHeight
;
3158 lpDevMode
->dmPelsWidth
= devmodeW
.dmPelsWidth
;
3159 lpDevMode
->u2
.dmDisplayFlags
= devmodeW
.u2
.dmDisplayFlags
;
3160 lpDevMode
->dmDisplayFrequency
= devmodeW
.dmDisplayFrequency
;
3161 lpDevMode
->dmFields
= devmodeW
.dmFields
;
3163 lpDevMode
->u1
.s2
.dmPosition
.x
= devmodeW
.u1
.s2
.dmPosition
.x
;
3164 lpDevMode
->u1
.s2
.dmPosition
.y
= devmodeW
.u1
.s2
.dmPosition
.y
;
3165 lpDevMode
->u1
.s2
.dmDisplayOrientation
= devmodeW
.u1
.s2
.dmDisplayOrientation
;
3166 lpDevMode
->u1
.s2
.dmDisplayFixedOutput
= devmodeW
.u1
.s2
.dmDisplayFixedOutput
;
3168 if (lpszDeviceName
) RtlFreeUnicodeString(&nameW
);
3173 /***********************************************************************
3174 * EnumDisplaySettingsExW (USER32.@)
3176 BOOL WINAPI
EnumDisplaySettingsExW(LPCWSTR lpszDeviceName
, DWORD iModeNum
,
3177 LPDEVMODEW lpDevMode
, DWORD dwFlags
)
3179 /* make sure the desktop window is created before mode enumeration */
3182 return USER_Driver
->pEnumDisplaySettingsEx(lpszDeviceName
, iModeNum
, lpDevMode
, dwFlags
);
3185 /***********************************************************************
3186 * SetProcessDPIAware (USER32.@)
3188 BOOL WINAPI
SetProcessDPIAware( VOID
)