diff options
Diffstat (limited to 'calendar')
-rw-r--r-- | calendar/ChangeLog | 11 | ||||
-rw-r--r-- | calendar/gui/e-calendar-view.c | 41 | ||||
-rw-r--r-- | calendar/gui/e-day-view.c | 2 | ||||
-rw-r--r-- | calendar/gui/e-week-view.c | 8 |
4 files changed, 57 insertions, 5 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 2e801c8e97..848ade1860 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,5 +1,16 @@ 2006-04-22 Srinivasa Ragavan <sragavan@novell.com> + ** Fixes bug #326434 + + * gui/e-calendar-view.c: (e_calendar_view_move_tip), + (e_calendar_view_get_tooltips): Added New function to move tooltip + with respect to screen size. + * gui/e-day-view.c: (e_day_view_on_text_item_event): move the tooltip + * gui/e-week-view.c: (tooltip_event_cb), + (e_week_view_on_text_item_event): Move the tooltip + +2006-04-22 Srinivasa Ragavan <sragavan@novell.com> + Rewrite of Alarm daemon with EThread to make it thread safe. It also fixes a lot of random crashes. diff --git a/calendar/gui/e-calendar-view.c b/calendar/gui/e-calendar-view.c index 0fb1ad8abe..d612dc1432 100644 --- a/calendar/gui/e-calendar-view.c +++ b/calendar/gui/e-calendar-view.c @@ -2068,6 +2068,44 @@ get_label (struct icaltimetype *tt) return g_strdup (buffer); } +void +e_calendar_view_move_tip (GtkWidget *widget, int x, int y) +{ + GtkRequisition requisition; + gint w, h; + GdkScreen *screen; + GdkScreen *pointer_screen; + gint monitor_num, px, py; + GdkRectangle monitor; + + screen = gtk_widget_get_screen (widget); + + gtk_widget_size_request (widget, &requisition); + w = requisition.width; + h = requisition.height; + + gdk_display_get_pointer (gdk_screen_get_display (screen), + &pointer_screen, &px, &py, NULL); + if (pointer_screen != screen) + { + px = x; + py = y; + } + monitor_num = gdk_screen_get_monitor_at_point (screen, px, py); + gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); + + if ((x + w) > monitor.x + monitor.width) + x -= (x + w) - (monitor.x + monitor.width); + else if (x < monitor.x) + x = monitor.x; + + if ((y + h + widget->allocation.height + 4) > monitor.y + monitor.height) + y = y - h - 36; + + gtk_window_move (GTK_WINDOW (widget), x, y); + gtk_widget_show (widget); +} + /* * It is expected to show the tooltips in this below format * @@ -2209,6 +2247,9 @@ e_calendar_view_get_tooltips (ECalendarViewEventData *data) gtk_container_add ((GtkContainer *)pevent->tooltip, frame); gtk_widget_show_all (pevent->tooltip); + + e_calendar_view_move_tip (pevent->tooltip, pevent->x +16, pevent->y+16); + gdk_keyboard_grab (pevent->tooltip->window, FALSE, GDK_CURRENT_TIME); g_signal_connect (pevent->tooltip, "key-press-event", G_CALLBACK (tooltip_grab), data->cal_view); pevent->timeout = -1; diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index 34fa4c2ad3..f58502946d 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -5893,7 +5893,7 @@ e_day_view_on_text_item_event (GnomeCanvasItem *item, pevent->tooltip = (GtkWidget *)g_object_get_data (G_OBJECT (day_view), "tooltip-window"); if (pevent->tooltip) { - gtk_window_move ((GtkWindow *)pevent->tooltip, ((int)((GdkEventMotion *)event)->x_root)+16, ((int)((GdkEventMotion *)event)->y_root) +16); + e_calendar_view_move_tip (pevent->tooltip, pevent->x+16, pevent->y+16); } return TRUE; diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index ccfde3af78..cc2f88a385 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -2554,7 +2554,7 @@ tooltip_event_cb (GnomeCanvasItem *item, pevent->tooltip = (GtkWidget *)g_object_get_data (G_OBJECT (view), "tooltip-window"); if (pevent->tooltip) { - gtk_window_move ((GtkWindow *)pevent->tooltip, ((int)((GdkEventMotion *)event)->x_root)+16, ((int)((GdkEventMotion *)event)->y_root) +16); + e_calendar_view_move_tip (pevent->tooltip, pevent->x+16, pevent->y+16); } return TRUE; @@ -3125,9 +3125,9 @@ e_week_view_on_text_item_event (GnomeCanvasItem *item, pevent->y = ((GdkEventMotion *)gdkevent)->y_root; pevent->tooltip = (GtkWidget *)g_object_get_data (G_OBJECT (week_view), "tooltip-window"); - if (pevent->tooltip) - gtk_window_move ((GtkWindow *)pevent->tooltip, ((int)((GdkEventMotion *)gdkevent)->x_root)+16, ((int)((GdkEventMotion *)gdkevent)->y_root) +16); - + if (pevent->tooltip) { + e_calendar_view_move_tip (pevent->tooltip, pevent->x+16, pevent->y+16); + } return TRUE; case GDK_FOCUS_CHANGE: if (gdkevent->focus_change.in) { |