From 1582407fc782c0befd0760633324dd5c206524a1 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Thu, 13 Oct 2011 14:25:18 +0200 Subject: Remove Q_WS_ and Q_OS_SYMBIAN from QtGui. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I2ac3376513c3fbfc81a2e695a73a0d948d2696bc Reviewed-on: http://codereview.qt-project.org/6607 Reviewed-by: Samuel Rødal --- src/gui/egl/qegl.cpp | 2 - src/gui/egl/qegl_p.h | 48 --- src/gui/egl/qegl_stub.cpp | 2 - src/gui/egl/qeglproperties_p.h | 3 - src/gui/image/qbmphandler.cpp | 15 - src/gui/image/qimage.cpp | 15 - src/gui/image/qnativeimage.cpp | 143 --------- src/gui/image/qnativeimage_p.h | 15 - src/gui/image/qpixmap.cpp | 2 - src/gui/image/qpixmap_blitter.cpp | 2 - src/gui/image/qpixmap_raster.cpp | 48 --- src/gui/image/qpixmap_raster_p.h | 3 - src/gui/image/qpixmapcache.cpp | 4 - src/gui/image/qplatformpixmap.cpp | 11 - src/gui/image/qplatformpixmap_qpa.h | 3 - src/gui/image/qvolatileimage.cpp | 24 -- src/gui/image/qvolatileimagedata_p.h | 13 - src/gui/kernel/qcursor.cpp | 4 - src/gui/kernel/qcursor.h | 33 -- src/gui/kernel/qcursor_p.h | 45 --- src/gui/kernel/qdnd.cpp | 19 -- src/gui/kernel/qevent.cpp | 45 --- src/gui/kernel/qevent.h | 6 - src/gui/kernel/qevent_p.h | 6 - src/gui/kernel/qguiapplication.cpp | 115 ------- src/gui/kernel/qkeymapper_p.h | 62 +--- src/gui/kernel/qsessionmanager.h | 3 - src/gui/kernel/qwindowdefs.h | 36 --- src/gui/opengl/qopenglfunctions.h | 8 - src/gui/opengl/qopenglpaintengine.cpp | 26 -- src/gui/opengl/qopengltextureglyphcache.cpp | 3 - src/gui/painting/qbrush.h | 3 - src/gui/painting/qdrawhelper.cpp | 21 -- src/gui/painting/qdrawhelper_arm_simd.cpp | 217 ------------- src/gui/painting/qpaintdevice.cpp | 7 - src/gui/painting/qpaintdevice.h | 3 - src/gui/painting/qpaintengine.cpp | 26 -- src/gui/painting/qpaintengine.h | 11 - src/gui/painting/qpaintengine_raster.cpp | 115 ------- src/gui/painting/qpaintengine_raster_p.h | 7 - src/gui/painting/qpaintengineex.cpp | 9 - src/gui/painting/qpainter.cpp | 6 - src/gui/painting/qpainterpath.cpp | 3 - src/gui/painting/qpdf.cpp | 12 - src/gui/painting/qrasterizer_p.h | 3 - src/gui/painting/qregion.cpp | 63 +--- src/gui/painting/qregion.h | 42 --- src/gui/painting/qtextureglyphcache.cpp | 40 --- src/gui/text/qabstractfontengine_p.h | 2 - src/gui/text/qfont.cpp | 198 ------------ src/gui/text/qfont.h | 21 -- src/gui/text/qfont_p.h | 28 -- src/gui/text/qfontdatabase.cpp | 457 +--------------------------- src/gui/text/qfontdatabase.h | 5 - src/gui/text/qfontengine.cpp | 14 - src/gui/text/qfontengine_ft.cpp | 4 - src/gui/text/qfontengine_ft_p.h | 10 - src/gui/text/qfontengine_p.h | 67 ---- src/gui/text/qfontengine_qpf.cpp | 31 -- src/gui/text/qfontengineglyphcache_p.h | 9 - src/gui/text/qfontmetrics.cpp | 16 - src/gui/text/qfontmetrics.h | 6 - src/gui/text/qfontsubset.cpp | 34 --- src/gui/text/qlinecontrol.cpp | 39 --- src/gui/text/qrawfont.cpp | 18 -- src/gui/text/qrawfont_ft.cpp | 11 - src/gui/text/qrawfont_p.h | 20 -- src/gui/text/qtextcontrol.cpp | 10 - src/gui/text/qtextengine.cpp | 222 -------------- src/gui/text/qtextengine_p.h | 6 - src/gui/text/qtextlayout.cpp | 17 +- src/gui/util/qdesktopservices.cpp | 10 - src/gui/util/qdesktopservices_s60.cpp | 5 - src/gui/util/qdesktopservices_win.cpp | 4 - 74 files changed, 5 insertions(+), 2611 deletions(-) (limited to 'src') diff --git a/src/gui/egl/qegl.cpp b/src/gui/egl/qegl.cpp index 2f2f7724a4..4675533144 100644 --- a/src/gui/egl/qegl.cpp +++ b/src/gui/egl/qegl.cpp @@ -636,7 +636,6 @@ EGLBoolean QEgl::eglSwapBuffersRegion2NOK(EGLDisplay dpy, EGLSurface surface, EG return 0; } -#ifndef Q_WS_X11 EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties) { // Create the native drawable for the paint device. @@ -674,7 +673,6 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglPr } return surf; } -#endif // Return the error string associated with a specific code. diff --git a/src/gui/egl/qegl_p.h b/src/gui/egl/qegl_p.h index e0c02aa150..db8d8b7a38 100644 --- a/src/gui/egl/qegl_p.h +++ b/src/gui/egl/qegl_p.h @@ -87,25 +87,6 @@ typedef int EGLClientBuffer; #endif -#if defined(Q_WS_X11) -// If included , then the global namespace -// may have been polluted with X #define's. The following makes sure -// the X11 headers were included properly and then cleans things up. -#include -#include -#undef Bool -#undef Status -#undef None -#undef KeyPress -#undef KeyRelease -#undef FocusIn -#undef FocusOut -#undef Type -#undef FontChange -#undef CursorShape -#undef Unsorted -#undef GrayScale -#endif // Internally we use the EGL-prefixed native types which are used in EGL >= 1.3. // For older versions of EGL, we have to define these types ourselves here: @@ -133,37 +114,11 @@ QT_BEGIN_NAMESPACE #endif // Try to get some info to debug the symbian build failues: -#ifdef Q_OS_SYMBIAN - -#ifdef EGL_KHR_image -#warning "EGL_KHR_image is defined" -#else -#warning "EGL_KHR_image is NOT defined" -#endif - -#ifdef EGL_KHR_image_base -#warning "EGL_KHR_image_base is defined" -#else -#warning "EGL_KHR_image_base is NOT defined" -#endif - -#ifdef EGL_EGLEXT_PROTOTYPES -#warning "EGL_EGLEXT_PROTOTYPES is defined" -#else -#warning "EGL_EGLEXT_PROTOTYPES NOT not defined" -#endif - -#endif // Declare/define the bits of EGL_KHR_image_base we need: #if !defined(EGL_KHR_image) && !defined(EGL_KHR_image_base) -#ifdef Q_OS_SYMBIAN -//symbian version of eglext.h differs from the khronos reference -typedef int EGLImageKHR; -#else typedef void *EGLImageKHR; -#endif #define EGL_NO_IMAGE_KHR ((EGLImageKHR)0) #define EGL_IMAGE_PRESERVED_KHR 0x30D2 @@ -230,9 +185,6 @@ namespace QEgl { Q_GUI_EXPORT EGLBoolean eglDestroyImageKHR(EGLDisplay dpy, EGLImageKHR img); Q_GUI_EXPORT EGLBoolean eglSwapBuffersRegion2NOK(EGLDisplay dpy, EGLSurface surface, EGLint count, const EGLint *rects); -#ifdef Q_WS_X11 - Q_GUI_EXPORT VisualID getCompatibleVisualId(EGLConfig config); -#endif } Q_DECLARE_OPERATORS_FOR_FLAGS(QEgl::ConfigOptions) diff --git a/src/gui/egl/qegl_stub.cpp b/src/gui/egl/qegl_stub.cpp index 3e9ccd3861..b86f4dc2c0 100644 --- a/src/gui/egl/qegl_stub.cpp +++ b/src/gui/egl/qegl_stub.cpp @@ -226,7 +226,6 @@ EGLBoolean QEgl::eglSwapBuffersRegion2NOK(EGLDisplay dpy, EGLSurface surface, EG return 0; } -#ifndef Q_WS_X11 EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglProperties *properties) { Q_UNUSED(device) @@ -235,7 +234,6 @@ EGLSurface QEgl::createSurface(QPaintDevice *device, EGLConfig cfg, const QEglPr NOEGL return 0; } -#endif // Return the error string associated with a specific code. diff --git a/src/gui/egl/qeglproperties_p.h b/src/gui/egl/qeglproperties_p.h index d8d64e01a1..23f3000923 100644 --- a/src/gui/egl/qeglproperties_p.h +++ b/src/gui/egl/qeglproperties_p.h @@ -79,9 +79,6 @@ public: const int *properties() const { return props.constData(); } void setPixelFormat(QImage::Format pixelFormat); -#ifdef Q_WS_X11 - void setVisualFormat(const QX11Info *xinfo); -#endif void setDeviceType(int devType); void setPaintDeviceFormat(QPaintDevice *dev); void setRenderableType(QEgl::API api); diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index d854b1765b..3011a6c130 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -580,12 +580,6 @@ bool qt_write_dib(QDataStream &s, QImage image) } else if (image.depth() == 32) { bpl_bmp = ((image.width()*24+31)/32)*4; nbits = 24; -#ifdef Q_WS_QWS - } else if (image.depth() == 1 || image.depth() == 8) { - // Qt for Embedded Linux doesn't word align. - bpl_bmp = ((image.width()*image.depth()+31)/32)*4; - nbits = image.depth(); -#endif } else { bpl_bmp = bpl; nbits = image.depth(); @@ -631,18 +625,9 @@ bool qt_write_dib(QDataStream &s, QImage image) int y; if (nbits == 1 || nbits == 8) { // direct output -#ifdef Q_WS_QWS - // Qt for Embedded Linux doesn't word align. - int pad = bpl_bmp - bpl; - char padding[4]; -#endif for (y=image.height()-1; y>=0; y--) { if (d->write((char*)image.scanLine(y), bpl) == -1) return false; -#ifdef Q_WS_QWS - if (d->write(padding, pad) == -1) - return false; -#endif } return true; } diff --git a/src/gui/image/qimage.cpp b/src/gui/image/qimage.cpp index d0de95366f..67facafade 100644 --- a/src/gui/image/qimage.cpp +++ b/src/gui/image/qimage.cpp @@ -5392,21 +5392,6 @@ bool qt_xForm_helper(const QTransform &trueMat, int xoffset, int type, int depth dptr++; } break; -# if defined(Q_WS_WIN) - case QT_XFORM_TYPE_WINDOWSPIXMAP: - while (dptr < maxp) { - IWX_PIX(128); - IWX_PIX(64); - IWX_PIX(32); - IWX_PIX(16); - IWX_PIX(8); - IWX_PIX(4); - IWX_PIX(2); - IWX_PIX(1); - dptr++; - } - break; -# endif } } m21ydx += m21; diff --git a/src/gui/image/qnativeimage.cpp b/src/gui/image/qnativeimage.cpp index 35bca4431d..30c1c0621e 100644 --- a/src/gui/image/qnativeimage.cpp +++ b/src/gui/image/qnativeimage.cpp @@ -48,152 +48,10 @@ #include "private/qguiapplication_p.h" -#if defined(Q_WS_X11) && !defined(QT_NO_MITSHM) -#include -#include -#include -#endif -#ifdef Q_WS_MAC -#include -#endif QT_BEGIN_NAMESPACE -#ifdef Q_WS_WIN -typedef struct { - BITMAPINFOHEADER bmiHeader; - DWORD redMask; - DWORD greenMask; - DWORD blueMask; -} BITMAPINFO_MASK; - - -QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool isTextBuffer, QWindow *) -{ -#ifndef Q_WS_WINCE - Q_UNUSED(isTextBuffer); -#endif - BITMAPINFO_MASK bmi; - memset(&bmi, 0, sizeof(bmi)); - bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bmi.bmiHeader.biWidth = width; - bmi.bmiHeader.biHeight = -height; - bmi.bmiHeader.biPlanes = 1; - bmi.bmiHeader.biSizeImage = 0; - - if (format == QImage::Format_RGB16) { - bmi.bmiHeader.biBitCount = 16; -#ifdef Q_WS_WINCE - if (isTextBuffer) { - bmi.bmiHeader.biCompression = BI_RGB; - bmi.redMask = 0; - bmi.greenMask = 0; - bmi.blueMask = 0; - } else -#endif - { - bmi.bmiHeader.biCompression = BI_BITFIELDS; - bmi.redMask = 0xF800; - bmi.greenMask = 0x07E0; - bmi.blueMask = 0x001F; - } - } else { - bmi.bmiHeader.biBitCount = 32; - bmi.bmiHeader.biCompression = BI_RGB; - bmi.redMask = 0; - bmi.greenMask = 0; - bmi.blueMask = 0; - } - - HDC display_dc = GetDC(0); - hdc = CreateCompatibleDC(display_dc); - ReleaseDC(0, display_dc); - Q_ASSERT(hdc); - - uchar *bits = 0; - bitmap = CreateDIBSection(hdc, reinterpret_cast(&bmi), DIB_RGB_COLORS, (void**) &bits, 0, 0); - Q_ASSERT(bitmap); - Q_ASSERT(bits); - - null_bitmap = (HBITMAP)SelectObject(hdc, bitmap); - image = QImage(bits, width, height, format); - - Q_ASSERT(image.paintEngine()->type() == QPaintEngine::Raster); - static_cast(image.paintEngine())->setDC(hdc); - -#ifndef Q_WS_WINCE - GdiFlush(); -#endif -} - -QNativeImage::~QNativeImage() -{ - if (bitmap || hdc) { - Q_ASSERT(hdc); - Q_ASSERT(bitmap); - if (null_bitmap) - SelectObject(hdc, null_bitmap); - DeleteDC(hdc); - DeleteObject(bitmap); - } -} - -QImage::Format QNativeImage::systemFormat() -{ - if (QGuiApplication::primaryScreen()->depth() == 16) - return QImage::Format_RGB16; - return QImage::Format_RGB32; -} - -#elif defined(Q_WS_MAC) - -QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool /* isTextBuffer */, QWindow *) - : image(width, height, format) -{ - - uint cgflags = kCGImageAlphaNoneSkipFirst; - switch (format) { - case QImage::Format_ARGB32: - cgflags = kCGImageAlphaFirst; - break; - case QImage::Format_ARGB32_Premultiplied: - case QImage::Format_ARGB8565_Premultiplied: - case QImage::Format_ARGB6666_Premultiplied: - case QImage::Format_ARGB8555_Premultiplied: - case QImage::Format_ARGB4444_Premultiplied: - cgflags = kCGImageAlphaPremultipliedFirst; - break; - default: - break; - } - -#ifdef kCGBitmapByteOrder32Host //only needed because CGImage.h added symbols in the minor version - cgflags |= kCGBitmapByteOrder32Host; -#endif - - cg = CGBitmapContextCreate(image.bits(), width, height, 8, image.bytesPerLine(), - QCoreGraphicsPaintEngine::macDisplayColorSpace(0), cgflags); - CGContextTranslateCTM(cg, 0, height); - CGContextScaleCTM(cg, 1, -1); - - Q_ASSERT(image.paintEngine()->type() == QPaintEngine::Raster); - static_cast(image.paintEngine())->setCGContext(cg); -} - - -QNativeImage::~QNativeImage() -{ - CGContextRelease(cg); -} - -QImage::Format QNativeImage::systemFormat() -{ - return QImage::Format_RGB32; -} - - -#else // other platforms... QNativeImage::QNativeImage(int width, int height, QImage::Format format, bool /* isTextBuffer */, QWindow *) : image(width, height, format) @@ -211,7 +69,6 @@ QImage::Format QNativeImage::systemFormat() return QGuiApplication::primaryScreen()->handle()->format(); } -#endif // platforms QT_END_NAMESPACE diff --git a/src/gui/image/qnativeimage_p.h b/src/gui/image/qnativeimage_p.h index f9132de69e..433460b463 100644 --- a/src/gui/image/qnativeimage_p.h +++ b/src/gui/image/qnativeimage_p.h @@ -55,13 +55,6 @@ #include "qimage.h" -#ifdef Q_WS_WIN -#include "qt_windows.h" - -#elif defined(Q_WS_MAC) -#include - -#endif QT_BEGIN_NAMESPACE @@ -80,14 +73,6 @@ public: static QImage::Format systemFormat(); -#ifdef Q_WS_WIN - HDC hdc; - HBITMAP bitmap; - HBITMAP null_bitmap; - -#elif defined(Q_WS_MAC) - CGContextRef cg; -#endif private: Q_DISABLE_COPY(QNativeImage) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index 35b9ae33ec..c025aa9283 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -63,9 +63,7 @@ #include "qthread.h" #include "qdebug.h" -#ifdef Q_WS_QPA # include "qplatformintegration_qpa.h" -#endif #include "qpixmap_raster_p.h" #include "private/qhexstring_p.h" diff --git a/src/gui/image/qpixmap_blitter.cpp b/src/gui/image/qpixmap_blitter.cpp index 25801dbd4c..16e914c8ee 100644 --- a/src/gui/image/qpixmap_blitter.cpp +++ b/src/gui/image/qpixmap_blitter.cpp @@ -93,9 +93,7 @@ void QBlittablePlatformPixmap::resize(int width, int height) { m_blittable.reset(0); m_engine.reset(0); -#ifdef Q_WS_QPA d = QGuiApplication::primaryScreen()->depth(); -#endif w = width; h = height; is_null = (w <= 0 || h <= 0); diff --git a/src/gui/image/qpixmap_raster.cpp b/src/gui/image/qpixmap_raster.cpp index ce7d66043c..887074c7b7 100644 --- a/src/gui/image/qpixmap_raster.cpp +++ b/src/gui/image/qpixmap_raster.cpp @@ -98,22 +98,10 @@ QPlatformPixmap *QRasterPlatformPixmap::createCompatiblePlatformPixmap() const void QRasterPlatformPixmap::resize(int width, int height) { QImage::Format format; -#ifdef Q_WS_QWS - if (pixelType() == BitmapType) { - format = QImage::Format_Mono; - } else { - format = QScreen::instance()->pixelFormat(); - if (format == QImage::Format_Invalid) - format = QImage::Format_ARGB32_Premultiplied; - else if (format == QImage::Format_Indexed8) // currently not supported - format = QImage::Format_RGB444; - } -#else if (pixelType() == BitmapType) format = QImage::Format_MonoLSB; else format = QNativeImage::systemFormat(); -#endif image = QImage(width, height, format); w = width; @@ -340,41 +328,6 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageC if (flags & Qt::NoFormatConversion) format = sourceImage.format(); else -#ifdef Q_WS_QWS - if (pixelType() == BitmapType) { - format = QImage::Format_Mono; - } else { - format = QScreen::instance()->pixelFormat(); - if (format == QImage::Format_Invalid) - format = QImage::Format_ARGB32_Premultiplied; - else if (format == QImage::Format_Indexed8) // currently not supported - format = QImage::Format_RGB444; - } - - if (sourceImage.hasAlphaChannel() - && ((flags & Qt::NoOpaqueDetection) - || const_cast(sourceImage).data_ptr()->checkForAlphaPixels())) { - switch (format) { - case QImage::Format_RGB16: - format = QImage::Format_ARGB8565_Premultiplied; - break; - case QImage::Format_RGB666: - format = QImage::Format_ARGB6666_Premultiplied; - break; - case QImage::Format_RGB555: - format = QImage::Format_ARGB8555_Premultiplied; - break; - case QImage::Format_RGB444: - format = QImage::Format_ARGB4444_Premultiplied; - break; - default: - format = QImage::Format_ARGB32_Premultiplied; - break; - } - } else if (format == QImage::Format_Invalid) { - format = QImage::Format_ARGB32_Premultiplied; - } -#else if (pixelType() == BitmapType) { format = QImage::Format_MonoLSB; } else { @@ -416,7 +369,6 @@ void QRasterPlatformPixmap::createPixmapForImage(QImage &sourceImage, Qt::ImageC } } } -#endif if (inPlace && sourceImage.d->convertInPlace(format, flags)) { image = sourceImage; diff --git a/src/gui/image/qpixmap_raster_p.h b/src/gui/image/qpixmap_raster_p.h index c451a94858..0de212dd61 100644 --- a/src/gui/image/qpixmap_raster_p.h +++ b/src/gui/image/qpixmap_raster_p.h @@ -55,9 +55,6 @@ #include -#ifdef Q_WS_WIN -# include "qt_windows.h" -#endif QT_BEGIN_NAMESPACE diff --git a/src/gui/image/qpixmapcache.cpp b/src/gui/image/qpixmapcache.cpp index a85e092b83..94f38347c1 100644 --- a/src/gui/image/qpixmapcache.cpp +++ b/src/gui/image/qpixmapcache.cpp @@ -91,11 +91,7 @@ QT_BEGIN_NAMESPACE \sa QCache, QPixmap */ -#if defined(Q_WS_QWS) || defined(Q_WS_WINCE) -static int cache_limit = 2048; // 2048 KB cache limit for embedded -#else static int cache_limit = 10240; // 10 MB cache limit for desktop -#endif /*! \class QPixmapCache::Key diff --git a/src/gui/image/qplatformpixmap.cpp b/src/gui/image/qplatformpixmap.cpp index a214f397ed..e1bf944d9b 100644 --- a/src/gui/image/qplatformpixmap.cpp +++ b/src/gui/image/qplatformpixmap.cpp @@ -174,16 +174,5 @@ QImage* QPlatformPixmap::buffer() return 0; } -#if defined(Q_OS_SYMBIAN) -void* QPlatformPixmap::toNativeType(NativeType /* type */) -{ - return 0; -} - -void QPlatformPixmap::fromNativeType(void* /* pixmap */, NativeType /* typre */) -{ - return; -} -#endif QT_END_NAMESPACE diff --git a/src/gui/image/qplatformpixmap_qpa.h b/src/gui/image/qplatformpixmap_qpa.h index 929d7df789..ad0a8dc69e 100644 --- a/src/gui/image/qplatformpixmap_qpa.h +++ b/src/gui/image/qplatformpixmap_qpa.h @@ -154,9 +154,6 @@ private: # define QT_XFORM_TYPE_MSBFIRST 0 # define QT_XFORM_TYPE_LSBFIRST 1 -# if defined(Q_WS_WIN) -# define QT_XFORM_TYPE_WINDOWSPIXMAP 2 -# endif extern bool qt_xForm_helper(const QTransform&, int, int, int, uchar*, int, int, int, const uchar*, int, int, int); QT_END_NAMESPACE diff --git a/src/gui/image/qvolatileimage.cpp b/src/gui/image/qvolatileimage.cpp index f7fe70c496..8fd3620b4b 100644 --- a/src/gui/image/qvolatileimage.cpp +++ b/src/gui/image/qvolatileimage.cpp @@ -274,36 +274,12 @@ bool QVolatileImagePaintEngine::end() void QVolatileImagePaintEngine::drawPixmap(const QPointF &p, const QPixmap &pm) { -#ifdef Q_OS_SYMBIAN - void *nativeData = pm.handle()->toNativeType(QPlatformPixmap::VolatileImage); - if (nativeData) { - QVolatileImage *img = static_cast(nativeData); - img->beginDataAccess(); - QRasterPaintEngine::drawImage(p, img->imageRef()); - img->endDataAccess(true); - } else { - QRasterPaintEngine::drawPixmap(p, pm); - } -#else QRasterPaintEngine::drawPixmap(p, pm); -#endif } void QVolatileImagePaintEngine::drawPixmap(const QRectF &r, const QPixmap &pm, const QRectF &sr) { -#ifdef Q_OS_SYMBIAN - void *nativeData = pm.handle()->toNativeType(QPlatformPixmap::VolatileImage); - if (nativeData) { - QVolatileImage *img = static_cast(nativeData); - img->beginDataAccess(); - QRasterPaintEngine::drawImage(r, img->imageRef(), sr); - img->endDataAccess(true); - } else { - QRasterPaintEngine::drawPixmap(r, pm, sr); - } -#else QRasterPaintEngine::drawPixmap(r, pm, sr); -#endif } QT_END_NAMESPACE diff --git a/src/gui/image/qvolatileimagedata_p.h b/src/gui/image/qvolatileimagedata_p.h index b2161fc6db..9f817874a4 100644 --- a/src/gui/image/qvolatileimagedata_p.h +++ b/src/gui/image/qvolatileimagedata_p.h @@ -56,9 +56,6 @@ #include #include -#ifdef Q_OS_SYMBIAN -class CFbsBitmap; -#endif QT_BEGIN_NAMESPACE @@ -78,16 +75,6 @@ public: void *duplicateNativeImage() const; void ensureImage(); -#ifdef Q_OS_SYMBIAN - void updateImage(); - void initWithBitmap(CFbsBitmap *source); - void applyMask(CFbsBitmap *mask); - void ensureBitmap(); - void release(); - QVolatileImageData *next; - QVolatileImageData *prev; - CFbsBitmap *bitmap; -#endif QImage image; QPaintEngine *pengine; }; diff --git a/src/gui/kernel/qcursor.cpp b/src/gui/kernel/qcursor.cpp index 9ca06aaa98..faa9500f9f 100644 --- a/src/gui/kernel/qcursor.cpp +++ b/src/gui/kernel/qcursor.cpp @@ -395,10 +395,6 @@ void QCursorData::initialize() { if (QCursorData::initialized) return; -#ifdef Q_WS_MAC - // DRSWAT - Not Needed Cocoa or Carbon - //InitCursor(); -#endif for (int shape = 0; shape <= Qt::LastCursor; ++shape) qt_cursorTable[shape] = new QCursorData((Qt::CursorShape)shape); QCursorData::initialized = true; diff --git a/src/gui/kernel/qcursor.h b/src/gui/kernel/qcursor.h index dac74c2c01..584aff42d3 100644 --- a/src/gui/kernel/qcursor.h +++ b/src/gui/kernel/qcursor.h @@ -76,15 +76,6 @@ class QCursorData; class QBitmap; class QPixmap; -#if defined(Q_WS_MAC) -void qt_mac_set_cursor(const QCursor *c); -#endif -#if defined(Q_OS_SYMBIAN) -extern void qt_symbian_show_pointer_sprite(); -extern void qt_symbian_hide_pointer_sprite(); -extern void qt_symbian_set_pointer_sprite(const QCursor& cursor); -extern void qt_symbian_move_cursor_sprite(); -#endif class Q_GUI_EXPORT QCursor { @@ -121,35 +112,11 @@ public: #endif #ifndef qdoc -#if defined(Q_WS_WIN) - HCURSOR handle() const; - QCursor(HCURSOR cursor); -#elif defined(Q_WS_X11) - Qt::HANDLE handle() const; - QCursor(Qt::HANDLE cursor); - static int x11Screen(); -#elif defined(Q_WS_MAC) - Qt::HANDLE handle() const; -#elif defined(Q_WS_QWS) || defined(Q_WS_QPA) int handle() const; -#elif defined(Q_OS_SYMBIAN) - Qt::HANDLE handle() const; -#endif #endif private: QCursorData *d; -#if defined(Q_WS_MAC) - friend void *qt_mac_nsCursorForQCursor(const QCursor &c); - friend void qt_mac_set_cursor(const QCursor *c); - friend void qt_mac_updateCursorWithWidgetUnderMouse(QWidget *widgetUnderMouse); -#endif -#if defined(Q_OS_SYMBIAN) - friend void qt_symbian_show_pointer_sprite(); - friend void qt_symbian_hide_pointer_sprite(); - friend void qt_symbian_set_pointer_sprite(const QCursor& cursor); - friend void qt_symbian_move_cursor_sprite(); -#endif }; /***************************************************************************** diff --git a/src/gui/kernel/qcursor_p.h b/src/gui/kernel/qcursor_p.h index 775d46d792..71a07cca49 100644 --- a/src/gui/kernel/qcursor_p.h +++ b/src/gui/kernel/qcursor_p.h @@ -58,22 +58,9 @@ #include "QtCore/qnamespace.h" #include "QtGui/qpixmap.h" -# if defined (Q_WS_MAC) -# include "private/qt_mac_p.h" -# elif defined(Q_WS_X11) -# include "private/qt_x11_p.h" -# elif defined(Q_WS_WIN) -# include "QtCore/qt_windows.h" -# elif defined(Q_OS_SYMBIAN) -# include "private/qt_s60_p.h" -#endif QT_BEGIN_NAMESPACE -#if defined (Q_WS_MAC) -void *qt_mac_nsCursorForQCursor(const QCursor &c); -class QMacAnimateCursor; -#endif class QBitmap; class QCursorData { @@ -89,39 +76,7 @@ public: QBitmap *bm, *bmm; QPixmap pixmap; short hx, hy; -#if defined (Q_WS_MAC) - int mId; -#elif defined(Q_WS_QWS) || defined(Q_WS_QPA) int id; -#endif -#if defined (Q_WS_WIN) - HCURSOR hcurs; -#elif defined (Q_WS_X11) - XColor fg, bg; - Cursor hcurs; - Pixmap pm, pmm; -#elif defined (Q_WS_MAC) - enum { TYPE_None, TYPE_ImageCursor, TYPE_ThemeCursor } type; - union { - struct { - uint my_cursor:1; - void *nscursor; - } cp; - struct { - QMacAnimateCursor *anim; - ThemeCursor curs; - } tc; - } curs; - void initCursorFromBitmap(); - void initCursorFromPixmap(); -#elif defined Q_OS_SYMBIAN - void loadShapeFromResource(RWsSpriteBase& target, QString resource, int hx, int hy, int interval=0); - void constructShapeSprite(RWsSpriteBase& target); - void constructCursorSprite(RWsSpriteBase& target); - RWsPointerCursor pcurs; - RWsSprite scurs; - RPointerArray nativeSpriteMembers; -#endif static bool initialized; void update(); static QCursorData *setBitmap(const QBitmap &bitmap, const QBitmap &mask, int hotX, int hotY); diff --git a/src/gui/kernel/qdnd.cpp b/src/gui/kernel/qdnd.cpp index de255b9cc5..6cf986ff66 100644 --- a/src/gui/kernel/qdnd.cpp +++ b/src/gui/kernel/qdnd.cpp @@ -132,18 +132,12 @@ QDragManager::QDragManager() { Q_ASSERT(!instance); -#ifdef Q_WS_QWS - currentActionForOverrideCursor = Qt::IgnoreAction; -#endif object = 0; beingCancelled = false; restoreCursor = false; willDrop = false; eventLoop = 0; currentDropTarget = 0; -#ifdef Q_WS_X11 - xdndMimeTransferedPixmapIndex = 0; -#endif shapedPixmapWindow = 0; possible_actions = Qt::IgnoreAction; @@ -211,21 +205,9 @@ Qt::DropAction QDragManager::defaultAction(Qt::DropActions possibleActions, if (defaultAction == Qt::IgnoreAction) { //This means that the drag was initiated by QDrag::start and we need to //preserve the old behavior -#ifdef Q_WS_MAC - defaultAction = Qt::MoveAction; -#else defaultAction = Qt::CopyAction; -#endif } -#ifdef Q_WS_MAC - if (modifiers & Qt::ControlModifier && modifiers & Qt::AltModifier) - defaultAction = Qt::LinkAction; - else if (modifiers & Qt::AltModifier) - defaultAction = Qt::CopyAction; - else if (modifiers & Qt::ControlModifier) - defaultAction = Qt::MoveAction; -#else if (modifiers & Qt::ControlModifier && modifiers & Qt::ShiftModifier) defaultAction = Qt::LinkAction; else if (modifiers & Qt::ControlModifier) @@ -234,7 +216,6 @@ Qt::DropAction QDragManager::defaultAction(Qt::DropActions possibleActions, defaultAction = Qt::MoveAction; else if (modifiers & Qt::AltModifier) defaultAction = Qt::LinkAction; -#endif #ifdef QDND_DEBUG qDebug("possible actions : %s", dragActionsToString(possibleActions).latin1()); diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index ed22ffe148..c9e49ef700 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -50,9 +50,6 @@ #include "qevent_p.h" #include "qmath.h" -#ifdef Q_OS_SYMBIAN -#include "private/qcore_symbian_p.h" -#endif QT_BEGIN_NAMESPACE @@ -838,16 +835,6 @@ bool QKeyEvent::matches(QKeySequence::StandardKey matchKey) const uint searchkey = (modifiers() | key()) & ~(Qt::KeypadModifier); //The keypad modifier should not make a difference uint platform = QGuiApplicationPrivate::currentKeyPlatform(); -#ifdef Q_WS_MAC - if (qApp->testAttribute(Qt::AA_MacDontSwapCtrlAndMeta)) { - uint oldSearchKey = searchkey; - searchkey &= ~(Qt::ControlModifier | Qt::MetaModifier); - if (oldSearchKey & Qt::ControlModifier) - searchkey |= Qt::MetaModifier; - if (oldSearchKey & Qt::MetaModifier) - searchkey |= Qt::ControlModifier; - } -#endif uint N = QKeySequencePrivate::numberOfKeyBindings; int first = 0; @@ -2733,9 +2720,6 @@ QShowEvent::~QShowEvent() QFileOpenEventPrivate::~QFileOpenEventPrivate() { -#ifdef Q_OS_SYMBIAN - file.Close(); -#endif } /*! @@ -2761,21 +2745,6 @@ QFileOpenEvent::QFileOpenEvent(const QUrl &url) f = url.toLocalFile(); } -#ifdef Q_OS_SYMBIAN -/*! \internal -*/ -QFileOpenEvent::QFileOpenEvent(const RFile &fileHandle) - : QEvent(FileOpen) -{ - TFileName fullName; - fileHandle.FullName(fullName); - f = qt_TDesC2QString(fullName); - QScopedPointer priv(new QFileOpenEventPrivate(QUrl::fromLocalFile(f))); - // Duplicate here allows the file handle to be valid after S60 app construction is complete. - qt_symbian_throwIfError(priv->file.Duplicate(fileHandle)); - d = reinterpret_cast(priv.take()); -} -#endif /*! \internal */ @@ -2818,20 +2787,6 @@ QUrl QFileOpenEvent::url() const bool QFileOpenEvent::openFile(QFile &file, QIODevice::OpenMode flags) const { file.setFileName(f); -#ifdef Q_OS_SYMBIAN - const QFileOpenEventPrivate *priv = reinterpret_cast(d); - if (priv->file.SubSessionHandle()) { - RFile dup; - // Duplicate here means that the opened QFile will continue to be valid beyond the lifetime of this QFileOpenEvent. - // It also allows openFile to be used in threads other than the thread in which the QFileOpenEvent was created. - if (dup.Duplicate(priv->file) == KErrNone) { - QScopedPointer > dupCloser(&dup); - bool open = file.open(dup, flags, QFile::AutoCloseHandle); - dupCloser.take(); - return open; - } - } -#endif return file.open(flags); } diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index eea9b2bdf1..ae16776c57 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -55,9 +55,6 @@ #include #include -#ifdef Q_OS_SYMBIAN -class RFile; -#endif QT_BEGIN_HEADER @@ -609,9 +606,6 @@ class Q_GUI_EXPORT QFileOpenEvent : public QEvent public: QFileOpenEvent(const QString &file); QFileOpenEvent(const QUrl &url); -#ifdef Q_OS_SYMBIAN - QFileOpenEvent(const RFile &fileHandle); -#endif ~QFileOpenEvent(); inline QString file() const { return f; } diff --git a/src/gui/kernel/qevent_p.h b/src/gui/kernel/qevent_p.h index f304f44846..1d65eb63be 100644 --- a/src/gui/kernel/qevent_p.h +++ b/src/gui/kernel/qevent_p.h @@ -46,9 +46,6 @@ #include #include -#ifdef Q_OS_SYMBIAN -#include -#endif QT_BEGIN_NAMESPACE @@ -120,9 +117,6 @@ public: ~QFileOpenEventPrivate(); QUrl url; -#ifdef Q_OS_SYMBIAN - RFile file; -#endif }; diff --git a/src/gui/kernel/qguiapplication.cpp b/src/gui/kernel/qguiapplication.cpp index 723f69199f..e4216a60b9 100644 --- a/src/gui/kernel/qguiapplication.cpp +++ b/src/gui/kernel/qguiapplication.cpp @@ -1369,13 +1369,8 @@ Qt::LayoutDirection QGuiApplication::keyboardInputDirection() static const char * const move_xpm[] = { "11 20 3 1", ". c None", -#if defined(Q_WS_WIN) -"a c #000000", -"X c #FFFFFF", // Windows cursor is traditionally white -#else "a c #FFFFFF", "X c #000000", // X11 cursor is traditionally black -#endif "aa.........", "aXa........", "aXXa.......", @@ -1397,44 +1392,6 @@ static const char * const move_xpm[] = { ".......aXXa", "........aa."}; -#ifdef Q_WS_WIN -/* XPM */ -static const char * const ignore_xpm[] = { -"24 30 3 1", -". c None", -"a c #000000", -"X c #FFFFFF", -"aa......................", -"aXa.....................", -"aXXa....................", -"aXXXa...................", -"aXXXXa..................", -"aXXXXXa.................", -"aXXXXXXa................", -"aXXXXXXXa...............", -"aXXXXXXXXa..............", -"aXXXXXXXXXa.............", -"aXXXXXXaaaa.............", -"aXXXaXXa................", -"aXXaaXXa................", -"aXa..aXXa...............", -"aa...aXXa...............", -"a.....aXXa..............", -"......aXXa.....XXXX.....", -".......aXXa..XXaaaaXX...", -".......aXXa.XaaaaaaaaX..", -"........aa.XaaaXXXXaaaX.", -"...........XaaaaX..XaaX.", -"..........XaaXaaaX..XaaX", -"..........XaaXXaaaX.XaaX", -"..........XaaX.XaaaXXaaX", -"..........XaaX..XaaaXaaX", -"...........XaaX..XaaaaX.", -"...........XaaaXXXXaaaX.", -"............XaaaaaaaaX..", -".............XXaaaaXX...", -"...............XXXX....."}; -#endif /* XPM */ static const char * const copy_xpm[] = { @@ -1442,28 +1399,6 @@ static const char * const copy_xpm[] = { ". c None", "a c #000000", "X c #FFFFFF", -#if defined(Q_WS_WIN) // Windows cursor is traditionally white -"aa......................", -"aXa.....................", -"aXXa....................", -"aXXXa...................", -"aXXXXa..................", -"aXXXXXa.................", -"aXXXXXXa................", -"aXXXXXXXa...............", -"aXXXXXXXXa..............", -"aXXXXXXXXXa.............", -"aXXXXXXaaaa.............", -"aXXXaXXa................", -"aXXaaXXa................", -"aXa..aXXa...............", -"aa...aXXa...............", -"a.....aXXa..............", -"......aXXa..............", -".......aXXa.............", -".......aXXa.............", -"........aa...aaaaaaaaaaa", -#else "XX......................", "XaX.....................", "XaaX....................", @@ -1484,7 +1419,6 @@ static const char * const copy_xpm[] = { ".......XaaX.............", ".......XaaX.............", "........XX...aaaaaaaaaaa", -#endif ".............aXXXXXXXXXa", ".............aXXXXXXXXXa", ".............aXXXXaXXXXa", @@ -1502,28 +1436,6 @@ static const char * const link_xpm[] = { ". c None", "a c #000000", "X c #FFFFFF", -#if defined(Q_WS_WIN) // Windows cursor is traditionally white -"aa......................", -"aXa.....................", -"aXXa....................", -"aXXXa...................", -"aXXXXa..................", -"aXXXXXa.................", -"aXXXXXXa................", -"aXXXXXXXa...............", -"aXXXXXXXXa..............", -"aXXXXXXXXXa.............", -"aXXXXXXaaaa.............", -"aXXXaXXa................", -"aXXaaXXa................", -"aXa..aXXa...............", -"aa...aXXa...............", -"a.....aXXa..............", -"......aXXa..............", -".......aXXa.............", -".......aXXa.............", -"........aa...aaaaaaaaaaa", -#else "XX......................", "XaX.....................", "XaaX....................", @@ -1544,7 +1456,6 @@ static const char * const link_xpm[] = { ".......XaaX.............", ".......XaaX.............", "........XX...aaaaaaaaaaa", -#endif ".............aXXXXXXXXXa", ".............aXXXaaaaXXa", ".............aXXXXaaaXXa", @@ -1558,33 +1469,7 @@ static const char * const link_xpm[] = { QPixmap QGuiApplicationPrivate::getPixmapCursor(Qt::CursorShape cshape) { -#if defined(Q_WS_X11) || defined(Q_WS_WIN) - if (!move_cursor) { - move_cursor = new QPixmap((const char **)move_xpm); - copy_cursor = new QPixmap((const char **)copy_xpm); - link_cursor = new QPixmap((const char **)link_xpm); -#ifdef Q_WS_WIN - ignore_cursor = new QPixmap((const char **)ignore_xpm); -#endif - } - - switch (cshape) { - case Qt::DragMoveCursor: - return *move_cursor; - case Qt::DragCopyCursor: - return *copy_cursor; - case Qt::DragLinkCursor: - return *link_cursor; -#ifdef Q_WS_WIN - case Qt::ForbiddenCursor: - return *ignore_cursor; -#endif - default: - break; - } -#else Q_UNUSED(cshape); -#endif return QPixmap(); } diff --git a/src/gui/kernel/qkeymapper_p.h b/src/gui/kernel/qkeymapper_p.h index 35f2a63345..95dd624164 100644 --- a/src/gui/kernel/qkeymapper_p.h +++ b/src/gui/kernel/qkeymapper_p.h @@ -60,9 +60,6 @@ #include #include -#if defined (Q_WS_MAC64) -# include -#endif QT_BEGIN_NAMESPACE @@ -76,13 +73,6 @@ public: static QKeyMapper *instance(); static void changeKeyboard(); -#ifndef Q_WS_QPA - static bool sendKeyEvent(QWidget *widget, bool grab, - QEvent::Type type, int code, Qt::KeyboardModifiers modifiers, - const QString &text, bool autorepeat, int count, - quint32 nativeScanCode, quint32 nativeVirtualKey, quint32 nativeModifiers, - bool *unusedExceptForCocoa = 0); -#endif static QList possibleKeys(QKeyEvent *e); private: @@ -166,57 +156,7 @@ public: void deleteLayouts(); KeyboardLayoutItem *keyLayout[256]; - -#elif defined(Q_WS_X11) - - QList possibleKeysXKB(QKeyEvent *event); - QList possibleKeysCore(QKeyEvent *event); - - bool translateKeyEventInternal(QWidget *keywidget, - const XEvent *, - KeySym &keysym, - int& count, - QString& text, - Qt::KeyboardModifiers& modifiers, - int &code, - QEvent::Type &type, - bool statefulTranslation = true); - bool translateKeyEvent(QWidget *keywidget, - const XEvent *, - bool grab); - - int xkb_currentGroup; - QXCoreDesc coreDesc; - -#elif defined(Q_WS_MAC) - bool updateKeyboard(); - void updateKeyMap(EventHandlerCallRef, EventRef, void *); - bool translateKeyEvent(QWidget *, EventHandlerCallRef, EventRef, void *, bool); - void deleteLayouts(); - - enum { NullMode, UnicodeMode, OtherMode } keyboard_mode; - union { - const UCKeyboardLayout *unicode; - void *other; - } keyboard_layout_format; -#ifdef Q_WS_MAC64 - QCFType currentInputSource; -#else - KeyboardLayoutRef currentKeyboardLayout; -#endif - KeyboardLayoutKind keyboard_kind; - UInt32 keyboard_dead; - KeyboardLayoutItem *keyLayout[256]; -#elif defined(Q_WS_QWS) -#elif defined(Q_OS_SYMBIAN) -public: - QString translateKeyEvent(int keySym, Qt::KeyboardModifiers modifiers); - int mapS60KeyToQt(TUint s60key); - int mapS60ScanCodesToQt(TUint s60key); - int mapQtToS60Key(int qtKey); - int mapQtToS60ScanCodes(int qtKey); - void updateInputLanguage(); -#endif +#endif // defined(Q_OS_WIN) }; QKeyMapperPrivate *qt_keymapper_private(); // from qkeymapper.cpp diff --git a/src/gui/kernel/qsessionmanager.h b/src/gui/kernel/qsessionmanager.h index 3328fa9011..31a26c1582 100644 --- a/src/gui/kernel/qsessionmanager.h +++ b/src/gui/kernel/qsessionmanager.h @@ -68,9 +68,6 @@ class Q_GUI_EXPORT QSessionManager : public QObject public: QString sessionId() const; QString sessionKey() const; -#if defined(Q_WS_X11) || defined(Q_WS_MAC) - void *handle() const; -#endif bool allowsInteraction(); bool allowsErrorInteraction(); diff --git a/src/gui/kernel/qwindowdefs.h b/src/gui/kernel/qwindowdefs.h index 165b62da8f..b77ec0b2f3 100644 --- a/src/gui/kernel/qwindowdefs.h +++ b/src/gui/kernel/qwindowdefs.h @@ -92,53 +92,17 @@ QT_END_HEADER // Window system dependent definitions -#if defined(Q_WS_MAC) && !defined(Q_WS_QWS) - -#include - -#ifdef Q_WS_MAC32 -typedef int WId; -#else -typedef long WId; -#endif - -#endif // Q_WS_MAC #if defined(Q_OS_WIN) # include #endif // Q_OS_WIN -#if defined(Q_WS_X11) - -typedef struct _XDisplay Display; -typedef union _XEvent XEvent; -typedef struct _XGC *GC; -typedef struct _XRegion *Region; -typedef unsigned long WId; - -#endif // Q_WS_X11 - -#if defined(Q_WS_QWS) - -typedef unsigned long WId; -QT_BEGIN_HEADER -QT_BEGIN_NAMESPACE -struct QWSEvent; -QT_END_NAMESPACE -QT_END_HEADER -#endif // Q_WS_QWS -#if defined(Q_WS_QPA) typedef unsigned long WId; -#endif // Q_WS_QPA -#if defined(Q_OS_SYMBIAN) -class CCoeControl; -typedef CCoeControl * WId; -#endif // Q_OS_SYMBIAN QT_BEGIN_HEADER QT_BEGIN_NAMESPACE diff --git a/src/gui/opengl/qopenglfunctions.h b/src/gui/opengl/qopenglfunctions.h index d3bd580fc7..7851842d46 100644 --- a/src/gui/opengl/qopenglfunctions.h +++ b/src/gui/opengl/qopenglfunctions.h @@ -77,11 +77,7 @@ QT_MODULE(Gui) typedef ptrdiff_t qopengl_GLintptr; typedef ptrdiff_t qopengl_GLsizeiptr; -#ifdef Q_WS_WIN -# define QOPENGLF_APIENTRY APIENTRY -#endif -#ifndef Q_WS_MAC # ifndef QOPENGLF_APIENTRYP # ifdef QOPENGLF_APIENTRY # define QOPENGLF_APIENTRYP QOPENGLF_APIENTRY * @@ -90,10 +86,6 @@ typedef ptrdiff_t qopengl_GLsizeiptr; # define QOPENGLF_APIENTRYP * # endif # endif -#else -# define QOPENGLF_APIENTRY -# define QOPENGLF_APIENTRYP * -#endif struct QOpenGLFunctionsPrivate; diff --git a/src/gui/opengl/qopenglpaintengine.cpp b/src/gui/opengl/qopenglpaintengine.cpp index b29cedcdf9..9c5e4d2fdb 100644 --- a/src/gui/opengl/qopenglpaintengine.cpp +++ b/src/gui/opengl/qopenglpaintengine.cpp @@ -92,13 +92,7 @@ QT_BEGIN_NAMESPACE -#if defined(Q_WS_WIN) -extern Q_GUI_EXPORT bool qt_cleartype_enabled; -#endif -#ifdef Q_WS_MAC -extern bool qt_applefontsmoothing_enabled; -#endif Q_GUI_EXPORT QImage qt_imageForBrush(int brushStyle, bool invert); @@ -1530,13 +1524,6 @@ namespace { } -#if defined(Q_WS_WIN) -static bool fontSmoothingApproximately(qreal target) -{ - extern Q_GUI_EXPORT qreal qt_fontsmoothing_gamma; // qapplication_win.cpp - return (qAbs(qt_fontsmoothing_gamma - target) < 0.2); -} -#endif // #define QT_OPENGL_DRAWCACHEDGLYPHS_INDEX_ARRAY_VBO @@ -1801,13 +1788,7 @@ void QOpenGL2PaintEngineExPrivate::drawCachedGlyphs(QFontEngineGlyphCache::Type bool srgbFrameBufferEnabled = false; if (funcs.hasOpenGLExtension(QOpenGLExtensions::SRGBFrameBuffer)) { -#if defined(Q_WS_MAC) - if (glyphType == QFontEngineGlyphCache::Raster_RGBMask) -#elif defined(Q_WS_WIN) - if (glyphType != QFontEngineGlyphCache::Raster_RGBMask || fontSmoothingApproximately(2.1)) -#else if (false) -#endif { glEnable(GL_FRAMEBUFFER_SRGB); srgbFrameBufferEnabled = true; @@ -1979,13 +1960,6 @@ bool QOpenGL2PaintEngineEx::begin(QPaintDevice *pdev) d->glyphCacheType = QFontEngineGlyphCache::Raster_A8; #if !defined(QT_OPENGL_ES_2) -#if defined(Q_WS_WIN) - if (qt_cleartype_enabled - && (fontSmoothingApproximately(1.0) || fontSmoothingApproximately(2.1))) -#endif -#if defined(Q_WS_MAC) - if (qt_applefontsmoothing_enabled) -#endif d->glyphCacheType = QFontEngineGlyphCache::Raster_RGBMask; #endif diff --git a/src/gui/opengl/qopengltextureglyphcache.cpp b/src/gui/opengl/qopengltextureglyphcache.cpp index bfeef5a685..f262d5d387 100644 --- a/src/gui/opengl/qopengltextureglyphcache.cpp +++ b/src/gui/opengl/qopengltextureglyphcache.cpp @@ -45,9 +45,6 @@ QT_BEGIN_NAMESPACE -#ifdef Q_WS_WIN -extern Q_GUI_EXPORT bool qt_cleartype_enabled; -#endif QBasicAtomicInt qopengltextureglyphcache_serial_number = Q_BASIC_ATOMIC_INITIALIZER(1); diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h index edb092c035..80d9b43f1f 100644 --- a/src/gui/painting/qbrush.h +++ b/src/gui/painting/qbrush.h @@ -127,9 +127,6 @@ public: inline bool operator!=(const QBrush &b) const { return !(operator==(b)); } private: -#if defined(Q_WS_X11) - friend class QX11PaintEngine; -#endif friend class QRasterPaintEngine; friend class QRasterPaintEnginePrivate; friend struct QSpanData; diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index cfd9934e9b..c4c5846ed9 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -6557,29 +6557,12 @@ static void qt_alphamapblit_quint16(QRasterBuffer *rasterBuffer, void qt_build_pow_tables() { qreal smoothing = qreal(1.7); -#ifdef Q_WS_MAC - // decided by testing a few things on an iMac, should probably get this from the - // system... - smoothing = qreal(2.0); -#endif -#ifdef Q_WS_WIN - extern qreal qt_fontsmoothing_gamma; // qapplication_win.cpp - smoothing = qt_fontsmoothing_gamma; -#endif -#ifdef Q_WS_X11 - Q_UNUSED(smoothing); - for (int i=0; i<256; ++i) { - qt_pow_rgb_gamma[i] = uchar(i); - qt_pow_rgb_invgamma[i] = uchar(i); - } -#else for (int i=0; i<256; ++i) { qt_pow_rgb_gamma[i] = uchar(qRound(qPow(i / qreal(255.0), smoothing) * 255)); qt_pow_rgb_invgamma[i] = uchar(qRound(qPow(i / qreal(255.), 1 / smoothing) * 255)); } -#endif #if defined(Q_OS_WIN) && !defined(Q_OS_WINCE) const qreal gray_gamma = 2.31; @@ -6599,10 +6582,6 @@ static inline void rgbBlendPixel(quint32 *dst, int coverage, int sr, int sg, int int db = qBlue(*dst); if (da != 255 -#if defined (Q_WS_WIN) - // Work around GDI messing up alpha channel - && qRed(*dst) <= da && qBlue(*dst) <= da && qGreen(*dst) <= da -#endif ) { int a = qGray(coverage); diff --git a/src/gui/painting/qdrawhelper_arm_simd.cpp b/src/gui/painting/qdrawhelper_arm_simd.cpp index 7c664372c3..48b67f4020 100644 --- a/src/gui/painting/qdrawhelper_arm_simd.cpp +++ b/src/gui/painting/qdrawhelper_arm_simd.cpp @@ -46,223 +46,7 @@ #ifdef QT_HAVE_ARM_SIMD -#if defined(Q_OS_SYMBIAN) -#if !defined(__SWITCH_TO_ARM) -#ifdef __MARM_THUMB__ -#ifndef __ARMCC__ -#define __SWITCH_TO_ARM asm("push {r0} ");\ - asm("add r0, pc, #4 ");\ - asm("bx r0 ");\ - asm("nop ");\ - asm(".align 2 ");\ - asm(".code 32 ");\ - asm("ldr r0, [sp], #4 ") -#define __END_ARM asm(".code 16 ") -#else -#define __SWITCH_TO_ARM asm(".code 32 "); -#define __END_ARM -#endif // __ARMCC__ -#else -#define __SWITCH_TO_ARM -#define __END_ARM -#endif //__MARM_THUMB__ -#endif -#endif -#if defined(Q_OS_SYMBIAN) && defined(Q_CC_RVCT) -__asm void qt_blend_argb32_on_argb32_arm_simd(uchar *destPixels, int dbpl, - const uchar *srcPixels, int sbpl, - int w, int h, - int const_alpha) -{ -#ifndef __ARMCC__ - __SWITCH_TO_ARM; -#else - CODE32 -#endif // __ARMCC__ - - stmfd sp!, {r4-r12, r14} - - // read arguments off the stack - add r8, sp, #10 * 4 - ldmia r8, {r4-r6} - - // adjust dbpl and sbpl - mov r14, #4 - mul r14, r4, r14 - sub r1, r1, r14 - sub r3, r3, r14 - - // load 0xFF00FF00 to r12 - mov r12, #0xFF000000 - add r12, r12, #0xFF00 - - // load 0x800080 to r14 - mov r14, #0x800000 - add r14, r14, #0x80 - - /* - Registers: - r0 dst - r1 dbpl - r2 src - r3 sbpl - r4 w - r5 h - r6 const_alpha - r12 0xFF0000 - r14 0x800080 - */ - - cmp r6, #256 //test if we have fully opaque constant alpha value - bne argb32constalpha // branch if not - -argb32_next_row - - mov r7, r4 - -argb32_next_pixel - - ldr r8, [r2], #4 // load src pixel - - // Negate r8 and extract src alpha - mvn r11, r8 // bitwise not - uxtb r11, r11, ror #24 - - cmp r11, #0 // test for full src opacity (negated) - beq argb32_no_blend - - cmp r11, #255 // test for full src transparency (negated) - addeq r0, #4 - beq argb32_nop - - ldr r9, [r0] // load dst pixel - - // blend - uxtb16 r10, r9 - uxtb16 r6, r9, ror #8 - mla r10, r11, r10, r14 - mla r9, r6, r11, r14 - uxtab16 r10, r10, r10, ror #8 - uxtab16 r9, r9, r9, ror #8 - and r9, r9, r12 - uxtab16 r10, r9, r10, ror #8 - - uqadd8 r8, r10, r8 - -argb32_no_blend - - str r8, [r0], #4 - -argb32_nop - - subs r7, r7, #1 - bgt argb32_next_pixel - - add r0, r0, r1 // dest = dest + dbpl - add r2, r2, r3 // src = src + sbpl - - subs r5, r5, #1 - bgt argb32_next_row - - b argb32_blend_exit - -argb32constalpha - - cmp r6, #0 - beq argb32_blend_exit - - ; const_alpha = (const_alpha * 255) >> 8; - mov r11, #255 - mul r6, r6, r11 - mov r11, r6, lsr #8 - -argb32constalpha_next_row - - mov r7, r4 - -argb32constalpha_next_pixel - - ldr r9, [r2], #4 // load src pixel - - // blend - uxtb16 r10, r9 - uxtb16 r6, r9, ror #8 - mla r10, r11, r10, r14 - mla r9, r6, r11, r14 - uxtab16 r10, r10, r10, ror #8 - uxtab16 r9, r9, r9, ror #8 - and r9, r9, r12 - uxtab16 r8, r9, r10, ror #8 - - ldr r9, [r0] // load dst pixel - - // blend - uxtb16 r10, r9 - uxtb16 r6, r9, ror #8 - - // Negate r8 and extract src alpha - mvn r9, r8 // bitwise not - uxtb r9, r9, ror #24 - - mla r10, r9, r10, r14 - mla r9, r6, r9, r14 - uxtab16 r10, r10, r10, ror #8 - uxtab16 r9, r9, r9, ror #8 - and r9, r9, r12 - uxtab16 r10, r9, r10, ror #8 - - uqadd8 r8, r10, r8 - - str r8, [r0], #4 - - subs r7, r7, #1 - bgt argb32constalpha_next_pixel - - add r0, r0, r1 // dest = dest + dbpl - add r2, r2, r3 // src = src + sbpl - - subs r5, r5, #1 - bgt argb32constalpha_next_row - -argb32_blend_exit - - // Restore registers - ldmfd sp!, {r4-r12, lr} - bx lr - - __END_ARM -} - -void qt_blend_rgb32_on_rgb32_arm_simd(uchar *destPixels, int dbpl, - const uchar *srcPixels, int sbpl, - int w, int h, - int const_alpha) -{ - if (const_alpha != 256) { - qt_blend_argb32_on_argb32_arm_simd(destPixels, dbpl, srcPixels, sbpl, w, h, const_alpha); - return; - } - - const uint *src = (const uint *) srcPixels; - uint *dst = (uint *) destPixels; - if (w <= 64) { - for (int y=0; y(textItem); QPainterPath path; -#ifndef Q_WS_MAC path.setFillRule(Qt::WindingFill); -#endif if (ti.glyphs.numGlyphs) ti.fontEngine->addOutlineToPath(0, 0, ti.glyphs, &path, ti.flags); if (!path.isEmpty()) { @@ -903,30 +901,6 @@ QPaintDevice *QPaintEngine::paintDevice() const return d_func()->pdev; } -#ifdef Q_WS_WIN -/*! - \internal - - Empty default implementation. -*/ - -HDC QPaintEngine::getDC() const -{ - return 0; -} - - -/*! - \internal - - Empty default implementation. -*/ - -void QPaintEngine::releaseDC(HDC) const -{ -} - -#endif /*! \internal diff --git a/src/gui/painting/qpaintengine.h b/src/gui/painting/qpaintengine.h index 49ceb2a8b3..28c2942930 100644 --- a/src/gui/painting/qpaintengine.h +++ b/src/gui/painting/qpaintengine.h @@ -191,10 +191,6 @@ public: void setSystemRect(const QRect &rect); QRect systemRect() const; -#ifdef Q_WS_WIN - virtual HDC getDC() const; - virtual void releaseDC(HDC hdc) const; -#endif virtual QPoint coordinateOffset() const; @@ -266,14 +262,7 @@ private: friend class QPSPrintEngine; friend class QMacPrintEngine; friend class QMacPrintEnginePrivate; -#ifdef Q_WS_QWS - friend class QtopiaPrintEngine; - friend class QtopiaPrintEnginePrivate; - friend class QProxyFontEngine; -#endif -#ifdef Q_WS_QPA friend class QFontEngineQPA; -#endif friend class QPainter; friend class QPainterPrivate; friend class QWidget; diff --git a/src/gui/painting/qpaintengine_raster.cpp b/src/gui/painting/qpaintengine_raster.cpp index 99c17435dc..e49bd229e7 100644 --- a/src/gui/painting/qpaintengine_raster.cpp +++ b/src/gui/painting/qpaintengine_raster.cpp @@ -75,15 +75,6 @@ # include # include # include -# if defined(Q_OS_WINCE) -# include "qguifunctions_wince.h" -# endif -#elif defined(Q_WS_MAC) -# include -# include -# include -#elif defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) -# include #endif #if defined(Q_OS_WIN64) @@ -135,9 +126,6 @@ bool QRasterPaintEngine::clearTypeFontsEnabled() #endif // Q_OS_WIN -#ifdef Q_WS_MAC -extern bool qt_applefontsmoothing_enabled; -#endif /******************************************************************************** @@ -482,8 +470,6 @@ bool QRasterPaintEngine::begin(QPaintDevice *device) d->glyphCacheType = QFontEngineGlyphCache::Raster_Mono; #if defined(Q_OS_WIN) else if (clearTypeFontsEnabled()) -#elif defined (Q_WS_MAC) - else if (qt_applefontsmoothing_enabled) #else else if (false) #endif @@ -2789,46 +2775,6 @@ bool QRasterPaintEngine::drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, return true; } -#if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) -void QRasterPaintEngine::drawGlyphsS60(const QPointF &p, const QTextItemInt &ti) -{ - Q_D(QRasterPaintEngine); - QRasterPaintEngineState *s = state(); - - QFontEngine *fontEngine = ti.fontEngine; - if (fontEngine->type() != QFontEngine::S60FontEngine) { - QPaintEngineEx::drawTextItem(p, ti); - return; - } - - QFontEngineS60 *fe = static_cast(fontEngine); - - QVarLengthArray positions; - QVarLengthArray glyphs; - QTransform matrix = s->matrix; - matrix.translate(p.x(), p.y()); - if (matrix.type() == QTransform::TxScale) - fe->setFontScale(matrix.m11()); - ti.fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); - - const QFixed aliasDelta = QFixed::fromReal(aliasedCoordinateDelta); - - for (int i=0; igetCharacterData(glyphs[i], tmetrics, glyphBitmapBytes, glyphBitmapSize); - const int x = qFloor(positions[i].x + tmetrics.HorizBearingX() + aliasDelta); - const int y = qFloor(positions[i].y - tmetrics.HorizBearingY() + aliasDelta); - alphaPenBlt(glyphBitmapBytes, glyphBitmapSize.iWidth, 8, x, y, glyphBitmapSize.iWidth, glyphBitmapSize.iHeight); - } - - if (matrix.type() == QTransform::TxScale) - fe->setFontScale(1.0); - - return; -} -#endif // Q_OS_SYMBIAN && QT_NO_FREETYPE /*! * Returns true if the rectangle is completely within the current clip @@ -2967,7 +2913,6 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte ensurePen(); ensureState(); -#if defined (Q_WS_WIN) || defined(Q_WS_MAC) || defined(Q_WS_QPA) if (!supportsTransformations(ti.fontEngine)) { QVarLengthArray positions; @@ -2982,36 +2927,6 @@ void QRasterPaintEngine::drawTextItem(const QPointF &p, const QTextItem &textIte return; } -#elif defined (Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) // Q_OS_WIN || Q_WS_MAC || Q_WS_QPA - if (s->matrix.type() <= QTransform::TxTranslate - || (s->matrix.type() == QTransform::TxScale - && (qFuzzyCompare(s->matrix.m11(), s->matrix.m22())))) { - drawGlyphsS60(p, ti); - return; - } -#else // Q_OS_WIN || Q_WS_MAC || Q_WS_QPA - - QFontEngine *fontEngine = ti.fontEngine; - -#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) - - if (fontEngine->type() == QFontEngine::Freetype) { - QTransform matrix = s->matrix; - matrix.translate(p.x(), p.y()); - - QVarLengthArray positions; - QVarLengthArray glyphs; - fontEngine->getGlyphPositions(ti.glyphs, matrix, ti.flags, glyphs, positions); - if (glyphs.size() == 0) - return; - - if (!drawCachedGlyphs(glyphs.size(), glyphs.constData(), positions.constData(), fontEngine)) - QPaintEngine::drawTextItem(p, ti); - - return; - } -#endif -#endif QPaintEngineEx::drawTextItem(p, ti); } @@ -3189,22 +3104,6 @@ void QRasterPaintEngine::drawEllipse(const QRectF &rect) /*! \internal */ -#ifdef Q_WS_MAC -void QRasterPaintEngine::setCGContext(CGContextRef ctx) -{ - Q_D(QRasterPaintEngine); - d->cgContext = ctx; -} - -/*! - \internal -*/ -CGContextRef QRasterPaintEngine::getCGContext() const -{ - Q_D(const QRasterPaintEngine); - return d->cgContext; -} -#endif #ifdef Q_OS_WIN /*! @@ -3236,26 +3135,12 @@ void QRasterPaintEngine::releaseDC(HDC) const bool QRasterPaintEngine::supportsTransformations(const QFontEngine *fontEngine) const { const QTransform &m = state()->matrix; -#if defined(Q_WS_WIN) && !defined(Q_WS_WINCE) - QFontEngine::Type fontEngineType = fontEngine->type(); - if ((fontEngineType == QFontEngine::Win && !((QFontEngineWin *) fontEngine)->ttf && m.type() > QTransform::TxTranslate) - || (m.type() <= QTransform::TxTranslate - && (fontEngineType == QFontEngine::TestFontEngine - || fontEngineType == QFontEngine::Box))) { - return true; - } -#endif return supportsTransformations(fontEngine->fontDef.pixelSize, m); } bool QRasterPaintEngine::supportsTransformations(qreal pixelSize, const QTransform &m) const { -#if defined(Q_WS_MAC) - // Mac font engines don't support scaling and rotation - if (m.type() > QTransform::TxTranslate) -#else if (m.type() >= QTransform::TxProject) -#endif return true; return !shouldDrawCachedGlyphs(pixelSize, m); diff --git a/src/gui/painting/qpaintengine_raster_p.h b/src/gui/painting/qpaintengine_raster_p.h index d387e1312a..6e71e9986a 100644 --- a/src/gui/painting/qpaintengine_raster_p.h +++ b/src/gui/painting/qpaintengine_raster_p.h @@ -219,10 +219,6 @@ public: void saveBuffer(const QString &s) const; #endif -#ifdef Q_WS_MAC - void setCGContext(CGContextRef ref); - CGContextRef getCGContext() const; -#endif #ifdef Q_OS_WIN void setDC(HDC hdc); @@ -254,9 +250,6 @@ private: bool drawCachedGlyphs(int numGlyphs, const glyph_t *glyphs, const QFixedPoint *positions, QFontEngine *fontEngine); -#if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) - void drawGlyphsS60(const QPointF &p, const QTextItemInt &ti); -#endif // Q_OS_SYMBIAN && QT_NO_FREETYPE bool setClipRectInDeviceCoords(const QRect &r, Qt::ClipOperation op); diff --git a/src/gui/painting/qpaintengineex.cpp b/src/gui/painting/qpaintengineex.cpp index 5ef6900cc8..5c39a5fca2 100644 --- a/src/gui/painting/qpaintengineex.cpp +++ b/src/gui/painting/qpaintengineex.cpp @@ -925,15 +925,8 @@ void QPaintEngineEx::drawPolygon(const QPoint *points, int pointCount, PolygonDr int count = pointCount<<1; QVarLengthArray pts(count); -#ifdef Q_WS_MAC - for (int i=0; inumGlyphs == 0) return; diff --git a/src/gui/painting/qpainter.cpp b/src/gui/painting/qpainter.cpp index 2cd601f2c7..416fe5adbf 100644 --- a/src/gui/painting/qpainter.cpp +++ b/src/gui/painting/qpainter.cpp @@ -157,15 +157,9 @@ static bool qt_painter_thread_test(int devType, const char *what, bool extraCond case QInternal::Printer: case QInternal::Picture: // can be drawn onto these devices safely from any thread -#ifndef Q_WS_WIN if (extraCondition) -#endif break; default: -#ifdef Q_WS_X11 - if (QApplication::testAttribute(Qt::AA_X11InitThreads)) - return true; -#endif if (!extraCondition && QThread::currentThread() != qApp->thread()) { qWarning("QPainter: It is not safe to use %s outside the GUI thread", what); return false; diff --git a/src/gui/painting/qpainterpath.cpp b/src/gui/painting/qpainterpath.cpp index 8bb599f9f0..5b70f4b22a 100644 --- a/src/gui/painting/qpainterpath.cpp +++ b/src/gui/painting/qpainterpath.cpp @@ -2970,9 +2970,6 @@ qreal QPainterPath::angleAtPercent(qreal t) const return QLineF(0, 0, m1, m2).angle(); } -#if defined(Q_WS_WINCE) -#pragma warning( disable : 4056 4756 ) -#endif /*! Returns the slope of the path at the percentage \a t. The diff --git a/src/gui/painting/qpdf.cpp b/src/gui/painting/qpdf.cpp index 47687e4a53..8f21663ffc 100644 --- a/src/gui/painting/qpdf.cpp +++ b/src/gui/painting/qpdf.cpp @@ -2438,12 +2438,6 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti) if (ti.charFormat.isAnchor()) { qreal size = ti.fontEngine->fontDef.pixelSize; -#ifdef Q_WS_WIN - if (ti.fontEngine->type() == QFontEngine::Win) { - QFontEngineWin *fe = static_cast(ti.fontEngine); - size = fe->tm.tmHeight; - } -#endif int synthesized = ti.fontEngine->synthesized(); qreal stretch = synthesized & QFontEngine::SynthesizedStretch ? ti.fontEngine->fontDef.stretch/100. : 1.; @@ -2507,12 +2501,6 @@ void QPdfEnginePrivate::drawTextItem(const QPointF &p, const QTextItemInt &ti) currentPage->fonts.append(font->object_id); qreal size = ti.fontEngine->fontDef.pixelSize; -#ifdef Q_WS_WIN - if (ti.fontEngine->type() == QFontEngine::Win) { - QFontEngineWin *fe = static_cast(ti.fontEngine); - size = fe->tm.tmHeight; - } -#endif QVarLengthArray glyphs; QVarLengthArray positions; diff --git a/src/gui/painting/qrasterizer_p.h b/src/gui/painting/qrasterizer_p.h index e72ddbf2b7..913e2d3229 100644 --- a/src/gui/painting/qrasterizer_p.h +++ b/src/gui/painting/qrasterizer_p.h @@ -66,9 +66,6 @@ class QRasterBuffer; class QRasterizerPrivate; class -#ifdef Q_WS_QWS -Q_GUI_EXPORT -#endif QRasterizer { public: diff --git a/src/gui/painting/qregion.cpp b/src/gui/painting/qregion.cpp index 9d9534bee9..2843e5ccb7 100644 --- a/src/gui/painting/qregion.cpp +++ b/src/gui/painting/qregion.cpp @@ -46,14 +46,10 @@ #include "qdatastream.h" #include "qvariant.h" #include "qvarlengtharray.h" - -#include - -#if defined(Q_OS_UNIX) || defined(Q_WS_WIN) #include "qimage.h" #include "qbitmap.h" -#include -#endif + +#include QT_BEGIN_NAMESPACE @@ -263,12 +259,6 @@ void QRegion::detach() { if (d->ref.load() != 1) *this = copy(); -#if defined(Q_WS_X11) - else if (d->xrectangles) { - free(d->xrectangles); - d->xrectangles = 0; - } -#endif } // duplicates in qregion_win.cpp and qregion_wce.cpp @@ -1598,22 +1588,8 @@ void QRegionPrivate::selfTest() const } #endif // QT_REGION_DEBUG -#if defined(Q_WS_X11) -QT_BEGIN_INCLUDE_NAMESPACE -# include "qregion_x11.cpp" -QT_END_INCLUDE_NAMESPACE -#elif defined(Q_WS_MAC) -QT_BEGIN_INCLUDE_NAMESPACE -# include "qregion_mac.cpp" -QT_END_INCLUDE_NAMESPACE -#elif defined(Q_WS_WIN) -QT_BEGIN_INCLUDE_NAMESPACE -# include "qregion_win.cpp" -QT_END_INCLUDE_NAMESPACE -#elif defined(Q_WS_QWS) || defined(Q_WS_QPA) static QRegionPrivate qrp; QRegion::QRegionData QRegion::shared_empty = {Q_BASIC_ATOMIC_INITIALIZER(1), &qrp}; -#endif typedef void (*OverlapFunc)(register QRegionPrivate &dest, register const QRect *r1, const QRect *r1End, register const QRect *r2, const QRect *r2End, register int y1, register int y2); @@ -3822,12 +3798,6 @@ QRegion::QRegion(const QRect &r, RegionType t) } else { d = new QRegionData; d->ref.store(1); -#if defined(Q_WS_X11) - d->rgn = 0; - d->xrectangles = 0; -#elif defined(Q_WS_WIN) - d->rgn = 0; -#endif if (t == Rectangle) { d->qt_rgn = new QRegionPrivate(r); } else if (t == Ellipse) { @@ -3847,12 +3817,6 @@ QRegion::QRegion(const QPolygon &a, Qt::FillRule fillRule) if (qt_rgn) { d = new QRegionData; d->ref.store(1); -#if defined(Q_WS_X11) - d->rgn = 0; - d->xrectangles = 0; -#elif defined(Q_WS_WIN) - d->rgn = 0; -#endif d->qt_rgn = qt_rgn; } else { d = &shared_empty; @@ -3879,12 +3843,6 @@ QRegion::QRegion(const QBitmap &bm) } else { d = new QRegionData; d->ref.store(1); -#if defined(Q_WS_X11) - d->rgn = 0; - d->xrectangles = 0; -#elif defined(Q_WS_WIN) - d->rgn = 0; -#endif d->qt_rgn = qt_bitmapToRegion(bm); } } @@ -3892,15 +3850,6 @@ QRegion::QRegion(const QBitmap &bm) void QRegion::cleanUp(QRegion::QRegionData *x) { delete x->qt_rgn; -#if defined(Q_WS_X11) - if (x->rgn) - XDestroyRegion(x->rgn); - if (x->xrectangles) - free(x->xrectangles); -#elif defined(Q_WS_WIN) - if (x->rgn) - qt_win_dispose_rgn(x->rgn); -#endif delete x; } @@ -3929,12 +3878,6 @@ QRegion QRegion::copy() const QRegion r; QScopedPointer x(new QRegionData); x->ref.store(1); -#if defined(Q_WS_X11) - x->rgn = 0; - x->xrectangles = 0; -#elif defined(Q_WS_WIN) - x->rgn = 0; -#endif if (d->qt_rgn) x->qt_rgn = new QRegionPrivate(*d->qt_rgn); else @@ -4221,9 +4164,7 @@ QRect QRegion::boundingRect() const Returns true if \a rect is guaranteed to be fully contained in \a region. A false return value does not guarantee the opposite. */ -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) Q_GUI_EXPORT -#endif bool qt_region_strictContains(const QRegion ®ion, const QRect &rect) { if (isEmptyHelper(region.d->qt_rgn) || !rect.isValid()) diff --git a/src/gui/painting/qregion.h b/src/gui/painting/qregion.h index d1ec9c6c34..a599b3ad16 100644 --- a/src/gui/painting/qregion.h +++ b/src/gui/painting/qregion.h @@ -59,9 +59,7 @@ QT_MODULE(Gui) template class QVector; class QVariant; -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) struct QRegionPrivate; -#endif class QBitmap; @@ -142,24 +140,8 @@ public: Handle handle() const; #endif #ifndef qdoc -#if defined(Q_WS_WIN) - inline HRGN handle() const { ensureHandle(); return d->rgn; } -#elif defined(Q_WS_X11) - inline Region handle() const { if(!d->rgn) updateX11Region(); return d->rgn; } -#elif defined(Q_WS_MAC) -#if defined Q_WS_MAC32 - RgnHandle toQDRgn() const; - RgnHandle toQDRgnForUpdate_sys() const; - static QRegion fromQDRgn(RgnHandle shape); -#endif - inline HIMutableShapeRef handle(bool unused = false) const - { Q_UNUSED(unused); return toHIMutableShape(); } - HIMutableShapeRef toHIMutableShape() const; - static QRegion fromHIShapeRef(HIShapeRef shape); -#elif defined(Q_WS_QWS) || defined(Q_WS_QPA) inline void *handle() const { return d->qt_rgn; } #endif -#endif #ifndef QT_NO_DATASTREAM friend Q_GUI_EXPORT QDataStream &operator<<(QDataStream &, const QRegion &); @@ -168,20 +150,7 @@ public: private: QRegion copy() const; // helper of detach. void detach(); -#if defined(Q_WS_WIN) - void ensureHandle() const; - QRegion winCombine(const QRegion &r, int num) const; -#elif defined(Q_WS_X11) - void updateX11Region() const; - void *clipRectangles(int &num) const; - friend void *qt_getClipRects(const QRegion &r, int &num); -#elif defined(Q_WS_MAC) - static OSStatus shape2QRegionHelper(int inMessage, HIShapeRef inShape, - const CGRect *inRect, void *inRefcon); -#endif -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) Q_GUI_EXPORT -#endif friend bool qt_region_strictContains(const QRegion ®ion, const QRect &rect); friend struct QRegionPrivate; @@ -191,19 +160,8 @@ Q_GUI_EXPORT #endif struct QRegionData { QBasicAtomicInt ref; -#if defined(Q_WS_WIN) - HRGN rgn; -#elif defined(Q_WS_X11) - Region rgn; - void *xrectangles; -#endif -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_WS_X11) || defined(Q_WS_MAC) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) QRegionPrivate *qt_rgn; -#endif }; -#if defined(Q_WS_WIN) - friend class QETWidget; -#endif struct QRegionData *d; static struct QRegionData shared_empty; static void cleanUp(QRegionData *x); diff --git a/src/gui/painting/qtextureglyphcache.cpp b/src/gui/painting/qtextureglyphcache.cpp index 0f9a82c25a..b56f6b42e4 100644 --- a/src/gui/painting/qtextureglyphcache.cpp +++ b/src/gui/painting/qtextureglyphcache.cpp @@ -134,13 +134,9 @@ bool QTextureGlyphCache::populate(QFontEngine *fontEngine, int numGlyphs, const if (!supportsSubPixelPositions) { m_subPixelPositionCount = 1; } else { -#if !defined(Q_WS_X11) int i = 0; while (m_subPixelPositionCount == 0 && i < numGlyphs) m_subPixelPositionCount = calculateSubPixelPositionCount(glyphs[i++]); -#else - m_subPixelPositionCount = 4; -#endif } } @@ -295,38 +291,6 @@ void QTextureGlyphCache::fillInPendingGlyphs() QImage QTextureGlyphCache::textureMapForGlyph(glyph_t g, QFixed subPixelPosition) const { -#if defined(Q_WS_X11) - if (m_transform.type() > QTransform::TxTranslate && m_current_fontengine->type() == QFontEngine::Freetype) { - QFontEngineFT::GlyphFormat format = QFontEngineFT::Format_None; - QImage::Format imageFormat = QImage::Format_Invalid; - switch (m_type) { - case Raster_RGBMask: - format = QFontEngineFT::Format_A32; - imageFormat = QImage::Format_RGB32; - break; - case Raster_A8: - format = QFontEngineFT::Format_A8; - imageFormat = QImage::Format_Indexed8; - break; - case Raster_Mono: - format = QFontEngineFT::Format_Mono; - imageFormat = QImage::Format_Mono; - break; - }; - - QFontEngineFT *ft = static_cast (m_current_fontengine); - QFontEngineFT::QGlyphSet *gset = ft->loadTransformedGlyphSet(m_transform); - QFixedPoint positions[1]; - positions[0].x = subPixelPosition; - - if (gset && ft->loadGlyphs(gset, &g, 1, positions, format)) { - QFontEngineFT::Glyph *glyph = gset->getGlyph(g, subPixelPosition); - const int bytesPerLine = (format == QFontEngineFT::Format_Mono ? ((glyph->width + 31) & ~31) >> 3 - : (glyph->width + 3) & ~3); - return QImage(glyph->data, glyph->width, glyph->height, bytesPerLine, imageFormat); - } - } else -#endif if (m_type == QFontEngineGlyphCache::Raster_RGBMask) return m_current_fontengine->alphaRGBMapForGlyph(g, subPixelPosition, glyphMargin(), m_transform); else @@ -367,11 +331,7 @@ void QImageTextureGlyphCache::createTextureData(int width, int height) int QImageTextureGlyphCache::glyphMargin() const { -#if defined(Q_WS_MAC) || defined(Q_WS_X11) - return 0; -#else return m_type == QFontEngineGlyphCache::Raster_RGBMask ? 2 : 0; -#endif } void QImageTextureGlyphCache::fillTexture(const Coord &c, glyph_t g, QFixed subPixelPosition) diff --git a/src/gui/text/qabstractfontengine_p.h b/src/gui/text/qabstractfontengine_p.h index 44bb6be84f..b744d6664c 100644 --- a/src/gui/text/qabstractfontengine_p.h +++ b/src/gui/text/qabstractfontengine_p.h @@ -91,9 +91,7 @@ public: virtual Type type() const { return Proxy; } virtual const char *name() const { return "proxy engine"; } -#if !defined(Q_WS_X11) && !defined(Q_WS_WIN) && !defined(Q_WS_MAC) && !defined(Q_OS_SYMBIAN) virtual void draw(QPaintEngine *, qreal, qreal, const QTextItemInt &); -#endif inline QAbstractFontEngine::Capabilities capabilities() const { return engineCapabilities; } diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 3d2dfb9c76..7cd9fb15e9 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -62,17 +62,8 @@ #include #include -#ifdef Q_WS_X11 -#include "qx11info_x11.h" -#include -#endif -#ifdef Q_OS_SYMBIAN -#include -#endif -#ifdef Q_WS_QPA #include #include -#endif #include #include @@ -86,13 +77,7 @@ QT_BEGIN_NAMESPACE -#ifdef Q_WS_WIN -extern HDC shared_dc(); -#endif -#ifdef Q_WS_X11 -extern const QX11Info *qt_x11Info(const QPaintDevice *pd); -#endif bool QFontDef::exactMatch(const QFontDef &other) const { @@ -146,9 +131,6 @@ bool QFontDef::exactMatch(const QFontDef &other) const && (this_foundry.isEmpty() || other_foundry.isEmpty() || this_foundry == other_foundry) -#ifdef Q_WS_X11 - && addStyle == other.addStyle -#endif // Q_WS_X11 ); } @@ -160,14 +142,6 @@ Q_GUI_EXPORT int qt_defaultDpiX() return 75; int dpi; -#ifdef Q_WS_X11 - dpi = QX11Info::appDpiX(); -#elif defined(Q_WS_WIN) - dpi = GetDeviceCaps(shared_dc(),LOGPIXELSX); -#elif defined(Q_WS_MAC) - extern float qt_mac_defaultDpi_x(); //qpaintdevice_mac.cpp - dpi = qt_mac_defaultDpi_x(); -#elif defined(Q_WS_QPA) QScreen *screen = QGuiApplication::primaryScreen(); if (screen) { dpi = qRound(screen->logicalDotsPerInchX()); @@ -175,9 +149,6 @@ Q_GUI_EXPORT int qt_defaultDpiX() //PI has not been initialised, or it is being initialised. Give a default dpi dpi = 100; } -#elif defined(Q_OS_SYMBIAN) - dpi = S60->defaultDpiX; -#endif // Q_WS_X11 return dpi; } @@ -188,14 +159,6 @@ Q_GUI_EXPORT int qt_defaultDpiY() return 75; int dpi; -#ifdef Q_WS_X11 - dpi = QX11Info::appDpiY(); -#elif defined(Q_WS_WIN) - dpi = GetDeviceCaps(shared_dc(),LOGPIXELSY); -#elif defined(Q_WS_MAC) - extern float qt_mac_defaultDpi_y(); //qpaintdevice_mac.cpp - dpi = qt_mac_defaultDpi_y(); -#elif defined(Q_WS_QPA) QScreen *screen = QGuiApplication::primaryScreen(); if (screen) { dpi = qRound(screen->logicalDotsPerInchY()); @@ -203,9 +166,6 @@ Q_GUI_EXPORT int qt_defaultDpiY() //PI has not been initialised, or it is being initialised. Give a default dpi dpi = 100; } -#elif defined(Q_OS_SYMBIAN) - dpi = S60->defaultDpiY; -#endif // Q_WS_X11 return dpi; } @@ -220,15 +180,6 @@ QFontPrivate::QFontPrivate() rawMode(false), underline(false), overline(false), strikeOut(false), kerning(true), capital(0), letterSpacingIsAbsolute(false), scFont(0) { -#ifdef Q_WS_X11 - if (QX11Info::display()) - screen = QX11Info::appScreen(); - else - screen = 0; -#endif -#ifdef Q_WS_WIN - hdc = 0; -#endif } QFontPrivate::QFontPrivate(const QFontPrivate &other) @@ -239,9 +190,6 @@ QFontPrivate::QFontPrivate(const QFontPrivate &other) letterSpacing(other.letterSpacing), wordSpacing(other.wordSpacing), scFont(other.scFont) { -#ifdef Q_WS_WIN - hdc = other.hdc; -#endif if (scFont && scFont != this) scFont->ref.ref(); } @@ -258,11 +206,7 @@ QFontPrivate::~QFontPrivate() extern QMutex *qt_fontdatabase_mutex(); -#if !defined(Q_WS_MAC) #define QT_FONT_ENGINE_FROM_DATA(data, script) data->engines[script] -#else -#define QT_FONT_ENGINE_FROM_DATA(data, script) data->engine -#endif QFontEngine *QFontPrivate::engineForScript(int script) const { @@ -379,26 +323,16 @@ void QFontPrivate::resolve(uint mask, const QFontPrivate *other) QFontEngineData::QFontEngineData() : ref(1), fontCache(QFontCache::instance()) { -#if !defined(Q_WS_MAC) memset(engines, 0, QUnicodeTables::ScriptCount * sizeof(QFontEngine *)); -#else - engine = 0; -#endif } QFontEngineData::~QFontEngineData() { -#if !defined(Q_WS_MAC) for (int i = 0; i < QUnicodeTables::ScriptCount; ++i) { if (engines[i]) engines[i]->ref.deref(); engines[i] = 0; } -#else - if (engine) - engine->ref.deref(); - engine = 0; -#endif // Q_WS_X11 || Q_WS_WIN || Q_WS_MAC } @@ -710,12 +644,7 @@ QFont::QFont(const QFont &font, QPaintDevice *pd) { Q_ASSERT(pd != 0); int dpi = pd->logicalDpiY(); -#ifdef Q_WS_X11 - const QX11Info *info = qt_x11Info(pd); - int screen = info ? info->screen() : 0; -#else const int screen = 0; -#endif if (font.d->dpi != dpi || font.d->screen != screen ) { d = new QFontPrivate(*font.d); d->dpi = dpi; @@ -723,10 +652,6 @@ QFont::QFont(const QFont &font, QPaintDevice *pd) } else { d = font.d.data(); } -#ifdef Q_WS_WIN - if (pd->devType() == QInternal::Printer && pd->getDC()) - d->hdc = pd->getDC(); -#endif } /*! @@ -787,11 +712,7 @@ QFont::QFont(const QString &family, int pointSize, int weight, bool italic) : d(new QFontPrivate()), resolve_mask(QFont::FamilyResolved) { if (pointSize <= 0) { -#ifdef Q_OS_SYMBIAN - pointSize = 7; -#else pointSize = 12; -#endif } else { resolve_mask |= QFont::SizeResolved; } @@ -866,9 +787,6 @@ void QFont::setFamily(const QString &family) detach(); d->request.family = family; -#if defined(Q_WS_X11) - d->request.addStyle.clear(); -#endif // Q_WS_X11 resolve_mask |= QFont::FamilyResolved; } @@ -1457,9 +1375,6 @@ void QFont::setStyleHint(StyleHint hint, StyleStrategy strategy) resolve_mask |= QFont::StyleHintResolved; resolve_mask |= QFont::StyleStrategyResolved; -#if defined(Q_WS_X11) - d->request.addStyle.clear(); -#endif // Q_WS_X11 } /*! @@ -1780,9 +1695,6 @@ bool QFont::operator<(const QFont &f) const if (r1.styleHint != r2.styleHint) return r1.styleHint < r2.styleHint; if (r1.styleStrategy != r2.styleStrategy) return r1.styleStrategy < r2.styleStrategy; if (r1.family != r2.family) return r1.family < r2.family; -#ifdef Q_WS_X11 - if (r1.addStyle != r2.addStyle) return r1.addStyle < r2.addStyle; -#endif // Q_WS_X11 if (f.d->capital != d->capital) return f.d->capital < d->capital; if (f.d->letterSpacingIsAbsolute != d->letterSpacingIsAbsolute) return f.d->letterSpacingIsAbsolute < d->letterSpacingIsAbsolute; @@ -1886,17 +1798,6 @@ static void initFontSubst() // default substitutions static const char * const initTbl[] = { -#if defined(Q_WS_X11) - "arial", "helvetica", - "times new roman", "times", - "courier new", "courier", - "sans serif", "helvetica", -#elif defined(Q_WS_WIN) - "times", "times new roman", - "courier", "courier new", - "helvetica", "arial", - "sans serif", "arial", -#endif 0, 0 }; @@ -1905,10 +1806,6 @@ static void initFontSubst() Q_ASSERT(fontSubst != 0); if (!fontSubst->isEmpty()) return; -#if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG) - if (X11->has_fontconfig) - return; -#endif for (int i=0; initTbl[i] != 0; i += 2) { QStringList &list = (*fontSubst)[QString::fromLatin1(initTbl[i])]; @@ -2211,7 +2108,6 @@ bool QFont::fromString(const QString &descrip) return true; } -#if !defined(Q_WS_QWS) /*! \internal Internal function that dumps font cache statistics. @@ -2221,7 +2117,6 @@ void QFont::cacheStatistics() } -#endif // !Q_WS_QWS @@ -2255,11 +2150,7 @@ QDataStream &operator<<(QDataStream &s, const QFont &font) } else if (s.version() <= 3) { qint16 pointSize = (qint16) (font.d->request.pointSize * 10); if (pointSize < 0) { -#ifdef Q_WS_X11 - pointSize = (qint16)(font.d->request.pixelSize*720/QX11Info::appDpiY()); -#else pointSize = (qint16)QFontInfo(font).pointSize() * 10; -#endif } s << pointSize; } else { @@ -2775,19 +2666,12 @@ void QFontCache::clear() end = engineDataCache.end(); while (it != end) { QFontEngineData *data = it.value(); -#if !defined(Q_WS_MAC) for (int i = 0; i < QUnicodeTables::ScriptCount; ++i) { if (data->engines[i]) { data->engines[i]->ref.deref(); data->engines[i] = 0; } } -#else - if (data->engine) { - data->engine->ref.deref(); - data->engine = 0; - } -#endif ++it; } } @@ -2811,17 +2695,6 @@ void QFontCache::clear() engineCache.clear(); } -#if defined(Q_WS_QWS) && !defined(QT_NO_QWS_QPF2) -void QFontCache::removeEngineForFont(const QByteArray &_fontName) -{ - - /* This could be optimized but the code becomes much more complex if we want to handle multi - * font engines and it is probably not worth it. Therefore we just clear the entire font cache. - */ - Q_UNUSED(_fontName); - clear(); -} -#endif QFontEngineData *QFontCache::findEngineData(const Key &key) const { @@ -2909,69 +2782,6 @@ void QFontCache::decreaseCost(uint cost) cost, total_cost, max_cost); } -#if defined(Q_WS_WIN) || defined (Q_WS_QWS) -void QFontCache::cleanupPrinterFonts() -{ - FC_DEBUG("QFontCache::cleanupPrinterFonts"); - - { - FC_DEBUG(" CLEAN engine data:"); - - // clean out all unused engine data - EngineDataCache::Iterator it = engineDataCache.begin(), - end = engineDataCache.end(); - while (it != end) { - if (it.key().screen == 0) { - ++it; - continue; - } - - if(it.value()->ref != 0) { - for(int i = 0; i < QUnicodeTables::ScriptCount; ++i) { - if(it.value()->engines[i]) { - it.value()->engines[i]->ref.deref(); - it.value()->engines[i] = 0; - } - } - ++it; - } else { - - EngineDataCache::Iterator rem = it++; - - decreaseCost(sizeof(QFontEngineData)); - - FC_DEBUG(" %p", rem.value()); - - delete rem.value(); - engineDataCache.erase(rem); - } - } - } - - EngineCache::Iterator it = engineCache.begin(), - end = engineCache.end(); - while(it != end) { - if (it.value().data->ref != 0 || it.key().screen == 0) { - ++it; - continue; - } - - FC_DEBUG(" %p: timestamp %4u hits %2u ref %2d/%2d, type '%s'", - it.value().data, it.value().timestamp, it.value().hits, - int(it.value().data->ref), it.value().data->cache_count, - it.value().data->name()); - - if (--it.value().data->cache_count == 0) { - FC_DEBUG(" DELETE: last occurrence in cache"); - - decreaseCost(it.value().data->cache_cost); - delete it.value().data; - } - - engineCache.erase(it++); - } -} -#endif void QFontCache::timerEvent(QTimerEvent *) { @@ -3004,14 +2814,6 @@ void QFontCache::timerEvent(QTimerEvent *) #ifdef QFONTCACHE_DEBUG FC_DEBUG(" %p: ref %2d", it.value(), int(it.value()->ref)); -# if defined(Q_WS_X11) || defined(Q_WS_WIN) - // print out all engines - for (int i = 0; i < QUnicodeTables::ScriptCount; ++i) { - if (! it.value()->engines[i]) - continue; - FC_DEBUG(" contains %p", it.value()->engines[i]); - } -# endif // Q_WS_X11 || Q_WS_WIN #endif // QFONTCACHE_DEBUG if (it.value()->ref != 0) diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index 421c1dd2de..326dc9d63e 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -46,9 +46,6 @@ #include #include -#if defined(Q_WS_X11) || defined(Q_WS_QWS) -typedef struct FT_FaceRec_* FT_Face; -#endif QT_BEGIN_HEADER @@ -246,17 +243,7 @@ public: { qSwap(d, other.d); qSwap(resolve_mask, other.resolve_mask); return *this; } #endif -#ifdef Q_WS_WIN - HFONT handle() const; -#else // !Q_WS_WIN Qt::HANDLE handle() const; -#endif // Q_WS_WIN -#ifdef Q_WS_MAC - quint32 macFontID() const; -#endif -#if defined(Q_WS_X11) || defined(Q_WS_QWS) - FT_Face freetypeFace() const; -#endif // needed for X11 void setRawName(const QString &); @@ -275,9 +262,7 @@ public: static void removeSubstitution(const QString &); static void initialize(); static void cleanup(); -#ifndef Q_WS_QWS static void cacheStatistics(); -#endif QString defaultFamily() const; QString lastResortFamily() const; @@ -292,12 +277,6 @@ private: void detach(); -#if defined(Q_WS_MAC) - void macSetFont(QPaintDevice *); -#elif defined(Q_WS_X11) - void x11SetScreen(int screen = -1); - int x11Screen() const; -#endif friend class QFontPrivate; friend class QFontDialogPrivate; diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index ebc842c794..f4641ff77e 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -73,18 +73,12 @@ struct QFontDef styleStrategy(QFont::PreferDefault), styleHint(QFont::AnyStyle), weight(50), fixedPitch(false), style(QFont::StyleNormal), stretch(100), ignorePitch(true), hintingPreference(QFont::PreferDefaultHinting) -#ifdef Q_WS_MAC - ,fixedPitchComputed(false) -#endif { } QString family; QString styleName; -#ifdef Q_WS_X11 - QString addStyle; -#endif // Q_WS_X11 qreal pointSize; qreal pixelSize; @@ -115,9 +109,6 @@ struct QFontDef && family == other.family && (styleName.isEmpty() || other.styleName.isEmpty() || styleName == other.styleName) && hintingPreference == other.hintingPreference -#ifdef Q_WS_X11 - && addStyle == other.addStyle -#endif ; } inline bool operator<(const QFontDef &other) const @@ -133,9 +124,6 @@ struct QFontDef return styleName < other.styleName; if (hintingPreference != other.hintingPreference) return hintingPreference < other.hintingPreference; -#ifdef Q_WS_X11 - if (addStyle != other.addStyle) return addStyle < other.addStyle; -#endif // Q_WS_X11 if (ignorePitch != other.ignorePitch) return ignorePitch < other.ignorePitch; if (fixedPitch != other.fixedPitch) return fixedPitch < other.fixedPitch; @@ -152,20 +140,13 @@ public: QAtomicInt ref; QFontCache *fontCache; -#if !defined(Q_WS_MAC) QFontEngine *engines[QUnicodeTables::ScriptCount]; -#else - QFontEngine *engine; -#endif }; class Q_GUI_EXPORT QFontPrivate { public: -#ifdef Q_WS_X11 - static int defaultEncodingID; -#endif // Q_WS_X11 QFontPrivate(); QFontPrivate(const QFontPrivate &other); @@ -180,9 +161,6 @@ public: int dpi; int screen; -#ifdef Q_WS_WIN - HDC hdc; -#endif uint rawMode : 1; uint underline : 1; @@ -222,9 +200,6 @@ public: ~QFontCache(); void clear(); -#if defined(Q_WS_QWS) && !defined(QT_NO_QWS_QPF2) - void removeEngineForFont(const QByteArray &fontName); -#endif // universal key structure. QFontEngineDatas and QFontEngines are cached using // the same keys struct Key { @@ -269,9 +244,6 @@ public: QFontEngine *findEngine(const Key &key); void insertEngine(const Key &key, QFontEngine *engine); -#if defined(Q_WS_WIN) || defined(Q_WS_QWS) - void cleanupPrinterFonts(); -#endif private: void increaseCost(uint cost); diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 680f63edb3..740cd4c52c 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -50,22 +50,13 @@ #include "private/qunicodetables_p.h" #include "qfontengine_p.h" -#ifdef Q_WS_QPA #include #include #include "qabstractfileengine.h" -#endif -#ifdef Q_WS_X11 -#include -#endif #include #include -#if (defined(Q_WS_QWS)|| defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) -# include -# include FT_TRUETYPE_TABLES_H -#endif // #define QFONTDATABASE_DEBUG #ifdef QFONTDATABASE_DEBUG @@ -81,9 +72,6 @@ # define FM_DEBUG if (false) qDebug #endif -#if defined(Q_WS_WIN) && !defined(QT_NO_DIRECTWRITE) -# include -#endif QT_BEGIN_NAMESPACE @@ -164,53 +152,13 @@ struct QtFontEncoding struct QtFontSize { -#ifdef Q_WS_X11 - QtFontEncoding *encodings; - QtFontEncoding *encodingID(int id, uint xpoint = 0, uint xres = 0, - uint yres = 0, uint avgwidth = 0, bool add = false); - unsigned short count : 16; -#endif // Q_WS_X11 - -#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) - QByteArray fileName; - int fileIndex; -#endif // defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) -#if defined(Q_WS_QPA) + void *handle; -#endif unsigned short pixelSize : 16; }; -#ifdef Q_WS_X11 -QtFontEncoding *QtFontSize::encodingID(int id, uint xpoint, uint xres, - uint yres, uint avgwidth, bool add) -{ - // we don't match using the xpoint, xres and yres parameters, only the id - for (int i = 0; i < count; ++i) { - if (encodings[i].encoding == id) - return encodings + i; - } - - if (!add) return 0; - - if (!(count % 4)) { - QtFontEncoding *newEncodings = (QtFontEncoding *) - realloc(encodings, - (((count+4) >> 2) << 2) * sizeof(QtFontEncoding)); - Q_CHECK_PTR(newEncodings); - encodings = newEncodings; - } - encodings[count].encoding = id; - encodings[count].xpoint = xpoint; - encodings[count].xres = xres; - encodings[count].yres = yres; - encodings[count].avgwidth = avgwidth; - encodings[count].pitch = '*'; - return encodings + count++; -} -#endif // Q_WS_X11 struct QtFontStyle { @@ -241,34 +189,17 @@ struct QtFontStyle : key(k), bitmapScalable(false), smoothScalable(false), count(0), pixelSizes(0) { -#if defined(Q_WS_X11) - weightName = setwidthName = 0; -#endif // Q_WS_X11 } ~QtFontStyle() { -#ifdef Q_WS_X11 - delete [] weightName; - delete [] setwidthName; -#endif -#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) while (count) { // bitfield count-- in while condition does not work correctly in mwccsym2 count--; -#ifdef Q_WS_X11 - free(pixelSizes[count].encodings); -#endif -#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) - pixelSizes[count].fileName.~QByteArray(); -#endif -#if defined (Q_WS_QPA) QPlatformIntegration *integration = QGuiApplicationPrivate::platformIntegration(); if (integration) { //on shut down there will be some that we don't release. integration->fontDatabase()->releaseHandle(pixelSizes[count].handle); } -#endif } -#endif free(pixelSizes); } @@ -279,13 +210,7 @@ struct QtFontStyle QtFontSize *pixelSizes; QString styleName; -#ifdef Q_WS_X11 - const char *weightName; - const char *setwidthName; -#endif // Q_WS_X11 -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) bool antialiased; -#endif QtFontSize *pixelSize(unsigned short size, bool = false); }; @@ -325,17 +250,7 @@ QtFontSize *QtFontStyle::pixelSize(unsigned short size, bool add) pixelSizes = newPixelSizes; } pixelSizes[count].pixelSize = size; -#ifdef Q_WS_X11 - pixelSizes[count].count = 0; - pixelSizes[count].encodings = 0; -#endif -#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) - new (&pixelSizes[count].fileName) QByteArray; - pixelSizes[count].fileIndex = 0; -#endif -#if defined(Q_WS_QPA) pixelSizes[count].handle = 0; -#endif return pixelSizes + (count++); } @@ -412,26 +327,13 @@ struct QtFontFamily QtFontFamily(const QString &n) : -#ifdef Q_WS_X11 - fixedPitch(true), ftWritingSystemCheck(false), - xlfdLoaded(false), synthetic(false), symbol_checked(false), -#else fixedPitch(false), -#endif -#ifdef Q_WS_WIN - writingSystemCheck(false), - loaded(false), -#endif #if !defined(QWS) && defined(Q_OS_MAC) fixedPitchComputed(false), #endif name(n), count(0), foundries(0) -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) , bogusWritingSystems(false) -#endif -#if defined(Q_WS_QPA) , askedForFallback(false) -#endif { memset(writingSystems, 0, sizeof(writingSystems)); } @@ -442,40 +344,17 @@ struct QtFontFamily } bool fixedPitch : 1; -#ifdef Q_WS_X11 - bool ftWritingSystemCheck : 1; - bool xlfdLoaded : 1; - bool synthetic : 1; -#endif -#ifdef Q_WS_WIN - bool writingSystemCheck : 1; - bool loaded : 1; -#endif #if !defined(QWS) && defined(Q_OS_MAC) bool fixedPitchComputed : 1; #endif -#ifdef Q_WS_X11 - bool symbol_checked : 1; -#endif QString name; -#if defined(Q_WS_X11) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) - QByteArray fontFilename; - int fontFileIndex; -#endif -#ifdef Q_WS_WIN - QString english_name; -#endif int count; QtFontFoundry **foundries; -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) bool bogusWritingSystems; QStringList fallbackFamilies; -#endif -#if defined (Q_WS_QPA) bool askedForFallback; -#endif unsigned char writingSystems[QFontDatabase::WritingSystemsCount]; QtFontFoundry *foundry(const QString &f, bool = false); @@ -644,44 +523,16 @@ QList qt_determine_writing_systems_from_truetype_b return writingSystems; } -#if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) -// class with virtual destructor, derived in qfontdatabase_s60.cpp -class QSymbianFontDatabaseExtras -{ -public: - virtual ~QSymbianFontDatabaseExtras() {} -}; -#endif class QFontDatabasePrivate { public: QFontDatabasePrivate() : count(0), families(0), reregisterAppFonts(false) -#if defined(Q_WS_QWS) - , stream(0) -#endif -#if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) - , symbianExtras(0) -#endif -#if defined(Q_WS_WIN) && !defined(QT_NO_DIRECTWRITE) - , directWriteFactory(0) - , directWriteGdiInterop(0) -#endif { } ~QFontDatabasePrivate() { free(); -#if defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) - if (symbianExtras) - delete symbianExtras; -#endif -#if defined(Q_WS_WIN) && !defined(QT_NO_DIRECTWRITE) - if (directWriteGdiInterop) - directWriteGdiInterop->Release(); - if (directWriteFactory != 0) - directWriteFactory->Release(); -#endif } QtFontFamily *family(const QString &f, bool = false); void free() { @@ -694,15 +545,8 @@ public: } int count; -#if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG) - QString systemLang; -#endif QtFontFamily **families; -#if defined(Q_WS_WIN) && !defined(QT_NO_DIRECTWRITE) - IDWriteFactory *directWriteFactory; - IDWriteGdiInterop *directWriteGdiInterop; -#endif struct ApplicationFont { @@ -728,27 +572,7 @@ public: void invalidate(); -#if defined(Q_WS_QWS) - bool loadFromCache(const QString &fontPath); - void addQPF2File(const QByteArray &file); -#endif // Q_WS_QWS -#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) - void addFont(const QString &familyname, const char *foundryname, int weight, - bool italic, int pixelSize, const QByteArray &file, int fileIndex, - bool antialiased, - const QList &writingSystems = QList()); -#ifndef QT_NO_FREETYPE - QStringList addTTFile(const QByteArray &file, const QByteArray &fontData = QByteArray()); -#endif // QT_NO_FREETYPE -#endif -#if defined(Q_WS_QWS) - QDataStream *stream; -#elif defined(Q_OS_SYMBIAN) && defined(QT_NO_FREETYPE) - QSymbianFontDatabaseExtras *symbianExtras; -#endif -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) QStringList fallbackFamilies; -#endif }; void QFontDatabasePrivate::invalidate() @@ -797,118 +621,7 @@ QtFontFamily *QFontDatabasePrivate::family(const QString &f, bool create) return families[pos]; } -#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) -void QFontDatabasePrivate::addFont(const QString &familyname, const char *foundryname, int weight, bool italic, int pixelSize, - const QByteArray &file, int fileIndex, bool antialiased, - const QList &writingSystems) -{ -// qDebug() << "Adding font" << familyname << weight << italic << pixelSize << file << fileIndex << antialiased; - QtFontStyle::Key styleKey; - styleKey.style = italic ? QFont::StyleItalic : QFont::StyleNormal; - styleKey.weight = weight; - styleKey.stretch = 100; - QtFontFamily *f = family(familyname, true); - - if (writingSystems.isEmpty()) { - for (int ws = 1; ws < QFontDatabase::WritingSystemsCount; ++ws) { - f->writingSystems[ws] = QtFontFamily::Supported; - } - f->bogusWritingSystems = true; - } else { - for (int i = 0; i < writingSystems.count(); ++i) { - f->writingSystems[writingSystems.at(i)] = QtFontFamily::Supported; - } - } - QtFontFoundry *foundry = f->foundry(QString::fromLatin1(foundryname), true); - QtFontStyle *style = foundry->style(styleKey, QString(), true); - style->smoothScalable = (pixelSize == 0); - style->antialiased = antialiased; - QtFontSize *size = style->pixelSize(pixelSize?pixelSize:SMOOTH_SCALABLE, true); - size->fileName = file; - size->fileIndex = fileIndex; - -#if defined(Q_WS_QWS) - if (stream) { - *stream << familyname << foundry->name << weight << quint8(italic) << pixelSize - << file << fileIndex << quint8(antialiased); - *stream << quint8(writingSystems.count()); - for (int i = 0; i < writingSystems.count(); ++i) - *stream << quint8(writingSystems.at(i)); - } -#else // ..in case of defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) - f->fontFilename = file; - f->fontFileIndex = fileIndex; -#endif -} -#endif - -#if (defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN)) && !defined(QT_NO_FREETYPE) -QStringList QFontDatabasePrivate::addTTFile(const QByteArray &file, const QByteArray &fontData) -{ - QStringList families; - extern FT_Library qt_getFreetype(); - FT_Library library = qt_getFreetype(); - - int index = 0; - int numFaces = 0; - do { - FT_Face face; - FT_Error error; - if (!fontData.isEmpty()) { - error = FT_New_Memory_Face(library, (const FT_Byte *)fontData.constData(), fontData.size(), index, &face); - } else { - error = FT_New_Face(library, file, index, &face); - } - if (error != FT_Err_Ok) { - qDebug() << "FT_New_Face failed with index" << index << ":" << hex << error; - break; - } - numFaces = face->num_faces; - - int weight = QFont::Normal; - bool italic = face->style_flags & FT_STYLE_FLAG_ITALIC; - - if (face->style_flags & FT_STYLE_FLAG_BOLD) - weight = QFont::Bold; - - QList writingSystems; - // detect symbol fonts - for (int i = 0; i < face->num_charmaps; ++i) { - FT_CharMap cm = face->charmaps[i]; - if (cm->encoding == ft_encoding_adobe_custom - || cm->encoding == ft_encoding_symbol) { - writingSystems.append(QFontDatabase::Symbol); - break; - } - } - if (writingSystems.isEmpty()) { - TT_OS2 *os2 = (TT_OS2 *)FT_Get_Sfnt_Table(face, ft_sfnt_os2); - if (os2) { - quint32 unicodeRange[4] = { - static_cast(os2->ulUnicodeRange1), static_cast(os2->ulUnicodeRange2), static_cast(os2->ulUnicodeRange3), static_cast(os2->ulUnicodeRange4) - }; - quint32 codePageRange[2] = { - static_cast(os2->ulCodePageRange1), static_cast(os2->ulCodePageRange2) - }; - - writingSystems = qt_determine_writing_systems_from_truetype_bits(unicodeRange, codePageRange); - //for (int i = 0; i < writingSystems.count(); ++i) - // qDebug() << QFontDatabase::writingSystemName(writingSystems.at(i)); - } - } - - QString family = QString::fromAscii(face->family_name); - families.append(family); - addFont(family, /*foundry*/ "", weight, italic, - /*pixelsize*/ 0, file, index, /*antialias*/ true, writingSystems); - - FT_Done_Face(face); - ++index; - } while (index < numFaces); - return families; -} -#endif static const int scriptForWritingSystem[] = { QUnicodeTables::Common, // Any @@ -961,18 +674,6 @@ int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSystem) } -#if defined Q_WS_QWS || (defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG)) || defined(Q_WS_WIN) -static inline bool requiresOpenType(int writingSystem) -{ - return ((writingSystem >= QFontDatabase::Syriac && writingSystem <= QFontDatabase::Sinhala) - || writingSystem == QFontDatabase::Khmer || writingSystem == QFontDatabase::Nko); -} -static inline bool scriptRequiresOpenType(int script) -{ - return ((script >= QUnicodeTables::Syriac && script <= QUnicodeTables::Sinhala) - || script == QUnicodeTables::Khmer || script == QUnicodeTables::Nko); -} -#endif /*! @@ -1030,12 +731,10 @@ struct QtFontDesc int familyIndex; }; -#if !defined(Q_WS_MAC) static void match(int script, const QFontDef &request, const QString &family_name, const QString &foundry_name, int force_encoding_id, QtFontDesc *desc, const QList &blacklistedFamilies = QList(), bool forceXLFD=false); -#if defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA) static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDef *fontDef) { fontDef->family = desc.family->name; @@ -1061,10 +760,7 @@ static void initFontDef(const QtFontDesc &desc, const QFontDef &request, QFontDe fontDef->stretch = desc.style->key.stretch; fontDef->ignorePitch = false; } -#endif -#endif -#if defined(Q_WS_X11) || defined(Q_WS_WIN) || defined(Q_OS_SYMBIAN) || defined(Q_WS_QPA) static void getEngineData(const QFontPrivate *d, const QFontCache::Key &key) { // look for the requested font in the engine data cache @@ -1077,7 +773,6 @@ static void getEngineData(const QFontPrivate *d, const QFontCache::Key &key) d->engineData->ref.ref(); } } -#endif static QStringList familyList(const QFontDef &req) { @@ -1117,26 +812,8 @@ QMutex *qt_fontdatabase_mutex() } QT_BEGIN_INCLUDE_NAMESPACE -#if defined(Q_WS_X11) -# include "qfontdatabase_x11.cpp" -#elif defined(Q_WS_MAC) -# include "qfontdatabase_mac.cpp" -#elif defined(Q_WS_WIN) -# include "qfontdatabase_win.cpp" -#elif defined(Q_WS_QWS) -# include "qfontdatabase_qws.cpp" -#elif defined(Q_WS_QPA) # include "qfontdatabase_qpa.cpp" -#elif defined(Q_OS_SYMBIAN) -# include "qfontdatabase_s60.cpp" -#endif QT_END_INCLUDE_NAMESPACE -#if !defined(Q_WS_X11) && !defined(Q_WS_QPA) -QString QFontDatabase::resolveFontFamilyAlias(const QString &family) -{ - return family; -} -#endif static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &styleKey, const QString &styleName = QString()) @@ -1177,56 +854,7 @@ static QtFontStyle *bestStyle(QtFontFoundry *foundry, const QtFontStyle::Key &st return foundry->styles[best]; } -#if defined(Q_WS_X11) -static QtFontEncoding *findEncoding(int script, int styleStrategy, - QtFontSize *size, int force_encoding_id) -{ - QtFontEncoding *encoding = 0; - - if (force_encoding_id >= 0) { - encoding = size->encodingID(force_encoding_id); - if (!encoding) - FM_DEBUG(" required encoding_id not available"); - return encoding; - } - - if (styleStrategy & (QFont::OpenGLCompatible | QFont::PreferBitmap)) { - FM_DEBUG(" PreferBitmap and/or OpenGL set, skipping Freetype"); - } else { - encoding = size->encodingID(-1); // -1 == prefer Freetype - if (encoding) - return encoding; - } - - // FT not available, find an XLFD font, trying the default encoding first - encoding = size->encodingID(QFontPrivate::defaultEncodingID); - if (encoding) { - // does it support the requested script? - bool supportsScript = false; - for (int ws = 1; !supportsScript && ws < QFontDatabase::WritingSystemsCount; ++ws) { - if (scriptForWritingSystem[ws] != script) - continue; - supportsScript = writingSystems_for_xlfd_encoding[encoding->encoding][ws]; - } - if (!supportsScript) - encoding = 0; - } - // find the first encoding that supports the requested script - for (int ws = 1; !encoding && ws < QFontDatabase::WritingSystemsCount; ++ws) { - if (scriptForWritingSystem[ws] != script) - continue; - for (int x = 0; !encoding && x < size->count; ++x) { - const int enc = size->encodings[x].encoding; - if (writingSystems_for_xlfd_encoding[enc][ws]) - encoding = size->encodings + x; - } - } - return encoding; -} -#endif // Q_WS_X11 - -#if !defined(Q_WS_MAC) static unsigned int bestFoundry(int script, unsigned int score, int styleStrategy, const QtFontFamily *family, const QString &foundry_name, @@ -1290,23 +918,11 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy, } } -#ifdef Q_WS_X11 - QtFontEncoding *encoding = 0; -#endif // 4. find closest size match if (! size) { unsigned int distance = ~0u; for (int x = 0; x < style->count; ++x) { -#ifdef Q_WS_X11 - encoding = - findEncoding(script, styleStrategy, style->pixelSizes + x, force_encoding_id); - if (!encoding) { - FM_DEBUG(" size %3d does not support the script we want", - style->pixelSizes[x].pixelSize); - continue; - } -#endif unsigned int d; if (style->pixelSizes[x].pixelSize < pixelSize) { @@ -1341,16 +957,6 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy, } } -#ifdef Q_WS_X11 - if (size) { - encoding = findEncoding(script, styleStrategy, size, force_encoding_id); - if (!encoding) size = 0; - } - if (! encoding) { - FM_DEBUG(" foundry doesn't support the script we want"); - continue; - } -#endif // Q_WS_X11 unsigned int this_score = 0x0000; enum { @@ -1360,17 +966,6 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy, EncodingMismatch = 0x0002, XLFDPenalty = 0x0001 }; -#ifdef Q_WS_X11 - if (encoding->encoding != -1) { - this_score += XLFDPenalty; - if (encoding->encoding != QFontPrivate::defaultEncodingID) - this_score += EncodingMismatch; - } - if (pitch != '*') { - if (!(pitch == 'm' && encoding->pitch == 'c') && pitch != encoding->pitch) - this_score += PitchMismatch; - } -#else if (pitch != '*') { #if !defined(QWS) && defined(Q_OS_MAC) qt_mac_get_fixed_pitch(const_cast(family)); @@ -1379,7 +974,6 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy, || (pitch == 'p' && family->fixedPitch)) this_score += PitchMismatch; } -#endif if (styleKey != style->key) this_score += StyleMismatch; if (!style->smoothScalable && px != size->pixelSize) // bitmap scaled @@ -1395,9 +989,6 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy, desc->foundry = foundry; desc->style = style; desc->size = size; -#ifdef Q_WS_X11 - desc->encoding = encoding; -#endif // Q_WS_X11 } else { FM_DEBUG(" score %x no better than best %x", this_score, score); } @@ -1405,9 +996,7 @@ unsigned int bestFoundry(int script, unsigned int score, int styleStrategy, return score; } -#endif -#if !defined(Q_WS_MAC) /*! \internal @@ -1436,11 +1025,6 @@ static void match(int script, const QFontDef &request, family_name.isEmpty() ? "-- first in script --" : family_name.toLatin1().constData(), foundry_name.isEmpty() ? "-- any --" : foundry_name.toLatin1().constData(), script, request.weight, request.style, request.stretch, request.pixelSize, pitch); -#if defined(FONT_MATCH_DEBUG) && defined(Q_WS_X11) - if (force_encoding_id >= 0) { - FM_DEBUG(" required encoding: %d", force_encoding_id); - } -#endif desc->family = 0; desc->foundry = 0; @@ -1451,12 +1035,8 @@ static void match(int script, const QFontDef &request, unsigned int score = ~0u; -#ifdef Q_WS_X11 - load(family_name, script, forceXLFD); -#else Q_UNUSED(forceXLFD); load(family_name, script); -#endif QFontDatabasePrivate *db = privateDb(); for (int x = 0; x < db->count; ++x) { @@ -1468,9 +1048,6 @@ static void match(int script, const QFontDef &request, if (!family_name.isEmpty() && test.family->name.compare(family_name, Qt::CaseInsensitive) != 0 -#ifdef Q_WS_WIN - && test.family->english_name.compare(family_name, Qt::CaseInsensitive) != 0 -#endif ) continue; @@ -1514,7 +1091,6 @@ static void match(int script, const QFontDef &request, break; } } -#endif static QString styleStringHelper(int weight, QFont::Style style) { @@ -1677,9 +1253,6 @@ QList QFontDatabase::writingSystems() const QMutexLocker locker(fontDatabaseMutex()); QT_PREPEND_NAMESPACE(load)(); -#ifdef Q_WS_X11 - checkSymbolFonts(); -#endif QList list; for (int i = 0; i < d->count; ++i) { @@ -1713,9 +1286,6 @@ QList QFontDatabase::writingSystems(const QString QMutexLocker locker(fontDatabaseMutex()); QT_PREPEND_NAMESPACE(load)(); -#ifdef Q_WS_X11 - checkSymbolFonts(familyName); -#endif QList list; QtFontFamily *f = d->family(familyName); @@ -1746,10 +1316,6 @@ QStringList QFontDatabase::families(WritingSystem writingSystem) const QMutexLocker locker(fontDatabaseMutex()); QT_PREPEND_NAMESPACE(load)(); -#ifdef Q_WS_X11 - if (writingSystem != Any) - checkSymbolFonts(); -#endif QStringList flist; for (int i = 0; i < d->count; i++) { @@ -1950,12 +1516,6 @@ bool QFontDatabase::isScalable(const QString &family, QList QFontDatabase::pointSizes(const QString &family, const QString &styleName) { -#if defined(Q_WS_WIN) - // windows and macosx are always smoothly scalable - Q_UNUSED(family); - Q_UNUSED(styleName); - return standardSizes(); -#else bool smoothScalable = false; QString familyName, foundryName; parseFontName(family, foundryName, familyName); @@ -1972,11 +1532,7 @@ QList QFontDatabase::pointSizes(const QString &family, if (!fam) return sizes; -#ifdef Q_WS_X11 - int dpi = QX11Info::appDpiY(); -#else const int dpi = qt_defaultDpiY(); // embedded -#endif for (int j = 0; j < fam->count; j++) { QtFontFoundry *foundry = fam->foundries[j]; @@ -2005,7 +1561,6 @@ QList QFontDatabase::pointSizes(const QString &family, qSort(sizes); return sizes; -#endif } /*! @@ -2061,11 +1616,6 @@ QFont QFontDatabase::font(const QString &family, const QString &style, QList QFontDatabase::smoothSizes(const QString &family, const QString &styleName) { -#ifdef Q_WS_WIN - Q_UNUSED(family); - Q_UNUSED(styleName); - return QFontDatabase::standardSizes(); -#else bool smoothScalable = false; QString familyName, foundryName; parseFontName(family, foundryName, familyName); @@ -2082,11 +1632,7 @@ QList QFontDatabase::smoothSizes(const QString &family, if (!fam) return sizes; -#ifdef Q_WS_X11 - int dpi = QX11Info::appDpiY(); -#else const int dpi = qt_defaultDpiY(); // embedded -#endif for (int j = 0; j < fam->count; j++) { QtFontFoundry *foundry = fam->foundries[j]; @@ -2115,7 +1661,6 @@ QList QFontDatabase::smoothSizes(const QString &family, qSort(sizes); return sizes; -#endif } diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h index fb8ef20d6d..6e0550334f 100644 --- a/src/gui/text/qfontdatabase.h +++ b/src/gui/text/qfontdatabase.h @@ -153,13 +153,8 @@ private: static void createDatabase(); static void parseFontName(const QString &name, QString &foundry, QString &family); static QString resolveFontFamilyAlias(const QString &family); -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) static QFontEngine *findFont(int script, const QFontPrivate *fp, const QFontDef &request); -#endif static void load(const QFontPrivate *d, int script); -#ifdef Q_WS_X11 - static QFontEngine *loadXlfd(int screen, int script, const QFontDef &request, int force_encoding_id = -1); -#endif friend struct QFontDef; friend class QFontPrivate; diff --git a/src/gui/text/qfontengine.cpp b/src/gui/text/qfontengine.cpp index 1960b1e9b2..3f008064e2 100644 --- a/src/gui/text/qfontengine.cpp +++ b/src/gui/text/qfontengine.cpp @@ -796,7 +796,6 @@ QFontEngineGlyphCache *QFontEngine::glyphCache(void *key, QFontEngineGlyphCache: return 0; } -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) static inline QFixed kerning(int left, int right, const QFontEngine::KernPair *pairs, int numPairs) { uint left_right = (left << 16) + right; @@ -895,11 +894,6 @@ end: // qDebug() << 'i' << i << "left_right" << hex << kerning_pairs.at(i).left_right; } -#else -void QFontEngine::doKerning(QGlyphLayout *, QTextEngine::ShaperFlags) const -{ -} -#endif int QFontEngine::glyphCount() const { @@ -1249,7 +1243,6 @@ glyph_metrics_t QFontEngineBox::boundingBox(const QGlyphLayout &glyphs) return overall; } -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) void QFontEngineBox::draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &ti) { if (!ti.glyphs.numGlyphs) @@ -1276,7 +1269,6 @@ void QFontEngineBox::draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt painter->drawRect(QRectF(positions[k].toPointF(), s)); painter->restore(); } -#endif glyph_metrics_t QFontEngineBox::boundingBox(glyph_t) { @@ -1310,12 +1302,6 @@ qreal QFontEngineBox::maxCharWidth() const return _size; } -#ifdef Q_WS_X11 -int QFontEngineBox::cmap() const -{ - return -1; -} -#endif const char *QFontEngineBox::name() const { diff --git a/src/gui/text/qfontengine_ft.cpp b/src/gui/text/qfontengine_ft.cpp index 9ed3906f4a..ecb717ec56 100644 --- a/src/gui/text/qfontengine_ft.cpp +++ b/src/gui/text/qfontengine_ft.cpp @@ -754,7 +754,6 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format, metrics = face->size->metrics; -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) /* TrueType fonts with embedded bitmaps may have a bitmap font specific ascent/descent in the EBLC table. There is no direct public API @@ -777,7 +776,6 @@ bool QFontEngineFT::init(FaceId faceId, bool antialias, GlyphFormat format, } } } -#endif fontDef.styleName = QString::fromUtf8(face->style_name); @@ -862,10 +860,8 @@ QFontEngineFT::Glyph *QFontEngineFT::loadGlyph(QGlyphSet *set, uint glyph, int vfactor = 1; int load_flags = loadFlags(set, format, 0, hsubpixel, vfactor); -#ifndef Q_WS_QWS if (format != Format_Mono && !embeddedbitmap) load_flags |= FT_LOAD_NO_BITMAP; -#endif FT_Matrix matrix = freetype->matrix; bool transform = matrix.xx != 0x10000 diff --git a/src/gui/text/qfontengine_ft_p.h b/src/gui/text/qfontengine_ft_p.h index f22a043548..bbef0bfcc7 100644 --- a/src/gui/text/qfontengine_ft_p.h +++ b/src/gui/text/qfontengine_ft_p.h @@ -58,9 +58,6 @@ #include #include FT_FREETYPE_H -#if defined(Q_WS_X11) -#include -#endif #ifndef Q_OS_WIN #include @@ -165,9 +162,6 @@ public: Subpixel_VBGR }; -#if defined(Q_WS_X11) && !defined(QT_NO_XRENDER) - typedef XGlyphInfo GlyphInfo; -#else struct GlyphInfo { unsigned short width; unsigned short height; @@ -176,7 +170,6 @@ public: short xOff; short yOff; }; -#endif struct GlyphAndSubPixelPosition { @@ -310,9 +303,6 @@ private: const QFixedPoint *positions, GlyphFormat format = Format_Render); -#if defined(Q_WS_QWS) || defined(Q_OS_SYMBIAN) - virtual void draw(QPaintEngine * /*p*/, qreal /*x*/, qreal /*y*/, const QTextItemInt & /*si*/) {} -#endif QFontEngineFT(const QFontDef &fd); virtual ~QFontEngineFT(); diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index 2bec69c467..ec1f22b6e1 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -60,16 +60,7 @@ #include "private/qtextengine_p.h" #include "private/qfont_p.h" -#ifdef Q_WS_WIN -# include "QtCore/qt_windows.h" -#endif -#ifdef Q_WS_MAC -# include "private/qt_mac_p.h" -# include "QtCore/qmap.h" -# include "QtCore/qcache.h" -# include "private/qcore_mac_p.h" -#endif #include @@ -181,9 +172,6 @@ public: virtual void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const {} virtual void doKerning(QGlyphLayout *, QTextEngine::ShaperFlags) const; -#if !defined(Q_WS_X11) && !defined(Q_WS_WIN) && !defined(Q_WS_MAC) && !defined(Q_OS_SYMBIAN) && !defined(Q_WS_QPA) - virtual void draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si) = 0; -#endif virtual void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, QPainterPath *path, QTextItem::RenderFlags flags); @@ -275,7 +263,6 @@ public: bool symbol; mutable HB_FontRec hbFont; mutable HB_Face hbFace; -#if defined(Q_WS_WIN) || defined(Q_WS_X11) || defined(Q_WS_QWS) || defined(Q_WS_QPA) || defined(Q_OS_SYMBIAN) struct KernPair { uint left_right; QFixed adjust; @@ -287,7 +274,6 @@ public: }; QVector kerning_pairs; void loadKerningPairs(QFixed scalingFactor); -#endif int glyphFormat; QImage currentlyLockedAlphaMap; @@ -319,48 +305,6 @@ inline uint qHash(const QFontEngine::FaceId &f) class QGlyph; -#if defined(Q_WS_QWS) - -#ifndef QT_NO_QWS_QPF - -class QFontEngineQPF1Data; - -class QFontEngineQPF1 : public QFontEngine -{ -public: - QFontEngineQPF1(const QFontDef&, const QString &fn); - ~QFontEngineQPF1(); - - virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const; - virtual void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const; - - virtual void draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si); - virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags); - - virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs); - virtual glyph_metrics_t boundingBox(glyph_t glyph); - - virtual QFixed ascent() const; - virtual QFixed descent() const; - virtual QFixed leading() const; - virtual qreal maxCharWidth() const; - virtual qreal minLeftBearing() const; - virtual qreal minRightBearing() const; - virtual QFixed underlinePosition() const; - virtual QFixed lineThickness() const; - - virtual Type type() const; - - virtual bool canRender(const QChar *string, int len); - inline const char *name() const { return 0; } - virtual QImage alphaMapForGlyph(glyph_t); - - - QFontEngineQPF1Data *d; -}; -#endif // QT_NO_QWS_QPF - -#endif // QWS class QFontEngineBox : public QFontEngine @@ -372,9 +316,7 @@ public: virtual bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const; virtual void recalcAdvances(QGlyphLayout *, QTextEngine::ShaperFlags) const; -#if !defined(Q_WS_X11) && !defined(Q_WS_WIN) && !defined(Q_WS_MAC) && !defined(Q_OS_SYMBIAN) void draw(QPaintEngine *p, qreal x, qreal y, const QTextItemInt &si); -#endif virtual void addOutlineToPath(qreal x, qreal y, const QGlyphLayout &glyphs, QPainterPath *path, QTextItem::RenderFlags flags); virtual glyph_metrics_t boundingBox(const QGlyphLayout &glyphs); @@ -389,9 +331,6 @@ public: virtual qreal minRightBearing() const { return 0; } virtual QImage alphaMapForGlyph(glyph_t); -#ifdef Q_WS_X11 - int cmap() const; -#endif virtual const char *name() const; virtual bool canRender(const QChar *string, int len); @@ -471,12 +410,6 @@ public: QT_END_NAMESPACE -#ifdef Q_WS_WIN -# include "private/qfontengine_win_p.h" -#endif -#if defined(Q_OS_SYMBIAN) && !defined(QT_NO_FREETYPE) -# include "private/qfontengine_ft_p.h" -#endif #endif // QFONTENGINE_P_H diff --git a/src/gui/text/qfontengine_qpf.cpp b/src/gui/text/qfontengine_qpf.cpp index 584cdc0d66..8bdaa46524 100644 --- a/src/gui/text/qfontengine_qpf.cpp +++ b/src/gui/text/qfontengine_qpf.cpp @@ -70,11 +70,6 @@ QT_BEGIN_NAMESPACE QT_BEGIN_INCLUDE_NAMESPACE -#if defined(Q_WS_QWS) -# include "private/qwscommand_qws_p.h" -# include "qwsdisplay_qws.h" -# include "qabstractfontengine_p.h" -#endif #include "qplatformdefs.h" QT_END_INCLUDE_NAMESPACE @@ -231,12 +226,7 @@ QVariant QFontEngineQPF::extractHeaderField(const uchar *data, HeaderTag request QString qws_fontCacheDir() { QString dir; -#if defined(Q_WS_QWS) - extern QString qws_dataDir(); - dir = qws_dataDir(); -#else dir = QDir::tempPath(); -#endif dir.append(QLatin1String("/fonts/")); QDir qd(dir); if (!qd.exists() && !qd.mkpath(dir)) @@ -504,24 +494,10 @@ QFontEngineQPF::QFontEngineQPF(const QFontDef &def, int fileDescriptor, QFontEng << "glyphMapOffset" << glyphMapOffset << "glyphDataOffset" << glyphDataOffset << "fd" << fd << "glyphDataSize" << glyphDataSize; #endif -#if defined(Q_WS_QWS) - if (isValid() && renderingFontEngine) - qt_fbdpy->sendFontCommand(QWSFontCommand::StartedUsingFont, encodedFileName); -#endif } QFontEngineQPF::~QFontEngineQPF() { -#if defined(Q_WS_QWS) - if (isValid() && renderingFontEngine) { - QT_TRY { - qt_fbdpy->sendFontCommand(QWSFontCommand::StoppedUsingFont, encodedFileName); - } QT_CATCH(...) { - qDebug("QFontEngineQPF::~QFontEngineQPF: Out of memory"); - // ignore. - } - } -#endif delete renderingFontEngine; if (fontData) { if (munmap((void *)fontData, dataSize) == -1) { @@ -982,14 +958,7 @@ bool QFontEngineQPF::lockFile() perror("unlocking possibly corrupt qpf"); return false; } -#if defined(Q_WS_QWS) - extern int qws_client_id; - // qws_client_id == 0 means we're the server. in this case we just - // set the id to 1 - header->lock = qws_client_id ? qws_client_id : 1; -#else header->lock = 1; -#endif return true; } diff --git a/src/gui/text/qfontengineglyphcache_p.h b/src/gui/text/qfontengineglyphcache_p.h index 3ac5392d0f..6b633d615c 100644 --- a/src/gui/text/qfontengineglyphcache_p.h +++ b/src/gui/text/qfontengineglyphcache_p.h @@ -59,16 +59,7 @@ #include #include "private/qfont_p.h" -#ifdef Q_WS_WIN -# include "QtCore/qt_windows.h" -#endif -#ifdef Q_WS_MAC -# include "private/qt_mac_p.h" -# include "QtCore/qmap.h" -# include "QtCore/qcache.h" -# include "private/qcore_mac_p.h" -#endif QT_BEGIN_NAMESPACE diff --git a/src/gui/text/qfontmetrics.cpp b/src/gui/text/qfontmetrics.cpp index 9fce85f25b..012e9f300b 100644 --- a/src/gui/text/qfontmetrics.cpp +++ b/src/gui/text/qfontmetrics.cpp @@ -49,15 +49,9 @@ #include -#ifdef Q_WS_X11 -#include "qx11info_x11.h" -#endif QT_BEGIN_NAMESPACE -#ifdef Q_WS_X11 -extern const QX11Info *qt_x11Info(const QPaintDevice *pd); -#endif extern void qt_format_text(const QFont& font, const QRectF &_r, int tf, const QString &text, QRectF *brect, @@ -182,12 +176,7 @@ QFontMetrics::QFontMetrics(const QFont &font) QFontMetrics::QFontMetrics(const QFont &font, QPaintDevice *paintdevice) { int dpi = paintdevice ? paintdevice->logicalDpiY() : qt_defaultDpi(); -#ifdef Q_WS_X11 - const QX11Info *info = qt_x11Info(paintdevice); - int screen = info ? info->screen() : 0; -#else const int screen = 0; -#endif if (font.d->dpi != dpi || font.d->screen != screen ) { d = new QFontPrivate(*font.d); d->dpi = dpi; @@ -1060,12 +1049,7 @@ QFontMetricsF::QFontMetricsF(const QFont &font) QFontMetricsF::QFontMetricsF(const QFont &font, QPaintDevice *paintdevice) { int dpi = paintdevice ? paintdevice->logicalDpiY() : qt_defaultDpi(); -#ifdef Q_WS_X11 - const QX11Info *info = qt_x11Info(paintdevice); - int screen = info ? info->screen() : 0; -#else const int screen = 0; -#endif if (font.d->dpi != dpi || font.d->screen != screen ) { d = new QFontPrivate(*font.d); d->dpi = dpi; diff --git a/src/gui/text/qfontmetrics.h b/src/gui/text/qfontmetrics.h index f21e820556..21e211a4a7 100644 --- a/src/gui/text/qfontmetrics.h +++ b/src/gui/text/qfontmetrics.h @@ -54,9 +54,6 @@ QT_BEGIN_NAMESPACE QT_MODULE(Gui) -#ifdef Q_WS_QWS -class QFontEngine; -#endif class QTextCodec; class QRect; @@ -121,9 +118,6 @@ public: inline bool operator !=(const QFontMetrics &other) const { return !operator==(other); } private: -#if defined(Q_WS_MAC) - friend class QFontPrivate; -#endif friend class QFontMetricsF; friend class QStackTextEngine; diff --git a/src/gui/text/qfontsubset.cpp b/src/gui/text/qfontsubset.cpp index dc2a14a52a..cf707fe78f 100644 --- a/src/gui/text/qfontsubset.cpp +++ b/src/gui/text/qfontsubset.cpp @@ -45,14 +45,8 @@ #include "private/qpdf_p.h" #include "private/qfunctions_p.h" -#ifdef Q_WS_X11 -#include "private/qfontengine_x11_p.h" -#endif #ifndef QT_NO_FREETYPE -#if defined(Q_WS_X11) || defined(Q_WS_QWS) -# include "private/qfontengine_ft_p.h" -#endif #include #include FT_FREETYPE_H #endif @@ -285,24 +279,6 @@ QByteArray QFontSubset::glyphName(unsigned short unicode, bool symbol) #ifndef QT_NO_FREETYPE static FT_Face ft_face(const QFontEngine *engine) { -#ifdef Q_WS_X11 -#ifndef QT_NO_FONTCONFIG - if (engine->type() == QFontEngine::Freetype) { - const QFontEngineFT *ft = static_cast(engine); - return ft->non_locked_face(); - } else -#endif - if (engine->type() == QFontEngine::XLFD) { - const QFontEngineXLFD *xlfd = static_cast(engine); - return xlfd->non_locked_face(); - } -#endif -#ifdef Q_WS_QWS - if (engine->type() == QFontEngine::Freetype) { - const QFontEngineFT *ft = static_cast(engine); - return ft->non_locked_face(); - } -#endif return 0; } #endif @@ -322,10 +298,6 @@ QByteArray QFontSubset::glyphName(unsigned int glyph, const QVector reverse char name[32]; name[0] = 0; if (face && FT_HAS_GLYPH_NAMES(face)) { -#if defined(Q_WS_X11) - if (fontEngine->type() == QFontEngine::XLFD) - glyphIndex = static_cast(fontEngine)->glyphIndexToFreetypeGlyphIndex(glyphIndex); -#endif FT_Get_Glyph_Name(face, glyphIndex, &name, 32); if (name[0] == '.') // fix broken PS fonts returning .notdef for many glyphs name[0] = 0; @@ -333,12 +305,6 @@ QByteArray QFontSubset::glyphName(unsigned int glyph, const QVector reverse if (name[0]) { s << '/' << name; } else -#endif -#if defined(Q_WS_X11) - if (fontEngine->type() == QFontEngine::XLFD) { - uint uc = static_cast(fontEngine)->toUnicode(glyphIndex); - s << '/' << glyphName(uc, false /* ### */); - } else #endif if (reverseMap[glyphIndex] && reverseMap[glyphIndex] < 0x10000) { s << '/' << glyphName(reverseMap[glyphIndex], false); diff --git a/src/gui/text/qlinecontrol.cpp b/src/gui/text/qlinecontrol.cpp index 33de367d96..3373807bd7 100644 --- a/src/gui/text/qlinecontrol.cpp +++ b/src/gui/text/qlinecontrol.cpp @@ -1491,10 +1491,6 @@ void QLineControl::processKeyEvent(QKeyEvent* event) else if (event == QKeySequence::Paste) { if (!isReadOnly()) { QClipboard::Mode mode = QClipboard::Clipboard; -#ifdef Q_WS_X11 - if (event->modifiers() == (Qt::CTRL | Qt::SHIFT) && event->key() == Qt::Key_Insert) - mode = QClipboard::Selection; -#endif paste(mode); } } @@ -1598,26 +1594,6 @@ void QLineControl::processKeyEvent(QKeyEvent* event) #endif // QT_NO_SHORTCUT else { bool handled = false; -#ifdef Q_WS_MAC - if (event->key() == Qt::Key_Up || event->key() == Qt::Key_Down) { - Qt::KeyboardModifiers myModifiers = (event->modifiers() & ~Qt::KeypadModifier); - if (myModifiers & Qt::ShiftModifier) { - if (myModifiers == (Qt::ControlModifier|Qt::ShiftModifier) - || myModifiers == (Qt::AltModifier|Qt::ShiftModifier) - || myModifiers == Qt::ShiftModifier) { - - event->key() == Qt::Key_Up ? home(1) : end(1); - } - } else { - if ((myModifiers == Qt::ControlModifier - || myModifiers == Qt::AltModifier - || myModifiers == Qt::NoModifier)) { - event->key() == Qt::Key_Up ? home(0) : end(0); - } - } - handled = true; - } -#endif if (event->modifiers() & Qt::ControlModifier) { switch (event->key()) { case Qt::Key_Backspace: @@ -1626,21 +1602,6 @@ void QLineControl::processKeyEvent(QKeyEvent* event) del(); } break; -#if defined(Q_WS_X11) - case Qt::Key_E: - end(0); - break; - - case Qt::Key_U: - if (!isReadOnly()) { - setSelection(0, text().size()); -#ifndef QT_NO_CLIPBOARD - copy(); -#endif - del(); - } - break; -#endif default: if (!handled) unknown = true; diff --git a/src/gui/text/qrawfont.cpp b/src/gui/text/qrawfont.cpp index 01c04a74ca..389c5bdc75 100644 --- a/src/gui/text/qrawfont.cpp +++ b/src/gui/text/qrawfont.cpp @@ -646,23 +646,6 @@ extern int qt_script_for_writing_system(QFontDatabase::WritingSystem writingSyst QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writingSystem) { QRawFont rawFont; -#if defined(Q_WS_MAC) - QTextLayout layout(QFontDatabase::writingSystemSample(writingSystem), font); - layout.beginLayout(); - QTextLine line = layout.createLine(); - layout.endLayout(); - QList list = layout.glyphRuns(); - if (list.size()) { - // Pick the one matches the family name we originally requested, - // if none of them match, just pick the first one - for (int i = 0; i < list.size(); i++) { - rawfont = list.at(i).rawFont(); - if (rawfont.familyName() == font.family()) - return rawfont; - } - return list.at(0).rawFont(); - } -#else QFontPrivate *font_d = QFontPrivate::get(font); int script = qt_script_for_writing_system(writingSystem); QFontEngine *fe = font_d->engineForScript(script); @@ -681,7 +664,6 @@ QRawFont QRawFont::fromFont(const QFont &font, QFontDatabase::WritingSystem writ rawFont.d.data()->fontEngine->ref.ref(); rawFont.d.data()->hintingPreference = font.hintingPreference(); } -#endif return rawFont; } diff --git a/src/gui/text/qrawfont_ft.cpp b/src/gui/text/qrawfont_ft.cpp index 1666df3fdf..c941b98694 100644 --- a/src/gui/text/qrawfont_ft.cpp +++ b/src/gui/text/qrawfont_ft.cpp @@ -47,28 +47,17 @@ #include "qfontengine_ft_p.h" #include "quuid.h" -#if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG) -# include "qfontengine_x11_p.h" -#endif QT_BEGIN_NAMESPACE class QFontEngineFTRawFont -#if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG) - : public QFontEngineX11FT -#else : public QFontEngineFT -#endif { public: QFontEngineFTRawFont(const QFontDef &fontDef) -#if defined(Q_WS_X11) && !defined(QT_NO_FONTCONFIG) - : QFontEngineX11FT(fontDef) -#else : QFontEngineFT(fontDef) -#endif { } diff --git a/src/gui/text/qrawfont_p.h b/src/gui/text/qrawfont_p.h index 0187c374a0..1f2e957906 100644 --- a/src/gui/text/qrawfont_p.h +++ b/src/gui/text/qrawfont_p.h @@ -71,21 +71,11 @@ public: : fontEngine(0) , hintingPreference(QFont::PreferDefaultHinting) , thread(0) -#if defined(Q_WS_WIN) - , fontHandle(NULL) - , ptrAddFontMemResourceEx(NULL) - , ptrRemoveFontMemResourceEx(NULL) -#endif {} QRawFontPrivate(const QRawFontPrivate &other) : hintingPreference(other.hintingPreference) , thread(other.thread) -#if defined(Q_WS_WIN) - , fontHandle(NULL) - , ptrAddFontMemResourceEx(other.ptrAddFontMemResourceEx) - , ptrRemoveFontMemResourceEx(other.ptrRemoveFontMemResourceEx) -#endif { fontEngine = other.fontEngine; if (fontEngine != 0) @@ -117,16 +107,6 @@ public: QThread *thread; QAtomicInt ref; -#if defined(Q_WS_WIN) - HANDLE fontHandle; - - typedef HANDLE (WINAPI *PtrAddFontMemResourceEx)(PVOID, DWORD, PVOID, DWORD *); - typedef BOOL (WINAPI *PtrRemoveFontMemResourceEx)(HANDLE); - - PtrAddFontMemResourceEx ptrAddFontMemResourceEx; - PtrRemoveFontMemResourceEx ptrRemoveFontMemResourceEx; - -#endif // Q_WS_WIN }; QT_END_NAMESPACE diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 4edaf8a0e6..810c715437 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -88,9 +88,6 @@ const bool fullWidthSelection = true; QT_BEGIN_NAMESPACE #ifndef QT_NO_CONTEXTMENU -#if defined(Q_WS_WIN) || defined(Q_WS_X11) -extern bool qt_use_rtl_extensions; -#endif #endif // could go into QTextCursor... @@ -1171,10 +1168,6 @@ void QTextControlPrivate::keyPressEvent(QKeyEvent *e) } else if (e == QKeySequence::Paste) { QClipboard::Mode mode = QClipboard::Clipboard; -#ifdef Q_WS_X11 - if (e->modifiers() == (Qt::CTRL | Qt::SHIFT) && e->key() == Qt::Key_Insert) - mode = QClipboard::Selection; -#endif q->paste(mode); } #endif @@ -1932,9 +1925,6 @@ void QTextControlPrivate::focusEvent(QFocusEvent *e) if (e->gotFocus()) { #ifdef QT_KEYPAD_NAVIGATION if (!QGuiApplication::keypadNavigationEnabled() || (hasEditFocus && (e->reason() == Qt::PopupFocusReason -#ifdef Q_OS_SYMBIAN - || e->reason() == Qt::ActiveWindowFocusReason -#endif ))) { #endif cursorOn = (interactionFlags & Qt::TextSelectableByKeyboard); diff --git a/src/gui/text/qtextengine.cpp b/src/gui/text/qtextengine.cpp index 416a219e05..3a2431d1ea 100644 --- a/src/gui/text/qtextengine.cpp +++ b/src/gui/text/qtextengine.cpp @@ -819,11 +819,6 @@ void QTextEngine::bidiReorder(int numItems, const quint8 *levels, int *visualOrd QT_BEGIN_INCLUDE_NAMESPACE -#if defined(Q_WS_X11) || defined (Q_WS_QWS) -# include "qfontengine_ft_p.h" -#elif defined(Q_WS_MAC) -# include "qtextengine_mac.cpp" -#endif #include @@ -874,20 +869,6 @@ void QTextEngine::shapeLine(const QScriptLine &line) } } -#if !defined(QT_ENABLE_HARFBUZZ_FOR_MAC) && defined(Q_WS_MAC) -static bool enableHarfBuzz() -{ - static enum { Yes, No, Unknown } status = Unknown; - - if (status == Unknown) { - QByteArray v = qgetenv("QT_ENABLE_HARFBUZZ"); - bool value = !v.isEmpty() && v != "0" && v != "false"; - if (value) status = Yes; - else status = No; - } - return status == Yes; -} -#endif void QTextEngine::shapeText(int item) const { @@ -897,30 +878,7 @@ void QTextEngine::shapeText(int item) const if (si.num_glyphs) return; -#if defined(Q_WS_MAC) -#if !defined(QT_ENABLE_HARFBUZZ_FOR_MAC) - if (enableHarfBuzz()) { -#endif - QFontEngine *actualFontEngine = fontEngine(si, &si.ascent, &si.descent, &si.leading); - if (actualFontEngine->type() == QFontEngine::Multi) - actualFontEngine = static_cast(actualFontEngine)->engine(0); - - HB_Face face = actualFontEngine->harfbuzzFace(); - HB_Script script = (HB_Script) si.analysis.script; - if (face->supported_scripts[script]) - shapeTextWithHarfbuzz(item); - else - shapeTextMac(item); -#if !defined(QT_ENABLE_HARFBUZZ_FOR_MAC) - } else { - shapeTextMac(item); - } -#endif -#elif defined(Q_WS_WINCE) - shapeTextWithCE(item); -#else shapeTextWithHarfbuzz(item); -#endif si.width = 0; @@ -978,186 +936,6 @@ static inline bool hasCaseChange(const QScriptItem &si) si.analysis.flags == QScriptAnalysis::Lowercase; } -#if defined(Q_WS_WINCE) //TODO -// set the glyph attributes heuristically. Assumes a 1 to 1 relationship between chars and glyphs -// and no reordering. -// also computes logClusters heuristically -static void heuristicSetGlyphAttributes(const QChar *uc, int length, QGlyphLayout *glyphs, unsigned short *logClusters, int num_glyphs) -{ - // ### zeroWidth and justification are missing here!!!!! - - Q_UNUSED(num_glyphs); - Q_ASSERT(num_glyphs <= length); - -// qDebug("QScriptEngine::heuristicSetGlyphAttributes, num_glyphs=%d", item->num_glyphs); - - int glyph_pos = 0; - for (int i = 0; i < length; i++) { - if (uc[i].isHighSurrogate() && i < length-1 && uc[i+1].isLowSurrogate()) { - logClusters[i] = glyph_pos; - logClusters[++i] = glyph_pos; - } else { - logClusters[i] = glyph_pos; - } - ++glyph_pos; - } - - // first char in a run is never (treated as) a mark - int cStart = 0; - - const bool symbolFont = false; // #### - glyphs->attributes[0].mark = false; - glyphs->attributes[0].clusterStart = true; - glyphs->attributes[0].dontPrint = (!symbolFont && uc[0].unicode() == 0x00ad) || qIsControlChar(uc[0].unicode()); - - int pos = 0; - int lastCat = QChar::category(uc[0].unicode()); - for (int i = 1; i < length; ++i) { - if (logClusters[i] == pos) - // same glyph - continue; - ++pos; - while (pos < logClusters[i]) { - glyphs[pos].attributes = glyphs[pos-1].attributes; - ++pos; - } - // hide soft-hyphens by default - if ((!symbolFont && uc[i].unicode() == 0x00ad) || qIsControlChar(uc[i].unicode())) - glyphs->attributes[pos].dontPrint = true; - const QUnicodeTables::Properties *prop = QUnicodeTables::properties(uc[i].unicode()); - int cat = prop->category; - if (cat != QChar::Mark_NonSpacing) { - glyphs->attributes[pos].mark = false; - glyphs->attributes[pos].clusterStart = true; - glyphs->attributes[pos].combiningClass = 0; - cStart = logClusters[i]; - } else { - int cmb = prop->combiningClass; - - if (cmb == 0) { - // Fix 0 combining classes - if ((uc[pos].unicode() & 0xff00) == 0x0e00) { - // thai or lao - unsigned char col = uc[pos].cell(); - if (col == 0x31 || - col == 0x34 || - col == 0x35 || - col == 0x36 || - col == 0x37 || - col == 0x47 || - col == 0x4c || - col == 0x4d || - col == 0x4e) { - cmb = QChar::Combining_AboveRight; - } else if (col == 0xb1 || - col == 0xb4 || - col == 0xb5 || - col == 0xb6 || - col == 0xb7 || - col == 0xbb || - col == 0xcc || - col == 0xcd) { - cmb = QChar::Combining_Above; - } else if (col == 0xbc) { - cmb = QChar::Combining_Below; - } - } - } - - glyphs->attributes[pos].mark = true; - glyphs->attributes[pos].clusterStart = false; - glyphs->attributes[pos].combiningClass = cmb; - logClusters[i] = cStart; - glyphs->advances_x[pos] = 0; - glyphs->advances_y[pos] = 0; - } - - // one gets an inter character justification point if the current char is not a non spacing mark. - // as then the current char belongs to the last one and one gets a space justification point - // after the space char. - if (lastCat == QChar::Separator_Space) - glyphs->attributes[pos-1].justification = HB_Space; - else if (cat != QChar::Mark_NonSpacing) - glyphs->attributes[pos-1].justification = HB_Character; - else - glyphs->attributes[pos-1].justification = HB_NoJustification; - - lastCat = cat; - } - pos = logClusters[length-1]; - if (lastCat == QChar::Separator_Space) - glyphs->attributes[pos].justification = HB_Space; - else - glyphs->attributes[pos].justification = HB_Character; -} - -void QTextEngine::shapeTextWithCE(int item) const -{ - QScriptItem &si = layoutData->items[item]; - si.glyph_data_offset = layoutData->used; - - QFontEngine *fe = fontEngine(si, &si.ascent, &si.descent, &si.leading); - - QTextEngine::ShaperFlags flags; - if (si.analysis.bidiLevel % 2) - flags |= RightToLeft; - if (option.useDesignMetrics()) - flags |= DesignMetrics; - - // pre-initialize char attributes - if (! attributes()) - return; - - const int len = length(item); - int num_glyphs = length(item); - const QChar *str = layoutData->string.unicode() + si.position; - ushort upperCased[256]; - if (hasCaseChange(si)) { - ushort *uc = upperCased; - if (len > 256) - uc = new ushort[len]; - for (int i = 0; i < len; ++i) { - if(si.analysis.flags == QScriptAnalysis::Lowercase) - uc[i] = str[i].toLower().unicode(); - else - uc[i] = str[i].toUpper().unicode(); - } - str = reinterpret_cast(uc); - } - - while (true) { - if (! ensureSpace(num_glyphs)) { - // If str is converted to uppercase/lowercase form with a new buffer, - // we need to delete that buffer before return for error - const ushort *uc = reinterpret_cast(str); - if (hasCaseChange(si) && uc != upperCased) - delete [] uc; - return; - } - num_glyphs = layoutData->glyphLayout.numGlyphs - layoutData->used; - - QGlyphLayout g = availableGlyphs(&si); - unsigned short *log_clusters = logClusters(&si); - - if (fe->stringToCMap(str, - len, - &g, - &num_glyphs, - flags)) { - heuristicSetGlyphAttributes(str, len, &g, log_clusters, num_glyphs); - break; - } - } - - si.num_glyphs = num_glyphs; - - layoutData->used += si.num_glyphs; - - const ushort *uc = reinterpret_cast(str); - if (hasCaseChange(si) && uc != upperCased) - delete [] uc; -} -#endif static inline void moveGlyphData(const QGlyphLayout &destination, const QGlyphLayout &source, int num) { diff --git a/src/gui/text/qtextengine_p.h b/src/gui/text/qtextengine_p.h index fd11b9f658..2bdc866276 100644 --- a/src/gui/text/qtextengine_p.h +++ b/src/gui/text/qtextengine_p.h @@ -637,12 +637,6 @@ private: void addRequiredBoundaries() const; void shapeText(int item) const; void shapeTextWithHarfbuzz(int item) const; -#if defined(Q_WS_WINCE) - void shapeTextWithCE(int item) const; -#endif -#if defined(Q_WS_MAC) - void shapeTextMac(int item) const; -#endif void splitItem(int item, int pos) const; void resolveAdditionalFormats() const; diff --git a/src/gui/text/qtextlayout.cpp b/src/gui/text/qtextlayout.cpp index 8a77b07008..3e7c0ad4ab 100644 --- a/src/gui/text/qtextlayout.cpp +++ b/src/gui/text/qtextlayout.cpp @@ -1290,10 +1290,6 @@ void QTextLayout::drawCursor(QPainter *p, const QPointF &pos, int cursorPosition && (p->transform().type() > QTransform::TxTranslate); if (toggleAntialiasing) p->setRenderHint(QPainter::Antialiasing); -#ifdef Q_WS_MAC - // Always draw the cursor aligned to pixel boundary. - x = qRound(x); -#endif p->fillRect(QRectF(x, y, qreal(width), (base + descent + 1).toReal()), p->pen().brush()); if (toggleAntialiasing) p->setRenderHint(QPainter::Antialiasing, false); @@ -1899,9 +1895,7 @@ void QTextLine::layout_helper(int maxGlyphs) // expand the text beyond the edge. if (sb_or_ws|breakany) { QFixed rightBearing = lbh.rightBearing; // store previous right bearing -#if !defined(Q_WS_MAC) if (lbh.calculateNewWidth(line) - lbh.minimumRightBearing > line.width) -#endif lbh.adjustRightBearing(); if (lbh.checkFullOtherwiseExtend(line)) { // we are too wide, fix right bearing @@ -2123,15 +2117,7 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g fontD->fontEngine = fontEngine; fontD->thread = QThread::currentThread(); fontD->fontEngine->ref.ref(); - -#if defined(Q_WS_WIN) - if (fontEngine->supportsSubPixelPositions()) - fontD->hintingPreference = QFont::PreferVerticalHinting; - else - fontD->hintingPreference = QFont::PreferFullHinting; -#elif defined(Q_WS_MAC) - fontD->hintingPreference = QFont::PreferNoHinting; -#elif !defined(QT_NO_FREETYPE) +#if !defined(QT_NO_FREETYPE) if (fontEngine->type() == QFontEngine::Freetype) { QFontEngineFT *freeTypeEngine = static_cast(fontEngine); switch (freeTypeEngine->defaultHintStyle()) { @@ -2148,7 +2134,6 @@ static QGlyphRun glyphRunWithInfo(QFontEngine *fontEngine, const QGlyphLayout &g }; } #endif - QVarLengthArray glyphsArray; QVarLengthArray positionsArray; diff --git a/src/gui/util/qdesktopservices.cpp b/src/gui/util/qdesktopservices.cpp index 669f7ea893..7e8195afe9 100644 --- a/src/gui/util/qdesktopservices.cpp +++ b/src/gui/util/qdesktopservices.cpp @@ -45,17 +45,7 @@ #include -#if defined(Q_WS_QWS) || defined(Q_WS_QPA) #include "qdesktopservices_qpa.cpp" -#elif defined(Q_WS_X11) -#include "qdesktopservices_x11.cpp" -#elif defined(Q_WS_WIN) -#include "qdesktopservices_win.cpp" -#elif defined(Q_WS_MAC) -#include "qdesktopservices_mac.cpp" -#elif defined(Q_OS_SYMBIAN) -#include "qdesktopservices_s60.cpp" -#endif #include #include diff --git a/src/gui/util/qdesktopservices_s60.cpp b/src/gui/util/qdesktopservices_s60.cpp index 97d1226032..41fc0f3b3c 100644 --- a/src/gui/util/qdesktopservices_s60.cpp +++ b/src/gui/util/qdesktopservices_s60.cpp @@ -49,11 +49,6 @@ #include // PathInfo #ifndef USE_SCHEMEHANDLER -#ifdef Q_WS_S60 -// This flag changes the implementation to use S60 CDcoumentHandler -// instead of apparc when opening the files -#define USE_DOCUMENTHANDLER -#endif #include // CRichText #include // CEikonEnv diff --git a/src/gui/util/qdesktopservices_win.cpp b/src/gui/util/qdesktopservices_win.cpp index 6f447aae4b..b06b52e399 100644 --- a/src/gui/util/qdesktopservices_win.cpp +++ b/src/gui/util/qdesktopservices_win.cpp @@ -191,11 +191,7 @@ QString QDesktopServices::storageLocation(StandardLocation type) switch (type) { case DataLocation: -#if defined Q_WS_WINCE - if (SHGetSpecialFolderPath(0, path, CSIDL_APPDATA, FALSE)) -#else if (SHGetSpecialFolderPath(0, path, CSIDL_LOCAL_APPDATA, FALSE)) -#endif result = QString::fromWCharArray(path); if (!QCoreApplication::organizationName().isEmpty()) result = result + QLatin1String("\\") + QCoreApplication::organizationName(); -- cgit v1.2.3