summaryrefslogtreecommitdiffstats
path: root/src/plugins/platforms/cocoa/qcocoaintegration.mm
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/platforms/cocoa/qcocoaintegration.mm')
-rw-r--r--src/plugins/platforms/cocoa/qcocoaintegration.mm46
1 files changed, 28 insertions, 18 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm
index 086f7b62e9..3e03b1a23d 100644
--- a/src/plugins/platforms/cocoa/qcocoaintegration.mm
+++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm
@@ -42,14 +42,11 @@
#include "qcocoaintegration.h"
#include "qcocoawindow.h"
-#include "qcocoawindowsurface.h"
-#include "qcocoaeventloopintegration.h"
+#include "qcocoabackingstore.h"
+#include "qcocoanativeinterface.h"
-#include "qcoretextfontdatabase.h"
-
-#include <QtGui/QApplication>
-
-#include <private/qpixmap_raster_p.h>
+#include "qcocoaeventdispatcher.h"
+#include <QtPlatformSupport/private/qbasicunixfontdatabase_p.h>
QT_BEGIN_NAMESPACE
@@ -74,7 +71,8 @@ QCocoaScreen::~QCocoaScreen()
}
QCocoaIntegration::QCocoaIntegration()
- : mFontDb(new QCoreTextFontDatabase())
+ : mFontDb(new QBasicUnixFontDatabase())
+ , mEventDispatcher(new QCocoaEventDispatcher())
{
mPool = new QCocoaAutoReleasePool;
@@ -82,10 +80,16 @@ QCocoaIntegration::QCocoaIntegration()
[NSApplication sharedApplication];
// [[OurApplication alloc] init];
+ // Move the application window to front to avoid launching behind the terminal.
+ // Ignoring other apps is neccessary (we must ignore the terminal), but makes
+ // Qt apps play slightly less nice with other apps when lanching from Finder
+ // (See the activateIgnoringOtherApps docs.)
+ [[NSApplication sharedApplication] activateIgnoringOtherApps : YES];
+
NSArray *screens = [NSScreen screens];
for (uint i = 0; i < [screens count]; i++) {
QCocoaScreen *screen = new QCocoaScreen(i);
- mScreens.append(screen);
+ screenAdded(screen);
}
}
@@ -98,26 +102,31 @@ bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) cons
{
switch (cap) {
case ThreadedPixmaps: return true;
+ case OpenGL : return true;
default: return QPlatformIntegration::hasCapability(cap);
}
}
-QPixmapData *QCocoaIntegration::createPixmapData(QPixmapData::PixelType type) const
+QPlatformWindow *QCocoaIntegration::createPlatformWindow(QWindow *window) const
{
- return new QRasterPixmapData(type);
+ return new QCocoaWindow(window);
}
-QPlatformWindow *QCocoaIntegration::createPlatformWindow(QWidget *widget, WId winId) const
+QPlatformGLContext *QCocoaIntegration::createPlatformGLContext(QGuiGLContext *context) const
{
- Q_UNUSED(winId);
- return new QCocoaWindow(widget);
+ return new QCocoaGLContext(context->format(), context->shareHandle());
}
-QWindowSurface *QCocoaIntegration::createWindowSurface(QWidget *widget, WId winId) const
+QPlatformBackingStore *QCocoaIntegration::createPlatformBackingStore(QWindow *window) const
{
- return new QCocoaWindowSurface(widget,winId);
+ return new QCocoaBackingStore(window);
+}
+
+QAbstractEventDispatcher *QCocoaIntegration::guiThreadEventDispatcher() const
+{
+ return mEventDispatcher;
}
QPlatformFontDatabase *QCocoaIntegration::fontDatabase() const
@@ -125,8 +134,9 @@ QPlatformFontDatabase *QCocoaIntegration::fontDatabase() const
return mFontDb;
}
-QPlatformEventLoopIntegration *QCocoaIntegration::createEventLoopIntegration() const
+QPlatformNativeInterface *QCocoaIntegration::nativeInterface() const
{
- return new QCocoaEventLoopIntegration();
+ return new QCocoaNativeInterface();
}
+
QT_END_NAMESPACE