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
33 #include "wine/winuser16.h"
37 #include "user_private.h"
38 #include "wine/unicode.h"
39 #include "wine/debug.h"
41 WINE_DEFAULT_DEBUG_CHANNEL(system
);
43 /* System parameter indexes */
49 SPI_SETKEYBOARDSPEED_IDX
,
50 SPI_ICONHORIZONTALSPACING_IDX
,
51 SPI_SETSCREENSAVETIMEOUT_IDX
,
52 SPI_SETGRIDGRANULARITY_IDX
,
53 SPI_SETKEYBOARDDELAY_IDX
,
54 SPI_ICONVERTICALSPACING_IDX
,
55 SPI_SETICONTITLEWRAP_IDX
,
56 SPI_SETMENUDROPALIGNMENT_IDX
,
57 SPI_SETDOUBLECLKWIDTH_IDX
,
58 SPI_SETDOUBLECLKHEIGHT_IDX
,
59 SPI_SETDOUBLECLICKTIME_IDX
,
60 SPI_SETMOUSEBUTTONSWAP_IDX
,
61 SPI_SETDRAGFULLWINDOWS_IDX
,
63 SPI_SETSHOWSOUNDS_IDX
,
64 SPI_SETKEYBOARDPREF_IDX
,
65 SPI_SETSCREENREADER_IDX
,
66 SPI_SETSCREENSAVERRUNNING_IDX
,
67 SPI_SETFONTSMOOTHING_IDX
,
68 SPI_SETLISTBOXSMOOTHSCROLLING_IDX
,
69 SPI_SETMOUSEHOVERWIDTH_IDX
,
70 SPI_SETMOUSEHOVERHEIGHT_IDX
,
71 SPI_SETMOUSEHOVERTIME_IDX
,
72 SPI_SETMOUSESCROLLLINES_IDX
,
73 SPI_SETMENUSHOWDELAY_IDX
,
74 SPI_SETICONTITLELOGFONT_IDX
,
75 SPI_SETLOWPOWERACTIVE_IDX
,
76 SPI_SETPOWEROFFACTIVE_IDX
,
77 SPI_USERPREFERENCEMASK_IDX
,
78 SPI_NONCLIENTMETRICS_IDX
,
79 SPI_MINIMIZEDMETRICS_IDX
,
84 static const char * const DefSysColors
[] =
86 "Scrollbar", "192 192 192", /* COLOR_SCROLLBAR */
87 "Background", "0 128 128", /* COLOR_BACKGROUND */
88 "ActiveTitle", "0 0 128", /* COLOR_ACTIVECAPTION */
89 "InactiveTitle", "128 128 128", /* COLOR_INACTIVECAPTION */
90 "Menu", "192 192 192", /* COLOR_MENU */
91 "Window", "255 255 255", /* COLOR_WINDOW */
92 "WindowFrame", "0 0 0", /* COLOR_WINDOWFRAME */
93 "MenuText", "0 0 0", /* COLOR_MENUTEXT */
94 "WindowText", "0 0 0", /* COLOR_WINDOWTEXT */
95 "TitleText", "255 255 255", /* COLOR_CAPTIONTEXT */
96 "ActiveBorder", "192 192 192", /* COLOR_ACTIVEBORDER */
97 "InactiveBorder", "192 192 192", /* COLOR_INACTIVEBORDER */
98 "AppWorkSpace", "128 128 128", /* COLOR_APPWORKSPACE */
99 "Hilight", "0 0 128", /* COLOR_HIGHLIGHT */
100 "HilightText", "255 255 255", /* COLOR_HIGHLIGHTTEXT */
101 "ButtonFace", "192 192 192", /* COLOR_BTNFACE */
102 "ButtonShadow", "128 128 128", /* COLOR_BTNSHADOW */
103 "GrayText", "128 128 128", /* COLOR_GRAYTEXT */
104 "ButtonText", "0 0 0", /* COLOR_BTNTEXT */
105 "InactiveTitleText", "192 192 192", /* COLOR_INACTIVECAPTIONTEXT */
106 "ButtonHilight", "255 255 255", /* COLOR_BTNHIGHLIGHT */
107 "ButtonDkShadow", "0 0 0", /* COLOR_3DDKSHADOW */
108 "ButtonLight", "224 224 224", /* COLOR_3DLIGHT */
109 "InfoText", "0 0 0", /* COLOR_INFOTEXT */
110 "InfoWindow", "255 255 225", /* COLOR_INFOBK */
111 "ButtonAlternateFace", "180 180 180", /* COLOR_ALTERNATEBTNFACE */
112 "HotTrackingColor", "0 0 255", /* COLOR_HOTLIGHT */
113 "GradientActiveTitle", "16 132 208", /* COLOR_GRADIENTACTIVECAPTION */
114 "GradientInactiveTitle", "181 181 181", /* COLOR_GRADIENTINACTIVECAPTION */
115 "MenuHilight", "0 0 0", /* COLOR_MENUHILIGHT */
116 "MenuBar", "192 192 192" /* COLOR_MENUBAR */
120 * Names of the registry subkeys of HKEY_CURRENT_USER key and value names
121 * for the system parameters.
122 * Names of the keys are created by adding string "_REGKEY" to
123 * "SET" action names, value names are created by adding "_REG_NAME"
124 * to the "SET" action name.
126 static const WCHAR SPI_SETBEEP_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','S','o','u','n','d',0};
127 static const WCHAR SPI_SETBEEP_VALNAME
[]= {'B','e','e','p',0};
128 static const WCHAR SPI_SETMOUSE_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
129 static const WCHAR SPI_SETMOUSE_VALNAME1
[]= {'M','o','u','s','e','T','h','r','e','s','h','o','l','d','1',0};
130 static const WCHAR SPI_SETMOUSE_VALNAME2
[]= {'M','o','u','s','e','T','h','r','e','s','h','o','l','d','2',0};
131 static const WCHAR SPI_SETMOUSE_VALNAME3
[]= {'M','o','u','s','e','S','p','e','e','d',0};
132 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','\\',
133 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
134 static const WCHAR SPI_SETBORDER_VALNAME
[]= {'B','o','r','d','e','r','W','i','d','t','h',0};
135 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};
136 static const WCHAR SPI_SETKEYBOARDSPEED_VALNAME
[]= {'K','e','y','b','o','a','r','d','S','p','e','e','d',0};
137 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','\\',
138 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
139 static const WCHAR SPI_ICONHORIZONTALSPACING_VALNAME
[]= {'I','c','o','n','S','p','a','c','i','n','g',0};
140 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};
141 static const WCHAR SPI_SETSCREENSAVETIMEOUT_VALNAME
[]= {'S','c','r','e','e','n','S','a','v','e','T','i','m','e','O','u','t',0};
142 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};
143 static const WCHAR SPI_SETSCREENSAVEACTIVE_VALNAME
[]= {'S','c','r','e','e','n','S','a','v','e','A','c','t','i','v','e',0};
144 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};
145 static const WCHAR SPI_SETGRIDGRANULARITY_VALNAME
[]= {'G','r','i','d','G','r','a','n','u','l','a','r','i','t','y',0};
146 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};
147 static const WCHAR SPI_SETKEYBOARDDELAY_VALNAME
[]= {'K','e','y','b','o','a','r','d','D','e','l','a','y',0};
148 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','\\',
149 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
150 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};
151 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','\\',
152 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
153 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};
154 static const WCHAR SPI_SETICONTITLEWRAP_VALNAME
[]= {'I','c','o','n','T','i','t','l','e','W','r','a','p',0};
155 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','\\',
156 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
157 static const WCHAR SPI_SETICONTITLELOGFONT_VALNAME
[]= {'I','c','o','n','F','o','n','t',0};
158 static const WCHAR SPI_SETMENUDROPALIGNMENT_REGKEY1
[]= {'S','o','f','t','w','a','r','e','\\',
159 'M','i','c','r','o','s','o','f','t','\\',
160 'W','i','n','d','o','w','s',' ','N','T','\\',
161 'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
162 'W','i','n','d','o','w','s',0};
163 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};
164 static const WCHAR SPI_SETMENUDROPALIGNMENT_VALNAME
[]= {'M','e','n','u','D','r','o','p','A','l','i','g','n','m','e','n','t',0};
165 static const WCHAR SPI_SETDOUBLECLKWIDTH_REGKEY1
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
166 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};
167 static const WCHAR SPI_SETDOUBLECLKWIDTH_VALNAME
[]= {'D','o','u','b','l','e','C','l','i','c','k','W','i','d','t','h',0};
168 static const WCHAR SPI_SETDOUBLECLKHEIGHT_REGKEY1
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
169 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};
170 static const WCHAR SPI_SETDOUBLECLKHEIGHT_VALNAME
[]= {'D','o','u','b','l','e','C','l','i','c','k','H','e','i','g','h','t',0};
171 static const WCHAR SPI_SETDOUBLECLICKTIME_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
172 static const WCHAR SPI_SETDOUBLECLICKTIME_VALNAME
[]= {'D','o','u','b','l','e','C','l','i','c','k','S','p','e','e','d',0};
173 static const WCHAR SPI_SETMOUSEBUTTONSWAP_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
174 static const WCHAR SPI_SETMOUSEBUTTONSWAP_VALNAME
[]= {'S','w','a','p','M','o','u','s','e','B','u','t','t','o','n','s',0};
175 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};
176 static const WCHAR SPI_SETDRAGFULLWINDOWS_VALNAME
[]= {'D','r','a','g','F','u','l','l','W','i','n','d','o','w','s',0};
177 static const WCHAR SPI_SETSHOWSOUNDS_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
178 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
179 'S','h','o','w','S','o','u','n','d','s',0};
180 static const WCHAR SPI_SETSHOWSOUNDS_VALNAME
[]= {'O','n',0};
181 static const WCHAR SPI_SETKEYBOARDPREF_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
182 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
183 'K','e','y','b','o','a','r','d',' ','P','r','e','f','e','r','e','n','c','e',0};
184 static const WCHAR SPI_SETKEYBOARDPREF_VALNAME
[]= {'O','n',0};
185 static const WCHAR SPI_SETSCREENREADER_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\',
186 'A','c','c','e','s','s','i','b','i','l','i','t','y','\\',
187 'B','l','i','n','d',' ','A','c','c','e','s','s',0};
188 static const WCHAR SPI_SETSCREENREADER_VALNAME
[]= {'O','n',0};
189 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};
190 static const WCHAR SPI_SETDESKWALLPAPER_VALNAME
[]= {'W','a','l','l','p','a','p','e','r',0};
191 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};
192 static const WCHAR SPI_SETFONTSMOOTHING_VALNAME
[]= {'F','o','n','t','S','m','o','o','t','h','i','n','g',0};
193 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};
194 static const WCHAR SPI_SETLOWPOWERACTIVE_VALNAME
[]= {'L','o','w','P','o','w','e','r','A','c','t','i','v','e',0};
195 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};
196 static const WCHAR SPI_SETPOWEROFFACTIVE_VALNAME
[]= {'P','o','w','e','r','O','f','f','A','c','t','i','v','e',0};
197 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};
198 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};
199 static const WCHAR SPI_SETLISTBOXSMOOTHSCROLLING_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p',0};
200 static const WCHAR SPI_SETLISTBOXSMOOTHSCROLLING_VALNAME
[]= {'S','m','o','o','t','h','S','c','r','o','l','l',0};
201 static const WCHAR SPI_SETMOUSEHOVERWIDTH_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
202 static const WCHAR SPI_SETMOUSEHOVERWIDTH_VALNAME
[]= {'M','o','u','s','e','H','o','v','e','r','W','i','d','t','h',0};
203 static const WCHAR SPI_SETMOUSEHOVERHEIGHT_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
204 static const WCHAR SPI_SETMOUSEHOVERHEIGHT_VALNAME
[]= {'M','o','u','s','e','H','o','v','e','r','H','e','i','g','h','t',0};
205 static const WCHAR SPI_SETMOUSEHOVERTIME_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','M','o','u','s','e',0};
206 static const WCHAR SPI_SETMOUSEHOVERTIME_VALNAME
[]= {'M','o','u','s','e','H','o','v','e','r','T','i','m','e',0};
207 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};
208 static const WCHAR SPI_SETMOUSESCROLLLINES_VALNAME
[]= {'W','h','e','e','l','S','c','r','o','l','l','L','i','n','e','s',0};
209 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};
210 static const WCHAR SPI_SETMENUSHOWDELAY_VALNAME
[]= {'M','e','n','u','S','h','o','w','D','e','l','a','y',0};
211 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};
212 static const WCHAR SPI_CARETWIDTH_VALNAME
[]= {'C','a','r','e','t','W','i','d','t','h',0};
214 /* FIXME - real values */
215 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};
216 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};
218 static const WCHAR METRICS_REGKEY
[]= {'C','o','n','t','r','o','l',' ','P','a','n','e','l','\\','D','e','s','k','t','o','p','\\',
219 'W','i','n','d','o','w','M','e','t','r','i','c','s',0};
220 static const WCHAR METRICS_SCROLLWIDTH_VALNAME
[]= {'S','c','r','o','l','l','W','i','d','t','h',0};
221 static const WCHAR METRICS_SCROLLHEIGHT_VALNAME
[]= {'S','c','r','o','l','l','H','e','i','g','h','t',0};
222 static const WCHAR METRICS_CAPTIONWIDTH_VALNAME
[]= {'C','a','p','t','i','o','n','W','i','d','t','h',0};
223 static const WCHAR METRICS_CAPTIONHEIGHT_VALNAME
[]= {'C','a','p','t','i','o','n','H','e','i','g','h','t',0};
224 static const WCHAR METRICS_SMCAPTIONWIDTH_VALNAME
[]= {'S','m','C','a','p','t','i','o','n','W','i','d','t','h',0};
225 static const WCHAR METRICS_SMCAPTIONHEIGHT_VALNAME
[]= {'S','m','C','a','p','t','i','o','n','H','e','i','g','h','t',0};
226 static const WCHAR METRICS_MENUWIDTH_VALNAME
[]= {'M','e','n','u','W','i','d','t','h',0};
227 static const WCHAR METRICS_MENUHEIGHT_VALNAME
[]= {'M','e','n','u','H','e','i','g','h','t',0};
228 static const WCHAR METRICS_ICONSIZE_VALNAME
[]= {'S','h','e','l','l',' ','I','c','o','n',' ','S','i','z','e',0};
229 static const WCHAR METRICS_BORDERWIDTH_VALNAME
[]= {'B','o','r','d','e','r','W','i','d','t','h',0};
230 static const WCHAR METRICS_CAPTIONLOGFONT_VALNAME
[]= {'C','a','p','t','i','o','n','F','o','n','t',0};
231 static const WCHAR METRICS_SMCAPTIONLOGFONT_VALNAME
[]={'S','m','C','a','p','t','i','o','n','F','o','n','t',0};
232 static const WCHAR METRICS_MENULOGFONT_VALNAME
[]= {'M','e','n','u','F','o','n','t',0};
233 static const WCHAR METRICS_MESSAGELOGFONT_VALNAME
[]= {'M','e','s','s','a','g','e','F','o','n','t',0};
234 static const WCHAR METRICS_STATUSLOGFONT_VALNAME
[]= {'S','t','a','t','u','s','F','o','n','t',0};
235 /* minimized metrics */
236 static const WCHAR METRICS_MINWIDTH_VALNAME
[] = {'M','i','n','W','i','d','t','h','\0'};
237 static const WCHAR METRICS_MINHORZGAP_VALNAME
[] = {'M','i','n','H','o','r','z','G','a','p','\0'};
238 static const WCHAR METRICS_MINVERTGAP_VALNAME
[] = {'M','i','n','V','e','r','t','G','a','p','\0'};
239 static const WCHAR METRICS_MINARRANGE_VALNAME
[] = {'M','i','n','A','r','r','a','n','g','e','\0'};
241 static const WCHAR WINE_CURRENT_USER_REGKEY
[] = {'S','o','f','t','w','a','r','e','\\',
244 /* volatile registry branch under WINE_CURRENT_USER_REGKEY for temporary values storage */
245 static const WCHAR WINE_CURRENT_USER_REGKEY_TEMP_PARAMS
[] = {'T','e','m','p','o','r','a','r','y',' ',
246 'S','y','s','t','e','m',' ',
247 'P','a','r','a','m','e','t','e','r','s',0};
249 static const WCHAR Yes
[]= {'Y','e','s',0};
250 static const WCHAR No
[]= {'N','o',0};
251 static const WCHAR Desktop
[]= {'D','e','s','k','t','o','p',0};
252 static const WCHAR Pattern
[]= {'P','a','t','t','e','r','n',0};
253 static const WCHAR MenuFont
[]= {'M','e','n','u','F','o','n','t',0};
254 static const WCHAR MenuFontSize
[]= {'M','e','n','u','F','o','n','t','S','i','z','e',0};
255 static const WCHAR StatusFont
[]= {'S','t','a','t','u','s','F','o','n','t',0};
256 static const WCHAR StatusFontSize
[]= {'S','t','a','t','u','s','F','o','n','t','S','i','z','e',0};
257 static const WCHAR MessageFont
[]= {'M','e','s','s','a','g','e','F','o','n','t',0};
258 static const WCHAR MessageFontSize
[]= {'M','e','s','s','a','g','e','F','o','n','t','S','i','z','e',0};
259 static const WCHAR System
[]= {'S','y','s','t','e','m',0};
260 static const WCHAR IconTitleSize
[]= {'I','c','o','n','T','i','t','l','e','S','i','z','e',0};
261 static const WCHAR IconTitleFaceName
[]= {'I','c','o','n','T','i','t','l','e','F','a','c','e','N','a','m','e',0};
262 static const WCHAR defPattern
[]= {'1','7','0',' ','8','5',' ','1','7','0',' ','8','5',' ','1','7','0',' ','8','5',
263 ' ','1','7','0',' ','8','5',0};
264 static const WCHAR CSu
[]= {'%','u',0};
265 static const WCHAR CSd
[]= {'%','d',0};
267 /* Indicators whether system parameter value is loaded */
268 static char spi_loaded
[SPI_INDEX_COUNT
];
270 static BOOL notify_change
= TRUE
;
272 /* System parameters storage */
273 static BOOL beep_active
= TRUE
;
274 static int mouse_threshold1
= 6;
275 static int mouse_threshold2
= 10;
276 static int mouse_speed
= 1;
277 static UINT border
= 1;
278 static UINT keyboard_speed
= 31;
279 static UINT screensave_timeout
= 300;
280 static UINT grid_granularity
= 0;
281 static UINT keyboard_delay
= 1;
282 static UINT double_click_width
= 4;
283 static UINT double_click_height
= 4;
284 static UINT double_click_time
= 500;
285 static BOOL drag_full_windows
= FALSE
;
286 static RECT work_area
;
287 static BOOL keyboard_pref
= TRUE
;
288 static BOOL screen_reader
= FALSE
;
289 static UINT mouse_hover_width
= 4;
290 static UINT mouse_hover_height
= 4;
291 static UINT mouse_hover_time
= 400;
292 static UINT mouse_scroll_lines
= 3;
293 static UINT menu_show_delay
= 400;
294 static UINT menu_drop_alignment
= 0;
295 static BOOL screensaver_running
= FALSE
;
296 static UINT font_smoothing
= 0; /* 0x01 for 95/98/NT, 0x02 for 98/ME/2k/XP */
297 static BOOL lowpoweractive
= FALSE
;
298 static BOOL poweroffactive
= FALSE
;
299 static BOOL show_sounds
= FALSE
;
300 static BOOL swap_buttons
= FALSE
;
301 static UINT caret_width
= 1;
302 static BYTE user_prefs
[4];
304 static MINIMIZEDMETRICS minimized_metrics
=
306 sizeof(MINIMIZEDMETRICS
),
310 ARW_HIDE
/* iArrange */
313 static ICONMETRICSW icon_metrics
=
315 sizeof(ICONMETRICSW
),
316 75, /* iHorzSpacing */
317 75, /* iVertSpacing */
318 TRUE
, /* iTitleWrap */
319 { -11, 0, 0, 0, FW_NORMAL
, FALSE
, FALSE
, FALSE
, ANSI_CHARSET
,
320 OUT_DEFAULT_PRECIS
, CLIP_DEFAULT_PRECIS
, DEFAULT_QUALITY
, DEFAULT_PITCH
} /* lfFont */
323 static NONCLIENTMETRICSW nonclient_metrics
=
325 sizeof(NONCLIENTMETRICSW
),
326 1, /* iBorderWidth */
327 16, /* iScrollWidth */
328 16, /* iScrollHeight */
329 18, /* iCaptionWidth */
330 18, /* iCaptionHeight */
331 { 0 }, /* lfCaptionFont */
332 13, /* iSmCaptionWidth */
333 15, /* iSmCaptionHeight */
334 { 0 }, /* lfSmCaptionFont */
336 18, /* iMenuHeight */
337 { 0 }, /* lfMenuFont */
338 { 0 }, /* lfStatusFont */
339 { 0 } /* lfMessageFont */
342 /* some additional non client metric info */
343 static TEXTMETRICW tmMenuFont
;
344 static UINT CaptionFontAvCharWidth
;
346 static SIZE icon_size
= { 32, 32 };
348 #define NUM_SYS_COLORS (COLOR_MENUBAR+1)
350 static COLORREF SysColors
[NUM_SYS_COLORS
];
351 static HBRUSH SysColorBrushes
[NUM_SYS_COLORS
];
352 static HPEN SysColorPens
[NUM_SYS_COLORS
];
354 static const WORD wPattern55AA
[] = { 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa, 0x5555, 0xaaaa };
356 HBRUSH SYSCOLOR_55AABrush
= 0;
358 extern void __wine_make_gdi_object_system( HGDIOBJ handle
, BOOL set
);
361 /* This function is a copy of the one in objects/font.c */
362 static void SYSPARAMS_LogFont32ATo16( const LOGFONTA
* font32
, LPLOGFONT16 font16
)
364 font16
->lfHeight
= font32
->lfHeight
;
365 font16
->lfWidth
= font32
->lfWidth
;
366 font16
->lfEscapement
= font32
->lfEscapement
;
367 font16
->lfOrientation
= font32
->lfOrientation
;
368 font16
->lfWeight
= font32
->lfWeight
;
369 font16
->lfItalic
= font32
->lfItalic
;
370 font16
->lfUnderline
= font32
->lfUnderline
;
371 font16
->lfStrikeOut
= font32
->lfStrikeOut
;
372 font16
->lfCharSet
= font32
->lfCharSet
;
373 font16
->lfOutPrecision
= font32
->lfOutPrecision
;
374 font16
->lfClipPrecision
= font32
->lfClipPrecision
;
375 font16
->lfQuality
= font32
->lfQuality
;
376 font16
->lfPitchAndFamily
= font32
->lfPitchAndFamily
;
377 lstrcpynA( font16
->lfFaceName
, font32
->lfFaceName
, LF_FACESIZE
);
380 static void SYSPARAMS_LogFont16To32W( const LOGFONT16
*font16
, LPLOGFONTW font32
)
382 font32
->lfHeight
= font16
->lfHeight
;
383 font32
->lfWidth
= font16
->lfWidth
;
384 font32
->lfEscapement
= font16
->lfEscapement
;
385 font32
->lfOrientation
= font16
->lfOrientation
;
386 font32
->lfWeight
= font16
->lfWeight
;
387 font32
->lfItalic
= font16
->lfItalic
;
388 font32
->lfUnderline
= font16
->lfUnderline
;
389 font32
->lfStrikeOut
= font16
->lfStrikeOut
;
390 font32
->lfCharSet
= font16
->lfCharSet
;
391 font32
->lfOutPrecision
= font16
->lfOutPrecision
;
392 font32
->lfClipPrecision
= font16
->lfClipPrecision
;
393 font32
->lfQuality
= font16
->lfQuality
;
394 font32
->lfPitchAndFamily
= font16
->lfPitchAndFamily
;
395 MultiByteToWideChar( CP_ACP
, 0, font16
->lfFaceName
, -1, font32
->lfFaceName
, LF_FACESIZE
);
396 font32
->lfFaceName
[LF_FACESIZE
-1] = 0;
399 static void SYSPARAMS_LogFont32WTo32A( const LOGFONTW
* font32W
, LPLOGFONTA font32A
)
401 font32A
->lfHeight
= font32W
->lfHeight
;
402 font32A
->lfWidth
= font32W
->lfWidth
;
403 font32A
->lfEscapement
= font32W
->lfEscapement
;
404 font32A
->lfOrientation
= font32W
->lfOrientation
;
405 font32A
->lfWeight
= font32W
->lfWeight
;
406 font32A
->lfItalic
= font32W
->lfItalic
;
407 font32A
->lfUnderline
= font32W
->lfUnderline
;
408 font32A
->lfStrikeOut
= font32W
->lfStrikeOut
;
409 font32A
->lfCharSet
= font32W
->lfCharSet
;
410 font32A
->lfOutPrecision
= font32W
->lfOutPrecision
;
411 font32A
->lfClipPrecision
= font32W
->lfClipPrecision
;
412 font32A
->lfQuality
= font32W
->lfQuality
;
413 font32A
->lfPitchAndFamily
= font32W
->lfPitchAndFamily
;
414 WideCharToMultiByte( CP_ACP
, 0, font32W
->lfFaceName
, -1, font32A
->lfFaceName
, LF_FACESIZE
, NULL
, NULL
);
415 font32A
->lfFaceName
[LF_FACESIZE
-1] = 0;
418 static void SYSPARAMS_LogFont32ATo32W( const LOGFONTA
* font32A
, LPLOGFONTW font32W
)
420 font32W
->lfHeight
= font32A
->lfHeight
;
421 font32W
->lfWidth
= font32A
->lfWidth
;
422 font32W
->lfEscapement
= font32A
->lfEscapement
;
423 font32W
->lfOrientation
= font32A
->lfOrientation
;
424 font32W
->lfWeight
= font32A
->lfWeight
;
425 font32W
->lfItalic
= font32A
->lfItalic
;
426 font32W
->lfUnderline
= font32A
->lfUnderline
;
427 font32W
->lfStrikeOut
= font32A
->lfStrikeOut
;
428 font32W
->lfCharSet
= font32A
->lfCharSet
;
429 font32W
->lfOutPrecision
= font32A
->lfOutPrecision
;
430 font32W
->lfClipPrecision
= font32A
->lfClipPrecision
;
431 font32W
->lfQuality
= font32A
->lfQuality
;
432 font32W
->lfPitchAndFamily
= font32A
->lfPitchAndFamily
;
433 MultiByteToWideChar( CP_ACP
, 0, font32A
->lfFaceName
, -1, font32W
->lfFaceName
, LF_FACESIZE
);
434 font32W
->lfFaceName
[LF_FACESIZE
-1] = 0;
437 static void SYSPARAMS_NonClientMetrics32ATo16( const NONCLIENTMETRICSA
* lpnm32
, LPNONCLIENTMETRICS16 lpnm16
)
439 lpnm16
->iBorderWidth
= lpnm32
->iBorderWidth
;
440 lpnm16
->iScrollWidth
= lpnm32
->iScrollWidth
;
441 lpnm16
->iScrollHeight
= lpnm32
->iScrollHeight
;
442 lpnm16
->iCaptionWidth
= lpnm32
->iCaptionWidth
;
443 lpnm16
->iCaptionHeight
= lpnm32
->iCaptionHeight
;
444 SYSPARAMS_LogFont32ATo16( &lpnm32
->lfCaptionFont
, &lpnm16
->lfCaptionFont
);
445 lpnm16
->iSmCaptionWidth
= lpnm32
->iSmCaptionWidth
;
446 lpnm16
->iSmCaptionHeight
= lpnm32
->iSmCaptionHeight
;
447 SYSPARAMS_LogFont32ATo16( &lpnm32
->lfSmCaptionFont
, &lpnm16
->lfSmCaptionFont
);
448 lpnm16
->iMenuWidth
= lpnm32
->iMenuWidth
;
449 lpnm16
->iMenuHeight
= lpnm32
->iMenuHeight
;
450 SYSPARAMS_LogFont32ATo16( &lpnm32
->lfMenuFont
, &lpnm16
->lfMenuFont
);
451 SYSPARAMS_LogFont32ATo16( &lpnm32
->lfStatusFont
, &lpnm16
->lfStatusFont
);
452 SYSPARAMS_LogFont32ATo16( &lpnm32
->lfMessageFont
, &lpnm16
->lfMessageFont
);
455 static void SYSPARAMS_NonClientMetrics32WTo32A( const NONCLIENTMETRICSW
* lpnm32W
, LPNONCLIENTMETRICSA lpnm32A
)
457 lpnm32A
->iBorderWidth
= lpnm32W
->iBorderWidth
;
458 lpnm32A
->iScrollWidth
= lpnm32W
->iScrollWidth
;
459 lpnm32A
->iScrollHeight
= lpnm32W
->iScrollHeight
;
460 lpnm32A
->iCaptionWidth
= lpnm32W
->iCaptionWidth
;
461 lpnm32A
->iCaptionHeight
= lpnm32W
->iCaptionHeight
;
462 SYSPARAMS_LogFont32WTo32A( &lpnm32W
->lfCaptionFont
, &lpnm32A
->lfCaptionFont
);
463 lpnm32A
->iSmCaptionWidth
= lpnm32W
->iSmCaptionWidth
;
464 lpnm32A
->iSmCaptionHeight
= lpnm32W
->iSmCaptionHeight
;
465 SYSPARAMS_LogFont32WTo32A( &lpnm32W
->lfSmCaptionFont
, &lpnm32A
->lfSmCaptionFont
);
466 lpnm32A
->iMenuWidth
= lpnm32W
->iMenuWidth
;
467 lpnm32A
->iMenuHeight
= lpnm32W
->iMenuHeight
;
468 SYSPARAMS_LogFont32WTo32A( &lpnm32W
->lfMenuFont
, &lpnm32A
->lfMenuFont
);
469 SYSPARAMS_LogFont32WTo32A( &lpnm32W
->lfStatusFont
, &lpnm32A
->lfStatusFont
);
470 SYSPARAMS_LogFont32WTo32A( &lpnm32W
->lfMessageFont
, &lpnm32A
->lfMessageFont
);
473 static void SYSPARAMS_NonClientMetrics32ATo32W( const NONCLIENTMETRICSA
* lpnm32A
, LPNONCLIENTMETRICSW lpnm32W
)
475 lpnm32W
->iBorderWidth
= lpnm32A
->iBorderWidth
;
476 lpnm32W
->iScrollWidth
= lpnm32A
->iScrollWidth
;
477 lpnm32W
->iScrollHeight
= lpnm32A
->iScrollHeight
;
478 lpnm32W
->iCaptionWidth
= lpnm32A
->iCaptionWidth
;
479 lpnm32W
->iCaptionHeight
= lpnm32A
->iCaptionHeight
;
480 SYSPARAMS_LogFont32ATo32W( &lpnm32A
->lfCaptionFont
, &lpnm32W
->lfCaptionFont
);
481 lpnm32W
->iSmCaptionWidth
= lpnm32A
->iSmCaptionWidth
;
482 lpnm32W
->iSmCaptionHeight
= lpnm32A
->iSmCaptionHeight
;
483 SYSPARAMS_LogFont32ATo32W( &lpnm32A
->lfSmCaptionFont
, &lpnm32W
->lfSmCaptionFont
);
484 lpnm32W
->iMenuWidth
= lpnm32A
->iMenuWidth
;
485 lpnm32W
->iMenuHeight
= lpnm32A
->iMenuHeight
;
486 SYSPARAMS_LogFont32ATo32W( &lpnm32A
->lfMenuFont
, &lpnm32W
->lfMenuFont
);
487 SYSPARAMS_LogFont32ATo32W( &lpnm32A
->lfStatusFont
, &lpnm32W
->lfStatusFont
);
488 SYSPARAMS_LogFont32ATo32W( &lpnm32A
->lfMessageFont
, &lpnm32W
->lfMessageFont
);
492 /* Helper functions to retrieve monitors info */
500 static BOOL CALLBACK
monitor_info_proc( HMONITOR monitor
, HDC hdc
, LPRECT rect
, LPARAM lp
)
502 struct monitor_info
*info
= (struct monitor_info
*)lp
;
504 UnionRect( &info
->virtual_rect
, &info
->virtual_rect
, rect
);
508 static void get_monitors_info( struct monitor_info
*info
)
511 SetRectEmpty( &info
->virtual_rect
);
512 EnumDisplayMonitors( 0, NULL
, monitor_info_proc
, (LPARAM
)info
);
516 /* get text metrics and/or "average" char width of the specified logfont
517 * for the specified dc */
518 static void get_text_metr_size( HDC hdc
, LOGFONTW
*plf
, TEXTMETRICW
* ptm
, UINT
*psz
)
520 HFONT hfont
, hfontsav
;
523 hfont
= CreateFontIndirectW( plf
);
524 if( !hfont
|| ( hfontsav
= SelectObject( hdc
, hfont
)) == NULL
) {
527 if( hfont
) DeleteObject( hfont
);
530 GetTextMetricsW( hdc
, ptm
);
532 if( !(*psz
= GdiGetCharDimensions( hdc
, ptm
, NULL
)))
534 SelectObject( hdc
, hfontsav
);
535 DeleteObject( hfont
);
538 /***********************************************************************
539 * get_volatile_regkey
541 * Return a handle to the volatile registry key used to store
542 * non-permanently modified parameters.
544 static HKEY
get_volatile_regkey(void)
546 static HKEY volatile_key
;
551 /* This must be non-volatile! */
552 if (RegCreateKeyExW( HKEY_CURRENT_USER
, WINE_CURRENT_USER_REGKEY
,
553 0, 0, REG_OPTION_NON_VOLATILE
, KEY_ALL_ACCESS
, 0,
554 &key
, 0 ) != ERROR_SUCCESS
)
556 ERR("Can't create wine registry branch\n");
560 /* @@ Wine registry key: HKCU\Software\Wine\Temporary System Parameters */
561 if (RegCreateKeyExW( key
, WINE_CURRENT_USER_REGKEY_TEMP_PARAMS
,
562 0, 0, REG_OPTION_VOLATILE
, KEY_ALL_ACCESS
, 0,
563 &volatile_key
, 0 ) != ERROR_SUCCESS
)
564 ERR("Can't create non-permanent wine registry branch\n");
572 /***********************************************************************
573 * SYSPARAMS_NotifyChange
575 * Sends notification about system parameter update.
577 static void SYSPARAMS_NotifyChange( UINT uiAction
, UINT fWinIni
)
579 static const WCHAR emptyW
[1];
583 if (fWinIni
& SPIF_UPDATEINIFILE
)
585 if (fWinIni
& (SPIF_SENDWININICHANGE
| SPIF_SENDCHANGE
))
586 SendMessageTimeoutW(HWND_BROADCAST
, WM_SETTINGCHANGE
,
587 uiAction
, (LPARAM
) emptyW
,
588 SMTO_ABORTIFHUNG
, 2000, NULL
);
592 /* FIXME notify other wine processes with internal message */
598 /***********************************************************************
599 * Loads system parameter from user profile.
601 static BOOL
SYSPARAMS_LoadRaw( LPCWSTR lpRegKey
, LPCWSTR lpValName
, LPBYTE lpBuf
, DWORD count
)
607 memset( lpBuf
, 0, count
);
608 if ((RegOpenKeyW( get_volatile_regkey(), lpRegKey
, &hKey
) == ERROR_SUCCESS
) ||
609 (RegOpenKeyW( HKEY_CURRENT_USER
, lpRegKey
, &hKey
) == ERROR_SUCCESS
))
611 ret
= !RegQueryValueExW( hKey
, lpValName
, NULL
, &type
, (LPBYTE
)lpBuf
, &count
);
617 static BOOL
SYSPARAMS_Load( LPCWSTR lpRegKey
, LPCWSTR lpValName
, LPWSTR lpBuf
, DWORD count
)
619 return SYSPARAMS_LoadRaw( lpRegKey
, lpValName
, (LPBYTE
)lpBuf
, count
);
622 /***********************************************************************
623 * Saves system parameter to user profile.
626 /* Save data as-is */
627 static BOOL
SYSPARAMS_SaveRaw( LPCWSTR lpRegKey
, LPCWSTR lpValName
,
628 const BYTE
* lpValue
, DWORD valueSize
,
629 DWORD type
, UINT fWinIni
)
636 if (fWinIni
& SPIF_UPDATEINIFILE
)
638 hBaseKey
= HKEY_CURRENT_USER
;
643 hBaseKey
= get_volatile_regkey();
644 dwOptions
= REG_OPTION_VOLATILE
;
647 if (RegCreateKeyExW( hBaseKey
, lpRegKey
,
648 0, 0, dwOptions
, KEY_ALL_ACCESS
,
649 0, &hKey
, 0 ) == ERROR_SUCCESS
)
651 if (RegSetValueExW( hKey
, lpValName
, 0, type
,
652 lpValue
, valueSize
) == ERROR_SUCCESS
)
655 if (hBaseKey
== HKEY_CURRENT_USER
)
656 RegDeleteKeyW( get_volatile_regkey(), lpRegKey
);
663 /* Convenience function to save strings */
664 static BOOL
SYSPARAMS_Save( LPCWSTR lpRegKey
, LPCWSTR lpValName
, LPCWSTR lpValue
,
667 return SYSPARAMS_SaveRaw( lpRegKey
, lpValName
, (const BYTE
*)lpValue
,
668 (strlenW(lpValue
) + 1)*sizeof(WCHAR
), REG_SZ
, fWinIni
);
671 /* Convenience function to save logical fonts */
672 static BOOL
SYSPARAMS_SaveLogFont( LPCWSTR lpRegKey
, LPCWSTR lpValName
,
673 LPLOGFONTW plf
, UINT fWinIni
)
675 return SYSPARAMS_SaveRaw( lpRegKey
, lpValName
, (const BYTE
*)plf
,
676 sizeof( LOGFONTW
), REG_BINARY
, fWinIni
);
680 static inline HDC
get_display_dc(void)
682 static const WCHAR DISPLAY
[] = {'D','I','S','P','L','A','Y',0};
683 static HDC display_dc
;
684 if (!display_dc
) display_dc
= CreateICW( DISPLAY
, NULL
, NULL
, NULL
);
688 static inline int get_display_dpi(void)
690 static int display_dpi
;
691 if (!display_dpi
) display_dpi
= GetDeviceCaps( get_display_dc(), LOGPIXELSY
);
695 /***********************************************************************
696 * SYSPARAMS_Twips2Pixels
698 * Convert a dimension value that was obtained from the registry. These are
699 * quoted as being "twips" values if negative and pixels if positive.
700 * One inch is 1440 twips. So to convert, divide by 1440 to get inches and
701 * multiply that by the dots-per-inch to get the size in pixels.
703 * MSDN Library - April 2001 -> Resource Kits ->
704 * Windows 2000 Resource Kit Reference ->
705 * Technical Reference to the Windows 2000 Registry ->
706 * HKEY_CURRENT_USER -> Control Panel -> Desktop -> WindowMetrics
708 inline static int SYSPARAMS_Twips2Pixels(int x
)
711 x
= (-x
* get_display_dpi() + 720) / 1440;
715 /***********************************************************************
718 * Get a registry entry from the already open key. This allows us to open the
719 * section once and read several values.
721 * Of course this function belongs somewhere more usable but here will do
724 static int get_reg_metric( HKEY hkey
, LPCWSTR lpValName
, int default_value
)
726 int value
= default_value
;
730 DWORD type
, count
= sizeof(buffer
);
731 if(!RegQueryValueExW( hkey
, lpValName
, NULL
, &type
, (LPBYTE
)buffer
, &count
) )
735 /* Are there any utilities for converting registry entries
738 /* FIXME_(reg)("We need reg format converter\n"); */
741 value
= atoiW(buffer
);
744 return SYSPARAMS_Twips2Pixels(value
);
748 /*************************************************************************
749 * SYSPARAMS_SetSysColor
751 static void SYSPARAMS_SetSysColor( int index
, COLORREF color
)
753 if (index
< 0 || index
>= NUM_SYS_COLORS
) return;
754 SysColors
[index
] = color
;
755 if (SysColorBrushes
[index
])
757 __wine_make_gdi_object_system( SysColorBrushes
[index
], FALSE
);
758 DeleteObject( SysColorBrushes
[index
] );
760 SysColorBrushes
[index
] = CreateSolidBrush( color
);
761 __wine_make_gdi_object_system( SysColorBrushes
[index
], TRUE
);
763 if (SysColorPens
[index
])
765 __wine_make_gdi_object_system( SysColorPens
[index
], FALSE
);
766 DeleteObject( SysColorPens
[index
] );
768 SysColorPens
[index
] = CreatePen( PS_SOLID
, 1, color
);
769 __wine_make_gdi_object_system( SysColorPens
[index
], TRUE
);
772 /* load a uint parameter from the registry */
773 static BOOL
get_uint_param( unsigned int idx
, LPCWSTR regkey
, LPCWSTR value
,
774 UINT
*value_ptr
, UINT
*ret_ptr
)
776 if (!ret_ptr
) return FALSE
;
777 if (!spi_loaded
[idx
])
781 if (SYSPARAMS_Load( regkey
, value
, buf
, sizeof(buf
) )) *value_ptr
= atoiW( buf
);
782 spi_loaded
[idx
] = TRUE
;
784 *ret_ptr
= *value_ptr
;
788 /* load a twips parameter from the registry */
789 static BOOL
get_twips_param( unsigned int idx
, LPCWSTR regkey
, LPCWSTR value
,
790 UINT
*value_ptr
, UINT
*ret_ptr
)
792 if (!ret_ptr
) return FALSE
;
793 if (!spi_loaded
[idx
])
797 if (SYSPARAMS_Load( regkey
, value
, buf
, sizeof(buf
) ))
798 *value_ptr
= SYSPARAMS_Twips2Pixels( atoiW(buf
) );
799 spi_loaded
[idx
] = TRUE
;
801 *ret_ptr
= *value_ptr
;
805 /* load a boolean parameter from the registry */
806 static inline BOOL
get_bool_param( unsigned int idx
, LPCWSTR regkey
, LPCWSTR value
,
807 BOOL
*value_ptr
, BOOL
*ret_ptr
)
809 return get_uint_param( idx
, regkey
, value
, (UINT
*)value_ptr
, (UINT
*)ret_ptr
);
812 /* set a uint parameter that is mirrored in two different registry locations */
813 static BOOL
set_uint_param_mirrored( unsigned int idx
, LPCWSTR regkey
, LPCWSTR regkey_mirror
,
814 LPCWSTR value
, UINT
*value_ptr
, UINT new_val
, UINT fWinIni
)
818 wsprintfW(buf
, CSu
, new_val
);
819 if (!SYSPARAMS_Save( regkey
, value
, buf
, fWinIni
)) return FALSE
;
820 if (regkey_mirror
) SYSPARAMS_Save( regkey_mirror
, value
, buf
, fWinIni
);
821 *value_ptr
= new_val
;
822 spi_loaded
[idx
] = TRUE
;
826 /* save an int parameter in registry */
827 static BOOL
save_int_param( LPCWSTR regkey
, LPCWSTR value
, INT
*value_ptr
,
828 INT new_val
, UINT fWinIni
)
832 wsprintfW(buf
, CSd
, new_val
);
833 if (!SYSPARAMS_Save( regkey
, value
, buf
, fWinIni
)) return FALSE
;
834 if( value_ptr
) *value_ptr
= new_val
;
838 /* set an int parameter in the registry */
839 static inline BOOL
set_int_param( unsigned int idx
, LPCWSTR regkey
, LPCWSTR value
,
840 INT
*value_ptr
, INT new_val
, UINT fWinIni
)
842 BOOL ret
= save_int_param( regkey
, value
, value_ptr
, new_val
, fWinIni
);
843 if (ret
) spi_loaded
[idx
] = TRUE
;
847 /* set a uint parameter in the registry */
848 static inline BOOL
set_uint_param( unsigned int idx
, LPCWSTR regkey
, LPCWSTR value
,
849 UINT
*value_ptr
, UINT new_val
, UINT fWinIni
)
851 return set_uint_param_mirrored( idx
, regkey
, NULL
, value
, value_ptr
, new_val
, fWinIni
);
854 /* set a boolean parameter that is mirrored in two different registry locations */
855 static inline BOOL
set_bool_param_mirrored( unsigned int idx
, LPCWSTR regkey
, LPCWSTR regkey_mirror
,
856 LPCWSTR value
, BOOL
*value_ptr
, BOOL new_val
, UINT fWinIni
)
858 return set_uint_param_mirrored( idx
, regkey
, regkey_mirror
, value
,
859 (UINT
*)value_ptr
, new_val
, fWinIni
);
862 /* set a boolean parameter in the registry */
863 static inline BOOL
set_bool_param( unsigned int idx
, LPCWSTR regkey
, LPCWSTR value
,
864 BOOL
*value_ptr
, BOOL new_val
, UINT fWinIni
)
866 return set_uint_param( idx
, regkey
, value
, (UINT
*)value_ptr
, new_val
, fWinIni
);
869 /* load a boolean parameter from the user preference key */
870 static BOOL
get_user_pref_param( UINT offset
, UINT mask
, BOOL
*ret_ptr
)
872 if (!ret_ptr
) return FALSE
;
874 if (!spi_loaded
[SPI_USERPREFERENCEMASK_IDX
])
876 SYSPARAMS_LoadRaw( SPI_USERPREFERENCEMASK_REGKEY
,
877 SPI_USERPREFERENCEMASK_VALNAME
,
878 user_prefs
, sizeof(user_prefs
) );
879 spi_loaded
[SPI_USERPREFERENCEMASK_IDX
] = TRUE
;
881 *ret_ptr
= (user_prefs
[offset
] & mask
) != 0;
885 /* set a boolean parameter in the user preference key */
886 static BOOL
set_user_pref_param( UINT offset
, UINT mask
, BOOL value
, BOOL fWinIni
)
888 SYSPARAMS_LoadRaw( SPI_USERPREFERENCEMASK_REGKEY
,
889 SPI_USERPREFERENCEMASK_VALNAME
,
890 user_prefs
, sizeof(user_prefs
) );
891 spi_loaded
[SPI_USERPREFERENCEMASK_IDX
] = TRUE
;
893 if (value
) user_prefs
[offset
] |= mask
;
894 else user_prefs
[offset
] &= ~mask
;
896 SYSPARAMS_SaveRaw( SPI_USERPREFERENCEMASK_REGKEY
,
897 SPI_USERPREFERENCEMASK_VALNAME
,
898 user_prefs
, sizeof(user_prefs
), REG_BINARY
, fWinIni
);
902 /***********************************************************************
905 * Initialisation of the system metrics array.
907 void SYSPARAMS_Init(void)
909 HKEY hkey
; /* key to the window metrics area of the registry */
914 /* initialize system colors */
916 if (RegCreateKeyExA(HKEY_CURRENT_USER
, "Control Panel\\Colors", 0, 0, 0, KEY_ALL_ACCESS
, 0, &hkey
, 0))
918 for (i
= 0; i
< NUM_SYS_COLORS
; i
++)
922 /* first try, registry */
925 DWORD dwDataSize
= sizeof(buffer
);
926 if (!(RegQueryValueExA(hkey
,DefSysColors
[i
*2], 0, 0, (LPBYTE
) buffer
, &dwDataSize
)))
927 if (sscanf( buffer
, "%d %d %d", &r
, &g
, &b
) == 3) bOk
= TRUE
;
930 /* second try, win.ini */
933 GetProfileStringA( "colors", DefSysColors
[i
*2], DefSysColors
[i
*2+1], buffer
, 100 );
934 if (sscanf( buffer
, " %d %d %d", &r
, &g
, &b
) == 3) bOk
= TRUE
;
937 /* last chance, take the default */
940 int iNumColors
= sscanf( DefSysColors
[i
*2+1], " %d %d %d", &r
, &g
, &b
);
941 assert (iNumColors
==3);
944 SYSPARAMS_SetSysColor( i
, RGB(r
,g
,b
) );
946 if (hkey
) RegCloseKey( hkey
);
948 /* create 55AA bitmap */
950 h55AABitmap
= CreateBitmap( 8, 8, 1, 1, wPattern55AA
);
951 SYSCOLOR_55AABrush
= CreatePatternBrush( h55AABitmap
);
952 __wine_make_gdi_object_system( SYSCOLOR_55AABrush
, TRUE
);
956 /***********************************************************************
959 * Tries to retrieve logfont info from the specified key and value
961 static BOOL
reg_get_logfont(LPCWSTR key
, LPCWSTR value
, LOGFONTW
*lf
)
970 base_keys
[0] = get_volatile_regkey();
971 base_keys
[1] = HKEY_CURRENT_USER
;
973 for(i
= 0; i
< 2 && !found
; i
++)
975 if(RegOpenKeyW(base_keys
[i
], key
, &hkey
) == ERROR_SUCCESS
)
977 size
= sizeof(lfbuf
);
978 if(RegQueryValueExW(hkey
, value
, NULL
, &type
, (LPBYTE
)&lfbuf
, &size
) == ERROR_SUCCESS
&&
981 if( size
== sizeof(lfbuf
))
984 memcpy(lf
, &lfbuf
, size
);
985 } else if( size
== sizeof( LOGFONT16
))
986 { /* win9x-winME format */
988 SYSPARAMS_LogFont16To32W( (LOGFONT16
*) &lfbuf
, lf
);
990 WARN("Unknown format in key %s value %s, size is %d\n",
991 debugstr_w( key
), debugstr_w( value
), size
);
996 if( found
&& lf
->lfHeight
> 0) {
997 /* positive height value means points ( inch/72 ) */
998 lf
->lfHeight
= -MulDiv( lf
->lfHeight
, get_display_dpi(), 72);
1003 /* load all the minimized metrics */
1004 static void load_minimized_metrics(void)
1007 if (RegOpenKeyExW (HKEY_CURRENT_USER
, METRICS_REGKEY
,
1008 0, KEY_QUERY_VALUE
, &hkey
) != ERROR_SUCCESS
) hkey
= 0;
1010 minimized_metrics
.iWidth
= max( get_reg_metric(hkey
,
1011 METRICS_MINWIDTH_VALNAME
, minimized_metrics
.iWidth
), 0);
1012 minimized_metrics
.iHorzGap
= max( get_reg_metric(hkey
,
1013 METRICS_MINHORZGAP_VALNAME
, minimized_metrics
.iHorzGap
), 0);
1014 minimized_metrics
.iVertGap
= max( get_reg_metric(hkey
,
1015 METRICS_MINVERTGAP_VALNAME
, minimized_metrics
.iVertGap
), 0);
1016 minimized_metrics
.iArrange
= 0x0f & get_reg_metric(hkey
,
1017 METRICS_MINARRANGE_VALNAME
, minimized_metrics
.iArrange
);
1019 if (hkey
) RegCloseKey( hkey
);
1020 spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
] = TRUE
;
1023 /* adjust some of the raw values found in the registry */
1024 static void normalize_nonclientmetrics( NONCLIENTMETRICSW
*pncm
)
1027 if( pncm
->iBorderWidth
< 1) pncm
->iBorderWidth
= 1;
1028 if( pncm
->iCaptionWidth
< 8) pncm
->iCaptionWidth
= 8;
1029 if( pncm
->iScrollWidth
< 8) pncm
->iScrollWidth
= 8;
1030 if( pncm
->iScrollHeight
< 8) pncm
->iScrollHeight
= 8;
1032 /* get some extra metrics */
1033 get_text_metr_size( get_display_dc(), &pncm
->lfMenuFont
,
1035 get_text_metr_size( get_display_dc(), &pncm
->lfCaptionFont
,
1036 NULL
, &CaptionFontAvCharWidth
);
1038 /* adjust some heights to the corresponding font */
1039 pncm
->iMenuHeight
= max( pncm
->iMenuHeight
,
1040 2 + tmMenuFont
.tmHeight
+ tmMenuFont
.tmExternalLeading
);
1041 get_text_metr_size( get_display_dc(), &pncm
->lfCaptionFont
, &tm
, NULL
);
1042 pncm
->iCaptionHeight
= max( pncm
->iCaptionHeight
, 2 + tm
.tmHeight
);
1043 get_text_metr_size( get_display_dc(), &pncm
->lfSmCaptionFont
, &tm
, NULL
);
1044 pncm
->iSmCaptionHeight
= max( pncm
->iSmCaptionHeight
, 2 + tm
.tmHeight
);
1047 /* load all the non-client metrics */
1048 static void load_nonclient_metrics(void)
1051 NONCLIENTMETRICSW ncm
;
1054 ncm
.cbSize
= sizeof (ncm
);
1055 if (RegOpenKeyExW (HKEY_CURRENT_USER
, METRICS_REGKEY
,
1056 0, KEY_QUERY_VALUE
, &hkey
) != ERROR_SUCCESS
) hkey
= 0;
1058 /* initialize geometry entries */
1059 ncm
.iBorderWidth
= get_reg_metric(hkey
, METRICS_BORDERWIDTH_VALNAME
, 1);
1060 ncm
.iScrollWidth
= get_reg_metric(hkey
, METRICS_SCROLLWIDTH_VALNAME
, 16);
1061 ncm
.iScrollHeight
= get_reg_metric(hkey
, METRICS_SCROLLHEIGHT_VALNAME
, 16);
1063 /* size of the normal caption buttons */
1064 ncm
.iCaptionHeight
= get_reg_metric(hkey
, METRICS_CAPTIONHEIGHT_VALNAME
, 18);
1065 ncm
.iCaptionWidth
= get_reg_metric(hkey
, METRICS_CAPTIONWIDTH_VALNAME
, ncm
.iCaptionHeight
);
1067 /* caption font metrics */
1068 if (!reg_get_logfont(METRICS_REGKEY
, METRICS_CAPTIONLOGFONT_VALNAME
, &ncm
.lfCaptionFont
))
1070 SystemParametersInfoW( SPI_GETICONTITLELOGFONT
, 0, &ncm
.lfCaptionFont
, 0 );
1071 ncm
.lfCaptionFont
.lfWeight
= FW_BOLD
;
1074 /* size of the small caption buttons */
1075 ncm
.iSmCaptionWidth
= get_reg_metric(hkey
, METRICS_SMCAPTIONWIDTH_VALNAME
, 13);
1076 ncm
.iSmCaptionHeight
= get_reg_metric(hkey
, METRICS_SMCAPTIONHEIGHT_VALNAME
, 15);
1078 /* small caption font metrics */
1079 if (!reg_get_logfont(METRICS_REGKEY
, METRICS_SMCAPTIONLOGFONT_VALNAME
, &ncm
.lfSmCaptionFont
))
1080 SystemParametersInfoW( SPI_GETICONTITLELOGFONT
, 0, &ncm
.lfSmCaptionFont
, 0 );
1082 /* menus, FIXME: names of wine.conf entries are bogus */
1084 /* size of the menu (MDI) buttons */
1085 ncm
.iMenuHeight
= get_reg_metric(hkey
, METRICS_MENUHEIGHT_VALNAME
, 18);
1086 ncm
.iMenuWidth
= get_reg_metric(hkey
, METRICS_MENUWIDTH_VALNAME
, ncm
.iMenuHeight
);
1088 /* menu font metrics */
1089 if (!reg_get_logfont(METRICS_REGKEY
, METRICS_MENULOGFONT_VALNAME
, &ncm
.lfMenuFont
))
1091 SystemParametersInfoW( SPI_GETICONTITLELOGFONT
, 0, &ncm
.lfMenuFont
, 0 );
1092 GetProfileStringW( Desktop
, MenuFont
, ncm
.lfCaptionFont
.lfFaceName
,
1093 ncm
.lfMenuFont
.lfFaceName
, LF_FACESIZE
);
1094 r
= GetProfileIntW( Desktop
, MenuFontSize
, 0 );
1096 ncm
.lfMenuFont
.lfHeight
= -r
;
1097 ncm
.lfMenuFont
.lfWeight
= FW_NORMAL
;
1100 /* status bar font metrics */
1101 if (!reg_get_logfont(METRICS_REGKEY
, METRICS_STATUSLOGFONT_VALNAME
, &ncm
.lfStatusFont
))
1103 SystemParametersInfoW( SPI_GETICONTITLELOGFONT
, 0, &ncm
.lfStatusFont
, 0 );
1104 GetProfileStringW( Desktop
, StatusFont
, ncm
.lfCaptionFont
.lfFaceName
,
1105 ncm
.lfStatusFont
.lfFaceName
, LF_FACESIZE
);
1106 r
= GetProfileIntW( Desktop
, StatusFontSize
, 0 );
1108 ncm
.lfStatusFont
.lfHeight
= -r
;
1109 ncm
.lfStatusFont
.lfWeight
= FW_NORMAL
;
1112 /* message font metrics */
1113 if (!reg_get_logfont(METRICS_REGKEY
, METRICS_MESSAGELOGFONT_VALNAME
, &ncm
.lfMessageFont
))
1115 SystemParametersInfoW( SPI_GETICONTITLELOGFONT
, 0, &ncm
.lfMessageFont
, 0 );
1116 GetProfileStringW( Desktop
, MessageFont
, ncm
.lfCaptionFont
.lfFaceName
,
1117 ncm
.lfMessageFont
.lfFaceName
, LF_FACESIZE
);
1118 r
= GetProfileIntW( Desktop
, MessageFontSize
, 0 );
1120 ncm
.lfMessageFont
.lfHeight
= -r
;
1121 ncm
.lfMessageFont
.lfWeight
= FW_NORMAL
;
1124 /* some extra fields not in the nonclient structure */
1125 icon_size
.cx
= icon_size
.cy
= get_reg_metric( hkey
, METRICS_ICONSIZE_VALNAME
, 32 );
1127 if (hkey
) RegCloseKey( hkey
);
1128 normalize_nonclientmetrics( &ncm
);
1129 memcpy( &nonclient_metrics
, &ncm
, sizeof(nonclient_metrics
) );
1130 spi_loaded
[SPI_NONCLIENTMETRICS_IDX
] = TRUE
;
1134 /***********************************************************************
1135 * SystemParametersInfoW (USER32.@)
1137 * Each system parameter has flag which shows whether the parameter
1138 * is loaded or not. Parameters, stored directly in SysParametersInfo are
1139 * loaded from registry only when they are requested and the flag is
1140 * "false", after the loading the flag is set to "true". On interprocess
1141 * notification of the parameter change the corresponding parameter flag is
1142 * set to "false". The parameter value will be reloaded when it is requested
1144 * Parameters, backed by or depend on GetSystemMetrics are processed
1145 * differently. These parameters are always loaded. They are reloaded right
1146 * away on interprocess change notification. We can't do lazy loading because
1147 * we don't want to complicate GetSystemMetrics.
1148 * Parameters, backed by X settings are read from corresponding setting.
1149 * On the parameter change request the setting is changed. Interprocess change
1150 * notifications are ignored.
1151 * When parameter value is updated the changed value is stored in permanent
1152 * registry branch if saving is requested. Otherwise it is stored
1153 * in temporary branch
1155 * Some SPI values can also be stored as Twips values in the registry,
1156 * don't forget the conversion!
1158 BOOL WINAPI
SystemParametersInfoW( UINT uiAction
, UINT uiParam
,
1159 PVOID pvParam
, UINT fWinIni
)
1161 #define WINE_SPI_FIXME(x) \
1163 FIXME( "Unimplemented action: %u (%s)\n", x, #x ); \
1164 SetLastError( ERROR_INVALID_SPI_VALUE ); \
1167 #define WINE_SPI_WARN(x) \
1169 WARN( "Ignored action: %u (%s)\n", x, #x ); \
1173 unsigned spi_idx
= 0;
1177 case SPI_GETBEEP
: /* 1 */
1178 if (!pvParam
) return FALSE
;
1180 spi_idx
= SPI_SETBEEP_IDX
;
1181 if (!spi_loaded
[spi_idx
])
1185 if (SYSPARAMS_Load( SPI_SETBEEP_REGKEY
, SPI_SETBEEP_VALNAME
, buf
, sizeof(buf
) ))
1186 beep_active
= !lstrcmpiW( Yes
, buf
);
1187 spi_loaded
[spi_idx
] = TRUE
;
1190 *(BOOL
*)pvParam
= beep_active
;
1193 case SPI_SETBEEP
: /* 2 */
1194 spi_idx
= SPI_SETBEEP_IDX
;
1195 if (SYSPARAMS_Save( SPI_SETBEEP_REGKEY
, SPI_SETBEEP_VALNAME
,
1196 (uiParam
? Yes
: No
), fWinIni
))
1198 beep_active
= uiParam
;
1199 spi_loaded
[spi_idx
] = TRUE
;
1205 case SPI_GETMOUSE
: /* 3 */
1206 if (!pvParam
) return FALSE
;
1208 spi_idx
= SPI_SETMOUSE_IDX
;
1209 if (!spi_loaded
[spi_idx
])
1213 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY
, SPI_SETMOUSE_VALNAME1
,
1215 mouse_threshold1
= atoiW( buf
);
1216 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY
, SPI_SETMOUSE_VALNAME2
,
1218 mouse_threshold2
= atoiW( buf
);
1219 if (SYSPARAMS_Load( SPI_SETMOUSE_REGKEY
, SPI_SETMOUSE_VALNAME3
,
1221 mouse_speed
= atoiW( buf
);
1222 spi_loaded
[spi_idx
] = TRUE
;
1224 ((INT
*)pvParam
)[0] = mouse_threshold1
;
1225 ((INT
*)pvParam
)[1] = mouse_threshold2
;
1226 ((INT
*)pvParam
)[2] = mouse_speed
;
1229 case SPI_SETMOUSE
: /* 4 */
1231 if (!pvParam
) return FALSE
;
1232 ret
= set_int_param( SPI_SETMOUSE_IDX
, SPI_SETMOUSE_REGKEY
, SPI_SETMOUSE_VALNAME1
,
1233 &mouse_threshold1
, ((INT
*)pvParam
)[0], fWinIni
);
1235 save_int_param( SPI_SETMOUSE_REGKEY
, SPI_SETMOUSE_VALNAME2
,
1236 &mouse_threshold2
, ((INT
*)pvParam
)[1], fWinIni
);
1237 save_int_param( SPI_SETMOUSE_REGKEY
, SPI_SETMOUSE_VALNAME3
,
1238 &mouse_speed
, ((INT
*)pvParam
)[2], fWinIni
);
1244 ret
= get_twips_param( SPI_SETBORDER_IDX
,
1245 SPI_SETBORDER_REGKEY
,
1246 SPI_SETBORDER_VALNAME
,
1248 if( *(INT
*)pvParam
< 1) *(INT
*)pvParam
= 1;
1252 nonclient_metrics
.iBorderWidth
= uiParam
> 0 ? uiParam
: 1;
1253 /* raw value goes to registry */
1254 ret
= set_uint_param( SPI_SETBORDER_IDX
,
1255 SPI_SETBORDER_REGKEY
,
1256 SPI_SETBORDER_VALNAME
,
1257 &border
, uiParam
, fWinIni
);
1260 case SPI_GETKEYBOARDSPEED
:
1261 ret
= get_uint_param( SPI_SETKEYBOARDSPEED_IDX
,
1262 SPI_SETKEYBOARDSPEED_REGKEY
,
1263 SPI_SETKEYBOARDSPEED_VALNAME
,
1264 &keyboard_speed
, pvParam
);
1267 case SPI_SETKEYBOARDSPEED
:
1268 if (uiParam
> 31) uiParam
= 31;
1269 ret
= set_uint_param( SPI_SETKEYBOARDSPEED_IDX
,
1270 SPI_SETKEYBOARDSPEED_REGKEY
,
1271 SPI_SETKEYBOARDSPEED_VALNAME
,
1272 &keyboard_speed
, uiParam
, fWinIni
);
1275 /* not implemented in Windows */
1276 WINE_SPI_WARN(SPI_LANGDRIVER
); /* 12 */
1278 case SPI_ICONHORIZONTALSPACING
:
1279 if (pvParam
!= NULL
)
1281 ret
= get_twips_param( SPI_ICONHORIZONTALSPACING_IDX
,
1282 SPI_ICONHORIZONTALSPACING_REGKEY
,
1283 SPI_ICONHORIZONTALSPACING_VALNAME
,
1284 (UINT
*)&icon_metrics
.iHorzSpacing
, pvParam
);
1288 if (uiParam
< 32) uiParam
= 32;
1289 ret
= set_uint_param( SPI_ICONHORIZONTALSPACING_IDX
,
1290 SPI_ICONHORIZONTALSPACING_REGKEY
,
1291 SPI_ICONHORIZONTALSPACING_VALNAME
,
1292 (UINT
*)&icon_metrics
.iHorzSpacing
, uiParam
, fWinIni
);
1296 case SPI_GETSCREENSAVETIMEOUT
:
1297 ret
= get_uint_param( SPI_SETSCREENSAVETIMEOUT_IDX
,
1298 SPI_SETSCREENSAVETIMEOUT_REGKEY
,
1299 SPI_SETSCREENSAVETIMEOUT_VALNAME
,
1300 &screensave_timeout
, pvParam
);
1303 case SPI_SETSCREENSAVETIMEOUT
:
1304 ret
= set_uint_param( SPI_SETSCREENSAVETIMEOUT_IDX
,
1305 SPI_SETSCREENSAVETIMEOUT_REGKEY
,
1306 SPI_SETSCREENSAVETIMEOUT_VALNAME
,
1307 &screensave_timeout
, uiParam
, fWinIni
);
1310 case SPI_GETSCREENSAVEACTIVE
: /* 16 */
1311 if (!pvParam
) return FALSE
;
1312 *(BOOL
*)pvParam
= USER_Driver
->pGetScreenSaveActive();
1315 case SPI_SETSCREENSAVEACTIVE
: /* 17 */
1319 wsprintfW(buf
, CSu
, uiParam
);
1320 USER_Driver
->pSetScreenSaveActive( uiParam
);
1321 /* saved value does not affect Wine */
1322 SYSPARAMS_Save( SPI_SETSCREENSAVEACTIVE_REGKEY
,
1323 SPI_SETSCREENSAVEACTIVE_VALNAME
,
1328 case SPI_GETGRIDGRANULARITY
:
1329 ret
= get_uint_param( SPI_SETGRIDGRANULARITY_IDX
,
1330 SPI_SETGRIDGRANULARITY_REGKEY
,
1331 SPI_SETGRIDGRANULARITY_VALNAME
,
1332 &grid_granularity
, pvParam
);
1335 case SPI_SETGRIDGRANULARITY
:
1336 ret
= set_uint_param( SPI_SETGRIDGRANULARITY_IDX
,
1337 SPI_SETGRIDGRANULARITY_REGKEY
,
1338 SPI_SETGRIDGRANULARITY_VALNAME
,
1339 &grid_granularity
, uiParam
, fWinIni
);
1342 case SPI_SETDESKWALLPAPER
: /* 20 */
1343 if (!pvParam
|| !SetDeskWallPaper( (LPSTR
)pvParam
)) return FALSE
;
1344 SYSPARAMS_Save(SPI_SETDESKWALLPAPER_REGKEY
, SPI_SETDESKWALLPAPER_VALNAME
, pvParam
, fWinIni
);
1347 case SPI_SETDESKPATTERN
: /* 21 */
1348 /* FIXME: the ability to specify a pattern in pvParam
1349 doesn't seem to be documented for Win32 */
1350 if ((INT16
)uiParam
== -1)
1353 GetProfileStringW( Desktop
, Pattern
,
1355 buf
, sizeof(buf
)/sizeof(WCHAR
) );
1356 ret
= DESKTOP_SetPattern( buf
);
1358 ret
= DESKTOP_SetPattern( (LPWSTR
)pvParam
);
1361 case SPI_GETKEYBOARDDELAY
:
1362 ret
= get_uint_param( SPI_SETKEYBOARDDELAY_IDX
,
1363 SPI_SETKEYBOARDDELAY_REGKEY
,
1364 SPI_SETKEYBOARDDELAY_VALNAME
,
1365 &keyboard_delay
, pvParam
);
1368 case SPI_SETKEYBOARDDELAY
:
1369 ret
= set_uint_param( SPI_SETKEYBOARDDELAY_IDX
,
1370 SPI_SETKEYBOARDDELAY_REGKEY
,
1371 SPI_SETKEYBOARDDELAY_VALNAME
,
1372 &keyboard_delay
, uiParam
, fWinIni
);
1375 case SPI_ICONVERTICALSPACING
:
1376 if (pvParam
!= NULL
)
1378 ret
= get_twips_param( SPI_ICONVERTICALSPACING_IDX
,
1379 SPI_ICONVERTICALSPACING_REGKEY
,
1380 SPI_ICONVERTICALSPACING_VALNAME
,
1381 (UINT
*)&icon_metrics
.iVertSpacing
, pvParam
);
1382 if( icon_metrics
.iVertSpacing
< 32)
1383 icon_metrics
.iVertSpacing
= 32;
1387 if (uiParam
< 32) uiParam
= 32;
1388 ret
= set_uint_param( SPI_ICONVERTICALSPACING_IDX
,
1389 SPI_ICONVERTICALSPACING_REGKEY
,
1390 SPI_ICONVERTICALSPACING_VALNAME
,
1391 (UINT
*)&icon_metrics
.iVertSpacing
, uiParam
, fWinIni
);
1395 case SPI_GETICONTITLEWRAP
:
1396 ret
= get_bool_param( SPI_SETICONTITLEWRAP_IDX
,
1397 SPI_SETICONTITLEWRAP_REGKEY1
,
1398 SPI_SETICONTITLEWRAP_VALNAME
,
1399 &icon_metrics
.iTitleWrap
, pvParam
);
1402 case SPI_SETICONTITLEWRAP
:
1403 ret
= set_bool_param_mirrored( SPI_SETICONTITLEWRAP_IDX
,
1404 SPI_SETICONTITLEWRAP_REGKEY1
,
1405 SPI_SETICONTITLEWRAP_REGKEY2
,
1406 SPI_SETICONTITLEWRAP_VALNAME
,
1407 &icon_metrics
.iTitleWrap
, uiParam
, fWinIni
);
1410 case SPI_GETMENUDROPALIGNMENT
:
1411 ret
= get_uint_param( SPI_SETMENUDROPALIGNMENT_IDX
,
1412 SPI_SETMENUDROPALIGNMENT_REGKEY1
,
1413 SPI_SETMENUDROPALIGNMENT_VALNAME
,
1414 &menu_drop_alignment
, pvParam
);
1417 case SPI_SETMENUDROPALIGNMENT
:
1418 ret
= set_uint_param_mirrored( SPI_SETMENUDROPALIGNMENT_IDX
,
1419 SPI_SETMENUDROPALIGNMENT_REGKEY1
,
1420 SPI_SETMENUDROPALIGNMENT_REGKEY2
,
1421 SPI_SETMENUDROPALIGNMENT_VALNAME
,
1422 &menu_drop_alignment
, uiParam
, fWinIni
);
1425 case SPI_SETDOUBLECLKWIDTH
:
1426 ret
= set_uint_param_mirrored( SPI_SETDOUBLECLKWIDTH_IDX
,
1427 SPI_SETDOUBLECLKWIDTH_REGKEY1
,
1428 SPI_SETDOUBLECLKWIDTH_REGKEY2
,
1429 SPI_SETDOUBLECLKWIDTH_VALNAME
,
1430 &double_click_width
, uiParam
, fWinIni
);
1433 case SPI_SETDOUBLECLKHEIGHT
:
1434 ret
= set_uint_param_mirrored( SPI_SETDOUBLECLKHEIGHT_IDX
,
1435 SPI_SETDOUBLECLKHEIGHT_REGKEY1
,
1436 SPI_SETDOUBLECLKHEIGHT_REGKEY2
,
1437 SPI_SETDOUBLECLKHEIGHT_VALNAME
,
1438 &double_click_height
, uiParam
, fWinIni
);
1441 case SPI_GETICONTITLELOGFONT
:
1445 if (!pvParam
) return FALSE
;
1447 spi_idx
= SPI_SETICONTITLELOGFONT_IDX
;
1448 if (!spi_loaded
[spi_idx
])
1450 if (!reg_get_logfont( SPI_SETICONTITLELOGFONT_REGKEY
,
1451 SPI_SETICONTITLELOGFONT_VALNAME
, &icon_metrics
.lfFont
))
1456 * The 'default GDI fonts' seems to be returned.
1457 * If a returned font is not a correct font in your environment,
1458 * please try to fix objects/gdiobj.c at first.
1460 GetObjectW( GetStockObject( DEFAULT_GUI_FONT
), sizeof(LOGFONTW
), &lfDefault
);
1462 GetProfileStringW( Desktop
, IconTitleFaceName
,
1463 lfDefault
.lfFaceName
,
1464 icon_metrics
.lfFont
.lfFaceName
,
1467 r
= GetProfileIntW( Desktop
, IconTitleSize
, 0 );
1469 icon_metrics
.lfFont
.lfHeight
= -r
;
1471 icon_metrics
.lfFont
.lfHeight
= lfDefault
.lfHeight
;
1473 icon_metrics
.lfFont
.lfWidth
= 0;
1474 icon_metrics
.lfFont
.lfEscapement
= icon_metrics
.lfFont
.lfOrientation
= 0;
1475 icon_metrics
.lfFont
.lfWeight
= FW_NORMAL
;
1476 icon_metrics
.lfFont
.lfItalic
= FALSE
;
1477 icon_metrics
.lfFont
.lfStrikeOut
= FALSE
;
1478 icon_metrics
.lfFont
.lfUnderline
= FALSE
;
1479 icon_metrics
.lfFont
.lfCharSet
= lfDefault
.lfCharSet
; /* at least 'charset' should not be hard-coded */
1480 icon_metrics
.lfFont
.lfOutPrecision
= OUT_DEFAULT_PRECIS
;
1481 icon_metrics
.lfFont
.lfClipPrecision
= CLIP_DEFAULT_PRECIS
;
1482 icon_metrics
.lfFont
.lfQuality
= DEFAULT_QUALITY
;
1483 icon_metrics
.lfFont
.lfPitchAndFamily
= DEFAULT_PITCH
;
1484 spi_loaded
[spi_idx
] = TRUE
;
1487 *(LOGFONTW
*)pvParam
= icon_metrics
.lfFont
;
1491 case SPI_SETDOUBLECLICKTIME
:
1492 ret
= set_uint_param( SPI_SETDOUBLECLICKTIME_IDX
,
1493 SPI_SETDOUBLECLICKTIME_REGKEY
,
1494 SPI_SETDOUBLECLICKTIME_VALNAME
,
1495 &double_click_time
, uiParam
, fWinIni
);
1498 case SPI_SETMOUSEBUTTONSWAP
:
1499 ret
= set_bool_param( SPI_SETMOUSEBUTTONSWAP_IDX
,
1500 SPI_SETMOUSEBUTTONSWAP_REGKEY
,
1501 SPI_SETMOUSEBUTTONSWAP_VALNAME
,
1502 &swap_buttons
, uiParam
, fWinIni
);
1505 case SPI_SETICONTITLELOGFONT
: /* 34 */
1506 if( uiParam
== sizeof(LOGFONTW
)) {
1507 ret
= SYSPARAMS_SaveLogFont( SPI_SETICONTITLELOGFONT_REGKEY
,
1508 SPI_SETICONTITLELOGFONT_VALNAME
, (LOGFONTW
*)pvParam
, fWinIni
);
1510 icon_metrics
.lfFont
= *(LOGFONTW
*)pvParam
;
1511 spi_loaded
[SPI_SETICONTITLELOGFONT_IDX
] = TRUE
;
1517 case SPI_GETFASTTASKSWITCH
: /* 35 */
1518 if (!pvParam
) return FALSE
;
1519 *(BOOL
*)pvParam
= 1;
1522 case SPI_SETFASTTASKSWITCH
: /* 36 */
1523 /* the action is disabled */
1527 case SPI_SETDRAGFULLWINDOWS
:
1528 ret
= set_bool_param( SPI_SETDRAGFULLWINDOWS_IDX
,
1529 SPI_SETDRAGFULLWINDOWS_REGKEY
,
1530 SPI_SETDRAGFULLWINDOWS_VALNAME
,
1531 &drag_full_windows
, uiParam
, fWinIni
);
1534 case SPI_GETDRAGFULLWINDOWS
:
1535 ret
= get_bool_param( SPI_SETDRAGFULLWINDOWS_IDX
,
1536 SPI_SETDRAGFULLWINDOWS_REGKEY
,
1537 SPI_SETDRAGFULLWINDOWS_VALNAME
,
1538 &drag_full_windows
, pvParam
);
1541 case SPI_GETNONCLIENTMETRICS
:
1543 LPNONCLIENTMETRICSW lpnm
= pvParam
;
1545 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
1547 if (lpnm
&& lpnm
->cbSize
== sizeof(NONCLIENTMETRICSW
))
1548 memcpy( lpnm
, &nonclient_metrics
, sizeof(*lpnm
) );
1554 case SPI_SETNONCLIENTMETRICS
:
1556 LPNONCLIENTMETRICSW lpnm
= pvParam
;
1558 if (lpnm
&& lpnm
->cbSize
== sizeof(NONCLIENTMETRICSW
))
1560 NONCLIENTMETRICSW ncm
;
1561 ret
= set_uint_param( SPI_SETBORDER_IDX
,
1562 SPI_SETBORDER_REGKEY
, SPI_SETBORDER_VALNAME
,
1563 &border
, lpnm
->iBorderWidth
, fWinIni
);
1564 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1565 METRICS_SCROLLWIDTH_VALNAME
, NULL
,
1566 lpnm
->iScrollWidth
, fWinIni
);
1567 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1568 METRICS_SCROLLHEIGHT_VALNAME
, NULL
,
1569 lpnm
->iScrollHeight
, fWinIni
);
1570 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1571 METRICS_CAPTIONWIDTH_VALNAME
, NULL
,
1572 lpnm
->iCaptionWidth
, fWinIni
);
1573 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1574 METRICS_CAPTIONHEIGHT_VALNAME
, NULL
,
1575 lpnm
->iCaptionHeight
, fWinIni
);
1576 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1577 METRICS_SMCAPTIONWIDTH_VALNAME
, NULL
,
1578 lpnm
->iSmCaptionWidth
, fWinIni
);
1579 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1580 METRICS_SMCAPTIONHEIGHT_VALNAME
, NULL
,
1581 lpnm
->iSmCaptionHeight
, fWinIni
);
1582 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1583 METRICS_MENUWIDTH_VALNAME
, NULL
,
1584 lpnm
->iMenuWidth
, fWinIni
);
1585 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1586 METRICS_MENUHEIGHT_VALNAME
, NULL
,
1587 lpnm
->iMenuHeight
, fWinIni
);
1588 if( ret
) ret
= SYSPARAMS_SaveLogFont(
1589 METRICS_REGKEY
, METRICS_MENULOGFONT_VALNAME
,
1590 &lpnm
->lfMenuFont
, fWinIni
);
1591 if( ret
) ret
= SYSPARAMS_SaveLogFont(
1592 METRICS_REGKEY
, METRICS_CAPTIONLOGFONT_VALNAME
,
1593 &lpnm
->lfCaptionFont
, fWinIni
);
1594 if( ret
) ret
= SYSPARAMS_SaveLogFont(
1595 METRICS_REGKEY
, METRICS_SMCAPTIONLOGFONT_VALNAME
,
1596 &lpnm
->lfSmCaptionFont
, fWinIni
);
1597 if( ret
) ret
= SYSPARAMS_SaveLogFont(
1598 METRICS_REGKEY
, METRICS_STATUSLOGFONT_VALNAME
,
1599 &lpnm
->lfStatusFont
, fWinIni
);
1600 if( ret
) ret
= SYSPARAMS_SaveLogFont(
1601 METRICS_REGKEY
, METRICS_MESSAGELOGFONT_VALNAME
,
1602 &lpnm
->lfMessageFont
, fWinIni
);
1604 memcpy( &ncm
, lpnm
, sizeof(nonclient_metrics
) );
1605 normalize_nonclientmetrics( &ncm
);
1606 memcpy( &nonclient_metrics
, &ncm
, sizeof(nonclient_metrics
) );
1607 spi_loaded
[SPI_NONCLIENTMETRICS_IDX
] = TRUE
;
1613 case SPI_GETMINIMIZEDMETRICS
:
1615 MINIMIZEDMETRICS
* lpMm
= pvParam
;
1616 if (lpMm
&& lpMm
->cbSize
== sizeof(*lpMm
)) {
1617 if( spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
]) load_minimized_metrics();
1618 memcpy( lpMm
, &minimized_metrics
, sizeof(*lpMm
) );
1624 case SPI_SETMINIMIZEDMETRICS
:
1626 MINIMIZEDMETRICS
* lpMm
= pvParam
;
1627 if (lpMm
&& lpMm
->cbSize
== sizeof(*lpMm
)) {
1628 ret
= save_int_param( METRICS_REGKEY
, METRICS_MINWIDTH_VALNAME
,
1629 &minimized_metrics
.iWidth
, max( lpMm
->iWidth
, 0), fWinIni
);
1630 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1631 METRICS_MINHORZGAP_VALNAME
, &minimized_metrics
.iHorzGap
,
1632 max( lpMm
->iHorzGap
, 0), fWinIni
);
1633 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1634 METRICS_MINVERTGAP_VALNAME
, &minimized_metrics
.iVertGap
,
1635 max( lpMm
->iVertGap
, 0), fWinIni
);
1636 if( ret
) ret
= save_int_param( METRICS_REGKEY
,
1637 METRICS_MINARRANGE_VALNAME
, &minimized_metrics
.iArrange
,
1638 0x0f & lpMm
->iArrange
, fWinIni
);
1639 if( ret
) spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
] = TRUE
;
1645 case SPI_GETICONMETRICS
:
1647 LPICONMETRICSW lpIcon
= pvParam
;
1648 if(lpIcon
&& lpIcon
->cbSize
== sizeof(*lpIcon
))
1650 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING
, 0,
1651 &lpIcon
->iHorzSpacing
, FALSE
);
1652 SystemParametersInfoW( SPI_ICONVERTICALSPACING
, 0,
1653 &lpIcon
->iVertSpacing
, FALSE
);
1654 SystemParametersInfoW( SPI_GETICONTITLEWRAP
, 0,
1655 &lpIcon
->iTitleWrap
, FALSE
);
1656 SystemParametersInfoW( SPI_GETICONTITLELOGFONT
, 0,
1657 &lpIcon
->lfFont
, FALSE
);
1666 case SPI_SETICONMETRICS
:
1668 LPICONMETRICSW lpIcon
= pvParam
;
1669 if (lpIcon
&& lpIcon
->cbSize
== sizeof(*lpIcon
)) {
1670 ret
= set_int_param( SPI_ICONVERTICALSPACING_IDX
,
1671 SPI_ICONVERTICALSPACING_REGKEY
,
1672 SPI_ICONVERTICALSPACING_VALNAME
,
1673 &icon_metrics
.iVertSpacing
,
1674 lpIcon
->iVertSpacing
, fWinIni
);
1676 ret
= set_int_param( SPI_ICONHORIZONTALSPACING_IDX
,
1677 SPI_ICONHORIZONTALSPACING_REGKEY
,
1678 SPI_ICONHORIZONTALSPACING_VALNAME
,
1679 &icon_metrics
.iHorzSpacing
,
1680 lpIcon
->iHorzSpacing
, fWinIni
);
1683 ret
= set_bool_param_mirrored( SPI_SETICONTITLEWRAP_IDX
,
1684 SPI_SETICONTITLEWRAP_REGKEY1
, SPI_SETICONTITLEWRAP_REGKEY2
,
1685 SPI_SETICONTITLEWRAP_VALNAME
, &icon_metrics
.iTitleWrap
,
1686 lpIcon
->iTitleWrap
, fWinIni
);
1688 if( ret
) ret
= SYSPARAMS_SaveLogFont( SPI_SETICONTITLELOGFONT_REGKEY
,
1689 SPI_SETICONTITLELOGFONT_VALNAME
, &lpIcon
->lfFont
, fWinIni
);
1691 icon_metrics
.lfFont
= lpIcon
->lfFont
;
1692 spi_loaded
[SPI_SETICONTITLELOGFONT_IDX
] = TRUE
;
1699 case SPI_SETWORKAREA
: /* 47 WINVER >= 0x400 */
1701 if (!pvParam
) return FALSE
;
1703 spi_idx
= SPI_SETWORKAREA_IDX
;
1704 CopyRect( &work_area
, (RECT
*)pvParam
);
1705 spi_loaded
[spi_idx
] = TRUE
;
1709 case SPI_GETWORKAREA
: /* 48 WINVER >= 0x400 */
1711 if (!pvParam
) return FALSE
;
1713 spi_idx
= SPI_SETWORKAREA_IDX
;
1714 if (!spi_loaded
[spi_idx
])
1716 SetRect( &work_area
, 0, 0,
1717 GetSystemMetrics( SM_CXSCREEN
),
1718 GetSystemMetrics( SM_CYSCREEN
) );
1719 spi_loaded
[spi_idx
] = TRUE
;
1721 CopyRect( (RECT
*)pvParam
, &work_area
);
1726 WINE_SPI_FIXME(SPI_SETPENWINDOWS
); /* 49 WINVER >= 0x400 */
1728 case SPI_GETFILTERKEYS
: /* 50 */
1730 LPFILTERKEYS lpFilterKeys
= (LPFILTERKEYS
)pvParam
;
1731 WARN("SPI_GETFILTERKEYS not fully implemented\n");
1732 if (lpFilterKeys
&& lpFilterKeys
->cbSize
== sizeof(FILTERKEYS
))
1734 /* Indicate that no FilterKeys feature available */
1735 lpFilterKeys
->dwFlags
= 0;
1736 lpFilterKeys
->iWaitMSec
= 0;
1737 lpFilterKeys
->iDelayMSec
= 0;
1738 lpFilterKeys
->iRepeatMSec
= 0;
1739 lpFilterKeys
->iBounceMSec
= 0;
1747 WINE_SPI_FIXME(SPI_SETFILTERKEYS
); /* 51 */
1749 case SPI_GETTOGGLEKEYS
: /* 52 */
1751 LPTOGGLEKEYS lpToggleKeys
= (LPTOGGLEKEYS
)pvParam
;
1752 WARN("SPI_GETTOGGLEKEYS not fully implemented\n");
1753 if (lpToggleKeys
&& lpToggleKeys
->cbSize
== sizeof(TOGGLEKEYS
))
1755 /* Indicate that no ToggleKeys feature available */
1756 lpToggleKeys
->dwFlags
= 0;
1764 WINE_SPI_FIXME(SPI_SETTOGGLEKEYS
); /* 53 */
1766 case SPI_GETMOUSEKEYS
: /* 54 */
1768 LPMOUSEKEYS lpMouseKeys
= (LPMOUSEKEYS
)pvParam
;
1769 WARN("SPI_GETMOUSEKEYS not fully implemented\n");
1770 if (lpMouseKeys
&& lpMouseKeys
->cbSize
== sizeof(MOUSEKEYS
))
1772 /* Indicate that no MouseKeys feature available */
1773 lpMouseKeys
->dwFlags
= 0;
1774 lpMouseKeys
->iMaxSpeed
= 360;
1775 lpMouseKeys
->iTimeToMaxSpeed
= 1000;
1776 lpMouseKeys
->iCtrlSpeed
= 0;
1777 lpMouseKeys
->dwReserved1
= 0;
1778 lpMouseKeys
->dwReserved2
= 0;
1786 WINE_SPI_FIXME(SPI_SETMOUSEKEYS
); /* 55 */
1788 case SPI_GETSHOWSOUNDS
:
1789 ret
= get_bool_param( SPI_SETSHOWSOUNDS_IDX
,
1790 SPI_SETSHOWSOUNDS_REGKEY
,
1791 SPI_SETSHOWSOUNDS_VALNAME
,
1792 &show_sounds
, pvParam
);
1795 case SPI_SETSHOWSOUNDS
:
1796 ret
= set_bool_param( SPI_SETSHOWSOUNDS_IDX
,
1797 SPI_SETSHOWSOUNDS_REGKEY
,
1798 SPI_SETSHOWSOUNDS_VALNAME
,
1799 &show_sounds
, uiParam
, fWinIni
);
1802 case SPI_GETSTICKYKEYS
: /* 58 */
1804 LPSTICKYKEYS lpStickyKeys
= (LPSTICKYKEYS
)pvParam
;
1805 WARN("SPI_GETSTICKYKEYS not fully implemented\n");
1806 if (lpStickyKeys
&& lpStickyKeys
->cbSize
== sizeof(STICKYKEYS
))
1808 /* Indicate that no StickyKeys feature available */
1809 lpStickyKeys
->dwFlags
= 0;
1817 WINE_SPI_FIXME(SPI_SETSTICKYKEYS
); /* 59 */
1819 case SPI_GETACCESSTIMEOUT
: /* 60 */
1821 LPACCESSTIMEOUT lpAccessTimeout
= (LPACCESSTIMEOUT
)pvParam
;
1822 WARN("SPI_GETACCESSTIMEOUT not fully implemented\n");
1823 if (lpAccessTimeout
&& lpAccessTimeout
->cbSize
== sizeof(ACCESSTIMEOUT
))
1825 /* Indicate that no accessibility features timeout is available */
1826 lpAccessTimeout
->dwFlags
= 0;
1827 lpAccessTimeout
->iTimeOutMSec
= 0;
1835 WINE_SPI_FIXME(SPI_SETACCESSTIMEOUT
); /* 61 */
1837 case SPI_GETSERIALKEYS
: /* 62 WINVER >= 0x400 */
1839 LPSERIALKEYSW lpSerialKeysW
= (LPSERIALKEYSW
)pvParam
;
1840 WARN("SPI_GETSERIALKEYS not fully implemented\n");
1841 if (lpSerialKeysW
&& lpSerialKeysW
->cbSize
== sizeof(SERIALKEYSW
))
1843 /* Indicate that no SerialKeys feature available */
1844 lpSerialKeysW
->dwFlags
= 0;
1845 lpSerialKeysW
->lpszActivePort
= NULL
;
1846 lpSerialKeysW
->lpszPort
= NULL
;
1847 lpSerialKeysW
->iBaudRate
= 0;
1848 lpSerialKeysW
->iPortState
= 0;
1856 WINE_SPI_FIXME(SPI_SETSERIALKEYS
); /* 63 WINVER >= 0x400 */
1858 case SPI_GETSOUNDSENTRY
: /* 64 */
1860 LPSOUNDSENTRYW lpSoundSentryW
= (LPSOUNDSENTRYW
)pvParam
;
1861 WARN("SPI_GETSOUNDSENTRY not fully implemented\n");
1862 if (lpSoundSentryW
&& lpSoundSentryW
->cbSize
== sizeof(SOUNDSENTRYW
))
1864 /* Indicate that no SoundSentry feature available */
1865 lpSoundSentryW
->dwFlags
= 0;
1866 lpSoundSentryW
->iFSTextEffect
= 0;
1867 lpSoundSentryW
->iFSTextEffectMSec
= 0;
1868 lpSoundSentryW
->iFSTextEffectColorBits
= 0;
1869 lpSoundSentryW
->iFSGrafEffect
= 0;
1870 lpSoundSentryW
->iFSGrafEffectMSec
= 0;
1871 lpSoundSentryW
->iFSGrafEffectColor
= 0;
1872 lpSoundSentryW
->iWindowsEffect
= 0;
1873 lpSoundSentryW
->iWindowsEffectMSec
= 0;
1874 lpSoundSentryW
->lpszWindowsEffectDLL
= 0;
1875 lpSoundSentryW
->iWindowsEffectOrdinal
= 0;
1883 WINE_SPI_FIXME(SPI_SETSOUNDSENTRY
); /* 65 */
1885 case SPI_GETHIGHCONTRAST
: /* 66 WINVER >= 0x400 */
1887 LPHIGHCONTRASTW lpHighContrastW
= (LPHIGHCONTRASTW
)pvParam
;
1888 WARN("SPI_GETHIGHCONTRAST not fully implemented\n");
1889 if (lpHighContrastW
&& lpHighContrastW
->cbSize
== sizeof(HIGHCONTRASTW
))
1891 /* Indicate that no high contrast feature available */
1892 lpHighContrastW
->dwFlags
= 0;
1893 lpHighContrastW
->lpszDefaultScheme
= NULL
;
1901 WINE_SPI_FIXME(SPI_SETHIGHCONTRAST
); /* 67 WINVER >= 0x400 */
1903 case SPI_GETKEYBOARDPREF
:
1904 ret
= get_bool_param( SPI_SETKEYBOARDPREF_IDX
,
1905 SPI_SETKEYBOARDPREF_REGKEY
,
1906 SPI_SETKEYBOARDPREF_VALNAME
,
1907 &keyboard_pref
, pvParam
);
1910 case SPI_SETKEYBOARDPREF
:
1911 ret
= set_bool_param( SPI_SETKEYBOARDPREF_IDX
,
1912 SPI_SETKEYBOARDPREF_REGKEY
,
1913 SPI_SETKEYBOARDPREF_VALNAME
,
1914 &keyboard_pref
, uiParam
, fWinIni
);
1917 case SPI_GETSCREENREADER
:
1918 ret
= get_bool_param( SPI_SETSCREENREADER_IDX
,
1919 SPI_SETSCREENREADER_REGKEY
,
1920 SPI_SETSCREENREADER_VALNAME
,
1921 &screen_reader
, pvParam
);
1924 case SPI_SETSCREENREADER
:
1925 ret
= set_bool_param( SPI_SETSCREENREADER_IDX
,
1926 SPI_SETSCREENREADER_REGKEY
,
1927 SPI_SETSCREENREADER_VALNAME
,
1928 &screen_reader
, uiParam
, fWinIni
);
1931 case SPI_GETANIMATION
: /* 72 WINVER >= 0x400 */
1933 LPANIMATIONINFO lpAnimInfo
= (LPANIMATIONINFO
)pvParam
;
1935 /* Tell it "disabled" */
1936 if (lpAnimInfo
&& lpAnimInfo
->cbSize
== sizeof(ANIMATIONINFO
))
1937 lpAnimInfo
->iMinAnimate
= 0; /* Minimise and restore animation is disabled (nonzero == enabled) */
1942 WINE_SPI_WARN(SPI_SETANIMATION
); /* 73 WINVER >= 0x400 */
1944 case SPI_GETFONTSMOOTHING
:
1947 ret
= get_uint_param( SPI_SETFONTSMOOTHING_IDX
,
1948 SPI_SETFONTSMOOTHING_REGKEY
,
1949 SPI_SETFONTSMOOTHING_VALNAME
,
1950 &font_smoothing
, &tmpval
);
1951 *(UINT
*) pvParam
= ( tmpval
!= 0);
1954 case SPI_SETFONTSMOOTHING
:
1955 uiParam
= uiParam
? 2 : 0; /* Win NT4/2k/XP behavior */
1956 ret
= set_uint_param( SPI_SETFONTSMOOTHING_IDX
,
1957 SPI_SETFONTSMOOTHING_REGKEY
,
1958 SPI_SETFONTSMOOTHING_VALNAME
,
1959 &font_smoothing
, uiParam
, fWinIni
);
1962 WINE_SPI_FIXME(SPI_SETDRAGWIDTH
); /* 76 WINVER >= 0x400 */
1963 WINE_SPI_FIXME(SPI_SETDRAGHEIGHT
); /* 77 WINVER >= 0x400 */
1965 WINE_SPI_FIXME(SPI_SETHANDHELD
); /* 78 WINVER >= 0x400 */
1967 WINE_SPI_FIXME(SPI_GETLOWPOWERTIMEOUT
); /* 79 WINVER >= 0x400 */
1968 WINE_SPI_FIXME(SPI_GETPOWEROFFTIMEOUT
); /* 80 WINVER >= 0x400 */
1969 WINE_SPI_FIXME(SPI_SETLOWPOWERTIMEOUT
); /* 81 WINVER >= 0x400 */
1970 WINE_SPI_FIXME(SPI_SETPOWEROFFTIMEOUT
); /* 82 WINVER >= 0x400 */
1972 case SPI_GETLOWPOWERACTIVE
:
1973 ret
= get_bool_param( SPI_SETLOWPOWERACTIVE_IDX
,
1974 SPI_SETLOWPOWERACTIVE_REGKEY
,
1975 SPI_SETLOWPOWERACTIVE_VALNAME
,
1976 &lowpoweractive
, pvParam
);
1979 case SPI_GETPOWEROFFACTIVE
:
1980 ret
= get_bool_param( SPI_SETPOWEROFFACTIVE_IDX
,
1981 SPI_SETPOWEROFFACTIVE_REGKEY
,
1982 SPI_SETPOWEROFFACTIVE_VALNAME
,
1983 &poweroffactive
, pvParam
);
1986 case SPI_SETLOWPOWERACTIVE
:
1987 ret
= set_bool_param( SPI_SETLOWPOWERACTIVE_IDX
,
1988 SPI_SETLOWPOWERACTIVE_REGKEY
,
1989 SPI_SETLOWPOWERACTIVE_VALNAME
,
1990 &lowpoweractive
, uiParam
, fWinIni
);
1993 case SPI_SETPOWEROFFACTIVE
:
1994 ret
= set_bool_param( SPI_SETPOWEROFFACTIVE_IDX
,
1995 SPI_SETPOWEROFFACTIVE_REGKEY
,
1996 SPI_SETPOWEROFFACTIVE_VALNAME
,
1997 &poweroffactive
, uiParam
, fWinIni
);
2000 WINE_SPI_FIXME(SPI_SETCURSORS
); /* 87 WINVER >= 0x400 */
2001 WINE_SPI_FIXME(SPI_SETICONS
); /* 88 WINVER >= 0x400 */
2003 case SPI_GETDEFAULTINPUTLANG
: /* 89 WINVER >= 0x400 */
2004 ret
= GetKeyboardLayout(0) ? TRUE
: FALSE
;
2007 WINE_SPI_FIXME(SPI_SETDEFAULTINPUTLANG
); /* 90 WINVER >= 0x400 */
2009 WINE_SPI_FIXME(SPI_SETLANGTOGGLE
); /* 91 WINVER >= 0x400 */
2011 case SPI_GETWINDOWSEXTENSION
: /* 92 WINVER >= 0x400 */
2012 WARN("pretend no support for Win9x Plus! for now.\n");
2013 ret
= FALSE
; /* yes, this is the result value */
2016 WINE_SPI_FIXME(SPI_SETMOUSETRAILS
); /* 93 WINVER >= 0x400 */
2017 WINE_SPI_FIXME(SPI_GETMOUSETRAILS
); /* 94 WINVER >= 0x400 */
2018 WINE_SPI_FIXME(SPI_GETSNAPTODEFBUTTON
); /* 95 WINVER >= 0x400 */
2019 WINE_SPI_FIXME(SPI_SETSNAPTODEFBUTTON
); /* 96 WINVER >= 0x400 */
2021 case SPI_SETSCREENSAVERRUNNING
:
2022 ret
= set_bool_param( SPI_SETSCREENSAVERRUNNING_IDX
,
2023 SPI_SETSCREENSAVERRUNNING_REGKEY
,
2024 SPI_SETSCREENSAVERRUNNING_VALNAME
,
2025 &screensaver_running
, uiParam
, fWinIni
);
2028 case SPI_GETMOUSEHOVERWIDTH
:
2029 ret
= get_uint_param( SPI_SETMOUSEHOVERWIDTH_IDX
,
2030 SPI_SETMOUSEHOVERWIDTH_REGKEY
,
2031 SPI_SETMOUSEHOVERWIDTH_VALNAME
,
2032 &mouse_hover_width
, pvParam
);
2035 case SPI_SETMOUSEHOVERWIDTH
:
2036 ret
= set_uint_param( SPI_SETMOUSEHOVERWIDTH_IDX
,
2037 SPI_SETMOUSEHOVERWIDTH_REGKEY
,
2038 SPI_SETMOUSEHOVERWIDTH_VALNAME
,
2039 &mouse_hover_width
, uiParam
, fWinIni
);
2042 case SPI_GETMOUSEHOVERHEIGHT
:
2043 ret
= get_uint_param( SPI_SETMOUSEHOVERHEIGHT_IDX
,
2044 SPI_SETMOUSEHOVERHEIGHT_REGKEY
,
2045 SPI_SETMOUSEHOVERHEIGHT_VALNAME
,
2046 &mouse_hover_height
, pvParam
);
2049 case SPI_SETMOUSEHOVERHEIGHT
:
2050 ret
= set_uint_param( SPI_SETMOUSEHOVERHEIGHT_IDX
,
2051 SPI_SETMOUSEHOVERHEIGHT_REGKEY
,
2052 SPI_SETMOUSEHOVERHEIGHT_VALNAME
,
2053 &mouse_hover_height
, uiParam
, fWinIni
);
2056 case SPI_GETMOUSEHOVERTIME
:
2057 ret
= get_uint_param( SPI_SETMOUSEHOVERTIME_IDX
,
2058 SPI_SETMOUSEHOVERTIME_REGKEY
,
2059 SPI_SETMOUSEHOVERTIME_VALNAME
,
2060 &mouse_hover_time
, pvParam
);
2063 case SPI_SETMOUSEHOVERTIME
:
2064 ret
= set_uint_param( SPI_SETMOUSEHOVERTIME_IDX
,
2065 SPI_SETMOUSEHOVERTIME_REGKEY
,
2066 SPI_SETMOUSEHOVERTIME_VALNAME
,
2067 &mouse_hover_time
, uiParam
, fWinIni
);
2070 case SPI_GETWHEELSCROLLLINES
:
2071 ret
= get_uint_param( SPI_SETMOUSESCROLLLINES_IDX
,
2072 SPI_SETMOUSESCROLLLINES_REGKEY
,
2073 SPI_SETMOUSESCROLLLINES_VALNAME
,
2074 &mouse_scroll_lines
, pvParam
);
2077 case SPI_SETWHEELSCROLLLINES
:
2078 ret
= set_uint_param( SPI_SETMOUSESCROLLLINES_IDX
,
2079 SPI_SETMOUSESCROLLLINES_REGKEY
,
2080 SPI_SETMOUSESCROLLLINES_VALNAME
,
2081 &mouse_scroll_lines
, uiParam
, fWinIni
);
2084 case SPI_GETMENUSHOWDELAY
:
2085 ret
= get_uint_param( SPI_SETMENUSHOWDELAY_IDX
,
2086 SPI_SETMENUSHOWDELAY_REGKEY
,
2087 SPI_SETMENUSHOWDELAY_VALNAME
,
2088 &menu_show_delay
, pvParam
);
2091 case SPI_SETMENUSHOWDELAY
:
2092 ret
= set_uint_param( SPI_SETMENUSHOWDELAY_IDX
,
2093 SPI_SETMENUSHOWDELAY_REGKEY
,
2094 SPI_SETMENUSHOWDELAY_VALNAME
,
2095 &menu_show_delay
, uiParam
, fWinIni
);
2098 WINE_SPI_FIXME(SPI_GETSHOWIMEUI
); /* 110 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2099 WINE_SPI_FIXME(SPI_SETSHOWIMEUI
); /* 111 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2100 WINE_SPI_FIXME(SPI_GETMOUSESPEED
); /* 112 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2101 WINE_SPI_FIXME(SPI_SETMOUSESPEED
); /* 113 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2103 case SPI_GETSCREENSAVERRUNNING
:
2104 ret
= get_bool_param( SPI_SETSCREENSAVERRUNNING_IDX
,
2105 SPI_SETSCREENSAVERRUNNING_REGKEY
,
2106 SPI_SETSCREENSAVERRUNNING_VALNAME
,
2107 &screensaver_running
, pvParam
);
2110 case SPI_GETDESKWALLPAPER
: /* 115 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2112 WCHAR buf
[MAX_PATH
];
2114 if (!pvParam
) return FALSE
;
2116 if (uiParam
> MAX_PATH
)
2121 if (SYSPARAMS_Load(SPI_SETDESKWALLPAPER_REGKEY
, SPI_SETDESKWALLPAPER_VALNAME
, buf
, sizeof(buf
)))
2123 lstrcpynW((WCHAR
*)pvParam
, buf
, uiParam
);
2127 /* Return an empty string */
2128 memset((WCHAR
*)pvParam
, 0, uiParam
);
2134 WINE_SPI_FIXME(SPI_GETACTIVEWINDOWTRACKING
);/* 0x1000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2135 WINE_SPI_FIXME(SPI_SETACTIVEWINDOWTRACKING
);/* 0x1001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2136 case SPI_GETMENUANIMATION
: /* 0x1002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2137 ret
= get_user_pref_param( 0, 0x02, pvParam
);
2140 case SPI_SETMENUANIMATION
: /* 0x1003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2141 ret
= set_user_pref_param( 0, 0x02, (BOOL
)pvParam
, fWinIni
);
2144 case SPI_GETCOMBOBOXANIMATION
: /* 0x1004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2145 ret
= get_user_pref_param( 0, 0x04, pvParam
);
2148 case SPI_SETCOMBOBOXANIMATION
: /* 0x1005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2149 ret
= set_user_pref_param( 0, 0x04, (BOOL
)pvParam
, fWinIni
);
2152 case SPI_GETLISTBOXSMOOTHSCROLLING
: /* 0x1006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2153 ret
= get_user_pref_param( 0, 0x08, pvParam
);
2156 case SPI_SETLISTBOXSMOOTHSCROLLING
: /* 0x1007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2157 ret
= set_user_pref_param( 0, 0x08, (BOOL
)pvParam
, fWinIni
);
2160 case SPI_GETGRADIENTCAPTIONS
:
2161 ret
= get_user_pref_param( 0, 0x10, pvParam
);
2164 case SPI_SETGRADIENTCAPTIONS
:
2165 ret
= set_user_pref_param( 0, 0x10, (BOOL
)pvParam
, fWinIni
);
2168 case SPI_GETKEYBOARDCUES
:
2169 ret
= get_user_pref_param( 0, 0x20, pvParam
);
2172 case SPI_SETKEYBOARDCUES
:
2173 ret
= set_user_pref_param( 0, 0x20, (BOOL
)pvParam
, fWinIni
);
2176 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKZORDER
); /* 0x100C _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2177 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKZORDER
); /* 0x100D _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2178 case SPI_GETHOTTRACKING
:
2179 ret
= get_user_pref_param( 0, 0x80, pvParam
);
2182 case SPI_SETHOTTRACKING
:
2183 ret
= set_user_pref_param( 0, 0x80, (BOOL
)pvParam
, fWinIni
);
2186 WINE_SPI_FIXME(SPI_GETMENUFADE
); /* 0x1012 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2187 WINE_SPI_FIXME(SPI_SETMENUFADE
); /* 0x1013 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2188 case SPI_GETSELECTIONFADE
: /* 0x1014 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2189 ret
= get_user_pref_param( 1, 0x04, pvParam
);
2192 case SPI_SETSELECTIONFADE
: /* 0x1015 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2193 ret
= set_user_pref_param( 1, 0x04, (BOOL
)pvParam
, fWinIni
);
2196 case SPI_GETTOOLTIPANIMATION
: /* 0x1016 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2197 ret
= get_user_pref_param( 1, 0x08, pvParam
);
2200 case SPI_SETTOOLTIPANIMATION
: /* 0x1017 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2201 ret
= set_user_pref_param( 1, 0x08, (BOOL
)pvParam
, fWinIni
);
2204 case SPI_GETTOOLTIPFADE
: /* 0x1018 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2205 ret
= get_user_pref_param( 1, 0x10, pvParam
);
2208 case SPI_SETTOOLTIPFADE
: /* 0x1019 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2209 ret
= set_user_pref_param( 1, 0x10, (BOOL
)pvParam
, fWinIni
);
2212 case SPI_GETCURSORSHADOW
: /* 0x101A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2213 ret
= get_user_pref_param( 1, 0x20, pvParam
);
2216 case SPI_SETCURSORSHADOW
: /* 0x101B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2217 ret
= set_user_pref_param( 1, 0x20, (BOOL
)pvParam
, fWinIni
);
2220 WINE_SPI_FIXME(SPI_GETMOUSESONAR
); /* 0x101C _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2221 WINE_SPI_FIXME(SPI_SETMOUSESONAR
); /* 0x101D _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2222 WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCK
); /* 0x101E _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2223 WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCK
); /* 0x101F _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2224 WINE_SPI_FIXME(SPI_GETMOUSEVANISH
); /* 0x1020 _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2225 WINE_SPI_FIXME(SPI_SETMOUSEVANISH
); /* 0x1021 _WIN32_WINNT >= 0x510 || _WIN32_WINDOW >= 0x490*/
2226 case SPI_GETFLATMENU
:
2227 ret
= get_user_pref_param( 2, 0x02, pvParam
);
2230 case SPI_SETFLATMENU
:
2231 ret
= set_user_pref_param( 2, 0x02, (BOOL
)pvParam
, fWinIni
);
2234 WINE_SPI_FIXME(SPI_GETDROPSHADOW
); /* 0x1024 _WIN32_WINNT >= 0x510 */
2235 WINE_SPI_FIXME(SPI_SETDROPSHADOW
); /* 0x1025 _WIN32_WINNT >= 0x510 */
2236 WINE_SPI_FIXME(SPI_GETBLOCKSENDINPUTRESETS
);
2237 WINE_SPI_FIXME(SPI_SETBLOCKSENDINPUTRESETS
);
2238 case SPI_GETUIEFFECTS
:
2239 ret
= get_user_pref_param( 3, 0x80, pvParam
);
2242 case SPI_SETUIEFFECTS
:
2243 /* FIXME: this probably should mask other UI effect values when unset */
2244 ret
= set_user_pref_param( 3, 0x80, (BOOL
)pvParam
, fWinIni
);
2247 WINE_SPI_FIXME(SPI_GETFOREGROUNDLOCKTIMEOUT
);/* 0x2000 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2248 WINE_SPI_FIXME(SPI_SETFOREGROUNDLOCKTIMEOUT
);/* 0x2001 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2249 WINE_SPI_FIXME(SPI_GETACTIVEWNDTRKTIMEOUT
); /* 0x2002 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2250 WINE_SPI_FIXME(SPI_SETACTIVEWNDTRKTIMEOUT
); /* 0x2003 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2251 WINE_SPI_FIXME(SPI_GETFOREGROUNDFLASHCOUNT
);/* 0x2004 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2252 WINE_SPI_FIXME(SPI_SETFOREGROUNDFLASHCOUNT
);/* 0x2005 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2253 case SPI_GETCARETWIDTH
: /* 0x2006 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2254 ret
= get_uint_param( SPI_CARETWIDTH_IDX
,
2255 SPI_CARETWIDTH_REGKEY
,
2256 SPI_CARETWIDTH_VALNAME
,
2257 &caret_width
, pvParam
);
2260 case SPI_SETCARETWIDTH
: /* 0x2007 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2261 ret
= set_uint_param( SPI_CARETWIDTH_IDX
,
2262 SPI_CARETWIDTH_REGKEY
,
2263 SPI_CARETWIDTH_VALNAME
,
2264 &caret_width
, uiParam
, fWinIni
);
2267 WINE_SPI_FIXME(SPI_GETMOUSECLICKLOCKTIME
); /* 0x2008 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2268 WINE_SPI_FIXME(SPI_SETMOUSECLICKLOCKTIME
); /* 0x2009 _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2269 WINE_SPI_FIXME(SPI_GETFONTSMOOTHINGTYPE
); /* 0x200A _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2270 WINE_SPI_FIXME(SPI_SETFONTSMOOTHINGTYPE
); /* 0x200B _WIN32_WINNT >= 0x500 || _WIN32_WINDOW > 0x400 */
2271 WINE_SPI_FIXME(SPI_GETFONTSMOOTHINGCONTRAST
);/* 0x200C _WIN32_WINNT >= 0x510 */
2272 WINE_SPI_FIXME(SPI_SETFONTSMOOTHINGCONTRAST
);/* 0x200D _WIN32_WINNT >= 0x510 */
2273 WINE_SPI_FIXME(SPI_GETFOCUSBORDERWIDTH
); /* 0x200E _WIN32_WINNT >= 0x510 */
2274 WINE_SPI_FIXME(SPI_SETFOCUSBORDERWIDTH
); /* 0x200F _WIN32_WINNT >= 0x510 */
2275 WINE_SPI_FIXME(SPI_GETFOCUSBORDERHEIGHT
); /* 0x2010 _WIN32_WINNT >= 0x510 */
2276 WINE_SPI_FIXME(SPI_SETFOCUSBORDERHEIGHT
); /* 0x2011 _WIN32_WINNT >= 0x510 */
2277 WINE_SPI_FIXME(SPI_GETFONTSMOOTHINGORIENTATION
); /* 0x2012 */
2278 WINE_SPI_FIXME(SPI_SETFONTSMOOTHINGORIENTATION
); /* 0x2013 */
2281 FIXME( "Unknown action: %u\n", uiAction
);
2282 SetLastError( ERROR_INVALID_SPI_VALUE
);
2288 SYSPARAMS_NotifyChange( uiAction
, fWinIni
);
2289 TRACE("(%u, %u, %p, %u) ret %d\n",
2290 uiAction
, uiParam
, pvParam
, fWinIni
, ret
);
2293 #undef WINE_SPI_FIXME
2294 #undef WINE_SPI_WARN
2298 /***********************************************************************
2299 * SystemParametersInfo (USER.483)
2301 BOOL16 WINAPI
SystemParametersInfo16( UINT16 uAction
, UINT16 uParam
,
2302 LPVOID lpvParam
, UINT16 fuWinIni
)
2306 TRACE("(%u, %u, %p, %u)\n", uAction
, uParam
, lpvParam
, fuWinIni
);
2310 case SPI_GETBEEP
: /* 1 */
2311 case SPI_GETSCREENSAVEACTIVE
: /* 16 */
2312 case SPI_GETICONTITLEWRAP
: /* 25 */
2313 case SPI_GETMENUDROPALIGNMENT
: /* 27 */
2314 case SPI_GETFASTTASKSWITCH
: /* 35 */
2315 case SPI_GETDRAGFULLWINDOWS
: /* 38 WINVER >= 0x0400 */
2318 ret
= SystemParametersInfoA( uAction
, uParam
, lpvParam
? &tmp
: NULL
, fuWinIni
);
2319 if (ret
&& lpvParam
)
2320 *(BOOL16
*)lpvParam
= tmp
;
2324 case SPI_GETBORDER
: /* 5 */
2325 case SPI_ICONHORIZONTALSPACING
: /* 13 */
2326 case SPI_GETSCREENSAVETIMEOUT
: /* 14 */
2327 case SPI_GETGRIDGRANULARITY
: /* 18 */
2328 case SPI_GETKEYBOARDDELAY
: /* 22 */
2329 case SPI_ICONVERTICALSPACING
: /* 24 */
2332 ret
= SystemParametersInfoA( uAction
, uParam
, lpvParam
? &tmp
: NULL
, fuWinIni
);
2333 if (ret
&& lpvParam
)
2334 *(INT16
*)lpvParam
= tmp
;
2338 case SPI_GETKEYBOARDSPEED
: /* 10 */
2341 ret
= SystemParametersInfoA( uAction
, uParam
, lpvParam
? &tmp
: NULL
, fuWinIni
);
2342 if (ret
&& lpvParam
)
2343 *(WORD
*)lpvParam
= tmp
;
2347 case SPI_GETICONTITLELOGFONT
: /* 31 */
2350 ret
= SystemParametersInfoA( uAction
, uParam
, lpvParam
? &tmp
: NULL
, fuWinIni
);
2351 if (ret
&& lpvParam
)
2352 SYSPARAMS_LogFont32ATo16( &tmp
, (LPLOGFONT16
)lpvParam
);
2356 case SPI_GETNONCLIENTMETRICS
: /* 41 WINVER >= 0x400 */
2358 NONCLIENTMETRICSA tmp
;
2359 LPNONCLIENTMETRICS16 lpnm16
= (LPNONCLIENTMETRICS16
)lpvParam
;
2360 if (lpnm16
&& lpnm16
->cbSize
== sizeof(NONCLIENTMETRICS16
))
2362 tmp
.cbSize
= sizeof(NONCLIENTMETRICSA
);
2363 ret
= SystemParametersInfoA( uAction
, uParam
, &tmp
, fuWinIni
);
2365 SYSPARAMS_NonClientMetrics32ATo16( &tmp
, lpnm16
);
2367 else /* winfile 95 sets cbSize to 340 */
2368 ret
= SystemParametersInfoA( uAction
, uParam
, lpvParam
, fuWinIni
);
2372 case SPI_GETWORKAREA
: /* 48 WINVER >= 0x400 */
2375 ret
= SystemParametersInfoA( uAction
, uParam
, lpvParam
? &tmp
: NULL
, fuWinIni
);
2376 if (ret
&& lpvParam
)
2378 RECT16
*r16
= (RECT16
*)lpvParam
;
2379 r16
->left
= tmp
.left
;
2381 r16
->right
= tmp
.right
;
2382 r16
->bottom
= tmp
.bottom
;
2387 case SPI_GETMOUSEHOVERWIDTH
: /* 98 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2388 case SPI_GETMOUSEHOVERHEIGHT
: /* 100 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2389 case SPI_GETMOUSEHOVERTIME
: /* 102 _WIN32_WINNT >= 0x400 || _WIN32_WINDOW > 0x400 */
2392 ret
= SystemParametersInfoA( uAction
, uParam
, lpvParam
? &tmp
: NULL
, fuWinIni
);
2393 if (ret
&& lpvParam
)
2394 *(UINT16
*)lpvParam
= tmp
;
2399 ret
= SystemParametersInfoA( uAction
, uParam
, lpvParam
, fuWinIni
);
2405 /***********************************************************************
2406 * SystemParametersInfoA (USER32.@)
2408 BOOL WINAPI
SystemParametersInfoA( UINT uiAction
, UINT uiParam
,
2409 PVOID pvParam
, UINT fuWinIni
)
2413 TRACE("(%u, %u, %p, %u)\n", uiAction
, uiParam
, pvParam
, fuWinIni
);
2417 case SPI_SETDESKWALLPAPER
: /* 20 */
2418 case SPI_SETDESKPATTERN
: /* 21 */
2422 if (!MultiByteToWideChar( CP_ACP
, 0, (LPSTR
)pvParam
, -1,
2423 buffer
, sizeof(buffer
)/sizeof(WCHAR
) ))
2424 buffer
[sizeof(buffer
)/sizeof(WCHAR
)-1] = 0;
2425 ret
= SystemParametersInfoW( uiAction
, uiParam
, pvParam
? buffer
: NULL
, fuWinIni
);
2429 case SPI_GETICONTITLELOGFONT
: /* 31 */
2432 ret
= SystemParametersInfoW( uiAction
, uiParam
, pvParam
? &tmp
: NULL
, fuWinIni
);
2434 SYSPARAMS_LogFont32WTo32A( &tmp
, (LPLOGFONTA
)pvParam
);
2438 case SPI_GETNONCLIENTMETRICS
: /* 41 WINVER >= 0x400 */
2440 NONCLIENTMETRICSW tmp
;
2441 LPNONCLIENTMETRICSA lpnmA
= (LPNONCLIENTMETRICSA
)pvParam
;
2442 if (lpnmA
&& lpnmA
->cbSize
== sizeof(NONCLIENTMETRICSA
))
2444 tmp
.cbSize
= sizeof(NONCLIENTMETRICSW
);
2445 ret
= SystemParametersInfoW( uiAction
, uiParam
, &tmp
, fuWinIni
);
2447 SYSPARAMS_NonClientMetrics32WTo32A( &tmp
, lpnmA
);
2454 case SPI_SETNONCLIENTMETRICS
: /* 42 WINVER >= 0x400 */
2456 NONCLIENTMETRICSW tmp
;
2457 LPNONCLIENTMETRICSA lpnmA
= (LPNONCLIENTMETRICSA
)pvParam
;
2458 if (lpnmA
&& lpnmA
->cbSize
== sizeof(NONCLIENTMETRICSA
))
2460 tmp
.cbSize
= sizeof(NONCLIENTMETRICSW
);
2461 SYSPARAMS_NonClientMetrics32ATo32W( lpnmA
, &tmp
);
2462 ret
= SystemParametersInfoW( uiAction
, uiParam
, &tmp
, fuWinIni
);
2469 case SPI_GETICONMETRICS
: /* 45 WINVER >= 0x400 */
2472 LPICONMETRICSA lpimA
= (LPICONMETRICSA
)pvParam
;
2473 if (lpimA
&& lpimA
->cbSize
== sizeof(ICONMETRICSA
))
2475 tmp
.cbSize
= sizeof(ICONMETRICSW
);
2476 ret
= SystemParametersInfoW( uiAction
, uiParam
, &tmp
, fuWinIni
);
2479 lpimA
->iHorzSpacing
= tmp
.iHorzSpacing
;
2480 lpimA
->iVertSpacing
= tmp
.iVertSpacing
;
2481 lpimA
->iTitleWrap
= tmp
.iTitleWrap
;
2482 SYSPARAMS_LogFont32WTo32A( &tmp
.lfFont
, &lpimA
->lfFont
);
2490 case SPI_SETICONMETRICS
: /* 46 WINVER >= 0x400 */
2493 LPICONMETRICSA lpimA
= (LPICONMETRICSA
)pvParam
;
2494 if (lpimA
&& lpimA
->cbSize
== sizeof(ICONMETRICSA
))
2496 tmp
.cbSize
= sizeof(ICONMETRICSW
);
2497 tmp
.iHorzSpacing
= lpimA
->iHorzSpacing
;
2498 tmp
.iVertSpacing
= lpimA
->iVertSpacing
;
2499 tmp
.iTitleWrap
= lpimA
->iTitleWrap
;
2500 SYSPARAMS_LogFont32ATo32W( &lpimA
->lfFont
, &tmp
.lfFont
);
2501 ret
= SystemParametersInfoW( uiAction
, uiParam
, &tmp
, fuWinIni
);
2508 case SPI_GETHIGHCONTRAST
: /* 66 WINVER >= 0x400 */
2511 LPHIGHCONTRASTA lphcA
= (LPHIGHCONTRASTA
)pvParam
;
2512 if (lphcA
&& lphcA
->cbSize
== sizeof(HIGHCONTRASTA
))
2514 tmp
.cbSize
= sizeof(HIGHCONTRASTW
);
2515 ret
= SystemParametersInfoW( uiAction
, uiParam
, &tmp
, fuWinIni
);
2518 lphcA
->dwFlags
= tmp
.dwFlags
;
2519 lphcA
->lpszDefaultScheme
= NULL
; /* FIXME? */
2527 case SPI_GETDESKWALLPAPER
: /* 115 */
2529 WCHAR buffer
[MAX_PATH
];
2530 ret
= (SystemParametersInfoW( SPI_GETDESKWALLPAPER
, uiParam
, buffer
, fuWinIni
) &&
2531 WideCharToMultiByte(CP_ACP
, 0, buffer
, -1, pvParam
, uiParam
, NULL
, NULL
));
2536 ret
= SystemParametersInfoW( uiAction
, uiParam
, pvParam
, fuWinIni
);
2543 /***********************************************************************
2544 * GetSystemMetrics (USER32.@)
2546 INT WINAPI
GetSystemMetrics( INT index
)
2550 /* some metrics are dynamic */
2554 return GetDeviceCaps( get_display_dc(), HORZRES
);
2556 return GetDeviceCaps( get_display_dc(), VERTRES
);
2558 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2559 return nonclient_metrics
.iScrollWidth
;
2561 return GetSystemMetrics(SM_CXVSCROLL
);
2563 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2564 return nonclient_metrics
.iCaptionHeight
+ 1;
2567 /* SM_C{X,Y}BORDER always returns 1 regardless of 'BorderWidth' value in registry */
2573 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2574 return nonclient_metrics
.iScrollHeight
;
2576 return GetSystemMetrics(SM_CYVTHUMB
);
2578 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2579 return icon_size
.cx
;
2581 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2582 return icon_size
.cy
;
2587 return GetSystemMetrics(SM_CYMENUSIZE
) + 1;
2588 case SM_CXFULLSCREEN
:
2589 /* see the remark for SM_CXMAXIMIZED, at least this formulation is
2591 return GetSystemMetrics( SM_CXMAXIMIZED
) - 2 * GetSystemMetrics( SM_CXFRAME
);
2592 case SM_CYFULLSCREEN
:
2593 /* see the remark for SM_CYMAXIMIZED, at least this formulation is
2595 return GetSystemMetrics( SM_CYMAXIMIZED
) - GetSystemMetrics( SM_CYMIN
);
2596 case SM_CYKANJIWINDOW
:
2598 case SM_MOUSEPRESENT
:
2601 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2602 return nonclient_metrics
.iScrollHeight
;
2604 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2605 return nonclient_metrics
.iScrollHeight
;
2609 get_bool_param( SPI_SETMOUSEBUTTONSWAP_IDX
, SPI_SETMOUSEBUTTONSWAP_REGKEY
,
2610 SPI_SETMOUSEBUTTONSWAP_VALNAME
, &swap_buttons
, (BOOL
*)&ret
);
2618 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2619 return 3 * nonclient_metrics
.iCaptionWidth
+ GetSystemMetrics( SM_CYSIZE
) +
2620 4 * CaptionFontAvCharWidth
+ 2 * GetSystemMetrics( SM_CXFRAME
) + 4;
2622 return GetSystemMetrics( SM_CYCAPTION
) + 2 * GetSystemMetrics( SM_CYFRAME
);
2624 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2625 return nonclient_metrics
.iCaptionWidth
;
2627 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2628 return nonclient_metrics
.iCaptionHeight
;
2630 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2631 return GetSystemMetrics(SM_CXDLGFRAME
) + nonclient_metrics
.iBorderWidth
;
2633 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2634 return GetSystemMetrics(SM_CYDLGFRAME
) + nonclient_metrics
.iBorderWidth
;
2636 return GetSystemMetrics(SM_CXMIN
);
2638 return GetSystemMetrics(SM_CYMIN
);
2639 case SM_CXDOUBLECLK
:
2640 get_uint_param( SPI_SETDOUBLECLKWIDTH_IDX
, SPI_SETDOUBLECLKWIDTH_REGKEY1
,
2641 SPI_SETDOUBLECLKWIDTH_VALNAME
, &double_click_width
, &ret
);
2643 case SM_CYDOUBLECLK
:
2644 get_uint_param( SPI_SETDOUBLECLKHEIGHT_IDX
, SPI_SETDOUBLECLKHEIGHT_REGKEY1
,
2645 SPI_SETDOUBLECLKHEIGHT_VALNAME
, &double_click_height
, &ret
);
2647 case SM_CXICONSPACING
:
2648 SystemParametersInfoW( SPI_ICONHORIZONTALSPACING
, 0, &ret
, 0 );
2650 case SM_CYICONSPACING
:
2651 SystemParametersInfoW( SPI_ICONVERTICALSPACING
, 0, &ret
, 0 );
2653 case SM_MENUDROPALIGNMENT
:
2654 SystemParametersInfoW( SPI_GETMENUDROPALIGNMENT
, 0, &ret
, 0 );
2658 case SM_DBCSENABLED
:
2661 GetCPInfo( CP_ACP
, &cpinfo
);
2662 return (cpinfo
.MaxCharSize
> 1);
2664 case SM_CMOUSEBUTTONS
:
2669 return GetSystemMetrics(SM_CXBORDER
) + 1;
2671 return GetSystemMetrics(SM_CYBORDER
) + 1;
2672 case SM_CXMINSPACING
:
2673 if( spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
]) load_minimized_metrics();
2674 return GetSystemMetrics(SM_CXMINIMIZED
) + minimized_metrics
.iHorzGap
;
2675 case SM_CYMINSPACING
:
2676 if( spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
]) load_minimized_metrics();
2677 return GetSystemMetrics(SM_CYMINIMIZED
) + minimized_metrics
.iVertGap
;
2681 case SM_CYSMCAPTION
:
2682 return GetSystemMetrics(SM_CYSMSIZE
) + 1;
2684 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2685 return nonclient_metrics
.iSmCaptionWidth
;
2687 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2688 return nonclient_metrics
.iSmCaptionHeight
;
2690 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2691 return nonclient_metrics
.iMenuWidth
;
2693 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2694 return nonclient_metrics
.iMenuHeight
;
2696 if( spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
]) load_minimized_metrics();
2697 return minimized_metrics
.iArrange
;
2698 case SM_CXMINIMIZED
:
2699 if( spi_loaded
[SPI_MINIMIZEDMETRICS_IDX
]) load_minimized_metrics();
2700 return minimized_metrics
.iWidth
+ 6;
2701 case SM_CYMINIMIZED
:
2702 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2703 return nonclient_metrics
.iCaptionHeight
+ 6;
2705 return GetSystemMetrics(SM_CXVIRTUALSCREEN
) + 4 + 2 * GetSystemMetrics(SM_CXFRAME
);
2707 return GetSystemMetrics(SM_CYVIRTUALSCREEN
) + 4 + 2 * GetSystemMetrics(SM_CYFRAME
);
2708 case SM_CXMAXIMIZED
:
2709 /* FIXME: subtract the width of any vertical application toolbars*/
2710 return GetSystemMetrics(SM_CXSCREEN
) + 2 * GetSystemMetrics(SM_CXFRAME
);
2711 case SM_CYMAXIMIZED
:
2712 /* FIXME: subtract the width of any horizontal application toolbars*/
2713 return GetSystemMetrics(SM_CYSCREEN
) + 2 * GetSystemMetrics(SM_CYCAPTION
);
2715 return 3; /* FIXME */
2717 return 0; /* 0 = ok, 1 = failsafe, 2 = failsafe + network */
2722 SystemParametersInfoW( SPI_GETSHOWSOUNDS
, 0, &ret
, 0 );
2724 case SM_CXMENUCHECK
:
2725 case SM_CYMENUCHECK
:
2726 if (!spi_loaded
[SPI_NONCLIENTMETRICS_IDX
]) load_nonclient_metrics();
2727 return tmMenuFont
.tmHeight
<= 0 ? 13 :
2728 ((tmMenuFont
.tmHeight
+ tmMenuFont
.tmExternalLeading
+ 1) / 2) * 2 - 1;
2729 case SM_SLOWMACHINE
:
2730 return 0; /* FIXME: Should check the type of processor */
2731 case SM_MIDEASTENABLED
:
2732 return 0; /* FIXME */
2733 case SM_MOUSEWHEELPRESENT
:
2735 case SM_XVIRTUALSCREEN
:
2737 struct monitor_info info
;
2738 get_monitors_info( &info
);
2739 return info
.virtual_rect
.left
;
2741 case SM_YVIRTUALSCREEN
:
2743 struct monitor_info info
;
2744 get_monitors_info( &info
);
2745 return info
.virtual_rect
.top
;
2747 case SM_CXVIRTUALSCREEN
:
2749 struct monitor_info info
;
2750 get_monitors_info( &info
);
2751 return info
.virtual_rect
.right
- info
.virtual_rect
.left
;
2753 case SM_CYVIRTUALSCREEN
:
2755 struct monitor_info info
;
2756 get_monitors_info( &info
);
2757 return info
.virtual_rect
.bottom
- info
.virtual_rect
.top
;
2761 struct monitor_info info
;
2762 get_monitors_info( &info
);
2765 case SM_SAMEDISPLAYFORMAT
:
2768 return 0; /* FIXME */
2769 case SM_CXFOCUSBORDER
:
2770 case SM_CYFOCUSBORDER
:
2773 case SM_MEDIACENTER
:
2783 /***********************************************************************
2784 * SwapMouseButton (USER32.@)
2785 * Reverse or restore the meaning of the left and right mouse buttons
2786 * fSwap [I ] TRUE - reverse, FALSE - original
2790 BOOL WINAPI
SwapMouseButton( BOOL fSwap
)
2792 BOOL prev
= GetSystemMetrics(SM_SWAPBUTTON
);
2793 SystemParametersInfoW(SPI_SETMOUSEBUTTONSWAP
, fSwap
, 0, 0);
2798 /**********************************************************************
2799 * SetDoubleClickTime (USER32.@)
2801 BOOL WINAPI
SetDoubleClickTime( UINT interval
)
2803 return SystemParametersInfoW(SPI_SETDOUBLECLICKTIME
, interval
, 0, 0);
2807 /**********************************************************************
2808 * GetDoubleClickTime (USER32.@)
2810 UINT WINAPI
GetDoubleClickTime(void)
2814 get_uint_param( SPI_SETDOUBLECLICKTIME_IDX
,
2815 SPI_SETDOUBLECLICKTIME_REGKEY
,
2816 SPI_SETDOUBLECLICKTIME_VALNAME
,
2817 &double_click_time
, &time
);
2818 if (!time
) time
= 500;
2823 /*************************************************************************
2824 * GetSysColor (USER32.@)
2826 COLORREF WINAPI
GetSysColor( INT nIndex
)
2828 if (nIndex
>= 0 && nIndex
< NUM_SYS_COLORS
)
2829 return SysColors
[nIndex
];
2835 /*************************************************************************
2836 * SetSysColors (USER32.@)
2838 BOOL WINAPI
SetSysColors( INT nChanges
, const INT
*lpSysColor
,
2839 const COLORREF
*lpColorValues
)
2843 for (i
= 0; i
< nChanges
; i
++) SYSPARAMS_SetSysColor( lpSysColor
[i
], lpColorValues
[i
] );
2845 /* Send WM_SYSCOLORCHANGE message to all windows */
2847 SendMessageTimeoutW( HWND_BROADCAST
, WM_SYSCOLORCHANGE
, 0, 0, SMTO_ABORTIFHUNG
, 2000, NULL
);
2849 /* Repaint affected portions of all visible windows */
2851 RedrawWindow( GetDesktopWindow(), NULL
, 0,
2852 RDW_INVALIDATE
| RDW_ERASE
| RDW_UPDATENOW
| RDW_ALLCHILDREN
);
2857 /*************************************************************************
2858 * SetSysColorsTemp (USER32.@)
2862 * Called by W98SE desk.cpl Control Panel Applet:
2863 * handle = SetSysColorsTemp(ptr, ptr, nCount); ("set" call)
2864 * result = SetSysColorsTemp(NULL, NULL, handle); ("restore" call)
2866 * pPens is an array of COLORREF values, which seems to be used
2867 * to indicate the color values to create new pens with.
2869 * pBrushes is an array of solid brush handles (returned by a previous
2870 * CreateSolidBrush), which seems to contain the brush handles to set
2871 * for the system colors.
2873 * n seems to be used for
2874 * a) indicating the number of entries to operate on (length of pPens,
2876 * b) passing the handle that points to the previously used color settings.
2877 * I couldn't figure out in hell what kind of handle this is on
2878 * Windows. I just use a heap handle instead. Shouldn't matter anyway.
2881 * heap handle of our own copy of the current syscolors in case of
2882 * "set" call, i.e. pPens, pBrushes != NULL.
2883 * TRUE (unconditionally !) in case of "restore" call,
2884 * i.e. pPens, pBrushes == NULL.
2885 * FALSE in case of either pPens != NULL and pBrushes == NULL
2886 * or pPens == NULL and pBrushes != NULL.
2888 * I'm not sure whether this implementation is 100% correct. [AM]
2890 DWORD WINAPI
SetSysColorsTemp( const COLORREF
*pPens
, const HBRUSH
*pBrushes
, DWORD n
)
2894 if (pPens
&& pBrushes
) /* "set" call */
2896 /* allocate our structure to remember old colors */
2897 LPVOID pOldCol
= HeapAlloc(GetProcessHeap(), 0, sizeof(DWORD
)+n
*sizeof(HPEN
)+n
*sizeof(HBRUSH
));
2899 *(DWORD
*)p
= n
; p
= (char*)p
+ sizeof(DWORD
);
2900 memcpy(p
, SysColorPens
, n
*sizeof(HPEN
)); p
= (char*)p
+ n
*sizeof(HPEN
);
2901 memcpy(p
, SysColorBrushes
, n
*sizeof(HBRUSH
)); p
= (char*)p
+ n
*sizeof(HBRUSH
);
2903 for (i
=0; i
< n
; i
++)
2905 SysColorPens
[i
] = CreatePen( PS_SOLID
, 1, pPens
[i
] );
2906 SysColorBrushes
[i
] = pBrushes
[i
];
2909 return (DWORD
)pOldCol
;
2911 if (!pPens
&& !pBrushes
) /* "restore" call */
2913 LPVOID pOldCol
= (LPVOID
)n
;
2915 DWORD nCount
= *(DWORD
*)p
;
2916 p
= (char*)p
+ sizeof(DWORD
);
2918 for (i
=0; i
< nCount
; i
++)
2920 DeleteObject(SysColorPens
[i
]);
2921 SysColorPens
[i
] = *(HPEN
*)p
; p
= (char*)p
+ sizeof(HPEN
);
2923 for (i
=0; i
< nCount
; i
++)
2925 SysColorBrushes
[i
] = *(HBRUSH
*)p
; p
= (char*)p
+ sizeof(HBRUSH
);
2927 /* get rid of storage structure */
2928 HeapFree(GetProcessHeap(), 0, pOldCol
);
2936 /***********************************************************************
2937 * GetSysColorBrush (USER32.@)
2939 HBRUSH WINAPI
GetSysColorBrush( INT index
)
2941 if (0 <= index
&& index
< NUM_SYS_COLORS
) return SysColorBrushes
[index
];
2942 WARN("Unknown index(%d)\n", index
);
2943 return GetStockObject(LTGRAY_BRUSH
);
2947 /***********************************************************************
2950 HPEN
SYSCOLOR_GetPen( INT index
)
2952 /* We can assert here, because this function is internal to Wine */
2953 assert (0 <= index
&& index
< NUM_SYS_COLORS
);
2954 return SysColorPens
[index
];
2958 /***********************************************************************
2959 * ChangeDisplaySettingsA (USER32.@)
2961 LONG WINAPI
ChangeDisplaySettingsA( LPDEVMODEA devmode
, DWORD flags
)
2963 return ChangeDisplaySettingsExA(NULL
,devmode
,NULL
,flags
,NULL
);
2967 /***********************************************************************
2968 * ChangeDisplaySettingsW (USER32.@)
2970 LONG WINAPI
ChangeDisplaySettingsW( LPDEVMODEW devmode
, DWORD flags
)
2972 return ChangeDisplaySettingsExW(NULL
,devmode
,NULL
,flags
,NULL
);
2976 /***********************************************************************
2977 * ChangeDisplaySettingsExA (USER32.@)
2979 LONG WINAPI
ChangeDisplaySettingsExA( LPCSTR devname
, LPDEVMODEA devmode
, HWND hwnd
,
2980 DWORD flags
, LPVOID lparam
)
2984 UNICODE_STRING nameW
;
2986 if (devname
) RtlCreateUnicodeStringFromAsciiz(&nameW
, devname
);
2987 else nameW
.Buffer
= NULL
;
2991 devmodeW
.dmBitsPerPel
= devmode
->dmBitsPerPel
;
2992 devmodeW
.dmPelsHeight
= devmode
->dmPelsHeight
;
2993 devmodeW
.dmPelsWidth
= devmode
->dmPelsWidth
;
2994 devmodeW
.dmDisplayFlags
= devmode
->dmDisplayFlags
;
2995 devmodeW
.dmDisplayFrequency
= devmode
->dmDisplayFrequency
;
2996 devmodeW
.dmFields
= devmode
->dmFields
;
2997 ret
= ChangeDisplaySettingsExW(nameW
.Buffer
, &devmodeW
, hwnd
, flags
, lparam
);
3001 ret
= ChangeDisplaySettingsExW(nameW
.Buffer
, NULL
, hwnd
, flags
, lparam
);
3004 if (devname
) RtlFreeUnicodeString(&nameW
);
3009 /***********************************************************************
3010 * ChangeDisplaySettingsExW (USER32.@)
3012 LONG WINAPI
ChangeDisplaySettingsExW( LPCWSTR devname
, LPDEVMODEW devmode
, HWND hwnd
,
3013 DWORD flags
, LPVOID lparam
)
3015 /* make sure the desktop window is created before mode changing */
3018 return USER_Driver
->pChangeDisplaySettingsEx( devname
, devmode
, hwnd
, flags
, lparam
);
3022 /***********************************************************************
3023 * EnumDisplaySettingsW (USER32.@)
3026 * TRUE if nth setting exists found (described in the LPDEVMODEW struct)
3027 * FALSE if we do not have the nth setting
3029 BOOL WINAPI
EnumDisplaySettingsW( LPCWSTR name
, DWORD n
, LPDEVMODEW devmode
)
3031 return EnumDisplaySettingsExW(name
, n
, devmode
, 0);
3035 /***********************************************************************
3036 * EnumDisplaySettingsA (USER32.@)
3038 BOOL WINAPI
EnumDisplaySettingsA(LPCSTR name
,DWORD n
,LPDEVMODEA devmode
)
3040 return EnumDisplaySettingsExA(name
, n
, devmode
, 0);
3044 /***********************************************************************
3045 * EnumDisplaySettingsExA (USER32.@)
3047 BOOL WINAPI
EnumDisplaySettingsExA(LPCSTR lpszDeviceName
, DWORD iModeNum
,
3048 LPDEVMODEA lpDevMode
, DWORD dwFlags
)
3052 UNICODE_STRING nameW
;
3054 if (lpszDeviceName
) RtlCreateUnicodeStringFromAsciiz(&nameW
, lpszDeviceName
);
3055 else nameW
.Buffer
= NULL
;
3057 ret
= EnumDisplaySettingsExW(nameW
.Buffer
,iModeNum
,&devmodeW
,dwFlags
);
3060 lpDevMode
->dmBitsPerPel
= devmodeW
.dmBitsPerPel
;
3061 lpDevMode
->dmPelsHeight
= devmodeW
.dmPelsHeight
;
3062 lpDevMode
->dmPelsWidth
= devmodeW
.dmPelsWidth
;
3063 lpDevMode
->dmDisplayFlags
= devmodeW
.dmDisplayFlags
;
3064 lpDevMode
->dmDisplayFrequency
= devmodeW
.dmDisplayFrequency
;
3065 lpDevMode
->dmFields
= devmodeW
.dmFields
;
3067 if (lpszDeviceName
) RtlFreeUnicodeString(&nameW
);
3072 /***********************************************************************
3073 * EnumDisplaySettingsExW (USER32.@)
3075 BOOL WINAPI
EnumDisplaySettingsExW(LPCWSTR lpszDeviceName
, DWORD iModeNum
,
3076 LPDEVMODEW lpDevMode
, DWORD dwFlags
)
3078 return USER_Driver
->pEnumDisplaySettingsEx(lpszDeviceName
, iModeNum
, lpDevMode
, dwFlags
);