GNOME Bugzilla – Bug 720256
GtkScaleButton popup appears positioned randomly on the screen
Last modified: 2013-12-14 20:55:23 UTC
On wayland, GtkScaleButton's popup doesn't appear on top of the button, but randomly on the screen. This is because gtk_window_move() has no effect for normal toplevel windows or windows that are not transient. Indeed, making the pop transient with something like: --- a/gtk/gtkscalebutton.c +++ b/gtk/gtkscalebutton.c @@ -911,6 +911,9 @@ gtk_scale_popup (GtkWidget *widget, x += allocation.x; y += allocation.y; + gtk_window_set_transient_for (GTK_WINDOW (priv->dock), + GTK_WINDOW (gtk_widget_get_toplevel (widget))); + if (priv->orientation == GTK_ORIENTATION_VERTICAL) gtk_window_move (GTK_WINDOW (priv->dock), x, y - (SCALE_SIZE / 2)); else makes the popup properly positioned. This works with gtk+-3.10 but may not work with gtk+ 3.11/master because of the switch to the xdg-shell protocol. I haven't tested that.
Created attachment 263985 [details] [review] ScaleButton: make the popup transient to the button's window Fixes the popup positioning on wayland.
Created attachment 263986 [details] testcase Example that shows the problem. With the attached gtk+ patch on gtk+ 3.10.2, the example works fine in wayland, and keeps working fine on X11.
Attachment 263985 [details] pushed as 4e1b733 - ScaleButton: make the popup transient to the button's window