Commit graph

163 commits

Author SHA1 Message Date
Ryan Dwyer
93696b78ec Fix crash when closing output window from outer session
Emitting the close event needs to happen before
container_output_destroy, because container_output_destroy sets the
sway_output to NULL and sway_output is used in IPC.
2018-06-26 20:14:58 +10:00
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
a3976e2659 Fix another crash when moving out of stacks or tabs 2018-06-24 23:07:52 +10:00
Ryan Dwyer
b864ac0149 Fix crash when unmapping a view with reapable parents
container_destroy was calling container_reap_empty, which calls
container_destroy and so on. Eventually the original container_destroy
would return a NULL pointer to the caller which caused a crash.

This also fixes an arrange on the wrong container when moving views in
and out of stacks.
2018-06-24 15:50:53 +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
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
9e96cfd310 Merge remote-tracking branch 'upstream/master' into atomic 2018-06-11 11:03:43 +10:00
Nate Symer
6a910b9ba5 Implement gaps (PR #2047) 2018-06-09 09:34:56 -04: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
59c9488701 WIP: Atomic layout updates ground work 2018-06-09 10:08:43 +10:00
Brian Ashworth
e2b2fb0a0e Switch restore workspaces to a nested for-loop 2018-06-08 13:08:00 -04:00
Brian Ashworth
5c9a917df9 Restore workspaces to outputs based on priority 2018-06-08 13:08:00 -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
Ryan Dwyer
8289e30308 Fix potential crash when destroying workspace
`_container_destroy` emits a destroy event, and any listener for this
event should have access to the full container, not a half destroyed
one.

`_container_destroy` also destroys the swayc, so we have to grab a
reference to the sway_workspace so we can free it afterwards.

This also fixes a memory leak where the floating container wasn't freed.

Fixes #2092.
2018-06-03 10:28:24 +10:00
Ryan Dwyer
97672295ed Don't unmaximize floating views 2018-06-01 23:14:58 +10:00
Ryan Dwyer
d4ed204d4d Remove container_self_or_parent_floating 2018-06-01 23:14:58 +10:00
Ryan Dwyer
70f5d6fcf3 Rename container_set_geometry_from_view 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
13a4b0512e Fix unfullscreening a floating view 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
Ryan Dwyer
6f4cb2b29d Add tree representation to IPC workspace description 2018-05-29 17:42:11 +10:00
Ryan Dwyer
7c7d24600b Fix ancestor typos 2018-05-28 12:45:42 +10:00
Brian Ashworth
fd137c4f05 Send workspace::move in container_output_destroy 2018-05-27 12:27:18 -04:00
emersion
9c0cc98d07
Don't move empty workspaces when output is destroyed 2018-05-27 16:58:31 +01:00
Ryan Dwyer
db38b9bbf3 Clean up container title functions
* Add and use lenient_strcat and lenient_strncat functions
* Rename `concatenate_child_titles` function as that's no longer what it
does
* Rename `container_notify_child_title_changed` because we only need to
notify that the tree structure has changed, not titles
* Don't notify parents when a child changes its title
* Update ancestor titles when changing a container's layout
	* Eg. create nested tabs and change the inner container to stacking
* No need to store tree presentation in both container->name and
formatted_title
2018-05-25 21:07:59 +10:00
Ryan Dwyer
5354988317 Implement clicking stacked title bars 2018-05-22 08:43:00 +10:00
Ryan Dwyer
f6c3682c05 Use constants for titlebar dimensions 2018-05-22 08:27:42 +10:00
Ryan Dwyer
4672cb7ccf Use class or app_id in tree representation 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
bd79584f65 Add assertion in container_at_view 2018-05-21 20:16:56 +10:00
Ryan Dwyer
c08f9bf257 Implement tabbed layout 2018-05-21 20:16:56 +10:00
Ryan Dwyer
9fd28aea8c Rebuild textures if needed when moving a container
When moving a container to an output which has a different scale than
the previous, rebuild the title and marks textures at the new scale.

Fixes #1999.
2018-05-19 23:33:36 +10:00
Ryan Dwyer
ebb0d051db Fix many border opacity issues 2018-05-17 08:29:14 +10:00
Ryan Dwyer
b351d0a64a Set textures to null when destroying 2018-05-17 08:29:14 +10:00
emersion
95a10dd4f3
Kill wl_shell 2018-05-14 13:26:10 +01:00
emersion
88d9d43b36
Add xdg-shell stable support 2018-05-13 16:38:56 +01:00
Brian Ashworth
0f43eac5dc Fix recursion when counting descendants of a type 2018-05-12 21:19:55 -04:00
Brian Ashworth
e3625d8f33 Count descendant views for hide_edge_borders smart 2018-05-12 12:37:48 -04:00
emersion
c0f5d740a5
Damage container when updating title 2018-05-10 23:03:51 +01:00
emersion
bec80f1551
Damage borders when damaging view 2018-05-10 23:03:50 +01:00
Ryan Dwyer
556ff5f50e Implement pango support
Implements support for the pango: prefix in the font command.

Closes #1903.
2018-05-06 08:25:22 +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
Alex Xu (Hello71)
3202c45054 Check for NULL in container_update_title
Fixes crash when opening Firefox developer tools.
2018-05-04 11:10:01 -04:00
Ryan Dwyer
ed0d606c2a Fix title texture width
Use max of the container width or text width.
2018-05-03 22:51:14 +10:00