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

ipc: add an input event #4342

Merged
merged 2 commits into from
Jul 23, 2019
Merged

ipc: add an input event #4342

merged 2 commits into from
Jul 23, 2019

Conversation

RedSoxFan
Copy link
Member

@RedSoxFan RedSoxFan commented Jul 17, 2019

Closes #4334

This adds an ipc event related to input devices. Currently the
following changes are supported:

  • added: when an input device becomes available
  • removed: when an input device is no longer available
  • xkb_keymap_changed: (keyboards only) the keymap changed
  • xkb_layout_changed: (keyboards only) the effective layout changed
  • libinput_config_changed: (libinput devices only) a libinput config option changed

@RedSoxFan
Copy link
Member Author

This is ready for review. I kept the input::xkb_config_changed event in a separate commit since it includes a major refactor of the libinput config management code.

sway/sway-ipc.7.scd Outdated Show resolved Hide resolved
This adds an ipc event related to input devices. Currently the
following changes are supported:
- added: when an input device becomes available
- removed: when an input device is no longer available
- xkb_keymap_changed: (keyboards only) the keymap changed
- xkb_layout_changed: (keyboards only) the effective layout changed
This adds a libinput_config change type to the input event for when
the libinput config for a device changes

In order for this to be possible to track, the libinput config code
had to be refactored. It is now extracted into a separate file to
isolate it from the rest of the input management code.
@@ -1371,6 +1371,9 @@ available:
|- 0x80000014
: bar_status_update
: Send when the visibility of a bar should change due to a modifier
|- 0x80000015
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since i3 won't implement such an event, it may be wise to leave 0x80000015 for a future i3 event, and choose a much higher event code.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bar_status_update is also Sway specific. I just added this one right after. Should they both be changed?

@@ -603,8 +608,23 @@ void sway_keyboard_configure(struct sway_keyboard *keyboard) {
}
}

bool keymap_changed = false;
bool effective_layout_changed = keyboard->effective_layout != 0;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, not sure I understand the logic here...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, nevermind. It's the effective layout that gets reset.

However if the keymap changed the effective layout changes too, even if effective_layout is still zero. The effective layout depends on the keymap.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, but if the effective layout is 0 before and after, then either the entire keymap changed or the keymap is identical and there is no change to the effective layout. See #4343 for a follow-up for this

Copy link
Member

@emersion emersion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, those two comments are just me being confused. This LGTM, thanks!

@emersion emersion merged commit 1a16262 into swaywm:master Jul 23, 2019
@RedSoxFan RedSoxFan deleted the ipc-event-input branch July 23, 2019 18:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Allow subscribing to xkb layout changes
2 participants