Wayland: Respect top level bounds sent by compositor

This commit is contained in:
Kovid Goyal 2024-04-06 17:29:17 +05:30
parent c651312a88
commit 283eba9667
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C
3 changed files with 11 additions and 0 deletions

8
glfw/internal.h vendored
View file

@ -111,6 +111,13 @@ typedef void (* _GLFWdestroycontextfun)(_GLFWwindow*);
#define GL_CONTEXT_RELEASE_BEHAVIOR_FLUSH 0x82fc
#define GL_CONTEXT_FLAG_NO_ERROR_BIT_KHR 0x00000008
#define MAX(x, y) __extension__ ({ \
__typeof__ (x) a = (x); __typeof__ (y) b = (y); \
a > b ? a : b;})
#define MIN(x, y) __extension__ ({ \
__typeof__ (x) a = (x); __typeof__ (y) b = (y); \
a < b ? a : b;})
typedef int GLint;
typedef unsigned int GLuint;
typedef unsigned int GLenum;
@ -875,3 +882,4 @@ int _glfwPlatformSetWindowBlur(_GLFWwindow* handle, int value);
char* _glfw_strdup(const char* source);
void _glfw_free_clipboard_data(_GLFWClipboardData *cd);

View file

@ -469,6 +469,8 @@ set_csd_window_geometry(_GLFWwindow *window, int32_t *width, int32_t *height) {
if (!size_specified_by_compositor) {
*width = window->wl.user_requested_content_size.width;
*height = window->wl.user_requested_content_size.height;
if (window->wl.xdg.top_level_bounds.width > 0) *width = MIN(*width, window->wl.xdg.top_level_bounds.width);
if (window->wl.xdg.top_level_bounds.height > 0) *height = MIN(*height, window->wl.xdg.top_level_bounds.height);
if (has_csd) *height += decs.metrics.visible_titlebar_height;
}
decs.geometry.x = 0; decs.geometry.y = 0;

1
glfw/wl_window.c vendored
View file

@ -719,6 +719,7 @@ xdg_toplevel_configure_bounds(void *data, struct xdg_toplevel *xdg_toplevel UNUS
_GLFWwindow *window = data;
window->wl.xdg.top_level_bounds.width = width;
window->wl.xdg.top_level_bounds.height = height;
debug("Compositor set top-level bounds of: %dx%d\n", width, height);
}
static const struct xdg_toplevel_listener xdgToplevelListener = {