Commit graph

24 commits

Author SHA1 Message Date
Caduser2020 57ae751655 Simplify swaybar/swaynag scaling code
Use `cairo_scale` to set the scale factor, removing redundant
multiplications by `output->scale`.
2021-09-12 09:05:12 +02:00
Kenny Levinsen 6271bd06e9 swaybar: Use position from wl_pointer.enter
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-03-20 11:56:13 +01:00
Manuel Stoeckl 8f2cd3236f Make Wayland request listeners static const when possible 2021-02-04 09:49:06 +01:00
Martin Dørum 4492e493e6 swaybar: Fix scrolling with precise trackpads 2020-04-28 21:46:37 +02:00
Ian Fan b54f5e170a swaybar: fix memory leaks 2020-03-30 17:31:00 +02:00
Hristo Venev 7affe5c1bd swaybar: fix i3bar relative coordinates when scaling is used
24e8ba048a 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-10 18:58:09 +01:00
Hristo Venev fca32b6334 Do not truncate pointer coordinates to int.
This increases the precision of the clicks when using i3bar.
2020-02-10 18:58:09 +01:00
Andri Yngvason fd24b1afd8 swaybar: Fix input device removal
Before swaybar would exit with a protocol error when a pointer or touch
device was removed.
2020-01-05 19:57:05 +01:00
Daniel Eklöf b4b274cdce check for empty string before calling strtoul() and check errno
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-05 14:40:29 -04:00
Daniel Eklöf 900d3287f9 swaybar/nag: use xcursor theme defined by XCURSOR_THEME/SIZE
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-06-05 14:40:29 -04:00
Brian Ashworth dc7a3930a7 swaybar: add multiseat support
This just adds multiseat support to swaybar
2019-04-24 07:16:37 -06:00
Drew DeVault d1588e3739 swaybar: cycle workspaces on touch drag 2019-02-23 20:00:20 +01:00
Drew DeVault 4599907de7 swaybar: process hotspots on touch tap 2019-02-23 20:00:20 +01:00
M Stoeckl 1211a81aad Replace wlr_log with sway_log
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-21 12:59:42 +01:00
Brian Ashworth 02bbefda20 bar_cmd_tray_bind: Use mouse button helpers
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-16 11:12:45 +01:00
Brian Ashworth 3d6440ec26 bar_cmd_bind: utilize mouse button helpers
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-10 12:43:10 -05:00
Jan Beich 0a4c4f3e52 Simplify evdev includes on FreeBSD by relying on up-to-date package
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>
	   ^~~~~~~~~~~~~~~~~~~~~~~~~~~
2019-01-09 11:02:05 +00:00
Brian Ashworth 35a82a8693 swaybar: fix cursor scale
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-15 09:26:50 +01:00
Hristo Venev 24e8ba048a Add relative coordinates in JSON for i3bar click events
Compatibility with i3 commit 161db6f17d734ac9deb0a20e81b78d4b2a92ce68.
2018-12-04 12:49:21 +02:00
Ian Fan 19421373b9 swaybar: when scrolling, check that there are workspaces to scroll on 2018-10-25 14:12:26 +01:00
Ian Fan c5541763c0 swaybar: fix scrolling behaviour
1. wrap_scroll has been fixed
2. release bindings are checked when returning early
2018-10-25 12:57:16 +01:00
Ian Fan c3fdabb725 swaybar: reverse order of workspaces list
This makes it congruent with its visual appearance, making it easier to
reason about.
2018-10-25 12:57:16 +01:00
ossi.ahosalmi 79011e68df missing headers for swaybar/input.c 2018-10-19 15:55:30 +03:00
Ian Fan 499150a91b swaybar: separate input code to new file 2018-10-18 14:19:00 +01:00