Commit Graph

1345 Commits

Author SHA1 Message Date
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
Tarmack 989123a2a5 Add support for workspace_min_width bar option. 2020-10-11 19:12:42 +02:00
Tobias Langendorf 657587964e xwayland: support views that change override-redirect status 2020-10-10 09:53:41 +02:00
Mustafa Abdul-Kader eb1c09030e swaynag: add details background option
Adds a new config option for details background for swaynag

issue/#5673
2020-09-14 22:13:01 -04:00
oliver-giersch a543fa35ff swaynag: adds option to separately specify the text color for buttons 2020-09-04 18:17:42 +02:00
Simon Ser 2c76923282 Use wlr_output_event_commit
Instead of listening to both transform and scale events, we can listen
to the commit event and use the new wlr_output_event_commit struct to
decide what to do.

This de-duplicates some of the work we were doing twice when an output
was re-configured.

Depends on [1].

[1]: https://github.com/swaywm/wlroots/pull/2315
2020-08-27 13:57:10 -06:00
Konstantin Pospelov fd216b3a81 exec: fix validation during config reload
Split cmd_exec_always into separate methods for general validation and
process creation. This fixes a potential call of join_args with 0 arguments.
2020-08-24 09:41:54 +02:00
Ronan Pigott b7f28cd6b7 view: remove foreign toplevel listeners on destroy 2020-08-05 11:05:49 +02:00
Ronan Pigott f478f4cc66 view: implement foreign toplevel fullscreen request 2020-08-05 11:05:49 +02:00
Tobias Langendorf 4f718e6c75 Fix X11 clients getting stuck minimized
Usually it should be enough to simply not grant a client's
minimize request, however some applications (Steam, fullscreen
games in Wine) don't wait for the compositor and minimize anyway,
getting them stuck in an unrecoverable state.
Restoring them immediately lead to heavy flickering when unfocused
on my test application (Earth Defense Force 5 via Steam), so it's
preferable to grant their request without actually minimizing and
then restoring them once they are in focus again.
2020-07-22 18:50:57 -04:00
Nils Schulte 6898d1963f moved and renamed movement-unit parsing to common 2020-07-21 10:07:01 +02:00
Ronan Pigott 39d677af15 input: implement xdg_toplevel interactive resize hints 2020-07-13 00:21:52 -04:00
Simon Ser 5432f00adf config/output: don't change output state before commit
Previously, we called output_disable prior to wlr_output_commit. This
mutates Sway's output state before the output commit actually succeeds.
This results in Sway's state getting out-of-sync with wlroots'.

An alternative fix [1] was to revert the changes made by output_disable
in case of failure. This is a little complicated. Instead, this patch
makes it so Sway's internal state is never changed before a successful
wlr_output commit.

We had two output flags: enabled and configured. However enabled was set
prior to the output becoming enabled, and was used to prevent the output
event handlers (specifically, the mode handler) from calling
apply_output_config again (infinite loop).

Rename enabled to enabling and use it exclusively for this purpose.
Rename configure to enabled, because that's what it really means.

[1]: https://github.com/swaywm/sway/pull/5521

Closes: https://github.com/swaywm/sway/issues/5483
2020-07-10 18:18:27 -04:00
Geoffrey Casper ea3ba203cc Reload command now matches i3's implementation 2020-07-07 17:15:57 -04:00
Tudor Brindus 92891fb1ed commands/move: unwrap workspace container on move to new workspace
If moving e.g. `T[app app]` into a new workspace with `workspace_layout
tabbed`, then post-move the tree in that workspace will be `T[T[app
app]]`. This still happens with horizontal or vertical workspace layout,
but is less visible since those containers have no decorations.

Fixes #5426.
2020-07-01 18:43:20 -04:00
Kenny Levinsen 492267a5d6 seat: Refocus seat when wlr_drag is destroyed
wlr_drag installs grabs for the full duration of the drag, leading to
the drag target not being focused when the drag ends. This leads to
unexpected focus behavior, especially for the keyboard which requires
toggling focus away and back to set.

We can only fix the focus once the grabs are released, so refocus the
seat when the wlr_drag destroy event is received.

Closes: https://github.com/swaywm/sway/issues/5116
2020-06-30 13:27:51 +02:00
Drew DeVault 8d5e627bc9 Implement wlr-foreign-toplevel-management-v1 2020-06-23 22:26:00 +02:00
Tudor Brindus b3f08597cd input: disable events for map_to_output devices when output not present
Fixes #3449.
2020-06-19 10:02:22 +02:00
Tudor Brindus d328c2439c input/pointer: don't trigger pointer bindings for emulated input
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.
2020-06-18 22:35:01 +02:00
Tudor Brindus 82c439c4f1 input/cursor: send idle events based off device type, not input type
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.
2020-06-18 22:35:01 +02:00
Simon Ser e19bd1e474 Add support for viewporter
Depends on [1].

[1]: https://github.com/swaywm/wlroots/pull/2092
2020-06-17 10:18:58 -06:00
Brian Ashworth 33aa59d4c6 input/keyboard: wlr_keyboard_group enter and leave
This adds support for wlr_keyboard_group's enter and leave events. The
enter event just updates the keyboard's state. The leave event updates
the keyboard's state and if the surface was notified of a press event
for any of the keycodes, it is refocused so that it can pick up the
current keyboard state without triggering any keybinds.
2020-06-16 17:53:23 +02:00
Jason Nader 45859be03f i3-compat: add GET_BINDING_STATE IPC command 2020-06-14 00:55:14 -04:00
Tudor Brindus ed08f2f20c tree/view: fix smart gaps when ancestor container is tabbed or stacked
Fixes #5406.
2020-06-08 19:01:45 -04:00
Graham Christensen a974300652 swaynag: allow specifying more buttons which execute and dismiss
I don't love -z / -Z, but I figure this patch is far from being
accepted for other reasons too.
2020-06-09 00:00:14 +02:00
Tudor Brindus 53dc83fb68 tree/container: introduce `container_toplevel_ancestor` helper
This allows us to not have to explicitly write the same while loop
everywhere.
2020-06-07 10:46:14 +02:00
Tudor Brindus d7900c6e5e common/util: fix `get_current_time_msec` returning microseconds
This commit makes `get_current_time_msec` correctly return milliseconds
as opposed to microseconds. It also considers the value of `tv_sec`, so
we don't lose occasionally go back in time by one second. Finally, the
function is moved into `util.c` so that it can be reused elsewhere
without having to consider these pitfalls.
2020-06-06 13:38:41 +02:00
Kalyan Sriram e3e548a648
Save transform during transaction
Closes: https://github.com/swaywm/sway/issues/5412
2020-06-05 14:13:18 +02:00
Kenny Levinsen 5a4a7bc0da container: Remove useless surface dimensions
The adjustments to resize logic left them unnecessary.
2020-06-03 16:41:17 +02:00
Kenny Levinsen fcd0ab8f33 view: Save all buffers associated with view
During the execution of a resize transaction, the buffer associated
with a view's surface is saved and reused until the client acknowledges
the resulting configure event.

However, only one the main buffer of the main surface was stored and
rendered, meaning that subsurfaces disappear during resize.

Iterate over all, store and render buffers from all surfaces in the view
to ensure that correct rendering is preserved.
2020-06-03 16:41:17 +02:00
Damien Tardy-Panis 0cbd26f0da Add views idle inhibition status in get_tree output
Fixes #5286
2020-05-29 17:29:41 -04:00
Tudor Brindus 6da1631090 input/cursor: rename `simulated_tool_tip_down` to be more accurate
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.
2020-05-29 08:44:56 +02:00
Tudor Brindus d71fed95da input/cursor: keep reference to cursor in constraint
set_region accepts a NULL *data, so we can't use it to reference the
constraint and find the cursor through its seat.

Fixes #5386.
2020-05-26 16:24:52 +02:00
Tudor Brindus 5d13f647f9 input/tablet: add seatop_down entry for tablet input
Currently, when tablet input exits a window during an implicit grab, it
passes focus to another window.

For instance, this is problematic when trying to drag a scrollbar, and
exiting the window — the scrollbar motion stops. Additionally,
without `focus_follows_mouse no`, the tablet passes focus to whatever
surface it goes over regardless of if there is an active implicit.

If the tablet is over a surface that does not bind tablet handlers, sway
will fall back to pointer emulation, and all of this works fine. It
probably should have consistent behavior between emulated and
not-emulated input, though.

This commit adds a condition for entering seatop_down when a tablet's
tool tip goes down, and exiting when it goes up. Since events won't be
routed through seatop_default, this prevents windows losing focus during
implicit grabs.

Closes #5302.
2020-05-25 10:01:00 +02:00
Érico Rolim 1d3681f521 Remove code related to the security features
- Remove struct definitions
- Remove struct members
- Remove initializations and frees
2020-05-21 10:57:00 +02:00
Martin Michlmayr 06fc42359b Fix typos in comments 2020-05-21 10:52:59 +02:00
Tudor Brindus 6f0a0bd385 input/pointer: only warp cursor when the confine region has changed
Refs #5268.
2020-05-21 10:45:08 +02:00
Michael Weiser 0f11aa037a commands: Add per-view shortcuts_inhibitor command
Add a separate per-view shortcuts_inhibitor command that can be used
with criteria to override the per-seat defaults. This allows to e.g.
disable shortcuts inhibiting globally but enable it for specific,
known-good virtualization and remote desktop software or, alternatively,
to blacklist that one slightly broken piece of software that just
doesn't seem to get it right but insists on trying.

Add a flag to sway_view and handling logic in the input manager that
respects that flag if configured but falls back to per-seat config
otherwise. Add the actual command but with just enable and disable
subcommands since there's no value in duplicating the per-seat
activate/deactivate/toggle logic here. Split the inhibitor retrieval
helper in two so we can use the backend half in the command to retrieve
inhibitors for a specific surface and not just the currently focused
one. Extend the manual page with documentation of the command and
references to its per-seat sibling and usefulness with criteria.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
2020-05-13 21:22:16 -04:00
David96 2473cac32c Implement pointer simulation if client hasn't bound to touch 2020-05-13 14:29:15 -04:00
Tudor Brindus 726d187d3c input/tablet: simplify parameter plumbing for tablet references
This is a small cleanup commit for removing `sway_tablet` parameters
from functions that already accept `sway_tablet_tool`, since the tablet
reference can be accessed through `tool->tablet`.
2020-05-10 16:49:35 +02:00
Tudor Brindus e262f93d0a input: rename pointer handlers to be unambiguous
This commit renames `motion` and `axis` handlers to `pointer_motion` and
`pointer_axis`, respectively, to disambiguate them from their tablet
(and future touch) handlers. `button` is left as-is, as it is generic
across input devices.
2020-05-02 18:28:06 +02:00
Tudor Brindus ae3ec745f8 input: refactor tablet motion into seatop handler
This commit moves tablet motion logic into a seatop handler.

As a side-effect of seatop implementations being able to receive
tablet motion events, fixes #5232.
2020-05-02 13:32:28 +02:00
Tudor Brindus 0dc1863dce input/cursor: make cursor rebasing cursor type-agnostic
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
2020-05-02 13:32:28 +02:00
Simon Ser 5e5e5f2ee5 Add a secondary headless backend
This allows the create_output command to work on DRM too.
2020-05-01 17:00:14 +02:00
Tudor Brindus 2913f39dcb input/cursor: release simulated tool tip button when over v2 surface
d88460f addressed sending v2 tool tip up when over a non-v2 surface.
This commit addresses the other direction.

Fixes #5230.
2020-05-01 11:00:49 +02:00
Martin Dørum 4492e493e6 swaybar: Fix scrolling with precise trackpads 2020-04-28 21:46:37 +02:00
Tudor Brindus 44b2d3ad81 input/cursor: fix hide cursor timeouts on tablets and touchscreens
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.
2020-04-22 17:30:08 +02:00
Andri Yngvason 46599df0a2 input: Mark virtual devices as such
This is for internal configuration purposes
2020-04-14 12:07:24 +02:00
Simon Ser 4d13cee59a Use bitshifts for bitfields
Instead of hardcoded power of 2 values, use bitshifts. This makes the
enums more readable, avoids mistakes, and makes it clear how much of the
int32_t bit space we have left.

While at it, fix other minor style issues.
2020-04-10 18:08:46 -04:00
David96 8c62278207 Render layer shell popups over the top layer 2020-04-10 10:45:47 +02:00