Skip to content

Commit

Permalink
x: add more picture helper functions
Browse files Browse the repository at this point in the history
Signed-off-by: Yuxuan Shui <[email protected]>
  • Loading branch information
yshui committed Aug 19, 2020
1 parent 4c1360f commit 1f65d88
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/x.c
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,15 @@ xcb_visualid_t x_get_visual_for_standard(xcb_connection_t *c, xcb_pict_standard_
return x_get_visual_for_pictfmt(g_pictfmts, pictfmt->id);
}

xcb_render_pictformat_t
x_get_pictfmt_for_standard(xcb_connection_t *c, xcb_pict_standard_t std) {
x_get_server_pictfmts(c);

auto pictfmt = xcb_render_util_find_standard_format(g_pictfmts, std);

return pictfmt->id;
}

int x_get_visual_depth(xcb_connection_t *c, xcb_visualid_t visual) {
auto setup = xcb_get_setup(c);
for (auto screen = xcb_setup_roots_iterator(setup); screen.rem;
Expand Down Expand Up @@ -231,6 +240,17 @@ x_create_picture_with_standard_and_pixmap(xcb_connection_t *c, xcb_pict_standard
return x_create_picture_with_pictfmt_and_pixmap(c, pictfmt, pixmap, valuemask, attr);
}

xcb_render_picture_t
x_create_picture_with_standard(xcb_connection_t *c, xcb_drawable_t d, int w, int h,
xcb_pict_standard_t standard, uint32_t valuemask,
const xcb_render_create_picture_value_list_t *attr) {
x_get_server_pictfmts(c);

auto pictfmt = xcb_render_util_find_standard_format(g_pictfmts, standard);
assert(pictfmt);
return x_create_picture_with_pictfmt(c, d, w, h, pictfmt, valuemask, attr);
}

/**
* Create an picture.
*/
Expand Down
9 changes: 9 additions & 0 deletions src/x.h
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,12 @@ x_create_picture_with_standard_and_pixmap(xcb_connection_t *, xcb_pict_standard_
const xcb_render_create_picture_value_list_t *attr)
attr_nonnull(1);

xcb_render_picture_t
x_create_picture_with_standard(xcb_connection_t *c, xcb_drawable_t d, int w, int h,
xcb_pict_standard_t standard, uint32_t valuemask,
const xcb_render_create_picture_value_list_t *attr)
attr_nonnull(1);

/**
* Create an picture.
*/
Expand Down Expand Up @@ -261,6 +267,9 @@ struct xvisual_info x_get_visual_info(xcb_connection_t *c, xcb_visualid_t visual

xcb_visualid_t x_get_visual_for_standard(xcb_connection_t *c, xcb_pict_standard_t std);

xcb_render_pictformat_t
x_get_pictfmt_for_standard(xcb_connection_t *c, xcb_pict_standard_t std);

xcb_screen_t *x_screen_of_display(xcb_connection_t *c, int screen);

uint32_t attr_deprecated xcb_generate_id(xcb_connection_t *c);

0 comments on commit 1f65d88

Please sign in to comment.