Commit Graph

122 Commits

Author SHA1 Message Date
Isaac Freund 252b2348bd
wlr_cursor: constify map to region box arguments 2022-02-05 16:32:38 +01:00
Kirill Primak 3cfe29b598 cursor: ensure mapping box is always initialized
Commit 498f30aad1 changed the logic of
get_mapping() in types/wlr_cursor.c to use updated version of
wlr_output_layout_get_box(). However, the case where c_device isn't NULL
but doesn't have output or geometry mappings wasn't handled properly,
resulting in leaving the output value uninitialized. This commit fixes
`c_device != NULL` branch by returning from the function only when a
mapping is found.

Fixes https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/3369
2022-01-31 21:00:20 +03:00
Kirill Primak ba6ba4b07a cursor: store mapped_box as value 2022-01-31 10:32:47 +00:00
Kirill Primak 498f30aad1 output-layout: make wlr_output_layout_get_box() take a box as parameter
Closes https://gitlab.freedesktop.org/wlroots/wlroots/-/issues/812
2022-01-31 10:32:47 +00:00
Jonathan Wong 0fb479ca61 Added whitespace between "output" and "(not" 2021-11-28 16:56:09 +00:00
José Expósito 4c3e307ec8 cursor: emit hold gesture events
Recevie the hold gesture events from the libinput or Wayland backends,
abstracted as pointer signals, and re-emit them from the cursor
interface.
2021-09-27 15:30:31 +02:00
Simon Ser 22fd411bc3 cursor: add touch frame event 2021-07-08 09:12:17 +02:00
Simon Zeni e192d87731 move wlr_box from /types to /util 2021-07-06 21:43:17 +02: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 ad28f57533 input/tablet: fix up updated axes after rotation
In the case that only one axis received an event, rotating the input can
cause the change to actually happen on the other axis, as far as clients
are concerned.

This commit updates the axes flags to be consistent post-rotation.

Fixes swaywm/sway#4776.
2020-04-27 18:34:09 +02:00
Manuel Stoeckl f22a5d1704 Fix output rotation direction
The Wayland protocol specifies output transform rotations to be
counterclockwise and applied to the surface. Previously, wlroots
copied Weston and incorrectly made rotations act clockwise on
surfaces. This commit fixes that.

This change will break compositors which expect transform rotations
to be clockwise, and the rare applications that make use of surface
transforms.
2020-02-17 21:43:05 +01:00
Ilia Bozhinov 480a31ea4e wlr_box: properly calculate closest point for non-positive area boxes
If box->width/height is <= 0, the box doesn't contain any points, and so
there is no closest point. wlr_box_closest_point should return NAN in this
case.

In addition, we need to handle empty boxes in a few other
output-layout-related places, because outputs can have size 0x0 when
they are created or destroyed.
2019-10-11 23:43:13 +03: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
Greg V 9fe8e37961 Implement the pointer-gestures-unstable-v1 protocol
This protocol relays touchpad gesture events produced by libinput to
supporting clients (e.g. Evince, Eye of GNOME).
2019-01-28 22:06:36 +01:00
emersion 5de26ad8ed
pointer: add a frame event
Frame events group logically connected pointer events. It makes sense to make
the backend responsible for sending frame events, since once the events are
split (ie. once the frame events are stripped) it's not easy to figure out
which events belongs to which frame again.

This is also how Weston handles frame events.

Fixes https://github.com/swaywm/wlroots/issues/1468
2019-01-26 11:04:05 +01:00
emersion dfdbc1f870
output-layout, cursor: fix duplicate cursors
wlr_cursor: make sure the output doesn't have a cursor before
creating a new one

wlr_output_layout: don't emit the "add" event when the output is
already in the layout
2018-10-19 14:50:35 +02:00
Las fa2e6e7d9d Implement pointer-constraints protocol in wlroots and rootston 2018-09-18 10:14:33 +02:00
Aidan Epstein e334b46b39
Fix uninitialized value in wlr_cursor. 2018-08-31 23:36:38 +00: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
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
emersion 7cbef15206
util: add wlr_ prefix to log symbols 2018-07-09 22:49:54 +01:00
Genki Sky d1cf9acbd5 cleanup: Use void for zero-parameter functions
Signed-off-by: Genki Sky <sky@genki.is>
2018-05-30 20:19:16 -04:00
Ivan Chebykin cec7cd2b39
Fix gcc maybe-uninitialized in wlr_cursor apply_output_transform 2018-05-04 18:41:51 +03:00
Guido Günther 4efae8c177 wlr_cursor: transform absolute coordinates
Honor output rotation when processing absolute coordinates. This fixes
touch events on rotated outputs.

Fixes #928
2018-05-03 11:09:14 +02:00
emersion 6e7c0b57f6
cursor: use NAN for unspecified axes, refactor absolute warping code 2018-04-28 09:24:38 +01:00
emersion 625a7a48dc
Don't use the wlr_ prefix for static functions 2018-04-25 23:51:00 +01:00
emersion bc0bfde5ee
cursor: allow to call wlr_cursor_wrap_absolute with zero 2018-04-24 19:46:29 +01: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 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
emersion f5507ec677
cursor: fix segfault when destroying a wlr_output_layout with a wlr_cursor attached 2018-01-22 09:29:52 +01:00
emersion 51db087210
Introduce fractional scaling 2017-12-15 01:00:03 +01:00
Tony Crisci e5a31ae870 wlr-seat: basic touch 2017-11-15 08:34:48 -05:00
emersion ac1573b0e7
Add scale parameter to wlr_cursor_set_image 2017-11-11 17:27:44 +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
emersion 7dc716a2bb
Fix memory leak in wlr_cursor 2017-10-31 14:58:58 +01:00
emersion 2c63aa2056
Destroy x11 output with backend 2017-10-31 14:21:12 +01:00
emersion 6a74a3586f
Fix wlr_cursor_destroy, handle device remove in examples/multi-cursor 2017-10-31 12:30:57 +01:00
emersion 044173d1df
Add multi-pointer example 2017-10-31 12:30:57 +01:00
emersion 4230a577cc
Remove wlr_cursor_set_xcursor for now 2017-10-31 12:30:56 +01:00
emersion 95566c6bdf
Transform cursor hotspot, fix wayland cursor hotspot 2017-10-31 12:30:56 +01:00
emersion 2e2d63a164
Manage wlr_output_cursor from wlr_cursor 2017-10-31 12:30:56 +01:00
emersion 1b6c729360
Add wlr_output_cursor 2017-10-31 12:30:03 +01:00
Versus Void 641d08ce7e Transform hotspot with cursor
Fix #188
2017-10-06 09:07:08 +03:00
Tony Crisci 6c24300d13 wlr_cursor_device create and destroy
Refactor wlr_cursor_device creation and destruction into their own functions.

Properly unsubscribe from signals in the wlr_cursor_device_destroy function.
2017-09-05 17:48:02 -04:00
Tony Crisci 57c18c38bb wlr_cursor: handle layout changes
Add the layout `destroy` and `change` events.

When a layout is destroyed, detach is from the wlr_cursor.

When a layout is changed, warp the cursor to the closest layout boundary.
2017-09-05 07:48:28 -04:00
Tony Crisci d9ab631f5d bugfix: set cursor coords on warp_unchecked 2017-08-29 12:48:45 -04:00
Tony Crisci b6031d1065 refactor wlr_output_layout_closest_point 2017-08-29 12:36:39 -04:00
Tony Crisci 9b65d0b3f0 refactor and rename wlr_geometry to wlr_box 2017-08-29 12:36:39 -04:00
Tony Crisci a51b76083e rename wlr_cursor_init to wlr_cursor_create 2017-08-29 12:36:39 -04:00
Tony Crisci 1fb8bc9340 wlr_cursor.c: fix formatting 2017-08-29 12:36:39 -04:00
Tony Crisci 4fbe322fa6 fix memory errors 2017-08-28 11:07:54 -04:00
Tony Crisci 5c845f14ed handle input device destroy 2017-08-28 10:29:53 -04:00
Tony Crisci df0ee7f25f implement tablet tool devices 2017-08-28 10:23:14 -04:00
Tony Crisci 0dc3aecfd4 refactor device mapping calculation 2017-08-27 20:10:46 -04:00
Tony Crisci 5e06d61e42 implement touch up and touch down 2017-08-27 17:35:12 -04:00
Tony Crisci ed126b0881 add touch events 2017-08-27 11:34:25 -04:00
Tony Crisci ac503a47a7 intersect cursor and device regions 2017-08-26 11:55:24 -04:00
Tony Crisci 0a97b68278 implement cursor and device geometry mapping 2017-08-26 08:32:11 -04:00
Tony Crisci 98f4cdfccb implement wlr_cursor_map_input_to_output 2017-08-26 08:32:11 -04:00
Tony Crisci 13e895d943 implement wlr_cursor_map_to_output 2017-08-26 08:32:11 -04:00
Tony Crisci a4810203cc change output layout coords to double type 2017-08-26 08:32:11 -04:00
Tony Crisci f69a7afd36 assert cursor layout for move and warp functions 2017-08-26 08:32:11 -04:00
Tony Crisci 0cba06dcef implement wlr_cursor_warp 2017-08-26 08:32:11 -04:00
Tony Crisci dd68f680e4 handle cursor to output edge cases 2017-08-26 08:32:11 -04:00
Tony Crisci 431e1ddeca smooth pointer transitioning between outputs 2017-08-26 08:32:11 -04:00
Tony Crisci 9978349903 use safe for_each when freeing cursor devices 2017-08-26 08:32:11 -04:00
Tony Crisci e3d47376dc add wlr_cursor basic implementation 2017-08-26 08:32:11 -04:00