diff options
author | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-02-18 16:14:52 +0100 |
---|---|---|
committer | Frederik Gladhorn <frederik.gladhorn@digia.com> | 2013-02-18 16:14:52 +0100 |
commit | f4900d340a4c620b56871995741696d28e53c167 (patch) | |
tree | 66d4ed6e4e8012e8a534717e87bf15cf8a992652 /src/plugins | |
parent | 7c33ae6a7bbbd42ce70acf77aa55c1bc2a23c8ec (diff) | |
parent | 843de37bca944110fdf3aab161d680e3845d2dd2 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/widgets/styles/qmacstyle_mac.mm
Change-Id: If8326db9e7da3cbf45dbf7475fdff9915c7723b1
Diffstat (limited to 'src/plugins')
-rw-r--r-- | src/plugins/platforms/cocoa/qnsview.mm | 9 | ||||
-rw-r--r-- | src/plugins/platforms/windows/qwindowsglcontext.cpp | 21 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qglxintegration.cpp | 25 |
3 files changed, 26 insertions, 29 deletions
diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index c23d924993..cdbaa235e4 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -667,9 +667,8 @@ static QTouchDevice *touchDevice = 0; } #endif - - NSPoint windowPoint = [self convertPoint: [theEvent locationInWindow] fromView: nil]; - QPoint qt_windowPoint(windowPoint.x, windowPoint.y); + QPoint qt_windowPoint, qt_screenPoint; + [self convertFromEvent:theEvent toWindowPoint:&qt_windowPoint andScreenPoint:&qt_screenPoint]; NSTimeInterval timestamp = [theEvent timestamp]; ulong qt_timestamp = timestamp * 1000; @@ -687,7 +686,7 @@ static QTouchDevice *touchDevice = 0; currentWheelModifiers = [self convertKeyModifiers:[theEvent modifierFlags]]; } - QWindowSystemInterface::handleWheelEvent(m_window, qt_timestamp, qt_windowPoint, qt_windowPoint, pixelDelta, angleDelta, currentWheelModifiers); + QWindowSystemInterface::handleWheelEvent(m_window, qt_timestamp, qt_windowPoint, qt_screenPoint, pixelDelta, angleDelta, currentWheelModifiers); if (phase == NSEventPhaseEnded || phase == NSEventPhaseCancelled) { currentWheelModifiers = Qt::NoModifier; @@ -695,7 +694,7 @@ static QTouchDevice *touchDevice = 0; } else #endif { - QWindowSystemInterface::handleWheelEvent(m_window, qt_timestamp, qt_windowPoint, qt_windowPoint, pixelDelta, angleDelta, + QWindowSystemInterface::handleWheelEvent(m_window, qt_timestamp, qt_windowPoint, qt_screenPoint, pixelDelta, angleDelta, [self convertKeyModifiers:[theEvent modifierFlags]]); } } diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index 0ef9f931c2..081b42ce65 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -136,6 +136,10 @@ #define GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT 0x0001 #endif +#ifndef GL_CONTEXT_FLAG_DEBUG_BIT +#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 +#endif + QT_BEGIN_NAMESPACE template <class MaskType, class FlagType> inline bool testFlag(MaskType mask, FlagType flag) @@ -696,34 +700,27 @@ QWindowsOpenGLContextFormat QWindowsOpenGLContextFormat::current() result.version = (version.mid(0, majorDot).toInt() << 8) + version.mid(majorDot + 1, minorDot - majorDot - 1).toInt(); } + result.profile = QSurfaceFormat::NoProfile; if (result.version < 0x0300) { - result.profile = QSurfaceFormat::NoProfile; result.options |= QSurfaceFormat::DeprecatedFunctions; return result; } // v3 onwards GLint value = 0; glGetIntegerv(GL_CONTEXT_FLAGS, &value); - if (value & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT) + if (!(value & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)) result.options |= QSurfaceFormat::DeprecatedFunctions; - if (value & WGL_CONTEXT_DEBUG_BIT_ARB) + if (value & GL_CONTEXT_FLAG_DEBUG_BIT) result.options |= QSurfaceFormat::DebugContext; if (result.version < 0x0302) return result; // v3.2 onwards: Profiles value = 0; glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &value); - switch (value) { - case WGL_CONTEXT_CORE_PROFILE_BIT_ARB: + if (value & GL_CONTEXT_CORE_PROFILE_BIT) result.profile = QSurfaceFormat::CoreProfile; - break; - case WGL_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB: + else if (value & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) result.profile = QSurfaceFormat::CompatibilityProfile; - break; - default: - result.profile = QSurfaceFormat::NoProfile; - break; - } return result; } diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index 5e2731430d..854f7bcd17 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -75,6 +75,10 @@ typedef GLXContext (*glXCreateContextAttribsARBProc)(Display*, GLXFBConfig, GLXC #define GLX_CONTEXT_PROFILE_MASK_ARB 0x9126 #endif +#ifndef GL_CONTEXT_FLAG_DEBUG_BIT +#define GL_CONTEXT_FLAG_DEBUG_BIT 0x00000002 +#endif + static Window createDummyWindow(QXcbScreen *screen, XVisualInfo *visualInfo) { Colormap cmap = XCreateColormap(DISPLAY_FROM_XCB(screen), screen->root(), visualInfo->visual, AllocNone); @@ -169,6 +173,8 @@ static void updateFormatFromContext(QSurfaceFormat &format) format.setMinorVersion(minor); } + format.setProfile(QSurfaceFormat::NoProfile); + const int version = (major << 8) + minor; if (version < 0x0300) { format.setProfile(QSurfaceFormat::NoProfile); @@ -180,9 +186,9 @@ static void updateFormatFromContext(QSurfaceFormat &format) // a debug context GLint value = 0; glGetIntegerv(GL_CONTEXT_FLAGS, &value); - if (value & ~GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT) + if (!(value & GL_CONTEXT_FLAG_FORWARD_COMPATIBLE_BIT)) format.setOption(QSurfaceFormat::DeprecatedFunctions); - if (value & GLX_CONTEXT_DEBUG_BIT_ARB) + if (value & GL_CONTEXT_FLAG_DEBUG_BIT) format.setOption(QSurfaceFormat::DebugContext); if (version < 0x0302) return; @@ -190,17 +196,11 @@ static void updateFormatFromContext(QSurfaceFormat &format) // Version 3.2 and newer have a profile value = 0; glGetIntegerv(GL_CONTEXT_PROFILE_MASK, &value); - switch (value) { - case GLX_CONTEXT_CORE_PROFILE_BIT_ARB: + + if (value & GL_CONTEXT_CORE_PROFILE_BIT) format.setProfile(QSurfaceFormat::CoreProfile); - break; - case GLX_CONTEXT_COMPATIBILITY_PROFILE_BIT_ARB: + else if (value & GL_CONTEXT_COMPATIBILITY_PROFILE_BIT) format.setProfile(QSurfaceFormat::CompatibilityProfile); - break; - default: - format.setProfile(QSurfaceFormat::NoProfile); - break; - } } /*! @@ -287,6 +287,7 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat glXCreateContextAttribsARB = (glXCreateContextAttribsARBProc) glXGetProcAddress((const GLubyte*)"glXCreateContextAttribsARB"); QList<QByteArray> glxExt = QByteArray(glXQueryExtensionsString(DISPLAY_FROM_XCB(m_screen), m_screen->screenNumber())).split(' '); + bool supportsProfiles = glxExt.contains("GLX_ARB_create_context_profile"); // Use glXCreateContextAttribsARB if is available if (glxExt.contains("GLX_ARB_create_context") && glXCreateContextAttribsARB != 0) { @@ -306,7 +307,7 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat << GLX_CONTEXT_MINOR_VERSION_ARB << minorVersion; // If asking for OpenGL 3.2 or newer we should also specify a profile - if (m_format.majorVersion() > 3 || (m_format.majorVersion() == 3 && m_format.minorVersion() > 1)) { + if (supportsProfiles && (m_format.majorVersion() > 3 || (m_format.majorVersion() == 3 && m_format.minorVersion() > 1))) { if (m_format.profile() == QSurfaceFormat::CoreProfile) contextAttributes << GLX_CONTEXT_PROFILE_MASK_ARB << GLX_CONTEXT_CORE_PROFILE_BIT_ARB; else |