[evolution-patches] [Calendar] Fix for Bug # 326434



Hi
Added code to
*gui/e-calendar-view.c
*gui/e-week-view.c
*gui/e-day-view.c
 
to display tooltip maximally visible wherever placed on screen.

Rajeev


Yahoo! Autos. Looking for a sweet ride? Get pricing, reviews, & more on new and used cars.
Index: gui/e-calendar-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-calendar-view.c,v
retrieving revision 1.114
diff -u -p -r1.114 e-calendar-view.c
--- gui/e-calendar-view.c	23 Jan 2006 06:45:03 -0000	1.114
+++ gui/e-calendar-view.c	2 Feb 2006 04:34:58 -0000
@@ -1995,6 +1995,7 @@ e_calendar_view_get_tooltips (ECalendarV
 	GtkWidget *widget = (GtkWidget *) g_object_get_data (data->cal_view, "tooltip-window");
 	ECalComponent *newcomp = e_cal_component_new ();
 	icaltimezone *zone;	
+	int screen_width, width;
 
 	/* Delete any stray tooltip if left */
 	if (widget)
@@ -2112,6 +2113,15 @@ e_calendar_view_get_tooltips (ECalendarV
 	gtk_container_add ((GtkContainer *)pevent->tooltip, frame);
 			
 	gtk_widget_show_all (pevent->tooltip);	
+
+	screen_width = gdk_screen_width();
+	width = ((GtkWidget *)pevent->tooltip)->allocation.width;
+	
+	if(pevent ->tooltip) {
+		if((width + pevent->x) >= screen_width)
+			gtk_window_move ((GtkWindow *)pevent->tooltip, screen_width-width, 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;
Index: gui/e-day-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-day-view.c,v
retrieving revision 1.293
diff -u -p -r1.293 e-day-view.c
--- gui/e-day-view.c	16 Jan 2006 12:59:43 -0000	1.293
+++ gui/e-day-view.c	2 Feb 2006 04:35:13 -0000
@@ -5948,6 +5948,9 @@ e_day_view_on_text_item_event (GnomeCanv
 			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, "event-day"));
+			int screen_width = gdk_screen_width();						
+			int width = 0;
+			GtkRequisition request;
 
 			pevent = tooltip_get_view_event (day_view, day, event_num);
 						
@@ -5956,7 +5959,14 @@ e_day_view_on_text_item_event (GnomeCanv
 			pevent->tooltip = (GtkWidget *)g_object_get_data (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);
+				gtk_widget_size_request(pevent->tooltip, &request);
+				width = request.width;
+
+			if((width + pevent->x) <= screen_width)
+					gtk_window_move ((GtkWindow *)pevent->tooltip, ((int)((GdkEventMotion *)event)->x_root)+16, ((int)((GdkEventMotion *)event)->y_root) +16);
+				else
+					gtk_window_move ((GtkWindow *)pevent->tooltip, screen_width-width, ((int)
+((GdkEventMotion *)event)->y_root)+16);
 			}
 
 			return TRUE;
Index: gui/e-week-view.c
===================================================================
RCS file: /cvs/gnome/evolution/calendar/gui/e-week-view.c,v
retrieving revision 1.256
diff -u -p -r1.256 e-week-view.c
--- gui/e-week-view.c	30 Jan 2006 14:36:33 -0000	1.256
+++ gui/e-week-view.c	2 Feb 2006 04:35:23 -0000
@@ -2619,7 +2619,6 @@ tooltip_event_cb (GnomeCanvasItem *item,
 			pevent->x = ((GdkEventMotion *)event)->x_root;
 			pevent->y = ((GdkEventMotion *)event)->y_root;
 			pevent->tooltip = (GtkWidget *)g_object_get_data (view, "tooltip-window");
-			
 			if (pevent->tooltip) {
 				gtk_window_move ((GtkWindow *)pevent->tooltip, ((int)((GdkEventMotion *)event)->x_root)+16, ((int)((GdkEventMotion *)event)->y_root) +16);
 			}
@@ -3036,6 +3035,9 @@ e_week_view_on_text_item_event (GnomeCan
 	gint event_num, span_num;
 	int nevent = GPOINTER_TO_INT (g_object_get_data (item, "event-num"));
 	EWeekViewEvent *pevent;
+	int screen_width = gdk_screen_width();						
+	int width = 0;
+	GtkRequisition request;
 	
 	pevent = tooltip_get_view_event (week_view, -1, nevent);
 
@@ -3194,9 +3196,16 @@ e_week_view_on_text_item_event (GnomeCan
 		pevent->y = ((GdkEventMotion *)gdkevent)->y_root;
 		pevent->tooltip = (GtkWidget *)g_object_get_data (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) {
+			gtk_widget_size_request(pevent->tooltip, &request);
+			width = request.width;
+			
+			if((width + pevent->x) <= screen_width)
+				gtk_window_move ((GtkWindow *)pevent->tooltip, ((int)((GdkEventMotion *)gdkevent)->x_root)+16, ((int)((GdkEventMotion *)gdkevent)->y_root) +16);
+			else
+				gtk_window_move ((GtkWindow *)pevent->tooltip, screen_width-width, ((int)
+((GdkEventMotion *)gdkevent)->y_root)+16);
+		}
 		return TRUE;		
 	case GDK_FOCUS_CHANGE:
 		if (gdkevent->focus_change.in) {
Index: ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/calendar/ChangeLog,v
retrieving revision 1.2963
diff -u -p -r1.2963 ChangeLog
--- ChangeLog	27 Jan 2006 19:39:44 -0000	1.2963
+++ ChangeLog	2 Feb 2006 04:35:37 -0000
@@ -1,3 +1,12 @@
+2006-02-01  Rajeev ramanathan <rajeevramanathan_2004 yahoo co in>
+
+	** Fixes Bug #326434
+
+	* gui/e-day-view.c : (e_day_view_on_text_item_event)
+	* gui/e-calendar-view.c : (e_calendar_view_get_tooltips)  Calculated 
+	Width of the tooltip widget and used it with X-position of mouse to 
+	display tooltip 	maximally visible whereever placed in the screen 
+	
 2006-01-28  Rajeev ramanathan <rajeevramanathan_2004 yahoo co in>
 
 	** Fixes bug #328510, #328885


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]