From b14590968a2d3fe382797c608046afdeb93538b8 Mon Sep 17 00:00:00 2001 From: Jon Trowbridge Date: Tue, 30 Oct 2001 01:05:17 +0000 Subject: Added. Makes our popup window a transient of the toplevel. 2001-10-29 Jon Trowbridge * gal/e-text/e-entry.c (e_entry_make_completion_window_transient): Added. Makes our popup window a transient of the toplevel. (e_entry_enable_completion_full): Try to make our popup a transient. (e_entry_realize): Also try to make our popup a transient here, in case the entry wasn't packed before we enabled completion. This is all an attempt to fix bug #13791. svn path=/trunk/; revision=14390 --- widgets/text/e-entry.c | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'widgets') diff --git a/widgets/text/e-entry.c b/widgets/text/e-entry.c index 10f5fd8e2a..47bbca0079 100644 --- a/widgets/text/e-entry.c +++ b/widgets/text/e-entry.c @@ -129,6 +129,7 @@ struct _EEntryPrivate { guint draw_borders : 1; guint emulate_label_resize : 1; + guint have_set_transient : 1; gint last_width; }; @@ -750,6 +751,25 @@ key_release_cb (GtkWidget *w, GdkEventKey *ev, gpointer user_data) return rv; } +static void +e_entry_make_completion_window_transient (EEntry *entry) +{ + GtkWidget *w; + + if (entry->priv->have_set_transient || entry->priv->completion_view_popup == NULL) + return; + + w = GTK_WIDGET (entry)->parent; + while (w && ! GTK_IS_WINDOW (w)) + w = w->parent; + + if (w) { + gtk_window_set_transient_for (GTK_WINDOW (entry->priv->completion_view_popup), + GTK_WINDOW (w)); + entry->priv->have_set_transient = 1; + } +} + void e_entry_enable_completion_full (EEntry *entry, ECompletion *completion, gint delay, EEntryCompletionHandler handler) { @@ -808,6 +828,8 @@ e_entry_enable_completion_full (EEntry *entry, ECompletion *completion, gint del entry->priv->completion_view_popup = gtk_window_new (GTK_WINDOW_POPUP); + e_entry_make_completion_window_transient (entry); + gtk_signal_connect (GTK_OBJECT (entry->item->model), "cancel_completion", GTK_SIGNAL_FUNC (cancel_completion_cb), @@ -1215,6 +1237,8 @@ e_entry_realize (GtkWidget *widget) entry = E_ENTRY (widget); + e_entry_make_completion_window_transient (entry); + if (entry->priv->emulate_label_resize) { d(g_print("%s: queue_resize\n", __FUNCTION__)); gtk_widget_queue_resize (GTK_WIDGET (entry->canvas)); -- cgit v1.2.3