directfb: Fix compilation

The DirectFB QPA plugin has not built since Qt 6, because it used
deprecated API which has been removed and private API which has
changed.

This change updates the handleMouseEvent() and
handleWheelEvent() calls with the contents of the deprecated
overloads the way they were in Qt 5.15.

In addition, it updates usage of GlyphAndSubPixelPosition to default to
vertical subpixel position of 0, and adds override qualifiers where
necessary.

Fixes: QTBUG-105061
Change-Id: Id7516f8e3c0a466d15b754f8e5f6df15a5f9526a
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
This commit is contained in:
Eskil Abrahamsen Blomfeldt 2022-08-30 14:54:01 +02:00
parent 267d923ed9
commit d86ab16a86
10 changed files with 59 additions and 47 deletions

View File

@ -24,7 +24,7 @@ class QDirectFbIntegrationPlugin : public QPlatformIntegrationPlugin
Q_OBJECT Q_OBJECT
Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "directfb.json") Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "directfb.json")
public: public:
QPlatformIntegration *create(const QString&, const QStringList&); QPlatformIntegration *create(const QString&, const QStringList&) override;
}; };
QPlatformIntegration * QDirectFbIntegrationPlugin::create(const QString& system, const QStringList& paramList) QPlatformIntegration * QDirectFbIntegrationPlugin::create(const QString& system, const QStringList& paramList)

View File

@ -18,10 +18,10 @@ class QDirectFbBackingStore : public QPlatformBackingStore
public: public:
QDirectFbBackingStore(QWindow *window); QDirectFbBackingStore(QWindow *window);
QPaintDevice *paintDevice(); QPaintDevice *paintDevice() override;
void flush(QWindow *window, const QRegion &region, const QPoint &offset); void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
void resize (const QSize &size, const QRegion &staticContents); void resize (const QSize &size, const QRegion &staticContents) override;
bool scroll(const QRegion &area, int dx, int dy); bool scroll(const QRegion &area, int dx, int dy) override;
QImage toImage() const override; QImage toImage() const override;

View File

@ -216,7 +216,7 @@ bool QDirectFbBlitter::drawCachedGlyphs(const QPaintEngineState *state, QFontEng
for (int i=0; i<numGlyphs; ++i) { for (int i=0; i<numGlyphs; ++i) {
QFixed subPixelPosition = fontEngine->subPixelPositionForX(positions[i].x); QFixed subPixelPosition = fontEngine->subPixelPositionForX(positions[i].x);
QTextureGlyphCache::GlyphAndSubPixelPosition glyph(glyphs[i], subPixelPosition); QTextureGlyphCache::GlyphAndSubPixelPosition glyph(glyphs[i], QFixedPoint(subPixelPosition, 0));
const QTextureGlyphCache::Coord &c = cache->coords[glyph]; const QTextureGlyphCache::Coord &c = cache->coords[glyph];
if (c.isNull()) if (c.isNull())
continue; continue;

View File

@ -19,11 +19,20 @@ public:
QDirectFbBlitter(const QSize &size, bool alpha); QDirectFbBlitter(const QSize &size, bool alpha);
virtual ~QDirectFbBlitter(); virtual ~QDirectFbBlitter();
virtual void fillRect(const QRectF &rect, const QColor &color); void fillRect(const QRectF &rect, const QColor &color) override;
virtual void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect); void drawPixmap(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect) override;
void alphaFillRect(const QRectF &rect, const QColor &color, QPainter::CompositionMode cmode); void alphaFillRect(const QRectF &rect, const QColor &color, QPainter::CompositionMode cmode) override;
void drawPixmapOpacity(const QRectF &rect, const QPixmap &pixmap, const QRectF &subrect, QPainter::CompositionMode cmode, qreal opacity); void drawPixmapOpacity(const QRectF &rect,
virtual bool drawCachedGlyphs(const QPaintEngineState *state, QFontEngine::GlyphFormat glyphFormat, int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine); const QPixmap &pixmap,
const QRectF &subrect,
QPainter::CompositionMode cmode,
qreal opacity) override;
bool drawCachedGlyphs(const QPaintEngineState *state,
QFontEngine::GlyphFormat glyphFormat,
int numGlyphs,
const glyph_t *glyphs,
const QFixedPoint *positions,
QFontEngine *fontEngine) override;
IDirectFBSurface *dfbSurface() const; IDirectFBSurface *dfbSurface() const;
@ -32,8 +41,8 @@ public:
static DFBSurfacePixelFormat selectPixmapFormat(bool withAlpha); static DFBSurfacePixelFormat selectPixmapFormat(bool withAlpha);
protected: protected:
virtual QImage *doLock(); QImage *doLock() override;
virtual void doUnlock(); void doUnlock() override;
QDirectFBPointer<IDirectFBSurface> m_surface; QDirectFBPointer<IDirectFBSurface> m_surface;
QImage m_image; QImage m_image;
@ -50,12 +59,12 @@ private:
class QDirectFbBlitterPlatformPixmap : public QBlittablePlatformPixmap class QDirectFbBlitterPlatformPixmap : public QBlittablePlatformPixmap
{ {
public: public:
QBlittable *createBlittable(const QSize &size, bool alpha) const; QBlittable *createBlittable(const QSize &size, bool alpha) const override;
QDirectFbBlitter *dfbBlitter() const; QDirectFbBlitter *dfbBlitter() const;
virtual bool fromFile(const QString &filename, const char *format, bool fromFile(const QString &filename, const char *format,
Qt::ImageConversionFlags flags); Qt::ImageConversionFlags flags) override;
private: private:
bool fromDataBufferDescription(const DFBDataBufferDescription &); bool fromDataBufferDescription(const DFBDataBufferDescription &);
@ -83,7 +92,7 @@ public:
: QImageTextureGlyphCache(format, matrix) : QImageTextureGlyphCache(format, matrix)
{} {}
virtual void resizeTextureData(int width, int height); void resizeTextureData(int width, int height) override;
IDirectFBSurface *sourceSurface(); IDirectFBSurface *sourceSurface();

View File

@ -19,7 +19,7 @@ class QDirectFBCursor : public QPlatformCursor
public: public:
QDirectFBCursor(QPlatformScreen *screen); QDirectFBCursor(QPlatformScreen *screen);
#ifndef QT_NO_CURSOR #ifndef QT_NO_CURSOR
void changeCursor(QCursor *cursor, QWindow *window); void changeCursor(QCursor *cursor, QWindow *window) override;
#endif #endif
private: private:

View File

@ -126,7 +126,7 @@ void QDirectFbInput::handleMouseEvents(const DFBEvent &event)
long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000);
QWindow *tlw = m_tlwMap.value(event.window.window_id); QWindow *tlw = m_tlwMap.value(event.window.window_id);
QWindowSystemInterface::handleMouseEvent(tlw, timestamp, p, globalPos, buttons); QWindowSystemInterface::handleMouseEvent(tlw, timestamp, p, globalPos, buttons, Qt::NoButton, QEvent::None);
} }
void QDirectFbInput::handleWheelEvent(const DFBEvent &event) void QDirectFbInput::handleWheelEvent(const DFBEvent &event)
@ -135,9 +135,12 @@ void QDirectFbInput::handleWheelEvent(const DFBEvent &event)
QPoint globalPos(event.window.cx, event.window.cy); QPoint globalPos(event.window.cx, event.window.cy);
long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000); long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000);
QWindow *tlw = m_tlwMap.value(event.window.window_id); QWindow *tlw = m_tlwMap.value(event.window.window_id);
QWindowSystemInterface::handleWheelEvent(tlw, timestamp, p, globalPos, QWindowSystemInterface::handleWheelEvent(tlw,
event.window.step*120, timestamp,
Qt::Vertical); p,
globalPos,
QPoint(),
QPoint(0, event.window.step*120));
} }
void QDirectFbInput::handleKeyEvents(const DFBEvent &event) void QDirectFbInput::handleKeyEvents(const DFBEvent &event)

View File

@ -26,7 +26,7 @@ public:
void stopInputEventLoop(); void stopInputEventLoop();
protected: protected:
void run(); void run() override;
private: private:
void handleEvents(); void handleEvents();

View File

@ -25,16 +25,16 @@ public:
void connectToDirectFb(); void connectToDirectFb();
bool hasCapability(Capability cap) const; bool hasCapability(Capability cap) const override;
QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const; QPlatformPixmap *createPlatformPixmap(QPlatformPixmap::PixelType type) const override;
QPlatformWindow *createPlatformWindow(QWindow *window) const; QPlatformWindow *createPlatformWindow(QWindow *window) const override;
QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const; QPlatformBackingStore *createPlatformBackingStore(QWindow *window) const override;
QAbstractEventDispatcher *createEventDispatcher() const; QAbstractEventDispatcher *createEventDispatcher() const override;
QPlatformFontDatabase *fontDatabase() const; QPlatformFontDatabase *fontDatabase() const override;
QPlatformServices *services() const; QPlatformServices *services() const override;
QPlatformInputContext *inputContext() const { return m_inputContext; } QPlatformInputContext *inputContext() const override { return m_inputContext; }
QPlatformNativeInterface *nativeInterface() const; QPlatformNativeInterface *nativeInterface() const override;
protected: protected:
virtual void initializeDirectFB(); virtual void initializeDirectFB();

View File

@ -19,11 +19,11 @@ class QDirectFbScreen : public QPlatformScreen
public: public:
QDirectFbScreen(int display); QDirectFbScreen(int display);
QRect geometry() const { return m_geometry; } QRect geometry() const override { return m_geometry; }
int depth() const { return m_depth; } int depth() const override { return m_depth; }
QImage::Format format() const { return m_format; } QImage::Format format() const override { return m_format; }
QSizeF physicalSize() const { return m_physicalSize; } QSizeF physicalSize() const override { return m_physicalSize; }
QPlatformCursor *cursor() const { return m_cursor.data(); } QPlatformCursor *cursor() const override { return m_cursor.data(); }
// DirectFb helpers // DirectFb helpers
IDirectFBDisplayLayer *dfbLayer() const; IDirectFBDisplayLayer *dfbLayer() const;

View File

@ -15,19 +15,19 @@ class QDirectFbWindow : public QPlatformWindow
{ {
public: public:
QDirectFbWindow(QWindow *tlw, QDirectFbInput *inputhandler); QDirectFbWindow(QWindow *tlw, QDirectFbInput *inputhandler);
~QDirectFbWindow(); ~QDirectFbWindow() override;
void setGeometry(const QRect &rect); void setGeometry(const QRect &rect) override;
void setOpacity(qreal level); void setOpacity(qreal level) override;
void setVisible(bool visible); void setVisible(bool visible) override;
void setWindowFlags(Qt::WindowFlags flags); void setWindowFlags(Qt::WindowFlags flags) override;
bool setKeyboardGrabEnabled(bool grab); bool setKeyboardGrabEnabled(bool grab) override;
bool setMouseGrabEnabled(bool grab); bool setMouseGrabEnabled(bool grab) override;
void raise(); void raise() override;
void lower(); void lower() override;
WId winId() const; WId winId() const override;
virtual void createDirectFBWindow(); virtual void createDirectFBWindow();
IDirectFBWindow *dfbWindow() const; IDirectFBWindow *dfbWindow() const;