Commit graph

328 commits

Author SHA1 Message Date
Ryan Dwyer 15dc5286e2 Move floating windows to front when focused 2018-07-11 19:50:02 +10:00
emersion 63b4bf5000
Update for swaywm/wlroots#1126 2018-07-09 22:54:30 +01:00
emersion b3c55dd909
Merge branch 'master' into leaks 2018-07-06 16:22:13 +01:00
Drew DeVault 3d2595b102
Merge branch 'master' into remove-input-fix 2018-07-06 06:28:01 -07:00
Ian Fan f63b209d51 Attach destroy handler earlier
This prevents it from being bypassed when the device has no seat configuration
2018-07-06 14:13:45 +01:00
Brian Ashworth c833ae64bc Fix pointer button events for layer surfaces 2018-07-05 23:01:35 -04:00
Dominique Martinet 8a771785ad keyboard: free xkb keymap on destroy 2018-07-05 08:13:10 +09:00
Ryan Dwyer 0bd41a0dae Fix focus related damage
When you have an unfocused container (so one view is focused_inactive),
and you focus any other view in that container, the view with
focused_inactive was not damaged. This is because we damaged the
previous focus and new focus, but needed to damage the parent of the new
focus.
2018-07-04 15:38:08 +10:00
Ryan Dwyer 1e4807efa0 Don't return pending children in seat_get_active_current_child
Fixes #2192.

seat_get_active_current_child is intended to return a child of the given
container which has finished its mapping transaction and is able to be
rendered on screen. The previous implementation was capable of returning
a pending child, which caused a child of a tabbed or stacked view to be
rendered prematurely while it was mapping.
2018-07-02 22:16:20 +10:00
Ryan Dwyer a2fbb20a61 Merge remote-tracking branch 'upstream/master' into atomic 2018-06-29 20:04:24 +10:00
Armin Preiml 1eede432fc fix handling key modifiers if not pressed at first
fixes #2169
2018-06-28 15:23:26 +02:00
Ryan Dwyer bf38081382
Merge branch 'master' into xwayland-wants-float 2018-06-27 13:21:00 +10:00
Tony Crisci e9ad10c2d6 dont focus-follow-mouse when keyboard grab 2018-06-24 20:30:43 -04:00
Ryan Dwyer 32b865e610 Fix crash when deleting last child in a tabbed or stacked container
There was no `current` child because the container was destroyed. This
makes it fall back to looking in the parent's current children list.
2018-06-23 17:47:28 +10:00
emersion cda66e9a26
Automatically float xwayland windows 2018-06-18 22:52:10 +01:00
frsfnrrg ca061ba8bf Fix keyboard shortcut handling inconsistencies
* Ensure that modifier keys are identified even when the next key does
  not produce a keysym. This requires that modifier change tracking
  be done for each sway_shortcut_state.

* Permit regular and --release shortcuts on the same key combination.
  Distinct bindings are identified for press and release cases; note
  that the release binding needs to be identified for both key press
  and key release events.

* Maintain ascending sort order for the shortcut state list, and keep
  track of the number of pressed key ids, for simpler (and hence
  faster) searching of the list of key bindings.

* Move binding duplicate detection into get_active_binding to avoid
  duplicating error messages.
2018-06-12 20:26:57 -04:00
emersion cfd02918c0
Render drag icons 2018-06-09 13:26:03 +01:00
Scott Leggett 609c420501 Initialise previous cursor position.
Fix the problem with focus jumping to the container under the cursor
when first starting sway.
2018-06-06 20:45:02 +10:00
Ryan Dwyer bcdb676abb Don't set focus to NULL when clicking a surface which has no container 2018-06-04 11:31:25 +10:00
Ryan Dwyer 9253278328 Restore focus when unmapping layer shell surfaces 2018-06-04 11:31:07 +10:00
Ryan Dwyer 57e78414fa Fix seat_get_active_child
seat_get_active_child is used for tabbed and stacked containers to get
the active child. The previous implementation used seat_get_focus_inactive
then ascended the tree to the child of the tabbed/stacked container, but
this fails when the workspace itself is stacked or tabbed and the most
recently active child is floating.

The new implementation takes a more simple approach, where it directly
scans the focus stack for the first immediate child which isn't the
floating container.

Fixes #2098.
2018-06-03 22:31:54 +10:00
Brian Ashworth 7c810dc344 Make command block implementation generic 2018-06-02 08:07:44 -04:00
frsfnrrg 78b7b46895 Style fix, redundant entry removal, fix extra keysym delete 2018-06-01 18:52:36 -04:00
frsfnrrg 480f0c593c Rename update_shortcut_model to update_shortcut_state 2018-06-01 18:52:36 -04:00
frsfnrrg 83d559dd03 Rename check_shortcut_model to get_active_binding 2018-06-01 18:52:36 -04:00
frsfnrrg c53e4e6cde Style fixed for keyboard.c 2018-06-01 18:52:36 -04:00
frsfnrrg f2fe93d171 Remove almost-always redundant loop in key handling 2018-06-01 18:52:36 -04:00
frsfnrrg a056419ad7 Rewrite shortcut handling code to avoid hardcoded values
The same shortcut algorithm is now used for keycodes,
raw keysyms, and translated keysyms. Pressed keysyms
are now stored in association with the keycodes that
generated them. Modifier keycodes (and associated
keysyms) are identified retroactively by the subsequent
change to the modifier flags.
2018-06-01 18:52:36 -04:00
Drew DeVault e605dc43bb Fix mouse warping interaction with layout coords 2018-06-01 23:14:58 +10:00
Ryan Dwyer e4e912ea91 Store swayc coordinates as layout-local 2018-06-01 23:14:58 +10:00
Ryan Dwyer 1f2e399ade Implement floating 2018-06-01 23:14:58 +10:00
Ryan Dwyer 7c7d24600b Fix ancestor typos 2018-05-28 12:45:42 +10:00
Drew DeVault b2c0ba5b18
Merge pull request #2050 from smlx/focus-fix
Focus containers only on entry.
2018-05-27 15:42:39 -04:00
frsfnrrg a78a5684ea Implement bindsym/bindcode --locked
Adds the --locked flag to bindsym and bindcode commands.

When a keyboard's associated seat has an exclusive client
(i.e, a screenlocker), then bindings are only executed if
they have the locked flag. When there is no such client,
this restriction is lifted.
2018-05-27 13:28:02 -04:00
Scott Leggett 4d8120ccf3 Improve comment. 2018-05-28 02:35:24 +10:00
Scott Leggett b57f88e7db Avoid assert on container type. 2018-05-28 02:25:42 +10:00
Scott Leggett 1b8de39287 Move previous cursor_position inline. 2018-05-28 02:14:19 +10:00
Scott Leggett d1ebbebea0 Remove unused function. 2018-05-28 01:38:46 +10:00
Scott Leggett 0039f7a4fd Simplify logic, remove redundant variables. 2018-05-28 01:38:46 +10:00
Scott Leggett dd86444e59 Rely on view_is_visible rather thank walking the tree ourselves. 2018-05-28 01:38:46 +10:00
Scott Leggett 4cd304e4ba Store previous position in sway_cursor. 2018-05-28 01:37:43 +10:00
Scott Leggett 06098bef98 Focus containers only on entry. 2018-05-27 15:29:48 +10:00
Drew DeVault fea654a6ce Replace oft-failing abort with if statement
Fixes #2045
2018-05-26 10:35:15 -04:00
Ivan Chebykin 464ec44b00
Check for next_focus before assert 2018-05-26 15:54:49 +03:00
Ivan Chebykin 6e6b0decd9
Fix usage of sway_assert 2018-05-26 15:51:36 +03:00
Ivan Chebykin 820a8c9c2d
Moved visibility check of of loop, added asserts 2018-05-26 13:34:14 +03:00
Ivan Chebykin 740234a4bc
Break after first tabbed/stacked layout 2018-05-25 17:45:41 +03:00
Ivan Chebykin 53516fa03f
Fix mouse focusing for horizontal/vertical views in tabbed containers 2018-05-25 17:22:25 +03:00
Ivan Chebykin f85d3e15ba
Fixed styling issues 2018-05-25 16:54:43 +03:00
Ivan Chebykin e19fe56e2f
Focus inactive container instead of checking cursor position 2018-05-25 16:54:43 +03:00
Ivan Chebykin 3b67253312
Skip all nested containers 2018-05-25 16:54:43 +03:00
Ivan Chebykin c62efbb5ce
Implement correct focusing for tabbed containers 2018-05-25 16:54:43 +03:00
Ivan Chebykin c1be4b0153
Fix focusing from other containers 2018-05-25 16:54:43 +03:00
Ivan Chebykin 87af08966a
Don't focus tabbed and stacked containers on mouseover 2018-05-25 16:54:43 +03:00
Drew DeVault 8bbf78fdd4 Fix focus follows mouse with no focus 2018-05-21 17:21:01 -04:00
Ryan Dwyer efc07fb3d4 Don't track damage for views on inactive tabs 2018-05-21 20:16:56 +10:00
Ryan Dwyer c08f9bf257 Implement tabbed layout 2018-05-21 20:16:56 +10:00
Brian Ashworth 82cd55a670 Fix border commands from changing focus 2018-05-20 23:12:33 -04:00
Drew DeVault a3d3c819cf Fix focus_follows_mouse over swaybar
If you moved your mouse over swaybar (e.g. to scroll between
workspaces), focus would move to the workspace. This is not the right
thing to do. The solution is complicated by the fact that if you move
your mouse into a new output with an empty workspace, that workspace
_should_ receive focus.
2018-05-20 14:46:29 -04:00
Mattias Eriksson 8fbafbfab5 Idle handling for dpms/lockscreen et al
Swayidle handles idle events and allows
for dpms and lockscreen handling. It also
handles systemd sleep events, and can
raise a lockscreen on sleep

Fixes #541
2018-05-13 00:30:09 +02:00
emersion 50298dc901
Send pointer discrete axis values and source
Update for swaywm/wlroots#970
2018-05-12 13:56:17 +01:00
Ryan Dwyer 83e314bf51 Highlight all child borders when using focus parent 2018-05-11 09:20:46 +10:00
emersion 70b80b4698
Damage container on focus 2018-05-10 23:03:50 +01:00
Drew DeVault 029c9b1796
Merge pull request #1907 from emersion/backend-input-mapping
Default to backend-wise input device mapping, if any
2018-05-03 10:46:02 -04:00
Drew DeVault d233e75eec Hide cursor on touch down 2018-05-03 10:39:34 -04:00
emersion 424006089e
Default to backend-wise input device mapping, if any 2018-05-03 14:16:17 +01:00
Drew DeVault 52aa245b24 Implement basic touch support
This required changing container_at_cursor to container_at_coords so
that we could get the appropriate surface (and sx/xy) without moving the
cursor.

Future work:

- Simulate a cursor for clients which have not bound to wl_touch
- Keep sending motion events when moving outside the surface (#1892)
- Bind gestures to sway commands
2018-05-02 09:00:26 -04:00
emersion 976e6b99b6
Merge branch 'master' into refactor-arrange-windows 2018-04-29 13:10:59 +01:00
Ryan Dwyer 167c2e1aa9 Refactor arrange_windows()
Replaces arrange_windows() with arrange_root(), arrange_output(),
arrange_workspace() and arrange_children_of().

Also makes fullscreen views save and restore their dimensions, which
allows it to preserve any custom resize and is also a requirement for
floating views once they are implemented.
2018-04-28 11:26:14 +10:00
emersion 860d2384b4
Update for swaywm/wlroots#923 2018-04-27 17:30:45 +01:00
emersion ff61df17ff
Add map_from_region command 2018-04-26 10:53:47 +01:00
emersion 3ed3bdf03f
Fix segfault when switching back to workspace with osu! 2018-04-24 18:18:49 +01:00
emersion 4cf77e1de4
Default to current time when triggering cursor events 2018-04-21 14:07:22 +01:00
emersion 33ed279494
Update cursor when workspace focus changes 2018-04-21 12:46:48 +01:00
Drew DeVault 777800e37a Fix qutebrowser crash on context menu dismissal 2018-04-19 09:15:21 -04:00
Drew DeVault 21eb63cc9e
Merge branch 'master' into fullscreen 2018-04-19 08:56:03 -04:00
Ryan Dwyer 5b30391383 Make key repeat configurable
This creates two input commands for configuring the repeat delay and rate.

Example config:

    input "myidentifier" {
        repeat_delay 250
        repeat_rate 25
    }
2018-04-18 23:19:23 +10:00
Ryan Dwyer 8d06b222f0 Fullscreen rendering and input fixes.
* Render background when using fullscreen, because transparency.
* Check that fullscreen surface allows input.
* Don't look for surfaces in top layer if there's a fullscreen view.
2018-04-18 13:06:10 +10:00
Ryan Dwyer 35ccdd67a8 More fullscreen fixes.
* Render fullscreen views without wlr function, which makes popups and
lockscreen work.
* Don't allow input events to surfaces behind fullscreen views.
* Use correct output dimensions (for rotated outputs).
2018-04-18 08:35:28 +10:00
Ryan Dwyer c685ef081f Create sway_workspace struct. 2018-04-17 09:31:34 +10:00
Ryan Dwyer 52420cc24d Implement fullscreen. 2018-04-16 20:36:40 +10:00
db f555edf353 remove empty workspace when focusing its output
Until now, focus changing code only considered cleaning up the last focused
workspace. This commit adds removal of empty workspace from output that just
received focus on a different workspace.

Fixes: #1797
2018-04-15 08:30:30 +02:00
Dominique Martinet 1fd21650d7 seat_set_focus_wrap: fix use-after-free when destroying last focused container 2018-04-13 14:58:23 +09:00
Danny Bautista 1edb2bd892 Implement cursor event simulation with sway commands. 2018-04-10 12:40:50 -04:00
Drew DeVault 07b6be6214
Merge pull request #1769 from acrisci/focus-inactive-fixes
Focus inactive fixes
2018-04-08 16:05:03 -04:00
Drew DeVault 0e3ddf255e Add input "identifier" map_to_output "identifier" 2018-04-08 15:09:12 -04:00
Tony Crisci ae78f6fb93 Merge branch 'wlroots' into focus-inactive-fixes 2018-04-08 12:47:56 -04:00
Drew DeVault 9c5a88a7bd Fix cursor motion issues
Use only one canonical cursor x/y position and send cursor enter when
mouse is warped.

Tangentally related to #1714
2018-04-08 12:42:56 -04:00
emersion 5ebc99253a
Use wlr_surface_point_accepts_input for unmanaged surfaces 2018-04-08 11:43:18 -04:00
Tony Crisci 46280460a5 push all parents of focused container in focus stack 2018-04-08 11:34:38 -04:00
Drew DeVault 9114d3b84c Implement tablet tool support 2018-04-08 10:48:13 -04:00
Tony Crisci de811823b6 seat focus inactive children foreach 2018-04-07 16:14:12 -04:00
Tony Crisci c0f9ee7bd1 seat get focus inactive view 2018-04-07 16:06:36 -04:00
emersion 2b357af7ee
Give keyboard focus to unmanaged xwayland surfaces
This fixes dmenu
2018-04-07 14:03:30 -04:00
Drew DeVault 603e0e42c5 Add debug tree view 2018-04-06 11:49:27 -04:00
Drew DeVault cca420b2f8 Fix focus_follows_mouse issues 2018-04-06 09:32:51 -04:00
Drew DeVault b08f7e5183 Fix deletion of still-visible workspaces on unfocus 2018-04-06 09:26:49 -04:00
emersion 641807d920
Handle unmanaged surfaces motion 2018-04-05 18:48:35 -04:00
Tony Crisci 65f254f3fb Merge branch 'wlroots' into fix-focus-inactive 2018-04-04 22:36:09 -04:00
Tony Crisci deda37469a fix focus child 2018-04-04 22:31:10 -04:00
emersion 8eff00f723 Remove unused SWAY_VIEW_TYPES 2018-04-04 22:03:14 -04:00
Tony Crisci 3e61718053 try to fix focus-inactive 2018-04-04 18:52:38 -04:00
Drew DeVault d2d050d59c Address review feedback 2018-04-04 18:47:48 -04:00
Drew DeVault b7e7794912 Implement input-inhibit in sway, swaylock 2018-04-04 18:47:48 -04:00
Drew DeVault 06fbd51ff5 Add input inhibitor to input manager 2018-04-04 18:47:48 -04:00
Drew DeVault 3ede718c06 Refocus the last focused container on lock exit 2018-04-04 18:47:48 -04:00
Tony Crisci 741e3959e3 Merge branch 'wlroots' into split-containers2 2018-04-04 00:20:44 -04:00
Tony Crisci 97b171649d move output damage to workspace destructor 2018-04-03 19:36:57 -04:00
Tony Crisci b4c5f79725 move view and workspace destructors to container.c 2018-04-03 12:25:19 -04:00
Drew DeVault 0bf3b88019 Give layer shells under the shell layer focus 2018-04-02 21:17:16 -04:00
Drew DeVault 56078edd65 Give exclusive focus to layers above shell layer 2018-04-02 21:09:09 -04:00
Tony Crisci a89096278b Merge branch 'wlroots' into split-containers 2018-04-02 19:22:10 -04:00
Tony Crisci d434da5632 Merge branch 'wlroots' into split-containers 2018-04-02 16:09:27 -04:00
emersion a4a241697a
Merge branch 'wlroots' into view-redesign 2018-04-02 15:30:58 -04:00
emersion 2f64ce86c4
Xwayland unmanaged views aren't views anymore 2018-04-02 14:35:43 -04:00
Tony Crisci 357a4401fa address feedback 2018-04-02 14:15:40 -04:00
Tony Crisci 2187684bd0 Merge branch 'wlroots' into split-containers 2018-04-02 14:06:04 -04:00
Tony Crisci c7a6524954 fix segfault 2018-04-02 13:56:35 -04:00
Tony Crisci 5e024278a6 Merge branch 'wlroots' into seat-fixes 2018-04-02 13:23:43 -04:00
Tony Crisci 22287b42bf dont copy input config 2018-04-02 13:19:58 -04:00
Tony Crisci 35445b40a2 remove unused attachment config 2018-04-02 12:16:00 -04:00
Tony Crisci a82c107c76 80col 2018-04-02 11:44:42 -04:00
Drew DeVault b2d871cfe2 Partially implement move command
Works:

- move [container|window] to workspace <name>
    - Note, this should be able to move C_CONTAINER but this is untested
- move [workspace] to output [left|right|up|down|<name>]

Not implemented yet:

- move [left|right|up|down]
- move scratchpad
- move position
2018-04-02 11:12:18 -04:00
Tony Crisci 53bb7ea996 dont copy seat config on the seat 2018-04-02 10:37:31 -04:00
Tony Crisci 0828c77251 rename input-manager functions 2018-04-02 08:49:38 -04:00
Tony Crisci e677c5b204 rename seat functions 2018-04-02 08:45:37 -04:00
Tony Crisci eda425fdab fix some segfaults 2018-03-31 18:52:02 -04:00
Tony Crisci 2aec85bf24 clean up view destroy seat cleanup 2018-03-31 17:07:37 -04:00
Tony Crisci 6f7b33e691 handle container destroy in the seat 2018-03-31 15:38:59 -04:00
Tony Crisci 7706d83160 basic split containers 2018-03-31 15:37:16 -04:00
Drew DeVault 122b96abed
Merge pull request #1684 from swaywm/follow-warp
Implement focus_follows_mouse, mouse_warping
2018-03-31 15:32:29 -04:00
Drew DeVault f2332dc75c Address review feedback 2018-03-31 15:20:43 -04:00
Drew DeVault b9d2983324 Fix interaction between warping and following 2018-03-31 13:05:45 -04:00
Drew DeVault 9b38ef950f Implement focus_follows_mouse
Also contains two other small changes:

- Clicking any button will focus the container clicked (not just left)
- Remove seamless_mouse (doesn't make sense on wlroots)
2018-03-31 13:05:45 -04:00
Drew DeVault ae6d459000 Implement mouse warping 2018-03-31 13:05:45 -04:00
emersion 98b67e2399
Fix xwayland configure in set_size 2018-03-31 11:30:15 -04:00
Drew DeVault eb5a8e03ff Check for null container 2018-03-31 10:51:39 -04:00
Drew DeVault e4fd47d3a1
Merge pull request #1682 from emersion/unmanaged-no-container
Make it clear that unmanaged views don't have a container
2018-03-31 10:49:06 -04:00
Drew DeVault ccdcaa478f Fix bug with previous commit 2018-03-31 10:47:04 -04:00
emersion a44a71c116
Make it clear that unmanaged views don't have a container
view->swayc is NULL anyway.
2018-03-31 10:39:05 -04:00
Drew DeVault 8aa195e311 Fix #1104 2018-03-31 09:45:11 -04:00
Drew DeVault 5c08e13e50 Set Xwayland seat on focus
Necessary to make primary selection syncronize
2018-03-31 09:29:34 -04:00
emersion b237fa0b22
Set xwayland cursor 2018-03-31 00:24:38 -04:00
Drew DeVault 212b503992 Use wlr_surface_point_accepts_input 2018-03-30 23:08:24 -04:00
Drew DeVault f5470f3338 Pass pointer events to surface layers 2018-03-30 21:03:35 -04:00
emersion 9665642765
Merge branch 'wlroots' into client-cursors 2018-03-30 19:04:06 -04:00
emersion eb716c6c43
Fix segfaults when focusing a workspace 2018-03-30 16:12:02 -04:00
emersion 03255fd202
Fix pointer events for hidden workspaces 2018-03-30 15:33:16 -04:00
emersion 6c9d67b105
Handle set_cursor requests from clients
Allow clients to set a custom cursor if they have the seat's
pointer focus.
2018-03-30 10:53:18 -04:00
Drew DeVault 01af343912 Destroy empty workspaces when moving away 2018-03-30 10:47:19 -04:00