fix: xdg surface handle pending configure + dont update usable area when new layer surface firt create

This commit is contained in:
DL
2025-07-03 14:58:20 +02:00
parent c1393a1366
commit ea98928849
4 changed files with 23 additions and 5 deletions

View File

@ -352,7 +352,7 @@ void diyac_new_layer_surface(struct wl_listener *listener, void *data)
*/
struct wlr_layer_surface_v1_state old_state = layer_surface->current;
layer_surface->current = layer_surface->pending;
diyac_output_update_usable_area(output);
// diyac_output_update_usable_area(output);
layer_surface->current = old_state;
}

21
view.c
View File

@ -26,10 +26,9 @@ static int handle_configure_timeout(void *data)
return 0; /* ignored per wl_event_loop docs */
}
static void diyac_view_configure(struct diyac_view *view, struct wlr_box geo)
void diya_view_set_pending_configure_serial(struct diyac_view* view, uint32_t serial)
{
view->pending_size = geo;
view->configuration_serial = wlr_xdg_toplevel_set_size(view->xdg_toplevel, geo.width, geo.height);
view->configuration_serial = serial;
if (!view->configuration_timeout)
{
view->configuration_timeout = wl_event_loop_add_timer(view->server->wl_event_loop, handle_configure_timeout, view);
@ -37,10 +36,24 @@ static void diyac_view_configure(struct diyac_view *view, struct wlr_box geo)
wl_event_source_timer_update(view->configuration_timeout, CONFIGURE_TIMEOUT_MS);
}
static void diyac_view_configure(struct diyac_view *view, struct wlr_box geo)
{
view->pending_size = geo;
uint32_t serial = wlr_xdg_toplevel_set_size(view->xdg_toplevel, geo.width, geo.height);
if(serial > 0)
{
diya_view_set_pending_configure_serial(view, serial);
}
}
static void diyac_view_set_activated(struct diyac_view *view, bool activated)
{
struct diyac_server *server = view->server;
wlr_xdg_toplevel_set_activated(view->xdg_toplevel, activated);
uint32_t serial = wlr_xdg_toplevel_set_activated(view->xdg_toplevel, activated);
if(serial > 0)
{
diya_view_set_pending_configure_serial(view, serial);
}
if (view->toplevel.handle)
{
wlr_foreign_toplevel_handle_v1_set_activated(view->toplevel.handle, activated);

1
view.h
View File

@ -22,4 +22,5 @@ void diyac_view_update_title(struct diyac_view * view);
void diyac_view_update_app_id(struct diyac_view * view);
void diyac_view_sync_geo(struct diyac_view *view);
void diya_view_unfocus(struct diyac_view* view);
void diya_view_set_pending_configure_serial(struct diyac_view* view, uint32_t serial);
#endif

4
xdg.c
View File

@ -65,6 +65,10 @@ static void xdg_toplevel_commit(struct wl_listener *listener, void *data)
wlr_xdg_surface_schedule_configure(xdg_surface);
uint32_t wm_caps = WLR_XDG_TOPLEVEL_WM_CAPABILITIES_MAXIMIZE | WLR_XDG_TOPLEVEL_WM_CAPABILITIES_FULLSCREEN | WLR_XDG_TOPLEVEL_WM_CAPABILITIES_MINIMIZE;
wlr_xdg_toplevel_set_wm_capabilities(toplevel->xdg_toplevel, wm_caps);
if(serial > 0)
{
diya_view_set_pending_configure_serial(toplevel, serial);
}
return;
}