]> Pileus Git - ~andy/gtk/commitdiff
chain up.
authorMichael Natterer <mitch@imendio.com>
Tue, 6 Feb 2007 12:11:33 +0000 (12:11 +0000)
committerMichael Natterer <mitch@src.gnome.org>
Tue, 6 Feb 2007 12:11:33 +0000 (12:11 +0000)
2007-02-06  Michael Natterer  <mitch@imendio.com>

* gtk/gtktooltip.c (gtk_tooltip_finalize): chain up.

(gtk_tooltip_show_tooltip): move variables and code to local
scope. Fixes warnings about maybe uninitialized variables.

svn path=/trunk/; revision=17265

ChangeLog
gtk/gtktooltip.c

index 0ff9c9aadf89bc51721b51c3ac09cb17738cd183..465f0da84116796af8c15fabcd3ffa37d31dd13d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2007-02-06  Michael Natterer  <mitch@imendio.com>
+
+       * gtk/gtktooltip.c (gtk_tooltip_finalize): chain up.
+
+       (gtk_tooltip_show_tooltip): move variables and code to local
+       scope. Fixes warnings about maybe uninitialized variables.
+
 2007-02-06  Kristian Rietveld  <kris@imendio.com>
 
        New tooltips API.
index 2e6f69a4f7ec28f6f49263c9453e6f294b28751b..17c3f242d9d2310ee7b88ea8a6556b6789fecb63 100644 (file)
@@ -180,6 +180,8 @@ gtk_tooltip_finalize (GObject *object)
                                            tooltip);
       gtk_widget_destroy (tooltip->window);
     }
+
+  G_OBJECT_CLASS (gtk_tooltip_parent_class)->finalize (object);
 }
 
 /* public API */
@@ -599,10 +601,7 @@ static void
 gtk_tooltip_show_tooltip (GdkDisplay *display)
 {
   gint x, y;
-  gint w, h;
-  gint monitor_num;
   GdkScreen *screen;
-  GdkRectangle monitor;
 
   GdkWindow *window;
   GtkWidget *tooltip_widget;
@@ -684,15 +683,6 @@ gtk_tooltip_show_tooltip (GdkDisplay *display)
       y += cursor_size / 2;
     }
 
-  if (tooltip->current_window)
-    {
-      GtkRequisition requisition;
-
-      gtk_widget_size_request (GTK_WIDGET (tooltip->current_window), &requisition);
-      w = requisition.width;
-      h = requisition.height;
-    }
-
   screen = gtk_widget_get_screen (tooltip_widget);
 
   if (screen != gtk_widget_get_screen (tooltip->window))
@@ -709,20 +699,27 @@ gtk_tooltip_show_tooltip (GdkDisplay *display)
 
   tooltip->tooltip_widget = tooltip_widget;
 
-  monitor_num = gdk_screen_get_monitor_at_point (screen, x, y);
-  gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
-
-  if (x + w > monitor.x + monitor.width)
-    x -= x - (monitor.x + monitor.width) + w;
-  else if (x < monitor.x)
-    x = monitor.x;
-
-  if (y + h > monitor.y + monitor.height)
-    y -= y - (monitor.y + monitor.height) + h;
-
   /* Show it */
   if (tooltip->current_window)
     {
+      gint monitor_num;
+      GdkRectangle monitor;
+      GtkRequisition requisition;
+
+      gtk_widget_size_request (GTK_WIDGET (tooltip->current_window),
+                               &requisition);
+
+      monitor_num = gdk_screen_get_monitor_at_point (screen, x, y);
+      gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
+
+      if (x + requisition.width > monitor.x + monitor.width)
+        x -= x - (monitor.x + monitor.width) + requisition.width;
+      else if (x < monitor.x)
+        x = monitor.x;
+
+      if (y + requisition.height > monitor.y + monitor.height)
+        y -= y - (monitor.y + monitor.height) + requisition.height;
+
       gtk_window_move (GTK_WINDOW (tooltip->current_window), x, y);
       gtk_widget_show (GTK_WIDGET (tooltip->current_window));
     }