sharplispers / clx

a fork of crhodes' fork of danb's fork of the CLX library, an X11 client for Common Lisp
Other
116 stars 46 forks source link

Ongoing efforts to use XmlXcb? #185

Open lycheese opened 3 years ago

lycheese commented 3 years ago

I recently tried out stumpwm and discovered that neither ISO_Level3_Shift nor ISO_Level5_Shift work properly (which I need to for example to type a question mark; I am using the bone keyboard layout).

After a short research trip I discovered that clx does not completely implement xkeyboard and saw a point on cliki that an opportunity to contribute would be to use XmlXcb as a basis but I was unable to find any ongoing projects that I could contribute to.

Did I miss any projects? If there are currently none, any tips where I would start?

dkochmanski commented 3 years ago

I'm not aware of any project doing that; however, we have discussed it on #clim IRC channel in the past.

The gist of the idea is that xcb project maintains a set of xml files that describe in detail X11 protocols; in principle it is possible to load these xml files and generate clx request definitions automatically (mind, that clx has a certain abstraction for working with the buffer and defining requests - you may see i.e how the render extension is implemented by hand).

So that would be basically a macro that converts something like this (this format is made up, I didn't check xcb nor clx atm):

<protocol name='keyboard'>
  <request name='do_something'>
    <arg name='param_1' type='integer_32' />
    <arg name='param_2' type='string' />
  </request>
</protocol>

Into something like

(defpackage #:clx/keyboard
  (:use #:cl #:xlib)
  (:export #:do-something))
(in-package #:clx/keyboard)

(define-extension "KEYBOARD")

(defun do-something (display arg1 arg2)
  (with-buffer-request (display display)
    (integer32 arg1)
    (string arg2)))

mind that there are probably many details that need to be worked out (you may learn them when you dig into xcb-xml format and clx abstractions).

JMC-design commented 3 years ago

Unfortunately, as I've mentioned before, it is not a simple matter of changing from one format to another. Large events need to be properly supported, 64 bit fields supported(trivial, already done in my branch), support for both regular events and large events under the same event numbers. You basically need to completely change how clx handles events. As for xkb specifically, I don't know about level 5, but you should be able to detect shift levels client side using compatibility maps. I've mentioned this before and there was no response and I've since forgotten the information as there didn't seem to be any interest.

lycheese commented 3 years ago

@dkochmanski thank you for the example.

@JMC-design ISO_Level3_Shift -- as far as I can tell -- is its own self-inserting button in clx and allows -- like you said -- working around the problem with a compatibility map. ISO_Level5_Shift however shows up as NIL and is lost in stumpwm bindings (it still works in graphical programs though; I guess stumpwm only intercepts bindings after C-t and graphical programs just use libxkbcommon?).

Thank you both for taking the time to respond this. I will try out a few things and look into xmlxcb more. Would it be okay to ask eventual questions here or is there a better place?

dkochmanski commented 3 years ago

Yes, this place is fine.

Wysłano z aplikacji ProtonMail

-------- Oryginalna wiadomość -------- ‎ 27 kwi 2021, 19:24, Elia Nolz napisał(a):

@.***(https://github.com/dkochmanski) thank you for the example.

@JMC-design ISO_Level3_Shift -- as far as I can tell -- is its own self-inserting button in clx and allows -- like you said -- working around the problem with a compatibility map. ISO_Level5_Shift however shows up as NIL and is lost in stumpwm bindings (it still works in graphical programs though; I guess stumpwm only intercepts bindings after C-t and graphical programs just use libxkbcommon?).

Thank you both for taking the time to respond this. I will try out a few things and look into xmlxcb more. Would it be okay to ask eventual questions here or is there a better place?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

fabian-thomas commented 1 year ago

@lycheese Did you get any further with this? I wanna try out StumpWM but currently I can't since I can't even type simple lisp expressions into eval because my keyboard layout (neo2) has parens on a layer using ISO_Level3_Shift.

lycheese commented 1 year ago

@fabian-thomas No, I sadly did not have the time to pursue this and had to switch to Wayland shortly after due to some new requirements.