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
f704d5c6
Commit
f704d5c6
authored
Apr 09, 2008
by
Lei Zhang
Committed by
Alexandre Julliard
Apr 09, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
user32: Add edit control check to see if its in a dialog on WM_CHAR/VK_RETURN.
parent
731d77f7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
39 additions
and
11 deletions
+39
-11
edit.c
dlls/user32/edit.c
+34
-4
edit.c
dlls/user32/tests/edit.c
+5
-7
No files found.
dlls/user32/edit.c
View file @
f704d5c6
...
...
@@ -863,7 +863,7 @@ static LRESULT WINAPI EditWndProc_common( HWND hwnd, UINT msg,
}
else
{
if
(
charW
==
VK_TAB
||
charW
==
VK_RETURN
)
if
(
charW
==
VK_TAB
)
break
;
}
result
=
EDIT_WM_Char
(
es
,
charW
);
...
...
@@ -3989,6 +3989,32 @@ static BOOL EDIT_EM_Undo(EDITSTATE *es)
}
/* Helper function for WM_CHAR
*
* According to an MSDN blog article titled "Just because you're a control
* doesn't mean that you're necessarily inside a dialog box," multiline edit
* controls without ES_WANTRETURN would attempt to detect whether it is inside
* a dialog box or not.
*/
static
BOOL
EDIT_IsInsideDialog
(
EDITSTATE
*
es
)
{
WND
*
pParent
;
BOOL
r
=
FALSE
;
if
(
es
->
hwndParent
)
{
pParent
=
WIN_GetPtr
(
es
->
hwndParent
);
if
(
pParent
&&
pParent
!=
WND_OTHER_PROCESS
&&
pParent
!=
WND_DESKTOP
)
{
if
(
pParent
->
flags
&
WIN_ISDIALOG
)
r
=
TRUE
;
WIN_ReleasePtr
(
pParent
);
}
}
return
r
;
}
/*********************************************************************
*
* WM_CHAR
...
...
@@ -4002,9 +4028,13 @@ static LRESULT EDIT_WM_Char(EDITSTATE *es, WCHAR c)
switch
(
c
)
{
case
'\r'
:
/* If the edit doesn't want the return and it's not a multiline edit, do nothing */
if
(
!
(
es
->
style
&
ES_MULTILINE
)
&&
!
(
es
->
style
&
ES_WANTRETURN
))
break
;
/* If it's not a multiline edit box, it would be ignored below.
* For multiline edit without ES_WANTRETURN, we have to make a
* special case.
*/
if
((
es
->
style
&
ES_MULTILINE
)
&&
!
(
es
->
style
&
ES_WANTRETURN
))
if
(
EDIT_IsInsideDialog
(
es
))
break
;
case
'\n'
:
if
(
es
->
style
&
ES_MULTILINE
)
{
if
(
es
->
style
&
ES_READONLY
)
{
...
...
dlls/user32/tests/edit.c
View file @
f704d5c6
...
...
@@ -1652,15 +1652,13 @@ static void test_enter(void)
ok
(
TRUE
==
r
,
"Expected: %d, got: %d
\n
"
,
TRUE
,
r
);
r
=
SendMessage
(
hwEdit
,
WM_CHAR
,
VK_RETURN
,
0
);
todo_wine
ok
(
1
==
r
,
"Expected: %d, got: %d
\n
"
,
1
,
r
);
ok
(
1
==
r
,
"Expected: %d, got: %d
\n
"
,
1
,
r
);
/* get text */
buffer
[
0
]
=
0
;
r
=
SendMessage
(
hwEdit
,
WM_GETTEXT
,
16
,
(
LPARAM
)
buffer
);
todo_wine
{
ok
(
2
==
r
,
"Expected: %d, got len %d
\n
"
,
2
,
r
);
ok
(
0
==
strcmp
(
buffer
,
"
\r\n
"
),
"expected
\"\\
r
\\
n
\"
, got
\"
%s
\"\n
"
,
buffer
);
}
DestroyWindow
(
hwEdit
);
...
...
@@ -1674,7 +1672,7 @@ static void test_enter(void)
ok
(
TRUE
==
r
,
"Expected: %d, got: %d
\n
"
,
TRUE
,
r
);
r
=
SendMessage
(
hwEdit
,
WM_CHAR
,
VK_RETURN
,
0
);
todo_wine
ok
(
1
==
r
,
"Expected: %d, got: %d
\n
"
,
1
,
r
);
ok
(
1
==
r
,
"Expected: %d, got: %d
\n
"
,
1
,
r
);
/* get text */
buffer
[
0
]
=
0
;
...
...
@@ -1694,7 +1692,7 @@ static void test_enter(void)
ok
(
TRUE
==
r
,
"Expected: %d, got: %d
\n
"
,
TRUE
,
r
);
r
=
SendMessage
(
hwEdit
,
WM_CHAR
,
VK_RETURN
,
0
);
todo_wine
ok
(
1
==
r
,
"Expected: %d, got: %d
\n
"
,
1
,
r
);
ok
(
1
==
r
,
"Expected: %d, got: %d
\n
"
,
1
,
r
);
/* get text */
buffer
[
0
]
=
0
;
...
...
@@ -1844,7 +1842,7 @@ static void test_wantreturn_edit_dialog(void)
r
=
DialogBoxParam
(
hinst
,
"EDIT_WANTRETURN_DIALOG"
,
NULL
,
(
DLGPROC
)
edit_wantreturn_dialog_proc
,
3
);
ok
(
444
==
r
,
"Expected %d, got %d
\n
"
,
444
,
r
);
r
=
DialogBoxParam
(
hinst
,
"EDIT_WANTRETURN_DIALOG"
,
NULL
,
(
DLGPROC
)
edit_wantreturn_dialog_proc
,
4
);
todo_wine
ok
(
444
==
r
,
"Expected %d, got %d
\n
"
,
444
,
r
);
ok
(
444
==
r
,
"Expected %d, got %d
\n
"
,
444
,
r
);
r
=
DialogBoxParam
(
hinst
,
"EDIT_WANTRETURN_DIALOG"
,
NULL
,
(
DLGPROC
)
edit_wantreturn_dialog_proc
,
5
);
ok
(
444
==
r
,
"Expected %d, got %d
\n
"
,
444
,
r
);
...
...
@@ -1852,7 +1850,7 @@ static void test_wantreturn_edit_dialog(void)
r
=
DialogBoxParam
(
hinst
,
"EDIT_WANTRETURN_DIALOG"
,
NULL
,
(
DLGPROC
)
edit_wantreturn_dialog_proc
,
6
);
todo_wine
ok
(
444
==
r
,
"Expected %d, got %d
\n
"
,
444
,
r
);
r
=
DialogBoxParam
(
hinst
,
"EDIT_WANTRETURN_DIALOG"
,
NULL
,
(
DLGPROC
)
edit_wantreturn_dialog_proc
,
7
);
todo_wine
ok
(
444
==
r
,
"Expected %d, got %d
\n
"
,
444
,
r
);
ok
(
444
==
r
,
"Expected %d, got %d
\n
"
,
444
,
r
);
r
=
DialogBoxParam
(
hinst
,
"EDIT_WANTRETURN_DIALOG"
,
NULL
,
(
DLGPROC
)
edit_wantreturn_dialog_proc
,
8
);
ok
(
444
==
r
,
"Expected %d, got %d
\n
"
,
444
,
r
);
}
...
...
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