views/month: Use variables some more

Makes it easier to reason about the if conditions there.
This commit is contained in:
Georges Basile Stavracas Neto
2024-08-13 16:25:45 +00:00
parent 11499ad1d5
commit 54657788d0
+8 -4
View File
@@ -118,6 +118,8 @@ allocate_overflow_popover (GcalMonthView *self,
gint popover_height; gint popover_height;
gint popover_width; gint popover_width;
gint header_height; gint header_height;
gint popover_x2;
gint popover_y2;
g_assert (self->overflow.relative_to != NULL); g_assert (self->overflow.relative_to != NULL);
@@ -167,11 +169,13 @@ allocate_overflow_popover (GcalMonthView *self,
.height = popover_height, .height = popover_height,
}; };
if (popover_allocation.x + popover_allocation.width > width) popover_x2 = popover_allocation.x + popover_allocation.width;
popover_allocation.x -= (popover_allocation.x + popover_allocation.width - width); if (popover_x2 > width)
popover_allocation.x -= (popover_x2 - width);
if (popover_allocation.y + popover_allocation.height > height) popover_y2 = popover_allocation.y + popover_allocation.height;
popover_allocation.y -= (popover_allocation.y + popover_allocation.height - height); if (popover_y2 > height)
popover_allocation.y -= (popover_y2 - height);
gtk_widget_size_allocate (self->overflow.popover, &popover_allocation, baseline); gtk_widget_size_allocate (self->overflow.popover, &popover_allocation, baseline);
} }