summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/android/qandroidplatformwindow.cpp
diff options
context:
space:
mode:
authorAssam Boudjelthia <assam.boudjelthia@qt.io>2024-11-28 21:51:04 +0200
committerAssam Boudjelthia <assam.boudjelthia@qt.io>2024-12-03 17:27:27 +0200
commit0abcb9bef8a7cb85df006adfed51bc9258868ed2 (patch)
tree200715849a95fc53b08bd3f31c811b7df68d9400 /src/plugins/platforms/android/qandroidplatformwindow.cpp
parenta2385e5c9dc9b07cb43264bf0309a80992f80ad8 (diff)
Android: improve fullscreen and maximized states handling
Rework fullscreen and maximized/expanded states handling by simplifying and re-organizing the code, removing some unnecessary code. Also, use newer APIs and handling the cutout regions. For expanded mode, use transparent instead of translucent so that the user can decide what color to use if needed, and in any case using the translucent flags is deprecated. You might still notice some artifacts as in QTBUG-88676, a fix for that is outside the scope of this patch. When going off of fullscreen mode one some cases you might notice a white/black black at the bottom and that's because QtRootLayout.onSizeChanged() is reporting wrong available size which is also an existing issue and outside of this scope. Fixes: QTBUG-96105 Fixes: QTBUG-101968 Fixes: QTBUG-127394 Fixes: QTBUG-121820 Task-number: QTBUG-109878 Task-number: QTBUG-119594 Change-Id: I586775a1d0414ec0adbc968d50b9c1a1ce466422 Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@qt.io>
Diffstat (limited to 'src/plugins/platforms/android/qandroidplatformwindow.cpp')
-rw-r--r--src/plugins/platforms/android/qandroidplatformwindow.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/src/plugins/platforms/android/qandroidplatformwindow.cpp b/src/plugins/platforms/android/qandroidplatformwindow.cpp
index 26dcdfeb437..b535ea78ed2 100644
--- a/src/plugins/platforms/android/qandroidplatformwindow.cpp
+++ b/src/plugins/platforms/android/qandroidplatformwindow.cpp
@@ -3,6 +3,7 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#include "qandroidplatformwindow.h"
+#include "androidbackendregister.h"
#include "qandroidplatformopenglcontext.h"
#include "qandroidplatformscreen.h"
@@ -255,19 +256,13 @@ void QAndroidPlatformWindow::requestActivateWindow()
void QAndroidPlatformWindow::updateSystemUiVisibility()
{
- Qt::WindowFlags flags = window()->flags();
- bool isNonRegularWindow = flags & (Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window;
+ const int flags = window()->flags();
+ const bool isNonRegularWindow = flags & (Qt::Popup | Qt::Dialog | Qt::Sheet) & ~Qt::Window;
if (!isNonRegularWindow) {
- SystemUiVisibility visibility;
- if (m_windowState & Qt::WindowFullScreen)
- visibility = SYSTEM_UI_VISIBILITY_FULLSCREEN;
- else if (flags & Qt::ExpandedClientAreaHint)
- visibility = SYSTEM_UI_VISIBILITY_TRANSLUCENT;
- else
- visibility = SYSTEM_UI_VISIBILITY_NORMAL;
-
+ const bool isFullScreen = (m_windowState & Qt::WindowFullScreen);
+ const bool expandedToCutout = (flags & Qt::ExpandedClientAreaHint);
QtAndroid::backendRegister()->callInterface<QtJniTypes::QtWindowInterface, void>(
- "setSystemUiVisibility", jint(visibility));
+ "setSystemUiVisibility", isFullScreen, expandedToCutout);
}
}