summaryrefslogtreecommitdiffstats
path: root/include/sway/input/cursor.h
Commit message (Collapse)AuthorAge
* input/pointer: don't trigger pointer bindings for emulated inputLibravatar Tudor Brindus2020-06-18
| | | | | | | | | | 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.
* input/cursor: send idle events based off device type, not input typeLibravatar Tudor Brindus2020-06-18
| | | | | | | | 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.
* input/cursor: rename `simulated_tool_tip_down` to be more accurateLibravatar Tudor Brindus2020-05-29
| | | | | | | | | 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.
* input/pointer: only warp cursor when the confine region has changedLibravatar Tudor Brindus2020-05-21
| | | | Refs #5268.
* Implement pointer simulation if client hasn't bound to touchLibravatar David962020-05-13
|
* 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: 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: 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.
* 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.
* 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.
* 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
* Implement pointer-constraints-unstable-v1Libravatar Las2019-01-30
|
* Update for swaywm/wlroots#1503Libravatar emersion2019-01-27
|
* bar_cmd_tray_bind: Use mouse button helpersLibravatar Brian Ashworth2019-01-16
| | | | | | | | | | | | | | | | This modifies `bar_cmd_tray_bindsym` to use `get_mouse_bindsym` for parsing mouse buttons. This also introduces `bar_cmd_tray_bindcode`, which will use `get_mouse_bindcode` for parsing mouse buttons. Like with sway bindings, the two commands are encapsulated in a single file to maximize shared code. This also modifies tray bindings to work off of events codes rather than x11 buttons, which allows for any mouse buttons to be used. For `get_bar_config`, `event_code` has been added to the `tray_bindings` section and will include to event code for the button. If the event code can be mapped to a x11 button, `input_code` will still be the x11 button number. Otherwise, `input_code` will be `0`.
* Merge pull request #3343 from RedSoxFan/seat-cursor-buttons-improvedLibravatar Drew DeVault2019-01-13
|\ | | | | Improve mouse button parsing: seat cursor buttons
| * seat_cmd_cursor: utilize mouse button helpersLibravatar Brian Ashworth2019-01-10
| | | | | | | | | | | | | | | | | | | | This modifies `seat_cmd_cursor` to utilize `get_mouse_button` when parsing mouse buttons for the `press` and `release` operations. All x11 buttons, button event names, and button event codes are supported. For x11 axis buttons, `dispatch_cursor_axis` is used instead of `dispatch_cursor_button`. However the `press`/`release` state is ignored and the either axis event is processed. This also removes support for `left` and `right` in favor of `BTN_LEFT` and `BTN_RIGHT`.
* | Refactor seat operations to use an interfaceLibravatar Ryan Dwyer2019-01-10
|/ | | | | | | | | | | | | | | | | | This splits each seat operation (drag/move tiling/floating etc) into a separate file and introduces a struct sway_seatop_impl to abstract the operation. The move_tiling_threshold operation has been merged into move_tiling. The main logic for each operation is untouched aside from variable renames. The following previously-static functions have been made public: * node_at_coords * container_raise_floating * render_rect * premultiply_alpha * scale_box
* Add helpers for improved mouse button parsingLibravatar Brian Ashworth2019-01-09
| | | | | | | | | | | | | | | | | | | The following helper functions have been added to aid with parsing mouse buttons from a string: 1. `get_mouse_bindsym`: attempts to parse the string as an x11 button (button[1-9]) or as an event name (ex BTN_LEFT or BTN_SIDE) 2. `get_mouse_bindcode`: attempts to parse the string as an event code and validates that the event code is a button (starts with `BTN_`). 3. `get_mouse_button`: this is a conveniency function for callers that do not care whether a bindsym or bindcode are used and attempts to parse the string as a bindsym and then bindcode. None of these functions are used in this commit. The sole purpose of this commit is to make the larger set more granular and easier to review/manipulate. There will be a series of commits following this one that will modify any command which uses a mouse button to use these helpers.
* cursor: move unhide and timeout retrieval into separate functionsLibravatar Rouven Czerwinski2019-01-07
| | | | | The unhide and timeout retrieval functions are needed in a later commit. No functional changes.
* hide_cursor: change to a seat subcommandLibravatar Brian Ashworth2018-12-30
| | | | | This makes hide_cursor a seat subcommand, which allows for seat specific timeouts.
* Split image_surface handling into own functionLibravatar Brian Ashworth2018-12-25
|
* Implement hide_cursor <timeout> commandLibravatar Brian Ashworth2018-12-25
| | | | | Allows the cursor to be hidden after a specified timeout in milliseconds
* Change mouse buttons to x11 map and libevdev namesLibravatar Brian Ashworth2018-12-25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This modifies the way mouse bindings are parsed. Instead of adding to BTN_LEFT, which results in button numbers that may not be expected, buttons will be parsed in one of the following ways: 1. `button[1-9]` will now map to their x11 equivalents. This is already the case for bar bindings. This adds support for binding to axis events, which was not possible in the previous approach. 2. Anything that starts with `BTN_` will be parsed as an event code name using `libevdev_event_code_from_name`. This allows for any button to be mapped to instead of limiting usage to the ones near BTN_LEFT. This also adds a dependency on libevdev, but since libevdev is already a dependency of libinput, this should be fine. If needed, this option can have dependency guards added. Binding changes: - button1: BTN_LEFT -> BTN_LEFT - button2: BTN_RIGHT -> BTN_MIDDLE - button3: BTN_MIDDLE -> BTN_RIGHT - button4: BTN_SIDE -> SWAY_SCROLL_UP - button5: BTN_EXTRA -> SWAY_SCROLL_DOWN - button6: BTN_FORWARD -> SWAY_SCROLL_LEFT - button7: BTN_BACK -> SWAY_SCROLL_RIGHT - button8: BTN_TASK -> BTN_SIDE - button9: BTN_JOYSTICK -> BTN_EXTRA Since the axis events need to be mapped to an event code, this uses the following mappings to avoid any conflicts: - SWAY_SCROLL_UP: KEY_MAX + 1 - SWAY_SCROLL_DOWN: KEY_MAX + 2 - SWAY_SCROLL_LEFT: KEY_MAX + 3 - SWAY_SCROLL_RIGHT: KEY_MAX + 4
* Introduce cursor_rebaseLibravatar Ryan Dwyer2018-10-19
| | | | | This function "rebases" the cursor on top of whatever is underneath it, without triggering any focus changes.
* cmd_bind{sym,code}: Implement per-device bindingsLibravatar Brian Ashworth2018-10-18
| | | | | bindsym --input-device=<identifier> ... bindcode --input-device=<identifier> ...
* cursor: functions to warp cursor to container and workspaceLibravatar Rouven Czerwinski2018-10-16
| | | | | | The new functions allow a cursor to be warped without changing the focus. This is a preparation commit to handle cursor warping not only in seat_set_focus_warp.
* Fix focusing topmost floating windowsLibravatar Jonathan Buch2018-10-03
| | | | | | | | | | | | Re-focus on the container on which the cursor hovers over. A special case is, if there are menus or other subsurfaces open in the focused container. It will prefer the focused container as long as there are subsurfaces. This commit starts caching the previous node as well as the previous x/y cursor position. Re-calculating the previous focused node by looking at the current state of the cursor position does not work, if the environment changes.
* Invoke mouse bindingsLibravatar frsfnrrg2018-07-23
| | | | | | | | | | | | | | | | The mouse binding logic is inspired/copied from the keyboard binding logic; we store a sorted list of the currently pressed buttons, and trigger a binding when the currently pressed (or just recently pressed, in the case of a release binding) buttons, as well as modifiers/container region, match those of a given binding. As the code to execute a binding is not very keyboard specific, keyboard_execute_command is renamed to seat_execute_command and moved to where the other binding handling functions are. The call to transaction_commit_dirty has been lifted out.
* Prevent re-uploading the same cursor image multiple timesLibravatar Ryan Dwyer2018-07-22
|
* Move previous cursor_position inline.Libravatar Scott Leggett2018-05-28
|
* Store previous position in sway_cursor.Libravatar Scott Leggett2018-05-28
|
* Focus containers only on entry.Libravatar Scott Leggett2018-05-27
|
* Fix border commands from changing focusLibravatar Brian Ashworth2018-05-20
|
* Default to current time when triggering cursor eventsLibravatar emersion2018-04-21
|
* Clean up cursor simulation code.Libravatar Danny Bautista2018-04-10
|
* Implement cursor event simulation with sway commands.Libravatar Danny Bautista2018-04-10
|
* Fix cursor motion issuesLibravatar Drew DeVault2018-04-08
| | | | | | | Use only one canonical cursor x/y position and send cursor enter when mouse is warped. Tangentally related to #1714
* Implement tablet tool supportLibravatar Drew DeVault2018-04-08
|
* Handle set_cursor requests from clientsLibravatar emersion2018-03-30
| | | | | Allow clients to set a custom cursor if they have the seat's pointer focus.
* config reload: destroy old seat when removed from configLibravatar Dominique Martinet2018-01-22
| | | | | This adds new sway_seat_destroy and sway_cursor_destroy helpers and compare new and old config on free
* fix header includesLibravatar Tony Crisci2017-12-16
|
* working pointer motionLibravatar Tony Crisci2017-12-10
|
* sway xcursor managerLibravatar Tony Crisci2017-12-09
|
* input include directoryLibravatar Tony Crisci2017-12-08