xkbcommon / libxkbcommon

keymap handling library for toolkits and window systems
https://xkbcommon.org
Other
278 stars 124 forks source link

Suitable to replace libxkbfile and libxklavier? #283

Open hickford opened 2 years ago

hickford commented 2 years ago

Hi. I came across some older XKB libraries. Do you know any more about them? Is their functionality subsumed by libxkbcommon or libxkbregistry? Could they be replaced?

Here's a list of their reverse dependencies in Debian apt rdepends libxkbfile1 libxklavier16 | uniq

reverse dependencies in Debian #### libxkbfile1 * code * code-exploration * code-insiders * fcitx-module-x11 * fcitx5-config-qt * fcitx5-module-xorg * gnome-flashback * kde-config-fcitx * libcinnamon-desktop4 * libfreerdp2-2 * libinput-pad1 * libmutter-7-0 * libukwm-1-0 * libxkbfile-dev * libxklavier16 * onboard * plasma-desktop * remmina-plugin-nx * scim-kmfl-imengine * ukui-control-center * x11-apps * x11-utils * x11-xkb-utils * xpra #### libxklavier16 * cairo-dock-keyboard-indicator-plug-in * cinnamon-control-center * cinnamon-settings-daemon * gir1.2-xkl-1.0 * gkbd-capplet * gnome-screensaver * gxkb * libcaribou0 * libgnomekbd8 * libinput-pad1 * liblightdm-gobject-1-0 * libmatekbd4 * libxklavier-dev * mate-control-center * mate-screensaver * mate-settings-daemon * ukui-control-center * ukui-settings-daemon * xfce4-settings * xfce4-xkb-plugin
hickford commented 2 years ago

@whot I see you already made such a change in libgnome-desktop https://gitlab.gnome.org/GNOME/gnome-desktop/-/merge_requests/88

whot commented 2 years ago

A comment from my private notes on libxkbfile, prob from a few years back, it's not dated:

I originally looked into this to determine whether we can get rid of it, but the short answer is no, it's required by xkbcomp and the server for XKM reading. The server doesn't actually use the library itself, but it does need the XKM.h and XKMformat.h headers that are shipped by libxkbfile.

I guess both headers describe an ABI-stable format, so copying those headers to get rid of the dependency itself may be possible. But then you could argue - what's the point because any Xorg process will still require xkbcomp, so this really only helps the Xwayland case.

libxklavier can probably be replaced with libxkbregistry but I didn't look into the various callers, so I don't know the details.

edit: to answer your question more explicitly - "probably" but it would require someone to go through the callers and update each of them, which is a rather thankless job.

bluetech commented 2 years ago

Went through the libxkbfile1 reverse deps:

code, code-exploration, code-insiders

Has an open issue, probably can convert to using libxkbcommon with some effort.

fcitx-module-x11, fcitx5-config-qt, fcitx5-module-xorg, kde-config-fcitx

Going to assume by the names it's X11 support, not needed for Wayland.

gnome-flashback

Used here: https://gitlab.gnome.org/GNOME/gnome-flashback/-/blob/master/gnome-flashback/libinput-sources/gf-keyboard-manager.c Should use libxkbregistry + GTK/Compositor APIs?

libcinnamon-desktop4

https://github.com/linuxmint/cinnamon-desktop/blob/24e6eba969dd59ad8518c1f2db502027666e8644/libcinnamon-desktop/gnome-xkb-info.c

Looks like can use libxkbregistry.

libfreerdp2-2

https://github.com/FreeRDP/FreeRDP/blob/master/libfreerdp/locale/keyboard_xkbfile.c

Can use xkbcommon-x11 looks like.

libinput-pad1

https://github.com/fujiwarat/input-pad/blob/451db10570ef93b5d508653e9e0e471729453fb1/input-pad/geometry-gdk.c

Used XKB geometry, which xkbcomon does not support. No replacement currently.

libmutter-7-0

https://gitlab.gnome.org/GNOME/mutter/-/blob/main/src/backends/x11/cm/meta-backend-x11-cm.c Updates the X11 XKB keymap, not supported in xkbcommon so no replacement. Only used when X11/Xwayland is enabled, so should fix itself in time hopefully.

libukwm-1-0

https://github.com/ukui/ukwm/blob/9da46de1242d5eb0fa132a2e1ce4a63652d028bc/src/backends/x11/cm/meta-backend-x11-cm.c Looks like a fork/derivation of mutter, probably same situation.

onboard

On-screen keyboard. Project looks abandoned to me, use compositor-native replacement?

plasma-desktop

Can't find where it's used, Arch package doesn't depend on libxkbfile, maybe the dep was dropped?

remmina-plugin-nx

https://gitlab.com/Remmina/remmina-plugins/-/blob/main/plugins/nx/nx_plugin.c Can use xkbcommon-x11 probably, although the plugin is maybe legacy (what's nx anyway?)

scim-kmfl-imengine

Wasn't able to browse the source code, being on sourceforge I'm going to assume this project is dead.

ukui-control-center

https://github.com/ukui/ukui-control-center/blob/9f07714ffc27539648992d21f56088460ef3cc6d/plugins/devices/keyboard/preview/x11_helper.cpp https://github.com/ukui/ukui-control-center/blob/9f07714ffc27539648992d21f56088460ef3cc6d/plugins/devices/keyboard/preview/xkb_rules.cpp

Looks like old KDE code. Can use libxkbregistry for some stuff, didn't check it all.

x11-apps, x11-utils, x11-xkb-utils

X11 stuff...

xpra

https://github.com/Xpra-org/xpra/blob/185223dec12a0020726b5913ae8126c9cce84b07/xpra/x11/bindings/keyboard_bindings.pyx Probably no replacement.