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
6290d059
Commit
6290d059
authored
May 03, 2022
by
Jacek Caban
Committed by
Alexandre Julliard
May 05, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Use unixlib interface for IME calls.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
040d1f9b
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
66 additions
and
52 deletions
+66
-52
dllmain.c
dlls/winex11.drv/dllmain.c
+7
-0
ime.c
dlls/winex11.drv/ime.c
+33
-25
unixlib.h
dlls/winex11.drv/unixlib.h
+7
-0
x11drv.h
dlls/winex11.drv/x11drv.h
+7
-12
xim.c
dlls/winex11.drv/xim.c
+12
-15
No files found.
dlls/winex11.drv/dllmain.c
View file @
6290d059
...
...
@@ -133,6 +133,11 @@ static const callback_func callback_funcs[] =
x11drv_clipboard_init
,
x11drv_dnd_drop_event
,
x11drv_dnd_leave_event
,
x11drv_ime_get_cursor_pos
,
x11drv_ime_set_composition_status
,
x11drv_ime_set_cursor_pos
,
x11drv_ime_set_open_status
,
x11drv_ime_update_association
,
};
C_ASSERT
(
ARRAYSIZE
(
callback_funcs
)
==
client_funcs_count
);
...
...
@@ -150,6 +155,8 @@ static const kernel_callback kernel_callbacks[] =
x11drv_dnd_enter_event
,
x11drv_dnd_position_event
,
x11drv_dnd_post_drop
,
x11drv_ime_set_composition_string
,
x11drv_ime_set_result
,
};
C_ASSERT
(
NtUserDriverCallbackFirst
+
ARRAYSIZE
(
kernel_callbacks
)
==
client_func_last
);
...
...
dlls/winex11.drv/ime.c
View file @
6290d059
...
...
@@ -916,15 +916,16 @@ DWORD WINAPI ImeGetImeMenuItems(HIMC hIMC, DWORD dwFlags, DWORD dwType,
/* Interfaces to XIM and other parts of winex11drv */
void
IME_SetOpenStatus
(
BOOL
fOpen
)
NTSTATUS
x11drv_ime_set_open_status
(
UINT
open
)
{
HIMC
imc
;
imc
=
RealIMC
(
FROM_X11
);
ImmSetOpenStatus
(
imc
,
fOpen
);
ImmSetOpenStatus
(
imc
,
open
);
return
0
;
}
void
IME_SetCompositionStatus
(
BOOL
fOpen
)
NTSTATUS
x11drv_ime_set_composition_status
(
UINT
open
)
{
HIMC
imc
;
LPINPUTCONTEXT
lpIMC
;
...
...
@@ -933,28 +934,29 @@ void IME_SetCompositionStatus(BOOL fOpen)
imc
=
RealIMC
(
FROM_X11
);
lpIMC
=
ImmLockIMC
(
imc
);
if
(
lpIMC
==
NULL
)
return
;
return
0
;
myPrivate
=
ImmLockIMCC
(
lpIMC
->
hPrivate
);
if
(
fO
pen
&&
!
myPrivate
->
bInComposition
)
if
(
o
pen
&&
!
myPrivate
->
bInComposition
)
{
GenerateIMEMessage
(
imc
,
WM_IME_STARTCOMPOSITION
,
0
,
0
);
}
else
if
(
!
fO
pen
&&
myPrivate
->
bInComposition
)
else
if
(
!
o
pen
&&
myPrivate
->
bInComposition
)
{
ShowWindow
(
myPrivate
->
hwndDefault
,
SW_HIDE
);
ImmDestroyIMCC
(
lpIMC
->
hCompStr
);
lpIMC
->
hCompStr
=
ImeCreateBlankCompStr
();
GenerateIMEMessage
(
imc
,
WM_IME_ENDCOMPOSITION
,
0
,
0
);
}
myPrivate
->
bInComposition
=
fO
pen
;
myPrivate
->
bInComposition
=
o
pen
;
ImmUnlockIMCC
(
lpIMC
->
hPrivate
);
ImmUnlockIMC
(
imc
);
return
0
;
}
INT
IME_GetCursorPos
(
void
)
NTSTATUS
x11drv_ime_get_cursor_pos
(
UINT
arg
)
{
LPINPUTCONTEXT
lpIMC
;
INT
rc
=
0
;
...
...
@@ -974,68 +976,73 @@ INT IME_GetCursorPos(void)
return
rc
;
}
void
IME_SetCursorPos
(
DWORD
pos
)
NTSTATUS
x11drv_ime_set_cursor_pos
(
UINT
pos
)
{
LPINPUTCONTEXT
lpIMC
;
LPCOMPOSITIONSTRING
compstr
;
if
(
!
hSelectedFrom
)
return
;
return
0
;
lpIMC
=
LockRealIMC
(
FROM_X11
);
if
(
!
lpIMC
)
return
;
return
0
;
compstr
=
ImmLockIMCC
(
lpIMC
->
hCompStr
);
if
(
!
compstr
)
{
UnlockRealIMC
(
FROM_X11
);
return
;
return
0
;
}
compstr
->
dwCursorPos
=
pos
;
ImmUnlockIMCC
(
lpIMC
->
hCompStr
);
UnlockRealIMC
(
FROM_X11
);
GenerateIMEMessage
(
FROM_X11
,
WM_IME_COMPOSITION
,
pos
,
GCS_CURSORPOS
);
return
;
return
0
;
}
void
IME_UpdateAssociation
(
HWND
focus
)
NTSTATUS
x11drv_ime_update_association
(
UINT
arg
)
{
ImmGetContext
(
focus
);
HWND
focus
=
UlongToHandle
(
arg
);
if
(
!
focus
||
!
hSelectedFrom
)
return
;
ImmGetContext
(
focus
);
ImmAssociateContext
(
focus
,
RealIMC
(
FROM_X11
));
if
(
focus
&&
hSelectedFrom
)
ImmAssociateContext
(
focus
,
RealIMC
(
FROM_X11
));
return
0
;
}
BOOL
IME_SetCompositionString
(
DWORD
dwIndex
,
LPCVOID
lpComp
,
DWORD
dwCompLen
,
LPCVOID
lpRead
,
DWORD
dwReadLen
)
NTSTATUS
WINAPI
x11drv_ime_set_composition_string
(
void
*
param
,
ULONG
size
)
{
return
ImeSetCompositionString
(
FROM_X11
,
dwIndex
,
lpComp
,
dwCompLen
,
lpRead
,
dwReadLen
);
return
ImeSetCompositionString
(
FROM_X11
,
SCS_SETSTR
,
param
,
size
,
NULL
,
0
);
}
void
IME_SetResultString
(
LPWSTR
lpResult
,
DWORD
dwResultLen
)
NTSTATUS
WINAPI
x11drv_ime_set_result
(
void
*
params
,
ULONG
len
)
{
WCHAR
*
lpResult
=
params
;
HIMC
imc
;
LPINPUTCONTEXT
lpIMC
;
HIMCC
newCompStr
;
LPIMEPRIVATE
myPrivate
;
BOOL
inComp
;
HWND
focus
;
len
/=
sizeof
(
WCHAR
);
if
((
focus
=
GetFocus
()))
x11drv_ime_update_association
(
HandleToUlong
(
focus
));
imc
=
RealIMC
(
FROM_X11
);
lpIMC
=
ImmLockIMC
(
imc
);
if
(
lpIMC
==
NULL
)
return
;
return
0
;
newCompStr
=
updateCompStr
(
lpIMC
->
hCompStr
,
NULL
,
0
);
ImmDestroyIMCC
(
lpIMC
->
hCompStr
);
lpIMC
->
hCompStr
=
newCompStr
;
newCompStr
=
updateResultStr
(
lpIMC
->
hCompStr
,
lpResult
,
dwResultL
en
);
newCompStr
=
updateResultStr
(
lpIMC
->
hCompStr
,
lpResult
,
l
en
);
ImmDestroyIMCC
(
lpIMC
->
hCompStr
);
lpIMC
->
hCompStr
=
newCompStr
;
...
...
@@ -1057,6 +1064,7 @@ void IME_SetResultString(LPWSTR lpResult, DWORD dwResultLen)
ImmSetOpenStatus
(
imc
,
FALSE
);
ImmUnlockIMC
(
imc
);
return
0
;
}
/*****
...
...
dlls/winex11.drv/unixlib.h
View file @
6290d059
...
...
@@ -75,6 +75,8 @@ enum x11drv_client_funcs
client_func_dnd_enter_event
,
client_func_dnd_position_event
,
client_func_dnd_post_drop
,
client_func_ime_set_composition_string
,
client_func_ime_set_result
,
client_func_last
};
...
...
@@ -86,6 +88,11 @@ enum client_callback
client_clipboard_init
,
client_dnd_drop_event
,
client_dnd_leave_event
,
client_ime_get_cursor_pos
,
client_ime_set_composition_status
,
client_ime_set_cursor_pos
,
client_ime_set_open_status
,
client_ime_update_association
,
client_funcs_count
};
...
...
dlls/winex11.drv/x11drv.h
View file @
6290d059
...
...
@@ -284,18 +284,6 @@ extern const struct gdi_dc_funcs *X11DRV_XRender_Init(void) DECLSPEC_HIDDEN;
extern
struct
opengl_funcs
*
get_glx_driver
(
UINT
)
DECLSPEC_HIDDEN
;
extern
const
struct
vulkan_funcs
*
get_vulkan_driver
(
UINT
)
DECLSPEC_HIDDEN
;
/* IME support */
extern
void
IME_SetOpenStatus
(
BOOL
fOpen
)
DECLSPEC_HIDDEN
;
extern
void
IME_SetCompositionStatus
(
BOOL
fOpen
)
DECLSPEC_HIDDEN
;
extern
INT
IME_GetCursorPos
(
void
)
DECLSPEC_HIDDEN
;
extern
void
IME_SetCursorPos
(
DWORD
pos
)
DECLSPEC_HIDDEN
;
extern
void
IME_UpdateAssociation
(
HWND
focus
)
DECLSPEC_HIDDEN
;
extern
BOOL
IME_SetCompositionString
(
DWORD
dwIndex
,
LPCVOID
lpComp
,
DWORD
dwCompLen
,
LPCVOID
lpRead
,
DWORD
dwReadLen
)
DECLSPEC_HIDDEN
;
extern
void
IME_SetResultString
(
LPWSTR
lpResult
,
DWORD
dwResultlen
)
DECLSPEC_HIDDEN
;
extern
struct
format_entry
*
import_xdnd_selection
(
Display
*
display
,
Window
win
,
Atom
selection
,
Atom
*
targets
,
UINT
count
,
size_t
*
size
)
DECLSPEC_HIDDEN
;
...
...
@@ -849,9 +837,16 @@ extern NTSTATUS x11drv_xim_reset( void *arg ) DECLSPEC_HIDDEN;
extern
NTSTATUS
WINAPI
x11drv_dnd_enter_event
(
void
*
params
,
ULONG
size
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
WINAPI
x11drv_dnd_position_event
(
void
*
params
,
ULONG
size
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
WINAPI
x11drv_dnd_post_drop
(
void
*
data
,
ULONG
size
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
WINAPI
x11drv_ime_set_composition_string
(
void
*
params
,
ULONG
size
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
WINAPI
x11drv_ime_set_result
(
void
*
params
,
ULONG
size
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
x11drv_dnd_drop_event
(
UINT
arg
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
x11drv_dnd_leave_event
(
UINT
arg
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
x11drv_ime_get_cursor_pos
(
UINT
arg
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
x11drv_ime_set_composition_status
(
UINT
arg
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
x11drv_ime_set_cursor_pos
(
UINT
pos
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
x11drv_ime_set_open_status
(
UINT
open
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
x11drv_ime_update_association
(
UINT
arg
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
x11drv_client_func
(
enum
x11drv_client_funcs
func
,
const
void
*
params
,
...
...
dlls/winex11.drv/xim.c
View file @
6290d059
...
...
@@ -89,25 +89,21 @@ static void X11DRV_ImmSetInternalString(DWORD dwOffset,
if
(
lpComp
)
memcpy
(
ptr_new
,
lpComp
,
byte_length
);
dwCompStringLength
+=
byte_expansion
;
IME_SetCompositionString
(
SCS_SETSTR
,
CompositionS
tring
,
dwCompStringLength
,
NULL
,
0
);
x11drv_client_func
(
client_func_ime_set_composition_s
tring
,
CompositionString
,
dwCompStringLength
);
}
void
X11DRV_XIMLookupChars
(
const
char
*
str
,
DWORD
count
)
{
WCHAR
*
output
;
DWORD
len
;
HWND
focus
;
TRACE
(
"%p %u
\n
"
,
str
,
count
);
if
(
!
(
output
=
malloc
(
count
*
sizeof
(
WCHAR
)
)))
return
;
len
=
ntdll_umbstowcs
(
str
,
count
,
output
,
count
);
if
((
focus
=
GetFocus
()))
IME_UpdateAssociation
(
focus
);
IME_SetResultString
(
output
,
len
);
x11drv_client_func
(
client_func_ime_set_result
,
output
,
len
*
sizeof
(
WCHAR
)
);
free
(
output
);
}
...
...
@@ -120,21 +116,22 @@ static BOOL XIMPreEditStateNotifyCallback(XIC xic, XPointer p, XPointer data)
switch
(
state
)
{
case
XIMPreeditEnable
:
IME_SetOpenStatus
(
TRUE
);
x11drv_client_call
(
client_ime_set_open_status
,
TRUE
);
break
;
case
XIMPreeditDisable
:
IME_SetOpenStatus
(
FALSE
);
x11drv_client_call
(
client_ime_set_open_status
,
FALSE
);
break
;
default:
break
;
}
return
TRUE
;
}
static
int
XIMPreEditStartCallback
(
XIC
ic
,
XPointer
client_data
,
XPointer
call_data
)
{
TRACE
(
"PreEditStartCallback %p
\n
"
,
ic
);
IME_SetCompositionStatus
(
TRUE
);
x11drv_client_call
(
client_ime_set_composition_status
,
TRUE
);
ximInComposeMode
=
TRUE
;
return
-
1
;
}
...
...
@@ -148,7 +145,7 @@ static void XIMPreEditDoneCallback(XIC ic, XPointer client_data, XPointer call_d
dwCompStringSize
=
0
;
dwCompStringLength
=
0
;
CompositionString
=
NULL
;
IME_SetCompositionStatus
(
FALSE
);
x11drv_client_call
(
client_ime_set_composition_status
,
FALSE
);
}
static
void
XIMPreEditDrawCallback
(
XIM
ic
,
XPointer
client_data
,
...
...
@@ -188,7 +185,7 @@ static void XIMPreEditDrawCallback(XIM ic, XPointer client_data,
}
else
X11DRV_ImmSetInternalString
(
sel
,
len
,
NULL
,
0
);
IME_SetCursorPos
(
P_DR
->
caret
);
x11drv_client_call
(
client_ime_set_cursor_pos
,
P_DR
->
caret
);
}
TRACE
(
"Finished
\n
"
);
}
...
...
@@ -200,7 +197,7 @@ static void XIMPreEditCaretCallback(XIC ic, XPointer client_data,
if
(
P_C
)
{
int
pos
=
IME_GetCursorPos
(
);
int
pos
=
x11drv_client_call
(
client_ime_get_cursor_pos
,
0
);
TRACE
(
"pos: %d
\n
"
,
pos
);
switch
(
P_C
->
direction
)
{
...
...
@@ -229,7 +226,7 @@ static void XIMPreEditCaretCallback(XIC ic, XPointer client_data,
FIXME
(
"Not implemented
\n
"
);
break
;
}
IME_SetCursorPos
(
pos
);
x11drv_client_call
(
client_ime_set_cursor_pos
,
pos
);
P_C
->
position
=
pos
;
}
TRACE
(
"Finished
\n
"
);
...
...
@@ -423,7 +420,7 @@ static BOOL open_xim( Display *display )
else
thread_data
->
font_set
=
NULL
;
IME_UpdateAssociation
(
NULL
);
x11drv_client_call
(
client_ime_update_association
,
0
);
return
TRUE
;
}
...
...
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