From 3c65aade6f8cc5cddc9c455cce7143453e3ec583 Mon Sep 17 00:00:00 2001 From: Michael Natterer Date: Tue, 6 Feb 2007 12:11:33 +0000 Subject: [PATCH] chain up. 2007-02-06 Michael Natterer * 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 | 7 +++++++ gtk/gtktooltip.c | 43 ++++++++++++++++++++----------------------- 2 files changed, 27 insertions(+), 23 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0ff9c9aadf..465f0da841 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2007-02-06 Michael Natterer + + * 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 New tooltips API. diff --git a/gtk/gtktooltip.c b/gtk/gtktooltip.c index 2e6f69a4f7..17c3f242d9 100644 --- a/gtk/gtktooltip.c +++ b/gtk/gtktooltip.c @@ -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)); }