From f48170b479df359f47af12b03a501d9d0c386e66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= Date: Mon, 2 Nov 2015 00:26:39 +0100 Subject: xcb: Add Xinerama support This patch makes possible to use Xinerama screens in XCB platform plugin. Task-number: QTBUG-48615 Change-Id: Ib4dbfcdfadc46d2875a2fc09e8b852181edfbed2 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/README | 6 ++-- src/plugins/platforms/xcb/qxcbconnection.cpp | 54 ++++++++++++++++++++++++---- src/plugins/platforms/xcb/qxcbconnection.h | 2 ++ src/plugins/platforms/xcb/qxcbscreen.cpp | 26 +++++++++----- src/plugins/platforms/xcb/qxcbscreen.h | 4 ++- src/plugins/platforms/xcb/xcb_qpa_lib.pro | 2 +- 6 files changed, 75 insertions(+), 19 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/README b/src/plugins/platforms/xcb/README index 2f666bebfd..15cf4cf241 100644 --- a/src/plugins/platforms/xcb/README +++ b/src/plugins/platforms/xcb/README @@ -3,14 +3,14 @@ Requires libxcb >= 1.5. PACKAGE DEPENDENCIES Required packages: -libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm1 libxcb-icccm1-dev libxcb-sync0 libxcb-sync0-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-glx0-dev +libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm1 libxcb-icccm1-dev libxcb-sync0 libxcb-sync0-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-glx0-dev libxcb-xinerama0-dev On Ubuntu 11.10 icccm1 is replaced by icccm4 and xcb-render-util is not available: -libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-sync0 libxcb-sync0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-glx0-dev +libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-sync0 libxcb-sync0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-glx0-dev libxcb-xinerama0-dev The packages for xcb-render-util can be installed manually from http://packages.ubuntu.com/natty/libxcb-render-util0 and http://packages.ubuntu.com/natty/libxcb-render-util0-dev On Ubuntu 12.04 icccm1 is replaced by icccm4 and xcb-render-util can be installed automatically: -libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-sync0 libxcb-sync0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-glx0-dev +libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm4 libxcb-icccm4-dev libxcb-sync0 libxcb-sync0-dev libxcb-xfixes0-dev libxrender-dev libxcb-shape0-dev libxcb-randr0-dev libxcb-render-util0 libxcb-render-util0-dev libxcb-glx0-dev libxcb-xinerama0-dev On Fedora, the following packages are required: diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 231fe9af3f..f93cfde4a5 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -60,6 +60,7 @@ #include #include #include +#include #ifdef XCB_USE_XLIB #include @@ -386,6 +387,7 @@ void QXcbConnection::initializeScreens() xcb_screen_t *xcbScreen = it.data; QXcbVirtualDesktop *virtualDesktop = new QXcbVirtualDesktop(this, xcbScreen, xcbScreenNumber); m_virtualDesktops.append(virtualDesktop); + QList siblings; if (has_randr_extension) { xcb_generic_error_t *error = NULL; // RRGetScreenResourcesCurrent is fast but it may return nothing if the @@ -429,7 +431,6 @@ void QXcbConnection::initializeScreens() qWarning("failed to get the primary output of the screen"); free(error); } else { - QList siblings; for (int i = 0; i < outputCount; i++) { QScopedPointer output( xcb_randr_get_output_info_reply(xcb_connection(), @@ -471,12 +472,30 @@ void QXcbConnection::initializeScreens() } } } - virtualDesktop->setScreens(siblings); } } } + } else if (has_xinerama_extension) { + // Xinerama is available + xcb_xinerama_query_screens_cookie_t cookie = xcb_xinerama_query_screens(m_connection); + xcb_xinerama_query_screens_reply_t *screens = xcb_xinerama_query_screens_reply(m_connection, + cookie, + Q_NULLPTR); + if (screens) { + xcb_xinerama_screen_info_iterator_t it = xcb_xinerama_query_screens_screen_info_iterator(screens); + while (it.rem) { + xcb_xinerama_screen_info_t *screen_info = it.data; + QXcbScreen *screen = new QXcbScreen(this, virtualDesktop, + XCB_NONE, Q_NULLPTR, + screen_info, it.index); + siblings << screen; + m_screens << screen; + xcb_xinerama_screen_info_next(&it); + } + free(screens); + } } - if (virtualDesktop->screens().isEmpty()) { + if (siblings.isEmpty()) { // If there are no XRandR outputs or XRandR extension is missing, // then create a fake/legacy screen. QXcbScreen *screen = new QXcbScreen(this, virtualDesktop, XCB_NONE, Q_NULLPTR); @@ -486,8 +505,9 @@ void QXcbConnection::initializeScreens() primaryScreen = screen; primaryScreen->setPrimary(true); } - virtualDesktop->addScreen(screen); + siblings << screen; } + virtualDesktop->setScreens(siblings); xcb_screen_next(&it); ++xcbScreenNumber; } // for each xcb screen @@ -529,6 +549,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra , xfixes_first_event(0) , xrandr_first_event(0) , xkb_first_event(0) + , has_xinerama_extension(false) , has_shape_extension(false) , has_randr_extension(false) , has_input_shape(false) @@ -583,7 +604,10 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra m_time = XCB_CURRENT_TIME; m_netWmUserTime = XCB_CURRENT_TIME; - initializeXRandr(); + if (!qEnvironmentVariableIsSet("QT_XCB_NO_XRANDR")) + initializeXRandr(); + if (!has_randr_extension) + initializeXinerama(); initializeXFixes(); initializeScreens(); @@ -2087,6 +2111,22 @@ void QXcbConnection::initializeXRandr() } } +void QXcbConnection::initializeXinerama() +{ + const xcb_query_extension_reply_t *reply = xcb_get_extension_data(m_connection, &xcb_xinerama_id); + if (!reply || !reply->present) + return; + + xcb_generic_error_t *error = Q_NULLPTR; + xcb_xinerama_is_active_cookie_t xinerama_query_cookie = xcb_xinerama_is_active(m_connection); + xcb_xinerama_is_active_reply_t *xinerama_is_active = xcb_xinerama_is_active_reply(m_connection, + xinerama_query_cookie, + &error); + has_xinerama_extension = xinerama_is_active && !error && xinerama_is_active->state; + free(error); + free(xinerama_is_active); +} + void QXcbConnection::initializeXShape() { const xcb_query_extension_reply_t *xshape_reply = xcb_get_extension_data(m_connection, &xcb_shape_id); @@ -2174,7 +2214,9 @@ void QXcbConnection::initializeXKB() bool QXcbConnection::xi2MouseEvents() const { static bool mouseViaXI2 = !qEnvironmentVariableIsSet("QT_XCB_NO_XI2_MOUSE"); - return mouseViaXI2; + // Don't use XInput2 when Xinerama extension is enabled, + // because it causes problems with multi-monitor setup. + return mouseViaXI2 && !has_xinerama_extension; } #if defined(XCB_USE_XINPUT2) diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index fb7cc137b9..6d26e88fa2 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -515,6 +515,7 @@ private: void initializeXFixes(); void initializeXRender(); void initializeXRandr(); + void initializeXinerama(); void initializeXShape(); void initializeXKB(); void handleClientMessageEvent(const xcb_client_message_event_t *event); @@ -639,6 +640,7 @@ private: uint32_t xrandr_first_event; uint32_t xkb_first_event; + bool has_xinerama_extension; bool has_shape_extension; bool has_randr_extension; bool has_input_shape; diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index f05432ef68..caddd2b2a5 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -155,8 +155,15 @@ void QXcbVirtualDesktop::updateWorkArea() } } +static inline QSizeF sizeInMillimeters(const QSize &size, const QDpi &dpi) +{ + return QSizeF(Q_MM_PER_INCH * size.width() / dpi.first, + Q_MM_PER_INCH * size.height() / dpi.second); +} + QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDesktop, - xcb_randr_output_t outputId, xcb_randr_get_output_info_reply_t *output) + xcb_randr_output_t outputId, xcb_randr_get_output_info_reply_t *output, + const xcb_xinerama_screen_info_t *xineramaScreenInfo, int xineramaScreenIdx) : QXcbObject(connection) , m_virtualDesktop(virtualDesktop) , m_output(outputId) @@ -188,8 +195,14 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDe updateRefreshRate(crtc->mode); free(crtc); } - } else { - updateGeometry(output ? output->timestamp : 0); + } else if (xineramaScreenInfo) { + m_geometry = QRect(xineramaScreenInfo->x_org, xineramaScreenInfo->y_org, + xineramaScreenInfo->width, xineramaScreenInfo->height); + m_nativeGeometry = m_geometry; + m_availableGeometry = m_geometry & m_virtualDesktop->workArea(); + m_sizeMillimeters = sizeInMillimeters(m_geometry.size(), virtualDpi()); + if (xineramaScreenIdx > -1) + m_outputName += QLatin1Char('-') + QString::number(xineramaScreenIdx); } if (m_geometry.isEmpty()) { @@ -538,11 +551,8 @@ void QXcbScreen::updateGeometry(const QRect &geom, uint8_t rotation) // It can be that physical size is unknown while virtual size // is known (probably back-calculated from DPI and resolution), // e.g. on VNC or with some hardware. - if (m_sizeMillimeters.isEmpty()) { - QDpi dpi = virtualDpi(); - m_sizeMillimeters = QSizeF(Q_MM_PER_INCH * xGeometry.width() / dpi.first, - Q_MM_PER_INCH * xGeometry.width() / dpi.second); - } + if (m_sizeMillimeters.isEmpty()) + m_sizeMillimeters = sizeInMillimeters(xGeometry.size(), virtualDpi()); qreal dpi = xGeometry.width() / physicalSize().width() * qreal(25.4); m_pixelDensity = qRound(dpi/96); diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index 79620f40ec..dd7396aca2 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -40,6 +40,7 @@ #include #include #include +#include #include "qxcbobject.h" #include "qxcbscreen.h" @@ -102,7 +103,8 @@ class Q_XCB_EXPORT QXcbScreen : public QXcbObject, public QPlatformScreen { public: QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDesktop, - xcb_randr_output_t outputId, xcb_randr_get_output_info_reply_t *outputInfo); + xcb_randr_output_t outputId, xcb_randr_get_output_info_reply_t *outputInfo, + const xcb_xinerama_screen_info_t *xineramaScreenInfo = Q_NULLPTR, int xineramaScreenIdx = -1); ~QXcbScreen(); QString getOutputName(xcb_randr_get_output_info_reply_t *outputInfo); diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index 60eb8a02e3..302d87e007 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -92,7 +92,7 @@ contains(QT_CONFIG, xcb-qt) { INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/sysinclude LIBS += -lxcb -L$$OUT_PWD/xcb-static -lxcb-static } else { - LIBS += -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr -lxcb-shape -lxcb-keysyms + LIBS += -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr -lxcb-shape -lxcb-keysyms -lxcb-xinerama !contains(DEFINES, QT_NO_XKB):LIBS += -lxcb-xkb } -- cgit v1.2.3 From ebe08096c94c6af43ee492c8939693a1bcbd893f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= Date: Mon, 16 Nov 2015 14:21:58 +0100 Subject: xcb: Add Xinerama 3rd party source code for static build Change-Id: I421d0bcf3fd6362ad6e95db5cfcdefd1a9ec096f Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/xcb-static/xcb-static.pro | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/xcb-static/xcb-static.pro b/src/plugins/platforms/xcb/xcb-static/xcb-static.pro index d0fe282b14..20481e4834 100644 --- a/src/plugins/platforms/xcb/xcb-static/xcb-static.pro +++ b/src/plugins/platforms/xcb/xcb-static/xcb-static.pro @@ -1,7 +1,8 @@ # # Statically compile in code for # libxcb-fixes, libxcb-randr, libxcb-shm, libxcb-sync, libxcb-image, -# libxcb-keysyms, libxcb-icccm, libxcb-renderutil, libxcb-xkb +# libxcb-keysyms, libxcb-icccm, libxcb-renderutil, libxcb-xkb, +# libxcb-xinerama # CONFIG += static load(qt_helper_lib) @@ -28,7 +29,8 @@ SOURCES += \ $$LIBXCB_DIR/sync.c \ $$LIBXCB_DIR/render.c \ $$LIBXCB_DIR/shape.c \ - $$LIBXCB_DIR/xkb.c + $$LIBXCB_DIR/xkb.c \ + $$LIBXCB_DIR/xinerama.c # # xcb-util -- cgit v1.2.3 From b1c156d692b21a04e31d5658ee6a73867e86e48f Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Sun, 20 Dec 2015 00:09:01 +0100 Subject: Default to OpenGLES when building with -opengl es2 Fixes the xcb_glx plugin to follow the -opengl configure option for default surface types. This makes it match closer to xcb_egl behavior and makes the default match QOpenGLContext::openGLModuleType. Change-Id: Iea3f8069fffefa46a32945eeeea1312566df129f Task-number: QTBUG-50015 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp index 37f01d4eed..4cb220a02f 100644 --- a/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/gl_integrations/xcb_glx/qglxintegration.cpp @@ -175,7 +175,11 @@ QGLXContext::QGLXContext(QXcbScreen *screen, const QSurfaceFormat &format, QPlat void QGLXContext::init(QXcbScreen *screen, QPlatformOpenGLContext *share) { if (m_format.renderableType() == QSurfaceFormat::DefaultRenderableType) +#if defined(QT_OPENGL_ES_2) + m_format.setRenderableType(QSurfaceFormat::OpenGLES); +#else m_format.setRenderableType(QSurfaceFormat::OpenGL); +#endif if (m_format.renderableType() != QSurfaceFormat::OpenGL && m_format.renderableType() != QSurfaceFormat::OpenGLES) return; -- cgit v1.2.3 From b12e876efce4309ed61c04b9232ee80ec64baddc Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Wed, 9 Dec 2015 13:18:17 +0100 Subject: tst_qwindow::isExposed - fix failing test on OS X MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: Ice25c8ffaaa4662b679ee829dc0a38834e3258b7 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qnsview.mm | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 3faa292ae0..0d80333e65 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -440,16 +440,17 @@ QT_WARNING_PUSH QT_WARNING_DISABLE_CLANG("-Wobjc-method-access") enum { NSWindowOcclusionStateVisible = 1UL << 1 }; #endif - if ((NSUInteger)[self.window occlusionState] & NSWindowOcclusionStateVisible) { - m_platformWindow->exposeWindow(); - } else { - // Send Obscure events on window occlusion to stop animations. Several - // unit tests expect paint and/or expose events for windows that are - // sometimes (unpredictably) occlouded: Don't send Obscure events when - // running under QTestLib. - static bool onTestLib = qt_mac_resolveOption(false, "QT_QTESTLIB_RUNNING"); - if (!onTestLib) + // Several unit tests expect paint and/or expose events for windows that are + // sometimes (unpredictably) occluded and some unit tests depend on QWindow::isExposed - + // don't send Expose/Obscure events when running under QTestLib. + static const bool onTestLib = qt_mac_resolveOption(false, "QT_QTESTLIB_RUNNING"); + if (!onTestLib) { + if ((NSUInteger)[self.window occlusionState] & NSWindowOcclusionStateVisible) { + m_platformWindow->exposeWindow(); + } else { + // Send Obscure events on window occlusion to stop animations. m_platformWindow->obscureWindow(); + } } #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_9 QT_WARNING_POP -- cgit v1.2.3 From 0c60dda8728af906acd0772615c517a51d3bec61 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 4 Jan 2016 12:45:46 +0100 Subject: QWindowsTheme: Fix return type of helper dWordSystemParametersInfo(). QApplication::wheelScrollLines() was always 1 due it being a bool. Task-number: QTBUG-49561 Change-Id: I83e97da3507c31dfd024db7bf543c4e6a3b4a98b Reviewed-by: Oliver Wolff --- src/plugins/platforms/windows/qwindowstheme.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index 877bdfec17..cc367ff801 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -131,7 +131,7 @@ static inline bool booleanSystemParametersInfo(UINT what, bool defaultValue) return defaultValue; } -static inline bool dWordSystemParametersInfo(UINT what, DWORD defaultValue) +static inline DWORD dWordSystemParametersInfo(UINT what, DWORD defaultValue) { DWORD result; if (SystemParametersInfo(what, 0, &result, 0)) @@ -394,7 +394,7 @@ QVariant QWindowsTheme::themeHint(ThemeHint hint) const case ContextMenuOnMouseRelease: return QVariant(true); case WheelScrollLines: - return dWordSystemParametersInfo(SPI_GETWHEELSCROLLLINES, 3); + return QVariant(int(dWordSystemParametersInfo(SPI_GETWHEELSCROLLLINES, 3))); default: break; } -- cgit v1.2.3 From 2ca20724dd17df96143be160505f982ab6cf4378 Mon Sep 17 00:00:00 2001 From: Samuel Nevala Date: Tue, 17 Nov 2015 07:52:28 +0200 Subject: WinRT: Add camera button events on Windows Phone MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Windows Phone 8.1 provides access to the camera button and press/release events get passed as Key_CameraFocus and Key_Camera. Unfortunately a release does not provide what has been pressed before, hence this information needs to be cached when the press happens. Done-with: Maurice Kalinowski Task-number: QTBUG-39115 Change-Id: I6ce58a1f07a6bf7183b8d99a26e5cd7b0d32d6db Reviewed-by: Topi Reiniö Reviewed-by: Samuel Nevala Reviewed-by: Oliver Wolff --- src/plugins/platforms/winrt/qwinrtintegration.cpp | 64 +++++++++++++++++++++++ src/plugins/platforms/winrt/qwinrtintegration.h | 4 ++ 2 files changed, 68 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/winrt/qwinrtintegration.cpp b/src/plugins/platforms/winrt/qwinrtintegration.cpp index 9db5df995a..e94a0aa846 100644 --- a/src/plugins/platforms/winrt/qwinrtintegration.cpp +++ b/src/plugins/platforms/winrt/qwinrtintegration.cpp @@ -79,6 +79,7 @@ typedef IEventHandler ResumeHandler; typedef IEventHandler SuspendHandler; #ifdef Q_OS_WINPHONE typedef IEventHandler BackPressedHandler; +typedef IEventHandler CameraButtonHandler; #endif QT_BEGIN_NAMESPACE @@ -88,6 +89,8 @@ uint qHash(CoreApplicationCallbackRemover key) { void *ptr = *(void **)(&key); r #ifdef Q_OS_WINPHONE typedef HRESULT (__stdcall IHardwareButtonsStatics::*HardwareButtonsCallbackRemover)(EventRegistrationToken); uint qHash(HardwareButtonsCallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); } +typedef HRESULT (__stdcall IHardwareButtonsStatics2::*HardwareButtons2CallbackRemover)(EventRegistrationToken); +uint qHash(HardwareButtons2CallbackRemover key) { void *ptr = *(void **)(&key); return qHash(ptr); } #endif class QWinRTIntegrationPrivate @@ -103,6 +106,10 @@ public: #ifdef Q_OS_WINPHONE ComPtr hardwareButtons; QHash buttonsTokens; + ComPtr cameraButtons; + QHash cameraTokens; + bool cameraHalfPressed : 1; + bool cameraPressed : 1; #endif }; @@ -130,6 +137,23 @@ QWinRTIntegration::QWinRTIntegration() : d_ptr(new QWinRTIntegrationPrivate) hr = d->hardwareButtons->add_BackPressed(Callback(this, &QWinRTIntegration::onBackButtonPressed).Get(), &d->buttonsTokens[&IHardwareButtonsStatics::remove_BackPressed]); Q_ASSERT_SUCCEEDED(hr); + + hr = RoGetActivationFactory(HString::MakeReference(RuntimeClass_Windows_Phone_UI_Input_HardwareButtons).Get(), + IID_PPV_ARGS(&d->cameraButtons)); + Q_ASSERT_SUCCEEDED(hr); + if (qEnvironmentVariableIntValue("QT_QPA_ENABLE_CAMERA_KEYS")) { + hr = d->cameraButtons->add_CameraPressed(Callback(this, &QWinRTIntegration::onCameraPressed).Get(), + &d->cameraTokens[&IHardwareButtonsStatics2::remove_CameraPressed]); + Q_ASSERT_SUCCEEDED(hr); + hr = d->cameraButtons->add_CameraHalfPressed(Callback(this, &QWinRTIntegration::onCameraHalfPressed).Get(), + &d->cameraTokens[&IHardwareButtonsStatics2::remove_CameraHalfPressed]); + Q_ASSERT_SUCCEEDED(hr); + hr = d->cameraButtons->add_CameraReleased(Callback(this, &QWinRTIntegration::onCameraReleased).Get(), + &d->cameraTokens[&IHardwareButtonsStatics2::remove_CameraReleased]); + Q_ASSERT_SUCCEEDED(hr); + } + d->cameraPressed = false; + d->cameraHalfPressed = false; #endif // Q_OS_WINPHONE QEventDispatcherWinRT::runOnXamlThread([d]() { @@ -151,6 +175,10 @@ QWinRTIntegration::~QWinRTIntegration() hr = (d->hardwareButtons.Get()->*i.key())(i.value()); Q_ASSERT_SUCCEEDED(hr); } + for (QHash::const_iterator i = d->cameraTokens.begin(); i != d->cameraTokens.end(); ++i) { + hr = (d->cameraButtons.Get()->*i.key())(i.value()); + Q_ASSERT_SUCCEEDED(hr); + } #endif for (QHash::const_iterator i = d->applicationTokens.begin(); i != d->applicationTokens.end(); ++i) { hr = (d->application.Get()->*i.key())(i.value()); @@ -268,6 +296,42 @@ HRESULT QWinRTIntegration::onBackButtonPressed(IInspectable *, IBackPressedEvent args->put_Handled(pressed || released); return S_OK; } + +HRESULT QWinRTIntegration::onCameraPressed(IInspectable *, ICameraEventArgs *) +{ + Q_D(QWinRTIntegration); + QWindow *window = d->mainScreen->topWindow(); + QWindowSystemInterface::handleExtendedKeyEvent(window, QEvent::KeyPress, Qt::Key_Camera, Qt::NoModifier, + 0, 0, 0, QString(), false, 1, false); + d->cameraPressed = true; + return S_OK; +} + +HRESULT QWinRTIntegration::onCameraHalfPressed(IInspectable *, ICameraEventArgs *) +{ + Q_D(QWinRTIntegration); + QWindow *window = d->mainScreen->topWindow(); + QWindowSystemInterface::handleExtendedKeyEvent(window, QEvent::KeyPress, Qt::Key_CameraFocus, Qt::NoModifier, + 0, 0, 0, QString(), false, 1, false); + d->cameraHalfPressed = true; + return S_OK; +} + +HRESULT QWinRTIntegration::onCameraReleased(IInspectable *, ICameraEventArgs *) +{ + Q_D(QWinRTIntegration); + QWindow *window = d->mainScreen->topWindow(); + if (d->cameraHalfPressed) + QWindowSystemInterface::handleExtendedKeyEvent(window, QEvent::KeyRelease, Qt::Key_CameraFocus, Qt::NoModifier, + 0, 0, 0, QString(), false, 1, false); + + if (d->cameraPressed) + QWindowSystemInterface::handleExtendedKeyEvent(window, QEvent::KeyRelease, Qt::Key_Camera, Qt::NoModifier, + 0, 0, 0, QString(), false, 1, false); + d->cameraHalfPressed = false; + d->cameraPressed = false; + return S_OK; +} #endif // Q_OS_WINPHONE HRESULT QWinRTIntegration::onSuspended(IInspectable *, ISuspendingEventArgs *) diff --git a/src/plugins/platforms/winrt/qwinrtintegration.h b/src/plugins/platforms/winrt/qwinrtintegration.h index 3a151e1ed8..5456f6922f 100644 --- a/src/plugins/platforms/winrt/qwinrtintegration.h +++ b/src/plugins/platforms/winrt/qwinrtintegration.h @@ -52,6 +52,7 @@ namespace ABI { namespace UI { namespace Input { struct IBackPressedEventArgs; + struct ICameraEventArgs; } } } @@ -100,6 +101,9 @@ public: private: #ifdef Q_OS_WINPHONE HRESULT onBackButtonPressed(IInspectable *, ABI::Windows::Phone::UI::Input::IBackPressedEventArgs *args); + HRESULT onCameraPressed(IInspectable *, ABI::Windows::Phone::UI::Input::ICameraEventArgs *); + HRESULT onCameraHalfPressed(IInspectable *, ABI::Windows::Phone::UI::Input::ICameraEventArgs *); + HRESULT onCameraReleased(IInspectable *, ABI::Windows::Phone::UI::Input::ICameraEventArgs *); #endif HRESULT onSuspended(IInspectable *, ABI::Windows::ApplicationModel::ISuspendingEventArgs *); HRESULT onResume(IInspectable *, IInspectable *); -- cgit v1.2.3 From 2d8b0d1cd566cc0c3ab600650b66cdc771d8314f Mon Sep 17 00:00:00 2001 From: Shawn Rutledge Date: Mon, 4 Jan 2016 15:09:10 +0100 Subject: xcb: don't select XInput events on the root window If we select XInput events, then when the mouse is clicked, there will not be a fallback to a core pointer event. But a typical Qt application doesn't own the root window. If the window manager (such as OpenBox, Awesome or fvwm) relies on receiving core pointer click events, e.g. to show a desktop menu, then each time a device is hotplugged while a Qt application is running, we would select XI2 events and thereby prevent the window manager from receiving them. QDesktopWidget's native window is added to m_mapper, even when it isn't mapped. Then after hotplugging there's a hierarchy event, and that calls xi2Select for every window in m_mapper. The assumption with this patch is that the root window does need to be in m_mapper in case the QDesktopWidget is shown (that was done already in Qt 5.1: fca94fa5ed8321e84e7b0ff515620fbb901db545), but xi2Select must avoid selecting XI2 events on it to fix this bug. Task-number: QTBUG-49952 Change-Id: I5c160e879d93fadfce14120ef2e89a4f71d4f599 Reviewed-by: Uli Schlachter Reviewed-by: Paul Olav Tvete --- src/plugins/platforms/xcb/qxcbconnection_xi2.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp index 1a123703a5..1b84de4834 100644 --- a/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection_xi2.cpp @@ -274,7 +274,7 @@ void QXcbConnection::finalizeXInput2() void QXcbConnection::xi2Select(xcb_window_t window) { - if (!m_xi2Enabled) + if (!m_xi2Enabled || window == rootWindow()) return; Display *xDisplay = static_cast(m_xlib_display); -- cgit v1.2.3 From 0b3da1907d46a03e8838c4086b23d48ba69c8776 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C5=82a=C5=BCej=20Szczygie=C5=82?= Date: Sun, 18 Oct 2015 00:16:15 +0200 Subject: xcb: fix drag and drop when window is hidden This patch fixes drag and drop operation on XCB platform when window will be hidden. The window can be hidden during dnd operation by switching virtual desktops or by minimizing all windows (show desktop) using key shortcut. The ShapedPixmapWindow must grab mouse before dnd operation if mouse is not grabbed by other window (like in Qt4). Task-number: QTBUG-46243 Change-Id: I807bc842719a2d0ea0f4dcb733c06c1fd08813e1 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbconnection.cpp | 5 +++++ src/plugins/platforms/xcb/qxcbconnection.h | 3 +++ src/plugins/platforms/xcb/qxcbdrag.cpp | 2 ++ src/plugins/platforms/xcb/qxcbwindow.cpp | 21 +++++++++++++++++++-- 4 files changed, 29 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index f93cfde4a5..abb48034cd 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -556,6 +556,7 @@ QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGra , has_xkb(false) , m_buttons(0) , m_focusWindow(0) + , m_mouseGrabber(0) , m_clientLeader(0) , m_systemTrayTracker(0) , m_glIntegration(Q_NULLPTR) @@ -1352,6 +1353,10 @@ void QXcbConnection::setFocusWindow(QXcbWindow *w) { m_focusWindow = w; } +void QXcbConnection::setMouseGrabber(QXcbWindow *w) +{ + m_mouseGrabber = w; +} void QXcbConnection::grabServer() { diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 6d26e88fa2..a6a7b9e7ca 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -469,6 +469,8 @@ public: QXcbWindow *focusWindow() const { return m_focusWindow; } void setFocusWindow(QXcbWindow *); + QXcbWindow *mouseGrabber() const { return m_mouseGrabber; } + void setMouseGrabber(QXcbWindow *); QByteArray startupId() const { return m_startupId; } void setStartupId(const QByteArray &nextId) { m_startupId = nextId; } @@ -649,6 +651,7 @@ private: Qt::MouseButtons m_buttons; QXcbWindow *m_focusWindow; + QXcbWindow *m_mouseGrabber; xcb_window_t m_clientLeader; QByteArray m_startupId; diff --git a/src/plugins/platforms/xcb/qxcbdrag.cpp b/src/plugins/platforms/xcb/qxcbdrag.cpp index d19ea241f1..9296a6d141 100644 --- a/src/plugins/platforms/xcb/qxcbdrag.cpp +++ b/src/plugins/platforms/xcb/qxcbdrag.cpp @@ -194,6 +194,8 @@ void QXcbDrag::startDrag() setUseCompositing(current_virtual_desktop->compositingActive()); QBasicDrag::startDrag(); + if (connection()->mouseGrabber() == Q_NULLPTR) + shapedPixmapWindow()->setMouseGrabEnabled(true); } void QXcbDrag::endDrag() diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index bec167fec2..4e4a0cdaef 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -594,12 +594,16 @@ QXcbWindow::~QXcbWindow() { if (window()->type() != Qt::ForeignWindow) destroy(); + else if (connection()->mouseGrabber() == this) + connection()->setMouseGrabber(Q_NULLPTR); } void QXcbWindow::destroy() { if (connection()->focusWindow() == this) doFocusOut(); + if (connection()->mouseGrabber() == this) + connection()->setMouseGrabber(Q_NULLPTR); if (m_syncCounter && m_usingSyncProtocol) Q_XCB_CALL(xcb_sync_destroy_counter(xcb_connection(), m_syncCounter)); @@ -847,6 +851,9 @@ void QXcbWindow::hide() xcb_flush(xcb_connection()); + if (connection()->mouseGrabber() == this) + connection()->setMouseGrabber(Q_NULLPTR); + m_mapped = false; } @@ -2357,6 +2364,8 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev QWindowSystemInterface::handleWindowStateChanged(window(), newState); m_lastWindowStateEvent = newState; m_windowState = newState; + if (m_windowState == Qt::WindowMinimized && connection()->mouseGrabber() == this) + connection()->setMouseGrabber(Q_NULLPTR); } return; } else if (event->atom == atom(QXcbAtom::_NET_FRAME_EXTENTS)) { @@ -2411,9 +2420,15 @@ bool QXcbWindow::setKeyboardGrabEnabled(bool grab) bool QXcbWindow::setMouseGrabEnabled(bool grab) { + if (!grab && connection()->mouseGrabber() == this) + connection()->setMouseGrabber(Q_NULLPTR); #ifdef XCB_USE_XINPUT22 - if (connection()->xi2MouseEvents()) - return connection()->xi2SetMouseGrabEnabled(m_window, grab); + if (connection()->xi2MouseEvents()) { + bool result = connection()->xi2SetMouseGrabEnabled(m_window, grab); + if (grab && result) + connection()->setMouseGrabber(this); + return result; + } #endif if (grab && !connection()->canGrab()) return false; @@ -2432,6 +2447,8 @@ bool QXcbWindow::setMouseGrabEnabled(bool grab) xcb_grab_pointer_reply_t *reply = xcb_grab_pointer_reply(xcb_connection(), cookie, NULL); bool result = !(!reply || reply->status != XCB_GRAB_STATUS_SUCCESS); free(reply); + if (result) + connection()->setMouseGrabber(this); return result; } -- cgit v1.2.3 From 83dedc5b74c4d66c378b1335b134cc558c8a4ea4 Mon Sep 17 00:00:00 2001 From: Takumi ASAKI Date: Tue, 5 Jan 2016 14:28:50 +0900 Subject: Fix potential crash in FreeType font database for WinCE Change-Id: Iea922c2561d59a67cc26c300325a3f198baaafa7 Reviewed-by: Andy Shaw --- src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp index 1b6ee0f383..684c44acf2 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp @@ -310,7 +310,7 @@ static QStringList fontNamesFromTTCFile(const QString &filename) if (ttcTableHeader.majorVersion < 1 || ttcTableHeader.majorVersion > 2) return retVal; QVarLengthArray offsetTable(ttcTableHeader.numFonts); - bytesToRead = sizeof(offsetTable) * ttcTableHeader.numFonts; + bytesToRead = sizeof(quint32) * ttcTableHeader.numFonts; bytesRead = f.read((char*)offsetTable.data(), bytesToRead); if (bytesToRead != bytesRead) return retVal; -- cgit v1.2.3 From e8747d9e9fdc039eadb5bd937f7832164ef6796a Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 4 Jan 2016 12:06:02 +0100 Subject: Windows/DirectWrite: Dynamically load GetUserDefaultLocaleName(). The function is not available on Windows XP. Task-number: QTBUG-50188 Change-Id: I4ded1a4eb37af84979c3ce1a9af0d95da60b56ac Reviewed-by: Kai Koehne --- .../platforms/windows/qwindowsfontenginedirectwrite.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp index 5e2e9f6454..a50ee60975 100644 --- a/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp +++ b/src/plugins/platforms/windows/qwindowsfontenginedirectwrite.cpp @@ -50,6 +50,7 @@ #include #include #include +#include #include #include @@ -645,6 +646,16 @@ QFontEngine *QWindowsFontEngineDirectWrite::cloneWithSize(qreal pixelSize) const return fontEngine; } +// Dynamically resolve GetUserDefaultLocaleName, which is available from Windows +// Vista onwards. ### fixme 5.7: Consider reverting to direct linking. +typedef int (WINAPI *GetUserDefaultLocaleNamePtr)(LPWSTR, int); + +static inline GetUserDefaultLocaleNamePtr resolveGetUserDefaultLocaleName() +{ + QSystemLibrary library(QStringLiteral("kernel32")); + return (GetUserDefaultLocaleNamePtr)library.resolve("GetUserDefaultLocaleName"); +} + void QWindowsFontEngineDirectWrite::initFontInfo(const QFontDef &request, int dpi, IDWriteFont *font) { @@ -663,7 +674,9 @@ void QWindowsFontEngineDirectWrite::initFontInfo(const QFontDef &request, BOOL exists = false; wchar_t localeName[LOCALE_NAME_MAX_LENGTH]; - int defaultLocaleSuccess = GetUserDefaultLocaleName(localeName, LOCALE_NAME_MAX_LENGTH); + static const GetUserDefaultLocaleNamePtr getUserDefaultLocaleName = resolveGetUserDefaultLocaleName(); + const int defaultLocaleSuccess = getUserDefaultLocaleName + ? getUserDefaultLocaleName(localeName, LOCALE_NAME_MAX_LENGTH) : 0; if (defaultLocaleSuccess) hr = familyNames->FindLocaleName(localeName, &index, &exists); -- cgit v1.2.3 From 81ee6e763efc4cb7cac12a9f91578776e9b05a3c Mon Sep 17 00:00:00 2001 From: Harald Meyer Date: Thu, 24 Dec 2015 12:23:14 +0100 Subject: Fixed crash on iOS devices due to unsupported selector. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added check for traiCollection selector. Task-number: QTBUG-50159 Change-Id: Ie3efafe9e22e59aef862a681ad733f2bb0a5ba49 Reviewed-by: Tor Arne Vestbø --- src/plugins/platforms/ios/qiosintegration.mm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/ios/qiosintegration.mm b/src/plugins/platforms/ios/qiosintegration.mm index 0e3da8dce8..3e6b5e51ea 100644 --- a/src/plugins/platforms/ios/qiosintegration.mm +++ b/src/plugins/platforms/ios/qiosintegration.mm @@ -105,8 +105,10 @@ QIOSIntegration::QIOSIntegration() m_touchDevice = new QTouchDevice; m_touchDevice->setType(QTouchDevice::TouchScreen); QTouchDevice::Capabilities touchCapabilities = QTouchDevice::Position | QTouchDevice::NormalizedPosition; - if (mainScreen.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable) - touchCapabilities |= QTouchDevice::Pressure; + if ([mainScreen respondsToSelector:@selector(traitCollection)]) { + if (mainScreen.traitCollection.forceTouchCapability == UIForceTouchCapabilityAvailable) + touchCapabilities |= QTouchDevice::Pressure; + } m_touchDevice->setCapabilities(touchCapabilities); QWindowSystemInterface::registerTouchDevice(m_touchDevice); QMacInternalPasteboardMime::initializeMimeTypes(); -- cgit v1.2.3 From e9eb32f332561847e11ada14fd04c919b91d3511 Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Wed, 6 Jan 2016 14:16:57 +0200 Subject: Android: Activate Qt::Popup windows On Android, back button will send a CloseEvent to the focused window. This change will activate (focus) the Popup windows when they'll become visible. Task-number: QTBUG-46419 Change-Id: I6787435b24502bbf9a78662a0c6fd159d4ee2e8d Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/plugins/platforms/android/qandroidplatformscreen.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/android/qandroidplatformscreen.cpp b/src/plugins/platforms/android/qandroidplatformscreen.cpp index 209ce2f7db..8152f1d53f 100644 --- a/src/plugins/platforms/android/qandroidplatformscreen.cpp +++ b/src/plugins/platforms/android/qandroidplatformscreen.cpp @@ -111,9 +111,13 @@ QAndroidPlatformScreen::~QAndroidPlatformScreen() QWindow *QAndroidPlatformScreen::topWindow() const { - foreach (QAndroidPlatformWindow *w, m_windowStack) - if (w->window()->type() == Qt::Window || w->window()->type() == Qt::Dialog) + foreach (QAndroidPlatformWindow *w, m_windowStack) { + if (w->window()->type() == Qt::Window || + w->window()->type() == Qt::Popup || + w->window()->type() == Qt::Dialog) { return w->window(); + } + } return 0; } -- cgit v1.2.3 From c09412fcea92864c4240bced258a72ab5f73870d Mon Sep 17 00:00:00 2001 From: YAMAMOTO Atsushi Date: Tue, 15 Dec 2015 01:07:40 +0900 Subject: Windows: Fix QWindowsInputContext for Japanese IME. Change the QWindowsInputContext::composition if it is called with lParam has flags GCS_RESULTSTR and GCS_DELTASTART, it doesn't call endContextComposition. Task-number: QTBUG-49955 Change-Id: I49de3f239bf8a77414e433b255db08f227141158 Reviewed-by: Tasuku Suzuki Reviewed-by: Takumi ASAKI Reviewed-by: Friedemann Kleint Reviewed-by: Andy Shaw Reviewed-by: Liang Qi (cherry picked from qtbase/786984e7e47a63094ad64ec86a4892cc5c0ad6d4) Reviewed-by: Oswald Buddenhagen --- src/plugins/platforms/windows/qwindowsinputcontext.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp index 7e1cc563cb..56b5561756 100644 --- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp @@ -484,7 +484,8 @@ bool QWindowsInputContext::composition(HWND hwnd, LPARAM lParamIn) if (lParam & GCS_RESULTSTR) { // A fixed result, return the converted string event->setCommitString(getCompositionString(himc, GCS_RESULTSTR)); - endContextComposition(); + if (!(lParam & GCS_DELTASTART)) + endContextComposition(); } const bool result = QCoreApplication::sendEvent(m_compositionContext.focusObject, event.data()); qCDebug(lcQpaInputMethods) << '<' << __FUNCTION__ << "sending markup=" -- cgit v1.2.3 From 5001f6ceba5a1006876e9daf90eaab03ef9fef0c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 7 Jan 2016 12:40:20 +0100 Subject: Fix mac build with -no-widgets Unused parameters are errors. Change-Id: I79782a8094491a953d6e838e6b8c5b9d6327f30a Reviewed-by: Simon Hausmann --- src/plugins/platforms/cocoa/qcocoahelpers.mm | 1 + src/plugins/platforms/cocoa/qcocoanativeinterface.mm | 1 + 2 files changed, 2 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index f51c21ee9b..7bc8d6585b 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -604,6 +604,7 @@ void qt_mac_cleanUpMacColorSpaces() CGColorSpaceRef qt_mac_colorSpaceForDeviceType(const QPaintDevice *paintDevice) { #ifdef QT_NO_WIDGETS + Q_UNUSED(paintDevice) return qt_mac_displayColorSpace(0); #else bool isWidget = (paintDevice->devType() == QInternal::Widget); diff --git a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm index 41ea1fa49c..baee451903 100644 --- a/src/plugins/platforms/cocoa/qcocoanativeinterface.mm +++ b/src/plugins/platforms/cocoa/qcocoanativeinterface.mm @@ -162,6 +162,7 @@ void *QCocoaNativeInterface::NSPrintInfoForPrintEngine(QPrintEngine *printEngine macPrintEnginePriv->initialize(); return macPrintEnginePriv->printInfo; #else + Q_UNUSED(printEngine); qFatal("Printing is not supported when Qt is configured with -no-widgets"); return 0; #endif -- cgit v1.2.3