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
d65f2492
Commit
d65f2492
authored
Jun 10, 2022
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 13, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
win32u: Move GetDialogBaseUnits implementation from user32.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
parent
817dca10
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
53 additions
and
31 deletions
+53
-31
dialog.c
dlls/user32/dialog.c
+1
-16
sysparams.c
dlls/win32u/sysparams.c
+46
-15
ntuser.h
include/ntuser.h
+6
-0
No files found.
dlls/user32/dialog.c
View file @
d65f2492
...
...
@@ -1519,22 +1519,7 @@ BOOL WINAPI CheckRadioButton( HWND hwndDlg, int firstID,
*/
DWORD
WINAPI
GetDialogBaseUnits
(
void
)
{
static
LONG
cx
,
cy
;
if
(
!
cx
)
{
HDC
hdc
;
if
((
hdc
=
GetDC
(
0
)))
{
cx
=
GdiGetCharDimensions
(
hdc
,
NULL
,
&
cy
);
NtUserReleaseDC
(
0
,
hdc
);
}
TRACE
(
"base units = %ld,%ld
\n
"
,
cx
,
cy
);
}
return
MAKELONG
(
MulDiv
(
cx
,
GetDpiForSystem
(),
USER_DEFAULT_SCREEN_DPI
),
MulDiv
(
cy
,
GetDpiForSystem
(),
USER_DEFAULT_SCREEN_DPI
));
return
NtUserGetDialogBaseUnits
();
}
...
...
dlls/win32u/sysparams.c
View file @
d65f2492
...
...
@@ -2724,38 +2724,66 @@ static void get_real_fontname( LOGFONTW *lf, WCHAR fullname[LF_FACESIZE] )
lstrcpyW
(
fullname
,
lf
->
lfFaceName
);
}
static
LONG
get_char_dimensions
(
HDC
hdc
,
TEXTMETRICW
*
metric
,
LONG
*
height
)
{
SIZE
sz
;
static
const
WCHAR
abcdW
[]
=
{
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
'g'
,
'h'
,
'i'
,
'j'
,
'k'
,
'l'
,
'm'
,
'n'
,
'o'
,
'p'
,
'q'
,
'r'
,
's'
,
't'
,
'u'
,
'v'
,
'w'
,
'x'
,
'y'
,
'z'
,
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
,
'H'
,
'I'
,
'J'
,
'K'
,
'L'
,
'M'
,
'N'
,
'O'
,
'P'
,
'Q'
,
'R'
,
'S'
,
'T'
,
'U'
,
'V'
,
'W'
,
'X'
,
'Y'
,
'Z'
};
if
(
metric
&&
!
NtGdiGetTextMetricsW
(
hdc
,
metric
,
0
))
return
0
;
if
(
!
NtGdiGetTextExtentExW
(
hdc
,
abcdW
,
ARRAYSIZE
(
abcdW
),
0
,
NULL
,
NULL
,
&
sz
,
0
))
return
0
;
if
(
height
)
*
height
=
sz
.
cy
;
return
(
sz
.
cx
/
26
+
1
)
/
2
;
}
/* get text metrics and/or "average" char width of the specified logfont
* for the specified dc */
static
void
get_text_metr_size
(
HDC
hdc
,
LOGFONTW
*
plf
,
TEXTMETRICW
*
ptm
,
UINT
*
psz
)
static
void
get_text_metr_size
(
HDC
hdc
,
LOGFONTW
*
plf
,
TEXTMETRICW
*
metric
,
UINT
*
psz
)
{
ENUMLOGFONTEXDVW
exdv
=
{
.
elfEnumLogfontEx
.
elfLogFont
=
*
plf
};
HFONT
hfont
,
hfontsav
;
TEXTMETRICW
tm
;
if
(
!
ptm
)
ptm
=
&
tm
;
UINT
ret
;
if
(
!
metric
)
metric
=
&
tm
;
hfont
=
NtGdiHfontCreate
(
&
exdv
,
sizeof
(
exdv
),
0
,
0
,
NULL
);
if
(
!
hfont
||
!
(
hfontsav
=
NtGdiSelectFont
(
hdc
,
hfont
)))
{
ptm
->
tmHeight
=
-
1
;
metric
->
tmHeight
=
-
1
;
if
(
psz
)
*
psz
=
10
;
if
(
hfont
)
NtGdiDeleteObjectApp
(
hfont
);
return
;
}
NtGdiGetTextMetricsW
(
hdc
,
ptm
,
0
);
if
(
psz
)
{
SIZE
sz
;
static
const
WCHAR
abcdW
[]
=
{
'a'
,
'b'
,
'c'
,
'd'
,
'e'
,
'f'
,
'g'
,
'h'
,
'i'
,
'j'
,
'k'
,
'l'
,
'm'
,
'n'
,
'o'
,
'p'
,
'q'
,
'r'
,
's'
,
't'
,
'u'
,
'v'
,
'w'
,
'x'
,
'y'
,
'z'
,
'A'
,
'B'
,
'C'
,
'D'
,
'E'
,
'F'
,
'G'
,
'H'
,
'I'
,
'J'
,
'K'
,
'L'
,
'M'
,
'N'
,
'O'
,
'P'
,
'Q'
,
'R'
,
'S'
,
'T'
,
'U'
,
'V'
,
'W'
,
'X'
,
'Y'
,
'Z'
};
if
(
NtGdiGetTextExtentExW
(
hdc
,
abcdW
,
ARRAYSIZE
(
abcdW
),
0
,
NULL
,
NULL
,
&
sz
,
0
))
*
psz
=
(
sz
.
cx
/
26
+
1
)
/
2
;
else
*
psz
=
10
;
}
ret
=
get_char_dimensions
(
hdc
,
metric
,
NULL
);
if
(
psz
)
*
psz
=
ret
?
ret
:
10
;
NtGdiSelectFont
(
hdc
,
hfontsav
);
NtGdiDeleteObjectApp
(
hfont
);
}
static
DWORD
get_dialog_base_units
(
void
)
{
static
LONG
cx
,
cy
;
if
(
!
cx
)
{
HDC
hdc
;
if
((
hdc
=
NtUserGetDCEx
(
0
,
0
,
DCX_CACHE
|
DCX_WINDOW
)))
{
cx
=
get_char_dimensions
(
hdc
,
NULL
,
&
cy
);
NtUserReleaseDC
(
0
,
hdc
);
}
TRACE
(
"base units = %d,%d
\n
"
,
cx
,
cy
);
}
return
MAKELONG
(
muldiv
(
cx
,
get_system_dpi
(),
USER_DEFAULT_SCREEN_DPI
),
muldiv
(
cy
,
get_system_dpi
(),
USER_DEFAULT_SCREEN_DPI
));
}
/* adjust some of the raw values found in the registry */
static
void
normalize_nonclientmetrics
(
NONCLIENTMETRICSW
*
pncm
)
{
...
...
@@ -4681,6 +4709,9 @@ ULONG_PTR WINAPI NtUserCallNoParam( ULONG code )
case
NtUserCallNoParam_GetDesktopWindow
:
return
HandleToUlong
(
get_desktop_window
()
);
case
NtUserCallNoParam_GetDialogBaseUnits
:
return
get_dialog_base_units
();
case
NtUserCallNoParam_GetInputState
:
return
get_input_state
();
...
...
include/ntuser.h
View file @
d65f2492
...
...
@@ -718,6 +718,7 @@ enum
{
NtUserCallNoParam_DestroyCaret
,
NtUserCallNoParam_GetDesktopWindow
,
NtUserCallNoParam_GetDialogBaseUnits
,
NtUserCallNoParam_GetInputState
,
NtUserCallNoParam_ReleaseCapture
,
/* temporary exports */
...
...
@@ -735,6 +736,11 @@ static inline HWND NtUserGetDesktopWindow(void)
return
UlongToHandle
(
NtUserCallNoParam
(
NtUserCallNoParam_GetDesktopWindow
));
}
static
inline
DWORD
NtUserGetDialogBaseUnits
(
void
)
{
return
NtUserCallNoParam
(
NtUserCallNoParam_GetDialogBaseUnits
);
};
static
inline
BOOL
NtUserGetInputState
(
void
)
{
return
NtUserCallNoParam
(
NtUserCallNoParam_GetInputState
);
...
...
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