summaryrefslogtreecommitdiff
path: root/mozilla-1609732-no-full-hide.patch
blob: 9894ed4c15bcb6f7d19562f0a5caf0c605ced48c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
diff --git a/widget/gtk/WindowSurfaceWayland.cpp b/widget/gtk/WindowSurfaceWayland.cpp
--- a/widget/gtk/WindowSurfaceWayland.cpp
+++ b/widget/gtk/WindowSurfaceWayland.cpp
@@ -805,6 +805,10 @@
   mBufferCommitAllowed = false;
 
   LayoutDeviceIntRect lockedScreenRect = mWindow->GetBounds();
+  // The window bounds of popup windows contains relative position to
+  // the transient window. We need to remove that effect because by changing
+  // position of the popup window the buffer has not changed its size.
+  lockedScreenRect.x = lockedScreenRect.y = 0;
   gfx::IntRect lockSize = aRegion.GetBounds().ToUnknownRect();
 
   bool isTransparentPopup =
diff --git a/widget/gtk/nsWindow.cpp b/widget/gtk/nsWindow.cpp
--- a/widget/gtk/nsWindow.cpp
+++ b/widget/gtk/nsWindow.cpp
@@ -1324,6 +1324,7 @@
     // Fallback to the parent given in nsWindow::Create (most likely the
     // toplevel window).
     parentGtkWindow = gtk_window_get_transient_for(GTK_WINDOW(mShell));
+    LOG(("  Setting parent from transient: %p [GtkWindow]\n", parentGtkWindow));
   }
   // Add current window to the visible popup list
   gVisibleWaylandPopupWindows =
@@ -1355,7 +1356,7 @@
        mBounds.width, mBounds.height));
 
   GtkWindow* parentGtkWindow = gtk_window_get_transient_for(GTK_WINDOW(mShell));
-  if (!parentGtkWindow) {
+  if (!parentGtkWindow || !GTK_IS_WIDGET(parentGtkWindow)) {
     NS_WARNING("Popup has no parent!");
     return;
   }
@@ -1431,8 +1432,13 @@
        parentWindow));
 
   int x_parent, y_parent;
-  gdk_window_get_origin(gtk_widget_get_window(GTK_WIDGET(parentWindow)),
-                        &x_parent, &y_parent);
+  if (parentWindow) {
+    gdk_window_get_origin(gtk_widget_get_window(GTK_WIDGET(parentWindow)),
+                          &x_parent, &y_parent);
+  } else {
+    NS_WARNING(("no parent window, this should not happen for popup!"));
+    x_parent = y_parent = 0;
+  }
 
   GdkRectangle rect = {aPosition->x - x_parent, aPosition->y - y_parent, 1, 1};
   if (aSize) {
@@ -1470,7 +1476,7 @@
   bool isWidgetVisible =
       (sGtkWidgetIsVisible != nullptr) && sGtkWidgetIsVisible(mShell);
   if (isWidgetVisible) {
-    HideWaylandWindow();
+    gtk_widget_hide(mShell);
   }
 
   LOG(("  requested rect: x: %d y: %d width: %d height: %d\n", rect.x, rect.y,

bgstack15