New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Better Embedding API proposal #18479
Comments
I will be working on this. But first, I'm experimenting with embedding Servo in an Android app, and I also need to understand the impact of multiprocess and sandboxing. |
I started to write a crate for a gtk binding to servo and there's one thing I'd like a better API. Also, I don't know what you meant by that:
But if I had to manage a second event loop in my crate, it would become way more complex, for the creator of the crate, but also to the users. Thanks. |
Yes. I'm planning to fix that once I introduce multi-window support. We would initiate Servo first, then attach compositors.
No, you won't need a second event loop. It's just a cosmetic change. Instead of having to implement the Because 1) servo already have these events internally ( Then, any wrapper around Servo (ServoGtk, ServoQt, ServoWebview, …) would translate these events to widget specific callbacks. |
Sorry, I hesitated to create a separate issue for my question but how can I embedded Servo in a Java/JOGL software? Of course, JOGL is able to create an OpenGL context, NEWT (its own windowing API) is able to drive the event loop to ensure rendering and input processing but is there a JNI binding for Servo? I'd like to use Servo with JOGL to render web pages. I'd like to be able to write the UIs in HTML/Javascript with a mean to know which events are generated when the user clicks on a link, for example to build the menus in my first person shooter. |
In theory, there's nothing blocking you here. |
@paulrouget Do I have to write the JNI bindings myself? I try to evaluate the amount of time required to have something partially working. I saw somewhere that you're working on a tiny JNI binding targeting Android. I was thinking about using a FBO to render to a texture as a first step. What do you mean exactly by "its own gl buffer"? |
PR #20912 will provide a simple servo library for Android with the JNI bindings. You can render on a texture. That will work. |
@paulrouget Thank you. I understand that's a work in progress. If I need to use a larger subset of the Servo API, I might temporarily use jnr-ffi. Which methods do you plan to keep in libsimpleservo? I've looked at jniapi.rs, I see only a few methods to resize the browser, go back, load a URI, ... |
What do you need? |
Maybe I'm missing something obvious. I know that I have to call Java_com_mozilla_servoview_NativeServo_init first, it creates the context and JOGL can create an external context bound to this one. I understand that HostTrait.flush is called when the GL buffer has been updated but I don't know how to get the content of this GL buffer. |
In Java, create a surface. When Servo calls |
triage: is this still an issue? |
Yes. Still relevant. |
These are just cosmetic changes, but that would make it easier from the perspective of the embedder to use libservo.
WindowEvent
should be functions. For example,servo.reload(id)
instead ofservo.handle_event(vec![WindowEvent::Reload(id)])
.use
when using libservo #18475WindowEvent::LayoutChanged(LayoutStruct)
WindowMethods
related to navigation (load_start, load_end, …) should become events. And embedder has to deal with an event loop. It makes sense for Servo to provide events instead of callbacks. Maybe by just queuingEmbedderMsg
s.WindowMethods:present
andcomposite
should have their own callbacksServo::handle_event(vec![])
all the time Can we make it so the embedder doesn't need to call Browser::handle_event() when there's no event? #15734The text was updated successfully, but these errors were encountered: