diff options
author | Srinivasa Ragavan <sragavan@novell.com> | 2006-01-04 00:07:42 +0800 |
---|---|---|
committer | Srinivasa Ragavan <sragavan@src.gnome.org> | 2006-01-04 00:07:42 +0800 |
commit | 6e64033d4c4c4728e21a686a251aafed65440b69 (patch) | |
tree | ee1fb12f70bdbd22e71f3e21a4737743c78d3916 /calendar/gui/e-day-view.c | |
parent | 89b91db3e37442bc6dd40ceace65940b4639b147 (diff) | |
download | gsoc2013-evolution-6e64033d4c4c4728e21a686a251aafed65440b69.tar.gz gsoc2013-evolution-6e64033d4c4c4728e21a686a251aafed65440b69.tar.zst gsoc2013-evolution-6e64033d4c4c4728e21a686a251aafed65440b69.zip |
** Fix for bug #325416
2006-01-03 Srinivasa Ragavan <sragavan@novell.com>
** Fix for bug #325416
* gui/e-day-view.c: (e_day_view_convert_event_coords),
(tooltip_get_view_event), (tooltip_destroy),
(e_day_view_on_text_item_event): Read the event num from the position
of x,y.
svn path=/trunk/; revision=31039
Diffstat (limited to 'calendar/gui/e-day-view.c')
-rw-r--r-- | calendar/gui/e-day-view.c | 41 |
1 files changed, 33 insertions, 8 deletions
diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 3288559b11..fa1e826443 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -2835,6 +2835,12 @@ e_day_view_convert_event_coords (EDayView *day_view, event_y = event->motion.y; event_window = event->motion.window; break; + case GDK_ENTER_NOTIFY: + case GDK_LEAVE_NOTIFY: + event_x = event->crossing.x; + event_y = event->crossing.y; + event_window = event->crossing.window; + break; default: /* Shouldn't get here. */ g_assert_not_reached (); @@ -5777,7 +5783,6 @@ tooltip_get_view_event (EDayView *day_view, int day, int event_num) { EDayViewEvent *pevent; - if (day == E_DAY_VIEW_LONG_EVENT) { pevent = &g_array_index (day_view->long_events, EDayViewEvent, event_num); @@ -5792,9 +5797,9 @@ tooltip_get_view_event (EDayView *day_view, int day, int event_num) static void tooltip_destroy (EDayView *day_view, GnomeCanvasItem *item) { - int day = GPOINTER_TO_INT (g_object_get_data (item, "event-day")); - int event_num = GPOINTER_TO_INT (g_object_get_data (item, "event-num")); EDayViewEvent *pevent; + int event_num = GPOINTER_TO_INT(g_object_get_data ((GObject *)item, "event-num")); + int day = GPOINTER_TO_INT(g_object_get_data ((GObject *)item, "day")); pevent = tooltip_get_view_event (day_view, day, event_num); if (pevent) { @@ -5874,12 +5879,32 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item, return FALSE; case GDK_ENTER_NOTIFY: { - int day = GPOINTER_TO_INT (g_object_get_data (item, "event-day")); - int event_num = GPOINTER_TO_INT (g_object_get_data (item, "event-num")); EDayViewEvent *pevent; ECalendarViewEventData *data; - + gint event_x, event_y, row, day, event_num; + ECalendarViewPosition pos; + + + /* Convert the coords to the main canvas window, or return if the + window is not found. */ + if (!e_day_view_convert_event_coords (day_view, (GdkEvent*) event, + GTK_LAYOUT (day_view->main_canvas)->bin_window, + &event_x, &event_y)) { + + return FALSE; + } + /* Find out where the mouse is. */ + pos = e_day_view_convert_position_in_main_canvas (day_view, + event_x, event_y, + &day, &row, + &event_num); + + if (pos == E_CALENDAR_VIEW_POS_OUTSIDE) + return FALSE; + pevent = tooltip_get_view_event (day_view, day, event_num); + g_object_set_data (item, "event-num", GINT_TO_POINTER (event_num)); + g_object_set_data (item, "event-day", GINT_TO_POINTER (day)); data = g_malloc (sizeof (ECalendarViewEventData)); pevent->x = ((GdkEventCrossing *)event)->x_root; @@ -5899,9 +5924,9 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item, return TRUE; case GDK_MOTION_NOTIFY: { - int day = GPOINTER_TO_INT (g_object_get_data (item, "event-day")); - int event_num = GPOINTER_TO_INT (g_object_get_data (item, "event-num")); EDayViewEvent *pevent; + int event_num = GPOINTER_TO_INT(g_object_get_data ((GObject *)item, "event-num")); + int day = GPOINTER_TO_INT(g_object_get_data ((GObject *)item, "day")); pevent = tooltip_get_view_event (day_view, day, event_num); |