firefox/mozilla-1562827.patch
Martin Stransky 20c032f2ed Added upstream Wayland patches (mozilla-1548475, mozilla-1562827,
mozilla-1567434, mozilla-1573813, mozilla-1574036,
  mozilla-1576268).
- Enable multiprocess compilation.
2019-09-02 17:03:30 +02:00

142 lines
5.6 KiB
Diff

diff -up firefox-69.0/widget/gtk/nsWindow.cpp.mozilla-1562827 firefox-69.0/widget/gtk/nsWindow.cpp
--- firefox-69.0/widget/gtk/nsWindow.cpp.mozilla-1562827 2019-09-02 15:16:15.031528276 +0200
+++ firefox-69.0/widget/gtk/nsWindow.cpp 2019-09-02 15:16:15.037528254 +0200
@@ -818,7 +818,6 @@ void nsWindow::SetParent(nsIWidget* aNew
if (mParent) {
mParent->RemoveChild(this);
}
-
mParent = aNewParent;
GtkWidget* oldContainer = GetMozContainerWidget();
@@ -830,88 +829,73 @@ void nsWindow::SetParent(nsIWidget* aNew
return;
}
+ nsWindow* newParent = static_cast<nsWindow*>(aNewParent);
+ GdkWindow* newParentWindow = nullptr;
+ GtkWidget* newContainer = nullptr;
if (aNewParent) {
aNewParent->AddChild(this);
- ReparentNativeWidget(aNewParent);
+ newParentWindow = newParent->mGdkWindow;
+ newContainer = newParent->GetMozContainerWidget();
} else {
// aNewParent is nullptr, but reparent to a hidden window to avoid
// destroying the GdkWindow and its descendants.
// An invisible container widget is needed to hold descendant
// GtkWidgets.
- GtkWidget* newContainer = EnsureInvisibleContainer();
- GdkWindow* newParentWindow = gtk_widget_get_window(newContainer);
- ReparentNativeWidgetInternal(aNewParent, newContainer, newParentWindow,
- oldContainer);
- }
-}
-
-bool nsWindow::WidgetTypeSupportsAcceleration() { return !IsSmallPopup(); }
-
-void nsWindow::ReparentNativeWidget(nsIWidget* aNewParent) {
- MOZ_ASSERT(aNewParent, "null widget");
- NS_ASSERTION(!mIsDestroyed, "");
- NS_ASSERTION(!static_cast<nsWindow*>(aNewParent)->mIsDestroyed, "");
-
- GtkWidget* oldContainer = GetMozContainerWidget();
- if (!oldContainer) {
- // The GdkWindows have been destroyed so there is nothing else to
- // reparent.
- MOZ_ASSERT(gdk_window_is_destroyed(mGdkWindow),
- "live GdkWindow with no widget");
- return;
+ newContainer = EnsureInvisibleContainer();
+ newParentWindow = gtk_widget_get_window(newContainer);
}
- MOZ_ASSERT(!gdk_window_is_destroyed(mGdkWindow),
- "destroyed GdkWindow with widget");
- auto* newParent = static_cast<nsWindow*>(aNewParent);
- GdkWindow* newParentWindow = newParent->mGdkWindow;
- GtkWidget* newContainer = newParent->GetMozContainerWidget();
- GtkWindow* shell = GTK_WINDOW(mShell);
-
- if (shell && gtk_window_get_transient_for(shell)) {
- GtkWindow* topLevelParent =
- GTK_WINDOW(gtk_widget_get_toplevel(newContainer));
- gtk_window_set_transient_for(shell, topLevelParent);
- }
-
- ReparentNativeWidgetInternal(aNewParent, newContainer, newParentWindow,
- oldContainer);
-}
-
-void nsWindow::ReparentNativeWidgetInternal(nsIWidget* aNewParent,
- GtkWidget* aNewContainer,
- GdkWindow* aNewParentWindow,
- GtkWidget* aOldContainer) {
- if (!aNewContainer) {
+ if (!newContainer) {
// The new parent GdkWindow has been destroyed.
- MOZ_ASSERT(!aNewParentWindow || gdk_window_is_destroyed(aNewParentWindow),
+ MOZ_ASSERT(!newParentWindow || gdk_window_is_destroyed(newParentWindow),
"live GdkWindow with no widget");
Destroy();
} else {
- if (aNewContainer != aOldContainer) {
- MOZ_ASSERT(!gdk_window_is_destroyed(aNewParentWindow),
+ if (newContainer != oldContainer) {
+ MOZ_ASSERT(!gdk_window_is_destroyed(newParentWindow),
"destroyed GdkWindow with widget");
- SetWidgetForHierarchy(mGdkWindow, aOldContainer, aNewContainer);
+ SetWidgetForHierarchy(mGdkWindow, oldContainer, newContainer);
- if (aOldContainer == gInvisibleContainer) {
+ if (oldContainer == gInvisibleContainer) {
CheckDestroyInvisibleContainer();
}
}
- if (!mIsTopLevel) {
- gdk_window_reparent(mGdkWindow, aNewParentWindow,
- DevicePixelsToGdkCoordRoundDown(mBounds.x),
- DevicePixelsToGdkCoordRoundDown(mBounds.y));
- }
+ gdk_window_reparent(mGdkWindow, newParentWindow,
+ DevicePixelsToGdkCoordRoundDown(mBounds.x),
+ DevicePixelsToGdkCoordRoundDown(mBounds.y));
+ mToplevelParentWindow = GTK_WINDOW(gtk_widget_get_toplevel(newContainer));
}
- auto* newParent = static_cast<nsWindow*>(aNewParent);
bool parentHasMappedToplevel = newParent && newParent->mHasMappedToplevel;
if (mHasMappedToplevel != parentHasMappedToplevel) {
SetHasMappedToplevel(parentHasMappedToplevel);
}
}
+bool nsWindow::WidgetTypeSupportsAcceleration() { return !IsSmallPopup(); }
+
+void nsWindow::ReparentNativeWidget(nsIWidget* aNewParent) {
+ MOZ_ASSERT(aNewParent, "null widget");
+ MOZ_ASSERT(!mIsDestroyed, "");
+ MOZ_ASSERT(!static_cast<nsWindow*>(aNewParent)->mIsDestroyed, "");
+ MOZ_ASSERT(!gdk_window_is_destroyed(mGdkWindow),
+ "destroyed GdkWindow with widget");
+
+ MOZ_ASSERT(
+ !mParent,
+ "nsWindow::ReparentNativeWidget() works on toplevel windows only.");
+
+ auto* newParent = static_cast<nsWindow*>(aNewParent);
+ GtkWindow* newParentWidget = GTK_WINDOW(newParent->GetGtkWidget());
+ GtkWindow* shell = GTK_WINDOW(mShell);
+
+ if (shell && gtk_window_get_transient_for(shell)) {
+ gtk_window_set_transient_for(shell, newParentWidget);
+ mToplevelParentWindow = newParentWidget;
+ }
+}
+
void nsWindow::SetModal(bool aModal) {
LOG(("nsWindow::SetModal [%p] %d\n", (void*)this, aModal));
if (mIsDestroyed) return;
diff -up firefox-69.0/widget/gtk/nsWindow.h.mozilla-1562827 firefox-69.0/widget/gtk/nsWindow.h