c5da2d
diff -up firefox-102.2.0/widget/gtk/nsWindow.cpp.D110204-fscreen.diff firefox-102.2.0/widget/gtk/nsWindow.cpp
c5da2d
--- firefox-102.2.0/widget/gtk/nsWindow.cpp.D110204-fscreen.diff	2022-08-18 21:54:09.000000000 +0200
c5da2d
+++ firefox-102.2.0/widget/gtk/nsWindow.cpp	2022-09-02 15:55:18.023843940 +0200
c5da2d
@@ -96,6 +96,7 @@
c5da2d
 #include "ScreenHelperGTK.h"
17290f
 #include "SystemTimeConverter.h"
17290f
 #include "WidgetUtilsGtk.h"
f9ee7b
+#include "nsIBrowserHandler.h"
f9ee7b
 
17290f
 #ifdef ACCESSIBILITY
17290f
 #  include "mozilla/a11y/LocalAccessible.h"
c5da2d
@@ -169,7 +170,8 @@ const gint kEvents = GDK_TOUCHPAD_GESTUR
c5da2d
                      GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK |
c5da2d
                      GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
c5da2d
                      GDK_SMOOTH_SCROLL_MASK | GDK_TOUCH_MASK | GDK_SCROLL_MASK |
c5da2d
-                     GDK_POINTER_MOTION_MASK | GDK_PROPERTY_CHANGE_MASK;
c5da2d
+                     GDK_POINTER_MOTION_MASK | GDK_PROPERTY_CHANGE_MASK |
c5da2d
+                     GDK_FOCUS_CHANGE_MASK;
c5da2d
 
c5da2d
 /* utility functions */
c5da2d
 static bool is_mouse_in_window(GdkWindow* aWindow, gdouble aMouseX,
c5da2d
@@ -408,7 +410,8 @@ nsWindow::nsWindow()
c5da2d
       mMovedAfterMoveToRect(false),
c5da2d
       mResizedAfterMoveToRect(false),
c5da2d
       mConfiguredClearColor(false),
c5da2d
-      mGotNonBlankPaint(false) {
c5da2d
+      mGotNonBlankPaint(false),
c5da2d
+      mPendingFullscreen(false) {
c5da2d
   mWindowType = eWindowType_child;
c5da2d
   mSizeConstraints.mMaxSize = GetSafeWindowSize(mSizeConstraints.mMaxSize);
c5da2d
 
c5da2d
@@ -4814,6 +4817,19 @@ void nsWindow::OnWindowStateEvent(GtkWid
17290f
       ClearTransparencyBitmap();
f9ee7b
     }
f9ee7b
   }
f9ee7b
+
f9ee7b
+  // Hack to ensure window switched to fullscreen - avoid to fail when starting
f9ee7b
+  // in kiosk mode
f9ee7b
+  if (mPendingFullscreen &&
f9ee7b
+      !(aEvent->new_window_state & GDK_WINDOW_STATE_FULLSCREEN)) {
f9ee7b
+    LOG(
c5da2d
+        "  Window should be fullscreen, but it's not, retrying set to "
c5da2d
+         "fullscreen.\n");
f9ee7b
+    MakeFullScreen(true);
f9ee7b
+  } else {
c5da2d
+    LOG("  Window successfully switched to fullscreen, happy now\n");
f9ee7b
+    mPendingFullscreen = false;
f9ee7b
+  }
f9ee7b
 }
f9ee7b
 
17290f
 void nsWindow::OnDPIChanged() {
c5da2d
@@ -7042,6 +7058,19 @@ nsresult nsWindow::MakeFullScreen(bool a
f9ee7b
       }
f9ee7b
     }
f9ee7b
 
f9ee7b
+    // if in kiosk, ensure the fullscreen is called
f9ee7b
+    nsCOMPtr<nsIBrowserHandler> browserHandler =
f9ee7b
+        do_GetService("@mozilla.org/browser/clh;1");
f9ee7b
+    if (browserHandler) {
f9ee7b
+      bool isKiosk;
f9ee7b
+      browserHandler->GetKiosk(&isKiosk);
f9ee7b
+      if (isKiosk) {
c5da2d
+        LOG("  is kiosk, ensure the window switch to fullscreen\n");
f9ee7b
+        mPendingFullscreen = true;
f9ee7b
+      }
f9ee7b
+    } else {
c5da2d
+      LOG("  Cannot find the browserHandler service.\n");
f9ee7b
+    }
f9ee7b
     gtk_window_fullscreen(GTK_WINDOW(mShell));
f9ee7b
   } else {
f9ee7b
     mSizeMode = mLastSizeMode;
c5da2d
diff -up firefox-102.2.0/widget/gtk/nsWindow.h.D110204-fscreen.diff firefox-102.2.0/widget/gtk/nsWindow.h
c5da2d
--- firefox-102.2.0/widget/gtk/nsWindow.h.D110204-fscreen.diff	2022-08-18 21:53:52.000000000 +0200
c5da2d
+++ firefox-102.2.0/widget/gtk/nsWindow.h	2022-09-02 08:17:07.606010905 +0200
c5da2d
@@ -712,6 +712,7 @@ class nsWindow final : public nsBaseWidg
c5da2d
    * move-to-rect callback we set mMovedAfterMoveToRect/mResizedAfterMoveToRect.
17290f
    */
c5da2d
   bool mWaitingForMoveToRectCallback : 1;
c5da2d
+  bool mPendingFullscreen : 1;
c5da2d
   bool mMovedAfterMoveToRect : 1;
c5da2d
   bool mResizedAfterMoveToRect : 1;
f9ee7b