This implementation as it stands is incomplete/buggy and will make
updating to wlr_scene more complex.
It will be reimplemented after updating to wlr_scene is complete.
It looks like having the empty error capture |_| on the else branch of
the if statement causes the else branch to be ignored by the compiler.
This should be a compile error, as the condition of the if statement is
a bool, not an error union.
These new functions allow testing commits without messing up the
pending state of the output and needing to rollback. The new apply()
function also makes the code considerably more concise.
A user reported a crash that only reproduces when preloading a hardened
malloc implementation. From the stack trace, this use-after-free seems
to be the most likely cause. Yay hardened malloc!
Outputs that are part of the layout but currently disabled (e.g. due
to use of wlr-output-power-management) are not correctly handled as
river currently waits for them to present a new locked frame before
sending the locked event.
This new frame never comes however since the output is disabled. Fix
this by maintaining the correct Output.lock_render_state as outputs
are enabled/disabled.
Additionally add missing maybeLock() calls to handle the case that all
outputs in the layout are disabled.
Curently since the struct is semantically passed by value not reference,
there is no guarantee that the `seat_node.data.focused.view == &self`
comparison will work as intended. Since updating to Zig 0.10.0, it seems
this latent bug has now manifested and the focused view title is no
longer sent to the client when it changes.
Fix this by taking the view argument by constant pointer instead.
Instead of stashing the active view and setting Seat.focused to the
Xwayland OR surface when a child OR surface of a currently focused
Xwayland view is given keyboard focus, keep Seat.focused set to the
Xwayland view.
Such Override Redirect surfaces are commonly used for drop down menus
and the like, and river should behave as if the parent Xwayland view
still has focus.
This ensures that the riverctl focus-view next/prev commands continue to
work as expected while a popup is open, the correct focused view title
will be sent over river status, etc.
It's also cleaner to centralize this logic in XwaylandOverrideRedirect
and keep it out of Seat.zig.
Xwayland OR menus may disappear if their parent view is deactivated. The
heuristic and ICCCM input model implemented prior, used to determine whether an
OR surface may take focus, does not cover all menus, so retaining parent view
activation works as a catch-all solution for handling unwanted OR menu focus.
We currently scale the width/height of rectangles based on the scaled
x/y instead of the unscaled x/y. This however leads to inconsistent
width/height due to rounding. Fix this bug by basing width/height
scaling off of the original x/y.
Furthermore, fix a typo where we scaled the height off of the x
coordinate instead of the y coordinate.
If the client commits a protocol error or otherwise crashes before the
session has been fully locked, we currently try to send the locked event
without checking if the client has been destroyed.
This commit adds the necessary if statement.
There's currently a potential race in the implementation that can be hit
during unlocking. This is not a security vulnerability, but it does
cause the compositor to crash due to a failed assertion.
This commit simplifies the code and fixes the race as well as tightening
up the assertions around this state/control flow even further.
Currently we send the locked event after rendering and commit of blank
or lock surfaces buffers on all outputs. However, this is technically
not enough to ensure that the buffers have been presented.
Instead, listen to the wlr_output present event to ensure that no
normal, "unlocked" content is possibly visible.
The wlroots rendering API expects colors to be provided with
premultipled alpha but we currently do not parse them as such. This
causes blending with e.g. a transparent border color to be very broken.
The calculation of view.pending.box.x for snap right should be based on
output_width (not output_height).
The inverse applies to view.pending.box.y for snap down.
Currently the spawn-tagmask applies to the currently focused output.
This however means that it is lost if the monitor is unplugged and makes
it hard to set for all outputs.
Change this to make the command apply to all outputs.
This is a breaking change.
When focus-follows-cursor is used with cursor-warp, some windows will
get focus before the cursor properly "enters" the window since they have
a larger input-region than their window geometry, this causes the cursor
to be yanked to the middle unexpectedly.
This fix makes it so the focus is only given when the cursor enters the
window geometry.
It was forgotten to destroy the callback server side object when sending
the destructor event. With the new zig-wayland version, this cannot be
forgotten.
This is nice simplification and allows us to abort startup if the
default xkb configuration (perhaps influenced by XKB_DEFAULT_*
environment variables) is invalid.
Currently the session lock client has no 100% safe way to know when it
is safe to suspend after requesting that the session be locked.
For a suspend to be safe the compositor must have either blanked or
rendered a lock surface on all outputs before suspending. This is
because the current framebuffer on suspend appears to be saved and
displayed again after suspend, at least on my Linux system.
If a new "locked" frame for all outputs is not rendered before suspend,
an "unlocked" frame or frames will likely be briefly displayed on resume
before the lock surfaces are rendered or the screen is blanked.
To fix this, wait until a lock surface has been rendered on all outputs,
or if that times out until all outputs have been blanked, before sending
the locked event to the client.
Resolving this race on the compositor side without protocol changes
is the most effective way to avoid this potential information leak,
regardless of which session lock client is used.
This also cleans up the code by using @Type(), eliminating the need
for the argFlag() and boolFlag() functions.
Allowing [:0]const u8 arguments makes this parser useful for
river-control commands as well.