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