summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorten Sorvig <morten.sorvig@nokia.com>2011-08-15 13:09:18 +0200
committerRichard Moe Gustavsen <richard.gustavsen@nokia.com>2011-08-18 09:46:57 +0200
commitc9d1adb7fa42cb36e5da0fb691efb6fd61f4d2f2 (patch)
treee1bbe388f33bd1af13cc6adf77ab8d7278ecc4c4
parent6fce65f87129e7f9a02b1dcba73e8cef66c8bbbc (diff)
Create NSWindow subclass.
Allows us to override canBecomeKeyWindow etc. Change-Id: Ia74006ac85acb98e8a0fe0a8cdc8e5e0b9aee5c4 Reviewed-on: http://codereview.qt.nokia.com/2955 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@nokia.com>
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.h11
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm20
2 files changed, 27 insertions, 4 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h
index e301c48e59..92fc026bc1 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.h
+++ b/src/plugins/platforms/cocoa/qcocoawindow.h
@@ -52,6 +52,12 @@
QT_BEGIN_NAMESPACE
+@interface QNSWindow : NSWindow {
+
+}
+
+@end
+
class QCocoaWindow : public QPlatformWindow
{
public:
@@ -76,13 +82,14 @@ public:
protected:
void determineWindowClass();
- NSWindow *createWindow();
+ QNSWindow *createWindow();
NSRect globalGeometry(const QRect localWindowGeometry) const;
QRect windowGeometry() const;
QCocoaWindow *parentCocoaWindow() const;
+
private:
friend class QCocoaBackingStore;
- NSWindow *m_nsWindow;
+ QNSWindow *m_nsWindow;
QNSView *m_contentView;
NSView *m_windowSurfaceView;
quint32 m_windowAttributes;
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index fefdbc8205..7e88cdbf75 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -53,8 +53,24 @@
#include <QDebug>
+@implementation QNSWindow
+
+- (BOOL)canBecomeKeyWindow
+{
+ return YES;
+}
+
+- (BOOL)canBecomeMainWindow
+{
+ return YES;
+}
+
+@end
+
QCocoaWindow::QCocoaWindow(QWindow *tlw)
: QPlatformWindow(tlw)
+ , m_windowAttributes(0)
+ , m_windowClass(0)
, m_glContext(0)
{
QCocoaAutoReleasePool pool;
@@ -251,7 +267,7 @@ void QCocoaWindow::determineWindowClass()
/*
*/
-NSWindow * QCocoaWindow::createWindow()
+QNSWindow * QCocoaWindow::createWindow()
{
// Determine if we need to add in our "custom window" attribute. Cocoa is rather clever
// in deciding if we need the maximize button or not (i.e., it's resizeable, so you
@@ -272,7 +288,7 @@ NSWindow * QCocoaWindow::createWindow()
*/
NSRect frame = globalGeometry(window()->geometry());
QCocoaAutoReleasePool pool;
- NSWindow *window;
+ QNSWindow *window;
switch (m_windowClass) {
case kMovableModalWindowClass: