12#include <qpa/qwindowsysteminterface.h>
13#include <private/qhighdpiscaling_p.h>
21 "
org/qtproject/qt/android/QtInputConnection$QtInputConnectionListener")
25 m_surfaceContainerType(SurfaceContainer::TextureView), m_nativeParentQtWindow(
nullptr),
26 m_androidSurfaceObject(
nullptr)
37 const QRect nativeScreenGeometry = platformScreen()->availableGeometry();
39 setGeometry(nativeScreenGeometry);
42 const QRect availableDeviceIndependentGeometry = (
window->parent())
43 ?
window->parent()->geometry()
47 window, requestedNativeGeometry, availableDeviceIndependentGeometry.width(),
48 availableDeviceIndependentGeometry.height());
49 if (requestedNativeGeometry != finalNativeGeometry)
50 setGeometry(finalNativeGeometry);
53 if (isEmbeddingContainer())
58 if (!androidParent->isEmbeddingContainer())
63 QtJniTypes::QtInputConnectionListener listener =
64 reg->callInterface<QtJniTypes::QtInputInterface, QtJniTypes::QtInputConnectionListener>(
65 "getInputConnectionListener");
67 m_nativeQtWindow = QJniObject::construct<QtJniTypes::QtWindow>(
68 QNativeInterface::QAndroidApplication::context(), m_nativeParentQtWindow, listener);
69 m_nativeViewId = m_nativeQtWindow.callMethod<jint>(
"getId");
72 platformScreen()->addWindow(
this);
74 static bool ok =
false;
77 static const SurfaceContainer
type =
static_cast<SurfaceContainer
>(
value);
78 if (
type == SurfaceContainer::SurfaceView ||
type == SurfaceContainer::TextureView)
79 m_surfaceContainerType =
type;
80 }
else if (platformScreen()->windows().size() <= 1) {
84 m_surfaceContainerType = SurfaceContainer::SurfaceView;
86 qCDebug(lcQpaWindow) <<
"Window" << m_nativeViewId <<
"using surface container type"
87 <<
static_cast<int>(m_surfaceContainerType);
92 if (
window()->isTopLevel())
122 availableGeometry.
right(), availableGeometry.
bottom());
141 if (
window()->isTopLevel()) {
187 using namespace QtJniTypes;
191 if (androidWindow->isEmbeddingContainer())
197 const QtWindow parentWindow = androidWindow->nativeWindow();
234 if (!isNonRegularWindow) {
264 jint
x = 0,
y = 0,
w = -1,
h = -1;
265 if (!
rect.isNull()) {
268 w = std::max(
rect.width(), 1);
269 h = std::max(
rect.height(), 1);
332 return modalWindow && modalWindow !=
window();
342void QAndroidPlatformWindow::setSurface(JNIEnv *env, jobject
object, jint windowId,
343 QtJniTypes::Surface surface)
351 const QList<QWindow*> windows =
qGuiApp->allWindows();
362void QAndroidPlatformWindow::windowFocusChanged(JNIEnv *env, jobject
object,
363 jboolean
focus, jint windowId)
368 Q_ASSERT_X(
window,
"QAndroidPlatformWindow",
"windowFocusChanged event window should exist");
379 if (!env.registerNativeMethods(QtJniTypes::Traits<QtJniTypes::QtWindow>::className(),
381 Q_JNI_NATIVE_SCOPED_METHOD(setSurface, QAndroidPlatformWindow),
382 Q_JNI_NATIVE_SCOPED_METHOD(windowFocusChanged, QAndroidPlatformWindow)
384 qCCritical(lcQpaWindow) <<
"RegisterNatives failed for"
385 << 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.
AndroidBackendRegister * backendRegister()
@ 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