Fork me on GitHub
#membrane
<
2023-12-17
>
James Amberger03:12:05

I’m looking at the diagram and trying to follow along in the code but am not sure how the view gets supplied to the event function

phronmophobic20:12:59

It's currently more of an implementation detail , but passing the view to the event function is the responsibility of the "graphics backend"/"toolkit". Using the skia backend as an example, the mouse-button-callback calls the event function https://github.com/phronmophobic/membrane/blob/88afb37cda16ea343b2ec3b9790ee15896f4993d/src/membrane/skia.clj#L1656. The callback is setup when the window is created https://github.com/phronmophobic/membrane/blob/88afb37cda16ea343b2ec3b9790ee15896f4993d/src/membrane/skia.clj#L2127C7-L2127C7. In the future, I'd like to provide better support for creating new backends and simplifying existing backends.

James Amberger01:12:54

Thanks. So do the backends “diff” from repaint to repaint or do they just redraw the whole render target every repaint?

phronmophobic13:12:56

There’s currently no diffing. There are some instances where paints are cached. Mainly, I haven’t implemented any diffing because it hasn’t been necessary. There are a lot of cool drawing optimizations that are possible, but repainting hasn’t been a bottleneck so I’ve been focusing on other things.

phronmophobic13:12:10

One cool idea is that a lot of the drawing optimizations should be portable across backends.

James Amberger14:12:29

right, right. this is fascinating work. unlike with re-frame (which I agree is great) I find myself reading your whole src

phronmophobic15:12:28

Hopefully, it's not too messy! I really wish I could spend more time on each individual piece, but just making a simple todo app requires quite a few different pieces. I tried really hard to reuse existing UI related libraries, but many of them are highly coupled to specific frameworks.