-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
custom_shell_surface_needs_commit
is unreliable
#185
Comments
All the mode or visibility changes require `wl_surface_commit` to be applied. gtk-layer-shell will attempt to force GTK to commit, but may fail if the surface has stopped receiving frame callbacks[^1]. Thus, we could get stuck in a state where the bar is hidden and unable to regain visibility. Until that's addressed in `gtk-layer-shell`, we should take care of the commits ourselves. [^1]: wmww/gtk-layer-shell#185
Check GTK internal state to avoid reintroducing the crashes. Fixes wmww#185
Hmm, I believe you that there are problems, but I'm scared to change anything because
my preference would be either for app devs to work around the issue in their code if possible, or failing that to somehow make the fixed but potentially less stable code path opt-in (so we don't break existing apps that work fine as-is) |
I really don't like the workaround code: alebastr/Waybar@6416f7d. And it isn't something I want to see being copied from app to app.
How about exposing this code as |
That would be acceptable, as long as the library continues to work the same when apps don't call it. I realize this isn't a great solution, but I think it's the best compromise if more private struct usage is indeed needed. Taking a closer look at the issue, it looks like the call to gtk-layer-shell/src/layer-surface.c Line 370 in 07653ce
|
Updated the PR with explicit commit method. Remapping seems a bit too heavy when you only need to send two Wayland protocol messages. And yes, there is an obnoxious flickering that would accompany any layer surface state updates, as you can't determine when you really require a remap. Layer change is not the only reason the surface can become occluded or visible. |
How often are you updating the layer surface state in Waybar? Does this happen in cases other than when user configuration changes? |
Waybar partially implements At the moment, user can change layer/exclusivity/visibility via IPC and bind bar visibility to a press/release of the modifier ( |
I don't understand why flickering on property change would be an issue for those usecases? |
This is how it works with The bar is configured to toggle between the bottom and the overlay layers depending on the modifier key state. bar.webm |
All right fine, I'm convinced |
All the mode or visibility changes require `wl_surface_commit` to be applied. gtk-layer-shell will attempt to force GTK to commit, but may fail if the surface has stopped receiving frame callbacks[^1]. Thus, we could get stuck in a state where the bar is hidden and unable to regain visibility. To address this, a new API has been added to gtk-layer-shell, `gtk_layer_try_force_commit`, which does `wl_surface_commit` with the necessary safety checks to avoid corrupting GTK internal state. Note: this change bumps gtk-layer-shell requirement to 0.9.0. [^1]: wmww/gtk-layer-shell#185
All the mode or visibility changes require `wl_surface_commit` to be applied. gtk-layer-shell will attempt to force GTK to commit, but may fail if the surface has stopped receiving frame callbacks[^1]. Thus, we could get stuck in a state where the bar is hidden and unable to regain visibility. To address this, a new API has been added to gtk-layer-shell, `gtk_layer_try_force_commit`, which does `wl_surface_commit` with the necessary safety checks to avoid corrupting GTK internal state. Note: this change bumps gtk-layer-shell requirement to 0.9.0. [^1]: wmww/gtk-layer-shell#185
All the mode or visibility changes require `wl_surface_commit` to be applied. gtk-layer-shell will attempt to force GTK to commit, but may fail if the surface has stopped receiving frame callbacks[^1]. Thus, we could get stuck in a state where the bar is hidden and unable to regain visibility. To address this, a new API has been added to gtk-layer-shell, `gtk_layer_try_force_commit`, which does `wl_surface_commit` with the necessary safety checks to avoid corrupting GTK internal state. Note: this change bumps gtk-layer-shell requirement to 0.9.0. [^1]: wmww/gtk-layer-shell#185
I've been debugging an issue where Waybar fails to switch from the
GTK_LAYER_SHELL_LAYER_BOTTOM
toOVERLAY
orTOP
with Sway 1.10.The following fragment of WAYLAND_DEBUG log has sent me to the scary depths of GTK
and helped me realize two facts
gdk_window_invalidate_rect
schedules a redraw and commit on the next frame callbackwlr_scene
may stop delivering frame callbacks to a fully occluded surfaceSo once the layer surface is fully hidden behind an opaque surface, it won't be able to get out without external help.
It appears that we have to use a direct
wl_surface_commit
, but without reintroducing #47 or #51. Looking at these issues, it occurs to me that it would be safe to commit ifGdkWindowImplWayland.pending_commit
andGdkWindowImplWayland.pending_buffer_attached
are unset, which we can easily check via private struct accessors.In the meantime, I'm going to work around that in waybar by adding a conditional
wl_surface_commit
that is only allowed betweenGdkFrameClock::after-paint
andGdkFrameClock::before-paint
. That's the closest approximation of the check above possible with public GTK APIs.The text was updated successfully, but these errors were encountered: