58cb8d
diff -up firefox-78.9.0/widget/gtk/nsWindow.cpp.D110204-fscreen firefox-78.9.0/widget/gtk/nsWindow.cpp
58cb8d
--- firefox-78.9.0/widget/gtk/nsWindow.cpp.D110204-fscreen	2021-03-30 13:28:56.212009697 +0200
58cb8d
+++ firefox-78.9.0/widget/gtk/nsWindow.cpp	2021-03-30 13:37:41.925850585 +0200
58cb8d
@@ -139,6 +139,7 @@ using namespace mozilla::widget;
58cb8d
 
58cb8d
 #include <dlfcn.h>
58cb8d
 #include "nsPresContext.h"
58cb8d
+#include "nsIBrowserHandler.h"
58cb8d
 
58cb8d
 using namespace mozilla;
58cb8d
 using namespace mozilla::gfx;
58cb8d
@@ -416,6 +417,7 @@ nsWindow::nsWindow() {
58cb8d
   mRetryPointerGrab = false;
58cb8d
   mWindowType = eWindowType_child;
58cb8d
   mSizeState = nsSizeMode_Normal;
58cb8d
+  mPendingFullscreen = false;
58cb8d
   mBoundsAreValid = true;
58cb8d
   mAspectRatio = 0.0f;
58cb8d
   mAspectRatioSaved = 0.0f;
58cb8d
@@ -3887,6 +3889,19 @@ void nsWindow::OnWindowStateEvent(GtkWid
58cb8d
       }
58cb8d
     }
58cb8d
   }
58cb8d
+
58cb8d
+  // Hack to ensure window switched to fullscreen - avoid to fail when starting
58cb8d
+  // in kiosk mode
58cb8d
+  if (mPendingFullscreen &&
58cb8d
+      !(aEvent->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)) {
58cb8d
+    LOG(
58cb8d
+        ("  Window should be fullscreen, but it's not, retrying set to "
58cb8d
+         "fullscreen.\n"));
58cb8d
+    MakeFullScreen(true);
58cb8d
+  } else {
58cb8d
+    LOG(("  Window successfully switched to fullscreen, happy now\n"));
58cb8d
+    mPendingFullscreen = false;
58cb8d
+  }
58cb8d
 }
58cb8d
 
58cb8d
 void nsWindow::ThemeChanged() {
58cb8d
@@ -6010,6 +6025,19 @@ nsresult nsWindow::MakeFullScreen(bool a
58cb8d
       }
58cb8d
     }
58cb8d
 
58cb8d
+    // if in kiosk, ensure the fullscreen is called
58cb8d
+    nsCOMPtr<nsIBrowserHandler> browserHandler =
58cb8d
+        do_GetService("@mozilla.org/browser/clh;1");
58cb8d
+    if (browserHandler) {
58cb8d
+      bool isKiosk;
58cb8d
+      browserHandler->GetKiosk(&isKiosk);
58cb8d
+      if (isKiosk) {
58cb8d
+        LOG(("  is kiosk, ensure the window switch to fullscreen\n"));
58cb8d
+        mPendingFullscreen = true;
58cb8d
+      }
58cb8d
+    } else {
58cb8d
+      LOG(("  Cannot find the browserHandler service.\n"));
58cb8d
+    }
58cb8d
     gtk_window_fullscreen(GTK_WINDOW(mShell));
58cb8d
   } else {
58cb8d
     mSizeMode = mLastSizeMode;
58cb8d
diff -up firefox-78.9.0/widget/gtk/nsWindow.h.D110204-fscreen firefox-78.9.0/widget/gtk/nsWindow.h
58cb8d
--- firefox-78.9.0/widget/gtk/nsWindow.h.D110204-fscreen	2021-03-15 16:52:42.000000000 +0100
58cb8d
+++ firefox-78.9.0/widget/gtk/nsWindow.h	2021-03-30 13:28:56.237009784 +0200
58cb8d
@@ -703,6 +703,7 @@ class nsWindow final : public nsBaseWidg
58cb8d
   nsRect mPreferredPopupRect;
58cb8d
   bool mPreferredPopupRectFlushed;
58cb8d
   bool mWaitingForMoveToRectCB;
58cb8d
+  bool mPendingFullscreen;
58cb8d
   LayoutDeviceIntRect mPendingSizeRect;
58cb8d
 
58cb8d
   /**