diff options
author | Norwegian Rock Cat <qt-info@nokia.com> | 2009-04-14 13:02:34 (GMT) |
---|---|---|
committer | Norwegian Rock Cat <qt-info@nokia.com> | 2009-04-14 13:35:39 (GMT) |
commit | 56feb92927d48edffcd09491091ec735b86a820d (patch) | |
tree | 114a4e229ab0f46a4ea56a7031e20456bf7f9260 /src/gui/kernel/qcursor_mac.mm | |
parent | 9a41b437be6014c7a671591e2741c5ca7d8c8be8 (diff) | |
download | Qt-56feb92927d48edffcd09491091ec735b86a820d.zip Qt-56feb92927d48edffcd09491091ec735b86a820d.tar.gz Qt-56feb92927d48edffcd09491091ec735b86a820d.tar.bz2 |
Fix a bug where a widget would not always get the correct Cursor in Cocoa
Cocoa has a different way of dealing with cursors than our heavy handed
approach that we used in Carbon. We simply need to re-implement the
proper function in NSView and set up the rectangles for the cursor
correctly. We also need to expose an QCursor2NSCursor type functions
since the current QCursor::handle() is useless for doing this and we
shouldn't change that. With this change things seem to work much more
like the native stuff for both Carbon and Cocoa.
Diffstat (limited to 'src/gui/kernel/qcursor_mac.mm')
-rw-r--r-- | src/gui/kernel/qcursor_mac.mm | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/gui/kernel/qcursor_mac.mm b/src/gui/kernel/qcursor_mac.mm index d632eb79..ae98f2e 100644 --- a/src/gui/kernel/qcursor_mac.mm +++ b/src/gui/kernel/qcursor_mac.mm @@ -95,9 +95,19 @@ protected: } }; +void *nsCursorForQCursor(const QCursor &c) +{ + c.d->update(); + return [[static_cast<NSCursor *>(c.d->curs.cp.nscursor) retain] autorelease]; +} + static QCursorData *currentCursor = 0; //current cursor void qt_mac_set_cursor(const QCursor *c, const QPoint &) { +#ifdef QT_MAC_USE_COCOA + Q_UNUSED(c); + return; +#else if (!c) { currentCursor = 0; return; @@ -128,10 +138,15 @@ void qt_mac_set_cursor(const QCursor *c, const QPoint &) } } currentCursor = c->d; +#endif } void qt_mac_update_cursor_at_global_pos(const QPoint &globalPos) { +#ifdef QT_MAC_USE_COCOA + Q_UNUSED(globalPos); + return; +#else QCursor cursor(Qt::ArrowCursor); if (QApplication::overrideCursor()) { cursor = *QApplication::overrideCursor(); @@ -144,6 +159,7 @@ void qt_mac_update_cursor_at_global_pos(const QPoint &globalPos) } } qt_mac_set_cursor(&cursor, globalPos); +#endif } void qt_mac_update_cursor() |