Conversation
The trait `Component` is now split into `ComponentConfig` ans `ComponentState`, which allows us more flexibility with the user facing configuration types. (Eg. accepting a `&str` and copying it into a `String` afterwards) The `ComponentState` has now more methods than the previous `Component` trait had, which allows for better error messages. The `render` method also accepts a `cairo::Surface` so that components can render arbitary visuals on the bar.
|
Well like this travis seems to automatically check the builds which is nice. |
|
Ah, I have only implemented the traits in |
Replace `ItemState` with `ComponentContext` and `Box<ComponentStateExt>`. Adresses #8
Redesing the `Component*` traits so that `ComponentState` doesn't have to implement `Stream`. Also modified `Bar` to use single `Vec` to store all components and created `XcbContext` to bundle XCB related information. `ComponentContext` was also changed drastically. Created `ComponentStateWrapper` to wrap `ComponentState` and the associated stream in such a way that we can preserve full type safety.
Programming is FUN! |
|
At least travis seems to like it more now. What design issues did you run into? Could you resolve them? |
|
Initially I required I hope I have resolved the issues successfully and that the current version has managed to improve the type safety while simplifying the interface. (Especially by cutting the number of different traits.) Now Next up is implementing the abstraction layer which provides |
|
Also, I need an interface for a component to get the bar properties (e.g. fg/bg colors, height). |
Implement `StringComponent` as an abstraction for implementing components as streams of strings.
Did not render *anything* before this commit.
…ng it. This is archieved through `ComponentContainer` wrapper enum and `ComponentContainerExt` trait, which replaces the `ComponentConfigExt` as the way of storing the component config before crating it.
Fix an integer overflow that occurs when rendering centered components.
|
Argh. Travis fails because of some weird PangoCairo C-binding stuff. |
|
So dependency issues with the CI and not actual build problems? It looks like it has nothing to do with Travis. So setting the dependency in |
|
I don't think any of our dependencies have updated in the last 2 months, so I think this is debian updating their glib/cairo/pango packages or something. Also, works on my machine. |
|
No I've just tried running Using Archlinux with latest nightly. |
|
Oh. After And with that |
|
Well that is kinda unfortunate. :P Unfortunately the Cargo.lock is not in git so all branches broke for me now. |
|
Here's your dependency graph for reference. What do you mean by "trying a few different commits"? |
|
It doesn't look like this one restarted the CI. |
|
Well, it might be that we hit some concurrent build quota with these 16 build tasks. |
|
Yeah I guess running 6 builds at the same time might be a bit much. |
|
Oh right, this branch still has the old CI configs. |
|
What is left to do before this can be merged? Seems like everything is fine with travis. |
Split `StringComponent` into `StringComponentConfig` and `StringComponentState` similarly to the `ComponentConfig` and `ComponentState` traits. This is more flexible and I should have done this to begin with. It adds more boilerplate code when implementing trivial components, but that can be simplified with a macro in a future if necessary.
Refactor the components to use the split up `StringComponent` traits.
|
Ran into problems when trying to implement the However there seems to be some issues with tokio usage. All components do not always update independently. This might be caused by prematurely returning The middle slot has BG drawing issues again, maybe I accidentally reversed something while resolving merge conflicts? |
| if let Some(&(ref ctx, _)) = self.slot_items(Slot::Center).first() { | ||
| if let Some(old_start) = ctx.position { | ||
| self.paint_bg(old_start, old_start + old_width_all)?; | ||
| } |
There was a problem hiding this comment.
I can't see an issue but the center problem is probably caused by the changes to redraw_center before this point.
There was a problem hiding this comment.
@dogamak I just checked and it seems like the old_width_all is not calculated properly. Is it not possible to get the old width anymore?
There was a problem hiding this comment.
I also found the issue that when position changes, but not width, there will be no redraw. Getting the old position works tho. So this is an oversight in my initial implementation.
|
Tokio always is a little troublesome in my experience. Might be a good idea to narrow down the issue and then ask in tokio gitter/irc. |
|
One thing I also noticed is that not only the center element old width is wrong, but it also cuts off the element (only small part of it is displayed). So something's not right there. |
|
@dogamak Would you accept PRs to this PR? I could look into some of these problems to get this finished already. |
The trait
Componentis now split intoComponentConfigansComponentState, which allows us more flexibility with theuser facing configuration types. (Eg. accepting a
&strand copying itinto a
Stringafterwards)The
ComponentStatehas now more methods than the previousComponenttrait had, which allows for better error messages. Therendermethod also accepts acairo::Surfaceso that components canrender arbitary visuals on the bar.
I'll create this pull request for my own commit. I have no idea if this is a common practice or not. Actually I don't have a clue about anything regarding git workflows, but this seems like a thing that could be a thing. 😕
This is a counterpart of #8. It seems like github uses the same id space for bot pull requests and issues, so I might be a little confused here...