Cocoa: Send window activation events.

Change-Id: I599b4316f1535bf4855b205bfb2117bbcee63bf0
Reviewed-by: Bradley T. Hughes <bradley.hughes@nokia.com>
Reviewed-by: Tor Arne Vestbø <tor.arne.vestbo@nokia.com>
bb10
Morten Johan Sorvig 2012-01-12 12:32:59 +01:00 committed by Qt by Nokia
parent 56b2a229a3
commit 7407045388
3 changed files with 22 additions and 0 deletions

View File

@ -100,6 +100,16 @@ QCocoaWindow::QCocoaWindow(QWindow *tlw)
m_contentView = [[QNSView alloc] initWithQWindow:tlw platformWindow:this];
[[NSNotificationCenter defaultCenter] addObserver:m_contentView
selector:@selector(windowDidBecomeKey)
name:NSWindowDidBecomeKeyNotification
object:m_nsWindow];
[[NSNotificationCenter defaultCenter] addObserver:m_contentView
selector:@selector(windowDidResignKey)
name:NSWindowDidResignKeyNotification
object:m_nsWindow];
// ### Accept touch events by default.
// Beware that enabling touch events has a negative impact on the overall performance.
// We probably need a QWindowSystemInterface API to enable/disable touch events.

View File

@ -62,6 +62,8 @@ class QCocoaWindow;
- (void)setImage:(QImage *)image;
- (void)drawRect:(NSRect)dirtyRect;
- (void)updateGeometry;
- (void)windowDidBecomeKey;
- (void)windowDidResignKey;
- (BOOL)isFlipped;
- (BOOL)acceptsFirstResponder;

View File

@ -138,6 +138,16 @@ static QTouchDevice *touchDevice = 0;
QWindowSystemInterface::handleSynchronousGeometryChange(m_window, geo);
}
- (void)windowDidBecomeKey
{
QWindowSystemInterface::handleWindowActivated(m_window);
}
- (void)windowDidResignKey
{
QWindowSystemInterface::handleWindowActivated(0);
}
- (void) setImage:(QImage *)image
{
CGImageRelease(m_cgImage);