Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
fb118b22
Commit
fb118b22
authored
May 02, 2017
by
Huw Davies
Committed by
Alexandre Julliard
May 02, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Fix the calculation of system metrics icon sizes.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
a7d79fe4
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
11 deletions
+42
-11
sysparams.c
dlls/user32/sysparams.c
+7
-5
sysparams.c
dlls/user32/tests/sysparams.c
+35
-6
No files found.
dlls/user32/sysparams.c
View file @
fb118b22
...
...
@@ -174,7 +174,6 @@ static const WCHAR SMCAPTIONWIDTH_VALNAME[]= {METRICS_KEY,'S','m','C',
static
const
WCHAR
SMCAPTIONHEIGHT_VALNAME
[]
=
{
METRICS_KEY
,
'S'
,
'm'
,
'C'
,
'a'
,
'p'
,
't'
,
'i'
,
'o'
,
'n'
,
'H'
,
'e'
,
'i'
,
'g'
,
'h'
,
't'
,
0
};
static
const
WCHAR
MENUWIDTH_VALNAME
[]
=
{
METRICS_KEY
,
'M'
,
'e'
,
'n'
,
'u'
,
'W'
,
'i'
,
'd'
,
't'
,
'h'
,
0
};
static
const
WCHAR
MENUHEIGHT_VALNAME
[]
=
{
METRICS_KEY
,
'M'
,
'e'
,
'n'
,
'u'
,
'H'
,
'e'
,
'i'
,
'g'
,
'h'
,
't'
,
0
};
static
const
WCHAR
ICONSIZE_VALNAME
[]
=
{
METRICS_KEY
,
'S'
,
'h'
,
'e'
,
'l'
,
'l'
,
' '
,
'I'
,
'c'
,
'o'
,
'n'
,
' '
,
'S'
,
'i'
,
'z'
,
'e'
,
0
};
static
const
WCHAR
PADDEDBORDERWIDTH_VALNAME
[]
=
{
METRICS_KEY
,
'P'
,
'a'
,
'd'
,
'd'
,
'e'
,
'd'
,
'B'
,
'o'
,
'r'
,
'd'
,
'e'
,
'r'
,
'W'
,
'i'
,
'd'
,
't'
,
'h'
,
0
};
static
const
WCHAR
CAPTIONLOGFONT_VALNAME
[]
=
{
METRICS_KEY
,
'C'
,
'a'
,
'p'
,
't'
,
'i'
,
'o'
,
'n'
,
'F'
,
'o'
,
'n'
,
't'
,
0
};
static
const
WCHAR
SMCAPTIONLOGFONT_VALNAME
[]
=
{
METRICS_KEY
,
'S'
,
'm'
,
'C'
,
'a'
,
'p'
,
't'
,
'i'
,
'o'
,
'n'
,
'F'
,
'o'
,
'n'
,
't'
,
0
};
...
...
@@ -1158,7 +1157,6 @@ static UINT_ENTRY( DRAGHEIGHT, 4 );
static
UINT_ENTRY
(
DOUBLECLICKTIME
,
500
);
static
UINT_ENTRY
(
FONTSMOOTHING
,
2
);
static
UINT_ENTRY
(
GRIDGRANULARITY
,
0
);
static
UINT_ENTRY
(
ICONSIZE
,
32
);
static
UINT_ENTRY
(
KEYBOARDDELAY
,
1
);
static
UINT_ENTRY
(
KEYBOARDSPEED
,
31
);
static
UINT_ENTRY
(
MENUSHOWDELAY
,
400
);
...
...
@@ -1323,7 +1321,6 @@ static union sysparam_all_entry * const default_entries[] =
(
union
sysparam_all_entry
*
)
&
entry_FOREGROUNDFLASHCOUNT
,
(
union
sysparam_all_entry
*
)
&
entry_FOREGROUNDLOCKTIMEOUT
,
(
union
sysparam_all_entry
*
)
&
entry_ICONHORIZONTALSPACING
,
(
union
sysparam_all_entry
*
)
&
entry_ICONSIZE
,
(
union
sysparam_all_entry
*
)
&
entry_ICONTITLEWRAP
,
(
union
sysparam_all_entry
*
)
&
entry_ICONVERTICALSPACING
,
(
union
sysparam_all_entry
*
)
&
entry_KEYBOARDDELAY
,
...
...
@@ -2400,7 +2397,9 @@ INT WINAPI GetSystemMetrics( INT index )
return
max
(
8
,
ret
);
case
SM_CXICON
:
case
SM_CYICON
:
get_entry
(
&
entry_ICONSIZE
,
0
,
&
ret
);
ret
=
32
;
if
(
IsProcessDPIAware
())
ret
=
MulDiv
(
ret
,
get_display_dpi
(),
USER_DEFAULT_SCREEN_DPI
);
return
ret
;
case
SM_CXCURSOR
:
case
SM_CYCURSOR
:
...
...
@@ -2492,7 +2491,10 @@ INT WINAPI GetSystemMetrics( INT index )
return
GetSystemMetrics
(
SM_CYMINIMIZED
)
+
max
(
0
,
(
INT
)
ret
);
case
SM_CXSMICON
:
case
SM_CYSMICON
:
return
16
;
ret
=
16
;
if
(
IsProcessDPIAware
())
ret
=
MulDiv
(
ret
,
get_display_dpi
(),
USER_DEFAULT_SCREEN_DPI
)
&
~
1
;
return
ret
;
case
SM_CYSMCAPTION
:
return
GetSystemMetrics
(
SM_CYSMSIZE
)
+
1
;
case
SM_CXSMSIZE
:
...
...
dlls/user32/tests/sysparams.c
View file @
fb118b22
...
...
@@ -39,6 +39,8 @@
#endif
static
LONG
(
WINAPI
*
pChangeDisplaySettingsExA
)(
LPCSTR
,
LPDEVMODEA
,
HWND
,
DWORD
,
LPVOID
);
static
BOOL
(
WINAPI
*
pIsProcessDPIAware
)(
void
);
static
BOOL
(
WINAPI
*
pSetProcessDPIAware
)(
void
);
static
BOOL
strict
;
static
int
dpi
,
real_dpi
;
...
...
@@ -2702,7 +2704,7 @@ static void test_GetSystemMetrics( void)
HDC
hdc
=
CreateICA
(
"Display"
,
0
,
0
,
0
);
UINT
avcwCaption
;
INT
CaptionWidthfromreg
;
INT
CaptionWidthfromreg
,
smicon
,
broken_val
;
MINIMIZEDMETRICS
minim
;
NONCLIENTMETRICSA
ncm
;
SIZE
screen
;
...
...
@@ -2769,8 +2771,9 @@ static void test_GetSystemMetrics( void)
ok_gsm
(
SM_CYDLGFRAME
,
3
);
ok_gsm
(
SM_CYVTHUMB
,
ncm
.
iScrollHeight
);
ok_gsm
(
SM_CXHTHUMB
,
ncm
.
iScrollHeight
);
/* SM_CXICON */
/* SM_CYICON */
/* These don't depend on the Shell Icon Size registry value */
ok_gsm
(
SM_CXICON
,
MulDiv
(
32
,
dpi
,
USER_DEFAULT_SCREEN_DPI
)
);
ok_gsm
(
SM_CYICON
,
MulDiv
(
32
,
dpi
,
USER_DEFAULT_SCREEN_DPI
)
);
/* SM_CXCURSOR */
/* SM_CYCURSOR */
ok_gsm
(
SM_CYMENU
,
ncm
.
iMenuHeight
+
1
);
...
...
@@ -2815,8 +2818,32 @@ static void test_GetSystemMetrics( void)
/* sign-extension for iHorzGap/iVertGap is broken on Win9x */
ok_gsm
(
SM_CXMINSPACING
,
GetSystemMetrics
(
SM_CXMINIMIZED
)
+
(
short
)
minim
.
iHorzGap
);
ok_gsm
(
SM_CYMINSPACING
,
GetSystemMetrics
(
SM_CYMINIMIZED
)
+
(
short
)
minim
.
iVertGap
);
/* SM_CXSMICON */
/* SM_CYSMICON */
smicon
=
MulDiv
(
16
,
dpi
,
USER_DEFAULT_SCREEN_DPI
);
if
(
!
pIsProcessDPIAware
||
pIsProcessDPIAware
())
smicon
=
max
(
min
(
smicon
,
CaptionWidthfromreg
-
2
),
4
)
&
~
1
;
todo_wine_if
(
real_dpi
==
dpi
&&
smicon
!=
(
MulDiv
(
16
,
dpi
,
USER_DEFAULT_SCREEN_DPI
)
&
~
1
)
)
{
broken_val
=
(
min
(
ncm
.
iCaptionHeight
,
CaptionWidthfromreg
)
-
2
)
&
~
1
;
broken_val
=
min
(
broken_val
,
20
);
if
(
smicon
==
4
)
{
ok_gsm_2
(
SM_CXSMICON
,
smicon
,
6
);
ok_gsm_2
(
SM_CYSMICON
,
smicon
,
6
);
}
else
if
(
smicon
<
broken_val
)
{
ok_gsm_2
(
SM_CXSMICON
,
smicon
,
broken_val
);
ok_gsm_2
(
SM_CYSMICON
,
smicon
,
broken_val
);
}
else
{
ok_gsm
(
SM_CXSMICON
,
smicon
);
ok_gsm
(
SM_CYSMICON
,
smicon
);
}
}
ok_gsm
(
SM_CYSMCAPTION
,
ncm
.
iSmCaptionHeight
+
1
);
ok_gsm_3
(
SM_CXSMSIZE
,
ncm
.
iSmCaptionWidth
,
/* classic/standard windows style */
...
...
@@ -2960,7 +2987,9 @@ START_TEST(sysparams)
HANDLE
hInstance
,
hdll
;
hdll
=
GetModuleHandleA
(
"user32.dll"
);
pChangeDisplaySettingsExA
=
(
void
*
)
GetProcAddress
(
hdll
,
"ChangeDisplaySettingsExA"
);
pChangeDisplaySettingsExA
=
(
void
*
)
GetProcAddress
(
hdll
,
"ChangeDisplaySettingsExA"
);
pIsProcessDPIAware
=
(
void
*
)
GetProcAddress
(
hdll
,
"IsProcessDPIAware"
);
pSetProcessDPIAware
=
(
void
*
)
GetProcAddress
(
hdll
,
"SetProcessDPIAware"
);
hInstance
=
GetModuleHandleA
(
NULL
);
hdc
=
GetDC
(
0
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment