602bf9
--- firefox-91.11.0/widget/gtk/nsWindow.cpp.D110204-fscreen.diff	2022-06-20 21:18:51.000000000 +0200
602bf9
+++ firefox-91.11.0/widget/gtk/nsWindow.cpp	2022-06-21 12:21:44.892706641 +0200
7a48c4
@@ -91,6 +91,7 @@
7a48c4
 #include "SystemTimeConverter.h"
7a48c4
 #include "WidgetUtilsGtk.h"
7a48c4
 #include "mozilla/X11Util.h"
7a48c4
+#include "nsIBrowserHandler.h"
7a48c4
 
7a48c4
 #ifdef ACCESSIBILITY
7a48c4
 #  include "mozilla/a11y/LocalAccessible.h"
7a48c4
@@ -441,6 +442,7 @@ nsWindow::nsWindow()
7a48c4
       mHasMappedToplevel(false),
7a48c4
       mRetryPointerGrab(false),
7a48c4
       mSizeState(nsSizeMode_Normal),
7a48c4
+      mPendingFullscreen(false),
7a48c4
       mAspectRatio(0.0f),
7a48c4
       mAspectRatioSaved(0.0f),
7a48c4
       mLastScrollEventTime(GDK_CURRENT_TIME),
602bf9
@@ -4618,6 +4620,19 @@ void nsWindow::OnWindowStateEvent(GtkWid
7a48c4
       ClearTransparencyBitmap();
7a48c4
     }
7a48c4
   }
7a48c4
+
7a48c4
+  // Hack to ensure window switched to fullscreen - avoid to fail when starting
7a48c4
+  // in kiosk mode
7a48c4
+  if (mPendingFullscreen &&
7a48c4
+      !(aEvent->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)) {
7a48c4
+    LOG(
7a48c4
+        ("  Window should be fullscreen, but it's not, retrying set to "
7a48c4
+         "fullscreen.\n"));
7a48c4
+    MakeFullScreen(true);
7a48c4
+  } else {
7a48c4
+    LOG(("  Window successfully switched to fullscreen, happy now\n"));
7a48c4
+    mPendingFullscreen = false;
7a48c4
+  }
7a48c4
 }
7a48c4
 
7a48c4
 void nsWindow::OnDPIChanged() {
602bf9
@@ -6860,6 +6875,19 @@ nsresult nsWindow::MakeFullScreen(bool a
7a48c4
       }
7a48c4
     }
7a48c4
 
7a48c4
+    // if in kiosk, ensure the fullscreen is called
7a48c4
+    nsCOMPtr<nsIBrowserHandler> browserHandler =
7a48c4
+        do_GetService("@mozilla.org/browser/clh;1");
7a48c4
+    if (browserHandler) {
7a48c4
+      bool isKiosk;
7a48c4
+      browserHandler->GetKiosk(&isKiosk);
7a48c4
+      if (isKiosk) {
7a48c4
+        LOG(("  is kiosk, ensure the window switch to fullscreen\n"));
7a48c4
+        mPendingFullscreen = true;
7a48c4
+      }
7a48c4
+    } else {
7a48c4
+      LOG(("  Cannot find the browserHandler service.\n"));
7a48c4
+    }
7a48c4
     gtk_window_fullscreen(GTK_WINDOW(mShell));
7a48c4
   } else {
7a48c4
     mSizeMode = mLastSizeMode;
602bf9
--- firefox-91.11.0/widget/gtk/nsWindow.h.D110204-fscreen.diff	2022-06-21 12:21:44.894706636 +0200
602bf9
+++ firefox-91.11.0/widget/gtk/nsWindow.h	2022-06-21 12:25:20.985209461 +0200
602bf9
@@ -767,6 +767,7 @@ class nsWindow final : public nsBaseWidg
602bf9
    * move-to-rect callback we set mResizedAfterMoveToRect.
7a48c4
    */
7a48c4
   bool mWaitingForMoveToRectCallback;
7a48c4
+  bool mPendingFullscreen;
602bf9
   bool mResizedAfterMoveToRect;
7a48c4
 
7a48c4
   /**