812674
diff -up firefox-114.0/widget/gtk/nsWindow.cpp.D110204-fscreen.diff firefox-114.0/widget/gtk/nsWindow.cpp
812674
--- firefox-114.0/widget/gtk/nsWindow.cpp.D110204-fscreen.diff	2023-05-17 10:43:02.000000000 +0200
812674
+++ firefox-114.0/widget/gtk/nsWindow.cpp	2023-05-17 13:53:54.000443278 +0200
812674
@@ -100,6 +100,7 @@
481763
 #include "ScreenHelperGTK.h"
488d12
 #include "SystemTimeConverter.h"
488d12
 #include "WidgetUtilsGtk.h"
58cb8d
+#include "nsIBrowserHandler.h"
58cb8d
 
488d12
 #ifdef ACCESSIBILITY
488d12
 #  include "mozilla/a11y/LocalAccessible.h"
812674
@@ -173,7 +174,8 @@ const gint kEvents = GDK_TOUCHPAD_GESTUR
481763
                      GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
481763
                      GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
481763
                      GDK_SMOOTH_SCROLL_MASK | GDK_TOUCH_MASK | GDK_SCROLL_MASK |
481763
-                     GDK_POINTER_MOTION_MASK | GDK_PROPERTY_CHANGE_MASK;
481763
+                     GDK_POINTER_MOTION_MASK | GDK_PROPERTY_CHANGE_MASK |
481763
+                     GDK_FOCUS_CHANGE_MASK;
481763
 
481763
 /* utility functions */
481763
 static bool is_mouse_in_window(GdkWindow* aWindow, gdouble aMouseX,
812674
@@ -433,7 +435,8 @@ nsWindow::nsWindow()
481763
       mResizedAfterMoveToRect(false),
481763
       mConfiguredClearColor(false),
812674
       mGotNonBlankPaint(false),
812674
-      mNeedsToRetryCapturingMouse(false) {
812674
+      mNeedsToRetryCapturingMouse(false),
481763
+      mPendingFullscreen(false) {
812674
   mWindowType = WindowType::Child;
481763
   mSizeConstraints.mMaxSize = GetSafeWindowSize(mSizeConstraints.mMaxSize);
481763
 
812674
@@ -5263,6 +5266,19 @@ void nsWindow::OnWindowStateEvent(GtkWid
488d12
       ClearTransparencyBitmap();
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(
481763
+        "  Window should be fullscreen, but it's not, retrying set to "
481763
+         "fullscreen.\n");
58cb8d
+    MakeFullScreen(true);
58cb8d
+  } else {
481763
+    LOG("  Window successfully switched to fullscreen, happy now\n");
58cb8d
+    mPendingFullscreen = false;
58cb8d
+  }
58cb8d
 }
58cb8d
 
488d12
 void nsWindow::OnDPIChanged() {
812674
@@ -7409,6 +7425,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) {
481763
+        LOG("  is kiosk, ensure the window switch to fullscreen\n");
58cb8d
+        mPendingFullscreen = true;
58cb8d
+      }
58cb8d
+    } else {
481763
+      LOG("  Cannot find the browserHandler service.\n");
58cb8d
+    }
58cb8d
     gtk_window_fullscreen(GTK_WINDOW(mShell));
58cb8d
   } else {
812674
     gtk_window_unfullscreen(GTK_WINDOW(mShell));
812674
diff -up firefox-114.0/widget/gtk/nsWindow.h.D110204-fscreen.diff firefox-114.0/widget/gtk/nsWindow.h
812674
--- firefox-114.0/widget/gtk/nsWindow.h.D110204-fscreen.diff	2023-05-17 08:46:16.000000000 +0200
812674
+++ firefox-114.0/widget/gtk/nsWindow.h	2023-05-17 13:51:29.502159247 +0200
812674
@@ -752,6 +752,7 @@ class nsWindow final : public nsBaseWidg
481763
    * move-to-rect callback we set mMovedAfterMoveToRect/mResizedAfterMoveToRect.
488d12
    */
481763
   bool mWaitingForMoveToRectCallback : 1;
481763
+  bool mPendingFullscreen : 1;
481763
   bool mMovedAfterMoveToRect : 1;
481763
   bool mResizedAfterMoveToRect : 1;
58cb8d