aboutsummaryrefslogtreecommitdiff
path: root/swaybar/input.c
AgeCommit message (Collapse)Author
2023-07-31swaybar: Implement wp_cursor_shape_v1Alexander Orzechowski
2023-07-08swaybar: handle wayland-cursor failuresManuel Stoeckl
Updating the cursor is not essential, so this change prints a warning when wl_cursor_theme_load or wl_cursor_theme_get_cursor fail instead of crashing or exiting.
2023-06-27swaybar: don't set current workspace as not visiblellyyr
When `wrap_scroll yes` is configured and there's only one workspace open, swaybar will mark it as not visible if the user scrolls on it and eventually incorrectly fail the `active->visible` assert. Fix this by making sure that new and current workspace aren't the same.
2023-06-25Use "default" XCursor instead of "left_ptr"Simon Ser
"left_ptr" is the legacy XCursor name. "default" is the cursor spec name.
2022-11-26swaybar: Make hotspots block bar release bindingsJoan Bruguera
The previous commit prioritized hotspots before bar bindings for press events, which matches i3's behaviour. However, since hotspots don't need to do any processing on release events, those were not handled, and simply fell through to `bindsym --release` bar bindings (if any). This is counter-intuitive, and doesn't match i3's behaviour. Instead in case a hotspot handles the press event, it should also handle the release event, doing nothing, but blocking the event from triggering a --release bar binding. E.g., in Sway, without this commit, this config. shows a text on tray clicks: bar { # ... bindsym --release button1 exec swaynag -m I_got_the_release_event. } But the same configuration in i3 (with i3-nagbar) doesn't show the text. Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
2022-11-26swaybar: Prioritize hotspot events to bar bindingsJoan Bruguera
This is consistent with i3bar's behaviour, and for example, allows binding a command to button1, while still being able to click on tray icons or other zones on the bar's status line which may have their own bindings. E.g., in Sway, without this commit, this config. makes tray icons unclickable: bar { # ... bindsym button1 exec swaynag -m You_clicked_the_tray._Want_some_help? } But the same configuration in i3 (with i3-nagbar) keeps tray items clickable. Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
2021-09-12Simplify swaybar/swaynag scaling codeCaduser2020
Use `cairo_scale` to set the scale factor, removing redundant multiplications by `output->scale`.
2021-03-20swaybar: Use position from wl_pointer.enterKenny Levinsen
Only wl_pointer.motion was used to update pointer position, which would cause issues if the pointer was not moved prior to wl_pointer.button. This also fixes touch input through wl_pointer emulation, which fires wl_pointer.button immediately after wl_pointer.enter. Copied from a similar fix made to swaynag. Closes: https://github.com/swaywm/sway/issues/6109
2021-02-04Make Wayland request listeners static const when possibleManuel Stoeckl
2020-04-28swaybar: Fix scrolling with precise trackpadsMartin Dørum
2020-03-30swaybar: fix memory leaksIan Fan
2020-02-10swaybar: fix i3bar relative coordinates when scaling is usedHristo Venev
24e8ba048aef4751c6fa1d5982ee634f921e6cf6 did not take scaling into account. The hotspot size used pixel coordinates, the absolute coordinates were logical, and the relative coordinates were completely wrong. This commit makes all coordinates use logical values. If `"float_event_coords":true` is sent in the handshake message, coordinates are sent as floating-point values. The "scale" field is an integer containing the scale value.
2020-02-10Do not truncate pointer coordinates to int.Hristo Venev
This increases the precision of the clicks when using i3bar.
2020-01-05swaybar: Fix input device removalAndri Yngvason
Before swaybar would exit with a protocol error when a pointer or touch device was removed.
2019-06-05check for empty string before calling strtoul() and check errnoDaniel Eklöf
Note: since strtoul() has no real error return code (both 0 and ULONG_MAX may be returned on both success and failure), set errno=0 before calling strtoul().
2019-06-05swaybar/nag: use xcursor theme defined by XCURSOR_THEME/SIZEDaniel Eklöf
If the XCURSOR_THEME and/or XCURSOR_SIZE environment variables are set, use the theme and size they define. If they're not set, use the same defaults as before (system default theme, size=24).
2019-04-24swaybar: add multiseat supportBrian Ashworth
This just adds multiseat support to swaybar
2019-02-23swaybar: cycle workspaces on touch dragDrew DeVault
2019-02-23swaybar: process hotspots on touch tapDrew DeVault
2019-01-21Replace wlr_log with sway_logM Stoeckl
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.
2019-01-16bar_cmd_tray_bind: Use mouse button helpersBrian Ashworth
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`.
2019-01-10bar_cmd_bind: utilize mouse button helpersBrian Ashworth
This modifies `bar_cmd_bindsym` to use `get_mouse_bindsym` for parsing mouse buttons. This also introduces `cmd_bar_bindcode`, which will use `get_mouse_bindcode` for parsing mouse buttons. Like sway bindings, the two commands are encapsulated in a single file with shared code. This also modifies swaybar to operate off of event codes rather than x11 button numbers, which allows for any mouse button to be used. This introduces two new IPC properties: - For `get_bar_config`, `event_code` has been added to the `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`. - Likewise for `click_events`, `event` has been added and will include the event code for the button clicked. If the event code can be mapped to a x11 button, `button` will still be the x11 button number. Otherwise, `button` will be `0`.
2019-01-09Simplify evdev includes on FreeBSD by relying on up-to-date packageJan Beich
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> ^~~~~~~~~~~~~~~~~~~~~~~~~~~
2018-12-15swaybar: fix cursor scaleBrian Ashworth
This fixes a few issues with swaybar's cursor scaling: 1. The cursor scale is now changed when the output scale changes 2. The cursor scale is no longer bound by the max output scale when swaybar is launched 3. Related to the previous item, the cursor is no longer tiny on low scale outputs after the max output scale has changed This also bumps up `wl_compositor` to version 4 to allow usage of `wl_surface_damage_buffer`.
2018-12-04Add relative coordinates in JSON for i3bar click eventsHristo Venev
Compatibility with i3 commit 161db6f17d734ac9deb0a20e81b78d4b2a92ce68.
2018-10-25swaybar: when scrolling, check that there are workspaces to scroll onIan Fan
2018-10-25swaybar: fix scrolling behaviourIan Fan
1. wrap_scroll has been fixed 2. release bindings are checked when returning early
2018-10-25swaybar: reverse order of workspaces listIan Fan
This makes it congruent with its visual appearance, making it easier to reason about.
2018-10-19missing headers for swaybar/input.cossi.ahosalmi
2018-10-18swaybar: separate input code to new fileIan Fan