views/month-view-row: Compute exact width of event widgets

Currently, month cells are using `round()` to allocate the width,
whereas event widgets are using implicit double → int conversion,
which causes event widgets to be offset by a pixel, and thus
touches month cells' borders.

This new approach guarantees the exact width of the event widgets
by invoking `round()`.

Part-of: <https://gitlab.gnome.org/GNOME/gnome-calendar/-/merge_requests/676>
This commit is contained in:
Hari Rana
2025-12-28 17:04:32 +00:00
committed by Marge Bot
parent 7577e2a1d5
commit b0a5ff18d5
+7 -2
View File
@@ -574,12 +574,17 @@ gcal_month_view_row_size_allocate (GtkWidget *widget,
{
GcalEventBlock *block;
GtkAllocation allocation;
gint start_cell;
gint end_cell;
block = g_ptr_array_index (blocks, block_index);
allocation.x = (is_ltr ? block->cell : 7 - block->cell - block->length) * cell_width;
start_cell = is_ltr ? block->cell : 7 - block->cell - block->length;
end_cell = start_cell + block->length;
allocation.x = round (start_cell * cell_width);
allocation.y = cell_y[block->cell];
allocation.width = block->length * cell_width;
allocation.width = round (end_cell * cell_width);
allocation.height = block->height;
gtk_widget_set_child_visible (block->event_widget, block->visible);