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
fa56a363
Commit
fa56a363
authored
May 04, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
May 15, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/edit: Delegate composition string rendering to the IME UI.
Wine-Bug:
https://bugs.winehq.org/show_bug.cgi?id=53860
parent
e2cd4dcf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
154 deletions
+13
-154
edit.c
dlls/comctl32/edit.c
+13
-154
No files found.
dlls/comctl32/edit.c
View file @
fa56a363
...
@@ -141,9 +141,8 @@ typedef struct
...
@@ -141,9 +141,8 @@ typedef struct
/*
/*
* IME Data
* IME Data
*/
*/
UINT
composition_len
;
/* length of composition, 0 == no composition */
UINT
ime_status
;
/* IME status flag */
int
composition_start
;
/* the character position for the composition */
UINT
ime_status
;
/* IME status flag */
/*
/*
* Uniscribe Data
* Uniscribe Data
*/
*/
...
@@ -2068,9 +2067,6 @@ static INT EDIT_PaintText(EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col
...
@@ -2068,9 +2067,6 @@ static INT EDIT_PaintText(EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col
{
{
COLORREF
BkColor
;
COLORREF
BkColor
;
COLORREF
TextColor
;
COLORREF
TextColor
;
LOGFONTW
underline_font
;
HFONT
hUnderline
=
0
;
HFONT
old_font
=
0
;
INT
ret
;
INT
ret
;
INT
li
;
INT
li
;
INT
BkMode
;
INT
BkMode
;
...
@@ -2082,20 +2078,9 @@ static INT EDIT_PaintText(EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col
...
@@ -2082,20 +2078,9 @@ static INT EDIT_PaintText(EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col
BkColor
=
GetBkColor
(
dc
);
BkColor
=
GetBkColor
(
dc
);
TextColor
=
GetTextColor
(
dc
);
TextColor
=
GetTextColor
(
dc
);
if
(
rev
)
{
if
(
rev
)
{
if
(
es
->
composition_len
==
0
)
SetBkColor
(
dc
,
GetSysColor
(
COLOR_HIGHLIGHT
));
{
SetTextColor
(
dc
,
GetSysColor
(
COLOR_HIGHLIGHTTEXT
));
SetBkColor
(
dc
,
GetSysColor
(
COLOR_HIGHLIGHT
));
SetBkMode
(
dc
,
OPAQUE
);
SetTextColor
(
dc
,
GetSysColor
(
COLOR_HIGHLIGHTTEXT
));
SetBkMode
(
dc
,
OPAQUE
);
}
else
{
HFONT
current
=
GetCurrentObject
(
dc
,
OBJ_FONT
);
GetObjectW
(
current
,
sizeof
(
LOGFONTW
),
&
underline_font
);
underline_font
.
lfUnderline
=
TRUE
;
hUnderline
=
CreateFontIndirectW
(
&
underline_font
);
old_font
=
SelectObject
(
dc
,
hUnderline
);
}
}
}
li
=
EDIT_EM_LineIndex
(
es
,
line
);
li
=
EDIT_EM_LineIndex
(
es
,
line
);
if
(
es
->
style
&
ES_MULTILINE
)
{
if
(
es
->
style
&
ES_MULTILINE
)
{
...
@@ -2107,19 +2092,9 @@ static INT EDIT_PaintText(EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col
...
@@ -2107,19 +2092,9 @@ static INT EDIT_PaintText(EDITSTATE *es, HDC dc, INT x, INT y, INT line, INT col
ret
=
size
.
cx
;
ret
=
size
.
cx
;
}
}
if
(
rev
)
{
if
(
rev
)
{
if
(
es
->
composition_len
==
0
)
SetBkColor
(
dc
,
BkColor
);
{
SetTextColor
(
dc
,
TextColor
);
SetBkColor
(
dc
,
BkColor
);
SetBkMode
(
dc
,
BkMode
);
SetTextColor
(
dc
,
TextColor
);
SetBkMode
(
dc
,
BkMode
);
}
else
{
if
(
old_font
)
SelectObject
(
dc
,
old_font
);
if
(
hUnderline
)
DeleteObject
(
hUnderline
);
}
}
}
return
ret
;
return
ret
;
}
}
...
@@ -4278,75 +4253,6 @@ static BOOL EDIT_EM_GetCueBanner(EDITSTATE *es, WCHAR *buf, DWORD size)
...
@@ -4278,75 +4253,6 @@ static BOOL EDIT_EM_GetCueBanner(EDITSTATE *es, WCHAR *buf, DWORD size)
* The Following code is to handle inline editing from IMEs
* The Following code is to handle inline editing from IMEs
*/
*/
static
void
EDIT_GetCompositionStr
(
HIMC
hIMC
,
LPARAM
CompFlag
,
EDITSTATE
*
es
)
{
LONG
buflen
;
LPWSTR
lpCompStr
;
LPSTR
lpCompStrAttr
=
NULL
;
DWORD
dwBufLenAttr
;
buflen
=
ImmGetCompositionStringW
(
hIMC
,
GCS_COMPSTR
,
NULL
,
0
);
if
(
buflen
<
0
)
{
return
;
}
lpCompStr
=
Alloc
(
buflen
);
if
(
!
lpCompStr
)
{
ERR
(
"Unable to allocate IME CompositionString
\n
"
);
return
;
}
if
(
buflen
)
ImmGetCompositionStringW
(
hIMC
,
GCS_COMPSTR
,
lpCompStr
,
buflen
);
if
(
CompFlag
&
GCS_COMPATTR
)
{
/*
* We do not use the attributes yet. it would tell us what characters
* are in transition and which are converted or decided upon
*/
dwBufLenAttr
=
ImmGetCompositionStringW
(
hIMC
,
GCS_COMPATTR
,
NULL
,
0
);
if
(
dwBufLenAttr
)
{
dwBufLenAttr
++
;
lpCompStrAttr
=
Alloc
(
dwBufLenAttr
+
1
);
if
(
!
lpCompStrAttr
)
{
ERR
(
"Unable to allocate IME Attribute String
\n
"
);
Free
(
lpCompStr
);
return
;
}
ImmGetCompositionStringW
(
hIMC
,
GCS_COMPATTR
,
lpCompStrAttr
,
dwBufLenAttr
);
lpCompStrAttr
[
dwBufLenAttr
]
=
0
;
}
}
/* check for change in composition start */
if
(
es
->
selection_end
<
es
->
composition_start
)
es
->
composition_start
=
es
->
selection_end
;
/* replace existing selection string */
es
->
selection_start
=
es
->
composition_start
;
if
(
es
->
composition_len
>
0
)
es
->
selection_end
=
es
->
composition_start
+
es
->
composition_len
;
else
es
->
selection_end
=
es
->
selection_start
;
EDIT_EM_ReplaceSel
(
es
,
FALSE
,
lpCompStr
,
buflen
/
sizeof
(
WCHAR
),
TRUE
,
TRUE
);
es
->
composition_len
=
abs
(
es
->
composition_start
-
es
->
selection_end
);
es
->
selection_start
=
es
->
composition_start
;
es
->
selection_end
=
es
->
selection_start
+
es
->
composition_len
;
Free
(
lpCompStrAttr
);
Free
(
lpCompStr
);
}
static
void
EDIT_GetResultStr
(
HIMC
hIMC
,
EDITSTATE
*
es
)
static
void
EDIT_GetResultStr
(
HIMC
hIMC
,
EDITSTATE
*
es
)
{
{
LONG
buflen
;
LONG
buflen
;
...
@@ -4366,48 +4272,22 @@ static void EDIT_GetResultStr(HIMC hIMC, EDITSTATE *es)
...
@@ -4366,48 +4272,22 @@ static void EDIT_GetResultStr(HIMC hIMC, EDITSTATE *es)
}
}
ImmGetCompositionStringW
(
hIMC
,
GCS_RESULTSTR
,
lpResultStr
,
buflen
);
ImmGetCompositionStringW
(
hIMC
,
GCS_RESULTSTR
,
lpResultStr
,
buflen
);
/* check for change in composition start */
if
(
es
->
selection_end
<
es
->
composition_start
)
es
->
composition_start
=
es
->
selection_end
;
es
->
selection_start
=
es
->
composition_start
;
es
->
selection_end
=
es
->
composition_start
+
es
->
composition_len
;
EDIT_EM_ReplaceSel
(
es
,
TRUE
,
lpResultStr
,
buflen
/
sizeof
(
WCHAR
),
TRUE
,
TRUE
);
EDIT_EM_ReplaceSel
(
es
,
TRUE
,
lpResultStr
,
buflen
/
sizeof
(
WCHAR
),
TRUE
,
TRUE
);
es
->
composition_start
=
es
->
selection_end
;
es
->
composition_len
=
0
;
Free
(
lpResultStr
);
Free
(
lpResultStr
);
}
}
static
void
EDIT_ImeComposition
(
HWND
hwnd
,
LPARAM
CompFlag
,
EDITSTATE
*
es
)
static
void
EDIT_ImeComposition
(
HWND
hwnd
,
LPARAM
CompFlag
,
EDITSTATE
*
es
)
{
{
HIMC
hIMC
;
HIMC
hIMC
;
int
cursor
;
if
(
es
->
composition_len
==
0
&&
es
->
selection_start
!=
es
->
selection_end
)
{
EDIT_EM_ReplaceSel
(
es
,
TRUE
,
NULL
,
0
,
TRUE
,
TRUE
);
es
->
composition_start
=
es
->
selection_end
;
}
hIMC
=
ImmGetContext
(
hwnd
);
hIMC
=
ImmGetContext
(
hwnd
);
if
(
!
hIMC
)
if
(
!
hIMC
)
return
;
return
;
if
(
CompFlag
&
GCS_RESULTSTR
)
if
(
CompFlag
&
GCS_RESULTSTR
)
{
EDIT_GetResultStr
(
hIMC
,
es
);
EDIT_GetResultStr
(
hIMC
,
es
);
cursor
=
0
;
}
else
{
if
(
CompFlag
&
GCS_COMPSTR
)
EDIT_GetCompositionStr
(
hIMC
,
CompFlag
,
es
);
cursor
=
ImmGetCompositionStringW
(
hIMC
,
GCS_CURSORPOS
,
0
,
0
);
}
ImmReleaseContext
(
hwnd
,
hIMC
);
ImmReleaseContext
(
hwnd
,
hIMC
);
EDIT_SetCaretPos
(
es
,
es
->
selection_start
+
cursor
,
es
->
flags
&
EF_AFTER_WRAP
);
}
}
...
@@ -5081,32 +4961,11 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
...
@@ -5081,32 +4961,11 @@ static LRESULT CALLBACK EDIT_WindowProc(HWND hwnd, UINT msg, WPARAM wParam, LPAR
EDIT_UpdateImmCompositionFont
(
es
);
EDIT_UpdateImmCompositionFont
(
es
);
break
;
break
;
case
WM_IME_STARTCOMPOSITION
:
es
->
composition_start
=
es
->
selection_end
;
es
->
composition_len
=
0
;
break
;
case
WM_IME_COMPOSITION
:
case
WM_IME_COMPOSITION
:
if
(
lParam
&
GCS_RESULTSTR
&&
!
(
es
->
ime_status
&
EIMES_GETCOMPSTRATONCE
))
EDIT_EM_ReplaceSel
(
es
,
TRUE
,
NULL
,
0
,
TRUE
,
TRUE
);
{
if
((
lParam
&
GCS_RESULTSTR
)
&&
(
es
->
ime_status
&
EIMES_GETCOMPSTRATONCE
))
DefWindowProcW
(
hwnd
,
msg
,
wParam
,
lParam
);
EDIT_ImeComposition
(
hwnd
,
lParam
,
es
);
break
;
return
DefWindowProcW
(
hwnd
,
msg
,
wParam
,
lParam
);
}
EDIT_ImeComposition
(
hwnd
,
lParam
,
es
);
break
;
case
WM_IME_ENDCOMPOSITION
:
if
(
es
->
composition_len
>
0
)
{
EDIT_EM_ReplaceSel
(
es
,
TRUE
,
NULL
,
0
,
TRUE
,
TRUE
);
es
->
selection_end
=
es
->
selection_start
;
es
->
composition_len
=
0
;
}
break
;
case
WM_IME_COMPOSITIONFULL
:
break
;
case
WM_IME_SELECT
:
case
WM_IME_SELECT
:
break
;
break
;
...
...
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