Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clx: display-keyboard-mappings: spurious caching of the mappings #53

Closed
dkochmanski opened this issue Sep 17, 2016 · 2 comments
Closed

Comments

@dkochmanski
Copy link
Member

Steps to reproduce:

  1. Set keyboard layout to English before starting lisp
    setxkbmap -layout us
  2. Start any application using clx (for instance climacs)
(eval-when (:load-toplevel :compile-toplevel :execute)
  (ql:quickload 'climacs))
(climacs:climacs)
  1. Type a few characters in climacs (layout is qwerty)
  2. Change layout from the console
    setxkbmap -layout fr
  3. Type a few more characters in climacs (layout is still qwerty)

How to fix:

diff --git a/translate.lisp b/translate.lisp
index 0b0d7a8..64bc183 100644
--- a/translate.lisp
+++ b/translate.lisp
@@ -279,8 +279,7 @@
 (defun display-keyboard-mapping (display)
   (declare (type display display))
   (declare (clx-values (simple-array keysym (display-max-keycode keysyms-per-keycode))))
-  (or (display-keysym-mapping display)
-      (setf (display-keysym-mapping display) (keyboard-mapping display))))
+  (setf (display-keysym-mapping display) (keyboard-mapping display)))

 (defun keycode->keysym (display keycode keysym-index)
   (declare (type display display)

Fix proposed in: McCLIM/McCLIM#35

dkochmanski added a commit that referenced this issue Sep 17, 2016
Keyboard-mapping may change during the runtime, but CLX doesn't pick
that changes. Fixes #53.
@PuercoPop
Copy link
Contributor

I've been thinking about what would be the ideal solution, CLX would provide two classes for display, the vanilla and the cached-keysyms-display. The user of CLX could decide with which version to start the connection. However due to CLX's design, that favors minimizing the round trips doing this would require heavy modifications to the code base. A more workable solution would be to document the problem in the manual and provide example code of how to handle the keyboard layout changing notify-event in the client code.

Thoughts?

@dkochmanski
Copy link
Member Author

This is correct behavior, McCLIM handles it correctly and stumpwm does as well. See closed wip fix (last comment) for explanation, why we don't want to handle this in clx (#54).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants