Xnest: helper for writing property by atom and type name
Add a little helper for writing properties, using atom and type as string instead of XIDs. The upstream's atom XIDs are looked up automatically. Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
parent
3a53bebd2f
commit
731e84e592
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Reference in New Issue