ibus / ibus

Intelligent Input Bus for Linux/Unix
https://github.com/ibus/ibus/wiki
GNU Lesser General Public License v2.1
868 stars 180 forks source link

ibus-setup: Support running without GdkX11 (Wayland-only systems) #2374

Open Arfrever opened 2 years ago

Arfrever commented 2 years ago

https://github.com/ibus/ibus/blob/e465011b48cbaca4f18a65cf7b23a1035cf6b105/setup/main.py#L45

Usage of GdkX11 is scarce, only in one function. Maybe it is possible to work without GdkX11 available, e.g. by skipping some code. GTK 4 (#2373) provides introspection modules GdkWayland and GdkX11, but it is not clear to me if the equivalent functionality is provided by GdkWayland.

fujiwarat commented 2 years ago

GdkX11 is needed for IBUS_SETUP_XID environment variable which is used by each engine setup dialog to make the modal dialog between different PIDs. gnome-control-center also exports GNOME_CONTROL_CENTER_XID between g-c-c and engine setup dialog. https://wiki.gnome.org/AllanDay/IMEGuidelines

Probably we cannot get window IDs of the different PIDs in Wayland so we could just skip the code.

jtojnar commented 2 years ago

GNOME Control Center (GTK 4 app) supports that on Wayland too. Though it needs two separate code paths:

https://gitlab.gnome.org/GNOME/gnome-control-center/-/blob/2641f68fccb70b6d482d85ab463f7e5636572b60/panels/online-accounts/cc-online-accounts-panel.c#L453-476

The child process then also needs to handle both backends separately:

https://gitlab.gnome.org/GNOME/gnome-control-center/-/blob/2641f68fccb70b6d482d85ab463f7e5636572b60/panels/online-accounts/gnome-control-center-goa-helper.c#L111-169

Arfrever commented 2 years ago

So it would appear that names of some Wayland-specific functions are:

And when ibus-setup is ported to GTK 4, doing the desired thing in Wayland environment may be possible...