summaryrefslogtreecommitdiffstats
path: root/sway/input/cursor.c
Commit message (Collapse)AuthorAge
...
* 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
|
* Missed a spot in pointer constraintsLibravatar Drew DeVault2019-01-30
|
* Add pointer_constraint commandLibravatar Drew DeVault2019-01-30
|
* Add relative pointerLibravatar absrd2019-01-30
|
* Implement pointer-constraints-unstable-v1Libravatar Las2019-01-30
|
* Merge pull request #3423 from RyanDwyer/fullscreen-globalLibravatar Drew DeVault2019-01-27
|\ | | | | Implement fullscreen global
| * Implement fullscreen globalLibravatar Ryan Dwyer2019-01-25
| |
* | Update for swaywm/wlroots#1503Libravatar emersion2019-01-27
|/
* Replace wlr_log with sway_logLibravatar M Stoeckl2019-01-21
| | | | | | | | | | | | | This commit mostly duplicates the wlr_log functions, although with a sway_* prefix. (This is very similar to PR #2009.) However, the logging function no longer needs to be replaceable, so sway_log_init's second argument is used to set the exit callback for sway_abort. wlr_log_init is still invoked in sway/main.c This commit makes it easier to remove the wlroots dependency for the helper programs swaymsg, swaybg, swaybar, and swaynag.
* Fix crash in cursor_rebase with multiple screensLibravatar emersion2019-01-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Designing the output configuration sequence without invalid state is tricky. We have one function, apply_output_config, that takes an output and (besides other things) performs a modeset and inserts the output in the output layout. The modeset can fail, in which case we don't want the output to be enabled. We also have an output_enable function, which calls output_apply_config and also configures the output's workspace and inserts it in the root container. Now, we have two choices. Either we configure the output before it's been inserted in the root container and then, if the modeset was successful, we insert it and create the workspace. The main issue with this approach is that configuring the output triggers a handful of signals, namely wlr_output.mode and wlr_output_layout.change. In those event handlers, we need to make sure to ignore these outputs in the process of being configured. Either we first insert the output, create the workspace and then try to configure it. It means we need to undo everything if the modeset fails. The main issue with this solution is that it enables and disables the output very quickly, creates a workspace and immediately destroys it, and maybe moves views back and forth (see output_evacuate). I've tried to make it so an output isn't enabled then immediately disabled. We already have code for ignoring outputs when the output is being destructed. Fixes https://github.com/swaywm/sway/issues/3462
* 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`.
* cursor: send clear_focus on hide and enter event on unhideLibravatar Rouven Czerwinski2019-01-15
| | | | | | | | | | | | Clear the focus when we hide the cursor and show it again during the unhide action. The unhide function will rebase the cursor after the unhide. Tested by looking at the WAYLAND_DEBUG=1 output of termite. Also call cursor_handle_activity before sending pointer events to send the enter events to the surface if the cursor was hidden before. Fixes #3431
* 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`.
* | Merge pull request #3342 from RedSoxFan/scroll-buttons-improvedLibravatar Drew DeVault2019-01-13
|\ \ | | | | | | Improve mouse button parsing: input scroll_button
| * | input_cmd_scroll_button: utilize mouse btn helpersLibravatar Brian Ashworth2019-01-10
| |/ | | | | | | | | | | | | | | This modifies `input_cmd_scroll_button` to utilize the mouse button helper `get_mouse_button` when parsing the button. x11 axis buttons are not supported with this command and `CMD_INVALID` will be returned, but all other x11 buttons, button event names, and button event codes should be working
* / 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
* Merge pull request #3341 from RedSoxFan/mouse-bindings-improvedLibravatar Ian Fan2019-01-10
|\ | | | | Improve mouse button parsing: helpers and bind{code/sym}
| * 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.
* | Merge pull request #3399 from RedSoxFan/fix-output-destruction-segfaultsLibravatar emersion2019-01-10
|\ \ | | | | | | Fix segfaults on output destruction
| * | Fix segfaults on output destructionLibravatar Brian Ashworth2019-01-10
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fixes two causes of segfaulting when an output is destroyed. The first occurred when an output was never enabled. The issue was that the destroy signal was never initialized so when it was emitted, sway segfaulted. This was fixed by moving the initialization into `output_create` since all outputs, regardless of whether they have ever been enabled, will be destroyed at some point. The second occurred when the cursor was on an output that was being destroyed. The sway output would have already been removed, but if there are other outputs, a cursor rebase would still occur. Since the wlr_output still existed and the sway output was destroyed, the cursor could be over nothing, resulting in a segfault when trying to get the sway output, which was destroyed.
* / cursor: allow scrolling tabs/stack on title borderLibravatar Brian Ashworth2019-01-09
|/ | | | | | This allows tabbed and stacked containers to be scrolled through when the cursor is over the border of the title bar. The borders around the other three edges of the contents should not be affected by this change.
* Simplify evdev includes on FreeBSD by relying on up-to-date packageLibravatar Jan Beich2019-01-09
| | | | | | | | | | | | evdev-proto is installed by a dependency, so some files have been missed: In file included from ../sway/input/cursor.c:3: /usr/local/include/libevdev-1.0/libevdev/libevdev.h:30:10: fatal error: 'linux/input.h' file not found #include <linux/input.h> ^~~~~~~~~~~~~~~ ../swaybar/i3bar.c:3:10: fatal error: 'linux/input-event-codes.h' file not found #include <linux/input-event-codes.h> ^~~~~~~~~~~~~~~~~~~~~~~~~~~
* 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.
* Apply tiling_drag_threshold to all containersLibravatar David962019-01-03
|
* Implement tiling_drag_thresholdLibravatar Brian Ashworth2019-01-02
| | | | | | | | | Implements `tiling_drag_threshold <threshold>` to prevent accidental dragging of tiling containers. If a container (and all of its descendants) are unfocused and the tile bar is pressed, a threshold will be used before actually starting the drag. Once the threshold has been exceeded, the cursor will change to the grab icon and the operation will switch from `OP_MOVE_TILING_THRESHOLD` to `OP_MOVE_TILING`.
* hide_cursor: change to a seat subcommandLibravatar Brian Ashworth2018-12-30
| | | | | This makes hide_cursor a seat subcommand, which allows for seat specific timeouts.
* Remove button from state on release during opLibravatar Brian Ashworth2018-12-29
| | | | | | | This fixes a bug in `dispatch_cursor_button` where if there was an operation occurring, the button would not be removed from the state on release. This resulted in the button appearing to be permanently pressed and caused mouse bindings to not match correctly.
* 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
* Focus node before tiling drag if on titlebarLibravatar Brian Ashworth2018-12-17
| | | | | Before attempting to drag a tiling container by its titlebar, focus it. This fixes clicking on titlebars to focus a container.
* Allow tiling views to be dragged by the titlebarLibravatar Brian Ashworth2018-12-17
| | | | | | Enables titling views to be dragged by the titlebar. This is in addition to using the modifier and dragging them from anywhere on the container surface. Floating views already allow this behavior.
* Replace _XOPEN_SOURCE with _POSIX_C_SOURCELibravatar emersion2018-11-25
| | | | And make sure we don't define both in the same source file.
* Add scroll factor config option.Libravatar Spencer Michaels2018-11-18
|
* Use #if instead of #ifdefLibravatar emersion2018-11-18
|
* Move view {x,y,width,height} into container structLibravatar Ryan Dwyer2018-11-17
| | | | | | | | | | | | | | | | | | | This renames/moves the following properties: * sway_view.{x,y,width,height} -> sway_container.content_{x,y,width,height} * This is required to support placeholder containers as they don't have a view. * sway_container_state.view_{x,y,width,height} -> sway_container_state.content_{x,y,width,height} * To remain consistent with the above. * sway_container_state.con_{x,y,width,height} -> sway_container_state.{x,y,width,height} * The con prefix was there to give it contrast from the view properties, and is no longer useful. The function container_set_geometry_from_floating_view has also been renamed to container_set_geometry_from_content.
* Fix segfault in dispatch_cursor_buttonLibravatar emersion2018-11-15
|