mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2025-10-29 05:40:12 -04:00
xwayland/xwm: log when property type is invalid
This commit is contained in:
parent
5175b6e94e
commit
08c74f36a9
1 changed files with 23 additions and 8 deletions
|
|
@ -646,6 +646,7 @@ static void read_surface_class(struct wlr_xwm *xwm,
|
|||
struct wlr_xwayland_surface *surface, xcb_get_property_reply_t *reply) {
|
||||
if (reply->type != XCB_ATOM_STRING && reply->type != xwm->atoms[UTF8_STRING] &&
|
||||
reply->type != XCB_ATOM_NONE) {
|
||||
wlr_log(WLR_DEBUG, "Invalid WM_CLASS property type");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -676,6 +677,7 @@ static void read_surface_startup_id(struct wlr_xwm *xwm,
|
|||
xcb_get_property_reply_t *reply) {
|
||||
if (reply->type != XCB_ATOM_STRING && reply->type != xwm->atoms[UTF8_STRING] &&
|
||||
reply->type != XCB_ATOM_NONE) {
|
||||
wlr_log(WLR_DEBUG, "Invalid NET_STARTUP_ID property type");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -697,17 +699,21 @@ static void read_surface_startup_id(struct wlr_xwm *xwm,
|
|||
static void read_surface_opacity(struct wlr_xwm *xwm,
|
||||
struct wlr_xwayland_surface *xsurface,
|
||||
xcb_get_property_reply_t *reply) {
|
||||
if (reply->type == XCB_ATOM_CARDINAL && reply->format == 32 &&
|
||||
xcb_get_property_value_length(reply) ==
|
||||
sizeof(uint32_t)) {
|
||||
uint32_t *val = xcb_get_property_value(reply);
|
||||
|
||||
xsurface->opacity = (double)*val / UINT32_MAX;
|
||||
wl_signal_emit_mutable(&xsurface->events.set_opacity, NULL);
|
||||
} else if (reply->type == XCB_ATOM_NONE) {
|
||||
if (reply->type == XCB_ATOM_NONE) {
|
||||
xsurface->opacity = 1.0;
|
||||
wl_signal_emit_mutable(&xsurface->events.set_opacity, NULL);
|
||||
return;
|
||||
}
|
||||
|
||||
if (reply->type != XCB_ATOM_CARDINAL || reply->format != 32 ||
|
||||
xcb_get_property_value_length(reply) != sizeof(uint32_t)) {
|
||||
wlr_log(WLR_DEBUG, "Invalid NET_WINDOW_OPACITY property type");
|
||||
return;
|
||||
}
|
||||
|
||||
uint32_t *val = xcb_get_property_value(reply);
|
||||
xsurface->opacity = (double)*val / UINT32_MAX;
|
||||
wl_signal_emit_mutable(&xsurface->events.set_opacity, NULL);
|
||||
}
|
||||
|
||||
static void read_surface_role(struct wlr_xwm *xwm,
|
||||
|
|
@ -715,6 +721,7 @@ static void read_surface_role(struct wlr_xwm *xwm,
|
|||
xcb_get_property_reply_t *reply) {
|
||||
if (reply->type != XCB_ATOM_STRING && reply->type != xwm->atoms[UTF8_STRING] &&
|
||||
reply->type != XCB_ATOM_NONE) {
|
||||
wlr_log(WLR_DEBUG, "Invalid WM_WINDOW_ROLE property type");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -736,6 +743,7 @@ static void read_surface_title(struct wlr_xwm *xwm,
|
|||
xcb_get_property_reply_t *reply) {
|
||||
if (reply->type != XCB_ATOM_STRING && reply->type != xwm->atoms[UTF8_STRING] &&
|
||||
reply->type != XCB_ATOM_NONE) {
|
||||
wlr_log(WLR_DEBUG, "Invalid WM_NAME/NET_WM_NAME property type");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -775,6 +783,7 @@ static void read_surface_parent(struct wlr_xwm *xwm,
|
|||
struct wlr_xwayland_surface *xsurface,
|
||||
xcb_get_property_reply_t *reply) {
|
||||
if (reply->type != XCB_ATOM_WINDOW && reply->type != XCB_ATOM_NONE) {
|
||||
wlr_log(WLR_DEBUG, "Invalid WM_TRANSIENT_FOR property type");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -806,6 +815,7 @@ static void read_surface_window_type(struct wlr_xwm *xwm,
|
|||
struct wlr_xwayland_surface *xsurface,
|
||||
xcb_get_property_reply_t *reply) {
|
||||
if (reply->type != XCB_ATOM_ATOM && reply->type != XCB_ATOM_NONE) {
|
||||
wlr_log(WLR_DEBUG, "Invalid NET_WM_WINDOW_TYPE property type");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -832,6 +842,7 @@ static void read_surface_protocols(struct wlr_xwm *xwm,
|
|||
struct wlr_xwayland_surface *xsurface,
|
||||
xcb_get_property_reply_t *reply) {
|
||||
if (reply->type != XCB_ATOM_ATOM && reply->type != XCB_ATOM_NONE) {
|
||||
wlr_log(WLR_DEBUG, "Invalid WM_PROTOCOLS property type");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -859,6 +870,7 @@ static void read_surface_hints(struct wlr_xwm *xwm,
|
|||
// In practice, reply->type == XCB_ATOM_ATOM
|
||||
if (reply->type != xwm->atoms[WM_HINTS] && reply->type != XCB_ATOM_ATOM &&
|
||||
reply->type != XCB_ATOM_NONE) {
|
||||
wlr_log(WLR_DEBUG, "Invalid WM_HINTS property type");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -886,6 +898,7 @@ static void read_surface_normal_hints(struct wlr_xwm *xwm,
|
|||
struct wlr_xwayland_surface *xsurface,
|
||||
xcb_get_property_reply_t *reply) {
|
||||
if (reply->type != xwm->atoms[WM_SIZE_HINTS] && reply->type != XCB_ATOM_NONE) {
|
||||
wlr_log(WLR_DEBUG, "Invalid WM_NORMAL_HINTS property type");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -944,6 +957,7 @@ static void read_surface_motif_hints(struct wlr_xwm *xwm,
|
|||
}
|
||||
|
||||
if (reply->value_len < 5) {
|
||||
wlr_log(WLR_DEBUG, "Invalid MOTIF_WM_HINTS property type");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -979,6 +993,7 @@ static void read_surface_strut_partial(struct wlr_xwm *xwm,
|
|||
if (reply->type != XCB_ATOM_CARDINAL || reply->format != 32 ||
|
||||
xcb_get_property_value_length(reply) !=
|
||||
sizeof(xcb_ewmh_wm_strut_partial_t)) {
|
||||
wlr_log(WLR_DEBUG, "Invalid NET_WM_STRUT_PARTIAL property type");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue