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