Skip to content

Commit

Permalink
Merge pull request #45 from giucam/xkb
Browse files Browse the repository at this point in the history
Don't update the keymap every time a key is pressed
  • Loading branch information
giucam committed Sep 4, 2015
2 parents bf46e15 + df64c2e commit 9c385e1
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/compositor/wayland_wrapper/qwlkeyboard.cpp
Expand Up @@ -144,14 +144,13 @@ void Keyboard::setFocus(Surface* surface)
void Keyboard::setKeymap(const QWaylandKeymap &keymap)
{
m_keymap = keymap;
m_pendingKeymap = true;

// If there is no key currently pressed, update right away the keymap
// Otherwise, delay the update when keys are released
// see http://lists.freedesktop.org/archives/wayland-devel/2013-October/011395.html
if (m_keys.isEmpty()) {
updateKeymap();
} else {
m_pendingKeymap = true;
}
}

Expand Down Expand Up @@ -279,6 +278,11 @@ void Keyboard::updateModifierState(uint code, uint32_t state)

void Keyboard::updateKeymap()
{
// There must be no keys pressed when changing the keymap,
// see http://lists.freedesktop.org/archives/wayland-devel/2013-October/011395.html
if (!m_pendingKeymap || !m_keys.isEmpty())
return;

m_pendingKeymap = false;
#ifndef QT_NO_WAYLAND_XKB
createXKBKeymap();
Expand Down

0 comments on commit 9c385e1

Please sign in to comment.