On Thu, 6 Jun 2019 23:00:05 +0200, Mike Wey wrote:
On 06-06-2019 06:08, Alex X wrote:
Another question: Is there any way to draw over a widget easily? e.g., get a context of a widget and just draw on it over all the children widgets for a container and it not mess with anything(just purely visual).
I have overridden the addOnDraw, the problem is I need to sync two addOnDraws...
It would be better to be able to get the context for the widget I want then draw to it in a single addOnDraw so they will always be in sync.
This should work for drawing on top of widgets:
bool draw(Scoped!Context cr, Widget widget)
I'm either misunderstanding your code or didn't explain what I want well enough or you misunderstood me ;)
I have two widgets where I am drawing stuff to
Both a and b need to be synchronized though.
addOnDraw may call a and b at drastically different times. I queue them up together but the internal scheduling does not call them together(stuff happens in between).
I could up the frame rate and this might fix things at the cost of unnecessary processing.
What I'd like to do is
just have one draw routine:
bool a(Scoped!Context cr, Widget widget)
// Get the context for the the 2nd widget
cr2 = getContext(w2);
cr2.destroy(); // or whatever it is
I realize it might not be valid to get the context for another widget outside the draw(it might not exist or whatever) but the idea is to show that above they should be synced together. since the draw routines happen together.
What is happening is that I have two widgets that are suppose to draw something in sync. I queue the routines but they are not called together and one lags the other and it is clearly obvious they are not in sync by the design.
If I upped the frame rate it would make it less obvious I imagine but I'd rather not have it an issue at all.
I'm thinking I might have to rethink my design and it might solve some problems though. I'm drawing in a child drawing area and I might just need to draw in the parent widget and take try to position things properly and it might work. That way everything will definitely be synced. It might work for my application since it is relatively basic.