Fixed QT_NO_CURSOR build for windows/CE plugin.

Change-Id: I02f13b2af2d8c285fbca46917ff77826720857be
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@digia.com>
bb10
Bjoern Breitmeyer 2013-01-30 14:39:53 +01:00 committed by The Qt Project
parent d45b40007f
commit e74bf9497c
5 changed files with 34 additions and 2 deletions

View File

@ -39,6 +39,7 @@
**
****************************************************************************/
#ifndef QT_NO_CURSOR
#include "qwindowscursor.h"
#include "qwindowscontext.h"
#include "qwindowswindow.h"
@ -498,3 +499,5 @@ HCURSOR QWindowsWindowCursor::handle() const
}
QT_END_NAMESPACE
#endif // !QT_NO_CURSOR

View File

@ -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)

View File

@ -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

View File

@ -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"
@ -726,7 +728,9 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const WindowData &data) :
m_hdc(0),
m_windowState(Qt::WindowNoState),
m_opacity(1.0),
#ifndef QT_NO_CURSOR
m_cursor(QWindowsScreen::screenOf(aWindow)->windowsCursor()->standardWindowCursor()),
#endif
m_dropTarget(0),
m_savedStyle(0),
m_format(aWindow->format()),
@ -1649,11 +1653,14 @@ void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const
void QWindowsWindow::applyCursor()
{
#ifndef QT_NO_CURSOR
SetCursor(m_cursor.handle());
#endif
}
void QWindowsWindow::setCursor(const QWindowsWindowCursor &c)
{
#ifndef QT_NO_CURSOR
if (c.handle() != m_cursor.handle()) {
const bool underMouse = QWindowsContext::instance()->windowUnderMouse() == window();
if (QWindowsContext::verboseWindows)
@ -1663,6 +1670,7 @@ void QWindowsWindow::setCursor(const QWindowsWindowCursor &c)
if (underMouse)
applyCursor();
}
#endif
}
/*!

View File

@ -224,7 +224,9 @@ public:
void getSizeHints(MINMAXINFO *mmi) const;
#endif
#ifndef QT_NO_CURSOR
QWindowsWindowCursor cursor() const { return m_cursor; }
#endif
void setCursor(const QWindowsWindowCursor &c);
void applyCursor();
@ -270,7 +272,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;