[racket] Adding a new native GUI component — is it possible?
I experimented with this a while back by using the XEmbed protocol to
embed an instance of uzbl into a GtkSocket:
https://github.com/jeapostrophe/rune/blob/master/hirune/socket.rkt
You probably don't want to do that, because uzbl is kind of a weird
browser, Xembed doesn't work across platforms, etc. But this code
shows you how simple it is to add a new widget to the Racket GUI
hierarchy.
Jay
On Thu, Dec 11, 2014 at 12:35 AM, Alexis King <lexi.lambda at gmail.com> wrote:
> The Racket GUI system is nice, but as with almost any GUI system, sometimes
> I yearn for the simplicity of HTML rendering. CSS and JavaScript let
> properly-styled HTML be easily inserted into almost any application without
> anyone realizing it isn’t native, so long as it’s fast and seamless.
>
> Basically, I want to try and create a wrapper for a Chromium web view to be
> able to add to a Racket GUI in the same way that I can add, say, a
> horizontal-panel%. However, even putting the logistics of the complications
> that would involve aside, the question becomes… is it even possible to
> implement a new native UI component without sticking it into the internals
> of MrEd?
>
> Currently, all of the plumbing that handles the linkage of the GUI classes
> with their underlying native counterparts is tightly woven into the gui
> library itself. There’s no way for an external package to hook into that
> system and add something new, as far as I can tell. Ideally, I’d like to be
> able to write a native library for each platform to define a GTK widget, a
> Cocoa view, and a Windows… whatever they’re called in Windows. (I don’t do
> Windows development.) Then I’d be able to write my own plumbing to connect
> those native components with a Racket class that would provide the adequate
> abstractions.
>
> I’m willing to work out those problems, but in order to do that, I do need
> to figure out a suitable method for actually adding a GUI component. I’d
> love for adding a web view to be as easy as typing (new web-view% [parent
> frame] [url "http://google.com"]) and have it just work.
>
> Is this possible? Is it foreseeably possible? If not, what would be the best
> way to integrate such functionality so that it’s at least semi-composable
> with the existing libraries?
>
> (As a note, rendering to a canvas% or something like that is most certainly
> out of the question. Chromium needs access to the window itself to get the
> hardware-accelerated performance necessary to actually make it feasible.)
>
> Alexis
>
> ____________________
> Racket Users list:
> http://lists.racket-lang.org/users
>
--
Jay McCarthy
http://jeapostrophe.github.io
"Wherefore, be not weary in well-doing,
for ye are laying the foundation of a great work.
And out of small things proceedeth that which is great."
- D&C 64:33