mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 12:55:58 +01:00
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:
parent
60ca6f17eb
commit
d40bcfe2c1
2 changed files with 11 additions and 8 deletions
|
@ -412,10 +412,12 @@ void xwm_handle_selection_request(struct wlr_xwm *xwm,
|
||||||
|
|
||||||
// No xwayland surface focused, deny access to clipboard
|
// No xwayland surface focused, deny access to clipboard
|
||||||
if (xwm->focus_surface == NULL && xwm->drag_focus == NULL) {
|
if (xwm->focus_surface == NULL && xwm->drag_focus == NULL) {
|
||||||
char *selection_name = xwm_get_atom_name(xwm, selection->atom);
|
if (wlr_log_get_verbosity() >= WLR_DEBUG) {
|
||||||
wlr_log(WLR_DEBUG, "denying read access to selection %u (%s): "
|
char *selection_name = xwm_get_atom_name(xwm, selection->atom);
|
||||||
"no xwayland surface focused", selection->atom, selection_name);
|
wlr_log(WLR_DEBUG, "denying read access to selection %u (%s): "
|
||||||
free(selection_name);
|
"no xwayland surface focused", selection->atom, selection_name);
|
||||||
|
free(selection_name);
|
||||||
|
}
|
||||||
goto fail_notify_requestor;
|
goto fail_notify_requestor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -873,7 +873,7 @@ static void read_surface_property(struct wlr_xwm *xwm,
|
||||||
read_surface_role(xwm, xsurface, reply);
|
read_surface_role(xwm, xsurface, reply);
|
||||||
} else if (property == xwm->atoms[NET_STARTUP_ID]) {
|
} else if (property == xwm->atoms[NET_STARTUP_ID]) {
|
||||||
read_surface_startup_id(xwm, xsurface, reply);
|
read_surface_startup_id(xwm, xsurface, reply);
|
||||||
} else {
|
} else if (wlr_log_get_verbosity() >= WLR_DEBUG) {
|
||||||
char *prop_name = xwm_get_atom_name(xwm, property);
|
char *prop_name = xwm_get_atom_name(xwm, property);
|
||||||
wlr_log(WLR_DEBUG, "unhandled X11 property %" PRIu32 " (%s) for window %" PRIu32,
|
wlr_log(WLR_DEBUG, "unhandled X11 property %" PRIu32 " (%s) for window %" PRIu32,
|
||||||
property, prop_name ? prop_name : "(null)", xsurface->window_id);
|
property, prop_name ? prop_name : "(null)", xsurface->window_id);
|
||||||
|
@ -1327,7 +1327,7 @@ static void xwm_handle_net_wm_state_message(struct wlr_xwm *xwm,
|
||||||
changed = update_state(action, &xsurface->maximized_horz);
|
changed = update_state(action, &xsurface->maximized_horz);
|
||||||
} else if (property == xwm->atoms[NET_WM_STATE_HIDDEN]) {
|
} else if (property == xwm->atoms[NET_WM_STATE_HIDDEN]) {
|
||||||
changed = update_state(action, &xsurface->minimized);
|
changed = update_state(action, &xsurface->minimized);
|
||||||
} else if (property != XCB_ATOM_NONE) {
|
} else if (property != XCB_ATOM_NONE && wlr_log_get_verbosity() >= WLR_DEBUG) {
|
||||||
char *prop_name = xwm_get_atom_name(xwm, property);
|
char *prop_name = xwm_get_atom_name(xwm, property);
|
||||||
wlr_log(WLR_DEBUG, "Unhandled NET_WM_STATE property change "
|
wlr_log(WLR_DEBUG, "Unhandled NET_WM_STATE property change "
|
||||||
"%"PRIu32" (%s)", property, prop_name ? prop_name : "(null)");
|
"%"PRIu32" (%s)", property, prop_name ? prop_name : "(null)");
|
||||||
|
@ -1391,7 +1391,7 @@ static void xwm_handle_wm_protocols_message(struct wlr_xwm *xwm,
|
||||||
|
|
||||||
wl_event_source_timer_update(surface->ping_timer, 0);
|
wl_event_source_timer_update(surface->ping_timer, 0);
|
||||||
surface->pinging = false;
|
surface->pinging = false;
|
||||||
} else {
|
} else if (wlr_log_get_verbosity() >= WLR_DEBUG) {
|
||||||
char *type_name = xwm_get_atom_name(xwm, type);
|
char *type_name = xwm_get_atom_name(xwm, type);
|
||||||
wlr_log(WLR_DEBUG, "unhandled WM_PROTOCOLS client message %" PRIu32 " (%s)",
|
wlr_log(WLR_DEBUG, "unhandled WM_PROTOCOLS client message %" PRIu32 " (%s)",
|
||||||
type, type_name ? type_name : "(null)");
|
type, type_name ? type_name : "(null)");
|
||||||
|
@ -1520,7 +1520,8 @@ static void xwm_handle_client_message(struct wlr_xwm *xwm,
|
||||||
xwm_handle_net_startup_info_message(xwm, ev);
|
xwm_handle_net_startup_info_message(xwm, ev);
|
||||||
} else if (ev->type == xwm->atoms[WM_CHANGE_STATE]) {
|
} else if (ev->type == xwm->atoms[WM_CHANGE_STATE]) {
|
||||||
xwm_handle_wm_change_state_message(xwm, ev);
|
xwm_handle_wm_change_state_message(xwm, ev);
|
||||||
} else if (!xwm_handle_selection_client_message(xwm, ev)) {
|
} else if (!xwm_handle_selection_client_message(xwm, ev) &&
|
||||||
|
wlr_log_get_verbosity() >= WLR_DEBUG) {
|
||||||
char *type_name = xwm_get_atom_name(xwm, ev->type);
|
char *type_name = xwm_get_atom_name(xwm, ev->type);
|
||||||
wlr_log(WLR_DEBUG, "unhandled x11 client message %" PRIu32 " (%s)", ev->type,
|
wlr_log(WLR_DEBUG, "unhandled x11 client message %" PRIu32 " (%s)", ev->type,
|
||||||
type_name ? type_name : "(null)");
|
type_name ? type_name : "(null)");
|
||||||
|
|
Loading…
Reference in a new issue