Migrate GTK+3 with EGL application from X11 to Wayland

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Migrate GTK+3 with EGL application from X11 to Wayland

2,323 Views
MariusMaximus
Contributor I

At this moment I have experience with ARM Tegra 2 with X11
My application  use GTK+ for user interface (widows, buttons ,menu etc..)
Some parts of UI use OpenGL ES over EGL

Sample code: http://bobthegnome.blogspot.com/2014/09/using-egl-with-gtk.html 

static void realize_cb (GtkWidget *widget)
{
    EGLConfig egl_config;
    EGLint n_config;
    EGLint attributes[] = { EGL_RENDERABLE_TYPE, EGL_OPENGL_BIT,
                            EGL_NONE };

    egl_display = eglGetDisplay ((EGLNativeDisplayType) gdk_x11_display_get_xdisplay (gtk_widget_get_display (widget)));
    eglInitialize (egl_display, NULL, NULL);
    eglChooseConfig (egl_display, attributes, &egl_config, 1, &n_config);
    eglBindAPI (EGL_OPENGL_API); // or EGL_OPENGL_ES_API !!!!
    egl_surface = eglCreateWindowSurface (egl_display, egl_config, gdk_x11_window_get_xid (gtk_widget_get_window (widget)), NULL);
    egl_context = eglCreateContext (egl_display, egl_config, EGL_NO_CONTEXT, NULL);
}

 

This function create egl_display, egl_surface,  egl_context   From GtkWidget 

At this moment i try migrate applcation to "imx8 mini"

Where is the problem: wayland don't have functions gdk_x11_....  it is wayland, OK
But how to fix it ?   How to create egl context in GTK+ ? Is it possible ?

0 Kudos
2 Replies

2,312 Views
Bio_TICFSL
NXP TechSupport
NXP TechSupport

Hello MariusMaximus,

 

No, You need to check the file to disable-x11-backend none of i.MX8 have an X11 backend, and gtk+ is X11 specific.

 

Regards

 

0 Kudos

2,304 Views
MariusMaximus
Contributor I

>> gtk+ is X11 specific.

   In my opinion , I don't think you're right . I have build "DISTRO=fsl-imx-wayland " for my imx8 , GTK+ application works OK. I don't have any X11 lib in my image.

Please look at this video  https://www.youtube.com/watch?v=fr8eo4RlPw4
web browser as backend for gtk+application , I just found it

In my Old application on X11 I have 2 windows.Window [2] has parent set to Window [1]

app.png

  I'd like to do the same on wayland

I can create EGL context in window created by "wl_egl_window_create"

And I have for moment

app2.png

But widows are independend , after focus window [1] I see

app3.png

 

0 Kudos