[gnumeric] place the function tooltip correctly



commit 9cc48eecd6882abb4b73ca0b07a1b49b19e6716c
Author: Andreas J Guelzow <aguelzow pyrshep ca>
Date:   Wed Jun 16 00:44:43 2010 -0600

    place the function tooltip correctly
    
    2010-06-16 Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* configure.in: check for gtk_widget_get_allocation
    	* src/dead-kittens.h (gtk_widget_get_allocation): new
    
    2010-06-16  Andreas J. Guelzow <aguelzow pyrshep ca>
    
    	* gnumeric-expr-entry.c (gee_create_tooltip): place the
    	  tooltip correctly

 ChangeLog                         |    5 +++++
 configure.in                      |    2 +-
 src/dead-kittens.h                |    5 +++++
 src/widgets/ChangeLog             |    5 +++++
 src/widgets/gnumeric-expr-entry.c |   15 +++++++--------
 5 files changed, 23 insertions(+), 9 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index ff4de84..5f1f542 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2010-06-16 Andreas J. Guelzow <aguelzow pyrshep ca>
 
+	* configure.in: check for gtk_widget_get_allocation
+	* src/dead-kittens.h (gtk_widget_get_allocation): new
+
+2010-06-16 Andreas J. Guelzow <aguelzow pyrshep ca>
+
 	* src/GNOME_Gnumeric-gtk.xml.in: add new menu items
 	* src/HILDON_Gnumeric-gtk.xml.in: ditto
 	* component/Gnumeric-embed.xml.in: ditto
diff --git a/configure.in b/configure.in
index 0745f04..2c9eb03 100644
--- a/configure.in
+++ b/configure.in
@@ -689,7 +689,7 @@ LIBS="$GNUMERIC_LIBS $LIBS"
 
 AC_CHECK_FUNCS(g_date_set_time_t g_slice_alloc g_option_context_set_delocalize)
 AC_CHECK_FUNCS(pango_font_map_create_context)
-AC_CHECK_FUNCS(gtk_orientable_set_orientation gtk_adjustment_configure gtk_widget_set_visible gtk_widget_get_state gtk_widget_is_toplevel gtk_widget_get_window gsf_open_pkg_foreach_rel gtk_dialog_get_content_area gtk_entry_get_buffer gtk_widget_get_can_focus gtk_entry_get_text_length gtk_entry_set_icon_from_stock gtk_layout_get_bin_window)
+AC_CHECK_FUNCS(gtk_orientable_set_orientation gtk_adjustment_configure gtk_widget_set_visible gtk_widget_get_state gtk_widget_is_toplevel gtk_widget_get_window gsf_open_pkg_foreach_rel gtk_dialog_get_content_area gtk_entry_get_buffer gtk_widget_get_can_focus gtk_entry_get_text_length gtk_entry_set_icon_from_stock gtk_layout_get_bin_window gtk_widget_get_allocation)
 AC_CHECK_FUNCS(gsf_infile_msvba_steal_modules)
 
 AC_MSG_CHECKING([for PANGO_WEIGHT_THIN etc.])
diff --git a/src/dead-kittens.h b/src/dead-kittens.h
index d2b1f7b..0d12d25 100644
--- a/src/dead-kittens.h
+++ b/src/dead-kittens.h
@@ -27,4 +27,9 @@
 #define gtk_widget_get_window(w) ((w)->window)
 #endif
 
+#ifndef HAVE_GTK_WIDGET_GET_ALLOCATION
+#define gtk_widget_get_allocation(w,a) (*(a) = (w)->allocation)
+#endif
+
+
 #endif
diff --git a/src/widgets/ChangeLog b/src/widgets/ChangeLog
index a2bc58f..721ffeb 100644
--- a/src/widgets/ChangeLog
+++ b/src/widgets/ChangeLog
@@ -1,3 +1,8 @@
+2010-06-16  Andreas J. Guelzow <aguelzow pyrshep ca>
+
+	* gnumeric-expr-entry.c (gee_create_tooltip): place the
+	  tooltip correctly
+
 2010-06-15  Andreas J. Guelzow <aguelzow pyrshep ca>
 
 	* gnumeric-expr-entry.c (gee_create_tooltip): set tooltip
diff --git a/src/widgets/gnumeric-expr-entry.c b/src/widgets/gnumeric-expr-entry.c
index 1639823..b4ed0b8 100644
--- a/src/widgets/gnumeric-expr-entry.c
+++ b/src/widgets/gnumeric-expr-entry.c
@@ -615,9 +615,9 @@ gee_create_tooltip (GnmExprEntry *gee, gchar const *str)
 	GtkTextBuffer *buffer;
 	GtkWindow *toplevel;
 	GdkScreen *screen;
-	gint dest_x = 0, dest_y = 0;
 	gint root_x = 0, root_y = 0;
-	GtkRequisition requisition;
+	GtkAllocation allocation;
+	GdkWindow *gdkw;
 
 	toplevel = GTK_WINDOW (gtk_widget_get_toplevel 
 			       (GTK_WIDGET (gee->entry)));
@@ -630,20 +630,19 @@ gee_create_tooltip (GnmExprEntry *gee, gchar const *str)
 	
 	screen = gtk_window_get_screen (toplevel);
 	
-	gtk_widget_size_request (GTK_WIDGET (gee->entry), &requisition);
-	gtk_widget_translate_coordinates    
-		(GTK_WIDGET (gee->entry), GTK_WIDGET (toplevel),
-		 0, 2 * requisition.height, &dest_x, &dest_y);
-	gtk_window_get_position (toplevel, &root_x, &root_y);
+	gdkw = gtk_widget_get_window (GTK_WIDGET (gee->entry));
+	gdk_window_get_origin (gdkw, &root_x, &root_y);
+	gtk_widget_get_allocation (GTK_WIDGET (gee->entry), &allocation);
 
 	tip = gtk_window_new (GTK_WINDOW_POPUP);
 	gtk_window_set_type_hint (GTK_WINDOW (tip),
 				  GDK_WINDOW_TYPE_HINT_TOOLTIP);
 	gtk_window_set_resizable (GTK_WINDOW (tip), FALSE);
 	gtk_widget_set_name (tip, "gnumeric-tooltip");
+	gtk_window_set_gravity (GTK_WINDOW (tip), GDK_GRAVITY_NORTH_WEST);
 	
 	gtk_window_set_screen (GTK_WINDOW (tip), screen);
-	gtk_window_move (GTK_WINDOW (tip), root_x + dest_x, root_y + dest_y);
+	gtk_window_move (GTK_WINDOW (tip), root_x, root_y + allocation.height);
 
 	text = gtk_text_view_new ();
 	gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (text), GTK_WRAP_NONE);



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