diff --git a/glfw/wl_window.c b/glfw/wl_window.c index 35fabd611..e5cd1e226 100644 --- a/glfw/wl_window.c +++ b/glfw/wl_window.c @@ -361,8 +361,8 @@ resizeFramebuffer(_GLFWwindow* window) { double scale = _glfwWaylandWindowScale(window); int scaled_width = (int)round(window->wl.width * scale); int scaled_height = (int)round(window->wl.height * scale); - debug("Resizing framebuffer to: %dx%d window size: %dx%d at scale: %.3f\n", - scaled_width, scaled_height, window->wl.width, window->wl.height, scale); + debug("Resizing framebuffer of window: %llu to: %dx%d window size: %dx%d at scale: %.3f\n", + window->id, scaled_width, scaled_height, window->wl.width, window->wl.height, scale); wl_egl_window_resize(window->wl.native, scaled_width, scaled_height, 0, 0); update_regions(window); window->wl.waiting_for_swap_to_commit = true; @@ -376,7 +376,7 @@ _glfwWaylandAfterBufferSwap(_GLFWwindow* window) { window->wl.temp_buffer_used_during_window_creation = NULL; } if (window->wl.waiting_for_swap_to_commit) { - debug("Waiting for swap to commit: swap has happened, window surface committed\n"); + debug("Waiting for swap to commit window %llu: swap has happened, window surface committed\n", window->id); window->wl.waiting_for_swap_to_commit = false; // this is not really needed, since I think eglSwapBuffers() calls wl_surface_commit() // but lets be safe. See https://gitlab.freedesktop.org/mesa/mesa/-/blob/main/src/egl/drivers/dri2/platform_wayland.c#L1510 @@ -415,7 +415,7 @@ dispatchChangesAfterConfigure(_GLFWwindow *window, int32_t width, int32_t height } if (scale_changed) { - debug("Scale changed to %.3f in dispatchChangesAfterConfigure\n", _glfwWaylandWindowScale(window)); + debug("Scale changed to %.3f in dispatchChangesAfterConfigure for window: %llu\n", _glfwWaylandWindowScale(window), window->id); apply_scale_changes(window, !size_changed, false); } @@ -427,8 +427,8 @@ dispatchChangesAfterConfigure(_GLFWwindow *window, int32_t width, int32_t height static void inform_compositor_of_window_geometry(_GLFWwindow *window, const char *event) { #define geometry window->wl.decorations.geometry - debug("Setting window \"visible area\" geometry in %s event: x=%d y=%d %dx%d viewport: %dx%d\n", - event, geometry.x, geometry.y, geometry.width, geometry.height, window->wl.width, window->wl.height); + debug("Setting window %llu \"visible area\" geometry in %s event: x=%d y=%d %dx%d viewport: %dx%d\n", + window->id, event, geometry.x, geometry.y, geometry.width, geometry.height, window->wl.width, window->wl.height); xdg_surface_set_window_geometry(window->wl.xdg.surface, geometry.x, geometry.y, geometry.width, geometry.height); if (window->wl.wp_viewport) wp_viewport_set_destination(window->wl.wp_viewport, window->wl.width, window->wl.height); #undef geometry @@ -443,7 +443,7 @@ xdgDecorationHandleConfigure(void* data, _GLFWwindow* window = data; window->wl.pending.decoration_mode = mode; window->wl.pending_state |= PENDING_STATE_DECORATION; - debug("XDG decoration configure event received: has_server_side_decorations: %d\n", (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE)); + debug("XDG decoration configure event received for window %llu: has_server_side_decorations: %d\n", window->id, (mode == ZXDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE)); } static const struct zxdg_toplevel_decoration_v1_listener xdgDecorationListener = { @@ -468,7 +468,7 @@ static void surfaceHandleEnter(void *data, window->wl.monitors[window->wl.monitorsCount++] = monitor; if (checkScaleChange(window)) { - debug("Scale changed to %.3f in surfaceHandleEnter\n", _glfwWaylandWindowScale(window)); + debug("Scale changed to %.3f for window %llu in surfaceHandleEnter\n", _glfwWaylandWindowScale(window), window->id); apply_scale_changes(window, true, true); } } @@ -492,7 +492,7 @@ static void surfaceHandleLeave(void *data, window->wl.monitors[--window->wl.monitorsCount] = NULL; if (checkScaleChange(window)) { - debug("Scale changed to %.3f in surfaceHandleLeave\n", _glfwWaylandWindowScale(window)); + debug("Scale changed to %.3f for window %llu in surfaceHandleLeave\n", _glfwWaylandWindowScale(window), window->id); apply_scale_changes(window, true, true); } } @@ -503,7 +503,7 @@ surface_preferred_buffer_scale(void *data, struct wl_surface *surface UNUSED, in _GLFWwindow* window = data; window->wl.once.preferred_scale_received = true; if ((int)window->wl.integer_scale.preferred == scale && window->wl.window_fully_created) return; - debug("Preferred integer buffer scale changed to: %d\n", scale); + debug("Preferred integer buffer scale changed to: %d for window %llu\n", scale, window->id); window->wl.integer_scale.preferred = scale; window->wl.window_fully_created = true; if (!window->wl.fractional_scale) apply_scale_changes(window, true, true); @@ -530,7 +530,7 @@ fractional_scale_preferred_scale(void *data, struct wp_fractional_scale_v1 *wp_f _GLFWwindow *window = data; window->wl.once.fractional_scale_received = true; if (scale == window->wl.fractional_scale && window->wl.window_fully_created) return; - debug("Fractional scale requested: %u/120 = %.2f\n", scale, scale / 120.); + debug("Fractional scale requested: %u/120 = %.2f for window %llu\n", scale, scale / 120., window->id); window->wl.fractional_scale = scale; // Hyprland sends a fraction scale = 1 event before configuring the xdg surface and then another after with the correct scale window->wl.window_fully_created = window->wl.once.surface_configured || scale != 120; @@ -584,7 +584,7 @@ static bool createSurface(_GLFWwindow* window, window->wl.integer_scale.deduced = scale; if (_glfw.wl.has_preferred_buffer_scale) { scale = 1; window->wl.integer_scale.preferred = 1; } - debug("Creating window at size: %dx%d and scale %d\n", wndconfig->width, wndconfig->height, scale); + debug("Creating window %llu at size: %dx%d and scale %d\n", window->id, wndconfig->width, wndconfig->height, scale); window->wl.native = wl_egl_window_create(window->wl.surface, wndconfig->width * scale, wndconfig->height * scale); if (!window->wl.native) return false; @@ -643,7 +643,7 @@ xdgToplevelHandleConfigure(void* data, float targetRatio; enum xdg_toplevel_state* state; uint32_t new_states = 0; - debug("XDG top-level configure event: size: %dx%d states: ", width, height); + debug("XDG top-level configure event for window %llu: size: %dx%d states: ", window->id, width, height); wl_array_for_each(state, states) { switch (*state) { @@ -725,7 +725,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); + debug("Compositor set top-level bounds of: %dx%d for window %llu\n", width, height, window->id); } static const struct xdg_toplevel_listener xdgToplevelListener = { @@ -774,7 +774,7 @@ apply_xdg_configure_changes(_GLFWwindow *window) { csd_set_window_geometry(window, &width, &height); bool resized = dispatchChangesAfterConfigure(window, width, height); csd_set_visible(window, !(window->wl.decorations.serverSide || window->monitor || window->wl.current.toplevel_states & TOPLEVEL_STATE_FULLSCREEN)); - debug("Final window content size: %dx%d resized: %d\n", width, height, resized); + debug("Final window %llu content size: %dx%d resized: %d\n", window->id, width, height, resized); } inform_compositor_of_window_geometry(window, "configure"); @@ -857,14 +857,14 @@ attach_temp_buffer_during_window_creation(_GLFWwindow *window) { if (!window->wl.temp_buffer_used_during_window_creation) return false; wl_surface_attach(window->wl.surface, window->wl.temp_buffer_used_during_window_creation, 0, 0); wl_surface_commit(window->wl.surface); - debug("Attached temp buffer during window creation of size: %dx%d and rgba(%u, %u, %u, %u)\n", width, height, color.red, color.green, color.blue, color.alpha); + debug("Attached temp buffer during window %llu creation of size: %dx%d and rgba(%u, %u, %u, %u)\n", window->id, width, height, color.red, color.green, color.blue, color.alpha); return true; } static void loop_till_window_fully_created(_GLFWwindow *window) { if (!window->wl.window_fully_created) { - debug("Waiting for compositor to send fractional scale for window\n"); + debug("Waiting for compositor to send fractional scale for window %llu\n", window->id); monotonic_t start = monotonic(); while (!window->wl.window_fully_created && monotonic() - start < ms_to_monotonic_t(300)) { if (wl_display_roundtrip(_glfw.wl.display) == -1) { @@ -888,7 +888,7 @@ xdgSurfaceHandleConfigure(void* data, struct xdg_surface* surface, uint32_t seri // or buffer state query. _GLFWwindow* window = data; xdg_surface_ack_configure(surface, serial); - debug("XDG surface configure event received and acknowledged\n"); + debug("XDG surface configure event received and acknowledged for window %llu\n", window->id); apply_xdg_configure_changes(window); if (!window->wl.window_fully_created) { if (!attach_temp_buffer_during_window_creation(window)) window->wl.window_fully_created = true;