mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
more style nits
This commit is contained in:
parent
be091b3523
commit
3d12b6d1d9
6
calmwm.c
6
calmwm.c
|
@ -120,7 +120,7 @@ main(int argc, char **argv)
|
||||||
if (cwm_status == CWM_RESTART)
|
if (cwm_status == CWM_RESTART)
|
||||||
x_restart(cwm_argv);
|
x_restart(cwm_argv);
|
||||||
|
|
||||||
return (0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -185,7 +185,7 @@ x_wmerrorhandler(Display *dpy, XErrorEvent *e)
|
||||||
{
|
{
|
||||||
errx(1, "root window unavailable - perhaps another wm is running?");
|
errx(1, "root window unavailable - perhaps another wm is running?");
|
||||||
|
|
||||||
return (0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -201,7 +201,7 @@ x_errorhandler(Display *dpy, XErrorEvent *e)
|
||||||
|
|
||||||
warnx("%s(0x%x): %s", req, (unsigned int)e->resourceid, msg);
|
warnx("%s(0x%x): %s", req, (unsigned int)e->resourceid, msg);
|
||||||
#endif
|
#endif
|
||||||
return (0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
34
client.c
34
client.c
|
@ -47,11 +47,11 @@ client_find(Window win)
|
||||||
{
|
{
|
||||||
struct client_ctx *cc;
|
struct client_ctx *cc;
|
||||||
|
|
||||||
TAILQ_FOREACH(cc, &Clientq, entry)
|
TAILQ_FOREACH(cc, &Clientq, entry) {
|
||||||
if (cc->win == win)
|
if (cc->win == win)
|
||||||
return (cc);
|
return(cc);
|
||||||
|
}
|
||||||
return (NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct client_ctx *
|
struct client_ctx *
|
||||||
|
@ -63,16 +63,16 @@ client_init(Window win, struct screen_ctx *sc)
|
||||||
int mapped;
|
int mapped;
|
||||||
|
|
||||||
if (win == None)
|
if (win == None)
|
||||||
return (NULL);
|
return(NULL);
|
||||||
if (!XGetWindowAttributes(X_Dpy, win, &wattr))
|
if (!XGetWindowAttributes(X_Dpy, win, &wattr))
|
||||||
return (NULL);
|
return(NULL);
|
||||||
|
|
||||||
if (sc == NULL) {
|
if (sc == NULL) {
|
||||||
sc = screen_find(wattr.root);
|
sc = screen_find(wattr.root);
|
||||||
mapped = 1;
|
mapped = 1;
|
||||||
} else {
|
} else {
|
||||||
if (wattr.override_redirect || wattr.map_state != IsViewable)
|
if (wattr.override_redirect || wattr.map_state != IsViewable)
|
||||||
return (NULL);
|
return(NULL);
|
||||||
mapped = wattr.map_state != IsUnmapped;
|
mapped = wattr.map_state != IsUnmapped;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ client_init(Window win, struct screen_ctx *sc)
|
||||||
XSync(X_Dpy, False);
|
XSync(X_Dpy, False);
|
||||||
XUngrabServer(X_Dpy);
|
XUngrabServer(X_Dpy);
|
||||||
|
|
||||||
return (cc);
|
return(cc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -226,7 +226,7 @@ client_none(struct screen_ctx *sc)
|
||||||
struct client_ctx *
|
struct client_ctx *
|
||||||
client_current(void)
|
client_current(void)
|
||||||
{
|
{
|
||||||
return (curcc);
|
return(curcc);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -696,7 +696,7 @@ client_mrunext(struct client_ctx *cc)
|
||||||
struct screen_ctx *sc = cc->sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
struct client_ctx *ccc;
|
struct client_ctx *ccc;
|
||||||
|
|
||||||
return ((ccc = TAILQ_NEXT(cc, mru_entry)) != NULL ?
|
return((ccc = TAILQ_NEXT(cc, mru_entry)) != NULL ?
|
||||||
ccc : TAILQ_FIRST(&sc->mruq));
|
ccc : TAILQ_FIRST(&sc->mruq));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -706,7 +706,7 @@ client_mruprev(struct client_ctx *cc)
|
||||||
struct screen_ctx *sc = cc->sc;
|
struct screen_ctx *sc = cc->sc;
|
||||||
struct client_ctx *ccc;
|
struct client_ctx *ccc;
|
||||||
|
|
||||||
return ((ccc = TAILQ_PREV(cc, cycle_entry_q, mru_entry)) != NULL ?
|
return((ccc = TAILQ_PREV(cc, cycle_entry_q, mru_entry)) != NULL ?
|
||||||
ccc : TAILQ_LAST(&sc->mruq, cycle_entry_q));
|
ccc : TAILQ_LAST(&sc->mruq, cycle_entry_q));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -896,7 +896,7 @@ client_transient(struct client_ctx *cc)
|
||||||
static int
|
static int
|
||||||
client_inbound(struct client_ctx *cc, int x, int y)
|
client_inbound(struct client_ctx *cc, int x, int y)
|
||||||
{
|
{
|
||||||
return (x < cc->geom.w && x >= 0 &&
|
return(x < cc->geom.w && x >= 0 &&
|
||||||
y < cc->geom.h && y >= 0);
|
y < cc->geom.h && y >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -916,15 +916,15 @@ client_snapcalc(int n0, int n1, int e0, int e1, int snapdist)
|
||||||
/* possible to snap in both directions */
|
/* possible to snap in both directions */
|
||||||
if (s0 != 0 && s1 != 0)
|
if (s0 != 0 && s1 != 0)
|
||||||
if (abs(s0) < abs(s1))
|
if (abs(s0) < abs(s1))
|
||||||
return (s0);
|
return(s0);
|
||||||
else
|
else
|
||||||
return (s1);
|
return(s1);
|
||||||
else if (s0 != 0)
|
else if (s0 != 0)
|
||||||
return (s0);
|
return(s0);
|
||||||
else if (s1 != 0)
|
else if (s1 != 0)
|
||||||
return (s1);
|
return(s1);
|
||||||
else
|
else
|
||||||
return (0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
20
conf.c
20
conf.c
|
@ -475,14 +475,14 @@ conf_bind_getmask(const char *name, unsigned int *mask)
|
||||||
|
|
||||||
*mask = 0;
|
*mask = 0;
|
||||||
if ((dash = strchr(name, '-')) == NULL)
|
if ((dash = strchr(name, '-')) == NULL)
|
||||||
return (name);
|
return(name);
|
||||||
for (i = 0; i < nitems(bind_mods); i++) {
|
for (i = 0; i < nitems(bind_mods); i++) {
|
||||||
if ((ch = strchr(name, bind_mods[i].ch)) != NULL && ch < dash)
|
if ((ch = strchr(name, bind_mods[i].ch)) != NULL && ch < dash)
|
||||||
*mask |= bind_mods[i].mask;
|
*mask |= bind_mods[i].mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Skip past modifiers. */
|
/* Skip past modifiers. */
|
||||||
return (dash + 1);
|
return(dash + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -500,7 +500,7 @@ conf_bind_kbd(struct conf *c, const char *bind, const char *cmd)
|
||||||
if (kb->press.keysym == NoSymbol) {
|
if (kb->press.keysym == NoSymbol) {
|
||||||
warnx("unknown symbol: %s", key);
|
warnx("unknown symbol: %s", key);
|
||||||
free(kb);
|
free(kb);
|
||||||
return (0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We now have the correct binding, remove duplicates. */
|
/* We now have the correct binding, remove duplicates. */
|
||||||
|
@ -508,7 +508,7 @@ conf_bind_kbd(struct conf *c, const char *bind, const char *cmd)
|
||||||
|
|
||||||
if (strcmp("unmap", cmd) == 0) {
|
if (strcmp("unmap", cmd) == 0) {
|
||||||
free(kb);
|
free(kb);
|
||||||
return (1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < nitems(name_to_func); i++) {
|
for (i = 0; i < nitems(name_to_func); i++) {
|
||||||
|
@ -520,7 +520,7 @@ conf_bind_kbd(struct conf *c, const char *bind, const char *cmd)
|
||||||
kb->argument = name_to_func[i].argument;
|
kb->argument = name_to_func[i].argument;
|
||||||
kb->argtype |= ARG_INT;
|
kb->argtype |= ARG_INT;
|
||||||
TAILQ_INSERT_TAIL(&c->keybindingq, kb, entry);
|
TAILQ_INSERT_TAIL(&c->keybindingq, kb, entry);
|
||||||
return (1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
kb->callback = kbfunc_cmdexec;
|
kb->callback = kbfunc_cmdexec;
|
||||||
|
@ -528,7 +528,7 @@ conf_bind_kbd(struct conf *c, const char *bind, const char *cmd)
|
||||||
kb->argument.c = xstrdup(cmd);
|
kb->argument.c = xstrdup(cmd);
|
||||||
kb->argtype |= ARG_CHAR;
|
kb->argtype |= ARG_CHAR;
|
||||||
TAILQ_INSERT_TAIL(&c->keybindingq, kb, entry);
|
TAILQ_INSERT_TAIL(&c->keybindingq, kb, entry);
|
||||||
return (1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -564,7 +564,7 @@ conf_bind_mouse(struct conf *c, const char *bind, const char *cmd)
|
||||||
if (errstr) {
|
if (errstr) {
|
||||||
warnx("button number is %s: %s", errstr, button);
|
warnx("button number is %s: %s", errstr, button);
|
||||||
free(mb);
|
free(mb);
|
||||||
return (0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* We now have the correct binding, remove duplicates. */
|
/* We now have the correct binding, remove duplicates. */
|
||||||
|
@ -572,7 +572,7 @@ conf_bind_mouse(struct conf *c, const char *bind, const char *cmd)
|
||||||
|
|
||||||
if (strcmp("unmap", cmd) == 0) {
|
if (strcmp("unmap", cmd) == 0) {
|
||||||
free(mb);
|
free(mb);
|
||||||
return (1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < nitems(name_to_func); i++) {
|
for (i = 0; i < nitems(name_to_func); i++) {
|
||||||
|
@ -583,10 +583,10 @@ conf_bind_mouse(struct conf *c, const char *bind, const char *cmd)
|
||||||
mb->flags = name_to_func[i].flags;
|
mb->flags = name_to_func[i].flags;
|
||||||
mb->argument = name_to_func[i].argument;
|
mb->argument = name_to_func[i].argument;
|
||||||
TAILQ_INSERT_TAIL(&c->mousebindingq, mb, entry);
|
TAILQ_INSERT_TAIL(&c->mousebindingq, mb, entry);
|
||||||
return (1);
|
return(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
return (0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
26
menu.c
26
menu.c
|
@ -126,7 +126,7 @@ menu_filter(struct screen_ctx *sc, struct menu_q *menuq, const char *prompt,
|
||||||
if (xu_ptr_grab(sc->menuwin, MENUGRABMASK,
|
if (xu_ptr_grab(sc->menuwin, MENUGRABMASK,
|
||||||
Conf.cursor[CF_QUESTION]) < 0) {
|
Conf.cursor[CF_QUESTION]) < 0) {
|
||||||
XUnmapWindow(X_Dpy, sc->menuwin);
|
XUnmapWindow(X_Dpy, sc->menuwin);
|
||||||
return (NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
XGetInputFocus(X_Dpy, &focuswin, &focusrevert);
|
XGetInputFocus(X_Dpy, &focuswin, &focusrevert);
|
||||||
|
@ -180,7 +180,7 @@ out:
|
||||||
XUnmapWindow(X_Dpy, sc->menuwin);
|
XUnmapWindow(X_Dpy, sc->menuwin);
|
||||||
XUngrabKeyboard(X_Dpy, CurrentTime);
|
XUngrabKeyboard(X_Dpy, CurrentTime);
|
||||||
|
|
||||||
return (mi);
|
return(mi);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct menu *
|
static struct menu *
|
||||||
|
@ -210,7 +210,7 @@ menu_complete_path(struct menu_ctx *mc)
|
||||||
else if (!mr->abort)
|
else if (!mr->abort)
|
||||||
strlcpy(mr->text, mc->searchstr, sizeof(mr->text));
|
strlcpy(mr->text, mc->searchstr, sizeof(mr->text));
|
||||||
free(path);
|
free(path);
|
||||||
return (mr);
|
return(mr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static struct menu *
|
static struct menu *
|
||||||
|
@ -225,7 +225,7 @@ menu_handle_key(XEvent *e, struct menu_ctx *mc, struct menu_q *menuq,
|
||||||
wchar_t wc;
|
wchar_t wc;
|
||||||
|
|
||||||
if (menu_keycode(&e->xkey, &ctl, chr) < 0)
|
if (menu_keycode(&e->xkey, &ctl, chr) < 0)
|
||||||
return (NULL);
|
return(NULL);
|
||||||
|
|
||||||
switch (ctl) {
|
switch (ctl) {
|
||||||
case CTL_ERASEONE:
|
case CTL_ERASEONE:
|
||||||
|
@ -266,7 +266,7 @@ menu_handle_key(XEvent *e, struct menu_ctx *mc, struct menu_q *menuq,
|
||||||
mi->dummy = 1;
|
mi->dummy = 1;
|
||||||
}
|
}
|
||||||
mi->abort = 0;
|
mi->abort = 0;
|
||||||
return (mi);
|
return(mi);
|
||||||
case CTL_WIPE:
|
case CTL_WIPE:
|
||||||
mc->searchstr[0] = '\0';
|
mc->searchstr[0] = '\0';
|
||||||
mc->changed = 1;
|
mc->changed = 1;
|
||||||
|
@ -281,7 +281,7 @@ menu_handle_key(XEvent *e, struct menu_ctx *mc, struct menu_q *menuq,
|
||||||
if ((mc->flags & CWM_MENU_FILE) &&
|
if ((mc->flags & CWM_MENU_FILE) &&
|
||||||
(strncmp(mc->searchstr, mi->text,
|
(strncmp(mc->searchstr, mi->text,
|
||||||
strlen(mi->text))) == 0)
|
strlen(mi->text))) == 0)
|
||||||
return (menu_complete_path(mc));
|
return(menu_complete_path(mc));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Put common prefix of the results into searchstr
|
* Put common prefix of the results into searchstr
|
||||||
|
@ -306,7 +306,7 @@ menu_handle_key(XEvent *e, struct menu_ctx *mc, struct menu_q *menuq,
|
||||||
mi->text[0] = '\0';
|
mi->text[0] = '\0';
|
||||||
mi->dummy = 1;
|
mi->dummy = 1;
|
||||||
mi->abort = 1;
|
mi->abort = 1;
|
||||||
return (mi);
|
return(mi);
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -329,7 +329,7 @@ menu_handle_key(XEvent *e, struct menu_ctx *mc, struct menu_q *menuq,
|
||||||
mc->listing = 0;
|
mc->listing = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (NULL);
|
return(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -497,7 +497,7 @@ menu_handle_release(XEvent *e, struct menu_ctx *mc, struct menu_q *resultq)
|
||||||
mi->text[0] = '\0';
|
mi->text[0] = '\0';
|
||||||
mi->dummy = 1;
|
mi->dummy = 1;
|
||||||
}
|
}
|
||||||
return (mi);
|
return(mi);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -517,7 +517,7 @@ menu_calc_entry(struct menu_ctx *mc, int x, int y)
|
||||||
if (mc->hasprompt && entry == 0)
|
if (mc->hasprompt && entry == 0)
|
||||||
entry = -1;
|
entry = -1;
|
||||||
|
|
||||||
return (entry);
|
return(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -597,12 +597,12 @@ menu_keycode(XKeyEvent *ev, enum ctltype *ctl, char *chr)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*ctl != CTL_NONE)
|
if (*ctl != CTL_NONE)
|
||||||
return (0);
|
return(0);
|
||||||
|
|
||||||
if (XLookupString(ev, chr, 32, &ks, NULL) < 0)
|
if (XLookupString(ev, chr, 32, &ks, NULL) < 0)
|
||||||
return (-1);
|
return(-1);
|
||||||
|
|
||||||
return (0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
10
screen.c
10
screen.c
|
@ -83,12 +83,12 @@ screen_find(Window win)
|
||||||
{
|
{
|
||||||
struct screen_ctx *sc;
|
struct screen_ctx *sc;
|
||||||
|
|
||||||
TAILQ_FOREACH(sc, &Screenq, entry)
|
TAILQ_FOREACH(sc, &Screenq, entry) {
|
||||||
if (sc->rootwin == win)
|
if (sc->rootwin == win)
|
||||||
return (sc);
|
return(sc);
|
||||||
|
}
|
||||||
/* XXX FAIL HERE */
|
/* XXX FAIL HERE */
|
||||||
return (TAILQ_FIRST(&Screenq));
|
return(TAILQ_FIRST(&Screenq));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -133,7 +133,7 @@ screen_find_xinerama(struct screen_ctx *sc, int x, int y, int flags)
|
||||||
geom.w -= (sc->gap.left + sc->gap.right);
|
geom.w -= (sc->gap.left + sc->gap.right);
|
||||||
geom.h -= (sc->gap.top + sc->gap.bottom);
|
geom.h -= (sc->gap.top + sc->gap.bottom);
|
||||||
}
|
}
|
||||||
return (geom);
|
return(geom);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
12
search.c
12
search.c
|
@ -194,13 +194,13 @@ search_match_path(struct menu_q *menuq, struct menu_q *resultq, char *search, in
|
||||||
static void
|
static void
|
||||||
search_match_path_exec(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
search_match_path_exec(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
||||||
{
|
{
|
||||||
return (search_match_path(menuq, resultq, search, PATH_EXEC));
|
return(search_match_path(menuq, resultq, search, PATH_EXEC));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
search_match_path_any(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
search_match_path_any(struct menu_q *menuq, struct menu_q *resultq, char *search)
|
||||||
{
|
{
|
||||||
return (search_match_path(menuq, resultq, search, PATH_ANY));
|
return(search_match_path(menuq, resultq, search, PATH_ANY));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -254,13 +254,13 @@ strsubmatch(char *sub, char *str, int zeroidx)
|
||||||
unsigned int n, flen;
|
unsigned int n, flen;
|
||||||
|
|
||||||
if (sub == NULL || str == NULL)
|
if (sub == NULL || str == NULL)
|
||||||
return (0);
|
return(0);
|
||||||
|
|
||||||
len = strlen(str);
|
len = strlen(str);
|
||||||
sublen = strlen(sub);
|
sublen = strlen(sub);
|
||||||
|
|
||||||
if (sublen > len)
|
if (sublen > len)
|
||||||
return (0);
|
return(0);
|
||||||
|
|
||||||
if (!zeroidx)
|
if (!zeroidx)
|
||||||
flen = len - sublen;
|
flen = len - sublen;
|
||||||
|
@ -269,7 +269,7 @@ strsubmatch(char *sub, char *str, int zeroidx)
|
||||||
|
|
||||||
for (n = 0; n <= flen; n++)
|
for (n = 0; n <= flen; n++)
|
||||||
if (strncasecmp(sub, str + n, sublen) == 0)
|
if (strncasecmp(sub, str + n, sublen) == 0)
|
||||||
return (1);
|
return(1);
|
||||||
|
|
||||||
return (0);
|
return(0);
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,7 +42,7 @@ xmalloc(size_t siz)
|
||||||
if ((p = malloc(siz)) == NULL)
|
if ((p = malloc(siz)) == NULL)
|
||||||
err(1, "malloc");
|
err(1, "malloc");
|
||||||
|
|
||||||
return (p);
|
return(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
|
@ -57,7 +57,7 @@ xcalloc(size_t no, size_t siz)
|
||||||
if ((p = calloc(no, siz)) == NULL)
|
if ((p = calloc(no, siz)) == NULL)
|
||||||
err(1, "calloc");
|
err(1, "calloc");
|
||||||
|
|
||||||
return (p);
|
return(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *
|
char *
|
||||||
|
@ -68,7 +68,7 @@ xstrdup(const char *str)
|
||||||
if ((p = strdup(str)) == NULL)
|
if ((p = strdup(str)) == NULL)
|
||||||
err(1, "strdup");
|
err(1, "strdup");
|
||||||
|
|
||||||
return (p);
|
return(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -84,5 +84,5 @@ xasprintf(char **ret, const char *fmt, ...)
|
||||||
if (i < 0 || *ret == NULL)
|
if (i < 0 || *ret == NULL)
|
||||||
err(1, "asprintf");
|
err(1, "asprintf");
|
||||||
|
|
||||||
return (i);
|
return(i);
|
||||||
}
|
}
|
||||||
|
|
18
xutil.c
18
xutil.c
|
@ -74,7 +74,7 @@ xu_key_ungrab(Window win)
|
||||||
int
|
int
|
||||||
xu_ptr_grab(Window win, unsigned int mask, Cursor curs)
|
xu_ptr_grab(Window win, unsigned int mask, Cursor curs)
|
||||||
{
|
{
|
||||||
return (XGrabPointer(X_Dpy, win, False, mask,
|
return(XGrabPointer(X_Dpy, win, False, mask,
|
||||||
GrabModeAsync, GrabModeAsync,
|
GrabModeAsync, GrabModeAsync,
|
||||||
None, curs, CurrentTime) == GrabSuccess ? 0 : -1);
|
None, curs, CurrentTime) == GrabSuccess ? 0 : -1);
|
||||||
}
|
}
|
||||||
|
@ -82,7 +82,7 @@ xu_ptr_grab(Window win, unsigned int mask, Cursor curs)
|
||||||
int
|
int
|
||||||
xu_ptr_regrab(unsigned int mask, Cursor curs)
|
xu_ptr_regrab(unsigned int mask, Cursor curs)
|
||||||
{
|
{
|
||||||
return (XChangeActivePointerGrab(X_Dpy, mask,
|
return(XChangeActivePointerGrab(X_Dpy, mask,
|
||||||
curs, CurrentTime) == GrabSuccess ? 0 : -1);
|
curs, CurrentTime) == GrabSuccess ? 0 : -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,12 +117,12 @@ xu_getprop(Window win, Atom atm, Atom type, long len, unsigned char **p)
|
||||||
|
|
||||||
if (XGetWindowProperty(X_Dpy, win, atm, 0L, len, False, type,
|
if (XGetWindowProperty(X_Dpy, win, atm, 0L, len, False, type,
|
||||||
&realtype, &format, &n, &extra, p) != Success || *p == NULL)
|
&realtype, &format, &n, &extra, p) != Success || *p == NULL)
|
||||||
return (-1);
|
return(-1);
|
||||||
|
|
||||||
if (n == 0)
|
if (n == 0)
|
||||||
XFree(*p);
|
XFree(*p);
|
||||||
|
|
||||||
return (n);
|
return(n);
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
@ -135,7 +135,7 @@ xu_getstrprop(Window win, Atom atm, char **text) {
|
||||||
|
|
||||||
XGetTextProperty(X_Dpy, win, &prop, atm);
|
XGetTextProperty(X_Dpy, win, &prop, atm);
|
||||||
if (!prop.nitems)
|
if (!prop.nitems)
|
||||||
return (0);
|
return(0);
|
||||||
|
|
||||||
if (Xutf8TextPropertyToTextList(X_Dpy, &prop, &list,
|
if (Xutf8TextPropertyToTextList(X_Dpy, &prop, &list,
|
||||||
&nitems) == Success && nitems > 0 && *list) {
|
&nitems) == Success && nitems > 0 && *list) {
|
||||||
|
@ -154,7 +154,7 @@ xu_getstrprop(Window win, Atom atm, char **text) {
|
||||||
|
|
||||||
XFree(prop.value);
|
XFree(prop.value);
|
||||||
|
|
||||||
return (nitems);
|
return(nitems);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Root Window Properties */
|
/* Root Window Properties */
|
||||||
|
@ -351,13 +351,13 @@ xu_ewmh_get_net_wm_state(struct client_ctx *cc, int *n)
|
||||||
|
|
||||||
if ((*n = xu_getprop(cc->win, ewmh[_NET_WM_STATE], XA_ATOM, 64L,
|
if ((*n = xu_getprop(cc->win, ewmh[_NET_WM_STATE], XA_ATOM, 64L,
|
||||||
(unsigned char **)&p)) <= 0)
|
(unsigned char **)&p)) <= 0)
|
||||||
return (NULL);
|
return(NULL);
|
||||||
|
|
||||||
state = xcalloc(*n, sizeof(Atom));
|
state = xcalloc(*n, sizeof(Atom));
|
||||||
(void)memcpy(state, p, *n * sizeof(Atom));
|
(void)memcpy(state, p, *n * sizeof(Atom));
|
||||||
XFree((char *)p);
|
XFree((char *)p);
|
||||||
|
|
||||||
return (state);
|
return(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -483,7 +483,7 @@ xu_xft_width(XftFont *xftfont, const char *text, int len)
|
||||||
XftTextExtentsUtf8(X_Dpy, xftfont, (const FcChar8*)text,
|
XftTextExtentsUtf8(X_Dpy, xftfont, (const FcChar8*)text,
|
||||||
len, &extents);
|
len, &extents);
|
||||||
|
|
||||||
return (extents.xOff);
|
return(extents.xOff);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
Loading…
Reference in New Issue
Block a user