diff --git a/hw/xnest/xcb.c b/hw/xnest/xcb.c index d78f3ebda..63e0371e1 100644 --- a/hw/xnest/xcb.c +++ b/hw/xnest/xcb.c @@ -576,3 +576,33 @@ int xnest_text_width_16 (xnestPrivFont *font, const uint16_t* str, int count) return width; } + +void xnest_upstream_set_property( + struct xnest_upstream_info *upstream, + xcb_window_t window, + const char* property, + const char* type, + int state, + uint32_t format, + uint32_t size, + void *data) +{ + xcb_atom_t upstream_atom_type = xnest_intern_atom(upstream->conn, type); + xcb_atom_t upstream_atom_name = xnest_intern_atom(upstream->conn, property); + + switch (state) { + case PropertyNewValue: + xcb_change_property(upstream->conn, + XCB_PROP_MODE_REPLACE, + window, + upstream_atom_name, + upstream_atom_type, + format, + size, + data); + break; + case PropertyDelete: + xcb_delete_property(upstream->conn, window, upstream_atom_name); + break; + } +} diff --git a/hw/xnest/xnest-xcb.h b/hw/xnest/xnest-xcb.h index 4619bd375..4e976bca7 100644 --- a/hw/xnest/xnest-xcb.h +++ b/hw/xnest/xnest-xcb.h @@ -107,4 +107,14 @@ int xnest_text_width_16 (xnestPrivFont *font, const uint16_t *string, int count) xcb_atom_t xnest_intern_atom(xcb_connection_t *conn, const char* name); +void xnest_upstream_set_property( + struct xnest_upstream_info *upstream, + xcb_window_t window, + const char* property, + const char* type, + int state, + uint32_t format, + uint32_t size, + void *data); + #endif /* __XNEST__XCB_H */