From 6b04f28b4850a32ce1b9b2a5c7bea5b0a7c0a4fe Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sun, 29 Mar 2015 17:12:20 +0200 Subject: [PATCH] fix remaining warnings --- i3bar/src/xcb.c | 14 +++++++------- libi3/safewrappers.c | 4 ++-- src/handlers.c | 18 +++++++++++------- 3 files changed, 20 insertions(+), 16 deletions(-) diff --git a/i3bar/src/xcb.c b/i3bar/src/xcb.c index d0bc3d6c..e53b9226 100644 --- a/i3bar/src/xcb.c +++ b/i3bar/src/xcb.c @@ -110,23 +110,23 @@ struct xcb_colors_t { struct xcb_colors_t colors; /* Horizontal offset between a workspace label and button borders */ -const static int ws_hoff_px = 4; +static const int ws_hoff_px = 4; /* Vertical offset between a workspace label and button borders */ -const static int ws_voff_px = 3; +static const int ws_voff_px = 3; /* Offset between two workspace buttons */ -const static int ws_spacing_px = 1; +static const int ws_spacing_px = 1; /* Offset between the statusline and 1) workspace buttons on the left * 2) the tray or screen edge on the right */ -const static int sb_hoff_px = 4; +static const int sb_hoff_px = 4; /* Additional offset between the tray and the statusline, if the tray is not empty */ -const static int tray_loff_px = 2; +static const int tray_loff_px = 2; /* Vertical offset between the bar and a separator */ -const static int sep_voff_px = 4; +static const int sep_voff_px = 4; /* We define xcb_request_failed as a macro to include the relevant line number */ #define xcb_request_failed(cookie, err_msg) _xcb_request_failed(cookie, err_msg, __LINE__) @@ -1941,7 +1941,7 @@ void draw_bars(bool unhide) { DLOG("Printing statusline!\n"); int tray_width = get_tray_width(outputs_walk->trayclients); - int max_statusline_width = outputs_walk->rect.w - workspace_width - tray_width - 2 * logical_px(sb_hoff_px); + uint32_t max_statusline_width = outputs_walk->rect.w - workspace_width - tray_width - 2 * logical_px(sb_hoff_px); /* If the statusline is too long, try to use short texts. */ if (statusline_width > max_statusline_width) diff --git a/libi3/safewrappers.c b/libi3/safewrappers.c index 6acf3109..db9b6b4a 100644 --- a/libi3/safewrappers.c +++ b/libi3/safewrappers.c @@ -60,7 +60,7 @@ int sasprintf(char **strp, const char *fmt, ...) { } ssize_t writeall(int fd, const void *buf, size_t count) { - int written = 0; + size_t written = 0; ssize_t n = 0; while (written < count) { @@ -70,7 +70,7 @@ ssize_t writeall(int fd, const void *buf, size_t count) { continue; return n; } - written += n; + written += (size_t)n; } return written; diff --git a/src/handlers.c b/src/handlers.c index 4b5c87d4..041f7e36 100644 --- a/src/handlers.c +++ b/src/handlers.c @@ -874,12 +874,16 @@ static void handle_client_message(xcb_client_message_event_t *event) { .root_y = y_root, .event_x = x_root - (con->rect.x), .event_y = y_root - (con->rect.y)}; - if (direction == _NET_WM_MOVERESIZE_MOVE) { - floating_drag_window(con->parent, &fake); - } else if (direction >= _NET_WM_MOVERESIZE_SIZE_TOPLEFT && direction <= _NET_WM_MOVERESIZE_SIZE_LEFT) { - floating_resize_window(con->parent, FALSE, &fake); - } else { - DLOG("_NET_WM_MOVERESIZE direction %d not implemented\n", direction); + switch (direction) { + case _NET_WM_MOVERESIZE_MOVE: + floating_drag_window(con->parent, &fake); + break; + case _NET_WM_MOVERESIZE_SIZE_TOPLEFT... _NET_WM_MOVERESIZE_SIZE_LEFT: + floating_resize_window(con->parent, FALSE, &fake); + break; + default: + DLOG("_NET_WM_MOVERESIZE direction %d not implemented\n", direction); + break; } } else { DLOG("unhandled clientmessage\n"); @@ -1214,7 +1218,7 @@ static bool handle_strut_partial_change(void *data, xcb_connection_t *conn, uint con->window->dock = W_DOCK_BOTTOM; } else { DLOG("Ignoring invalid reserved edges (_NET_WM_STRUT_PARTIAL), using position as fallback:\n"); - if (con->geometry.y < (int16_t)(search_at->rect.height / 2)) { + if (con->geometry.y < (search_at->rect.height / 2)) { DLOG("geom->y = %d < rect.height / 2 = %d, it is a top dock client\n", con->geometry.y, (search_at->rect.height / 2)); con->window->dock = W_DOCK_TOP;