(Wayland) Style nits

This commit is contained in:
twinaphex 2021-12-24 14:29:12 +01:00
parent f0392474f2
commit e1d144e2b8
2 changed files with 143 additions and 131 deletions

View File

@ -87,7 +87,8 @@ static void handle_toplevel_config_common(void *data,
break; break;
} }
} }
if (width > 0 && height > 0) if ( width > 0
&& height > 0)
{ {
wl->prev_width = width; wl->prev_width = width;
wl->prev_height = height; wl->prev_height = height;
@ -251,17 +252,14 @@ static void gfx_ctx_wl_update_title(void *data)
video_driver_get_window_title(title, sizeof(title)); video_driver_get_window_title(title, sizeof(title));
#ifdef HAVE_LIBDECOR #ifdef HAVE_LIBDECOR
if (wl && title[0]) { if (wl && title[0])
libdecor_frame_set_title(wl->libdecor_frame, title); libdecor_frame_set_title(wl->libdecor_frame, title);
}
#else #else
if (wl && title[0]) if (wl && title[0])
{ {
if (wl->deco) if (wl->deco)
{
zxdg_toplevel_decoration_v1_set_mode(wl->deco, zxdg_toplevel_decoration_v1_set_mode(wl->deco,
ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE); ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
}
xdg_toplevel_set_title(wl->xdg_toplevel, title); xdg_toplevel_set_title(wl->xdg_toplevel, title);
} }
#endif #endif
@ -272,7 +270,10 @@ static bool gfx_ctx_wl_get_metrics(void *data,
{ {
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
if (!wl || !wl->current_output || wl->current_output->physical_width == 0 || wl->current_output->physical_height == 0) if ( !wl
|| !wl->current_output
|| wl->current_output->physical_width == 0
|| wl->current_output->physical_height == 0)
return false; return false;
switch (type) switch (type)
@ -286,7 +287,8 @@ static bool gfx_ctx_wl_get_metrics(void *data,
break; break;
case DISPLAY_METRIC_DPI: case DISPLAY_METRIC_DPI:
*value = (float)wl->current_output->width * 25.4f / (float)wl->current_output->physical_width; *value = (float)wl->current_output->width * 25.4f /
(float)wl->current_output->physical_width;
break; break;
default: default:
@ -313,31 +315,37 @@ static void
handle_libdecor_frame_configure(struct libdecor_frame *frame, handle_libdecor_frame_configure(struct libdecor_frame *frame,
struct libdecor_configuration *configuration, void *data) struct libdecor_configuration *configuration, void *data)
{ {
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
struct libdecor_state *state;
int width, height; int width, height;
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
static const enum libdecor_window_state tiled_states = ( struct libdecor_state *state = NULL;
LIBDECOR_WINDOW_STATE_TILED_LEFT | LIBDECOR_WINDOW_STATE_TILED_RIGHT | static const enum
LIBDECOR_WINDOW_STATE_TILED_TOP | LIBDECOR_WINDOW_STATE_TILED_BOTTOM libdecor_window_state tiled_states = (
LIBDECOR_WINDOW_STATE_TILED_LEFT
| LIBDECOR_WINDOW_STATE_TILED_RIGHT
| LIBDECOR_WINDOW_STATE_TILED_TOP
| LIBDECOR_WINDOW_STATE_TILED_BOTTOM
); );
enum libdecor_window_state window_state; enum libdecor_window_state window_state;
bool focused = false; bool focused = false;
wl->fullscreen = false; bool tiled = false;
wl->maximized = false;
bool tiled = false; wl->fullscreen = false;
if (libdecor_configuration_get_window_state(configuration, &window_state)) { wl->maximized = false;
wl->fullscreen = (window_state & LIBDECOR_WINDOW_STATE_FULLSCREEN) != 0;
wl->maximized = (window_state & LIBDECOR_WINDOW_STATE_MAXIMIZED) != 0; if (libdecor_configuration_get_window_state(
focused = (window_state & LIBDECOR_WINDOW_STATE_ACTIVE) != 0; configuration, &window_state))
tiled = (window_state & tiled_states) != 0; {
} wl->fullscreen = (window_state & LIBDECOR_WINDOW_STATE_FULLSCREEN) != 0;
wl->maximized = (window_state & LIBDECOR_WINDOW_STATE_MAXIMIZED) != 0;
focused = (window_state & LIBDECOR_WINDOW_STATE_ACTIVE) != 0;
tiled = (window_state & tiled_states) != 0;
}
if (!libdecor_configuration_get_content_size(configuration, frame, if (!libdecor_configuration_get_content_size(configuration, frame,
&width, &height)) { &width, &height))
width = wl->prev_width; {
height = wl->prev_height; width = wl->prev_width;
height = wl->prev_height;
} }
if (width > 0 && height > 0) if (width > 0 && height > 0)
@ -352,9 +360,10 @@ handle_libdecor_frame_configure(struct libdecor_frame *frame,
if (wl->win) if (wl->win)
wl_egl_window_resize(wl->win, wl->width, wl->height, 0, 0); wl_egl_window_resize(wl->win, wl->width, wl->height, 0, 0);
else else
wl->win = wl_egl_window_create(wl->surface, wl->win = wl_egl_window_create(
wl->width * wl->buffer_scale, wl->surface,
wl->height * wl->buffer_scale); wl->width * wl->buffer_scale,
wl->height * wl->buffer_scale);
#endif #endif
state = libdecor_state_new(wl->width, wl->height); state = libdecor_state_new(wl->width, wl->height);
@ -446,8 +455,6 @@ static void *gfx_ctx_wl_init(void *video_driver)
if (!wl) if (!wl)
return NULL; return NULL;
(void)video_driver;
wl_list_init(&wl->all_outputs); wl_list_init(&wl->all_outputs);
#ifdef HAVE_EGL #ifdef HAVE_EGL
@ -485,9 +492,9 @@ static void *gfx_ctx_wl_init(void *video_driver)
frontend_driver_destroy_signal_handler_state(); frontend_driver_destroy_signal_handler_state();
wl->input.dpy = wl_display_connect(NULL); wl->input.dpy = wl_display_connect(NULL);
wl->last_buffer_scale = 1; wl->last_buffer_scale = 1;
wl->buffer_scale = 1; wl->buffer_scale = 1;
if (!wl->input.dpy) if (!wl->input.dpy)
{ {
@ -546,14 +553,14 @@ static void *gfx_ctx_wl_init(void *video_driver)
goto error; goto error;
#endif #endif
wl->input.keyboard_focus = true; wl->input.keyboard_focus = true;
wl->input.mouse.focus = true; wl->input.mouse.focus = true;
wl->cursor.surface = wl_compositor_create_surface(wl->compositor); wl->cursor.surface = wl_compositor_create_surface(wl->compositor);
wl->cursor.theme = wl_cursor_theme_load(NULL, 16, wl->shm); wl->cursor.theme = wl_cursor_theme_load(NULL, 16, wl->shm);
wl->cursor.default_cursor = wl_cursor_theme_get_cursor(wl->cursor.theme, "left_ptr"); wl->cursor.default_cursor = wl_cursor_theme_get_cursor(wl->cursor.theme, "left_ptr");
wl->num_active_touches = 0; wl->num_active_touches = 0;
for (i = 0;i < MAX_TOUCHES;i++) for (i = 0;i < MAX_TOUCHES;i++)
{ {
@ -606,7 +613,8 @@ static EGLint *egl_fill_attribs(gfx_ctx_wayland_data_t *wl, EGLint *attr)
*attr++ = EGL_CONTEXT_MINOR_VERSION_KHR; *attr++ = EGL_CONTEXT_MINOR_VERSION_KHR;
*attr++ = wl->egl.minor; *attr++ = wl->egl.minor;
/* Technically, we don't have core/compat until 3.2. /* Technically, we don't have core/compat until 3.2.
* Version 3.1 is either compat or not depending on GL_ARB_compatibility. */ * Version 3.1 is either compat or not depending
* on GL_ARB_compatibility. */
if (version >= 3002) if (version >= 3002)
{ {
*attr++ = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR; *attr++ = EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR;
@ -627,8 +635,9 @@ static EGLint *egl_fill_attribs(gfx_ctx_wayland_data_t *wl, EGLint *attr)
case GFX_CTX_OPENGL_ES_API: case GFX_CTX_OPENGL_ES_API:
#ifdef HAVE_OPENGLES #ifdef HAVE_OPENGLES
*attr++ = EGL_CONTEXT_CLIENT_VERSION; /* Same as EGL_CONTEXT_MAJOR_VERSION */ *attr++ = EGL_CONTEXT_CLIENT_VERSION;
*attr++ = wl->egl.major ? (EGLint)wl->egl.major : 2; /* Same as EGL_CONTEXT_MAJOR_VERSION */
*attr++ = wl->egl.major ? (EGLint)wl->egl.major : 2;
#ifdef EGL_KHR_create_context #ifdef EGL_KHR_create_context
if (wl->egl.minor > 0) if (wl->egl.minor > 0)
{ {
@ -695,16 +704,18 @@ static bool gfx_ctx_wl_set_video_mode(void *data,
#ifdef HAVE_LIBDECOR #ifdef HAVE_LIBDECOR
wl->libdecor_context = libdecor_new(wl->input.dpy, &libdecor_interface); wl->libdecor_context = libdecor_new(wl->input.dpy, &libdecor_interface);
if (wl->libdecor_context) { if (wl->libdecor_context)
{
wl->libdecor_frame = libdecor_decorate(wl->libdecor_context, wl->surface, &libdecor_frame_interface, wl); wl->libdecor_frame = libdecor_decorate(wl->libdecor_context, wl->surface, &libdecor_frame_interface, wl);
if (wl->libdecor_frame == NULL) { if (!wl->libdecor_frame)
{
RARCH_ERR("[Wayland]: Failed to crate libdecor frame\n"); RARCH_ERR("[Wayland]: Failed to crate libdecor frame\n");
goto error; goto error;
} else {
libdecor_frame_set_app_id(wl->libdecor_frame, "retroarch");
libdecor_frame_set_title(wl->libdecor_frame, "RetroArch");
libdecor_frame_map(wl->libdecor_frame);
} }
libdecor_frame_set_app_id(wl->libdecor_frame, "retroarch");
libdecor_frame_set_title(wl->libdecor_frame, "RetroArch");
libdecor_frame_map(wl->libdecor_frame);
} }
/* Waiting for libdecor to be configured before starting to draw */ /* Waiting for libdecor to be configured before starting to draw */
@ -712,10 +723,13 @@ static bool gfx_ctx_wl_set_video_mode(void *data,
wl->configured = true; wl->configured = true;
while (wl->configured) while (wl->configured)
if (libdecor_dispatch(wl->libdecor_context, 0) < 0) { {
if (libdecor_dispatch(wl->libdecor_context, 0) < 0)
{
RARCH_ERR("[Wayland]: libdecor failed to dispatch\n"); RARCH_ERR("[Wayland]: libdecor failed to dispatch\n");
goto error; goto error;
}; }
}
#else #else
wl->xdg_surface = xdg_wm_base_get_xdg_surface(wl->xdg_shell, wl->surface); wl->xdg_surface = xdg_wm_base_get_xdg_surface(wl->xdg_shell, wl->surface);
xdg_surface_add_listener(wl->xdg_surface, &xdg_surface_listener, wl); xdg_surface_add_listener(wl->xdg_surface, &xdg_surface_listener, wl);
@ -727,21 +741,19 @@ static bool gfx_ctx_wl_set_video_mode(void *data,
xdg_toplevel_set_title(wl->xdg_toplevel, "RetroArch"); xdg_toplevel_set_title(wl->xdg_toplevel, "RetroArch");
if (wl->deco_manager) if (wl->deco_manager)
{ wl->deco = zxdg_decoration_manager_v1_get_toplevel_decoration(
wl->deco = zxdg_decoration_manager_v1_get_toplevel_decoration( wl->deco_manager, wl->xdg_toplevel);
wl->deco_manager, wl->xdg_toplevel);
}
/* Waiting for xdg_toplevel to be configured before starting to draw */ /* Waiting for xdg_toplevel to be configured before starting to draw */
wl_surface_commit(wl->surface); wl_surface_commit(wl->surface);
wl->configured = true; wl->configured = true;
while (wl->configured) while (wl->configured)
wl_display_dispatch(wl->input.dpy); wl_display_dispatch(wl->input.dpy);
#endif #endif
wl_display_roundtrip(wl->input.dpy); wl_display_roundtrip(wl->input.dpy);
xdg_wm_base_add_listener(wl->xdg_shell, &xdg_shell_listener, NULL); xdg_wm_base_add_listener(wl->xdg_shell, &xdg_shell_listener, NULL);
#ifdef HAVE_EGL #ifdef HAVE_EGL
if (!egl_create_context(&wl->egl, (attr != egl_attribs) if (!egl_create_context(&wl->egl, (attr != egl_attribs)
@ -817,27 +829,26 @@ static bool gfx_ctx_wl_has_focus(void *data)
static bool gfx_ctx_wl_suppress_screensaver(void *data, bool state) static bool gfx_ctx_wl_suppress_screensaver(void *data, bool state)
{ {
(void)data; gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data; if (!wl->idle_inhibit_manager)
return false;
if (state == (!!wl->idle_inhibitor))
return true;
if (!wl->idle_inhibit_manager) if (state)
return false; {
if (state == (!!wl->idle_inhibitor)) RARCH_LOG("[Wayland]: Enabling idle inhibitor\n");
return true; struct zwp_idle_inhibit_manager_v1 *mgr = wl->idle_inhibit_manager;
if (state) wl->idle_inhibitor = zwp_idle_inhibit_manager_v1_create_inhibitor(mgr, wl->surface);
{ }
RARCH_LOG("[Wayland]: Enabling idle inhibitor\n"); else
struct zwp_idle_inhibit_manager_v1 *mgr = wl->idle_inhibit_manager; {
wl->idle_inhibitor = zwp_idle_inhibit_manager_v1_create_inhibitor(mgr, wl->surface); RARCH_LOG("[Wayland]: Disabling the idle inhibitor\n");
} zwp_idle_inhibitor_v1_destroy(wl->idle_inhibitor);
else wl->idle_inhibitor = NULL;
{ }
RARCH_LOG("[Wayland]: Disabling the idle inhibitor\n"); return true;
zwp_idle_inhibitor_v1_destroy(wl->idle_inhibitor);
wl->idle_inhibitor = NULL;
}
return true;
} }
static enum gfx_ctx_api gfx_ctx_wl_get_api(void *data) static enum gfx_ctx_api gfx_ctx_wl_get_api(void *data)
@ -898,17 +909,16 @@ static bool gfx_ctx_wl_bind_api(void *video_driver,
static void gfx_ctx_wl_swap_buffers(void *data) static void gfx_ctx_wl_swap_buffers(void *data)
{ {
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
#ifdef HAVE_EGL #ifdef HAVE_EGL
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
egl_swap_buffers(&wl->egl); egl_swap_buffers(&wl->egl);
#endif #endif
} }
static void gfx_ctx_wl_bind_hw_render(void *data, bool enable) static void gfx_ctx_wl_bind_hw_render(void *data, bool enable)
{ {
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
#ifdef HAVE_EGL #ifdef HAVE_EGL
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
egl_bind_hw_render(&wl->egl, enable); egl_bind_hw_render(&wl->egl, enable);
#endif #endif
} }

View File

@ -243,9 +243,8 @@ static void gfx_ctx_wl_update_title(void *data)
video_driver_get_window_title(title, sizeof(title)); video_driver_get_window_title(title, sizeof(title));
#ifdef HAVE_LIBDECOR #ifdef HAVE_LIBDECOR
if (wl && title[0]) { if (wl && title[0])
libdecor_frame_set_title(wl->libdecor_frame, title); libdecor_frame_set_title(wl->libdecor_frame, title);
}
#else #else
if (wl && title[0]) if (wl && title[0])
{ {
@ -306,31 +305,33 @@ static void
handle_libdecor_frame_configure(struct libdecor_frame *frame, handle_libdecor_frame_configure(struct libdecor_frame *frame,
struct libdecor_configuration *configuration, void *data) struct libdecor_configuration *configuration, void *data)
{ {
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
struct libdecor_state *state; struct libdecor_state *state;
int width, height; int width, height;
enum libdecor_window_state window_state;
gfx_ctx_wayland_data_t *wl = (gfx_ctx_wayland_data_t*)data;
bool focused = false;
bool tiled = false;
static const enum libdecor_window_state tiled_states = ( static const enum libdecor_window_state tiled_states = (
LIBDECOR_WINDOW_STATE_TILED_LEFT | LIBDECOR_WINDOW_STATE_TILED_RIGHT | LIBDECOR_WINDOW_STATE_TILED_LEFT | LIBDECOR_WINDOW_STATE_TILED_RIGHT |
LIBDECOR_WINDOW_STATE_TILED_TOP | LIBDECOR_WINDOW_STATE_TILED_BOTTOM LIBDECOR_WINDOW_STATE_TILED_TOP | LIBDECOR_WINDOW_STATE_TILED_BOTTOM
); );
enum libdecor_window_state window_state; wl->fullscreen = false;
bool focused = false; wl->maximized = false;
wl->fullscreen = false;
wl->maximized = false; if (libdecor_configuration_get_window_state(configuration, &window_state))
bool tiled = false; {
if (libdecor_configuration_get_window_state(configuration, &window_state)) { wl->fullscreen = (window_state & LIBDECOR_WINDOW_STATE_FULLSCREEN) != 0;
wl->fullscreen = (window_state & LIBDECOR_WINDOW_STATE_FULLSCREEN) != 0; wl->maximized = (window_state & LIBDECOR_WINDOW_STATE_MAXIMIZED) != 0;
wl->maximized = (window_state & LIBDECOR_WINDOW_STATE_MAXIMIZED) != 0; focused = (window_state & LIBDECOR_WINDOW_STATE_ACTIVE) != 0;
focused = (window_state & LIBDECOR_WINDOW_STATE_ACTIVE) != 0; tiled = (window_state & tiled_states) != 0;
tiled = (window_state & tiled_states) != 0;
} }
if (!libdecor_configuration_get_content_size(configuration, frame, if (!libdecor_configuration_get_content_size(configuration, frame,
&width, &height)) { &width, &height))
width = wl->prev_width; {
height = wl->prev_height; width = wl->prev_width;
height = wl->prev_height;
} }
if (width > 0 && height > 0) if (width > 0 && height > 0)
@ -382,15 +383,13 @@ static void *gfx_ctx_wl_init(void *video_driver)
if (!wl) if (!wl)
return NULL; return NULL;
(void)video_driver;
wl_list_init(&wl->all_outputs); wl_list_init(&wl->all_outputs);
frontend_driver_destroy_signal_handler_state(); frontend_driver_destroy_signal_handler_state();
wl->input.dpy = wl_display_connect(NULL); wl->input.dpy = wl_display_connect(NULL);
wl->last_buffer_scale = 1; wl->last_buffer_scale = 1;
wl->buffer_scale = 1; wl->buffer_scale = 1;
if (!wl->input.dpy) if (!wl->input.dpy)
{ {
@ -437,14 +436,14 @@ static void *gfx_ctx_wl_init(void *video_driver)
if (!vulkan_context_init(&wl->vk, VULKAN_WSI_WAYLAND)) if (!vulkan_context_init(&wl->vk, VULKAN_WSI_WAYLAND))
goto error; goto error;
wl->input.keyboard_focus = true; wl->input.keyboard_focus = true;
wl->input.mouse.focus = true; wl->input.mouse.focus = true;
wl->cursor.surface = wl_compositor_create_surface(wl->compositor); wl->cursor.surface = wl_compositor_create_surface(wl->compositor);
wl->cursor.theme = wl_cursor_theme_load(NULL, 16, wl->shm); wl->cursor.theme = wl_cursor_theme_load(NULL, 16, wl->shm);
wl->cursor.default_cursor = wl_cursor_theme_get_cursor(wl->cursor.theme, "left_ptr"); wl->cursor.default_cursor = wl_cursor_theme_get_cursor(wl->cursor.theme, "left_ptr");
wl->num_active_touches = 0; wl->num_active_touches = 0;
for (i = 0;i < MAX_TOUCHES;i++) for (i = 0;i < MAX_TOUCHES;i++)
{ {
@ -512,16 +511,18 @@ static bool gfx_ctx_wl_set_video_mode(void *data,
#ifdef HAVE_LIBDECOR #ifdef HAVE_LIBDECOR
wl->libdecor_context = libdecor_new(wl->input.dpy, &libdecor_interface); wl->libdecor_context = libdecor_new(wl->input.dpy, &libdecor_interface);
if (wl->libdecor_context) { if (wl->libdecor_context)
{
wl->libdecor_frame = libdecor_decorate(wl->libdecor_context, wl->surface, &libdecor_frame_interface, wl); wl->libdecor_frame = libdecor_decorate(wl->libdecor_context, wl->surface, &libdecor_frame_interface, wl);
if (wl->libdecor_frame == NULL) { if (!wl->libdecor_frame)
{
RARCH_ERR("[Wayland/Vulkan]: Failed to crate libdecor frame\n"); RARCH_ERR("[Wayland/Vulkan]: Failed to crate libdecor frame\n");
goto error; goto error;
} else {
libdecor_frame_set_app_id(wl->libdecor_frame, "retroarch");
libdecor_frame_set_title(wl->libdecor_frame, "RetroArch");
libdecor_frame_map(wl->libdecor_frame);
} }
libdecor_frame_set_app_id(wl->libdecor_frame, "retroarch");
libdecor_frame_set_title(wl->libdecor_frame, "RetroArch");
libdecor_frame_map(wl->libdecor_frame);
} }
/* Waiting for libdecor to be configured before starting to draw */ /* Waiting for libdecor to be configured before starting to draw */
@ -529,12 +530,15 @@ static bool gfx_ctx_wl_set_video_mode(void *data,
wl->configured = true; wl->configured = true;
while (wl->configured) while (wl->configured)
if (libdecor_dispatch(wl->libdecor_context, 0) < 0) { {
if (libdecor_dispatch(wl->libdecor_context, 0) < 0)
{
RARCH_ERR("[Wayland/Vulkan]: libdecor failed to dispatch\n"); RARCH_ERR("[Wayland/Vulkan]: libdecor failed to dispatch\n");
goto error; goto error;
}; }
}
#else #else
wl->xdg_surface = xdg_wm_base_get_xdg_surface(wl->xdg_shell, wl->surface); wl->xdg_surface = xdg_wm_base_get_xdg_surface(wl->xdg_shell, wl->surface);
xdg_surface_add_listener(wl->xdg_surface, &xdg_surface_listener, wl); xdg_surface_add_listener(wl->xdg_surface, &xdg_surface_listener, wl);
wl->xdg_toplevel = xdg_surface_get_toplevel(wl->xdg_surface); wl->xdg_toplevel = xdg_surface_get_toplevel(wl->xdg_surface);
@ -544,30 +548,28 @@ static bool gfx_ctx_wl_set_video_mode(void *data,
xdg_toplevel_set_title(wl->xdg_toplevel, "RetroArch"); xdg_toplevel_set_title(wl->xdg_toplevel, "RetroArch");
if (wl->deco_manager) if (wl->deco_manager)
{ wl->deco = zxdg_decoration_manager_v1_get_toplevel_decoration(
wl->deco = zxdg_decoration_manager_v1_get_toplevel_decoration( wl->deco_manager, wl->xdg_toplevel);
wl->deco_manager, wl->xdg_toplevel);
}
/* Waiting for xdg_toplevel to be configured before starting to draw */ /* Waiting for xdg_toplevel to be configured before starting to draw */
wl_surface_commit(wl->surface); wl_surface_commit(wl->surface);
wl->configured = true; wl->configured = true;
while (wl->configured) while (wl->configured)
wl_display_dispatch(wl->input.dpy); wl_display_dispatch(wl->input.dpy);
#endif #endif
wl_display_roundtrip(wl->input.dpy); wl_display_roundtrip(wl->input.dpy);
xdg_wm_base_add_listener(wl->xdg_shell, &xdg_shell_listener, NULL); xdg_wm_base_add_listener(wl->xdg_shell, &xdg_shell_listener, NULL);
if (fullscreen) if (fullscreen)
{ {
#ifdef HAVE_LIBDECOR #ifdef HAVE_LIBDECOR
libdecor_frame_set_fullscreen(wl->libdecor_frame, NULL); libdecor_frame_set_fullscreen(wl->libdecor_frame, NULL);
#else #else
xdg_toplevel_set_fullscreen(wl->xdg_toplevel, NULL); xdg_toplevel_set_fullscreen(wl->xdg_toplevel, NULL);
#endif #endif
} }
flush_wayland_fd(&wl->input); flush_wayland_fd(&wl->input);