summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/configure.json41
-rw-r--r--src/gui/kernel/qguiapplication.cpp16
-rw-r--r--src/gui/kernel/qguiapplication_p.h2
-rw-r--r--src/gui/kernel/qinputdevicemanager.cpp44
-rw-r--r--src/gui/kernel/qinputdevicemanager_p.h3
-rw-r--r--src/gui/kernel/qinputdevicemanager_p_p.h2
-rw-r--r--src/gui/kernel/qopenglcontext.cpp4
-rw-r--r--src/gui/kernel/qplatformwindow.cpp10
-rw-r--r--src/gui/kernel/qplatformwindow.h1
-rw-r--r--src/gui/kernel/qwindow_p.h2
-rw-r--r--src/gui/kernel/qwindowsysteminterface.cpp7
-rw-r--r--src/gui/kernel/qwindowsysteminterface.h3
-rw-r--r--src/gui/kernel/qwindowsysteminterface_p.h12
-rw-r--r--src/gui/painting/qcolor.cpp2
-rw-r--r--src/gui/painting/qcoregraphics_p.h10
15 files changed, 150 insertions, 9 deletions
diff --git a/src/gui/configure.json b/src/gui/configure.json
index 2c1fe6c86e..a7f08f2cc0 100644
--- a/src/gui/configure.json
+++ b/src/gui/configure.json
@@ -722,6 +722,33 @@
},
"use": "egl"
},
+ "egl-openwfd": {
+ "label": "OpenWFD EGL",
+ "type": "compile",
+ "test": {
+ "include": [ "wfd.h" ],
+ "main": [
+ "wfdEnumerateDevices(nullptr, 0, nullptr);"
+ ]
+ },
+ "use": "egl"
+ },
+ "egl-rcar": {
+ "label": "RCAR EGL",
+ "type": "compile",
+ "test": {
+ "include": [ "EGL/egl.h" ],
+ "tail": [
+ "extern \"C\" {",
+ "extern unsigned long PVRGrfxServerInit(void);",
+ "}"
+ ],
+ "main": [
+ "PVRGrfxServerInit();"
+ ]
+ },
+ "use": "egl opengl_es2"
+ },
"evdev": {
"label": "evdev",
"type": "compile",
@@ -952,7 +979,7 @@
"label": "IMF",
"emitIf": "config.qnx",
"condition": "libs.imf",
- "output": [ "privateConfig" ]
+ "output": [ "privateFeature" ]
},
"integrityfb": {
"label": "INTEGRITY framebuffer",
@@ -1119,11 +1146,21 @@
"condition": "features.eglfs && tests.egl-viv",
"output": [ "privateFeature" ]
},
+ "eglfs_rcar": {
+ "label": "EGLFS RCAR",
+ "condition": "config.integrity && features.eglfs && tests.egl-rcar",
+ "output": [ "privateFeature" ]
+ },
"eglfs_viv_wl": {
"label": "EGLFS i.Mx6 Wayland",
"condition": "features.eglfs_viv && libs.wayland_server",
"output": [ "privateFeature" ]
},
+ "eglfs_openwfd": {
+ "label": "EGLFS OpenWFD",
+ "condition": "config.integrity && features.eglfs && tests.egl-openwfd",
+ "output": [ "privateFeature" ]
+ },
"gif": {
"label": "GIF",
"condition": "features.imageformatplugin",
@@ -1610,7 +1647,7 @@ QMAKE_LIBDIR_OPENGL[_ES2] and QMAKE_LIBS_OPENGL[_ES2] in the mkspec for your pla
"section": "EGLFS details",
"condition": "features.eglfs",
"entries": [
- "eglfs_viv", "eglfs_viv_wl", "eglfs_egldevice", "eglfs_gbm", "eglfs_mali", "eglfs_brcm", "egl_x11"
+ "eglfs_openwfd", "eglfs_viv", "eglfs_viv_wl", "eglfs_rcar", "eglfs_egldevice", "eglfs_gbm", "eglfs_mali", "eglfs_brcm", "egl_x11"
]
},
"linuxfb", "vnc", "mirclient",
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index b26567ad0c..5baadd425f 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -1767,6 +1767,9 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
case QWindowSystemInterfacePrivate::WindowScreenChanged:
QGuiApplicationPrivate::processWindowScreenChangedEvent(static_cast<QWindowSystemInterfacePrivate::WindowScreenChangedEvent *>(e));
break;
+ case QWindowSystemInterfacePrivate::SafeAreaMarginsChanged:
+ QGuiApplicationPrivate::processSafeAreaMarginsChangedEvent(static_cast<QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent *>(e));
+ break;
case QWindowSystemInterfacePrivate::ApplicationStateChanged: {
QWindowSystemInterfacePrivate::ApplicationStateChangedEvent * changeEvent = static_cast<QWindowSystemInterfacePrivate::ApplicationStateChangedEvent *>(e);
QGuiApplicationPrivate::setApplicationState(changeEvent->newState, changeEvent->forcePropagate); }
@@ -2220,6 +2223,17 @@ void QGuiApplicationPrivate::processWindowScreenChangedEvent(QWindowSystemInterf
}
}
+void QGuiApplicationPrivate::processSafeAreaMarginsChangedEvent(QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent *wse)
+{
+ if (wse->window.isNull())
+ return;
+
+ // Handle by forwarding directly to QWindowPrivate, instead of sending spontaneous
+ // QEvent like most other functions, as there's no QEvent type for the safe area
+ // change, and we don't want to add one until we know that this is a good API.
+ qt_window_private(wse->window)->processSafeAreaMarginsChanged();
+}
+
void QGuiApplicationPrivate::processThemeChanged(QWindowSystemInterfacePrivate::ThemeChangeEvent *tce)
{
if (self)
@@ -2887,7 +2901,7 @@ QPlatformDragQtResponse QGuiApplicationPrivate::processDrag(QWindow *w, const QM
static QPointer<QWindow> currentDragWindow;
static Qt::DropAction lastAcceptedDropAction = Qt::IgnoreAction;
QPlatformDrag *platformDrag = platformIntegration()->drag();
- if (!platformDrag) {
+ if (!platformDrag || (w && w->d_func()->blockedByModalWindow)) {
lastAcceptedDropAction = Qt::IgnoreAction;
return QPlatformDragQtResponse(false, lastAcceptedDropAction, QRect());
}
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 014ed861df..becaa7ceb3 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -133,6 +133,8 @@ public:
static void processWindowStateChangedEvent(QWindowSystemInterfacePrivate::WindowStateChangedEvent *e);
static void processWindowScreenChangedEvent(QWindowSystemInterfacePrivate::WindowScreenChangedEvent *e);
+ static void processSafeAreaMarginsChangedEvent(QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent *e);
+
static void processWindowSystemEvent(QWindowSystemInterfacePrivate::WindowSystemEvent *e);
static void updateFilteredScreenOrientation(QScreen *screen);
diff --git a/src/gui/kernel/qinputdevicemanager.cpp b/src/gui/kernel/qinputdevicemanager.cpp
index 2d231ae26f..37b1450d5a 100644
--- a/src/gui/kernel/qinputdevicemanager.cpp
+++ b/src/gui/kernel/qinputdevicemanager.cpp
@@ -92,4 +92,48 @@ void QInputDeviceManager::setCursorPos(const QPoint &pos)
emit cursorPositionChangeRequested(pos);
}
+/*!
+ \return the keyboard modifier state stored in the QInputDeviceManager object.
+
+ Keyboard input handlers are expected to keep this up-to-date via
+ setKeyboardModifiers().
+
+ Querying the state via this function (e.g. from a mouse handler that needs
+ to include the modifier state in mouse events) is the preferred alternative
+ over QGuiApplication::keyboardModifiers() since the latter may not report
+ the current state due to asynchronous QPA event processing.
+ */
+Qt::KeyboardModifiers QInputDeviceManager::keyboardModifiers() const
+{
+ Q_D(const QInputDeviceManager);
+ return d->keyboardModifiers;
+}
+
+void QInputDeviceManager::setKeyboardModifiers(Qt::KeyboardModifiers modsBeforeEvent, int key)
+{
+ Q_D(QInputDeviceManager);
+ Qt::KeyboardModifiers mods;
+ switch (key) {
+ case Qt::Key_Shift:
+ mods = Qt::KeyboardModifiers(modsBeforeEvent ^ Qt::ShiftModifier);
+ break;
+ case Qt::Key_Control:
+ mods = Qt::KeyboardModifiers(modsBeforeEvent ^ Qt::ControlModifier);
+ break;
+ case Qt::Key_Alt:
+ mods = Qt::KeyboardModifiers(modsBeforeEvent ^ Qt::AltModifier);
+ break;
+ case Qt::Key_Meta:
+ mods = Qt::KeyboardModifiers(modsBeforeEvent ^ Qt::MetaModifier);
+ break;
+ case Qt::Key_AltGr:
+ mods = Qt::KeyboardModifiers(modsBeforeEvent ^ Qt::GroupSwitchModifier);
+ break;
+ default:
+ mods = modsBeforeEvent;
+ break;
+ }
+ d->keyboardModifiers = mods;
+}
+
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qinputdevicemanager_p.h b/src/gui/kernel/qinputdevicemanager_p.h
index db9d0596b6..ddf1e6befa 100644
--- a/src/gui/kernel/qinputdevicemanager_p.h
+++ b/src/gui/kernel/qinputdevicemanager_p.h
@@ -78,6 +78,9 @@ public:
void setCursorPos(const QPoint &pos);
+ Qt::KeyboardModifiers keyboardModifiers() const;
+ void setKeyboardModifiers(Qt::KeyboardModifiers modsBeforeEvent, int key);
+
signals:
void deviceListChanged(QInputDeviceManager::DeviceType type);
void cursorPositionChangeRequested(const QPoint &pos);
diff --git a/src/gui/kernel/qinputdevicemanager_p_p.h b/src/gui/kernel/qinputdevicemanager_p_p.h
index ae91f3a2ab..0a91252fbc 100644
--- a/src/gui/kernel/qinputdevicemanager_p_p.h
+++ b/src/gui/kernel/qinputdevicemanager_p_p.h
@@ -69,6 +69,8 @@ public:
void setDeviceCount(QInputDeviceManager::DeviceType type, int count);
QMap<QInputDeviceManager::DeviceType, int> m_deviceCount;
+
+ Qt::KeyboardModifiers keyboardModifiers;
};
QT_END_NAMESPACE
diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp
index 6298dd5f45..27ea3864b9 100644
--- a/src/gui/kernel/qopenglcontext.cpp
+++ b/src/gui/kernel/qopenglcontext.cpp
@@ -937,7 +937,9 @@ GLuint QOpenGLContext::defaultFramebufferObject() const
/*!
Makes the context current in the current thread, against the given
- \a surface. Returns \c true if successful.
+ \a surface. Returns \c true if successful; otherwise returns \c false.
+ The latter may happen if the surface is not exposed, or the graphics
+ hardware is not available due to e.g. the application being suspended.
If \a surface is 0 this is equivalent to calling doneCurrent().
diff --git a/src/gui/kernel/qplatformwindow.cpp b/src/gui/kernel/qplatformwindow.cpp
index ae39411729..7a4be7b8a8 100644
--- a/src/gui/kernel/qplatformwindow.cpp
+++ b/src/gui/kernel/qplatformwindow.cpp
@@ -166,6 +166,16 @@ QMargins QPlatformWindow::frameMargins() const
}
/*!
+ The safe area margins of a window represent the area that is safe to
+ place content within, without intersecting areas of the screen where
+ system UI is placed, or where a screen bezel may cover the content.
+*/
+QMargins QPlatformWindow::safeAreaMargins() const
+{
+ return QMargins();
+}
+
+/*!
Reimplemented in subclasses to show the surface
if \a visible is \c true, and hide it if \a visible is \c false.
diff --git a/src/gui/kernel/qplatformwindow.h b/src/gui/kernel/qplatformwindow.h
index dff8f618e2..cf5f38d249 100644
--- a/src/gui/kernel/qplatformwindow.h
+++ b/src/gui/kernel/qplatformwindow.h
@@ -88,6 +88,7 @@ public:
virtual QRect normalGeometry() const;
virtual QMargins frameMargins() const;
+ virtual QMargins safeAreaMargins() const;
virtual void setVisible(bool visible);
virtual void setWindowFlags(Qt::WindowFlags flags);
diff --git a/src/gui/kernel/qwindow_p.h b/src/gui/kernel/qwindow_p.h
index 2de5aab2c4..7ef73eb410 100644
--- a/src/gui/kernel/qwindow_p.h
+++ b/src/gui/kernel/qwindow_p.h
@@ -155,6 +155,8 @@ public:
virtual void clearFocusObject();
virtual QRectF closestAcceptableGeometry(const QRectF &rect) const;
+ virtual void processSafeAreaMarginsChanged() {};
+
bool isPopup() const { return (windowFlags & Qt::WindowType_Mask) == Qt::Popup; }
static QWindowPrivate *get(QWindow *window) { return window->d_func(); }
diff --git a/src/gui/kernel/qwindowsysteminterface.cpp b/src/gui/kernel/qwindowsysteminterface.cpp
index 2cecb444c3..c47d940e4a 100644
--- a/src/gui/kernel/qwindowsysteminterface.cpp
+++ b/src/gui/kernel/qwindowsysteminterface.cpp
@@ -265,6 +265,13 @@ void QWindowSystemInterface::handleWindowScreenChanged(QWindow *window, QScreen
QWindowSystemInterfacePrivate::handleWindowSystemEvent(e);
}
+QT_DEFINE_QPA_EVENT_HANDLER(void, handleSafeAreaMarginsChanged, QWindow *window)
+{
+ QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent *e =
+ new QWindowSystemInterfacePrivate::SafeAreaMarginsChangedEvent(window);
+ QWindowSystemInterfacePrivate::handleWindowSystemEvent<Delivery>(e);
+}
+
QT_DEFINE_QPA_EVENT_HANDLER(void, handleApplicationStateChanged, Qt::ApplicationState newState, bool forcePropagate)
{
Q_ASSERT(QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ApplicationState));
diff --git a/src/gui/kernel/qwindowsysteminterface.h b/src/gui/kernel/qwindowsysteminterface.h
index b1ca6238cb..bd6416cc95 100644
--- a/src/gui/kernel/qwindowsysteminterface.h
+++ b/src/gui/kernel/qwindowsysteminterface.h
@@ -181,6 +181,9 @@ public:
static void handleWindowScreenChanged(QWindow *window, QScreen *newScreen);
template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
+ static void handleSafeAreaMarginsChanged(QWindow *window);
+
+ template<typename Delivery = QWindowSystemInterface::DefaultDelivery>
static void handleApplicationStateChanged(Qt::ApplicationState newState, bool forcePropagate = false);
#ifndef QT_NO_DRAGANDDROP
diff --git a/src/gui/kernel/qwindowsysteminterface_p.h b/src/gui/kernel/qwindowsysteminterface_p.h
index 6a1360a26a..f781d6e3b8 100644
--- a/src/gui/kernel/qwindowsysteminterface_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_p.h
@@ -98,7 +98,8 @@ public:
#endif
ApplicationStateChanged = 0x19,
FlushEvents = 0x20,
- WindowScreenChanged = 0x21
+ WindowScreenChanged = 0x21,
+ SafeAreaMarginsChanged = 0x22
};
class WindowSystemEvent {
@@ -185,6 +186,15 @@ public:
QPointer<QScreen> screen;
};
+ class SafeAreaMarginsChangedEvent : public WindowSystemEvent {
+ public:
+ SafeAreaMarginsChangedEvent(QWindow *w)
+ : WindowSystemEvent(SafeAreaMarginsChanged), window(w)
+ { }
+
+ QPointer<QWindow> window;
+ };
+
class ApplicationStateChangedEvent : public WindowSystemEvent {
public:
ApplicationStateChangedEvent(Qt::ApplicationState newState, bool forcePropagate = false)
diff --git a/src/gui/painting/qcolor.cpp b/src/gui/painting/qcolor.cpp
index 855f245396..c55bcb12c9 100644
--- a/src/gui/painting/qcolor.cpp
+++ b/src/gui/painting/qcolor.cpp
@@ -853,7 +853,7 @@ QString QColor::name(NameFormat format) const
return QLatin1Char('#') + QString::number(rgba() | 0x1000000, 16).rightRef(6);
case HexArgb:
// it's called rgba() but it does return AARRGGBB
- return QLatin1Char('#') + QString::number(rgba() | 0x100000000, 16).rightRef(8);
+ return QLatin1Char('#') + QString::number(rgba() | Q_INT64_C(0x100000000), 16).rightRef(8);
}
return QString();
}
diff --git a/src/gui/painting/qcoregraphics_p.h b/src/gui/painting/qcoregraphics_p.h
index d74c4d0711..6b6a1e800e 100644
--- a/src/gui/painting/qcoregraphics_p.h
+++ b/src/gui/painting/qcoregraphics_p.h
@@ -56,13 +56,15 @@
#include <QtGui/qpalette.h>
#include <CoreGraphics/CoreGraphics.h>
-#ifdef Q_OS_MACOS
+
+#if defined(__OBJC__) && defined(Q_OS_MACOS)
#include <AppKit/AppKit.h>
+#define HAVE_APPKIT
#endif
QT_BEGIN_NAMESPACE
-#ifdef Q_OS_MACOS
+#ifdef HAVE_APPKIT
Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QPixmap &pm);
Q_GUI_EXPORT NSImage *qt_mac_create_nsimage(const QIcon &icon, int defaultSize = 0);
Q_GUI_EXPORT QPixmap qt_mac_toQPixmap(const NSImage *image, const QSizeF &size);
@@ -78,7 +80,7 @@ Q_GUI_EXPORT CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *
Q_GUI_EXPORT void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransform *orig_xform);
-#ifdef Q_OS_MACOS
+#ifdef HAVE_APPKIT
Q_GUI_EXPORT QColor qt_mac_toQColor(const NSColor *color);
Q_GUI_EXPORT QBrush qt_mac_toQBrush(const NSColor *color, QPalette::ColorGroup colorGroup = QPalette::Normal);
#endif
@@ -124,4 +126,6 @@ private:
QT_END_NAMESPACE
+#undef HAVE_APPKIT
+
#endif // QCOREGRAPHICS_P_H