aboutsummaryrefslogtreecommitdiffstats
path: root/sway/input/cursor.c
Commit message (Collapse)AuthorAge
* input/tablet: simplify parameter plumbing for tablet referencesLibravatar Tudor Brindus2020-05-10
| | | | | | 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`.
* Don't unhide cursor on touch eventsLibravatar David962020-05-05
| | | | | Touch events hide the cursor so unhiding it again only causes it to flicker.
* input/cursor: remove erroneous cast for tablet tool buttonLibravatar Tudor Brindus2020-05-02
| | | | | The type expected by wlroots is uint32_t, which `event->button` already is.
* input: rename pointer handlers to be unambiguousLibravatar Tudor Brindus2020-05-02
| | | | | | | 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.
* input: refactor tablet motion into seatop handlerLibravatar Tudor Brindus2020-05-02
| | | | | | | 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.
* input/cursor: disambiguate cursor functions from pointer functionsLibravatar Tudor Brindus2020-05-02
|
* input/cursor: make cursor rebasing cursor type-agnosticLibravatar Tudor Brindus2020-05-02
| | | | | | | | 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
* input/cursor: release simulated tool tip button when over v2 surfaceLibravatar Tudor Brindus2020-05-01
| | | | | | | d88460f addressed sending v2 tool tip up when over a non-v2 surface. This commit addresses the other direction. Fixes #5230.
* input/cursor: correctly transfer focus when using tablet penLibravatar Tudor Brindus2020-04-24
| | | | | | | | | 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.
* input/cursor: fix hide cursor timeouts on tablets and touchscreensLibravatar Tudor Brindus2020-04-22
| | | | | | | | | 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.
* input/cursor: fix jerky resizing of non-tablet_v2 surfacesLibravatar Tudor Brindus2020-04-22
| | | | | | This fixes resizing containers being very jerky under pointer emulation. Refs #5232.
* input/cursor: correctly send tablet_v2 up event when over non-v2 surfaceLibravatar Tudor Brindus2020-04-22
| | | | | | | | | | | | 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.
* Don't transfer focus to NULL node on touchLibravatar David962020-04-17
| | | | Fixes #5185
* Adjust focus order to match rendering order of layer shell popups.Libravatar Aleksei Bavshin2020-04-10
|
* swapped hiding the cursor and sending a touch event as a more logical sequenceLibravatar Some Chinese Guy2020-04-03
|
* switched to setting focus with seat_set_focusLibravatar Some Chinese Guy2020-03-29
|
* Added focus following for touch_downLibravatar Some Chinese Guy2020-03-29
|
* sway/input/cursor.c: fix undefined behaviour when event is NULLLibravatar Jason Nader2020-03-16
|
* sway/input/cursor.c: move NULL check to where it should beLibravatar Jason Nader2020-03-15
|
* input/cursor: handle setting a NULL image surfaceLibravatar Brian Ashworth2020-01-06
| | | | | | This fixes a crash when attempting to listen to a signal on a NULL cursor image surface. If the surface is NULL, the listener is just reinitialized using wl_list_init.
* input/cursor: handle image surface destroyLibravatar Brian Ashworth2020-01-05
| | | | | | This adds a listener for the destroy event of the cursor image surface. This prevents a use-after-free when the last visible image surface is freed, there has not been a new cursor set, and the cursor is reshown.
* Add seat <seat> idle_{inhibit,wake} <sources...>Libravatar Drew DeVault2019-12-12
| | | | | | | | | | This adds seat configuration options which can be used to configure what events affect the idle behavior of sway. An example use-case is mobile devices: you would remove touch from the list of idle_wake events. This allows the phone to stay on while you're actively using it, but doesn't wake from idle on touch events while it's sleeping in your pocket.
* input/cursor: remove gesture listeners in destroyLibravatar Benjamin Cheng2019-12-07
| | | | | Part of #4794. Forgot to remove gesture listeners when the cursor is destroyed.
* input/cursor: pass gesture events to clientsLibravatar Benjamin Cheng2019-12-07
| | | | | | | | | Some wayland clients (mostly GTK3 apps) like eog or evince support gestures like pinch-to-zoom. These gestures are given to clients via the pointer_gestures_v1 protocol. This is already supported in wlroots, so we just need to hook up the events here in sway. Fixes #4724
* input: Add support for tablet protocol.Libravatar John Chadwick2019-09-25
| | | | | | Sway has basic support for drawing tablets, but does not expose properties such as pressure sensitivity. This implements the wlr tablet v2 protocol, providing tablet events to Wayland clients.
* layer-shell: add support for popupsLibravatar Drew DeVault2019-08-14
|
* input/cursor: do not hide when buttons are pressedLibravatar Brian Ashworth2019-08-06
| | | | | | This just adds a small quality of life improvement to the cursor hiding functionality. The cursor will no longer be hidden unless all buttons are released.
* Unhide cursor on cursor activity after touchLibravatar Alex Maese2019-06-08
|
* Introduce default seatopLibravatar Ryan Dwyer2019-03-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This introduces a `default` seat operation which is used when no mouse buttons are being held. This means there is now always a seat operation in progress. It allows us to separate `default` code from the standard cursor management code. The sway_seatop_impl struct has gained callbacks `axis`, `rebase` and `end`, and lost callbacks `finish` and `abort`. `axis` and `rebase` are only used by the default seatop. `end` is called when a seatop is being replaced by another one and allows the seatop to free any resources, though no seatop currently needs to do this. `finish` is no longer required, as each seatop can gracefully finish in their `button` callback. And `abort` is not needed, as calling `end` would achieve the same thing. The struct has also gained a bool named allow_set_cursor which allows the client to set a new cursor during `default` and `down` seatops. Seatops would previously store which button they were started with and stop when that button was released. This behaviour is changed so that it only ends once all buttons are released. So you can start a drag with $mod+left, then click and hold right, release left and it'll continue dragging while the right button is held. The motion callback now accepts dx and dy. Most seatops don't use this as they store the cursor position when the seatop is started and compare it with the current cursor position. This approach doesn't make sense for the default seatop though, hence why dx and dy are needed. The pressed_buttons array has been moved from the sway_cursor struct to the default seatop's data. This is only used for the default seatop to check bindings. The total pressed button count remains in the sway_cursor struct though, because all the other seatops check it to know if they should end. The `down` seatop no longer has a `moved` property. This was used to track if the cursor moved and to recheck focus_follows_mouse, but seems to work without it. The logic for focus_follows_mouse has been refactored. As part of this I've removed the call to wlr_seat_keyboard_has_grab as we don't appear to use keyboard grabs. The functions for handling relative motion, absolute motion and tool axis have been changed. Previously the handler functions were handle_cursor_motion, handle_cursor_motion_absolute and handle_tool_axis. The latter two both called cursor_motion_absolute. Both handle_cursor_motion and cursor_motion_absolute did very similar things. These are now simplified into three handlers and a single common function called cursor_motion. All three handlers call cursor_motion. As cursor_motion works with relative distances, the absolute and tool axis handlers convert them to relative first.
* Replace seatup allows_events with button callbackLibravatar Ryan Dwyer2019-03-17
|
* Fix click behaviourLibravatar Ryan Dwyer2019-03-11
| | | | | | | | | By the time seatop_allows_events was called, seatop_impl was already NULL, causing the function to always return false. This means a press event was sent to clients without a corresponding release event. This patch moves the call to seatop_finish to after the seatop_allows_events check.
* Don't send button events to surfaces when dragging or resizingLibravatar Ryan Dwyer2019-03-11
| | | | | | | | | | | It turns out sending button events during all seat operations is not desirable. This patch introduces a new property `seatop_impl.allows_events` which allows each operation to define whether button events should be passed to the surface or not. The `down` seat operation is the only one that supports this. As all the other seatops don't support it, the calls to seat_pointer_notify_button prior to starting them have been removed.
* Allow concurrent clicksLibravatar Ryan Dwyer2019-03-04
| | | | | | | | | | | | | | | | | | | | | If two cursor buttons are pressed at the same time, the client will now be notified of the second button press. The main reason for not sending the concurrent presses was due to an early return in dispatch_cursor_button if a seatop is in progress. This patch makes it call seat_pointer_notify_button prior to returning. But it also has to make sure there's not a mismatch in events such as a release without a press. Prior to this patch, the down seatop would send press and release events in its begin and finish functions. No other seatops did this. A press event would be sent prior to starting tiling drag, but never an associated release. After this patch, no seatops send their own press or release events. We send them prior to calling the seatop begin functions, then the first part of dispatch_cursor_button handles all presses during seatops and when releasing the seatop.
* seat: don't send button release when not pressedLibravatar emersion2019-02-28
| | | | | | | | | All seat operations except "down" eat the button pressed event and don't send it to clients. Thus, when ending such seat operations we shouldn't send the button released event. This commit moves the logic used to send pressed/released into the "down" operation.
* cursor: intitialize sx and sy to zeroLibravatar Rouven Czerwinski2019-02-27
| | | | | If node_at_coords does an early return without setting these values, they can be used uninitialized later. Initialize both to zero.
* cursor: remove unused node assignementLibravatar Rouven Czerwinski2019-02-27
| | | | | The node variable is not used before its reassigned later in the function, remove the assignement.
* Update for swaywm/wlroots#1517Libravatar emersion2019-02-23
|
* input/cursor: allow whole-window bindings on wsLibravatar Brian Ashworth2019-02-22
| | | | | To match i3's behavior, this allows mouse bindings to be triggered over a workspace when `--whole-window` is given.
* Handle NULL from output_get_active_workspaceLibravatar Brian Ashworth2019-02-21
| | | | | | | | | | This modifies the places where output_get_active_workspace is called to handle a NULL result. Some places already handled it and did not need a change, some just have guard off code blocks, others return errors, and some have sway_asserts since the case should never happen. A lot of this is probably just safety precautions since they probably will never be called when `output_get_active_workspace` is not fully configured with a workspace.
* Check layout before getting pointer surface coordsLibravatar Vincent Vanlaer2019-02-16
| | | | | This fixes issues of clients at the edge of the screen, like swaybar, ignoring buttons.
* cursor: relative-pointer-v1 time is usecLibravatar Brian Ashworth2019-02-13
| | | | | | In handle_cursor_motion, the timestamp passed to `wlr_relative_pointer_manager_v1_send_relative_motion` should be microseconds (not milliseconds) according to relative-pointer-v1 spec.
* Rebase cursor when a layer surface mapsLibravatar emersion2019-02-12
| | | | | | | Also removes an extraneous arrange_outputs call, it's already called if necessary in arrange_layers. Updates https://github.com/swaywm/sway/issues/3080
* Merge pull request #3562 from ↵Libravatar Drew DeVault2019-02-03
|\ | | | | | | | | vilhalmer/focus_follows_mouse-workspace-last-inactive Focus workspace inactive node with focus_follows_mouse
| * Focus ws inactive node with focus_follows_mouseLibravatar vilhalmer2019-02-03
| |
* | Fall back to wildcard in sway_cursor_constrainLibravatar vilhalmer2019-02-03
| |
* | Skip constraining cursor if no seat configLibravatar vilhalmer2019-02-03
|/
* Merge pull request #3543 from emersion/relative-pointer-usecLibravatar Drew DeVault2019-02-01
|\ | | | | relative-pointer-v1: time is in usec, not msec
| * relative-pointer-v1: time is in usec, not msecLibravatar emersion2019-01-30
| |
* | pointer_constraint: change to a seat subcommandLibravatar Brian Ashworth2019-01-31
|/ | | | | | | | | | | | This changes the `pointer_constraint` command to be a subcommand of seat to allow for per-seat settings. The current implementation that is not a seat subcommand will only operate on the current seat and will segfault in the config due to `config->handler_context.seat` only being set at runtime. This also allows for the wildcard identifier to be used to alter the pointer constraint settings on all seats and allows for the setting to be merged with the rest of the seat config.
* Send pointer frames on tool eventsLibravatar Drew DeVault2019-01-30
|