Comments (5)
Here is a patch to weston which makes it possible to reproduce there.
To reproduce, add the following to weston.ini, and apply the patch below. Pressing Super+space will switch between the layout groups in the configured keymap.
[keyboard]
keymap_layout=de,us
keymap_variant=neo,dvorak-alt-intl
diff --git a/desktop-shell/shell.c b/desktop-shell/shell.c
index 1f99efe3..c7a5e887 100644
--- a/desktop-shell/shell.c
+++ b/desktop-shell/shell.c
@@ -4599,6 +4599,20 @@ workspace_move_surface_down_binding(struct weston_keyboard *keyboard,
take_surface_to_workspace_by_seat(shell, keyboard->seat, new_index);
}
+static void
+keyboard_layout_next_index(struct weston_keyboard *keyboard,
+ uint32_t time, uint32_t key, void *data)
+{
+ struct desktop_shell *shell = data;
+ struct weston_seat *seat;
+
+ if (shell->locked)
+ return;
+
+ wl_list_for_each(seat, &shell->compositor->seat_list, link)
+ weston_seat_next_keymap_layout(seat);
+}
+
static void
shell_reposition_view_on_output_destroy(struct weston_view *view)
{
@@ -4924,6 +4938,10 @@ shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell)
workspace_move_surface_down_binding,
shell);
+ weston_compositor_add_key_binding(ec, KEY_SPACE, MODIFIER_SUPER,
+ keyboard_layout_next_index,
+ shell);
+
/* Add bindings for mod+F[1-6] for workspace 1 to 6. */
if (shell->workspaces.num > 1) {
num_workspace_bindings = shell->workspaces.num;
diff --git a/libweston/compositor.h b/libweston/compositor.h
index 8b2d2b06..f6a08af7 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -1742,6 +1742,8 @@ void
weston_seat_repick(struct weston_seat *seat);
void
weston_seat_update_keymap(struct weston_seat *seat, struct xkb_keymap *keymap);
+void
+weston_seat_next_keymap_layout(struct weston_seat *seat);
void
weston_seat_release(struct weston_seat *seat);
diff --git a/libweston/input.c b/libweston/input.c
index 81a94a92..b3998018 100644
--- a/libweston/input.c
+++ b/libweston/input.c
@@ -1933,6 +1933,42 @@ update_keymap(struct weston_seat *seat)
send_modifiers(resource, wl_display_get_serial(seat->compositor->wl_display), keyboard);
}
+WL_EXPORT void
+weston_seat_next_keymap_layout(struct weston_seat *seat)
+{
+ struct weston_keyboard *keyboard = weston_seat_get_keyboard(seat);
+ xkb_mod_mask_t latched_mods;
+ xkb_mod_mask_t locked_mods;
+ xkb_layout_index_t layout_index;
+ struct wl_resource *resource;
+
+ latched_mods = xkb_state_serialize_mods(keyboard->xkb_state.state,
+ XKB_STATE_MODS_LATCHED);
+ locked_mods = xkb_state_serialize_mods(keyboard->xkb_state.state,
+ XKB_STATE_MODS_LOCKED);
+ layout_index = xkb_state_serialize_group(keyboard->xkb_state.state,
+ XKB_STATE_EFFECTIVE);
+ layout_index = ((layout_index + 1) %
+ xkb_keymap_num_layouts(keyboard->xkb_info->keymap));
+
+ xkb_state_update_mask(keyboard->xkb_state.state,
+ 0, /* depressed */
+ latched_mods,
+ locked_mods,
+ 0, 0, layout_index);
+
+ notify_modifiers(seat, wl_display_next_serial(seat->compositor->wl_display));
+
+ wl_resource_for_each(resource, &keyboard->resource_list)
+ send_modifiers(resource,
+ wl_display_get_serial(seat->compositor->wl_display),
+ keyboard);
+ wl_resource_for_each(resource, &keyboard->focus_resource_list)
+ send_modifiers(resource,
+ wl_display_get_serial(seat->compositor->wl_display),
+ keyboard);
+}
+
WL_EXPORT void
notify_key(struct weston_seat *seat, uint32_t time, uint32_t key,
enum wl_keyboard_key_state state,
from libxkbcommon.
Instead of patching interactive-evdev, I used the following for the neo case:
sudo ./build/interactive-evdev -l de,de,us,us -v ,neo,dvorak-alt-intl, -o grp:menu_toggle
and used the menu
key to toggle, vs. the following for the dvorak-only case:
sudo ./build/interactive-evdev -l us -v dvorak-alt-intl
As you described, in the first case the output is
keysyms [ Control_L ] unicode [ ] layout [ German (0) ] level [ 0 ] mods [ ] leds [ Group 2 ]
keysyms [ Shift_L ] unicode [ ] layout [ German (0) ] level [ 0 ] mods [ Control ] leds [ Group 2 ]
keysyms [ C ] unicode [ � ] layout [ English (Dvorak alternative international no dead keys) (2) ] level [ 1 ] mods [ -Shift Control ] leds [ Group 2 ]
and in the second case,
keysyms [ Control_L ] unicode [ ] layout [ English (Dvorak alternative international no dead keys) (0) ] level [ 0 ] mods [ ] leds [ ]
keysyms [ Shift_L ] unicode [ ] layout [ English (Dvorak alternative international no dead keys) (0) ] level [ 0 ] mods [ Control ] leds [ ]
keysyms [ C ] unicode [ � ] layout [ English (Dvorak alternative international no dead keys) (0) ] level [ 1 ] mods [ -Shift Control ] leds [ ]
I assume what seemed odd to you in the first case is that the first and second lines say German (0)
rather than English (Dvorak alternative international no dead keys)
. This is however the expected behavior: country layouts normally only override the main alphanumeric keycodes, but do not touch the other keys. Thus, when you press e.g. Control_L
, it falls back to the first group which contains the base definitions.
The third line however, is similar in both.
So if looking just at the above, it seems like xkbcommon is working as expected. If you are able to debug the applications and see what exactly is the difference that makes the shortcuts fail, that would help. I might do it myself when I have time.
from libxkbcommon.
Closing per comment above; feel free to reopen if you think this is an xkbcommon issue.
from libxkbcommon.
Wouldn't say the issue is fixed, as AFAIK it still happens (in weston with the patch, mutter/gnome-shell etc). Did you ever get a chance to try the weston patch and reproduce the client-side issues?
from libxkbcommon.
Sorry, setting it up is a bit too much for me.
What would help is a set of (input, expected, actual) at a level closer to xkbcommon. The ones provided in the original descriptions don't look problematic to me, as I explained in a previous comment.
from libxkbcommon.
Related Issues (20)
- question: how to map from xcb key press/release event state field to xkb_mod_mask_t HOT 2
- Support for pointer keys? HOT 8
- no usable option to activate horizontal number keys on Azerty keyboard HOT 2
- ! include line in rules file does not require a newline HOT 1
- LatchGroup action is not supported
- Types parser allows type definitions with garbage
- xkb_keysym_from_name returns upper case keysym for case-insensitive match in a few cases HOT 4
- Set Caps Lock to non-toggling without assigning it to Shift key, or make "last used layout" shortcut HOT 9
- Compose key does not always work HOT 11
- Documentation on how to create/install custom layouts needed HOT 16
- ABI break in 1.6.0 HOT 2
- 1.7.0: test suite fails in two units HOT 6
- Using my custom keyboard layouts doesn't work as expected when using `grp:alt_space_toggle` or `grp:win_space_toggle` HOT 4
- How to read used keysyms/keycodes for each modifier_map HOT 7
- meson.build script broke detection of --version-script support in GNU ld, as NetBSD uses HOT 3
- support multiple actions for a key per level HOT 2
- Please increment minor DSO version
- Feature Request: Add Halmak Keyboard Layout HOT 1
- rules: setxkbmap deals with empty component differently
- Crash on "Show Keyboard Layout" on GNOME HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libxkbcommon.