diff options
author | Liang Qi <liang.qi@qt.io> | 2016-09-22 07:28:34 +0200 |
---|---|---|
committer | Liang Qi <liang.qi@qt.io> | 2016-09-22 07:28:34 +0200 |
commit | 50908f023d83257dbc0b6d17bfe29e2f101615af (patch) | |
tree | de68e2d9587db1fb59d75505981b6ff033e12992 /src/plugins/platforms | |
parent | 7555a925816e3244073803f0adc4d44640f5ac1d (diff) | |
parent | d10e4c193b0152350e884adcc1060aabd1a974f7 (diff) |
Merge remote-tracking branch 'origin/5.7' into 5.8
Conflicts:
src/plugins/platforms/ios/qiosviewcontroller.mm
Change-Id: I2dda31867cbc79ea7fe965f52afb518aefa4ad20
Diffstat (limited to 'src/plugins/platforms')
-rw-r--r-- | src/plugins/platforms/cocoa/qcocoaglcontext.mm | 5 | ||||
-rw-r--r-- | src/plugins/platforms/ios/qiosmenu.mm | 7 | ||||
-rw-r--r-- | src/plugins/platforms/ios/qiosviewcontroller.mm | 4 | ||||
-rw-r--r-- | src/plugins/platforms/ios/qioswindow.mm | 2 | ||||
-rw-r--r-- | src/plugins/platforms/ios/quiview.mm | 3 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbkeyboard.cpp | 72 | ||||
-rw-r--r-- | src/plugins/platforms/xcb/qxcbkeyboard.h | 2 |
7 files changed, 63 insertions, 32 deletions
diff --git a/src/plugins/platforms/cocoa/qcocoaglcontext.mm b/src/plugins/platforms/cocoa/qcocoaglcontext.mm index 628357eb39..ccb11f80f1 100644 --- a/src/plugins/platforms/cocoa/qcocoaglcontext.mm +++ b/src/plugins/platforms/cocoa/qcocoaglcontext.mm @@ -330,6 +330,11 @@ void QCocoaGLContext::updateSurfaceFormat() [pixelFormat release]; + GLint swapInterval = -1; + [m_context getValues:&swapInterval forParameter:NSOpenGLCPSwapInterval]; + if (swapInterval >= 0) + m_format.setSwapInterval(swapInterval); + // Restore the original context CGLSetCurrentContext(oldContext); } diff --git a/src/plugins/platforms/ios/qiosmenu.mm b/src/plugins/platforms/ios/qiosmenu.mm index 6165e480dc..02deab59b5 100644 --- a/src/plugins/platforms/ios/qiosmenu.mm +++ b/src/plugins/platforms/ios/qiosmenu.mm @@ -321,7 +321,7 @@ QIOSMenu::QIOSMenu() : QPlatformMenu() , m_tag(0) , m_enabled(true) - , m_visible(true) + , m_visible(false) , m_text(QString()) , m_menuType(DefaultMenu) , m_effectiveMenuType(DefaultMenu) @@ -414,7 +414,7 @@ void QIOSMenu::handleItemSelected(QIOSMenuItem *menuItem) void QIOSMenu::showPopup(const QWindow *parentWindow, const QRect &targetRect, const QPlatformMenuItem *item) { - if (m_currentMenu == this || !m_visible || !m_enabled || !parentWindow) + if (m_currentMenu == this || !parentWindow) return; emit aboutToShow(); @@ -441,6 +441,8 @@ void QIOSMenu::showPopup(const QWindow *parentWindow, const QRect &targetRect, c toggleShowUsingUIPickerView(true); break; } + + m_visible = true; } void QIOSMenu::dismiss() @@ -462,6 +464,7 @@ void QIOSMenu::dismiss() } m_currentMenu = 0; + m_visible = false; } void QIOSMenu::toggleShowUsingUIMenuController(bool show) diff --git a/src/plugins/platforms/ios/qiosviewcontroller.mm b/src/plugins/platforms/ios/qiosviewcontroller.mm index 72eb5e27a0..0478c5b8c8 100644 --- a/src/plugins/platforms/ios/qiosviewcontroller.mm +++ b/src/plugins/platforms/ios/qiosviewcontroller.mm @@ -229,6 +229,10 @@ @implementation QIOSViewController +@synthesize prefersStatusBarHidden; +@synthesize preferredStatusBarUpdateAnimation; +@synthesize preferredStatusBarStyle; + - (id)initWithQIOSScreen:(QT_PREPEND_NAMESPACE(QIOSScreen) *)screen { if (self = [self init]) { diff --git a/src/plugins/platforms/ios/qioswindow.mm b/src/plugins/platforms/ios/qioswindow.mm index ae14d87a30..8ff0dfbd5f 100644 --- a/src/plugins/platforms/ios/qioswindow.mm +++ b/src/plugins/platforms/ios/qioswindow.mm @@ -93,7 +93,7 @@ QIOSWindow::~QIOSWindow() // practice this doesn't seem to happen when removing the view from its superview. To ensure that // Qt's internal state for touch and mouse handling is kept consistent, we therefor have to force // cancellation of all touch events. - [m_view touchesCancelled:0 withEvent:0]; + [m_view touchesCancelled:[NSSet set] withEvent:0]; clearAccessibleCache(); m_view->m_qioswindow = 0; diff --git a/src/plugins/platforms/ios/quiview.mm b/src/plugins/platforms/ios/quiview.mm index e039594406..5c493617b1 100644 --- a/src/plugins/platforms/ios/quiview.mm +++ b/src/plugins/platforms/ios/quiview.mm @@ -429,7 +429,8 @@ // We do this by assuming that there are no cases where a // sub-set of the active touch events are intentionally cancelled. - if (touches && (static_cast<NSInteger>([touches count]) != m_activeTouches.count())) + NSInteger count = static_cast<NSInteger>([touches count]); + if (count != 0 && count != m_activeTouches.count()) qWarning("Subset of active touches cancelled by UIKit"); m_activeTouches.clear(); diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 4c908359f3..a5aff7f11f 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -748,8 +748,7 @@ void QXcbKeyboard::updateKeymap() // update xkb state object xkb_state_unref(xkb_state); xkb_state = new_state; - if (!connection()->hasXKB()) - updateXKBMods(); + updateXKBMods(); checkForLatinLayout(); } @@ -774,32 +773,37 @@ void QXcbKeyboard::updateXKBState(xcb_xkb_state_notify_event_t *state) } #endif +void QXcbKeyboard::updateXKBStateFromState(struct xkb_state *kb_state, quint16 state) +{ + const quint32 modsDepressed = xkb_state_serialize_mods(kb_state, XKB_STATE_MODS_DEPRESSED); + const quint32 modsLatched = xkb_state_serialize_mods(kb_state, XKB_STATE_MODS_LATCHED); + const quint32 modsLocked = xkb_state_serialize_mods(kb_state, XKB_STATE_MODS_LOCKED); + const quint32 xkbMask = xkbModMask(state); + + const quint32 latched = modsLatched & xkbMask; + const quint32 locked = modsLocked & xkbMask; + quint32 depressed = modsDepressed & xkbMask; + // set modifiers in depressed if they don't appear in any of the final masks + depressed |= ~(depressed | latched | locked) & xkbMask; + + const xkb_state_component newState + = xkb_state_update_mask(kb_state, + depressed, + latched, + locked, + 0, + 0, + (state >> 13) & 3); // bits 13 and 14 report the state keyboard group + + if ((newState & XKB_STATE_LAYOUT_EFFECTIVE) == XKB_STATE_LAYOUT_EFFECTIVE) { + //qWarning("TODO: Support KeyboardLayoutChange on QPA (QTBUG-27681)"); + } +} + void QXcbKeyboard::updateXKBStateFromCore(quint16 state) { if (m_config && !connection()->hasXKB()) { - const quint32 modsDepressed = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_DEPRESSED); - const quint32 modsLatched = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LATCHED); - const quint32 modsLocked = xkb_state_serialize_mods(xkb_state, XKB_STATE_MODS_LOCKED); - const quint32 xkbMask = xkbModMask(state); - - const quint32 latched = modsLatched & xkbMask; - const quint32 locked = modsLocked & xkbMask; - quint32 depressed = modsDepressed & xkbMask; - // set modifiers in depressed if they don't appear in any of the final masks - depressed |= ~(depressed | latched | locked) & xkbMask; - - const xkb_state_component newState - = xkb_state_update_mask(xkb_state, - depressed, - latched, - locked, - 0, - 0, - (state >> 13) & 3); // bits 13 and 14 report the state keyboard group - - if ((newState & XKB_STATE_LAYOUT_EFFECTIVE) == XKB_STATE_LAYOUT_EFFECTIVE) { - //qWarning("TODO: Support KeyboardLayoutChange on QPA (QTBUG-27681)"); - } + updateXKBStateFromState(xkb_state, state); } } @@ -1463,7 +1467,16 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, if (type == QEvent::KeyPress) targetWindow->updateNetWmUserTime(time); - xcb_keysym_t sym = xkb_state_key_get_one_sym(xkb_state, code); + // Have a temporary keyboard state filled in from state + // this way we allow for synthetic events to have different state + // from the current state i.e. you can have Alt+Ctrl pressed + // and receive a synthetic key event that has neither Alt nor Ctrl pressed + struct xkb_state *kb_state = xkb_state_new(xkb_keymap); + if (!kb_state) + return; + updateXKBStateFromState(kb_state, state); + + xcb_keysym_t sym = xkb_state_key_get_one_sym(kb_state, code); QPlatformInputContext *inputContext = QGuiApplicationPrivate::platformIntegration()->inputContext(); QMetaMethod method; @@ -1482,11 +1495,13 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, Q_ARG(uint, code), Q_ARG(uint, state), Q_ARG(bool, type == QEvent::KeyPress)); - if (retval) + if (retval) { + xkb_state_unref(kb_state); return; + } } - QString string = lookupString(xkb_state, code); + QString string = lookupString(kb_state, code); // Ιf control modifier is set we should prefer latin character, this is // used for standard shortcuts in checks like "key == QKeySequence::Copy", @@ -1557,6 +1572,7 @@ void QXcbKeyboard::handleKeyEvent(xcb_window_t sourceWindow, QEvent::Type type, QWindowSystemInterface::handleExtendedKeyEvent(window, time, QEvent::KeyPress, qtcode, modifiers, code, sym, state, string, isAutoRepeat); } + xkb_state_unref(kb_state); } QString QXcbKeyboard::lookupString(struct xkb_state *state, xcb_keycode_t code) const diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h index 817b57ff5b..dfd2926435 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.h +++ b/src/plugins/platforms/xcb/qxcbkeyboard.h @@ -104,6 +104,8 @@ protected: void checkForLatinLayout(); private: + void updateXKBStateFromState(struct xkb_state *kb_state, quint16 state); + bool m_config; xcb_keycode_t m_autorepeat_code; |