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