Commit Graph

52 Commits

Author SHA1 Message Date
Simon Ser 5888c96da8 tablet: stop using wlr_list 2021-07-01 10:35:39 -04:00
Justus Rossmeier b9e9e0e133 tablet_v2: Fix implicit grab end detection
Store the previously focused surface in `state->focused` as well as in
`state->original` when starting an implicit grab. That way at the end
of an implicit grab, the detection whether the grab started and ended
on the same surface works as intended, even if the original surface was
never left at all.
2021-02-07 19:49:33 -05:00
Manuel Stoeckl a290d7a78d Make implementation function lists static const
This requires a change to the type of `struct wlr_tablet` and
`wlr_tablet_init` signature, both of which are part of the unstable API.
2021-02-05 10:04:20 +01:00
Isaac Freund e06c9e43af Remove unneeded includes from wlr_input_device.h
This uncovered many places where we were using things without directly
including them.
2020-11-11 15:40:47 +01:00
Tudor Brindus c9c31f803e util/time: de-duplicate `timespec_to_msec` 2020-06-06 00:09:19 +02:00
Simon Ser 1a23c1425f Add comments for missing tablet tool entries
And stop using default cases, so that we know which parts of the code
need an update when adding a new enum entry.

Closes: https://github.com/swaywm/wlroots/issues/2208
2020-05-28 15:13:05 +02:00
Simon Ser 781ed1ff02 Fix -Wreturn-type warnings
When calling assert(0) instead of returning a value, -Wreturn-type
warnings are triggered because assertions can be disabled. Replace these
assertions with abort().
2020-05-19 14:54:02 +02:00
Tudor Brindus 7693fdb8a7 tablet: expose wlr_tablet_tool_v2_has_implicit_grab function
This is necessary so that sway can determine when to start emulating
pointer events -- it shouldn't start doing so during an implicit grab,
even if the pen is over a surface that doesn't bind tablet input.

Refs swaywm/sway#5302.
2020-05-14 18:45:19 +02:00
Tudor Brindus 74c0d03f00 tablet: pass motion events to implicitly grabbed surface
Refs swaywm/sway#5302.
2020-05-14 18:45:19 +02:00
Simon Ser 22d345d982
Remove .swp file added by mistake
Fixes: d698334620 ("input/tablet: clear focused surface on surface destroy")
2020-04-30 13:19:46 +02:00
Tudor Brindus d698334620 input/tablet: clear focused surface on surface destroy
Otherwise, we can end up left with a dangling pointer to a
previously-focused, now-destroyed surface.

Fixes swaywm/sway#5264.
2020-04-30 12:08:42 +02:00
myfreeweb 774548696c Send tablet tool frame on proximity_out
Fixes GTK application crashes
2019-12-18 13:23:07 -05:00
Simon Ser 5cde35923c Simplify globals implementation by removing destructors
Some globals are static and it doesn't make sense to destroy them before
the wl_display. For instance, wl_compositor should be created before the
display is started and shouldn't be destroyed.

For these globals, we can simplify the code by removing the destructor
and stop keeping track of wl_resources (these will be destroyed with the
wl_display by libwayland).
2019-11-25 09:01:46 -05:00
György Kurucz b81bb2ef30 Fix heap-use-after-free in wlr_send_tablet_v2_tablet_pad_leave
See swaywm/sway#4660
2019-10-27 19:01:16 +01:00
Markus Ongyerth 57babd2e13 Move initialization of wlr_tablet_pad into types/wlr_tablet_pad 2019-09-26 19:41:19 +03:00
Drew DeVault 94f65e354d Add libinput-1.14 support
This libinput version adds a new tablet tool type.
2019-08-11 19:39:47 +09:00
Simon Ser ca45f4490c Remove all wayland-server.h includes
The documentation for wayland-server.h says:

> Use of this header file is discouraged. Prefer including
> wayland-server-core.h instead, which does not include the server protocol
> header and as such only defines the library PI, excluding the deprecated API
> below.

Replacing wayland-server.h with wayland-server-core.h allows us to drop the
WL_HIDE_DEPRECATED declaration.
2019-07-27 15:49:32 -04:00
Manuel Stoeckl 1ef0c03a46 wlr_tablet_v2: Register event serials 2019-06-30 15:01:05 -04:00
Markus Ongyerth 09b2833dcd send proximity_out in proximity in for tablet_v2
When the proximity_in event is sent for tablet_v2 and there's already a
surface that currently has tablet (tool) focus, it should be told that
this is no longer the case, so we need to send the proximity_out event.
2019-03-31 20:16:03 +03:00
Stuart Dilts 08454adada types/meson.build: Add compile args for libinput to lib_wlr_types (#1636)
* Add compile args for libinput to lib_wlr_types

Fixes the build on openSUSE Tumbleweed

* Remove libinput include from wlr_tablet_v2.c

+ libinput isn't used in the file
+ Also remove libinput dependency from types/meson.build
2019-03-27 19:31:20 +02:00
Markus Ongyerth fc9838b15e Prevent NULL dereference in tablet_tool handler
In case a tool was removed, but not yet destroyed by the client, the
tool_client's tool can be NULL. We have to check that as well in the
set_cursor handler to prevent using inert resources
2019-02-19 08:51:10 +01:00
emersion 0fafab87e3
Fix a few typos 2019-01-10 09:30:14 +01:00
emersion 3ca7ca5306
tablet-v2: fix wlr_tablet_seat_v2 leak 2018-12-04 20:06:38 +01:00
emersion 89ec624f81
tablet-v2: fix segfault on display destroy 2018-11-12 20:05:13 +01:00
emersion a9e02a9ea6 tablet-v2: fix memory leak on OOM, fix resource version 2018-10-13 11:01:38 +02:00
emersion 769a8e9917
Merge pull request #1160 from Ongy/tablet-grabs
Tablet grabs
2018-09-12 19:01:50 +02:00
Markus Ongyerth 21e1cc9ab4 Implement feedback 2018-09-08 19:17:44 +02:00
emersion d22431d969
Merge pull request #1228 from arandomhuman/misc-mem
Miscellaneous memory leak fixes
2018-09-03 08:26:59 +02:00
random human 9f511ae942
Remove listener link after tablet_manager destroy 2018-09-03 05:05:18 +05:30
random human 568b0ffe2c
Call wl_global_create first in case of failure 2018-09-03 02:43:55 +05:30
cnt0 6946134883 fix incorrect NULL check 2018-09-02 20:48:18 +02:00
random human 8589ae19de Fix bugs listed by clang's static analyzer
A few pedantic changes and unused variables (1-4), and genuine bugs (5,
6).

The reports with the corresponding files and lines numbers are as
follows.

1. backend/libinput/tablet_pad.c@31,44,57
"Allocator sizeof operand mismatch"
"Result of 'calloc' is converted to a pointer of type 'unsigned int',
which is incompatible with sizeof operand type 'int'"

2. types/tablet_v2/wlr_tablet_v2_pad.c@371
"Allocator sizeof operand mismatch"
"Result of 'calloc' is converted to a pointer of type 'uint32_t', which
is incompatible with sizeof operand type 'int'"

3. types/wlr_cursor.c@335
"Dead initialization"
"Value stored to 'dx'/'dy' during its initialization is never read"

4. rootston/xdg_shell.c@510
"Dead initialization"
"Value stored to 'desktop' during its initialization is never read"

5. types/tablet_v2/wlr_tablet_v2_pad.c@475
"Dereference of null pointer"
"Access to field 'strips' results in a dereference of a null pointer
(loaded from field 'current_client')"

The boolean logic was incorrect (c.f. the check in the following
function).

6. examples/idle.c@163,174,182
"Uninitialized argument value"
"1st function call argument is an uninitialized value"

If close_timeout != 0, but simulate_activity_timeout >= close_timeout,
the program would segfault at pthread_cancel(t1).
2018-08-31 19:41:18 +02:00
Alexander Bakker 221d412824 Init the new destroy signals added by #1200 2018-08-27 18:21:36 +02:00
Alexander Bakker 20db29779e Add destroy signals to types that are destroyed by wl_display_destroy 2018-08-26 23:23:12 +02:00
Markus Ongyerth 3ad7b146eb Fix typos/order in tablet-v2 2018-08-06 08:45:44 +02:00
Markus Ongyerth f64962ace8 tablet-v2 tool: Implement implicit grab
Implement the tablet-v2 tablet tool's implicit grab semantics for
buttons and tip.

This avoids losing focus (to other [sub]surfaces) when a button is held,
or the tip is down.
This should help when the device is used close to a surface's border and
would otherwise have to be very precise.
2018-08-06 08:45:41 +02:00
Markus Ongyerth d5950255de tablet-v2 tablet_tool grab implementation
Implement the basic logic for tablet-v2 tablet_tool's grabs. And plug in
the default grab.
2018-07-23 10:08:10 +02:00
Drew DeVault 4b096fc114 Revert "Merge pull request #1153 from emersion/include-config"
This reverts commit ef0a6ea4d2, reversing
changes made to 8d03bc9178.
2018-07-21 09:44:20 -04:00
emersion 41094a7df5 Always include config.h 2018-07-21 13:08:23 +01:00
Markus Ongyerth 454f2a84a8 tablet-v2 tablet_pad grab implementation
Implement the basic logic for tablet-v2 tablet_pad's grabs. And plug in
the default grab.
Features like "holding" the focus should be implemented via grabs, like
they are for pointer and keyboard.
2018-07-19 11:35:00 +02:00
Markus Ongyerth 9a6f77fc2c tablet-v2: fix merge commits and test again
There were a few issues after rebase, that the merge algorithm didn't
throw at my face:

wlr_output did a check on the actual role, not a string anymore, so that
had to go to allow tablet-v2 to set cursor surfaces.
A few L_DEBUG/L_ERRORs were still around
There was a user-after-free in tablet-group free()ing, probably after
insufficient testing from a previous feedback pass
2018-07-14 10:29:22 +02:00
Markus Ongyerth 74ca2f8fcf Another round of feedback from acrisci 2018-07-14 09:52:34 +02:00
Markus Ongyerth 43b20bfea2 First feedback pass from acrisci 2018-07-14 09:52:05 +02:00
Markus Ongyerth d9e978e1b3 rename wlr_tablet_tool to wlr_tablet
The previous naming was based on the input-device capability names from
libinput.
With code that uses the libinput_tablet_tool and mapping into tablet-v2,
this is confusing, so the name is changed to follow the names used in
the protocol.
2018-07-14 09:49:58 +02:00
Markus Ongyerth 101080a382 Another feedback pass 2018-07-14 09:48:57 +02:00
Markus Ongyerth 6b51f3b57a use previous resource versions and destroy pads 2018-07-14 09:48:57 +02:00
Markus Ongyerth 503f9d6e52 emersion feedback
Introduce TABLET_MANAGER_VERSION and remove the wlr_tablet_tool_tool.c
2018-07-14 09:48:57 +02:00
Markus Ongyerth 2bc09d91c3 Silent conversion from double to int should be illegal 2018-07-14 09:48:57 +02:00
Markus Ongyerth dc525a9c5f Clean up serial handling and automate proximity acompaning events 2018-07-14 09:48:57 +02:00
Markus Ongyerth 25c2808153 Clean up serial handling 2018-07-14 09:48:57 +02:00