diff options
-rw-r--r-- | sway/config/output.c | 2 | ||||
-rw-r--r-- | sway/desktop/output.c | 10 | ||||
-rw-r--r-- | sway/desktop/render.c | 12 | ||||
-rw-r--r-- | sway/input/seatop_default.c | 4 | ||||
-rw-r--r-- | sway/input/seatop_down.c | 2 |
5 files changed, 15 insertions, 15 deletions
diff --git a/sway/config/output.c b/sway/config/output.c index 914cf6c4..e2e48e4c 100644 --- a/sway/config/output.c +++ b/sway/config/output.c @@ -257,7 +257,7 @@ static void set_mode(struct wlr_output *output, struct wlr_output_state *pending // Not all floating point integers can be represented exactly // as (int)(1000 * mHz / 1000.f) // round() the result to avoid any error - int mhz = (int)round(refresh_rate * 1000); + int mhz = (int)roundf(refresh_rate * 1000); if (wl_list_empty(&output->modes) || custom) { sway_log(SWAY_DEBUG, "Assigning custom mode to %s", output->name); diff --git a/sway/desktop/output.c b/sway/desktop/output.c index f39b8ea7..409478a7 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -364,14 +364,14 @@ overlay: } static int scale_length(int length, int offset, float scale) { - return round((offset + length) * scale) - round(offset * scale); + return roundf((offset + length) * scale) - roundf(offset * scale); } void scale_box(struct wlr_box *box, float scale) { box->width = scale_length(box->width, box->x, scale); box->height = scale_length(box->height, box->y, scale); - box->x = round(box->x * scale); - box->y = round(box->y * scale); + box->x = roundf(box->x * scale); + box->y = roundf(box->y * scale); } struct sway_workspace *output_get_active_workspace(struct sway_output *output) { @@ -683,11 +683,11 @@ static void damage_surface_iterator(struct sway_output *output, pixman_region32_init(&damage); wlr_surface_get_effective_damage(surface, &damage); wlr_region_scale(&damage, &damage, output->wlr_output->scale); - if (ceil(output->wlr_output->scale) > surface->current.scale) { + if (ceilf(output->wlr_output->scale) > surface->current.scale) { // When scaling up a surface, it'll become blurry so we need to // expand the damage region wlr_region_expand(&damage, &damage, - ceil(output->wlr_output->scale) - surface->current.scale); + ceilf(output->wlr_output->scale) - surface->current.scale); } pixman_region32_translate(&damage, box.x, box.y); if (wlr_damage_ring_add(&output->damage_ring, &damage)) { diff --git a/sway/desktop/render.c b/sway/desktop/render.c index ea9c37d9..4d242bd7 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c @@ -50,7 +50,7 @@ struct render_data { * scaled to 2px. */ static int scale_length(int length, int offset, float scale) { - return round((offset + length) * scale) - round(offset * scale); + return roundf((offset + length) * scale) - roundf(offset * scale); } static void scissor_output(struct wlr_output *wlr_output, @@ -482,7 +482,7 @@ static void render_titlebar(struct sway_output *output, size_t inner_width = width - titlebar_h_padding * 2; // output-buffer local - int ob_inner_x = round(inner_x * output_scale); + int ob_inner_x = roundf(inner_x * output_scale); int ob_inner_width = scale_length(inner_width, inner_x, output_scale); int ob_bg_height = scale_length( (titlebar_v_padding - titlebar_border_thickness) * 2 + @@ -531,7 +531,7 @@ static void render_titlebar(struct sway_output *output, memcpy(&color, colors->background, sizeof(float) * 4); premultiply_alpha(color, con->alpha); box.x = texture_box.x + round(output_x * output_scale); - box.y = round((y + titlebar_border_thickness) * output_scale); + box.y = roundf((y + titlebar_border_thickness) * output_scale); box.width = texture_box.width; box.height = ob_padding_above; render_rect(output, output_damage, &box, color); @@ -562,7 +562,7 @@ static void render_titlebar(struct sway_output *output, // The title texture might be shorter than the config->font_height, // in which case we need to pad it above and below. - int ob_padding_above = round((titlebar_v_padding - + int ob_padding_above = roundf((titlebar_v_padding - titlebar_border_thickness) * output_scale); int ob_padding_below = ob_bg_height - ob_padding_above - texture_box.height; @@ -607,7 +607,7 @@ static void render_titlebar(struct sway_output *output, memcpy(&color, colors->background, sizeof(float) * 4); premultiply_alpha(color, con->alpha); box.x = texture_box.x + round(output_x * output_scale); - box.y = round((y + titlebar_border_thickness) * output_scale); + box.y = roundf((y + titlebar_border_thickness) * output_scale); box.width = texture_box.width; box.height = ob_padding_above; render_rect(output, output_damage, &box, color); @@ -647,7 +647,7 @@ static void render_titlebar(struct sway_output *output, box.width = ob_right_x - ob_left_x - ob_left_width; if (box.width > 0) { box.x = ob_left_x + ob_left_width + round(output_x * output_scale); - box.y = round(bg_y * output_scale); + box.y = roundf(bg_y * output_scale); box.height = ob_bg_height; render_rect(output, output_damage, &box, color); } diff --git a/sway/input/seatop_default.c b/sway/input/seatop_default.c index 84acefdf..6c69a0ea 100644 --- a/sway/input/seatop_default.c +++ b/sway/input/seatop_default.c @@ -726,7 +726,7 @@ static void handle_pointer_axis(struct sway_seat *seat, seat_get_active_tiling_child(seat, tabcontainer); list_t *siblings = container_get_siblings(cont); int desired = list_find(siblings, active->sway_container) + - round(scroll_factor * event->delta_discrete / WLR_POINTER_AXIS_DISCRETE_STEP); + roundf(scroll_factor * event->delta_discrete / WLR_POINTER_AXIS_DISCRETE_STEP); if (desired < 0) { desired = 0; } else if (desired >= siblings->length) { @@ -761,7 +761,7 @@ static void handle_pointer_axis(struct sway_seat *seat, if (!handled) { wlr_seat_pointer_notify_axis(cursor->seat->wlr_seat, event->time_msec, event->orientation, scroll_factor * event->delta, - round(scroll_factor * event->delta_discrete), event->source); + roundf(scroll_factor * event->delta_discrete), event->source); } } diff --git a/sway/input/seatop_down.c b/sway/input/seatop_down.c index b40773d0..3f880ccf 100644 --- a/sway/input/seatop_down.c +++ b/sway/input/seatop_down.c @@ -28,7 +28,7 @@ static void handle_pointer_axis(struct sway_seat *seat, wlr_seat_pointer_notify_axis(seat->wlr_seat, event->time_msec, event->orientation, scroll_factor * event->delta, - round(scroll_factor * event->delta_discrete), event->source); + roundf(scroll_factor * event->delta_discrete), event->source); } static void handle_button(struct sway_seat *seat, uint32_t time_msec, |