Commit graph

71 commits

Author SHA1 Message Date
Ryan Dwyer 27a20a4884 Allow containers to be fullscreen 2018-07-26 08:27:07 +10:00
Ryan Dwyer 81e8f31cc6 Implement scratchpad
Implements the following commands:

* move scratchpad
* scratchpad show
* [criteria] scratchpad show

Also fixes these:

* Fix memory leak when executing command with criteria
(use `list_free(views)` instead of `free(views)`)
* Fix crash when running `move to` with no further arguments
2018-07-23 08:24:32 +10:00
Ryan Dwyer 9fbe13b9be Implement floating_modifier and mouse operations for floating views
This implements the following:

* `floating_modifier` configuration directive
* Drag a floating window by its title bar
* Hold mod + drag a floating window from anywhere
* Resize a floating view by dragging the border
* Resize a floating view by holding mod and right clicking anywhere on
the view
* Resize a floating view and keep aspect ratio by holding shift while
resizing using either method
* Mouse cursor turns into resize when hovering floating border or corner
2018-07-22 23:10:19 +10:00
Ryan Dwyer be28c18ad5 Mark containers as urgent in IPC if they have urgent views 2018-07-16 14:30:31 +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
Ryan Dwyer 2032f85d94 Simplify transactions by utilising a dirty flag on containers
This PR changes the way we handle transactions to a more simple method.
The new method is to mark containers as dirty from low level code
(eg. arranging, or container_destroy, and eventually seat_set_focus),
then call transaction_commit_dirty which picks up those containers and
runs them through a transaction. The old methods of using transactions
(arrange_and_commit, or creating one manually) are now no longer
possible.

The highest-level code (execute_command and view implementation
handlers) will call transaction_commit_dirty, so most other code just
needs to set containers as dirty. This is done by arranging, but can
also be done by calling container_set_dirty.
2018-07-14 23:14:55 +10:00
Ryan Dwyer ab8a86369c Implement some floating move commands
This implements the following for floating containers:

* move <direction> <amount>
* move [absolute] position <x> <y>
* move [absolute] position mouse
2018-07-09 23:38:29 +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 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 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 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
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 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 1132efe42e Send frame done to floating views
Also centers them on the screen when initially floated

In the future we'll need a more sophisticated solution than that
2018-06-01 23:14:58 +10:00
Drew DeVault f3ab895916 Implement floating enable 2018-06-01 23:14:58 +10:00
Ryan Dwyer 7c7d24600b Fix ancestor typos 2018-05-28 12:45:42 +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 4de137e021 Replace empty argument with void 2018-05-22 09:44:34 +10:00
Ryan Dwyer f6c3682c05 Use constants for titlebar dimensions 2018-05-22 08:27:42 +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
Brian Ashworth e3625d8f33 Count descendant views for hide_edge_borders smart 2018-05-12 12:37:48 -04: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 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
Ryan Dwyer e67f354333 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-04-30 21:24:13 +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 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
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
emersion c2b1beef15
Remove L_TYPES 2018-04-05 23:22:08 -04:00
emersion 076bedb85e
Add container_damage_whole 2018-04-05 18:31:19 -04:00
Tony Crisci fc9398a42e Implement opacity command 2018-04-04 21:57:05 -04:00
Tony Crisci a001890fb8 move workspace create to workspace.c 2018-04-03 19:52:17 -04:00
Tony Crisci eca4468c2c fix old todos 2018-04-03 17:06:57 -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 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 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