*/
void xcb_draw_line(xcb_connection_t *conn, xcb_drawable_t drawable, xcb_gcontext_t gc,
uint32_t colorpixel, uint32_t x, uint32_t y, uint32_t to_x, uint32_t to_y) {
- xcb_change_gc(conn, gc, XCB_GC_FOREGROUND, (uint32_t[]) {colorpixel});
+ xcb_change_gc(conn, gc, XCB_GC_FOREGROUND, (uint32_t[]){colorpixel});
xcb_poly_line(conn, XCB_COORD_MODE_ORIGIN, drawable, gc, 2,
- (xcb_point_t[]) {{x, y}, {to_x, to_y}});
+ (xcb_point_t[]){{x, y}, {to_x, to_y}});
}
/*
*/
void xcb_draw_rect(xcb_connection_t *conn, xcb_drawable_t drawable, xcb_gcontext_t gc,
uint32_t colorpixel, uint32_t x, uint32_t y, uint32_t width, uint32_t height) {
- xcb_change_gc(conn, gc, XCB_GC_FOREGROUND, (uint32_t[]) {colorpixel});
+ xcb_change_gc(conn, gc, XCB_GC_FOREGROUND, (uint32_t[]){colorpixel});
xcb_rectangle_t rect = {x, y, width, height};
xcb_poly_fill_rectangle(conn, drawable, gc, 1, &rect);
}
add_ignore_event(cookie.sequence, -1);
}
+/*
+ * Returns the first supported _NET_WM_WINDOW_TYPE atom.
+ *
+ */
+xcb_atom_t xcb_get_preferred_window_type(xcb_get_property_reply_t *reply) {
+ if (reply == NULL || xcb_get_property_value_length(reply) == 0)
+ return XCB_NONE;
+
+ xcb_atom_t *atoms;
+ if ((atoms = xcb_get_property_value(reply)) == NULL)
+ return XCB_NONE;
+
+ for (int i = 0; i < xcb_get_property_value_length(reply) / (reply->format / 8); i++) {
+ if (atoms[i] == A__NET_WM_WINDOW_TYPE_NORMAL ||
+ atoms[i] == A__NET_WM_WINDOW_TYPE_DIALOG ||
+ atoms[i] == A__NET_WM_WINDOW_TYPE_UTILITY ||
+ atoms[i] == A__NET_WM_WINDOW_TYPE_TOOLBAR ||
+ atoms[i] == A__NET_WM_WINDOW_TYPE_SPLASH ||
+ atoms[i] == A__NET_WM_WINDOW_TYPE_MENU ||
+ atoms[i] == A__NET_WM_WINDOW_TYPE_DROPDOWN_MENU ||
+ atoms[i] == A__NET_WM_WINDOW_TYPE_POPUP_MENU ||
+ atoms[i] == A__NET_WM_WINDOW_TYPE_TOOLTIP) {
+ return atoms[i];
+ }
+ }
+
+ return XCB_NONE;
+}
+
/*
* Returns true if the given reply contains the given atom.
*