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