[Development] Mac: MouseMove events for inactive applications (qt4+qt5)

Nils Jeisecke njeisecke at saltation.de
Wed Jul 4 19:41:04 CEST 2012


Hi,

in Qt 4.x it's currently not possible to have mouse over effects for
e.g. overlay windows if the application is not active.

The following patch fixes that:

diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index 646053a..9bd1d06 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -470,8 +470,8 @@ static int qCocoaViewCount = 0;
     // turn it on in ALL case. That means EVERY QCocoaView gets to
pay the cost of
     // mouse moves delivered to it (Apple recommends keeping it OFF
because there
     // is a performance hit). So it goes.
-    NSUInteger trackingOptions = NSTrackingMouseEnteredAndExited |
NSTrackingActiveInActiveApp
-                                 | NSTrackingInVisibleRect |
NSTrackingMouseMoved;
+    NSUInteger trackingOptions = NSTrackingMouseEnteredAndExited
+                                 | NSTrackingInVisibleRect |
NSTrackingMouseMoved | NSTrackingActiveAlways;
     NSTrackingArea *ta = [[NSTrackingArea alloc] initWithRect:NSMakeRect(0, 0,

   qwidget->width(),

   qwidget->height())

I would like to post a change request, but I expect people to complain
about the missing fix for qt5 ;-)

I had a look at the Qt5 cocoa platform plugin and have noticed that
the whole tracking stuff simply wasn't ported from Qt4.
Was there any particular reason for this or is it simply not implemented yet?

Thanks

Nils



More information about the Development mailing list