mirror of
https://github.com/swaywm/sway.git
synced 2025-11-08 13:29:50 -05:00
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).
This commit is contained in:
parent
53e3f35ba3
commit
a120d4c79f
10 changed files with 55 additions and 73 deletions
|
|
@ -118,17 +118,6 @@ struct sway_container *seat_get_focus_inactive_view(struct sway_seat *seat,
|
|||
struct sway_container *seat_get_active_child(struct sway_seat *seat,
|
||||
struct sway_container *container);
|
||||
|
||||
/**
|
||||
* Return the immediate child of container which was most recently focused, with
|
||||
* fallback to selecting the child in the parent's `current` (rendered) children
|
||||
* list.
|
||||
*
|
||||
* This is useful for when a tabbed container and its children are destroyed but
|
||||
* still being rendered, and we have to render an appropriate child.
|
||||
*/
|
||||
struct sway_container *seat_get_active_current_child(struct sway_seat *seat,
|
||||
struct sway_container *container);
|
||||
|
||||
/**
|
||||
* Iterate over the focus-inactive children of the container calling the
|
||||
* function on each.
|
||||
|
|
|
|||
|
|
@ -68,6 +68,9 @@ struct sway_container_state {
|
|||
struct sway_container *parent;
|
||||
list_t *children;
|
||||
|
||||
struct sway_container *focused_inactive_child;
|
||||
bool focused;
|
||||
|
||||
// View properties
|
||||
double view_x, view_y;
|
||||
double view_width, view_height;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue