1
1
Fork 0
mirror of https://github.com/swaywm/sway synced 2024-06-21 23:49:05 +02:00
Commit Graph

761 Commits

Author SHA1 Message Date
Simon Ser 7114030159 Add support for touch frame events
Update for the breaking change in [1].

[1]: https://github.com/swaywm/wlroots/pull/3001
2021-07-08 09:18:20 +02:00
Simon Ser 4832fc937f Update wlr_box includes
Update for the breaking change in [1].

[1]: https://github.com/swaywm/wlroots/pull/3011
2021-07-07 11:29:14 +02:00
Kenny Levinsen 80315217f7 input: Move get_current_time_msec in from util
get_current_time_msec is only used in cursor.c, so we can move it in and
make it static. This is primarily intended to avoid a symbol collision
with wlroots, which we unfortunately do not have a good solution for
yet.
2021-06-23 09:55:36 +02:00
tomKPZ f9a5c18c93 Add tab dragging functionality
Implements functionality described in [1].  Please see the issue for a
video with a demonstration of the new behavior.

An issue is that titlebars cover up a significant portion of the top
edge drop area.  The solution is simply to change the edge drop area
hitbox to start at the contents instead of the container.

[1] https://github.com/swaywm/sway/issues/6218
2021-05-06 00:24:55 -04:00
xdavidwu e5913f8106
Implement input method keyboard grab 2021-03-12 12:18:08 +01:00
lbonn c6e7cf1ae5 focus: beyond fullscreen when focused explicitly
When issuing a focus command on a specific container, users expect to
proceed it even if is hidden by a fullscreen window.

This matches the behavior of i3.
2021-02-25 09:40:20 -05:00
Simon Ser eea9c6331f Automatically map built-in touchscreens/tablets to built-in panels
Detect whether an output is built-in via its type. Detect whether
a touchscreen or tablet tool is built-in via its ID_PATH property.
2021-02-25 09:38:00 -05:00
Kenny Levinsen a047b5ee4a container: Move pending state to state struct
Pending state is currently inlined directly in the container struct,
while the current state is in a state struct. A side-effect of this is
that it is not immediately obvious that pending double-buffered state is
accessed, nor is it obvious what state is double-buffered.

Instead, use the state struct for both current and pending.
2021-02-16 22:05:00 -05:00
David96 28cadf5580 Add missing transaction commits to seatop_default
Every seat_set_focus* should be followed by a transaction_commit_dirty.
In cases where the focus change is followed by a seatop_begin* this is
not needed, as transaction_commit_dirty is then called by the
seatop_begin* function.

Fixes #6034
2021-02-16 09:35:48 -05:00
Tadeo Kondrak 42cbaf278c text_input: Add support for focusing layer-shell surfaces 2021-02-15 18:24:47 -05:00
Tadeo Kondrak c88f7ad1d0 text_input: Only send surrounding_text and content_type if supported 2021-02-15 16:45:35 -05:00
Tadeo Kondrak b0e8f4ade2 text_input: Ignore text_input disable from unfocused windows
Before this commit, there would be cases where focus changes from one
window to another, the new window activates text_input, then the old
window sends a deactivate request, making text_input unfocused
completely.
2021-02-15 16:44:15 -05:00
Kenny Levinsen 31a01bb80d input: Commit transactions in seatop_default
This is needed for focus_follows_mouse, and was accidentally omitted in
the previous transaction commit shuffle.
2021-02-15 13:49:47 -05:00
Kenny Levinsen b5b628cb41 input: Only commit transactions when necessary
There is no need to check for transactions at the end of every user
input, as the vast majority of input will not issue transactions. This
implementation can also hide where changes are made without an
appropriate transaction commit, as a future unrelated input would issue
the commit instead.

Instead, commit transactions in places where changes are made or are
likely to be made.
2021-02-14 13:19:08 -05:00
Andri Yngvason 9ef5cc03f1 input/seat: Reset command handler context in seat_destroy()
This fixes a dangling reference which causes a use-after-free.
2021-01-01 19:02:56 +01:00
Andri Yngvason e11bc058ac input/seat: Clean up focus_stack in seat_destroy()
This fixes use-after-free when seat_destroy() has been called.
2021-01-01 19:02:56 +01:00
Andri Yngvason 98eece53ad input: Clean up input_method_relay in seat_destoy()
This fixes a crash that happens when input_method_new or text_method_new
events are emitted after the seat has been freed.
2021-01-01 19:02:56 +01:00
Ronan Pigott ece6a1d408 Change workspace_layout to match i3 behavior
In i3, the workspace_layout command does not affect the
workspace layout. Instead, new workspace level containers
are wrapped in the desired layout and the workspace layout
always defaults to the output orientation.
2020-12-20 00:58:42 -05:00
Tudor Brindus cc2c0d5966 input/cursor: unhide cursor on synthetic input
Fixes #5847.
2020-12-06 09:38:49 +01:00
Brian Ashworth 9d6787d10d input/keyboard: fix Group# bindings for keyboard groups
The keyboard group's effective keyboard layout was never being changed
due to a condition that incorrectly preventing it from being performed.
The IPC event that follows the change was correctly being prevented.
2020-11-12 10:52:45 +01:00
Tudor Brindus 07042486c3 tree/container: introduce `container_is_sticky[_or_child]` functions
To query whether a container is sticky, checking `con->is_sticky` is
insufficient. `container_is_floating_or_child` must also return true;
this led to a lot of repetition.

This commit introduces `container_is_sticky[_or_child]` functions, and
switches all stickiness checks to use them. (Including ones where the
container is already known to be floating, for consistency.)
2020-11-11 20:43:58 -05:00
Simon Ser a56098a24e
Add missing includes for wlr_input_device.h
References: https://github.com/swaywm/wlroots/pull/2470
2020-11-11 15:40:50 +01:00
Simon Ser bb342ac5e6
Replace wlr_key_state with wl_keyboard_key_state
References: https://github.com/swaywm/wlroots/pull/2446
2020-11-11 11:00:55 +01:00
Tudor Brindus 0df5753aed input/seatop_default: consider fullscreen views to have no edges
Previously, `find_edge` on a single fullscreen view would occasionally
return an edge rather than `WLR_EDGE_NONE`. This would trigger entry
into `seatop_resize_tiling`, which doesn't have meaning for a fullscreen
view.

The result was that the fullscreen container hitbox was considered to be
that of where it'd be if it were tiling, so most clicks would not go
through.

Fixes #5792.
2020-11-05 12:25:15 +01:00
Tudor Brindus c523aa623b input: fully change focus when scrolling tabs/stacks
When scrolling on a tabbed/stacked container, i3 focuses its
inactive-focused focused child. Sway does the same, but then resets the
focus to whatever was focused previously.

Ref e5992eed16/src/click.c (L207-L219)
2020-11-01 04:05:38 -05:00
Tudor Brindus 60d95414d4 commands/focus: force container warp when fulfilling `focus mode_toggle`
This commit switches focusing behavior to force a warp when executing
`focus mode_toggle`.

Fixes #5772.
2020-11-01 03:43:00 -05:00
Tudor Brindus 8c12e71a66 input: remove motion deltas from seatop callbacks
Straightforward cleanup, they haven't been used for a while.
2020-10-31 23:15:32 +01:00
Tamir Zahavi-Brunner 96578aa91e hide_cursor: Add an option to hide when typing
Add an option for the `hide_cursor` command to hide the cursor when
typing, i.e. whenever a key is pressed.
2020-10-30 09:59:54 +01:00
Ronan Pigott 9e272a7986 tiling_resize: abandon resize if a sibling con dies 2020-10-20 20:23:50 +02:00
Ronan Pigott 33affb33d2 tiling_drag: emit window move ipc events 2020-10-18 21:56:35 +02:00
Ronan Pigott 5bcbc0b4a9 seat: use default output mapping if there is no input config 2020-10-16 18:34:09 +02:00
Tudor Brindus ed247c031c input/tablet: add tool_mode option to set tablet tools as relative input
Closes #4139.
2020-10-12 15:01:37 +02:00
Tudor Brindus 136add4e12 input/cursor: default tablet lens tool to relative motion
It is recommended that mouse and lens cursor tool default to relative
mode and all pen-like tools to absolute mode.

Refs
https://wayland.freedesktop.org/libinput/doc/1.11.3/tablet-support.html#tablet-relative-motion.
2020-10-12 15:01:37 +02:00
David96 c150177a94 Make focus_follows_mouse work when hovering a layer-shell surface on another output
Fixes #5668
2020-09-26 17:42:14 -04:00
Rouven Czerwinski 41999d7c9f cursor: update hide timer during config apply
We can't arm the timer during cursor creation since the config may not
be ready yet. Instead arm the timer while applying the input
configuration, by this time the configuration has been parsed and we can
arm the hide timer.

Fixes #5686
2020-09-16 07:53:57 +02:00
Rouven Czerwinski 299a159add cursor: arm cursor hide timer immediately
According to the wayland docs, wayland timers are disarmed on creation.
This leads to the cursor not being hidden if there is no activity after
creation, since the timer is armed on activity, but not at creation.
Arm the timer after creation to ensure the cursor is hidden even if
there is no cursor activity after creation.

Fixes #5684
2020-09-15 09:55:30 +02:00
Tudor Brindus 2efecc14ef input/pointer: update cursor activity after updating button counts
Otherwise, Sway will not re-hide a cursor after the last button has been
released.

Needed alongside afa890e to fix #5679.
2020-09-14 22:28:21 -04:00
Rouven Czerwinski afa890e8e9 input/cursor: reset event source after unhide
Reset the event source after unhiding the cursor, to ensure that the
timeout starts after showing the cursor. Also remove the open coded
variant in seat_consider_warp_to_focus().

Fixes #5679
2020-09-14 18:14:08 -04:00
Brian Ashworth 2ea5d2985a input/libinput: remove input type property bias
This changes it so all libinput config options are set on any device
that supports it. Previously, only a subset of libinput config options
were being considered depending on the input type. Instead of trying to
guess which properties the device may support, attempt to set any
configured property regardless of the device type. All of the functions
already have early returns in them for when the device does not actually
support the property. This brings the configuration side inline with
describe_libinput_device for the IPC side. This change was prompted
by a tablet tool showing the calibration matrix property in the IPC
message, but not being able to actually change it since that property
was only being considered for the touch input type.
2020-09-03 10:46:06 +02:00
Antonin Décimo bbf7b92fe4 Fix incorrect format specifiers 2020-07-30 22:02:42 -04:00
Tudor Brindus 6b9a9b6246 input/cursor: don't send wl_pointer.motion event on pointer unlock warp
On warping to a cursor hint, update the pointer position we track as
well, so that on the next pointer rebase we don't send an unexpected
synthetic motion event to clients.

Fixes #5405.
2020-07-15 19:40:09 +02:00
Ronan Pigott 39d677af15 input: implement xdg_toplevel interactive resize hints 2020-07-13 00:21:52 -04:00
Simon Ser 5432f00adf config/output: don't change output state before commit
Previously, we called output_disable prior to wlr_output_commit. This
mutates Sway's output state before the output commit actually succeeds.
This results in Sway's state getting out-of-sync with wlroots'.

An alternative fix [1] was to revert the changes made by output_disable
in case of failure. This is a little complicated. Instead, this patch
makes it so Sway's internal state is never changed before a successful
wlr_output commit.

We had two output flags: enabled and configured. However enabled was set
prior to the output becoming enabled, and was used to prevent the output
event handlers (specifically, the mode handler) from calling
apply_output_config again (infinite loop).

Rename enabled to enabling and use it exclusively for this purpose.
Rename configure to enabled, because that's what it really means.

[1]: https://github.com/swaywm/sway/pull/5521

Closes: https://github.com/swaywm/sway/issues/5483
2020-07-10 18:18:27 -04:00
Nick Diego Yamane e5954f321f seat/dnd: support null drag icon surfaces
As per the Wayland spec [1]:

> The icon surface is an optional (can be NULL) surface that provides an
> icon to be moved around with the cursor.

However, as of now Sway "start_drag" signal handler does not starts the
DND session unless a non-NULL drag icons is provided. This patch fixes
it by skipping handling of the drag icon if it is null.

Fixes #5509

[1] https://wayland.freedesktop.org/docs/html/apa.html#protocol-spec-wl_data_device

Signed-off-by: Nick Diego Yamane <nickdiego@igalia.com>
2020-07-07 00:05:35 +02:00
wb9688 17ff13fc84 Replace unprintable characters in input device id 2020-07-03 14:59:20 +02:00
Simon Ser dfccd2a4c4 Don't set xwayland cursor when wlr_xwayland failed
This causes a NULL pointer dereference.
2020-07-02 23:55:56 -04:00
Simon Ser 1bfbf262cc seat: fix segfault in sway_input_method_relay_set_focus
sway_input_method_relay_set_focus was called before
sway_input_method_relay_init.

Closes: https://github.com/swaywm/sway/issues/5503
2020-07-02 17:11:05 -04:00
Kenny Levinsen 492267a5d6 seat: Refocus seat when wlr_drag is destroyed
wlr_drag installs grabs for the full duration of the drag, leading to
the drag target not being focused when the drag ends. This leads to
unexpected focus behavior, especially for the keyboard which requires
toggling focus away and back to set.

We can only fix the focus once the grabs are released, so refocus the
seat when the wlr_drag destroy event is received.

Closes: https://github.com/swaywm/sway/issues/5116
2020-06-30 13:27:51 +02:00
Tudor Brindus c822427091 input/pointer: correctly handle bindings for synthetic events
This commit addresses a regression introduced in 8fa74ad.

Fixes #5481.
2020-06-25 21:32:15 +02:00
Tudor Brindus 2270b4c213 input/seat: don't notify keyboard grabs with NULL surface on shutdown
Fixes #5469, a minor regression introduced in #5368.
2020-06-19 18:46:01 +02:00
Tudor Brindus b3f08597cd input: disable events for map_to_output devices when output not present
Fixes #3449.
2020-06-19 10:02:22 +02:00
Tudor Brindus d328c2439c input/pointer: don't trigger pointer bindings for emulated input
Prior to this commit, a tablet device could trigger mouse button down
bindings if the pen was pressed on a surface that didn't bind tablet
handlers -- but it wouldn't if the surface did bind tablet handlers.

We should expose consistent behavior to users so that they don't have to
care about emulated vs. non-emulated input, so stop triggering bindings
for any non-pointer devices.
2020-06-18 22:35:01 +02:00
Tudor Brindus 82c439c4f1 input/cursor: send idle events based off device type, not input type
Previously, a tablet or touch device could report activity as a pointer
device if it went through pointer emulation. This commit refactors idle
sources to be consistently reported based on the type of the device that
generated an input event, and now how that input event is being
processed.
2020-06-18 22:35:01 +02:00
Tudor Brindus 8fa74add82 input/pointer: don't trigger pointer bindings for emulated input
Prior to this commit, a tablet device could trigger mouse button down
bindings if the pen was pressed on a surface that didn't bind tablet
handlers -- but it wouldn't if the surface did bind tablet handlers.

We should expose consistent behavior to users so that they don't have to
care about emulated vs. non-emulated input, so stop triggering bindings
for any non-pointer devices.
2020-06-16 19:21:55 +02:00
Tudor Brindus 20deb8ec16 input/tablet: focus appropriate node on tip down
This commit makes tablet input more usable when `focus_follows_mouse` is
set to `no`.

Previously, tapping down on surfaces that bound tablet input would not
switch focus, whereas tapping on surfaces that didn't (and hence went
through pointer emulation) did.
2020-06-16 17:58:13 +02:00
Brian Ashworth 33aa59d4c6 input/keyboard: wlr_keyboard_group enter and leave
This adds support for wlr_keyboard_group's enter and leave events. The
enter event just updates the keyboard's state. The leave event updates
the keyboard's state and if the surface was notified of a press event
for any of the keycodes, it is refocused so that it can pick up the
current keyboard state without triggering any keybinds.
2020-06-16 17:53:23 +02:00
Tudor Brindus 14e887bc3d input: tweak resize behavior to not change tab focus on border click
If a resize is triggered on a tabbed or stacked container, change focus
to the tab which already had inactive focus, rather than to the tab
whose border was clicked -- otherwise, we'd change the active tab when
the user probably just wanted to resize.
2020-06-08 18:23:09 -04:00
Tudor Brindus ce494a5811 input/tablet: allow moving tiling tablet v2 surfaces by pen input
Closes #5293.
2020-06-07 10:46:14 +02:00
Tudor Brindus 7dec1f8398 input/tablet: allow moving floating tablet v2 surfaces by pen input
Refs #5293.
2020-06-07 10:46:14 +02:00
Tudor Brindus 53dc83fb68 tree/container: introduce `container_toplevel_ancestor` helper
This allows us to not have to explicitly write the same while loop
everywhere.
2020-06-07 10:46:14 +02:00
Tudor Brindus d7900c6e5e common/util: fix `get_current_time_msec` returning microseconds
This commit makes `get_current_time_msec` correctly return milliseconds
as opposed to microseconds. It also considers the value of `tv_sec`, so
we don't lose occasionally go back in time by one second. Finally, the
function is moved into `util.c` so that it can be reused elsewhere
without having to consider these pitfalls.
2020-06-06 13:38:41 +02:00
Thomas Hebb 84ec8f92a6 Use new wlroots API for clearing keyboard/pointer focus during grabs
We are not allowed to do what we did in #5222 and pass a `NULL` surface
wlr_seat_pointer_notify_enter(), and it's causing crashes when an
xdg-shell popup is active (see #5294 and swaywm/wlroots#2161).

Instead, solve #5220 using the new wlroots API introduced in
swaywm/wlroots#2217.
2020-06-05 17:24:23 +02:00
Tudor Brindus f7e050c58f input/cursor: refactor tablet tool tip events into seatops
This commit moves tool tip event generation into seatops. In doing so,
some corner cases where we'd erroneously (but likely harmlessly)
generate both tablet and pointer events simultaneously are eliminated.
2020-06-04 10:20:32 +02:00
Tudor Brindus 6da1631090 input/cursor: rename `simulated_tool_tip_down` to be more accurate
This is a tiny cleanup commit that renames `simulated_tool_tip_down` to
`simulating_pointer_from_tool_tip`, making it match
`simulating_pointer_from_touch`.

This is a better name since it makes it clear that it's the *pointer*
that's being simulated, not the tool tip.
2020-05-29 08:44:56 +02:00
Tudor Brindus 6ea45395c7 input/pointer: send pointer enter event on confine warp
The spec has this to say about sending events on confine creation:

  Whenever the confinement is activated, it is guaranteed that the
surface the pointer is confined to will already have received pointer
focus and that the pointer will be within the region passed to the
request creating this object.

...and on region update:

  If warped, a wl_pointer.motion event will be emitted, but no
wp_relative_pointer.relative_motion event.

Prior to this patch, sway did neither, and updated the hardware cursor
position without notifying the underlying surface until the next motion
event. This led to inconsistent results, especially in applications that
draw their own software cursor.
2020-05-28 09:44:00 +02:00
Tudor Brindus d71fed95da input/cursor: keep reference to cursor in constraint
set_region accepts a NULL *data, so we can't use it to reference the
constraint and find the cursor through its seat.

Fixes #5386.
2020-05-26 16:24:52 +02:00
Tudor Brindus 34e0cad9ac input/cursor: fix heap-buffer overflow in constraint set_region
Fixes #5383, caused by an oversight in 6f0a0bd.
2020-05-25 21:30:53 +02:00
Tudor Brindus 5d13f647f9 input/tablet: add seatop_down entry for tablet input
Currently, when tablet input exits a window during an implicit grab, it
passes focus to another window.

For instance, this is problematic when trying to drag a scrollbar, and
exiting the window &mdash; the scrollbar motion stops. Additionally,
without `focus_follows_mouse no`, the tablet passes focus to whatever
surface it goes over regardless of if there is an active implicit.

If the tablet is over a surface that does not bind tablet handlers, sway
will fall back to pointer emulation, and all of this works fine. It
probably should have consistent behavior between emulated and
not-emulated input, though.

This commit adds a condition for entering seatop_down when a tablet's
tool tip goes down, and exiting when it goes up. Since events won't be
routed through seatop_default, this prevents windows losing focus during
implicit grabs.

Closes #5302.
2020-05-25 10:01:00 +02:00
Tudor Brindus 6f0a0bd385 input/pointer: only warp cursor when the confine region has changed
Refs #5268.
2020-05-21 10:45:08 +02:00
Brian Ashworth 5c32a48453 input: fix reloading crash due to keyboard group configuring
Keyboard group keyboards should not call sway_keyboard_configure. They
do not have an input config and they derive their state from the
keyboards within the group.

For some reason, I got sway_keyboard_configure and
seat_configure_keyboard mixed up and thought seat_reset_device called
the latter.

Calling sway_keyboard_configure with a keyboard group's keyboard is not
supported and can cause issues. If any clients are listening to the ipc
input event, a sigsegv will occur due to not every property - such as
identifier - being wired up for keyboard group keyboard's.

This also adds an assertion to sway_keyboard_configure to ensure that
this does not occur in the future and any instances are quickly caught.
2020-05-19 15:42:32 -04:00
Brian Ashworth 975b8a90ad input: reset keyboard groups keyboard on reset all
If the keyboard that triggers the reload binding is using the default
keymap, default repeat delay, and default repeat rate, the associated
keyboard group is never being destroyed on reload. This was causing the
keyboard group's keyboard not to get disarmed and result in a
use-after-free in handle_keyboard_repeat.

If the keyboard was not using the defaults for all three settings, then
it's associated keyboard would get destroyed during the reset - which
did disarm the keyboard group's keyboard. In this case, the
use-after-free would not occur.

This adds a block to input_manager_reset_all_inputs that resets the
keyboard for all keyboard groups in all seats, which will disarm them.
Since the inputs are all being reset anyway, which will reset all
individual keyboards, it is not necessary to be selective on which ones
get reset.
2020-05-14 23:51:17 -04:00
Michael Weiser 0f11aa037a commands: Add per-view shortcuts_inhibitor command
Add a separate per-view shortcuts_inhibitor command that can be used
with criteria to override the per-seat defaults. This allows to e.g.
disable shortcuts inhibiting globally but enable it for specific,
known-good virtualization and remote desktop software or, alternatively,
to blacklist that one slightly broken piece of software that just
doesn't seem to get it right but insists on trying.

Add a flag to sway_view and handling logic in the input manager that
respects that flag if configured but falls back to per-seat config
otherwise. Add the actual command but with just enable and disable
subcommands since there's no value in duplicating the per-seat
activate/deactivate/toggle logic here. Split the inhibitor retrieval
helper in two so we can use the backend half in the command to retrieve
inhibitors for a specific surface and not just the currently focused
one. Extend the manual page with documentation of the command and
references to its per-seat sibling and usefulness with criteria.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2020-05-13 21:22:16 -04:00
David96 2473cac32c Implement pointer simulation if client hasn't bound to touch 2020-05-13 14:29:15 -04:00
Adam Kürthy 7a294b2668 Really fix floating window border resize problems
Fixes: https://github.com/swaywm/sway/pull/5250
2020-05-13 11:07:31 +02:00
Tudor Brindus 2262ae60f4 input/cursor: don't apply pointer constraint to emulated tablet input
Closes #5268.
2020-05-13 08:58:23 +02:00
Tudor Brindus 726d187d3c input/tablet: simplify parameter plumbing for tablet references
This is a small cleanup commit for removing `sway_tablet` parameters
from functions that already accept `sway_tablet_tool`, since the tablet
reference can be accessed through `tool->tablet`.
2020-05-10 16:49:35 +02:00
Tudor Brindus 7c37e9d01e input/keyboard: use wlr_keyboard_keymaps_match from wlroots
Added in swaywm/wlroots#2172, so that sway doesn't need to maintain
an independent copy of this function.
2020-05-08 17:48:43 -04:00
David96 e5fed6b246 Don't unhide cursor on touch events
Touch events hide the cursor so unhiding it again only causes it to
flicker.
2020-05-05 17:39:26 +02:00
Tudor Brindus 52bd6aecf2 input/cursor: remove erroneous cast for tablet tool button
The type expected by wlroots is uint32_t, which `event->button`
already is.
2020-05-02 21:16:21 +02:00
Tudor Brindus e262f93d0a input: rename pointer handlers to be unambiguous
This commit renames `motion` and `axis` handlers to `pointer_motion` and
`pointer_axis`, respectively, to disambiguate them from their tablet
(and future touch) handlers. `button` is left as-is, as it is generic
across input devices.
2020-05-02 18:28:06 +02:00
Tudor Brindus ae3ec745f8 input: refactor tablet motion into seatop handler
This commit moves tablet motion logic into a seatop handler.

As a side-effect of seatop implementations being able to receive
tablet motion events, fixes #5232.
2020-05-02 13:32:28 +02:00
Tudor Brindus 9362003cba input/cursor: disambiguate cursor functions from pointer functions 2020-05-02 13:32:28 +02:00
Tudor Brindus 0dc1863dce input/cursor: make cursor rebasing cursor type-agnostic
This commit refactors `cursor_rebase` into `cursor_update_image`, and
moves sending pointer events to the two existing call sites. This will
enable this code to be reused for tablets.

Refs #5232
2020-05-02 13:32:28 +02:00
Simon Ser 6021fc4a08 Fix invisible cursor on startup 2020-05-01 16:57:24 +02:00
Simon Ser f55de073c2 Don't assert the cursor theme loads
If it doesn't load, it's a runtime error, so we shouldn't use an
assertion.
2020-05-01 16:57:24 +02:00
Tudor Brindus 2913f39dcb input/cursor: release simulated tool tip button when over v2 surface
d88460f addressed sending v2 tool tip up when over a non-v2 surface.
This commit addresses the other direction.

Fixes #5230.
2020-05-01 11:00:49 +02:00
Nick Diego Yamane 091f580b7c input/seatop_default: properly notify pointer leave
Currently, clients receive wl_data_device::leave events only when the
pointer enters another surface, which leads to issues, such as #5220.
This happens because wlr_seat_pointer_notify_enter() is called when
handling motion events only for non-NULL surfaces.

Fixes #5220
2020-05-01 10:56:14 +02:00
Tudor Brindus a5c26e6a05 input/tablet: query tablet focused surface for cursor image check
`handle_tablet_tool_set_cursor` was copied from input/cursor.c's
`handle_request_set_cursor`, but the focused surface check was not
adjusted appropriately.

Fixes #5257.
2020-04-26 09:14:54 +02:00
Tudor Brindus d77247117c input/cursor: correctly transfer focus when using tablet pen
Fixes #4819.

This commit ensures that `seat_set_focus` is called to transfer focus
when a window is selected via a pen. Previously, it would race with
`node_at_coords`, and only properly transfer focus if its returned
`surface` was NULL.
2020-04-24 18:54:48 +02:00
Tudor Brindus 3de1a3958e config/output: reconfigure input devices on new output
Some input rules, like `map_to_output`, are dependent on a specific
screen being present. This currently does not work for hotplugged
outputs, or outputs that are processed after the input device is
initially probed.

This commit fixes both cases, by reconfiguring inputs on each output
addition.

Fixes #5231.
2020-04-24 18:51:22 +02:00
Adam Kürthy 65302093cf Take window borders into account when resizing floating windows
Otherwise the borders can be resized to smaller than the minimum window size.
2020-04-24 18:41:33 +02:00
Tudor Brindus 44b2d3ad81 input/cursor: fix hide cursor timeouts on tablets and touchscreens
This commit refactors `cursor_handle_activity` to also take the idle
source, so that it can be reused for tablet and touch activity.
Previously, the timeouts would be tracked, but the cursor would never be
un-hidden for anything but pointers.

Fixes #5169.
2020-04-22 17:30:08 +02:00
Tudor Brindus c23182fd7a input/cursor: fix jerky resizing of non-tablet_v2 surfaces
This fixes resizing containers being very jerky under pointer emulation.

Refs #5232.
2020-04-22 17:24:01 +02:00
Tudor Brindus d88460f716 input/cursor: correctly send tablet_v2 up event when over non-v2 surface
If we started holding the tool tip down on a surface that accepts tablet
v2, we should notify that surface if it gets released over a surface
that doesn't support v2.

Since GTK supports tablet v2, this fixes the common case of starting a
drag over a GTK surface (e.g. scrollbar) and releasing it outside (e.g.
over the gaps between sway containers, or in a terminal).

Refs #5230.
2020-04-22 17:22:40 +02:00
David96 2b15cf453e Don't transfer focus to NULL node on touch
Fixes #5185
2020-04-17 15:49:17 +02:00
Rouven Czerwinski 0efc28e2f5 input/seatop_default: release on empty workspace
Instead of handling presses and releases on empty workspaces as setting
focus to the workspace, handle releases by notifying the seat of a
pointer action. This way DnDs are correctly released if the button is
released over an empty workspace. This is achieved by removing the early
return and letting the handle_button() call seat_pointer_notify_button()
at the very end.

Fixes #3932
2020-04-15 13:40:38 +02:00
Di Ma 2bece94b9b Fix a use-after-free error in switch binding 2020-04-14 19:41:30 -04:00
Di Ma c1c2fe04bb Fix a use-after-free error in switch binding 2020-04-14 19:41:30 -04:00
Di Ma a3e574f63f Fix a use-after-free error in switch binding 2020-04-14 19:41:30 -04:00
Andri Yngvason b18d943442 input: keyboard: Never group virtual keyboards.
This fixes #5134
2020-04-14 12:07:24 +02:00