c4efd4
diff -up firefox-91.0/widget/gtk/nsWindow.cpp.D110204-fscreen.diff firefox-91.0/widget/gtk/nsWindow.cpp
c4efd4
--- firefox-91.0/widget/gtk/nsWindow.cpp.D110204-fscreen.diff	2021-07-27 23:31:38.000000000 +0200
c4efd4
+++ firefox-91.0/widget/gtk/nsWindow.cpp	2021-07-30 15:47:22.031795569 +0200
c4efd4
@@ -91,6 +91,7 @@
c4efd4
 #include "SystemTimeConverter.h"
c4efd4
 #include "WidgetUtilsGtk.h"
c4efd4
 #include "mozilla/X11Util.h"
ad8adb
+#include "nsIBrowserHandler.h"
ad8adb
 
c4efd4
 #ifdef ACCESSIBILITY
c4efd4
 #  include "mozilla/a11y/LocalAccessible.h"
c4efd4
@@ -441,6 +442,7 @@ nsWindow::nsWindow()
c4efd4
       mHasMappedToplevel(false),
c4efd4
       mRetryPointerGrab(false),
c4efd4
       mSizeState(nsSizeMode_Normal),
c4efd4
+      mPendingFullscreen(false),
c4efd4
       mAspectRatio(0.0f),
c4efd4
       mAspectRatioSaved(0.0f),
c4efd4
       mLastScrollEventTime(GDK_CURRENT_TIME),
c4efd4
@@ -4626,6 +4628,19 @@ void nsWindow::OnWindowStateEvent(GtkWid
c4efd4
       ClearTransparencyBitmap();
ad8adb
     }
ad8adb
   }
ad8adb
+
ad8adb
+  // Hack to ensure window switched to fullscreen - avoid to fail when starting
ad8adb
+  // in kiosk mode
ad8adb
+  if (mPendingFullscreen &&
ad8adb
+      !(aEvent->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)) {
ad8adb
+    LOG(
ad8adb
+        ("  Window should be fullscreen, but it's not, retrying set to "
ad8adb
+         "fullscreen.\n"));
ad8adb
+    MakeFullScreen(true);
ad8adb
+  } else {
ad8adb
+    LOG(("  Window successfully switched to fullscreen, happy now\n"));
ad8adb
+    mPendingFullscreen = false;
ad8adb
+  }
ad8adb
 }
ad8adb
 
c4efd4
 void nsWindow::OnDPIChanged() {
c4efd4
@@ -6880,6 +6895,19 @@ nsresult nsWindow::MakeFullScreen(bool a
ad8adb
       }
ad8adb
     }
ad8adb
 
ad8adb
+    // if in kiosk, ensure the fullscreen is called
ad8adb
+    nsCOMPtr<nsIBrowserHandler> browserHandler =
ad8adb
+        do_GetService("@mozilla.org/browser/clh;1");
ad8adb
+    if (browserHandler) {
ad8adb
+      bool isKiosk;
ad8adb
+      browserHandler->GetKiosk(&isKiosk);
ad8adb
+      if (isKiosk) {
ad8adb
+        LOG(("  is kiosk, ensure the window switch to fullscreen\n"));
ad8adb
+        mPendingFullscreen = true;
ad8adb
+      }
ad8adb
+    } else {
ad8adb
+      LOG(("  Cannot find the browserHandler service.\n"));
ad8adb
+    }
ad8adb
     gtk_window_fullscreen(GTK_WINDOW(mShell));
ad8adb
   } else {
ad8adb
     mSizeMode = mLastSizeMode;
c4efd4
diff -up firefox-91.0/widget/gtk/nsWindow.h.D110204-fscreen.diff firefox-91.0/widget/gtk/nsWindow.h
c4efd4
--- firefox-91.0/widget/gtk/nsWindow.h.D110204-fscreen.diff	2021-07-27 23:31:38.000000000 +0200
c4efd4
+++ firefox-91.0/widget/gtk/nsWindow.h	2021-07-29 18:35:41.000639386 +0200
c4efd4
@@ -763,6 +763,7 @@ class nsWindow final : public nsBaseWidg
c4efd4
    * move-to-rect callback we store it to mNewSizeAfterMoveToRect.
c4efd4
    */
c4efd4
   bool mWaitingForMoveToRectCallback;
ad8adb
+  bool mPendingFullscreen;
c4efd4
   LayoutDeviceIntRect mNewSizeAfterMoveToRect;
ad8adb
 
ad8adb
   /**