summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOrestis Floros <orestisflo@gmail.com>2022-07-28 07:14:36 +0200
committerMichael Stapelberg <stapelberg@users.noreply.github.com>2022-07-28 09:25:55 +0200
commit807e972330b011de6afd227283cd49ebcf0ce1e7 (patch)
tree6cbb7ea1634a2c2e5d68ce4b6d77279d26b36bca
parent103dc7b55dce161d14888a481020f69687eafa2d (diff)
downloadi3-807e972330b011de6afd227283cd49ebcf0ce1e7.tar.gz
i3-807e972330b011de6afd227283cd49ebcf0ce1e7.zip
Fix Wbitwise-instead-of-logical warnings
> error: use of bitwise '|' with boolean operands
-rw-r--r--src/randr.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/src/randr.c b/src/randr.c
index b4d1d094..26b4ca34 100644
--- a/src/randr.c
+++ b/src/randr.c
@@ -665,11 +665,12 @@ static bool randr_query_outputs_15(void) {
new->primary = monitor_info->primary;
- new->changed =
- update_if_necessary(&(new->rect.x), monitor_info->x) |
- update_if_necessary(&(new->rect.y), monitor_info->y) |
- update_if_necessary(&(new->rect.width), monitor_info->width) |
- update_if_necessary(&(new->rect.height), monitor_info->height);
+ const bool update_x = update_if_necessary(&(new->rect.x), monitor_info->x);
+ const bool update_y = update_if_necessary(&(new->rect.y), monitor_info->y);
+ const bool update_w = update_if_necessary(&(new->rect.width), monitor_info->width);
+ const bool update_h = update_if_necessary(&(new->rect.height), monitor_info->height);
+
+ new->changed = update_x || update_y || update_w || update_h;
DLOG("name %s, x %d, y %d, width %d px, height %d px, width %d mm, height %d mm, primary %d, automatic %d\n",
name,
@@ -743,10 +744,11 @@ static void handle_output(xcb_connection_t *conn, xcb_randr_output_t id,
return;
}
- bool updated = update_if_necessary(&(new->rect.x), crtc->x) |
- update_if_necessary(&(new->rect.y), crtc->y) |
- update_if_necessary(&(new->rect.width), crtc->width) |
- update_if_necessary(&(new->rect.height), crtc->height);
+ const bool update_x = update_if_necessary(&(new->rect.x), crtc->x);
+ const bool update_y = update_if_necessary(&(new->rect.y), crtc->y);
+ const bool update_w = update_if_necessary(&(new->rect.width), crtc->width);
+ const bool update_h = update_if_necessary(&(new->rect.height), crtc->height);
+ const bool updated = update_x || update_y || update_w || update_h;
free(crtc);
new->active = (new->rect.width != 0 && new->rect.height != 0);
if (!new->active) {
@@ -943,9 +945,11 @@ void randr_query_outputs(void) {
uint32_t width = min(other->rect.width, output->rect.width);
uint32_t height = min(other->rect.height, output->rect.height);
- if (update_if_necessary(&(output->rect.width), width) |
- update_if_necessary(&(output->rect.height), height))
+ const bool update_w = update_if_necessary(&(output->rect.width), width);
+ const bool update_h = update_if_necessary(&(output->rect.height), height);
+ if (update_w || update_h) {
output->changed = true;
+ }
update_if_necessary(&(other->rect.width), width);
update_if_necessary(&(other->rect.height), height);