Ignore:
Timestamp:
May 5, 2011, 5:36:53 AM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/src/opengl/qgl_mac.mm

    r769 r846  
    11/****************************************************************************
    22**
    3 ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
     3** Copyright (C) 201 Nokia Corporation and/or its subsidiary(-ies).
    44** All rights reserved.
    55** Contact: Nokia Corporation ([email protected])
     
    698698        NSView *view = qt_mac_nativeview_for(w);
    699699
    700         // ideally we would use QWidget::isVisible(), but we get "invalid drawable" errors
    701         if (![(NSWindow *)qt_mac_window_for(w) isVisible])
    702             return;
     700        // Trying to attach the GL context to the NSView will fail with
     701        // "invalid drawable" if done too soon, but we have to make sure
     702        // the connection is made before the first paint event. Using
     703        // the NSView do to this check fails as the NSView is visible
     704        // before it's safe to connect, and using the NSWindow fails as
     705        // the NSWindow will become visible after the first paint event.
     706        // This leaves us with the QWidget, who's visible state seems
     707        // to match the point in time when it's safe to connect.
     708        if (!w || !w->isVisible())
     709            return; // Not safe to attach GL context to view yet
     710
    703711        if ([static_cast<NSOpenGLContext *>(d->cx) view] != view && ![view isHidden])
    704712            [static_cast<NSOpenGLContext *>(d->cx) setView:view];
     
    805813{
    806814    CFBundleRef bundle = 0;
     815
    807816    QCFType<CFURLRef> url = CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
    808                  QCFString::toCFStringRef(QLatin1String("/System/Library/Frameworks/OpenGL.framework")), kCFURLPOSIXPathStyle, false);
     817                 , kCFURLPOSIXPathStyle, false);
    809818    if (url)
    810819        bundle = CFBundleCreate(kCFAllocatorDefault, url);
     820
    811821    return bundle;
    812822}
     
    814824void *QGLContext::getProcAddress(const QString &proc) const
    815825{
    816     return CFBundleGetFunctionPointerForName(QCFType<CFBundleRef>(qt_getOpenGLBundle()),
    817                                              QCFString(proc));
     826    CFStringRef procName = QCFString(proc).toCFStringRef(proc);
     827    void *result = CFBundleGetFunctionPointerForName(QCFType<CFBundleRef>(qt_getOpenGLBundle()),
     828                                             procName);
     829    CFRelease(procName);
     830    return result;
    818831}
    819832#ifndef QT_MAC_USE_COCOA
Note: See TracChangeset for help on using the changeset viewer.