diff --git a/awesome-client.c b/awesome-client.c index 8f9518e9..bc4024aa 100644 --- a/awesome-client.c +++ b/awesome-client.c @@ -105,9 +105,9 @@ send_msg(const char *msg, ssize_t msg_len) { int try = 10; - while (try && send_msg_raw(msg, msg_len) == -1) + while(try && send_msg_raw(msg, msg_len) == -1) { - switch (errno) + switch(errno) { case EPIPE: case ENOTCONN: @@ -146,7 +146,7 @@ recv_msg(void) while(try) { r = recv(csfd, buf, sizeof(buf) - 1, MSG_TRUNC | MSG_DONTWAIT); - if (r < 0) + if(r < 0) { if(errno != EAGAIN) return warn("error recieving from UNIX domain socket: %s", strerror(errno)); @@ -205,7 +205,7 @@ main(int argc, char **argv) display = getenv("DISPLAY"); - if (!sockets_init()) + if(!sockets_init()) { warn("can't connect to UNIX domain socket: %s", strerror(errno)); return EXIT_FAILURE; @@ -240,12 +240,12 @@ main(int argc, char **argv) { ret_value = send_msg(msg, msg_len); p_delete(&msg); - if (ret_value != EXIT_SUCCESS) + if(ret_value != EXIT_SUCCESS) return ret_value; msg = p_new(char, 1); msg_len = 1; } - else if (len > 1) + else if(len > 1) { msg_len += len; p_realloc(&msg, msg_len); diff --git a/client.c b/client.c index 439d9f7f..741bd2de 100644 --- a/client.c +++ b/client.c @@ -242,7 +242,7 @@ client_ban(client_t *c) } /* Wait until the last moment to take away the focus from the window. */ - if (globalconf.screens[c->phys_screen].client_focus == c) + if(globalconf.screens[c->phys_screen].client_focus == c) client_unfocus(c); } @@ -756,7 +756,7 @@ client_resize(client_t *c, area_t geometry, bool hints) /* The idea is to give a client a resize even when banned. */ /* We just have to move the (x,y) to keep it out of the viewport. */ /* This at least doesn't break expectations about events. */ - if (c->isbanned) + if(c->isbanned) { geometry_internal.x = values[0] = - (geometry_internal.width + 2 * c->border); geometry_internal.y = values[1] = - (geometry_internal.height + 2 * c->border); @@ -826,7 +826,7 @@ client_setfullscreen(client_t *c, bool s) area_t geometry; /* Make sure the current geometry is stored without titlebar. */ - if (s) + if(s) titlebar_ban(c->titlebar); /* become fullscreen! */ @@ -1456,7 +1456,7 @@ luaA_client_struts(lua_State *L) struts.top = luaA_getopt_number(L, 2, "top", (*c)->strut.top); struts.bottom = luaA_getopt_number(L, 2, "bottom", (*c)->strut.bottom); - if (struts.left != (*c)->strut.left || struts.right != (*c)->strut.right || + if(struts.left != (*c)->strut.left || struts.right != (*c)->strut.right || struts.top != (*c)->strut.top || struts.bottom != (*c)->strut.bottom) { /* Struts are not so well defined in the context of xinerama. So we just * give the entire root window and let the window manager decide. */ diff --git a/dbus.c b/dbus.c index 089de74f..9b776835 100644 --- a/dbus.c +++ b/dbus.c @@ -455,7 +455,8 @@ a_dbus_cleanup(void) dbus_error_free(&err); - if (dbusio.fd >= 0) { + if(dbusio.fd >= 0) + { ev_ref(EV_DEFAULT_UC); ev_io_stop(EV_DEFAULT_UC_ &dbusio); dbusio.fd = -1; diff --git a/draw.c b/draw.c index aa796832..c9107dfe 100644 --- a/draw.c +++ b/draw.c @@ -100,7 +100,7 @@ draw_screen_default_visual(xcb_screen_t *s) for(; depth_iter.rem; xcb_depth_next (&depth_iter)) for(xcb_visualtype_iterator_t visual_iter = xcb_depth_visuals_iterator (depth_iter.data); visual_iter.rem; xcb_visualtype_next (&visual_iter)) - if (s->root_visual == visual_iter.data->visual_id) + if(s->root_visual == visual_iter.data->visual_id) return visual_iter.data; return NULL; @@ -457,7 +457,7 @@ draw_graph(draw_context_t *ctx, area_t rect, int *from, int *to, int cur_index, cairo_line_to(ctx->cr, x, rect.y - to[cur_index]); x -= 1.0; - if (--cur_index < 0) + if(--cur_index < 0) cur_index = rect.width - 1; } } @@ -468,7 +468,7 @@ draw_graph(draw_context_t *ctx, area_t rect, int *from, int *to, int cur_index, cairo_line_to(ctx->cr, x, rect.y - to[cur_index]); x += 1.0; - if (--cur_index < 0) + if(--cur_index < 0) cur_index = rect.width - 1; } @@ -533,7 +533,7 @@ draw_graph_line(draw_context_t *ctx, area_t rect, int *to, int cur_index, /* cycles around the index */ if(grow == Right) { - if (++cur_index > w - 1) + if(++cur_index > w - 1) cur_index = 0; } else @@ -695,7 +695,7 @@ draw_text_extents(draw_text_context_t *data) alignment_t draw_align_fromstr(const char *align, ssize_t len) { - switch (a_tokenize(align, len)) + switch(a_tokenize(align, len)) { case A_TK_CENTER: return AlignCenter; case A_TK_RIGHT: return AlignRight; diff --git a/event.c b/event.c index 995672d5..7dedef1d 100644 --- a/event.c +++ b/event.c @@ -292,7 +292,7 @@ event_handle_configurerequest(void *data __attribute__ ((unused)), if(ev->value_mask & XCB_CONFIG_WINDOW_HEIGHT) geometry.height = ev->height; - if (ev->value_mask & XCB_CONFIG_WINDOW_BORDER_WIDTH) + if(ev->value_mask & XCB_CONFIG_WINDOW_BORDER_WIDTH) client_setborder(c, ev->border_width); /* Clients are not allowed to directly mess with stacking parameters. */ diff --git a/key.c b/key.c index 322b8f41..84accb47 100644 --- a/key.c +++ b/key.c @@ -58,12 +58,12 @@ static int key_ev_cmp(xcb_keysym_t keysym, xcb_keycode_t keycode, unsigned long mod, const keyb_t *k) { - if (k->keysym) { - if (k->keysym != keysym) + if(k->keysym) { + if(k->keysym != keysym) return k->keysym > keysym ? 1 : -1; } - if (k->keycode) { - if (k->keycode != keycode) + if(k->keycode) { + if(k->keycode != keycode) return k->keycode > keycode ? 1 : -1; } return k->mod == mod ? 0 : (k->mod > mod ? 1 : -1); @@ -75,9 +75,9 @@ key_cmp(const keyb_t *k1, const keyb_t *k2) assert ((k1->keysym && k2->keysym) || (k1->keycode && k2->keycode)); assert ((!k1->keysym && !k2->keysym) || (!k1->keycode && !k2->keycode)); - if (k1->keysym != k2->keysym) + if(k1->keysym != k2->keysym) return k2->keysym > k1->keysym ? 1 : -1; - if (k1->keycode != k2->keycode) + if(k1->keycode != k2->keycode) return k2->keycode > k1->keycode ? 1 : -1; return k1->mod == k2->mod ? 0 : (k2->mod > k1->mod ? 1 : -1); } @@ -125,9 +125,10 @@ key_register(keybindings_t *keys, keyb_t *k) key_ref(&k); - while (l < r) { + while(l < r) { int i = (r + l) / 2; - switch (key_cmp(k, arr->tab[i])) { + switch(key_cmp(k, arr->tab[i])) + { case -1: /* k < arr->tab[i] */ r = i; break; @@ -234,10 +235,10 @@ key_find(keybindings_t *keys, const xcb_key_press_event_t *ev) again: l = 0; r = arr->len; - while (l < r) + while(l < r) { int i = (r + l) / 2; - switch (key_ev_cmp(keysym, ev->detail, mod, arr->tab[i])) + switch(key_ev_cmp(keysym, ev->detail, mod, arr->tab[i])) { case -1: /* ev < arr->tab[i] */ r = i; @@ -265,9 +266,9 @@ luaA_keystore(keyb_t *key, const char *str, ssize_t len) if(*str != '#') { key->keysym = XStringToKeysym(str); - if (!key->keysym) + if(!key->keysym) { - if (len == 1) + if(len == 1) key->keysym = *str; else warn("there's no keysym named \"%s\"", str); diff --git a/keygrabber.c b/keygrabber.c index a19db379..13b5765e 100644 --- a/keygrabber.c +++ b/keygrabber.c @@ -101,7 +101,7 @@ keysym_to_unicode_590_5fe[] = 0x06f0, 0x06f1, 0x06f2, 0x06f3, 0x06f4, 0x06f5, 0x06f6, 0x06f7, /* 0x0590-0x0597 */ 0x06f8, 0x06f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x0598-0x059f */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x066a, 0x0670, 0x0679, /* 0x05a0-0x05a7 */ - + 0x067e, 0x0686, 0x0688, 0x0691, 0x060c, 0x0000, 0x06d4, 0x0000, /* 0x05ac-0x05af */ 0x0660, 0x0661, 0x0662, 0x0663, 0x0664, 0x0665, 0x0666, 0x0667, /* 0x05b0-0x05b7 */ 0x0668, 0x0669, 0x0000, 0x061b, 0x0000, 0x0000, 0x0000, 0x061f, /* 0x05b8-0x05bf */ @@ -258,7 +258,7 @@ keysym_to_unicode_12a1_12fe[] = 0x0175, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6b, /* 0x12f0-0x12f7 */ 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0177 /* 0x12f0-0x12ff */ }; - + static unsigned short const keysym_to_unicode_13bc_13be[] = { @@ -403,7 +403,7 @@ keysym_to_utf8(char *buf, int len, const xcb_keysym_t ksym) return false; count = utf8clen(ksym_conv); - switch (count) + switch(count) { case 7: return false; case 6: buf[5] = (ksym_conv | 0x80) & 0xbf; ksym_conv >>= 6; @@ -515,7 +515,7 @@ static bool keysym_to_xkb(char *buf, ssize_t len, const xcb_keysym_t ksym) { switch(ksym) - { + { CASE(ISO_Lock); CASE(ISO_Level2_Latch); CASE(ISO_Level3_Shift); @@ -687,7 +687,7 @@ keygrabber_handlekpress(lua_State *L, xcb_key_press_event_t *e) xcb_keysym_t ksym = 0; char buf[MAX(MB_LEN_MAX, 32)]; - if (!key_press_lookup_string(e, buf, countof(buf), &ksym)) + if(!key_press_lookup_string(e, buf, countof(buf), &ksym)) return false; lua_newtable(L); diff --git a/luaa.c b/luaa.c index 9d615f49..afe249ec 100644 --- a/luaa.c +++ b/luaa.c @@ -991,7 +991,7 @@ luaA_docmd(const char *cmd) oldtop = newtop; *p = '\0'; - if (luaL_dostring(globalconf.L, cmd)) + if(luaL_dostring(globalconf.L, cmd)) { warn("error executing Lua code: %s", lua_tostring(globalconf.L, -1)); return 1; @@ -1040,7 +1040,7 @@ static void luaA_conn_cleanup(EV_P_ ev_io *w) { ev_ref(EV_DEFAULT_UC); ev_io_stop(EV_DEFAULT_UC_ w); - if (close(w->fd)) + if(close(w->fd)) warn("error closing UNIX domain socket: %s", strerror(errno)); p_delete(&w); } @@ -1079,7 +1079,7 @@ luaA_cb(EV_P_ ev_io *w, int revents) s = lua_tolstring(globalconf.L, -1, &len); /* ignore ENOENT because the client may not read */ - if (send(w->fd, s, len, MSG_DONTWAIT) == -1) + if(send(w->fd, s, len, MSG_DONTWAIT) == -1) switch(errno) { case ENOENT: @@ -1112,7 +1112,7 @@ luaA_cs_init(void) { int csfd = socket_getclient(); - if (csfd < 0 || fcntl(csfd, F_SETFD, FD_CLOEXEC) == -1) + if(csfd < 0 || fcntl(csfd, F_SETFD, FD_CLOEXEC) == -1) return; if(!(addr = socket_open(csfd, SOCKET_MODE_BIND))) @@ -1134,7 +1134,7 @@ luaA_cs_cleanup(void) return; ev_ref(EV_DEFAULT_UC); ev_io_stop(EV_DEFAULT_UC_ &csio); - if (close(csio.fd)) + if(close(csio.fd)) warn("error closing UNIX domain socket: %s", strerror(errno)); if(unlink(addr->sun_path)) warn("error unlinking UNIX domain socket: %s", strerror(errno)); diff --git a/mouse.c b/mouse.c index 53499dc3..d43b386c 100644 --- a/mouse.c +++ b/mouse.c @@ -66,7 +66,7 @@ mouse_query_pointer(xcb_window_t window, int16_t *x, int16_t *y, xcb_window_t *c *x = query_ptr_r->win_x; *y = query_ptr_r->win_y; - if (mask) + if(mask) *mask = query_ptr_r->mask; if(child) *child = query_ptr_r->child; diff --git a/screen.c b/screen.c index a815fbc9..bfab8cc0 100644 --- a/screen.c +++ b/screen.c @@ -185,28 +185,28 @@ screen_area_get(int screen, wibox_array_t *wiboxes, { if(c->strut.top_start_x || c->strut.top_end_x) { - if (c->strut.top) + if(c->strut.top) top += c->strut.top; else top += c->geometry.height; } if(c->strut.bottom_start_x || c->strut.bottom_end_x) { - if (c->strut.bottom) + if(c->strut.bottom) bottom += c->strut.bottom; else bottom += c->geometry.height; } if(c->strut.left_start_y || c->strut.left_end_y) { - if (c->strut.left) + if(c->strut.left) left += c->strut.left; else left += c->geometry.width; } if(c->strut.right_start_y || c->strut.right_end_y) { - if (c->strut.right) + if(c->strut.right) right += c->strut.right; else right += c->geometry.width; @@ -334,7 +334,7 @@ screen_client_moveto(client_t *c, int new_screen, bool dotag, bool doresize) globalconf.screens[old_screen].need_arrange = true; client_need_arrange(c); - if (!doresize) + if(!doresize) return; from = screen_area_get(old_screen, NULL, NULL, false); @@ -351,15 +351,15 @@ screen_client_moveto(client_t *c, int new_screen, bool dotag, bool doresize) new_f_geometry.y = to.y + new_f_geometry.y - from.x; /* resize the client's original geometry if it doesn't fit the screen */ - if (new_f_geometry.width > to.width) + if(new_f_geometry.width > to.width) new_f_geometry.width = to.width; - if (new_f_geometry.height > to.height) + if(new_f_geometry.height > to.height) new_f_geometry.height = to.height; /* make sure the client is still on the screen */ - if (new_f_geometry.x + new_f_geometry.width > to.x + to.width) + if(new_f_geometry.x + new_f_geometry.width > to.x + to.width) new_f_geometry.x = to.x + to.width - new_f_geometry.width; - if (new_f_geometry.y + new_f_geometry.height > to.y + to.height) + if(new_f_geometry.y + new_f_geometry.height > to.y + to.height) new_f_geometry.y = to.y + to.height - new_f_geometry.height; c->geometries.fullscreen = new_f_geometry; diff --git a/tag.c b/tag.c index e2ba3acb..3278d0a6 100644 --- a/tag.c +++ b/tag.c @@ -178,7 +178,7 @@ bool is_client_tagged(client_t *c, tag_t *t) { for(int i = 0; i < t->clients.len; i++) - if (t->clients.tab[i] == c) + if(t->clients.tab[i] == c) return true; return false; @@ -210,7 +210,7 @@ tags_get_current(int screen) static void tag_view_only(tag_t *target) { - if (target) + if(target) { tag_array_t *tags = &globalconf.screens[target->screen].tags; diff --git a/titlebar.c b/titlebar.c index 50f27b80..f75a4ddb 100644 --- a/titlebar.c +++ b/titlebar.c @@ -83,7 +83,7 @@ titlebar_ban(wibox_t *titlebar) } /* Remove titlebar geometry from client. */ - if ((c = client_getbytitlebar(titlebar))) + if((c = client_getbytitlebar(titlebar))) c->geometry = titlebar_geometry_remove(titlebar, 0, c->geometry); titlebar->isbanned = true; @@ -104,7 +104,7 @@ titlebar_unban(wibox_t *titlebar) client_t *c; simple_window_t *sw = &titlebar->sw; - if (sw->window) + if(sw->window) { /* All resizing is done, so only move now. */ uint32_t request[] = { sw->geometry.x, sw->geometry.y }; @@ -117,7 +117,7 @@ titlebar_unban(wibox_t *titlebar) titlebar->isbanned = false; /* Add titlebar geometry from client. */ - if ((c = client_getbytitlebar(titlebar))) + if((c = client_getbytitlebar(titlebar))) c->geometry = titlebar_geometry_add(titlebar, 0, c->geometry); } } @@ -303,9 +303,9 @@ titlebar_client_attach(client_t *c, wibox_t *t) void titlebar_set_visible(wibox_t *t, bool visible) { - if (visible != t->isvisible) + if(visible != t->isvisible) { - if ((t->isvisible = visible)) + if((t->isvisible = visible)) titlebar_unban(t); else titlebar_ban(t);