Commit graph

324 commits

Author SHA1 Message Date
Ryan Dwyer 834805f5e2 Fix crash when disconnecting output
We were freeing the sway_output immediately upon disconnect which left
a dangling pointer in the output's container. It then tried to use the
pointer when the container is freed.

We don't need to store the sway_output in an output's container which is
destroying, so the fix is to set the pointer to NULL and remove the use
in container_free.

Also added an arrange when the output is disconnected for good measure.
2018-06-26 19:40:42 +10:00
Ryan Dwyer 0085f64ac0 Remove timer when transaction destroys 2018-06-26 18:51:37 +10:00
Ryan Dwyer e8001e6fbe Damage output when views toggle fullscreen
Also add workspace to the transaction when a view maps in fullscreen
mode.
2018-06-26 14:24:15 +10:00
Ryan Dwyer 50190bc760 Rename view's free callback to destroy 2018-06-26 13:18:33 +10:00
Ryan Dwyer 7a922c65aa Damage output when a fullscreen view unmaps
Also moved the arranging into view_unmap to avoid excessive code
duplication.
2018-06-26 13:15:45 +10:00
Dominique Martinet c9be014557 xdg_shell: make view floating if a parent has been set
Prompts e.g. authentication request from firefox-wayland ought to be
floating.

This is a bit coarse but just fixed size is not enough, here is what
firefox does:
[1285461.363]  -> xdg_wm_base@18.get_xdg_surface(new id xdg_surface@68, wl_surface@71)
[1285461.508]  -> xdg_surface@68.get_toplevel(new id xdg_toplevel@67)
[1285461.571]  -> xdg_toplevel@67.set_parent(xdg_toplevel@37)
[1285461.630]  -> xdg_toplevel@67.set_title("Authentication Required")
[1285461.736]  -> xdg_toplevel@67.set_app_id("firefox")
...
[1285476.549] xdg_toplevel@67.configure(0, 0, array)
...
[1285502.080]  -> xdg_toplevel@67.set_min_size(299, 187)
[1285502.140]  -> xdg_toplevel@67.set_max_size(1920, 32767)

This can also be observed with e.g. the open window of gedit
(gedit->open->other documents)
2018-06-26 12:02:50 +09:00
Ryan Dwyer beacd4d9f9 Rename progress_queue to transaction_progress_queue 2018-06-25 16:50:01 +10:00
Ryan Dwyer c371ff3de8 Implement per-configure debug timings 2018-06-25 09:25:51 +10:00
Ryan Dwyer 289d696adc Implement transaction timings debug
Launch sway with SWAY_DEBUG=txn_timings to enable it.
2018-06-25 09:09:43 +10:00
emersion eeb38d65cb
xwayland: accept configure requests from floating views 2018-06-24 19:21:02 +01:00
Ryan Dwyer 1549fb719a Implement atomic layout updates for xwayland views 2018-06-24 23:01:09 +10:00
Ryan Dwyer 33e03cb277 Fix crash related to stacks and tabs 2018-06-24 13:08:47 +10:00
Ryan Dwyer f08a30d6d0 Force transactions to complete in order
This forces transactions to complete in order by using a singly linked
list stored in the sway server.
2018-06-24 12:33:23 +10: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
Ryan Dwyer 38398e2d77 Implement atomic layout updates for tree operations
This implements atomic layout updates for when views map, reparent or
unmap.
2018-06-23 16:24:11 +10:00
emersion cda66e9a26
Automatically float xwayland windows 2018-06-18 22:52:10 +01:00
Ryan Dwyer 1c89f32533 Preserve buffers during transactions
* Also fix parts of the rendering where it was rendering the pending
state instead of current.
2018-06-18 20:42:12 +10:00
Ryan Dwyer 645bf446fa Merge remote-tracking branch 'upstream/master' into atomic 2018-06-18 15:58:48 +10:00
emersion 088cae45c8 Update for swaywm/wlroots#1060 2018-06-16 13:32:23 -04:00
Ryan Dwyer 9e96cfd310 Merge remote-tracking branch 'upstream/master' into atomic 2018-06-11 11:03:43 +10:00
emersion cfd02918c0
Render drag icons 2018-06-09 13:26:03 +01:00
emersion 88cd7616db
Fix compilation errors related to disabled outputs 2018-06-09 11:38:16 +01:00
Ryan Dwyer bb66e6d578 Refactor everything that needs to arrange windows
* The arrange_foo functions are now replaced with arrange_and_commit, or
with manually created transactions and arrange_windows x2.
* The arrange functions are now only called from the highest level
functions rather than from both high level and low level functions.
* Due to the previous point, view_set_fullscreen_raw and
view_set_fullscreen are both merged into one function again.
* Floating and fullscreen are now working with transactions.
2018-06-09 10:11:25 +10:00
Ryan Dwyer f9e6d703d2 Make main properties be the pending state 2018-06-09 10:08:43 +10:00
Ryan Dwyer 59c9488701 WIP: Atomic layout updates ground work 2018-06-09 10:08:43 +10:00
Brian Ashworth e072fbc6d9 Switch output storing from list_t to wl_list 2018-06-06 20:11:24 -04:00
Brian Ashworth a0bbe67076 Address emersions comments on output re-enabling 2018-06-06 20:11:24 -04:00
Brian Ashworth a1b5b93d29 Store sway_outputs so that they can be reenabled 2018-06-06 20:11:24 -04:00
emersion 0f71547032
Merge pull request #2095 from emersion/fullscreen-damage-only-visible
Only send frame to visible surfaces when fullscreened
2018-06-05 11:18:52 +01:00
Ryan Dwyer 1206a60977 Don't restore focus if unmapping surface wasn't focused 2018-06-04 13:31:09 +10:00
Ryan Dwyer 9253278328 Restore focus when unmapping layer shell surfaces 2018-06-04 11:31:07 +10:00
Ryan Dwyer 74799937cf Restore focus when unmapping unmanaged xwayland surfaces 2018-06-04 11:30:26 +10:00
emersion 55b855d867
Add SWAY_DAMAGE_DEBUG
Setting it to "rerender" will always re-render everything
regardless of the damaged region. Setting it to "highlight" will
clear the screen and render only damaged regions.
2018-06-02 21:57:34 +01:00
emersion 34bdf25bb5
Only send frame to visible surfaces when fullscreened 2018-06-02 20:56:33 +01:00
emersion 51eee3aecc
Schedule a frame even if damage is empty 2018-06-02 20:42:26 +01:00
emersion 65845be802
Only send frame done to visible views
Also don't accumulate empty damage
2018-06-02 15:19:03 +01:00
Ryan Dwyer d466b8fa7b Don't auto float xdg views if their dimensions are not set 2018-06-01 23:14:58 +10:00
Ryan Dwyer c9e3a313b4 Fix fullscreen position of xwayland views 2018-06-01 23:14:58 +10:00
Ryan Dwyer 9119f87655 Fix floating position when view is floated when mapped 2018-06-01 23:14:58 +10:00
Ryan Dwyer 97672295ed Don't unmaximize floating views 2018-06-01 23:14:58 +10:00
Ryan Dwyer becceafa7f Remove unfinished wants_floating implementation for xwayland 2018-06-01 23:14:58 +10:00
Ryan Dwyer 5b1601c2e3 Don't let xwayland views set position unless unmanaged 2018-06-01 23:14:58 +10:00
Ryan Dwyer 02d385e06f Use swayc rather than wlr_output when rendering 2018-06-01 23:14:58 +10:00
Ryan Dwyer 3b1db30a5e Use surface size if xdg shell's geometry isn't set 2018-06-01 23:14:58 +10:00
Ryan Dwyer 4371c746e4 Implement wants_floating for xdg_shell and xdg_shell_v6 2018-06-01 23:14:58 +10:00
Ryan Dwyer 3281574fa3 Remove check for if floating view intersects output 2018-06-01 23:14:58 +10:00
Ryan Dwyer 7d2b33a458 Render floating views before top layer and unmanaged 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 02de2a6f65 Rename set_maximized functions to set_tiled 2018-06-01 23:14:58 +10:00
Ryan Dwyer dc83b158e1 Fix issues with sticky containers and workspaces
* Attach sticky containers to new workspaces when switching
* Fire the close event *before* we start destroying the workspace to
prevent a crash

Because the sticky container now follows the visible workspace, this
simplifies the rendering and container_at logic.
2018-06-01 23:14:58 +10:00
Ryan Dwyer 754cb7944c Respect view's border config for floating containers 2018-06-01 23:14:58 +10:00
Ryan Dwyer aaba7642b3 Replace is_floating boolean with function 2018-06-01 23:14:58 +10:00
Ryan Dwyer 34f35f0bad Use L_FLOATING instead of reapable boolean 2018-06-01 23:14:58 +10:00
Ryan Dwyer 1f2e399ade Implement floating 2018-06-01 23:14:58 +10:00
Drew DeVault 71db8de4be Render floating views 2018-06-01 23:14:58 +10:00
Brian Ashworth 205a1732cf Force fullscreen views to be fully opaque 2018-05-28 13:55:38 -04:00
emersion b350e8ec82
xdg-shell: make all toplevels tiled 2018-05-27 13:28:37 +01:00
Ryan Dwyer f6c3682c05 Use constants for titlebar dimensions 2018-05-22 08:27:42 +10:00
Ryan Dwyer 664169fbf1 Implement stacked layout 2018-05-22 08:27:24 +10:00
Ryan Dwyer 048b29527b Pre-multiply alpha for tab decorations 2018-05-21 20:16:56 +10:00
Ryan Dwyer 90607dc329 Add left/right borders to tabs 2018-05-21 20:16:56 +10:00
Ryan Dwyer 5ab4930185 Fix tab border issues 2018-05-21 20:16:56 +10: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 750a497a8b Pre-multiply alpha for non-textures 2018-05-20 09:33:47 -04:00
Konstantin Pospelov fcc11f9771 Fix pixel bar below title
This commit changes how the left and right indents are calculated for the
title bottom pixel bar, so that it is displayed properly in case the left or
right border is hidden.
2018-05-19 18:39:01 +03:00
Ryan Dwyer f0212d66ee Update marks textures on output scale event 2018-05-17 08:29:14 +10:00
Ryan Dwyer ebb0d051db Fix many border opacity issues 2018-05-17 08:29:14 +10:00
Ryan Dwyer 0e2cc0af30 Implement show_marks 2018-05-17 08:29:14 +10:00
emersion 79e970d86e
Correctly clip title texture if necessary 2018-05-15 08:38:28 +01:00
Brian Ashworth 9ba0dca7ba
Merge branch 'master' into fix-1975 2018-05-14 09:06:23 -04:00
Brian Ashworth 77b42ec821 Always render top border for border normal 2018-05-14 09:04:18 -04:00
emersion 95a10dd4f3
Kill wl_shell 2018-05-14 13:26:10 +01:00
Brian Ashworth 34b864fb17
Merge branch 'master' into fix-1975 2018-05-14 00:28:21 -04:00
Brian Ashworth 6ff7c52736 Fix titles and detect edges for hide_edge_borders 2018-05-14 00:20:34 -04:00
Ryan Dwyer 8432d8a15e xdg_shell: Replace get_prop with get_string_prop 2018-05-14 11:47:39 +10:00
Ryan Dwyer 1e9aaa54a8 Revert "Revert "Merge pull request #1943 from RyanDwyer/criteria-improvements""
This reverts commit 32a572cecf.

This reimplements the criteria overhaul in preparation for fixing a
known bug.
2018-05-14 11:38:09 +10:00
emersion 88d9d43b36
Add xdg-shell stable support 2018-05-13 16:38:56 +01:00
Ryan Dwyer 90e6dfa268
Merge branch 'master' into edge-borders 2018-05-13 11:45:11 +10:00
emersion 360e63b8a7
Don't destroy view child on xdg-popup unmap 2018-05-12 19:33:38 +01:00
Brian Ashworth 2adf23c2a3 Only count views for hide_edge_borders smart 2018-05-12 12:56:26 -04:00
Brian Ashworth e3625d8f33 Count descendant views for hide_edge_borders smart 2018-05-12 12:37:48 -04:00
Drew DeVault 32a572cecf Revert "Merge pull request #1943 from RyanDwyer/criteria-improvements"
This reverts commit 3e1bf721c6, reversing
changes made to 2217518bd5.
2018-05-12 08:52:54 -04:00
Brian Ashworth 3db7fc2bb2 Implement hide_edge_borders 2018-05-11 18:44:56 -04:00
Ryan Dwyer 3b0c26d149 Overhaul criteria implementation
The criteria struct now uses properties for each token type rather than
the list_t list of tokens. The reason for this is that different token
types have different data types: pcre, string and number to name a few.
This solution should be more flexible moving forward. A bonus of this is
that criteria is now easier to understand when looking at the struct
definition.

The criteria parser has been rewritten because the previous one didn't
support valueless pairs (eg. [class="foo" floating]).

Criteria now has types. Types at the moment are CT_COMMAND,
CT_ASSIGN_WORKSPACE and CT_ASSIGN_OUTPUT. i3 uses types as well.
Previously the assign command was creating a criteria with 'move to
workspace <name>' as its command, but this caused the window to appear
briefly on the focused workspace before being moved to the assigned
workspace. It now creates the view directly in the assigned workspace.

Each view will only execute a given criteria once. This is achieved by
storing a list of executed criteria in the view. This is the same
strategy used by i3.

Escaping now works properly. Previously you could do things like
[class="Fire\"fox"] and the stored value would be 'Fire\"fox', but it
should be (and now is) 'Fire"fox'.

The public functions in criteria.c are now all prefixed with criteria_.

Xwayland views now listen to the set_title, set_class and
set_window_type events and criteria will be run when these happen. XDG
shell has none of these events so it continues to update the title in
handle_commit.

Each view type's get_prop function has been split into get_string_prop
and get_int_prop because some properties like the X11 window ID and
window type are numeric.

The following new criteria tokens are now supported:

* id (X11 window ID)
* instance
* tiling
* workspace
2018-05-11 09:38:53 +10:00
Ryan Dwyer 83e314bf51 Highlight all child borders when using focus parent 2018-05-11 09:20:46 +10:00
emersion 44fcc06efd
Fix damage tracking on HiDPI 2018-05-10 23:22:00 +01:00
emersion 90614f3a63
Accumulate surface damage even if whole=true 2018-05-10 23:03:51 +01:00
emersion bec80f1551
Damage borders when damaging view 2018-05-10 23:03:50 +01:00
emersion 98f7ee8f59
Render borders with damage 2018-05-10 23:03:50 +01:00
emersion c8a9ea3903
Implement full damage tracking 2018-05-10 23:02:37 +01:00
emersion 3d29e73e72
layer-shell: use usable_area when arranging non-exclusive layer surfaces 2018-05-10 12:19:38 +01:00
Ryan Dwyer 4922d269b8 Fix titles on rotated outputs
If the output is rotated, the scissor box needs to be transformed in the
opposite rotation.
2018-05-09 16:41:54 +10:00
Ryan Dwyer 228c478e8d Implement title_format
This implements the title_format command, with a new placeholder %shell
which gets substituted with the view type (xwayland, xdg_shell_v6 or
wl_shell).

Example config:

    for_window [title=".*"] title_format %title (class=%class instance=%instance shell=%shell)
2018-05-05 22:29:37 +10:00
Ryan Dwyer e83e5487be Use scissor to render title texture
This allows the title's texture to always be the full width of the text,
and clipped at render time according to the desired width (eg. tabs...).

As an added bonus, the texture no longer needs to be updated when
containers are arranged.
2018-05-05 20:32:31 +10:00
Ryan Dwyer 74d1367fac Update titles when surfaces are committed 2018-05-03 15:42:49 +10:00
Ryan Dwyer b667298a0a Render titles 2018-05-03 15:12:00 +10:00
Ryan Dwyer daab8e3503 Support alpha in border colours
The alpha component is merged with the container's opacity.

Completes #1882.
2018-05-02 08:40:38 +10:00
db 22170bde77 Fix layer surface crash on output destroy
Before freeing sway_output, NULL the wlr_output reference to it. Check for that
NULL in layer_shell handle_destroy. Don't damage null container in unmap.
Additionaly, terminate swaybg if its output is being disabled.
2018-05-01 19:05:32 +02:00
Ryan Dwyer a19a511b90 Implement indicator border 2018-05-01 19:21:29 +10:00