From d40bcfe2c18f057f4bc324a81230f6ba2267db44 Mon Sep 17 00:00:00 2001 From: Simon Ser Date: Fri, 28 Jul 2023 14:21:37 +0200 Subject: xwayland: avoid calling xwm_get_atom_name() when debug logs are off xwm_get_atom_name() performs a roundtrip to the X11 server. Avoid calling this blocking function if debug logs are turned off. --- xwayland/selection/outgoing.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'xwayland/selection') diff --git a/xwayland/selection/outgoing.c b/xwayland/selection/outgoing.c index 87c0fb06..3e5432f0 100644 --- a/xwayland/selection/outgoing.c +++ b/xwayland/selection/outgoing.c @@ -412,10 +412,12 @@ void xwm_handle_selection_request(struct wlr_xwm *xwm, // No xwayland surface focused, deny access to clipboard if (xwm->focus_surface == NULL && xwm->drag_focus == NULL) { - char *selection_name = xwm_get_atom_name(xwm, selection->atom); - wlr_log(WLR_DEBUG, "denying read access to selection %u (%s): " - "no xwayland surface focused", selection->atom, selection_name); - free(selection_name); + if (wlr_log_get_verbosity() >= WLR_DEBUG) { + char *selection_name = xwm_get_atom_name(xwm, selection->atom); + wlr_log(WLR_DEBUG, "denying read access to selection %u (%s): " + "no xwayland surface focused", selection->atom, selection_name); + free(selection_name); + } goto fail_notify_requestor; } -- cgit v1.2.3