<div dir="ltr"><div>Hi Keerthivasan,</div><div><br></div><div>Answers below.</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Em ter., 26 de dez. de 2023 às 15:32, Keerthivasan Raghavan <<a href="mailto:mail2akash97@gmail.com">mail2akash97@gmail.com</a>> escreveu:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:"Droid Sans Mono","monospace",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><div><span style="color:rgb(212,212,212)">Hi All,</span></div><br><div><span style="color:rgb(212,212,212)">I am a newbie to the desktop/embedded linux graphics and widget toolkit.</span></div><br><div><span style="color:rgb(212,212,212)">The following is a list of questions about how OpenJFX is architected/designed/implemented:</span></div><br><div><span style="color:rgb(103,150,230)">*</span><span style="color:rgb(212,212,212)"> How does openjfx manage the lifecycle of windows/surfaces/graphics-context(EGL/OpenGL) to draw into?</span></div><div><span style="color:rgb(212,212,212)"> What is the (design and implementation)/architecture of the window system abstraction used by OpenJFX?</span></div><div><span style="color:rgb(212,212,212)"> Any links to code snippets inside OpenJFX showing the creation/management of an X11-Window/Wayland-Surface would help.</span></div><div><span style="color:rgb(212,212,212)"> References:</span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(103,150,230)">*</span><span style="color:rgb(212,212,212)"> GTK uses GDK(<a href="https://docs.gtk.org/gtk4/drawing-model.html" target="_blank">https://docs.gtk.org/gtk4/drawing-model.html</a>) for managing windowing abstraction.</span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(103,150,230)">*</span><span style="color:rgb(212,212,212)"> GLFW, a cross platform (window + graphics context + input) management: <a href="https://www.glfw.org/" target="_blank">https://www.glfw.org/</a></span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(103,150,230)">*</span><span style="color:rgb(212,212,212)"> Microsoft Windows win32 API: <a href="https://learn.microsoft.com/en-us/windows/win32/learnwin32/creating-a-window" target="_blank">https://learn.microsoft.com/en-us/windows/win32/learnwin32/creating-a-window</a>, </span></div><div><span style="color:rgb(212,212,212)"> <a href="https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-createwindowexa" target="_blank">https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-createwindowexa</a></span></div><br></div></div></blockquote><div><br></div><div>Each platform has its implementation.The abstraction layer is called "glass". In the case of linux, gtk is used. Pure wayland (without XWayland) is not supported yet - and, from my experience, gtk will probably not be used.</div><div>Look for glass_window.cpp for the Gtk backend.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:"Droid Sans Mono","monospace",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><div><span style="color:rgb(103,150,230)">*</span><span style="color:rgb(212,212,212)"> How are frames created using drawing operations?</span></div><div><span style="color:rgb(212,212,212)"> What is the abstraction used to express the content of the frame?</span></div><div><span style="color:rgb(212,212,212)"> Any code/design links please.</span></div><div><span style="color:rgb(212,212,212)"> References:</span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(103,150,230)">*</span><span style="color:rgb(212,212,212)"> GTK uses GSK(<a href="https://docs.gtk.org/gsk4/" target="_blank">https://docs.gtk.org/gsk4/</a>) for building the scene graph that can be rendered as a frame.</span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(103,150,230)">*</span><span style="color:rgb(212,212,212)"> Windows reference: <a href="https://learn.microsoft.com/en-us/windows/win32/learnwin32/your-first-direct2d-program" target="_blank">https://learn.microsoft.com/en-us/windows/win32/learnwin32/your-first-direct2d-program</a></span></div><br></div></div></blockquote><div><br></div><div>The rendering abstraction layer is called "prism". I'm not sure how the scene graph is translated into rendering artifacts. </div><div>On Linux, GLX is used to glue to OpenGL on a sublayer of prism called "es2". If Wayland is implemented, it will have to use EGL.</div><div>Windows uses direct3d</div><div>Mac will use Metal (I think it's under development).</div><div><br></div><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:"Droid Sans Mono","monospace",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><br><div><span style="color:rgb(103,150,230)">*</span><span style="color:rgb(212,212,212)"> How is event management done in OpenGFX ?</span></div><div><span style="color:rgb(212,212,212)"> Any code/design links please.</span></div><div><span style="color:rgb(212,212,212)"> Reference: </span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(103,150,230)">*</span><span style="color:rgb(212,212,212)"> GTK uses an main eventloop <a href="https://docs.gtk.org/glib/main-loop.html" target="_blank">https://docs.gtk.org/glib/main-loop.html</a> .</span></div></div></div></blockquote><div><br></div><div>Desktop events originate from glass and it's platform dependent. Those events are translated into JavaFX event system.</div><div>In the case of Linux it also uses GTK eventloop.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:"Droid Sans Mono","monospace",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><br><div><span style="color:rgb(103,150,230)">*</span><span style="color:rgb(212,212,212)"> How are widgets drawn ? How are events dispatched to widgets and how do widgets react to events ?</span></div><div><span style="color:rgb(212,212,212)"> How is the application widget UI state stored and what is the corresponding memory management for storing the UI/widget state ?</span></div><div><span style="color:rgb(212,212,212)"> Does the UI state get modeled as a scene graph ?</span></div><div><span style="color:rgb(212,212,212)"> Any code/design links please.</span></div><div><span style="color:rgb(212,212,212)"> Reference: </span></div><div><span style="color:rgb(212,212,212)"> </span><span style="color:rgb(103,150,230)">*</span><span style="color:rgb(212,212,212)"> <a href="https://learn.microsoft.com/en-us/windows/win32/learnwin32/retained-mode-versus-immediate-mode" target="_blank">https://learn.microsoft.com/en-us/windows/win32/learnwin32/retained-mode-versus-immediate-mode</a></span></div></div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:"Droid Sans Mono","monospace",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><br></div></div></blockquote><div><br></div><div>Widgets are drawn using the scene graph. I think a Node is the basic element (on the public API). </div><div>In the case of Linux, javafx draws directly into the window/surface (that is passed by glass). This is the case of hardware accelerated rendering. If software is used, it generates a bitmap buffer that is passed to glass. In the case of linux, cairo is used.</div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:"Droid Sans Mono","monospace",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"></div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:"Droid Sans Mono","monospace",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap">Please feel free to reply with code links, design docs, wikis or articles of the web.<br></div><div style="color:rgb(212,212,212);background-color:rgb(30,30,30);font-family:"Droid Sans Mono","monospace",monospace;font-weight:normal;font-size:14px;line-height:19px;white-space:pre-wrap"><br><div><span style="color:rgb(212,212,212)">Thank you,</span></div><div><span style="color:rgb(212,212,212)">Keerthivasan Raghavan</span></div></div></div>
</blockquote></div></div>