diff options
author | Milan Crha <mcrha@redhat.com> | 2014-06-25 16:16:17 +0800 |
---|---|---|
committer | Milan Crha <mcrha@redhat.com> | 2014-06-25 16:16:17 +0800 |
commit | 6765ed10ff637c382031504b6dee647babea2375 (patch) | |
tree | 06792630f8ae029a625d809cc1395d9fc86b4136 | |
parent | ffc21b90eed0af55480eddc470053efd85f71f6c (diff) | |
download | gsoc2013-evolution-6765ed10ff637c382031504b6dee647babea2375.tar gsoc2013-evolution-6765ed10ff637c382031504b6dee647babea2375.tar.gz gsoc2013-evolution-6765ed10ff637c382031504b6dee647babea2375.tar.bz2 gsoc2013-evolution-6765ed10ff637c382031504b6dee647babea2375.tar.lz gsoc2013-evolution-6765ed10ff637c382031504b6dee647babea2375.tar.xz gsoc2013-evolution-6765ed10ff637c382031504b6dee647babea2375.tar.zst gsoc2013-evolution-6765ed10ff637c382031504b6dee647babea2375.zip |
Bug 607753 - Appointment tooltip sometimes 'stick' to screen
-rw-r--r-- | calendar/gui/e-calendar-view.c | 42 | ||||
-rw-r--r-- | calendar/gui/e-day-view.c | 6 | ||||
-rw-r--r-- | calendar/gui/e-week-view.c | 8 |
3 files changed, 42 insertions, 14 deletions
diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index f51506b0a7..1fac6e7855 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -1907,26 +1907,31 @@ e_calendar_view_send (ECalendarView *cal_view, g_object_unref (send_comp); } -static gboolean -tooltip_grab (GtkWidget *tooltip, - GdkEvent *key_event, - ECalendarView *view) +static void +tooltip_ungrab (ECalendarView *view, + guint32 event_time) { - GtkWidget *widget; GdkDevice *keyboard; - guint32 event_time; - - widget = g_object_get_data (G_OBJECT (view), "tooltip-window"); - if (widget == NULL) - return TRUE; - - event_time = gdk_event_get_time (key_event); while (!g_queue_is_empty (&view->priv->grabbed_keyboards)) { keyboard = g_queue_pop_head (&view->priv->grabbed_keyboards); gdk_device_ungrab (keyboard, event_time); g_object_unref (keyboard); } +} + +static gboolean +tooltip_key_event (GtkWidget *tooltip, + GdkEvent *key_event, + ECalendarView *view) +{ + GtkWidget *widget; + + widget = g_object_get_data (G_OBJECT (view), "tooltip-window"); + if (widget == NULL) + return TRUE; + + tooltip_ungrab (view, gdk_event_get_time (key_event)); gtk_widget_destroy (widget); g_object_set_data (G_OBJECT (view), "tooltip-window", NULL); @@ -1993,6 +1998,16 @@ e_calendar_view_move_tip (GtkWidget *widget, gtk_widget_show (widget); } +static void +tooltip_window_destroyed_cb (gpointer user_data, + GObject *gone) +{ + ECalendarView *view = user_data; + + tooltip_ungrab (view, GDK_CURRENT_TIME); + g_object_unref (view); +} + /* * It is expected to show the tooltips in this below format * @@ -2237,9 +2252,10 @@ e_calendar_view_get_tooltips (const ECalendarViewEventData *data) g_signal_connect ( pevent->tooltip, "key-press-event", - G_CALLBACK (tooltip_grab), data->cal_view); + G_CALLBACK (tooltip_key_event), data->cal_view); pevent->timeout = -1; + g_object_weak_ref (G_OBJECT (pevent->tooltip), tooltip_window_destroyed_cb, g_object_ref (data->cal_view)); g_object_set_data (G_OBJECT (data->cal_view), "tooltip-window", pevent->tooltip); g_object_unref (newcomp); diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 45bb8197e3..eb73b8a86e 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -465,6 +465,7 @@ static void e_day_view_queue_layout (EDayView *day_view); static void e_day_view_cancel_layout (EDayView *day_view); static gboolean e_day_view_layout_timeout_cb (gpointer data); static void tooltip_destroy (EDayView *day_view, GnomeCanvasItem *item); +static EDayViewEvent *tooltip_get_view_event (EDayView *day_view, gint day, gint event_num); enum { PROP_0, @@ -4488,7 +4489,10 @@ e_day_view_show_popup_menu (EDayView *day_view, gint day, gint event_num) { - tooltip_destroy (day_view, NULL); + EDayViewEvent *pevent = tooltip_get_view_event (day_view, day, event_num); + + if (pevent && pevent->canvas_item) + tooltip_destroy (day_view, pevent->canvas_item); day_view->popup_event_day = day; day_view->popup_event_num = event_num; diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index f3343d9e5d..93d40cdb35 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -4767,6 +4767,14 @@ e_week_view_show_popup_menu (EWeekView *week_view, GdkEvent *button_event, gint event_num) { + guint timeout; + + timeout = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (week_view), "tooltip-timeout")); + if (timeout) { + g_source_remove (timeout); + g_object_set_data (G_OBJECT (week_view), "tooltip-timeout", NULL); + } + week_view->popup_event_num = event_num; e_calendar_view_popup_event (E_CALENDAR_VIEW (week_view), button_event); |