diff options
Diffstat (limited to 'src/gui/kernel')
-rw-r--r-- | src/gui/kernel/qguiapplication.cpp | 17 | ||||
-rw-r--r-- | src/gui/kernel/qkeysequence.cpp | 16 | ||||
-rw-r--r-- | src/gui/kernel/qopenglcontext.cpp | 33 | ||||
-rw-r--r-- | src/gui/kernel/qopenglcontext.h | 3 | ||||
-rw-r--r-- | src/gui/kernel/qopenglcontext_p.h | 3 | ||||
-rw-r--r-- | src/gui/kernel/qplatformmenu.h | 6 | ||||
-rw-r--r-- | src/gui/kernel/qplatformtheme.cpp | 26 | ||||
-rw-r--r-- | src/gui/kernel/qstylehints.cpp | 2 | ||||
-rw-r--r-- | src/gui/kernel/qwindow.cpp | 3 |
9 files changed, 75 insertions, 34 deletions
diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index a19eebfb7c..bdedc9d75f 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1609,14 +1609,17 @@ void QGuiApplicationPrivate::processWindowSystemEvent(QWindowSystemInterfacePriv void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::MouseEvent *e) { QEvent::Type type; - // move first Qt::MouseButtons stateChange = e->buttons ^ buttons; - const bool frameStrut = e->type == QWindowSystemInterfacePrivate::FrameStrutMouse; if (e->globalPos != QGuiApplicationPrivate::lastCursorPosition && (stateChange != Qt::NoButton)) { - QWindowSystemInterfacePrivate::MouseEvent * newMouseEvent = - new QWindowSystemInterfacePrivate::MouseEvent(e->window.data(), e->timestamp, e->type, e->localPos, e->globalPos, e->buttons, e->modifiers); - QWindowSystemInterfacePrivate::windowSystemEventQueue.prepend(newMouseEvent); // just in case the move triggers a new event loop - stateChange = Qt::NoButton; + // A mouse event should not change both position and buttons at the same time. Instead we + // should first send a move event followed by a button changed event. Since this is not the case + // with the current event, we fake a move-only event that we recurse and process first. This + // will update the global mouse position and cause the second event to be a button only event. + QWindowSystemInterfacePrivate::MouseEvent moveEvent(e->window.data(), + e->timestamp, e->type, e->localPos, e->globalPos, buttons, e->modifiers); + processMouseEvent(&moveEvent); + Q_ASSERT(e->globalPos == QGuiApplicationPrivate::lastCursorPosition); + // continue with processing mouse button change event } QWindow *window = e->window.data(); @@ -1635,6 +1638,7 @@ void QGuiApplicationPrivate::processMouseEvent(QWindowSystemInterfacePrivate::Mo Qt::MouseButton button = Qt::NoButton; bool doubleClick = false; + const bool frameStrut = e->type == QWindowSystemInterfacePrivate::FrameStrutMouse; if (QGuiApplicationPrivate::lastCursorPosition != globalPoint) { type = frameStrut ? QEvent::NonClientAreaMouseMove : QEvent::MouseMove; @@ -3002,6 +3006,7 @@ void QGuiApplication::sync() && QGuiApplicationPrivate::platform_integration->hasCapability(QPlatformIntegration::SyncState)) { QGuiApplicationPrivate::platform_integration->sync(); QCoreApplication::processEvents(); + QWindowSystemInterface::flushWindowSystemEvents(); } } diff --git a/src/gui/kernel/qkeysequence.cpp b/src/gui/kernel/qkeysequence.cpp index 4569457a20..59cdabbc0f 100644 --- a/src/gui/kernel/qkeysequence.cpp +++ b/src/gui/kernel/qkeysequence.cpp @@ -238,9 +238,9 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni \row \li SaveAs \li \li Ctrl+Shift+S \li \li Ctrl+Shift+S \row \li New \li Ctrl+N \li Ctrl+N \li Ctrl+N \li Ctrl+N \row \li Delete \li Del \li Del, Meta+D \li Del, Ctrl+D \li Del, Ctrl+D - \row \li Cut \li Ctrl+X, Shift+Del \li Ctrl+X \li Ctrl+X, F20, Shift+Del \li Ctrl+X, F20, Shift+Del + \row \li Cut \li Ctrl+X, Shift+Del \li Ctrl+X, Meta+K \li Ctrl+X, F20, Shift+Del \li Ctrl+X, F20, Shift+Del \row \li Copy \li Ctrl+C, Ctrl+Ins \li Ctrl+C \li Ctrl+C, F16, Ctrl+Ins \li Ctrl+C, F16, Ctrl+Ins - \row \li Paste \li Ctrl+V, Shift+Ins \li Ctrl+V \li Ctrl+V, F18, Shift+Ins \li Ctrl+V, F18, Shift+Ins + \row \li Paste \li Ctrl+V, Shift+Ins \li Ctrl+V, Meta+Y \li Ctrl+V, F18, Shift+Ins \li Ctrl+V, F18, Shift+Ins \row \li Preferences \li \li Ctrl+, \li \li \row \li Undo \li Ctrl+Z, Alt+Backspace \li Ctrl+Z \li Ctrl+Z, F14 \li Ctrl+Z, F14 \row \li Redo \li Ctrl+Y, Shift+Ctrl+Z, Alt+Shift+Backspace \li Ctrl+Shift+Z \li Ctrl+Shift+Z \li Ctrl+Shift+Z @@ -263,13 +263,13 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni \row \li Bold \li Ctrl+B \li Ctrl+B \li Ctrl+B \li Ctrl+B \row \li Italic \li Ctrl+I \li Ctrl+I \li Ctrl+I \li Ctrl+I \row \li Underline \li Ctrl+U \li Ctrl+U \li Ctrl+U \li Ctrl+U - \row \li MoveToNextChar \li Right \li Right \li Right \li Right - \row \li MoveToPreviousChar \li Left \li Left \li Left \li Left + \row \li MoveToNextChar \li Right \li Right, Meta+F \li Right \li Right + \row \li MoveToPreviousChar \li Left \li Left, Meta+B \li Left \li Left \row \li MoveToNextWord \li Ctrl+Right \li Alt+Right \li Ctrl+Right \li Ctrl+Right \row \li MoveToPreviousWord \li Ctrl+Left \li Alt+Left \li Ctrl+Left \li Ctrl+Left - \row \li MoveToNextLine \li Down \li Down \li Down \li Down - \row \li MoveToPreviousLine \li Up \li Up \li Up \li Up - \row \li MoveToNextPage \li PgDown \li PgDown, Alt+PgDown, Meta+Down, Meta+PgDown\li PgDown \li PgDown + \row \li MoveToNextLine \li Down \li Down, Meta+N \li Down \li Down + \row \li MoveToPreviousLine \li Up \li Up, Meta+P \li Up \li Up + \row \li MoveToNextPage \li PgDown \li PgDown, Alt+PgDown, Meta+Down, Meta+PgDown, Meta+V \li PgDown \li PgDown \row \li MoveToPreviousPage \li PgUp \li PgUp, Alt+PgUp, Meta+Up, Meta+PgUp \li PgUp \li PgUp \row \li MoveToStartOfLine \li Home \li Ctrl+Left, Meta+Left \li Home \li Home \row \li MoveToEndOfLine \li End \li Ctrl+Right, Meta+Right \li End, Ctrl+E \li End, Ctrl+E @@ -296,7 +296,7 @@ void Q_GUI_EXPORT qt_set_sequence_auto_mnemonic(bool b) { qt_sequence_no_mnemoni \row \li DeleteEndOfLine \li (none) \li (none) \li Ctrl+K \li Ctrl+K \row \li DeleteCompleteLine \li (none) \li (none) \li Ctrl+U \li Ctrl+U \row \li InsertParagraphSeparator \li Enter \li Enter \li Enter \li Enter - \row \li InsertLineSeparator \li Shift+Enter \li Meta+Enter \li Shift+Enter \li Shift+Enter + \row \li InsertLineSeparator \li Shift+Enter \li Meta+Enter, Meta+O \li Shift+Enter \li Shift+Enter \endtable Note that, since the key sequences used for the standard shortcuts differ diff --git a/src/gui/kernel/qopenglcontext.cpp b/src/gui/kernel/qopenglcontext.cpp index e258218e85..7382d63a06 100644 --- a/src/gui/kernel/qopenglcontext.cpp +++ b/src/gui/kernel/qopenglcontext.cpp @@ -230,6 +230,7 @@ public: }; static QThreadStorage<QGuiGLThreadContext *> qwindow_context_storage; +static QOpenGLContext *global_share_context = 0; #ifndef QT_NO_DEBUG QHash<QOpenGLContext *, bool> QOpenGLContextPrivate::makeCurrentTracker; @@ -330,6 +331,25 @@ QOpenGLContext *QOpenGLContextPrivate::setCurrentContext(QOpenGLContext *context return previous; } +/*! + \internal + + This function is used by the Qt WebEngine to set up context sharing + across multiple windows. Do not use it for any other purpose. +*/ +void QOpenGLContextPrivate::setGlobalShareContext(QOpenGLContext *context) +{ + global_share_context = context; +} + +/*! + \internal +*/ +QOpenGLContext *QOpenGLContextPrivate::globalShareContext() +{ + return global_share_context; +} + int QOpenGLContextPrivate::maxTextureSize() { if (max_texture_size != -1) @@ -597,7 +617,8 @@ QOpenGLFunctions *QOpenGLContext::functions() const Returns a pointer to an object that provides access to all functions for the version and profile of this context. Before using any of the functions - they must be initialized by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions(). + they must be initialized by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions() + with this context being the current context. Usually one would use the template version of this function to automatically have the result cast to the correct type. @@ -609,7 +630,7 @@ QOpenGLFunctions *QOpenGLContext::functions() const qWarning() << "Could not obtain required OpenGL context version"; exit(1); } - funcs->initializeOpenGLFunctions(context); + funcs->initializeOpenGLFunctions(); \endcode It is possible to request a functions object for a different version and profile @@ -639,8 +660,9 @@ QOpenGLFunctions *QOpenGLContext::functions() const /*! Returns a pointer to an object that provides access to all functions for the - \a versionProfile of the current context. Before using any of the functions they must - be initialized by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions(). + \a versionProfile of this context. Before using any of the functions they must + be initialized by calling QAbstractOpenGLFunctions::initializeOpenGLFunctions() + with this context being the current context. Usually one would use the template version of this function to automatically have the result cast to the correct type. @@ -1010,7 +1032,6 @@ void *QOpenGLContext::openGLModuleHandle() \value DesktopGL Desktop OpenGL \value GLES2 OpenGL ES 2.0 or higher - \value GLES1 OpenGL ES 1.x \since 5.3 */ @@ -1038,8 +1059,6 @@ QOpenGLContext::OpenGLModuleType QOpenGLContext::openGLModuleType() return QGuiApplicationPrivate::instance()->platformIntegration()->openGLModuleType(); #elif defined(QT_OPENGL_ES_2) return GLES2; -#elif defined(QT_OPENGL_ES) - return GLES1; #else return DesktopGL; #endif diff --git a/src/gui/kernel/qopenglcontext.h b/src/gui/kernel/qopenglcontext.h index 06a7b723b4..fce983f975 100644 --- a/src/gui/kernel/qopenglcontext.h +++ b/src/gui/kernel/qopenglcontext.h @@ -196,8 +196,7 @@ public: enum OpenGLModuleType { DesktopGL, - GLES2, - GLES1 + GLES2 }; static OpenGLModuleType openGLModuleType(); diff --git a/src/gui/kernel/qopenglcontext_p.h b/src/gui/kernel/qopenglcontext_p.h index 23c13b2e24..b21ff67068 100644 --- a/src/gui/kernel/qopenglcontext_p.h +++ b/src/gui/kernel/qopenglcontext_p.h @@ -244,6 +244,9 @@ public: static QOpenGLContext *setCurrentContext(QOpenGLContext *context); + static void setGlobalShareContext(QOpenGLContext *context); + static QOpenGLContext *globalShareContext(); + int maxTextureSize(); static QOpenGLContextPrivate *get(QOpenGLContext *context) diff --git a/src/gui/kernel/qplatformmenu.h b/src/gui/kernel/qplatformmenu.h index 9326a2b3a1..19e2d9bccf 100644 --- a/src/gui/kernel/qplatformmenu.h +++ b/src/gui/kernel/qplatformmenu.h @@ -66,7 +66,11 @@ Q_OBJECT public: // copied from, and must stay in sync with, QAction menu roles. enum MenuRole { NoRole = 0, TextHeuristicRole, ApplicationSpecificRole, AboutQtRole, - AboutRole, PreferencesRole, QuitRole }; + AboutRole, PreferencesRole, QuitRole, + // However these roles are private, perhaps temporarily. + // They could be added as public QAction roles if necessary. + CutRole, CopyRole, PasteRole, SelectAllRole, + RoleCount }; virtual void setTag(quintptr tag) = 0; virtual quintptr tag()const = 0; diff --git a/src/gui/kernel/qplatformtheme.cpp b/src/gui/kernel/qplatformtheme.cpp index 05ab2f15ba..d3d3d3c222 100644 --- a/src/gui/kernel/qplatformtheme.cpp +++ b/src/gui/kernel/qplatformtheme.cpp @@ -178,12 +178,13 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = { {QKeySequence::Close, 0, Qt::CTRL | Qt::Key_W, KB_Win | KB_X11}, {QKeySequence::Save, 1, Qt::CTRL | Qt::Key_S, KB_All}, {QKeySequence::New, 1, Qt::CTRL | Qt::Key_N, KB_All}, - {QKeySequence::Delete, 0, Qt::META | Qt::Key_D, KB_Mac}, {QKeySequence::Delete, 0, Qt::CTRL | Qt::Key_D, KB_X11}, //emacs (line edit only) {QKeySequence::Delete, 1, Qt::Key_Delete, KB_All}, + {QKeySequence::Delete, 0, Qt::META | Qt::Key_D, KB_Mac}, {QKeySequence::Cut, 1, Qt::CTRL | Qt::Key_X, KB_All}, {QKeySequence::Cut, 0, Qt::SHIFT | Qt::Key_Delete, KB_Win | KB_X11}, //## Check if this should work on mac {QKeySequence::Cut, 0, Qt::Key_F20, KB_X11}, //Cut on sun keyboards + {QKeySequence::Cut, 0, Qt::META | Qt::Key_K, KB_Mac}, {QKeySequence::Copy, 0, Qt::CTRL | Qt::Key_Insert, KB_X11 | KB_Win}, {QKeySequence::Copy, 1, Qt::CTRL | Qt::Key_C, KB_All}, {QKeySequence::Copy, 0, Qt::Key_F16, KB_X11}, //Copy on sun keyboards @@ -191,6 +192,7 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = { {QKeySequence::Paste, 1, Qt::CTRL | Qt::Key_V, KB_All}, {QKeySequence::Paste, 0, Qt::SHIFT | Qt::Key_Insert, KB_Win | KB_X11}, {QKeySequence::Paste, 0, Qt::Key_F18, KB_X11}, //Paste on sun keyboards + {QKeySequence::Paste, 0, Qt::META | Qt::Key_Y, KB_Mac}, {QKeySequence::Undo, 0, Qt::ALT | Qt::Key_Backspace, KB_Win}, {QKeySequence::Undo, 1, Qt::CTRL | Qt::Key_Z, KB_All}, {QKeySequence::Undo, 0, Qt::Key_F14, KB_X11}, //Undo on sun keyboards @@ -241,16 +243,21 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = { {QKeySequence::Bold, 1, Qt::CTRL | Qt::Key_B, KB_All}, {QKeySequence::Italic, 0, Qt::CTRL | Qt::Key_I, KB_All}, {QKeySequence::Underline, 1, Qt::CTRL | Qt::Key_U, KB_All}, - {QKeySequence::MoveToNextChar, 0, Qt::Key_Right, KB_All}, - {QKeySequence::MoveToPreviousChar, 0, Qt::Key_Left, KB_All}, + {QKeySequence::MoveToNextChar, 1, Qt::Key_Right, KB_All}, + {QKeySequence::MoveToNextChar, 0, Qt::META | Qt::Key_F, KB_Mac}, + {QKeySequence::MoveToPreviousChar, 1, Qt::Key_Left, KB_All}, + {QKeySequence::MoveToPreviousChar, 0, Qt::META | Qt::Key_B, KB_Mac}, {QKeySequence::MoveToNextWord, 0, Qt::ALT | Qt::Key_Right, KB_Mac}, {QKeySequence::MoveToNextWord, 0, Qt::CTRL | Qt::Key_Right, KB_Win | KB_X11}, {QKeySequence::MoveToPreviousWord, 0, Qt::ALT | Qt::Key_Left, KB_Mac}, {QKeySequence::MoveToPreviousWord, 0, Qt::CTRL | Qt::Key_Left, KB_Win | KB_X11}, - {QKeySequence::MoveToNextLine, 0, Qt::Key_Down, KB_All}, - {QKeySequence::MoveToPreviousLine, 0, Qt::Key_Up, KB_All}, + {QKeySequence::MoveToNextLine, 1, Qt::Key_Down, KB_All}, + {QKeySequence::MoveToNextLine, 0, Qt::META | Qt::Key_N, KB_Mac}, + {QKeySequence::MoveToPreviousLine, 1, Qt::Key_Up, KB_All}, + {QKeySequence::MoveToPreviousLine, 0, Qt::META | Qt::Key_P, KB_Mac}, {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_PageDown, KB_Mac}, {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_Down, KB_Mac}, + {QKeySequence::MoveToNextPage, 0, Qt::META | Qt::Key_V, KB_Mac}, {QKeySequence::MoveToNextPage, 0, Qt::ALT | Qt::Key_PageDown, KB_Mac }, {QKeySequence::MoveToNextPage, 1, Qt::Key_PageDown, KB_All}, {QKeySequence::MoveToPreviousPage, 0, Qt::META | Qt::Key_PageUp, KB_Mac}, @@ -265,9 +272,9 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = { {QKeySequence::MoveToEndOfLine, 0, Qt::Key_End, KB_Win | KB_X11}, {QKeySequence::MoveToEndOfLine, 0, Qt::CTRL + Qt::Key_E, KB_X11}, {QKeySequence::MoveToStartOfBlock, 0, Qt::META | Qt::Key_A, KB_Mac}, - {QKeySequence::MoveToStartOfBlock, 0, Qt::ALT | Qt::Key_Up, KB_Mac}, //mac only + {QKeySequence::MoveToStartOfBlock, 1, Qt::ALT | Qt::Key_Up, KB_Mac}, //mac only {QKeySequence::MoveToEndOfBlock, 0, Qt::META | Qt::Key_E, KB_Mac}, - {QKeySequence::MoveToEndOfBlock, 0, Qt::ALT | Qt::Key_Down, KB_Mac}, //mac only + {QKeySequence::MoveToEndOfBlock, 1, Qt::ALT | Qt::Key_Down, KB_Mac}, //mac only {QKeySequence::MoveToStartOfDocument, 1, Qt::CTRL | Qt::Key_Up, KB_Mac}, {QKeySequence::MoveToStartOfDocument, 0, Qt::CTRL | Qt::Key_Home, KB_Win | KB_X11}, {QKeySequence::MoveToStartOfDocument, 0, Qt::Key_Home, KB_Mac}, @@ -290,10 +297,10 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = { {QKeySequence::SelectEndOfLine, 0, Qt::META | Qt::SHIFT | Qt::Key_Right, KB_Mac}, {QKeySequence::SelectEndOfLine, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Right, KB_Mac }, {QKeySequence::SelectEndOfLine, 0, Qt::SHIFT | Qt::Key_End, KB_Win | KB_X11}, + {QKeySequence::SelectStartOfBlock, 1, Qt::ALT | Qt::SHIFT | Qt::Key_Up, KB_Mac}, //mac only {QKeySequence::SelectStartOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_A, KB_Mac}, - {QKeySequence::SelectStartOfBlock, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Up, KB_Mac}, //mac only + {QKeySequence::SelectEndOfBlock, 1, Qt::ALT | Qt::SHIFT | Qt::Key_Down, KB_Mac}, //mac only {QKeySequence::SelectEndOfBlock, 0, Qt::META | Qt::SHIFT | Qt::Key_E, KB_Mac}, - {QKeySequence::SelectEndOfBlock, 0, Qt::ALT | Qt::SHIFT | Qt::Key_Down, KB_Mac}, //mac only {QKeySequence::SelectStartOfDocument, 1, Qt::CTRL | Qt::SHIFT | Qt::Key_Up, KB_Mac}, {QKeySequence::SelectStartOfDocument, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_Home, KB_Win | KB_X11}, {QKeySequence::SelectStartOfDocument, 0, Qt::SHIFT | Qt::Key_Home, KB_Mac}, @@ -311,6 +318,7 @@ const QKeyBinding QPlatformThemePrivate::keyBindings[] = { {QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_Return, KB_Mac}, {QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Enter, KB_All}, {QKeySequence::InsertLineSeparator, 0, Qt::SHIFT | Qt::Key_Return, KB_All}, + {QKeySequence::InsertLineSeparator, 0, Qt::META | Qt::Key_O, KB_Mac}, {QKeySequence::SaveAs, 0, Qt::CTRL | Qt::SHIFT | Qt::Key_S, KB_Gnome | KB_Mac}, {QKeySequence::Preferences, 0, Qt::CTRL | Qt::Key_Comma, KB_Mac}, {QKeySequence::Quit, 0, Qt::CTRL | Qt::Key_Q, KB_Gnome | KB_KDE | KB_Mac}, diff --git a/src/gui/kernel/qstylehints.cpp b/src/gui/kernel/qstylehints.cpp index e1468942af..ac638f4905 100644 --- a/src/gui/kernel/qstylehints.cpp +++ b/src/gui/kernel/qstylehints.cpp @@ -163,7 +163,7 @@ void QStyleHints::setStartDragDistance(int startDragDistance) and the current position (e.g. in the mouse move event) is \c currentPos, you can find out if a drag should be started with code like this: - \snippet code/src_gui_kernel_qguiapplication.cpp 6 + \snippet code/src_gui_kernel_qapplication.cpp 6 \sa startDragTime(), QPoint::manhattanLength(), {Drag and Drop} */ diff --git a/src/gui/kernel/qwindow.cpp b/src/gui/kernel/qwindow.cpp index 13da58e391..6dcc3df166 100644 --- a/src/gui/kernel/qwindow.cpp +++ b/src/gui/kernel/qwindow.cpp @@ -1751,7 +1751,10 @@ void QWindow::showFullScreen() { setWindowState(Qt::WindowFullScreen); setVisible(true); +#if !defined Q_OS_QNX // On QNX this window will be activated anyway from libscreen + // activating it here before libscreen activates it causes problems requestActivate(); +#endif } /*! |