Blob Blame History Raw
--- firefox-91.11.0/widget/gtk/nsWindow.cpp.D110204-fscreen.diff	2022-06-20 21:18:51.000000000 +0200
+++ firefox-91.11.0/widget/gtk/nsWindow.cpp	2022-06-21 12:21:44.892706641 +0200
@@ -91,6 +91,7 @@
 #include "SystemTimeConverter.h"
 #include "WidgetUtilsGtk.h"
 #include "mozilla/X11Util.h"
+#include "nsIBrowserHandler.h"
 
 #ifdef ACCESSIBILITY
 #  include "mozilla/a11y/LocalAccessible.h"
@@ -441,6 +442,7 @@ nsWindow::nsWindow()
       mHasMappedToplevel(false),
       mRetryPointerGrab(false),
       mSizeState(nsSizeMode_Normal),
+      mPendingFullscreen(false),
       mAspectRatio(0.0f),
       mAspectRatioSaved(0.0f),
       mLastScrollEventTime(GDK_CURRENT_TIME),
@@ -4618,6 +4620,19 @@ void nsWindow::OnWindowStateEvent(GtkWid
       ClearTransparencyBitmap();
     }
   }
+
+  // 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::OnDPIChanged() {
@@ -6860,6 +6875,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;
--- firefox-91.11.0/widget/gtk/nsWindow.h.D110204-fscreen.diff	2022-06-21 12:21:44.894706636 +0200
+++ firefox-91.11.0/widget/gtk/nsWindow.h	2022-06-21 12:25:20.985209461 +0200
@@ -767,6 +767,7 @@ class nsWindow final : public nsBaseWidg
    * move-to-rect callback we set mResizedAfterMoveToRect.
    */
   bool mWaitingForMoveToRectCallback;
+  bool mPendingFullscreen;
   bool mResizedAfterMoveToRect;
 
   /**