Commit Graph

49 Commits

Author SHA1 Message Date
random human 40a43003a1
Send unique keymap file descriptors
To prevent wl_keyboard keymap being written to by clients, use a unique
file descriptor for each wl_keyboard resource.

Reference: weston, commit 76829fc4eaea329d2a525c3978271e13bd76c078
2018-09-18 13:58:36 +05:30
Markus Ongyerth 74ca2f8fcf Another round of feedback from acrisci 2018-07-14 09:52:34 +02:00
emersion 7cbef15206
util: add wlr_ prefix to log symbols 2018-07-09 22:49:54 +01:00
Dominique Martinet efef54ccf5 wlr_keyboard: fix mmap leak + logic on close for keymap_fd
mmap leak found through static analysis
2018-06-30 11:38:21 +09:00
emersion f8e0a03451
backend/x11: correctly destroy input devices 2018-04-28 12:55:36 +01:00
emersion 79da4c175e
backend/headless: remove useless destructor 2018-04-28 12:48:05 +01:00
Markus Ongyerth c8ccb1bef3 reorder xkb state handling in wlr_keyboard
wlr_keyboard manages the xkb-common state of the compositor.
It used to update the state, update the modifiers, then notify the
compositor.
When [Shift_L] was pressed and released, this resulted in an event chain:
  Modifiers: Shift
  Key: Shift_L (Pressed)

  Modifiers:
  Key: Shift_L (Release)

The xkb-docs state that the state should be updated *after* the key was
handled [1], to prevent the new state from influencing the actual key
generated.

To achieve this, the event to the compositor is emitted, *before*
wlroots handles the xkb and internal keyboard state.

With this patch applied, the emitted events ill be:
  Modifiers:
  Key: Shift_L (Pressed)

  Modifiers: Shift
  Key: Shift_L (Release)

[1] https://xkbcommon.org/doc/current/group__state.html#gac554aa20743a621692c1a744a05e06ce
2018-04-18 11:54:59 +02:00
Drew DeVault 1d9be89e2d
Revert "ELF Visibility" 2018-02-19 18:01:27 -05:00
Scott Anderson 86269052eb Explicitly export EFL symbols 2018-02-19 14:26:40 +13:00
emersion c2e1474010
Reformat all #include directives 2018-02-12 21:29:23 +01:00
emersion 36ead80cd1
Make wlr_signal_emit_safe private 2018-02-12 19:52:47 +01:00
emersion 5e58d46cc1
Add wlr_signal_emit_safe 2018-02-12 09:12:31 +01:00
Guido Günther 1633b8d793 wlr_keyboard: use correct printf format string for keymap_size
keymap_size is a size_t. Otherwise the build fails on arm like

../types/wlr_keyboard.c: In function 'wlr_keyboard_set_keymap':
../include/wlr/util/log.h:34:17: error: format '%lu' expects argument of type 'long unsigned int', but argument 5 has type 'size_t {aka unsigned int}' [-Werror=format=]
  _wlr_log(verb, "[%s:%d] " fmt, _strip_path(__FILE__), __LINE__, ##__VA_ARGS__)
                 ^
../types/wlr_keyboard.c:218:3: note: in expansion of macro 'wlr_log'
   wlr_log(L_ERROR, "creating a keymap file for %lu bytes failed", kb->keymap_size);
   ^~~~~~~
../types/wlr_keyboard.c:218:50: note: format string is defined here
   wlr_log(L_ERROR, "creating a keymap file for %lu bytes failed", kb->keymap_size);
                                                ~~^
                                                %u
2018-01-27 12:23:26 +01:00
Tony Crisci b6f29e87e8 dont use pointer for modifiers 2018-01-17 08:31:15 -05:00
Tony Crisci 9765232096 update xkb state on layout change 2018-01-06 09:36:57 -05:00
Tony Crisci ca0f456d6c wlr-keyboard set layout error handling 2018-01-06 09:06:19 -05:00
Tony Crisci 0ef2df21f2 compositor modifier hook 2018-01-05 07:00:50 -05:00
Tony Crisci e8b810ce3e keep track of number of keycodes pressed 2017-12-27 18:58:43 -05:00
Tony Crisci c838679393 fix memory leaks 2017-12-18 14:53:24 -05:00
Tony Crisci 20327d82cb Merge branch 'master' into keyboard-fixes 2017-12-18 10:04:27 -05:00
Tony Crisci 37c83d5c6d misc keyboard fixes 2017-12-18 09:59:59 -05:00
emersion 2c31cac116
Do not segfault when loading an unknown keymap 2017-12-18 15:11:05 +01:00
emersion a3c0f97810
Make keyboard repeat info configurable 2017-12-08 17:03:05 +01:00
emersion bb79ada49f
Fix a bunch of mistakes detected with scan-build 2017-11-16 10:30:54 +01:00
emersion 84d5e6bbb4
Send current keyboard state when entering a surface 2017-11-08 10:57:46 +01:00
Drew DeVault 2272f3d47c Don't segfault wlr_keyboard when no xkb state 2017-10-11 22:45:39 -04:00
Versus Void 568b270cdf Use xkb_state_update_mask() with Wayland backend
Fix #158
2017-10-06 22:02:29 +00:00
Drew DeVault 5f3c56de28 Merge pull request #184 from emersion/rootston-keys
Keyboard modifiers
2017-10-03 10:36:16 -04:00
emersion 521e893528
Add modifiers signal, remove wlr_keyboard_update_modifiers 2017-10-03 14:03:26 +02:00
emersion d71344bcdd
Fix modifiers support with backend != wayland 2017-10-03 09:15:48 +02:00
emersion d3d9aca40c
Add modifiers support in wayland backend, parse modifiers in rootston config 2017-10-03 08:46:11 +02:00
emersion 3a8fdebaaa
Fix modifiers handling, add wlr_keyboard_get_modifiers 2017-10-03 08:46:11 +02:00
emersion 2fccff16eb
Begin modifiers support 2017-10-03 08:46:11 +02:00
Versus Void 2207d616c9 Free xkb structures on wlr_keyboard destroy 2017-10-03 08:34:30 +03:00
Tony Crisci 0f56326cb8 fix libinput wlr-keyboard use after free 2017-09-28 20:29:26 -04:00
Drew DeVault 906a816abf Fix rootston keyboard, add Xwayland 2017-09-28 08:54:57 -04:00
Drew DeVault 1ddda91b1b Fix broken keyboard handling 2017-09-25 16:44:26 -04:00
Drew DeVault e6a6634bc5 Minor tweaks to (broken) keyboard support 2017-09-25 08:47:00 -04:00
Drew DeVault 61e451ea1b Move keyboard logic to wlr_{keyboard,seat} 2017-09-24 14:12:56 -04:00
Markus Ongyerth 935b6d871e fixes use after free caused by signal lists
A structs throughout the code use implementation specific free
functions.
When those functions are not used, they simply call free() on their
data, but this leaves around wl_signals linked into listeners.
When those listeners try to remove themself from the list, they write
into the now free memory.

This commit adds calls to remove the signals from those lists, so the
listeners can safely call wl_list_remove
2017-09-08 16:02:26 +02:00
nyorain aa20634309 Simplify input device destruction code 2017-08-14 18:23:20 +02:00
nyorain f998bb8299 Fix style issues 2017-08-14 17:09:56 +02:00
Dominique Martinet 0a3246ad97 Refactor out wlr_keyboard_state 2017-08-14 16:22:31 +02:00
Drew DeVault f4453d104d Reorganize wlr-common 2017-06-21 12:10:07 -04:00
Drew DeVault fd91244e83 Update everyone to use new headers 2017-06-21 10:27:45 -04:00
Drew DeVault 632a04f1b7 Implement keyboard LEDs 2017-06-19 15:15:37 -04:00
Drew DeVault d6905f86cb Allocate wlr_touch devices 2017-06-14 11:40:03 -04:00
Drew DeVault 5dd96c0772 Incorporate XKBCommon into example 2017-06-13 08:10:36 -04:00
Drew DeVault 0e75d157f5 Initialize keyboards from libinput 2017-06-13 08:10:36 -04:00