This commit is contained in:
Kovid Goyal 2021-04-07 15:26:30 +05:30
parent 850a8218db
commit fe0e1adb2a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

10
glfw/wl_window.c vendored
View File

@ -42,6 +42,7 @@
#include <fcntl.h> #include <fcntl.h>
#include <sys/mman.h> #include <sys/mman.h>
#define debug(...) if (_glfw.hints.init.debugRendering) printf(__VA_ARGS__);
static struct wl_buffer* createShmBuffer(const GLFWimage* image, bool is_opaque, bool init_data) static struct wl_buffer* createShmBuffer(const GLFWimage* image, bool is_opaque, bool init_data)
{ {
@ -407,12 +408,11 @@ static void xdgToplevelHandleConfigure(void* data,
float targetRatio; float targetRatio;
enum xdg_toplevel_state* state; enum xdg_toplevel_state* state;
uint32_t new_states = 0; uint32_t new_states = 0;
const bool report_event = _glfw.hints.init.debugRendering; debug("top-level configure event: size: %dx%d states: ", width, height);
if (report_event) printf("top-level configure event: size: %dx%d states: ", width, height);
wl_array_for_each(state, states) { wl_array_for_each(state, states) {
switch (*state) { switch (*state) {
#define C(x) case XDG_##x: new_states |= x; if (report_event) printf("%s ", #x); break #define C(x) case XDG_##x: new_states |= x; debug("%s ", #x); break
C(TOPLEVEL_STATE_RESIZING); C(TOPLEVEL_STATE_RESIZING);
C(TOPLEVEL_STATE_MAXIMIZED); C(TOPLEVEL_STATE_MAXIMIZED);
C(TOPLEVEL_STATE_FULLSCREEN); C(TOPLEVEL_STATE_FULLSCREEN);
@ -424,7 +424,7 @@ static void xdgToplevelHandleConfigure(void* data,
#undef C #undef C
} }
} }
if (report_event) printf("\n"); debug("\n");
if (new_states & TOPLEVEL_STATE_RESIZING) { if (new_states & TOPLEVEL_STATE_RESIZING) {
if (width) window->wl.user_requested_content_size.width = width; if (width) window->wl.user_requested_content_size.width = width;
if (height) window->wl.user_requested_content_size.height = height; if (height) window->wl.user_requested_content_size.height = height;
@ -446,7 +446,7 @@ static void xdgToplevelHandleConfigure(void* data,
} }
window->wl.toplevel_states = new_states; window->wl.toplevel_states = new_states;
set_csd_window_geometry(window, &width, &height); set_csd_window_geometry(window, &width, &height);
if (report_event) printf("final window content size: %dx%d\n", window->wl.width, window->wl.height); debug("final window content size: %dx%d\n", window->wl.width, window->wl.height);
wl_surface_commit(window->wl.surface); wl_surface_commit(window->wl.surface);
dispatchChangesAfterConfigure(window, width, height); dispatchChangesAfterConfigure(window, width, height);
_glfwInputWindowFocus(window, window->wl.toplevel_states & TOPLEVEL_STATE_ACTIVATED); _glfwInputWindowFocus(window, window->wl.toplevel_states & TOPLEVEL_STATE_ACTIVATED);