After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 720256 - GtkScaleButton popup appears positioned randomly on the screen
GtkScaleButton popup appears positioned randomly on the screen
Status: RESOLVED FIXED
Product: gtk+
Classification: Platform
Component: Backend: Wayland
unspecified
Other Linux
: Normal normal
: ---
Assigned To: gtk-bugs
gtk-bugs
Depends on:
Blocks:
 
 
Reported: 2013-12-11 14:48 UTC by Emilio Pozuelo Monfort
Modified: 2013-12-14 20:55 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
ScaleButton: make the popup transient to the button's window (941 bytes, patch)
2013-12-11 14:51 UTC, Emilio Pozuelo Monfort
committed Details | Review
testcase (254 bytes, text/x-csrc)
2013-12-11 14:53 UTC, Emilio Pozuelo Monfort
  Details

Description Emilio Pozuelo Monfort 2013-12-11 14:48:42 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.
Comment 1 Emilio Pozuelo Monfort 2013-12-11 14:51:39 UTC
Created attachment 263985 [details] [review]
ScaleButton: make the popup transient to the button's window

Fixes the popup positioning on wayland.
Comment 2 Emilio Pozuelo Monfort 2013-12-11 14:53:48 UTC
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.
Comment 3 Matthias Clasen 2013-12-14 20:55:19 UTC
Attachment 263985 [details] pushed as 4e1b733 - ScaleButton: make the popup transient to the button's window