Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Bug#1008481: Add SDL_IM_MODULE to fcitx4 and fcitx5

75 views
Skip to first unread message

Shengjing Zhu

unread,
Mar 27, 2022, 3:10:05 AM3/27/22
to
Source: im-config
Version: 0.50-2
Severity: wishlist
X-Debbugs-Cc: zh...@debian.org

Origin from https://salsa.debian.org/input-method-team/im-config/-/merge_requests/14

I asked the author to submit a bug first. But we haven't received so far.

sdl2 supports reading SDL_IM_MODULE, but the supported value is only fcitx,
otherwise it uses ibus.

Fcitx support in sdl2 package: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=881042
Upstream code: https://github.com/libsdl-org/SDL/blob/120c76c8/src/core/linux/SDL_ime.c#L46-L49

So adding SDL_IM_MODULE=fcitx to fcitx4 and fcitx5 is reasonable.

Osamu Aoki

unread,
Mar 27, 2022, 11:40:03 PM3/27/22
to
Hi,

These bugs seem somewhat similar:

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=990316
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1008481

Please check these.
So question is "Does sdl upstream recommend turning on IM_MODULE as default?

Also, I am a bit concerned to add features for external program fearng some
regressions. Please explain this has no negative side effects.

Can we resolve this by adding README for some special case situation.

Osamu

Shengjing Zhu

unread,
Mar 28, 2022, 2:40:04 AM3/28/22
to
On Mon, Mar 28, 2022 at 11:37 AM Osamu Aoki <os...@debian.org> wrote:
>
> Hi,
>
> These bugs seem somewhat similar:
>
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=990316
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1008481
>

AFAICT, GLFW_IM_MODULE is different from SDL_IM_MODULE.

I can't find GLFW_IM_MODULE in glfw code, it only appears in kitty's glfw fork.
But SDL_IM_MODULE can be found in sdl2 code.

Ref: https://github.com/libsdl-org/SDL/blob/120c76c8/src/core/linux/SDL_ime.c#L46-L49

--
Shengjing Zhu

Gunnar Hjalmarsson

unread,
Mar 28, 2022, 3:20:03 PM3/28/22
to
Like Osamu I first thought: "This is similar to bug #990316". But I no
longer think that's the case. As regards Kitty, upstream intentionally
disables the IM support by default. This seems to be something else, and
AFAICT adding that variable would not contradict to anyone's intention.

But with that said, I don't think it makes sense to spam the users'
environment with duplicate variables. Upstream already makes use of the
well established XMODIFIERS variable, and by parsing its value they
would know whether fcitx(5) is used or not. So we may want to propose
that to upstream rather than adding a new application specific variable.

--
Cheers,
Gunnar

Shengjing Zhu

unread,
Mar 28, 2022, 3:40:03 PM3/28/22
to
1. I thought XMODIFIERS is for XIM (X Input Method). Not sure why sdl2
checks XMODIFIERS as well.
2. Changing sdl2 upstream takes too long to propagate. SDL_IM_MODULE
appeared in sdl2 since 2016
https://github.com/libsdl-org/SDL/commit/808c75d1
User asks for this for Dota2 game, which seems hard to get sdl2 updated...

--
Shengjing Zhu

Gunnar Hjalmarsson

unread,
Mar 28, 2022, 4:00:03 PM3/28/22
to
Ok, I rest my case. :)

As far as I'm concerned, please feel free to push the change to the repo.

--
Gunnar

Osamu Aoki

unread,
Mar 29, 2022, 3:20:03 AM3/29/22
to
Hi,

Let me assess situation more verbosely.

> -----Original Message-----
> From: Shengjing Zhu <zh...@debian.org>
> To: Gunnar Hjalmarsson <gunn...@debian.org>
> Cc: 100...@bugs.debian.org, Osamu Aoki <os...@debian.org>
> Subject: Re: Bug#1008481: Add SDL_IM_MODULE to fcitx4 and fcitx5
> Date: Tue, 29 Mar 2022 03:27:36 +0800
>
> On Tue, Mar 29, 2022 at 3:05 AM Gunnar Hjalmarsson <gunn...@debian.org> wrote:
> >
> > On 2022-03-28 08:28, Shengjing Zhu wrote:
> > > On Mon, Mar 28, 2022 at 11:37 AM Osamu Aoki <os...@debian.org> wrote:
> > > >
> > > > Hi,
> > > >
> > > > These bugs seem ***somewhat*** similar:

Yes, I understand these are not the same problem.

With your explanation, I think I am clear about issues.

> > > > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=990316
> > > > https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1008481
> > > >
> > >
> > > AFAICT, GLFW_IM_MODULE is different from SDL_IM_MODULE.
> > >
> > > I can't find GLFW_IM_MODULE in glfw code, it only appears in kitty's glfw fork.

The upstream of glfw doesn't support GLFW_IM_MODULE.

The vendored copy of glfw in the popular kitty supports GLFW_IM_MODULE and kitty
upstream still advises not to enable this input method support as the default
setting.

So we decided not to enable it from im-config

Since fcitx5 uses the same protocol as ibus, documented proposed workaround was to
set GLFW_IM_MODULE=ibus for both ibus case and fcitx5 case. fcitx4 isn't supported
and no proposed setting.

> > > But SDL_IM_MODULE can be found in sdl2 code.
> > > Ref:
> > >
> https://github.com/libsdl-org/SDL/blob/120c76c8/src/core/linux/SDL_ime.c#L46-L49

The upstream of sdl in Debian has been supporting fcitx via SDL_IM_MODULE for some
time.

No popular programs in Debian used modern sdl2 so the support of fcitx via
SDL_IM_MODULE was never raised nor addressed in im-config. It should have been and
is a valid feature addition case for im-config.

> ...
> 2. Changing sdl2 upstream takes too long to propagate. SDL_IM_MODULE
> appeared in sdl2 since 2016
> https://github.com/libsdl-org/SDL/commit/808c75d1
> User asks for this for Dota2 game, which seems hard to get sdl2 updated...

The vendored copy of sdl2 in the popular non-Debian DOTA finally got updated and now
support of fcitx (fcitx4?) via SDL_IM_MODULE is a desirable feature. So there is
significant desire to set up fcitx for sdl2 from the user.

We know from glfw discussion, fcitx4 and fcitx5 uses different protocol.
(fcitx5==ibus)

My question is what is the correct value for SDL_IM_MODULE which works with Debian's
sdl2 and DOTA's sdl2?.

ibus --> no setting for SDL_IM_MODULE
fcitx (fcitx4) --> SDL_IM_MODULE=fcitx
fcitx5 --> SDL_IM_MODULE=fcitx5 or SDL_IM_MODULE=ibus


Please propose your patch and explain your setting

Regards,

Osamu

Shengjing Zhu

unread,
Mar 29, 2022, 4:10:03 AM3/29/22
to
Just to answer the protocol part.

IMO, there are at least 4 protocols that fcitx5 supports.
+ fcitx5, at dbus org.fcitx.Fcitx-0
+ fcitx4, at dbus org.fcitx.Fcitx5
+ dbus, at dbus address org.freedesktop.portal.Fcitx
+ ibus, at dbus address org.freedesktop.portal.IBus

Both fcitx4 and fcitx5 have a dbus frontend, and they listen on the
same address.
sdl2 implements fcitx support with dbus frontend. So both fcitx4 and
fcitx5 support it.

For kitty, it only supports ibus, but it can also connect to fcitx5's
ibus frontend.
For sdl2, it supports ibus, so it can connect to fcitx5's ibus
frontend as well, but since there's native fcitx support, using fcitx
dbus frontend is preferred.

In conclusion,

For SDL_IM_MODULE

+ fcitx(fcitx4) --> SDL_IM_MODULE=fcitx
+ fcitx5 --> SDL_IM_MODULE=fcitx
+ ibus --> no setting
+ others --> no settings

--
Shengjing Zhu

Shengjing Zhu

unread,
Mar 29, 2022, 4:10:04 AM3/29/22
to
Typo: the bus address for fcitx4 and fcitx5 should be exchanged.

Osamu Aoki

unread,
Mar 29, 2022, 5:00:03 AM3/29/22
to
Hi,

> -----Original Message-----
> From: Shengjing Zhu <zh...@debian.org>
> To: Osamu Aoki <os...@debian.org>
> Cc: Gunnar Hjalmarsson <gunn...@debian.org>, 100...@bugs.debian.org
> Subject: Re: Bug#1008481: Add SDL_IM_MODULE to fcitx4 and fcitx5
> Date: Tue, 29 Mar 2022 16:00:32 +0800
>
> ...
> > In conclusion,
> >
> > For SDL_IM_MODULE
> >
> > + fcitx(fcitx4) --> SDL_IM_MODULE=fcitx
> > + fcitx5 --> SDL_IM_MODULE=fcitx
> > + ibus --> no setting
> > + others --> no settings

You did good home work. Impressed.

I am a bit confused what to do with closed patches.
https://salsa.debian.org/input-method-team/im-config/-/merge_requests/14

Does the INPUT_METHOD thing valid proposal ? I don't understand rationale for adding
yet-another-variable.

Can you provide best solution as PR or patch?

Thanks,

Osamu

wangtianzhu

unread,
Apr 6, 2022, 5:20:03 AM4/6/22
to

INPUT_METHOD have also been added in the patch.

INPUT_METHOD can be used to distinguish fcitx4 and fcitx5.

 

An environment variable INPUT_METHOD is required to tell which input method framework is currently used by other third-party input method.

wangtianzhu

unread,
Apr 6, 2022, 5:20:03 AM4/6/22
to

Gunnar Hjalmarsson

unread,
May 3, 2022, 2:40:03 PM5/3/22
to
On 2022-04-06 11:13, wangtianzhu wrote:
> INPUT_METHOD have also been added in the patch.
>
> INPUT_METHOD can be used to distinguish fcitx4 and fcitx5.

Please submit a separate bug about that. If you do, I think you need to
elaborate on the justification.

--
Rgds,
Gunnar Hjalmarsson

Shengjing Zhu

unread,
May 3, 2022, 3:20:05 PM5/3/22
to
Hi

On Wed, May 4, 2022 at 2:30 AM Gunnar Hjalmarsson
<nor...@salsa.debian.org> wrote:
>
> Control: tag -1 pending
>
> Hello,
>
> Bug #1008481 in im-config reported by you has been fixed in the
> Git repository and is awaiting an upload. You can see the commit
> message below and you can check the diff of the fix at:
>
> https://salsa.debian.org/input-method-team/im-config/-/commit/74f8b98e1b4bf7f699059840bc2857b9a9140e3d
>
> ------------------------------------------------------------------------
> Add SDL_IM_MODULE to fcitx4 and fcitx5
>
> Closes: #1008481

Thanks for moving forward.

I've been busy with life recently due to the lockdown in Shanghai.

--
Shengjing Zhu
0 new messages