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
d0691e8c
Commit
d0691e8c
authored
Apr 02, 2023
by
Rémi Bernon
Committed by
Alexandre Julliard
Apr 05, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Refactor XIM input style selection.
parent
08bc39bd
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
56 deletions
+28
-56
xim.c
dlls/winex11.drv/xim.c
+28
-56
No files found.
dlls/winex11.drv/xim.c
View file @
d0691e8c
...
...
@@ -49,17 +49,8 @@ static DWORD dwCompStringLength = 0;
static
LPBYTE
CompositionString
=
NULL
;
static
DWORD
dwCompStringSize
=
0
;
#define STYLE_OFFTHESPOT (XIMPreeditArea | XIMStatusArea)
#define STYLE_OVERTHESPOT (XIMPreeditPosition | XIMStatusNothing)
#define STYLE_ROOT (XIMPreeditNothing | XIMStatusNothing)
/* this uses all the callbacks to utilize full IME support */
#define STYLE_CALLBACK (XIMPreeditCallbacks | XIMStatusNothing)
/* in order to enable deadkey support */
#define STYLE_NONE (XIMPreeditNothing | XIMStatusNothing)
static
XIMStyle
ximStyle
=
0
;
static
XIMStyle
ximStyleRoot
=
0
;
static
XIMStyle
ximStyleRequest
=
STYLE_CALLBACK
;
static
XIMStyle
input_style
=
0
;
static
XIMStyle
input_style_req
=
XIMPreeditCallbacks
|
XIMStatusCallbacks
;
static
const
char
*
debugstr_xim_style
(
XIMStyle
style
)
{
...
...
@@ -338,13 +329,6 @@ BOOL xim_init( const WCHAR *input_style )
static
const
WCHAR
overthespotW
[]
=
{
'o'
,
'v'
,
'e'
,
'r'
,
't'
,
'h'
,
'e'
,
's'
,
'p'
,
'o'
,
't'
,
0
};
static
const
WCHAR
rootW
[]
=
{
'r'
,
'o'
,
'o'
,
't'
,
0
};
if
(
!
wcsicmp
(
input_style
,
offthespotW
))
ximStyleRequest
=
STYLE_OFFTHESPOT
;
else
if
(
!
wcsicmp
(
input_style
,
overthespotW
))
ximStyleRequest
=
STYLE_OVERTHESPOT
;
else
if
(
!
wcsicmp
(
input_style
,
rootW
))
ximStyleRequest
=
STYLE_ROOT
;
if
(
!
XSupportsLocale
())
{
WARN
(
"X does not support locale.
\n
"
);
...
...
@@ -355,6 +339,17 @@ BOOL xim_init( const WCHAR *input_style )
WARN
(
"Could not set locale modifiers.
\n
"
);
return
FALSE
;
}
if
(
!
wcsicmp
(
input_style
,
offthespotW
))
input_style_req
=
XIMPreeditArea
|
XIMStatusArea
;
else
if
(
!
wcsicmp
(
input_style
,
overthespotW
))
input_style_req
=
XIMPreeditPosition
|
XIMStatusNothing
;
else
if
(
!
wcsicmp
(
input_style
,
rootW
))
input_style_req
=
XIMPreeditNothing
|
XIMStatusNothing
;
TRACE
(
"requesting %s style %#lx %s
\n
"
,
debugstr_w
(
input_style
),
input_style_req
,
debugstr_xim_style
(
input_style_req
)
);
return
TRUE
;
}
...
...
@@ -364,13 +359,12 @@ static void xim_destroy( XIM xim, XPointer user, XPointer arg );
static
XIM
xim_create
(
struct
x11drv_thread_data
*
data
)
{
XIMCallback
destroy
=
{.
callback
=
xim_destroy
,
.
client_data
=
(
XPointer
)
data
};
Display
*
display
=
data
->
display
;
XIMStyle
ximStyleNone
;
XIMStyles
*
ximStyles
=
NULL
;
XIMStyle
input_style_fallback
=
XIMPreeditNone
|
XIMStatusNone
;
XIMStyles
*
styles
=
NULL
;
INT
i
;
XIM
xim
;
if
(
!
(
xim
=
XOpenIM
(
display
,
NULL
,
NULL
,
NULL
)))
if
(
!
(
xim
=
XOpenIM
(
d
ata
->
d
isplay
,
NULL
,
NULL
,
NULL
)))
{
WARN
(
"Could not open input method.
\n
"
);
return
NULL
;
...
...
@@ -382,50 +376,28 @@ static XIM xim_create( struct x11drv_thread_data *data )
TRACE
(
"xim %p, XDisplayOfIM %p, XLocaleOfIM %s
\n
"
,
xim
,
XDisplayOfIM
(
xim
),
debugstr_a
(
XLocaleOfIM
(
xim
))
);
XGetIMValues
(
xim
,
XNQueryInputStyle
,
&
ximStyles
,
NULL
);
if
(
ximStyles
==
0
)
XGetIMValues
(
xim
,
XNQueryInputStyle
,
&
styles
,
NULL
);
if
(
!
styles
)
{
WARN
(
"Could not find supported input style.
\n
"
);
XCloseIM
(
xim
);
return
NULL
;
}
ximStyleRoot
=
0
;
ximStyleNone
=
0
;
ximStyle
=
0
;
TRACE
(
"input styles count %u
\n
"
,
ximStyles
->
count_styles
);
for
(
i
=
0
;
i
<
ximStyles
->
count_styles
;
++
i
)
TRACE
(
"input styles count %u
\n
"
,
styles
->
count_styles
);
for
(
i
=
0
,
input_style
=
0
;
i
<
styles
->
count_styles
;
++
i
)
{
XIMStyle
style
=
ximS
tyles
->
supported_styles
[
i
];
XIMStyle
style
=
s
tyles
->
supported_styles
[
i
];
TRACE
(
" %u: %#lx %s
\n
"
,
i
,
style
,
debugstr_xim_style
(
style
)
);
if
(
!
ximStyle
&&
(
ximStyles
->
supported_styles
[
i
]
==
ximStyleRequest
))
{
ximStyle
=
ximStyleRequest
;
TRACE
(
"Setting Style: ximStyle = ximStyleRequest
\n
"
);
}
else
if
(
!
ximStyleRoot
&&
(
ximStyles
->
supported_styles
[
i
]
==
STYLE_ROOT
))
{
ximStyleRoot
=
STYLE_ROOT
;
TRACE
(
"Setting Style: ximStyleRoot = STYLE_ROOT
\n
"
);
}
else
if
(
!
ximStyleNone
&&
(
ximStyles
->
supported_styles
[
i
]
==
STYLE_NONE
))
{
TRACE
(
"Setting Style: ximStyleNone = STYLE_NONE
\n
"
);
ximStyleNone
=
STYLE_NONE
;
}
if
(
style
==
input_style_req
)
input_style
=
style
;
if
(
!
input_style
&&
(
style
&
input_style_req
))
input_style
=
style
;
if
(
input_style_fallback
>
style
)
input_style_fallback
=
style
;
}
XFree
(
ximStyles
);
if
(
ximStyle
==
0
)
ximStyle
=
ximStyleRoot
;
XFree
(
styles
);
if
(
ximStyle
==
0
)
ximStyle
=
ximStyleNone
;
if
(
!
input_style
)
input_style
=
input_style_fallback
;
TRACE
(
"selected style %#lx %s
\n
"
,
input_style
,
debugstr_xim_style
(
input_style
)
)
;
return
xim
;
}
...
...
@@ -511,7 +483,7 @@ XIC X11DRV_CreateIC( XIM xim, HWND hwnd, struct x11drv_win_data *data )
XNStatusDoneCallback
,
&
status_done
,
XNStatusDrawCallback
,
&
status_draw
,
NULL
);
xic
=
XCreateIC
(
xim
,
XNInputStyle
,
ximS
tyle
,
XNPreeditAttributes
,
preedit
,
XNStatusAttributes
,
status
,
xic
=
XCreateIC
(
xim
,
XNInputStyle
,
input_s
tyle
,
XNPreeditAttributes
,
preedit
,
XNStatusAttributes
,
status
,
XNClientWindow
,
win
,
XNFocusWindow
,
win
,
XNDestroyCallback
,
&
destroy
,
NULL
);
TRACE
(
"created XIC %p
\n
"
,
xic
);
...
...
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