void _gtk_tooltip_focus_in (GtkWidget *widget) { gint x, y; gboolean return_value = FALSE; GdkDisplay *display; GtkTooltip *tooltip; GdkDevice *device; /* Get current tooltip for this display */ display = gtk_widget_get_display (widget); tooltip = g_object_get_data (G_OBJECT (display), "gdk-display-current-tooltip"); /* Check if keyboard mode is enabled at this moment */ if (!tooltip || !tooltip->keyboard_mode_enabled) return; device = gtk_get_current_event_device (); if (device && gdk_device_get_source (device) == GDK_SOURCE_KEYBOARD) device = gdk_device_get_associated_device (device); /* This function should be called by either a focus in event, * or a key binding. In either case there should be a device. */ if (!device) return; if (tooltip->keyboard_widget) g_object_unref (tooltip->keyboard_widget); tooltip->keyboard_widget = g_object_ref (widget); gdk_window_get_device_position (gtk_widget_get_window (widget), device, &x, &y, NULL); return_value = gtk_tooltip_run_requery (&widget, tooltip, &x, &y); if (!return_value) { gtk_tooltip_hide_tooltip (tooltip); return; } if (!tooltip->current_window) { if (gtk_widget_get_tooltip_window (widget)) tooltip->current_window = gtk_widget_get_tooltip_window (widget); else tooltip->current_window = GTK_WINDOW (GTK_TOOLTIP (tooltip)->window); } gtk_tooltip_show_tooltip (display); }
void _gtk_tooltip_focus_in (GtkWidget *widget) { gint x, y; gboolean return_value = FALSE; GdkDisplay *display; GtkTooltip *tooltip; /* Get current tooltip for this display */ display = gtk_widget_get_display (widget); tooltip = g_object_get_data (G_OBJECT (display), "gdk-display-current-tooltip"); /* Check if keyboard mode is enabled at this moment */ if (!tooltip || !tooltip->keyboard_mode_enabled) return; if (tooltip->keyboard_widget) g_object_unref (tooltip->keyboard_widget); tooltip->keyboard_widget = g_object_ref (widget); gdk_window_get_pointer (widget->window, &x, &y, NULL); return_value = gtk_tooltip_run_requery (&widget, tooltip, &x, &y); if (!return_value) { gtk_tooltip_hide_tooltip (tooltip); return; } if (!tooltip->current_window) { if (gtk_widget_get_tooltip_window (widget)) tooltip->current_window = gtk_widget_get_tooltip_window (widget); else tooltip->current_window = GTK_WINDOW (GTK_TOOLTIP (tooltip)->window); } gtk_tooltip_show_tooltip (display); }
static gint tooltip_popup_timeout (gpointer data) { GdkDisplay *display; GtkTooltip *tooltip; display = GDK_DISPLAY (data); tooltip = g_object_get_qdata (G_OBJECT (display), quark_current_tooltip); /* This usually does not happen. However, it does occur in language * bindings were reference counting of objects behaves differently. */ if (!tooltip) return FALSE; gtk_tooltip_show_tooltip (display); tooltip->timeout_id = 0; return FALSE; }