From c9417bf36781e4bb6a5eae5ad2d5f7fdf8d92021 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Sat, 18 Jan 2020 17:26:53 +0000 Subject: [PATCH] x: trivial function renames Signed-off-by: Yuxuan Shui --- src/c2.c | 13 +++++++------ src/win.c | 14 +++++++------- src/x.c | 9 ++++----- src/x.h | 16 ++++++++-------- 4 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/c2.c b/src/c2.c index af29520..f5fe550 100644 --- a/src/c2.c +++ b/src/c2.c @@ -32,6 +32,7 @@ #include #include +#include "atom.h" #include "common.h" #include "compiler.h" #include "config.h" @@ -40,7 +41,6 @@ #include "utils.h" #include "win.h" #include "x.h" -#include "atom.h" #include "c2.h" @@ -1343,8 +1343,8 @@ static inline void c2_match_once_leaf(session_t *ps, const struct managed_win *w // A raw window property else { winprop_t prop = - wid_get_prop_adv(ps, wid, pleaf->tgtatom, idx, 1L, - c2_get_atom_type(pleaf), pleaf->format); + x_get_prop_with_offset(ps, wid, pleaf->tgtatom, idx, 1L, + c2_get_atom_type(pleaf), pleaf->format); if (prop.nitems) { *perr = false; tgt = winprop_get_int(prop); @@ -1389,8 +1389,8 @@ static inline void c2_match_once_leaf(session_t *ps, const struct managed_win *w } else if (pleaf->type == C2_L_TATOM) { // An atom type property, convert it to string winprop_t prop = - wid_get_prop_adv(ps, wid, pleaf->tgtatom, idx, 1L, - c2_get_atom_type(pleaf), pleaf->format); + x_get_prop_with_offset(ps, wid, pleaf->tgtatom, idx, 1L, + c2_get_atom_type(pleaf), pleaf->format); xcb_atom_t atom = (xcb_atom_t)winprop_get_int(prop); if (atom) { xcb_get_atom_name_reply_t *reply = xcb_get_atom_name_reply( @@ -1562,7 +1562,8 @@ static bool c2_match_once(session_t *ps, const struct managed_win *w, const c2_p * @param pdata a place to return the data * @return true if matched, false otherwise. */ -bool c2_match(session_t *ps, const struct managed_win *w, const c2_lptr_t *condlst, void **pdata) { +bool c2_match(session_t *ps, const struct managed_win *w, const c2_lptr_t *condlst, + void **pdata) { // Then go through the whole linked list for (; condlst; condlst = condlst->next) { if (c2_match_once(ps, w, condlst->ptr)) { diff --git a/src/win.c b/src/win.c index 42d9c28..c733058 100644 --- a/src/win.c +++ b/src/win.c @@ -501,7 +501,7 @@ static inline bool win_bounding_shaped(const session_t *ps, xcb_window_t wid) { static wintype_t wid_get_prop_wintype(session_t *ps, xcb_window_t wid) { winprop_t prop = - wid_get_prop(ps, wid, ps->atoms->a_NET_WM_WINDOW_TYPE, 32L, XCB_ATOM_ATOM, 32); + x_get_prop(ps, wid, ps->atoms->a_NET_WM_WINDOW_TYPE, 32L, XCB_ATOM_ATOM, 32); for (unsigned i = 0; i < prop.nitems; ++i) { for (wintype_t j = 1; j < NUM_WINTYPES; ++j) { @@ -522,8 +522,8 @@ wid_get_opacity_prop(session_t *ps, xcb_window_t wid, opacity_t def, opacity_t * bool ret = false; *out = def; - winprop_t prop = wid_get_prop(ps, wid, ps->atoms->a_NET_WM_WINDOW_OPACITY, 1L, - XCB_ATOM_CARDINAL, 32); + winprop_t prop = x_get_prop(ps, wid, ps->atoms->a_NET_WM_WINDOW_OPACITY, 1L, + XCB_ATOM_CARDINAL, 32); if (prop.nitems) { *out = *prop.c32; @@ -675,8 +675,8 @@ bool win_should_fade(session_t *ps, const struct managed_win *w) { * The property must be set on the outermost window, usually the WM frame. */ void win_update_prop_shadow_raw(session_t *ps, struct managed_win *w) { - winprop_t prop = wid_get_prop(ps, w->base.id, ps->atoms->a_COMPTON_SHADOW, 1, - XCB_ATOM_CARDINAL, 32); + winprop_t prop = x_get_prop(ps, w->base.id, ps->atoms->a_COMPTON_SHADOW, 1, + XCB_ATOM_CARDINAL, 32); if (!prop.nitems) { w->prop_shadow = -1; @@ -1625,8 +1625,8 @@ void win_update_opacity_prop(session_t *ps, struct managed_win *w) { * Retrieve frame extents from a window. */ void win_update_frame_extents(session_t *ps, struct managed_win *w, xcb_window_t client) { - winprop_t prop = wid_get_prop(ps, client, ps->atoms->a_NET_FRAME_EXTENTS, 4L, - XCB_ATOM_CARDINAL, 32); + winprop_t prop = x_get_prop(ps, client, ps->atoms->a_NET_FRAME_EXTENTS, 4L, + XCB_ATOM_CARDINAL, 32); if (prop.nitems == 4) { const int32_t extents[4] = { diff --git a/src/x.c b/src/x.c index b22ba69..fe162d2 100644 --- a/src/x.c +++ b/src/x.c @@ -40,8 +40,8 @@ * @return a winprop_t structure containing the attribute * and number of items. A blank one on failure. */ -winprop_t wid_get_prop_adv(const session_t *ps, xcb_window_t w, xcb_atom_t atom, - int offset, int length, xcb_atom_t rtype, int rformat) { +winprop_t x_get_prop_with_offset(const session_t *ps, xcb_window_t w, xcb_atom_t atom, + int offset, int length, xcb_atom_t rtype, int rformat) { xcb_get_property_reply_t *r = xcb_get_property_reply( ps->c, xcb_get_property(ps->c, 0, w, atom, rtype, to_u32_checked(offset), @@ -75,7 +75,7 @@ winprop_t wid_get_prop_adv(const session_t *ps, xcb_window_t w, xcb_atom_t atom, xcb_window_t wid_get_prop_window(session_t *ps, xcb_window_t wid, xcb_atom_t aprop) { // Get the attribute xcb_window_t p = XCB_NONE; - winprop_t prop = wid_get_prop(ps, wid, aprop, 1L, XCB_ATOM_WINDOW, 32); + winprop_t prop = x_get_prop(ps, wid, aprop, 1L, XCB_ATOM_WINDOW, 32); // Return it if (prop.nitems) { @@ -460,8 +460,7 @@ xcb_pixmap_t x_get_root_back_pixmap(session_t *ps) { // Get the values of background attributes for (int p = 0; background_props_str[p]; p++) { xcb_atom_t prop_atom = get_atom(ps->atoms, background_props_str[p]); - winprop_t prop = - wid_get_prop(ps, ps->root, prop_atom, 1, XCB_ATOM_PIXMAP, 32); + winprop_t prop = x_get_prop(ps, ps->root, prop_atom, 1, XCB_ATOM_PIXMAP, 32); if (prop.nitems) { pixmap = (xcb_pixmap_t)*prop.p32; free_winprop(&prop); diff --git a/src/x.h b/src/x.h index 49cbff7..e98b211 100644 --- a/src/x.h +++ b/src/x.h @@ -12,8 +12,8 @@ #include "compiler.h" #include "kernel.h" -#include "region.h" #include "log.h" +#include "region.h" typedef struct session session_t; @@ -78,8 +78,8 @@ static inline uint32_t x_new_id(xcb_connection_t *c) { auto ret = xcb_generate_id(c); if (ret == (uint32_t)-1) { log_fatal("We seems to have run of XIDs. This is either a bug in the X " - "server, or a resource leakage in the compositor. Please open an " - "issue about this problem. The compositor will die."); + "server, or a resource leakage in the compositor. Please open " + "an issue about this problem. The compositor will die."); abort(); } return ret; @@ -111,15 +111,15 @@ static inline void x_sync(xcb_connection_t *c) { * @return a winprop_t structure containing the attribute * and number of items. A blank one on failure. */ -winprop_t wid_get_prop_adv(const session_t *ps, xcb_window_t w, xcb_atom_t atom, - int offset, int length, xcb_atom_t rtype, int rformat); +winprop_t x_get_prop_with_offset(const session_t *ps, xcb_window_t w, xcb_atom_t atom, + int offset, int length, xcb_atom_t rtype, int rformat); /** * Wrapper of wid_get_prop_adv(). */ -static inline winprop_t wid_get_prop(const session_t *ps, xcb_window_t wid, xcb_atom_t atom, - int length, xcb_atom_t rtype, int rformat) { - return wid_get_prop_adv(ps, wid, atom, 0L, length, rtype, rformat); +static inline winprop_t x_get_prop(const session_t *ps, xcb_window_t wid, xcb_atom_t atom, + int length, xcb_atom_t rtype, int rformat) { + return x_get_prop_with_offset(ps, wid, atom, 0L, length, rtype, rformat); } /// Discard all X events in queue or in flight. Should only be used when the server is