x: create_picture_with_{visual, pictfmt} don't need session_t

Take xcb_connection_t and xcb_drawable_t instead.

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui
2019-02-27 00:30:27 +00:00
parent 0ceee9aad1
commit 26214f312f
4 changed files with 42 additions and 42 deletions

49
src/x.h
View File

@ -11,8 +11,8 @@
#include <xcb/xfixes.h>
#include "compiler.h"
#include "region.h"
#include "kernel.h"
#include "region.h"
typedef struct session session_t;
@ -34,15 +34,16 @@ typedef struct winprop {
#define XCB_SYNCED_VOID(func, c, ...) \
xcb_request_check(c, func##_checked(c, __VA_ARGS__));
#define XCB_SYNCED(func, c, ...) \
({ \
xcb_generic_error_t *e = NULL; \
__auto_type r = func##_reply(c, func(c, __VA_ARGS__), &e); \
if (e) { \
x_print_error(e->sequence, e->major_code, e->minor_code, e->error_code); \
free(e); \
} \
r; \
#define XCB_SYNCED(func, c, ...) \
({ \
xcb_generic_error_t *e = NULL; \
__auto_type r = func##_reply(c, func(c, __VA_ARGS__), &e); \
if (e) { \
x_print_error(e->sequence, e->major_code, e->minor_code, \
e->error_code); \
free(e); \
} \
r; \
})
/**
@ -92,13 +93,16 @@ xcb_window_t wid_get_prop_window(session_t *ps, xcb_window_t wid, xcb_atom_t apr
/**
* Get the value of a text property of a window.
*/
bool wid_get_text_prop(session_t *ps, xcb_window_t wid, xcb_atom_t prop, char ***pstrlst, int *pnstr);
bool wid_get_text_prop(session_t *ps, xcb_window_t wid, xcb_atom_t prop, char ***pstrlst,
int *pnstr);
const xcb_render_pictforminfo_t *x_get_pictform_for_visual(xcb_connection_t *, xcb_visualid_t);
const xcb_render_pictforminfo_t *
x_get_pictform_for_visual(xcb_connection_t *, xcb_visualid_t);
int x_get_visual_depth(xcb_connection_t *, xcb_visualid_t);
xcb_render_picture_t
x_create_picture_with_pictfmt_and_pixmap(xcb_connection_t *, const xcb_render_pictforminfo_t *pictfmt,
x_create_picture_with_pictfmt_and_pixmap(xcb_connection_t *,
const xcb_render_pictforminfo_t *pictfmt,
xcb_pixmap_t pixmap, unsigned long valuemask,
const xcb_render_create_picture_value_list_t *attr)
attr_nonnull(1, 2);
@ -118,14 +122,16 @@ x_create_picture_with_standard_and_pixmap(xcb_connection_t *, xcb_pict_standard_
/**
* Create an picture.
*/
xcb_render_picture_t
x_create_picture_with_pictfmt(session_t *ps, int wid, int hei,
const xcb_render_pictforminfo_t *pictfmt, unsigned long valuemask,
const xcb_render_create_picture_value_list_t *attr);
xcb_render_picture_t attr_nonnull(1, 4)
x_create_picture_with_pictfmt(xcb_connection_t *, xcb_drawable_t, int wid, int hei,
const xcb_render_pictforminfo_t *pictfmt,
unsigned long valuemask,
const xcb_render_create_picture_value_list_t *attr);
xcb_render_picture_t
x_create_picture_with_visual(session_t *ps, int w, int h, xcb_visualid_t visual, unsigned long valuemask,
const xcb_render_create_picture_value_list_t *attr);
xcb_render_picture_t attr_nonnull(1)
x_create_picture_with_visual(xcb_connection_t *, xcb_drawable_t, int w, int h,
xcb_visualid_t visual, unsigned long valuemask,
const xcb_render_create_picture_value_list_t *attr);
/// Fetch a X region and store it in a pixman region
bool x_fetch_region(xcb_connection_t *, xcb_xfixes_region_t r, region_t *res);
@ -180,4 +186,5 @@ bool x_fence_sync(xcb_connection_t *, xcb_sync_fence_t);
* will be allocated, and `*ret` will be updated.
* @param[inout] size size of the array pointed to by `ret`.
*/
size_t x_picture_filter_from_conv(const conv *kernel, double center, xcb_render_fixed_t **ret, size_t *size);
size_t x_picture_filter_from_conv(const conv *kernel, double center,
xcb_render_fixed_t **ret, size_t *size);