GNOME Bugzilla – Bug 81651
Tooltips is not multihead safe.
Last modified: 2011-02-04 16:11:52 UTC
mozilla with gtk+ 2.1 coredump on startup See http://bugzilla.mozilla.org/show_bug.cgi?id=140698 for details. Here is a small patch to fix the problem : Index: gtk/gtktooltips.c =================================================================== RCS file: /cvs/gnome/gtk+/gtk/gtktooltips.c,v retrieving revision 1.50 diff -u -r1.50 gtktooltips.c --- gtk/gtktooltips.c 29 Apr 2002 22:53:39 -0000 1.50 +++ gtk/gtktooltips.c 13 May 2002 15:26:59 -0000 @@ -174,8 +174,9 @@ 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)); + if (tooltips->active_tips_data) + gtk_window_set_screen (GTK_WINDOW (tooltips->tip_window), + gtk_widget_get_screen (tooltips->active_tips_data->widget)); gtk_widget_set_app_paintable (tooltips->tip_window, TRUE); gtk_window_set_policy (GTK_WINDOW (tooltips->tip_window), FALSE, FALSE, TRUE); gtk_widget_set_name (tooltips->tip_window, "gtk-tooltips"); Can I commit ?
One of the notes I have from my merge and that I haven't had a chance to writeup/ put into bugzilla yet is that GtkTooltips is not multihead safe. Every time the current widget changes, the code needs to move the tips window to the screen for that widget if necessary. (The code can't assume that all widgets for a single GtkTooltips object will be on the same screen.) The patch above can't be correct ... since it will just leave the tooltips window on the default screen.
To implement this properly, adding a SCREEN signal to gtk window would the right way to go. Am I correct ?
No separate signal is needed since you can connect to notify::screen. But if tooltips pop down when the widget is unrealized / hidden (I think they will) I'm not sure watching the screen is necessary.
Once again, you are right :) Here is a simple patch which insure the tooltip window is displayed on the correct screen when the tip is drawn : Index: gtk/gtktooltips.c =================================================================== RCS file: /cvs/gnome/gtk+/gtk/gtktooltips.c,v retrieving revision 1.50 diff -u -r1.50 gtktooltips.c --- gtk/gtktooltips.c 29 Apr 2002 22:53:39 -0000 1.50 +++ gtk/gtktooltips.c 15 May 2002 14:25:28 -0000 @@ -340,6 +340,10 @@ keyboard_mode = get_keyboard_mode (widget); screen = gtk_widget_get_screen (widget); + + if (gtk_window_get_screen (GTK_WINDOW (tooltips->tip_window)) != screen) + gtk_window_set_screen (GTK_WINDOW (tooltips->tip_window), screen); + scr_w = gdk_screen_get_width (screen); scr_h = gdk_screen_get_height (screen); can I commit ?
Hi, all, what is the status of this bug?
*** Bug 90191 has been marked as a duplicate of this bug. ***
I believe the patch from Bug 90191 solve the source of the problem (I forgot the set the screen in some cases). Owen: Can I commit ?
Created attachment 11765 [details] [review] Patch as applied
I ended up with something a fair bit more complex, because I needed to handle the case where the display for the current tooltips->tip_window was closed ... in that case, it is necessary to destroy the tip_widow to avoid leaving a window open on the closed display. 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)