membrane

2025-06-16T18:38:55.075979Z

I think I would often want to call something like https://github.com/phronmophobic/clobber/blob/0ac3fd9242f1c9b52689d1a9b5d67a4419a38153/src/com/phronemophobic/clobber/modes/clojure/ui.clj#L109-L121 on every window resize. What's the way to do that in membrane? Since as far as I can tell, there's no event type for window size state, and since there's no event type for it (to use with e.g. ui/on), how do we initially create an intent for it? (I do see you can access the window height in :membrane.component/context but I don' think that fully addresses how to do it "the membrane way")

phronmophobic 2025-06-16T18:41:20.892339Z

I do think this is an area where membrane doesn't currently provide an easy option, but it should. I'm still thinking about what membrane should provide as a best practice, but there are a few workarounds that shouldn't be too bad

2025-06-16T18:44:23.091079Z

Ah, nice! that should get me there, thanks

phronmophobic 2025-06-16T18:45:24.624929Z

It's key to make sure to call (skia/-reshape window window-handle width height) in the reshape handler or the window might act weird.

phronmophobic 2025-06-16T18:46:51.172359Z

I would like to provide a more generic solution built in. Easel has a thing where resize is like an event similar to your description. I've found it pretty convenient.

phronmophobic 2025-06-16T18:48:21.930279Z

Same goes for mounting/unmounting. Although, mounting and unmounting are usually abused in most UI application, there are still some use cases for them in membrane.

phronmophobic 2025-06-16T18:49:06.740869Z

For both of them, I would like to try to avoid walking the whole UI tree too often.

2025-06-16T18:54:21.533359Z

Nice yeah mounting/unmounting did seem related too. Glad you're taking your time with this stuff! The easel stuff should be more than enough for me for now

phronmophobic 2025-06-16T18:56:09.272229Z

I wrote some initial ideas on mounting/unmounting at https://phronmophobic.github.io/membrane/membrane-topics.html#Effects-on-Mounting-or-Unmounting. I still think that approach is more of a workaround than a best practice.

👀 1
phronmophobic 2025-06-16T18:59:21.920489Z

It kinda stink to be in beta for so long, but I am trying to work towards an eventual 1.0.