From 19171e5540fa0913f0d62cc7642d4e1dd6cb16eb Mon Sep 17 00:00:00 2001 From: Hari Rana Date: Tue, 9 Dec 2025 22:26:10 -0500 Subject: [PATCH] gui/event-widget: Position event popover to the pointer's Currently, the event popover will always set its position to the center of the event widget. This becomes an undesirable behavior with long(er) event widgets, as clicking the edges will require the user to physically move their pointer all the way to the popover, which may be challenging depending on the distance. This addresses this problematic behavior by positioning the popover right above the pointer only when the event is a multi-day event, and when the event widget is not inside a GtkListBox widget. Part-of: --- src/gui/gcal-event-widget.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/gui/gcal-event-widget.c b/src/gui/gcal-event-widget.c index fadbdd62..c1762094 100644 --- a/src/gui/gcal-event-widget.c +++ b/src/gui/gcal-event-widget.c @@ -30,6 +30,7 @@ #include "gcal-event-popover.h" #include "gcal-event-widget.h" #include "gcal-overflow-bin.h" +#include "gcal-view.h" #include "gcal-utils.h" #define LOCATION_MAX_LEN 50 @@ -583,8 +584,24 @@ on_click_gesture_release_cb (GtkGestureClick *click_gesture, gdouble y, GcalEventWidget *self) { + GdkRectangle rect; + gboolean not_inside_list_box; + gtk_gesture_set_state (GTK_GESTURE (click_gesture), GTK_EVENT_SEQUENCE_CLAIMED); g_signal_emit (self, signals[ACTIVATE], 0); + + g_assert (GCAL_IS_EVENT_POPOVER (self->preview_popover)); + + not_inside_list_box = !gtk_widget_get_ancestor (GTK_WIDGET (self), GTK_TYPE_LIST_BOX); + if (not_inside_list_box && gcal_event_is_multiday (self->event)) + { + rect.x = x; + rect.y = 0; + rect.width = 1; + rect.height = 1; + + gtk_popover_set_pointing_to (GTK_POPOVER (self->preview_popover), &rect); + } } static void