Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
2b6f4506
Commit
2b6f4506
authored
Mar 14, 2019
by
Akihiro Sagawa
Committed by
Alexandre Julliard
Mar 18, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Fix minimum control size conditions when using EC_USEFONTINFO.
Signed-off-by:
Akihiro Sagawa
<
sagawa.aki@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
71523aea
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
40 deletions
+8
-40
edit.c
dlls/user32/edit.c
+7
-28
edit.c
dlls/user32/tests/edit.c
+1
-12
No files found.
dlls/user32/edit.c
View file @
2b6f4506
...
...
@@ -2850,26 +2850,10 @@ static void EDIT_EM_SetLimitText(EDITSTATE *es, UINT limit)
* action wParam despite what the docs say. EC_USEFONTINFO calculates the
* margin according to the textmetrics of the current font.
*
* When EC_USEFONTINFO is used in the non_cjk case the margins only
* change if the edit control is equal to or larger than a certain
* size. Though there is an exception for the empty client rect case
* with small font sizes.
* When EC_USEFONTINFO is used, the margins only change if the edit control is
* equal to or larger than a certain size. The empty client rect is treated as
* 80 pixels width.
*/
static
BOOL
is_cjk
(
UINT
charset
)
{
switch
(
charset
)
{
case
SHIFTJIS_CHARSET
:
case
HANGUL_CHARSET
:
case
GB2312_CHARSET
:
case
CHINESEBIG5_CHARSET
:
return
TRUE
;
}
/* HANGUL_CHARSET is strange, though treated as CJK by Win 8, it is
* not by other versions including Win 10. */
return
FALSE
;
}
static
void
EDIT_EM_SetMargins
(
EDITSTATE
*
es
,
INT
action
,
WORD
left
,
WORD
right
,
BOOL
repaint
)
{
...
...
@@ -2881,26 +2865,21 @@ static void EDIT_EM_SetMargins(EDITSTATE *es, INT action,
if
(
es
->
font
&&
(
left
==
EC_USEFONTINFO
||
right
==
EC_USEFONTINFO
))
{
HDC
dc
=
GetDC
(
es
->
hwndSelf
);
HFONT
old_font
=
SelectObject
(
dc
,
es
->
font
);
LONG
width
=
GdiGetCharDimensions
(
dc
,
&
tm
,
NULL
);
LONG
width
=
GdiGetCharDimensions
(
dc
,
&
tm
,
NULL
)
,
rc_width
;
RECT
rc
;
/* The default margins are only non zero for TrueType or Vector fonts */
if
(
tm
.
tmPitchAndFamily
&
(
TMPF_VECTOR
|
TMPF_TRUETYPE
))
{
if
(
!
is_cjk
(
tm
.
tmCharSet
))
{
/* FIXME: figure out the CJK values. */
default_left_margin
=
width
/
2
;
default_right_margin
=
width
/
2
;
GetClientRect
(
es
->
hwndSelf
,
&
rc
);
if
(
rc
.
right
-
rc
.
left
<
(
width
/
2
+
width
)
*
2
&&
(
width
>=
28
||
!
IsRectEmpty
(
&
rc
))
)
{
rc_width
=
!
IsRectEmpty
(
&
rc
)
?
rc
.
right
-
rc
.
left
:
80
;
if
(
rc_width
<
default_left_margin
+
default_right_margin
+
width
*
2
)
{
default_left_margin
=
es
->
left_margin
;
default_right_margin
=
es
->
right_margin
;
}
}
else
{
/* FIXME: figure out the CJK values. They are not affected by the client rect. */
default_left_margin
=
width
/
2
;
default_right_margin
=
width
/
2
;
}
}
SelectObject
(
dc
,
old_font
);
ReleaseDC
(
es
->
hwndSelf
,
dc
);
...
...
dlls/user32/tests/edit.c
View file @
2b6f4506
...
...
@@ -1451,7 +1451,7 @@ static void test_margins_usefontinfo(UINT charset)
HDC
hdc
;
TEXTMETRICW
tm
;
SIZE
size
;
BOOL
cjk
=
FALSE
,
cjk
_charset
;
BOOL
cjk_charset
;
LOGFONTA
lf
;
HFONT
hfont
;
RECT
rect
;
...
...
@@ -1486,16 +1486,6 @@ static void test_margins_usefontinfo(UINT charset)
return
;
}
expect
=
MAKELONG
(
size
.
cx
/
2
,
size
.
cx
/
2
);
charset
=
GetTextCharset
(
hdc
);
switch
(
charset
)
{
case
SHIFTJIS_CHARSET
:
case
HANGUL_CHARSET
:
case
GB2312_CHARSET
:
case
CHINESEBIG5_CHARSET
:
cjk
=
TRUE
;
}
cjk_charset
=
is_cjk_charset
(
hdc
);
hfont
=
SelectObject
(
hdc
,
hfont
);
...
...
@@ -1537,7 +1527,6 @@ static void test_margins_usefontinfo(UINT charset)
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
small_margins
);
SendMessageA
(
hwnd
,
EM_SETMARGINS
,
EC_LEFTMARGIN
|
EC_RIGHTMARGIN
,
MAKELONG
(
EC_USEFONTINFO
,
EC_USEFONTINFO
));
margins
=
SendMessageA
(
hwnd
,
EM_GETMARGINS
,
0
,
0
);
todo_wine_if
(
cjk
)
ok
(
margins
==
small_margins
,
"%d: got %d, %d
\n
"
,
charset
,
HIWORD
(
margins
),
LOWORD
(
margins
));
DestroyWindow
(
hwnd
);
...
...
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