x_get_pictform_for_visual should return const *

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2019-02-07 00:18:47 +00:00
parent aa9c439cc6
commit 7d00b89364
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
4 changed files with 12 additions and 11 deletions

View File

@ -998,7 +998,7 @@ void paint_all(session_t *ps, win *const t, bool ignore_damage) {
// First we create a new picture, and copy content from the buffer
// to it
xcb_render_pictforminfo_t *pictfmt =
auto pictfmt =
x_get_pictform_for_visual(ps->c, ps->vis);
xcb_render_picture_t new_pict = x_create_picture_with_pictfmt(
ps, ps->root_width, ps->root_height, pictfmt, 0, NULL);

View File

@ -96,7 +96,7 @@ struct win {
int xinerama_scr;
#endif
/// Window visual pict format;
xcb_render_pictforminfo_t *pictfmt;
const xcb_render_pictforminfo_t *pictfmt;
/// Window painting mode.
winmode_t mode;
/// Whether the window has been damaged at least once.

13
src/x.c
View File

@ -129,7 +129,8 @@ static inline void x_get_server_pictfmts(xcb_connection_t *c) {
}
}
xcb_render_pictforminfo_t *x_get_pictform_for_visual(xcb_connection_t *c, xcb_visualid_t visual) {
const xcb_render_pictforminfo_t *
x_get_pictform_for_visual(xcb_connection_t *c, xcb_visualid_t visual) {
x_get_server_pictfmts(c);
xcb_render_pictvisual_t *pv = xcb_render_util_find_visual_format(g_pictfmts, visual);
@ -161,7 +162,7 @@ int x_get_visual_depth(xcb_connection_t *c, xcb_visualid_t visual) {
xcb_render_picture_t
x_create_picture_with_pictfmt_and_pixmap(
xcb_connection_t *c, xcb_render_pictforminfo_t * pictfmt,
xcb_connection_t *c, const xcb_render_pictforminfo_t * pictfmt,
xcb_pixmap_t pixmap, unsigned long valuemask,
const xcb_render_create_picture_value_list_t *attr)
{
@ -192,7 +193,7 @@ x_create_picture_with_visual_and_pixmap(
xcb_pixmap_t pixmap, unsigned long valuemask,
const xcb_render_create_picture_value_list_t *attr)
{
xcb_render_pictforminfo_t *pictfmt = x_get_pictform_for_visual(c, visual);
const xcb_render_pictforminfo_t *pictfmt = x_get_pictform_for_visual(c, visual);
return x_create_picture_with_pictfmt_and_pixmap(c, pictfmt, pixmap, valuemask, attr);
}
@ -204,7 +205,7 @@ x_create_picture_with_standard_and_pixmap(
{
x_get_server_pictfmts(c);
xcb_render_pictforminfo_t *pictfmt =
auto pictfmt =
xcb_render_util_find_standard_format(g_pictfmts, standard);
assert(pictfmt);
return x_create_picture_with_pictfmt_and_pixmap(c, pictfmt, pixmap, valuemask, attr);
@ -215,7 +216,7 @@ x_create_picture_with_standard_and_pixmap(
*/
xcb_render_picture_t
x_create_picture_with_pictfmt(session_t *ps, int wid, int hei,
xcb_render_pictforminfo_t *pictfmt, unsigned long valuemask,
const xcb_render_pictforminfo_t *pictfmt, unsigned long valuemask,
const xcb_render_create_picture_value_list_t *attr)
{
if (!pictfmt)
@ -245,7 +246,7 @@ 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_pictforminfo_t *pictfmt = x_get_pictform_for_visual(ps->c, visual);
auto pictfmt = x_get_pictform_for_visual(ps->c, visual);
return x_create_picture_with_pictfmt(ps, w, h, pictfmt, valuemask, attr);
}

View File

@ -93,11 +93,11 @@ xcb_window_t wid_get_prop_window(session_t *ps, xcb_window_t wid, xcb_atom_t apr
*/
bool wid_get_text_prop(session_t *ps, xcb_window_t wid, xcb_atom_t prop, char ***pstrlst, int *pnstr);
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 *, 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);
@ -119,7 +119,7 @@ x_create_picture_with_standard_and_pixmap(xcb_connection_t *, xcb_pict_standard_
*/
xcb_render_picture_t
x_create_picture_with_pictfmt(session_t *ps, int wid, int hei,
xcb_render_pictforminfo_t *pictfmt, unsigned long valuemask,
const xcb_render_pictforminfo_t *pictfmt, unsigned long valuemask,
const xcb_render_create_picture_value_list_t *attr);
xcb_render_picture_t