Before this commit, <else> branch was always executed with
monitor="current", monitor="left" or monitor="right" queries.
For example:
<action name="If">
<query monitor="current" />
<then>
<action />
</then>
<else>
<action />
</else>
</action>
These are just lists of enum lab_node_type, with a bounded size and
no middle-insertions/removals, so linked lists are overkill.
Also, the use of wl_list_for_each[_reverse] just to access the first or
last entry in the list (corner button) was weird.
This patch should not change any behaviors.
This clarifies the semantics of cursor_context returned by
get_cursor_context() as I described in cursor.h; when cursor is on a
subsurface (e.g. xdg/x11/layer/session-lock), the returned ctx.surface
and ctx.node points to the subsurface rather than its parent.
With this change, when a layer-popup has a subsurface and cursor is on
it, wl_pointer.enter/motion events are sent to the subsurface rather
than its parent layer-popup surface. I think this follows wayland spec
more closely.
Tested with my demo: https://github.com/tokyo4j/wayland-demo/tree/layer-popup
Instead, set ctx.type = LAB_NODE_LAYER_SURFACE for both layer-surfaces
and layer-subsurfaces.
This patch preserves the existing behaviors:
- Pressing a subsurface of an on-demand layer-surface gives pointer
focus to the subsurface, but gives keyboard focus to the parent
layer-surface (related: a5fcbfaf).
- Pressing a subsurface of a layer-surface doesn't close a popup
(related: a89bcc3c).
This doesn't change any behaviors.
Attaching LAB_NODE_NONE node-descriptor to ssd->tree looks strange, this
patch uses new LAB_NODE_SSD_ROOT instead. The node-descriptor attached to
ssd->tree is needed for get_cursor_context() to detect cursor hovering on
borders/extents.
I also updated get_cursor_context() to make my intent clearer.
In f347a81, I thought there are only window contents and SSD under
`view->scene_tree` and forgot about the resize-indicator.
I also refactored the logic around it:
- Remove `ret.node->type == WLR_SCENE_NODE_BUFFER` check since it's
already done by `lab_wlr_surface_from_node()`
- Eliminate duplicated call to `lab_wlr_surface_from_node()`
Introduced in #3062.
Its usage is guarded by a wlroots version check
which prevented the CI to detect the issue.
When compiled with a wlroots version > 0.19.0
(like the chase 0.20 PR) the error shows up.
struct ssd_part and struct node_descriptor seem to have essentially the
same purpose: tag a wlr_scene_node with some extra data indicating what
we're using it for.
Also, as with enum ssd_part_type (now lab_node_type), ssd_part is used
for several types of nodes that are not part of SSD.
So instead of the current chaining (node_descriptor -> ssd_part), let's
flatten/unify the two structs.
In detail:
- First, merge node_descriptor_type into lab_node_type.
- Add a separate view pointer in node_descriptor, since in the case of
SSD buttons we need separate view and button data pointers.
- Rename ssd_part_button to simply ssd_button. It no longer contains
an ssd_part as base.
- Add node_try_ssd_button_from_node() which replaces
node_ssd_part_from_node() + button_try_from_ssd_part().
- Factor out ssd_button_free() to be called in node descriptor destroy.
- Finally, get_cursor_context() needs a little reorganization to handle
the unified structs.
Overall, this simplifies the code a bit, and in my opinion makes it
easier to understand. No functional change intended.
ssd_part_type contains several node types that are not actually part of
server-side decorations (ROOT, MENU, OSD, etc.)
Rename it accordingly and move it to a common location, along with some
related conversion/comparison functions.
Fixes up f347a81. This mistake didn't cause misbehaviors because the
ssd_part bound to ssd->tree is just a placeholder to let
get_cursor_context() call ssd_get_resizing_type() when the cursor is on
border/extents.
- Rename `scaled_scene_buffer` to `scaled_buffer`. This makes it clear
that `scaled_{font,img,icon}_buffers` are implementations of it.
- Move the files from `src/common` to `src/scaled-buffer` as
`scaled_icon_buffer` heavily depends on `server` and `view` etc.
When resizing in only one axis (horizontal/vertical), there's no reason
to un-maximize the other axis.
Supporting logic was landed in the previous commit and in ebd39dfe0d
(which fixed the client-initiated resize case), so all that remains is
to make a small change in interactive_begin().
view_restore_to() (which is just set_maximized() + view_move_resize())
hasn't aged well and doesn't line up with typical usage anymore:
- it's missing view_set_untiled(), which has to be called separately
- it always forces view_move_resize() even when that's not needed
- it doesn't allow un-maximizing only one axis (see next commit)
- the fullscreen check is unnecessary (already checked in callers)
Eliminate it and just expose view_set_maximized() instead.
No functional change intended in this commit.
`update_last_layout_geometry()` stores `view->natural_geometry` in
`view->last_layout_geometry`, but it's empty for initially-maximized
windows, so their positions were not restored after outputs are
unplugged and plugged (also when VT switching in wlroots 0.19.0).
This commit sets the fallback natural geometry (at the center of the
output) so that initially-maximized windows reappears in the same output.
Now it's not very reasonable to determine the default window width based
on the titlebar geometry, as the titlebar can be shrunk to 1px.
Let's use the fixed value of 100px for simplification.
- Use a single `lab_scene_rect` for both overlay background and outlines,
like I described in the TODO comment in ffd4005.
- Simplify the resource management by destroying the overlay tree when
it's hidden. I think its overhead is pretty minimal.
- Share a single `lab_scene_rect` for both region/edge overlays.
This commit fixes that client-side icons were not loaded when the rendered
icon size is larger than icon sizes from the client. This bug has become
more likely to happen due to the new thumnail-style window switcher.
The cause was `abs(INT_MIN)` becomes `INT_MIN` due to integer overflow.