aboutsummaryrefslogtreecommitdiff
path: root/xwayland/selection
diff options
context:
space:
mode:
authorSimon Ser <contact@emersion.fr>2023-07-28 14:21:37 +0200
committerSimon Ser <contact@emersion.fr>2023-07-28 14:21:37 +0200
commitd40bcfe2c18f057f4bc324a81230f6ba2267db44 (patch)
treebce3eef983848ee4f9061df079eabdba419854da /xwayland/selection
parent60ca6f17eb190cfdb3ba9863cdd8a4f7b00f3e64 (diff)
downloadwlroots-d40bcfe2c18f057f4bc324a81230f6ba2267db44.tar.xz
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.
Diffstat (limited to 'xwayland/selection')
-rw-r--r--xwayland/selection/outgoing.c10
1 files changed, 6 insertions, 4 deletions
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;
}