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
7a038cae
Commit
7a038cae
authored
Mar 17, 2021
by
Huw Davies
Committed by
Alexandre Julliard
Mar 17, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Handle dialog mode in the host.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
84aa9b91
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
49 deletions
+56
-49
editor.c
dlls/riched20/editor.c
+0
-47
editstr.h
dlls/riched20/editstr.h
+0
-1
txthost.c
dlls/riched20/txthost.c
+56
-1
No files found.
dlls/riched20/editor.c
View file @
7a038cae
...
...
@@ -2411,34 +2411,8 @@ static void ME_UpdateSelectionLinkAttribute(ME_TextEditor *editor)
static
BOOL
handle_enter
(
ME_TextEditor
*
editor
)
{
BOOL
ctrl_is_down
=
GetKeyState
(
VK_CONTROL
)
&
0x8000
;
BOOL
shift_is_down
=
GetKeyState
(
VK_SHIFT
)
&
0x8000
;
if
(
editor
->
bDialogMode
)
{
if
(
ctrl_is_down
)
return
TRUE
;
if
(
!
(
editor
->
styleFlags
&
ES_WANTRETURN
))
{
if
(
editor
->
hwndParent
)
{
DWORD
dw
;
dw
=
SendMessageW
(
editor
->
hwndParent
,
DM_GETDEFID
,
0
,
0
);
if
(
HIWORD
(
dw
)
==
DC_HASDEFID
)
{
HWND
hwDefCtrl
=
GetDlgItem
(
editor
->
hwndParent
,
LOWORD
(
dw
));
if
(
hwDefCtrl
)
{
SendMessageW
(
editor
->
hwndParent
,
WM_NEXTDLGCTL
,
(
WPARAM
)
hwDefCtrl
,
TRUE
);
PostMessageW
(
hwDefCtrl
,
WM_KEYDOWN
,
VK_RETURN
,
0
);
}
}
}
return
TRUE
;
}
}
if
(
editor
->
props
&
TXTBIT_MULTILINE
)
{
ME_Cursor
cursor
=
editor
->
pCursors
[
0
];
...
...
@@ -2647,14 +2621,6 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
if
(
!
editor
->
bEmulateVersion10
)
return
handle_enter
(
editor
);
break
;
case
VK_ESCAPE
:
if
(
editor
->
bDialogMode
&&
editor
->
hwndParent
)
PostMessageW
(
editor
->
hwndParent
,
WM_CLOSE
,
0
,
0
);
return
TRUE
;
case
VK_TAB
:
if
(
editor
->
bDialogMode
&&
editor
->
hwndParent
)
SendMessageW
(
editor
->
hwndParent
,
WM_NEXTDLGCTL
,
shift_is_down
,
0
);
return
TRUE
;
case
'A'
:
if
(
ctrl_is_down
)
{
...
...
@@ -3068,7 +3034,6 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
ed
->
mode
|=
(
ed
->
props
&
TXTBIT_RICHTEXT
)
?
TM_RICHTEXT
:
TM_PLAINTEXT
;
ed
->
AutoURLDetect_bEnable
=
FALSE
;
ed
->
bHaveFocus
=
FALSE
;
ed
->
bDialogMode
=
FALSE
;
ed
->
bMouseCaptured
=
FALSE
;
ed
->
caret_hidden
=
FALSE
;
ed
->
caret_height
=
0
;
...
...
@@ -3399,18 +3364,6 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
return
ME_StreamIn
(
editor
,
wParam
,
(
EDITSTREAM
*
)
lParam
,
TRUE
);
case
EM_STREAMOUT
:
return
ME_StreamOut
(
editor
,
wParam
,
(
EDITSTREAM
*
)
lParam
);
case
WM_GETDLGCODE
:
{
UINT
code
=
DLGC_WANTCHARS
|
DLGC_WANTTAB
|
DLGC_WANTARROWS
;
if
(
lParam
)
editor
->
bDialogMode
=
TRUE
;
if
(
editor
->
props
&
TXTBIT_MULTILINE
)
code
|=
DLGC_WANTMESSAGE
;
if
(
!
(
editor
->
props
&
TXTBIT_SAVESELECTION
))
code
|=
DLGC_HASSETSEL
;
return
code
;
}
case
EM_EMPTYUNDOBUFFER
:
ME_EmptyUndoStack
(
editor
);
return
0
;
...
...
dlls/riched20/editstr.h
View file @
7a038cae
...
...
@@ -424,7 +424,6 @@ typedef struct tagME_TextEditor
BOOL
AutoURLDetect_bEnable
;
WCHAR
cPasswordMask
;
BOOL
bHaveFocus
;
BOOL
bDialogMode
;
/* Indicates that we are inside a dialog window */
/*for IME */
int
imeStartIndex
;
DWORD
selofs
;
/* The size of the selection bar on the left side of control */
...
...
dlls/riched20/txthost.c
View file @
7a038cae
...
...
@@ -39,7 +39,8 @@ struct host
ITextServices
*
text_srv
;
ME_TextEditor
*
editor
;
/* to be removed */
HWND
window
,
parent
;
BOOL
emulate_10
;
unsigned
int
emulate_10
:
1
;
unsigned
int
dialog_mode
:
1
;
PARAFORMAT2
para_fmt
;
DWORD
props
,
scrollbars
,
event_mask
;
};
...
...
@@ -84,6 +85,7 @@ struct host *host_create( HWND hwnd, CREATESTRUCTW *cs, BOOL emulate_10 )
texthost
->
window
=
hwnd
;
texthost
->
parent
=
cs
->
hwndParent
;
texthost
->
emulate_10
=
emulate_10
;
texthost
->
dialog_mode
=
0
;
memset
(
&
texthost
->
para_fmt
,
0
,
sizeof
(
texthost
->
para_fmt
)
);
texthost
->
para_fmt
.
cbSize
=
sizeof
(
texthost
->
para_fmt
);
texthost
->
para_fmt
.
dwMask
=
PFM_ALIGNMENT
;
...
...
@@ -844,6 +846,31 @@ static HRESULT set_options( struct host *host, DWORD op, DWORD value, LRESULT *r
return
hr
;
}
/* handle dialog mode VK_RETURN. Returns TRUE if message has been processed */
static
BOOL
handle_dialog_enter
(
struct
host
*
host
)
{
BOOL
ctrl_is_down
=
GetKeyState
(
VK_CONTROL
)
&
0x8000
;
if
(
ctrl_is_down
)
return
TRUE
;
if
(
host
->
editor
->
styleFlags
&
ES_WANTRETURN
)
return
FALSE
;
if
(
host
->
parent
)
{
DWORD
id
=
SendMessageW
(
host
->
parent
,
DM_GETDEFID
,
0
,
0
);
if
(
HIWORD
(
id
)
==
DC_HASDEFID
)
{
HWND
ctrl
=
GetDlgItem
(
host
->
parent
,
LOWORD
(
id
));
if
(
ctrl
)
{
SendMessageW
(
host
->
parent
,
WM_NEXTDLGCTL
,
(
WPARAM
)
ctrl
,
TRUE
);
PostMessageW
(
ctrl
,
WM_KEYDOWN
,
VK_RETURN
,
0
);
}
}
}
return
TRUE
;
}
static
LRESULT
send_msg_filter
(
struct
host
*
host
,
UINT
msg
,
WPARAM
*
wparam
,
LPARAM
*
lparam
)
{
MSGFILTER
msgf
;
...
...
@@ -905,6 +932,7 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
WCHAR
wc
=
wparam
;
if
(
!
unicode
)
MultiByteToWideChar
(
CP_ACP
,
0
,
(
char
*
)
&
wparam
,
1
,
&
wc
,
1
);
if
(
wparam
==
'\r'
&&
host
->
dialog_mode
&&
host
->
emulate_10
&&
handle_dialog_enter
(
host
))
break
;
hr
=
ITextServices_TxSendMessage
(
host
->
text_srv
,
msg
,
wc
,
lparam
,
&
res
);
break
;
}
...
...
@@ -958,6 +986,14 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
}
break
;
}
case
WM_GETDLGCODE
:
if
(
lparam
)
host
->
dialog_mode
=
TRUE
;
res
=
DLGC_WANTCHARS
|
DLGC_WANTTAB
|
DLGC_WANTARROWS
;
if
(
host
->
props
&
TXTBIT_MULTILINE
)
res
|=
DLGC_WANTMESSAGE
;
if
(
!
(
host
->
props
&
TXTBIT_SAVESELECTION
))
res
|=
DLGC_HASSETSEL
;
break
;
case
EM_GETLINE
:
if
(
unicode
)
hr
=
ITextServices_TxSendMessage
(
host
->
text_srv
,
msg
,
wparam
,
lparam
,
&
res
);
else
hr
=
get_lineA
(
host
->
text_srv
,
wparam
,
lparam
,
&
res
);
...
...
@@ -1014,6 +1050,25 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
else
hr
=
get_text_rangeA
(
host
,
(
TEXTRANGEA
*
)
lparam
,
&
res
);
break
;
case
WM_KEYDOWN
:
switch
(
LOWORD
(
wparam
))
{
case
VK_ESCAPE
:
if
(
host
->
dialog_mode
&&
host
->
parent
)
PostMessageW
(
host
->
parent
,
WM_CLOSE
,
0
,
0
);
break
;
case
VK_TAB
:
if
(
host
->
dialog_mode
&&
host
->
parent
)
SendMessageW
(
host
->
parent
,
WM_NEXTDLGCTL
,
GetKeyState
(
VK_SHIFT
)
&
0x8000
,
0
);
break
;
case
VK_RETURN
:
if
(
host
->
dialog_mode
&&
!
host
->
emulate_10
&&
handle_dialog_enter
(
host
))
break
;
/* fall through */
default:
hr
=
ITextServices_TxSendMessage
(
host
->
text_srv
,
msg
,
wparam
,
lparam
,
&
res
);
}
break
;
case
WM_PAINT
:
{
HDC
hdc
;
...
...
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