Commit Graph

147 Commits

Author SHA1 Message Date
Markus Ongyerth 000b305ecc backend/libinput: Manage tablet tool livetimes
This adds the management code to manage tablet tools lifetimes from
libinput.
It follows the suggestion made in the tablet-unstable-v2.xml to destroy
tablet_tools once all tablets that it got into contact with were removed
from the system. This is implemented via a refcount.

If a tool is *not* unique, it will be destroyed on proximity out. This
is libinput specific and mentioned in libinput docs that tools will not
be found again, so we shouldn't keep a reference to them.
Also they can't be on other tablets as well, because they cannot be
tracked.

The naming in this commit is a bit off (to not break things).
The wlr names stay the same, tablet_tool is the libinput_device with
capaiblity LIBINPUT_DEVICE_CAP_TABLET_TOOL which is more akin to
"tablet" in the tablet-unstable-v2 protocol.
The struct that corresponds to the tablet_tool in tablet-unstable-v2 is
called tablet_tool_tool, a rename should be done at some point in the
future.
2018-07-14 09:40:39 +02:00
emersion 7cbef15206
util: add wlr_ prefix to log symbols 2018-07-09 22:49:54 +01:00
Scott Anderson 47985d2dc5 Multiseat fixes 2018-06-14 20:46:16 +12:00
emersion 0b58579564
Add support for discrete axis values 2018-05-12 13:34:58 +01:00
morganamilo 6305e6327f
Fix typos in comments and strings 2018-05-03 21:59:43 +01:00
emersion 2551ef8871
input-device: add output_name field, populate it from libinput 2018-04-29 14:30:09 +01:00
emersion 79da4c175e
backend/headless: remove useless destructor 2018-04-28 12:48:05 +01:00
emersion 625a7a48dc
Don't use the wlr_ prefix for static functions 2018-04-25 23:51:00 +01:00
emersion 71ca45e2c0
Make sure we don't use others' prefixes 2018-04-25 23:24:58 +01:00
emersion b0d99f5c67
Remove wlr_ prefix from local symbols 2018-04-25 23:00:46 +01:00
Drew DeVault 56deff41b6 Implement input inhibit in rootston 2018-04-03 15:09:53 -04:00
Drew DeVault ac219cbda6 Remove width_mm from tablet events 2018-03-28 12:05:37 -04:00
Drew DeVault 324b9d910d Remove width_mm from wlr_touch events 2018-03-28 11:04:40 -04:00
Drew DeVault a35a5786b0 Remove width_mm from wlr_pointer events 2018-03-28 10:46:50 -04:00
Drew DeVault bfc0e95d2c Add mode support to libinput backend
And extend tablet example with tilt and ring support
2018-03-07 20:57:55 -05:00
Scott Anderson 3c9fc7c68e Add const to x11 and input interfaces 2018-03-06 21:16:18 +13:00
Dan Robertson 99e6cba3c3
Fix null deref in wlr_libinput_backend_destroy
If input_event is null (e.g. if backend_start has not been called yet)
wl_event_source_remove will result in a null deref.
2018-02-25 02:26:56 +00: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
Scott Anderson f27c0b44b8 Remove usec_to_msec from public API 2018-02-19 10:43:25 +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 10ecf871f2
Remove wlr_backend.events.{output_remove,device_remove} 2018-02-12 10:36:43 +01:00
emersion 5e58d46cc1
Add wlr_signal_emit_safe 2018-02-12 09:12:31 +01:00
emersion babdd6ccf7
backend: fix use-after-free when destroying backends
The backend destroy signal is emitted before the output_remove
signal is. When the destroy signal is emitted listeners remove
their output_remove listener, so the output_remove signal is never
received and listeners have an invalid output pointer.

The correct way to solve this would be to remove the output_remove
signal completely and use the wlr_output.events.destroy signal
instead. This isn't yet possible because wl_signal_emit is unsafe
and listeners cannot be removed in listeners.
2018-01-30 19:45:57 +01:00
Dominique Martinet 3e228b0b2a libinput backend: add wlr_input_device_is_libinput 2017-12-19 20:13:49 +01:00
emersion 9d43adaafa
Listen to display destroy in backends 2017-12-07 23:44:59 +01:00
emersion 016744ef4d
Refactor wlr_list inside wlroots 2017-11-19 00:17:40 +01:00
Tony Crisci f61986e8db rename touch slot to touch id 2017-11-16 17:53:52 -05:00
emersion bb79ada49f
Fix a bunch of mistakes detected with scan-build 2017-11-16 10:30:54 +01:00
Drew DeVault 6d8e1abfc0 Improve input sensitivity
We now use doubles until the last minute, which makes it so we can move
the pointer more precisely. This also includes a fix for tablet tools,
which move absolutely and sometimes do not update the X or Y axis.
2017-11-04 01:35:12 -04:00
Dominique Martinet b53db8c39e libinput backend destroy: fix small leak 2017-11-01 21:14:23 +01:00
Dominique Martinet 43cd3c7aea Indentation fix
Some space sneaked in. tabtabtab.
2017-11-01 20:14:52 +01:00
Dominique Martinet e3ee2cd9c7 rootston exit: fix libinput destroy
The wlr_list -> wl_list rework changed 'wlr_devices' to
wl_list, but missed its use on destroy.
2017-11-01 19:37:35 +01:00
Tony Crisci 875a5b446f remove time usec 2017-10-30 15:43:06 -04:00
Tony Crisci a224e74fad refactor input time_sec to time_msec 2017-10-30 06:40:06 -04:00
Drew DeVault c5fff08f8a Forgot to rename these 2017-10-22 10:56:40 -04:00
Drew DeVault 169b68b17c Rename remaining refs to wlr_list 2017-10-21 22:02:36 -04:00
Heghedus Razvan e1f196a3e9 Replace list_t with wl_list for wlr_input_device
Signed-off-by: Heghedus Razvan <heghedus.razvan@gmail.com>
2017-10-20 11:50:43 +03:00
D.B 7cdc19d57f Fix duplicated pointer axis events
In pointer.c, some axis event was emitted even if the event pointer did not have
current axis.

In X11 backend pointer scroll events seem to be composed of both BUTTON_PRESS
and BUTTON_RELEASE. Therefore we should skip one of them (RELEASE) to avoid
event duplication.
2017-10-14 07:29:23 +02:00
Versus Void 568b270cdf Use xkb_state_update_mask() with Wayland backend
Fix #158
2017-10-06 22:02:29 +00:00
Tony Crisci 0f56326cb8 fix libinput wlr-keyboard use after free 2017-09-28 20:29:26 -04:00
Drew DeVault 61e451ea1b Move keyboard logic to wlr_{keyboard,seat} 2017-09-24 14:12:56 -04:00
Drew DeVault 6daf9e9ab2 Merge pull request #120 from acrisci/feature/wlr-cursor
wlr_cursor
2017-08-29 12:12:18 -05:00
Tony Crisci df0ee7f25f implement tablet tool devices 2017-08-28 10:23:14 -04:00
Tony Crisci c914697676 add device to touch events 2017-08-27 11:44:55 -04:00
Tony Crisci 98f4cdfccb implement wlr_cursor_map_input_to_output 2017-08-26 08:32:11 -04:00
Scott Anderson fb93628bda Merge wlr_udev into wlr_session 2017-08-26 14:02:04 +12:00
Dominique Martinet 12782eabfe libinput: wl_event_source_remove on destroy 2017-08-19 08:33:31 +02:00
Drew DeVault beb84940cf Improve no device detection support 2017-08-16 07:24:46 -04:00
Drew DeVault 3ac10a81bd Merge pull request #94 from martinetd/libinput_no_device
libinput: fail if no input found on init
2017-08-16 07:22:36 -04:00
Calvin Lee 901c14c409 Prevent alloc errors from crashing in `list_t`
This commit changes the `list_t` api so that alloc errors can be
detected and worked around. Also fixes errors not found in 5cc7342
2017-08-16 09:23:21 +02:00
Dominique Martinet 880c239657 libinput: fail if no input found on init
This runs through events pending at init on initialization so we can
tell if some devices are available.

Note that with the way wlr_device_lists is managed, this checks that
there is at least one device we handle - it doesn't have to be a
keyboard, but there is at least a mouse or tablet_pad or something
that we care about.

Instead of failing inconditionally it might be better to leave the
decision to the user, e.g. add a "backend_has_devices" function to
call later.

(Tested by moving /dev/input off)

Fixes #24.
2017-08-16 09:18:12 +02:00
Drew DeVault 27c13d621d Merge pull request #88 from 4e554c4c/alloc_crashing
Prevent alloc errors from crashing
2017-08-15 12:21:58 -04:00
Calvin Lee 5cc7342606 Prevent alloc errors from crashing
Resolves #76
2017-08-15 08:04:57 +02:00
nyorain f998bb8299 Fix style issues 2017-08-14 17:09:56 +02:00
Dominique Martinet ba20d5b3ca Refactor out wlr_touch_state 2017-08-14 16:22:31 +02:00
Dominique Martinet bd67849c03 Refactor out wlr_tablet_tool_state 2017-08-14 16:22:31 +02:00
Dominique Martinet a289940bff Refactor out wlr_tablet_pad_state 2017-08-14 16:22:31 +02:00
Dominique Martinet 53e7bebd23 Refactor out wlr_pointer_state 2017-08-14 16:22:31 +02:00
Dominique Martinet 0a3246ad97 Refactor out wlr_keyboard_state 2017-08-14 16:22:31 +02:00
Dominique Martinet e6ad67911b Refactor out wlr_input_device_state 2017-08-14 16:22:31 +02:00
Calvin Lee de66bdb867 Add backend detection functions
Resolves #80
2017-08-13 23:08:33 +02:00
Drew DeVault 4386816889 wlr_backend_init -> wlr_backend_start
Also renames create to init. We'll use create for anything that
allocates and init for anything that takes a pointer and initializes it.
2017-08-13 10:19:57 -04:00
Dominique Martinet 5c82d2f5c3 libinput backend: massive renaming
- 'libinput' (backend's) to libinput_context
- 'device' (libinput_device) to libinput_dev
- 'dev' (wlr_device) to wlr_dev
- 'devices' lists tangling of libinput devices to wlr_devices
- 'devices' list of wlr_devices in backend state to wlr_device_lists
2017-08-13 08:18:05 +02:00
Dominique Martinet 08a2afdf6f libinput backend: match logging for removal and add
Only log removal of devices once, but also log it for devices
that we do not care about.
2017-08-13 08:09:11 +02:00
Dominique Martinet 701e147b9b libinput: remove useless get_context call
That function is literally just "return event->device->seat->libinput"
We do not use context, so do not fetch it.
2017-08-13 08:07:44 +02:00
Drew DeVault 60d1131df2 Re-enable backend autoselection 2017-08-12 19:56:55 -04:00
Drew DeVault c95a108d2f Update libinput backend with new state design 2017-08-12 13:51:47 -04:00
Dominique Martinet 3e2cb5b5cf libinput: fix segfault when handling non-wlr device removal 2017-08-12 15:13:29 +02:00
Dominique Martinet de86965174 Use libinput_event_destroy/xkb_*_unref
Also sneak in a missing drmModeFreePlaneResources
2017-08-12 00:11:18 +02:00
Dominique Martinet e1293a7853 libinput: signal input remove on libinput backend destroy
This lets the upper crust cleanup and free their own states
2017-08-12 00:11:18 +02:00
Dominique Martinet be3a0ad065 libinput backend: fill in handle_device_removed
And fix input_remove_notify accordingly
2017-08-12 00:11:18 +02:00
Dominique Martinet c42674bc25 Fix libinput destroy for devices with multiple capabilities 2017-08-11 21:02:40 +02:00
Dominique Martinet 0354aaeff2 Complete a few destroy functions
This adds missing free calls for:
 - drm outputs
 - libinput backend in general
 - final udev free
 - output mode state
2017-08-11 19:17:03 +02:00
Dominique Martinet 0663b6d1e1 Build libinput events on the stack instead of allocating 2017-08-11 18:38:27 +02:00
Scott Anderson cb4d50e22c Changed header paths. 2017-08-06 13:25:26 +12:00
Drew DeVault 3d71969b2a Make event names consistent 2017-06-21 14:07:09 -04: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
Scott Anderson 55854565dc Fixed VT switching 2017-06-21 13:31:29 +12:00
Drew DeVault 632a04f1b7 Implement keyboard LEDs 2017-06-19 15:15:37 -04:00
Drew DeVault ecb04afcad Implement tablet pads 2017-06-19 14:49:07 -04:00
Drew DeVault def3d7c64f Add tablet example 2017-06-15 16:15:12 -04:00
Drew DeVault 4a9966b1a4 Implement wlr_tablet_tool 2017-06-15 14:32:53 -04:00
Drew DeVault 3f24f8a1be Flesh out touch events and add demo 2017-06-14 14:50:09 -04:00
Drew DeVault d6905f86cb Allocate wlr_touch devices 2017-06-14 11:40:03 -04:00
Drew DeVault a63230e59c Implement libinput wlr_pointer 2017-06-13 11:05:45 -04:00
Drew DeVault 5dd96c0772 Incorporate XKBCommon into example 2017-06-13 08:10:36 -04:00
Drew DeVault 508d135de7 Only allocate device state when it will be used
This design also avoids double frees in the future when we're creating
several wlr_input_devices from one libinput_device.
2017-06-13 08:10:36 -04:00
Drew DeVault 7a5f35b5bb Reassign ownership of libinput handle 2017-06-13 08:10:36 -04:00
Drew DeVault f479b7c8c7 Split keyboard code out into its own file 2017-06-13 08:10:36 -04:00
Drew DeVault 59ceaf507e Handle key presses 2017-06-13 08:10:36 -04:00
Drew DeVault 0e75d157f5 Initialize keyboards from libinput 2017-06-13 08:10:36 -04:00
Drew DeVault 019fff06be Fix issues, flesh out event handling somewhat 2017-06-13 08:10:36 -04:00
Drew DeVault af69591e62 Add error handling and init in backend_autocreate 2017-06-13 08:10:36 -04:00
Drew DeVault 1262f1400c Initial pass on libinput backend 2017-06-13 08:10:22 -04:00