Commit graph

339 commits

Author SHA1 Message Date
Ryan Dwyer fc826b921f Call view_set_tiled for mapping non-floating views
Fixes #2209.
2018-07-05 09:04:15 +10:00
Ryan Dwyer 4cb6c368a7 Fix boolean 2018-07-04 20:33:38 +10:00
Ryan Dwyer f156a25e64 Only call view_set_tiled when switching floating mode
Otherwise it repeatedly sets the view's border to the config's default.
2018-07-04 20:10:47 +10:00
Dominique Martinet c78ab67877 workspace_next_name: fix string length for ws_num >= 100
The check didn't include && ws_num < 100 so l would always be 1 or 2
Instead of fixing logic it's simpler to just call snprintf twice to get
length and use that.

Also change malloc failure check to sway_assert because both callers of
this function do not do null check and would segfault...

Found through static analysis.
2018-07-02 08:03:41 +09:00
Dominique Martinet 9c9ee3e4ef find prev/next output/workspace: add NULL check
These could be called with NULL if there is no focus

Found through static analysis.
2018-07-02 08:03:41 +09:00
Dominique Martinet 9ea4cc13a0 sway views: add helpers to get view and layer from wlr_surface 2018-06-30 22:31:14 +09:00
Ryan Dwyer e396af853b Merge remote-tracking branch 'upstream/master' into atomic 2018-06-30 22:46:25 +10:00
Rostislav Pehlivanov f42bf0ad4a container_at_view: don't offset the view by the window geometry
Fixes floating window input offsets. As discussed on IRC with emersion,
this shouldn't have been done in the first place.
2018-06-30 11:11:06 +01:00
Rostislav Pehlivanov e0d0e8f840 Revert "Don't unmaximize floating views"
This reverts commit 97672295ed.
2018-06-30 11:10:47 +01:00
emersion 4de28bba68
Fix floating views not receiving frame events
That happened when they were in tabbed or stacked containers.

Fixes #2161
2018-06-30 09:49:51 +01:00
Ryan Dwyer e6829c5991 Move unsetting of view->surface into view_unmap 2018-06-27 17:54:57 +10:00
Ryan Dwyer 8773ed3970 Fix memleak in container_get_box
Rather than allocate a structure and expect callers to free it, take a
pointer to an existing struct as an argument.

This function is no longer called anywhere though.
2018-06-27 17:47:41 +10:00
Ryan Dwyer be86d3aba6 Remove transaction_add_damage
Instead, damage each container when applying the transaction.
2018-06-27 17:46:03 +10:00
Ryan Dwyer 61c1187685 Fix nitpicks 2018-06-27 17:23:44 +10:00
Ryan Dwyer a7b3f29292 Remove incorrect assertion and supporting code
Children can exist when destroying a container, such as when destroying
the last output. Sway is not terminating in that case.
2018-06-26 20:18:57 +10:00
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 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
Ryan Dwyer 9b15e81cff Fix potential crash when fullscreen view unmaps
It happened when a view is a grandchild or deeper of the workspace, is
fullscreen, and unmaps. The workspace would not be included in the
transaction and its pointer to the fullscreen view was left dangling.
2018-06-25 16:41:31 +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
Drew DeVault 867fb6aedb
Merge pull request #2124 from emersion/drag-icons
Render drag icons
2018-06-09 10:50:34 -07:00
Nate Symer 6a910b9ba5 Implement gaps (PR #2047) 2018-06-09 09:34:56 -04:00
emersion cfd02918c0
Render drag icons 2018-06-09 13:26:03 +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 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
emersion 07bee8cffe
Merge pull request #2084 from RedSoxFan/runtime-var-expansion
Runtime variable expansion
2018-06-07 19:29:26 +01: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
Brian Ashworth 82b3b587dd Remove tab/stack check for focusing after a split 2018-06-06 19:38:38 -04:00
Brian Ashworth e7261e2917 Fix focusing after splitting tabs/stacks 2018-06-06 16:41:19 -04:00
Brian Ashworth 067fe9d047 Support runtime var expansion and set at runtime 2018-06-05 10:08:00 -04:00
Brian Ashworth 9aaac8b8c8 Fix movement crashes/issues 2018-06-05 01:13:27 -04:00
Ryan Dwyer d02e9aa4bc Fix initial workspace orientation on a rotated output 2018-06-03 23:39:09 +10:00
emersion 8e3d19aad2
Merge pull request #2096 from kupospelov/fix-title-update
Fix view title update order
2018-06-03 09:20:57 +01: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
Konstantin Pospelov e6baac4297 Fix view title update order
This commit fixes the function call order to make sure that the title
texture is updated using the relevant global font size.
2018-06-03 00:32:18 +03:00
Ryan Dwyer 3f1cfd547e Fix top border when a view is initially floating
Fixes #2085.
2018-06-02 11:45:16 +10:00
Ryan Dwyer a2c1cb9072 Fix mpv damage issue when unfullscreening into floating 2018-06-01 23:14:58 +10:00
Ryan Dwyer f24087d104 Fix fullscreen position 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 40af5d81a1 Fix getting adjacent output 2018-06-01 23:14:58 +10:00