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.
This commit is contained in:
Simon Ser 2023-07-28 14:21:37 +02:00
parent 60ca6f17eb
commit d40bcfe2c1
2 changed files with 11 additions and 8 deletions

View file

@ -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;
}