summaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/platforms/android/androidjnimenu.cpp9
-rw-r--r--src/plugins/platforms/android/androidjnimenu.h1
-rw-r--r--src/plugins/platforms/android/qandroidplatformtheme.cpp6
-rw-r--r--src/plugins/platforms/android/qandroidplatformtheme.h1
-rw-r--r--src/plugins/platforms/cocoa/qcocoaaccessibility.mm6
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm11
-rw-r--r--src/plugins/platforms/directfb/qdirectfbblitter.cpp124
-rw-r--r--src/plugins/platforms/directfb/qdirectfbblitter.h16
-rw-r--r--src/plugins/platforms/directfb/qdirectfbintegration.cpp13
-rw-r--r--src/plugins/platforms/directfb/qdirectfbintegration.h2
-rw-r--r--src/plugins/platforms/directfb/qdirectfbwindow.cpp2
-rw-r--r--src/plugins/platforms/eglfs/qeglfshooks_stub.cpp4
-rw-r--r--src/plugins/platforms/kms/qkmsbackingstore.cpp5
-rw-r--r--src/plugins/platforms/windows/accessible/iaccessible2.cpp7
-rw-r--r--src/plugins/platforms/xcb/qglxintegration.cpp8
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.cpp5
-rw-r--r--src/plugins/platforms/xcb/qxcbbackingstore.h3
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.cpp13
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection.h6
-rw-r--r--src/plugins/platforms/xcb/qxcbconnection_xi2.cpp97
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.cpp9
-rw-r--r--src/plugins/platforms/xcb/qxcbnativeinterface.h4
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp78
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.h8
-rw-r--r--src/plugins/platformthemes/gtk2/qgtk2theme.cpp8
-rw-r--r--src/plugins/platformthemes/gtk2/qgtk2theme.h3
26 files changed, 349 insertions, 100 deletions
diff --git a/src/plugins/platforms/android/androidjnimenu.cpp b/src/plugins/platforms/android/androidjnimenu.cpp
index 6a979b9255..9dc8395888 100644
--- a/src/plugins/platforms/android/androidjnimenu.cpp
+++ b/src/plugins/platforms/android/androidjnimenu.cpp
@@ -68,6 +68,7 @@ namespace QtAndroidMenu
static jmethodID openContextMenuMethodID = 0;
static jmethodID closeContextMenuMethodID = 0;
static jmethodID resetOptionsMenuMethodID = 0;
+ static jmethodID openOptionsMenuMethodID = 0;
static jmethodID clearMenuMethodID = 0;
static jmethodID addMenuItemMethodID = 0;
@@ -87,6 +88,13 @@ namespace QtAndroidMenu
env.jniEnv->CallStaticVoidMethod(applicationClass(), resetOptionsMenuMethodID);
}
+ void openOptionsMenu()
+ {
+ AttachedJNIEnv env;
+ if (env.jniEnv)
+ env.jniEnv->CallStaticVoidMethod(applicationClass(), openOptionsMenuMethodID);
+ }
+
void showContextMenu(QAndroidPlatformMenu *menu, JNIEnv *env)
{
QMutexLocker lock(&visibleMenuMutex);
@@ -409,6 +417,7 @@ namespace QtAndroidMenu
GET_AND_CHECK_STATIC_METHOD(openContextMenuMethodID, appClass, "openContextMenu", "()V");
GET_AND_CHECK_STATIC_METHOD(closeContextMenuMethodID, appClass, "closeContextMenu", "()V");
GET_AND_CHECK_STATIC_METHOD(resetOptionsMenuMethodID, appClass, "resetOptionsMenu", "()V");
+ GET_AND_CHECK_STATIC_METHOD(openOptionsMenuMethodID, appClass, "openOptionsMenu", "()V");
jclass clazz;
FIND_AND_CHECK_CLASS("android/view/Menu");
diff --git a/src/plugins/platforms/android/androidjnimenu.h b/src/plugins/platforms/android/androidjnimenu.h
index 2ae406901a..3ca0fb555f 100644
--- a/src/plugins/platforms/android/androidjnimenu.h
+++ b/src/plugins/platforms/android/androidjnimenu.h
@@ -55,6 +55,7 @@ class QWindow;
namespace QtAndroidMenu
{
// Menu support
+ void openOptionsMenu();
void showContextMenu(QAndroidPlatformMenu *menu, JNIEnv *env = 0);
void hideContextMenu(QAndroidPlatformMenu *menu);
void syncMenu(QAndroidPlatformMenu *menu);
diff --git a/src/plugins/platforms/android/qandroidplatformtheme.cpp b/src/plugins/platforms/android/qandroidplatformtheme.cpp
index 1c9be189c8..b24085f5ea 100644
--- a/src/plugins/platforms/android/qandroidplatformtheme.cpp
+++ b/src/plugins/platforms/android/qandroidplatformtheme.cpp
@@ -39,6 +39,7 @@
**
****************************************************************************/
+#include "androidjnimenu.h"
#include "qandroidplatformtheme.h"
#include "qandroidplatformmenubar.h"
#include "qandroidplatformmenu.h"
@@ -104,6 +105,11 @@ QPlatformMenuItem *QAndroidPlatformTheme::createPlatformMenuItem() const
return new QAndroidPlatformMenuItem;
}
+void QAndroidPlatformTheme::showPlatformMenuBar()
+{
+ QtAndroidMenu::openOptionsMenu();
+}
+
static inline int paletteType(QPlatformTheme::Palette type)
{
switch (type) {
diff --git a/src/plugins/platforms/android/qandroidplatformtheme.h b/src/plugins/platforms/android/qandroidplatformtheme.h
index c37c9986c6..786e7e5650 100644
--- a/src/plugins/platforms/android/qandroidplatformtheme.h
+++ b/src/plugins/platforms/android/qandroidplatformtheme.h
@@ -55,6 +55,7 @@ public:
virtual QPlatformMenuBar *createPlatformMenuBar() const;
virtual QPlatformMenu *createPlatformMenu() const;
virtual QPlatformMenuItem *createPlatformMenuItem() const;
+ virtual void showPlatformMenuBar();
virtual const QPalette *palette(Palette type = SystemPalette) const;
virtual const QFont *font(Font type = SystemFont) const;
virtual QVariant themeHint(ThemeHint hint) const;
diff --git a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
index 8f83b0fe30..204e0ed98b 100644
--- a/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
+++ b/src/plugins/platforms/cocoa/qcocoaaccessibility.mm
@@ -152,6 +152,12 @@ static void populateRoleMap()
roleMap[QAccessible::Paragraph] = NSAccessibilityGroupRole;
roleMap[QAccessible::Section] = NSAccessibilityGroupRole;
roleMap[QAccessible::WebDocument] = NSAccessibilityGroupRole;
+ roleMap[QAccessible::ColorChooser] = NSAccessibilityColorWellRole;
+ roleMap[QAccessible::Footer] = NSAccessibilityGroupRole;
+ roleMap[QAccessible::Form] = NSAccessibilityGroupRole;
+ roleMap[QAccessible::Heading] = @"AXHeading";
+ roleMap[QAccessible::Note] = NSAccessibilityGroupRole;
+ roleMap[QAccessible::ComplementaryContent] = NSAccessibilityGroupRole;
}
/*
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index e3916ea787..894c2c1168 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -97,13 +97,10 @@ CGImageRef qt_mac_toCGImage(const QImage &inImage)
if (inImage.isNull())
return 0;
- QImage image = (inImage.depth() == 32) ? inImage : inImage.convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ QImage image = inImage;
uint cgflags = kCGImageAlphaNone;
switch (image.format()) {
- case QImage::Format_ARGB32_Premultiplied:
- cgflags = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host;
- break;
case QImage::Format_ARGB32:
cgflags = kCGImageAlphaFirst | kCGBitmapByteOrder32Host;
break;
@@ -123,7 +120,11 @@ CGImageRef qt_mac_toCGImage(const QImage &inImage)
cgflags = kCGImageAlphaNoneSkipLast | kCGBitmapByteOrder32Big;
break;
default:
- Q_ASSERT(false); // Should never be reached.
+ // Everything not recognized explicitly is converted to ARGB32_Premultiplied.
+ image = inImage.convertToFormat(QImage::Format_ARGB32_Premultiplied);
+ // no break;
+ case QImage::Format_ARGB32_Premultiplied:
+ cgflags = kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host;
break;
}
diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.cpp b/src/plugins/platforms/directfb/qdirectfbblitter.cpp
index 46f811f816..bc6e4d70e9 100644
--- a/src/plugins/platforms/directfb/qdirectfbblitter.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbblitter.cpp
@@ -58,7 +58,9 @@ static QBlittable::Capabilities dfb_blitter_capabilities()
|QBlittable::SourceOverPixmapCapability
|QBlittable::SourceOverScaledPixmapCapability
|QBlittable::AlphaFillRectCapability
- |QBlittable::OpacityPixmapCapability);
+ |QBlittable::OpacityPixmapCapability
+ |QBlittable::DrawScaledCachedGlyphsCapability
+ );
}
QDirectFbBlitter::QDirectFbBlitter(const QSize &rect, IDirectFBSurface *surface)
@@ -210,6 +212,86 @@ void QDirectFbBlitter::drawPixmapOpacity(const QRectF &rect, const QPixmap &pixm
DirectFBError("QDirectFBBlitter::drawPixmapExtended()", result);
}
+bool QDirectFbBlitter::drawCachedGlyphs(const QPaintEngineState *state, QFontEngine::GlyphFormat glyphFormat, int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine)
+{
+ void *cacheKey = QDirectFbConvenience::dfbInterface();
+
+ QDirectFbTextureGlyphCache *cache =
+ static_cast<QDirectFbTextureGlyphCache *>(fontEngine->glyphCache(cacheKey, glyphFormat, state->transform()));
+ if (!cache) {
+ cache = new QDirectFbTextureGlyphCache(glyphFormat, state->transform());
+ fontEngine->setGlyphCache(cacheKey, cache);
+ }
+
+ cache->populate(fontEngine, numGlyphs, glyphs, positions);
+ cache->fillInPendingGlyphs();
+
+ if (cache->image().width() == 0 || cache->image().height() == 0)
+ return false;
+
+ const int margin = fontEngine->glyphMargin(glyphFormat);
+
+ QVarLengthArray<DFBRectangle, 64> sourceRects(numGlyphs);
+ QVarLengthArray<DFBPoint, 64> destPoints(numGlyphs);
+ int nGlyphs = 0;
+
+ for (int i=0; i<numGlyphs; ++i) {
+
+ QFixed subPixelPosition = fontEngine->subPixelPositionForX(positions[i].x);
+ QTextureGlyphCache::GlyphAndSubPixelPosition glyph(glyphs[i], subPixelPosition);
+ const QTextureGlyphCache::Coord &c = cache->coords[glyph];
+ if (c.isNull())
+ continue;
+
+ int x = qFloor(positions[i].x) + c.baseLineX - margin;
+ int y = qRound(positions[i].y) - c.baseLineY - margin;
+
+ // printf("drawing [%d %d %d %d] baseline [%d %d], glyph: %d, to: %d %d, pos: %d %d\n",
+ // c.x, c.y,
+ // c.w, c.h,
+ // c.baseLineX, c.baseLineY,
+ // glyphs[i],
+ // x, y,
+ // positions[i].x.toInt(), positions[i].y.toInt());
+
+ sourceRects[nGlyphs].x = c.x;
+ sourceRects[nGlyphs].y = c.y;
+ sourceRects[nGlyphs].w = c.w;
+ sourceRects[nGlyphs].h = c.h;
+ destPoints[nGlyphs].x = x;
+ destPoints[nGlyphs].y = y;
+ ++nGlyphs;
+ }
+
+ const QColor color = state->pen().color();
+ m_surface->SetColor(m_surface.data(), color.red(), color.green(), color.blue(), color.alpha());
+
+ m_surface->SetSrcBlendFunction(m_surface.data(), DSBF_SRCALPHA);
+ m_surface->SetDstBlendFunction(m_surface.data(), DSBF_INVSRCALPHA);
+
+ int flags = DSBLIT_BLEND_ALPHACHANNEL | DSBLIT_COLORIZE;
+ if (color.alpha() != 0xff)
+ flags |= DSBLIT_BLEND_COLORALPHA;
+ m_surface->SetBlittingFlags(m_surface.data(), DFBSurfaceBlittingFlags(flags));
+
+ const QRasterPaintEngineState *rs = static_cast<const QRasterPaintEngineState*>(state);
+ if (rs->clip && rs->clip->enabled) {
+ Q_ASSERT(rs->clip->hasRectClip);
+ DFBRegion dfbClip;
+ dfbClip.x1 = rs->clip->clipRect.x();
+ dfbClip.y1 = rs->clip->clipRect.y();
+ dfbClip.x2 = rs->clip->clipRect.right();
+ dfbClip.y2 = rs->clip->clipRect.bottom();
+ m_surface->SetClip(m_surface.data(), &dfbClip);
+ }
+
+ m_surface->BatchBlit(m_surface.data(), cache->sourceSurface(), sourceRects.constData(), destPoints.constData(), nGlyphs);
+
+ if (rs->clip && rs->clip->enabled)
+ m_surface->SetClip(m_surface.data(), 0);
+ return true;
+}
+
QImage *QDirectFbBlitter::doLock()
{
Q_ASSERT(m_surface);
@@ -321,4 +403,44 @@ void QDirectFbBlitter::doUnlock()
m_surface->Unlock(m_surface.data());
}
+void QDirectFbTextureGlyphCache::resizeTextureData(int width, int height)
+{
+ m_surface.reset();;
+ QImageTextureGlyphCache::resizeTextureData(width, height);
+}
+
+IDirectFBSurface *QDirectFbTextureGlyphCache::sourceSurface()
+{
+ if (m_surface.isNull()) {
+ const QImage &source = image();
+ DFBSurfaceDescription desc;
+ memset(&desc, 0, sizeof(desc));
+ desc.flags = DFBSurfaceDescriptionFlags(DSDESC_WIDTH | DSDESC_HEIGHT | DSDESC_PIXELFORMAT | DSDESC_PREALLOCATED | DSDESC_CAPS);
+ desc.width = source.width();
+ desc.height = source.height();
+ desc.caps = DSCAPS_SYSTEMONLY;
+
+ switch (source.format()) {
+ case QImage::Format_Mono:
+ desc.pixelformat = DSPF_A1;
+ break;
+ case QImage::Format_Indexed8:
+ desc.pixelformat = DSPF_A8;
+ break;
+ default:
+ qFatal("QDirectFBTextureGlyphCache: Unsupported source texture image format.");
+ break;
+ }
+
+ desc.preallocated[0].data = const_cast<void*>(static_cast<const void*>(source.bits()));
+ desc.preallocated[0].pitch = source.bytesPerLine();
+ desc.preallocated[1].data = 0;
+ desc.preallocated[1].pitch = 0;
+
+ IDirectFB *dfb = QDirectFbConvenience::dfbInterface();
+ dfb->CreateSurface(dfb , &desc, m_surface.outPtr());
+ }
+ return m_surface.data();
+}
+
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/directfb/qdirectfbblitter.h b/src/plugins/platforms/directfb/qdirectfbblitter.h
index 0255040729..c60f0fac25 100644
--- a/src/plugins/platforms/directfb/qdirectfbblitter.h
+++ b/src/plugins/platforms/directfb/qdirectfbblitter.h
@@ -61,6 +61,7 @@ public:
virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect);
void alphaFillRect(const QRectF &rect, const QColor &color, QPainter::CompositionMode cmode);
void drawPixmapOpacity(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect, QPainter::CompositionMode cmode, qreal opacity);
+ virtual bool drawCachedGlyphs(const QPaintEngineState *state, QFontEngine::GlyphFormat glyphFormat, int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine);
IDirectFBSurface *dfbSurface() const;
@@ -110,6 +111,21 @@ inline IDirectFBSurface *QDirectFbBlitter::dfbSurface() const
return m_surface.data();
}
+class QDirectFbTextureGlyphCache : public QImageTextureGlyphCache
+{
+public:
+ QDirectFbTextureGlyphCache(QFontEngine::GlyphFormat format, const QTransform &matrix)
+ : QImageTextureGlyphCache(format, matrix)
+ {}
+
+ virtual void resizeTextureData(int width, int height);
+
+ IDirectFBSurface *sourceSurface();
+
+private:
+ QDirectFBPointer<IDirectFBSurface> m_surface;
+};
+
QT_END_NAMESPACE
#endif // QDIRECTFBBLITTER_H
diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.cpp b/src/plugins/platforms/directfb/qdirectfbintegration.cpp
index 3d1b79ef38..27d070b75d 100644
--- a/src/plugins/platforms/directfb/qdirectfbintegration.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbintegration.cpp
@@ -71,6 +71,19 @@ void QDirectFbIntegration::connectToDirectFb()
initializeInput();
}
+bool QDirectFbIntegration::hasCapability(Capability cap) const
+{
+ switch (cap) {
+ case ThreadedPixmaps: return true;
+ case MultipleWindows: return true;
+#ifdef DIRECTFB_GL_EGL
+ case OpenGL: return true;
+ case ThreadedOpenGL: return true;
+#endif
+ default: return QPlatformIntegration::hasCapability(cap);
+ }
+}
+
void QDirectFbIntegration::initializeDirectFB()
{
const QStringList args = QCoreApplication::arguments();
diff --git a/src/plugins/platforms/directfb/qdirectfbintegration.h b/src/plugins/platforms/directfb/qdirectfbintegration.h
index b49600bed9..8586f33587 100644
--- a/src/plugins/platforms/directfb/qdirectfbintegration.h
+++ b/src/plugins/platforms/directfb/qdirectfbintegration.h
@@ -62,6 +62,7 @@ public:
void connectToDirectFb();
+ bool hasCapability(Capability cap) const;
QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const;
QPlatformWindow *createPlatformWindow(QWindow *window) const;
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const;
@@ -80,6 +81,7 @@ protected:
QScopedPointer<QDirectFbInput> m_input;
QScopedPointer<QThread> m_inputRunner;
QScopedPointer<QPlatformFontDatabase> m_fontDb;
+
};
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/directfb/qdirectfbwindow.cpp b/src/plugins/platforms/directfb/qdirectfbwindow.cpp
index 8d7eeb3cd9..6bdfc9f161 100644
--- a/src/plugins/platforms/directfb/qdirectfbwindow.cpp
+++ b/src/plugins/platforms/directfb/qdirectfbwindow.cpp
@@ -137,7 +137,7 @@ void QDirectFbWindow::setVisible(bool visible)
}
if (window()->isTopLevel() && visible)
- QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(0, 0), window()->geometry()));
+ QWindowSystemInterface::handleExposeEvent(window(), QRect(QPoint(0, 0), window()->geometry().size()));
}
void QDirectFbWindow::setWindowFlags(Qt::WindowFlags flags)
diff --git a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
index 4aa3f29260..5405db7959 100644
--- a/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
+++ b/src/plugins/platforms/eglfs/qeglfshooks_stub.cpp
@@ -85,8 +85,10 @@ void QEglFSHooks::platformInit()
framebuffer = qt_safe_open(fbDev, O_RDONLY);
- if (framebuffer == -1)
+ if (framebuffer == -1) {
qWarning("EGLFS: Failed to open %s", qPrintable(fbDev));
+ qFatal("EGLFS: Can't continue without a display");
+ }
}
void QEglFSHooks::platformDestroy()
diff --git a/src/plugins/platforms/kms/qkmsbackingstore.cpp b/src/plugins/platforms/kms/qkmsbackingstore.cpp
index fa4ef847cd..143693ba74 100644
--- a/src/plugins/platforms/kms/qkmsbackingstore.cpp
+++ b/src/plugins/platforms/kms/qkmsbackingstore.cpp
@@ -203,6 +203,11 @@ void QKmsBackingStore::resize(const QSize &size, const QRegion &staticContents)
m_context->makeCurrent(window());
+ if (!m_initialized) {
+ initializeOpenGLFunctions();
+ m_initialized = true;
+ }
+
if (m_texture)
glDeleteTextures(1, &m_texture);
diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.cpp b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
index 20658f9cad..dcb137c09e 100644
--- a/src/plugins/platforms/windows/accessible/iaccessible2.cpp
+++ b/src/plugins/platforms/windows/accessible/iaccessible2.cpp
@@ -1706,6 +1706,13 @@ QByteArray QWindowsIA2Accessible::IIDToString(REFIID id)
return strGuid;
}
+// Q_STATIC_ASSERT(IA2_ROLE_CANVAS == QAccessible::Canvas); // ### Qt 6: make them the same
+Q_STATIC_ASSERT(IA2_ROLE_COLOR_CHOOSER == QAccessible::ColorChooser);
+Q_STATIC_ASSERT(IA2_ROLE_FOOTER == QAccessible::Footer);
+Q_STATIC_ASSERT(IA2_ROLE_FORM == QAccessible::Form);
+Q_STATIC_ASSERT(IA2_ROLE_HEADING == QAccessible::Heading);
+Q_STATIC_ASSERT(IA2_ROLE_NOTE == QAccessible::Note);
+Q_STATIC_ASSERT(IA2_ROLE_COMPLEMENTARY_CONTENT == QAccessible::ComplementaryContent);
QT_END_NAMESPACE
diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp
index 3ce0041aeb..d6fe5f3477 100644
--- a/src/plugins/platforms/xcb/qglxintegration.cpp
+++ b/src/plugins/platforms/xcb/qglxintegration.cpp
@@ -213,17 +213,17 @@ void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share)
QVector<int> glVersions;
if (m_format.renderableType() == QSurfaceFormat::OpenGL) {
- if (requestedVersion > 43)
+ if (requestedVersion > 45)
glVersions << requestedVersion;
// Don't bother with versions below 2.0
- glVersions << 43 << 42 << 41 << 40 << 33 << 32 << 31 << 30 << 21 << 20;
+ glVersions << 45 << 44 << 43 << 42 << 41 << 40 << 33 << 32 << 31 << 30 << 21 << 20;
} else if (m_format.renderableType() == QSurfaceFormat::OpenGLES) {
- if (requestedVersion > 30)
+ if (requestedVersion > 31)
glVersions << requestedVersion;
// Don't bother with versions below ES 2.0
- glVersions << 30 << 20;
+ glVersions << 31 << 30 << 20;
// ES does not support any format option
m_format.setOptions(QSurfaceFormat::FormatOptions());
}
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
index ada5b0eedf..6258b29fc7 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp
@@ -337,9 +337,10 @@ void QXcbBackingStore::flush(QWindow *window, const QRegion &region, const QPoin
#ifndef QT_NO_OPENGL
void QXcbBackingStore::composeAndFlush(QWindow *window, const QRegion &region, const QPoint &offset,
- QPlatformTextureList *textures, QOpenGLContext *context)
+ QPlatformTextureList *textures, QOpenGLContext *context,
+ bool translucentBackground)
{
- QPlatformBackingStore::composeAndFlush(window, region, offset, textures, context);
+ QPlatformBackingStore::composeAndFlush(window, region, offset, textures, context, translucentBackground);
Q_XCB_NOOP(connection());
diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.h b/src/plugins/platforms/xcb/qxcbbackingstore.h
index af3c004c2d..725d0511af 100644
--- a/src/plugins/platforms/xcb/qxcbbackingstore.h
+++ b/src/plugins/platforms/xcb/qxcbbackingstore.h
@@ -62,7 +62,8 @@ public:
void flush(QWindow *window, const QRegion &region, const QPoint &offset);
#ifndef QT_NO_OPENGL
void composeAndFlush(QWindow *window, const QRegion &region, const QPoint &offset,
- QPlatformTextureList *textures, QOpenGLContext *context);
+ QPlatformTextureList *textures, QOpenGLContext *context,
+ bool translucentBackground);
#endif
QImage toImage() const;
void resize(const QSize &size, const QRegion &staticContents);
diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp
index ff8a6e2d76..6a9abb5faf 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection.cpp
@@ -92,6 +92,9 @@
QT_BEGIN_NAMESPACE
+Q_LOGGING_CATEGORY(lcQpaXInput, "qt.qpa.events.input")
+Q_LOGGING_CATEGORY(lcQpaXInputDevices, "qt.qpa.devices")
+
#ifdef XCB_USE_XLIB
static const char * const xcbConnectionErrors[] = {
"No error", /* Error 0 */
@@ -324,8 +327,6 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra
, has_input_shape(false)
, has_touch_without_mouse_emulation(false)
, has_xkb(false)
- , debug_xinput_devices(false)
- , debug_xinput(false)
, m_buttons(0)
, m_focusWindow(0)
, m_systemTrayTracker(0)
@@ -798,8 +799,7 @@ void QXcbConnection::handleButtonPress(xcb_generic_event_t *ev)
// the rest we need to manage ourselves
m_buttons = (m_buttons & ~0x7) | translateMouseButtons(event->state);
m_buttons |= translateMouseButton(event->detail);
- if (Q_UNLIKELY(debug_xinput))
- qDebug("xcb: pressed mouse button %d, button state %X", event->detail, static_cast<unsigned int>(m_buttons));
+ qCDebug(lcQpaXInput, "xcb: pressed mouse button %d, button state %X", event->detail, static_cast<unsigned int>(m_buttons));
}
void QXcbConnection::handleButtonRelease(xcb_generic_event_t *ev)
@@ -810,8 +810,7 @@ void QXcbConnection::handleButtonRelease(xcb_generic_event_t *ev)
// the rest we need to manage ourselves
m_buttons = (m_buttons & ~0x7) | translateMouseButtons(event->state);
m_buttons &= ~translateMouseButton(event->detail);
- if (Q_UNLIKELY(debug_xinput))
- qDebug("xcb: released mouse button %d, button state %X", event->detail, static_cast<unsigned int>(m_buttons));
+ qCDebug(lcQpaXInput, "xcb: released mouse button %d, button state %X", event->detail, static_cast<unsigned int>(m_buttons));
}
#ifndef QT_NO_XKB
@@ -864,7 +863,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event)
handleButtonRelease(event);
HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_release_event_t, event, handleButtonReleaseEvent);
case XCB_MOTION_NOTIFY:
- if (Q_UNLIKELY(debug_xinput)) {
+ if (Q_UNLIKELY(lcQpaXInput().isDebugEnabled())) {
xcb_motion_notify_event_t *mev = (xcb_motion_notify_event_t *)event;
qDebug("xcb: moved mouse to %4d, %4d; button state %X", mev->event_x, mev->event_y, static_cast<unsigned int>(m_buttons));
}
diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h
index 44ee38e5de..9816d221a7 100644
--- a/src/plugins/platforms/xcb/qxcbconnection.h
+++ b/src/plugins/platforms/xcb/qxcbconnection.h
@@ -52,6 +52,7 @@
#include <QVector>
#include <QVarLengthArray>
#include <qpa/qwindowsysteminterface.h>
+#include <QtCore/QLoggingCategory>
// This is needed to make Qt compile together with XKB. xkb.h is using a variable
// which is called 'explicit', this is a reserved keyword in c++
@@ -81,6 +82,9 @@ struct xcb_randr_get_output_info_reply_t;
QT_BEGIN_NAMESPACE
+Q_DECLARE_LOGGING_CATEGORY(lcQpaXInput)
+Q_DECLARE_LOGGING_CATEGORY(lcQpaXInputDevices)
+
class QXcbScreen;
class QXcbWindow;
class QXcbDrag;
@@ -613,8 +617,6 @@ private:
bool has_input_shape;
bool has_touch_without_mouse_emulation;
bool has_xkb;
- bool debug_xinput_devices;
- bool debug_xinput;
Qt::MouseButtons m_buttons;
diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
index 512e574859..e3194d8177 100644
--- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
+++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp
@@ -71,8 +71,11 @@ struct XInput2DeviceData {
void QXcbConnection::initializeXInput2()
{
- debug_xinput = qEnvironmentVariableIsSet("QT_XCB_DEBUG_XINPUT");
- debug_xinput_devices = qEnvironmentVariableIsSet("QT_XCB_DEBUG_XINPUT_DEVICES");
+ // TODO Qt 6 (or perhaps earlier): remove these redundant env variables
+ if (qEnvironmentVariableIsSet("QT_XCB_DEBUG_XINPUT"))
+ const_cast<QLoggingCategory&>(lcQpaXInput()).setEnabled(QtDebugMsg, true);
+ if (qEnvironmentVariableIsSet("QT_XCB_DEBUG_XINPUT_DEVICES"))
+ const_cast<QLoggingCategory&>(lcQpaXInputDevices()).setEnabled(QtDebugMsg, true);
Display *xDisplay = static_cast<Display *>(m_xlib_display);
if (XQueryExtension(xDisplay, "XInputExtension", &m_xiOpCode, &m_xiEventBase, &m_xiErrorBase)) {
int xiMajor = 2;
@@ -87,11 +90,10 @@ void QXcbConnection::initializeXInput2()
} else
m_xi2Enabled = true;
if (m_xi2Enabled) {
- if (Q_UNLIKELY(debug_xinput_devices))
#ifdef XCB_USE_XINPUT22
- qDebug("XInput version %d.%d is available and Qt supports 2.2 or greater", xiMajor, m_xi2Minor);
+ qCDebug(lcQpaXInputDevices, "XInput version %d.%d is available and Qt supports 2.2 or greater", xiMajor, m_xi2Minor);
#else
- qDebug("XInput version %d.%d is available and Qt supports 2.0", xiMajor, m_xi2Minor);
+ qCDebug(lcQpaXInputDevices, "XInput version %d.%d is available and Qt supports 2.0", xiMajor, m_xi2Minor);
#endif
}
@@ -116,8 +118,7 @@ void QXcbConnection::xi2SetupDevices()
// Only non-master pointing devices are relevant here.
if (devices[i].use != XISlavePointer)
continue;
- if (Q_UNLIKELY(debug_xinput_devices))
- qDebug() << "input device "<< devices[i].name;
+ qCDebug(lcQpaXInputDevices) << "input device "<< devices[i].name;
#ifndef QT_NO_TABLETEVENT
TabletData tabletData;
#endif
@@ -127,8 +128,7 @@ void QXcbConnection::xi2SetupDevices()
case XIValuatorClass: {
XIValuatorClassInfo *vci = reinterpret_cast<XIValuatorClassInfo *>(devices[i].classes[c]);
const int valuatorAtom = qatom(vci->label);
- if (Q_UNLIKELY(debug_xinput_devices))
- qDebug() << " has valuator" << atomName(vci->label) << "recognized?" << (valuatorAtom < QXcbAtom::NAtoms);
+ qCDebug(lcQpaXInputDevices) << " has valuator" << atomName(vci->label) << "recognized?" << (valuatorAtom < QXcbAtom::NAtoms);
#ifndef QT_NO_TABLETEVENT
if (valuatorAtom < QXcbAtom::NAtoms) {
TabletData::ValuatorClassInfo info;
@@ -173,10 +173,18 @@ void QXcbConnection::xi2SetupDevices()
if ((!label6 || qatom(label6) == QXcbAtom::ButtonHorizWheelLeft) && (!label7 || qatom(label7) == QXcbAtom::ButtonHorizWheelRight))
scrollingDevice.legacyOrientations |= Qt::Horizontal;
}
+ qCDebug(lcQpaXInputDevices, " has %d buttons", bci->num_buttons);
break;
}
#endif
+ case XIKeyClass:
+ qCDebug(lcQpaXInputDevices) << " it's a keyboard";
+ break;
+ case XITouchClass:
+ // will be handled in deviceForId()
+ break;
default:
+ qCDebug(lcQpaXInputDevices) << " has class" << devices[i].classes[c]->type;
break;
}
}
@@ -192,8 +200,7 @@ void QXcbConnection::xi2SetupDevices()
tabletData.pointerType = QTabletEvent::Eraser;
m_tabletData.append(tabletData);
isTablet = true;
- if (Q_UNLIKELY(debug_xinput_devices))
- qDebug() << " it's a tablet with pointer type" << tabletData.pointerType;
+ qCDebug(lcQpaXInputDevices) << " it's a tablet with pointer type" << tabletData.pointerType;
}
#endif // QT_NO_TABLETEVENT
@@ -203,24 +210,21 @@ void QXcbConnection::xi2SetupDevices()
// Only use legacy wheel button events when we don't have real scroll valuators.
scrollingDevice.legacyOrientations &= ~scrollingDevice.orientations;
m_scrollingDevices.insert(scrollingDevice.deviceId, scrollingDevice);
- if (Q_UNLIKELY(debug_xinput_devices))
- qDebug() << " it's a scrolling device";
+ qCDebug(lcQpaXInputDevices) << " it's a scrolling device";
}
#endif
- if (!isTablet) {
+ if (!isTablet && lcQpaXInputDevices().isDebugEnabled()) {
XInput2DeviceData *dev = deviceForId(devices[i].deviceid);
- if (Q_UNLIKELY(debug_xinput_devices)) {
- if (dev && dev->qtTouchDevice->type() == QTouchDevice::TouchScreen)
- qDebug(" it's a touchscreen with type %d capabilities 0x%X max touch points %d",
- dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(),
- dev->qtTouchDevice->maximumTouchPoints());
- else if (dev && dev->qtTouchDevice->type() == QTouchDevice::TouchPad)
- qDebug(" it's a touchpad with type %d capabilities 0x%X max touch points %d size %f x %f",
- dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(),
- dev->qtTouchDevice->maximumTouchPoints(),
- dev->size.width(), dev->size.height());
- }
+ if (dev && dev->qtTouchDevice->type() == QTouchDevice::TouchScreen)
+ qCDebug(lcQpaXInputDevices, " it's a touchscreen with type %d capabilities 0x%X max touch points %d",
+ dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(),
+ dev->qtTouchDevice->maximumTouchPoints());
+ else if (dev && dev->qtTouchDevice->type() == QTouchDevice::TouchPad)
+ qCDebug(lcQpaXInputDevices, " it's a touchpad with type %d capabilities 0x%X max touch points %d size %f x %f",
+ dev->qtTouchDevice->type(), (unsigned int)dev->qtTouchDevice->capabilities(),
+ dev->qtTouchDevice->maximumTouchPoints(),
+ dev->size.width(), dev->size.height());
}
}
XIFreeDeviceInfo(devices);
@@ -342,8 +346,7 @@ XInput2DeviceData *QXcbConnection::deviceForId(int id)
case XITouchClass: {
XITouchClassInfo *tci = reinterpret_cast<XITouchClassInfo *>(classinfo);
maxTouchPoints = tci->num_touches;
- if (Q_UNLIKELY(debug_xinput_devices))
- qDebug(" has touch class with mode %d", tci->mode);
+ qCDebug(lcQpaXInputDevices, " has touch class with mode %d", tci->mode);
switch (tci->mode) {
case XIDependentTouch:
type = QTouchDevice::TouchPad;
@@ -372,6 +375,8 @@ XInput2DeviceData *QXcbConnection::deviceForId(int id)
}
break;
}
+ default:
+ break;
}
}
if (type < 0 && caps && hasRelativeCoords) {
@@ -444,11 +449,11 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
#ifdef XCB_USE_XINPUT22
if (xiEvent->evtype == XI_TouchBegin || xiEvent->evtype == XI_TouchUpdate || xiEvent->evtype == XI_TouchEnd) {
xXIDeviceEvent* xiDeviceEvent = reinterpret_cast<xXIDeviceEvent *>(event);
- if (Q_UNLIKELY(debug_xinput))
- qDebug("XI2 touch event type %d seq %d detail %d pos %6.1f, %6.1f root pos %6.1f, %6.1f",
- event->event_type, xiEvent->sequenceNumber, xiDeviceEvent->detail,
- fixed1616ToReal(xiDeviceEvent->event_x), fixed1616ToReal(xiDeviceEvent->event_y),
- fixed1616ToReal(xiDeviceEvent->root_x), fixed1616ToReal(xiDeviceEvent->root_y) );
+ if (Q_UNLIKELY(lcQpaXInput().isDebugEnabled()))
+ qCDebug(lcQpaXInput, "XI2 touch event type %d seq %d detail %d pos %6.1f, %6.1f root pos %6.1f, %6.1f",
+ event->event_type, xiEvent->sequenceNumber, xiDeviceEvent->detail,
+ fixed1616ToReal(xiDeviceEvent->event_x), fixed1616ToReal(xiDeviceEvent->event_y),
+ fixed1616ToReal(xiDeviceEvent->root_x), fixed1616ToReal(xiDeviceEvent->root_y) );
if (QXcbWindow *platformWindow = platformWindowFromId(xiDeviceEvent->event)) {
XInput2DeviceData *dev = deviceForId(xiDeviceEvent->sourceid);
@@ -474,9 +479,9 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
double value;
if (!xi2GetValuatorValueIfSet(xiDeviceEvent, n, &value))
continue;
- if (Q_UNLIKELY(debug_xinput))
- qDebug(" valuator %20s value %lf from range %lf -> %lf",
- atomName(vci->label).constData(), value, vci->min, vci->max );
+ if (Q_UNLIKELY(lcQpaXInput().isDebugEnabled()))
+ qCDebug(lcQpaXInput, " valuator %20s value %lf from range %lf -> %lf",
+ atomName(vci->label).constData(), value, vci->min, vci->max );
if (vci->label == atom(QXcbAtom::RelX)) {
nx = valuatorNormalized(value, vci);
} else if (vci->label == atom(QXcbAtom::RelY)) {
@@ -552,9 +557,9 @@ void QXcbConnection::xi2HandleEvent(xcb_ge_event_t *event)
touchPoint.area = QRectF(x - w/2, y - h/2, w, h);
touchPoint.normalPosition = QPointF(nx, ny);
- if (Q_UNLIKELY(debug_xinput))
- qDebug() << " touchpoint " << touchPoint.id << " state " << touchPoint.state << " pos norm " << touchPoint.normalPosition <<
- " area " << touchPoint.area << " pressure " << touchPoint.pressure;
+ if (Q_UNLIKELY(lcQpaXInput().isDebugEnabled()))
+ qCDebug(lcQpaXInput) << " touchpoint " << touchPoint.id << " state " << touchPoint.state << " pos norm " << touchPoint.normalPosition <<
+ " area " << touchPoint.area << " pressure " << touchPoint.pressure;
QWindowSystemInterface::handleTouchEvent(platformWindow->window(), xiEvent->time, dev->qtTouchDevice, m_touchPoints.values());
if (touchPoint.state == Qt::TouchPointReleased)
// If a touchpoint was released, we can forget it, because the ID won't be reused.
@@ -805,13 +810,11 @@ bool QXcbConnection::xi2HandleTabletEvent(void *event, TabletData *tabletData)
tabletData->pointerType,
tabletData->serialId);
}
- if (Q_UNLIKELY(debug_xinput)) {
- // TODO maybe have a hash of tabletData->deviceId to device data so we can
- // look up the tablet name here, and distinguish multiple tablets
- qDebug("XI2 proximity change on tablet %d (USB %x): last tool: %x id %x current tool: %x id %x TabletDevice %d",
- ev->deviceid, ptr[_WACSER_USB_ID], ptr[_WACSER_LAST_TOOL_SERIAL], ptr[_WACSER_LAST_TOOL_ID],
- ptr[_WACSER_TOOL_SERIAL], ptr[_WACSER_TOOL_ID], tabletData->tool);
- }
+ // TODO maybe have a hash of tabletData->deviceId to device data so we can
+ // look up the tablet name here, and distinguish multiple tablets
+ qCDebug(lcQpaXInput, "XI2 proximity change on tablet %d (USB %x): last tool: %x id %x current tool: %x id %x TabletDevice %d",
+ ev->deviceid, ptr[_WACSER_USB_ID], ptr[_WACSER_LAST_TOOL_SERIAL], ptr[_WACSER_LAST_TOOL_ID],
+ ptr[_WACSER_TOOL_SERIAL], ptr[_WACSER_TOOL_ID], tabletData->tool);
}
XFree(data);
}
@@ -872,8 +875,8 @@ void QXcbConnection::xi2ReportTabletEvent(TabletData &tabletData, void *event)
}
}
- if (Q_UNLIKELY(debug_xinput))
- qDebug("XI2 event on tablet %d with tool %d type %d seq %d detail %d pos %6.1f, %6.1f root pos %6.1f, %6.1f buttons 0x%x pressure %4.2lf tilt %d, %d rotation %6.2lf",
+ if (Q_UNLIKELY(lcQpaXInput().isDebugEnabled()))
+ qCDebug(lcQpaXInput, "XI2 event on tablet %d with tool %d type %d seq %d detail %d pos %6.1f, %6.1f root pos %6.1f, %6.1f buttons 0x%x pressure %4.2lf tilt %d, %d rotation %6.2lf",
ev->deviceid, tabletData.tool, ev->evtype, ev->sequenceNumber, ev->detail,
fixed1616ToReal(ev->event_x), fixed1616ToReal(ev->event_y),
fixed1616ToReal(ev->root_x), fixed1616ToReal(ev->root_y),
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
index 5673d41811..a00da04c26 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp
@@ -85,7 +85,8 @@ static int resourceType(const QByteArray &key)
QByteArrayLiteral("appusertime"), QByteArrayLiteral("hintstyle"),
QByteArrayLiteral("startupid"), QByteArrayLiteral("traywindow"),
QByteArrayLiteral("gettimestamp"), QByteArrayLiteral("x11screen"),
- QByteArrayLiteral("rootwindow")
+ QByteArrayLiteral("rootwindow"),
+ QByteArrayLiteral("subpixeltype"), QByteArrayLiteral("antialiasingEnabled")
};
const QByteArray *end = names + sizeof(names) / sizeof(names[0]);
const QByteArray *result = std::find(names, end, key);
@@ -277,6 +278,12 @@ void *QXcbNativeInterface::nativeResourceForScreen(const QByteArray &resource, Q
case ScreenHintStyle:
result = reinterpret_cast<void *>(xcbScreen->hintStyle() + 1);
break;
+ case ScreenSubpixelType:
+ result = reinterpret_cast<void *>(xcbScreen->subpixelType() + 1);
+ break;
+ case ScreenAntialiasingEnabled:
+ result = reinterpret_cast<void *>(xcbScreen->antialiasingEnabled() + 1);
+ break;
case TrayWindow:
if (QXcbSystemTrayTracker *s = systemTrayTracker(screen))
result = (void *)quintptr(s->trayWindow());
diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h
index c63cdf0254..1cd764914a 100644
--- a/src/plugins/platforms/xcb/qxcbnativeinterface.h
+++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h
@@ -73,7 +73,9 @@ public:
TrayWindow,
GetTimestamp,
X11Screen,
- RootWindow
+ RootWindow,
+ ScreenSubpixelType,
+ ScreenAntialiasingEnabled
};
QXcbNativeInterface();
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index 85f4dfbd43..952f32d806 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -69,6 +69,8 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr,
, m_refreshRate(60)
, m_forcedDpi(-1)
, m_hintStyle(QFontEngine::HintStyle(-1))
+ , m_subpixelType(QFontEngine::SubpixelAntialiasingType(-1))
+ , m_antialiasingEnabled(-1)
, m_xSettings(0)
{
if (connection->hasXRandr())
@@ -547,32 +549,52 @@ QPixmap QXcbScreen::grabWindow(WId window, int x, int y, int width, int height)
return result;
}
+static bool parseXftInt(const QByteArray& stringValue, int *value)
+{
+ Q_ASSERT(value != 0);
+ bool ok;
+ *value = stringValue.toInt(&ok);
+ return ok;
+}
+
+static QFontEngine::HintStyle parseXftHintStyle(const QByteArray& stringValue)
+{
+ if (stringValue == "hintfull")
+ return QFontEngine::HintFull;
+ else if (stringValue == "hintnone")
+ return QFontEngine::HintNone;
+ else if (stringValue == "hintmedium")
+ return QFontEngine::HintMedium;
+ else if (stringValue == "hintslight")
+ return QFontEngine::HintLight;
+
+ return QFontEngine::HintStyle(-1);
+}
+
+static QFontEngine::SubpixelAntialiasingType parseXftRgba(const QByteArray& stringValue)
+{
+ if (stringValue == "none")
+ return QFontEngine::Subpixel_None;
+ else if (stringValue == "rgb")
+ return QFontEngine::Subpixel_RGB;
+ else if (stringValue == "bgr")
+ return QFontEngine::Subpixel_BGR;
+ else if (stringValue == "vrgb")
+ return QFontEngine::Subpixel_VRGB;
+ else if (stringValue == "vbgr")
+ return QFontEngine::Subpixel_VBGR;
+
+ return QFontEngine::SubpixelAntialiasingType(-1);
+}
+
bool QXcbScreen::xResource(const QByteArray &identifier,
const QByteArray &expectedIdentifier,
- int *value)
+ QByteArray& stringValue)
{
- Q_ASSERT(value != 0);
if (identifier.startsWith(expectedIdentifier)) {
- QByteArray stringValue = identifier.mid(expectedIdentifier.size());
-
- bool ok;
- *value = stringValue.toInt(&ok);
- if (!ok) {
- if (stringValue == "hintfull")
- *value = QFontEngine::HintFull;
- else if (stringValue == "hintnone")
- *value = QFontEngine::HintNone;
- else if (stringValue == "hintmedium")
- *value = QFontEngine::HintMedium;
- else if (stringValue == "hintslight")
- *value = QFontEngine::HintLight;
-
- return *value != 0;
- }
-
+ stringValue = identifier.mid(expectedIdentifier.size());
return true;
}
-
return false;
}
@@ -604,10 +626,18 @@ void QXcbScreen::readXResources()
for (int i = 0; i < split.size(); ++i) {
const QByteArray &r = split.at(i);
int value;
- if (xResource(r, "Xft.dpi:\t", &value))
- m_forcedDpi = value;
- else if (xResource(r, "Xft.hintstyle:\t", &value))
- m_hintStyle = QFontEngine::HintStyle(value);
+ QByteArray stringValue;
+ if (xResource(r, "Xft.dpi:\t", stringValue)) {
+ if (parseXftInt(stringValue, &value))
+ m_forcedDpi = value;
+ } else if (xResource(r, "Xft.hintstyle:\t", stringValue)) {
+ m_hintStyle = parseXftHintStyle(stringValue);
+ } else if (xResource(r, "Xft.antialias:\t", stringValue)) {
+ if (parseXftInt(stringValue, &value))
+ m_antialiasingEnabled = value;
+ } else if (xResource(r, "Xft.rgba:\t", stringValue)) {
+ m_subpixelType = parseXftRgba(stringValue);
+ }
}
}
diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h
index 53ac65bb09..db72d94698 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.h
+++ b/src/plugins/platforms/xcb/qxcbscreen.h
@@ -104,13 +104,15 @@ public:
void readXResources();
QFontEngine::HintStyle hintStyle() const { return m_hintStyle; }
+ QFontEngine::SubpixelAntialiasingType subpixelType() const { return m_subpixelType; }
+ int antialiasingEnabled() const { return m_antialiasingEnabled; }
QXcbXSettings *xSettings() const;
private:
static bool xResource(const QByteArray &identifier,
- const QByteArray &expectedIdentifier,
- int *value);
+ const QByteArray &expectedIdentifier,
+ QByteArray &stringValue);
void sendStartupMessage(const QByteArray &message) const;
xcb_screen_t *m_screen;
@@ -133,6 +135,8 @@ private:
int m_refreshRate;
int m_forcedDpi;
QFontEngine::HintStyle m_hintStyle;
+ QFontEngine::SubpixelAntialiasingType m_subpixelType;
+ int m_antialiasingEnabled;
QXcbXSettings *m_xSettings;
};
diff --git a/src/plugins/platformthemes/gtk2/qgtk2theme.cpp b/src/plugins/platformthemes/gtk2/qgtk2theme.cpp
index 812f4bc000..4df3a304e1 100644
--- a/src/plugins/platformthemes/gtk2/qgtk2theme.cpp
+++ b/src/plugins/platformthemes/gtk2/qgtk2theme.cpp
@@ -85,6 +85,14 @@ QVariant QGtk2Theme::themeHint(QPlatformTheme::ThemeHint hint) const
}
}
+QString QGtk2Theme::gtkFontName() const
+{
+ QString cfgFontName = gtkSetting("gtk-font-name");
+ if (!cfgFontName.isEmpty())
+ return cfgFontName;
+ return QGnomeTheme::gtkFontName();
+}
+
bool QGtk2Theme::usePlatformNativeDialog(DialogType type) const
{
switch (type) {
diff --git a/src/plugins/platformthemes/gtk2/qgtk2theme.h b/src/plugins/platformthemes/gtk2/qgtk2theme.h
index a0bd34ed9f..c74e58e648 100644
--- a/src/plugins/platformthemes/gtk2/qgtk2theme.h
+++ b/src/plugins/platformthemes/gtk2/qgtk2theme.h
@@ -51,7 +51,8 @@ class QGtk2Theme : public QGnomeTheme
public:
QGtk2Theme();
- QVariant themeHint(ThemeHint hint) const;
+ virtual QVariant themeHint(ThemeHint hint) const Q_DECL_OVERRIDE;
+ virtual QString gtkFontName() const Q_DECL_OVERRIDE;
bool usePlatformNativeDialog(DialogType type) const;
QPlatformDialogHelper *createPlatformDialogHelper(DialogType type) const;