12#include <qpa/qwindowsysteminterface.h>
13#include <private/qhighdpiscaling_p.h>
21 m_surfaceContainerType(
SurfaceContainer::TextureView), m_nativeParentQtWindow(
nullptr),
22 m_androidSurfaceObject(
nullptr)
33 const QRect nativeScreenGeometry = platformScreen()->availableGeometry();
35 setGeometry(nativeScreenGeometry);
38 const QRect availableDeviceIndependentGeometry = (
window->parent())
39 ?
window->parent()->geometry()
43 window, requestedNativeGeometry, availableDeviceIndependentGeometry.width(),
44 availableDeviceIndependentGeometry.height());
45 if (requestedNativeGeometry != finalNativeGeometry)
46 setGeometry(finalNativeGeometry);
49 if (isEmbeddingContainer())
54 if (!androidParent->isEmbeddingContainer())
58 m_nativeQtWindow = QJniObject::construct<QtJniTypes::QtWindow>(
59 QNativeInterface::QAndroidApplication::context(),
60 m_nativeParentQtWindow,
62 m_nativeViewId = m_nativeQtWindow.callMethod<jint>(
"getId");
65 platformScreen()->addWindow(
this);
67 static bool ok =
false;
71 if (
type == SurfaceContainer::SurfaceView ||
type == SurfaceContainer::TextureView)
72 m_surfaceContainerType =
type;
73 }
else if (platformScreen()->windows().size() <= 1) {
77 m_surfaceContainerType = SurfaceContainer::SurfaceView;
79 qCDebug(lcQpaWindow) <<
"Window" << m_nativeViewId <<
"using surface container type"
80 <<
static_cast<int>(m_surfaceContainerType);
85 if (
window()->isTopLevel())
115 availableGeometry.
right(), availableGeometry.
bottom());
134 if (
window()->isTopLevel()) {
180 using namespace QtJniTypes;
184 if (androidWindow->isEmbeddingContainer())
190 const QtWindow parentWindow = androidWindow->nativeWindow();
227 if (!isNonRegularWindow) {
257 jint
x = 0,
y = 0,
w = -1,
h = -1;
258 if (!
rect.isNull()) {
261 w = std::max(
rect.width(), 1);
262 h = std::max(
rect.height(), 1);
325 return modalWindow && modalWindow !=
window();
335void QAndroidPlatformWindow::setSurface(JNIEnv *env, jobject
object, jint windowId,
336 QtJniTypes::Surface surface)
344 const QList<QWindow*> windows =
qGuiApp->allWindows();
355void QAndroidPlatformWindow::windowFocusChanged(JNIEnv *env, jobject
object,
356 jboolean
focus, jint windowId)
361 Q_ASSERT_X(
window,
"QAndroidPlatformWindow",
"windowFocusChanged event window should exist");
372 if (!env.registerNativeMethods(QtJniTypes::Traits<QtJniTypes::QtWindow>::className(),
374 Q_JNI_NATIVE_SCOPED_METHOD(setSurface, QAndroidPlatformWindow),
375 Q_JNI_NATIVE_SCOPED_METHOD(windowFocusChanged, QAndroidPlatformWindow)
377 qCCritical(lcQpaWindow) <<
"RegisterNatives failed for"
378 << QtJniTypes::Traits<QtJniTypes::QtWindow>::className();
static QWindow * modalWindow()
Returns the most recently shown modal window.
\inmodule QtCore\reentrant
\inmodule QtCore\reentrant
constexpr bool isEmpty() const noexcept
Returns true if the rectangle is empty, otherwise returns false.
constexpr int height() const noexcept
Returns the height of the rectangle.
constexpr bool isNull() const noexcept
Returns true if the rectangle is a null rectangle, otherwise returns false.
constexpr int bottom() const noexcept
Returns the y-coordinate of the rectangle's bottom edge.
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
constexpr int left() const noexcept
Returns the x-coordinate of the rectangle's left edge.
constexpr int width() const noexcept
Returns the width of the rectangle.
constexpr int right() const noexcept
Returns the x-coordinate of the rectangle's right edge.
The QRegion class specifies a clip region for a painter.
QPlatformScreen * handle() const
Get the platform screen handle.
static bool flushWindowSystemEvents(QEventLoop::ProcessEventsFlags flags=QEventLoop::AllEvents)
Make Qt Gui process all events on the event queue immediately.
static void handleFocusWindowChanged(QWindow *window, Qt::FocusReason r=Qt::OtherFocusReason)
static void handleGeometryChange(QWindow *window, const QRect &newRect)
static bool handleExposeEvent(QWindow *window, const QRegion ®ion)
Qt::WindowFlags flags
the window flags of the window
T toNativePixels(const T &value, const C *context)
T fromNativePixels(const T &value, const C *context)
Combined button and popup list for selecting options.
QtJniTypes::QtInputDelegate qtInputDelegate()
@ SYSTEM_UI_VISIBILITY_TRANSLUCENT
@ SYSTEM_UI_VISIBILITY_FULLSCREEN
@ SYSTEM_UI_VISIBILITY_NORMAL
void setSystemUiVisibility(SystemUiVisibility uiVisibility)
QWindow * windowFromId(int windowId)
@ MaximizeUsingFullscreenGeometryHint
@ ActiveWindowFocusReason
DBusConnection const char DBusError DBusBusType DBusError return DBusConnection DBusHandleMessageFunction void DBusFreeFunction return DBusConnection return DBusConnection return const char DBusError return DBusConnection DBusMessage dbus_uint32_t return DBusConnection dbus_bool_t DBusConnection DBusAddWatchFunction DBusRemoveWatchFunction DBusWatchToggledFunction void DBusFreeFunction return DBusConnection DBusDispatchStatusFunction void DBusFreeFunction DBusTimeout return DBusTimeout return DBusWatch return DBusWatch unsigned int return DBusError const DBusError return const DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessage return DBusMessageIter int const void return DBusMessageIter DBusMessageIter return DBusMessageIter void DBusMessageIter void int return DBusMessage DBusMessageIter return DBusMessageIter return DBusMessageIter DBusMessageIter const char const char const char const char return DBusMessage return DBusMessage const char return DBusMessage dbus_bool_t return DBusMessage dbus_uint32_t return DBusMessage void
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
bool qFuzzyCompare(qfloat16 p1, qfloat16 p2) noexcept
#define Q_LOGGING_CATEGORY(name,...)
#define qCCritical(category,...)
#define qCDebug(category,...)
GLint GLint GLint GLint GLint x
[0]
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLfloat GLfloat GLfloat GLfloat h
#define Q_ASSERT_X(cond, x, msg)
Q_CORE_EXPORT int qEnvironmentVariableIntValue(const char *varName, bool *ok=nullptr) noexcept