xwayland: fix extraneous NET_WM_STATE log messages

wlroots would log "Unhandled NET_WM_STATE property change" log
messages for atoms we know about. Simplify the code structure
and remove these extra messages.
This commit is contained in:
Simon Ser 2021-01-26 23:11:29 +01:00 committed by Ilia Bozhinov
parent a406f19479
commit f8a66072e7

View file

@ -579,7 +579,7 @@ static void read_surface_hints(struct wlr_xwm *xwm,
if (xsurface->hints == NULL) { if (xsurface->hints == NULL) {
return; return;
} }
memcpy(xsurface->hints, &hints, sizeof(struct wlr_xwayland_surface_hints)); memcpy(xsurface->hints, &hints, sizeof(struct wlr_xwayland_surface_hints));
xsurface->hints_urgency = xcb_icccm_wm_hints_get_urgency(&hints); xsurface->hints_urgency = xcb_icccm_wm_hints_get_urgency(&hints);
@ -1165,27 +1165,27 @@ static void xwm_handle_net_wm_state_message(struct wlr_xwm *xwm,
for (size_t i = 0; i < 2; ++i) { for (size_t i = 0; i < 2; ++i) {
xcb_atom_t property = client_message->data.data32[1 + i]; xcb_atom_t property = client_message->data.data32[1 + i];
if (property == xwm->atoms[NET_WM_STATE_MODAL] && bool changed = false;
update_state(action, &xsurface->modal)) { if (property == xwm->atoms[NET_WM_STATE_MODAL]) {
xsurface_set_net_wm_state(xsurface); changed = update_state(action, &xsurface->modal);
} else if (property == xwm->atoms[NET_WM_STATE_FULLSCREEN] && } else if (property == xwm->atoms[NET_WM_STATE_FULLSCREEN]) {
update_state(action, &xsurface->fullscreen)) { changed = update_state(action, &xsurface->fullscreen);
xsurface_set_net_wm_state(xsurface); } else if (property == xwm->atoms[NET_WM_STATE_MAXIMIZED_VERT]) {
} else if (property == xwm->atoms[NET_WM_STATE_MAXIMIZED_VERT] && changed = update_state(action, &xsurface->maximized_vert);
update_state(action, &xsurface->maximized_vert)) { } else if (property == xwm->atoms[NET_WM_STATE_MAXIMIZED_HORZ]) {
xsurface_set_net_wm_state(xsurface); changed = update_state(action, &xsurface->maximized_horz);
} else if (property == xwm->atoms[NET_WM_STATE_MAXIMIZED_HORZ] && } else if (property == xwm->atoms[NET_WM_STATE_HIDDEN]) {
update_state(action, &xsurface->maximized_horz)) { changed = update_state(action, &xsurface->minimized);
xsurface_set_net_wm_state(xsurface);
} else if (property == xwm->atoms[NET_WM_STATE_HIDDEN] &&
update_state(action, &xsurface->minimized)) {
xsurface_set_net_wm_state(xsurface);
} else if (property != XCB_ATOM_NONE) { } else if (property != XCB_ATOM_NONE) {
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)");
free(prop_name); free(prop_name);
} }
if (changed) {
xsurface_set_net_wm_state(xsurface);
}
} }
// client_message->data.data32[3] is the source indication // client_message->data.data32[3] is the source indication
// all other values are set to 0 // all other values are set to 0