Multihead safety fixes, handle displays being closed. (#81651, based on

Tue Oct 22 16:37:12 2002  Owen Taylor  <otaylor@redhat.com>

        * gtk/gtktooltips.c: Multihead safety fixes, handle
        displays being closed. (#81651, based on patch
        from Erwann Chenede)

        * gtk/gtktoolbar.c (gtk_toolbar_init): Fix typo
        from the last commit.
This commit is contained in:
Owen Taylor 2002-10-22 21:05:47 +00:00 committed by Owen Taylor
parent 8042766f6a
commit f1b8a1ce57
8 changed files with 115 additions and 5 deletions

View File

@ -1,3 +1,12 @@
Tue Oct 22 16:37:12 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.c: Multihead safety fixes, handle
displays being closed. (#81651, based on patch
from Erwann Chenede)
* gtk/gtktoolbar.c (gtk_toolbar_init): Fix typo
from the last commit.
Tue Oct 22 15:55:08 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c: Fix handling of getting the

View File

@ -1,3 +1,12 @@
Tue Oct 22 16:37:12 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.c: Multihead safety fixes, handle
displays being closed. (#81651, based on patch
from Erwann Chenede)
* gtk/gtktoolbar.c (gtk_toolbar_init): Fix typo
from the last commit.
Tue Oct 22 15:55:08 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c: Fix handling of getting the

View File

@ -1,3 +1,12 @@
Tue Oct 22 16:37:12 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.c: Multihead safety fixes, handle
displays being closed. (#81651, based on patch
from Erwann Chenede)
* gtk/gtktoolbar.c (gtk_toolbar_init): Fix typo
from the last commit.
Tue Oct 22 15:55:08 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c: Fix handling of getting the

View File

@ -1,3 +1,12 @@
Tue Oct 22 16:37:12 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.c: Multihead safety fixes, handle
displays being closed. (#81651, based on patch
from Erwann Chenede)
* gtk/gtktoolbar.c (gtk_toolbar_init): Fix typo
from the last commit.
Tue Oct 22 15:55:08 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c: Fix handling of getting the

View File

@ -1,3 +1,12 @@
Tue Oct 22 16:37:12 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.c: Multihead safety fixes, handle
displays being closed. (#81651, based on patch
from Erwann Chenede)
* gtk/gtktoolbar.c (gtk_toolbar_init): Fix typo
from the last commit.
Tue Oct 22 15:55:08 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c: Fix handling of getting the

View File

@ -1,3 +1,12 @@
Tue Oct 22 16:37:12 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtktooltips.c: Multihead safety fixes, handle
displays being closed. (#81651, based on patch
from Erwann Chenede)
* gtk/gtktoolbar.c (gtk_toolbar_init): Fix typo
from the last commit.
Tue Oct 22 15:55:08 2002 Owen Taylor <otaylor@redhat.com>
* gtk/gtktoolbar.c: Fix handling of getting the

View File

@ -406,7 +406,7 @@ gtk_toolbar_init (GtkToolbar *toolbar)
toolbar->children = NULL;
toolbar->orientation = GTK_ORIENTATION_HORIZONTAL;
toolbar->icon_size = DEFAULT_ICON_SIZE;
toolbar->style = DEFAUL_TOOLBAR_STYLE;
toolbar->style = DEFAULT_TOOLBAR_STYLE;
toolbar->tooltips = gtk_tooltips_new ();
g_object_ref (toolbar->tooltips);
gtk_object_sink (GTK_OBJECT (toolbar->tooltips));

View File

@ -62,6 +62,7 @@ static gint gtk_tooltips_timeout (gpointer data);
static gint gtk_tooltips_paint_window (GtkTooltips *tooltips);
static void gtk_tooltips_draw_tips (GtkTooltips *tooltips);
static void gtk_tooltips_unset_tip_window (GtkTooltips *tooltips);
static gboolean get_keyboard_mode (GtkWidget *widget);
@ -149,6 +150,34 @@ gtk_tooltips_destroy_data (GtkTooltipsData *tooltipsdata)
g_free (tooltipsdata);
}
static void
tip_window_display_closed (GdkDisplay *display,
gboolean was_error,
GtkTooltips *tooltips)
{
gtk_tooltips_unset_tip_window (tooltips);
}
static void
disconnect_tip_window_display_closed (GtkTooltips *tooltips)
{
g_signal_handlers_disconnect_by_func (gtk_widget_get_display (tooltips->tip_window),
(gpointer) tip_window_display_closed,
tooltips);
}
static void
gtk_tooltips_unset_tip_window (GtkTooltips *tooltips)
{
if (tooltips->tip_window)
{
disconnect_tip_window_display_closed (tooltips);
gtk_widget_destroy (tooltips->tip_window);
tooltips->tip_window = NULL;
}
}
static void
gtk_tooltips_destroy (GtkObject *object)
{
@ -175,8 +204,34 @@ gtk_tooltips_destroy (GtkObject *object)
}
}
if (tooltips->tip_window)
gtk_widget_destroy (tooltips->tip_window);
gtk_tooltips_unset_tip_window (tooltips);
}
static void
gtk_tooltips_update_screen (GtkTooltips *tooltips,
gboolean new_window)
{
gboolean screen_changed = FALSE;
if (tooltips->active_tips_data->widget)
{
GdkScreen *screen = gtk_widget_get_screen (tooltips->active_tips_data->widget);
screen_changed = (screen != gtk_widget_get_screen (tooltips->tip_window));
if (screen_changed)
{
if (!new_window)
disconnect_tip_window_display_closed (tooltips);
gtk_window_set_screen (GTK_WINDOW (tooltips->tip_window), screen);
}
}
if (screen_changed || new_window)
g_signal_connect (gtk_widget_get_display (tooltips->tip_window), "closed",
G_CALLBACK (tip_window_display_closed), tooltips);
}
void
@ -187,8 +242,7 @@ gtk_tooltips_force_window (GtkTooltips *tooltips)
if (!tooltips->tip_window)
{
tooltips->tip_window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_window_set_screen (GTK_WINDOW (tooltips->tip_window),
gtk_widget_get_screen (tooltips->active_tips_data->widget));
gtk_tooltips_update_screen (tooltips, TRUE);
gtk_widget_set_app_paintable (tooltips->tip_window, TRUE);
gtk_window_set_resizable (GTK_WINDOW (tooltips->tip_window), FALSE);
gtk_widget_set_name (tooltips->tip_window, "gtk-tooltips");
@ -352,6 +406,8 @@ gtk_tooltips_draw_tips (GtkTooltips *tooltips)
keyboard_mode = get_keyboard_mode (widget);
gtk_tooltips_update_screen (tooltips, FALSE);
screen = gtk_widget_get_screen (widget);
scr_w = gdk_screen_get_width (screen);
scr_h = gdk_screen_get_height (screen);