Commit graph

379 commits

Author SHA1 Message Date
Ryan Dwyer d10ccc1eb1 Correctly track saved surfaces during multiple transactions
Fixes #2364.

Suppose a view is 600px wide, and we tell it to resize to 601px during a
resize operation. We create a transaction, save the 600px buffer and
send the configure. This buffer is saved into the associated
instruction, and is rendered while we wait for the view to commit a
601px buffer.

Before the view commits the 601px buffer, suppose we tell it to resize
to 602px. The new transaction will also save the buffer, but it's still
the 600px buffer because we haven't received a new one yet.

Then suppose the view commits its original 601px buffer. This completes
the first transaction, so we apply the 601px width to the container.
There's still the second (now only) transaction remaining, so we render
the saved buffer from that. But this is still the 600px buffer, and we
believe it's 601px. Whoops.

The problem here is we can't stack buffers like this. So this commit
removes the saved buffer from the instructions, places it in the view
instead, and re-saves the latest buffer every time the view completes a
transaction and still has further pending transactions.

As saved buffers are now specific to views rather than instructions, the
functions for saving and removing the saved buffer have been moved to
view.c.

The calls to save and restore the buffer have been relocated to more
appropriate functions too, favouring transaction_commit and
transaction_apply rather than transaction_add_container and
transaction_destroy.
2018-08-01 16:24:15 +10:00
emersion 15c19572cf Fix segfault with fullscreen 2018-07-30 19:44:07 +01:00
Drew DeVault cbd0c3ec40
Merge pull request #2367 from emersion/iterator-redesign
Refactor surface iterators
2018-07-30 13:12:22 -04:00
Brian Ashworth b8efdeae29 Fix title textures on scale change 2018-07-30 01:59:20 -04:00
emersion 9a7e436fad Don't give focus if xwayland window has a type hint 2018-07-29 17:28:21 +01:00
emersion 0ad865f0b7 Make output_surface_for_each_surface_iterator static 2018-07-29 14:34:48 +01:00
emersion 9951b2ec33 Remove unused output_from_wlr_output 2018-07-29 14:33:26 +01:00
emersion fe0750fec1 Remove output_surface_for_each_surface from header 2018-07-29 14:33:26 +01:00
emersion 8d5cc8625c Completely switch over to new iterators 2018-07-29 14:33:26 +01:00
emersion e9d674cfd2 wip: redesign output_view_for_each_surface iterator 2018-07-29 14:33:26 +01:00
emersion a0dd977617 wip: redesign output_layer_for_each_surface iterator 2018-07-29 14:33:26 +01:00
emersion dbf6dd0dae wip: redesign output_drag_icons_for_each_surface iterator 2018-07-29 14:33:26 +01:00
emersion d2172bd331 wip: redesign output_unmanaged_for_each_surface iterator 2018-07-29 14:33:26 +01:00
Drew DeVault 53069f1403
Merge pull request #2360 from RyanDwyer/floating-containers
Allow containers to float
2018-07-28 09:30:12 -04: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 a4bcddcfdc Include errno.h 2018-07-28 22:40:43 +10:00
Ryan Dwyer d6daf10cad Show errno description in log 2018-07-28 22:40:43 +10:00
Ryan Dwyer 32663b7b01 Handle out-of-fd situations gracefully for transaction and urgent timers 2018-07-28 22:40:43 +10:00
Ryan Dwyer 52cf410d3c Second attempt at fixing transaction use-after-free
The solution used in 073ac425d5 doesn't
work in all cases because the freed instruction might be ahead in the
list, not necessarily behind.

The new solution delays running the queue until after the loop has
finished iterating, thus avoiding the problem completely.
2018-07-28 17:43:18 +10:00
Ryan Dwyer 073ac425d5 Fix use after free in transactions
In set_instructions_ready, calling set_instruction_ready may cause any
number of transactions to get applied, which removes them from the list
being iterated.  The iteration variables need to be adjusted
accordingly.
2018-07-28 15:21:39 +10:00
Ryan Dwyer 868dcde14e Fix indent 2018-07-26 08:28:05 +10:00
Ryan Dwyer 27a20a4884 Allow containers to be fullscreen 2018-07-26 08:27:07 +10:00
Drew DeVault 53dbe2da4b
Merge pull request #2353 from emersion/render-opaque-overlay
Improve rendering with a fullscreen opaque overlay surface
2018-07-25 08:32:32 -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
emersion 0e79b2114c Improve rendering with a fullscreen opaque overlay surface
The rendering code doesn't use the exclusive input surface at all
anymore to decide to skip rendering of shell surfaces. This fixes
a weird situation in which a client requests exclusive input but
isn't an overlay layer surface.

The renderer also renders all overlay surfaces in this situation,
not just one. This simplifies the code and fixes rendering when
there are more than one overlay surfaces (e.g. for a virtual
keyboard to type the lockscreen password).
2018-07-25 08:55:41 +01: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
Drew DeVault f4b882475e Merge branch 'master' into pid-workspaces 2018-07-23 20:31:11 -04:00
somdoron 7ead2e85a7 fix crash on new output while swaylock is running 2018-07-23 19:35:40 +03:00
emersion 238c8afc74 Handle set_{title,app_id} for xdg-shell and zxdg-shell-v6
This allows to update the title even if the view doesn't commit.
This is useful e.g. when a terminal sets its toplevel title to
the currently running command and when the view isn't visible.
2018-07-22 22:20:07 +01: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 cf5f5eaf8c Deny move/resize events for tiled xdg shell views 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 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 31f91bd483 Improve resize performance by partially flushing the transaction queue
When interactively resizing some views (eg. Nautilus), new transactions
are added to the queue faster than the client can process them.
Previously, we would wait for the entire queue to be ready before
applying any of them, but in this case the transactions would time out,
giving the client choppy performance.

This changes the queue handling so it applies the transactions up to the
first waiting transaction, without waiting for the entire queue to be
ready.
2018-07-22 23:10:19 +10:00
Ryan Dwyer f9491c9584 Fix damage issue when moving and resizing 2018-07-22 23:10:19 +10:00
Ryan Dwyer c2ed3d8bd6 Implement force_display_urgency_hint
The directive sets the timeout before an urgent view becomes normal
again after switching to it from another workspace.

Also:

* When an xwayland surface removes the urgent hint while the timer is
active, we now ignore the request. This happens as soon as the view
receives focus, so it was effectively making the timer pointless.
* The timeout is now only applied when switching to it from another
workspace.
2018-07-21 10:28:07 +10:00
emersion 4154234eee Update for swaywm/wlroots#1148 2018-07-19 21:54:46 +01:00
Ryan Dwyer 63d6233fcb Allow xwayland views to become urgent when on a non-visible workspace
This removes the urgency stuff from the commit handler and puts it in a
new set_hints handler instead. This allows the xwayland surface to
become urgent without having to commit (which doesn't happen if it's on
an non-visible workspace).
2018-07-19 21:08:51 +10:00
emersion 747725b8bb Don't unfocus when an override redirect window is mapped 2018-07-18 20:00:48 +01:00
emersion fb4eca5d56 Handle xwayland override_redirect flag change
This fixes syncplay menus.
2018-07-18 19:10:08 +01:00
frsfnrrg 3931cb85b2 Fix memory leak in sway/desktop/idle_inhibit_v1.c 2018-07-17 11:35:24 -04:00
frsfnrrg 37471ac649 Fix memory leak in handle_layer_shell_surface 2018-07-17 11:35:24 -04:00
Ryan Dwyer 75c699db62 Implement default_floating_border command and adjust CSD behaviour 2018-07-17 10:14:33 +10:00
Ryan Dwyer af5f736277 Render containers as urgent if they have an urgent child 2018-07-16 18:22:27 +10:00
Ryan Dwyer e3f90f00fe Implement xwayland urgency hint 2018-07-16 08:42:34 +10:00
Ryan Dwyer 315d5311b2 Implement urgency base functionality
Introduces a command to manually set urgency, as well as rendering of
urgent views, sending the IPC event, removing urgency after focused for
one second, and matching urgent views via criteria.
2018-07-16 08:19:25 +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
Drew DeVault 53e3f35ba3
Merge pull request #2272 from RyanDwyer/simplify-transactions
Simplify transactions by using a dirty flag on containers
2018-07-15 05:01:25 -07:00