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_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "directfb.json")
public:
QPlatformIntegration *create(const QString&, const QStringList&);
QPlatformIntegration *create(const QString&, const QStringList&) override;
};
QPlatformIntegration * QDirectFbIntegrationPlugin::create(const QString& system, const QStringList& paramList)

View File

@ -18,10 +18,10 @@ class QDirectFbBackingStore : public QPlatformBackingStore
public:
QDirectFbBackingStore(QWindow *window);
QPaintDevice *paintDevice();
void flush(QWindow *window, const QRegion &region, const QPoint &offset);
void resize (const QSize &size, const QRegion &staticContents);
bool scroll(const QRegion &area, int dx, int dy);
QPaintDevice *paintDevice() override;
void flush(QWindow *window, const QRegion &region, const QPoint &offset) override;
void resize (const QSize &size, const QRegion &staticContents) override;
bool scroll(const QRegion &area, int dx, int dy) 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) {
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];
if (c.isNull())
continue;

View File

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

View File

@ -19,7 +19,7 @@ class QDirectFBCursor : public QPlatformCursor
public:
QDirectFBCursor(QPlatformScreen *screen);
#ifndef QT_NO_CURSOR
void changeCursor(QCursor *cursor, QWindow *window);
void changeCursor(QCursor *cursor, QWindow *window) override;
#endif
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);
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)
@ -135,9 +135,12 @@ void QDirectFbInput::handleWheelEvent(const DFBEvent &event)
QPoint globalPos(event.window.cx, event.window.cy);
long timestamp = (event.window.timestamp.tv_sec*1000) + (event.window.timestamp.tv_usec/1000);
QWindow *tlw = m_tlwMap.value(event.window.window_id);
QWindowSystemInterface::handleWheelEvent(tlw, timestamp, p, globalPos,
event.window.step*120,
Qt::Vertical);
QWindowSystemInterface::handleWheelEvent(tlw,
timestamp,
p,
globalPos,
QPoint(),
QPoint(0, event.window.step*120));
}
void QDirectFbInput::handleKeyEvents(const DFBEvent &event)

View File

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

View File

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

View File

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

View File

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