CodeStyle

This commit is contained in:
Consolatis 2022-01-09 05:48:27 +01:00 committed by Johan Malm
parent e0264e471c
commit d9cef42721
5 changed files with 16 additions and 8 deletions

View file

@ -22,8 +22,9 @@ nodename(xmlNode *node, char *buf, int len)
char c; char c;
while ((c = *name++) != 0) { while ((c = *name++) != 0) {
*p++ = tolower(c); *p++ = tolower(c);
if (!--len) if (!--len) {
return buf; return buf;
}
} }
*p = 0; *p = 0;
node = node->parent; node = node->parent;

View file

@ -18,8 +18,9 @@ mousebind_button_from_str(const char *str, uint32_t *modifiers)
while (strlen(str) >= 2 && str[1] == '-') { while (strlen(str) >= 2 && str[1] == '-') {
char modname[2] = {str[0], 0}; char modname[2] = {str[0], 0};
uint32_t parsed_modifier = parse_modifier(modname); uint32_t parsed_modifier = parse_modifier(modname);
if (!parsed_modifier) if (!parsed_modifier) {
goto invalid; goto invalid;
}
*modifiers |= parsed_modifier; *modifiers |= parsed_modifier;
str += 2; str += 2;
} }

View file

@ -660,8 +660,9 @@ rcxml_read(const char *filename)
buf_init(&b); buf_init(&b);
while (getline(&line, &len, stream) != -1) { while (getline(&line, &len, stream) != -1) {
char *p = strrchr(line, '\n'); char *p = strrchr(line, '\n');
if (p) if (p) {
*p = '\0'; *p = '\0';
}
buf_add(&b, line); buf_add(&b, line);
} }
free(line); free(line);

View file

@ -481,8 +481,9 @@ handle_release_mousebinding(struct view *view, struct server *server,
case MOUSE_ACTION_RELEASE: case MOUSE_ACTION_RELEASE:
break; break;
case MOUSE_ACTION_CLICK: case MOUSE_ACTION_CLICK:
if (mousebind->pressed_in_context) if (mousebind->pressed_in_context) {
break; break;
}
continue; continue;
default: default:
continue; continue;
@ -497,8 +498,9 @@ handle_release_mousebinding(struct view *view, struct server *server,
* regardless of whether activated or not * regardless of whether activated or not
*/ */
wl_list_for_each(mousebind, &rc.mousebinds, link) { wl_list_for_each(mousebind, &rc.mousebinds, link) {
if (mousebind->button == button) if (mousebind->button == button) {
mousebind->pressed_in_context = false; mousebind->pressed_in_context = false;
}
} }
return activated_any && activated_any_frame; return activated_any && activated_any_frame;
} }
@ -551,12 +553,14 @@ handle_press_mousebinding(struct view *view, struct server *server,
* the release event, unless the press event is * the release event, unless the press event is
* counted as a DOUBLECLICK. * counted as a DOUBLECLICK.
*/ */
if (!double_click) if (!double_click) {
mousebind->pressed_in_context = true; mousebind->pressed_in_context = true;
}
continue; continue;
case MOUSE_ACTION_DOUBLECLICK: case MOUSE_ACTION_DOUBLECLICK:
if (!double_click) if (!double_click) {
continue; continue;
}
break; break;
case MOUSE_ACTION_PRESS: case MOUSE_ACTION_PRESS:
break; break;

View file

@ -261,8 +261,9 @@ parse_xml(const char *filename, struct server *server)
buf_init(&b); buf_init(&b);
while (getline(&line, &len, stream) != -1) { while (getline(&line, &len, stream) != -1) {
char *p = strrchr(line, '\n'); char *p = strrchr(line, '\n');
if (p) if (p) {
*p = '\0'; *p = '\0';
}
buf_add(&b, line); buf_add(&b, line);
} }
free(line); free(line);