summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@qt.io>2018-05-03 14:26:01 +0200
committerLiang Qi <liang.qi@qt.io>2018-05-03 14:50:22 +0200
commit60fefff22f7fa259a8bdb023d1ec9a57cfd34bfb (patch)
treeab33ab6eeb08f7a72e0196ee5025790aaa01b1dd /src
parentb1e0a71997111fc296001bc94e0da8342cf0ac97 (diff)
parentda32360ffc3c7b677355c37ae54c89637c18047f (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Conflicts: examples/widgets/graphicsview/elasticnodes/graphwidget.cpp examples/widgets/graphicsview/elasticnodes/node.cpp examples/widgets/graphicsview/elasticnodes/node.h src/plugins/platforms/cocoa/qnsview.mm src/plugins/platforms/cocoa/qnsview_drawing.mm src/widgets/kernel/qmacgesturerecognizer_p.h Change-Id: I13cf06bac75d48d779d8ee7b5c91bfc976f2a32c
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qprocess_win.cpp7
-rw-r--r--src/gui/kernel/qinputdevicemanager.cpp23
-rw-r--r--src/gui/kernel/qinputdevicemanager_p.h2
-rw-r--r--src/platformheaders/eglfsfunctions/qeglfsfunctions.qdoc15
-rw-r--r--src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp3
-rw-r--r--src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp5
-rw-r--r--src/platformsupport/input/libinput/qlibinputkeyboard.cpp24
-rw-r--r--src/platformsupport/input/libinput/qlibinputkeyboard_p.h1
-rw-r--r--src/platformsupport/input/libinput/qlibinputpointer.cpp2
-rw-r--r--src/plugins/platforms/cocoa/qcocoahelpers.mm10
-rw-r--r--src/plugins/platforms/cocoa/qcocoawindow.mm6
-rw-r--r--src/plugins/platforms/cocoa/qnsview_drawing.mm2
-rw-r--r--src/plugins/platforms/cocoa/qprintengine_mac.mm14
-rw-r--r--src/plugins/platforms/eglfs/deviceintegration/eglfs_rcar/qeglfsrcarintegration.cpp26
-rw-r--r--src/plugins/platforms/qnx/qqnxnativeinterface.cpp3
-rw-r--r--src/plugins/platforms/qnx/qqnxrasterwindow.cpp2
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp26
-rw-r--r--src/plugins/platforms/qnx/qqnxscreeneventhandler.h1
-rw-r--r--src/plugins/platforms/xcb/qxcbscreen.cpp7
-rw-r--r--src/plugins/printsupport/cups/qcupsprintengine.cpp5
-rw-r--r--src/printsupport/kernel/qprintengine_win.cpp5
-rw-r--r--src/testlib/qtestsystem.h18
-rw-r--r--src/widgets/kernel/qmacgesturerecognizer.cpp15
-rw-r--r--src/widgets/kernel/qmacgesturerecognizer_p.h22
24 files changed, 160 insertions, 84 deletions
diff --git a/src/corelib/io/qprocess_win.cpp b/src/corelib/io/qprocess_win.cpp
index 3a62a67e3b..b1ec2c560c 100644
--- a/src/corelib/io/qprocess_win.cpp
+++ b/src/corelib/io/qprocess_win.cpp
@@ -499,8 +499,13 @@ void QProcessPrivate::startProcess()
if (!openChannel(stdinChannel) ||
!openChannel(stdoutChannel) ||
- !openChannel(stderrChannel))
+ !openChannel(stderrChannel)) {
+ QString errorString = QProcess::tr("Process failed to start: %1").arg(qt_error_string());
+ cleanup();
+ setErrorAndEmit(QProcess::FailedToStart, errorString);
+ q->setProcessState(QProcess::NotRunning);
return;
+ }
const QString args = qt_create_commandline(program, arguments, nativeArguments);
QByteArray envlist;
diff --git a/src/gui/kernel/qinputdevicemanager.cpp b/src/gui/kernel/qinputdevicemanager.cpp
index 37b1450d5a..6e4e5a9c93 100644
--- a/src/gui/kernel/qinputdevicemanager.cpp
+++ b/src/gui/kernel/qinputdevicemanager.cpp
@@ -109,30 +109,9 @@ Qt::KeyboardModifiers QInputDeviceManager::keyboardModifiers() const
return d->keyboardModifiers;
}
-void QInputDeviceManager::setKeyboardModifiers(Qt::KeyboardModifiers modsBeforeEvent, int key)
+void QInputDeviceManager::setKeyboardModifiers(Qt::KeyboardModifiers mods)
{
Q_D(QInputDeviceManager);
- Qt::KeyboardModifiers mods;
- switch (key) {
- case Qt::Key_Shift:
- mods = Qt::KeyboardModifiers(modsBeforeEvent ^ Qt::ShiftModifier);
- break;
- case Qt::Key_Control:
- mods = Qt::KeyboardModifiers(modsBeforeEvent ^ Qt::ControlModifier);
- break;
- case Qt::Key_Alt:
- mods = Qt::KeyboardModifiers(modsBeforeEvent ^ Qt::AltModifier);
- break;
- case Qt::Key_Meta:
- mods = Qt::KeyboardModifiers(modsBeforeEvent ^ Qt::MetaModifier);
- break;
- case Qt::Key_AltGr:
- mods = Qt::KeyboardModifiers(modsBeforeEvent ^ Qt::GroupSwitchModifier);
- break;
- default:
- mods = modsBeforeEvent;
- break;
- }
d->keyboardModifiers = mods;
}
diff --git a/src/gui/kernel/qinputdevicemanager_p.h b/src/gui/kernel/qinputdevicemanager_p.h
index ddf1e6befa..d73c5526d0 100644
--- a/src/gui/kernel/qinputdevicemanager_p.h
+++ b/src/gui/kernel/qinputdevicemanager_p.h
@@ -79,7 +79,7 @@ public:
void setCursorPos(const QPoint &pos);
Qt::KeyboardModifiers keyboardModifiers() const;
- void setKeyboardModifiers(Qt::KeyboardModifiers modsBeforeEvent, int key);
+ void setKeyboardModifiers(Qt::KeyboardModifiers mods);
signals:
void deviceListChanged(QInputDeviceManager::DeviceType type);
diff --git a/src/platformheaders/eglfsfunctions/qeglfsfunctions.qdoc b/src/platformheaders/eglfsfunctions/qeglfsfunctions.qdoc
index fc392ac369..0bee9190cf 100644
--- a/src/platformheaders/eglfsfunctions/qeglfsfunctions.qdoc
+++ b/src/platformheaders/eglfsfunctions/qeglfsfunctions.qdoc
@@ -91,6 +91,12 @@
*/
/*!
+ \fn bool QEglFSFunctions::vsp2SetLayerAlpha(const QScreen *screen, int id, qreal alpha)
+ \internal
+ \preliminary
+*/
+
+/*!
\fn void QEglFSFunctions::vsp2AddBlendListener(const QScreen *screen, void(*callback)())
\internal
\preliminary
@@ -121,6 +127,11 @@
\internal
*/
+/*!
+ \typedef QEglFSFunctions::Vsp2SetLayerAlphaType
+ \internal
+*/
+
/*! \fn QByteArray QEglFSFunctions::vsp2AddBlendListenerTypeIdentifier()
\internal
*/
@@ -140,3 +151,7 @@
/*! \fn QByteArray QEglFSFunctions::vsp2SetLayerPositionTypeIdentifier()
\internal
*/
+
+/*! \fn QByteArray QEglFSFunctions::vsp2SetLayerAlphaTypeIdentifier()
+ \internal
+ */
diff --git a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
index 47a65eded8..b21d5d9ef5 100644
--- a/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
+++ b/src/platformsupport/input/evdevkeyboard/qevdevkeyboardhandler.cpp
@@ -225,7 +225,8 @@ void QEvdevKeyboardHandler::readKeycode()
void QEvdevKeyboardHandler::processKeyEvent(int nativecode, int unicode, int qtcode,
Qt::KeyboardModifiers modifiers, bool isPress, bool autoRepeat)
{
- QGuiApplicationPrivate::inputDeviceManager()->setKeyboardModifiers(modifiers, qtcode);
+ if (!autoRepeat)
+ QGuiApplicationPrivate::inputDeviceManager()->setKeyboardModifiers(QEvdevKeyboardHandler::toQtModifiers(m_modifiers));
QWindowSystemInterface::handleExtendedKeyEvent(0, (isPress ? QEvent::KeyPress : QEvent::KeyRelease),
qtcode, modifiers, nativecode + 8, 0, int(modifiers),
diff --git a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
index 5264736dd6..ae81bca00f 100644
--- a/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
+++ b/src/platformsupport/input/evdevmouse/qevdevmousemanager.cpp
@@ -148,14 +148,13 @@ void QEvdevMouseManager::handleMouseEvent(int x, int y, bool abs, Qt::MouseButto
QPoint pos(m_x + m_xoffset, m_y + m_yoffset);
// Cannot track the keyboard modifiers ourselves here. Instead, report the
// modifiers from the last key event that has been seen by QGuiApplication.
- Qt::KeyboardModifiers mods = QGuiApplication::keyboardModifiers();
- QWindowSystemInterface::handleMouseEvent(0, pos, pos, buttons, button, type, mods);
+ QWindowSystemInterface::handleMouseEvent(0, pos, pos, buttons, button, type, QGuiApplicationPrivate::inputDeviceManager()->keyboardModifiers());
}
void QEvdevMouseManager::handleWheelEvent(QPoint delta)
{
QPoint pos(m_x + m_xoffset, m_y + m_yoffset);
- QWindowSystemInterface::handleWheelEvent(0, pos, pos, QPoint(), delta, QGuiApplication::keyboardModifiers());
+ QWindowSystemInterface::handleWheelEvent(0, pos, pos, QPoint(), delta, QGuiApplicationPrivate::inputDeviceManager()->keyboardModifiers());
}
void QEvdevMouseManager::addMouse(const QString &deviceNode)
diff --git a/src/platformsupport/input/libinput/qlibinputkeyboard.cpp b/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
index ec01f95947..5152725468 100644
--- a/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
+++ b/src/platformsupport/input/libinput/qlibinputkeyboard.cpp
@@ -135,7 +135,8 @@ QLibInputKeyboard::QLibInputKeyboard()
#ifndef QT_NO_XKBCOMMON_EVDEV
: m_ctx(0),
m_keymap(0),
- m_state(0)
+ m_state(0),
+ m_mods(Qt::NoModifier)
#endif
{
#ifndef QT_NO_XKBCOMMON_EVDEV
@@ -203,22 +204,27 @@ void QLibInputKeyboard::processKey(libinput_event_keyboard *e)
Qt::KeyboardModifiers mods = Qt::NoModifier;
const int qtkey = keysymToQtKey(sym, &mods, text);
- xkb_state_component modtype = xkb_state_component(XKB_STATE_MODS_DEPRESSED | XKB_STATE_MODS_LATCHED);
- if (xkb_state_mod_index_is_active(m_state, m_modindex[0], modtype) && (qtkey != Qt::Key_Control || !pressed))
+ if (qtkey == Qt::Key_Control)
mods |= Qt::ControlModifier;
- if (xkb_state_mod_index_is_active(m_state, m_modindex[1], modtype) && (qtkey != Qt::Key_Alt || !pressed))
+ if (qtkey == Qt::Key_Alt)
mods |= Qt::AltModifier;
- if (xkb_state_mod_index_is_active(m_state, m_modindex[2], modtype) && (qtkey != Qt::Key_Shift || !pressed))
+ if (qtkey == Qt::Key_Shift)
mods |= Qt::ShiftModifier;
- if (xkb_state_mod_index_is_active(m_state, m_modindex[3], modtype) && (qtkey != Qt::Key_Meta || !pressed))
+ if (qtkey == Qt::Key_Meta)
mods |= Qt::MetaModifier;
-
xkb_state_update_key(m_state, k, pressed ? XKB_KEY_DOWN : XKB_KEY_UP);
- QGuiApplicationPrivate::inputDeviceManager()->setKeyboardModifiers(mods, qtkey);
+ if (mods != Qt::NoModifier) {
+ if (pressed)
+ m_mods |= mods;
+ else
+ m_mods &= ~mods;
+
+ QGuiApplicationPrivate::inputDeviceManager()->setKeyboardModifiers(m_mods);
+ }
QWindowSystemInterface::handleExtendedKeyEvent(nullptr,
pressed ? QEvent::KeyPress : QEvent::KeyRelease,
- qtkey, mods, k, sym, mods, text);
+ qtkey, m_mods, k, sym, m_mods, text);
if (pressed && xkb_keymap_key_repeats(m_keymap, k)) {
m_repeatData.qtkey = qtkey;
diff --git a/src/platformsupport/input/libinput/qlibinputkeyboard_p.h b/src/platformsupport/input/libinput/qlibinputkeyboard_p.h
index b7ee8a363f..9e09bccd79 100644
--- a/src/platformsupport/input/libinput/qlibinputkeyboard_p.h
+++ b/src/platformsupport/input/libinput/qlibinputkeyboard_p.h
@@ -93,6 +93,7 @@ private:
QString unicodeText;
int repeatCount;
} m_repeatData;
+ Qt::KeyboardModifiers m_mods;
#endif
};
diff --git a/src/platformsupport/input/libinput/qlibinputpointer.cpp b/src/platformsupport/input/libinput/qlibinputpointer.cpp
index cb08ab53b2..c54b61fc66 100644
--- a/src/platformsupport/input/libinput/qlibinputpointer.cpp
+++ b/src/platformsupport/input/libinput/qlibinputpointer.cpp
@@ -125,7 +125,7 @@ void QLibInputPointer::processAxis(libinput_event_pointer *e)
#endif
const int factor = 8;
angleDelta *= -factor;
- Qt::KeyboardModifiers mods = QGuiApplication::keyboardModifiers();
+ Qt::KeyboardModifiers mods = QGuiApplicationPrivate::inputDeviceManager()->keyboardModifiers();
QWindowSystemInterface::handleWheelEvent(nullptr, m_pos, m_pos, QPoint(), angleDelta, mods);
}
diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm
index ee1b79b4cd..a1cf1bc632 100644
--- a/src/plugins/platforms/cocoa/qcocoahelpers.mm
+++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm
@@ -261,6 +261,16 @@ QRectF qt_mac_flip(const QRectF &rect, const QRectF &reference)
// -------------------------------------------------------------------------
+/*!
+ \fn Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum)
+
+ Returns the Qt::Button that corresponds to an NSEvent.buttonNumber.
+
+ \note AppKit will use buttonNumber 0 to indicate both "left button"
+ and "no button". Only NSEvents that describes mouse press/release
+ events (e.g NSEventTypeOtherMouseDown) will contain a valid
+ button number.
+*/
Qt::MouseButton cocoaButton2QtButton(NSInteger buttonNum)
{
if (buttonNum >= 0 && buttonNum <= 31)
diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm
index 20358e7269..7e7740527f 100644
--- a/src/plugins/platforms/cocoa/qcocoawindow.mm
+++ b/src/plugins/platforms/cocoa/qcocoawindow.mm
@@ -394,10 +394,10 @@ void QCocoaWindow::setVisible(bool visible)
removeMonitor();
monitor = [NSEvent addGlobalMonitorForEventsMatchingMask:NSLeftMouseDownMask|NSRightMouseDownMask|NSOtherMouseDownMask|NSMouseMovedMask handler:^(NSEvent *e) {
QPointF localPoint = QCocoaScreen::mapFromNative([NSEvent mouseLocation]);
- const auto eventType = e.type == NSMouseMoved ? QEvent::MouseMove : QEvent::MouseButtonPress;
+ const auto button = e.type == NSEventTypeMouseMoved ? Qt::NoButton : cocoaButton2QtButton([e buttonNumber]);
+ const auto eventType = e.type == NSEventTypeMouseMoved ? QEvent::MouseMove : QEvent::MouseButtonPress;
QWindowSystemInterface::handleMouseEvent(window(), window()->mapFromGlobal(localPoint.toPoint()), localPoint,
- Qt::MouseButtons(uint(NSEvent.pressedMouseButtons & 0xFFFF)),
- cocoaButton2QtButton(e.buttonNumber), eventType);
+ Qt::MouseButtons(uint(NSEvent.pressedMouseButtons & 0xFFFF)), button, eventType);
}];
}
}
diff --git a/src/plugins/platforms/cocoa/qnsview_drawing.mm b/src/plugins/platforms/cocoa/qnsview_drawing.mm
index fc5f806cb6..3bba68b0cf 100644
--- a/src/plugins/platforms/cocoa/qnsview_drawing.mm
+++ b/src/plugins/platforms/cocoa/qnsview_drawing.mm
@@ -123,7 +123,7 @@
m_platformWindow->handleExposeEvent(dirtyRegion);
}
- if (m_platformWindow->hasPendingUpdateRequest()) {
+ if (m_updateRequested && m_platformWindow->hasPendingUpdateRequest()) {
// A call to QWindow::requestUpdate was issued during event delivery above,
// but AppKit will reset the needsDisplay state of the view after completing
// the current display cycle, so we need to defer the request to redisplay.
diff --git a/src/plugins/platforms/cocoa/qprintengine_mac.mm b/src/plugins/platforms/cocoa/qprintengine_mac.mm
index d34d7ddb0d..f2f29b26ee 100644
--- a/src/plugins/platforms/cocoa/qprintengine_mac.mm
+++ b/src/plugins/platforms/cocoa/qprintengine_mac.mm
@@ -574,6 +574,11 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
d->setPageSize(QPageSize(QPageSize::id(value.toInt())));
break;
case PPK_PrinterName: {
+ QVariant pageSize = QVariant::fromValue(d->m_pageLayout.pageSize());
+ const bool isFullPage = d->m_pageLayout.mode() == QPageLayout::FullPageMode;
+ QVariant orientation = QVariant::fromValue(d->m_pageLayout.orientation());
+ QVariant margins = QVariant::fromValue(QPair<QMarginsF, QPageLayout::Unit>(d->m_pageLayout.margins(),
+ d->m_pageLayout.units()));
QString id = value.toString();
if (id.isEmpty())
id = QCocoaPrinterSupport().defaultPrintDeviceId();
@@ -583,7 +588,14 @@ void QMacPrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &va
PMPrinter printer = d->m_printDevice->macPrinter();
PMRetain(printer);
PMSessionSetCurrentPMPrinter(d->session(), printer);
- // TODO Do we need to check if the page size, etc, are valid on new printer?
+ // Ensure the settings are up to date and valid
+ if (d->m_printDevice->supportedPageSize(pageSize.value<QPageSize>()).isValid())
+ setProperty(PPK_QPageSize, pageSize);
+ else
+ setProperty(PPK_CustomPaperSize, pageSize.value<QPageSize>().size(QPageSize::Point));
+ setProperty(PPK_FullPage, QVariant(isFullPage));
+ setProperty(PPK_Orientation, orientation);
+ setProperty(PPK_QPageMargins, margins);
break;
}
case PPK_CustomPaperSize:
diff --git a/src/plugins/platforms/eglfs/deviceintegration/eglfs_rcar/qeglfsrcarintegration.cpp b/src/plugins/platforms/eglfs/deviceintegration/eglfs_rcar/qeglfsrcarintegration.cpp
index 98cf1d3bfb..212ebde05a 100644
--- a/src/plugins/platforms/eglfs/deviceintegration/eglfs_rcar/qeglfsrcarintegration.cpp
+++ b/src/plugins/platforms/eglfs/deviceintegration/eglfs_rcar/qeglfsrcarintegration.cpp
@@ -52,12 +52,28 @@ QT_BEGIN_NAMESPACE
void QEglFSRcarIntegration::platformInit()
{
+ bool ok;
+
QEglFSDeviceIntegration::platformInit();
PVRGrfxServerInit();
mScreenSize = q_screenSizeFromFb(0);
mNativeDisplay = (NativeDisplayType)EGL_DEFAULT_DISPLAY;
+
+ mNativeDisplayID = qEnvironmentVariableIntValue("QT_QPA_WM_DISP_ID", &ok);
+ if (!ok)
+ mNativeDisplayID = RCAR_DEFAULT_DISPLAY;
+
+ r_wm_Error_t wm_err = R_WM_DevInit(mNativeDisplayID);
+ if (wm_err != R_WM_ERR_OK)
+ qFatal("Failed to init WM Dev: %d, error: %d", mNativeDisplayID, wm_err);
+ wm_err = R_WM_ScreenBgColorSet(mNativeDisplayID, 0x20, 0x20, 0x20); // Grey
+ if (wm_err != R_WM_ERR_OK)
+ qFatal("Failed to set screen background: %d", wm_err);
+ wm_err = R_WM_ScreenEnable(mNativeDisplayID);
+ if (wm_err != R_WM_ERR_OK)
+ qFatal("Failed to enable screen: %d", wm_err);
}
QSize QEglFSRcarIntegration::screenSize() const
@@ -104,14 +120,6 @@ EGLNativeWindowType QEglFSRcarIntegration::createNativeWindow(QPlatformWindow *w
{
bool ok;
- mNativeDisplayID = qEnvironmentVariableIntValue("QT_QPA_WM_DISP_ID", &ok);
- if (!ok)
- mNativeDisplayID = RCAR_DEFAULT_DISPLAY;
-
- r_wm_Error_t wm_err = R_WM_DevInit(mNativeDisplayID);
- if (wm_err != R_WM_ERR_OK)
- qFatal("Failed to init WM Dev: %d, error: %d", mNativeDisplayID, wm_err);
-
mNativeWindow = (EGLNativeWindowTypeREL*)malloc(sizeof(EGLNativeWindowTypeREL));
memset(mNativeWindow, 0, sizeof(EGLNativeWindowTypeREL));
@@ -134,7 +142,7 @@ EGLNativeWindowType QEglFSRcarIntegration::createNativeWindow(QPlatformWindow *w
mNativeWindow->Surface.Type = R_WM_SURFACE_FB;
mNativeWindow->Surface.BufMode = R_WM_WINBUF_ALLOC_INTERNAL;
- wm_err = R_WM_WindowCreate(mNativeDisplayID, mNativeWindow);
+ r_wm_Error_t wm_err = R_WM_WindowCreate(mNativeDisplayID, mNativeWindow);
if (wm_err != R_WM_ERR_OK)
qFatal("Failed to create window layer: %d", wm_err);
wm_err = R_WM_DevEventRegister(mNativeDisplayID, R_WM_EVENT_VBLANK, 0);
diff --git a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp
index 3eebb9c742..3bd6a86b59 100644
--- a/src/plugins/platforms/qnx/qqnxnativeinterface.cpp
+++ b/src/plugins/platforms/qnx/qqnxnativeinterface.cpp
@@ -91,6 +91,9 @@ void *QQnxNativeInterface::nativeResourceForScreen(const QByteArray &resource, Q
void *QQnxNativeInterface::nativeResourceForIntegration(const QByteArray &resource)
{
+ if (resource == "screenContext")
+ return m_integration->screenContext();
+
return 0;
}
diff --git a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp
index dc844189d1..0014ef8c6e 100644
--- a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp
+++ b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp
@@ -158,7 +158,7 @@ QQnxBuffer &QQnxRasterWindow::renderBuffer()
"Failed to clear window buffer");
}
- Q_SCREEN_CHECKERROR(screen_flush_blits(platformScreen->nativeContext(), 0),
+ Q_SCREEN_CHECKERROR(screen_flush_blits(platformScreen->nativeContext(), SCREEN_WAIT_IDLE),
"Failed to flush blits");
// Use the first available render buffer
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
index 5d230e2145..f211883e4f 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
+++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp
@@ -591,6 +591,10 @@ void QQnxScreenEventHandler::handlePropertyEvent(screen_event_t event)
case SCREEN_PROPERTY_FOCUS:
handleKeyboardFocusPropertyEvent(window);
break;
+ case SCREEN_PROPERTY_SIZE:
+ case SCREEN_PROPERTY_POSITION:
+ handleGeometryPropertyEvent(window);
+ break;
default:
// event ignored
qScreenEventDebug() << "Ignore property event for property: " << property;
@@ -617,6 +621,28 @@ void QQnxScreenEventHandler::handleKeyboardFocusPropertyEvent(screen_window_t wi
m_focusLostTimer = startTimer(50);
}
+void QQnxScreenEventHandler::handleGeometryPropertyEvent(screen_window_t window)
+{
+ int pos[2];
+ if (screen_get_window_property_iv(window, SCREEN_PROPERTY_POSITION, pos) != 0) {
+ qFatal("QQnx: failed to query window property, errno=%d", errno);
+ }
+
+ int size[2];
+ if (screen_get_window_property_iv(window, SCREEN_PROPERTY_SIZE, size) != 0) {
+ qFatal("QQnx: failed to query window property, errno=%d", errno);
+ }
+
+ QRect rect(pos[0], pos[1], size[0], size[1]);
+ QWindow *qtWindow = QQnxIntegration::window(window);
+ if (qtWindow) {
+ qtWindow->setGeometry(rect);
+ QWindowSystemInterface::handleGeometryChange(qtWindow, rect);
+ }
+
+ qScreenEventDebug() << qtWindow << "moved to" << rect;
+}
+
void QQnxScreenEventHandler::timerEvent(QTimerEvent *event)
{
if (event->timerId() == m_focusLostTimer) {
diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h
index d872f9b9aa..40697b7a09 100644
--- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.h
+++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.h
@@ -85,6 +85,7 @@ private:
void handleDisplayEvent(screen_event_t event);
void handlePropertyEvent(screen_event_t event);
void handleKeyboardFocusPropertyEvent(screen_window_t window);
+ void handleGeometryPropertyEvent(screen_window_t window);
private:
enum {
diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp
index df458e85d7..e1bd8eb752 100644
--- a/src/plugins/platforms/xcb/qxcbscreen.cpp
+++ b/src/plugins/platforms/xcb/qxcbscreen.cpp
@@ -750,7 +750,12 @@ void QXcbScreen::updateGeometry(const QRect &geometry, uint8_t rotation)
m_sizeMillimeters = sizeInMillimeters(geometry.size(), virtualDpi());
qreal dpi = geometry.width() / physicalSize().width() * qreal(25.4);
- m_pixelDensity = qMax(1, qRound(dpi/96));
+ qreal rawFactor = dpi/96;
+ int roundedFactor = qFloor(rawFactor);
+ // Round up for .8 and higher. This favors "small UI" over "large UI".
+ if (rawFactor - roundedFactor >= 0.8)
+ roundedFactor = qCeil(rawFactor);
+ m_pixelDensity = qMax(1, roundedFactor);
m_geometry = geometry;
m_availableGeometry = geometry & m_virtualDesktop->workArea();
QWindowSystemInterface::handleScreenGeometryChange(QPlatformScreen::screen(), m_geometry, m_availableGeometry);
diff --git a/src/plugins/printsupport/cups/qcupsprintengine.cpp b/src/plugins/printsupport/cups/qcupsprintengine.cpp
index f204e3b0da..c9683eb99d 100644
--- a/src/plugins/printsupport/cups/qcupsprintengine.cpp
+++ b/src/plugins/printsupport/cups/qcupsprintengine.cpp
@@ -285,7 +285,10 @@ void QCupsPrintEnginePrivate::changePrinter(const QString &newPrinter)
grayscale = m_printDevice.defaultColorMode() == QPrint::GrayScale;
// Get the equivalent page size for this printer as supported names may be different
- setPageSize(m_pageLayout.pageSize());
+ if (m_printDevice.supportedPageSize(m_pageLayout.pageSize()).isValid())
+ setPageSize(m_pageLayout.pageSize());
+ else
+ setPageSize(QPageSize(m_pageLayout.pageSize().size(QPageSize::Point), QPageSize::Point));
}
void QCupsPrintEnginePrivate::setPageSize(const QPageSize &pageSize)
diff --git a/src/printsupport/kernel/qprintengine_win.cpp b/src/printsupport/kernel/qprintengine_win.cpp
index a943d24cb1..ca4d1d0bd6 100644
--- a/src/printsupport/kernel/qprintengine_win.cpp
+++ b/src/printsupport/kernel/qprintengine_win.cpp
@@ -1234,7 +1234,10 @@ void QWin32PrintEngine::setProperty(PrintEnginePropertyKey key, const QVariant &
if (printDevice.isValid()) {
d->m_printDevice = printDevice;
d->initialize();
- setProperty(PPK_QPageSize, pageSize);
+ if (d->m_printDevice.supportedPageSize(pageSize.value<QPageSize>()).isValid())
+ setProperty(PPK_QPageSize, pageSize);
+ else
+ setProperty(PPK_CustomPaperSize, pageSize.value<QPageSize>().size(QPageSize::Point));
setProperty(PPK_FullPage, QVariant(isFullPage));
setProperty(PPK_Orientation, orientation);
setProperty(PPK_QPageMargins, margins);
diff --git a/src/testlib/qtestsystem.h b/src/testlib/qtestsystem.h
index de6bd177d3..df62b392d4 100644
--- a/src/testlib/qtestsystem.h
+++ b/src/testlib/qtestsystem.h
@@ -110,23 +110,7 @@ namespace QTest
#ifdef QT_GUI_LIB
Q_REQUIRED_RESULT inline static bool qWaitForWindowActive(QWindow *window, int timeout = 5000)
{
- bool becameActive = qWaitFor([&]() { return window->isActive(); }, timeout);
-
- // Try ensuring the platform window receives the real position.
- // (i.e. that window->pos() reflects reality)
- // isActive() ( == FocusIn in case of X) does not guarantee this. It seems some WMs randomly
- // send the final ConfigureNotify (the one with the non-bogus 0,0 position) after the FocusIn.
- // If we just let things go, every mapTo/FromGlobal call the tests perform directly after
- // qWaitForWindowShown() will generate bogus results.
- if (becameActive) {
- int waitNo = 0; // 0, 0 might be a valid position after all, so do not wait for ever
- while (window->position().isNull()) {
- if (waitNo++ > timeout / 10)
- break;
- qWait(10);
- }
- }
- return window->isActive();
+ return qWaitFor([&]() { return window->isActive(); }, timeout);
}
Q_REQUIRED_RESULT inline static bool qWaitForWindowExposed(QWindow *window, int timeout = 5000)
diff --git a/src/widgets/kernel/qmacgesturerecognizer.cpp b/src/widgets/kernel/qmacgesturerecognizer.cpp
index 6dedd3c2d0..d39b93e320 100644
--- a/src/widgets/kernel/qmacgesturerecognizer.cpp
+++ b/src/widgets/kernel/qmacgesturerecognizer.cpp
@@ -43,6 +43,7 @@
#include "qevent.h"
#include "qwidget.h"
#include "qdebug.h"
+#include <QtCore/qcoreapplication.h>
#ifndef QT_NO_GESTURES
@@ -181,6 +182,16 @@ QGesture *QMacPanGestureRecognizer::create(QObject *target)
return 0;
}
+void QMacPanGestureRecognizer::timerEvent(QTimerEvent *ev)
+{
+ if (ev->timerId() == _panTimer.timerId()) {
+ if (_panTimer.isActive())
+ _panTimer.stop();
+ if (_target)
+ QCoreApplication::sendEvent(_target, ev);
+ }
+}
+
QGestureRecognizer::Result
QMacPanGestureRecognizer::recognize(QGesture *gesture, QObject *target, QEvent *event)
{
@@ -195,7 +206,8 @@ QMacPanGestureRecognizer::recognize(QGesture *gesture, QObject *target, QEvent *
if (ev->touchPoints().size() == 1) {
reset(gesture);
_startPos = QCursor::pos();
- _panTimer.start(panBeginDelay, target);
+ _target = target;
+ _panTimer.start(panBeginDelay, this);
_panCanceled = false;
return QGestureRecognizer::MayBeGesture;
}
@@ -242,7 +254,6 @@ QMacPanGestureRecognizer::recognize(QGesture *gesture, QObject *target, QEvent *
case QEvent::Timer: {
QTimerEvent *ev = static_cast<QTimerEvent *>(event);
if (ev->timerId() == _panTimer.timerId()) {
- _panTimer.stop();
if (_panCanceled)
break;
// Begin new pan session!
diff --git a/src/widgets/kernel/qmacgesturerecognizer_p.h b/src/widgets/kernel/qmacgesturerecognizer_p.h
index be3f3266ac..739fc201b7 100644
--- a/src/widgets/kernel/qmacgesturerecognizer_p.h
+++ b/src/widgets/kernel/qmacgesturerecognizer_p.h
@@ -55,6 +55,7 @@
#include "qtimer.h"
#include "qpoint.h"
#include "qgesturerecognizer.h"
+#include <QtCore/qpointer.h>
#ifndef QT_NO_GESTURES
@@ -65,9 +66,9 @@ class QMacSwipeGestureRecognizer : public QGestureRecognizer
public:
QMacSwipeGestureRecognizer();
- QGesture *create(QObject *target);
- QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event);
- void reset(QGesture *gesture);
+ QGesture *create(QObject *target) override;
+ QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event) override;
+ void reset(QGesture *gesture) override;
};
class QMacPinchGestureRecognizer : public QGestureRecognizer
@@ -75,9 +76,9 @@ class QMacPinchGestureRecognizer : public QGestureRecognizer
public:
QMacPinchGestureRecognizer();
- QGesture *create(QObject *target);
- QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event);
- void reset(QGesture *gesture);
+ QGesture *create(QObject *target) override;
+ QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event) override;
+ void reset(QGesture *gesture) override;
};
class QMacPanGestureRecognizer : public QObject, public QGestureRecognizer
@@ -85,13 +86,16 @@ class QMacPanGestureRecognizer : public QObject, public QGestureRecognizer
public:
QMacPanGestureRecognizer();
- QGesture *create(QObject *target);
- QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event);
- void reset(QGesture *gesture);
+ QGesture *create(QObject *target) override;
+ QGestureRecognizer::Result recognize(QGesture *gesture, QObject *watched, QEvent *event) override;
+ void reset(QGesture *gesture) override;
+protected:
+ void timerEvent(QTimerEvent *ev) override;
private:
QPointF _startPos;
QBasicTimer _panTimer;
bool _panCanceled;
+ QPointer<QObject> _target;
};
QT_END_NAMESPACE