x: trivial function renames

Signed-off-by: Yuxuan Shui <yshuiv7@gmail.com>
This commit is contained in:
Yuxuan Shui 2020-01-18 17:26:53 +00:00
parent 463bf09d0a
commit c9417bf367
No known key found for this signature in database
GPG Key ID: 37C999F617EA1A47
4 changed files with 26 additions and 26 deletions

View File

@ -32,6 +32,7 @@
#include <X11/Xlib.h>
#include <xcb/xcb.h>
#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)) {

View File

@ -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] = {

View File

@ -40,8 +40,8 @@
* @return a <code>winprop_t</code> 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);

16
src/x.h
View File

@ -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 <code>winprop_t</code> 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