summaryrefslogtreecommitdiffstats
path: root/src/gui/kernel/qcocoaview_mac.mm
diff options
context:
space:
mode:
authorNorwegian Rock Cat <qt-info@nokia.com>2009-04-15 12:11:39 +0200
committerNorwegian Rock Cat <qt-info@nokia.com>2009-04-15 12:17:06 +0200
commitb4234ab3f4dbd8c7017d749888b2d8effd3c5983 (patch)
tree6be863fea37b64cb9950da2274cbe6a4423ab401 /src/gui/kernel/qcocoaview_mac.mm
parenta55f477b2a40b89e690fe6b61509cf665e96243b (diff)
BT: Fix Cocoa bug w/OpenGL widgets in dock widgets would disappear.
The NSOpenGLContext seems to be tied to the window. So if the view changes from one window to another, the OpenGL context needs to be cleared. We can do this by hooking into the viewWillChangeWindow and viewDidChangeWindow events and clear and reset the drawable respectively. We also found out that QCocoaOpenGLView was not being used at all, so just remove it to get rid of any confusion. Task-number: 250066 Reviewed-by: Trond
Diffstat (limited to 'src/gui/kernel/qcocoaview_mac.mm')
-rw-r--r--src/gui/kernel/qcocoaview_mac.mm21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm
index bcbd1bfc90..7668d66bb9 100644
--- a/src/gui/kernel/qcocoaview_mac.mm
+++ b/src/gui/kernel/qcocoaview_mac.mm
@@ -944,6 +944,27 @@ extern "C" {
}
}
+- (void)viewWillMoveToWindow:(NSWindow *)window
+{
+ if (qwidget->windowFlags() & Qt::MSWindowsOwnDC
+ && (window != [self window])) { // OpenGL Widget
+ // Create a stupid ClearDrawable Event
+ QEvent event(QEvent::MacGLClearDrawable);
+ qApp->sendEvent(qwidget, &event);
+ }
+}
+
+- (void)viewDidMoveToWindow
+{
+ if (qwidget->windowFlags() & Qt::MSWindowsOwnDC && [self window]) {
+ // call update paint event
+ qwidgetprivate->needWindowChange = true;
+ QEvent event(QEvent::MacGLWindowChange);
+ qApp->sendEvent(qwidget, &event);
+ }
+}
+
+
// NSTextInput Protocol implementation
- (void) insertText:(id)aString