]> git.proxmox.com Git - mirror_qemu.git/commit
kbd-state: add keyboard state tracker
authorGerd Hoffmann <kraxel@redhat.com>
Tue, 22 Jan 2019 09:28:07 +0000 (10:28 +0100)
committerGerd Hoffmann <kraxel@redhat.com>
Tue, 5 Feb 2019 09:45:44 +0000 (10:45 +0100)
commit47ddfab18a31b3bc0464893b1dc2ba6fcda41bf1
treeb023704f54130ace0cc1281887423015d91aa3bc
parent051a0cde7b0a0dda9eef166f9aecd09dfc0a00cf
kbd-state: add keyboard state tracker

Now that most user interfaces are using QKeyCodes it is easier to have
common keyboard code useable by all user interfaces.

This patch adds helper code to track the state of all keyboard keys,
using a bitmap indexed by QKeyCode.  Modifier state is tracked too,
as separate bitmap.  That makes checking modifier state easier.
Likewise we can easily apply special handling for capslock & numlock
(toggles on keypress) and ctrl + shift (we have two keys for that).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Message-id: 20190122092814.14919-2-kraxel@redhat.com

[ kraxel: added license boilerplate header ]

Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
include/ui/kbd-state.h [new file with mode: 0644]
ui/Makefile.objs
ui/kbd-state.c [new file with mode: 0644]