diff options
Diffstat (limited to 'src/plugins/platforms')
75 files changed, 293 insertions, 1892 deletions
diff --git a/src/plugins/platforms/android/qandroidinputcontext.cpp b/src/plugins/platforms/android/qandroidinputcontext.cpp index dc420775cf..125a03469f 100644 --- a/src/plugins/platforms/android/qandroidinputcontext.cpp +++ b/src/plugins/platforms/android/qandroidinputcontext.cpp @@ -645,7 +645,7 @@ jboolean QAndroidInputContext::commitText(const QString &text, jint newCursorPos : localPos - text.length() + newCursorPosition; //move the cursor attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, - newLocalPos, 0, QVariant())); + newLocalPos, 0)); } } m_blockUpdateSelection = updateSelectionWasBlocked; @@ -691,7 +691,7 @@ jboolean QAndroidInputContext::finishComposingText() // Moving Qt's cursor to where the preedit cursor used to be QList<QInputMethodEvent::Attribute> attributes; - attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, localCursorPos, 0, QVariant())); + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, localCursorPos, 0)); QInputMethodEvent event(QString(), attributes); event.setCommitString(m_composingText); @@ -848,8 +848,7 @@ jboolean QAndroidInputContext::setComposingText(const QString &text, jint newCur QList<QInputMethodEvent::Attribute> attributes; attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, newCursorPosition, - 1, - QVariant())); + 1)); // Show compose text underlined QTextCharFormat underlined; underlined.setFontUnderline(true); @@ -921,7 +920,7 @@ jboolean QAndroidInputContext::setComposingRegion(jint start, jint end) QVariant(underlined))); // Keep the cursor position unchanged (don't move to end of preedit) - attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, currentCursor - start, 1, QVariant())); + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, currentCursor - start, 1)); QInputMethodEvent event(m_composingText, attributes); event.setCommitString(QString(), relativeStart, length); @@ -955,7 +954,7 @@ jboolean QAndroidInputContext::setSelection(jint start, jint end) // preedit cursor int localOldPos = query->value(Qt::ImCursorPosition).toInt(); int pos = localCursorPos - localOldPos; - attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, pos, 1, QVariant())); + attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Cursor, pos, 1)); //but we have to tell Qt about the compose text all over again @@ -970,8 +969,7 @@ jboolean QAndroidInputContext::setSelection(jint start, jint end) // actually changing the selection attributes.append(QInputMethodEvent::Attribute(QInputMethodEvent::Selection, localCursorPos, - end - start, - QVariant())); + end - start)); } QInputMethodEvent event(m_composingText, attributes); sendInputMethodEventThreadSafe(&event); diff --git a/src/plugins/platforms/android/qandroidplatformintegration.cpp b/src/plugins/platforms/android/qandroidplatformintegration.cpp index 80d7e31aa3..e10bd95e12 100644 --- a/src/plugins/platforms/android/qandroidplatformintegration.cpp +++ b/src/plugins/platforms/android/qandroidplatformintegration.cpp @@ -80,6 +80,8 @@ Qt::ScreenOrientation QAndroidPlatformIntegration::m_nativeOrientation = Qt::Pri Qt::ApplicationState QAndroidPlatformIntegration::m_defaultApplicationState = Qt::ApplicationActive; +bool QAndroidPlatformIntegration::m_showPasswordEnabled = false; + void *QAndroidPlatformNativeInterface::nativeResourceForIntegration(const QByteArray &resource) { if (resource=="JavaVM") @@ -191,6 +193,19 @@ QAndroidPlatformIntegration::QAndroidPlatformIntegration(const QStringList ¶ } QWindowSystemInterface::registerTouchDevice(m_touchDevice); } + + auto contentResolver = javaActivity.callObjectMethod("getContentResolver", "()Landroid/content/ContentResolver;"); + Q_ASSERT(contentResolver.isValid()); + QJNIObjectPrivate txtShowPassValue = QJNIObjectPrivate::callStaticObjectMethod("android/provider/Settings$System", + "getString", + "(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;", + contentResolver.object(), + QJNIObjectPrivate::getStaticObjectField("android/provider/Settings$System", "TEXT_SHOW_PASSWORD", "Ljava/lang/String;").object()); + if (txtShowPassValue.isValid()) { + bool ok = false; + const int txtShowPass = txtShowPassValue.toString().toInt(&ok); + m_showPasswordEnabled = ok ? (txtShowPass == 1) : false; + } } QGuiApplicationPrivate::instance()->setApplicationState(m_defaultApplicationState); @@ -313,6 +328,9 @@ QPlatformServices *QAndroidPlatformIntegration::services() const QVariant QAndroidPlatformIntegration::styleHint(StyleHint hint) const { switch (hint) { + case PasswordMaskDelay: + // this number is from a hard-coded value in Android code (cf. PasswordTransformationMethod) + return m_showPasswordEnabled ? 1500 : 0; case ShowIsMaximized: return true; default: diff --git a/src/plugins/platforms/android/qandroidplatformintegration.h b/src/plugins/platforms/android/qandroidplatformintegration.h index 1f06c23d0b..bda0bee9ad 100644 --- a/src/plugins/platforms/android/qandroidplatformintegration.h +++ b/src/plugins/platforms/android/qandroidplatformintegration.h @@ -143,6 +143,8 @@ private: static Qt::ApplicationState m_defaultApplicationState; + static bool m_showPasswordEnabled; + QPlatformFontDatabase *m_androidFDB; QAndroidPlatformNativeInterface *m_androidPlatformNativeInterface; QAndroidPlatformServices *m_androidPlatformServices; diff --git a/src/plugins/platforms/android/qandroidplatformscreen.cpp b/src/plugins/platforms/android/qandroidplatformscreen.cpp index a73550606b..155d6bfb8d 100644 --- a/src/plugins/platforms/android/qandroidplatformscreen.cpp +++ b/src/plugins/platforms/android/qandroidplatformscreen.cpp @@ -379,9 +379,8 @@ void QAndroidPlatformScreen::doRedraw() } } - foreach (const QRect &rect, visibleRegion.rects()) { + for (const QRect &rect : visibleRegion) compositePainter.fillRect(rect, QColor(Qt::transparent)); - } ret = ANativeWindow_unlockAndPost(m_nativeSurface); if (ret >= 0) diff --git a/src/plugins/platforms/cocoa/qcocoaapplication.mm b/src/plugins/platforms/cocoa/qcocoaapplication.mm index c496134606..170f17504f 100644 --- a/src/plugins/platforms/cocoa/qcocoaapplication.mm +++ b/src/plugins/platforms/cocoa/qcocoaapplication.mm @@ -71,11 +71,11 @@ ** ****************************************************************************/ -#include <qcocoaapplication.h> +#include "qcocoaapplication.h" -#include <qcocoaintrospection.h> -#include <qcocoaapplicationdelegate.h> -#include <qcocoahelpers.h> +#include "qcocoaintrospection.h" +#include "qcocoaapplicationdelegate.h" +#include "qcocoahelpers.h" #include <qguiapplication.h> #include <qdebug.h> diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.h b/src/plugins/platforms/cocoa/qcocoabackingstore.h index fa05626d18..52a3e756b9 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.h +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.h @@ -57,11 +57,8 @@ public: QPaintDevice *paintDevice() Q_DECL_OVERRIDE; void flush(QWindow *widget, const QRegion ®ion, const QPoint &offset) Q_DECL_OVERRIDE; -#ifndef QT_NO_OPENGL QImage toImage() const Q_DECL_OVERRIDE; -#else - QImage toImage() const; // No QPlatformBackingStore::toImage() for NO_OPENGL builds. -#endif + void resize (const QSize &size, const QRegion &) Q_DECL_OVERRIDE; bool scroll(const QRegion &area, int dx, int dy) Q_DECL_OVERRIDE; void beginPaint(const QRegion ®ion) Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/cocoa/qcocoabackingstore.mm b/src/plugins/platforms/cocoa/qcocoabackingstore.mm index b060d6a082..20233518b3 100644 --- a/src/plugins/platforms/cocoa/qcocoabackingstore.mm +++ b/src/plugins/platforms/cocoa/qcocoabackingstore.mm @@ -96,9 +96,8 @@ bool QCocoaBackingStore::scroll(const QRegion &area, int dx, int dy) extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); const qreal devicePixelRatio = m_qImage.devicePixelRatio(); QPoint qpoint(dx * devicePixelRatio, dy * devicePixelRatio); - const QVector<QRect> qrects = area.rects(); - for (int i = 0; i < qrects.count(); ++i) { - const QRect &qrect = QRect(qrects.at(i).topLeft() * devicePixelRatio, qrects.at(i).size() * devicePixelRatio); + for (const QRect &rect : area) { + const QRect qrect(rect.topLeft() * devicePixelRatio, rect.size() * devicePixelRatio); qt_scrollRectInImage(m_qImage, qrect, qpoint); } return true; @@ -109,10 +108,9 @@ void QCocoaBackingStore::beginPaint(const QRegion ®ion) if (m_qImage.hasAlphaChannel()) { QPainter p(&m_qImage); p.setCompositionMode(QPainter::CompositionMode_Source); - const QVector<QRect> rects = region.rects(); const QColor blank = Qt::transparent; - for (QVector<QRect>::const_iterator it = rects.begin(), end = rects.end(); it != end; ++it) - p.fillRect(*it, blank); + for (const QRect &rect : region) + p.fillRect(rect, blank); } } diff --git a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm index 47f9539d9c..488c9b8928 100644 --- a/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoacolordialoghelper.mm @@ -132,7 +132,7 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSColorPanelDelegate); - (void)setDialogHelper:(QCocoaColorDialogHelper *)helper { mHelper = helper; - [mColorPanel setShowsAlpha:mHelper->options()->testOption(QColorDialogOptions::ShowAlphaChannel)]; + if (mHelper->options()->testOption(QColorDialogOptions::NoButtons)) { [self restoreOriginalContentView]; } else if (!mStolenContentView) { @@ -483,6 +483,14 @@ bool QCocoaColorDialogHelper::show(Qt::WindowFlags, Qt::WindowModality windowMod { if (windowModality == Qt::WindowModal) windowModality = Qt::ApplicationModal; + + // Workaround for Apple rdar://25792119: If you invoke + // -setShowsAlpha: multiple times before showing the color + // picker, its height grows irrevocably. Instead, only + // invoke it once, when we show the dialog. + [[NSColorPanel sharedColorPanel] setShowsAlpha: + options()->testOption(QColorDialogOptions::ShowAlphaChannel)]; + sharedColorPanel()->init(this); return sharedColorPanel()->show(windowModality, parent); } diff --git a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm index 4eb35f5495..0375dd85f2 100644 --- a/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm +++ b/src/plugins/platforms/cocoa/qcocoafiledialoghelper.mm @@ -61,6 +61,8 @@ #include <qvarlengtharray.h> #include <stdlib.h> #include <qabstracteventdispatcher.h> +#include <qsysinfo.h> +#include <qglobal.h> #include <QDir> #include <qpa/qplatformnativeinterface.h> @@ -160,6 +162,11 @@ QT_NAMESPACE_ALIAS_OBJC_CLASS(QNSOpenSavePanelDelegate); // here to make sure it gets the correct value. [mSavePanel setDelegate:self]; +#if QT_OSX_PLATFORM_SDK_EQUAL_OR_ABOVE(__MAC_10_11) + if (QSysInfo::MacintoshVersion >= QSysInfo::MV_10_11) + mOpenPanel.accessoryViewDisclosed = YES; +#endif + if (mOptions->isLabelExplicitlySet(QFileDialogOptions::Accept)) [mSavePanel setPrompt:[self strip:options->labelText(QFileDialogOptions::Accept)]]; if (mOptions->isLabelExplicitlySet(QFileDialogOptions::FileName)) diff --git a/src/plugins/platforms/cocoa/qcocoahelpers.mm b/src/plugins/platforms/cocoa/qcocoahelpers.mm index 7480d99d19..c91c67fe79 100644 --- a/src/plugins/platforms/cocoa/qcocoahelpers.mm +++ b/src/plugins/platforms/cocoa/qcocoahelpers.mm @@ -202,15 +202,9 @@ NSImage *qt_mac_create_nsimage(const QIcon &icon) HIMutableShapeRef qt_mac_QRegionToHIMutableShape(const QRegion ®ion) { HIMutableShapeRef shape = HIShapeCreateMutable(); - QVector<QRect> rects = region.rects(); - if (!rects.isEmpty()) { - int n = rects.count(); - const QRect *qt_r = rects.constData(); - while (n--) { - CGRect cgRect = CGRectMake(qt_r->x(), qt_r->y(), qt_r->width(), qt_r->height()); - HIShapeUnionWithRect(shape, &cgRect); - ++qt_r; - } + for (const QRect &rect : region) { + CGRect cgRect = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()); + HIShapeUnionWithRect(shape, &cgRect); } return shape; } diff --git a/src/plugins/platforms/cocoa/qcocoakeymapper.h b/src/plugins/platforms/cocoa/qcocoakeymapper.h index 93ebc5b9dc..4ba615efeb 100644 --- a/src/plugins/platforms/cocoa/qcocoakeymapper.h +++ b/src/plugins/platforms/cocoa/qcocoakeymapper.h @@ -40,7 +40,7 @@ #ifndef QCOCOAKEYMAPPER_H #define QCOCOAKEYMAPPER_H -#include <qcocoahelpers.h> +#include "qcocoahelpers.h" #include <AppKit/AppKit.h> #include <Carbon/Carbon.h> diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 3115db2b83..c9783df44b 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -431,7 +431,7 @@ static bool _q_dontOverrideCtrlLMB = false; // set the active window to zero here, the new key window's // NSWindowDidBecomeKeyNotification hander will change the active window NSWindow *keyWindow = [NSApp keyWindow]; - if (!keyWindow) { + if (!keyWindow || keyWindow == windowNotification.object) { // no new key window, go ahead and set the active window to zero if (!m_platformWindow->windowIsPopupType() && !m_isMenuView) QWindowSystemInterface::handleWindowActivated(0); @@ -524,7 +524,7 @@ QT_WARNING_POP m_backingStore = backingStore; m_backingStoreOffset = offset * m_backingStore->getBackingStoreDevicePixelRatio(); - foreach (QRect rect, region.rects()) + for (const QRect &rect : region) [self setNeedsDisplayInRect:NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height())]; } diff --git a/src/plugins/platforms/cocoa/qpaintengine_mac.mm b/src/plugins/platforms/cocoa/qpaintengine_mac.mm index 395c25c915..759c4d26a5 100644 --- a/src/plugins/platforms/cocoa/qpaintengine_mac.mm +++ b/src/plugins/platforms/cocoa/qpaintengine_mac.mm @@ -88,10 +88,7 @@ static void qt_mac_clip_cg(CGContextRef hd, const QRegion &rgn, CGAffineTransfor if (rgn.isEmpty()) { CGContextAddRect(hd, CGRectMake(0, 0, 0, 0)); } else { - QVector<QRect> rects = rgn.rects(); - const int count = rects.size(); - for (int i = 0; i < count; i++) { - const QRect &r = rects[i]; + for (const QRect &r : rgn) { CGRect mac_r = CGRectMake(r.x(), r.y(), r.width(), r.height()); CGContextAddRect(hd, mac_r); } diff --git a/src/plugins/platforms/direct2d/direct2d.pro b/src/plugins/platforms/direct2d/direct2d.pro index 005a4da6db..f4c3b5cc3b 100644 --- a/src/plugins/platforms/direct2d/direct2d.pro +++ b/src/plugins/platforms/direct2d/direct2d.pro @@ -4,7 +4,7 @@ QT *= core-private QT *= gui-private QT *= platformsupport-private -LIBS *= -ld2d1 -ld3d11 -ldwrite -lVersion -lgdi32 +LIBS += -ldwmapi -ld2d1 -ld3d11 -ldwrite -lVersion -lgdi32 include(../windows/windows.pri) diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.cpp index 97eadb207b..38f2352934 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.cpp @@ -95,7 +95,7 @@ void QWindowsDirect2DBackingStore::beginPaint(const QRegion ®ion) painter.setCompositionMode(QPainter::CompositionMode_Source); - foreach (const QRect &r, region.rects()) + for (const QRect &r : region) painter.fillRect(r, clear); } @@ -127,10 +127,14 @@ void QWindowsDirect2DBackingStore::resize(const QSize &size, const QRegion ®i QPixmap *newPixmap = nativeWindow(window())->pixmap(); if (!old.isNull()) { - foreach (const QRect &rect, region.rects()) { + for (const QRect &rect : region) platformPixmap(newPixmap)->copy(old.handle(), rect); - } } } +QImage QWindowsDirect2DBackingStore::toImage() const +{ + return nativeWindow(window())->pixmap()->toImage(); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.h b/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.h index 9d754866cc..670c4e9840 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.h +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dbackingstore.h @@ -60,6 +60,8 @@ public: QPaintDevice *paintDevice() Q_DECL_OVERRIDE; void flush(QWindow *targetWindow, const QRegion ®ion, const QPoint &offset) Q_DECL_OVERRIDE; void resize(const QSize &size, const QRegion &staticContents) Q_DECL_OVERRIDE; + + QImage toImage() const override; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp b/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp index 4e677166b2..c750b02078 100644 --- a/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp +++ b/src/plugins/platforms/direct2d/qwindowsdirect2dwindow.cpp @@ -122,7 +122,7 @@ void QWindowsDirect2DWindow::flush(QWindowsDirect2DBitmap *bitmap, const QRegion QRegion clipped = region; clipped &= QRect(QPoint(), size); - foreach (const QRect &rect, clipped.rects()) { + for (const QRect &rect : clipped) { QRectF rectF(rect); dc->DrawBitmap(bitmap->bitmap(), to_d2d_rect_f(rectF), diff --git a/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp b/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp index 0bcf93aa3d..8d5e1e50c4 100644 --- a/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp +++ b/src/plugins/platforms/directfb/qdirectfbbackingstore.cpp @@ -70,9 +70,7 @@ void QDirectFbBackingStore::flush(QWindow *, const QRegion ®ion, const QPoint { m_pmdata->blittable()->unlock(); - QVector<QRect> rects = region.rects(); - for (int i = 0 ; i < rects.size(); i++) { - const QRect rect = rects.at(i); + for (const QRect &rect : region) { DFBRegion dfbReg(rect.x() + offset.x(),rect.y() + offset.y(),rect.right() + offset.x(),rect.bottom() + offset.y()); m_dfbSurface->Flip(m_dfbSurface.data(), &dfbReg, DFBSurfaceFlipFlags(DSFLIP_BLIT|DSFLIP_ONSYNC)); } @@ -108,13 +106,15 @@ bool QDirectFbBackingStore::scroll(const QRegion &area, int dx, int dy) if (area.rectCount() == 1) { scrollSurface(m_dfbSurface.data(), area.boundingRect(), dx, dy); } else { - const QVector<QRect> rects = area.rects(); - const int n = rects.size(); - for (int i=0; i<n; ++i) { - scrollSurface(m_dfbSurface.data(), rects.at(i), dx, dy); - } + for (const QRect &rect : area) + scrollSurface(m_dfbSurface.data(), rect, dx, dy); } return true; } +QImage QDirectFbBackingStore::toImage() const +{ + return m_pixmap.data()->toImage(); +} + QT_END_NAMESPACE diff --git a/src/plugins/platforms/directfb/qdirectfbbackingstore.h b/src/plugins/platforms/directfb/qdirectfbbackingstore.h index 33ab1c111d..af1ce92e64 100644 --- a/src/plugins/platforms/directfb/qdirectfbbackingstore.h +++ b/src/plugins/platforms/directfb/qdirectfbbackingstore.h @@ -59,6 +59,8 @@ public: void resize (const QSize &size, const QRegion &staticContents); bool scroll(const QRegion &area, int dx, int dy); + QImage toImage() const override; + private: void lockSurfaceToImage(); diff --git a/src/plugins/platforms/ios/qioseventdispatcher.mm b/src/plugins/platforms/ios/qioseventdispatcher.mm index 8d82364cc0..f49f81912e 100644 --- a/src/plugins/platforms/ios/qioseventdispatcher.mm +++ b/src/plugins/platforms/ios/qioseventdispatcher.mm @@ -493,7 +493,7 @@ void QIOSEventDispatcher::handleRunLoopExit(CFRunLoopActivity activity) Q_UNUSED(activity); Q_ASSERT(activity == kCFRunLoopExit); - if (m_processEventLevel == 1 && !QThreadData::current()->eventLoops.top()->isRunning()) { + if (m_processEventLevel == 1 && !currentEventLoop()->isRunning()) { qEventDispatcherDebug() << "Root runloop level exited"; interruptEventLoopExec(); } diff --git a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp index 321e124eee..f0c29130f8 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp @@ -412,9 +412,8 @@ QRegion QLinuxFbScreen::doRedraw() if (!mBlitter) mBlitter = new QPainter(&mFbScreenImage); - QVector<QRect> rects = touched.rects(); - for (int i = 0; i < rects.size(); i++) - mBlitter->drawImage(rects[i], *mScreenImage, rects[i]); + for (const QRect &rect : touched) + mBlitter->drawImage(rect, *mScreenImage, rect); return touched; } diff --git a/src/plugins/platforms/mirclient/qmirclientbackingstore.cpp b/src/plugins/platforms/mirclient/qmirclientbackingstore.cpp index 465ad355b9..f80d85842a 100644 --- a/src/plugins/platforms/mirclient/qmirclientbackingstore.cpp +++ b/src/plugins/platforms/mirclient/qmirclientbackingstore.cpp @@ -100,7 +100,7 @@ void QMirClientBackingStore::updateTexture() QRegion fixed; QRect imageRect = mImage.rect(); - Q_FOREACH (const QRect &rect, mDirty.rects()) { + for (const QRect &rect : mDirty) { // intersect with image rect to be sure QRect r = imageRect & rect; @@ -113,7 +113,7 @@ void QMirClientBackingStore::updateTexture() fixed |= r; } - Q_FOREACH (const QRect &rect, fixed.rects()) { + for (const QRect &rect : fixed) { // if the sub-rect is full-width we can pass the image data directly to // OpenGL instead of copying, since there is no gap between scanlines if (rect.width() == imageRect.width()) { diff --git a/src/plugins/platforms/offscreen/qoffscreencommon.cpp b/src/plugins/platforms/offscreen/qoffscreencommon.cpp index ed1a81c2b3..a63aacdbfe 100644 --- a/src/plugins/platforms/offscreen/qoffscreencommon.cpp +++ b/src/plugins/platforms/offscreen/qoffscreencommon.cpp @@ -179,9 +179,8 @@ bool QOffscreenBackingStore::scroll(const QRegion &area, int dx, int dy) if (m_image.isNull()) return false; - const QVector<QRect> rects = area.rects(); - for (int i = 0; i < rects.size(); ++i) - qt_scrollRectInImage(m_image, rects.at(i), QPoint(dx, dy)); + for (const QRect &rect : area) + qt_scrollRectInImage(m_image, rect, QPoint(dx, dy)); return true; } diff --git a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp index a08ac2b839..90a09d3087 100644 --- a/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp +++ b/src/plugins/platforms/qnx/qqnxbuttoneventnotifier.cpp @@ -97,7 +97,7 @@ void QQnxButtonEventNotifier::start() m_readNotifier = new QSocketNotifier(m_fd, QSocketNotifier::Read); QObject::connect(m_readNotifier, SIGNAL(activated(int)), this, SLOT(updateButtonStates())); - qButtonDebug() << "successfully connected to Navigator. fd =" << m_fd; + qButtonDebug("successfully connected to Navigator. fd = %d", m_fd); } void QQnxButtonEventNotifier::updateButtonStates() @@ -121,7 +121,7 @@ void QQnxButtonEventNotifier::updateButtonStates() // Ensure data is null terminated buffer[bytes] = '\0'; - qButtonDebug() << "received PPS message:\n" << buffer; + qButtonDebug("received PPS message:\n%s", buffer); // Process received message QByteArray ppsData = QByteArray::fromRawData(buffer, bytes); diff --git a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp index 79ff74b113..ce3a445d7c 100644 --- a/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp +++ b/src/plugins/platforms/qnx/qqnxinputcontext_imf.cpp @@ -721,7 +721,7 @@ void QQnxInputContext::update(Qt::InputMethodQueries queries) initEvent(&caretEvent.event, sInputSession, EVENT_CARET, CARET_POS_CHANGED, sizeof(caretEvent)); caretEvent.old_pos = lastCaret; caretEvent.new_pos = m_caretPosition; - qInputContextDebug() << "ictrl_dispatch_event caret changed" << lastCaret << m_caretPosition; + qInputContextDebug("ictrl_dispatch_event caret changed %d %d", lastCaret, m_caretPosition); p_ictrl_dispatch_event(&caretEvent.event); } } @@ -914,7 +914,7 @@ bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan navigation_event_t navEvent; initEvent(&navEvent.event, sInputSession, EVENT_NAVIGATION, key, sizeof(navEvent)); navEvent.magnitude = 1; - qInputContextDebug() << "ictrl_dispatch_even navigation" << key; + qInputContextDebug("ictrl_dispatch_even navigation %d", key); p_ictrl_dispatch_event(&navEvent.event); } } else { @@ -927,7 +927,7 @@ bool QQnxInputContext::handleKeyboardEvent(int flags, int sym, int mod, int scan keyEvent.sequence_id = sequenceId; p_ictrl_dispatch_event(&keyEvent.event); - qInputContextDebug() << "ictrl_dispatch_even key" << key; + qInputContextDebug("ictrl_dispatch_even key %d", key); } return true; @@ -943,7 +943,7 @@ void QQnxInputContext::updateCursorPosition() QCoreApplication::sendEvent(input, &query); m_caretPosition = query.value(Qt::ImCursorPosition).toInt(); - qInputContextDebug() << m_caretPosition; + qInputContextDebug("%d", m_caretPosition); } void QQnxInputContext::endComposition() @@ -1116,7 +1116,7 @@ int32_t QQnxInputContext::processEvent(event_t *event) int flags = KEY_SYM_VALID | KEY_CAP_VALID; if (event->event_id == IMF_KEY_DOWN) flags |= KEY_DOWN; - qInputContextDebug() << "EVENT_KEY" << flags << keySym; + qInputContextDebug("EVENT_KEY %d %d", flags, keySym); QQnxScreenEventHandler::injectKeyboardEvent(flags, keySym, modifiers, 0, keyCap); result = 0; break; @@ -1156,7 +1156,7 @@ int32_t QQnxInputContext::onCommitText(spannable_string_t *text, int32_t new_cur int32_t QQnxInputContext::onDeleteSurroundingText(int32_t left_length, int32_t right_length) { - qInputContextDebug() << "L:" << left_length << " R:" << right_length; + qInputContextDebug("L: %d R: %d", int(left_length), int(right_length)); QObject *input = qGuiApp->focusObject(); if (!input) diff --git a/src/plugins/platforms/qnx/qqnxintegration.cpp b/src/plugins/platforms/qnx/qqnxintegration.cpp index 3a0e97af6e..9d38742d6f 100644 --- a/src/plugins/platforms/qnx/qqnxintegration.cpp +++ b/src/plugins/platforms/qnx/qqnxintegration.cpp @@ -453,11 +453,11 @@ void QQnxIntegration::createDisplays() Q_SCREEN_CHECKERROR(result, "Failed to query display attachment"); if (!isAttached) { - qIntegrationDebug() << "Skipping non-attached display" << i; + qIntegrationDebug("Skipping non-attached display %d", i); continue; } - qIntegrationDebug() << "Creating screen for display" << i; + qIntegrationDebug("Creating screen for display %d", i); createDisplay(displays[i], /*isPrimary=*/false); } // of displays iteration } diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp index 4955938a3a..0e16764b79 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxnavigatoreventhandler.cpp @@ -63,14 +63,14 @@ bool QQnxNavigatorEventHandler::handleOrientationCheck(int angle) { // reply to navigator that (any) orientation is acceptable // TODO: check if top window flags prohibit orientation change - qNavigatorEventHandlerDebug() << "angle=" << angle; + qNavigatorEventHandlerDebug("angle=%d", angle); return true; } void QQnxNavigatorEventHandler::handleOrientationChange(int angle) { // update screen geometry and reply to navigator that we're ready - qNavigatorEventHandlerDebug() << "angle=" << angle; + qNavigatorEventHandlerDebug("angle=%d", angle); emit rotationChanged(angle); } diff --git a/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp b/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp index 9ccda2d94a..1f630863b7 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp +++ b/src/plugins/platforms/qnx/qqnxnavigatoreventnotifier.cpp @@ -91,8 +91,7 @@ void QQnxNavigatorEventNotifier::start() errno = 0; m_fd = open(navigatorControlPath, O_RDWR); if (m_fd == -1) { - qNavigatorEventNotifierDebug() << "failed to open navigator pps:" - << strerror(errno); + qNavigatorEventNotifierDebug("failed to open navigator pps: %s", strerror(errno)); return; } diff --git a/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp b/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp index fd1bbc4a85..d5234ca92f 100644 --- a/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp +++ b/src/plugins/platforms/qnx/qqnxnavigatorpps.cpp @@ -79,7 +79,7 @@ bool QQnxNavigatorPps::openPpsConnection() return false; } - qNavigatorDebug() << "successfully connected to Navigator. fd=" << m_fd; + qNavigatorDebug("successfully connected to Navigator. fd=%d", m_fd); return true; } diff --git a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp index c9a89def41..a758bdf7f4 100644 --- a/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp +++ b/src/plugins/platforms/qnx/qqnxrasterbackingstore.cpp @@ -139,7 +139,7 @@ void QQnxRasterBackingStore::beginPaint(const QRegion ®ion) platformWindow()->adjustBufferSize(); if (window()->requestedFormat().alphaBufferSize() > 0) { - foreach (const QRect &r, region.rects()) { + for (const QRect &r : region) { // Clear transparent regions const int bg[] = { SCREEN_BLIT_COLOR, 0x00000000, diff --git a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp index 0fe80d856d..b075690e3d 100644 --- a/src/plugins/platforms/qnx/qqnxrasterwindow.cpp +++ b/src/plugins/platforms/qnx/qqnxrasterwindow.cpp @@ -208,10 +208,9 @@ void QQnxRasterWindow::blitPreviousToCurrent(const QRegion ®ion, int dx, int QQnxBuffer &previousBuffer = m_buffers[m_previousBufferIndex]; // Break down region into non-overlapping rectangles - const QVector<QRect> rects = region.rects(); - for (int i = rects.size() - 1; i >= 0; i--) { + for (auto rit = region.rbegin(), rend = region.rend(); rit != rend; ++rit) { // Clip rectangle to bounds of target - const QRect rect = rects[i].intersected(currentBuffer.rect()); + const QRect rect = rit->intersected(currentBuffer.rect()); if (rect.isEmpty()) continue; diff --git a/src/plugins/platforms/qnx/qqnxscreen.cpp b/src/plugins/platforms/qnx/qqnxscreen.cpp index 16ddcd784b..678e83cd57 100644 --- a/src/plugins/platforms/qnx/qqnxscreen.cpp +++ b/src/plugins/platforms/qnx/qqnxscreen.cpp @@ -340,11 +340,12 @@ qreal QQnxScreen::refreshRate() const qWarning("QQnxScreen: Failed to query screen mode. Using default value of 60Hz"); return 60.0; } - qScreenDebug() << "screen mode:" << endl - << " width =" << displayMode.width << endl - << " height =" << displayMode.height << endl - << " refresh =" << displayMode.refresh << endl - << " interlaced =" << displayMode.interlaced; + qScreenDebug("screen mode:\n" + " width = %u\n" + " height = %u\n" + " refresh = %u\n" + " interlaced = %u", + uint(displayMode.width), uint(displayMode.height), uint(displayMode.refresh), uint(displayMode.interlaced)); return static_cast<qreal>(displayMode.refresh); } @@ -404,7 +405,7 @@ static bool isOrthogonal(int angle1, int angle2) void QQnxScreen::setRotation(int rotation) { - qScreenDebug() << "orientation =" << rotation; + qScreenDebug("orientation = %d", rotation); // Check if rotation changed // We only want to rotate if we are the primary screen if (m_currentRotation != rotation && isPrimaryScreen()) { diff --git a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp index 599d43a8c8..42651732c2 100644 --- a/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp +++ b/src/plugins/platforms/qnx/qqnxscreeneventhandler.cpp @@ -147,7 +147,7 @@ bool QQnxScreenEventHandler::handleEvent(screen_event_t event, int qnxType) default: // event ignored - qScreenEventDebug() << "unknown event" << qnxType; + qScreenEventDebug("unknown event %d", qnxType); return false; } diff --git a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp index 1174dc6ab3..025c03c058 100644 --- a/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp +++ b/src/plugins/platforms/qnx/qqnxvirtualkeyboardpps.cpp @@ -164,7 +164,7 @@ void QQnxVirtualKeyboardPps::ppsDataReady() { ssize_t nread = qt_safe_read(m_fd, m_buffer, ms_bufferSize - 1); - qVirtualKeyboardDebug() << "keyboardMessage size: " << nread; + qVirtualKeyboardDebug("keyboardMessage size: %zd", nread); if (nread < 0){ connect(); // reconnect return; @@ -230,7 +230,7 @@ void QQnxVirtualKeyboardPps::handleKeyboardInfoMessage() } setHeight(newHeight); - qVirtualKeyboardDebug() << "size=" << newHeight; + qVirtualKeyboardDebug("size=%d", newHeight); } bool QQnxVirtualKeyboardPps::showKeyboard() diff --git a/src/plugins/platforms/windows/accessible/accessible.pri b/src/plugins/platforms/windows/accessible/accessible.pri index 0774d907f2..0e3aacc558 100644 --- a/src/plugins/platforms/windows/accessible/accessible.pri +++ b/src/plugins/platforms/windows/accessible/accessible.pri @@ -6,15 +6,13 @@ HEADERS += \ $$PWD/qwindowsaccessibility.h \ $$PWD/comutils.h -!wince: { - SOURCES += $$PWD/qwindowsmsaaaccessible.cpp - HEADERS += $$PWD/qwindowsmsaaaccessible.h +SOURCES += $$PWD/qwindowsmsaaaccessible.cpp +HEADERS += $$PWD/qwindowsmsaaaccessible.h - !mingw: { - SOURCES += $$PWD/iaccessible2.cpp - HEADERS += $$PWD/iaccessible2.h - include(../../../../3rdparty/iaccessible2/iaccessible2.pri) - } +!mingw: { + SOURCES += $$PWD/iaccessible2.cpp + HEADERS += $$PWD/iaccessible2.h + include(../../../../3rdparty/iaccessible2/iaccessible2.pri) } mingw: LIBS *= -luuid diff --git a/src/plugins/platforms/windows/accessible/comutils.cpp b/src/plugins/platforms/windows/accessible/comutils.cpp index 7655bdf622..1c072c5e2c 100644 --- a/src/plugins/platforms/windows/accessible/comutils.cpp +++ b/src/plugins/platforms/windows/accessible/comutils.cpp @@ -170,7 +170,6 @@ bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeN case QVariant::LongLong: if (out && arg.vt == (VT_CY|VT_BYREF)) { arg.pcyVal->int64 = qvar.toLongLong(); -#if !defined(Q_OS_WINCE) && defined(_MSC_VER) && _MSC_VER >= 1400 } else if (out && arg.vt == (VT_I8|VT_BYREF)) { *arg.pllVal = qvar.toLongLong(); } else { @@ -181,22 +180,11 @@ bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeN arg.vt |= VT_BYREF; } } -#else - } else { - arg.vt = VT_CY; - arg.cyVal.int64 = qvar.toLongLong(); - if (out) { - arg.pcyVal = new CY(arg.cyVal); - arg.vt |= VT_BYREF; - } - } -#endif break; case QVariant::ULongLong: if (out && arg.vt == (VT_CY|VT_BYREF)) { arg.pcyVal->int64 = qvar.toULongLong(); -#if !defined(Q_OS_WINCE) && defined(_MSC_VER) && _MSC_VER >= 1400 } else if (out && arg.vt == (VT_UI8|VT_BYREF)) { *arg.pullVal = qvar.toULongLong(); } else { @@ -207,18 +195,6 @@ bool QVariant2VARIANT(const QVariant &var, VARIANT &arg, const QByteArray &typeN arg.vt |= VT_BYREF; } } -#else - } else { - arg.vt = VT_CY; - arg.cyVal.int64 = qvar.toULongLong(); - if (out) { - arg.pcyVal = new CY(arg.cyVal); - arg.vt |= VT_BYREF; - } - } - -#endif - break; case QVariant::Bool: diff --git a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp index 4a3f0ccb2b..08edf816b0 100644 --- a/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp +++ b/src/plugins/platforms/windows/accessible/qwindowsaccessibility.cpp @@ -56,12 +56,10 @@ #include <QtGui/qguiapplication.h> #include "qwindowsaccessibility.h" -#if !defined(Q_OS_WINCE) -# ifdef Q_CC_MINGW -# include "qwindowsmsaaaccessible.h" -# else -# include "iaccessible2.h" -# endif +#ifdef Q_CC_MINGW +# include "qwindowsmsaaaccessible.h" +#else +# include "iaccessible2.h" #endif #include "comutils.h" @@ -74,11 +72,7 @@ #include <winuser.h> #if !defined(WINABLEAPI) -# if defined(Q_OS_WINCE) -# include <bldver.h> -# else -# include <winable.h> -# endif +# include <winable.h> #endif #include <servprov.h> @@ -153,10 +147,6 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) } } -#if defined(Q_OS_WINCE) // ### TODO: check for NotifyWinEvent in CE 6.0 - // There is no user32.lib nor NotifyWinEvent for CE - return; -#else // An event has to be associated with a window, // so find the first parent that is a widget and that has a WId QAccessibleInterface *iface = event->accessibleInterface(); @@ -179,7 +169,6 @@ void QWindowsAccessibility::notifyAccessibilityUpdate(QAccessibleEvent *event) event->type() != QAccessible::ObjectDestroyed) { ::NotifyWinEvent(event->type(), hWnd, OBJID_CLIENT, QAccessible::uniqueId(iface)); } -#endif // Q_OS_WINCE } QWindow *QWindowsAccessibility::windowHelper(const QAccessibleInterface *iface) @@ -202,11 +191,6 @@ QWindow *QWindowsAccessibility::windowHelper(const QAccessibleInterface *iface) */ IAccessible *QWindowsAccessibility::wrap(QAccessibleInterface *acc) { -#if defined(Q_OS_WINCE) - Q_UNUSED(acc); - - return 0; -#else if (!acc) return 0; @@ -222,12 +206,10 @@ IAccessible *QWindowsAccessibility::wrap(QAccessibleInterface *acc) IAccessible *iacc = 0; wacc->QueryInterface(IID_IAccessible, reinterpret_cast<void **>(&iacc)); return iacc; -#endif // defined(Q_OS_WINCE) } bool QWindowsAccessibility::handleAccessibleObjectFromWindowRequest(HWND hwnd, WPARAM wParam, LPARAM lParam, LRESULT *lResult) { -#if !defined(Q_OS_WINCE) if (static_cast<long>(lParam) == static_cast<long>(UiaRootObjectId)) { /* For UI Automation */ } else if (DWORD(lParam) == DWORD(OBJID_CLIENT)) { @@ -263,12 +245,6 @@ bool QWindowsAccessibility::handleAccessibleObjectFromWindowRequest(HWND hwnd, W } } } -#else - Q_UNUSED(hwnd); - Q_UNUSED(wParam); - Q_UNUSED(lParam); - Q_UNUSED(lResult); -#endif // !defined(Q_OS_WINCE) return false; } diff --git a/src/plugins/platforms/windows/qplatformfunctions_wince.h b/src/plugins/platforms/windows/qplatformfunctions_wince.h deleted file mode 100644 index 309191537a..0000000000 --- a/src/plugins/platforms/windows/qplatformfunctions_wince.h +++ /dev/null @@ -1,371 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QPLATFORMFUNCTIONS_WCE_H -#define QPLATFORMFUNCTIONS_WCE_H -// -// W A R N I N G -// ------------- -// -// This file is part of the QPA API and is not meant to be used -// in applications. Usage of this API may make your code -// source and binary incompatible with future versions of Qt. -// - -#ifdef Q_OS_WINCE -#include <QtCore/qfunctions_wince.h> -#define UNDER_NT -#include <wingdi.h> -#include <objidl.h> - -#ifndef WM_MOUSELEAVE -# define WM_MOUSELEAVE 0x02A3 -#endif - -#ifndef WM_TOUCH -# define WM_TOUCH 0x0240 -#endif - -#ifndef WM_GETOBJECT -#define WM_GETOBJECT 0x003D -#endif - -#define GetWindowLongPtr GetWindowLong -#define SetWindowLongPtr SetWindowLong -#define GWLP_USERDATA GWL_USERDATA - -#ifndef CWP_SKIPINVISIBLE -#define CWP_SKIPINVISIBLE 0x0001 -#define CWP_SKIPTRANSPARENT 0x0004 -#endif - -#ifndef CS_OWNDC -#define CS_OWNDC 0x0020 -#endif - -#ifndef HWND_MESSAGE -#define HWND_MESSAGE 0 -#endif - -// Real Value would be 0x40000000, but if we pass this to Windows Embedded Compact -// he blits it wrongly, so lets not do any harm and define it to 0 -#ifndef CAPTUREBLT -#define CAPTUREBLT (DWORD)0x0 -#endif - -#define SW_SHOWMINIMIZED SW_MINIMIZE -#define SW_SHOWMINNOACTIVE SW_MINIMIZE - -#ifndef CF_DIBV5 -#define CF_DIBV5 17 -#endif - -#ifndef WM_MOUSEACTIVATE -#define WM_MOUSEACTIVATE 0x0021 -#endif - -#ifndef WM_CHILDACTIVATE -#define WM_CHILDACTIVATE 0x0022 -#endif - -#ifndef WM_PARENTNOTIFY -#define WM_PARENTNOTIFY 0x0210 -#endif - -#ifndef WM_ENTERIDLE -#define WM_ENTERIDLE 0x0121 -#endif - -#ifndef WM_GETMINMAXINFO -#define WM_GETMINMAXINFO 0x0024 -#endif - -#ifndef WM_WINDOWPOSCHANGING -#define WM_WINDOWPOSCHANGING 0x0046 -#endif - -#ifndef WM_NCMOUSEMOVE -#define WM_NCMOUSEMOVE 0x00A0 -#endif - -#ifndef WM_NCMBUTTONDBLCLK -#define WM_NCMBUTTONDBLCLK 0x00A -#endif - -#ifndef WM_NCCREATE -#define WM_NCCREATE 0x0081 -#endif - -#ifndef WM_NCCALCSIZE -#define WM_NCCALCSIZE 0x0083 -#endif - -#ifndef WM_NCACTIVATE -#define WM_NCACTIVATE 0x0086 -#endif - -#ifndef WM_NCMOUSELEAVE -#define WM_NCMOUSELEAVE 0x02A2 -#endif - -#ifndef WM_NCLBUTTONDOWN -#define WM_NCLBUTTONDOWN 0x00A1 -#endif - -#ifndef WM_NCLBUTTONUP -#define WM_NCLBUTTONUP 0x00A2 -#endif - -#ifndef WM_NCPAINT -#define WM_NCPAINT 0x0085 -#endif - -#ifndef WM_NCHITTEST -#define WM_NCHITTEST 0x0084 -#endif - -#ifndef WM_THEMECHANGED -#define WM_THEMECHANGED 0x031A -#endif - -#ifndef WM_DISPLAYCHANGE -#define WM_DISPLAYCHANGE 0x007E -#endif - -#ifndef VREFRESH -#define VREFRESH 116 -#endif - -#ifndef SM_SWAPBUTTON -#define SM_SWAPBUTTON 23 -#endif - -// application defines -#define SPI_SETNONCLIENTMETRICS 72 -#define SPI_SETICONTITLELOGFONT 0x0022 -#define WM_ACTIVATEAPP 0x001c -#define SW_PARENTCLOSING 1 -#define SW_OTHERMAXIMIZED 2 -#define SW_PARENTOPENING 3 -#define SW_OTHERRESTORED 4 -#define GET_XBUTTON_WPARAM(wParam) (HIWORD(wParam)) - -// drag n drop -#ifndef CFSTR_PERFORMEDDROPEFFECT -#define CFSTR_PERFORMEDDROPEFFECT TEXT("Performed DropEffect") -#endif - -// QWidget -#define SW_SHOWMINIMIZED SW_MINIMIZE - -// QRegion -#define ALTERNATE 0 -#define WINDING 1 - -// QFontEngine -typedef struct _FIXED { - WORD fract; - short value; -} FIXED; - -typedef struct tagPOINTFX { - FIXED x; - FIXED y; -} POINTFX; - -typedef struct _MAT2 { - FIXED eM11; - FIXED eM12; - FIXED eM21; - FIXED eM22; -} MAT2; - -typedef struct _GLYPHMETRICS { - UINT gmBlackBoxX; - UINT gmBlackBoxY; - POINT gmptGlyphOrigin; - short gmCellIncX; - short gmCellIncY; -} GLYPHMETRICS; - -typedef struct tagTTPOLYGONHEADER -{ - DWORD cb; - DWORD dwType; - POINTFX pfxStart; -} TTPOLYGONHEADER; - -typedef struct tagTTPOLYCURVE -{ - WORD wType; - WORD cpfx; - POINTFX apfx[1]; -} TTPOLYCURVE; - -#define GGO_NATIVE 2 -#define GGO_GLYPH_INDEX 0x0080 -#define TT_PRIM_LINE 1 -#define TT_PRIM_QSPLINE 2 -#define TT_PRIM_CSPLINE 3 -#define ANSI_VAR_FONT 12 - -#ifndef OleInitialize -#define OleInitialize(a) 0 -#endif - -#ifndef SPI_GETSNAPTODEFBUTTON -#define SPI_GETSNAPTODEFBUTTON 95 -#endif - -#ifndef WS_EX_LAYERED -#define WS_EX_LAYERED 0x00080000 -#endif - -// Clipboard -------------------------------------------------------- -#ifndef WM_CHANGECBCHAIN -#define WM_CHANGECBCHAIN 0x030D -#endif - -#ifndef WM_DRAWCLIPBOARD -#define WM_DRAWCLIPBOARD 0x0308 -#endif - -#include <QFileInfo> - -inline bool IsIconic( HWND /*hWnd*/ ) -{ - return false; -} - -inline int AddFontResourceExW( LPCWSTR name, DWORD /*fl*/, PVOID /*res*/) -{ - QString fName = QString::fromWCharArray(name); - QFileInfo fileinfo(fName); - fName = fileinfo.absoluteFilePath(); - return AddFontResource((LPCWSTR)fName.utf16()); -} - -inline bool RemoveFontResourceExW( LPCWSTR /*name*/, DWORD /*fl*/, PVOID /*pdv*/) -{ - return 0; -} - -inline void OleUninitialize() -{ -} - -inline DWORD GetGlyphOutline( HDC /*hdc*/, UINT /*uChar*/, INT /*fuFormat*/, GLYPHMETRICS * /*lpgm*/, - DWORD /*cjBuffer*/, LPVOID /*pvBuffer*/, CONST MAT2 * /*lpmat2*/ ) -{ - qFatal("GetGlyphOutline() not supported under Windows CE. Please try using freetype font-rendering, by " - "passing the command line argument -platform windows:fontengine=freetype to the application."); - return GDI_ERROR; -} - -inline HWND GetAncestor(HWND hWnd, UINT /*gaFlags*/) -{ - return GetParent(hWnd); -} - -#ifndef GA_PARENT -# define GA_PARENT 1 -#endif - -#ifndef SPI_SETFONTSMOOTHINGTYPE -# define SPI_SETFONTSMOOTHINGTYPE 0x200B -#endif -#ifndef SPI_GETFONTSMOOTHINGTYPE -# define SPI_GETFONTSMOOTHINGTYPE 0x200A -#endif -#ifndef FE_FONTSMOOTHINGCLEARTYPE -# define FE_FONTSMOOTHINGCLEARTYPE 0x0002 -#endif - -#ifndef DEVICE_FONTTYPE -#define DEVICE_FONTTYPE 0x0002 -#endif - -#ifndef RASTER_FONTTYPE -#define RASTER_FONTTYPE 0x0001 -#endif - -#ifndef WM_DISPLAYCHANGE -#define WM_DISPLAYCHANGE 0x007E -#endif - -BOOL qt_wince_ChangeClipboardChain( - HWND hWndRemove, // handle to window to remove - HWND hWndNewNext // handle to next window -); -#define ChangeClipboardChain(a,b) qt_wince_ChangeClipboardChain(a,b); - -HWND qt_wince_SetClipboardViewer( - HWND hWndNewViewer // handle to clipboard viewer window -); -#define SetClipboardViewer(a) qt_wince_SetClipboardViewer(a) - -/* Shell stock icon IDs - SHGetStockIconInfo() is not available on CE, but we're using these - constants in code that is built on CE as well */ - enum - { - SIID_INVALID = -1, - SIID_DOCNOASSOC = 0, - SIID_FOLDER = 3, - SIID_FOLDEROPEN = 4, - SIID_DRIVE35 = 6, - SIID_DRIVEFIXED = 8, - SIID_DRIVENET = 9, - SIID_DRIVECD = 11, - SIID_HELP = 23, - SIID_RECYCLER = 31, - SIID_DRIVEDVD = 59, - SIID_SHIELD = 77, - SIID_WARNING = 78, - SIID_INFO = 79, - SIID_ERROR = 80 -}; - -#ifndef SHGSI_LINKOVERLAY -// Value is wrong, but doesn't matter, not used at runtime -#define SHGSI_LINKOVERLAY 0 -#endif - -#endif // Q_OS_WINCE -#endif // QPLATFORMFUNCTIONS_WCE_H diff --git a/src/plugins/platforms/windows/qtwindowsglobal.h b/src/plugins/platforms/windows/qtwindowsglobal.h index 90008663e7..cb85856787 100644 --- a/src/plugins/platforms/windows/qtwindowsglobal.h +++ b/src/plugins/platforms/windows/qtwindowsglobal.h @@ -43,9 +43,6 @@ #include "qtwindows_additional.h" #include <QtCore/qnamespace.h> -#ifdef Q_OS_WINCE -# include "qplatformfunctions_wince.h" -#endif QT_BEGIN_NAMESPACE @@ -158,10 +155,8 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI case WM_MOUSEWHEEL: case WM_MOUSEHWHEEL: return QtWindows::MouseWheelEvent; -#ifndef Q_OS_WINCE case WM_WINDOWPOSCHANGING: return QtWindows::GeometryChangingEvent; -#endif case WM_MOVE: return QtWindows::MoveEvent; case WM_SHOWWINDOW: @@ -172,10 +167,8 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI return QtWindows::ResizeEvent; case WM_NCCALCSIZE: return QtWindows::CalculateSize; -#ifndef Q_OS_WINCE case WM_NCHITTEST: return QtWindows::NonClientHitTest; -#endif // !Q_OS_WINCE case WM_GETMINMAXINFO: return QtWindows::QuerySizeHints; case WM_KEYDOWN: // keyboard event @@ -243,12 +236,10 @@ inline QtWindows::WindowsEventType windowsEventType(UINT message, WPARAM wParamI return QtWindows::ContextMenu; #endif case WM_SYSCOMMAND: -#ifndef Q_OS_WINCE if ((wParamIn & 0xfff0) == SC_CONTEXTHELP) return QtWindows::WhatsThisEvent; -#endif break; -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) case WM_QUERYENDSESSION: return QtWindows::QueryEndSessionApplicationEvent; case WM_ENDSESSION: diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.cpp b/src/plugins/platforms/windows/qwindowsbackingstore.cpp index 7123ed826d..3b7374dc92 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.cpp +++ b/src/plugins/platforms/windows/qwindowsbackingstore.cpp @@ -87,7 +87,6 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion, QWindowsWindow *rw = QWindowsWindow::windowsWindowOf(window); Q_ASSERT(rw); -#ifndef Q_OS_WINCE const bool hasAlpha = rw->format().hasAlpha(); const Qt::WindowFlags flags = window->flags(); if ((flags & Qt::FramelessWindowHint) && QWindowsWindow::setWindowLayered(rw->handle(), flags, hasAlpha, rw->opacity()) && hasAlpha) { @@ -101,21 +100,16 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion, POINT ptDst = {r.x(), r.y()}; POINT ptSrc = {0, 0}; BLENDFUNCTION blend = {AC_SRC_OVER, 0, BYTE(qRound(255.0 * rw->opacity())), AC_SRC_ALPHA}; - if (QWindowsContext::user32dll.updateLayeredWindowIndirect) { - RECT dirty = {dirtyRect.x(), dirtyRect.y(), - dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()}; - UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA, &dirty}; - const BOOL result = QWindowsContext::user32dll.updateLayeredWindowIndirect(rw->handle(), &info); - if (!result) - qErrnoWarning("UpdateLayeredWindowIndirect failed for ptDst=(%d, %d)," - " size=(%dx%d), dirty=(%dx%d %d, %d)", r.x(), r.y(), - r.width(), r.height(), dirtyRect.width(), dirtyRect.height(), - dirtyRect.x(), dirtyRect.y()); - } else { - QWindowsContext::user32dll.updateLayeredWindow(rw->handle(), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA); - } + RECT dirty = {dirtyRect.x(), dirtyRect.y(), + dirtyRect.x() + dirtyRect.width(), dirtyRect.y() + dirtyRect.height()}; + UPDATELAYEREDWINDOWINFO info = {sizeof(info), NULL, &ptDst, &size, m_image->hdc(), &ptSrc, 0, &blend, ULW_ALPHA, &dirty}; + const BOOL result = UpdateLayeredWindowIndirect(rw->handle(), &info); + if (!result) + qErrnoWarning("UpdateLayeredWindowIndirect failed for ptDst=(%d, %d)," + " size=(%dx%d), dirty=(%dx%d %d, %d)", r.x(), r.y(), + r.width(), r.height(), dirtyRect.width(), dirtyRect.height(), + dirtyRect.x(), dirtyRect.y()); } else { -#endif const HDC dc = rw->getDC(); if (!dc) { qErrnoWarning("%s: GetDC failed", __FUNCTION__); @@ -129,9 +123,7 @@ void QWindowsBackingStore::flush(QWindow *window, const QRegion ®ion, qErrnoWarning(int(lastError), "%s: BitBlt failed", __FUNCTION__); } rw->releaseDC(); -#ifndef Q_OS_WINCE } -#endif // Write image for debug purposes. if (QWindowsContext::verbose > 2 && lcQpaBackingStore().isDebugEnabled()) { @@ -175,7 +167,7 @@ void QWindowsBackingStore::resize(const QSize &size, const QRegion ®ion) staticRegion &= QRect(0, 0, newimg.width(), newimg.height()); QPainter painter(&newimg); painter.setCompositionMode(QPainter::CompositionMode_Source); - foreach (const QRect &rect, staticRegion.rects()) + for (const QRect &rect : staticRegion) painter.drawImage(rect, oldimg, rect); } @@ -190,10 +182,9 @@ bool QWindowsBackingStore::scroll(const QRegion &area, int dx, int dy) if (m_image.isNull() || m_image->image().isNull()) return false; - const QVector<QRect> rects = area.rects(); const QPoint offset(dx, dy); - for (int i = 0; i < rects.size(); ++i) - qt_scrollRectInImage(m_image->image(), rects.at(i), offset); + for (const QRect &rect : area) + qt_scrollRectInImage(m_image->image(), rect, offset); return true; } @@ -207,7 +198,7 @@ void QWindowsBackingStore::beginPaint(const QRegion ®ion) QPainter p(&m_image->image()); p.setCompositionMode(QPainter::CompositionMode_Source); const QColor blank = Qt::transparent; - foreach (const QRect &r, region.rects()) + for (const QRect &r : region) p.fillRect(r, blank); } } @@ -219,8 +210,6 @@ HDC QWindowsBackingStore::getDC() const return 0; } -#ifndef QT_NO_OPENGL - QImage QWindowsBackingStore::toImage() const { if (m_image.isNull()) { @@ -230,6 +219,4 @@ QImage QWindowsBackingStore::toImage() const return m_image.data()->image(); } -#endif // !QT_NO_OPENGL - QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsbackingstore.h b/src/plugins/platforms/windows/qwindowsbackingstore.h index 26c79348a9..5cd621375d 100644 --- a/src/plugins/platforms/windows/qwindowsbackingstore.h +++ b/src/plugins/platforms/windows/qwindowsbackingstore.h @@ -65,9 +65,7 @@ public: HDC getDC() const; -#ifndef QT_NO_OPENGL QImage toImage() const Q_DECL_OVERRIDE; -#endif private: QScopedPointer<QWindowsNativeImage> m_image; diff --git a/src/plugins/platforms/windows/qwindowsclipboard.cpp b/src/plugins/platforms/windows/qwindowsclipboard.cpp index d527e07308..21bc9d7377 100644 --- a/src/plugins/platforms/windows/qwindowsclipboard.cpp +++ b/src/plugins/platforms/windows/qwindowsclipboard.cpp @@ -237,8 +237,7 @@ void QWindowsClipboard::propagateClipboardMessage(UINT message, WPARAM wParam, L return; // In rare cases, a clipboard viewer can hang (application crashed, // suspended by a shell prompt 'Select' or debugger). - if (QWindowsContext::user32dll.isHungAppWindow - && QWindowsContext::user32dll.isHungAppWindow(m_nextClipboardViewer)) { + if (IsHungAppWindow(m_nextClipboardViewer)) { qWarning("Cowardly refusing to send clipboard message to hung application..."); return; } diff --git a/src/plugins/platforms/windows/qwindowscontext.cpp b/src/plugins/platforms/windows/qwindowscontext.cpp index efeb1f5f05..ef0962c2ff 100644 --- a/src/plugins/platforms/windows/qwindowscontext.cpp +++ b/src/plugins/platforms/windows/qwindowscontext.cpp @@ -51,7 +51,7 @@ #ifndef QT_NO_ACCESSIBILITY # include "accessible/qwindowsaccessibility.h" #endif -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) # include <private/qsessionmanager_p.h> # include "qwindowssessionmanager.h" #endif @@ -76,9 +76,7 @@ #include <stdlib.h> #include <stdio.h> #include <windowsx.h> -#ifndef Q_OS_WINCE -# include <comdef.h> -#endif +#include <comdef.h> QT_BEGIN_NAMESPACE @@ -99,45 +97,29 @@ int QWindowsContext::verbose = 0; # define LANG_SYRIAC 0x5a #endif -static inline bool useRTL_Extensions(QSysInfo::WinVersion ver) +static inline bool useRTL_Extensions() { - // This is SDK dependent on CE so out of scope for now - if (QSysInfo::windowsVersion() & QSysInfo::WV_CE_based) - return false; - if ((ver & QSysInfo::WV_NT_based) && (ver >= QSysInfo::WV_VISTA)) { - // Since the IsValidLanguageGroup/IsValidLocale functions always return true on - // Vista, check the Keyboard Layouts for enabling RTL. - if (const int nLayouts = GetKeyboardLayoutList(0, 0)) { - QScopedArrayPointer<HKL> lpList(new HKL[nLayouts]); - GetKeyboardLayoutList(nLayouts, lpList.data()); - for (int i = 0; i < nLayouts; ++i) { - switch (PRIMARYLANGID((quintptr)lpList[i])) { - case LANG_ARABIC: - case LANG_HEBREW: - case LANG_FARSI: - case LANG_SYRIAC: - return true; - default: - break; - } + // Since the IsValidLanguageGroup/IsValidLocale functions always return true on + // Vista, check the Keyboard Layouts for enabling RTL. + if (const int nLayouts = GetKeyboardLayoutList(0, 0)) { + QScopedArrayPointer<HKL> lpList(new HKL[nLayouts]); + GetKeyboardLayoutList(nLayouts, lpList.data()); + for (int i = 0; i < nLayouts; ++i) { + switch (PRIMARYLANGID((quintptr)lpList[i])) { + case LANG_ARABIC: + case LANG_HEBREW: + case LANG_FARSI: + case LANG_SYRIAC: + return true; + default: + break; } } - return false; - } // NT/Vista -#ifndef Q_OS_WINCE - // Pre-NT: figure out whether a RTL language is installed - return IsValidLanguageGroup(LGRPID_ARABIC, LGRPID_INSTALLED) - || IsValidLanguageGroup(LGRPID_HEBREW, LGRPID_INSTALLED) - || IsValidLocale(MAKELCID(MAKELANGID(LANG_ARABIC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED) - || IsValidLocale(MAKELCID(MAKELANGID(LANG_HEBREW, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED) - || IsValidLocale(MAKELCID(MAKELANGID(LANG_SYRIAC, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED) - || IsValidLocale(MAKELCID(MAKELANGID(LANG_FARSI, SUBLANG_DEFAULT), SORT_DEFAULT), LCID_INSTALLED); -#else + } return false; -#endif } -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) static inline QWindowsSessionManager *platformSessionManager() { QGuiApplicationPrivate *guiPrivate = static_cast<QGuiApplicationPrivate*>(QObjectPrivate::get(qApp)); QSessionManagerPrivate *managerPrivate = static_cast<QSessionManagerPrivate*>(QObjectPrivate::get(guiPrivate->session_manager)); @@ -160,13 +142,8 @@ static inline QWindowsSessionManager *platformSessionManager() { \internal \ingroup qt-lighthouse-win */ - -#ifndef Q_OS_WINCE - QWindowsUser32DLL::QWindowsUser32DLL() : - setLayeredWindowAttributes(0), updateLayeredWindow(0), - updateLayeredWindowIndirect(0), - isHungAppWindow(0), isTouchWindow(0), + isTouchWindow(0), registerTouchWindow(0), unregisterTouchWindow(0), getTouchInputInfo(0), closeTouchInputHandle(0), setProcessDPIAware(0), addClipboardFormatListener(0), removeClipboardFormatListener(0), @@ -177,20 +154,11 @@ QWindowsUser32DLL::QWindowsUser32DLL() : void QWindowsUser32DLL::init() { QSystemLibrary library(QStringLiteral("user32")); - // MinGW (g++ 3.4.5) accepts only C casts. - setLayeredWindowAttributes = (SetLayeredWindowAttributes)(library.resolve("SetLayeredWindowAttributes")); - updateLayeredWindow = (UpdateLayeredWindow)(library.resolve("UpdateLayeredWindow")); - if (Q_UNLIKELY(!setLayeredWindowAttributes || !updateLayeredWindow)) - qFatal("This version of Windows is not supported (User32.dll is missing the symbols 'SetLayeredWindowAttributes', 'UpdateLayeredWindow')."); - - updateLayeredWindowIndirect = (UpdateLayeredWindowIndirect)(library.resolve("UpdateLayeredWindowIndirect")); - isHungAppWindow = (IsHungAppWindow)library.resolve("IsHungAppWindow"); setProcessDPIAware = (SetProcessDPIAware)library.resolve("SetProcessDPIAware"); - if (QSysInfo::windowsVersion() >= QSysInfo::WV_VISTA) { - addClipboardFormatListener = (AddClipboardFormatListener)library.resolve("AddClipboardFormatListener"); - removeClipboardFormatListener = (RemoveClipboardFormatListener)library.resolve("RemoveClipboardFormatListener"); - } + addClipboardFormatListener = (AddClipboardFormatListener)library.resolve("AddClipboardFormatListener"); + removeClipboardFormatListener = (RemoveClipboardFormatListener)library.resolve("RemoveClipboardFormatListener"); + getDisplayAutoRotationPreferences = (GetDisplayAutoRotationPreferences)library.resolve("GetDisplayAutoRotationPreferences"); setDisplayAutoRotationPreferences = (SetDisplayAutoRotationPreferences)library.resolve("SetDisplayAutoRotationPreferences"); } @@ -208,38 +176,6 @@ bool QWindowsUser32DLL::initTouch() return isTouchWindow && registerTouchWindow && unregisterTouchWindow && getTouchInputInfo && closeTouchInputHandle; } -/*! - \class QWindowsShell32DLL - \brief Struct that contains dynamically resolved symbols of Shell32.dll. - - The stub libraries shipped with the MinGW compiler miss some of the - functions. They need to be retrieved dynamically. - - \sa QWindowsUser32DLL - - \internal - \ingroup qt-lighthouse-win -*/ - -QWindowsShell32DLL::QWindowsShell32DLL() - : sHCreateItemFromParsingName(0) - , sHGetKnownFolderIDList(0) - , sHGetStockIconInfo(0) - , sHGetImageList(0) - , sHCreateItemFromIDList(0) -{ -} - -void QWindowsShell32DLL::init() -{ - QSystemLibrary library(QStringLiteral("shell32")); - sHCreateItemFromParsingName = (SHCreateItemFromParsingName)(library.resolve("SHCreateItemFromParsingName")); - sHGetKnownFolderIDList = (SHGetKnownFolderIDList)(library.resolve("SHGetKnownFolderIDList")); - sHGetStockIconInfo = (SHGetStockIconInfo)library.resolve("SHGetStockIconInfo"); - sHGetImageList = (SHGetImageList)library.resolve("SHGetImageList"); - sHCreateItemFromIDList = (SHCreateItemFromIDList)library.resolve("SHCreateItemFromIDList"); -} - QWindowsShcoreDLL::QWindowsShcoreDLL() : getProcessDpiAwareness(0) , setProcessDpiAwareness(0) @@ -258,11 +194,8 @@ void QWindowsShcoreDLL::init() } QWindowsUser32DLL QWindowsContext::user32dll; -QWindowsShell32DLL QWindowsContext::shell32dll; QWindowsShcoreDLL QWindowsContext::shcoredll; -#endif // !Q_OS_WINCE - QWindowsContext *QWindowsContext::m_instance = 0; /*! @@ -291,7 +224,7 @@ struct QWindowsContextPrivate { QWindowsMimeConverter m_mimeConverter; QWindowsScreenManager m_screenManager; QSharedPointer<QWindowCreationContext> m_creationContext; -#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_TABLETEVENT) QScopedPointer<QWindowsTabletSupport> m_tabletSupport; #endif const HRESULT m_oleInitializeResult; @@ -306,18 +239,14 @@ QWindowsContextPrivate::QWindowsContextPrivate() , m_eventType(QByteArrayLiteral("windows_generic_MSG")) , m_lastActiveWindow(0), m_asyncExpose(0) { - const QSysInfo::WinVersion ver = QSysInfo::windowsVersion(); -#ifndef Q_OS_WINCE QWindowsContext::user32dll.init(); - QWindowsContext::shell32dll.init(); QWindowsContext::shcoredll.init(); if (m_mouseHandler.touchDevice() && QWindowsContext::user32dll.initTouch()) m_systemInfo |= QWindowsContext::SI_SupportsTouch; -#endif // !Q_OS_WINCE m_displayContext = GetDC(0); m_defaultDPI = GetDeviceCaps(m_displayContext, LOGPIXELSY); - if (useRTL_Extensions(ver)) { + if (useRTL_Extensions()) { m_systemInfo |= QWindowsContext::SI_RTL_Extensions; m_keyMapper.setUseRTLExtensions(true); } @@ -338,7 +267,7 @@ QWindowsContext::QWindowsContext() : const QByteArray bv = qgetenv("QT_QPA_VERBOSE"); if (!bv.isEmpty()) QLoggingCategory::setFilterRules(QString::fromLocal8Bit(bv)); -#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_TABLETEVENT) d->m_tabletSupport.reset(QWindowsTabletSupport::create()); qCDebug(lcQpaTablet) << "Tablet support: " << (d->m_tabletSupport.isNull() ? QStringLiteral("None") : d->m_tabletSupport->description()); #endif @@ -346,7 +275,7 @@ QWindowsContext::QWindowsContext() : QWindowsContext::~QWindowsContext() { -#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_TABLETEVENT) d->m_tabletSupport.reset(); // Destroy internal window before unregistering classes. #endif unregisterWindowClasses(); @@ -371,12 +300,10 @@ bool QWindowsContext::initTouch(unsigned integrationOptions) if (!touchDevice) return false; -#ifndef Q_OS_WINCE if (!QWindowsContext::user32dll.initTouch()) { delete touchDevice; return false; } -#endif // !Q_OS_WINCE if (!(integrationOptions & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch)) touchDevice->setCapabilities(touchDevice->capabilities() | QTouchDevice::MouseEmulation); @@ -389,7 +316,7 @@ bool QWindowsContext::initTouch(unsigned integrationOptions) void QWindowsContext::setTabletAbsoluteRange(int a) { -#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_TABLETEVENT) if (!d->m_tabletSupport.isNull()) d->m_tabletSupport->setAbsoluteRange(a); #else @@ -399,19 +326,16 @@ void QWindowsContext::setTabletAbsoluteRange(int a) int QWindowsContext::processDpiAwareness() { -#ifndef Q_OS_WINCE int result; if (QWindowsContext::shcoredll.getProcessDpiAwareness && SUCCEEDED(QWindowsContext::shcoredll.getProcessDpiAwareness(NULL, &result))) { return result; } -#endif // !Q_OS_WINCE return -1; } void QWindowsContext::setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiAwareness) { -#ifndef Q_OS_WINCE qCDebug(lcQpaWindows) << __FUNCTION__ << dpiAwareness; if (QWindowsContext::shcoredll.isValid()) { const HRESULT hr = QWindowsContext::shcoredll.setProcessDpiAwareness(dpiAwareness); @@ -426,9 +350,6 @@ void QWindowsContext::setProcessDpiAwareness(QtWindows::ProcessDpiAwareness dpiA qErrnoWarning("SetProcessDPIAware() failed"); } } -#else // !Q_OS_WINCE - Q_UNUSED(dpiAwareness) -#endif } QWindowsContext *QWindowsContext::instance() @@ -559,19 +480,14 @@ QString QWindowsContext::registerWindowClass(QString cname, if (d->m_registeredWindowClassNames.contains(cname)) // already registered in our list return cname; -#ifndef Q_OS_WINCE WNDCLASSEX wc; wc.cbSize = sizeof(WNDCLASSEX); -#else - WNDCLASS wc; -#endif wc.style = style; wc.lpfnWndProc = proc; wc.cbClsExtra = 0; wc.cbWndExtra = 0; wc.hInstance = appInstance; wc.hCursor = 0; -#ifndef Q_OS_WINCE wc.hbrBackground = brush; if (icon) { wc.hIcon = static_cast<HICON>(LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE)); @@ -587,22 +503,10 @@ QString QWindowsContext::registerWindowClass(QString cname, wc.hIcon = 0; wc.hIconSm = 0; } -#else - if (icon) { - wc.hIcon = (HICON)LoadImage(appInstance, L"IDI_ICON1", IMAGE_ICON, 0, 0, LR_DEFAULTSIZE); - } else { - wc.hIcon = 0; - } -#endif wc.lpszMenuName = 0; wc.lpszClassName = reinterpret_cast<LPCWSTR>(cname.utf16()); -#ifndef Q_OS_WINCE ATOM atom = RegisterClassEx(&wc); -#else - ATOM atom = RegisterClass(&wc); -#endif - if (!atom) qErrnoWarning("QApplication::regClass: Registering window class '%s' failed.", qPrintable(cname)); @@ -720,28 +624,14 @@ static inline bool findPlatformWindowHelper(const POINT &screenPoint, unsigned c POINT point = screenPoint; ScreenToClient(*hwnd, &point); // Returns parent if inside & none matched. -#ifndef Q_OS_WINCE const HWND child = ChildWindowFromPointEx(*hwnd, point, cwexFlags); -#else -// Under Windows CE we don't use ChildWindowFromPointEx as it's not available -// and ChildWindowFromPoint does not work properly. - Q_UNUSED(cwexFlags) - const HWND child = WindowFromPoint(point); -#endif if (!child || child == *hwnd) return false; if (QWindowsWindow *window = context->findPlatformWindow(child)) { *result = window; *hwnd = child; -#ifndef Q_OS_WINCE return true; -#else -// WindowFromPoint does not return same handle in two sequential calls, which leads -// to an endless loop, but calling WindowFromPoint once is good enough. - return false; -#endif } -#ifndef Q_OS_WINCE // Does not have WS_EX_TRANSPARENT . // QTBUG-40555: despite CWP_SKIPINVISIBLE, it is possible to hit on invisible // full screen windows of other applications that have WS_EX_TRANSPARENT set // (for example created by screen sharing applications). In that case, try to @@ -757,7 +647,6 @@ static inline bool findPlatformWindowHelper(const POINT &screenPoint, unsigned c return true; } } -#endif // !Q_OS_WINCE *hwnd = child; return true; } @@ -784,7 +673,7 @@ QWindowsScreenManager &QWindowsContext::screenManager() QWindowsTabletSupport *QWindowsContext::tabletSupport() const { -#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_TABLETEVENT) return d->m_tabletSupport.data(); #else return 0; @@ -810,7 +699,6 @@ HWND QWindowsContext::createDummyWindow(const QString &classNameIn, HWND_MESSAGE, NULL, static_cast<HINSTANCE>(GetModuleHandle(0)), NULL); } -#ifndef Q_OS_WINCE // Re-engineered from the inline function _com_error::ErrorMessage(). // We cannot use it directly since it uses swprintf_s(), which is not // present in the MSVCRT.DLL found on Windows XP (QTBUG-35617). @@ -829,7 +717,6 @@ static inline QString errorMessageFromComError(const _com_error &comError) return QStringLiteral("IDispatch error #") + QString::number(wCode); return QStringLiteral("Unknown error 0x0") + QString::number(comError.Error(), 16); } -#endif // !Q_OS_WINCE /*! \brief Common COM error strings. @@ -894,12 +781,10 @@ QByteArray QWindowsContext::comErrorString(HRESULT hr) default: break; } -#ifndef Q_OS_WINCE _com_error error(hr); result += QByteArrayLiteral(" ("); result += errorMessageFromComError(error); result += ')'; -#endif // !Q_OS_WINCE return result; } @@ -935,9 +820,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, ClientToScreen(msg.hwnd, &msg.pt); } } else { -#ifndef Q_OS_WINCE GetCursorPos(&msg.pt); -#endif } // Run the native event filters. @@ -980,7 +863,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, switch (et) { case QtWindows::GestureEvent: -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result); #else return d->m_mouseHandler.translateGestureEvent(platformWindow->window(), hwnd, et, msg, result); @@ -1019,11 +902,9 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, // Pass on to current creation context if (!platformWindow && !d->m_creationContext.isNull()) { switch (et) { -#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO case QtWindows::QuerySizeHints: d->m_creationContext->applyToMinMaxInfo(reinterpret_cast<MINMAXINFO *>(lParam)); return true; -#endif case QtWindows::ResizeEvent: d->m_creationContext->obtainedGeometry.setSize(QSize(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam))); return true; @@ -1061,7 +942,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::InputMethodKeyEvent: case QtWindows::InputMethodKeyDownEvent: case QtWindows::AppCommandEvent: -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) return platformSessionManager()->isInteractionBlocked() ? true : d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result); #else return d->m_keyMapper.translateKeyEvent(platformWindow->window(), hwnd, msg, result); @@ -1072,7 +953,6 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::ResizeEvent: platformWindow->handleResized(static_cast<int>(wParam)); return true; -#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO case QtWindows::QuerySizeHints: platformWindow->getSizeHints(reinterpret_cast<MINMAXINFO *>(lParam)); return true;// maybe available on some SDKs revisit WM_NCCALCSIZE @@ -1082,30 +962,18 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, return platformWindow->handleNonClientHitTest(QPoint(msg.pt.x, msg.pt.y), result); case QtWindows::GeometryChangingEvent: return platformWindow->QWindowsWindow::handleGeometryChanging(&msg); -#endif // !Q_OS_WINCE case QtWindows::ExposeEvent: return platformWindow->handleWmPaint(hwnd, message, wParam, lParam); case QtWindows::NonClientMouseEvent: if (platformWindow->frameStrutEventsEnabled()) -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); #else return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); #endif break; -/* the mouse tracking on windows already handles the reset of the cursor - * and does not like somebody else handling it. - * on WINCE its necessary to handle this event to get the correct cursor - */ -#ifdef Q_OS_WINCE - case QtWindows::CursorEvent: - { - QWindowsWindow::baseWindowOf(platformWindow->window())->applyCursor(); - return true; - } -#endif case QtWindows::ScrollEvent: -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateScrollEvent(platformWindow->window(), hwnd, msg, result); #else return d->m_mouseHandler.translateScrollEvent(platformWindow->window(), hwnd, msg, result); @@ -1113,13 +981,13 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::MouseWheelEvent: case QtWindows::MouseEvent: case QtWindows::LeaveEvent: -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); #else return d->m_mouseHandler.translateMouseEvent(platformWindow->window(), hwnd, et, msg, result); #endif case QtWindows::TouchEvent: -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) return platformSessionManager()->isInteractionBlocked() ? true : d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result); #else return d->m_mouseHandler.translateTouchEvent(platformWindow->window(), hwnd, et, msg, result); @@ -1152,7 +1020,6 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, case QtWindows::CompositionSettingsChanged: platformWindow->handleCompositionSettingsChanged(); return true; -#ifndef Q_OS_WINCE case QtWindows::ActivateWindowEvent: if (platformWindow->window()->flags() & Qt::WindowDoesNotAcceptFocus) { *result = LRESULT(MA_NOACTIVATE); @@ -1175,7 +1042,6 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, return true; } break; -#endif #ifndef QT_NO_CONTEXTMENU case QtWindows::ContextMenu: return handleContextMenuEvent(platformWindow->window(), msg); @@ -1186,7 +1052,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, return true; #endif } break; -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) case QtWindows::QueryEndSessionApplicationEvent: { QWindowsSessionManager *sessionManager = platformSessionManager(); if (sessionManager->isActive()) { // bogus message from windows @@ -1226,7 +1092,7 @@ bool QWindowsContext::windowsProc(HWND hwnd, UINT message, } return true; } -#endif // !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#endif // !defined(QT_NO_SESSIONMANAGER) default: break; } diff --git a/src/plugins/platforms/windows/qwindowscontext.h b/src/plugins/platforms/windows/qwindowscontext.h index 3559335747..32d7800ef5 100644 --- a/src/plugins/platforms/windows/qwindowscontext.h +++ b/src/plugins/platforms/windows/qwindowscontext.h @@ -79,38 +79,23 @@ class QPoint; class QKeyEvent; class QTouchDevice; -#ifndef Q_OS_WINCE struct QWindowsUser32DLL { QWindowsUser32DLL(); inline void init(); inline bool initTouch(); - typedef BOOL (WINAPI *IsTouchWindow)(HWND, PULONG); + typedef BOOL (WINAPI *IsTouchWindow)(HWND, PULONG); // Windows 7 typedef BOOL (WINAPI *RegisterTouchWindow)(HWND, ULONG); typedef BOOL (WINAPI *UnregisterTouchWindow)(HWND); typedef BOOL (WINAPI *GetTouchInputInfo)(HANDLE, UINT, PVOID, int); typedef BOOL (WINAPI *CloseTouchInputHandle)(HANDLE); - typedef BOOL (WINAPI *SetLayeredWindowAttributes)(HWND, COLORREF, BYTE, DWORD); - typedef BOOL (WINAPI *UpdateLayeredWindow)(HWND, HDC , const POINT *, - const SIZE *, HDC, const POINT *, COLORREF, - const BLENDFUNCTION *, DWORD); - typedef BOOL (WINAPI *UpdateLayeredWindowIndirect)(HWND, const UPDATELAYEREDWINDOWINFO *); - typedef BOOL (WINAPI *IsHungAppWindow)(HWND); typedef BOOL (WINAPI *SetProcessDPIAware)(); typedef BOOL (WINAPI *AddClipboardFormatListener)(HWND); typedef BOOL (WINAPI *RemoveClipboardFormatListener)(HWND); typedef BOOL (WINAPI *GetDisplayAutoRotationPreferences)(DWORD *); typedef BOOL (WINAPI *SetDisplayAutoRotationPreferences)(DWORD); - // Functions missing in Q_CC_GNU stub libraries. - SetLayeredWindowAttributes setLayeredWindowAttributes; - UpdateLayeredWindow updateLayeredWindow; - - // Functions missing in older versions of Windows - UpdateLayeredWindowIndirect updateLayeredWindowIndirect; - IsHungAppWindow isHungAppWindow; - // Touch functions from Windows 7 onwards (also for use with Q_CC_MSVC). IsTouchWindow isTouchWindow; RegisterTouchWindow registerTouchWindow; @@ -121,7 +106,8 @@ struct QWindowsUser32DLL // Windows Vista onwards SetProcessDPIAware setProcessDPIAware; - // Clipboard listeners, Windows Vista onwards + // Clipboard listeners are present on Windows Vista onwards + // but missing in MinGW 4.9 stub libs. Can be removed in MinGW 5. AddClipboardFormatListener addClipboardFormatListener; RemoveClipboardFormatListener removeClipboardFormatListener; @@ -130,24 +116,6 @@ struct QWindowsUser32DLL SetDisplayAutoRotationPreferences setDisplayAutoRotationPreferences; }; -struct QWindowsShell32DLL -{ - QWindowsShell32DLL(); - inline void init(); - - typedef HRESULT (WINAPI *SHCreateItemFromParsingName)(PCWSTR, IBindCtx *, const GUID&, void **); - typedef HRESULT (WINAPI *SHGetKnownFolderIDList)(const GUID &, DWORD, HANDLE, PIDLIST_ABSOLUTE *); - typedef HRESULT (WINAPI *SHGetStockIconInfo)(int , int , _SHSTOCKICONINFO *); - typedef HRESULT (WINAPI *SHGetImageList)(int, REFIID , void **); - typedef HRESULT (WINAPI *SHCreateItemFromIDList)(PCIDLIST_ABSOLUTE, REFIID, void **); - - SHCreateItemFromParsingName sHCreateItemFromParsingName; - SHGetKnownFolderIDList sHGetKnownFolderIDList; - SHGetStockIconInfo sHGetStockIconInfo; - SHGetImageList sHGetImageList; - SHCreateItemFromIDList sHCreateItemFromIDList; -}; - // Shell scaling library (Windows 8.1 onwards) struct QWindowsShcoreDLL { QWindowsShcoreDLL(); @@ -163,8 +131,6 @@ struct QWindowsShcoreDLL { GetDpiForMonitor getDpiForMonitor; }; -#endif // Q_OS_WINCE - class QWindowsContext { Q_DISABLE_COPY(QWindowsContext) @@ -236,11 +202,9 @@ public: QWindowsMimeConverter &mimeConverter() const; QWindowsScreenManager &screenManager(); QWindowsTabletSupport *tabletSupport() const; -#ifndef Q_OS_WINCE + static QWindowsUser32DLL user32dll; - static QWindowsShell32DLL shell32dll; static QWindowsShcoreDLL shcoredll; -#endif static QByteArray comErrorString(HRESULT hr); bool asyncExpose() const; diff --git a/src/plugins/platforms/windows/qwindowscursor.cpp b/src/plugins/platforms/windows/qwindowscursor.cpp index d02648fade..1bebe88df7 100644 --- a/src/plugins/platforms/windows/qwindowscursor.cpp +++ b/src/plugins/platforms/windows/qwindowscursor.cpp @@ -56,7 +56,7 @@ static bool initResources() { -#if !defined (Q_OS_WINCE) && !defined (QT_NO_IMAGEFORMAT_PNG) +#if !defined (QT_NO_IMAGEFORMAT_PNG) Q_INIT_RESOURCE(cursors); #endif return true; @@ -143,7 +143,6 @@ static HCURSOR createBitmapCursor(const QImage &bbits, const QImage &mbits, if (hotSpot.y() < 0) hotSpot.setY(height / 2); const int n = qMax(1, width / 8); -#if !defined(Q_OS_WINCE) QScopedArrayPointer<uchar> xBits(new uchar[height * n]); QScopedArrayPointer<uchar> xMask(new uchar[height * n]); int x = 0; @@ -164,54 +163,6 @@ static HCURSOR createBitmapCursor(const QImage &bbits, const QImage &mbits, } return CreateCursor(GetModuleHandle(0), hotSpot.x(), hotSpot.y(), width, height, xBits.data(), xMask.data()); -#elif defined(GWES_ICONCURS) // Q_OS_WINCE - // Windows CE only supports fixed cursor size. - int sysW = GetSystemMetrics(SM_CXCURSOR); - int sysH = GetSystemMetrics(SM_CYCURSOR); - int sysN = qMax(1, sysW / 8); - uchar* xBits = new uchar[sysH * sysN]; - uchar* xMask = new uchar[sysH * sysN]; - int x = 0; - for (int i = 0; i < sysH; ++i) { - if (i >= height) { - memset(&xBits[x] , 255, sysN); - memset(&xMask[x] , 0, sysN); - x += sysN; - } else { - int fillWidth = n > sysN ? sysN : n; - const uchar *bits = bbits.constScanLine(i); - const uchar *mask = mbits.constScanLine(i); - for (int j = 0; j < fillWidth; ++j) { - uchar b = bits[j]; - uchar m = mask[j]; - if (invb) - b ^= 0xFF; - if (invm) - m ^= 0xFF; - xBits[x] = ~m; - xMask[x] = b ^ m; - ++x; - } - for (int j = fillWidth; j < sysN; ++j ) { - xBits[x] = 255; - xMask[x] = 0; - ++x; - } - } - } - - HCURSOR hcurs = CreateCursor(qWinAppInst(), hotSpot.x(), hotSpot.y(), sysW, sysH, - xBits, xMask); - delete [] xBits; - delete [] xMask; - return hcurs; -#else - Q_UNUSED(n); - Q_UNUSED(invm); - Q_UNUSED(invb); - Q_UNUSED(mbits); - return 0; -#endif } // Create a cursor from image and mask of the format QImage::Format_Mono. @@ -252,7 +203,7 @@ static QSize systemCursorSize(const QPlatformScreen *screen = Q_NULLPTR) return primaryScreenCursorSize; } -#if defined (Q_OS_WINCE) || defined (QT_NO_IMAGEFORMAT_PNG) +#if defined (QT_NO_IMAGEFORMAT_PNG) static inline QSize standardCursorSize() { return QSize(32, 32); } @@ -468,7 +419,7 @@ QWindowsCursor::PixmapCursor QWindowsCursor::customCursor(Qt::CursorShape cursor return QWindowsCursor::PixmapCursor(); } -#else // Q_OS_WINCE || QT_NO_IMAGEFORMAT_PNG +#else // QT_NO_IMAGEFORMAT_PNG struct QWindowsCustomPngCursor { Qt::CursorShape shape; int size; @@ -526,7 +477,7 @@ QWindowsCursor::PixmapCursor QWindowsCursor::customCursor(Qt::CursorShape cursor QString::fromLatin1(bestFit->fileName)); return PixmapCursor(rawImage, QPoint(bestFit->hotSpotX, bestFit->hotSpotY)); } -#endif // Q_OS_WINCE || QT_NO_IMAGEFORMAT_PNG +#endif // !QT_NO_IMAGEFORMAT_PNG struct QWindowsStandardCursorMapping { Qt::CursorShape shape; @@ -575,13 +526,8 @@ HCURSOR QWindowsCursor::createCursorFromShape(Qt::CursorShape cursorShape, const // Load available standard cursors from resources const QWindowsStandardCursorMapping *sEnd = standardCursors + sizeof(standardCursors) / sizeof(standardCursors[0]); for (const QWindowsStandardCursorMapping *s = standardCursors; s < sEnd; ++s) { - if (s->shape == cursorShape) { -#ifndef Q_OS_WINCE + if (s->shape == cursorShape) return static_cast<HCURSOR>(LoadImage(0, s->resource, IMAGE_CURSOR, 0, 0, LR_DEFAULTSIZE | LR_SHARED)); -#else - return LoadCursor(0, s->resource); -#endif - } } qWarning("%s: Invalid cursor shape %d", __FUNCTION__, cursorShape); @@ -677,7 +623,6 @@ QPoint QWindowsCursor::mousePosition() QWindowsCursor::CursorState QWindowsCursor::cursorState() { -#ifndef Q_OS_WINCE enum { cursorShowing = 0x1, cursorSuppressed = 0x2 }; // Windows 8: CURSOR_SUPPRESSED CURSORINFO cursorInfo; cursorInfo.cbSize = sizeof(CURSORINFO); @@ -687,7 +632,6 @@ QWindowsCursor::CursorState QWindowsCursor::cursorState() if (cursorInfo.flags & cursorSuppressed) return CursorSuppressed; } -#endif // !Q_OS_WINCE return CursorHidden; } @@ -758,7 +702,6 @@ QPixmap QWindowsCursor::dragDefaultCursor(Qt::DropAction action) const "...............XXXX....."}; if (m_ignoreDragCursor.isNull()) { -#if !defined (Q_OS_WINCE) HCURSOR cursor = LoadCursor(NULL, IDC_NO); ICONINFO iconInfo = {0, 0, 0, 0, 0}; GetIconInfo(cursor, &iconInfo); @@ -782,9 +725,6 @@ QPixmap QWindowsCursor::dragDefaultCursor(Qt::DropAction action) const DeleteObject(iconInfo.hbmMask); DeleteObject(iconInfo.hbmColor); DestroyCursor(cursor); -#else // !Q_OS_WINCE - m_ignoreDragCursor = QPixmap(ignoreDragCursorXpmC); -#endif // !Q_OS_WINCE } return m_ignoreDragCursor; } diff --git a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp index d5e5f87e5c..a237013c87 100644 --- a/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp +++ b/src/plugins/platforms/windows/qwindowsdialoghelpers.cpp @@ -637,7 +637,6 @@ void QWindowsDialogHelperBase<BaseClass>::stopTimer() } } -#ifndef Q_OS_WINCE // Find a file dialog window created by IFileDialog by process id, window // title and class, which starts with a hash '#'. @@ -673,7 +672,6 @@ static inline HWND findDialogWindow(const QString &title) EnumWindows(findDialogEnumWindowsProc, reinterpret_cast<LPARAM>(&context)); return context.hwnd; } -#endif // !Q_OS_WINCE template <class BaseClass> void QWindowsDialogHelperBase<BaseClass>::hide() @@ -989,24 +987,19 @@ void QWindowsNativeFileDialogBase::setWindowTitle(const QString &title) IShellItem *QWindowsNativeFileDialogBase::shellItem(const QUrl &url) { -#ifndef Q_OS_WINCE if (url.isLocalFile()) { - if (!QWindowsContext::shell32dll.sHCreateItemFromParsingName) - return Q_NULLPTR; IShellItem *result = Q_NULLPTR; const QString native = QDir::toNativeSeparators(url.toLocalFile()); const HRESULT hr = - QWindowsContext::shell32dll.sHCreateItemFromParsingName(reinterpret_cast<const wchar_t *>(native.utf16()), - NULL, IID_IShellItem, - reinterpret_cast<void **>(&result)); + SHCreateItemFromParsingName(reinterpret_cast<const wchar_t *>(native.utf16()), + NULL, IID_IShellItem, + reinterpret_cast<void **>(&result)); if (FAILED(hr)) { qErrnoWarning("%s: SHCreateItemFromParsingName(%s)) failed", __FUNCTION__, qPrintable(url.toString())); return Q_NULLPTR; } return result; } else if (url.scheme() == QLatin1String("clsid")) { - if (!QWindowsContext::shell32dll.sHGetKnownFolderIDList || !QWindowsContext::shell32dll.sHCreateItemFromIDList) - return Q_NULLPTR; // Support for virtual folders via GUID // (see https://msdn.microsoft.com/en-us/library/windows/desktop/dd378457(v=vs.85).aspx) // specified as "clsid:<GUID>" (without '{', '}'). @@ -1017,12 +1010,12 @@ IShellItem *QWindowsNativeFileDialogBase::shellItem(const QUrl &url) return Q_NULLPTR; } PIDLIST_ABSOLUTE idList; - HRESULT hr = QWindowsContext::shell32dll.sHGetKnownFolderIDList(uuid, 0, 0, &idList); + HRESULT hr = SHGetKnownFolderIDList(uuid, 0, 0, &idList); if (FAILED(hr)) { qErrnoWarning("%s: SHGetKnownFolderIDList(%s)) failed", __FUNCTION__, qPrintable(url.toString())); return Q_NULLPTR; } - hr = QWindowsContext::shell32dll.sHCreateItemFromIDList(idList, IID_IShellItem, reinterpret_cast<void **>(&result)); + hr = SHCreateItemFromIDList(idList, IID_IShellItem, reinterpret_cast<void **>(&result)); CoTaskMemFree(idList); if (FAILED(hr)) { qErrnoWarning("%s: SHCreateItemFromIDList(%s)) failed", __FUNCTION__, qPrintable(url.toString())); @@ -1032,9 +1025,6 @@ IShellItem *QWindowsNativeFileDialogBase::shellItem(const QUrl &url) } else { qWarning() << __FUNCTION__ << ": Unhandled scheme: " << url.scheme(); } -#else // !Q_OS_WINCE - Q_UNUSED(url) -#endif return 0; } @@ -1050,11 +1040,9 @@ void QWindowsNativeFileDialogBase::setDirectory(const QUrl &directory) QString QWindowsNativeFileDialogBase::directory() const { -#ifndef Q_OS_WINCE IShellItem *item = 0; if (m_fileDialog && SUCCEEDED(m_fileDialog->GetFolder(&item)) && item) return QWindowsNativeFileDialogBase::itemPath(item); -#endif return QString(); } @@ -1106,7 +1094,7 @@ void QWindowsNativeFileDialogBase::setMode(QFileDialogOptions::FileMode mode, qErrnoWarning("%s: SetOptions() failed", __FUNCTION__); } -#if !defined(Q_OS_WINCE) && defined(__IShellLibrary_INTERFACE_DEFINED__) // Windows SDK 7 +#if defined(__IShellLibrary_INTERFACE_DEFINED__) // Windows SDK 7 // Helper for "Libraries": collections of folders appearing from Windows 7 // on, visible in the file dialogs. @@ -1159,7 +1147,7 @@ QString QWindowsNativeFileDialogBase::libraryItemDefaultSaveFolder(IShellItem *i return result; } -#else // !Q_OS_WINCE && __IShellLibrary_INTERFACE_DEFINED__ +#else // __IShellLibrary_INTERFACE_DEFINED__ QList<QUrl> QWindowsNativeFileDialogBase::libraryItemFolders(IShellItem *) { @@ -1171,7 +1159,7 @@ QString QWindowsNativeFileDialogBase::libraryItemDefaultSaveFolder(IShellItem *) return QString(); } -#endif // Q_OS_WINCE || !__IShellLibrary_INTERFACE_DEFINED__ +#endif // !__IShellLibrary_INTERFACE_DEFINED__ QString QWindowsNativeFileDialogBase::itemPath(IShellItem *item) { @@ -1417,14 +1405,12 @@ bool QWindowsNativeFileDialogBase::onFileOk() void QWindowsNativeFileDialogBase::close() { m_fileDialog->Close(S_OK); -#ifndef Q_OS_WINCE // IFileDialog::Close() does not work unless invoked from a callback. // Try to find the window and send it a WM_CLOSE in addition. const HWND hwnd = findDialogWindow(m_title); qCDebug(lcQpaDialogs) << __FUNCTION__ << "closing" << hwnd; if (hwnd && IsWindowVisible(hwnd)) PostMessageW(hwnd, WM_CLOSE, 0, 0); -#endif // !Q_OS_WINCE } HRESULT QWindowsNativeFileDialogEventHandler::OnFolderChanging(IFileDialog *, IShellItem *item) @@ -1725,8 +1711,6 @@ QString QWindowsFileDialogHelper::selectedNameFilter() const return m_data.selectedNameFilter(); } -#ifndef Q_OS_WINCE - /*! \class QWindowsXpNativeFileDialog \brief Native Windows directory dialog for Windows XP using SHlib-functions. @@ -2050,8 +2034,6 @@ QString QWindowsXpFileDialogHelper::selectedNameFilter() const return m_data.selectedNameFilter(); } -#endif // Q_OS_WINCE - /*! \class QWindowsNativeColorDialog \brief Native Windows color dialog. @@ -2209,17 +2191,13 @@ QPlatformDialogHelper *createHelper(QPlatformTheme::DialogType type) if (QWindowsIntegration::instance()->options() & QWindowsIntegration::NoNativeDialogs) return 0; switch (type) { - case QPlatformTheme::FileDialog: -#ifndef Q_OS_WINCE // Note: "Windows XP Professional x64 Edition has version number WV_5_2 (WV_2003). + case QPlatformTheme::FileDialog: // Note: "Windows XP Professional x64 Edition has version number WV_5_2 (WV_2003). if (QWindowsIntegration::instance()->options() & QWindowsIntegration::XpNativeDialogs || QSysInfo::windowsVersion() <= QSysInfo::WV_2003) { return new QWindowsXpFileDialogHelper(); } if (QSysInfo::windowsVersion() > QSysInfo::WV_2003) return new QWindowsFileDialogHelper(); -#else - return new QWindowsFileDialogHelper(); -#endif // Q_OS_WINCE case QPlatformTheme::ColorDialog: #ifdef USE_NATIVE_COLOR_DIALOG return new QWindowsColorDialogHelper(); diff --git a/src/plugins/platforms/windows/qwindowseglcontext.cpp b/src/plugins/platforms/windows/qwindowseglcontext.cpp index a3f9f0b44b..23a6f35576 100644 --- a/src/plugins/platforms/windows/qwindowseglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowseglcontext.cpp @@ -95,13 +95,9 @@ static void *resolveFunc(HMODULE lib, const char *name) return proc; } #else -static void *resolveFunc(HMODULE lib, const char *name) +static inline void *resolveFunc(HMODULE lib, const char *name) { -# ifndef Q_OS_WINCE - return (void *) ::GetProcAddress(lib, name); -# else - return (void *) ::GetProcAddress(lib, (const wchar_t *) QString::fromLatin1(name).utf16()); -# endif // Q_OS_WINCE + return ::GetProcAddress(lib, name); } #endif // Q_CC_MINGW @@ -121,7 +117,7 @@ void *QWindowsLibEGL::resolve(const char *name) bool QWindowsLibEGL::init() { const char dllName[] = QT_STRINGIFY(LIBEGL_NAME) -#if defined(QT_DEBUG) && !defined(Q_OS_WINCE) +#if defined(QT_DEBUG) "d" #endif ""; @@ -178,7 +174,7 @@ bool QWindowsLibGLESv2::init() { const char dllName[] = QT_STRINGIFY(LIBGLESV2_NAME) -#if defined(QT_DEBUG) && !defined(Q_OS_WINCE) +#if defined(QT_DEBUG) "d" #endif ""; diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp index 68a8fc5390..be183034de 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase.cpp @@ -57,10 +57,6 @@ #include <wchar.h> -#ifdef Q_OS_WINCE -# include "qplatformfunctions_wince.h" -#endif - #if !defined(QT_NO_DIRECTWRITE) # if defined(QT_USE_DIRECTWRITE2) # include <dwrite_2.h> @@ -947,17 +943,6 @@ static bool addFontToDatabase(const QString &familyName, uchar charSet, quint32 codePageRange[2] = { signature->fsCsb[0], signature->fsCsb[1] }; -#ifdef Q_OS_WINCE - if (signature->fsUsb[0] == 0) { - // If the unicode ranges bit mask is zero then - // EnumFontFamiliesEx failed to determine it properly. - // In this case we just pretend that the font supports all languages. - unicodeRange[0] = 0xbfffffff; // second most significant bit must be zero - unicodeRange[1] = 0xffffffff; - unicodeRange[2] = 0xffffffff; - unicodeRange[3] = 0xffffffff; - } -#endif writingSystems = QPlatformFontDatabase::writingSystemsFromTrueTypeBits(unicodeRange, codePageRange); // ### Hack to work around problem with Thai text on Windows 7. Segoe UI contains // the symbol for Baht, and Windows thus reports that it supports the Thai script. @@ -1117,9 +1102,8 @@ QWindowsFontEngineDataPtr sharedFontData() } #endif // QT_NO_THREAD -#ifndef Q_OS_WINCE extern Q_GUI_EXPORT bool qt_needs_a8_gamma_correction; -#endif + QWindowsFontDatabase::QWindowsFontDatabase() { // Properties accessed by QWin32PrintEngine (Qt Print Support) @@ -1133,9 +1117,7 @@ QWindowsFontDatabase::QWindowsFontDatabase() qCDebug(lcQpaFonts) << __FUNCTION__ << "Clear type: " << data->clearTypeEnabled << "gamma: " << data->fontSmoothingGamma; } -#ifndef Q_OS_WINCE qt_needs_a8_gamma_correction = true; -#endif } QWindowsFontDatabase::~QWindowsFontDatabase() @@ -1586,14 +1568,12 @@ LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request) int strat = OUT_DEFAULT_PRECIS; if (request.styleStrategy & QFont::PreferBitmap) { strat = OUT_RASTER_PRECIS; -#ifndef Q_OS_WINCE } else if (request.styleStrategy & QFont::PreferDevice) { strat = OUT_DEVICE_PRECIS; } else if (request.styleStrategy & QFont::PreferOutline) { strat = OUT_OUTLINE_PRECIS; } else if (request.styleStrategy & QFont::ForceOutline) { strat = OUT_TT_ONLY_PRECIS; -#endif } lf.lfOutPrecision = strat; @@ -1602,10 +1582,8 @@ LOGFONT QWindowsFontDatabase::fontDefToLOGFONT(const QFontDef &request) if (request.styleStrategy & QFont::PreferMatch) qual = DRAFT_QUALITY; -#ifndef Q_OS_WINCE else if (request.styleStrategy & QFont::PreferQuality) qual = PROOF_QUALITY; -#endif if (request.styleStrategy & QFont::PreferAntialias) { if (QSysInfo::WindowsVersion >= QSysInfo::WV_XP && !(request.styleStrategy & QFont::NoSubpixelAntialias)) { diff --git a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp index fb75e75dcd..d782519c68 100644 --- a/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp +++ b/src/plugins/platforms/windows/qwindowsfontdatabase_ft.cpp @@ -53,10 +53,6 @@ #include <QtGui/QFontDatabase> #include <wchar.h> -#ifdef Q_OS_WINCE -#include <QtCore/QFile> -#include <QtEndian> -#endif QT_BEGIN_NAMESPACE @@ -108,8 +104,6 @@ static FontFile * createFontFile(const QString &fileName, int index) extern bool localizedName(const QString &name); extern QString getEnglishName(const QString &familyName); -#ifndef Q_OS_WINCE - namespace { struct FontKey { @@ -165,223 +159,6 @@ static const FontKey *findFontKey(const QString &name, int *indexIn = Q_NULLPTR) return Q_NULLPTR; } -#else // Q_OS_WINCE - -typedef struct { - quint16 majorVersion; - quint16 minorVersion; - quint16 numTables; - quint16 searchRange; - quint16 entrySelector; - quint16 rangeShift; -} OFFSET_TABLE; - -typedef struct { - quint32 tag; - quint32 checkSum; - quint32 offset; - quint32 length; -} TABLE_DIRECTORY; - -typedef struct { - quint16 fontSelector; - quint16 nrCount; - quint16 storageOffset; -} NAME_TABLE_HEADER; - -typedef struct { - quint16 platformID; - quint16 encodingID; - quint16 languageID; - quint16 nameID; - quint16 stringLength; - quint16 stringOffset; -} NAME_RECORD; - -typedef struct { - quint32 tag; - quint16 majorVersion; - quint16 minorVersion; - quint32 numFonts; -} TTC_TABLE_HEADER; - -static QString fontNameFromTTFile(const QString &filename, int startPos = 0) -{ - QFile f(filename); - QString retVal; - qint64 bytesRead; - qint64 bytesToRead; - - if (f.open(QIODevice::ReadOnly)) { - f.seek(startPos); - OFFSET_TABLE ttOffsetTable; - bytesToRead = sizeof(OFFSET_TABLE); - bytesRead = f.read((char*)&ttOffsetTable, bytesToRead); - if (bytesToRead != bytesRead) - return retVal; - ttOffsetTable.numTables = qFromBigEndian(ttOffsetTable.numTables); - ttOffsetTable.majorVersion = qFromBigEndian(ttOffsetTable.majorVersion); - ttOffsetTable.minorVersion = qFromBigEndian(ttOffsetTable.minorVersion); - - if (ttOffsetTable.majorVersion != 1 || ttOffsetTable.minorVersion != 0) - return retVal; - - TABLE_DIRECTORY tblDir; - bool found = false; - - for (int i = 0; i < ttOffsetTable.numTables; i++) { - bytesToRead = sizeof(TABLE_DIRECTORY); - bytesRead = f.read((char*)&tblDir, bytesToRead); - if (bytesToRead != bytesRead) - return retVal; - if (qFromBigEndian(tblDir.tag) == MAKE_TAG('n', 'a', 'm', 'e')) { - found = true; - tblDir.length = qFromBigEndian(tblDir.length); - tblDir.offset = qFromBigEndian(tblDir.offset); - break; - } - } - - if (found) { - f.seek(tblDir.offset); - NAME_TABLE_HEADER ttNTHeader; - bytesToRead = sizeof(NAME_TABLE_HEADER); - bytesRead = f.read((char*)&ttNTHeader, bytesToRead); - if (bytesToRead != bytesRead) - return retVal; - ttNTHeader.nrCount = qFromBigEndian(ttNTHeader.nrCount); - ttNTHeader.storageOffset = qFromBigEndian(ttNTHeader.storageOffset); - NAME_RECORD ttRecord; - found = false; - - for (int i = 0; i < ttNTHeader.nrCount; i++) { - bytesToRead = sizeof(NAME_RECORD); - bytesRead = f.read((char*)&ttRecord, bytesToRead); - if (bytesToRead != bytesRead) - return retVal; - ttRecord.nameID = qFromBigEndian(ttRecord.nameID); - if (ttRecord.nameID == 1) { - ttRecord.stringLength = qFromBigEndian(ttRecord.stringLength); - ttRecord.stringOffset = qFromBigEndian(ttRecord.stringOffset); - int nPos = f.pos(); - f.seek(tblDir.offset + ttRecord.stringOffset + ttNTHeader.storageOffset); - - QByteArray nameByteArray = f.read(ttRecord.stringLength); - if (!nameByteArray.isEmpty()) { - if (ttRecord.encodingID == 256 || ttRecord.encodingID == 768) { - //This is UTF-16 in big endian - int stringLength = ttRecord.stringLength / 2; - retVal.resize(stringLength); - QChar *data = retVal.data(); - const ushort *srcData = (const ushort *)nameByteArray.data(); - for (int i = 0; i < stringLength; ++i) - data[i] = qFromBigEndian(srcData[i]); - return retVal; - } else if (ttRecord.encodingID == 0) { - //This is Latin1 - retVal = QString::fromLatin1(nameByteArray); - } else { - qWarning("Could not retrieve Font name from file: %s", qPrintable(QDir::toNativeSeparators(filename))); - } - break; - } - f.seek(nPos); - } - } - } - f.close(); - } - return retVal; -} - -static QStringList fontNamesFromTTCFile(const QString &filename) -{ - QFile f(filename); - QStringList retVal; - qint64 bytesRead; - qint64 bytesToRead; - - if (f.open(QIODevice::ReadOnly)) { - TTC_TABLE_HEADER ttcTableHeader; - bytesToRead = sizeof(TTC_TABLE_HEADER); - bytesRead = f.read((char*)&ttcTableHeader, bytesToRead); - if (bytesToRead != bytesRead) - return retVal; - ttcTableHeader.majorVersion = qFromBigEndian(ttcTableHeader.majorVersion); - ttcTableHeader.minorVersion = qFromBigEndian(ttcTableHeader.minorVersion); - ttcTableHeader.numFonts = qFromBigEndian(ttcTableHeader.numFonts); - - if (ttcTableHeader.majorVersion < 1 || ttcTableHeader.majorVersion > 2) - return retVal; - QVarLengthArray<quint32> offsetTable(ttcTableHeader.numFonts); - bytesToRead = sizeof(quint32) * ttcTableHeader.numFonts; - bytesRead = f.read((char*)offsetTable.data(), bytesToRead); - if (bytesToRead != bytesRead) - return retVal; - f.close(); - for (int i = 0; i < (int)ttcTableHeader.numFonts; ++i) - retVal << fontNameFromTTFile(filename, qFromBigEndian(offsetTable[i])); - } - return retVal; -} - -static inline QString fontSettingsOrganization() { return QStringLiteral("Qt-Project"); } -static inline QString fontSettingsApplication() { return QStringLiteral("Qtbase"); } -static inline QString fontSettingsGroup() { return QStringLiteral("CEFontCache"); } - -static QString findFontFile(const QString &faceName) -{ - static QHash<QString, QString> fontCache; - - if (fontCache.isEmpty()) { - QSettings settings(QSettings::SystemScope, fontSettingsOrganization(), fontSettingsApplication()); - settings.beginGroup(fontSettingsGroup()); - foreach (const QString &fontName, settings.allKeys()) - fontCache.insert(fontName, settings.value(fontName).toString()); - settings.endGroup(); - } - - QString value = fontCache.value(faceName); - - //Fallback if we haven't cached the font yet or the font got removed/renamed iterate again over all fonts - if (value.isEmpty() || !QFile::exists(value)) { - QSettings settings(QSettings::SystemScope, fontSettingsOrganization(), fontSettingsApplication()); - settings.beginGroup(fontSettingsGroup()); - - //empty the cache first, as it seems that it is dirty - settings.remove(QString()); - - QDirIterator it(QStringLiteral("/Windows"), QStringList() << QStringLiteral("*.ttf") << QStringLiteral("*.ttc"), QDir::Files | QDir::Hidden | QDir::System); - const QLatin1Char lowerF('f'); - const QLatin1Char upperF('F'); - while (it.hasNext()) { - const QString fontFile = it.next(); - QStringList fontNames; - const QChar c = fontFile[fontFile.size() - 1]; - if (c == lowerF || c == upperF) - fontNames << fontNameFromTTFile(fontFile); - else - fontNames << fontNamesFromTTCFile(fontFile); - foreach (const QString fontName, fontNames) { - if (fontName.isEmpty()) - continue; - fontCache.insert(fontName, fontFile); - settings.setValue(fontName, fontFile); - - if (localizedName(fontName)) { - QString englishFontName = getEnglishName(fontName); - fontCache.insert(englishFontName, fontFile); - settings.setValue(englishFontName, fontFile); - } - } - } - settings.endGroup(); - value = fontCache.value(faceName); - } - return value; -} -#endif // Q_OS_WINCE - static bool addFontToDatabase(const QString &faceName, const QString &fullName, uchar charSet, @@ -453,7 +230,6 @@ static bool addFontToDatabase(const QString &faceName, } int index = 0; -#ifndef Q_OS_WINCE const FontKey *key = findFontKey(faceName, &index); if (!key) { key = findFontKey(fullName, &index); @@ -465,19 +241,11 @@ static bool addFontToDatabase(const QString &faceName, return false; } QString value = key->fileName; -#else - QString value = findFontFile(faceName); -#endif - if (value.isEmpty()) return false; if (!QDir::isAbsolutePath(value)) -#ifndef Q_OS_WINCE value.prepend(QFile::decodeName(qgetenv("windir") + "\\Fonts\\")); -#else - value.prepend(QFile::decodeName("/Windows/")); -#endif QPlatformFontDatabase::registerFont(faceName, QString(), foundryName, weight, style, stretch, antialias, scalable, size, fixed, writingSystems, createFontFile(value, index)); @@ -501,24 +269,6 @@ static bool addFontToDatabase(const QString &faceName, return true; } -#ifdef Q_OS_WINCE -static QByteArray getFntTable(HFONT hfont, uint tag) -{ - HDC hdc = GetDC(0); - HGDIOBJ oldFont = SelectObject(hdc, hfont); - quint32 t = qFromBigEndian<quint32>(tag); - QByteArray buffer; - - DWORD length = GetFontData(hdc, t, 0, NULL, 0); - if (length != GDI_ERROR) { - buffer.resize(length); - GetFontData(hdc, t, 0, reinterpret_cast<uchar *>(buffer.data()), length); - } - SelectObject(hdc, oldFont); - return buffer; -} -#endif - static int QT_WIN_CALLBACK storeFont(const LOGFONT *logFont, const TEXTMETRIC *textmetric, DWORD type, LPARAM) { @@ -576,8 +326,6 @@ struct PopulateFamiliesContext }; } // namespace -#ifndef Q_OS_WINCE - // Delayed population of font families static int QT_WIN_CALLBACK populateFontFamilies(const LOGFONT *logFont, const TEXTMETRIC *textmetric, @@ -633,74 +381,6 @@ void QWindowsFontDatabaseFT::populateFontDatabase() QPlatformFontDatabase::registerFontFamily(context.systemDefaultFont); } -#else // !Q_OS_WINCE - -// Non-delayed population of fonts (Windows CE). - -static int QT_WIN_CALLBACK populateFontCe(ENUMLOGFONTEX* f, NEWTEXTMETRICEX *textmetric, - int type, LPARAM lparam) -{ - // the "@family" fonts are just the same as "family". Ignore them. - const wchar_t *faceNameW = f->elfLogFont.lfFaceName; - if (faceNameW[0] && faceNameW[0] != L'@' && wcsncmp(faceNameW, L"WST_", 4)) { - const uchar charSet = f->elfLogFont.lfCharSet; - - FONTSIGNATURE signature; - QByteArray table; - - if (type & TRUETYPE_FONTTYPE) { - HFONT hfont = CreateFontIndirect(&f->elfLogFont); - table = getFntTable(hfont, MAKE_TAG('O', 'S', '/', '2')); - DeleteObject((HGDIOBJ)hfont); - } - - if (table.length() >= 86) { - // See also qfontdatabase_mac.cpp, offsets taken from OS/2 table in the TrueType spec - uchar *tableData = reinterpret_cast<uchar *>(table.data()); - - signature.fsUsb[0] = qFromBigEndian<quint32>(tableData + 42); - signature.fsUsb[1] = qFromBigEndian<quint32>(tableData + 46); - signature.fsUsb[2] = qFromBigEndian<quint32>(tableData + 50); - signature.fsUsb[3] = qFromBigEndian<quint32>(tableData + 54); - - signature.fsCsb[0] = qFromBigEndian<quint32>(tableData + 78); - signature.fsCsb[1] = qFromBigEndian<quint32>(tableData + 82); - } else { - memset(&signature, 0, sizeof(signature)); - } - - // NEWTEXTMETRICEX is a NEWTEXTMETRIC, which according to the documentation is - // identical to a TEXTMETRIC except for the last four members, which we don't use - // anyway - const QString faceName = QString::fromWCharArray(f->elfLogFont.lfFaceName); - if (addFontToDatabase(faceName, QString::fromWCharArray(f->elfFullName), - charSet, (TEXTMETRIC *)textmetric, &signature, type, true)) { - PopulateFamiliesContext *context = reinterpret_cast<PopulateFamiliesContext *>(lparam); - if (!context->seenSystemDefaultFont && faceName == context->systemDefaultFont) - context->seenSystemDefaultFont = true; - } - } - - // keep on enumerating - return 1; -} - -void QWindowsFontDatabaseFT::populateFontDatabase() -{ - LOGFONT lf; - lf.lfCharSet = DEFAULT_CHARSET; - HDC dummy = GetDC(0); - lf.lfFaceName[0] = 0; - lf.lfPitchAndFamily = 0; - PopulateFamiliesContext context(QWindowsFontDatabase::systemDefaultFont().family()); - EnumFontFamiliesEx(dummy, &lf, (FONTENUMPROC)populateFontCe, reinterpret_cast<LPARAM>(&context), 0); - ReleaseDC(0, dummy); - // Work around EnumFontFamiliesEx() not listing the system font, see below. - if (!context.seenSystemDefaultFont) - populateFamily(context.systemDefaultFont); -} -#endif // Q_OS_WINCE - QFontEngine * QWindowsFontDatabaseFT::fontEngine(const QFontDef &fontDef, void *handle) { QFontEngine *fe = QBasicFontDatabase::fontEngine(fontDef, handle); @@ -718,21 +398,8 @@ QFontEngine *QWindowsFontDatabaseFT::fontEngine(const QByteArray &fontData, qrea QStringList QWindowsFontDatabaseFT::fallbacksForFamily(const QString &family, QFont::Style style, QFont::StyleHint styleHint, QChar::Script script) const { QStringList result; - result.append(QWindowsFontDatabase::familyForStyleHint(styleHint)); - -#ifdef Q_OS_WINCE - QSettings settings(QLatin1String("HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\FontLink\\SystemLink"), QSettings::NativeFormat); - const QStringList fontList = settings.value(family).toStringList(); - foreach (const QString &fallback, fontList) { - const int sep = fallback.indexOf(QLatin1Char(',')); - if (sep > 0) - result << fallback.mid(sep + 1); - } -#endif - result.append(QWindowsFontDatabase::extraTryFontsForFamily(family)); - result.append(QBasicFontDatabase::fallbacksForFamily(family, style, styleHint, script)); qCDebug(lcQpaFonts) << __FUNCTION__ << family << style << styleHint diff --git a/src/plugins/platforms/windows/qwindowsfontengine.cpp b/src/plugins/platforms/windows/qwindowsfontengine.cpp index 806af6458b..0c213b933c 100644 --- a/src/plugins/platforms/windows/qwindowsfontengine.cpp +++ b/src/plugins/platforms/windows/qwindowsfontengine.cpp @@ -65,10 +65,6 @@ #include <limits.h> -#ifdef Q_OS_WINCE -# include "qplatformfunctions_wince.h" -#endif - #if !defined(QT_NO_DIRECTWRITE) # include <dwrite.h> #endif @@ -205,9 +201,6 @@ int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLa { int glyph_pos = 0; { -#if defined(Q_OS_WINCE) - { -#else if (symbol) { QStringIterator it(str, str + numChars); while (it.hasNext()) { @@ -225,7 +218,6 @@ int QWindowsFontEngine::getGlyphIndexes(const QChar *str, int numChars, QGlyphLa ++glyph_pos; } } else { -#endif QStringIterator it(str, str + numChars); while (it.hasNext()) { const uint uc = it.next(); @@ -329,21 +321,16 @@ QWindowsFontEngine::~QWindowsFontEngine() glyph_t QWindowsFontEngine::glyphIndex(uint ucs4) const { - glyph_t glyph; + glyph_t glyph = 0; -#if !defined(Q_OS_WINCE) if (symbol) { glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4); if (glyph == 0 && ucs4 < 0x100) glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4 + 0xf000); } else if (ttf) { glyph = getTrueTypeGlyphIndex(cmap, cmapSize, ucs4); - } else -#endif - if (ucs4 >= tm.tmFirstChar && ucs4 <= tm.tmLastChar) { + } else if (ucs4 >= tm.tmFirstChar && ucs4 <= tm.tmLastChar) { glyph = ucs4; - } else { - glyph = 0; } return glyph; @@ -377,12 +364,8 @@ bool QWindowsFontEngine::stringToCMap(const QChar *str, int len, QGlyphLayout *g inline void calculateTTFGlyphWidth(HDC hdc, UINT glyph, int &width) { -#if defined(Q_OS_WINCE) - GetCharWidth32(hdc, glyph, glyph, &width); -#else if (ptrGetCharWidthI) ptrGetCharWidthI(hdc, glyph, 1, 0, &width); -#endif } void QWindowsFontEngine::recalcAdvances(QGlyphLayout *glyphs, QFontEngine::ShaperFlags flags) const @@ -467,7 +450,7 @@ glyph_metrics_t QWindowsFontEngine::boundingBox(const QGlyphLayout &glyphs) return glyph_metrics_t(0, -tm.tmAscent, w - lastRightBearing(glyphs), tm.tmHeight, w, 0); } -#ifndef Q_OS_WINCE + bool QWindowsFontEngine::getOutlineMetrics(glyph_t glyph, const QTransform &t, glyph_metrics_t *metrics) const { Q_ASSERT(metrics != 0); @@ -520,11 +503,9 @@ bool QWindowsFontEngine::getOutlineMetrics(glyph_t glyph, const QTransform &t, g return false; } } -#endif glyph_metrics_t QWindowsFontEngine::boundingBox(glyph_t glyph, const QTransform &t) { -#ifndef Q_OS_WINCE HDC hdc = m_fontEngineData->hdc; SelectObject(hdc, hfont); @@ -542,34 +523,6 @@ glyph_metrics_t QWindowsFontEngine::boundingBox(glyph_t glyph, const QTransform } return glyphMetrics; -#else - HDC hdc = m_fontEngineData->hdc; - HGDIOBJ oldFont = SelectObject(hdc, hfont); - - ABC abc; - int width; - int advance; -#ifdef GWES_MGTT // true type fonts - if (GetCharABCWidths(hdc, glyph, glyph, &abc)) { - width = qAbs(abc.abcA) + abc.abcB + qAbs(abc.abcC); - advance = abc.abcA + abc.abcB + abc.abcC; - } - else -#endif -#if defined(GWES_MGRAST) || defined(GWES_MGRAST2) // raster fonts - if (GetCharWidth32(hdc, glyph, glyph, &width)) { - advance = width; - } - else -#endif - { // fallback - width = tm.tmMaxCharWidth; - advance = width; - } - - SelectObject(hdc, oldFont); - return glyph_metrics_t(0, -tm.tmAscent, width, tm.tmHeight, advance, 0).transformed(t); -#endif } QFixed QWindowsFontEngine::ascent() const @@ -636,22 +589,16 @@ void QWindowsFontEngine::getGlyphBearings(glyph_t glyph, qreal *leftBearing, qre HDC hdc = m_fontEngineData->hdc; SelectObject(hdc, hfont); -#ifndef Q_OS_WINCE - if (ttf) -#endif - { + if (ttf) { ABC abcWidths; GetCharABCWidthsI(hdc, glyph, 1, 0, &abcWidths); if (leftBearing) *leftBearing = abcWidths.abcA; if (rightBearing) *rightBearing = abcWidths.abcC; - } -#ifndef Q_OS_WINCE - else { + } else { QFontEngine::getGlyphBearings(glyph, leftBearing, rightBearing); } -#endif } #endif // Q_CC_MINGW @@ -670,7 +617,6 @@ qreal QWindowsFontEngine::minLeftBearing() const qreal QWindowsFontEngine::minRightBearing() const { -#ifndef Q_OS_WINCE if (rbearing == SHRT_MIN) { int ml = 0; int mr = 0; @@ -726,40 +672,6 @@ qreal QWindowsFontEngine::minRightBearing() const } return rbearing; -#else // !Q_OS_WINCE - if (rbearing == SHRT_MIN) { - int ml = 0; - int mr = 0; - HDC hdc = m_fontEngineData->hdc; - SelectObject(hdc, hfont); - if (ttf) { - ABC *abc = 0; - int n = tm.tmLastChar - tm.tmFirstChar; - if (n <= max_font_count) { - abc = new ABC[n+1]; - GetCharABCWidths(hdc, tm.tmFirstChar, tm.tmLastChar, abc); - } else { - abc = new ABC[char_table_entries+1]; - for (int i = 0; i < char_table_entries; i++) - GetCharABCWidths(hdc, char_table[i], char_table[i], abc+i); - n = char_table_entries; - } - ml = abc[0].abcA; - mr = abc[0].abcC; - for (int i = 1; i < n; i++) { - if (abc[i].abcA + abc[i].abcB + abc[i].abcC != 0) { - ml = qMin(ml,abc[i].abcA); - mr = qMin(mr,abc[i].abcC); - } - } - delete [] abc; - } - lbearing = ml; - rbearing = mr; - } - - return rbearing; -#endif // Q_OS_WINCE } static inline double qt_fixed_to_double(const FIXED &p) { @@ -786,7 +698,6 @@ static bool addGlyphToPath(glyph_t glyph, const QFixedPoint &position, HDC hdc, GLYPHMETRICS gMetric; memset(&gMetric, 0, sizeof(GLYPHMETRICS)); -#ifndef Q_OS_WINCE if (metric) { // If metrics requested, retrieve first using GGO_METRICS, because the returned // values are incorrect for OpenType PS fonts if obtained at the same time as the @@ -801,7 +712,6 @@ static bool addGlyphToPath(glyph_t glyph, const QFixedPoint &position, HDC hdc, int(gMetric.gmBlackBoxX), int(gMetric.gmBlackBoxY), gMetric.gmCellIncX, gMetric.gmCellIncY); } -#endif uint glyphFormat = GGO_NATIVE; @@ -820,15 +730,6 @@ static bool addGlyphToPath(glyph_t glyph, const QFixedPoint &position, HDC hdc, return false; } -#ifdef Q_OS_WINCE - if (metric) { - // #### obey scale - *metric = glyph_metrics_t(gMetric.gmptGlyphOrigin.x, -gMetric.gmptGlyphOrigin.y, - (int)gMetric.gmBlackBoxX, (int)gMetric.gmBlackBoxY, - gMetric.gmCellIncX, gMetric.gmCellIncY); - } -#endif - DWORD offset = 0; DWORD headerOffset = 0; @@ -1052,7 +953,6 @@ QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph, bool has_transformation = t.type() > QTransform::TxTranslate; -#ifndef Q_OS_WINCE unsigned int options = ttf ? ETO_GLYPH_INDEX : 0; XFORM xform; @@ -1095,13 +995,6 @@ QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph, xform.eDx -= tgm.gmptGlyphOrigin.x; xform.eDy += tgm.gmptGlyphOrigin.y; } -#else // else wince - unsigned int options = 0; - if (has_transformation) { - qWarning() << "QWindowsFontEngine is unable to apply transformations other than translations for fonts on Windows CE." - << "If you need them anyway, start your application with -platform windows:fontengine=freetype."; - } -#endif // wince // The padding here needs to be kept in sync with the values in alphaMapBoundingBox. QWindowsNativeImage *ni = new QWindowsNativeImage(iw + 2 * margin, @@ -1123,14 +1016,11 @@ QWindowsNativeImage *QWindowsFontEngine::drawGDIGlyph(HFONT font, glyph_t glyph, HGDIOBJ old_font = SelectObject(hdc, font); -#ifndef Q_OS_WINCE if (has_transformation) { SetGraphicsMode(hdc, GM_ADVANCED); SetWorldTransform(hdc, &xform); ExtTextOut(hdc, 0, 0, options, 0, reinterpret_cast<LPCWSTR>(&glyph), 1, 0); - } else -#endif // !Q_OS_WINCE - { + } else { ExtTextOut(hdc, -gx + margin, -gy + margin, options, 0, reinterpret_cast<LPCWSTR>(&glyph), 1, 0); } diff --git a/src/plugins/platforms/windows/qwindowsglcontext.cpp b/src/plugins/platforms/windows/qwindowsglcontext.cpp index cc2f05b6d1..48439e9523 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsglcontext.cpp @@ -149,15 +149,9 @@ QT_BEGIN_NAMESPACE QWindowsOpengl32DLL QOpenGLStaticContext::opengl32; -void *QWindowsOpengl32DLL::resolve(const char *name) +FARPROC QWindowsOpengl32DLL::resolve(const char *name) { -#ifndef Q_OS_WINCE - void *proc = m_lib ? (void *) ::GetProcAddress(m_lib, name) : 0; -#else - void *proc = m_lib ? (void *) ::GetProcAddress(m_lib, (const wchar_t *) QString::fromLatin1(name).utf16()) : 0; -#endif - - return proc; + return m_lib ? ::GetProcAddress(m_lib, name) : nullptr; } bool QWindowsOpengl32DLL::init(bool softwareRendering) diff --git a/src/plugins/platforms/windows/qwindowsglcontext.h b/src/plugins/platforms/windows/qwindowsglcontext.h index e8c78860f2..3ebf5b7bc2 100644 --- a/src/plugins/platforms/windows/qwindowsglcontext.h +++ b/src/plugins/platforms/windows/qwindowsglcontext.h @@ -122,7 +122,7 @@ struct QWindowsOpengl32DLL void (APIENTRY * glGetIntegerv)(GLenum pname, GLint* params); const GLubyte * (APIENTRY * glGetString)(GLenum name); - void *resolve(const char *name); + FARPROC resolve(const char *name); private: HMODULE m_lib; bool m_nonOpengl32; diff --git a/src/plugins/platforms/windows/qwindowsinputcontext.cpp b/src/plugins/platforms/windows/qwindowsinputcontext.cpp index 501b956a68..8adbd494c4 100644 --- a/src/plugins/platforms/windows/qwindowsinputcontext.cpp +++ b/src/plugins/platforms/windows/qwindowsinputcontext.cpp @@ -190,11 +190,7 @@ bool QWindowsInputContext::hasCapability(Capability capability) const { switch (capability) { case QPlatformInputContext::HiddenTextCapability: -#ifndef Q_OS_WINCE return false; // QTBUG-40691, do not show IME on desktop for password entry fields. -#else - break; // Windows CE: Show software keyboard. -#endif default: break; } diff --git a/src/plugins/platforms/windows/qwindowsintegration.cpp b/src/plugins/platforms/windows/qwindowsintegration.cpp index b524adb2cb..8a229db812 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.cpp +++ b/src/plugins/platforms/windows/qwindowsintegration.cpp @@ -64,7 +64,7 @@ #include <qpa/qplatformnativeinterface.h> #include <qpa/qwindowsysteminterface.h> -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#ifndef QT_NO_SESSIONMANAGER # include "qwindowssessionmanager.h" #endif #include <QtGui/qtouchdevice.h> @@ -102,7 +102,7 @@ QT_BEGIN_NAMESPACE It should compile with: \list - \li Microsoft Visual Studio 2008 or later (using the Microsoft Windows SDK, + \li Microsoft Visual Studio 2013 or later (using the Microsoft Windows SDK, (\c Q_CC_MSVC). \li Stock \l{http://mingw.org/}{MinGW} (\c Q_CC_MINGW). This version ships with headers that are missing a lot of WinAPI. @@ -112,7 +112,6 @@ QT_BEGIN_NAMESPACE (\c Q_CC_MINGW and \c __MINGW64_VERSION_MAJOR indicating the version). MinGW-w64 provides more complete headers (compared to stock MinGW from mingw.org), including a considerable part of the Windows SDK. - \li Visual Studio 2008 for Windows Embedded (\c Q_OS_WINCE). \endlist The file \c qtwindows_additional.h contains defines and declarations that @@ -214,9 +213,7 @@ QWindowsIntegrationPrivate::QWindowsIntegrationPrivate(const QStringList ¶mL : m_options(0) , m_fontDatabase(0) { -#ifndef Q_OS_WINCE Q_INIT_RESOURCE(openglblacklists); -#endif static bool dpiAwarenessSet = false; int tabletAbsoluteRange = -1; @@ -470,46 +467,16 @@ QWindowsStaticOpenGLContext *QWindowsIntegration::staticOpenGLContext() } #endif // !QT_NO_OPENGL -/* Workaround for QTBUG-24205: In 'Auto', pick the FreeType engine for - * QML2 applications. */ - -#ifdef Q_OS_WINCE -// It's not easy to detect if we are running a QML application -// Let's try to do so by checking if the Qt Quick module is loaded. -inline bool isQMLApplication() -{ - // check if the Qt Quick module is loaded -#ifdef _DEBUG - HMODULE handle = GetModuleHandle(L"Qt5Quick" QT_LIBINFIX L"d.dll"); -#else - HMODULE handle = GetModuleHandle(L"Qt5Quick" QT_LIBINFIX L".dll"); -#endif - return (handle != NULL); -} -#endif - QPlatformFontDatabase *QWindowsIntegration::fontDatabase() const { if (!d->m_fontDatabase) { #ifdef QT_NO_FREETYPE d->m_fontDatabase = new QWindowsFontDatabase(); #else // QT_NO_FREETYPE - if (d->m_options & QWindowsIntegration::FontDatabaseFreeType) { + if (d->m_options & QWindowsIntegration::FontDatabaseFreeType) d->m_fontDatabase = new QWindowsFontDatabaseFT; - } else if (d->m_options & QWindowsIntegration::FontDatabaseNative){ - d->m_fontDatabase = new QWindowsFontDatabase; - } else { -#ifndef Q_OS_WINCE + else d->m_fontDatabase = new QWindowsFontDatabase; -#else - if (isQMLApplication()) { - qCDebug(lcQpaFonts) << "QML application detected, using FreeType rendering"; - d->m_fontDatabase = new QWindowsFontDatabaseFT; - } - else - d->m_fontDatabase = new QWindowsFontDatabase; -#endif - } #endif // QT_NO_FREETYPE } return d->m_fontDatabase; @@ -597,7 +564,7 @@ unsigned QWindowsIntegration::options() const return d->m_options; } -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) QPlatformSessionManager *QWindowsIntegration::createPlatformSessionManager(const QString &id, const QString &key) const { return new QWindowsSessionManager(id, key); diff --git a/src/plugins/platforms/windows/qwindowsintegration.h b/src/plugins/platforms/windows/qwindowsintegration.h index 9658ef711d..437253cedc 100644 --- a/src/plugins/platforms/windows/qwindowsintegration.h +++ b/src/plugins/platforms/windows/qwindowsintegration.h @@ -104,7 +104,7 @@ public: void beep() const Q_DECL_OVERRIDE; -#if !defined(Q_OS_WINCE) && !defined(QT_NO_SESSIONMANAGER) +#if !defined(QT_NO_SESSIONMANAGER) QPlatformSessionManager *createPlatformSessionManager(const QString &id, const QString &key) const Q_DECL_OVERRIDE; #endif diff --git a/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp b/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp index 2dfe7fc5f9..21ebee6262 100644 --- a/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp +++ b/src/plugins/platforms/windows/qwindowsinternalmimedata.cpp @@ -39,7 +39,6 @@ #include "qwindowsinternalmimedata.h" #include "qwindowscontext.h" -#include "qplatformfunctions_wince.h" #include "qwindowsmime.h" #include <QDebug> /*! diff --git a/src/plugins/platforms/windows/qwindowskeymapper.cpp b/src/plugins/platforms/windows/qwindowskeymapper.cpp index 5b2370b69d..8d6e83298e 100644 --- a/src/plugins/platforms/windows/qwindowskeymapper.cpp +++ b/src/plugins/platforms/windows/qwindowskeymapper.cpp @@ -552,34 +552,6 @@ inline quint32 winceKeyBend(quint32 keyCode) return KeyTbl[keyCode]; } -#ifdef Q_OS_WINCE -QT_BEGIN_INCLUDE_NAMESPACE -int ToUnicode(UINT vk, int /*scancode*/, unsigned char* /*kbdBuffer*/, LPWSTR unicodeBuffer, int, int) -{ - QT_USE_NAMESPACE - QChar* buf = reinterpret_cast< QChar*>(unicodeBuffer); - if (KeyTbl[vk] == 0) { - buf[0] = vk; - return 1; - } - return 0; -} - -int ToAscii(UINT vk, int scancode, unsigned char *kbdBuffer, LPWORD unicodeBuffer, int flag) -{ - return ToUnicode(vk, scancode, kbdBuffer, (LPWSTR) unicodeBuffer, 0, flag); - -} - -bool GetKeyboardState(unsigned char* kbuffer) -{ - for (int i=0; i< 256; ++i) - kbuffer[i] = GetAsyncKeyState(i); - return true; -} -QT_END_INCLUDE_NAMESPACE -#endif // Q_OS_WINCE - // Translate a VK into a Qt key code, or unicode character static inline quint32 toKeyOrUnicode(quint32 vk, quint32 scancode, unsigned char *kbdBuffer, bool *isDeadkey = 0) { @@ -780,7 +752,6 @@ static void showSystemMenu(QWindow* w) if (!menu) return; // no menu for this window -#ifndef Q_OS_WINCE #define enabled (MF_BYCOMMAND | MF_ENABLED) #define disabled (MF_BYCOMMAND | MF_GRAYED) @@ -805,7 +776,6 @@ static void showSystemMenu(QWindow* w) #undef enabled #undef disabled -#endif // !Q_OS_WINCE const QPoint pos = QHighDpi::toNativePixels(topLevel->geometry().topLeft(), topLevel); const int ret = TrackPopupMenuEx(menu, TPM_LEFTALIGN | TPM_TOPALIGN | TPM_NONOTIFY | TPM_RETURNCMD, @@ -1172,7 +1142,6 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms modifiers, scancode, quint32(msg.wParam), nModifiers, text, false); result =true; bool store = true; -#ifndef Q_OS_WINCE // Alt+<alphanumerical> go to the Win32 menu system if unhandled by Qt if (msgType == WM_SYSKEYDOWN && !result && a) { HWND parent = GetParent(QWindowsWindow::handleOf(receiver)); @@ -1186,7 +1155,6 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms parent = GetParent(parent); } } -#endif // !Q_OS_WINCE if (!store) key_recorder.findKey(int(msg.wParam), true); } @@ -1216,7 +1184,6 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms nModifiers, (rec ? rec->text : QString()), false); result = true; -#ifndef Q_OS_WINCE // don't pass Alt to Windows unless we are embedded in a non-Qt window if (code == Qt::Key_Alt) { const QWindowsContext *context = QWindowsContext::instance(); @@ -1229,7 +1196,6 @@ bool QWindowsKeyMapper::translateKeyEventInternal(QWindow *window, const MSG &ms parent = GetParent(parent); } } -#endif } } return result; diff --git a/src/plugins/platforms/windows/qwindowsmime.cpp b/src/plugins/platforms/windows/qwindowsmime.cpp index cb112446fc..d6375693d8 100644 --- a/src/plugins/platforms/windows/qwindowsmime.cpp +++ b/src/plugins/platforms/windows/qwindowsmime.cpp @@ -403,11 +403,9 @@ QDebug operator<<(QDebug d, const FORMATETC &tc) case CF_UNICODETEXT: d << "CF_UNICODETEXT"; break; -#ifndef Q_OS_WINCE case CF_ENHMETAFILE: d << "CF_ENHMETAFILE"; break; -#endif // !Q_OS_WINCE default: d << QWindowsMimeConverter::clipboardFormatName(tc.cfFormat); break; diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.cpp b/src/plugins/platforms/windows/qwindowsmousehandler.cpp index 78fff65d84..fcba0d9e9b 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.cpp +++ b/src/plugins/platforms/windows/qwindowsmousehandler.cpp @@ -203,7 +203,6 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, Qt::MouseEventSource source = Qt::MouseEventNotSynthesized; -#ifndef Q_OS_WINCE // Check for events synthesized from touch. Lower byte is touch index, 0 means pen. static const bool passSynthesizedMouseEvents = !(QWindowsIntegration::instance()->options() & QWindowsIntegration::DontPassOsMouseEventsSynthesizedFromTouch); @@ -218,7 +217,6 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, return false; } } -#endif // !Q_OS_WINCE const QPoint winEventPosition(GET_X_LPARAM(msg.lParam), GET_Y_LPARAM(msg.lParam)); if (et & QtWindows::NonClientEventFlag) { @@ -320,7 +318,6 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, const bool hasCapture = platformWindow->hasMouseCapture(); const bool currentNotCapturing = hasCapture && currentWindowUnderMouse != window; -#ifndef Q_OS_WINCE // Enter new window: track to generate leave event. // If there is an active capture, only track if the current window is capturing, // so we don't get extra leave when cursor leaves the application. @@ -334,7 +331,6 @@ bool QWindowsMouseHandler::translateMouseEvent(QWindow *window, HWND hwnd, qWarning("TrackMouseEvent failed."); m_trackedWindow = window; } -#endif // !Q_OS_WINCE // No enter or leave events are sent as long as there is an autocapturing window. if (!hasCapture || !platformWindow->testFlag(QWindowsWindow::AutoMouseCapture)) { @@ -487,7 +483,6 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, QtWindows::WindowsEventType, MSG msg, LRESULT *) { -#ifndef Q_OS_WINCE typedef QWindowSystemInterface::TouchPoint QTouchPoint; typedef QList<QWindowSystemInterface::TouchPoint> QTouchPointList; @@ -563,109 +558,17 @@ bool QWindowsMouseHandler::translateTouchEvent(QWindow *window, HWND, QWindowSystemInterface::handleTouchEvent(window, m_touchDevice, touchPoints); -#else // !Q_OS_WINCE - Q_UNUSED(window) - Q_UNUSED(msg) -#endif return true; - } bool QWindowsMouseHandler::translateGestureEvent(QWindow *window, HWND hwnd, QtWindows::WindowsEventType, MSG msg, LRESULT *) { -#ifndef Q_OS_WINCE Q_UNUSED(window) Q_UNUSED(hwnd) Q_UNUSED(msg) return false; -#else // !Q_OS_WINCE - GESTUREINFO gi; - memset(&gi, 0, sizeof(GESTUREINFO)); - gi.cbSize = sizeof(GESTUREINFO); - - if (!GetGestureInfo((HGESTUREINFO)msg.lParam, &gi)) - return false; - - const QPoint position = QPoint(gi.ptsLocation.x, gi.ptsLocation.y); - - if (gi.dwID != GID_DIRECTMANIPULATION) - return true; - static QPoint lastTouchPos; - const QScreen *screen = window->screen(); - if (!screen) - screen = QGuiApplication::primaryScreen(); - if (!screen) - return true; - const QRect screenGeometry = screen->geometry(); - QWindowSystemInterface::TouchPoint touchPoint; - static QWindowSystemInterface::TouchPoint touchPoint2; - touchPoint.id = 0;//gi.dwInstanceID; - touchPoint.pressure = 1.0; - - if (gi.dwFlags & GF_BEGIN) - touchPoint.state = Qt::TouchPointPressed; - else if (gi.dwFlags & GF_END) - touchPoint.state = Qt::TouchPointReleased; - else if (gi.dwFlags == 0) - touchPoint.state = Qt::TouchPointMoved; - else - return true; - touchPoint2.pressure = 1.0; - touchPoint2.id = 1; - const QPoint winEventPosition = position; - const int deltaX = GID_DIRECTMANIPULATION_DELTA_X(gi.ullArguments); - const int deltaY = GID_DIRECTMANIPULATION_DELTA_Y(gi.ullArguments); - //Touch points are taken from the whole screen so map the position to the screen - const QPoint globalPosition = QWindowsGeometryHint::mapToGlobal(hwnd, winEventPosition); - const QPoint globalPosition2 = QWindowsGeometryHint::mapToGlobal(hwnd, QPoint(position.x() + deltaX, position.y() + deltaY)); - - touchPoint.normalPosition = - QPointF( (qreal)globalPosition.x() / screenGeometry.width(), (qreal)globalPosition.y() / screenGeometry.height() ); - - touchPoint.area.moveCenter(globalPosition); - - QList<QWindowSystemInterface::TouchPoint> pointList; - pointList.append(touchPoint); - if (deltaX != 0 && deltaY != 0) { - touchPoint2.state = m_had2ndTouchPoint ? Qt::TouchPointMoved : Qt::TouchPointPressed; - m_had2ndTouchPoint = true; - touchPoint2.normalPosition = - QPointF( (qreal)globalPosition2.x() / screenGeometry.width(), (qreal)globalPosition2.y() / screenGeometry.height() ); - - touchPoint2.area.moveCenter(globalPosition2); - lastTouchPos = globalPosition2; - pointList.append(touchPoint2); - } else if (m_had2ndTouchPoint) { - touchPoint2.normalPosition = - QPointF( (qreal)lastTouchPos.x() / screenGeometry.width(), (qreal)lastTouchPos.y() / screenGeometry.height() ); - - touchPoint2.area.moveCenter(lastTouchPos); - touchPoint2.state = Qt::TouchPointReleased; - pointList.append(touchPoint2); - m_had2ndTouchPoint = false; - } - - if (!m_touchDevice) { - m_touchDevice = new QTouchDevice; - // TODO: Device used to be hardcoded to screen in previous code. - m_touchDevice->setType(QTouchDevice::TouchScreen); - m_touchDevice->setCapabilities(QTouchDevice::Position | QTouchDevice::Area | QTouchDevice::NormalizedPosition); - QWindowSystemInterface::registerTouchDevice(m_touchDevice); - } - - QWindowSystemInterface::handleTouchEvent(window, m_touchDevice, pointList); - // handle window focusing in/out - if (window != m_windowUnderMouse) { - if (m_windowUnderMouse) - QWindowSystemInterface::handleLeaveEvent(m_windowUnderMouse); - if (window) - QWindowSystemInterface::handleEnterEvent(window); - m_windowUnderMouse = window; - } - return true; -#endif // Q_OS_WINCE } QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsmousehandler.h b/src/plugins/platforms/windows/qwindowsmousehandler.h index d16c9f9e02..3eacc5f1a5 100644 --- a/src/plugins/platforms/windows/qwindowsmousehandler.h +++ b/src/plugins/platforms/windows/qwindowsmousehandler.h @@ -91,10 +91,6 @@ private: QTouchDevice *m_touchDevice; bool m_leftButtonDown; QWindow *m_previousCaptureWindow; -#ifdef Q_OS_WINCE -//This is required to send a touch up if we don't get a second touch position any more - bool m_had2ndTouchPoint; -#endif }; Qt::MouseButtons QWindowsMouseHandler::keyStateToMouseButtons(int wParam) diff --git a/src/plugins/platforms/windows/qwindowsnativeimage.cpp b/src/plugins/platforms/windows/qwindowsnativeimage.cpp index bc8bfda32b..ec9683ea8d 100644 --- a/src/plugins/platforms/windows/qwindowsnativeimage.cpp +++ b/src/plugins/platforms/windows/qwindowsnativeimage.cpp @@ -126,9 +126,7 @@ QWindowsNativeImage::QWindowsNativeImage(int width, int height, m_image = QImage(width, height, format); } -#ifndef Q_OS_WINCE GdiFlush(); -#endif } QWindowsNativeImage::~QWindowsNativeImage() diff --git a/src/plugins/platforms/windows/qwindowsopengltester.cpp b/src/plugins/platforms/windows/qwindowsopengltester.cpp index 4ca7f0e413..d5d50a69cd 100644 --- a/src/plugins/platforms/windows/qwindowsopengltester.cpp +++ b/src/plugins/platforms/windows/qwindowsopengltester.cpp @@ -54,17 +54,14 @@ #include <private/qopengl_p.h> #endif -#ifndef Q_OS_WINCE -# include <QtCore/qt_windows.h> -# include <private/qsystemlibrary_p.h> -# include <d3d9.h> -#endif +#include <QtCore/qt_windows.h> +#include <private/qsystemlibrary_p.h> +#include <d3d9.h> QT_BEGIN_NAMESPACE GpuDescription GpuDescription::detect() { -#ifndef Q_OS_WINCE typedef IDirect3D9 * (WINAPI *PtrDirect3DCreate9)(UINT); GpuDescription result; @@ -95,13 +92,6 @@ GpuDescription GpuDescription::detect() result.description = adapterIdentifier.Description; } return result; -#else // !Q_OS_WINCE - GpuDescription result; - result.vendorId = result.deviceId = result.revision =1; - result.driverVersion = QVersionNumber(1, 1, 1); - result.driverName = result.description = QByteArrayLiteral("Generic"); - return result; -#endif } #ifndef QT_NO_DEBUG_STREAM @@ -155,7 +145,6 @@ QVariant GpuDescription::toVariant() const QWindowsOpenGLTester::Renderer QWindowsOpenGLTester::requestedGlesRenderer() { -#ifndef Q_OS_WINCE const char platformVar[] = "QT_ANGLE_PLATFORM"; if (qEnvironmentVariableIsSet(platformVar)) { const QByteArray anglePlatform = qgetenv(platformVar); @@ -167,13 +156,11 @@ QWindowsOpenGLTester::Renderer QWindowsOpenGLTester::requestedGlesRenderer() return QWindowsOpenGLTester::AngleRendererD3d11Warp; qCWarning(lcQpaGl) << "Invalid value set for " << platformVar << ": " << anglePlatform; } -#endif // !Q_OS_WINCE return QWindowsOpenGLTester::InvalidRenderer; } QWindowsOpenGLTester::Renderer QWindowsOpenGLTester::requestedRenderer() { -#ifndef Q_OS_WINCE const char openGlVar[] = "QT_OPENGL"; if (QCoreApplication::testAttribute(Qt::AA_UseOpenGLES)) { const Renderer glesRenderer = QWindowsOpenGLTester::requestedGlesRenderer(); @@ -195,12 +182,9 @@ QWindowsOpenGLTester::Renderer QWindowsOpenGLTester::requestedRenderer() return QWindowsOpenGLTester::SoftwareRasterizer; qCWarning(lcQpaGl) << "Invalid value set for " << openGlVar << ": " << requested; } -#endif // !Q_OS_WINCE return QWindowsOpenGLTester::InvalidRenderer; } -#ifndef Q_OS_WINCE - static inline QString resolveBugListFile(const QString &fileName) { if (QFileInfo(fileName).isAbsolute()) @@ -216,12 +200,10 @@ static inline QString resolveBugListFile(const QString &fileName) return QStandardPaths::locate(QStandardPaths::ConfigLocation, fileName); } -# ifndef QT_NO_OPENGL +#ifndef QT_NO_OPENGL typedef QHash<QOpenGLConfig::Gpu, QWindowsOpenGLTester::Renderers> SupportedRenderersCache; Q_GLOBAL_STATIC(SupportedRenderersCache, supportedRenderersCache) -# endif - -#endif // !Q_OS_WINCE +#endif QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(const GpuDescription &gpu, bool glesOnly) { @@ -229,8 +211,6 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c Q_UNUSED(glesOnly) #if defined(QT_NO_OPENGL) return 0; -#elif defined(Q_OS_WINCE) - return QWindowsOpenGLTester::Gles; #else QOpenGLConfig::Gpu qgpu = QOpenGLConfig::Gpu::fromDevice(gpu.vendorId, gpu.deviceId, gpu.driverVersion, gpu.description); SupportedRenderersCache *srCache = supportedRenderersCache(); @@ -280,7 +260,7 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::detectSupportedRenderers(c } srCache->insert(qgpu, result); return result; -#endif // !Q_OS_WINCE && !QT_NO_OPENGL +#endif // !QT_NO_OPENGL } QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedGlesRenderers() @@ -301,7 +281,7 @@ QWindowsOpenGLTester::Renderers QWindowsOpenGLTester::supportedRenderers() bool QWindowsOpenGLTester::testDesktopGL() { -#if !defined(QT_NO_OPENGL) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_OPENGL) HMODULE lib = 0; HWND wnd = 0; HDC dc = 0; @@ -428,7 +408,7 @@ cleanup: return result; #else return false; -#endif // !QT_NO_OPENGL && !Q_OS_WINCE +#endif // !QT_NO_OPENGL } QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/qwindowsscreen.cpp b/src/plugins/platforms/windows/qwindowsscreen.cpp index b476c9be1d..93839ccf43 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.cpp +++ b/src/plugins/platforms/windows/qwindowsscreen.cpp @@ -68,8 +68,6 @@ static inline QDpi deviceDPI(HDC hdc) return QDpi(GetDeviceCaps(hdc, LOGPIXELSX), GetDeviceCaps(hdc, LOGPIXELSY)); } -#ifndef Q_OS_WINCE - static inline QDpi monitorDPI(HMONITOR hMonitor) { if (QWindowsContext::shcoredll.isValid()) { @@ -81,8 +79,6 @@ static inline QDpi monitorDPI(HMONITOR hMonitor) return QDpi(0, 0); } -#endif // !Q_OS_WINCE - typedef QList<QWindowsScreenData> WindowsScreenDataList; static bool monitorData(HMONITOR hMonitor, QWindowsScreenData *data) @@ -99,20 +95,9 @@ static bool monitorData(HMONITOR hMonitor, QWindowsScreenData *data) if (data->name == QLatin1String("WinDisc")) { data->flags |= QWindowsScreenData::LockScreen; } else { -#ifdef Q_OS_WINCE - //Windows CE, just supports one Display and expects to get only DISPLAY, - //instead of DISPLAY0 and so on, which are passed by info.szDevice - HDC hdc = CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL); -#else - HDC hdc = CreateDC(info.szDevice, NULL, NULL, NULL); -#endif - if (hdc) { -#ifndef Q_OS_WINCE + if (const HDC hdc = CreateDC(info.szDevice, NULL, NULL, NULL)) { const QDpi dpi = monitorDPI(hMonitor); data->dpi = dpi.first ? dpi : deviceDPI(hdc); -#else - data->dpi = deviceDPI(hdc); -#endif data->depth = GetDeviceCaps(hdc, BITSPIXEL); data->format = data->depth == 16 ? QImage::Format_RGB16 : QImage::Format_RGB32; data->physicalSizeMM = QSizeF(GetDeviceCaps(hdc, HORZSIZE), GetDeviceCaps(hdc, VERTSIZE)); @@ -330,7 +315,6 @@ enum OrientationPreference // matching Win32 API ORIENTATION_PREFERENCE bool QWindowsScreen::setOrientationPreference(Qt::ScreenOrientation o) { bool result = false; -#ifndef Q_OS_WINCE if (QWindowsContext::user32dll.setDisplayAutoRotationPreferences) { DWORD orientationPreference = 0; switch (o) { @@ -352,14 +336,12 @@ bool QWindowsScreen::setOrientationPreference(Qt::ScreenOrientation o) } result = QWindowsContext::user32dll.setDisplayAutoRotationPreferences(orientationPreference); } -#endif // !Q_OS_WINCE return result; } Qt::ScreenOrientation QWindowsScreen::orientationPreference() { Qt::ScreenOrientation result = Qt::PrimaryOrientation; -#ifndef Q_OS_WINCE if (QWindowsContext::user32dll.getDisplayAutoRotationPreferences) { DWORD orientationPreference = 0; if (QWindowsContext::user32dll.getDisplayAutoRotationPreferences(&orientationPreference)) { @@ -379,7 +361,6 @@ Qt::ScreenOrientation QWindowsScreen::orientationPreference() } } } -#endif // !Q_OS_WINCE return result; } @@ -388,7 +369,7 @@ Qt::ScreenOrientation QWindowsScreen::orientationPreference() */ QPlatformScreen::SubpixelAntialiasingType QWindowsScreen::subpixelAntialiasingTypeHint() const { -#if defined(Q_OS_WINCE) || !defined(FT_LCD_FILTER_H) || !defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING) +#if !defined(FT_LCD_FILTER_H) || !defined(FT_CONFIG_OPTION_SUBPIXEL_RENDERING) return QPlatformScreen::Subpixel_None; #else QPlatformScreen::SubpixelAntialiasingType type = QPlatformScreen::subpixelAntialiasingTypeHint(); diff --git a/src/plugins/platforms/windows/qwindowsscreen.h b/src/plugins/platforms/windows/qwindowsscreen.h index 2afc410e07..02a9dc3bc3 100644 --- a/src/plugins/platforms/windows/qwindowsscreen.h +++ b/src/plugins/platforms/windows/qwindowsscreen.h @@ -41,9 +41,6 @@ #define QWINDOWSSCREEN_H #include "qtwindowsglobal.h" -#ifdef Q_OS_WINCE -# include "qplatformfunctions_wince.h" -#endif #include <QtCore/QList> #include <QtCore/QVector> diff --git a/src/plugins/platforms/windows/qwindowsservices.cpp b/src/plugins/platforms/windows/qwindowsservices.cpp index 3c99e3507e..5074db9051 100644 --- a/src/plugins/platforms/windows/qwindowsservices.cpp +++ b/src/plugins/platforms/windows/qwindowsservices.cpp @@ -46,9 +46,7 @@ #include <QtCore/QDir> #include <shlobj.h> -#ifndef Q_OS_WINCE -# include <intshcut.h> -#endif +#include <intshcut.h> QT_BEGIN_NAMESPACE @@ -56,7 +54,6 @@ enum { debug = 0 }; static inline bool shellExecute(const QUrl &url) { -#ifndef Q_OS_WINCE const QString nativeFilePath = url.isLocalFile() ? QDir::toNativeSeparators(url.toLocalFile()) : url.toString(QUrl::FullyEncoded); const quintptr result = @@ -69,10 +66,6 @@ static inline bool shellExecute(const QUrl &url) return false; } return true; -#else - Q_UNUSED(url); - return false; -#endif } // Retrieve the commandline for the default mail client. It contains a @@ -107,13 +100,9 @@ static inline QString mailCommand() } if (!command[0]) return QString(); -#ifndef Q_OS_WINCE wchar_t expandedCommand[MAX_PATH] = {0}; return ExpandEnvironmentStrings(command, expandedCommand, MAX_PATH) ? QString::fromWCharArray(expandedCommand) : QString::fromWCharArray(command); -#else - return QString(); -#endif } static inline bool launchMail(const QUrl &url) diff --git a/src/plugins/platforms/windows/qwindowstabletsupport.h b/src/plugins/platforms/windows/qwindowstabletsupport.h index 4a24d62770..2c05dcddfc 100644 --- a/src/plugins/platforms/windows/qwindowstabletsupport.h +++ b/src/plugins/platforms/windows/qwindowstabletsupport.h @@ -42,7 +42,7 @@ #include "qtwindowsglobal.h" -#if !defined(QT_NO_TABLETEVENT) && !defined(Q_OS_WINCE) +#if !defined(QT_NO_TABLETEVENT) #include <QtCore/QVector> #include <QtCore/QPointF> @@ -143,5 +143,5 @@ private: QT_END_NAMESPACE -#endif // !QT_NO_TABLETEVENT && !Q_OS_WINCE +#endif // !QT_NO_TABLETEVENT #endif // QWINDOWSTABLETSUPPORT_H diff --git a/src/plugins/platforms/windows/qwindowstheme.cpp b/src/plugins/platforms/windows/qwindowstheme.cpp index 96940f3f4c..a9307f79fb 100644 --- a/src/plugins/platforms/windows/qwindowstheme.cpp +++ b/src/plugins/platforms/windows/qwindowstheme.cpp @@ -49,17 +49,12 @@ #include "qwindowsintegration.h" #include "qt_windows.h" #include "qwindowsfontdatabase.h" -#ifdef Q_OS_WINCE -# include "qplatformfunctions_wince.h" -# include "winuser.h" -#else -# include <commctrl.h> -# include <objbase.h> -# ifndef Q_CC_MINGW -# include <commoncontrols.h> -# endif -# include <shellapi.h> +#include <commctrl.h> +#include <objbase.h> +#ifndef Q_CC_MINGW +# include <commoncontrols.h> #endif +#include <shellapi.h> #include <QtCore/QVariant> #include <QtCore/QCoreApplication> @@ -128,7 +123,6 @@ static inline QColor getSysColor(int index) return COLORREFToQColor(GetSysColor(index)); } -#ifndef QT_NO_WINCE_SHELLSDK // QTBUG-48823/Windows 10: SHGetFileInfo() (as called by item views on file system // models has been observed to trigger a WM_PAINT on the mainwindow. Suppress the // behavior by running it in a thread. @@ -161,7 +155,6 @@ static bool shGetFileInfoBackground(QWindowsThreadPoolRunner &r, } return result; } -#endif // !QT_NO_WINCE_SHELLSDK // from QStyle::standardPalette static inline QPalette standardPalette() @@ -272,14 +265,9 @@ static inline QPalette menuPalette(const QPalette &systemPalette) result.setColor(QPalette::Active, QPalette::ButtonText, menuTextColor); result.setColor(QPalette::Disabled, QPalette::WindowText, disabled); result.setColor(QPalette::Disabled, QPalette::Text, disabled); -#ifndef Q_OS_WINCE const bool isFlat = booleanSystemParametersInfo(SPI_GETFLATMENU, false); result.setColor(QPalette::Disabled, QPalette::Highlight, getSysColor(isFlat ? COLOR_MENUHILIGHT : COLOR_HIGHLIGHT)); -#else - result.setColor(QPalette::Disabled, QPalette::Highlight, - getSysColor(COLOR_HIGHLIGHT)); -#endif result.setColor(QPalette::Disabled, QPalette::HighlightedText, disabled); result.setColor(QPalette::Disabled, QPalette::Button, result.color(QPalette::Active, QPalette::Button)); @@ -305,11 +293,7 @@ static inline QPalette *menuBarPalette(const QPalette &menuPalette) QPalette *result = 0; if (booleanSystemParametersInfo(SPI_GETFLATMENU, false)) { result = new QPalette(menuPalette); -#ifndef Q_OS_WINCE const QColor menubar(getSysColor(COLOR_MENUBAR)); -#else - const QColor menubar(getSysColor(COLOR_MENU)); -#endif result->setColor(QPalette::Active, QPalette::Button, menubar); result->setColor(QPalette::Disabled, QPalette::Button, menubar); result->setColor(QPalette::Inactive, QPalette::Button, menubar); @@ -379,12 +363,10 @@ QVariant QWindowsTheme::themeHint(ThemeHint hint) const return QVariant(iconThemeSearchPaths()); case StyleNames: return QVariant(styleNames()); -#ifndef Q_OS_WINCE case TextCursorWidth: return QVariant(int(dWordSystemParametersInfo(SPI_GETCARETWIDTH, 1u))); case DropShadow: return QVariant(booleanSystemParametersInfo(SPI_GETDROPSHADOW, false)); -#endif // !Q_OS_WINCE case MaximumScrollBarDragDistance: return QVariant(qRound(qreal(QWindowsContext::instance()->defaultDPI()) * 1.375)); case KeyboardScheme: @@ -438,7 +420,6 @@ void QWindowsTheme::clearFonts() void QWindowsTheme::refreshFonts() { -#ifndef Q_OS_WINCE // ALL THIS FUNCTIONALITY IS MISSING ON WINCE clearFonts(); if (!QGuiApplication::desktopSettingsAware()) return; @@ -467,7 +448,6 @@ void QWindowsTheme::refreshFonts() m_fonts[DockWidgetTitleFont] = new QFont(titleFont); m_fonts[ItemViewFont] = new QFont(iconTitleFont); m_fonts[FixedFont] = new QFont(fixedFont); -#endif // !Q_OS_WINCE } bool QWindowsTheme::usePlatformNativeDialog(DialogType type) const @@ -491,12 +471,7 @@ Q_GUI_EXPORT QPixmap qt_pixmapFromWinHICON(HICON icon); static QPixmap loadIconFromShell32(int resourceId, QSizeF size) { -#ifdef Q_OS_WINCE - HMODULE hmod = LoadLibrary(L"ceshell"); -#else - HMODULE hmod = QSystemLibrary::load(L"shell32"); -#endif - if (hmod) { + if (const HMODULE hmod = QSystemLibrary::load(L"shell32")) { HICON iconHandle = static_cast<HICON>(LoadImage(hmod, MAKEINTRESOURCE(resourceId), IMAGE_ICON, int(size.width()), int(size.height()), 0)); @@ -512,7 +487,7 @@ static QPixmap loadIconFromShell32(int resourceId, QSizeF size) QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &pixmapSize) const { int resourceId = -1; - int stockId = SIID_INVALID; + SHSTOCKICONID stockId = SIID_INVALID; UINT stockFlags = 0; LPCTSTR iconName = 0; switch (sp) { @@ -575,7 +550,6 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &pixmapSiz stockId = SIID_RECYCLER; resourceId = 191; break; -#ifndef Q_OS_WINCE case MessageBoxInformation: stockId = SIID_INFO; iconName = IDI_INFORMATION; @@ -595,29 +569,22 @@ QPixmap QWindowsTheme::standardPixmap(StandardPixmap sp, const QSizeF &pixmapSiz case VistaShield: stockId = SIID_SHIELD; break; -#endif default: break; } -#ifndef Q_OS_WINCE if (stockId != SIID_INVALID) { - if (QSysInfo::WindowsVersion >= QSysInfo::WV_VISTA - && (QSysInfo::WindowsVersion & QSysInfo::WV_NT_based) - && QWindowsContext::shell32dll.sHGetStockIconInfo) { - QPixmap pixmap; - SHSTOCKICONINFO iconInfo; - memset(&iconInfo, 0, sizeof(iconInfo)); - iconInfo.cbSize = sizeof(iconInfo); - stockFlags |= (pixmapSize.width() > 16 ? SHGFI_LARGEICON : SHGFI_SMALLICON); - if (QWindowsContext::shell32dll.sHGetStockIconInfo(stockId, SHGFI_ICON | stockFlags, &iconInfo) == S_OK) { - pixmap = qt_pixmapFromWinHICON(iconInfo.hIcon); - DestroyIcon(iconInfo.hIcon); - return pixmap; - } + QPixmap pixmap; + SHSTOCKICONINFO iconInfo; + memset(&iconInfo, 0, sizeof(iconInfo)); + iconInfo.cbSize = sizeof(iconInfo); + stockFlags |= (pixmapSize.width() > 16 ? SHGFI_LARGEICON : SHGFI_SMALLICON); + if (SHGetStockIconInfo(stockId, SHGFI_ICON | stockFlags, &iconInfo) == S_OK) { + pixmap = qt_pixmapFromWinHICON(iconInfo.hIcon); + DestroyIcon(iconInfo.hIcon); + return pixmap; } } -#endif if (resourceId != -1) { QPixmap pixmap = loadIconFromShell32(resourceId, pixmapSize); @@ -692,14 +659,8 @@ static QPixmap pixmapFromShellImageList(int iImageList, const SHFILEINFO &info) // For MinGW: static const IID iID_IImageList = {0x46eb5926, 0x582e, 0x4017, {0x9f, 0xdf, 0xe8, 0x99, 0x8d, 0xaa, 0x9, 0x50}}; - if (!QWindowsContext::shell32dll.sHGetImageList) - return result; - if (iImageList == sHIL_JUMBO && QSysInfo::WindowsVersion < QSysInfo::WV_VISTA) - return result; - IImageList *imageList = 0; - HRESULT hr = QWindowsContext::shell32dll.sHGetImageList(iImageList, iID_IImageList, - reinterpret_cast<void **>(&imageList)); + HRESULT hr = SHGetImageList(iImageList, iID_IImageList, reinterpret_cast<void **>(&imageList)); if (hr != S_OK) return result; HICON hIcon; @@ -755,22 +716,13 @@ QPixmap QWindowsTheme::fileIconPixmap(const QFileInfo &fileInfo, const QSizeF &s SHFILEINFO info; const unsigned int flags = -#ifndef Q_OS_WINCE SHGFI_ICON|iconSize|SHGFI_SYSICONINDEX|SHGFI_ADDOVERLAYS|SHGFI_OVERLAYINDEX; -#else - iconSize|SHGFI_SYSICONINDEX; -#endif // Q_OS_WINCE - -#if !defined(QT_NO_WINCE_SHELLSDK) const bool val = cacheableDirIcon && useDefaultFolderIcon ? shGetFileInfoBackground(m_threadPoolRunner, L"dummy", FILE_ATTRIBUTE_DIRECTORY, &info, flags | SHGFI_USEFILEATTRIBUTES) : shGetFileInfoBackground(m_threadPoolRunner, reinterpret_cast<const wchar_t *>(filePath.utf16()), 0, &info, flags); -#else - const bool val = false; -#endif // !QT_NO_WINCE_SHELLSDK // Even if GetFileInfo returns a valid result, hIcon can be empty in some cases if (val && info.hIcon) { diff --git a/src/plugins/platforms/windows/qwindowswindow.cpp b/src/plugins/platforms/windows/qwindowswindow.cpp index f76b3bb2d2..4aa6eaea4a 100644 --- a/src/plugins/platforms/windows/qwindowswindow.cpp +++ b/src/plugins/platforms/windows/qwindowswindow.cpp @@ -62,6 +62,8 @@ #include <QtCore/QDebug> +#include <dwmapi.h> + QT_BEGIN_NAMESPACE enum { @@ -147,7 +149,6 @@ QDebug operator<<(QDebug d, const POINT &p) return d; } -# ifndef Q_OS_WINCE QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p) { QDebugStateSaver saver(d); @@ -178,14 +179,12 @@ QDebug operator<<(QDebug d, const WINDOWPLACEMENT &wp) << ", rcNormalPosition=" << wp.rcNormalPosition; return d; } -# endif // !Q_OS_WINCE #endif // !QT_NO_DEBUG_STREAM // QTBUG-43872, for windows that do not have WS_EX_TOOLWINDOW set, WINDOWPLACEMENT // is in workspace/available area coordinates. static QPoint windowPlacementOffset(HWND hwnd, const QPoint &point) { -#ifndef Q_OS_WINCE if (GetWindowLongPtr(hwnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW) return QPoint(0, 0); const QWindowsScreenManager &screenManager = QWindowsContext::instance()->screenManager(); @@ -193,10 +192,6 @@ static QPoint windowPlacementOffset(HWND hwnd, const QPoint &point) ? screenManager.screens().constFirst() : screenManager.screenAtDp(point); if (screen) return screen->availableGeometry().topLeft() - screen->geometry().topLeft(); -#else - Q_UNUSED(hwnd) - Q_UNUSED(point) -#endif return QPoint(0, 0); } @@ -205,7 +200,6 @@ static QPoint windowPlacementOffset(HWND hwnd, const QPoint &point) static inline QRect frameGeometry(HWND hwnd, bool topLevel) { RECT rect = { 0, 0, 0, 0 }; -#ifndef Q_OS_WINCE if (topLevel) { WINDOWPLACEMENT windowPlacement; windowPlacement.length = sizeof(WINDOWPLACEMENT); @@ -215,7 +209,6 @@ static inline QRect frameGeometry(HWND hwnd, bool topLevel) return result.translated(windowPlacementOffset(hwnd, result.topLeft())); } } -#endif // !Q_OS_WINCE GetWindowRect(hwnd, &rect); // Screen coordinates. const HWND parent = GetParent(hwnd); if (parent && !topLevel) { @@ -236,7 +229,6 @@ static QWindow::Visibility windowVisibility_sys(HWND hwnd) { if (!IsWindowVisible(hwnd)) return QWindow::Hidden; -#ifndef Q_OS_WINCE WINDOWPLACEMENT windowPlacement; windowPlacement.length = sizeof(WINDOWPLACEMENT); if (GetWindowPlacement(hwnd, &windowPlacement)) { @@ -251,7 +243,6 @@ static QWindow::Visibility windowVisibility_sys(HWND hwnd) break; } } -#endif // !Q_OS_WINCE return QWindow::Windowed; } @@ -269,65 +260,27 @@ static inline bool windowIsOpenGL(const QWindow *w) static bool applyBlurBehindWindow(HWND hwnd) { -#ifdef Q_OS_WINCE - Q_UNUSED(hwnd); - return false; -#else - enum { dwmBbEnable = 0x1, dwmBbBlurRegion = 0x2 }; - - struct DwmBlurBehind { - DWORD dwFlags; - BOOL fEnable; - HRGN hRgnBlur; - BOOL fTransitionOnMaximized; - }; - - typedef HRESULT (WINAPI *PtrDwmEnableBlurBehindWindow)(HWND, const DwmBlurBehind*); - typedef HRESULT (WINAPI *PtrDwmIsCompositionEnabled)(BOOL *); - - // DWM API is available only from Windows Vista - if (QSysInfo::windowsVersion() < QSysInfo::WV_VISTA) - return false; - - static bool functionPointersResolved = false; - static PtrDwmEnableBlurBehindWindow dwmBlurBehind = 0; - static PtrDwmIsCompositionEnabled dwmIsCompositionEnabled = 0; - - if (Q_UNLIKELY(!functionPointersResolved)) { - QSystemLibrary library(QStringLiteral("dwmapi")); - if (library.load()) { - dwmBlurBehind = (PtrDwmEnableBlurBehindWindow)(library.resolve("DwmEnableBlurBehindWindow")); - dwmIsCompositionEnabled = (PtrDwmIsCompositionEnabled)(library.resolve("DwmIsCompositionEnabled")); - } - - functionPointersResolved = true; - } - - if (Q_UNLIKELY(!dwmBlurBehind || !dwmIsCompositionEnabled)) - return false; - BOOL compositionEnabled; - if (dwmIsCompositionEnabled(&compositionEnabled) != S_OK) + if (DwmIsCompositionEnabled(&compositionEnabled) != S_OK) return false; - DwmBlurBehind blurBehind = {0, 0, 0, 0}; + DWM_BLURBEHIND blurBehind = {0, 0, 0, 0}; if (compositionEnabled) { - blurBehind.dwFlags = dwmBbEnable | dwmBbBlurRegion; + blurBehind.dwFlags = DWM_BB_ENABLE | DWM_BB_BLURREGION; blurBehind.fEnable = TRUE; blurBehind.hRgnBlur = CreateRectRgn(0, 0, -1, -1); } else { - blurBehind.dwFlags = dwmBbEnable; + blurBehind.dwFlags = DWM_BB_ENABLE; blurBehind.fEnable = FALSE; } - const bool result = dwmBlurBehind(hwnd, &blurBehind) == S_OK; + const bool result = DwmEnableBlurBehindWindow(hwnd, &blurBehind) == S_OK; if (blurBehind.hRgnBlur) DeleteObject(blurBehind.hRgnBlur); return result; -#endif // Q_OS_WINCE } // from qwidget_win.cpp, pass flags separately in case they have been "autofixed". @@ -346,7 +299,6 @@ static bool shouldShowMaximizeButton(const QWindow *w, Qt::WindowFlags flags) // Qt::WindowTransparentForInput (in combination with WS_EX_TRANSPARENT). bool QWindowsWindow::setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, qreal opacity) { -#ifndef Q_OS_WINCE // maybe needs revisiting WS_EX_LAYERED const LONG exStyle = GetWindowLong(hwnd, GWL_EXSTYLE); const bool needsLayered = (flags & Qt::WindowTransparentForInput) || (hasAlpha && (flags & Qt::FramelessWindowHint)) || opacity < 1.0; @@ -359,36 +311,22 @@ bool QWindowsWindow::setWindowLayered(HWND hwnd, Qt::WindowFlags flags, bool has } } return needsLayered; -#else // !Q_OS_WINCE - Q_UNUSED(hwnd); - Q_UNUSED(flags); - Q_UNUSED(hasAlpha); - Q_UNUSED(opacity); - return false; -#endif // Q_OS_WINCE } static void setWindowOpacity(HWND hwnd, Qt::WindowFlags flags, bool hasAlpha, bool openGL, qreal level) { -#ifdef Q_OS_WINCE // WINCE does not support that feature and microsoft explicitly warns to use those calls - Q_UNUSED(hwnd); - Q_UNUSED(flags); - Q_UNUSED(hasAlpha); - Q_UNUSED(level); -#else if (QWindowsWindow::setWindowLayered(hwnd, flags, hasAlpha, level)) { const BYTE alpha = BYTE(qRound(255.0 * level)); if (hasAlpha && !openGL && (flags & Qt::FramelessWindowHint)) { // Non-GL windows with alpha: Use blend function to update. BLENDFUNCTION blend = {AC_SRC_OVER, 0, alpha, AC_SRC_ALPHA}; - QWindowsContext::user32dll.updateLayeredWindow(hwnd, NULL, NULL, NULL, NULL, NULL, 0, &blend, ULW_ALPHA); + UpdateLayeredWindow(hwnd, NULL, NULL, NULL, NULL, NULL, 0, &blend, ULW_ALPHA); } else { - QWindowsContext::user32dll.setLayeredWindowAttributes(hwnd, 0, alpha, LWA_ALPHA); + SetLayeredWindowAttributes(hwnd, 0, alpha, LWA_ALPHA); } } else if (IsWindowVisible(hwnd)) { // Repaint when switching from layered. InvalidateRect(hwnd, NULL, TRUE); } -#endif // !Q_OS_WINCE } static inline void updateGLWindowSettings(const QWindow *w, HWND hwnd, Qt::WindowFlags flags, qreal opacity) @@ -604,12 +542,10 @@ void WindowCreationData::fromWindow(const QWindow *w, const Qt::WindowFlags flag exStyle |= WS_EX_TOOLWINDOW; } -#ifndef Q_OS_WINCE // make mouse events fall through this window // NOTE: WS_EX_TRANSPARENT flag can make mouse inputs fall through a layered window if (flagsIn & Qt::WindowTransparentForInput) exStyle |= WS_EX_LAYERED | WS_EX_TRANSPARENT; -#endif } } @@ -650,10 +586,6 @@ QWindowsWindowData context->frameX, context->frameY, context->frameWidth, context->frameHeight, parentHandle, NULL, appinst, NULL); -#ifdef Q_OS_WINCE - if (DisableGestures(result.hwnd, TGF_GID_ALL, TGF_SCOPE_WINDOW)) - EnableGestures(result.hwnd, TGF_GID_DIRECTMANIPULATION, TGF_SCOPE_WINDOW); -#endif qCDebug(lcQpaWindows).nospace() << "CreateWindowEx: returns " << w << ' ' << result.hwnd << " obtained geometry: " << context->obtainedGeometry << ' ' << context->margins; @@ -764,9 +696,7 @@ bool QWindowsGeometryHint::validSize(const QSize &s) const QMargins QWindowsGeometryHint::frame(DWORD style, DWORD exStyle) { RECT rect = {0,0,0,0}; -#ifndef Q_OS_WINCE style &= ~(WS_OVERLAPPED); // Not permitted, see docs. -#endif if (!AdjustWindowRectEx(&rect, style, FALSE, exStyle)) qErrnoWarning("%s: AdjustWindowRectEx failed", __FUNCTION__); const QMargins result(qAbs(rect.left), qAbs(rect.top), @@ -779,7 +709,6 @@ QMargins QWindowsGeometryHint::frame(DWORD style, DWORD exStyle) bool QWindowsGeometryHint::handleCalculateSize(const QMargins &customMargins, const MSG &msg, LRESULT *result) { -#ifndef Q_OS_WINCE // NCCALCSIZE_PARAMS structure if wParam==TRUE if (!msg.wParam || customMargins.isNull()) return false; @@ -795,15 +724,8 @@ bool QWindowsGeometryHint::handleCalculateSize(const QMargins &customMargins, co << ncp->rgrc[0] << ' ' << ncp->rgrc[1] << ' ' << ncp->rgrc[2] << ' ' << ncp->lppos->cx << ',' << ncp->lppos->cy; return true; -#else - Q_UNUSED(customMargins) - Q_UNUSED(msg) - Q_UNUSED(result) - return false; -#endif } -#ifndef Q_OS_WINCE void QWindowsGeometryHint::applyToMinMaxInfo(HWND hwnd, MINMAXINFO *mmi) const { return applyToMinMaxInfo(DWORD(GetWindowLong(hwnd, GWL_STYLE)), @@ -835,7 +757,6 @@ void QWindowsGeometryHint::applyToMinMaxInfo(DWORD style, DWORD exStyle, MINMAXI << " frame=" << margins << ' ' << frameWidth << ',' << frameHeight << " out " << *mmi; } -#endif // !Q_OS_WINCE bool QWindowsGeometryHint::positionIncludesFrame(const QWindow *w) { @@ -1080,9 +1001,6 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) m_dropTarget(0), m_savedStyle(0), m_format(aWindow->requestedFormat()), -#ifdef Q_OS_WINCE - m_previouslyHidden(false), -#endif m_iconSmall(0), m_iconBig(0), m_surface(0) @@ -1116,10 +1034,8 @@ QWindowsWindow::QWindowsWindow(QWindow *aWindow, const QWindowsWindowData &data) QWindowsWindow::~QWindowsWindow() { setFlag(WithinDestroy); -#ifndef Q_OS_WINCE if (testFlag(TouchRegistered)) QWindowsContext::user32dll.unregisterTouchWindow(m_data.hwnd); -#endif // !Q_OS_WINCE destroyWindow(); destroyIcon(); } @@ -1163,14 +1079,6 @@ void QWindowsWindow::destroyWindow() m_surface = 0; } #endif -#ifdef Q_OS_WINCE - if ((m_windowState & Qt::WindowFullScreen) && !m_previouslyHidden) { - HWND handle = FindWindow(L"HHTaskBar", L""); - if (handle) { - ShowWindow(handle, SW_SHOW); - } - } -#endif // !Q_OS_WINCE DestroyWindow(m_data.hwnd); context->removeWindow(m_data.hwnd); m_data.hwnd = 0; @@ -1338,7 +1246,6 @@ QPoint QWindowsWindow::mapFromGlobal(const QPoint &pos) const return pos; } -#ifndef Q_OS_WINCE static inline HWND transientParentHwnd(HWND hwnd) { if (GetAncestor(hwnd, GA_PARENT) == GetDesktopWindow()) { @@ -1348,7 +1255,6 @@ static inline HWND transientParentHwnd(HWND hwnd) } return 0; } -#endif // !Q_OS_WINCE // Update the transient parent for a toplevel window. The concept does not // really exist on Windows, the relationship is set by passing a parent along with !WS_CHILD @@ -1356,7 +1262,6 @@ static inline HWND transientParentHwnd(HWND hwnd) // SetParent, which would make it a real child). void QWindowsWindow::updateTransientParent() const { -#ifndef Q_OS_WINCE if (window()->type() == Qt::Popup) return; // QTBUG-34503, // a popup stays on top, no parent, see also WindowCreationData::fromWindow(). // Update transient parent. @@ -1368,7 +1273,6 @@ void QWindowsWindow::updateTransientParent() const newTransientParent = tw->handle(); if (newTransientParent != oldTransientParent) SetWindowLongPtr(m_data.hwnd, GWL_HWNDPARENT, LONG_PTR(newTransientParent)); -#endif // !Q_OS_WINCE } static inline bool testShowWithoutActivating(const QWindow *window) @@ -1486,16 +1390,12 @@ void QWindowsWindow::handleCompositionSettingsChanged() static QRect normalFrameGeometry(HWND hwnd) { -#ifndef Q_OS_WINCE WINDOWPLACEMENT wp; wp.length = sizeof(WINDOWPLACEMENT); if (GetWindowPlacement(hwnd, &wp)) { const QRect result = qrectFromRECT(wp.rcNormalPosition); return result.translated(windowPlacementOffset(hwnd, result.topLeft())); } -#else - Q_UNUSED(hwnd) -#endif return QRect(); } @@ -1615,7 +1515,6 @@ void QWindowsBaseWindow::setGeometry_sys(const QRect &rect) const << " new frame: " << frameGeometry; bool result = false; -#ifndef Q_OS_WINCE const HWND hwnd = handle(); WINDOWPLACEMENT windowPlacement; windowPlacement.length = sizeof(WINDOWPLACEMENT); @@ -1628,9 +1527,7 @@ void QWindowsBaseWindow::setGeometry_sys(const QRect &rect) const RECTfromQRect(frameGeometry.translated(-windowPlacementOffset(hwnd, frameGeometry.topLeft()))); windowPlacement.showCmd = windowPlacement.showCmd == SW_SHOWMINIMIZED ? SW_SHOWMINIMIZED : SW_HIDE; result = SetWindowPlacement(hwnd, &windowPlacement); - } else -#endif // !Q_OS_WINCE - { + } else { result = MoveWindow(hwnd, frameGeometry.x(), frameGeometry.y(), frameGeometry.width(), frameGeometry.height(), true); } @@ -1822,18 +1719,6 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) setFlag(FrameDirty); if ((oldState == Qt::WindowFullScreen) != (newState == Qt::WindowFullScreen)) { -#ifdef Q_OS_WINCE - HWND handle = FindWindow(L"HHTaskBar", L""); - if (handle) { - if (newState == Qt::WindowFullScreen) { - BOOL hidden = ShowWindow(handle, SW_HIDE); - if (!hidden) - m_previouslyHidden = true; - } else if (!m_previouslyHidden){ - ShowWindow(handle, SW_SHOW); - } - } -#endif if (newState == Qt::WindowFullScreen) { #ifndef Q_FLATTEN_EXPOSE UINT newStyle = WS_CLIPCHILDREN | WS_CLIPSIBLINGS | WS_POPUP; @@ -1845,17 +1730,13 @@ void QWindowsWindow::setWindowState_sys(Qt::WindowState newState) // Window state but emulated by changing geometry and style. if (!m_savedStyle) { m_savedStyle = style(); -#ifndef Q_OS_WINCE if (oldState == Qt::WindowMinimized || oldState == Qt::WindowMaximized) { const QRect nf = normalFrameGeometry(m_data.hwnd); if (nf.isValid()) m_savedFrameGeometry = nf; } else { -#endif m_savedFrameGeometry = frameGeometry_sys(); -#ifndef Q_OS_WINCE } -#endif } if (m_savedStyle & WS_SYSMENU) newStyle |= WS_SYSMENU; @@ -1968,7 +1849,6 @@ void QWindowsWindow::propagateSizeHints() bool QWindowsWindow::handleGeometryChangingMessage(MSG *message, const QWindow *qWindow, const QMargins &margins) { -#ifndef Q_OS_WINCE if (!qWindow->isTopLevel()) // Implement hasHeightForWidth(). return false; WINDOWPOS *windowPos = reinterpret_cast<WINDOWPOS *>(message->lParam); @@ -1988,10 +1868,6 @@ bool QWindowsWindow::handleGeometryChangingMessage(MSG *message, const QWindow * windowPos->cx = correctedFrameGeometry.width(); windowPos->cy = correctedFrameGeometry.height(); return true; -#else // !Q_OS_WINCE - Q_UNUSED(message) - return false; -#endif } bool QWindowsWindow::handleGeometryChanging(MSG *message) const @@ -2049,15 +1925,13 @@ static inline void addRectToWinRegion(const QRect &rect, HRGN *winRegion) static HRGN qRegionToWinRegion(const QRegion ®ion) { - const QVector<QRect> rects = region.rects(); - if (rects.isEmpty()) - return NULL; - const int rectCount = rects.size(); - if (rectCount == 1) - return createRectRegion(region.boundingRect()); - HRGN hRegion = createRectRegion(rects.front()); - for (int i = 1; i < rectCount; ++i) - addRectToWinRegion(rects.at(i), &hRegion); + auto it = region.begin(); + const auto end = region.end(); + if (it == end) + return nullptr; + HRGN hRegion = createRectRegion(*it); + while (++it != end) + addRectToWinRegion(*it, &hRegion); return hRegion; } @@ -2086,7 +1960,6 @@ void QWindowsWindow::requestActivateWindow() // 'Active' state handling is based in focus since it needs to work for // child windows as well. if (m_data.hwnd) { -#ifndef Q_OS_WINCE const DWORD currentThread = GetCurrentThreadId(); bool attached = false; DWORD foregroundThread = 0; @@ -2103,13 +1976,10 @@ void QWindowsWindow::requestActivateWindow() attached = AttachThreadInput(foregroundThread, currentThread, TRUE) == TRUE; } } -#endif // !Q_OS_WINCE SetForegroundWindow(m_data.hwnd); SetFocus(m_data.hwnd); -#ifndef Q_OS_WINCE if (attached) AttachThreadInput(foregroundThread, currentThread, FALSE); -#endif // !Q_OS_WINCE } } @@ -2191,7 +2061,6 @@ void QWindowsWindow::setFrameStrutEventsEnabled(bool enabled) } } -#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO void QWindowsWindow::getSizeHints(MINMAXINFO *mmi) const { const QWindowsGeometryHint hint(window(), m_data.customMargins); @@ -2262,8 +2131,6 @@ bool QWindowsWindow::handleNonClientHitTest(const QPoint &globalPos, LRESULT *re return false; } -#endif // !Q_OS_WINCE - #ifndef QT_NO_CURSOR // Return the default cursor (Arrow) from QWindowsCursor's cache. static inline CursorHandlePtr defaultCursor(const QWindow *w) @@ -2330,7 +2197,6 @@ void QWindowsWindow::setCursor(const CursorHandlePtr &c) #endif } -#ifndef Q_OS_WINCE void QWindowsWindow::setAlertState(bool enabled) { if (isAlertState() == enabled) @@ -2369,7 +2235,6 @@ void QWindowsWindow::stopAlertWindow() info.uCount = 0; FlashWindowEx(&info); } -#endif // !Q_OS_WINCE bool QWindowsWindow::isEnabled() const { @@ -2485,7 +2350,6 @@ void QWindowsWindow::setTouchWindowTouchTypeStatic(QWindow *window, QWindowsWind void QWindowsWindow::registerTouchWindow(QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes) { -#ifndef Q_OS_WINCE if ((QWindowsContext::instance()->systemInfo() & QWindowsContext::SI_SupportsTouch)) { ULONG touchFlags = 0; const bool ret = QWindowsContext::user32dll.isTouchWindow(m_data.hwnd, &touchFlags); @@ -2498,7 +2362,6 @@ void QWindowsWindow::registerTouchWindow(QWindowsWindowFunctions::TouchWindowTou else qErrnoWarning("RegisterTouchWindow() failed for window '%s'.", qPrintable(window()->objectName())); } -#endif // !Q_OS_WINCE } void QWindowsWindow::aboutToMakeCurrent() diff --git a/src/plugins/platforms/windows/qwindowswindow.h b/src/plugins/platforms/windows/qwindowswindow.h index 999761f3c6..070add052b 100644 --- a/src/plugins/platforms/windows/qwindowswindow.h +++ b/src/plugins/platforms/windows/qwindowswindow.h @@ -41,9 +41,6 @@ #define QWINDOWSWINDOW_H #include "qtwindows_additional.h" -#ifdef Q_OS_WINCE -# include "qplatformfunctions_wince.h" -#endif #include "qwindowscursor.h" #include <qpa/qplatformwindow.h> @@ -60,10 +57,8 @@ struct QWindowsGeometryHint explicit QWindowsGeometryHint(const QWindow *w, const QMargins &customMargins); static QMargins frame(DWORD style, DWORD exStyle); static bool handleCalculateSize(const QMargins &customMargins, const MSG &msg, LRESULT *result); -#ifndef Q_OS_WINCE //MinMax maybe define struct if not available void applyToMinMaxInfo(DWORD style, DWORD exStyle, MINMAXINFO *mmi) const; void applyToMinMaxInfo(HWND hwnd, MINMAXINFO *mmi) const; -#endif bool validSize(const QSize &s) const; static inline QPoint mapToGlobal(HWND hwnd, const QPoint &); @@ -83,10 +78,8 @@ struct QWindowCreationContext QWindowCreationContext(const QWindow *w, const QRect &r, const QMargins &customMargins, DWORD style, DWORD exStyle); -#ifndef Q_OS_WINCE //MinMax maybe define struct if not available void applyToMinMaxInfo(MINMAXINFO *mmi) const { geometryHint.applyToMinMaxInfo(style, exStyle, mmi); } -#endif QWindowsGeometryHint geometryHint; const QWindow *window; @@ -293,10 +286,8 @@ public: HDC getDC(); void releaseDC(); -#ifndef Q_OS_WINCE // maybe available on some SDKs revisit WM_GETMINMAXINFO void getSizeHints(MINMAXINFO *mmi) const; bool handleNonClientHitTest(const QPoint &globalPos, LRESULT *result) const; -#endif // !Q_OS_WINCE #ifndef QT_NO_CURSOR CursorHandlePtr cursor() const { return m_cursor; } @@ -316,12 +307,10 @@ public: void invalidateSurface() Q_DECL_OVERRIDE; void aboutToMakeCurrent(); -#ifndef Q_OS_WINCE void setAlertState(bool enabled) Q_DECL_OVERRIDE; bool isAlertState() const Q_DECL_OVERRIDE { return testFlag(AlertState); } void alertWindow(int durationMs = 0); void stopAlertWindow(); -#endif static void setTouchWindowTouchTypeStatic(QWindow *window, QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes); void registerTouchWindow(QWindowsWindowFunctions::TouchWindowTouchTypes touchTypes = QWindowsWindowFunctions::NormalTouch); @@ -355,9 +344,6 @@ private: unsigned m_savedStyle; QRect m_savedFrameGeometry; const QSurfaceFormat m_format; -#ifdef Q_OS_WINCE - bool m_previouslyHidden; -#endif HICON m_iconSmall; HICON m_iconBig; void *m_surface; @@ -366,11 +352,9 @@ private: #ifndef QT_NO_DEBUG_STREAM QDebug operator<<(QDebug d, const RECT &r); QDebug operator<<(QDebug d, const POINT &); -# ifndef Q_OS_WINCE QDebug operator<<(QDebug d, const MINMAXINFO &i); QDebug operator<<(QDebug d, const NCCALCSIZE_PARAMS &p); QDebug operator<<(QDebug d, const WINDOWPLACEMENT &); -# endif // !Q_OS_WINCE #endif // !QT_NO_DEBUG_STREAM // ---------- QWindowsGeometryHint inline functions. @@ -434,11 +418,7 @@ inline void QWindowsWindow::destroyIcon() inline bool QWindowsWindow::isLayered() const { -#ifndef Q_OS_WINCE return GetWindowLongPtr(m_data.hwnd, GWL_EXSTYLE) & WS_EX_LAYERED; -#else - return false; -#endif } QT_END_NAMESPACE diff --git a/src/plugins/platforms/windows/windows.pri b/src/plugins/platforms/windows/windows.pri index f4dbd10a49..b8476df792 100644 --- a/src/plugins/platforms/windows/windows.pri +++ b/src/plugins/platforms/windows/windows.pri @@ -1,14 +1,11 @@ # Note: OpenGL32 must precede Gdi32 as it overwrites some functions. -LIBS *= -lole32 -!wince: LIBS *= -luser32 -lwinspool -limm32 -lwinmm -loleaut32 +LIBS += -lole32 -luser32 -lwinspool -limm32 -lwinmm -loleaut32 contains(QT_CONFIG, opengl):!contains(QT_CONFIG, opengles2):!contains(QT_CONFIG, dynamicgl): LIBS *= -lopengl32 mingw: LIBS *= -luuid # For the dialog helpers: -!wince: LIBS *= -lshlwapi -lshell32 -!wince: LIBS *= -ladvapi32 -wince: DEFINES *= QT_LIBINFIX=L"\"\\\"$${QT_LIBINFIX}\\\"\"" +LIBS += -lshlwapi -lshell32 -ladvapi32 DEFINES *= QT_NO_CAST_FROM_ASCII @@ -62,7 +59,6 @@ HEADERS += \ $$PWD/qwindowstheme.h \ $$PWD/qwindowsdialoghelpers.h \ $$PWD/qwindowsservices.h \ - $$PWD/qplatformfunctions_wince.h \ $$PWD/qwindowsnativeimage.h \ $$PWD/qwindowsnativeinterface.h \ $$PWD/qwindowsopengltester.h \ @@ -101,36 +97,30 @@ contains(QT_CONFIG,dynamicgl) { } } -!wince:!contains( DEFINES, QT_NO_TABLETEVENT ) { +!contains( DEFINES, QT_NO_TABLETEVENT ) { INCLUDEPATH += $$QT_SOURCE_TREE/src/3rdparty/wintab HEADERS += $$PWD/qwindowstabletsupport.h SOURCES += $$PWD/qwindowstabletsupport.cpp } -!wince:!contains( DEFINES, QT_NO_SESSIONMANAGER ) { +!contains( DEFINES, QT_NO_SESSIONMANAGER ) { SOURCES += $$PWD/qwindowssessionmanager.cpp HEADERS += $$PWD/qwindowssessionmanager.h } -!wince:!contains( DEFINES, QT_NO_IMAGEFORMAT_PNG ) { - RESOURCES += $$PWD/cursors.qrc -} +!contains( DEFINES, QT_NO_IMAGEFORMAT_PNG ):RESOURCES += $$PWD/cursors.qrc -!wince: RESOURCES += $$PWD/openglblacklists.qrc +RESOURCES += $$PWD/openglblacklists.qrc contains(QT_CONFIG, freetype) { - DEFINES *= QT_NO_FONTCONFIG - include($$QT_SOURCE_TREE/src/3rdparty/freetype_dependency.pri) - HEADERS += \ - $$PWD/qwindowsfontdatabase_ft.h - SOURCES += \ - $$PWD/qwindowsfontdatabase_ft.cpp -} else:contains(QT_CONFIG, system-freetype) { - include($$QT_SOURCE_TREE/src/platformsupport/fontdatabases/basic/basic.pri) - HEADERS += \ - $$PWD/qwindowsfontdatabase_ft.h - SOURCES += \ - $$PWD/qwindowsfontdatabase_ft.cpp + HEADERS += $$PWD/qwindowsfontdatabase_ft.h + SOURCES += $$PWD/qwindowsfontdatabase_ft.cpp + contains(QT_CONFIG, system-freetype) { + include($$QT_SOURCE_TREE/src/platformsupport/fontdatabases/basic/basic.pri) + } else { + DEFINES *= QT_NO_FONTCONFIG + include($$QT_SOURCE_TREE/src/3rdparty/freetype_dependency.pri) + } } contains(QT_CONFIG, accessibility):include($$PWD/accessible/accessible.pri) diff --git a/src/plugins/platforms/windows/windows.pro b/src/plugins/platforms/windows/windows.pro index 2e0f723693..adafa830d5 100644 --- a/src/plugins/platforms/windows/windows.pro +++ b/src/plugins/platforms/windows/windows.pro @@ -4,7 +4,7 @@ QT *= core-private QT *= gui-private QT *= platformsupport-private -!wince:LIBS *= -lgdi32 +LIBS += -lgdi32 -ldwmapi include(windows.pri) diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.cpp b/src/plugins/platforms/xcb/qxcbbackingstore.cpp index a999fb0aa2..130ae9be0c 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.cpp +++ b/src/plugins/platforms/xcb/qxcbbackingstore.cpp @@ -223,14 +223,14 @@ bool QXcbShmImage::scroll(const QRegion &area, int dx, int dy) preparePaint(area); const QPoint delta(dx, dy); - foreach (const QRect &rect, area.rects()) + for (const QRect &rect : area) qt_scrollRectInImage(*image(), rect, delta); if (m_xcb_pixmap) { flushPixmap(area); ensureGC(m_xcb_pixmap); const QRect bounds(QPoint(0, 0), size()); - foreach (const QRect &src, area.rects()) { + for (const QRect &src : area) { const QRect dst = src.translated(delta).intersected(bounds); Q_XCB_CALL(xcb_copy_area(xcb_connection(), m_xcb_pixmap, @@ -531,11 +531,9 @@ void QXcbBackingStore::beginPaint(const QRegion ®ion) if (m_image->hasAlpha()) { QPainter p(paintDevice()); p.setCompositionMode(QPainter::CompositionMode_Source); - const QVector<QRect> rects = region.rects(); const QColor blank = Qt::transparent; - for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) { - p.fillRect(*it, blank); - } + for (const QRect &rect : region) + p.fillRect(rect, blank); } } @@ -555,22 +553,21 @@ void QXcbBackingStore::endPaint() // Slow path: the paint device was m_rgbImage. Now copy with swapping red // and blue into m_image. - const QVector<QRect> rects = region.rects(); - if (rects.isEmpty()) + auto it = region.begin(); + const auto end = region.end(); + if (it == end) return; QPainter p(m_image->image()); - for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) { + while (it != end) { const QRect rect = *it; p.drawImage(rect.topLeft(), m_rgbImage.copy(rect).rgbSwapped()); } } -#ifndef QT_NO_OPENGL QImage QXcbBackingStore::toImage() const { return m_image && m_image->image() ? *m_image->image() : QImage(); } -#endif QPlatformGraphicsBuffer *QXcbBackingStore::graphicsBuffer() const { diff --git a/src/plugins/platforms/xcb/qxcbbackingstore.h b/src/plugins/platforms/xcb/qxcbbackingstore.h index 5a8f385c1b..6af679d28a 100644 --- a/src/plugins/platforms/xcb/qxcbbackingstore.h +++ b/src/plugins/platforms/xcb/qxcbbackingstore.h @@ -63,8 +63,8 @@ public: void composeAndFlush(QWindow *window, const QRegion ®ion, const QPoint &offset, QPlatformTextureList *textures, QOpenGLContext *context, bool translucentBackground) Q_DECL_OVERRIDE; - QImage toImage() const Q_DECL_OVERRIDE; #endif + QImage toImage() const Q_DECL_OVERRIDE; QPlatformGraphicsBuffer *graphicsBuffer() const Q_DECL_OVERRIDE; diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 2c0f1f26b0..17fafd5ef0 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -2789,9 +2789,8 @@ void QXcbWindow::setMask(const QRegion ®ion) XCB_SHAPE_SK_BOUNDING, xcb_window(), 0, 0, XCB_NONE); } else { QVector<xcb_rectangle_t> rects; - const QVector<QRect> regionRects = region.rects(); - rects.reserve(regionRects.count()); - foreach (const QRect &r, regionRects) + rects.reserve(region.rectCount()); + for (const QRect &r : region) rects.push_back(qRectToXCBRectangle(r)); xcb_shape_rectangles(connection()->xcb_connection(), XCB_SHAPE_SO_SET, XCB_SHAPE_SK_BOUNDING, XCB_CLIP_ORDERING_UNSORTED, diff --git a/src/plugins/platforms/xcb/xcb_qpa_lib.pro b/src/plugins/platforms/xcb/xcb_qpa_lib.pro index f4a4e5a78a..cbb4c361f9 100644 --- a/src/plugins/platforms/xcb/xcb_qpa_lib.pro +++ b/src/plugins/platforms/xcb/xcb_qpa_lib.pro @@ -48,10 +48,10 @@ contains(QT_CONFIG, xcb-xlib) { DEFINES += XCB_USE_XINPUT2 SOURCES += qxcbconnection_xi2.cpp LIBS += -lXi - !isEmpty(QMAKE_LIBXI_VERSION_MAJOR) { - DEFINES += LIBXI_MAJOR=$$QMAKE_LIBXI_VERSION_MAJOR \ - LIBXI_MINOR=$$QMAKE_LIBXI_VERSION_MINOR \ - LIBXI_PATCH=$$QMAKE_LIBXI_VERSION_PATCH + !isEmpty(QMAKE_XINPUT2_VERSION_MAJOR) { + DEFINES += LIBXI_MAJOR=$$QMAKE_XINPUT2_VERSION_MAJOR \ + LIBXI_MINOR=$$QMAKE_XINPUT2_VERSION_MINOR \ + LIBXI_PATCH=$$QMAKE_XINPUT2_VERSION_PATCH } } } @@ -81,7 +81,7 @@ CONFIG += qpa/genericunixfontdatabase contains(QT_CONFIG, dbus-linked) { QT += dbus - LIBS += $$QT_LIBS_DBUS + LIBS += $$QMAKE_LIBS_DBUS } contains(QT_CONFIG, xcb-qt) { |