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