Closed zbaylin closed 4 years ago
I decided to pick up ppx_optcomp
using @EduardoRFS's config.h
to fix the symbol issues. This lets us use native features across platforms without having to have a "fake" implementation on the others.
@EduardoRFS I had to modify the config file a bit since ppx_optcomp
doesn't support ifdef
, just if
and ifndef
-- pretty simple change but just wanted to make sure I didn't miss anything.
@glennsl totally agree, and I was actually going to close this PR and start again for the same reasons. When I first started looking into this, I couldn't seem to find a way to poll & flush like you were talking about. However, I recently found this gist that I was using to bind Gtk to our SDL/X11 window: https://gist.github.com/pastapojken/69f1e223fd926425f7ae770a95ec79a2
Towards the end the event loop does the exact same thing I think we want: poll (gtk_events_pending()
) and, if there are any events, flush (gtk_main_iteration()
). I still think using ppx_optcomp
is the best way to get these Gtk functions into Revery without cross-platform compilation issues, but I also think this PR needs to be redone.
Yeah, that looks like exactly what need. Good call!
This is more of a proposal. It works on Linux right now, but it won't work on macOS/Windows for linking errors (something I need to fix).
Basically the reason to do this would be so that we can get all the niceties that Gtk provides to its widgets: things like Menu Bars, Native inputs, etc. Since Gtk does it's own processing in the event loop, unfortunately that means we have to port over our current event loop (literally just a while loop if you look in
reason-sdl2
) to the Gtk one on Linux.If anyone has any better ideas, please let me know!