diff options
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm | 5 | ||||
-rw-r--r-- | src/plugins/platforms/qnx/qqnxwindow.cpp | 2 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsfontengine.cpp | 9 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.cpp | 13 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowswindow.h | 25 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.cpp | 1 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbconnection.h | 1 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbintegration.cpp | 44 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbintegration.h | 4 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 9 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbwindow.cpp | 10 |
11 files changed, 97 insertions, 26 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm index b1d9e4ebce..13b4085252 100644 --- a/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafontdialoghelper.mm @@ -142,6 +142,11 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSFontPanelDelegate); mDialogIsExecuting = false; mResultSet = false; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7 + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_7) + [mFontPanel setRestorable:NO]; +#endif + [mFontPanel setTitle:QCFString::toNSString(helper->options()->windowTitle())]; if (mHelper->options()->testOption(QFontDialogOptions::NoButtons)) { diff --git a/src/plugins/platforms/qnx/qqnxwindow.cpp b/src/plugins/platforms/qnx/qqnxwindow.cpp index e14f18b2c5..2bd5cfd801 100644 --- a/src/plugins/platforms/qnx/qqnxwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxwindow.cpp @@ -135,7 +135,7 @@ QQnxWindow::QQnxWindow(QWindow *window, screen_context_t context) if (result != 0) qFatal("QQnxWindow: failed to set window swap interval, errno=%d", errno); - if (window->flags() && Qt::WindowDoesNotAcceptFocus) { + if (window->flags() & Qt::WindowDoesNotAcceptFocus) { errno = 0; val = SCREEN_SENSITIVITY_NO_FOCUS; result = screen_set_window_property_iv(m_window, SCREEN_PROPERTY_SENSITIVITY, &val); diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 792e79df19..33ddcaffc5 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -1128,11 +1128,10 @@ QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph, } #else // else wince unsigned int options = 0; -#ifdef DEBUG - Q_ASSERT(!has_transformation); -#else - Q_UNUSED(has_transformation); -#endif + if (has_transformation) { + qWarning() << "QWindowsFontEngine is unable to apply transformations other than translations for fonts on Windows CE." + << "If you need them anyway, start your application with -platform windows:fontengine=freetype."; + } #endif // wince QWindowsNativeImage *ni = new QWindowsNativeImage(iw + 2 * margin + 4, ih + 2 * margin + 4, diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index c3ec949eef..dc51dbfc88 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -808,8 +808,12 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) : const Qt::WindowType type = aWindow->type(); if (type == Qt::Desktop) return; // No further handling for Qt::Desktop - if (aWindow->surfaceType() == QWindow::OpenGLSurface) + if (aWindow->surfaceType() == QWindow::OpenGLSurface) { setFlag(OpenGLSurface); +#ifdef QT_OPENGL_ES_2 + setFlag(OpenGL_ES2); +#endif + } if (aWindow->isTopLevel()) { switch (type) { case Qt::Window: @@ -1233,9 +1237,16 @@ void QWindowsWindow::handleGeometryChange() //Prevent recursive resizes for Windows CE if (testFlag(WithinSetStyle)) return; + const QRect previousGeometry = m_data.geometry; m_data.geometry = geometry_sys(); QPlatformWindow::setGeometry(m_data.geometry); QWindowSystemInterface::handleGeometryChange(window(), m_data.geometry); + // QTBUG-32121: OpenGL/normal windows (with exception of ANGLE) do not receive + // expose events when shrinking, synthesize. + if (!testFlag(OpenGL_ES2) && isExposed() + && !(m_data.geometry.width() > previousGeometry.width() || m_data.geometry.height() > previousGeometry.height())) { + fireExpose(QRegion(m_data.geometry), true); + } if (testFlag(SynchronousGeometryChangeEvent)) QWindowSystemInterface::flushWindowSystemEvents(); diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 07f3976d87..996542f92a 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -124,18 +124,19 @@ public: WithinSetParent = 0x2, FrameDirty = 0x4, //! Frame outdated by setStyle, recalculate in next query. OpenGLSurface = 0x10, - OpenGLDoubleBuffered = 0x20, - OpenGlPixelFormatInitialized = 0x40, - BlockedByModal = 0x80, - SizeGripOperation = 0x100, - FrameStrutEventsEnabled = 0x200, - SynchronousGeometryChangeEvent = 0x400, - WithinSetStyle = 0x800, - WithinDestroy = 0x1000, - TouchRegistered = 0x2000, - AlertState = 0x4000, - Exposed = 0x08000, - WithinCreate = 0x10000 + OpenGL_ES2 = 0x20, + OpenGLDoubleBuffered = 0x40, + OpenGlPixelFormatInitialized = 0x80, + BlockedByModal = 0x100, + SizeGripOperation = 0x200, + FrameStrutEventsEnabled = 0x400, + SynchronousGeometryChangeEvent = 0x800, + WithinSetStyle = 0x1000, + WithinDestroy = 0x2000, + TouchRegistered = 0x4000, + AlertState = 0x8000, + Exposed = 0x10000, + WithinCreate = 0x20000 }; struct WindowData diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 40e35acd5e..c4dd58667d 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -1232,6 +1232,7 @@ static const char * xcb_atomnames = { // ICCCM window state "WM_STATE\0" "WM_CHANGE_STATE\0" + "WM_CLASS\0" // Session management "WM_CLIENT_LEADER\0" diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 1662e862f1..8f568c6c25 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -102,6 +102,7 @@ namespace QXcbAtom { // ICCCM window state WM_STATE, WM_CHANGE_STATE, + WM_CLASS, // Session management WM_CLIENT_LEADER, diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 1c170d44e6..46077e2c3f 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -389,4 +389,48 @@ QVariant QXcbIntegration::styleHint(QPlatformIntegration::StyleHint hint) const return QPlatformIntegration::styleHint(hint); } +static QString argv0BaseName() +{ + QString result; + const QStringList arguments = QCoreApplication::arguments(); + if (!arguments.isEmpty() && !arguments.front().isEmpty()) { + result = arguments.front(); + const int lastSlashPos = result.lastIndexOf(QLatin1Char('/')); + if (lastSlashPos != -1) + result.remove(0, lastSlashPos + 1); + } + return result; +} + +static const char resourceNameVar[] = "RESOURCE_NAME"; + +QByteArray QXcbIntegration::wmClass() const +{ + if (m_wmClass.isEmpty()) { + // Instance name according to ICCCM 4.1.2.5 + QString name; + if (name.isEmpty() && qEnvironmentVariableIsSet(resourceNameVar)) + name = QString::fromLocal8Bit(qgetenv(resourceNameVar)); + if (name.isEmpty()) + name = argv0BaseName(); + + // Note: QCoreApplication::applicationName() cannot be called from the QGuiApplication constructor, + // hence this delayed initialization. + QString className = QCoreApplication::applicationName(); + if (className.isEmpty()) { + className = argv0BaseName(); + if (!className.isEmpty() && className.at(0).isLower()) + className[0] = className.at(0).toUpper(); + } + + if (!name.isEmpty() && !className.isEmpty()) { + m_wmClass = name.toLocal8Bit(); + m_wmClass.append('\0'); + m_wmClass.append(className.toLocal8Bit()); + m_wmClass.append('\0'); + } + } + return m_wmClass; +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index cc39fb1462..b884b3b7f2 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -99,6 +99,8 @@ public: QXcbConnection *defaultConnection() const { return m_connections.first(); } + QByteArray wmClass() const; + private: QList<QXcbConnection *> m_connections; @@ -115,6 +117,8 @@ private: QScopedPointer<QPlatformServices> m_services; friend class QXcbConnection; // access QPlatformIntegration::screenAdded() + + mutable QByteArray m_wmClass; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 7d832a1c08..9e9fd2914f 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -95,12 +95,9 @@ QXcbNativeInterface::QXcbNativeInterface() : void QXcbNativeInterface::beep() // For QApplication::beep() { -#ifdef XCB_USE_XLIB - ::Display *display = (::Display *)nativeResourceForScreen(QByteArrayLiteral("display"), QGuiApplication::primaryScreen()); - XBell(display, 0); -#else - fputc(7, stdout); -#endif + QPlatformScreen *screen = QGuiApplication::primaryScreen()->handle(); + xcb_connection_t *connection = static_cast<QXcbScreen *>(screen)->xcb_connection(); + xcb_bell(connection, 0); } void *QXcbNativeInterface::nativeResourceForIntegration(const QByteArray &resourceString) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 3a19788316..0325338a13 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -379,6 +379,13 @@ void QXcbWindow::create() m_syncValue.hi = 0; m_syncValue.lo = 0; + const QByteArray wmClass = static_cast<QXcbIntegration *>(QGuiApplicationPrivate::platformIntegration())->wmClass(); + if (!wmClass.isEmpty()) { + Q_XCB_CALL(xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, + m_window, atom(QXcbAtom::WM_CLASS), + XCB_ATOM_STRING, 8, wmClass.size(), wmClass.constData())); + } + if (m_usingSyncProtocol) { m_syncCounter = xcb_generate_id(xcb_connection()); Q_XCB_CALL(xcb_sync_create_counter(xcb_connection(), m_syncCounter, m_syncValue)); @@ -1636,7 +1643,8 @@ void QXcbWindow::handleButtonPressEvent(const xcb_button_press_event_t *event) { if (window() != QGuiApplication::focusWindow()) { QWindow *w = static_cast<QWindowPrivate *>(QObjectPrivate::get(window()))->eventReceiver(); - w->requestActivate(); + if (!(w->flags() & Qt::WindowDoesNotAcceptFocus)) + w->requestActivate(); } updateNetWmUserTime(event->time); |