Commit Graph

69 Commits

Author SHA1 Message Date
Simon Ser d0bd591ee7 Drop server.h include from input/input-manager.h
The only reason it's included there is for a declaration of
struct sway_server, but we can just forward-declare it.

This avoids rebuilding almost all of Sway when touching server.h.
All other server.h includes are from source files, not headers.
2024-05-27 09:28:43 -04:00
Simon Ser fc640d5f6c Define _POSIX_C_SOURCE globally
See discussion in https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/4555
2024-02-23 17:43:19 +03:00
iff 3dd2f4a67f
commands/input/map_from_region: don't treat 0x prefix as hex identifier
When using the `map_from_region` for pen tables, we will usually make
the available area as big as possible while maintaining the proportions
with the screen.

As most of the tablets uses a 16:10 ratios while the most popular screen
ratios is still 16:9, the argument for most people should be `0x0 1x0.9`
to have the maximum effective area.

However, the argument above won't work because the current code will
treat `0x...` as a hexadecimal number, instead of setting both `x` and
`y` to `0`.

This fix allows the use of the following syntax:

```
input type:tablet_tool {
	map_from_region 0x0 1x0.9
}
```
2023-09-07 01:31:35 +00:00
Cezary Drożak c08762901e input/libinput: add scroll_button_lock method
Closes https://github.com/swaywm/sway/issues/6987

Co-authored-by: JJGadgets <git@jjgadgets.tech>
Co-authored-by: DeltaWhy <mike5713@gmail.com>
2023-06-16 15:30:04 +02:00
Simon Ser a7b50f6c9c commands: add printf attribute to cmd_results_new()
And fix the resulting build failures.
2023-04-14 18:34:54 +02:00
Lucas Zampieri efd83cb8b9 Add libinput RotationAngle
This patch adds the libinput option RotationAngle to sway.

Signoff-by: Lucas Zampieri <lzampier@redhat.com>
2022-12-09 11:28:53 +01:00
Simon Ser e62299daa4 Make libinput backend optional 2022-11-28 13:28:15 -05:00
pudiva chip líquida 7cc8ab6d6c Support libinput's 1.21 new dwtp option
Support the new dwtp (disable while trackpointing) option introduced in
libinput 1.21, allowing users to control whether the trackpoint (like
those in Thinkpads, but not only) should be disabled while using the
keyboard/touchpad.

See: https://gitlab.freedesktop.org/libinput/libinput/-/issues/731
2022-10-30 10:56:34 +01:00
Simon Ser 122d8ce954 Remove access to wlr_input_device union
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3626
Closes: https://github.com/swaywm/sway/issues/7077
2022-06-22 12:44:15 -04:00
Victor Makarov 70d30ac72b
xkb_switch_layout: fix relative layout switches
Fixes #6011
2022-04-28 13:20:44 +02:00
Simon Zeni f8990523b4 sway/commands: add missing wlr_keyboard interface include in xkb_switch_layout 2022-02-21 20:25:47 +03:00
Simon Ser 4832fc937f Update wlr_box includes
Update for the breaking change in [1].

[1]: https://github.com/swaywm/wlroots/pull/3011
2021-07-07 11:29:14 +02:00
Tudor Brindus ed247c031c input/tablet: add tool_mode option to set tablet tools as relative input
Closes #4139.
2020-10-12 15:01:37 +02:00
Tudor Brindus eeb90a7963 input_cmd_click_method: fix typo in error text 2020-06-19 22:48:53 +02:00
Bor Grošelj Simić 27d5cf1316 input: implement cycling through keyboard layout list 2020-03-11 12:12:23 +01:00
Brian Ashworth ec7d3f181d input_cmd_events: add support for input types
This adds support for input type configs to input_cmd_events. This works
similar to the wildcard handling that existed where configs for the
devices are stored and the type config is reset to INT_MIN so that it
does not override.

This also condenses the toggle_send_events and
toggle_wildcard_send_events functions into a single function to reduce
code duplication.
2020-02-18 18:08:45 +01:00
Brian Ashworth 2f858a1ada input_cmd_xkb_file: allow shell path expansion
This allows for shell path expansion for input_cmd_xkb_file. The logic
has been extracted from output_cmd_background
2019-11-21 10:36:15 -05:00
Tadeo Kondrak 7f54495b5e Use an enum instead of a marker string for map_to_ 2019-11-17 13:34:24 +01:00
Tadeo Kondrak 4829f1c26a Implement input map_to_region command 2019-11-17 13:34:24 +01:00
Brian Ashworth 36aa67e549 input_cmd_xkb_switch_layout: support input types
This just adds input type config support to input_cmd_xkb_switch_layout
so that `input type:keyboard xkb_switch_layout <idx>` will work
2019-07-18 08:20:54 +03:00
Ed Younis 37308f6549 input_cmd_xkb_*: cleanup includes 2019-07-17 19:26:58 -04:00
Ed Younis eb770e88b7 Implement input_cmd_xkb_file (#3999)
Adds a new commend "xkb_file", which constructs the internal
xkb_keymap from a xkb file rather than an RMLVO configuration.
This allows greater flexibility when specifying xkb configurations.
An xkb file can be dumped with the xkbcomp program.
2019-07-17 19:26:58 -04:00
Sergei Dolgov c9cb5ced7f calibration_matrix: expect 6 individual values
Example usage from command line:

    swaymsg input type:touch calibration_matrix -- -1 0 1 0 -1 1
2019-07-05 18:41:56 +03:00
Sergei Dolgov bcceb61b43 Use isnan 2019-07-05 18:41:56 +03:00
Sergei Dolgov 01ec18e802 Add calibration_matrix config option
Can be used to change the orientation of a touchscreen.

Example usage with swaymsg:

    # identity
    swaymsg input type:touch calibration_matrix '"1 0 0 0 1 0"'

    # 90 degree clockwise
    swaymsg input type:touch calibration_matrix '"0 -1 1 1 0 0"'

    # 180 degree clockwise
    swaymsg input type:touch calibration_matrix '"-1 0 1 0 -1 1"'

    # 270 degree clockwise
    swaymsg input type:touch calibration_matrix '"0 1 0 -1 0 1"'

Documentation:

    https://wayland.freedesktop.org/libinput/doc/latest/absolute-axes.html#calibration-of-absolute-devices
2019-07-05 18:41:56 +03:00
Simon Ser 2bccb387d8 Add a new xkb_switch_layout command
This allows users to programatically change the active layout.
2019-06-09 15:20:14 -04:00
Brian Ashworth 5b1a8d62b9 config/input: validate xkb keymap before storing
This allows for an optional validation stage when storing an input
config. Currently, only the xkb keymap is validated. If storing the
delta input config will result in any invalid xkb keymaps, the input
config will not be stored and error will be populated with the first
line of the xkbcommon log.
2019-06-09 20:13:22 +03:00
Drew DeVault cddb057343
Merge pull request #3480 from RedSoxFan/input-modes-improved-toggle
input_cmd_events: allow toggle modes to be listed
2019-01-21 09:28:47 -05: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 91c1f44956 input_cmd_events: allow toggle modes to be listed
This extends `input <identifier> events toggle` to allow for an optional
list of modes to toggle through. If no event modes are listed, all
supported modes are cycled through (current behavior). If event modes
are listed, they will be cycled through, defaulting to the first mode
listed when the current mode is not in the list. This modes listed will
also not be checked to see if the device supports them and may fail.
2019-01-21 02:13:01 -05:00
M Stoeckl 2a684cad5f Remove now-unused "input" argument of cmd_results_new
Patch tested by compiling with `__attribute__ ((format (printf, 2, 3)))`
applied to `cmd_results_new`.

String usage constants have been converted from pointers to arrays when
encountered. General handler format strings were sometimes modified to
include the old input string, especially for unknown command errors.
2019-01-14 08:05:29 -05:00
Drew DeVault db1631b67d
Merge pull request #3342 from RedSoxFan/scroll-buttons-improved
Improve mouse button parsing: input scroll_button
2019-01-13 20:40:00 -05:00
Brian Ashworth 4e6bd53abf input_cmd_scroll_button: utilize mouse btn helpers
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
2019-01-10 12:45:52 -05:00
Brian Ashworth 55e1d599a2 input_cmd_events: implement toggle
Implements toggling input events during runtime. This will not attempt
to toggle to a mode that is not supported by the device.

When toggling the wildcard input, the device specific input configs are
altered. Each device will cycle one supported mode.
2019-01-09 23:17:27 -05:00
emersion 3a310f92ab
Replace _XOPEN_SOURCE with _POSIX_C_SOURCE
And make sure we don't define both in the same source file.
2018-11-25 17:19:43 +01:00
Spencer Michaels 70bc4c3ab6 Add scroll factor config option. 2018-11-18 13:49:30 -05:00
Connor E b865dabeba Use parse_boolean where possible. 2018-11-10 12:55:06 +00:00
Drew DeVault e60ad3f677 Fix some missing commands in sway-input(5) 2018-10-03 07:50:37 -04:00
PP ae2b70f59e add tap-and-drag setting to sway-input 2018-09-29 11:49:41 +02:00
Brian Ashworth baeb28ea62 Implement support for input wildcard 2018-09-23 19:56:52 -04:00
ProgAndy c7a3a03115 Add xkb_numlock/xkb_capslock commands (#2311) 2018-07-25 17:24:45 +02:00
Brian Ashworth 863914ec95 Switch to using a function to parse booleans 2018-07-23 21:33:17 -04:00
Brian Ashworth 13c6627ddb Implement tap_button_map for input devices 2018-07-14 01:01:47 -04:00
Robert Kubosz f8bc928b2d
add error handling for scroll button out of range
user will be informed if the scroll button indentifier values causes
underflow or overflow.
2018-07-13 11:39:39 +02:00
Robert Kubosz 89db5b5716
expanded error detection for scroll button option
Now the scroll_button will not accept:
  - letters on string beginning;
  - negative numbers.

What is tolerated:
  - letters after number;
  - rational numbers: the fraction after dot will be omitted.
2018-07-12 23:50:34 +02:00
Robert Kubosz 094edcbea2
rm constraint for max value of button identifier
updated error message to be more adequate for current contraint
2018-07-12 15:50:42 +02:00
Robert Kubosz 08edaf4e76
increase maximum value of button identifier
and also cleanup spaces
2018-07-12 12:08:53 +02:00
Robert Kubosz 41b80c28df
add scroll button option
This commit introduces a scroll_button option, which is intended to be
used with scroll_method. Now user can edit his sway config and add an
scroll_button option to device section.
2018-07-11 22:03:06 +02:00
emersion 63b4bf5000
Update for swaywm/wlroots#1126 2018-07-09 22:54:30 +01:00
Dominique Martinet 5690bea227 input_config: free new_input_config on error
Found through static analysis.
2018-07-02 08:03:41 +09:00