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
f3696e6a
Commit
f3696e6a
authored
May 09, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
May 10, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Use a helper to change internal composition status.
parent
9d282171
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
46 deletions
+30
-46
ime.c
dlls/winex11.drv/ime.c
+30
-46
No files found.
dlls/winex11.drv/ime.c
View file @
f3696e6a
...
...
@@ -453,6 +453,25 @@ static void GenerateIMEMessage(HIMC hIMC, UINT msg, WPARAM wParam,
UnlockRealIMC
(
hIMC
);
}
static
void
ime_set_composition_status
(
HIMC
himc
,
BOOL
composition
)
{
struct
ime_private
*
priv
;
INPUTCONTEXT
*
ctx
;
UINT
msg
=
0
;
if
(
!
(
ctx
=
ImmLockIMC
(
himc
)))
return
;
if
((
priv
=
ImmLockIMCC
(
ctx
->
hPrivate
)))
{
if
(
!
priv
->
bInComposition
&&
composition
)
msg
=
WM_IME_STARTCOMPOSITION
;
else
if
(
priv
->
bInComposition
&&
!
composition
)
msg
=
WM_IME_ENDCOMPOSITION
;
priv
->
bInComposition
=
composition
;
ImmUnlockIMCC
(
ctx
->
hPrivate
);
}
ImmUnlockIMC
(
himc
);
if
(
msg
)
GenerateIMEMessage
(
himc
,
msg
,
0
,
0
);
}
static
BOOL
IME_RemoveFromSelected
(
HIMC
hIMC
)
{
int
i
;
...
...
@@ -580,16 +599,8 @@ BOOL WINAPI NotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
X11DRV_CALL
(
xim_preedit_state
,
&
preedit_params
);
if
(
!
lpIMC
->
fOpen
)
{
LPIMEPRIVATE
myPrivate
;
myPrivate
=
ImmLockIMCC
(
lpIMC
->
hPrivate
);
if
(
myPrivate
->
bInComposition
)
{
X11DRV_CALL
(
xim_reset
,
lpIMC
->
hWnd
);
GenerateIMEMessage
(
hIMC
,
WM_IME_ENDCOMPOSITION
,
0
,
0
);
myPrivate
->
bInComposition
=
FALSE
;
}
ImmUnlockIMCC
(
lpIMC
->
hPrivate
);
X11DRV_CALL
(
xim_reset
,
lpIMC
->
hWnd
);
ime_set_composition_status
(
hIMC
,
FALSE
);
}
break
;
...
...
@@ -602,7 +613,6 @@ BOOL WINAPI NotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
case
CPS_COMPLETE
:
{
HIMCC
newCompStr
;
LPIMEPRIVATE
myPrivate
;
WCHAR
*
str
;
UINT
len
;
...
...
@@ -614,7 +624,6 @@ BOOL WINAPI NotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
ImmDestroyIMCC
(
lpIMC
->
hCompStr
);
lpIMC
->
hCompStr
=
newCompStr
;
myPrivate
=
ImmLockIMCC
(
lpIMC
->
hPrivate
);
if
((
str
=
input_context_get_comp_str
(
lpIMC
,
FALSE
,
&
len
)))
{
WCHAR
param
=
str
[
0
];
...
...
@@ -631,15 +640,10 @@ BOOL WINAPI NotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
GenerateIMEMessage
(
hIMC
,
WM_IME_COMPOSITION
,
param
,
GCS_RESULTSTR
|
GCS_RESULTCLAUSE
);
GenerateIMEMessage
(
hIMC
,
WM_IME_ENDCOMPOSITION
,
0
,
0
);
free
(
str
);
}
else
if
(
myPrivate
->
bInComposition
)
GenerateIMEMessage
(
hIMC
,
WM_IME_ENDCOMPOSITION
,
0
,
0
);
myPrivate
->
bInComposition
=
FALSE
;
ImmUnlockIMCC
(
lpIMC
->
hPrivate
);
ime_set_composition_status
(
hIMC
,
FALSE
);
bRet
=
TRUE
;
}
...
...
@@ -648,8 +652,6 @@ BOOL WINAPI NotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
case
CPS_REVERT
:
FIXME
(
"CPS_REVERT
\n
"
);
break
;
case
CPS_CANCEL
:
{
LPIMEPRIVATE
myPrivate
;
TRACE
(
"CPS_CANCEL
\n
"
);
X11DRV_CALL
(
xim_reset
,
lpIMC
->
hWnd
);
...
...
@@ -658,13 +660,7 @@ BOOL WINAPI NotifyIME(HIMC hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
ImmDestroyIMCC
(
lpIMC
->
hCompStr
);
lpIMC
->
hCompStr
=
ImeCreateBlankCompStr
();
myPrivate
=
ImmLockIMCC
(
lpIMC
->
hPrivate
);
if
(
myPrivate
->
bInComposition
)
{
GenerateIMEMessage
(
hIMC
,
WM_IME_ENDCOMPOSITION
,
0
,
0
);
myPrivate
->
bInComposition
=
FALSE
;
}
ImmUnlockIMCC
(
lpIMC
->
hPrivate
);
ime_set_composition_status
(
hIMC
,
FALSE
);
bRet
=
TRUE
;
}
break
;
...
...
@@ -685,7 +681,6 @@ BOOL WINAPI ImeSetCompositionString(HIMC hIMC, DWORD dwIndex, LPCVOID lpComp,
LPINPUTCONTEXT
lpIMC
;
DWORD
flags
=
0
;
WCHAR
wParam
=
0
;
LPIMEPRIVATE
myPrivate
;
TRACE
(
"(%p, %ld, %p, %ld, %p, %ld):
\n
"
,
hIMC
,
dwIndex
,
lpComp
,
dwCompLen
,
lpRead
,
dwReadLen
);
...
...
@@ -710,17 +705,11 @@ BOOL WINAPI ImeSetCompositionString(HIMC hIMC, DWORD dwIndex, LPCVOID lpComp,
if
(
lpIMC
==
NULL
)
return
FALSE
;
myPrivate
=
ImmLockIMCC
(
lpIMC
->
hPrivate
);
if
(
dwIndex
==
SCS_SETSTR
)
{
HIMCC
newCompStr
;
if
(
!
myPrivate
->
bInComposition
)
{
GenerateIMEMessage
(
hIMC
,
WM_IME_STARTCOMPOSITION
,
0
,
0
);
myPrivate
->
bInComposition
=
TRUE
;
}
ime_set_composition_status
(
hIMC
,
TRUE
);
/* clear existing result */
newCompStr
=
updateResultStr
(
lpIMC
->
hCompStr
,
NULL
,
0
);
...
...
@@ -768,30 +757,25 @@ NTSTATUS x11drv_ime_set_composition_status( UINT open )
{
HIMC
imc
;
LPINPUTCONTEXT
lpIMC
;
LPIMEPRIVATE
myPrivate
;
imc
=
RealIMC
(
FROM_X11
);
lpIMC
=
ImmLockIMC
(
imc
);
if
(
lpIMC
==
NULL
)
return
0
;
myPrivate
=
ImmLockIMCC
(
lpIMC
->
hPrivate
);
if
(
open
&&
!
myPrivate
->
bInComposition
)
{
GenerateIMEMessage
(
imc
,
WM_IME_STARTCOMPOSITION
,
0
,
0
);
}
else
if
(
!
open
&&
myPrivate
->
bInComposition
)
if
(
!
open
)
{
struct
ime_private
*
myPrivate
=
ImmLockIMCC
(
lpIMC
->
hPrivate
);
ShowWindow
(
myPrivate
->
hwndDefault
,
SW_HIDE
);
ImmDestroyIMCC
(
lpIMC
->
hCompStr
);
lpIMC
->
hCompStr
=
ImeCreateBlankCompStr
();
GenerateIMEMessage
(
imc
,
WM_IME_ENDCOMPOSITION
,
0
,
0
);
ImmUnlockIMCC
(
lpIMC
->
hPrivate
);
}
myPrivate
->
bInComposition
=
open
;
ImmUnlockIMCC
(
lpIMC
->
hPrivate
);
ImmUnlockIMC
(
imc
);
ime_set_composition_status
(
imc
,
open
);
return
0
;
}
...
...
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