From d64f776a9a41a8d1144397b7b62efbdee8d24857 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 31 Mar 2015 09:17:39 +0200 Subject: Windows: Fallback to 0 samples if ARB::choosePixelFormat() fails with 1 This solves a problem when using a Qt application over remote desktop as if it failed with even 1 sample then it would fallback to GDI which causes an error if the software OpenGL option is used. Change-Id: Ib311a7a657f92aab15277461bc8e040bebbe4753 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowsglcontext.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index 3348241d37..908bc65843 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -597,6 +597,14 @@ static int choosePixelFormat(HDC hdc, break; if (iAttributes[samplesValuePosition] > 1) { iAttributes[samplesValuePosition] /= 2; + } else if (iAttributes[samplesValuePosition] == 1) { + // Fallback in case it is unable to initialize with any + // samples to avoid falling back to the GDI path + // NB: The sample attributes needs to be at the end for this + // to work correctly + iAttributes[samplesValuePosition - 1] = FALSE; + iAttributes[samplesValuePosition] = 0; + iAttributes[samplesValuePosition + 1] = 0; } else { break; } -- cgit v1.2.3 From 20c651d8b8c18ed123b84162fe4531eb4f414509 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9rgio=20Martins?= Date: Sun, 29 Mar 2015 16:02:53 +0100 Subject: Fix QNX and Blackberry -qtnamespace build Task-number: QTBUG-43569 Change-Id: I81a560d1508de4d808a807f1febdc17619cf4dda Reviewed-by: Rafael Roquetto --- src/plugins/platforms/qnx/qqnxfilepicker.cpp | 4 ++++ src/plugins/platforms/qnx/qqnxfilepicker.h | 4 ++++ src/plugins/platforms/qnx/qqnxsystemsettings.h | 4 ++-- src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h | 2 ++ 4 files changed, 12 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/qnx/qqnxfilepicker.cpp b/src/plugins/platforms/qnx/qqnxfilepicker.cpp index 9362f9cd0b..4853dce9d9 100644 --- a/src/plugins/platforms/qnx/qqnxfilepicker.cpp +++ b/src/plugins/platforms/qnx/qqnxfilepicker.cpp @@ -55,6 +55,8 @@ #define qFilePickerDebug QT_NO_QDEBUG_MACRO #endif +QT_BEGIN_NAMESPACE + static const char s_filePickerTarget[] = "sys.filepicker.target"; QQnxFilePicker::QQnxFilePicker(QObject *parent) @@ -322,3 +324,5 @@ QString QQnxFilePicker::modeToString(QQnxFilePicker::Mode mode) const return QStringLiteral("Picker"); } + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxfilepicker.h b/src/plugins/platforms/qnx/qqnxfilepicker.h index 82df1ea32d..63832633d8 100644 --- a/src/plugins/platforms/qnx/qqnxfilepicker.h +++ b/src/plugins/platforms/qnx/qqnxfilepicker.h @@ -38,6 +38,8 @@ #include #include +QT_BEGIN_NAMESPACE + struct navigator_invoke_invocation_t; class QQnxFilePicker : public QObject, public QAbstractNativeEventFilter @@ -100,4 +102,6 @@ private: QString m_title; }; +QT_END_NAMESPACE + #endif // QQNXFILEPICKER_H diff --git a/src/plugins/platforms/qnx/qqnxsystemsettings.h b/src/plugins/platforms/qnx/qqnxsystemsettings.h index 3402243572..1f0e425f71 100644 --- a/src/plugins/platforms/qnx/qqnxsystemsettings.h +++ b/src/plugins/platforms/qnx/qqnxsystemsettings.h @@ -37,10 +37,10 @@ #include #include -class QPlatformFontDatabase; - QT_BEGIN_NAMESPACE +class QPlatformFontDatabase; + QHash qt_qnx_createRoleFonts(QPlatformFontDatabase *fontDatabase); QT_END_NAMESPACE diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h index faba3409d9..0ced2340b0 100644 --- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h +++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.h @@ -86,4 +86,6 @@ private: static const size_t ms_bufferSize; }; +QT_END_NAMESPACE + #endif // VIRTUALKEYBOARDPPS_H -- cgit v1.2.3 From e7e580412e7375aee6dad8d1b60ae8a40d6c7207 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 7 Apr 2015 13:13:14 +0200 Subject: Windows: Fix -no-widgets build Change-Id: I0a79a61ffe8b6c6f66895dbeb988e653e11c9661 Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/accessible/iaccessible2.cpp | 2 +- src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/accessible/iaccessible2.cpp b/src/plugins/platforms/windows/accessible/iaccessible2.cpp index 7f60be0d50..465770176d 100644 --- a/src/plugins/platforms/windows/accessible/iaccessible2.cpp +++ b/src/plugins/platforms/windows/accessible/iaccessible2.cpp @@ -38,7 +38,7 @@ #include #include #include -#include +#include #include QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp index a115d7c477..a11aa74e8a 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp +++ b/src/plugins/platforms/windows/accessible/qwindowsmsaaaccessible.cpp @@ -49,10 +49,6 @@ #include #include #include -#include -#include -#include -#include //#include #ifndef UiaRootObjectId -- cgit v1.2.3 From 65d2b6b4df8d339177e640e5166d2a88088b8453 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Tue, 31 Mar 2015 14:43:53 +0200 Subject: Add missing event types in printXcbEvent And replace Xlib define GenericEvent with XCB define XCB_GE_GENERIC. Change-Id: Ie82cb7f58b18fc0d253e4b7fd65495608df0a7d9 Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbconnection.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index f4c633e2d7..f0cd4c8484 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -83,6 +83,12 @@ Q_LOGGING_CATEGORY(lcQpaXInput, "qt.qpa.input") Q_LOGGING_CATEGORY(lcQpaXInputDevices, "qt.qpa.input.devices") Q_LOGGING_CATEGORY(lcQpaScreen, "qt.qpa.screen") +// this event type was added in libxcb 1.10, +// but we support also older version +#ifndef XCB_GE_GENERIC +#define XCB_GE_GENERIC 35 +#endif + #ifdef XCB_USE_XLIB static const char * const xcbConnectionErrors[] = { "No error", /* Error 0 */ @@ -666,6 +672,7 @@ void printXcbEvent(const char *message, xcb_generic_event_t *event) PRINT_XCB_EVENT(XCB_KEYMAP_NOTIFY); PRINT_XCB_EVENT(XCB_EXPOSE); PRINT_XCB_EVENT(XCB_GRAPHICS_EXPOSURE); + PRINT_XCB_EVENT(XCB_NO_EXPOSURE); PRINT_XCB_EVENT(XCB_VISIBILITY_NOTIFY); PRINT_XCB_EVENT(XCB_CREATE_NOTIFY); PRINT_XCB_EVENT(XCB_DESTROY_NOTIFY); @@ -685,6 +692,8 @@ void printXcbEvent(const char *message, xcb_generic_event_t *event) PRINT_XCB_EVENT(XCB_SELECTION_NOTIFY); PRINT_XCB_EVENT(XCB_COLORMAP_NOTIFY); PRINT_XCB_EVENT(XCB_CLIENT_MESSAGE); + PRINT_XCB_EVENT(XCB_MAPPING_NOTIFY); + PRINT_XCB_EVENT(XCB_GE_GENERIC); default: qDebug("QXcbConnection: %s: unknown event - response_type: %d - sequence: %d", message, int(event->response_type & ~0x80), int(event->sequence)); } @@ -1080,7 +1089,7 @@ void QXcbConnection::handleXcbEvent(xcb_generic_event_t *event) HANDLE_PLATFORM_WINDOW_EVENT(xcb_property_notify_event_t, window, handlePropertyNotifyEvent); break; #if defined(XCB_USE_XINPUT2) - case GenericEvent: + case XCB_GE_GENERIC: if (m_xi2Enabled) xi2HandleEvent(reinterpret_cast(event)); break; -- cgit v1.2.3 From 2314286883dd7d31db05115ced82d6916499d933 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Wed, 25 Mar 2015 11:36:29 +0100 Subject: evdevtouch: Add hotplug support Follow the exact same structure as evdevmouse and keyboard. We must do monitoring via device discovery just like we do for keyboards and mice. Otherwise the usage of touchscreens that connect via USB or can be turned on/off independently from the board becomes troublesome. Change-Id: I2de3b519e8d617b0612e5df486e481bbc09b9c8c Reviewed-by: Andy Nichols --- src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp index 2c61f68e83..ccf86dafb2 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp @@ -49,7 +49,7 @@ #if !defined(QT_NO_EVDEV) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_NO_SDK)) #include #include -#include +#include #endif #if !defined(QT_NO_TSLIB) && (!defined(Q_OS_ANDROID) || defined(Q_OS_ANDROID_NO_SDK)) @@ -139,7 +139,7 @@ void QLinuxFbIntegration::createInputHandlers() new QTsLibMouseHandler(QLatin1String("TsLib"), QString()); else #endif // QT_NO_TSLIB - new QEvdevTouchScreenHandlerThread(QString(), this); + new QEvdevTouchManager(QLatin1String("EvdevTouch"), QString() /* spec */, this); #endif } -- cgit v1.2.3 From f3e405cb3b40c585cb5a535aa0562bfca74d3474 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 18 Mar 2015 16:38:12 +0100 Subject: Fix logicalDotsPerInch when using devicePixelRatio Qt does not support having different fontMetrics for different screens Also add environment variable for overriding logicalDpi Change-Id: I0baf73026d97fec590597ee304ad9fa119d7a328 Reviewed-by: Friedemann Kleint Reviewed-by: Lars Knoll Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbscreen.cpp | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 383adf9734..6f1fc08167 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -310,19 +310,16 @@ QImage::Format QXcbScreen::format() const QDpi QXcbScreen::logicalDpi() const { - int dpr = int(devicePixelRatio()); - - if (m_forcedDpi > 0) - return QDpi(m_forcedDpi/dpr, m_forcedDpi/dpr); + static const int overrideDpi = qEnvironmentVariableIntValue("QT_FONT_DPI"); + if (overrideDpi) + return QDpi(overrideDpi, overrideDpi); - static const bool auto_dpr = qgetenv("QT_DEVICE_PIXEL_RATIO").toLower() == "auto"; - if (auto_dpr) { - return QDpi(Q_MM_PER_INCH * m_geometry.width() / m_sizeMillimeters.width(), - Q_MM_PER_INCH * m_geometry.height() / m_sizeMillimeters.height()); - } else { - return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width() / dpr, - Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height() / dpr); + if (m_forcedDpi > 0) { + int primaryDpr = int(connection()->screens().at(0)->devicePixelRatio()); + return QDpi(m_forcedDpi/primaryDpr, m_forcedDpi/primaryDpr); } + return QDpi(Q_MM_PER_INCH * m_virtualSize.width() / m_virtualSizeMillimeters.width(), + Q_MM_PER_INCH * m_virtualSize.height() / m_virtualSizeMillimeters.height()); } -- cgit v1.2.3 From f932a85bd91556f608d884a61600ea0cacedd33f Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 25 Feb 2015 09:52:15 +0100 Subject: Windows: Fix dialog close button showing despite ~Qt::WindowCloseButtonHint. Further restrict the condition under which the special window flags for QTBUG-2027 apply. Change-Id: I458c7c6bfb06820992b5a21820c0439fd2ce7d9d Task-number: QTBUG-2027 Reviewed-by: Joerg Bornemann --- src/plugins/platforms/windows/qwindowswindow.cpp | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index 6afa4e6591..b19510073a 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -540,13 +540,9 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag } if (flags & Qt::WindowSystemMenuHint) style |= WS_SYSMENU; - else if (dialog) { - // QTBUG-2027, dialogs without system menu. - style |= WS_SYSMENU; - if (!(flags & Qt::FramelessWindowHint)) { - style |= WS_BORDER; - exStyle |= WS_EX_DLGMODALFRAME; - } + else if (dialog && (flags & Qt::WindowCloseButtonHint) && !(flags & Qt::FramelessWindowHint)) { + style |= WS_SYSMENU | WS_BORDER; // QTBUG-2027, dialogs without system menu. + exStyle |= WS_EX_DLGMODALFRAME; } if (flags & Qt::WindowMinimizeButtonHint) style |= WS_MINIMIZEBOX; -- cgit v1.2.3 From 2af77ab826083d8a2a311bc7af2bc0f744beec25 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Wed, 8 Apr 2015 13:31:46 +0300 Subject: winrt: remove the dead WP8.0 code from input context Change-Id: I8db61b4db32052f64833767085f2ebc5f1cc5bcf Reviewed-by: Andrew Knight --- src/plugins/platforms/winrt/qwinrtinputcontext.cpp | 23 ---------------------- 1 file changed, 23 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/winrt/qwinrtinputcontext.cpp b/src/plugins/platforms/winrt/qwinrtinputcontext.cpp index 299a80b1d7..63d4c01697 100644 --- a/src/plugins/platforms/winrt/qwinrtinputcontext.cpp +++ b/src/plugins/platforms/winrt/qwinrtinputcontext.cpp @@ -44,11 +44,6 @@ using namespace ABI::Windows::Foundation; using namespace ABI::Windows::UI::ViewManagement; using namespace ABI::Windows::UI::Core; -#if defined(Q_OS_WINPHONE) && _MSC_VER==1700 -#include -using namespace ABI::Windows::Phone::UI::Core; -#endif - typedef ITypedEventHandler InputPaneVisibilityHandler; QT_BEGIN_NAMESPACE @@ -140,7 +135,6 @@ void QWinRTInputContext::setKeyboardRect(const QRectF rect) #ifdef Q_OS_WINPHONE -#if _MSC_VER>1700 // Windows Phone 8.1+ static HRESULT getInputPane(ComPtr *inputPane2) { ComPtr factory; @@ -165,17 +159,9 @@ static HRESULT getInputPane(ComPtr *inputPane2) } return hr; } -#endif // _MSC_VER>1700 void QWinRTInputContext::showInputPanel() { -#if _MSC_VER<=1700 // Windows Phone 8.0 - ICoreWindowKeyboardInput *input; - if (SUCCEEDED(m_window->QueryInterface(IID_PPV_ARGS(&input)))) { - input->put_IsKeyboardInputEnabled(true); - input->Release(); - } -#else // _MSC_VER<=1700 ComPtr inputPane; HRESULT hr = getInputPane(&inputPane); if (FAILED(hr)) @@ -185,18 +171,10 @@ void QWinRTInputContext::showInputPanel() hr = inputPane->TryShow(&success); if (FAILED(hr)) qErrnoWarning(hr, "Failed to show input panel."); -#endif // _MSC_VER>1700 } void QWinRTInputContext::hideInputPanel() { -#if _MSC_VER<=1700 // Windows Phone 8.0 - ICoreWindowKeyboardInput *input; - if (SUCCEEDED(m_window->QueryInterface(IID_PPV_ARGS(&input)))) { - input->put_IsKeyboardInputEnabled(false); - input->Release(); - } -#else // _MSC_VER<=1700 ComPtr inputPane; HRESULT hr = getInputPane(&inputPane); if (FAILED(hr)) @@ -206,7 +184,6 @@ void QWinRTInputContext::hideInputPanel() hr = inputPane->TryHide(&success); if (FAILED(hr)) qErrnoWarning(hr, "Failed to hide input panel."); -#endif // _MSC_VER>1700 } #else // Q_OS_WINPHONE -- cgit v1.2.3 From 331ddacfca90c91c5b44484bf3c78e2aa5b85947 Mon Sep 17 00:00:00 2001 From: Peng Wu Date: Wed, 8 Apr 2015 11:30:39 +0300 Subject: winrt: set correct virtual keyboard size This is done by multiplying by the DIP scale factor. Task-number: QTBUG-44152 Change-Id: I587a66f1a2f7fa3a713c279f5d877e6acb844620 Reviewed-by: Andrew Knight --- src/plugins/platforms/winrt/qwinrtinputcontext.cpp | 41 +++++++++------------- src/plugins/platforms/winrt/qwinrtinputcontext.h | 8 +++-- src/plugins/platforms/winrt/qwinrtscreen.cpp | 10 ++++-- src/plugins/platforms/winrt/qwinrtscreen.h | 1 + 4 files changed, 31 insertions(+), 29 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/winrt/qwinrtinputcontext.cpp b/src/plugins/platforms/winrt/qwinrtinputcontext.cpp index 63d4c01697..f0de578db6 100644 --- a/src/plugins/platforms/winrt/qwinrtinputcontext.cpp +++ b/src/plugins/platforms/winrt/qwinrtinputcontext.cpp @@ -32,6 +32,7 @@ ****************************************************************************/ #include "qwinrtinputcontext.h" +#include "qwinrtscreen.h" #include #include @@ -61,8 +62,8 @@ QT_BEGIN_NAMESPACE Windows Phone, however, supports direct hiding/showing of the keyboard. */ -QWinRTInputContext::QWinRTInputContext(ICoreWindow *window) - : m_window(window) +QWinRTInputContext::QWinRTInputContext(QWinRTScreen *screen) + : m_screen(screen) { IInputPaneStatics *statics; if (FAILED(GetActivationFactory(HString::MakeReference(RuntimeClass_Windows_UI_ViewManagement_InputPane).Get(), @@ -81,9 +82,7 @@ QWinRTInputContext::QWinRTInputContext(ICoreWindow *window) inputPane->add_Hiding(Callback( this, &QWinRTInputContext::onHiding).Get(), &hideToken); - Rect rect; - inputPane->get_OccludedRect(&rect); - m_keyboardRect = QRectF(rect.X, rect.Y, rect.Width, rect.Height); + handleVisibilityChange(inputPane); m_isInputPanelVisible = !m_keyboardRect.isEmpty(); } else { qWarning(Q_FUNC_INFO ": failed to retrieve InputPane."); @@ -104,35 +103,29 @@ HRESULT QWinRTInputContext::onShowing(IInputPane *pane, IInputPaneVisibilityEven { m_isInputPanelVisible = true; emitInputPanelVisibleChanged(); - - Rect rect; - pane->get_OccludedRect(&rect); - setKeyboardRect(QRectF(rect.X, rect.Y, rect.Width, rect.Height)); - - return S_OK; + return handleVisibilityChange(pane); } HRESULT QWinRTInputContext::onHiding(IInputPane *pane, IInputPaneVisibilityEventArgs *) { m_isInputPanelVisible = false; emitInputPanelVisibleChanged(); + return handleVisibilityChange(pane); +} +HRESULT QWinRTInputContext::handleVisibilityChange(IInputPane *pane) +{ Rect rect; pane->get_OccludedRect(&rect); - setKeyboardRect(QRectF(rect.X, rect.Y, rect.Width, rect.Height)); - + const QRectF keyboardRect = QRectF(qRound(rect.X * m_screen->scaleFactor()), qRound(rect.Y * m_screen->scaleFactor()), + qRound(rect.Width * m_screen->scaleFactor()), qRound(rect.Height * m_screen->scaleFactor())); + if (m_keyboardRect != keyboardRect) { + m_keyboardRect = keyboardRect; + emitKeyboardRectChanged(); + } return S_OK; } -void QWinRTInputContext::setKeyboardRect(const QRectF rect) -{ - if (m_keyboardRect == rect) - return; - - m_keyboardRect = rect; - emitKeyboardRectChanged(); -} - #ifdef Q_OS_WINPHONE static HRESULT getInputPane(ComPtr *inputPane2) @@ -234,7 +227,7 @@ HRESULT QWinRTInputContext::GetPropertyValue(PROPERTYID idProp, VARIANT *retVal) break; case 30020: //UIA_NativeWindowHandlePropertyId retVal->vt = VT_PTR; - retVal->punkVal = m_window; + retVal->punkVal = m_screen->coreWindow(); break; } return S_OK; @@ -244,7 +237,7 @@ HRESULT QWinRTInputContext::get_HostRawElementProvider(IRawElementProviderSimple { // Return the window's element provider IInspectable *hostProvider; - HRESULT hr = m_window->get_AutomationHostProvider(&hostProvider); + HRESULT hr = m_screen->coreWindow()->get_AutomationHostProvider(&hostProvider); if (SUCCEEDED(hr)) { hr = hostProvider->QueryInterface(IID_PPV_ARGS(retVal)); hostProvider->Release(); diff --git a/src/plugins/platforms/winrt/qwinrtinputcontext.h b/src/plugins/platforms/winrt/qwinrtinputcontext.h index 6b1b66c0a3..761908a9cb 100644 --- a/src/plugins/platforms/winrt/qwinrtinputcontext.h +++ b/src/plugins/platforms/winrt/qwinrtinputcontext.h @@ -58,6 +58,7 @@ namespace ABI { QT_BEGIN_NAMESPACE +class QWinRTScreen; class QWinRTInputContext : public QPlatformInputContext #ifndef Q_OS_WINPHONE , public Microsoft::WRL::RuntimeClass< @@ -66,7 +67,7 @@ class QWinRTInputContext : public QPlatformInputContext #endif // !Q_OS_WINPHONE { public: - explicit QWinRTInputContext(ABI::Windows::UI::Core::ICoreWindow *window); + explicit QWinRTInputContext(QWinRTScreen *); QRectF keyboardRect() const; @@ -101,9 +102,10 @@ private: ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *); HRESULT onHiding(ABI::Windows::UI::ViewManagement::IInputPane *, ABI::Windows::UI::ViewManagement::IInputPaneVisibilityEventArgs *); - void setKeyboardRect(const QRectF rect); - ABI::Windows::UI::Core::ICoreWindow *m_window; + HRESULT handleVisibilityChange(ABI::Windows::UI::ViewManagement::IInputPane *); + + QWinRTScreen *m_screen; QRectF m_keyboardRect; bool m_isInputPanelVisible; }; diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index d7888194c2..d53b4e6ab9 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -497,9 +497,9 @@ QWinRTScreen::QWinRTScreen() Q_ASSERT_SUCCEEDED(hr); #ifdef Q_OS_WINPHONE - d->inputContext.reset(new QWinRTInputContext(d->coreWindow.Get())); + d->inputContext.reset(new QWinRTInputContext(this)); #else - d->inputContext = Make(d->coreWindow.Get()); + d->inputContext = Make(this); #endif Rect rect; @@ -680,6 +680,12 @@ QDpi QWinRTScreen::logicalDpi() const return QDpi(d->logicalDpi, d->logicalDpi); } +qreal QWinRTScreen::scaleFactor() const +{ + Q_D(const QWinRTScreen); + return d->scaleFactor; +} + QWinRTInputContext *QWinRTScreen::inputContext() const { Q_D(const QWinRTScreen); diff --git a/src/plugins/platforms/winrt/qwinrtscreen.h b/src/plugins/platforms/winrt/qwinrtscreen.h index 404c8ca04e..cbef9543a9 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.h +++ b/src/plugins/platforms/winrt/qwinrtscreen.h @@ -93,6 +93,7 @@ public: QSurfaceFormat surfaceFormat() const; QSizeF physicalSize() const Q_DECL_OVERRIDE; QDpi logicalDpi() const Q_DECL_OVERRIDE; + qreal scaleFactor() const; QWinRTInputContext *inputContext() const; QPlatformCursor *cursor() const; Qt::KeyboardModifiers keyboardModifiers() const; -- cgit v1.2.3 From 310488a19636a0f33ad11f4100c6af16c2261c07 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Wed, 18 Mar 2015 18:40:20 +0200 Subject: windows: Fix platform plugin compilation with new angle The identifiers for configuring a software renderer changed. Change-Id: I739cedbb0a00bc6be94df716d66cd1520d4f7c9d Reviewed-by: Friedemann Kleint Reviewed-by: Maurice Kalinowski Reviewed-by: Kai Koehne --- src/plugins/platforms/windows/qwindowseglcontext.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp index 7db6abd8ef..0184877fdd 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp @@ -366,7 +366,8 @@ QWindowsEGLStaticContext *QWindowsEGLStaticContext::create(QWindowsOpenGLTester: const EGLint anglePlatformAttributes[][5] = { { EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, EGL_NONE }, { EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D9_ANGLE, EGL_NONE }, - { EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, EGL_PLATFORM_ANGLE_USE_WARP_ANGLE, EGL_TRUE, EGL_NONE } + { EGL_PLATFORM_ANGLE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_TYPE_D3D11_ANGLE, + EGL_PLATFORM_ANGLE_DEVICE_TYPE_ANGLE, EGL_PLATFORM_ANGLE_DEVICE_TYPE_WARP_ANGLE, EGL_NONE } }; const EGLint *attributes = 0; if (preferredType & QWindowsOpenGLTester::AngleRendererD3d11) -- cgit v1.2.3 From c32048c62f3c592ab6bca9345ba61031e5a23742 Mon Sep 17 00:00:00 2001 From: Andrew Knight Date: Wed, 25 Mar 2015 22:06:34 +0200 Subject: winrt: Fix platform plugin after ANGLE upgrade Remove manual EGL window resizing as this is now handled inside ANGLE. Change-Id: I0d4c4df71114c60f4ce75e9010f40a0fd58dee1a Reviewed-by: Maurice Kalinowski --- src/plugins/platforms/winrt/qwinrtscreen.cpp | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/winrt/qwinrtscreen.cpp b/src/plugins/platforms/winrt/qwinrtscreen.cpp index d53b4e6ab9..c4512b4d2d 100644 --- a/src/plugins/platforms/winrt/qwinrtscreen.cpp +++ b/src/plugins/platforms/winrt/qwinrtscreen.cpp @@ -580,7 +580,7 @@ QWinRTScreen::QWinRTScreen() d->orientation = d->nativeOrientation; onOrientationChanged(Q_NULLPTR, Q_NULLPTR); - d->eglDisplay = eglGetDisplay(d->displayInformation.Get()); + d->eglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); if (d->eglDisplay == EGL_NO_DISPLAY) qCritical("Failed to initialize EGL display: 0x%x", eglGetError()); @@ -616,14 +616,7 @@ QWinRTScreen::QWinRTScreen() d->eglConfig = q_configFromGLFormat(d->eglDisplay, d->surfaceFormat); d->surfaceFormat = q_glFormatFromConfig(d->eglDisplay, d->eglConfig, d->surfaceFormat); - const QRect bounds = geometry(); - EGLint windowAttributes[] = { - EGL_FIXED_SIZE_ANGLE, EGL_TRUE, - EGL_WIDTH, bounds.width(), - EGL_HEIGHT, bounds.height(), - EGL_NONE - }; - d->eglSurface = eglCreateWindowSurface(d->eglDisplay, d->eglConfig, d->coreWindow.Get(), windowAttributes); + d->eglSurface = eglCreateWindowSurface(d->eglDisplay, d->eglConfig, d->coreWindow.Get(), NULL); if (d->eglSurface == EGL_NO_SURFACE) qCritical("Failed to create EGL window surface: 0x%x", eglGetError()); } @@ -1087,14 +1080,6 @@ HRESULT QWinRTScreen::onSizeChanged(ICoreWindow *, IWindowSizeChangedEventArgs * d->logicalSize = logicalSize; if (d->eglDisplay) { const QRect newGeometry = geometry(); - int width = newGeometry.width(); - int height = newGeometry.height(); -#ifdef Q_OS_WINPHONE // Windows Phone can pass in a negative size to provide orientation information - width *= (d->orientation == Qt::InvertedPortraitOrientation || d->orientation == Qt::LandscapeOrientation) ? -1 : 1; - height *= (d->orientation == Qt::InvertedPortraitOrientation || d->orientation == Qt::InvertedLandscapeOrientation) ? -1 : 1; -#endif - eglSurfaceAttrib(d->eglDisplay, d->eglSurface, EGL_WIDTH, width); - eglSurfaceAttrib(d->eglDisplay, d->eglSurface, EGL_HEIGHT, height); QWindowSystemInterface::handleScreenGeometryChange(screen(), newGeometry, newGeometry); QPlatformScreen::resizeMaximizedWindows(); handleExpose(); -- cgit v1.2.3 From 34ec0713bb5a2bc12782ab17ceabfead37c4b584 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Wed, 8 Apr 2015 13:09:10 +0200 Subject: Add a means to set the application icon where supported On OS X the application icon can be changed at runtime, so this adds a way to set this via the QPlatformIntegration. [ChangeLog][OS X] QApplication::setWindowIcon now changes the icon for the application in the dock. Task-number: QTBUG-43999 Change-Id: Ice298c0bd52f10f4866f37c6d3f20cf5419b7a1b Reviewed-by: Gabriel de Dietrich Reviewed-by: Jake Petroules --- src/plugins/platforms/cocoa/qcocoaintegration.h | 2 ++ src/plugins/platforms/cocoa/qcocoaintegration.mm | 13 +++++++++++++ 2 files changed, 15 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h index dc9140d990..ee42a83446 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaintegration.h @@ -138,6 +138,8 @@ public: QCocoaWindow *popPopupWindow(); QCocoaWindow *activePopupWindow() const; QList *popupWindowStack(); + + void setApplicationIcon(const QIcon &icon) const; private: static QCocoaIntegration *mInstance; diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index aa33cfd8bc..c8f6dd05db 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -420,6 +420,7 @@ bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) cons case ForeignWindows: case RasterGLSurface: case ApplicationState: + case ApplicationIcon: return true; default: return QPlatformIntegration::hasCapability(cap); @@ -569,4 +570,16 @@ QList *QCocoaIntegration::popupWindowStack() return &m_popupWindowStack; } +void QCocoaIntegration::setApplicationIcon(const QIcon &icon) const +{ + NSImage *image = nil; + if (!icon.isNull()) { + NSSize size = [[[NSApplication sharedApplication] dockTile] size]; + QPixmap pixmap = icon.pixmap(size.width, size.height); + image = static_cast(qt_mac_create_nsimage(pixmap)); + } + [[NSApplication sharedApplication] setApplicationIconImage:image]; + [image release]; +} + QT_END_NAMESPACE -- cgit v1.2.3 From 4ecae86e4b44c564e0f9b0e869e85f1c9febbdb4 Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Fri, 3 Apr 2015 16:40:15 +0300 Subject: xcb: Handle XSettings for a virtual desktop rather than for an output MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The virtual desktop may be composed of several outputs which are represented by the QXcbScreen class. XSettings are related to the virtual desktop, so introduce a QXcbVirtualDesktop class and store QXcbXSettings in it. Change-Id: Ib2261675ef8e5136592d4b856bc84646db3a3af4 Reviewed-by: Uli Schlachter Reviewed-by: Jørgen Lind --- src/plugins/platforms/xcb/qxcbconnection.cpp | 44 ++++++++++++++-------------- src/plugins/platforms/xcb/qxcbconnection.h | 6 ++-- src/plugins/platforms/xcb/qxcbcursor.cpp | 2 +- src/plugins/platforms/xcb/qxcbcursor.h | 2 +- src/plugins/platforms/xcb/qxcbscreen.cpp | 44 +++++++++++++++++++--------- src/plugins/platforms/xcb/qxcbscreen.h | 36 +++++++++++++++++------ src/plugins/platforms/xcb/qxcbxsettings.cpp | 10 +++---- src/plugins/platforms/xcb/qxcbxsettings.h | 4 +-- 8 files changed, 92 insertions(+), 56 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index f0cd4c8484..3d65b789a4 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -143,7 +143,7 @@ QXcbScreen* QXcbConnection::findScreenForOutput(xcb_window_t rootWindow, xcb_ran return 0; } -QXcbScreen* QXcbConnection::createScreen(int screenNumber, xcb_screen_t* xcbScreen, +QXcbScreen* QXcbConnection::createScreen(QXcbVirtualDesktop* virtualDesktop, xcb_randr_output_t outputId, xcb_randr_get_output_info_reply_t *output) { @@ -156,10 +156,10 @@ QXcbScreen* QXcbConnection::createScreen(int screenNumber, xcb_screen_t* xcbScre int dotPos = displayName.lastIndexOf('.'); if (dotPos != -1) displayName.truncate(dotPos); - name = QString::fromLocal8Bit(displayName) + QLatin1Char('.') + QString::number(screenNumber); + name = QString::fromLocal8Bit(displayName) + QLatin1Char('.') + QString::number(virtualDesktop->number()); } - return new QXcbScreen(this, xcbScreen, outputId, output, name, screenNumber); + return new QXcbScreen(this, virtualDesktop, outputId, output, name); } bool QXcbConnection::checkOutputIsPrimary(xcb_window_t rootWindow, xcb_randr_output_t output) @@ -179,15 +179,11 @@ bool QXcbConnection::checkOutputIsPrimary(xcb_window_t rootWindow, xcb_randr_out return isPrimary; } -xcb_screen_t* QXcbConnection::xcbScreenForRootWindow(xcb_window_t rootWindow, int *xcbScreenNumber) +QXcbVirtualDesktop* QXcbConnection::virtualDesktopForRootWindow(xcb_window_t rootWindow) { - xcb_screen_iterator_t xcbScreenIter = xcb_setup_roots_iterator(m_setup); - for (; xcbScreenIter.rem; xcb_screen_next(&xcbScreenIter)) { - if (xcbScreenIter.data->root == rootWindow) { - if (xcbScreenNumber) - *xcbScreenNumber = xcb_setup_roots_length(m_setup) - xcbScreenIter.rem; - return xcbScreenIter.data; - } + foreach (QXcbVirtualDesktop *virtualDesktop, m_virtualDesktops) { + if (virtualDesktop->screen()->root == rootWindow) + return virtualDesktop; } return 0; @@ -200,8 +196,8 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event) { if (event->subCode == XCB_RANDR_NOTIFY_CRTC_CHANGE) { xcb_randr_crtc_change_t crtc = event->u.cc; - xcb_screen_t *xcbScreen = xcbScreenForRootWindow(crtc.window); - if (!xcbScreen) + QXcbVirtualDesktop *virtualDesktop = virtualDesktopForRootWindow(crtc.window); + if (!virtualDesktop) // Not for us return; @@ -218,9 +214,8 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event) } else if (event->subCode == XCB_RANDR_NOTIFY_OUTPUT_CHANGE) { xcb_randr_output_change_t output = event->u.oc; - int xcbScreenNumber = 0; - xcb_screen_t *xcbScreen = xcbScreenForRootWindow(output.window, &xcbScreenNumber); - if (!xcbScreen) + QXcbVirtualDesktop *virtualDesktop = virtualDesktopForRootWindow(output.window); + if (!virtualDesktop) // Not for us return; @@ -248,7 +243,7 @@ void QXcbConnection::updateScreens(const xcb_randr_notify_event_t *event) QScopedPointer outputInfo( xcb_randr_get_output_info_reply(xcb_connection(), outputInfoCookie, NULL)); - screen = createScreen(xcbScreenNumber, xcbScreen, output.output, outputInfo.data()); + screen = createScreen(virtualDesktop, output.output, outputInfo.data()); qCDebug(lcQpaScreen) << "output" << screen->name() << "is connected and enabled"; screen->setPrimary(checkOutputIsPrimary(output.window, output.output)); @@ -299,14 +294,15 @@ void QXcbConnection::initializeScreens() xcb_screen_iterator_t it = xcb_setup_roots_iterator(m_setup); int xcbScreenNumber = 0; // screen number in the xcb sense QXcbScreen* primaryScreen = Q_NULLPTR; - xcb_screen_t *xcbScreen = Q_NULLPTR; bool hasOutputs = false; while (it.rem) { // Each "screen" in xcb terminology is a virtual desktop, // potentially a collection of separate juxtaposed monitors. // But we want a separate QScreen for each output (e.g. DVI-I-1, VGA-1, etc.) // which will become virtual siblings. - xcbScreen = it.data; + xcb_screen_t *xcbScreen = it.data; + QXcbVirtualDesktop *virtualDesktop = new QXcbVirtualDesktop(this, xcbScreen, xcbScreenNumber); + m_virtualDesktops.append(virtualDesktop); QList siblings; int outputCount = 0; int connectedOutputCount = 0; @@ -376,7 +372,7 @@ void QXcbConnection::initializeScreens() continue; } - QXcbScreen *screen = createScreen(xcbScreenNumber, xcbScreen, outputs[i], output.data()); + QXcbScreen *screen = createScreen(virtualDesktop, outputs[i], output.data()); siblings << screen; ++connectedOutputCount; hasOutputs = true; @@ -411,8 +407,9 @@ void QXcbConnection::initializeScreens() // but the dimensions are known anyway, and we don't already have any lingering // (possibly disconnected) screens, then showing windows should be possible, // so create one screen. (QTBUG-31389) - if (xcbScreen && !hasOutputs && xcbScreen->width_in_pixels > 0 && xcbScreen->height_in_pixels > 0 && m_screens.isEmpty()) { - QXcbScreen *screen = createScreen(0, xcbScreen, 0, Q_NULLPTR); + QXcbVirtualDesktop *virtualDesktop = m_virtualDesktops.value(0); + if (virtualDesktop && !hasOutputs && !virtualDesktop->size().isEmpty() && m_screens.isEmpty()) { + QXcbScreen *screen = createScreen(virtualDesktop, 0, Q_NULLPTR); screen->setVirtualSiblings(QList() << screen); m_screens << screen; primaryScreen = screen; @@ -583,6 +580,9 @@ QXcbConnection::~QXcbConnection() while (!m_screens.isEmpty()) integration->destroyScreen(m_screens.takeLast()); + while (!m_virtualDesktops.isEmpty()) + delete m_virtualDesktops.takeLast(); + delete m_glIntegration; #ifdef XCB_USE_XLIB diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index f479c1bc80..91547dd697 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -80,6 +80,7 @@ Q_DECLARE_LOGGING_CATEGORY(lcQpaXInput) Q_DECLARE_LOGGING_CATEGORY(lcQpaXInputDevices) Q_DECLARE_LOGGING_CATEGORY(lcQpaScreen) +class QXcbVirtualDesktop; class QXcbScreen; class QXcbWindow; class QXcbDrag; @@ -494,12 +495,12 @@ private: void initializeXShape(); void initializeXKB(); void handleClientMessageEvent(const xcb_client_message_event_t *event); - QXcbScreen* createScreen(int screenNumber, xcb_screen_t* xcbScreen, + QXcbScreen* createScreen(QXcbVirtualDesktop *virtualDesktop, xcb_randr_output_t outputId = XCB_NONE, xcb_randr_get_output_info_reply_t *output = 0); QXcbScreen* findScreenForCrtc(xcb_window_t rootWindow, xcb_randr_crtc_t crtc); QXcbScreen* findScreenForOutput(xcb_window_t rootWindow, xcb_randr_output_t output); - xcb_screen_t* xcbScreenForRootWindow(xcb_window_t rootWindow, int *xcbScreenNumber = 0); + QXcbVirtualDesktop* virtualDesktopForRootWindow(xcb_window_t rootWindow); bool checkOutputIsPrimary(xcb_window_t rootWindow, xcb_randr_output_t output); void initializeScreens(); void updateScreens(const xcb_randr_notify_event_t *event); @@ -564,6 +565,7 @@ private: const xcb_setup_t *m_setup; bool m_canGrabServer; + QList m_virtualDesktops; QList m_screens; int m_primaryScreenNumber; diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index 8dd27ec9c5..e30cc26313 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -502,7 +502,7 @@ bool updateCursorTheme(void *dpy, const QByteArray &theme) { return setTheme; } - void QXcbCursor::cursorThemePropertyChanged(QXcbScreen *screen, const QByteArray &name, const QVariant &property, void *handle) + void QXcbCursor::cursorThemePropertyChanged(QXcbVirtualDesktop *screen, const QByteArray &name, const QVariant &property, void *handle) { Q_UNUSED(screen); Q_UNUSED(name); diff --git a/src/plugins/platforms/xcb/qxcbcursor.h b/src/plugins/platforms/xcb/qxcbcursor.h index 1280c7e042..7e5cdc6870 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.h +++ b/src/plugins/platforms/xcb/qxcbcursor.h @@ -91,7 +91,7 @@ private: CursorHash m_cursorHash; #endif #ifdef XCB_USE_XLIB - static void cursorThemePropertyChanged(QXcbScreen *screen, + static void cursorThemePropertyChanged(QXcbVirtualDesktop *screen, const QByteArray &name, const QVariant &property, void *handle); diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 6f1fc08167..fcf70f3c51 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -47,11 +47,33 @@ QT_BEGIN_NAMESPACE -QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, +QXcbVirtualDesktop::QXcbVirtualDesktop(QXcbConnection *connection, xcb_screen_t *screen, int number) + : QXcbObject(connection) + , m_screen(screen) + , m_number(number) + , m_xSettings(Q_NULLPTR) +{ +} + +QXcbVirtualDesktop::~QXcbVirtualDesktop() +{ + delete m_xSettings; +} + +QXcbXSettings *QXcbVirtualDesktop::xSettings() const +{ + if (!m_xSettings) { + QXcbVirtualDesktop *self = const_cast(this); + self->m_xSettings = new QXcbXSettings(self); + } + return m_xSettings; +} + +QXcbScreen::QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDesktop, xcb_randr_output_t outputId, xcb_randr_get_output_info_reply_t *output, - QString outputName, int number) + QString outputName) : QXcbObject(connection) - , m_screen(scr) + , m_virtualDesktop(virtualDesktop) , m_output(outputId) , m_crtc(output ? output->crtc : 0) , m_mode(XCB_NONE) @@ -59,10 +81,9 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, , m_rotation(XCB_RANDR_ROTATION_ROTATE_0) , m_outputName(outputName) , m_outputSizeMillimeters(output ? QSize(output->mm_width, output->mm_height) : QSize()) - , m_virtualSize(scr->width_in_pixels, scr->height_in_pixels) - , m_virtualSizeMillimeters(scr->width_in_millimeters, scr->height_in_millimeters) + , m_virtualSize(virtualDesktop->size()) + , m_virtualSizeMillimeters(virtualDesktop->physicalSize()) , m_orientation(Qt::PrimaryOrientation) - , m_number(number) , m_refreshRate(60) , m_forcedDpi(-1) , m_devicePixelRatio(1) @@ -70,7 +91,6 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *scr, , m_noFontHinting(false) , m_subpixelType(QFontEngine::SubpixelAntialiasingType(-1)) , m_antialiasingEnabled(-1) - , m_xSettings(0) { if (connection->hasXRandr()) { xcb_randr_select_input(xcb_connection(), screen()->root, true); @@ -215,7 +235,7 @@ QXcbScreen::~QXcbScreen() QWindow *QXcbScreen::topLevelAt(const QPoint &p) const { - xcb_window_t root = m_screen->root; + xcb_window_t root = screen()->root; int dpr = int(devicePixelRatio()); int x = p.x() / dpr; @@ -496,7 +516,7 @@ void QXcbScreen::updateRefreshRate(xcb_randr_mode_t mode) // we can safely use get_screen_resources_current here, because in order to // get here, we must have called get_screen_resources before xcb_randr_get_screen_resources_current_cookie_t resourcesCookie = - xcb_randr_get_screen_resources_current_unchecked(xcb_connection(), m_screen->root); + xcb_randr_get_screen_resources_current_unchecked(xcb_connection(), screen()->root); xcb_randr_get_screen_resources_current_reply_t *resources = xcb_randr_get_screen_resources_current_reply(xcb_connection(), resourcesCookie, NULL); if (resources) { @@ -707,11 +727,7 @@ void QXcbScreen::readXResources() QXcbXSettings *QXcbScreen::xSettings() const { - if (!m_xSettings) { - QXcbScreen *self = const_cast(this); - self->m_xSettings = new QXcbXSettings(self); - } - return m_xSettings; + return m_virtualDesktop->xSettings(); } static inline void formatRect(QDebug &debug, const QRect r) diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index 3f228465f2..6b60ea9bb1 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -54,12 +54,32 @@ class QXcbXSettings; class QDebug; #endif +class QXcbVirtualDesktop : public QXcbObject +{ +public: + QXcbVirtualDesktop(QXcbConnection *connection, xcb_screen_t *screen, int number); + ~QXcbVirtualDesktop(); + + xcb_screen_t *screen() const { return m_screen; } + int number() const { return m_number; } + QSize size() const { return QSize(m_screen->width_in_pixels, m_screen->height_in_pixels); } + QSize physicalSize() const { return QSize(m_screen->width_in_millimeters, m_screen->height_in_millimeters); } + + QXcbXSettings *xSettings() const; + +private: + xcb_screen_t *m_screen; + int m_number; + + QXcbXSettings *m_xSettings; +}; + class Q_XCB_EXPORT QXcbScreen : public QXcbObject, public QPlatformScreen { public: - QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen, + QXcbScreen(QXcbConnection *connection, QXcbVirtualDesktop *virtualDesktop, xcb_randr_output_t outputId, xcb_randr_get_output_info_reply_t *output, - QString outputName, int number); + QString outputName); ~QXcbScreen(); QPixmap grabWindow(WId window, int x, int y, int width, int height) const Q_DECL_OVERRIDE; @@ -69,7 +89,7 @@ public: QRect geometry() const Q_DECL_OVERRIDE { return m_geometry; } QRect nativeGeometry() const { return m_nativeGeometry; } QRect availableGeometry() const Q_DECL_OVERRIDE {return m_availableGeometry;} - int depth() const Q_DECL_OVERRIDE { return m_screen->root_depth; } + int depth() const Q_DECL_OVERRIDE { return screen()->root_depth; } QImage::Format format() const Q_DECL_OVERRIDE; QSizeF physicalSize() const Q_DECL_OVERRIDE { return m_sizeMillimeters; } QSize virtualSize() const { return m_virtualSize; } @@ -87,10 +107,10 @@ public: void setPrimary(bool primary) { m_primary = primary; } bool isPrimary() const { return m_primary; } - int screenNumber() const { return m_number; } + int screenNumber() const { return m_virtualDesktop->number(); } - xcb_screen_t *screen() const { return m_screen; } - xcb_window_t root() const { return m_screen->root; } + xcb_screen_t *screen() const { return m_virtualDesktop->screen(); } + xcb_window_t root() const { return screen()->root; } xcb_randr_output_t output() const { return m_output; } xcb_randr_crtc_t crtc() const { return m_crtc; } xcb_randr_mode_t mode() const { return m_mode; } @@ -126,7 +146,7 @@ private: QByteArray &stringValue); void sendStartupMessage(const QByteArray &message) const; - xcb_screen_t *m_screen; + QXcbVirtualDesktop *m_virtualDesktop; xcb_randr_output_t m_output; xcb_randr_crtc_t m_crtc; xcb_randr_mode_t m_mode; @@ -143,7 +163,6 @@ private: QSizeF m_virtualSizeMillimeters; QList m_siblings; Qt::ScreenOrientation m_orientation; - int m_number; QString m_windowManagerName; bool m_syncRequestSupported; xcb_window_t m_clientLeader; @@ -157,7 +176,6 @@ private: bool m_noFontHinting; QFontEngine::SubpixelAntialiasingType m_subpixelType; int m_antialiasingEnabled; - QXcbXSettings *m_xSettings; }; #ifndef QT_NO_DEBUG_STREAM diff --git a/src/plugins/platforms/xcb/qxcbxsettings.cpp b/src/plugins/platforms/xcb/qxcbxsettings.cpp index c83edd506d..46cee5d6d0 100644 --- a/src/plugins/platforms/xcb/qxcbxsettings.cpp +++ b/src/plugins/platforms/xcb/qxcbxsettings.cpp @@ -63,7 +63,7 @@ public: : last_change_serial(-1) {} - void updateValue(QXcbScreen *screen, const QByteArray &name, const QVariant &value, int last_change_serial) + void updateValue(QXcbVirtualDesktop *screen, const QByteArray &name, const QVariant &value, int last_change_serial) { if (last_change_serial <= this->last_change_serial) return; @@ -92,7 +92,7 @@ public: class QXcbXSettingsPrivate { public: - QXcbXSettingsPrivate(QXcbScreen *screen) + QXcbXSettingsPrivate(QXcbVirtualDesktop *screen) : screen(screen) , initialized(false) { @@ -217,18 +217,18 @@ public: } #endif //XCB_USE_XLIB - QXcbScreen *screen; + QXcbVirtualDesktop *screen; xcb_window_t x_settings_window; QMap settings; bool initialized; }; -QXcbXSettings::QXcbXSettings(QXcbScreen *screen) +QXcbXSettings::QXcbXSettings(QXcbVirtualDesktop *screen) : d_ptr(new QXcbXSettingsPrivate(screen)) { QByteArray settings_atom_for_screen("_XSETTINGS_S"); - settings_atom_for_screen.append(QByteArray::number(screen->screenNumber())); + settings_atom_for_screen.append(QByteArray::number(screen->number())); xcb_intern_atom_cookie_t atom_cookie = xcb_intern_atom(screen->xcb_connection(), true, settings_atom_for_screen.length(), diff --git a/src/plugins/platforms/xcb/qxcbxsettings.h b/src/plugins/platforms/xcb/qxcbxsettings.h index 4022f0a2c4..3f1d175336 100644 --- a/src/plugins/platforms/xcb/qxcbxsettings.h +++ b/src/plugins/platforms/xcb/qxcbxsettings.h @@ -44,13 +44,13 @@ class QXcbXSettings : public QXcbWindowEventListener { Q_DECLARE_PRIVATE(QXcbXSettings) public: - QXcbXSettings(QXcbScreen *screen); + QXcbXSettings(QXcbVirtualDesktop *screen); ~QXcbXSettings(); bool initialized() const; QVariant setting(const QByteArray &property) const; - typedef void (*PropertyChangeFunc)(QXcbScreen *screen, const QByteArray &name, const QVariant &property, void *handle); + typedef void (*PropertyChangeFunc)(QXcbVirtualDesktop *screen, const QByteArray &name, const QVariant &property, void *handle); void registerCallbackForProperty(const QByteArray &property, PropertyChangeFunc func, void *handle); void removeCallbackForHandle(const QByteArray &property, void *handle); void removeCallbackForHandle(void *handle); -- cgit v1.2.3 From 364905b59242084ba468d7fc52ab8ee4f889654c Mon Sep 17 00:00:00 2001 From: Alexander Volkov Date: Thu, 9 Apr 2015 14:50:36 +0300 Subject: xcb: Fix getting of virtual roots Update QXcbWMSupport::net_virtual_roots instead of QXcbWMSupport::net_wm_atoms. It's a copy/paste error. Change-Id: If146955d954850f02980f473ad2318d67f193ec9 Reviewed-by: Lars Knoll Reviewed-by: Uli Schlachter --- src/plugins/platforms/xcb/qxcbwmsupport.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbwmsupport.cpp b/src/plugins/platforms/xcb/qxcbwmsupport.cpp index bcdfde2ef9..7d31ac7118 100644 --- a/src/plugins/platforms/xcb/qxcbwmsupport.cpp +++ b/src/plugins/platforms/xcb/qxcbwmsupport.cpp @@ -68,7 +68,7 @@ void QXcbWMSupport::updateNetWMAtoms() remaining = 0; if (reply->type == XCB_ATOM_ATOM && reply->format == 32) { - int len = xcb_get_property_value_length(reply)/4; + int len = xcb_get_property_value_length(reply)/sizeof(xcb_atom_t); xcb_atom_t *atoms = (xcb_atom_t *)xcb_get_property_value(reply); int s = net_wm_atoms.size(); net_wm_atoms.resize(s + len); @@ -102,11 +102,11 @@ void QXcbWMSupport::updateVirtualRoots() remaining = 0; if (reply->type == XCB_ATOM_ATOM && reply->format == 32) { - int len = xcb_get_property_value_length(reply)/4; - xcb_atom_t *atoms = (xcb_atom_t *)xcb_get_property_value(reply); - int s = net_wm_atoms.size(); - net_wm_atoms.resize(s + len); - memcpy(net_wm_atoms.data() + s, atoms, len*sizeof(xcb_atom_t)); + int len = xcb_get_property_value_length(reply)/sizeof(xcb_window_t); + xcb_window_t *roots = (xcb_window_t *)xcb_get_property_value(reply); + int s = net_virtual_roots.size(); + net_virtual_roots.resize(s + len); + memcpy(net_virtual_roots.data() + s, roots, len*sizeof(xcb_window_t)); remaining = reply->bytes_after; offset += len; -- cgit v1.2.3 From 4fab4d2e806ee5aff112a0ef194cf0974e229eaa Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Thu, 9 Apr 2015 12:21:12 +0200 Subject: qiostextresponder: Use UIKeyboardTypePhonePad for ImhDialableCharactersOnly Change-Id: I8123199da51a0b840c068bea4ba089c0fec9697b Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiostextresponder.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index 5d2a675f90..0b5ff11b47 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -196,7 +196,7 @@ else if (hints & Qt::ImhFormattedNumbersOnly) self.keyboardType = UIKeyboardTypeDecimalPad; else if (hints & Qt::ImhDialableCharactersOnly) - self.keyboardType = UIKeyboardTypeNumberPad; + self.keyboardType = UIKeyboardTypePhonePad; else self.keyboardType = UIKeyboardTypeDefault; -- cgit v1.2.3 From 95b481ea6dfa901c23b012085527769f9b5823c9 Mon Sep 17 00:00:00 2001 From: Kai Uwe Broulik Date: Thu, 9 Apr 2015 12:27:31 +0200 Subject: qiostextresponder: Add support for ImhLatinOnly Change-Id: I38f43cd644d3c26c834cf60019c4db1fa0b8d61f Reviewed-by: Richard Moe Gustavsen --- src/plugins/platforms/ios/qiostextresponder.mm | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/ios/qiostextresponder.mm b/src/plugins/platforms/ios/qiostextresponder.mm index 0b5ff11b47..52336a4e69 100644 --- a/src/plugins/platforms/ios/qiostextresponder.mm +++ b/src/plugins/platforms/ios/qiostextresponder.mm @@ -197,6 +197,8 @@ self.keyboardType = UIKeyboardTypeDecimalPad; else if (hints & Qt::ImhDialableCharactersOnly) self.keyboardType = UIKeyboardTypePhonePad; + else if (hints & Qt::ImhLatinOnly) + self.keyboardType = UIKeyboardTypeASCIICapable; else self.keyboardType = UIKeyboardTypeDefault; -- cgit v1.2.3 From 4e1b09fa8ff1a9ab42c0a29a2efe1ae7f4700d71 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Fri, 20 Mar 2015 17:30:26 +0100 Subject: Keep screen geometries from overlapping The simple mapping of dividing each position by the devicePixelRatio does not work when screens have different DPR. If the low-DPR screen above or to the left of the high-DPR screen, the geometries will overlap in the Qt coordinate system. This change introduces a new mapping where the origin of each screen does not move. This mapping is not perfect: it will have gaps between contiguous screens. However, it will keep non-overlapping screens non-overlapping in the Qt coordinate system. Since there is no longer a simple linear coordinate transform, we have to add screen-dependent mapping functions, and distinguish between local and non-local coordinates. A side benefit is that the code is now easier to read, since we remove most manual coordinate transformation. We also have to cache the screen of each window: since we send resize events before screen change events, we cannot rely on QPlatformWindow::screen() (which is set from the screen change event). Task-number: QTBUG-45076 Change-Id: Ie95a0b71ae274e02903caa102a98af2050a44129 Reviewed-by: Shawn Rutledge --- src/plugins/platforms/xcb/qxcbcursor.cpp | 7 +- src/plugins/platforms/xcb/qxcbscreen.cpp | 29 ++++++- src/plugins/platforms/xcb/qxcbscreen.h | 5 ++ src/plugins/platforms/xcb/qxcbwindow.cpp | 143 ++++++++++++++++++++----------- src/plugins/platforms/xcb/qxcbwindow.h | 10 ++- 5 files changed, 138 insertions(+), 56 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbcursor.cpp b/src/plugins/platforms/xcb/qxcbcursor.cpp index e30cc26313..e51ab85e30 100644 --- a/src/plugins/platforms/xcb/qxcbcursor.cpp +++ b/src/plugins/platforms/xcb/qxcbcursor.cpp @@ -633,18 +633,17 @@ void QXcbCursor::queryPointer(QXcbConnection *c, xcb_window_t *rootWin, QPoint * QPoint QXcbCursor::pos() const { - const int dpr = int(m_screen->devicePixelRatio()); QPoint p; queryPointer(connection(), 0, &p); - return p / dpr; + return m_screen->mapFromNative(p); } void QXcbCursor::setPos(const QPoint &pos) { - const int dpr = int(m_screen->devicePixelRatio()); + const QPoint xPos = m_screen->mapToNative(pos); xcb_window_t root = 0; queryPointer(connection(), &root, 0); - xcb_warp_pointer(xcb_connection(), XCB_NONE, root, 0, 0, 0, 0, pos.x()*dpr, pos.y()*dpr); + xcb_warp_pointer(xcb_connection(), XCB_NONE, root, 0, 0, 0, 0, xPos.x(), xPos.y()); xcb_flush(xcb_connection()); } diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index fcf70f3c51..bcaa13eb1e 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -273,6 +273,31 @@ QWindow *QXcbScreen::topLevelAt(const QPoint &p) const return 0; } + +QPoint QXcbScreen::mapToNative(const QPoint &pos) const +{ + const int dpr = int(devicePixelRatio()); + return (pos - m_geometry.topLeft()) * dpr + m_nativeGeometry.topLeft(); +} + +QPoint QXcbScreen::mapFromNative(const QPoint &pos) const +{ + const int dpr = int(devicePixelRatio()); + return (pos - m_nativeGeometry.topLeft()) / dpr + m_geometry.topLeft(); +} + +QRect QXcbScreen::mapToNative(const QRect &rect) const +{ + const int dpr = int(devicePixelRatio()); + return QRect(mapToNative(rect.topLeft()), rect.size() * dpr); +} + +QRect QXcbScreen::mapFromNative(const QRect &rect) const +{ + const int dpr = int(devicePixelRatio()); + return QRect(mapFromNative(rect.topLeft()), rect.size() / dpr); +} + void QXcbScreen::windowShown(QXcbWindow *window) { // Freedesktop.org Startup Notification @@ -499,9 +524,9 @@ void QXcbScreen::updateGeometry(const QRect &geom, uint8_t rotation) qreal dpi = xGeometry.width() / physicalSize().width() * qreal(25.4); m_devicePixelRatio = qRound(dpi/96); const int dpr = int(devicePixelRatio()); // we may override m_devicePixelRatio - m_geometry = QRect(xGeometry.topLeft()/dpr, xGeometry.size()/dpr); + m_geometry = QRect(xGeometry.topLeft(), xGeometry.size()/dpr); m_nativeGeometry = QRect(xGeometry.topLeft(), xGeometry.size()); - m_availableGeometry = QRect(xAvailableGeometry.topLeft()/dpr, xAvailableGeometry.size()/dpr); + m_availableGeometry = QRect(mapFromNative(xAvailableGeometry.topLeft()), xAvailableGeometry.size()/dpr); QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry); } diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index 6b60ea9bb1..a29efc1e79 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -140,6 +140,11 @@ public: QXcbXSettings *xSettings() const; + QPoint mapToNative(const QPoint &pos) const; + QPoint mapFromNative(const QPoint &pos) const; + QRect mapToNative(const QRect &rect) const; + QRect mapFromNative(const QRect &rect) const; + private: static bool xResource(const QByteArray &identifier, const QByteArray &expectedIdentifier, diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index b06b41a77b..b5d0741fa6 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -138,7 +138,7 @@ enum QX11EmbedMessageType { const quint32 XEMBED_VERSION = 0; -static inline QRect mapToNative(const QRect &qtRect, int dpr) +static inline QRect mapLocalGeometryToNative(const QRect &qtRect, int dpr) { return QRect(qtRect.x() * dpr, qtRect.y() * dpr, qtRect.width() * dpr, qtRect.height() * dpr); } @@ -166,11 +166,45 @@ static inline QRect mapExposeFromNative(const QRect &xRect, int dpr) return QRect(dpr_floor(xRect.topLeft(), dpr), dpr_ceil(xRect.bottomRight(), dpr)); } -static inline QRect mapGeometryFromNative(const QRect &xRect, int dpr) +static inline QRect mapLocalGeometryFromNative(const QRect &xRect, int dpr) { return QRect(xRect.topLeft() / dpr, dpr_ceil(xRect.size(), dpr)); } +QXcbScreen *QXcbWindow::parentScreen() +{ + return parent() ? static_cast(parent())->parentScreen() : m_xcbScreen; +} + +QPoint QXcbWindow::mapToNative(const QPoint &pos, const QXcbScreen *screen) const +{ + if (parent()) + return pos * int(screen->devicePixelRatio()); + else + return screen->mapToNative(pos); +} +QPoint QXcbWindow::mapFromNative(const QPoint &pos, const QXcbScreen *screen) const +{ + if (parent()) + return pos / int(screen->devicePixelRatio()); + else + return screen->mapFromNative(pos); +} +QRect QXcbWindow::mapToNative(const QRect &rect, const QXcbScreen *screen) const +{ + if (parent()) + return mapLocalGeometryToNative(rect, int(screen->devicePixelRatio())); + else + return screen->mapToNative(rect); +} +QRect QXcbWindow::mapFromNative(const QRect &rect, const QXcbScreen *screen) const +{ + if (parent()) + return mapLocalGeometryFromNative(rect, int(screen->devicePixelRatio())); + else + return screen->mapFromNative(rect); +} + // Returns \c true if we should set WM_TRANSIENT_FOR on \a w static inline bool isTransient(const QWindow *w) { @@ -291,6 +325,7 @@ static const char *wm_window_type_property_id = "_q_xcb_wm_window_type"; QXcbWindow::QXcbWindow(QWindow *window) : QPlatformWindow(window) , m_window(0) + , m_xcbScreen(0) , m_syncCounter(0) , m_gravity(XCB_GRAVITY_STATIC) , m_mapped(false) @@ -344,8 +379,11 @@ void QXcbWindow::create() Qt::WindowType type = window()->type(); - QXcbScreen *platformScreen = xcbScreen(); + QXcbScreen *currentScreen = xcbScreen(); + QRect rect = window()->geometry(); + QXcbScreen *platformScreen = parent() ? parentScreen() : static_cast(screenForGeometry(rect)); + m_xcbScreen = platformScreen; if (type == Qt::Desktop) { m_window = platformScreen->root(); m_depth = platformScreen->screen()->root_depth; @@ -371,13 +409,10 @@ void QXcbWindow::create() // Parameters to XCreateWindow() are frame corner + inner size. // This fits in case position policy is frame inclusive. There is // currently no way to implement it for frame-exclusive geometries. - QRect rect = window()->geometry(); QPlatformWindow::setGeometry(rect); - QXcbScreen *currentScreen = xcbScreen(); - QPlatformScreen *newScreen = screenForGeometry(rect); - if (newScreen != currentScreen) - QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen()); + if (platformScreen != currentScreen) + QWindowSystemInterface::handleWindowScreenChanged(window(), platformScreen->QPlatformScreen::screen()); const int dpr = int(devicePixelRatio()); @@ -428,7 +463,7 @@ void QXcbWindow::create() m_visualId = visualInfo->visualid; - const QRect xRect = mapToNative(rect, dpr); + const QRect xRect = mapToNative(rect, platformScreen); m_window = XCreateWindow(DISPLAY_FROM_XCB(this), xcb_parent_id, xRect.x(), xRect.y(), xRect.width(), xRect.height(), 0, visualInfo->depth, InputOutput, visualInfo->visual, @@ -472,15 +507,16 @@ void QXcbWindow::create() const xcb_visualtype_t *visual = platformScreen->visualForId(m_visualId); m_imageFormat = imageFormatForVisual(m_depth, visual->red_mask, visual->blue_mask, &m_imageRgbSwap); + const QRect xRect = mapToNative(rect, platformScreen); Q_XCB_CALL(xcb_create_window(xcb_connection(), m_depth, m_window, // window id xcb_parent_id, // parent window id - rect.x(), - rect.y(), - rect.width(), - rect.height(), + xRect.x(), + xRect.y(), + xRect.width(), + xRect.height(), 0, // border width XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class m_visualId, // visual @@ -631,7 +667,7 @@ void QXcbWindow::destroy() void QXcbWindow::maybeSetScreen(QXcbScreen *screen) { - if (!window()->screen() && screen->geometry().contains(geometry().topLeft() * int(devicePixelRatio()))) { + if (!window()->screen() && screen->geometry().contains(geometry().topLeft())) { QWindowSystemInterface::handleWindowScreenChanged(window(), static_cast(screen)->screen()); QWindowSystemInterface::handleExposeEvent(window(), QRegion(QRect(QPoint(0, 0), window()->size()))); } @@ -644,16 +680,17 @@ void QXcbWindow::setGeometry(const QRect &rect) propagateSizeHints(); QXcbScreen *currentScreen = xcbScreen(); - QPlatformScreen *newScreen = screenForGeometry(rect); + QXcbScreen *newScreen = parent() ? parentScreen() : static_cast(screenForGeometry(rect)); + if (!newScreen) newScreen = currentScreen; - const QRect xRect = mapToNative(rect, int(newScreen->devicePixelRatio())); + m_xcbScreen = newScreen; + const QRect xRect = mapToNative(rect, newScreen); const QRect wmGeometry = windowToWmGeometry(xRect); - if (newScreen != currentScreen) - QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen()); + QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen()); if (qt_window_private(window())->positionAutomatic) { const quint32 mask = XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; @@ -1160,6 +1197,8 @@ void QXcbWindow::changeNetWmState(bool set, xcb_atom_t one, xcb_atom_t two) event.data.data32[3] = 0; event.data.data32[4] = 0; + if (!xcbScreen()) + return; Q_XCB_CALL(xcb_send_event(xcb_connection(), 0, xcbScreen()->root(), XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *)&event)); } @@ -1554,7 +1593,7 @@ void QXcbWindow::propagateSizeHints() memset(&hints, 0, sizeof(hints)); const int dpr = int(devicePixelRatio()); - const QRect xRect = mapToNative(windowToWmGeometry(geometry()), dpr); + const QRect xRect = windowToWmGeometry(mapToNative(geometry(), xcbScreen())); QWindow *win = window(); @@ -1892,20 +1931,21 @@ void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *even } } -// Temporary workaround for bug in QPlatformScreen::screenForNativeGeometry +// Temporary workaround for bug in QPlatformScreen::screenForGeometry // we need the native geometries to detect our screen, but that's not // available in cross-platform code. Will be fixed properly when highDPI // support is refactored to expose the native coordinate system. -QPlatformScreen *QXcbWindow::screenForNativeGeometry(const QRect &newGeometry) const +QXcbScreen *QXcbWindow::screenForNativeGeometry(const QRect &newGeometry) const { - QXcbScreen *currentScreen = static_cast(screen()); + QXcbScreen *currentScreen = xcbScreen(); if (!currentScreen && QGuiApplication::primaryScreen()) currentScreen = static_cast(QGuiApplication::primaryScreen()->handle()); if (currentScreen && !parent() && !currentScreen->nativeGeometry().intersects(newGeometry)) { Q_FOREACH (QPlatformScreen* screen, currentScreen->virtualSiblings()) { - if (static_cast(screen)->nativeGeometry().intersects(newGeometry)) - return screen; + QXcbScreen *xcbScreen = static_cast(screen); + if (xcbScreen->nativeGeometry().intersects(newGeometry)) + return xcbScreen; } } return currentScreen; @@ -1927,23 +1967,18 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t * } } - const int dpr = devicePixelRatio(); const QRect nativeRect = QRect(pos, QSize(event->width, event->height)); - const QRect rect = mapGeometryFromNative(nativeRect, dpr); + QXcbScreen *newScreen = parent() ? parentScreen() : screenForNativeGeometry(nativeRect); + + m_xcbScreen = newScreen; + if (!newScreen) + return; + const QRect rect = mapFromNative(nativeRect, newScreen); QPlatformWindow::setGeometry(rect); QWindowSystemInterface::handleGeometryChange(window(), rect); - QPlatformScreen *newScreen = screenForNativeGeometry(nativeRect); - if (newScreen != screen()) { - if (newScreen) - QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->screen()); - int newDpr = newScreen->devicePixelRatio(); - if (newDpr != dpr) { - QRect newRect = mapGeometryFromNative(nativeRect, newDpr); - QPlatformWindow::setGeometry(newRect); - QWindowSystemInterface::handleGeometryChange(window(), newRect); - } - } + if (newScreen != screen()) + QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen()); m_configureNotifyPending = false; @@ -1984,12 +2019,12 @@ QPoint QXcbWindow::mapToGlobal(const QPoint &pos) const xcb_translate_coordinates_reply_t *reply = xcb_translate_coordinates_reply(xcb_connection(), cookie, NULL); if (reply) { - ret.setX(reply->dst_x / dpr); - ret.setY(reply->dst_y / dpr); + ret.setX(reply->dst_x); + ret.setY(reply->dst_y); free(reply); } - return ret; + return mapFromNative(ret, xcbScreen()); } QPoint QXcbWindow::mapFromGlobal(const QPoint &pos) const @@ -1999,9 +2034,10 @@ QPoint QXcbWindow::mapFromGlobal(const QPoint &pos) const const int dpr = int(devicePixelRatio()); QPoint ret; + QPoint xPos = mapToNative(pos, xcbScreen()); xcb_translate_coordinates_cookie_t cookie = xcb_translate_coordinates(xcb_connection(), xcbScreen()->root(), xcb_window(), - pos.x() *dpr, pos.y() * dpr); + xPos.x(), xPos.y()); xcb_translate_coordinates_reply_t *reply = xcb_translate_coordinates_reply(xcb_connection(), cookie, NULL); if (reply) { @@ -2055,7 +2091,7 @@ void QXcbWindow::handleButtonPressEvent(const xcb_button_press_event_t *event) } const int dpr = int(devicePixelRatio()); QPoint local(event->event_x/dpr, event->event_y/dpr); - QPoint global(event->root_x/dpr, event->root_y/dpr); + QPoint global = xcbScreen()->mapFromNative(QPoint(event->root_x, event->root_y)); Qt::KeyboardModifiers modifiers = connection()->keyboard()->translateModifiers(event->state); @@ -2080,7 +2116,7 @@ void QXcbWindow::handleButtonReleaseEvent(const xcb_button_release_event_t *even { const int dpr = int(devicePixelRatio()); QPoint local(event->event_x/dpr, event->event_y/dpr); - QPoint global(event->root_x/dpr, event->root_y/dpr); + QPoint global = xcbScreen()->mapFromNative(QPoint(event->root_x, event->root_y)); Qt::KeyboardModifiers modifiers = connection()->keyboard()->translateModifiers(event->state); if (event->detail >= 4 && event->detail <= 7) { @@ -2095,7 +2131,9 @@ void QXcbWindow::handleMotionNotifyEvent(const xcb_motion_notify_event_t *event) { const int dpr = int(devicePixelRatio()); QPoint local(event->event_x/dpr, event->event_y/dpr); - QPoint global(event->root_x/dpr, event->root_y/dpr); + if (!xcbScreen()) + return; + QPoint global = xcbScreen()->mapFromNative(QPoint(event->root_x, event->root_y)); Qt::KeyboardModifiers modifiers = connection()->keyboard()->translateModifiers(event->state); handleMouseEvent(event->time, local, global, modifiers); @@ -2152,7 +2190,9 @@ void QXcbWindow::handleEnterNotifyEvent(const xcb_enter_notify_event_t *event) const int dpr = int(devicePixelRatio()); const QPoint local(event->event_x/dpr, event->event_y/dpr); - const QPoint global(event->root_x/dpr, event->root_y/dpr); + if (!xcbScreen()) + return; + QPoint global = xcbScreen()->mapFromNative(QPoint(event->root_x, event->root_y)); QWindowSystemInterface::handleEnterEvent(window(), local, global); } @@ -2170,7 +2210,9 @@ void QXcbWindow::handleLeaveNotifyEvent(const xcb_leave_notify_event_t *event) if (enterWindow) { const int dpr = int(devicePixelRatio()); QPoint local(enter->event_x/dpr, enter->event_y/dpr); - QPoint global(enter->root_x/dpr, enter->root_y/dpr); + if (!xcbScreen()) + return; + QPoint global = xcbScreen()->mapFromNative(QPoint(event->root_x, event->root_y)); QWindowSystemInterface::handleEnterLeaveEvent(enterWindow->window(), window(), local, global); } else { @@ -2185,6 +2227,8 @@ void QXcbWindow::handlePropertyNotifyEvent(const xcb_property_notify_event_t *ev connection()->setTime(event->time); const bool propertyDeleted = event->state == XCB_PROPERTY_DELETE; + if (!xcbScreen()) + return; if (event->atom == atom(QXcbAtom::_NET_WM_STATE) || event->atom == atom(QXcbAtom::WM_STATE)) { if (propertyDeleted) @@ -2333,7 +2377,6 @@ void QXcbWindow::windowEvent(QEvent *event) bool QXcbWindow::startSystemResize(const QPoint &pos, Qt::Corner corner) { - const int dpr = int(devicePixelRatio()); const xcb_atom_t moveResize = connection()->atom(QXcbAtom::_NET_WM_MOVERESIZE); if (!connection()->wmSupport()->isSupportedByWM(moveResize)) return false; @@ -2342,7 +2385,7 @@ bool QXcbWindow::startSystemResize(const QPoint &pos, Qt::Corner corner) xev.type = moveResize; xev.window = xcb_window(); xev.format = 32; - const QPoint globalPos = window()->mapToGlobal(pos) * dpr; + const QPoint globalPos = mapToNative(window()->mapToGlobal(pos), xcbScreen()); xev.data.data32[0] = globalPos.x(); xev.data.data32[1] = globalPos.y(); const bool bottom = corner == Qt::BottomRightCorner || corner == Qt::BottomLeftCorner; @@ -2471,7 +2514,7 @@ void QXcbWindow::setMask(const QRegion ®ion) const int dpr = devicePixelRatio(); QVector rects; foreach (const QRect &r, region.rects()) - rects.push_back(qRectToXCBRectangle(mapToNative(r, dpr))); + rects.push_back(qRectToXCBRectangle(mapLocalGeometryToNative(r, dpr))); xcb_shape_rectangles(connection()->xcb_connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED, xcb_window(), 0, 0, rects.size(), &rects[0]); @@ -2495,6 +2538,8 @@ bool QXcbWindow::needsSync() const void QXcbWindow::postSyncWindowRequest() { + if (!xcbScreen()) + return; if (!m_pendingSyncRequest) { QXcbSyncWindowRequest *e = new QXcbSyncWindowRequest(this); m_pendingSyncRequest = e; diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index c08408a1ca..fbf3cfe172 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -155,7 +155,7 @@ public: virtual void create(); virtual void destroy(); void maybeSetScreen(QXcbScreen *screen); - QPlatformScreen *screenForNativeGeometry(const QRect &newGeometry) const; + QXcbScreen *screenForNativeGeometry(const QRect &newGeometry) const; public Q_SLOTS: void updateSyncRequestCounter(); @@ -165,6 +165,12 @@ protected: virtual void *createVisual() { return Q_NULLPTR; } virtual bool supportsSyncProtocol() { return !window()->supportsOpenGL(); } + QPoint mapToNative(const QPoint &pos, const QXcbScreen *screen) const; + QPoint mapFromNative(const QPoint &pos, const QXcbScreen *screen) const; + QRect mapToNative(const QRect &rect, const QXcbScreen *screen) const; + QRect mapFromNative(const QRect &rect, const QXcbScreen *screen) const; + QXcbScreen *parentScreen(); + void changeNetWmState(bool set, xcb_atom_t one, xcb_atom_t two = 0); NetWmStates netWmStates(); void setNetWmStates(NetWmStates); @@ -192,6 +198,8 @@ protected: xcb_window_t m_window; + QXcbScreen *m_xcbScreen; + uint m_depth; QImage::Format m_imageFormat; bool m_imageRgbSwap; -- cgit v1.2.3 From 939f21be53efabc37b7682a72effab716d8b9410 Mon Sep 17 00:00:00 2001 From: Filipe Azevedo Date: Mon, 16 Mar 2015 14:07:17 +0100 Subject: QNSView: Implement custom cursors for drag and drop. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The change has been made so it support possible future change for QTBUG-26724 Task-number: QTBUG-40346 Change-Id: Ia52835f1a882289a2a22a0b755c943a12b8d3aa3 Reviewed-by: Christoph Schleifenbaum Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qnsview.mm | 42 ++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 3a3a17a474..7896fffaad 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1883,6 +1883,48 @@ static QPoint mapWindowCoordinates(QWindow *source, QWindow *target, QPoint poin response = QWindowSystemInterface::handleDrag(target, &mimeData, mapWindowCoordinates(m_window, target, qt_windowPoint), qtAllowed); } + QCocoaDrag* nativeDrag = QCocoaIntegration::instance()->drag(); + const QPixmap pixmapCursor = nativeDrag->currentDrag()->dragCursor(response.acceptedAction()); + NSCursor *nativeCursor = nil; + + if (pixmapCursor.isNull()) { + switch (response.acceptedAction()) { + case Qt::CopyAction: + nativeCursor = [NSCursor dragCopyCursor]; + break; + case Qt::LinkAction: + nativeCursor = [NSCursor dragLinkCursor]; + break; + case Qt::IgnoreAction: + // Uncomment the next lines if forbiden cursor wanted on non droppable targets. + /*nativeCursor = [NSCursor operationNotAllowedCursor]; + break;*/ + case Qt::MoveAction: + default: + nativeCursor = [NSCursor arrowCursor]; + break; + } + } + else { + NSImage *nsimage = qt_mac_create_nsimage(pixmapCursor); + nativeCursor = [[NSCursor alloc] initWithImage:nsimage hotSpot:NSZeroPoint]; + [nsimage release]; + } + + // change the cursor + [nativeCursor set]; + + // Make sure the cursor is updated correctly if the mouse does not move and window is under cursor + // by creating a fake move event + const QPoint mousePos(QCursor::pos()); + CGEventRef moveEvent(CGEventCreateMouseEvent( + NULL, kCGEventMouseMoved, + CGPointMake(mousePos.x(), mousePos.y()), + kCGMouseButtonLeft // ignored + )); + CGEventPost(kCGHIDEventTap, moveEvent); + CFRelease(moveEvent); + return qt_mac_mapDropAction(response.acceptedAction()); } -- cgit v1.2.3 From d605883b5e8e8cb272fab760cd4896d006ce0719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 10 Apr 2015 12:57:02 +0200 Subject: Make it possible to use the -visual argument for xcb applications to use a specific visual id when creating windows. Also make it possible to retrieve the visual id of a specific window with QXcbWindowFunctions::visualId(QWindow *window). UINT_MAX is used as an invalid visualId. Change-Id: If62ada119ce8f9174cc211f53bbf1ce1bb7d021a Reviewed-by: Andy Shaw --- src/plugins/platforms/xcb/qxcbconnection.cpp | 19 +++++- src/plugins/platforms/xcb/qxcbconnection.h | 9 ++- src/plugins/platforms/xcb/qxcbintegration.cpp | 11 ++- src/plugins/platforms/xcb/qxcbintegration.h | 3 + src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 3 + src/plugins/platforms/xcb/qxcbwindow.cpp | 82 +++++++++++++++++------ src/plugins/platforms/xcb/qxcbwindow.h | 3 + 7 files changed, 105 insertions(+), 25 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 3d65b789a4..94f4c2a2d3 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -66,6 +66,7 @@ #include #include #include +#include #endif #if defined(XCB_USE_XINPUT2) @@ -437,9 +438,10 @@ void QXcbConnection::initializeScreens() qCDebug(lcQpaScreen) << "primary output is" << m_screens.first()->name(); } -QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGrabServer, const char *displayName) +QXcbConnection::QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGrabServer, xcb_visualid_t defaultVisualId, const char *displayName) : m_connection(0) , m_canGrabServer(canGrabServer) + , m_defaultVisualId(defaultVisualId) , m_primaryScreenNumber(0) , m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY")) , m_nativeInterface(nativeInterface) @@ -1351,6 +1353,21 @@ void *QXcbConnection::xlib_display() const { return m_xlib_display; } + +void *QXcbConnection::createVisualInfoForDefaultVisualId() const +{ + if (m_defaultVisualId == UINT_MAX) + return 0; + XVisualInfo info; + memset(&info, 0, sizeof info); + info.visualid = m_defaultVisualId; + + int count = 0; + XVisualInfo *retVisual = XGetVisualInfo(DISPLAY_FROM_XCB(this), VisualIDMask, &info, &count); + Q_ASSERT(count < 2); + return retVisual; +} + #endif void QXcbConnection::processXcbEvents() diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 91547dd697..e4274eca4d 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -370,7 +370,7 @@ class Q_XCB_EXPORT QXcbConnection : public QObject { Q_OBJECT public: - QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGrabServer, const char *displayName = 0); + QXcbConnection(QXcbNativeInterface *nativeInterface, bool canGrabServer, xcb_visualid_t defaultVisualId, const char *displayName = 0); ~QXcbConnection(); QXcbConnection *connection() const { return const_cast(this); } @@ -400,8 +400,13 @@ public: QXcbWMSupport *wmSupport() const { return m_wmSupport.data(); } xcb_window_t rootWindow(); + + bool hasDefaultVisualId() const { return m_defaultVisualId != UINT_MAX; } + xcb_visualid_t defaultVisualId() const { return m_defaultVisualId; } + #ifdef XCB_USE_XLIB void *xlib_display() const; + void *createVisualInfoForDefaultVisualId() const; #endif #if defined(XCB_USE_XINPUT2) @@ -564,6 +569,7 @@ private: xcb_connection_t *m_connection; const xcb_setup_t *m_setup; bool m_canGrabServer; + xcb_visualid_t m_defaultVisualId; QList m_virtualDesktops; QList m_screens; @@ -632,6 +638,7 @@ private: }; #define DISPLAY_FROM_XCB(object) ((Display *)(object->connection()->xlib_display())) +#define CREATE_VISUALINFO_FROM_DEFAULT_VISUALID(object) ((XVisualInfo *)(object->connection()->createVisualInfoForDefaultVisualId())) template xcb_generic_event_t *QXcbConnection::checkEvent(T &checker) diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 2547e537a7..fc06f1a7b0 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -116,6 +116,7 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char : m_services(new QGenericUnixServices) , m_instanceName(0) , m_canGrab(true) + , m_defaultVisualId(UINT_MAX) { m_instance = this; @@ -143,6 +144,12 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char noGrabArg = true; else if (arg == "-dograb") doGrabArg = true; + else if (arg == "-visual" && i < argc - 1) { + bool ok = false; + m_defaultVisualId = QByteArray(argv[++i]).toUInt(&ok, 0); + if (!ok) + m_defaultVisualId = UINT_MAX; + } else argv[j++] = argv[i]; } @@ -167,12 +174,12 @@ QXcbIntegration::QXcbIntegration(const QStringList ¶meters, int &argc, char if (canNotGrabEnv) m_canGrab = false; - m_connections << new QXcbConnection(m_nativeInterface.data(), m_canGrab, displayName); + m_connections << new QXcbConnection(m_nativeInterface.data(), m_canGrab, m_defaultVisualId, displayName); for (int i = 0; i < parameters.size() - 1; i += 2) { qCDebug(lcQpaScreen) << "connecting to additional display: " << parameters.at(i) << parameters.at(i+1); QString display = parameters.at(i) + QLatin1Char(':') + parameters.at(i+1); - m_connections << new QXcbConnection(m_nativeInterface.data(), m_canGrab, display.toLatin1().constData()); + m_connections << new QXcbConnection(m_nativeInterface.data(), m_canGrab, m_defaultVisualId, display.toLatin1().constData()); } m_fontDatabase.reset(new QGenericUnixFontDatabase()); diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index 4212d53810..4e2a3c2bbd 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -39,6 +39,8 @@ #include "qxcbexport.h" +#include + QT_BEGIN_NAMESPACE class QXcbConnection; @@ -123,6 +125,7 @@ private: mutable QByteArray m_wmClass; const char *m_instanceName; bool m_canGrab; + xcb_visualid_t m_defaultVisualId; static QXcbIntegration *m_instance; }; diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index bfba7f2b6a..8bf9003af7 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -392,6 +392,9 @@ QFunctionPointer QXcbNativeInterface::platformFunction(const QByteArray &functio if (function == QXcbWindowFunctions::setWmWindowTypeIdentifier()) { return QFunctionPointer(QXcbWindow::setWmWindowTypeStatic); } + if (function == QXcbWindowFunctions::visualIdIdentifier()) { + return QFunctionPointer(QXcbWindowFunctions::VisualId(QXcbWindow::visualIdStatic)); + } return Q_NULLPTR; } diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index b5d0741fa6..77c431edb2 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -388,7 +388,16 @@ void QXcbWindow::create() m_window = platformScreen->root(); m_depth = platformScreen->screen()->root_depth; m_visualId = platformScreen->screen()->root_visual; - const xcb_visualtype_t *visual = platformScreen->visualForId(m_visualId); + const xcb_visualtype_t *visual = 0; + if (connection()->hasDefaultVisualId()) { + visual = platformScreen->visualForId(connection()->defaultVisualId()); + if (visual) + m_visualId = connection()->defaultVisualId(); + if (!visual) + qWarning() << "Could not use default visual id. Falling back to root_visual for screen."; + } + if (!visual) + visual = platformScreen->visualForId(m_visualId); m_imageFormat = imageFormatForVisual(m_depth, visual->red_mask, visual->blue_mask, &m_imageRgbSwap); connection()->addWindowEventListener(m_window, this); return; @@ -442,7 +451,12 @@ void QXcbWindow::create() #ifdef XCB_USE_XLIB if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL)) { - XVisualInfo *visualInfo = static_cast(createVisual()); + XVisualInfo *visualInfo = Q_NULLPTR; + if (connection()->hasDefaultVisualId()) + visualInfo = CREATE_VISUALINFO_FROM_DEFAULT_VISUALID(this); + if (!visualInfo) + visualInfo = static_cast(createVisual()); + if (!visualInfo && window()->surfaceType() == QSurface::OpenGLSurface) qFatal("Could not initialize OpenGL"); @@ -477,35 +491,49 @@ void QXcbWindow::create() if (!m_window) { m_window = xcb_generate_id(xcb_connection()); - m_visualId = platformScreen->screen()->root_visual; + m_visualId = UINT_MAX; + const xcb_visualtype_t *visual = Q_NULLPTR; m_depth = platformScreen->screen()->root_depth; uint32_t mask = 0; uint32_t values[3]; - if (m_format.alphaBufferSize() == 8) { - xcb_depth_iterator_t depthIter = xcb_screen_allowed_depths_iterator(platformScreen->screen()); - while (depthIter.rem) { - if (depthIter.data->depth == 32) { - xcb_visualtype_iterator_t visualIter = xcb_depth_visuals_iterator(depthIter.data); - if (visualIter.rem) { - m_visualId = visualIter.data->visual_id; - m_depth = 32; - uint32_t colormap = xcb_generate_id(xcb_connection()); - xcb_create_colormap(xcb_connection(), XCB_COLORMAP_ALLOC_NONE, colormap, - xcb_parent_id, m_visualId); - mask |= XCB_CW_BACK_PIXEL | XCB_CW_BORDER_PIXEL | XCB_CW_COLORMAP; - values[0] = platformScreen->screen()->white_pixel; - values[1] = platformScreen->screen()->black_pixel; - values[2] = colormap; - break; + if (connection()->hasDefaultVisualId()) { + m_visualId = connection()->defaultVisualId(); + visual = platformScreen->visualForId(m_visualId); + } + + if (!visual) { + if (connection()->hasDefaultVisualId()) + qWarning("Failed to use default visual id. Falling back to using screens root_visual"); + + m_visualId = platformScreen->screen()->root_visual; + + if (m_format.alphaBufferSize() == 8) { + xcb_depth_iterator_t depthIter = xcb_screen_allowed_depths_iterator(platformScreen->screen()); + while (depthIter.rem) { + if (depthIter.data->depth == 32) { + xcb_visualtype_iterator_t visualIter = xcb_depth_visuals_iterator(depthIter.data); + if (visualIter.rem) { + m_visualId = visualIter.data->visual_id; + m_depth = 32; + uint32_t colormap = xcb_generate_id(xcb_connection()); + xcb_create_colormap(xcb_connection(), XCB_COLORMAP_ALLOC_NONE, colormap, + xcb_parent_id, m_visualId); + mask |= XCB_CW_BACK_PIXEL | XCB_CW_BORDER_PIXEL | XCB_CW_COLORMAP; + values[0] = platformScreen->screen()->white_pixel; + values[1] = platformScreen->screen()->black_pixel; + values[2] = colormap; + break; + } } + xcb_depth_next(&depthIter); } - xcb_depth_next(&depthIter); } + + visual = platformScreen->visualForId(m_visualId); } - const xcb_visualtype_t *visual = platformScreen->visualForId(m_visualId); m_imageFormat = imageFormatForVisual(m_depth, visual->red_mask, visual->blue_mask, &m_imageRgbSwap); const QRect xRect = mapToNative(rect, platformScreen); @@ -1680,6 +1708,13 @@ void QXcbWindow::setWmWindowTypeStatic(QWindow *window, QXcbWindowFunctions::WmW window->setProperty(wm_window_type_property_id, QVariant::fromValue(static_cast(windowTypes))); } +uint QXcbWindow::visualIdStatic(QWindow *window) +{ + if (window && window->handle()) + return static_cast(window->handle())->visualId(); + return UINT_MAX; +} + QXcbWindowFunctions::WmWindowTypes QXcbWindow::wmWindowTypes() const { QXcbWindowFunctions::WmWindowTypes result(0); @@ -2531,6 +2566,11 @@ void QXcbWindow::setAlertState(bool enabled) changeNetWmState(enabled, atom(QXcbAtom::_NET_WM_STATE_DEMANDS_ATTENTION)); } +uint QXcbWindow::visualId() const +{ + return m_visualId; +} + bool QXcbWindow::needsSync() const { return m_syncState == SyncAndConfigureReceived; diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index fbf3cfe172..512bc54255 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -139,10 +139,13 @@ public: void updateNetWmUserTime(xcb_timestamp_t timestamp); static void setWmWindowTypeStatic(QWindow *window, QXcbWindowFunctions::WmWindowTypes windowTypes); + static uint visualIdStatic(QWindow *window); QXcbWindowFunctions::WmWindowTypes wmWindowTypes() const; void setWmWindowType(QXcbWindowFunctions::WmWindowTypes types); + uint visualId() const; + bool needsSync() const; void postSyncWindowRequest(); -- cgit v1.2.3 From 4f8171998378f3e0f345b2b417afbfc9ad9738f0 Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Tue, 14 Apr 2015 12:02:47 +0200 Subject: Pass on the auto repeat information for key events Task-number: QTBUG-45340 Change-Id: Iecc55987fa784e4bf14317d9d4a085a8f0b58451 Reviewed-by: Christian Stromme --- src/plugins/platforms/android/androidjniinput.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp index 14b0c96cb5..8ee3ff88d1 100644 --- a/src/plugins/platforms/android/androidjniinput.cpp +++ b/src/plugins/platforms/android/androidjniinput.cpp @@ -663,24 +663,24 @@ namespace QtAndroidInput return unicode ? QString(QChar(unicode)) : QString(); } - static void keyDown(JNIEnv */*env*/, jobject /*thiz*/, jint key, jint unicode, jint modifier) + static void keyDown(JNIEnv */*env*/, jobject /*thiz*/, jint key, jint unicode, jint modifier, jboolean autoRepeat) { QWindowSystemInterface::handleKeyEvent(0, QEvent::KeyPress, mapAndroidKey(key), mapAndroidModifiers(modifier), toString(unicode), - false); + autoRepeat); } - static void keyUp(JNIEnv */*env*/, jobject /*thiz*/, jint key, jint unicode, jint modifier) + static void keyUp(JNIEnv */*env*/, jobject /*thiz*/, jint key, jint unicode, jint modifier, jboolean autoRepeat) { QWindowSystemInterface::handleKeyEvent(0, QEvent::KeyRelease, mapAndroidKey(key), mapAndroidModifiers(modifier), toString(unicode), - false); + autoRepeat); } static void keyboardVisibilityChanged(JNIEnv */*env*/, jobject /*thiz*/, jboolean visibility) @@ -702,8 +702,8 @@ namespace QtAndroidInput {"mouseUp", "(III)V", (void *)mouseUp}, {"mouseMove", "(III)V", (void *)mouseMove}, {"longPress", "(III)V", (void *)longPress}, - {"keyDown", "(III)V", (void *)keyDown}, - {"keyUp", "(III)V", (void *)keyUp}, + {"keyDown", "(IIIZ)V", (void *)keyDown}, + {"keyUp", "(IIIZ)V", (void *)keyUp}, {"keyboardVisibilityChanged", "(Z)V", (void *)keyboardVisibilityChanged} }; -- cgit v1.2.3 From 090002618ff4889f1953642ab9d73bceaa1c962a Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Wed, 15 Apr 2015 14:51:04 +0200 Subject: Fix compilation of xcb-qt without system xcb headers Make sure the plugins are actually using the 3rdparty headers we ship, not the system ones. Change-Id: I5c857abee8e62c207843f9d29c369620be0d7da8 Reviewed-by: Laszlo Agocs --- .../platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri index 8c60268e0d..e859865687 100644 --- a/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri +++ b/src/plugins/platforms/xcb/gl_integrations/gl_integrations_plugin_base.pri @@ -29,8 +29,8 @@ CONFIG += qpa/genericunixfontdatabase contains(QT_CONFIG, xcb-qt) { DEFINES += XCB_USE_RENDER - XCB_DIR = ../../../3rdparty/xcb - INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/sysinclude + XCB_DIR = $$clean_path($$PWD/../../../../3rdparty/xcb) + INCLUDEPATH += $$XCB_DIR/include $$XCB_DIR/include/xcb $$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 -- cgit v1.2.3 From d4bc56cb4218f6f8378f04c23865156b349b037d Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete Date: Wed, 15 Apr 2015 14:00:10 +0200 Subject: Fix screen detection on configureNotify If we got two rapid screen changes in a row, we would disregard the second change. This happens because QPlatformScreen::screen() is updated asynchronously, so if we got a screen change A --> B immediately followed by B --> A, before the first screen change event had been processed, we would compare with the old value and conclude nothing had changed. This can happen on creation: if the initial geometry of the window is outside all physical screens, the window manager will immediately move it. The solution is to compare the new screen to the locally cached value. Change-Id: I5440dc035cac4fba4f29ac563e36dfe3e2f82aea Task-number: QTBUG-45076 Reviewed-by: Shawn Rutledge Reviewed-by: Laszlo Agocs --- src/plugins/platforms/xcb/qxcbwindow.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 77c431edb2..3188a7f19d 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -2005,6 +2005,7 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t * const QRect nativeRect = QRect(pos, QSize(event->width, event->height)); QXcbScreen *newScreen = parent() ? parentScreen() : screenForNativeGeometry(nativeRect); + QXcbScreen *currentScreen = m_xcbScreen; m_xcbScreen = newScreen; if (!newScreen) return; @@ -2012,7 +2013,7 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t * QPlatformWindow::setGeometry(rect); QWindowSystemInterface::handleGeometryChange(window(), rect); - if (newScreen != screen()) + if (newScreen != currentScreen) QWindowSystemInterface::handleWindowScreenChanged(window(), newScreen->QPlatformScreen::screen()); m_configureNotifyPending = false; -- cgit v1.2.3 From 5e8e04a29ff15e8b329c758f2ea62b8e6feb70f9 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 27 Mar 2015 12:28:40 +0100 Subject: OS X: Do not re-create tracking areas over and over again NSTrackingInVisibleRect already makes sure that the tracking area updates itself, so we only need to add our tracking area if it is missing. For some reason this also fixes that Qt mouse tracking was broken after showing e.g. an embedded native WebView. Task-number: QTBUG-21944 Change-Id: I8013517f474f18e44b1ddd411defe1b6e60f05bf Reviewed-by: Gabriel de Dietrich --- src/plugins/platforms/cocoa/qnsview.h | 1 + src/plugins/platforms/cocoa/qnsview.mm | 30 ++++++++++++------------------ 2 files changed, 13 insertions(+), 18 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index c3815ee60a..32bc15d092 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -59,6 +59,7 @@ Q_FORWARD_DECLARE_OBJC_CLASS(QT_MANGLE_NAMESPACE(QNSViewMouseMoveHelper)); bool m_shouldInvalidateWindowShadow; QWindow *m_window; QCocoaWindow *m_platformWindow; + NSTrackingArea *m_trackingArea; Qt::MouseButtons m_buttons; Qt::MouseButtons m_frameStrutButtons; QString m_composingText; diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 7896fffaad..04f7119730 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -167,6 +167,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; - (void)dealloc { CGImageRelease(m_maskImage); + [m_trackingArea release]; m_maskImage = 0; m_window = 0; m_subscribesForGlobalFrameNotifications = false; @@ -188,6 +189,7 @@ static NSString *_q_NSWindowDidChangeOcclusionStateNotification = nil; m_window = window; m_platformWindow = platformWindow; m_sendKeyEvent = false; + m_trackingArea = nil; #ifdef QT_COCOA_ENABLE_ACCESSIBILITY_INSPECTOR // prevent rift in space-time continuum, disable @@ -841,19 +843,11 @@ QT_WARNING_POP { [super updateTrackingAreas]; - // [NSView addTrackingArea] is slow, so bail out early if we can: - if (NSIsEmptyRect([self visibleRect])) - return; - - // Remove current trakcing areas: QCocoaAutoReleasePool pool; - if (NSArray *trackingArray = [self trackingAreas]) { - NSUInteger size = [trackingArray count]; - for (NSUInteger i = 0; i < size; ++i) { - NSTrackingArea *t = [trackingArray objectAtIndex:i]; - [self removeTrackingArea:t]; - } - } + + // NSTrackingInVisibleRect keeps care of updating once the tracking is set up, so bail out early + if (m_trackingArea && [[self trackingAreas] containsObject:m_trackingArea]) + return; // Ideally, we shouldn't have NSTrackingMouseMoved events included below, it should // only be turned on if mouseTracking, hover is on or a tool tip is set. @@ -863,12 +857,12 @@ QT_WARNING_POP // is a performance hit). So it goes. NSUInteger trackingOptions = NSTrackingMouseEnteredAndExited | NSTrackingActiveInActiveApp | NSTrackingInVisibleRect | NSTrackingMouseMoved | NSTrackingCursorUpdate; - NSTrackingArea *ta = [[[NSTrackingArea alloc] initWithRect:[self frame] - options:trackingOptions - owner:m_mouseMoveHelper - userInfo:nil] - autorelease]; - [self addTrackingArea:ta]; + [m_trackingArea release]; + m_trackingArea = [[NSTrackingArea alloc] initWithRect:[self frame] + options:trackingOptions + owner:m_mouseMoveHelper + userInfo:nil]; + [self addTrackingArea:m_trackingArea]; } -(void)cursorUpdateImpl:(NSEvent *)theEvent -- cgit v1.2.3 From 700eb7a2a58dd64c03c5855f2b038e7cbce1fc12 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Mon, 13 Apr 2015 08:52:25 +0200 Subject: windows: Add a version test to the Intel HD blacklist The original rule was way too broad: it disabled desktop GL many HD 4400 machines that have no problems with it at all. While the rule with the version check is somewhat dubious, it is the only thing we can do. Task-number: QTBUG-45505 Task-number: QTBUG-43263 Change-Id: I217a96a2a9c7cc2d000a8f06493d0857626f2aaa Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/openglblacklists/default.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/openglblacklists/default.json b/src/plugins/platforms/windows/openglblacklists/default.json index 0217b79ecf..23607523bd 100644 --- a/src/plugins/platforms/windows/openglblacklists/default.json +++ b/src/plugins/platforms/windows/openglblacklists/default.json @@ -4,12 +4,16 @@ "entries": [ { "id": 1, - "description": "Desktop OpenGL is unreliable on Intel HD3000/GMA (QTBUG-43263, QTBUG-42240)", + "description": "Desktop OpenGL is unreliable on some Intel HD laptops (QTBUG-43263, QTBUG-42240)", "vendor_id": "0x8086", "device_id": [ "0x0A16" ], "os": { "type": "win" }, + "driver_version": { + "op": "<=", + "value": "10.18.10.3277" + }, "features": [ "disable_desktopgl" ] -- cgit v1.2.3 From b7d75277208cdbd63c4483fb89fc04798939c651 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Thu, 16 Apr 2015 15:44:27 +0200 Subject: Map X11 AudioPause button Add a missing mapping for the X11 media key AudioPause. Change-Id: I2888854a021192942c7e8d47d581d834e1f39736 Reviewed-by: Shawn Rutledge Reviewed-by: Gatis Paeglis --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 1 + 1 file changed, 1 insertion(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 376599578f..6a9ef5869e 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -437,6 +437,7 @@ static const unsigned int KeyTbl[] = { XF86XK_AudioPrev, Qt::Key_MediaPrevious, XF86XK_AudioNext, Qt::Key_MediaNext, XF86XK_AudioRecord, Qt::Key_MediaRecord, + XF86XK_AudioPause, Qt::Key_MediaPause, XF86XK_Mail, Qt::Key_LaunchMail, XF86XK_MyComputer, Qt::Key_Launch0, // ### Qt 6: remap properly XF86XK_Calculator, Qt::Key_Launch1, -- cgit v1.2.3 From f3fad26bc9e0fde3bcf1625da731aeb02b04a7a5 Mon Sep 17 00:00:00 2001 From: Laszlo Agocs Date: Thu, 9 Apr 2015 16:49:34 +0200 Subject: Add matching by GL_VENDOR to QOpenGLConfig This will be essential on Linux, especially Embedded where PCI IDs are not that useful. Change-Id: I2fa8ca07236e8aae203e21fe629d12aab092c7fd Reviewed-by: Friedemann Kleint --- src/plugins/platforms/windows/qwindowsopengltester.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp index f5065a22b8..2e6a43f596 100644 --- a/src/plugins/platforms/windows/qwindowsopengltester.cpp +++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp @@ -224,10 +224,7 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c #elif defined(Q_OS_WINCE) return QWindowsOpenGLTester::Gles; #else - QOpenGLConfig::Gpu qgpu; - qgpu.deviceId = gpu.deviceId; - qgpu.vendorId = gpu.vendorId; - qgpu.driverVersion = gpu.driverVersion; + QOpenGLConfig::Gpu qgpu = QOpenGLConfig::Gpu::fromDevice(gpu.deviceId, gpu.vendorId, gpu.driverVersion); SupportedRenderersCache *srCache = supportedRenderersCache(); SupportedRenderersCache::const_iterator it = srCache->find(qgpu); if (it != srCache->cend()) -- cgit v1.2.3 From be6b27aaa1ce2d9cdd93e005dafb62fa81c5cdc0 Mon Sep 17 00:00:00 2001 From: Christoph Schleifenbaum Date: Sun, 12 Apr 2015 17:59:19 +0200 Subject: Cocoa: Remove NSMenuItem setEnabled used in wrong way. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Whether menu items are enabled or not is not set via NSMenuItem's enabled property but depends on the return value of CocoaMenu's validateMenuItem. Change-Id: I5673da18ab9eb3510b773e0ab520e5382a160844 Task-number: QTBUG-42511 Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoamenuitem.mm | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoamenuitem.mm b/src/plugins/platforms/cocoa/qcocoamenuitem.mm index bf12c0f2ce..f288ab85c0 100644 --- a/src/plugins/platforms/cocoa/qcocoamenuitem.mm +++ b/src/plugins/platforms/cocoa/qcocoamenuitem.mm @@ -308,7 +308,6 @@ NSMenuItem *QCocoaMenuItem::sync() } [m_native setHidden: !m_isVisible]; - [m_native setEnabled: m_enabled]; [m_native setView:m_itemView]; QString text = mergeText(); @@ -410,7 +409,7 @@ void QCocoaMenuItem::syncModalState(bool modal) if (modal) [m_native setEnabled:NO]; else - [m_native setEnabled:m_enabled]; + [m_native setEnabled:YES]; } QPlatformMenuItem::MenuRole QCocoaMenuItem::effectiveRole() const -- cgit v1.2.3 From bf23091e6b29a5ca0875ca281ed346c8493b9396 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Thu, 26 Mar 2015 11:24:07 +0100 Subject: Cocoa integration - invalid window state MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit QCocoaWindow::syncWindowState incorrectly sets m_effectivelyMaximized as !m_effectivelyMaximized after calling zoom. But zoom can trigger windowDidEndLiveResize, which also can set m_effectivelyMaximized, so double negation results in ... the previous value. Fixed. Change-Id: Iea974132a1854a258e27635e8779d7d8c02bfc0c Reviewed-by: Morten Johan Sørvig --- src/plugins/platforms/cocoa/qcocoawindow.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index ec289aba99..8ee21b121b 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1510,10 +1510,11 @@ void QCocoaWindow::syncWindowState(Qt::WindowState newState) } } + const bool effMax = m_effectivelyMaximized; if ((m_synchedWindowState & Qt::WindowMaximized) != (newState & Qt::WindowMaximized) || (m_effectivelyMaximized && newState == Qt::WindowNoState)) { if ((m_synchedWindowState & Qt::WindowFullScreen) == (newState & Qt::WindowFullScreen)) { [m_nsWindow zoom : m_nsWindow]; // toggles - m_effectivelyMaximized = !m_effectivelyMaximized; + m_effectivelyMaximized = !effMax; } else if (!(newState & Qt::WindowMaximized)) { // it would be nice to change the target geometry that toggleFullScreen will animate toward // but there is no known way, so the maximized state is not possible at this time -- cgit v1.2.3 From 628fa13ea4d6ff0e2e2ee76c9adfc78676de3c59 Mon Sep 17 00:00:00 2001 From: Gatis Paeglis Date: Tue, 21 Apr 2015 16:11:20 +0200 Subject: Fix "Unsupported extension used" error MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This error message was a result of calling *_randr_* functions in QXcbWindow::updateGeometry without checking if the X server provides the XRandR extension. Change-Id: I165f201c32ca0f4976f9ff9b9f17323098940511 Task-number: QTBUG-45624 Task-number: QTBUG-45388 Task-number: QTBUG-45312 Reviewed-by: Laszlo Agocs Reviewed-by: Shawn Rutledge Reviewed-by: Jan Kundrát --- src/plugins/platforms/xcb/qxcbscreen.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/plugins/platforms') diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index bcaa13eb1e..a0d6d88d11 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -468,6 +468,9 @@ void QXcbScreen::handleScreenChange(xcb_randr_screen_change_notify_event_t *chan void QXcbScreen::updateGeometry(xcb_timestamp_t timestamp) { + if (!connection()->hasXRandr()) + return; + xcb_randr_get_crtc_info_cookie_t crtcCookie = xcb_randr_get_crtc_info_unchecked(xcb_connection(), m_crtc, timestamp); xcb_randr_get_crtc_info_reply_t *crtc = -- cgit v1.2.3