summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/windows
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2013-02-17 20:31:38 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-02-17 20:31:38 +0100
commite88011357e5dd3b0ae4e6bc715ef29e5f4f3ffab (patch)
treec5b05d45e49194d70ff4defae41e5d5d5cf75e80 /src/plugins/platforms/windows
parent2df8884bc68343ad96962e7496b98d6e585c0347 (diff)
parente65cd6f3794e12e6bc5c2ee985eae8e70ff5f333 (diff)
Merge "Merge remote-tracking branch 'origin/stable' into dev" into refs/staging/dev
Diffstat (limited to 'src/plugins/platforms/windows')
-rw-r--r--src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp7
-rw-r--r--src/plugins/platforms/windows/qwindowsbackingstore.cpp8
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.cpp18
-rw-r--r--src/plugins/platforms/windows/qwindowscontext.h2
-rw-r--r--src/plugins/platforms/windows/qwindowscursor.cpp3
-rw-r--r--src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp2
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.cpp25
-rw-r--r--src/plugins/platforms/windows/qwindowsintegration.h4
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.cpp11
-rw-r--r--src/plugins/platforms/windows/qwindowsscreen.h8
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.cpp93
-rw-r--r--src/plugins/platforms/windows/qwindowswindow.h6
-rw-r--r--src/plugins/platforms/windows/windows.pro12
13 files changed, 146 insertions, 53 deletions
diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
index 7cc2b2aeb0..c23902014c 100644
--- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
+++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp
@@ -577,9 +577,10 @@ HRESULT STDMETHODCALLTYPE QWindowsMsaaAccessible::accLocation(long *pxLeft, long
QRect rect;
if (varID.lVal) {
- QAIPointer child = QAIPointer(accessible->child(varID.lVal - 1));
- if (child->isValid())
- rect = child->rect();
+ QAIPointer child(childPointer(varID));
+ if (!child)
+ return E_FAIL;
+ rect = child->rect();
} else {
rect = accessible->rect();
}
diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp
index 792eaf0fdc..b40aefa225 100644
--- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp
+++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp
@@ -88,11 +88,8 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion &region,
QWindowsWindow *rw = QWindowsWindow::baseWindowOf(window);
#ifndef Q_OS_WINCE
- if (rw->format().hasAlpha() && (window->flags() & Qt::FramelessWindowHint)) {
- const long wl = GetWindowLong(rw->handle(), GWL_EXSTYLE);
- if ((wl & WS_EX_LAYERED) == 0)
- SetWindowLong(rw->handle(), GWL_EXSTYLE, wl | WS_EX_LAYERED);
-
+ const Qt::WindowFlags flags = window->flags();
+ if ((flags & Qt::FramelessWindowHint) && QWindowsWindow::setWindowLayered(rw->handle(), flags, rw->format().hasAlpha(), rw->opacity())) {
QRect r = window->frameGeometry();
QPoint frameOffset(window->frameMargins().left(), window->frameMargins().top());
QRect dirtyRect = br.translated(offset + frameOffset);
@@ -101,7 +98,6 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion &region,
POINT ptDst = {r.x(), r.y()};
POINT ptSrc = {0, 0};
BLENDFUNCTION blend = {AC_SRC_OVER, 0, (BYTE)(255.0 * rw->opacity()), AC_SRC_ALPHA};
-
if (QWindowsContext::user32dll.updateLayeredWindowIndirect) {
RECT dirty = {dirtyRect.x(), dirtyRect.y(),
dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()};
diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp
index c658a1814f..a6709dffb3 100644
--- a/src/plugins/platforms/windows/qwindowscontext.cpp
+++ b/src/plugins/platforms/windows/qwindowscontext.cpp
@@ -869,8 +869,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message,
#endif
#ifndef QT_NO_CONTEXTMENU
case QtWindows::ContextMenu:
- handleContextMenuEvent(platformWindow->window(), msg);
- return true;
+ return handleContextMenuEvent(platformWindow->window(), msg);
#endif
default:
break;
@@ -904,7 +903,7 @@ void QWindowsContext::handleFocusEvent(QtWindows::WindowsEventType et,
}
#ifndef QT_NO_CONTEXTMENU
-void QWindowsContext::handleContextMenuEvent(QWindow *window, const MSG &msg)
+bool QWindowsContext::handleContextMenuEvent(QWindow *window, const MSG &msg)
{
bool mouseTriggered = false;
QPoint globalPos;
@@ -914,10 +913,23 @@ void QWindowsContext::handleContextMenuEvent(QWindow *window, const MSG &msg)
globalPos.setX(msg.pt.x);
globalPos.setY(msg.pt.y);
pos = QWindowsGeometryHint::mapFromGlobal(msg.hwnd, globalPos);
+
+ RECT clientRect;
+ if (GetClientRect(msg.hwnd, &clientRect)) {
+ if (pos.x() < (int)clientRect.left || pos.x() >= (int)clientRect.right ||
+ pos.y() < (int)clientRect.top || pos.y() >= (int)clientRect.bottom)
+ {
+ // This is the case that user has right clicked in the window's caption,
+ // We should call DefWindowProc() to display a default shortcut menu
+ // instead of sending a Qt window system event.
+ return false;
+ }
+ }
}
QWindowSystemInterface::handleContextMenuEvent(window, mouseTriggered, pos, globalPos,
QWindowsKeyMapper::queryKeyboardModifiers());
+ return true;
}
#endif
diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h
index bfe56ed246..1fe71e3aff 100644
--- a/src/plugins/platforms/windows/qwindowscontext.h
+++ b/src/plugins/platforms/windows/qwindowscontext.h
@@ -192,7 +192,7 @@ public:
private:
void handleFocusEvent(QtWindows::WindowsEventType et, QWindowsWindow *w);
#ifndef QT_NO_CONTEXTMENU
- void handleContextMenuEvent(QWindow *window, const MSG &msg);
+ bool handleContextMenuEvent(QWindow *window, const MSG &msg);
#endif
void unregisterWindowClasses();
diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp
index 4f9698b21b..5b2a3acbae 100644
--- a/src/plugins/platforms/windows/qwindowscursor.cpp
+++ b/src/plugins/platforms/windows/qwindowscursor.cpp
@@ -39,6 +39,7 @@
**
****************************************************************************/
+#ifndef QT_NO_CURSOR
#include "qwindowscursor.h"
#include "qwindowscontext.h"
#include "qwindowswindow.h"
@@ -527,3 +528,5 @@ HCURSOR QWindowsWindowCursor::handle() const
}
QT_END_NAMESPACE
+
+#endif // !QT_NO_CURSOR
diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
index a71ee2f9ed..c2ddb912f1 100644
--- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
+++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp
@@ -247,7 +247,7 @@ static bool addFontToDatabase(QString familyName, const QString &scriptName,
value = fontCache.value(faceName);
- //Fallback if we havent cached the font yet or the font got removed/renamed iterate again over all fonts
+ //Fallback if we haven't cached the font yet or the font got removed/renamed iterate again over all fonts
if (value.isEmpty() || !QFile::exists(value)) {
QSettings settings(QSettings::SystemScope, QStringLiteral("Qt-Project"), QStringLiteral("Qtbase"));
settings.beginGroup(QStringLiteral("CEFontCache"));
diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp
index 3c6fcca813..30e0478e64 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.cpp
+++ b/src/plugins/platforms/windows/qwindowsintegration.cpp
@@ -59,8 +59,10 @@
#include "qwindowsguieventdispatcher.h"
#ifndef QT_NO_CLIPBOARD
# include "qwindowsclipboard.h"
+# ifndef QT_NO_DRAGANDDROP
+# include "qwindowsdrag.h"
+# endif
#endif
-#include "qwindowsdrag.h"
#include "qwindowsinputcontext.h"
#include "qwindowskeymapper.h"
# ifndef QT_NO_ACCESSIBILITY
@@ -108,6 +110,9 @@ public:
Q_INVOKABLE void *createMessageWindow(const QString &classNameTemplate,
const QString &windowName,
void *eventProc) const;
+
+ Q_INVOKABLE QString registerWindowClass(const QString &classNameIn, void *eventProc) const;
+
bool asyncExpose() const;
void setAsyncExpose(bool value);
@@ -223,6 +228,15 @@ void *QWindowsNativeInterface::createMessageWindow(const QString &classNameTempl
return hwnd;
}
+/*!
+ \brief Registers a unique window class with a callback function based on \a classNameIn.
+*/
+
+QString QWindowsNativeInterface::registerWindowClass(const QString &classNameIn, void *eventProc) const
+{
+ return QWindowsContext::instance()->registerWindowClass(classNameIn, (WNDPROC)eventProc);
+}
+
bool QWindowsNativeInterface::asyncExpose() const
{
return QWindowsContext::instance()->asyncExpose();
@@ -291,8 +305,10 @@ struct QWindowsIntegrationPrivate
QWindowsNativeInterface m_nativeInterface;
#ifndef QT_NO_CLIPBOARD
QWindowsClipboard m_clipboard;
-#endif
+# ifndef QT_NO_DRAGANDDROP
QWindowsDrag m_drag;
+# endif
+#endif
QWindowsGuiEventDispatcher *m_eventDispatcher;
#if defined(QT_OPENGL_ES_2)
QEGLStaticContextPtr m_staticEGLContext;
@@ -559,12 +575,13 @@ QPlatformClipboard * QWindowsIntegration::clipboard() const
{
return &d->m_clipboard;
}
-#endif // !QT_NO_CLIPBOARD
-
+# ifndef QT_NO_DRAGANDDROP
QPlatformDrag *QWindowsIntegration::drag() const
{
return &d->m_drag;
}
+# endif // !QT_NO_DRAGANDDROP
+#endif // !QT_NO_CLIPBOARD
QPlatformInputContext * QWindowsIntegration::inputContext() const
{
diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h
index 2593c3b946..24dc01f0bd 100644
--- a/src/plugins/platforms/windows/qwindowsintegration.h
+++ b/src/plugins/platforms/windows/qwindowsintegration.h
@@ -75,8 +75,10 @@ public:
virtual QAbstractEventDispatcher *guiThreadEventDispatcher() const;
#ifndef QT_NO_CLIPBOARD
virtual QPlatformClipboard *clipboard() const;
-#endif
+# ifndef QT_NO_DRAGANDDROP
virtual QPlatformDrag *drag() const;
+# endif
+#endif !QT_NO_CLIPBOARD
virtual QPlatformInputContext *inputContext() const;
#ifndef QT_NO_ACCESSIBILITY
virtual QPlatformAccessibility *accessibility() const;
diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp
index 9bb16793cc..f616972aa0 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.cpp
+++ b/src/plugins/platforms/windows/qwindowsscreen.cpp
@@ -168,8 +168,10 @@ static QDebug operator<<(QDebug dbg, const QWindowsScreenData &d)
// Return the cursor to be shared by all screens (virtual desktop).
static inline QSharedPointer<QWindowsCursor> sharedCursor()
{
+#ifndef QT_NO_CURSOR
if (const QScreen *primaryScreen = QGuiApplication::primaryScreen())
return static_cast<const QWindowsScreen *>(primaryScreen->handle())->windowsCursor();
+#endif
return QSharedPointer<QWindowsCursor>(new QWindowsCursor);
}
@@ -182,7 +184,10 @@ static inline QSharedPointer<QWindowsCursor> sharedCursor()
*/
QWindowsScreen::QWindowsScreen(const QWindowsScreenData &data) :
- m_data(data), m_cursor(sharedCursor())
+ m_data(data)
+#ifndef QT_NO_CURSOR
+ ,m_cursor(sharedCursor())
+#endif
{
}
@@ -250,7 +255,11 @@ QWindow *QWindowsScreen::windowAt(const QPoint &screenPoint, unsigned flags)
QWindow *QWindowsScreen::windowUnderMouse(unsigned flags)
{
+#ifndef QT_NO_CURSOR
return QWindowsScreen::windowAt(QWindowsCursor::mousePosition(), flags);
+#else
+ return 0;
+#endif
}
QWindowsScreen *QWindowsScreen::screenOf(const QWindow *w)
diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h
index 7da1a4d207..216973125b 100644
--- a/src/plugins/platforms/windows/qwindowsscreen.h
+++ b/src/plugins/platforms/windows/qwindowsscreen.h
@@ -79,7 +79,9 @@ struct QWindowsScreenData
class QWindowsScreen : public QPlatformScreen
{
public:
+#ifndef QT_NO_CURSOR
typedef QSharedPointer<QWindowsCursor> WindowsCursorPtr;
+#endif
explicit QWindowsScreen(const QWindowsScreenData &data);
@@ -106,14 +108,20 @@ public:
inline void handleChanges(const QWindowsScreenData &newData);
+#ifndef QT_NO_CURSOR
QPlatformCursor *cursor() const { return m_cursor.data(); }
const WindowsCursorPtr &windowsCursor() const { return m_cursor; }
+#else
+ QPlatformCursor *cursor() const { return 0; }
+#endif // !QT_NO_CURSOR
const QWindowsScreenData &data() const { return m_data; }
private:
QWindowsScreenData m_data;
+#ifndef QT_NO_CURSOR
const WindowsCursorPtr m_cursor;
+#endif
};
class QWindowsScreenManager
diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp
index 9391929c41..d565420f4f 100644
--- a/src/plugins/platforms/windows/qwindowswindow.cpp
+++ b/src/plugins/platforms/windows/qwindowswindow.cpp
@@ -44,7 +44,9 @@
#include "qwindowscontext.h"
#include "qwindowsdrag.h"
#include "qwindowsscreen.h"
-#include "qwindowscursor.h"
+#ifdef QT_NO_CURSOR
+# include "qwindowscursor.h"
+#endif
#ifdef QT_OPENGL_ES_2
# include "qwindowseglcontext.h"
@@ -209,22 +211,42 @@ static bool shouldShowMaximizeButton(Qt::WindowFlags flags)
return flags & Qt::WindowMaximizeButtonHint;
}
-static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, qreal level)
+// Set the WS_EX_LAYERED flag on a HWND if required. This is required for
+// translucent backgrounds, not fully opaque windows and for
+// Qt::WindowTransparentForInput (in combination with WS_EX_TRANSPARENT).
+bool QWindowsWindow::setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal opacity)
+{
+#ifndef Q_OS_WINCE // maybe needs revisiting WS_EX_LAYERED
+ const LONG exStyle = GetWindowLong(hwnd, GWL_EXSTYLE);
+ const bool needsLayered = (flags & Qt::WindowTransparentForInput)
+ || (hasAlpha && (flags & Qt::FramelessWindowHint)) || opacity < 1.0;
+ const bool isLayered = (exStyle & WS_EX_LAYERED);
+ if (needsLayered != isLayered) {
+ if (needsLayered) {
+ SetWindowLong(hwnd, GWL_EXSTYLE, exStyle | WS_EX_LAYERED);
+ } else {
+ SetWindowLong(hwnd, GWL_EXSTYLE, exStyle & ~WS_EX_LAYERED);
+ }
+ }
+ return needsLayered;
+#else // !Q_OS_WINCE
+ Q_UNUSED(hwnd);
+ Q_UNUSED(flags);
+ Q_UNUSED(hasAlpha);
+ Q_UNUSED(opacity);
+ return false;
+#endif // Q_OS_WINCE
+}
+
+static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal level)
{
-#ifdef Q_OS_WINCE // maybe needs revisit WS_EX_LAYERED
+#ifdef Q_OS_WINCE // WINCE does not support that feature and microsoft explicitly warns to use those calls
Q_UNUSED(hwnd);
Q_UNUSED(flags);
+ Q_UNUSED(hasAlpha);
Q_UNUSED(level);
#else
- const long wl = GetWindowLong(hwnd, GWL_EXSTYLE);
- const bool isOpaque = level == 1.0 && !(flags & Qt::WindowTransparentForInput);
-
- if (isOpaque) {
- if (wl & WS_EX_LAYERED)
- SetWindowLong(hwnd, GWL_EXSTYLE, wl & ~WS_EX_LAYERED);
- } else {
- if ((wl & WS_EX_LAYERED) == 0)
- SetWindowLong(hwnd, GWL_EXSTYLE, wl | WS_EX_LAYERED);
+ if (QWindowsWindow::setWindowLayered(hwnd, flags, hasAlpha, level)) {
if (flags & Qt::FramelessWindowHint) {
BLENDFUNCTION blend = {AC_SRC_OVER, 0, (BYTE)(255.0 * level), AC_SRC_ALPHA};
QWindowsContext::user32dll.updateLayeredWindow(hwnd, NULL, NULL, NULL, NULL, NULL, 0, &blend, ULW_ALPHA);
@@ -271,7 +293,7 @@ struct WindowCreationData
WindowCreationData() : parentHandle(0), type(Qt::Widget), style(0), exStyle(0),
topLevel(false), popup(false), dialog(false), desktop(false),
- tool(false), embedded(false) {}
+ tool(false), embedded(false), hasAlpha(false) {}
void fromWindow(const QWindow *w, const Qt::WindowFlags flags, unsigned creationFlags = 0);
inline WindowData create(const QWindow *w, const WindowData &data, QString title) const;
@@ -290,6 +312,7 @@ struct WindowCreationData
bool desktop;
bool tool;
bool embedded;
+ bool hasAlpha;
};
QDebug operator<<(QDebug debug, const WindowCreationData &d)
@@ -308,6 +331,7 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag
unsigned creationFlags)
{
isGL = w->surfaceType() == QWindow::OpenGLSurface;
+ hasAlpha = w->format().hasAlpha();
flags = flagsIn;
// Sometimes QWindow doesn't have a QWindow parent but does have a native parent window,
@@ -321,10 +345,12 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag
if (creationFlags & ForceChild) {
topLevel = false;
- } else if (creationFlags & ForceTopLevel) {
- topLevel = true;
+ } else if (embedded) {
+ // Embedded native windows (for example Active X server windows) are by
+ // definition never toplevel, even though they do not have QWindow parents.
+ topLevel = false;
} else {
- topLevel = w->isTopLevel();
+ topLevel = (creationFlags & ForceTopLevel) ? true : w->isTopLevel();
}
if (topLevel && flags == 1) {
@@ -530,7 +556,7 @@ void WindowCreationData::initialize(HWND hwnd, bool frameChange, qreal opacityLe
EnableMenuItem(systemMenu, SC_CLOSE, MF_BYCOMMAND|MF_GRAYED);
}
- setWindowOpacity(hwnd, flags, opacityLevel);
+ setWindowOpacity(hwnd, flags, hasAlpha, opacityLevel);
} else { // child.
SetWindowPos(hwnd, HWND_TOP, 0, 0, 0, 0, swpFlags);
}
@@ -770,8 +796,10 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) :
break;
}
}
+#ifndef Q_OS_WINCE
if (QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch)
QWindowsContext::user32dll.registerTouchWindow(m_data.hwnd, 0);
+#endif // !Q_OS_WINCE
setWindowState(aWindow->windowState());
const qreal opacity = qt_window_private(aWindow)->opacity;
if (!qFuzzyCompare(opacity, qreal(1.0)))
@@ -780,8 +808,10 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) :
QWindowsWindow::~QWindowsWindow()
{
+#ifndef Q_OS_WINCE
if (QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch)
QWindowsContext::user32dll.unregisterTouchWindow(m_data.hwnd);
+#endif // !Q_OS_WINCE
destroyWindow();
destroyIcon();
}
@@ -811,7 +841,7 @@ void QWindowsWindow::destroyWindow()
ShowWindow(handle, SW_SHOW);
}
}
-#endif
+#endif // !Q_OS_WINCE
if (m_data.hwnd != GetDesktopWindow())
DestroyWindow(m_data.hwnd);
QWindowsContext::instance()->removeWindow(m_data.hwnd);
@@ -821,21 +851,29 @@ void QWindowsWindow::destroyWindow()
void QWindowsWindow::registerDropSite()
{
+#ifndef QT_NO_CLIPBOARD
+# ifndef QT_NO_DRAGANDDROP
if (m_data.hwnd && !m_dropTarget) {
m_dropTarget = new QWindowsOleDropTarget(window());
RegisterDragDrop(m_data.hwnd, m_dropTarget);
CoLockObjectExternal(m_dropTarget, true, true);
}
+# endif // !QT_NO_DRAGANDDROP
+#endif // !QT_NO_CLIPBOARD
}
void QWindowsWindow::unregisterDropSite()
{
+#ifndef QT_NO_CLIPBOARD
+# ifndef QT_NO_DRAGANDDROP
if (m_data.hwnd && m_dropTarget) {
m_dropTarget->Release();
CoLockObjectExternal(m_dropTarget, false, true);
RevokeDragDrop(m_data.hwnd);
m_dropTarget = 0;
}
+# endif // !QT_NO_DRAGANDDROP
+#endif // !QT_NO_CLIPBOARD
}
// Returns topmost QWindowsWindow ancestor even if there are embedded windows in the chain.
@@ -1231,18 +1269,7 @@ void QWindowsWindow::setWindowTitle(const QString &title)
if (QWindowsContext::verboseWindows)
qDebug() << __FUNCTION__ << this << window() <<title;
if (m_data.hwnd) {
-
- QString fullTitle = title;
- if (QGuiApplicationPrivate::displayName) {
- // Append display name, if set.
- if (!fullTitle.isEmpty())
- fullTitle += QStringLiteral(" - ");
- fullTitle += *QGuiApplicationPrivate::displayName;
- } else if (fullTitle.isEmpty()) {
- // Don't let the window title be completely empty, use the app name as fallback.
- fullTitle = QCoreApplication::applicationName();
- }
-
+ const QString fullTitle = formatWindowTitle(title, QStringLiteral(" - "));
SetWindowText(m_data.hwnd, (const wchar_t*)fullTitle.utf16());
}
}
@@ -1508,7 +1535,7 @@ void QWindowsWindow::setOpacity(qreal level)
if (m_opacity != level) {
m_opacity = level;
if (m_data.hwnd)
- setWindowOpacity(m_data.hwnd, m_data.flags, level);
+ setWindowOpacity(m_data.hwnd, m_data.flags, window()->format().hasAlpha(), level);
}
}
@@ -1671,12 +1698,14 @@ void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const
void QWindowsWindow::applyCursor()
{
+#ifndef QT_NO_CURSOR
if (m_cursor.isNull()) { // Recurse up to parent with non-null cursor.
if (const QWindow *p = window()->parent())
QWindowsWindow::baseWindowOf(p)->applyCursor();
} else {
SetCursor(m_cursor.handle());
}
+#endif
}
// Check whether to apply a new cursor. Either the window in question is
@@ -1698,6 +1727,7 @@ static inline bool applyNewCursor(const QWindow *w)
void QWindowsWindow::setCursor(const QWindowsWindowCursor &c)
{
+#ifndef QT_NO_CURSOR
if (c.handle() != m_cursor.handle()) {
const bool apply = applyNewCursor(window());
if (QWindowsContext::verboseWindows)
@@ -1707,6 +1737,7 @@ void QWindowsWindow::setCursor(const QWindowsWindowCursor &c)
if (apply)
applyCursor();
}
+#endif
}
/*!
diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h
index 9dc8c170e7..8fe5cbe17b 100644
--- a/src/plugins/platforms/windows/qwindowswindow.h
+++ b/src/plugins/platforms/windows/qwindowswindow.h
@@ -223,13 +223,17 @@ public:
static inline void *userDataOf(HWND hwnd);
static inline void setUserDataOf(HWND hwnd, void *ud);
+ static bool setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal opacity);
+
HDC getDC();
void releaseDC();
#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO
void getSizeHints(MINMAXINFO *mmi) const;
#endif
+#ifndef QT_NO_CURSOR
QWindowsWindowCursor cursor() const { return m_cursor; }
+#endif
void setCursor(const QWindowsWindowCursor &c);
void applyCursor();
@@ -275,7 +279,9 @@ private:
HDC m_hdc;
Qt::WindowState m_windowState;
qreal m_opacity;
+#ifndef QT_NO_CURSOR
QWindowsWindowCursor m_cursor;
+#endif
QWindowsOleDropTarget *m_dropTarget;
unsigned m_savedStyle;
QRect m_savedFrameGeometry;
diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro
index 7f73465135..ff162e2d41 100644
--- a/src/plugins/platforms/windows/windows.pro
+++ b/src/plugins/platforms/windows/windows.pro
@@ -45,7 +45,6 @@ SOURCES += \
qwindowsguieventdispatcher.cpp \
qwindowsole.cpp \
qwindowsmime.cpp \
- qwindowsdrag.cpp \
qwindowsinternalmimedata.cpp \
qwindowscursor.cpp \
qwindowsinputcontext.cpp \
@@ -69,7 +68,6 @@ HEADERS += \
qtwindows_additional.h \
qwindowsole.h \
qwindowsmime.h \
- qwindowsdrag.h \
qwindowsinternalmimedata.h \
qwindowscursor.h \
array.h \
@@ -94,6 +92,16 @@ contains(QT_CONFIG, opengles2) {
HEADERS += qwindowsclipboard.h
}
+# drag and drop on windows only works if a clipboard is available
+!contains( DEFINES, QT_NO_DRAGANDDROP ) {
+ !win32:SOURCES += qwindowsdrag.cpp
+ !win32:HEADERS += qwindowsdrag.h
+ win32:!contains( DEFINES, QT_NO_CLIPBOARD ) {
+ HEADERS += qwindowsdrag.h
+ SOURCES += qwindowsdrag.cpp
+ }
+}
+
# Enable access to HB_Face in harfbuzz includes included by qfontengine_p.h.
DEFINES *= QT_COMPILES_IN_HARFBUZZ