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
ca878114
Commit
ca878114
authored
Mar 29, 2018
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Implement GetDpiForSystem().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e9000b4e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
34 deletions
+28
-34
sysparams.c
dlls/user32/sysparams.c
+26
-34
user32.spec
dlls/user32/user32.spec
+1
-0
winuser.h
include/winuser.h
+1
-0
No files found.
dlls/user32/sysparams.c
View file @
ca878114
...
...
@@ -625,19 +625,6 @@ void release_display_dc( HDC hdc )
LeaveCriticalSection
(
&
display_dc_section
);
}
static
inline
int
get_display_dpi
(
void
)
{
static
int
display_dpi
;
HDC
hdc
;
if
(
!
display_dpi
)
{
hdc
=
get_display_dc
();
display_dpi
=
GetDeviceCaps
(
hdc
,
LOGPIXELSY
);
release_display_dc
(
hdc
);
}
return
display_dpi
;
}
static
INT
CALLBACK
real_fontname_proc
(
const
LOGFONTW
*
lf
,
const
TEXTMETRICW
*
ntm
,
DWORD
type
,
LPARAM
lparam
)
{
const
ENUMLOGFONTW
*
elf
=
(
const
ENUMLOGFONTW
*
)
lf
;
...
...
@@ -768,7 +755,7 @@ static BOOL get_twips_entry( union sysparam_all_entry *entry, UINT int_param, vo
* Technical Reference to the Windows 2000 Registry ->
* HKEY_CURRENT_USER -> Control Panel -> Desktop -> WindowMetrics
*/
if
(
val
<
0
)
val
=
(
-
val
*
get_display_dpi
()
+
720
)
/
1440
;
if
(
val
<
0
)
val
=
(
-
val
*
GetDpiForSystem
()
+
720
)
/
1440
;
entry
->
uint
.
val
=
val
;
}
}
...
...
@@ -952,13 +939,13 @@ static BOOL get_font_entry( union sysparam_all_entry *entry, UINT int_param, voi
{
case
sizeof
(
font
):
if
(
font
.
lfHeight
>
0
)
/* positive height value means points ( inch/72 ) */
font
.
lfHeight
=
-
MulDiv
(
font
.
lfHeight
,
get_display_dpi
(),
72
);
font
.
lfHeight
=
-
MulDiv
(
font
.
lfHeight
,
GetDpiForSystem
(),
72
);
entry
->
font
.
val
=
font
;
break
;
case
sizeof
(
LOGFONT16
):
/* win9x-winME format */
SYSPARAMS_LogFont16To32W
(
(
LOGFONT16
*
)
&
font
,
&
entry
->
font
.
val
);
if
(
entry
->
font
.
val
.
lfHeight
>
0
)
entry
->
font
.
val
.
lfHeight
=
-
MulDiv
(
entry
->
font
.
val
.
lfHeight
,
get_display_dpi
(),
72
);
entry
->
font
.
val
.
lfHeight
=
-
MulDiv
(
entry
->
font
.
val
.
lfHeight
,
GetDpiForSystem
(),
72
);
break
;
default:
WARN
(
"Unknown format in key %s value %s
\n
"
,
...
...
@@ -1509,9 +1496,7 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
ret
=
get_entry
(
&
entry_ICONHORIZONTALSPACING
,
uiParam
,
pvParam
);
else
{
int
min_val
=
32
;
if
(
IsProcessDPIAware
())
min_val
=
MulDiv
(
min_val
,
get_display_dpi
(),
USER_DEFAULT_SCREEN_DPI
);
int
min_val
=
MulDiv
(
32
,
GetDpiForSystem
(),
USER_DEFAULT_SCREEN_DPI
);
ret
=
set_entry
(
&
entry_ICONHORIZONTALSPACING
,
max
(
min_val
,
uiParam
),
pvParam
,
fWinIni
);
}
break
;
...
...
@@ -1552,9 +1537,7 @@ BOOL WINAPI SystemParametersInfoW( UINT uiAction, UINT uiParam,
ret
=
get_entry
(
&
entry_ICONVERTICALSPACING
,
uiParam
,
pvParam
);
else
{
int
min_val
=
32
;
if
(
IsProcessDPIAware
())
min_val
=
MulDiv
(
min_val
,
get_display_dpi
(),
USER_DEFAULT_SCREEN_DPI
);
int
min_val
=
MulDiv
(
32
,
GetDpiForSystem
(),
USER_DEFAULT_SCREEN_DPI
);
ret
=
set_entry
(
&
entry_ICONVERTICALSPACING
,
max
(
min_val
,
uiParam
),
pvParam
,
fWinIni
);
}
break
;
...
...
@@ -2435,18 +2418,12 @@ INT WINAPI GetSystemMetrics( INT index )
return
max
(
8
,
ret
);
case
SM_CXICON
:
case
SM_CYICON
:
ret
=
32
;
if
(
IsProcessDPIAware
())
ret
=
MulDiv
(
ret
,
get_display_dpi
(),
USER_DEFAULT_SCREEN_DPI
);
return
ret
;
return
MulDiv
(
32
,
GetDpiForSystem
(),
USER_DEFAULT_SCREEN_DPI
);
case
SM_CXCURSOR
:
case
SM_CYCURSOR
:
if
(
IsProcessDPIAware
())
{
ret
=
MulDiv
(
32
,
get_display_dpi
(),
USER_DEFAULT_SCREEN_DPI
);
ret
=
MulDiv
(
32
,
GetDpiForSystem
(),
USER_DEFAULT_SCREEN_DPI
);
if
(
ret
>=
64
)
return
64
;
if
(
ret
>=
48
)
return
48
;
}
return
32
;
case
SM_CYMENU
:
return
GetSystemMetrics
(
SM_CYMENUSIZE
)
+
1
;
...
...
@@ -2537,10 +2514,7 @@ INT WINAPI GetSystemMetrics( INT index )
return
GetSystemMetrics
(
SM_CYMINIMIZED
)
+
max
(
0
,
(
INT
)
ret
);
case
SM_CXSMICON
:
case
SM_CYSMICON
:
ret
=
16
;
if
(
IsProcessDPIAware
())
ret
=
MulDiv
(
ret
,
get_display_dpi
(),
USER_DEFAULT_SCREEN_DPI
)
&
~
1
;
return
ret
;
return
MulDiv
(
16
,
GetDpiForSystem
(),
USER_DEFAULT_SCREEN_DPI
)
&
~
1
;
case
SM_CYSMCAPTION
:
return
GetSystemMetrics
(
SM_CYSMSIZE
)
+
1
;
case
SM_CXSMSIZE
:
...
...
@@ -2963,6 +2937,24 @@ BOOL WINAPI IsProcessDPIAware(void)
return
TRUE
;
}
/***********************************************************************
* GetDpiForSystem (USER32.@)
*/
UINT
WINAPI
GetDpiForSystem
(
void
)
{
static
int
display_dpi
;
if
(
!
IsProcessDPIAware
())
return
USER_DEFAULT_SCREEN_DPI
;
if
(
!
display_dpi
)
{
HDC
hdc
=
get_display_dc
();
display_dpi
=
GetDeviceCaps
(
hdc
,
LOGPIXELSY
);
release_display_dc
(
hdc
);
}
return
display_dpi
;
}
/**********************************************************************
* SetThreadDpiAwarenessContext (USER32.@)
*/
...
...
dlls/user32/user32.spec
View file @
ca878114
...
...
@@ -292,6 +292,7 @@
@ stdcall GetDlgItemTextA(long long ptr long)
@ stdcall GetDlgItemTextW(long long ptr long)
@ stdcall GetDoubleClickTime()
@ stdcall GetDpiForSystem()
@ stdcall GetFocus()
@ stdcall GetForegroundWindow()
@ stdcall GetGestureConfig(long long long ptr ptr long)
...
...
include/winuser.h
View file @
ca878114
...
...
@@ -3675,6 +3675,7 @@ WINUSERAPI UINT WINAPI GetDlgItemTextA(HWND,INT,LPSTR,INT);
WINUSERAPI
UINT
WINAPI
GetDlgItemTextW
(
HWND
,
INT
,
LPWSTR
,
INT
);
#define GetDlgItemText WINELIB_NAME_AW(GetDlgItemText)
WINUSERAPI
UINT
WINAPI
GetDoubleClickTime
(
void
);
WINUSERAPI
UINT
WINAPI
GetDpiForSystem
(
void
);
WINUSERAPI
HWND
WINAPI
GetFocus
(
void
);
WINUSERAPI
HWND
WINAPI
GetForegroundWindow
(
void
);
WINUSERAPI
BOOL
WINAPI
GetGestureConfig
(
HWND
,
DWORD
,
DWORD
,
UINT
*
,
GESTURECONFIG
*
,
UINT
);
...
...
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