code-style: general cleanups (#137)
* tns_clean_cache: remove unused function arg * remove malloc casting * improve consistency use sizeof(T) at the end * avoid comparing integers of different signedness * use Window type for embed and parent * remove unnecessary comparisons * remove cpp style comments * improve consistency: remove comma from the end of enumerator list * Removed useless _IMAGE_CONFIG defines * consistency: use the same order as snprintf * Resolve c89 warnings Co-authored-by: uidops <uidops@protonmail.com> Co-authored-by: Arthur Williams <taaparthur@gmail.com>
This commit is contained in:
20
window.c
20
window.c
@ -172,7 +172,7 @@ void win_init(win_t *win)
|
||||
void win_open(win_t *win)
|
||||
{
|
||||
int c, i, j, n;
|
||||
long parent;
|
||||
Window parent;
|
||||
win_env_t *e;
|
||||
XClassHint classhint;
|
||||
unsigned long *icon_data;
|
||||
@ -188,7 +188,7 @@ void win_open(win_t *win)
|
||||
XSetWindowAttributes attrs;
|
||||
|
||||
e = &win->env;
|
||||
parent = options->embed != 0 ? options->embed : RootWindow(e->dpy, e->scr);
|
||||
parent = options->embed ? options->embed : RootWindow(e->dpy, e->scr);
|
||||
|
||||
sizehints.flags = PWinGravity;
|
||||
sizehints.win_gravity = NorthWestGravity;
|
||||
@ -199,16 +199,16 @@ void win_open(win_t *win)
|
||||
else
|
||||
gmask = XParseGeometry(options->geometry, &win->x, &win->y,
|
||||
&win->w, &win->h);
|
||||
if ((gmask & WidthValue) != 0)
|
||||
if (gmask & WidthValue)
|
||||
sizehints.flags |= USSize;
|
||||
else
|
||||
win->w = WIN_WIDTH;
|
||||
if ((gmask & HeightValue) != 0)
|
||||
if (gmask & HeightValue)
|
||||
sizehints.flags |= USSize;
|
||||
else
|
||||
win->h = WIN_HEIGHT;
|
||||
if ((gmask & XValue) != 0) {
|
||||
if ((gmask & XNegative) != 0) {
|
||||
if (gmask & XValue) {
|
||||
if (gmask & XNegative) {
|
||||
win->x += e->scrw - win->w;
|
||||
sizehints.win_gravity = NorthEastGravity;
|
||||
}
|
||||
@ -216,8 +216,8 @@ void win_open(win_t *win)
|
||||
} else {
|
||||
win->x = 0;
|
||||
}
|
||||
if ((gmask & YValue) != 0) {
|
||||
if ((gmask & YNegative) != 0) {
|
||||
if (gmask & YValue) {
|
||||
if (gmask & YNegative) {
|
||||
win->y += e->scrh - win->h;
|
||||
sizehints.win_gravity = sizehints.win_gravity == NorthEastGravity
|
||||
? SouthEastGravity : SouthWestGravity;
|
||||
@ -322,7 +322,7 @@ void win_open(win_t *win)
|
||||
|
||||
CLEANUP void win_close(win_t *win)
|
||||
{
|
||||
int i;
|
||||
unsigned int i;
|
||||
|
||||
for (i = 0; i < ARRLEN(cursors); i++)
|
||||
XFreeCursor(win->env.dpy, cursors[i].icon);
|
||||
@ -360,7 +360,7 @@ void win_toggle_fullscreen(win_t *win)
|
||||
cm->window = win->xwin;
|
||||
cm->message_type = atoms[ATOM__NET_WM_STATE];
|
||||
cm->format = 32;
|
||||
cm->data.l[0] = 2; // toggle
|
||||
cm->data.l[0] = 2; /* toggle */
|
||||
cm->data.l[1] = atoms[ATOM__NET_WM_STATE_FULLSCREEN];
|
||||
|
||||
XSendEvent(win->env.dpy, DefaultRootWindow(win->env.dpy), False,
|
||||
|
Reference in New Issue
Block a user