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

How to get raw event? #179

Closed C-Entropy closed 3 years ago

C-Entropy commented 3 years ago

I have to forward event to another x client, how do I get the raw envet? For example, the xcb_key_press_event_t, I try to generate it using

(event-case (display)
      ((:key-press) (window code x y state time root root-x root-y child same-screen-p)
       (parse-fun (list window code x y state time root root-x root-y child same-screen-p)))
      )

But I don't know how to get uint16_t sequence; and xcb_window_t event;

Harleqin commented 3 years ago

Would be nice to leave a solution or comment for closing, for anyone having a similar question later.

C-Entropy commented 3 years ago

Here is my sloution to get key-press and key-release:

      ((:key-release) (window sequence code x y state time root root-x root-y child same-screen-p)
      (list 3 code sequence time root window child  root-x root-y x y state same-screen-p)))

      ((:key-press) (window sequence code x y state time root root-x root-y child same-screen-p)
       (list 2 code sequence time root window child  root-x root-y x y state same-screen-p)));;you may find the order of them from xlib/xorg document.

and then convert the list to corresponding binary. It is kind of silly, I think the be better solution is to dig into source code of clx, but for me, this can work.

If you have better solutions, please let me know.