Commit Graph

130 Commits

Author SHA1 Message Date
Ryan Dwyer f5dc3ac09d Don't call send_pointer_notify_button when doing move or resize 2018-08-08 22:32:59 +10:00
Ryan Dwyer 4c5dc6f135 Focus floating views when beginning move/resize operations 2018-08-08 22:28:13 +10:00
Ryan Dwyer c17f0870ef Fix crash when moving cursor over a fullscreen split container
Calling container_at_view fails an assertion if the container isn't a
view. Calling tiling_container_at works correctly, as that function
checks if the container is a view and calls container_at_view if so.
2018-08-03 18:08:20 +10:00
emersion b336564511 Fix pointer events for fullscreen views 2018-08-02 22:48:43 +01:00
minus e72f86784c Fix crash on mouse motion on fullscreen container
container_at expects a workspace, not the fullscreened container.
Fixes #2409
2018-08-02 23:19:01 +02:00
Ryan Dwyer 8392eae40f Revert "Revert "Fix popups""
This reverts commit 9aa258d33a.

Reverting the revert, so that popups can be fixed.
2018-08-02 23:36:36 +10:00
Drew DeVault 9aa258d33a Revert "Fix popups"
This reverts commit de86d65627.
2018-08-02 09:05:46 -04:00
Drew DeVault 9564c73c0d
Merge pull request #2391 from RyanDwyer/fix-popups-v2
Fix popups (v2)
2018-08-01 22:02:12 -04:00
Ian Fan 03eaf444a4 ipc: prevent emitting a workspace::focus event when moving a container to a different workspace or output
When a container is moved from, say, workspace 1 to workspace 2, workspace 2 is focused in order to arrange the windows before focus is moved back to workspace 1, which caused a workspace:focus event from workspace 2 to workspace 1 to be emitted. This commit inhibits that event.
2018-08-01 16:57:15 +01:00
Ryan Dwyer de86d65627 Fix popups
Fixes the render and container_at order for popups.

Fixes #2210

For rendering:

* render_view_surfaces has been renamed to render_view_toplevels
* render_view_toplevels now uses output_surface_for_each_surface (which
is now public), as that function uses wlr_surface_for_each_surface which
doesn't descend into popups
* Views now have a for_each_popup iterator, which is used by the
renderer to render the focused view's popups
* When rendering a popup, toplevels (xdg subsurfaces) of that popup are
also rendered

For sending frame done, the logic has been updated to match the
rendering logic:

* send_frame_done_container no longer descends into popups
* for_each_popup is used to send frame done to the focused view's popups
and their child toplevels

For container_at:

* floating_container_at is now static, which means it had to be moved
higher in the file.
* container_at now considers popups for the focused view before checking
containers.
* tiling_container_at has been introduced, so that it doesn't call
container_at recursively (it would check popups recursively if it did)
2018-07-31 18:41:30 +10:00
Ryan Dwyer 0b6b6716e2 Fix clicking a floating split container
It would focus the split container rather than the child.

This commit makes it track the child and the split container separately
and send the surface click to the child.
2018-07-28 22:41:04 +10:00
Ryan Dwyer 08cfba2192 Allow containers to float
Things worth noting:

* When a fullscreen view unmaps, the check to unset fullscreen on the
workspace has been moved out of view_unmap and into container_destroy,
because containers can be fullscreen too
* The calls to `container_reap_empty_recursive(workspace)` have been
removed from `container_set_floating`. That function reaps upwards so it
wouldn't do anything. I'm probably the one who originally added it...
* My fix (b14bd1b0b1) for the tabbed child
crash has a side effect where when you close a floating container, focus
is not given to the tiled container again. I've removed my fix and
removed the call to `send_cursor_motion` from `seat_set_focus_warp`. We
should consider calling it from somewhere earlier in the call stack.
2018-07-28 22:41:04 +10:00
Ryan Dwyer 27a20a4884 Allow containers to be fullscreen 2018-07-26 08:27:07 +10:00
Drew DeVault fc718f629a
Merge pull request #2350 from ppascher/xwayland-optional
Added meson option to allow building sway without xwayland support
2018-07-25 08:27:40 -04:00
Pascal Pascher f95cb9a7c1 reverted includes of "sway/config.h" and replaced with "config.h" from meson build 2018-07-25 13:32:20 +02:00
Pascal Pascher 79a45d4a40 more style fixes, included "sway/config.h" where needed 2018-07-25 12:17:10 +02:00
Brian Ashworth 3a75bb7f32 Change button var passed to seat_begin_move 2018-07-24 18:52:54 -04:00
Brian Ashworth dca02944ce Implement floating_modifier <mod> [inverse|normal] 2018-07-24 18:41:08 -04:00
Pascal Pascher 2bf893248a style fixes, exclude sway/desctop/xwayland.c when enable_xwayland: false 2018-07-24 23:37:41 +02:00
Pascal Pascher 24ad1c3983 Added meson option "enable_xwayland" (default: true) to enable/disable xwayland support 2018-07-24 22:16:06 +02:00
Ryan Dwyer 2f1b84a0f3 Fix crash when clicking certain surfaces
cont was NULL.
2018-07-24 21:12:24 +10:00
Ryan Dwyer e7c10f1871 Make mod+resize work in any direction
This makes it so if you hold mod and right click on a surface to resize
it, the resize direction is chosen based on which quarter of the surface
you've clicked. The previous implementation only resized towards the
bottom right.
2018-07-24 20:20:00 +10:00
frsfnrrg 94dd8823a0 Invoke mouse bindings
The mouse binding logic is inspired/copied from the
keyboard binding logic; we store a sorted list of the
currently pressed buttons, and trigger a binding when
the currently pressed (or just recently pressed, in
the case of a release binding) buttons, as well as
modifiers/container region, match those of a given
binding.

As the code to execute a binding is not very keyboard
specific, keyboard_execute_command is renamed to
seat_execute_command and moved to where the other
binding handling functions are. The call to
transaction_commit_dirty has been lifted out.
2018-07-23 21:38:29 -04:00
Ryan Dwyer 0db6f2ef58 Fix some cases where the cursor doesn't update
cursor_set_image only uploads the named image if it doesn't match the
previous named image. This means when setting the cursor image to a
surface as given by a client, we have to clear the currently stored
image.
2018-07-24 09:09:49 +10:00
Ryan Dwyer d21d4b83a3 Set cursor when beginning resize and move operations 2018-07-22 23:10:19 +10:00
Ryan Dwyer 009b426024 Fix damage when shrinking a floating view using cursor 2018-07-22 23:10:19 +10:00
Ryan Dwyer 5ba2ae9c6a Implement request_move and request_resize for xwayland views
I discovered we have to send a click event when ending the move or
resize operation to make xwayland's requests work correctly.
2018-07-22 23:10:19 +10:00
Ryan Dwyer 3faceadffe Fix focus bug with floating containers 2018-07-22 23:10:19 +10:00
Ryan Dwyer 011d1ebfa4 Consider view's min/max sizes when resizing 2018-07-22 23:10:19 +10:00
Ryan Dwyer 9df660ee31 Store last button and use it when views request to move or resize 2018-07-22 23:10:19 +10:00
Ryan Dwyer 6767d8a593 Prevent re-uploading the same cursor image multiple times 2018-07-22 23:10:19 +10:00
Ryan Dwyer 0c87bff5d1 Replace static handle_end_operation with seat_end_mouse_operation 2018-07-22 23:10:19 +10:00
Ryan Dwyer ff445cc855 Implement xdg shell request_move and request_resize events
Also does a few other related things:

* Now uses enum wlr_edges instead of our own enum resize_edge
* Now uses wlr_xcursor_get_resize_name and removes our own
find_resize_edge_name
* Renames drag to move for consistency
2018-07-22 23:10:19 +10:00
Ryan Dwyer 1b3b75a094 Use wlr_keyboard_get_modifiers 2018-07-22 23:10:19 +10:00
Ryan Dwyer dd337127d8 Use separate function for choosing edge cursor 2018-07-22 23:10:19 +10:00
Ryan Dwyer 350e9ea929 Fix clicking xwayland menus 2018-07-22 23:10:19 +10:00
Ryan Dwyer c299b6b5cd Use max multiplier when resizing while preserving ratio 2018-07-22 23:10:19 +10:00
Ryan Dwyer 2c6616050a Make mod + resize do it from the top left corner 2018-07-22 23:10:19 +10:00
Ryan Dwyer 3aadf944ae Use WLR_MODIFIER_SHIFT 2018-07-22 23:10:19 +10:00
Ryan Dwyer 9fbe13b9be Implement floating_modifier and mouse operations for floating views
This implements the following:

* `floating_modifier` configuration directive
* Drag a floating window by its title bar
* Hold mod + drag a floating window from anywhere
* Resize a floating view by dragging the border
* Resize a floating view by holding mod and right clicking anywhere on
the view
* Resize a floating view and keep aspect ratio by holding shift while
resizing using either method
* Mouse cursor turns into resize when hovering floating border or corner
2018-07-22 23:10:19 +10:00
Ryan Dwyer 8533c35a9f Fix crash and render issues involving cursor_send_pointer_motion
Fixes #2303, as well as a crash.

To replicate the crash:

* Have multiple outputs
* In config: for_window [<criteria>] workspace foo
* Also in config: workspace foo output <left-output-name>
* Focus the right output, and ensure workspace foo doesn't exist
* Launch the app that triggers the criteria

When the view maps, it calls workspace_switch which calls
send_set_focus which calls cursor_send_pointer_motion which calls
transaction_commit_dirty. This call to transaction_commit_dirty is not
meant to happen at this time because the tree isn't guaranteed to be in
a consistent state, but I'm not sure how exactly this leads to the crash
or render issues.

In this case the transaction is already committed by the view
implementation's handle_map function. So the solution is to remove it
from cursor_send_pointer_motion and add it to the other functions in
cursor.c which call cursor_send_pointer_motion.
2018-07-19 19:49:50 +10:00
Ryan Dwyer a120d4c79f Make focus part of transactions
Rather than maintain copies of the entire focus stack, this PR
transactionises the focus by introducing two new properties to the
container state and using those when rendering.

* `bool focused` means this container has actual focus. Only one
container should have this equalling true in its current state.
* `struct sway_container *focus_inactive_child` points to the immediate
child that was most recently focused (eg. for tabbed and stacked
containers).
2018-07-15 22:08:26 +10:00
emersion 63b4bf5000
Update for swaywm/wlroots#1126 2018-07-09 22:54:30 +01:00
Brian Ashworth c833ae64bc Fix pointer button events for layer surfaces 2018-07-05 23:01:35 -04:00
Tony Crisci e9ad10c2d6 dont focus-follow-mouse when keyboard grab 2018-06-24 20:30:43 -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 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