Cocoa: Mouse enter events on window activation.

This patch tells the window system that it should create a mouse enter
event if a window was activated when the mouse was inside. This wasn't
working and was a regression.

Task-number: QTBUG-35109

[ChangeLog][Cocoa] Fix enterEvent not being called on activate.

Change-Id: I4e4662b4a4c58dafa8d0a2c09458ab88f678d243
Reviewed-by: Liang Qi <liang.qi@digia.com>
This commit is contained in:
Christoph Schleifenbaum 2013-11-25 19:45:06 +01:00 committed by The Qt Project
parent 923d498029
commit 5361513ec8
3 changed files with 14 additions and 0 deletions

View File

@ -93,6 +93,8 @@ QT_END_NAMESPACE
- (BOOL)hasMask;
- (BOOL)isOpaque;
- (void)convertFromScreen:(NSPoint)mouseLocation toWindowPoint:(QPointF *)qtWindowPoint andScreenPoint:(QPointF *)qtScreenPoint;
- (void)resetMouseButtons;
- (void)handleMouseEvent:(NSEvent *)theEvent;

View File

@ -53,6 +53,7 @@
- (id)initWithQCocoaWindow: (QCocoaWindow *) cocoaWindow;
- (void)windowDidBecomeKey:(NSNotification *)notification;
- (void)windowDidResize:(NSNotification *)notification;
- (void)windowDidMove:(NSNotification *)notification;
- (void)windowWillMove:(NSNotification *)notification;

View File

@ -56,6 +56,17 @@
return self;
}
- (void)windowDidBecomeKey:(NSNotification *)notification
{
Q_UNUSED(notification);
if (m_cocoaWindow->m_windowUnderMouse) {
QPointF windowPoint;
QPointF screenPoint;
[m_cocoaWindow->m_qtView convertFromScreen:[NSEvent mouseLocation] toWindowPoint:&windowPoint andScreenPoint:&screenPoint];
QWindowSystemInterface::handleEnterEvent(m_cocoaWindow->m_enterLeaveTargetWindow, windowPoint, screenPoint);
}
}
- (void)windowDidResize:(NSNotification *)notification
{
Q_UNUSED(notification);