Commit graph

537 commits

Author SHA1 Message Date
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
Drew DeVault acd79e1505 Implement pid->workspace tracking
When you spawn a process with the exec command, sway now notes the
workspace you had focused and the pid of the child process, then assigns
that workspace to the child when its window appears.

Some of this is carried over from sway 0.15, but with some major
refactoring and centralization of state.
2018-07-01 09:58:18 -04: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
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
Drew DeVault f3ab895916 Implement floating enable 2018-06-01 23:14:58 +10:00
emersion c47d6cb1c4
Merge pull request #2081 from RedSoxFan/fix-2077
Send reparent events in container_split
2018-06-01 10:36:47 +01:00
Brian Ashworth 8237d944d4 Fix move perpendicular segfault 2018-06-01 01:12:10 -04:00
Brian Ashworth cca587b21f Send reparent events in container_split 2018-05-31 23:47:21 -04:00
Brian Ashworth e13c94f2dd Fix typo 2018-05-31 12:07:54 -04:00
Brian Ashworth 633bee9019 Fix moving out of tab/stack when only child 2018-05-31 11:51:00 -04:00
Brian Ashworth 3b90b55666 Notify of subtree change 2018-05-29 11:27:04 -04:00
Brian Ashworth 103a302fa4 Fix moving out of a tabbed/stacked workspace 2018-05-29 11:21:55 -04:00
Brian Ashworth a66fd74a54 Fix breaking out of tabs/stacks 2018-05-29 11:21:55 -04:00
Ryan Dwyer 6f4cb2b29d Add tree representation to IPC workspace description 2018-05-29 17:42:11 +10:00
emersion 1071785f56
Merge pull request #2060 from RedSoxFan/focus-wrapping
Implement focus_wrapping
2018-05-28 10:30:11 +01:00
emersion 015878e5db
Merge pull request #2058 from RyanDwyer/refactor-parse-title-format
Refactor parse_title_format
2018-05-28 09:18:07 +01:00
Brian Ashworth 46da1dc32b Implement focus_wrapping 2018-05-27 23:20:21 -04:00
Ryan Dwyer 7c7d24600b Fix ancestor typos 2018-05-28 12:45:42 +10:00
Ryan Dwyer 9df1432f56 Refactor parse_title_format
Don't read properties until needed, and do it with less lines of code.
2018-05-28 12:03:43 +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 8fda41dab5
Merge branch 'master' into cmd-swap 2018-05-28 00:14:22 +10:00
Ryan Dwyer d3dd7e5bae Rename view_get_type to view_get_shell 2018-05-27 22:02:00 +10:00
Ryan Dwyer 51865c00c8 Add %app_id to title_format 2018-05-27 09:50:38 +10:00
Brian Ashworth 569f4e0e4c Implement swap command 2018-05-26 11:05:02 -04:00
Drew DeVault ab74c95d56
Merge pull request #2036 from RyanDwyer/workspace-switch-on-map
Switch workspace if required when mapping a view
2018-05-25 08:47:08 -04:00
Drew DeVault daf328d054
Merge pull request #2033 from RyanDwyer/arrange-after-flatten
Arrange views after flattening the parent
2018-05-25 08:43:57 -04:00
Drew DeVault a268a0c2ae
Merge pull request #2034 from RyanDwyer/cleanup-container-titles
Clean up container title functions
2018-05-25 08:41:01 -04:00
Ryan Dwyer f32a002401 Switch workspace if required when mapping a view
If a view is created on a workspace that wasn't visible, switch to it.

Fixes #1879.
2018-05-25 22:28:01 +10:00
Ryan Dwyer e496cc99f8 Fix focus bug when moving between outputs
When moving focus left or right to an adjacent output, only select the
first or last child in the new workspace if the workspace's layout is
horizontalish. If it's a verticalish layout, use the last focused
container.
2018-05-25 21:39:48 +10: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 320703fdca Arrange views after flattening the parent
Fixes #2029.
2018-05-25 16:42:55 +10:00
Ryan Dwyer c9630975da Fix crash in move workspace to output command
Fixes #2026.
2018-05-24 23:01:17 +10:00
Ryan Dwyer cdbae9a5e9 Fix nested tabs
Fixes #2023.
2018-05-24 17:38:31 +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 664169fbf1 Implement stacked layout 2018-05-22 08:27:24 +10:00
Brian Ashworth 0273c6438c Fix hide_edge_borders smart for tabs and stacks 2018-05-21 13:18:18 -04:00
Ryan Dwyer 5ab4930185 Fix tab border issues 2018-05-21 20:16:56 +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 c4ea2b51f6 Fix hide_edge_borders constraints
When checking if a border is on the edge, the check should be done
against the workspace rather than the output.
2018-05-21 13:59:01 +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 69ac7f73e7 Destroy marks textures when view destroyed 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
Ryan Dwyer 5384fdcbc6 Don't show marks which start with an underscore 2018-05-17 08:29:14 +10:00
Ryan Dwyer 0e2cc0af30 Implement show_marks 2018-05-17 08:29:14 +10:00
Ryan Dwyer fc96f004d2 Don't steal focus when a view changes its title
Fixes #1989
2018-05-16 20:29:04 +10:00
Ryan Dwyer 22d38600d0 Implement marks 2018-05-15 11:18:27 +10:00
Brian Ashworth 9ba0dca7ba
Merge branch 'master' into fix-1975 2018-05-14 09:06:23 -04:00
emersion 95a10dd4f3
Kill wl_shell 2018-05-14 13:26:10 +01:00
Brian Ashworth 3488fbc859 Fix y and height for a hidden top normal border 2018-05-14 01:46:53 -04: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 92b8497a0b Fix crash when launching programs from dmenu 2018-05-14 11:48:15 +10:00
Ryan Dwyer bffcb496cc Revert "Revert "Merge pull request #1953 from RyanDwyer/criteria-focused""
This reverts commit ac0e62584f.

This reimplements the criteria __focused__ commit in preparation for
fixing a known bug.
2018-05-14 11:38:09 +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
Drew DeVault b2dec12368
Merge pull request #1970 from emersion/xdg-shell-stable
Add xdg-shell stable support
2018-05-13 13:45:15 -04:00
emersion 88d9d43b36
Add xdg-shell stable support 2018-05-13 16:38:56 +01:00
Heghedus Razvan 789a877b37 Fix crash when using pango markup font
The characters & < > ' " needs to be escaped when using pango markup

Signed-off-by: Heghedus Razvan <heghedus.razvan@gmail.com>
2018-05-13 17:53:45 +03:00
Brian Ashworth 0f43eac5dc Fix recursion when counting descendants of a type 2018-05-12 21:19:55 -04:00
Brian Ashworth 2adf23c2a3 Only count views for hide_edge_borders smart 2018-05-12 12:56:26 -04:00
Brian Ashworth ec60e24f75
Merge branch 'master' into edge-borders 2018-05-12 12:43:34 -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
Drew DeVault ac0e62584f Revert "Merge pull request #1953 from RyanDwyer/criteria-focused"
This reverts commit 2511adffc2, reversing
changes made to 3e1bf721c6.
2018-05-12 08:52:48 -04:00
Ryan Dwyer 4717c71da5
Merge branch 'master' into fix-crash-on-fullscreen 2018-05-12 17:52:51 +10:00
Ryan Dwyer 94e42f9857 Implement __focused__ criteria 2018-05-12 12:34:12 +10:00
Brian Ashworth 3db7fc2bb2 Implement hide_edge_borders 2018-05-11 18:44:56 -04:00
Dudemanguy911 935bda0f33 fix crash on fullscreen toggle 2018-05-11 07:42:56 -05: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
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 936226845f Add extra check for view title being NULL 2018-05-05 22:29:37 +10:00
Ryan Dwyer 5d6d24e71a Move code for re-arranging after font height change into a common place 2018-05-05 22:29:37 +10:00
Ryan Dwyer da7d6642d3 Refactor parse_title_format() 2018-05-05 22:29:37 +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
Drew DeVault 58a033d816 Convert border_colors.text to float[4] 2018-05-03 08:14:17 -04:00
Drew DeVault 8f06aa7598 Fix anti-aliasing 2018-05-03 08:12:26 -04:00
Ryan Dwyer 89d1571041 Fix potential segfault when setting container title 2018-05-03 15:23:39 +10:00
Ryan Dwyer 55b307cddf Calculate config->font_height based on existing container titles 2018-05-03 15:12:00 +10:00
Ryan Dwyer b667298a0a Render titles 2018-05-03 15:12:00 +10:00
Dillen Meijboom b45e2bd95e Fixed #1888 GCC cannot compile due to uninitialized variables (#1889) 2018-05-02 10:40:45 +01: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 83952c5201 Restore view_update_position() 2018-05-01 07:46:57 -04:00
Ryan Dwyer 55577498c0 Allow clicking view decorations to focus view 2018-05-01 07:46:57 -04:00
Ryan Dwyer 0375f966f1 Fix surface offset when using borders 2018-05-01 07:46:57 -04:00
Ryan Dwyer fa5de2876e Move docblock and fix indenting of switch/case. 2018-05-01 07:46:57 -04:00
Ryan Dwyer 630ba30e3c Implement borders
Implements rendering of borders. Title text is still to do.

Implements the following configuration directives:

* client.focused
* client.focused_inactive
* client.unfocused
* client.urgent
* border
* default_border
2018-05-01 07:46:57 -04:00
Ryan Dwyer 91f97fc21a Fix segfault in view_unmap()
If the last remaining view on a workspace is unmapped and the workspace
is not visible, parent will be a C_OUTPUT. Call the arrange_output()
function in this case.
2018-05-01 17:18:20 +10:00
Ryan Dwyer 312fdf313f Remove arrange_windows()
After the refactor, this function is no longer called.
2018-04-30 08:47:38 +10:00
Ryan Dwyer 167c2e1aa9 Refactor arrange_windows()
Replaces arrange_windows() with arrange_root(), arrange_output(),
arrange_workspace() and arrange_children_of().

Also makes fullscreen views save and restore their dimensions, which
allows it to preserve any custom resize and is also a requirement for
floating views once they are implemented.
2018-04-28 11:26:14 +10:00
Ryan Dwyer ae39d7b28c Remove sway_container.workspace_layout
Fixes #1716.
2018-04-26 10:14:18 +10:00
Ryan Dwyer dfc26c664f Update wording about unmanaged/unmapped views 2018-04-24 20:14:22 +10:00
Ryan Dwyer 30a7488936 Add assert to view_execute_criteria() 2018-04-24 20:08:32 +10:00
Ryan Dwyer 72767e1cc3 Implement criteria commands
Implements the following commands:

* for_window [...] <cmdlist>
* assign [...] <workspace>
2018-04-24 20:08:32 +10:00
Ryan Dwyer 22b9169631 Fix crash in container_descendants()
If root is a C_VIEW, the children property is a null pointer.
2018-04-24 12:27:04 +10:00
emersion a41057714f
Update for wlroots#885 2018-04-21 19:12:49 +01:00
Ryan Dwyer 34429a3605 Keep view fullscreened when moving to another workspace.
container_handle_fullscreen_reparent() must be called *after* setting
the container's new parent.
2018-04-20 21:26:14 +10:00
Ryan Dwyer 45a2fad0de container_get_in_direction(): Don't split this function 2018-04-19 12:53:02 +10:00
Ryan Dwyer 7e38cc2e05 arrange_windows(): Calculate workspace properties when fullscreen 2018-04-19 12:50:53 +10:00
Ryan Dwyer 35ccdd67a8 More fullscreen fixes.
* Render fullscreen views without wlr function, which makes popups and
lockscreen work.
* Don't allow input events to surfaces behind fullscreen views.
* Use correct output dimensions (for rotated outputs).
2018-04-18 08:35:28 +10:00
Ryan Dwyer 72beae209b Fullscreen fixes. 2018-04-18 00:10:32 +10:00
Ryan Dwyer cc4da245a8 Fix views unmapping their own fullscreen windows. 2018-04-17 11:06:03 +10:00
Ryan Dwyer c685ef081f Create sway_workspace struct. 2018-04-17 09:31:34 +10:00
Ryan Dwyer bfd5834f4c Feedback for fullscreen. 2018-04-17 08:11:50 +10:00
Ryan Dwyer 52420cc24d Implement fullscreen. 2018-04-16 20:36:40 +10:00
Dominique Martinet 8490d1662c Fix gcc maybe-uninitialized warning 2018-04-13 22:47:27 +09:00
Dominique Martinet de65d05821 container_destroy: fix segfault
cont->children doesn't have to be NULL when there is no children
2018-04-13 14:58:23 +09:00
Tony Crisci 9db859585e container_create_notify on split 2018-04-07 18:01:18 -04:00
Tony Crisci c0f9ee7bd1 seat get focus inactive view 2018-04-07 16:06:36 -04:00
emersion 61abd56ca4
Fix output containers position 2018-04-07 12:44:02 -04:00
Drew DeVault c47b4d4edb
Merge pull request #1756 from emersion/output-damage
Fine-grained damage tracking
2018-04-07 11:53:10 -04:00
Drew DeVault f5a9bd5cb7
Merge pull request #1700 from swaywm/move-cmd-full
Implement move [left|right|up|down]
2018-04-07 11:19:25 -04:00
emersion 93ca8919f6
Don't rejigger if parent has two children 2018-04-06 18:10:02 -04:00
emersion 37b173f326
When moving between outputs, use output center as reference 2018-04-06 17:50:12 -04:00
Drew DeVault 640232eb22
Revert "Break everything^W^WUse wlr_box for sway_container" 2018-04-06 16:13:26 -04:00
Drew DeVault df0d57b916 Fix issue with incorrectly rejiggered workspaces 2018-04-06 15:54:03 -04:00
Drew DeVault 764489e737 Break everything^W^WUse wlr_box for sway_container 2018-04-06 15:38:37 -04:00
Drew DeVault 9109b1fd11 Fix moving to parallel container on another output 2018-04-06 15:37:55 -04:00
Drew DeVault 5ff16994c5 Address @emersion feedback 2018-04-06 15:09:52 -04:00
Drew DeVault c8be7bfc1e Fix another of @orestisf1993's issues 2018-04-06 13:57:04 -04:00
Drew DeVault 1f70b94f34 Fix moving into right end of container 2018-04-06 13:17:22 -04:00
Drew DeVault cd6e3182fa Fix issues @orestisf1993 raised 2018-04-06 12:46:33 -04:00
Drew DeVault b5baa78dc3 Address @emersion's comments 2018-04-06 11:53:10 -04:00
Drew DeVault 603e0e42c5 Add debug tree view 2018-04-06 11:49:27 -04:00
emersion 516f5454ad
Simplify damage tracking functions, use them in layer shell 2018-04-06 11:45:40 -04:00
emersion 290c916290
Send surface enter/leave events to view children 2018-04-06 10:26:32 -04:00
Drew DeVault a06052ad9d Fix splitting workspaces 2018-04-06 09:43:52 -04:00
Drew DeVault efac07db5f Fix workspaces not updated on swaybar 2018-04-06 09:43:52 -04:00
Drew DeVault 57954a2b24 Implement move [left|right|up|down]
The exact semantics of this command are complicated. I'll describe each
test scenario as s-expressions. Everything assumes L_HORIZ if not
specified, but if you rotate everything 90 degrees the same test cases
hold.

```
(container (view a) (view b focus) (view c))
-> move left
(container (view b focus) (view a) (view c))

(container (view a) (view b focus) (view c))
-> move right
(container (view a) (view c) (view b focus))

(container L_VERT (view a))
(container L_HORIZ
  (view b) (view c focus))
-> move up
(container L_VERT
  (view a) (view c focus))
(container L_HORIZ (view b))

(workspace
  (view a) (view b focus) (view c))
-> move up
(workspace [split direction flipped]
  (view b focus)
  (container (view a) (view c)))

(workspace
  (view a) (view b focus) (view c))
-> move down
(workspace [split direction flipped]
  (container (view a) (view c))
  (view b focus)))

Note: outputs use wlr_output_layout instead of assuming that i+/-1 is
the next output in the move direction.

(root
  (output X11-1
    (workspace 1))
  (output X11-2
    (workspace 1 (view a focus) (view b)))))
-> move left
(root
  (output X11-1
    (workspace 1 (view a focus)))
  (output X11-2
    (workspace 1 (view b)))))

(root
  (output X11-1
    (workspace 1
      (container (view a) (view b)))
  (output X11-2
    (workspace 1 (view c focus)))))
-> move left
(root
  (output X11-1
    (workspace 1
      (container (view a) (view b))
      (view c focus)))
  (output X11-2
    (workspace 1)))
```
2018-04-06 09:43:52 -04:00
Drew DeVault d77a0119f4 Avoid arranging windows while reloading config 2018-04-06 09:43:44 -04:00
Drew DeVault b08f7e5183 Fix deletion of still-visible workspaces on unfocus 2018-04-06 09:26:49 -04:00
emersion 88e3e5ea5d
Fix wl_output enter/leave events
Fixes #1739
2018-04-06 00:10:17 -04:00
Drew DeVault f63d9417cd
Merge pull request #1743 from emersion/subsurface-damage-tracking
Damage tracking for view children
2018-04-05 22:53:21 -04:00
emersion d65d001aa5
Fix desktop_damage_whole_surface 2018-04-05 18:38:50 -04:00
emersion 6b9b03f09f
Remove outdated TODO 2018-04-05 18:33:18 -04:00
emersion 076bedb85e
Add container_damage_whole 2018-04-05 18:31:19 -04:00
emersion f5e5b1819b
Track damage of xdg-shell-v6 popups 2018-04-05 16:48:11 -04:00
Drew DeVault f242362e7e Handle output removal on swaybar 2018-04-05 16:04:30 -04:00
emersion 45f93e1650
Accumulate damage from subsurfaces 2018-04-05 15:20:45 -04:00
emersion dcd15a2d3d
Implement shell views 2018-04-05 11:40:39 -04:00
Drew DeVault 9e89daf213
Merge pull request #1734 from swaywm/resize-cmd
Implement resize command
2018-04-05 00:17:47 -04:00
Drew DeVault f77986338f Implement resize command 2018-04-05 00:03:20 -04:00
Tony Crisci 65f254f3fb Merge branch 'wlroots' into fix-focus-inactive 2018-04-04 22:36:09 -04:00
Tony Crisci deda37469a fix focus child 2018-04-04 22:31:10 -04:00
emersion 44b8d30f52 Use new wlr_*_surface_at functions 2018-04-04 22:03:14 -04:00
emersion 8eff00f723 Remove unused SWAY_VIEW_TYPES 2018-04-04 22:03:14 -04:00
Tony Crisci fc9398a42e Implement opacity command 2018-04-04 21:57:05 -04:00
Tony Crisci cfd806577b fix sending window new event 2018-04-04 19:37:01 -04:00
Tony Crisci 3e61718053 try to fix focus-inactive 2018-04-04 18:52:38 -04:00
Tony Crisci 76b0f3531f send window close event 2018-04-04 14:19:38 -04:00
Tony Crisci 62c79ef451 fix double free 2018-04-04 00:22:40 -04:00
Tony Crisci 741e3959e3 Merge branch 'wlroots' into split-containers2 2018-04-04 00:20:44 -04:00
Tony Crisci 9d1cbd77ac simplify container close 2018-04-03 23:59:44 -04:00
emersion f3ef1da750
Fix wrong output container coordinates 2018-04-03 21:06:13 -04:00
Tony Crisci fa004dd0d7 move output create to its own file 2018-04-03 20:00:09 -04:00
Tony Crisci a001890fb8 move workspace create to workspace.c 2018-04-03 19:52:17 -04:00
Tony Crisci 97b171649d move output damage to workspace destructor 2018-04-03 19:36:57 -04:00
emersion c0554d23d3
Fix rendering with multiple outputs 2018-04-03 19:34:56 -04:00
Tony Crisci 035a88e0dc rename container_finish to _container_destroy 2018-04-03 19:32:09 -04:00
Tony Crisci 481a8275c1 address feedback 2018-04-03 19:23:59 -04:00
Drew DeVault 1a5785b0c3
Merge pull request #1712 from RedSoxFan/workspace-number-names
Fix name generation from workspace number commands
2018-04-03 15:58:12 -04:00
Brian Ashworth 1e549230db Fix name generation for workspace number <name> 2018-04-03 15:18:57 -04:00
Tony Crisci a514fee1b9 rename workspace_get_initial_output 2018-04-03 13:24:48 -04:00
Tony Crisci 9b567fc37e clean up container_get_default_layout 2018-04-03 13:23:34 -04:00
Tony Crisci 065887bb7b move container_set_layout to layout.h 2018-04-03 13:16:23 -04:00
Tony Crisci fcbcbf34ad make container_finish private 2018-04-03 13:10:51 -04:00
Tony Crisci 5f4761c4f4 unify workspace create functions 2018-04-03 13:08:45 -04:00
Tony Crisci cba258e16a move output code out of the tree 2018-04-03 12:40:11 -04:00
Tony Crisci 09d448ea2d unify container destroy functions 2018-04-03 12:34:01 -04:00
Tony Crisci b4c5f79725 move view and workspace destructors to container.c 2018-04-03 12:25:19 -04:00
Tony Crisci 7afbe9284f rename _container_destroy to container_finish 2018-04-03 11:27:27 -04:00
Tony Crisci 33006c4e64 dont deallocate in container_close 2018-04-02 23:15:19 -04:00
Tony Crisci 20f9d49b82 cleanup 2018-04-02 22:42:44 -04:00
Tony Crisci 2992b72d61 change reap container approach 2018-04-02 22:37:21 -04:00
Tony Crisci 2c165e1288 fix more close segfaults 2018-04-02 21:01:33 -04:00
Tony Crisci a89096278b Merge branch 'wlroots' into split-containers 2018-04-02 19:22:10 -04:00
Tony Crisci d434da5632 Merge branch 'wlroots' into split-containers 2018-04-02 16:09:27 -04:00
Tony Crisci d070244362 fix workspace splits 2018-04-02 15:40:40 -04:00
emersion a4a241697a
Merge branch 'wlroots' into view-redesign 2018-04-02 15:30:58 -04:00
emersion 0c0cc79282
Merge pull request #1699 from acrisci/seat-fixes
Seat fixes and cleanup
2018-04-02 15:24:25 -04:00
emersion 2f64ce86c4
Xwayland unmanaged views aren't views anymore 2018-04-02 14:35:43 -04:00
Drew DeVault 4134407fa9
Merge pull request #1690 from swaywm/i3bar-json
I3bar json
2018-04-02 14:23:01 -04:00
Tony Crisci 357a4401fa address feedback 2018-04-02 14:15:40 -04:00
Tony Crisci 2187684bd0 Merge branch 'wlroots' into split-containers 2018-04-02 14:06:04 -04:00
Tony Crisci 5e024278a6 Merge branch 'wlroots' into seat-fixes 2018-04-02 13:23:43 -04:00
emersion 2a8985a345
Merge pull request #1697 from RedSoxFan/back-and-forth
Fix back-and-forth workspace name saving for non-empty workspaces
2018-04-02 12:28:08 -04:00
Drew DeVault c507727ad2 Fix use-after-free with block hotspots 2018-04-02 11:53:56 -04:00
Drew DeVault b2d871cfe2 Partially implement move command
Works:

- move [container|window] to workspace <name>
    - Note, this should be able to move C_CONTAINER but this is untested
- move [workspace] to output [left|right|up|down|<name>]

Not implemented yet:

- move [left|right|up|down]
- move scratchpad
- move position
2018-04-02 11:12:18 -04:00