summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-11-22 11:06:15 +0100
committerQt by Nokia <qt-info@nokia.com>2011-12-01 10:51:10 +0100
commit89aee9ecde7ca28b5ed93514c07c41ed110849cc (patch)
treeb700b471bf93b121ab7c2623f25a83af698839d0
parent4eedb335c6ca33ba93e56581895205f3a8be527e (diff)
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>
-rw-r--r--src/gui/kernel/qguiapplication.cpp23
-rw-r--r--src/gui/kernel/qguiapplication_p.h1
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.cpp7
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa.h1
-rw-r--r--src/gui/kernel/qwindowsysteminterface_qpa_p.h8
5 files changed, 37 insertions, 3 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp
index 63e8909eeb..859295de2b 100644
--- a/src/gui/kernel/qguiapplication.cpp
+++ b/src/gui/kernel/qguiapplication.cpp
@@ -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)
diff --git a/src/gui/kernel/qguiapplication_p.h b/src/gui/kernel/qguiapplication_p.h
index 255a1587f5..9c8a2ca642 100644
--- a/src/gui/kernel/qguiapplication_p.h
+++ b/src/gui/kernel/qguiapplication_p.h
@@ -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);
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
index 17a5bb4eda..979a168c05 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp
@@ -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);
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h
index 04e8a6e01c..d00f0af37c 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa.h
@@ -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);
diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
index 44746500aa..7d5455c06b 100644
--- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h
+++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h
@@ -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)