On Fri, 7 Jun 2019 17:08:47 +0200, Mike Wey wrote:

On 07-06-2019 04:38, Alex X wrote:

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

      return true;

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.

I misunderstood you.

To draw on a other widget you can use this:

auto gdkWin = otherWidget.getWindow();
auto gdkCx  = gdkWin.beginDrawFrame(gdkWin.getVisibleRegion());
auto cairoCx = gdkCx.getCairoContext();

// Draw to cairoCx.


Thanks. I'm changed my code to write on the parent widget instead and it seems like it will solve several problems. Still working on it though... this, though, might help out later if I need to sync more stuff up.