From 18a21b45f9987961f5a267018262e4cc556235e3 Mon Sep 17 00:00:00 2001 From: Seunghun Lee Date: Mon, 15 May 2023 10:54:03 +0900 Subject: [PATCH] xdg_shell_v6: Add ds_xdg_toplevel_v6_set APIs Change-Id: I3d57455ff3cdd41e0abb3f30b2513f777d422122 --- include/libds/xdg_shell_v6.h | 19 +++++++++++++----- src/xdg_shell_v6/xdg_toplevel_v6.c | 41 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 5 deletions(-) diff --git a/include/libds/xdg_shell_v6.h b/include/libds/xdg_shell_v6.h index 40c9c5a..35a2d42 100644 --- a/include/libds/xdg_shell_v6.h +++ b/include/libds/xdg_shell_v6.h @@ -14,6 +14,8 @@ struct ds_xdg_shell_v6; struct ds_xdg_surface_v6; +struct ds_xdg_toplevel_v6; + struct ds_xdg_shell_v6 * ds_xdg_shell_v6_create(struct wl_display *display); @@ -43,14 +45,21 @@ ds_xdg_surface_v6_ping(struct ds_xdg_surface_v6 *surface); struct ds_surface * ds_xdg_surface_v6_get_surface(struct ds_xdg_surface_v6 *surface); -uint32_t -ds_xdg_toplevel_set_size(struct ds_xdg_surface_v6 *surface, - uint32_t width, uint32_t height); +uint32_t ds_xdg_toplevel_v6_set_size(struct ds_xdg_toplevel_v6 *toplevel, + int32_t width, int32_t height); -uint32_t -ds_xdg_toplevel_set_activated(struct ds_xdg_surface_v6 *surface, +uint32_t ds_xdg_toplevel_v6_set_activated(struct ds_xdg_toplevel_v6 *toplevel, bool activated); +uint32_t ds_xdg_toplevel_v6_set_maximized(struct ds_xdg_toplevel_v6 *toplevel, + bool maximized); + +uint32_t ds_xdg_toplevel_v6_set_fullscreen(struct ds_xdg_toplevel_v6 *toplevel, + bool fullscreen); + +uint32_t ds_xdg_toplevel_v6_set_resizing(struct ds_xdg_toplevel_v6 *toplevel, + bool resizing); + #ifdef __cplusplus } #endif diff --git a/src/xdg_shell_v6/xdg_toplevel_v6.c b/src/xdg_shell_v6/xdg_toplevel_v6.c index 8a72807..dc3ca87 100644 --- a/src/xdg_shell_v6/xdg_toplevel_v6.c +++ b/src/xdg_shell_v6/xdg_toplevel_v6.c @@ -14,6 +14,47 @@ static const struct zxdg_toplevel_v6_interface xdg_toplevel_v6_impl; static void xdg_toplevel_v6_handle_resource_destroy(struct wl_resource *resource); +WL_EXPORT uint32_t +ds_xdg_toplevel_v6_set_size(struct ds_xdg_toplevel_v6 *toplevel, + int32_t width, int32_t height) +{ + toplevel->scheduled.width = width; + toplevel->scheduled.height = height; + return ds_xdg_surface_v6_schedule_configure(toplevel->base); +} + +WL_EXPORT uint32_t +ds_xdg_toplevel_v6_set_activated(struct ds_xdg_toplevel_v6 *toplevel, + bool activated) +{ + toplevel->scheduled.activated = activated; + return ds_xdg_surface_v6_schedule_configure(toplevel->base); +} + +WL_EXPORT uint32_t +ds_xdg_toplevel_v6_set_maximized(struct ds_xdg_toplevel_v6 *toplevel, + bool maximized) +{ + toplevel->scheduled.maximized = maximized; + return ds_xdg_surface_v6_schedule_configure(toplevel->base); +} + +WL_EXPORT uint32_t +ds_xdg_toplevel_v6_set_fullscreen(struct ds_xdg_toplevel_v6 *toplevel, + bool fullscreen) +{ + toplevel->scheduled.fullscreen = fullscreen; + return ds_xdg_surface_v6_schedule_configure(toplevel->base); +} + +WL_EXPORT uint32_t +ds_xdg_toplevel_v6_set_resizing(struct ds_xdg_toplevel_v6 *toplevel, + bool resizing) +{ + toplevel->scheduled.resizing = resizing; + return ds_xdg_surface_v6_schedule_configure(toplevel->base); +} + void create_xdg_toplevel_v6(struct ds_xdg_surface_v6 *surface, uint32_t id) { -- 2.7.4