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:
@@ -574,12 +574,17 @@ gcal_month_view_row_size_allocate (GtkWidget *widget,
|
|||||||
{
|
{
|
||||||
GcalEventBlock *block;
|
GcalEventBlock *block;
|
||||||
GtkAllocation allocation;
|
GtkAllocation allocation;
|
||||||
|
gint start_cell;
|
||||||
|
gint end_cell;
|
||||||
|
|
||||||
block = g_ptr_array_index (blocks, block_index);
|
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.y = cell_y[block->cell];
|
||||||
allocation.width = block->length * cell_width;
|
allocation.width = round (end_cell * cell_width);
|
||||||
allocation.height = block->height;
|
allocation.height = block->height;
|
||||||
|
|
||||||
gtk_widget_set_child_visible (block->event_widget, block->visible);
|
gtk_widget_set_child_visible (block->event_widget, block->visible);
|
||||||
|
|||||||
Reference in New Issue
Block a user