mirror of
https://gitlab.freedesktop.org/wlroots/wlroots.git
synced 2026-05-25 21:37:54 -04:00
xwayland: use const pointers for xcb_get_property_value()
These values must not be mutated, they are owned by the xcb_get_property_reply_t.
This commit is contained in:
parent
a00a9178ae
commit
9d6c9e8783
2 changed files with 11 additions and 11 deletions
|
|
@ -103,7 +103,7 @@ static int write_selection_property_to_wl_client(int fd, uint32_t mask,
|
||||||
void *data) {
|
void *data) {
|
||||||
struct wlr_xwm_selection_transfer *transfer = data;
|
struct wlr_xwm_selection_transfer *transfer = data;
|
||||||
|
|
||||||
char *property = xcb_get_property_value(transfer->property_reply);
|
const char *property = xcb_get_property_value(transfer->property_reply);
|
||||||
int remainder = xcb_get_property_value_length(transfer->property_reply) -
|
int remainder = xcb_get_property_value_length(transfer->property_reply) -
|
||||||
transfer->property_start;
|
transfer->property_start;
|
||||||
|
|
||||||
|
|
@ -343,7 +343,7 @@ static bool source_get_targets(struct wlr_xwm_selection *selection,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
xcb_atom_t *value = xcb_get_property_value(reply);
|
const xcb_atom_t *value = xcb_get_property_value(reply);
|
||||||
for (uint32_t i = 0; i < reply->value_len; i++) {
|
for (uint32_t i = 0; i < reply->value_len; i++) {
|
||||||
char *mime_type = NULL;
|
char *mime_type = NULL;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -659,7 +659,7 @@ static void read_surface_class(struct wlr_xwm *xwm,
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t len = xcb_get_property_value_length(reply);
|
size_t len = xcb_get_property_value_length(reply);
|
||||||
char *class = xcb_get_property_value(reply);
|
const char *class = xcb_get_property_value(reply);
|
||||||
|
|
||||||
// Unpack two sequentially stored strings: instance, class
|
// Unpack two sequentially stored strings: instance, class
|
||||||
size_t instance_len = strnlen(class, len);
|
size_t instance_len = strnlen(class, len);
|
||||||
|
|
@ -690,7 +690,7 @@ static void read_surface_startup_id(struct wlr_xwm *xwm,
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t len = xcb_get_property_value_length(reply);
|
size_t len = xcb_get_property_value_length(reply);
|
||||||
char *startup_id = xcb_get_property_value(reply);
|
const char *startup_id = xcb_get_property_value(reply);
|
||||||
|
|
||||||
free(xsurface->startup_id);
|
free(xsurface->startup_id);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
|
|
@ -719,7 +719,7 @@ static void read_surface_opacity(struct wlr_xwm *xwm,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t *val = xcb_get_property_value(reply);
|
const uint32_t *val = xcb_get_property_value(reply);
|
||||||
xsurface->opacity = (double)*val / UINT32_MAX;
|
xsurface->opacity = (double)*val / UINT32_MAX;
|
||||||
wl_signal_emit_mutable(&xsurface->events.set_opacity, NULL);
|
wl_signal_emit_mutable(&xsurface->events.set_opacity, NULL);
|
||||||
}
|
}
|
||||||
|
|
@ -734,7 +734,7 @@ static void read_surface_role(struct wlr_xwm *xwm,
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t len = xcb_get_property_value_length(reply);
|
size_t len = xcb_get_property_value_length(reply);
|
||||||
char *role = xcb_get_property_value(reply);
|
const char *role = xcb_get_property_value(reply);
|
||||||
|
|
||||||
free(xsurface->role);
|
free(xsurface->role);
|
||||||
if (len > 0) {
|
if (len > 0) {
|
||||||
|
|
@ -806,7 +806,7 @@ static void read_surface_parent(struct wlr_xwm *xwm,
|
||||||
}
|
}
|
||||||
|
|
||||||
struct wlr_xwayland_surface *found_parent = NULL;
|
struct wlr_xwayland_surface *found_parent = NULL;
|
||||||
xcb_window_t *xid = xcb_get_property_value(reply);
|
const xcb_window_t *xid = xcb_get_property_value(reply);
|
||||||
if (reply->type != XCB_ATOM_NONE && xid != NULL) {
|
if (reply->type != XCB_ATOM_NONE && xid != NULL) {
|
||||||
found_parent = lookup_surface(xwm, *xid);
|
found_parent = lookup_surface(xwm, *xid);
|
||||||
if (!has_parent(found_parent, xsurface)) {
|
if (!has_parent(found_parent, xsurface)) {
|
||||||
|
|
@ -837,7 +837,7 @@ static void read_surface_window_type(struct wlr_xwm *xwm,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
xcb_atom_t *atoms = xcb_get_property_value(reply);
|
const xcb_atom_t *atoms = xcb_get_property_value(reply);
|
||||||
size_t atoms_len = reply->value_len;
|
size_t atoms_len = reply->value_len;
|
||||||
size_t atoms_size = sizeof(xcb_atom_t) * atoms_len;
|
size_t atoms_size = sizeof(xcb_atom_t) * atoms_len;
|
||||||
|
|
||||||
|
|
@ -864,7 +864,7 @@ static void read_surface_protocols(struct wlr_xwm *xwm,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
xcb_atom_t *atoms = xcb_get_property_value(reply);
|
const xcb_atom_t *atoms = xcb_get_property_value(reply);
|
||||||
size_t atoms_len = reply->value_len;
|
size_t atoms_len = reply->value_len;
|
||||||
size_t atoms_size = sizeof(xcb_atom_t) * atoms_len;
|
size_t atoms_size = sizeof(xcb_atom_t) * atoms_len;
|
||||||
|
|
||||||
|
|
@ -981,7 +981,7 @@ static void read_surface_motif_hints(struct wlr_xwm *xwm,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t *motif_hints = xcb_get_property_value(reply);
|
const uint32_t *motif_hints = xcb_get_property_value(reply);
|
||||||
if (motif_hints[MWM_HINTS_FLAGS_FIELD] & MWM_HINTS_DECORATIONS) {
|
if (motif_hints[MWM_HINTS_FLAGS_FIELD] & MWM_HINTS_DECORATIONS) {
|
||||||
xsurface->decorations = WLR_XWAYLAND_SURFACE_DECORATIONS_ALL;
|
xsurface->decorations = WLR_XWAYLAND_SURFACE_DECORATIONS_ALL;
|
||||||
uint32_t decorations = motif_hints[MWM_HINTS_DECORATIONS_FIELD];
|
uint32_t decorations = motif_hints[MWM_HINTS_DECORATIONS_FIELD];
|
||||||
|
|
@ -1029,7 +1029,7 @@ static void read_surface_net_wm_state(struct wlr_xwm *xwm,
|
||||||
struct wlr_xwayland_surface *xsurface,
|
struct wlr_xwayland_surface *xsurface,
|
||||||
xcb_get_property_reply_t *reply) {
|
xcb_get_property_reply_t *reply) {
|
||||||
xsurface->fullscreen = 0;
|
xsurface->fullscreen = 0;
|
||||||
xcb_atom_t *atom = xcb_get_property_value(reply);
|
const xcb_atom_t *atom = xcb_get_property_value(reply);
|
||||||
for (uint32_t i = 0; i < reply->value_len; i++) {
|
for (uint32_t i = 0; i < reply->value_len; i++) {
|
||||||
if (atom[i] == xwm->atoms[NET_WM_STATE_MODAL]) {
|
if (atom[i] == xwm->atoms[NET_WM_STATE_MODAL]) {
|
||||||
xsurface->modal = true;
|
xsurface->modal = true;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue