Esempio n. 1
0
static union waffle_native_config*
wayland_config_get_native(struct wcore_config *wc_config)
{
    struct wegl_config *config = wegl_config(wc_config);
    struct wayland_display *dpy = wayland_display(wc_config->display);
    union waffle_native_config *n_config;

    WCORE_CREATE_NATIVE_UNION(n_config, wayland);
    if (!n_config)
        return NULL;

    wayland_display_fill_native(dpy, &n_config->wayland->display);
    n_config->wayland->egl_config = config->egl;

    return n_config;
}
Esempio n. 2
0
struct wcore_window*
xegl_window_create(struct wcore_platform *wc_plat,
                   struct wcore_config *wc_config,
                   int width,
                   int height)
{
    struct xegl_window *self;
    struct xegl_display *dpy = xegl_display(wc_config->display);
    struct wegl_config *config = wegl_config(wc_config);
    xcb_visualid_t visual;
    bool ok = true;

    self = wcore_calloc(sizeof(*self));
    if (self == NULL)
        return NULL;

    ok = eglGetConfigAttrib(dpy->wegl.egl,
                            config->egl,
                            EGL_NATIVE_VISUAL_ID,
                            (EGLint*) &visual);
    if (!ok) {
        wegl_emit_error("eglGetConfigAttrib(EGL_NATIVE_VISUAL_ID)");
        goto error;
    }

    ok = x11_window_init(&self->x11,
                         &dpy->x11,
                         visual,
                         width,
                         height);
    if (!ok)
        goto error;

    ok = wegl_window_init(&self->wegl,
                          &config->wcore,
                          (intptr_t) self->x11.xcb);
    if (!ok)
        goto error;

    return &self->wegl.wcore;

error:
    xegl_window_destroy(&self->wegl.wcore);
    return NULL;
}