Skip to content
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

Refactor layer surface implementations (again) #892

Merged
merged 9 commits into from
Nov 2, 2020

Conversation

alebastr
Copy link
Contributor

An attempt to update the bar code for #860 that went overboard. I'm pretty sure that something is broken in this branch, just haven't figured out what. I'll be keeping this as a draft until I'm convinced that the only collateral damage is logs.

GLSSurfaceImpl works fine for me so far, which is not surprising with how small it is after letting gtk-layer-shell manage exclusive zone. RawSurfaceImpl is not so extensively tested, but I'm going to switch to it for next few days and try all the configuration changes possible via IPC.


The end goal is a live configuration reload and updates from sway IPC events, but the path is long (alebastr/Waybar@master...swaybar-ipc is a somewhat ugly proof of concept for the IPC part).
It might also require some feedback and breaking changes as I don't know how close we want to be to swaybar behavior and how good is the idea to apply all supported configuration from sway's barconfig_update event.

@alebastr alebastr force-pushed the layer-surfaces-v3 branch 2 times, most recently from d1ad77c to c980692 Compare October 25, 2020 05:41
@alebastr alebastr marked this pull request as ready for review October 25, 2020 05:42
@alebastr
Copy link
Contributor Author

Okay, I haven't found any new issues with both implementations. Guess it's ready for review and wider testing...
I could split surface implementations into new files or move them after the Bar code if you think it'll make things cleaner.

This PR also supersedes #545

@Alexays
Copy link
Owner

Alexays commented Oct 28, 2020

Awesome stuff @alebastr!
The only thing that bothers me is the snake case on the name of the functions instead of the camelca.
Otherwise, I am very happy with this refacto! 🎉

Previous attempts to use auto exclusive zone from gtk-layer-shell failed
because gls was expecting real booleans (`TRUE`/`FALSE`) as set_anchor
arguments. With that being fixed, gtk_layer_auto_exclusive_zone_enable
makes gls handle everything related to the bar resizing.

The only remaining purpose of onConfigureGLS is to log warnings and bar
size changes; gtk-layer-shell code path no longer needs saved width_ or
height_ values.
Extract two surface implementations from the bar class: GLSSurfaceImpl
and RawSurfaceImpl. This change allowed to remove _all_ surface type
conditionals and significantly simplify the Bar code.

The change also applies PImpl pattern to the Bar, allowing to remove
some headers and fields from `bar.hpp`.
Replace a couple of header includes with forward declarations.
wayland log shows that some changes were committed twice and some
weren't committed until the next redraw.
Invisible bar on a `top` layer would still intercept pointer events and
stop them from reaching windows below. Always changing the layer to
to `bottom` along with making bar invisible would prevent that.
@alebastr
Copy link
Contributor Author

The only thing that bothers me is the snake case on the name of the functions instead of the camelca.

Sorry, that wasn't conscious. Been working with different code style too much 😄
Fixed and rebased.

@Alexays
Copy link
Owner

Alexays commented Nov 2, 2020

Tested and LGTM, thanks for this refacto so far.
❤️

@Alexays Alexays merged commit faacd76 into Alexays:master Nov 2, 2020
@alebastr alebastr deleted the layer-surfaces-v3 branch November 2, 2020 15:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants