Added QPA window system interface handler for logical DPI changes.
Logical DPI is independent from geometry and physical DPI. Change-Id: Ice487f61e1bda9e6791e2adf6998ebf61cdbaef2 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
This commit is contained in:
parent
4eedb335c6
commit
89aee9ecde
@ -586,6 +586,10 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv
|
||||
QGuiApplicationPrivate::reportAvailableGeometryChange(
|
||||
static_cast<QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *>(e));
|
||||
break;
|
||||
case QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInch:
|
||||
QGuiApplicationPrivate::reportLogicalDotsPerInchChange(
|
||||
static_cast<QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *>(e));
|
||||
break;
|
||||
case QWindowSystemInterfacePrivate::Map:
|
||||
QGuiApplicationPrivate::processMapEvent(static_cast<QWindowSystemInterfacePrivate::MapEvent *>(e));
|
||||
break;
|
||||
@ -998,9 +1002,6 @@ void QGuiApplicationPrivate::reportGeometryChange(QWindowSystemInterfacePrivate:
|
||||
emit s->physicalDotsPerInchXChanged(s->physicalDotsPerInchX());
|
||||
emit s->physicalDotsPerInchYChanged(s->physicalDotsPerInchY());
|
||||
emit s->physicalDotsPerInchChanged(s->physicalDotsPerInch());
|
||||
emit s->logicalDotsPerInchXChanged(s->logicalDotsPerInchX());
|
||||
emit s->logicalDotsPerInchYChanged(s->logicalDotsPerInchY());
|
||||
emit s->logicalDotsPerInchChanged(s->logicalDotsPerInch());
|
||||
emit s->availableSizeChanged(s->availableSize());
|
||||
emit s->availableGeometryChanged(s->availableGeometry());
|
||||
}
|
||||
@ -1021,6 +1022,22 @@ void QGuiApplicationPrivate::reportAvailableGeometryChange(
|
||||
emit s->availableGeometryChanged(s->availableGeometry());
|
||||
}
|
||||
|
||||
void QGuiApplicationPrivate::reportLogicalDotsPerInchChange(QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e)
|
||||
{
|
||||
// This operation only makes sense after the QGuiApplication constructor runs
|
||||
if (QCoreApplication::startingUp())
|
||||
return;
|
||||
|
||||
if (!e->screen)
|
||||
return;
|
||||
|
||||
QScreen *s = e->screen.data();
|
||||
|
||||
emit s->logicalDotsPerInchXChanged(s->logicalDotsPerInchX());
|
||||
emit s->logicalDotsPerInchYChanged(s->logicalDotsPerInchY());
|
||||
emit s->logicalDotsPerInchChanged(s->logicalDotsPerInch());
|
||||
}
|
||||
|
||||
void QGuiApplicationPrivate::processMapEvent(QWindowSystemInterfacePrivate::MapEvent *e)
|
||||
{
|
||||
if (!e->mapped)
|
||||
|
@ -125,6 +125,7 @@ public:
|
||||
static void reportScreenOrientationChange(QWindowSystemInterfacePrivate::ScreenOrientationEvent *e);
|
||||
static void reportGeometryChange(QWindowSystemInterfacePrivate::ScreenGeometryEvent *e);
|
||||
static void reportAvailableGeometryChange(QWindowSystemInterfacePrivate::ScreenAvailableGeometryEvent *e);
|
||||
static void reportLogicalDotsPerInchChange(QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e);
|
||||
|
||||
static void processMapEvent(QWindowSystemInterfacePrivate::MapEvent *e);
|
||||
static void processUnmapEvent(QWindowSystemInterfacePrivate::UnmapEvent *e);
|
||||
|
@ -278,6 +278,13 @@ void QWindowSystemInterface::handleScreenAvailableGeometryChange(QScreen *screen
|
||||
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
|
||||
}
|
||||
|
||||
void QWindowSystemInterface::handleScreenLogicalDotsPerInchChange(QScreen *screen)
|
||||
{
|
||||
QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent *e =
|
||||
new QWindowSystemInterfacePrivate::ScreenLogicalDotsPerInchEvent(screen);
|
||||
QWindowSystemInterfacePrivate::queueWindowSystemEvent(e);
|
||||
}
|
||||
|
||||
void QWindowSystemInterface::handleMapEvent(QWindow *tlw)
|
||||
{
|
||||
QWindowSystemInterfacePrivate::MapEvent *e = new QWindowSystemInterfacePrivate::MapEvent(tlw);
|
||||
|
@ -117,6 +117,7 @@ public:
|
||||
static void handleScreenOrientationChange(QScreen *screen);
|
||||
static void handleScreenGeometryChange(QScreen *screen);
|
||||
static void handleScreenAvailableGeometryChange(QScreen *screen);
|
||||
static void handleScreenLogicalDotsPerInchChange(QScreen *screen);
|
||||
|
||||
// For event dispatcher implementations
|
||||
static bool sendWindowSystemEvents(QAbstractEventDispatcher *eventDispatcher, QEventLoop::ProcessEventsFlags flags);
|
||||
|
@ -63,6 +63,7 @@ public:
|
||||
ScreenOrientation,
|
||||
ScreenGeometry,
|
||||
ScreenAvailableGeometry,
|
||||
ScreenLogicalDotsPerInch,
|
||||
Map,
|
||||
Unmap,
|
||||
Expose
|
||||
@ -215,6 +216,13 @@ public:
|
||||
QWeakPointer<QScreen> screen;
|
||||
};
|
||||
|
||||
class ScreenLogicalDotsPerInchEvent : public WindowSystemEvent {
|
||||
public:
|
||||
ScreenLogicalDotsPerInchEvent(QScreen *s)
|
||||
: WindowSystemEvent(ScreenLogicalDotsPerInch), screen(s) { }
|
||||
QWeakPointer<QScreen> screen;
|
||||
};
|
||||
|
||||
class MapEvent : public WindowSystemEvent {
|
||||
public:
|
||||
MapEvent(QWindow *mapped)
|
||||
|
Loading…
Reference in New Issue
Block a user