firefox/mozilla-1705048.patch
2021-06-01 10:15:57 +02:00

71 lines
3.0 KiB
Diff

diff -up firefox-89.0/widget/gtk/nsWindow.cpp.1705048 firefox-89.0/widget/gtk/nsWindow.cpp
--- firefox-89.0/widget/gtk/nsWindow.cpp.1705048 2021-06-01 10:12:40.671376199 +0200
+++ firefox-89.0/widget/gtk/nsWindow.cpp 2021-06-01 10:13:45.134701718 +0200
@@ -553,6 +553,7 @@ nsWindow::nsWindow() {
mTitlebarBackdropState = false;
mHasAlphaVisual = false;
+ mIsWaylandPanelWindow = false;
mIsPIPWindow = false;
mAlwaysOnTop = false;
@@ -3724,7 +3725,7 @@ void nsWindow::OnButtonPressEvent(GdkEve
LayoutDeviceIntPoint refPoint =
GdkEventCoordsToDevicePixels(aEvent->x, aEvent->y);
- if (mDraggableRegion.Contains(refPoint.x, refPoint.y) &&
+ if ((mIsWaylandPanelWindow || mDraggableRegion.Contains(refPoint.x, refPoint.y)) &&
domButton == MouseButton::ePrimary &&
eventStatus.mContentStatus != nsEventStatus_eConsumeNoDefault) {
mWindowShouldStartDragging = true;
@@ -4636,8 +4637,9 @@ nsresult nsWindow::Create(nsIWidget* aPa
// as a workaround.
mWindowType = eWindowType_toplevel;
} else if (mWindowType == eWindowType_popup && !aNativeParent && !aParent) {
- // Workaround for Wayland where the popup windows always need to have
- // parent window. For example webrtc ui is a popup window without parent.
+ // mIsWaylandPanelWindow is a special toplevel window on Wayland which
+ // emulates X11 popup window without parent.
+ mIsWaylandPanelWindow = true;
mWindowType = eWindowType_toplevel;
}
}
@@ -4664,8 +4666,10 @@ nsresult nsWindow::Create(nsIWidget* aPa
// popup window position.
GtkWindowType type = GTK_WINDOW_TOPLEVEL;
if (mWindowType == eWindowType_popup) {
- type = (mIsX11Display && aInitData->mNoAutoHide) ? GTK_WINDOW_TOPLEVEL
- : GTK_WINDOW_POPUP;
+ type = GTK_WINDOW_POPUP;
+ if (GdkIsX11Display() && aInitData->mNoAutoHide) {
+ type = GTK_WINDOW_TOPLEVEL;
+ }
}
mShell = gtk_window_new(type);
@@ -4912,6 +4916,10 @@ nsresult nsWindow::Create(nsIWidget* aPa
}
#endif
+ if (mIsWaylandPanelWindow) {
+ gtk_window_set_decorated(GTK_WINDOW(mShell), false);
+ }
+
if (mWindowType == eWindowType_popup) {
// gdk does not automatically set the cursor for "temporary"
// windows, which are what gtk uses for popups.
diff -up firefox-89.0/widget/gtk/nsWindow.h.1705048 firefox-89.0/widget/gtk/nsWindow.h
--- firefox-89.0/widget/gtk/nsWindow.h.1705048 2021-06-01 10:12:40.671376199 +0200
+++ firefox-89.0/widget/gtk/nsWindow.h 2021-06-01 10:12:40.673376240 +0200
@@ -590,6 +590,10 @@ class nsWindow final : public nsBaseWidg
LayoutDeviceIntRegion mDraggableRegion;
// It's PictureInPicture window.
bool mIsPIPWindow;
+ // It's undecorated popup utility window, without resizers/titlebar,
+ // movable by mouse. Used on Wayland as a workaround for popups without
+ // parent (for instance WebRTC sharing indicator).
+ bool mIsWaylandPanelWindow;
bool mAlwaysOnTop;
#ifdef ACCESSIBILITY