summaryrefslogtreecommitdiffstats
path: root/src/widgets/kernel
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/kernel')
-rw-r--r--src/widgets/kernel/qapplication_p.h10
-rw-r--r--src/widgets/kernel/qapplication_qpa.cpp19
2 files changed, 28 insertions, 1 deletions
diff --git a/src/widgets/kernel/qapplication_p.h b/src/widgets/kernel/qapplication_p.h
index 75cc003a1d..c4a9a15064 100644
--- a/src/widgets/kernel/qapplication_p.h
+++ b/src/widgets/kernel/qapplication_p.h
@@ -59,6 +59,9 @@
#include "QtGui/qfont.h"
#include "QtGui/qcursor.h"
#include "QtGui/qregion.h"
+#include "QtGui/qwindow.h"
+#include "qwidget.h"
+#include "QtGui/qplatformnativeinterface_qpa.h"
#include "QtCore/qmutex.h"
#include "QtCore/qtranslator.h"
#include "QtCore/qbasictimer.h"
@@ -512,6 +515,13 @@ public:
#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined (Q_WS_QWS) || defined(Q_WS_MAC) || defined(Q_WS_QPA)
void sendSyntheticEnterLeave(QWidget *widget);
#endif
+#ifdef Q_OS_WIN
+ static HWND getHWNDForWidget(QWidget *widget)
+ {
+ QWindow *window = qobject_cast<QWindow *>(widget);
+ return static_cast<HWND> ("handle", QGuiApplication::platformNativeInterface()->nativeResourceForWindow("handle", window));
+ }
+#endif
#ifndef QT_NO_GESTURES
QGestureManager *gestureManager;
diff --git a/src/widgets/kernel/qapplication_qpa.cpp b/src/widgets/kernel/qapplication_qpa.cpp
index dcda20138d..1b37ddf2e0 100644
--- a/src/widgets/kernel/qapplication_qpa.cpp
+++ b/src/widgets/kernel/qapplication_qpa.cpp
@@ -434,6 +434,18 @@ void qt_init(QApplicationPrivate *, int type)
#endif
}
+#ifdef Q_OS_WIN
+static HDC displayDC = 0; // display device context
+
+Q_WIDGETS_EXPORT HDC qt_win_display_dc() // get display DC
+{
+ Q_ASSERT(qApp && qApp->thread() == QThread::currentThread());
+ if (!displayDC)
+ displayDC = GetDC(0);
+ return displayDC;
+}
+#endif
+
void qt_cleanup()
{
QPixmapCache::clear();
@@ -442,9 +454,14 @@ void qt_cleanup()
QApplicationPrivate::inputContext = 0;
QApplicationPrivate::active_window = 0; //### this should not be necessary
+#ifdef Q_OS_WIN
+ if (displayDC) {
+ ReleaseDC(0, displayDC);
+ displayDC = 0;
+ }
+#endif
}
-
#ifdef QT3_SUPPORT
void QApplication::setMainWidget(QWidget *mainWidget)
{