如何使用xdg-shell调整大小?

时间:2018-11-29 18:36:25

标签: c++ c wayland

我尝试在RetroArch中设置窗口调整xdg_toplevel的大小,但是在上一个“ else”之后,顶层已损坏

static void handle_toplevel_config(void *data, struct xdg_toplevel *toplevel,
                                   int32_t width, int32_t height, struct wl_array *states)
{
    gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;

    /* TODO: implement resizing */
    printf("Configure event got, width: %d, height: %d\n", width, height);
    wl->fullscreen = false;
    wl->maximized = wl->resize = false;
    enum xdg_toplevel_state *state;
    wl_array_for_each(state, states) {
        switch (*state) {
            case XDG_TOPLEVEL_STATE_FULLSCREEN:
                wl->fullscreen = true;
                break;
            case XDG_TOPLEVEL_STATE_MAXIMIZED:
            printf("Surface state: XDG_SURFACE_STATE_MAXIMIZED\n");
                wl->maximized = true;
                break;
            case XDG_TOPLEVEL_STATE_RESIZING:
            printf("Surface state: XDG_SURFACE_STATE_RESIZING\n");
                wl->resize = true;
                break;
            case XDG_TOPLEVEL_STATE_ACTIVATED:
            printf("Surface state: XDG_SURFACE_STATE_ACTIVATED\n");
                wl->activated = true;
                break;
            }
    }
    if (width > 0 && height > 0) {
        if (!wl->fullscreen) {
            wl->prev_width = width;
            wl->prev_height = height;
            wl->width = width;
            wl->height = height;
        }
    }
    else {
        wl->width = wl->prev_width;
        wl->height = wl->prev_height;
    }

    wl->configured = false;
}
  

[WARN] [stb]字体图集太大:2457x2457 [ERROR]创建失败   渲染后端:机顶盒。 [信息] [字体]:使用字体渲染后端:   位图。 [WARN] [stb]字体图集太大:2457x2457 [ERROR]无法   创建渲染后端:stb。 [信息] [字体]:使用字体渲染   后端:位图。

没有最后一个“ else”块,它可以完美运行。

0 个答案:

没有答案