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