From 94cedb692a1f6fbaae2ff0b96a7e50512ac6f215 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Fri, 14 Jan 2011 11:02:54 +0100 Subject: Free memory when disabling the unified toolbar. Reviewed-by: Richard Moe Gustavsen --- src/gui/widgets/qmainwindow.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/gui/widgets/qmainwindow.cpp b/src/gui/widgets/qmainwindow.cpp index da902d5..214cf05 100644 --- a/src/gui/widgets/qmainwindow.cpp +++ b/src/gui/widgets/qmainwindow.cpp @@ -1526,12 +1526,23 @@ void QMainWindow::setUnifiedTitleAndToolBarOnMac(bool set) #ifdef QT_MAC_USE_COCOA // Activate the unified toolbar with the raster engine. - if (windowSurface()) { + if (windowSurface() && set) { d->layout->unifiedSurface = new QUnifiedToolbarSurface(this); } #endif // QT_MAC_USE_COCOA d->layout->updateHIToolBarStatus(); + +#ifdef QT_MAC_USE_COCOA + // Deactivate the unified toolbar with the raster engine. + if (windowSurface() && !set) { + if (d->layout->unifiedSurface) { + delete d->layout->unifiedSurface; + d->layout->unifiedSurface = 0; + } + } +#endif // QT_MAC_USE_COCOA + // Enabling the unified toolbar clears the opaque size grip setting, update it. d->macUpdateOpaqueSizeGrip(); #else -- cgit v0.12 From 6482a5c5e272d79c312a5f5ef16ee2adf21f4504 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Tue, 18 Jan 2011 16:32:17 +0100 Subject: Add a utility function to call setNeedsDisplay: This allows to trigger a drawRect: on the NSView associated with a QWidget. Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qt_cocoa_helpers_mac.mm | 7 +++++++ src/gui/kernel/qt_cocoa_helpers_mac_p.h | 3 +++ 2 files changed, 10 insertions(+) diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 48d21e9..74d44a3 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -1590,6 +1590,13 @@ void qt_mac_display(QWidget *widget) return; } +void qt_mac_setneedsdisplay(QWidget *widget) +{ + NSView *theNSView = qt_mac_nativeview_for(widget); + [theNSView setNeedsDisplay:YES]; + return; +} + #endif // QT_MAC_USE_COCOA QT_END_NAMESPACE diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h index 04c2d06..25dcdc3 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h +++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h @@ -227,7 +227,10 @@ void qt_cocoaPostMessage(id target, SEL selector, int argCount=0, id arg1=0, id void qt_mac_post_retranslateAppMenu(); +#ifdef QT_MAC_USE_COCOA void qt_mac_display(QWidget *widget); +void qt_mac_setneedsdisplay(QWidget *widget); +#endif // QT_MAC_USE_COCOA QT_END_NAMESPACE -- cgit v0.12 From b595c2fbe0fa354190b713ef09dd1f348e22e2b6 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Fri, 21 Jan 2011 12:55:23 +0100 Subject: Set the graphics system name in the graphics system factory. This allows us to know which graphics system is in use at runtime. Reviewed-by: Jani Hautakangas --- src/gui/painting/qgraphicssystem_runtime.cpp | 1 - src/gui/painting/qgraphicssystemfactory.cpp | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp index a9fbbee..bd27e9d 100644 --- a/src/gui/painting/qgraphicssystem_runtime.cpp +++ b/src/gui/painting/qgraphicssystem_runtime.cpp @@ -322,7 +322,6 @@ QRuntimeGraphicsSystem::QRuntimeGraphicsSystem() : m_windowSurfaceDestroyPolicy(DestroyImmediately), m_graphicsSystem(0) { - QApplicationPrivate::graphics_system_name = QLatin1String("runtime"); QApplicationPrivate::runtime_graphics_system = true; #ifdef QT_DEFAULT_RUNTIME_SYSTEM diff --git a/src/gui/painting/qgraphicssystemfactory.cpp b/src/gui/painting/qgraphicssystemfactory.cpp index 3adeba4..1416f7c 100644 --- a/src/gui/painting/qgraphicssystemfactory.cpp +++ b/src/gui/painting/qgraphicssystemfactory.cpp @@ -45,6 +45,7 @@ #include "qmutex.h" #include "qapplication.h" +#include #include "qgraphicssystem_raster_p.h" #include "qgraphicssystem_runtime_p.h" #include "qdebug.h" @@ -79,6 +80,7 @@ QGraphicsSystem *QGraphicsSystemFactory::create(const QString& key) } #endif + QApplicationPrivate::graphics_system_name = system; if (system == QLatin1String("raster")) return new QRasterGraphicsSystem; else if (system == QLatin1String("runtime")) -- cgit v0.12 From f723903b6990655c12fb1747a816ed62b01e87c0 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Tue, 25 Jan 2011 14:50:17 +0100 Subject: Add utility functions for using Core Graphics contexts. These snippets are often used while managing Core Graphics contexts. Putting them in inlined functions makes code easier to read. Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qt_cocoa_helpers_mac_p.h | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h index 25dcdc3..b177210 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h +++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h @@ -232,6 +232,34 @@ void qt_mac_display(QWidget *widget); void qt_mac_setneedsdisplay(QWidget *widget); #endif // QT_MAC_USE_COCOA + +// Utility functions to ease the use of Core Graphics contexts. + +inline void qt_mac_retain_graphics_context(CGContextRef context) +{ + CGContextRetain(context); + CGContextSaveGState(context); +} + +inline void qt_mac_release_graphics_context(CGContextRef context) +{ + CGContextRestoreGState(context); + CGContextRelease(context); +} + +inline void qt_mac_draw_image(CGContextRef context, CGContextRef imageContext, CGRect area, CGRect drawingArea) +{ + CGImageRef image = CGBitmapContextCreateImage(imageContext); + CGImageRef subImage = CGImageCreateWithImageInRect(image, area); + + CGContextTranslateCTM (context, 0, drawingArea.origin.y + CGRectGetMaxY(drawingArea)); + CGContextScaleCTM(context, 1, -1); + CGContextDrawImage(context, drawingArea, subImage); + + CGImageRelease(subImage); + CGImageRelease(image); +} + QT_END_NAMESPACE #endif // QT_COCOA_HELPERS_MAC_P_H -- cgit v0.12 From 85b8631c2f30947e3c8364c903a4f85abb8f11e2 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Tue, 25 Jan 2011 15:07:51 +0100 Subject: Small typo fix. Reviewed-by: Eskil Abrahamsen Blomfeldt --- src/gui/kernel/qcocoaview_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index e02cf11..6059946 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -547,7 +547,7 @@ static int qCocoaViewCount = 0; } // Since we don't want to use the native engine, we must exit, however - // widgets that are set to paint on screen, spesifically QGLWidget, + // widgets that are set to paint on screen, specifically QGLWidget, // requires the following code to execute in order to be drawn. if (!qwidget->testAttribute(Qt::WA_PaintOnScreen)) return; -- cgit v0.12 From 26d25ab46900d84b44e451c2a0a986bfed94a3f4 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Tue, 25 Jan 2011 15:23:34 +0100 Subject: Move the flushing to [view drawRect:rect] Instead of flushing by grabbing the Core Graphics context, we do it directly in the drawRect: method. This approach allows us to call flush() many times and only proceed to flush when the system is ready. Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qcocoaview_mac.mm | 114 +++++++++++++++++++----- src/gui/kernel/qwidget.cpp | 1 + src/gui/kernel/qwidget_p.h | 5 +- src/gui/painting/qunifiedtoolbarsurface_mac.cpp | 71 +++------------ src/gui/painting/qunifiedtoolbarsurface_mac_p.h | 7 +- src/gui/painting/qwindowsurface_raster.cpp | 42 +++++---- src/gui/painting/qwindowsurface_raster_p.h | 11 +++ 7 files changed, 153 insertions(+), 98 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 6059946..e50c401 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -52,6 +52,8 @@ #include #include #include +#include +#include #include #include @@ -530,8 +532,86 @@ static int qCocoaViewCount = 0; if (!qwidget) return; + // Getting context. + CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; + qt_mac_retain_graphics_context(context); + // We use a different graphics system. - if (QApplicationPrivate::graphicsSystem() != 0 && !qwidgetprivate->isInUnifiedToolbar) { + if (QApplicationPrivate::graphicsSystem() != 0) { + + // Raster engine. + if (QApplicationPrivate::graphics_system_name == QLatin1String("raster")) { + + if (!qwidgetprivate->isInUnifiedToolbar) { + + // Qt handles the painting occuring inside the window. + // Cocoa also keeps track of all widgets as NSView and therefore might + // ask for a repainting of a widget even if Qt is already taking care of it. + // + // The only valid reason for Cocoa to call drawRect: is for window manipulation + // (ie. resize, ...). + // + // Qt will then forward the update to the children. + if (!qwidget->isWindow()) { + qt_mac_release_graphics_context(context); + return; + } + + QRasterWindowSurface *winSurface = dynamic_cast(qwidget->windowSurface()); + if (!winSurface || !winSurface->needsFlush) { + qt_mac_release_graphics_context(context); + return; + } + + // Clip to region. + const QVector &rects = winSurface->regionToFlush.rects(); + for (int i = 0; i < rects.size(); ++i) { + const QRect &rect = rects.at(i); + CGContextAddRect(context, CGRectMake(rect.x(), rect.y(), rect.width(), rect.height())); + } + CGContextClip(context); + + QRect r = winSurface->regionToFlush.boundingRect(); + const CGRect area = CGRectMake(r.x(), r.y(), r.width(), r.height()); + + qt_mac_draw_image(context, winSurface->imageContext(), area, area); + + winSurface->needsFlush = false; + winSurface->regionToFlush = QRegion(); + + } else { + + QUnifiedToolbarSurface *unifiedSurface = dynamic_cast(qwidgetprivate->unifiedSurface); + if (!unifiedSurface || !qwidgetprivate->flushRequested) { + qt_mac_release_graphics_context(context); + return; + } + + // We render the content of the toolbar in the surface. + unifiedSurface->updateToolbarOffset(qwidget); + QRect beginPaintRect(qwidgetprivate->toolbar_offset.x(), qwidgetprivate->toolbar_offset.y(), qwidget->geometry().width(), qwidget->geometry().height()); + QRegion beginPaintRegion(beginPaintRect); + + unifiedSurface->beginPaint(beginPaintRegion); + qwidget->render(unifiedSurface->paintDevice(), qwidgetprivate->toolbar_offset, QRegion(), QWidget::DrawChildren); + + int areaX = qwidgetprivate->toolbar_offset.x(); + int areaY = qwidgetprivate->toolbar_offset.y(); + int areaWidth = qwidget->geometry().width(); + int areaHeight = qwidget->geometry().height(); + const CGRect area = CGRectMake(areaX, areaY, areaWidth, areaHeight); + const CGRect drawingArea = CGRectMake(0, 0, areaWidth, areaHeight); + + qt_mac_draw_image(context, unifiedSurface->imageContext(), area, drawingArea); + + qwidgetprivate->flushRequested = false; + + } + + CGContextFlush(context); + qt_mac_release_graphics_context(context); + return; + } // Qt handles the painting occuring inside the window. // Cocoa also keeps track of all widgets as NSView and therefore might @@ -553,19 +633,8 @@ static int qCocoaViewCount = 0; return; } - CGContextRef cg = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort]; - CGContextRetain(cg); - qwidgetprivate->hd = cg; - - // We steal the CGContext for flushing in the unified toolbar with the raster engine. - if (QApplicationPrivate::graphicsSystem() != 0 && qwidgetprivate->isInUnifiedToolbar) { - qwidgetprivate->cgContext = cg; - qwidgetprivate->hasOwnContext = true; - qwidgetprivate->unifiedSurface->flush(qwidget, qwidgetprivate->ut_rg, qwidgetprivate->ut_pt); - return; - } - - CGContextSaveGState(cg); + // Native engine. + qwidgetprivate->hd = context; if (qwidget->isVisible() && qwidget->updatesEnabled()) { //process the actual paint event. if (qwidget->testAttribute(Qt::WA_WState_InPaintEvent)) @@ -600,18 +669,18 @@ static int qCocoaViewCount = 0; engine->setSystemClip(qrgn); if (qwidgetprivate->extra && qwidgetprivate->extra->hasMask) { CGRect widgetRect = CGRectMake(0, 0, qwidget->width(), qwidget->height()); - CGContextTranslateCTM (cg, 0, widgetRect.size.height); - CGContextScaleCTM(cg, 1, -1); + CGContextTranslateCTM (context, 0, widgetRect.size.height); + CGContextScaleCTM(context, 1, -1); if (qwidget->isWindow()) - CGContextClearRect(cg, widgetRect); - CGContextClipToMask(cg, widgetRect, qwidgetprivate->extra->imageMask); - CGContextScaleCTM(cg, 1, -1); - CGContextTranslateCTM (cg, 0, -widgetRect.size.height); + CGContextClearRect(context, widgetRect); + CGContextClipToMask(context, widgetRect, qwidgetprivate->extra->imageMask); + CGContextScaleCTM(context, 1, -1); + CGContextTranslateCTM (context, 0, -widgetRect.size.height); } if (qwidget->isWindow() && !qwidgetprivate->isOpaque && !qwidget->testAttribute(Qt::WA_MacBrushedMetal)) { - CGContextClearRect(cg, NSRectToCGRect(aRect)); + CGContextClearRect(context, NSRectToCGRect(aRect)); } // Check for alien widgets, use qwidgetPrivate->drawWidget() to draw the widget if this @@ -653,8 +722,7 @@ static int qCocoaViewCount = 0; " widget outside of the PaintEvent"); } qwidgetprivate->hd = 0; - CGContextRestoreGState(cg); - CGContextRelease(cg); + qt_mac_release_graphics_context(context); } - (BOOL)acceptsFirstMouse:(NSEvent *)theEvent diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 16f64ff..056aea6 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -324,6 +324,7 @@ QWidgetPrivate::QWidgetPrivate(int version) hasOwnContext = false; isInUnifiedToolbar = false; unifiedSurface = 0; + askedForFlush = false; #endif // QT_MAC_USE_COCOA #ifdef QWIDGET_EXTRA_DEBUG static int count = 0; diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 6b85391..f5a965c 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -852,13 +852,16 @@ public: // Do we need to change the methods? bool changeMethods; bool hasOwnContext; + + // Unified toolbar variables CGContextRef cgContext; QRegion ut_rg; QPoint ut_pt; bool isInUnifiedToolbar; QWindowSurface *unifiedSurface; QPoint toolbar_offset; -#endif + bool askedForFlush; +#endif // QT_MAC_USE_COCOA void determineWindowClass(); void transferChildren(); bool qt_mac_dnd_event(uint, DragRef); diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp index 02ba8db..38dc632 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp +++ b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp @@ -92,6 +92,11 @@ void QUnifiedToolbarSurface::recursiveRedirect(QObject *object, const QPoint &of } } +void QUnifiedToolbarSurface::updateRedirection(QWidget *widget) +{ + recursiveRedirect(widget, widget->d_func()->toolbar_offset); +} + void QUnifiedToolbarSurface::insertToolbar(QWidget *toolbar, const QPoint &offset) { setGeometry(QRect(QPoint(0, 0), QSize(offset.x() + toolbar->width(), 100))); // FIXME @@ -130,67 +135,13 @@ void QUnifiedToolbarSurface::updateToolbarOffset(QWidget *widget) void QUnifiedToolbarSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &offset) { Q_D(QUnifiedToolbarSurface); - - QRegion flushingRegion(widget->rect()); - - if (!d->image || rgn.rectCount() == 0) { - return; - } - Q_UNUSED(offset); - // Get a context for the widget. - CGContextRef context; - if (!(widget->d_func()->hasOwnContext)) { - widget->d_func()->ut_rg = rgn; - widget->d_func()->ut_pt = offset; - qt_mac_display(widget); + if (!d->image || rgn.rectCount() == 0) return; - } else { - // We render the content of the toolbar in the surface. - updateToolbarOffset(widget); - QRect beginPaintRect(widget->d_func()->toolbar_offset.x(), widget->d_func()->toolbar_offset.y(), widget->geometry().width(), widget->geometry().height()); - QRegion beginPaintRegion(beginPaintRect); - - context = widget->d_func()->cgContext; - beginPaint(beginPaintRegion); - widget->render(widget->d_func()->unifiedSurface->paintDevice(), widget->d_func()->toolbar_offset, QRegion(), QWidget::DrawChildren); - } - - CGContextSaveGState(context); - - int areaX = widget->d_func()->toolbar_offset.x(); - int areaY = widget->d_func()->toolbar_offset.y(); - int areaWidth = widget->geometry().width(); - int areaHeight = widget->geometry().height(); - const CGRect area = CGRectMake(areaX, areaY, areaWidth, areaHeight); - // Clip to region. - const QVector &rects = flushingRegion.rects(); - for (int i = 0; i < rects.size(); ++i) { - const QRect &rect = rects.at(i); - CGContextAddRect(context, CGRectMake(rect.x(), rect.y(), rect.width(), rect.height())); - } - CGContextAddRect(context, area); - CGContextClip(context); - - - CGImageRef image = CGBitmapContextCreateImage(d->image->cg); - CGImageRef subImage = CGImageCreateWithImageInRect(image, area); - - const CGRect drawingArea = CGRectMake(0, 0, areaWidth, areaHeight); - qt_mac_drawCGImage(context, &drawingArea, subImage); - - CGImageRelease(subImage); - CGImageRelease(image); - - CGContextFlush(context); - - // Restore context. - CGContextRestoreGState(context); - CGContextRelease(context); - widget->d_func()->cgContext = 0; - widget->d_func()->hasOwnContext = false; + widget->d_func()->askedForFlush = true; + qt_mac_setneedsdisplay(widget); } void QUnifiedToolbarSurface::prepareBuffer(QImage::Format format, QWidget *widget) @@ -254,6 +205,12 @@ void QUnifiedToolbarSurface::prepareBuffer(QImage::Format format, QWidget *widge delete oldImage; } +CGContextRef QUnifiedToolbarSurface::imageContext() +{ + Q_D(QUnifiedToolbarSurface); + return d->image->cg; +} + QT_END_NAMESPACE #endif // QT_MAC_USE_COCOA diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h index 3bc0404..6e40a17 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h +++ b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h @@ -82,10 +82,13 @@ public: void setGeometry(const QRect &rect); void beginPaint(const QRegion &rgn); void insertToolbar(QWidget *toolbar, const QPoint &offset); + void updateRedirection(QWidget *widget); + void updateToolbarOffset(QWidget *widget); -private: QPaintDevice *paintDevice(); - void updateToolbarOffset(QWidget *widget); + CGContextRef imageContext(); + +private: void prepareBuffer(QImage::Format format, QWidget *widget); void recursiveRedirect(QObject *widget, const QPoint &offset); diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index 2b4e125..92e9425 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -98,6 +98,11 @@ QRasterWindowSurface::QRasterWindowSurface(QWidget *window, bool setDefaultSurfa d_ptr->image = 0; d_ptr->inSetGeometry = false; setStaticContentsSupport(true); + +#ifdef QT_MAC_USE_COCOA + needsFlush = false; + regionToFlush = QRegion(); +#endif // QT_MAC_USE_COCOA } @@ -251,13 +256,23 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi #ifdef Q_WS_MAC + Q_UNUSED(offset); + // This is mainly done for native components like native "open file" dialog. if (widget->testAttribute(Qt::WA_DontShowOnScreen)) { return; } #ifdef QT_MAC_USE_COCOA + this->needsFlush = true; + this->regionToFlush += rgn; + + // The actual flushing will be processed in [view drawRect:rect] + qt_mac_setneedsdisplay(widget); + // Unified toolbar hack. + // We issue a flush call for each QToolBar so they get repainted right after + // the main window. QMainWindow* mWindow = qobject_cast(widget->window()); if (mWindow) { QMainWindowLayout *mLayout = qobject_cast(mWindow->layout()); @@ -267,24 +282,17 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi QToolBar* toolbar = toolbarList.at(i); if (mLayout->toolBarArea(toolbar) == Qt::TopToolBarArea) { QWidget* tbWidget = (QWidget*) toolbar; - if (tbWidget->d_func()->unifiedSurface) { + if (tbWidget->d_func()->unifiedSurface) tbWidget->d_func()->unifiedSurface->flush(tbWidget, rgn, offset); - } } } } -#endif // QT_MAC_USE_COCOA - - Q_UNUSED(offset); +#else // Get a context for the widget. -#ifndef QT_MAC_USE_COCOA CGContextRef context; CGrafPtr port = GetWindowPort(qt_mac_window_for(widget)); QDBeginCGContext(port, &context); -#else - extern CGContextRef qt_mac_graphicsContextFor(QWidget *); - CGContextRef context = qt_mac_graphicsContextFor(widget); -#endif + CGContextRetain(context); CGContextSaveGState(context); @@ -310,16 +318,12 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi CGImageRelease(subImage); CGImageRelease(image); -#ifndef QT_MAC_USE_COCOA QDEndCGContext(port, &context); -#else - CGContextFlush(context); -#endif // Restore context. CGContextRestoreGState(context); CGContextRelease(context); - +#endif // QT_MAC_USE_COCOA #endif // Q_WS_MAC @@ -461,4 +465,12 @@ void QRasterWindowSurface::prepareBuffer(QImage::Format format, QWidget *widget) delete oldImage; } +#ifdef QT_MAC_USE_COCOA +CGContextRef QRasterWindowSurface::imageContext() +{ + Q_D(QRasterWindowSurface); + return d->image->cg; +} +#endif // QT_MAC_USE_COCOA + QT_END_NAMESPACE diff --git a/src/gui/painting/qwindowsurface_raster_p.h b/src/gui/painting/qwindowsurface_raster_p.h index a7c3b9f..4674fa0 100644 --- a/src/gui/painting/qwindowsurface_raster_p.h +++ b/src/gui/painting/qwindowsurface_raster_p.h @@ -56,6 +56,10 @@ #include #include "private/qwindowsurface_p.h" +#ifdef QT_MAC_USE_COCOA +# include +#endif // QT_MAC_USE_COCOA + QT_BEGIN_NAMESPACE #ifdef Q_WS_WIN @@ -106,6 +110,13 @@ public: void setGeometry(const QRect &rect); bool scroll(const QRegion &area, int dx, int dy); +#ifdef QT_MAC_USE_COCOA + CGContextRef imageContext(); + + bool needsFlush; + QRegion regionToFlush; +#endif // QT_MAC_USE_COCOA + private: void prepareBuffer(QImage::Format format, QWidget *widget); Q_DECLARE_PRIVATE(QRasterWindowSurface) -- cgit v0.12 From e1a1ff63d3078b01045a526a54d923ac0bae1032 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Wed, 26 Jan 2011 12:43:02 +0100 Subject: Change variable name. Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qwidget.cpp | 2 +- src/gui/kernel/qwidget_p.h | 2 +- src/gui/painting/qunifiedtoolbarsurface_mac.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 056aea6..88348cd 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -324,7 +324,7 @@ QWidgetPrivate::QWidgetPrivate(int version) hasOwnContext = false; isInUnifiedToolbar = false; unifiedSurface = 0; - askedForFlush = false; + flushRequested = false; #endif // QT_MAC_USE_COCOA #ifdef QWIDGET_EXTRA_DEBUG static int count = 0; diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index f5a965c..4e91358 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -860,7 +860,7 @@ public: bool isInUnifiedToolbar; QWindowSurface *unifiedSurface; QPoint toolbar_offset; - bool askedForFlush; + bool flushRequested; #endif // QT_MAC_USE_COCOA void determineWindowClass(); void transferChildren(); diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp index 38dc632..4c027f8 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp +++ b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp @@ -140,7 +140,7 @@ void QUnifiedToolbarSurface::flush(QWidget *widget, const QRegion &rgn, const QP if (!d->image || rgn.rectCount() == 0) return; - widget->d_func()->askedForFlush = true; + widget->d_func()->flushRequested = true; qt_mac_setneedsdisplay(widget); } -- cgit v0.12 From c710993bc1653e85f598ea099de2eb23904f0bcf Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Wed, 26 Jan 2011 16:17:13 +0100 Subject: Remove useless displayIfNeeded: definition. This is no longer needed for the raster engine. We don't need to sync the backing store this way. Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qcocoasharedwindowmethods_mac_p.h | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h index 60cdfb9..0150e75 100644 --- a/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h +++ b/src/gui/kernel/qcocoasharedwindowmethods_mac_p.h @@ -346,22 +346,6 @@ QT_END_NAMESPACE return dropResult; } -- (void)displayIfNeeded -{ - - QWidget *qwidget = [[QT_MANGLE_NAMESPACE(QCocoaWindowDelegate) sharedDelegate] qt_qwidgetForWindow:self]; - if (qwidget == 0) { - [super displayIfNeeded]; - return; - } - - if (QApplicationPrivate::graphicsSystem() != 0) { - if (QWidgetBackingStore *bs = qt_widget_private(qwidget)->maybeBackingStore()) - bs->sync(qwidget, qwidget->rect()); - } - [super displayIfNeeded]; -} - // This is a hack and it should be removed once we find the real cause for // the painting problems. // We have a static variable that signals if we have been called before or not. -- cgit v0.12 From e10a438a90b369c894b5f39cc1ab61ae68ff200c Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Wed, 26 Jan 2011 16:29:28 +0100 Subject: Force the display: in the unified toolbar. Instead of calling setNeedsDisplay:, we call have to call display: to avoid flickering. Reviewed-by: Richard Moe Gustavsen --- src/gui/painting/qunifiedtoolbarsurface_mac.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp index 4c027f8..5f52679 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp +++ b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp @@ -141,7 +141,9 @@ void QUnifiedToolbarSurface::flush(QWidget *widget, const QRegion &rgn, const QP return; widget->d_func()->flushRequested = true; - qt_mac_setneedsdisplay(widget); + + // We call display: directly to avoid flickering in the toolbar. + qt_mac_display(widget); } void QUnifiedToolbarSurface::prepareBuffer(QImage::Format format, QWidget *widget) -- cgit v0.12 From b0d682080023dc07e912bf273d007306e758dd01 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Thu, 27 Jan 2011 10:24:02 +0100 Subject: Move all display: utility functions. All utility functions to call display: are now placed in qt_cocoa_helpers_mac.mm Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qt_cocoa_helpers_mac.mm | 19 ++++++++++++++++++- src/gui/kernel/qt_cocoa_helpers_mac_p.h | 3 ++- src/gui/kernel/qwidget_mac.mm | 23 ++--------------------- src/gui/painting/qwindowsurface_raster.cpp | 2 +- 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 74d44a3..71f59e3 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -1590,13 +1590,30 @@ void qt_mac_display(QWidget *widget) return; } -void qt_mac_setneedsdisplay(QWidget *widget) +void qt_mac_setNeedsDisplay(QWidget *widget) { NSView *theNSView = qt_mac_nativeview_for(widget); [theNSView setNeedsDisplay:YES]; return; } +void qt_mac_setNeedsDisplayInRect(QWidget *widget, QRegion region) +{ + NSView *theNSView = qt_mac_nativeview_for(widget); + if (region.isEmpty()) { + [theNSView setNeedsDisplay:YES]; + return; + } + + QVector rects = region.rects(); + for (int i = 0; i < rects.count(); ++i) { + const QRect &rect = rects.at(i); + NSRect nsrect = NSMakeRect(rect.x(), rect.y(), rect.width(), rect.height()); + [theNSView setNeedsDisplayInRect:nsrect]; + } + +} + #endif // QT_MAC_USE_COCOA QT_END_NAMESPACE diff --git a/src/gui/kernel/qt_cocoa_helpers_mac_p.h b/src/gui/kernel/qt_cocoa_helpers_mac_p.h index b177210..a80c2e1 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac_p.h +++ b/src/gui/kernel/qt_cocoa_helpers_mac_p.h @@ -229,7 +229,8 @@ void qt_mac_post_retranslateAppMenu(); #ifdef QT_MAC_USE_COCOA void qt_mac_display(QWidget *widget); -void qt_mac_setneedsdisplay(QWidget *widget); +void qt_mac_setNeedsDisplay(QWidget *widget); +void qt_mac_setNeedsDisplayInRect(QWidget *widget, QRegion region); #endif // QT_MAC_USE_COCOA diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 3c5c458..83483f5 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -580,25 +580,6 @@ inline static void qt_mac_set_window_group_to_popup(OSWindowRef window) } #endif -#ifdef QT_MAC_USE_COCOA -void qt_mac_set_needs_display(QWidget *widget, QRegion region) -{ - NSView *theNSView = qt_mac_nativeview_for(widget); - if (region.isEmpty()) { - [theNSView setNeedsDisplay:YES]; - return; - } - - QVector rects = region.rects(); - for (int i = 0; iimageMask == 0)]; [window invalidateShadow]; } - qt_mac_set_needs_display(q, QRegion()); + qt_mac_setNeedsDisplayInRect(q, QRegion()); } #endif diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index 92e9425..8e09c58 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -268,7 +268,7 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi this->regionToFlush += rgn; // The actual flushing will be processed in [view drawRect:rect] - qt_mac_setneedsdisplay(widget); + qt_mac_setNeedsDisplay(widget); // Unified toolbar hack. // We issue a flush call for each QToolBar so they get repainted right after -- cgit v0.12 From c8684662c20deacb791afb4ae3169af997793c2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 27 Jan 2011 12:36:20 +0100 Subject: Only const_cast can remove const :) --- src/plugins/platforms/testlite/qtestliteintegration.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp index 9b641d1..dc8a6d7 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteintegration.cpp @@ -140,7 +140,7 @@ bool QTestLiteIntegration::hasOpenGL() const static bool wasEglInitialized = false; if (!eglHasbeenInitialized) { eglHasbeenInitialized = true; - QTestLiteScreen *screen = static_cast(mScreens.at(0)); + const QTestLiteScreen *screen = static_cast(mScreens.at(0)); EGLint major, minor; eglBindAPI(EGL_OPENGL_ES_API); EGLDisplay disp = eglGetDisplay(screen->display()); -- cgit v0.12 From a98c8058e76e8e0418e16a0cbc4b700e81cdcd3d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 27 Jan 2011 12:36:51 +0100 Subject: Remove unneeded include --- src/plugins/platforms/wayland/qwaylandglcontext.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandglcontext.cpp b/src/plugins/platforms/wayland/qwaylandglcontext.cpp index 4bf68c4..23631d9 100644 --- a/src/plugins/platforms/wayland/qwaylandglcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandglcontext.cpp @@ -51,11 +51,7 @@ #include #include -extern "C" { -#include -} - -Q_GLOBAL_STATIC(QMutex,qt_defaultSharedContextMutex); +Q_GLOBAL_STATIC(QMutex,qt_defaultSharedContextMutex) EGLint QWaylandGLContext::contextAttibutes[] = { EGL_CONTEXT_CLIENT_VERSION, 2, -- cgit v0.12 From dbb0f9bfbe98dfd789948ed65fe906b3c2b757f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 27 Jan 2011 15:21:28 +0100 Subject: Precision specifiers are not allowed for shader variables Reviewed-by: sroedal --- .../gl2paintengineex/qglengineshadersource_p.h | 28 +++++++++++----------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/src/opengl/gl2paintengineex/qglengineshadersource_p.h b/src/opengl/gl2paintengineex/qglengineshadersource_p.h index 1aacc96..fc8b9ef 100644 --- a/src/opengl/gl2paintengineex/qglengineshadersource_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadersource_p.h @@ -148,7 +148,7 @@ static const char* const qglslAffinePositionWithPatternBrushVertexShader = qglslPositionWithPatternBrushVertexShader; static const char* const qglslPatternBrushSrcFragmentShader = "\n\ - uniform lowp sampler2D brushTexture; \n\ + uniform sampler2D brushTexture; \n\ uniform lowp vec4 patternColor; \n\ varying highp vec2 patternTexCoords;\n\ lowp vec4 srcPixel() \n\ @@ -183,7 +183,7 @@ static const char* const qglslAffinePositionWithLinearGradientBrushVertexShader = qglslPositionWithLinearGradientBrushVertexShader; static const char* const qglslLinearGradientBrushSrcFragmentShader = "\n\ - uniform lowp sampler2D brushTexture; \n\ + uniform sampler2D brushTexture; \n\ varying mediump float index; \n\ lowp vec4 srcPixel() \n\ { \n\ @@ -218,7 +218,7 @@ static const char* const qglslAffinePositionWithConicalGradientBrushVertexShader static const char* const qglslConicalGradientBrushSrcFragmentShader = "\n\ #define INVERSE_2PI 0.1591549430918953358 \n\ - uniform lowp sampler2D brushTexture; \n\ + uniform sampler2D brushTexture; \n\ uniform mediump float angle; \n\ varying highp vec2 A; \n\ lowp vec4 srcPixel() \n\ @@ -260,7 +260,7 @@ static const char* const qglslAffinePositionWithRadialGradientBrushVertexShader = qglslPositionWithRadialGradientBrushVertexShader; static const char* const qglslRadialGradientBrushSrcFragmentShader = "\n\ - uniform lowp sampler2D brushTexture; \n\ + uniform sampler2D brushTexture; \n\ uniform highp float fmp2_m_radius2; \n\ uniform highp float inverse_2_fmp2_m_radius2; \n\ varying highp float b; \n\ @@ -304,14 +304,14 @@ static const char* const qglslAffinePositionWithTextureBrushVertexShader // TODO: Special case POT textures which don't need this emulation static const char* const qglslTextureBrushSrcFragmentShader = "\n\ varying highp vec2 brushTextureCoords; \n\ - uniform lowp sampler2D brushTexture; \n\ + uniform sampler2D brushTexture; \n\ lowp vec4 srcPixel() { \n\ return texture2D(brushTexture, fract(brushTextureCoords)); \n\ }\n"; #else static const char* const qglslTextureBrushSrcFragmentShader = "\n\ varying highp vec2 brushTextureCoords; \n\ - uniform lowp sampler2D brushTexture; \n\ + uniform sampler2D brushTexture; \n\ lowp vec4 srcPixel() \n\ { \n\ return texture2D(brushTexture, brushTextureCoords); \n\ @@ -321,7 +321,7 @@ static const char* const qglslTextureBrushSrcFragmentShader = "\n\ static const char* const qglslTextureBrushSrcWithPatternFragmentShader = "\n\ varying highp vec2 brushTextureCoords; \n\ uniform lowp vec4 patternColor; \n\ - uniform lowp sampler2D brushTexture; \n\ + uniform sampler2D brushTexture; \n\ lowp vec4 srcPixel() \n\ { \n\ return patternColor * (1.0 - texture2D(brushTexture, brushTextureCoords).r); \n\ @@ -337,7 +337,7 @@ static const char* const qglslSolidBrushSrcFragmentShader = "\n\ static const char* const qglslImageSrcFragmentShader = "\n\ varying highp vec2 textureCoords; \n\ - uniform lowp sampler2D imageTexture; \n\ + uniform sampler2D imageTexture; \n\ lowp vec4 srcPixel() \n\ { \n" "return texture2D(imageTexture, textureCoords); \n" @@ -345,7 +345,7 @@ static const char* const qglslImageSrcFragmentShader = "\n\ static const char* const qglslCustomSrcFragmentShader = "\n\ varying highp vec2 textureCoords; \n\ - uniform lowp sampler2D imageTexture; \n\ + uniform sampler2D imageTexture; \n\ lowp vec4 srcPixel() \n\ { \n\ return customShader(imageTexture, textureCoords); \n\ @@ -354,7 +354,7 @@ static const char* const qglslCustomSrcFragmentShader = "\n\ static const char* const qglslImageSrcWithPatternFragmentShader = "\n\ varying highp vec2 textureCoords; \n\ uniform lowp vec4 patternColor; \n\ - uniform lowp sampler2D imageTexture; \n\ + uniform sampler2D imageTexture; \n\ lowp vec4 srcPixel() \n\ { \n\ return patternColor * (1.0 - texture2D(imageTexture, textureCoords).r); \n\ @@ -362,7 +362,7 @@ static const char* const qglslImageSrcWithPatternFragmentShader = "\n\ static const char* const qglslNonPremultipliedImageSrcFragmentShader = "\n\ varying highp vec2 textureCoords; \n\ - uniform lowp sampler2D imageTexture; \n\ + uniform sampler2D imageTexture; \n\ lowp vec4 srcPixel() \n\ { \n\ lowp vec4 sample = texture2D(imageTexture, textureCoords); \n\ @@ -454,7 +454,7 @@ static const char* const qglslMainFragmentShader = "\n\ static const char* const qglslMaskFragmentShader = "\n\ varying highp vec2 textureCoords;\n\ - uniform lowp sampler2D maskTexture;\n\ + uniform sampler2D maskTexture;\n\ lowp vec4 applyMask(lowp vec4 src) \n\ {\n\ lowp vec4 mask = texture2D(maskTexture, textureCoords); \n\ @@ -478,7 +478,7 @@ static const char* const qglslMaskFragmentShader = "\n\ static const char* const qglslRgbMaskFragmentShaderPass1 = "\n\ varying highp vec2 textureCoords;\n\ - uniform lowp sampler2D maskTexture;\n\ + uniform sampler2D maskTexture;\n\ lowp vec4 applyMask(lowp vec4 src) \n\ { \n\ lowp vec4 mask = texture2D(maskTexture, textureCoords); \n\ @@ -487,7 +487,7 @@ static const char* const qglslRgbMaskFragmentShaderPass1 = "\n\ static const char* const qglslRgbMaskFragmentShaderPass2 = "\n\ varying highp vec2 textureCoords;\n\ - uniform lowp sampler2D maskTexture;\n\ + uniform sampler2D maskTexture;\n\ lowp vec4 applyMask(lowp vec4 src) \n\ { \n\ lowp vec4 mask = texture2D(maskTexture, textureCoords); \n\ -- cgit v0.12 From 2ab07dd167e05fe60525fde9b7b180738e431b9d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 27 Jan 2011 15:25:00 +0100 Subject: Lighthouse: Wayland plugin. Only create depth and stencil buffers once --- src/plugins/platforms/wayland/qwaylandcursor.cpp | 2 +- src/plugins/platforms/wayland/qwaylanddrmsurface.cpp | 16 ++++++++-------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 29c6abd..f51281d 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -48,7 +48,7 @@ #include -#define DATADIR "/home/jlind/install/share" +#define DATADIR "/usr/share" static const struct pointer_image { const char *filename; diff --git a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp index 76c8c33..603c018 100644 --- a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp @@ -77,7 +77,6 @@ QWaylandDrmBuffer::QWaylandDrmBuffer(QWaylandDisplay *display, mImage = eglCreateDRMImageMESA(mDisplay->eglDisplay(), imageAttribs); - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, mImage); glGenTextures(1, &mTexture); glBindTexture(GL_TEXTURE_2D, mTexture); glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, mImage); @@ -112,7 +111,6 @@ QWaylandDrmBuffer::~QWaylandDrmBuffer(void) void QWaylandDrmBuffer::bindToCurrentFbo() { Q_ASSERT(QPlatformGLContext::currentContext()); - glBindTexture(GL_TEXTURE_2D, mTexture); glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, mTexture, 0); QT_CHECK_GLERROR(); @@ -135,6 +133,13 @@ QWaylandPaintDevice::QWaylandPaintDevice(QWaylandDisplay *display, QWindowSurfac glGenFramebuffers(1, &m_thisFBO); glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_thisFBO); + glGenRenderbuffers(1, &mDepthStencil); + glBindRenderbuffer(GL_RENDERBUFFER_EXT, mDepthStencil); + glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, + GL_RENDERBUFFER_EXT, mDepthStencil); + glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, + GL_RENDERBUFFER_EXT, mDepthStencil); + if (windowSurface->size().isValid()) resize(windowSurface->size()); } @@ -184,15 +189,9 @@ void QWaylandPaintDevice::resize(const QSize &size) } } - glDeleteRenderbuffers(1,&mDepthStencil); - glGenRenderbuffers(1,&mDepthStencil); glBindRenderbuffer(GL_RENDERBUFFER_EXT,mDepthStencil); glRenderbufferStorage(GL_RENDERBUFFER_EXT, GL_DEPTH24_STENCIL8_EXT, size.width(), size.height()); - glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, mDepthStencil); - glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, mDepthStencil); GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER_EXT); @@ -247,6 +246,7 @@ void QWaylandDrmWindowSurface::flush(QWidget *widget, const QRegion ®ion, con Q_UNUSED(offset); QWaylandWindow *ww = (QWaylandWindow *) widget->platformWindow(); + glFlush(); ww->attach(mPaintDevice->currentDrmBufferAndSwap()); QVector rects = region.rects(); -- cgit v0.12 From 0b1b6859e7127cd68c262e240e305df03a9e0ef5 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Fri, 28 Jan 2011 15:19:33 +0100 Subject: Disable subtractOpaqueSiblings when in the unified toolbar. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the items in the unified toolbar have non-relevant positions and can't be overshadowed by another widget, we always paint them. Reviewed-by: Samuel Rødal --- src/gui/kernel/qwidget.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 88348cd..04bc2fb 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -2075,7 +2075,7 @@ void QWidgetPrivate::subtractOpaqueSiblings(QRegion &sourceRegion, bool *hasDirt { Q_Q(const QWidget); static int disableSubtractOpaqueSiblings = qgetenv("QT_NO_SUBTRACTOPAQUESIBLINGS").toInt(); - if (disableSubtractOpaqueSiblings || q->isWindow()) + if (disableSubtractOpaqueSiblings || q->isWindow() || q->d_func()->isInUnifiedToolbar) return; QRect clipBoundingRect; -- cgit v0.12 From 5aa2ea5ef204caee97de1b9ea6533a5382075147 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Mon, 31 Jan 2011 13:42:38 +0100 Subject: Remove useless variables. Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qwidget_p.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 4e91358..921cf03 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -854,9 +854,6 @@ public: bool hasOwnContext; // Unified toolbar variables - CGContextRef cgContext; - QRegion ut_rg; - QPoint ut_pt; bool isInUnifiedToolbar; QWindowSurface *unifiedSurface; QPoint toolbar_offset; -- cgit v0.12 From b3a8877f54bbd60a4f54439f5d551e1dfec7a9a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Thu, 27 Jan 2011 13:52:40 -0500 Subject: wayland: Handle keyboard focus correctly Activate the window widget and update modifiers. --- src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 03edc07..102a213 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -282,19 +282,28 @@ void QWaylandInputDevice::inputHandleKeyboardFocus(void *data, { Q_UNUSED(input_device); Q_UNUSED(time); - Q_UNUSED(keys); QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data; QWaylandWindow *window; - - if (inputDevice->mKeyboardFocus) { - window = inputDevice->mKeyboardFocus; - inputDevice->mKeyboardFocus = NULL; + uint32_t *k, *end; + uint32_t code; + + end = (uint32_t *) ((char *) keys->data + keys->size); + inputDevice->mModifiers = 0; + for (k = (uint32_t *) keys->data; k < end; k++) { + code = *k + inputDevice->mXkb->min_key_code; + inputDevice->mModifiers |= + translateModifiers(inputDevice->mXkb->map->modmap[code]); } if (surface) { window = (QWaylandWindow *) wl_surface_get_user_data(surface); inputDevice->mKeyboardFocus = window; + QWindowSystemInterface::handleWindowActivated(window->widget()); + } else { + inputDevice->mKeyboardFocus = NULL; + QWindowSystemInterface::handleWindowActivated(0); } + } const struct wl_input_device_listener QWaylandInputDevice::inputDeviceListener = { -- cgit v0.12 From 7386d37ae301092a3eecc9a3bf94dfd42509f666 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 28 Jan 2011 08:38:10 +0100 Subject: Lighthouse: Wayland, if we don't have cursors installed or the configuration is faulty, then don't change cursors --- src/plugins/platforms/wayland/qwaylandcursor.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index f51281d..0ad0702 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -164,6 +164,9 @@ void QWaylandCursor::changeCursor(QCursor *cursor, QWidget *widget) QImageReader reader(p->filename); + if (!reader.canRead()) + return; + if (mBuffer == NULL || mBuffer->size() != reader.size()) { if (mBuffer) delete mBuffer; -- cgit v0.12 From 6d3b5e1cdb3858ab8fe650493bf36a2b5260da1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristian=20H=C3=B8gsberg?= Date: Sat, 5 Feb 2011 09:20:19 -0500 Subject: wayland: Use wayland-egl instead of drm specific code --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 116 +++------------------ src/plugins/platforms/wayland/qwaylanddisplay.h | 11 +- .../platforms/wayland/qwaylanddrmsurface.cpp | 40 +++---- src/plugins/platforms/wayland/qwaylanddrmsurface.h | 1 + src/plugins/platforms/wayland/wayland.pro | 2 +- 5 files changed, 38 insertions(+), 132 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 70713ec..2e30c2f 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -50,9 +50,7 @@ #include #include -extern "C" { -#include -} +#include struct wl_surface *QWaylandDisplay::createSurface() { @@ -67,14 +65,6 @@ struct wl_buffer *QWaylandDisplay::createShmBuffer(int fd, return wl_shm_create_buffer(mShm, fd, width, height, stride, visual); } -struct wl_buffer *QWaylandDisplay::createDrmBuffer(int name, - int width, int height, - uint32_t stride, - struct wl_visual *visual) -{ - return wl_drm_create_buffer(mDrm, name, width, height, stride, visual); -} - struct wl_visual *QWaylandDisplay::rgbVisual() { return wl_display_get_rgb_visual(mDisplay); @@ -90,62 +80,11 @@ struct wl_visual *QWaylandDisplay::argbPremultipliedVisual() return wl_display_get_premultiplied_argb_visual(mDisplay); } -void QWaylandDisplay::drmHandleDevice(void *data, - struct wl_drm *drm, const char *device) +struct wl_egl_display *QWaylandDisplay::nativeDisplay() { - Q_UNUSED(drm); - QWaylandDisplay *qwd = (QWaylandDisplay *) data; - drm_magic_t magic; - - qwd->mDeviceName = strdup(device); - - qwd->mFd = open(qwd->mDeviceName, O_RDWR); - if (qwd->mFd < 0) { - qWarning("drm open failed: %m"); - return; - } - - if (drmGetMagic(qwd->mFd, &magic)) { - qWarning("DRI2: failed to get drm magic"); - return; - } - - wl_drm_authenticate(qwd->mDrm, magic); + return mNativeEglDisplay; } -void QWaylandDisplay::drmHandleAuthenticated(void *data, struct wl_drm *drm) -{ - Q_UNUSED(drm); - QWaylandDisplay *qwd = (QWaylandDisplay *) data; - EGLint major, minor; - const char *extensions; - - qwd->mEglDisplay = eglGetDRMDisplayMESA(qwd->mFd); - if (qwd->mEglDisplay == NULL) { - qWarning("failed to create display"); - return; - } - - if (!eglInitialize(qwd->mEglDisplay, &major, &minor)) { - qWarning("failed to initialize display"); - qwd->mEglDisplay = NULL; - return; - } - - extensions = eglQueryString(qwd->mEglDisplay, EGL_EXTENSIONS); - if (!strstr(extensions, "EGL_KHR_surfaceless_gles2")) { - qWarning("EGL_KHR_surfaceless_opengles2 not available"); - eglTerminate(qwd->mEglDisplay); - qwd->mEglDisplay = NULL; - return; - } -} - -const struct wl_drm_listener QWaylandDisplay::drmListener = { - QWaylandDisplay::drmHandleDevice, - QWaylandDisplay::drmHandleAuthenticated -}; - void QWaylandDisplay::shellHandleConfigure(void *data, struct wl_shell *shell, uint32_t time, uint32_t edges, struct wl_surface *surface, @@ -189,9 +128,6 @@ void QWaylandDisplay::displayHandleGlobal(struct wl_display *display, if (strcmp(interface, "compositor") == 0) { qwd->mCompositor = wl_compositor_create(display, id); - } else if (strcmp(interface, "drm") == 0) { - qwd->mDrm = wl_drm_create(display, id); - wl_drm_add_listener(qwd->mDrm, &drmListener, qwd); } else if (strcmp(interface, "shm") == 0) { qwd->mShm = wl_shm_create(display, id); } else if (strcmp(interface, "shell") == 0) { @@ -207,26 +143,6 @@ void QWaylandDisplay::displayHandleGlobal(struct wl_display *display, } } -static void roundtripCallback(void *data) -{ - bool *done = (bool *) data; - - *done = true; -} - -static void forceRoundtrip(struct wl_display *display) -{ - bool done; - - wl_display_sync_callback(display, roundtripCallback, &done); - wl_display_iterate(display, WL_DISPLAY_WRITABLE); - done = false; - while (!done) - wl_display_iterate(display, WL_DISPLAY_READABLE); -} - -static const char *socket_name = NULL; - void QWaylandDisplay::eventDispatcher(void) { wl_display_iterate(mDisplay, WL_DISPLAY_READABLE); @@ -257,7 +173,9 @@ void QWaylandDisplay::flushRequests(void) QWaylandDisplay::QWaylandDisplay(void) : mWriteNotifier(0) { - mDisplay = wl_display_connect(socket_name); + EGLint major, minor; + + mDisplay = wl_display_connect(NULL); if (mDisplay == NULL) { fprintf(stderr, "failed to create display: %m\n"); return; @@ -266,18 +184,17 @@ QWaylandDisplay::QWaylandDisplay(void) wl_display_add_global_listener(mDisplay, QWaylandDisplay::displayHandleGlobal, this); - /* Process connection events. */ - wl_display_iterate(mDisplay, WL_DISPLAY_READABLE); - if (!mShm || !mDeviceName) - forceRoundtrip(mDisplay); + mNativeEglDisplay = wl_egl_native_display_create(mDisplay); - /* Force a roundtrip to finish the drm authentication so we - * initialize EGL before proceeding */ - forceRoundtrip(mDisplay); - if (mEglDisplay == NULL) - qDebug("EGL not available"); - else - qDebug("EGL initialized"); + mEglDisplay = eglGetDisplay(mNativeEglDisplay); + if (mEglDisplay == NULL) { + qWarning("EGL not available"); + } else { + if (!eglInitialize(mEglDisplay, &major, &minor)) { + qWarning("failed to initialize EGL display"); + return; + } + } int fd = wl_display_get_fd(mDisplay, sourceUpdate, this); mReadNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this); @@ -293,6 +210,7 @@ QWaylandDisplay::QWaylandDisplay(void) QWaylandDisplay::~QWaylandDisplay(void) { close(mFd); + eglTerminate(mEglDisplay); wl_display_destroy(mDisplay); } diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index f179713..375a9c1 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -71,12 +71,10 @@ public: struct wl_buffer *createShmBuffer(int fd, int width, int height, uint32_t stride, struct wl_visual *visual); - struct wl_buffer *createDrmBuffer(int name, int width, int height, - uint32_t stride, - struct wl_visual *visual); struct wl_visual *rgbVisual(); struct wl_visual *argbVisual(); struct wl_visual *argbPremultipliedVisual(); + struct wl_egl_display *nativeDisplay(); EGLDisplay eglDisplay() { return mEglDisplay; } void setCursor(QWaylandBuffer *buffer, int32_t x, int32_t y); @@ -91,7 +89,6 @@ public slots: private: struct wl_display *mDisplay; struct wl_compositor *mCompositor; - struct wl_drm *mDrm; struct wl_shm *mShm; struct wl_shell *mShell; char *mDeviceName; @@ -101,16 +98,13 @@ private: QSocketNotifier *mReadNotifier; QSocketNotifier *mWriteNotifier; EGLDisplay mEglDisplay; + struct wl_egl_display *mNativeEglDisplay; static void displayHandleGlobal(struct wl_display *display, uint32_t id, const char *interface, uint32_t version, void *data); - static void drmHandleDevice(void *data, - struct wl_drm *drm, const char *device); - static void drmHandleAuthenticated(void *data, struct wl_drm *drm); - static void outputHandleGeometry(void *data, struct wl_output *output, int32_t x, int32_t y, @@ -123,7 +117,6 @@ private: static int sourceUpdate(uint32_t mask, void *data); - static const struct wl_drm_listener drmListener; static const struct wl_output_listener outputListener; static const struct wl_shell_listener shellListener; }; diff --git a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp index 603c018..a9a8046 100644 --- a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp @@ -50,10 +50,7 @@ #include #include -#include -#include -#include -#include +#include QT_BEGIN_NAMESPACE @@ -66,23 +63,6 @@ QWaylandDrmBuffer::QWaylandDrmBuffer(QWaylandDisplay *display, , mSize(size) { struct wl_visual *visual; - EGLint name, stride; - EGLint imageAttribs[] = { - EGL_WIDTH, size.width(), - EGL_HEIGHT, size.height(), - EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_ARGB32_MESA, - EGL_DRM_BUFFER_USE_MESA, EGL_DRM_BUFFER_USE_SCANOUT_MESA, - EGL_NONE - }; - - mImage = eglCreateDRMImageMESA(mDisplay->eglDisplay(), imageAttribs); - - glGenTextures(1, &mTexture); - glBindTexture(GL_TEXTURE_2D, mTexture); - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, mImage); - - eglExportDRMImageMESA(mDisplay->eglDisplay(), - mImage, &name, NULL, &stride); switch (format) { case QImage::Format_ARGB32: @@ -97,14 +77,28 @@ QWaylandDrmBuffer::QWaylandDrmBuffer(QWaylandDisplay *display, break; } - mBuffer = display->createDrmBuffer(name, size.width(), size.height(), - stride, visual); + mPixmap = wl_egl_native_pixmap_create(display->nativeDisplay(), + size.width(), size.height(), + visual, 0); + + mImage = eglCreateImageKHR(display->eglDisplay(), + NULL, EGL_NATIVE_PIXMAP_KHR, + (EGLClientBuffer) mPixmap, NULL); + + glGenTextures(1, &mTexture); + qDebug() << "generating mTexture" << mTexture; + glBindTexture(GL_TEXTURE_2D, mTexture); + glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, mImage); + + mBuffer = wl_egl_native_pixmap_create_buffer(display->nativeDisplay(), + mPixmap); } QWaylandDrmBuffer::~QWaylandDrmBuffer(void) { glDeleteTextures(1, &mTexture); eglDestroyImageKHR(mDisplay->eglDisplay(), mImage); + wl_egl_native_pixmap_destroy(mPixmap); wl_buffer_destroy(mBuffer); } diff --git a/src/plugins/platforms/wayland/qwaylanddrmsurface.h b/src/plugins/platforms/wayland/qwaylanddrmsurface.h index eafea13..f49263b 100644 --- a/src/plugins/platforms/wayland/qwaylanddrmsurface.h +++ b/src/plugins/platforms/wayland/qwaylanddrmsurface.h @@ -76,6 +76,7 @@ public: QSize size() const { return mSize; } private: + struct wl_egl_pixmap *mPixmap; EGLImageKHR mImage; QWaylandDisplay *mDisplay; QSize mSize; diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro index 8ba1408..803a8e9 100644 --- a/src/plugins/platforms/wayland/wayland.pro +++ b/src/plugins/platforms/wayland/wayland.pro @@ -27,7 +27,7 @@ HEADERS = qwaylandintegration.h \ contains(QT_CONFIG, opengl) { QT += opengl } -LIBS += -lwayland-client -lxkbcommon -lEGL +LIBS += -lwayland-client -lwayland-egl -lxkbcommon -lEGL unix { CONFIG += link_pkgconfig PKGCONFIG += libdrm -- cgit v0.12 From a39b6c89efe78ab74767f70d60a2a9238a31c34a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 1 Feb 2011 16:01:57 +0100 Subject: Lighthouse: Fix if context isSharing setup for QGLContext --- src/opengl/qgl.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 0ec3a15..9f31c62 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -3310,8 +3310,10 @@ bool QGLContext::create(const QGLContext* shareContext) QWidgetPrivate *wd = qt_widget_private(static_cast(d->paintDevice)); wd->usesDoubleBufferedGLContext = d->glFormat.doubleBuffer(); } +#ifndef Q_WS_QPA //We do this in choose context->setupSharing() if (d->sharing) // ok, we managed to share QGLContextGroup::addShare(this, shareContext); +#endif return d->valid; } -- cgit v0.12 From d7043ed404982efc67fd252c04a055e4ed783d6b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Tue, 1 Feb 2011 16:02:32 +0100 Subject: Lighthouse: QGLWidgetPropogate the resizeEvent down to the Widget before doing the QGLWidget event handling --- src/opengl/qgl_qpa.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index 0f4b305..b865086 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -331,13 +331,14 @@ bool QGLWidget::event(QEvent *e) void QGLWidget::resizeEvent(QResizeEvent *e) { Q_D(QGLWidget); + + QWidget::resizeEvent(e); if (!isValid()) return; makeCurrent(); if (!d->glcx->initialized()) glInit(); resizeGL(width(), height()); - return QWidget::resizeEvent(e); } -- cgit v0.12 From 7ea1dd46966ae7cfa07fa18c001704e3c981b669 Mon Sep 17 00:00:00 2001 From: con Date: Mon, 7 Feb 2011 09:59:33 +0100 Subject: Move Mac specific include into Q_WS_MAC scope for QScroller abstraction Reviewed-by: jorgen --- src/gui/util/qscroller_mac.mm | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/gui/util/qscroller_mac.mm b/src/gui/util/qscroller_mac.mm index 3203036..d85a51b 100644 --- a/src/gui/util/qscroller_mac.mm +++ b/src/gui/util/qscroller_mac.mm @@ -39,12 +39,13 @@ ** ****************************************************************************/ -#import #include "qscroller_p.h" #ifdef Q_WS_MAC +#import + QPointF QScrollerPrivate::realDpi(int screen) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; -- cgit v0.12 From ed4dddfb3f2a357875fb9e471e7d5db98633f34c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 7 Feb 2011 10:21:47 +0100 Subject: Moving mac specific functionality into correct place in pri file --- src/gui/painting/painting.pri | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri index 51f2538..65e7af4 100644 --- a/src/gui/painting/painting.pri +++ b/src/gui/painting/painting.pri @@ -234,8 +234,10 @@ x11 { } !embedded:!qpa:mac { - HEADERS += painting/qwindowsurface_mac_p.h - SOURCES += painting/qwindowsurface_mac.cpp + HEADERS += painting/qwindowsurface_mac_p.h \ + painting/qunifiedtoolbarsurface_mac_p.h + SOURCES += painting/qwindowsurface_mac.cpp \ + painting/qunifiedtoolbarsurface_mac.cpp } embedded { @@ -260,12 +262,6 @@ symbian { QMAKE_CXXFLAGS.ARMCC *= -O3 } -mac { - HEADERS += painting/qunifiedtoolbarsurface_mac_p.h - SOURCES += painting/qunifiedtoolbarsurface_mac.cpp -} - - NEON_SOURCES += painting/qdrawhelper_neon.cpp NEON_HEADERS += painting/qdrawhelper_neon_p.h NEON_ASM += ../3rdparty/pixman/pixman-arm-neon-asm.S painting/qdrawhelper_neon_asm.S -- cgit v0.12 From 8298a9d4190de1d2055da8be446c8ae4b22b6618 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 7 Feb 2011 16:29:19 +0100 Subject: Initial (incomplete) XCB platform port. --- src/plugins/platforms/xcb/main.cpp | 72 +++++++++ src/plugins/platforms/xcb/qxcbconnection.cpp | 110 ++++++++++++++ src/plugins/platforms/xcb/qxcbconnection.h | 75 ++++++++++ src/plugins/platforms/xcb/qxcbintegration.cpp | 116 +++++++++++++++ src/plugins/platforms/xcb/qxcbintegration.h | 78 ++++++++++ src/plugins/platforms/xcb/qxcbscreen.cpp | 77 ++++++++++ src/plugins/platforms/xcb/qxcbscreen.h | 72 +++++++++ src/plugins/platforms/xcb/qxcbwindow.cpp | 189 ++++++++++++++++++++++++ src/plugins/platforms/xcb/qxcbwindow.h | 90 +++++++++++ src/plugins/platforms/xcb/qxcbwindowsurface.cpp | 106 +++++++++++++ src/plugins/platforms/xcb/qxcbwindowsurface.h | 66 +++++++++ src/plugins/platforms/xcb/xcb.pro | 26 ++++ 12 files changed, 1077 insertions(+) create mode 100644 src/plugins/platforms/xcb/main.cpp create mode 100644 src/plugins/platforms/xcb/qxcbconnection.cpp create mode 100644 src/plugins/platforms/xcb/qxcbconnection.h create mode 100644 src/plugins/platforms/xcb/qxcbintegration.cpp create mode 100644 src/plugins/platforms/xcb/qxcbintegration.h create mode 100644 src/plugins/platforms/xcb/qxcbscreen.cpp create mode 100644 src/plugins/platforms/xcb/qxcbscreen.h create mode 100644 src/plugins/platforms/xcb/qxcbwindow.cpp create mode 100644 src/plugins/platforms/xcb/qxcbwindow.h create mode 100644 src/plugins/platforms/xcb/qxcbwindowsurface.cpp create mode 100644 src/plugins/platforms/xcb/qxcbwindowsurface.h create mode 100644 src/plugins/platforms/xcb/xcb.pro diff --git a/src/plugins/platforms/xcb/main.cpp b/src/plugins/platforms/xcb/main.cpp new file mode 100644 index 0000000..1966003 --- /dev/null +++ b/src/plugins/platforms/xcb/main.cpp @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include "qxcbintegration.h" + +QT_BEGIN_NAMESPACE + +class QXcbIntegrationPlugin : public QPlatformIntegrationPlugin +{ +public: + QStringList keys() const; + QPlatformIntegration *create(const QString&, const QStringList&); +}; + +QStringList QXcbIntegrationPlugin::keys() const +{ + QStringList list; + list << "xcb"; + return list; +} + +QPlatformIntegration* QXcbIntegrationPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + if (system.toLower() == "xcb") + return new QXcbIntegration; + + return 0; +} + +Q_EXPORT_PLUGIN2(xcb, QXcbIntegrationPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp new file mode 100644 index 0000000..d5e44ad --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -0,0 +1,110 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qxcbconnection.h" +#include "qxcbscreen.h" +#include "qxcbwindow.h" + +#include +#include + +#include + +QXcbConnection::QXcbConnection(const char *displayName) +{ + int primaryScreen; + + m_connection = xcb_connect(displayName, &primaryScreen); + + m_setup = xcb_get_setup(m_connection); + + xcb_screen_iterator_t it = xcb_setup_roots_iterator(m_setup); + + while (it.rem) { + m_screens << new QXcbScreen(this, it.data); + xcb_screen_next(&it); + } + + QSocketNotifier *socket = new QSocketNotifier(xcb_get_file_descriptor(m_connection), QSocketNotifier::Read, this); + connect(socket, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); +} + +QXcbConnection::~QXcbConnection() +{ + qDeleteAll(m_screens); + + xcb_disconnect(m_connection); +} + +QXcbWindow *platformWindowFromId(xcb_window_t id) +{ + QWidget *widget = QWidget::find(id); + if (widget) + return static_cast(widget->platformWindow()); + return 0; +} + +#define HANDLE_PLATFORM_WINDOW_EVENT(event_t, window, handler) \ +{ \ + event_t *e = (event_t *)event; \ + if (QXcbWindow *platformWindow = platformWindowFromId(e->window)) \ + platformWindow->handler(e); \ +} \ +break; + +void QXcbConnection::eventDispatcher() +{ + while (xcb_generic_event_t *event = xcb_poll_for_event(m_connection)) { + switch (event->response_type & ~0x80) { + case XCB_EXPOSE: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_expose_event_t, window, handleExposeEvent); + case XCB_BUTTON_PRESS: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_press_event_t, event, handleButtonPressEvent); + case XCB_BUTTON_RELEASE: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_release_event_t, event, handleButtonReleaseEvent); + case XCB_MOTION_NOTIFY: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_motion_notify_event_t, event, handleMotionNotifyEvent); + default: + break; + + } + } +} diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h new file mode 100644 index 0000000..509e798 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXCBCONNECTION_H +#define QXCBCONNECTION_H + +#include + +#include +#include + +class QXcbScreen; + +class QXcbConnection : public QObject +{ + Q_OBJECT +public: + QXcbConnection(const char *displayName = 0); + ~QXcbConnection(); + + QList screens() const { return m_screens; } + int primaryScreen() const { return m_primaryScreen; } + + xcb_connection_t *connection() const { return m_connection; } + +private slots: + void eventDispatcher(); + +private: + xcb_connection_t *m_connection; + const xcb_setup_t *m_setup; + + QList m_screens; + int m_primaryScreen; +}; + +#endif diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp new file mode 100644 index 0000000..5da86010 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -0,0 +1,116 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qxcbintegration.h" +#include "qxcbconnection.h" +#include "qxcbscreen.h" +#include "qxcbwindow.h" +#include "qxcbwindowsurface.h" + +#include + +#include + +#include "qgenericunixfontdatabase.h" + +#include + +QXcbIntegration::QXcbIntegration() + : m_connection(new QXcbConnection) +{ + foreach (QXcbScreen *screen, m_connection->screens()) + m_screens << screen; + + m_fontDatabase = new QGenericUnixFontDatabase(); +} + +QXcbIntegration::~QXcbIntegration() +{ + delete m_connection; +} + +QPixmapData *QXcbIntegration::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QPlatformWindow *QXcbIntegration::createPlatformWindow(QWidget *widget, WId winId) const +{ + Q_UNUSED(winId); + return new QXcbWindow(widget); +} + +QWindowSurface *QXcbIntegration::createWindowSurface(QWidget *widget, WId winId) const +{ + Q_UNUSED(winId); + return new QXcbWindowSurface(widget); +} + +QList QXcbIntegration::screens() const +{ + return m_screens; +} + +void QXcbIntegration::moveToScreen(QWidget *window, int screen) +{ + Q_UNUSED(window); + Q_UNUSED(screen); +} + +bool QXcbIntegration::isVirtualDesktop() +{ + return false; +} + +QPlatformFontDatabase *QXcbIntegration::fontDatabase() const +{ + return m_fontDatabase; +} + +QPixmap QXcbIntegration::grabWindow(WId window, int x, int y, int width, int height) const +{ + Q_UNUSED(window); + Q_UNUSED(x); + Q_UNUSED(y); + Q_UNUSED(width); + Q_UNUSED(height); + return QPixmap(); +} diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h new file mode 100644 index 0000000..8b599b3 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -0,0 +1,78 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXCBINTEGRATION_H +#define QXCBINTEGRATION_H + +#include +#include + +QT_BEGIN_NAMESPACE + +class QXcbConnection; + +class QXcbIntegration : public QPlatformIntegration +{ +public: + QXcbIntegration(); + ~QXcbIntegration(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + + QList screens() const; + void moveToScreen(QWidget *window, int screen); + bool isVirtualDesktop(); + QPixmap grabWindow(WId window, int x, int y, int width, int height) const; + + QPlatformFontDatabase *fontDatabase() const; + +private: + QList m_screens; + QXcbConnection *m_connection; + + QPlatformFontDatabase *m_fontDatabase; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp new file mode 100644 index 0000000..bbd3fd4 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -0,0 +1,77 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qxcbscreen.h" + +#include + +QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen) + : m_connection(connection) + , m_screen(screen) +{ + printf ("\n"); + printf ("Informations of screen %d:\n", screen->root); + printf (" width.........: %d\n", screen->width_in_pixels); + printf (" height........: %d\n", screen->height_in_pixels); + printf (" depth.........: %d\n", screen->root_depth); + printf (" white pixel...: %x\n", screen->white_pixel); + printf (" black pixel...: %x\n", screen->black_pixel); + printf ("\n"); +} + +QXcbScreen::~QXcbScreen() +{ +} + +QRect QXcbScreen::geometry() const +{ + return QRect(0, 0, m_screen->width_in_pixels, m_screen->height_in_pixels); +} + +int QXcbScreen::depth() const +{ + return m_screen->root_depth; +} + +QImage::Format QXcbScreen::format() const +{ + return QImage::Format_RGB32; +} diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h new file mode 100644 index 0000000..22b182b --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXCBSCREEN_H +#define QXCBSCREEN_H + +#include + +#include + +class QXcbConnection; + +class QXcbScreen : public QPlatformScreen +{ +public: + QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen); + ~QXcbScreen(); + + QRect geometry() const; + int depth() const; + QImage::Format format() const; + + QXcbConnection *connection() const { return m_connection; } + + xcb_screen_t *screen() const { return m_screen; } + xcb_window_t root() const { return m_screen->root; } + +private: + QXcbConnection *m_connection; + + xcb_screen_t *m_screen; +}; + +#endif diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp new file mode 100644 index 0000000..71bef2f --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -0,0 +1,189 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qxcbwindow.h" + +#include "qxcbconnection.h" +#include "qxcbscreen.h" + +#include + +#include + +#include + +QXcbWindow::QXcbWindow(QWidget *tlw) + : QPlatformWindow(tlw) +{ + m_screen = static_cast(QPlatformScreen::platformScreenForWidget(tlw)); + + const quint32 mask = XCB_CW_BACK_PIXMAP | XCB_CW_EVENT_MASK; + const quint32 values[] = { + // XCB_CW_BACK_PIXMAP + XCB_NONE, + // XCB_CW_EVENT_MASK + XCB_EVENT_MASK_EXPOSURE + | XCB_EVENT_MASK_BUTTON_PRESS + | XCB_EVENT_MASK_BUTTON_RELEASE + | XCB_EVENT_MASK_BUTTON_MOTION + }; + + m_window = xcb_generate_id(connection()); + xcb_create_window(connection(), + XCB_COPY_FROM_PARENT, // depth -- same as root + m_window, // window id + m_screen->root(), // parent window id + tlw->x(), + tlw->y(), + tlw->width(), + tlw->height(), + 0, // border width + XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class + m_screen->screen()->root_visual, // visual + mask, // value mask + values); // value list + + printf("m_window: %d\n", m_window); +} + +QXcbWindow::~QXcbWindow() +{ + xcb_destroy_window(connection(), m_window); +} + +void QXcbWindow::setGeometry(const QRect &rect) +{ + QPlatformWindow::setGeometry(rect); +} + +void QXcbWindow::setVisible(bool visible) +{ + if (visible) + xcb_map_window(connection(), m_window); + else + xcb_unmap_window(connection(), m_window); +} + +Qt::WindowFlags QXcbWindow::setWindowFlags(Qt::WindowFlags flags) +{ + return flags; +} + +Qt::WindowFlags QXcbWindow::windowFlags() const +{ + return 0; +} + +WId QXcbWindow::winId() const +{ + return m_window; +} + +void QXcbWindow::setParent(const QPlatformWindow *) +{ +} + +void QXcbWindow::setWindowTitle(const QString &) +{ +} + +void QXcbWindow::raise() +{ +} + +void QXcbWindow::lower() +{ +} + +void QXcbWindow::requestActivateWindow() +{ +} + +xcb_connection_t *QXcbWindow::connection() const +{ + return m_screen->connection()->connection(); +} + +void QXcbWindow::handleExposeEvent(xcb_expose_event_t *event) +{ + if (event->count != 0) + return; + + QWindowSurface *surface = widget()->windowSurface(); + if (surface) + surface->flush(widget(), widget()->geometry(), QPoint()); +} + +static Qt::MouseButtons translateMouseButtons(int s) +{ + Qt::MouseButtons ret = 0; + if (s & XCB_BUTTON_MASK_1) + ret |= Qt::LeftButton; + if (s & XCB_BUTTON_MASK_2) + ret |= Qt::MidButton; + if (s & XCB_BUTTON_MASK_3) + ret |= Qt::RightButton; + return ret; +} + +void QXcbWindow::handleButtonPressEvent(xcb_button_press_event_t *event) +{ + handleMouseEvent(event->detail, event->state, event->time, QPoint(event->event_x, event->event_y), QPoint(event->root_x, event->root_y)); +} + +void QXcbWindow::handleButtonReleaseEvent(xcb_button_release_event_t *event) +{ + handleMouseEvent(event->detail, event->state, event->time, QPoint(event->event_x, event->event_y), QPoint(event->root_x, event->root_y)); +} + +void QXcbWindow::handleMouseEvent(xcb_button_t detail, uint16_t state, xcb_timestamp_t time, const QPoint &local, const QPoint &global) +{ + Qt::MouseButtons buttons = translateMouseButtons(state); + Qt::MouseButtons button = translateMouseButtons(detail); + buttons ^= button; // X event uses state *before*, Qt uses state *after* + + QWindowSystemInterface::handleMouseEvent(widget(), time, local, global, buttons); +} + +void QXcbWindow::handleMotionNotifyEvent(xcb_motion_notify_event_t *event) +{ +} + diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h new file mode 100644 index 0000000..51c1856 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -0,0 +1,90 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXCBWINDOW_H +#define QXCBWINDOW_H + +#include + +#include + +class QXcbScreen; + +class QXcbWindow : public QPlatformWindow +{ +public: + QXcbWindow(QWidget *tlw); + ~QXcbWindow(); + + void setGeometry(const QRect &rect); + + void setVisible(bool visible); + Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); + Qt::WindowFlags windowFlags() const; + WId winId() const; + void setParent(const QPlatformWindow *window); + + void setWindowTitle(const QString &title); + void raise(); + void lower(); + + void requestActivateWindow(); + + QPlatformGLContext *glContext() const { return 0; } + + xcb_window_t window() const { return m_window; } + + void handleExposeEvent(xcb_expose_event_t *event); + void handleButtonPressEvent(xcb_button_press_event_t *event); + void handleButtonReleaseEvent(xcb_button_release_event_t *event); + void handleMotionNotifyEvent(xcb_motion_notify_event_t *event); + + void handleMouseEvent(xcb_button_t detail, uint16_t state, xcb_timestamp_t time, const QPoint &local, const QPoint &global); + +private: + xcb_connection_t *connection() const; + + QXcbScreen *m_screen; + + xcb_window_t m_window; +}; + +#endif diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp new file mode 100644 index 0000000..27912cc --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qxcbwindowsurface.h" + +#include "qxcbconnection.h" +#include "qxcbscreen.h" +#include "qxcbwindow.h" + +#include + +QXcbWindowSurface::QXcbWindowSurface(QWidget *widget, bool setDefaultSurface) + : QWindowSurface(widget, setDefaultSurface) +{ + setStaticContentsSupport(false); + setPartialUpdateSupport(false); +} + +QXcbWindowSurface::~QXcbWindowSurface() +{ +} + +QPaintDevice *QXcbWindowSurface::paintDevice() +{ + return &m_image; +} + +void QXcbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(region); + Q_UNUSED(offset); + + QXcbScreen *screen = static_cast(QPlatformScreen::platformScreenForWidget(widget)); + QXcbWindow *window = static_cast(widget->window()->platformWindow()); + + xcb_connection_t *xcb_con = screen->connection()->connection(); + + m_gc = xcb_generate_id(xcb_con); + xcb_create_gc(xcb_con, m_gc, window->window(), 0, 0); + + xcb_put_image(xcb_con, + XCB_IMAGE_FORMAT_Z_PIXMAP, + window->window(), + m_gc, + m_image.width(), + m_image.height(), + 0, + 0, + 0, + 24, + m_image.numBytes(), + m_image.bits()); + + xcb_free_gc(xcb_con, m_gc); + xcb_flush(xcb_con); +} + +void QXcbWindowSurface::resize(const QSize &size) +{ + QWindowSurface::resize(size); + m_image = QImage(size, QImage::Format_RGB32); +} + +bool QXcbWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + return false; +} + diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.h b/src/plugins/platforms/xcb/qxcbwindowsurface.h new file mode 100644 index 0000000..74be9a2 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXCBWINDOWSURFACE_H +#define QXCBWINDOWSURFACE_H + +#include + +#include + +class QXcbWindowSurface : public QWindowSurface +{ +public: + QXcbWindowSurface(QWidget *widget, bool setDefaultSurface = true); + ~QXcbWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void resize(const QSize &size); + bool scroll(const QRegion &area, int dx, int dy); + +private: + QImage m_image; + + xcb_gcontext_t m_gc; +}; + +#endif diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro new file mode 100644 index 0000000..cbbda0d --- /dev/null +++ b/src/plugins/platforms/xcb/xcb.pro @@ -0,0 +1,26 @@ +TARGET = xcb + +include(../../qpluginbase.pri) +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms + +SOURCES = \ + main.cpp \ + qxcbintegration.cpp \ + qxcbconnection.cpp \ + qxcbscreen.cpp \ + qxcbwindow.cpp \ + qxcbwindowsurface.cpp + +HEADERS = \ + qxcbintegration.h \ + qxcbconnection.h \ + qxcbscreen.h \ + qxcbwindow.h \ + qxcbwindowsurface.h + +LIBS += -lxcb + +include (../fontdatabases/genericunix/genericunix.pri) + +target.path += $$[QT_INSTALL_PLUGINS]/platforms +INSTALLS += target -- cgit v0.12 From eef89ebc2abe0f095a4ad186a449ff78f1e57dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 7 Feb 2011 16:19:01 +0100 Subject: Make sure its possible to use qpa scope in use applications In user applications it should be possible to write something like qpa { HEADERS += Lighthousespecificheader.h } Reviewed-by: paul --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 9730e25..bacd2e4 100755 --- a/configure +++ b/configure @@ -6996,6 +6996,7 @@ fi if [ "$PLATFORM_QPA" = "yes" ]; then QMAKE_CONFIG="$QMAKE_CONFIG qpa" QT_CONFIG="$QT_CONFIG qpa" + QTCONFIG_CONFIG="$QTCONFIG_CONFIG qpa" rm -f "src/.moc/$QMAKE_OUTDIR/allmoc.cpp" # needs remaking if config changes fi -- cgit v0.12 From 5708dba6b3661d69446802c9a83d348520d5cd60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 7 Feb 2011 17:45:49 +0100 Subject: Improve mouse input handling in XCB lighthouse backend. --- src/plugins/platforms/xcb/qxcbwindow.cpp | 53 +++++++++++++++++++++++++++----- 1 file changed, 46 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 71bef2f..7d18d52 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -164,26 +164,65 @@ static Qt::MouseButtons translateMouseButtons(int s) return ret; } +static Qt::MouseButton translateMouseButton(xcb_button_t s) +{ + switch (s) { + case 1: + return Qt::LeftButton; + case 2: + return Qt::MidButton; + case 3: + return Qt::RightButton; + default: + return Qt::NoButton; + } +} + void QXcbWindow::handleButtonPressEvent(xcb_button_press_event_t *event) { - handleMouseEvent(event->detail, event->state, event->time, QPoint(event->event_x, event->event_y), QPoint(event->root_x, event->root_y)); + QPoint local(event->event_x, event->event_y); + QPoint global(event->root_x, event->root_y); + + Qt::KeyboardModifiers modifiers = Qt::NoModifier; + + if (event->detail >= 4 && event->detail <= 7) { + //logic borrowed from qapplication_x11.cpp + int delta = 120 * ((event->detail == 4 || event->detail == 6) ? 1 : -1); + bool hor = (((event->detail == 4 || event->detail == 5) + && (modifiers & Qt::AltModifier)) + || (event->detail == 6 || event->detail == 7)); + + QWindowSystemInterface::handleWheelEvent(widget(), event->time, + local, global, delta, hor ? Qt::Horizontal : Qt::Vertical); + return; + } + + handleMouseEvent(event->detail, event->state, event->time, local, global); } void QXcbWindow::handleButtonReleaseEvent(xcb_button_release_event_t *event) { - handleMouseEvent(event->detail, event->state, event->time, QPoint(event->event_x, event->event_y), QPoint(event->root_x, event->root_y)); + QPoint local(event->event_x, event->event_y); + QPoint global(event->root_x, event->root_y); + + handleMouseEvent(event->detail, event->state, event->time, local, global); +} + +void QXcbWindow::handleMotionNotifyEvent(xcb_motion_notify_event_t *event) +{ + QPoint local(event->event_x, event->event_y); + QPoint global(event->root_x, event->root_y); + + handleMouseEvent(event->detail, event->state, event->time, local, global); } void QXcbWindow::handleMouseEvent(xcb_button_t detail, uint16_t state, xcb_timestamp_t time, const QPoint &local, const QPoint &global) { Qt::MouseButtons buttons = translateMouseButtons(state); - Qt::MouseButtons button = translateMouseButtons(detail); + Qt::MouseButton button = translateMouseButton(detail); + buttons ^= button; // X event uses state *before*, Qt uses state *after* QWindowSystemInterface::handleMouseEvent(widget(), time, local, global, buttons); } -void QXcbWindow::handleMotionNotifyEvent(xcb_motion_notify_event_t *event) -{ -} - -- cgit v0.12 From 3c603d35d46257ceee50bfe315d4cd5abd97b24f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 7 Feb 2011 18:14:32 +0100 Subject: Lighthouse Wayland: wayland-egl entry points where renamed Conflicts: src/plugins/platforms/wayland/qwaylanddisplay.cpp src/plugins/platforms/wayland/qwaylanddrmsurface.cpp --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 2 +- src/plugins/platforms/wayland/qwaylanddrmsurface.cpp | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 2e30c2f..0747afd 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -184,7 +184,7 @@ QWaylandDisplay::QWaylandDisplay(void) wl_display_add_global_listener(mDisplay, QWaylandDisplay::displayHandleGlobal, this); - mNativeEglDisplay = wl_egl_native_display_create(mDisplay); + mNativeEglDisplay = wl_egl_display_create(mDisplay); mEglDisplay = eglGetDisplay(mNativeEglDisplay); if (mEglDisplay == NULL) { diff --git a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp index a9a8046..aaf4a5c 100644 --- a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp @@ -77,9 +77,9 @@ QWaylandDrmBuffer::QWaylandDrmBuffer(QWaylandDisplay *display, break; } - mPixmap = wl_egl_native_pixmap_create(display->nativeDisplay(), - size.width(), size.height(), - visual, 0); + mPixmap = wl_egl_pixmap_create(display->nativeDisplay(), + size.width(), size.height(), + visual, 0); mImage = eglCreateImageKHR(display->eglDisplay(), NULL, EGL_NATIVE_PIXMAP_KHR, @@ -90,15 +90,14 @@ QWaylandDrmBuffer::QWaylandDrmBuffer(QWaylandDisplay *display, glBindTexture(GL_TEXTURE_2D, mTexture); glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, mImage); - mBuffer = wl_egl_native_pixmap_create_buffer(display->nativeDisplay(), - mPixmap); + mBuffer = wl_egl_pixmap_create_buffer(display->nativeDisplay(), mPixmap); } QWaylandDrmBuffer::~QWaylandDrmBuffer(void) { glDeleteTextures(1, &mTexture); eglDestroyImageKHR(mDisplay->eglDisplay(), mImage); - wl_egl_native_pixmap_destroy(mPixmap); + wl_egl_pixmap_destroy(mPixmap); wl_buffer_destroy(mBuffer); } -- cgit v0.12 From 573901d760414ad7c1fd74bad75b2c21532d0ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 7 Feb 2011 17:50:31 +0100 Subject: Added support for scrolling in XCB window surface. --- src/plugins/platforms/xcb/qxcbwindowsurface.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp index 27912cc..ad91c34 100644 --- a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp @@ -99,8 +99,17 @@ void QXcbWindowSurface::resize(const QSize &size) m_image = QImage(size, QImage::Format_RGB32); } +extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); + bool QXcbWindowSurface::scroll(const QRegion &area, int dx, int dy) { - return false; + if (m_image.isNull()) + return false; + + const QVector rects = area.rects(); + for (int i = 0; i < rects.size(); ++i) + qt_scrollRectInImage(m_image, rects.at(i), QPoint(dx, dy)); + + return true; } -- cgit v0.12 From 864e16ad2858ba752070528b1ba03edeafa54579 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 7 Feb 2011 18:30:47 +0100 Subject: Added atom resolving, resizing, and window title support to XCB backend. --- src/plugins/platforms/xcb/qxcbconnection.cpp | 198 ++++++++++++++++++++++++++- src/plugins/platforms/xcb/qxcbconnection.h | 173 +++++++++++++++++++++++ src/plugins/platforms/xcb/qxcbwindow.cpp | 25 +++- src/plugins/platforms/xcb/qxcbwindow.h | 1 + 4 files changed, 395 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index d5e44ad..df655a3 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -49,10 +49,11 @@ #include QXcbConnection::QXcbConnection(const char *displayName) + : m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY")) { int primaryScreen; - m_connection = xcb_connect(displayName, &primaryScreen); + m_connection = xcb_connect(m_displayName.constData(), &primaryScreen); m_setup = xcb_get_setup(m_connection); @@ -65,6 +66,8 @@ QXcbConnection::QXcbConnection(const char *displayName) QSocketNotifier *socket = new QSocketNotifier(xcb_get_file_descriptor(m_connection), QSocketNotifier::Read, this); connect(socket, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); + + initializeAllAtoms(); } QXcbConnection::~QXcbConnection() @@ -102,9 +105,202 @@ void QXcbConnection::eventDispatcher() HANDLE_PLATFORM_WINDOW_EVENT(xcb_button_release_event_t, event, handleButtonReleaseEvent); case XCB_MOTION_NOTIFY: HANDLE_PLATFORM_WINDOW_EVENT(xcb_motion_notify_event_t, event, handleMotionNotifyEvent); + case XCB_CONFIGURE_NOTIFY: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_configure_notify_event_t, event, handleConfigureNotifyEvent); default: break; } } } + +static const char * xcb_atomnames = { + // window-manager <-> client protocols + "WM_PROTOCOLS\0" + "WM_DELETE_WINDOW\0" + "WM_TAKE_FOCUS\0" + "_NET_WM_PING\0" + "_NET_WM_CONTEXT_HELP\0" + "_NET_WM_SYNC_REQUEST\0" + "_NET_WM_SYNC_REQUEST_COUNTER\0" + + // ICCCM window state + "WM_STATE\0" + "WM_CHANGE_STATE\0" + + // Session management + "WM_CLIENT_LEADER\0" + "WM_WINDOW_ROLE\0" + "SM_CLIENT_ID\0" + + // Clipboard + "CLIPBOARD\0" + "INCR\0" + "TARGETS\0" + "MULTIPLE\0" + "TIMESTAMP\0" + "SAVE_TARGETS\0" + "CLIP_TEMPORARY\0" + "_QT_SELECTION\0" + "_QT_CLIPBOARD_SENTINEL\0" + "_QT_SELECTION_SENTINEL\0" + "CLIPBOARD_MANAGER\0" + + "RESOURCE_MANAGER\0" + + "_XSETROOT_ID\0" + + "_QT_SCROLL_DONE\0" + "_QT_INPUT_ENCODING\0" + + "_MOTIF_WM_HINTS\0" + + "DTWM_IS_RUNNING\0" + "ENLIGHTENMENT_DESKTOP\0" + "_DT_SAVE_MODE\0" + "_SGI_DESKS_MANAGER\0" + + // EWMH (aka NETWM) + "_NET_SUPPORTED\0" + "_NET_VIRTUAL_ROOTS\0" + "_NET_WORKAREA\0" + + "_NET_MOVERESIZE_WINDOW\0" + "_NET_WM_MOVERESIZE\0" + + "_NET_WM_NAME\0" + "_NET_WM_ICON_NAME\0" + "_NET_WM_ICON\0" + + "_NET_WM_PID\0" + + "_NET_WM_WINDOW_OPACITY\0" + + "_NET_WM_STATE\0" + "_NET_WM_STATE_ABOVE\0" + "_NET_WM_STATE_BELOW\0" + "_NET_WM_STATE_FULLSCREEN\0" + "_NET_WM_STATE_MAXIMIZED_HORZ\0" + "_NET_WM_STATE_MAXIMIZED_VERT\0" + "_NET_WM_STATE_MODAL\0" + "_NET_WM_STATE_STAYS_ON_TOP\0" + "_NET_WM_STATE_DEMANDS_ATTENTION\0" + + "_NET_WM_USER_TIME\0" + "_NET_WM_USER_TIME_WINDOW\0" + "_NET_WM_FULL_PLACEMENT\0" + + "_NET_WM_WINDOW_TYPE\0" + "_NET_WM_WINDOW_TYPE_DESKTOP\0" + "_NET_WM_WINDOW_TYPE_DOCK\0" + "_NET_WM_WINDOW_TYPE_TOOLBAR\0" + "_NET_WM_WINDOW_TYPE_MENU\0" + "_NET_WM_WINDOW_TYPE_UTILITY\0" + "_NET_WM_WINDOW_TYPE_SPLASH\0" + "_NET_WM_WINDOW_TYPE_DIALOG\0" + "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU\0" + "_NET_WM_WINDOW_TYPE_POPUP_MENU\0" + "_NET_WM_WINDOW_TYPE_TOOLTIP\0" + "_NET_WM_WINDOW_TYPE_NOTIFICATION\0" + "_NET_WM_WINDOW_TYPE_COMBO\0" + "_NET_WM_WINDOW_TYPE_DND\0" + "_NET_WM_WINDOW_TYPE_NORMAL\0" + "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE\0" + + "_KDE_NET_WM_FRAME_STRUT\0" + + "_NET_STARTUP_INFO\0" + "_NET_STARTUP_INFO_BEGIN\0" + + "_NET_SUPPORTING_WM_CHECK\0" + + "_NET_WM_CM_S0\0" + + "_NET_SYSTEM_TRAY_VISUAL\0" + + "_NET_ACTIVE_WINDOW\0" + + // Property formats + "COMPOUND_TEXT\0" + "TEXT\0" + "UTF8_STRING\0" + + // xdnd + "XdndEnter\0" + "XdndPosition\0" + "XdndStatus\0" + "XdndLeave\0" + "XdndDrop\0" + "XdndFinished\0" + "XdndTypeList\0" + "XdndActionList\0" + + "XdndSelection\0" + + "XdndAware\0" + "XdndProxy\0" + + "XdndActionCopy\0" + "XdndActionLink\0" + "XdndActionMove\0" + "XdndActionPrivate\0" + + // Motif DND + "_MOTIF_DRAG_AND_DROP_MESSAGE\0" + "_MOTIF_DRAG_INITIATOR_INFO\0" + "_MOTIF_DRAG_RECEIVER_INFO\0" + "_MOTIF_DRAG_WINDOW\0" + "_MOTIF_DRAG_TARGETS\0" + + "XmTRANSFER_SUCCESS\0" + "XmTRANSFER_FAILURE\0" + + // Xkb + "_XKB_RULES_NAMES\0" + + // XEMBED + "_XEMBED\0" + "_XEMBED_INFO\0" + + // Wacom old. (before version 0.10) + "Wacom Stylus\0" + "Wacom Cursor\0" + "Wacom Eraser\0" + + // Tablet + "STYLUS\0" + "ERASER\0" +}; + +xcb_atom_t QXcbConnection::atom(QXcbAtom::Atom atom) +{ + return m_allAtoms[atom]; +} + +void QXcbConnection::initializeAllAtoms() { + const char *names[QXcbAtom::NAtoms]; + const char *ptr = xcb_atomnames; + + int i = 0; + while (*ptr) { + names[i++] = ptr; + while (*ptr) + ++ptr; + ++ptr; + } + + Q_ASSERT(i == QXcbAtom::NPredefinedAtoms); + + QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_"); + settings_atom_name += m_displayName; + names[i++] = settings_atom_name; + + xcb_intern_atom_cookie_t cookies[QXcbAtom::NAtoms]; + + Q_ASSERT(i == QXcbAtom::NAtoms); + for (i = 0; i < QXcbAtom::NAtoms; ++i) + cookies[i] = xcb_intern_atom(m_connection, false, strlen(names[i]), names[i]); + + for (i = 0; i < QXcbAtom::NAtoms; ++i) + m_allAtoms[i] = xcb_intern_atom_reply(m_connection, cookies[i], 0)->atom; +} diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 509e798..e0b506f 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -49,6 +49,169 @@ class QXcbScreen; +namespace QXcbAtom { + enum Atom { + // window-manager <-> client protocols + WM_PROTOCOLS, + WM_DELETE_WINDOW, + WM_TAKE_FOCUS, + _NET_WM_PING, + _NET_WM_CONTEXT_HELP, + _NET_WM_SYNC_REQUEST, + _NET_WM_SYNC_REQUEST_COUNTER, + + // ICCCM window state + WM_STATE, + WM_CHANGE_STATE, + + // Session management + WM_CLIENT_LEADER, + WM_WINDOW_ROLE, + SM_CLIENT_ID, + + // Clipboard + CLIPBOARD, + INCR, + TARGETS, + MULTIPLE, + TIMESTAMP, + SAVE_TARGETS, + CLIP_TEMPORARY, + _QT_SELECTION, + _QT_CLIPBOARD_SENTINEL, + _QT_SELECTION_SENTINEL, + CLIPBOARD_MANAGER, + + RESOURCE_MANAGER, + + _XSETROOT_ID, + + _QT_SCROLL_DONE, + _QT_INPUT_ENCODING, + + _MOTIF_WM_HINTS, + + DTWM_IS_RUNNING, + ENLIGHTENMENT_DESKTOP, + _DT_SAVE_MODE, + _SGI_DESKS_MANAGER, + + // EWMH (aka NETWM) + _NET_SUPPORTED, + _NET_VIRTUAL_ROOTS, + _NET_WORKAREA, + + _NET_MOVERESIZE_WINDOW, + _NET_WM_MOVERESIZE, + + _NET_WM_NAME, + _NET_WM_ICON_NAME, + _NET_WM_ICON, + + _NET_WM_PID, + + _NET_WM_WINDOW_OPACITY, + + _NET_WM_STATE, + _NET_WM_STATE_ABOVE, + _NET_WM_STATE_BELOW, + _NET_WM_STATE_FULLSCREEN, + _NET_WM_STATE_MAXIMIZED_HORZ, + _NET_WM_STATE_MAXIMIZED_VERT, + _NET_WM_STATE_MODAL, + _NET_WM_STATE_STAYS_ON_TOP, + _NET_WM_STATE_DEMANDS_ATTENTION, + + _NET_WM_USER_TIME, + _NET_WM_USER_TIME_WINDOW, + _NET_WM_FULL_PLACEMENT, + + _NET_WM_WINDOW_TYPE, + _NET_WM_WINDOW_TYPE_DESKTOP, + _NET_WM_WINDOW_TYPE_DOCK, + _NET_WM_WINDOW_TYPE_TOOLBAR, + _NET_WM_WINDOW_TYPE_MENU, + _NET_WM_WINDOW_TYPE_UTILITY, + _NET_WM_WINDOW_TYPE_SPLASH, + _NET_WM_WINDOW_TYPE_DIALOG, + _NET_WM_WINDOW_TYPE_DROPDOWN_MENU, + _NET_WM_WINDOW_TYPE_POPUP_MENU, + _NET_WM_WINDOW_TYPE_TOOLTIP, + _NET_WM_WINDOW_TYPE_NOTIFICATION, + _NET_WM_WINDOW_TYPE_COMBO, + _NET_WM_WINDOW_TYPE_DND, + _NET_WM_WINDOW_TYPE_NORMAL, + _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, + + _KDE_NET_WM_FRAME_STRUT, + + _NET_STARTUP_INFO, + _NET_STARTUP_INFO_BEGIN, + + _NET_SUPPORTING_WM_CHECK, + + _NET_WM_CM_S0, + + _NET_SYSTEM_TRAY_VISUAL, + + _NET_ACTIVE_WINDOW, + + // Property formats + COMPOUND_TEXT, + TEXT, + UTF8_STRING, + + // Xdnd + XdndEnter, + XdndPosition, + XdndStatus, + XdndLeave, + XdndDrop, + XdndFinished, + XdndTypelist, + XdndActionList, + + XdndSelection, + + XdndAware, + XdndProxy, + + XdndActionCopy, + XdndActionLink, + XdndActionMove, + XdndActionPrivate, + + // Motif DND + _MOTIF_DRAG_AND_DROP_MESSAGE, + _MOTIF_DRAG_INITIATOR_INFO, + _MOTIF_DRAG_RECEIVER_INFO, + _MOTIF_DRAG_WINDOW, + _MOTIF_DRAG_TARGETS, + + XmTRANSFER_SUCCESS, + XmTRANSFER_FAILURE, + + // Xkb + _XKB_RULES_NAMES, + + // XEMBED + _XEMBED, + _XEMBED_INFO, + + XWacomStylus, + XWacomCursor, + XWacomEraser, + + XTabletStylus, + XTabletEraser, + + NPredefinedAtoms, + + _QT_SETTINGS_TIMESTAMP = NPredefinedAtoms, + NAtoms + }; +} + class QXcbConnection : public QObject { Q_OBJECT @@ -61,15 +224,25 @@ public: xcb_connection_t *connection() const { return m_connection; } + xcb_atom_t atom(QXcbAtom::Atom atom); + + const char *displayName() const { return m_displayName.constData(); } + private slots: void eventDispatcher(); private: + void initializeAllAtoms(); + xcb_connection_t *m_connection; const xcb_setup_t *m_setup; QList m_screens; int m_primaryScreen; + + xcb_atom_t m_allAtoms[QXcbAtom::NAtoms]; + + QByteArray m_displayName; }; #endif diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 7d18d52..c6bb6d7 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -61,6 +61,7 @@ QXcbWindow::QXcbWindow(QWidget *tlw) XCB_NONE, // XCB_CW_EVENT_MASK XCB_EVENT_MASK_EXPOSURE + | XCB_EVENT_MASK_STRUCTURE_NOTIFY | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_BUTTON_MOTION @@ -121,8 +122,17 @@ void QXcbWindow::setParent(const QPlatformWindow *) { } -void QXcbWindow::setWindowTitle(const QString &) +void QXcbWindow::setWindowTitle(const QString &title) { + QByteArray ba = title.toUtf8(); + xcb_change_property (connection(), + XCB_PROP_MODE_REPLACE, + m_window, + m_screen->connection()->atom(QXcbAtom::_NET_WM_NAME), + m_screen->connection()->atom(QXcbAtom::UTF8_STRING), + 8, + ba.length(), + ba.constData()); } void QXcbWindow::raise() @@ -152,6 +162,19 @@ void QXcbWindow::handleExposeEvent(xcb_expose_event_t *event) surface->flush(widget(), widget()->geometry(), QPoint()); } +void QXcbWindow::handleConfigureNotifyEvent(xcb_configure_notify_event_t *event) +{ + int xpos = geometry().x(); + int ypos = geometry().y(); + + if ((event->width == geometry().width() && event->height == geometry().height()) || event->x != 0 || event->y != 0) { + xpos = event->x; + ypos = event->y; + } + + QWindowSystemInterface::handleGeometryChange(widget(), QRect(xpos, ypos, event->width, event->height)); +} + static Qt::MouseButtons translateMouseButtons(int s) { Qt::MouseButtons ret = 0; diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 51c1856..d74786b 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -73,6 +73,7 @@ public: xcb_window_t window() const { return m_window; } void handleExposeEvent(xcb_expose_event_t *event); + void handleConfigureNotifyEvent(xcb_configure_notify_event_t *event); void handleButtonPressEvent(xcb_button_press_event_t *event); void handleButtonReleaseEvent(xcb_button_release_event_t *event); void handleMotionNotifyEvent(xcb_motion_notify_event_t *event); -- cgit v0.12 From 4d6150a045a37fe82ec4abad2721eba4374a8c37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 8 Feb 2011 10:11:32 +0100 Subject: Add WM_DELETE_WINDOW support and clean up atom / connection handling. --- src/plugins/platforms/xcb/qxcbconnection.cpp | 14 +++--- src/plugins/platforms/xcb/qxcbconnection.h | 4 +- src/plugins/platforms/xcb/qxcbobject.h | 62 +++++++++++++++++++++++++ src/plugins/platforms/xcb/qxcbscreen.cpp | 2 +- src/plugins/platforms/xcb/qxcbscreen.h | 8 ++-- src/plugins/platforms/xcb/qxcbwindow.cpp | 45 ++++++++++++------ src/plugins/platforms/xcb/qxcbwindow.h | 7 +-- src/plugins/platforms/xcb/qxcbwindowsurface.cpp | 16 +++---- src/plugins/platforms/xcb/qxcbwindowsurface.h | 4 +- src/plugins/platforms/xcb/xcb.pro | 1 + 10 files changed, 124 insertions(+), 39 deletions(-) create mode 100644 src/plugins/platforms/xcb/qxcbobject.h diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index df655a3..023f673 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -55,7 +55,7 @@ QXcbConnection::QXcbConnection(const char *displayName) m_connection = xcb_connect(m_displayName.constData(), &primaryScreen); - m_setup = xcb_get_setup(m_connection); + m_setup = xcb_get_setup(xcb_connection()); xcb_screen_iterator_t it = xcb_setup_roots_iterator(m_setup); @@ -64,7 +64,7 @@ QXcbConnection::QXcbConnection(const char *displayName) xcb_screen_next(&it); } - QSocketNotifier *socket = new QSocketNotifier(xcb_get_file_descriptor(m_connection), QSocketNotifier::Read, this); + QSocketNotifier *socket = new QSocketNotifier(xcb_get_file_descriptor(xcb_connection()), QSocketNotifier::Read, this); connect(socket, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); initializeAllAtoms(); @@ -74,7 +74,7 @@ QXcbConnection::~QXcbConnection() { qDeleteAll(m_screens); - xcb_disconnect(m_connection); + xcb_disconnect(xcb_connection()); } QXcbWindow *platformWindowFromId(xcb_window_t id) @@ -95,7 +95,7 @@ break; void QXcbConnection::eventDispatcher() { - while (xcb_generic_event_t *event = xcb_poll_for_event(m_connection)) { + while (xcb_generic_event_t *event = xcb_poll_for_event(xcb_connection())) { switch (event->response_type & ~0x80) { case XCB_EXPOSE: HANDLE_PLATFORM_WINDOW_EVENT(xcb_expose_event_t, window, handleExposeEvent); @@ -107,6 +107,8 @@ void QXcbConnection::eventDispatcher() HANDLE_PLATFORM_WINDOW_EVENT(xcb_motion_notify_event_t, event, handleMotionNotifyEvent); case XCB_CONFIGURE_NOTIFY: HANDLE_PLATFORM_WINDOW_EVENT(xcb_configure_notify_event_t, event, handleConfigureNotifyEvent); + case XCB_CLIENT_MESSAGE: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_client_message_event_t, window, handleClientMessageEvent); default: break; @@ -299,8 +301,8 @@ void QXcbConnection::initializeAllAtoms() { Q_ASSERT(i == QXcbAtom::NAtoms); for (i = 0; i < QXcbAtom::NAtoms; ++i) - cookies[i] = xcb_intern_atom(m_connection, false, strlen(names[i]), names[i]); + cookies[i] = xcb_intern_atom(xcb_connection(), false, strlen(names[i]), names[i]); for (i = 0; i < QXcbAtom::NAtoms; ++i) - m_allAtoms[i] = xcb_intern_atom_reply(m_connection, cookies[i], 0)->atom; + m_allAtoms[i] = xcb_intern_atom_reply(xcb_connection(), cookies[i], 0)->atom; } diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index e0b506f..9fb641e 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -222,12 +222,12 @@ public: QList screens() const { return m_screens; } int primaryScreen() const { return m_primaryScreen; } - xcb_connection_t *connection() const { return m_connection; } - xcb_atom_t atom(QXcbAtom::Atom atom); const char *displayName() const { return m_displayName.constData(); } + xcb_connection_t *xcb_connection() const { return m_connection; } + private slots: void eventDispatcher(); diff --git a/src/plugins/platforms/xcb/qxcbobject.h b/src/plugins/platforms/xcb/qxcbobject.h new file mode 100644 index 0000000..cabfd7c --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbobject.h @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXCBOBJECT_H +#define QXCBOBJECT_H + +#include "qxcbconnection.h" + +class QXcbObject +{ +public: + QXcbObject(QXcbConnection *connection = 0) : m_connection(connection) {} + + void setConnection(QXcbConnection *connection) { m_connection = connection; } + QXcbConnection *connection() const { return m_connection; } + + xcb_atom_t atom(QXcbAtom::Atom atom) const { return m_connection->atom(atom); } + xcb_connection_t *xcb_connection() const { return m_connection->xcb_connection(); } + +private: + QXcbConnection *m_connection; +}; + +#endif diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index bbd3fd4..1adde6b 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -44,7 +44,7 @@ #include QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen) - : m_connection(connection) + : QXcbObject(connection) , m_screen(screen) { printf ("\n"); diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index 22b182b..88de1a8 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -46,9 +46,11 @@ #include +#include "qxcbobject.h" + class QXcbConnection; -class QXcbScreen : public QPlatformScreen +class QXcbScreen : public QXcbObject, public QPlatformScreen { public: QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen); @@ -58,14 +60,10 @@ public: int depth() const; QImage::Format format() const; - QXcbConnection *connection() const { return m_connection; } - xcb_screen_t *screen() const { return m_screen; } xcb_window_t root() const { return m_screen->root; } private: - QXcbConnection *m_connection; - xcb_screen_t *m_screen; }; diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index c6bb6d7..c7bcd38 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -55,6 +55,8 @@ QXcbWindow::QXcbWindow(QWidget *tlw) { m_screen = static_cast(QPlatformScreen::platformScreenForWidget(tlw)); + setConnection(m_screen->connection()); + const quint32 mask = XCB_CW_BACK_PIXMAP | XCB_CW_EVENT_MASK; const quint32 values[] = { // XCB_CW_BACK_PIXMAP @@ -67,8 +69,8 @@ QXcbWindow::QXcbWindow(QWidget *tlw) | XCB_EVENT_MASK_BUTTON_MOTION }; - m_window = xcb_generate_id(connection()); - xcb_create_window(connection(), + m_window = xcb_generate_id(xcb_connection()); + xcb_create_window(xcb_connection(), XCB_COPY_FROM_PARENT, // depth -- same as root m_window, // window id m_screen->root(), // parent window id @@ -82,12 +84,25 @@ QXcbWindow::QXcbWindow(QWidget *tlw) mask, // value mask values); // value list + xcb_atom_t properties[] = { + atom(QXcbAtom::WM_DELETE_WINDOW) + }; + + xcb_change_property(xcb_connection(), + XCB_PROP_MODE_REPLACE, + m_window, + atom(QXcbAtom::WM_PROTOCOLS), + 4, + 32, + sizeof(properties) / sizeof(xcb_atom_t), + properties); + printf("m_window: %d\n", m_window); } QXcbWindow::~QXcbWindow() { - xcb_destroy_window(connection(), m_window); + xcb_destroy_window(xcb_connection(), m_window); } void QXcbWindow::setGeometry(const QRect &rect) @@ -98,9 +113,9 @@ void QXcbWindow::setGeometry(const QRect &rect) void QXcbWindow::setVisible(bool visible) { if (visible) - xcb_map_window(connection(), m_window); + xcb_map_window(xcb_connection(), m_window); else - xcb_unmap_window(connection(), m_window); + xcb_unmap_window(xcb_connection(), m_window); } Qt::WindowFlags QXcbWindow::setWindowFlags(Qt::WindowFlags flags) @@ -125,11 +140,11 @@ void QXcbWindow::setParent(const QPlatformWindow *) void QXcbWindow::setWindowTitle(const QString &title) { QByteArray ba = title.toUtf8(); - xcb_change_property (connection(), + xcb_change_property (xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, - m_screen->connection()->atom(QXcbAtom::_NET_WM_NAME), - m_screen->connection()->atom(QXcbAtom::UTF8_STRING), + atom(QXcbAtom::_NET_WM_NAME), + atom(QXcbAtom::UTF8_STRING), 8, ba.length(), ba.constData()); @@ -147,11 +162,6 @@ void QXcbWindow::requestActivateWindow() { } -xcb_connection_t *QXcbWindow::connection() const -{ - return m_screen->connection()->connection(); -} - void QXcbWindow::handleExposeEvent(xcb_expose_event_t *event) { if (event->count != 0) @@ -162,6 +172,15 @@ void QXcbWindow::handleExposeEvent(xcb_expose_event_t *event) surface->flush(widget(), widget()->geometry(), QPoint()); } +void QXcbWindow::handleClientMessageEvent(xcb_client_message_event_t *event) +{ + if (event->format == 32 && event->type == atom(QXcbAtom::WM_PROTOCOLS)) { + if (event->data.data32[0] == atom(QXcbAtom::WM_DELETE_WINDOW)) { + QWindowSystemInterface::handleCloseEvent(widget()); + } + } +} + void QXcbWindow::handleConfigureNotifyEvent(xcb_configure_notify_event_t *event) { int xpos = geometry().x(); diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index d74786b..a772d30 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -46,9 +46,11 @@ #include +#include "qxcbobject.h" + class QXcbScreen; -class QXcbWindow : public QPlatformWindow +class QXcbWindow : public QXcbObject, public QPlatformWindow { public: QXcbWindow(QWidget *tlw); @@ -73,6 +75,7 @@ public: xcb_window_t window() const { return m_window; } void handleExposeEvent(xcb_expose_event_t *event); + void handleClientMessageEvent(xcb_client_message_event_t *event); void handleConfigureNotifyEvent(xcb_configure_notify_event_t *event); void handleButtonPressEvent(xcb_button_press_event_t *event); void handleButtonReleaseEvent(xcb_button_release_event_t *event); @@ -81,8 +84,6 @@ public: void handleMouseEvent(xcb_button_t detail, uint16_t state, xcb_timestamp_t time, const QPoint &local, const QPoint &global); private: - xcb_connection_t *connection() const; - QXcbScreen *m_screen; xcb_window_t m_window; diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp index ad91c34..e3b2c6c 100644 --- a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp @@ -52,6 +52,9 @@ QXcbWindowSurface::QXcbWindowSurface(QWidget *widget, bool setDefaultSurface) { setStaticContentsSupport(false); setPartialUpdateSupport(false); + + QXcbScreen *screen = static_cast(QPlatformScreen::platformScreenForWidget(widget)); + setConnection(screen->connection()); } QXcbWindowSurface::~QXcbWindowSurface() @@ -68,15 +71,12 @@ void QXcbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoi Q_UNUSED(region); Q_UNUSED(offset); - QXcbScreen *screen = static_cast(QPlatformScreen::platformScreenForWidget(widget)); QXcbWindow *window = static_cast(widget->window()->platformWindow()); - xcb_connection_t *xcb_con = screen->connection()->connection(); - - m_gc = xcb_generate_id(xcb_con); - xcb_create_gc(xcb_con, m_gc, window->window(), 0, 0); + m_gc = xcb_generate_id(xcb_connection()); + xcb_create_gc(xcb_connection(), m_gc, window->window(), 0, 0); - xcb_put_image(xcb_con, + xcb_put_image(xcb_connection(), XCB_IMAGE_FORMAT_Z_PIXMAP, window->window(), m_gc, @@ -89,8 +89,8 @@ void QXcbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoi m_image.numBytes(), m_image.bits()); - xcb_free_gc(xcb_con, m_gc); - xcb_flush(xcb_con); + xcb_free_gc(xcb_connection(), m_gc); + xcb_flush(xcb_connection()); } void QXcbWindowSurface::resize(const QSize &size) diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.h b/src/plugins/platforms/xcb/qxcbwindowsurface.h index 74be9a2..66b9c29 100644 --- a/src/plugins/platforms/xcb/qxcbwindowsurface.h +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.h @@ -46,7 +46,9 @@ #include -class QXcbWindowSurface : public QWindowSurface +#include "qxcbobject.h" + +class QXcbWindowSurface : public QXcbObject, public QWindowSurface { public: QXcbWindowSurface(QWidget *widget, bool setDefaultSurface = true); diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index cbbda0d..f63495c 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -12,6 +12,7 @@ SOURCES = \ qxcbwindowsurface.cpp HEADERS = \ + qxcbobject.h \ qxcbintegration.h \ qxcbconnection.h \ qxcbscreen.h \ -- cgit v0.12 From 988d67957fdb7f5b50c8bff6c70e2ae299f7744c Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Tue, 8 Feb 2011 10:35:08 +0100 Subject: Remove useless function. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Samuel Rødal --- src/gui/painting/qunifiedtoolbarsurface_mac.cpp | 5 ----- src/gui/painting/qunifiedtoolbarsurface_mac_p.h | 1 - 2 files changed, 6 deletions(-) diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp index 5f52679..36b3e6a 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp +++ b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp @@ -92,11 +92,6 @@ void QUnifiedToolbarSurface::recursiveRedirect(QObject *object, const QPoint &of } } -void QUnifiedToolbarSurface::updateRedirection(QWidget *widget) -{ - recursiveRedirect(widget, widget->d_func()->toolbar_offset); -} - void QUnifiedToolbarSurface::insertToolbar(QWidget *toolbar, const QPoint &offset) { setGeometry(QRect(QPoint(0, 0), QSize(offset.x() + toolbar->width(), 100))); // FIXME diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h index 6e40a17..54f0f8e 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h +++ b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h @@ -82,7 +82,6 @@ public: void setGeometry(const QRect &rect); void beginPaint(const QRegion &rgn); void insertToolbar(QWidget *toolbar, const QPoint &offset); - void updateRedirection(QWidget *widget); void updateToolbarOffset(QWidget *widget); QPaintDevice *paintDevice(); -- cgit v0.12 From e7c3a905637a157d4989682c49b7c5691071eb81 Mon Sep 17 00:00:00 2001 From: Fabien Freling Date: Tue, 8 Feb 2011 10:43:10 +0100 Subject: Force the repaint during live resize. During live resize on Mac, it is important to keep up with the resizing of the window, or the application looks sluggish. Calling update() is not enough, since we then are lagging behind the system by going through the event loop. Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qcocoawindowdelegate_mac.mm | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm index 6ce7b35..55f2db6 100644 --- a/src/gui/kernel/qcocoawindowdelegate_mac.mm +++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm @@ -215,6 +215,11 @@ static void cleanupCocoaWindowDelegate() QWidgetPrivate::qt_mac_update_sizer(qwidget); [self syncSizeForWidget:qwidget toSize:newSize fromSize:oldSize]; } + + // We force the repaint to be synchronized with the resize of the window. + // Otherwise, the resize looks sluggish because we paint one event loop later. + if ([[window contentView] inLiveResize]) + qwidget->repaint(); } - (void)windowDidMove:(NSNotification *)notification -- cgit v0.12 From 6a4ef30a8f585a3dc20b337eb336ab028c97ddb7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 8 Feb 2011 14:34:52 +0100 Subject: Optimized XCB window surface using partial updates and shared images. --- src/plugins/platforms/xcb/qxcbconnection.cpp | 1 - src/plugins/platforms/xcb/qxcbwindow.cpp | 12 +- src/plugins/platforms/xcb/qxcbwindowsurface.cpp | 149 ++++++++++++++++++++---- src/plugins/platforms/xcb/qxcbwindowsurface.h | 8 +- src/plugins/platforms/xcb/xcb.pro | 2 +- 5 files changed, 138 insertions(+), 34 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 023f673..70c6a63 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -111,7 +111,6 @@ void QXcbConnection::eventDispatcher() HANDLE_PLATFORM_WINDOW_EVENT(xcb_client_message_event_t, window, handleClientMessageEvent); default: break; - } } } diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index c7bcd38..6dfccba 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -96,8 +96,6 @@ QXcbWindow::QXcbWindow(QWidget *tlw) 32, sizeof(properties) / sizeof(xcb_atom_t), properties); - - printf("m_window: %d\n", m_window); } QXcbWindow::~QXcbWindow() @@ -164,12 +162,12 @@ void QXcbWindow::requestActivateWindow() void QXcbWindow::handleExposeEvent(xcb_expose_event_t *event) { - if (event->count != 0) - return; - QWindowSurface *surface = widget()->windowSurface(); - if (surface) - surface->flush(widget(), widget()->geometry(), QPoint()); + if (surface) { + QRect rect(event->x, event->y, event->width, event->height); + + surface->flush(widget(), rect, QPoint()); + } } void QXcbWindow::handleClientMessageEvent(xcb_client_message_event_t *event) diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp index e3b2c6c..513de08 100644 --- a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp @@ -45,13 +45,119 @@ #include "qxcbscreen.h" #include "qxcbwindow.h" +#include +#include + +#include +#include + #include +class QXcbShmImage : public QXcbObject +{ +public: + QXcbShmImage(QXcbScreen *connection, const QSize &size); + ~QXcbShmImage() { destroy(); } + + QImage *image() { return &m_qimage; } + + void put(xcb_window_t window, const QPoint &dst, const QRect &source); + void preparePaint(const QRegion ®ion); + +private: + void destroy(); + + xcb_shm_segment_info_t m_shm_info; + + xcb_image_t *m_xcb_image; + + QImage m_qimage; + + xcb_gcontext_t m_gc; + xcb_window_t m_gc_window; + + QRegion m_dirty; +}; + +QXcbShmImage::QXcbShmImage(QXcbScreen *screen, const QSize &size) + : QXcbObject(screen->connection()) + , m_gc(0) + , m_gc_window(0) +{ + m_xcb_image = xcb_image_create_native(xcb_connection(), + size.width(), + size.height(), + XCB_IMAGE_FORMAT_Z_PIXMAP, + screen->depth(), + 0, + ~0, + 0); + m_shm_info.shmid = shmget (IPC_PRIVATE, + m_xcb_image->stride * m_xcb_image->height, IPC_CREAT|0777); + + m_shm_info.shmaddr = m_xcb_image->data = (quint8 *)shmat (m_shm_info.shmid, 0, 0); + m_shm_info.shmseg = xcb_generate_id(xcb_connection()); + + xcb_shm_attach(xcb_connection(), m_shm_info.shmseg, m_shm_info.shmid, false); + + m_qimage = QImage( (uchar*) m_xcb_image->data, m_xcb_image->width, m_xcb_image->height, m_xcb_image->stride, screen->format()); +} + +void QXcbShmImage::destroy() +{ + xcb_shm_detach(xcb_connection(), m_shm_info.shmseg); + xcb_image_destroy(m_xcb_image); + shmdt(m_shm_info.shmaddr); + shmctl(m_shm_info.shmid, IPC_RMID, 0); + + xcb_free_gc(xcb_connection(), m_gc); +} + +void QXcbShmImage::put(xcb_window_t window, const QPoint &target, const QRect &source) +{ + if (m_gc_window != window) { + xcb_free_gc(xcb_connection(), m_gc); + + m_gc = xcb_generate_id(xcb_connection()); + xcb_create_gc(xcb_connection(), m_gc, window, 0, 0); + + m_gc_window = window; + } + + xcb_image_shm_put(xcb_connection(), + window, + m_gc, + m_xcb_image, + m_shm_info, + source.x(), + source.y(), + target.x(), + target.y(), + source.width(), + source.height(), + false); + + m_dirty = m_dirty | source; + + xcb_flush(xcb_connection()); +} + +void QXcbShmImage::preparePaint(const QRegion ®ion) +{ + // to prevent X from reading from the image region while we're writing to it + if (m_dirty.intersects(region)) { + // from xcb_aux_sync + free(xcb_get_input_focus_reply(xcb_connection(), xcb_get_input_focus(xcb_connection()), 0)); + m_dirty = QRegion(); + } +} + QXcbWindowSurface::QXcbWindowSurface(QWidget *widget, bool setDefaultSurface) : QWindowSurface(widget, setDefaultSurface) + , m_image(0) { setStaticContentsSupport(false); - setPartialUpdateSupport(false); + setPartialUpdateSupport(true); QXcbScreen *screen = static_cast(QPlatformScreen::platformScreenForWidget(widget)); setConnection(screen->connection()); @@ -63,7 +169,12 @@ QXcbWindowSurface::~QXcbWindowSurface() QPaintDevice *QXcbWindowSurface::paintDevice() { - return &m_image; + return m_image->image(); +} + +void QXcbWindowSurface::beginPaint(const QRegion ®ion) +{ + m_image->preparePaint(region); } void QXcbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) @@ -73,42 +184,36 @@ void QXcbWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoi QXcbWindow *window = static_cast(widget->window()->platformWindow()); - m_gc = xcb_generate_id(xcb_connection()); - xcb_create_gc(xcb_connection(), m_gc, window->window(), 0, 0); - - xcb_put_image(xcb_connection(), - XCB_IMAGE_FORMAT_Z_PIXMAP, - window->window(), - m_gc, - m_image.width(), - m_image.height(), - 0, - 0, - 0, - 24, - m_image.numBytes(), - m_image.bits()); + extern QWidgetData* qt_widget_data(QWidget *); + QPoint widgetOffset = qt_qwidget_data(widget)->wrect.topLeft(); - xcb_free_gc(xcb_connection(), m_gc); - xcb_flush(xcb_connection()); + QVector rects = region.rects(); + for (int i = 0; i < rects.size(); ++i) + m_image->put(window->window(), rects.at(i).topLeft() - widgetOffset, rects.at(i).translated(offset)); } void QXcbWindowSurface::resize(const QSize &size) { QWindowSurface::resize(size); - m_image = QImage(size, QImage::Format_RGB32); + + QXcbScreen *screen = static_cast(QPlatformScreen::platformScreenForWidget(window())); + + delete m_image; + m_image = new QXcbShmImage(screen, size); } extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); bool QXcbWindowSurface::scroll(const QRegion &area, int dx, int dy) { - if (m_image.isNull()) + if (m_image->image()->isNull()) return false; + m_image->preparePaint(area); + const QVector rects = area.rects(); for (int i = 0; i < rects.size(); ++i) - qt_scrollRectInImage(m_image, rects.at(i), QPoint(dx, dy)); + qt_scrollRectInImage(*m_image->image(), rects.at(i), QPoint(dx, dy)); return true; } diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.h b/src/plugins/platforms/xcb/qxcbwindowsurface.h index 66b9c29..ee63190 100644 --- a/src/plugins/platforms/xcb/qxcbwindowsurface.h +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.h @@ -48,6 +48,8 @@ #include "qxcbobject.h" +class QXcbShmImage; + class QXcbWindowSurface : public QXcbObject, public QWindowSurface { public: @@ -59,10 +61,10 @@ public: void resize(const QSize &size); bool scroll(const QRegion &area, int dx, int dy); -private: - QImage m_image; + void beginPaint(const QRegion &); - xcb_gcontext_t m_gc; +private: + QXcbShmImage *m_image; }; #endif diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index f63495c..a4f9246 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -19,7 +19,7 @@ HEADERS = \ qxcbwindow.h \ qxcbwindowsurface.h -LIBS += -lxcb +LIBS += -lxcb -lxcb-image include (../fontdatabases/genericunix/genericunix.pri) -- cgit v0.12 From 9d808132dbf2de191e3d1ab2a1222e584d7ff1bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 8 Feb 2011 14:45:09 +0100 Subject: Made XCB report correct physical size. --- src/plugins/platforms/xcb/qxcbscreen.cpp | 5 +++++ src/plugins/platforms/xcb/qxcbscreen.h | 1 + 2 files changed, 6 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 1adde6b..a9a24dd 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -75,3 +75,8 @@ QImage::Format QXcbScreen::format() const { return QImage::Format_RGB32; } + +QSize QXcbScreen::physicalSize() const +{ + return QSize(m_screen->width_in_millimeters, m_screen->height_in_millimeters); +} diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index 88de1a8..abebcd9 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -59,6 +59,7 @@ public: QRect geometry() const; int depth() const; QImage::Format format() const; + QSize physicalSize() const; xcb_screen_t *screen() const { return m_screen; } xcb_window_t root() const { return m_screen->root; } -- cgit v0.12 From 6c19992488d1aa820e860575533f2e2c1d3351d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 8 Feb 2011 16:07:19 +0100 Subject: Initial key event handling for XCB backend. As there is no XLookupString equivalent in XCB, the key handling is still incomplete. --- src/plugins/platforms/xcb/qxcbconnection.cpp | 28 + src/plugins/platforms/xcb/qxcbconnection.h | 6 + src/plugins/platforms/xcb/qxcbkeyboard.cpp | 949 +++++++++++++++++++++++++++ src/plugins/platforms/xcb/qxcbkeyboard.h | 79 +++ src/plugins/platforms/xcb/qxcbscreen.cpp | 11 + src/plugins/platforms/xcb/qxcbwindow.cpp | 38 +- src/plugins/platforms/xcb/qxcbwindow.h | 17 +- src/plugins/platforms/xcb/xcb.pro | 14 +- 8 files changed, 1124 insertions(+), 18 deletions(-) create mode 100644 src/plugins/platforms/xcb/qxcbkeyboard.cpp create mode 100644 src/plugins/platforms/xcb/qxcbkeyboard.h diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 70c6a63..2977d76 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include "qxcbconnection.h" +#include "qxcbkeyboard.h" #include "qxcbscreen.h" #include "qxcbwindow.h" @@ -67,6 +68,8 @@ QXcbConnection::QXcbConnection(const char *displayName) QSocketNotifier *socket = new QSocketNotifier(xcb_get_file_descriptor(xcb_connection()), QSocketNotifier::Read, this); connect(socket, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); + m_keyboard = new QXcbKeyboard(this); + initializeAllAtoms(); } @@ -75,6 +78,8 @@ QXcbConnection::~QXcbConnection() qDeleteAll(m_screens); xcb_disconnect(xcb_connection()); + + delete m_keyboard; } QXcbWindow *platformWindowFromId(xcb_window_t id) @@ -93,6 +98,14 @@ QXcbWindow *platformWindowFromId(xcb_window_t id) } \ break; +#define HANDLE_KEYBOARD_EVENT(event_t, handler) \ +{ \ + event_t *e = (event_t *)event; \ + if (QXcbWindow *platformWindow = platformWindowFromId(e->event)) \ + m_keyboard->handler(platformWindow->widget(), e); \ +} \ +break; + void QXcbConnection::eventDispatcher() { while (xcb_generic_event_t *event = xcb_poll_for_event(xcb_connection())) { @@ -109,6 +122,21 @@ void QXcbConnection::eventDispatcher() HANDLE_PLATFORM_WINDOW_EVENT(xcb_configure_notify_event_t, event, handleConfigureNotifyEvent); case XCB_CLIENT_MESSAGE: HANDLE_PLATFORM_WINDOW_EVENT(xcb_client_message_event_t, window, handleClientMessageEvent); + case XCB_ENTER_NOTIFY: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_enter_notify_event_t, event, handleEnterNotifyEvent); + case XCB_LEAVE_NOTIFY: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_leave_notify_event_t, event, handleLeaveNotifyEvent); + case XCB_FOCUS_IN: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_focus_in_event_t, event, handleFocusInEvent); + case XCB_FOCUS_OUT: + HANDLE_PLATFORM_WINDOW_EVENT(xcb_focus_out_event_t, event, handleFocusOutEvent); + case XCB_KEY_PRESS: + HANDLE_KEYBOARD_EVENT(xcb_key_press_event_t, handleKeyPressEvent); + case XCB_KEY_RELEASE: + HANDLE_KEYBOARD_EVENT(xcb_key_release_event_t, handleKeyReleaseEvent); + case XCB_MAPPING_NOTIFY: + m_keyboard->handleMappingNotifyEvent((xcb_mapping_notify_event_t *)event); + break; default: break; } diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 9fb641e..97f9ba5 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -212,6 +212,8 @@ namespace QXcbAtom { }; } +class QXcbKeyboard; + class QXcbConnection : public QObject { Q_OBJECT @@ -228,6 +230,8 @@ public: xcb_connection_t *xcb_connection() const { return m_connection; } + QXcbKeyboard *keyboard() const { return m_keyboard; } + private slots: void eventDispatcher(); @@ -243,6 +247,8 @@ private: xcb_atom_t m_allAtoms[QXcbAtom::NAtoms]; QByteArray m_displayName; + + QXcbKeyboard *m_keyboard; }; #endif diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp new file mode 100644 index 0000000..b226e3e --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -0,0 +1,949 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qxcbkeyboard.h" + +#include + +#include + +#include +#include + +#include + +#ifndef XK_ISO_Left_Tab +#define XK_ISO_Left_Tab 0xFE20 +#endif + +#ifndef XK_dead_hook +#define XK_dead_hook 0xFE61 +#endif + +#ifndef XK_dead_horn +#define XK_dead_horn 0xFE62 +#endif + +#ifndef XK_Codeinput +#define XK_Codeinput 0xFF37 +#endif + +#ifndef XK_Kanji_Bangou +#define XK_Kanji_Bangou 0xFF37 /* same as codeinput */ +#endif + +// Fix old X libraries +#ifndef XK_KP_Home +#define XK_KP_Home 0xFF95 +#endif +#ifndef XK_KP_Left +#define XK_KP_Left 0xFF96 +#endif +#ifndef XK_KP_Up +#define XK_KP_Up 0xFF97 +#endif +#ifndef XK_KP_Right +#define XK_KP_Right 0xFF98 +#endif +#ifndef XK_KP_Down +#define XK_KP_Down 0xFF99 +#endif +#ifndef XK_KP_Prior +#define XK_KP_Prior 0xFF9A +#endif +#ifndef XK_KP_Next +#define XK_KP_Next 0xFF9B +#endif +#ifndef XK_KP_End +#define XK_KP_End 0xFF9C +#endif +#ifndef XK_KP_Insert +#define XK_KP_Insert 0xFF9E +#endif +#ifndef XK_KP_Delete +#define XK_KP_Delete 0xFF9F +#endif + +// the next lines are taken on 10/2009 from X.org (X11/XF86keysym.h), defining some special +// multimedia keys. They are included here as not every system has them. +#define XF86XK_MonBrightnessUp 0x1008FF02 +#define XF86XK_MonBrightnessDown 0x1008FF03 +#define XF86XK_KbdLightOnOff 0x1008FF04 +#define XF86XK_KbdBrightnessUp 0x1008FF05 +#define XF86XK_KbdBrightnessDown 0x1008FF06 +#define XF86XK_Standby 0x1008FF10 +#define XF86XK_AudioLowerVolume 0x1008FF11 +#define XF86XK_AudioMute 0x1008FF12 +#define XF86XK_AudioRaiseVolume 0x1008FF13 +#define XF86XK_AudioPlay 0x1008FF14 +#define XF86XK_AudioStop 0x1008FF15 +#define XF86XK_AudioPrev 0x1008FF16 +#define XF86XK_AudioNext 0x1008FF17 +#define XF86XK_HomePage 0x1008FF18 +#define XF86XK_Mail 0x1008FF19 +#define XF86XK_Start 0x1008FF1A +#define XF86XK_Search 0x1008FF1B +#define XF86XK_AudioRecord 0x1008FF1C +#define XF86XK_Calculator 0x1008FF1D +#define XF86XK_Memo 0x1008FF1E +#define XF86XK_ToDoList 0x1008FF1F +#define XF86XK_Calendar 0x1008FF20 +#define XF86XK_PowerDown 0x1008FF21 +#define XF86XK_ContrastAdjust 0x1008FF22 +#define XF86XK_Back 0x1008FF26 +#define XF86XK_Forward 0x1008FF27 +#define XF86XK_Stop 0x1008FF28 +#define XF86XK_Refresh 0x1008FF29 +#define XF86XK_PowerOff 0x1008FF2A +#define XF86XK_WakeUp 0x1008FF2B +#define XF86XK_Eject 0x1008FF2C +#define XF86XK_ScreenSaver 0x1008FF2D +#define XF86XK_WWW 0x1008FF2E +#define XF86XK_Sleep 0x1008FF2F +#define XF86XK_Favorites 0x1008FF30 +#define XF86XK_AudioPause 0x1008FF31 +#define XF86XK_AudioMedia 0x1008FF32 +#define XF86XK_MyComputer 0x1008FF33 +#define XF86XK_LightBulb 0x1008FF35 +#define XF86XK_Shop 0x1008FF36 +#define XF86XK_History 0x1008FF37 +#define XF86XK_OpenURL 0x1008FF38 +#define XF86XK_AddFavorite 0x1008FF39 +#define XF86XK_HotLinks 0x1008FF3A +#define XF86XK_BrightnessAdjust 0x1008FF3B +#define XF86XK_Finance 0x1008FF3C +#define XF86XK_Community 0x1008FF3D +#define XF86XK_AudioRewind 0x1008FF3E +#define XF86XK_BackForward 0x1008FF3F +#define XF86XK_Launch0 0x1008FF40 +#define XF86XK_Launch1 0x1008FF41 +#define XF86XK_Launch2 0x1008FF42 +#define XF86XK_Launch3 0x1008FF43 +#define XF86XK_Launch4 0x1008FF44 +#define XF86XK_Launch5 0x1008FF45 +#define XF86XK_Launch6 0x1008FF46 +#define XF86XK_Launch7 0x1008FF47 +#define XF86XK_Launch8 0x1008FF48 +#define XF86XK_Launch9 0x1008FF49 +#define XF86XK_LaunchA 0x1008FF4A +#define XF86XK_LaunchB 0x1008FF4B +#define XF86XK_LaunchC 0x1008FF4C +#define XF86XK_LaunchD 0x1008FF4D +#define XF86XK_LaunchE 0x1008FF4E +#define XF86XK_LaunchF 0x1008FF4F +#define XF86XK_ApplicationLeft 0x1008FF50 +#define XF86XK_ApplicationRight 0x1008FF51 +#define XF86XK_Book 0x1008FF52 +#define XF86XK_CD 0x1008FF53 +#define XF86XK_Calculater 0x1008FF54 +#define XF86XK_Clear 0x1008FF55 +#define XF86XK_ClearGrab 0x1008FE21 +#define XF86XK_Close 0x1008FF56 +#define XF86XK_Copy 0x1008FF57 +#define XF86XK_Cut 0x1008FF58 +#define XF86XK_Display 0x1008FF59 +#define XF86XK_DOS 0x1008FF5A +#define XF86XK_Documents 0x1008FF5B +#define XF86XK_Excel 0x1008FF5C +#define XF86XK_Explorer 0x1008FF5D +#define XF86XK_Game 0x1008FF5E +#define XF86XK_Go 0x1008FF5F +#define XF86XK_iTouch 0x1008FF60 +#define XF86XK_LogOff 0x1008FF61 +#define XF86XK_Market 0x1008FF62 +#define XF86XK_Meeting 0x1008FF63 +#define XF86XK_MenuKB 0x1008FF65 +#define XF86XK_MenuPB 0x1008FF66 +#define XF86XK_MySites 0x1008FF67 +#define XF86XK_News 0x1008FF69 +#define XF86XK_OfficeHome 0x1008FF6A +#define XF86XK_Option 0x1008FF6C +#define XF86XK_Paste 0x1008FF6D +#define XF86XK_Phone 0x1008FF6E +#define XF86XK_Reply 0x1008FF72 +#define XF86XK_Reload 0x1008FF73 +#define XF86XK_RotateWindows 0x1008FF74 +#define XF86XK_RotationPB 0x1008FF75 +#define XF86XK_RotationKB 0x1008FF76 +#define XF86XK_Save 0x1008FF77 +#define XF86XK_Send 0x1008FF7B +#define XF86XK_Spell 0x1008FF7C +#define XF86XK_SplitScreen 0x1008FF7D +#define XF86XK_Support 0x1008FF7E +#define XF86XK_TaskPane 0x1008FF7F +#define XF86XK_Terminal 0x1008FF80 +#define XF86XK_Tools 0x1008FF81 +#define XF86XK_Travel 0x1008FF82 +#define XF86XK_Video 0x1008FF87 +#define XF86XK_Word 0x1008FF89 +#define XF86XK_Xfer 0x1008FF8A +#define XF86XK_ZoomIn 0x1008FF8B +#define XF86XK_ZoomOut 0x1008FF8C +#define XF86XK_Away 0x1008FF8D +#define XF86XK_Messenger 0x1008FF8E +#define XF86XK_WebCam 0x1008FF8F +#define XF86XK_MailForward 0x1008FF90 +#define XF86XK_Pictures 0x1008FF91 +#define XF86XK_Music 0x1008FF92 +#define XF86XK_Battery 0x1008FF93 +#define XF86XK_Bluetooth 0x1008FF94 +#define XF86XK_WLAN 0x1008FF95 +#define XF86XK_UWB 0x1008FF96 +#define XF86XK_AudioForward 0x1008FF97 +#define XF86XK_AudioRepeat 0x1008FF98 +#define XF86XK_AudioRandomPlay 0x1008FF99 +#define XF86XK_Subtitle 0x1008FF9A +#define XF86XK_AudioCycleTrack 0x1008FF9B +#define XF86XK_Time 0x1008FF9F +#define XF86XK_Select 0x1008FFA0 +#define XF86XK_View 0x1008FFA1 +#define XF86XK_TopMenu 0x1008FFA2 +#define XF86XK_Suspend 0x1008FFA7 +#define XF86XK_Hibernate 0x1008FFA8 + + +// end of XF86keysyms.h + +// Special keys used by Qtopia, mapped into the X11 private keypad range. +#define QTOPIAXK_Select 0x11000601 +#define QTOPIAXK_Yes 0x11000602 +#define QTOPIAXK_No 0x11000603 +#define QTOPIAXK_Cancel 0x11000604 +#define QTOPIAXK_Printer 0x11000605 +#define QTOPIAXK_Execute 0x11000606 +#define QTOPIAXK_Sleep 0x11000607 +#define QTOPIAXK_Play 0x11000608 +#define QTOPIAXK_Zoom 0x11000609 +#define QTOPIAXK_Context1 0x1100060A +#define QTOPIAXK_Context2 0x1100060B +#define QTOPIAXK_Context3 0x1100060C +#define QTOPIAXK_Context4 0x1100060D +#define QTOPIAXK_Call 0x1100060E +#define QTOPIAXK_Hangup 0x1100060F +#define QTOPIAXK_Flip 0x11000610 + +// keyboard mapping table +static const unsigned int KeyTbl[] = { + + // misc keys + + XK_Escape, Qt::Key_Escape, + XK_Tab, Qt::Key_Tab, + XK_ISO_Left_Tab, Qt::Key_Backtab, + XK_BackSpace, Qt::Key_Backspace, + XK_Return, Qt::Key_Return, + XK_Insert, Qt::Key_Insert, + XK_Delete, Qt::Key_Delete, + XK_Clear, Qt::Key_Delete, + XK_Pause, Qt::Key_Pause, + XK_Print, Qt::Key_Print, + 0x1005FF60, Qt::Key_SysReq, // hardcoded Sun SysReq + 0x1007ff00, Qt::Key_SysReq, // hardcoded X386 SysReq + + // cursor movement + + XK_Home, Qt::Key_Home, + XK_End, Qt::Key_End, + XK_Left, Qt::Key_Left, + XK_Up, Qt::Key_Up, + XK_Right, Qt::Key_Right, + XK_Down, Qt::Key_Down, + XK_Prior, Qt::Key_PageUp, + XK_Next, Qt::Key_PageDown, + + // modifiers + + XK_Shift_L, Qt::Key_Shift, + XK_Shift_R, Qt::Key_Shift, + XK_Shift_Lock, Qt::Key_Shift, + XK_Control_L, Qt::Key_Control, + XK_Control_R, Qt::Key_Control, + XK_Meta_L, Qt::Key_Meta, + XK_Meta_R, Qt::Key_Meta, + XK_Alt_L, Qt::Key_Alt, + XK_Alt_R, Qt::Key_Alt, + XK_Caps_Lock, Qt::Key_CapsLock, + XK_Num_Lock, Qt::Key_NumLock, + XK_Scroll_Lock, Qt::Key_ScrollLock, + XK_Super_L, Qt::Key_Super_L, + XK_Super_R, Qt::Key_Super_R, + XK_Menu, Qt::Key_Menu, + XK_Hyper_L, Qt::Key_Hyper_L, + XK_Hyper_R, Qt::Key_Hyper_R, + XK_Help, Qt::Key_Help, + 0x1000FF74, Qt::Key_Backtab, // hardcoded HP backtab + 0x1005FF10, Qt::Key_F11, // hardcoded Sun F36 (labeled F11) + 0x1005FF11, Qt::Key_F12, // hardcoded Sun F37 (labeled F12) + + // numeric and function keypad keys + + XK_KP_Space, Qt::Key_Space, + XK_KP_Tab, Qt::Key_Tab, + XK_KP_Enter, Qt::Key_Enter, + //XK_KP_F1, Qt::Key_F1, + //XK_KP_F2, Qt::Key_F2, + //XK_KP_F3, Qt::Key_F3, + //XK_KP_F4, Qt::Key_F4, + XK_KP_Home, Qt::Key_Home, + XK_KP_Left, Qt::Key_Left, + XK_KP_Up, Qt::Key_Up, + XK_KP_Right, Qt::Key_Right, + XK_KP_Down, Qt::Key_Down, + XK_KP_Prior, Qt::Key_PageUp, + XK_KP_Next, Qt::Key_PageDown, + XK_KP_End, Qt::Key_End, + XK_KP_Begin, Qt::Key_Clear, + XK_KP_Insert, Qt::Key_Insert, + XK_KP_Delete, Qt::Key_Delete, + XK_KP_Equal, Qt::Key_Equal, + XK_KP_Multiply, Qt::Key_Asterisk, + XK_KP_Add, Qt::Key_Plus, + XK_KP_Separator, Qt::Key_Comma, + XK_KP_Subtract, Qt::Key_Minus, + XK_KP_Decimal, Qt::Key_Period, + XK_KP_Divide, Qt::Key_Slash, + + // International input method support keys + + // International & multi-key character composition + XK_ISO_Level3_Shift, Qt::Key_AltGr, + XK_Multi_key, Qt::Key_Multi_key, + XK_Codeinput, Qt::Key_Codeinput, + XK_SingleCandidate, Qt::Key_SingleCandidate, + XK_MultipleCandidate, Qt::Key_MultipleCandidate, + XK_PreviousCandidate, Qt::Key_PreviousCandidate, + + // Misc Functions + XK_Mode_switch, Qt::Key_Mode_switch, + XK_script_switch, Qt::Key_Mode_switch, + + // Japanese keyboard support + XK_Kanji, Qt::Key_Kanji, + XK_Muhenkan, Qt::Key_Muhenkan, + //XK_Henkan_Mode, Qt::Key_Henkan_Mode, + XK_Henkan_Mode, Qt::Key_Henkan, + XK_Henkan, Qt::Key_Henkan, + XK_Romaji, Qt::Key_Romaji, + XK_Hiragana, Qt::Key_Hiragana, + XK_Katakana, Qt::Key_Katakana, + XK_Hiragana_Katakana, Qt::Key_Hiragana_Katakana, + XK_Zenkaku, Qt::Key_Zenkaku, + XK_Hankaku, Qt::Key_Hankaku, + XK_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku, + XK_Touroku, Qt::Key_Touroku, + XK_Massyo, Qt::Key_Massyo, + XK_Kana_Lock, Qt::Key_Kana_Lock, + XK_Kana_Shift, Qt::Key_Kana_Shift, + XK_Eisu_Shift, Qt::Key_Eisu_Shift, + XK_Eisu_toggle, Qt::Key_Eisu_toggle, + //XK_Kanji_Bangou, Qt::Key_Kanji_Bangou, + //XK_Zen_Koho, Qt::Key_Zen_Koho, + //XK_Mae_Koho, Qt::Key_Mae_Koho, + XK_Kanji_Bangou, Qt::Key_Codeinput, + XK_Zen_Koho, Qt::Key_MultipleCandidate, + XK_Mae_Koho, Qt::Key_PreviousCandidate, + +#ifdef XK_KOREAN + // Korean keyboard support + XK_Hangul, Qt::Key_Hangul, + XK_Hangul_Start, Qt::Key_Hangul_Start, + XK_Hangul_End, Qt::Key_Hangul_End, + XK_Hangul_Hanja, Qt::Key_Hangul_Hanja, + XK_Hangul_Jamo, Qt::Key_Hangul_Jamo, + XK_Hangul_Romaja, Qt::Key_Hangul_Romaja, + //XK_Hangul_Codeinput, Qt::Key_Hangul_Codeinput, + XK_Hangul_Codeinput, Qt::Key_Codeinput, + XK_Hangul_Jeonja, Qt::Key_Hangul_Jeonja, + XK_Hangul_Banja, Qt::Key_Hangul_Banja, + XK_Hangul_PreHanja, Qt::Key_Hangul_PreHanja, + XK_Hangul_PostHanja, Qt::Key_Hangul_PostHanja, + //XK_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate, + //XK_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate, + //XK_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate, + XK_Hangul_SingleCandidate, Qt::Key_SingleCandidate, + XK_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate, + XK_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate, + XK_Hangul_Special, Qt::Key_Hangul_Special, + //XK_Hangul_switch, Qt::Key_Hangul_switch, + XK_Hangul_switch, Qt::Key_Mode_switch, +#endif // XK_KOREAN + + // dead keys + XK_dead_grave, Qt::Key_Dead_Grave, + XK_dead_acute, Qt::Key_Dead_Acute, + XK_dead_circumflex, Qt::Key_Dead_Circumflex, + XK_dead_tilde, Qt::Key_Dead_Tilde, + XK_dead_macron, Qt::Key_Dead_Macron, + XK_dead_breve, Qt::Key_Dead_Breve, + XK_dead_abovedot, Qt::Key_Dead_Abovedot, + XK_dead_diaeresis, Qt::Key_Dead_Diaeresis, + XK_dead_abovering, Qt::Key_Dead_Abovering, + XK_dead_doubleacute, Qt::Key_Dead_Doubleacute, + XK_dead_caron, Qt::Key_Dead_Caron, + XK_dead_cedilla, Qt::Key_Dead_Cedilla, + XK_dead_ogonek, Qt::Key_Dead_Ogonek, + XK_dead_iota, Qt::Key_Dead_Iota, + XK_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound, + XK_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound, + XK_dead_belowdot, Qt::Key_Dead_Belowdot, + XK_dead_hook, Qt::Key_Dead_Hook, + XK_dead_horn, Qt::Key_Dead_Horn, + + // Special keys from X.org - This include multimedia keys, + // wireless/bluetooth/uwb keys, special launcher keys, etc. + XF86XK_Back, Qt::Key_Back, + XF86XK_Forward, Qt::Key_Forward, + XF86XK_Stop, Qt::Key_Stop, + XF86XK_Refresh, Qt::Key_Refresh, + XF86XK_Favorites, Qt::Key_Favorites, + XF86XK_AudioMedia, Qt::Key_LaunchMedia, + XF86XK_OpenURL, Qt::Key_OpenUrl, + XF86XK_HomePage, Qt::Key_HomePage, + XF86XK_Search, Qt::Key_Search, + XF86XK_AudioLowerVolume, Qt::Key_VolumeDown, + XF86XK_AudioMute, Qt::Key_VolumeMute, + XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp, + XF86XK_AudioPlay, Qt::Key_MediaPlay, + XF86XK_AudioStop, Qt::Key_MediaStop, + XF86XK_AudioPrev, Qt::Key_MediaPrevious, + XF86XK_AudioNext, Qt::Key_MediaNext, + XF86XK_AudioRecord, Qt::Key_MediaRecord, + XF86XK_Mail, Qt::Key_LaunchMail, + XF86XK_MyComputer, Qt::Key_Launch0, // ### Qt 5: remap properly + XF86XK_Calculator, Qt::Key_Launch1, + XF86XK_Memo, Qt::Key_Memo, + XF86XK_ToDoList, Qt::Key_ToDoList, + XF86XK_Calendar, Qt::Key_Calendar, + XF86XK_PowerDown, Qt::Key_PowerDown, + XF86XK_ContrastAdjust, Qt::Key_ContrastAdjust, + XF86XK_Standby, Qt::Key_Standby, + XF86XK_MonBrightnessUp, Qt::Key_MonBrightnessUp, + XF86XK_MonBrightnessDown, Qt::Key_MonBrightnessDown, + XF86XK_KbdLightOnOff, Qt::Key_KeyboardLightOnOff, + XF86XK_KbdBrightnessUp, Qt::Key_KeyboardBrightnessUp, + XF86XK_KbdBrightnessDown, Qt::Key_KeyboardBrightnessDown, + XF86XK_PowerOff, Qt::Key_PowerOff, + XF86XK_WakeUp, Qt::Key_WakeUp, + XF86XK_Eject, Qt::Key_Eject, + XF86XK_ScreenSaver, Qt::Key_ScreenSaver, + XF86XK_WWW, Qt::Key_WWW, + XF86XK_Sleep, Qt::Key_Sleep, + XF86XK_LightBulb, Qt::Key_LightBulb, + XF86XK_Shop, Qt::Key_Shop, + XF86XK_History, Qt::Key_History, + XF86XK_AddFavorite, Qt::Key_AddFavorite, + XF86XK_HotLinks, Qt::Key_HotLinks, + XF86XK_BrightnessAdjust, Qt::Key_BrightnessAdjust, + XF86XK_Finance, Qt::Key_Finance, + XF86XK_Community, Qt::Key_Community, + XF86XK_AudioRewind, Qt::Key_AudioRewind, + XF86XK_BackForward, Qt::Key_BackForward, + XF86XK_ApplicationLeft, Qt::Key_ApplicationLeft, + XF86XK_ApplicationRight, Qt::Key_ApplicationRight, + XF86XK_Book, Qt::Key_Book, + XF86XK_CD, Qt::Key_CD, + XF86XK_Calculater, Qt::Key_Calculator, + XF86XK_Clear, Qt::Key_Clear, + XF86XK_ClearGrab, Qt::Key_ClearGrab, + XF86XK_Close, Qt::Key_Close, + XF86XK_Copy, Qt::Key_Copy, + XF86XK_Cut, Qt::Key_Cut, + XF86XK_Display, Qt::Key_Display, + XF86XK_DOS, Qt::Key_DOS, + XF86XK_Documents, Qt::Key_Documents, + XF86XK_Excel, Qt::Key_Excel, + XF86XK_Explorer, Qt::Key_Explorer, + XF86XK_Game, Qt::Key_Game, + XF86XK_Go, Qt::Key_Go, + XF86XK_iTouch, Qt::Key_iTouch, + XF86XK_LogOff, Qt::Key_LogOff, + XF86XK_Market, Qt::Key_Market, + XF86XK_Meeting, Qt::Key_Meeting, + XF86XK_MenuKB, Qt::Key_MenuKB, + XF86XK_MenuPB, Qt::Key_MenuPB, + XF86XK_MySites, Qt::Key_MySites, + XF86XK_News, Qt::Key_News, + XF86XK_OfficeHome, Qt::Key_OfficeHome, + XF86XK_Option, Qt::Key_Option, + XF86XK_Paste, Qt::Key_Paste, + XF86XK_Phone, Qt::Key_Phone, + XF86XK_Reply, Qt::Key_Reply, + XF86XK_Reload, Qt::Key_Reload, + XF86XK_RotateWindows, Qt::Key_RotateWindows, + XF86XK_RotationPB, Qt::Key_RotationPB, + XF86XK_RotationKB, Qt::Key_RotationKB, + XF86XK_Save, Qt::Key_Save, + XF86XK_Send, Qt::Key_Send, + XF86XK_Spell, Qt::Key_Spell, + XF86XK_SplitScreen, Qt::Key_SplitScreen, + XF86XK_Support, Qt::Key_Support, + XF86XK_TaskPane, Qt::Key_TaskPane, + XF86XK_Terminal, Qt::Key_Terminal, + XF86XK_Tools, Qt::Key_Tools, + XF86XK_Travel, Qt::Key_Travel, + XF86XK_Video, Qt::Key_Video, + XF86XK_Word, Qt::Key_Word, + XF86XK_Xfer, Qt::Key_Xfer, + XF86XK_ZoomIn, Qt::Key_ZoomIn, + XF86XK_ZoomOut, Qt::Key_ZoomOut, + XF86XK_Away, Qt::Key_Away, + XF86XK_Messenger, Qt::Key_Messenger, + XF86XK_WebCam, Qt::Key_WebCam, + XF86XK_MailForward, Qt::Key_MailForward, + XF86XK_Pictures, Qt::Key_Pictures, + XF86XK_Music, Qt::Key_Music, + XF86XK_Battery, Qt::Key_Battery, + XF86XK_Bluetooth, Qt::Key_Bluetooth, + XF86XK_WLAN, Qt::Key_WLAN, + XF86XK_UWB, Qt::Key_UWB, + XF86XK_AudioForward, Qt::Key_AudioForward, + XF86XK_AudioRepeat, Qt::Key_AudioRepeat, + XF86XK_AudioRandomPlay, Qt::Key_AudioRandomPlay, + XF86XK_Subtitle, Qt::Key_Subtitle, + XF86XK_AudioCycleTrack, Qt::Key_AudioCycleTrack, + XF86XK_Time, Qt::Key_Time, + XF86XK_Select, Qt::Key_Select, + XF86XK_View, Qt::Key_View, + XF86XK_TopMenu, Qt::Key_TopMenu, + XF86XK_Bluetooth, Qt::Key_Bluetooth, + XF86XK_Suspend, Qt::Key_Suspend, + XF86XK_Hibernate, Qt::Key_Hibernate, + XF86XK_Launch0, Qt::Key_Launch2, // ### Qt 5: remap properly + XF86XK_Launch1, Qt::Key_Launch3, + XF86XK_Launch2, Qt::Key_Launch4, + XF86XK_Launch3, Qt::Key_Launch5, + XF86XK_Launch4, Qt::Key_Launch6, + XF86XK_Launch5, Qt::Key_Launch7, + XF86XK_Launch6, Qt::Key_Launch8, + XF86XK_Launch7, Qt::Key_Launch9, + XF86XK_Launch8, Qt::Key_LaunchA, + XF86XK_Launch9, Qt::Key_LaunchB, + XF86XK_LaunchA, Qt::Key_LaunchC, + XF86XK_LaunchB, Qt::Key_LaunchD, + XF86XK_LaunchC, Qt::Key_LaunchE, + XF86XK_LaunchD, Qt::Key_LaunchF, + XF86XK_LaunchE, Qt::Key_LaunchG, + XF86XK_LaunchF, Qt::Key_LaunchH, + + // Qtopia keys + QTOPIAXK_Select, Qt::Key_Select, + QTOPIAXK_Yes, Qt::Key_Yes, + QTOPIAXK_No, Qt::Key_No, + QTOPIAXK_Cancel, Qt::Key_Cancel, + QTOPIAXK_Printer, Qt::Key_Printer, + QTOPIAXK_Execute, Qt::Key_Execute, + QTOPIAXK_Sleep, Qt::Key_Sleep, + QTOPIAXK_Play, Qt::Key_Play, + QTOPIAXK_Zoom, Qt::Key_Zoom, + QTOPIAXK_Context1, Qt::Key_Context1, + QTOPIAXK_Context2, Qt::Key_Context2, + QTOPIAXK_Context3, Qt::Key_Context3, + QTOPIAXK_Context4, Qt::Key_Context4, + QTOPIAXK_Call, Qt::Key_Call, + QTOPIAXK_Hangup, Qt::Key_Hangup, + QTOPIAXK_Flip, Qt::Key_Flip, + + 0, 0 +}; + +static const unsigned short katakanaKeysymsToUnicode[] = { + 0x0000, 0x3002, 0x300C, 0x300D, 0x3001, 0x30FB, 0x30F2, 0x30A1, + 0x30A3, 0x30A5, 0x30A7, 0x30A9, 0x30E3, 0x30E5, 0x30E7, 0x30C3, + 0x30FC, 0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30AB, 0x30AD, + 0x30AF, 0x30B1, 0x30B3, 0x30B5, 0x30B7, 0x30B9, 0x30BB, 0x30BD, + 0x30BF, 0x30C1, 0x30C4, 0x30C6, 0x30C8, 0x30CA, 0x30CB, 0x30CC, + 0x30CD, 0x30CE, 0x30CF, 0x30D2, 0x30D5, 0x30D8, 0x30DB, 0x30DE, + 0x30DF, 0x30E0, 0x30E1, 0x30E2, 0x30E4, 0x30E6, 0x30E8, 0x30E9, + 0x30EA, 0x30EB, 0x30EC, 0x30ED, 0x30EF, 0x30F3, 0x309B, 0x309C +}; + +static const unsigned short cyrillicKeysymsToUnicode[] = { + 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, + 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0000, 0x045e, 0x045f, + 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, + 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0000, 0x040e, 0x040f, + 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, + 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, + 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, + 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, + 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, + 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, + 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, + 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a +}; + +static const unsigned short greekKeysymsToUnicode[] = { + 0x0000, 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, + 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, + 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, + 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, + 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, + 0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, + 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, + 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, + 0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, + 0x03c8, 0x03c9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short technicalKeysymsToUnicode[] = { + 0x0000, 0x23B7, 0x250C, 0x2500, 0x2320, 0x2321, 0x2502, 0x23A1, + 0x23A3, 0x23A4, 0x23A6, 0x239B, 0x239D, 0x239E, 0x23A0, 0x23A8, + 0x23AC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222B, + 0x2234, 0x221D, 0x221E, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, + 0x223C, 0x2243, 0x0000, 0x0000, 0x0000, 0x21D4, 0x21D2, 0x2261, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221A, 0x0000, + 0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222A, 0x2227, 0x2228, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2202, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, + 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193, 0x0000 +}; + +static const unsigned short specialKeysymsToUnicode[] = { + 0x25C6, 0x2592, 0x2409, 0x240C, 0x240D, 0x240A, 0x0000, 0x0000, + 0x2424, 0x240B, 0x2518, 0x2510, 0x250C, 0x2514, 0x253C, 0x23BA, + 0x23BB, 0x2500, 0x23BC, 0x23BD, 0x251C, 0x2524, 0x2534, 0x252C, + 0x2502, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short publishingKeysymsToUnicode[] = { + 0x0000, 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, + 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, + 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, + 0x2105, 0x0000, 0x0000, 0x2012, 0x2329, 0x0000, 0x232a, 0x0000, + 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, + 0x0000, 0x2122, 0x2613, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25af, + 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x0000, 0x2032, 0x2033, + 0x0000, 0x271d, 0x0000, 0x25ac, 0x25c0, 0x25b6, 0x25cf, 0x25ae, + 0x25e6, 0x25ab, 0x25ad, 0x25b3, 0x25bd, 0x2606, 0x2022, 0x25aa, + 0x25b2, 0x25bc, 0x261c, 0x261e, 0x2663, 0x2666, 0x2665, 0x0000, + 0x2720, 0x2020, 0x2021, 0x2713, 0x2717, 0x266f, 0x266d, 0x2642, + 0x2640, 0x260e, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e, 0x0000 +}; + +static const unsigned short aplKeysymsToUnicode[] = { + 0x0000, 0x0000, 0x0000, 0x003c, 0x0000, 0x0000, 0x003e, 0x0000, + 0x2228, 0x2227, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x00af, 0x0000, 0x22a5, 0x2229, 0x230a, 0x0000, 0x005f, 0x0000, + 0x0000, 0x0000, 0x2218, 0x0000, 0x2395, 0x0000, 0x22a4, 0x25cb, + 0x0000, 0x0000, 0x0000, 0x2308, 0x0000, 0x0000, 0x222a, 0x0000, + 0x2283, 0x0000, 0x2282, 0x0000, 0x22a2, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x22a3, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short koreanKeysymsToUnicode[] = { + 0x0000, 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, + 0x3138, 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, + 0x3140, 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, + 0x3148, 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, + 0x3150, 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, + 0x3158, 0x3159, 0x315a, 0x315b, 0x315c, 0x315d, 0x315e, 0x315f, + 0x3160, 0x3161, 0x3162, 0x3163, 0x11a8, 0x11a9, 0x11aa, 0x11ab, + 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, + 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, + 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x316d, + 0x3171, 0x3178, 0x317f, 0x3181, 0x3184, 0x3186, 0x318d, 0x318e, + 0x11eb, 0x11f0, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9 +}; + +static QChar keysymToUnicode(unsigned char byte3, unsigned char byte4) +{ + switch (byte3) { + case 0x04: + // katakana + if (byte4 > 0xa0 && byte4 < 0xe0) + return QChar(katakanaKeysymsToUnicode[byte4 - 0xa0]); + else if (byte4 == 0x7e) + return QChar(0x203e); // Overline + break; + case 0x06: + // russian, use lookup table + if (byte4 > 0xa0) + return QChar(cyrillicKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x07: + // greek + if (byte4 > 0xa0) + return QChar(greekKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x08: + // technical + if (byte4 > 0xa0) + return QChar(technicalKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x09: + // special + if (byte4 >= 0xe0) + return QChar(specialKeysymsToUnicode[byte4 - 0xe0]); + break; + case 0x0a: + // publishing + if (byte4 > 0xa0) + return QChar(publishingKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x0b: + // APL + if (byte4 > 0xa0) + return QChar(aplKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x0e: + // Korean + if (byte4 > 0xa0) + return QChar(koreanKeysymsToUnicode[byte4 - 0xa0]); + break; + default: + break; + } + return QChar(0x0); +} + +Qt::KeyboardModifiers QXcbKeyboard::translateModifiers(int s) +{ + Qt::KeyboardModifiers ret = 0; + if (s & XCB_MOD_MASK_SHIFT) + ret |= Qt::ShiftModifier; + if (s & XCB_MOD_MASK_CONTROL) + ret |= Qt::ControlModifier; + if (s & m_alt_mask) + ret |= Qt::AltModifier; + if (s & m_meta_mask) + ret |= Qt::MetaModifier; + return ret; +} + +int QXcbKeyboard::translateKeySym(uint key) const +{ + int code = -1; + int i = 0; // any other keys + while (KeyTbl[i]) { + if (key == KeyTbl[i]) { + code = (int)KeyTbl[i+1]; + break; + } + i += 2; + } + if (m_meta_mask) { + // translate Super/Hyper keys to Meta if we're using them as the MetaModifier + if (m_meta_mask == m_super_mask && (code == Qt::Key_Super_L || code == Qt::Key_Super_R)) { + code = Qt::Key_Meta; + } else if (m_meta_mask == m_hyper_mask && (code == Qt::Key_Hyper_L || code == Qt::Key_Hyper_R)) { + code = Qt::Key_Meta; + } + } + return code; +} + +QString QXcbKeyboard::translateKeySym(xcb_keysym_t keysym, uint xmodifiers, + int &code, Qt::KeyboardModifiers &modifiers, + QByteArray &chars, int &count) +{ + // all keysyms smaller than 0xff00 are actally keys that can be mapped to unicode chars + + QTextCodec *mapper = QTextCodec::codecForLocale(); + QChar converted; + + if (/*count == 0 &&*/ keysym < 0xff00) { + unsigned char byte3 = (unsigned char)(keysym >> 8); + int mib = -1; + switch(byte3) { + case 0: // Latin 1 + case 1: // Latin 2 + case 2: //latin 3 + case 3: // latin4 + mib = byte3 + 4; break; + case 5: // arabic + mib = 82; break; + case 12: // Hebrew + mib = 85; break; + case 13: // Thai + mib = 2259; break; + case 4: // kana + case 6: // cyrillic + case 7: // greek + case 8: // technical, no mapping here at the moment + case 9: // Special + case 10: // Publishing + case 11: // APL + case 14: // Korean, no mapping + mib = -1; // manual conversion + mapper= 0; +#if !defined(QT_NO_XIM) + converted = keysymToUnicode(byte3, keysym & 0xff); +#endif + case 0x20: + // currency symbols + if (keysym >= 0x20a0 && keysym <= 0x20ac) { + mib = -1; // manual conversion + mapper = 0; + converted = (uint)keysym; + } + break; + default: + break; + } + if (mib != -1) { + mapper = QTextCodec::codecForMib(mib); + if (chars.isEmpty()) + chars.resize(1); + chars[0] = (unsigned char) (keysym & 0xff); // get only the fourth bit for conversion later + count = 1; + } + } else if (keysym >= 0x1000000 && keysym <= 0x100ffff) { + converted = (ushort) (keysym - 0x1000000); + mapper = 0; + } + if (count < (int)chars.size()-1) + chars[count] = '\0'; + + QString text; + if (!mapper && converted.unicode() != 0x0) { + text = converted; + } else if (!chars.isEmpty()) { + // convert chars (8bit) to text (unicode). + if (mapper) + text = mapper->toUnicode(chars.data(), count, 0); + if (text.isEmpty()) { + // no mapper, or codec couldn't convert to unicode (this + // can happen when running in the C locale or with no LANG + // set). try converting from latin-1 + text = QString::fromLatin1(chars); + } + } + + modifiers = translateModifiers(xmodifiers); + + // Commentary in X11/keysymdef says that X codes match ASCII, so it + // is safe to use the locale functions to process X codes in ISO8859-1. + // + // This is mainly for compatibility - applications should not use the + // Qt keycodes between 128 and 255, but should rather use the + // QKeyEvent::text(). + // + if (keysym < 128 || (keysym < 256 && (!mapper || mapper->mibEnum()==4))) { + // upper-case key, if known + code = isprint((int)keysym) ? toupper((int)keysym) : 0; + } else if (keysym >= XK_F1 && keysym <= XK_F35) { + // function keys + code = Qt::Key_F1 + ((int)keysym - XK_F1); + } else if (keysym >= XK_KP_Space && keysym <= XK_KP_9) { + if (keysym >= XK_KP_0) { + // numeric keypad keys + code = Qt::Key_0 + ((int)keysym - XK_KP_0); + } else { + code = translateKeySym(keysym); + } + modifiers |= Qt::KeypadModifier; + } else if (text.length() == 1 && text.unicode()->unicode() > 0x1f && text.unicode()->unicode() != 0x7f && !(keysym >= XK_dead_grave && keysym <= XK_dead_horn)) { + code = text.unicode()->toUpper().unicode(); + } else { + // any other keys + code = translateKeySym(keysym); + + if (code == Qt::Key_Tab && (modifiers & Qt::ShiftModifier)) { + // map shift+tab to shift+backtab, QShortcutMap knows about it + // and will handle it. + code = Qt::Key_Backtab; + text = QString(); + } + } + + return text; +} + +QXcbKeyboard::QXcbKeyboard(QXcbConnection *connection) + : QXcbObject(connection) + , m_alt_mask(0) + , m_super_mask(0) + , m_hyper_mask(0) + , m_meta_mask(0) +{ + m_key_symbols = xcb_key_symbols_alloc(xcb_connection()); +} + +QXcbKeyboard::~QXcbKeyboard() +{ + xcb_key_symbols_free(m_key_symbols); +} + +void QXcbKeyboard::handleKeyPressEvent(QWidget *widget, const xcb_key_press_event_t *event) +{ + xcb_keysym_t sym = xcb_key_press_lookup_keysym(m_key_symbols, const_cast(event), 0); + + QByteArray chars; + chars.resize(513); + + Qt::KeyboardModifiers modifiers; + int qtcode = 0; + int count = 0; + + QString string = translateKeySym(sym, event->state, qtcode, modifiers, chars, count); + + QWindowSystemInterface::handleKeyEvent(widget, event->time, QEvent::KeyPress, qtcode, modifiers, string.left(count)); +} + +void QXcbKeyboard::handleKeyReleaseEvent(QWidget *widget, const xcb_key_release_event_t *event) +{ + xcb_keysym_t sym = xcb_key_release_lookup_keysym(m_key_symbols, const_cast(event), 0); + + QByteArray chars; + chars.resize(513); + + Qt::KeyboardModifiers modifiers; + int qtcode = 0; + int count = 0; + + QString string = translateKeySym(sym, event->state, qtcode, modifiers, chars, count); + + QWindowSystemInterface::handleKeyEvent(widget, event->time, QEvent::KeyRelease, qtcode, modifiers, string.left(count)); +} + +void QXcbKeyboard::handleMappingNotifyEvent(const xcb_mapping_notify_event_t *event) +{ + xcb_refresh_keyboard_mapping(m_key_symbols, const_cast(event)); +} diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h new file mode 100644 index 0000000..dc4175a --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbkeyboard.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QXCBKEYBOARD_H +#define QXCBKEYBOARD_H + +#include "qxcbobject.h" + +#include "xcb/xcb_keysyms.h" + +class QXcbKeyboard : public QXcbObject +{ +public: + QXcbKeyboard(QXcbConnection *connection); + ~QXcbKeyboard(); + + void handleKeyPressEvent(QWidget *widget, const xcb_key_press_event_t *event); + void handleKeyReleaseEvent(QWidget *widget, const xcb_key_release_event_t *event); + + void handleMappingNotifyEvent(const xcb_mapping_notify_event_t *event); + + Qt::KeyboardModifiers translateModifiers(int s); + +private: + + int translateKeySym(uint key) const; + QString translateKeySym(xcb_keysym_t keysym, uint xmodifiers, + int &code, Qt::KeyboardModifiers &modifiers, + QByteArray &chars, int &count); + + uint m_alt_mask; + uint m_super_mask; + uint m_hyper_mask; + uint m_meta_mask; + uint m_mode_switch_mask; + uint m_num_lock_mask; + + xcb_key_symbols_t *m_key_symbols; +}; + +#endif diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index a9a24dd..4faa617 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -55,6 +55,17 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen) printf (" white pixel...: %x\n", screen->white_pixel); printf (" black pixel...: %x\n", screen->black_pixel); printf ("\n"); + + const quint32 mask = XCB_CW_EVENT_MASK; + const quint32 values[] = { + // XCB_CW_EVENT_MASK + XCB_EVENT_MASK_KEYMAP_STATE + | XCB_EVENT_MASK_ENTER_WINDOW + | XCB_EVENT_MASK_LEAVE_WINDOW + | XCB_EVENT_MASK_PROPERTY_CHANGE + }; + + xcb_configure_window(xcb_connection(), screen->root, mask, values); } QXcbScreen::~QXcbScreen() diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 6dfccba..bdb5fc1 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -64,9 +64,15 @@ QXcbWindow::QXcbWindow(QWidget *tlw) // XCB_CW_EVENT_MASK XCB_EVENT_MASK_EXPOSURE | XCB_EVENT_MASK_STRUCTURE_NOTIFY + | XCB_EVENT_MASK_KEY_PRESS + | XCB_EVENT_MASK_KEY_RELEASE | XCB_EVENT_MASK_BUTTON_PRESS | XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_BUTTON_MOTION + | XCB_EVENT_MASK_ENTER_WINDOW + | XCB_EVENT_MASK_LEAVE_WINDOW + | XCB_EVENT_MASK_PROPERTY_CHANGE + | XCB_EVENT_MASK_FOCUS_CHANGE }; m_window = xcb_generate_id(xcb_connection()); @@ -160,7 +166,7 @@ void QXcbWindow::requestActivateWindow() { } -void QXcbWindow::handleExposeEvent(xcb_expose_event_t *event) +void QXcbWindow::handleExposeEvent(const xcb_expose_event_t *event) { QWindowSurface *surface = widget()->windowSurface(); if (surface) { @@ -170,7 +176,7 @@ void QXcbWindow::handleExposeEvent(xcb_expose_event_t *event) } } -void QXcbWindow::handleClientMessageEvent(xcb_client_message_event_t *event) +void QXcbWindow::handleClientMessageEvent(const xcb_client_message_event_t *event) { if (event->format == 32 && event->type == atom(QXcbAtom::WM_PROTOCOLS)) { if (event->data.data32[0] == atom(QXcbAtom::WM_DELETE_WINDOW)) { @@ -179,7 +185,7 @@ void QXcbWindow::handleClientMessageEvent(xcb_client_message_event_t *event) } } -void QXcbWindow::handleConfigureNotifyEvent(xcb_configure_notify_event_t *event) +void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t *event) { int xpos = geometry().x(); int ypos = geometry().y(); @@ -218,7 +224,7 @@ static Qt::MouseButton translateMouseButton(xcb_button_t s) } } -void QXcbWindow::handleButtonPressEvent(xcb_button_press_event_t *event) +void QXcbWindow::handleButtonPressEvent(const xcb_button_press_event_t *event) { QPoint local(event->event_x, event->event_y); QPoint global(event->root_x, event->root_y); @@ -240,7 +246,7 @@ void QXcbWindow::handleButtonPressEvent(xcb_button_press_event_t *event) handleMouseEvent(event->detail, event->state, event->time, local, global); } -void QXcbWindow::handleButtonReleaseEvent(xcb_button_release_event_t *event) +void QXcbWindow::handleButtonReleaseEvent(const xcb_button_release_event_t *event) { QPoint local(event->event_x, event->event_y); QPoint global(event->root_x, event->root_y); @@ -248,7 +254,7 @@ void QXcbWindow::handleButtonReleaseEvent(xcb_button_release_event_t *event) handleMouseEvent(event->detail, event->state, event->time, local, global); } -void QXcbWindow::handleMotionNotifyEvent(xcb_motion_notify_event_t *event) +void QXcbWindow::handleMotionNotifyEvent(const xcb_motion_notify_event_t *event) { QPoint local(event->event_x, event->event_y); QPoint global(event->root_x, event->root_y); @@ -266,3 +272,23 @@ void QXcbWindow::handleMouseEvent(xcb_button_t detail, uint16_t state, xcb_times QWindowSystemInterface::handleMouseEvent(widget(), time, local, global, buttons); } +void QXcbWindow::handleEnterNotifyEvent(const xcb_enter_notify_event_t *) +{ + QWindowSystemInterface::handleEnterEvent(widget()); +} + +void QXcbWindow::handleLeaveNotifyEvent(const xcb_leave_notify_event_t *) +{ + QWindowSystemInterface::handleLeaveEvent(widget()); +} + +void QXcbWindow::handleFocusInEvent(const xcb_focus_in_event_t *) +{ + QWindowSystemInterface::handleWindowActivated(widget()); +} + +void QXcbWindow::handleFocusOutEvent(const xcb_focus_out_event_t *) +{ + QWindowSystemInterface::handleWindowActivated(0); +} + diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index a772d30..d9ca86c 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -74,12 +74,17 @@ public: xcb_window_t window() const { return m_window; } - void handleExposeEvent(xcb_expose_event_t *event); - void handleClientMessageEvent(xcb_client_message_event_t *event); - void handleConfigureNotifyEvent(xcb_configure_notify_event_t *event); - void handleButtonPressEvent(xcb_button_press_event_t *event); - void handleButtonReleaseEvent(xcb_button_release_event_t *event); - void handleMotionNotifyEvent(xcb_motion_notify_event_t *event); + void handleExposeEvent(const xcb_expose_event_t *event); + void handleClientMessageEvent(const xcb_client_message_event_t *event); + void handleConfigureNotifyEvent(const xcb_configure_notify_event_t *event); + void handleButtonPressEvent(const xcb_button_press_event_t *event); + void handleButtonReleaseEvent(const xcb_button_release_event_t *event); + void handleMotionNotifyEvent(const xcb_motion_notify_event_t *event); + + void handleEnterNotifyEvent(const xcb_enter_notify_event_t *event); + void handleLeaveNotifyEvent(const xcb_leave_notify_event_t *event); + void handleFocusInEvent(const xcb_focus_in_event_t *event); + void handleFocusOutEvent(const xcb_focus_out_event_t *event); void handleMouseEvent(xcb_button_t detail, uint16_t state, xcb_timestamp_t time, const QPoint &local, const QPoint &global); diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index a4f9246..3aee0a2 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -4,22 +4,24 @@ include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms SOURCES = \ - main.cpp \ - qxcbintegration.cpp \ qxcbconnection.cpp \ + qxcbintegration.cpp \ + qxcbkeyboard.cpp \ qxcbscreen.cpp \ qxcbwindow.cpp \ - qxcbwindowsurface.cpp + qxcbwindowsurface.cpp \ + main.cpp HEADERS = \ - qxcbobject.h \ - qxcbintegration.h \ qxcbconnection.h \ + qxcbintegration.h \ + qxcbkeyboard.h \ + qxcbobject.h \ qxcbscreen.h \ qxcbwindow.h \ qxcbwindowsurface.h -LIBS += -lxcb -lxcb-image +LIBS += -lxcb -lxcb-image -lxcb-keysyms include (../fontdatabases/genericunix/genericunix.pri) -- cgit v0.12 From 6aa7b8ff77a968a2ad11181d21812e3fe675ba23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Tue, 8 Feb 2011 16:22:18 +0100 Subject: Added setGeometry(), raise(), lower() and setParent() in XCB backend. --- src/plugins/platforms/xcb/qxcbwindow.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index bdb5fc1..caeb3fa 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -112,6 +112,11 @@ QXcbWindow::~QXcbWindow() void QXcbWindow::setGeometry(const QRect &rect) { QPlatformWindow::setGeometry(rect); + + const quint32 mask = XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y | XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT; + const quint32 values[] = { rect.x(), rect.y(), rect.width(), rect.height() }; + + xcb_configure_window(xcb_connection(), m_window, mask, values); } void QXcbWindow::setVisible(bool visible) @@ -137,8 +142,10 @@ WId QXcbWindow::winId() const return m_window; } -void QXcbWindow::setParent(const QPlatformWindow *) +void QXcbWindow::setParent(const QPlatformWindow *parent) { + QPoint topLeft = geometry().topLeft(); + xcb_reparent_window(xcb_connection(), window(), static_cast(parent)->window(), topLeft.x(), topLeft.y()); } void QXcbWindow::setWindowTitle(const QString &title) @@ -156,10 +163,16 @@ void QXcbWindow::setWindowTitle(const QString &title) void QXcbWindow::raise() { + const quint32 mask = XCB_CONFIG_WINDOW_STACK_MODE; + const quint32 values[] = { XCB_STACK_MODE_ABOVE }; + xcb_configure_window(xcb_connection(), m_window, mask, values); } void QXcbWindow::lower() { + const quint32 mask = XCB_CONFIG_WINDOW_STACK_MODE; + const quint32 values[] = { XCB_STACK_MODE_BELOW }; + xcb_configure_window(xcb_connection(), m_window, mask, values); } void QXcbWindow::requestActivateWindow() -- cgit v0.12 From a0cc1e923e1d43bbb86d59b829c2d8a23a03bcf4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 9 Feb 2011 11:38:36 +0100 Subject: Added window attribute setting to XCB backend. --- src/plugins/platforms/xcb/qxcbwindow.cpp | 154 +++++++++++++++++++++++++++++-- src/plugins/platforms/xcb/qxcbwindow.h | 1 - 2 files changed, 145 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index caeb3fa..b54a233 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -90,9 +90,14 @@ QXcbWindow::QXcbWindow(QWidget *tlw) mask, // value mask values); // value list - xcb_atom_t properties[] = { - atom(QXcbAtom::WM_DELETE_WINDOW) - }; + xcb_atom_t properties[4]; + int propertyCount = 0; + properties[propertyCount++] = atom(QXcbAtom::WM_DELETE_WINDOW); + properties[propertyCount++] = atom(QXcbAtom::WM_TAKE_FOCUS); + properties[propertyCount++] = atom(QXcbAtom::_NET_WM_PING); + + if (tlw->windowFlags() & Qt::WindowContextHelpButtonHint) + properties[propertyCount++] = atom(QXcbAtom::_NET_WM_CONTEXT_HELP); xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, @@ -100,7 +105,7 @@ QXcbWindow::QXcbWindow(QWidget *tlw) atom(QXcbAtom::WM_PROTOCOLS), 4, 32, - sizeof(properties) / sizeof(xcb_atom_t), + propertyCount, properties); } @@ -127,14 +132,144 @@ void QXcbWindow::setVisible(bool visible) xcb_unmap_window(xcb_connection(), m_window); } +struct QtMWMHints { + quint32 flags, functions, decorations; + qint32 input_mode; + quint32 status; +}; + +enum { + MWM_HINTS_FUNCTIONS = (1L << 0), + + MWM_FUNC_ALL = (1L << 0), + MWM_FUNC_RESIZE = (1L << 1), + MWM_FUNC_MOVE = (1L << 2), + MWM_FUNC_MINIMIZE = (1L << 3), + MWM_FUNC_MAXIMIZE = (1L << 4), + MWM_FUNC_CLOSE = (1L << 5), + + MWM_HINTS_DECORATIONS = (1L << 1), + + MWM_DECOR_ALL = (1L << 0), + MWM_DECOR_BORDER = (1L << 1), + MWM_DECOR_RESIZEH = (1L << 2), + MWM_DECOR_TITLE = (1L << 3), + MWM_DECOR_MENU = (1L << 4), + MWM_DECOR_MINIMIZE = (1L << 5), + MWM_DECOR_MAXIMIZE = (1L << 6), + + MWM_HINTS_INPUT_MODE = (1L << 2), + + MWM_INPUT_MODELESS = 0L, + MWM_INPUT_PRIMARY_APPLICATION_MODAL = 1L, + MWM_INPUT_FULL_APPLICATION_MODAL = 3L +}; + Qt::WindowFlags QXcbWindow::setWindowFlags(Qt::WindowFlags flags) { - return flags; -} + Qt::WindowType type = static_cast(int(flags & Qt::WindowType_Mask)); + + if (type == Qt::ToolTip) + flags |= Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint; + if (type == Qt::Popup) + flags |= Qt::X11BypassWindowManagerHint; + + bool topLevel = (flags & Qt::Window); + bool popup = (type == Qt::Popup); + bool dialog = (type == Qt::Dialog + || type == Qt::Sheet); + bool desktop = (type == Qt::Desktop); + bool tool = (type == Qt::Tool || type == Qt::SplashScreen + || type == Qt::ToolTip || type == Qt::Drawer); + + Q_UNUSED(topLevel); + Q_UNUSED(dialog); + Q_UNUSED(desktop); + Q_UNUSED(tool); + + bool tooltip = (type == Qt::ToolTip); + + QtMWMHints mwmhints; + mwmhints.flags = 0L; + mwmhints.functions = 0L; + mwmhints.decorations = 0; + mwmhints.input_mode = 0L; + mwmhints.status = 0L; + + if (type != Qt::SplashScreen) { + mwmhints.flags |= MWM_HINTS_DECORATIONS; + + bool customize = flags & Qt::CustomizeWindowHint; + if (!(flags & Qt::FramelessWindowHint) && !(customize && !(flags & Qt::WindowTitleHint))) { + mwmhints.decorations |= MWM_DECOR_BORDER; + mwmhints.decorations |= MWM_DECOR_RESIZEH; + + if (flags & Qt::WindowTitleHint) + mwmhints.decorations |= MWM_DECOR_TITLE; + + if (flags & Qt::WindowSystemMenuHint) + mwmhints.decorations |= MWM_DECOR_MENU; + + if (flags & Qt::WindowMinimizeButtonHint) { + mwmhints.decorations |= MWM_DECOR_MINIMIZE; + mwmhints.functions |= MWM_FUNC_MINIMIZE; + } + + if (flags & Qt::WindowMaximizeButtonHint) { + mwmhints.decorations |= MWM_DECOR_MAXIMIZE; + mwmhints.functions |= MWM_FUNC_MAXIMIZE; + } + + if (flags & Qt::WindowCloseButtonHint) + mwmhints.functions |= MWM_FUNC_CLOSE; + } + } else { + // if type == Qt::SplashScreen + mwmhints.decorations = MWM_DECOR_ALL; + } -Qt::WindowFlags QXcbWindow::windowFlags() const -{ - return 0; + if (mwmhints.functions != 0) { + mwmhints.flags |= MWM_HINTS_FUNCTIONS; + mwmhints.functions |= MWM_FUNC_MOVE | MWM_FUNC_RESIZE; + } else { + mwmhints.functions = MWM_FUNC_ALL; + } + + if (!(flags & Qt::FramelessWindowHint) + && flags & Qt::CustomizeWindowHint + && flags & Qt::WindowTitleHint + && !(flags & + (Qt::WindowMinimizeButtonHint + | Qt::WindowMaximizeButtonHint + | Qt::WindowCloseButtonHint))) + { + // a special case - only the titlebar without any button + mwmhints.flags = MWM_HINTS_FUNCTIONS; + mwmhints.functions = MWM_FUNC_MOVE | MWM_FUNC_RESIZE; + mwmhints.decorations = 0; + } + + if (mwmhints.flags != 0l) { + xcb_change_property(xcb_connection(), + XCB_PROP_MODE_REPLACE, + m_window, + atom(QXcbAtom::_MOTIF_WM_HINTS), + atom(QXcbAtom::_MOTIF_WM_HINTS), + 32, + 5, + &mwmhints); + } else { + xcb_delete_property(xcb_connection(), m_window, atom(QXcbAtom::_MOTIF_WM_HINTS)); + } + + if (popup || tooltip) { + const quint32 mask = XCB_CW_OVERRIDE_REDIRECT | XCB_CW_SAVE_UNDER; + const quint32 values[] = { true, true }; + + xcb_change_window_attributes(xcb_connection(), m_window, mask, values); + } + + return QPlatformWindow::setWindowFlags(flags); } WId QXcbWindow::winId() const @@ -177,6 +312,7 @@ void QXcbWindow::lower() void QXcbWindow::requestActivateWindow() { + xcb_set_input_focus(xcb_connection(), m_window, XCB_INPUT_FOCUS_PARENT, XCB_TIME_CURRENT_TIME); } void QXcbWindow::handleExposeEvent(const xcb_expose_event_t *event) diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index d9ca86c..17e1742 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -60,7 +60,6 @@ public: void setVisible(bool visible); Qt::WindowFlags setWindowFlags(Qt::WindowFlags flags); - Qt::WindowFlags windowFlags() const; WId winId() const; void setParent(const QPlatformWindow *window); -- cgit v0.12 From bb0480a03bba6b23dd1e35ea1a8cc62e4f4a0219 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 9 Feb 2011 12:05:54 +0100 Subject: Added workaround to make XCB key event handling detect upper case. --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 29 ++++++++++++++--------------- src/plugins/platforms/xcb/qxcbkeyboard.h | 3 +++ 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index b226e3e..83f053a 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -911,10 +911,8 @@ QXcbKeyboard::~QXcbKeyboard() xcb_key_symbols_free(m_key_symbols); } -void QXcbKeyboard::handleKeyPressEvent(QWidget *widget, const xcb_key_press_event_t *event) +void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keysym_t sym, quint16 state, xcb_timestamp_t time) { - xcb_keysym_t sym = xcb_key_press_lookup_keysym(m_key_symbols, const_cast(event), 0); - QByteArray chars; chars.resize(513); @@ -922,25 +920,26 @@ void QXcbKeyboard::handleKeyPressEvent(QWidget *widget, const xcb_key_press_even int qtcode = 0; int count = 0; - QString string = translateKeySym(sym, event->state, qtcode, modifiers, chars, count); + if (state & XCB_MOD_MASK_SHIFT && sym <= 0x7f && isalpha(sym)) + sym = toupper(sym); - QWindowSystemInterface::handleKeyEvent(widget, event->time, QEvent::KeyPress, qtcode, modifiers, string.left(count)); + QString string = translateKeySym(sym, state, qtcode, modifiers, chars, count); + + QWindowSystemInterface::handleKeyEvent(widget, time, type, qtcode, modifiers, string.left(count)); } -void QXcbKeyboard::handleKeyReleaseEvent(QWidget *widget, const xcb_key_release_event_t *event) +void QXcbKeyboard::handleKeyPressEvent(QWidget *widget, const xcb_key_press_event_t *event) { - xcb_keysym_t sym = xcb_key_release_lookup_keysym(m_key_symbols, const_cast(event), 0); - - QByteArray chars; - chars.resize(513); + xcb_keysym_t sym = xcb_key_press_lookup_keysym(m_key_symbols, const_cast(event), 0); - Qt::KeyboardModifiers modifiers; - int qtcode = 0; - int count = 0; + handleKeyEvent(widget, QEvent::KeyPress, sym, event->state, event->time); +} - QString string = translateKeySym(sym, event->state, qtcode, modifiers, chars, count); +void QXcbKeyboard::handleKeyReleaseEvent(QWidget *widget, const xcb_key_release_event_t *event) +{ + xcb_keysym_t sym = xcb_key_release_lookup_keysym(m_key_symbols, const_cast(event), 0); - QWindowSystemInterface::handleKeyEvent(widget, event->time, QEvent::KeyRelease, qtcode, modifiers, string.left(count)); + handleKeyEvent(widget, QEvent::KeyRelease, sym, event->state, event->time); } void QXcbKeyboard::handleMappingNotifyEvent(const xcb_mapping_notify_event_t *event) diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h index dc4175a..89c7418 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.h +++ b/src/plugins/platforms/xcb/qxcbkeyboard.h @@ -46,6 +46,8 @@ #include "xcb/xcb_keysyms.h" +#include + class QXcbKeyboard : public QXcbObject { public: @@ -60,6 +62,7 @@ public: Qt::KeyboardModifiers translateModifiers(int s); private: + void handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keysym_t sym, quint16 state, xcb_timestamp_t time); int translateKeySym(uint key) const; QString translateKeySym(xcb_keysym_t keysym, uint xmodifiers, -- cgit v0.12 From 69a0d3bdbfecdbf559aa6d0132281ad64b88fac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Wed, 9 Feb 2011 12:36:16 +0100 Subject: Better handling of key codes in XCB backend. Using xcb_key_symbols_get_keysym seems to give better results compared to xcb_key_press_lookup_keysym xcb_key_release_lookup_keysym. --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 29 ++++++++++++++++++----------- src/plugins/platforms/xcb/qxcbkeyboard.h | 2 +- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 83f053a..67039a7 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -911,18 +911,29 @@ QXcbKeyboard::~QXcbKeyboard() xcb_key_symbols_free(m_key_symbols); } -void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keysym_t sym, quint16 state, xcb_timestamp_t time) +void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time) { + int col = state & XCB_MOD_MASK_SHIFT ? 1 : 0; + + const int altGrOffset = 4; + if (state & 128) + col += altGrOffset; + + xcb_keysym_t sym = xcb_key_symbols_get_keysym(m_key_symbols, code, col); + + if (state & XCB_MOD_MASK_LOCK && sym <= 0x7f && isprint(sym)) { + if (isupper(sym)) + sym = tolower(sym); + else + sym = toupper(sym); + } + QByteArray chars; - chars.resize(513); Qt::KeyboardModifiers modifiers; int qtcode = 0; int count = 0; - if (state & XCB_MOD_MASK_SHIFT && sym <= 0x7f && isalpha(sym)) - sym = toupper(sym); - QString string = translateKeySym(sym, state, qtcode, modifiers, chars, count); QWindowSystemInterface::handleKeyEvent(widget, time, type, qtcode, modifiers, string.left(count)); @@ -930,16 +941,12 @@ void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keysym void QXcbKeyboard::handleKeyPressEvent(QWidget *widget, const xcb_key_press_event_t *event) { - xcb_keysym_t sym = xcb_key_press_lookup_keysym(m_key_symbols, const_cast(event), 0); - - handleKeyEvent(widget, QEvent::KeyPress, sym, event->state, event->time); + handleKeyEvent(widget, QEvent::KeyPress, event->detail, event->state, event->time); } void QXcbKeyboard::handleKeyReleaseEvent(QWidget *widget, const xcb_key_release_event_t *event) { - xcb_keysym_t sym = xcb_key_release_lookup_keysym(m_key_symbols, const_cast(event), 0); - - handleKeyEvent(widget, QEvent::KeyRelease, sym, event->state, event->time); + handleKeyEvent(widget, QEvent::KeyRelease, event->detail, event->state, event->time); } void QXcbKeyboard::handleMappingNotifyEvent(const xcb_mapping_notify_event_t *event) diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h index 89c7418..2a17e48 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.h +++ b/src/plugins/platforms/xcb/qxcbkeyboard.h @@ -62,7 +62,7 @@ public: Qt::KeyboardModifiers translateModifiers(int s); private: - void handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keysym_t sym, quint16 state, xcb_timestamp_t time); + void handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time); int translateKeySym(uint key) const; QString translateKeySym(xcb_keysym_t keysym, uint xmodifiers, -- cgit v0.12 From cb742e70f0d2fb992d27045f6d3d9624bd10ced5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 9 Feb 2011 14:55:24 +0100 Subject: Dont include EGL header when compiling with QT_NO_EGL --- src/opengl/qgl.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/qgl.cpp b/src/opengl/qgl.cpp index 9f31c62..ffde515 100644 --- a/src/opengl/qgl.cpp +++ b/src/opengl/qgl.cpp @@ -97,7 +97,7 @@ #include "qlibrary.h" #include -#ifdef QT_OPENGL_ES +#if defined(QT_OPENGL_ES) && !defined(QT_NO_EGL) #include #endif -- cgit v0.12 From 5112afc9eeb546f27e2fa5d655418ee7c544b109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 9 Feb 2011 15:00:16 +0100 Subject: Add highest pixel format option to q_configFromQPlatformWindowFormat The default is still the old behavior --- .../platforms/eglconvenience/qeglconvenience.cpp | 18 +++++++++--------- src/plugins/platforms/eglconvenience/qeglconvenience.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.cpp b/src/plugins/platforms/eglconvenience/qeglconvenience.cpp index 1612f79..acdbf24 100644 --- a/src/plugins/platforms/eglconvenience/qeglconvenience.cpp +++ b/src/plugins/platforms/eglconvenience/qeglconvenience.cpp @@ -206,7 +206,7 @@ bool q_reduceConfigAttributes(QVector *configAttributes) return false; } -EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format) +EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format, bool highestPixelFormat) { EGLConfig cfg = 0; QVector configureAttributes = q_createConfigAttributesFromFormat(format); @@ -227,14 +227,14 @@ EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformW if (!eglChooseConfig(display, configureAttributes.constData(), 0, 0, &matching) || !matching) continue; -// // If we want the best pixel format, then return the first -// // matching configuration. -// if (match == QEgl::BestPixelFormat) { -// eglChooseConfig(display, props.properties(), &cfg, 1, &matching); -// if (matching < 1) -// continue; -// return cfg; -// } + // If we want the best pixel format, then return the first + // matching configuration. + if (highestPixelFormat) { + eglChooseConfig(display, configureAttributes.constData(), &cfg, 1, &matching); + if (matching < 1) + continue; + return cfg; + } // Fetch all of the matching configurations and find the // first that matches the pixel format we wanted. diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.h b/src/plugins/platforms/eglconvenience/qeglconvenience.h index 98c30b8..a1df3cc 100644 --- a/src/plugins/platforms/eglconvenience/qeglconvenience.h +++ b/src/plugins/platforms/eglconvenience/qeglconvenience.h @@ -51,7 +51,7 @@ QT_BEGIN_NAMESPACE QVector q_createConfigAttributesFromFormat(const QPlatformWindowFormat &format); bool q_reduceConfigAttributes(QVector *configAttributes); -EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format); +EGLConfig q_configFromQPlatformWindowFormat(EGLDisplay display, const QPlatformWindowFormat &format, bool highestPixelFormat = false); QPlatformWindowFormat qt_qPlatformWindowFormatFromConfig(EGLDisplay display, const EGLConfig config); bool q_hasEglExtension(EGLDisplay display,const char* extensionName); -- cgit v0.12 From f45102d9e53dc1ac8bde83fc27d83834c79cae93 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 9 Feb 2011 15:03:36 +0100 Subject: Export QGLEngineSharedShaders --- src/opengl/gl2paintengineex/qglengineshadermanager_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h index 16a7d66..7cc9dc3 100644 --- a/src/opengl/gl2paintengineex/qglengineshadermanager_p.h +++ b/src/opengl/gl2paintengineex/qglengineshadermanager_p.h @@ -259,7 +259,7 @@ static const GLuint QT_PMV_MATRIX_3_ATTR = 5; class QGLEngineShaderProg; -class QGLEngineSharedShaders +class Q_OPENGL_EXPORT QGLEngineSharedShaders { Q_GADGET public: -- cgit v0.12 From c902dcc8943a2bfcb6432d46303ace46def6fe86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 9 Feb 2011 15:16:14 +0100 Subject: Lighthouse: Wayland: Use EGLSurface --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 4 +- src/plugins/platforms/wayland/qwaylanddisplay.h | 11 +- .../platforms/wayland/qwaylanddrmsurface.cpp | 245 +++++++-------------- src/plugins/platforms/wayland/qwaylanddrmsurface.h | 71 +----- .../platforms/wayland/qwaylandeglwindow.cpp | 115 ++++++++++ src/plugins/platforms/wayland/qwaylandeglwindow.h | 68 ++++++ .../platforms/wayland/qwaylandglcontext.cpp | 64 +++--- src/plugins/platforms/wayland/qwaylandglcontext.h | 17 +- src/plugins/platforms/wayland/qwaylandinclude.h | 72 ++++++ .../platforms/wayland/qwaylandintegration.cpp | 14 +- src/plugins/platforms/wayland/qwaylandscreen.cpp | 19 ++ src/plugins/platforms/wayland/qwaylandscreen.h | 3 + .../platforms/wayland/qwaylandshmsurface.cpp | 23 +- .../platforms/wayland/qwaylandshmwindow.cpp | 89 ++++++++ src/plugins/platforms/wayland/qwaylandshmwindow.h | 63 ++++++ src/plugins/platforms/wayland/qwaylandwindow.cpp | 35 +-- src/plugins/platforms/wayland/qwaylandwindow.h | 25 ++- src/plugins/platforms/wayland/wayland.pro | 31 ++- 18 files changed, 628 insertions(+), 341 deletions(-) create mode 100644 src/plugins/platforms/wayland/qwaylandeglwindow.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandeglwindow.h create mode 100644 src/plugins/platforms/wayland/qwaylandinclude.h create mode 100644 src/plugins/platforms/wayland/qwaylandshmwindow.cpp create mode 100644 src/plugins/platforms/wayland/qwaylandshmwindow.h diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index 0747afd..ca23165 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -50,8 +50,6 @@ #include #include -#include - struct wl_surface *QWaylandDisplay::createSurface() { return wl_compositor_create_surface(mCompositor); @@ -186,7 +184,7 @@ QWaylandDisplay::QWaylandDisplay(void) mNativeEglDisplay = wl_egl_display_create(mDisplay); - mEglDisplay = eglGetDisplay(mNativeEglDisplay); + mEglDisplay = eglGetDisplay((EGLNativeDisplayType)mNativeEglDisplay); if (mEglDisplay == NULL) { qWarning("EGL not available"); } else { diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index 375a9c1..ca31756 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -44,13 +44,12 @@ #include #include +#include +#include +#include +#include -#include - -#define MESA_EGL_NO_X11_HEADERS -#define EGL_EGLEXT_PROTOTYPES -#include -#include +#include "qwaylandinclude.h" class QWaylandInputDevice; class QSocketNotifier; diff --git a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp index aaf4a5c..38bbc59 100644 --- a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp @@ -38,183 +38,104 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ + #include "qwaylanddrmsurface.h" #include "qwaylanddisplay.h" #include "qwaylandwindow.h" #include "qwaylandscreen.h" -#include -#include -#include -#include +#include +#include -#include -#include +#include QT_BEGIN_NAMESPACE -/* - * Shared DRM surface for GL based drawing - */ -QWaylandDrmBuffer::QWaylandDrmBuffer(QWaylandDisplay *display, - const QSize &size, QImage::Format format) - : mDisplay(display) - , mSize(size) -{ - struct wl_visual *visual; - - switch (format) { - case QImage::Format_ARGB32: - visual = display->argbVisual(); - break; - case QImage::Format_ARGB32_Premultiplied: - visual = display->argbPremultipliedVisual(); - break; - default: - qDebug("unsupported buffer format %d requested\n", format); - visual = display->argbVisual(); - break; - } - - mPixmap = wl_egl_pixmap_create(display->nativeDisplay(), - size.width(), size.height(), - visual, 0); - - mImage = eglCreateImageKHR(display->eglDisplay(), - NULL, EGL_NATIVE_PIXMAP_KHR, - (EGLClientBuffer) mPixmap, NULL); - glGenTextures(1, &mTexture); - qDebug() << "generating mTexture" << mTexture; - glBindTexture(GL_TEXTURE_2D, mTexture); - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, mImage); - mBuffer = wl_egl_pixmap_create_buffer(display->nativeDisplay(), mPixmap); -} - -QWaylandDrmBuffer::~QWaylandDrmBuffer(void) +static void drawTexture(const QRectF &rect, GLuint tex_id, const QSize &texSize, const QRectF &br) { - glDeleteTextures(1, &mTexture); - eglDestroyImageKHR(mDisplay->eglDisplay(), mImage); - wl_egl_pixmap_destroy(mPixmap); - wl_buffer_destroy(mBuffer); -} + const GLenum target = GL_TEXTURE_2D; + QRectF src = br.isEmpty() + ? QRectF(QPointF(), texSize) + : QRectF(QPointF(br.x(), texSize.height() - br.bottom()), br.size()); -void QWaylandDrmBuffer::bindToCurrentFbo() -{ - Q_ASSERT(QPlatformGLContext::currentContext()); - glFramebufferTexture2D(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, mTexture, 0); - QT_CHECK_GLERROR(); -} + if (target == GL_TEXTURE_2D) { + qreal width = texSize.width(); + qreal height = texSize.height(); -QWaylandPaintDevice::QWaylandPaintDevice(QWaylandDisplay *display, QWindowSurface *windowSurface, QPlatformGLContext *context) - : QGLPaintDevice() - , mDisplay(display) - , mPlatformGLContext(context) - , mWindowSurface(windowSurface) - , mBufferList(1) - , mCurrentPaintBuffer(0) - , mDepthStencil(0) -{ - for (int i = 0; i < mBufferList.size(); i++) { - mBufferList[i] = 0; + src.setLeft(src.left() / width); + src.setRight(src.right() / width); + src.setTop(src.top() / height); + src.setBottom(src.bottom() / height); } - mPlatformGLContext->makeCurrent(); - glGenFramebuffers(1, &m_thisFBO); - glBindFramebuffer(GL_FRAMEBUFFER_EXT, m_thisFBO); + const GLfloat tx1 = src.left(); + const GLfloat tx2 = src.right(); + const GLfloat ty1 = src.top(); + const GLfloat ty2 = src.bottom(); - glGenRenderbuffers(1, &mDepthStencil); - glBindRenderbuffer(GL_RENDERBUFFER_EXT, mDepthStencil); - glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_DEPTH_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, mDepthStencil); - glFramebufferRenderbuffer(GL_FRAMEBUFFER_EXT, GL_STENCIL_ATTACHMENT_EXT, - GL_RENDERBUFFER_EXT, mDepthStencil); + GLfloat texCoordArray[4*2] = { + tx1, ty2, tx2, ty2, tx2, ty1, tx1, ty1 + }; - if (windowSurface->size().isValid()) - resize(windowSurface->size()); -} + GLfloat vertexArray[4*2]; + vertexArray[0] = rect.left(); vertexArray[1] = rect.top(); + vertexArray[2] = rect.right(); vertexArray[3] = rect.top(); + vertexArray[4] = rect.right(); vertexArray[5] = rect.bottom(); + vertexArray[6] = rect.left(); vertexArray[7] = rect.bottom(); -QWaylandPaintDevice::~QWaylandPaintDevice() -{ - for(int i = 0; i < mBufferList.size(); i++) { - delete mBufferList[i]; - } - glDeleteRenderbuffers(1,&mDepthStencil); - glDeleteFramebuffers(1,&m_thisFBO); -} + glVertexAttribPointer(QT_VERTEX_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, vertexArray); + glVertexAttribPointer(QT_TEXTURE_COORDS_ATTR, 2, GL_FLOAT, GL_FALSE, 0, texCoordArray); -QSize QWaylandPaintDevice::size() const -{ - return mSize; -} -QGLContext *QWaylandPaintDevice::context() const -{ - return QGLContext::fromPlatformGLContext(mPlatformGLContext); -} -QPaintEngine *QWaylandPaintDevice::paintEngine() const -{ - return qt_qgl_paint_engine(); -} + glBindTexture(target, tex_id); -void QWaylandPaintDevice::beginPaint() -{ - QGLPaintDevice::beginPaint(); - currentDrmBuffer()->bindToCurrentFbo(); -} + glEnableVertexAttribArray(QT_VERTEX_COORDS_ATTR); + glEnableVertexAttribArray(QT_TEXTURE_COORDS_ATTR); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glDisableVertexAttribArray(QT_VERTEX_COORDS_ATTR); + glDisableVertexAttribArray(QT_TEXTURE_COORDS_ATTR); -bool QWaylandPaintDevice::isFlipped()const -{ - return true; + glBindTexture(target, 0); } -void QWaylandPaintDevice::resize(const QSize &size) +static void blitTexture(QGLContext *ctx, GLuint texture, const QSize &viewport, const QSize &texSize, const QRect &targetRect, const QRect &sourceRect) { - QImage::Format format = QPlatformScreen::platformScreenForWidget(mWindowSurface->window())->format(); - mPlatformGLContext->makeCurrent(); - mSize = size; - for (int i = 0; i < mBufferList.size(); i++) { - if (!mBufferList.at(i) || mBufferList.at(i)->size() != size) { - delete mBufferList[i]; - mBufferList[i] = new QWaylandDrmBuffer(mDisplay, size, format); - } - } + glDisable(GL_DEPTH_TEST); + glDisable(GL_SCISSOR_TEST); + glDisable(GL_BLEND); + glViewport(0, 0, viewport.width(), viewport.height()); - glBindRenderbuffer(GL_RENDERBUFFER_EXT,mDepthStencil); - glRenderbufferStorage(GL_RENDERBUFFER_EXT, - GL_DEPTH24_STENCIL8_EXT, size.width(), size.height()); + QGLShaderProgram *blitProgram = + QGLEngineSharedShaders::shadersForContext(ctx)->blitProgram(); + blitProgram->bind(); + blitProgram->setUniformValue("imageTexture", 0 /*QT_IMAGE_TEXTURE_UNIT*/); - GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER_EXT); + // The shader manager's blit program does not multiply the + // vertices by the pmv matrix, so we need to do the effect + // of the orthographic projection here ourselves. + QRectF r; + qreal w = viewport.width(); + qreal h = viewport.height(); + r.setLeft((targetRect.left() / w) * 2.0f - 1.0f); + if (targetRect.right() == (viewport.width() - 1)) + r.setRight(1.0f); + else + r.setRight((targetRect.right() / w) * 2.0f - 1.0f); + r.setBottom((targetRect.top() / h) * 2.0f - 1.0f); + if (targetRect.bottom() == (viewport.height() - 1)) + r.setTop(1.0f); + else + r.setTop((targetRect.bottom() / w) * 2.0f - 1.0f); - switch(status) { - case GL_NO_ERROR: - case GL_FRAMEBUFFER_COMPLETE_EXT: - qDebug() << "fbo ok"; - break; - default: - qDebug() <<"QWaylandDrmBuffer error: "<< status; - break; - } - QT_CHECK_GLERROR(); -} - -QWaylandDrmBuffer *QWaylandPaintDevice::currentDrmBuffer() const -{ - return mBufferList[mCurrentPaintBuffer]; -} -QWaylandDrmBuffer *QWaylandPaintDevice::currentDrmBufferAndSwap() -{ - QWaylandDrmBuffer *currentDrmBuffer = mBufferList[mCurrentPaintBuffer]; - mCurrentPaintBuffer = (mCurrentPaintBuffer +1) % mBufferList.size(); - return currentDrmBuffer; + drawTexture(r, texture, texSize, sourceRect); } QWaylandDrmWindowSurface::QWaylandDrmWindowSurface(QWidget *window) : QWindowSurface(window) , mDisplay(QWaylandScreen::waylandScreenFromWidget(window)->display()) - , mPaintDevice(new QWaylandPaintDevice(mDisplay, this,window->platformWindow()->glContext())) + , mPaintDevice(0) { } @@ -224,41 +145,39 @@ QWaylandDrmWindowSurface::~QWaylandDrmWindowSurface() delete mPaintDevice; } -void QWaylandDrmWindowSurface::beginPaint(const QRegion &) +QPaintDevice *QWaylandDrmWindowSurface::paintDevice() { - window()->platformWindow()->glContext()->makeCurrent(); + return mPaintDevice; } -QPaintDevice *QWaylandDrmWindowSurface::paintDevice() +void QWaylandDrmWindowSurface::beginPaint(const QRegion &) { - return mPaintDevice; + window()->platformWindow()->glContext()->makeCurrent(); + glClearColor(0,0,0,0xff); + glClear(GL_COLOR_BUFFER_BIT); } void QWaylandDrmWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) { Q_UNUSED(offset); + Q_UNUSED(region); QWaylandWindow *ww = (QWaylandWindow *) widget->platformWindow(); - glFlush(); - ww->attach(mPaintDevice->currentDrmBufferAndSwap()); + if (mPaintDevice->isBound()) + mPaintDevice->release(); - QVector rects = region.rects(); - for (int i = 0; i < rects.size(); i++) { - QRect r = rects.at(i); - wl_surface_damage(ww->surface(), - r.x(), r.y(), r.width(), r.height()); - } + QRect rect(0,0,size().width(),size().height()); + QGLContext *ctx = QGLContext::fromPlatformGLContext(ww->glContext()); + blitTexture(ctx,mPaintDevice->texture(),size(),mPaintDevice->size(),rect,rect); + ww->glContext()->swapBuffers(); } -void QWaylandDrmWindowSurface::resize(const QSize &requestedSize) +void QWaylandDrmWindowSurface::resize(const QSize &size) { - QWindowSurface::resize(requestedSize); - QWaylandWindow *ww = (QWaylandWindow *) window()->platformWindow(); - - ww->glContext()->makeCurrent(); - - mPaintDevice->resize(requestedSize); - ww->attach(mPaintDevice->currentDrmBuffer()); + QWindowSurface::resize(size); + window()->platformWindow()->glContext()->makeCurrent(); + delete mPaintDevice; + mPaintDevice = new QGLFramebufferObject(size,QGLFramebufferObject::CombinedDepthStencil,GL_TEXTURE_2D,GL_RGBA); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylanddrmsurface.h b/src/plugins/platforms/wayland/qwaylanddrmsurface.h index f49263b..78418ee 100644 --- a/src/plugins/platforms/wayland/qwaylanddrmsurface.h +++ b/src/plugins/platforms/wayland/qwaylanddrmsurface.h @@ -43,76 +43,10 @@ #define QWAYLANDDRMSURFACE_H #include "qwaylanddisplay.h" -#include "qwaylandbuffer.h" #include -#include -#include -#define GL_GLEXT_PROTOTYPES -#include -#include - -#define QT_RESET_GLERROR() \ -{ \ - while (glGetError() != GL_NO_ERROR) {} \ -} -#define QT_CHECK_GLERROR() \ -{ \ - GLenum err = glGetError(); \ - if (err != GL_NO_ERROR) { \ - qDebug("[%s line %d] GL Error: 0x%x", \ - __FILE__, __LINE__, (int)err); \ - } \ -} - -class QWaylandDrmBuffer : public QWaylandBuffer { -public: - QWaylandDrmBuffer(QWaylandDisplay *display, - const QSize &size, QImage::Format format); - ~QWaylandDrmBuffer(); - - void bindToCurrentFbo(); - QSize size() const { return mSize; } - -private: - struct wl_egl_pixmap *mPixmap; - EGLImageKHR mImage; - QWaylandDisplay *mDisplay; - QSize mSize; - GLuint mTexture; - -}; - -class QWaylandPaintDevice : public QGLPaintDevice -{ -public: - QWaylandPaintDevice(QWaylandDisplay *display, QWindowSurface *windowSurface, QPlatformGLContext *context); - ~QWaylandPaintDevice(); - - QSize size() const; - QGLContext *context() const; - QPaintEngine *paintEngine() const; - - void beginPaint(); - - bool isFlipped()const; - - void resize(const QSize &size); - - QWaylandDrmBuffer *currentDrmBuffer() const; - QWaylandDrmBuffer *currentDrmBufferAndSwap(); - -private: - QWaylandDisplay *mDisplay; - QPlatformGLContext *mPlatformGLContext; - QWindowSurface *mWindowSurface; - QVarLengthArray mBufferList; - int mCurrentPaintBuffer; - GLuint mDepthStencil; - QSize mSize; - -}; +class QGLFramebufferObject; class QWaylandDrmWindowSurface : public QWindowSurface { @@ -124,12 +58,13 @@ public: QPaintDevice *paintDevice(); void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void resize(const QSize &size); private: QWaylandDisplay *mDisplay; - QWaylandPaintDevice *mPaintDevice; + QGLFramebufferObject *mPaintDevice; }; #endif // QWAYLANDDRMSURFACE_H diff --git a/src/plugins/platforms/wayland/qwaylandeglwindow.cpp b/src/plugins/platforms/wayland/qwaylandeglwindow.cpp new file mode 100644 index 0000000..6e5e5bb --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandeglwindow.cpp @@ -0,0 +1,115 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandeglwindow.h" + +#include "qwaylandscreen.h" +#include "qwaylandglcontext.h" + +#include + + +QWaylandEglWindow::QWaylandEglWindow(QWidget *window) + : QWaylandWindow(window) + , mGLContext(0) + , mWaylandEglWindow(0) +{ + //super creates a new surface + newSurfaceCreated(); +} + +QWaylandEglWindow::~QWaylandEglWindow() +{ + if (mGLContext) + delete mGLContext; +} + +QWaylandWindow::WindowType QWaylandEglWindow::windowType() const +{ + return QWaylandWindow::Egl; +} + +void QWaylandEglWindow::setGeometry(const QRect &rect) +{ + QWaylandWindow::setGeometry(rect); + if (mWaylandEglWindow) { + wl_egl_window_resize(mWaylandEglWindow,rect.width(),rect.height(),0,0); + } +} + +void QWaylandEglWindow::setParent(const QPlatformWindow *parent) +{ + const QWaylandWindow *wParent = static_cast(parent); + + mParentWindow = wParent; +} + +QPlatformGLContext * QWaylandEglWindow::glContext() const +{ + if (!mGLContext) { + QWaylandEglWindow *that = const_cast(this); + that->mGLContext = new QWaylandGLContext(that->mDisplay,widget()->platformWindowFormat()); + + EGLNativeWindowType window(reinterpret_cast(mWaylandEglWindow)); + EGLSurface surface = eglCreateWindowSurface(mDisplay->eglDisplay(),mGLContext->eglConfig(),window,NULL); + that->mGLContext->setEglSurface(surface); + } + + return mGLContext; +} + +void QWaylandEglWindow::newSurfaceCreated() +{ + if (mWaylandEglWindow) { + wl_egl_window_destroy(mWaylandEglWindow); + } + wl_visual *visual = QWaylandScreen::waylandScreenFromWidget(widget())->visual(); + QSize size = geometry().size(); + if (!size.isValid()) + size = QSize(0,0); + + mWaylandEglWindow = wl_egl_window_create(mSurface,size.width(),size.height(),visual); + if (mGLContext) { + EGLNativeWindowType window(reinterpret_cast(mWaylandEglWindow)); + EGLSurface surface = eglCreateWindowSurface(mDisplay->eglDisplay(),mGLContext->eglConfig(),window,NULL); + mGLContext->setEglSurface(surface); + } +} diff --git a/src/plugins/platforms/wayland/qwaylandeglwindow.h b/src/plugins/platforms/wayland/qwaylandeglwindow.h new file mode 100644 index 0000000..4b3bb5b --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandeglwindow.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDEGLWINDOW_H +#define QWAYLANDEGLWINDOW_H + +#include "qwaylandwindow.h" + +class QWaylandGLContext; + +class QWaylandEglWindow : public QWaylandWindow +{ +public: + QWaylandEglWindow(QWidget *window); + ~QWaylandEglWindow(); + WindowType windowType() const; + void setGeometry(const QRect &rect); + void setParent(const QPlatformWindow *parent); + QPlatformGLContext *glContext() const; +protected: + void newSurfaceCreated(); +private: + QWaylandGLContext *mGLContext; + struct wl_egl_window *mWaylandEglWindow; + EGLConfig mConfig; + + const QWaylandWindow *mParentWindow; +}; + +#endif // QWAYLANDEGLWINDOW_H diff --git a/src/plugins/platforms/wayland/qwaylandglcontext.cpp b/src/plugins/platforms/wayland/qwaylandglcontext.cpp index 23631d9..3720567 100644 --- a/src/plugins/platforms/wayland/qwaylandglcontext.cpp +++ b/src/plugins/platforms/wayland/qwaylandglcontext.cpp @@ -45,25 +45,21 @@ #include "qwaylandwindow.h" #include "qwaylanddrmsurface.h" +#include "../eglconvenience/qeglconvenience.h" + #include #include -#include -#include - Q_GLOBAL_STATIC(QMutex,qt_defaultSharedContextMutex) -EGLint QWaylandGLContext::contextAttibutes[] = { - EGL_CONTEXT_CLIENT_VERSION, 2, - EGL_NONE -}; - QWaylandGLContext::QWaylandGLContext(QWaylandDisplay *wd, const QPlatformWindowFormat &format) : QPlatformGLContext() - , mFormat(format) , mDisplay(wd) + , mSurface(EGL_NO_SURFACE) + , mConfig(q_configFromQPlatformWindowFormat(mDisplay->eglDisplay(),format,true)) + , mFormat(qt_qPlatformWindowFormatFromConfig(mDisplay->eglDisplay(),mConfig)) { - QPlatformGLContext *sharePlatformContext; + QPlatformGLContext *sharePlatformContext = 0; if (format.useDefaultSharedContext()) { if (!QPlatformGLContext::defaultSharedContext()) { if (qt_defaultSharedContextMutex()->tryLock()){ @@ -84,26 +80,22 @@ QWaylandGLContext::QWaylandGLContext(QWaylandDisplay *wd, const QPlatformWindowF shareEGLContext = static_cast(sharePlatformContext)->mContext; eglBindAPI(EGL_OPENGL_ES_API); - mContext = eglCreateContext(mDisplay->eglDisplay(), NULL, - shareEGLContext, contextAttibutes); - - mFormat.setAccum(false); - mFormat.setAlphaBufferSize(8); - mFormat.setRedBufferSize(8); - mFormat.setGreenBufferSize(8); - mFormat.setBlueBufferSize(8); - mFormat.setDepth(false); -// mFormat.setDepthBufferSize(8); - mFormat.setStencil(false); -// mFormat.setStencilBufferSize(24); -// mFormat.setSampleBuffers(false); + QVector eglContextAttrs; + eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); + eglContextAttrs.append(2); + eglContextAttrs.append(EGL_NONE); + + mContext = eglCreateContext(mDisplay->eglDisplay(), mConfig, + shareEGLContext, eglContextAttrs.constData()); } QWaylandGLContext::QWaylandGLContext() : QPlatformGLContext() , mDisplay(0) , mContext(EGL_NO_CONTEXT) + , mSurface(EGL_NO_SURFACE) + , mConfig(0) { } QWaylandGLContext::~QWaylandGLContext() @@ -114,7 +106,10 @@ QWaylandGLContext::~QWaylandGLContext() void QWaylandGLContext::makeCurrent() { QPlatformGLContext::makeCurrent(); - eglMakeCurrent(mDisplay->eglDisplay(), EGL_NO_SURFACE, EGL_NO_SURFACE, mContext); + if (mSurface == EGL_NO_SURFACE) { + qWarning("makeCurrent with EGL_NO_SURFACE"); + } + eglMakeCurrent(mDisplay->eglDisplay(), mSurface, mSurface, mContext); } void QWaylandGLContext::doneCurrent() @@ -125,6 +120,7 @@ void QWaylandGLContext::doneCurrent() void QWaylandGLContext::swapBuffers() { + eglSwapBuffers(mDisplay->eglDisplay(),mSurface); } void *QWaylandGLContext::getProcAddress(const QString &string) @@ -134,10 +130,26 @@ void *QWaylandGLContext::getProcAddress(const QString &string) void QWaylandGLContext::createDefaultSharedContex(QWaylandDisplay *display) { + QVector eglContextAttrs; + eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); + eglContextAttrs.append(2); + eglContextAttrs.append(EGL_NONE); + QWaylandGLContext *defaultSharedContext = new QWaylandGLContext; defaultSharedContext->mDisplay = display; - defaultSharedContext->mContext = eglCreateContext(mDisplay->eglDisplay(), NULL, - EGL_NO_CONTEXT, contextAttibutes); + defaultSharedContext->mContext = eglCreateContext(mDisplay->eglDisplay(),mConfig, + EGL_NO_CONTEXT, eglContextAttrs.constData()); QPlatformGLContext::setDefaultSharedContext(defaultSharedContext); } +void QWaylandGLContext::setEglSurface(EGLSurface surface) +{ + doneCurrent(); + mSurface = surface; +} + +EGLConfig QWaylandGLContext::eglConfig() const +{ + return mConfig; +} + diff --git a/src/plugins/platforms/wayland/qwaylandglcontext.h b/src/plugins/platforms/wayland/qwaylandglcontext.h index d9ba323..dd319fd 100644 --- a/src/plugins/platforms/wayland/qwaylandglcontext.h +++ b/src/plugins/platforms/wayland/qwaylandglcontext.h @@ -42,17 +42,14 @@ #ifndef QWAYLANDGLCONTEXT_H #define QWAYLANDGLCONTEXT_H +#include "qwaylanddisplay.h" + #include -#include -class QWaylandDisplay; class QWaylandWindow; class QWaylandDrmWindowSurface; -#define MESA_EGL_NO_X11_HEADERS -#define EGL_EGLEXT_PROTOTYPES -#include -#include +#include "qwaylandinclude.h" class QWaylandGLContext : public QPlatformGLContext { public: @@ -62,14 +59,18 @@ public: void doneCurrent(); void swapBuffers(); void* getProcAddress(const QString&); + QPlatformWindowFormat platformWindowFormat() const { return mFormat; } + void setEglSurface(EGLSurface surface); + EGLConfig eglConfig() const; private: - QPlatformWindowFormat mFormat; QWaylandDisplay *mDisplay; - static EGLint contextAttibutes[]; EGLContext mContext; + EGLSurface mSurface; + EGLConfig mConfig; + QPlatformWindowFormat mFormat; void createDefaultSharedContex(QWaylandDisplay *display); QWaylandGLContext(); diff --git a/src/plugins/platforms/wayland/qwaylandinclude.h b/src/plugins/platforms/wayland/qwaylandinclude.h new file mode 100644 index 0000000..d1f7e39 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandinclude.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDINCLUDE_H +#define QWAYLANDINCLUDE_H + +#include + +#include + +#define GL_GLEXT_PROTOTYPES +#include +#include + +//#define MESA_EGL_NO_X11_HEADERS +#define EGL_EGLEXT_PROTOTYPES + #include + #include + +#undef FocusOut +#undef FocusIn +#undef KeyPress +#undef KeyRelease +#undef None +#undef RevertToParent +#undef GrayScale +#undef CursorShape + +#ifdef FontChange +#undef FontChange +#endif + + +#endif // QWAYLANDINCLUDE_H diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 02bc680..9483a47 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -44,7 +44,8 @@ #include "qwaylanddisplay.h" #include "qwaylandshmsurface.h" #include "qwaylanddrmsurface.h" -#include "qwaylandwindow.h" +#include "qwaylandshmwindow.h" +#include "qwaylandeglwindow.h" #include "qfontconfigdatabase.h" @@ -80,16 +81,21 @@ QPixmapData *QWaylandIntegration::createPixmapData(QPixmapData::PixelType type) QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWidget *widget, WId winId) const { Q_UNUSED(winId); - return new QWaylandWindow(widget); + bool useOpenGL = mUseOpenGL || (widget->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL); + if (useOpenGL) + return new QWaylandEglWindow(widget); + + return new QWaylandShmWindow(widget); } QWindowSurface *QWaylandIntegration::createWindowSurface(QWidget *widget, WId winId) const { Q_UNUSED(winId); Q_UNUSED(winId); - - if (mUseOpenGL) + bool useOpenGL = mUseOpenGL || (widget->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL); + if (useOpenGL) return new QWaylandDrmWindowSurface(widget); + return new QWaylandShmWindowSurface(widget); } diff --git a/src/plugins/platforms/wayland/qwaylandscreen.cpp b/src/plugins/platforms/wayland/qwaylandscreen.cpp index aa1083f..35e2532 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.cpp +++ b/src/plugins/platforms/wayland/qwaylandscreen.cpp @@ -85,3 +85,22 @@ QWaylandScreen * QWaylandScreen::waylandScreenFromWidget(QWidget *widget) QPlatformScreen *platformScreen = QPlatformScreen::platformScreenForWidget(widget); return static_cast(platformScreen); } + +wl_visual * QWaylandScreen::visual() const +{ + struct wl_visual *visual; + + switch (format()) { + case QImage::Format_ARGB32: + visual = mWaylandDisplay->argbVisual(); + break; + case QImage::Format_ARGB32_Premultiplied: + visual = mWaylandDisplay->argbPremultipliedVisual(); + break; + default: + qDebug("unsupported buffer format %d requested\n", format()); + visual = mWaylandDisplay->argbVisual(); + break; + } + return visual; +} diff --git a/src/plugins/platforms/wayland/qwaylandscreen.h b/src/plugins/platforms/wayland/qwaylandscreen.h index 368859f..7784646 100644 --- a/src/plugins/platforms/wayland/qwaylandscreen.h +++ b/src/plugins/platforms/wayland/qwaylandscreen.h @@ -46,6 +46,7 @@ class QWaylandDisplay; class QWaylandCursor; +struct wl_visual; class QWaylandScreen : public QPlatformScreen { @@ -59,6 +60,8 @@ public: int depth() const; QImage::Format format() const; + wl_visual *visual() const; + static QWaylandScreen *waylandScreenFromWidget(QWidget *widget); private: diff --git a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp index 83bb993..9bcae26 100644 --- a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp @@ -44,7 +44,7 @@ #include #include "qwaylanddisplay.h" -#include "qwaylandwindow.h" +#include "qwaylandshmwindow.h" #include "qwaylandscreen.h" #include @@ -111,23 +111,22 @@ void QWaylandShmWindowSurface::flush(QWidget *widget, const QRegion ®ion, con { Q_UNUSED(widget); Q_UNUSED(offset); - QWaylandWindow *ww = (QWaylandWindow *) window()->platformWindow(); - QVector rects = region.rects(); - const QRect *r; - int i; + QWaylandShmWindow *waylandWindow = static_cast(window()->platformWindow()); + Q_ASSERT(waylandWindow->windowType() == QWaylandWindow::Shm); - for (i = 0; i < rects.size(); i++) { - r = &rects.at(i); - wl_surface_damage(ww->surface(), - r->x(), r->y(), r->width(), r->height()); + QVector rects = region.rects(); + for (int i = 0; i < rects.size(); i++) { + waylandWindow->damage(rects.at(i)); } } void QWaylandShmWindowSurface::resize(const QSize &size) { - QWaylandWindow *ww = (QWaylandWindow *) window()->platformWindow(); + QWaylandShmWindow *waylandWindow = static_cast(window()->platformWindow()); + Q_ASSERT(waylandWindow->windowType() == QWaylandWindow::Shm); + QWindowSurface::resize(size); - QImage::Format format = QApplicationPrivate::platformIntegration()->screens().first()->format(); + QImage::Format format = QPlatformScreen::platformScreenForWidget(window())->format(); if (mBuffer != NULL && mBuffer->size() == size) return; @@ -137,7 +136,7 @@ void QWaylandShmWindowSurface::resize(const QSize &size) mBuffer = new QWaylandShmBuffer(mDisplay, size, format); - ww->attach(mBuffer); + waylandWindow->attach(mBuffer); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.cpp b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp new file mode 100644 index 0000000..cafd2d0 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandshmwindow.cpp @@ -0,0 +1,89 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qwaylandshmwindow.h" + +#include "qwaylandbuffer.h" + +QWaylandShmWindow::QWaylandShmWindow(QWidget *widget) + : QWaylandWindow(widget) + , mBuffer(0) +{ + newSurfaceCreated(); +} + +QWaylandShmWindow::~QWaylandShmWindow() +{ + +} + +QWaylandWindow::WindowType QWaylandShmWindow::windowType() const +{ + return QWaylandWindow::Shm; +} + +QPlatformGLContext * QWaylandShmWindow::glContext() const +{ + qWarning("Trying to retrieve a glContext from a Raster window surface!"); + return 0; +} + +void QWaylandShmWindow::attach(QWaylandBuffer *buffer) +{ + mBuffer = buffer; + if (mSurface) { + wl_surface_attach(mSurface, buffer->buffer(),0,0); + } +} + + +void QWaylandShmWindow::damage(const QRect &rect) +{ + wl_surface_damage(mSurface, + rect.x(), rect.y(), rect.width(), rect.height()); +} + +void QWaylandShmWindow::newSurfaceCreated() +{ + if (mBuffer) { + wl_surface_attach(mSurface,mBuffer->buffer(),0,0); + } +} diff --git a/src/plugins/platforms/wayland/qwaylandshmwindow.h b/src/plugins/platforms/wayland/qwaylandshmwindow.h new file mode 100644 index 0000000..14a29d2 --- /dev/null +++ b/src/plugins/platforms/wayland/qwaylandshmwindow.h @@ -0,0 +1,63 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the config.tests of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWAYLANDSHMWINDOW_H +#define QWAYLANDSHMWINDOW_H + +#include "qwaylandwindow.h" + +class QWaylandShmWindow : public QWaylandWindow +{ +public: + QWaylandShmWindow(QWidget *widget); + ~QWaylandShmWindow(); + + WindowType windowType() const; + QPlatformGLContext *glContext() const; + void attach(QWaylandBuffer *buffer); + void damage(const QRect &rect); +protected: + void newSurfaceCreated(); +private: + QWaylandBuffer *mBuffer; +}; + +#endif // QWAYLANDSHMWINDOW_H diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index a28bdfe..934bbff 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -43,10 +43,6 @@ #include "qwaylanddisplay.h" #include "qwaylandscreen.h" -#include "qwaylandglcontext.h" -#include "qwaylandbuffer.h" - -#include "qwaylanddrmsurface.h" #include #include @@ -56,8 +52,6 @@ QWaylandWindow::QWaylandWindow(QWidget *window) : QPlatformWindow(window) , mDisplay(QWaylandScreen::waylandScreenFromWidget(window)->display()) - , mGLContext(0) - , mBuffer(0) { static WId id = 1; mWindowId = id++; @@ -67,8 +61,6 @@ QWaylandWindow::QWaylandWindow(QWidget *window) QWaylandWindow::~QWaylandWindow() { - if (mGLContext) - delete mGLContext; } WId QWaylandWindow::winId() const @@ -78,13 +70,17 @@ WId QWaylandWindow::winId() const void QWaylandWindow::setParent(const QPlatformWindow *parent) { - QWaylandWindow *wParent = (QWaylandWindow *)parent; - - mParentWindow = wParent; + Q_UNUSED(parent); + qWarning("Trying to add a raster window as a sub-window"); } void QWaylandWindow::setVisible(bool visible) { + if (!mSurface) { + mSurface = mDisplay->createSurface(); + newSurfaceCreated(); + } + if (visible) { wl_surface_set_user_data(mSurface, this); wl_surface_map_toplevel(mSurface); @@ -94,13 +90,6 @@ void QWaylandWindow::setVisible(bool visible) } } -void QWaylandWindow::attach(QWaylandBuffer *buffer) -{ - if (mSurface) { - wl_surface_attach(mSurface, buffer->buffer(),0,0); - } -} - void QWaylandWindow::configure(uint32_t time, uint32_t edges, int32_t x, int32_t y, int32_t width, int32_t height) @@ -111,13 +100,3 @@ void QWaylandWindow::configure(uint32_t time, uint32_t edges, QWindowSystemInterface::handleGeometryChange(widget(), geometry); } - -QPlatformGLContext *QWaylandWindow::glContext() const -{ - if (!mGLContext) { - QWaylandWindow *that = const_cast(this); - that->mGLContext = new QWaylandGLContext(mDisplay, widget()->platformWindowFormat()); - } - - return mGLContext; -} diff --git a/src/plugins/platforms/wayland/qwaylandwindow.h b/src/plugins/platforms/wayland/qwaylandwindow.h index 8b047d7..3b51ee7 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.h +++ b/src/plugins/platforms/wayland/qwaylandwindow.h @@ -45,35 +45,38 @@ #include #include +#include "qwaylanddisplay.h" class QWaylandDisplay; class QWaylandBuffer; +struct wl_egl_window; class QWaylandWindow : public QPlatformWindow { public: + enum WindowType { + Shm, + Egl + }; + QWaylandWindow(QWidget *window); ~QWaylandWindow(); - struct wl_surface *surface() { return mSurface; } + virtual WindowType windowType() const = 0; + WId winId() const; void setVisible(bool visible); + void setParent(const QPlatformWindow *parent); + void configure(uint32_t time, uint32_t edges, int32_t x, int32_t y, int32_t width, int32_t height); - WId winId() const; - void setParent(const QPlatformWindow *parent); - QPlatformGLContext *glContext() const; - void attach(QWaylandBuffer *buffer); - QWaylandBuffer *getBuffer(void) { return mBuffer; } - QWaylandWindow *getParentWindow(void) { return mParentWindow; } -private: +protected: struct wl_surface *mSurface; + virtual void newSurfaceCreated() = 0; QWaylandDisplay *mDisplay; - QPlatformGLContext *mGLContext; WId mWindowId; - QWaylandBuffer *mBuffer; - QWaylandWindow *mParentWindow; + }; diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro index 803a8e9..7e8a1fa 100644 --- a/src/plugins/platforms/wayland/wayland.pro +++ b/src/plugins/platforms/wayland/wayland.pro @@ -9,20 +9,27 @@ SOURCES = main.cpp \ qwaylanddrmsurface.cpp \ qwaylandinputdevice.cpp \ qwaylandglcontext.cpp \ - qwaylandcursor.cpp \ - qwaylanddisplay.cpp \ - qwaylandwindow.cpp \ - qwaylandscreen.cpp + qwaylandcursor.cpp \ + qwaylanddisplay.cpp \ + qwaylandwindow.cpp \ + qwaylandscreen.cpp \ + ../eglconvenience/qeglconvenience.cpp \ + qwaylandeglwindow.cpp \ + qwaylandshmwindow.cpp HEADERS = qwaylandintegration.h \ - qwaylandcursor.h \ - qwaylanddisplay.h \ - qwaylandwindow.h \ - qwaylandscreen.h \ - qwaylandglcontext.h \ - qwaylandshmsurface.h \ - qwaylanddrmsurface.h \ - qwaylandbuffer.h + qwaylandcursor.h \ + qwaylanddisplay.h \ + qwaylandwindow.h \ + qwaylandscreen.h \ + qwaylandglcontext.h \ + qwaylandshmsurface.h \ + qwaylanddrmsurface.h \ + qwaylandbuffer.h \ + ../eglconvenience/qeglconvenience.h \ + qwaylandinclude.h \ + qwaylandeglwindow.h \ + qwaylandshmwindow.h contains(QT_CONFIG, opengl) { QT += opengl -- cgit v0.12 From ea20564a32336c40adb7e3f8e7c5ae13497883c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Wed, 9 Feb 2011 15:40:06 +0100 Subject: Remove warning msg in Lighthouse QGLWidget code --- src/opengl/qgl_qpa.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/opengl/qgl_qpa.cpp b/src/opengl/qgl_qpa.cpp index b865086..d2c0166 100644 --- a/src/opengl/qgl_qpa.cpp +++ b/src/opengl/qgl_qpa.cpp @@ -324,7 +324,6 @@ void QGLWidget::setMouseTracking(bool enable) bool QGLWidget::event(QEvent *e) { - Q_D(QGLWidget); return QWidget::event(e); } -- cgit v0.12 From 909674fce854cd7f761891b918cdf3342e81a0ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 10 Feb 2011 10:08:56 +0100 Subject: Lighthouse: Wayland: Fix include --- src/plugins/platforms/wayland/qwaylandeglwindow.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylandeglwindow.cpp b/src/plugins/platforms/wayland/qwaylandeglwindow.cpp index 6e5e5bb..0bdf44d 100644 --- a/src/plugins/platforms/wayland/qwaylandeglwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandeglwindow.cpp @@ -43,9 +43,7 @@ #include "qwaylandscreen.h" #include "qwaylandglcontext.h" - -#include - +#include "qwaylandinclude.h" QWaylandEglWindow::QWaylandEglWindow(QWidget *window) : QWaylandWindow(window) -- cgit v0.12 From ae873c93125df1c6afe03fe30f70878a8d47414a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Thu, 10 Feb 2011 10:09:18 +0100 Subject: Lighthouse: Wayland compile-fix for egl interface change --- src/plugins/platforms/wayland/qwaylandeglwindow.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/platforms/wayland/qwaylandeglwindow.cpp b/src/plugins/platforms/wayland/qwaylandeglwindow.cpp index 0bdf44d..ed54bb9 100644 --- a/src/plugins/platforms/wayland/qwaylandeglwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandeglwindow.cpp @@ -104,7 +104,7 @@ void QWaylandEglWindow::newSurfaceCreated() if (!size.isValid()) size = QSize(0,0); - mWaylandEglWindow = wl_egl_window_create(mSurface,size.width(),size.height(),visual); + mWaylandEglWindow = wl_egl_window_create(mDisplay->nativeDisplay(),mSurface,size.width(),size.height(),visual); if (mGLContext) { EGLNativeWindowType window(reinterpret_cast(mWaylandEglWindow)); EGLSurface surface = eglCreateWindowSurface(mDisplay->eglDisplay(),mGLContext->eglConfig(),window,NULL); -- cgit v0.12 From b6e74de57f6f7504148987394c311c215ec7b375 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 10 Feb 2011 10:11:55 +0100 Subject: Small improvement to XCB key input handling. If xcb_key_symbols_get_keysym returns XCB_NO_SYMBOL, try the other column. --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index 67039a7..dcb35fd 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -911,6 +911,8 @@ QXcbKeyboard::~QXcbKeyboard() xcb_key_symbols_free(m_key_symbols); } +// #define XCB_KEYBOARD_DEBUG + void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keycode_t code, quint16 state, xcb_timestamp_t time) { int col = state & XCB_MOD_MASK_SHIFT ? 1 : 0; @@ -919,7 +921,17 @@ void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keycod if (state & 128) col += altGrOffset; +#ifdef XCB_KEYBOARD_DEBUG + printf("key code: %d, state: %d, syms: ", code, state); + for (int i = 0; i <= 5; ++i) { + printf("%d ", xcb_key_symbols_get_keysym(m_key_symbols, code, i)); + } + printf("\n"); +#endif + xcb_keysym_t sym = xcb_key_symbols_get_keysym(m_key_symbols, code, col); + if (sym == XCB_NO_SYMBOL) + sym = xcb_key_symbols_get_keysym(m_key_symbols, code, col ^ 0x1); if (state & XCB_MOD_MASK_LOCK && sym <= 0x7f && isprint(sym)) { if (isupper(sym)) -- cgit v0.12 From e279d2ae598c7b05dff843e021fc8a08199c36de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 10 Feb 2011 10:15:49 +0100 Subject: Fixed 'lingering' dialog bug in XCB backend. We need to flush the XCB command stream after unmapping a window, to ensure it doesn't get delayed. --- src/plugins/platforms/xcb/qxcbwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index b54a233..95110e6 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -130,6 +130,8 @@ void QXcbWindow::setVisible(bool visible) xcb_map_window(xcb_connection(), m_window); else xcb_unmap_window(xcb_connection(), m_window); + + xcb_flush(xcb_connection()); } struct QtMWMHints { -- cgit v0.12 From 51b657a032cb0b9b3c4c7dbfab52c148cf9253af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 10 Feb 2011 15:28:35 +0100 Subject: Added GL support to XCB backend. We need to use a Xlib / XCB hybrid approach, as GLX depends on Xlib, and there's no replacement for XCB. --- src/plugins/platforms/xcb/README | 2 + src/plugins/platforms/xcb/qglxintegration.cpp | 360 ++++++++++++++++++++++++++ src/plugins/platforms/xcb/qglxintegration.h | 87 +++++++ src/plugins/platforms/xcb/qxcbconnection.cpp | 24 +- src/plugins/platforms/xcb/qxcbconnection.h | 10 + src/plugins/platforms/xcb/qxcbintegration.cpp | 10 + src/plugins/platforms/xcb/qxcbintegration.h | 1 + src/plugins/platforms/xcb/qxcbscreen.cpp | 8 +- src/plugins/platforms/xcb/qxcbscreen.h | 5 +- src/plugins/platforms/xcb/qxcbwindow.cpp | 89 +++++-- src/plugins/platforms/xcb/qxcbwindow.h | 6 +- src/plugins/platforms/xcb/xcb.pro | 10 + 12 files changed, 588 insertions(+), 24 deletions(-) create mode 100644 src/plugins/platforms/xcb/README create mode 100644 src/plugins/platforms/xcb/qglxintegration.cpp create mode 100644 src/plugins/platforms/xcb/qglxintegration.h diff --git a/src/plugins/platforms/xcb/README b/src/plugins/platforms/xcb/README new file mode 100644 index 0000000..d250ad0 --- /dev/null +++ b/src/plugins/platforms/xcb/README @@ -0,0 +1,2 @@ +Required packages: +libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp new file mode 100644 index 0000000..0cb6b1d --- /dev/null +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -0,0 +1,360 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include +#include +#include + +#include "qxcbwindow.h" +#include "qxcbscreen.h" + +#include +#include +#include + +#include "qglxintegration.h" + +#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) +#include +#endif + +QMutex QGLXContext::m_defaultSharedContextMutex(QMutex::Recursive); + +QVector QGLXContext::buildSpec(const QPlatformWindowFormat &format) +{ + QVector spec(48); + int i = 0; + + spec[i++] = GLX_LEVEL; + spec[i++] = 0; + spec[i++] = GLX_DRAWABLE_TYPE; spec[i++] = GLX_WINDOW_BIT; + + if (format.rgba()) { + spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_RGBA_BIT; + spec[i++] = GLX_RED_SIZE; spec[i++] = (format.redBufferSize() == -1) ? 1 : format.redBufferSize(); + spec[i++] = GLX_GREEN_SIZE; spec[i++] = (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize(); + spec[i++] = GLX_BLUE_SIZE; spec[i++] = (format.blueBufferSize() == -1) ? 1 : format.blueBufferSize(); + if (format.alpha()) { + spec[i++] = GLX_ALPHA_SIZE; spec[i++] = (format.alphaBufferSize() == -1) ? 1 : format.alphaBufferSize(); + } + + spec[i++] = GLX_ACCUM_RED_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + spec[i++] = GLX_ACCUM_GREEN_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + spec[i++] = GLX_ACCUM_BLUE_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + + if (format.alpha()) { + spec[i++] = GLX_ACCUM_ALPHA_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + } + + } else { + spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_COLOR_INDEX_BIT; //I'm really not sure if this works.... + spec[i++] = GLX_BUFFER_SIZE; spec[i++] = 8; + } + + spec[i++] = GLX_DOUBLEBUFFER; spec[i++] = format.doubleBuffer() ? True : False; + spec[i++] = GLX_STEREO; spec[i++] = format.stereo() ? True : False; + + if (format.depth()) { + spec[i++] = GLX_DEPTH_SIZE; spec[i++] = (format.depthBufferSize() == -1) ? 1 : format.depthBufferSize(); + } + + if (format.stencil()) { + spec[i++] = GLX_STENCIL_SIZE; spec[i++] = (format.stencilBufferSize() == -1) ? 1 : format.stencilBufferSize(); + } + if (format.sampleBuffers()) { + spec[i++] = GLX_SAMPLE_BUFFERS_ARB; + spec[i++] = 1; + spec[i++] = GLX_SAMPLES_ARB; + spec[i++] = format.samples() == -1 ? 4 : format.samples(); + } + + spec[i++] = None; + return spec; +} + +GLXFBConfig QGLXContext::findConfig(const QXcbScreen *screen, const QPlatformWindowFormat &format) +{ + bool reduced = true; + GLXFBConfig chosenConfig = 0; + QPlatformWindowFormat reducedFormat = format; + while (!chosenConfig && reduced) { + QVector spec = buildSpec(reducedFormat); + int confcount = 0; + GLXFBConfig *configs; + configs = glXChooseFBConfig(DISPLAY_FROM_XCB(screen), screen->screenNumber(), spec.constData(), &confcount); + if (confcount) + { + for (int i = 0; i < confcount; i++) { + chosenConfig = configs[i]; + // Make sure we try to get an ARGB visual if the format asked for an alpha: + if (reducedFormat.alpha()) { + int alphaSize; + glXGetFBConfigAttrib(DISPLAY_FROM_XCB(screen), configs[i], GLX_ALPHA_SIZE, &alphaSize); + if (alphaSize > 0) + break; + } else { + break; // Just choose the first in the list if there's no alpha requested + } + } + + XFree(configs); + } + reducedFormat = reducePlatformWindowFormat(reducedFormat,&reduced); + } + + if (!chosenConfig) + qWarning("Warning no context created"); + + return chosenConfig; +} + +XVisualInfo *QGLXContext::findVisualInfo(const QXcbScreen *screen, const QPlatformWindowFormat &format) +{ + GLXFBConfig config = QGLXContext::findConfig(screen,format); + XVisualInfo *visualInfo = glXGetVisualFromFBConfig(DISPLAY_FROM_XCB(screen), config); + return visualInfo; +} + +QPlatformWindowFormat QGLXContext::platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext ctx) +{ + QPlatformWindowFormat format; + int redSize = 0; + int greenSize = 0; + int blueSize = 0; + int alphaSize = 0; + int depthSize = 0; + int stencilSize = 0; + int sampleBuffers = 0; + int sampleCount = 0; + int level = 0; + int rgba = 0; + int stereo = 0; + int accumSizeA = 0; + int accumSizeR = 0; + int accumSizeG = 0; + int accumSizeB = 0; + + XVisualInfo *vi = glXGetVisualFromFBConfig(display,config); + glXGetConfig(display,vi,GLX_RGBA,&rgba); + XFree(vi); + glXGetFBConfigAttrib(display, config, GLX_RED_SIZE, &redSize); + glXGetFBConfigAttrib(display, config, GLX_GREEN_SIZE, &greenSize); + glXGetFBConfigAttrib(display, config, GLX_BLUE_SIZE, &blueSize); + glXGetFBConfigAttrib(display, config, GLX_ALPHA_SIZE, &alphaSize); + glXGetFBConfigAttrib(display, config, GLX_DEPTH_SIZE, &depthSize); + glXGetFBConfigAttrib(display, config, GLX_STENCIL_SIZE, &stencilSize); + glXGetFBConfigAttrib(display, config, GLX_SAMPLES, &sampleBuffers); + glXGetFBConfigAttrib(display, config, GLX_LEVEL, &level); + glXGetFBConfigAttrib(display, config, GLX_STEREO, &stereo); + glXGetFBConfigAttrib(display, config, GLX_ACCUM_ALPHA_SIZE, &accumSizeA); + glXGetFBConfigAttrib(display, config, GLX_ACCUM_RED_SIZE, &accumSizeR); + glXGetFBConfigAttrib(display, config, GLX_ACCUM_GREEN_SIZE, &accumSizeG); + glXGetFBConfigAttrib(display, config, GLX_ACCUM_BLUE_SIZE, &accumSizeB); + + format.setRedBufferSize(redSize); + format.setGreenBufferSize(greenSize); + format.setBlueBufferSize(blueSize); + format.setAlphaBufferSize(alphaSize); + format.setDepthBufferSize(depthSize); + format.setStencilBufferSize(stencilSize); + format.setSampleBuffers(sampleBuffers); + if (format.sampleBuffers()) { + glXGetFBConfigAttrib(display, config, GLX_SAMPLES_ARB, &sampleCount); + format.setSamples(sampleCount); + } + + format.setDirectRendering(glXIsDirect(display, ctx)); + format.setRgba(rgba); + format.setStereo(stereo); + format.setAccumBufferSize(accumSizeB); + + return format; +} + +QPlatformWindowFormat QGLXContext::reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced) +{ + QPlatformWindowFormat retFormat = format; + *reduced = true; + + if (retFormat.sampleBuffers()) { + retFormat.setSampleBuffers(false); + } else if (retFormat.stereo()) { + retFormat.setStereo(false); + } else if (retFormat.accum()) { + retFormat.setAccum(false); + }else if (retFormat.stencil()) { + retFormat.setStencil(false); + }else if (retFormat.alpha()) { + retFormat.setAlpha(false); + }else if (retFormat.depth()) { + retFormat.setDepth(false); + }else if (retFormat.doubleBuffer()) { + retFormat.setDoubleBuffer(false); + }else{ + *reduced = false; + } + return retFormat; +} + +QGLXContext::QGLXContext(Window window, QXcbScreen *screen, const QPlatformWindowFormat &format) + : QPlatformGLContext() + , m_screen(screen) + , m_drawable((Drawable)window) + , m_context(0) +{ + + const QPlatformGLContext *sharePlatformContext; + if (format.useDefaultSharedContext()) { + if (!QPlatformGLContext::defaultSharedContext()) { + if (m_defaultSharedContextMutex.tryLock()){ + createDefaultSharedContex(screen); + m_defaultSharedContextMutex.unlock(); + } else { + m_defaultSharedContextMutex.lock(); //wait to the the shared context is created + m_defaultSharedContextMutex.unlock(); + } + } + sharePlatformContext = QPlatformGLContext::defaultSharedContext(); + } else { + sharePlatformContext = format.sharedGLContext(); + } + GLXContext shareGlxContext = 0; + if (sharePlatformContext) + shareGlxContext = static_cast(sharePlatformContext)->glxContext(); + + GLXFBConfig config = findConfig(screen,format); + m_context = glXCreateNewContext(DISPLAY_FROM_XCB(screen), config, GLX_RGBA_TYPE, shareGlxContext, TRUE); + m_windowFormat = QGLXContext::platformWindowFromGLXFBConfig(DISPLAY_FROM_XCB(screen), config, m_context); +} + +QGLXContext::QGLXContext(QXcbScreen *screen, Drawable drawable, GLXContext context) + : QPlatformGLContext(), m_screen(screen), m_drawable(drawable), m_context(context) +{ + +} + +QGLXContext::~QGLXContext() +{ + if (m_context) + glXDestroyContext(DISPLAY_FROM_XCB(m_screen), m_context); +} + +void QGLXContext::createDefaultSharedContex(QXcbScreen *screen) +{ + int x = 0; + int y = 0; + int w = 3; + int h = 3; + + QPlatformWindowFormat format = QPlatformWindowFormat::defaultFormat(); + GLXContext context; + GLXFBConfig config = findConfig(screen,format); + if (config) { + XVisualInfo *visualInfo = glXGetVisualFromFBConfig(DISPLAY_FROM_XCB(screen), config); + Colormap cmap = XCreateColormap(DISPLAY_FROM_XCB(screen), screen->root(), visualInfo->visual, AllocNone); + XSetWindowAttributes a; + a.colormap = cmap; + Window sharedWindow = XCreateWindow(DISPLAY_FROM_XCB(screen), screen->root(), x, y, w, h, + 0, visualInfo->depth, InputOutput, visualInfo->visual, + CWColormap, &a); + + context = glXCreateNewContext(DISPLAY_FROM_XCB(screen), config, GLX_RGBA_TYPE, 0, TRUE); + QPlatformGLContext *sharedContext = new QGLXContext(screen, sharedWindow, context); + QPlatformGLContext::setDefaultSharedContext(sharedContext); + } else { + qWarning("Warning no shared context created"); + } +} + +void QGLXContext::makeCurrent() +{ + QPlatformGLContext::makeCurrent(); + glXMakeCurrent(DISPLAY_FROM_XCB(m_screen), m_drawable, m_context); +} + +void QGLXContext::doneCurrent() +{ + QPlatformGLContext::doneCurrent(); + glXMakeCurrent(DISPLAY_FROM_XCB(m_screen), 0, 0); +} + +void QGLXContext::swapBuffers() +{ + glXSwapBuffers(DISPLAY_FROM_XCB(m_screen), m_drawable); +} + +void* QGLXContext::getProcAddress(const QString& procName) +{ + typedef void *(*qt_glXGetProcAddressARB)(const GLubyte *); + static qt_glXGetProcAddressARB glXGetProcAddressARB = 0; + static bool resolved = false; + + if (resolved && !glXGetProcAddressARB) + return 0; + if (!glXGetProcAddressARB) { + QList glxExt = QByteArray(glXGetClientString(DISPLAY_FROM_XCB(m_screen), GLX_EXTENSIONS)).split(' '); + if (glxExt.contains("GLX_ARB_get_proc_address")) { +#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) + void *handle = dlopen(NULL, RTLD_LAZY); + if (handle) { + glXGetProcAddressARB = (qt_glXGetProcAddressARB) dlsym(handle, "glXGetProcAddressARB"); + dlclose(handle); + } + if (!glXGetProcAddressARB) +#endif + { + extern const QString qt_gl_library_name(); +// QLibrary lib(qt_gl_library_name()); + QLibrary lib(QLatin1String("GL")); + glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB"); + } + } + resolved = true; + } + if (!glXGetProcAddressARB) + return 0; + return glXGetProcAddressARB(reinterpret_cast(procName.toLatin1().data())); +} + +QPlatformWindowFormat QGLXContext::platformWindowFormat() const +{ + return m_windowFormat; +} diff --git a/src/plugins/platforms/xcb/qglxintegration.h b/src/plugins/platforms/xcb/qglxintegration.h new file mode 100644 index 0000000..0006363 --- /dev/null +++ b/src/plugins/platforms/xcb/qglxintegration.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGLXINTEGRATION_H +#define QGLXINTEGRATION_H + +#include "qxcbwindow.h" + +#include +#include + +#include + +#include + +class QGLXContext : public QPlatformGLContext +{ +public: + QGLXContext(Window window, QXcbScreen *xd, const QPlatformWindowFormat &format); + ~QGLXContext(); + + virtual void makeCurrent(); + virtual void doneCurrent(); + virtual void swapBuffers(); + virtual void* getProcAddress(const QString& procName); + + GLXContext glxContext() const { return m_context; } + + QPlatformWindowFormat platformWindowFormat() const; + + static XVisualInfo *findVisualInfo(const QXcbScreen *xd, const QPlatformWindowFormat &format); + +private: + static GLXFBConfig findConfig(const QXcbScreen *xd,const QPlatformWindowFormat &format); + static QVector buildSpec(const QPlatformWindowFormat &format); + static QPlatformWindowFormat platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context); + static QPlatformWindowFormat reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced); + + QXcbScreen *m_screen; + Drawable m_drawable; + GLXContext m_context; + QPlatformWindowFormat m_windowFormat; + + QGLXContext (QXcbScreen *screen, Drawable drawable, GLXContext context); + static QMutex m_defaultSharedContextMutex; + static void createDefaultSharedContex(QXcbScreen *xd); +}; + +#endif diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 2977d76..eafd83a 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -49,19 +49,33 @@ #include +#ifdef XCB_USE_XLIB_FOR_GLX +#include +#include +#endif + QXcbConnection::QXcbConnection(const char *displayName) : m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY")) { - int primaryScreen; - + int primaryScreen = 0; + +#ifdef XCB_USE_XLIB_FOR_GLX + Display *dpy = XOpenDisplay(m_displayName.constData()); + primaryScreen = DefaultScreen(dpy); + m_connection = XGetXCBConnection(dpy); + XSetEventQueueOwner(dpy, XCBOwnsEventQueue); + m_xlib_display = dpy; +#else m_connection = xcb_connect(m_displayName.constData(), &primaryScreen); +#endif m_setup = xcb_get_setup(xcb_connection()); xcb_screen_iterator_t it = xcb_setup_roots_iterator(m_setup); + int screenNumber = 0; while (it.rem) { - m_screens << new QXcbScreen(this, it.data); + m_screens << new QXcbScreen(this, it.data, screenNumber++); xcb_screen_next(&it); } @@ -77,7 +91,11 @@ QXcbConnection::~QXcbConnection() { qDeleteAll(m_screens); +#ifdef XCB_USE_XLIB_FOR_GLX + XCloseDisplay((Display *)m_xlib_display); +#else xcb_disconnect(xcb_connection()); +#endif delete m_keyboard; } diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 97f9ba5..8a225c2 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -232,6 +232,10 @@ public: QXcbKeyboard *keyboard() const { return m_keyboard; } +#ifdef XCB_USE_XLIB_FOR_GLX + void *xlib_display() const { return m_xlib_display; } +#endif + private slots: void eventDispatcher(); @@ -249,6 +253,12 @@ private: QByteArray m_displayName; QXcbKeyboard *m_keyboard; + +#ifdef XCB_USE_XLIB_FOR_GLX + void *m_xlib_display; +#endif }; +#define DISPLAY_FROM_XCB(object) ((Display *)(object->connection()->xlib_display())) + #endif diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 5da86010..89a6154 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -114,3 +114,13 @@ QPixmap QXcbIntegration::grabWindow(WId window, int x, int y, int width, int hei Q_UNUSED(height); return QPixmap(); } + + +bool QXcbIntegration::hasOpenGL() const +{ +#ifdef XCB_USE_XLIB_FOR_GLX + return true; +#else + return false; +#endif +} diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index 8b599b3..80f70fb 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -65,6 +65,7 @@ public: QPixmap grabWindow(WId window, int x, int y, int width, int height) const; QPlatformFontDatabase *fontDatabase() const; + bool hasOpenGL() const; private: QList m_screens; diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 4faa617..519db63 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -43,9 +43,10 @@ #include -QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen) +QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen, int number) : QXcbObject(connection) , m_screen(screen) + , m_number(number) { printf ("\n"); printf ("Informations of screen %d:\n", screen->root); @@ -91,3 +92,8 @@ QSize QXcbScreen::physicalSize() const { return QSize(m_screen->width_in_millimeters, m_screen->height_in_millimeters); } + +int QXcbScreen::screenNumber() const +{ + return m_number; +} diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index abebcd9..77ee46f 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -53,7 +53,7 @@ class QXcbConnection; class QXcbScreen : public QXcbObject, public QPlatformScreen { public: - QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen); + QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen, int number); ~QXcbScreen(); QRect geometry() const; @@ -61,11 +61,14 @@ public: QImage::Format format() const; QSize physicalSize() const; + int screenNumber() const; + xcb_screen_t *screen() const { return m_screen; } xcb_window_t root() const { return m_screen->root; } private: xcb_screen_t *m_screen; + int m_number; }; #endif diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 95110e6..e9ff5df 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -44,14 +44,24 @@ #include "qxcbconnection.h" #include "qxcbscreen.h" +#include #include #include #include +#ifdef XCB_USE_XLIB_FOR_GLX +#include +#include +#include "qglxintegration.h" +#endif + QXcbWindow::QXcbWindow(QWidget *tlw) : QPlatformWindow(tlw) +#ifdef XCB_USE_XLIB_FOR_GLX + , m_glx_context(0) +#endif { m_screen = static_cast(QPlatformScreen::platformScreenForWidget(tlw)); @@ -75,20 +85,44 @@ QXcbWindow::QXcbWindow(QWidget *tlw) | XCB_EVENT_MASK_FOCUS_CHANGE }; - m_window = xcb_generate_id(xcb_connection()); - xcb_create_window(xcb_connection(), - XCB_COPY_FROM_PARENT, // depth -- same as root - m_window, // window id - m_screen->root(), // parent window id - tlw->x(), - tlw->y(), - tlw->width(), - tlw->height(), - 0, // border width - XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class - m_screen->screen()->root_visual, // visual - mask, // value mask - values); // value list +#ifdef XCB_USE_XLIB_FOR_GLX + if (tlw->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL + && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { + XVisualInfo *visualInfo = QGLXContext::findVisualInfo(m_screen, tlw->platformWindowFormat()); + if (visualInfo) { + Colormap cmap = XCreateColormap(DISPLAY_FROM_XCB(this), m_screen->root(), visualInfo->visual, AllocNone); + + XSetWindowAttributes a; + a.colormap = cmap; + m_window = XCreateWindow(DISPLAY_FROM_XCB(this), m_screen->root(), tlw->x(), tlw->y(), tlw->width(), tlw->height(), + 0, visualInfo->depth, InputOutput, visualInfo->visual, + CWColormap, &a); + + printf("created GL window: %d\n", m_window); + } else { + qFatal("no window!"); + } + } else +#endif + { + m_window = xcb_generate_id(xcb_connection()); + + xcb_create_window(xcb_connection(), + XCB_COPY_FROM_PARENT, // depth -- same as root + m_window, // window id + m_screen->root(), // parent window id + tlw->x(), + tlw->y(), + tlw->width(), + tlw->height(), + 0, // border width + XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class + m_screen->screen()->root_visual, // visual + mask, // value mask + values); // value list + + printf("created regular window: %d\n", m_window); + } xcb_atom_t properties[4]; int propertyCount = 0; @@ -126,12 +160,12 @@ void QXcbWindow::setGeometry(const QRect &rect) void QXcbWindow::setVisible(bool visible) { - if (visible) + if (visible) { xcb_map_window(xcb_connection(), m_window); - else + } else { xcb_unmap_window(xcb_connection(), m_window); - - xcb_flush(xcb_connection()); + xcb_flush(xcb_connection()); + } } struct QtMWMHints { @@ -317,6 +351,25 @@ void QXcbWindow::requestActivateWindow() xcb_set_input_focus(xcb_connection(), m_window, XCB_INPUT_FOCUS_PARENT, XCB_TIME_CURRENT_TIME); } +QPlatformGLContext *QXcbWindow::glContext() const +{ +#ifdef XCB_USE_XLIB_FOR_GLX + if (!QApplicationPrivate::platformIntegration()->hasOpenGL()) { + printf("no opengl\n"); + return 0; + } + + if (!m_glx_context) { + QXcbWindow *that = const_cast(this); + that->m_glx_context = new QGLXContext(m_window, m_screen, widget()->platformWindowFormat()); + } + + return m_glx_context; +#else + return 0; +#endif +} + void QXcbWindow::handleExposeEvent(const xcb_expose_event_t *event) { QWindowSurface *surface = widget()->windowSurface(); diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 17e1742..8db1a1e 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -48,6 +48,7 @@ #include "qxcbobject.h" +class QGLXContext; class QXcbScreen; class QXcbWindow : public QXcbObject, public QPlatformWindow @@ -69,7 +70,7 @@ public: void requestActivateWindow(); - QPlatformGLContext *glContext() const { return 0; } + QPlatformGLContext *glContext() const; xcb_window_t window() const { return m_window; } @@ -91,6 +92,9 @@ private: QXcbScreen *m_screen; xcb_window_t m_window; +#ifdef XCB_USE_XLIB_FOR_GLX + QGLXContext *m_glx_context; +#endif }; #endif diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index 3aee0a2..58382c0 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -21,6 +21,16 @@ HEADERS = \ qxcbwindow.h \ qxcbwindowsurface.h +contains(QT_CONFIG, opengl):DEFINES += XCB_USE_XLIB_FOR_GLX + +contains(DEFINES, XCB_USE_XLIB_FOR_GLX) { + QT += opengl + + HEADERS += qglxintegration.h + SOURCES += qglxintegration.cpp + LIBS += -lX11 -lX11-xcb +} + LIBS += -lxcb -lxcb-image -lxcb-keysyms include (../fontdatabases/genericunix/genericunix.pri) -- cgit v0.12 From 03b79ca3fda15df214c68ee945ac56000a404d99 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 10 Feb 2011 18:30:51 +0100 Subject: Added warnings for unhandled XCB events. --- src/plugins/platforms/xcb/qxcbconnection.cpp | 46 ++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index eafd83a..3018f56 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -124,6 +124,51 @@ break; } \ break; +void unhandledXcbEventError(xcb_generic_event_t *event) +{ +#define UNHANDLED_XCB_EVENT(event) \ + case event: \ + printf("Unhandled XCB event: %d - %s\n", event, #event); \ + break; + + switch (event->response_type & ~0x80) { + UNHANDLED_XCB_EVENT(XCB_KEY_PRESS); + UNHANDLED_XCB_EVENT(XCB_KEY_RELEASE); + UNHANDLED_XCB_EVENT(XCB_BUTTON_PRESS); + UNHANDLED_XCB_EVENT(XCB_BUTTON_RELEASE); + UNHANDLED_XCB_EVENT(XCB_MOTION_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_ENTER_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_LEAVE_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_FOCUS_IN); + UNHANDLED_XCB_EVENT(XCB_FOCUS_OUT); + UNHANDLED_XCB_EVENT(XCB_KEYMAP_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_EXPOSE); + UNHANDLED_XCB_EVENT(XCB_GRAPHICS_EXPOSURE); + UNHANDLED_XCB_EVENT(XCB_VISIBILITY_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_CREATE_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_DESTROY_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_UNMAP_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_MAP_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_MAP_REQUEST); + UNHANDLED_XCB_EVENT(XCB_REPARENT_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_CONFIGURE_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_CONFIGURE_REQUEST); + UNHANDLED_XCB_EVENT(XCB_GRAVITY_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_RESIZE_REQUEST); + UNHANDLED_XCB_EVENT(XCB_CIRCULATE_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_CIRCULATE_REQUEST); + UNHANDLED_XCB_EVENT(XCB_PROPERTY_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_SELECTION_CLEAR); + UNHANDLED_XCB_EVENT(XCB_SELECTION_REQUEST); + UNHANDLED_XCB_EVENT(XCB_SELECTION_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_COLORMAP_NOTIFY); + UNHANDLED_XCB_EVENT(XCB_CLIENT_MESSAGE); + UNHANDLED_XCB_EVENT(XCB_MAPPING_NOTIFY); + default: + printf("Unhandled XCB event: %d - %s\n", event->response_type, "unknown"); + } +} + void QXcbConnection::eventDispatcher() { while (xcb_generic_event_t *event = xcb_poll_for_event(xcb_connection())) { @@ -156,6 +201,7 @@ void QXcbConnection::eventDispatcher() m_keyboard->handleMappingNotifyEvent((xcb_mapping_notify_event_t *)event); break; default: + unhandledXcbEventError(event); break; } } -- cgit v0.12 From 6257adcdd693ac5c4c258fd81b0e6b2dcfbf8750 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 10 Feb 2011 18:42:51 +0100 Subject: Added WM_TRANSIENT_FOR property to XCB backend. --- src/plugins/platforms/xcb/qxcbwindow.cpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index e9ff5df..824a967 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -57,6 +57,19 @@ #include "qglxintegration.h" #endif +// Returns true if we should set WM_TRANSIENT_FOR on \a w +static inline bool isTransient(const QWidget *w) +{ + return ((w->windowType() == Qt::Dialog + || w->windowType() == Qt::Sheet + || w->windowType() == Qt::Tool + || w->windowType() == Qt::SplashScreen + || w->windowType() == Qt::ToolTip + || w->windowType() == Qt::Drawer + || w->windowType() == Qt::Popup) + && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); +} + QXcbWindow::QXcbWindow(QWidget *tlw) : QPlatformWindow(tlw) #ifdef XCB_USE_XLIB_FOR_GLX @@ -141,6 +154,16 @@ QXcbWindow::QXcbWindow(QWidget *tlw) 32, propertyCount, properties); + + if (isTransient(tlw) && tlw->parentWidget()) { + // ICCCM 4.1.2.6 + QWidget *p = tlw->parentWidget()->window(); + xcb_window_t parentWindow = p->winId(); + xcb_change_property(xcb_connection(), XCB_PROP_MODE_REPLACE, m_window, + XCB_ATOM_WM_TRANSIENT_FOR, XCB_ATOM_WINDOW, 32, + 1, &parentWindow); + + } } QXcbWindow::~QXcbWindow() -- cgit v0.12 From 80b387b77863230e6edbc03695a971bcd0bcb5d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Thu, 10 Feb 2011 19:22:35 +0100 Subject: Conform to ICCCM when mapping / unmapping windows in XCB backend. --- src/plugins/platforms/xcb/README | 2 +- src/plugins/platforms/xcb/qxcbwindow.cpp | 19 +++++++++++++++++++ src/plugins/platforms/xcb/xcb.pro | 2 +- 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/README b/src/plugins/platforms/xcb/README index d250ad0..e88596b 100644 --- a/src/plugins/platforms/xcb/README +++ b/src/plugins/platforms/xcb/README @@ -1,2 +1,2 @@ Required packages: -libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev +libxcb1 libxcb1-dev libx11-xcb1 libx11-xcb-dev libxcb-keysyms1 libxcb-keysyms1-dev libxcb-image0 libxcb-image0-dev libxcb-shm0 libxcb-shm0-dev libxcb-icccm1 libxcb-icccm1-dev diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 824a967..7fb4cc4 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -44,6 +44,8 @@ #include "qxcbconnection.h" #include "qxcbscreen.h" +#include + #include #include @@ -183,10 +185,27 @@ void QXcbWindow::setGeometry(const QRect &rect) void QXcbWindow::setVisible(bool visible) { + xcb_wm_hints_t hints; if (visible) { + if (widget()->isMinimized()) + xcb_wm_hints_set_iconic(&hints); + else + xcb_wm_hints_set_normal(&hints); + xcb_set_wm_hints(xcb_connection(), m_window, &hints); xcb_map_window(xcb_connection(), m_window); } else { xcb_unmap_window(xcb_connection(), m_window); + + // send synthetic UnmapNotify event according to icccm 4.1.4 + xcb_unmap_notify_event_t event; + event.response_type = XCB_UNMAP_NOTIFY; + event.sequence = 0; // does this matter? + event.event = m_screen->root(); + event.window = m_window; + event.from_configure = false; + xcb_send_event(xcb_connection(), false, m_screen->root(), + XCB_EVENT_MASK_SUBSTRUCTURE_NOTIFY | XCB_EVENT_MASK_SUBSTRUCTURE_REDIRECT, (const char *)&event); + xcb_flush(xcb_connection()); } } diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index 58382c0..a6e92ef 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -31,7 +31,7 @@ contains(DEFINES, XCB_USE_XLIB_FOR_GLX) { LIBS += -lX11 -lX11-xcb } -LIBS += -lxcb -lxcb-image -lxcb-keysyms +LIBS += -lxcb -lxcb-image -lxcb-keysyms -lxcb-icccm include (../fontdatabases/genericunix/genericunix.pri) -- cgit v0.12 From 27ba43fe5302158cdb54bc0e3fd055b3008ec7ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 11 Feb 2011 07:55:12 +0100 Subject: Lighthouse: Wayland: Sort out egl includes in plugin We used to include the X part of the eglplatform.h, but now the mesa version of the header file has a WL_EGL_PLATFORM part. This define is defined in wayland-egl.h which thus needs to be included before any egl header file. --- src/plugins/platforms/eglconvenience/qeglconvenience.h | 4 ++++ src/plugins/platforms/wayland/qwaylandinclude.h | 15 --------------- src/plugins/platforms/wayland/wayland.pro | 2 ++ 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/src/plugins/platforms/eglconvenience/qeglconvenience.h b/src/plugins/platforms/eglconvenience/qeglconvenience.h index a1df3cc..681e9db 100644 --- a/src/plugins/platforms/eglconvenience/qeglconvenience.h +++ b/src/plugins/platforms/eglconvenience/qeglconvenience.h @@ -46,7 +46,11 @@ #include #include +#ifdef Q_PLATFORM_WAYLAND +#include "qwaylandinclude.h" +#else #include +#endif QT_BEGIN_NAMESPACE QVector q_createConfigAttributesFromFormat(const QPlatformWindowFormat &format); diff --git a/src/plugins/platforms/wayland/qwaylandinclude.h b/src/plugins/platforms/wayland/qwaylandinclude.h index d1f7e39..afaa885 100644 --- a/src/plugins/platforms/wayland/qwaylandinclude.h +++ b/src/plugins/platforms/wayland/qwaylandinclude.h @@ -50,23 +50,8 @@ #include #include -//#define MESA_EGL_NO_X11_HEADERS #define EGL_EGLEXT_PROTOTYPES #include #include -#undef FocusOut -#undef FocusIn -#undef KeyPress -#undef KeyRelease -#undef None -#undef RevertToParent -#undef GrayScale -#undef CursorShape - -#ifdef FontChange -#undef FontChange -#endif - - #endif // QWAYLANDINCLUDE_H diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro index 7e8a1fa..e40e423 100644 --- a/src/plugins/platforms/wayland/wayland.pro +++ b/src/plugins/platforms/wayland/wayland.pro @@ -3,6 +3,8 @@ include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms +DEFINES += Q_PLATFORM_WAYLAND + SOURCES = main.cpp \ qwaylandintegration.cpp \ qwaylandshmsurface.cpp \ -- cgit v0.12 From 0ade22781b4f8d291e0b096160f2db5a3caec9dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Fri, 11 Feb 2011 15:12:59 +0100 Subject: Lighthouse:Propogate the configure event to the QWaylandWindow --- src/plugins/platforms/wayland/qwaylandwindow.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandwindow.cpp b/src/plugins/platforms/wayland/qwaylandwindow.cpp index 934bbff..a912a83 100644 --- a/src/plugins/platforms/wayland/qwaylandwindow.cpp +++ b/src/plugins/platforms/wayland/qwaylandwindow.cpp @@ -98,5 +98,7 @@ void QWaylandWindow::configure(uint32_t time, uint32_t edges, Q_UNUSED(edges); QRect geometry = QRect(x, y, width, height); + setGeometry(geometry); + QWindowSystemInterface::handleGeometryChange(widget(), geometry); } -- cgit v0.12 From 6027b734714aadf22d34f4e99663b4117cdb4a28 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 14 Feb 2011 10:44:44 +0100 Subject: Properly update the geometry variable of QPlatformWindow when resized. --- src/plugins/platforms/xcb/qxcbwindow.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 7fb4cc4..78cba1c 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -441,7 +441,10 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t * ypos = event->y; } - QWindowSystemInterface::handleGeometryChange(widget(), QRect(xpos, ypos, event->width, event->height)); + QRect rect(xpos, ypos, event->width, event->height); + QPlatformWindow::setGeometry(rect); + + QWindowSystemInterface::handleGeometryChange(widget(), rect); } static Qt::MouseButtons translateMouseButtons(int s) -- cgit v0.12 From b46f72e62a5cb781ec94d7cd0317f5cf58c26693 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= Date: Mon, 14 Feb 2011 10:54:35 +0100 Subject: More debugging of XCB events. --- src/plugins/platforms/xcb/qxcbconnection.cpp | 84 +++++++++++++++------------- 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 3018f56..0696ed3 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -124,49 +124,56 @@ break; } \ break; -void unhandledXcbEventError(xcb_generic_event_t *event) +#define XCB_EVENT_DEBUG + +void printXcbEvent(const char *message, xcb_generic_event_t *event) { -#define UNHANDLED_XCB_EVENT(event) \ +#ifdef XCB_EVENT_DEBUG +#define PRINT_XCB_EVENT(event) \ case event: \ - printf("Unhandled XCB event: %d - %s\n", event, #event); \ + printf("%s: %d - %s\n", message, event, #event); \ break; switch (event->response_type & ~0x80) { - UNHANDLED_XCB_EVENT(XCB_KEY_PRESS); - UNHANDLED_XCB_EVENT(XCB_KEY_RELEASE); - UNHANDLED_XCB_EVENT(XCB_BUTTON_PRESS); - UNHANDLED_XCB_EVENT(XCB_BUTTON_RELEASE); - UNHANDLED_XCB_EVENT(XCB_MOTION_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_ENTER_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_LEAVE_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_FOCUS_IN); - UNHANDLED_XCB_EVENT(XCB_FOCUS_OUT); - UNHANDLED_XCB_EVENT(XCB_KEYMAP_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_EXPOSE); - UNHANDLED_XCB_EVENT(XCB_GRAPHICS_EXPOSURE); - UNHANDLED_XCB_EVENT(XCB_VISIBILITY_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_CREATE_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_DESTROY_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_UNMAP_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_MAP_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_MAP_REQUEST); - UNHANDLED_XCB_EVENT(XCB_REPARENT_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_CONFIGURE_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_CONFIGURE_REQUEST); - UNHANDLED_XCB_EVENT(XCB_GRAVITY_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_RESIZE_REQUEST); - UNHANDLED_XCB_EVENT(XCB_CIRCULATE_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_CIRCULATE_REQUEST); - UNHANDLED_XCB_EVENT(XCB_PROPERTY_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_SELECTION_CLEAR); - UNHANDLED_XCB_EVENT(XCB_SELECTION_REQUEST); - UNHANDLED_XCB_EVENT(XCB_SELECTION_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_COLORMAP_NOTIFY); - UNHANDLED_XCB_EVENT(XCB_CLIENT_MESSAGE); - UNHANDLED_XCB_EVENT(XCB_MAPPING_NOTIFY); + PRINT_XCB_EVENT(XCB_KEY_PRESS); + PRINT_XCB_EVENT(XCB_KEY_RELEASE); + PRINT_XCB_EVENT(XCB_BUTTON_PRESS); + PRINT_XCB_EVENT(XCB_BUTTON_RELEASE); + PRINT_XCB_EVENT(XCB_MOTION_NOTIFY); + PRINT_XCB_EVENT(XCB_ENTER_NOTIFY); + PRINT_XCB_EVENT(XCB_LEAVE_NOTIFY); + PRINT_XCB_EVENT(XCB_FOCUS_IN); + PRINT_XCB_EVENT(XCB_FOCUS_OUT); + PRINT_XCB_EVENT(XCB_KEYMAP_NOTIFY); + PRINT_XCB_EVENT(XCB_EXPOSE); + PRINT_XCB_EVENT(XCB_GRAPHICS_EXPOSURE); + PRINT_XCB_EVENT(XCB_VISIBILITY_NOTIFY); + PRINT_XCB_EVENT(XCB_CREATE_NOTIFY); + PRINT_XCB_EVENT(XCB_DESTROY_NOTIFY); + PRINT_XCB_EVENT(XCB_UNMAP_NOTIFY); + PRINT_XCB_EVENT(XCB_MAP_NOTIFY); + PRINT_XCB_EVENT(XCB_MAP_REQUEST); + PRINT_XCB_EVENT(XCB_REPARENT_NOTIFY); + PRINT_XCB_EVENT(XCB_CONFIGURE_NOTIFY); + PRINT_XCB_EVENT(XCB_CONFIGURE_REQUEST); + PRINT_XCB_EVENT(XCB_GRAVITY_NOTIFY); + PRINT_XCB_EVENT(XCB_RESIZE_REQUEST); + PRINT_XCB_EVENT(XCB_CIRCULATE_NOTIFY); + PRINT_XCB_EVENT(XCB_CIRCULATE_REQUEST); + PRINT_XCB_EVENT(XCB_PROPERTY_NOTIFY); + PRINT_XCB_EVENT(XCB_SELECTION_CLEAR); + PRINT_XCB_EVENT(XCB_SELECTION_REQUEST); + PRINT_XCB_EVENT(XCB_SELECTION_NOTIFY); + PRINT_XCB_EVENT(XCB_COLORMAP_NOTIFY); + PRINT_XCB_EVENT(XCB_CLIENT_MESSAGE); + PRINT_XCB_EVENT(XCB_MAPPING_NOTIFY); default: - printf("Unhandled XCB event: %d - %s\n", event->response_type, "unknown"); + printf("%s: %d - %s\n", message, event->response_type, "unknown"); } +#else + Q_UNUSED(message); + Q_UNUSED(event); +#endif } void QXcbConnection::eventDispatcher() @@ -201,9 +208,10 @@ void QXcbConnection::eventDispatcher() m_keyboard->handleMappingNotifyEvent((xcb_mapping_notify_event_t *)event); break; default: - unhandledXcbEventError(event); - break; + printXcbEvent("Unhandled XCB event", event); + return; } + printXcbEvent("Handled XCB event", event); } } -- cgit v0.12 From 5582311143115dc16281d8ee258bde92e00d55b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 14 Feb 2011 13:12:16 +0100 Subject: Lighthouse: Testlite: Added modallity for dialogs Also fixed some identing in qtestlitewindow --- src/plugins/platforms/testlite/qtestlitewindow.cpp | 154 ++++++++++++++++----- src/plugins/platforms/testlite/qtestlitewindow.h | 3 +- 2 files changed, 124 insertions(+), 33 deletions(-) diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index d9c69e3..b7c5e99 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -78,46 +78,46 @@ QTestLiteWindow::QTestLiteWindow(QWidget *window) int w = window->width(); int h = window->height(); - if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL - && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { - #if !defined(QT_NO_OPENGL) + if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL + && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { +#if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) - XVisualInfo *visualInfo = QGLXContext::findVisualInfo(mScreen,window->platformWindowFormat()); + XVisualInfo *visualInfo = QGLXContext::findVisualInfo(mScreen,window->platformWindowFormat()); #else - QPlatformWindowFormat windowFormat = correctColorBuffers(window->platformWindowFormat()); + QPlatformWindowFormat windowFormat = correctColorBuffers(window->platformWindowFormat()); - EGLDisplay eglDisplay = eglGetDisplay(mScreen->display()); - EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,windowFormat); - VisualID id = QTestLiteEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); + EGLDisplay eglDisplay = eglGetDisplay(mScreen->display()); + EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,windowFormat); + VisualID id = QTestLiteEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - visualInfoTemplate.visualid = id; + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + visualInfoTemplate.visualid = id; - XVisualInfo *visualInfo; - int matchingCount = 0; - visualInfo = XGetVisualInfo(mScreen->display(), VisualIDMask, &visualInfoTemplate, &matchingCount); + XVisualInfo *visualInfo; + int matchingCount = 0; + visualInfo = XGetVisualInfo(mScreen->display(), VisualIDMask, &visualInfoTemplate, &matchingCount); #endif //!defined(QT_OPENGL_ES_2) - if (visualInfo) { - Colormap cmap = XCreateColormap(mScreen->display(),mScreen->rootWindow(),visualInfo->visual,AllocNone); - - XSetWindowAttributes a; - a.colormap = cmap; - x_window = XCreateWindow(mScreen->display(), mScreen->rootWindow(),x, y, w, h, - 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWColormap, &a); - } else { - qFatal("no window!"); - } -#endif //!defined(QT_NO_OPENGL) + if (visualInfo) { + Colormap cmap = XCreateColormap(mScreen->display(),mScreen->rootWindow(),visualInfo->visual,AllocNone); + + XSetWindowAttributes a; + a.colormap = cmap; + x_window = XCreateWindow(mScreen->display(), mScreen->rootWindow(),x, y, w, h, + 0, visualInfo->depth, InputOutput, visualInfo->visual, + CWColormap, &a); } else { - x_window = XCreateSimpleWindow(mScreen->display(), mScreen->rootWindow(), - x, y, w, h, 0 /*border_width*/, - mScreen->blackPixel(), mScreen->whitePixel()); + qFatal("no window!"); } +#endif //!defined(QT_NO_OPENGL) + } else { + x_window = XCreateSimpleWindow(mScreen->display(), mScreen->rootWindow(), + x, y, w, h, 0 /*border_width*/, + mScreen->blackPixel(), mScreen->whitePixel()); + } #ifdef MYX11_DEBUG - qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; + qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; #endif XSetWindowBackgroundPixmap(mScreen->display(), x_window, XNone); @@ -252,7 +252,7 @@ void QTestLiteWindow::setGeometry(const QRect &rect) Qt::WindowFlags QTestLiteWindow::windowFlags() const { - return window_flags; + return mWindowFlags; } WId QTestLiteWindow::winId() const @@ -411,10 +411,46 @@ static inline bool isTransient(const QWidget *w) && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); } +QVector QTestLiteWindow::getNetWmState() const +{ + QVector returnValue; + + // Don't read anything, just get the size of the property data + Atom actualType; + int actualFormat; + ulong propertyLength; + ulong bytesLeft; + uchar *propertyData = 0; + if (XGetWindowProperty(mScreen->display(), x_window, QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE), 0, 0, + False, XA_ATOM, &actualType, &actualFormat, + &propertyLength, &bytesLeft, &propertyData) == Success + && actualType == XA_ATOM && actualFormat == 32) { + returnValue.resize(bytesLeft / 4); + XFree((char*) propertyData); + + // fetch all data + if (XGetWindowProperty(mScreen->display(), x_window, QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE), 0, + returnValue.size(), False, XA_ATOM, &actualType, &actualFormat, + &propertyLength, &bytesLeft, &propertyData) != Success) { + returnValue.clear(); + } else if (propertyLength != (ulong)returnValue.size()) { + returnValue.resize(propertyLength); + } + + // put it into netWmState + if (!returnValue.isEmpty()) { + memcpy(returnValue.data(), propertyData, returnValue.size() * sizeof(Atom)); + } + XFree((char*) propertyData); + } + + return returnValue; +} + Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) { // Q_ASSERT(flags & Qt::Window); - window_flags = flags; + mWindowFlags = flags; #ifdef MYX11_DEBUG qDebug() << "QTestLiteWindow::setWindowFlags" << hex << x_window << "flags" << flags; @@ -518,8 +554,50 @@ Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) mwmhints.decorations = 0; } + if (widget()->windowModality() == Qt::WindowModal) { + mwmhints.input_mode = MWM_INPUT_PRIMARY_APPLICATION_MODAL; + } else if (widget()->windowModality() == Qt::ApplicationModal) { + mwmhints.input_mode = MWM_INPUT_FULL_APPLICATION_MODAL; + } + setMWMHints(mwmhints); + QVector netWmState = getNetWmState(); + + if (flags & Qt::WindowStaysOnTopHint) { + if (flags & Qt::WindowStaysOnBottomHint) + qWarning() << "QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time"; + if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_ABOVE))) + netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_ABOVE)); + if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_STAYS_ON_TOP))) + netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_STAYS_ON_TOP)); + } else if (flags & Qt::WindowStaysOnBottomHint) { + if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_BELOW))) + netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_BELOW)); + } + if (widget()->isFullScreen()) { + if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_FULLSCREEN))) + netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_FULLSCREEN)); + } + if (widget()->isMaximized()) { + if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MAXIMIZED_HORZ))) + netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MAXIMIZED_HORZ)); + if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MAXIMIZED_VERT))) + netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MAXIMIZED_VERT)); + } + if (widget()->windowModality() != Qt::NonModal) { + if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MODAL))) + netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MODAL)); + } + + if (!netWmState.isEmpty()) { + XChangeProperty(mScreen->display(), x_window, + QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE), XA_ATOM, 32, PropModeReplace, + (unsigned char *) netWmState.data(), netWmState.size()); + } else { + XDeleteProperty(mScreen->display(), x_window, QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE)); + } + //##### only if initializeWindow??? if (popup || tooltip) { // popup widget @@ -547,6 +625,18 @@ void QTestLiteWindow::setVisible(bool visible) #ifdef MYX11_DEBUG qDebug() << "QTestLiteWindow::setVisible" << visible << hex << x_window; #endif + if (isTransient(widget())) { + Window parentXWindow = x_window; + if (widget()->parentWidget()) { + QWidget *widgetParent = widget()->parentWidget()->window(); + if (widgetParent && widgetParent->platformWindow()) { + QTestLiteWindow *parentWidnow = static_cast(widgetParent->platformWindow()); + parentXWindow = parentWidnow->x_window; + } + } + XSetTransientForHint(mScreen->display(),x_window,parentXWindow); + } + if (visible) { //ensure that the window is viewed in correct position. doSizeHints(); diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h index e45c3fd..2ca7e10 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.h +++ b/src/plugins/platforms/testlite/qtestlitewindow.h @@ -123,6 +123,7 @@ public: GC graphicsContext() const; protected: + QVector getNetWmState() const; void setMWMHints(const QtMWMHints &mwmhints); QtMWMHints getMWMHints() const; @@ -138,7 +139,7 @@ private: QPlatformGLContext *mGLContext; QTestLiteScreen *mScreen; - Qt::WindowFlags window_flags; + Qt::WindowFlags mWindowFlags; }; #endif -- cgit v0.12 From 7be3f2585676cb18821b51427527275fb441fa46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 14 Feb 2011 13:36:13 +0100 Subject: Lighthouse: renaming testlite to xlib --- src/plugins/platforms/testlite/main.cpp | 20 ++-- src/plugins/platforms/testlite/qglxintegration.cpp | 10 +- src/plugins/platforms/testlite/qglxintegration.h | 12 +- .../platforms/testlite/qtestliteclipboard.cpp | 100 ++++++++-------- .../platforms/testlite/qtestliteclipboard.h | 10 +- src/plugins/platforms/testlite/qtestlitecursor.cpp | 16 +-- src/plugins/platforms/testlite/qtestlitecursor.h | 6 +- .../platforms/testlite/qtestliteeglintegration.cpp | 2 +- .../platforms/testlite/qtestliteeglintegration.h | 2 +- .../platforms/testlite/qtestliteintegration.cpp | 34 +++--- .../platforms/testlite/qtestliteintegration.h | 8 +- .../platforms/testlite/qtestlitekeyboard.cpp | 14 +-- src/plugins/platforms/testlite/qtestlitekeyboard.h | 6 +- src/plugins/platforms/testlite/qtestlitemime.cpp | 66 +++++------ src/plugins/platforms/testlite/qtestlitemime.h | 6 +- src/plugins/platforms/testlite/qtestlitescreen.cpp | 40 +++---- src/plugins/platforms/testlite/qtestlitescreen.h | 18 +-- .../platforms/testlite/qtestlitestaticinfo.cpp | 36 +++--- .../platforms/testlite/qtestlitestaticinfo.h | 2 +- src/plugins/platforms/testlite/qtestlitewindow.cpp | 126 ++++++++++----------- src/plugins/platforms/testlite/qtestlitewindow.h | 14 +-- .../platforms/testlite/qtestlitewindowsurface.cpp | 36 +++--- .../platforms/testlite/qtestlitewindowsurface.h | 20 ++-- 23 files changed, 301 insertions(+), 303 deletions(-) diff --git a/src/plugins/platforms/testlite/main.cpp b/src/plugins/platforms/testlite/main.cpp index 2f6aa8b..131d399 100644 --- a/src/plugins/platforms/testlite/main.cpp +++ b/src/plugins/platforms/testlite/main.cpp @@ -44,36 +44,36 @@ QT_BEGIN_NAMESPACE -class QTestLiteIntegrationPlugin : public QPlatformIntegrationPlugin +class QXlibIntegrationPlugin : public QPlatformIntegrationPlugin { public: QStringList keys() const; QPlatformIntegration *create(const QString&, const QStringList&); }; -QStringList QTestLiteIntegrationPlugin::keys() const +QStringList QXlibIntegrationPlugin::keys() const { QStringList list; - list << "TestLite"; + list << "Xlib"; #ifndef QT_NO_OPENGL - list << "TestLiteGL"; + list << "XlibGL"; #endif return list; } -QPlatformIntegration* QTestLiteIntegrationPlugin::create(const QString& system, const QStringList& paramList) +QPlatformIntegration* QXlibIntegrationPlugin::create(const QString& system, const QStringList& paramList) { Q_UNUSED(paramList); - if (system.toLower() == "testlite") - return new QTestLiteIntegration; + if (system.toLower() == "xlib") + return new QXlibIntegration; #ifndef QT_NO_OPENGL - if (system.toLower() == "testlitegl") - return new QTestLiteIntegration(true); + if (system.toLower() == "xlibgl") + return new QXlibIntegration(true); #endif return 0; } -Q_EXPORT_PLUGIN2(testlite, QTestLiteIntegrationPlugin) +Q_EXPORT_PLUGIN2(xlib, QXlibIntegrationPlugin) QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp index 8023014..46dfef9 100644 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ b/src/plugins/platforms/testlite/qglxintegration.cpp @@ -113,7 +113,7 @@ QVector QGLXContext::buildSpec(const QPlatformWindowFormat &format) return spec; } -GLXFBConfig QGLXContext::findConfig(const QTestLiteScreen *screen, const QPlatformWindowFormat &format) +GLXFBConfig QGLXContext::findConfig(const QXlibScreen *screen, const QPlatformWindowFormat &format) { bool reduced = true; GLXFBConfig chosenConfig = 0; @@ -149,7 +149,7 @@ GLXFBConfig QGLXContext::findConfig(const QTestLiteScreen *screen, const QPlatfo return chosenConfig; } -XVisualInfo *QGLXContext::findVisualInfo(const QTestLiteScreen *screen, const QPlatformWindowFormat &format) +XVisualInfo *QGLXContext::findVisualInfo(const QXlibScreen *screen, const QPlatformWindowFormat &format) { GLXFBConfig config = QGLXContext::findConfig(screen,format); XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display(),config); @@ -237,7 +237,7 @@ QPlatformWindowFormat QGLXContext::reducePlatformWindowFormat(const QPlatformWin return retFormat; } -QGLXContext::QGLXContext(Window window, QTestLiteScreen *screen, const QPlatformWindowFormat &format) +QGLXContext::QGLXContext(Window window, QXlibScreen *screen, const QPlatformWindowFormat &format) : QPlatformGLContext() , m_screen(screen) , m_drawable((Drawable)window) @@ -272,7 +272,7 @@ QGLXContext::QGLXContext(Window window, QTestLiteScreen *screen, const QPlatform #endif } -QGLXContext::QGLXContext(QTestLiteScreen *screen, Drawable drawable, GLXContext context) +QGLXContext::QGLXContext(QXlibScreen *screen, Drawable drawable, GLXContext context) : QPlatformGLContext(), m_screen(screen), m_drawable(drawable), m_context(context) { @@ -286,7 +286,7 @@ QGLXContext::~QGLXContext() } } -void QGLXContext::createDefaultSharedContex(QTestLiteScreen *screen) +void QGLXContext::createDefaultSharedContex(QXlibScreen *screen) { int x = 0; int y = 0; diff --git a/src/plugins/platforms/testlite/qglxintegration.h b/src/plugins/platforms/testlite/qglxintegration.h index abece45..f982708 100644 --- a/src/plugins/platforms/testlite/qglxintegration.h +++ b/src/plugins/platforms/testlite/qglxintegration.h @@ -57,7 +57,7 @@ QT_BEGIN_NAMESPACE class QGLXContext : public QPlatformGLContext { public: - QGLXContext(Window window, QTestLiteScreen *xd, const QPlatformWindowFormat &format); + QGLXContext(Window window, QXlibScreen *xd, const QPlatformWindowFormat &format); ~QGLXContext(); virtual void makeCurrent(); @@ -69,22 +69,22 @@ public: QPlatformWindowFormat platformWindowFormat() const; - static XVisualInfo *findVisualInfo(const QTestLiteScreen *xd, const QPlatformWindowFormat &format); + static XVisualInfo *findVisualInfo(const QXlibScreen *xd, const QPlatformWindowFormat &format); private: - static GLXFBConfig findConfig(const QTestLiteScreen *xd,const QPlatformWindowFormat &format); + static GLXFBConfig findConfig(const QXlibScreen *xd,const QPlatformWindowFormat &format); static QVector buildSpec(const QPlatformWindowFormat &format); static QPlatformWindowFormat platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context); static QPlatformWindowFormat reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced); - QTestLiteScreen *m_screen; + QXlibScreen *m_screen; Drawable m_drawable; GLXContext m_context; QPlatformWindowFormat m_windowFormat; - QGLXContext (QTestLiteScreen *screen, Drawable drawable, GLXContext context); + QGLXContext (QXlibScreen *screen, Drawable drawable, GLXContext context); static QMutex m_defaultSharedContextMutex; - static void createDefaultSharedContex(QTestLiteScreen *xd); + static void createDefaultSharedContex(QXlibScreen *xd); }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestliteclipboard.cpp b/src/plugins/platforms/testlite/qtestliteclipboard.cpp index 9bab7f9..1264b5a 100644 --- a/src/plugins/platforms/testlite/qtestliteclipboard.cpp +++ b/src/plugins/platforms/testlite/qtestliteclipboard.cpp @@ -48,12 +48,12 @@ #include -class QTestLiteClipboardMime : public QTestLiteMime +class QXlibClipboardMime : public QXlibMime { Q_OBJECT public: - QTestLiteClipboardMime(QClipboard::Mode mode, QTestLiteClipboard *clipboard) - : QTestLiteMime() + QXlibClipboardMime(QClipboard::Mode mode, QXlibClipboard *clipboard) + : QXlibMime() , m_clipboard(clipboard) { switch (mode) { @@ -62,7 +62,7 @@ public: break; case QClipboard::Clipboard: - modeAtom = QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD); + modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); break; default: @@ -78,11 +78,11 @@ protected: return QStringList(); if (!formatList.count()) { - QTestLiteClipboardMime *that = const_cast(this); + QXlibClipboardMime *that = const_cast(this); // get the list of targets from the current clipboard owner - we do this // once so that multiple calls to this function don't require multiple // server round trips... - that->format_atoms = m_clipboard->getDataInFormat(modeAtom,QTestLiteStatic::atom(QTestLiteStatic::TARGETS)); + that->format_atoms = m_clipboard->getDataInFormat(modeAtom,QXlibStatic::atom(QXlibStatic::TARGETS)); if (format_atoms.size() > 0) { Atom *targets = (Atom *) format_atoms.data(); @@ -141,14 +141,14 @@ private: Atom modeAtom; - QTestLiteClipboard *m_clipboard; + QXlibClipboard *m_clipboard; QStringList formatList; QByteArray format_atoms; }; -const int QTestLiteClipboard::clipboard_timeout = 5000; +const int QXlibClipboard::clipboard_timeout = 5000; -QTestLiteClipboard::QTestLiteClipboard(QTestLiteScreen *screen) +QXlibClipboard::QXlibClipboard(QXlibScreen *screen) : QPlatformClipboard() , m_screen(screen) , m_xClipboard(0) @@ -160,14 +160,14 @@ QTestLiteClipboard::QTestLiteClipboard(QTestLiteScreen *screen) { } -const QMimeData * QTestLiteClipboard::mimeData(QClipboard::Mode mode) const +const QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) const { if (mode == QClipboard::Clipboard) { if (!m_xClipboard) { - QTestLiteClipboard *that = const_cast(this); - that->m_xClipboard = new QTestLiteClipboardMime(mode,that); + QXlibClipboard *that = const_cast(this); + that->m_xClipboard = new QXlibClipboardMime(mode,that); } - Window clipboardOwner = XGetSelectionOwner(screen()->display(),QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD)); + Window clipboardOwner = XGetSelectionOwner(screen()->display(),QXlibStatic::atom(QXlibStatic::CLIPBOARD)); if (clipboardOwner == owner()) { return m_clientClipboard; } else { @@ -175,8 +175,8 @@ const QMimeData * QTestLiteClipboard::mimeData(QClipboard::Mode mode) const } } else if (mode == QClipboard::Selection) { if (!m_xSelection) { - QTestLiteClipboard *that = const_cast(this); - that->m_xSelection = new QTestLiteClipboardMime(mode,that); + QXlibClipboard *that = const_cast(this); + that->m_xSelection = new QXlibClipboardMime(mode,that); } Window clipboardOwner = XGetSelectionOwner(screen()->display(),XA_PRIMARY); if (clipboardOwner == owner()) { @@ -188,7 +188,7 @@ const QMimeData * QTestLiteClipboard::mimeData(QClipboard::Mode mode) const return 0; } -void QTestLiteClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) +void QXlibClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) { Atom modeAtom; QMimeData **d; @@ -199,7 +199,7 @@ void QTestLiteClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) break; case QClipboard::Clipboard: - modeAtom = QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD); + modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); d = &m_clientClipboard; break; @@ -226,7 +226,7 @@ void QTestLiteClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) } -bool QTestLiteClipboard::supportsMode(QClipboard::Mode mode) const +bool QXlibClipboard::supportsMode(QClipboard::Mode mode) const { if (mode == QClipboard::Clipboard || mode == QClipboard::Selection) return true; @@ -234,16 +234,16 @@ bool QTestLiteClipboard::supportsMode(QClipboard::Mode mode) const } -QTestLiteScreen * QTestLiteClipboard::screen() const +QXlibScreen * QXlibClipboard::screen() const { return m_screen; } -Window QTestLiteClipboard::requestor() const +Window QXlibClipboard::requestor() const { if (!m_requestor) { int x = 0, y = 0, w = 3, h = 3; - QTestLiteClipboard *that = const_cast(this); + QXlibClipboard *that = const_cast(this); Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), x, y, w, h, 0 /*border_width*/, m_screen->blackPixel(), m_screen->whitePixel()); @@ -252,7 +252,7 @@ Window QTestLiteClipboard::requestor() const return m_requestor; } -void QTestLiteClipboard::setRequestor(Window window) +void QXlibClipboard::setRequestor(Window window) { if (m_requestor != XNone) { XDestroyWindow(m_screen->display(),m_requestor); @@ -260,11 +260,11 @@ void QTestLiteClipboard::setRequestor(Window window) m_requestor = window; } -Window QTestLiteClipboard::owner() const +Window QXlibClipboard::owner() const { if (!m_owner) { int x = 0, y = 0, w = 3, h = 3; - QTestLiteClipboard *that = const_cast(this); + QXlibClipboard *that = const_cast(this); Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), x, y, w, h, 0 /*border_width*/, m_screen->blackPixel(), m_screen->whitePixel()); @@ -273,7 +273,7 @@ Window QTestLiteClipboard::owner() const return m_owner; } -void QTestLiteClipboard::setOwner(Window window) +void QXlibClipboard::setOwner(Window window) { if (m_owner != XNone){ XDestroyWindow(m_screen->display(),m_owner); @@ -281,45 +281,45 @@ void QTestLiteClipboard::setOwner(Window window) m_owner = window; } -Atom QTestLiteClipboard::sendTargetsSelection(QMimeData *d, Window window, Atom property) +Atom QXlibClipboard::sendTargetsSelection(QMimeData *d, Window window, Atom property) { QVector types; QStringList formats = QInternalMimeData::formatsHelper(d); for (int i = 0; i < formats.size(); ++i) { - QList atoms = QTestLiteMime::mimeAtomsForFormat(screen()->display(),formats.at(i)); + QList atoms = QXlibMime::mimeAtomsForFormat(screen()->display(),formats.at(i)); for (int j = 0; j < atoms.size(); ++j) { if (!types.contains(atoms.at(j))) types.append(atoms.at(j)); } } - types.append(QTestLiteStatic::atom(QTestLiteStatic::TARGETS)); - types.append(QTestLiteStatic::atom(QTestLiteStatic::MULTIPLE)); - types.append(QTestLiteStatic::atom(QTestLiteStatic::TIMESTAMP)); - types.append(QTestLiteStatic::atom(QTestLiteStatic::SAVE_TARGETS)); + types.append(QXlibStatic::atom(QXlibStatic::TARGETS)); + types.append(QXlibStatic::atom(QXlibStatic::MULTIPLE)); + types.append(QXlibStatic::atom(QXlibStatic::TIMESTAMP)); + types.append(QXlibStatic::atom(QXlibStatic::SAVE_TARGETS)); XChangeProperty(screen()->display(), window, property, XA_ATOM, 32, PropModeReplace, (uchar *) types.data(), types.size()); return property; } -Atom QTestLiteClipboard::sendSelection(QMimeData *d, Atom target, Window window, Atom property) +Atom QXlibClipboard::sendSelection(QMimeData *d, Atom target, Window window, Atom property) { Atom atomFormat = target; int dataFormat = 0; QByteArray data; - QString fmt = QTestLiteMime::mimeAtomToString(screen()->display(), target); + QString fmt = QXlibMime::mimeAtomToString(screen()->display(), target); if (fmt.isEmpty()) { // Not a MIME type we have qDebug() << "QClipboard: send_selection(): converting to type '%s' is not supported" << fmt.data(); return XNone; } qDebug() << "QClipboard: send_selection(): converting to type '%s'" << fmt.data(); - if (QTestLiteMime::mimeDataForAtom(screen()->display(),target, d, &data, &atomFormat, &dataFormat)) { + if (QXlibMime::mimeDataForAtom(screen()->display(),target, d, &data, &atomFormat, &dataFormat)) { // don't allow INCR transfers when using MULTIPLE or to // Motif clients (since Motif doesn't support INCR) - static Atom motif_clip_temporary = QTestLiteStatic::atom(QTestLiteStatic::CLIP_TEMPORARY); + static Atom motif_clip_temporary = QXlibStatic::atom(QXlibStatic::CLIP_TEMPORARY); bool allow_incr = property != motif_clip_temporary; // X_ChangeProperty protocol request is 24 bytes @@ -327,7 +327,7 @@ Atom QTestLiteClipboard::sendSelection(QMimeData *d, Atom target, Window window, if (data.size() > increment && allow_incr) { long bytes = data.size(); XChangeProperty(screen()->display(), window, property, - QTestLiteStatic::atom(QTestLiteStatic::INCR), 32, PropModeReplace, (uchar *) &bytes, 1); + QXlibStatic::atom(QXlibStatic::INCR), 32, PropModeReplace, (uchar *) &bytes, 1); // (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment); qDebug() << "not implemented INCRT just YET!"; @@ -346,7 +346,7 @@ Atom QTestLiteClipboard::sendSelection(QMimeData *d, Atom target, Window window, return property; } -void QTestLiteClipboard::handleSelectionRequest(XEvent *xevent) +void QXlibClipboard::handleSelectionRequest(XEvent *xevent) { XSelectionRequestEvent *req = &xevent->xselectionrequest; @@ -367,7 +367,7 @@ void QTestLiteClipboard::handleSelectionRequest(XEvent *xevent) QMimeData *d; if (req->selection == XA_PRIMARY) { d = m_clientSelection; - } else if (req->selection == QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD)) { + } else if (req->selection == QXlibStatic::atom(QXlibStatic::CLIPBOARD)) { d = m_clientClipboard; } else { qWarning("QClipboard: Unknown selection '%lx'", req->selection); @@ -381,9 +381,9 @@ void QTestLiteClipboard::handleSelectionRequest(XEvent *xevent) return; } - Atom xa_targets = QTestLiteStatic::atom(QTestLiteStatic::TARGETS); - Atom xa_multiple = QTestLiteStatic::atom(QTestLiteStatic::MULTIPLE); - Atom xa_timestamp = QTestLiteStatic::atom(QTestLiteStatic::TIMESTAMP); + Atom xa_targets = QXlibStatic::atom(QXlibStatic::TARGETS); + Atom xa_multiple = QXlibStatic::atom(QXlibStatic::MULTIPLE); + Atom xa_timestamp = QXlibStatic::atom(QXlibStatic::TIMESTAMP); struct AtomPair { Atom target; Atom property; } *multi = 0; Atom multi_type = XNone; @@ -469,7 +469,7 @@ void QTestLiteClipboard::handleSelectionRequest(XEvent *xevent) static inline int maxSelectionIncr(Display *dpy) { return XMaxRequestSize(dpy) > 65536 ? 65536*4 : XMaxRequestSize(dpy)*4 - 100; } -bool QTestLiteClipboard::clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const +bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const { int maxsize = maxSelectionIncr(screen()->display()); ulong bytes_left; // bytes_after @@ -549,7 +549,7 @@ bool QTestLiteClipboard::clipboardReadProperty(Window win, Atom property, bool d XFree((char*)data); } - if (*format == 8 && *type == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) { + if (*format == 8 && *type == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { // convert COMPOUND_TEXT to a multibyte string XTextProperty textprop; textprop.encoding = *type; @@ -581,7 +581,7 @@ bool QTestLiteClipboard::clipboardReadProperty(Window win, Atom property, bool d return ok; } -QByteArray QTestLiteClipboard::clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm) +QByteArray QXlibClipboard::clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm) { XEvent event; @@ -639,7 +639,7 @@ QByteArray QTestLiteClipboard::clipboardReadIncrementalProperty(Window win, Atom return QByteArray(); } -QByteArray QTestLiteClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) +QByteArray QXlibClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) { QByteArray buf; @@ -647,8 +647,8 @@ QByteArray QTestLiteClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) XSelectInput(screen()->display(), win, NoEventMask); // don't listen for any events - XDeleteProperty(screen()->display(), win, QTestLiteStatic::atom(QTestLiteStatic::_QT_SELECTION)); - XConvertSelection(screen()->display(), modeAtom, fmtatom, QTestLiteStatic::atom(QTestLiteStatic::_QT_SELECTION), win, CurrentTime); + XDeleteProperty(screen()->display(), win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION)); + XConvertSelection(screen()->display(), modeAtom, fmtatom, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), win, CurrentTime); XSync(screen()->display(), false); XEvent xevent; @@ -660,10 +660,10 @@ QByteArray QTestLiteClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) Atom type; XSelectInput(screen()->display(), win, PropertyChangeMask); - if (clipboardReadProperty(win, QTestLiteStatic::atom(QTestLiteStatic::_QT_SELECTION), true, &buf, 0, &type, 0)) { - if (type == QTestLiteStatic::atom(QTestLiteStatic::INCR)) { + if (clipboardReadProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), true, &buf, 0, &type, 0)) { + if (type == QXlibStatic::atom(QXlibStatic::INCR)) { int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0; - buf = clipboardReadIncrementalProperty(win, QTestLiteStatic::atom(QTestLiteStatic::_QT_SELECTION), nbytes, false); + buf = clipboardReadIncrementalProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), nbytes, false); } } diff --git a/src/plugins/platforms/testlite/qtestliteclipboard.h b/src/plugins/platforms/testlite/qtestliteclipboard.h index 76065a2..109714c 100644 --- a/src/plugins/platforms/testlite/qtestliteclipboard.h +++ b/src/plugins/platforms/testlite/qtestliteclipboard.h @@ -45,18 +45,18 @@ #include #include "qtestlitestaticinfo.h" -class QTestLiteScreen; -class QTestLiteClipboard : public QPlatformClipboard +class QXlibScreen; +class QXlibClipboard : public QPlatformClipboard { public: - QTestLiteClipboard(QTestLiteScreen *screen); + QXlibClipboard(QXlibScreen *screen); const QMimeData *mimeData(QClipboard::Mode mode) const; void setMimeData(QMimeData *data, QClipboard::Mode mode); bool supportsMode(QClipboard::Mode mode) const; - QTestLiteScreen *screen() const; + QXlibScreen *screen() const; Window requestor() const; void setRequestor(Window window); @@ -76,7 +76,7 @@ private: Atom sendTargetsSelection(QMimeData *d, Window window, Atom property); Atom sendSelection(QMimeData *d, Atom target, Window window, Atom property); - QTestLiteScreen *m_screen; + QXlibScreen *m_screen; QMimeData *m_xClipboard; QMimeData *m_clientClipboard; diff --git a/src/plugins/platforms/testlite/qtestlitecursor.cpp b/src/plugins/platforms/testlite/qtestlitecursor.cpp index e7ef673..2f7cfbf 100644 --- a/src/plugins/platforms/testlite/qtestlitecursor.cpp +++ b/src/plugins/platforms/testlite/qtestlitecursor.cpp @@ -51,17 +51,17 @@ QT_BEGIN_NAMESPACE -QTestLiteCursor::QTestLiteCursor(QTestLiteScreen *screen) +QXlibCursor::QXlibCursor(QXlibScreen *screen) : QPlatformCursor(screen) { } -void QTestLiteCursor::changeCursor(QCursor *cursor, QWidget *widget) +void QXlibCursor::changeCursor(QCursor *cursor, QWidget *widget) { - QTestLiteWindow *w = 0; + QXlibWindow *w = 0; if (widget) { QWidget *window = widget->window(); - w = static_cast(window->platformWindow()); + w = static_cast(window->platformWindow()); } else { // No X11 cursor control when there is no widget under the cursor return; @@ -89,7 +89,7 @@ void QTestLiteCursor::changeCursor(QCursor *cursor, QWidget *widget) w->setCursor(c); } -Cursor QTestLiteCursor::createCursorBitmap(QCursor * cursor) +Cursor QXlibCursor::createCursorBitmap(QCursor * cursor) { XColor bg, fg; bg.red = 255 << 8; @@ -132,7 +132,7 @@ Cursor QTestLiteCursor::createCursorBitmap(QCursor * cursor) return c; } -Cursor QTestLiteCursor::createCursorShape(int cshape) +Cursor QXlibCursor::createCursorShape(int cshape) { Cursor cursor = 0; @@ -191,9 +191,9 @@ Cursor QTestLiteCursor::createCursorShape(int cshape) return cursor; } -QTestLiteScreen * QTestLiteCursor::testLiteScreen() const +QXlibScreen * QXlibCursor::testLiteScreen() const { - return static_cast(screen); + return static_cast(screen); } QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitecursor.h b/src/plugins/platforms/testlite/qtestlitecursor.h index bb3549e..db9f9e2 100644 --- a/src/plugins/platforms/testlite/qtestlitecursor.h +++ b/src/plugins/platforms/testlite/qtestlitecursor.h @@ -48,10 +48,10 @@ QT_BEGIN_NAMESPACE -class QTestLiteCursor : QPlatformCursor +class QXlibCursor : QPlatformCursor { public: - QTestLiteCursor(QTestLiteScreen *screen); + QXlibCursor(QXlibScreen *screen); void changeCursor(QCursor * cursor, QWidget * widget); private: @@ -59,7 +59,7 @@ private: Cursor createCursorBitmap(QCursor * cursor); Cursor createCursorShape(int cshape); - QTestLiteScreen *testLiteScreen() const; + QXlibScreen *testLiteScreen() const; QMap cursorMap; }; diff --git a/src/plugins/platforms/testlite/qtestliteeglintegration.cpp b/src/plugins/platforms/testlite/qtestliteeglintegration.cpp index 532c63d..9bbe0ca 100644 --- a/src/plugins/platforms/testlite/qtestliteeglintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteeglintegration.cpp @@ -52,7 +52,7 @@ static int countBits(unsigned long mask) return count; } -VisualID QTestLiteEglIntegration::getCompatibleVisualId(Display *display, EGLConfig config) +VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLConfig config) { VisualID visualId = 0; EGLint eglValue = 0; diff --git a/src/plugins/platforms/testlite/qtestliteeglintegration.h b/src/plugins/platforms/testlite/qtestliteeglintegration.h index 99e9018..4c2e50d 100644 --- a/src/plugins/platforms/testlite/qtestliteeglintegration.h +++ b/src/plugins/platforms/testlite/qtestliteeglintegration.h @@ -45,7 +45,7 @@ #include "qtestlitestaticinfo.h" #include "../eglconvenience/qeglconvenience.h" -class QTestLiteEglIntegration +class QXlibEglIntegration { public: static VisualID getCompatibleVisualId(Display *display, EGLConfig config); diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp index dc8a6d7..cdc5c29 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.cpp +++ b/src/plugins/platforms/testlite/qtestliteintegration.cpp @@ -61,16 +61,16 @@ QT_BEGIN_NAMESPACE -QTestLiteIntegration::QTestLiteIntegration(bool useOpenGL) +QXlibIntegration::QXlibIntegration(bool useOpenGL) : mUseOpenGL(useOpenGL) , mFontDb(new QGenericUnixFontDatabase()) , mClipboard(0) { - mPrimaryScreen = new QTestLiteScreen(); + mPrimaryScreen = new QXlibScreen(); mScreens.append(mPrimaryScreen); } -QPixmapData *QTestLiteIntegration::createPixmapData(QPixmapData::PixelType type) const +QPixmapData *QXlibIntegration::createPixmapData(QPixmapData::PixelType type) const { #ifndef QT_NO_OPENGL if (mUseOpenGL) @@ -79,33 +79,33 @@ QPixmapData *QTestLiteIntegration::createPixmapData(QPixmapData::PixelType type) return new QRasterPixmapData(type); } -QWindowSurface *QTestLiteIntegration::createWindowSurface(QWidget *widget, WId) const +QWindowSurface *QXlibIntegration::createWindowSurface(QWidget *widget, WId) const { #ifndef QT_NO_OPENGL if (mUseOpenGL) return new QGLWindowSurface(widget); #endif - return new QTestLiteWindowSurface(widget); + return new QXlibWindowSurface(widget); } -QPlatformWindow *QTestLiteIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const +QPlatformWindow *QXlibIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const { - return new QTestLiteWindow(widget); + return new QXlibWindow(widget); } -QPixmap QTestLiteIntegration::grabWindow(WId window, int x, int y, int width, int height) const +QPixmap QXlibIntegration::grabWindow(WId window, int x, int y, int width, int height) const { QImage image; QWidget *widget = QWidget::find(window); if (widget) { - QTestLiteScreen *screen = QTestLiteScreen::testLiteScreenForWidget(widget); + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); image = screen->grabWindow(window,x,y,width,height); } else { for (int i = 0; i < mScreens.size(); i++) { - QTestLiteScreen *screen = static_cast(mScreens[i]); + QXlibScreen *screen = static_cast(mScreens[i]); if (screen->rootWindow() == window) { image = screen->grabWindow(window,x,y,width,height); } @@ -114,33 +114,33 @@ QPixmap QTestLiteIntegration::grabWindow(WId window, int x, int y, int width, in return QPixmap::fromImage(image); } -QPlatformFontDatabase *QTestLiteIntegration::fontDatabase() const +QPlatformFontDatabase *QXlibIntegration::fontDatabase() const { return mFontDb; } -QPlatformClipboard * QTestLiteIntegration::clipboard() const +QPlatformClipboard * QXlibIntegration::clipboard() const { //Use lazy init since clipboard needs QTestliteScreen if (!mClipboard) { - QTestLiteIntegration *that = const_cast(this); - that->mClipboard = new QTestLiteClipboard(mPrimaryScreen); + QXlibIntegration *that = const_cast(this); + that->mClipboard = new QXlibClipboard(mPrimaryScreen); } return mClipboard; } -bool QTestLiteIntegration::hasOpenGL() const +bool QXlibIntegration::hasOpenGL() const { #if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) - QTestLiteScreen *screen = static_cast(mScreens.at(0)); + QXlibScreen *screen = static_cast(mScreens.at(0)); return glXQueryExtension(screen->display(), 0, 0) != 0; #else static bool eglHasbeenInitialized = false; static bool wasEglInitialized = false; if (!eglHasbeenInitialized) { eglHasbeenInitialized = true; - const QTestLiteScreen *screen = static_cast(mScreens.at(0)); + const QXlibScreen *screen = static_cast(mScreens.at(0)); EGLint major, minor; eglBindAPI(EGL_OPENGL_ES_API); EGLDisplay disp = eglGetDisplay(screen->display()); diff --git a/src/plugins/platforms/testlite/qtestliteintegration.h b/src/plugins/platforms/testlite/qtestliteintegration.h index 320cf00..c3125b8 100644 --- a/src/plugins/platforms/testlite/qtestliteintegration.h +++ b/src/plugins/platforms/testlite/qtestliteintegration.h @@ -52,12 +52,12 @@ QT_BEGIN_NAMESPACE -class QTestLiteScreen; +class QXlibScreen; -class QTestLiteIntegration : public QPlatformIntegration +class QXlibIntegration : public QPlatformIntegration { public: - QTestLiteIntegration(bool useOpenGL = false); + QXlibIntegration(bool useOpenGL = false); QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; @@ -74,7 +74,7 @@ public: private: bool mUseOpenGL; - QTestLiteScreen *mPrimaryScreen; + QXlibScreen *mPrimaryScreen; QList mScreens; QPlatformFontDatabase *mFontDb; QPlatformClipboard *mClipboard; diff --git a/src/plugins/platforms/testlite/qtestlitekeyboard.cpp b/src/plugins/platforms/testlite/qtestlitekeyboard.cpp index 5b4ebd7..fb0cf2e 100644 --- a/src/plugins/platforms/testlite/qtestlitekeyboard.cpp +++ b/src/plugins/platforms/testlite/qtestlitekeyboard.cpp @@ -740,7 +740,7 @@ static QChar keysymToUnicode(unsigned char byte3, unsigned char byte4) return QChar(0x0); } -Qt::KeyboardModifiers QTestLiteKeyboard::translateModifiers(int s) +Qt::KeyboardModifiers QXlibKeyboard::translateModifiers(int s) { Qt::KeyboardModifiers ret = 0; if (s & ShiftMask) @@ -756,7 +756,7 @@ Qt::KeyboardModifiers QTestLiteKeyboard::translateModifiers(int s) return ret; } -void QTestLiteKeyboard::setMask(KeySym sym, uint mask) +void QXlibKeyboard::setMask(KeySym sym, uint mask) { if (m_alt_mask == 0 && m_meta_mask != mask @@ -800,7 +800,7 @@ void QTestLiteKeyboard::setMask(KeySym sym, uint mask) } } -int QTestLiteKeyboard::translateKeySym(uint key) const +int QXlibKeyboard::translateKeySym(uint key) const { int code = -1; int i = 0; // any other keys @@ -822,7 +822,7 @@ int QTestLiteKeyboard::translateKeySym(uint key) const return code; } -QString QTestLiteKeyboard::translateKeySym(KeySym keysym, uint xmodifiers, +QString QXlibKeyboard::translateKeySym(KeySym keysym, uint xmodifiers, int &code, Qt::KeyboardModifiers &modifiers, QByteArray &chars, int &count) { @@ -939,7 +939,7 @@ QString QTestLiteKeyboard::translateKeySym(KeySym keysym, uint xmodifiers, return text; } -QTestLiteKeyboard::QTestLiteKeyboard(QTestLiteScreen *screen) +QXlibKeyboard::QXlibKeyboard(QXlibScreen *screen) : m_screen(screen) , m_alt_mask(0) , m_super_mask(0) @@ -949,7 +949,7 @@ QTestLiteKeyboard::QTestLiteKeyboard(QTestLiteScreen *screen) changeLayout(); } -void QTestLiteKeyboard::changeLayout() +void QXlibKeyboard::changeLayout() { XkbDescPtr xkbDesc = XkbGetMap(m_screen->display(), XkbAllClientInfoMask, XkbUseCoreKbd); for (int i = xkbDesc->min_key_code; i < xkbDesc->max_key_code; ++i) { @@ -986,7 +986,7 @@ static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) } } -void QTestLiteKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev) +void QXlibKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev) { int qtcode = 0; Qt::KeyboardModifiers modifiers = translateModifiers(ev->state); diff --git a/src/plugins/platforms/testlite/qtestlitekeyboard.h b/src/plugins/platforms/testlite/qtestlitekeyboard.h index 6873a09..98df4e1 100644 --- a/src/plugins/platforms/testlite/qtestlitekeyboard.h +++ b/src/plugins/platforms/testlite/qtestlitekeyboard.h @@ -44,10 +44,10 @@ #include "qtestliteintegration.h" -class QTestLiteKeyboard +class QXlibKeyboard { public: - QTestLiteKeyboard(QTestLiteScreen *screen); + QXlibKeyboard(QXlibScreen *screen); void changeLayout(); @@ -63,7 +63,7 @@ private: int &code, Qt::KeyboardModifiers &modifiers, QByteArray &chars, int &count); - QTestLiteScreen *m_screen; + QXlibScreen *m_screen; uint m_alt_mask; uint m_super_mask; diff --git a/src/plugins/platforms/testlite/qtestlitemime.cpp b/src/plugins/platforms/testlite/qtestlitemime.cpp index c509991..5335ae9 100644 --- a/src/plugins/platforms/testlite/qtestlitemime.cpp +++ b/src/plugins/platforms/testlite/qtestlitemime.cpp @@ -48,22 +48,22 @@ #include #include -QTestLiteMime::QTestLiteMime() +QXlibMime::QXlibMime() : QInternalMimeData() { } -QTestLiteMime::~QTestLiteMime() +QXlibMime::~QXlibMime() {} -QString QTestLiteMime::mimeAtomToString(Display *display, Atom a) +QString QXlibMime::mimeAtomToString(Display *display, Atom a) { if (!a) return 0; - if (a == XA_STRING || a == QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING)) { + if (a == XA_STRING || a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) { return "text/plain"; // some Xdnd clients are dumb } char *atom = XGetAtomName(display, a); @@ -72,14 +72,14 @@ QString QTestLiteMime::mimeAtomToString(Display *display, Atom a) return result; } -Atom QTestLiteMime::mimeStringToAtom(Display *display, const QString &mimeType) +Atom QXlibMime::mimeStringToAtom(Display *display, const QString &mimeType) { if (mimeType.isEmpty()) return 0; return XInternAtom(display, mimeType.toLatin1().constData(), False); } -QStringList QTestLiteMime::mimeFormatsForAtom(Display *display, Atom a) +QStringList QXlibMime::mimeFormatsForAtom(Display *display, Atom a) { QStringList formats; if (a) { @@ -87,10 +87,10 @@ QStringList QTestLiteMime::mimeFormatsForAtom(Display *display, Atom a) formats.append(atomName); // special cases for string type - if (a == QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING) + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) || a == XA_STRING - || a == QTestLiteStatic::atom(QTestLiteStatic::TEXT) - || a == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) + || a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) formats.append(QLatin1String("text/plain")); // special cases for uris @@ -104,7 +104,7 @@ QStringList QTestLiteMime::mimeFormatsForAtom(Display *display, Atom a) return formats; } -bool QTestLiteMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat) +bool QXlibMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat) { bool ret = false; *atomFormat = a; @@ -116,27 +116,27 @@ bool QTestLiteMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeDat *dataFormat = 16; ret = true; } else { - if ((a == QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING) + if ((a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) || a == XA_STRING - || a == QTestLiteStatic::atom(QTestLiteStatic::TEXT) - || a == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) + || a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) && QInternalMimeData::hasFormatHelper(QLatin1String("text/plain"), mimeData)) { - if (a == QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING)){ + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)){ *data = QInternalMimeData::renderDataHelper(QLatin1String("text/plain"), mimeData); ret = true; } else if (a == XA_STRING) { *data = QString::fromUtf8(QInternalMimeData::renderDataHelper( QLatin1String("text/plain"), mimeData)).toLocal8Bit(); ret = true; - } else if (a == QTestLiteStatic::atom(QTestLiteStatic::TEXT) - || a == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) { + } else if (a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { // the ICCCM states that TEXT and COMPOUND_TEXT are in the // encoding of choice, so we choose the encoding of the locale QByteArray strData = QString::fromUtf8(QInternalMimeData::renderDataHelper( QLatin1String("text/plain"), mimeData)).toLocal8Bit(); char *list[] = { strData.data(), NULL }; - XICCEncodingStyle style = (a == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) + XICCEncodingStyle style = (a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) ? XCompoundTextStyle : XStdICCTextStyle; XTextProperty textprop; if (list[0] != NULL @@ -165,17 +165,17 @@ bool QTestLiteMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeDat return ret && data != 0; } -QList QTestLiteMime::mimeAtomsForFormat(Display *display, const QString &format) +QList QXlibMime::mimeAtomsForFormat(Display *display, const QString &format) { QList atoms; atoms.append(mimeStringToAtom(display, format)); // special cases for strings if (format == QLatin1String("text/plain")) { - atoms.append(QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING)); + atoms.append(QXlibStatic::atom(QXlibStatic::UTF8_STRING)); atoms.append(XA_STRING); - atoms.append(QTestLiteStatic::atom(QTestLiteStatic::TEXT)); - atoms.append(QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)); + atoms.append(QXlibStatic::atom(QXlibStatic::TEXT)); + atoms.append(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)); } // special cases for uris @@ -192,7 +192,7 @@ QList QTestLiteMime::mimeAtomsForFormat(Display *display, const QString &f return atoms; } -QVariant QTestLiteMime::mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding) +QVariant QXlibMime::mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding) { QString atomName = mimeAtomToString(display,a); if (atomName == format) @@ -212,12 +212,12 @@ QVariant QTestLiteMime::mimeConvertToFormat(Display *display, Atom a, const QByt // special cases for string types if (format == QLatin1String("text/plain")) { - if (a == QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING)) + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) return QString::fromUtf8(data); if (a == XA_STRING) return QString::fromLatin1(data); - if (a == QTestLiteStatic::atom(QTestLiteStatic::TEXT) - || a == QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT)) + if (a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) // #### might be wrong for COMPUND_TEXT return QString::fromLocal8Bit(data, data.size()); } @@ -251,7 +251,7 @@ QVariant QTestLiteMime::mimeConvertToFormat(Display *display, Atom a, const QByt XGetGeometry(display, xpm, &root, &x, &y, &width, &height, &border_width, &depth); XImage *ximg = XGetImage(display,xpm,x,y,width,height,AllPlanes,depth==1 ? XYPixmap : ZPixmap); - QImage qimg = QTestLiteStatic::qimageFromXImage(ximg); + QImage qimg = QXlibStatic::qimageFromXImage(ximg); XDestroyImage(ximg); QImageWriter imageWriter; @@ -266,18 +266,18 @@ QVariant QTestLiteMime::mimeConvertToFormat(Display *display, Atom a, const QByt return QVariant(); } -Atom QTestLiteMime::mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList &atoms, QByteArray *requestedEncoding) +Atom QXlibMime::mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList &atoms, QByteArray *requestedEncoding) { requestedEncoding->clear(); // find matches for string types if (format == QLatin1String("text/plain")) { - if (atoms.contains(QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING))) - return QTestLiteStatic::atom(QTestLiteStatic::UTF8_STRING); - if (atoms.contains(QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT))) - return QTestLiteStatic::atom(QTestLiteStatic::COMPOUND_TEXT); - if (atoms.contains(QTestLiteStatic::atom(QTestLiteStatic::TEXT))) - return QTestLiteStatic::atom(QTestLiteStatic::TEXT); + if (atoms.contains(QXlibStatic::atom(QXlibStatic::UTF8_STRING))) + return QXlibStatic::atom(QXlibStatic::UTF8_STRING); + if (atoms.contains(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT))) + return QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT); + if (atoms.contains(QXlibStatic::atom(QXlibStatic::TEXT))) + return QXlibStatic::atom(QXlibStatic::TEXT); if (atoms.contains(XA_STRING)) return XA_STRING; } diff --git a/src/plugins/platforms/testlite/qtestlitemime.h b/src/plugins/platforms/testlite/qtestlitemime.h index f11070f..6a70ea4 100644 --- a/src/plugins/platforms/testlite/qtestlitemime.h +++ b/src/plugins/platforms/testlite/qtestlitemime.h @@ -49,11 +49,11 @@ #include "qtestliteintegration.h" #include "qtestliteclipboard.h" -class QTestLiteMime : public QInternalMimeData { +class QXlibMime : public QInternalMimeData { Q_OBJECT public: - QTestLiteMime(); - ~QTestLiteMime(); + QXlibMime(); + ~QXlibMime(); static QList mimeAtomsForFormat(Display *display, const QString &format); static QString mimeAtomToString(Display *display, Atom a); diff --git a/src/plugins/platforms/testlite/qtestlitescreen.cpp b/src/plugins/platforms/testlite/qtestlitescreen.cpp index c211ee6..714c17b 100644 --- a/src/plugins/platforms/testlite/qtestlitescreen.cpp +++ b/src/plugins/platforms/testlite/qtestlitescreen.cpp @@ -188,7 +188,7 @@ qDebug() << "qt_x_errhandler" << err->error_code; return 0; } -QTestLiteScreen::QTestLiteScreen() +QXlibScreen::QXlibScreen() : mFormat(QImage::Format_RGB32) { char *display_name = getenv("DISPLAY"); @@ -228,11 +228,11 @@ QTestLiteScreen::QTestLiteScreen() QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); - mCursor = new QTestLiteCursor(this); - mKeyboard = new QTestLiteKeyboard(this); + mCursor = new QXlibCursor(this); + mKeyboard = new QXlibKeyboard(this); } -QTestLiteScreen::~QTestLiteScreen() +QXlibScreen::~QXlibScreen() { delete mCursor; XCloseDisplay(mDisplay); @@ -245,17 +245,17 @@ QTestLiteScreen::~QTestLiteScreen() #undef KeyRelease #endif -bool QTestLiteScreen::handleEvent(XEvent *xe) +bool QXlibScreen::handleEvent(XEvent *xe) { int quit = false; - QTestLiteWindow *platformWindow = 0; + QXlibWindow *platformWindow = 0; QWidget *widget = QWidget::find(xe->xany.window); if (widget) { - platformWindow = static_cast(widget->platformWindow()); + platformWindow = static_cast(widget->platformWindow()); } - Atom wmProtocolsAtom = QTestLiteStatic::atom(QTestLiteStatic::WM_PROTOCOLS); - Atom wmDeleteWindowAtom = QTestLiteStatic::atom(QTestLiteStatic::WM_DELETE_WINDOW); + Atom wmProtocolsAtom = QXlibStatic::atom(QXlibStatic::WM_PROTOCOLS); + Atom wmDeleteWindowAtom = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); switch (xe->type) { case ClientMessage: @@ -346,14 +346,14 @@ bool QTestLiteScreen::handleEvent(XEvent *xe) static Bool checkForClipboardEvents(Display *, XEvent *e, XPointer) { - Atom clipboard = QTestLiteStatic::atom(QTestLiteStatic::CLIPBOARD); + Atom clipboard = QXlibStatic::atom(QXlibStatic::CLIPBOARD); return ((e->type == SelectionRequest && (e->xselectionrequest.selection == XA_PRIMARY || e->xselectionrequest.selection == clipboard)) || (e->type == SelectionClear && (e->xselectionclear.selection == XA_PRIMARY || e->xselectionclear.selection == clipboard))); } -bool QTestLiteScreen::waitForClipboardEvent(Window win, int type, XEvent *event, int timeout) +bool QXlibScreen::waitForClipboardEvent(Window win, int type, XEvent *event, int timeout) { QElapsedTimer timer; timer.start(); @@ -377,7 +377,7 @@ bool QTestLiteScreen::waitForClipboardEvent(Window win, int type, XEvent *event, return false; } -void QTestLiteScreen::eventDispatcher() +void QXlibScreen::eventDispatcher() { ulong marker = XNextRequest(mDisplay); // int i = 0; @@ -402,7 +402,7 @@ void QTestLiteScreen::eventDispatcher() } } -QImage QTestLiteScreen::grabWindow(Window window, int x, int y, int w, int h) +QImage QXlibScreen::grabWindow(Window window, int x, int y, int w, int h) { if (w == 0 || h ==0) return QImage(); @@ -437,31 +437,31 @@ QImage QTestLiteScreen::grabWindow(Window window, int x, int y, int w, int h) return result; } -QTestLiteScreen * QTestLiteScreen::testLiteScreenForWidget(QWidget *widget) +QXlibScreen * QXlibScreen::testLiteScreenForWidget(QWidget *widget) { QPlatformScreen *platformScreen = platformScreenForWidget(widget); - return static_cast(platformScreen); + return static_cast(platformScreen); } -Display * QTestLiteScreen::display() const +Display * QXlibScreen::display() const { return mDisplay; } -int QTestLiteScreen::xScreenNumber() const +int QXlibScreen::xScreenNumber() const { return mScreen; } -QTestLiteKeyboard * QTestLiteScreen::keyboard() const +QXlibKeyboard * QXlibScreen::keyboard() const { return mKeyboard; } -void QTestLiteScreen::handleSelectionRequest(XEvent *event) +void QXlibScreen::handleSelectionRequest(XEvent *event) { QPlatformIntegration *integration = QApplicationPrivate::platformIntegration(); - QTestLiteClipboard *clipboard = static_cast(integration->clipboard()); + QXlibClipboard *clipboard = static_cast(integration->clipboard()); clipboard->handleSelectionRequest(event); } diff --git a/src/plugins/platforms/testlite/qtestlitescreen.h b/src/plugins/platforms/testlite/qtestlitescreen.h index 860a67c..7e59a59 100644 --- a/src/plugins/platforms/testlite/qtestlitescreen.h +++ b/src/plugins/platforms/testlite/qtestlitescreen.h @@ -47,16 +47,16 @@ QT_BEGIN_NAMESPACE -class QTestLiteCursor; -class QTestLiteKeyboard; +class QXlibCursor; +class QXlibKeyboard; -class QTestLiteScreen : public QPlatformScreen +class QXlibScreen : public QPlatformScreen { Q_OBJECT public: - QTestLiteScreen(); + QXlibScreen(); - ~QTestLiteScreen(); + ~QXlibScreen(); QString displayName() const { return mDisplayName; } @@ -74,12 +74,12 @@ public: QImage grabWindow(Window window, int x, int y, int w, int h); - static QTestLiteScreen *testLiteScreenForWidget(QWidget *widget); + static QXlibScreen *testLiteScreenForWidget(QWidget *widget); Display *display() const; int xScreenNumber() const; - QTestLiteKeyboard *keyboard() const; + QXlibKeyboard *keyboard() const; public slots: void eventDispatcher(); @@ -92,8 +92,8 @@ private: QSize mPhysicalSize; int mDepth; QImage::Format mFormat; - QTestLiteCursor *mCursor; - QTestLiteKeyboard *mKeyboard; + QXlibCursor *mCursor; + QXlibKeyboard *mKeyboard; Display * mDisplay; int mScreen; diff --git a/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp b/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp index 2c6404d..837636c 100644 --- a/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp +++ b/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp @@ -261,7 +261,7 @@ public: , xfixes_eventbase(0) , xfixes_errorbase(0) { - QTestLiteScreen *screen = qobject_cast (QApplicationPrivate::platformIntegration()->screens().at(0)); + QXlibScreen *screen = qobject_cast (QApplicationPrivate::platformIntegration()->screens().at(0)); Q_ASSERT(screen); initializeAllAtoms(screen); @@ -287,7 +287,7 @@ public: return supported; } - Atom atom(QTestLiteStatic::X11Atom atom) + Atom atom(QXlibStatic::X11Atom atom) { return m_allAtoms[atom]; } @@ -351,8 +351,8 @@ public: private: - void initializeAllAtoms(QTestLiteScreen *screen) { - const char *names[QTestLiteStatic::NAtoms]; + void initializeAllAtoms(QXlibScreen *screen) { + const char *names[QXlibStatic::NAtoms]; const char *ptr = x11_atomnames; int i = 0; @@ -363,22 +363,22 @@ private: ++ptr; } - Q_ASSERT(i == QTestLiteStatic::NPredefinedAtoms); + Q_ASSERT(i == QXlibStatic::NPredefinedAtoms); QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_"); settings_atom_name += XDisplayName(qPrintable(screen->displayName())); names[i++] = settings_atom_name; - Q_ASSERT(i == QTestLiteStatic::NAtoms); + Q_ASSERT(i == QXlibStatic::NAtoms); #if 0//defined(XlibSpecificationRelease) && (XlibSpecificationRelease >= 6) XInternAtoms(screen->display(), (char **)names, i, False, m_allAtoms); #else - for (i = 0; i < QTestLiteStatic::NAtoms; ++i) + for (i = 0; i < QXlibStatic::NAtoms; ++i) m_allAtoms[i] = XInternAtom(screen->display(), (char *)names[i], False); #endif } - void initializeSupportedAtoms(QTestLiteScreen *screen) + void initializeSupportedAtoms(QXlibScreen *screen) { Atom type; int format; @@ -387,7 +387,7 @@ private: unsigned char *data = 0; int e = XGetWindowProperty(screen->display(), screen->rootWindow(), - this->atom(QTestLiteStatic::_NET_SUPPORTED), 0, 0, + this->atom(QXlibStatic::_NET_SUPPORTED), 0, 0, False, XA_ATOM, &type, &format, &nitems, &after, &data); if (data) XFree(data); @@ -398,7 +398,7 @@ private: while (after > 0) { XGetWindowProperty(screen->display(), screen->rootWindow(), - this->atom(QTestLiteStatic::_NET_SUPPORTED), offset, 1024, + this->atom(QXlibStatic::_NET_SUPPORTED), offset, 1024, False, XA_ATOM, &type, &format, &nitems, &after, &data); if (type == XA_ATOM && format == 32) { @@ -423,7 +423,7 @@ private: } } - void resolveXFixes(QTestLiteScreen *screen) + void resolveXFixes(QXlibScreen *screen) { #ifndef QT_NO_XFIXES // See if Xfixes is supported on the connected display @@ -456,7 +456,7 @@ private: } Atom *m_supportedAtoms; - Atom m_allAtoms[QTestLiteStatic::NAtoms]; + Atom m_allAtoms[QXlibStatic::NAtoms]; #ifndef QT_NO_XFIXES PtrXFixesQueryExtension ptrXFixesQueryExtension; @@ -474,28 +474,28 @@ private: Q_GLOBAL_STATIC(QTestLiteStaticInfoPrivate, qTestLiteStaticInfoPrivate); -Atom QTestLiteStatic::atom(QTestLiteStatic::X11Atom atom) +Atom QXlibStatic::atom(QXlibStatic::X11Atom atom) { return qTestLiteStaticInfoPrivate()->atom(atom); } -bool QTestLiteStatic::isSupportedByWM(Atom atom) +bool QXlibStatic::isSupportedByWM(Atom atom) { return qTestLiteStaticInfoPrivate()->isSupportedByWM(atom); } -bool QTestLiteStatic::useXFixes() +bool QXlibStatic::useXFixes() { return qTestLiteStaticInfoPrivate()->useXFixes(); } -int QTestLiteStatic::xFixesEventBase() +int QXlibStatic::xFixesEventBase() { return qTestLiteStaticInfoPrivate()->xFixesEventBase(); } #ifndef QT_NO_XFIXES -PtrXFixesSelectSelectionInput QTestLiteStatic::xFixesSelectSelectionInput() +PtrXFixesSelectSelectionInput QXlibStatic::xFixesSelectSelectionInput() { qDebug() << qTestLiteStaticInfoPrivate()->useXFixes(); if (!qTestLiteStaticInfoPrivate()->useXFixes()) @@ -504,7 +504,7 @@ PtrXFixesSelectSelectionInput QTestLiteStatic::xFixesSelectSelectionInput() return qTestLiteStaticInfoPrivate()->xFixesSelectSelectionInput(); } -QImage QTestLiteStatic::qimageFromXImage(XImage *xi) +QImage QXlibStatic::qimageFromXImage(XImage *xi) { return qTestLiteStaticInfoPrivate()->qimageFromXImage(xi); } diff --git a/src/plugins/platforms/testlite/qtestlitestaticinfo.h b/src/plugins/platforms/testlite/qtestlitestaticinfo.h index 0876768..8473ee9 100644 --- a/src/plugins/platforms/testlite/qtestlitestaticinfo.h +++ b/src/plugins/platforms/testlite/qtestlitestaticinfo.h @@ -231,7 +231,7 @@ enum { #endif -class QTestLiteStatic +class QXlibStatic { public: enum X11Atom { diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp index b7c5e99..0f11a81 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindow.cpp @@ -68,10 +68,10 @@ QT_BEGIN_NAMESPACE -QTestLiteWindow::QTestLiteWindow(QWidget *window) +QXlibWindow::QXlibWindow(QWidget *window) : QPlatformWindow(window) , mGLContext(0) - , mScreen(QTestLiteScreen::testLiteScreenForWidget(window)) + , mScreen(QXlibScreen::testLiteScreenForWidget(window)) { int x = window->x(); int y = window->y(); @@ -88,7 +88,7 @@ QTestLiteWindow::QTestLiteWindow(QWidget *window) EGLDisplay eglDisplay = eglGetDisplay(mScreen->display()); EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,windowFormat); - VisualID id = QTestLiteEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); + VisualID id = QXlibEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); XVisualInfo visualInfoTemplate; memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); @@ -133,20 +133,20 @@ QTestLiteWindow::QTestLiteWindow(QWidget *window) Atom protocols[5]; int n = 0; - protocols[n++] = QTestLiteStatic::atom(QTestLiteStatic::WM_DELETE_WINDOW); // support del window protocol - protocols[n++] = QTestLiteStatic::atom(QTestLiteStatic::WM_TAKE_FOCUS); // support take focus window protocol - protocols[n++] = QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_PING); // support _NET_WM_PING protocol + protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); // support del window protocol + protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_TAKE_FOCUS); // support take focus window protocol + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_PING); // support _NET_WM_PING protocol #ifndef QT_NO_XSYNC - protocols[n++] = QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_SYNC_REQUEST); // support _NET_WM_SYNC_REQUEST protocol + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_SYNC_REQUEST); // support _NET_WM_SYNC_REQUEST protocol #endif // QT_NO_XSYNC if (window->windowFlags() & Qt::WindowContextHelpButtonHint) - protocols[n++] = QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_CONTEXT_HELP); + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_CONTEXT_HELP); XSetWMProtocols(mScreen->display(), x_window, protocols, n); } -QTestLiteWindow::~QTestLiteWindow() +QXlibWindow::~QXlibWindow() { #ifdef MYX11_DEBUG qDebug() << "~QTestLiteWindow" << hex << x_window; @@ -172,7 +172,7 @@ static Qt::MouseButtons translateMouseButtons(int s) -void QTestLiteWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) +void QXlibWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) { static QPoint mousePoint; @@ -215,68 +215,68 @@ void QTestLiteWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) mousePoint = QPoint(e->x_root, e->y_root); } -void QTestLiteWindow::handleCloseEvent() +void QXlibWindow::handleCloseEvent() { QWindowSystemInterface::handleCloseEvent(widget()); } -void QTestLiteWindow::handleEnterEvent() +void QXlibWindow::handleEnterEvent() { QWindowSystemInterface::handleEnterEvent(widget()); } -void QTestLiteWindow::handleLeaveEvent() +void QXlibWindow::handleLeaveEvent() { QWindowSystemInterface::handleLeaveEvent(widget()); } -void QTestLiteWindow::handleFocusInEvent() +void QXlibWindow::handleFocusInEvent() { QWindowSystemInterface::handleWindowActivated(widget()); } -void QTestLiteWindow::handleFocusOutEvent() +void QXlibWindow::handleFocusOutEvent() { QWindowSystemInterface::handleWindowActivated(0); } -void QTestLiteWindow::setGeometry(const QRect &rect) +void QXlibWindow::setGeometry(const QRect &rect) { XMoveResizeWindow(mScreen->display(), x_window, rect.x(), rect.y(), rect.width(), rect.height()); QPlatformWindow::setGeometry(rect); } -Qt::WindowFlags QTestLiteWindow::windowFlags() const +Qt::WindowFlags QXlibWindow::windowFlags() const { return mWindowFlags; } -WId QTestLiteWindow::winId() const +WId QXlibWindow::winId() const { return x_window; } -void QTestLiteWindow::setParent(const QPlatformWindow *window) +void QXlibWindow::setParent(const QPlatformWindow *window) { QPoint topLeft = geometry().topLeft(); XReparentWindow(mScreen->display(),x_window,window->winId(),topLeft.x(),topLeft.y()); } -void QTestLiteWindow::raise() +void QXlibWindow::raise() { XRaiseWindow(mScreen->display(), x_window); } -void QTestLiteWindow::lower() +void QXlibWindow::lower() { XLowerWindow(mScreen->display(), x_window); } -void QTestLiteWindow::setWindowTitle(const QString &title) +void QXlibWindow::setWindowTitle(const QString &title) { QByteArray ba = title.toLatin1(); //We're not making a general solution here... XTextProperty windowName; @@ -288,7 +288,7 @@ void QTestLiteWindow::setWindowTitle(const QString &title) XSetWMName(mScreen->display(), x_window, &windowName); } -GC QTestLiteWindow::createGC() +GC QXlibWindow::createGC() { GC gc; @@ -299,7 +299,7 @@ GC QTestLiteWindow::createGC() return gc; } -void QTestLiteWindow::paintEvent() +void QXlibWindow::paintEvent() { #ifdef MYX11_DEBUG // qDebug() << "QTestLiteWindow::paintEvent" << shm_img.size() << painted; @@ -309,12 +309,12 @@ void QTestLiteWindow::paintEvent() surface->flush(widget(), widget()->geometry(), QPoint()); } -void QTestLiteWindow::requestActivateWindow() +void QXlibWindow::requestActivateWindow() { XSetInputFocus(mScreen->display(), x_window, XRevertToParent, CurrentTime); } -void QTestLiteWindow::resizeEvent(XConfigureEvent *e) +void QXlibWindow::resizeEvent(XConfigureEvent *e) { int xpos = geometry().x(); int ypos = geometry().y(); @@ -333,7 +333,7 @@ void QTestLiteWindow::resizeEvent(XConfigureEvent *e) QWindowSystemInterface::handleGeometryChange(widget(), newRect); } -void QTestLiteWindow::mousePressEvent(XButtonEvent *e) +void QXlibWindow::mousePressEvent(XButtonEvent *e) { static long prevTime = 0; static Window prevWindow; @@ -356,22 +356,22 @@ void QTestLiteWindow::mousePressEvent(XButtonEvent *e) handleMouseEvent(type, e); } -QtMWMHints QTestLiteWindow::getMWMHints() const +QXlibMWMHints QXlibWindow::getMWMHints() const { - QtMWMHints mwmhints; + QXlibMWMHints mwmhints; Atom type; int format; ulong nitems, bytesLeft; uchar *data = 0; - Atom atomForMotifWmHints = QTestLiteStatic::atom(QTestLiteStatic::_MOTIF_WM_HINTS); + Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); if ((XGetWindowProperty(mScreen->display(), x_window, atomForMotifWmHints, 0, 5, false, atomForMotifWmHints, &type, &format, &nitems, &bytesLeft, &data) == Success) && (type == atomForMotifWmHints && format == 32 && nitems >= 5)) { - mwmhints = *(reinterpret_cast(data)); + mwmhints = *(reinterpret_cast(data)); } else { mwmhints.flags = 0L; mwmhints.functions = MWM_FUNC_ALL; @@ -386,9 +386,9 @@ QtMWMHints QTestLiteWindow::getMWMHints() const return mwmhints; } -void QTestLiteWindow::setMWMHints(const QtMWMHints &mwmhints) +void QXlibWindow::setMWMHints(const QXlibMWMHints &mwmhints) { - Atom atomForMotifWmHints = QTestLiteStatic::atom(QTestLiteStatic::_MOTIF_WM_HINTS); + Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); if (mwmhints.flags != 0l) { XChangeProperty(mScreen->display(), x_window, atomForMotifWmHints, atomForMotifWmHints, 32, @@ -411,7 +411,7 @@ static inline bool isTransient(const QWidget *w) && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); } -QVector QTestLiteWindow::getNetWmState() const +QVector QXlibWindow::getNetWmState() const { QVector returnValue; @@ -421,7 +421,7 @@ QVector QTestLiteWindow::getNetWmState() const ulong propertyLength; ulong bytesLeft; uchar *propertyData = 0; - if (XGetWindowProperty(mScreen->display(), x_window, QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE), 0, 0, + if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, 0, False, XA_ATOM, &actualType, &actualFormat, &propertyLength, &bytesLeft, &propertyData) == Success && actualType == XA_ATOM && actualFormat == 32) { @@ -429,7 +429,7 @@ QVector QTestLiteWindow::getNetWmState() const XFree((char*) propertyData); // fetch all data - if (XGetWindowProperty(mScreen->display(), x_window, QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE), 0, + if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, returnValue.size(), False, XA_ATOM, &actualType, &actualFormat, &propertyLength, &bytesLeft, &propertyData) != Success) { returnValue.clear(); @@ -447,7 +447,7 @@ QVector QTestLiteWindow::getNetWmState() const return returnValue; } -Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) +Qt::WindowFlags QXlibWindow::setWindowFlags(Qt::WindowFlags flags) { // Q_ASSERT(flags & Qt::Window); mWindowFlags = flags; @@ -478,7 +478,7 @@ Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) XSetWindowAttributes wsa; - QtMWMHints mwmhints; + QXlibMWMHints mwmhints; mwmhints.flags = 0L; mwmhints.functions = 0L; mwmhints.decorations = 0; @@ -567,35 +567,35 @@ Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) if (flags & Qt::WindowStaysOnTopHint) { if (flags & Qt::WindowStaysOnBottomHint) qWarning() << "QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time"; - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_ABOVE))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_ABOVE)); - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_STAYS_ON_TOP))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_STAYS_ON_TOP)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP)); } else if (flags & Qt::WindowStaysOnBottomHint) { - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_BELOW))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_BELOW)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW)); } if (widget()->isFullScreen()) { - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_FULLSCREEN))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_FULLSCREEN)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN)); } if (widget()->isMaximized()) { - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MAXIMIZED_HORZ))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MAXIMIZED_HORZ)); - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MAXIMIZED_VERT))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MAXIMIZED_VERT)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT)); } if (widget()->windowModality() != Qt::NonModal) { - if (!netWmState.contains(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MODAL))) - netWmState.append(QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE_MODAL)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL)); } if (!netWmState.isEmpty()) { XChangeProperty(mScreen->display(), x_window, - QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE), XA_ATOM, 32, PropModeReplace, + QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), XA_ATOM, 32, PropModeReplace, (unsigned char *) netWmState.data(), netWmState.size()); } else { - XDeleteProperty(mScreen->display(), x_window, QTestLiteStatic::atom(QTestLiteStatic::_NET_WM_STATE)); + XDeleteProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE)); } //##### only if initializeWindow??? @@ -620,7 +620,7 @@ Qt::WindowFlags QTestLiteWindow::setWindowFlags(Qt::WindowFlags flags) return flags; } -void QTestLiteWindow::setVisible(bool visible) +void QXlibWindow::setVisible(bool visible) { #ifdef MYX11_DEBUG qDebug() << "QTestLiteWindow::setVisible" << visible << hex << x_window; @@ -630,7 +630,7 @@ void QTestLiteWindow::setVisible(bool visible) if (widget()->parentWidget()) { QWidget *widgetParent = widget()->parentWidget()->window(); if (widgetParent && widgetParent->platformWindow()) { - QTestLiteWindow *parentWidnow = static_cast(widgetParent->platformWindow()); + QXlibWindow *parentWidnow = static_cast(widgetParent->platformWindow()); parentXWindow = parentWidnow->x_window; } } @@ -646,18 +646,18 @@ void QTestLiteWindow::setVisible(bool visible) } } -void QTestLiteWindow::setCursor(const Cursor &cursor) +void QXlibWindow::setCursor(const Cursor &cursor) { XDefineCursor(mScreen->display(), x_window, cursor); XFlush(mScreen->display()); } -QPlatformGLContext *QTestLiteWindow::glContext() const +QPlatformGLContext *QXlibWindow::glContext() const { if (!QApplicationPrivate::platformIntegration()->hasOpenGL()) return 0; if (!mGLContext) { - QTestLiteWindow *that = const_cast(this); + QXlibWindow *that = const_cast(this); #if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) that->mGLContext = new QGLXContext(x_window, mScreen,widget()->platformWindowFormat()); @@ -680,17 +680,17 @@ QPlatformGLContext *QTestLiteWindow::glContext() const return mGLContext; } -Window QTestLiteWindow::xWindow() const +Window QXlibWindow::xWindow() const { return x_window; } -GC QTestLiteWindow::graphicsContext() const +GC QXlibWindow::graphicsContext() const { return gc; } -void QTestLiteWindow::doSizeHints() +void QXlibWindow::doSizeHints() { Q_ASSERT(widget()->testAttribute(Qt::WA_WState_Created)); XSizeHints s; @@ -709,7 +709,7 @@ void QTestLiteWindow::doSizeHints() XSetWMNormalHints(mScreen->display(), x_window, &s); } -QPlatformWindowFormat QTestLiteWindow::correctColorBuffers(const QPlatformWindowFormat &platformWindowFormat) const +QPlatformWindowFormat QXlibWindow::correctColorBuffers(const QPlatformWindowFormat &platformWindowFormat) const { // I have only tested this setup on a dodgy intel setup, where I didn't use standard libs, // so this might be not what we want to do :) diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h index 2ca7e10..ccf6867 100644 --- a/src/plugins/platforms/testlite/qtestlitewindow.h +++ b/src/plugins/platforms/testlite/qtestlitewindow.h @@ -50,7 +50,7 @@ #include #include -struct QtMWMHints { +struct QXlibMWMHints { ulong flags, functions, decorations; long input_mode; ulong status; @@ -83,11 +83,11 @@ enum { MWM_INPUT_FULL_APPLICATION_MODAL = 3L }; -class QTestLiteWindow : public QPlatformWindow +class QXlibWindow : public QPlatformWindow { public: - QTestLiteWindow(QWidget *window); - ~QTestLiteWindow(); + QXlibWindow(QWidget *window); + ~QXlibWindow(); void mousePressEvent(XButtonEvent*); @@ -124,8 +124,8 @@ public: protected: QVector getNetWmState() const; - void setMWMHints(const QtMWMHints &mwmhints); - QtMWMHints getMWMHints() const; + void setMWMHints(const QXlibMWMHints &mwmhints); + QXlibMWMHints getMWMHints() const; void doSizeHints(); @@ -138,7 +138,7 @@ private: GC createGC(); QPlatformGLContext *mGLContext; - QTestLiteScreen *mScreen; + QXlibScreen *mScreen; Qt::WindowFlags mWindowFlags; }; diff --git a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp b/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp index ced964a..088730d 100644 --- a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp +++ b/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp @@ -55,9 +55,9 @@ QT_BEGIN_NAMESPACE -struct MyShmImageInfo { - MyShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} - ~MyShmImageInfo() { destroy(); } +struct QXlibShmImageInfo { + QXlibShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} + ~QXlibShmImageInfo() { destroy(); } void destroy(); @@ -68,7 +68,7 @@ struct MyShmImageInfo { #ifndef DONT_USE_MIT_SHM -void MyShmImageInfo::destroy() +void QXlibShmImageInfo::destroy() { XShmDetach (display, &shminfo); XDestroyImage (image); @@ -77,18 +77,18 @@ void MyShmImageInfo::destroy() } #endif -void QTestLiteWindowSurface::resizeShmImage(int width, int height) +void QXlibWindowSurface::resizeShmImage(int width, int height) { #ifdef DONT_USE_MIT_SHM shm_img = QImage(width, height, QImage::Format_RGB32); #else - QTestLiteScreen *screen = QTestLiteScreen::testLiteScreenForWidget(window()); + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(window()); if (image_info) image_info->destroy(); else - image_info = new MyShmImageInfo(screen->display()); + image_info = new QXlibShmImageInfo(screen->display()); Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); @@ -115,37 +115,37 @@ void QTestLiteWindowSurface::resizeShmImage(int width, int height) } -void QTestLiteWindowSurface::resizeBuffer(QSize s) +void QXlibWindowSurface::resizeBuffer(QSize s) { if (shm_img.size() != s) resizeShmImage(s.width(), s.height()); } -QSize QTestLiteWindowSurface::bufferSize() const +QSize QXlibWindowSurface::bufferSize() const { return shm_img.size(); } -QTestLiteWindowSurface::QTestLiteWindowSurface (QWidget *window) +QXlibWindowSurface::QXlibWindowSurface (QWidget *window) : QWindowSurface(window), painted(false), image_info(0) { - xw = static_cast(window->platformWindow()); + xw = static_cast(window->platformWindow()); // qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; } -QTestLiteWindowSurface::~QTestLiteWindowSurface() +QXlibWindowSurface::~QXlibWindowSurface() { delete image_info; } -QPaintDevice *QTestLiteWindowSurface::paintDevice() +QPaintDevice *QXlibWindowSurface::paintDevice() { return &shm_img; } -void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +void QXlibWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) { Q_UNUSED(widget); Q_UNUSED(region); @@ -154,7 +154,7 @@ void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const if (!painted) return; - QTestLiteScreen *screen = QTestLiteScreen::testLiteScreenForWidget(widget); + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); GC gc = xw->graphicsContext(); Window window = xw->xWindow(); #ifdef DONT_USE_MIT_SHM @@ -197,7 +197,7 @@ void QTestLiteWindowSurface::flush(QWidget *widget, const QRegion ®ion, const // from qwindowsurface.cpp extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); -bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) +bool QXlibWindowSurface::scroll(const QRegion &area, int dx, int dy) { if (shm_img.isNull()) return false; @@ -210,13 +210,13 @@ bool QTestLiteWindowSurface::scroll(const QRegion &area, int dx, int dy) } -void QTestLiteWindowSurface::beginPaint(const QRegion ®ion) +void QXlibWindowSurface::beginPaint(const QRegion ®ion) { Q_UNUSED(region); resizeBuffer(size()); } -void QTestLiteWindowSurface::endPaint(const QRegion ®ion) +void QXlibWindowSurface::endPaint(const QRegion ®ion) { Q_UNUSED(region); painted = true; //there is content in the buffer diff --git a/src/plugins/platforms/testlite/qtestlitewindowsurface.h b/src/plugins/platforms/testlite/qtestlitewindowsurface.h index ca900e5..12b4c60 100644 --- a/src/plugins/platforms/testlite/qtestlitewindowsurface.h +++ b/src/plugins/platforms/testlite/qtestlitewindowsurface.h @@ -47,21 +47,19 @@ QT_BEGIN_NAMESPACE -class QTestLiteWindow; -class QTestLiteIntegration; -class QTestLiteScreen; -class MyShmImageInfo; +class QXlibWindow; +class QXlibIntegration; +class QXlibScreen; +class QXlibShmImageInfo; -class QTestLiteWindowSurface : public QWindowSurface +class QXlibWindowSurface : public QWindowSurface { public: - QTestLiteWindowSurface (QWidget *window); - ~QTestLiteWindowSurface(); + QXlibWindowSurface (QWidget *window); + ~QXlibWindowSurface(); QPaintDevice *paintDevice(); -// void flush(); void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); -// void resize(const QSize &size); bool scroll(const QRegion &area, int dx, int dy); void beginPaint(const QRegion ®ion); @@ -76,9 +74,9 @@ private: void resizeShmImage(int width, int height); QImage shm_img; - MyShmImageInfo *image_info; + QXlibShmImageInfo *image_info; - QTestLiteWindow *xw; + QXlibWindow *xw; }; -- cgit v0.12 From 98f2392e7278aea52f46b7e20f93dea1831e5704 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= Date: Mon, 14 Feb 2011 13:37:24 +0100 Subject: Lighthouse Moving testlite plugin into xlib --- src/plugins/platforms/testlite/main.cpp | 79 -- src/plugins/platforms/testlite/qglxintegration.cpp | 376 -------- src/plugins/platforms/testlite/qglxintegration.h | 94 -- .../platforms/testlite/qtestliteclipboard.cpp | 676 ------------- .../platforms/testlite/qtestliteclipboard.h | 94 -- src/plugins/platforms/testlite/qtestlitecursor.cpp | 199 ---- src/plugins/platforms/testlite/qtestlitecursor.h | 68 -- .../platforms/testlite/qtestliteeglintegration.cpp | 186 ---- .../platforms/testlite/qtestliteeglintegration.h | 54 -- .../platforms/testlite/qtestliteintegration.cpp | 156 --- .../platforms/testlite/qtestliteintegration.h | 85 -- .../platforms/testlite/qtestlitekeyboard.cpp | 1000 -------------------- src/plugins/platforms/testlite/qtestlitekeyboard.h | 76 -- src/plugins/platforms/testlite/qtestlitemime.cpp | 322 ------- src/plugins/platforms/testlite/qtestlitemime.h | 67 -- src/plugins/platforms/testlite/qtestlitescreen.cpp | 468 --------- src/plugins/platforms/testlite/qtestlitescreen.h | 104 -- .../platforms/testlite/qtestlitestaticinfo.cpp | 511 ---------- .../platforms/testlite/qtestlitestaticinfo.h | 413 -------- src/plugins/platforms/testlite/qtestlitewindow.cpp | 735 -------------- src/plugins/platforms/testlite/qtestlitewindow.h | 145 --- .../platforms/testlite/qtestlitewindowsurface.cpp | 224 ----- .../platforms/testlite/qtestlitewindowsurface.h | 86 -- src/plugins/platforms/testlite/testlite.pro | 57 -- src/plugins/platforms/xlib/main.cpp | 79 ++ src/plugins/platforms/xlib/qglxintegration.cpp | 376 ++++++++ src/plugins/platforms/xlib/qglxintegration.h | 94 ++ src/plugins/platforms/xlib/qtestliteclipboard.cpp | 676 +++++++++++++ src/plugins/platforms/xlib/qtestliteclipboard.h | 94 ++ src/plugins/platforms/xlib/qtestlitecursor.cpp | 199 ++++ src/plugins/platforms/xlib/qtestlitecursor.h | 68 ++ .../platforms/xlib/qtestliteeglintegration.cpp | 186 ++++ .../platforms/xlib/qtestliteeglintegration.h | 54 ++ .../platforms/xlib/qtestliteintegration.cpp | 156 +++ src/plugins/platforms/xlib/qtestliteintegration.h | 85 ++ src/plugins/platforms/xlib/qtestlitekeyboard.cpp | 1000 ++++++++++++++++++++ src/plugins/platforms/xlib/qtestlitekeyboard.h | 76 ++ src/plugins/platforms/xlib/qtestlitemime.cpp | 322 +++++++ src/plugins/platforms/xlib/qtestlitemime.h | 67 ++ src/plugins/platforms/xlib/qtestlitescreen.cpp | 468 +++++++++ src/plugins/platforms/xlib/qtestlitescreen.h | 104 ++ src/plugins/platforms/xlib/qtestlitestaticinfo.cpp | 511 ++++++++++ src/plugins/platforms/xlib/qtestlitestaticinfo.h | 413 ++++++++ src/plugins/platforms/xlib/qtestlitewindow.cpp | 735 ++++++++++++++ src/plugins/platforms/xlib/qtestlitewindow.h | 145 +++ .../platforms/xlib/qtestlitewindowsurface.cpp | 224 +++++ .../platforms/xlib/qtestlitewindowsurface.h | 86 ++ src/plugins/platforms/xlib/testlite.pro | 57 ++ 48 files changed, 6275 insertions(+), 6275 deletions(-) delete mode 100644 src/plugins/platforms/testlite/main.cpp delete mode 100644 src/plugins/platforms/testlite/qglxintegration.cpp delete mode 100644 src/plugins/platforms/testlite/qglxintegration.h delete mode 100644 src/plugins/platforms/testlite/qtestliteclipboard.cpp delete mode 100644 src/plugins/platforms/testlite/qtestliteclipboard.h delete mode 100644 src/plugins/platforms/testlite/qtestlitecursor.cpp delete mode 100644 src/plugins/platforms/testlite/qtestlitecursor.h delete mode 100644 src/plugins/platforms/testlite/qtestliteeglintegration.cpp delete mode 100644 src/plugins/platforms/testlite/qtestliteeglintegration.h delete mode 100644 src/plugins/platforms/testlite/qtestliteintegration.cpp delete mode 100644 src/plugins/platforms/testlite/qtestliteintegration.h delete mode 100644 src/plugins/platforms/testlite/qtestlitekeyboard.cpp delete mode 100644 src/plugins/platforms/testlite/qtestlitekeyboard.h delete mode 100644 src/plugins/platforms/testlite/qtestlitemime.cpp delete mode 100644 src/plugins/platforms/testlite/qtestlitemime.h delete mode 100644 src/plugins/platforms/testlite/qtestlitescreen.cpp delete mode 100644 src/plugins/platforms/testlite/qtestlitescreen.h delete mode 100644 src/plugins/platforms/testlite/qtestlitestaticinfo.cpp delete mode 100644 src/plugins/platforms/testlite/qtestlitestaticinfo.h delete mode 100644 src/plugins/platforms/testlite/qtestlitewindow.cpp delete mode 100644 src/plugins/platforms/testlite/qtestlitewindow.h delete mode 100644 src/plugins/platforms/testlite/qtestlitewindowsurface.cpp delete mode 100644 src/plugins/platforms/testlite/qtestlitewindowsurface.h delete mode 100644 src/plugins/platforms/testlite/testlite.pro create mode 100644 src/plugins/platforms/xlib/main.cpp create mode 100644 src/plugins/platforms/xlib/qglxintegration.cpp create mode 100644 src/plugins/platforms/xlib/qglxintegration.h create mode 100644 src/plugins/platforms/xlib/qtestliteclipboard.cpp create mode 100644 src/plugins/platforms/xlib/qtestliteclipboard.h create mode 100644 src/plugins/platforms/xlib/qtestlitecursor.cpp create mode 100644 src/plugins/platforms/xlib/qtestlitecursor.h create mode 100644 src/plugins/platforms/xlib/qtestliteeglintegration.cpp create mode 100644 src/plugins/platforms/xlib/qtestliteeglintegration.h create mode 100644 src/plugins/platforms/xlib/qtestliteintegration.cpp create mode 100644 src/plugins/platforms/xlib/qtestliteintegration.h create mode 100644 src/plugins/platforms/xlib/qtestlitekeyboard.cpp create mode 100644 src/plugins/platforms/xlib/qtestlitekeyboard.h create mode 100644 src/plugins/platforms/xlib/qtestlitemime.cpp create mode 100644 src/plugins/platforms/xlib/qtestlitemime.h create mode 100644 src/plugins/platforms/xlib/qtestlitescreen.cpp create mode 100644 src/plugins/platforms/xlib/qtestlitescreen.h create mode 100644 src/plugins/platforms/xlib/qtestlitestaticinfo.cpp create mode 100644 src/plugins/platforms/xlib/qtestlitestaticinfo.h create mode 100644 src/plugins/platforms/xlib/qtestlitewindow.cpp create mode 100644 src/plugins/platforms/xlib/qtestlitewindow.h create mode 100644 src/plugins/platforms/xlib/qtestlitewindowsurface.cpp create mode 100644 src/plugins/platforms/xlib/qtestlitewindowsurface.h create mode 100644 src/plugins/platforms/xlib/testlite.pro diff --git a/src/plugins/platforms/testlite/main.cpp b/src/plugins/platforms/testlite/main.cpp deleted file mode 100644 index 131d399..0000000 --- a/src/plugins/platforms/testlite/main.cpp +++ /dev/null @@ -1,79 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include "qtestliteintegration.h" - -QT_BEGIN_NAMESPACE - -class QXlibIntegrationPlugin : public QPlatformIntegrationPlugin -{ -public: - QStringList keys() const; - QPlatformIntegration *create(const QString&, const QStringList&); -}; - -QStringList QXlibIntegrationPlugin::keys() const -{ - QStringList list; - list << "Xlib"; -#ifndef QT_NO_OPENGL - list << "XlibGL"; -#endif - return list; -} - -QPlatformIntegration* QXlibIntegrationPlugin::create(const QString& system, const QStringList& paramList) -{ - Q_UNUSED(paramList); - if (system.toLower() == "xlib") - return new QXlibIntegration; -#ifndef QT_NO_OPENGL - if (system.toLower() == "xlibgl") - return new QXlibIntegration(true); -#endif - - return 0; -} - -Q_EXPORT_PLUGIN2(xlib, QXlibIntegrationPlugin) - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qglxintegration.cpp b/src/plugins/platforms/testlite/qglxintegration.cpp deleted file mode 100644 index 46dfef9..0000000 --- a/src/plugins/platforms/testlite/qglxintegration.cpp +++ /dev/null @@ -1,376 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include -#include -#include - -#include "qtestlitewindow.h" -#include "qtestlitescreen.h" - -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) -#include -#include -#include - -#include "qglxintegration.h" - -#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) -#include -#endif - -QT_BEGIN_NAMESPACE - -QMutex QGLXContext::m_defaultSharedContextMutex(QMutex::Recursive); - -QVector QGLXContext::buildSpec(const QPlatformWindowFormat &format) -{ - QVector spec(48); - int i = 0; - - spec[i++] = GLX_LEVEL; - spec[i++] = 0; - spec[i++] = GLX_DRAWABLE_TYPE; spec[i++] = GLX_WINDOW_BIT; - - if (format.rgba()) { - spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_RGBA_BIT; - spec[i++] = GLX_RED_SIZE; spec[i++] = (format.redBufferSize() == -1) ? 1 : format.redBufferSize(); - spec[i++] = GLX_GREEN_SIZE; spec[i++] = (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize(); - spec[i++] = GLX_BLUE_SIZE; spec[i++] = (format.blueBufferSize() == -1) ? 1 : format.blueBufferSize(); - if (format.alpha()) { - spec[i++] = GLX_ALPHA_SIZE; spec[i++] = (format.alphaBufferSize() == -1) ? 1 : format.alphaBufferSize(); - } - - spec[i++] = GLX_ACCUM_RED_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); - spec[i++] = GLX_ACCUM_GREEN_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); - spec[i++] = GLX_ACCUM_BLUE_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); - - if (format.alpha()) { - spec[i++] = GLX_ACCUM_ALPHA_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); - } - - } else { - spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_COLOR_INDEX_BIT; //I'm really not sure if this works.... - spec[i++] = GLX_BUFFER_SIZE; spec[i++] = 8; - } - - spec[i++] = GLX_DOUBLEBUFFER; spec[i++] = format.doubleBuffer() ? True : False; - spec[i++] = GLX_STEREO; spec[i++] = format.stereo() ? True : False; - - if (format.depth()) { - spec[i++] = GLX_DEPTH_SIZE; spec[i++] = (format.depthBufferSize() == -1) ? 1 : format.depthBufferSize(); - } - - if (format.stencil()) { - spec[i++] = GLX_STENCIL_SIZE; spec[i++] = (format.stencilBufferSize() == -1) ? 1 : format.stencilBufferSize(); - } - if (format.sampleBuffers()) { - spec[i++] = GLX_SAMPLE_BUFFERS_ARB; - spec[i++] = 1; - spec[i++] = GLX_SAMPLES_ARB; - spec[i++] = format.samples() == -1 ? 4 : format.samples(); - } - - spec[i++] = XNone; - return spec; -} - -GLXFBConfig QGLXContext::findConfig(const QXlibScreen *screen, const QPlatformWindowFormat &format) -{ - bool reduced = true; - GLXFBConfig chosenConfig = 0; - QPlatformWindowFormat reducedFormat = format; - while (!chosenConfig && reduced) { - QVector spec = buildSpec(reducedFormat); - int confcount = 0; - GLXFBConfig *configs; - configs = glXChooseFBConfig(screen->display(),screen->xScreenNumber(),spec.constData(),&confcount); - if (confcount) - { - for (int i = 0; i < confcount; i++) { - chosenConfig = configs[i]; - // Make sure we try to get an ARGB visual if the format asked for an alpha: - if (reducedFormat.alpha()) { - int alphaSize; - glXGetFBConfigAttrib(screen->display(),configs[i],GLX_ALPHA_SIZE,&alphaSize); - if (alphaSize > 0) - break; - } else { - break; // Just choose the first in the list if there's no alpha requested - } - } - - XFree(configs); - } - reducedFormat = reducePlatformWindowFormat(reducedFormat,&reduced); - } - - if (!chosenConfig) - qWarning("Warning no context created"); - - return chosenConfig; -} - -XVisualInfo *QGLXContext::findVisualInfo(const QXlibScreen *screen, const QPlatformWindowFormat &format) -{ - GLXFBConfig config = QGLXContext::findConfig(screen,format); - XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display(),config); - return visualInfo; -} - -QPlatformWindowFormat QGLXContext::platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext ctx) -{ - QPlatformWindowFormat format; - int redSize = 0; - int greenSize = 0; - int blueSize = 0; - int alphaSize = 0; - int depthSize = 0; - int stencilSize = 0; - int sampleBuffers = 0; - int sampleCount = 0; - int level = 0; - int rgba = 0; - int stereo = 0; - int accumSizeA = 0; - int accumSizeR = 0; - int accumSizeG = 0; - int accumSizeB = 0; - - XVisualInfo *vi = glXGetVisualFromFBConfig(display,config); - glXGetConfig(display,vi,GLX_RGBA,&rgba); - XFree(vi); - glXGetFBConfigAttrib(display, config, GLX_RED_SIZE, &redSize); - glXGetFBConfigAttrib(display, config, GLX_GREEN_SIZE, &greenSize); - glXGetFBConfigAttrib(display, config, GLX_BLUE_SIZE, &blueSize); - glXGetFBConfigAttrib(display, config, GLX_ALPHA_SIZE, &alphaSize); - glXGetFBConfigAttrib(display, config, GLX_DEPTH_SIZE, &depthSize); - glXGetFBConfigAttrib(display, config, GLX_STENCIL_SIZE, &stencilSize); - glXGetFBConfigAttrib(display, config, GLX_SAMPLES, &sampleBuffers); - glXGetFBConfigAttrib(display, config, GLX_LEVEL, &level); - glXGetFBConfigAttrib(display, config, GLX_STEREO, &stereo); - glXGetFBConfigAttrib(display, config, GLX_ACCUM_ALPHA_SIZE, &accumSizeA); - glXGetFBConfigAttrib(display, config, GLX_ACCUM_RED_SIZE, &accumSizeR); - glXGetFBConfigAttrib(display, config, GLX_ACCUM_GREEN_SIZE, &accumSizeG); - glXGetFBConfigAttrib(display, config, GLX_ACCUM_BLUE_SIZE, &accumSizeB); - - format.setRedBufferSize(redSize); - format.setGreenBufferSize(greenSize); - format.setBlueBufferSize(blueSize); - format.setAlphaBufferSize(alphaSize); - format.setDepthBufferSize(depthSize); - format.setStencilBufferSize(stencilSize); - format.setSampleBuffers(sampleBuffers); - if (format.sampleBuffers()) { - glXGetFBConfigAttrib(display, config, GLX_SAMPLES_ARB, &sampleCount); - format.setSamples(sampleCount); - } - - format.setDirectRendering(glXIsDirect(display, ctx)); - format.setRgba(rgba); - format.setStereo(stereo); - format.setAccumBufferSize(accumSizeB); - - return format; -} - -QPlatformWindowFormat QGLXContext::reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced) -{ - QPlatformWindowFormat retFormat = format; - *reduced = true; - - if (retFormat.sampleBuffers()) { - retFormat.setSampleBuffers(false); - } else if (retFormat.stereo()) { - retFormat.setStereo(false); - } else if (retFormat.accum()) { - retFormat.setAccum(false); - }else if (retFormat.stencil()) { - retFormat.setStencil(false); - }else if (retFormat.alpha()) { - retFormat.setAlpha(false); - }else if (retFormat.depth()) { - retFormat.setDepth(false); - }else if (retFormat.doubleBuffer()) { - retFormat.setDoubleBuffer(false); - }else{ - *reduced = false; - } - return retFormat; -} - -QGLXContext::QGLXContext(Window window, QXlibScreen *screen, const QPlatformWindowFormat &format) - : QPlatformGLContext() - , m_screen(screen) - , m_drawable((Drawable)window) - , m_context(0) -{ - - const QPlatformGLContext *sharePlatformContext; - if (format.useDefaultSharedContext()) { - if (!QPlatformGLContext::defaultSharedContext()) { - if (m_defaultSharedContextMutex.tryLock()){ - createDefaultSharedContex(screen); - m_defaultSharedContextMutex.unlock(); - } else { - m_defaultSharedContextMutex.lock(); //wait to the the shared context is created - m_defaultSharedContextMutex.unlock(); - } - } - sharePlatformContext = QPlatformGLContext::defaultSharedContext(); - } else { - sharePlatformContext = format.sharedGLContext(); - } - GLXContext shareGlxContext = 0; - if (sharePlatformContext) - shareGlxContext = static_cast(sharePlatformContext)->glxContext(); - - GLXFBConfig config = findConfig(screen,format); - m_context = glXCreateNewContext(screen->display(),config,GLX_RGBA_TYPE,shareGlxContext,TRUE); - m_windowFormat = QGLXContext::platformWindowFromGLXFBConfig(screen->display(),config,m_context); - -#ifdef MYX11_DEBUG - qDebug() << "QGLXGLContext::create context" << m_context; -#endif -} - -QGLXContext::QGLXContext(QXlibScreen *screen, Drawable drawable, GLXContext context) - : QPlatformGLContext(), m_screen(screen), m_drawable(drawable), m_context(context) -{ - -} - -QGLXContext::~QGLXContext() -{ - if (m_context) { - qDebug("Destroying GLX context 0x%p", m_context); - glXDestroyContext(m_screen->display(), m_context); - } -} - -void QGLXContext::createDefaultSharedContex(QXlibScreen *screen) -{ - int x = 0; - int y = 0; - int w = 3; - int h = 3; - - QPlatformWindowFormat format = QPlatformWindowFormat::defaultFormat(); - GLXContext context; - GLXFBConfig config = findConfig(screen,format); - if (config) { - XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display(),config); - Colormap cmap = XCreateColormap(screen->display(),screen->rootWindow(),visualInfo->visual,AllocNone); - XSetWindowAttributes a; - a.colormap = cmap; - Window sharedWindow = XCreateWindow(screen->display(), screen->rootWindow(),x, y, w, h, - 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWColormap, &a); - - context = glXCreateNewContext(screen->display(),config,GLX_RGBA_TYPE,0,TRUE); - QPlatformGLContext *sharedContext = new QGLXContext(screen,sharedWindow,context); - QPlatformGLContext::setDefaultSharedContext(sharedContext); - } else { - qWarning("Warning no shared context created"); - } -} - -void QGLXContext::makeCurrent() -{ - QPlatformGLContext::makeCurrent(); -#ifdef MYX11_DEBUG - qDebug("QGLXGLContext::makeCurrent(window=0x%x, ctx=0x%x)", m_drawable, m_context); -#endif - glXMakeCurrent(m_screen->display(), m_drawable, m_context); -} - -void QGLXContext::doneCurrent() -{ - QPlatformGLContext::doneCurrent(); - glXMakeCurrent(m_screen->display(), 0, 0); -} - -void QGLXContext::swapBuffers() -{ - glXSwapBuffers(m_screen->display(), m_drawable); -} - -void* QGLXContext::getProcAddress(const QString& procName) -{ - typedef void *(*qt_glXGetProcAddressARB)(const GLubyte *); - static qt_glXGetProcAddressARB glXGetProcAddressARB = 0; - static bool resolved = false; - - if (resolved && !glXGetProcAddressARB) - return 0; - if (!glXGetProcAddressARB) { - QList glxExt = QByteArray(glXGetClientString(m_screen->display(), GLX_EXTENSIONS)).split(' '); - if (glxExt.contains("GLX_ARB_get_proc_address")) { -#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) - void *handle = dlopen(NULL, RTLD_LAZY); - if (handle) { - glXGetProcAddressARB = (qt_glXGetProcAddressARB) dlsym(handle, "glXGetProcAddressARB"); - dlclose(handle); - } - if (!glXGetProcAddressARB) -#endif - { - extern const QString qt_gl_library_name(); -// QLibrary lib(qt_gl_library_name()); - QLibrary lib(QLatin1String("GL")); - glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB"); - } - } - resolved = true; - } - if (!glXGetProcAddressARB) - return 0; - return glXGetProcAddressARB(reinterpret_cast(procName.toLatin1().data())); -} - -QPlatformWindowFormat QGLXContext::platformWindowFormat() const -{ - return m_windowFormat; -} - -QT_END_NAMESPACE - -#endif //!defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) diff --git a/src/plugins/platforms/testlite/qglxintegration.h b/src/plugins/platforms/testlite/qglxintegration.h deleted file mode 100644 index f982708..0000000 --- a/src/plugins/platforms/testlite/qglxintegration.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef Q_GLX_CONTEXT_H -#define Q_GLX_CONTEXT_H - -#include "qtestlitewindow.h" - -#include -#include - -#include - -#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) -#include - -QT_BEGIN_NAMESPACE - -class QGLXContext : public QPlatformGLContext -{ -public: - QGLXContext(Window window, QXlibScreen *xd, const QPlatformWindowFormat &format); - ~QGLXContext(); - - virtual void makeCurrent(); - virtual void doneCurrent(); - virtual void swapBuffers(); - virtual void* getProcAddress(const QString& procName); - - GLXContext glxContext() const {return m_context;} - - QPlatformWindowFormat platformWindowFormat() const; - - static XVisualInfo *findVisualInfo(const QXlibScreen *xd, const QPlatformWindowFormat &format); -private: - static GLXFBConfig findConfig(const QXlibScreen *xd,const QPlatformWindowFormat &format); - static QVector buildSpec(const QPlatformWindowFormat &format); - static QPlatformWindowFormat platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context); - static QPlatformWindowFormat reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced); - - - QXlibScreen *m_screen; - Drawable m_drawable; - GLXContext m_context; - QPlatformWindowFormat m_windowFormat; - - QGLXContext (QXlibScreen *screen, Drawable drawable, GLXContext context); - static QMutex m_defaultSharedContextMutex; - static void createDefaultSharedContex(QXlibScreen *xd); -}; - -QT_END_NAMESPACE - -#endif //!defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) - -#endif diff --git a/src/plugins/platforms/testlite/qtestliteclipboard.cpp b/src/plugins/platforms/testlite/qtestliteclipboard.cpp deleted file mode 100644 index 1264b5a..0000000 --- a/src/plugins/platforms/testlite/qtestliteclipboard.cpp +++ /dev/null @@ -1,676 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestliteclipboard.h" - -#include "qtestlitescreen.h" -#include "qtestlitemime.h" - -#include - -#include - -class QXlibClipboardMime : public QXlibMime -{ - Q_OBJECT -public: - QXlibClipboardMime(QClipboard::Mode mode, QXlibClipboard *clipboard) - : QXlibMime() - , m_clipboard(clipboard) - { - switch (mode) { - case QClipboard::Selection: - modeAtom = XA_PRIMARY; - break; - - case QClipboard::Clipboard: - modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); - break; - - default: - qWarning("QTestLiteMime: Internal error: Unsupported clipboard mode"); - break; - } - } - -protected: - QStringList formats_sys() const - { - if (empty()) - return QStringList(); - - if (!formatList.count()) { - QXlibClipboardMime *that = const_cast(this); - // get the list of targets from the current clipboard owner - we do this - // once so that multiple calls to this function don't require multiple - // server round trips... - that->format_atoms = m_clipboard->getDataInFormat(modeAtom,QXlibStatic::atom(QXlibStatic::TARGETS)); - - if (format_atoms.size() > 0) { - Atom *targets = (Atom *) format_atoms.data(); - int size = format_atoms.size() / sizeof(Atom); - - for (int i = 0; i < size; ++i) { - if (targets[i] == 0) - continue; - - QStringList formatsForAtom = mimeFormatsForAtom(m_clipboard->screen()->display(),targets[i]); - for (int j = 0; j < formatsForAtom.size(); ++j) { - if (!formatList.contains(formatsForAtom.at(j))) - that->formatList.append(formatsForAtom.at(j)); - } - } - } - } - - return formatList; - } - - bool hasFormat_sys(const QString &format) const - { - QStringList list = formats(); - return list.contains(format); - } - - QVariant retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const - { - if (fmt.isEmpty() || empty()) - return QByteArray(); - - (void)formats(); // trigger update of format list - - QList atoms; - Atom *targets = (Atom *) format_atoms.data(); - int size = format_atoms.size() / sizeof(Atom); - for (int i = 0; i < size; ++i) - atoms.append(targets[i]); - - QByteArray encoding; - Atom fmtatom = mimeAtomForFormat(m_clipboard->screen()->display(),fmt, requestedType, atoms, &encoding); - - if (fmtatom == 0) - return QVariant(); - - return mimeConvertToFormat(m_clipboard->screen()->display(),fmtatom, m_clipboard->getDataInFormat(modeAtom,fmtatom), fmt, requestedType, encoding); - } -private: - bool empty() const - { - Window win = XGetSelectionOwner(m_clipboard->screen()->display(), modeAtom); - - return win == XNone; - } - - - Atom modeAtom; - QXlibClipboard *m_clipboard; - QStringList formatList; - QByteArray format_atoms; -}; - -const int QXlibClipboard::clipboard_timeout = 5000; - -QXlibClipboard::QXlibClipboard(QXlibScreen *screen) - : QPlatformClipboard() - , m_screen(screen) - , m_xClipboard(0) - , m_clientClipboard(0) - , m_xSelection(0) - , m_clientSelection(0) - , m_requestor(XNone) - , m_owner(XNone) -{ -} - -const QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) const -{ - if (mode == QClipboard::Clipboard) { - if (!m_xClipboard) { - QXlibClipboard *that = const_cast(this); - that->m_xClipboard = new QXlibClipboardMime(mode,that); - } - Window clipboardOwner = XGetSelectionOwner(screen()->display(),QXlibStatic::atom(QXlibStatic::CLIPBOARD)); - if (clipboardOwner == owner()) { - return m_clientClipboard; - } else { - return m_xClipboard; - } - } else if (mode == QClipboard::Selection) { - if (!m_xSelection) { - QXlibClipboard *that = const_cast(this); - that->m_xSelection = new QXlibClipboardMime(mode,that); - } - Window clipboardOwner = XGetSelectionOwner(screen()->display(),XA_PRIMARY); - if (clipboardOwner == owner()) { - return m_clientSelection; - } else { - return m_xSelection; - } - } - return 0; -} - -void QXlibClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) -{ - Atom modeAtom; - QMimeData **d; - switch (mode) { - case QClipboard::Selection: - modeAtom = XA_PRIMARY; - d = &m_clientSelection; - break; - - case QClipboard::Clipboard: - modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); - d = &m_clientClipboard; - break; - - default: - qWarning("QClipboard::setMimeData: unsupported mode '%d'", mode); - return; - } - - Window newOwner; - - if (! data) { // no data, clear clipboard contents - newOwner = XNone; - } else { - newOwner = owner(); - - *d = data; - } - - XSetSelectionOwner(m_screen->display(), modeAtom, newOwner, CurrentTime); - - if (XGetSelectionOwner(m_screen->display(), modeAtom) != newOwner) { - qWarning("QClipboard::setData: Cannot set X11 selection owner"); - } - -} - -bool QXlibClipboard::supportsMode(QClipboard::Mode mode) const -{ - if (mode == QClipboard::Clipboard || mode == QClipboard::Selection) - return true; - return false; -} - - -QXlibScreen * QXlibClipboard::screen() const -{ - return m_screen; -} - -Window QXlibClipboard::requestor() const -{ - if (!m_requestor) { - int x = 0, y = 0, w = 3, h = 3; - QXlibClipboard *that = const_cast(this); - Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), - x, y, w, h, 0 /*border_width*/, - m_screen->blackPixel(), m_screen->whitePixel()); - that->setRequestor(window); - } - return m_requestor; -} - -void QXlibClipboard::setRequestor(Window window) -{ - if (m_requestor != XNone) { - XDestroyWindow(m_screen->display(),m_requestor); - } - m_requestor = window; -} - -Window QXlibClipboard::owner() const -{ - if (!m_owner) { - int x = 0, y = 0, w = 3, h = 3; - QXlibClipboard *that = const_cast(this); - Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), - x, y, w, h, 0 /*border_width*/, - m_screen->blackPixel(), m_screen->whitePixel()); - that->setOwner(window); - } - return m_owner; -} - -void QXlibClipboard::setOwner(Window window) -{ - if (m_owner != XNone){ - XDestroyWindow(m_screen->display(),m_owner); - } - m_owner = window; -} - -Atom QXlibClipboard::sendTargetsSelection(QMimeData *d, Window window, Atom property) -{ - QVector types; - QStringList formats = QInternalMimeData::formatsHelper(d); - for (int i = 0; i < formats.size(); ++i) { - QList atoms = QXlibMime::mimeAtomsForFormat(screen()->display(),formats.at(i)); - for (int j = 0; j < atoms.size(); ++j) { - if (!types.contains(atoms.at(j))) - types.append(atoms.at(j)); - } - } - types.append(QXlibStatic::atom(QXlibStatic::TARGETS)); - types.append(QXlibStatic::atom(QXlibStatic::MULTIPLE)); - types.append(QXlibStatic::atom(QXlibStatic::TIMESTAMP)); - types.append(QXlibStatic::atom(QXlibStatic::SAVE_TARGETS)); - - XChangeProperty(screen()->display(), window, property, XA_ATOM, 32, - PropModeReplace, (uchar *) types.data(), types.size()); - return property; -} - -Atom QXlibClipboard::sendSelection(QMimeData *d, Atom target, Window window, Atom property) -{ - Atom atomFormat = target; - int dataFormat = 0; - QByteArray data; - - QString fmt = QXlibMime::mimeAtomToString(screen()->display(), target); - if (fmt.isEmpty()) { // Not a MIME type we have - qDebug() << "QClipboard: send_selection(): converting to type '%s' is not supported" << fmt.data(); - return XNone; - } - qDebug() << "QClipboard: send_selection(): converting to type '%s'" << fmt.data(); - - if (QXlibMime::mimeDataForAtom(screen()->display(),target, d, &data, &atomFormat, &dataFormat)) { - - // don't allow INCR transfers when using MULTIPLE or to - // Motif clients (since Motif doesn't support INCR) - static Atom motif_clip_temporary = QXlibStatic::atom(QXlibStatic::CLIP_TEMPORARY); - bool allow_incr = property != motif_clip_temporary; - - // X_ChangeProperty protocol request is 24 bytes - const int increment = (XMaxRequestSize(screen()->display()) * 4) - 24; - if (data.size() > increment && allow_incr) { - long bytes = data.size(); - XChangeProperty(screen()->display(), window, property, - QXlibStatic::atom(QXlibStatic::INCR), 32, PropModeReplace, (uchar *) &bytes, 1); - -// (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment); - qDebug() << "not implemented INCRT just YET!"; - return property; - } - - // make sure we can perform the XChangeProperty in a single request - if (data.size() > increment) - return XNone; // ### perhaps use several XChangeProperty calls w/ PropModeAppend? - int dataSize = data.size() / (dataFormat / 8); - // use a single request to transfer data - XChangeProperty(screen()->display(), window, property, atomFormat, - dataFormat, PropModeReplace, (uchar *) data.data(), - dataSize); - } - return property; -} - -void QXlibClipboard::handleSelectionRequest(XEvent *xevent) -{ - XSelectionRequestEvent *req = &xevent->xselectionrequest; - - if (requestor() && req->requestor == requestor()) { - qDebug() << "This should be caught before"; - return; - } - - XEvent event; - event.xselection.type = SelectionNotify; - event.xselection.display = req->display; - event.xselection.requestor = req->requestor; - event.xselection.selection = req->selection; - event.xselection.target = req->target; - event.xselection.property = XNone; - event.xselection.time = req->time; - - QMimeData *d; - if (req->selection == XA_PRIMARY) { - d = m_clientSelection; - } else if (req->selection == QXlibStatic::atom(QXlibStatic::CLIPBOARD)) { - d = m_clientClipboard; - } else { - qWarning("QClipboard: Unknown selection '%lx'", req->selection); - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); - return; - } - - if (!d) { - qWarning("QClipboard: Cannot transfer data, no data available"); - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); - return; - } - - Atom xa_targets = QXlibStatic::atom(QXlibStatic::TARGETS); - Atom xa_multiple = QXlibStatic::atom(QXlibStatic::MULTIPLE); - Atom xa_timestamp = QXlibStatic::atom(QXlibStatic::TIMESTAMP); - - struct AtomPair { Atom target; Atom property; } *multi = 0; - Atom multi_type = XNone; - int multi_format = 0; - int nmulti = 0; - int imulti = -1; - bool multi_writeback = false; - - if (req->target == xa_multiple) { - QByteArray multi_data; - if (req->property == XNone - || !clipboardReadProperty(req->requestor, req->property, false, &multi_data, - 0, &multi_type, &multi_format) - || multi_format != 32) { - // MULTIPLE property not formatted correctly - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); - return; - } - nmulti = multi_data.size()/sizeof(*multi); - multi = new AtomPair[nmulti]; - memcpy(multi,multi_data.data(),multi_data.size()); - imulti = 0; - } - - for (; imulti < nmulti; ++imulti) { - Atom target; - Atom property; - - if (multi) { - target = multi[imulti].target; - property = multi[imulti].property; - } else { - target = req->target; - property = req->property; - if (property == XNone) // obsolete client - property = target; - } - - Atom ret = XNone; - if (target == XNone || property == XNone) { - ; - } else if (target == xa_timestamp) { -// if (d->timestamp != CurrentTime) { -// XChangeProperty(screen()->display(), req->requestor, property, XA_INTEGER, 32, -// PropModeReplace, CurrentTime, 1); -// ret = property; -// } else { -// qWarning("QClipboard: Invalid data timestamp"); -// } - } else if (target == xa_targets) { - ret = sendTargetsSelection(d, req->requestor, property); - } else { - ret = sendSelection(d, target, req->requestor, property); - } - - if (nmulti > 0) { - if (ret == XNone) { - multi[imulti].property = XNone; - multi_writeback = true; - } - } else { - event.xselection.property = ret; - break; - } - } - - if (nmulti > 0) { - if (multi_writeback) { - // according to ICCCM 2.6.2 says to put None back - // into the original property on the requestor window - XChangeProperty(screen()->display(), req->requestor, req->property, multi_type, 32, - PropModeReplace, (uchar *) multi, nmulti * 2); - } - - delete [] multi; - event.xselection.property = req->property; - } - - // send selection notify to requestor - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); -} - -static inline int maxSelectionIncr(Display *dpy) -{ return XMaxRequestSize(dpy) > 65536 ? 65536*4 : XMaxRequestSize(dpy)*4 - 100; } - -bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const -{ - int maxsize = maxSelectionIncr(screen()->display()); - ulong bytes_left; // bytes_after - ulong length; // nitems - uchar *data; - Atom dummy_type; - int dummy_format; - int r; - - if (!type) // allow null args - type = &dummy_type; - if (!format) - format = &dummy_format; - - // Don't read anything, just get the size of the property data - r = XGetWindowProperty(screen()->display(), win, property, 0, 0, False, - AnyPropertyType, type, format, - &length, &bytes_left, &data); - if (r != Success || (type && *type == XNone)) { - buffer->resize(0); - return false; - } - XFree((char*)data); - - int offset = 0, buffer_offset = 0, format_inc = 1, proplen = bytes_left; - - switch (*format) { - case 8: - default: - format_inc = sizeof(char) / 1; - break; - - case 16: - format_inc = sizeof(short) / 2; - proplen *= sizeof(short) / 2; - break; - - case 32: - format_inc = sizeof(long) / 4; - proplen *= sizeof(long) / 4; - break; - } - - int newSize = proplen; - buffer->resize(newSize); - - bool ok = (buffer->size() == newSize); - - if (ok && newSize) { - // could allocate buffer - - while (bytes_left) { - // more to read... - - r = XGetWindowProperty(screen()->display(), win, property, offset, maxsize/4, - False, AnyPropertyType, type, format, - &length, &bytes_left, &data); - if (r != Success || (type && *type == XNone)) - break; - - offset += length / (32 / *format); - length *= format_inc * (*format) / 8; - - // Here we check if we get a buffer overflow and tries to - // recover -- this shouldn't normally happen, but it doesn't - // hurt to be defensive - if ((int)(buffer_offset + length) > buffer->size()) { - length = buffer->size() - buffer_offset; - - // escape loop - bytes_left = 0; - } - - memcpy(buffer->data() + buffer_offset, data, length); - buffer_offset += length; - - XFree((char*)data); - } - - if (*format == 8 && *type == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { - // convert COMPOUND_TEXT to a multibyte string - XTextProperty textprop; - textprop.encoding = *type; - textprop.format = *format; - textprop.nitems = buffer_offset; - textprop.value = (unsigned char *) buffer->data(); - - char **list_ret = 0; - int count; - if (XmbTextPropertyToTextList(screen()->display(), &textprop, &list_ret, - &count) == Success && count && list_ret) { - offset = buffer_offset = strlen(list_ret[0]); - buffer->resize(offset); - memcpy(buffer->data(), list_ret[0], offset); - } - if (list_ret) XFreeStringList(list_ret); - } - } - - // correct size, not 0-term. - if (size) - *size = buffer_offset; - - if (deleteProperty) - XDeleteProperty(screen()->display(), win, property); - - XFlush(screen()->display()); - - return ok; -} - -QByteArray QXlibClipboard::clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm) -{ - XEvent event; - - QByteArray buf; - QByteArray tmp_buf; - bool alloc_error = false; - int length; - int offset = 0; - - if (nbytes > 0) { - // Reserve buffer + zero-terminator (for text data) - // We want to complete the INCR transfer even if we cannot - // allocate more memory - buf.resize(nbytes+1); - alloc_error = buf.size() != nbytes+1; - } - - for (;;) { - XFlush(screen()->display()); - if (!screen()->waitForClipboardEvent(win,PropertyNotify,&event,clipboard_timeout)) - break; - if (event.xproperty.atom != property || - event.xproperty.state != PropertyNewValue) - continue; - if (clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0)) { - if (length == 0) { // no more data, we're done - if (nullterm) { - buf.resize(offset+1); - buf[offset] = '\0'; - } else { - buf.resize(offset); - } - return buf; - } else if (!alloc_error) { - if (offset+length > (int)buf.size()) { - buf.resize(offset+length+65535); - if (buf.size() != offset+length+65535) { - alloc_error = true; - length = buf.size() - offset; - } - } - memcpy(buf.data()+offset, tmp_buf.constData(), length); - tmp_buf.resize(0); - offset += length; - } - } else { - break; - } - } - - // timed out ... create a new requestor window, otherwise the requestor - // could consider next request to be still part of this timed out request - setRequestor(0); - - return QByteArray(); -} - -QByteArray QXlibClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) -{ - QByteArray buf; - - Window win = requestor(); - - XSelectInput(screen()->display(), win, NoEventMask); // don't listen for any events - - XDeleteProperty(screen()->display(), win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION)); - XConvertSelection(screen()->display(), modeAtom, fmtatom, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), win, CurrentTime); - XSync(screen()->display(), false); - - XEvent xevent; - if (!screen()->waitForClipboardEvent(win,SelectionNotify,&xevent,clipboard_timeout) || - xevent.xselection.property == XNone) { - return buf; - } - - Atom type; - XSelectInput(screen()->display(), win, PropertyChangeMask); - - if (clipboardReadProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), true, &buf, 0, &type, 0)) { - if (type == QXlibStatic::atom(QXlibStatic::INCR)) { - int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0; - buf = clipboardReadIncrementalProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), nbytes, false); - } - } - - XSelectInput(screen()->display(), win, NoEventMask); - - - return buf; -} - -#include "qtestliteclipboard.moc" diff --git a/src/plugins/platforms/testlite/qtestliteclipboard.h b/src/plugins/platforms/testlite/qtestliteclipboard.h deleted file mode 100644 index 109714c..0000000 --- a/src/plugins/platforms/testlite/qtestliteclipboard.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITECLIPBOARD_H -#define QTESTLITECLIPBOARD_H - -#include -#include "qtestlitestaticinfo.h" - -class QXlibScreen; -class QXlibClipboard : public QPlatformClipboard -{ -public: - QXlibClipboard(QXlibScreen *screen); - - const QMimeData *mimeData(QClipboard::Mode mode) const; - void setMimeData(QMimeData *data, QClipboard::Mode mode); - - bool supportsMode(QClipboard::Mode mode) const; - - QXlibScreen *screen() const; - - Window requestor() const; - void setRequestor(Window window); - - Window owner() const; - - void handleSelectionRequest(XEvent *event); - - bool clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const; - QByteArray clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm); - - QByteArray getDataInFormat(Atom modeAtom, Atom fmtatom); - -private: - void setOwner(Window window); - - Atom sendTargetsSelection(QMimeData *d, Window window, Atom property); - Atom sendSelection(QMimeData *d, Atom target, Window window, Atom property); - - QXlibScreen *m_screen; - - QMimeData *m_xClipboard; - QMimeData *m_clientClipboard; - - QMimeData *m_xSelection; - QMimeData *m_clientSelection; - - Window m_requestor; - Window m_owner; - - static const int clipboard_timeout; - -}; - -#endif // QTESTLITECLIPBOARD_H diff --git a/src/plugins/platforms/testlite/qtestlitecursor.cpp b/src/plugins/platforms/testlite/qtestlitecursor.cpp deleted file mode 100644 index 2f7cfbf..0000000 --- a/src/plugins/platforms/testlite/qtestlitecursor.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitecursor.h" - -#include "qtestliteintegration.h" -#include "qtestlitescreen.h" -#include "qtestlitewindow.h" - -#include - -#include - -QT_BEGIN_NAMESPACE - -QXlibCursor::QXlibCursor(QXlibScreen *screen) - : QPlatformCursor(screen) -{ -} - -void QXlibCursor::changeCursor(QCursor *cursor, QWidget *widget) -{ - QXlibWindow *w = 0; - if (widget) { - QWidget *window = widget->window(); - w = static_cast(window->platformWindow()); - } else { - // No X11 cursor control when there is no widget under the cursor - return; - } - - if (!w) - return; - - int id = cursor->handle(); - - Cursor c; - if (!cursorMap.contains(id)) { - if (cursor->shape() == Qt::BitmapCursor) - c = createCursorBitmap(cursor); - else - c = createCursorShape(cursor->shape()); - if (!c) { - return; - } - cursorMap.insert(id, c); - } else { - c = cursorMap.value(id); - } - - w->setCursor(c); -} - -Cursor QXlibCursor::createCursorBitmap(QCursor * cursor) -{ - XColor bg, fg; - bg.red = 255 << 8; - bg.green = 255 << 8; - bg.blue = 255 << 8; - fg.red = 0; - fg.green = 0; - fg.blue = 0; - QPoint spot = cursor->hotSpot(); - Window rootwin = testLiteScreen()->rootWindow(); - - QImage mapImage = cursor->bitmap()->toImage().convertToFormat(QImage::Format_MonoLSB); - QImage maskImage = cursor->mask()->toImage().convertToFormat(QImage::Format_MonoLSB); - - int width = cursor->bitmap()->width(); - int height = cursor->bitmap()->height(); - int bytesPerLine = mapImage.bytesPerLine(); - int destLineSize = width / 8; - if (width % 8) - destLineSize++; - - const uchar * map = mapImage.bits(); - const uchar * mask = maskImage.bits(); - - char * mapBits = new char[height * destLineSize]; - char * maskBits = new char[height * destLineSize]; - for (int i = 0; i < height; i++) { - memcpy(mapBits + (destLineSize * i),map + (bytesPerLine * i), destLineSize); - memcpy(maskBits + (destLineSize * i),mask + (bytesPerLine * i), destLineSize); - } - - Pixmap cp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, mapBits, width, height); - Pixmap mp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, maskBits, width, height); - Cursor c = XCreatePixmapCursor(testLiteScreen()->display(), cp, mp, &fg, &bg, spot.x(), spot.y()); - XFreePixmap(testLiteScreen()->display(), cp); - XFreePixmap(testLiteScreen()->display(), mp); - delete[] mapBits; - delete[] maskBits; - - return c; -} - -Cursor QXlibCursor::createCursorShape(int cshape) -{ - Cursor cursor = 0; - - if (cshape < 0 || cshape > Qt::LastCursor) - return 0; - - switch (cshape) { - case Qt::ArrowCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_left_ptr); - break; - case Qt::UpArrowCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_center_ptr); - break; - case Qt::CrossCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_crosshair); - break; - case Qt::WaitCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); - break; - case Qt::IBeamCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_xterm); - break; - case Qt::SizeAllCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_fleur); - break; - case Qt::PointingHandCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_hand2); - break; - case Qt::SizeBDiagCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_top_right_corner); - break; - case Qt::SizeFDiagCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_bottom_right_corner); - break; - case Qt::SizeVerCursor: - case Qt::SplitVCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_v_double_arrow); - break; - case Qt::SizeHorCursor: - case Qt::SplitHCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_h_double_arrow); - break; - case Qt::WhatsThisCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_question_arrow); - break; - case Qt::ForbiddenCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_circle); - break; - case Qt::BusyCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); - break; - - default: //default cursor for all the rest - break; - } - return cursor; -} - -QXlibScreen * QXlibCursor::testLiteScreen() const -{ - return static_cast(screen); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitecursor.h b/src/plugins/platforms/testlite/qtestlitecursor.h deleted file mode 100644 index db9f9e2..0000000 --- a/src/plugins/platforms/testlite/qtestlitecursor.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITECURSOR_H -#define QTESTLITECURSOR_H - -#include - -#include "qtestliteintegration.h" - -QT_BEGIN_NAMESPACE - -class QXlibCursor : QPlatformCursor -{ -public: - QXlibCursor(QXlibScreen *screen); - - void changeCursor(QCursor * cursor, QWidget * widget); -private: - - Cursor createCursorBitmap(QCursor * cursor); - Cursor createCursorShape(int cshape); - - QXlibScreen *testLiteScreen() const; - QMap cursorMap; -}; - -QT_END_NAMESPACE - -#endif // QTESTLITECURSOR_H diff --git a/src/plugins/platforms/testlite/qtestliteeglintegration.cpp b/src/plugins/platforms/testlite/qtestliteeglintegration.cpp deleted file mode 100644 index 9bbe0ca..0000000 --- a/src/plugins/platforms/testlite/qtestliteeglintegration.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestliteeglintegration.h" - -static int countBits(unsigned long mask) -{ - int count = 0; - while (mask != 0) { - if (mask & 1) - ++count; - mask >>= 1; - } - return count; -} - -VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLConfig config) -{ - VisualID visualId = 0; - EGLint eglValue = 0; - - EGLDisplay eglDisplay = eglGetDisplay(display); - - EGLint configRedSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_RED_SIZE, &configRedSize); - - EGLint configGreenSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_GREEN_SIZE, &configGreenSize); - - EGLint configBlueSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_BLUE_SIZE, &configBlueSize); - - EGLint configAlphaSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_ALPHA_SIZE, &configAlphaSize); - - eglGetConfigAttrib(eglDisplay, config, EGL_CONFIG_ID, &eglValue); - int configId = eglValue; - - // See if EGL provided a valid VisualID: - eglGetConfigAttrib(eglDisplay, config, EGL_NATIVE_VISUAL_ID, &eglValue); - visualId = (VisualID)eglValue; - if (visualId) { - // EGL has suggested a visual id, so get the rest of the visual info for that id: - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - visualInfoTemplate.visualid = visualId; - - XVisualInfo *chosenVisualInfo; - int matchingCount = 0; - chosenVisualInfo = XGetVisualInfo(display, VisualIDMask, &visualInfoTemplate, &matchingCount); - if (chosenVisualInfo) { - // Skip size checks if implementation supports non-matching visual - // and config (http://bugreports.qt.nokia.com/browse/QTBUG-9444). - if (q_hasEglExtension(eglDisplay,"EGL_NV_post_convert_rounding")) { - XFree(chosenVisualInfo); - return visualId; - } - - int visualRedSize = countBits(chosenVisualInfo->red_mask); - int visualGreenSize = countBits(chosenVisualInfo->green_mask); - int visualBlueSize = countBits(chosenVisualInfo->blue_mask); - int visualAlphaSize = -1; // Need XRender to tell us the alpha channel size - - bool visualMatchesConfig = false; - if ( visualRedSize == configRedSize && - visualGreenSize == configGreenSize && - visualBlueSize == configBlueSize ) - { - // We need XRender to check the alpha channel size of the visual. If we don't have - // the alpha size, we don't check it against the EGL config's alpha size. - if (visualAlphaSize >= 0) - visualMatchesConfig = visualAlphaSize == configAlphaSize; - else - visualMatchesConfig = true; - } - - if (!visualMatchesConfig) { - if (visualAlphaSize >= 0) { - qWarning("Warning: EGL suggested using X Visual ID %d (ARGB%d%d%d%d) for EGL config %d (ARGB%d%d%d%d), but this is incompatable", - (int)visualId, visualAlphaSize, visualRedSize, visualGreenSize, visualBlueSize, - configId, configAlphaSize, configRedSize, configGreenSize, configBlueSize); - } else { - qWarning("Warning: EGL suggested using X Visual ID %d (RGB%d%d%d) for EGL config %d (RGB%d%d%d), but this is incompatable", - (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, - configId, configRedSize, configGreenSize, configBlueSize); - } - visualId = 0; - } - } else { - qWarning("Warning: EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", - (int)visualId, configId); - visualId = 0; - } - XFree(chosenVisualInfo); - } -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - else - qDebug("EGL did not suggest a VisualID (EGL_NATIVE_VISUAL_ID was zero) for EGLConfig %d", configId); -#endif - - if (visualId) { -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - if (configAlphaSize > 0) - qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, configId); - else - qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId); -#endif - return visualId; - } - - // Finally, try to - // use XGetVisualInfo and only use the bit depths to match on: - if (!visualId) { - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - XVisualInfo *matchingVisuals; - int matchingCount = 0; - - visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize + configAlphaSize; - matchingVisuals = XGetVisualInfo(display, - VisualDepthMask, - &visualInfoTemplate, - &matchingCount); - if (!matchingVisuals) { - // Try again without taking the alpha channel into account: - visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize; - matchingVisuals = XGetVisualInfo(display, - VisualDepthMask, - &visualInfoTemplate, - &matchingCount); - } - - if (matchingVisuals) { - visualId = matchingVisuals[0].visualid; - XFree(matchingVisuals); - } - } - - if (visualId) { -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, configId); -#endif - return visualId; - } - - qWarning("Unable to find an X11 visual which matches EGL config %d", configId); - return (VisualID)0; -} diff --git a/src/plugins/platforms/testlite/qtestliteeglintegration.h b/src/plugins/platforms/testlite/qtestliteeglintegration.h deleted file mode 100644 index 4c2e50d..0000000 --- a/src/plugins/platforms/testlite/qtestliteeglintegration.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITEEGLINTEGRATION_H -#define QTESTLITEEGLINTEGRATION_H - -#include "qtestlitestaticinfo.h" -#include "../eglconvenience/qeglconvenience.h" - -class QXlibEglIntegration -{ -public: - static VisualID getCompatibleVisualId(Display *display, EGLConfig config); -}; - -#endif // QTESTLITEEGLINTEGRATION_H diff --git a/src/plugins/platforms/testlite/qtestliteintegration.cpp b/src/plugins/platforms/testlite/qtestliteintegration.cpp deleted file mode 100644 index cdc5c29..0000000 --- a/src/plugins/platforms/testlite/qtestliteintegration.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestliteintegration.h" -#include "qtestlitewindowsurface.h" -#include -#include - -#include "qtestlitewindow.h" -#include "qgenericunixfontdatabase.h" -#include "qtestlitescreen.h" -#include "qtestliteclipboard.h" - -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) -#include -#else -#include -#endif //!defined(QT_OPENGL_ES_2) -#include -#include -#endif //QT_NO_OPENGL - -QT_BEGIN_NAMESPACE - -QXlibIntegration::QXlibIntegration(bool useOpenGL) - : mUseOpenGL(useOpenGL) - , mFontDb(new QGenericUnixFontDatabase()) - , mClipboard(0) -{ - mPrimaryScreen = new QXlibScreen(); - mScreens.append(mPrimaryScreen); -} - -QPixmapData *QXlibIntegration::createPixmapData(QPixmapData::PixelType type) const -{ -#ifndef QT_NO_OPENGL - if (mUseOpenGL) - return new QGLPixmapData(type); -#endif - return new QRasterPixmapData(type); -} - -QWindowSurface *QXlibIntegration::createWindowSurface(QWidget *widget, WId) const -{ -#ifndef QT_NO_OPENGL - if (mUseOpenGL) - return new QGLWindowSurface(widget); -#endif - return new QXlibWindowSurface(widget); -} - - -QPlatformWindow *QXlibIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const -{ - return new QXlibWindow(widget); -} - - - -QPixmap QXlibIntegration::grabWindow(WId window, int x, int y, int width, int height) const -{ - QImage image; - QWidget *widget = QWidget::find(window); - if (widget) { - QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); - image = screen->grabWindow(window,x,y,width,height); - } else { - for (int i = 0; i < mScreens.size(); i++) { - QXlibScreen *screen = static_cast(mScreens[i]); - if (screen->rootWindow() == window) { - image = screen->grabWindow(window,x,y,width,height); - } - } - } - return QPixmap::fromImage(image); -} - -QPlatformFontDatabase *QXlibIntegration::fontDatabase() const -{ - return mFontDb; -} - -QPlatformClipboard * QXlibIntegration::clipboard() const -{ - //Use lazy init since clipboard needs QTestliteScreen - if (!mClipboard) { - QXlibIntegration *that = const_cast(this); - that->mClipboard = new QXlibClipboard(mPrimaryScreen); - } - return mClipboard; -} - -bool QXlibIntegration::hasOpenGL() const -{ -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) - QXlibScreen *screen = static_cast(mScreens.at(0)); - return glXQueryExtension(screen->display(), 0, 0) != 0; -#else - static bool eglHasbeenInitialized = false; - static bool wasEglInitialized = false; - if (!eglHasbeenInitialized) { - eglHasbeenInitialized = true; - const QXlibScreen *screen = static_cast(mScreens.at(0)); - EGLint major, minor; - eglBindAPI(EGL_OPENGL_ES_API); - EGLDisplay disp = eglGetDisplay(screen->display()); - wasEglInitialized = eglInitialize(disp,&major,&minor); - } - return wasEglInitialized; -#endif -#endif - return false; -} - - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestliteintegration.h b/src/plugins/platforms/testlite/qtestliteintegration.h deleted file mode 100644 index c3125b8..0000000 --- a/src/plugins/platforms/testlite/qtestliteintegration.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_TESTLITE_H -#define QGRAPHICSSYSTEM_TESTLITE_H - -//make sure textstream is included before any X11 headers -#include - -#include -#include - -#include "qtestlitestaticinfo.h" - -QT_BEGIN_NAMESPACE - -class QXlibScreen; - -class QXlibIntegration : public QPlatformIntegration -{ -public: - QXlibIntegration(bool useOpenGL = false); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; - QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; - - QPixmap grabWindow(WId window, int x, int y, int width, int height) const; - - QList screens() const { return mScreens; } - - QPlatformFontDatabase *fontDatabase() const; - QPlatformClipboard *clipboard() const; - - bool hasOpenGL() const; - -private: - bool mUseOpenGL; - QXlibScreen *mPrimaryScreen; - QList mScreens; - QPlatformFontDatabase *mFontDb; - QPlatformClipboard *mClipboard; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/testlite/qtestlitekeyboard.cpp b/src/plugins/platforms/testlite/qtestlitekeyboard.cpp deleted file mode 100644 index fb0cf2e..0000000 --- a/src/plugins/platforms/testlite/qtestlitekeyboard.cpp +++ /dev/null @@ -1,1000 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitekeyboard.h" - -#include "qtestlitescreen.h" - -#include - -#include - -#ifndef XK_ISO_Left_Tab -#define XK_ISO_Left_Tab 0xFE20 -#endif - -#ifndef XK_dead_hook -#define XK_dead_hook 0xFE61 -#endif - -#ifndef XK_dead_horn -#define XK_dead_horn 0xFE62 -#endif - -#ifndef XK_Codeinput -#define XK_Codeinput 0xFF37 -#endif - -#ifndef XK_Kanji_Bangou -#define XK_Kanji_Bangou 0xFF37 /* same as codeinput */ -#endif - -// Fix old X libraries -#ifndef XK_KP_Home -#define XK_KP_Home 0xFF95 -#endif -#ifndef XK_KP_Left -#define XK_KP_Left 0xFF96 -#endif -#ifndef XK_KP_Up -#define XK_KP_Up 0xFF97 -#endif -#ifndef XK_KP_Right -#define XK_KP_Right 0xFF98 -#endif -#ifndef XK_KP_Down -#define XK_KP_Down 0xFF99 -#endif -#ifndef XK_KP_Prior -#define XK_KP_Prior 0xFF9A -#endif -#ifndef XK_KP_Next -#define XK_KP_Next 0xFF9B -#endif -#ifndef XK_KP_End -#define XK_KP_End 0xFF9C -#endif -#ifndef XK_KP_Insert -#define XK_KP_Insert 0xFF9E -#endif -#ifndef XK_KP_Delete -#define XK_KP_Delete 0xFF9F -#endif - -// the next lines are taken on 10/2009 from X.org (X11/XF86keysym.h), defining some special -// multimedia keys. They are included here as not every system has them. -#define XF86XK_MonBrightnessUp 0x1008FF02 -#define XF86XK_MonBrightnessDown 0x1008FF03 -#define XF86XK_KbdLightOnOff 0x1008FF04 -#define XF86XK_KbdBrightnessUp 0x1008FF05 -#define XF86XK_KbdBrightnessDown 0x1008FF06 -#define XF86XK_Standby 0x1008FF10 -#define XF86XK_AudioLowerVolume 0x1008FF11 -#define XF86XK_AudioMute 0x1008FF12 -#define XF86XK_AudioRaiseVolume 0x1008FF13 -#define XF86XK_AudioPlay 0x1008FF14 -#define XF86XK_AudioStop 0x1008FF15 -#define XF86XK_AudioPrev 0x1008FF16 -#define XF86XK_AudioNext 0x1008FF17 -#define XF86XK_HomePage 0x1008FF18 -#define XF86XK_Mail 0x1008FF19 -#define XF86XK_Start 0x1008FF1A -#define XF86XK_Search 0x1008FF1B -#define XF86XK_AudioRecord 0x1008FF1C -#define XF86XK_Calculator 0x1008FF1D -#define XF86XK_Memo 0x1008FF1E -#define XF86XK_ToDoList 0x1008FF1F -#define XF86XK_Calendar 0x1008FF20 -#define XF86XK_PowerDown 0x1008FF21 -#define XF86XK_ContrastAdjust 0x1008FF22 -#define XF86XK_Back 0x1008FF26 -#define XF86XK_Forward 0x1008FF27 -#define XF86XK_Stop 0x1008FF28 -#define XF86XK_Refresh 0x1008FF29 -#define XF86XK_PowerOff 0x1008FF2A -#define XF86XK_WakeUp 0x1008FF2B -#define XF86XK_Eject 0x1008FF2C -#define XF86XK_ScreenSaver 0x1008FF2D -#define XF86XK_WWW 0x1008FF2E -#define XF86XK_Sleep 0x1008FF2F -#define XF86XK_Favorites 0x1008FF30 -#define XF86XK_AudioPause 0x1008FF31 -#define XF86XK_AudioMedia 0x1008FF32 -#define XF86XK_MyComputer 0x1008FF33 -#define XF86XK_LightBulb 0x1008FF35 -#define XF86XK_Shop 0x1008FF36 -#define XF86XK_History 0x1008FF37 -#define XF86XK_OpenURL 0x1008FF38 -#define XF86XK_AddFavorite 0x1008FF39 -#define XF86XK_HotLinks 0x1008FF3A -#define XF86XK_BrightnessAdjust 0x1008FF3B -#define XF86XK_Finance 0x1008FF3C -#define XF86XK_Community 0x1008FF3D -#define XF86XK_AudioRewind 0x1008FF3E -#define XF86XK_BackForward 0x1008FF3F -#define XF86XK_Launch0 0x1008FF40 -#define XF86XK_Launch1 0x1008FF41 -#define XF86XK_Launch2 0x1008FF42 -#define XF86XK_Launch3 0x1008FF43 -#define XF86XK_Launch4 0x1008FF44 -#define XF86XK_Launch5 0x1008FF45 -#define XF86XK_Launch6 0x1008FF46 -#define XF86XK_Launch7 0x1008FF47 -#define XF86XK_Launch8 0x1008FF48 -#define XF86XK_Launch9 0x1008FF49 -#define XF86XK_LaunchA 0x1008FF4A -#define XF86XK_LaunchB 0x1008FF4B -#define XF86XK_LaunchC 0x1008FF4C -#define XF86XK_LaunchD 0x1008FF4D -#define XF86XK_LaunchE 0x1008FF4E -#define XF86XK_LaunchF 0x1008FF4F -#define XF86XK_ApplicationLeft 0x1008FF50 -#define XF86XK_ApplicationRight 0x1008FF51 -#define XF86XK_Book 0x1008FF52 -#define XF86XK_CD 0x1008FF53 -#define XF86XK_Calculater 0x1008FF54 -#define XF86XK_Clear 0x1008FF55 -#define XF86XK_ClearGrab 0x1008FE21 -#define XF86XK_Close 0x1008FF56 -#define XF86XK_Copy 0x1008FF57 -#define XF86XK_Cut 0x1008FF58 -#define XF86XK_Display 0x1008FF59 -#define XF86XK_DOS 0x1008FF5A -#define XF86XK_Documents 0x1008FF5B -#define XF86XK_Excel 0x1008FF5C -#define XF86XK_Explorer 0x1008FF5D -#define XF86XK_Game 0x1008FF5E -#define XF86XK_Go 0x1008FF5F -#define XF86XK_iTouch 0x1008FF60 -#define XF86XK_LogOff 0x1008FF61 -#define XF86XK_Market 0x1008FF62 -#define XF86XK_Meeting 0x1008FF63 -#define XF86XK_MenuKB 0x1008FF65 -#define XF86XK_MenuPB 0x1008FF66 -#define XF86XK_MySites 0x1008FF67 -#define XF86XK_News 0x1008FF69 -#define XF86XK_OfficeHome 0x1008FF6A -#define XF86XK_Option 0x1008FF6C -#define XF86XK_Paste 0x1008FF6D -#define XF86XK_Phone 0x1008FF6E -#define XF86XK_Reply 0x1008FF72 -#define XF86XK_Reload 0x1008FF73 -#define XF86XK_RotateWindows 0x1008FF74 -#define XF86XK_RotationPB 0x1008FF75 -#define XF86XK_RotationKB 0x1008FF76 -#define XF86XK_Save 0x1008FF77 -#define XF86XK_Send 0x1008FF7B -#define XF86XK_Spell 0x1008FF7C -#define XF86XK_SplitScreen 0x1008FF7D -#define XF86XK_Support 0x1008FF7E -#define XF86XK_TaskPane 0x1008FF7F -#define XF86XK_Terminal 0x1008FF80 -#define XF86XK_Tools 0x1008FF81 -#define XF86XK_Travel 0x1008FF82 -#define XF86XK_Video 0x1008FF87 -#define XF86XK_Word 0x1008FF89 -#define XF86XK_Xfer 0x1008FF8A -#define XF86XK_ZoomIn 0x1008FF8B -#define XF86XK_ZoomOut 0x1008FF8C -#define XF86XK_Away 0x1008FF8D -#define XF86XK_Messenger 0x1008FF8E -#define XF86XK_WebCam 0x1008FF8F -#define XF86XK_MailForward 0x1008FF90 -#define XF86XK_Pictures 0x1008FF91 -#define XF86XK_Music 0x1008FF92 -#define XF86XK_Battery 0x1008FF93 -#define XF86XK_Bluetooth 0x1008FF94 -#define XF86XK_WLAN 0x1008FF95 -#define XF86XK_UWB 0x1008FF96 -#define XF86XK_AudioForward 0x1008FF97 -#define XF86XK_AudioRepeat 0x1008FF98 -#define XF86XK_AudioRandomPlay 0x1008FF99 -#define XF86XK_Subtitle 0x1008FF9A -#define XF86XK_AudioCycleTrack 0x1008FF9B -#define XF86XK_Time 0x1008FF9F -#define XF86XK_Select 0x1008FFA0 -#define XF86XK_View 0x1008FFA1 -#define XF86XK_TopMenu 0x1008FFA2 -#define XF86XK_Suspend 0x1008FFA7 -#define XF86XK_Hibernate 0x1008FFA8 - - -// end of XF86keysyms.h - -// Special keys used by Qtopia, mapped into the X11 private keypad range. -#define QTOPIAXK_Select 0x11000601 -#define QTOPIAXK_Yes 0x11000602 -#define QTOPIAXK_No 0x11000603 -#define QTOPIAXK_Cancel 0x11000604 -#define QTOPIAXK_Printer 0x11000605 -#define QTOPIAXK_Execute 0x11000606 -#define QTOPIAXK_Sleep 0x11000607 -#define QTOPIAXK_Play 0x11000608 -#define QTOPIAXK_Zoom 0x11000609 -#define QTOPIAXK_Context1 0x1100060A -#define QTOPIAXK_Context2 0x1100060B -#define QTOPIAXK_Context3 0x1100060C -#define QTOPIAXK_Context4 0x1100060D -#define QTOPIAXK_Call 0x1100060E -#define QTOPIAXK_Hangup 0x1100060F -#define QTOPIAXK_Flip 0x11000610 - -// keyboard mapping table -static const unsigned int KeyTbl[] = { - - // misc keys - - XK_Escape, Qt::Key_Escape, - XK_Tab, Qt::Key_Tab, - XK_ISO_Left_Tab, Qt::Key_Backtab, - XK_BackSpace, Qt::Key_Backspace, - XK_Return, Qt::Key_Return, - XK_Insert, Qt::Key_Insert, - XK_Delete, Qt::Key_Delete, - XK_Clear, Qt::Key_Delete, - XK_Pause, Qt::Key_Pause, - XK_Print, Qt::Key_Print, - 0x1005FF60, Qt::Key_SysReq, // hardcoded Sun SysReq - 0x1007ff00, Qt::Key_SysReq, // hardcoded X386 SysReq - - // cursor movement - - XK_Home, Qt::Key_Home, - XK_End, Qt::Key_End, - XK_Left, Qt::Key_Left, - XK_Up, Qt::Key_Up, - XK_Right, Qt::Key_Right, - XK_Down, Qt::Key_Down, - XK_Prior, Qt::Key_PageUp, - XK_Next, Qt::Key_PageDown, - - // modifiers - - XK_Shift_L, Qt::Key_Shift, - XK_Shift_R, Qt::Key_Shift, - XK_Shift_Lock, Qt::Key_Shift, - XK_Control_L, Qt::Key_Control, - XK_Control_R, Qt::Key_Control, - XK_Meta_L, Qt::Key_Meta, - XK_Meta_R, Qt::Key_Meta, - XK_Alt_L, Qt::Key_Alt, - XK_Alt_R, Qt::Key_Alt, - XK_Caps_Lock, Qt::Key_CapsLock, - XK_Num_Lock, Qt::Key_NumLock, - XK_Scroll_Lock, Qt::Key_ScrollLock, - XK_Super_L, Qt::Key_Super_L, - XK_Super_R, Qt::Key_Super_R, - XK_Menu, Qt::Key_Menu, - XK_Hyper_L, Qt::Key_Hyper_L, - XK_Hyper_R, Qt::Key_Hyper_R, - XK_Help, Qt::Key_Help, - 0x1000FF74, Qt::Key_Backtab, // hardcoded HP backtab - 0x1005FF10, Qt::Key_F11, // hardcoded Sun F36 (labeled F11) - 0x1005FF11, Qt::Key_F12, // hardcoded Sun F37 (labeled F12) - - // numeric and function keypad keys - - XK_KP_Space, Qt::Key_Space, - XK_KP_Tab, Qt::Key_Tab, - XK_KP_Enter, Qt::Key_Enter, - //XK_KP_F1, Qt::Key_F1, - //XK_KP_F2, Qt::Key_F2, - //XK_KP_F3, Qt::Key_F3, - //XK_KP_F4, Qt::Key_F4, - XK_KP_Home, Qt::Key_Home, - XK_KP_Left, Qt::Key_Left, - XK_KP_Up, Qt::Key_Up, - XK_KP_Right, Qt::Key_Right, - XK_KP_Down, Qt::Key_Down, - XK_KP_Prior, Qt::Key_PageUp, - XK_KP_Next, Qt::Key_PageDown, - XK_KP_End, Qt::Key_End, - XK_KP_Begin, Qt::Key_Clear, - XK_KP_Insert, Qt::Key_Insert, - XK_KP_Delete, Qt::Key_Delete, - XK_KP_Equal, Qt::Key_Equal, - XK_KP_Multiply, Qt::Key_Asterisk, - XK_KP_Add, Qt::Key_Plus, - XK_KP_Separator, Qt::Key_Comma, - XK_KP_Subtract, Qt::Key_Minus, - XK_KP_Decimal, Qt::Key_Period, - XK_KP_Divide, Qt::Key_Slash, - - // International input method support keys - - // International & multi-key character composition - XK_ISO_Level3_Shift, Qt::Key_AltGr, - XK_Multi_key, Qt::Key_Multi_key, - XK_Codeinput, Qt::Key_Codeinput, - XK_SingleCandidate, Qt::Key_SingleCandidate, - XK_MultipleCandidate, Qt::Key_MultipleCandidate, - XK_PreviousCandidate, Qt::Key_PreviousCandidate, - - // Misc Functions - XK_Mode_switch, Qt::Key_Mode_switch, - XK_script_switch, Qt::Key_Mode_switch, - - // Japanese keyboard support - XK_Kanji, Qt::Key_Kanji, - XK_Muhenkan, Qt::Key_Muhenkan, - //XK_Henkan_Mode, Qt::Key_Henkan_Mode, - XK_Henkan_Mode, Qt::Key_Henkan, - XK_Henkan, Qt::Key_Henkan, - XK_Romaji, Qt::Key_Romaji, - XK_Hiragana, Qt::Key_Hiragana, - XK_Katakana, Qt::Key_Katakana, - XK_Hiragana_Katakana, Qt::Key_Hiragana_Katakana, - XK_Zenkaku, Qt::Key_Zenkaku, - XK_Hankaku, Qt::Key_Hankaku, - XK_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku, - XK_Touroku, Qt::Key_Touroku, - XK_Massyo, Qt::Key_Massyo, - XK_Kana_Lock, Qt::Key_Kana_Lock, - XK_Kana_Shift, Qt::Key_Kana_Shift, - XK_Eisu_Shift, Qt::Key_Eisu_Shift, - XK_Eisu_toggle, Qt::Key_Eisu_toggle, - //XK_Kanji_Bangou, Qt::Key_Kanji_Bangou, - //XK_Zen_Koho, Qt::Key_Zen_Koho, - //XK_Mae_Koho, Qt::Key_Mae_Koho, - XK_Kanji_Bangou, Qt::Key_Codeinput, - XK_Zen_Koho, Qt::Key_MultipleCandidate, - XK_Mae_Koho, Qt::Key_PreviousCandidate, - -#ifdef XK_KOREAN - // Korean keyboard support - XK_Hangul, Qt::Key_Hangul, - XK_Hangul_Start, Qt::Key_Hangul_Start, - XK_Hangul_End, Qt::Key_Hangul_End, - XK_Hangul_Hanja, Qt::Key_Hangul_Hanja, - XK_Hangul_Jamo, Qt::Key_Hangul_Jamo, - XK_Hangul_Romaja, Qt::Key_Hangul_Romaja, - //XK_Hangul_Codeinput, Qt::Key_Hangul_Codeinput, - XK_Hangul_Codeinput, Qt::Key_Codeinput, - XK_Hangul_Jeonja, Qt::Key_Hangul_Jeonja, - XK_Hangul_Banja, Qt::Key_Hangul_Banja, - XK_Hangul_PreHanja, Qt::Key_Hangul_PreHanja, - XK_Hangul_PostHanja, Qt::Key_Hangul_PostHanja, - //XK_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate, - //XK_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate, - //XK_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate, - XK_Hangul_SingleCandidate, Qt::Key_SingleCandidate, - XK_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate, - XK_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate, - XK_Hangul_Special, Qt::Key_Hangul_Special, - //XK_Hangul_switch, Qt::Key_Hangul_switch, - XK_Hangul_switch, Qt::Key_Mode_switch, -#endif // XK_KOREAN - - // dead keys - XK_dead_grave, Qt::Key_Dead_Grave, - XK_dead_acute, Qt::Key_Dead_Acute, - XK_dead_circumflex, Qt::Key_Dead_Circumflex, - XK_dead_tilde, Qt::Key_Dead_Tilde, - XK_dead_macron, Qt::Key_Dead_Macron, - XK_dead_breve, Qt::Key_Dead_Breve, - XK_dead_abovedot, Qt::Key_Dead_Abovedot, - XK_dead_diaeresis, Qt::Key_Dead_Diaeresis, - XK_dead_abovering, Qt::Key_Dead_Abovering, - XK_dead_doubleacute, Qt::Key_Dead_Doubleacute, - XK_dead_caron, Qt::Key_Dead_Caron, - XK_dead_cedilla, Qt::Key_Dead_Cedilla, - XK_dead_ogonek, Qt::Key_Dead_Ogonek, - XK_dead_iota, Qt::Key_Dead_Iota, - XK_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound, - XK_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound, - XK_dead_belowdot, Qt::Key_Dead_Belowdot, - XK_dead_hook, Qt::Key_Dead_Hook, - XK_dead_horn, Qt::Key_Dead_Horn, - - // Special keys from X.org - This include multimedia keys, - // wireless/bluetooth/uwb keys, special launcher keys, etc. - XF86XK_Back, Qt::Key_Back, - XF86XK_Forward, Qt::Key_Forward, - XF86XK_Stop, Qt::Key_Stop, - XF86XK_Refresh, Qt::Key_Refresh, - XF86XK_Favorites, Qt::Key_Favorites, - XF86XK_AudioMedia, Qt::Key_LaunchMedia, - XF86XK_OpenURL, Qt::Key_OpenUrl, - XF86XK_HomePage, Qt::Key_HomePage, - XF86XK_Search, Qt::Key_Search, - XF86XK_AudioLowerVolume, Qt::Key_VolumeDown, - XF86XK_AudioMute, Qt::Key_VolumeMute, - XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp, - XF86XK_AudioPlay, Qt::Key_MediaPlay, - XF86XK_AudioStop, Qt::Key_MediaStop, - XF86XK_AudioPrev, Qt::Key_MediaPrevious, - XF86XK_AudioNext, Qt::Key_MediaNext, - XF86XK_AudioRecord, Qt::Key_MediaRecord, - XF86XK_Mail, Qt::Key_LaunchMail, - XF86XK_MyComputer, Qt::Key_Launch0, // ### Qt 5: remap properly - XF86XK_Calculator, Qt::Key_Launch1, - XF86XK_Memo, Qt::Key_Memo, - XF86XK_ToDoList, Qt::Key_ToDoList, - XF86XK_Calendar, Qt::Key_Calendar, - XF86XK_PowerDown, Qt::Key_PowerDown, - XF86XK_ContrastAdjust, Qt::Key_ContrastAdjust, - XF86XK_Standby, Qt::Key_Standby, - XF86XK_MonBrightnessUp, Qt::Key_MonBrightnessUp, - XF86XK_MonBrightnessDown, Qt::Key_MonBrightnessDown, - XF86XK_KbdLightOnOff, Qt::Key_KeyboardLightOnOff, - XF86XK_KbdBrightnessUp, Qt::Key_KeyboardBrightnessUp, - XF86XK_KbdBrightnessDown, Qt::Key_KeyboardBrightnessDown, - XF86XK_PowerOff, Qt::Key_PowerOff, - XF86XK_WakeUp, Qt::Key_WakeUp, - XF86XK_Eject, Qt::Key_Eject, - XF86XK_ScreenSaver, Qt::Key_ScreenSaver, - XF86XK_WWW, Qt::Key_WWW, - XF86XK_Sleep, Qt::Key_Sleep, - XF86XK_LightBulb, Qt::Key_LightBulb, - XF86XK_Shop, Qt::Key_Shop, - XF86XK_History, Qt::Key_History, - XF86XK_AddFavorite, Qt::Key_AddFavorite, - XF86XK_HotLinks, Qt::Key_HotLinks, - XF86XK_BrightnessAdjust, Qt::Key_BrightnessAdjust, - XF86XK_Finance, Qt::Key_Finance, - XF86XK_Community, Qt::Key_Community, - XF86XK_AudioRewind, Qt::Key_AudioRewind, - XF86XK_BackForward, Qt::Key_BackForward, - XF86XK_ApplicationLeft, Qt::Key_ApplicationLeft, - XF86XK_ApplicationRight, Qt::Key_ApplicationRight, - XF86XK_Book, Qt::Key_Book, - XF86XK_CD, Qt::Key_CD, - XF86XK_Calculater, Qt::Key_Calculator, - XF86XK_Clear, Qt::Key_Clear, - XF86XK_ClearGrab, Qt::Key_ClearGrab, - XF86XK_Close, Qt::Key_Close, - XF86XK_Copy, Qt::Key_Copy, - XF86XK_Cut, Qt::Key_Cut, - XF86XK_Display, Qt::Key_Display, - XF86XK_DOS, Qt::Key_DOS, - XF86XK_Documents, Qt::Key_Documents, - XF86XK_Excel, Qt::Key_Excel, - XF86XK_Explorer, Qt::Key_Explorer, - XF86XK_Game, Qt::Key_Game, - XF86XK_Go, Qt::Key_Go, - XF86XK_iTouch, Qt::Key_iTouch, - XF86XK_LogOff, Qt::Key_LogOff, - XF86XK_Market, Qt::Key_Market, - XF86XK_Meeting, Qt::Key_Meeting, - XF86XK_MenuKB, Qt::Key_MenuKB, - XF86XK_MenuPB, Qt::Key_MenuPB, - XF86XK_MySites, Qt::Key_MySites, - XF86XK_News, Qt::Key_News, - XF86XK_OfficeHome, Qt::Key_OfficeHome, - XF86XK_Option, Qt::Key_Option, - XF86XK_Paste, Qt::Key_Paste, - XF86XK_Phone, Qt::Key_Phone, - XF86XK_Reply, Qt::Key_Reply, - XF86XK_Reload, Qt::Key_Reload, - XF86XK_RotateWindows, Qt::Key_RotateWindows, - XF86XK_RotationPB, Qt::Key_RotationPB, - XF86XK_RotationKB, Qt::Key_RotationKB, - XF86XK_Save, Qt::Key_Save, - XF86XK_Send, Qt::Key_Send, - XF86XK_Spell, Qt::Key_Spell, - XF86XK_SplitScreen, Qt::Key_SplitScreen, - XF86XK_Support, Qt::Key_Support, - XF86XK_TaskPane, Qt::Key_TaskPane, - XF86XK_Terminal, Qt::Key_Terminal, - XF86XK_Tools, Qt::Key_Tools, - XF86XK_Travel, Qt::Key_Travel, - XF86XK_Video, Qt::Key_Video, - XF86XK_Word, Qt::Key_Word, - XF86XK_Xfer, Qt::Key_Xfer, - XF86XK_ZoomIn, Qt::Key_ZoomIn, - XF86XK_ZoomOut, Qt::Key_ZoomOut, - XF86XK_Away, Qt::Key_Away, - XF86XK_Messenger, Qt::Key_Messenger, - XF86XK_WebCam, Qt::Key_WebCam, - XF86XK_MailForward, Qt::Key_MailForward, - XF86XK_Pictures, Qt::Key_Pictures, - XF86XK_Music, Qt::Key_Music, - XF86XK_Battery, Qt::Key_Battery, - XF86XK_Bluetooth, Qt::Key_Bluetooth, - XF86XK_WLAN, Qt::Key_WLAN, - XF86XK_UWB, Qt::Key_UWB, - XF86XK_AudioForward, Qt::Key_AudioForward, - XF86XK_AudioRepeat, Qt::Key_AudioRepeat, - XF86XK_AudioRandomPlay, Qt::Key_AudioRandomPlay, - XF86XK_Subtitle, Qt::Key_Subtitle, - XF86XK_AudioCycleTrack, Qt::Key_AudioCycleTrack, - XF86XK_Time, Qt::Key_Time, - XF86XK_Select, Qt::Key_Select, - XF86XK_View, Qt::Key_View, - XF86XK_TopMenu, Qt::Key_TopMenu, - XF86XK_Bluetooth, Qt::Key_Bluetooth, - XF86XK_Suspend, Qt::Key_Suspend, - XF86XK_Hibernate, Qt::Key_Hibernate, - XF86XK_Launch0, Qt::Key_Launch2, // ### Qt 5: remap properly - XF86XK_Launch1, Qt::Key_Launch3, - XF86XK_Launch2, Qt::Key_Launch4, - XF86XK_Launch3, Qt::Key_Launch5, - XF86XK_Launch4, Qt::Key_Launch6, - XF86XK_Launch5, Qt::Key_Launch7, - XF86XK_Launch6, Qt::Key_Launch8, - XF86XK_Launch7, Qt::Key_Launch9, - XF86XK_Launch8, Qt::Key_LaunchA, - XF86XK_Launch9, Qt::Key_LaunchB, - XF86XK_LaunchA, Qt::Key_LaunchC, - XF86XK_LaunchB, Qt::Key_LaunchD, - XF86XK_LaunchC, Qt::Key_LaunchE, - XF86XK_LaunchD, Qt::Key_LaunchF, - XF86XK_LaunchE, Qt::Key_LaunchG, - XF86XK_LaunchF, Qt::Key_LaunchH, - - // Qtopia keys - QTOPIAXK_Select, Qt::Key_Select, - QTOPIAXK_Yes, Qt::Key_Yes, - QTOPIAXK_No, Qt::Key_No, - QTOPIAXK_Cancel, Qt::Key_Cancel, - QTOPIAXK_Printer, Qt::Key_Printer, - QTOPIAXK_Execute, Qt::Key_Execute, - QTOPIAXK_Sleep, Qt::Key_Sleep, - QTOPIAXK_Play, Qt::Key_Play, - QTOPIAXK_Zoom, Qt::Key_Zoom, - QTOPIAXK_Context1, Qt::Key_Context1, - QTOPIAXK_Context2, Qt::Key_Context2, - QTOPIAXK_Context3, Qt::Key_Context3, - QTOPIAXK_Context4, Qt::Key_Context4, - QTOPIAXK_Call, Qt::Key_Call, - QTOPIAXK_Hangup, Qt::Key_Hangup, - QTOPIAXK_Flip, Qt::Key_Flip, - - 0, 0 -}; - -static const unsigned short katakanaKeysymsToUnicode[] = { - 0x0000, 0x3002, 0x300C, 0x300D, 0x3001, 0x30FB, 0x30F2, 0x30A1, - 0x30A3, 0x30A5, 0x30A7, 0x30A9, 0x30E3, 0x30E5, 0x30E7, 0x30C3, - 0x30FC, 0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30AB, 0x30AD, - 0x30AF, 0x30B1, 0x30B3, 0x30B5, 0x30B7, 0x30B9, 0x30BB, 0x30BD, - 0x30BF, 0x30C1, 0x30C4, 0x30C6, 0x30C8, 0x30CA, 0x30CB, 0x30CC, - 0x30CD, 0x30CE, 0x30CF, 0x30D2, 0x30D5, 0x30D8, 0x30DB, 0x30DE, - 0x30DF, 0x30E0, 0x30E1, 0x30E2, 0x30E4, 0x30E6, 0x30E8, 0x30E9, - 0x30EA, 0x30EB, 0x30EC, 0x30ED, 0x30EF, 0x30F3, 0x309B, 0x309C -}; - -static const unsigned short cyrillicKeysymsToUnicode[] = { - 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, - 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0000, 0x045e, 0x045f, - 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, - 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0000, 0x040e, 0x040f, - 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, - 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, - 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, - 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, - 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, - 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, - 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, - 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a -}; - -static const unsigned short greekKeysymsToUnicode[] = { - 0x0000, 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, - 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, - 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, - 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, - 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, - 0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, - 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, - 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, - 0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, - 0x03c8, 0x03c9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -}; - -static const unsigned short technicalKeysymsToUnicode[] = { - 0x0000, 0x23B7, 0x250C, 0x2500, 0x2320, 0x2321, 0x2502, 0x23A1, - 0x23A3, 0x23A4, 0x23A6, 0x239B, 0x239D, 0x239E, 0x23A0, 0x23A8, - 0x23AC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222B, - 0x2234, 0x221D, 0x221E, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, - 0x223C, 0x2243, 0x0000, 0x0000, 0x0000, 0x21D4, 0x21D2, 0x2261, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221A, 0x0000, - 0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222A, 0x2227, 0x2228, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2202, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, - 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193, 0x0000 -}; - -static const unsigned short specialKeysymsToUnicode[] = { - 0x25C6, 0x2592, 0x2409, 0x240C, 0x240D, 0x240A, 0x0000, 0x0000, - 0x2424, 0x240B, 0x2518, 0x2510, 0x250C, 0x2514, 0x253C, 0x23BA, - 0x23BB, 0x2500, 0x23BC, 0x23BD, 0x251C, 0x2524, 0x2534, 0x252C, - 0x2502, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -}; - -static const unsigned short publishingKeysymsToUnicode[] = { - 0x0000, 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, - 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, - 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, - 0x2105, 0x0000, 0x0000, 0x2012, 0x2329, 0x0000, 0x232a, 0x0000, - 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, - 0x0000, 0x2122, 0x2613, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25af, - 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x0000, 0x2032, 0x2033, - 0x0000, 0x271d, 0x0000, 0x25ac, 0x25c0, 0x25b6, 0x25cf, 0x25ae, - 0x25e6, 0x25ab, 0x25ad, 0x25b3, 0x25bd, 0x2606, 0x2022, 0x25aa, - 0x25b2, 0x25bc, 0x261c, 0x261e, 0x2663, 0x2666, 0x2665, 0x0000, - 0x2720, 0x2020, 0x2021, 0x2713, 0x2717, 0x266f, 0x266d, 0x2642, - 0x2640, 0x260e, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e, 0x0000 -}; - -static const unsigned short aplKeysymsToUnicode[] = { - 0x0000, 0x0000, 0x0000, 0x003c, 0x0000, 0x0000, 0x003e, 0x0000, - 0x2228, 0x2227, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x00af, 0x0000, 0x22a5, 0x2229, 0x230a, 0x0000, 0x005f, 0x0000, - 0x0000, 0x0000, 0x2218, 0x0000, 0x2395, 0x0000, 0x22a4, 0x25cb, - 0x0000, 0x0000, 0x0000, 0x2308, 0x0000, 0x0000, 0x222a, 0x0000, - 0x2283, 0x0000, 0x2282, 0x0000, 0x22a2, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x22a3, 0x0000, 0x0000, 0x0000 -}; - -static const unsigned short koreanKeysymsToUnicode[] = { - 0x0000, 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, - 0x3138, 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, - 0x3140, 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, - 0x3148, 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, - 0x3150, 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, - 0x3158, 0x3159, 0x315a, 0x315b, 0x315c, 0x315d, 0x315e, 0x315f, - 0x3160, 0x3161, 0x3162, 0x3163, 0x11a8, 0x11a9, 0x11aa, 0x11ab, - 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, - 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, - 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x316d, - 0x3171, 0x3178, 0x317f, 0x3181, 0x3184, 0x3186, 0x318d, 0x318e, - 0x11eb, 0x11f0, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9 -}; - -static QChar keysymToUnicode(unsigned char byte3, unsigned char byte4) -{ - switch (byte3) { - case 0x04: - // katakana - if (byte4 > 0xa0 && byte4 < 0xe0) - return QChar(katakanaKeysymsToUnicode[byte4 - 0xa0]); - else if (byte4 == 0x7e) - return QChar(0x203e); // Overline - break; - case 0x06: - // russian, use lookup table - if (byte4 > 0xa0) - return QChar(cyrillicKeysymsToUnicode[byte4 - 0xa0]); - break; - case 0x07: - // greek - if (byte4 > 0xa0) - return QChar(greekKeysymsToUnicode[byte4 - 0xa0]); - break; - case 0x08: - // technical - if (byte4 > 0xa0) - return QChar(technicalKeysymsToUnicode[byte4 - 0xa0]); - break; - case 0x09: - // special - if (byte4 >= 0xe0) - return QChar(specialKeysymsToUnicode[byte4 - 0xe0]); - break; - case 0x0a: - // publishing - if (byte4 > 0xa0) - return QChar(publishingKeysymsToUnicode[byte4 - 0xa0]); - break; - case 0x0b: - // APL - if (byte4 > 0xa0) - return QChar(aplKeysymsToUnicode[byte4 - 0xa0]); - break; - case 0x0e: - // Korean - if (byte4 > 0xa0) - return QChar(koreanKeysymsToUnicode[byte4 - 0xa0]); - break; - default: - break; - } - return QChar(0x0); -} - -Qt::KeyboardModifiers QXlibKeyboard::translateModifiers(int s) -{ - Qt::KeyboardModifiers ret = 0; - if (s & ShiftMask) - ret |= Qt::ShiftModifier; - if (s & ControlMask) - ret |= Qt::ControlModifier; - if (s & m_alt_mask) - ret |= Qt::AltModifier; - if (s & m_meta_mask) - ret |= Qt::MetaModifier; -// if (s & m_mode_switch_mask) //doesn't seem to work correctly -// ret |= Qt::GroupSwitchModifier; - return ret; -} - -void QXlibKeyboard::setMask(KeySym sym, uint mask) -{ - if (m_alt_mask == 0 - && m_meta_mask != mask - && m_super_mask != mask - && m_hyper_mask != mask - && (sym == XK_Alt_L || sym == XK_Alt_R)) { - m_alt_mask = mask; - } - if (m_meta_mask == 0 - && m_alt_mask != mask - && m_super_mask != mask - && m_hyper_mask != mask - && (sym == XK_Meta_L || sym == XK_Meta_R)) { - m_meta_mask = mask; - } - if (m_super_mask == 0 - && m_alt_mask != mask - && m_meta_mask != mask - && m_hyper_mask != mask - && (sym == XK_Super_L || sym == XK_Super_R)) { - m_super_mask = mask; - } - if (m_hyper_mask == 0 - && m_alt_mask != mask - && m_meta_mask != mask - && m_super_mask != mask - && (sym == XK_Hyper_L || sym == XK_Hyper_R)) { - m_hyper_mask = mask; - } - if (m_mode_switch_mask == 0 - && m_alt_mask != mask - && m_meta_mask != mask - && m_super_mask != mask - && m_hyper_mask != mask - && sym == XK_Mode_switch) { - m_mode_switch_mask = mask; - } - if (m_num_lock_mask == 0 - && sym == XK_Num_Lock) { - m_num_lock_mask = mask; - } -} - -int QXlibKeyboard::translateKeySym(uint key) const -{ - int code = -1; - int i = 0; // any other keys - while (KeyTbl[i]) { - if (key == KeyTbl[i]) { - code = (int)KeyTbl[i+1]; - break; - } - i += 2; - } - if (m_meta_mask) { - // translate Super/Hyper keys to Meta if we're using them as the MetaModifier - if (m_meta_mask == m_super_mask && (code == Qt::Key_Super_L || code == Qt::Key_Super_R)) { - code = Qt::Key_Meta; - } else if (m_meta_mask == m_hyper_mask && (code == Qt::Key_Hyper_L || code == Qt::Key_Hyper_R)) { - code = Qt::Key_Meta; - } - } - return code; -} - -QString QXlibKeyboard::translateKeySym(KeySym keysym, uint xmodifiers, - int &code, Qt::KeyboardModifiers &modifiers, - QByteArray &chars, int &count) -{ - // all keysyms smaller than 0xff00 are actally keys that can be mapped to unicode chars - - QTextCodec *mapper = QTextCodec::codecForLocale(); - QChar converted; - - if (/*count == 0 &&*/ keysym < 0xff00) { - unsigned char byte3 = (unsigned char)(keysym >> 8); - int mib = -1; - switch(byte3) { - case 0: // Latin 1 - case 1: // Latin 2 - case 2: //latin 3 - case 3: // latin4 - mib = byte3 + 4; break; - case 5: // arabic - mib = 82; break; - case 12: // Hebrew - mib = 85; break; - case 13: // Thai - mib = 2259; break; - case 4: // kana - case 6: // cyrillic - case 7: // greek - case 8: // technical, no mapping here at the moment - case 9: // Special - case 10: // Publishing - case 11: // APL - case 14: // Korean, no mapping - mib = -1; // manual conversion - mapper= 0; -#if !defined(QT_NO_XIM) - converted = keysymToUnicode(byte3, keysym & 0xff); -#endif - case 0x20: - // currency symbols - if (keysym >= 0x20a0 && keysym <= 0x20ac) { - mib = -1; // manual conversion - mapper = 0; - converted = (uint)keysym; - } - break; - default: - break; - } - if (mib != -1) { - mapper = QTextCodec::codecForMib(mib); - if (chars.isEmpty()) - chars.resize(1); - chars[0] = (unsigned char) (keysym & 0xff); // get only the fourth bit for conversion later - count = 1; - } - } else if (keysym >= 0x1000000 && keysym <= 0x100ffff) { - converted = (ushort) (keysym - 0x1000000); - mapper = 0; - } - if (count < (int)chars.size()-1) - chars[count] = '\0'; - - QString text; - if (!mapper && converted.unicode() != 0x0) { - text = converted; - } else if (!chars.isEmpty()) { - // convert chars (8bit) to text (unicode). - if (mapper) - text = mapper->toUnicode(chars.data(), count, 0); - if (text.isEmpty()) { - // no mapper, or codec couldn't convert to unicode (this - // can happen when running in the C locale or with no LANG - // set). try converting from latin-1 - text = QString::fromLatin1(chars); - } - } - - modifiers = translateModifiers(xmodifiers); - - // Commentary in X11/keysymdef says that X codes match ASCII, so it - // is safe to use the locale functions to process X codes in ISO8859-1. - // - // This is mainly for compatibility - applications should not use the - // Qt keycodes between 128 and 255, but should rather use the - // QKeyEvent::text(). - // - if (keysym < 128 || (keysym < 256 && (!mapper || mapper->mibEnum()==4))) { - // upper-case key, if known - code = isprint((int)keysym) ? toupper((int)keysym) : 0; - } else if (keysym >= XK_F1 && keysym <= XK_F35) { - // function keys - code = Qt::Key_F1 + ((int)keysym - XK_F1); - } else if (keysym >= XK_KP_Space && keysym <= XK_KP_9) { - if (keysym >= XK_KP_0) { - // numeric keypad keys - code = Qt::Key_0 + ((int)keysym - XK_KP_0); - } else { - code = translateKeySym(keysym); - } - modifiers |= Qt::KeypadModifier; - } else if (text.length() == 1 && text.unicode()->unicode() > 0x1f && text.unicode()->unicode() != 0x7f && !(keysym >= XK_dead_grave && keysym <= XK_dead_horn)) { - code = text.unicode()->toUpper().unicode(); - } else { - // any other keys - code = translateKeySym(keysym); - - if (code == Qt::Key_Tab && (modifiers & Qt::ShiftModifier)) { - // map shift+tab to shift+backtab, QShortcutMap knows about it - // and will handle it. - code = Qt::Key_Backtab; - text = QString(); - } - } - - return text; -} - -QXlibKeyboard::QXlibKeyboard(QXlibScreen *screen) - : m_screen(screen) - , m_alt_mask(0) - , m_super_mask(0) - , m_hyper_mask(0) - , m_meta_mask(0) -{ - changeLayout(); -} - -void QXlibKeyboard::changeLayout() -{ - XkbDescPtr xkbDesc = XkbGetMap(m_screen->display(), XkbAllClientInfoMask, XkbUseCoreKbd); - for (int i = xkbDesc->min_key_code; i < xkbDesc->max_key_code; ++i) { - const uint mask = xkbDesc->map->modmap ? xkbDesc->map->modmap[i] : 0; - if (mask == 0) { - // key is not bound to a modifier - continue; - } - - for (int j = 0; j < XkbKeyGroupsWidth(xkbDesc, i); ++j) { - KeySym keySym = XkbKeySym(xkbDesc, i, j); - if (keySym == NoSymbol) - continue; - setMask(keySym, mask); - } - } - XkbFreeKeyboard(xkbDesc, XkbAllComponentsMask, true); - -} - -static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) -{ - switch (qtcode) { - case Qt::Key_Control: - return Qt::ControlModifier; - case Qt::Key_Alt: - return Qt::AltModifier; - case Qt::Key_Shift: - return Qt::ShiftModifier; - case Qt::Key_Meta: - return Qt::MetaModifier; - default: - return Qt::NoModifier; - } -} - -void QXlibKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev) -{ - int qtcode = 0; - Qt::KeyboardModifiers modifiers = translateModifiers(ev->state); - QByteArray chars; - chars.resize(513); - int count = 0; - KeySym keySym; - count = XLookupString(ev,chars.data(),chars.size(),&keySym,0); - QString text = translateKeySym(keySym,ev->state,qtcode,modifiers,chars,count); - QWindowSystemInterface::handleKeyEvent(widget,ev->time,type,qtcode,modifiers,text.left(count)); -} diff --git a/src/plugins/platforms/testlite/qtestlitekeyboard.h b/src/plugins/platforms/testlite/qtestlitekeyboard.h deleted file mode 100644 index 98df4e1..0000000 --- a/src/plugins/platforms/testlite/qtestlitekeyboard.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITEKEYBOARD_H -#define QTESTLITEKEYBOARD_H - -#include "qtestliteintegration.h" - -class QXlibKeyboard -{ -public: - QXlibKeyboard(QXlibScreen *screen); - - void changeLayout(); - - void handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev); - - Qt::KeyboardModifiers translateModifiers(int s); - -private: - - void setMask(KeySym sym, uint mask); - int translateKeySym(uint key) const; - QString translateKeySym(KeySym keysym, uint xmodifiers, - int &code, Qt::KeyboardModifiers &modifiers, - QByteArray &chars, int &count); - - QXlibScreen *m_screen; - - uint m_alt_mask; - uint m_super_mask; - uint m_hyper_mask; - uint m_meta_mask; - uint m_mode_switch_mask; - uint m_num_lock_mask; -}; - -#endif // QTESTLITEKEYBOARD_H diff --git a/src/plugins/platforms/testlite/qtestlitemime.cpp b/src/plugins/platforms/testlite/qtestlitemime.cpp deleted file mode 100644 index 5335ae9..0000000 --- a/src/plugins/platforms/testlite/qtestlitemime.cpp +++ /dev/null @@ -1,322 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitemime.h" - -#include "qtestlitestaticinfo.h" -#include "qtestlitescreen.h" - -#include -#include -#include - -QXlibMime::QXlibMime() - : QInternalMimeData() -{ } - -QXlibMime::~QXlibMime() -{} - - - - - -QString QXlibMime::mimeAtomToString(Display *display, Atom a) -{ - if (!a) return 0; - - if (a == XA_STRING || a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) { - return "text/plain"; // some Xdnd clients are dumb - } - char *atom = XGetAtomName(display, a); - QString result = QString::fromLatin1(atom); - XFree(atom); - return result; -} - -Atom QXlibMime::mimeStringToAtom(Display *display, const QString &mimeType) -{ - if (mimeType.isEmpty()) - return 0; - return XInternAtom(display, mimeType.toLatin1().constData(), False); -} - -QStringList QXlibMime::mimeFormatsForAtom(Display *display, Atom a) -{ - QStringList formats; - if (a) { - QString atomName = mimeAtomToString(display, a); - formats.append(atomName); - - // special cases for string type - if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) - || a == XA_STRING - || a == QXlibStatic::atom(QXlibStatic::TEXT) - || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) - formats.append(QLatin1String("text/plain")); - - // special cases for uris - if (atomName == QLatin1String("text/x-moz-url")) - formats.append(QLatin1String("text/uri-list")); - - // special case for images - if (a == XA_PIXMAP) - formats.append(QLatin1String("image/ppm")); - } - return formats; -} - -bool QXlibMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat) -{ - bool ret = false; - *atomFormat = a; - *dataFormat = 8; - QString atomName = mimeAtomToString(display, a); - if (QInternalMimeData::hasFormatHelper(atomName, mimeData)) { - *data = QInternalMimeData::renderDataHelper(atomName, mimeData); - if (atomName == QLatin1String("application/x-color")) - *dataFormat = 16; - ret = true; - } else { - if ((a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) - || a == XA_STRING - || a == QXlibStatic::atom(QXlibStatic::TEXT) - || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) - && QInternalMimeData::hasFormatHelper(QLatin1String("text/plain"), mimeData)) { - if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)){ - *data = QInternalMimeData::renderDataHelper(QLatin1String("text/plain"), mimeData); - ret = true; - } else if (a == XA_STRING) { - *data = QString::fromUtf8(QInternalMimeData::renderDataHelper( - QLatin1String("text/plain"), mimeData)).toLocal8Bit(); - ret = true; - } else if (a == QXlibStatic::atom(QXlibStatic::TEXT) - || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { - // the ICCCM states that TEXT and COMPOUND_TEXT are in the - // encoding of choice, so we choose the encoding of the locale - QByteArray strData = QString::fromUtf8(QInternalMimeData::renderDataHelper( - QLatin1String("text/plain"), mimeData)).toLocal8Bit(); - char *list[] = { strData.data(), NULL }; - - XICCEncodingStyle style = (a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) - ? XCompoundTextStyle : XStdICCTextStyle; - XTextProperty textprop; - if (list[0] != NULL - && XmbTextListToTextProperty(display, list, 1, style, - &textprop) == Success) { - *atomFormat = textprop.encoding; - *dataFormat = textprop.format; - *data = QByteArray((const char *) textprop.value, textprop.nitems * textprop.format / 8); - ret = true; - - XFree(textprop.value); - } - } - } else if (atomName == QLatin1String("text/x-moz-url") && - QInternalMimeData::hasFormatHelper(QLatin1String("text/uri-list"), mimeData)) { - QByteArray uri = QInternalMimeData::renderDataHelper( - QLatin1String("text/uri-list"), mimeData).split('\n').first(); - QString mozUri = QString::fromLatin1(uri, uri.size()); - mozUri += QLatin1Char('\n'); - *data = QByteArray(reinterpret_cast(mozUri.utf16()), mozUri.length() * 2); - ret = true; - } else if ((a == XA_PIXMAP || a == XA_BITMAP) && mimeData->hasImage()) { - ret = true; - } - } - return ret && data != 0; -} - -QList QXlibMime::mimeAtomsForFormat(Display *display, const QString &format) -{ - QList atoms; - atoms.append(mimeStringToAtom(display, format)); - - // special cases for strings - if (format == QLatin1String("text/plain")) { - atoms.append(QXlibStatic::atom(QXlibStatic::UTF8_STRING)); - atoms.append(XA_STRING); - atoms.append(QXlibStatic::atom(QXlibStatic::TEXT)); - atoms.append(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)); - } - - // special cases for uris - if (format == QLatin1String("text/uri-list")) { - atoms.append(mimeStringToAtom(display,QLatin1String("text/x-moz-url"))); - } - - //special cases for images - if (format == QLatin1String("image/ppm")) - atoms.append(XA_PIXMAP); - if (format == QLatin1String("image/pbm")) - atoms.append(XA_BITMAP); - - return atoms; -} - -QVariant QXlibMime::mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding) -{ - QString atomName = mimeAtomToString(display,a); - if (atomName == format) - return data; - - if (!encoding.isEmpty() - && atomName == format + QLatin1String(";charset=") + QString::fromLatin1(encoding)) { - - if (requestedType == QVariant::String) { - QTextCodec *codec = QTextCodec::codecForName(encoding); - if (codec) - return codec->toUnicode(data); - } - - return data; - } - - // special cases for string types - if (format == QLatin1String("text/plain")) { - if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) - return QString::fromUtf8(data); - if (a == XA_STRING) - return QString::fromLatin1(data); - if (a == QXlibStatic::atom(QXlibStatic::TEXT) - || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) - // #### might be wrong for COMPUND_TEXT - return QString::fromLocal8Bit(data, data.size()); - } - - // special case for uri types - if (format == QLatin1String("text/uri-list")) { - if (atomName == QLatin1String("text/x-moz-url")) { - // we expect this as utf16 - // the first part is a url that should only contain ascci char - // so it should be safe to check that the second char is 0 - // to verify that it is utf16 - if (data.size() > 1 && data.at(1) == 0) - return QString::fromRawData((const QChar *)data.constData(), - data.size() / 2).split(QLatin1Char('\n')).first().toLatin1(); - } - } - - // special cas for images - if (format == QLatin1String("image/ppm")) { - if (a == XA_PIXMAP && data.size() == sizeof(Pixmap)) { - Pixmap xpm = *((Pixmap*)data.data()); - if (!xpm) - return QByteArray(); - Window root; - int x; - int y; - uint width; - uint height; - uint border_width; - uint depth; - - XGetGeometry(display, xpm, &root, &x, &y, &width, &height, &border_width, &depth); - XImage *ximg = XGetImage(display,xpm,x,y,width,height,AllPlanes,depth==1 ? XYPixmap : ZPixmap); - QImage qimg = QXlibStatic::qimageFromXImage(ximg); - XDestroyImage(ximg); - - QImageWriter imageWriter; - imageWriter.setFormat("PPMRAW"); - QBuffer buf; - buf.open(QIODevice::WriteOnly); - imageWriter.setDevice(&buf); - imageWriter.write(qimg); - return buf.buffer(); - } - } - return QVariant(); -} - -Atom QXlibMime::mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding) -{ - requestedEncoding->clear(); - - // find matches for string types - if (format == QLatin1String("text/plain")) { - if (atoms.contains(QXlibStatic::atom(QXlibStatic::UTF8_STRING))) - return QXlibStatic::atom(QXlibStatic::UTF8_STRING); - if (atoms.contains(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT))) - return QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT); - if (atoms.contains(QXlibStatic::atom(QXlibStatic::TEXT))) - return QXlibStatic::atom(QXlibStatic::TEXT); - if (atoms.contains(XA_STRING)) - return XA_STRING; - } - - // find matches for uri types - if (format == QLatin1String("text/uri-list")) { - Atom a = mimeStringToAtom(display,format); - if (a && atoms.contains(a)) - return a; - a = mimeStringToAtom(display,QLatin1String("text/x-moz-url")); - if (a && atoms.contains(a)) - return a; - } - - // find match for image - if (format == QLatin1String("image/ppm")) { - if (atoms.contains(XA_PIXMAP)) - return XA_PIXMAP; - } - - // for string/text requests try to use a format with a well-defined charset - // first to avoid encoding problems - if (requestedType == QVariant::String - && format.startsWith(QLatin1String("text/")) - && !format.contains(QLatin1String("charset="))) { - - QString formatWithCharset = format; - formatWithCharset.append(QLatin1String(";charset=utf-8")); - - Atom a = mimeStringToAtom(display,formatWithCharset); - if (a && atoms.contains(a)) { - *requestedEncoding = "utf-8"; - return a; - } - } - - Atom a = mimeStringToAtom(display,format); - if (a && atoms.contains(a)) - return a; - - return 0; -} diff --git a/src/plugins/platforms/testlite/qtestlitemime.h b/src/plugins/platforms/testlite/qtestlitemime.h deleted file mode 100644 index 6a70ea4..0000000 --- a/src/plugins/platforms/testlite/qtestlitemime.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITEMIME_H -#define QTESTLITEMIME_H - -#include <private/qdnd_p.h> - -#include <QtGui/QClipboard> - -#include "qtestliteintegration.h" -#include "qtestliteclipboard.h" - -class QXlibMime : public QInternalMimeData { - Q_OBJECT -public: - QXlibMime(); - ~QXlibMime(); - - static QList<Atom> mimeAtomsForFormat(Display *display, const QString &format); - static QString mimeAtomToString(Display *display, Atom a); - static bool mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat); - static QStringList mimeFormatsForAtom(Display *display, Atom a); - static Atom mimeStringToAtom(Display *display, const QString &mimeType); - static QVariant mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding); - static Atom mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding); -}; - -#endif // QTESTLITEMIME_H diff --git a/src/plugins/platforms/testlite/qtestlitescreen.cpp b/src/plugins/platforms/testlite/qtestlitescreen.cpp deleted file mode 100644 index 714c17b..0000000 --- a/src/plugins/platforms/testlite/qtestlitescreen.cpp +++ /dev/null @@ -1,468 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitescreen.h" - -#include "qtestlitecursor.h" -#include "qtestlitewindow.h" -#include "qtestlitekeyboard.h" -#include "qtestlitestaticinfo.h" -#include "qtestliteclipboard.h" - -#include <QtCore/QDebug> -#include <QtCore/QSocketNotifier> -#include <QtCore/QElapsedTimer> - -#include <private/qapplication_p.h> - -#include <X11/extensions/Xfixes.h> - -QT_BEGIN_NAMESPACE - -static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); -static bool seen_badwindow; - -static int qt_x_errhandler(Display *dpy, XErrorEvent *err) -{ - -qDebug() << "qt_x_errhandler" << err->error_code; - - switch (err->error_code) { - case BadAtom: -#if 0 - if (err->request_code == 20 /* X_GetProperty */ - && (err->resourceid == XA_RESOURCE_MANAGER - || err->resourceid == XA_RGB_DEFAULT_MAP - || err->resourceid == ATOM(_NET_SUPPORTED) - || err->resourceid == ATOM(_NET_SUPPORTING_WM_CHECK) - || err->resourceid == ATOM(KDE_FULL_SESSION) - || err->resourceid == ATOM(KWIN_RUNNING) - || err->resourceid == ATOM(XdndProxy) - || err->resourceid == ATOM(XdndAware)) - - - ) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } -#endif - qDebug() << "BadAtom"; - break; - - case BadWindow: - if (err->request_code == 2 /* X_ChangeWindowAttributes */ - || err->request_code == 38 /* X_QueryPointer */) { - for (int i = 0; i < ScreenCount(dpy); ++i) { - if (err->resourceid == RootWindow(dpy, i)) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } - } - } - seen_badwindow = true; - if (err->request_code == 25 /* X_SendEvent */) { - for (int i = 0; i < ScreenCount(dpy); ++i) { - if (err->resourceid == RootWindow(dpy, i)) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } - } -#if 0 - if (X11->xdndHandleBadwindow()) { - qDebug("xdndHandleBadwindow returned true"); - return 0; - } -#endif - } -#if 0 - if (X11->ignore_badwindow) - return 0; -#endif - break; - - case BadMatch: - if (err->request_code == 42 /* X_SetInputFocus */) - return 0; - break; - - default: -#if 0 //!defined(QT_NO_XINPUT) - if (err->request_code == X11->xinput_major - && err->error_code == (X11->xinput_errorbase + XI_BadDevice) - && err->minor_code == 3 /* X_OpenDevice */) { - return 0; - } -#endif - break; - } - - char errstr[256]; - XGetErrorText( dpy, err->error_code, errstr, 256 ); - char buffer[256]; - char request_str[256]; - qsnprintf(buffer, 256, "%d", err->request_code); - XGetErrorDatabaseText(dpy, "XRequest", buffer, "", request_str, 256); - if (err->request_code < 128) { - // X error for a normal protocol request - qWarning( "X Error: %s %d\n" - " Major opcode: %d (%s)\n" - " Resource id: 0x%lx", - errstr, err->error_code, - err->request_code, - request_str, - err->resourceid ); - } else { - // X error for an extension request - const char *extensionName = 0; -#if 0 - if (err->request_code == X11->xrender_major) - extensionName = "RENDER"; - else if (err->request_code == X11->xrandr_major) - extensionName = "RANDR"; - else if (err->request_code == X11->xinput_major) - extensionName = "XInputExtension"; - else if (err->request_code == X11->mitshm_major) - extensionName = "MIT-SHM"; -#endif - char minor_str[256]; - if (extensionName) { - qsnprintf(buffer, 256, "%s.%d", extensionName, err->minor_code); - XGetErrorDatabaseText(dpy, "XRequest", buffer, "", minor_str, 256); - } else { - extensionName = "Uknown extension"; - qsnprintf(minor_str, 256, "Unknown request"); - } - qWarning( "X Error: %s %d\n" - " Extension: %d (%s)\n" - " Minor opcode: %d (%s)\n" - " Resource id: 0x%lx", - errstr, err->error_code, - err->request_code, - extensionName, - err->minor_code, - minor_str, - err->resourceid ); - } - - // ### we really should distinguish between severe, non-severe and - // ### application specific errors - - return 0; -} - -QXlibScreen::QXlibScreen() - : mFormat(QImage::Format_RGB32) -{ - char *display_name = getenv("DISPLAY"); - mDisplay = XOpenDisplay(display_name); - mDisplayName = QString::fromLocal8Bit(display_name); - if (!mDisplay) { - fprintf(stderr, "Cannot connect to X server: %s\n", - display_name); - exit(1); - } - -#ifndef DONT_USE_MIT_SHM - Status MIT_SHM_extension_supported = XShmQueryExtension (mDisplay); - Q_ASSERT(MIT_SHM_extension_supported == True); -#endif - original_x_errhandler = XSetErrorHandler(qt_x_errhandler); - - if (qgetenv("DO_X_SYNCHRONIZE").toInt()) - XSynchronize(mDisplay, true); - - mScreen = DefaultScreen(mDisplay); - XSelectInput(mDisplay,rootWindow(), KeymapStateMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask); - int width = DisplayWidth(mDisplay, mScreen); - int height = DisplayHeight(mDisplay, mScreen); - mGeometry = QRect(0,0,width,height); - - int physicalWidth = DisplayWidthMM(mDisplay, mScreen); - int physicalHeight = DisplayHeightMM(mDisplay, mScreen); - mPhysicalSize = QSize(physicalWidth,physicalHeight); - - int xSocketNumber = XConnectionNumber(mDisplay); - - mDepth = DefaultDepth(mDisplay,mScreen); -#ifdef MYX11_DEBUG - qDebug() << "X socket:"<< xSocketNumber; -#endif - QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); - connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); - - mCursor = new QXlibCursor(this); - mKeyboard = new QXlibKeyboard(this); -} - -QXlibScreen::~QXlibScreen() -{ - delete mCursor; - XCloseDisplay(mDisplay); -} - -#ifdef KeyPress -#undef KeyPress -#endif -#ifdef KeyRelease -#undef KeyRelease -#endif - -bool QXlibScreen::handleEvent(XEvent *xe) -{ - int quit = false; - QXlibWindow *platformWindow = 0; - QWidget *widget = QWidget::find(xe->xany.window); - if (widget) { - platformWindow = static_cast<QXlibWindow *>(widget->platformWindow()); - } - - Atom wmProtocolsAtom = QXlibStatic::atom(QXlibStatic::WM_PROTOCOLS); - Atom wmDeleteWindowAtom = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); - switch (xe->type) { - - case ClientMessage: - if (xe->xclient.format == 32 && xe->xclient.message_type == wmProtocolsAtom) { - Atom a = xe->xclient.data.l[0]; - if (a == wmDeleteWindowAtom) - platformWindow->handleCloseEvent(); - } - break; - - case Expose: - if (platformWindow) - if (xe->xexpose.count == 0) - platformWindow->paintEvent(); - break; - case ConfigureNotify: - if (platformWindow) - platformWindow->resizeEvent(&xe->xconfigure); - break; - - case ButtonPress: - if (platformWindow) - platformWindow->mousePressEvent(&xe->xbutton); - break; - - case ButtonRelease: - if (platformWindow) - platformWindow->handleMouseEvent(QEvent::MouseButtonRelease, &xe->xbutton); - break; - - case MotionNotify: - if (platformWindow) - platformWindow->handleMouseEvent(QEvent::MouseMove, &xe->xbutton); - break; - - case XKeyPress: - mKeyboard->handleKeyEvent(widget,QEvent::KeyPress, &xe->xkey); - break; - - case XKeyRelease: - mKeyboard->handleKeyEvent(widget,QEvent::KeyRelease, &xe->xkey); - break; - - case EnterNotify: - if (platformWindow) - platformWindow->handleEnterEvent(); - break; - - case LeaveNotify: - if (platformWindow) - platformWindow->handleLeaveEvent(); - break; - - case XFocusIn: - if (platformWindow) - platformWindow->handleFocusInEvent(); - break; - - case XFocusOut: - if (platformWindow) - platformWindow->handleFocusOutEvent(); - break; - - case PropertyNotify: - break; - - case SelectionClear: - qDebug() << "Selection Clear!!!"; - break; - case SelectionRequest: - handleSelectionRequest(xe); - break; - case SelectionNotify: - qDebug() << "Selection Notify!!!!"; - - break; - - - default: -#ifdef MYX11_DEBUG - qDebug() << hex << xe->xany.window << "Other X event" << xe->type; -#endif - break; - } - - return quit; -} - -static Bool checkForClipboardEvents(Display *, XEvent *e, XPointer) -{ - Atom clipboard = QXlibStatic::atom(QXlibStatic::CLIPBOARD); - return ((e->type == SelectionRequest && (e->xselectionrequest.selection == XA_PRIMARY - || e->xselectionrequest.selection == clipboard)) - || (e->type == SelectionClear && (e->xselectionclear.selection == XA_PRIMARY - || e->xselectionclear.selection == clipboard))); -} - -bool QXlibScreen::waitForClipboardEvent(Window win, int type, XEvent *event, int timeout) -{ - QElapsedTimer timer; - timer.start(); - do { - if (XCheckTypedWindowEvent(mDisplay,win,type,event)) - return true; - - // process other clipboard events, since someone is probably requesting data from us - XEvent e; - if (XCheckIfEvent(mDisplay, &e, checkForClipboardEvents, 0)) - handleEvent(&e); - - XFlush(mDisplay); - - // sleep 50 ms, so we don't use up CPU cycles all the time. - struct timeval usleep_tv; - usleep_tv.tv_sec = 0; - usleep_tv.tv_usec = 50000; - select(0, 0, 0, 0, &usleep_tv); - } while (timer.elapsed() < timeout); - return false; -} - -void QXlibScreen::eventDispatcher() -{ - ulong marker = XNextRequest(mDisplay); - // int i = 0; - while (XPending(mDisplay)) { - XEvent event; - XNextEvent(mDisplay, &event); - /* done = */ - handleEvent(&event); - - if (event.xany.serial >= marker) { - #ifdef MYX11_DEBUG - qDebug() << "potential livelock averted"; - #endif - #if 0 - if (XEventsQueued(mDisplay, QueuedAfterFlush)) { - qDebug() << " with events queued"; - QTimer::singleShot(0, this, SLOT(eventDispatcher())); - } - #endif - break; - } - } -} - -QImage QXlibScreen::grabWindow(Window window, int x, int y, int w, int h) -{ - if (w == 0 || h ==0) - return QImage(); - - //WinId 0 means the desktop widget - if (!window) - window = rootWindow(); - - XWindowAttributes window_attr; - if (!XGetWindowAttributes(mDisplay, window, &window_attr)) - return QImage(); - - if (w < 0) - w = window_attr.width - x; - if (h < 0) - h = window_attr.height - y; - - // Ideally, we should also limit ourselves to the screen area, but the Qt docs say - // that it's "unsafe" to go outside the screen, so we can ignore that problem. - - //We're definitely not optimizing for speed... - XImage *xi = XGetImage(mDisplay, window, x, y, w, h, AllPlanes, ZPixmap); - - if (!xi) - return QImage(); - - //taking a copy to make sure we have ownership -- not fast - QImage result = QImage( (uchar*) xi->data, xi->width, xi->height, xi->bytes_per_line, QImage::Format_RGB32 ).copy(); - - XDestroyImage(xi); - - return result; -} - -QXlibScreen * QXlibScreen::testLiteScreenForWidget(QWidget *widget) -{ - QPlatformScreen *platformScreen = platformScreenForWidget(widget); - return static_cast<QXlibScreen *>(platformScreen); -} - -Display * QXlibScreen::display() const -{ - return mDisplay; -} - -int QXlibScreen::xScreenNumber() const -{ - return mScreen; -} - -QXlibKeyboard * QXlibScreen::keyboard() const -{ - return mKeyboard; -} - -void QXlibScreen::handleSelectionRequest(XEvent *event) -{ - QPlatformIntegration *integration = QApplicationPrivate::platformIntegration(); - QXlibClipboard *clipboard = static_cast<QXlibClipboard *>(integration->clipboard()); - clipboard->handleSelectionRequest(event); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitescreen.h b/src/plugins/platforms/testlite/qtestlitescreen.h deleted file mode 100644 index 7e59a59..0000000 --- a/src/plugins/platforms/testlite/qtestlitescreen.h +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITESCREEN_H -#define QTESTLITESCREEN_H - -#include <QtGui/QPlatformScreen> -#include "qtestliteintegration.h" - -QT_BEGIN_NAMESPACE - -class QXlibCursor; -class QXlibKeyboard; - -class QXlibScreen : public QPlatformScreen -{ - Q_OBJECT -public: - QXlibScreen(); - - ~QXlibScreen(); - - QString displayName() const { return mDisplayName; } - - QRect geometry() const { return mGeometry; } - int depth() const { return mDepth; } - QImage::Format format() const { return mFormat; } - QSize physicalSize() const { return mPhysicalSize; } - - Window rootWindow() { return RootWindow(mDisplay, mScreen); } - unsigned long blackPixel() { return BlackPixel(mDisplay, mScreen); } - unsigned long whitePixel() { return WhitePixel(mDisplay, mScreen); } - - bool handleEvent(XEvent *xe); - bool waitForClipboardEvent(Window win, int type, XEvent *event, int timeout); - - QImage grabWindow(Window window, int x, int y, int w, int h); - - static QXlibScreen *testLiteScreenForWidget(QWidget *widget); - - Display *display() const; - int xScreenNumber() const; - - QXlibKeyboard *keyboard() const; - -public slots: - void eventDispatcher(); - -private: - - void handleSelectionRequest(XEvent *event); - QString mDisplayName; - QRect mGeometry; - QSize mPhysicalSize; - int mDepth; - QImage::Format mFormat; - QXlibCursor *mCursor; - QXlibKeyboard *mKeyboard; - - Display * mDisplay; - int mScreen; -}; - -QT_END_NAMESPACE - -#endif // QTESTLITESCREEN_H diff --git a/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp b/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp deleted file mode 100644 index 837636c..0000000 --- a/src/plugins/platforms/testlite/qtestlitestaticinfo.cpp +++ /dev/null @@ -1,511 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitestaticinfo.h" -#include "qtestlitescreen.h" - -#include <qplatformdefs.h> - -#include <QtGui/private/qapplication_p.h> -#include <QtCore/QBuffer> -#include <QtCore/QLibrary> - -#include <QDebug> - -#ifndef QT_NO_XFIXES -#include <X11/extensions/Xfixes.h> -#endif // QT_NO_XFIXES - -static const char * x11_atomnames = { - // window-manager <-> client protocols - "WM_PROTOCOLS\0" - "WM_DELETE_WINDOW\0" - "WM_TAKE_FOCUS\0" - "_NET_WM_PING\0" - "_NET_WM_CONTEXT_HELP\0" - "_NET_WM_SYNC_REQUEST\0" - "_NET_WM_SYNC_REQUEST_COUNTER\0" - - // ICCCM window state - "WM_STATE\0" - "WM_CHANGE_STATE\0" - - // Session management - "WM_CLIENT_LEADER\0" - "WM_WINDOW_ROLE\0" - "SM_CLIENT_ID\0" - - // Clipboard - "CLIPBOARD\0" - "INCR\0" - "TARGETS\0" - "MULTIPLE\0" - "TIMESTAMP\0" - "SAVE_TARGETS\0" - "CLIP_TEMPORARY\0" - "_QT_SELECTION\0" - "_QT_CLIPBOARD_SENTINEL\0" - "_QT_SELECTION_SENTINEL\0" - "CLIPBOARD_MANAGER\0" - - "RESOURCE_MANAGER\0" - - "_XSETROOT_ID\0" - - "_QT_SCROLL_DONE\0" - "_QT_INPUT_ENCODING\0" - - "_MOTIF_WM_HINTS\0" - - "DTWM_IS_RUNNING\0" - "ENLIGHTENMENT_DESKTOP\0" - "_DT_SAVE_MODE\0" - "_SGI_DESKS_MANAGER\0" - - // EWMH (aka NETWM) - "_NET_SUPPORTED\0" - "_NET_VIRTUAL_ROOTS\0" - "_NET_WORKAREA\0" - - "_NET_MOVERESIZE_WINDOW\0" - "_NET_WM_MOVERESIZE\0" - - "_NET_WM_NAME\0" - "_NET_WM_ICON_NAME\0" - "_NET_WM_ICON\0" - - "_NET_WM_PID\0" - - "_NET_WM_WINDOW_OPACITY\0" - - "_NET_WM_STATE\0" - "_NET_WM_STATE_ABOVE\0" - "_NET_WM_STATE_BELOW\0" - "_NET_WM_STATE_FULLSCREEN\0" - "_NET_WM_STATE_MAXIMIZED_HORZ\0" - "_NET_WM_STATE_MAXIMIZED_VERT\0" - "_NET_WM_STATE_MODAL\0" - "_NET_WM_STATE_STAYS_ON_TOP\0" - "_NET_WM_STATE_DEMANDS_ATTENTION\0" - - "_NET_WM_USER_TIME\0" - "_NET_WM_USER_TIME_WINDOW\0" - "_NET_WM_FULL_PLACEMENT\0" - - "_NET_WM_WINDOW_TYPE\0" - "_NET_WM_WINDOW_TYPE_DESKTOP\0" - "_NET_WM_WINDOW_TYPE_DOCK\0" - "_NET_WM_WINDOW_TYPE_TOOLBAR\0" - "_NET_WM_WINDOW_TYPE_MENU\0" - "_NET_WM_WINDOW_TYPE_UTILITY\0" - "_NET_WM_WINDOW_TYPE_SPLASH\0" - "_NET_WM_WINDOW_TYPE_DIALOG\0" - "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU\0" - "_NET_WM_WINDOW_TYPE_POPUP_MENU\0" - "_NET_WM_WINDOW_TYPE_TOOLTIP\0" - "_NET_WM_WINDOW_TYPE_NOTIFICATION\0" - "_NET_WM_WINDOW_TYPE_COMBO\0" - "_NET_WM_WINDOW_TYPE_DND\0" - "_NET_WM_WINDOW_TYPE_NORMAL\0" - "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE\0" - - "_KDE_NET_WM_FRAME_STRUT\0" - - "_NET_STARTUP_INFO\0" - "_NET_STARTUP_INFO_BEGIN\0" - - "_NET_SUPPORTING_WM_CHECK\0" - - "_NET_WM_CM_S0\0" - - "_NET_SYSTEM_TRAY_VISUAL\0" - - "_NET_ACTIVE_WINDOW\0" - - // Property formats - "COMPOUND_TEXT\0" - "TEXT\0" - "UTF8_STRING\0" - - // xdnd - "XdndEnter\0" - "XdndPosition\0" - "XdndStatus\0" - "XdndLeave\0" - "XdndDrop\0" - "XdndFinished\0" - "XdndTypeList\0" - "XdndActionList\0" - - "XdndSelection\0" - - "XdndAware\0" - "XdndProxy\0" - - "XdndActionCopy\0" - "XdndActionLink\0" - "XdndActionMove\0" - "XdndActionPrivate\0" - - // Motif DND - "_MOTIF_DRAG_AND_DROP_MESSAGE\0" - "_MOTIF_DRAG_INITIATOR_INFO\0" - "_MOTIF_DRAG_RECEIVER_INFO\0" - "_MOTIF_DRAG_WINDOW\0" - "_MOTIF_DRAG_TARGETS\0" - - "XmTRANSFER_SUCCESS\0" - "XmTRANSFER_FAILURE\0" - - // Xkb - "_XKB_RULES_NAMES\0" - - // XEMBED - "_XEMBED\0" - "_XEMBED_INFO\0" - - // Wacom old. (before version 0.10) - "Wacom Stylus\0" - "Wacom Cursor\0" - "Wacom Eraser\0" - - // Tablet - "STYLUS\0" - "ERASER\0" -}; - -/*! - \internal - Try to resolve a \a symbol from \a library with the version specified - by \a vernum. - - Note that, in the case of the Xfixes library, \a vernum is not the same as - \c XFIXES_MAJOR - it is a part of soname and may differ from the Xfixes - version. -*/ -static void* qt_load_library_runtime(const char *library, int vernum, - int highestVernum, const char *symbol) -{ - QList<int> versions; - // we try to load in the following order: - // explicit version -> the default one -> (from the highest (highestVernum) to the lowest (vernum) ) - if (vernum != -1) - versions << vernum; - versions << -1; - if (vernum != -1) { - for(int i = highestVernum; i > vernum; --i) - versions << i; - } - Q_FOREACH(int version, versions) { - QLatin1String libName(library); - QLibrary xfixesLib(libName, version); - void *ptr = xfixesLib.resolve(symbol); - if (ptr) - return ptr; - } - return 0; -} - -# define XFIXES_LOAD_RUNTIME(vernum, symbol, symbol_type) \ - (symbol_type)qt_load_library_runtime("libXfixes", vernum, 4, #symbol); -# define XFIXES_LOAD_V1(symbol) \ - XFIXES_LOAD_RUNTIME(1, symbol, Ptr##symbol) -# define XFIXES_LOAD_V2(symbol) \ - XFIXES_LOAD_RUNTIME(2, symbol, Ptr##symbol) - - -class QTestLiteStaticInfoPrivate -{ -public: - QTestLiteStaticInfoPrivate() - : use_xfixes(false) - , xfixes_major(0) - , xfixes_eventbase(0) - , xfixes_errorbase(0) - { - QXlibScreen *screen = qobject_cast<QXlibScreen *> (QApplicationPrivate::platformIntegration()->screens().at(0)); - Q_ASSERT(screen); - - initializeAllAtoms(screen); - initializeSupportedAtoms(screen); - - resolveXFixes(screen); - } - - bool isSupportedByWM(Atom atom) - { - if (!m_supportedAtoms) - return false; - - bool supported = false; - int i = 0; - while (m_supportedAtoms[i] != 0) { - if (m_supportedAtoms[i++] == atom) { - supported = true; - break; - } - } - - return supported; - } - - Atom atom(QXlibStatic::X11Atom atom) - { - return m_allAtoms[atom]; - } - - bool useXFixes() const { return use_xfixes; } - - int xFixesEventBase() const {return xfixes_eventbase; } - - PtrXFixesSelectSelectionInput xFixesSelectSelectionInput() const - { - return ptrXFixesSelectSelectionInput; - } - - QImage qimageFromXImage(XImage *xi) - { - QImage::Format format = QImage::Format_ARGB32_Premultiplied; - if (xi->depth == 24) - format = QImage::Format_RGB32; - else if (xi->depth == 16) - format = QImage::Format_RGB16; - - QImage image = QImage((uchar *)xi->data, xi->width, xi->height, xi->bytes_per_line, format).copy(); - - // we may have to swap the byte order - if ((QSysInfo::ByteOrder == QSysInfo::LittleEndian && xi->byte_order == MSBFirst) - || (QSysInfo::ByteOrder == QSysInfo::BigEndian && xi->byte_order == LSBFirst)) - { - for (int i=0; i < image.height(); i++) { - if (xi->depth == 16) { - ushort *p = (ushort*)image.scanLine(i); - ushort *end = p + image.width(); - while (p < end) { - *p = ((*p << 8) & 0xff00) | ((*p >> 8) & 0x00ff); - p++; - } - } else { - uint *p = (uint*)image.scanLine(i); - uint *end = p + image.width(); - while (p < end) { - *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000) - | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff); - p++; - } - } - } - } - - // fix-up alpha channel - if (format == QImage::Format_RGB32) { - QRgb *p = (QRgb *)image.bits(); - for (int y = 0; y < xi->height; ++y) { - for (int x = 0; x < xi->width; ++x) - p[x] |= 0xff000000; - p += xi->bytes_per_line / 4; - } - } - - return image; - } - - -private: - - void initializeAllAtoms(QXlibScreen *screen) { - const char *names[QXlibStatic::NAtoms]; - const char *ptr = x11_atomnames; - - int i = 0; - while (*ptr) { - names[i++] = ptr; - while (*ptr) - ++ptr; - ++ptr; - } - - Q_ASSERT(i == QXlibStatic::NPredefinedAtoms); - - QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_"); - settings_atom_name += XDisplayName(qPrintable(screen->displayName())); - names[i++] = settings_atom_name; - - Q_ASSERT(i == QXlibStatic::NAtoms); - #if 0//defined(XlibSpecificationRelease) && (XlibSpecificationRelease >= 6) - XInternAtoms(screen->display(), (char **)names, i, False, m_allAtoms); - #else - for (i = 0; i < QXlibStatic::NAtoms; ++i) - m_allAtoms[i] = XInternAtom(screen->display(), (char *)names[i], False); - #endif - } - - void initializeSupportedAtoms(QXlibScreen *screen) - { - Atom type; - int format; - long offset = 0; - unsigned long nitems, after; - unsigned char *data = 0; - - int e = XGetWindowProperty(screen->display(), screen->rootWindow(), - this->atom(QXlibStatic::_NET_SUPPORTED), 0, 0, - False, XA_ATOM, &type, &format, &nitems, &after, &data); - if (data) - XFree(data); - - if (e == Success && type == XA_ATOM && format == 32) { - QBuffer ts; - ts.open(QIODevice::WriteOnly); - - while (after > 0) { - XGetWindowProperty(screen->display(), screen->rootWindow(), - this->atom(QXlibStatic::_NET_SUPPORTED), offset, 1024, - False, XA_ATOM, &type, &format, &nitems, &after, &data); - - if (type == XA_ATOM && format == 32) { - ts.write(reinterpret_cast<char *>(data), nitems * sizeof(long)); - offset += nitems; - } else - after = 0; - if (data) - XFree(data); - } - - // compute nitems - QByteArray buffer(ts.buffer()); - nitems = buffer.size() / sizeof(Atom); - m_supportedAtoms = new Atom[nitems + 1]; - Atom *a = (Atom *) buffer.data(); - uint i; - for (i = 0; i < nitems; i++) - m_supportedAtoms[i] = a[i]; - m_supportedAtoms[nitems] = 0; - - } - } - - void resolveXFixes(QXlibScreen *screen) - { -#ifndef QT_NO_XFIXES - // See if Xfixes is supported on the connected display - if (XQueryExtension(screen->display(), "XFIXES", &xfixes_major, - &xfixes_eventbase, &xfixes_errorbase)) { - ptrXFixesQueryExtension = XFIXES_LOAD_V1(XFixesQueryExtension); - ptrXFixesQueryVersion = XFIXES_LOAD_V1(XFixesQueryVersion); - ptrXFixesSetCursorName = XFIXES_LOAD_V2(XFixesSetCursorName); - ptrXFixesSelectSelectionInput = XFIXES_LOAD_V2(XFixesSelectSelectionInput); - - if(ptrXFixesQueryExtension && ptrXFixesQueryVersion - && ptrXFixesQueryExtension(screen->display(), &xfixes_eventbase, - &xfixes_errorbase)) { - // Xfixes is supported. - // Note: the XFixes protocol version is negotiated using QueryVersion. - // We supply the highest version we support, the X server replies with - // the highest version it supports, but no higher than the version we - // asked for. The version sent back is the protocol version the X server - // will use to talk us. If this call is removed, the behavior of the - // X server when it receives an XFixes request is undefined. - int major = 3; - int minor = 0; - ptrXFixesQueryVersion(screen->display(), &major, &minor); - use_xfixes = (major >= 1); - xfixes_major = major; - } - } -#endif // QT_NO_XFIXES - - } - - Atom *m_supportedAtoms; - Atom m_allAtoms[QXlibStatic::NAtoms]; - -#ifndef QT_NO_XFIXES - PtrXFixesQueryExtension ptrXFixesQueryExtension; - PtrXFixesQueryVersion ptrXFixesQueryVersion; - PtrXFixesSetCursorName ptrXFixesSetCursorName; - PtrXFixesSelectSelectionInput ptrXFixesSelectSelectionInput; -#endif - - bool use_xfixes; - int xfixes_major; - int xfixes_eventbase; - int xfixes_errorbase; - -}; -Q_GLOBAL_STATIC(QTestLiteStaticInfoPrivate, qTestLiteStaticInfoPrivate); - - -Atom QXlibStatic::atom(QXlibStatic::X11Atom atom) -{ - return qTestLiteStaticInfoPrivate()->atom(atom); -} - -bool QXlibStatic::isSupportedByWM(Atom atom) -{ - return qTestLiteStaticInfoPrivate()->isSupportedByWM(atom); -} - -bool QXlibStatic::useXFixes() -{ - return qTestLiteStaticInfoPrivate()->useXFixes(); -} - -int QXlibStatic::xFixesEventBase() -{ - return qTestLiteStaticInfoPrivate()->xFixesEventBase(); -} - -#ifndef QT_NO_XFIXES -PtrXFixesSelectSelectionInput QXlibStatic::xFixesSelectSelectionInput() -{ - qDebug() << qTestLiteStaticInfoPrivate()->useXFixes(); - if (!qTestLiteStaticInfoPrivate()->useXFixes()) - return 0; - - return qTestLiteStaticInfoPrivate()->xFixesSelectSelectionInput(); -} - -QImage QXlibStatic::qimageFromXImage(XImage *xi) -{ - return qTestLiteStaticInfoPrivate()->qimageFromXImage(xi); -} -#endif //QT_NO_XFIXES diff --git a/src/plugins/platforms/testlite/qtestlitestaticinfo.h b/src/plugins/platforms/testlite/qtestlitestaticinfo.h deleted file mode 100644 index 8473ee9..0000000 --- a/src/plugins/platforms/testlite/qtestlitestaticinfo.h +++ /dev/null @@ -1,413 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITESTATICINFO_H -#define QTESTLITESTATICINFO_H - -#include <QtCore/QTextStream> -#include <QtCore/QDataStream> -#include <QtCore/QMetaType> -#include <QtCore/QVariant> - -#if defined(_XLIB_H_) // crude hack, but... -#error "cannot include <X11/Xlib.h> before this file" -#endif -#define XRegisterIMInstantiateCallback qt_XRegisterIMInstantiateCallback -#define XUnregisterIMInstantiateCallback qt_XUnregisterIMInstantiateCallback -#define XSetIMValues qt_XSetIMValues -#include <X11/Xlib.h> -#undef XRegisterIMInstantiateCallback -#undef XUnregisterIMInstantiateCallback -#undef XSetIMValues - -#include <X11/Xutil.h> -#include <X11/Xos.h> -#ifdef index -# undef index -#endif -#ifdef rindex -# undef rindex -#endif -#ifdef Q_OS_VXWORS -# ifdef open -# undef open -# endif -# ifdef getpid -# undef getpid -# endif -#endif // Q_OS_VXWORKS -#include <X11/Xatom.h> - -//#define QT_NO_SHAPE -#ifdef QT_NO_SHAPE -# define XShapeCombineRegion(a,b,c,d,e,f,g) -# define XShapeCombineMask(a,b,c,d,e,f,g) -#else -# include <X11/extensions/shape.h> -#endif // QT_NO_SHAPE - - -#if !defined (QT_NO_TABLET) -# include <X11/extensions/XInput.h> -#if defined (Q_OS_IRIX) -# include <X11/extensions/SGIMisc.h> -# include <wacom.h> -#endif -#endif // QT_NO_TABLET - - -// #define QT_NO_XINERAMA -#ifndef QT_NO_XINERAMA -// XFree86 does not C++ify Xinerama (at least up to XFree86 4.0.3). -extern "C" { -# include <X11/extensions/Xinerama.h> -} -#endif // QT_NO_XINERAMA - -// #define QT_NO_XRANDR -#ifndef QT_NO_XRANDR -# include <X11/extensions/Xrandr.h> -#endif // QT_NO_XRANDR - -// #define QT_NO_XRENDER -#ifndef QT_NO_XRENDER -# include <X11/extensions/Xrender.h> -#endif // QT_NO_XRENDER - -#ifndef QT_NO_XSYNC -extern "C" { -# include "X11/extensions/sync.h" -} -#endif - -// #define QT_NO_XKB -#ifndef QT_NO_XKB -# include <X11/XKBlib.h> -#endif // QT_NO_XKB - - -#if !defined(XlibSpecificationRelease) -# define X11R4 -typedef char *XPointer; -#else -# undef X11R4 -#endif - -#ifndef QT_NO_XFIXES -typedef Bool (*PtrXFixesQueryExtension)(Display *, int *, int *); -typedef Status (*PtrXFixesQueryVersion)(Display *, int *, int *); -typedef void (*PtrXFixesSetCursorName)(Display *dpy, Cursor cursor, const char *name); -typedef void (*PtrXFixesSelectSelectionInput)(Display *dpy, Window win, Atom selection, unsigned long eventMask); -#endif // QT_NO_XFIXES - -#ifndef QT_NO_XCURSOR -#include <X11/Xcursor/Xcursor.h> -typedef Cursor (*PtrXcursorLibraryLoadCursor)(Display *, const char *); -#endif // QT_NO_XCURSOR - -#ifndef QT_NO_XINERAMA -typedef Bool (*PtrXineramaQueryExtension)(Display *dpy, int *event_base, int *error_base); -typedef Bool (*PtrXineramaIsActive)(Display *dpy); -typedef XineramaScreenInfo *(*PtrXineramaQueryScreens)(Display *dpy, int *number); -#endif // QT_NO_XINERAMA - -#ifndef QT_NO_XRANDR -typedef void (*PtrXRRSelectInput)(Display *, Window, int); -typedef int (*PtrXRRUpdateConfiguration)(XEvent *); -typedef int (*PtrXRRRootToScreen)(Display *, Window); -typedef Bool (*PtrXRRQueryExtension)(Display *, int *, int *); -#endif // QT_NO_XRANDR - -#ifndef QT_NO_XINPUT -typedef int (*PtrXCloseDevice)(Display *, XDevice *); -typedef XDeviceInfo* (*PtrXListInputDevices)(Display *, int *); -typedef XDevice* (*PtrXOpenDevice)(Display *, XID); -typedef void (*PtrXFreeDeviceList)(XDeviceInfo *); -typedef int (*PtrXSelectExtensionEvent)(Display *, Window, XEventClass *, int); -#endif // QT_NO_XINPUT - -/* - * Solaris patch 108652-47 and higher fixes crases in - * XRegisterIMInstantiateCallback, but the function doesn't seem to - * work. - * - * Instead, we disabled R6 input, and open the input method - * immediately at application start. - */ - -//######### XFree86 has wrong declarations for XRegisterIMInstantiateCallback -//######### and XUnregisterIMInstantiateCallback in at least version 3.3.2. -//######### Many old X11R6 header files lack XSetIMValues. -//######### Therefore, we have to declare these functions ourselves. - -extern "C" Bool XRegisterIMInstantiateCallback( - Display*, - struct _XrmHashBucketRec*, - char*, - char*, - XIMProc, //XFree86 has XIDProc, which has to be wrong - XPointer -); - -extern "C" Bool XUnregisterIMInstantiateCallback( - Display*, - struct _XrmHashBucketRec*, - char*, - char*, - XIMProc, //XFree86 has XIDProc, which has to be wrong - XPointer -); - -#ifndef X11R4 -# include <X11/Xlocale.h> -#endif // X11R4 - - -#ifndef QT_NO_MITSHM -# include <X11/extensions/XShm.h> -#endif // QT_NO_MITSHM - -// rename a couple of X defines to get rid of name clashes -// resolve the conflict between X11's FocusIn and QEvent::FocusIn -enum { - XFocusOut = FocusOut, - XFocusIn = FocusIn, - XKeyPress = KeyPress, - XKeyRelease = KeyRelease, - XNone = None, - XRevertToParent = RevertToParent, - XGrayScale = GrayScale, - XCursorShape = CursorShape -}; -#undef FocusOut -#undef FocusIn -#undef KeyPress -#undef KeyRelease -#undef None -#undef RevertToParent -#undef GrayScale -#undef CursorShape - -#ifdef FontChange -#undef FontChange -#endif - - -class QXlibStatic -{ -public: - enum X11Atom { - // window-manager <-> client protocols - WM_PROTOCOLS, - WM_DELETE_WINDOW, - WM_TAKE_FOCUS, - _NET_WM_PING, - _NET_WM_CONTEXT_HELP, - _NET_WM_SYNC_REQUEST, - _NET_WM_SYNC_REQUEST_COUNTER, - - // ICCCM window state - WM_STATE, - WM_CHANGE_STATE, - - // Session management - WM_CLIENT_LEADER, - WM_WINDOW_ROLE, - SM_CLIENT_ID, - - // Clipboard - CLIPBOARD, - INCR, - TARGETS, - MULTIPLE, - TIMESTAMP, - SAVE_TARGETS, - CLIP_TEMPORARY, - _QT_SELECTION, - _QT_CLIPBOARD_SENTINEL, - _QT_SELECTION_SENTINEL, - CLIPBOARD_MANAGER, - - RESOURCE_MANAGER, - - _XSETROOT_ID, - - _QT_SCROLL_DONE, - _QT_INPUT_ENCODING, - - _MOTIF_WM_HINTS, - - DTWM_IS_RUNNING, - ENLIGHTENMENT_DESKTOP, - _DT_SAVE_MODE, - _SGI_DESKS_MANAGER, - - // EWMH (aka NETWM) - _NET_SUPPORTED, - _NET_VIRTUAL_ROOTS, - _NET_WORKAREA, - - _NET_MOVERESIZE_WINDOW, - _NET_WM_MOVERESIZE, - - _NET_WM_NAME, - _NET_WM_ICON_NAME, - _NET_WM_ICON, - - _NET_WM_PID, - - _NET_WM_WINDOW_OPACITY, - - _NET_WM_STATE, - _NET_WM_STATE_ABOVE, - _NET_WM_STATE_BELOW, - _NET_WM_STATE_FULLSCREEN, - _NET_WM_STATE_MAXIMIZED_HORZ, - _NET_WM_STATE_MAXIMIZED_VERT, - _NET_WM_STATE_MODAL, - _NET_WM_STATE_STAYS_ON_TOP, - _NET_WM_STATE_DEMANDS_ATTENTION, - - _NET_WM_USER_TIME, - _NET_WM_USER_TIME_WINDOW, - _NET_WM_FULL_PLACEMENT, - - _NET_WM_WINDOW_TYPE, - _NET_WM_WINDOW_TYPE_DESKTOP, - _NET_WM_WINDOW_TYPE_DOCK, - _NET_WM_WINDOW_TYPE_TOOLBAR, - _NET_WM_WINDOW_TYPE_MENU, - _NET_WM_WINDOW_TYPE_UTILITY, - _NET_WM_WINDOW_TYPE_SPLASH, - _NET_WM_WINDOW_TYPE_DIALOG, - _NET_WM_WINDOW_TYPE_DROPDOWN_MENU, - _NET_WM_WINDOW_TYPE_POPUP_MENU, - _NET_WM_WINDOW_TYPE_TOOLTIP, - _NET_WM_WINDOW_TYPE_NOTIFICATION, - _NET_WM_WINDOW_TYPE_COMBO, - _NET_WM_WINDOW_TYPE_DND, - _NET_WM_WINDOW_TYPE_NORMAL, - _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, - - _KDE_NET_WM_FRAME_STRUT, - - _NET_STARTUP_INFO, - _NET_STARTUP_INFO_BEGIN, - - _NET_SUPPORTING_WM_CHECK, - - _NET_WM_CM_S0, - - _NET_SYSTEM_TRAY_VISUAL, - - _NET_ACTIVE_WINDOW, - - // Property formats - COMPOUND_TEXT, - TEXT, - UTF8_STRING, - - // Xdnd - XdndEnter, - XdndPosition, - XdndStatus, - XdndLeave, - XdndDrop, - XdndFinished, - XdndTypelist, - XdndActionList, - - XdndSelection, - - XdndAware, - XdndProxy, - - XdndActionCopy, - XdndActionLink, - XdndActionMove, - XdndActionPrivate, - - // Motif DND - _MOTIF_DRAG_AND_DROP_MESSAGE, - _MOTIF_DRAG_INITIATOR_INFO, - _MOTIF_DRAG_RECEIVER_INFO, - _MOTIF_DRAG_WINDOW, - _MOTIF_DRAG_TARGETS, - - XmTRANSFER_SUCCESS, - XmTRANSFER_FAILURE, - - // Xkb - _XKB_RULES_NAMES, - - // XEMBED - _XEMBED, - _XEMBED_INFO, - - XWacomStylus, - XWacomCursor, - XWacomEraser, - - XTabletStylus, - XTabletEraser, - - NPredefinedAtoms, - - _QT_SETTINGS_TIMESTAMP = NPredefinedAtoms, - NAtoms - }; - - static Atom atom(X11Atom atom); - static bool isSupportedByWM(Atom atom); - - static bool useXFixes(); - static int xFixesEventBase(); - - #ifndef QT_NO_XFIXES - static PtrXFixesSelectSelectionInput xFixesSelectSelectionInput(); - #endif //QT_NO_XFIXES - - static QImage qimageFromXImage(XImage *xi); - - -}; - -#endif // QTESTLITESTATICINFO_H diff --git a/src/plugins/platforms/testlite/qtestlitewindow.cpp b/src/plugins/platforms/testlite/qtestlitewindow.cpp deleted file mode 100644 index 0f11a81..0000000 --- a/src/plugins/platforms/testlite/qtestlitewindow.cpp +++ /dev/null @@ -1,735 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitewindow.h" - -#include "qtestliteintegration.h" -#include "qtestlitescreen.h" -#include "qtestlitekeyboard.h" -#include "qtestlitestaticinfo.h" - -#include <QtGui/QWindowSystemInterface> -#include <QSocketNotifier> -#include <QApplication> -#include <QDebug> - -#include <QtGui/private/qwindowsurface_p.h> -#include <QtGui/private/qapplication_p.h> - -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) -#include "qglxintegration.h" -#else -#include "../eglconvenience/qeglconvenience.h" -#include "../eglconvenience/qeglplatformcontext.h" -#include "qtestliteeglintegration.h" -#endif //QT_OPENGL_ES_2 -#endif //QT_NO_OPENGL - -//#define MYX11_DEBUG - -QT_BEGIN_NAMESPACE - -QXlibWindow::QXlibWindow(QWidget *window) - : QPlatformWindow(window) - , mGLContext(0) - , mScreen(QXlibScreen::testLiteScreenForWidget(window)) -{ - int x = window->x(); - int y = window->y(); - int w = window->width(); - int h = window->height(); - - if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL - && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) - XVisualInfo *visualInfo = QGLXContext::findVisualInfo(mScreen,window->platformWindowFormat()); -#else - QPlatformWindowFormat windowFormat = correctColorBuffers(window->platformWindowFormat()); - - EGLDisplay eglDisplay = eglGetDisplay(mScreen->display()); - EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,windowFormat); - VisualID id = QXlibEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); - - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - visualInfoTemplate.visualid = id; - - XVisualInfo *visualInfo; - int matchingCount = 0; - visualInfo = XGetVisualInfo(mScreen->display(), VisualIDMask, &visualInfoTemplate, &matchingCount); -#endif //!defined(QT_OPENGL_ES_2) - if (visualInfo) { - Colormap cmap = XCreateColormap(mScreen->display(),mScreen->rootWindow(),visualInfo->visual,AllocNone); - - XSetWindowAttributes a; - a.colormap = cmap; - x_window = XCreateWindow(mScreen->display(), mScreen->rootWindow(),x, y, w, h, - 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWColormap, &a); - } else { - qFatal("no window!"); - } -#endif //!defined(QT_NO_OPENGL) - } else { - x_window = XCreateSimpleWindow(mScreen->display(), mScreen->rootWindow(), - x, y, w, h, 0 /*border_width*/, - mScreen->blackPixel(), mScreen->whitePixel()); - } - -#ifdef MYX11_DEBUG - qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; -#endif - - XSetWindowBackgroundPixmap(mScreen->display(), x_window, XNone); - - XSelectInput(mScreen->display(), x_window, - ExposureMask | KeyPressMask | KeyReleaseMask | - EnterWindowMask | LeaveWindowMask | FocusChangeMask | - PointerMotionMask | ButtonPressMask | ButtonReleaseMask | - ButtonMotionMask | PropertyChangeMask | - StructureNotifyMask); - - gc = createGC(); - - Atom protocols[5]; - int n = 0; - protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); // support del window protocol - protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_TAKE_FOCUS); // support take focus window protocol - protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_PING); // support _NET_WM_PING protocol -#ifndef QT_NO_XSYNC - protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_SYNC_REQUEST); // support _NET_WM_SYNC_REQUEST protocol -#endif // QT_NO_XSYNC - if (window->windowFlags() & Qt::WindowContextHelpButtonHint) - protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_CONTEXT_HELP); - XSetWMProtocols(mScreen->display(), x_window, protocols, n); -} - - - -QXlibWindow::~QXlibWindow() -{ -#ifdef MYX11_DEBUG - qDebug() << "~QTestLiteWindow" << hex << x_window; -#endif - delete mGLContext; - XFreeGC(mScreen->display(), gc); - XDestroyWindow(mScreen->display(), x_window); -} - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Mouse event stuff -static Qt::MouseButtons translateMouseButtons(int s) -{ - Qt::MouseButtons ret = 0; - if (s & Button1Mask) - ret |= Qt::LeftButton; - if (s & Button2Mask) - ret |= Qt::MidButton; - if (s & Button3Mask) - ret |= Qt::RightButton; - return ret; -} - - - -void QXlibWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) -{ - static QPoint mousePoint; - - Qt::MouseButton button = Qt::NoButton; - Qt::MouseButtons buttons = translateMouseButtons(e->state); - Qt::KeyboardModifiers modifiers = mScreen->keyboard()->translateModifiers(e->state); - if (type != QEvent::MouseMove) { - switch (e->button) { - case Button1: button = Qt::LeftButton; break; - case Button2: button = Qt::MidButton; break; - case Button3: button = Qt::RightButton; break; - case Button4: - case Button5: - case 6: - case 7: { - //mouse wheel - if (type == QEvent::MouseButtonPress) { - //logic borrowed from qapplication_x11.cpp - int delta = 120 * ((e->button == Button4 || e->button == 6) ? 1 : -1); - bool hor = (((e->button == Button4 || e->button == Button5) - && (modifiers & Qt::AltModifier)) - || (e->button == 6 || e->button == 7)); - QWindowSystemInterface::handleWheelEvent(widget(), e->time, - QPoint(e->x, e->y), - QPoint(e->x_root, e->y_root), - delta, hor ? Qt::Horizontal : Qt::Vertical); - } - return; - } - default: break; - } - } - - buttons ^= button; // X event uses state *before*, Qt uses state *after* - - QWindowSystemInterface::handleMouseEvent(widget(), e->time, QPoint(e->x, e->y), - QPoint(e->x_root, e->y_root), - buttons); - - mousePoint = QPoint(e->x_root, e->y_root); -} - -void QXlibWindow::handleCloseEvent() -{ - QWindowSystemInterface::handleCloseEvent(widget()); -} - - -void QXlibWindow::handleEnterEvent() -{ - QWindowSystemInterface::handleEnterEvent(widget()); -} - -void QXlibWindow::handleLeaveEvent() -{ - QWindowSystemInterface::handleLeaveEvent(widget()); -} - -void QXlibWindow::handleFocusInEvent() -{ - QWindowSystemInterface::handleWindowActivated(widget()); -} - -void QXlibWindow::handleFocusOutEvent() -{ - QWindowSystemInterface::handleWindowActivated(0); -} - - - -void QXlibWindow::setGeometry(const QRect &rect) -{ - XMoveResizeWindow(mScreen->display(), x_window, rect.x(), rect.y(), rect.width(), rect.height()); - QPlatformWindow::setGeometry(rect); -} - - -Qt::WindowFlags QXlibWindow::windowFlags() const -{ - return mWindowFlags; -} - -WId QXlibWindow::winId() const -{ - return x_window; -} - -void QXlibWindow::setParent(const QPlatformWindow *window) -{ - QPoint topLeft = geometry().topLeft(); - XReparentWindow(mScreen->display(),x_window,window->winId(),topLeft.x(),topLeft.y()); -} - -void QXlibWindow::raise() -{ - XRaiseWindow(mScreen->display(), x_window); -} - -void QXlibWindow::lower() -{ - XLowerWindow(mScreen->display(), x_window); -} - -void QXlibWindow::setWindowTitle(const QString &title) -{ - QByteArray ba = title.toLatin1(); //We're not making a general solution here... - XTextProperty windowName; - windowName.value = (unsigned char *)ba.constData(); - windowName.encoding = XA_STRING; - windowName.format = 8; - windowName.nitems = ba.length(); - - XSetWMName(mScreen->display(), x_window, &windowName); -} - -GC QXlibWindow::createGC() -{ - GC gc; - - gc = XCreateGC(mScreen->display(), x_window, 0, 0); - if (gc < 0) { - qWarning("QTestLiteWindow::createGC() could not create GC"); - } - return gc; -} - -void QXlibWindow::paintEvent() -{ -#ifdef MYX11_DEBUG -// qDebug() << "QTestLiteWindow::paintEvent" << shm_img.size() << painted; -#endif - - if (QWindowSurface *surface = widget()->windowSurface()) - surface->flush(widget(), widget()->geometry(), QPoint()); -} - -void QXlibWindow::requestActivateWindow() -{ - XSetInputFocus(mScreen->display(), x_window, XRevertToParent, CurrentTime); -} - -void QXlibWindow::resizeEvent(XConfigureEvent *e) -{ - int xpos = geometry().x(); - int ypos = geometry().y(); - if ((e->width != geometry().width() || e->height != geometry().height()) && e->x == 0 && e->y == 0) { - //qDebug() << "resize with bogus pos" << e->x << e->y << e->width << e->height << "window"<< hex << window; - } else { - //qDebug() << "geometry change" << e->x << e->y << e->width << e->height << "window"<< hex << window; - xpos = e->x; - ypos = e->y; - } -#ifdef MYX11_DEBUG - qDebug() << hex << x_window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height; -#endif - - QRect newRect(xpos, ypos, e->width, e->height); - QWindowSystemInterface::handleGeometryChange(widget(), newRect); -} - -void QXlibWindow::mousePressEvent(XButtonEvent *e) -{ - static long prevTime = 0; - static Window prevWindow; - static int prevX = -999; - static int prevY = -999; - - QEvent::Type type = QEvent::MouseButtonPress; - - if (e->window == prevWindow && long(e->time) - prevTime < QApplication::doubleClickInterval() - && qAbs(e->x - prevX) < 5 && qAbs(e->y - prevY) < 5) { - type = QEvent::MouseButtonDblClick; - prevTime = e->time - QApplication::doubleClickInterval(); //no double click next time - } else { - prevTime = e->time; - } - prevWindow = e->window; - prevX = e->x; - prevY = e->y; - - handleMouseEvent(type, e); -} - -QXlibMWMHints QXlibWindow::getMWMHints() const -{ - QXlibMWMHints mwmhints; - - Atom type; - int format; - ulong nitems, bytesLeft; - uchar *data = 0; - Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); - if ((XGetWindowProperty(mScreen->display(), x_window, atomForMotifWmHints, 0, 5, false, - atomForMotifWmHints, &type, &format, &nitems, &bytesLeft, - &data) == Success) - && (type == atomForMotifWmHints - && format == 32 - && nitems >= 5)) { - mwmhints = *(reinterpret_cast<QXlibMWMHints *>(data)); - } else { - mwmhints.flags = 0L; - mwmhints.functions = MWM_FUNC_ALL; - mwmhints.decorations = MWM_DECOR_ALL; - mwmhints.input_mode = 0L; - mwmhints.status = 0L; - } - - if (data) - XFree(data); - - return mwmhints; -} - -void QXlibWindow::setMWMHints(const QXlibMWMHints &mwmhints) -{ - Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); - if (mwmhints.flags != 0l) { - XChangeProperty(mScreen->display(), x_window, - atomForMotifWmHints, atomForMotifWmHints, 32, - PropModeReplace, (unsigned char *) &mwmhints, 5); - } else { - XDeleteProperty(mScreen->display(), x_window, atomForMotifWmHints); - } -} - -// Returns true if we should set WM_TRANSIENT_FOR on \a w -static inline bool isTransient(const QWidget *w) -{ - return ((w->windowType() == Qt::Dialog - || w->windowType() == Qt::Sheet - || w->windowType() == Qt::Tool - || w->windowType() == Qt::SplashScreen - || w->windowType() == Qt::ToolTip - || w->windowType() == Qt::Drawer - || w->windowType() == Qt::Popup) - && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); -} - -QVector<Atom> QXlibWindow::getNetWmState() const -{ - QVector<Atom> returnValue; - - // Don't read anything, just get the size of the property data - Atom actualType; - int actualFormat; - ulong propertyLength; - ulong bytesLeft; - uchar *propertyData = 0; - if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, 0, - False, XA_ATOM, &actualType, &actualFormat, - &propertyLength, &bytesLeft, &propertyData) == Success - && actualType == XA_ATOM && actualFormat == 32) { - returnValue.resize(bytesLeft / 4); - XFree((char*) propertyData); - - // fetch all data - if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, - returnValue.size(), False, XA_ATOM, &actualType, &actualFormat, - &propertyLength, &bytesLeft, &propertyData) != Success) { - returnValue.clear(); - } else if (propertyLength != (ulong)returnValue.size()) { - returnValue.resize(propertyLength); - } - - // put it into netWmState - if (!returnValue.isEmpty()) { - memcpy(returnValue.data(), propertyData, returnValue.size() * sizeof(Atom)); - } - XFree((char*) propertyData); - } - - return returnValue; -} - -Qt::WindowFlags QXlibWindow::setWindowFlags(Qt::WindowFlags flags) -{ -// Q_ASSERT(flags & Qt::Window); - mWindowFlags = flags; - -#ifdef MYX11_DEBUG - qDebug() << "QTestLiteWindow::setWindowFlags" << hex << x_window << "flags" << flags; -#endif - Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask)); - - if (type == Qt::ToolTip) - flags |= Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint; - if (type == Qt::Popup) - flags |= Qt::X11BypassWindowManagerHint; - - bool topLevel = (flags & Qt::Window); - bool popup = (type == Qt::Popup); - bool dialog = (type == Qt::Dialog - || type == Qt::Sheet); - bool desktop = (type == Qt::Desktop); - bool tool = (type == Qt::Tool || type == Qt::SplashScreen - || type == Qt::ToolTip || type == Qt::Drawer); - - Q_UNUSED(topLevel); - Q_UNUSED(dialog); - Q_UNUSED(desktop); - - bool tooltip = (type == Qt::ToolTip); - - XSetWindowAttributes wsa; - - QXlibMWMHints mwmhints; - mwmhints.flags = 0L; - mwmhints.functions = 0L; - mwmhints.decorations = 0; - mwmhints.input_mode = 0L; - mwmhints.status = 0L; - - - ulong wsa_mask = 0; - if (type != Qt::SplashScreen) { // && customize) { - mwmhints.flags |= MWM_HINTS_DECORATIONS; - - bool customize = flags & Qt::CustomizeWindowHint; - if (!(flags & Qt::FramelessWindowHint) && !(customize && !(flags & Qt::WindowTitleHint))) { - mwmhints.decorations |= MWM_DECOR_BORDER; - mwmhints.decorations |= MWM_DECOR_RESIZEH; - - if (flags & Qt::WindowTitleHint) - mwmhints.decorations |= MWM_DECOR_TITLE; - - if (flags & Qt::WindowSystemMenuHint) - mwmhints.decorations |= MWM_DECOR_MENU; - - if (flags & Qt::WindowMinimizeButtonHint) { - mwmhints.decorations |= MWM_DECOR_MINIMIZE; - mwmhints.functions |= MWM_FUNC_MINIMIZE; - } - - if (flags & Qt::WindowMaximizeButtonHint) { - mwmhints.decorations |= MWM_DECOR_MAXIMIZE; - mwmhints.functions |= MWM_FUNC_MAXIMIZE; - } - - if (flags & Qt::WindowCloseButtonHint) - mwmhints.functions |= MWM_FUNC_CLOSE; - } - } else { - // if type == Qt::SplashScreen - mwmhints.decorations = MWM_DECOR_ALL; - } - - if (tool) { - wsa.save_under = True; - wsa_mask |= CWSaveUnder; - } - - if (flags & Qt::X11BypassWindowManagerHint) { - wsa.override_redirect = True; - wsa_mask |= CWOverrideRedirect; - } -#if 0 - if (wsa_mask && initializeWindow) { - Q_ASSERT(id); - XChangeWindowAttributes(dpy, id, wsa_mask, &wsa); - } -#endif - if (mwmhints.functions != 0) { - mwmhints.flags |= MWM_HINTS_FUNCTIONS; - mwmhints.functions |= MWM_FUNC_MOVE | MWM_FUNC_RESIZE; - } else { - mwmhints.functions = MWM_FUNC_ALL; - } - - if (!(flags & Qt::FramelessWindowHint) - && flags & Qt::CustomizeWindowHint - && flags & Qt::WindowTitleHint - && !(flags & - (Qt::WindowMinimizeButtonHint - | Qt::WindowMaximizeButtonHint - | Qt::WindowCloseButtonHint))) { - // a special case - only the titlebar without any button - mwmhints.flags = MWM_HINTS_FUNCTIONS; - mwmhints.functions = MWM_FUNC_MOVE | MWM_FUNC_RESIZE; - mwmhints.decorations = 0; - } - - if (widget()->windowModality() == Qt::WindowModal) { - mwmhints.input_mode = MWM_INPUT_PRIMARY_APPLICATION_MODAL; - } else if (widget()->windowModality() == Qt::ApplicationModal) { - mwmhints.input_mode = MWM_INPUT_FULL_APPLICATION_MODAL; - } - - setMWMHints(mwmhints); - - QVector<Atom> netWmState = getNetWmState(); - - if (flags & Qt::WindowStaysOnTopHint) { - if (flags & Qt::WindowStaysOnBottomHint) - qWarning() << "QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time"; - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE)); - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP)); - } else if (flags & Qt::WindowStaysOnBottomHint) { - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW)); - } - if (widget()->isFullScreen()) { - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN)); - } - if (widget()->isMaximized()) { - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ)); - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT)); - } - if (widget()->windowModality() != Qt::NonModal) { - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL)); - } - - if (!netWmState.isEmpty()) { - XChangeProperty(mScreen->display(), x_window, - QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), XA_ATOM, 32, PropModeReplace, - (unsigned char *) netWmState.data(), netWmState.size()); - } else { - XDeleteProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE)); - } - -//##### only if initializeWindow??? - - if (popup || tooltip) { // popup widget -#ifdef MYX11_DEBUG - qDebug() << "Doing XChangeWindowAttributes for popup" << wsa.override_redirect; -#endif - // set EWMH window types - // setNetWmWindowTypes(); - - wsa.override_redirect = True; - wsa.save_under = True; - XChangeWindowAttributes(mScreen->display(), x_window, CWOverrideRedirect | CWSaveUnder, - &wsa); - } else { -#ifdef MYX11_DEBUG - qDebug() << "Doing XChangeWindowAttributes for non-popup"; -#endif - } - - return flags; -} - -void QXlibWindow::setVisible(bool visible) -{ -#ifdef MYX11_DEBUG - qDebug() << "QTestLiteWindow::setVisible" << visible << hex << x_window; -#endif - if (isTransient(widget())) { - Window parentXWindow = x_window; - if (widget()->parentWidget()) { - QWidget *widgetParent = widget()->parentWidget()->window(); - if (widgetParent && widgetParent->platformWindow()) { - QXlibWindow *parentWidnow = static_cast<QXlibWindow *>(widgetParent->platformWindow()); - parentXWindow = parentWidnow->x_window; - } - } - XSetTransientForHint(mScreen->display(),x_window,parentXWindow); - } - - if (visible) { - //ensure that the window is viewed in correct position. - doSizeHints(); - XMapWindow(mScreen->display(), x_window); - } else { - XUnmapWindow(mScreen->display(), x_window); - } -} - -void QXlibWindow::setCursor(const Cursor &cursor) -{ - XDefineCursor(mScreen->display(), x_window, cursor); - XFlush(mScreen->display()); -} - -QPlatformGLContext *QXlibWindow::glContext() const -{ - if (!QApplicationPrivate::platformIntegration()->hasOpenGL()) - return 0; - if (!mGLContext) { - QXlibWindow *that = const_cast<QXlibWindow *>(this); -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) - that->mGLContext = new QGLXContext(x_window, mScreen,widget()->platformWindowFormat()); -#else - EGLDisplay display = eglGetDisplay(mScreen->display()); - - QPlatformWindowFormat windowFormat = correctColorBuffers(widget()->platformWindowFormat()); - - EGLConfig config = q_configFromQPlatformWindowFormat(display,windowFormat); - QVector<EGLint> eglContextAttrs; - eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); - eglContextAttrs.append(2); - eglContextAttrs.append(EGL_NONE); - - EGLSurface eglSurface = eglCreateWindowSurface(display,config,(EGLNativeWindowType)x_window,0); - that->mGLContext = new QEGLPlatformContext(display, config, eglContextAttrs.data(), eglSurface, EGL_OPENGL_ES_API); -#endif -#endif - } - return mGLContext; -} - -Window QXlibWindow::xWindow() const -{ - return x_window; -} - -GC QXlibWindow::graphicsContext() const -{ - return gc; -} - -void QXlibWindow::doSizeHints() -{ - Q_ASSERT(widget()->testAttribute(Qt::WA_WState_Created)); - XSizeHints s; - s.flags = 0; - QRect g = geometry(); - s.x = g.x(); - s.y = g.y(); - s.width = g.width(); - s.height = g.height(); - s.flags |= USPosition; - s.flags |= PPosition; - s.flags |= USSize; - s.flags |= PSize; - s.flags |= PWinGravity; - s.win_gravity = QApplication::isRightToLeft() ? NorthEastGravity : NorthWestGravity; - XSetWMNormalHints(mScreen->display(), x_window, &s); -} - -QPlatformWindowFormat QXlibWindow::correctColorBuffers(const QPlatformWindowFormat &platformWindowFormat) const -{ - // I have only tested this setup on a dodgy intel setup, where I didn't use standard libs, - // so this might be not what we want to do :) - if ( !(platformWindowFormat.redBufferSize() == -1 && - platformWindowFormat.greenBufferSize() == -1 && - platformWindowFormat.blueBufferSize() == -1)) - return platformWindowFormat; - - QPlatformWindowFormat windowFormat = platformWindowFormat; - if (mScreen->depth() == 16) { - windowFormat.setRedBufferSize(5); - windowFormat.setGreenBufferSize(6); - windowFormat.setBlueBufferSize(5); - } else { - windowFormat.setRedBufferSize(8); - windowFormat.setGreenBufferSize(8); - windowFormat.setBlueBufferSize(8); - } - - return windowFormat; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitewindow.h b/src/plugins/platforms/testlite/qtestlitewindow.h deleted file mode 100644 index ccf6867..0000000 --- a/src/plugins/platforms/testlite/qtestlitewindow.h +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITEWINDOW_H -#define QTESTLITEWINDOW_H - -#include "qtestliteintegration.h" - -#include <QPlatformWindow> -#include <QEvent> - -#include <QObject> -#include <QImage> - -struct QXlibMWMHints { - ulong flags, functions, decorations; - long input_mode; - ulong status; -}; - -enum { - MWM_HINTS_FUNCTIONS = (1L << 0), - - MWM_FUNC_ALL = (1L << 0), - MWM_FUNC_RESIZE = (1L << 1), - MWM_FUNC_MOVE = (1L << 2), - MWM_FUNC_MINIMIZE = (1L << 3), - MWM_FUNC_MAXIMIZE = (1L << 4), - MWM_FUNC_CLOSE = (1L << 5), - - MWM_HINTS_DECORATIONS = (1L << 1), - - MWM_DECOR_ALL = (1L << 0), - MWM_DECOR_BORDER = (1L << 1), - MWM_DECOR_RESIZEH = (1L << 2), - MWM_DECOR_TITLE = (1L << 3), - MWM_DECOR_MENU = (1L << 4), - MWM_DECOR_MINIMIZE = (1L << 5), - MWM_DECOR_MAXIMIZE = (1L << 6), - - MWM_HINTS_INPUT_MODE = (1L << 2), - - MWM_INPUT_MODELESS = 0L, - MWM_INPUT_PRIMARY_APPLICATION_MODAL = 1L, - MWM_INPUT_FULL_APPLICATION_MODAL = 3L -}; - -class QXlibWindow : public QPlatformWindow -{ -public: - QXlibWindow(QWidget *window); - ~QXlibWindow(); - - - void mousePressEvent(XButtonEvent*); - void handleMouseEvent(QEvent::Type, XButtonEvent *ev); - - void handleCloseEvent(); - void handleEnterEvent(); - void handleLeaveEvent(); - void handleFocusInEvent(); - void handleFocusOutEvent(); - - void resizeEvent(XConfigureEvent *configure_event); - void paintEvent(); - - void requestActivateWindow(); - - void setGeometry(const QRect &rect); - - Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); - Qt::WindowFlags windowFlags() const; - void setVisible(bool visible); - WId winId() const; - void setParent(const QPlatformWindow *window); - void raise(); - void lower(); - void setWindowTitle(const QString &title); - - void setCursor(const Cursor &cursor); - - QPlatformGLContext *glContext() const; - - Window xWindow() const; - GC graphicsContext() const; - -protected: - QVector<Atom> getNetWmState() const; - void setMWMHints(const QXlibMWMHints &mwmhints); - QXlibMWMHints getMWMHints() const; - - void doSizeHints(); - -private: - QPlatformWindowFormat correctColorBuffers(const QPlatformWindowFormat &windowFormat)const; - - Window x_window; - GC gc; - - GC createGC(); - - QPlatformGLContext *mGLContext; - QXlibScreen *mScreen; - Qt::WindowFlags mWindowFlags; -}; - -#endif diff --git a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp b/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp deleted file mode 100644 index 088730d..0000000 --- a/src/plugins/platforms/testlite/qtestlitewindowsurface.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitewindowsurface.h" -#include "qtestliteintegration.h" - -#include <QtCore/qdebug.h> -#include <QWindowSystemInterface> - -#include "qtestlitewindow.h" -#include "qtestlitescreen.h" - -# include <sys/ipc.h> -# include <sys/shm.h> -# include <X11/extensions/XShm.h> - -QT_BEGIN_NAMESPACE - - -struct QXlibShmImageInfo { - QXlibShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} - ~QXlibShmImageInfo() { destroy(); } - - void destroy(); - - XShmSegmentInfo shminfo; - XImage *image; - Display *display; -}; - - -#ifndef DONT_USE_MIT_SHM -void QXlibShmImageInfo::destroy() -{ - XShmDetach (display, &shminfo); - XDestroyImage (image); - shmdt (shminfo.shmaddr); - shmctl (shminfo.shmid, IPC_RMID, 0); -} -#endif - -void QXlibWindowSurface::resizeShmImage(int width, int height) -{ - -#ifdef DONT_USE_MIT_SHM - shm_img = QImage(width, height, QImage::Format_RGB32); -#else - - QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(window()); - if (image_info) - image_info->destroy(); - else - image_info = new QXlibShmImageInfo(screen->display()); - - Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); - - - XImage *image = XShmCreateImage (screen->display(), visual, 24, ZPixmap, 0, - &image_info->shminfo, width, height); - - - image_info->shminfo.shmid = shmget (IPC_PRIVATE, - image->bytes_per_line * image->height, IPC_CREAT|0777); - - image_info->shminfo.shmaddr = image->data = (char*)shmat (image_info->shminfo.shmid, 0, 0); - image_info->shminfo.readOnly = False; - - image_info->image = image; - - Status shm_attach_status = XShmAttach(screen->display(), &image_info->shminfo); - - Q_ASSERT(shm_attach_status == True); - - shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, QImage::Format_RGB32 ); -#endif - painted = false; -} - - -void QXlibWindowSurface::resizeBuffer(QSize s) -{ - if (shm_img.size() != s) - resizeShmImage(s.width(), s.height()); -} - -QSize QXlibWindowSurface::bufferSize() const -{ - return shm_img.size(); -} - -QXlibWindowSurface::QXlibWindowSurface (QWidget *window) - : QWindowSurface(window), - painted(false), image_info(0) -{ - xw = static_cast<QXlibWindow*>(window->platformWindow()); -// qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; -} - -QXlibWindowSurface::~QXlibWindowSurface() -{ - delete image_info; -} - -QPaintDevice *QXlibWindowSurface::paintDevice() -{ - return &shm_img; -} - - -void QXlibWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(widget); - Q_UNUSED(region); - Q_UNUSED(offset); - - if (!painted) - return; - - QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); - GC gc = xw->graphicsContext(); - Window window = xw->xWindow(); -#ifdef DONT_USE_MIT_SHM - // just convert the image every time... - if (!shm_img.isNull()) { - Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); - - QImage image = shm_img; - //img.convertToFormat( - XImage *xi = XCreateImage(screen->display(), visual, 24, ZPixmap, - 0, (char *) image.scanLine(0), image.width(), image.height(), - 32, image.bytesPerLine()); - - int x = 0; - int y = 0; - - /*int r =*/ XPutImage(screen->display(), window, gc, xi, 0, 0, x, y, image.width(), image.height()); - - xi->data = 0; // QImage owns these bits - XDestroyImage(xi); - } -#else - // Use MIT_SHM - if (image_info && image_info->image) { - //qDebug() << "Here we go" << image_info->image->width << image_info->image->height; - int x = 0; - int y = 0; - - // We could set send_event to true, and then use the ShmCompletion to synchronize, - // but let's do like Qt/11 and just use XSync - XShmPutImage (screen->display(), window, gc, image_info->image, 0, 0, - x, y, image_info->image->width, image_info->image->height, - /*send_event*/ False); - - XSync(screen->display(), False); - } -#endif -} - -// from qwindowsurface.cpp -extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); - -bool QXlibWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - if (shm_img.isNull()) - return false; - - const QVector<QRect> rects = area.rects(); - for (int i = 0; i < rects.size(); ++i) - qt_scrollRectInImage(shm_img, rects.at(i), QPoint(dx, dy)); - - return true; -} - - -void QXlibWindowSurface::beginPaint(const QRegion ®ion) -{ - Q_UNUSED(region); - resizeBuffer(size()); -} - -void QXlibWindowSurface::endPaint(const QRegion ®ion) -{ - Q_UNUSED(region); - painted = true; //there is content in the buffer -} -QT_END_NAMESPACE diff --git a/src/plugins/platforms/testlite/qtestlitewindowsurface.h b/src/plugins/platforms/testlite/qtestlitewindowsurface.h deleted file mode 100644 index 12b4c60..0000000 --- a/src/plugins/platforms/testlite/qtestlitewindowsurface.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_TESTLITE_H -#define QWINDOWSURFACE_TESTLITE_H - -#include <QtGui/private/qwindowsurface_p.h> - - -QT_BEGIN_NAMESPACE - -class QXlibWindow; -class QXlibIntegration; -class QXlibScreen; -class QXlibShmImageInfo; - -class QXlibWindowSurface : public QWindowSurface -{ -public: - QXlibWindowSurface (QWidget *window); - ~QXlibWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - bool scroll(const QRegion &area, int dx, int dy); - - void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); - -private: - bool painted; - void resizeBuffer(QSize); - QSize bufferSize() const; - - - void resizeShmImage(int width, int height); - - QImage shm_img; - QXlibShmImageInfo *image_info; - - QXlibWindow *xw; - -}; - - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/testlite/testlite.pro b/src/plugins/platforms/testlite/testlite.pro deleted file mode 100644 index 7fb3304..0000000 --- a/src/plugins/platforms/testlite/testlite.pro +++ /dev/null @@ -1,57 +0,0 @@ -TARGET = qtestlite - -include(../../qpluginbase.pri) -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms - -SOURCES = \ - main.cpp \ - qtestliteintegration.cpp \ - qtestlitewindowsurface.cpp \ - qtestlitewindow.cpp \ - qtestlitecursor.cpp \ - qtestlitescreen.cpp \ - qtestlitekeyboard.cpp \ - qtestliteclipboard.cpp \ - qtestlitemime.cpp \ - qtestlitestaticinfo.cpp - -HEADERS = \ - qtestliteintegration.h \ - qtestlitewindowsurface.h \ - qtestlitewindow.h \ - qtestlitecursor.h \ - qtestlitescreen.h \ - qtestlitekeyboard.h \ - qtestliteclipboard.h \ - qtestlitemime.h \ - qtestlitestaticinfo.h - -LIBS += -lX11 -lXext - -mac { - LIBS += -L/usr/X11/lib -lz -framework Carbon -} - -include (../fontdatabases/genericunix/genericunix.pri) - -contains(QT_CONFIG, opengl) { - QT += opengl - !contains(QT_CONFIG, opengles2) { - HEADERS += qglxintegration.h - SOURCES += qglxintegration.cpp - } else { # There is no easy way to detect if we'r suppose to use glx or not - HEADERS += \ - ../eglconvenience/qeglplatformcontext.h \ - ../eglconvenience/qeglconvenience.h \ - qtestliteeglintegration.h - - SOURCES += \ - ../eglconvenience/qeglplatformcontext.cpp \ - ../eglconvenience/qeglconvenience.cpp \ - qtestliteeglintegration.cpp - LIBS += -lEGL - } -} - -target.path += $$[QT_INSTALL_PLUGINS]/platforms -INSTALLS += target diff --git a/src/plugins/platforms/xlib/main.cpp b/src/plugins/platforms/xlib/main.cpp new file mode 100644 index 0000000..131d399 --- /dev/null +++ b/src/plugins/platforms/xlib/main.cpp @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui/QPlatformIntegrationPlugin> +#include "qtestliteintegration.h" + +QT_BEGIN_NAMESPACE + +class QXlibIntegrationPlugin : public QPlatformIntegrationPlugin +{ +public: + QStringList keys() const; + QPlatformIntegration *create(const QString&, const QStringList&); +}; + +QStringList QXlibIntegrationPlugin::keys() const +{ + QStringList list; + list << "Xlib"; +#ifndef QT_NO_OPENGL + list << "XlibGL"; +#endif + return list; +} + +QPlatformIntegration* QXlibIntegrationPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + if (system.toLower() == "xlib") + return new QXlibIntegration; +#ifndef QT_NO_OPENGL + if (system.toLower() == "xlibgl") + return new QXlibIntegration(true); +#endif + + return 0; +} + +Q_EXPORT_PLUGIN2(xlib, QXlibIntegrationPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qglxintegration.cpp b/src/plugins/platforms/xlib/qglxintegration.cpp new file mode 100644 index 0000000..46dfef9 --- /dev/null +++ b/src/plugins/platforms/xlib/qglxintegration.cpp @@ -0,0 +1,376 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QDebug> +#include <QLibrary> +#include <QGLFormat> + +#include "qtestlitewindow.h" +#include "qtestlitescreen.h" + +#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) +#include <X11/Xlib.h> +#include <X11/Xutil.h> +#include <GL/glx.h> + +#include "qglxintegration.h" + +#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) +#include <dlfcn.h> +#endif + +QT_BEGIN_NAMESPACE + +QMutex QGLXContext::m_defaultSharedContextMutex(QMutex::Recursive); + +QVector<int> QGLXContext::buildSpec(const QPlatformWindowFormat &format) +{ + QVector<int> spec(48); + int i = 0; + + spec[i++] = GLX_LEVEL; + spec[i++] = 0; + spec[i++] = GLX_DRAWABLE_TYPE; spec[i++] = GLX_WINDOW_BIT; + + if (format.rgba()) { + spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_RGBA_BIT; + spec[i++] = GLX_RED_SIZE; spec[i++] = (format.redBufferSize() == -1) ? 1 : format.redBufferSize(); + spec[i++] = GLX_GREEN_SIZE; spec[i++] = (format.greenBufferSize() == -1) ? 1 : format.greenBufferSize(); + spec[i++] = GLX_BLUE_SIZE; spec[i++] = (format.blueBufferSize() == -1) ? 1 : format.blueBufferSize(); + if (format.alpha()) { + spec[i++] = GLX_ALPHA_SIZE; spec[i++] = (format.alphaBufferSize() == -1) ? 1 : format.alphaBufferSize(); + } + + spec[i++] = GLX_ACCUM_RED_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + spec[i++] = GLX_ACCUM_GREEN_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + spec[i++] = GLX_ACCUM_BLUE_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + + if (format.alpha()) { + spec[i++] = GLX_ACCUM_ALPHA_SIZE; spec[i++] = (format.accumBufferSize() == -1) ? 1 : format.accumBufferSize(); + } + + } else { + spec[i++] = GLX_RENDER_TYPE; spec[i++] = GLX_COLOR_INDEX_BIT; //I'm really not sure if this works.... + spec[i++] = GLX_BUFFER_SIZE; spec[i++] = 8; + } + + spec[i++] = GLX_DOUBLEBUFFER; spec[i++] = format.doubleBuffer() ? True : False; + spec[i++] = GLX_STEREO; spec[i++] = format.stereo() ? True : False; + + if (format.depth()) { + spec[i++] = GLX_DEPTH_SIZE; spec[i++] = (format.depthBufferSize() == -1) ? 1 : format.depthBufferSize(); + } + + if (format.stencil()) { + spec[i++] = GLX_STENCIL_SIZE; spec[i++] = (format.stencilBufferSize() == -1) ? 1 : format.stencilBufferSize(); + } + if (format.sampleBuffers()) { + spec[i++] = GLX_SAMPLE_BUFFERS_ARB; + spec[i++] = 1; + spec[i++] = GLX_SAMPLES_ARB; + spec[i++] = format.samples() == -1 ? 4 : format.samples(); + } + + spec[i++] = XNone; + return spec; +} + +GLXFBConfig QGLXContext::findConfig(const QXlibScreen *screen, const QPlatformWindowFormat &format) +{ + bool reduced = true; + GLXFBConfig chosenConfig = 0; + QPlatformWindowFormat reducedFormat = format; + while (!chosenConfig && reduced) { + QVector<int> spec = buildSpec(reducedFormat); + int confcount = 0; + GLXFBConfig *configs; + configs = glXChooseFBConfig(screen->display(),screen->xScreenNumber(),spec.constData(),&confcount); + if (confcount) + { + for (int i = 0; i < confcount; i++) { + chosenConfig = configs[i]; + // Make sure we try to get an ARGB visual if the format asked for an alpha: + if (reducedFormat.alpha()) { + int alphaSize; + glXGetFBConfigAttrib(screen->display(),configs[i],GLX_ALPHA_SIZE,&alphaSize); + if (alphaSize > 0) + break; + } else { + break; // Just choose the first in the list if there's no alpha requested + } + } + + XFree(configs); + } + reducedFormat = reducePlatformWindowFormat(reducedFormat,&reduced); + } + + if (!chosenConfig) + qWarning("Warning no context created"); + + return chosenConfig; +} + +XVisualInfo *QGLXContext::findVisualInfo(const QXlibScreen *screen, const QPlatformWindowFormat &format) +{ + GLXFBConfig config = QGLXContext::findConfig(screen,format); + XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display(),config); + return visualInfo; +} + +QPlatformWindowFormat QGLXContext::platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext ctx) +{ + QPlatformWindowFormat format; + int redSize = 0; + int greenSize = 0; + int blueSize = 0; + int alphaSize = 0; + int depthSize = 0; + int stencilSize = 0; + int sampleBuffers = 0; + int sampleCount = 0; + int level = 0; + int rgba = 0; + int stereo = 0; + int accumSizeA = 0; + int accumSizeR = 0; + int accumSizeG = 0; + int accumSizeB = 0; + + XVisualInfo *vi = glXGetVisualFromFBConfig(display,config); + glXGetConfig(display,vi,GLX_RGBA,&rgba); + XFree(vi); + glXGetFBConfigAttrib(display, config, GLX_RED_SIZE, &redSize); + glXGetFBConfigAttrib(display, config, GLX_GREEN_SIZE, &greenSize); + glXGetFBConfigAttrib(display, config, GLX_BLUE_SIZE, &blueSize); + glXGetFBConfigAttrib(display, config, GLX_ALPHA_SIZE, &alphaSize); + glXGetFBConfigAttrib(display, config, GLX_DEPTH_SIZE, &depthSize); + glXGetFBConfigAttrib(display, config, GLX_STENCIL_SIZE, &stencilSize); + glXGetFBConfigAttrib(display, config, GLX_SAMPLES, &sampleBuffers); + glXGetFBConfigAttrib(display, config, GLX_LEVEL, &level); + glXGetFBConfigAttrib(display, config, GLX_STEREO, &stereo); + glXGetFBConfigAttrib(display, config, GLX_ACCUM_ALPHA_SIZE, &accumSizeA); + glXGetFBConfigAttrib(display, config, GLX_ACCUM_RED_SIZE, &accumSizeR); + glXGetFBConfigAttrib(display, config, GLX_ACCUM_GREEN_SIZE, &accumSizeG); + glXGetFBConfigAttrib(display, config, GLX_ACCUM_BLUE_SIZE, &accumSizeB); + + format.setRedBufferSize(redSize); + format.setGreenBufferSize(greenSize); + format.setBlueBufferSize(blueSize); + format.setAlphaBufferSize(alphaSize); + format.setDepthBufferSize(depthSize); + format.setStencilBufferSize(stencilSize); + format.setSampleBuffers(sampleBuffers); + if (format.sampleBuffers()) { + glXGetFBConfigAttrib(display, config, GLX_SAMPLES_ARB, &sampleCount); + format.setSamples(sampleCount); + } + + format.setDirectRendering(glXIsDirect(display, ctx)); + format.setRgba(rgba); + format.setStereo(stereo); + format.setAccumBufferSize(accumSizeB); + + return format; +} + +QPlatformWindowFormat QGLXContext::reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced) +{ + QPlatformWindowFormat retFormat = format; + *reduced = true; + + if (retFormat.sampleBuffers()) { + retFormat.setSampleBuffers(false); + } else if (retFormat.stereo()) { + retFormat.setStereo(false); + } else if (retFormat.accum()) { + retFormat.setAccum(false); + }else if (retFormat.stencil()) { + retFormat.setStencil(false); + }else if (retFormat.alpha()) { + retFormat.setAlpha(false); + }else if (retFormat.depth()) { + retFormat.setDepth(false); + }else if (retFormat.doubleBuffer()) { + retFormat.setDoubleBuffer(false); + }else{ + *reduced = false; + } + return retFormat; +} + +QGLXContext::QGLXContext(Window window, QXlibScreen *screen, const QPlatformWindowFormat &format) + : QPlatformGLContext() + , m_screen(screen) + , m_drawable((Drawable)window) + , m_context(0) +{ + + const QPlatformGLContext *sharePlatformContext; + if (format.useDefaultSharedContext()) { + if (!QPlatformGLContext::defaultSharedContext()) { + if (m_defaultSharedContextMutex.tryLock()){ + createDefaultSharedContex(screen); + m_defaultSharedContextMutex.unlock(); + } else { + m_defaultSharedContextMutex.lock(); //wait to the the shared context is created + m_defaultSharedContextMutex.unlock(); + } + } + sharePlatformContext = QPlatformGLContext::defaultSharedContext(); + } else { + sharePlatformContext = format.sharedGLContext(); + } + GLXContext shareGlxContext = 0; + if (sharePlatformContext) + shareGlxContext = static_cast<const QGLXContext*>(sharePlatformContext)->glxContext(); + + GLXFBConfig config = findConfig(screen,format); + m_context = glXCreateNewContext(screen->display(),config,GLX_RGBA_TYPE,shareGlxContext,TRUE); + m_windowFormat = QGLXContext::platformWindowFromGLXFBConfig(screen->display(),config,m_context); + +#ifdef MYX11_DEBUG + qDebug() << "QGLXGLContext::create context" << m_context; +#endif +} + +QGLXContext::QGLXContext(QXlibScreen *screen, Drawable drawable, GLXContext context) + : QPlatformGLContext(), m_screen(screen), m_drawable(drawable), m_context(context) +{ + +} + +QGLXContext::~QGLXContext() +{ + if (m_context) { + qDebug("Destroying GLX context 0x%p", m_context); + glXDestroyContext(m_screen->display(), m_context); + } +} + +void QGLXContext::createDefaultSharedContex(QXlibScreen *screen) +{ + int x = 0; + int y = 0; + int w = 3; + int h = 3; + + QPlatformWindowFormat format = QPlatformWindowFormat::defaultFormat(); + GLXContext context; + GLXFBConfig config = findConfig(screen,format); + if (config) { + XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display(),config); + Colormap cmap = XCreateColormap(screen->display(),screen->rootWindow(),visualInfo->visual,AllocNone); + XSetWindowAttributes a; + a.colormap = cmap; + Window sharedWindow = XCreateWindow(screen->display(), screen->rootWindow(),x, y, w, h, + 0, visualInfo->depth, InputOutput, visualInfo->visual, + CWColormap, &a); + + context = glXCreateNewContext(screen->display(),config,GLX_RGBA_TYPE,0,TRUE); + QPlatformGLContext *sharedContext = new QGLXContext(screen,sharedWindow,context); + QPlatformGLContext::setDefaultSharedContext(sharedContext); + } else { + qWarning("Warning no shared context created"); + } +} + +void QGLXContext::makeCurrent() +{ + QPlatformGLContext::makeCurrent(); +#ifdef MYX11_DEBUG + qDebug("QGLXGLContext::makeCurrent(window=0x%x, ctx=0x%x)", m_drawable, m_context); +#endif + glXMakeCurrent(m_screen->display(), m_drawable, m_context); +} + +void QGLXContext::doneCurrent() +{ + QPlatformGLContext::doneCurrent(); + glXMakeCurrent(m_screen->display(), 0, 0); +} + +void QGLXContext::swapBuffers() +{ + glXSwapBuffers(m_screen->display(), m_drawable); +} + +void* QGLXContext::getProcAddress(const QString& procName) +{ + typedef void *(*qt_glXGetProcAddressARB)(const GLubyte *); + static qt_glXGetProcAddressARB glXGetProcAddressARB = 0; + static bool resolved = false; + + if (resolved && !glXGetProcAddressARB) + return 0; + if (!glXGetProcAddressARB) { + QList<QByteArray> glxExt = QByteArray(glXGetClientString(m_screen->display(), GLX_EXTENSIONS)).split(' '); + if (glxExt.contains("GLX_ARB_get_proc_address")) { +#if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) + void *handle = dlopen(NULL, RTLD_LAZY); + if (handle) { + glXGetProcAddressARB = (qt_glXGetProcAddressARB) dlsym(handle, "glXGetProcAddressARB"); + dlclose(handle); + } + if (!glXGetProcAddressARB) +#endif + { + extern const QString qt_gl_library_name(); +// QLibrary lib(qt_gl_library_name()); + QLibrary lib(QLatin1String("GL")); + glXGetProcAddressARB = (qt_glXGetProcAddressARB) lib.resolve("glXGetProcAddressARB"); + } + } + resolved = true; + } + if (!glXGetProcAddressARB) + return 0; + return glXGetProcAddressARB(reinterpret_cast<const GLubyte *>(procName.toLatin1().data())); +} + +QPlatformWindowFormat QGLXContext::platformWindowFormat() const +{ + return m_windowFormat; +} + +QT_END_NAMESPACE + +#endif //!defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) diff --git a/src/plugins/platforms/xlib/qglxintegration.h b/src/plugins/platforms/xlib/qglxintegration.h new file mode 100644 index 0000000..f982708 --- /dev/null +++ b/src/plugins/platforms/xlib/qglxintegration.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef Q_GLX_CONTEXT_H +#define Q_GLX_CONTEXT_H + +#include "qtestlitewindow.h" + +#include <QtGui/QPlatformGLContext> +#include <QtGui/QPlatformWindowFormat> + +#include <QtCore/QMutex> + +#if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) +#include <GL/glx.h> + +QT_BEGIN_NAMESPACE + +class QGLXContext : public QPlatformGLContext +{ +public: + QGLXContext(Window window, QXlibScreen *xd, const QPlatformWindowFormat &format); + ~QGLXContext(); + + virtual void makeCurrent(); + virtual void doneCurrent(); + virtual void swapBuffers(); + virtual void* getProcAddress(const QString& procName); + + GLXContext glxContext() const {return m_context;} + + QPlatformWindowFormat platformWindowFormat() const; + + static XVisualInfo *findVisualInfo(const QXlibScreen *xd, const QPlatformWindowFormat &format); +private: + static GLXFBConfig findConfig(const QXlibScreen *xd,const QPlatformWindowFormat &format); + static QVector<int> buildSpec(const QPlatformWindowFormat &format); + static QPlatformWindowFormat platformWindowFromGLXFBConfig(Display *display, GLXFBConfig config, GLXContext context); + static QPlatformWindowFormat reducePlatformWindowFormat(const QPlatformWindowFormat &format, bool *reduced); + + + QXlibScreen *m_screen; + Drawable m_drawable; + GLXContext m_context; + QPlatformWindowFormat m_windowFormat; + + QGLXContext (QXlibScreen *screen, Drawable drawable, GLXContext context); + static QMutex m_defaultSharedContextMutex; + static void createDefaultSharedContex(QXlibScreen *xd); +}; + +QT_END_NAMESPACE + +#endif //!defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) + +#endif diff --git a/src/plugins/platforms/xlib/qtestliteclipboard.cpp b/src/plugins/platforms/xlib/qtestliteclipboard.cpp new file mode 100644 index 0000000..1264b5a --- /dev/null +++ b/src/plugins/platforms/xlib/qtestliteclipboard.cpp @@ -0,0 +1,676 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestliteclipboard.h" + +#include "qtestlitescreen.h" +#include "qtestlitemime.h" + +#include <private/qapplication_p.h> + +#include <QtCore/QDebug> + +class QXlibClipboardMime : public QXlibMime +{ + Q_OBJECT +public: + QXlibClipboardMime(QClipboard::Mode mode, QXlibClipboard *clipboard) + : QXlibMime() + , m_clipboard(clipboard) + { + switch (mode) { + case QClipboard::Selection: + modeAtom = XA_PRIMARY; + break; + + case QClipboard::Clipboard: + modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); + break; + + default: + qWarning("QTestLiteMime: Internal error: Unsupported clipboard mode"); + break; + } + } + +protected: + QStringList formats_sys() const + { + if (empty()) + return QStringList(); + + if (!formatList.count()) { + QXlibClipboardMime *that = const_cast<QXlibClipboardMime *>(this); + // get the list of targets from the current clipboard owner - we do this + // once so that multiple calls to this function don't require multiple + // server round trips... + that->format_atoms = m_clipboard->getDataInFormat(modeAtom,QXlibStatic::atom(QXlibStatic::TARGETS)); + + if (format_atoms.size() > 0) { + Atom *targets = (Atom *) format_atoms.data(); + int size = format_atoms.size() / sizeof(Atom); + + for (int i = 0; i < size; ++i) { + if (targets[i] == 0) + continue; + + QStringList formatsForAtom = mimeFormatsForAtom(m_clipboard->screen()->display(),targets[i]); + for (int j = 0; j < formatsForAtom.size(); ++j) { + if (!formatList.contains(formatsForAtom.at(j))) + that->formatList.append(formatsForAtom.at(j)); + } + } + } + } + + return formatList; + } + + bool hasFormat_sys(const QString &format) const + { + QStringList list = formats(); + return list.contains(format); + } + + QVariant retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const + { + if (fmt.isEmpty() || empty()) + return QByteArray(); + + (void)formats(); // trigger update of format list + + QList<Atom> atoms; + Atom *targets = (Atom *) format_atoms.data(); + int size = format_atoms.size() / sizeof(Atom); + for (int i = 0; i < size; ++i) + atoms.append(targets[i]); + + QByteArray encoding; + Atom fmtatom = mimeAtomForFormat(m_clipboard->screen()->display(),fmt, requestedType, atoms, &encoding); + + if (fmtatom == 0) + return QVariant(); + + return mimeConvertToFormat(m_clipboard->screen()->display(),fmtatom, m_clipboard->getDataInFormat(modeAtom,fmtatom), fmt, requestedType, encoding); + } +private: + bool empty() const + { + Window win = XGetSelectionOwner(m_clipboard->screen()->display(), modeAtom); + + return win == XNone; + } + + + Atom modeAtom; + QXlibClipboard *m_clipboard; + QStringList formatList; + QByteArray format_atoms; +}; + +const int QXlibClipboard::clipboard_timeout = 5000; + +QXlibClipboard::QXlibClipboard(QXlibScreen *screen) + : QPlatformClipboard() + , m_screen(screen) + , m_xClipboard(0) + , m_clientClipboard(0) + , m_xSelection(0) + , m_clientSelection(0) + , m_requestor(XNone) + , m_owner(XNone) +{ +} + +const QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) const +{ + if (mode == QClipboard::Clipboard) { + if (!m_xClipboard) { + QXlibClipboard *that = const_cast<QXlibClipboard *>(this); + that->m_xClipboard = new QXlibClipboardMime(mode,that); + } + Window clipboardOwner = XGetSelectionOwner(screen()->display(),QXlibStatic::atom(QXlibStatic::CLIPBOARD)); + if (clipboardOwner == owner()) { + return m_clientClipboard; + } else { + return m_xClipboard; + } + } else if (mode == QClipboard::Selection) { + if (!m_xSelection) { + QXlibClipboard *that = const_cast<QXlibClipboard *>(this); + that->m_xSelection = new QXlibClipboardMime(mode,that); + } + Window clipboardOwner = XGetSelectionOwner(screen()->display(),XA_PRIMARY); + if (clipboardOwner == owner()) { + return m_clientSelection; + } else { + return m_xSelection; + } + } + return 0; +} + +void QXlibClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) +{ + Atom modeAtom; + QMimeData **d; + switch (mode) { + case QClipboard::Selection: + modeAtom = XA_PRIMARY; + d = &m_clientSelection; + break; + + case QClipboard::Clipboard: + modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); + d = &m_clientClipboard; + break; + + default: + qWarning("QClipboard::setMimeData: unsupported mode '%d'", mode); + return; + } + + Window newOwner; + + if (! data) { // no data, clear clipboard contents + newOwner = XNone; + } else { + newOwner = owner(); + + *d = data; + } + + XSetSelectionOwner(m_screen->display(), modeAtom, newOwner, CurrentTime); + + if (XGetSelectionOwner(m_screen->display(), modeAtom) != newOwner) { + qWarning("QClipboard::setData: Cannot set X11 selection owner"); + } + +} + +bool QXlibClipboard::supportsMode(QClipboard::Mode mode) const +{ + if (mode == QClipboard::Clipboard || mode == QClipboard::Selection) + return true; + return false; +} + + +QXlibScreen * QXlibClipboard::screen() const +{ + return m_screen; +} + +Window QXlibClipboard::requestor() const +{ + if (!m_requestor) { + int x = 0, y = 0, w = 3, h = 3; + QXlibClipboard *that = const_cast<QXlibClipboard *>(this); + Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), + x, y, w, h, 0 /*border_width*/, + m_screen->blackPixel(), m_screen->whitePixel()); + that->setRequestor(window); + } + return m_requestor; +} + +void QXlibClipboard::setRequestor(Window window) +{ + if (m_requestor != XNone) { + XDestroyWindow(m_screen->display(),m_requestor); + } + m_requestor = window; +} + +Window QXlibClipboard::owner() const +{ + if (!m_owner) { + int x = 0, y = 0, w = 3, h = 3; + QXlibClipboard *that = const_cast<QXlibClipboard *>(this); + Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), + x, y, w, h, 0 /*border_width*/, + m_screen->blackPixel(), m_screen->whitePixel()); + that->setOwner(window); + } + return m_owner; +} + +void QXlibClipboard::setOwner(Window window) +{ + if (m_owner != XNone){ + XDestroyWindow(m_screen->display(),m_owner); + } + m_owner = window; +} + +Atom QXlibClipboard::sendTargetsSelection(QMimeData *d, Window window, Atom property) +{ + QVector<Atom> types; + QStringList formats = QInternalMimeData::formatsHelper(d); + for (int i = 0; i < formats.size(); ++i) { + QList<Atom> atoms = QXlibMime::mimeAtomsForFormat(screen()->display(),formats.at(i)); + for (int j = 0; j < atoms.size(); ++j) { + if (!types.contains(atoms.at(j))) + types.append(atoms.at(j)); + } + } + types.append(QXlibStatic::atom(QXlibStatic::TARGETS)); + types.append(QXlibStatic::atom(QXlibStatic::MULTIPLE)); + types.append(QXlibStatic::atom(QXlibStatic::TIMESTAMP)); + types.append(QXlibStatic::atom(QXlibStatic::SAVE_TARGETS)); + + XChangeProperty(screen()->display(), window, property, XA_ATOM, 32, + PropModeReplace, (uchar *) types.data(), types.size()); + return property; +} + +Atom QXlibClipboard::sendSelection(QMimeData *d, Atom target, Window window, Atom property) +{ + Atom atomFormat = target; + int dataFormat = 0; + QByteArray data; + + QString fmt = QXlibMime::mimeAtomToString(screen()->display(), target); + if (fmt.isEmpty()) { // Not a MIME type we have + qDebug() << "QClipboard: send_selection(): converting to type '%s' is not supported" << fmt.data(); + return XNone; + } + qDebug() << "QClipboard: send_selection(): converting to type '%s'" << fmt.data(); + + if (QXlibMime::mimeDataForAtom(screen()->display(),target, d, &data, &atomFormat, &dataFormat)) { + + // don't allow INCR transfers when using MULTIPLE or to + // Motif clients (since Motif doesn't support INCR) + static Atom motif_clip_temporary = QXlibStatic::atom(QXlibStatic::CLIP_TEMPORARY); + bool allow_incr = property != motif_clip_temporary; + + // X_ChangeProperty protocol request is 24 bytes + const int increment = (XMaxRequestSize(screen()->display()) * 4) - 24; + if (data.size() > increment && allow_incr) { + long bytes = data.size(); + XChangeProperty(screen()->display(), window, property, + QXlibStatic::atom(QXlibStatic::INCR), 32, PropModeReplace, (uchar *) &bytes, 1); + +// (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment); + qDebug() << "not implemented INCRT just YET!"; + return property; + } + + // make sure we can perform the XChangeProperty in a single request + if (data.size() > increment) + return XNone; // ### perhaps use several XChangeProperty calls w/ PropModeAppend? + int dataSize = data.size() / (dataFormat / 8); + // use a single request to transfer data + XChangeProperty(screen()->display(), window, property, atomFormat, + dataFormat, PropModeReplace, (uchar *) data.data(), + dataSize); + } + return property; +} + +void QXlibClipboard::handleSelectionRequest(XEvent *xevent) +{ + XSelectionRequestEvent *req = &xevent->xselectionrequest; + + if (requestor() && req->requestor == requestor()) { + qDebug() << "This should be caught before"; + return; + } + + XEvent event; + event.xselection.type = SelectionNotify; + event.xselection.display = req->display; + event.xselection.requestor = req->requestor; + event.xselection.selection = req->selection; + event.xselection.target = req->target; + event.xselection.property = XNone; + event.xselection.time = req->time; + + QMimeData *d; + if (req->selection == XA_PRIMARY) { + d = m_clientSelection; + } else if (req->selection == QXlibStatic::atom(QXlibStatic::CLIPBOARD)) { + d = m_clientClipboard; + } else { + qWarning("QClipboard: Unknown selection '%lx'", req->selection); + XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + return; + } + + if (!d) { + qWarning("QClipboard: Cannot transfer data, no data available"); + XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + return; + } + + Atom xa_targets = QXlibStatic::atom(QXlibStatic::TARGETS); + Atom xa_multiple = QXlibStatic::atom(QXlibStatic::MULTIPLE); + Atom xa_timestamp = QXlibStatic::atom(QXlibStatic::TIMESTAMP); + + struct AtomPair { Atom target; Atom property; } *multi = 0; + Atom multi_type = XNone; + int multi_format = 0; + int nmulti = 0; + int imulti = -1; + bool multi_writeback = false; + + if (req->target == xa_multiple) { + QByteArray multi_data; + if (req->property == XNone + || !clipboardReadProperty(req->requestor, req->property, false, &multi_data, + 0, &multi_type, &multi_format) + || multi_format != 32) { + // MULTIPLE property not formatted correctly + XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + return; + } + nmulti = multi_data.size()/sizeof(*multi); + multi = new AtomPair[nmulti]; + memcpy(multi,multi_data.data(),multi_data.size()); + imulti = 0; + } + + for (; imulti < nmulti; ++imulti) { + Atom target; + Atom property; + + if (multi) { + target = multi[imulti].target; + property = multi[imulti].property; + } else { + target = req->target; + property = req->property; + if (property == XNone) // obsolete client + property = target; + } + + Atom ret = XNone; + if (target == XNone || property == XNone) { + ; + } else if (target == xa_timestamp) { +// if (d->timestamp != CurrentTime) { +// XChangeProperty(screen()->display(), req->requestor, property, XA_INTEGER, 32, +// PropModeReplace, CurrentTime, 1); +// ret = property; +// } else { +// qWarning("QClipboard: Invalid data timestamp"); +// } + } else if (target == xa_targets) { + ret = sendTargetsSelection(d, req->requestor, property); + } else { + ret = sendSelection(d, target, req->requestor, property); + } + + if (nmulti > 0) { + if (ret == XNone) { + multi[imulti].property = XNone; + multi_writeback = true; + } + } else { + event.xselection.property = ret; + break; + } + } + + if (nmulti > 0) { + if (multi_writeback) { + // according to ICCCM 2.6.2 says to put None back + // into the original property on the requestor window + XChangeProperty(screen()->display(), req->requestor, req->property, multi_type, 32, + PropModeReplace, (uchar *) multi, nmulti * 2); + } + + delete [] multi; + event.xselection.property = req->property; + } + + // send selection notify to requestor + XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); +} + +static inline int maxSelectionIncr(Display *dpy) +{ return XMaxRequestSize(dpy) > 65536 ? 65536*4 : XMaxRequestSize(dpy)*4 - 100; } + +bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const +{ + int maxsize = maxSelectionIncr(screen()->display()); + ulong bytes_left; // bytes_after + ulong length; // nitems + uchar *data; + Atom dummy_type; + int dummy_format; + int r; + + if (!type) // allow null args + type = &dummy_type; + if (!format) + format = &dummy_format; + + // Don't read anything, just get the size of the property data + r = XGetWindowProperty(screen()->display(), win, property, 0, 0, False, + AnyPropertyType, type, format, + &length, &bytes_left, &data); + if (r != Success || (type && *type == XNone)) { + buffer->resize(0); + return false; + } + XFree((char*)data); + + int offset = 0, buffer_offset = 0, format_inc = 1, proplen = bytes_left; + + switch (*format) { + case 8: + default: + format_inc = sizeof(char) / 1; + break; + + case 16: + format_inc = sizeof(short) / 2; + proplen *= sizeof(short) / 2; + break; + + case 32: + format_inc = sizeof(long) / 4; + proplen *= sizeof(long) / 4; + break; + } + + int newSize = proplen; + buffer->resize(newSize); + + bool ok = (buffer->size() == newSize); + + if (ok && newSize) { + // could allocate buffer + + while (bytes_left) { + // more to read... + + r = XGetWindowProperty(screen()->display(), win, property, offset, maxsize/4, + False, AnyPropertyType, type, format, + &length, &bytes_left, &data); + if (r != Success || (type && *type == XNone)) + break; + + offset += length / (32 / *format); + length *= format_inc * (*format) / 8; + + // Here we check if we get a buffer overflow and tries to + // recover -- this shouldn't normally happen, but it doesn't + // hurt to be defensive + if ((int)(buffer_offset + length) > buffer->size()) { + length = buffer->size() - buffer_offset; + + // escape loop + bytes_left = 0; + } + + memcpy(buffer->data() + buffer_offset, data, length); + buffer_offset += length; + + XFree((char*)data); + } + + if (*format == 8 && *type == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { + // convert COMPOUND_TEXT to a multibyte string + XTextProperty textprop; + textprop.encoding = *type; + textprop.format = *format; + textprop.nitems = buffer_offset; + textprop.value = (unsigned char *) buffer->data(); + + char **list_ret = 0; + int count; + if (XmbTextPropertyToTextList(screen()->display(), &textprop, &list_ret, + &count) == Success && count && list_ret) { + offset = buffer_offset = strlen(list_ret[0]); + buffer->resize(offset); + memcpy(buffer->data(), list_ret[0], offset); + } + if (list_ret) XFreeStringList(list_ret); + } + } + + // correct size, not 0-term. + if (size) + *size = buffer_offset; + + if (deleteProperty) + XDeleteProperty(screen()->display(), win, property); + + XFlush(screen()->display()); + + return ok; +} + +QByteArray QXlibClipboard::clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm) +{ + XEvent event; + + QByteArray buf; + QByteArray tmp_buf; + bool alloc_error = false; + int length; + int offset = 0; + + if (nbytes > 0) { + // Reserve buffer + zero-terminator (for text data) + // We want to complete the INCR transfer even if we cannot + // allocate more memory + buf.resize(nbytes+1); + alloc_error = buf.size() != nbytes+1; + } + + for (;;) { + XFlush(screen()->display()); + if (!screen()->waitForClipboardEvent(win,PropertyNotify,&event,clipboard_timeout)) + break; + if (event.xproperty.atom != property || + event.xproperty.state != PropertyNewValue) + continue; + if (clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0)) { + if (length == 0) { // no more data, we're done + if (nullterm) { + buf.resize(offset+1); + buf[offset] = '\0'; + } else { + buf.resize(offset); + } + return buf; + } else if (!alloc_error) { + if (offset+length > (int)buf.size()) { + buf.resize(offset+length+65535); + if (buf.size() != offset+length+65535) { + alloc_error = true; + length = buf.size() - offset; + } + } + memcpy(buf.data()+offset, tmp_buf.constData(), length); + tmp_buf.resize(0); + offset += length; + } + } else { + break; + } + } + + // timed out ... create a new requestor window, otherwise the requestor + // could consider next request to be still part of this timed out request + setRequestor(0); + + return QByteArray(); +} + +QByteArray QXlibClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) +{ + QByteArray buf; + + Window win = requestor(); + + XSelectInput(screen()->display(), win, NoEventMask); // don't listen for any events + + XDeleteProperty(screen()->display(), win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION)); + XConvertSelection(screen()->display(), modeAtom, fmtatom, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), win, CurrentTime); + XSync(screen()->display(), false); + + XEvent xevent; + if (!screen()->waitForClipboardEvent(win,SelectionNotify,&xevent,clipboard_timeout) || + xevent.xselection.property == XNone) { + return buf; + } + + Atom type; + XSelectInput(screen()->display(), win, PropertyChangeMask); + + if (clipboardReadProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), true, &buf, 0, &type, 0)) { + if (type == QXlibStatic::atom(QXlibStatic::INCR)) { + int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0; + buf = clipboardReadIncrementalProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), nbytes, false); + } + } + + XSelectInput(screen()->display(), win, NoEventMask); + + + return buf; +} + +#include "qtestliteclipboard.moc" diff --git a/src/plugins/platforms/xlib/qtestliteclipboard.h b/src/plugins/platforms/xlib/qtestliteclipboard.h new file mode 100644 index 0000000..109714c --- /dev/null +++ b/src/plugins/platforms/xlib/qtestliteclipboard.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITECLIPBOARD_H +#define QTESTLITECLIPBOARD_H + +#include <QPlatformClipboard> +#include "qtestlitestaticinfo.h" + +class QXlibScreen; +class QXlibClipboard : public QPlatformClipboard +{ +public: + QXlibClipboard(QXlibScreen *screen); + + const QMimeData *mimeData(QClipboard::Mode mode) const; + void setMimeData(QMimeData *data, QClipboard::Mode mode); + + bool supportsMode(QClipboard::Mode mode) const; + + QXlibScreen *screen() const; + + Window requestor() const; + void setRequestor(Window window); + + Window owner() const; + + void handleSelectionRequest(XEvent *event); + + bool clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const; + QByteArray clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm); + + QByteArray getDataInFormat(Atom modeAtom, Atom fmtatom); + +private: + void setOwner(Window window); + + Atom sendTargetsSelection(QMimeData *d, Window window, Atom property); + Atom sendSelection(QMimeData *d, Atom target, Window window, Atom property); + + QXlibScreen *m_screen; + + QMimeData *m_xClipboard; + QMimeData *m_clientClipboard; + + QMimeData *m_xSelection; + QMimeData *m_clientSelection; + + Window m_requestor; + Window m_owner; + + static const int clipboard_timeout; + +}; + +#endif // QTESTLITECLIPBOARD_H diff --git a/src/plugins/platforms/xlib/qtestlitecursor.cpp b/src/plugins/platforms/xlib/qtestlitecursor.cpp new file mode 100644 index 0000000..2f7cfbf --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitecursor.cpp @@ -0,0 +1,199 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitecursor.h" + +#include "qtestliteintegration.h" +#include "qtestlitescreen.h" +#include "qtestlitewindow.h" + +#include <QtGui/QBitmap> + +#include <X11/cursorfont.h> + +QT_BEGIN_NAMESPACE + +QXlibCursor::QXlibCursor(QXlibScreen *screen) + : QPlatformCursor(screen) +{ +} + +void QXlibCursor::changeCursor(QCursor *cursor, QWidget *widget) +{ + QXlibWindow *w = 0; + if (widget) { + QWidget *window = widget->window(); + w = static_cast<QXlibWindow*>(window->platformWindow()); + } else { + // No X11 cursor control when there is no widget under the cursor + return; + } + + if (!w) + return; + + int id = cursor->handle(); + + Cursor c; + if (!cursorMap.contains(id)) { + if (cursor->shape() == Qt::BitmapCursor) + c = createCursorBitmap(cursor); + else + c = createCursorShape(cursor->shape()); + if (!c) { + return; + } + cursorMap.insert(id, c); + } else { + c = cursorMap.value(id); + } + + w->setCursor(c); +} + +Cursor QXlibCursor::createCursorBitmap(QCursor * cursor) +{ + XColor bg, fg; + bg.red = 255 << 8; + bg.green = 255 << 8; + bg.blue = 255 << 8; + fg.red = 0; + fg.green = 0; + fg.blue = 0; + QPoint spot = cursor->hotSpot(); + Window rootwin = testLiteScreen()->rootWindow(); + + QImage mapImage = cursor->bitmap()->toImage().convertToFormat(QImage::Format_MonoLSB); + QImage maskImage = cursor->mask()->toImage().convertToFormat(QImage::Format_MonoLSB); + + int width = cursor->bitmap()->width(); + int height = cursor->bitmap()->height(); + int bytesPerLine = mapImage.bytesPerLine(); + int destLineSize = width / 8; + if (width % 8) + destLineSize++; + + const uchar * map = mapImage.bits(); + const uchar * mask = maskImage.bits(); + + char * mapBits = new char[height * destLineSize]; + char * maskBits = new char[height * destLineSize]; + for (int i = 0; i < height; i++) { + memcpy(mapBits + (destLineSize * i),map + (bytesPerLine * i), destLineSize); + memcpy(maskBits + (destLineSize * i),mask + (bytesPerLine * i), destLineSize); + } + + Pixmap cp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, mapBits, width, height); + Pixmap mp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, maskBits, width, height); + Cursor c = XCreatePixmapCursor(testLiteScreen()->display(), cp, mp, &fg, &bg, spot.x(), spot.y()); + XFreePixmap(testLiteScreen()->display(), cp); + XFreePixmap(testLiteScreen()->display(), mp); + delete[] mapBits; + delete[] maskBits; + + return c; +} + +Cursor QXlibCursor::createCursorShape(int cshape) +{ + Cursor cursor = 0; + + if (cshape < 0 || cshape > Qt::LastCursor) + return 0; + + switch (cshape) { + case Qt::ArrowCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_left_ptr); + break; + case Qt::UpArrowCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_center_ptr); + break; + case Qt::CrossCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_crosshair); + break; + case Qt::WaitCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); + break; + case Qt::IBeamCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_xterm); + break; + case Qt::SizeAllCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_fleur); + break; + case Qt::PointingHandCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_hand2); + break; + case Qt::SizeBDiagCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_top_right_corner); + break; + case Qt::SizeFDiagCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_bottom_right_corner); + break; + case Qt::SizeVerCursor: + case Qt::SplitVCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_v_double_arrow); + break; + case Qt::SizeHorCursor: + case Qt::SplitHCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_h_double_arrow); + break; + case Qt::WhatsThisCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_question_arrow); + break; + case Qt::ForbiddenCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_circle); + break; + case Qt::BusyCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); + break; + + default: //default cursor for all the rest + break; + } + return cursor; +} + +QXlibScreen * QXlibCursor::testLiteScreen() const +{ + return static_cast<QXlibScreen *>(screen); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qtestlitecursor.h b/src/plugins/platforms/xlib/qtestlitecursor.h new file mode 100644 index 0000000..db9f9e2 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitecursor.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITECURSOR_H +#define QTESTLITECURSOR_H + +#include <QtGui/QPlatformCursor> + +#include "qtestliteintegration.h" + +QT_BEGIN_NAMESPACE + +class QXlibCursor : QPlatformCursor +{ +public: + QXlibCursor(QXlibScreen *screen); + + void changeCursor(QCursor * cursor, QWidget * widget); +private: + + Cursor createCursorBitmap(QCursor * cursor); + Cursor createCursorShape(int cshape); + + QXlibScreen *testLiteScreen() const; + QMap<int, Cursor> cursorMap; +}; + +QT_END_NAMESPACE + +#endif // QTESTLITECURSOR_H diff --git a/src/plugins/platforms/xlib/qtestliteeglintegration.cpp b/src/plugins/platforms/xlib/qtestliteeglintegration.cpp new file mode 100644 index 0000000..9bbe0ca --- /dev/null +++ b/src/plugins/platforms/xlib/qtestliteeglintegration.cpp @@ -0,0 +1,186 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestliteeglintegration.h" + +static int countBits(unsigned long mask) +{ + int count = 0; + while (mask != 0) { + if (mask & 1) + ++count; + mask >>= 1; + } + return count; +} + +VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLConfig config) +{ + VisualID visualId = 0; + EGLint eglValue = 0; + + EGLDisplay eglDisplay = eglGetDisplay(display); + + EGLint configRedSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_RED_SIZE, &configRedSize); + + EGLint configGreenSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_GREEN_SIZE, &configGreenSize); + + EGLint configBlueSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_BLUE_SIZE, &configBlueSize); + + EGLint configAlphaSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_ALPHA_SIZE, &configAlphaSize); + + eglGetConfigAttrib(eglDisplay, config, EGL_CONFIG_ID, &eglValue); + int configId = eglValue; + + // See if EGL provided a valid VisualID: + eglGetConfigAttrib(eglDisplay, config, EGL_NATIVE_VISUAL_ID, &eglValue); + visualId = (VisualID)eglValue; + if (visualId) { + // EGL has suggested a visual id, so get the rest of the visual info for that id: + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + visualInfoTemplate.visualid = visualId; + + XVisualInfo *chosenVisualInfo; + int matchingCount = 0; + chosenVisualInfo = XGetVisualInfo(display, VisualIDMask, &visualInfoTemplate, &matchingCount); + if (chosenVisualInfo) { + // Skip size checks if implementation supports non-matching visual + // and config (http://bugreports.qt.nokia.com/browse/QTBUG-9444). + if (q_hasEglExtension(eglDisplay,"EGL_NV_post_convert_rounding")) { + XFree(chosenVisualInfo); + return visualId; + } + + int visualRedSize = countBits(chosenVisualInfo->red_mask); + int visualGreenSize = countBits(chosenVisualInfo->green_mask); + int visualBlueSize = countBits(chosenVisualInfo->blue_mask); + int visualAlphaSize = -1; // Need XRender to tell us the alpha channel size + + bool visualMatchesConfig = false; + if ( visualRedSize == configRedSize && + visualGreenSize == configGreenSize && + visualBlueSize == configBlueSize ) + { + // We need XRender to check the alpha channel size of the visual. If we don't have + // the alpha size, we don't check it against the EGL config's alpha size. + if (visualAlphaSize >= 0) + visualMatchesConfig = visualAlphaSize == configAlphaSize; + else + visualMatchesConfig = true; + } + + if (!visualMatchesConfig) { + if (visualAlphaSize >= 0) { + qWarning("Warning: EGL suggested using X Visual ID %d (ARGB%d%d%d%d) for EGL config %d (ARGB%d%d%d%d), but this is incompatable", + (int)visualId, visualAlphaSize, visualRedSize, visualGreenSize, visualBlueSize, + configId, configAlphaSize, configRedSize, configGreenSize, configBlueSize); + } else { + qWarning("Warning: EGL suggested using X Visual ID %d (RGB%d%d%d) for EGL config %d (RGB%d%d%d), but this is incompatable", + (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, + configId, configRedSize, configGreenSize, configBlueSize); + } + visualId = 0; + } + } else { + qWarning("Warning: EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", + (int)visualId, configId); + visualId = 0; + } + XFree(chosenVisualInfo); + } +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + else + qDebug("EGL did not suggest a VisualID (EGL_NATIVE_VISUAL_ID was zero) for EGLConfig %d", configId); +#endif + + if (visualId) { +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + if (configAlphaSize > 0) + qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, configId); + else + qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId); +#endif + return visualId; + } + + // Finally, try to + // use XGetVisualInfo and only use the bit depths to match on: + if (!visualId) { + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + XVisualInfo *matchingVisuals; + int matchingCount = 0; + + visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize + configAlphaSize; + matchingVisuals = XGetVisualInfo(display, + VisualDepthMask, + &visualInfoTemplate, + &matchingCount); + if (!matchingVisuals) { + // Try again without taking the alpha channel into account: + visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize; + matchingVisuals = XGetVisualInfo(display, + VisualDepthMask, + &visualInfoTemplate, + &matchingCount); + } + + if (matchingVisuals) { + visualId = matchingVisuals[0].visualid; + XFree(matchingVisuals); + } + } + + if (visualId) { +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, configId); +#endif + return visualId; + } + + qWarning("Unable to find an X11 visual which matches EGL config %d", configId); + return (VisualID)0; +} diff --git a/src/plugins/platforms/xlib/qtestliteeglintegration.h b/src/plugins/platforms/xlib/qtestliteeglintegration.h new file mode 100644 index 0000000..4c2e50d --- /dev/null +++ b/src/plugins/platforms/xlib/qtestliteeglintegration.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITEEGLINTEGRATION_H +#define QTESTLITEEGLINTEGRATION_H + +#include "qtestlitestaticinfo.h" +#include "../eglconvenience/qeglconvenience.h" + +class QXlibEglIntegration +{ +public: + static VisualID getCompatibleVisualId(Display *display, EGLConfig config); +}; + +#endif // QTESTLITEEGLINTEGRATION_H diff --git a/src/plugins/platforms/xlib/qtestliteintegration.cpp b/src/plugins/platforms/xlib/qtestliteintegration.cpp new file mode 100644 index 0000000..cdc5c29 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestliteintegration.cpp @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestliteintegration.h" +#include "qtestlitewindowsurface.h" +#include <QtGui/private/qpixmap_raster_p.h> +#include <QtCore/qdebug.h> + +#include "qtestlitewindow.h" +#include "qgenericunixfontdatabase.h" +#include "qtestlitescreen.h" +#include "qtestliteclipboard.h" + +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) +#include <GL/glx.h> +#else +#include <EGL/egl.h> +#endif //!defined(QT_OPENGL_ES_2) +#include <private/qwindowsurface_gl_p.h> +#include <private/qpixmapdata_gl_p.h> +#endif //QT_NO_OPENGL + +QT_BEGIN_NAMESPACE + +QXlibIntegration::QXlibIntegration(bool useOpenGL) + : mUseOpenGL(useOpenGL) + , mFontDb(new QGenericUnixFontDatabase()) + , mClipboard(0) +{ + mPrimaryScreen = new QXlibScreen(); + mScreens.append(mPrimaryScreen); +} + +QPixmapData *QXlibIntegration::createPixmapData(QPixmapData::PixelType type) const +{ +#ifndef QT_NO_OPENGL + if (mUseOpenGL) + return new QGLPixmapData(type); +#endif + return new QRasterPixmapData(type); +} + +QWindowSurface *QXlibIntegration::createWindowSurface(QWidget *widget, WId) const +{ +#ifndef QT_NO_OPENGL + if (mUseOpenGL) + return new QGLWindowSurface(widget); +#endif + return new QXlibWindowSurface(widget); +} + + +QPlatformWindow *QXlibIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const +{ + return new QXlibWindow(widget); +} + + + +QPixmap QXlibIntegration::grabWindow(WId window, int x, int y, int width, int height) const +{ + QImage image; + QWidget *widget = QWidget::find(window); + if (widget) { + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); + image = screen->grabWindow(window,x,y,width,height); + } else { + for (int i = 0; i < mScreens.size(); i++) { + QXlibScreen *screen = static_cast<QXlibScreen *>(mScreens[i]); + if (screen->rootWindow() == window) { + image = screen->grabWindow(window,x,y,width,height); + } + } + } + return QPixmap::fromImage(image); +} + +QPlatformFontDatabase *QXlibIntegration::fontDatabase() const +{ + return mFontDb; +} + +QPlatformClipboard * QXlibIntegration::clipboard() const +{ + //Use lazy init since clipboard needs QTestliteScreen + if (!mClipboard) { + QXlibIntegration *that = const_cast<QXlibIntegration *>(this); + that->mClipboard = new QXlibClipboard(mPrimaryScreen); + } + return mClipboard; +} + +bool QXlibIntegration::hasOpenGL() const +{ +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) + QXlibScreen *screen = static_cast<const QXlibScreen *>(mScreens.at(0)); + return glXQueryExtension(screen->display(), 0, 0) != 0; +#else + static bool eglHasbeenInitialized = false; + static bool wasEglInitialized = false; + if (!eglHasbeenInitialized) { + eglHasbeenInitialized = true; + const QXlibScreen *screen = static_cast<const QXlibScreen *>(mScreens.at(0)); + EGLint major, minor; + eglBindAPI(EGL_OPENGL_ES_API); + EGLDisplay disp = eglGetDisplay(screen->display()); + wasEglInitialized = eglInitialize(disp,&major,&minor); + } + return wasEglInitialized; +#endif +#endif + return false; +} + + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qtestliteintegration.h b/src/plugins/platforms/xlib/qtestliteintegration.h new file mode 100644 index 0000000..c3125b8 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestliteintegration.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_TESTLITE_H +#define QGRAPHICSSYSTEM_TESTLITE_H + +//make sure textstream is included before any X11 headers +#include <QtCore/QTextStream> + +#include <QtGui/QPlatformIntegration> +#include <QtGui/QPlatformScreen> + +#include "qtestlitestaticinfo.h" + +QT_BEGIN_NAMESPACE + +class QXlibScreen; + +class QXlibIntegration : public QPlatformIntegration +{ +public: + QXlibIntegration(bool useOpenGL = false); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + + QPixmap grabWindow(WId window, int x, int y, int width, int height) const; + + QList<QPlatformScreen *> screens() const { return mScreens; } + + QPlatformFontDatabase *fontDatabase() const; + QPlatformClipboard *clipboard() const; + + bool hasOpenGL() const; + +private: + bool mUseOpenGL; + QXlibScreen *mPrimaryScreen; + QList<QPlatformScreen *> mScreens; + QPlatformFontDatabase *mFontDb; + QPlatformClipboard *mClipboard; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/xlib/qtestlitekeyboard.cpp b/src/plugins/platforms/xlib/qtestlitekeyboard.cpp new file mode 100644 index 0000000..fb0cf2e --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitekeyboard.cpp @@ -0,0 +1,1000 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitekeyboard.h" + +#include "qtestlitescreen.h" + +#include <QtGui/QWindowSystemInterface> + +#include <QtCore/QTextCodec> + +#ifndef XK_ISO_Left_Tab +#define XK_ISO_Left_Tab 0xFE20 +#endif + +#ifndef XK_dead_hook +#define XK_dead_hook 0xFE61 +#endif + +#ifndef XK_dead_horn +#define XK_dead_horn 0xFE62 +#endif + +#ifndef XK_Codeinput +#define XK_Codeinput 0xFF37 +#endif + +#ifndef XK_Kanji_Bangou +#define XK_Kanji_Bangou 0xFF37 /* same as codeinput */ +#endif + +// Fix old X libraries +#ifndef XK_KP_Home +#define XK_KP_Home 0xFF95 +#endif +#ifndef XK_KP_Left +#define XK_KP_Left 0xFF96 +#endif +#ifndef XK_KP_Up +#define XK_KP_Up 0xFF97 +#endif +#ifndef XK_KP_Right +#define XK_KP_Right 0xFF98 +#endif +#ifndef XK_KP_Down +#define XK_KP_Down 0xFF99 +#endif +#ifndef XK_KP_Prior +#define XK_KP_Prior 0xFF9A +#endif +#ifndef XK_KP_Next +#define XK_KP_Next 0xFF9B +#endif +#ifndef XK_KP_End +#define XK_KP_End 0xFF9C +#endif +#ifndef XK_KP_Insert +#define XK_KP_Insert 0xFF9E +#endif +#ifndef XK_KP_Delete +#define XK_KP_Delete 0xFF9F +#endif + +// the next lines are taken on 10/2009 from X.org (X11/XF86keysym.h), defining some special +// multimedia keys. They are included here as not every system has them. +#define XF86XK_MonBrightnessUp 0x1008FF02 +#define XF86XK_MonBrightnessDown 0x1008FF03 +#define XF86XK_KbdLightOnOff 0x1008FF04 +#define XF86XK_KbdBrightnessUp 0x1008FF05 +#define XF86XK_KbdBrightnessDown 0x1008FF06 +#define XF86XK_Standby 0x1008FF10 +#define XF86XK_AudioLowerVolume 0x1008FF11 +#define XF86XK_AudioMute 0x1008FF12 +#define XF86XK_AudioRaiseVolume 0x1008FF13 +#define XF86XK_AudioPlay 0x1008FF14 +#define XF86XK_AudioStop 0x1008FF15 +#define XF86XK_AudioPrev 0x1008FF16 +#define XF86XK_AudioNext 0x1008FF17 +#define XF86XK_HomePage 0x1008FF18 +#define XF86XK_Mail 0x1008FF19 +#define XF86XK_Start 0x1008FF1A +#define XF86XK_Search 0x1008FF1B +#define XF86XK_AudioRecord 0x1008FF1C +#define XF86XK_Calculator 0x1008FF1D +#define XF86XK_Memo 0x1008FF1E +#define XF86XK_ToDoList 0x1008FF1F +#define XF86XK_Calendar 0x1008FF20 +#define XF86XK_PowerDown 0x1008FF21 +#define XF86XK_ContrastAdjust 0x1008FF22 +#define XF86XK_Back 0x1008FF26 +#define XF86XK_Forward 0x1008FF27 +#define XF86XK_Stop 0x1008FF28 +#define XF86XK_Refresh 0x1008FF29 +#define XF86XK_PowerOff 0x1008FF2A +#define XF86XK_WakeUp 0x1008FF2B +#define XF86XK_Eject 0x1008FF2C +#define XF86XK_ScreenSaver 0x1008FF2D +#define XF86XK_WWW 0x1008FF2E +#define XF86XK_Sleep 0x1008FF2F +#define XF86XK_Favorites 0x1008FF30 +#define XF86XK_AudioPause 0x1008FF31 +#define XF86XK_AudioMedia 0x1008FF32 +#define XF86XK_MyComputer 0x1008FF33 +#define XF86XK_LightBulb 0x1008FF35 +#define XF86XK_Shop 0x1008FF36 +#define XF86XK_History 0x1008FF37 +#define XF86XK_OpenURL 0x1008FF38 +#define XF86XK_AddFavorite 0x1008FF39 +#define XF86XK_HotLinks 0x1008FF3A +#define XF86XK_BrightnessAdjust 0x1008FF3B +#define XF86XK_Finance 0x1008FF3C +#define XF86XK_Community 0x1008FF3D +#define XF86XK_AudioRewind 0x1008FF3E +#define XF86XK_BackForward 0x1008FF3F +#define XF86XK_Launch0 0x1008FF40 +#define XF86XK_Launch1 0x1008FF41 +#define XF86XK_Launch2 0x1008FF42 +#define XF86XK_Launch3 0x1008FF43 +#define XF86XK_Launch4 0x1008FF44 +#define XF86XK_Launch5 0x1008FF45 +#define XF86XK_Launch6 0x1008FF46 +#define XF86XK_Launch7 0x1008FF47 +#define XF86XK_Launch8 0x1008FF48 +#define XF86XK_Launch9 0x1008FF49 +#define XF86XK_LaunchA 0x1008FF4A +#define XF86XK_LaunchB 0x1008FF4B +#define XF86XK_LaunchC 0x1008FF4C +#define XF86XK_LaunchD 0x1008FF4D +#define XF86XK_LaunchE 0x1008FF4E +#define XF86XK_LaunchF 0x1008FF4F +#define XF86XK_ApplicationLeft 0x1008FF50 +#define XF86XK_ApplicationRight 0x1008FF51 +#define XF86XK_Book 0x1008FF52 +#define XF86XK_CD 0x1008FF53 +#define XF86XK_Calculater 0x1008FF54 +#define XF86XK_Clear 0x1008FF55 +#define XF86XK_ClearGrab 0x1008FE21 +#define XF86XK_Close 0x1008FF56 +#define XF86XK_Copy 0x1008FF57 +#define XF86XK_Cut 0x1008FF58 +#define XF86XK_Display 0x1008FF59 +#define XF86XK_DOS 0x1008FF5A +#define XF86XK_Documents 0x1008FF5B +#define XF86XK_Excel 0x1008FF5C +#define XF86XK_Explorer 0x1008FF5D +#define XF86XK_Game 0x1008FF5E +#define XF86XK_Go 0x1008FF5F +#define XF86XK_iTouch 0x1008FF60 +#define XF86XK_LogOff 0x1008FF61 +#define XF86XK_Market 0x1008FF62 +#define XF86XK_Meeting 0x1008FF63 +#define XF86XK_MenuKB 0x1008FF65 +#define XF86XK_MenuPB 0x1008FF66 +#define XF86XK_MySites 0x1008FF67 +#define XF86XK_News 0x1008FF69 +#define XF86XK_OfficeHome 0x1008FF6A +#define XF86XK_Option 0x1008FF6C +#define XF86XK_Paste 0x1008FF6D +#define XF86XK_Phone 0x1008FF6E +#define XF86XK_Reply 0x1008FF72 +#define XF86XK_Reload 0x1008FF73 +#define XF86XK_RotateWindows 0x1008FF74 +#define XF86XK_RotationPB 0x1008FF75 +#define XF86XK_RotationKB 0x1008FF76 +#define XF86XK_Save 0x1008FF77 +#define XF86XK_Send 0x1008FF7B +#define XF86XK_Spell 0x1008FF7C +#define XF86XK_SplitScreen 0x1008FF7D +#define XF86XK_Support 0x1008FF7E +#define XF86XK_TaskPane 0x1008FF7F +#define XF86XK_Terminal 0x1008FF80 +#define XF86XK_Tools 0x1008FF81 +#define XF86XK_Travel 0x1008FF82 +#define XF86XK_Video 0x1008FF87 +#define XF86XK_Word 0x1008FF89 +#define XF86XK_Xfer 0x1008FF8A +#define XF86XK_ZoomIn 0x1008FF8B +#define XF86XK_ZoomOut 0x1008FF8C +#define XF86XK_Away 0x1008FF8D +#define XF86XK_Messenger 0x1008FF8E +#define XF86XK_WebCam 0x1008FF8F +#define XF86XK_MailForward 0x1008FF90 +#define XF86XK_Pictures 0x1008FF91 +#define XF86XK_Music 0x1008FF92 +#define XF86XK_Battery 0x1008FF93 +#define XF86XK_Bluetooth 0x1008FF94 +#define XF86XK_WLAN 0x1008FF95 +#define XF86XK_UWB 0x1008FF96 +#define XF86XK_AudioForward 0x1008FF97 +#define XF86XK_AudioRepeat 0x1008FF98 +#define XF86XK_AudioRandomPlay 0x1008FF99 +#define XF86XK_Subtitle 0x1008FF9A +#define XF86XK_AudioCycleTrack 0x1008FF9B +#define XF86XK_Time 0x1008FF9F +#define XF86XK_Select 0x1008FFA0 +#define XF86XK_View 0x1008FFA1 +#define XF86XK_TopMenu 0x1008FFA2 +#define XF86XK_Suspend 0x1008FFA7 +#define XF86XK_Hibernate 0x1008FFA8 + + +// end of XF86keysyms.h + +// Special keys used by Qtopia, mapped into the X11 private keypad range. +#define QTOPIAXK_Select 0x11000601 +#define QTOPIAXK_Yes 0x11000602 +#define QTOPIAXK_No 0x11000603 +#define QTOPIAXK_Cancel 0x11000604 +#define QTOPIAXK_Printer 0x11000605 +#define QTOPIAXK_Execute 0x11000606 +#define QTOPIAXK_Sleep 0x11000607 +#define QTOPIAXK_Play 0x11000608 +#define QTOPIAXK_Zoom 0x11000609 +#define QTOPIAXK_Context1 0x1100060A +#define QTOPIAXK_Context2 0x1100060B +#define QTOPIAXK_Context3 0x1100060C +#define QTOPIAXK_Context4 0x1100060D +#define QTOPIAXK_Call 0x1100060E +#define QTOPIAXK_Hangup 0x1100060F +#define QTOPIAXK_Flip 0x11000610 + +// keyboard mapping table +static const unsigned int KeyTbl[] = { + + // misc keys + + XK_Escape, Qt::Key_Escape, + XK_Tab, Qt::Key_Tab, + XK_ISO_Left_Tab, Qt::Key_Backtab, + XK_BackSpace, Qt::Key_Backspace, + XK_Return, Qt::Key_Return, + XK_Insert, Qt::Key_Insert, + XK_Delete, Qt::Key_Delete, + XK_Clear, Qt::Key_Delete, + XK_Pause, Qt::Key_Pause, + XK_Print, Qt::Key_Print, + 0x1005FF60, Qt::Key_SysReq, // hardcoded Sun SysReq + 0x1007ff00, Qt::Key_SysReq, // hardcoded X386 SysReq + + // cursor movement + + XK_Home, Qt::Key_Home, + XK_End, Qt::Key_End, + XK_Left, Qt::Key_Left, + XK_Up, Qt::Key_Up, + XK_Right, Qt::Key_Right, + XK_Down, Qt::Key_Down, + XK_Prior, Qt::Key_PageUp, + XK_Next, Qt::Key_PageDown, + + // modifiers + + XK_Shift_L, Qt::Key_Shift, + XK_Shift_R, Qt::Key_Shift, + XK_Shift_Lock, Qt::Key_Shift, + XK_Control_L, Qt::Key_Control, + XK_Control_R, Qt::Key_Control, + XK_Meta_L, Qt::Key_Meta, + XK_Meta_R, Qt::Key_Meta, + XK_Alt_L, Qt::Key_Alt, + XK_Alt_R, Qt::Key_Alt, + XK_Caps_Lock, Qt::Key_CapsLock, + XK_Num_Lock, Qt::Key_NumLock, + XK_Scroll_Lock, Qt::Key_ScrollLock, + XK_Super_L, Qt::Key_Super_L, + XK_Super_R, Qt::Key_Super_R, + XK_Menu, Qt::Key_Menu, + XK_Hyper_L, Qt::Key_Hyper_L, + XK_Hyper_R, Qt::Key_Hyper_R, + XK_Help, Qt::Key_Help, + 0x1000FF74, Qt::Key_Backtab, // hardcoded HP backtab + 0x1005FF10, Qt::Key_F11, // hardcoded Sun F36 (labeled F11) + 0x1005FF11, Qt::Key_F12, // hardcoded Sun F37 (labeled F12) + + // numeric and function keypad keys + + XK_KP_Space, Qt::Key_Space, + XK_KP_Tab, Qt::Key_Tab, + XK_KP_Enter, Qt::Key_Enter, + //XK_KP_F1, Qt::Key_F1, + //XK_KP_F2, Qt::Key_F2, + //XK_KP_F3, Qt::Key_F3, + //XK_KP_F4, Qt::Key_F4, + XK_KP_Home, Qt::Key_Home, + XK_KP_Left, Qt::Key_Left, + XK_KP_Up, Qt::Key_Up, + XK_KP_Right, Qt::Key_Right, + XK_KP_Down, Qt::Key_Down, + XK_KP_Prior, Qt::Key_PageUp, + XK_KP_Next, Qt::Key_PageDown, + XK_KP_End, Qt::Key_End, + XK_KP_Begin, Qt::Key_Clear, + XK_KP_Insert, Qt::Key_Insert, + XK_KP_Delete, Qt::Key_Delete, + XK_KP_Equal, Qt::Key_Equal, + XK_KP_Multiply, Qt::Key_Asterisk, + XK_KP_Add, Qt::Key_Plus, + XK_KP_Separator, Qt::Key_Comma, + XK_KP_Subtract, Qt::Key_Minus, + XK_KP_Decimal, Qt::Key_Period, + XK_KP_Divide, Qt::Key_Slash, + + // International input method support keys + + // International & multi-key character composition + XK_ISO_Level3_Shift, Qt::Key_AltGr, + XK_Multi_key, Qt::Key_Multi_key, + XK_Codeinput, Qt::Key_Codeinput, + XK_SingleCandidate, Qt::Key_SingleCandidate, + XK_MultipleCandidate, Qt::Key_MultipleCandidate, + XK_PreviousCandidate, Qt::Key_PreviousCandidate, + + // Misc Functions + XK_Mode_switch, Qt::Key_Mode_switch, + XK_script_switch, Qt::Key_Mode_switch, + + // Japanese keyboard support + XK_Kanji, Qt::Key_Kanji, + XK_Muhenkan, Qt::Key_Muhenkan, + //XK_Henkan_Mode, Qt::Key_Henkan_Mode, + XK_Henkan_Mode, Qt::Key_Henkan, + XK_Henkan, Qt::Key_Henkan, + XK_Romaji, Qt::Key_Romaji, + XK_Hiragana, Qt::Key_Hiragana, + XK_Katakana, Qt::Key_Katakana, + XK_Hiragana_Katakana, Qt::Key_Hiragana_Katakana, + XK_Zenkaku, Qt::Key_Zenkaku, + XK_Hankaku, Qt::Key_Hankaku, + XK_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku, + XK_Touroku, Qt::Key_Touroku, + XK_Massyo, Qt::Key_Massyo, + XK_Kana_Lock, Qt::Key_Kana_Lock, + XK_Kana_Shift, Qt::Key_Kana_Shift, + XK_Eisu_Shift, Qt::Key_Eisu_Shift, + XK_Eisu_toggle, Qt::Key_Eisu_toggle, + //XK_Kanji_Bangou, Qt::Key_Kanji_Bangou, + //XK_Zen_Koho, Qt::Key_Zen_Koho, + //XK_Mae_Koho, Qt::Key_Mae_Koho, + XK_Kanji_Bangou, Qt::Key_Codeinput, + XK_Zen_Koho, Qt::Key_MultipleCandidate, + XK_Mae_Koho, Qt::Key_PreviousCandidate, + +#ifdef XK_KOREAN + // Korean keyboard support + XK_Hangul, Qt::Key_Hangul, + XK_Hangul_Start, Qt::Key_Hangul_Start, + XK_Hangul_End, Qt::Key_Hangul_End, + XK_Hangul_Hanja, Qt::Key_Hangul_Hanja, + XK_Hangul_Jamo, Qt::Key_Hangul_Jamo, + XK_Hangul_Romaja, Qt::Key_Hangul_Romaja, + //XK_Hangul_Codeinput, Qt::Key_Hangul_Codeinput, + XK_Hangul_Codeinput, Qt::Key_Codeinput, + XK_Hangul_Jeonja, Qt::Key_Hangul_Jeonja, + XK_Hangul_Banja, Qt::Key_Hangul_Banja, + XK_Hangul_PreHanja, Qt::Key_Hangul_PreHanja, + XK_Hangul_PostHanja, Qt::Key_Hangul_PostHanja, + //XK_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate, + //XK_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate, + //XK_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate, + XK_Hangul_SingleCandidate, Qt::Key_SingleCandidate, + XK_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate, + XK_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate, + XK_Hangul_Special, Qt::Key_Hangul_Special, + //XK_Hangul_switch, Qt::Key_Hangul_switch, + XK_Hangul_switch, Qt::Key_Mode_switch, +#endif // XK_KOREAN + + // dead keys + XK_dead_grave, Qt::Key_Dead_Grave, + XK_dead_acute, Qt::Key_Dead_Acute, + XK_dead_circumflex, Qt::Key_Dead_Circumflex, + XK_dead_tilde, Qt::Key_Dead_Tilde, + XK_dead_macron, Qt::Key_Dead_Macron, + XK_dead_breve, Qt::Key_Dead_Breve, + XK_dead_abovedot, Qt::Key_Dead_Abovedot, + XK_dead_diaeresis, Qt::Key_Dead_Diaeresis, + XK_dead_abovering, Qt::Key_Dead_Abovering, + XK_dead_doubleacute, Qt::Key_Dead_Doubleacute, + XK_dead_caron, Qt::Key_Dead_Caron, + XK_dead_cedilla, Qt::Key_Dead_Cedilla, + XK_dead_ogonek, Qt::Key_Dead_Ogonek, + XK_dead_iota, Qt::Key_Dead_Iota, + XK_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound, + XK_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound, + XK_dead_belowdot, Qt::Key_Dead_Belowdot, + XK_dead_hook, Qt::Key_Dead_Hook, + XK_dead_horn, Qt::Key_Dead_Horn, + + // Special keys from X.org - This include multimedia keys, + // wireless/bluetooth/uwb keys, special launcher keys, etc. + XF86XK_Back, Qt::Key_Back, + XF86XK_Forward, Qt::Key_Forward, + XF86XK_Stop, Qt::Key_Stop, + XF86XK_Refresh, Qt::Key_Refresh, + XF86XK_Favorites, Qt::Key_Favorites, + XF86XK_AudioMedia, Qt::Key_LaunchMedia, + XF86XK_OpenURL, Qt::Key_OpenUrl, + XF86XK_HomePage, Qt::Key_HomePage, + XF86XK_Search, Qt::Key_Search, + XF86XK_AudioLowerVolume, Qt::Key_VolumeDown, + XF86XK_AudioMute, Qt::Key_VolumeMute, + XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp, + XF86XK_AudioPlay, Qt::Key_MediaPlay, + XF86XK_AudioStop, Qt::Key_MediaStop, + XF86XK_AudioPrev, Qt::Key_MediaPrevious, + XF86XK_AudioNext, Qt::Key_MediaNext, + XF86XK_AudioRecord, Qt::Key_MediaRecord, + XF86XK_Mail, Qt::Key_LaunchMail, + XF86XK_MyComputer, Qt::Key_Launch0, // ### Qt 5: remap properly + XF86XK_Calculator, Qt::Key_Launch1, + XF86XK_Memo, Qt::Key_Memo, + XF86XK_ToDoList, Qt::Key_ToDoList, + XF86XK_Calendar, Qt::Key_Calendar, + XF86XK_PowerDown, Qt::Key_PowerDown, + XF86XK_ContrastAdjust, Qt::Key_ContrastAdjust, + XF86XK_Standby, Qt::Key_Standby, + XF86XK_MonBrightnessUp, Qt::Key_MonBrightnessUp, + XF86XK_MonBrightnessDown, Qt::Key_MonBrightnessDown, + XF86XK_KbdLightOnOff, Qt::Key_KeyboardLightOnOff, + XF86XK_KbdBrightnessUp, Qt::Key_KeyboardBrightnessUp, + XF86XK_KbdBrightnessDown, Qt::Key_KeyboardBrightnessDown, + XF86XK_PowerOff, Qt::Key_PowerOff, + XF86XK_WakeUp, Qt::Key_WakeUp, + XF86XK_Eject, Qt::Key_Eject, + XF86XK_ScreenSaver, Qt::Key_ScreenSaver, + XF86XK_WWW, Qt::Key_WWW, + XF86XK_Sleep, Qt::Key_Sleep, + XF86XK_LightBulb, Qt::Key_LightBulb, + XF86XK_Shop, Qt::Key_Shop, + XF86XK_History, Qt::Key_History, + XF86XK_AddFavorite, Qt::Key_AddFavorite, + XF86XK_HotLinks, Qt::Key_HotLinks, + XF86XK_BrightnessAdjust, Qt::Key_BrightnessAdjust, + XF86XK_Finance, Qt::Key_Finance, + XF86XK_Community, Qt::Key_Community, + XF86XK_AudioRewind, Qt::Key_AudioRewind, + XF86XK_BackForward, Qt::Key_BackForward, + XF86XK_ApplicationLeft, Qt::Key_ApplicationLeft, + XF86XK_ApplicationRight, Qt::Key_ApplicationRight, + XF86XK_Book, Qt::Key_Book, + XF86XK_CD, Qt::Key_CD, + XF86XK_Calculater, Qt::Key_Calculator, + XF86XK_Clear, Qt::Key_Clear, + XF86XK_ClearGrab, Qt::Key_ClearGrab, + XF86XK_Close, Qt::Key_Close, + XF86XK_Copy, Qt::Key_Copy, + XF86XK_Cut, Qt::Key_Cut, + XF86XK_Display, Qt::Key_Display, + XF86XK_DOS, Qt::Key_DOS, + XF86XK_Documents, Qt::Key_Documents, + XF86XK_Excel, Qt::Key_Excel, + XF86XK_Explorer, Qt::Key_Explorer, + XF86XK_Game, Qt::Key_Game, + XF86XK_Go, Qt::Key_Go, + XF86XK_iTouch, Qt::Key_iTouch, + XF86XK_LogOff, Qt::Key_LogOff, + XF86XK_Market, Qt::Key_Market, + XF86XK_Meeting, Qt::Key_Meeting, + XF86XK_MenuKB, Qt::Key_MenuKB, + XF86XK_MenuPB, Qt::Key_MenuPB, + XF86XK_MySites, Qt::Key_MySites, + XF86XK_News, Qt::Key_News, + XF86XK_OfficeHome, Qt::Key_OfficeHome, + XF86XK_Option, Qt::Key_Option, + XF86XK_Paste, Qt::Key_Paste, + XF86XK_Phone, Qt::Key_Phone, + XF86XK_Reply, Qt::Key_Reply, + XF86XK_Reload, Qt::Key_Reload, + XF86XK_RotateWindows, Qt::Key_RotateWindows, + XF86XK_RotationPB, Qt::Key_RotationPB, + XF86XK_RotationKB, Qt::Key_RotationKB, + XF86XK_Save, Qt::Key_Save, + XF86XK_Send, Qt::Key_Send, + XF86XK_Spell, Qt::Key_Spell, + XF86XK_SplitScreen, Qt::Key_SplitScreen, + XF86XK_Support, Qt::Key_Support, + XF86XK_TaskPane, Qt::Key_TaskPane, + XF86XK_Terminal, Qt::Key_Terminal, + XF86XK_Tools, Qt::Key_Tools, + XF86XK_Travel, Qt::Key_Travel, + XF86XK_Video, Qt::Key_Video, + XF86XK_Word, Qt::Key_Word, + XF86XK_Xfer, Qt::Key_Xfer, + XF86XK_ZoomIn, Qt::Key_ZoomIn, + XF86XK_ZoomOut, Qt::Key_ZoomOut, + XF86XK_Away, Qt::Key_Away, + XF86XK_Messenger, Qt::Key_Messenger, + XF86XK_WebCam, Qt::Key_WebCam, + XF86XK_MailForward, Qt::Key_MailForward, + XF86XK_Pictures, Qt::Key_Pictures, + XF86XK_Music, Qt::Key_Music, + XF86XK_Battery, Qt::Key_Battery, + XF86XK_Bluetooth, Qt::Key_Bluetooth, + XF86XK_WLAN, Qt::Key_WLAN, + XF86XK_UWB, Qt::Key_UWB, + XF86XK_AudioForward, Qt::Key_AudioForward, + XF86XK_AudioRepeat, Qt::Key_AudioRepeat, + XF86XK_AudioRandomPlay, Qt::Key_AudioRandomPlay, + XF86XK_Subtitle, Qt::Key_Subtitle, + XF86XK_AudioCycleTrack, Qt::Key_AudioCycleTrack, + XF86XK_Time, Qt::Key_Time, + XF86XK_Select, Qt::Key_Select, + XF86XK_View, Qt::Key_View, + XF86XK_TopMenu, Qt::Key_TopMenu, + XF86XK_Bluetooth, Qt::Key_Bluetooth, + XF86XK_Suspend, Qt::Key_Suspend, + XF86XK_Hibernate, Qt::Key_Hibernate, + XF86XK_Launch0, Qt::Key_Launch2, // ### Qt 5: remap properly + XF86XK_Launch1, Qt::Key_Launch3, + XF86XK_Launch2, Qt::Key_Launch4, + XF86XK_Launch3, Qt::Key_Launch5, + XF86XK_Launch4, Qt::Key_Launch6, + XF86XK_Launch5, Qt::Key_Launch7, + XF86XK_Launch6, Qt::Key_Launch8, + XF86XK_Launch7, Qt::Key_Launch9, + XF86XK_Launch8, Qt::Key_LaunchA, + XF86XK_Launch9, Qt::Key_LaunchB, + XF86XK_LaunchA, Qt::Key_LaunchC, + XF86XK_LaunchB, Qt::Key_LaunchD, + XF86XK_LaunchC, Qt::Key_LaunchE, + XF86XK_LaunchD, Qt::Key_LaunchF, + XF86XK_LaunchE, Qt::Key_LaunchG, + XF86XK_LaunchF, Qt::Key_LaunchH, + + // Qtopia keys + QTOPIAXK_Select, Qt::Key_Select, + QTOPIAXK_Yes, Qt::Key_Yes, + QTOPIAXK_No, Qt::Key_No, + QTOPIAXK_Cancel, Qt::Key_Cancel, + QTOPIAXK_Printer, Qt::Key_Printer, + QTOPIAXK_Execute, Qt::Key_Execute, + QTOPIAXK_Sleep, Qt::Key_Sleep, + QTOPIAXK_Play, Qt::Key_Play, + QTOPIAXK_Zoom, Qt::Key_Zoom, + QTOPIAXK_Context1, Qt::Key_Context1, + QTOPIAXK_Context2, Qt::Key_Context2, + QTOPIAXK_Context3, Qt::Key_Context3, + QTOPIAXK_Context4, Qt::Key_Context4, + QTOPIAXK_Call, Qt::Key_Call, + QTOPIAXK_Hangup, Qt::Key_Hangup, + QTOPIAXK_Flip, Qt::Key_Flip, + + 0, 0 +}; + +static const unsigned short katakanaKeysymsToUnicode[] = { + 0x0000, 0x3002, 0x300C, 0x300D, 0x3001, 0x30FB, 0x30F2, 0x30A1, + 0x30A3, 0x30A5, 0x30A7, 0x30A9, 0x30E3, 0x30E5, 0x30E7, 0x30C3, + 0x30FC, 0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30AB, 0x30AD, + 0x30AF, 0x30B1, 0x30B3, 0x30B5, 0x30B7, 0x30B9, 0x30BB, 0x30BD, + 0x30BF, 0x30C1, 0x30C4, 0x30C6, 0x30C8, 0x30CA, 0x30CB, 0x30CC, + 0x30CD, 0x30CE, 0x30CF, 0x30D2, 0x30D5, 0x30D8, 0x30DB, 0x30DE, + 0x30DF, 0x30E0, 0x30E1, 0x30E2, 0x30E4, 0x30E6, 0x30E8, 0x30E9, + 0x30EA, 0x30EB, 0x30EC, 0x30ED, 0x30EF, 0x30F3, 0x309B, 0x309C +}; + +static const unsigned short cyrillicKeysymsToUnicode[] = { + 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, + 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0000, 0x045e, 0x045f, + 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, + 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0000, 0x040e, 0x040f, + 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, + 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, + 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, + 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, + 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, + 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, + 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, + 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a +}; + +static const unsigned short greekKeysymsToUnicode[] = { + 0x0000, 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, + 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, + 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, + 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, + 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, + 0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, + 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, + 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, + 0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, + 0x03c8, 0x03c9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short technicalKeysymsToUnicode[] = { + 0x0000, 0x23B7, 0x250C, 0x2500, 0x2320, 0x2321, 0x2502, 0x23A1, + 0x23A3, 0x23A4, 0x23A6, 0x239B, 0x239D, 0x239E, 0x23A0, 0x23A8, + 0x23AC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222B, + 0x2234, 0x221D, 0x221E, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, + 0x223C, 0x2243, 0x0000, 0x0000, 0x0000, 0x21D4, 0x21D2, 0x2261, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221A, 0x0000, + 0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222A, 0x2227, 0x2228, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2202, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, + 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193, 0x0000 +}; + +static const unsigned short specialKeysymsToUnicode[] = { + 0x25C6, 0x2592, 0x2409, 0x240C, 0x240D, 0x240A, 0x0000, 0x0000, + 0x2424, 0x240B, 0x2518, 0x2510, 0x250C, 0x2514, 0x253C, 0x23BA, + 0x23BB, 0x2500, 0x23BC, 0x23BD, 0x251C, 0x2524, 0x2534, 0x252C, + 0x2502, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short publishingKeysymsToUnicode[] = { + 0x0000, 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, + 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, + 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, + 0x2105, 0x0000, 0x0000, 0x2012, 0x2329, 0x0000, 0x232a, 0x0000, + 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, + 0x0000, 0x2122, 0x2613, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25af, + 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x0000, 0x2032, 0x2033, + 0x0000, 0x271d, 0x0000, 0x25ac, 0x25c0, 0x25b6, 0x25cf, 0x25ae, + 0x25e6, 0x25ab, 0x25ad, 0x25b3, 0x25bd, 0x2606, 0x2022, 0x25aa, + 0x25b2, 0x25bc, 0x261c, 0x261e, 0x2663, 0x2666, 0x2665, 0x0000, + 0x2720, 0x2020, 0x2021, 0x2713, 0x2717, 0x266f, 0x266d, 0x2642, + 0x2640, 0x260e, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e, 0x0000 +}; + +static const unsigned short aplKeysymsToUnicode[] = { + 0x0000, 0x0000, 0x0000, 0x003c, 0x0000, 0x0000, 0x003e, 0x0000, + 0x2228, 0x2227, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x00af, 0x0000, 0x22a5, 0x2229, 0x230a, 0x0000, 0x005f, 0x0000, + 0x0000, 0x0000, 0x2218, 0x0000, 0x2395, 0x0000, 0x22a4, 0x25cb, + 0x0000, 0x0000, 0x0000, 0x2308, 0x0000, 0x0000, 0x222a, 0x0000, + 0x2283, 0x0000, 0x2282, 0x0000, 0x22a2, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x22a3, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short koreanKeysymsToUnicode[] = { + 0x0000, 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, + 0x3138, 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, + 0x3140, 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, + 0x3148, 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, + 0x3150, 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, + 0x3158, 0x3159, 0x315a, 0x315b, 0x315c, 0x315d, 0x315e, 0x315f, + 0x3160, 0x3161, 0x3162, 0x3163, 0x11a8, 0x11a9, 0x11aa, 0x11ab, + 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, + 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, + 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x316d, + 0x3171, 0x3178, 0x317f, 0x3181, 0x3184, 0x3186, 0x318d, 0x318e, + 0x11eb, 0x11f0, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9 +}; + +static QChar keysymToUnicode(unsigned char byte3, unsigned char byte4) +{ + switch (byte3) { + case 0x04: + // katakana + if (byte4 > 0xa0 && byte4 < 0xe0) + return QChar(katakanaKeysymsToUnicode[byte4 - 0xa0]); + else if (byte4 == 0x7e) + return QChar(0x203e); // Overline + break; + case 0x06: + // russian, use lookup table + if (byte4 > 0xa0) + return QChar(cyrillicKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x07: + // greek + if (byte4 > 0xa0) + return QChar(greekKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x08: + // technical + if (byte4 > 0xa0) + return QChar(technicalKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x09: + // special + if (byte4 >= 0xe0) + return QChar(specialKeysymsToUnicode[byte4 - 0xe0]); + break; + case 0x0a: + // publishing + if (byte4 > 0xa0) + return QChar(publishingKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x0b: + // APL + if (byte4 > 0xa0) + return QChar(aplKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x0e: + // Korean + if (byte4 > 0xa0) + return QChar(koreanKeysymsToUnicode[byte4 - 0xa0]); + break; + default: + break; + } + return QChar(0x0); +} + +Qt::KeyboardModifiers QXlibKeyboard::translateModifiers(int s) +{ + Qt::KeyboardModifiers ret = 0; + if (s & ShiftMask) + ret |= Qt::ShiftModifier; + if (s & ControlMask) + ret |= Qt::ControlModifier; + if (s & m_alt_mask) + ret |= Qt::AltModifier; + if (s & m_meta_mask) + ret |= Qt::MetaModifier; +// if (s & m_mode_switch_mask) //doesn't seem to work correctly +// ret |= Qt::GroupSwitchModifier; + return ret; +} + +void QXlibKeyboard::setMask(KeySym sym, uint mask) +{ + if (m_alt_mask == 0 + && m_meta_mask != mask + && m_super_mask != mask + && m_hyper_mask != mask + && (sym == XK_Alt_L || sym == XK_Alt_R)) { + m_alt_mask = mask; + } + if (m_meta_mask == 0 + && m_alt_mask != mask + && m_super_mask != mask + && m_hyper_mask != mask + && (sym == XK_Meta_L || sym == XK_Meta_R)) { + m_meta_mask = mask; + } + if (m_super_mask == 0 + && m_alt_mask != mask + && m_meta_mask != mask + && m_hyper_mask != mask + && (sym == XK_Super_L || sym == XK_Super_R)) { + m_super_mask = mask; + } + if (m_hyper_mask == 0 + && m_alt_mask != mask + && m_meta_mask != mask + && m_super_mask != mask + && (sym == XK_Hyper_L || sym == XK_Hyper_R)) { + m_hyper_mask = mask; + } + if (m_mode_switch_mask == 0 + && m_alt_mask != mask + && m_meta_mask != mask + && m_super_mask != mask + && m_hyper_mask != mask + && sym == XK_Mode_switch) { + m_mode_switch_mask = mask; + } + if (m_num_lock_mask == 0 + && sym == XK_Num_Lock) { + m_num_lock_mask = mask; + } +} + +int QXlibKeyboard::translateKeySym(uint key) const +{ + int code = -1; + int i = 0; // any other keys + while (KeyTbl[i]) { + if (key == KeyTbl[i]) { + code = (int)KeyTbl[i+1]; + break; + } + i += 2; + } + if (m_meta_mask) { + // translate Super/Hyper keys to Meta if we're using them as the MetaModifier + if (m_meta_mask == m_super_mask && (code == Qt::Key_Super_L || code == Qt::Key_Super_R)) { + code = Qt::Key_Meta; + } else if (m_meta_mask == m_hyper_mask && (code == Qt::Key_Hyper_L || code == Qt::Key_Hyper_R)) { + code = Qt::Key_Meta; + } + } + return code; +} + +QString QXlibKeyboard::translateKeySym(KeySym keysym, uint xmodifiers, + int &code, Qt::KeyboardModifiers &modifiers, + QByteArray &chars, int &count) +{ + // all keysyms smaller than 0xff00 are actally keys that can be mapped to unicode chars + + QTextCodec *mapper = QTextCodec::codecForLocale(); + QChar converted; + + if (/*count == 0 &&*/ keysym < 0xff00) { + unsigned char byte3 = (unsigned char)(keysym >> 8); + int mib = -1; + switch(byte3) { + case 0: // Latin 1 + case 1: // Latin 2 + case 2: //latin 3 + case 3: // latin4 + mib = byte3 + 4; break; + case 5: // arabic + mib = 82; break; + case 12: // Hebrew + mib = 85; break; + case 13: // Thai + mib = 2259; break; + case 4: // kana + case 6: // cyrillic + case 7: // greek + case 8: // technical, no mapping here at the moment + case 9: // Special + case 10: // Publishing + case 11: // APL + case 14: // Korean, no mapping + mib = -1; // manual conversion + mapper= 0; +#if !defined(QT_NO_XIM) + converted = keysymToUnicode(byte3, keysym & 0xff); +#endif + case 0x20: + // currency symbols + if (keysym >= 0x20a0 && keysym <= 0x20ac) { + mib = -1; // manual conversion + mapper = 0; + converted = (uint)keysym; + } + break; + default: + break; + } + if (mib != -1) { + mapper = QTextCodec::codecForMib(mib); + if (chars.isEmpty()) + chars.resize(1); + chars[0] = (unsigned char) (keysym & 0xff); // get only the fourth bit for conversion later + count = 1; + } + } else if (keysym >= 0x1000000 && keysym <= 0x100ffff) { + converted = (ushort) (keysym - 0x1000000); + mapper = 0; + } + if (count < (int)chars.size()-1) + chars[count] = '\0'; + + QString text; + if (!mapper && converted.unicode() != 0x0) { + text = converted; + } else if (!chars.isEmpty()) { + // convert chars (8bit) to text (unicode). + if (mapper) + text = mapper->toUnicode(chars.data(), count, 0); + if (text.isEmpty()) { + // no mapper, or codec couldn't convert to unicode (this + // can happen when running in the C locale or with no LANG + // set). try converting from latin-1 + text = QString::fromLatin1(chars); + } + } + + modifiers = translateModifiers(xmodifiers); + + // Commentary in X11/keysymdef says that X codes match ASCII, so it + // is safe to use the locale functions to process X codes in ISO8859-1. + // + // This is mainly for compatibility - applications should not use the + // Qt keycodes between 128 and 255, but should rather use the + // QKeyEvent::text(). + // + if (keysym < 128 || (keysym < 256 && (!mapper || mapper->mibEnum()==4))) { + // upper-case key, if known + code = isprint((int)keysym) ? toupper((int)keysym) : 0; + } else if (keysym >= XK_F1 && keysym <= XK_F35) { + // function keys + code = Qt::Key_F1 + ((int)keysym - XK_F1); + } else if (keysym >= XK_KP_Space && keysym <= XK_KP_9) { + if (keysym >= XK_KP_0) { + // numeric keypad keys + code = Qt::Key_0 + ((int)keysym - XK_KP_0); + } else { + code = translateKeySym(keysym); + } + modifiers |= Qt::KeypadModifier; + } else if (text.length() == 1 && text.unicode()->unicode() > 0x1f && text.unicode()->unicode() != 0x7f && !(keysym >= XK_dead_grave && keysym <= XK_dead_horn)) { + code = text.unicode()->toUpper().unicode(); + } else { + // any other keys + code = translateKeySym(keysym); + + if (code == Qt::Key_Tab && (modifiers & Qt::ShiftModifier)) { + // map shift+tab to shift+backtab, QShortcutMap knows about it + // and will handle it. + code = Qt::Key_Backtab; + text = QString(); + } + } + + return text; +} + +QXlibKeyboard::QXlibKeyboard(QXlibScreen *screen) + : m_screen(screen) + , m_alt_mask(0) + , m_super_mask(0) + , m_hyper_mask(0) + , m_meta_mask(0) +{ + changeLayout(); +} + +void QXlibKeyboard::changeLayout() +{ + XkbDescPtr xkbDesc = XkbGetMap(m_screen->display(), XkbAllClientInfoMask, XkbUseCoreKbd); + for (int i = xkbDesc->min_key_code; i < xkbDesc->max_key_code; ++i) { + const uint mask = xkbDesc->map->modmap ? xkbDesc->map->modmap[i] : 0; + if (mask == 0) { + // key is not bound to a modifier + continue; + } + + for (int j = 0; j < XkbKeyGroupsWidth(xkbDesc, i); ++j) { + KeySym keySym = XkbKeySym(xkbDesc, i, j); + if (keySym == NoSymbol) + continue; + setMask(keySym, mask); + } + } + XkbFreeKeyboard(xkbDesc, XkbAllComponentsMask, true); + +} + +static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) +{ + switch (qtcode) { + case Qt::Key_Control: + return Qt::ControlModifier; + case Qt::Key_Alt: + return Qt::AltModifier; + case Qt::Key_Shift: + return Qt::ShiftModifier; + case Qt::Key_Meta: + return Qt::MetaModifier; + default: + return Qt::NoModifier; + } +} + +void QXlibKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev) +{ + int qtcode = 0; + Qt::KeyboardModifiers modifiers = translateModifiers(ev->state); + QByteArray chars; + chars.resize(513); + int count = 0; + KeySym keySym; + count = XLookupString(ev,chars.data(),chars.size(),&keySym,0); + QString text = translateKeySym(keySym,ev->state,qtcode,modifiers,chars,count); + QWindowSystemInterface::handleKeyEvent(widget,ev->time,type,qtcode,modifiers,text.left(count)); +} diff --git a/src/plugins/platforms/xlib/qtestlitekeyboard.h b/src/plugins/platforms/xlib/qtestlitekeyboard.h new file mode 100644 index 0000000..98df4e1 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitekeyboard.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITEKEYBOARD_H +#define QTESTLITEKEYBOARD_H + +#include "qtestliteintegration.h" + +class QXlibKeyboard +{ +public: + QXlibKeyboard(QXlibScreen *screen); + + void changeLayout(); + + void handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev); + + Qt::KeyboardModifiers translateModifiers(int s); + +private: + + void setMask(KeySym sym, uint mask); + int translateKeySym(uint key) const; + QString translateKeySym(KeySym keysym, uint xmodifiers, + int &code, Qt::KeyboardModifiers &modifiers, + QByteArray &chars, int &count); + + QXlibScreen *m_screen; + + uint m_alt_mask; + uint m_super_mask; + uint m_hyper_mask; + uint m_meta_mask; + uint m_mode_switch_mask; + uint m_num_lock_mask; +}; + +#endif // QTESTLITEKEYBOARD_H diff --git a/src/plugins/platforms/xlib/qtestlitemime.cpp b/src/plugins/platforms/xlib/qtestlitemime.cpp new file mode 100644 index 0000000..5335ae9 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitemime.cpp @@ -0,0 +1,322 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitemime.h" + +#include "qtestlitestaticinfo.h" +#include "qtestlitescreen.h" + +#include <QtCore/QTextCodec> +#include <QtGui/QImageWriter> +#include <QtCore/QBuffer> + +QXlibMime::QXlibMime() + : QInternalMimeData() +{ } + +QXlibMime::~QXlibMime() +{} + + + + + +QString QXlibMime::mimeAtomToString(Display *display, Atom a) +{ + if (!a) return 0; + + if (a == XA_STRING || a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) { + return "text/plain"; // some Xdnd clients are dumb + } + char *atom = XGetAtomName(display, a); + QString result = QString::fromLatin1(atom); + XFree(atom); + return result; +} + +Atom QXlibMime::mimeStringToAtom(Display *display, const QString &mimeType) +{ + if (mimeType.isEmpty()) + return 0; + return XInternAtom(display, mimeType.toLatin1().constData(), False); +} + +QStringList QXlibMime::mimeFormatsForAtom(Display *display, Atom a) +{ + QStringList formats; + if (a) { + QString atomName = mimeAtomToString(display, a); + formats.append(atomName); + + // special cases for string type + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) + || a == XA_STRING + || a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) + formats.append(QLatin1String("text/plain")); + + // special cases for uris + if (atomName == QLatin1String("text/x-moz-url")) + formats.append(QLatin1String("text/uri-list")); + + // special case for images + if (a == XA_PIXMAP) + formats.append(QLatin1String("image/ppm")); + } + return formats; +} + +bool QXlibMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat) +{ + bool ret = false; + *atomFormat = a; + *dataFormat = 8; + QString atomName = mimeAtomToString(display, a); + if (QInternalMimeData::hasFormatHelper(atomName, mimeData)) { + *data = QInternalMimeData::renderDataHelper(atomName, mimeData); + if (atomName == QLatin1String("application/x-color")) + *dataFormat = 16; + ret = true; + } else { + if ((a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) + || a == XA_STRING + || a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) + && QInternalMimeData::hasFormatHelper(QLatin1String("text/plain"), mimeData)) { + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)){ + *data = QInternalMimeData::renderDataHelper(QLatin1String("text/plain"), mimeData); + ret = true; + } else if (a == XA_STRING) { + *data = QString::fromUtf8(QInternalMimeData::renderDataHelper( + QLatin1String("text/plain"), mimeData)).toLocal8Bit(); + ret = true; + } else if (a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { + // the ICCCM states that TEXT and COMPOUND_TEXT are in the + // encoding of choice, so we choose the encoding of the locale + QByteArray strData = QString::fromUtf8(QInternalMimeData::renderDataHelper( + QLatin1String("text/plain"), mimeData)).toLocal8Bit(); + char *list[] = { strData.data(), NULL }; + + XICCEncodingStyle style = (a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) + ? XCompoundTextStyle : XStdICCTextStyle; + XTextProperty textprop; + if (list[0] != NULL + && XmbTextListToTextProperty(display, list, 1, style, + &textprop) == Success) { + *atomFormat = textprop.encoding; + *dataFormat = textprop.format; + *data = QByteArray((const char *) textprop.value, textprop.nitems * textprop.format / 8); + ret = true; + + XFree(textprop.value); + } + } + } else if (atomName == QLatin1String("text/x-moz-url") && + QInternalMimeData::hasFormatHelper(QLatin1String("text/uri-list"), mimeData)) { + QByteArray uri = QInternalMimeData::renderDataHelper( + QLatin1String("text/uri-list"), mimeData).split('\n').first(); + QString mozUri = QString::fromLatin1(uri, uri.size()); + mozUri += QLatin1Char('\n'); + *data = QByteArray(reinterpret_cast<const char *>(mozUri.utf16()), mozUri.length() * 2); + ret = true; + } else if ((a == XA_PIXMAP || a == XA_BITMAP) && mimeData->hasImage()) { + ret = true; + } + } + return ret && data != 0; +} + +QList<Atom> QXlibMime::mimeAtomsForFormat(Display *display, const QString &format) +{ + QList<Atom> atoms; + atoms.append(mimeStringToAtom(display, format)); + + // special cases for strings + if (format == QLatin1String("text/plain")) { + atoms.append(QXlibStatic::atom(QXlibStatic::UTF8_STRING)); + atoms.append(XA_STRING); + atoms.append(QXlibStatic::atom(QXlibStatic::TEXT)); + atoms.append(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)); + } + + // special cases for uris + if (format == QLatin1String("text/uri-list")) { + atoms.append(mimeStringToAtom(display,QLatin1String("text/x-moz-url"))); + } + + //special cases for images + if (format == QLatin1String("image/ppm")) + atoms.append(XA_PIXMAP); + if (format == QLatin1String("image/pbm")) + atoms.append(XA_BITMAP); + + return atoms; +} + +QVariant QXlibMime::mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding) +{ + QString atomName = mimeAtomToString(display,a); + if (atomName == format) + return data; + + if (!encoding.isEmpty() + && atomName == format + QLatin1String(";charset=") + QString::fromLatin1(encoding)) { + + if (requestedType == QVariant::String) { + QTextCodec *codec = QTextCodec::codecForName(encoding); + if (codec) + return codec->toUnicode(data); + } + + return data; + } + + // special cases for string types + if (format == QLatin1String("text/plain")) { + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) + return QString::fromUtf8(data); + if (a == XA_STRING) + return QString::fromLatin1(data); + if (a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) + // #### might be wrong for COMPUND_TEXT + return QString::fromLocal8Bit(data, data.size()); + } + + // special case for uri types + if (format == QLatin1String("text/uri-list")) { + if (atomName == QLatin1String("text/x-moz-url")) { + // we expect this as utf16 <url><space><title> + // the first part is a url that should only contain ascci char + // so it should be safe to check that the second char is 0 + // to verify that it is utf16 + if (data.size() > 1 && data.at(1) == 0) + return QString::fromRawData((const QChar *)data.constData(), + data.size() / 2).split(QLatin1Char('\n')).first().toLatin1(); + } + } + + // special cas for images + if (format == QLatin1String("image/ppm")) { + if (a == XA_PIXMAP && data.size() == sizeof(Pixmap)) { + Pixmap xpm = *((Pixmap*)data.data()); + if (!xpm) + return QByteArray(); + Window root; + int x; + int y; + uint width; + uint height; + uint border_width; + uint depth; + + XGetGeometry(display, xpm, &root, &x, &y, &width, &height, &border_width, &depth); + XImage *ximg = XGetImage(display,xpm,x,y,width,height,AllPlanes,depth==1 ? XYPixmap : ZPixmap); + QImage qimg = QXlibStatic::qimageFromXImage(ximg); + XDestroyImage(ximg); + + QImageWriter imageWriter; + imageWriter.setFormat("PPMRAW"); + QBuffer buf; + buf.open(QIODevice::WriteOnly); + imageWriter.setDevice(&buf); + imageWriter.write(qimg); + return buf.buffer(); + } + } + return QVariant(); +} + +Atom QXlibMime::mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding) +{ + requestedEncoding->clear(); + + // find matches for string types + if (format == QLatin1String("text/plain")) { + if (atoms.contains(QXlibStatic::atom(QXlibStatic::UTF8_STRING))) + return QXlibStatic::atom(QXlibStatic::UTF8_STRING); + if (atoms.contains(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT))) + return QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT); + if (atoms.contains(QXlibStatic::atom(QXlibStatic::TEXT))) + return QXlibStatic::atom(QXlibStatic::TEXT); + if (atoms.contains(XA_STRING)) + return XA_STRING; + } + + // find matches for uri types + if (format == QLatin1String("text/uri-list")) { + Atom a = mimeStringToAtom(display,format); + if (a && atoms.contains(a)) + return a; + a = mimeStringToAtom(display,QLatin1String("text/x-moz-url")); + if (a && atoms.contains(a)) + return a; + } + + // find match for image + if (format == QLatin1String("image/ppm")) { + if (atoms.contains(XA_PIXMAP)) + return XA_PIXMAP; + } + + // for string/text requests try to use a format with a well-defined charset + // first to avoid encoding problems + if (requestedType == QVariant::String + && format.startsWith(QLatin1String("text/")) + && !format.contains(QLatin1String("charset="))) { + + QString formatWithCharset = format; + formatWithCharset.append(QLatin1String(";charset=utf-8")); + + Atom a = mimeStringToAtom(display,formatWithCharset); + if (a && atoms.contains(a)) { + *requestedEncoding = "utf-8"; + return a; + } + } + + Atom a = mimeStringToAtom(display,format); + if (a && atoms.contains(a)) + return a; + + return 0; +} diff --git a/src/plugins/platforms/xlib/qtestlitemime.h b/src/plugins/platforms/xlib/qtestlitemime.h new file mode 100644 index 0000000..6a70ea4 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitemime.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITEMIME_H +#define QTESTLITEMIME_H + +#include <private/qdnd_p.h> + +#include <QtGui/QClipboard> + +#include "qtestliteintegration.h" +#include "qtestliteclipboard.h" + +class QXlibMime : public QInternalMimeData { + Q_OBJECT +public: + QXlibMime(); + ~QXlibMime(); + + static QList<Atom> mimeAtomsForFormat(Display *display, const QString &format); + static QString mimeAtomToString(Display *display, Atom a); + static bool mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat); + static QStringList mimeFormatsForAtom(Display *display, Atom a); + static Atom mimeStringToAtom(Display *display, const QString &mimeType); + static QVariant mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding); + static Atom mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding); +}; + +#endif // QTESTLITEMIME_H diff --git a/src/plugins/platforms/xlib/qtestlitescreen.cpp b/src/plugins/platforms/xlib/qtestlitescreen.cpp new file mode 100644 index 0000000..714c17b --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitescreen.cpp @@ -0,0 +1,468 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitescreen.h" + +#include "qtestlitecursor.h" +#include "qtestlitewindow.h" +#include "qtestlitekeyboard.h" +#include "qtestlitestaticinfo.h" +#include "qtestliteclipboard.h" + +#include <QtCore/QDebug> +#include <QtCore/QSocketNotifier> +#include <QtCore/QElapsedTimer> + +#include <private/qapplication_p.h> + +#include <X11/extensions/Xfixes.h> + +QT_BEGIN_NAMESPACE + +static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); +static bool seen_badwindow; + +static int qt_x_errhandler(Display *dpy, XErrorEvent *err) +{ + +qDebug() << "qt_x_errhandler" << err->error_code; + + switch (err->error_code) { + case BadAtom: +#if 0 + if (err->request_code == 20 /* X_GetProperty */ + && (err->resourceid == XA_RESOURCE_MANAGER + || err->resourceid == XA_RGB_DEFAULT_MAP + || err->resourceid == ATOM(_NET_SUPPORTED) + || err->resourceid == ATOM(_NET_SUPPORTING_WM_CHECK) + || err->resourceid == ATOM(KDE_FULL_SESSION) + || err->resourceid == ATOM(KWIN_RUNNING) + || err->resourceid == ATOM(XdndProxy) + || err->resourceid == ATOM(XdndAware)) + + + ) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } +#endif + qDebug() << "BadAtom"; + break; + + case BadWindow: + if (err->request_code == 2 /* X_ChangeWindowAttributes */ + || err->request_code == 38 /* X_QueryPointer */) { + for (int i = 0; i < ScreenCount(dpy); ++i) { + if (err->resourceid == RootWindow(dpy, i)) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } + } + } + seen_badwindow = true; + if (err->request_code == 25 /* X_SendEvent */) { + for (int i = 0; i < ScreenCount(dpy); ++i) { + if (err->resourceid == RootWindow(dpy, i)) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } + } +#if 0 + if (X11->xdndHandleBadwindow()) { + qDebug("xdndHandleBadwindow returned true"); + return 0; + } +#endif + } +#if 0 + if (X11->ignore_badwindow) + return 0; +#endif + break; + + case BadMatch: + if (err->request_code == 42 /* X_SetInputFocus */) + return 0; + break; + + default: +#if 0 //!defined(QT_NO_XINPUT) + if (err->request_code == X11->xinput_major + && err->error_code == (X11->xinput_errorbase + XI_BadDevice) + && err->minor_code == 3 /* X_OpenDevice */) { + return 0; + } +#endif + break; + } + + char errstr[256]; + XGetErrorText( dpy, err->error_code, errstr, 256 ); + char buffer[256]; + char request_str[256]; + qsnprintf(buffer, 256, "%d", err->request_code); + XGetErrorDatabaseText(dpy, "XRequest", buffer, "", request_str, 256); + if (err->request_code < 128) { + // X error for a normal protocol request + qWarning( "X Error: %s %d\n" + " Major opcode: %d (%s)\n" + " Resource id: 0x%lx", + errstr, err->error_code, + err->request_code, + request_str, + err->resourceid ); + } else { + // X error for an extension request + const char *extensionName = 0; +#if 0 + if (err->request_code == X11->xrender_major) + extensionName = "RENDER"; + else if (err->request_code == X11->xrandr_major) + extensionName = "RANDR"; + else if (err->request_code == X11->xinput_major) + extensionName = "XInputExtension"; + else if (err->request_code == X11->mitshm_major) + extensionName = "MIT-SHM"; +#endif + char minor_str[256]; + if (extensionName) { + qsnprintf(buffer, 256, "%s.%d", extensionName, err->minor_code); + XGetErrorDatabaseText(dpy, "XRequest", buffer, "", minor_str, 256); + } else { + extensionName = "Uknown extension"; + qsnprintf(minor_str, 256, "Unknown request"); + } + qWarning( "X Error: %s %d\n" + " Extension: %d (%s)\n" + " Minor opcode: %d (%s)\n" + " Resource id: 0x%lx", + errstr, err->error_code, + err->request_code, + extensionName, + err->minor_code, + minor_str, + err->resourceid ); + } + + // ### we really should distinguish between severe, non-severe and + // ### application specific errors + + return 0; +} + +QXlibScreen::QXlibScreen() + : mFormat(QImage::Format_RGB32) +{ + char *display_name = getenv("DISPLAY"); + mDisplay = XOpenDisplay(display_name); + mDisplayName = QString::fromLocal8Bit(display_name); + if (!mDisplay) { + fprintf(stderr, "Cannot connect to X server: %s\n", + display_name); + exit(1); + } + +#ifndef DONT_USE_MIT_SHM + Status MIT_SHM_extension_supported = XShmQueryExtension (mDisplay); + Q_ASSERT(MIT_SHM_extension_supported == True); +#endif + original_x_errhandler = XSetErrorHandler(qt_x_errhandler); + + if (qgetenv("DO_X_SYNCHRONIZE").toInt()) + XSynchronize(mDisplay, true); + + mScreen = DefaultScreen(mDisplay); + XSelectInput(mDisplay,rootWindow(), KeymapStateMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask); + int width = DisplayWidth(mDisplay, mScreen); + int height = DisplayHeight(mDisplay, mScreen); + mGeometry = QRect(0,0,width,height); + + int physicalWidth = DisplayWidthMM(mDisplay, mScreen); + int physicalHeight = DisplayHeightMM(mDisplay, mScreen); + mPhysicalSize = QSize(physicalWidth,physicalHeight); + + int xSocketNumber = XConnectionNumber(mDisplay); + + mDepth = DefaultDepth(mDisplay,mScreen); +#ifdef MYX11_DEBUG + qDebug() << "X socket:"<< xSocketNumber; +#endif + QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); + connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); + + mCursor = new QXlibCursor(this); + mKeyboard = new QXlibKeyboard(this); +} + +QXlibScreen::~QXlibScreen() +{ + delete mCursor; + XCloseDisplay(mDisplay); +} + +#ifdef KeyPress +#undef KeyPress +#endif +#ifdef KeyRelease +#undef KeyRelease +#endif + +bool QXlibScreen::handleEvent(XEvent *xe) +{ + int quit = false; + QXlibWindow *platformWindow = 0; + QWidget *widget = QWidget::find(xe->xany.window); + if (widget) { + platformWindow = static_cast<QXlibWindow *>(widget->platformWindow()); + } + + Atom wmProtocolsAtom = QXlibStatic::atom(QXlibStatic::WM_PROTOCOLS); + Atom wmDeleteWindowAtom = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); + switch (xe->type) { + + case ClientMessage: + if (xe->xclient.format == 32 && xe->xclient.message_type == wmProtocolsAtom) { + Atom a = xe->xclient.data.l[0]; + if (a == wmDeleteWindowAtom) + platformWindow->handleCloseEvent(); + } + break; + + case Expose: + if (platformWindow) + if (xe->xexpose.count == 0) + platformWindow->paintEvent(); + break; + case ConfigureNotify: + if (platformWindow) + platformWindow->resizeEvent(&xe->xconfigure); + break; + + case ButtonPress: + if (platformWindow) + platformWindow->mousePressEvent(&xe->xbutton); + break; + + case ButtonRelease: + if (platformWindow) + platformWindow->handleMouseEvent(QEvent::MouseButtonRelease, &xe->xbutton); + break; + + case MotionNotify: + if (platformWindow) + platformWindow->handleMouseEvent(QEvent::MouseMove, &xe->xbutton); + break; + + case XKeyPress: + mKeyboard->handleKeyEvent(widget,QEvent::KeyPress, &xe->xkey); + break; + + case XKeyRelease: + mKeyboard->handleKeyEvent(widget,QEvent::KeyRelease, &xe->xkey); + break; + + case EnterNotify: + if (platformWindow) + platformWindow->handleEnterEvent(); + break; + + case LeaveNotify: + if (platformWindow) + platformWindow->handleLeaveEvent(); + break; + + case XFocusIn: + if (platformWindow) + platformWindow->handleFocusInEvent(); + break; + + case XFocusOut: + if (platformWindow) + platformWindow->handleFocusOutEvent(); + break; + + case PropertyNotify: + break; + + case SelectionClear: + qDebug() << "Selection Clear!!!"; + break; + case SelectionRequest: + handleSelectionRequest(xe); + break; + case SelectionNotify: + qDebug() << "Selection Notify!!!!"; + + break; + + + default: +#ifdef MYX11_DEBUG + qDebug() << hex << xe->xany.window << "Other X event" << xe->type; +#endif + break; + } + + return quit; +} + +static Bool checkForClipboardEvents(Display *, XEvent *e, XPointer) +{ + Atom clipboard = QXlibStatic::atom(QXlibStatic::CLIPBOARD); + return ((e->type == SelectionRequest && (e->xselectionrequest.selection == XA_PRIMARY + || e->xselectionrequest.selection == clipboard)) + || (e->type == SelectionClear && (e->xselectionclear.selection == XA_PRIMARY + || e->xselectionclear.selection == clipboard))); +} + +bool QXlibScreen::waitForClipboardEvent(Window win, int type, XEvent *event, int timeout) +{ + QElapsedTimer timer; + timer.start(); + do { + if (XCheckTypedWindowEvent(mDisplay,win,type,event)) + return true; + + // process other clipboard events, since someone is probably requesting data from us + XEvent e; + if (XCheckIfEvent(mDisplay, &e, checkForClipboardEvents, 0)) + handleEvent(&e); + + XFlush(mDisplay); + + // sleep 50 ms, so we don't use up CPU cycles all the time. + struct timeval usleep_tv; + usleep_tv.tv_sec = 0; + usleep_tv.tv_usec = 50000; + select(0, 0, 0, 0, &usleep_tv); + } while (timer.elapsed() < timeout); + return false; +} + +void QXlibScreen::eventDispatcher() +{ + ulong marker = XNextRequest(mDisplay); + // int i = 0; + while (XPending(mDisplay)) { + XEvent event; + XNextEvent(mDisplay, &event); + /* done = */ + handleEvent(&event); + + if (event.xany.serial >= marker) { + #ifdef MYX11_DEBUG + qDebug() << "potential livelock averted"; + #endif + #if 0 + if (XEventsQueued(mDisplay, QueuedAfterFlush)) { + qDebug() << " with events queued"; + QTimer::singleShot(0, this, SLOT(eventDispatcher())); + } + #endif + break; + } + } +} + +QImage QXlibScreen::grabWindow(Window window, int x, int y, int w, int h) +{ + if (w == 0 || h ==0) + return QImage(); + + //WinId 0 means the desktop widget + if (!window) + window = rootWindow(); + + XWindowAttributes window_attr; + if (!XGetWindowAttributes(mDisplay, window, &window_attr)) + return QImage(); + + if (w < 0) + w = window_attr.width - x; + if (h < 0) + h = window_attr.height - y; + + // Ideally, we should also limit ourselves to the screen area, but the Qt docs say + // that it's "unsafe" to go outside the screen, so we can ignore that problem. + + //We're definitely not optimizing for speed... + XImage *xi = XGetImage(mDisplay, window, x, y, w, h, AllPlanes, ZPixmap); + + if (!xi) + return QImage(); + + //taking a copy to make sure we have ownership -- not fast + QImage result = QImage( (uchar*) xi->data, xi->width, xi->height, xi->bytes_per_line, QImage::Format_RGB32 ).copy(); + + XDestroyImage(xi); + + return result; +} + +QXlibScreen * QXlibScreen::testLiteScreenForWidget(QWidget *widget) +{ + QPlatformScreen *platformScreen = platformScreenForWidget(widget); + return static_cast<QXlibScreen *>(platformScreen); +} + +Display * QXlibScreen::display() const +{ + return mDisplay; +} + +int QXlibScreen::xScreenNumber() const +{ + return mScreen; +} + +QXlibKeyboard * QXlibScreen::keyboard() const +{ + return mKeyboard; +} + +void QXlibScreen::handleSelectionRequest(XEvent *event) +{ + QPlatformIntegration *integration = QApplicationPrivate::platformIntegration(); + QXlibClipboard *clipboard = static_cast<QXlibClipboard *>(integration->clipboard()); + clipboard->handleSelectionRequest(event); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qtestlitescreen.h b/src/plugins/platforms/xlib/qtestlitescreen.h new file mode 100644 index 0000000..7e59a59 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitescreen.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITESCREEN_H +#define QTESTLITESCREEN_H + +#include <QtGui/QPlatformScreen> +#include "qtestliteintegration.h" + +QT_BEGIN_NAMESPACE + +class QXlibCursor; +class QXlibKeyboard; + +class QXlibScreen : public QPlatformScreen +{ + Q_OBJECT +public: + QXlibScreen(); + + ~QXlibScreen(); + + QString displayName() const { return mDisplayName; } + + QRect geometry() const { return mGeometry; } + int depth() const { return mDepth; } + QImage::Format format() const { return mFormat; } + QSize physicalSize() const { return mPhysicalSize; } + + Window rootWindow() { return RootWindow(mDisplay, mScreen); } + unsigned long blackPixel() { return BlackPixel(mDisplay, mScreen); } + unsigned long whitePixel() { return WhitePixel(mDisplay, mScreen); } + + bool handleEvent(XEvent *xe); + bool waitForClipboardEvent(Window win, int type, XEvent *event, int timeout); + + QImage grabWindow(Window window, int x, int y, int w, int h); + + static QXlibScreen *testLiteScreenForWidget(QWidget *widget); + + Display *display() const; + int xScreenNumber() const; + + QXlibKeyboard *keyboard() const; + +public slots: + void eventDispatcher(); + +private: + + void handleSelectionRequest(XEvent *event); + QString mDisplayName; + QRect mGeometry; + QSize mPhysicalSize; + int mDepth; + QImage::Format mFormat; + QXlibCursor *mCursor; + QXlibKeyboard *mKeyboard; + + Display * mDisplay; + int mScreen; +}; + +QT_END_NAMESPACE + +#endif // QTESTLITESCREEN_H diff --git a/src/plugins/platforms/xlib/qtestlitestaticinfo.cpp b/src/plugins/platforms/xlib/qtestlitestaticinfo.cpp new file mode 100644 index 0000000..837636c --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitestaticinfo.cpp @@ -0,0 +1,511 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitestaticinfo.h" +#include "qtestlitescreen.h" + +#include <qplatformdefs.h> + +#include <QtGui/private/qapplication_p.h> +#include <QtCore/QBuffer> +#include <QtCore/QLibrary> + +#include <QDebug> + +#ifndef QT_NO_XFIXES +#include <X11/extensions/Xfixes.h> +#endif // QT_NO_XFIXES + +static const char * x11_atomnames = { + // window-manager <-> client protocols + "WM_PROTOCOLS\0" + "WM_DELETE_WINDOW\0" + "WM_TAKE_FOCUS\0" + "_NET_WM_PING\0" + "_NET_WM_CONTEXT_HELP\0" + "_NET_WM_SYNC_REQUEST\0" + "_NET_WM_SYNC_REQUEST_COUNTER\0" + + // ICCCM window state + "WM_STATE\0" + "WM_CHANGE_STATE\0" + + // Session management + "WM_CLIENT_LEADER\0" + "WM_WINDOW_ROLE\0" + "SM_CLIENT_ID\0" + + // Clipboard + "CLIPBOARD\0" + "INCR\0" + "TARGETS\0" + "MULTIPLE\0" + "TIMESTAMP\0" + "SAVE_TARGETS\0" + "CLIP_TEMPORARY\0" + "_QT_SELECTION\0" + "_QT_CLIPBOARD_SENTINEL\0" + "_QT_SELECTION_SENTINEL\0" + "CLIPBOARD_MANAGER\0" + + "RESOURCE_MANAGER\0" + + "_XSETROOT_ID\0" + + "_QT_SCROLL_DONE\0" + "_QT_INPUT_ENCODING\0" + + "_MOTIF_WM_HINTS\0" + + "DTWM_IS_RUNNING\0" + "ENLIGHTENMENT_DESKTOP\0" + "_DT_SAVE_MODE\0" + "_SGI_DESKS_MANAGER\0" + + // EWMH (aka NETWM) + "_NET_SUPPORTED\0" + "_NET_VIRTUAL_ROOTS\0" + "_NET_WORKAREA\0" + + "_NET_MOVERESIZE_WINDOW\0" + "_NET_WM_MOVERESIZE\0" + + "_NET_WM_NAME\0" + "_NET_WM_ICON_NAME\0" + "_NET_WM_ICON\0" + + "_NET_WM_PID\0" + + "_NET_WM_WINDOW_OPACITY\0" + + "_NET_WM_STATE\0" + "_NET_WM_STATE_ABOVE\0" + "_NET_WM_STATE_BELOW\0" + "_NET_WM_STATE_FULLSCREEN\0" + "_NET_WM_STATE_MAXIMIZED_HORZ\0" + "_NET_WM_STATE_MAXIMIZED_VERT\0" + "_NET_WM_STATE_MODAL\0" + "_NET_WM_STATE_STAYS_ON_TOP\0" + "_NET_WM_STATE_DEMANDS_ATTENTION\0" + + "_NET_WM_USER_TIME\0" + "_NET_WM_USER_TIME_WINDOW\0" + "_NET_WM_FULL_PLACEMENT\0" + + "_NET_WM_WINDOW_TYPE\0" + "_NET_WM_WINDOW_TYPE_DESKTOP\0" + "_NET_WM_WINDOW_TYPE_DOCK\0" + "_NET_WM_WINDOW_TYPE_TOOLBAR\0" + "_NET_WM_WINDOW_TYPE_MENU\0" + "_NET_WM_WINDOW_TYPE_UTILITY\0" + "_NET_WM_WINDOW_TYPE_SPLASH\0" + "_NET_WM_WINDOW_TYPE_DIALOG\0" + "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU\0" + "_NET_WM_WINDOW_TYPE_POPUP_MENU\0" + "_NET_WM_WINDOW_TYPE_TOOLTIP\0" + "_NET_WM_WINDOW_TYPE_NOTIFICATION\0" + "_NET_WM_WINDOW_TYPE_COMBO\0" + "_NET_WM_WINDOW_TYPE_DND\0" + "_NET_WM_WINDOW_TYPE_NORMAL\0" + "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE\0" + + "_KDE_NET_WM_FRAME_STRUT\0" + + "_NET_STARTUP_INFO\0" + "_NET_STARTUP_INFO_BEGIN\0" + + "_NET_SUPPORTING_WM_CHECK\0" + + "_NET_WM_CM_S0\0" + + "_NET_SYSTEM_TRAY_VISUAL\0" + + "_NET_ACTIVE_WINDOW\0" + + // Property formats + "COMPOUND_TEXT\0" + "TEXT\0" + "UTF8_STRING\0" + + // xdnd + "XdndEnter\0" + "XdndPosition\0" + "XdndStatus\0" + "XdndLeave\0" + "XdndDrop\0" + "XdndFinished\0" + "XdndTypeList\0" + "XdndActionList\0" + + "XdndSelection\0" + + "XdndAware\0" + "XdndProxy\0" + + "XdndActionCopy\0" + "XdndActionLink\0" + "XdndActionMove\0" + "XdndActionPrivate\0" + + // Motif DND + "_MOTIF_DRAG_AND_DROP_MESSAGE\0" + "_MOTIF_DRAG_INITIATOR_INFO\0" + "_MOTIF_DRAG_RECEIVER_INFO\0" + "_MOTIF_DRAG_WINDOW\0" + "_MOTIF_DRAG_TARGETS\0" + + "XmTRANSFER_SUCCESS\0" + "XmTRANSFER_FAILURE\0" + + // Xkb + "_XKB_RULES_NAMES\0" + + // XEMBED + "_XEMBED\0" + "_XEMBED_INFO\0" + + // Wacom old. (before version 0.10) + "Wacom Stylus\0" + "Wacom Cursor\0" + "Wacom Eraser\0" + + // Tablet + "STYLUS\0" + "ERASER\0" +}; + +/*! + \internal + Try to resolve a \a symbol from \a library with the version specified + by \a vernum. + + Note that, in the case of the Xfixes library, \a vernum is not the same as + \c XFIXES_MAJOR - it is a part of soname and may differ from the Xfixes + version. +*/ +static void* qt_load_library_runtime(const char *library, int vernum, + int highestVernum, const char *symbol) +{ + QList<int> versions; + // we try to load in the following order: + // explicit version -> the default one -> (from the highest (highestVernum) to the lowest (vernum) ) + if (vernum != -1) + versions << vernum; + versions << -1; + if (vernum != -1) { + for(int i = highestVernum; i > vernum; --i) + versions << i; + } + Q_FOREACH(int version, versions) { + QLatin1String libName(library); + QLibrary xfixesLib(libName, version); + void *ptr = xfixesLib.resolve(symbol); + if (ptr) + return ptr; + } + return 0; +} + +# define XFIXES_LOAD_RUNTIME(vernum, symbol, symbol_type) \ + (symbol_type)qt_load_library_runtime("libXfixes", vernum, 4, #symbol); +# define XFIXES_LOAD_V1(symbol) \ + XFIXES_LOAD_RUNTIME(1, symbol, Ptr##symbol) +# define XFIXES_LOAD_V2(symbol) \ + XFIXES_LOAD_RUNTIME(2, symbol, Ptr##symbol) + + +class QTestLiteStaticInfoPrivate +{ +public: + QTestLiteStaticInfoPrivate() + : use_xfixes(false) + , xfixes_major(0) + , xfixes_eventbase(0) + , xfixes_errorbase(0) + { + QXlibScreen *screen = qobject_cast<QXlibScreen *> (QApplicationPrivate::platformIntegration()->screens().at(0)); + Q_ASSERT(screen); + + initializeAllAtoms(screen); + initializeSupportedAtoms(screen); + + resolveXFixes(screen); + } + + bool isSupportedByWM(Atom atom) + { + if (!m_supportedAtoms) + return false; + + bool supported = false; + int i = 0; + while (m_supportedAtoms[i] != 0) { + if (m_supportedAtoms[i++] == atom) { + supported = true; + break; + } + } + + return supported; + } + + Atom atom(QXlibStatic::X11Atom atom) + { + return m_allAtoms[atom]; + } + + bool useXFixes() const { return use_xfixes; } + + int xFixesEventBase() const {return xfixes_eventbase; } + + PtrXFixesSelectSelectionInput xFixesSelectSelectionInput() const + { + return ptrXFixesSelectSelectionInput; + } + + QImage qimageFromXImage(XImage *xi) + { + QImage::Format format = QImage::Format_ARGB32_Premultiplied; + if (xi->depth == 24) + format = QImage::Format_RGB32; + else if (xi->depth == 16) + format = QImage::Format_RGB16; + + QImage image = QImage((uchar *)xi->data, xi->width, xi->height, xi->bytes_per_line, format).copy(); + + // we may have to swap the byte order + if ((QSysInfo::ByteOrder == QSysInfo::LittleEndian && xi->byte_order == MSBFirst) + || (QSysInfo::ByteOrder == QSysInfo::BigEndian && xi->byte_order == LSBFirst)) + { + for (int i=0; i < image.height(); i++) { + if (xi->depth == 16) { + ushort *p = (ushort*)image.scanLine(i); + ushort *end = p + image.width(); + while (p < end) { + *p = ((*p << 8) & 0xff00) | ((*p >> 8) & 0x00ff); + p++; + } + } else { + uint *p = (uint*)image.scanLine(i); + uint *end = p + image.width(); + while (p < end) { + *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000) + | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff); + p++; + } + } + } + } + + // fix-up alpha channel + if (format == QImage::Format_RGB32) { + QRgb *p = (QRgb *)image.bits(); + for (int y = 0; y < xi->height; ++y) { + for (int x = 0; x < xi->width; ++x) + p[x] |= 0xff000000; + p += xi->bytes_per_line / 4; + } + } + + return image; + } + + +private: + + void initializeAllAtoms(QXlibScreen *screen) { + const char *names[QXlibStatic::NAtoms]; + const char *ptr = x11_atomnames; + + int i = 0; + while (*ptr) { + names[i++] = ptr; + while (*ptr) + ++ptr; + ++ptr; + } + + Q_ASSERT(i == QXlibStatic::NPredefinedAtoms); + + QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_"); + settings_atom_name += XDisplayName(qPrintable(screen->displayName())); + names[i++] = settings_atom_name; + + Q_ASSERT(i == QXlibStatic::NAtoms); + #if 0//defined(XlibSpecificationRelease) && (XlibSpecificationRelease >= 6) + XInternAtoms(screen->display(), (char **)names, i, False, m_allAtoms); + #else + for (i = 0; i < QXlibStatic::NAtoms; ++i) + m_allAtoms[i] = XInternAtom(screen->display(), (char *)names[i], False); + #endif + } + + void initializeSupportedAtoms(QXlibScreen *screen) + { + Atom type; + int format; + long offset = 0; + unsigned long nitems, after; + unsigned char *data = 0; + + int e = XGetWindowProperty(screen->display(), screen->rootWindow(), + this->atom(QXlibStatic::_NET_SUPPORTED), 0, 0, + False, XA_ATOM, &type, &format, &nitems, &after, &data); + if (data) + XFree(data); + + if (e == Success && type == XA_ATOM && format == 32) { + QBuffer ts; + ts.open(QIODevice::WriteOnly); + + while (after > 0) { + XGetWindowProperty(screen->display(), screen->rootWindow(), + this->atom(QXlibStatic::_NET_SUPPORTED), offset, 1024, + False, XA_ATOM, &type, &format, &nitems, &after, &data); + + if (type == XA_ATOM && format == 32) { + ts.write(reinterpret_cast<char *>(data), nitems * sizeof(long)); + offset += nitems; + } else + after = 0; + if (data) + XFree(data); + } + + // compute nitems + QByteArray buffer(ts.buffer()); + nitems = buffer.size() / sizeof(Atom); + m_supportedAtoms = new Atom[nitems + 1]; + Atom *a = (Atom *) buffer.data(); + uint i; + for (i = 0; i < nitems; i++) + m_supportedAtoms[i] = a[i]; + m_supportedAtoms[nitems] = 0; + + } + } + + void resolveXFixes(QXlibScreen *screen) + { +#ifndef QT_NO_XFIXES + // See if Xfixes is supported on the connected display + if (XQueryExtension(screen->display(), "XFIXES", &xfixes_major, + &xfixes_eventbase, &xfixes_errorbase)) { + ptrXFixesQueryExtension = XFIXES_LOAD_V1(XFixesQueryExtension); + ptrXFixesQueryVersion = XFIXES_LOAD_V1(XFixesQueryVersion); + ptrXFixesSetCursorName = XFIXES_LOAD_V2(XFixesSetCursorName); + ptrXFixesSelectSelectionInput = XFIXES_LOAD_V2(XFixesSelectSelectionInput); + + if(ptrXFixesQueryExtension && ptrXFixesQueryVersion + && ptrXFixesQueryExtension(screen->display(), &xfixes_eventbase, + &xfixes_errorbase)) { + // Xfixes is supported. + // Note: the XFixes protocol version is negotiated using QueryVersion. + // We supply the highest version we support, the X server replies with + // the highest version it supports, but no higher than the version we + // asked for. The version sent back is the protocol version the X server + // will use to talk us. If this call is removed, the behavior of the + // X server when it receives an XFixes request is undefined. + int major = 3; + int minor = 0; + ptrXFixesQueryVersion(screen->display(), &major, &minor); + use_xfixes = (major >= 1); + xfixes_major = major; + } + } +#endif // QT_NO_XFIXES + + } + + Atom *m_supportedAtoms; + Atom m_allAtoms[QXlibStatic::NAtoms]; + +#ifndef QT_NO_XFIXES + PtrXFixesQueryExtension ptrXFixesQueryExtension; + PtrXFixesQueryVersion ptrXFixesQueryVersion; + PtrXFixesSetCursorName ptrXFixesSetCursorName; + PtrXFixesSelectSelectionInput ptrXFixesSelectSelectionInput; +#endif + + bool use_xfixes; + int xfixes_major; + int xfixes_eventbase; + int xfixes_errorbase; + +}; +Q_GLOBAL_STATIC(QTestLiteStaticInfoPrivate, qTestLiteStaticInfoPrivate); + + +Atom QXlibStatic::atom(QXlibStatic::X11Atom atom) +{ + return qTestLiteStaticInfoPrivate()->atom(atom); +} + +bool QXlibStatic::isSupportedByWM(Atom atom) +{ + return qTestLiteStaticInfoPrivate()->isSupportedByWM(atom); +} + +bool QXlibStatic::useXFixes() +{ + return qTestLiteStaticInfoPrivate()->useXFixes(); +} + +int QXlibStatic::xFixesEventBase() +{ + return qTestLiteStaticInfoPrivate()->xFixesEventBase(); +} + +#ifndef QT_NO_XFIXES +PtrXFixesSelectSelectionInput QXlibStatic::xFixesSelectSelectionInput() +{ + qDebug() << qTestLiteStaticInfoPrivate()->useXFixes(); + if (!qTestLiteStaticInfoPrivate()->useXFixes()) + return 0; + + return qTestLiteStaticInfoPrivate()->xFixesSelectSelectionInput(); +} + +QImage QXlibStatic::qimageFromXImage(XImage *xi) +{ + return qTestLiteStaticInfoPrivate()->qimageFromXImage(xi); +} +#endif //QT_NO_XFIXES diff --git a/src/plugins/platforms/xlib/qtestlitestaticinfo.h b/src/plugins/platforms/xlib/qtestlitestaticinfo.h new file mode 100644 index 0000000..8473ee9 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitestaticinfo.h @@ -0,0 +1,413 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITESTATICINFO_H +#define QTESTLITESTATICINFO_H + +#include <QtCore/QTextStream> +#include <QtCore/QDataStream> +#include <QtCore/QMetaType> +#include <QtCore/QVariant> + +#if defined(_XLIB_H_) // crude hack, but... +#error "cannot include <X11/Xlib.h> before this file" +#endif +#define XRegisterIMInstantiateCallback qt_XRegisterIMInstantiateCallback +#define XUnregisterIMInstantiateCallback qt_XUnregisterIMInstantiateCallback +#define XSetIMValues qt_XSetIMValues +#include <X11/Xlib.h> +#undef XRegisterIMInstantiateCallback +#undef XUnregisterIMInstantiateCallback +#undef XSetIMValues + +#include <X11/Xutil.h> +#include <X11/Xos.h> +#ifdef index +# undef index +#endif +#ifdef rindex +# undef rindex +#endif +#ifdef Q_OS_VXWORS +# ifdef open +# undef open +# endif +# ifdef getpid +# undef getpid +# endif +#endif // Q_OS_VXWORKS +#include <X11/Xatom.h> + +//#define QT_NO_SHAPE +#ifdef QT_NO_SHAPE +# define XShapeCombineRegion(a,b,c,d,e,f,g) +# define XShapeCombineMask(a,b,c,d,e,f,g) +#else +# include <X11/extensions/shape.h> +#endif // QT_NO_SHAPE + + +#if !defined (QT_NO_TABLET) +# include <X11/extensions/XInput.h> +#if defined (Q_OS_IRIX) +# include <X11/extensions/SGIMisc.h> +# include <wacom.h> +#endif +#endif // QT_NO_TABLET + + +// #define QT_NO_XINERAMA +#ifndef QT_NO_XINERAMA +// XFree86 does not C++ify Xinerama (at least up to XFree86 4.0.3). +extern "C" { +# include <X11/extensions/Xinerama.h> +} +#endif // QT_NO_XINERAMA + +// #define QT_NO_XRANDR +#ifndef QT_NO_XRANDR +# include <X11/extensions/Xrandr.h> +#endif // QT_NO_XRANDR + +// #define QT_NO_XRENDER +#ifndef QT_NO_XRENDER +# include <X11/extensions/Xrender.h> +#endif // QT_NO_XRENDER + +#ifndef QT_NO_XSYNC +extern "C" { +# include "X11/extensions/sync.h" +} +#endif + +// #define QT_NO_XKB +#ifndef QT_NO_XKB +# include <X11/XKBlib.h> +#endif // QT_NO_XKB + + +#if !defined(XlibSpecificationRelease) +# define X11R4 +typedef char *XPointer; +#else +# undef X11R4 +#endif + +#ifndef QT_NO_XFIXES +typedef Bool (*PtrXFixesQueryExtension)(Display *, int *, int *); +typedef Status (*PtrXFixesQueryVersion)(Display *, int *, int *); +typedef void (*PtrXFixesSetCursorName)(Display *dpy, Cursor cursor, const char *name); +typedef void (*PtrXFixesSelectSelectionInput)(Display *dpy, Window win, Atom selection, unsigned long eventMask); +#endif // QT_NO_XFIXES + +#ifndef QT_NO_XCURSOR +#include <X11/Xcursor/Xcursor.h> +typedef Cursor (*PtrXcursorLibraryLoadCursor)(Display *, const char *); +#endif // QT_NO_XCURSOR + +#ifndef QT_NO_XINERAMA +typedef Bool (*PtrXineramaQueryExtension)(Display *dpy, int *event_base, int *error_base); +typedef Bool (*PtrXineramaIsActive)(Display *dpy); +typedef XineramaScreenInfo *(*PtrXineramaQueryScreens)(Display *dpy, int *number); +#endif // QT_NO_XINERAMA + +#ifndef QT_NO_XRANDR +typedef void (*PtrXRRSelectInput)(Display *, Window, int); +typedef int (*PtrXRRUpdateConfiguration)(XEvent *); +typedef int (*PtrXRRRootToScreen)(Display *, Window); +typedef Bool (*PtrXRRQueryExtension)(Display *, int *, int *); +#endif // QT_NO_XRANDR + +#ifndef QT_NO_XINPUT +typedef int (*PtrXCloseDevice)(Display *, XDevice *); +typedef XDeviceInfo* (*PtrXListInputDevices)(Display *, int *); +typedef XDevice* (*PtrXOpenDevice)(Display *, XID); +typedef void (*PtrXFreeDeviceList)(XDeviceInfo *); +typedef int (*PtrXSelectExtensionEvent)(Display *, Window, XEventClass *, int); +#endif // QT_NO_XINPUT + +/* + * Solaris patch 108652-47 and higher fixes crases in + * XRegisterIMInstantiateCallback, but the function doesn't seem to + * work. + * + * Instead, we disabled R6 input, and open the input method + * immediately at application start. + */ + +//######### XFree86 has wrong declarations for XRegisterIMInstantiateCallback +//######### and XUnregisterIMInstantiateCallback in at least version 3.3.2. +//######### Many old X11R6 header files lack XSetIMValues. +//######### Therefore, we have to declare these functions ourselves. + +extern "C" Bool XRegisterIMInstantiateCallback( + Display*, + struct _XrmHashBucketRec*, + char*, + char*, + XIMProc, //XFree86 has XIDProc, which has to be wrong + XPointer +); + +extern "C" Bool XUnregisterIMInstantiateCallback( + Display*, + struct _XrmHashBucketRec*, + char*, + char*, + XIMProc, //XFree86 has XIDProc, which has to be wrong + XPointer +); + +#ifndef X11R4 +# include <X11/Xlocale.h> +#endif // X11R4 + + +#ifndef QT_NO_MITSHM +# include <X11/extensions/XShm.h> +#endif // QT_NO_MITSHM + +// rename a couple of X defines to get rid of name clashes +// resolve the conflict between X11's FocusIn and QEvent::FocusIn +enum { + XFocusOut = FocusOut, + XFocusIn = FocusIn, + XKeyPress = KeyPress, + XKeyRelease = KeyRelease, + XNone = None, + XRevertToParent = RevertToParent, + XGrayScale = GrayScale, + XCursorShape = CursorShape +}; +#undef FocusOut +#undef FocusIn +#undef KeyPress +#undef KeyRelease +#undef None +#undef RevertToParent +#undef GrayScale +#undef CursorShape + +#ifdef FontChange +#undef FontChange +#endif + + +class QXlibStatic +{ +public: + enum X11Atom { + // window-manager <-> client protocols + WM_PROTOCOLS, + WM_DELETE_WINDOW, + WM_TAKE_FOCUS, + _NET_WM_PING, + _NET_WM_CONTEXT_HELP, + _NET_WM_SYNC_REQUEST, + _NET_WM_SYNC_REQUEST_COUNTER, + + // ICCCM window state + WM_STATE, + WM_CHANGE_STATE, + + // Session management + WM_CLIENT_LEADER, + WM_WINDOW_ROLE, + SM_CLIENT_ID, + + // Clipboard + CLIPBOARD, + INCR, + TARGETS, + MULTIPLE, + TIMESTAMP, + SAVE_TARGETS, + CLIP_TEMPORARY, + _QT_SELECTION, + _QT_CLIPBOARD_SENTINEL, + _QT_SELECTION_SENTINEL, + CLIPBOARD_MANAGER, + + RESOURCE_MANAGER, + + _XSETROOT_ID, + + _QT_SCROLL_DONE, + _QT_INPUT_ENCODING, + + _MOTIF_WM_HINTS, + + DTWM_IS_RUNNING, + ENLIGHTENMENT_DESKTOP, + _DT_SAVE_MODE, + _SGI_DESKS_MANAGER, + + // EWMH (aka NETWM) + _NET_SUPPORTED, + _NET_VIRTUAL_ROOTS, + _NET_WORKAREA, + + _NET_MOVERESIZE_WINDOW, + _NET_WM_MOVERESIZE, + + _NET_WM_NAME, + _NET_WM_ICON_NAME, + _NET_WM_ICON, + + _NET_WM_PID, + + _NET_WM_WINDOW_OPACITY, + + _NET_WM_STATE, + _NET_WM_STATE_ABOVE, + _NET_WM_STATE_BELOW, + _NET_WM_STATE_FULLSCREEN, + _NET_WM_STATE_MAXIMIZED_HORZ, + _NET_WM_STATE_MAXIMIZED_VERT, + _NET_WM_STATE_MODAL, + _NET_WM_STATE_STAYS_ON_TOP, + _NET_WM_STATE_DEMANDS_ATTENTION, + + _NET_WM_USER_TIME, + _NET_WM_USER_TIME_WINDOW, + _NET_WM_FULL_PLACEMENT, + + _NET_WM_WINDOW_TYPE, + _NET_WM_WINDOW_TYPE_DESKTOP, + _NET_WM_WINDOW_TYPE_DOCK, + _NET_WM_WINDOW_TYPE_TOOLBAR, + _NET_WM_WINDOW_TYPE_MENU, + _NET_WM_WINDOW_TYPE_UTILITY, + _NET_WM_WINDOW_TYPE_SPLASH, + _NET_WM_WINDOW_TYPE_DIALOG, + _NET_WM_WINDOW_TYPE_DROPDOWN_MENU, + _NET_WM_WINDOW_TYPE_POPUP_MENU, + _NET_WM_WINDOW_TYPE_TOOLTIP, + _NET_WM_WINDOW_TYPE_NOTIFICATION, + _NET_WM_WINDOW_TYPE_COMBO, + _NET_WM_WINDOW_TYPE_DND, + _NET_WM_WINDOW_TYPE_NORMAL, + _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, + + _KDE_NET_WM_FRAME_STRUT, + + _NET_STARTUP_INFO, + _NET_STARTUP_INFO_BEGIN, + + _NET_SUPPORTING_WM_CHECK, + + _NET_WM_CM_S0, + + _NET_SYSTEM_TRAY_VISUAL, + + _NET_ACTIVE_WINDOW, + + // Property formats + COMPOUND_TEXT, + TEXT, + UTF8_STRING, + + // Xdnd + XdndEnter, + XdndPosition, + XdndStatus, + XdndLeave, + XdndDrop, + XdndFinished, + XdndTypelist, + XdndActionList, + + XdndSelection, + + XdndAware, + XdndProxy, + + XdndActionCopy, + XdndActionLink, + XdndActionMove, + XdndActionPrivate, + + // Motif DND + _MOTIF_DRAG_AND_DROP_MESSAGE, + _MOTIF_DRAG_INITIATOR_INFO, + _MOTIF_DRAG_RECEIVER_INFO, + _MOTIF_DRAG_WINDOW, + _MOTIF_DRAG_TARGETS, + + XmTRANSFER_SUCCESS, + XmTRANSFER_FAILURE, + + // Xkb + _XKB_RULES_NAMES, + + // XEMBED + _XEMBED, + _XEMBED_INFO, + + XWacomStylus, + XWacomCursor, + XWacomEraser, + + XTabletStylus, + XTabletEraser, + + NPredefinedAtoms, + + _QT_SETTINGS_TIMESTAMP = NPredefinedAtoms, + NAtoms + }; + + static Atom atom(X11Atom atom); + static bool isSupportedByWM(Atom atom); + + static bool useXFixes(); + static int xFixesEventBase(); + + #ifndef QT_NO_XFIXES + static PtrXFixesSelectSelectionInput xFixesSelectSelectionInput(); + #endif //QT_NO_XFIXES + + static QImage qimageFromXImage(XImage *xi); + + +}; + +#endif // QTESTLITESTATICINFO_H diff --git a/src/plugins/platforms/xlib/qtestlitewindow.cpp b/src/plugins/platforms/xlib/qtestlitewindow.cpp new file mode 100644 index 0000000..0f11a81 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitewindow.cpp @@ -0,0 +1,735 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitewindow.h" + +#include "qtestliteintegration.h" +#include "qtestlitescreen.h" +#include "qtestlitekeyboard.h" +#include "qtestlitestaticinfo.h" + +#include <QtGui/QWindowSystemInterface> +#include <QSocketNotifier> +#include <QApplication> +#include <QDebug> + +#include <QtGui/private/qwindowsurface_p.h> +#include <QtGui/private/qapplication_p.h> + +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) +#include "qglxintegration.h" +#else +#include "../eglconvenience/qeglconvenience.h" +#include "../eglconvenience/qeglplatformcontext.h" +#include "qtestliteeglintegration.h" +#endif //QT_OPENGL_ES_2 +#endif //QT_NO_OPENGL + +//#define MYX11_DEBUG + +QT_BEGIN_NAMESPACE + +QXlibWindow::QXlibWindow(QWidget *window) + : QPlatformWindow(window) + , mGLContext(0) + , mScreen(QXlibScreen::testLiteScreenForWidget(window)) +{ + int x = window->x(); + int y = window->y(); + int w = window->width(); + int h = window->height(); + + if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL + && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) + XVisualInfo *visualInfo = QGLXContext::findVisualInfo(mScreen,window->platformWindowFormat()); +#else + QPlatformWindowFormat windowFormat = correctColorBuffers(window->platformWindowFormat()); + + EGLDisplay eglDisplay = eglGetDisplay(mScreen->display()); + EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,windowFormat); + VisualID id = QXlibEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); + + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + visualInfoTemplate.visualid = id; + + XVisualInfo *visualInfo; + int matchingCount = 0; + visualInfo = XGetVisualInfo(mScreen->display(), VisualIDMask, &visualInfoTemplate, &matchingCount); +#endif //!defined(QT_OPENGL_ES_2) + if (visualInfo) { + Colormap cmap = XCreateColormap(mScreen->display(),mScreen->rootWindow(),visualInfo->visual,AllocNone); + + XSetWindowAttributes a; + a.colormap = cmap; + x_window = XCreateWindow(mScreen->display(), mScreen->rootWindow(),x, y, w, h, + 0, visualInfo->depth, InputOutput, visualInfo->visual, + CWColormap, &a); + } else { + qFatal("no window!"); + } +#endif //!defined(QT_NO_OPENGL) + } else { + x_window = XCreateSimpleWindow(mScreen->display(), mScreen->rootWindow(), + x, y, w, h, 0 /*border_width*/, + mScreen->blackPixel(), mScreen->whitePixel()); + } + +#ifdef MYX11_DEBUG + qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; +#endif + + XSetWindowBackgroundPixmap(mScreen->display(), x_window, XNone); + + XSelectInput(mScreen->display(), x_window, + ExposureMask | KeyPressMask | KeyReleaseMask | + EnterWindowMask | LeaveWindowMask | FocusChangeMask | + PointerMotionMask | ButtonPressMask | ButtonReleaseMask | + ButtonMotionMask | PropertyChangeMask | + StructureNotifyMask); + + gc = createGC(); + + Atom protocols[5]; + int n = 0; + protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); // support del window protocol + protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_TAKE_FOCUS); // support take focus window protocol + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_PING); // support _NET_WM_PING protocol +#ifndef QT_NO_XSYNC + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_SYNC_REQUEST); // support _NET_WM_SYNC_REQUEST protocol +#endif // QT_NO_XSYNC + if (window->windowFlags() & Qt::WindowContextHelpButtonHint) + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_CONTEXT_HELP); + XSetWMProtocols(mScreen->display(), x_window, protocols, n); +} + + + +QXlibWindow::~QXlibWindow() +{ +#ifdef MYX11_DEBUG + qDebug() << "~QTestLiteWindow" << hex << x_window; +#endif + delete mGLContext; + XFreeGC(mScreen->display(), gc); + XDestroyWindow(mScreen->display(), x_window); +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Mouse event stuff +static Qt::MouseButtons translateMouseButtons(int s) +{ + Qt::MouseButtons ret = 0; + if (s & Button1Mask) + ret |= Qt::LeftButton; + if (s & Button2Mask) + ret |= Qt::MidButton; + if (s & Button3Mask) + ret |= Qt::RightButton; + return ret; +} + + + +void QXlibWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) +{ + static QPoint mousePoint; + + Qt::MouseButton button = Qt::NoButton; + Qt::MouseButtons buttons = translateMouseButtons(e->state); + Qt::KeyboardModifiers modifiers = mScreen->keyboard()->translateModifiers(e->state); + if (type != QEvent::MouseMove) { + switch (e->button) { + case Button1: button = Qt::LeftButton; break; + case Button2: button = Qt::MidButton; break; + case Button3: button = Qt::RightButton; break; + case Button4: + case Button5: + case 6: + case 7: { + //mouse wheel + if (type == QEvent::MouseButtonPress) { + //logic borrowed from qapplication_x11.cpp + int delta = 120 * ((e->button == Button4 || e->button == 6) ? 1 : -1); + bool hor = (((e->button == Button4 || e->button == Button5) + && (modifiers & Qt::AltModifier)) + || (e->button == 6 || e->button == 7)); + QWindowSystemInterface::handleWheelEvent(widget(), e->time, + QPoint(e->x, e->y), + QPoint(e->x_root, e->y_root), + delta, hor ? Qt::Horizontal : Qt::Vertical); + } + return; + } + default: break; + } + } + + buttons ^= button; // X event uses state *before*, Qt uses state *after* + + QWindowSystemInterface::handleMouseEvent(widget(), e->time, QPoint(e->x, e->y), + QPoint(e->x_root, e->y_root), + buttons); + + mousePoint = QPoint(e->x_root, e->y_root); +} + +void QXlibWindow::handleCloseEvent() +{ + QWindowSystemInterface::handleCloseEvent(widget()); +} + + +void QXlibWindow::handleEnterEvent() +{ + QWindowSystemInterface::handleEnterEvent(widget()); +} + +void QXlibWindow::handleLeaveEvent() +{ + QWindowSystemInterface::handleLeaveEvent(widget()); +} + +void QXlibWindow::handleFocusInEvent() +{ + QWindowSystemInterface::handleWindowActivated(widget()); +} + +void QXlibWindow::handleFocusOutEvent() +{ + QWindowSystemInterface::handleWindowActivated(0); +} + + + +void QXlibWindow::setGeometry(const QRect &rect) +{ + XMoveResizeWindow(mScreen->display(), x_window, rect.x(), rect.y(), rect.width(), rect.height()); + QPlatformWindow::setGeometry(rect); +} + + +Qt::WindowFlags QXlibWindow::windowFlags() const +{ + return mWindowFlags; +} + +WId QXlibWindow::winId() const +{ + return x_window; +} + +void QXlibWindow::setParent(const QPlatformWindow *window) +{ + QPoint topLeft = geometry().topLeft(); + XReparentWindow(mScreen->display(),x_window,window->winId(),topLeft.x(),topLeft.y()); +} + +void QXlibWindow::raise() +{ + XRaiseWindow(mScreen->display(), x_window); +} + +void QXlibWindow::lower() +{ + XLowerWindow(mScreen->display(), x_window); +} + +void QXlibWindow::setWindowTitle(const QString &title) +{ + QByteArray ba = title.toLatin1(); //We're not making a general solution here... + XTextProperty windowName; + windowName.value = (unsigned char *)ba.constData(); + windowName.encoding = XA_STRING; + windowName.format = 8; + windowName.nitems = ba.length(); + + XSetWMName(mScreen->display(), x_window, &windowName); +} + +GC QXlibWindow::createGC() +{ + GC gc; + + gc = XCreateGC(mScreen->display(), x_window, 0, 0); + if (gc < 0) { + qWarning("QTestLiteWindow::createGC() could not create GC"); + } + return gc; +} + +void QXlibWindow::paintEvent() +{ +#ifdef MYX11_DEBUG +// qDebug() << "QTestLiteWindow::paintEvent" << shm_img.size() << painted; +#endif + + if (QWindowSurface *surface = widget()->windowSurface()) + surface->flush(widget(), widget()->geometry(), QPoint()); +} + +void QXlibWindow::requestActivateWindow() +{ + XSetInputFocus(mScreen->display(), x_window, XRevertToParent, CurrentTime); +} + +void QXlibWindow::resizeEvent(XConfigureEvent *e) +{ + int xpos = geometry().x(); + int ypos = geometry().y(); + if ((e->width != geometry().width() || e->height != geometry().height()) && e->x == 0 && e->y == 0) { + //qDebug() << "resize with bogus pos" << e->x << e->y << e->width << e->height << "window"<< hex << window; + } else { + //qDebug() << "geometry change" << e->x << e->y << e->width << e->height << "window"<< hex << window; + xpos = e->x; + ypos = e->y; + } +#ifdef MYX11_DEBUG + qDebug() << hex << x_window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height; +#endif + + QRect newRect(xpos, ypos, e->width, e->height); + QWindowSystemInterface::handleGeometryChange(widget(), newRect); +} + +void QXlibWindow::mousePressEvent(XButtonEvent *e) +{ + static long prevTime = 0; + static Window prevWindow; + static int prevX = -999; + static int prevY = -999; + + QEvent::Type type = QEvent::MouseButtonPress; + + if (e->window == prevWindow && long(e->time) - prevTime < QApplication::doubleClickInterval() + && qAbs(e->x - prevX) < 5 && qAbs(e->y - prevY) < 5) { + type = QEvent::MouseButtonDblClick; + prevTime = e->time - QApplication::doubleClickInterval(); //no double click next time + } else { + prevTime = e->time; + } + prevWindow = e->window; + prevX = e->x; + prevY = e->y; + + handleMouseEvent(type, e); +} + +QXlibMWMHints QXlibWindow::getMWMHints() const +{ + QXlibMWMHints mwmhints; + + Atom type; + int format; + ulong nitems, bytesLeft; + uchar *data = 0; + Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); + if ((XGetWindowProperty(mScreen->display(), x_window, atomForMotifWmHints, 0, 5, false, + atomForMotifWmHints, &type, &format, &nitems, &bytesLeft, + &data) == Success) + && (type == atomForMotifWmHints + && format == 32 + && nitems >= 5)) { + mwmhints = *(reinterpret_cast<QXlibMWMHints *>(data)); + } else { + mwmhints.flags = 0L; + mwmhints.functions = MWM_FUNC_ALL; + mwmhints.decorations = MWM_DECOR_ALL; + mwmhints.input_mode = 0L; + mwmhints.status = 0L; + } + + if (data) + XFree(data); + + return mwmhints; +} + +void QXlibWindow::setMWMHints(const QXlibMWMHints &mwmhints) +{ + Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); + if (mwmhints.flags != 0l) { + XChangeProperty(mScreen->display(), x_window, + atomForMotifWmHints, atomForMotifWmHints, 32, + PropModeReplace, (unsigned char *) &mwmhints, 5); + } else { + XDeleteProperty(mScreen->display(), x_window, atomForMotifWmHints); + } +} + +// Returns true if we should set WM_TRANSIENT_FOR on \a w +static inline bool isTransient(const QWidget *w) +{ + return ((w->windowType() == Qt::Dialog + || w->windowType() == Qt::Sheet + || w->windowType() == Qt::Tool + || w->windowType() == Qt::SplashScreen + || w->windowType() == Qt::ToolTip + || w->windowType() == Qt::Drawer + || w->windowType() == Qt::Popup) + && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); +} + +QVector<Atom> QXlibWindow::getNetWmState() const +{ + QVector<Atom> returnValue; + + // Don't read anything, just get the size of the property data + Atom actualType; + int actualFormat; + ulong propertyLength; + ulong bytesLeft; + uchar *propertyData = 0; + if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, 0, + False, XA_ATOM, &actualType, &actualFormat, + &propertyLength, &bytesLeft, &propertyData) == Success + && actualType == XA_ATOM && actualFormat == 32) { + returnValue.resize(bytesLeft / 4); + XFree((char*) propertyData); + + // fetch all data + if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, + returnValue.size(), False, XA_ATOM, &actualType, &actualFormat, + &propertyLength, &bytesLeft, &propertyData) != Success) { + returnValue.clear(); + } else if (propertyLength != (ulong)returnValue.size()) { + returnValue.resize(propertyLength); + } + + // put it into netWmState + if (!returnValue.isEmpty()) { + memcpy(returnValue.data(), propertyData, returnValue.size() * sizeof(Atom)); + } + XFree((char*) propertyData); + } + + return returnValue; +} + +Qt::WindowFlags QXlibWindow::setWindowFlags(Qt::WindowFlags flags) +{ +// Q_ASSERT(flags & Qt::Window); + mWindowFlags = flags; + +#ifdef MYX11_DEBUG + qDebug() << "QTestLiteWindow::setWindowFlags" << hex << x_window << "flags" << flags; +#endif + Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask)); + + if (type == Qt::ToolTip) + flags |= Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint; + if (type == Qt::Popup) + flags |= Qt::X11BypassWindowManagerHint; + + bool topLevel = (flags & Qt::Window); + bool popup = (type == Qt::Popup); + bool dialog = (type == Qt::Dialog + || type == Qt::Sheet); + bool desktop = (type == Qt::Desktop); + bool tool = (type == Qt::Tool || type == Qt::SplashScreen + || type == Qt::ToolTip || type == Qt::Drawer); + + Q_UNUSED(topLevel); + Q_UNUSED(dialog); + Q_UNUSED(desktop); + + bool tooltip = (type == Qt::ToolTip); + + XSetWindowAttributes wsa; + + QXlibMWMHints mwmhints; + mwmhints.flags = 0L; + mwmhints.functions = 0L; + mwmhints.decorations = 0; + mwmhints.input_mode = 0L; + mwmhints.status = 0L; + + + ulong wsa_mask = 0; + if (type != Qt::SplashScreen) { // && customize) { + mwmhints.flags |= MWM_HINTS_DECORATIONS; + + bool customize = flags & Qt::CustomizeWindowHint; + if (!(flags & Qt::FramelessWindowHint) && !(customize && !(flags & Qt::WindowTitleHint))) { + mwmhints.decorations |= MWM_DECOR_BORDER; + mwmhints.decorations |= MWM_DECOR_RESIZEH; + + if (flags & Qt::WindowTitleHint) + mwmhints.decorations |= MWM_DECOR_TITLE; + + if (flags & Qt::WindowSystemMenuHint) + mwmhints.decorations |= MWM_DECOR_MENU; + + if (flags & Qt::WindowMinimizeButtonHint) { + mwmhints.decorations |= MWM_DECOR_MINIMIZE; + mwmhints.functions |= MWM_FUNC_MINIMIZE; + } + + if (flags & Qt::WindowMaximizeButtonHint) { + mwmhints.decorations |= MWM_DECOR_MAXIMIZE; + mwmhints.functions |= MWM_FUNC_MAXIMIZE; + } + + if (flags & Qt::WindowCloseButtonHint) + mwmhints.functions |= MWM_FUNC_CLOSE; + } + } else { + // if type == Qt::SplashScreen + mwmhints.decorations = MWM_DECOR_ALL; + } + + if (tool) { + wsa.save_under = True; + wsa_mask |= CWSaveUnder; + } + + if (flags & Qt::X11BypassWindowManagerHint) { + wsa.override_redirect = True; + wsa_mask |= CWOverrideRedirect; + } +#if 0 + if (wsa_mask && initializeWindow) { + Q_ASSERT(id); + XChangeWindowAttributes(dpy, id, wsa_mask, &wsa); + } +#endif + if (mwmhints.functions != 0) { + mwmhints.flags |= MWM_HINTS_FUNCTIONS; + mwmhints.functions |= MWM_FUNC_MOVE | MWM_FUNC_RESIZE; + } else { + mwmhints.functions = MWM_FUNC_ALL; + } + + if (!(flags & Qt::FramelessWindowHint) + && flags & Qt::CustomizeWindowHint + && flags & Qt::WindowTitleHint + && !(flags & + (Qt::WindowMinimizeButtonHint + | Qt::WindowMaximizeButtonHint + | Qt::WindowCloseButtonHint))) { + // a special case - only the titlebar without any button + mwmhints.flags = MWM_HINTS_FUNCTIONS; + mwmhints.functions = MWM_FUNC_MOVE | MWM_FUNC_RESIZE; + mwmhints.decorations = 0; + } + + if (widget()->windowModality() == Qt::WindowModal) { + mwmhints.input_mode = MWM_INPUT_PRIMARY_APPLICATION_MODAL; + } else if (widget()->windowModality() == Qt::ApplicationModal) { + mwmhints.input_mode = MWM_INPUT_FULL_APPLICATION_MODAL; + } + + setMWMHints(mwmhints); + + QVector<Atom> netWmState = getNetWmState(); + + if (flags & Qt::WindowStaysOnTopHint) { + if (flags & Qt::WindowStaysOnBottomHint) + qWarning() << "QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time"; + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP)); + } else if (flags & Qt::WindowStaysOnBottomHint) { + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW)); + } + if (widget()->isFullScreen()) { + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN)); + } + if (widget()->isMaximized()) { + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT)); + } + if (widget()->windowModality() != Qt::NonModal) { + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL)); + } + + if (!netWmState.isEmpty()) { + XChangeProperty(mScreen->display(), x_window, + QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), XA_ATOM, 32, PropModeReplace, + (unsigned char *) netWmState.data(), netWmState.size()); + } else { + XDeleteProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE)); + } + +//##### only if initializeWindow??? + + if (popup || tooltip) { // popup widget +#ifdef MYX11_DEBUG + qDebug() << "Doing XChangeWindowAttributes for popup" << wsa.override_redirect; +#endif + // set EWMH window types + // setNetWmWindowTypes(); + + wsa.override_redirect = True; + wsa.save_under = True; + XChangeWindowAttributes(mScreen->display(), x_window, CWOverrideRedirect | CWSaveUnder, + &wsa); + } else { +#ifdef MYX11_DEBUG + qDebug() << "Doing XChangeWindowAttributes for non-popup"; +#endif + } + + return flags; +} + +void QXlibWindow::setVisible(bool visible) +{ +#ifdef MYX11_DEBUG + qDebug() << "QTestLiteWindow::setVisible" << visible << hex << x_window; +#endif + if (isTransient(widget())) { + Window parentXWindow = x_window; + if (widget()->parentWidget()) { + QWidget *widgetParent = widget()->parentWidget()->window(); + if (widgetParent && widgetParent->platformWindow()) { + QXlibWindow *parentWidnow = static_cast<QXlibWindow *>(widgetParent->platformWindow()); + parentXWindow = parentWidnow->x_window; + } + } + XSetTransientForHint(mScreen->display(),x_window,parentXWindow); + } + + if (visible) { + //ensure that the window is viewed in correct position. + doSizeHints(); + XMapWindow(mScreen->display(), x_window); + } else { + XUnmapWindow(mScreen->display(), x_window); + } +} + +void QXlibWindow::setCursor(const Cursor &cursor) +{ + XDefineCursor(mScreen->display(), x_window, cursor); + XFlush(mScreen->display()); +} + +QPlatformGLContext *QXlibWindow::glContext() const +{ + if (!QApplicationPrivate::platformIntegration()->hasOpenGL()) + return 0; + if (!mGLContext) { + QXlibWindow *that = const_cast<QXlibWindow *>(this); +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) + that->mGLContext = new QGLXContext(x_window, mScreen,widget()->platformWindowFormat()); +#else + EGLDisplay display = eglGetDisplay(mScreen->display()); + + QPlatformWindowFormat windowFormat = correctColorBuffers(widget()->platformWindowFormat()); + + EGLConfig config = q_configFromQPlatformWindowFormat(display,windowFormat); + QVector<EGLint> eglContextAttrs; + eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); + eglContextAttrs.append(2); + eglContextAttrs.append(EGL_NONE); + + EGLSurface eglSurface = eglCreateWindowSurface(display,config,(EGLNativeWindowType)x_window,0); + that->mGLContext = new QEGLPlatformContext(display, config, eglContextAttrs.data(), eglSurface, EGL_OPENGL_ES_API); +#endif +#endif + } + return mGLContext; +} + +Window QXlibWindow::xWindow() const +{ + return x_window; +} + +GC QXlibWindow::graphicsContext() const +{ + return gc; +} + +void QXlibWindow::doSizeHints() +{ + Q_ASSERT(widget()->testAttribute(Qt::WA_WState_Created)); + XSizeHints s; + s.flags = 0; + QRect g = geometry(); + s.x = g.x(); + s.y = g.y(); + s.width = g.width(); + s.height = g.height(); + s.flags |= USPosition; + s.flags |= PPosition; + s.flags |= USSize; + s.flags |= PSize; + s.flags |= PWinGravity; + s.win_gravity = QApplication::isRightToLeft() ? NorthEastGravity : NorthWestGravity; + XSetWMNormalHints(mScreen->display(), x_window, &s); +} + +QPlatformWindowFormat QXlibWindow::correctColorBuffers(const QPlatformWindowFormat &platformWindowFormat) const +{ + // I have only tested this setup on a dodgy intel setup, where I didn't use standard libs, + // so this might be not what we want to do :) + if ( !(platformWindowFormat.redBufferSize() == -1 && + platformWindowFormat.greenBufferSize() == -1 && + platformWindowFormat.blueBufferSize() == -1)) + return platformWindowFormat; + + QPlatformWindowFormat windowFormat = platformWindowFormat; + if (mScreen->depth() == 16) { + windowFormat.setRedBufferSize(5); + windowFormat.setGreenBufferSize(6); + windowFormat.setBlueBufferSize(5); + } else { + windowFormat.setRedBufferSize(8); + windowFormat.setGreenBufferSize(8); + windowFormat.setBlueBufferSize(8); + } + + return windowFormat; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qtestlitewindow.h b/src/plugins/platforms/xlib/qtestlitewindow.h new file mode 100644 index 0000000..ccf6867 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitewindow.h @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITEWINDOW_H +#define QTESTLITEWINDOW_H + +#include "qtestliteintegration.h" + +#include <QPlatformWindow> +#include <QEvent> + +#include <QObject> +#include <QImage> + +struct QXlibMWMHints { + ulong flags, functions, decorations; + long input_mode; + ulong status; +}; + +enum { + MWM_HINTS_FUNCTIONS = (1L << 0), + + MWM_FUNC_ALL = (1L << 0), + MWM_FUNC_RESIZE = (1L << 1), + MWM_FUNC_MOVE = (1L << 2), + MWM_FUNC_MINIMIZE = (1L << 3), + MWM_FUNC_MAXIMIZE = (1L << 4), + MWM_FUNC_CLOSE = (1L << 5), + + MWM_HINTS_DECORATIONS = (1L << 1), + + MWM_DECOR_ALL = (1L << 0), + MWM_DECOR_BORDER = (1L << 1), + MWM_DECOR_RESIZEH = (1L << 2), + MWM_DECOR_TITLE = (1L << 3), + MWM_DECOR_MENU = (1L << 4), + MWM_DECOR_MINIMIZE = (1L << 5), + MWM_DECOR_MAXIMIZE = (1L << 6), + + MWM_HINTS_INPUT_MODE = (1L << 2), + + MWM_INPUT_MODELESS = 0L, + MWM_INPUT_PRIMARY_APPLICATION_MODAL = 1L, + MWM_INPUT_FULL_APPLICATION_MODAL = 3L +}; + +class QXlibWindow : public QPlatformWindow +{ +public: + QXlibWindow(QWidget *window); + ~QXlibWindow(); + + + void mousePressEvent(XButtonEvent*); + void handleMouseEvent(QEvent::Type, XButtonEvent *ev); + + void handleCloseEvent(); + void handleEnterEvent(); + void handleLeaveEvent(); + void handleFocusInEvent(); + void handleFocusOutEvent(); + + void resizeEvent(XConfigureEvent *configure_event); + void paintEvent(); + + void requestActivateWindow(); + + void setGeometry(const QRect &rect); + + Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); + Qt::WindowFlags windowFlags() const; + void setVisible(bool visible); + WId winId() const; + void setParent(const QPlatformWindow *window); + void raise(); + void lower(); + void setWindowTitle(const QString &title); + + void setCursor(const Cursor &cursor); + + QPlatformGLContext *glContext() const; + + Window xWindow() const; + GC graphicsContext() const; + +protected: + QVector<Atom> getNetWmState() const; + void setMWMHints(const QXlibMWMHints &mwmhints); + QXlibMWMHints getMWMHints() const; + + void doSizeHints(); + +private: + QPlatformWindowFormat correctColorBuffers(const QPlatformWindowFormat &windowFormat)const; + + Window x_window; + GC gc; + + GC createGC(); + + QPlatformGLContext *mGLContext; + QXlibScreen *mScreen; + Qt::WindowFlags mWindowFlags; +}; + +#endif diff --git a/src/plugins/platforms/xlib/qtestlitewindowsurface.cpp b/src/plugins/platforms/xlib/qtestlitewindowsurface.cpp new file mode 100644 index 0000000..088730d --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitewindowsurface.cpp @@ -0,0 +1,224 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitewindowsurface.h" +#include "qtestliteintegration.h" + +#include <QtCore/qdebug.h> +#include <QWindowSystemInterface> + +#include "qtestlitewindow.h" +#include "qtestlitescreen.h" + +# include <sys/ipc.h> +# include <sys/shm.h> +# include <X11/extensions/XShm.h> + +QT_BEGIN_NAMESPACE + + +struct QXlibShmImageInfo { + QXlibShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} + ~QXlibShmImageInfo() { destroy(); } + + void destroy(); + + XShmSegmentInfo shminfo; + XImage *image; + Display *display; +}; + + +#ifndef DONT_USE_MIT_SHM +void QXlibShmImageInfo::destroy() +{ + XShmDetach (display, &shminfo); + XDestroyImage (image); + shmdt (shminfo.shmaddr); + shmctl (shminfo.shmid, IPC_RMID, 0); +} +#endif + +void QXlibWindowSurface::resizeShmImage(int width, int height) +{ + +#ifdef DONT_USE_MIT_SHM + shm_img = QImage(width, height, QImage::Format_RGB32); +#else + + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(window()); + if (image_info) + image_info->destroy(); + else + image_info = new QXlibShmImageInfo(screen->display()); + + Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); + + + XImage *image = XShmCreateImage (screen->display(), visual, 24, ZPixmap, 0, + &image_info->shminfo, width, height); + + + image_info->shminfo.shmid = shmget (IPC_PRIVATE, + image->bytes_per_line * image->height, IPC_CREAT|0777); + + image_info->shminfo.shmaddr = image->data = (char*)shmat (image_info->shminfo.shmid, 0, 0); + image_info->shminfo.readOnly = False; + + image_info->image = image; + + Status shm_attach_status = XShmAttach(screen->display(), &image_info->shminfo); + + Q_ASSERT(shm_attach_status == True); + + shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, QImage::Format_RGB32 ); +#endif + painted = false; +} + + +void QXlibWindowSurface::resizeBuffer(QSize s) +{ + if (shm_img.size() != s) + resizeShmImage(s.width(), s.height()); +} + +QSize QXlibWindowSurface::bufferSize() const +{ + return shm_img.size(); +} + +QXlibWindowSurface::QXlibWindowSurface (QWidget *window) + : QWindowSurface(window), + painted(false), image_info(0) +{ + xw = static_cast<QXlibWindow*>(window->platformWindow()); +// qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; +} + +QXlibWindowSurface::~QXlibWindowSurface() +{ + delete image_info; +} + +QPaintDevice *QXlibWindowSurface::paintDevice() +{ + return &shm_img; +} + + +void QXlibWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(region); + Q_UNUSED(offset); + + if (!painted) + return; + + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); + GC gc = xw->graphicsContext(); + Window window = xw->xWindow(); +#ifdef DONT_USE_MIT_SHM + // just convert the image every time... + if (!shm_img.isNull()) { + Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); + + QImage image = shm_img; + //img.convertToFormat( + XImage *xi = XCreateImage(screen->display(), visual, 24, ZPixmap, + 0, (char *) image.scanLine(0), image.width(), image.height(), + 32, image.bytesPerLine()); + + int x = 0; + int y = 0; + + /*int r =*/ XPutImage(screen->display(), window, gc, xi, 0, 0, x, y, image.width(), image.height()); + + xi->data = 0; // QImage owns these bits + XDestroyImage(xi); + } +#else + // Use MIT_SHM + if (image_info && image_info->image) { + //qDebug() << "Here we go" << image_info->image->width << image_info->image->height; + int x = 0; + int y = 0; + + // We could set send_event to true, and then use the ShmCompletion to synchronize, + // but let's do like Qt/11 and just use XSync + XShmPutImage (screen->display(), window, gc, image_info->image, 0, 0, + x, y, image_info->image->width, image_info->image->height, + /*send_event*/ False); + + XSync(screen->display(), False); + } +#endif +} + +// from qwindowsurface.cpp +extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); + +bool QXlibWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + if (shm_img.isNull()) + return false; + + const QVector<QRect> rects = area.rects(); + for (int i = 0; i < rects.size(); ++i) + qt_scrollRectInImage(shm_img, rects.at(i), QPoint(dx, dy)); + + return true; +} + + +void QXlibWindowSurface::beginPaint(const QRegion ®ion) +{ + Q_UNUSED(region); + resizeBuffer(size()); +} + +void QXlibWindowSurface::endPaint(const QRegion ®ion) +{ + Q_UNUSED(region); + painted = true; //there is content in the buffer +} +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qtestlitewindowsurface.h b/src/plugins/platforms/xlib/qtestlitewindowsurface.h new file mode 100644 index 0000000..12b4c60 --- /dev/null +++ b/src/plugins/platforms/xlib/qtestlitewindowsurface.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_TESTLITE_H +#define QWINDOWSURFACE_TESTLITE_H + +#include <QtGui/private/qwindowsurface_p.h> + + +QT_BEGIN_NAMESPACE + +class QXlibWindow; +class QXlibIntegration; +class QXlibScreen; +class QXlibShmImageInfo; + +class QXlibWindowSurface : public QWindowSurface +{ +public: + QXlibWindowSurface (QWidget *window); + ~QXlibWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + +private: + bool painted; + void resizeBuffer(QSize); + QSize bufferSize() const; + + + void resizeShmImage(int width, int height); + + QImage shm_img; + QXlibShmImageInfo *image_info; + + QXlibWindow *xw; + +}; + + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/xlib/testlite.pro b/src/plugins/platforms/xlib/testlite.pro new file mode 100644 index 0000000..7fb3304 --- /dev/null +++ b/src/plugins/platforms/xlib/testlite.pro @@ -0,0 +1,57 @@ +TARGET = qtestlite + +include(../../qpluginbase.pri) +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms + +SOURCES = \ + main.cpp \ + qtestliteintegration.cpp \ + qtestlitewindowsurface.cpp \ + qtestlitewindow.cpp \ + qtestlitecursor.cpp \ + qtestlitescreen.cpp \ + qtestlitekeyboard.cpp \ + qtestliteclipboard.cpp \ + qtestlitemime.cpp \ + qtestlitestaticinfo.cpp + +HEADERS = \ + qtestliteintegration.h \ + qtestlitewindowsurface.h \ + qtestlitewindow.h \ + qtestlitecursor.h \ + qtestlitescreen.h \ + qtestlitekeyboard.h \ + qtestliteclipboard.h \ + qtestlitemime.h \ + qtestlitestaticinfo.h + +LIBS += -lX11 -lXext + +mac { + LIBS += -L/usr/X11/lib -lz -framework Carbon +} + +include (../fontdatabases/genericunix/genericunix.pri) + +contains(QT_CONFIG, opengl) { + QT += opengl + !contains(QT_CONFIG, opengles2) { + HEADERS += qglxintegration.h + SOURCES += qglxintegration.cpp + } else { # There is no easy way to detect if we'r suppose to use glx or not + HEADERS += \ + ../eglconvenience/qeglplatformcontext.h \ + ../eglconvenience/qeglconvenience.h \ + qtestliteeglintegration.h + + SOURCES += \ + ../eglconvenience/qeglplatformcontext.cpp \ + ../eglconvenience/qeglconvenience.cpp \ + qtestliteeglintegration.cpp + LIBS += -lEGL + } +} + +target.path += $$[QT_INSTALL_PLUGINS]/platforms +INSTALLS += target -- cgit v0.12 From 29e009b19593bb42c65fd3a7e6646e929c514b44 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Mon, 14 Feb 2011 13:42:42 +0100 Subject: Lighthouse Renamed testlite files to xlib --- src/plugins/platforms/xlib/qtestliteclipboard.cpp | 676 ------------- src/plugins/platforms/xlib/qtestliteclipboard.h | 94 -- src/plugins/platforms/xlib/qtestlitecursor.cpp | 199 ---- src/plugins/platforms/xlib/qtestlitecursor.h | 68 -- .../platforms/xlib/qtestliteeglintegration.cpp | 186 ---- .../platforms/xlib/qtestliteeglintegration.h | 54 -- .../platforms/xlib/qtestliteintegration.cpp | 156 --- src/plugins/platforms/xlib/qtestliteintegration.h | 85 -- src/plugins/platforms/xlib/qtestlitekeyboard.cpp | 1000 -------------------- src/plugins/platforms/xlib/qtestlitekeyboard.h | 76 -- src/plugins/platforms/xlib/qtestlitemime.cpp | 322 ------- src/plugins/platforms/xlib/qtestlitemime.h | 67 -- src/plugins/platforms/xlib/qtestlitescreen.cpp | 468 --------- src/plugins/platforms/xlib/qtestlitescreen.h | 104 -- src/plugins/platforms/xlib/qtestlitestaticinfo.cpp | 511 ---------- src/plugins/platforms/xlib/qtestlitestaticinfo.h | 413 -------- src/plugins/platforms/xlib/qtestlitewindow.cpp | 735 -------------- src/plugins/platforms/xlib/qtestlitewindow.h | 145 --- .../platforms/xlib/qtestlitewindowsurface.cpp | 224 ----- .../platforms/xlib/qtestlitewindowsurface.h | 86 -- src/plugins/platforms/xlib/qxlibclipboard.cpp | 676 +++++++++++++ src/plugins/platforms/xlib/qxlibclipboard.h | 94 ++ src/plugins/platforms/xlib/qxlibcursor.cpp | 199 ++++ src/plugins/platforms/xlib/qxlibcursor.h | 68 ++ src/plugins/platforms/xlib/qxlibeglintegration.cpp | 186 ++++ src/plugins/platforms/xlib/qxlibeglintegration.h | 54 ++ src/plugins/platforms/xlib/qxlibintegration.cpp | 156 +++ src/plugins/platforms/xlib/qxlibintegration.h | 85 ++ src/plugins/platforms/xlib/qxlibkeyboard.cpp | 1000 ++++++++++++++++++++ src/plugins/platforms/xlib/qxlibkeyboard.h | 76 ++ src/plugins/platforms/xlib/qxlibmime.cpp | 322 +++++++ src/plugins/platforms/xlib/qxlibmime.h | 67 ++ src/plugins/platforms/xlib/qxlibscreen.cpp | 468 +++++++++ src/plugins/platforms/xlib/qxlibscreen.h | 104 ++ src/plugins/platforms/xlib/qxlibstatic.cpp | 511 ++++++++++ src/plugins/platforms/xlib/qxlibstatic.h | 413 ++++++++ src/plugins/platforms/xlib/qxlibwindow.cpp | 735 ++++++++++++++ src/plugins/platforms/xlib/qxlibwindow.h | 145 +++ src/plugins/platforms/xlib/qxlibwindowsurface.cpp | 224 +++++ src/plugins/platforms/xlib/qxlibwindowsurface.h | 86 ++ src/plugins/platforms/xlib/testlite.pro | 57 -- src/plugins/platforms/xlib/xlib.pro | 57 ++ 42 files changed, 5726 insertions(+), 5726 deletions(-) delete mode 100644 src/plugins/platforms/xlib/qtestliteclipboard.cpp delete mode 100644 src/plugins/platforms/xlib/qtestliteclipboard.h delete mode 100644 src/plugins/platforms/xlib/qtestlitecursor.cpp delete mode 100644 src/plugins/platforms/xlib/qtestlitecursor.h delete mode 100644 src/plugins/platforms/xlib/qtestliteeglintegration.cpp delete mode 100644 src/plugins/platforms/xlib/qtestliteeglintegration.h delete mode 100644 src/plugins/platforms/xlib/qtestliteintegration.cpp delete mode 100644 src/plugins/platforms/xlib/qtestliteintegration.h delete mode 100644 src/plugins/platforms/xlib/qtestlitekeyboard.cpp delete mode 100644 src/plugins/platforms/xlib/qtestlitekeyboard.h delete mode 100644 src/plugins/platforms/xlib/qtestlitemime.cpp delete mode 100644 src/plugins/platforms/xlib/qtestlitemime.h delete mode 100644 src/plugins/platforms/xlib/qtestlitescreen.cpp delete mode 100644 src/plugins/platforms/xlib/qtestlitescreen.h delete mode 100644 src/plugins/platforms/xlib/qtestlitestaticinfo.cpp delete mode 100644 src/plugins/platforms/xlib/qtestlitestaticinfo.h delete mode 100644 src/plugins/platforms/xlib/qtestlitewindow.cpp delete mode 100644 src/plugins/platforms/xlib/qtestlitewindow.h delete mode 100644 src/plugins/platforms/xlib/qtestlitewindowsurface.cpp delete mode 100644 src/plugins/platforms/xlib/qtestlitewindowsurface.h create mode 100644 src/plugins/platforms/xlib/qxlibclipboard.cpp create mode 100644 src/plugins/platforms/xlib/qxlibclipboard.h create mode 100644 src/plugins/platforms/xlib/qxlibcursor.cpp create mode 100644 src/plugins/platforms/xlib/qxlibcursor.h create mode 100644 src/plugins/platforms/xlib/qxlibeglintegration.cpp create mode 100644 src/plugins/platforms/xlib/qxlibeglintegration.h create mode 100644 src/plugins/platforms/xlib/qxlibintegration.cpp create mode 100644 src/plugins/platforms/xlib/qxlibintegration.h create mode 100644 src/plugins/platforms/xlib/qxlibkeyboard.cpp create mode 100644 src/plugins/platforms/xlib/qxlibkeyboard.h create mode 100644 src/plugins/platforms/xlib/qxlibmime.cpp create mode 100644 src/plugins/platforms/xlib/qxlibmime.h create mode 100644 src/plugins/platforms/xlib/qxlibscreen.cpp create mode 100644 src/plugins/platforms/xlib/qxlibscreen.h create mode 100644 src/plugins/platforms/xlib/qxlibstatic.cpp create mode 100644 src/plugins/platforms/xlib/qxlibstatic.h create mode 100644 src/plugins/platforms/xlib/qxlibwindow.cpp create mode 100644 src/plugins/platforms/xlib/qxlibwindow.h create mode 100644 src/plugins/platforms/xlib/qxlibwindowsurface.cpp create mode 100644 src/plugins/platforms/xlib/qxlibwindowsurface.h delete mode 100644 src/plugins/platforms/xlib/testlite.pro create mode 100644 src/plugins/platforms/xlib/xlib.pro diff --git a/src/plugins/platforms/xlib/qtestliteclipboard.cpp b/src/plugins/platforms/xlib/qtestliteclipboard.cpp deleted file mode 100644 index 1264b5a..0000000 --- a/src/plugins/platforms/xlib/qtestliteclipboard.cpp +++ /dev/null @@ -1,676 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestliteclipboard.h" - -#include "qtestlitescreen.h" -#include "qtestlitemime.h" - -#include <private/qapplication_p.h> - -#include <QtCore/QDebug> - -class QXlibClipboardMime : public QXlibMime -{ - Q_OBJECT -public: - QXlibClipboardMime(QClipboard::Mode mode, QXlibClipboard *clipboard) - : QXlibMime() - , m_clipboard(clipboard) - { - switch (mode) { - case QClipboard::Selection: - modeAtom = XA_PRIMARY; - break; - - case QClipboard::Clipboard: - modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); - break; - - default: - qWarning("QTestLiteMime: Internal error: Unsupported clipboard mode"); - break; - } - } - -protected: - QStringList formats_sys() const - { - if (empty()) - return QStringList(); - - if (!formatList.count()) { - QXlibClipboardMime *that = const_cast<QXlibClipboardMime *>(this); - // get the list of targets from the current clipboard owner - we do this - // once so that multiple calls to this function don't require multiple - // server round trips... - that->format_atoms = m_clipboard->getDataInFormat(modeAtom,QXlibStatic::atom(QXlibStatic::TARGETS)); - - if (format_atoms.size() > 0) { - Atom *targets = (Atom *) format_atoms.data(); - int size = format_atoms.size() / sizeof(Atom); - - for (int i = 0; i < size; ++i) { - if (targets[i] == 0) - continue; - - QStringList formatsForAtom = mimeFormatsForAtom(m_clipboard->screen()->display(),targets[i]); - for (int j = 0; j < formatsForAtom.size(); ++j) { - if (!formatList.contains(formatsForAtom.at(j))) - that->formatList.append(formatsForAtom.at(j)); - } - } - } - } - - return formatList; - } - - bool hasFormat_sys(const QString &format) const - { - QStringList list = formats(); - return list.contains(format); - } - - QVariant retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const - { - if (fmt.isEmpty() || empty()) - return QByteArray(); - - (void)formats(); // trigger update of format list - - QList<Atom> atoms; - Atom *targets = (Atom *) format_atoms.data(); - int size = format_atoms.size() / sizeof(Atom); - for (int i = 0; i < size; ++i) - atoms.append(targets[i]); - - QByteArray encoding; - Atom fmtatom = mimeAtomForFormat(m_clipboard->screen()->display(),fmt, requestedType, atoms, &encoding); - - if (fmtatom == 0) - return QVariant(); - - return mimeConvertToFormat(m_clipboard->screen()->display(),fmtatom, m_clipboard->getDataInFormat(modeAtom,fmtatom), fmt, requestedType, encoding); - } -private: - bool empty() const - { - Window win = XGetSelectionOwner(m_clipboard->screen()->display(), modeAtom); - - return win == XNone; - } - - - Atom modeAtom; - QXlibClipboard *m_clipboard; - QStringList formatList; - QByteArray format_atoms; -}; - -const int QXlibClipboard::clipboard_timeout = 5000; - -QXlibClipboard::QXlibClipboard(QXlibScreen *screen) - : QPlatformClipboard() - , m_screen(screen) - , m_xClipboard(0) - , m_clientClipboard(0) - , m_xSelection(0) - , m_clientSelection(0) - , m_requestor(XNone) - , m_owner(XNone) -{ -} - -const QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) const -{ - if (mode == QClipboard::Clipboard) { - if (!m_xClipboard) { - QXlibClipboard *that = const_cast<QXlibClipboard *>(this); - that->m_xClipboard = new QXlibClipboardMime(mode,that); - } - Window clipboardOwner = XGetSelectionOwner(screen()->display(),QXlibStatic::atom(QXlibStatic::CLIPBOARD)); - if (clipboardOwner == owner()) { - return m_clientClipboard; - } else { - return m_xClipboard; - } - } else if (mode == QClipboard::Selection) { - if (!m_xSelection) { - QXlibClipboard *that = const_cast<QXlibClipboard *>(this); - that->m_xSelection = new QXlibClipboardMime(mode,that); - } - Window clipboardOwner = XGetSelectionOwner(screen()->display(),XA_PRIMARY); - if (clipboardOwner == owner()) { - return m_clientSelection; - } else { - return m_xSelection; - } - } - return 0; -} - -void QXlibClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) -{ - Atom modeAtom; - QMimeData **d; - switch (mode) { - case QClipboard::Selection: - modeAtom = XA_PRIMARY; - d = &m_clientSelection; - break; - - case QClipboard::Clipboard: - modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); - d = &m_clientClipboard; - break; - - default: - qWarning("QClipboard::setMimeData: unsupported mode '%d'", mode); - return; - } - - Window newOwner; - - if (! data) { // no data, clear clipboard contents - newOwner = XNone; - } else { - newOwner = owner(); - - *d = data; - } - - XSetSelectionOwner(m_screen->display(), modeAtom, newOwner, CurrentTime); - - if (XGetSelectionOwner(m_screen->display(), modeAtom) != newOwner) { - qWarning("QClipboard::setData: Cannot set X11 selection owner"); - } - -} - -bool QXlibClipboard::supportsMode(QClipboard::Mode mode) const -{ - if (mode == QClipboard::Clipboard || mode == QClipboard::Selection) - return true; - return false; -} - - -QXlibScreen * QXlibClipboard::screen() const -{ - return m_screen; -} - -Window QXlibClipboard::requestor() const -{ - if (!m_requestor) { - int x = 0, y = 0, w = 3, h = 3; - QXlibClipboard *that = const_cast<QXlibClipboard *>(this); - Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), - x, y, w, h, 0 /*border_width*/, - m_screen->blackPixel(), m_screen->whitePixel()); - that->setRequestor(window); - } - return m_requestor; -} - -void QXlibClipboard::setRequestor(Window window) -{ - if (m_requestor != XNone) { - XDestroyWindow(m_screen->display(),m_requestor); - } - m_requestor = window; -} - -Window QXlibClipboard::owner() const -{ - if (!m_owner) { - int x = 0, y = 0, w = 3, h = 3; - QXlibClipboard *that = const_cast<QXlibClipboard *>(this); - Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), - x, y, w, h, 0 /*border_width*/, - m_screen->blackPixel(), m_screen->whitePixel()); - that->setOwner(window); - } - return m_owner; -} - -void QXlibClipboard::setOwner(Window window) -{ - if (m_owner != XNone){ - XDestroyWindow(m_screen->display(),m_owner); - } - m_owner = window; -} - -Atom QXlibClipboard::sendTargetsSelection(QMimeData *d, Window window, Atom property) -{ - QVector<Atom> types; - QStringList formats = QInternalMimeData::formatsHelper(d); - for (int i = 0; i < formats.size(); ++i) { - QList<Atom> atoms = QXlibMime::mimeAtomsForFormat(screen()->display(),formats.at(i)); - for (int j = 0; j < atoms.size(); ++j) { - if (!types.contains(atoms.at(j))) - types.append(atoms.at(j)); - } - } - types.append(QXlibStatic::atom(QXlibStatic::TARGETS)); - types.append(QXlibStatic::atom(QXlibStatic::MULTIPLE)); - types.append(QXlibStatic::atom(QXlibStatic::TIMESTAMP)); - types.append(QXlibStatic::atom(QXlibStatic::SAVE_TARGETS)); - - XChangeProperty(screen()->display(), window, property, XA_ATOM, 32, - PropModeReplace, (uchar *) types.data(), types.size()); - return property; -} - -Atom QXlibClipboard::sendSelection(QMimeData *d, Atom target, Window window, Atom property) -{ - Atom atomFormat = target; - int dataFormat = 0; - QByteArray data; - - QString fmt = QXlibMime::mimeAtomToString(screen()->display(), target); - if (fmt.isEmpty()) { // Not a MIME type we have - qDebug() << "QClipboard: send_selection(): converting to type '%s' is not supported" << fmt.data(); - return XNone; - } - qDebug() << "QClipboard: send_selection(): converting to type '%s'" << fmt.data(); - - if (QXlibMime::mimeDataForAtom(screen()->display(),target, d, &data, &atomFormat, &dataFormat)) { - - // don't allow INCR transfers when using MULTIPLE or to - // Motif clients (since Motif doesn't support INCR) - static Atom motif_clip_temporary = QXlibStatic::atom(QXlibStatic::CLIP_TEMPORARY); - bool allow_incr = property != motif_clip_temporary; - - // X_ChangeProperty protocol request is 24 bytes - const int increment = (XMaxRequestSize(screen()->display()) * 4) - 24; - if (data.size() > increment && allow_incr) { - long bytes = data.size(); - XChangeProperty(screen()->display(), window, property, - QXlibStatic::atom(QXlibStatic::INCR), 32, PropModeReplace, (uchar *) &bytes, 1); - -// (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment); - qDebug() << "not implemented INCRT just YET!"; - return property; - } - - // make sure we can perform the XChangeProperty in a single request - if (data.size() > increment) - return XNone; // ### perhaps use several XChangeProperty calls w/ PropModeAppend? - int dataSize = data.size() / (dataFormat / 8); - // use a single request to transfer data - XChangeProperty(screen()->display(), window, property, atomFormat, - dataFormat, PropModeReplace, (uchar *) data.data(), - dataSize); - } - return property; -} - -void QXlibClipboard::handleSelectionRequest(XEvent *xevent) -{ - XSelectionRequestEvent *req = &xevent->xselectionrequest; - - if (requestor() && req->requestor == requestor()) { - qDebug() << "This should be caught before"; - return; - } - - XEvent event; - event.xselection.type = SelectionNotify; - event.xselection.display = req->display; - event.xselection.requestor = req->requestor; - event.xselection.selection = req->selection; - event.xselection.target = req->target; - event.xselection.property = XNone; - event.xselection.time = req->time; - - QMimeData *d; - if (req->selection == XA_PRIMARY) { - d = m_clientSelection; - } else if (req->selection == QXlibStatic::atom(QXlibStatic::CLIPBOARD)) { - d = m_clientClipboard; - } else { - qWarning("QClipboard: Unknown selection '%lx'", req->selection); - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); - return; - } - - if (!d) { - qWarning("QClipboard: Cannot transfer data, no data available"); - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); - return; - } - - Atom xa_targets = QXlibStatic::atom(QXlibStatic::TARGETS); - Atom xa_multiple = QXlibStatic::atom(QXlibStatic::MULTIPLE); - Atom xa_timestamp = QXlibStatic::atom(QXlibStatic::TIMESTAMP); - - struct AtomPair { Atom target; Atom property; } *multi = 0; - Atom multi_type = XNone; - int multi_format = 0; - int nmulti = 0; - int imulti = -1; - bool multi_writeback = false; - - if (req->target == xa_multiple) { - QByteArray multi_data; - if (req->property == XNone - || !clipboardReadProperty(req->requestor, req->property, false, &multi_data, - 0, &multi_type, &multi_format) - || multi_format != 32) { - // MULTIPLE property not formatted correctly - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); - return; - } - nmulti = multi_data.size()/sizeof(*multi); - multi = new AtomPair[nmulti]; - memcpy(multi,multi_data.data(),multi_data.size()); - imulti = 0; - } - - for (; imulti < nmulti; ++imulti) { - Atom target; - Atom property; - - if (multi) { - target = multi[imulti].target; - property = multi[imulti].property; - } else { - target = req->target; - property = req->property; - if (property == XNone) // obsolete client - property = target; - } - - Atom ret = XNone; - if (target == XNone || property == XNone) { - ; - } else if (target == xa_timestamp) { -// if (d->timestamp != CurrentTime) { -// XChangeProperty(screen()->display(), req->requestor, property, XA_INTEGER, 32, -// PropModeReplace, CurrentTime, 1); -// ret = property; -// } else { -// qWarning("QClipboard: Invalid data timestamp"); -// } - } else if (target == xa_targets) { - ret = sendTargetsSelection(d, req->requestor, property); - } else { - ret = sendSelection(d, target, req->requestor, property); - } - - if (nmulti > 0) { - if (ret == XNone) { - multi[imulti].property = XNone; - multi_writeback = true; - } - } else { - event.xselection.property = ret; - break; - } - } - - if (nmulti > 0) { - if (multi_writeback) { - // according to ICCCM 2.6.2 says to put None back - // into the original property on the requestor window - XChangeProperty(screen()->display(), req->requestor, req->property, multi_type, 32, - PropModeReplace, (uchar *) multi, nmulti * 2); - } - - delete [] multi; - event.xselection.property = req->property; - } - - // send selection notify to requestor - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); -} - -static inline int maxSelectionIncr(Display *dpy) -{ return XMaxRequestSize(dpy) > 65536 ? 65536*4 : XMaxRequestSize(dpy)*4 - 100; } - -bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const -{ - int maxsize = maxSelectionIncr(screen()->display()); - ulong bytes_left; // bytes_after - ulong length; // nitems - uchar *data; - Atom dummy_type; - int dummy_format; - int r; - - if (!type) // allow null args - type = &dummy_type; - if (!format) - format = &dummy_format; - - // Don't read anything, just get the size of the property data - r = XGetWindowProperty(screen()->display(), win, property, 0, 0, False, - AnyPropertyType, type, format, - &length, &bytes_left, &data); - if (r != Success || (type && *type == XNone)) { - buffer->resize(0); - return false; - } - XFree((char*)data); - - int offset = 0, buffer_offset = 0, format_inc = 1, proplen = bytes_left; - - switch (*format) { - case 8: - default: - format_inc = sizeof(char) / 1; - break; - - case 16: - format_inc = sizeof(short) / 2; - proplen *= sizeof(short) / 2; - break; - - case 32: - format_inc = sizeof(long) / 4; - proplen *= sizeof(long) / 4; - break; - } - - int newSize = proplen; - buffer->resize(newSize); - - bool ok = (buffer->size() == newSize); - - if (ok && newSize) { - // could allocate buffer - - while (bytes_left) { - // more to read... - - r = XGetWindowProperty(screen()->display(), win, property, offset, maxsize/4, - False, AnyPropertyType, type, format, - &length, &bytes_left, &data); - if (r != Success || (type && *type == XNone)) - break; - - offset += length / (32 / *format); - length *= format_inc * (*format) / 8; - - // Here we check if we get a buffer overflow and tries to - // recover -- this shouldn't normally happen, but it doesn't - // hurt to be defensive - if ((int)(buffer_offset + length) > buffer->size()) { - length = buffer->size() - buffer_offset; - - // escape loop - bytes_left = 0; - } - - memcpy(buffer->data() + buffer_offset, data, length); - buffer_offset += length; - - XFree((char*)data); - } - - if (*format == 8 && *type == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { - // convert COMPOUND_TEXT to a multibyte string - XTextProperty textprop; - textprop.encoding = *type; - textprop.format = *format; - textprop.nitems = buffer_offset; - textprop.value = (unsigned char *) buffer->data(); - - char **list_ret = 0; - int count; - if (XmbTextPropertyToTextList(screen()->display(), &textprop, &list_ret, - &count) == Success && count && list_ret) { - offset = buffer_offset = strlen(list_ret[0]); - buffer->resize(offset); - memcpy(buffer->data(), list_ret[0], offset); - } - if (list_ret) XFreeStringList(list_ret); - } - } - - // correct size, not 0-term. - if (size) - *size = buffer_offset; - - if (deleteProperty) - XDeleteProperty(screen()->display(), win, property); - - XFlush(screen()->display()); - - return ok; -} - -QByteArray QXlibClipboard::clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm) -{ - XEvent event; - - QByteArray buf; - QByteArray tmp_buf; - bool alloc_error = false; - int length; - int offset = 0; - - if (nbytes > 0) { - // Reserve buffer + zero-terminator (for text data) - // We want to complete the INCR transfer even if we cannot - // allocate more memory - buf.resize(nbytes+1); - alloc_error = buf.size() != nbytes+1; - } - - for (;;) { - XFlush(screen()->display()); - if (!screen()->waitForClipboardEvent(win,PropertyNotify,&event,clipboard_timeout)) - break; - if (event.xproperty.atom != property || - event.xproperty.state != PropertyNewValue) - continue; - if (clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0)) { - if (length == 0) { // no more data, we're done - if (nullterm) { - buf.resize(offset+1); - buf[offset] = '\0'; - } else { - buf.resize(offset); - } - return buf; - } else if (!alloc_error) { - if (offset+length > (int)buf.size()) { - buf.resize(offset+length+65535); - if (buf.size() != offset+length+65535) { - alloc_error = true; - length = buf.size() - offset; - } - } - memcpy(buf.data()+offset, tmp_buf.constData(), length); - tmp_buf.resize(0); - offset += length; - } - } else { - break; - } - } - - // timed out ... create a new requestor window, otherwise the requestor - // could consider next request to be still part of this timed out request - setRequestor(0); - - return QByteArray(); -} - -QByteArray QXlibClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) -{ - QByteArray buf; - - Window win = requestor(); - - XSelectInput(screen()->display(), win, NoEventMask); // don't listen for any events - - XDeleteProperty(screen()->display(), win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION)); - XConvertSelection(screen()->display(), modeAtom, fmtatom, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), win, CurrentTime); - XSync(screen()->display(), false); - - XEvent xevent; - if (!screen()->waitForClipboardEvent(win,SelectionNotify,&xevent,clipboard_timeout) || - xevent.xselection.property == XNone) { - return buf; - } - - Atom type; - XSelectInput(screen()->display(), win, PropertyChangeMask); - - if (clipboardReadProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), true, &buf, 0, &type, 0)) { - if (type == QXlibStatic::atom(QXlibStatic::INCR)) { - int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0; - buf = clipboardReadIncrementalProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), nbytes, false); - } - } - - XSelectInput(screen()->display(), win, NoEventMask); - - - return buf; -} - -#include "qtestliteclipboard.moc" diff --git a/src/plugins/platforms/xlib/qtestliteclipboard.h b/src/plugins/platforms/xlib/qtestliteclipboard.h deleted file mode 100644 index 109714c..0000000 --- a/src/plugins/platforms/xlib/qtestliteclipboard.h +++ /dev/null @@ -1,94 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITECLIPBOARD_H -#define QTESTLITECLIPBOARD_H - -#include <QPlatformClipboard> -#include "qtestlitestaticinfo.h" - -class QXlibScreen; -class QXlibClipboard : public QPlatformClipboard -{ -public: - QXlibClipboard(QXlibScreen *screen); - - const QMimeData *mimeData(QClipboard::Mode mode) const; - void setMimeData(QMimeData *data, QClipboard::Mode mode); - - bool supportsMode(QClipboard::Mode mode) const; - - QXlibScreen *screen() const; - - Window requestor() const; - void setRequestor(Window window); - - Window owner() const; - - void handleSelectionRequest(XEvent *event); - - bool clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const; - QByteArray clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm); - - QByteArray getDataInFormat(Atom modeAtom, Atom fmtatom); - -private: - void setOwner(Window window); - - Atom sendTargetsSelection(QMimeData *d, Window window, Atom property); - Atom sendSelection(QMimeData *d, Atom target, Window window, Atom property); - - QXlibScreen *m_screen; - - QMimeData *m_xClipboard; - QMimeData *m_clientClipboard; - - QMimeData *m_xSelection; - QMimeData *m_clientSelection; - - Window m_requestor; - Window m_owner; - - static const int clipboard_timeout; - -}; - -#endif // QTESTLITECLIPBOARD_H diff --git a/src/plugins/platforms/xlib/qtestlitecursor.cpp b/src/plugins/platforms/xlib/qtestlitecursor.cpp deleted file mode 100644 index 2f7cfbf..0000000 --- a/src/plugins/platforms/xlib/qtestlitecursor.cpp +++ /dev/null @@ -1,199 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitecursor.h" - -#include "qtestliteintegration.h" -#include "qtestlitescreen.h" -#include "qtestlitewindow.h" - -#include <QtGui/QBitmap> - -#include <X11/cursorfont.h> - -QT_BEGIN_NAMESPACE - -QXlibCursor::QXlibCursor(QXlibScreen *screen) - : QPlatformCursor(screen) -{ -} - -void QXlibCursor::changeCursor(QCursor *cursor, QWidget *widget) -{ - QXlibWindow *w = 0; - if (widget) { - QWidget *window = widget->window(); - w = static_cast<QXlibWindow*>(window->platformWindow()); - } else { - // No X11 cursor control when there is no widget under the cursor - return; - } - - if (!w) - return; - - int id = cursor->handle(); - - Cursor c; - if (!cursorMap.contains(id)) { - if (cursor->shape() == Qt::BitmapCursor) - c = createCursorBitmap(cursor); - else - c = createCursorShape(cursor->shape()); - if (!c) { - return; - } - cursorMap.insert(id, c); - } else { - c = cursorMap.value(id); - } - - w->setCursor(c); -} - -Cursor QXlibCursor::createCursorBitmap(QCursor * cursor) -{ - XColor bg, fg; - bg.red = 255 << 8; - bg.green = 255 << 8; - bg.blue = 255 << 8; - fg.red = 0; - fg.green = 0; - fg.blue = 0; - QPoint spot = cursor->hotSpot(); - Window rootwin = testLiteScreen()->rootWindow(); - - QImage mapImage = cursor->bitmap()->toImage().convertToFormat(QImage::Format_MonoLSB); - QImage maskImage = cursor->mask()->toImage().convertToFormat(QImage::Format_MonoLSB); - - int width = cursor->bitmap()->width(); - int height = cursor->bitmap()->height(); - int bytesPerLine = mapImage.bytesPerLine(); - int destLineSize = width / 8; - if (width % 8) - destLineSize++; - - const uchar * map = mapImage.bits(); - const uchar * mask = maskImage.bits(); - - char * mapBits = new char[height * destLineSize]; - char * maskBits = new char[height * destLineSize]; - for (int i = 0; i < height; i++) { - memcpy(mapBits + (destLineSize * i),map + (bytesPerLine * i), destLineSize); - memcpy(maskBits + (destLineSize * i),mask + (bytesPerLine * i), destLineSize); - } - - Pixmap cp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, mapBits, width, height); - Pixmap mp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, maskBits, width, height); - Cursor c = XCreatePixmapCursor(testLiteScreen()->display(), cp, mp, &fg, &bg, spot.x(), spot.y()); - XFreePixmap(testLiteScreen()->display(), cp); - XFreePixmap(testLiteScreen()->display(), mp); - delete[] mapBits; - delete[] maskBits; - - return c; -} - -Cursor QXlibCursor::createCursorShape(int cshape) -{ - Cursor cursor = 0; - - if (cshape < 0 || cshape > Qt::LastCursor) - return 0; - - switch (cshape) { - case Qt::ArrowCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_left_ptr); - break; - case Qt::UpArrowCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_center_ptr); - break; - case Qt::CrossCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_crosshair); - break; - case Qt::WaitCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); - break; - case Qt::IBeamCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_xterm); - break; - case Qt::SizeAllCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_fleur); - break; - case Qt::PointingHandCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_hand2); - break; - case Qt::SizeBDiagCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_top_right_corner); - break; - case Qt::SizeFDiagCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_bottom_right_corner); - break; - case Qt::SizeVerCursor: - case Qt::SplitVCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_v_double_arrow); - break; - case Qt::SizeHorCursor: - case Qt::SplitHCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_h_double_arrow); - break; - case Qt::WhatsThisCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_question_arrow); - break; - case Qt::ForbiddenCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_circle); - break; - case Qt::BusyCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); - break; - - default: //default cursor for all the rest - break; - } - return cursor; -} - -QXlibScreen * QXlibCursor::testLiteScreen() const -{ - return static_cast<QXlibScreen *>(screen); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qtestlitecursor.h b/src/plugins/platforms/xlib/qtestlitecursor.h deleted file mode 100644 index db9f9e2..0000000 --- a/src/plugins/platforms/xlib/qtestlitecursor.h +++ /dev/null @@ -1,68 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITECURSOR_H -#define QTESTLITECURSOR_H - -#include <QtGui/QPlatformCursor> - -#include "qtestliteintegration.h" - -QT_BEGIN_NAMESPACE - -class QXlibCursor : QPlatformCursor -{ -public: - QXlibCursor(QXlibScreen *screen); - - void changeCursor(QCursor * cursor, QWidget * widget); -private: - - Cursor createCursorBitmap(QCursor * cursor); - Cursor createCursorShape(int cshape); - - QXlibScreen *testLiteScreen() const; - QMap<int, Cursor> cursorMap; -}; - -QT_END_NAMESPACE - -#endif // QTESTLITECURSOR_H diff --git a/src/plugins/platforms/xlib/qtestliteeglintegration.cpp b/src/plugins/platforms/xlib/qtestliteeglintegration.cpp deleted file mode 100644 index 9bbe0ca..0000000 --- a/src/plugins/platforms/xlib/qtestliteeglintegration.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestliteeglintegration.h" - -static int countBits(unsigned long mask) -{ - int count = 0; - while (mask != 0) { - if (mask & 1) - ++count; - mask >>= 1; - } - return count; -} - -VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLConfig config) -{ - VisualID visualId = 0; - EGLint eglValue = 0; - - EGLDisplay eglDisplay = eglGetDisplay(display); - - EGLint configRedSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_RED_SIZE, &configRedSize); - - EGLint configGreenSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_GREEN_SIZE, &configGreenSize); - - EGLint configBlueSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_BLUE_SIZE, &configBlueSize); - - EGLint configAlphaSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_ALPHA_SIZE, &configAlphaSize); - - eglGetConfigAttrib(eglDisplay, config, EGL_CONFIG_ID, &eglValue); - int configId = eglValue; - - // See if EGL provided a valid VisualID: - eglGetConfigAttrib(eglDisplay, config, EGL_NATIVE_VISUAL_ID, &eglValue); - visualId = (VisualID)eglValue; - if (visualId) { - // EGL has suggested a visual id, so get the rest of the visual info for that id: - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - visualInfoTemplate.visualid = visualId; - - XVisualInfo *chosenVisualInfo; - int matchingCount = 0; - chosenVisualInfo = XGetVisualInfo(display, VisualIDMask, &visualInfoTemplate, &matchingCount); - if (chosenVisualInfo) { - // Skip size checks if implementation supports non-matching visual - // and config (http://bugreports.qt.nokia.com/browse/QTBUG-9444). - if (q_hasEglExtension(eglDisplay,"EGL_NV_post_convert_rounding")) { - XFree(chosenVisualInfo); - return visualId; - } - - int visualRedSize = countBits(chosenVisualInfo->red_mask); - int visualGreenSize = countBits(chosenVisualInfo->green_mask); - int visualBlueSize = countBits(chosenVisualInfo->blue_mask); - int visualAlphaSize = -1; // Need XRender to tell us the alpha channel size - - bool visualMatchesConfig = false; - if ( visualRedSize == configRedSize && - visualGreenSize == configGreenSize && - visualBlueSize == configBlueSize ) - { - // We need XRender to check the alpha channel size of the visual. If we don't have - // the alpha size, we don't check it against the EGL config's alpha size. - if (visualAlphaSize >= 0) - visualMatchesConfig = visualAlphaSize == configAlphaSize; - else - visualMatchesConfig = true; - } - - if (!visualMatchesConfig) { - if (visualAlphaSize >= 0) { - qWarning("Warning: EGL suggested using X Visual ID %d (ARGB%d%d%d%d) for EGL config %d (ARGB%d%d%d%d), but this is incompatable", - (int)visualId, visualAlphaSize, visualRedSize, visualGreenSize, visualBlueSize, - configId, configAlphaSize, configRedSize, configGreenSize, configBlueSize); - } else { - qWarning("Warning: EGL suggested using X Visual ID %d (RGB%d%d%d) for EGL config %d (RGB%d%d%d), but this is incompatable", - (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, - configId, configRedSize, configGreenSize, configBlueSize); - } - visualId = 0; - } - } else { - qWarning("Warning: EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", - (int)visualId, configId); - visualId = 0; - } - XFree(chosenVisualInfo); - } -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - else - qDebug("EGL did not suggest a VisualID (EGL_NATIVE_VISUAL_ID was zero) for EGLConfig %d", configId); -#endif - - if (visualId) { -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - if (configAlphaSize > 0) - qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, configId); - else - qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId); -#endif - return visualId; - } - - // Finally, try to - // use XGetVisualInfo and only use the bit depths to match on: - if (!visualId) { - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - XVisualInfo *matchingVisuals; - int matchingCount = 0; - - visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize + configAlphaSize; - matchingVisuals = XGetVisualInfo(display, - VisualDepthMask, - &visualInfoTemplate, - &matchingCount); - if (!matchingVisuals) { - // Try again without taking the alpha channel into account: - visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize; - matchingVisuals = XGetVisualInfo(display, - VisualDepthMask, - &visualInfoTemplate, - &matchingCount); - } - - if (matchingVisuals) { - visualId = matchingVisuals[0].visualid; - XFree(matchingVisuals); - } - } - - if (visualId) { -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, configId); -#endif - return visualId; - } - - qWarning("Unable to find an X11 visual which matches EGL config %d", configId); - return (VisualID)0; -} diff --git a/src/plugins/platforms/xlib/qtestliteeglintegration.h b/src/plugins/platforms/xlib/qtestliteeglintegration.h deleted file mode 100644 index 4c2e50d..0000000 --- a/src/plugins/platforms/xlib/qtestliteeglintegration.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITEEGLINTEGRATION_H -#define QTESTLITEEGLINTEGRATION_H - -#include "qtestlitestaticinfo.h" -#include "../eglconvenience/qeglconvenience.h" - -class QXlibEglIntegration -{ -public: - static VisualID getCompatibleVisualId(Display *display, EGLConfig config); -}; - -#endif // QTESTLITEEGLINTEGRATION_H diff --git a/src/plugins/platforms/xlib/qtestliteintegration.cpp b/src/plugins/platforms/xlib/qtestliteintegration.cpp deleted file mode 100644 index cdc5c29..0000000 --- a/src/plugins/platforms/xlib/qtestliteintegration.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestliteintegration.h" -#include "qtestlitewindowsurface.h" -#include <QtGui/private/qpixmap_raster_p.h> -#include <QtCore/qdebug.h> - -#include "qtestlitewindow.h" -#include "qgenericunixfontdatabase.h" -#include "qtestlitescreen.h" -#include "qtestliteclipboard.h" - -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) -#include <GL/glx.h> -#else -#include <EGL/egl.h> -#endif //!defined(QT_OPENGL_ES_2) -#include <private/qwindowsurface_gl_p.h> -#include <private/qpixmapdata_gl_p.h> -#endif //QT_NO_OPENGL - -QT_BEGIN_NAMESPACE - -QXlibIntegration::QXlibIntegration(bool useOpenGL) - : mUseOpenGL(useOpenGL) - , mFontDb(new QGenericUnixFontDatabase()) - , mClipboard(0) -{ - mPrimaryScreen = new QXlibScreen(); - mScreens.append(mPrimaryScreen); -} - -QPixmapData *QXlibIntegration::createPixmapData(QPixmapData::PixelType type) const -{ -#ifndef QT_NO_OPENGL - if (mUseOpenGL) - return new QGLPixmapData(type); -#endif - return new QRasterPixmapData(type); -} - -QWindowSurface *QXlibIntegration::createWindowSurface(QWidget *widget, WId) const -{ -#ifndef QT_NO_OPENGL - if (mUseOpenGL) - return new QGLWindowSurface(widget); -#endif - return new QXlibWindowSurface(widget); -} - - -QPlatformWindow *QXlibIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const -{ - return new QXlibWindow(widget); -} - - - -QPixmap QXlibIntegration::grabWindow(WId window, int x, int y, int width, int height) const -{ - QImage image; - QWidget *widget = QWidget::find(window); - if (widget) { - QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); - image = screen->grabWindow(window,x,y,width,height); - } else { - for (int i = 0; i < mScreens.size(); i++) { - QXlibScreen *screen = static_cast<QXlibScreen *>(mScreens[i]); - if (screen->rootWindow() == window) { - image = screen->grabWindow(window,x,y,width,height); - } - } - } - return QPixmap::fromImage(image); -} - -QPlatformFontDatabase *QXlibIntegration::fontDatabase() const -{ - return mFontDb; -} - -QPlatformClipboard * QXlibIntegration::clipboard() const -{ - //Use lazy init since clipboard needs QTestliteScreen - if (!mClipboard) { - QXlibIntegration *that = const_cast<QXlibIntegration *>(this); - that->mClipboard = new QXlibClipboard(mPrimaryScreen); - } - return mClipboard; -} - -bool QXlibIntegration::hasOpenGL() const -{ -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) - QXlibScreen *screen = static_cast<const QXlibScreen *>(mScreens.at(0)); - return glXQueryExtension(screen->display(), 0, 0) != 0; -#else - static bool eglHasbeenInitialized = false; - static bool wasEglInitialized = false; - if (!eglHasbeenInitialized) { - eglHasbeenInitialized = true; - const QXlibScreen *screen = static_cast<const QXlibScreen *>(mScreens.at(0)); - EGLint major, minor; - eglBindAPI(EGL_OPENGL_ES_API); - EGLDisplay disp = eglGetDisplay(screen->display()); - wasEglInitialized = eglInitialize(disp,&major,&minor); - } - return wasEglInitialized; -#endif -#endif - return false; -} - - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qtestliteintegration.h b/src/plugins/platforms/xlib/qtestliteintegration.h deleted file mode 100644 index c3125b8..0000000 --- a/src/plugins/platforms/xlib/qtestliteintegration.h +++ /dev/null @@ -1,85 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QGRAPHICSSYSTEM_TESTLITE_H -#define QGRAPHICSSYSTEM_TESTLITE_H - -//make sure textstream is included before any X11 headers -#include <QtCore/QTextStream> - -#include <QtGui/QPlatformIntegration> -#include <QtGui/QPlatformScreen> - -#include "qtestlitestaticinfo.h" - -QT_BEGIN_NAMESPACE - -class QXlibScreen; - -class QXlibIntegration : public QPlatformIntegration -{ -public: - QXlibIntegration(bool useOpenGL = false); - - QPixmapData *createPixmapData(QPixmapData::PixelType type) const; - QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; - QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; - - QPixmap grabWindow(WId window, int x, int y, int width, int height) const; - - QList<QPlatformScreen *> screens() const { return mScreens; } - - QPlatformFontDatabase *fontDatabase() const; - QPlatformClipboard *clipboard() const; - - bool hasOpenGL() const; - -private: - bool mUseOpenGL; - QXlibScreen *mPrimaryScreen; - QList<QPlatformScreen *> mScreens; - QPlatformFontDatabase *mFontDb; - QPlatformClipboard *mClipboard; -}; - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/xlib/qtestlitekeyboard.cpp b/src/plugins/platforms/xlib/qtestlitekeyboard.cpp deleted file mode 100644 index fb0cf2e..0000000 --- a/src/plugins/platforms/xlib/qtestlitekeyboard.cpp +++ /dev/null @@ -1,1000 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitekeyboard.h" - -#include "qtestlitescreen.h" - -#include <QtGui/QWindowSystemInterface> - -#include <QtCore/QTextCodec> - -#ifndef XK_ISO_Left_Tab -#define XK_ISO_Left_Tab 0xFE20 -#endif - -#ifndef XK_dead_hook -#define XK_dead_hook 0xFE61 -#endif - -#ifndef XK_dead_horn -#define XK_dead_horn 0xFE62 -#endif - -#ifndef XK_Codeinput -#define XK_Codeinput 0xFF37 -#endif - -#ifndef XK_Kanji_Bangou -#define XK_Kanji_Bangou 0xFF37 /* same as codeinput */ -#endif - -// Fix old X libraries -#ifndef XK_KP_Home -#define XK_KP_Home 0xFF95 -#endif -#ifndef XK_KP_Left -#define XK_KP_Left 0xFF96 -#endif -#ifndef XK_KP_Up -#define XK_KP_Up 0xFF97 -#endif -#ifndef XK_KP_Right -#define XK_KP_Right 0xFF98 -#endif -#ifndef XK_KP_Down -#define XK_KP_Down 0xFF99 -#endif -#ifndef XK_KP_Prior -#define XK_KP_Prior 0xFF9A -#endif -#ifndef XK_KP_Next -#define XK_KP_Next 0xFF9B -#endif -#ifndef XK_KP_End -#define XK_KP_End 0xFF9C -#endif -#ifndef XK_KP_Insert -#define XK_KP_Insert 0xFF9E -#endif -#ifndef XK_KP_Delete -#define XK_KP_Delete 0xFF9F -#endif - -// the next lines are taken on 10/2009 from X.org (X11/XF86keysym.h), defining some special -// multimedia keys. They are included here as not every system has them. -#define XF86XK_MonBrightnessUp 0x1008FF02 -#define XF86XK_MonBrightnessDown 0x1008FF03 -#define XF86XK_KbdLightOnOff 0x1008FF04 -#define XF86XK_KbdBrightnessUp 0x1008FF05 -#define XF86XK_KbdBrightnessDown 0x1008FF06 -#define XF86XK_Standby 0x1008FF10 -#define XF86XK_AudioLowerVolume 0x1008FF11 -#define XF86XK_AudioMute 0x1008FF12 -#define XF86XK_AudioRaiseVolume 0x1008FF13 -#define XF86XK_AudioPlay 0x1008FF14 -#define XF86XK_AudioStop 0x1008FF15 -#define XF86XK_AudioPrev 0x1008FF16 -#define XF86XK_AudioNext 0x1008FF17 -#define XF86XK_HomePage 0x1008FF18 -#define XF86XK_Mail 0x1008FF19 -#define XF86XK_Start 0x1008FF1A -#define XF86XK_Search 0x1008FF1B -#define XF86XK_AudioRecord 0x1008FF1C -#define XF86XK_Calculator 0x1008FF1D -#define XF86XK_Memo 0x1008FF1E -#define XF86XK_ToDoList 0x1008FF1F -#define XF86XK_Calendar 0x1008FF20 -#define XF86XK_PowerDown 0x1008FF21 -#define XF86XK_ContrastAdjust 0x1008FF22 -#define XF86XK_Back 0x1008FF26 -#define XF86XK_Forward 0x1008FF27 -#define XF86XK_Stop 0x1008FF28 -#define XF86XK_Refresh 0x1008FF29 -#define XF86XK_PowerOff 0x1008FF2A -#define XF86XK_WakeUp 0x1008FF2B -#define XF86XK_Eject 0x1008FF2C -#define XF86XK_ScreenSaver 0x1008FF2D -#define XF86XK_WWW 0x1008FF2E -#define XF86XK_Sleep 0x1008FF2F -#define XF86XK_Favorites 0x1008FF30 -#define XF86XK_AudioPause 0x1008FF31 -#define XF86XK_AudioMedia 0x1008FF32 -#define XF86XK_MyComputer 0x1008FF33 -#define XF86XK_LightBulb 0x1008FF35 -#define XF86XK_Shop 0x1008FF36 -#define XF86XK_History 0x1008FF37 -#define XF86XK_OpenURL 0x1008FF38 -#define XF86XK_AddFavorite 0x1008FF39 -#define XF86XK_HotLinks 0x1008FF3A -#define XF86XK_BrightnessAdjust 0x1008FF3B -#define XF86XK_Finance 0x1008FF3C -#define XF86XK_Community 0x1008FF3D -#define XF86XK_AudioRewind 0x1008FF3E -#define XF86XK_BackForward 0x1008FF3F -#define XF86XK_Launch0 0x1008FF40 -#define XF86XK_Launch1 0x1008FF41 -#define XF86XK_Launch2 0x1008FF42 -#define XF86XK_Launch3 0x1008FF43 -#define XF86XK_Launch4 0x1008FF44 -#define XF86XK_Launch5 0x1008FF45 -#define XF86XK_Launch6 0x1008FF46 -#define XF86XK_Launch7 0x1008FF47 -#define XF86XK_Launch8 0x1008FF48 -#define XF86XK_Launch9 0x1008FF49 -#define XF86XK_LaunchA 0x1008FF4A -#define XF86XK_LaunchB 0x1008FF4B -#define XF86XK_LaunchC 0x1008FF4C -#define XF86XK_LaunchD 0x1008FF4D -#define XF86XK_LaunchE 0x1008FF4E -#define XF86XK_LaunchF 0x1008FF4F -#define XF86XK_ApplicationLeft 0x1008FF50 -#define XF86XK_ApplicationRight 0x1008FF51 -#define XF86XK_Book 0x1008FF52 -#define XF86XK_CD 0x1008FF53 -#define XF86XK_Calculater 0x1008FF54 -#define XF86XK_Clear 0x1008FF55 -#define XF86XK_ClearGrab 0x1008FE21 -#define XF86XK_Close 0x1008FF56 -#define XF86XK_Copy 0x1008FF57 -#define XF86XK_Cut 0x1008FF58 -#define XF86XK_Display 0x1008FF59 -#define XF86XK_DOS 0x1008FF5A -#define XF86XK_Documents 0x1008FF5B -#define XF86XK_Excel 0x1008FF5C -#define XF86XK_Explorer 0x1008FF5D -#define XF86XK_Game 0x1008FF5E -#define XF86XK_Go 0x1008FF5F -#define XF86XK_iTouch 0x1008FF60 -#define XF86XK_LogOff 0x1008FF61 -#define XF86XK_Market 0x1008FF62 -#define XF86XK_Meeting 0x1008FF63 -#define XF86XK_MenuKB 0x1008FF65 -#define XF86XK_MenuPB 0x1008FF66 -#define XF86XK_MySites 0x1008FF67 -#define XF86XK_News 0x1008FF69 -#define XF86XK_OfficeHome 0x1008FF6A -#define XF86XK_Option 0x1008FF6C -#define XF86XK_Paste 0x1008FF6D -#define XF86XK_Phone 0x1008FF6E -#define XF86XK_Reply 0x1008FF72 -#define XF86XK_Reload 0x1008FF73 -#define XF86XK_RotateWindows 0x1008FF74 -#define XF86XK_RotationPB 0x1008FF75 -#define XF86XK_RotationKB 0x1008FF76 -#define XF86XK_Save 0x1008FF77 -#define XF86XK_Send 0x1008FF7B -#define XF86XK_Spell 0x1008FF7C -#define XF86XK_SplitScreen 0x1008FF7D -#define XF86XK_Support 0x1008FF7E -#define XF86XK_TaskPane 0x1008FF7F -#define XF86XK_Terminal 0x1008FF80 -#define XF86XK_Tools 0x1008FF81 -#define XF86XK_Travel 0x1008FF82 -#define XF86XK_Video 0x1008FF87 -#define XF86XK_Word 0x1008FF89 -#define XF86XK_Xfer 0x1008FF8A -#define XF86XK_ZoomIn 0x1008FF8B -#define XF86XK_ZoomOut 0x1008FF8C -#define XF86XK_Away 0x1008FF8D -#define XF86XK_Messenger 0x1008FF8E -#define XF86XK_WebCam 0x1008FF8F -#define XF86XK_MailForward 0x1008FF90 -#define XF86XK_Pictures 0x1008FF91 -#define XF86XK_Music 0x1008FF92 -#define XF86XK_Battery 0x1008FF93 -#define XF86XK_Bluetooth 0x1008FF94 -#define XF86XK_WLAN 0x1008FF95 -#define XF86XK_UWB 0x1008FF96 -#define XF86XK_AudioForward 0x1008FF97 -#define XF86XK_AudioRepeat 0x1008FF98 -#define XF86XK_AudioRandomPlay 0x1008FF99 -#define XF86XK_Subtitle 0x1008FF9A -#define XF86XK_AudioCycleTrack 0x1008FF9B -#define XF86XK_Time 0x1008FF9F -#define XF86XK_Select 0x1008FFA0 -#define XF86XK_View 0x1008FFA1 -#define XF86XK_TopMenu 0x1008FFA2 -#define XF86XK_Suspend 0x1008FFA7 -#define XF86XK_Hibernate 0x1008FFA8 - - -// end of XF86keysyms.h - -// Special keys used by Qtopia, mapped into the X11 private keypad range. -#define QTOPIAXK_Select 0x11000601 -#define QTOPIAXK_Yes 0x11000602 -#define QTOPIAXK_No 0x11000603 -#define QTOPIAXK_Cancel 0x11000604 -#define QTOPIAXK_Printer 0x11000605 -#define QTOPIAXK_Execute 0x11000606 -#define QTOPIAXK_Sleep 0x11000607 -#define QTOPIAXK_Play 0x11000608 -#define QTOPIAXK_Zoom 0x11000609 -#define QTOPIAXK_Context1 0x1100060A -#define QTOPIAXK_Context2 0x1100060B -#define QTOPIAXK_Context3 0x1100060C -#define QTOPIAXK_Context4 0x1100060D -#define QTOPIAXK_Call 0x1100060E -#define QTOPIAXK_Hangup 0x1100060F -#define QTOPIAXK_Flip 0x11000610 - -// keyboard mapping table -static const unsigned int KeyTbl[] = { - - // misc keys - - XK_Escape, Qt::Key_Escape, - XK_Tab, Qt::Key_Tab, - XK_ISO_Left_Tab, Qt::Key_Backtab, - XK_BackSpace, Qt::Key_Backspace, - XK_Return, Qt::Key_Return, - XK_Insert, Qt::Key_Insert, - XK_Delete, Qt::Key_Delete, - XK_Clear, Qt::Key_Delete, - XK_Pause, Qt::Key_Pause, - XK_Print, Qt::Key_Print, - 0x1005FF60, Qt::Key_SysReq, // hardcoded Sun SysReq - 0x1007ff00, Qt::Key_SysReq, // hardcoded X386 SysReq - - // cursor movement - - XK_Home, Qt::Key_Home, - XK_End, Qt::Key_End, - XK_Left, Qt::Key_Left, - XK_Up, Qt::Key_Up, - XK_Right, Qt::Key_Right, - XK_Down, Qt::Key_Down, - XK_Prior, Qt::Key_PageUp, - XK_Next, Qt::Key_PageDown, - - // modifiers - - XK_Shift_L, Qt::Key_Shift, - XK_Shift_R, Qt::Key_Shift, - XK_Shift_Lock, Qt::Key_Shift, - XK_Control_L, Qt::Key_Control, - XK_Control_R, Qt::Key_Control, - XK_Meta_L, Qt::Key_Meta, - XK_Meta_R, Qt::Key_Meta, - XK_Alt_L, Qt::Key_Alt, - XK_Alt_R, Qt::Key_Alt, - XK_Caps_Lock, Qt::Key_CapsLock, - XK_Num_Lock, Qt::Key_NumLock, - XK_Scroll_Lock, Qt::Key_ScrollLock, - XK_Super_L, Qt::Key_Super_L, - XK_Super_R, Qt::Key_Super_R, - XK_Menu, Qt::Key_Menu, - XK_Hyper_L, Qt::Key_Hyper_L, - XK_Hyper_R, Qt::Key_Hyper_R, - XK_Help, Qt::Key_Help, - 0x1000FF74, Qt::Key_Backtab, // hardcoded HP backtab - 0x1005FF10, Qt::Key_F11, // hardcoded Sun F36 (labeled F11) - 0x1005FF11, Qt::Key_F12, // hardcoded Sun F37 (labeled F12) - - // numeric and function keypad keys - - XK_KP_Space, Qt::Key_Space, - XK_KP_Tab, Qt::Key_Tab, - XK_KP_Enter, Qt::Key_Enter, - //XK_KP_F1, Qt::Key_F1, - //XK_KP_F2, Qt::Key_F2, - //XK_KP_F3, Qt::Key_F3, - //XK_KP_F4, Qt::Key_F4, - XK_KP_Home, Qt::Key_Home, - XK_KP_Left, Qt::Key_Left, - XK_KP_Up, Qt::Key_Up, - XK_KP_Right, Qt::Key_Right, - XK_KP_Down, Qt::Key_Down, - XK_KP_Prior, Qt::Key_PageUp, - XK_KP_Next, Qt::Key_PageDown, - XK_KP_End, Qt::Key_End, - XK_KP_Begin, Qt::Key_Clear, - XK_KP_Insert, Qt::Key_Insert, - XK_KP_Delete, Qt::Key_Delete, - XK_KP_Equal, Qt::Key_Equal, - XK_KP_Multiply, Qt::Key_Asterisk, - XK_KP_Add, Qt::Key_Plus, - XK_KP_Separator, Qt::Key_Comma, - XK_KP_Subtract, Qt::Key_Minus, - XK_KP_Decimal, Qt::Key_Period, - XK_KP_Divide, Qt::Key_Slash, - - // International input method support keys - - // International & multi-key character composition - XK_ISO_Level3_Shift, Qt::Key_AltGr, - XK_Multi_key, Qt::Key_Multi_key, - XK_Codeinput, Qt::Key_Codeinput, - XK_SingleCandidate, Qt::Key_SingleCandidate, - XK_MultipleCandidate, Qt::Key_MultipleCandidate, - XK_PreviousCandidate, Qt::Key_PreviousCandidate, - - // Misc Functions - XK_Mode_switch, Qt::Key_Mode_switch, - XK_script_switch, Qt::Key_Mode_switch, - - // Japanese keyboard support - XK_Kanji, Qt::Key_Kanji, - XK_Muhenkan, Qt::Key_Muhenkan, - //XK_Henkan_Mode, Qt::Key_Henkan_Mode, - XK_Henkan_Mode, Qt::Key_Henkan, - XK_Henkan, Qt::Key_Henkan, - XK_Romaji, Qt::Key_Romaji, - XK_Hiragana, Qt::Key_Hiragana, - XK_Katakana, Qt::Key_Katakana, - XK_Hiragana_Katakana, Qt::Key_Hiragana_Katakana, - XK_Zenkaku, Qt::Key_Zenkaku, - XK_Hankaku, Qt::Key_Hankaku, - XK_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku, - XK_Touroku, Qt::Key_Touroku, - XK_Massyo, Qt::Key_Massyo, - XK_Kana_Lock, Qt::Key_Kana_Lock, - XK_Kana_Shift, Qt::Key_Kana_Shift, - XK_Eisu_Shift, Qt::Key_Eisu_Shift, - XK_Eisu_toggle, Qt::Key_Eisu_toggle, - //XK_Kanji_Bangou, Qt::Key_Kanji_Bangou, - //XK_Zen_Koho, Qt::Key_Zen_Koho, - //XK_Mae_Koho, Qt::Key_Mae_Koho, - XK_Kanji_Bangou, Qt::Key_Codeinput, - XK_Zen_Koho, Qt::Key_MultipleCandidate, - XK_Mae_Koho, Qt::Key_PreviousCandidate, - -#ifdef XK_KOREAN - // Korean keyboard support - XK_Hangul, Qt::Key_Hangul, - XK_Hangul_Start, Qt::Key_Hangul_Start, - XK_Hangul_End, Qt::Key_Hangul_End, - XK_Hangul_Hanja, Qt::Key_Hangul_Hanja, - XK_Hangul_Jamo, Qt::Key_Hangul_Jamo, - XK_Hangul_Romaja, Qt::Key_Hangul_Romaja, - //XK_Hangul_Codeinput, Qt::Key_Hangul_Codeinput, - XK_Hangul_Codeinput, Qt::Key_Codeinput, - XK_Hangul_Jeonja, Qt::Key_Hangul_Jeonja, - XK_Hangul_Banja, Qt::Key_Hangul_Banja, - XK_Hangul_PreHanja, Qt::Key_Hangul_PreHanja, - XK_Hangul_PostHanja, Qt::Key_Hangul_PostHanja, - //XK_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate, - //XK_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate, - //XK_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate, - XK_Hangul_SingleCandidate, Qt::Key_SingleCandidate, - XK_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate, - XK_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate, - XK_Hangul_Special, Qt::Key_Hangul_Special, - //XK_Hangul_switch, Qt::Key_Hangul_switch, - XK_Hangul_switch, Qt::Key_Mode_switch, -#endif // XK_KOREAN - - // dead keys - XK_dead_grave, Qt::Key_Dead_Grave, - XK_dead_acute, Qt::Key_Dead_Acute, - XK_dead_circumflex, Qt::Key_Dead_Circumflex, - XK_dead_tilde, Qt::Key_Dead_Tilde, - XK_dead_macron, Qt::Key_Dead_Macron, - XK_dead_breve, Qt::Key_Dead_Breve, - XK_dead_abovedot, Qt::Key_Dead_Abovedot, - XK_dead_diaeresis, Qt::Key_Dead_Diaeresis, - XK_dead_abovering, Qt::Key_Dead_Abovering, - XK_dead_doubleacute, Qt::Key_Dead_Doubleacute, - XK_dead_caron, Qt::Key_Dead_Caron, - XK_dead_cedilla, Qt::Key_Dead_Cedilla, - XK_dead_ogonek, Qt::Key_Dead_Ogonek, - XK_dead_iota, Qt::Key_Dead_Iota, - XK_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound, - XK_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound, - XK_dead_belowdot, Qt::Key_Dead_Belowdot, - XK_dead_hook, Qt::Key_Dead_Hook, - XK_dead_horn, Qt::Key_Dead_Horn, - - // Special keys from X.org - This include multimedia keys, - // wireless/bluetooth/uwb keys, special launcher keys, etc. - XF86XK_Back, Qt::Key_Back, - XF86XK_Forward, Qt::Key_Forward, - XF86XK_Stop, Qt::Key_Stop, - XF86XK_Refresh, Qt::Key_Refresh, - XF86XK_Favorites, Qt::Key_Favorites, - XF86XK_AudioMedia, Qt::Key_LaunchMedia, - XF86XK_OpenURL, Qt::Key_OpenUrl, - XF86XK_HomePage, Qt::Key_HomePage, - XF86XK_Search, Qt::Key_Search, - XF86XK_AudioLowerVolume, Qt::Key_VolumeDown, - XF86XK_AudioMute, Qt::Key_VolumeMute, - XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp, - XF86XK_AudioPlay, Qt::Key_MediaPlay, - XF86XK_AudioStop, Qt::Key_MediaStop, - XF86XK_AudioPrev, Qt::Key_MediaPrevious, - XF86XK_AudioNext, Qt::Key_MediaNext, - XF86XK_AudioRecord, Qt::Key_MediaRecord, - XF86XK_Mail, Qt::Key_LaunchMail, - XF86XK_MyComputer, Qt::Key_Launch0, // ### Qt 5: remap properly - XF86XK_Calculator, Qt::Key_Launch1, - XF86XK_Memo, Qt::Key_Memo, - XF86XK_ToDoList, Qt::Key_ToDoList, - XF86XK_Calendar, Qt::Key_Calendar, - XF86XK_PowerDown, Qt::Key_PowerDown, - XF86XK_ContrastAdjust, Qt::Key_ContrastAdjust, - XF86XK_Standby, Qt::Key_Standby, - XF86XK_MonBrightnessUp, Qt::Key_MonBrightnessUp, - XF86XK_MonBrightnessDown, Qt::Key_MonBrightnessDown, - XF86XK_KbdLightOnOff, Qt::Key_KeyboardLightOnOff, - XF86XK_KbdBrightnessUp, Qt::Key_KeyboardBrightnessUp, - XF86XK_KbdBrightnessDown, Qt::Key_KeyboardBrightnessDown, - XF86XK_PowerOff, Qt::Key_PowerOff, - XF86XK_WakeUp, Qt::Key_WakeUp, - XF86XK_Eject, Qt::Key_Eject, - XF86XK_ScreenSaver, Qt::Key_ScreenSaver, - XF86XK_WWW, Qt::Key_WWW, - XF86XK_Sleep, Qt::Key_Sleep, - XF86XK_LightBulb, Qt::Key_LightBulb, - XF86XK_Shop, Qt::Key_Shop, - XF86XK_History, Qt::Key_History, - XF86XK_AddFavorite, Qt::Key_AddFavorite, - XF86XK_HotLinks, Qt::Key_HotLinks, - XF86XK_BrightnessAdjust, Qt::Key_BrightnessAdjust, - XF86XK_Finance, Qt::Key_Finance, - XF86XK_Community, Qt::Key_Community, - XF86XK_AudioRewind, Qt::Key_AudioRewind, - XF86XK_BackForward, Qt::Key_BackForward, - XF86XK_ApplicationLeft, Qt::Key_ApplicationLeft, - XF86XK_ApplicationRight, Qt::Key_ApplicationRight, - XF86XK_Book, Qt::Key_Book, - XF86XK_CD, Qt::Key_CD, - XF86XK_Calculater, Qt::Key_Calculator, - XF86XK_Clear, Qt::Key_Clear, - XF86XK_ClearGrab, Qt::Key_ClearGrab, - XF86XK_Close, Qt::Key_Close, - XF86XK_Copy, Qt::Key_Copy, - XF86XK_Cut, Qt::Key_Cut, - XF86XK_Display, Qt::Key_Display, - XF86XK_DOS, Qt::Key_DOS, - XF86XK_Documents, Qt::Key_Documents, - XF86XK_Excel, Qt::Key_Excel, - XF86XK_Explorer, Qt::Key_Explorer, - XF86XK_Game, Qt::Key_Game, - XF86XK_Go, Qt::Key_Go, - XF86XK_iTouch, Qt::Key_iTouch, - XF86XK_LogOff, Qt::Key_LogOff, - XF86XK_Market, Qt::Key_Market, - XF86XK_Meeting, Qt::Key_Meeting, - XF86XK_MenuKB, Qt::Key_MenuKB, - XF86XK_MenuPB, Qt::Key_MenuPB, - XF86XK_MySites, Qt::Key_MySites, - XF86XK_News, Qt::Key_News, - XF86XK_OfficeHome, Qt::Key_OfficeHome, - XF86XK_Option, Qt::Key_Option, - XF86XK_Paste, Qt::Key_Paste, - XF86XK_Phone, Qt::Key_Phone, - XF86XK_Reply, Qt::Key_Reply, - XF86XK_Reload, Qt::Key_Reload, - XF86XK_RotateWindows, Qt::Key_RotateWindows, - XF86XK_RotationPB, Qt::Key_RotationPB, - XF86XK_RotationKB, Qt::Key_RotationKB, - XF86XK_Save, Qt::Key_Save, - XF86XK_Send, Qt::Key_Send, - XF86XK_Spell, Qt::Key_Spell, - XF86XK_SplitScreen, Qt::Key_SplitScreen, - XF86XK_Support, Qt::Key_Support, - XF86XK_TaskPane, Qt::Key_TaskPane, - XF86XK_Terminal, Qt::Key_Terminal, - XF86XK_Tools, Qt::Key_Tools, - XF86XK_Travel, Qt::Key_Travel, - XF86XK_Video, Qt::Key_Video, - XF86XK_Word, Qt::Key_Word, - XF86XK_Xfer, Qt::Key_Xfer, - XF86XK_ZoomIn, Qt::Key_ZoomIn, - XF86XK_ZoomOut, Qt::Key_ZoomOut, - XF86XK_Away, Qt::Key_Away, - XF86XK_Messenger, Qt::Key_Messenger, - XF86XK_WebCam, Qt::Key_WebCam, - XF86XK_MailForward, Qt::Key_MailForward, - XF86XK_Pictures, Qt::Key_Pictures, - XF86XK_Music, Qt::Key_Music, - XF86XK_Battery, Qt::Key_Battery, - XF86XK_Bluetooth, Qt::Key_Bluetooth, - XF86XK_WLAN, Qt::Key_WLAN, - XF86XK_UWB, Qt::Key_UWB, - XF86XK_AudioForward, Qt::Key_AudioForward, - XF86XK_AudioRepeat, Qt::Key_AudioRepeat, - XF86XK_AudioRandomPlay, Qt::Key_AudioRandomPlay, - XF86XK_Subtitle, Qt::Key_Subtitle, - XF86XK_AudioCycleTrack, Qt::Key_AudioCycleTrack, - XF86XK_Time, Qt::Key_Time, - XF86XK_Select, Qt::Key_Select, - XF86XK_View, Qt::Key_View, - XF86XK_TopMenu, Qt::Key_TopMenu, - XF86XK_Bluetooth, Qt::Key_Bluetooth, - XF86XK_Suspend, Qt::Key_Suspend, - XF86XK_Hibernate, Qt::Key_Hibernate, - XF86XK_Launch0, Qt::Key_Launch2, // ### Qt 5: remap properly - XF86XK_Launch1, Qt::Key_Launch3, - XF86XK_Launch2, Qt::Key_Launch4, - XF86XK_Launch3, Qt::Key_Launch5, - XF86XK_Launch4, Qt::Key_Launch6, - XF86XK_Launch5, Qt::Key_Launch7, - XF86XK_Launch6, Qt::Key_Launch8, - XF86XK_Launch7, Qt::Key_Launch9, - XF86XK_Launch8, Qt::Key_LaunchA, - XF86XK_Launch9, Qt::Key_LaunchB, - XF86XK_LaunchA, Qt::Key_LaunchC, - XF86XK_LaunchB, Qt::Key_LaunchD, - XF86XK_LaunchC, Qt::Key_LaunchE, - XF86XK_LaunchD, Qt::Key_LaunchF, - XF86XK_LaunchE, Qt::Key_LaunchG, - XF86XK_LaunchF, Qt::Key_LaunchH, - - // Qtopia keys - QTOPIAXK_Select, Qt::Key_Select, - QTOPIAXK_Yes, Qt::Key_Yes, - QTOPIAXK_No, Qt::Key_No, - QTOPIAXK_Cancel, Qt::Key_Cancel, - QTOPIAXK_Printer, Qt::Key_Printer, - QTOPIAXK_Execute, Qt::Key_Execute, - QTOPIAXK_Sleep, Qt::Key_Sleep, - QTOPIAXK_Play, Qt::Key_Play, - QTOPIAXK_Zoom, Qt::Key_Zoom, - QTOPIAXK_Context1, Qt::Key_Context1, - QTOPIAXK_Context2, Qt::Key_Context2, - QTOPIAXK_Context3, Qt::Key_Context3, - QTOPIAXK_Context4, Qt::Key_Context4, - QTOPIAXK_Call, Qt::Key_Call, - QTOPIAXK_Hangup, Qt::Key_Hangup, - QTOPIAXK_Flip, Qt::Key_Flip, - - 0, 0 -}; - -static const unsigned short katakanaKeysymsToUnicode[] = { - 0x0000, 0x3002, 0x300C, 0x300D, 0x3001, 0x30FB, 0x30F2, 0x30A1, - 0x30A3, 0x30A5, 0x30A7, 0x30A9, 0x30E3, 0x30E5, 0x30E7, 0x30C3, - 0x30FC, 0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30AB, 0x30AD, - 0x30AF, 0x30B1, 0x30B3, 0x30B5, 0x30B7, 0x30B9, 0x30BB, 0x30BD, - 0x30BF, 0x30C1, 0x30C4, 0x30C6, 0x30C8, 0x30CA, 0x30CB, 0x30CC, - 0x30CD, 0x30CE, 0x30CF, 0x30D2, 0x30D5, 0x30D8, 0x30DB, 0x30DE, - 0x30DF, 0x30E0, 0x30E1, 0x30E2, 0x30E4, 0x30E6, 0x30E8, 0x30E9, - 0x30EA, 0x30EB, 0x30EC, 0x30ED, 0x30EF, 0x30F3, 0x309B, 0x309C -}; - -static const unsigned short cyrillicKeysymsToUnicode[] = { - 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, - 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0000, 0x045e, 0x045f, - 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, - 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0000, 0x040e, 0x040f, - 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, - 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, - 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, - 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, - 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, - 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, - 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, - 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a -}; - -static const unsigned short greekKeysymsToUnicode[] = { - 0x0000, 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, - 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, - 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, - 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, - 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, - 0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, - 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, - 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, - 0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, - 0x03c8, 0x03c9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -}; - -static const unsigned short technicalKeysymsToUnicode[] = { - 0x0000, 0x23B7, 0x250C, 0x2500, 0x2320, 0x2321, 0x2502, 0x23A1, - 0x23A3, 0x23A4, 0x23A6, 0x239B, 0x239D, 0x239E, 0x23A0, 0x23A8, - 0x23AC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222B, - 0x2234, 0x221D, 0x221E, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, - 0x223C, 0x2243, 0x0000, 0x0000, 0x0000, 0x21D4, 0x21D2, 0x2261, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221A, 0x0000, - 0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222A, 0x2227, 0x2228, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2202, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, - 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193, 0x0000 -}; - -static const unsigned short specialKeysymsToUnicode[] = { - 0x25C6, 0x2592, 0x2409, 0x240C, 0x240D, 0x240A, 0x0000, 0x0000, - 0x2424, 0x240B, 0x2518, 0x2510, 0x250C, 0x2514, 0x253C, 0x23BA, - 0x23BB, 0x2500, 0x23BC, 0x23BD, 0x251C, 0x2524, 0x2534, 0x252C, - 0x2502, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 -}; - -static const unsigned short publishingKeysymsToUnicode[] = { - 0x0000, 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, - 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, - 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, - 0x2105, 0x0000, 0x0000, 0x2012, 0x2329, 0x0000, 0x232a, 0x0000, - 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, - 0x0000, 0x2122, 0x2613, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25af, - 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x0000, 0x2032, 0x2033, - 0x0000, 0x271d, 0x0000, 0x25ac, 0x25c0, 0x25b6, 0x25cf, 0x25ae, - 0x25e6, 0x25ab, 0x25ad, 0x25b3, 0x25bd, 0x2606, 0x2022, 0x25aa, - 0x25b2, 0x25bc, 0x261c, 0x261e, 0x2663, 0x2666, 0x2665, 0x0000, - 0x2720, 0x2020, 0x2021, 0x2713, 0x2717, 0x266f, 0x266d, 0x2642, - 0x2640, 0x260e, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e, 0x0000 -}; - -static const unsigned short aplKeysymsToUnicode[] = { - 0x0000, 0x0000, 0x0000, 0x003c, 0x0000, 0x0000, 0x003e, 0x0000, - 0x2228, 0x2227, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x00af, 0x0000, 0x22a5, 0x2229, 0x230a, 0x0000, 0x005f, 0x0000, - 0x0000, 0x0000, 0x2218, 0x0000, 0x2395, 0x0000, 0x22a4, 0x25cb, - 0x0000, 0x0000, 0x0000, 0x2308, 0x0000, 0x0000, 0x222a, 0x0000, - 0x2283, 0x0000, 0x2282, 0x0000, 0x22a2, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x22a3, 0x0000, 0x0000, 0x0000 -}; - -static const unsigned short koreanKeysymsToUnicode[] = { - 0x0000, 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, - 0x3138, 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, - 0x3140, 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, - 0x3148, 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, - 0x3150, 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, - 0x3158, 0x3159, 0x315a, 0x315b, 0x315c, 0x315d, 0x315e, 0x315f, - 0x3160, 0x3161, 0x3162, 0x3163, 0x11a8, 0x11a9, 0x11aa, 0x11ab, - 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, - 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, - 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x316d, - 0x3171, 0x3178, 0x317f, 0x3181, 0x3184, 0x3186, 0x318d, 0x318e, - 0x11eb, 0x11f0, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9 -}; - -static QChar keysymToUnicode(unsigned char byte3, unsigned char byte4) -{ - switch (byte3) { - case 0x04: - // katakana - if (byte4 > 0xa0 && byte4 < 0xe0) - return QChar(katakanaKeysymsToUnicode[byte4 - 0xa0]); - else if (byte4 == 0x7e) - return QChar(0x203e); // Overline - break; - case 0x06: - // russian, use lookup table - if (byte4 > 0xa0) - return QChar(cyrillicKeysymsToUnicode[byte4 - 0xa0]); - break; - case 0x07: - // greek - if (byte4 > 0xa0) - return QChar(greekKeysymsToUnicode[byte4 - 0xa0]); - break; - case 0x08: - // technical - if (byte4 > 0xa0) - return QChar(technicalKeysymsToUnicode[byte4 - 0xa0]); - break; - case 0x09: - // special - if (byte4 >= 0xe0) - return QChar(specialKeysymsToUnicode[byte4 - 0xe0]); - break; - case 0x0a: - // publishing - if (byte4 > 0xa0) - return QChar(publishingKeysymsToUnicode[byte4 - 0xa0]); - break; - case 0x0b: - // APL - if (byte4 > 0xa0) - return QChar(aplKeysymsToUnicode[byte4 - 0xa0]); - break; - case 0x0e: - // Korean - if (byte4 > 0xa0) - return QChar(koreanKeysymsToUnicode[byte4 - 0xa0]); - break; - default: - break; - } - return QChar(0x0); -} - -Qt::KeyboardModifiers QXlibKeyboard::translateModifiers(int s) -{ - Qt::KeyboardModifiers ret = 0; - if (s & ShiftMask) - ret |= Qt::ShiftModifier; - if (s & ControlMask) - ret |= Qt::ControlModifier; - if (s & m_alt_mask) - ret |= Qt::AltModifier; - if (s & m_meta_mask) - ret |= Qt::MetaModifier; -// if (s & m_mode_switch_mask) //doesn't seem to work correctly -// ret |= Qt::GroupSwitchModifier; - return ret; -} - -void QXlibKeyboard::setMask(KeySym sym, uint mask) -{ - if (m_alt_mask == 0 - && m_meta_mask != mask - && m_super_mask != mask - && m_hyper_mask != mask - && (sym == XK_Alt_L || sym == XK_Alt_R)) { - m_alt_mask = mask; - } - if (m_meta_mask == 0 - && m_alt_mask != mask - && m_super_mask != mask - && m_hyper_mask != mask - && (sym == XK_Meta_L || sym == XK_Meta_R)) { - m_meta_mask = mask; - } - if (m_super_mask == 0 - && m_alt_mask != mask - && m_meta_mask != mask - && m_hyper_mask != mask - && (sym == XK_Super_L || sym == XK_Super_R)) { - m_super_mask = mask; - } - if (m_hyper_mask == 0 - && m_alt_mask != mask - && m_meta_mask != mask - && m_super_mask != mask - && (sym == XK_Hyper_L || sym == XK_Hyper_R)) { - m_hyper_mask = mask; - } - if (m_mode_switch_mask == 0 - && m_alt_mask != mask - && m_meta_mask != mask - && m_super_mask != mask - && m_hyper_mask != mask - && sym == XK_Mode_switch) { - m_mode_switch_mask = mask; - } - if (m_num_lock_mask == 0 - && sym == XK_Num_Lock) { - m_num_lock_mask = mask; - } -} - -int QXlibKeyboard::translateKeySym(uint key) const -{ - int code = -1; - int i = 0; // any other keys - while (KeyTbl[i]) { - if (key == KeyTbl[i]) { - code = (int)KeyTbl[i+1]; - break; - } - i += 2; - } - if (m_meta_mask) { - // translate Super/Hyper keys to Meta if we're using them as the MetaModifier - if (m_meta_mask == m_super_mask && (code == Qt::Key_Super_L || code == Qt::Key_Super_R)) { - code = Qt::Key_Meta; - } else if (m_meta_mask == m_hyper_mask && (code == Qt::Key_Hyper_L || code == Qt::Key_Hyper_R)) { - code = Qt::Key_Meta; - } - } - return code; -} - -QString QXlibKeyboard::translateKeySym(KeySym keysym, uint xmodifiers, - int &code, Qt::KeyboardModifiers &modifiers, - QByteArray &chars, int &count) -{ - // all keysyms smaller than 0xff00 are actally keys that can be mapped to unicode chars - - QTextCodec *mapper = QTextCodec::codecForLocale(); - QChar converted; - - if (/*count == 0 &&*/ keysym < 0xff00) { - unsigned char byte3 = (unsigned char)(keysym >> 8); - int mib = -1; - switch(byte3) { - case 0: // Latin 1 - case 1: // Latin 2 - case 2: //latin 3 - case 3: // latin4 - mib = byte3 + 4; break; - case 5: // arabic - mib = 82; break; - case 12: // Hebrew - mib = 85; break; - case 13: // Thai - mib = 2259; break; - case 4: // kana - case 6: // cyrillic - case 7: // greek - case 8: // technical, no mapping here at the moment - case 9: // Special - case 10: // Publishing - case 11: // APL - case 14: // Korean, no mapping - mib = -1; // manual conversion - mapper= 0; -#if !defined(QT_NO_XIM) - converted = keysymToUnicode(byte3, keysym & 0xff); -#endif - case 0x20: - // currency symbols - if (keysym >= 0x20a0 && keysym <= 0x20ac) { - mib = -1; // manual conversion - mapper = 0; - converted = (uint)keysym; - } - break; - default: - break; - } - if (mib != -1) { - mapper = QTextCodec::codecForMib(mib); - if (chars.isEmpty()) - chars.resize(1); - chars[0] = (unsigned char) (keysym & 0xff); // get only the fourth bit for conversion later - count = 1; - } - } else if (keysym >= 0x1000000 && keysym <= 0x100ffff) { - converted = (ushort) (keysym - 0x1000000); - mapper = 0; - } - if (count < (int)chars.size()-1) - chars[count] = '\0'; - - QString text; - if (!mapper && converted.unicode() != 0x0) { - text = converted; - } else if (!chars.isEmpty()) { - // convert chars (8bit) to text (unicode). - if (mapper) - text = mapper->toUnicode(chars.data(), count, 0); - if (text.isEmpty()) { - // no mapper, or codec couldn't convert to unicode (this - // can happen when running in the C locale or with no LANG - // set). try converting from latin-1 - text = QString::fromLatin1(chars); - } - } - - modifiers = translateModifiers(xmodifiers); - - // Commentary in X11/keysymdef says that X codes match ASCII, so it - // is safe to use the locale functions to process X codes in ISO8859-1. - // - // This is mainly for compatibility - applications should not use the - // Qt keycodes between 128 and 255, but should rather use the - // QKeyEvent::text(). - // - if (keysym < 128 || (keysym < 256 && (!mapper || mapper->mibEnum()==4))) { - // upper-case key, if known - code = isprint((int)keysym) ? toupper((int)keysym) : 0; - } else if (keysym >= XK_F1 && keysym <= XK_F35) { - // function keys - code = Qt::Key_F1 + ((int)keysym - XK_F1); - } else if (keysym >= XK_KP_Space && keysym <= XK_KP_9) { - if (keysym >= XK_KP_0) { - // numeric keypad keys - code = Qt::Key_0 + ((int)keysym - XK_KP_0); - } else { - code = translateKeySym(keysym); - } - modifiers |= Qt::KeypadModifier; - } else if (text.length() == 1 && text.unicode()->unicode() > 0x1f && text.unicode()->unicode() != 0x7f && !(keysym >= XK_dead_grave && keysym <= XK_dead_horn)) { - code = text.unicode()->toUpper().unicode(); - } else { - // any other keys - code = translateKeySym(keysym); - - if (code == Qt::Key_Tab && (modifiers & Qt::ShiftModifier)) { - // map shift+tab to shift+backtab, QShortcutMap knows about it - // and will handle it. - code = Qt::Key_Backtab; - text = QString(); - } - } - - return text; -} - -QXlibKeyboard::QXlibKeyboard(QXlibScreen *screen) - : m_screen(screen) - , m_alt_mask(0) - , m_super_mask(0) - , m_hyper_mask(0) - , m_meta_mask(0) -{ - changeLayout(); -} - -void QXlibKeyboard::changeLayout() -{ - XkbDescPtr xkbDesc = XkbGetMap(m_screen->display(), XkbAllClientInfoMask, XkbUseCoreKbd); - for (int i = xkbDesc->min_key_code; i < xkbDesc->max_key_code; ++i) { - const uint mask = xkbDesc->map->modmap ? xkbDesc->map->modmap[i] : 0; - if (mask == 0) { - // key is not bound to a modifier - continue; - } - - for (int j = 0; j < XkbKeyGroupsWidth(xkbDesc, i); ++j) { - KeySym keySym = XkbKeySym(xkbDesc, i, j); - if (keySym == NoSymbol) - continue; - setMask(keySym, mask); - } - } - XkbFreeKeyboard(xkbDesc, XkbAllComponentsMask, true); - -} - -static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) -{ - switch (qtcode) { - case Qt::Key_Control: - return Qt::ControlModifier; - case Qt::Key_Alt: - return Qt::AltModifier; - case Qt::Key_Shift: - return Qt::ShiftModifier; - case Qt::Key_Meta: - return Qt::MetaModifier; - default: - return Qt::NoModifier; - } -} - -void QXlibKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev) -{ - int qtcode = 0; - Qt::KeyboardModifiers modifiers = translateModifiers(ev->state); - QByteArray chars; - chars.resize(513); - int count = 0; - KeySym keySym; - count = XLookupString(ev,chars.data(),chars.size(),&keySym,0); - QString text = translateKeySym(keySym,ev->state,qtcode,modifiers,chars,count); - QWindowSystemInterface::handleKeyEvent(widget,ev->time,type,qtcode,modifiers,text.left(count)); -} diff --git a/src/plugins/platforms/xlib/qtestlitekeyboard.h b/src/plugins/platforms/xlib/qtestlitekeyboard.h deleted file mode 100644 index 98df4e1..0000000 --- a/src/plugins/platforms/xlib/qtestlitekeyboard.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITEKEYBOARD_H -#define QTESTLITEKEYBOARD_H - -#include "qtestliteintegration.h" - -class QXlibKeyboard -{ -public: - QXlibKeyboard(QXlibScreen *screen); - - void changeLayout(); - - void handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev); - - Qt::KeyboardModifiers translateModifiers(int s); - -private: - - void setMask(KeySym sym, uint mask); - int translateKeySym(uint key) const; - QString translateKeySym(KeySym keysym, uint xmodifiers, - int &code, Qt::KeyboardModifiers &modifiers, - QByteArray &chars, int &count); - - QXlibScreen *m_screen; - - uint m_alt_mask; - uint m_super_mask; - uint m_hyper_mask; - uint m_meta_mask; - uint m_mode_switch_mask; - uint m_num_lock_mask; -}; - -#endif // QTESTLITEKEYBOARD_H diff --git a/src/plugins/platforms/xlib/qtestlitemime.cpp b/src/plugins/platforms/xlib/qtestlitemime.cpp deleted file mode 100644 index 5335ae9..0000000 --- a/src/plugins/platforms/xlib/qtestlitemime.cpp +++ /dev/null @@ -1,322 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitemime.h" - -#include "qtestlitestaticinfo.h" -#include "qtestlitescreen.h" - -#include <QtCore/QTextCodec> -#include <QtGui/QImageWriter> -#include <QtCore/QBuffer> - -QXlibMime::QXlibMime() - : QInternalMimeData() -{ } - -QXlibMime::~QXlibMime() -{} - - - - - -QString QXlibMime::mimeAtomToString(Display *display, Atom a) -{ - if (!a) return 0; - - if (a == XA_STRING || a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) { - return "text/plain"; // some Xdnd clients are dumb - } - char *atom = XGetAtomName(display, a); - QString result = QString::fromLatin1(atom); - XFree(atom); - return result; -} - -Atom QXlibMime::mimeStringToAtom(Display *display, const QString &mimeType) -{ - if (mimeType.isEmpty()) - return 0; - return XInternAtom(display, mimeType.toLatin1().constData(), False); -} - -QStringList QXlibMime::mimeFormatsForAtom(Display *display, Atom a) -{ - QStringList formats; - if (a) { - QString atomName = mimeAtomToString(display, a); - formats.append(atomName); - - // special cases for string type - if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) - || a == XA_STRING - || a == QXlibStatic::atom(QXlibStatic::TEXT) - || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) - formats.append(QLatin1String("text/plain")); - - // special cases for uris - if (atomName == QLatin1String("text/x-moz-url")) - formats.append(QLatin1String("text/uri-list")); - - // special case for images - if (a == XA_PIXMAP) - formats.append(QLatin1String("image/ppm")); - } - return formats; -} - -bool QXlibMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat) -{ - bool ret = false; - *atomFormat = a; - *dataFormat = 8; - QString atomName = mimeAtomToString(display, a); - if (QInternalMimeData::hasFormatHelper(atomName, mimeData)) { - *data = QInternalMimeData::renderDataHelper(atomName, mimeData); - if (atomName == QLatin1String("application/x-color")) - *dataFormat = 16; - ret = true; - } else { - if ((a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) - || a == XA_STRING - || a == QXlibStatic::atom(QXlibStatic::TEXT) - || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) - && QInternalMimeData::hasFormatHelper(QLatin1String("text/plain"), mimeData)) { - if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)){ - *data = QInternalMimeData::renderDataHelper(QLatin1String("text/plain"), mimeData); - ret = true; - } else if (a == XA_STRING) { - *data = QString::fromUtf8(QInternalMimeData::renderDataHelper( - QLatin1String("text/plain"), mimeData)).toLocal8Bit(); - ret = true; - } else if (a == QXlibStatic::atom(QXlibStatic::TEXT) - || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { - // the ICCCM states that TEXT and COMPOUND_TEXT are in the - // encoding of choice, so we choose the encoding of the locale - QByteArray strData = QString::fromUtf8(QInternalMimeData::renderDataHelper( - QLatin1String("text/plain"), mimeData)).toLocal8Bit(); - char *list[] = { strData.data(), NULL }; - - XICCEncodingStyle style = (a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) - ? XCompoundTextStyle : XStdICCTextStyle; - XTextProperty textprop; - if (list[0] != NULL - && XmbTextListToTextProperty(display, list, 1, style, - &textprop) == Success) { - *atomFormat = textprop.encoding; - *dataFormat = textprop.format; - *data = QByteArray((const char *) textprop.value, textprop.nitems * textprop.format / 8); - ret = true; - - XFree(textprop.value); - } - } - } else if (atomName == QLatin1String("text/x-moz-url") && - QInternalMimeData::hasFormatHelper(QLatin1String("text/uri-list"), mimeData)) { - QByteArray uri = QInternalMimeData::renderDataHelper( - QLatin1String("text/uri-list"), mimeData).split('\n').first(); - QString mozUri = QString::fromLatin1(uri, uri.size()); - mozUri += QLatin1Char('\n'); - *data = QByteArray(reinterpret_cast<const char *>(mozUri.utf16()), mozUri.length() * 2); - ret = true; - } else if ((a == XA_PIXMAP || a == XA_BITMAP) && mimeData->hasImage()) { - ret = true; - } - } - return ret && data != 0; -} - -QList<Atom> QXlibMime::mimeAtomsForFormat(Display *display, const QString &format) -{ - QList<Atom> atoms; - atoms.append(mimeStringToAtom(display, format)); - - // special cases for strings - if (format == QLatin1String("text/plain")) { - atoms.append(QXlibStatic::atom(QXlibStatic::UTF8_STRING)); - atoms.append(XA_STRING); - atoms.append(QXlibStatic::atom(QXlibStatic::TEXT)); - atoms.append(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)); - } - - // special cases for uris - if (format == QLatin1String("text/uri-list")) { - atoms.append(mimeStringToAtom(display,QLatin1String("text/x-moz-url"))); - } - - //special cases for images - if (format == QLatin1String("image/ppm")) - atoms.append(XA_PIXMAP); - if (format == QLatin1String("image/pbm")) - atoms.append(XA_BITMAP); - - return atoms; -} - -QVariant QXlibMime::mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding) -{ - QString atomName = mimeAtomToString(display,a); - if (atomName == format) - return data; - - if (!encoding.isEmpty() - && atomName == format + QLatin1String(";charset=") + QString::fromLatin1(encoding)) { - - if (requestedType == QVariant::String) { - QTextCodec *codec = QTextCodec::codecForName(encoding); - if (codec) - return codec->toUnicode(data); - } - - return data; - } - - // special cases for string types - if (format == QLatin1String("text/plain")) { - if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) - return QString::fromUtf8(data); - if (a == XA_STRING) - return QString::fromLatin1(data); - if (a == QXlibStatic::atom(QXlibStatic::TEXT) - || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) - // #### might be wrong for COMPUND_TEXT - return QString::fromLocal8Bit(data, data.size()); - } - - // special case for uri types - if (format == QLatin1String("text/uri-list")) { - if (atomName == QLatin1String("text/x-moz-url")) { - // we expect this as utf16 <url><space><title> - // the first part is a url that should only contain ascci char - // so it should be safe to check that the second char is 0 - // to verify that it is utf16 - if (data.size() > 1 && data.at(1) == 0) - return QString::fromRawData((const QChar *)data.constData(), - data.size() / 2).split(QLatin1Char('\n')).first().toLatin1(); - } - } - - // special cas for images - if (format == QLatin1String("image/ppm")) { - if (a == XA_PIXMAP && data.size() == sizeof(Pixmap)) { - Pixmap xpm = *((Pixmap*)data.data()); - if (!xpm) - return QByteArray(); - Window root; - int x; - int y; - uint width; - uint height; - uint border_width; - uint depth; - - XGetGeometry(display, xpm, &root, &x, &y, &width, &height, &border_width, &depth); - XImage *ximg = XGetImage(display,xpm,x,y,width,height,AllPlanes,depth==1 ? XYPixmap : ZPixmap); - QImage qimg = QXlibStatic::qimageFromXImage(ximg); - XDestroyImage(ximg); - - QImageWriter imageWriter; - imageWriter.setFormat("PPMRAW"); - QBuffer buf; - buf.open(QIODevice::WriteOnly); - imageWriter.setDevice(&buf); - imageWriter.write(qimg); - return buf.buffer(); - } - } - return QVariant(); -} - -Atom QXlibMime::mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding) -{ - requestedEncoding->clear(); - - // find matches for string types - if (format == QLatin1String("text/plain")) { - if (atoms.contains(QXlibStatic::atom(QXlibStatic::UTF8_STRING))) - return QXlibStatic::atom(QXlibStatic::UTF8_STRING); - if (atoms.contains(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT))) - return QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT); - if (atoms.contains(QXlibStatic::atom(QXlibStatic::TEXT))) - return QXlibStatic::atom(QXlibStatic::TEXT); - if (atoms.contains(XA_STRING)) - return XA_STRING; - } - - // find matches for uri types - if (format == QLatin1String("text/uri-list")) { - Atom a = mimeStringToAtom(display,format); - if (a && atoms.contains(a)) - return a; - a = mimeStringToAtom(display,QLatin1String("text/x-moz-url")); - if (a && atoms.contains(a)) - return a; - } - - // find match for image - if (format == QLatin1String("image/ppm")) { - if (atoms.contains(XA_PIXMAP)) - return XA_PIXMAP; - } - - // for string/text requests try to use a format with a well-defined charset - // first to avoid encoding problems - if (requestedType == QVariant::String - && format.startsWith(QLatin1String("text/")) - && !format.contains(QLatin1String("charset="))) { - - QString formatWithCharset = format; - formatWithCharset.append(QLatin1String(";charset=utf-8")); - - Atom a = mimeStringToAtom(display,formatWithCharset); - if (a && atoms.contains(a)) { - *requestedEncoding = "utf-8"; - return a; - } - } - - Atom a = mimeStringToAtom(display,format); - if (a && atoms.contains(a)) - return a; - - return 0; -} diff --git a/src/plugins/platforms/xlib/qtestlitemime.h b/src/plugins/platforms/xlib/qtestlitemime.h deleted file mode 100644 index 6a70ea4..0000000 --- a/src/plugins/platforms/xlib/qtestlitemime.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITEMIME_H -#define QTESTLITEMIME_H - -#include <private/qdnd_p.h> - -#include <QtGui/QClipboard> - -#include "qtestliteintegration.h" -#include "qtestliteclipboard.h" - -class QXlibMime : public QInternalMimeData { - Q_OBJECT -public: - QXlibMime(); - ~QXlibMime(); - - static QList<Atom> mimeAtomsForFormat(Display *display, const QString &format); - static QString mimeAtomToString(Display *display, Atom a); - static bool mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat); - static QStringList mimeFormatsForAtom(Display *display, Atom a); - static Atom mimeStringToAtom(Display *display, const QString &mimeType); - static QVariant mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding); - static Atom mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding); -}; - -#endif // QTESTLITEMIME_H diff --git a/src/plugins/platforms/xlib/qtestlitescreen.cpp b/src/plugins/platforms/xlib/qtestlitescreen.cpp deleted file mode 100644 index 714c17b..0000000 --- a/src/plugins/platforms/xlib/qtestlitescreen.cpp +++ /dev/null @@ -1,468 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitescreen.h" - -#include "qtestlitecursor.h" -#include "qtestlitewindow.h" -#include "qtestlitekeyboard.h" -#include "qtestlitestaticinfo.h" -#include "qtestliteclipboard.h" - -#include <QtCore/QDebug> -#include <QtCore/QSocketNotifier> -#include <QtCore/QElapsedTimer> - -#include <private/qapplication_p.h> - -#include <X11/extensions/Xfixes.h> - -QT_BEGIN_NAMESPACE - -static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); -static bool seen_badwindow; - -static int qt_x_errhandler(Display *dpy, XErrorEvent *err) -{ - -qDebug() << "qt_x_errhandler" << err->error_code; - - switch (err->error_code) { - case BadAtom: -#if 0 - if (err->request_code == 20 /* X_GetProperty */ - && (err->resourceid == XA_RESOURCE_MANAGER - || err->resourceid == XA_RGB_DEFAULT_MAP - || err->resourceid == ATOM(_NET_SUPPORTED) - || err->resourceid == ATOM(_NET_SUPPORTING_WM_CHECK) - || err->resourceid == ATOM(KDE_FULL_SESSION) - || err->resourceid == ATOM(KWIN_RUNNING) - || err->resourceid == ATOM(XdndProxy) - || err->resourceid == ATOM(XdndAware)) - - - ) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } -#endif - qDebug() << "BadAtom"; - break; - - case BadWindow: - if (err->request_code == 2 /* X_ChangeWindowAttributes */ - || err->request_code == 38 /* X_QueryPointer */) { - for (int i = 0; i < ScreenCount(dpy); ++i) { - if (err->resourceid == RootWindow(dpy, i)) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } - } - } - seen_badwindow = true; - if (err->request_code == 25 /* X_SendEvent */) { - for (int i = 0; i < ScreenCount(dpy); ++i) { - if (err->resourceid == RootWindow(dpy, i)) { - // Perhaps we're running under SECURITY reduction? :/ - return 0; - } - } -#if 0 - if (X11->xdndHandleBadwindow()) { - qDebug("xdndHandleBadwindow returned true"); - return 0; - } -#endif - } -#if 0 - if (X11->ignore_badwindow) - return 0; -#endif - break; - - case BadMatch: - if (err->request_code == 42 /* X_SetInputFocus */) - return 0; - break; - - default: -#if 0 //!defined(QT_NO_XINPUT) - if (err->request_code == X11->xinput_major - && err->error_code == (X11->xinput_errorbase + XI_BadDevice) - && err->minor_code == 3 /* X_OpenDevice */) { - return 0; - } -#endif - break; - } - - char errstr[256]; - XGetErrorText( dpy, err->error_code, errstr, 256 ); - char buffer[256]; - char request_str[256]; - qsnprintf(buffer, 256, "%d", err->request_code); - XGetErrorDatabaseText(dpy, "XRequest", buffer, "", request_str, 256); - if (err->request_code < 128) { - // X error for a normal protocol request - qWarning( "X Error: %s %d\n" - " Major opcode: %d (%s)\n" - " Resource id: 0x%lx", - errstr, err->error_code, - err->request_code, - request_str, - err->resourceid ); - } else { - // X error for an extension request - const char *extensionName = 0; -#if 0 - if (err->request_code == X11->xrender_major) - extensionName = "RENDER"; - else if (err->request_code == X11->xrandr_major) - extensionName = "RANDR"; - else if (err->request_code == X11->xinput_major) - extensionName = "XInputExtension"; - else if (err->request_code == X11->mitshm_major) - extensionName = "MIT-SHM"; -#endif - char minor_str[256]; - if (extensionName) { - qsnprintf(buffer, 256, "%s.%d", extensionName, err->minor_code); - XGetErrorDatabaseText(dpy, "XRequest", buffer, "", minor_str, 256); - } else { - extensionName = "Uknown extension"; - qsnprintf(minor_str, 256, "Unknown request"); - } - qWarning( "X Error: %s %d\n" - " Extension: %d (%s)\n" - " Minor opcode: %d (%s)\n" - " Resource id: 0x%lx", - errstr, err->error_code, - err->request_code, - extensionName, - err->minor_code, - minor_str, - err->resourceid ); - } - - // ### we really should distinguish between severe, non-severe and - // ### application specific errors - - return 0; -} - -QXlibScreen::QXlibScreen() - : mFormat(QImage::Format_RGB32) -{ - char *display_name = getenv("DISPLAY"); - mDisplay = XOpenDisplay(display_name); - mDisplayName = QString::fromLocal8Bit(display_name); - if (!mDisplay) { - fprintf(stderr, "Cannot connect to X server: %s\n", - display_name); - exit(1); - } - -#ifndef DONT_USE_MIT_SHM - Status MIT_SHM_extension_supported = XShmQueryExtension (mDisplay); - Q_ASSERT(MIT_SHM_extension_supported == True); -#endif - original_x_errhandler = XSetErrorHandler(qt_x_errhandler); - - if (qgetenv("DO_X_SYNCHRONIZE").toInt()) - XSynchronize(mDisplay, true); - - mScreen = DefaultScreen(mDisplay); - XSelectInput(mDisplay,rootWindow(), KeymapStateMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask); - int width = DisplayWidth(mDisplay, mScreen); - int height = DisplayHeight(mDisplay, mScreen); - mGeometry = QRect(0,0,width,height); - - int physicalWidth = DisplayWidthMM(mDisplay, mScreen); - int physicalHeight = DisplayHeightMM(mDisplay, mScreen); - mPhysicalSize = QSize(physicalWidth,physicalHeight); - - int xSocketNumber = XConnectionNumber(mDisplay); - - mDepth = DefaultDepth(mDisplay,mScreen); -#ifdef MYX11_DEBUG - qDebug() << "X socket:"<< xSocketNumber; -#endif - QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); - connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); - - mCursor = new QXlibCursor(this); - mKeyboard = new QXlibKeyboard(this); -} - -QXlibScreen::~QXlibScreen() -{ - delete mCursor; - XCloseDisplay(mDisplay); -} - -#ifdef KeyPress -#undef KeyPress -#endif -#ifdef KeyRelease -#undef KeyRelease -#endif - -bool QXlibScreen::handleEvent(XEvent *xe) -{ - int quit = false; - QXlibWindow *platformWindow = 0; - QWidget *widget = QWidget::find(xe->xany.window); - if (widget) { - platformWindow = static_cast<QXlibWindow *>(widget->platformWindow()); - } - - Atom wmProtocolsAtom = QXlibStatic::atom(QXlibStatic::WM_PROTOCOLS); - Atom wmDeleteWindowAtom = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); - switch (xe->type) { - - case ClientMessage: - if (xe->xclient.format == 32 && xe->xclient.message_type == wmProtocolsAtom) { - Atom a = xe->xclient.data.l[0]; - if (a == wmDeleteWindowAtom) - platformWindow->handleCloseEvent(); - } - break; - - case Expose: - if (platformWindow) - if (xe->xexpose.count == 0) - platformWindow->paintEvent(); - break; - case ConfigureNotify: - if (platformWindow) - platformWindow->resizeEvent(&xe->xconfigure); - break; - - case ButtonPress: - if (platformWindow) - platformWindow->mousePressEvent(&xe->xbutton); - break; - - case ButtonRelease: - if (platformWindow) - platformWindow->handleMouseEvent(QEvent::MouseButtonRelease, &xe->xbutton); - break; - - case MotionNotify: - if (platformWindow) - platformWindow->handleMouseEvent(QEvent::MouseMove, &xe->xbutton); - break; - - case XKeyPress: - mKeyboard->handleKeyEvent(widget,QEvent::KeyPress, &xe->xkey); - break; - - case XKeyRelease: - mKeyboard->handleKeyEvent(widget,QEvent::KeyRelease, &xe->xkey); - break; - - case EnterNotify: - if (platformWindow) - platformWindow->handleEnterEvent(); - break; - - case LeaveNotify: - if (platformWindow) - platformWindow->handleLeaveEvent(); - break; - - case XFocusIn: - if (platformWindow) - platformWindow->handleFocusInEvent(); - break; - - case XFocusOut: - if (platformWindow) - platformWindow->handleFocusOutEvent(); - break; - - case PropertyNotify: - break; - - case SelectionClear: - qDebug() << "Selection Clear!!!"; - break; - case SelectionRequest: - handleSelectionRequest(xe); - break; - case SelectionNotify: - qDebug() << "Selection Notify!!!!"; - - break; - - - default: -#ifdef MYX11_DEBUG - qDebug() << hex << xe->xany.window << "Other X event" << xe->type; -#endif - break; - } - - return quit; -} - -static Bool checkForClipboardEvents(Display *, XEvent *e, XPointer) -{ - Atom clipboard = QXlibStatic::atom(QXlibStatic::CLIPBOARD); - return ((e->type == SelectionRequest && (e->xselectionrequest.selection == XA_PRIMARY - || e->xselectionrequest.selection == clipboard)) - || (e->type == SelectionClear && (e->xselectionclear.selection == XA_PRIMARY - || e->xselectionclear.selection == clipboard))); -} - -bool QXlibScreen::waitForClipboardEvent(Window win, int type, XEvent *event, int timeout) -{ - QElapsedTimer timer; - timer.start(); - do { - if (XCheckTypedWindowEvent(mDisplay,win,type,event)) - return true; - - // process other clipboard events, since someone is probably requesting data from us - XEvent e; - if (XCheckIfEvent(mDisplay, &e, checkForClipboardEvents, 0)) - handleEvent(&e); - - XFlush(mDisplay); - - // sleep 50 ms, so we don't use up CPU cycles all the time. - struct timeval usleep_tv; - usleep_tv.tv_sec = 0; - usleep_tv.tv_usec = 50000; - select(0, 0, 0, 0, &usleep_tv); - } while (timer.elapsed() < timeout); - return false; -} - -void QXlibScreen::eventDispatcher() -{ - ulong marker = XNextRequest(mDisplay); - // int i = 0; - while (XPending(mDisplay)) { - XEvent event; - XNextEvent(mDisplay, &event); - /* done = */ - handleEvent(&event); - - if (event.xany.serial >= marker) { - #ifdef MYX11_DEBUG - qDebug() << "potential livelock averted"; - #endif - #if 0 - if (XEventsQueued(mDisplay, QueuedAfterFlush)) { - qDebug() << " with events queued"; - QTimer::singleShot(0, this, SLOT(eventDispatcher())); - } - #endif - break; - } - } -} - -QImage QXlibScreen::grabWindow(Window window, int x, int y, int w, int h) -{ - if (w == 0 || h ==0) - return QImage(); - - //WinId 0 means the desktop widget - if (!window) - window = rootWindow(); - - XWindowAttributes window_attr; - if (!XGetWindowAttributes(mDisplay, window, &window_attr)) - return QImage(); - - if (w < 0) - w = window_attr.width - x; - if (h < 0) - h = window_attr.height - y; - - // Ideally, we should also limit ourselves to the screen area, but the Qt docs say - // that it's "unsafe" to go outside the screen, so we can ignore that problem. - - //We're definitely not optimizing for speed... - XImage *xi = XGetImage(mDisplay, window, x, y, w, h, AllPlanes, ZPixmap); - - if (!xi) - return QImage(); - - //taking a copy to make sure we have ownership -- not fast - QImage result = QImage( (uchar*) xi->data, xi->width, xi->height, xi->bytes_per_line, QImage::Format_RGB32 ).copy(); - - XDestroyImage(xi); - - return result; -} - -QXlibScreen * QXlibScreen::testLiteScreenForWidget(QWidget *widget) -{ - QPlatformScreen *platformScreen = platformScreenForWidget(widget); - return static_cast<QXlibScreen *>(platformScreen); -} - -Display * QXlibScreen::display() const -{ - return mDisplay; -} - -int QXlibScreen::xScreenNumber() const -{ - return mScreen; -} - -QXlibKeyboard * QXlibScreen::keyboard() const -{ - return mKeyboard; -} - -void QXlibScreen::handleSelectionRequest(XEvent *event) -{ - QPlatformIntegration *integration = QApplicationPrivate::platformIntegration(); - QXlibClipboard *clipboard = static_cast<QXlibClipboard *>(integration->clipboard()); - clipboard->handleSelectionRequest(event); -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qtestlitescreen.h b/src/plugins/platforms/xlib/qtestlitescreen.h deleted file mode 100644 index 7e59a59..0000000 --- a/src/plugins/platforms/xlib/qtestlitescreen.h +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the plugins of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITESCREEN_H -#define QTESTLITESCREEN_H - -#include <QtGui/QPlatformScreen> -#include "qtestliteintegration.h" - -QT_BEGIN_NAMESPACE - -class QXlibCursor; -class QXlibKeyboard; - -class QXlibScreen : public QPlatformScreen -{ - Q_OBJECT -public: - QXlibScreen(); - - ~QXlibScreen(); - - QString displayName() const { return mDisplayName; } - - QRect geometry() const { return mGeometry; } - int depth() const { return mDepth; } - QImage::Format format() const { return mFormat; } - QSize physicalSize() const { return mPhysicalSize; } - - Window rootWindow() { return RootWindow(mDisplay, mScreen); } - unsigned long blackPixel() { return BlackPixel(mDisplay, mScreen); } - unsigned long whitePixel() { return WhitePixel(mDisplay, mScreen); } - - bool handleEvent(XEvent *xe); - bool waitForClipboardEvent(Window win, int type, XEvent *event, int timeout); - - QImage grabWindow(Window window, int x, int y, int w, int h); - - static QXlibScreen *testLiteScreenForWidget(QWidget *widget); - - Display *display() const; - int xScreenNumber() const; - - QXlibKeyboard *keyboard() const; - -public slots: - void eventDispatcher(); - -private: - - void handleSelectionRequest(XEvent *event); - QString mDisplayName; - QRect mGeometry; - QSize mPhysicalSize; - int mDepth; - QImage::Format mFormat; - QXlibCursor *mCursor; - QXlibKeyboard *mKeyboard; - - Display * mDisplay; - int mScreen; -}; - -QT_END_NAMESPACE - -#endif // QTESTLITESCREEN_H diff --git a/src/plugins/platforms/xlib/qtestlitestaticinfo.cpp b/src/plugins/platforms/xlib/qtestlitestaticinfo.cpp deleted file mode 100644 index 837636c..0000000 --- a/src/plugins/platforms/xlib/qtestlitestaticinfo.cpp +++ /dev/null @@ -1,511 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitestaticinfo.h" -#include "qtestlitescreen.h" - -#include <qplatformdefs.h> - -#include <QtGui/private/qapplication_p.h> -#include <QtCore/QBuffer> -#include <QtCore/QLibrary> - -#include <QDebug> - -#ifndef QT_NO_XFIXES -#include <X11/extensions/Xfixes.h> -#endif // QT_NO_XFIXES - -static const char * x11_atomnames = { - // window-manager <-> client protocols - "WM_PROTOCOLS\0" - "WM_DELETE_WINDOW\0" - "WM_TAKE_FOCUS\0" - "_NET_WM_PING\0" - "_NET_WM_CONTEXT_HELP\0" - "_NET_WM_SYNC_REQUEST\0" - "_NET_WM_SYNC_REQUEST_COUNTER\0" - - // ICCCM window state - "WM_STATE\0" - "WM_CHANGE_STATE\0" - - // Session management - "WM_CLIENT_LEADER\0" - "WM_WINDOW_ROLE\0" - "SM_CLIENT_ID\0" - - // Clipboard - "CLIPBOARD\0" - "INCR\0" - "TARGETS\0" - "MULTIPLE\0" - "TIMESTAMP\0" - "SAVE_TARGETS\0" - "CLIP_TEMPORARY\0" - "_QT_SELECTION\0" - "_QT_CLIPBOARD_SENTINEL\0" - "_QT_SELECTION_SENTINEL\0" - "CLIPBOARD_MANAGER\0" - - "RESOURCE_MANAGER\0" - - "_XSETROOT_ID\0" - - "_QT_SCROLL_DONE\0" - "_QT_INPUT_ENCODING\0" - - "_MOTIF_WM_HINTS\0" - - "DTWM_IS_RUNNING\0" - "ENLIGHTENMENT_DESKTOP\0" - "_DT_SAVE_MODE\0" - "_SGI_DESKS_MANAGER\0" - - // EWMH (aka NETWM) - "_NET_SUPPORTED\0" - "_NET_VIRTUAL_ROOTS\0" - "_NET_WORKAREA\0" - - "_NET_MOVERESIZE_WINDOW\0" - "_NET_WM_MOVERESIZE\0" - - "_NET_WM_NAME\0" - "_NET_WM_ICON_NAME\0" - "_NET_WM_ICON\0" - - "_NET_WM_PID\0" - - "_NET_WM_WINDOW_OPACITY\0" - - "_NET_WM_STATE\0" - "_NET_WM_STATE_ABOVE\0" - "_NET_WM_STATE_BELOW\0" - "_NET_WM_STATE_FULLSCREEN\0" - "_NET_WM_STATE_MAXIMIZED_HORZ\0" - "_NET_WM_STATE_MAXIMIZED_VERT\0" - "_NET_WM_STATE_MODAL\0" - "_NET_WM_STATE_STAYS_ON_TOP\0" - "_NET_WM_STATE_DEMANDS_ATTENTION\0" - - "_NET_WM_USER_TIME\0" - "_NET_WM_USER_TIME_WINDOW\0" - "_NET_WM_FULL_PLACEMENT\0" - - "_NET_WM_WINDOW_TYPE\0" - "_NET_WM_WINDOW_TYPE_DESKTOP\0" - "_NET_WM_WINDOW_TYPE_DOCK\0" - "_NET_WM_WINDOW_TYPE_TOOLBAR\0" - "_NET_WM_WINDOW_TYPE_MENU\0" - "_NET_WM_WINDOW_TYPE_UTILITY\0" - "_NET_WM_WINDOW_TYPE_SPLASH\0" - "_NET_WM_WINDOW_TYPE_DIALOG\0" - "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU\0" - "_NET_WM_WINDOW_TYPE_POPUP_MENU\0" - "_NET_WM_WINDOW_TYPE_TOOLTIP\0" - "_NET_WM_WINDOW_TYPE_NOTIFICATION\0" - "_NET_WM_WINDOW_TYPE_COMBO\0" - "_NET_WM_WINDOW_TYPE_DND\0" - "_NET_WM_WINDOW_TYPE_NORMAL\0" - "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE\0" - - "_KDE_NET_WM_FRAME_STRUT\0" - - "_NET_STARTUP_INFO\0" - "_NET_STARTUP_INFO_BEGIN\0" - - "_NET_SUPPORTING_WM_CHECK\0" - - "_NET_WM_CM_S0\0" - - "_NET_SYSTEM_TRAY_VISUAL\0" - - "_NET_ACTIVE_WINDOW\0" - - // Property formats - "COMPOUND_TEXT\0" - "TEXT\0" - "UTF8_STRING\0" - - // xdnd - "XdndEnter\0" - "XdndPosition\0" - "XdndStatus\0" - "XdndLeave\0" - "XdndDrop\0" - "XdndFinished\0" - "XdndTypeList\0" - "XdndActionList\0" - - "XdndSelection\0" - - "XdndAware\0" - "XdndProxy\0" - - "XdndActionCopy\0" - "XdndActionLink\0" - "XdndActionMove\0" - "XdndActionPrivate\0" - - // Motif DND - "_MOTIF_DRAG_AND_DROP_MESSAGE\0" - "_MOTIF_DRAG_INITIATOR_INFO\0" - "_MOTIF_DRAG_RECEIVER_INFO\0" - "_MOTIF_DRAG_WINDOW\0" - "_MOTIF_DRAG_TARGETS\0" - - "XmTRANSFER_SUCCESS\0" - "XmTRANSFER_FAILURE\0" - - // Xkb - "_XKB_RULES_NAMES\0" - - // XEMBED - "_XEMBED\0" - "_XEMBED_INFO\0" - - // Wacom old. (before version 0.10) - "Wacom Stylus\0" - "Wacom Cursor\0" - "Wacom Eraser\0" - - // Tablet - "STYLUS\0" - "ERASER\0" -}; - -/*! - \internal - Try to resolve a \a symbol from \a library with the version specified - by \a vernum. - - Note that, in the case of the Xfixes library, \a vernum is not the same as - \c XFIXES_MAJOR - it is a part of soname and may differ from the Xfixes - version. -*/ -static void* qt_load_library_runtime(const char *library, int vernum, - int highestVernum, const char *symbol) -{ - QList<int> versions; - // we try to load in the following order: - // explicit version -> the default one -> (from the highest (highestVernum) to the lowest (vernum) ) - if (vernum != -1) - versions << vernum; - versions << -1; - if (vernum != -1) { - for(int i = highestVernum; i > vernum; --i) - versions << i; - } - Q_FOREACH(int version, versions) { - QLatin1String libName(library); - QLibrary xfixesLib(libName, version); - void *ptr = xfixesLib.resolve(symbol); - if (ptr) - return ptr; - } - return 0; -} - -# define XFIXES_LOAD_RUNTIME(vernum, symbol, symbol_type) \ - (symbol_type)qt_load_library_runtime("libXfixes", vernum, 4, #symbol); -# define XFIXES_LOAD_V1(symbol) \ - XFIXES_LOAD_RUNTIME(1, symbol, Ptr##symbol) -# define XFIXES_LOAD_V2(symbol) \ - XFIXES_LOAD_RUNTIME(2, symbol, Ptr##symbol) - - -class QTestLiteStaticInfoPrivate -{ -public: - QTestLiteStaticInfoPrivate() - : use_xfixes(false) - , xfixes_major(0) - , xfixes_eventbase(0) - , xfixes_errorbase(0) - { - QXlibScreen *screen = qobject_cast<QXlibScreen *> (QApplicationPrivate::platformIntegration()->screens().at(0)); - Q_ASSERT(screen); - - initializeAllAtoms(screen); - initializeSupportedAtoms(screen); - - resolveXFixes(screen); - } - - bool isSupportedByWM(Atom atom) - { - if (!m_supportedAtoms) - return false; - - bool supported = false; - int i = 0; - while (m_supportedAtoms[i] != 0) { - if (m_supportedAtoms[i++] == atom) { - supported = true; - break; - } - } - - return supported; - } - - Atom atom(QXlibStatic::X11Atom atom) - { - return m_allAtoms[atom]; - } - - bool useXFixes() const { return use_xfixes; } - - int xFixesEventBase() const {return xfixes_eventbase; } - - PtrXFixesSelectSelectionInput xFixesSelectSelectionInput() const - { - return ptrXFixesSelectSelectionInput; - } - - QImage qimageFromXImage(XImage *xi) - { - QImage::Format format = QImage::Format_ARGB32_Premultiplied; - if (xi->depth == 24) - format = QImage::Format_RGB32; - else if (xi->depth == 16) - format = QImage::Format_RGB16; - - QImage image = QImage((uchar *)xi->data, xi->width, xi->height, xi->bytes_per_line, format).copy(); - - // we may have to swap the byte order - if ((QSysInfo::ByteOrder == QSysInfo::LittleEndian && xi->byte_order == MSBFirst) - || (QSysInfo::ByteOrder == QSysInfo::BigEndian && xi->byte_order == LSBFirst)) - { - for (int i=0; i < image.height(); i++) { - if (xi->depth == 16) { - ushort *p = (ushort*)image.scanLine(i); - ushort *end = p + image.width(); - while (p < end) { - *p = ((*p << 8) & 0xff00) | ((*p >> 8) & 0x00ff); - p++; - } - } else { - uint *p = (uint*)image.scanLine(i); - uint *end = p + image.width(); - while (p < end) { - *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000) - | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff); - p++; - } - } - } - } - - // fix-up alpha channel - if (format == QImage::Format_RGB32) { - QRgb *p = (QRgb *)image.bits(); - for (int y = 0; y < xi->height; ++y) { - for (int x = 0; x < xi->width; ++x) - p[x] |= 0xff000000; - p += xi->bytes_per_line / 4; - } - } - - return image; - } - - -private: - - void initializeAllAtoms(QXlibScreen *screen) { - const char *names[QXlibStatic::NAtoms]; - const char *ptr = x11_atomnames; - - int i = 0; - while (*ptr) { - names[i++] = ptr; - while (*ptr) - ++ptr; - ++ptr; - } - - Q_ASSERT(i == QXlibStatic::NPredefinedAtoms); - - QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_"); - settings_atom_name += XDisplayName(qPrintable(screen->displayName())); - names[i++] = settings_atom_name; - - Q_ASSERT(i == QXlibStatic::NAtoms); - #if 0//defined(XlibSpecificationRelease) && (XlibSpecificationRelease >= 6) - XInternAtoms(screen->display(), (char **)names, i, False, m_allAtoms); - #else - for (i = 0; i < QXlibStatic::NAtoms; ++i) - m_allAtoms[i] = XInternAtom(screen->display(), (char *)names[i], False); - #endif - } - - void initializeSupportedAtoms(QXlibScreen *screen) - { - Atom type; - int format; - long offset = 0; - unsigned long nitems, after; - unsigned char *data = 0; - - int e = XGetWindowProperty(screen->display(), screen->rootWindow(), - this->atom(QXlibStatic::_NET_SUPPORTED), 0, 0, - False, XA_ATOM, &type, &format, &nitems, &after, &data); - if (data) - XFree(data); - - if (e == Success && type == XA_ATOM && format == 32) { - QBuffer ts; - ts.open(QIODevice::WriteOnly); - - while (after > 0) { - XGetWindowProperty(screen->display(), screen->rootWindow(), - this->atom(QXlibStatic::_NET_SUPPORTED), offset, 1024, - False, XA_ATOM, &type, &format, &nitems, &after, &data); - - if (type == XA_ATOM && format == 32) { - ts.write(reinterpret_cast<char *>(data), nitems * sizeof(long)); - offset += nitems; - } else - after = 0; - if (data) - XFree(data); - } - - // compute nitems - QByteArray buffer(ts.buffer()); - nitems = buffer.size() / sizeof(Atom); - m_supportedAtoms = new Atom[nitems + 1]; - Atom *a = (Atom *) buffer.data(); - uint i; - for (i = 0; i < nitems; i++) - m_supportedAtoms[i] = a[i]; - m_supportedAtoms[nitems] = 0; - - } - } - - void resolveXFixes(QXlibScreen *screen) - { -#ifndef QT_NO_XFIXES - // See if Xfixes is supported on the connected display - if (XQueryExtension(screen->display(), "XFIXES", &xfixes_major, - &xfixes_eventbase, &xfixes_errorbase)) { - ptrXFixesQueryExtension = XFIXES_LOAD_V1(XFixesQueryExtension); - ptrXFixesQueryVersion = XFIXES_LOAD_V1(XFixesQueryVersion); - ptrXFixesSetCursorName = XFIXES_LOAD_V2(XFixesSetCursorName); - ptrXFixesSelectSelectionInput = XFIXES_LOAD_V2(XFixesSelectSelectionInput); - - if(ptrXFixesQueryExtension && ptrXFixesQueryVersion - && ptrXFixesQueryExtension(screen->display(), &xfixes_eventbase, - &xfixes_errorbase)) { - // Xfixes is supported. - // Note: the XFixes protocol version is negotiated using QueryVersion. - // We supply the highest version we support, the X server replies with - // the highest version it supports, but no higher than the version we - // asked for. The version sent back is the protocol version the X server - // will use to talk us. If this call is removed, the behavior of the - // X server when it receives an XFixes request is undefined. - int major = 3; - int minor = 0; - ptrXFixesQueryVersion(screen->display(), &major, &minor); - use_xfixes = (major >= 1); - xfixes_major = major; - } - } -#endif // QT_NO_XFIXES - - } - - Atom *m_supportedAtoms; - Atom m_allAtoms[QXlibStatic::NAtoms]; - -#ifndef QT_NO_XFIXES - PtrXFixesQueryExtension ptrXFixesQueryExtension; - PtrXFixesQueryVersion ptrXFixesQueryVersion; - PtrXFixesSetCursorName ptrXFixesSetCursorName; - PtrXFixesSelectSelectionInput ptrXFixesSelectSelectionInput; -#endif - - bool use_xfixes; - int xfixes_major; - int xfixes_eventbase; - int xfixes_errorbase; - -}; -Q_GLOBAL_STATIC(QTestLiteStaticInfoPrivate, qTestLiteStaticInfoPrivate); - - -Atom QXlibStatic::atom(QXlibStatic::X11Atom atom) -{ - return qTestLiteStaticInfoPrivate()->atom(atom); -} - -bool QXlibStatic::isSupportedByWM(Atom atom) -{ - return qTestLiteStaticInfoPrivate()->isSupportedByWM(atom); -} - -bool QXlibStatic::useXFixes() -{ - return qTestLiteStaticInfoPrivate()->useXFixes(); -} - -int QXlibStatic::xFixesEventBase() -{ - return qTestLiteStaticInfoPrivate()->xFixesEventBase(); -} - -#ifndef QT_NO_XFIXES -PtrXFixesSelectSelectionInput QXlibStatic::xFixesSelectSelectionInput() -{ - qDebug() << qTestLiteStaticInfoPrivate()->useXFixes(); - if (!qTestLiteStaticInfoPrivate()->useXFixes()) - return 0; - - return qTestLiteStaticInfoPrivate()->xFixesSelectSelectionInput(); -} - -QImage QXlibStatic::qimageFromXImage(XImage *xi) -{ - return qTestLiteStaticInfoPrivate()->qimageFromXImage(xi); -} -#endif //QT_NO_XFIXES diff --git a/src/plugins/platforms/xlib/qtestlitestaticinfo.h b/src/plugins/platforms/xlib/qtestlitestaticinfo.h deleted file mode 100644 index 8473ee9..0000000 --- a/src/plugins/platforms/xlib/qtestlitestaticinfo.h +++ /dev/null @@ -1,413 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITESTATICINFO_H -#define QTESTLITESTATICINFO_H - -#include <QtCore/QTextStream> -#include <QtCore/QDataStream> -#include <QtCore/QMetaType> -#include <QtCore/QVariant> - -#if defined(_XLIB_H_) // crude hack, but... -#error "cannot include <X11/Xlib.h> before this file" -#endif -#define XRegisterIMInstantiateCallback qt_XRegisterIMInstantiateCallback -#define XUnregisterIMInstantiateCallback qt_XUnregisterIMInstantiateCallback -#define XSetIMValues qt_XSetIMValues -#include <X11/Xlib.h> -#undef XRegisterIMInstantiateCallback -#undef XUnregisterIMInstantiateCallback -#undef XSetIMValues - -#include <X11/Xutil.h> -#include <X11/Xos.h> -#ifdef index -# undef index -#endif -#ifdef rindex -# undef rindex -#endif -#ifdef Q_OS_VXWORS -# ifdef open -# undef open -# endif -# ifdef getpid -# undef getpid -# endif -#endif // Q_OS_VXWORKS -#include <X11/Xatom.h> - -//#define QT_NO_SHAPE -#ifdef QT_NO_SHAPE -# define XShapeCombineRegion(a,b,c,d,e,f,g) -# define XShapeCombineMask(a,b,c,d,e,f,g) -#else -# include <X11/extensions/shape.h> -#endif // QT_NO_SHAPE - - -#if !defined (QT_NO_TABLET) -# include <X11/extensions/XInput.h> -#if defined (Q_OS_IRIX) -# include <X11/extensions/SGIMisc.h> -# include <wacom.h> -#endif -#endif // QT_NO_TABLET - - -// #define QT_NO_XINERAMA -#ifndef QT_NO_XINERAMA -// XFree86 does not C++ify Xinerama (at least up to XFree86 4.0.3). -extern "C" { -# include <X11/extensions/Xinerama.h> -} -#endif // QT_NO_XINERAMA - -// #define QT_NO_XRANDR -#ifndef QT_NO_XRANDR -# include <X11/extensions/Xrandr.h> -#endif // QT_NO_XRANDR - -// #define QT_NO_XRENDER -#ifndef QT_NO_XRENDER -# include <X11/extensions/Xrender.h> -#endif // QT_NO_XRENDER - -#ifndef QT_NO_XSYNC -extern "C" { -# include "X11/extensions/sync.h" -} -#endif - -// #define QT_NO_XKB -#ifndef QT_NO_XKB -# include <X11/XKBlib.h> -#endif // QT_NO_XKB - - -#if !defined(XlibSpecificationRelease) -# define X11R4 -typedef char *XPointer; -#else -# undef X11R4 -#endif - -#ifndef QT_NO_XFIXES -typedef Bool (*PtrXFixesQueryExtension)(Display *, int *, int *); -typedef Status (*PtrXFixesQueryVersion)(Display *, int *, int *); -typedef void (*PtrXFixesSetCursorName)(Display *dpy, Cursor cursor, const char *name); -typedef void (*PtrXFixesSelectSelectionInput)(Display *dpy, Window win, Atom selection, unsigned long eventMask); -#endif // QT_NO_XFIXES - -#ifndef QT_NO_XCURSOR -#include <X11/Xcursor/Xcursor.h> -typedef Cursor (*PtrXcursorLibraryLoadCursor)(Display *, const char *); -#endif // QT_NO_XCURSOR - -#ifndef QT_NO_XINERAMA -typedef Bool (*PtrXineramaQueryExtension)(Display *dpy, int *event_base, int *error_base); -typedef Bool (*PtrXineramaIsActive)(Display *dpy); -typedef XineramaScreenInfo *(*PtrXineramaQueryScreens)(Display *dpy, int *number); -#endif // QT_NO_XINERAMA - -#ifndef QT_NO_XRANDR -typedef void (*PtrXRRSelectInput)(Display *, Window, int); -typedef int (*PtrXRRUpdateConfiguration)(XEvent *); -typedef int (*PtrXRRRootToScreen)(Display *, Window); -typedef Bool (*PtrXRRQueryExtension)(Display *, int *, int *); -#endif // QT_NO_XRANDR - -#ifndef QT_NO_XINPUT -typedef int (*PtrXCloseDevice)(Display *, XDevice *); -typedef XDeviceInfo* (*PtrXListInputDevices)(Display *, int *); -typedef XDevice* (*PtrXOpenDevice)(Display *, XID); -typedef void (*PtrXFreeDeviceList)(XDeviceInfo *); -typedef int (*PtrXSelectExtensionEvent)(Display *, Window, XEventClass *, int); -#endif // QT_NO_XINPUT - -/* - * Solaris patch 108652-47 and higher fixes crases in - * XRegisterIMInstantiateCallback, but the function doesn't seem to - * work. - * - * Instead, we disabled R6 input, and open the input method - * immediately at application start. - */ - -//######### XFree86 has wrong declarations for XRegisterIMInstantiateCallback -//######### and XUnregisterIMInstantiateCallback in at least version 3.3.2. -//######### Many old X11R6 header files lack XSetIMValues. -//######### Therefore, we have to declare these functions ourselves. - -extern "C" Bool XRegisterIMInstantiateCallback( - Display*, - struct _XrmHashBucketRec*, - char*, - char*, - XIMProc, //XFree86 has XIDProc, which has to be wrong - XPointer -); - -extern "C" Bool XUnregisterIMInstantiateCallback( - Display*, - struct _XrmHashBucketRec*, - char*, - char*, - XIMProc, //XFree86 has XIDProc, which has to be wrong - XPointer -); - -#ifndef X11R4 -# include <X11/Xlocale.h> -#endif // X11R4 - - -#ifndef QT_NO_MITSHM -# include <X11/extensions/XShm.h> -#endif // QT_NO_MITSHM - -// rename a couple of X defines to get rid of name clashes -// resolve the conflict between X11's FocusIn and QEvent::FocusIn -enum { - XFocusOut = FocusOut, - XFocusIn = FocusIn, - XKeyPress = KeyPress, - XKeyRelease = KeyRelease, - XNone = None, - XRevertToParent = RevertToParent, - XGrayScale = GrayScale, - XCursorShape = CursorShape -}; -#undef FocusOut -#undef FocusIn -#undef KeyPress -#undef KeyRelease -#undef None -#undef RevertToParent -#undef GrayScale -#undef CursorShape - -#ifdef FontChange -#undef FontChange -#endif - - -class QXlibStatic -{ -public: - enum X11Atom { - // window-manager <-> client protocols - WM_PROTOCOLS, - WM_DELETE_WINDOW, - WM_TAKE_FOCUS, - _NET_WM_PING, - _NET_WM_CONTEXT_HELP, - _NET_WM_SYNC_REQUEST, - _NET_WM_SYNC_REQUEST_COUNTER, - - // ICCCM window state - WM_STATE, - WM_CHANGE_STATE, - - // Session management - WM_CLIENT_LEADER, - WM_WINDOW_ROLE, - SM_CLIENT_ID, - - // Clipboard - CLIPBOARD, - INCR, - TARGETS, - MULTIPLE, - TIMESTAMP, - SAVE_TARGETS, - CLIP_TEMPORARY, - _QT_SELECTION, - _QT_CLIPBOARD_SENTINEL, - _QT_SELECTION_SENTINEL, - CLIPBOARD_MANAGER, - - RESOURCE_MANAGER, - - _XSETROOT_ID, - - _QT_SCROLL_DONE, - _QT_INPUT_ENCODING, - - _MOTIF_WM_HINTS, - - DTWM_IS_RUNNING, - ENLIGHTENMENT_DESKTOP, - _DT_SAVE_MODE, - _SGI_DESKS_MANAGER, - - // EWMH (aka NETWM) - _NET_SUPPORTED, - _NET_VIRTUAL_ROOTS, - _NET_WORKAREA, - - _NET_MOVERESIZE_WINDOW, - _NET_WM_MOVERESIZE, - - _NET_WM_NAME, - _NET_WM_ICON_NAME, - _NET_WM_ICON, - - _NET_WM_PID, - - _NET_WM_WINDOW_OPACITY, - - _NET_WM_STATE, - _NET_WM_STATE_ABOVE, - _NET_WM_STATE_BELOW, - _NET_WM_STATE_FULLSCREEN, - _NET_WM_STATE_MAXIMIZED_HORZ, - _NET_WM_STATE_MAXIMIZED_VERT, - _NET_WM_STATE_MODAL, - _NET_WM_STATE_STAYS_ON_TOP, - _NET_WM_STATE_DEMANDS_ATTENTION, - - _NET_WM_USER_TIME, - _NET_WM_USER_TIME_WINDOW, - _NET_WM_FULL_PLACEMENT, - - _NET_WM_WINDOW_TYPE, - _NET_WM_WINDOW_TYPE_DESKTOP, - _NET_WM_WINDOW_TYPE_DOCK, - _NET_WM_WINDOW_TYPE_TOOLBAR, - _NET_WM_WINDOW_TYPE_MENU, - _NET_WM_WINDOW_TYPE_UTILITY, - _NET_WM_WINDOW_TYPE_SPLASH, - _NET_WM_WINDOW_TYPE_DIALOG, - _NET_WM_WINDOW_TYPE_DROPDOWN_MENU, - _NET_WM_WINDOW_TYPE_POPUP_MENU, - _NET_WM_WINDOW_TYPE_TOOLTIP, - _NET_WM_WINDOW_TYPE_NOTIFICATION, - _NET_WM_WINDOW_TYPE_COMBO, - _NET_WM_WINDOW_TYPE_DND, - _NET_WM_WINDOW_TYPE_NORMAL, - _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, - - _KDE_NET_WM_FRAME_STRUT, - - _NET_STARTUP_INFO, - _NET_STARTUP_INFO_BEGIN, - - _NET_SUPPORTING_WM_CHECK, - - _NET_WM_CM_S0, - - _NET_SYSTEM_TRAY_VISUAL, - - _NET_ACTIVE_WINDOW, - - // Property formats - COMPOUND_TEXT, - TEXT, - UTF8_STRING, - - // Xdnd - XdndEnter, - XdndPosition, - XdndStatus, - XdndLeave, - XdndDrop, - XdndFinished, - XdndTypelist, - XdndActionList, - - XdndSelection, - - XdndAware, - XdndProxy, - - XdndActionCopy, - XdndActionLink, - XdndActionMove, - XdndActionPrivate, - - // Motif DND - _MOTIF_DRAG_AND_DROP_MESSAGE, - _MOTIF_DRAG_INITIATOR_INFO, - _MOTIF_DRAG_RECEIVER_INFO, - _MOTIF_DRAG_WINDOW, - _MOTIF_DRAG_TARGETS, - - XmTRANSFER_SUCCESS, - XmTRANSFER_FAILURE, - - // Xkb - _XKB_RULES_NAMES, - - // XEMBED - _XEMBED, - _XEMBED_INFO, - - XWacomStylus, - XWacomCursor, - XWacomEraser, - - XTabletStylus, - XTabletEraser, - - NPredefinedAtoms, - - _QT_SETTINGS_TIMESTAMP = NPredefinedAtoms, - NAtoms - }; - - static Atom atom(X11Atom atom); - static bool isSupportedByWM(Atom atom); - - static bool useXFixes(); - static int xFixesEventBase(); - - #ifndef QT_NO_XFIXES - static PtrXFixesSelectSelectionInput xFixesSelectSelectionInput(); - #endif //QT_NO_XFIXES - - static QImage qimageFromXImage(XImage *xi); - - -}; - -#endif // QTESTLITESTATICINFO_H diff --git a/src/plugins/platforms/xlib/qtestlitewindow.cpp b/src/plugins/platforms/xlib/qtestlitewindow.cpp deleted file mode 100644 index 0f11a81..0000000 --- a/src/plugins/platforms/xlib/qtestlitewindow.cpp +++ /dev/null @@ -1,735 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitewindow.h" - -#include "qtestliteintegration.h" -#include "qtestlitescreen.h" -#include "qtestlitekeyboard.h" -#include "qtestlitestaticinfo.h" - -#include <QtGui/QWindowSystemInterface> -#include <QSocketNotifier> -#include <QApplication> -#include <QDebug> - -#include <QtGui/private/qwindowsurface_p.h> -#include <QtGui/private/qapplication_p.h> - -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) -#include "qglxintegration.h" -#else -#include "../eglconvenience/qeglconvenience.h" -#include "../eglconvenience/qeglplatformcontext.h" -#include "qtestliteeglintegration.h" -#endif //QT_OPENGL_ES_2 -#endif //QT_NO_OPENGL - -//#define MYX11_DEBUG - -QT_BEGIN_NAMESPACE - -QXlibWindow::QXlibWindow(QWidget *window) - : QPlatformWindow(window) - , mGLContext(0) - , mScreen(QXlibScreen::testLiteScreenForWidget(window)) -{ - int x = window->x(); - int y = window->y(); - int w = window->width(); - int h = window->height(); - - if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL - && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) - XVisualInfo *visualInfo = QGLXContext::findVisualInfo(mScreen,window->platformWindowFormat()); -#else - QPlatformWindowFormat windowFormat = correctColorBuffers(window->platformWindowFormat()); - - EGLDisplay eglDisplay = eglGetDisplay(mScreen->display()); - EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,windowFormat); - VisualID id = QXlibEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); - - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - visualInfoTemplate.visualid = id; - - XVisualInfo *visualInfo; - int matchingCount = 0; - visualInfo = XGetVisualInfo(mScreen->display(), VisualIDMask, &visualInfoTemplate, &matchingCount); -#endif //!defined(QT_OPENGL_ES_2) - if (visualInfo) { - Colormap cmap = XCreateColormap(mScreen->display(),mScreen->rootWindow(),visualInfo->visual,AllocNone); - - XSetWindowAttributes a; - a.colormap = cmap; - x_window = XCreateWindow(mScreen->display(), mScreen->rootWindow(),x, y, w, h, - 0, visualInfo->depth, InputOutput, visualInfo->visual, - CWColormap, &a); - } else { - qFatal("no window!"); - } -#endif //!defined(QT_NO_OPENGL) - } else { - x_window = XCreateSimpleWindow(mScreen->display(), mScreen->rootWindow(), - x, y, w, h, 0 /*border_width*/, - mScreen->blackPixel(), mScreen->whitePixel()); - } - -#ifdef MYX11_DEBUG - qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; -#endif - - XSetWindowBackgroundPixmap(mScreen->display(), x_window, XNone); - - XSelectInput(mScreen->display(), x_window, - ExposureMask | KeyPressMask | KeyReleaseMask | - EnterWindowMask | LeaveWindowMask | FocusChangeMask | - PointerMotionMask | ButtonPressMask | ButtonReleaseMask | - ButtonMotionMask | PropertyChangeMask | - StructureNotifyMask); - - gc = createGC(); - - Atom protocols[5]; - int n = 0; - protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); // support del window protocol - protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_TAKE_FOCUS); // support take focus window protocol - protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_PING); // support _NET_WM_PING protocol -#ifndef QT_NO_XSYNC - protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_SYNC_REQUEST); // support _NET_WM_SYNC_REQUEST protocol -#endif // QT_NO_XSYNC - if (window->windowFlags() & Qt::WindowContextHelpButtonHint) - protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_CONTEXT_HELP); - XSetWMProtocols(mScreen->display(), x_window, protocols, n); -} - - - -QXlibWindow::~QXlibWindow() -{ -#ifdef MYX11_DEBUG - qDebug() << "~QTestLiteWindow" << hex << x_window; -#endif - delete mGLContext; - XFreeGC(mScreen->display(), gc); - XDestroyWindow(mScreen->display(), x_window); -} - -//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -// Mouse event stuff -static Qt::MouseButtons translateMouseButtons(int s) -{ - Qt::MouseButtons ret = 0; - if (s & Button1Mask) - ret |= Qt::LeftButton; - if (s & Button2Mask) - ret |= Qt::MidButton; - if (s & Button3Mask) - ret |= Qt::RightButton; - return ret; -} - - - -void QXlibWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) -{ - static QPoint mousePoint; - - Qt::MouseButton button = Qt::NoButton; - Qt::MouseButtons buttons = translateMouseButtons(e->state); - Qt::KeyboardModifiers modifiers = mScreen->keyboard()->translateModifiers(e->state); - if (type != QEvent::MouseMove) { - switch (e->button) { - case Button1: button = Qt::LeftButton; break; - case Button2: button = Qt::MidButton; break; - case Button3: button = Qt::RightButton; break; - case Button4: - case Button5: - case 6: - case 7: { - //mouse wheel - if (type == QEvent::MouseButtonPress) { - //logic borrowed from qapplication_x11.cpp - int delta = 120 * ((e->button == Button4 || e->button == 6) ? 1 : -1); - bool hor = (((e->button == Button4 || e->button == Button5) - && (modifiers & Qt::AltModifier)) - || (e->button == 6 || e->button == 7)); - QWindowSystemInterface::handleWheelEvent(widget(), e->time, - QPoint(e->x, e->y), - QPoint(e->x_root, e->y_root), - delta, hor ? Qt::Horizontal : Qt::Vertical); - } - return; - } - default: break; - } - } - - buttons ^= button; // X event uses state *before*, Qt uses state *after* - - QWindowSystemInterface::handleMouseEvent(widget(), e->time, QPoint(e->x, e->y), - QPoint(e->x_root, e->y_root), - buttons); - - mousePoint = QPoint(e->x_root, e->y_root); -} - -void QXlibWindow::handleCloseEvent() -{ - QWindowSystemInterface::handleCloseEvent(widget()); -} - - -void QXlibWindow::handleEnterEvent() -{ - QWindowSystemInterface::handleEnterEvent(widget()); -} - -void QXlibWindow::handleLeaveEvent() -{ - QWindowSystemInterface::handleLeaveEvent(widget()); -} - -void QXlibWindow::handleFocusInEvent() -{ - QWindowSystemInterface::handleWindowActivated(widget()); -} - -void QXlibWindow::handleFocusOutEvent() -{ - QWindowSystemInterface::handleWindowActivated(0); -} - - - -void QXlibWindow::setGeometry(const QRect &rect) -{ - XMoveResizeWindow(mScreen->display(), x_window, rect.x(), rect.y(), rect.width(), rect.height()); - QPlatformWindow::setGeometry(rect); -} - - -Qt::WindowFlags QXlibWindow::windowFlags() const -{ - return mWindowFlags; -} - -WId QXlibWindow::winId() const -{ - return x_window; -} - -void QXlibWindow::setParent(const QPlatformWindow *window) -{ - QPoint topLeft = geometry().topLeft(); - XReparentWindow(mScreen->display(),x_window,window->winId(),topLeft.x(),topLeft.y()); -} - -void QXlibWindow::raise() -{ - XRaiseWindow(mScreen->display(), x_window); -} - -void QXlibWindow::lower() -{ - XLowerWindow(mScreen->display(), x_window); -} - -void QXlibWindow::setWindowTitle(const QString &title) -{ - QByteArray ba = title.toLatin1(); //We're not making a general solution here... - XTextProperty windowName; - windowName.value = (unsigned char *)ba.constData(); - windowName.encoding = XA_STRING; - windowName.format = 8; - windowName.nitems = ba.length(); - - XSetWMName(mScreen->display(), x_window, &windowName); -} - -GC QXlibWindow::createGC() -{ - GC gc; - - gc = XCreateGC(mScreen->display(), x_window, 0, 0); - if (gc < 0) { - qWarning("QTestLiteWindow::createGC() could not create GC"); - } - return gc; -} - -void QXlibWindow::paintEvent() -{ -#ifdef MYX11_DEBUG -// qDebug() << "QTestLiteWindow::paintEvent" << shm_img.size() << painted; -#endif - - if (QWindowSurface *surface = widget()->windowSurface()) - surface->flush(widget(), widget()->geometry(), QPoint()); -} - -void QXlibWindow::requestActivateWindow() -{ - XSetInputFocus(mScreen->display(), x_window, XRevertToParent, CurrentTime); -} - -void QXlibWindow::resizeEvent(XConfigureEvent *e) -{ - int xpos = geometry().x(); - int ypos = geometry().y(); - if ((e->width != geometry().width() || e->height != geometry().height()) && e->x == 0 && e->y == 0) { - //qDebug() << "resize with bogus pos" << e->x << e->y << e->width << e->height << "window"<< hex << window; - } else { - //qDebug() << "geometry change" << e->x << e->y << e->width << e->height << "window"<< hex << window; - xpos = e->x; - ypos = e->y; - } -#ifdef MYX11_DEBUG - qDebug() << hex << x_window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height; -#endif - - QRect newRect(xpos, ypos, e->width, e->height); - QWindowSystemInterface::handleGeometryChange(widget(), newRect); -} - -void QXlibWindow::mousePressEvent(XButtonEvent *e) -{ - static long prevTime = 0; - static Window prevWindow; - static int prevX = -999; - static int prevY = -999; - - QEvent::Type type = QEvent::MouseButtonPress; - - if (e->window == prevWindow && long(e->time) - prevTime < QApplication::doubleClickInterval() - && qAbs(e->x - prevX) < 5 && qAbs(e->y - prevY) < 5) { - type = QEvent::MouseButtonDblClick; - prevTime = e->time - QApplication::doubleClickInterval(); //no double click next time - } else { - prevTime = e->time; - } - prevWindow = e->window; - prevX = e->x; - prevY = e->y; - - handleMouseEvent(type, e); -} - -QXlibMWMHints QXlibWindow::getMWMHints() const -{ - QXlibMWMHints mwmhints; - - Atom type; - int format; - ulong nitems, bytesLeft; - uchar *data = 0; - Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); - if ((XGetWindowProperty(mScreen->display(), x_window, atomForMotifWmHints, 0, 5, false, - atomForMotifWmHints, &type, &format, &nitems, &bytesLeft, - &data) == Success) - && (type == atomForMotifWmHints - && format == 32 - && nitems >= 5)) { - mwmhints = *(reinterpret_cast<QXlibMWMHints *>(data)); - } else { - mwmhints.flags = 0L; - mwmhints.functions = MWM_FUNC_ALL; - mwmhints.decorations = MWM_DECOR_ALL; - mwmhints.input_mode = 0L; - mwmhints.status = 0L; - } - - if (data) - XFree(data); - - return mwmhints; -} - -void QXlibWindow::setMWMHints(const QXlibMWMHints &mwmhints) -{ - Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); - if (mwmhints.flags != 0l) { - XChangeProperty(mScreen->display(), x_window, - atomForMotifWmHints, atomForMotifWmHints, 32, - PropModeReplace, (unsigned char *) &mwmhints, 5); - } else { - XDeleteProperty(mScreen->display(), x_window, atomForMotifWmHints); - } -} - -// Returns true if we should set WM_TRANSIENT_FOR on \a w -static inline bool isTransient(const QWidget *w) -{ - return ((w->windowType() == Qt::Dialog - || w->windowType() == Qt::Sheet - || w->windowType() == Qt::Tool - || w->windowType() == Qt::SplashScreen - || w->windowType() == Qt::ToolTip - || w->windowType() == Qt::Drawer - || w->windowType() == Qt::Popup) - && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); -} - -QVector<Atom> QXlibWindow::getNetWmState() const -{ - QVector<Atom> returnValue; - - // Don't read anything, just get the size of the property data - Atom actualType; - int actualFormat; - ulong propertyLength; - ulong bytesLeft; - uchar *propertyData = 0; - if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, 0, - False, XA_ATOM, &actualType, &actualFormat, - &propertyLength, &bytesLeft, &propertyData) == Success - && actualType == XA_ATOM && actualFormat == 32) { - returnValue.resize(bytesLeft / 4); - XFree((char*) propertyData); - - // fetch all data - if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, - returnValue.size(), False, XA_ATOM, &actualType, &actualFormat, - &propertyLength, &bytesLeft, &propertyData) != Success) { - returnValue.clear(); - } else if (propertyLength != (ulong)returnValue.size()) { - returnValue.resize(propertyLength); - } - - // put it into netWmState - if (!returnValue.isEmpty()) { - memcpy(returnValue.data(), propertyData, returnValue.size() * sizeof(Atom)); - } - XFree((char*) propertyData); - } - - return returnValue; -} - -Qt::WindowFlags QXlibWindow::setWindowFlags(Qt::WindowFlags flags) -{ -// Q_ASSERT(flags & Qt::Window); - mWindowFlags = flags; - -#ifdef MYX11_DEBUG - qDebug() << "QTestLiteWindow::setWindowFlags" << hex << x_window << "flags" << flags; -#endif - Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask)); - - if (type == Qt::ToolTip) - flags |= Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint; - if (type == Qt::Popup) - flags |= Qt::X11BypassWindowManagerHint; - - bool topLevel = (flags & Qt::Window); - bool popup = (type == Qt::Popup); - bool dialog = (type == Qt::Dialog - || type == Qt::Sheet); - bool desktop = (type == Qt::Desktop); - bool tool = (type == Qt::Tool || type == Qt::SplashScreen - || type == Qt::ToolTip || type == Qt::Drawer); - - Q_UNUSED(topLevel); - Q_UNUSED(dialog); - Q_UNUSED(desktop); - - bool tooltip = (type == Qt::ToolTip); - - XSetWindowAttributes wsa; - - QXlibMWMHints mwmhints; - mwmhints.flags = 0L; - mwmhints.functions = 0L; - mwmhints.decorations = 0; - mwmhints.input_mode = 0L; - mwmhints.status = 0L; - - - ulong wsa_mask = 0; - if (type != Qt::SplashScreen) { // && customize) { - mwmhints.flags |= MWM_HINTS_DECORATIONS; - - bool customize = flags & Qt::CustomizeWindowHint; - if (!(flags & Qt::FramelessWindowHint) && !(customize && !(flags & Qt::WindowTitleHint))) { - mwmhints.decorations |= MWM_DECOR_BORDER; - mwmhints.decorations |= MWM_DECOR_RESIZEH; - - if (flags & Qt::WindowTitleHint) - mwmhints.decorations |= MWM_DECOR_TITLE; - - if (flags & Qt::WindowSystemMenuHint) - mwmhints.decorations |= MWM_DECOR_MENU; - - if (flags & Qt::WindowMinimizeButtonHint) { - mwmhints.decorations |= MWM_DECOR_MINIMIZE; - mwmhints.functions |= MWM_FUNC_MINIMIZE; - } - - if (flags & Qt::WindowMaximizeButtonHint) { - mwmhints.decorations |= MWM_DECOR_MAXIMIZE; - mwmhints.functions |= MWM_FUNC_MAXIMIZE; - } - - if (flags & Qt::WindowCloseButtonHint) - mwmhints.functions |= MWM_FUNC_CLOSE; - } - } else { - // if type == Qt::SplashScreen - mwmhints.decorations = MWM_DECOR_ALL; - } - - if (tool) { - wsa.save_under = True; - wsa_mask |= CWSaveUnder; - } - - if (flags & Qt::X11BypassWindowManagerHint) { - wsa.override_redirect = True; - wsa_mask |= CWOverrideRedirect; - } -#if 0 - if (wsa_mask && initializeWindow) { - Q_ASSERT(id); - XChangeWindowAttributes(dpy, id, wsa_mask, &wsa); - } -#endif - if (mwmhints.functions != 0) { - mwmhints.flags |= MWM_HINTS_FUNCTIONS; - mwmhints.functions |= MWM_FUNC_MOVE | MWM_FUNC_RESIZE; - } else { - mwmhints.functions = MWM_FUNC_ALL; - } - - if (!(flags & Qt::FramelessWindowHint) - && flags & Qt::CustomizeWindowHint - && flags & Qt::WindowTitleHint - && !(flags & - (Qt::WindowMinimizeButtonHint - | Qt::WindowMaximizeButtonHint - | Qt::WindowCloseButtonHint))) { - // a special case - only the titlebar without any button - mwmhints.flags = MWM_HINTS_FUNCTIONS; - mwmhints.functions = MWM_FUNC_MOVE | MWM_FUNC_RESIZE; - mwmhints.decorations = 0; - } - - if (widget()->windowModality() == Qt::WindowModal) { - mwmhints.input_mode = MWM_INPUT_PRIMARY_APPLICATION_MODAL; - } else if (widget()->windowModality() == Qt::ApplicationModal) { - mwmhints.input_mode = MWM_INPUT_FULL_APPLICATION_MODAL; - } - - setMWMHints(mwmhints); - - QVector<Atom> netWmState = getNetWmState(); - - if (flags & Qt::WindowStaysOnTopHint) { - if (flags & Qt::WindowStaysOnBottomHint) - qWarning() << "QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time"; - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE)); - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP)); - } else if (flags & Qt::WindowStaysOnBottomHint) { - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW)); - } - if (widget()->isFullScreen()) { - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN)); - } - if (widget()->isMaximized()) { - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ)); - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT)); - } - if (widget()->windowModality() != Qt::NonModal) { - if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL))) - netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL)); - } - - if (!netWmState.isEmpty()) { - XChangeProperty(mScreen->display(), x_window, - QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), XA_ATOM, 32, PropModeReplace, - (unsigned char *) netWmState.data(), netWmState.size()); - } else { - XDeleteProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE)); - } - -//##### only if initializeWindow??? - - if (popup || tooltip) { // popup widget -#ifdef MYX11_DEBUG - qDebug() << "Doing XChangeWindowAttributes for popup" << wsa.override_redirect; -#endif - // set EWMH window types - // setNetWmWindowTypes(); - - wsa.override_redirect = True; - wsa.save_under = True; - XChangeWindowAttributes(mScreen->display(), x_window, CWOverrideRedirect | CWSaveUnder, - &wsa); - } else { -#ifdef MYX11_DEBUG - qDebug() << "Doing XChangeWindowAttributes for non-popup"; -#endif - } - - return flags; -} - -void QXlibWindow::setVisible(bool visible) -{ -#ifdef MYX11_DEBUG - qDebug() << "QTestLiteWindow::setVisible" << visible << hex << x_window; -#endif - if (isTransient(widget())) { - Window parentXWindow = x_window; - if (widget()->parentWidget()) { - QWidget *widgetParent = widget()->parentWidget()->window(); - if (widgetParent && widgetParent->platformWindow()) { - QXlibWindow *parentWidnow = static_cast<QXlibWindow *>(widgetParent->platformWindow()); - parentXWindow = parentWidnow->x_window; - } - } - XSetTransientForHint(mScreen->display(),x_window,parentXWindow); - } - - if (visible) { - //ensure that the window is viewed in correct position. - doSizeHints(); - XMapWindow(mScreen->display(), x_window); - } else { - XUnmapWindow(mScreen->display(), x_window); - } -} - -void QXlibWindow::setCursor(const Cursor &cursor) -{ - XDefineCursor(mScreen->display(), x_window, cursor); - XFlush(mScreen->display()); -} - -QPlatformGLContext *QXlibWindow::glContext() const -{ - if (!QApplicationPrivate::platformIntegration()->hasOpenGL()) - return 0; - if (!mGLContext) { - QXlibWindow *that = const_cast<QXlibWindow *>(this); -#if !defined(QT_NO_OPENGL) -#if !defined(QT_OPENGL_ES_2) - that->mGLContext = new QGLXContext(x_window, mScreen,widget()->platformWindowFormat()); -#else - EGLDisplay display = eglGetDisplay(mScreen->display()); - - QPlatformWindowFormat windowFormat = correctColorBuffers(widget()->platformWindowFormat()); - - EGLConfig config = q_configFromQPlatformWindowFormat(display,windowFormat); - QVector<EGLint> eglContextAttrs; - eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); - eglContextAttrs.append(2); - eglContextAttrs.append(EGL_NONE); - - EGLSurface eglSurface = eglCreateWindowSurface(display,config,(EGLNativeWindowType)x_window,0); - that->mGLContext = new QEGLPlatformContext(display, config, eglContextAttrs.data(), eglSurface, EGL_OPENGL_ES_API); -#endif -#endif - } - return mGLContext; -} - -Window QXlibWindow::xWindow() const -{ - return x_window; -} - -GC QXlibWindow::graphicsContext() const -{ - return gc; -} - -void QXlibWindow::doSizeHints() -{ - Q_ASSERT(widget()->testAttribute(Qt::WA_WState_Created)); - XSizeHints s; - s.flags = 0; - QRect g = geometry(); - s.x = g.x(); - s.y = g.y(); - s.width = g.width(); - s.height = g.height(); - s.flags |= USPosition; - s.flags |= PPosition; - s.flags |= USSize; - s.flags |= PSize; - s.flags |= PWinGravity; - s.win_gravity = QApplication::isRightToLeft() ? NorthEastGravity : NorthWestGravity; - XSetWMNormalHints(mScreen->display(), x_window, &s); -} - -QPlatformWindowFormat QXlibWindow::correctColorBuffers(const QPlatformWindowFormat &platformWindowFormat) const -{ - // I have only tested this setup on a dodgy intel setup, where I didn't use standard libs, - // so this might be not what we want to do :) - if ( !(platformWindowFormat.redBufferSize() == -1 && - platformWindowFormat.greenBufferSize() == -1 && - platformWindowFormat.blueBufferSize() == -1)) - return platformWindowFormat; - - QPlatformWindowFormat windowFormat = platformWindowFormat; - if (mScreen->depth() == 16) { - windowFormat.setRedBufferSize(5); - windowFormat.setGreenBufferSize(6); - windowFormat.setBlueBufferSize(5); - } else { - windowFormat.setRedBufferSize(8); - windowFormat.setGreenBufferSize(8); - windowFormat.setBlueBufferSize(8); - } - - return windowFormat; -} - -QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qtestlitewindow.h b/src/plugins/platforms/xlib/qtestlitewindow.h deleted file mode 100644 index ccf6867..0000000 --- a/src/plugins/platforms/xlib/qtestlitewindow.h +++ /dev/null @@ -1,145 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITEWINDOW_H -#define QTESTLITEWINDOW_H - -#include "qtestliteintegration.h" - -#include <QPlatformWindow> -#include <QEvent> - -#include <QObject> -#include <QImage> - -struct QXlibMWMHints { - ulong flags, functions, decorations; - long input_mode; - ulong status; -}; - -enum { - MWM_HINTS_FUNCTIONS = (1L << 0), - - MWM_FUNC_ALL = (1L << 0), - MWM_FUNC_RESIZE = (1L << 1), - MWM_FUNC_MOVE = (1L << 2), - MWM_FUNC_MINIMIZE = (1L << 3), - MWM_FUNC_MAXIMIZE = (1L << 4), - MWM_FUNC_CLOSE = (1L << 5), - - MWM_HINTS_DECORATIONS = (1L << 1), - - MWM_DECOR_ALL = (1L << 0), - MWM_DECOR_BORDER = (1L << 1), - MWM_DECOR_RESIZEH = (1L << 2), - MWM_DECOR_TITLE = (1L << 3), - MWM_DECOR_MENU = (1L << 4), - MWM_DECOR_MINIMIZE = (1L << 5), - MWM_DECOR_MAXIMIZE = (1L << 6), - - MWM_HINTS_INPUT_MODE = (1L << 2), - - MWM_INPUT_MODELESS = 0L, - MWM_INPUT_PRIMARY_APPLICATION_MODAL = 1L, - MWM_INPUT_FULL_APPLICATION_MODAL = 3L -}; - -class QXlibWindow : public QPlatformWindow -{ -public: - QXlibWindow(QWidget *window); - ~QXlibWindow(); - - - void mousePressEvent(XButtonEvent*); - void handleMouseEvent(QEvent::Type, XButtonEvent *ev); - - void handleCloseEvent(); - void handleEnterEvent(); - void handleLeaveEvent(); - void handleFocusInEvent(); - void handleFocusOutEvent(); - - void resizeEvent(XConfigureEvent *configure_event); - void paintEvent(); - - void requestActivateWindow(); - - void setGeometry(const QRect &rect); - - Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); - Qt::WindowFlags windowFlags() const; - void setVisible(bool visible); - WId winId() const; - void setParent(const QPlatformWindow *window); - void raise(); - void lower(); - void setWindowTitle(const QString &title); - - void setCursor(const Cursor &cursor); - - QPlatformGLContext *glContext() const; - - Window xWindow() const; - GC graphicsContext() const; - -protected: - QVector<Atom> getNetWmState() const; - void setMWMHints(const QXlibMWMHints &mwmhints); - QXlibMWMHints getMWMHints() const; - - void doSizeHints(); - -private: - QPlatformWindowFormat correctColorBuffers(const QPlatformWindowFormat &windowFormat)const; - - Window x_window; - GC gc; - - GC createGC(); - - QPlatformGLContext *mGLContext; - QXlibScreen *mScreen; - Qt::WindowFlags mWindowFlags; -}; - -#endif diff --git a/src/plugins/platforms/xlib/qtestlitewindowsurface.cpp b/src/plugins/platforms/xlib/qtestlitewindowsurface.cpp deleted file mode 100644 index 088730d..0000000 --- a/src/plugins/platforms/xlib/qtestlitewindowsurface.cpp +++ /dev/null @@ -1,224 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qtestlitewindowsurface.h" -#include "qtestliteintegration.h" - -#include <QtCore/qdebug.h> -#include <QWindowSystemInterface> - -#include "qtestlitewindow.h" -#include "qtestlitescreen.h" - -# include <sys/ipc.h> -# include <sys/shm.h> -# include <X11/extensions/XShm.h> - -QT_BEGIN_NAMESPACE - - -struct QXlibShmImageInfo { - QXlibShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} - ~QXlibShmImageInfo() { destroy(); } - - void destroy(); - - XShmSegmentInfo shminfo; - XImage *image; - Display *display; -}; - - -#ifndef DONT_USE_MIT_SHM -void QXlibShmImageInfo::destroy() -{ - XShmDetach (display, &shminfo); - XDestroyImage (image); - shmdt (shminfo.shmaddr); - shmctl (shminfo.shmid, IPC_RMID, 0); -} -#endif - -void QXlibWindowSurface::resizeShmImage(int width, int height) -{ - -#ifdef DONT_USE_MIT_SHM - shm_img = QImage(width, height, QImage::Format_RGB32); -#else - - QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(window()); - if (image_info) - image_info->destroy(); - else - image_info = new QXlibShmImageInfo(screen->display()); - - Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); - - - XImage *image = XShmCreateImage (screen->display(), visual, 24, ZPixmap, 0, - &image_info->shminfo, width, height); - - - image_info->shminfo.shmid = shmget (IPC_PRIVATE, - image->bytes_per_line * image->height, IPC_CREAT|0777); - - image_info->shminfo.shmaddr = image->data = (char*)shmat (image_info->shminfo.shmid, 0, 0); - image_info->shminfo.readOnly = False; - - image_info->image = image; - - Status shm_attach_status = XShmAttach(screen->display(), &image_info->shminfo); - - Q_ASSERT(shm_attach_status == True); - - shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, QImage::Format_RGB32 ); -#endif - painted = false; -} - - -void QXlibWindowSurface::resizeBuffer(QSize s) -{ - if (shm_img.size() != s) - resizeShmImage(s.width(), s.height()); -} - -QSize QXlibWindowSurface::bufferSize() const -{ - return shm_img.size(); -} - -QXlibWindowSurface::QXlibWindowSurface (QWidget *window) - : QWindowSurface(window), - painted(false), image_info(0) -{ - xw = static_cast<QXlibWindow*>(window->platformWindow()); -// qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; -} - -QXlibWindowSurface::~QXlibWindowSurface() -{ - delete image_info; -} - -QPaintDevice *QXlibWindowSurface::paintDevice() -{ - return &shm_img; -} - - -void QXlibWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) -{ - Q_UNUSED(widget); - Q_UNUSED(region); - Q_UNUSED(offset); - - if (!painted) - return; - - QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); - GC gc = xw->graphicsContext(); - Window window = xw->xWindow(); -#ifdef DONT_USE_MIT_SHM - // just convert the image every time... - if (!shm_img.isNull()) { - Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); - - QImage image = shm_img; - //img.convertToFormat( - XImage *xi = XCreateImage(screen->display(), visual, 24, ZPixmap, - 0, (char *) image.scanLine(0), image.width(), image.height(), - 32, image.bytesPerLine()); - - int x = 0; - int y = 0; - - /*int r =*/ XPutImage(screen->display(), window, gc, xi, 0, 0, x, y, image.width(), image.height()); - - xi->data = 0; // QImage owns these bits - XDestroyImage(xi); - } -#else - // Use MIT_SHM - if (image_info && image_info->image) { - //qDebug() << "Here we go" << image_info->image->width << image_info->image->height; - int x = 0; - int y = 0; - - // We could set send_event to true, and then use the ShmCompletion to synchronize, - // but let's do like Qt/11 and just use XSync - XShmPutImage (screen->display(), window, gc, image_info->image, 0, 0, - x, y, image_info->image->width, image_info->image->height, - /*send_event*/ False); - - XSync(screen->display(), False); - } -#endif -} - -// from qwindowsurface.cpp -extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); - -bool QXlibWindowSurface::scroll(const QRegion &area, int dx, int dy) -{ - if (shm_img.isNull()) - return false; - - const QVector<QRect> rects = area.rects(); - for (int i = 0; i < rects.size(); ++i) - qt_scrollRectInImage(shm_img, rects.at(i), QPoint(dx, dy)); - - return true; -} - - -void QXlibWindowSurface::beginPaint(const QRegion ®ion) -{ - Q_UNUSED(region); - resizeBuffer(size()); -} - -void QXlibWindowSurface::endPaint(const QRegion ®ion) -{ - Q_UNUSED(region); - painted = true; //there is content in the buffer -} -QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qtestlitewindowsurface.h b/src/plugins/platforms/xlib/qtestlitewindowsurface.h deleted file mode 100644 index 12b4c60..0000000 --- a/src/plugins/platforms/xlib/qtestlitewindowsurface.h +++ /dev/null @@ -1,86 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QWINDOWSURFACE_TESTLITE_H -#define QWINDOWSURFACE_TESTLITE_H - -#include <QtGui/private/qwindowsurface_p.h> - - -QT_BEGIN_NAMESPACE - -class QXlibWindow; -class QXlibIntegration; -class QXlibScreen; -class QXlibShmImageInfo; - -class QXlibWindowSurface : public QWindowSurface -{ -public: - QXlibWindowSurface (QWidget *window); - ~QXlibWindowSurface(); - - QPaintDevice *paintDevice(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); - bool scroll(const QRegion &area, int dx, int dy); - - void beginPaint(const QRegion ®ion); - void endPaint(const QRegion ®ion); - -private: - bool painted; - void resizeBuffer(QSize); - QSize bufferSize() const; - - - void resizeShmImage(int width, int height); - - QImage shm_img; - QXlibShmImageInfo *image_info; - - QXlibWindow *xw; - -}; - - -QT_END_NAMESPACE - -#endif diff --git a/src/plugins/platforms/xlib/qxlibclipboard.cpp b/src/plugins/platforms/xlib/qxlibclipboard.cpp new file mode 100644 index 0000000..1264b5a --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibclipboard.cpp @@ -0,0 +1,676 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestliteclipboard.h" + +#include "qtestlitescreen.h" +#include "qtestlitemime.h" + +#include <private/qapplication_p.h> + +#include <QtCore/QDebug> + +class QXlibClipboardMime : public QXlibMime +{ + Q_OBJECT +public: + QXlibClipboardMime(QClipboard::Mode mode, QXlibClipboard *clipboard) + : QXlibMime() + , m_clipboard(clipboard) + { + switch (mode) { + case QClipboard::Selection: + modeAtom = XA_PRIMARY; + break; + + case QClipboard::Clipboard: + modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); + break; + + default: + qWarning("QTestLiteMime: Internal error: Unsupported clipboard mode"); + break; + } + } + +protected: + QStringList formats_sys() const + { + if (empty()) + return QStringList(); + + if (!formatList.count()) { + QXlibClipboardMime *that = const_cast<QXlibClipboardMime *>(this); + // get the list of targets from the current clipboard owner - we do this + // once so that multiple calls to this function don't require multiple + // server round trips... + that->format_atoms = m_clipboard->getDataInFormat(modeAtom,QXlibStatic::atom(QXlibStatic::TARGETS)); + + if (format_atoms.size() > 0) { + Atom *targets = (Atom *) format_atoms.data(); + int size = format_atoms.size() / sizeof(Atom); + + for (int i = 0; i < size; ++i) { + if (targets[i] == 0) + continue; + + QStringList formatsForAtom = mimeFormatsForAtom(m_clipboard->screen()->display(),targets[i]); + for (int j = 0; j < formatsForAtom.size(); ++j) { + if (!formatList.contains(formatsForAtom.at(j))) + that->formatList.append(formatsForAtom.at(j)); + } + } + } + } + + return formatList; + } + + bool hasFormat_sys(const QString &format) const + { + QStringList list = formats(); + return list.contains(format); + } + + QVariant retrieveData_sys(const QString &fmt, QVariant::Type requestedType) const + { + if (fmt.isEmpty() || empty()) + return QByteArray(); + + (void)formats(); // trigger update of format list + + QList<Atom> atoms; + Atom *targets = (Atom *) format_atoms.data(); + int size = format_atoms.size() / sizeof(Atom); + for (int i = 0; i < size; ++i) + atoms.append(targets[i]); + + QByteArray encoding; + Atom fmtatom = mimeAtomForFormat(m_clipboard->screen()->display(),fmt, requestedType, atoms, &encoding); + + if (fmtatom == 0) + return QVariant(); + + return mimeConvertToFormat(m_clipboard->screen()->display(),fmtatom, m_clipboard->getDataInFormat(modeAtom,fmtatom), fmt, requestedType, encoding); + } +private: + bool empty() const + { + Window win = XGetSelectionOwner(m_clipboard->screen()->display(), modeAtom); + + return win == XNone; + } + + + Atom modeAtom; + QXlibClipboard *m_clipboard; + QStringList formatList; + QByteArray format_atoms; +}; + +const int QXlibClipboard::clipboard_timeout = 5000; + +QXlibClipboard::QXlibClipboard(QXlibScreen *screen) + : QPlatformClipboard() + , m_screen(screen) + , m_xClipboard(0) + , m_clientClipboard(0) + , m_xSelection(0) + , m_clientSelection(0) + , m_requestor(XNone) + , m_owner(XNone) +{ +} + +const QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) const +{ + if (mode == QClipboard::Clipboard) { + if (!m_xClipboard) { + QXlibClipboard *that = const_cast<QXlibClipboard *>(this); + that->m_xClipboard = new QXlibClipboardMime(mode,that); + } + Window clipboardOwner = XGetSelectionOwner(screen()->display(),QXlibStatic::atom(QXlibStatic::CLIPBOARD)); + if (clipboardOwner == owner()) { + return m_clientClipboard; + } else { + return m_xClipboard; + } + } else if (mode == QClipboard::Selection) { + if (!m_xSelection) { + QXlibClipboard *that = const_cast<QXlibClipboard *>(this); + that->m_xSelection = new QXlibClipboardMime(mode,that); + } + Window clipboardOwner = XGetSelectionOwner(screen()->display(),XA_PRIMARY); + if (clipboardOwner == owner()) { + return m_clientSelection; + } else { + return m_xSelection; + } + } + return 0; +} + +void QXlibClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) +{ + Atom modeAtom; + QMimeData **d; + switch (mode) { + case QClipboard::Selection: + modeAtom = XA_PRIMARY; + d = &m_clientSelection; + break; + + case QClipboard::Clipboard: + modeAtom = QXlibStatic::atom(QXlibStatic::CLIPBOARD); + d = &m_clientClipboard; + break; + + default: + qWarning("QClipboard::setMimeData: unsupported mode '%d'", mode); + return; + } + + Window newOwner; + + if (! data) { // no data, clear clipboard contents + newOwner = XNone; + } else { + newOwner = owner(); + + *d = data; + } + + XSetSelectionOwner(m_screen->display(), modeAtom, newOwner, CurrentTime); + + if (XGetSelectionOwner(m_screen->display(), modeAtom) != newOwner) { + qWarning("QClipboard::setData: Cannot set X11 selection owner"); + } + +} + +bool QXlibClipboard::supportsMode(QClipboard::Mode mode) const +{ + if (mode == QClipboard::Clipboard || mode == QClipboard::Selection) + return true; + return false; +} + + +QXlibScreen * QXlibClipboard::screen() const +{ + return m_screen; +} + +Window QXlibClipboard::requestor() const +{ + if (!m_requestor) { + int x = 0, y = 0, w = 3, h = 3; + QXlibClipboard *that = const_cast<QXlibClipboard *>(this); + Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), + x, y, w, h, 0 /*border_width*/, + m_screen->blackPixel(), m_screen->whitePixel()); + that->setRequestor(window); + } + return m_requestor; +} + +void QXlibClipboard::setRequestor(Window window) +{ + if (m_requestor != XNone) { + XDestroyWindow(m_screen->display(),m_requestor); + } + m_requestor = window; +} + +Window QXlibClipboard::owner() const +{ + if (!m_owner) { + int x = 0, y = 0, w = 3, h = 3; + QXlibClipboard *that = const_cast<QXlibClipboard *>(this); + Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), + x, y, w, h, 0 /*border_width*/, + m_screen->blackPixel(), m_screen->whitePixel()); + that->setOwner(window); + } + return m_owner; +} + +void QXlibClipboard::setOwner(Window window) +{ + if (m_owner != XNone){ + XDestroyWindow(m_screen->display(),m_owner); + } + m_owner = window; +} + +Atom QXlibClipboard::sendTargetsSelection(QMimeData *d, Window window, Atom property) +{ + QVector<Atom> types; + QStringList formats = QInternalMimeData::formatsHelper(d); + for (int i = 0; i < formats.size(); ++i) { + QList<Atom> atoms = QXlibMime::mimeAtomsForFormat(screen()->display(),formats.at(i)); + for (int j = 0; j < atoms.size(); ++j) { + if (!types.contains(atoms.at(j))) + types.append(atoms.at(j)); + } + } + types.append(QXlibStatic::atom(QXlibStatic::TARGETS)); + types.append(QXlibStatic::atom(QXlibStatic::MULTIPLE)); + types.append(QXlibStatic::atom(QXlibStatic::TIMESTAMP)); + types.append(QXlibStatic::atom(QXlibStatic::SAVE_TARGETS)); + + XChangeProperty(screen()->display(), window, property, XA_ATOM, 32, + PropModeReplace, (uchar *) types.data(), types.size()); + return property; +} + +Atom QXlibClipboard::sendSelection(QMimeData *d, Atom target, Window window, Atom property) +{ + Atom atomFormat = target; + int dataFormat = 0; + QByteArray data; + + QString fmt = QXlibMime::mimeAtomToString(screen()->display(), target); + if (fmt.isEmpty()) { // Not a MIME type we have + qDebug() << "QClipboard: send_selection(): converting to type '%s' is not supported" << fmt.data(); + return XNone; + } + qDebug() << "QClipboard: send_selection(): converting to type '%s'" << fmt.data(); + + if (QXlibMime::mimeDataForAtom(screen()->display(),target, d, &data, &atomFormat, &dataFormat)) { + + // don't allow INCR transfers when using MULTIPLE or to + // Motif clients (since Motif doesn't support INCR) + static Atom motif_clip_temporary = QXlibStatic::atom(QXlibStatic::CLIP_TEMPORARY); + bool allow_incr = property != motif_clip_temporary; + + // X_ChangeProperty protocol request is 24 bytes + const int increment = (XMaxRequestSize(screen()->display()) * 4) - 24; + if (data.size() > increment && allow_incr) { + long bytes = data.size(); + XChangeProperty(screen()->display(), window, property, + QXlibStatic::atom(QXlibStatic::INCR), 32, PropModeReplace, (uchar *) &bytes, 1); + +// (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment); + qDebug() << "not implemented INCRT just YET!"; + return property; + } + + // make sure we can perform the XChangeProperty in a single request + if (data.size() > increment) + return XNone; // ### perhaps use several XChangeProperty calls w/ PropModeAppend? + int dataSize = data.size() / (dataFormat / 8); + // use a single request to transfer data + XChangeProperty(screen()->display(), window, property, atomFormat, + dataFormat, PropModeReplace, (uchar *) data.data(), + dataSize); + } + return property; +} + +void QXlibClipboard::handleSelectionRequest(XEvent *xevent) +{ + XSelectionRequestEvent *req = &xevent->xselectionrequest; + + if (requestor() && req->requestor == requestor()) { + qDebug() << "This should be caught before"; + return; + } + + XEvent event; + event.xselection.type = SelectionNotify; + event.xselection.display = req->display; + event.xselection.requestor = req->requestor; + event.xselection.selection = req->selection; + event.xselection.target = req->target; + event.xselection.property = XNone; + event.xselection.time = req->time; + + QMimeData *d; + if (req->selection == XA_PRIMARY) { + d = m_clientSelection; + } else if (req->selection == QXlibStatic::atom(QXlibStatic::CLIPBOARD)) { + d = m_clientClipboard; + } else { + qWarning("QClipboard: Unknown selection '%lx'", req->selection); + XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + return; + } + + if (!d) { + qWarning("QClipboard: Cannot transfer data, no data available"); + XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + return; + } + + Atom xa_targets = QXlibStatic::atom(QXlibStatic::TARGETS); + Atom xa_multiple = QXlibStatic::atom(QXlibStatic::MULTIPLE); + Atom xa_timestamp = QXlibStatic::atom(QXlibStatic::TIMESTAMP); + + struct AtomPair { Atom target; Atom property; } *multi = 0; + Atom multi_type = XNone; + int multi_format = 0; + int nmulti = 0; + int imulti = -1; + bool multi_writeback = false; + + if (req->target == xa_multiple) { + QByteArray multi_data; + if (req->property == XNone + || !clipboardReadProperty(req->requestor, req->property, false, &multi_data, + 0, &multi_type, &multi_format) + || multi_format != 32) { + // MULTIPLE property not formatted correctly + XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + return; + } + nmulti = multi_data.size()/sizeof(*multi); + multi = new AtomPair[nmulti]; + memcpy(multi,multi_data.data(),multi_data.size()); + imulti = 0; + } + + for (; imulti < nmulti; ++imulti) { + Atom target; + Atom property; + + if (multi) { + target = multi[imulti].target; + property = multi[imulti].property; + } else { + target = req->target; + property = req->property; + if (property == XNone) // obsolete client + property = target; + } + + Atom ret = XNone; + if (target == XNone || property == XNone) { + ; + } else if (target == xa_timestamp) { +// if (d->timestamp != CurrentTime) { +// XChangeProperty(screen()->display(), req->requestor, property, XA_INTEGER, 32, +// PropModeReplace, CurrentTime, 1); +// ret = property; +// } else { +// qWarning("QClipboard: Invalid data timestamp"); +// } + } else if (target == xa_targets) { + ret = sendTargetsSelection(d, req->requestor, property); + } else { + ret = sendSelection(d, target, req->requestor, property); + } + + if (nmulti > 0) { + if (ret == XNone) { + multi[imulti].property = XNone; + multi_writeback = true; + } + } else { + event.xselection.property = ret; + break; + } + } + + if (nmulti > 0) { + if (multi_writeback) { + // according to ICCCM 2.6.2 says to put None back + // into the original property on the requestor window + XChangeProperty(screen()->display(), req->requestor, req->property, multi_type, 32, + PropModeReplace, (uchar *) multi, nmulti * 2); + } + + delete [] multi; + event.xselection.property = req->property; + } + + // send selection notify to requestor + XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); +} + +static inline int maxSelectionIncr(Display *dpy) +{ return XMaxRequestSize(dpy) > 65536 ? 65536*4 : XMaxRequestSize(dpy)*4 - 100; } + +bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const +{ + int maxsize = maxSelectionIncr(screen()->display()); + ulong bytes_left; // bytes_after + ulong length; // nitems + uchar *data; + Atom dummy_type; + int dummy_format; + int r; + + if (!type) // allow null args + type = &dummy_type; + if (!format) + format = &dummy_format; + + // Don't read anything, just get the size of the property data + r = XGetWindowProperty(screen()->display(), win, property, 0, 0, False, + AnyPropertyType, type, format, + &length, &bytes_left, &data); + if (r != Success || (type && *type == XNone)) { + buffer->resize(0); + return false; + } + XFree((char*)data); + + int offset = 0, buffer_offset = 0, format_inc = 1, proplen = bytes_left; + + switch (*format) { + case 8: + default: + format_inc = sizeof(char) / 1; + break; + + case 16: + format_inc = sizeof(short) / 2; + proplen *= sizeof(short) / 2; + break; + + case 32: + format_inc = sizeof(long) / 4; + proplen *= sizeof(long) / 4; + break; + } + + int newSize = proplen; + buffer->resize(newSize); + + bool ok = (buffer->size() == newSize); + + if (ok && newSize) { + // could allocate buffer + + while (bytes_left) { + // more to read... + + r = XGetWindowProperty(screen()->display(), win, property, offset, maxsize/4, + False, AnyPropertyType, type, format, + &length, &bytes_left, &data); + if (r != Success || (type && *type == XNone)) + break; + + offset += length / (32 / *format); + length *= format_inc * (*format) / 8; + + // Here we check if we get a buffer overflow and tries to + // recover -- this shouldn't normally happen, but it doesn't + // hurt to be defensive + if ((int)(buffer_offset + length) > buffer->size()) { + length = buffer->size() - buffer_offset; + + // escape loop + bytes_left = 0; + } + + memcpy(buffer->data() + buffer_offset, data, length); + buffer_offset += length; + + XFree((char*)data); + } + + if (*format == 8 && *type == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { + // convert COMPOUND_TEXT to a multibyte string + XTextProperty textprop; + textprop.encoding = *type; + textprop.format = *format; + textprop.nitems = buffer_offset; + textprop.value = (unsigned char *) buffer->data(); + + char **list_ret = 0; + int count; + if (XmbTextPropertyToTextList(screen()->display(), &textprop, &list_ret, + &count) == Success && count && list_ret) { + offset = buffer_offset = strlen(list_ret[0]); + buffer->resize(offset); + memcpy(buffer->data(), list_ret[0], offset); + } + if (list_ret) XFreeStringList(list_ret); + } + } + + // correct size, not 0-term. + if (size) + *size = buffer_offset; + + if (deleteProperty) + XDeleteProperty(screen()->display(), win, property); + + XFlush(screen()->display()); + + return ok; +} + +QByteArray QXlibClipboard::clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm) +{ + XEvent event; + + QByteArray buf; + QByteArray tmp_buf; + bool alloc_error = false; + int length; + int offset = 0; + + if (nbytes > 0) { + // Reserve buffer + zero-terminator (for text data) + // We want to complete the INCR transfer even if we cannot + // allocate more memory + buf.resize(nbytes+1); + alloc_error = buf.size() != nbytes+1; + } + + for (;;) { + XFlush(screen()->display()); + if (!screen()->waitForClipboardEvent(win,PropertyNotify,&event,clipboard_timeout)) + break; + if (event.xproperty.atom != property || + event.xproperty.state != PropertyNewValue) + continue; + if (clipboardReadProperty(win, property, true, &tmp_buf, &length, 0, 0)) { + if (length == 0) { // no more data, we're done + if (nullterm) { + buf.resize(offset+1); + buf[offset] = '\0'; + } else { + buf.resize(offset); + } + return buf; + } else if (!alloc_error) { + if (offset+length > (int)buf.size()) { + buf.resize(offset+length+65535); + if (buf.size() != offset+length+65535) { + alloc_error = true; + length = buf.size() - offset; + } + } + memcpy(buf.data()+offset, tmp_buf.constData(), length); + tmp_buf.resize(0); + offset += length; + } + } else { + break; + } + } + + // timed out ... create a new requestor window, otherwise the requestor + // could consider next request to be still part of this timed out request + setRequestor(0); + + return QByteArray(); +} + +QByteArray QXlibClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) +{ + QByteArray buf; + + Window win = requestor(); + + XSelectInput(screen()->display(), win, NoEventMask); // don't listen for any events + + XDeleteProperty(screen()->display(), win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION)); + XConvertSelection(screen()->display(), modeAtom, fmtatom, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), win, CurrentTime); + XSync(screen()->display(), false); + + XEvent xevent; + if (!screen()->waitForClipboardEvent(win,SelectionNotify,&xevent,clipboard_timeout) || + xevent.xselection.property == XNone) { + return buf; + } + + Atom type; + XSelectInput(screen()->display(), win, PropertyChangeMask); + + if (clipboardReadProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), true, &buf, 0, &type, 0)) { + if (type == QXlibStatic::atom(QXlibStatic::INCR)) { + int nbytes = buf.size() >= 4 ? *((int*)buf.data()) : 0; + buf = clipboardReadIncrementalProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), nbytes, false); + } + } + + XSelectInput(screen()->display(), win, NoEventMask); + + + return buf; +} + +#include "qtestliteclipboard.moc" diff --git a/src/plugins/platforms/xlib/qxlibclipboard.h b/src/plugins/platforms/xlib/qxlibclipboard.h new file mode 100644 index 0000000..109714c --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibclipboard.h @@ -0,0 +1,94 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITECLIPBOARD_H +#define QTESTLITECLIPBOARD_H + +#include <QPlatformClipboard> +#include "qtestlitestaticinfo.h" + +class QXlibScreen; +class QXlibClipboard : public QPlatformClipboard +{ +public: + QXlibClipboard(QXlibScreen *screen); + + const QMimeData *mimeData(QClipboard::Mode mode) const; + void setMimeData(QMimeData *data, QClipboard::Mode mode); + + bool supportsMode(QClipboard::Mode mode) const; + + QXlibScreen *screen() const; + + Window requestor() const; + void setRequestor(Window window); + + Window owner() const; + + void handleSelectionRequest(XEvent *event); + + bool clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const; + QByteArray clipboardReadIncrementalProperty(Window win, Atom property, int nbytes, bool nullterm); + + QByteArray getDataInFormat(Atom modeAtom, Atom fmtatom); + +private: + void setOwner(Window window); + + Atom sendTargetsSelection(QMimeData *d, Window window, Atom property); + Atom sendSelection(QMimeData *d, Atom target, Window window, Atom property); + + QXlibScreen *m_screen; + + QMimeData *m_xClipboard; + QMimeData *m_clientClipboard; + + QMimeData *m_xSelection; + QMimeData *m_clientSelection; + + Window m_requestor; + Window m_owner; + + static const int clipboard_timeout; + +}; + +#endif // QTESTLITECLIPBOARD_H diff --git a/src/plugins/platforms/xlib/qxlibcursor.cpp b/src/plugins/platforms/xlib/qxlibcursor.cpp new file mode 100644 index 0000000..2f7cfbf --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibcursor.cpp @@ -0,0 +1,199 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitecursor.h" + +#include "qtestliteintegration.h" +#include "qtestlitescreen.h" +#include "qtestlitewindow.h" + +#include <QtGui/QBitmap> + +#include <X11/cursorfont.h> + +QT_BEGIN_NAMESPACE + +QXlibCursor::QXlibCursor(QXlibScreen *screen) + : QPlatformCursor(screen) +{ +} + +void QXlibCursor::changeCursor(QCursor *cursor, QWidget *widget) +{ + QXlibWindow *w = 0; + if (widget) { + QWidget *window = widget->window(); + w = static_cast<QXlibWindow*>(window->platformWindow()); + } else { + // No X11 cursor control when there is no widget under the cursor + return; + } + + if (!w) + return; + + int id = cursor->handle(); + + Cursor c; + if (!cursorMap.contains(id)) { + if (cursor->shape() == Qt::BitmapCursor) + c = createCursorBitmap(cursor); + else + c = createCursorShape(cursor->shape()); + if (!c) { + return; + } + cursorMap.insert(id, c); + } else { + c = cursorMap.value(id); + } + + w->setCursor(c); +} + +Cursor QXlibCursor::createCursorBitmap(QCursor * cursor) +{ + XColor bg, fg; + bg.red = 255 << 8; + bg.green = 255 << 8; + bg.blue = 255 << 8; + fg.red = 0; + fg.green = 0; + fg.blue = 0; + QPoint spot = cursor->hotSpot(); + Window rootwin = testLiteScreen()->rootWindow(); + + QImage mapImage = cursor->bitmap()->toImage().convertToFormat(QImage::Format_MonoLSB); + QImage maskImage = cursor->mask()->toImage().convertToFormat(QImage::Format_MonoLSB); + + int width = cursor->bitmap()->width(); + int height = cursor->bitmap()->height(); + int bytesPerLine = mapImage.bytesPerLine(); + int destLineSize = width / 8; + if (width % 8) + destLineSize++; + + const uchar * map = mapImage.bits(); + const uchar * mask = maskImage.bits(); + + char * mapBits = new char[height * destLineSize]; + char * maskBits = new char[height * destLineSize]; + for (int i = 0; i < height; i++) { + memcpy(mapBits + (destLineSize * i),map + (bytesPerLine * i), destLineSize); + memcpy(maskBits + (destLineSize * i),mask + (bytesPerLine * i), destLineSize); + } + + Pixmap cp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, mapBits, width, height); + Pixmap mp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, maskBits, width, height); + Cursor c = XCreatePixmapCursor(testLiteScreen()->display(), cp, mp, &fg, &bg, spot.x(), spot.y()); + XFreePixmap(testLiteScreen()->display(), cp); + XFreePixmap(testLiteScreen()->display(), mp); + delete[] mapBits; + delete[] maskBits; + + return c; +} + +Cursor QXlibCursor::createCursorShape(int cshape) +{ + Cursor cursor = 0; + + if (cshape < 0 || cshape > Qt::LastCursor) + return 0; + + switch (cshape) { + case Qt::ArrowCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_left_ptr); + break; + case Qt::UpArrowCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_center_ptr); + break; + case Qt::CrossCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_crosshair); + break; + case Qt::WaitCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); + break; + case Qt::IBeamCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_xterm); + break; + case Qt::SizeAllCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_fleur); + break; + case Qt::PointingHandCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_hand2); + break; + case Qt::SizeBDiagCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_top_right_corner); + break; + case Qt::SizeFDiagCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_bottom_right_corner); + break; + case Qt::SizeVerCursor: + case Qt::SplitVCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_v_double_arrow); + break; + case Qt::SizeHorCursor: + case Qt::SplitHCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_h_double_arrow); + break; + case Qt::WhatsThisCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_question_arrow); + break; + case Qt::ForbiddenCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_circle); + break; + case Qt::BusyCursor: + cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); + break; + + default: //default cursor for all the rest + break; + } + return cursor; +} + +QXlibScreen * QXlibCursor::testLiteScreen() const +{ + return static_cast<QXlibScreen *>(screen); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibcursor.h b/src/plugins/platforms/xlib/qxlibcursor.h new file mode 100644 index 0000000..db9f9e2 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibcursor.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITECURSOR_H +#define QTESTLITECURSOR_H + +#include <QtGui/QPlatformCursor> + +#include "qtestliteintegration.h" + +QT_BEGIN_NAMESPACE + +class QXlibCursor : QPlatformCursor +{ +public: + QXlibCursor(QXlibScreen *screen); + + void changeCursor(QCursor * cursor, QWidget * widget); +private: + + Cursor createCursorBitmap(QCursor * cursor); + Cursor createCursorShape(int cshape); + + QXlibScreen *testLiteScreen() const; + QMap<int, Cursor> cursorMap; +}; + +QT_END_NAMESPACE + +#endif // QTESTLITECURSOR_H diff --git a/src/plugins/platforms/xlib/qxlibeglintegration.cpp b/src/plugins/platforms/xlib/qxlibeglintegration.cpp new file mode 100644 index 0000000..9bbe0ca --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibeglintegration.cpp @@ -0,0 +1,186 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestliteeglintegration.h" + +static int countBits(unsigned long mask) +{ + int count = 0; + while (mask != 0) { + if (mask & 1) + ++count; + mask >>= 1; + } + return count; +} + +VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLConfig config) +{ + VisualID visualId = 0; + EGLint eglValue = 0; + + EGLDisplay eglDisplay = eglGetDisplay(display); + + EGLint configRedSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_RED_SIZE, &configRedSize); + + EGLint configGreenSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_GREEN_SIZE, &configGreenSize); + + EGLint configBlueSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_BLUE_SIZE, &configBlueSize); + + EGLint configAlphaSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_ALPHA_SIZE, &configAlphaSize); + + eglGetConfigAttrib(eglDisplay, config, EGL_CONFIG_ID, &eglValue); + int configId = eglValue; + + // See if EGL provided a valid VisualID: + eglGetConfigAttrib(eglDisplay, config, EGL_NATIVE_VISUAL_ID, &eglValue); + visualId = (VisualID)eglValue; + if (visualId) { + // EGL has suggested a visual id, so get the rest of the visual info for that id: + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + visualInfoTemplate.visualid = visualId; + + XVisualInfo *chosenVisualInfo; + int matchingCount = 0; + chosenVisualInfo = XGetVisualInfo(display, VisualIDMask, &visualInfoTemplate, &matchingCount); + if (chosenVisualInfo) { + // Skip size checks if implementation supports non-matching visual + // and config (http://bugreports.qt.nokia.com/browse/QTBUG-9444). + if (q_hasEglExtension(eglDisplay,"EGL_NV_post_convert_rounding")) { + XFree(chosenVisualInfo); + return visualId; + } + + int visualRedSize = countBits(chosenVisualInfo->red_mask); + int visualGreenSize = countBits(chosenVisualInfo->green_mask); + int visualBlueSize = countBits(chosenVisualInfo->blue_mask); + int visualAlphaSize = -1; // Need XRender to tell us the alpha channel size + + bool visualMatchesConfig = false; + if ( visualRedSize == configRedSize && + visualGreenSize == configGreenSize && + visualBlueSize == configBlueSize ) + { + // We need XRender to check the alpha channel size of the visual. If we don't have + // the alpha size, we don't check it against the EGL config's alpha size. + if (visualAlphaSize >= 0) + visualMatchesConfig = visualAlphaSize == configAlphaSize; + else + visualMatchesConfig = true; + } + + if (!visualMatchesConfig) { + if (visualAlphaSize >= 0) { + qWarning("Warning: EGL suggested using X Visual ID %d (ARGB%d%d%d%d) for EGL config %d (ARGB%d%d%d%d), but this is incompatable", + (int)visualId, visualAlphaSize, visualRedSize, visualGreenSize, visualBlueSize, + configId, configAlphaSize, configRedSize, configGreenSize, configBlueSize); + } else { + qWarning("Warning: EGL suggested using X Visual ID %d (RGB%d%d%d) for EGL config %d (RGB%d%d%d), but this is incompatable", + (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, + configId, configRedSize, configGreenSize, configBlueSize); + } + visualId = 0; + } + } else { + qWarning("Warning: EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", + (int)visualId, configId); + visualId = 0; + } + XFree(chosenVisualInfo); + } +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + else + qDebug("EGL did not suggest a VisualID (EGL_NATIVE_VISUAL_ID was zero) for EGLConfig %d", configId); +#endif + + if (visualId) { +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + if (configAlphaSize > 0) + qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, configId); + else + qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId); +#endif + return visualId; + } + + // Finally, try to + // use XGetVisualInfo and only use the bit depths to match on: + if (!visualId) { + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + XVisualInfo *matchingVisuals; + int matchingCount = 0; + + visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize + configAlphaSize; + matchingVisuals = XGetVisualInfo(display, + VisualDepthMask, + &visualInfoTemplate, + &matchingCount); + if (!matchingVisuals) { + // Try again without taking the alpha channel into account: + visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize; + matchingVisuals = XGetVisualInfo(display, + VisualDepthMask, + &visualInfoTemplate, + &matchingCount); + } + + if (matchingVisuals) { + visualId = matchingVisuals[0].visualid; + XFree(matchingVisuals); + } + } + + if (visualId) { +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, configId); +#endif + return visualId; + } + + qWarning("Unable to find an X11 visual which matches EGL config %d", configId); + return (VisualID)0; +} diff --git a/src/plugins/platforms/xlib/qxlibeglintegration.h b/src/plugins/platforms/xlib/qxlibeglintegration.h new file mode 100644 index 0000000..4c2e50d --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibeglintegration.h @@ -0,0 +1,54 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITEEGLINTEGRATION_H +#define QTESTLITEEGLINTEGRATION_H + +#include "qtestlitestaticinfo.h" +#include "../eglconvenience/qeglconvenience.h" + +class QXlibEglIntegration +{ +public: + static VisualID getCompatibleVisualId(Display *display, EGLConfig config); +}; + +#endif // QTESTLITEEGLINTEGRATION_H diff --git a/src/plugins/platforms/xlib/qxlibintegration.cpp b/src/plugins/platforms/xlib/qxlibintegration.cpp new file mode 100644 index 0000000..cdc5c29 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibintegration.cpp @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestliteintegration.h" +#include "qtestlitewindowsurface.h" +#include <QtGui/private/qpixmap_raster_p.h> +#include <QtCore/qdebug.h> + +#include "qtestlitewindow.h" +#include "qgenericunixfontdatabase.h" +#include "qtestlitescreen.h" +#include "qtestliteclipboard.h" + +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) +#include <GL/glx.h> +#else +#include <EGL/egl.h> +#endif //!defined(QT_OPENGL_ES_2) +#include <private/qwindowsurface_gl_p.h> +#include <private/qpixmapdata_gl_p.h> +#endif //QT_NO_OPENGL + +QT_BEGIN_NAMESPACE + +QXlibIntegration::QXlibIntegration(bool useOpenGL) + : mUseOpenGL(useOpenGL) + , mFontDb(new QGenericUnixFontDatabase()) + , mClipboard(0) +{ + mPrimaryScreen = new QXlibScreen(); + mScreens.append(mPrimaryScreen); +} + +QPixmapData *QXlibIntegration::createPixmapData(QPixmapData::PixelType type) const +{ +#ifndef QT_NO_OPENGL + if (mUseOpenGL) + return new QGLPixmapData(type); +#endif + return new QRasterPixmapData(type); +} + +QWindowSurface *QXlibIntegration::createWindowSurface(QWidget *widget, WId) const +{ +#ifndef QT_NO_OPENGL + if (mUseOpenGL) + return new QGLWindowSurface(widget); +#endif + return new QXlibWindowSurface(widget); +} + + +QPlatformWindow *QXlibIntegration::createPlatformWindow(QWidget *widget, WId /*winId*/) const +{ + return new QXlibWindow(widget); +} + + + +QPixmap QXlibIntegration::grabWindow(WId window, int x, int y, int width, int height) const +{ + QImage image; + QWidget *widget = QWidget::find(window); + if (widget) { + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); + image = screen->grabWindow(window,x,y,width,height); + } else { + for (int i = 0; i < mScreens.size(); i++) { + QXlibScreen *screen = static_cast<QXlibScreen *>(mScreens[i]); + if (screen->rootWindow() == window) { + image = screen->grabWindow(window,x,y,width,height); + } + } + } + return QPixmap::fromImage(image); +} + +QPlatformFontDatabase *QXlibIntegration::fontDatabase() const +{ + return mFontDb; +} + +QPlatformClipboard * QXlibIntegration::clipboard() const +{ + //Use lazy init since clipboard needs QTestliteScreen + if (!mClipboard) { + QXlibIntegration *that = const_cast<QXlibIntegration *>(this); + that->mClipboard = new QXlibClipboard(mPrimaryScreen); + } + return mClipboard; +} + +bool QXlibIntegration::hasOpenGL() const +{ +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) + QXlibScreen *screen = static_cast<const QXlibScreen *>(mScreens.at(0)); + return glXQueryExtension(screen->display(), 0, 0) != 0; +#else + static bool eglHasbeenInitialized = false; + static bool wasEglInitialized = false; + if (!eglHasbeenInitialized) { + eglHasbeenInitialized = true; + const QXlibScreen *screen = static_cast<const QXlibScreen *>(mScreens.at(0)); + EGLint major, minor; + eglBindAPI(EGL_OPENGL_ES_API); + EGLDisplay disp = eglGetDisplay(screen->display()); + wasEglInitialized = eglInitialize(disp,&major,&minor); + } + return wasEglInitialized; +#endif +#endif + return false; +} + + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibintegration.h b/src/plugins/platforms/xlib/qxlibintegration.h new file mode 100644 index 0000000..c3125b8 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibintegration.h @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QGRAPHICSSYSTEM_TESTLITE_H +#define QGRAPHICSSYSTEM_TESTLITE_H + +//make sure textstream is included before any X11 headers +#include <QtCore/QTextStream> + +#include <QtGui/QPlatformIntegration> +#include <QtGui/QPlatformScreen> + +#include "qtestlitestaticinfo.h" + +QT_BEGIN_NAMESPACE + +class QXlibScreen; + +class QXlibIntegration : public QPlatformIntegration +{ +public: + QXlibIntegration(bool useOpenGL = false); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + + QPixmap grabWindow(WId window, int x, int y, int width, int height) const; + + QList<QPlatformScreen *> screens() const { return mScreens; } + + QPlatformFontDatabase *fontDatabase() const; + QPlatformClipboard *clipboard() const; + + bool hasOpenGL() const; + +private: + bool mUseOpenGL; + QXlibScreen *mPrimaryScreen; + QList<QPlatformScreen *> mScreens; + QPlatformFontDatabase *mFontDb; + QPlatformClipboard *mClipboard; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/xlib/qxlibkeyboard.cpp b/src/plugins/platforms/xlib/qxlibkeyboard.cpp new file mode 100644 index 0000000..fb0cf2e --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibkeyboard.cpp @@ -0,0 +1,1000 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitekeyboard.h" + +#include "qtestlitescreen.h" + +#include <QtGui/QWindowSystemInterface> + +#include <QtCore/QTextCodec> + +#ifndef XK_ISO_Left_Tab +#define XK_ISO_Left_Tab 0xFE20 +#endif + +#ifndef XK_dead_hook +#define XK_dead_hook 0xFE61 +#endif + +#ifndef XK_dead_horn +#define XK_dead_horn 0xFE62 +#endif + +#ifndef XK_Codeinput +#define XK_Codeinput 0xFF37 +#endif + +#ifndef XK_Kanji_Bangou +#define XK_Kanji_Bangou 0xFF37 /* same as codeinput */ +#endif + +// Fix old X libraries +#ifndef XK_KP_Home +#define XK_KP_Home 0xFF95 +#endif +#ifndef XK_KP_Left +#define XK_KP_Left 0xFF96 +#endif +#ifndef XK_KP_Up +#define XK_KP_Up 0xFF97 +#endif +#ifndef XK_KP_Right +#define XK_KP_Right 0xFF98 +#endif +#ifndef XK_KP_Down +#define XK_KP_Down 0xFF99 +#endif +#ifndef XK_KP_Prior +#define XK_KP_Prior 0xFF9A +#endif +#ifndef XK_KP_Next +#define XK_KP_Next 0xFF9B +#endif +#ifndef XK_KP_End +#define XK_KP_End 0xFF9C +#endif +#ifndef XK_KP_Insert +#define XK_KP_Insert 0xFF9E +#endif +#ifndef XK_KP_Delete +#define XK_KP_Delete 0xFF9F +#endif + +// the next lines are taken on 10/2009 from X.org (X11/XF86keysym.h), defining some special +// multimedia keys. They are included here as not every system has them. +#define XF86XK_MonBrightnessUp 0x1008FF02 +#define XF86XK_MonBrightnessDown 0x1008FF03 +#define XF86XK_KbdLightOnOff 0x1008FF04 +#define XF86XK_KbdBrightnessUp 0x1008FF05 +#define XF86XK_KbdBrightnessDown 0x1008FF06 +#define XF86XK_Standby 0x1008FF10 +#define XF86XK_AudioLowerVolume 0x1008FF11 +#define XF86XK_AudioMute 0x1008FF12 +#define XF86XK_AudioRaiseVolume 0x1008FF13 +#define XF86XK_AudioPlay 0x1008FF14 +#define XF86XK_AudioStop 0x1008FF15 +#define XF86XK_AudioPrev 0x1008FF16 +#define XF86XK_AudioNext 0x1008FF17 +#define XF86XK_HomePage 0x1008FF18 +#define XF86XK_Mail 0x1008FF19 +#define XF86XK_Start 0x1008FF1A +#define XF86XK_Search 0x1008FF1B +#define XF86XK_AudioRecord 0x1008FF1C +#define XF86XK_Calculator 0x1008FF1D +#define XF86XK_Memo 0x1008FF1E +#define XF86XK_ToDoList 0x1008FF1F +#define XF86XK_Calendar 0x1008FF20 +#define XF86XK_PowerDown 0x1008FF21 +#define XF86XK_ContrastAdjust 0x1008FF22 +#define XF86XK_Back 0x1008FF26 +#define XF86XK_Forward 0x1008FF27 +#define XF86XK_Stop 0x1008FF28 +#define XF86XK_Refresh 0x1008FF29 +#define XF86XK_PowerOff 0x1008FF2A +#define XF86XK_WakeUp 0x1008FF2B +#define XF86XK_Eject 0x1008FF2C +#define XF86XK_ScreenSaver 0x1008FF2D +#define XF86XK_WWW 0x1008FF2E +#define XF86XK_Sleep 0x1008FF2F +#define XF86XK_Favorites 0x1008FF30 +#define XF86XK_AudioPause 0x1008FF31 +#define XF86XK_AudioMedia 0x1008FF32 +#define XF86XK_MyComputer 0x1008FF33 +#define XF86XK_LightBulb 0x1008FF35 +#define XF86XK_Shop 0x1008FF36 +#define XF86XK_History 0x1008FF37 +#define XF86XK_OpenURL 0x1008FF38 +#define XF86XK_AddFavorite 0x1008FF39 +#define XF86XK_HotLinks 0x1008FF3A +#define XF86XK_BrightnessAdjust 0x1008FF3B +#define XF86XK_Finance 0x1008FF3C +#define XF86XK_Community 0x1008FF3D +#define XF86XK_AudioRewind 0x1008FF3E +#define XF86XK_BackForward 0x1008FF3F +#define XF86XK_Launch0 0x1008FF40 +#define XF86XK_Launch1 0x1008FF41 +#define XF86XK_Launch2 0x1008FF42 +#define XF86XK_Launch3 0x1008FF43 +#define XF86XK_Launch4 0x1008FF44 +#define XF86XK_Launch5 0x1008FF45 +#define XF86XK_Launch6 0x1008FF46 +#define XF86XK_Launch7 0x1008FF47 +#define XF86XK_Launch8 0x1008FF48 +#define XF86XK_Launch9 0x1008FF49 +#define XF86XK_LaunchA 0x1008FF4A +#define XF86XK_LaunchB 0x1008FF4B +#define XF86XK_LaunchC 0x1008FF4C +#define XF86XK_LaunchD 0x1008FF4D +#define XF86XK_LaunchE 0x1008FF4E +#define XF86XK_LaunchF 0x1008FF4F +#define XF86XK_ApplicationLeft 0x1008FF50 +#define XF86XK_ApplicationRight 0x1008FF51 +#define XF86XK_Book 0x1008FF52 +#define XF86XK_CD 0x1008FF53 +#define XF86XK_Calculater 0x1008FF54 +#define XF86XK_Clear 0x1008FF55 +#define XF86XK_ClearGrab 0x1008FE21 +#define XF86XK_Close 0x1008FF56 +#define XF86XK_Copy 0x1008FF57 +#define XF86XK_Cut 0x1008FF58 +#define XF86XK_Display 0x1008FF59 +#define XF86XK_DOS 0x1008FF5A +#define XF86XK_Documents 0x1008FF5B +#define XF86XK_Excel 0x1008FF5C +#define XF86XK_Explorer 0x1008FF5D +#define XF86XK_Game 0x1008FF5E +#define XF86XK_Go 0x1008FF5F +#define XF86XK_iTouch 0x1008FF60 +#define XF86XK_LogOff 0x1008FF61 +#define XF86XK_Market 0x1008FF62 +#define XF86XK_Meeting 0x1008FF63 +#define XF86XK_MenuKB 0x1008FF65 +#define XF86XK_MenuPB 0x1008FF66 +#define XF86XK_MySites 0x1008FF67 +#define XF86XK_News 0x1008FF69 +#define XF86XK_OfficeHome 0x1008FF6A +#define XF86XK_Option 0x1008FF6C +#define XF86XK_Paste 0x1008FF6D +#define XF86XK_Phone 0x1008FF6E +#define XF86XK_Reply 0x1008FF72 +#define XF86XK_Reload 0x1008FF73 +#define XF86XK_RotateWindows 0x1008FF74 +#define XF86XK_RotationPB 0x1008FF75 +#define XF86XK_RotationKB 0x1008FF76 +#define XF86XK_Save 0x1008FF77 +#define XF86XK_Send 0x1008FF7B +#define XF86XK_Spell 0x1008FF7C +#define XF86XK_SplitScreen 0x1008FF7D +#define XF86XK_Support 0x1008FF7E +#define XF86XK_TaskPane 0x1008FF7F +#define XF86XK_Terminal 0x1008FF80 +#define XF86XK_Tools 0x1008FF81 +#define XF86XK_Travel 0x1008FF82 +#define XF86XK_Video 0x1008FF87 +#define XF86XK_Word 0x1008FF89 +#define XF86XK_Xfer 0x1008FF8A +#define XF86XK_ZoomIn 0x1008FF8B +#define XF86XK_ZoomOut 0x1008FF8C +#define XF86XK_Away 0x1008FF8D +#define XF86XK_Messenger 0x1008FF8E +#define XF86XK_WebCam 0x1008FF8F +#define XF86XK_MailForward 0x1008FF90 +#define XF86XK_Pictures 0x1008FF91 +#define XF86XK_Music 0x1008FF92 +#define XF86XK_Battery 0x1008FF93 +#define XF86XK_Bluetooth 0x1008FF94 +#define XF86XK_WLAN 0x1008FF95 +#define XF86XK_UWB 0x1008FF96 +#define XF86XK_AudioForward 0x1008FF97 +#define XF86XK_AudioRepeat 0x1008FF98 +#define XF86XK_AudioRandomPlay 0x1008FF99 +#define XF86XK_Subtitle 0x1008FF9A +#define XF86XK_AudioCycleTrack 0x1008FF9B +#define XF86XK_Time 0x1008FF9F +#define XF86XK_Select 0x1008FFA0 +#define XF86XK_View 0x1008FFA1 +#define XF86XK_TopMenu 0x1008FFA2 +#define XF86XK_Suspend 0x1008FFA7 +#define XF86XK_Hibernate 0x1008FFA8 + + +// end of XF86keysyms.h + +// Special keys used by Qtopia, mapped into the X11 private keypad range. +#define QTOPIAXK_Select 0x11000601 +#define QTOPIAXK_Yes 0x11000602 +#define QTOPIAXK_No 0x11000603 +#define QTOPIAXK_Cancel 0x11000604 +#define QTOPIAXK_Printer 0x11000605 +#define QTOPIAXK_Execute 0x11000606 +#define QTOPIAXK_Sleep 0x11000607 +#define QTOPIAXK_Play 0x11000608 +#define QTOPIAXK_Zoom 0x11000609 +#define QTOPIAXK_Context1 0x1100060A +#define QTOPIAXK_Context2 0x1100060B +#define QTOPIAXK_Context3 0x1100060C +#define QTOPIAXK_Context4 0x1100060D +#define QTOPIAXK_Call 0x1100060E +#define QTOPIAXK_Hangup 0x1100060F +#define QTOPIAXK_Flip 0x11000610 + +// keyboard mapping table +static const unsigned int KeyTbl[] = { + + // misc keys + + XK_Escape, Qt::Key_Escape, + XK_Tab, Qt::Key_Tab, + XK_ISO_Left_Tab, Qt::Key_Backtab, + XK_BackSpace, Qt::Key_Backspace, + XK_Return, Qt::Key_Return, + XK_Insert, Qt::Key_Insert, + XK_Delete, Qt::Key_Delete, + XK_Clear, Qt::Key_Delete, + XK_Pause, Qt::Key_Pause, + XK_Print, Qt::Key_Print, + 0x1005FF60, Qt::Key_SysReq, // hardcoded Sun SysReq + 0x1007ff00, Qt::Key_SysReq, // hardcoded X386 SysReq + + // cursor movement + + XK_Home, Qt::Key_Home, + XK_End, Qt::Key_End, + XK_Left, Qt::Key_Left, + XK_Up, Qt::Key_Up, + XK_Right, Qt::Key_Right, + XK_Down, Qt::Key_Down, + XK_Prior, Qt::Key_PageUp, + XK_Next, Qt::Key_PageDown, + + // modifiers + + XK_Shift_L, Qt::Key_Shift, + XK_Shift_R, Qt::Key_Shift, + XK_Shift_Lock, Qt::Key_Shift, + XK_Control_L, Qt::Key_Control, + XK_Control_R, Qt::Key_Control, + XK_Meta_L, Qt::Key_Meta, + XK_Meta_R, Qt::Key_Meta, + XK_Alt_L, Qt::Key_Alt, + XK_Alt_R, Qt::Key_Alt, + XK_Caps_Lock, Qt::Key_CapsLock, + XK_Num_Lock, Qt::Key_NumLock, + XK_Scroll_Lock, Qt::Key_ScrollLock, + XK_Super_L, Qt::Key_Super_L, + XK_Super_R, Qt::Key_Super_R, + XK_Menu, Qt::Key_Menu, + XK_Hyper_L, Qt::Key_Hyper_L, + XK_Hyper_R, Qt::Key_Hyper_R, + XK_Help, Qt::Key_Help, + 0x1000FF74, Qt::Key_Backtab, // hardcoded HP backtab + 0x1005FF10, Qt::Key_F11, // hardcoded Sun F36 (labeled F11) + 0x1005FF11, Qt::Key_F12, // hardcoded Sun F37 (labeled F12) + + // numeric and function keypad keys + + XK_KP_Space, Qt::Key_Space, + XK_KP_Tab, Qt::Key_Tab, + XK_KP_Enter, Qt::Key_Enter, + //XK_KP_F1, Qt::Key_F1, + //XK_KP_F2, Qt::Key_F2, + //XK_KP_F3, Qt::Key_F3, + //XK_KP_F4, Qt::Key_F4, + XK_KP_Home, Qt::Key_Home, + XK_KP_Left, Qt::Key_Left, + XK_KP_Up, Qt::Key_Up, + XK_KP_Right, Qt::Key_Right, + XK_KP_Down, Qt::Key_Down, + XK_KP_Prior, Qt::Key_PageUp, + XK_KP_Next, Qt::Key_PageDown, + XK_KP_End, Qt::Key_End, + XK_KP_Begin, Qt::Key_Clear, + XK_KP_Insert, Qt::Key_Insert, + XK_KP_Delete, Qt::Key_Delete, + XK_KP_Equal, Qt::Key_Equal, + XK_KP_Multiply, Qt::Key_Asterisk, + XK_KP_Add, Qt::Key_Plus, + XK_KP_Separator, Qt::Key_Comma, + XK_KP_Subtract, Qt::Key_Minus, + XK_KP_Decimal, Qt::Key_Period, + XK_KP_Divide, Qt::Key_Slash, + + // International input method support keys + + // International & multi-key character composition + XK_ISO_Level3_Shift, Qt::Key_AltGr, + XK_Multi_key, Qt::Key_Multi_key, + XK_Codeinput, Qt::Key_Codeinput, + XK_SingleCandidate, Qt::Key_SingleCandidate, + XK_MultipleCandidate, Qt::Key_MultipleCandidate, + XK_PreviousCandidate, Qt::Key_PreviousCandidate, + + // Misc Functions + XK_Mode_switch, Qt::Key_Mode_switch, + XK_script_switch, Qt::Key_Mode_switch, + + // Japanese keyboard support + XK_Kanji, Qt::Key_Kanji, + XK_Muhenkan, Qt::Key_Muhenkan, + //XK_Henkan_Mode, Qt::Key_Henkan_Mode, + XK_Henkan_Mode, Qt::Key_Henkan, + XK_Henkan, Qt::Key_Henkan, + XK_Romaji, Qt::Key_Romaji, + XK_Hiragana, Qt::Key_Hiragana, + XK_Katakana, Qt::Key_Katakana, + XK_Hiragana_Katakana, Qt::Key_Hiragana_Katakana, + XK_Zenkaku, Qt::Key_Zenkaku, + XK_Hankaku, Qt::Key_Hankaku, + XK_Zenkaku_Hankaku, Qt::Key_Zenkaku_Hankaku, + XK_Touroku, Qt::Key_Touroku, + XK_Massyo, Qt::Key_Massyo, + XK_Kana_Lock, Qt::Key_Kana_Lock, + XK_Kana_Shift, Qt::Key_Kana_Shift, + XK_Eisu_Shift, Qt::Key_Eisu_Shift, + XK_Eisu_toggle, Qt::Key_Eisu_toggle, + //XK_Kanji_Bangou, Qt::Key_Kanji_Bangou, + //XK_Zen_Koho, Qt::Key_Zen_Koho, + //XK_Mae_Koho, Qt::Key_Mae_Koho, + XK_Kanji_Bangou, Qt::Key_Codeinput, + XK_Zen_Koho, Qt::Key_MultipleCandidate, + XK_Mae_Koho, Qt::Key_PreviousCandidate, + +#ifdef XK_KOREAN + // Korean keyboard support + XK_Hangul, Qt::Key_Hangul, + XK_Hangul_Start, Qt::Key_Hangul_Start, + XK_Hangul_End, Qt::Key_Hangul_End, + XK_Hangul_Hanja, Qt::Key_Hangul_Hanja, + XK_Hangul_Jamo, Qt::Key_Hangul_Jamo, + XK_Hangul_Romaja, Qt::Key_Hangul_Romaja, + //XK_Hangul_Codeinput, Qt::Key_Hangul_Codeinput, + XK_Hangul_Codeinput, Qt::Key_Codeinput, + XK_Hangul_Jeonja, Qt::Key_Hangul_Jeonja, + XK_Hangul_Banja, Qt::Key_Hangul_Banja, + XK_Hangul_PreHanja, Qt::Key_Hangul_PreHanja, + XK_Hangul_PostHanja, Qt::Key_Hangul_PostHanja, + //XK_Hangul_SingleCandidate,Qt::Key_Hangul_SingleCandidate, + //XK_Hangul_MultipleCandidate,Qt::Key_Hangul_MultipleCandidate, + //XK_Hangul_PreviousCandidate,Qt::Key_Hangul_PreviousCandidate, + XK_Hangul_SingleCandidate, Qt::Key_SingleCandidate, + XK_Hangul_MultipleCandidate,Qt::Key_MultipleCandidate, + XK_Hangul_PreviousCandidate,Qt::Key_PreviousCandidate, + XK_Hangul_Special, Qt::Key_Hangul_Special, + //XK_Hangul_switch, Qt::Key_Hangul_switch, + XK_Hangul_switch, Qt::Key_Mode_switch, +#endif // XK_KOREAN + + // dead keys + XK_dead_grave, Qt::Key_Dead_Grave, + XK_dead_acute, Qt::Key_Dead_Acute, + XK_dead_circumflex, Qt::Key_Dead_Circumflex, + XK_dead_tilde, Qt::Key_Dead_Tilde, + XK_dead_macron, Qt::Key_Dead_Macron, + XK_dead_breve, Qt::Key_Dead_Breve, + XK_dead_abovedot, Qt::Key_Dead_Abovedot, + XK_dead_diaeresis, Qt::Key_Dead_Diaeresis, + XK_dead_abovering, Qt::Key_Dead_Abovering, + XK_dead_doubleacute, Qt::Key_Dead_Doubleacute, + XK_dead_caron, Qt::Key_Dead_Caron, + XK_dead_cedilla, Qt::Key_Dead_Cedilla, + XK_dead_ogonek, Qt::Key_Dead_Ogonek, + XK_dead_iota, Qt::Key_Dead_Iota, + XK_dead_voiced_sound, Qt::Key_Dead_Voiced_Sound, + XK_dead_semivoiced_sound, Qt::Key_Dead_Semivoiced_Sound, + XK_dead_belowdot, Qt::Key_Dead_Belowdot, + XK_dead_hook, Qt::Key_Dead_Hook, + XK_dead_horn, Qt::Key_Dead_Horn, + + // Special keys from X.org - This include multimedia keys, + // wireless/bluetooth/uwb keys, special launcher keys, etc. + XF86XK_Back, Qt::Key_Back, + XF86XK_Forward, Qt::Key_Forward, + XF86XK_Stop, Qt::Key_Stop, + XF86XK_Refresh, Qt::Key_Refresh, + XF86XK_Favorites, Qt::Key_Favorites, + XF86XK_AudioMedia, Qt::Key_LaunchMedia, + XF86XK_OpenURL, Qt::Key_OpenUrl, + XF86XK_HomePage, Qt::Key_HomePage, + XF86XK_Search, Qt::Key_Search, + XF86XK_AudioLowerVolume, Qt::Key_VolumeDown, + XF86XK_AudioMute, Qt::Key_VolumeMute, + XF86XK_AudioRaiseVolume, Qt::Key_VolumeUp, + XF86XK_AudioPlay, Qt::Key_MediaPlay, + XF86XK_AudioStop, Qt::Key_MediaStop, + XF86XK_AudioPrev, Qt::Key_MediaPrevious, + XF86XK_AudioNext, Qt::Key_MediaNext, + XF86XK_AudioRecord, Qt::Key_MediaRecord, + XF86XK_Mail, Qt::Key_LaunchMail, + XF86XK_MyComputer, Qt::Key_Launch0, // ### Qt 5: remap properly + XF86XK_Calculator, Qt::Key_Launch1, + XF86XK_Memo, Qt::Key_Memo, + XF86XK_ToDoList, Qt::Key_ToDoList, + XF86XK_Calendar, Qt::Key_Calendar, + XF86XK_PowerDown, Qt::Key_PowerDown, + XF86XK_ContrastAdjust, Qt::Key_ContrastAdjust, + XF86XK_Standby, Qt::Key_Standby, + XF86XK_MonBrightnessUp, Qt::Key_MonBrightnessUp, + XF86XK_MonBrightnessDown, Qt::Key_MonBrightnessDown, + XF86XK_KbdLightOnOff, Qt::Key_KeyboardLightOnOff, + XF86XK_KbdBrightnessUp, Qt::Key_KeyboardBrightnessUp, + XF86XK_KbdBrightnessDown, Qt::Key_KeyboardBrightnessDown, + XF86XK_PowerOff, Qt::Key_PowerOff, + XF86XK_WakeUp, Qt::Key_WakeUp, + XF86XK_Eject, Qt::Key_Eject, + XF86XK_ScreenSaver, Qt::Key_ScreenSaver, + XF86XK_WWW, Qt::Key_WWW, + XF86XK_Sleep, Qt::Key_Sleep, + XF86XK_LightBulb, Qt::Key_LightBulb, + XF86XK_Shop, Qt::Key_Shop, + XF86XK_History, Qt::Key_History, + XF86XK_AddFavorite, Qt::Key_AddFavorite, + XF86XK_HotLinks, Qt::Key_HotLinks, + XF86XK_BrightnessAdjust, Qt::Key_BrightnessAdjust, + XF86XK_Finance, Qt::Key_Finance, + XF86XK_Community, Qt::Key_Community, + XF86XK_AudioRewind, Qt::Key_AudioRewind, + XF86XK_BackForward, Qt::Key_BackForward, + XF86XK_ApplicationLeft, Qt::Key_ApplicationLeft, + XF86XK_ApplicationRight, Qt::Key_ApplicationRight, + XF86XK_Book, Qt::Key_Book, + XF86XK_CD, Qt::Key_CD, + XF86XK_Calculater, Qt::Key_Calculator, + XF86XK_Clear, Qt::Key_Clear, + XF86XK_ClearGrab, Qt::Key_ClearGrab, + XF86XK_Close, Qt::Key_Close, + XF86XK_Copy, Qt::Key_Copy, + XF86XK_Cut, Qt::Key_Cut, + XF86XK_Display, Qt::Key_Display, + XF86XK_DOS, Qt::Key_DOS, + XF86XK_Documents, Qt::Key_Documents, + XF86XK_Excel, Qt::Key_Excel, + XF86XK_Explorer, Qt::Key_Explorer, + XF86XK_Game, Qt::Key_Game, + XF86XK_Go, Qt::Key_Go, + XF86XK_iTouch, Qt::Key_iTouch, + XF86XK_LogOff, Qt::Key_LogOff, + XF86XK_Market, Qt::Key_Market, + XF86XK_Meeting, Qt::Key_Meeting, + XF86XK_MenuKB, Qt::Key_MenuKB, + XF86XK_MenuPB, Qt::Key_MenuPB, + XF86XK_MySites, Qt::Key_MySites, + XF86XK_News, Qt::Key_News, + XF86XK_OfficeHome, Qt::Key_OfficeHome, + XF86XK_Option, Qt::Key_Option, + XF86XK_Paste, Qt::Key_Paste, + XF86XK_Phone, Qt::Key_Phone, + XF86XK_Reply, Qt::Key_Reply, + XF86XK_Reload, Qt::Key_Reload, + XF86XK_RotateWindows, Qt::Key_RotateWindows, + XF86XK_RotationPB, Qt::Key_RotationPB, + XF86XK_RotationKB, Qt::Key_RotationKB, + XF86XK_Save, Qt::Key_Save, + XF86XK_Send, Qt::Key_Send, + XF86XK_Spell, Qt::Key_Spell, + XF86XK_SplitScreen, Qt::Key_SplitScreen, + XF86XK_Support, Qt::Key_Support, + XF86XK_TaskPane, Qt::Key_TaskPane, + XF86XK_Terminal, Qt::Key_Terminal, + XF86XK_Tools, Qt::Key_Tools, + XF86XK_Travel, Qt::Key_Travel, + XF86XK_Video, Qt::Key_Video, + XF86XK_Word, Qt::Key_Word, + XF86XK_Xfer, Qt::Key_Xfer, + XF86XK_ZoomIn, Qt::Key_ZoomIn, + XF86XK_ZoomOut, Qt::Key_ZoomOut, + XF86XK_Away, Qt::Key_Away, + XF86XK_Messenger, Qt::Key_Messenger, + XF86XK_WebCam, Qt::Key_WebCam, + XF86XK_MailForward, Qt::Key_MailForward, + XF86XK_Pictures, Qt::Key_Pictures, + XF86XK_Music, Qt::Key_Music, + XF86XK_Battery, Qt::Key_Battery, + XF86XK_Bluetooth, Qt::Key_Bluetooth, + XF86XK_WLAN, Qt::Key_WLAN, + XF86XK_UWB, Qt::Key_UWB, + XF86XK_AudioForward, Qt::Key_AudioForward, + XF86XK_AudioRepeat, Qt::Key_AudioRepeat, + XF86XK_AudioRandomPlay, Qt::Key_AudioRandomPlay, + XF86XK_Subtitle, Qt::Key_Subtitle, + XF86XK_AudioCycleTrack, Qt::Key_AudioCycleTrack, + XF86XK_Time, Qt::Key_Time, + XF86XK_Select, Qt::Key_Select, + XF86XK_View, Qt::Key_View, + XF86XK_TopMenu, Qt::Key_TopMenu, + XF86XK_Bluetooth, Qt::Key_Bluetooth, + XF86XK_Suspend, Qt::Key_Suspend, + XF86XK_Hibernate, Qt::Key_Hibernate, + XF86XK_Launch0, Qt::Key_Launch2, // ### Qt 5: remap properly + XF86XK_Launch1, Qt::Key_Launch3, + XF86XK_Launch2, Qt::Key_Launch4, + XF86XK_Launch3, Qt::Key_Launch5, + XF86XK_Launch4, Qt::Key_Launch6, + XF86XK_Launch5, Qt::Key_Launch7, + XF86XK_Launch6, Qt::Key_Launch8, + XF86XK_Launch7, Qt::Key_Launch9, + XF86XK_Launch8, Qt::Key_LaunchA, + XF86XK_Launch9, Qt::Key_LaunchB, + XF86XK_LaunchA, Qt::Key_LaunchC, + XF86XK_LaunchB, Qt::Key_LaunchD, + XF86XK_LaunchC, Qt::Key_LaunchE, + XF86XK_LaunchD, Qt::Key_LaunchF, + XF86XK_LaunchE, Qt::Key_LaunchG, + XF86XK_LaunchF, Qt::Key_LaunchH, + + // Qtopia keys + QTOPIAXK_Select, Qt::Key_Select, + QTOPIAXK_Yes, Qt::Key_Yes, + QTOPIAXK_No, Qt::Key_No, + QTOPIAXK_Cancel, Qt::Key_Cancel, + QTOPIAXK_Printer, Qt::Key_Printer, + QTOPIAXK_Execute, Qt::Key_Execute, + QTOPIAXK_Sleep, Qt::Key_Sleep, + QTOPIAXK_Play, Qt::Key_Play, + QTOPIAXK_Zoom, Qt::Key_Zoom, + QTOPIAXK_Context1, Qt::Key_Context1, + QTOPIAXK_Context2, Qt::Key_Context2, + QTOPIAXK_Context3, Qt::Key_Context3, + QTOPIAXK_Context4, Qt::Key_Context4, + QTOPIAXK_Call, Qt::Key_Call, + QTOPIAXK_Hangup, Qt::Key_Hangup, + QTOPIAXK_Flip, Qt::Key_Flip, + + 0, 0 +}; + +static const unsigned short katakanaKeysymsToUnicode[] = { + 0x0000, 0x3002, 0x300C, 0x300D, 0x3001, 0x30FB, 0x30F2, 0x30A1, + 0x30A3, 0x30A5, 0x30A7, 0x30A9, 0x30E3, 0x30E5, 0x30E7, 0x30C3, + 0x30FC, 0x30A2, 0x30A4, 0x30A6, 0x30A8, 0x30AA, 0x30AB, 0x30AD, + 0x30AF, 0x30B1, 0x30B3, 0x30B5, 0x30B7, 0x30B9, 0x30BB, 0x30BD, + 0x30BF, 0x30C1, 0x30C4, 0x30C6, 0x30C8, 0x30CA, 0x30CB, 0x30CC, + 0x30CD, 0x30CE, 0x30CF, 0x30D2, 0x30D5, 0x30D8, 0x30DB, 0x30DE, + 0x30DF, 0x30E0, 0x30E1, 0x30E2, 0x30E4, 0x30E6, 0x30E8, 0x30E9, + 0x30EA, 0x30EB, 0x30EC, 0x30ED, 0x30EF, 0x30F3, 0x309B, 0x309C +}; + +static const unsigned short cyrillicKeysymsToUnicode[] = { + 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, + 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0000, 0x045e, 0x045f, + 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, + 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0000, 0x040e, 0x040f, + 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, + 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, + 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, + 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, + 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, + 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, + 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, + 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a +}; + +static const unsigned short greekKeysymsToUnicode[] = { + 0x0000, 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, + 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, + 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, + 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, + 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, + 0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, + 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, + 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, + 0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, + 0x03c8, 0x03c9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short technicalKeysymsToUnicode[] = { + 0x0000, 0x23B7, 0x250C, 0x2500, 0x2320, 0x2321, 0x2502, 0x23A1, + 0x23A3, 0x23A4, 0x23A6, 0x239B, 0x239D, 0x239E, 0x23A0, 0x23A8, + 0x23AC, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x2264, 0x2260, 0x2265, 0x222B, + 0x2234, 0x221D, 0x221E, 0x0000, 0x0000, 0x2207, 0x0000, 0x0000, + 0x223C, 0x2243, 0x0000, 0x0000, 0x0000, 0x21D4, 0x21D2, 0x2261, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x221A, 0x0000, + 0x0000, 0x0000, 0x2282, 0x2283, 0x2229, 0x222A, 0x2227, 0x2228, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x2202, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, + 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193, 0x0000 +}; + +static const unsigned short specialKeysymsToUnicode[] = { + 0x25C6, 0x2592, 0x2409, 0x240C, 0x240D, 0x240A, 0x0000, 0x0000, + 0x2424, 0x240B, 0x2518, 0x2510, 0x250C, 0x2514, 0x253C, 0x23BA, + 0x23BB, 0x2500, 0x23BC, 0x23BD, 0x251C, 0x2524, 0x2534, 0x252C, + 0x2502, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short publishingKeysymsToUnicode[] = { + 0x0000, 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, + 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, + 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, + 0x2105, 0x0000, 0x0000, 0x2012, 0x2329, 0x0000, 0x232a, 0x0000, + 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, + 0x0000, 0x2122, 0x2613, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25af, + 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x0000, 0x2032, 0x2033, + 0x0000, 0x271d, 0x0000, 0x25ac, 0x25c0, 0x25b6, 0x25cf, 0x25ae, + 0x25e6, 0x25ab, 0x25ad, 0x25b3, 0x25bd, 0x2606, 0x2022, 0x25aa, + 0x25b2, 0x25bc, 0x261c, 0x261e, 0x2663, 0x2666, 0x2665, 0x0000, + 0x2720, 0x2020, 0x2021, 0x2713, 0x2717, 0x266f, 0x266d, 0x2642, + 0x2640, 0x260e, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e, 0x0000 +}; + +static const unsigned short aplKeysymsToUnicode[] = { + 0x0000, 0x0000, 0x0000, 0x003c, 0x0000, 0x0000, 0x003e, 0x0000, + 0x2228, 0x2227, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x00af, 0x0000, 0x22a5, 0x2229, 0x230a, 0x0000, 0x005f, 0x0000, + 0x0000, 0x0000, 0x2218, 0x0000, 0x2395, 0x0000, 0x22a4, 0x25cb, + 0x0000, 0x0000, 0x0000, 0x2308, 0x0000, 0x0000, 0x222a, 0x0000, + 0x2283, 0x0000, 0x2282, 0x0000, 0x22a2, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x22a3, 0x0000, 0x0000, 0x0000 +}; + +static const unsigned short koreanKeysymsToUnicode[] = { + 0x0000, 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, + 0x3138, 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, + 0x3140, 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, + 0x3148, 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, + 0x3150, 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, + 0x3158, 0x3159, 0x315a, 0x315b, 0x315c, 0x315d, 0x315e, 0x315f, + 0x3160, 0x3161, 0x3162, 0x3163, 0x11a8, 0x11a9, 0x11aa, 0x11ab, + 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, + 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, + 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x316d, + 0x3171, 0x3178, 0x317f, 0x3181, 0x3184, 0x3186, 0x318d, 0x318e, + 0x11eb, 0x11f0, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9 +}; + +static QChar keysymToUnicode(unsigned char byte3, unsigned char byte4) +{ + switch (byte3) { + case 0x04: + // katakana + if (byte4 > 0xa0 && byte4 < 0xe0) + return QChar(katakanaKeysymsToUnicode[byte4 - 0xa0]); + else if (byte4 == 0x7e) + return QChar(0x203e); // Overline + break; + case 0x06: + // russian, use lookup table + if (byte4 > 0xa0) + return QChar(cyrillicKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x07: + // greek + if (byte4 > 0xa0) + return QChar(greekKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x08: + // technical + if (byte4 > 0xa0) + return QChar(technicalKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x09: + // special + if (byte4 >= 0xe0) + return QChar(specialKeysymsToUnicode[byte4 - 0xe0]); + break; + case 0x0a: + // publishing + if (byte4 > 0xa0) + return QChar(publishingKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x0b: + // APL + if (byte4 > 0xa0) + return QChar(aplKeysymsToUnicode[byte4 - 0xa0]); + break; + case 0x0e: + // Korean + if (byte4 > 0xa0) + return QChar(koreanKeysymsToUnicode[byte4 - 0xa0]); + break; + default: + break; + } + return QChar(0x0); +} + +Qt::KeyboardModifiers QXlibKeyboard::translateModifiers(int s) +{ + Qt::KeyboardModifiers ret = 0; + if (s & ShiftMask) + ret |= Qt::ShiftModifier; + if (s & ControlMask) + ret |= Qt::ControlModifier; + if (s & m_alt_mask) + ret |= Qt::AltModifier; + if (s & m_meta_mask) + ret |= Qt::MetaModifier; +// if (s & m_mode_switch_mask) //doesn't seem to work correctly +// ret |= Qt::GroupSwitchModifier; + return ret; +} + +void QXlibKeyboard::setMask(KeySym sym, uint mask) +{ + if (m_alt_mask == 0 + && m_meta_mask != mask + && m_super_mask != mask + && m_hyper_mask != mask + && (sym == XK_Alt_L || sym == XK_Alt_R)) { + m_alt_mask = mask; + } + if (m_meta_mask == 0 + && m_alt_mask != mask + && m_super_mask != mask + && m_hyper_mask != mask + && (sym == XK_Meta_L || sym == XK_Meta_R)) { + m_meta_mask = mask; + } + if (m_super_mask == 0 + && m_alt_mask != mask + && m_meta_mask != mask + && m_hyper_mask != mask + && (sym == XK_Super_L || sym == XK_Super_R)) { + m_super_mask = mask; + } + if (m_hyper_mask == 0 + && m_alt_mask != mask + && m_meta_mask != mask + && m_super_mask != mask + && (sym == XK_Hyper_L || sym == XK_Hyper_R)) { + m_hyper_mask = mask; + } + if (m_mode_switch_mask == 0 + && m_alt_mask != mask + && m_meta_mask != mask + && m_super_mask != mask + && m_hyper_mask != mask + && sym == XK_Mode_switch) { + m_mode_switch_mask = mask; + } + if (m_num_lock_mask == 0 + && sym == XK_Num_Lock) { + m_num_lock_mask = mask; + } +} + +int QXlibKeyboard::translateKeySym(uint key) const +{ + int code = -1; + int i = 0; // any other keys + while (KeyTbl[i]) { + if (key == KeyTbl[i]) { + code = (int)KeyTbl[i+1]; + break; + } + i += 2; + } + if (m_meta_mask) { + // translate Super/Hyper keys to Meta if we're using them as the MetaModifier + if (m_meta_mask == m_super_mask && (code == Qt::Key_Super_L || code == Qt::Key_Super_R)) { + code = Qt::Key_Meta; + } else if (m_meta_mask == m_hyper_mask && (code == Qt::Key_Hyper_L || code == Qt::Key_Hyper_R)) { + code = Qt::Key_Meta; + } + } + return code; +} + +QString QXlibKeyboard::translateKeySym(KeySym keysym, uint xmodifiers, + int &code, Qt::KeyboardModifiers &modifiers, + QByteArray &chars, int &count) +{ + // all keysyms smaller than 0xff00 are actally keys that can be mapped to unicode chars + + QTextCodec *mapper = QTextCodec::codecForLocale(); + QChar converted; + + if (/*count == 0 &&*/ keysym < 0xff00) { + unsigned char byte3 = (unsigned char)(keysym >> 8); + int mib = -1; + switch(byte3) { + case 0: // Latin 1 + case 1: // Latin 2 + case 2: //latin 3 + case 3: // latin4 + mib = byte3 + 4; break; + case 5: // arabic + mib = 82; break; + case 12: // Hebrew + mib = 85; break; + case 13: // Thai + mib = 2259; break; + case 4: // kana + case 6: // cyrillic + case 7: // greek + case 8: // technical, no mapping here at the moment + case 9: // Special + case 10: // Publishing + case 11: // APL + case 14: // Korean, no mapping + mib = -1; // manual conversion + mapper= 0; +#if !defined(QT_NO_XIM) + converted = keysymToUnicode(byte3, keysym & 0xff); +#endif + case 0x20: + // currency symbols + if (keysym >= 0x20a0 && keysym <= 0x20ac) { + mib = -1; // manual conversion + mapper = 0; + converted = (uint)keysym; + } + break; + default: + break; + } + if (mib != -1) { + mapper = QTextCodec::codecForMib(mib); + if (chars.isEmpty()) + chars.resize(1); + chars[0] = (unsigned char) (keysym & 0xff); // get only the fourth bit for conversion later + count = 1; + } + } else if (keysym >= 0x1000000 && keysym <= 0x100ffff) { + converted = (ushort) (keysym - 0x1000000); + mapper = 0; + } + if (count < (int)chars.size()-1) + chars[count] = '\0'; + + QString text; + if (!mapper && converted.unicode() != 0x0) { + text = converted; + } else if (!chars.isEmpty()) { + // convert chars (8bit) to text (unicode). + if (mapper) + text = mapper->toUnicode(chars.data(), count, 0); + if (text.isEmpty()) { + // no mapper, or codec couldn't convert to unicode (this + // can happen when running in the C locale or with no LANG + // set). try converting from latin-1 + text = QString::fromLatin1(chars); + } + } + + modifiers = translateModifiers(xmodifiers); + + // Commentary in X11/keysymdef says that X codes match ASCII, so it + // is safe to use the locale functions to process X codes in ISO8859-1. + // + // This is mainly for compatibility - applications should not use the + // Qt keycodes between 128 and 255, but should rather use the + // QKeyEvent::text(). + // + if (keysym < 128 || (keysym < 256 && (!mapper || mapper->mibEnum()==4))) { + // upper-case key, if known + code = isprint((int)keysym) ? toupper((int)keysym) : 0; + } else if (keysym >= XK_F1 && keysym <= XK_F35) { + // function keys + code = Qt::Key_F1 + ((int)keysym - XK_F1); + } else if (keysym >= XK_KP_Space && keysym <= XK_KP_9) { + if (keysym >= XK_KP_0) { + // numeric keypad keys + code = Qt::Key_0 + ((int)keysym - XK_KP_0); + } else { + code = translateKeySym(keysym); + } + modifiers |= Qt::KeypadModifier; + } else if (text.length() == 1 && text.unicode()->unicode() > 0x1f && text.unicode()->unicode() != 0x7f && !(keysym >= XK_dead_grave && keysym <= XK_dead_horn)) { + code = text.unicode()->toUpper().unicode(); + } else { + // any other keys + code = translateKeySym(keysym); + + if (code == Qt::Key_Tab && (modifiers & Qt::ShiftModifier)) { + // map shift+tab to shift+backtab, QShortcutMap knows about it + // and will handle it. + code = Qt::Key_Backtab; + text = QString(); + } + } + + return text; +} + +QXlibKeyboard::QXlibKeyboard(QXlibScreen *screen) + : m_screen(screen) + , m_alt_mask(0) + , m_super_mask(0) + , m_hyper_mask(0) + , m_meta_mask(0) +{ + changeLayout(); +} + +void QXlibKeyboard::changeLayout() +{ + XkbDescPtr xkbDesc = XkbGetMap(m_screen->display(), XkbAllClientInfoMask, XkbUseCoreKbd); + for (int i = xkbDesc->min_key_code; i < xkbDesc->max_key_code; ++i) { + const uint mask = xkbDesc->map->modmap ? xkbDesc->map->modmap[i] : 0; + if (mask == 0) { + // key is not bound to a modifier + continue; + } + + for (int j = 0; j < XkbKeyGroupsWidth(xkbDesc, i); ++j) { + KeySym keySym = XkbKeySym(xkbDesc, i, j); + if (keySym == NoSymbol) + continue; + setMask(keySym, mask); + } + } + XkbFreeKeyboard(xkbDesc, XkbAllComponentsMask, true); + +} + +static Qt::KeyboardModifiers modifierFromKeyCode(int qtcode) +{ + switch (qtcode) { + case Qt::Key_Control: + return Qt::ControlModifier; + case Qt::Key_Alt: + return Qt::AltModifier; + case Qt::Key_Shift: + return Qt::ShiftModifier; + case Qt::Key_Meta: + return Qt::MetaModifier; + default: + return Qt::NoModifier; + } +} + +void QXlibKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev) +{ + int qtcode = 0; + Qt::KeyboardModifiers modifiers = translateModifiers(ev->state); + QByteArray chars; + chars.resize(513); + int count = 0; + KeySym keySym; + count = XLookupString(ev,chars.data(),chars.size(),&keySym,0); + QString text = translateKeySym(keySym,ev->state,qtcode,modifiers,chars,count); + QWindowSystemInterface::handleKeyEvent(widget,ev->time,type,qtcode,modifiers,text.left(count)); +} diff --git a/src/plugins/platforms/xlib/qxlibkeyboard.h b/src/plugins/platforms/xlib/qxlibkeyboard.h new file mode 100644 index 0000000..98df4e1 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibkeyboard.h @@ -0,0 +1,76 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITEKEYBOARD_H +#define QTESTLITEKEYBOARD_H + +#include "qtestliteintegration.h" + +class QXlibKeyboard +{ +public: + QXlibKeyboard(QXlibScreen *screen); + + void changeLayout(); + + void handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent *ev); + + Qt::KeyboardModifiers translateModifiers(int s); + +private: + + void setMask(KeySym sym, uint mask); + int translateKeySym(uint key) const; + QString translateKeySym(KeySym keysym, uint xmodifiers, + int &code, Qt::KeyboardModifiers &modifiers, + QByteArray &chars, int &count); + + QXlibScreen *m_screen; + + uint m_alt_mask; + uint m_super_mask; + uint m_hyper_mask; + uint m_meta_mask; + uint m_mode_switch_mask; + uint m_num_lock_mask; +}; + +#endif // QTESTLITEKEYBOARD_H diff --git a/src/plugins/platforms/xlib/qxlibmime.cpp b/src/plugins/platforms/xlib/qxlibmime.cpp new file mode 100644 index 0000000..5335ae9 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibmime.cpp @@ -0,0 +1,322 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitemime.h" + +#include "qtestlitestaticinfo.h" +#include "qtestlitescreen.h" + +#include <QtCore/QTextCodec> +#include <QtGui/QImageWriter> +#include <QtCore/QBuffer> + +QXlibMime::QXlibMime() + : QInternalMimeData() +{ } + +QXlibMime::~QXlibMime() +{} + + + + + +QString QXlibMime::mimeAtomToString(Display *display, Atom a) +{ + if (!a) return 0; + + if (a == XA_STRING || a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) { + return "text/plain"; // some Xdnd clients are dumb + } + char *atom = XGetAtomName(display, a); + QString result = QString::fromLatin1(atom); + XFree(atom); + return result; +} + +Atom QXlibMime::mimeStringToAtom(Display *display, const QString &mimeType) +{ + if (mimeType.isEmpty()) + return 0; + return XInternAtom(display, mimeType.toLatin1().constData(), False); +} + +QStringList QXlibMime::mimeFormatsForAtom(Display *display, Atom a) +{ + QStringList formats; + if (a) { + QString atomName = mimeAtomToString(display, a); + formats.append(atomName); + + // special cases for string type + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) + || a == XA_STRING + || a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) + formats.append(QLatin1String("text/plain")); + + // special cases for uris + if (atomName == QLatin1String("text/x-moz-url")) + formats.append(QLatin1String("text/uri-list")); + + // special case for images + if (a == XA_PIXMAP) + formats.append(QLatin1String("image/ppm")); + } + return formats; +} + +bool QXlibMime::mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat) +{ + bool ret = false; + *atomFormat = a; + *dataFormat = 8; + QString atomName = mimeAtomToString(display, a); + if (QInternalMimeData::hasFormatHelper(atomName, mimeData)) { + *data = QInternalMimeData::renderDataHelper(atomName, mimeData); + if (atomName == QLatin1String("application/x-color")) + *dataFormat = 16; + ret = true; + } else { + if ((a == QXlibStatic::atom(QXlibStatic::UTF8_STRING) + || a == XA_STRING + || a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) + && QInternalMimeData::hasFormatHelper(QLatin1String("text/plain"), mimeData)) { + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)){ + *data = QInternalMimeData::renderDataHelper(QLatin1String("text/plain"), mimeData); + ret = true; + } else if (a == XA_STRING) { + *data = QString::fromUtf8(QInternalMimeData::renderDataHelper( + QLatin1String("text/plain"), mimeData)).toLocal8Bit(); + ret = true; + } else if (a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) { + // the ICCCM states that TEXT and COMPOUND_TEXT are in the + // encoding of choice, so we choose the encoding of the locale + QByteArray strData = QString::fromUtf8(QInternalMimeData::renderDataHelper( + QLatin1String("text/plain"), mimeData)).toLocal8Bit(); + char *list[] = { strData.data(), NULL }; + + XICCEncodingStyle style = (a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) + ? XCompoundTextStyle : XStdICCTextStyle; + XTextProperty textprop; + if (list[0] != NULL + && XmbTextListToTextProperty(display, list, 1, style, + &textprop) == Success) { + *atomFormat = textprop.encoding; + *dataFormat = textprop.format; + *data = QByteArray((const char *) textprop.value, textprop.nitems * textprop.format / 8); + ret = true; + + XFree(textprop.value); + } + } + } else if (atomName == QLatin1String("text/x-moz-url") && + QInternalMimeData::hasFormatHelper(QLatin1String("text/uri-list"), mimeData)) { + QByteArray uri = QInternalMimeData::renderDataHelper( + QLatin1String("text/uri-list"), mimeData).split('\n').first(); + QString mozUri = QString::fromLatin1(uri, uri.size()); + mozUri += QLatin1Char('\n'); + *data = QByteArray(reinterpret_cast<const char *>(mozUri.utf16()), mozUri.length() * 2); + ret = true; + } else if ((a == XA_PIXMAP || a == XA_BITMAP) && mimeData->hasImage()) { + ret = true; + } + } + return ret && data != 0; +} + +QList<Atom> QXlibMime::mimeAtomsForFormat(Display *display, const QString &format) +{ + QList<Atom> atoms; + atoms.append(mimeStringToAtom(display, format)); + + // special cases for strings + if (format == QLatin1String("text/plain")) { + atoms.append(QXlibStatic::atom(QXlibStatic::UTF8_STRING)); + atoms.append(XA_STRING); + atoms.append(QXlibStatic::atom(QXlibStatic::TEXT)); + atoms.append(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)); + } + + // special cases for uris + if (format == QLatin1String("text/uri-list")) { + atoms.append(mimeStringToAtom(display,QLatin1String("text/x-moz-url"))); + } + + //special cases for images + if (format == QLatin1String("image/ppm")) + atoms.append(XA_PIXMAP); + if (format == QLatin1String("image/pbm")) + atoms.append(XA_BITMAP); + + return atoms; +} + +QVariant QXlibMime::mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding) +{ + QString atomName = mimeAtomToString(display,a); + if (atomName == format) + return data; + + if (!encoding.isEmpty() + && atomName == format + QLatin1String(";charset=") + QString::fromLatin1(encoding)) { + + if (requestedType == QVariant::String) { + QTextCodec *codec = QTextCodec::codecForName(encoding); + if (codec) + return codec->toUnicode(data); + } + + return data; + } + + // special cases for string types + if (format == QLatin1String("text/plain")) { + if (a == QXlibStatic::atom(QXlibStatic::UTF8_STRING)) + return QString::fromUtf8(data); + if (a == XA_STRING) + return QString::fromLatin1(data); + if (a == QXlibStatic::atom(QXlibStatic::TEXT) + || a == QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT)) + // #### might be wrong for COMPUND_TEXT + return QString::fromLocal8Bit(data, data.size()); + } + + // special case for uri types + if (format == QLatin1String("text/uri-list")) { + if (atomName == QLatin1String("text/x-moz-url")) { + // we expect this as utf16 <url><space><title> + // the first part is a url that should only contain ascci char + // so it should be safe to check that the second char is 0 + // to verify that it is utf16 + if (data.size() > 1 && data.at(1) == 0) + return QString::fromRawData((const QChar *)data.constData(), + data.size() / 2).split(QLatin1Char('\n')).first().toLatin1(); + } + } + + // special cas for images + if (format == QLatin1String("image/ppm")) { + if (a == XA_PIXMAP && data.size() == sizeof(Pixmap)) { + Pixmap xpm = *((Pixmap*)data.data()); + if (!xpm) + return QByteArray(); + Window root; + int x; + int y; + uint width; + uint height; + uint border_width; + uint depth; + + XGetGeometry(display, xpm, &root, &x, &y, &width, &height, &border_width, &depth); + XImage *ximg = XGetImage(display,xpm,x,y,width,height,AllPlanes,depth==1 ? XYPixmap : ZPixmap); + QImage qimg = QXlibStatic::qimageFromXImage(ximg); + XDestroyImage(ximg); + + QImageWriter imageWriter; + imageWriter.setFormat("PPMRAW"); + QBuffer buf; + buf.open(QIODevice::WriteOnly); + imageWriter.setDevice(&buf); + imageWriter.write(qimg); + return buf.buffer(); + } + } + return QVariant(); +} + +Atom QXlibMime::mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding) +{ + requestedEncoding->clear(); + + // find matches for string types + if (format == QLatin1String("text/plain")) { + if (atoms.contains(QXlibStatic::atom(QXlibStatic::UTF8_STRING))) + return QXlibStatic::atom(QXlibStatic::UTF8_STRING); + if (atoms.contains(QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT))) + return QXlibStatic::atom(QXlibStatic::COMPOUND_TEXT); + if (atoms.contains(QXlibStatic::atom(QXlibStatic::TEXT))) + return QXlibStatic::atom(QXlibStatic::TEXT); + if (atoms.contains(XA_STRING)) + return XA_STRING; + } + + // find matches for uri types + if (format == QLatin1String("text/uri-list")) { + Atom a = mimeStringToAtom(display,format); + if (a && atoms.contains(a)) + return a; + a = mimeStringToAtom(display,QLatin1String("text/x-moz-url")); + if (a && atoms.contains(a)) + return a; + } + + // find match for image + if (format == QLatin1String("image/ppm")) { + if (atoms.contains(XA_PIXMAP)) + return XA_PIXMAP; + } + + // for string/text requests try to use a format with a well-defined charset + // first to avoid encoding problems + if (requestedType == QVariant::String + && format.startsWith(QLatin1String("text/")) + && !format.contains(QLatin1String("charset="))) { + + QString formatWithCharset = format; + formatWithCharset.append(QLatin1String(";charset=utf-8")); + + Atom a = mimeStringToAtom(display,formatWithCharset); + if (a && atoms.contains(a)) { + *requestedEncoding = "utf-8"; + return a; + } + } + + Atom a = mimeStringToAtom(display,format); + if (a && atoms.contains(a)) + return a; + + return 0; +} diff --git a/src/plugins/platforms/xlib/qxlibmime.h b/src/plugins/platforms/xlib/qxlibmime.h new file mode 100644 index 0000000..6a70ea4 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibmime.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITEMIME_H +#define QTESTLITEMIME_H + +#include <private/qdnd_p.h> + +#include <QtGui/QClipboard> + +#include "qtestliteintegration.h" +#include "qtestliteclipboard.h" + +class QXlibMime : public QInternalMimeData { + Q_OBJECT +public: + QXlibMime(); + ~QXlibMime(); + + static QList<Atom> mimeAtomsForFormat(Display *display, const QString &format); + static QString mimeAtomToString(Display *display, Atom a); + static bool mimeDataForAtom(Display *display, Atom a, QMimeData *mimeData, QByteArray *data, Atom *atomFormat, int *dataFormat); + static QStringList mimeFormatsForAtom(Display *display, Atom a); + static Atom mimeStringToAtom(Display *display, const QString &mimeType); + static QVariant mimeConvertToFormat(Display *display, Atom a, const QByteArray &data, const QString &format, QVariant::Type requestedType, const QByteArray &encoding); + static Atom mimeAtomForFormat(Display *display, const QString &format, QVariant::Type requestedType, const QList<Atom> &atoms, QByteArray *requestedEncoding); +}; + +#endif // QTESTLITEMIME_H diff --git a/src/plugins/platforms/xlib/qxlibscreen.cpp b/src/plugins/platforms/xlib/qxlibscreen.cpp new file mode 100644 index 0000000..714c17b --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibscreen.cpp @@ -0,0 +1,468 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitescreen.h" + +#include "qtestlitecursor.h" +#include "qtestlitewindow.h" +#include "qtestlitekeyboard.h" +#include "qtestlitestaticinfo.h" +#include "qtestliteclipboard.h" + +#include <QtCore/QDebug> +#include <QtCore/QSocketNotifier> +#include <QtCore/QElapsedTimer> + +#include <private/qapplication_p.h> + +#include <X11/extensions/Xfixes.h> + +QT_BEGIN_NAMESPACE + +static int (*original_x_errhandler)(Display *dpy, XErrorEvent *); +static bool seen_badwindow; + +static int qt_x_errhandler(Display *dpy, XErrorEvent *err) +{ + +qDebug() << "qt_x_errhandler" << err->error_code; + + switch (err->error_code) { + case BadAtom: +#if 0 + if (err->request_code == 20 /* X_GetProperty */ + && (err->resourceid == XA_RESOURCE_MANAGER + || err->resourceid == XA_RGB_DEFAULT_MAP + || err->resourceid == ATOM(_NET_SUPPORTED) + || err->resourceid == ATOM(_NET_SUPPORTING_WM_CHECK) + || err->resourceid == ATOM(KDE_FULL_SESSION) + || err->resourceid == ATOM(KWIN_RUNNING) + || err->resourceid == ATOM(XdndProxy) + || err->resourceid == ATOM(XdndAware)) + + + ) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } +#endif + qDebug() << "BadAtom"; + break; + + case BadWindow: + if (err->request_code == 2 /* X_ChangeWindowAttributes */ + || err->request_code == 38 /* X_QueryPointer */) { + for (int i = 0; i < ScreenCount(dpy); ++i) { + if (err->resourceid == RootWindow(dpy, i)) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } + } + } + seen_badwindow = true; + if (err->request_code == 25 /* X_SendEvent */) { + for (int i = 0; i < ScreenCount(dpy); ++i) { + if (err->resourceid == RootWindow(dpy, i)) { + // Perhaps we're running under SECURITY reduction? :/ + return 0; + } + } +#if 0 + if (X11->xdndHandleBadwindow()) { + qDebug("xdndHandleBadwindow returned true"); + return 0; + } +#endif + } +#if 0 + if (X11->ignore_badwindow) + return 0; +#endif + break; + + case BadMatch: + if (err->request_code == 42 /* X_SetInputFocus */) + return 0; + break; + + default: +#if 0 //!defined(QT_NO_XINPUT) + if (err->request_code == X11->xinput_major + && err->error_code == (X11->xinput_errorbase + XI_BadDevice) + && err->minor_code == 3 /* X_OpenDevice */) { + return 0; + } +#endif + break; + } + + char errstr[256]; + XGetErrorText( dpy, err->error_code, errstr, 256 ); + char buffer[256]; + char request_str[256]; + qsnprintf(buffer, 256, "%d", err->request_code); + XGetErrorDatabaseText(dpy, "XRequest", buffer, "", request_str, 256); + if (err->request_code < 128) { + // X error for a normal protocol request + qWarning( "X Error: %s %d\n" + " Major opcode: %d (%s)\n" + " Resource id: 0x%lx", + errstr, err->error_code, + err->request_code, + request_str, + err->resourceid ); + } else { + // X error for an extension request + const char *extensionName = 0; +#if 0 + if (err->request_code == X11->xrender_major) + extensionName = "RENDER"; + else if (err->request_code == X11->xrandr_major) + extensionName = "RANDR"; + else if (err->request_code == X11->xinput_major) + extensionName = "XInputExtension"; + else if (err->request_code == X11->mitshm_major) + extensionName = "MIT-SHM"; +#endif + char minor_str[256]; + if (extensionName) { + qsnprintf(buffer, 256, "%s.%d", extensionName, err->minor_code); + XGetErrorDatabaseText(dpy, "XRequest", buffer, "", minor_str, 256); + } else { + extensionName = "Uknown extension"; + qsnprintf(minor_str, 256, "Unknown request"); + } + qWarning( "X Error: %s %d\n" + " Extension: %d (%s)\n" + " Minor opcode: %d (%s)\n" + " Resource id: 0x%lx", + errstr, err->error_code, + err->request_code, + extensionName, + err->minor_code, + minor_str, + err->resourceid ); + } + + // ### we really should distinguish between severe, non-severe and + // ### application specific errors + + return 0; +} + +QXlibScreen::QXlibScreen() + : mFormat(QImage::Format_RGB32) +{ + char *display_name = getenv("DISPLAY"); + mDisplay = XOpenDisplay(display_name); + mDisplayName = QString::fromLocal8Bit(display_name); + if (!mDisplay) { + fprintf(stderr, "Cannot connect to X server: %s\n", + display_name); + exit(1); + } + +#ifndef DONT_USE_MIT_SHM + Status MIT_SHM_extension_supported = XShmQueryExtension (mDisplay); + Q_ASSERT(MIT_SHM_extension_supported == True); +#endif + original_x_errhandler = XSetErrorHandler(qt_x_errhandler); + + if (qgetenv("DO_X_SYNCHRONIZE").toInt()) + XSynchronize(mDisplay, true); + + mScreen = DefaultScreen(mDisplay); + XSelectInput(mDisplay,rootWindow(), KeymapStateMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask); + int width = DisplayWidth(mDisplay, mScreen); + int height = DisplayHeight(mDisplay, mScreen); + mGeometry = QRect(0,0,width,height); + + int physicalWidth = DisplayWidthMM(mDisplay, mScreen); + int physicalHeight = DisplayHeightMM(mDisplay, mScreen); + mPhysicalSize = QSize(physicalWidth,physicalHeight); + + int xSocketNumber = XConnectionNumber(mDisplay); + + mDepth = DefaultDepth(mDisplay,mScreen); +#ifdef MYX11_DEBUG + qDebug() << "X socket:"<< xSocketNumber; +#endif + QSocketNotifier *sock = new QSocketNotifier(xSocketNumber, QSocketNotifier::Read, this); + connect(sock, SIGNAL(activated(int)), this, SLOT(eventDispatcher())); + + mCursor = new QXlibCursor(this); + mKeyboard = new QXlibKeyboard(this); +} + +QXlibScreen::~QXlibScreen() +{ + delete mCursor; + XCloseDisplay(mDisplay); +} + +#ifdef KeyPress +#undef KeyPress +#endif +#ifdef KeyRelease +#undef KeyRelease +#endif + +bool QXlibScreen::handleEvent(XEvent *xe) +{ + int quit = false; + QXlibWindow *platformWindow = 0; + QWidget *widget = QWidget::find(xe->xany.window); + if (widget) { + platformWindow = static_cast<QXlibWindow *>(widget->platformWindow()); + } + + Atom wmProtocolsAtom = QXlibStatic::atom(QXlibStatic::WM_PROTOCOLS); + Atom wmDeleteWindowAtom = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); + switch (xe->type) { + + case ClientMessage: + if (xe->xclient.format == 32 && xe->xclient.message_type == wmProtocolsAtom) { + Atom a = xe->xclient.data.l[0]; + if (a == wmDeleteWindowAtom) + platformWindow->handleCloseEvent(); + } + break; + + case Expose: + if (platformWindow) + if (xe->xexpose.count == 0) + platformWindow->paintEvent(); + break; + case ConfigureNotify: + if (platformWindow) + platformWindow->resizeEvent(&xe->xconfigure); + break; + + case ButtonPress: + if (platformWindow) + platformWindow->mousePressEvent(&xe->xbutton); + break; + + case ButtonRelease: + if (platformWindow) + platformWindow->handleMouseEvent(QEvent::MouseButtonRelease, &xe->xbutton); + break; + + case MotionNotify: + if (platformWindow) + platformWindow->handleMouseEvent(QEvent::MouseMove, &xe->xbutton); + break; + + case XKeyPress: + mKeyboard->handleKeyEvent(widget,QEvent::KeyPress, &xe->xkey); + break; + + case XKeyRelease: + mKeyboard->handleKeyEvent(widget,QEvent::KeyRelease, &xe->xkey); + break; + + case EnterNotify: + if (platformWindow) + platformWindow->handleEnterEvent(); + break; + + case LeaveNotify: + if (platformWindow) + platformWindow->handleLeaveEvent(); + break; + + case XFocusIn: + if (platformWindow) + platformWindow->handleFocusInEvent(); + break; + + case XFocusOut: + if (platformWindow) + platformWindow->handleFocusOutEvent(); + break; + + case PropertyNotify: + break; + + case SelectionClear: + qDebug() << "Selection Clear!!!"; + break; + case SelectionRequest: + handleSelectionRequest(xe); + break; + case SelectionNotify: + qDebug() << "Selection Notify!!!!"; + + break; + + + default: +#ifdef MYX11_DEBUG + qDebug() << hex << xe->xany.window << "Other X event" << xe->type; +#endif + break; + } + + return quit; +} + +static Bool checkForClipboardEvents(Display *, XEvent *e, XPointer) +{ + Atom clipboard = QXlibStatic::atom(QXlibStatic::CLIPBOARD); + return ((e->type == SelectionRequest && (e->xselectionrequest.selection == XA_PRIMARY + || e->xselectionrequest.selection == clipboard)) + || (e->type == SelectionClear && (e->xselectionclear.selection == XA_PRIMARY + || e->xselectionclear.selection == clipboard))); +} + +bool QXlibScreen::waitForClipboardEvent(Window win, int type, XEvent *event, int timeout) +{ + QElapsedTimer timer; + timer.start(); + do { + if (XCheckTypedWindowEvent(mDisplay,win,type,event)) + return true; + + // process other clipboard events, since someone is probably requesting data from us + XEvent e; + if (XCheckIfEvent(mDisplay, &e, checkForClipboardEvents, 0)) + handleEvent(&e); + + XFlush(mDisplay); + + // sleep 50 ms, so we don't use up CPU cycles all the time. + struct timeval usleep_tv; + usleep_tv.tv_sec = 0; + usleep_tv.tv_usec = 50000; + select(0, 0, 0, 0, &usleep_tv); + } while (timer.elapsed() < timeout); + return false; +} + +void QXlibScreen::eventDispatcher() +{ + ulong marker = XNextRequest(mDisplay); + // int i = 0; + while (XPending(mDisplay)) { + XEvent event; + XNextEvent(mDisplay, &event); + /* done = */ + handleEvent(&event); + + if (event.xany.serial >= marker) { + #ifdef MYX11_DEBUG + qDebug() << "potential livelock averted"; + #endif + #if 0 + if (XEventsQueued(mDisplay, QueuedAfterFlush)) { + qDebug() << " with events queued"; + QTimer::singleShot(0, this, SLOT(eventDispatcher())); + } + #endif + break; + } + } +} + +QImage QXlibScreen::grabWindow(Window window, int x, int y, int w, int h) +{ + if (w == 0 || h ==0) + return QImage(); + + //WinId 0 means the desktop widget + if (!window) + window = rootWindow(); + + XWindowAttributes window_attr; + if (!XGetWindowAttributes(mDisplay, window, &window_attr)) + return QImage(); + + if (w < 0) + w = window_attr.width - x; + if (h < 0) + h = window_attr.height - y; + + // Ideally, we should also limit ourselves to the screen area, but the Qt docs say + // that it's "unsafe" to go outside the screen, so we can ignore that problem. + + //We're definitely not optimizing for speed... + XImage *xi = XGetImage(mDisplay, window, x, y, w, h, AllPlanes, ZPixmap); + + if (!xi) + return QImage(); + + //taking a copy to make sure we have ownership -- not fast + QImage result = QImage( (uchar*) xi->data, xi->width, xi->height, xi->bytes_per_line, QImage::Format_RGB32 ).copy(); + + XDestroyImage(xi); + + return result; +} + +QXlibScreen * QXlibScreen::testLiteScreenForWidget(QWidget *widget) +{ + QPlatformScreen *platformScreen = platformScreenForWidget(widget); + return static_cast<QXlibScreen *>(platformScreen); +} + +Display * QXlibScreen::display() const +{ + return mDisplay; +} + +int QXlibScreen::xScreenNumber() const +{ + return mScreen; +} + +QXlibKeyboard * QXlibScreen::keyboard() const +{ + return mKeyboard; +} + +void QXlibScreen::handleSelectionRequest(XEvent *event) +{ + QPlatformIntegration *integration = QApplicationPrivate::platformIntegration(); + QXlibClipboard *clipboard = static_cast<QXlibClipboard *>(integration->clipboard()); + clipboard->handleSelectionRequest(event); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibscreen.h b/src/plugins/platforms/xlib/qxlibscreen.h new file mode 100644 index 0000000..7e59a59 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibscreen.h @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITESCREEN_H +#define QTESTLITESCREEN_H + +#include <QtGui/QPlatformScreen> +#include "qtestliteintegration.h" + +QT_BEGIN_NAMESPACE + +class QXlibCursor; +class QXlibKeyboard; + +class QXlibScreen : public QPlatformScreen +{ + Q_OBJECT +public: + QXlibScreen(); + + ~QXlibScreen(); + + QString displayName() const { return mDisplayName; } + + QRect geometry() const { return mGeometry; } + int depth() const { return mDepth; } + QImage::Format format() const { return mFormat; } + QSize physicalSize() const { return mPhysicalSize; } + + Window rootWindow() { return RootWindow(mDisplay, mScreen); } + unsigned long blackPixel() { return BlackPixel(mDisplay, mScreen); } + unsigned long whitePixel() { return WhitePixel(mDisplay, mScreen); } + + bool handleEvent(XEvent *xe); + bool waitForClipboardEvent(Window win, int type, XEvent *event, int timeout); + + QImage grabWindow(Window window, int x, int y, int w, int h); + + static QXlibScreen *testLiteScreenForWidget(QWidget *widget); + + Display *display() const; + int xScreenNumber() const; + + QXlibKeyboard *keyboard() const; + +public slots: + void eventDispatcher(); + +private: + + void handleSelectionRequest(XEvent *event); + QString mDisplayName; + QRect mGeometry; + QSize mPhysicalSize; + int mDepth; + QImage::Format mFormat; + QXlibCursor *mCursor; + QXlibKeyboard *mKeyboard; + + Display * mDisplay; + int mScreen; +}; + +QT_END_NAMESPACE + +#endif // QTESTLITESCREEN_H diff --git a/src/plugins/platforms/xlib/qxlibstatic.cpp b/src/plugins/platforms/xlib/qxlibstatic.cpp new file mode 100644 index 0000000..837636c --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibstatic.cpp @@ -0,0 +1,511 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitestaticinfo.h" +#include "qtestlitescreen.h" + +#include <qplatformdefs.h> + +#include <QtGui/private/qapplication_p.h> +#include <QtCore/QBuffer> +#include <QtCore/QLibrary> + +#include <QDebug> + +#ifndef QT_NO_XFIXES +#include <X11/extensions/Xfixes.h> +#endif // QT_NO_XFIXES + +static const char * x11_atomnames = { + // window-manager <-> client protocols + "WM_PROTOCOLS\0" + "WM_DELETE_WINDOW\0" + "WM_TAKE_FOCUS\0" + "_NET_WM_PING\0" + "_NET_WM_CONTEXT_HELP\0" + "_NET_WM_SYNC_REQUEST\0" + "_NET_WM_SYNC_REQUEST_COUNTER\0" + + // ICCCM window state + "WM_STATE\0" + "WM_CHANGE_STATE\0" + + // Session management + "WM_CLIENT_LEADER\0" + "WM_WINDOW_ROLE\0" + "SM_CLIENT_ID\0" + + // Clipboard + "CLIPBOARD\0" + "INCR\0" + "TARGETS\0" + "MULTIPLE\0" + "TIMESTAMP\0" + "SAVE_TARGETS\0" + "CLIP_TEMPORARY\0" + "_QT_SELECTION\0" + "_QT_CLIPBOARD_SENTINEL\0" + "_QT_SELECTION_SENTINEL\0" + "CLIPBOARD_MANAGER\0" + + "RESOURCE_MANAGER\0" + + "_XSETROOT_ID\0" + + "_QT_SCROLL_DONE\0" + "_QT_INPUT_ENCODING\0" + + "_MOTIF_WM_HINTS\0" + + "DTWM_IS_RUNNING\0" + "ENLIGHTENMENT_DESKTOP\0" + "_DT_SAVE_MODE\0" + "_SGI_DESKS_MANAGER\0" + + // EWMH (aka NETWM) + "_NET_SUPPORTED\0" + "_NET_VIRTUAL_ROOTS\0" + "_NET_WORKAREA\0" + + "_NET_MOVERESIZE_WINDOW\0" + "_NET_WM_MOVERESIZE\0" + + "_NET_WM_NAME\0" + "_NET_WM_ICON_NAME\0" + "_NET_WM_ICON\0" + + "_NET_WM_PID\0" + + "_NET_WM_WINDOW_OPACITY\0" + + "_NET_WM_STATE\0" + "_NET_WM_STATE_ABOVE\0" + "_NET_WM_STATE_BELOW\0" + "_NET_WM_STATE_FULLSCREEN\0" + "_NET_WM_STATE_MAXIMIZED_HORZ\0" + "_NET_WM_STATE_MAXIMIZED_VERT\0" + "_NET_WM_STATE_MODAL\0" + "_NET_WM_STATE_STAYS_ON_TOP\0" + "_NET_WM_STATE_DEMANDS_ATTENTION\0" + + "_NET_WM_USER_TIME\0" + "_NET_WM_USER_TIME_WINDOW\0" + "_NET_WM_FULL_PLACEMENT\0" + + "_NET_WM_WINDOW_TYPE\0" + "_NET_WM_WINDOW_TYPE_DESKTOP\0" + "_NET_WM_WINDOW_TYPE_DOCK\0" + "_NET_WM_WINDOW_TYPE_TOOLBAR\0" + "_NET_WM_WINDOW_TYPE_MENU\0" + "_NET_WM_WINDOW_TYPE_UTILITY\0" + "_NET_WM_WINDOW_TYPE_SPLASH\0" + "_NET_WM_WINDOW_TYPE_DIALOG\0" + "_NET_WM_WINDOW_TYPE_DROPDOWN_MENU\0" + "_NET_WM_WINDOW_TYPE_POPUP_MENU\0" + "_NET_WM_WINDOW_TYPE_TOOLTIP\0" + "_NET_WM_WINDOW_TYPE_NOTIFICATION\0" + "_NET_WM_WINDOW_TYPE_COMBO\0" + "_NET_WM_WINDOW_TYPE_DND\0" + "_NET_WM_WINDOW_TYPE_NORMAL\0" + "_KDE_NET_WM_WINDOW_TYPE_OVERRIDE\0" + + "_KDE_NET_WM_FRAME_STRUT\0" + + "_NET_STARTUP_INFO\0" + "_NET_STARTUP_INFO_BEGIN\0" + + "_NET_SUPPORTING_WM_CHECK\0" + + "_NET_WM_CM_S0\0" + + "_NET_SYSTEM_TRAY_VISUAL\0" + + "_NET_ACTIVE_WINDOW\0" + + // Property formats + "COMPOUND_TEXT\0" + "TEXT\0" + "UTF8_STRING\0" + + // xdnd + "XdndEnter\0" + "XdndPosition\0" + "XdndStatus\0" + "XdndLeave\0" + "XdndDrop\0" + "XdndFinished\0" + "XdndTypeList\0" + "XdndActionList\0" + + "XdndSelection\0" + + "XdndAware\0" + "XdndProxy\0" + + "XdndActionCopy\0" + "XdndActionLink\0" + "XdndActionMove\0" + "XdndActionPrivate\0" + + // Motif DND + "_MOTIF_DRAG_AND_DROP_MESSAGE\0" + "_MOTIF_DRAG_INITIATOR_INFO\0" + "_MOTIF_DRAG_RECEIVER_INFO\0" + "_MOTIF_DRAG_WINDOW\0" + "_MOTIF_DRAG_TARGETS\0" + + "XmTRANSFER_SUCCESS\0" + "XmTRANSFER_FAILURE\0" + + // Xkb + "_XKB_RULES_NAMES\0" + + // XEMBED + "_XEMBED\0" + "_XEMBED_INFO\0" + + // Wacom old. (before version 0.10) + "Wacom Stylus\0" + "Wacom Cursor\0" + "Wacom Eraser\0" + + // Tablet + "STYLUS\0" + "ERASER\0" +}; + +/*! + \internal + Try to resolve a \a symbol from \a library with the version specified + by \a vernum. + + Note that, in the case of the Xfixes library, \a vernum is not the same as + \c XFIXES_MAJOR - it is a part of soname and may differ from the Xfixes + version. +*/ +static void* qt_load_library_runtime(const char *library, int vernum, + int highestVernum, const char *symbol) +{ + QList<int> versions; + // we try to load in the following order: + // explicit version -> the default one -> (from the highest (highestVernum) to the lowest (vernum) ) + if (vernum != -1) + versions << vernum; + versions << -1; + if (vernum != -1) { + for(int i = highestVernum; i > vernum; --i) + versions << i; + } + Q_FOREACH(int version, versions) { + QLatin1String libName(library); + QLibrary xfixesLib(libName, version); + void *ptr = xfixesLib.resolve(symbol); + if (ptr) + return ptr; + } + return 0; +} + +# define XFIXES_LOAD_RUNTIME(vernum, symbol, symbol_type) \ + (symbol_type)qt_load_library_runtime("libXfixes", vernum, 4, #symbol); +# define XFIXES_LOAD_V1(symbol) \ + XFIXES_LOAD_RUNTIME(1, symbol, Ptr##symbol) +# define XFIXES_LOAD_V2(symbol) \ + XFIXES_LOAD_RUNTIME(2, symbol, Ptr##symbol) + + +class QTestLiteStaticInfoPrivate +{ +public: + QTestLiteStaticInfoPrivate() + : use_xfixes(false) + , xfixes_major(0) + , xfixes_eventbase(0) + , xfixes_errorbase(0) + { + QXlibScreen *screen = qobject_cast<QXlibScreen *> (QApplicationPrivate::platformIntegration()->screens().at(0)); + Q_ASSERT(screen); + + initializeAllAtoms(screen); + initializeSupportedAtoms(screen); + + resolveXFixes(screen); + } + + bool isSupportedByWM(Atom atom) + { + if (!m_supportedAtoms) + return false; + + bool supported = false; + int i = 0; + while (m_supportedAtoms[i] != 0) { + if (m_supportedAtoms[i++] == atom) { + supported = true; + break; + } + } + + return supported; + } + + Atom atom(QXlibStatic::X11Atom atom) + { + return m_allAtoms[atom]; + } + + bool useXFixes() const { return use_xfixes; } + + int xFixesEventBase() const {return xfixes_eventbase; } + + PtrXFixesSelectSelectionInput xFixesSelectSelectionInput() const + { + return ptrXFixesSelectSelectionInput; + } + + QImage qimageFromXImage(XImage *xi) + { + QImage::Format format = QImage::Format_ARGB32_Premultiplied; + if (xi->depth == 24) + format = QImage::Format_RGB32; + else if (xi->depth == 16) + format = QImage::Format_RGB16; + + QImage image = QImage((uchar *)xi->data, xi->width, xi->height, xi->bytes_per_line, format).copy(); + + // we may have to swap the byte order + if ((QSysInfo::ByteOrder == QSysInfo::LittleEndian && xi->byte_order == MSBFirst) + || (QSysInfo::ByteOrder == QSysInfo::BigEndian && xi->byte_order == LSBFirst)) + { + for (int i=0; i < image.height(); i++) { + if (xi->depth == 16) { + ushort *p = (ushort*)image.scanLine(i); + ushort *end = p + image.width(); + while (p < end) { + *p = ((*p << 8) & 0xff00) | ((*p >> 8) & 0x00ff); + p++; + } + } else { + uint *p = (uint*)image.scanLine(i); + uint *end = p + image.width(); + while (p < end) { + *p = ((*p << 24) & 0xff000000) | ((*p << 8) & 0x00ff0000) + | ((*p >> 8) & 0x0000ff00) | ((*p >> 24) & 0x000000ff); + p++; + } + } + } + } + + // fix-up alpha channel + if (format == QImage::Format_RGB32) { + QRgb *p = (QRgb *)image.bits(); + for (int y = 0; y < xi->height; ++y) { + for (int x = 0; x < xi->width; ++x) + p[x] |= 0xff000000; + p += xi->bytes_per_line / 4; + } + } + + return image; + } + + +private: + + void initializeAllAtoms(QXlibScreen *screen) { + const char *names[QXlibStatic::NAtoms]; + const char *ptr = x11_atomnames; + + int i = 0; + while (*ptr) { + names[i++] = ptr; + while (*ptr) + ++ptr; + ++ptr; + } + + Q_ASSERT(i == QXlibStatic::NPredefinedAtoms); + + QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_"); + settings_atom_name += XDisplayName(qPrintable(screen->displayName())); + names[i++] = settings_atom_name; + + Q_ASSERT(i == QXlibStatic::NAtoms); + #if 0//defined(XlibSpecificationRelease) && (XlibSpecificationRelease >= 6) + XInternAtoms(screen->display(), (char **)names, i, False, m_allAtoms); + #else + for (i = 0; i < QXlibStatic::NAtoms; ++i) + m_allAtoms[i] = XInternAtom(screen->display(), (char *)names[i], False); + #endif + } + + void initializeSupportedAtoms(QXlibScreen *screen) + { + Atom type; + int format; + long offset = 0; + unsigned long nitems, after; + unsigned char *data = 0; + + int e = XGetWindowProperty(screen->display(), screen->rootWindow(), + this->atom(QXlibStatic::_NET_SUPPORTED), 0, 0, + False, XA_ATOM, &type, &format, &nitems, &after, &data); + if (data) + XFree(data); + + if (e == Success && type == XA_ATOM && format == 32) { + QBuffer ts; + ts.open(QIODevice::WriteOnly); + + while (after > 0) { + XGetWindowProperty(screen->display(), screen->rootWindow(), + this->atom(QXlibStatic::_NET_SUPPORTED), offset, 1024, + False, XA_ATOM, &type, &format, &nitems, &after, &data); + + if (type == XA_ATOM && format == 32) { + ts.write(reinterpret_cast<char *>(data), nitems * sizeof(long)); + offset += nitems; + } else + after = 0; + if (data) + XFree(data); + } + + // compute nitems + QByteArray buffer(ts.buffer()); + nitems = buffer.size() / sizeof(Atom); + m_supportedAtoms = new Atom[nitems + 1]; + Atom *a = (Atom *) buffer.data(); + uint i; + for (i = 0; i < nitems; i++) + m_supportedAtoms[i] = a[i]; + m_supportedAtoms[nitems] = 0; + + } + } + + void resolveXFixes(QXlibScreen *screen) + { +#ifndef QT_NO_XFIXES + // See if Xfixes is supported on the connected display + if (XQueryExtension(screen->display(), "XFIXES", &xfixes_major, + &xfixes_eventbase, &xfixes_errorbase)) { + ptrXFixesQueryExtension = XFIXES_LOAD_V1(XFixesQueryExtension); + ptrXFixesQueryVersion = XFIXES_LOAD_V1(XFixesQueryVersion); + ptrXFixesSetCursorName = XFIXES_LOAD_V2(XFixesSetCursorName); + ptrXFixesSelectSelectionInput = XFIXES_LOAD_V2(XFixesSelectSelectionInput); + + if(ptrXFixesQueryExtension && ptrXFixesQueryVersion + && ptrXFixesQueryExtension(screen->display(), &xfixes_eventbase, + &xfixes_errorbase)) { + // Xfixes is supported. + // Note: the XFixes protocol version is negotiated using QueryVersion. + // We supply the highest version we support, the X server replies with + // the highest version it supports, but no higher than the version we + // asked for. The version sent back is the protocol version the X server + // will use to talk us. If this call is removed, the behavior of the + // X server when it receives an XFixes request is undefined. + int major = 3; + int minor = 0; + ptrXFixesQueryVersion(screen->display(), &major, &minor); + use_xfixes = (major >= 1); + xfixes_major = major; + } + } +#endif // QT_NO_XFIXES + + } + + Atom *m_supportedAtoms; + Atom m_allAtoms[QXlibStatic::NAtoms]; + +#ifndef QT_NO_XFIXES + PtrXFixesQueryExtension ptrXFixesQueryExtension; + PtrXFixesQueryVersion ptrXFixesQueryVersion; + PtrXFixesSetCursorName ptrXFixesSetCursorName; + PtrXFixesSelectSelectionInput ptrXFixesSelectSelectionInput; +#endif + + bool use_xfixes; + int xfixes_major; + int xfixes_eventbase; + int xfixes_errorbase; + +}; +Q_GLOBAL_STATIC(QTestLiteStaticInfoPrivate, qTestLiteStaticInfoPrivate); + + +Atom QXlibStatic::atom(QXlibStatic::X11Atom atom) +{ + return qTestLiteStaticInfoPrivate()->atom(atom); +} + +bool QXlibStatic::isSupportedByWM(Atom atom) +{ + return qTestLiteStaticInfoPrivate()->isSupportedByWM(atom); +} + +bool QXlibStatic::useXFixes() +{ + return qTestLiteStaticInfoPrivate()->useXFixes(); +} + +int QXlibStatic::xFixesEventBase() +{ + return qTestLiteStaticInfoPrivate()->xFixesEventBase(); +} + +#ifndef QT_NO_XFIXES +PtrXFixesSelectSelectionInput QXlibStatic::xFixesSelectSelectionInput() +{ + qDebug() << qTestLiteStaticInfoPrivate()->useXFixes(); + if (!qTestLiteStaticInfoPrivate()->useXFixes()) + return 0; + + return qTestLiteStaticInfoPrivate()->xFixesSelectSelectionInput(); +} + +QImage QXlibStatic::qimageFromXImage(XImage *xi) +{ + return qTestLiteStaticInfoPrivate()->qimageFromXImage(xi); +} +#endif //QT_NO_XFIXES diff --git a/src/plugins/platforms/xlib/qxlibstatic.h b/src/plugins/platforms/xlib/qxlibstatic.h new file mode 100644 index 0000000..8473ee9 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibstatic.h @@ -0,0 +1,413 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITESTATICINFO_H +#define QTESTLITESTATICINFO_H + +#include <QtCore/QTextStream> +#include <QtCore/QDataStream> +#include <QtCore/QMetaType> +#include <QtCore/QVariant> + +#if defined(_XLIB_H_) // crude hack, but... +#error "cannot include <X11/Xlib.h> before this file" +#endif +#define XRegisterIMInstantiateCallback qt_XRegisterIMInstantiateCallback +#define XUnregisterIMInstantiateCallback qt_XUnregisterIMInstantiateCallback +#define XSetIMValues qt_XSetIMValues +#include <X11/Xlib.h> +#undef XRegisterIMInstantiateCallback +#undef XUnregisterIMInstantiateCallback +#undef XSetIMValues + +#include <X11/Xutil.h> +#include <X11/Xos.h> +#ifdef index +# undef index +#endif +#ifdef rindex +# undef rindex +#endif +#ifdef Q_OS_VXWORS +# ifdef open +# undef open +# endif +# ifdef getpid +# undef getpid +# endif +#endif // Q_OS_VXWORKS +#include <X11/Xatom.h> + +//#define QT_NO_SHAPE +#ifdef QT_NO_SHAPE +# define XShapeCombineRegion(a,b,c,d,e,f,g) +# define XShapeCombineMask(a,b,c,d,e,f,g) +#else +# include <X11/extensions/shape.h> +#endif // QT_NO_SHAPE + + +#if !defined (QT_NO_TABLET) +# include <X11/extensions/XInput.h> +#if defined (Q_OS_IRIX) +# include <X11/extensions/SGIMisc.h> +# include <wacom.h> +#endif +#endif // QT_NO_TABLET + + +// #define QT_NO_XINERAMA +#ifndef QT_NO_XINERAMA +// XFree86 does not C++ify Xinerama (at least up to XFree86 4.0.3). +extern "C" { +# include <X11/extensions/Xinerama.h> +} +#endif // QT_NO_XINERAMA + +// #define QT_NO_XRANDR +#ifndef QT_NO_XRANDR +# include <X11/extensions/Xrandr.h> +#endif // QT_NO_XRANDR + +// #define QT_NO_XRENDER +#ifndef QT_NO_XRENDER +# include <X11/extensions/Xrender.h> +#endif // QT_NO_XRENDER + +#ifndef QT_NO_XSYNC +extern "C" { +# include "X11/extensions/sync.h" +} +#endif + +// #define QT_NO_XKB +#ifndef QT_NO_XKB +# include <X11/XKBlib.h> +#endif // QT_NO_XKB + + +#if !defined(XlibSpecificationRelease) +# define X11R4 +typedef char *XPointer; +#else +# undef X11R4 +#endif + +#ifndef QT_NO_XFIXES +typedef Bool (*PtrXFixesQueryExtension)(Display *, int *, int *); +typedef Status (*PtrXFixesQueryVersion)(Display *, int *, int *); +typedef void (*PtrXFixesSetCursorName)(Display *dpy, Cursor cursor, const char *name); +typedef void (*PtrXFixesSelectSelectionInput)(Display *dpy, Window win, Atom selection, unsigned long eventMask); +#endif // QT_NO_XFIXES + +#ifndef QT_NO_XCURSOR +#include <X11/Xcursor/Xcursor.h> +typedef Cursor (*PtrXcursorLibraryLoadCursor)(Display *, const char *); +#endif // QT_NO_XCURSOR + +#ifndef QT_NO_XINERAMA +typedef Bool (*PtrXineramaQueryExtension)(Display *dpy, int *event_base, int *error_base); +typedef Bool (*PtrXineramaIsActive)(Display *dpy); +typedef XineramaScreenInfo *(*PtrXineramaQueryScreens)(Display *dpy, int *number); +#endif // QT_NO_XINERAMA + +#ifndef QT_NO_XRANDR +typedef void (*PtrXRRSelectInput)(Display *, Window, int); +typedef int (*PtrXRRUpdateConfiguration)(XEvent *); +typedef int (*PtrXRRRootToScreen)(Display *, Window); +typedef Bool (*PtrXRRQueryExtension)(Display *, int *, int *); +#endif // QT_NO_XRANDR + +#ifndef QT_NO_XINPUT +typedef int (*PtrXCloseDevice)(Display *, XDevice *); +typedef XDeviceInfo* (*PtrXListInputDevices)(Display *, int *); +typedef XDevice* (*PtrXOpenDevice)(Display *, XID); +typedef void (*PtrXFreeDeviceList)(XDeviceInfo *); +typedef int (*PtrXSelectExtensionEvent)(Display *, Window, XEventClass *, int); +#endif // QT_NO_XINPUT + +/* + * Solaris patch 108652-47 and higher fixes crases in + * XRegisterIMInstantiateCallback, but the function doesn't seem to + * work. + * + * Instead, we disabled R6 input, and open the input method + * immediately at application start. + */ + +//######### XFree86 has wrong declarations for XRegisterIMInstantiateCallback +//######### and XUnregisterIMInstantiateCallback in at least version 3.3.2. +//######### Many old X11R6 header files lack XSetIMValues. +//######### Therefore, we have to declare these functions ourselves. + +extern "C" Bool XRegisterIMInstantiateCallback( + Display*, + struct _XrmHashBucketRec*, + char*, + char*, + XIMProc, //XFree86 has XIDProc, which has to be wrong + XPointer +); + +extern "C" Bool XUnregisterIMInstantiateCallback( + Display*, + struct _XrmHashBucketRec*, + char*, + char*, + XIMProc, //XFree86 has XIDProc, which has to be wrong + XPointer +); + +#ifndef X11R4 +# include <X11/Xlocale.h> +#endif // X11R4 + + +#ifndef QT_NO_MITSHM +# include <X11/extensions/XShm.h> +#endif // QT_NO_MITSHM + +// rename a couple of X defines to get rid of name clashes +// resolve the conflict between X11's FocusIn and QEvent::FocusIn +enum { + XFocusOut = FocusOut, + XFocusIn = FocusIn, + XKeyPress = KeyPress, + XKeyRelease = KeyRelease, + XNone = None, + XRevertToParent = RevertToParent, + XGrayScale = GrayScale, + XCursorShape = CursorShape +}; +#undef FocusOut +#undef FocusIn +#undef KeyPress +#undef KeyRelease +#undef None +#undef RevertToParent +#undef GrayScale +#undef CursorShape + +#ifdef FontChange +#undef FontChange +#endif + + +class QXlibStatic +{ +public: + enum X11Atom { + // window-manager <-> client protocols + WM_PROTOCOLS, + WM_DELETE_WINDOW, + WM_TAKE_FOCUS, + _NET_WM_PING, + _NET_WM_CONTEXT_HELP, + _NET_WM_SYNC_REQUEST, + _NET_WM_SYNC_REQUEST_COUNTER, + + // ICCCM window state + WM_STATE, + WM_CHANGE_STATE, + + // Session management + WM_CLIENT_LEADER, + WM_WINDOW_ROLE, + SM_CLIENT_ID, + + // Clipboard + CLIPBOARD, + INCR, + TARGETS, + MULTIPLE, + TIMESTAMP, + SAVE_TARGETS, + CLIP_TEMPORARY, + _QT_SELECTION, + _QT_CLIPBOARD_SENTINEL, + _QT_SELECTION_SENTINEL, + CLIPBOARD_MANAGER, + + RESOURCE_MANAGER, + + _XSETROOT_ID, + + _QT_SCROLL_DONE, + _QT_INPUT_ENCODING, + + _MOTIF_WM_HINTS, + + DTWM_IS_RUNNING, + ENLIGHTENMENT_DESKTOP, + _DT_SAVE_MODE, + _SGI_DESKS_MANAGER, + + // EWMH (aka NETWM) + _NET_SUPPORTED, + _NET_VIRTUAL_ROOTS, + _NET_WORKAREA, + + _NET_MOVERESIZE_WINDOW, + _NET_WM_MOVERESIZE, + + _NET_WM_NAME, + _NET_WM_ICON_NAME, + _NET_WM_ICON, + + _NET_WM_PID, + + _NET_WM_WINDOW_OPACITY, + + _NET_WM_STATE, + _NET_WM_STATE_ABOVE, + _NET_WM_STATE_BELOW, + _NET_WM_STATE_FULLSCREEN, + _NET_WM_STATE_MAXIMIZED_HORZ, + _NET_WM_STATE_MAXIMIZED_VERT, + _NET_WM_STATE_MODAL, + _NET_WM_STATE_STAYS_ON_TOP, + _NET_WM_STATE_DEMANDS_ATTENTION, + + _NET_WM_USER_TIME, + _NET_WM_USER_TIME_WINDOW, + _NET_WM_FULL_PLACEMENT, + + _NET_WM_WINDOW_TYPE, + _NET_WM_WINDOW_TYPE_DESKTOP, + _NET_WM_WINDOW_TYPE_DOCK, + _NET_WM_WINDOW_TYPE_TOOLBAR, + _NET_WM_WINDOW_TYPE_MENU, + _NET_WM_WINDOW_TYPE_UTILITY, + _NET_WM_WINDOW_TYPE_SPLASH, + _NET_WM_WINDOW_TYPE_DIALOG, + _NET_WM_WINDOW_TYPE_DROPDOWN_MENU, + _NET_WM_WINDOW_TYPE_POPUP_MENU, + _NET_WM_WINDOW_TYPE_TOOLTIP, + _NET_WM_WINDOW_TYPE_NOTIFICATION, + _NET_WM_WINDOW_TYPE_COMBO, + _NET_WM_WINDOW_TYPE_DND, + _NET_WM_WINDOW_TYPE_NORMAL, + _KDE_NET_WM_WINDOW_TYPE_OVERRIDE, + + _KDE_NET_WM_FRAME_STRUT, + + _NET_STARTUP_INFO, + _NET_STARTUP_INFO_BEGIN, + + _NET_SUPPORTING_WM_CHECK, + + _NET_WM_CM_S0, + + _NET_SYSTEM_TRAY_VISUAL, + + _NET_ACTIVE_WINDOW, + + // Property formats + COMPOUND_TEXT, + TEXT, + UTF8_STRING, + + // Xdnd + XdndEnter, + XdndPosition, + XdndStatus, + XdndLeave, + XdndDrop, + XdndFinished, + XdndTypelist, + XdndActionList, + + XdndSelection, + + XdndAware, + XdndProxy, + + XdndActionCopy, + XdndActionLink, + XdndActionMove, + XdndActionPrivate, + + // Motif DND + _MOTIF_DRAG_AND_DROP_MESSAGE, + _MOTIF_DRAG_INITIATOR_INFO, + _MOTIF_DRAG_RECEIVER_INFO, + _MOTIF_DRAG_WINDOW, + _MOTIF_DRAG_TARGETS, + + XmTRANSFER_SUCCESS, + XmTRANSFER_FAILURE, + + // Xkb + _XKB_RULES_NAMES, + + // XEMBED + _XEMBED, + _XEMBED_INFO, + + XWacomStylus, + XWacomCursor, + XWacomEraser, + + XTabletStylus, + XTabletEraser, + + NPredefinedAtoms, + + _QT_SETTINGS_TIMESTAMP = NPredefinedAtoms, + NAtoms + }; + + static Atom atom(X11Atom atom); + static bool isSupportedByWM(Atom atom); + + static bool useXFixes(); + static int xFixesEventBase(); + + #ifndef QT_NO_XFIXES + static PtrXFixesSelectSelectionInput xFixesSelectSelectionInput(); + #endif //QT_NO_XFIXES + + static QImage qimageFromXImage(XImage *xi); + + +}; + +#endif // QTESTLITESTATICINFO_H diff --git a/src/plugins/platforms/xlib/qxlibwindow.cpp b/src/plugins/platforms/xlib/qxlibwindow.cpp new file mode 100644 index 0000000..0f11a81 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibwindow.cpp @@ -0,0 +1,735 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitewindow.h" + +#include "qtestliteintegration.h" +#include "qtestlitescreen.h" +#include "qtestlitekeyboard.h" +#include "qtestlitestaticinfo.h" + +#include <QtGui/QWindowSystemInterface> +#include <QSocketNotifier> +#include <QApplication> +#include <QDebug> + +#include <QtGui/private/qwindowsurface_p.h> +#include <QtGui/private/qapplication_p.h> + +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) +#include "qglxintegration.h" +#else +#include "../eglconvenience/qeglconvenience.h" +#include "../eglconvenience/qeglplatformcontext.h" +#include "qtestliteeglintegration.h" +#endif //QT_OPENGL_ES_2 +#endif //QT_NO_OPENGL + +//#define MYX11_DEBUG + +QT_BEGIN_NAMESPACE + +QXlibWindow::QXlibWindow(QWidget *window) + : QPlatformWindow(window) + , mGLContext(0) + , mScreen(QXlibScreen::testLiteScreenForWidget(window)) +{ + int x = window->x(); + int y = window->y(); + int w = window->width(); + int h = window->height(); + + if(window->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL + && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) + XVisualInfo *visualInfo = QGLXContext::findVisualInfo(mScreen,window->platformWindowFormat()); +#else + QPlatformWindowFormat windowFormat = correctColorBuffers(window->platformWindowFormat()); + + EGLDisplay eglDisplay = eglGetDisplay(mScreen->display()); + EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,windowFormat); + VisualID id = QXlibEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); + + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + visualInfoTemplate.visualid = id; + + XVisualInfo *visualInfo; + int matchingCount = 0; + visualInfo = XGetVisualInfo(mScreen->display(), VisualIDMask, &visualInfoTemplate, &matchingCount); +#endif //!defined(QT_OPENGL_ES_2) + if (visualInfo) { + Colormap cmap = XCreateColormap(mScreen->display(),mScreen->rootWindow(),visualInfo->visual,AllocNone); + + XSetWindowAttributes a; + a.colormap = cmap; + x_window = XCreateWindow(mScreen->display(), mScreen->rootWindow(),x, y, w, h, + 0, visualInfo->depth, InputOutput, visualInfo->visual, + CWColormap, &a); + } else { + qFatal("no window!"); + } +#endif //!defined(QT_NO_OPENGL) + } else { + x_window = XCreateSimpleWindow(mScreen->display(), mScreen->rootWindow(), + x, y, w, h, 0 /*border_width*/, + mScreen->blackPixel(), mScreen->whitePixel()); + } + +#ifdef MYX11_DEBUG + qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; +#endif + + XSetWindowBackgroundPixmap(mScreen->display(), x_window, XNone); + + XSelectInput(mScreen->display(), x_window, + ExposureMask | KeyPressMask | KeyReleaseMask | + EnterWindowMask | LeaveWindowMask | FocusChangeMask | + PointerMotionMask | ButtonPressMask | ButtonReleaseMask | + ButtonMotionMask | PropertyChangeMask | + StructureNotifyMask); + + gc = createGC(); + + Atom protocols[5]; + int n = 0; + protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_DELETE_WINDOW); // support del window protocol + protocols[n++] = QXlibStatic::atom(QXlibStatic::WM_TAKE_FOCUS); // support take focus window protocol + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_PING); // support _NET_WM_PING protocol +#ifndef QT_NO_XSYNC + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_SYNC_REQUEST); // support _NET_WM_SYNC_REQUEST protocol +#endif // QT_NO_XSYNC + if (window->windowFlags() & Qt::WindowContextHelpButtonHint) + protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_CONTEXT_HELP); + XSetWMProtocols(mScreen->display(), x_window, protocols, n); +} + + + +QXlibWindow::~QXlibWindow() +{ +#ifdef MYX11_DEBUG + qDebug() << "~QTestLiteWindow" << hex << x_window; +#endif + delete mGLContext; + XFreeGC(mScreen->display(), gc); + XDestroyWindow(mScreen->display(), x_window); +} + +//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// Mouse event stuff +static Qt::MouseButtons translateMouseButtons(int s) +{ + Qt::MouseButtons ret = 0; + if (s & Button1Mask) + ret |= Qt::LeftButton; + if (s & Button2Mask) + ret |= Qt::MidButton; + if (s & Button3Mask) + ret |= Qt::RightButton; + return ret; +} + + + +void QXlibWindow::handleMouseEvent(QEvent::Type type, XButtonEvent *e) +{ + static QPoint mousePoint; + + Qt::MouseButton button = Qt::NoButton; + Qt::MouseButtons buttons = translateMouseButtons(e->state); + Qt::KeyboardModifiers modifiers = mScreen->keyboard()->translateModifiers(e->state); + if (type != QEvent::MouseMove) { + switch (e->button) { + case Button1: button = Qt::LeftButton; break; + case Button2: button = Qt::MidButton; break; + case Button3: button = Qt::RightButton; break; + case Button4: + case Button5: + case 6: + case 7: { + //mouse wheel + if (type == QEvent::MouseButtonPress) { + //logic borrowed from qapplication_x11.cpp + int delta = 120 * ((e->button == Button4 || e->button == 6) ? 1 : -1); + bool hor = (((e->button == Button4 || e->button == Button5) + && (modifiers & Qt::AltModifier)) + || (e->button == 6 || e->button == 7)); + QWindowSystemInterface::handleWheelEvent(widget(), e->time, + QPoint(e->x, e->y), + QPoint(e->x_root, e->y_root), + delta, hor ? Qt::Horizontal : Qt::Vertical); + } + return; + } + default: break; + } + } + + buttons ^= button; // X event uses state *before*, Qt uses state *after* + + QWindowSystemInterface::handleMouseEvent(widget(), e->time, QPoint(e->x, e->y), + QPoint(e->x_root, e->y_root), + buttons); + + mousePoint = QPoint(e->x_root, e->y_root); +} + +void QXlibWindow::handleCloseEvent() +{ + QWindowSystemInterface::handleCloseEvent(widget()); +} + + +void QXlibWindow::handleEnterEvent() +{ + QWindowSystemInterface::handleEnterEvent(widget()); +} + +void QXlibWindow::handleLeaveEvent() +{ + QWindowSystemInterface::handleLeaveEvent(widget()); +} + +void QXlibWindow::handleFocusInEvent() +{ + QWindowSystemInterface::handleWindowActivated(widget()); +} + +void QXlibWindow::handleFocusOutEvent() +{ + QWindowSystemInterface::handleWindowActivated(0); +} + + + +void QXlibWindow::setGeometry(const QRect &rect) +{ + XMoveResizeWindow(mScreen->display(), x_window, rect.x(), rect.y(), rect.width(), rect.height()); + QPlatformWindow::setGeometry(rect); +} + + +Qt::WindowFlags QXlibWindow::windowFlags() const +{ + return mWindowFlags; +} + +WId QXlibWindow::winId() const +{ + return x_window; +} + +void QXlibWindow::setParent(const QPlatformWindow *window) +{ + QPoint topLeft = geometry().topLeft(); + XReparentWindow(mScreen->display(),x_window,window->winId(),topLeft.x(),topLeft.y()); +} + +void QXlibWindow::raise() +{ + XRaiseWindow(mScreen->display(), x_window); +} + +void QXlibWindow::lower() +{ + XLowerWindow(mScreen->display(), x_window); +} + +void QXlibWindow::setWindowTitle(const QString &title) +{ + QByteArray ba = title.toLatin1(); //We're not making a general solution here... + XTextProperty windowName; + windowName.value = (unsigned char *)ba.constData(); + windowName.encoding = XA_STRING; + windowName.format = 8; + windowName.nitems = ba.length(); + + XSetWMName(mScreen->display(), x_window, &windowName); +} + +GC QXlibWindow::createGC() +{ + GC gc; + + gc = XCreateGC(mScreen->display(), x_window, 0, 0); + if (gc < 0) { + qWarning("QTestLiteWindow::createGC() could not create GC"); + } + return gc; +} + +void QXlibWindow::paintEvent() +{ +#ifdef MYX11_DEBUG +// qDebug() << "QTestLiteWindow::paintEvent" << shm_img.size() << painted; +#endif + + if (QWindowSurface *surface = widget()->windowSurface()) + surface->flush(widget(), widget()->geometry(), QPoint()); +} + +void QXlibWindow::requestActivateWindow() +{ + XSetInputFocus(mScreen->display(), x_window, XRevertToParent, CurrentTime); +} + +void QXlibWindow::resizeEvent(XConfigureEvent *e) +{ + int xpos = geometry().x(); + int ypos = geometry().y(); + if ((e->width != geometry().width() || e->height != geometry().height()) && e->x == 0 && e->y == 0) { + //qDebug() << "resize with bogus pos" << e->x << e->y << e->width << e->height << "window"<< hex << window; + } else { + //qDebug() << "geometry change" << e->x << e->y << e->width << e->height << "window"<< hex << window; + xpos = e->x; + ypos = e->y; + } +#ifdef MYX11_DEBUG + qDebug() << hex << x_window << dec << "ConfigureNotify" << e->x << e->y << e->width << e->height << "geometry" << xpos << ypos << width << height; +#endif + + QRect newRect(xpos, ypos, e->width, e->height); + QWindowSystemInterface::handleGeometryChange(widget(), newRect); +} + +void QXlibWindow::mousePressEvent(XButtonEvent *e) +{ + static long prevTime = 0; + static Window prevWindow; + static int prevX = -999; + static int prevY = -999; + + QEvent::Type type = QEvent::MouseButtonPress; + + if (e->window == prevWindow && long(e->time) - prevTime < QApplication::doubleClickInterval() + && qAbs(e->x - prevX) < 5 && qAbs(e->y - prevY) < 5) { + type = QEvent::MouseButtonDblClick; + prevTime = e->time - QApplication::doubleClickInterval(); //no double click next time + } else { + prevTime = e->time; + } + prevWindow = e->window; + prevX = e->x; + prevY = e->y; + + handleMouseEvent(type, e); +} + +QXlibMWMHints QXlibWindow::getMWMHints() const +{ + QXlibMWMHints mwmhints; + + Atom type; + int format; + ulong nitems, bytesLeft; + uchar *data = 0; + Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); + if ((XGetWindowProperty(mScreen->display(), x_window, atomForMotifWmHints, 0, 5, false, + atomForMotifWmHints, &type, &format, &nitems, &bytesLeft, + &data) == Success) + && (type == atomForMotifWmHints + && format == 32 + && nitems >= 5)) { + mwmhints = *(reinterpret_cast<QXlibMWMHints *>(data)); + } else { + mwmhints.flags = 0L; + mwmhints.functions = MWM_FUNC_ALL; + mwmhints.decorations = MWM_DECOR_ALL; + mwmhints.input_mode = 0L; + mwmhints.status = 0L; + } + + if (data) + XFree(data); + + return mwmhints; +} + +void QXlibWindow::setMWMHints(const QXlibMWMHints &mwmhints) +{ + Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); + if (mwmhints.flags != 0l) { + XChangeProperty(mScreen->display(), x_window, + atomForMotifWmHints, atomForMotifWmHints, 32, + PropModeReplace, (unsigned char *) &mwmhints, 5); + } else { + XDeleteProperty(mScreen->display(), x_window, atomForMotifWmHints); + } +} + +// Returns true if we should set WM_TRANSIENT_FOR on \a w +static inline bool isTransient(const QWidget *w) +{ + return ((w->windowType() == Qt::Dialog + || w->windowType() == Qt::Sheet + || w->windowType() == Qt::Tool + || w->windowType() == Qt::SplashScreen + || w->windowType() == Qt::ToolTip + || w->windowType() == Qt::Drawer + || w->windowType() == Qt::Popup) + && !w->testAttribute(Qt::WA_X11BypassTransientForHint)); +} + +QVector<Atom> QXlibWindow::getNetWmState() const +{ + QVector<Atom> returnValue; + + // Don't read anything, just get the size of the property data + Atom actualType; + int actualFormat; + ulong propertyLength; + ulong bytesLeft; + uchar *propertyData = 0; + if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, 0, + False, XA_ATOM, &actualType, &actualFormat, + &propertyLength, &bytesLeft, &propertyData) == Success + && actualType == XA_ATOM && actualFormat == 32) { + returnValue.resize(bytesLeft / 4); + XFree((char*) propertyData); + + // fetch all data + if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, + returnValue.size(), False, XA_ATOM, &actualType, &actualFormat, + &propertyLength, &bytesLeft, &propertyData) != Success) { + returnValue.clear(); + } else if (propertyLength != (ulong)returnValue.size()) { + returnValue.resize(propertyLength); + } + + // put it into netWmState + if (!returnValue.isEmpty()) { + memcpy(returnValue.data(), propertyData, returnValue.size() * sizeof(Atom)); + } + XFree((char*) propertyData); + } + + return returnValue; +} + +Qt::WindowFlags QXlibWindow::setWindowFlags(Qt::WindowFlags flags) +{ +// Q_ASSERT(flags & Qt::Window); + mWindowFlags = flags; + +#ifdef MYX11_DEBUG + qDebug() << "QTestLiteWindow::setWindowFlags" << hex << x_window << "flags" << flags; +#endif + Qt::WindowType type = static_cast<Qt::WindowType>(int(flags & Qt::WindowType_Mask)); + + if (type == Qt::ToolTip) + flags |= Qt::WindowStaysOnTopHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint; + if (type == Qt::Popup) + flags |= Qt::X11BypassWindowManagerHint; + + bool topLevel = (flags & Qt::Window); + bool popup = (type == Qt::Popup); + bool dialog = (type == Qt::Dialog + || type == Qt::Sheet); + bool desktop = (type == Qt::Desktop); + bool tool = (type == Qt::Tool || type == Qt::SplashScreen + || type == Qt::ToolTip || type == Qt::Drawer); + + Q_UNUSED(topLevel); + Q_UNUSED(dialog); + Q_UNUSED(desktop); + + bool tooltip = (type == Qt::ToolTip); + + XSetWindowAttributes wsa; + + QXlibMWMHints mwmhints; + mwmhints.flags = 0L; + mwmhints.functions = 0L; + mwmhints.decorations = 0; + mwmhints.input_mode = 0L; + mwmhints.status = 0L; + + + ulong wsa_mask = 0; + if (type != Qt::SplashScreen) { // && customize) { + mwmhints.flags |= MWM_HINTS_DECORATIONS; + + bool customize = flags & Qt::CustomizeWindowHint; + if (!(flags & Qt::FramelessWindowHint) && !(customize && !(flags & Qt::WindowTitleHint))) { + mwmhints.decorations |= MWM_DECOR_BORDER; + mwmhints.decorations |= MWM_DECOR_RESIZEH; + + if (flags & Qt::WindowTitleHint) + mwmhints.decorations |= MWM_DECOR_TITLE; + + if (flags & Qt::WindowSystemMenuHint) + mwmhints.decorations |= MWM_DECOR_MENU; + + if (flags & Qt::WindowMinimizeButtonHint) { + mwmhints.decorations |= MWM_DECOR_MINIMIZE; + mwmhints.functions |= MWM_FUNC_MINIMIZE; + } + + if (flags & Qt::WindowMaximizeButtonHint) { + mwmhints.decorations |= MWM_DECOR_MAXIMIZE; + mwmhints.functions |= MWM_FUNC_MAXIMIZE; + } + + if (flags & Qt::WindowCloseButtonHint) + mwmhints.functions |= MWM_FUNC_CLOSE; + } + } else { + // if type == Qt::SplashScreen + mwmhints.decorations = MWM_DECOR_ALL; + } + + if (tool) { + wsa.save_under = True; + wsa_mask |= CWSaveUnder; + } + + if (flags & Qt::X11BypassWindowManagerHint) { + wsa.override_redirect = True; + wsa_mask |= CWOverrideRedirect; + } +#if 0 + if (wsa_mask && initializeWindow) { + Q_ASSERT(id); + XChangeWindowAttributes(dpy, id, wsa_mask, &wsa); + } +#endif + if (mwmhints.functions != 0) { + mwmhints.flags |= MWM_HINTS_FUNCTIONS; + mwmhints.functions |= MWM_FUNC_MOVE | MWM_FUNC_RESIZE; + } else { + mwmhints.functions = MWM_FUNC_ALL; + } + + if (!(flags & Qt::FramelessWindowHint) + && flags & Qt::CustomizeWindowHint + && flags & Qt::WindowTitleHint + && !(flags & + (Qt::WindowMinimizeButtonHint + | Qt::WindowMaximizeButtonHint + | Qt::WindowCloseButtonHint))) { + // a special case - only the titlebar without any button + mwmhints.flags = MWM_HINTS_FUNCTIONS; + mwmhints.functions = MWM_FUNC_MOVE | MWM_FUNC_RESIZE; + mwmhints.decorations = 0; + } + + if (widget()->windowModality() == Qt::WindowModal) { + mwmhints.input_mode = MWM_INPUT_PRIMARY_APPLICATION_MODAL; + } else if (widget()->windowModality() == Qt::ApplicationModal) { + mwmhints.input_mode = MWM_INPUT_FULL_APPLICATION_MODAL; + } + + setMWMHints(mwmhints); + + QVector<Atom> netWmState = getNetWmState(); + + if (flags & Qt::WindowStaysOnTopHint) { + if (flags & Qt::WindowStaysOnBottomHint) + qWarning() << "QWidget: Incompatible window flags: the window can't be on top and on bottom at the same time"; + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_ABOVE)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_STAYS_ON_TOP)); + } else if (flags & Qt::WindowStaysOnBottomHint) { + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_BELOW)); + } + if (widget()->isFullScreen()) { + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_FULLSCREEN)); + } + if (widget()->isMaximized()) { + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_HORZ)); + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MAXIMIZED_VERT)); + } + if (widget()->windowModality() != Qt::NonModal) { + if (!netWmState.contains(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL))) + netWmState.append(QXlibStatic::atom(QXlibStatic::_NET_WM_STATE_MODAL)); + } + + if (!netWmState.isEmpty()) { + XChangeProperty(mScreen->display(), x_window, + QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), XA_ATOM, 32, PropModeReplace, + (unsigned char *) netWmState.data(), netWmState.size()); + } else { + XDeleteProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE)); + } + +//##### only if initializeWindow??? + + if (popup || tooltip) { // popup widget +#ifdef MYX11_DEBUG + qDebug() << "Doing XChangeWindowAttributes for popup" << wsa.override_redirect; +#endif + // set EWMH window types + // setNetWmWindowTypes(); + + wsa.override_redirect = True; + wsa.save_under = True; + XChangeWindowAttributes(mScreen->display(), x_window, CWOverrideRedirect | CWSaveUnder, + &wsa); + } else { +#ifdef MYX11_DEBUG + qDebug() << "Doing XChangeWindowAttributes for non-popup"; +#endif + } + + return flags; +} + +void QXlibWindow::setVisible(bool visible) +{ +#ifdef MYX11_DEBUG + qDebug() << "QTestLiteWindow::setVisible" << visible << hex << x_window; +#endif + if (isTransient(widget())) { + Window parentXWindow = x_window; + if (widget()->parentWidget()) { + QWidget *widgetParent = widget()->parentWidget()->window(); + if (widgetParent && widgetParent->platformWindow()) { + QXlibWindow *parentWidnow = static_cast<QXlibWindow *>(widgetParent->platformWindow()); + parentXWindow = parentWidnow->x_window; + } + } + XSetTransientForHint(mScreen->display(),x_window,parentXWindow); + } + + if (visible) { + //ensure that the window is viewed in correct position. + doSizeHints(); + XMapWindow(mScreen->display(), x_window); + } else { + XUnmapWindow(mScreen->display(), x_window); + } +} + +void QXlibWindow::setCursor(const Cursor &cursor) +{ + XDefineCursor(mScreen->display(), x_window, cursor); + XFlush(mScreen->display()); +} + +QPlatformGLContext *QXlibWindow::glContext() const +{ + if (!QApplicationPrivate::platformIntegration()->hasOpenGL()) + return 0; + if (!mGLContext) { + QXlibWindow *that = const_cast<QXlibWindow *>(this); +#if !defined(QT_NO_OPENGL) +#if !defined(QT_OPENGL_ES_2) + that->mGLContext = new QGLXContext(x_window, mScreen,widget()->platformWindowFormat()); +#else + EGLDisplay display = eglGetDisplay(mScreen->display()); + + QPlatformWindowFormat windowFormat = correctColorBuffers(widget()->platformWindowFormat()); + + EGLConfig config = q_configFromQPlatformWindowFormat(display,windowFormat); + QVector<EGLint> eglContextAttrs; + eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); + eglContextAttrs.append(2); + eglContextAttrs.append(EGL_NONE); + + EGLSurface eglSurface = eglCreateWindowSurface(display,config,(EGLNativeWindowType)x_window,0); + that->mGLContext = new QEGLPlatformContext(display, config, eglContextAttrs.data(), eglSurface, EGL_OPENGL_ES_API); +#endif +#endif + } + return mGLContext; +} + +Window QXlibWindow::xWindow() const +{ + return x_window; +} + +GC QXlibWindow::graphicsContext() const +{ + return gc; +} + +void QXlibWindow::doSizeHints() +{ + Q_ASSERT(widget()->testAttribute(Qt::WA_WState_Created)); + XSizeHints s; + s.flags = 0; + QRect g = geometry(); + s.x = g.x(); + s.y = g.y(); + s.width = g.width(); + s.height = g.height(); + s.flags |= USPosition; + s.flags |= PPosition; + s.flags |= USSize; + s.flags |= PSize; + s.flags |= PWinGravity; + s.win_gravity = QApplication::isRightToLeft() ? NorthEastGravity : NorthWestGravity; + XSetWMNormalHints(mScreen->display(), x_window, &s); +} + +QPlatformWindowFormat QXlibWindow::correctColorBuffers(const QPlatformWindowFormat &platformWindowFormat) const +{ + // I have only tested this setup on a dodgy intel setup, where I didn't use standard libs, + // so this might be not what we want to do :) + if ( !(platformWindowFormat.redBufferSize() == -1 && + platformWindowFormat.greenBufferSize() == -1 && + platformWindowFormat.blueBufferSize() == -1)) + return platformWindowFormat; + + QPlatformWindowFormat windowFormat = platformWindowFormat; + if (mScreen->depth() == 16) { + windowFormat.setRedBufferSize(5); + windowFormat.setGreenBufferSize(6); + windowFormat.setBlueBufferSize(5); + } else { + windowFormat.setRedBufferSize(8); + windowFormat.setGreenBufferSize(8); + windowFormat.setBlueBufferSize(8); + } + + return windowFormat; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibwindow.h b/src/plugins/platforms/xlib/qxlibwindow.h new file mode 100644 index 0000000..ccf6867 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibwindow.h @@ -0,0 +1,145 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITEWINDOW_H +#define QTESTLITEWINDOW_H + +#include "qtestliteintegration.h" + +#include <QPlatformWindow> +#include <QEvent> + +#include <QObject> +#include <QImage> + +struct QXlibMWMHints { + ulong flags, functions, decorations; + long input_mode; + ulong status; +}; + +enum { + MWM_HINTS_FUNCTIONS = (1L << 0), + + MWM_FUNC_ALL = (1L << 0), + MWM_FUNC_RESIZE = (1L << 1), + MWM_FUNC_MOVE = (1L << 2), + MWM_FUNC_MINIMIZE = (1L << 3), + MWM_FUNC_MAXIMIZE = (1L << 4), + MWM_FUNC_CLOSE = (1L << 5), + + MWM_HINTS_DECORATIONS = (1L << 1), + + MWM_DECOR_ALL = (1L << 0), + MWM_DECOR_BORDER = (1L << 1), + MWM_DECOR_RESIZEH = (1L << 2), + MWM_DECOR_TITLE = (1L << 3), + MWM_DECOR_MENU = (1L << 4), + MWM_DECOR_MINIMIZE = (1L << 5), + MWM_DECOR_MAXIMIZE = (1L << 6), + + MWM_HINTS_INPUT_MODE = (1L << 2), + + MWM_INPUT_MODELESS = 0L, + MWM_INPUT_PRIMARY_APPLICATION_MODAL = 1L, + MWM_INPUT_FULL_APPLICATION_MODAL = 3L +}; + +class QXlibWindow : public QPlatformWindow +{ +public: + QXlibWindow(QWidget *window); + ~QXlibWindow(); + + + void mousePressEvent(XButtonEvent*); + void handleMouseEvent(QEvent::Type, XButtonEvent *ev); + + void handleCloseEvent(); + void handleEnterEvent(); + void handleLeaveEvent(); + void handleFocusInEvent(); + void handleFocusOutEvent(); + + void resizeEvent(XConfigureEvent *configure_event); + void paintEvent(); + + void requestActivateWindow(); + + void setGeometry(const QRect &rect); + + Qt::WindowFlags setWindowFlags(Qt::WindowFlags type); + Qt::WindowFlags windowFlags() const; + void setVisible(bool visible); + WId winId() const; + void setParent(const QPlatformWindow *window); + void raise(); + void lower(); + void setWindowTitle(const QString &title); + + void setCursor(const Cursor &cursor); + + QPlatformGLContext *glContext() const; + + Window xWindow() const; + GC graphicsContext() const; + +protected: + QVector<Atom> getNetWmState() const; + void setMWMHints(const QXlibMWMHints &mwmhints); + QXlibMWMHints getMWMHints() const; + + void doSizeHints(); + +private: + QPlatformWindowFormat correctColorBuffers(const QPlatformWindowFormat &windowFormat)const; + + Window x_window; + GC gc; + + GC createGC(); + + QPlatformGLContext *mGLContext; + QXlibScreen *mScreen; + Qt::WindowFlags mWindowFlags; +}; + +#endif diff --git a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp new file mode 100644 index 0000000..088730d --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp @@ -0,0 +1,224 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qtestlitewindowsurface.h" +#include "qtestliteintegration.h" + +#include <QtCore/qdebug.h> +#include <QWindowSystemInterface> + +#include "qtestlitewindow.h" +#include "qtestlitescreen.h" + +# include <sys/ipc.h> +# include <sys/shm.h> +# include <X11/extensions/XShm.h> + +QT_BEGIN_NAMESPACE + + +struct QXlibShmImageInfo { + QXlibShmImageInfo(Display *xdisplay) : image(0), display(xdisplay) {} + ~QXlibShmImageInfo() { destroy(); } + + void destroy(); + + XShmSegmentInfo shminfo; + XImage *image; + Display *display; +}; + + +#ifndef DONT_USE_MIT_SHM +void QXlibShmImageInfo::destroy() +{ + XShmDetach (display, &shminfo); + XDestroyImage (image); + shmdt (shminfo.shmaddr); + shmctl (shminfo.shmid, IPC_RMID, 0); +} +#endif + +void QXlibWindowSurface::resizeShmImage(int width, int height) +{ + +#ifdef DONT_USE_MIT_SHM + shm_img = QImage(width, height, QImage::Format_RGB32); +#else + + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(window()); + if (image_info) + image_info->destroy(); + else + image_info = new QXlibShmImageInfo(screen->display()); + + Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); + + + XImage *image = XShmCreateImage (screen->display(), visual, 24, ZPixmap, 0, + &image_info->shminfo, width, height); + + + image_info->shminfo.shmid = shmget (IPC_PRIVATE, + image->bytes_per_line * image->height, IPC_CREAT|0777); + + image_info->shminfo.shmaddr = image->data = (char*)shmat (image_info->shminfo.shmid, 0, 0); + image_info->shminfo.readOnly = False; + + image_info->image = image; + + Status shm_attach_status = XShmAttach(screen->display(), &image_info->shminfo); + + Q_ASSERT(shm_attach_status == True); + + shm_img = QImage( (uchar*) image->data, image->width, image->height, image->bytes_per_line, QImage::Format_RGB32 ); +#endif + painted = false; +} + + +void QXlibWindowSurface::resizeBuffer(QSize s) +{ + if (shm_img.size() != s) + resizeShmImage(s.width(), s.height()); +} + +QSize QXlibWindowSurface::bufferSize() const +{ + return shm_img.size(); +} + +QXlibWindowSurface::QXlibWindowSurface (QWidget *window) + : QWindowSurface(window), + painted(false), image_info(0) +{ + xw = static_cast<QXlibWindow*>(window->platformWindow()); +// qDebug() << "QTestLiteWindowSurface::QTestLiteWindowSurface:" << xw->window; +} + +QXlibWindowSurface::~QXlibWindowSurface() +{ + delete image_info; +} + +QPaintDevice *QXlibWindowSurface::paintDevice() +{ + return &shm_img; +} + + +void QXlibWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(region); + Q_UNUSED(offset); + + if (!painted) + return; + + QXlibScreen *screen = QXlibScreen::testLiteScreenForWidget(widget); + GC gc = xw->graphicsContext(); + Window window = xw->xWindow(); +#ifdef DONT_USE_MIT_SHM + // just convert the image every time... + if (!shm_img.isNull()) { + Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); + + QImage image = shm_img; + //img.convertToFormat( + XImage *xi = XCreateImage(screen->display(), visual, 24, ZPixmap, + 0, (char *) image.scanLine(0), image.width(), image.height(), + 32, image.bytesPerLine()); + + int x = 0; + int y = 0; + + /*int r =*/ XPutImage(screen->display(), window, gc, xi, 0, 0, x, y, image.width(), image.height()); + + xi->data = 0; // QImage owns these bits + XDestroyImage(xi); + } +#else + // Use MIT_SHM + if (image_info && image_info->image) { + //qDebug() << "Here we go" << image_info->image->width << image_info->image->height; + int x = 0; + int y = 0; + + // We could set send_event to true, and then use the ShmCompletion to synchronize, + // but let's do like Qt/11 and just use XSync + XShmPutImage (screen->display(), window, gc, image_info->image, 0, 0, + x, y, image_info->image->width, image_info->image->height, + /*send_event*/ False); + + XSync(screen->display(), False); + } +#endif +} + +// from qwindowsurface.cpp +extern void qt_scrollRectInImage(QImage &img, const QRect &rect, const QPoint &offset); + +bool QXlibWindowSurface::scroll(const QRegion &area, int dx, int dy) +{ + if (shm_img.isNull()) + return false; + + const QVector<QRect> rects = area.rects(); + for (int i = 0; i < rects.size(); ++i) + qt_scrollRectInImage(shm_img, rects.at(i), QPoint(dx, dy)); + + return true; +} + + +void QXlibWindowSurface::beginPaint(const QRegion ®ion) +{ + Q_UNUSED(region); + resizeBuffer(size()); +} + +void QXlibWindowSurface::endPaint(const QRegion ®ion) +{ + Q_UNUSED(region); + painted = true; //there is content in the buffer +} +QT_END_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibwindowsurface.h b/src/plugins/platforms/xlib/qxlibwindowsurface.h new file mode 100644 index 0000000..12b4c60 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibwindowsurface.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QWINDOWSURFACE_TESTLITE_H +#define QWINDOWSURFACE_TESTLITE_H + +#include <QtGui/private/qwindowsurface_p.h> + + +QT_BEGIN_NAMESPACE + +class QXlibWindow; +class QXlibIntegration; +class QXlibScreen; +class QXlibShmImageInfo; + +class QXlibWindowSurface : public QWindowSurface +{ +public: + QXlibWindowSurface (QWidget *window); + ~QXlibWindowSurface(); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + bool scroll(const QRegion &area, int dx, int dy); + + void beginPaint(const QRegion ®ion); + void endPaint(const QRegion ®ion); + +private: + bool painted; + void resizeBuffer(QSize); + QSize bufferSize() const; + + + void resizeShmImage(int width, int height); + + QImage shm_img; + QXlibShmImageInfo *image_info; + + QXlibWindow *xw; + +}; + + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/xlib/testlite.pro b/src/plugins/platforms/xlib/testlite.pro deleted file mode 100644 index 7fb3304..0000000 --- a/src/plugins/platforms/xlib/testlite.pro +++ /dev/null @@ -1,57 +0,0 @@ -TARGET = qtestlite - -include(../../qpluginbase.pri) -QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms - -SOURCES = \ - main.cpp \ - qtestliteintegration.cpp \ - qtestlitewindowsurface.cpp \ - qtestlitewindow.cpp \ - qtestlitecursor.cpp \ - qtestlitescreen.cpp \ - qtestlitekeyboard.cpp \ - qtestliteclipboard.cpp \ - qtestlitemime.cpp \ - qtestlitestaticinfo.cpp - -HEADERS = \ - qtestliteintegration.h \ - qtestlitewindowsurface.h \ - qtestlitewindow.h \ - qtestlitecursor.h \ - qtestlitescreen.h \ - qtestlitekeyboard.h \ - qtestliteclipboard.h \ - qtestlitemime.h \ - qtestlitestaticinfo.h - -LIBS += -lX11 -lXext - -mac { - LIBS += -L/usr/X11/lib -lz -framework Carbon -} - -include (../fontdatabases/genericunix/genericunix.pri) - -contains(QT_CONFIG, opengl) { - QT += opengl - !contains(QT_CONFIG, opengles2) { - HEADERS += qglxintegration.h - SOURCES += qglxintegration.cpp - } else { # There is no easy way to detect if we'r suppose to use glx or not - HEADERS += \ - ../eglconvenience/qeglplatformcontext.h \ - ../eglconvenience/qeglconvenience.h \ - qtestliteeglintegration.h - - SOURCES += \ - ../eglconvenience/qeglplatformcontext.cpp \ - ../eglconvenience/qeglconvenience.cpp \ - qtestliteeglintegration.cpp - LIBS += -lEGL - } -} - -target.path += $$[QT_INSTALL_PLUGINS]/platforms -INSTALLS += target diff --git a/src/plugins/platforms/xlib/xlib.pro b/src/plugins/platforms/xlib/xlib.pro new file mode 100644 index 0000000..7fb3304 --- /dev/null +++ b/src/plugins/platforms/xlib/xlib.pro @@ -0,0 +1,57 @@ +TARGET = qtestlite + +include(../../qpluginbase.pri) +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms + +SOURCES = \ + main.cpp \ + qtestliteintegration.cpp \ + qtestlitewindowsurface.cpp \ + qtestlitewindow.cpp \ + qtestlitecursor.cpp \ + qtestlitescreen.cpp \ + qtestlitekeyboard.cpp \ + qtestliteclipboard.cpp \ + qtestlitemime.cpp \ + qtestlitestaticinfo.cpp + +HEADERS = \ + qtestliteintegration.h \ + qtestlitewindowsurface.h \ + qtestlitewindow.h \ + qtestlitecursor.h \ + qtestlitescreen.h \ + qtestlitekeyboard.h \ + qtestliteclipboard.h \ + qtestlitemime.h \ + qtestlitestaticinfo.h + +LIBS += -lX11 -lXext + +mac { + LIBS += -L/usr/X11/lib -lz -framework Carbon +} + +include (../fontdatabases/genericunix/genericunix.pri) + +contains(QT_CONFIG, opengl) { + QT += opengl + !contains(QT_CONFIG, opengles2) { + HEADERS += qglxintegration.h + SOURCES += qglxintegration.cpp + } else { # There is no easy way to detect if we'r suppose to use glx or not + HEADERS += \ + ../eglconvenience/qeglplatformcontext.h \ + ../eglconvenience/qeglconvenience.h \ + qtestliteeglintegration.h + + SOURCES += \ + ../eglconvenience/qeglplatformcontext.cpp \ + ../eglconvenience/qeglconvenience.cpp \ + qtestliteeglintegration.cpp + LIBS += -lEGL + } +} + +target.path += $$[QT_INSTALL_PLUGINS]/platforms +INSTALLS += target -- cgit v0.12 From 5cda0ff17d82197de987b1c09959549995737b9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Mon, 14 Feb 2011 14:00:14 +0100 Subject: Lighthouse: fix qxlib include files after file-rename --- src/plugins/platforms/xlib/main.cpp | 2 +- src/plugins/platforms/xlib/qglxintegration.cpp | 4 +-- src/plugins/platforms/xlib/qglxintegration.h | 2 +- src/plugins/platforms/xlib/qxlibclipboard.cpp | 8 ++--- src/plugins/platforms/xlib/qxlibclipboard.h | 2 +- src/plugins/platforms/xlib/qxlibcursor.cpp | 8 ++--- src/plugins/platforms/xlib/qxlibcursor.h | 2 +- src/plugins/platforms/xlib/qxlibeglintegration.cpp | 2 +- src/plugins/platforms/xlib/qxlibeglintegration.h | 2 +- src/plugins/platforms/xlib/qxlibintegration.cpp | 10 +++--- src/plugins/platforms/xlib/qxlibintegration.h | 2 +- src/plugins/platforms/xlib/qxlibkeyboard.cpp | 4 +-- src/plugins/platforms/xlib/qxlibkeyboard.h | 2 +- src/plugins/platforms/xlib/qxlibmime.cpp | 6 ++-- src/plugins/platforms/xlib/qxlibmime.h | 4 +-- src/plugins/platforms/xlib/qxlibscreen.cpp | 12 +++---- src/plugins/platforms/xlib/qxlibscreen.h | 2 +- src/plugins/platforms/xlib/qxlibstatic.cpp | 4 +-- src/plugins/platforms/xlib/qxlibwindow.cpp | 12 +++---- src/plugins/platforms/xlib/qxlibwindow.h | 2 +- src/plugins/platforms/xlib/qxlibwindowsurface.cpp | 8 ++--- src/plugins/platforms/xlib/xlib.pro | 42 +++++++++++----------- 22 files changed, 71 insertions(+), 71 deletions(-) diff --git a/src/plugins/platforms/xlib/main.cpp b/src/plugins/platforms/xlib/main.cpp index 131d399..3e2a6b9 100644 --- a/src/plugins/platforms/xlib/main.cpp +++ b/src/plugins/platforms/xlib/main.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include <QtGui/QPlatformIntegrationPlugin> -#include "qtestliteintegration.h" +#include "qxlibintegration.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/xlib/qglxintegration.cpp b/src/plugins/platforms/xlib/qglxintegration.cpp index 46dfef9..5ba4f0d 100644 --- a/src/plugins/platforms/xlib/qglxintegration.cpp +++ b/src/plugins/platforms/xlib/qglxintegration.cpp @@ -43,8 +43,8 @@ #include <QLibrary> #include <QGLFormat> -#include "qtestlitewindow.h" -#include "qtestlitescreen.h" +#include "qxlibwindow.h" +#include "qxlibscreen.h" #if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) #include <X11/Xlib.h> diff --git a/src/plugins/platforms/xlib/qglxintegration.h b/src/plugins/platforms/xlib/qglxintegration.h index f982708..81b48c9 100644 --- a/src/plugins/platforms/xlib/qglxintegration.h +++ b/src/plugins/platforms/xlib/qglxintegration.h @@ -42,7 +42,7 @@ #ifndef Q_GLX_CONTEXT_H #define Q_GLX_CONTEXT_H -#include "qtestlitewindow.h" +#include "qxlibwindow.h" #include <QtGui/QPlatformGLContext> #include <QtGui/QPlatformWindowFormat> diff --git a/src/plugins/platforms/xlib/qxlibclipboard.cpp b/src/plugins/platforms/xlib/qxlibclipboard.cpp index 1264b5a..7930fcb 100644 --- a/src/plugins/platforms/xlib/qxlibclipboard.cpp +++ b/src/plugins/platforms/xlib/qxlibclipboard.cpp @@ -39,10 +39,10 @@ ** ****************************************************************************/ -#include "qtestliteclipboard.h" +#include "qxlibclipboard.h" -#include "qtestlitescreen.h" -#include "qtestlitemime.h" +#include "qxlibscreen.h" +#include "qxlibmime.h" #include <private/qapplication_p.h> @@ -673,4 +673,4 @@ QByteArray QXlibClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) return buf; } -#include "qtestliteclipboard.moc" +#include "qxlibclipboard.moc" diff --git a/src/plugins/platforms/xlib/qxlibclipboard.h b/src/plugins/platforms/xlib/qxlibclipboard.h index 109714c..ec1d728 100644 --- a/src/plugins/platforms/xlib/qxlibclipboard.h +++ b/src/plugins/platforms/xlib/qxlibclipboard.h @@ -43,7 +43,7 @@ #define QTESTLITECLIPBOARD_H #include <QPlatformClipboard> -#include "qtestlitestaticinfo.h" +#include "qxlibstatic.h" class QXlibScreen; class QXlibClipboard : public QPlatformClipboard diff --git a/src/plugins/platforms/xlib/qxlibcursor.cpp b/src/plugins/platforms/xlib/qxlibcursor.cpp index 2f7cfbf..e4d248c 100644 --- a/src/plugins/platforms/xlib/qxlibcursor.cpp +++ b/src/plugins/platforms/xlib/qxlibcursor.cpp @@ -39,11 +39,11 @@ ** ****************************************************************************/ -#include "qtestlitecursor.h" +#include "qxlibcursor.h" -#include "qtestliteintegration.h" -#include "qtestlitescreen.h" -#include "qtestlitewindow.h" +#include "qxlibintegration.h" +#include "qxlibscreen.h" +#include "qxlibwindow.h" #include <QtGui/QBitmap> diff --git a/src/plugins/platforms/xlib/qxlibcursor.h b/src/plugins/platforms/xlib/qxlibcursor.h index db9f9e2..77c66bf 100644 --- a/src/plugins/platforms/xlib/qxlibcursor.h +++ b/src/plugins/platforms/xlib/qxlibcursor.h @@ -44,7 +44,7 @@ #include <QtGui/QPlatformCursor> -#include "qtestliteintegration.h" +#include "qxlibintegration.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibeglintegration.cpp b/src/plugins/platforms/xlib/qxlibeglintegration.cpp index 9bbe0ca..1135d2f 100644 --- a/src/plugins/platforms/xlib/qxlibeglintegration.cpp +++ b/src/plugins/platforms/xlib/qxlibeglintegration.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ -#include "qtestliteeglintegration.h" +#include "qxlibeglintegration.h" static int countBits(unsigned long mask) { diff --git a/src/plugins/platforms/xlib/qxlibeglintegration.h b/src/plugins/platforms/xlib/qxlibeglintegration.h index 4c2e50d..6a94b8e 100644 --- a/src/plugins/platforms/xlib/qxlibeglintegration.h +++ b/src/plugins/platforms/xlib/qxlibeglintegration.h @@ -42,7 +42,7 @@ #ifndef QTESTLITEEGLINTEGRATION_H #define QTESTLITEEGLINTEGRATION_H -#include "qtestlitestaticinfo.h" +#include "qxlibstatic.h" #include "../eglconvenience/qeglconvenience.h" class QXlibEglIntegration diff --git a/src/plugins/platforms/xlib/qxlibintegration.cpp b/src/plugins/platforms/xlib/qxlibintegration.cpp index cdc5c29..46eabbf 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.cpp +++ b/src/plugins/platforms/xlib/qxlibintegration.cpp @@ -39,15 +39,15 @@ ** ****************************************************************************/ -#include "qtestliteintegration.h" -#include "qtestlitewindowsurface.h" +#include "qxlibintegration.h" +#include "qxlibwindowsurface.h" #include <QtGui/private/qpixmap_raster_p.h> #include <QtCore/qdebug.h> -#include "qtestlitewindow.h" +#include "qxlibwindow.h" #include "qgenericunixfontdatabase.h" -#include "qtestlitescreen.h" -#include "qtestliteclipboard.h" +#include "qxlibscreen.h" +#include "qxlibclipboard.h" #if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) diff --git a/src/plugins/platforms/xlib/qxlibintegration.h b/src/plugins/platforms/xlib/qxlibintegration.h index c3125b8..dd8cdec 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.h +++ b/src/plugins/platforms/xlib/qxlibintegration.h @@ -48,7 +48,7 @@ #include <QtGui/QPlatformIntegration> #include <QtGui/QPlatformScreen> -#include "qtestlitestaticinfo.h" +#include "qxlibstatic.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibkeyboard.cpp b/src/plugins/platforms/xlib/qxlibkeyboard.cpp index fb0cf2e..65727a4 100644 --- a/src/plugins/platforms/xlib/qxlibkeyboard.cpp +++ b/src/plugins/platforms/xlib/qxlibkeyboard.cpp @@ -39,9 +39,9 @@ ** ****************************************************************************/ -#include "qtestlitekeyboard.h" +#include "qxlibkeyboard.h" -#include "qtestlitescreen.h" +#include "qxlibscreen.h" #include <QtGui/QWindowSystemInterface> diff --git a/src/plugins/platforms/xlib/qxlibkeyboard.h b/src/plugins/platforms/xlib/qxlibkeyboard.h index 98df4e1..02fc290 100644 --- a/src/plugins/platforms/xlib/qxlibkeyboard.h +++ b/src/plugins/platforms/xlib/qxlibkeyboard.h @@ -42,7 +42,7 @@ #ifndef QTESTLITEKEYBOARD_H #define QTESTLITEKEYBOARD_H -#include "qtestliteintegration.h" +#include "qxlibintegration.h" class QXlibKeyboard { diff --git a/src/plugins/platforms/xlib/qxlibmime.cpp b/src/plugins/platforms/xlib/qxlibmime.cpp index 5335ae9..61a0735 100644 --- a/src/plugins/platforms/xlib/qxlibmime.cpp +++ b/src/plugins/platforms/xlib/qxlibmime.cpp @@ -39,10 +39,10 @@ ** ****************************************************************************/ -#include "qtestlitemime.h" +#include "qxlibmime.h" -#include "qtestlitestaticinfo.h" -#include "qtestlitescreen.h" +#include "qxlibstatic.h" +#include "qxlibscreen.h" #include <QtCore/QTextCodec> #include <QtGui/QImageWriter> diff --git a/src/plugins/platforms/xlib/qxlibmime.h b/src/plugins/platforms/xlib/qxlibmime.h index 6a70ea4..316d423 100644 --- a/src/plugins/platforms/xlib/qxlibmime.h +++ b/src/plugins/platforms/xlib/qxlibmime.h @@ -46,8 +46,8 @@ #include <QtGui/QClipboard> -#include "qtestliteintegration.h" -#include "qtestliteclipboard.h" +#include "qxlibintegration.h" +#include "qxlibclipboard.h" class QXlibMime : public QInternalMimeData { Q_OBJECT diff --git a/src/plugins/platforms/xlib/qxlibscreen.cpp b/src/plugins/platforms/xlib/qxlibscreen.cpp index 714c17b..ef04fb2 100644 --- a/src/plugins/platforms/xlib/qxlibscreen.cpp +++ b/src/plugins/platforms/xlib/qxlibscreen.cpp @@ -39,13 +39,13 @@ ** ****************************************************************************/ -#include "qtestlitescreen.h" +#include "qxlibscreen.h" -#include "qtestlitecursor.h" -#include "qtestlitewindow.h" -#include "qtestlitekeyboard.h" -#include "qtestlitestaticinfo.h" -#include "qtestliteclipboard.h" +#include "qxlibcursor.h" +#include "qxlibwindow.h" +#include "qxlibkeyboard.h" +#include "qxlibstatic.h" +#include "qxlibclipboard.h" #include <QtCore/QDebug> #include <QtCore/QSocketNotifier> diff --git a/src/plugins/platforms/xlib/qxlibscreen.h b/src/plugins/platforms/xlib/qxlibscreen.h index 7e59a59..c8043fb 100644 --- a/src/plugins/platforms/xlib/qxlibscreen.h +++ b/src/plugins/platforms/xlib/qxlibscreen.h @@ -43,7 +43,7 @@ #define QTESTLITESCREEN_H #include <QtGui/QPlatformScreen> -#include "qtestliteintegration.h" +#include "qxlibintegration.h" QT_BEGIN_NAMESPACE diff --git a/src/plugins/platforms/xlib/qxlibstatic.cpp b/src/plugins/platforms/xlib/qxlibstatic.cpp index 837636c..3ce5768 100644 --- a/src/plugins/platforms/xlib/qxlibstatic.cpp +++ b/src/plugins/platforms/xlib/qxlibstatic.cpp @@ -39,8 +39,8 @@ ** ****************************************************************************/ -#include "qtestlitestaticinfo.h" -#include "qtestlitescreen.h" +#include "qxlibstatic.h" +#include "qxlibscreen.h" #include <qplatformdefs.h> diff --git a/src/plugins/platforms/xlib/qxlibwindow.cpp b/src/plugins/platforms/xlib/qxlibwindow.cpp index 0f11a81..ddd4002 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.cpp +++ b/src/plugins/platforms/xlib/qxlibwindow.cpp @@ -39,12 +39,12 @@ ** ****************************************************************************/ -#include "qtestlitewindow.h" +#include "qxlibwindow.h" -#include "qtestliteintegration.h" -#include "qtestlitescreen.h" -#include "qtestlitekeyboard.h" -#include "qtestlitestaticinfo.h" +#include "qxlibintegration.h" +#include "qxlibscreen.h" +#include "qxlibkeyboard.h" +#include "qxlibstatic.h" #include <QtGui/QWindowSystemInterface> #include <QSocketNotifier> @@ -60,7 +60,7 @@ #else #include "../eglconvenience/qeglconvenience.h" #include "../eglconvenience/qeglplatformcontext.h" -#include "qtestliteeglintegration.h" +#include "qxlibeglintegration.h" #endif //QT_OPENGL_ES_2 #endif //QT_NO_OPENGL diff --git a/src/plugins/platforms/xlib/qxlibwindow.h b/src/plugins/platforms/xlib/qxlibwindow.h index ccf6867..be98032 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.h +++ b/src/plugins/platforms/xlib/qxlibwindow.h @@ -42,7 +42,7 @@ #ifndef QTESTLITEWINDOW_H #define QTESTLITEWINDOW_H -#include "qtestliteintegration.h" +#include "qxlibintegration.h" #include <QPlatformWindow> #include <QEvent> diff --git a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp index 088730d..92e1793 100644 --- a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp +++ b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp @@ -39,14 +39,14 @@ ** ****************************************************************************/ -#include "qtestlitewindowsurface.h" -#include "qtestliteintegration.h" +#include "qxlibwindowsurface.h" +#include "qxlibintegration.h" #include <QtCore/qdebug.h> #include <QWindowSystemInterface> -#include "qtestlitewindow.h" -#include "qtestlitescreen.h" +#include "qxlibwindow.h" +#include "qxlibscreen.h" # include <sys/ipc.h> # include <sys/shm.h> diff --git a/src/plugins/platforms/xlib/xlib.pro b/src/plugins/platforms/xlib/xlib.pro index 7fb3304..999621b 100644 --- a/src/plugins/platforms/xlib/xlib.pro +++ b/src/plugins/platforms/xlib/xlib.pro @@ -1,30 +1,30 @@ -TARGET = qtestlite +TARGET = qxlib include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms SOURCES = \ main.cpp \ - qtestliteintegration.cpp \ - qtestlitewindowsurface.cpp \ - qtestlitewindow.cpp \ - qtestlitecursor.cpp \ - qtestlitescreen.cpp \ - qtestlitekeyboard.cpp \ - qtestliteclipboard.cpp \ - qtestlitemime.cpp \ - qtestlitestaticinfo.cpp + qxlibintegration.cpp \ + qxlibwindowsurface.cpp \ + qxlibwindow.cpp \ + qxlibcursor.cpp \ + qxlibscreen.cpp \ + qxlibkeyboard.cpp \ + qxlibclipboard.cpp \ + qxlibmime.cpp \ + qxlibstatic.cpp HEADERS = \ - qtestliteintegration.h \ - qtestlitewindowsurface.h \ - qtestlitewindow.h \ - qtestlitecursor.h \ - qtestlitescreen.h \ - qtestlitekeyboard.h \ - qtestliteclipboard.h \ - qtestlitemime.h \ - qtestlitestaticinfo.h + qxlibintegration.h \ + qxlibwindowsurface.h \ + qxlibwindow.h \ + qxlibcursor.h \ + qxlibscreen.h \ + qxlibkeyboard.h \ + qxlibclipboard.h \ + qxlibmime.h \ + qxlibstatic.h LIBS += -lX11 -lXext @@ -43,12 +43,12 @@ contains(QT_CONFIG, opengl) { HEADERS += \ ../eglconvenience/qeglplatformcontext.h \ ../eglconvenience/qeglconvenience.h \ - qtestliteeglintegration.h + qxlibeglintegration.h SOURCES += \ ../eglconvenience/qeglplatformcontext.cpp \ ../eglconvenience/qeglconvenience.cpp \ - qtestliteeglintegration.cpp + qxlibeglintegration.cpp LIBS += -lEGL } } -- cgit v0.12 From 7da16ed9888133039c6d7a261fc7c4b61d9b6114 Mon Sep 17 00:00:00 2001 From: Fabien Freling <fabien.freling@nokia.com> Date: Mon, 14 Feb 2011 15:29:07 +0100 Subject: Remove useless statements. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Samuel Rødal --- src/gui/kernel/qt_cocoa_helpers_mac.mm | 2 -- src/gui/painting/qwindowsurface_raster.cpp | 2 -- 2 files changed, 4 deletions(-) diff --git a/src/gui/kernel/qt_cocoa_helpers_mac.mm b/src/gui/kernel/qt_cocoa_helpers_mac.mm index 71f59e3..f3e1c9a 100644 --- a/src/gui/kernel/qt_cocoa_helpers_mac.mm +++ b/src/gui/kernel/qt_cocoa_helpers_mac.mm @@ -1587,14 +1587,12 @@ void qt_mac_display(QWidget *widget) { NSView *theNSView = qt_mac_nativeview_for(widget); [theNSView display]; - return; } void qt_mac_setNeedsDisplay(QWidget *widget) { NSView *theNSView = qt_mac_nativeview_for(widget); [theNSView setNeedsDisplay:YES]; - return; } void qt_mac_setNeedsDisplayInRect(QWidget *widget, QRegion region) diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index 8e09c58..45111dc 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -256,8 +256,6 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi #ifdef Q_WS_MAC - Q_UNUSED(offset); - // This is mainly done for native components like native "open file" dialog. if (widget->testAttribute(Qt::WA_DontShowOnScreen)) { return; -- cgit v0.12 From 78c5c1cae5f9e100bfb7388f68208406f0db4b42 Mon Sep 17 00:00:00 2001 From: Fabien Freling <fabien.freling@nokia.com> Date: Mon, 14 Feb 2011 16:23:00 +0100 Subject: Optimize the rendering path for the unified toolbar. The over flushing of the toolbar had a huge performance impact so now we only flush the toolbar when necessary and moved the rendering out of the flushing process. Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qcocoaview_mac.mm | 10 +------- src/gui/kernel/qwidget.cpp | 17 ++++++++++++++ src/gui/kernel/qwidget_p.h | 4 +++- src/gui/painting/qunifiedtoolbarsurface_mac.cpp | 31 +++++++++++++++++++------ src/gui/painting/qunifiedtoolbarsurface_mac_p.h | 3 ++- 5 files changed, 47 insertions(+), 18 deletions(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index e50c401..1fe96f8 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -581,20 +581,12 @@ static int qCocoaViewCount = 0; } else { - QUnifiedToolbarSurface *unifiedSurface = dynamic_cast<QUnifiedToolbarSurface *>(qwidgetprivate->unifiedSurface); + QUnifiedToolbarSurface *unifiedSurface = qwidgetprivate->unifiedSurface; if (!unifiedSurface || !qwidgetprivate->flushRequested) { qt_mac_release_graphics_context(context); return; } - // We render the content of the toolbar in the surface. - unifiedSurface->updateToolbarOffset(qwidget); - QRect beginPaintRect(qwidgetprivate->toolbar_offset.x(), qwidgetprivate->toolbar_offset.y(), qwidget->geometry().width(), qwidget->geometry().height()); - QRegion beginPaintRegion(beginPaintRect); - - unifiedSurface->beginPaint(beginPaintRegion); - qwidget->render(unifiedSurface->paintDevice(), qwidgetprivate->toolbar_offset, QRegion(), QWidget::DrawChildren); - int areaX = qwidgetprivate->toolbar_offset.x(); int areaY = qwidgetprivate->toolbar_offset.y(); int areaWidth = qwidget->geometry().width(); diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 04bc2fb..84a839f 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -324,6 +324,7 @@ QWidgetPrivate::QWidgetPrivate(int version) hasOwnContext = false; isInUnifiedToolbar = false; unifiedSurface = 0; + toolbar_ancestor = 0; flushRequested = false; #endif // QT_MAC_USE_COCOA #ifdef QWIDGET_EXTRA_DEBUG @@ -10360,6 +10361,10 @@ void QWidget::repaint(const QRect &rect) return; if (hasBackingStoreSupport()) { + if (qt_widget_private(this)->isInUnifiedToolbar) { + qt_widget_private(this)->unifiedSurface->renderToolbar(this, true); + return; + } QTLWExtra *tlwExtra = window()->d_func()->maybeTopData(); if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) { tlwExtra->inRepaint = true; @@ -10389,6 +10394,10 @@ void QWidget::repaint(const QRegion &rgn) return; if (hasBackingStoreSupport()) { + if (qt_widget_private(this)->isInUnifiedToolbar) { + qt_widget_private(this)->unifiedSurface->renderToolbar(this, true); + return; + } QTLWExtra *tlwExtra = window()->d_func()->maybeTopData(); if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) { tlwExtra->inRepaint = true; @@ -10446,6 +10455,10 @@ void QWidget::update(const QRect &rect) } if (hasBackingStoreSupport()) { + if (qt_widget_private(this)->isInUnifiedToolbar) { + qt_widget_private(this)->unifiedSurface->renderToolbar(this); + return; + } QTLWExtra *tlwExtra = window()->d_func()->maybeTopData(); if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) tlwExtra->backingStore->markDirty(rect, this); @@ -10470,6 +10483,10 @@ void QWidget::update(const QRegion &rgn) } if (hasBackingStoreSupport()) { + if (qt_widget_private(this)->isInUnifiedToolbar) { + qt_widget_private(this)->unifiedSurface->renderToolbar(this); + return; + } QTLWExtra *tlwExtra = window()->d_func()->maybeTopData(); if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) tlwExtra->backingStore->markDirty(rgn, this); diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 921cf03..59cb737 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -79,6 +79,7 @@ #ifdef Q_WS_MAC #include <private/qt_mac_p.h> +#include <private/qunifiedtoolbarsurface_mac_p.h> #endif #if defined(Q_WS_QWS) @@ -855,8 +856,9 @@ public: // Unified toolbar variables bool isInUnifiedToolbar; - QWindowSurface *unifiedSurface; + QUnifiedToolbarSurface *unifiedSurface; QPoint toolbar_offset; + QWidget *toolbar_ancestor; bool flushRequested; #endif // QT_MAC_USE_COCOA void determineWindowClass(); diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp index 36b3e6a..6abcf2c 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp +++ b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp @@ -71,7 +71,7 @@ QPaintDevice *QUnifiedToolbarSurface::paintDevice() return &d_ptr->image->image; } -void QUnifiedToolbarSurface::recursiveRedirect(QObject *object, const QPoint &offset) +void QUnifiedToolbarSurface::recursiveRedirect(QObject *object, QWidget *parent_toolbar, const QPoint &offset) { if (object != 0) { if (object->isWidgetType()) { @@ -83,9 +83,10 @@ void QUnifiedToolbarSurface::recursiveRedirect(QObject *object, const QPoint &of widget->d_func()->unifiedSurface = this; widget->d_func()->isInUnifiedToolbar = true; widget->d_func()->toolbar_offset = offset; + widget->d_func()->toolbar_ancestor = parent_toolbar; for (int i = 0; i < object->children().size(); ++i) { - recursiveRedirect(object->children().at(i), offset); + recursiveRedirect(object->children().at(i), parent_toolbar, offset); } } } @@ -95,7 +96,7 @@ void QUnifiedToolbarSurface::recursiveRedirect(QObject *object, const QPoint &of void QUnifiedToolbarSurface::insertToolbar(QWidget *toolbar, const QPoint &offset) { setGeometry(QRect(QPoint(0, 0), QSize(offset.x() + toolbar->width(), 100))); // FIXME - recursiveRedirect(toolbar, offset); + recursiveRedirect(toolbar, toolbar, offset); } void QUnifiedToolbarSurface::setGeometry(const QRect &rect) @@ -135,10 +136,10 @@ void QUnifiedToolbarSurface::flush(QWidget *widget, const QRegion &rgn, const QP if (!d->image || rgn.rectCount() == 0) return; - widget->d_func()->flushRequested = true; - - // We call display: directly to avoid flickering in the toolbar. - qt_mac_display(widget); + if (widget->d_func()->flushRequested) { + // We call display: directly to avoid flickering in the toolbar. + qt_mac_display(widget); + } } void QUnifiedToolbarSurface::prepareBuffer(QImage::Format format, QWidget *widget) @@ -208,6 +209,22 @@ CGContextRef QUnifiedToolbarSurface::imageContext() return d->image->cg; } +void QUnifiedToolbarSurface::renderToolbar(QWidget *widget, bool forceFlush) +{ + QWidget *toolbar = widget->d_func()->toolbar_ancestor; + + updateToolbarOffset(toolbar); + QRect beginPaintRect(toolbar->d_func()->toolbar_offset.x(), toolbar->d_func()->toolbar_offset.y(), toolbar->geometry().width(), toolbar->geometry().height()); + QRegion beginPaintRegion(beginPaintRect); + + beginPaint(beginPaintRegion); + toolbar->render(paintDevice(), toolbar->d_func()->toolbar_offset, QRegion(), QWidget::DrawChildren); + toolbar->d_func()->flushRequested = true; + + if (forceFlush) + flush(toolbar, beginPaintRegion, toolbar->d_func()->toolbar_offset); +} + QT_END_NAMESPACE #endif // QT_MAC_USE_COCOA diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h index 54f0f8e..f7ad02e 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h +++ b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h @@ -86,10 +86,11 @@ public: QPaintDevice *paintDevice(); CGContextRef imageContext(); + void renderToolbar(QWidget *widget, bool forceFlush = false); private: void prepareBuffer(QImage::Format format, QWidget *widget); - void recursiveRedirect(QObject *widget, const QPoint &offset); + void recursiveRedirect(QObject *widget, QWidget *parent_toolbar, const QPoint &offset); Q_DECLARE_PRIVATE(QUnifiedToolbarSurface) QScopedPointer<QUnifiedToolbarSurfacePrivate> d_ptr; -- cgit v0.12 From b4079c3d3891331ee635f8578740b8fcf2f06ac5 Mon Sep 17 00:00:00 2001 From: Fabien Freling <fabien.freling@nokia.com> Date: Wed, 23 Feb 2011 16:33:40 +0100 Subject: Remove useless variable. Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qwidget.cpp | 1 - src/gui/kernel/qwidget_p.h | 1 - 2 files changed, 2 deletions(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 51ced44..407af02 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -326,7 +326,6 @@ QWidgetPrivate::QWidgetPrivate(int version) drawRectOriginalAdded = false; originalDrawMethod = true; changeMethods = false; - hasOwnContext = false; isInUnifiedToolbar = false; unifiedSurface = 0; toolbar_ancestor = 0; diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 2940d19..492292c 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -857,7 +857,6 @@ public: bool originalDrawMethod; // Do we need to change the methods? bool changeMethods; - bool hasOwnContext; // Unified toolbar variables bool isInUnifiedToolbar; -- cgit v0.12 From f41e395e9ebc6db33c21ff082b59f2d7b6d2a3b2 Mon Sep 17 00:00:00 2001 From: Fabien Freling <fabien.freling@nokia.com> Date: Wed, 23 Feb 2011 17:42:23 +0100 Subject: Move the Mac specific behavior in #ifdef. Since the other platforms are not aware of the unified toolbar, we move all the specific behaviors in #ifdef sections. Reviewed-by: Denis Dzyubenko --- src/gui/kernel/qwidget.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 407af02..5fc9951 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -2078,9 +2078,14 @@ void QWidgetPrivate::subtractOpaqueSiblings(QRegion &sourceRegion, bool *hasDirt { Q_Q(const QWidget); static int disableSubtractOpaqueSiblings = qgetenv("QT_NO_SUBTRACTOPAQUESIBLINGS").toInt(); - if (disableSubtractOpaqueSiblings || q->isWindow() || q->d_func()->isInUnifiedToolbar) + if (disableSubtractOpaqueSiblings || q->isWindow()) return; +#ifdef QT_MAC_USE_COCOA + if (q->d_func()->isInUnifiedToolbar) + return; +#endif // QT_MAC_USE_COCOA + QRect clipBoundingRect; bool dirtyClipBoundingRect = true; @@ -10373,10 +10378,12 @@ void QWidget::repaint(const QRect &rect) return; if (hasBackingStoreSupport()) { +#ifdef QT_MAC_USE_COCOA if (qt_widget_private(this)->isInUnifiedToolbar) { qt_widget_private(this)->unifiedSurface->renderToolbar(this, true); return; } +#endif // QT_MAC_USE_COCOA QTLWExtra *tlwExtra = window()->d_func()->maybeTopData(); if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) { tlwExtra->inRepaint = true; @@ -10406,10 +10413,12 @@ void QWidget::repaint(const QRegion &rgn) return; if (hasBackingStoreSupport()) { +#ifdef QT_MAC_USE_COCOA if (qt_widget_private(this)->isInUnifiedToolbar) { qt_widget_private(this)->unifiedSurface->renderToolbar(this, true); return; } +#endif // QT_MAC_USE_COCOA QTLWExtra *tlwExtra = window()->d_func()->maybeTopData(); if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) { tlwExtra->inRepaint = true; @@ -10467,10 +10476,12 @@ void QWidget::update(const QRect &rect) } if (hasBackingStoreSupport()) { +#ifdef QT_MAC_USE_COCOA if (qt_widget_private(this)->isInUnifiedToolbar) { qt_widget_private(this)->unifiedSurface->renderToolbar(this); return; } +#endif // QT_MAC_USE_COCOA QTLWExtra *tlwExtra = window()->d_func()->maybeTopData(); if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) tlwExtra->backingStore->markDirty(rect, this); @@ -10495,10 +10506,12 @@ void QWidget::update(const QRegion &rgn) } if (hasBackingStoreSupport()) { +#ifdef QT_MAC_USE_COCOA if (qt_widget_private(this)->isInUnifiedToolbar) { qt_widget_private(this)->unifiedSurface->renderToolbar(this); return; } +#endif // QT_MAC_USE_COCOA QTLWExtra *tlwExtra = window()->d_func()->maybeTopData(); if (tlwExtra && !tlwExtra->inTopLevelResize && tlwExtra->backingStore) tlwExtra->backingStore->markDirty(rgn, this); -- cgit v0.12 From 99e32b0a2049f3b28d3a54bec31f2471586d8d74 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <samuel.rodal@nokia.com> Date: Thu, 24 Feb 2011 13:35:27 +0100 Subject: Added extended key event support in QWindowSystemInterface. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These are needed for compositor applications to be able to send the raw scan codes to the clients. Reviewed-by: Jørgen Lind --- src/gui/kernel/qapplication_qpa.cpp | 11 ++++++++-- src/gui/kernel/qevent.cpp | 1 + src/gui/kernel/qwindowsysteminterface_qpa.cpp | 30 +++++++++++++++++++++++++++ src/gui/kernel/qwindowsysteminterface_qpa.h | 11 ++++++++++ src/gui/kernel/qwindowsysteminterface_qpa_p.h | 12 ++++++++++- 5 files changed, 62 insertions(+), 3 deletions(-) diff --git a/src/gui/kernel/qapplication_qpa.cpp b/src/gui/kernel/qapplication_qpa.cpp index cd76adf..cb5439c 100644 --- a/src/gui/kernel/qapplication_qpa.cpp +++ b/src/gui/kernel/qapplication_qpa.cpp @@ -51,6 +51,7 @@ #endif #include "private/qwidget_p.h" +#include "private/qevent_p.h" #include "qgenericpluginfactory_qpa.h" #include "qplatformintegrationfactory_qpa_p.h" @@ -816,8 +817,14 @@ void QApplicationPrivate::processKeyEvent(QWindowSystemInterfacePrivate::KeyEven if (app_do_modal && !qt_try_modal(focusW, e->keyType)) return; - QKeyEvent ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount); - QApplication::sendSpontaneousEvent(focusW, &ev); + if (e->nativeScanCode || e->nativeVirtualKey || e->nativeModifiers) { + QKeyEventEx ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount, + e->nativeScanCode, e->nativeVirtualKey, e->nativeModifiers); + QApplication::sendSpontaneousEvent(focusW, &ev); + } else { + QKeyEvent ev(e->keyType, e->key, e->modifiers, e->unicode, e->repeat, e->repeatCount); + QApplication::sendSpontaneousEvent(focusW, &ev); + } } void QApplicationPrivate::processEnterEvent(QWindowSystemInterfacePrivate::EnterEvent *e) diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index e7abb47..db25da3 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -43,6 +43,7 @@ #include "qcursor.h" #include "qapplication.h" #include "private/qapplication_p.h" +#include "private/qevent_p.h" #include "private/qkeysequence_p.h" #include "qwidget.h" #include "qgraphicsview.h" diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.cpp b/src/gui/kernel/qwindowsysteminterface_qpa.cpp index b6177b0..1fd4afd 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.cpp +++ b/src/gui/kernel/qwindowsysteminterface_qpa.cpp @@ -150,6 +150,36 @@ void QWindowSystemInterface::handleKeyEvent(QWidget *tlw, ulong timestamp, QEven QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); } +void QWindowSystemInterface::handleExtendedKeyEvent(QWidget *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, + quint32 nativeScanCode, quint32 nativeVirtualKey, + quint32 nativeModifiers, + const QString& text, bool autorep, + ushort count) +{ + unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); + handleExtendedKeyEvent(w, time, type, key, modifiers, nativeScanCode, nativeVirtualKey, nativeModifiers, + text, autorep, count); +} + +void QWindowSystemInterface::handleExtendedKeyEvent(QWidget *tlw, ulong timestamp, QEvent::Type type, int key, + Qt::KeyboardModifiers modifiers, + quint32 nativeScanCode, quint32 nativeVirtualKey, + quint32 nativeModifiers, + const QString& text, bool autorep, + ushort count) +{ + if (tlw) { + QWidgetData *data = qt_qwidget_data(tlw); + if (data->in_destructor) + tlw = 0; + } + + QWindowSystemInterfacePrivate::KeyEvent * e = + new QWindowSystemInterfacePrivate::KeyEvent(tlw, timestamp, type, key, modifiers, + nativeScanCode, nativeVirtualKey, nativeModifiers, text, autorep, count); + QWindowSystemInterfacePrivate::queueWindowSystemEvent(e); +} + void QWindowSystemInterface::handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o) { unsigned long time = QWindowSystemInterfacePrivate::eventTime.elapsed(); handleWheelEvent(w, time, local, global, d, o); diff --git a/src/gui/kernel/qwindowsysteminterface_qpa.h b/src/gui/kernel/qwindowsysteminterface_qpa.h index 39c2f79..df67857 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa.h @@ -64,6 +64,17 @@ public: static void handleKeyEvent(QWidget *w, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); static void handleKeyEvent(QWidget *w, ulong timestamp, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1); + static void handleExtendedKeyEvent(QWidget *w, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, + quint32 nativeScanCode, quint32 nativeVirtualKey, + quint32 nativeModifiers, + const QString& text = QString(), bool autorep = false, + ushort count = 1); + static void handleExtendedKeyEvent(QWidget *w, ulong timestamp, QEvent::Type type, int key, Qt::KeyboardModifiers modifiers, + quint32 nativeScanCode, quint32 nativeVirtualKey, + quint32 nativeModifiers, + const QString& text = QString(), bool autorep = false, + ushort count = 1); + static void handleWheelEvent(QWidget *w, const QPoint & local, const QPoint & global, int d, Qt::Orientation o); static void handleWheelEvent(QWidget *w, ulong timestamp, const QPoint & local, const QPoint & global, int d, Qt::Orientation o); diff --git a/src/gui/kernel/qwindowsysteminterface_qpa_p.h b/src/gui/kernel/qwindowsysteminterface_qpa_p.h index 3491a1a..6be86ad 100644 --- a/src/gui/kernel/qwindowsysteminterface_qpa_p.h +++ b/src/gui/kernel/qwindowsysteminterface_qpa_p.h @@ -142,13 +142,23 @@ public: public: KeyEvent(QWidget *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods, const QString & text = QString(), bool autorep = false, ushort count = 1) :UserEvent(w, time, Key), key(k), unicode(text), repeat(autorep), - repeatCount(count), modifiers(mods), keyType(t) { } + repeatCount(count), modifiers(mods), keyType(t), + nativeScanCode(0), nativeVirtualKey(0), nativeModifiers(0) { } + KeyEvent(QWidget *w, ulong time, QEvent::Type t, int k, Qt::KeyboardModifiers mods, + quint32 nativeSC, quint32 nativeVK, quint32 nativeMods, + const QString & text = QString(), bool autorep = false, ushort count = 1) + :UserEvent(w, time, Key), key(k), unicode(text), repeat(autorep), + repeatCount(count), modifiers(mods), keyType(t), + nativeScanCode(nativeSC), nativeVirtualKey(nativeVK), nativeModifiers(nativeMods) { } int key; QString unicode; bool repeat; ushort repeatCount; Qt::KeyboardModifiers modifiers; QEvent::Type keyType; + quint32 nativeScanCode; + quint32 nativeVirtualKey; + quint32 nativeModifiers; }; class TouchEvent : public UserEvent { -- cgit v0.12 From 87c16f2bedaf1810cf9a96f65e5af0ad819bf9e5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <samuel.rodal@nokia.com> Date: Thu, 24 Feb 2011 13:49:16 +0100 Subject: Call the extended key event handlers in XCB and Xlib backends. --- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 2 +- src/plugins/platforms/xlib/qxlibkeyboard.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index dcb35fd..f594232 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -948,7 +948,7 @@ void QXcbKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, xcb_keycod QString string = translateKeySym(sym, state, qtcode, modifiers, chars, count); - QWindowSystemInterface::handleKeyEvent(widget, time, type, qtcode, modifiers, string.left(count)); + QWindowSystemInterface::handleExtendedKeyEvent(widget, time, type, qtcode, modifiers, code, 0, state, string.left(count)); } void QXcbKeyboard::handleKeyPressEvent(QWidget *widget, const xcb_key_press_event_t *event) diff --git a/src/plugins/platforms/xlib/qxlibkeyboard.cpp b/src/plugins/platforms/xlib/qxlibkeyboard.cpp index 65727a4..a1e38b0 100644 --- a/src/plugins/platforms/xlib/qxlibkeyboard.cpp +++ b/src/plugins/platforms/xlib/qxlibkeyboard.cpp @@ -996,5 +996,5 @@ void QXlibKeyboard::handleKeyEvent(QWidget *widget, QEvent::Type type, XKeyEvent KeySym keySym; count = XLookupString(ev,chars.data(),chars.size(),&keySym,0); QString text = translateKeySym(keySym,ev->state,qtcode,modifiers,chars,count); - QWindowSystemInterface::handleKeyEvent(widget,ev->time,type,qtcode,modifiers,text.left(count)); + QWindowSystemInterface::handleExtendedKeyEvent(widget,ev->time,type,qtcode,modifiers,ev->keycode,0,ev->state,text.left(count)); } -- cgit v0.12 From 1f50a3aa50b934a181cd0d18c260f2533ab63d43 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete <paul.tvete@nokia.com> Date: Thu, 24 Feb 2011 17:31:15 +0100 Subject: Make it build when EGL is not available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Jørgen --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 12 ++++++++++- src/plugins/platforms/wayland/qwaylandinclude.h | 6 ++++++ .../platforms/wayland/qwaylandintegration.cpp | 4 ++++ src/plugins/platforms/wayland/wayland.pro | 24 ++++++++++++++-------- 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index ca23165..c3e87a1 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -171,8 +171,9 @@ void QWaylandDisplay::flushRequests(void) QWaylandDisplay::QWaylandDisplay(void) : mWriteNotifier(0) { +#ifdef QT_WAYLAND_GL_SUPPORT EGLint major, minor; - +#endif mDisplay = wl_display_connect(NULL); if (mDisplay == NULL) { fprintf(stderr, "failed to create display: %m\n"); @@ -182,6 +183,7 @@ QWaylandDisplay::QWaylandDisplay(void) wl_display_add_global_listener(mDisplay, QWaylandDisplay::displayHandleGlobal, this); +#ifdef QT_WAYLAND_GL_SUPPORT mNativeEglDisplay = wl_egl_display_create(mDisplay); mEglDisplay = eglGetDisplay((EGLNativeDisplayType)mNativeEglDisplay); @@ -193,6 +195,12 @@ QWaylandDisplay::QWaylandDisplay(void) return; } } +#else + mNativeEglDisplay = 0; + mEglDisplay = 0; +#endif + + eventDispatcher(); int fd = wl_display_get_fd(mDisplay, sourceUpdate, this); mReadNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this); @@ -208,7 +216,9 @@ QWaylandDisplay::QWaylandDisplay(void) QWaylandDisplay::~QWaylandDisplay(void) { close(mFd); +#ifdef QT_WAYLAND_GL_SUPPORT eglTerminate(mEglDisplay); +#endif wl_display_destroy(mDisplay); } diff --git a/src/plugins/platforms/wayland/qwaylandinclude.h b/src/plugins/platforms/wayland/qwaylandinclude.h index afaa885..0135251 100644 --- a/src/plugins/platforms/wayland/qwaylandinclude.h +++ b/src/plugins/platforms/wayland/qwaylandinclude.h @@ -44,6 +44,7 @@ #include <wayland-client.h> +#ifdef QT_WAYLAND_GL_SUPPORT #include <wayland-egl.h> #define GL_GLEXT_PROTOTYPES @@ -54,4 +55,9 @@ #include <EGL/egl.h> #include <EGL/eglext.h> +#else +typedef void* EGLDisplay; +typedef void* EGLConfig; +#endif + #endif // QWAYLANDINCLUDE_H diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 9483a47..7c0f69e 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -54,7 +54,9 @@ #include <QtGui/QPlatformWindowFormat> #include <QtGui/private/qpixmap_raster_p.h> +#ifdef QT_WAYLAND_GL_SUPPORT #include <QtOpenGL/private/qpixmapdata_gl_p.h> +#endif QWaylandIntegration::QWaylandIntegration(bool useOpenGL) : mFontDb(new QFontconfigDatabase()) @@ -71,8 +73,10 @@ QWaylandIntegration::screens() const QPixmapData *QWaylandIntegration::createPixmapData(QPixmapData::PixelType type) const { +#ifdef QT_WAYLAND_GL_SUPPORT if (mUseOpenGL) return new QGLPixmapData(type); +#endif return new QRasterPixmapData(type); } diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro index e40e423..9faa59b 100644 --- a/src/plugins/platforms/wayland/wayland.pro +++ b/src/plugins/platforms/wayland/wayland.pro @@ -8,15 +8,11 @@ DEFINES += Q_PLATFORM_WAYLAND SOURCES = main.cpp \ qwaylandintegration.cpp \ qwaylandshmsurface.cpp \ - qwaylanddrmsurface.cpp \ qwaylandinputdevice.cpp \ - qwaylandglcontext.cpp \ qwaylandcursor.cpp \ qwaylanddisplay.cpp \ qwaylandwindow.cpp \ qwaylandscreen.cpp \ - ../eglconvenience/qeglconvenience.cpp \ - qwaylandeglwindow.cpp \ qwaylandshmwindow.cpp HEADERS = qwaylandintegration.h \ @@ -24,19 +20,31 @@ HEADERS = qwaylandintegration.h \ qwaylanddisplay.h \ qwaylandwindow.h \ qwaylandscreen.h \ - qwaylandglcontext.h \ qwaylandshmsurface.h \ qwaylanddrmsurface.h \ qwaylandbuffer.h \ - ../eglconvenience/qeglconvenience.h \ qwaylandinclude.h \ qwaylandeglwindow.h \ qwaylandshmwindow.h -contains(QT_CONFIG, opengl) { +LIBS += -lwayland-client +LIBS += -lxkbcommon + +contains(QT_CONFIG, opengles2) { QT += opengl + LIBS += -lwayland-egl -lEGL + + SOURCES += qwaylanddrmsurface.cpp \ + qwaylandglcontext.cpp \ + ../eglconvenience/qeglconvenience.cpp \ + qwaylandeglwindow.cpp + + HEADERS += qwaylandglcontext.h \ + ../eglconvenience/qeglconvenience.h \ + + DEFINES += QT_WAYLAND_GL_SUPPORT } -LIBS += -lwayland-client -lwayland-egl -lxkbcommon -lEGL + unix { CONFIG += link_pkgconfig PKGCONFIG += libdrm -- cgit v0.12 From 2b9e7bcede5ca6ba9de2534839244cc621f17e1c Mon Sep 17 00:00:00 2001 From: Fabien Freling <fabien.freling@nokia.com> Date: Thu, 24 Feb 2011 16:36:44 +0100 Subject: Add the ability to remove a toolbar from the unified toolbar. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows to toggle the unified look of the toolbar. This is useful for apps going fullscreen since we have to turn the unified look off when entering fullscreen mode. Reviewed-by: Samuel Rødal --- src/gui/painting/qunifiedtoolbarsurface_mac.cpp | 26 +++++++++++++++++++++++++ src/gui/painting/qunifiedtoolbarsurface_mac_p.h | 5 ++++- src/gui/widgets/qmainwindowlayout_mac.mm | 6 +++--- 3 files changed, 33 insertions(+), 4 deletions(-) diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp index 6abcf2c..87206f3 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp +++ b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp @@ -99,6 +99,32 @@ void QUnifiedToolbarSurface::insertToolbar(QWidget *toolbar, const QPoint &offse recursiveRedirect(toolbar, toolbar, offset); } +// We basically undo what we set in recursiveRedirect(). +void QUnifiedToolbarSurface::recursiveRemoval(QObject *object) +{ + if (object != 0) { + if (object->isWidgetType()) { + QWidget *widget = qobject_cast<QWidget *>(object); + + if (!(widget->windowType() & Qt::Window)) { + widget->d_func()->unifiedSurface = 0; + widget->d_func()->isInUnifiedToolbar = false; + widget->d_func()->toolbar_offset = QPoint(); + widget->d_func()->toolbar_ancestor = 0; + + for (int i = 0; i < object->children().size(); ++i) { + recursiveRemoval(object->children().at(i)); + } + } + } + } +} + +void QUnifiedToolbarSurface::removeToolbar(QToolBar *toolbar) +{ + recursiveRemoval(toolbar); +} + void QUnifiedToolbarSurface::setGeometry(const QRect &rect) { QWindowSurface::setGeometry(rect); diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h index f7ad02e..99839fa 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h +++ b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h @@ -55,6 +55,7 @@ #include <private/qwindowsurface_raster_p.h> #include <QWidget> +#include <QToolBar> #include <private/qwidget_p.h> #include <private/qnativeimage_p.h> @@ -82,15 +83,17 @@ public: void setGeometry(const QRect &rect); void beginPaint(const QRegion &rgn); void insertToolbar(QWidget *toolbar, const QPoint &offset); + void removeToolbar(QToolBar *toolbar); void updateToolbarOffset(QWidget *widget); + void renderToolbar(QWidget *widget, bool forceFlush = false); QPaintDevice *paintDevice(); CGContextRef imageContext(); - void renderToolbar(QWidget *widget, bool forceFlush = false); private: void prepareBuffer(QImage::Format format, QWidget *widget); void recursiveRedirect(QObject *widget, QWidget *parent_toolbar, const QPoint &offset); + void recursiveRemoval(QObject *object); Q_DECLARE_PRIVATE(QUnifiedToolbarSurface) QScopedPointer<QUnifiedToolbarSurfacePrivate> d_ptr; diff --git a/src/gui/widgets/qmainwindowlayout_mac.mm b/src/gui/widgets/qmainwindowlayout_mac.mm index e428ffc..761a433 100644 --- a/src/gui/widgets/qmainwindowlayout_mac.mm +++ b/src/gui/widgets/qmainwindowlayout_mac.mm @@ -356,10 +356,10 @@ void QMainWindowLayout::updateHIToolBarStatus() while (!qtoolbarsInUnifiedToolbarList.isEmpty()) { // Should shrink the list by one every time. QToolBar *toolbar = qtoolbarsInUnifiedToolbarList.first(); - layoutState.mainWindow->addToolBar(Qt::TopToolBarArea, toolbar); #if defined(QT_MAC_USE_COCOA) - toolbar->d_func()->isInUnifiedToolbar = false; + unifiedSurface->removeToolbar(toolbar); #endif + layoutState.mainWindow->addToolBar(Qt::TopToolBarArea, toolbar); } macWindowToolbarSet(qt_mac_window_for(layoutState.mainWindow), 0); } else { @@ -393,7 +393,7 @@ void QMainWindowLayout::insertIntoMacToolbar(QToolBar *before, QToolBar *toolbar return; #if defined(QT_MAC_USE_COCOA) - // toolbar will now become native (if not allready) since we need + // toolbar will now become native (if not already) since we need // an nsview for it inside the corresponding NSToolbarItem. // Setting isInUnifiedToolbar will (among other things) stop alien // siblings from becoming native when this happends since the toolbar -- cgit v0.12 From 2a9680ffcaf85f233323a0d41bea776a519e747a Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete <paul.tvete@nokia.com> Date: Fri, 25 Feb 2011 12:56:28 +0100 Subject: Avoid flicker Don't start a new paint until we get an ack from the compositor Reviewed-by: Samuel --- src/plugins/platforms/wayland/qwaylandshmsurface.cpp | 16 ++++++++++++++++ src/plugins/platforms/wayland/qwaylandshmsurface.h | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp index 9bcae26..b1cba71 100644 --- a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp @@ -95,6 +95,7 @@ QWaylandShmWindowSurface::QWaylandShmWindowSurface(QWidget *window) : QWindowSurface(window) , mBuffer(0) , mDisplay(QWaylandScreen::waylandScreenFromWidget(window)->display()) + , mWaitingForFrameSync(false) { } @@ -107,6 +108,19 @@ QPaintDevice *QWaylandShmWindowSurface::paintDevice() return mBuffer->image(); } +void QWaylandShmWindowSurface::beginPaint(const QRegion &) +{ + while (mWaitingForFrameSync) { + mDisplay->eventDispatcher(); + } +} + +void QWaylandShmWindowSurface::frameCallback(void *data, uint32_t time) +{ + QWaylandShmWindowSurface *self = static_cast<QWaylandShmWindowSurface*>(data); + self->mWaitingForFrameSync = false; +} + void QWaylandShmWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) { Q_UNUSED(widget); @@ -118,6 +132,8 @@ void QWaylandShmWindowSurface::flush(QWidget *widget, const QRegion ®ion, con for (int i = 0; i < rects.size(); i++) { waylandWindow->damage(rects.at(i)); } + mWaitingForFrameSync = true; + mDisplay->frameCallback(QWaylandShmWindowSurface::frameCallback, this); } void QWaylandShmWindowSurface::resize(const QSize &size) diff --git a/src/plugins/platforms/wayland/qwaylandshmsurface.h b/src/plugins/platforms/wayland/qwaylandshmsurface.h index 266b290..615d944 100644 --- a/src/plugins/platforms/wayland/qwaylandshmsurface.h +++ b/src/plugins/platforms/wayland/qwaylandshmsurface.h @@ -71,10 +71,14 @@ public: QPaintDevice *paintDevice(); void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); void resize(const QSize &size); + void beginPaint(const QRegion &); private: + static void frameCallback(void *data, uint32_t time);\ + QWaylandShmBuffer *mBuffer; QWaylandDisplay *mDisplay; + bool mWaitingForFrameSync; }; QT_END_NAMESPACE -- cgit v0.12 From 463cee77f75d20760f9f74f52e1dfccb44fcb862 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Thu, 24 Feb 2011 12:27:20 +0100 Subject: Lighthouse: Xlib added QXlibDisplay type We still use the nativeDisplay all over the place. Maybe we should? --- src/plugins/platforms/xlib/qxlibclipboard.cpp | 77 ++++++++++++----------- src/plugins/platforms/xlib/qxlibcursor.cpp | 39 ++++++------ src/plugins/platforms/xlib/qxlibdisplay.cpp | 37 +++++++++++ src/plugins/platforms/xlib/qxlibdisplay.h | 22 +++++++ src/plugins/platforms/xlib/qxlibintegration.cpp | 3 +- src/plugins/platforms/xlib/qxlibkeyboard.cpp | 3 +- src/plugins/platforms/xlib/qxlibscreen.cpp | 73 ++++++++++++--------- src/plugins/platforms/xlib/qxlibscreen.h | 16 ++--- src/plugins/platforms/xlib/qxlibstatic.cpp | 15 ++--- src/plugins/platforms/xlib/qxlibwindow.cpp | 67 ++++++++++---------- src/plugins/platforms/xlib/qxlibwindowsurface.cpp | 14 ++--- src/plugins/platforms/xlib/xlib.pro | 6 +- 12 files changed, 228 insertions(+), 144 deletions(-) create mode 100644 src/plugins/platforms/xlib/qxlibdisplay.cpp create mode 100644 src/plugins/platforms/xlib/qxlibdisplay.h diff --git a/src/plugins/platforms/xlib/qxlibclipboard.cpp b/src/plugins/platforms/xlib/qxlibclipboard.cpp index 7930fcb..49b2dc7 100644 --- a/src/plugins/platforms/xlib/qxlibclipboard.cpp +++ b/src/plugins/platforms/xlib/qxlibclipboard.cpp @@ -43,6 +43,7 @@ #include "qxlibscreen.h" #include "qxlibmime.h" +#include "qxlibdisplay.h" #include <private/qapplication_p.h> @@ -92,7 +93,7 @@ protected: if (targets[i] == 0) continue; - QStringList formatsForAtom = mimeFormatsForAtom(m_clipboard->screen()->display(),targets[i]); + QStringList formatsForAtom = mimeFormatsForAtom(m_clipboard->screen()->display()->nativeDisplay(),targets[i]); for (int j = 0; j < formatsForAtom.size(); ++j) { if (!formatList.contains(formatsForAtom.at(j))) that->formatList.append(formatsForAtom.at(j)); @@ -124,17 +125,17 @@ protected: atoms.append(targets[i]); QByteArray encoding; - Atom fmtatom = mimeAtomForFormat(m_clipboard->screen()->display(),fmt, requestedType, atoms, &encoding); + Atom fmtatom = mimeAtomForFormat(m_clipboard->screen()->display()->nativeDisplay(),fmt, requestedType, atoms, &encoding); if (fmtatom == 0) return QVariant(); - return mimeConvertToFormat(m_clipboard->screen()->display(),fmtatom, m_clipboard->getDataInFormat(modeAtom,fmtatom), fmt, requestedType, encoding); + return mimeConvertToFormat(m_clipboard->screen()->display()->nativeDisplay(),fmtatom, m_clipboard->getDataInFormat(modeAtom,fmtatom), fmt, requestedType, encoding); } private: bool empty() const { - Window win = XGetSelectionOwner(m_clipboard->screen()->display(), modeAtom); + Window win = XGetSelectionOwner(m_clipboard->screen()->display()->nativeDisplay(), modeAtom); return win == XNone; } @@ -167,7 +168,7 @@ const QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) const QXlibClipboard *that = const_cast<QXlibClipboard *>(this); that->m_xClipboard = new QXlibClipboardMime(mode,that); } - Window clipboardOwner = XGetSelectionOwner(screen()->display(),QXlibStatic::atom(QXlibStatic::CLIPBOARD)); + Window clipboardOwner = XGetSelectionOwner(screen()->display()->nativeDisplay(),QXlibStatic::atom(QXlibStatic::CLIPBOARD)); if (clipboardOwner == owner()) { return m_clientClipboard; } else { @@ -178,7 +179,7 @@ const QMimeData * QXlibClipboard::mimeData(QClipboard::Mode mode) const QXlibClipboard *that = const_cast<QXlibClipboard *>(this); that->m_xSelection = new QXlibClipboardMime(mode,that); } - Window clipboardOwner = XGetSelectionOwner(screen()->display(),XA_PRIMARY); + Window clipboardOwner = XGetSelectionOwner(screen()->display()->nativeDisplay(),XA_PRIMARY); if (clipboardOwner == owner()) { return m_clientSelection; } else { @@ -218,9 +219,9 @@ void QXlibClipboard::setMimeData(QMimeData *data, QClipboard::Mode mode) *d = data; } - XSetSelectionOwner(m_screen->display(), modeAtom, newOwner, CurrentTime); + XSetSelectionOwner(m_screen->display()->nativeDisplay(), modeAtom, newOwner, CurrentTime); - if (XGetSelectionOwner(m_screen->display(), modeAtom) != newOwner) { + if (XGetSelectionOwner(m_screen->display()->nativeDisplay(), modeAtom) != newOwner) { qWarning("QClipboard::setData: Cannot set X11 selection owner"); } @@ -244,7 +245,7 @@ Window QXlibClipboard::requestor() const if (!m_requestor) { int x = 0, y = 0, w = 3, h = 3; QXlibClipboard *that = const_cast<QXlibClipboard *>(this); - Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), + Window window = XCreateSimpleWindow(m_screen->display()->nativeDisplay(), m_screen->rootWindow(), x, y, w, h, 0 /*border_width*/, m_screen->blackPixel(), m_screen->whitePixel()); that->setRequestor(window); @@ -255,7 +256,7 @@ Window QXlibClipboard::requestor() const void QXlibClipboard::setRequestor(Window window) { if (m_requestor != XNone) { - XDestroyWindow(m_screen->display(),m_requestor); + XDestroyWindow(m_screen->display()->nativeDisplay(),m_requestor); } m_requestor = window; } @@ -265,7 +266,7 @@ Window QXlibClipboard::owner() const if (!m_owner) { int x = 0, y = 0, w = 3, h = 3; QXlibClipboard *that = const_cast<QXlibClipboard *>(this); - Window window = XCreateSimpleWindow(m_screen->display(), m_screen->rootWindow(), + Window window = XCreateSimpleWindow(m_screen->display()->nativeDisplay(), m_screen->rootWindow(), x, y, w, h, 0 /*border_width*/, m_screen->blackPixel(), m_screen->whitePixel()); that->setOwner(window); @@ -276,7 +277,7 @@ Window QXlibClipboard::owner() const void QXlibClipboard::setOwner(Window window) { if (m_owner != XNone){ - XDestroyWindow(m_screen->display(),m_owner); + XDestroyWindow(m_screen->display()->nativeDisplay(),m_owner); } m_owner = window; } @@ -286,7 +287,7 @@ Atom QXlibClipboard::sendTargetsSelection(QMimeData *d, Window window, Atom prop QVector<Atom> types; QStringList formats = QInternalMimeData::formatsHelper(d); for (int i = 0; i < formats.size(); ++i) { - QList<Atom> atoms = QXlibMime::mimeAtomsForFormat(screen()->display(),formats.at(i)); + QList<Atom> atoms = QXlibMime::mimeAtomsForFormat(screen()->display()->nativeDisplay(),formats.at(i)); for (int j = 0; j < atoms.size(); ++j) { if (!types.contains(atoms.at(j))) types.append(atoms.at(j)); @@ -297,7 +298,7 @@ Atom QXlibClipboard::sendTargetsSelection(QMimeData *d, Window window, Atom prop types.append(QXlibStatic::atom(QXlibStatic::TIMESTAMP)); types.append(QXlibStatic::atom(QXlibStatic::SAVE_TARGETS)); - XChangeProperty(screen()->display(), window, property, XA_ATOM, 32, + XChangeProperty(screen()->display()->nativeDisplay(), window, property, XA_ATOM, 32, PropModeReplace, (uchar *) types.data(), types.size()); return property; } @@ -308,14 +309,14 @@ Atom QXlibClipboard::sendSelection(QMimeData *d, Atom target, Window window, Ato int dataFormat = 0; QByteArray data; - QString fmt = QXlibMime::mimeAtomToString(screen()->display(), target); + QString fmt = QXlibMime::mimeAtomToString(screen()->display()->nativeDisplay(), target); if (fmt.isEmpty()) { // Not a MIME type we have qDebug() << "QClipboard: send_selection(): converting to type '%s' is not supported" << fmt.data(); return XNone; } qDebug() << "QClipboard: send_selection(): converting to type '%s'" << fmt.data(); - if (QXlibMime::mimeDataForAtom(screen()->display(),target, d, &data, &atomFormat, &dataFormat)) { + if (QXlibMime::mimeDataForAtom(screen()->display()->nativeDisplay(),target, d, &data, &atomFormat, &dataFormat)) { // don't allow INCR transfers when using MULTIPLE or to // Motif clients (since Motif doesn't support INCR) @@ -323,10 +324,10 @@ Atom QXlibClipboard::sendSelection(QMimeData *d, Atom target, Window window, Ato bool allow_incr = property != motif_clip_temporary; // X_ChangeProperty protocol request is 24 bytes - const int increment = (XMaxRequestSize(screen()->display()) * 4) - 24; + const int increment = (XMaxRequestSize(screen()->display()->nativeDisplay()) * 4) - 24; if (data.size() > increment && allow_incr) { long bytes = data.size(); - XChangeProperty(screen()->display(), window, property, + XChangeProperty(screen()->display()->nativeDisplay(), window, property, QXlibStatic::atom(QXlibStatic::INCR), 32, PropModeReplace, (uchar *) &bytes, 1); // (void)new QClipboardINCRTransaction(window, property, atomFormat, dataFormat, data, increment); @@ -339,7 +340,7 @@ Atom QXlibClipboard::sendSelection(QMimeData *d, Atom target, Window window, Ato return XNone; // ### perhaps use several XChangeProperty calls w/ PropModeAppend? int dataSize = data.size() / (dataFormat / 8); // use a single request to transfer data - XChangeProperty(screen()->display(), window, property, atomFormat, + XChangeProperty(screen()->display()->nativeDisplay(), window, property, atomFormat, dataFormat, PropModeReplace, (uchar *) data.data(), dataSize); } @@ -371,13 +372,13 @@ void QXlibClipboard::handleSelectionRequest(XEvent *xevent) d = m_clientClipboard; } else { qWarning("QClipboard: Unknown selection '%lx'", req->selection); - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + XSendEvent(screen()->display()->nativeDisplay(), req->requestor, False, NoEventMask, &event); return; } if (!d) { qWarning("QClipboard: Cannot transfer data, no data available"); - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + XSendEvent(screen()->display()->nativeDisplay(), req->requestor, False, NoEventMask, &event); return; } @@ -399,7 +400,7 @@ void QXlibClipboard::handleSelectionRequest(XEvent *xevent) 0, &multi_type, &multi_format) || multi_format != 32) { // MULTIPLE property not formatted correctly - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + XSendEvent(screen()->display()->nativeDisplay(), req->requestor, False, NoEventMask, &event); return; } nmulti = multi_data.size()/sizeof(*multi); @@ -427,7 +428,7 @@ void QXlibClipboard::handleSelectionRequest(XEvent *xevent) ; } else if (target == xa_timestamp) { // if (d->timestamp != CurrentTime) { -// XChangeProperty(screen()->display(), req->requestor, property, XA_INTEGER, 32, +// XChangeProperty(screen()->display()->nativeDisplay(), req->requestor, property, XA_INTEGER, 32, // PropModeReplace, CurrentTime, 1); // ret = property; // } else { @@ -454,7 +455,7 @@ void QXlibClipboard::handleSelectionRequest(XEvent *xevent) if (multi_writeback) { // according to ICCCM 2.6.2 says to put None back // into the original property on the requestor window - XChangeProperty(screen()->display(), req->requestor, req->property, multi_type, 32, + XChangeProperty(screen()->display()->nativeDisplay(), req->requestor, req->property, multi_type, 32, PropModeReplace, (uchar *) multi, nmulti * 2); } @@ -463,7 +464,7 @@ void QXlibClipboard::handleSelectionRequest(XEvent *xevent) } // send selection notify to requestor - XSendEvent(screen()->display(), req->requestor, False, NoEventMask, &event); + XSendEvent(screen()->display()->nativeDisplay(), req->requestor, False, NoEventMask, &event); } static inline int maxSelectionIncr(Display *dpy) @@ -471,7 +472,7 @@ static inline int maxSelectionIncr(Display *dpy) bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool deleteProperty, QByteArray *buffer, int *size, Atom *type, int *format) const { - int maxsize = maxSelectionIncr(screen()->display()); + int maxsize = maxSelectionIncr(screen()->display()->nativeDisplay()); ulong bytes_left; // bytes_after ulong length; // nitems uchar *data; @@ -485,7 +486,7 @@ bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool delet format = &dummy_format; // Don't read anything, just get the size of the property data - r = XGetWindowProperty(screen()->display(), win, property, 0, 0, False, + r = XGetWindowProperty(screen()->display()->nativeDisplay(), win, property, 0, 0, False, AnyPropertyType, type, format, &length, &bytes_left, &data); if (r != Success || (type && *type == XNone)) { @@ -524,7 +525,7 @@ bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool delet while (bytes_left) { // more to read... - r = XGetWindowProperty(screen()->display(), win, property, offset, maxsize/4, + r = XGetWindowProperty(screen()->display()->nativeDisplay(), win, property, offset, maxsize/4, False, AnyPropertyType, type, format, &length, &bytes_left, &data); if (r != Success || (type && *type == XNone)) @@ -559,7 +560,7 @@ bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool delet char **list_ret = 0; int count; - if (XmbTextPropertyToTextList(screen()->display(), &textprop, &list_ret, + if (XmbTextPropertyToTextList(screen()->display()->nativeDisplay(), &textprop, &list_ret, &count) == Success && count && list_ret) { offset = buffer_offset = strlen(list_ret[0]); buffer->resize(offset); @@ -574,9 +575,9 @@ bool QXlibClipboard::clipboardReadProperty(Window win, Atom property, bool delet *size = buffer_offset; if (deleteProperty) - XDeleteProperty(screen()->display(), win, property); + XDeleteProperty(screen()->display()->nativeDisplay(), win, property); - XFlush(screen()->display()); + screen()->display()->flush(); return ok; } @@ -600,7 +601,7 @@ QByteArray QXlibClipboard::clipboardReadIncrementalProperty(Window win, Atom pro } for (;;) { - XFlush(screen()->display()); + screen()->display()->flush(); if (!screen()->waitForClipboardEvent(win,PropertyNotify,&event,clipboard_timeout)) break; if (event.xproperty.atom != property || @@ -645,11 +646,11 @@ QByteArray QXlibClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) Window win = requestor(); - XSelectInput(screen()->display(), win, NoEventMask); // don't listen for any events + XSelectInput(screen()->display()->nativeDisplay(), win, NoEventMask); // don't listen for any events - XDeleteProperty(screen()->display(), win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION)); - XConvertSelection(screen()->display(), modeAtom, fmtatom, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), win, CurrentTime); - XSync(screen()->display(), false); + XDeleteProperty(screen()->display()->nativeDisplay(), win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION)); + XConvertSelection(screen()->display()->nativeDisplay(), modeAtom, fmtatom, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), win, CurrentTime); + screen()->display()->sync(); XEvent xevent; if (!screen()->waitForClipboardEvent(win,SelectionNotify,&xevent,clipboard_timeout) || @@ -658,7 +659,7 @@ QByteArray QXlibClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) } Atom type; - XSelectInput(screen()->display(), win, PropertyChangeMask); + XSelectInput(screen()->display()->nativeDisplay(), win, PropertyChangeMask); if (clipboardReadProperty(win, QXlibStatic::atom(QXlibStatic::_QT_SELECTION), true, &buf, 0, &type, 0)) { if (type == QXlibStatic::atom(QXlibStatic::INCR)) { @@ -667,7 +668,7 @@ QByteArray QXlibClipboard::getDataInFormat(Atom modeAtom, Atom fmtatom) } } - XSelectInput(screen()->display(), win, NoEventMask); + XSelectInput(screen()->display()->nativeDisplay(), win, NoEventMask); return buf; diff --git a/src/plugins/platforms/xlib/qxlibcursor.cpp b/src/plugins/platforms/xlib/qxlibcursor.cpp index e4d248c..074d2f7 100644 --- a/src/plugins/platforms/xlib/qxlibcursor.cpp +++ b/src/plugins/platforms/xlib/qxlibcursor.cpp @@ -44,6 +44,7 @@ #include "qxlibintegration.h" #include "qxlibscreen.h" #include "qxlibwindow.h" +#include "qxlibdisplay.h" #include <QtGui/QBitmap> @@ -121,11 +122,11 @@ Cursor QXlibCursor::createCursorBitmap(QCursor * cursor) memcpy(maskBits + (destLineSize * i),mask + (bytesPerLine * i), destLineSize); } - Pixmap cp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, mapBits, width, height); - Pixmap mp = XCreateBitmapFromData(testLiteScreen()->display(), rootwin, maskBits, width, height); - Cursor c = XCreatePixmapCursor(testLiteScreen()->display(), cp, mp, &fg, &bg, spot.x(), spot.y()); - XFreePixmap(testLiteScreen()->display(), cp); - XFreePixmap(testLiteScreen()->display(), mp); + Pixmap cp = XCreateBitmapFromData(testLiteScreen()->display()->nativeDisplay(), rootwin, mapBits, width, height); + Pixmap mp = XCreateBitmapFromData(testLiteScreen()->display()->nativeDisplay(), rootwin, maskBits, width, height); + Cursor c = XCreatePixmapCursor(testLiteScreen()->display()->nativeDisplay(), cp, mp, &fg, &bg, spot.x(), spot.y()); + XFreePixmap(testLiteScreen()->display()->nativeDisplay(), cp); + XFreePixmap(testLiteScreen()->display()->nativeDisplay(), mp); delete[] mapBits; delete[] maskBits; @@ -141,48 +142,48 @@ Cursor QXlibCursor::createCursorShape(int cshape) switch (cshape) { case Qt::ArrowCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_left_ptr); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_left_ptr); break; case Qt::UpArrowCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_center_ptr); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_center_ptr); break; case Qt::CrossCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_crosshair); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_crosshair); break; case Qt::WaitCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_watch); break; case Qt::IBeamCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_xterm); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_xterm); break; case Qt::SizeAllCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_fleur); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_fleur); break; case Qt::PointingHandCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_hand2); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_hand2); break; case Qt::SizeBDiagCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_top_right_corner); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_top_right_corner); break; case Qt::SizeFDiagCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_bottom_right_corner); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_bottom_right_corner); break; case Qt::SizeVerCursor: case Qt::SplitVCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_v_double_arrow); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_sb_v_double_arrow); break; case Qt::SizeHorCursor: case Qt::SplitHCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_sb_h_double_arrow); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_sb_h_double_arrow); break; case Qt::WhatsThisCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_question_arrow); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_question_arrow); break; case Qt::ForbiddenCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_circle); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_circle); break; case Qt::BusyCursor: - cursor = XCreateFontCursor(testLiteScreen()->display(), XC_watch); + cursor = XCreateFontCursor(testLiteScreen()->display()->nativeDisplay(), XC_watch); break; default: //default cursor for all the rest diff --git a/src/plugins/platforms/xlib/qxlibdisplay.cpp b/src/plugins/platforms/xlib/qxlibdisplay.cpp new file mode 100644 index 0000000..3b60af2 --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibdisplay.cpp @@ -0,0 +1,37 @@ +#include "qxlibdisplay.h" + +QXlibDisplay::QXlibDisplay(Display *display) + : mDisplay(display) +{ + if (!mDisplay) { + qFatal("Cannot connect to X server"); + } + mDisplayName = QString::fromLocal8Bit(DisplayString(mDisplay)); +} + +QXlibDisplay::~QXlibDisplay() +{ + XCloseDisplay(mDisplay); +} + +QString QXlibDisplay::displayName() const +{ + { return mDisplayName; } +} + + + +Display * QXlibDisplay::nativeDisplay() const +{ + return mDisplay; +} + +void QXlibDisplay::sync() const +{ + XSync(mDisplay, False); +} + +void QXlibDisplay::flush() const +{ + XFlush(mDisplay); +} diff --git a/src/plugins/platforms/xlib/qxlibdisplay.h b/src/plugins/platforms/xlib/qxlibdisplay.h new file mode 100644 index 0000000..f2cca9e --- /dev/null +++ b/src/plugins/platforms/xlib/qxlibdisplay.h @@ -0,0 +1,22 @@ +#ifndef QXLIBDISPLAY_H +#define QXLIBDISPLAY_H + +#include "qxlibintegration.h" + +class QXlibDisplay +{ +public: + QXlibDisplay(Display *display); + ~QXlibDisplay(); + QString displayName() const; + + Display *nativeDisplay() const; + + void sync() const; + void flush() const; +private: + Display *mDisplay; + QString mDisplayName; +}; + +#endif // QXLIBDISPLAY_H diff --git a/src/plugins/platforms/xlib/qxlibintegration.cpp b/src/plugins/platforms/xlib/qxlibintegration.cpp index 46eabbf..e3ebb13 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.cpp +++ b/src/plugins/platforms/xlib/qxlibintegration.cpp @@ -48,6 +48,7 @@ #include "qgenericunixfontdatabase.h" #include "qxlibscreen.h" #include "qxlibclipboard.h" +#include "qxlibdisplay.h" #if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) @@ -143,7 +144,7 @@ bool QXlibIntegration::hasOpenGL() const const QXlibScreen *screen = static_cast<const QXlibScreen *>(mScreens.at(0)); EGLint major, minor; eglBindAPI(EGL_OPENGL_ES_API); - EGLDisplay disp = eglGetDisplay(screen->display()); + EGLDisplay disp = eglGetDisplay(screen->display()->nativeDisplay()); wasEglInitialized = eglInitialize(disp,&major,&minor); } return wasEglInitialized; diff --git a/src/plugins/platforms/xlib/qxlibkeyboard.cpp b/src/plugins/platforms/xlib/qxlibkeyboard.cpp index a1e38b0..690d273 100644 --- a/src/plugins/platforms/xlib/qxlibkeyboard.cpp +++ b/src/plugins/platforms/xlib/qxlibkeyboard.cpp @@ -42,6 +42,7 @@ #include "qxlibkeyboard.h" #include "qxlibscreen.h" +#include "qxlibdisplay.h" #include <QtGui/QWindowSystemInterface> @@ -951,7 +952,7 @@ QXlibKeyboard::QXlibKeyboard(QXlibScreen *screen) void QXlibKeyboard::changeLayout() { - XkbDescPtr xkbDesc = XkbGetMap(m_screen->display(), XkbAllClientInfoMask, XkbUseCoreKbd); + XkbDescPtr xkbDesc = XkbGetMap(m_screen->display()->nativeDisplay(), XkbAllClientInfoMask, XkbUseCoreKbd); for (int i = xkbDesc->min_key_code; i < xkbDesc->max_key_code; ++i) { const uint mask = xkbDesc->map->modmap ? xkbDesc->map->modmap[i] : 0; if (mask == 0) { diff --git a/src/plugins/platforms/xlib/qxlibscreen.cpp b/src/plugins/platforms/xlib/qxlibscreen.cpp index ef04fb2..5a9aca9 100644 --- a/src/plugins/platforms/xlib/qxlibscreen.cpp +++ b/src/plugins/platforms/xlib/qxlibscreen.cpp @@ -46,6 +46,7 @@ #include "qxlibkeyboard.h" #include "qxlibstatic.h" #include "qxlibclipboard.h" +#include "qxlibdisplay.h" #include <QtCore/QDebug> #include <QtCore/QSocketNotifier> @@ -192,36 +193,32 @@ QXlibScreen::QXlibScreen() : mFormat(QImage::Format_RGB32) { char *display_name = getenv("DISPLAY"); - mDisplay = XOpenDisplay(display_name); - mDisplayName = QString::fromLocal8Bit(display_name); - if (!mDisplay) { - fprintf(stderr, "Cannot connect to X server: %s\n", - display_name); - exit(1); - } + Display *display = XOpenDisplay(display_name); + mDisplay = new QXlibDisplay(display); + #ifndef DONT_USE_MIT_SHM - Status MIT_SHM_extension_supported = XShmQueryExtension (mDisplay); + Status MIT_SHM_extension_supported = XShmQueryExtension (mDisplay->nativeDisplay()); Q_ASSERT(MIT_SHM_extension_supported == True); #endif original_x_errhandler = XSetErrorHandler(qt_x_errhandler); if (qgetenv("DO_X_SYNCHRONIZE").toInt()) - XSynchronize(mDisplay, true); + XSynchronize(mDisplay->nativeDisplay(), true); - mScreen = DefaultScreen(mDisplay); - XSelectInput(mDisplay,rootWindow(), KeymapStateMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask); - int width = DisplayWidth(mDisplay, mScreen); - int height = DisplayHeight(mDisplay, mScreen); + mScreen = DefaultScreen(mDisplay->nativeDisplay()); + XSelectInput(mDisplay->nativeDisplay(),rootWindow(), KeymapStateMask | EnterWindowMask | LeaveWindowMask | PropertyChangeMask); + int width = DisplayWidth(mDisplay->nativeDisplay(), mScreen); + int height = DisplayHeight(mDisplay->nativeDisplay(), mScreen); mGeometry = QRect(0,0,width,height); - int physicalWidth = DisplayWidthMM(mDisplay, mScreen); - int physicalHeight = DisplayHeightMM(mDisplay, mScreen); + int physicalWidth = DisplayWidthMM(mDisplay->nativeDisplay(), mScreen); + int physicalHeight = DisplayHeightMM(mDisplay->nativeDisplay(), mScreen); mPhysicalSize = QSize(physicalWidth,physicalHeight); - int xSocketNumber = XConnectionNumber(mDisplay); + int xSocketNumber = XConnectionNumber(mDisplay->nativeDisplay()); - mDepth = DefaultDepth(mDisplay,mScreen); + mDepth = DefaultDepth(mDisplay->nativeDisplay(),mScreen); #ifdef MYX11_DEBUG qDebug() << "X socket:"<< xSocketNumber; #endif @@ -235,7 +232,22 @@ QXlibScreen::QXlibScreen() QXlibScreen::~QXlibScreen() { delete mCursor; - XCloseDisplay(mDisplay); + delete mDisplay; +} + +Window QXlibScreen::rootWindow() +{ + return RootWindow(mDisplay->nativeDisplay(), mScreen); +} + +unsigned long QXlibScreen::blackPixel() +{ + return BlackPixel(mDisplay->nativeDisplay(), mScreen); +} + +unsigned long QXlibScreen::whitePixel() +{ + return WhitePixel(mDisplay->nativeDisplay(), mScreen); } #ifdef KeyPress @@ -358,15 +370,15 @@ bool QXlibScreen::waitForClipboardEvent(Window win, int type, XEvent *event, int QElapsedTimer timer; timer.start(); do { - if (XCheckTypedWindowEvent(mDisplay,win,type,event)) + if (XCheckTypedWindowEvent(mDisplay->nativeDisplay(),win,type,event)) return true; // process other clipboard events, since someone is probably requesting data from us XEvent e; - if (XCheckIfEvent(mDisplay, &e, checkForClipboardEvents, 0)) + if (XCheckIfEvent(mDisplay->nativeDisplay(), &e, checkForClipboardEvents, 0)) handleEvent(&e); - XFlush(mDisplay); + mDisplay->flush(); // sleep 50 ms, so we don't use up CPU cycles all the time. struct timeval usleep_tv; @@ -379,11 +391,11 @@ bool QXlibScreen::waitForClipboardEvent(Window win, int type, XEvent *event, int void QXlibScreen::eventDispatcher() { - ulong marker = XNextRequest(mDisplay); + ulong marker = XNextRequest(mDisplay->nativeDisplay()); // int i = 0; - while (XPending(mDisplay)) { + while (XPending(mDisplay->nativeDisplay())) { XEvent event; - XNextEvent(mDisplay, &event); + XNextEvent(mDisplay->nativeDisplay(), &event); /* done = */ handleEvent(&event); @@ -392,7 +404,7 @@ void QXlibScreen::eventDispatcher() qDebug() << "potential livelock averted"; #endif #if 0 - if (XEventsQueued(mDisplay, QueuedAfterFlush)) { + if (XEventsQueued(mDisplay->nativeDisplay(), QueuedAfterFlush)) { qDebug() << " with events queued"; QTimer::singleShot(0, this, SLOT(eventDispatcher())); } @@ -412,7 +424,7 @@ QImage QXlibScreen::grabWindow(Window window, int x, int y, int w, int h) window = rootWindow(); XWindowAttributes window_attr; - if (!XGetWindowAttributes(mDisplay, window, &window_attr)) + if (!XGetWindowAttributes(mDisplay->nativeDisplay(), window, &window_attr)) return QImage(); if (w < 0) @@ -424,7 +436,7 @@ QImage QXlibScreen::grabWindow(Window window, int x, int y, int w, int h) // that it's "unsafe" to go outside the screen, so we can ignore that problem. //We're definitely not optimizing for speed... - XImage *xi = XGetImage(mDisplay, window, x, y, w, h, AllPlanes, ZPixmap); + XImage *xi = XGetImage(mDisplay->nativeDisplay(), window, x, y, w, h, AllPlanes, ZPixmap); if (!xi) return QImage(); @@ -443,7 +455,7 @@ QXlibScreen * QXlibScreen::testLiteScreenForWidget(QWidget *widget) return static_cast<QXlibScreen *>(platformScreen); } -Display * QXlibScreen::display() const +QXlibDisplay * QXlibScreen::display() const { return mDisplay; } @@ -453,6 +465,11 @@ int QXlibScreen::xScreenNumber() const return mScreen; } +Visual * QXlibScreen::defaultVisual() const +{ + DefaultVisual(display()->nativeDisplay(), xScreenNumber()); +} + QXlibKeyboard * QXlibScreen::keyboard() const { return mKeyboard; diff --git a/src/plugins/platforms/xlib/qxlibscreen.h b/src/plugins/platforms/xlib/qxlibscreen.h index c8043fb..8dac41d 100644 --- a/src/plugins/platforms/xlib/qxlibscreen.h +++ b/src/plugins/platforms/xlib/qxlibscreen.h @@ -49,6 +49,7 @@ QT_BEGIN_NAMESPACE class QXlibCursor; class QXlibKeyboard; +class QXlibDisplay; class QXlibScreen : public QPlatformScreen { @@ -58,16 +59,14 @@ public: ~QXlibScreen(); - QString displayName() const { return mDisplayName; } - QRect geometry() const { return mGeometry; } int depth() const { return mDepth; } QImage::Format format() const { return mFormat; } QSize physicalSize() const { return mPhysicalSize; } - Window rootWindow() { return RootWindow(mDisplay, mScreen); } - unsigned long blackPixel() { return BlackPixel(mDisplay, mScreen); } - unsigned long whitePixel() { return WhitePixel(mDisplay, mScreen); } + Window rootWindow(); + unsigned long blackPixel(); + unsigned long whitePixel(); bool handleEvent(XEvent *xe); bool waitForClipboardEvent(Window win, int type, XEvent *event, int timeout); @@ -76,9 +75,11 @@ public: static QXlibScreen *testLiteScreenForWidget(QWidget *widget); - Display *display() const; + QXlibDisplay *display() const; int xScreenNumber() const; + Visual *defaultVisual() const; + QXlibKeyboard *keyboard() const; public slots: @@ -87,7 +88,6 @@ public slots: private: void handleSelectionRequest(XEvent *event); - QString mDisplayName; QRect mGeometry; QSize mPhysicalSize; int mDepth; @@ -95,7 +95,7 @@ private: QXlibCursor *mCursor; QXlibKeyboard *mKeyboard; - Display * mDisplay; + QXlibDisplay * mDisplay; int mScreen; }; diff --git a/src/plugins/platforms/xlib/qxlibstatic.cpp b/src/plugins/platforms/xlib/qxlibstatic.cpp index 3ce5768..f67fbdc 100644 --- a/src/plugins/platforms/xlib/qxlibstatic.cpp +++ b/src/plugins/platforms/xlib/qxlibstatic.cpp @@ -41,6 +41,7 @@ #include "qxlibstatic.h" #include "qxlibscreen.h" +#include "qxlibdisplay.h" #include <qplatformdefs.h> @@ -366,7 +367,7 @@ private: Q_ASSERT(i == QXlibStatic::NPredefinedAtoms); QByteArray settings_atom_name("_QT_SETTINGS_TIMESTAMP_"); - settings_atom_name += XDisplayName(qPrintable(screen->displayName())); + settings_atom_name += XDisplayName(qPrintable(screen->display()->displayName())); names[i++] = settings_atom_name; Q_ASSERT(i == QXlibStatic::NAtoms); @@ -374,7 +375,7 @@ private: XInternAtoms(screen->display(), (char **)names, i, False, m_allAtoms); #else for (i = 0; i < QXlibStatic::NAtoms; ++i) - m_allAtoms[i] = XInternAtom(screen->display(), (char *)names[i], False); + m_allAtoms[i] = XInternAtom(screen->display()->nativeDisplay(), (char *)names[i], False); #endif } @@ -386,7 +387,7 @@ private: unsigned long nitems, after; unsigned char *data = 0; - int e = XGetWindowProperty(screen->display(), screen->rootWindow(), + int e = XGetWindowProperty(screen->display()->nativeDisplay(), screen->rootWindow(), this->atom(QXlibStatic::_NET_SUPPORTED), 0, 0, False, XA_ATOM, &type, &format, &nitems, &after, &data); if (data) @@ -397,7 +398,7 @@ private: ts.open(QIODevice::WriteOnly); while (after > 0) { - XGetWindowProperty(screen->display(), screen->rootWindow(), + XGetWindowProperty(screen->display()->nativeDisplay(), screen->rootWindow(), this->atom(QXlibStatic::_NET_SUPPORTED), offset, 1024, False, XA_ATOM, &type, &format, &nitems, &after, &data); @@ -427,7 +428,7 @@ private: { #ifndef QT_NO_XFIXES // See if Xfixes is supported on the connected display - if (XQueryExtension(screen->display(), "XFIXES", &xfixes_major, + if (XQueryExtension(screen->display()->nativeDisplay(), "XFIXES", &xfixes_major, &xfixes_eventbase, &xfixes_errorbase)) { ptrXFixesQueryExtension = XFIXES_LOAD_V1(XFixesQueryExtension); ptrXFixesQueryVersion = XFIXES_LOAD_V1(XFixesQueryVersion); @@ -435,7 +436,7 @@ private: ptrXFixesSelectSelectionInput = XFIXES_LOAD_V2(XFixesSelectSelectionInput); if(ptrXFixesQueryExtension && ptrXFixesQueryVersion - && ptrXFixesQueryExtension(screen->display(), &xfixes_eventbase, + && ptrXFixesQueryExtension(screen->display()->nativeDisplay(), &xfixes_eventbase, &xfixes_errorbase)) { // Xfixes is supported. // Note: the XFixes protocol version is negotiated using QueryVersion. @@ -446,7 +447,7 @@ private: // X server when it receives an XFixes request is undefined. int major = 3; int minor = 0; - ptrXFixesQueryVersion(screen->display(), &major, &minor); + ptrXFixesQueryVersion(screen->display()->nativeDisplay(), &major, &minor); use_xfixes = (major >= 1); xfixes_major = major; } diff --git a/src/plugins/platforms/xlib/qxlibwindow.cpp b/src/plugins/platforms/xlib/qxlibwindow.cpp index ddd4002..90b36cf 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.cpp +++ b/src/plugins/platforms/xlib/qxlibwindow.cpp @@ -45,6 +45,7 @@ #include "qxlibscreen.h" #include "qxlibkeyboard.h" #include "qxlibstatic.h" +#include "qxlibdisplay.h" #include <QtGui/QWindowSystemInterface> #include <QSocketNotifier> @@ -86,9 +87,9 @@ QXlibWindow::QXlibWindow(QWidget *window) #else QPlatformWindowFormat windowFormat = correctColorBuffers(window->platformWindowFormat()); - EGLDisplay eglDisplay = eglGetDisplay(mScreen->display()); + EGLDisplay eglDisplay = eglGetDisplay(mScreen->display()->nativeDisplay()); EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,windowFormat); - VisualID id = QXlibEglIntegration::getCompatibleVisualId(mScreen->display(),eglConfig); + VisualID id = QXlibEglIntegration::getCompatibleVisualId(mScreen->display()->nativeDisplay(),eglConfig); XVisualInfo visualInfoTemplate; memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); @@ -96,14 +97,14 @@ QXlibWindow::QXlibWindow(QWidget *window) XVisualInfo *visualInfo; int matchingCount = 0; - visualInfo = XGetVisualInfo(mScreen->display(), VisualIDMask, &visualInfoTemplate, &matchingCount); + visualInfo = XGetVisualInfo(mScreen->display()->nativeDisplay(), VisualIDMask, &visualInfoTemplate, &matchingCount); #endif //!defined(QT_OPENGL_ES_2) if (visualInfo) { - Colormap cmap = XCreateColormap(mScreen->display(),mScreen->rootWindow(),visualInfo->visual,AllocNone); + Colormap cmap = XCreateColormap(mScreen->display()->nativeDisplay(),mScreen->rootWindow(),visualInfo->visual,AllocNone); XSetWindowAttributes a; a.colormap = cmap; - x_window = XCreateWindow(mScreen->display(), mScreen->rootWindow(),x, y, w, h, + x_window = XCreateWindow(mScreen->display()->nativeDisplay(), mScreen->rootWindow(),x, y, w, h, 0, visualInfo->depth, InputOutput, visualInfo->visual, CWColormap, &a); } else { @@ -111,7 +112,7 @@ QXlibWindow::QXlibWindow(QWidget *window) } #endif //!defined(QT_NO_OPENGL) } else { - x_window = XCreateSimpleWindow(mScreen->display(), mScreen->rootWindow(), + x_window = XCreateSimpleWindow(mScreen->display()->nativeDisplay(), mScreen->rootWindow(), x, y, w, h, 0 /*border_width*/, mScreen->blackPixel(), mScreen->whitePixel()); } @@ -120,9 +121,9 @@ QXlibWindow::QXlibWindow(QWidget *window) qDebug() << "QTestLiteWindow::QTestLiteWindow creating" << hex << x_window << window; #endif - XSetWindowBackgroundPixmap(mScreen->display(), x_window, XNone); + XSetWindowBackgroundPixmap(mScreen->display()->nativeDisplay(), x_window, XNone); - XSelectInput(mScreen->display(), x_window, + XSelectInput(mScreen->display()->nativeDisplay(), x_window, ExposureMask | KeyPressMask | KeyReleaseMask | EnterWindowMask | LeaveWindowMask | FocusChangeMask | PointerMotionMask | ButtonPressMask | ButtonReleaseMask | @@ -141,7 +142,7 @@ QXlibWindow::QXlibWindow(QWidget *window) #endif // QT_NO_XSYNC if (window->windowFlags() & Qt::WindowContextHelpButtonHint) protocols[n++] = QXlibStatic::atom(QXlibStatic::_NET_WM_CONTEXT_HELP); - XSetWMProtocols(mScreen->display(), x_window, protocols, n); + XSetWMProtocols(mScreen->display()->nativeDisplay(), x_window, protocols, n); } @@ -152,8 +153,8 @@ QXlibWindow::~QXlibWindow() qDebug() << "~QTestLiteWindow" << hex << x_window; #endif delete mGLContext; - XFreeGC(mScreen->display(), gc); - XDestroyWindow(mScreen->display(), x_window); + XFreeGC(mScreen->display()->nativeDisplay(), gc); + XDestroyWindow(mScreen->display()->nativeDisplay(), x_window); } //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -245,7 +246,7 @@ void QXlibWindow::handleFocusOutEvent() void QXlibWindow::setGeometry(const QRect &rect) { - XMoveResizeWindow(mScreen->display(), x_window, rect.x(), rect.y(), rect.width(), rect.height()); + XMoveResizeWindow(mScreen->display()->nativeDisplay(), x_window, rect.x(), rect.y(), rect.width(), rect.height()); QPlatformWindow::setGeometry(rect); } @@ -263,17 +264,17 @@ WId QXlibWindow::winId() const void QXlibWindow::setParent(const QPlatformWindow *window) { QPoint topLeft = geometry().topLeft(); - XReparentWindow(mScreen->display(),x_window,window->winId(),topLeft.x(),topLeft.y()); + XReparentWindow(mScreen->display()->nativeDisplay(),x_window,window->winId(),topLeft.x(),topLeft.y()); } void QXlibWindow::raise() { - XRaiseWindow(mScreen->display(), x_window); + XRaiseWindow(mScreen->display()->nativeDisplay(), x_window); } void QXlibWindow::lower() { - XLowerWindow(mScreen->display(), x_window); + XLowerWindow(mScreen->display()->nativeDisplay(), x_window); } void QXlibWindow::setWindowTitle(const QString &title) @@ -285,14 +286,14 @@ void QXlibWindow::setWindowTitle(const QString &title) windowName.format = 8; windowName.nitems = ba.length(); - XSetWMName(mScreen->display(), x_window, &windowName); + XSetWMName(mScreen->display()->nativeDisplay(), x_window, &windowName); } GC QXlibWindow::createGC() { GC gc; - gc = XCreateGC(mScreen->display(), x_window, 0, 0); + gc = XCreateGC(mScreen->display()->nativeDisplay(), x_window, 0, 0); if (gc < 0) { qWarning("QTestLiteWindow::createGC() could not create GC"); } @@ -311,7 +312,7 @@ void QXlibWindow::paintEvent() void QXlibWindow::requestActivateWindow() { - XSetInputFocus(mScreen->display(), x_window, XRevertToParent, CurrentTime); + XSetInputFocus(mScreen->display()->nativeDisplay(), x_window, XRevertToParent, CurrentTime); } void QXlibWindow::resizeEvent(XConfigureEvent *e) @@ -365,7 +366,7 @@ QXlibMWMHints QXlibWindow::getMWMHints() const ulong nitems, bytesLeft; uchar *data = 0; Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); - if ((XGetWindowProperty(mScreen->display(), x_window, atomForMotifWmHints, 0, 5, false, + if ((XGetWindowProperty(mScreen->display()->nativeDisplay(), x_window, atomForMotifWmHints, 0, 5, false, atomForMotifWmHints, &type, &format, &nitems, &bytesLeft, &data) == Success) && (type == atomForMotifWmHints @@ -390,11 +391,11 @@ void QXlibWindow::setMWMHints(const QXlibMWMHints &mwmhints) { Atom atomForMotifWmHints = QXlibStatic::atom(QXlibStatic::_MOTIF_WM_HINTS); if (mwmhints.flags != 0l) { - XChangeProperty(mScreen->display(), x_window, + XChangeProperty(mScreen->display()->nativeDisplay(), x_window, atomForMotifWmHints, atomForMotifWmHints, 32, PropModeReplace, (unsigned char *) &mwmhints, 5); } else { - XDeleteProperty(mScreen->display(), x_window, atomForMotifWmHints); + XDeleteProperty(mScreen->display()->nativeDisplay(), x_window, atomForMotifWmHints); } } @@ -421,7 +422,7 @@ QVector<Atom> QXlibWindow::getNetWmState() const ulong propertyLength; ulong bytesLeft; uchar *propertyData = 0; - if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, 0, + if (XGetWindowProperty(mScreen->display()->nativeDisplay(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, 0, False, XA_ATOM, &actualType, &actualFormat, &propertyLength, &bytesLeft, &propertyData) == Success && actualType == XA_ATOM && actualFormat == 32) { @@ -429,7 +430,7 @@ QVector<Atom> QXlibWindow::getNetWmState() const XFree((char*) propertyData); // fetch all data - if (XGetWindowProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, + if (XGetWindowProperty(mScreen->display()->nativeDisplay(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), 0, returnValue.size(), False, XA_ATOM, &actualType, &actualFormat, &propertyLength, &bytesLeft, &propertyData) != Success) { returnValue.clear(); @@ -591,11 +592,11 @@ Qt::WindowFlags QXlibWindow::setWindowFlags(Qt::WindowFlags flags) } if (!netWmState.isEmpty()) { - XChangeProperty(mScreen->display(), x_window, + XChangeProperty(mScreen->display()->nativeDisplay(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE), XA_ATOM, 32, PropModeReplace, (unsigned char *) netWmState.data(), netWmState.size()); } else { - XDeleteProperty(mScreen->display(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE)); + XDeleteProperty(mScreen->display()->nativeDisplay(), x_window, QXlibStatic::atom(QXlibStatic::_NET_WM_STATE)); } //##### only if initializeWindow??? @@ -609,7 +610,7 @@ Qt::WindowFlags QXlibWindow::setWindowFlags(Qt::WindowFlags flags) wsa.override_redirect = True; wsa.save_under = True; - XChangeWindowAttributes(mScreen->display(), x_window, CWOverrideRedirect | CWSaveUnder, + XChangeWindowAttributes(mScreen->display()->nativeDisplay(), x_window, CWOverrideRedirect | CWSaveUnder, &wsa); } else { #ifdef MYX11_DEBUG @@ -634,22 +635,22 @@ void QXlibWindow::setVisible(bool visible) parentXWindow = parentWidnow->x_window; } } - XSetTransientForHint(mScreen->display(),x_window,parentXWindow); + XSetTransientForHint(mScreen->display()->nativeDisplay(),x_window,parentXWindow); } if (visible) { //ensure that the window is viewed in correct position. doSizeHints(); - XMapWindow(mScreen->display(), x_window); + XMapWindow(mScreen->display()->nativeDisplay(), x_window); } else { - XUnmapWindow(mScreen->display(), x_window); + XUnmapWindow(mScreen->display()->nativeDisplay(), x_window); } } void QXlibWindow::setCursor(const Cursor &cursor) { - XDefineCursor(mScreen->display(), x_window, cursor); - XFlush(mScreen->display()); + XDefineCursor(mScreen->display()->nativeDisplay(), x_window, cursor); + mScreen->display()->flush(); } QPlatformGLContext *QXlibWindow::glContext() const @@ -662,7 +663,7 @@ QPlatformGLContext *QXlibWindow::glContext() const #if !defined(QT_OPENGL_ES_2) that->mGLContext = new QGLXContext(x_window, mScreen,widget()->platformWindowFormat()); #else - EGLDisplay display = eglGetDisplay(mScreen->display()); + EGLDisplay display = eglGetDisplay(mScreen->display()->nativeDisplay()); QPlatformWindowFormat windowFormat = correctColorBuffers(widget()->platformWindowFormat()); @@ -706,7 +707,7 @@ void QXlibWindow::doSizeHints() s.flags |= PSize; s.flags |= PWinGravity; s.win_gravity = QApplication::isRightToLeft() ? NorthEastGravity : NorthWestGravity; - XSetWMNormalHints(mScreen->display(), x_window, &s); + XSetWMNormalHints(mScreen->display()->nativeDisplay(), x_window, &s); } QPlatformWindowFormat QXlibWindow::correctColorBuffers(const QPlatformWindowFormat &platformWindowFormat) const diff --git a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp index 92e1793..fa1e197 100644 --- a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp +++ b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp @@ -47,6 +47,7 @@ #include "qxlibwindow.h" #include "qxlibscreen.h" +#include "qxlibdisplay.h" # include <sys/ipc.h> # include <sys/shm.h> @@ -88,12 +89,11 @@ void QXlibWindowSurface::resizeShmImage(int width, int height) if (image_info) image_info->destroy(); else - image_info = new QXlibShmImageInfo(screen->display()); + image_info = new QXlibShmImageInfo(screen->display()->nativeDisplay()); - Visual *visual = DefaultVisual(screen->display(), screen->xScreenNumber()); + Visual *visual = screen->defaultVisual(); - - XImage *image = XShmCreateImage (screen->display(), visual, 24, ZPixmap, 0, + XImage *image = XShmCreateImage (screen->display()->nativeDisplay(), visual, 24, ZPixmap, 0, &image_info->shminfo, width, height); @@ -105,7 +105,7 @@ void QXlibWindowSurface::resizeShmImage(int width, int height) image_info->image = image; - Status shm_attach_status = XShmAttach(screen->display(), &image_info->shminfo); + Status shm_attach_status = XShmAttach(screen->display()->nativeDisplay(), &image_info->shminfo); Q_ASSERT(shm_attach_status == True); @@ -185,11 +185,11 @@ void QXlibWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPo // We could set send_event to true, and then use the ShmCompletion to synchronize, // but let's do like Qt/11 and just use XSync - XShmPutImage (screen->display(), window, gc, image_info->image, 0, 0, + XShmPutImage (screen->display()->nativeDisplay(), window, gc, image_info->image, 0, 0, x, y, image_info->image->width, image_info->image->height, /*send_event*/ False); - XSync(screen->display(), False); + screen->display()->sync(); } #endif } diff --git a/src/plugins/platforms/xlib/xlib.pro b/src/plugins/platforms/xlib/xlib.pro index 999621b..dc22b80 100644 --- a/src/plugins/platforms/xlib/xlib.pro +++ b/src/plugins/platforms/xlib/xlib.pro @@ -13,7 +13,8 @@ SOURCES = \ qxlibkeyboard.cpp \ qxlibclipboard.cpp \ qxlibmime.cpp \ - qxlibstatic.cpp + qxlibstatic.cpp \ + qxlibdisplay.cpp HEADERS = \ qxlibintegration.h \ @@ -24,7 +25,8 @@ HEADERS = \ qxlibkeyboard.h \ qxlibclipboard.h \ qxlibmime.h \ - qxlibstatic.h + qxlibstatic.h \ + qxlibdisplay.h LIBS += -lX11 -lXext -- cgit v0.12 From 7629130b24c01d406f5dee8e6600538db666cfa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Thu, 24 Feb 2011 17:43:52 +0100 Subject: Lighthouse: Adding EGL support to the xcb plugin --- .../eglconvenience/qxlibeglintegration.cpp | 186 +++++++++++++++++++++ .../platforms/eglconvenience/qxlibeglintegration.h | 53 ++++++ src/plugins/platforms/xcb/qxcbconnection.cpp | 6 +- src/plugins/platforms/xcb/qxcbconnection.h | 4 +- src/plugins/platforms/xcb/qxcbintegration.cpp | 18 +- src/plugins/platforms/xcb/qxcbwindow.cpp | 53 ++++-- src/plugins/platforms/xcb/qxcbwindow.h | 6 +- src/plugins/platforms/xcb/xcb.pro | 27 ++- src/plugins/platforms/xlib/qxlibeglintegration.cpp | 186 --------------------- src/plugins/platforms/xlib/qxlibeglintegration.h | 54 ------ src/plugins/platforms/xlib/qxlibwindow.cpp | 2 +- src/plugins/platforms/xlib/xlib.pro | 4 +- 12 files changed, 328 insertions(+), 271 deletions(-) create mode 100644 src/plugins/platforms/eglconvenience/qxlibeglintegration.cpp create mode 100644 src/plugins/platforms/eglconvenience/qxlibeglintegration.h delete mode 100644 src/plugins/platforms/xlib/qxlibeglintegration.cpp delete mode 100644 src/plugins/platforms/xlib/qxlibeglintegration.h diff --git a/src/plugins/platforms/eglconvenience/qxlibeglintegration.cpp b/src/plugins/platforms/eglconvenience/qxlibeglintegration.cpp new file mode 100644 index 0000000..1135d2f --- /dev/null +++ b/src/plugins/platforms/eglconvenience/qxlibeglintegration.cpp @@ -0,0 +1,186 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qxlibeglintegration.h" + +static int countBits(unsigned long mask) +{ + int count = 0; + while (mask != 0) { + if (mask & 1) + ++count; + mask >>= 1; + } + return count; +} + +VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLConfig config) +{ + VisualID visualId = 0; + EGLint eglValue = 0; + + EGLDisplay eglDisplay = eglGetDisplay(display); + + EGLint configRedSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_RED_SIZE, &configRedSize); + + EGLint configGreenSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_GREEN_SIZE, &configGreenSize); + + EGLint configBlueSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_BLUE_SIZE, &configBlueSize); + + EGLint configAlphaSize = 0; + eglGetConfigAttrib(eglDisplay, config, EGL_ALPHA_SIZE, &configAlphaSize); + + eglGetConfigAttrib(eglDisplay, config, EGL_CONFIG_ID, &eglValue); + int configId = eglValue; + + // See if EGL provided a valid VisualID: + eglGetConfigAttrib(eglDisplay, config, EGL_NATIVE_VISUAL_ID, &eglValue); + visualId = (VisualID)eglValue; + if (visualId) { + // EGL has suggested a visual id, so get the rest of the visual info for that id: + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + visualInfoTemplate.visualid = visualId; + + XVisualInfo *chosenVisualInfo; + int matchingCount = 0; + chosenVisualInfo = XGetVisualInfo(display, VisualIDMask, &visualInfoTemplate, &matchingCount); + if (chosenVisualInfo) { + // Skip size checks if implementation supports non-matching visual + // and config (http://bugreports.qt.nokia.com/browse/QTBUG-9444). + if (q_hasEglExtension(eglDisplay,"EGL_NV_post_convert_rounding")) { + XFree(chosenVisualInfo); + return visualId; + } + + int visualRedSize = countBits(chosenVisualInfo->red_mask); + int visualGreenSize = countBits(chosenVisualInfo->green_mask); + int visualBlueSize = countBits(chosenVisualInfo->blue_mask); + int visualAlphaSize = -1; // Need XRender to tell us the alpha channel size + + bool visualMatchesConfig = false; + if ( visualRedSize == configRedSize && + visualGreenSize == configGreenSize && + visualBlueSize == configBlueSize ) + { + // We need XRender to check the alpha channel size of the visual. If we don't have + // the alpha size, we don't check it against the EGL config's alpha size. + if (visualAlphaSize >= 0) + visualMatchesConfig = visualAlphaSize == configAlphaSize; + else + visualMatchesConfig = true; + } + + if (!visualMatchesConfig) { + if (visualAlphaSize >= 0) { + qWarning("Warning: EGL suggested using X Visual ID %d (ARGB%d%d%d%d) for EGL config %d (ARGB%d%d%d%d), but this is incompatable", + (int)visualId, visualAlphaSize, visualRedSize, visualGreenSize, visualBlueSize, + configId, configAlphaSize, configRedSize, configGreenSize, configBlueSize); + } else { + qWarning("Warning: EGL suggested using X Visual ID %d (RGB%d%d%d) for EGL config %d (RGB%d%d%d), but this is incompatable", + (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, + configId, configRedSize, configGreenSize, configBlueSize); + } + visualId = 0; + } + } else { + qWarning("Warning: EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", + (int)visualId, configId); + visualId = 0; + } + XFree(chosenVisualInfo); + } +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + else + qDebug("EGL did not suggest a VisualID (EGL_NATIVE_VISUAL_ID was zero) for EGLConfig %d", configId); +#endif + + if (visualId) { +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + if (configAlphaSize > 0) + qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, configId); + else + qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId); +#endif + return visualId; + } + + // Finally, try to + // use XGetVisualInfo and only use the bit depths to match on: + if (!visualId) { + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + XVisualInfo *matchingVisuals; + int matchingCount = 0; + + visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize + configAlphaSize; + matchingVisuals = XGetVisualInfo(display, + VisualDepthMask, + &visualInfoTemplate, + &matchingCount); + if (!matchingVisuals) { + // Try again without taking the alpha channel into account: + visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize; + matchingVisuals = XGetVisualInfo(display, + VisualDepthMask, + &visualInfoTemplate, + &matchingCount); + } + + if (matchingVisuals) { + visualId = matchingVisuals[0].visualid; + XFree(matchingVisuals); + } + } + + if (visualId) { +#ifdef QT_DEBUG_X11_VISUAL_SELECTION + qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, configId); +#endif + return visualId; + } + + qWarning("Unable to find an X11 visual which matches EGL config %d", configId); + return (VisualID)0; +} diff --git a/src/plugins/platforms/eglconvenience/qxlibeglintegration.h b/src/plugins/platforms/eglconvenience/qxlibeglintegration.h new file mode 100644 index 0000000..f62dce4 --- /dev/null +++ b/src/plugins/platforms/eglconvenience/qxlibeglintegration.h @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtOpenVG module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QTESTLITEEGLINTEGRATION_H +#define QTESTLITEEGLINTEGRATION_H + +#include "qeglconvenience.h" + +class QXlibEglIntegration +{ +public: + static VisualID getCompatibleVisualId(Display *display, EGLConfig config); +}; + +#endif // QTESTLITEEGLINTEGRATION_H diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 0696ed3..967aa4d 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -49,7 +49,7 @@ #include <stdio.h> -#ifdef XCB_USE_XLIB_FOR_GLX +#ifdef XCB_USE_XLIB #include <X11/Xlib.h> #include <X11/Xlib-xcb.h> #endif @@ -59,7 +59,7 @@ QXcbConnection::QXcbConnection(const char *displayName) { int primaryScreen = 0; -#ifdef XCB_USE_XLIB_FOR_GLX +#ifdef XCB_USE_XLIB Display *dpy = XOpenDisplay(m_displayName.constData()); primaryScreen = DefaultScreen(dpy); m_connection = XGetXCBConnection(dpy); @@ -91,7 +91,7 @@ QXcbConnection::~QXcbConnection() { qDeleteAll(m_screens); -#ifdef XCB_USE_XLIB_FOR_GLX +#ifdef XCB_USE_XLIB XCloseDisplay((Display *)m_xlib_display); #else xcb_disconnect(xcb_connection()); diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 8a225c2..6a472a7 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -232,7 +232,7 @@ public: QXcbKeyboard *keyboard() const { return m_keyboard; } -#ifdef XCB_USE_XLIB_FOR_GLX +#ifdef XCB_USE_XLIB void *xlib_display() const { return m_xlib_display; } #endif @@ -254,7 +254,7 @@ private: QXcbKeyboard *m_keyboard; -#ifdef XCB_USE_XLIB_FOR_GLX +#ifdef XCB_USE_XLIB void *m_xlib_display; #endif }; diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 89a6154..6dc5a5c 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -53,6 +53,10 @@ #include <stdio.h> +#ifdef XCB_USE_EGL +#include <EGL/egl.h> +#endif + QXcbIntegration::QXcbIntegration() : m_connection(new QXcbConnection) { @@ -118,8 +122,20 @@ QPixmap QXcbIntegration::grabWindow(WId window, int x, int y, int width, int hei bool QXcbIntegration::hasOpenGL() const { -#ifdef XCB_USE_XLIB_FOR_GLX +#if defined(XCB_USE_GLX) return true; +#elif defined(XCB_USE_EGL) + static bool eglHasbeenInitialized = false; + static bool wasEglInitialized = false; + if (!eglHasbeenInitialized) { + eglHasbeenInitialized = true; + const QXcbScreen *screen = static_cast<const QXcbScreen *>(m_screens.at(0)); + EGLint major, minor; + eglBindAPI(EGL_OPENGL_ES_API); + EGLDisplay disp = eglGetDisplay((Display*)screen->connection()->xlib_display()); + wasEglInitialized = eglInitialize(disp,&major,&minor); + } + return wasEglInitialized; #else return false; #endif diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 78cba1c..bb856f2 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -53,10 +53,17 @@ #include <stdio.h> -#ifdef XCB_USE_XLIB_FOR_GLX +#ifdef XCB_USE_XLIB #include <X11/Xlib.h> #include <X11/Xutil.h> +#endif + +#if defined(XCB_USE_GLX) #include "qglxintegration.h" +#elif defined(XCB_USE_EGL) +#include "../eglconvenience/qeglplatformcontext.h" +#include "../eglconvenience/qeglconvenience.h" +#include "../eglconvenience/qxlibeglintegration.h" #endif // Returns true if we should set WM_TRANSIENT_FOR on \a w @@ -74,9 +81,7 @@ static inline bool isTransient(const QWidget *w) QXcbWindow::QXcbWindow(QWidget *tlw) : QPlatformWindow(tlw) -#ifdef XCB_USE_XLIB_FOR_GLX - , m_glx_context(0) -#endif + , m_context(0) { m_screen = static_cast<QXcbScreen *>(QPlatformScreen::platformScreenForWidget(tlw)); @@ -100,10 +105,24 @@ QXcbWindow::QXcbWindow(QWidget *tlw) | XCB_EVENT_MASK_FOCUS_CHANGE }; -#ifdef XCB_USE_XLIB_FOR_GLX +#if defined(XCB_USE_GLX) || defined(XCB_USE_EGL) if (tlw->platformWindowFormat().windowApi() == QPlatformWindowFormat::OpenGL && QApplicationPrivate::platformIntegration()->hasOpenGL() ) { +#if defined(XCB_USE_GLX) XVisualInfo *visualInfo = QGLXContext::findVisualInfo(m_screen, tlw->platformWindowFormat()); +#elif defined(XCB_USE_EGL) + EGLDisplay eglDisplay = eglGetDisplay(DISPLAY_FROM_XCB(this)); + EGLConfig eglConfig = q_configFromQPlatformWindowFormat(eglDisplay,tlw->platformWindowFormat(),true); + VisualID id = QXlibEglIntegration::getCompatibleVisualId(DISPLAY_FROM_XCB(this),eglConfig); + + XVisualInfo visualInfoTemplate; + memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); + visualInfoTemplate.visualid = id; + + XVisualInfo *visualInfo; + int matchingCount = 0; + visualInfo = XGetVisualInfo(DISPLAY_FROM_XCB(this), VisualIDMask, &visualInfoTemplate, &matchingCount); +#endif //XCB_USE_GLX if (visualInfo) { Colormap cmap = XCreateColormap(DISPLAY_FROM_XCB(this), m_screen->root(), visualInfo->visual, AllocNone); @@ -395,21 +414,31 @@ void QXcbWindow::requestActivateWindow() QPlatformGLContext *QXcbWindow::glContext() const { -#ifdef XCB_USE_XLIB_FOR_GLX if (!QApplicationPrivate::platformIntegration()->hasOpenGL()) { printf("no opengl\n"); return 0; } - - if (!m_glx_context) { +#if defined(XCB_USE_GLX) + if (!m_context) { QXcbWindow *that = const_cast<QXcbWindow *>(this); - that->m_glx_context = new QGLXContext(m_window, m_screen, widget()->platformWindowFormat()); + that->m_context = new QGLXContext(m_window, m_screen, widget()->platformWindowFormat()); } +#elif defined(XCB_USE_EGL) + if (!m_context) { + EGLDisplay display = eglGetDisplay(DISPLAY_FROM_XCB(this)); - return m_glx_context; -#else - return 0; + EGLConfig config = q_configFromQPlatformWindowFormat(display,widget()->platformWindowFormat(),true); + QVector<EGLint> eglContextAttrs; + eglContextAttrs.append(EGL_CONTEXT_CLIENT_VERSION); + eglContextAttrs.append(2); + eglContextAttrs.append(EGL_NONE); + + EGLSurface eglSurface = eglCreateWindowSurface(display,config,(EGLNativeWindowType)m_window,0); + QXcbWindow *that = const_cast<QXcbWindow *>(this); + that->m_context = new QEGLPlatformContext(display, config, eglContextAttrs.data(), eglSurface, EGL_OPENGL_ES_API); + } #endif + return m_context; } void QXcbWindow::handleExposeEvent(const xcb_expose_event_t *event) diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 8db1a1e..2e8238b 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -43,12 +43,12 @@ #define QXCBWINDOW_H #include <QtGui/QPlatformWindow> +#include <QtGui/QPlatformWindowFormat> #include <xcb/xcb.h> #include "qxcbobject.h" -class QGLXContext; class QXcbScreen; class QXcbWindow : public QXcbObject, public QPlatformWindow @@ -92,9 +92,7 @@ private: QXcbScreen *m_screen; xcb_window_t m_window; -#ifdef XCB_USE_XLIB_FOR_GLX - QGLXContext *m_glx_context; -#endif + QPlatformGLContext *m_context; }; #endif diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index a6e92ef..b5850e4 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -21,14 +21,29 @@ HEADERS = \ qxcbwindow.h \ qxcbwindowsurface.h -contains(QT_CONFIG, opengl):DEFINES += XCB_USE_XLIB_FOR_GLX - -contains(DEFINES, XCB_USE_XLIB_FOR_GLX) { +contains(QT_CONFIG, opengl) { QT += opengl - - HEADERS += qglxintegration.h - SOURCES += qglxintegration.cpp + DEFINES += XCB_USE_XLIB LIBS += -lX11 -lX11-xcb + + contains(QT_CONFIG, opengles2) { + DEFINES += XCB_USE_EGL + HEADERS += \ + ../eglconvenience/qeglplatformcontext.h \ + ../eglconvenience/qeglconvenience.h \ + ../eglconvenience/qxlibeglintegration.h + + SOURCES += \ + ../eglconvenience/qeglplatformcontext.cpp \ + ../eglconvenience/qeglconvenience.cpp \ + ../eglconvenience/qxlibeglintegration.cpp + + LIBS += -lEGL + } else { + DEFINES += XCB_USE_GLX + HEADERS += qglxintegration.h + SOURCES += qglxintegration.cpp + } } LIBS += -lxcb -lxcb-image -lxcb-keysyms -lxcb-icccm diff --git a/src/plugins/platforms/xlib/qxlibeglintegration.cpp b/src/plugins/platforms/xlib/qxlibeglintegration.cpp deleted file mode 100644 index 1135d2f..0000000 --- a/src/plugins/platforms/xlib/qxlibeglintegration.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qxlibeglintegration.h" - -static int countBits(unsigned long mask) -{ - int count = 0; - while (mask != 0) { - if (mask & 1) - ++count; - mask >>= 1; - } - return count; -} - -VisualID QXlibEglIntegration::getCompatibleVisualId(Display *display, EGLConfig config) -{ - VisualID visualId = 0; - EGLint eglValue = 0; - - EGLDisplay eglDisplay = eglGetDisplay(display); - - EGLint configRedSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_RED_SIZE, &configRedSize); - - EGLint configGreenSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_GREEN_SIZE, &configGreenSize); - - EGLint configBlueSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_BLUE_SIZE, &configBlueSize); - - EGLint configAlphaSize = 0; - eglGetConfigAttrib(eglDisplay, config, EGL_ALPHA_SIZE, &configAlphaSize); - - eglGetConfigAttrib(eglDisplay, config, EGL_CONFIG_ID, &eglValue); - int configId = eglValue; - - // See if EGL provided a valid VisualID: - eglGetConfigAttrib(eglDisplay, config, EGL_NATIVE_VISUAL_ID, &eglValue); - visualId = (VisualID)eglValue; - if (visualId) { - // EGL has suggested a visual id, so get the rest of the visual info for that id: - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - visualInfoTemplate.visualid = visualId; - - XVisualInfo *chosenVisualInfo; - int matchingCount = 0; - chosenVisualInfo = XGetVisualInfo(display, VisualIDMask, &visualInfoTemplate, &matchingCount); - if (chosenVisualInfo) { - // Skip size checks if implementation supports non-matching visual - // and config (http://bugreports.qt.nokia.com/browse/QTBUG-9444). - if (q_hasEglExtension(eglDisplay,"EGL_NV_post_convert_rounding")) { - XFree(chosenVisualInfo); - return visualId; - } - - int visualRedSize = countBits(chosenVisualInfo->red_mask); - int visualGreenSize = countBits(chosenVisualInfo->green_mask); - int visualBlueSize = countBits(chosenVisualInfo->blue_mask); - int visualAlphaSize = -1; // Need XRender to tell us the alpha channel size - - bool visualMatchesConfig = false; - if ( visualRedSize == configRedSize && - visualGreenSize == configGreenSize && - visualBlueSize == configBlueSize ) - { - // We need XRender to check the alpha channel size of the visual. If we don't have - // the alpha size, we don't check it against the EGL config's alpha size. - if (visualAlphaSize >= 0) - visualMatchesConfig = visualAlphaSize == configAlphaSize; - else - visualMatchesConfig = true; - } - - if (!visualMatchesConfig) { - if (visualAlphaSize >= 0) { - qWarning("Warning: EGL suggested using X Visual ID %d (ARGB%d%d%d%d) for EGL config %d (ARGB%d%d%d%d), but this is incompatable", - (int)visualId, visualAlphaSize, visualRedSize, visualGreenSize, visualBlueSize, - configId, configAlphaSize, configRedSize, configGreenSize, configBlueSize); - } else { - qWarning("Warning: EGL suggested using X Visual ID %d (RGB%d%d%d) for EGL config %d (RGB%d%d%d), but this is incompatable", - (int)visualId, visualRedSize, visualGreenSize, visualBlueSize, - configId, configRedSize, configGreenSize, configBlueSize); - } - visualId = 0; - } - } else { - qWarning("Warning: EGL suggested using X Visual ID %d for EGL config %d, but that isn't a valid ID", - (int)visualId, configId); - visualId = 0; - } - XFree(chosenVisualInfo); - } -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - else - qDebug("EGL did not suggest a VisualID (EGL_NATIVE_VISUAL_ID was zero) for EGLConfig %d", configId); -#endif - - if (visualId) { -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - if (configAlphaSize > 0) - qDebug("Using ARGB Visual ID %d provided by EGL for config %d", (int)visualId, configId); - else - qDebug("Using Opaque Visual ID %d provided by EGL for config %d", (int)visualId, configId); -#endif - return visualId; - } - - // Finally, try to - // use XGetVisualInfo and only use the bit depths to match on: - if (!visualId) { - XVisualInfo visualInfoTemplate; - memset(&visualInfoTemplate, 0, sizeof(XVisualInfo)); - XVisualInfo *matchingVisuals; - int matchingCount = 0; - - visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize + configAlphaSize; - matchingVisuals = XGetVisualInfo(display, - VisualDepthMask, - &visualInfoTemplate, - &matchingCount); - if (!matchingVisuals) { - // Try again without taking the alpha channel into account: - visualInfoTemplate.depth = configRedSize + configGreenSize + configBlueSize; - matchingVisuals = XGetVisualInfo(display, - VisualDepthMask, - &visualInfoTemplate, - &matchingCount); - } - - if (matchingVisuals) { - visualId = matchingVisuals[0].visualid; - XFree(matchingVisuals); - } - } - - if (visualId) { -#ifdef QT_DEBUG_X11_VISUAL_SELECTION - qDebug("Using Visual ID %d provided by XGetVisualInfo for EGL config %d", (int)visualId, configId); -#endif - return visualId; - } - - qWarning("Unable to find an X11 visual which matches EGL config %d", configId); - return (VisualID)0; -} diff --git a/src/plugins/platforms/xlib/qxlibeglintegration.h b/src/plugins/platforms/xlib/qxlibeglintegration.h deleted file mode 100644 index 6a94b8e..0000000 --- a/src/plugins/platforms/xlib/qxlibeglintegration.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtOpenVG module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QTESTLITEEGLINTEGRATION_H -#define QTESTLITEEGLINTEGRATION_H - -#include "qxlibstatic.h" -#include "../eglconvenience/qeglconvenience.h" - -class QXlibEglIntegration -{ -public: - static VisualID getCompatibleVisualId(Display *display, EGLConfig config); -}; - -#endif // QTESTLITEEGLINTEGRATION_H diff --git a/src/plugins/platforms/xlib/qxlibwindow.cpp b/src/plugins/platforms/xlib/qxlibwindow.cpp index 90b36cf..b0d32d9 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.cpp +++ b/src/plugins/platforms/xlib/qxlibwindow.cpp @@ -61,7 +61,7 @@ #else #include "../eglconvenience/qeglconvenience.h" #include "../eglconvenience/qeglplatformcontext.h" -#include "qxlibeglintegration.h" +#include "../eglconvenience/qxlibeglintegration.h" #endif //QT_OPENGL_ES_2 #endif //QT_NO_OPENGL diff --git a/src/plugins/platforms/xlib/xlib.pro b/src/plugins/platforms/xlib/xlib.pro index dc22b80..159fdbe 100644 --- a/src/plugins/platforms/xlib/xlib.pro +++ b/src/plugins/platforms/xlib/xlib.pro @@ -45,12 +45,12 @@ contains(QT_CONFIG, opengl) { HEADERS += \ ../eglconvenience/qeglplatformcontext.h \ ../eglconvenience/qeglconvenience.h \ - qxlibeglintegration.h + ../eglconvenience/qxlibeglintegration.h SOURCES += \ ../eglconvenience/qeglplatformcontext.cpp \ ../eglconvenience/qeglconvenience.cpp \ - qxlibeglintegration.cpp + ../eglconvenience/qxlibeglintegration.cpp LIBS += -lEGL } } -- cgit v0.12 From 93e0fc1476757331d25b9fe2d357e930eda55331 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Tue, 1 Mar 2011 10:06:31 +0100 Subject: Lighthouse: Xcb. implement dri2 context handling --- src/plugins/platforms/xcb/qdri2context.cpp | 224 ++++++++++++++++++++++++++ src/plugins/platforms/xcb/qdri2context.h | 34 ++++ src/plugins/platforms/xcb/qxcbconnection.cpp | 131 ++++++++++++++- src/plugins/platforms/xcb/qxcbconnection.h | 23 ++- src/plugins/platforms/xcb/qxcbintegration.cpp | 9 +- src/plugins/platforms/xcb/qxcbwindow.cpp | 16 +- src/plugins/platforms/xcb/xcb.pro | 48 +++--- 7 files changed, 460 insertions(+), 25 deletions(-) create mode 100644 src/plugins/platforms/xcb/qdri2context.cpp create mode 100644 src/plugins/platforms/xcb/qdri2context.h diff --git a/src/plugins/platforms/xcb/qdri2context.cpp b/src/plugins/platforms/xcb/qdri2context.cpp new file mode 100644 index 0000000..44b8fc2 --- /dev/null +++ b/src/plugins/platforms/xcb/qdri2context.cpp @@ -0,0 +1,224 @@ +#include "qdri2context.h" + +#include "qxcbwindow.h" +#include "qxcbconnection.h" + +#include <QtCore/QDebug> +#include <QtGui/QWidget> + +#include <xcb/dri2.h> +#include <xcb/xfixes.h> + +#define MESA_EGL_NO_X11_HEADERS +#define EGL_EGLEXT_PROTOTYPES +#include <EGL/egl.h> +#include <EGL/eglext.h> + +#define GL_GLEXT_PROTOTYPES +#include <GLES2/gl2.h> +#include <GLES2/gl2ext.h> + +class QDri2ContextPrivate +{ +public: + QDri2ContextPrivate(QXcbWindow *window) + : qXcbWindow(window) + , windowFormat(window->widget()->platformWindowFormat()) + , image(0) + { + } + + xcb_window_t xcbWindow() { return qXcbWindow->window(); } + xcb_connection_t *xcbConnection() { return qXcbWindow->xcb_connection(); } + + QXcbWindow *qXcbWindow; + QPlatformWindowFormat windowFormat; + + EGLContext eglContext; + + EGLImageKHR image; + + GLuint fbo; + GLuint rbo; + GLuint depth; + + QSize size; +}; + +QDri2Context::QDri2Context(QXcbWindow *window) + : d_ptr(new QDri2ContextPrivate(window)) +{ + Q_D(QDri2Context); + + static const EGLint contextAttribs[] = { + EGL_CONTEXT_CLIENT_VERSION, 2, + EGL_NONE + }; + + eglBindAPI(EGL_OPENGL_ES_API); + + EGLContext shareContext = EGL_NO_CONTEXT; + if (window->widget()->platformWindowFormat().sharedGLContext()) { + QDri2Context *context = static_cast<QDri2Context *>(window->widget()->platformWindowFormat().sharedGLContext()); + shareContext = context->d_func()->eglContext; + } + d->eglContext = eglCreateContext(EGL_DISPLAY_FROM_XCB(d->qXcbWindow), NULL, + shareContext, contextAttribs); + + if (d->eglContext == EGL_NO_CONTEXT) { + qDebug() << "No eglContext!" << eglGetError(); + } + + EGLBoolean makeCurrentSuccess = eglMakeCurrent(EGL_DISPLAY_FROM_XCB(d->qXcbWindow),EGL_NO_SURFACE,EGL_NO_SURFACE,d->eglContext); + if (!makeCurrentSuccess) { + qDebug() << "eglMakeCurrent failed!" << eglGetError(); + } + + xcb_dri2_create_drawable (d->xcbConnection(), d->xcbWindow()); + + glGenFramebuffers(1,&d->fbo); + glBindFramebuffer(GL_FRAMEBUFFER,d->fbo); + glActiveTexture(GL_TEXTURE0); + + glGenRenderbuffers(1, &d->rbo); + glBindRenderbuffer(GL_RENDERBUFFER, d->rbo); + + glGenRenderbuffers(1,&d->depth); + glBindRenderbuffer(GL_RENDERBUFFER, d->depth); + + resize(d->qXcbWindow->widget()->geometry().size()); + + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, d->rbo); + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT, GL_RENDERER,d->depth); + glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_STENCIL_ATTACHMENT, GL_RENDERER,d->depth); + + //restore the old current context + const QPlatformGLContext *currentContext = QPlatformGLContext::currentContext(); + if (currentContext) + const_cast<QPlatformGLContext*>(currentContext)->makeCurrent(); +} + +QDri2Context::~QDri2Context() +{ + //cleanup +} + +void QDri2Context::makeCurrent() +{ + QPlatformGLContext::makeCurrent(); + Q_D(QDri2Context); + + eglMakeCurrent(EGL_DISPLAY_FROM_XCB(d->qXcbWindow),EGL_NO_SURFACE,EGL_NO_SURFACE,d->eglContext); + glBindFramebuffer(GL_FRAMEBUFFER,d->fbo); + +} + +void QDri2Context::doneCurrent() +{ + QPlatformGLContext::doneCurrent(); + Q_D(QDri2Context); + eglMakeCurrent(EGL_DISPLAY_FROM_XCB(d->qXcbWindow),EGL_NO_SURFACE,EGL_NO_SURFACE,EGL_NO_CONTEXT); +} + +void QDri2Context::swapBuffers() +{ + Q_D(QDri2Context); + xcb_rectangle_t rectangle; + rectangle.x = 0; + rectangle.y = 0; + rectangle.width = d->qXcbWindow->widget()->geometry().width(); + rectangle.height = d->qXcbWindow->widget()->geometry().height(); + + xcb_xfixes_region_t xfixesRegion = xcb_generate_id(d->xcbConnection()); + xcb_xfixes_create_region(d->xcbConnection(), xfixesRegion, + 1, &rectangle); + + xcb_dri2_copy_region_cookie_t cookie = xcb_dri2_copy_region_unchecked(d->xcbConnection(), + d->qXcbWindow->window(), + xfixesRegion, + XCB_DRI2_ATTACHMENT_BUFFER_FRONT_LEFT, + XCB_DRI2_ATTACHMENT_BUFFER_BACK_LEFT); + + xcb_dri2_copy_region_reply_t *reply = xcb_dri2_copy_region_reply(d->xcbConnection(),cookie,NULL); + + //cleanup + delete reply; + xcb_xfixes_destroy_region(d->xcbConnection(), xfixesRegion); + +} + +void * QDri2Context::getProcAddress(const QString &procName) +{ + return (void *)eglGetProcAddress(qPrintable(procName)); +} + +void QDri2Context::resize(const QSize &size) +{ + Q_D(QDri2Context); + d->size= size; + + glBindFramebuffer(GL_FRAMEBUFFER,d->fbo); + + xcb_dri2_dri2_buffer_t *backBfr = backBuffer(); + + if (d->image) { + qDebug() << "destroing image"; + eglDestroyImageKHR(EGL_DISPLAY_FROM_XCB(d->qXcbWindow),d->image); + } + + EGLint imgAttribs[] = { + EGL_WIDTH, d->size.width(), + EGL_HEIGHT, d->size.height(), + EGL_DRM_BUFFER_STRIDE_MESA, backBfr->pitch /4, + EGL_DRM_BUFFER_FORMAT_MESA, EGL_DRM_BUFFER_FORMAT_ARGB32_MESA, + EGL_NONE + }; + + d->image = eglCreateImageKHR(EGL_DISPLAY_FROM_XCB(d->qXcbWindow), + EGL_NO_CONTEXT, + EGL_DRM_BUFFER_MESA, + (EGLClientBuffer) backBfr->name, + imgAttribs); + + glBindRenderbuffer(GL_RENDERBUFFER, d->rbo); + glEGLImageTargetRenderbufferStorageOES(GL_RENDERBUFFER, + d->image); + + glBindRenderbuffer(GL_RENDERBUFFER, d->depth); + glRenderbufferStorage(GL_RENDERBUFFER,GL_DEPTH24_STENCIL8_OES,d->size.width(), d->size.height()); + +} + +QPlatformWindowFormat QDri2Context::platformWindowFormat() const +{ + Q_D(const QDri2Context); + return d->windowFormat; +} + +xcb_dri2_dri2_buffer_t * QDri2Context::backBuffer() +{ + Q_D(QDri2Context); + + unsigned int backBufferAttachment = XCB_DRI2_ATTACHMENT_BUFFER_BACK_LEFT; + xcb_dri2_get_buffers_cookie_t cookie = xcb_dri2_get_buffers_unchecked (d->xcbConnection(), + d->xcbWindow(), + 1, 1, &backBufferAttachment); + + xcb_dri2_get_buffers_reply_t *reply = xcb_dri2_get_buffers_reply (d->xcbConnection(), cookie, NULL); + if (!reply) { + qDebug() << "failed to get buffers reply"; + return 0; + } + + xcb_dri2_dri2_buffer_t *buffers = xcb_dri2_get_buffers_buffers (reply); + if (!buffers) { + qDebug() << "failed to get buffers"; + return 0; + } + + Q_ASSERT(reply->count == 1); + + delete reply; + + return buffers; +} diff --git a/src/plugins/platforms/xcb/qdri2context.h b/src/plugins/platforms/xcb/qdri2context.h new file mode 100644 index 0000000..5646565 --- /dev/null +++ b/src/plugins/platforms/xcb/qdri2context.h @@ -0,0 +1,34 @@ +#ifndef QDRI2CONTEXT_H +#define QDRI2CONTEXT_H + +#include <QtGui/QPlatformGLContext> + +class QXcbWindow; +class QDri2ContextPrivate; + +struct xcb_dri2_dri2_buffer_t; + +class QDri2Context : public QPlatformGLContext +{ + Q_DECLARE_PRIVATE(QDri2Context); +public: + QDri2Context(QXcbWindow *window); + ~QDri2Context(); + + void makeCurrent(); + void doneCurrent(); + void swapBuffers(); + void* getProcAddress(const QString& procName); + + void resize(const QSize &size); + + QPlatformWindowFormat platformWindowFormat() const; + +protected: + xcb_dri2_dri2_buffer_t *backBuffer(); + QScopedPointer<QDri2ContextPrivate> d_ptr; +private: + Q_DISABLE_COPY(QDri2Context) +}; + +#endif // QDRI2CONTEXT_H diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 967aa4d..06e4d13 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -46,16 +46,38 @@ #include <QtAlgorithms> #include <QSocketNotifier> +#include <QtGui/private/qapplication_p.h> + +#include <QtCore/QDebug> #include <stdio.h> +#include <errno.h> #ifdef XCB_USE_XLIB #include <X11/Xlib.h> #include <X11/Xlib-xcb.h> #endif +#ifdef XCB_USE_DRI2 +#include <xcb/dri2.h> +#include <xcb/xfixes.h> +extern "C" { +#include <xf86drm.h> +} +#define MESA_EGL_NO_X11_HEADERS +#define EGL_EGLEXT_PROTOTYPES +#include <EGL/egl.h> +#include <EGL/eglext.h> +#endif + QXcbConnection::QXcbConnection(const char *displayName) : m_displayName(displayName ? QByteArray(displayName) : qgetenv("DISPLAY")) +#ifdef XCB_USE_DRI2 + , m_dri2_major(0) + , m_dri2_minor(0) + , m_dri2_support_probed(false) + , m_has_support_for_dri2(false) +#endif { int primaryScreen = 0; @@ -67,8 +89,8 @@ QXcbConnection::QXcbConnection(const char *displayName) m_xlib_display = dpy; #else m_connection = xcb_connect(m_displayName.constData(), &primaryScreen); -#endif +#endif //XCB_USE_XLIB m_setup = xcb_get_setup(xcb_connection()); xcb_screen_iterator_t it = xcb_setup_roots_iterator(m_setup); @@ -85,6 +107,10 @@ QXcbConnection::QXcbConnection(const char *displayName) m_keyboard = new QXcbKeyboard(this); initializeAllAtoms(); + +#ifdef XCB_USE_DRI2 + initializeDri2(); +#endif } QXcbConnection::~QXcbConnection() @@ -124,7 +150,7 @@ break; } \ break; -#define XCB_EVENT_DEBUG +//#define XCB_EVENT_DEBUG void printXcbEvent(const char *message, xcb_generic_event_t *event) { @@ -405,3 +431,104 @@ void QXcbConnection::initializeAllAtoms() { for (i = 0; i < QXcbAtom::NAtoms; ++i) m_allAtoms[i] = xcb_intern_atom_reply(xcb_connection(), cookies[i], 0)->atom; } + +#ifdef XCB_USE_DRI2 +void QXcbConnection::initializeDri2() +{ + xcb_dri2_connect_cookie_t connect_cookie = xcb_dri2_connect_unchecked (m_connection, + m_screens[0]->root(), + XCB_DRI2_DRIVER_TYPE_DRI); + + xcb_dri2_connect_reply_t *connect = xcb_dri2_connect_reply (m_connection, + connect_cookie, NULL); + + if (! connect || connect->driver_name_length + connect->device_name_length == 0) { + qDebug() << "Failed to connect to dri2"; + return; + } + + QString dri2DeviceName = QString::fromLocal8Bit(xcb_dri2_connect_device_name (connect), + xcb_dri2_connect_device_name_length (connect)); + delete connect; + + int fd = open(qPrintable(dri2DeviceName), O_RDWR); + if (fd < 0) { + qDebug() << "InitializeDri2: Could'nt open device << dri2DeviceName"; + return; + } + + drm_magic_t magic; + if (drmGetMagic(fd, &magic)) { + qDebug() << "Failed to get drmMagic"; + return; + } + + xcb_dri2_authenticate_cookie_t authenticate_cookie = xcb_dri2_authenticate_unchecked(m_connection, + m_screens[0]->root(), magic); + xcb_dri2_authenticate_reply_t *authenticate = xcb_dri2_authenticate_reply(m_connection, + authenticate_cookie, NULL); + if (authenticate == NULL || !authenticate->authenticated) { + fprintf(stderr, "DRI2: failed to authenticate\n"); + free(authenticate); + return; + } + + delete authenticate; + + EGLDisplay display = eglGetDRMDisplayMESA(fd); + if (!display) { + fprintf(stderr, "failed to create display\n"); + return; + } + + m_egl_display = display; + EGLint major,minor; + if (!eglInitialize(display, &major, &minor)) { + fprintf(stderr, "failed to initialize display\n"); + return; + } +} + +bool QXcbConnection::hasSupportForDri2() const +{ + if (!m_dri2_support_probed) { + xcb_generic_error_t *error = 0; + + xcb_prefetch_extension_data (m_connection, &xcb_xfixes_id); + xcb_prefetch_extension_data (m_connection, &xcb_dri2_id); + + xcb_xfixes_query_version_cookie_t xfixes_query_cookie = xcb_xfixes_query_version(m_connection, + XCB_XFIXES_MAJOR_VERSION, + XCB_XFIXES_MINOR_VERSION); + + xcb_dri2_query_version_cookie_t dri2_query_cookie = xcb_dri2_query_version (m_connection, + XCB_DRI2_MAJOR_VERSION, + XCB_DRI2_MINOR_VERSION); + + xcb_xfixes_query_version_reply_t *xfixes_query = xcb_xfixes_query_version_reply (m_connection, + xfixes_query_cookie, &error); + if (!xfixes_query || error || xfixes_query->major_version < 2) { + delete error; + delete xfixes_query; + return false; + } + delete xfixes_query; + + xcb_dri2_query_version_reply_t *dri2_query = xcb_dri2_query_version_reply (m_connection, + dri2_query_cookie, &error); + if (!dri2_query || error) { + delete error; + delete dri2_query; + return false; + } + + QXcbConnection *that = const_cast<QXcbConnection *>(this); + that->m_dri2_major = dri2_query->major_version; + that->m_dri2_minor = dri2_query->minor_version; + + that->m_has_support_for_dri2 = true; + that->m_dri2_support_probed = true; + } + return m_has_support_for_dri2; +} +#endif //XCB_USE_DRI2 diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 6a472a7..3aa36db 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -236,11 +236,19 @@ public: void *xlib_display() const { return m_xlib_display; } #endif +#ifdef XCB_USE_DRI2 + bool hasSupportForDri2() const; + void *egl_display() const { return m_egl_display; } +#endif + private slots: void eventDispatcher(); private: void initializeAllAtoms(); +#ifdef XCB_USE_DRI2 + void initializeDri2(); +#endif xcb_connection_t *m_connection; const xcb_setup_t *m_setup; @@ -254,11 +262,24 @@ private: QXcbKeyboard *m_keyboard; -#ifdef XCB_USE_XLIB +#if defined(XCB_USE_XLIB) void *m_xlib_display; #endif + +#ifdef XCB_USE_DRI2 + uint32_t m_dri2_major; + uint32_t m_dri2_minor; + bool m_dri2_support_probed; + bool m_has_support_for_dri2; + void *m_egl_display; +#endif + }; #define DISPLAY_FROM_XCB(object) ((Display *)(object->connection()->xlib_display())) +#ifdef XCB_USE_DRI2 +#define EGL_DISPLAY_FROM_XCB(object) ((EGLDisplay)(object->connection()->egl_display())) +#endif //endifXCB_USE_DRI2 + #endif diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 6dc5a5c..7f6d4c5 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -136,7 +136,12 @@ bool QXcbIntegration::hasOpenGL() const wasEglInitialized = eglInitialize(disp,&major,&minor); } return wasEglInitialized; -#else - return false; +#elif defined(XCB_USE_DRI2) + if (m_connection->hasSupportForDri2()) { + return true; + } #endif + return false; +} + } diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index bb856f2..005aa0e 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -43,6 +43,9 @@ #include "qxcbconnection.h" #include "qxcbscreen.h" +#ifdef XCB_USE_DRI2 +#include "qdri2context.h" +#endif #include <xcb/xcb_icccm.h> @@ -137,7 +140,7 @@ QXcbWindow::QXcbWindow(QWidget *tlw) qFatal("no window!"); } } else -#endif +#endif //defined(XCB_USE_GLX) || defined(XCB_USE_EGL) { m_window = xcb_generate_id(xcb_connection()); @@ -437,6 +440,12 @@ QPlatformGLContext *QXcbWindow::glContext() const QXcbWindow *that = const_cast<QXcbWindow *>(this); that->m_context = new QEGLPlatformContext(display, config, eglContextAttrs.data(), eglSurface, EGL_OPENGL_ES_API); } +#elif defined(XCB_USE_DRI2) + if (!m_context) { + QXcbWindow *that = const_cast<QXcbWindow *>(this); + that->m_context = new QDri2Context(that); + } + #endif return m_context; } @@ -474,6 +483,11 @@ void QXcbWindow::handleConfigureNotifyEvent(const xcb_configure_notify_event_t * QPlatformWindow::setGeometry(rect); QWindowSystemInterface::handleGeometryChange(widget(), rect); + +#if XCB_USE_DRI2 + if (m_context) + static_cast<QDri2Context *>(m_context)->resize(rect.size()); +#endif } static Qt::MouseButtons translateMouseButtons(int s) diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index b5850e4..9a3f735 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -23,26 +23,36 @@ HEADERS = \ contains(QT_CONFIG, opengl) { QT += opengl - DEFINES += XCB_USE_XLIB - LIBS += -lX11 -lX11-xcb - - contains(QT_CONFIG, opengles2) { - DEFINES += XCB_USE_EGL - HEADERS += \ - ../eglconvenience/qeglplatformcontext.h \ - ../eglconvenience/qeglconvenience.h \ - ../eglconvenience/qxlibeglintegration.h - - SOURCES += \ - ../eglconvenience/qeglplatformcontext.cpp \ - ../eglconvenience/qeglconvenience.cpp \ - ../eglconvenience/qxlibeglintegration.cpp - - LIBS += -lEGL + + DEFINES += XCB_USE_DRI2 + contains(DEFINES, XCB_USE_DRI2) { + LIBS += -lxcb-dri2 -lxcb-xfixes -lEGL + + HEADERS += qdri2context.h + SOURCES += qdri2context.cpp + } else { - DEFINES += XCB_USE_GLX - HEADERS += qglxintegration.h - SOURCES += qglxintegration.cpp + DEFINES += XCB_USE_XLIB + LIBS += -lX11 -lX11-xcb + + contains(QT_CONFIG, opengles2) { + DEFINES += XCB_USE_EGL + HEADERS += \ + ../eglconvenience/qeglplatformcontext.h \ + ../eglconvenience/qeglconvenience.h \ + ../eglconvenience/qxlibeglintegration.h + + SOURCES += \ + ../eglconvenience/qeglplatformcontext.cpp \ + ../eglconvenience/qeglconvenience.cpp \ + ../eglconvenience/qxlibeglintegration.cpp + + LIBS += -lEGL + } else { + DEFINES += XCB_USE_GLX + HEADERS += qglxintegration.h + SOURCES += qglxintegration.cpp + } } } -- cgit v0.12 From 044e06d5a40e3f8d5ae6861341b1f5449e3c0afe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Tue, 1 Mar 2011 10:09:18 +0100 Subject: Lighthouse: Add a native interface. Sometimes in applications code you need to get the native handles for displays, egl displays etc. The native interface class is how you access these handles. Reviewed-by: paul --- src/gui/kernel/kernel.pri | 6 ++- src/gui/kernel/qplatformintegration_qpa.cpp | 5 ++ src/gui/kernel/qplatformintegration_qpa.h | 4 +- src/gui/kernel/qplatformnativeinterface_qpa.cpp | 70 +++++++++++++++++++++++++ src/gui/kernel/qplatformnativeinterface_qpa.h | 68 ++++++++++++++++++++++++ 5 files changed, 150 insertions(+), 3 deletions(-) create mode 100644 src/gui/kernel/qplatformnativeinterface_qpa.cpp create mode 100644 src/gui/kernel/qplatformnativeinterface_qpa.h diff --git a/src/gui/kernel/kernel.pri b/src/gui/kernel/kernel.pri index 0ff3d88..32fa3d3 100644 --- a/src/gui/kernel/kernel.pri +++ b/src/gui/kernel/kernel.pri @@ -223,7 +223,8 @@ qpa { kernel/qdesktopwidget_qpa_p.h \ kernel/qplatformeventloopintegration_qpa.h \ kernel/qplatformcursor_qpa.h \ - kernel/qplatformclipboard_qpa.h + kernel/qplatformclipboard_qpa.h \ + kernel/qplatformnativeinterface_qpa.h SOURCES += \ kernel/qapplication_qpa.cpp \ @@ -246,7 +247,8 @@ qpa { kernel/qplatformeventloopintegration_qpa.cpp \ kernel/qplatformglcontext_qpa.cpp \ kernel/qplatformcursor_qpa.cpp \ - kernel/qplatformclipboard_qpa.cpp + kernel/qplatformclipboard_qpa.cpp \ + kernel/qplatformnativeinterface_qpa.cpp contains(QT_CONFIG, glib) { SOURCES += \ diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index 0cac57d..9f62538 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -111,6 +111,11 @@ QPlatformClipboard *QPlatformIntegration::clipboard() const return clipboard; } +QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const +{ + return 0; +} + /*! \class QPlatformIntegration \since 4.8 diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index 7050245..f01d462 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -60,6 +60,7 @@ class QWidget; class QPlatformEventLoopIntegration; class QPlatformFontDatabase; class QPlatformClipboard; +class QPlatformNativeInterface; class Q_GUI_EXPORT QPlatformIntegration { @@ -89,7 +90,8 @@ public: //jl:XXX should it be hasGLContext and do we need it at all? virtual bool hasOpenGL() const; - +// Access native handles. The window handle is allready available from Wid; + virtual QPlatformNativeInterface *nativeInterface() const; }; QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp new file mode 100644 index 0000000..67406cd --- /dev/null +++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qplatformnativeinterface_qpa.h" + +QT_BEGIN_NAMESPACE + +void * QPlatformNativeInterface::nativeDisplayForWidget(QWidget *widget) +{ + Q_UNUSED(widget); + return 0; +} + +void * QPlatformNativeInterface::eglDisplayForWidget(QWidget *widget) +{ + Q_UNUSED(widget); + return 0; +} + +void * QPlatformNativeInterface::nativeConnectionForWidget(QWidget *widget) +{ + Q_UNUSED(widget); + return 0; +} + +void * QPlatformNativeInterface::nativeScreenForWidget(QWidget *widget) +{ + Q_UNUSED(widget); + return 0; +} + +QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.h b/src/gui/kernel/qplatformnativeinterface_qpa.h new file mode 100644 index 0000000..d576297 --- /dev/null +++ b/src/gui/kernel/qplatformnativeinterface_qpa.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMNATIVEINTERFACE_QPA_H +#define QPLATFORMNATIVEINTERFACE_QPA_H + +#include <QtGui/qwindowdefs.h> + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Gui) + +class QWidget; + +class Q_GUI_EXPORT QPlatformNativeInterface +{ +public: + virtual void *nativeDisplayForWidget(QWidget *widget); + virtual void *eglDisplayForWidget(QWidget *widget); + virtual void *nativeConnectionForWidget(QWidget *widget); + virtual void *nativeScreenForWidget(QWidget *widget); +}; + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif // QPLATFORMNATIVEINTERFACE_QPA_H -- cgit v0.12 From 4d803a3493d15fdf7374689b774d02662dbd43b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Tue, 1 Mar 2011 10:11:36 +0100 Subject: Lighthouse: Xcb, implement native interface --- src/plugins/platforms/xcb/qxcbintegration.cpp | 5 +++ src/plugins/platforms/xcb/qxcbintegration.h | 3 ++ src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 50 +++++++++++++++++++++++ src/plugins/platforms/xcb/qxcbnativeinterface.h | 20 +++++++++ src/plugins/platforms/xcb/xcb.pro | 6 ++- 5 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 src/plugins/platforms/xcb/qxcbnativeinterface.cpp create mode 100644 src/plugins/platforms/xcb/qxcbnativeinterface.h diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 7f6d4c5..b6df550 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -44,6 +44,7 @@ #include "qxcbscreen.h" #include "qxcbwindow.h" #include "qxcbwindowsurface.h" +#include "qxcbnativeinterface.h" #include <xcb/xcb.h> @@ -64,6 +65,7 @@ QXcbIntegration::QXcbIntegration() m_screens << screen; m_fontDatabase = new QGenericUnixFontDatabase(); + m_nativeInterface = new QXcbNativeInterface; } QXcbIntegration::~QXcbIntegration() @@ -144,4 +146,7 @@ bool QXcbIntegration::hasOpenGL() const return false; } +QPlatformNativeInterface * QXcbIntegration::nativeInterface() const +{ + return m_nativeInterface; } diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index 80f70fb..eab6949 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -67,11 +67,14 @@ public: QPlatformFontDatabase *fontDatabase() const; bool hasOpenGL() const; + QPlatformNativeInterface *nativeInterface()const; + private: QList<QPlatformScreen *> m_screens; QXcbConnection *m_connection; QPlatformFontDatabase *m_fontDatabase; + QPlatformNativeInterface *m_nativeInterface; }; QT_END_NAMESPACE diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp new file mode 100644 index 0000000..859b6c3 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -0,0 +1,50 @@ +#include "qxcbnativeinterface.h" + +#include "qxcbscreen.h" + +#include <QtGui/private/qapplication_p.h> + +QXcbScreen *QXcbNativeInterface::screenForWidget(QWidget *widget) +{ + QXcbScreen *screen; + if (widget) { + screen = static_cast<QXcbScreen *>(QPlatformScreen::platformScreenForWidget(widget)); + }else { + screen = static_cast<QXcbScreen *>(QApplicationPrivate::platformIntegration()->screens()[0]); + } + return screen; +} + +void * QXcbNativeInterface::nativeDisplayForWidget(QWidget *widget) +{ +#if defined(XCB_USE_XLIB) + QXcbScreen *screen = screenForWidget(widget); + return screen->connection()->xlib_display(); +#else + Q_UNUSED(widget); + return 0; +#endif +} + +void * QXcbNativeInterface::eglDisplayForWidget(QWidget *widget) +{ +#if defined(XCB_USE_DRI2) + QXcbScreen *screen = screenForWidget(widget); + return screen->connection()->egl_display(); +#else + Q_UNUSED(widget) + return 0; +#endif +} + +void * QXcbNativeInterface::nativeConnectionForWidget(QWidget *widget) +{ + QXcbScreen *screen = screenForWidget(widget); + return screen->xcb_connection(); +} + +void * QXcbNativeInterface::nativeScreenForWidget(QWidget *widget) +{ + QXcbScreen *screen = screenForWidget(widget); + return screen->screen(); +} diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h new file mode 100644 index 0000000..fb48833 --- /dev/null +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -0,0 +1,20 @@ +#ifndef QXCBNATIVEINTERFACE_H +#define QXCBNATIVEINTERFACE_H + +#include <QtGui/QPlatformNativeInterface> + +class QWidget; +class QXcbScreen; + +class QXcbNativeInterface : public QPlatformNativeInterface +{ + void * nativeDisplayForWidget(QWidget *widget); + void * eglDisplayForWidget(QWidget *widget); + void * nativeConnectionForWidget(QWidget *widget); + void * nativeScreenForWidget(QWidget *widget); + +private: + static QXcbScreen *screenForWidget(QWidget *widget); +}; + +#endif // QXCBNATIVEINTERFACE_H diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index 9a3f735..2237cee 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -10,7 +10,8 @@ SOURCES = \ qxcbscreen.cpp \ qxcbwindow.cpp \ qxcbwindowsurface.cpp \ - main.cpp + main.cpp \ + qxcbnativeinterface.cpp HEADERS = \ qxcbconnection.h \ @@ -19,7 +20,8 @@ HEADERS = \ qxcbobject.h \ qxcbscreen.h \ qxcbwindow.h \ - qxcbwindowsurface.h + qxcbwindowsurface.h \ + qxcbnativeinterface.h contains(QT_CONFIG, opengl) { QT += opengl -- cgit v0.12 From b67d537070e88feb708d13b46cd1468e2c0dc0e8 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta <gunnar.sletta@nokia.com> Date: Thu, 10 Feb 2011 16:10:57 +1000 Subject: Allow using QPixmap outside GUI thread when using raster --- src/gui/image/qpixmap.cpp | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index f896572..b276180 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -98,12 +98,21 @@ static bool qt_pixmap_thread_test() qFatal("QPixmap: Must construct a QApplication before a QPaintDevice"); return false; } -#ifndef Q_WS_WIN - if (!QApplication::testAttribute(Qt::AA_X11InitThreads) && qApp->thread() != QThread::currentThread()) { - qWarning("QPixmap: It is not safe to use pixmaps outside the GUI thread"); - return false; - } + + if (qApp->thread() != QThread::currentThread()) { + bool fail = false; +#if defined (Q_WS_X11) + if (!QApplication::testAttribute(Qt::AA_X11InitThreads)) + fail = true; +#else + if (QApplicationPrivate::graphics_system_name != QLatin1String("raster")) + fail = true; #endif + if (fail) { + qWarning("QPixmap: It is not safe to use pixmaps outside the GUI thread"); + return false; + } + } return true; } -- cgit v0.12 From 327f4c8e3894ccf34e7629a8a840f92bd3ff8dd0 Mon Sep 17 00:00:00 2001 From: Gunnar Sletta <gunnar.sletta@nokia.com> Date: Mon, 21 Feb 2011 12:57:34 +0100 Subject: added capabilites to QPlatformIntegration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Jørgen Lind --- src/gui/image/qpixmap.cpp | 9 +++++++++ src/gui/kernel/qplatformintegration_qpa.cpp | 10 ++++++++++ src/gui/kernel/qplatformintegration_qpa.h | 6 ++++++ src/plugins/platforms/cocoa/qcocoaintegration.h | 1 + src/plugins/platforms/cocoa/qcocoaintegration.mm | 12 +++++++++++- src/plugins/platforms/eglfs/qeglfsintegration.cpp | 8 ++++++++ src/plugins/platforms/eglfs/qeglfsintegration.h | 1 + src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp | 9 +++++++++ src/plugins/platforms/linuxfb/qlinuxfbintegration.h | 2 ++ src/plugins/platforms/minimal/qminimalintegration.cpp | 8 ++++++++ src/plugins/platforms/minimal/qminimalintegration.h | 2 ++ src/plugins/platforms/openkode/qopenkodeintegration.cpp | 9 +++++++++ src/plugins/platforms/openkode/qopenkodeintegration.h | 2 ++ src/plugins/platforms/vnc/qvncintegration.cpp | 9 +++++++++ src/plugins/platforms/vnc/qvncintegration.h | 1 + src/plugins/platforms/wayland/qwaylandintegration.cpp | 10 ++++++++-- src/plugins/platforms/wayland/qwaylandintegration.h | 1 + 17 files changed, 97 insertions(+), 3 deletions(-) diff --git a/src/gui/image/qpixmap.cpp b/src/gui/image/qpixmap.cpp index b276180..90d9a90 100644 --- a/src/gui/image/qpixmap.cpp +++ b/src/gui/image/qpixmap.cpp @@ -71,6 +71,10 @@ # include "private/qpixmap_mac_p.h" #endif +#ifdef Q_WS_QPA +# include "qplatformintegration_qpa.h" +#endif + #if defined(Q_WS_X11) # include "qx11info_x11.h" # include <private/qt_x11_p.h> @@ -104,6 +108,11 @@ static bool qt_pixmap_thread_test() #if defined (Q_WS_X11) if (!QApplication::testAttribute(Qt::AA_X11InitThreads)) fail = true; +#elif defined (Q_WS_QPA) + if (!QApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::ThreadedPixmaps)) { + printf("Lighthouse plugin does not support threaded pixmaps!\n"); + fail = true; + } #else if (QApplicationPrivate::graphics_system_name != QLatin1String("raster")) fail = true; diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index 9f62538..f43e141 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -216,4 +216,14 @@ QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const QRect(x,y,width,height). */ + +bool QPlatformIntegration::hasCapability(Capability cap) const +{ + return false; +} + + + + + QT_END_NAMESPACE diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index f01d462..1d69af4 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -65,8 +65,14 @@ class QPlatformNativeInterface; class Q_GUI_EXPORT QPlatformIntegration { public: + enum Capability { + ThreadedPixmaps = 1, + }; + virtual ~QPlatformIntegration() { } + virtual bool hasCapability(Capability cap) const; + // GraphicsSystem functions virtual QPixmapData *createPixmapData(QPixmapData::PixelType type) const = 0; virtual QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const = 0; diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h index e7ecf2a..b94bcb9 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaintegration.h @@ -75,6 +75,7 @@ public: QCocoaIntegration(); ~QCocoaIntegration(); + bool hasCapability(QPlatformIntegration::Capability cap) const; QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index 28e894c..a75b88c 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -94,9 +94,19 @@ QCocoaIntegration::~QCocoaIntegration() delete mPool; } +bool QCocoaIntegration::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case ThreadedPixmaps: return true; + default: return QPlatformIntegration::hasCapability(cap); + } +} + + + QPixmapData *QCocoaIntegration::createPixmapData(QPixmapData::PixelType type) const { - return new QRasterPixmapData(type); + return new QRasterPixmapData(type); } QPlatformWindow *QCocoaIntegration::createPlatformWindow(QWidget *widget, WId winId) const diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.cpp b/src/plugins/platforms/eglfs/qeglfsintegration.cpp index a48fde8..257490d 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.cpp +++ b/src/plugins/platforms/eglfs/qeglfsintegration.cpp @@ -65,6 +65,14 @@ QEglFSIntegration::QEglFSIntegration() #endif } +bool QEglFSIntegration::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case ThreadedPixmaps: return true; + default: return QPlatformIntegration::hasCapability(cap); + } +} + QPixmapData *QEglFSIntegration::createPixmapData(QPixmapData::PixelType type) const { #ifdef QEGL_EXTRA_DEBUG diff --git a/src/plugins/platforms/eglfs/qeglfsintegration.h b/src/plugins/platforms/eglfs/qeglfsintegration.h index 0342539..ce231f2 100644 --- a/src/plugins/platforms/eglfs/qeglfsintegration.h +++ b/src/plugins/platforms/eglfs/qeglfsintegration.h @@ -56,6 +56,7 @@ class QEglFSIntegration : public QPlatformIntegration public: QEglFSIntegration(); + bool hasCapability(QPlatformIntegration::Capability cap) const; QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp index aa1d401..af5a337 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp @@ -782,6 +782,15 @@ void QLinuxFbIntegration::blank(bool on) d_ptr->blank = on; } +bool QLinuxFbIntegration::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case ThreadedPixmaps: return true; + default: return QPlatformIntegration::hasCapability(cap); + } +} + + QPixmapData *QLinuxFbIntegration::createPixmapData(QPixmapData::PixelType type) const { return new QRasterPixmapData(type); diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h index e93495c..ddf8873 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h @@ -77,6 +77,8 @@ public: QLinuxFbIntegration(); ~QLinuxFbIntegration(); + bool hasCapability(QPlatformIntegration::Capability cap) const; + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId WinId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId WinId) const; diff --git a/src/plugins/platforms/minimal/qminimalintegration.cpp b/src/plugins/platforms/minimal/qminimalintegration.cpp index c90e92e..0f11edd 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.cpp +++ b/src/plugins/platforms/minimal/qminimalintegration.cpp @@ -56,6 +56,14 @@ QMinimalIntegration::QMinimalIntegration() mScreens.append(mPrimaryScreen); } +bool QMinimalIntegration::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case ThreadedPixmaps: return true; + default: return QPlatformIntegration::hasCapability(cap); + } +} + QPixmapData *QMinimalIntegration::createPixmapData(QPixmapData::PixelType type) const { return new QRasterPixmapData(type); diff --git a/src/plugins/platforms/minimal/qminimalintegration.h b/src/plugins/platforms/minimal/qminimalintegration.h index 95b952e..aab6fe3 100644 --- a/src/plugins/platforms/minimal/qminimalintegration.h +++ b/src/plugins/platforms/minimal/qminimalintegration.h @@ -69,6 +69,8 @@ class QMinimalIntegration : public QPlatformIntegration public: QMinimalIntegration(); + bool hasCapability(QPlatformIntegration::Capability cap) const; + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.cpp b/src/plugins/platforms/openkode/qopenkodeintegration.cpp index 763e69e..2d17f33 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.cpp +++ b/src/plugins/platforms/openkode/qopenkodeintegration.cpp @@ -185,6 +185,15 @@ QOpenKODEIntegration::~QOpenKODEIntegration() delete mFontDb; } + +bool QOpenKODEIntegration::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case ThreadedPixmaps: return true; + default: return QPlatformIntegration::hasCapability(cap); + } +} + QPixmapData *QOpenKODEIntegration::createPixmapData(QPixmapData::PixelType type) const { return new QGLPixmapData(type); diff --git a/src/plugins/platforms/openkode/qopenkodeintegration.h b/src/plugins/platforms/openkode/qopenkodeintegration.h index a067491..2304f27 100644 --- a/src/plugins/platforms/openkode/qopenkodeintegration.h +++ b/src/plugins/platforms/openkode/qopenkodeintegration.h @@ -90,6 +90,8 @@ public: QOpenKODEIntegration(); ~QOpenKODEIntegration(); + bool hasCapability(QPlatformIntegration::Capability cap) const; + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp index b36ff33..56cbe4b 100644 --- a/src/plugins/platforms/vnc/qvncintegration.cpp +++ b/src/plugins/platforms/vnc/qvncintegration.cpp @@ -152,6 +152,15 @@ QVNCIntegration::QVNCIntegration(const QStringList& paramList) screen->setDirty(screenRect); } +bool QVNCIntegration::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case ThreadedPixmaps: return true; + default: return QPlatformIntegration::hasCapability(cap); + } +} + + QPixmapData *QVNCIntegration::createPixmapData(QPixmapData::PixelType type) const { return new QRasterPixmapData(type); diff --git a/src/plugins/platforms/vnc/qvncintegration.h b/src/plugins/platforms/vnc/qvncintegration.h index dfc0e6b..80338a1 100644 --- a/src/plugins/platforms/vnc/qvncintegration.h +++ b/src/plugins/platforms/vnc/qvncintegration.h @@ -81,6 +81,7 @@ class QVNCIntegration : public QPlatformIntegration public: QVNCIntegration(const QStringList& paramList); + bool hasCapability(QPlatformIntegration::Capability cap) const; QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 7c0f69e..3383410 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -71,6 +71,14 @@ QWaylandIntegration::screens() const return mDisplay->screens(); } +bool QWaylandIntegration::hasCapability(QPlatformIntegration::Capability cap) const +{ + switch (cap) { + case ThreadedPixmaps: return true; + default: return QPlatformIntegration::hasCapability(cap); + } +} + QPixmapData *QWaylandIntegration::createPixmapData(QPixmapData::PixelType type) const { #ifdef QT_WAYLAND_GL_SUPPORT @@ -80,8 +88,6 @@ QPixmapData *QWaylandIntegration::createPixmapData(QPixmapData::PixelType type) return new QRasterPixmapData(type); } - - QPlatformWindow *QWaylandIntegration::createPlatformWindow(QWidget *widget, WId winId) const { Q_UNUSED(winId); diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h index d707612..c3919ab 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.h +++ b/src/plugins/platforms/wayland/qwaylandintegration.h @@ -54,6 +54,7 @@ class QWaylandIntegration : public QPlatformIntegration public: QWaylandIntegration(bool useOpenGL = false); + bool hasCapability(QPlatformIntegration::Capability cap) const; QPixmapData *createPixmapData(QPixmapData::PixelType type) const; QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId) const; QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; -- cgit v0.12 From adeec26e3bd67183e329cee4a0d1e8b7f6c454c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Tue, 1 Mar 2011 12:32:24 +0100 Subject: Lighthouse: Native Interface, added graphicsDevice --- src/gui/kernel/qplatformnativeinterface_qpa.cpp | 14 ++++++++++---- src/gui/kernel/qplatformnativeinterface_qpa.h | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp index 67406cd..8f128ee 100644 --- a/src/gui/kernel/qplatformnativeinterface_qpa.cpp +++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp @@ -43,25 +43,31 @@ QT_BEGIN_NAMESPACE -void * QPlatformNativeInterface::nativeDisplayForWidget(QWidget *widget) +void *QPlatformNativeInterface::nativeDisplayForWidget(QWidget *widget) { Q_UNUSED(widget); return 0; } -void * QPlatformNativeInterface::eglDisplayForWidget(QWidget *widget) +void *QPlatformNativeInterface::eglDisplayForWidget(QWidget *widget) { Q_UNUSED(widget); return 0; } -void * QPlatformNativeInterface::nativeConnectionForWidget(QWidget *widget) +void *QPlatformNativeInterface::nativeConnectionForWidget(QWidget *widget) { Q_UNUSED(widget); return 0; } -void * QPlatformNativeInterface::nativeScreenForWidget(QWidget *widget) +void *QPlatformNativeInterface::nativeScreenForWidget(QWidget *widget) +{ + Q_UNUSED(widget); + return 0; +} + +void *QPlatformNativeInterface::nativeGraphicsDeviceForWidget(QWidget *widget) { Q_UNUSED(widget); return 0; diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.h b/src/gui/kernel/qplatformnativeinterface_qpa.h index d576297..80d6229 100644 --- a/src/gui/kernel/qplatformnativeinterface_qpa.h +++ b/src/gui/kernel/qplatformnativeinterface_qpa.h @@ -59,6 +59,7 @@ public: virtual void *eglDisplayForWidget(QWidget *widget); virtual void *nativeConnectionForWidget(QWidget *widget); virtual void *nativeScreenForWidget(QWidget *widget); + virtual void *nativeGraphicsDeviceForWidget(QWidget *widget); }; QT_END_NAMESPACE -- cgit v0.12 From ccb623188369be7bf4b991ff8a1f81d27137984c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Tue, 1 Mar 2011 13:58:53 +0100 Subject: Lighthouse: Make Native Interface slightly more agile We realised that we couldn't keep on adding virtual functions for all specific needs so we made one virtual function which takes a string parameter which enables the implementation to return anything. It seems a bit odd to have a virtual function as an accessor for a class with only 1 virtual function. But the idea is that we don't want a void * in the core lighthouse api. Also, the implementations should decleare more functions to do the heavy lifting of getting the handles Reviewed-by: paul --- src/gui/kernel/qplatformnativeinterface_qpa.cpp | 27 ++----------------------- src/gui/kernel/qplatformnativeinterface_qpa.h | 6 +----- 2 files changed, 3 insertions(+), 30 deletions(-) diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.cpp b/src/gui/kernel/qplatformnativeinterface_qpa.cpp index 8f128ee..ace4a7b 100644 --- a/src/gui/kernel/qplatformnativeinterface_qpa.cpp +++ b/src/gui/kernel/qplatformnativeinterface_qpa.cpp @@ -43,32 +43,9 @@ QT_BEGIN_NAMESPACE -void *QPlatformNativeInterface::nativeDisplayForWidget(QWidget *widget) -{ - Q_UNUSED(widget); - return 0; -} - -void *QPlatformNativeInterface::eglDisplayForWidget(QWidget *widget) -{ - Q_UNUSED(widget); - return 0; -} - -void *QPlatformNativeInterface::nativeConnectionForWidget(QWidget *widget) -{ - Q_UNUSED(widget); - return 0; -} - -void *QPlatformNativeInterface::nativeScreenForWidget(QWidget *widget) -{ - Q_UNUSED(widget); - return 0; -} - -void *QPlatformNativeInterface::nativeGraphicsDeviceForWidget(QWidget *widget) +void *QPlatformNativeInterface::nativeResourceForWidget(const QByteArray &resource, QWidget *widget) { + Q_UNUSED(resource); Q_UNUSED(widget); return 0; } diff --git a/src/gui/kernel/qplatformnativeinterface_qpa.h b/src/gui/kernel/qplatformnativeinterface_qpa.h index 80d6229..5ea2c13 100644 --- a/src/gui/kernel/qplatformnativeinterface_qpa.h +++ b/src/gui/kernel/qplatformnativeinterface_qpa.h @@ -55,11 +55,7 @@ class QWidget; class Q_GUI_EXPORT QPlatformNativeInterface { public: - virtual void *nativeDisplayForWidget(QWidget *widget); - virtual void *eglDisplayForWidget(QWidget *widget); - virtual void *nativeConnectionForWidget(QWidget *widget); - virtual void *nativeScreenForWidget(QWidget *widget); - virtual void *nativeGraphicsDeviceForWidget(QWidget *widget); + virtual void *nativeResourceForWidget(const QByteArray &resource, QWidget *widget); }; QT_END_NAMESPACE -- cgit v0.12 From 53741ff1983a9d0085658b96743b125daaa5e680 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Tue, 1 Mar 2011 14:01:43 +0100 Subject: Lighthouse: Implement the new Native Interface api in the xcb plugin --- src/plugins/platforms/xcb/qxcbconnection.cpp | 5 +- src/plugins/platforms/xcb/qxcbconnection.h | 2 + src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 74 ++++++++++++++++++++--- src/plugins/platforms/xcb/qxcbnativeinterface.h | 22 +++++-- 4 files changed, 87 insertions(+), 16 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 06e4d13..a2f985e 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -447,13 +447,14 @@ void QXcbConnection::initializeDri2() return; } - QString dri2DeviceName = QString::fromLocal8Bit(xcb_dri2_connect_device_name (connect), + m_dri2_device_name = QByteArray(xcb_dri2_connect_device_name (connect), xcb_dri2_connect_device_name_length (connect)); delete connect; - int fd = open(qPrintable(dri2DeviceName), O_RDWR); + int fd = open(m_dri2_device_name.constData(), O_RDWR); if (fd < 0) { qDebug() << "InitializeDri2: Could'nt open device << dri2DeviceName"; + m_dri2_device_name = QByteArray(); return; } diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 3aa36db..8a0f3d7 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -239,6 +239,7 @@ public: #ifdef XCB_USE_DRI2 bool hasSupportForDri2() const; void *egl_display() const { return m_egl_display; } + QByteArray dri2DeviceName() const { return m_dri2_device_name; } #endif private slots: @@ -272,6 +273,7 @@ private: bool m_dri2_support_probed; bool m_has_support_for_dri2; void *m_egl_display; + QByteArray m_dri2_device_name; #endif }; diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 859b6c3..f379580 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -3,8 +3,52 @@ #include "qxcbscreen.h" #include <QtGui/private/qapplication_p.h> +#include <QtCore/QMap> -QXcbScreen *QXcbNativeInterface::screenForWidget(QWidget *widget) +class QXcbResourceMap : public QMap<QByteArray, QXcbNativeInterface::ResourceType> +{ +public: + QXcbResourceMap() + :QMap<QByteArray, QXcbNativeInterface::ResourceType>() + { + insert("display",QXcbNativeInterface::Display); + insert("egldisplay",QXcbNativeInterface::EglDisplay); + insert("connection",QXcbNativeInterface::Connection); + insert("screen",QXcbNativeInterface::Screen); + insert("graphicsdevice",QXcbNativeInterface::GraphicsDevice); + } +}; + +Q_GLOBAL_STATIC(QXcbResourceMap, qXcbResourceMap) + +void *QXcbNativeInterface::nativeResourceForWidget(const QByteArray &resourceString, QWidget *widget) +{ + QByteArray lowerCaseResource = resourceString.toLower(); + ResourceType resource = qXcbResourceMap()->value(lowerCaseResource); + void *result = 0; + switch(resource) { + case Display: + result = displayForWidget(widget); + break; + case EglDisplay: + result = eglDisplayForWidget(widget); + break; + case Connection: + result = connectionForWidget(widget); + break; + case Screen: + result = qPlatformScreenForWidget(widget); + break; + case GraphicsDevice: + result = graphicsDeviceForWidget(widget); + break; + default: + result = 0; + } + return result; +} + +QXcbScreen *QXcbNativeInterface::qPlatformScreenForWidget(QWidget *widget) { QXcbScreen *screen; if (widget) { @@ -15,10 +59,10 @@ QXcbScreen *QXcbNativeInterface::screenForWidget(QWidget *widget) return screen; } -void * QXcbNativeInterface::nativeDisplayForWidget(QWidget *widget) +void *QXcbNativeInterface::displayForWidget(QWidget *widget) { #if defined(XCB_USE_XLIB) - QXcbScreen *screen = screenForWidget(widget); + QXcbScreen *screen = qPlatformScreenForWidget(widget); return screen->connection()->xlib_display(); #else Q_UNUSED(widget); @@ -26,10 +70,10 @@ void * QXcbNativeInterface::nativeDisplayForWidget(QWidget *widget) #endif } -void * QXcbNativeInterface::eglDisplayForWidget(QWidget *widget) +void *QXcbNativeInterface::eglDisplayForWidget(QWidget *widget) { #if defined(XCB_USE_DRI2) - QXcbScreen *screen = screenForWidget(widget); + QXcbScreen *screen = qPlatformScreenForWidget(widget); return screen->connection()->egl_display(); #else Q_UNUSED(widget) @@ -37,14 +81,26 @@ void * QXcbNativeInterface::eglDisplayForWidget(QWidget *widget) #endif } -void * QXcbNativeInterface::nativeConnectionForWidget(QWidget *widget) +void *QXcbNativeInterface::connectionForWidget(QWidget *widget) { - QXcbScreen *screen = screenForWidget(widget); + QXcbScreen *screen = qPlatformScreenForWidget(widget); return screen->xcb_connection(); } -void * QXcbNativeInterface::nativeScreenForWidget(QWidget *widget) +void *QXcbNativeInterface::screenForWidget(QWidget *widget) { - QXcbScreen *screen = screenForWidget(widget); + QXcbScreen *screen = qPlatformScreenForWidget(widget); return screen->screen(); } + +void *QXcbNativeInterface::graphicsDeviceForWidget(QWidget *widget) +{ +#if defined(XCB_USE_DRI2) + QXcbScreen *screen = qPlatformScreenForWidget(widget); + QByteArray deviceName = screen->connection()->dri2DeviceName(); + return deviceName.data(); +#else + return 0; +#endif + +} diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index fb48833..9815381 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -8,13 +8,25 @@ class QXcbScreen; class QXcbNativeInterface : public QPlatformNativeInterface { - void * nativeDisplayForWidget(QWidget *widget); - void * eglDisplayForWidget(QWidget *widget); - void * nativeConnectionForWidget(QWidget *widget); - void * nativeScreenForWidget(QWidget *widget); +public: + enum ResourceType { + Display, + EglDisplay, + Connection, + Screen, + GraphicsDevice + }; + + void *nativeResourceForWidget(const QByteArray &resourceString, QWidget *widget); + + void *displayForWidget(QWidget *widget); + void *eglDisplayForWidget(QWidget *widget); + void *connectionForWidget(QWidget *widget); + void *screenForWidget(QWidget *widget); + void *graphicsDeviceForWidget(QWidget *widget); private: - static QXcbScreen *screenForWidget(QWidget *widget); + static QXcbScreen *qPlatformScreenForWidget(QWidget *widget); }; #endif // QXCBNATIVEINTERFACE_H -- cgit v0.12 From 12573a8860d10cf023246e9d3d7f5739d83aabe4 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete <paul.tvete@nokia.com> Date: Wed, 2 Mar 2011 09:50:10 +0100 Subject: Build fixes for the Wayland plugin MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add qmake.conf variables, and use the generic font plugin. Reviewed-by: Jørgen --- mkspecs/common/linux.conf | 5 +++++ src/plugins/platforms/wayland/qwaylandinputdevice.cpp | 15 ++++++++++++--- src/plugins/platforms/wayland/qwaylandintegration.cpp | 4 ++-- src/plugins/platforms/wayland/wayland.pro | 10 ++++++---- 4 files changed, 25 insertions(+), 9 deletions(-) diff --git a/mkspecs/common/linux.conf b/mkspecs/common/linux.conf index e443be1..283cf83 100644 --- a/mkspecs/common/linux.conf +++ b/mkspecs/common/linux.conf @@ -35,6 +35,11 @@ QMAKE_LIBS_OPENGL_ES2 = -lGLESv2 QMAKE_LIBS_OPENVG = -lOpenVG QMAKE_LIBS_THREAD = -lpthread +QMAKE_CFLAGS_WAYLAND = +QMAKE_INCDIR_WAYLAND = +QMAKE_LIBS_WAYLAND = -lwayland-client -lxkbcommon +QMAKE_DEFINES_WAYLAND = + QMAKE_MOC = $$[QT_INSTALL_BINS]/moc QMAKE_UIC = $$[QT_INSTALL_BINS]/uic diff --git a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp index 102a213..47f9c91 100644 --- a/src/plugins/platforms/wayland/qwaylandinputdevice.cpp +++ b/src/plugins/platforms/wayland/qwaylandinputdevice.cpp @@ -52,8 +52,11 @@ #include <unistd.h> #include <fcntl.h> + +#ifndef QT_NO_WAYLAND_XKB #include <X11/extensions/XKBcommon.h> #include <X11/keysym.h> +#endif QWaylandInputDevice::QWaylandInputDevice(struct wl_display *display, uint32_t id) @@ -63,13 +66,13 @@ QWaylandInputDevice::QWaylandInputDevice(struct wl_display *display, , mKeyboardFocus(NULL) , mButtons(0) { - struct xkb_rule_names names; - wl_input_device_add_listener(mInputDevice, &inputDeviceListener, this); wl_input_device_set_user_data(mInputDevice, this); +#ifndef QT_NO_WAYLAND_XKB + struct xkb_rule_names names; names.rules = "evdev"; names.model = "pc105"; names.layout = "us"; @@ -77,6 +80,7 @@ QWaylandInputDevice::QWaylandInputDevice(struct wl_display *display, names.options = ""; mXkb = xkb_compile_keymap_from_rules(&names); +#endif } void QWaylandInputDevice::inputHandleMotion(void *data, @@ -135,6 +139,7 @@ void QWaylandInputDevice::inputHandleButton(void *data, inputDevice->mButtons); } +#ifndef QT_NO_WAYLAND_XKB static Qt::KeyboardModifiers translateModifiers(int s) { const uchar qt_alt_mask = XKB_COMMON_MOD1_MASK; @@ -201,11 +206,13 @@ static uint32_t translateKey(uint32_t sym, char *string, size_t size) return toupper(sym); } } +#endif void QWaylandInputDevice::inputHandleKey(void *data, struct wl_input_device *input_device, uint32_t time, uint32_t key, uint32_t state) { +#ifndef QT_NO_WAYLAND_XKB Q_UNUSED(input_device); QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data; QWaylandWindow *window = inputDevice->mKeyboardFocus; @@ -244,6 +251,7 @@ void QWaylandInputDevice::inputHandleKey(void *data, inputDevice->mModifiers, QString::fromLatin1(s)); } +#endif } void QWaylandInputDevice::inputHandlePointerFocus(void *data, @@ -280,6 +288,7 @@ void QWaylandInputDevice::inputHandleKeyboardFocus(void *data, struct wl_surface *surface, struct wl_array *keys) { +#ifndef QT_NO_WAYLAND_XKB Q_UNUSED(input_device); Q_UNUSED(time); QWaylandInputDevice *inputDevice = (QWaylandInputDevice *) data; @@ -303,7 +312,7 @@ void QWaylandInputDevice::inputHandleKeyboardFocus(void *data, inputDevice->mKeyboardFocus = NULL; QWindowSystemInterface::handleWindowActivated(0); } - +#endif } const struct wl_input_device_listener QWaylandInputDevice::inputDeviceListener = { diff --git a/src/plugins/platforms/wayland/qwaylandintegration.cpp b/src/plugins/platforms/wayland/qwaylandintegration.cpp index 3383410..267a037 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.cpp +++ b/src/plugins/platforms/wayland/qwaylandintegration.cpp @@ -47,7 +47,7 @@ #include "qwaylandshmwindow.h" #include "qwaylandeglwindow.h" -#include "qfontconfigdatabase.h" +#include "qgenericunixfontdatabase.h" #include <QtGui/QWindowSystemInterface> #include <QtGui/QPlatformCursor> @@ -59,7 +59,7 @@ #endif QWaylandIntegration::QWaylandIntegration(bool useOpenGL) - : mFontDb(new QFontconfigDatabase()) + : mFontDb(new QGenericUnixFontDatabase()) , mDisplay(new QWaylandDisplay()) , mUseOpenGL(useOpenGL) { diff --git a/src/plugins/platforms/wayland/wayland.pro b/src/plugins/platforms/wayland/wayland.pro index 9faa59b..face860 100644 --- a/src/plugins/platforms/wayland/wayland.pro +++ b/src/plugins/platforms/wayland/wayland.pro @@ -4,6 +4,7 @@ include(../../qpluginbase.pri) QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms DEFINES += Q_PLATFORM_WAYLAND +DEFINES += $$QMAKE_DEFINES_WAYLAND SOURCES = main.cpp \ qwaylandintegration.cpp \ @@ -27,8 +28,9 @@ HEADERS = qwaylandintegration.h \ qwaylandeglwindow.h \ qwaylandshmwindow.h -LIBS += -lwayland-client -LIBS += -lxkbcommon +INCLUDEPATH += $$QMAKE_INCDIR_WAYLAND +LIBS += $$QMAKE_LIBS_WAYLAND +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS_WAYLAND contains(QT_CONFIG, opengles2) { QT += opengl @@ -45,12 +47,12 @@ contains(QT_CONFIG, opengles2) { DEFINES += QT_WAYLAND_GL_SUPPORT } -unix { +unix:isEmpty(QMAKE_INCDIR_WAYLAND) { CONFIG += link_pkgconfig PKGCONFIG += libdrm } -include (../fontdatabases/fontconfig/fontconfig.pri) +include (../fontdatabases/genericunix/genericunix.pri) target.path += $$[QT_INSTALL_PLUGINS]/platforms INSTALLS += target -- cgit v0.12 From 571946141df5428c08221381b2f18302e004825f Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete <paul.tvete@nokia.com> Date: Wed, 2 Mar 2011 15:31:28 +0100 Subject: Compile with glx MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Jørgen --- src/plugins/platforms/xlib/qglxintegration.cpp | 29 +++++++++++++------------ src/plugins/platforms/xlib/qxlibintegration.cpp | 2 +- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/src/plugins/platforms/xlib/qglxintegration.cpp b/src/plugins/platforms/xlib/qglxintegration.cpp index 5ba4f0d..89cd768 100644 --- a/src/plugins/platforms/xlib/qglxintegration.cpp +++ b/src/plugins/platforms/xlib/qglxintegration.cpp @@ -45,6 +45,7 @@ #include "qxlibwindow.h" #include "qxlibscreen.h" +#include "qxlibdisplay.h" #if !defined(QT_NO_OPENGL) && !defined(QT_OPENGL_ES_2) #include <X11/Xlib.h> @@ -122,7 +123,7 @@ GLXFBConfig QGLXContext::findConfig(const QXlibScreen *screen, const QPlatformWi QVector<int> spec = buildSpec(reducedFormat); int confcount = 0; GLXFBConfig *configs; - configs = glXChooseFBConfig(screen->display(),screen->xScreenNumber(),spec.constData(),&confcount); + configs = glXChooseFBConfig(screen->display()->nativeDisplay(),screen->xScreenNumber(),spec.constData(),&confcount); if (confcount) { for (int i = 0; i < confcount; i++) { @@ -130,7 +131,7 @@ GLXFBConfig QGLXContext::findConfig(const QXlibScreen *screen, const QPlatformWi // Make sure we try to get an ARGB visual if the format asked for an alpha: if (reducedFormat.alpha()) { int alphaSize; - glXGetFBConfigAttrib(screen->display(),configs[i],GLX_ALPHA_SIZE,&alphaSize); + glXGetFBConfigAttrib(screen->display()->nativeDisplay(),configs[i],GLX_ALPHA_SIZE,&alphaSize); if (alphaSize > 0) break; } else { @@ -152,7 +153,7 @@ GLXFBConfig QGLXContext::findConfig(const QXlibScreen *screen, const QPlatformWi XVisualInfo *QGLXContext::findVisualInfo(const QXlibScreen *screen, const QPlatformWindowFormat &format) { GLXFBConfig config = QGLXContext::findConfig(screen,format); - XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display(),config); + XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display()->nativeDisplay(),config); return visualInfo; } @@ -264,8 +265,8 @@ QGLXContext::QGLXContext(Window window, QXlibScreen *screen, const QPlatformWind shareGlxContext = static_cast<const QGLXContext*>(sharePlatformContext)->glxContext(); GLXFBConfig config = findConfig(screen,format); - m_context = glXCreateNewContext(screen->display(),config,GLX_RGBA_TYPE,shareGlxContext,TRUE); - m_windowFormat = QGLXContext::platformWindowFromGLXFBConfig(screen->display(),config,m_context); + m_context = glXCreateNewContext(screen->display()->nativeDisplay(),config,GLX_RGBA_TYPE,shareGlxContext,TRUE); + m_windowFormat = QGLXContext::platformWindowFromGLXFBConfig(screen->display()->nativeDisplay(),config,m_context); #ifdef MYX11_DEBUG qDebug() << "QGLXGLContext::create context" << m_context; @@ -282,7 +283,7 @@ QGLXContext::~QGLXContext() { if (m_context) { qDebug("Destroying GLX context 0x%p", m_context); - glXDestroyContext(m_screen->display(), m_context); + glXDestroyContext(m_screen->display()->nativeDisplay(), m_context); } } @@ -297,15 +298,15 @@ void QGLXContext::createDefaultSharedContex(QXlibScreen *screen) GLXContext context; GLXFBConfig config = findConfig(screen,format); if (config) { - XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display(),config); - Colormap cmap = XCreateColormap(screen->display(),screen->rootWindow(),visualInfo->visual,AllocNone); + XVisualInfo *visualInfo = glXGetVisualFromFBConfig(screen->display()->nativeDisplay(),config); + Colormap cmap = XCreateColormap(screen->display()->nativeDisplay(),screen->rootWindow(),visualInfo->visual,AllocNone); XSetWindowAttributes a; a.colormap = cmap; - Window sharedWindow = XCreateWindow(screen->display(), screen->rootWindow(),x, y, w, h, + Window sharedWindow = XCreateWindow(screen->display()->nativeDisplay(), screen->rootWindow(),x, y, w, h, 0, visualInfo->depth, InputOutput, visualInfo->visual, CWColormap, &a); - context = glXCreateNewContext(screen->display(),config,GLX_RGBA_TYPE,0,TRUE); + context = glXCreateNewContext(screen->display()->nativeDisplay(),config,GLX_RGBA_TYPE,0,TRUE); QPlatformGLContext *sharedContext = new QGLXContext(screen,sharedWindow,context); QPlatformGLContext::setDefaultSharedContext(sharedContext); } else { @@ -319,18 +320,18 @@ void QGLXContext::makeCurrent() #ifdef MYX11_DEBUG qDebug("QGLXGLContext::makeCurrent(window=0x%x, ctx=0x%x)", m_drawable, m_context); #endif - glXMakeCurrent(m_screen->display(), m_drawable, m_context); + glXMakeCurrent(m_screen->display()->nativeDisplay(), m_drawable, m_context); } void QGLXContext::doneCurrent() { QPlatformGLContext::doneCurrent(); - glXMakeCurrent(m_screen->display(), 0, 0); + glXMakeCurrent(m_screen->display()->nativeDisplay(), 0, 0); } void QGLXContext::swapBuffers() { - glXSwapBuffers(m_screen->display(), m_drawable); + glXSwapBuffers(m_screen->display()->nativeDisplay(), m_drawable); } void* QGLXContext::getProcAddress(const QString& procName) @@ -342,7 +343,7 @@ void* QGLXContext::getProcAddress(const QString& procName) if (resolved && !glXGetProcAddressARB) return 0; if (!glXGetProcAddressARB) { - QList<QByteArray> glxExt = QByteArray(glXGetClientString(m_screen->display(), GLX_EXTENSIONS)).split(' '); + QList<QByteArray> glxExt = QByteArray(glXGetClientString(m_screen->display()->nativeDisplay(), GLX_EXTENSIONS)).split(' '); if (glxExt.contains("GLX_ARB_get_proc_address")) { #if defined(Q_OS_LINUX) || defined(Q_OS_BSD4) void *handle = dlopen(NULL, RTLD_LAZY); diff --git a/src/plugins/platforms/xlib/qxlibintegration.cpp b/src/plugins/platforms/xlib/qxlibintegration.cpp index e3ebb13..c207eb2 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.cpp +++ b/src/plugins/platforms/xlib/qxlibintegration.cpp @@ -135,7 +135,7 @@ bool QXlibIntegration::hasOpenGL() const #if !defined(QT_NO_OPENGL) #if !defined(QT_OPENGL_ES_2) QXlibScreen *screen = static_cast<const QXlibScreen *>(mScreens.at(0)); - return glXQueryExtension(screen->display(), 0, 0) != 0; + return glXQueryExtension(screen->display()->nativeDisplay(), 0, 0) != 0; #else static bool eglHasbeenInitialized = false; static bool wasEglInitialized = false; -- cgit v0.12 From 4ec935b3e738f79d76b708773c49471cffc46f65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Wed, 2 Mar 2011 16:15:47 +0100 Subject: Lighthouse: Make wayland configure check use pkg-config Reviewed-by: paul --- config.tests/qpa/wayland/wayland.pro | 6 ++---- configure | 19 ++++++++++++++++--- 2 files changed, 18 insertions(+), 7 deletions(-) diff --git a/config.tests/qpa/wayland/wayland.pro b/config.tests/qpa/wayland/wayland.pro index 266e4d6..0c2b899 100644 --- a/config.tests/qpa/wayland/wayland.pro +++ b/config.tests/qpa/wayland/wayland.pro @@ -1,6 +1,4 @@ SOURCES = wayland.cpp CONFIG -= qt - -QMAKE_CXXFLAGS += $$QT_CFLAGS_WAYLAND -LIBS += $$QT_LIBS_WAYLAND -lfreetype -lfontconfig -lwayland-client - +INCLUDEPATH += $$QMAKE_INCDIR_WAYLAND +LIBS += $$QMAKE_LIBS_WAYLAND diff --git a/configure b/configure index b95baab..664af92 100755 --- a/configure +++ b/configure @@ -6171,10 +6171,23 @@ if [ "$PLATFORM_QPA" = "yes" ]; then CFG_LIBFREETYPE=system fi - if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/wayland "Wayland" $L_FLAGS $I_FLAGS $l_FLAGS; then - QT_CONFIG="$QT_CONFIG wayland" - fi + fi + + if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists wayland-client 2>/dev/null; then + QMAKE_CFLAGS_WAYLAND=`$PKG_CONFIG --cflags wayland-client 2>/dev/null` + QMAKE_LIBS_WAYLAND=`$PKG_CONFIG --libs wayland-client 2>/dev/null` + QMAKE_INCDIR_WAYLAND=`$PKG_CONFIG --variable=includedir wayland-client 2>/dev/null` + fi + + # QMake variables set here override those in the mkspec. Therefore we only set the variables here if they are not zero. + if [ -n "$QMAKE_CFLAGS_WAYLAND" ] || [ -n "$QMAKE_LIBS_WAYLAND" ]; then + QMakeVar set QMAKE_CFLAGS_WAYLAND "$QMAKE_CFLAGS_WAYLAND" + QMakeVar set QMAKE_INCDIR_WAYLAND "$QMAKE_INCDIR_WAYLAND" + QMakeVar set QMAKE_LIBS_WAYLAND "$QMAKE_LIBS_WAYLAND" + fi + if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/wayland "Wayland" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_WAYLAND -I$QMAKE_INCDIR_WAYLAND $QMAKE_LIBS_WAYLAND; then + QT_CONFIG="$QT_CONFIG wayland" fi if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/mac/coreservices "CoreServices" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then -- cgit v0.12 From d585a66127f9ea13a07675e87fe0066037643df5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Thu, 3 Mar 2011 16:24:23 +0100 Subject: Lighthouse: Make xcb backen usable for anyone else again --- src/plugins/platforms/xcb/xcb.pro | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/xcb/xcb.pro b/src/plugins/platforms/xcb/xcb.pro index 2237cee..fdbe2cd 100644 --- a/src/plugins/platforms/xcb/xcb.pro +++ b/src/plugins/platforms/xcb/xcb.pro @@ -26,10 +26,13 @@ HEADERS = \ contains(QT_CONFIG, opengl) { QT += opengl - DEFINES += XCB_USE_DRI2 +# DEFINES += XCB_USE_DRI2 contains(DEFINES, XCB_USE_DRI2) { LIBS += -lxcb-dri2 -lxcb-xfixes -lEGL + CONFIG += link_pkgconfig + PKGCONFIG += libdrm + HEADERS += qdri2context.h SOURCES += qdri2context.cpp -- cgit v0.12 From 85b3a869fd69cfe14d05edd1fd17f913ba73dd52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Thu, 3 Mar 2011 18:40:42 +0100 Subject: Lighthouse: Add xkbcommon to pkg-config configuration of wayland --- configure | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/configure b/configure index 664af92..1922728 100755 --- a/configure +++ b/configure @@ -6173,10 +6173,10 @@ if [ "$PLATFORM_QPA" = "yes" ]; then fi - if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists wayland-client 2>/dev/null; then - QMAKE_CFLAGS_WAYLAND=`$PKG_CONFIG --cflags wayland-client 2>/dev/null` - QMAKE_LIBS_WAYLAND=`$PKG_CONFIG --libs wayland-client 2>/dev/null` - QMAKE_INCDIR_WAYLAND=`$PKG_CONFIG --variable=includedir wayland-client 2>/dev/null` + if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists wayland-client xkbcommon 2>/dev/null; then + QMAKE_CFLAGS_WAYLAND=`$PKG_CONFIG --cflags wayland-client xkbcommon 2>/dev/null` + QMAKE_LIBS_WAYLAND=`$PKG_CONFIG --libs wayland-client xkbcommon 2>/dev/null` + QMAKE_INCDIR_WAYLAND=`$PKG_CONFIG --variable=includedir wayland-client xkbcommon 2>/dev/null` fi # QMake variables set here override those in the mkspec. Therefore we only set the variables here if they are not zero. -- cgit v0.12 From 6daa12f8bcc16947a059747ebd985934163068eb Mon Sep 17 00:00:00 2001 From: Benjamin Franzke <benjaminfranzke@googlemail.com> Date: Thu, 3 Mar 2011 17:01:01 +0100 Subject: Lighthouse: Fix a block for wayland with gl support The initialial readable iteration, needs to be done before initializing egl, or it will be done inside egl. The readable iteration after initialzing egl would block forever otherwise. --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index c3e87a1..d0a0725 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -185,7 +185,13 @@ QWaylandDisplay::QWaylandDisplay(void) #ifdef QT_WAYLAND_GL_SUPPORT mNativeEglDisplay = wl_egl_display_create(mDisplay); +#else + mNativeEglDisplay = 0; +#endif + + eventDispatcher(); +#ifdef QT_WAYLAND_GL_SUPPORT mEglDisplay = eglGetDisplay((EGLNativeDisplayType)mNativeEglDisplay); if (mEglDisplay == NULL) { qWarning("EGL not available"); @@ -196,12 +202,9 @@ QWaylandDisplay::QWaylandDisplay(void) } } #else - mNativeEglDisplay = 0; mEglDisplay = 0; #endif - eventDispatcher(); - int fd = wl_display_get_fd(mDisplay, sourceUpdate, this); mReadNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this); connect(mReadNotifier, -- cgit v0.12 From 8dbe38632307d6cbe07f95db929e42ec01304324 Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Mon, 21 Feb 2011 08:30:06 +0100 Subject: don't print debug output --- src/gui/text/qplatformfontdatabase_qpa.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/text/qplatformfontdatabase_qpa.cpp b/src/gui/text/qplatformfontdatabase_qpa.cpp index afe762a..136130f 100644 --- a/src/gui/text/qplatformfontdatabase_qpa.cpp +++ b/src/gui/text/qplatformfontdatabase_qpa.cpp @@ -214,7 +214,7 @@ QFontEngine *QPlatformFontDatabase::fontEngine(const QFontDef &fontDef, QUnicode Q_UNUSED(handle); QByteArray *fileDataPtr = static_cast<QByteArray *>(handle); QFontEngineQPA *engine = new QFontEngineQPA(fontDef,*fileDataPtr); - qDebug() << fontDef.pixelSize << fontDef.weight << fontDef.style << fontDef.stretch << fontDef.styleHint << fontDef.styleStrategy << fontDef.family << script; + //qDebug() << fontDef.pixelSize << fontDef.weight << fontDef.style << fontDef.stretch << fontDef.styleHint << fontDef.styleStrategy << fontDef.family << script; return engine; } -- cgit v0.12 From 0be49f7c6719d3cfafb7e73a33dfd3f86aa8fb7c Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Wed, 16 Feb 2011 10:27:08 +0100 Subject: Do not explicitly process events before running event loop integration. Processing posted Qt events before the event loop integration is started may lead to the process being killed for taking too long time before the native event loop is running. Since event loop integrations are required to install a timer that does processEvents anyhow, the Qt events will be processed even without doing it explicitly in advance. --- src/gui/kernel/qeventdispatcher_qpa.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/src/gui/kernel/qeventdispatcher_qpa.cpp b/src/gui/kernel/qeventdispatcher_qpa.cpp index 519d2a6..f75cc0d 100644 --- a/src/gui/kernel/qeventdispatcher_qpa.cpp +++ b/src/gui/kernel/qeventdispatcher_qpa.cpp @@ -172,7 +172,6 @@ public: { if (qApp && (qApp->thread() == QThread::currentThread())) { m_isEventLoopIntegrationRunning = true; - QCoreApplication::processEvents(QEventLoop::WaitForMoreEvents); eventLoopIntegration->startEventLoop(); } } -- cgit v0.12 From 8238ca7f3d89d409221c96706eeae196199109c6 Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Thu, 3 Mar 2011 15:21:56 +0100 Subject: Inconsistency between ini case sensitivity between OS_MAC and WS_QPA. QPA sets CaseSensitive unconditionally, so if OS_MAC tries to use CaseInsensitive QSettings will assert. The patch leaves the non-QPA case unchanged. --- src/corelib/io/qsettings.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/corelib/io/qsettings.cpp b/src/corelib/io/qsettings.cpp index 92f7636..b084ca5 100644 --- a/src/corelib/io/qsettings.cpp +++ b/src/corelib/io/qsettings.cpp @@ -1004,7 +1004,7 @@ void QConfFileSettingsPrivate::initFormat() readFunc = 0; writeFunc = 0; #if defined(Q_OS_MAC) - caseSensitivity = (format == QSettings::NativeFormat) ? Qt::CaseSensitive : Qt::CaseInsensitive; + caseSensitivity = (format == QSettings::NativeFormat) ? Qt::CaseSensitive : IniCaseSensitivity; #else caseSensitivity = IniCaseSensitivity; #endif -- cgit v0.12 From cf264556fdea0d434e329e36c07a0ae6fa974f8b Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Fri, 4 Mar 2011 17:10:47 +0100 Subject: Fix 7ea1dd46966ae7cfa07fa18c001704e3c981b669 for Mac desktop builds. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cocoa.h can't be included after qscroller_p.h, but we need to have Q_WS_MAC defined before the ifdef. Reviewed-by: Morten Johan Sørvig --- src/gui/util/qscroller_mac.mm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gui/util/qscroller_mac.mm b/src/gui/util/qscroller_mac.mm index d85a51b..37756d7 100644 --- a/src/gui/util/qscroller_mac.mm +++ b/src/gui/util/qscroller_mac.mm @@ -39,13 +39,14 @@ ** ****************************************************************************/ - -#include "qscroller_p.h" +#include <QtCore/qglobal.h> #ifdef Q_WS_MAC #import <Cocoa/Cocoa.h> +#include "qscroller_p.h" + QPointF QScrollerPrivate::realDpi(int screen) { NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; -- cgit v0.12 From d9afcf0e84e438f89c1a8c5e26da51b06d8f61d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Mon, 7 Mar 2011 17:29:24 +0100 Subject: Lighthouse: Adding Native interface to getting the native eglcontext in xcbplugin. I also reoredered how eglInitialize was executed, (its not so lazy anymore) --- .../eglconvenience/qeglplatformcontext.cpp | 5 +++ .../platforms/eglconvenience/qeglplatformcontext.h | 2 ++ src/plugins/platforms/xcb/qdri2context.cpp | 6 ++++ src/plugins/platforms/xcb/qdri2context.h | 2 ++ src/plugins/platforms/xcb/qxcbconnection.cpp | 16 +++++++++ src/plugins/platforms/xcb/qxcbconnection.h | 15 +++++--- src/plugins/platforms/xcb/qxcbintegration.cpp | 12 +------ src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 40 +++++++++++++++++++++- src/plugins/platforms/xcb/qxcbnativeinterface.h | 4 ++- 9 files changed, 85 insertions(+), 17 deletions(-) diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp index 4b83a22..22e1bdc 100644 --- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp +++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.cpp @@ -155,3 +155,8 @@ QPlatformWindowFormat QEGLPlatformContext::platformWindowFormat() const { return m_windowFormat; } + +EGLContext QEGLPlatformContext::eglContext() const +{ + return m_eglContext; +} diff --git a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h b/src/plugins/platforms/eglconvenience/qeglplatformcontext.h index ac53559..9f3aea7 100644 --- a/src/plugins/platforms/eglconvenience/qeglplatformcontext.h +++ b/src/plugins/platforms/eglconvenience/qeglplatformcontext.h @@ -59,6 +59,8 @@ public: void makeDefaultSharedContext(); QPlatformWindowFormat platformWindowFormat() const; + + EGLContext eglContext() const; private: EGLContext m_eglContext; EGLDisplay m_eglDisplay; diff --git a/src/plugins/platforms/xcb/qdri2context.cpp b/src/plugins/platforms/xcb/qdri2context.cpp index 44b8fc2..10c9417 100644 --- a/src/plugins/platforms/xcb/qdri2context.cpp +++ b/src/plugins/platforms/xcb/qdri2context.cpp @@ -222,3 +222,9 @@ xcb_dri2_dri2_buffer_t * QDri2Context::backBuffer() return buffers; } + +void * QDri2Context::eglContext() const +{ + Q_D(QDri2Context); + return d->eglContext; +} diff --git a/src/plugins/platforms/xcb/qdri2context.h b/src/plugins/platforms/xcb/qdri2context.h index 5646565..8e4ac89 100644 --- a/src/plugins/platforms/xcb/qdri2context.h +++ b/src/plugins/platforms/xcb/qdri2context.h @@ -24,6 +24,8 @@ public: QPlatformWindowFormat platformWindowFormat() const; + void *eglContext() const; + protected: xcb_dri2_dri2_buffer_t *backBuffer(); QScopedPointer<QDri2ContextPrivate> d_ptr; diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index a2f985e..da60311 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -58,6 +58,10 @@ #include <X11/Xlib-xcb.h> #endif +#ifdef XCB_USE_EGL //dont pull in eglext prototypes +#include <EGL/egl.h> +#endif + #ifdef XCB_USE_DRI2 #include <xcb/dri2.h> #include <xcb/xfixes.h> @@ -87,6 +91,13 @@ QXcbConnection::QXcbConnection(const char *displayName) m_connection = XGetXCBConnection(dpy); XSetEventQueueOwner(dpy, XCBOwnsEventQueue); m_xlib_display = dpy; +#ifdef XCB_USE_EGL + EGLDisplay eglDisplay = eglGetDisplay(dpy); + m_egl_display = eglDisplay; + EGLint major, minor; + eglBindAPI(EGL_OPENGL_ES_API); + m_has_egl = eglInitialize(eglDisplay,&major,&minor); +#endif //XCB_USE_EGL #else m_connection = xcb_connect(m_displayName.constData(), &primaryScreen); @@ -432,6 +443,11 @@ void QXcbConnection::initializeAllAtoms() { m_allAtoms[i] = xcb_intern_atom_reply(xcb_connection(), cookies[i], 0)->atom; } +bool QXcbConnection::hasEgl() const +{ + return m_has_egl; +} + #ifdef XCB_USE_DRI2 void QXcbConnection::initializeDri2() { diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index 8a0f3d7..a7fa7fd 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -238,9 +238,14 @@ public: #ifdef XCB_USE_DRI2 bool hasSupportForDri2() const; - void *egl_display() const { return m_egl_display; } QByteArray dri2DeviceName() const { return m_dri2_device_name; } #endif +#ifdef XCB_USE_EGL + bool hasEgl() const; +#endif +#if defined(XCB_USE_EGL) || defined(XCB_USE_DRI2) + void *egl_display() const { return m_egl_display; } +#endif private slots: void eventDispatcher(); @@ -272,15 +277,17 @@ private: uint32_t m_dri2_minor; bool m_dri2_support_probed; bool m_has_support_for_dri2; - void *m_egl_display; QByteArray m_dri2_device_name; #endif - +#if defined(XCB_USE_EGL) || defined(XCB_USE_DRI2) + void *m_egl_display; + bool m_has_egl; +#endif }; #define DISPLAY_FROM_XCB(object) ((Display *)(object->connection()->xlib_display())) -#ifdef XCB_USE_DRI2 +#if defined(XCB_USE_DRI2) || defined(XCB_USE_EGL) #define EGL_DISPLAY_FROM_XCB(object) ((EGLDisplay)(object->connection()->egl_display())) #endif //endifXCB_USE_DRI2 diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index b6df550..0981655 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -127,17 +127,7 @@ bool QXcbIntegration::hasOpenGL() const #if defined(XCB_USE_GLX) return true; #elif defined(XCB_USE_EGL) - static bool eglHasbeenInitialized = false; - static bool wasEglInitialized = false; - if (!eglHasbeenInitialized) { - eglHasbeenInitialized = true; - const QXcbScreen *screen = static_cast<const QXcbScreen *>(m_screens.at(0)); - EGLint major, minor; - eglBindAPI(EGL_OPENGL_ES_API); - EGLDisplay disp = eglGetDisplay((Display*)screen->connection()->xlib_display()); - wasEglInitialized = eglInitialize(disp,&major,&minor); - } - return wasEglInitialized; + return m_connection->hasEgl(); #elif defined(XCB_USE_DRI2) if (m_connection->hasSupportForDri2()) { return true; diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index f379580..8b6678b 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -5,6 +5,14 @@ #include <QtGui/private/qapplication_p.h> #include <QtCore/QMap> +#include <QtCore/QDebug> + +#if defined(XCB_USE_EGL) +#include "../eglconvenience/qeglplatformcontext.h" +#elif defined (XCB_USE_DRI2) +#include "qdri2context.h" +#endif + class QXcbResourceMap : public QMap<QByteArray, QXcbNativeInterface::ResourceType> { public: @@ -16,6 +24,7 @@ public: insert("connection",QXcbNativeInterface::Connection); insert("screen",QXcbNativeInterface::Screen); insert("graphicsdevice",QXcbNativeInterface::GraphicsDevice); + insert("eglcontext",QXcbNativeInterface::EglContext); } }; @@ -42,6 +51,9 @@ void *QXcbNativeInterface::nativeResourceForWidget(const QByteArray &resourceStr case GraphicsDevice: result = graphicsDeviceForWidget(widget); break; + case EglContext: + result = eglContextForWidget(widget); + break; default: result = 0; } @@ -72,7 +84,7 @@ void *QXcbNativeInterface::displayForWidget(QWidget *widget) void *QXcbNativeInterface::eglDisplayForWidget(QWidget *widget) { -#if defined(XCB_USE_DRI2) +#if defined(XCB_USE_DRI2) || defined(XCB_USE_EGL) QXcbScreen *screen = qPlatformScreenForWidget(widget); return screen->connection()->egl_display(); #else @@ -100,7 +112,33 @@ void *QXcbNativeInterface::graphicsDeviceForWidget(QWidget *widget) QByteArray deviceName = screen->connection()->dri2DeviceName(); return deviceName.data(); #else + Q_UNUSED(widget); return 0; #endif } + +void * QXcbNativeInterface::eglContextForWidget(QWidget *widget) +{ + Q_ASSERT(widget); + if (!widget->platformWindow()) { + qDebug() << "QPlatformWindow does not exist for widget" << widget + << "cannot return EGLContext"; + return 0; + } + QPlatformGLContext *platformContext = widget->platformWindow()->glContext(); + if (!platformContext) { + qDebug() << "QPlatformWindow" << widget->platformWindow() << "does not have a glContext" + << "cannot return EGLContext"; + return 0; + } +#if defined(XCB_USE_EGL) + QEGLPlatformContext *eglPlatformContext = static_cast<QEGLPlatformContext *>(platformContext); + return eglPlatformContext->eglContext(); +#elif defined (XCB_USE_DRI2) + QDri2Context *dri2Context = static_cast<QDri2Context *>(platformContext); + return dri2Context->eglContext(); +#else + return 0; +#endif +} diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index 9815381..72c27d5 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -14,7 +14,8 @@ public: EglDisplay, Connection, Screen, - GraphicsDevice + GraphicsDevice, + EglContext }; void *nativeResourceForWidget(const QByteArray &resourceString, QWidget *widget); @@ -24,6 +25,7 @@ public: void *connectionForWidget(QWidget *widget); void *screenForWidget(QWidget *widget); void *graphicsDeviceForWidget(QWidget *widget); + void *eglContextForWidget(QWidget *widget); private: static QXcbScreen *qPlatformScreenForWidget(QWidget *widget); -- cgit v0.12 From 1e2410b5e486344d86cf02888a978fcda94fe02a Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Wed, 16 Feb 2011 10:24:12 +0100 Subject: Objective-c prf may not override OBJECTIVE_CFLAGS settings. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Morten Johan Sørvig --- mkspecs/common/gcc-base-macx.conf | 15 +++++++++++---- mkspecs/features/mac/objective_c.prf | 9 --------- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/mkspecs/common/gcc-base-macx.conf b/mkspecs/common/gcc-base-macx.conf index 5c9a8a1..2894f86 100644 --- a/mkspecs/common/gcc-base-macx.conf +++ b/mkspecs/common/gcc-base-macx.conf @@ -24,10 +24,16 @@ QMAKE_CXXFLAGS_PPC += $$QMAKE_CFLAGS_PPC QMAKE_CXXFLAGS_PPC_64 += $$QMAKE_CFLAGS_PPC_64 QMAKE_CXXFLAGS_DWARF2 += $$QMAKE_CFLAGS_DWARF2 -QMAKE_OBJECTIVE_CFLAGS_X86 += $$QMAKE_CFLAGS_X86 -QMAKE_OBJECTIVE_CFLAGS_X86_64 += $$QMAKE_CFLAGS_X86_64 -QMAKE_OBJECTIVE_CFLAGS_PPC += $$QMAKE_CFLAGS_PPC -QMAKE_OBJECTIVE_CFLAGS_PPC_64 += $$QMAKE_CFLAGS_PPC_64 +QMAKE_OBJECTIVE_CFLAGS = $$QMAKE_CFLAGS +QMAKE_OBJECTIVE_CFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON +QMAKE_OBJECTIVE_CFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF +QMAKE_OBJECTIVE_CFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG +QMAKE_OBJECTIVE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE +QMAKE_OBJECTIVE_CFLAGS_HIDESYMS = $$QMAKE_CXXFLAGS_HIDESYMS +QMAKE_OBJECTIVE_CFLAGS_X86 = $$QMAKE_CFLAGS_X86 +QMAKE_OBJECTIVE_CFLAGS_X86_64 = $$QMAKE_CFLAGS_X86_64 +QMAKE_OBJECTIVE_CFLAGS_PPC = $$QMAKE_CFLAGS_PPC +QMAKE_OBJECTIVE_CFLAGS_PPC_64 = $$QMAKE_CFLAGS_PPC_64 QMAKE_LFLAGS_X86 += $$QMAKE_CFLAGS_X86 QMAKE_LFLAGS_X86_64 += $$QMAKE_CFLAGS_X86_64 @@ -41,3 +47,4 @@ QMAKE_LFLAGS_INCREMENTAL += -undefined suppress -flat_namespace QMAKE_LFLAGS_SONAME += -install_name$${LITERAL_WHITESPACE} QMAKE_LFLAGS_VERSION += -current_version$${LITERAL_WHITESPACE} QMAKE_LFLAGS_COMPAT_VERSION += -compatibility_version$${LITERAL_WHITESPACE} + diff --git a/mkspecs/features/mac/objective_c.prf b/mkspecs/features/mac/objective_c.prf index ca693ba..0f25f41 100644 --- a/mkspecs/features/mac/objective_c.prf +++ b/mkspecs/features/mac/objective_c.prf @@ -9,15 +9,6 @@ for(source, SOURCES) { isEmpty(QMAKE_OBJECTIVE_CC):QMAKE_OBJECTIVE_CC = $$QMAKE_CC -QMAKE_OBJECTIVE_CFLAGS = $$QMAKE_CFLAGS -QMAKE_OBJECTIVE_CFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_OBJECTIVE_CFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_OBJECTIVE_CFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_OBJECTIVE_CFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -QMAKE_OBJECTIVE_CFLAGS_X86 = $$QMAKE_CFLAGS_X86 -QMAKE_OBJECTIVE_CFLAGS_PPC = $$QMAKE_CFLAGS_PPC -QMAKE_OBJECTIVE_CFLAGS_HIDESYMS = $$QMAKE_CXXFLAGS_HIDESYMS - OBJECTIVE_C_OBJECTS_DIR = $$OBJECTS_DIR isEmpty(OBJECTIVE_C_OBJECTS_DIR):OBJECTIVE_C_OBJECTS_DIR = . isEmpty(QMAKE_EXT_OBJECTIVE_C):QMAKE_EXT_OBJECTIVE_C = .mm .m -- cgit v0.12 From bf1eb9a98bedae2c1b261ed4d7d92d4a1dbe28e3 Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Fri, 4 Mar 2011 14:11:53 +0100 Subject: Build JavaScriptCore also under unusual platform combination. Reviewed-by: Jedrzej Nowacki Reviewed-by: Simon Hausmann --- src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h index 5abe9a1..cb4a963 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/wtf/Platform.h @@ -635,6 +635,9 @@ #define ENABLE_REPAINT_THROTTLING 1 #define HAVE_READLINE 1 #define WTF_PLATFORM_CF 1 +#endif + +#if OS(IPHONE_OS) && !PLATFORM(QT) #define WTF_USE_PTHREADS 1 #define HAVE_PTHREAD_RWLOCK 1 #endif -- cgit v0.12 From c84d09e1c5dd8fc3e989a07372abba8ed589ec67 Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Mon, 7 Mar 2011 15:24:42 +0100 Subject: Build QProcess on platforms that don't have _NSGetEnviron MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Jørgen Lind --- src/corelib/io/qprocess.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index a44c1e1..e11cef9 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -2232,10 +2232,10 @@ bool QProcess::startDetached(const QString &program) } QT_BEGIN_INCLUDE_NAMESPACE -#ifdef Q_OS_MAC +#if defined(Q_OS_MAC) && !defined(QT_NO_CORESERVICES) # include <crt_externs.h> # define environ (*_NSGetEnviron()) -#elif defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) +#elif defined(Q_OS_WINCE) || defined(Q_OS_SYMBIAN) || (defined(Q_OS_MAC) && defined(QT_NO_CORESERVICES)) static char *qt_empty_environ[] = { 0 }; #define environ qt_empty_environ #elif !defined(Q_OS_WIN) -- cgit v0.12 From e250660cced1f0bcb16494c23277f9205833ec03 Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Mon, 18 Oct 2010 09:49:18 +0200 Subject: Add proof-of-concept UIKit based lighthouse platform. See the README in the uikit platform plugin for details. --- mkspecs/qws/macx-iphonedevice-g++/Info.plist.lib | 18 + mkspecs/qws/macx-iphonedevice-g++/qmake.conf | 44 ++ mkspecs/qws/macx-iphonedevice-g++/qplatformdefs.h | 97 +++++ .../qws/macx-iphonesimulator-g++/Info.plist.lib | 18 + mkspecs/qws/macx-iphonesimulator-g++/qmake.conf | 45 ++ .../qws/macx-iphonesimulator-g++/qplatformdefs.h | 97 +++++ src/plugins/platforms/uikit/README | 45 ++ .../platforms/uikit/examples/qmltest/main.mm | 33 ++ .../platforms/uikit/examples/qmltest/qml/main.qml | 112 +++++ .../moc_qmlapplicationviewer.cpp | 69 ++++ .../qmlapplicationviewer/qmlapplicationviewer.cpp | 155 +++++++ .../qmlapplicationviewer/qmlapplicationviewer.h | 39 ++ .../uikit/examples/qmltest/qmltest-Info.plist | 28 ++ .../qmltest/qmltest.xcodeproj/project.pbxproj | 455 +++++++++++++++++++++ .../uikit/examples/qmltest/qmltest_Prefix.pch | 8 + src/plugins/platforms/uikit/main.mm | 74 ++++ src/plugins/platforms/uikit/quikiteventloop.h | 68 +++ src/plugins/platforms/uikit/quikiteventloop.mm | 158 +++++++ src/plugins/platforms/uikit/quikitintegration.h | 72 ++++ src/plugins/platforms/uikit/quikitintegration.mm | 104 +++++ src/plugins/platforms/uikit/quikitscreen.h | 75 ++++ src/plugins/platforms/uikit/quikitscreen.mm | 81 ++++ src/plugins/platforms/uikit/quikitwindow.h | 70 ++++ src/plugins/platforms/uikit/quikitwindow.mm | 88 ++++ src/plugins/platforms/uikit/quikitwindowsurface.h | 83 ++++ src/plugins/platforms/uikit/quikitwindowsurface.mm | 242 +++++++++++ src/plugins/platforms/uikit/uikit.pro | 23 ++ 27 files changed, 2401 insertions(+) create mode 100644 mkspecs/qws/macx-iphonedevice-g++/Info.plist.lib create mode 100644 mkspecs/qws/macx-iphonedevice-g++/qmake.conf create mode 100644 mkspecs/qws/macx-iphonedevice-g++/qplatformdefs.h create mode 100644 mkspecs/qws/macx-iphonesimulator-g++/Info.plist.lib create mode 100644 mkspecs/qws/macx-iphonesimulator-g++/qmake.conf create mode 100644 mkspecs/qws/macx-iphonesimulator-g++/qplatformdefs.h create mode 100644 src/plugins/platforms/uikit/README create mode 100644 src/plugins/platforms/uikit/examples/qmltest/main.mm create mode 100644 src/plugins/platforms/uikit/examples/qmltest/qml/main.qml create mode 100644 src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp create mode 100644 src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp create mode 100644 src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h create mode 100644 src/plugins/platforms/uikit/examples/qmltest/qmltest-Info.plist create mode 100755 src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj create mode 100644 src/plugins/platforms/uikit/examples/qmltest/qmltest_Prefix.pch create mode 100644 src/plugins/platforms/uikit/main.mm create mode 100644 src/plugins/platforms/uikit/quikiteventloop.h create mode 100644 src/plugins/platforms/uikit/quikiteventloop.mm create mode 100644 src/plugins/platforms/uikit/quikitintegration.h create mode 100644 src/plugins/platforms/uikit/quikitintegration.mm create mode 100644 src/plugins/platforms/uikit/quikitscreen.h create mode 100644 src/plugins/platforms/uikit/quikitscreen.mm create mode 100644 src/plugins/platforms/uikit/quikitwindow.h create mode 100644 src/plugins/platforms/uikit/quikitwindow.mm create mode 100644 src/plugins/platforms/uikit/quikitwindowsurface.h create mode 100644 src/plugins/platforms/uikit/quikitwindowsurface.mm create mode 100644 src/plugins/platforms/uikit/uikit.pro diff --git a/mkspecs/qws/macx-iphonedevice-g++/Info.plist.lib b/mkspecs/qws/macx-iphonedevice-g++/Info.plist.lib new file mode 100644 index 0000000..97609ed --- /dev/null +++ b/mkspecs/qws/macx-iphonedevice-g++/Info.plist.lib @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> +<plist version="0.9"> +<dict> + <key>CFBundlePackageType</key> + <string>FMWK</string> + <key>CFBundleShortVersionString</key> + <string>@SHORT_VERSION@</string> + <key>CFBundleGetInfoString</key> + <string>Created by Qt/QMake</string> + <key>CFBundleSignature</key> + <string>@TYPEINFO@</string> + <key>CFBundleExecutable</key> + <string>@LIBRARY@</string> + <key>NOTE</key> + <string>Please, do NOT change this file -- It was generated by Qt/QMake.</string> +</dict> +</plist> diff --git a/mkspecs/qws/macx-iphonedevice-g++/qmake.conf b/mkspecs/qws/macx-iphonedevice-g++/qmake.conf new file mode 100644 index 0000000..2cef3df --- /dev/null +++ b/mkspecs/qws/macx-iphonedevice-g++/qmake.conf @@ -0,0 +1,44 @@ +# +# qmake configuration for iphone-device-g++ +# +include(../../common/mac.conf) +include(../../common/g++-macx.conf) + +MAKEFILE_GENERATOR = UNIX +TEMPLATE = app +CONFIG += qt warn_on release app_bundle incremental global_init_link_order lib_version_first plugin_no_soname link_prl +QT += core gui +QMAKE_INCREMENTAL_STYLE = sublib + +# Do not compile a few things +DEFINES += QT_NO_AUDIO_BACKEND QT_NO_NETWORKPROXY QT_NO_FILESYSTEMWATCHER + +# You may need to change this to point to the iOS SDK you want to use. +QMAKE_IOS_DEV_PATH = /Developer/Platforms/iPhoneOS.platform/Developer +QMAKE_IOS_SDK = $$QMAKE_IOS_DEV_PATH/SDKs/iPhoneOS4.2.sdk +DEFINES += __IPHONE_OS_VERSION_MIN_REQUIRED=40200 + +#clear +QMAKE_MACOSX_DEPLOYMENT_TARGET = + +# TARGET_PLATFORM = ios +QMAKE_CC = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2 +QMAKE_CXX = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++-4.2 +QMAKE_LINK = $$QMAKE_CXX +QMAKE_LINK_SHLIB = $$QMAKE_CXX + +QMAKE_CFLAGS += -arch armv7 -marm -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2 -gdwarf-2 +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS +QMAKE_OBJECTIVE_CFLAGS += -arch armv7 -marm -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2 -gdwarf-2 -fobjc-abi-version=2 -fobjc-legacy-dispatch +QMAKE_LFLAGS += -arch armv7 -marm -miphoneos-version-min=4.2 -Wl,-syslibroot,$$QMAKE_IOS_SDK + +QMAKE_INCDIR_OPENGL = +QMAKE_LIBS_OPENGL = +QMAKE_LIBS_OPENGL_QT = + +#QMAKE_RESOURCE = +QMAKE_FIX_RPATH = $$QMAKE_IOS_DEV_PATH/usr/bin/install_name_tool -id +QMAKE_AR = $$QMAKE_IOS_DEV_PATH/usr/bin/ar cq +QMAKE_RANLIB = $$QMAKE_IOS_DEV_PATH/usr/bin/ranlib -s + +load(qt_config) diff --git a/mkspecs/qws/macx-iphonedevice-g++/qplatformdefs.h b/mkspecs/qws/macx-iphonedevice-g++/qplatformdefs.h new file mode 100644 index 0000000..425fda3 --- /dev/null +++ b/mkspecs/qws/macx-iphonedevice-g++/qplatformdefs.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMDEFS_H +#define QPLATFORMDEFS_H + +// Get Qt defines/settings + +#include "qglobal.h" + +// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs + +#include <unistd.h> + + +// We are hot - unistd.h should have turned on the specific APIs we requested + + +#include <pthread.h> +#include <dirent.h> +#include <fcntl.h> +#include <grp.h> +#include <pwd.h> +#include <signal.h> +#define QT_NO_LIBRARY_UNLOAD + +#include <sys/types.h> +#include <sys/ioctl.h> +#include <sys/ipc.h> +#include <sys/time.h> +#include <sys/shm.h> +#include <sys/socket.h> +#include <sys/stat.h> +#include <sys/wait.h> +#include <netinet/in.h> +#ifndef QT_NO_IPV6IFNAME +#include <net/if.h> +#endif + +#include "../../common/posix/qplatformdefs.h" + +#undef QT_OPEN_LARGEFILE +#undef QT_SOCKLEN_T +#undef QT_SIGNAL_IGNORE + +#define QT_OPEN_LARGEFILE 0 + +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) +#define QT_SOCKLEN_T socklen_t +#else +#define QT_SOCKLEN_T int +#endif + +#define QT_SIGNAL_IGNORE (void (*)(int))1 + +#define QT_SNPRINTF ::snprintf +#define QT_VSNPRINTF ::vsnprintf + +#endif // QPLATFORMDEFS_H diff --git a/mkspecs/qws/macx-iphonesimulator-g++/Info.plist.lib b/mkspecs/qws/macx-iphonesimulator-g++/Info.plist.lib new file mode 100644 index 0000000..97609ed --- /dev/null +++ b/mkspecs/qws/macx-iphonesimulator-g++/Info.plist.lib @@ -0,0 +1,18 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList.dtd"> +<plist version="0.9"> +<dict> + <key>CFBundlePackageType</key> + <string>FMWK</string> + <key>CFBundleShortVersionString</key> + <string>@SHORT_VERSION@</string> + <key>CFBundleGetInfoString</key> + <string>Created by Qt/QMake</string> + <key>CFBundleSignature</key> + <string>@TYPEINFO@</string> + <key>CFBundleExecutable</key> + <string>@LIBRARY@</string> + <key>NOTE</key> + <string>Please, do NOT change this file -- It was generated by Qt/QMake.</string> +</dict> +</plist> diff --git a/mkspecs/qws/macx-iphonesimulator-g++/qmake.conf b/mkspecs/qws/macx-iphonesimulator-g++/qmake.conf new file mode 100644 index 0000000..9a06857 --- /dev/null +++ b/mkspecs/qws/macx-iphonesimulator-g++/qmake.conf @@ -0,0 +1,45 @@ +# +# qmake configuration for macx-g++ +# +include(../../common/mac.conf) +include(../../common/g++-macx.conf) + +MAKEFILE_GENERATOR = UNIX +TEMPLATE = app +CONFIG += qt warn_on release app_bundle incremental global_init_link_order lib_version_first plugin_no_soname link_prl +QT += core gui +QMAKE_INCREMENTAL_STYLE = sublib + +# Do not compile a few things +DEFINES += QT_NO_AUDIO_BACKEND QT_NO_NETWORKPROXY QT_NO_FILESYSTEMWATCHER + +# You may need to change this to point to the iOS SDK you want to use. +QMAKE_IOS_DEV_PATH = /Developer/Platforms/iPhoneSimulator.platform/Developer +QMAKE_IOS_SDK = $$QMAKE_IOS_DEV_PATH/SDKs/iPhoneSimulator4.2.sdk +DEFINES += __IPHONE_OS_VERSION_MIN_REQUIRED=40200 +#clear +QMAKE_MACOSX_DEPLOYMENT_TARGET = + +# TARGET_PLATFORM = ios +QMAKE_CC = /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/gcc-4.2 +QMAKE_CXX = /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 +QMAKE_LINK = $$QMAKE_CXX +QMAKE_LINK_SHLIB = $$QMAKE_CXX + +QMAKE_CFLAGS += -arch i386 -isysroot $$QMAKE_IOS_SDK +QMAKE_CXXFLAGS += $$QMAKE_CFLAGS +QMAKE_OBJECTIVE_CFLAGS += -arch i386 -isysroot $$QMAKE_IOS_SDK -fobjc-abi-version=2 -fobjc-legacy-dispatch +QMAKE_LFLAGS += -arch i386 -Wl,-syslibroot,$$QMAKE_IOS_SDK + +QMAKE_INCDIR_OPENGL = +QMAKE_LIBS_OPENGL = +QMAKE_LIBS_OPENGL_QT = + +#QMAKE_RESOURCE = +QMAKE_FIX_RPATH = $$QMAKE_IOS_DEV_PATH/usr/bin/install_name_tool -id +QMAKE_AR = $$QMAKE_IOS_DEV_PATH/usr/bin/ar cq +QMAKE_RANLIB = $$QMAKE_IOS_DEV_PATH/usr/bin/ranlib -s + +load(qt_config) + +QMAKE_OBJECTIVE_CFLAGS_X86 += -arch i386 -isysroot $$QMAKE_IOS_SDK -fobjc-abi-version=2 -fobjc-legacy-dispatch diff --git a/mkspecs/qws/macx-iphonesimulator-g++/qplatformdefs.h b/mkspecs/qws/macx-iphonesimulator-g++/qplatformdefs.h new file mode 100644 index 0000000..425fda3 --- /dev/null +++ b/mkspecs/qws/macx-iphonesimulator-g++/qplatformdefs.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMDEFS_H +#define QPLATFORMDEFS_H + +// Get Qt defines/settings + +#include "qglobal.h" + +// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs + +#include <unistd.h> + + +// We are hot - unistd.h should have turned on the specific APIs we requested + + +#include <pthread.h> +#include <dirent.h> +#include <fcntl.h> +#include <grp.h> +#include <pwd.h> +#include <signal.h> +#define QT_NO_LIBRARY_UNLOAD + +#include <sys/types.h> +#include <sys/ioctl.h> +#include <sys/ipc.h> +#include <sys/time.h> +#include <sys/shm.h> +#include <sys/socket.h> +#include <sys/stat.h> +#include <sys/wait.h> +#include <netinet/in.h> +#ifndef QT_NO_IPV6IFNAME +#include <net/if.h> +#endif + +#include "../../common/posix/qplatformdefs.h" + +#undef QT_OPEN_LARGEFILE +#undef QT_SOCKLEN_T +#undef QT_SIGNAL_IGNORE + +#define QT_OPEN_LARGEFILE 0 + +#if (MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_4) +#define QT_SOCKLEN_T socklen_t +#else +#define QT_SOCKLEN_T int +#endif + +#define QT_SIGNAL_IGNORE (void (*)(int))1 + +#define QT_SNPRINTF ::snprintf +#define QT_VSNPRINTF ::vsnprintf + +#endif // QPLATFORMDEFS_H diff --git a/src/plugins/platforms/uikit/README b/src/plugins/platforms/uikit/README new file mode 100644 index 0000000..19ec83f --- /dev/null +++ b/src/plugins/platforms/uikit/README @@ -0,0 +1,45 @@ +This is a proof-of-concept implemenation of a UIKit based +QPA plugin. Note that this is completely unsupported, and it is probable +that many parts of QtCore and other Qt Modules don't work properly. + +1) Build Qt + +The example Xcode project in the examples subdirectory requires that you do shadow +builds of Qt in qt-lighthouse-ios-simulator and qt-lighthouse-ios-device directories +parallel to the sources. To build for simulator make sure that both the Simulator +configuration *and* the simulator specific target are active. To build for device +make sure that both the Device configuration *and* the device specific target are +active. + +The setup is configured to use the iOS 4.2 SDKs, you might want to edit the mkspecs +to fit your need. + +After configuring and building Qt you need to also build src/plugins/platforms/uikit. + +Simulator: +---------- +configure -qpa -xplatform qws/macx-iphonesimulator-g++ -arch i386 -developer-build -no-accessibility -no-qt3support -no-xmlpatterns -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -no-opengl -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations + +Device: +------- +configure -qpa -xplatform qws/macx-iphonedevice-g++ -arch armv7 -developer-build -no-accessibility -no-qt3support -no-xmlpatterns -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -no-opengl -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations + +2) XCode setup: +- there are examples in the examples subdirectory of the platform plugin +- to create something fresh do something like: + - Xcode: Create a "View-based Appplication" + - remove the nibs and view controller and app controller files + - remove the reference to "Main nib file" from plist file + - create a main.mm like in the examples + - add the qmlapplicationviewer sources to your project (including the moc_*.h) + (best to link, not copy), the code for this is from the Qt Creator + mobile Qt Quick application template + - Add the Qt .a libraries, uikit platform plugin and libz (v1.2.3) to Frameworks + - add "$(SRCROOT)/../../../../qt-lighthouse-ios-device/include" (or -simulator) + to the include search paths. + - add "$(SRCROOT)/../qmltest" to the include search path if you didn't copy but + linked to the qmlapplicationviewer + - for device set the architecture to armv7 only + +3) Done: Build and Run. + diff --git a/src/plugins/platforms/uikit/examples/qmltest/main.mm b/src/plugins/platforms/uikit/examples/qmltest/main.mm new file mode 100644 index 0000000..d90be56 --- /dev/null +++ b/src/plugins/platforms/uikit/examples/qmltest/main.mm @@ -0,0 +1,33 @@ +// +// main.m +// qmltest +// +// Created by Eike Troll on 18.02.11. +// Copyright 2011 __MyCompanyName__. All rights reserved. +// + +#import <UIKit/UIKit.h> + +#include "qmlapplicationviewer/qmlapplicationviewer.h" + +#include <QtGui/QApplication> +#include <QtCore/QtPlugin> + +Q_IMPORT_PLUGIN(UIKit) + +int main(int argc, char *argv[]) { + + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + + setenv("QT_QPA_PLATFORM","uikit",1); + + QApplication app(argc, argv); + QmlApplicationViewer viewer; + viewer.setOrientation(QmlApplicationViewer::ScreenOrientationAuto); + NSString *resourcePath = [[NSBundle mainBundle] resourcePath]; + viewer.setMainQmlFile(QString::fromUtf8([[resourcePath stringByAppendingPathComponent:@"qml/main.qml"] UTF8String])); + viewer.showMaximized(); + int retVal = app.exec(); + [pool release]; + return retVal; +} diff --git a/src/plugins/platforms/uikit/examples/qmltest/qml/main.qml b/src/plugins/platforms/uikit/examples/qmltest/qml/main.qml new file mode 100644 index 0000000..889a6d0 --- /dev/null +++ b/src/plugins/platforms/uikit/examples/qmltest/qml/main.qml @@ -0,0 +1,112 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 1.0 + +Rectangle { + id: box + width: 350; height: 250 + + Rectangle { + id: redSquare + width: 80; height: 80 + anchors.top: parent.top; anchors.left: parent.left; anchors.margins: 10 + color: "red" + + Text { text: "Click"; font.pixelSize: 16; anchors.centerIn: parent } + + MouseArea { + anchors.fill: parent + hoverEnabled: true + acceptedButtons: Qt.LeftButton | Qt.RightButton + + onEntered: info.text = 'Entered' + onExited: info.text = 'Exited (pressed=' + pressed + ')' + + onPressed: { + info.text = 'Pressed (button=' + (mouse.button == Qt.RightButton ? 'right' : 'left') + + ' shift=' + (mouse.modifiers & Qt.ShiftModifier ? 'true' : 'false') + ')' + var posInBox = redSquare.mapToItem(box, mouse.x, mouse.y) + posInfo.text = + mouse.x + ',' + mouse.y + ' in square' + + ' (' + posInBox.x + ',' + posInBox.y + ' in window)' + } + + onReleased: { + info.text = 'Released (isClick=' + mouse.isClick + ' wasHeld=' + mouse.wasHeld + ')' + posInfo.text = '' + } + + onPressAndHold: info.text = 'Press and hold' + onClicked: info.text = 'Clicked (wasHeld=' + mouse.wasHeld + ')' + onDoubleClicked: info.text = 'Double clicked' + } + } + + Rectangle { + id: blueSquare + width: 80; height: 80 + x: box.width - width - 10; y: 10 // making this item draggable, so don't use anchors + color: "blue" + + Text { text: "Drag"; font.pixelSize: 16; color: "white"; anchors.centerIn: parent } + + MouseArea { + anchors.fill: parent + drag.target: blueSquare + drag.axis: Drag.XandYAxis + drag.minimumX: 0 + drag.maximumX: box.width - parent.width + drag.minimumY: 0 + drag.maximumY: box.height - parent.width + } + } + + Text { + id: info + anchors.bottom: posInfo.top; anchors.horizontalCenter: parent.horizontalCenter; anchors.margins: 30 + + onTextChanged: console.log(text) + } + + Text { + id: posInfo + anchors.bottom: parent.bottom; anchors.horizontalCenter: parent.horizontalCenter; anchors.margins: 30 + } +} diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp new file mode 100644 index 0000000..7733ce2 --- /dev/null +++ b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp @@ -0,0 +1,69 @@ +/**************************************************************************** +** Meta object code from reading C++ file 'qmlapplicationviewer.h' +** +** Created: Fri Feb 18 17:53:42 2011 +** by: The Qt Meta Object Compiler version 62 (Qt 4.7.2) +** +** WARNING! All changes made in this file will be lost! +*****************************************************************************/ + +#include "qmlapplicationviewer.h" +#if !defined(Q_MOC_OUTPUT_REVISION) +#error "The header file 'qmlapplicationviewer.h' doesn't include <QObject>." +#elif Q_MOC_OUTPUT_REVISION != 62 +#error "This file was generated using the moc from 4.7.2. It" +#error "cannot be used with the include files from this version of Qt." +#error "(The moc has changed too much.)" +#endif + +QT_BEGIN_MOC_NAMESPACE +static const uint qt_meta_data_QmlApplicationViewer[] = { + + // content: + 5, // revision + 0, // classname + 0, 0, // classinfo + 0, 0, // methods + 0, 0, // properties + 0, 0, // enums/sets + 0, 0, // constructors + 0, // flags + 0, // signalCount + + 0 // eod +}; + +static const char qt_meta_stringdata_QmlApplicationViewer[] = { + "QmlApplicationViewer\0" +}; + +const QMetaObject QmlApplicationViewer::staticMetaObject = { + { &QDeclarativeView::staticMetaObject, qt_meta_stringdata_QmlApplicationViewer, + qt_meta_data_QmlApplicationViewer, 0 } +}; + +#ifdef Q_NO_DATA_RELOCATION +const QMetaObject &QmlApplicationViewer::getStaticMetaObject() { return staticMetaObject; } +#endif //Q_NO_DATA_RELOCATION + +const QMetaObject *QmlApplicationViewer::metaObject() const +{ + return QObject::d_ptr->metaObject ? QObject::d_ptr->metaObject : &staticMetaObject; +} + +void *QmlApplicationViewer::qt_metacast(const char *_clname) +{ + if (!_clname) return 0; + if (!strcmp(_clname, qt_meta_stringdata_QmlApplicationViewer)) + return static_cast<void*>(const_cast< QmlApplicationViewer*>(this)); + return QDeclarativeView::qt_metacast(_clname); +} + +int QmlApplicationViewer::qt_metacall(QMetaObject::Call _c, int _id, void **_a) +{ + _id = QDeclarativeView::qt_metacall(_c, _id, _a); + if (_id < 0) + return _id; + return _id; +} +QT_END_MOC_NAMESPACE diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp new file mode 100644 index 0000000..7844e46 --- /dev/null +++ b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -0,0 +1,155 @@ +// checksum 0x17fa version 0x3000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#include "qmlapplicationviewer.h" + +#include <QtCore/QCoreApplication> +#include <QtCore/QDir> +#include <QtCore/QFileInfo> +#include <QtDeclarative/QDeclarativeComponent> +#include <QtDeclarative/QDeclarativeEngine> +#include <QtDeclarative/QDeclarativeContext> + +#if defined(QMLJSDEBUGGER) +#include <qt_private/qdeclarativedebughelper_p.h> +#endif + +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) +#include <jsdebuggeragent.h> +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) +#include <qdeclarativeviewobserver.h> +#endif + +#if defined(QMLJSDEBUGGER) + +// Enable debugging before any QDeclarativeEngine is created +struct QmlJsDebuggingEnabler +{ + QmlJsDebuggingEnabler() + { + QDeclarativeDebugHelper::enableDebugging(); + } +}; + +// Execute code in constructor before first QDeclarativeEngine is instantiated +static QmlJsDebuggingEnabler enableDebuggingHelper; + +#endif // QMLJSDEBUGGER + +class QmlApplicationViewerPrivate +{ + QString mainQmlFile; + friend class QmlApplicationViewer; + static QString adjustPath(const QString &path); +}; + +QString QmlApplicationViewerPrivate::adjustPath(const QString &path) +{ +#ifdef Q_OS_UNIX +#ifdef Q_OS_MAC + if (!QDir::isAbsolutePath(path)) + return QCoreApplication::applicationDirPath() + + QLatin1String("/../Resources/") + path; +#else + const QString pathInShareDir = QCoreApplication::applicationDirPath() + + QLatin1String("/../share/") + + QFileInfo(QCoreApplication::applicationFilePath()).fileName() + + QLatin1Char('/') + path; + if (QFileInfo(pathInShareDir).exists()) + return pathInShareDir; +#endif +#endif + return path; +} + +QmlApplicationViewer::QmlApplicationViewer(QWidget *parent) : + QDeclarativeView(parent), + m_d(new QmlApplicationViewerPrivate) +{ + connect(engine(), SIGNAL(quit()), SLOT(close())); + setResizeMode(QDeclarativeView::SizeRootObjectToView); +#if defined(QMLJSDEBUGGER) && !defined(NO_JSDEBUGGER) + new QmlJSDebugger::JSDebuggerAgent(engine()); +#endif +#if defined(QMLJSDEBUGGER) && !defined(NO_QMLOBSERVER) + new QmlJSDebugger::QDeclarativeViewObserver(this, parent); +#endif +} + +QmlApplicationViewer::~QmlApplicationViewer() +{ + delete m_d; +} + +void QmlApplicationViewer::setMainQmlFile(const QString &file) +{ + m_d->mainQmlFile = QmlApplicationViewerPrivate::adjustPath(file); + setSource(QUrl::fromLocalFile(m_d->mainQmlFile)); +} + +void QmlApplicationViewer::addImportPath(const QString &path) +{ + engine()->addImportPath(QmlApplicationViewerPrivate::adjustPath(path)); +} + +void QmlApplicationViewer::setOrientation(ScreenOrientation orientation) +{ +//#if defined(Q_OS_SYMBIAN) +// // If the version of Qt on the device is < 4.7.2, that attribute won't work +// if (orientation != ScreenOrientationAuto) { +// const QStringList v = QString::fromAscii(qVersion()).split(QLatin1Char('.')); +// if (v.count() == 3 && (v.at(0).toInt() << 16 | v.at(1).toInt() << 8 | v.at(2).toInt()) < 0x040702) { +// qWarning("Screen orientation locking only supported with Qt 4.7.2 and above"); +// return; +// } +// } +//#endif // Q_OS_SYMBIAN +// +// Qt::WidgetAttribute attribute; +// switch (orientation) { +//#if QT_VERSION < 0x040702 +// // Qt < 4.7.2 does not yet have the Qt::WA_*Orientation attributes +// case ScreenOrientationLockPortrait: +// attribute = static_cast<Qt::WidgetAttribute>(128); +// break; +// case ScreenOrientationLockLandscape: +// attribute = static_cast<Qt::WidgetAttribute>(129); +// break; +// default: +// case ScreenOrientationAuto: +// attribute = static_cast<Qt::WidgetAttribute>(130); +// break; +//#else // QT_VERSION < 0x040702 +// case ScreenOrientationLockPortrait: +// attribute = Qt::WA_LockPortraitOrientation; +// break; +// case ScreenOrientationLockLandscape: +// attribute = Qt::WA_LockLandscapeOrientation; +// break; +// default: +// case ScreenOrientationAuto: +// attribute = Qt::WA_AutoOrientation; +// break; +//#endif // QT_VERSION < 0x040702 +// }; +// setAttribute(attribute, true); +} + +void QmlApplicationViewer::showExpanded() +{ +#ifdef Q_OS_SYMBIAN + showFullScreen(); +#elif defined(Q_WS_MAEMO_5) || defined(Q_WS_MAEMO_6) + showMaximized(); +#else + show(); +#endif +} diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h new file mode 100644 index 0000000..0e4de04 --- /dev/null +++ b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h @@ -0,0 +1,39 @@ +// checksum 0x5a59 version 0x3000a +/* + This file was generated by the Qt Quick Application wizard of Qt Creator. + QmlApplicationViewer is a convenience class containing mobile device specific + code such as screen orientation handling. Also QML paths and debugging are + handled here. + It is recommended not to modify this file, since newer versions of Qt Creator + may offer an updated version of it. +*/ + +#ifndef QMLAPPLICATIONVIEWER_H +#define QMLAPPLICATIONVIEWER_H + +#include <QtDeclarative/QDeclarativeView> + +class QmlApplicationViewer : public QDeclarativeView +{ + Q_OBJECT + +public: + enum ScreenOrientation { + ScreenOrientationLockPortrait, + ScreenOrientationLockLandscape, + ScreenOrientationAuto + }; + + explicit QmlApplicationViewer(QWidget *parent = 0); + virtual ~QmlApplicationViewer(); + + void setMainQmlFile(const QString &file); + void addImportPath(const QString &path); + void setOrientation(ScreenOrientation orientation); + void showExpanded(); + +private: + class QmlApplicationViewerPrivate *m_d; +}; + +#endif // QMLAPPLICATIONVIEWER_H diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmltest-Info.plist b/src/plugins/platforms/uikit/examples/qmltest/qmltest-Info.plist new file mode 100644 index 0000000..1566585 --- /dev/null +++ b/src/plugins/platforms/uikit/examples/qmltest/qmltest-Info.plist @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleDisplayName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundleExecutable</key> + <string>${EXECUTABLE_NAME}</string> + <key>CFBundleIconFile</key> + <string></string> + <key>CFBundleIdentifier</key> + <string>com.yourcompany.${PRODUCT_NAME:rfc1034identifier}</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundleName</key> + <string>${PRODUCT_NAME}</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>1.0</string> + <key>LSRequiresIPhoneOS</key> + <true/> +</dict> +</plist> diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj b/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj new file mode 100755 index 0000000..e105b73 --- /dev/null +++ b/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj @@ -0,0 +1,455 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + +/* Begin PBXBuildFile section */ + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; + 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; + D3CAA7C813264AAD008BB877 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = D3CAA7C713264AAD008BB877 /* main.mm */; }; + D3CAA7E613264EA6008BB877 /* moc_qmlapplicationviewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3CAA7E313264EA6008BB877 /* moc_qmlapplicationviewer.cpp */; }; + D3CAA7E713264EA6008BB877 /* qmlapplicationviewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3CAA7E413264EA6008BB877 /* qmlapplicationviewer.cpp */; }; + D3CAA7EC13264F52008BB877 /* main.mm in Sources */ = {isa = PBXBuildFile; fileRef = D3CAA7C713264AAD008BB877 /* main.mm */; }; + D3CAA7ED13264F52008BB877 /* moc_qmlapplicationviewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3CAA7E313264EA6008BB877 /* moc_qmlapplicationviewer.cpp */; }; + D3CAA7EE13264F52008BB877 /* qmlapplicationviewer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D3CAA7E413264EA6008BB877 /* qmlapplicationviewer.cpp */; }; + D3CAA7F013264F52008BB877 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; + D3CAA7F113264F52008BB877 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; + D3CAA7F213264F52008BB877 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; + D3CAA7FA13264F8A008BB877 /* libz.1.2.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */; }; + D3CAA80613264FD5008BB877 /* libQtCore_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7FB13264FB9008BB877 /* libQtCore_debug.a */; }; + D3CAA80713264FD5008BB877 /* libQtDeclarative_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7FC13264FB9008BB877 /* libQtDeclarative_debug.a */; }; + D3CAA80813264FD6008BB877 /* libQtGui_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7FD13264FB9008BB877 /* libQtGui_debug.a */; }; + D3CAA80913264FD6008BB877 /* libQtScript_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7FE13264FB9008BB877 /* libQtScript_debug.a */; }; + D3CAA80A13264FD7008BB877 /* libQtSql_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7FF13264FB9008BB877 /* libQtSql_debug.a */; }; + D3CAA81113264FF0008BB877 /* libz.1.2.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */; }; + D3CAA81313265005008BB877 /* libquikit_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81213265005008BB877 /* libquikit_debug.a */; }; + D3CAA81B13265056008BB877 /* libQtCore_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81613265056008BB877 /* libQtCore_debug.a */; }; + D3CAA81C13265056008BB877 /* libQtDeclarative_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81713265056008BB877 /* libQtDeclarative_debug.a */; }; + D3CAA81D13265056008BB877 /* libQtGui_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81813265056008BB877 /* libQtGui_debug.a */; }; + D3CAA81E13265056008BB877 /* libQtScript_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81913265056008BB877 /* libQtScript_debug.a */; }; + D3CAA81F13265056008BB877 /* libQtSql_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81A13265056008BB877 /* libQtSql_debug.a */; }; + D3CAA8211326507D008BB877 /* libquikit_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA8201326507D008BB877 /* libquikit_debug.a */; }; + D3CAA8261326520A008BB877 /* libQtNetwork_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA8251326520A008BB877 /* libQtNetwork_debug.a */; }; + D3CAA82813265220008BB877 /* libQtNetwork_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA82713265220008BB877 /* libQtNetwork_debug.a */; }; + D3CAA88A132652E5008BB877 /* fonts in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA836132652E5008BB877 /* fonts */; }; + D3CAA88B132652E5008BB877 /* fonts in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA836132652E5008BB877 /* fonts */; }; + D3CAA89113265310008BB877 /* qml in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA88E13265310008BB877 /* qml */; }; + D3CAA89213265310008BB877 /* qml in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA88E13265310008BB877 /* qml */; }; +/* End PBXBuildFile section */ + +/* Begin PBXFileReference section */ + 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 1D6058910D05DD3D006BFB54 /* qmltest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = qmltest.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 288765A40DF7441C002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 32CA4F630368D1EE00C91783 /* qmltest_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = qmltest_Prefix.pch; sourceTree = "<group>"; }; + 8D1107310486CEB800E47090 /* qmltest-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = "qmltest-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = "<group>"; }; + D3CAA7C713264AAD008BB877 /* main.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = main.mm; sourceTree = "<group>"; }; + D3CAA7E313264EA6008BB877 /* moc_qmlapplicationviewer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = moc_qmlapplicationviewer.cpp; path = qmlapplicationviewer/moc_qmlapplicationviewer.cpp; sourceTree = "<group>"; }; + D3CAA7E413264EA6008BB877 /* qmlapplicationviewer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = qmlapplicationviewer.cpp; path = qmlapplicationviewer/qmlapplicationviewer.cpp; sourceTree = "<group>"; }; + D3CAA7E513264EA6008BB877 /* qmlapplicationviewer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = qmlapplicationviewer.h; path = qmlapplicationviewer/qmlapplicationviewer.h; sourceTree = "<group>"; }; + D3CAA7F613264F52008BB877 /* qmltest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = qmltest.app; sourceTree = BUILT_PRODUCTS_DIR; }; + D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.1.2.3.dylib; path = usr/lib/libz.1.2.3.dylib; sourceTree = SDKROOT; }; + D3CAA7FB13264FB9008BB877 /* libQtCore_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtCore_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtCore_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA7FC13264FB9008BB877 /* libQtDeclarative_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtDeclarative_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtDeclarative_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA7FD13264FB9008BB877 /* libQtGui_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtGui_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtGui_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA7FE13264FB9008BB877 /* libQtScript_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtScript_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtScript_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA7FF13264FB9008BB877 /* libQtSql_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtSql_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtSql_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA81213265005008BB877 /* libquikit_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libquikit_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/plugins/platforms/libquikit_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA81613265056008BB877 /* libQtCore_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtCore_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtCore_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA81713265056008BB877 /* libQtDeclarative_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtDeclarative_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtDeclarative_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA81813265056008BB877 /* libQtGui_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtGui_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtGui_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA81913265056008BB877 /* libQtScript_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtScript_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtScript_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA81A13265056008BB877 /* libQtSql_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtSql_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtSql_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA8201326507D008BB877 /* libquikit_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libquikit_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/plugins/platforms/libquikit_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA8251326520A008BB877 /* libQtNetwork_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtNetwork_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtNetwork_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA82713265220008BB877 /* libQtNetwork_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtNetwork_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtNetwork_debug.a"; sourceTree = SOURCE_ROOT; }; + D3CAA836132652E5008BB877 /* fonts */ = {isa = PBXFileReference; lastKnownFileType = folder; name = fonts; path = ../../../../../../lib/fonts; sourceTree = SOURCE_ROOT; }; + D3CAA88E13265310008BB877 /* qml */ = {isa = PBXFileReference; lastKnownFileType = folder; path = qml; sourceTree = SOURCE_ROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, + 288765A50DF7441C002DB57D /* CoreGraphics.framework in Frameworks */, + D3CAA7FA13264F8A008BB877 /* libz.1.2.3.dylib in Frameworks */, + D3CAA81B13265056008BB877 /* libQtCore_debug.a in Frameworks */, + D3CAA81C13265056008BB877 /* libQtDeclarative_debug.a in Frameworks */, + D3CAA81D13265056008BB877 /* libQtGui_debug.a in Frameworks */, + D3CAA81E13265056008BB877 /* libQtScript_debug.a in Frameworks */, + D3CAA81F13265056008BB877 /* libQtSql_debug.a in Frameworks */, + D3CAA8211326507D008BB877 /* libquikit_debug.a in Frameworks */, + D3CAA82813265220008BB877 /* libQtNetwork_debug.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3CAA7EF13264F52008BB877 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + D3CAA7F013264F52008BB877 /* Foundation.framework in Frameworks */, + D3CAA7F113264F52008BB877 /* UIKit.framework in Frameworks */, + D3CAA7F213264F52008BB877 /* CoreGraphics.framework in Frameworks */, + D3CAA80613264FD5008BB877 /* libQtCore_debug.a in Frameworks */, + D3CAA80713264FD5008BB877 /* libQtDeclarative_debug.a in Frameworks */, + D3CAA80813264FD6008BB877 /* libQtGui_debug.a in Frameworks */, + D3CAA80913264FD6008BB877 /* libQtScript_debug.a in Frameworks */, + D3CAA80A13264FD7008BB877 /* libQtSql_debug.a in Frameworks */, + D3CAA81113264FF0008BB877 /* libz.1.2.3.dylib in Frameworks */, + D3CAA81313265005008BB877 /* libquikit_debug.a in Frameworks */, + D3CAA8261326520A008BB877 /* libQtNetwork_debug.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 1D6058910D05DD3D006BFB54 /* qmltest.app */, + D3CAA7F613264F52008BB877 /* qmltest.app */, + ); + name = Products; + sourceTree = "<group>"; + }; + 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { + isa = PBXGroup; + children = ( + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + D3CAA7E213264E8C008BB877 /* QMLApplicationViewer */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = CustomTemplate; + sourceTree = "<group>"; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 32CA4F630368D1EE00C91783 /* qmltest_Prefix.pch */, + D3CAA7C713264AAD008BB877 /* main.mm */, + ); + name = "Other Sources"; + sourceTree = "<group>"; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + D3CAA88E13265310008BB877 /* qml */, + D3CAA836132652E5008BB877 /* fonts */, + 8D1107310486CEB800E47090 /* qmltest-Info.plist */, + ); + name = Resources; + sourceTree = "<group>"; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + D3CAA81513265035008BB877 /* Simulator */, + D3CAA8141326500A008BB877 /* Device */, + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, + 1D30AB110D05D00D00671497 /* Foundation.framework */, + 288765A40DF7441C002DB57D /* CoreGraphics.framework */, + D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */, + ); + name = Frameworks; + sourceTree = "<group>"; + }; + D3CAA7E213264E8C008BB877 /* QMLApplicationViewer */ = { + isa = PBXGroup; + children = ( + D3CAA7E313264EA6008BB877 /* moc_qmlapplicationviewer.cpp */, + D3CAA7E413264EA6008BB877 /* qmlapplicationviewer.cpp */, + D3CAA7E513264EA6008BB877 /* qmlapplicationviewer.h */, + ); + name = QMLApplicationViewer; + sourceTree = "<group>"; + }; + D3CAA8141326500A008BB877 /* Device */ = { + isa = PBXGroup; + children = ( + D3CAA81213265005008BB877 /* libquikit_debug.a */, + D3CAA7FB13264FB9008BB877 /* libQtCore_debug.a */, + D3CAA7FC13264FB9008BB877 /* libQtDeclarative_debug.a */, + D3CAA7FD13264FB9008BB877 /* libQtGui_debug.a */, + D3CAA8251326520A008BB877 /* libQtNetwork_debug.a */, + D3CAA7FE13264FB9008BB877 /* libQtScript_debug.a */, + D3CAA7FF13264FB9008BB877 /* libQtSql_debug.a */, + ); + name = Device; + sourceTree = "<group>"; + }; + D3CAA81513265035008BB877 /* Simulator */ = { + isa = PBXGroup; + children = ( + D3CAA8201326507D008BB877 /* libquikit_debug.a */, + D3CAA81613265056008BB877 /* libQtCore_debug.a */, + D3CAA81713265056008BB877 /* libQtDeclarative_debug.a */, + D3CAA81813265056008BB877 /* libQtGui_debug.a */, + D3CAA82713265220008BB877 /* libQtNetwork_debug.a */, + D3CAA81913265056008BB877 /* libQtScript_debug.a */, + D3CAA81A13265056008BB877 /* libQtSql_debug.a */, + ); + name = Simulator; + sourceTree = "<group>"; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 1D6058900D05DD3D006BFB54 /* qmltest simulator */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "qmltest simulator" */; + buildPhases = ( + 1D60588D0D05DD3D006BFB54 /* Resources */, + 1D60588E0D05DD3D006BFB54 /* Sources */, + 1D60588F0D05DD3D006BFB54 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "qmltest simulator"; + productName = qmltest; + productReference = 1D6058910D05DD3D006BFB54 /* qmltest.app */; + productType = "com.apple.product-type.application"; + }; + D3CAA7E813264F52008BB877 /* qmltest device */ = { + isa = PBXNativeTarget; + buildConfigurationList = D3CAA7F313264F52008BB877 /* Build configuration list for PBXNativeTarget "qmltest device" */; + buildPhases = ( + D3CAA7E913264F52008BB877 /* Resources */, + D3CAA7EB13264F52008BB877 /* Sources */, + D3CAA7EF13264F52008BB877 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = "qmltest device"; + productName = qmltest; + productReference = D3CAA7F613264F52008BB877 /* qmltest.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "qmltest" */; + compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); + mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 1D6058900D05DD3D006BFB54 /* qmltest simulator */, + D3CAA7E813264F52008BB877 /* qmltest device */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXResourcesBuildPhase section */ + 1D60588D0D05DD3D006BFB54 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3CAA88A132652E5008BB877 /* fonts in Resources */, + D3CAA89113265310008BB877 /* qml in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3CAA7E913264F52008BB877 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3CAA88B132652E5008BB877 /* fonts in Resources */, + D3CAA89213265310008BB877 /* qml in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1D60588E0D05DD3D006BFB54 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3CAA7C813264AAD008BB877 /* main.mm in Sources */, + D3CAA7E613264EA6008BB877 /* moc_qmlapplicationviewer.cpp in Sources */, + D3CAA7E713264EA6008BB877 /* qmlapplicationviewer.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D3CAA7EB13264F52008BB877 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + D3CAA7EC13264F52008BB877 /* main.mm in Sources */, + D3CAA7ED13264F52008BB877 /* moc_qmlapplicationviewer.cpp in Sources */, + D3CAA7EE13264F52008BB877 /* qmlapplicationviewer.cpp in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin XCBuildConfiguration section */ + 1D6058940D05DD3E006BFB54 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = qmltest_Prefix.pch; + HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/include\"/**"; + INFOPLIST_FILE = "qmltest-Info.plist"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/lib\"", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/plugins/platforms\"", + ); + PRODUCT_NAME = qmltest; + }; + name = Debug; + }; + 1D6058950D05DD3E006BFB54 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; + COPY_PHASE_STRIP = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = qmltest_Prefix.pch; + HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/include\"/**"; + INFOPLIST_FILE = "qmltest-Info.plist"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/lib\"", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-simulator/plugins/platforms\"", + ); + PRODUCT_NAME = qmltest; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + PREBINDING = NO; + SDKROOT = iphoneos; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + OTHER_CFLAGS = "-DNS_BLOCK_ASSERTIONS=1"; + PREBINDING = NO; + SDKROOT = iphoneos; + }; + name = Release; + }; + D3CAA7F413264F52008BB877 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = qmltest_Prefix.pch; + HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/include\"/**"; + INFOPLIST_FILE = "qmltest-Info.plist"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/lib\"", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/plugins/platforms\"", + ); + PRODUCT_NAME = qmltest; + }; + name = Debug; + }; + D3CAA7F513264F52008BB877 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + ARCHS = "$(ARCHS_UNIVERSAL_IPHONE_OS)"; + COPY_PHASE_STRIP = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = qmltest_Prefix.pch; + HEADER_SEARCH_PATHS = "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/include\"/**"; + INFOPLIST_FILE = "qmltest-Info.plist"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/lib\"", + "\"$(SRCROOT)/../../../../../../../qt-lighthouse-ios-device/plugins/platforms\"", + ); + PRODUCT_NAME = qmltest; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "qmltest simulator" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1D6058940D05DD3E006BFB54 /* Debug */, + 1D6058950D05DD3E006BFB54 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "qmltest" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + D3CAA7F313264F52008BB877 /* Build configuration list for PBXNativeTarget "qmltest device" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + D3CAA7F413264F52008BB877 /* Debug */, + D3CAA7F513264F52008BB877 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmltest_Prefix.pch b/src/plugins/platforms/uikit/examples/qmltest/qmltest_Prefix.pch new file mode 100644 index 0000000..c06715c --- /dev/null +++ b/src/plugins/platforms/uikit/examples/qmltest/qmltest_Prefix.pch @@ -0,0 +1,8 @@ +// +// Prefix header for all source files of the 'qmltest' target in the 'qmltest' project +// + +#ifdef __OBJC__ + #import <Foundation/Foundation.h> + #import <UIKit/UIKit.h> +#endif diff --git a/src/plugins/platforms/uikit/main.mm b/src/plugins/platforms/uikit/main.mm new file mode 100644 index 0000000..05e0d02 --- /dev/null +++ b/src/plugins/platforms/uikit/main.mm @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <UIKit/UIKit.h> + +#include <QtGui/QPlatformIntegrationPlugin> +#include "quikitintegration.h" + +QT_BEGIN_NAMESPACE + +class QUIKitIntegrationPlugin : public QPlatformIntegrationPlugin +{ +public: + QStringList keys() const; + QPlatformIntegration *create(const QString&, const QStringList&); +}; + +QStringList QUIKitIntegrationPlugin::keys() const +{ + QStringList list; + list << "UIKit"; + return list; +} + +QPlatformIntegration * QUIKitIntegrationPlugin::create(const QString& system, const QStringList& paramList) +{ + Q_UNUSED(paramList); + if (system.toLower() == "uikit") + return new QUIKitIntegration; + + return 0; +} + +Q_EXPORT_PLUGIN2(UIKit, QUIKitIntegrationPlugin) + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/uikit/quikiteventloop.h b/src/plugins/platforms/uikit/quikiteventloop.h new file mode 100644 index 0000000..5c18999 --- /dev/null +++ b/src/plugins/platforms/uikit/quikiteventloop.h @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QUIKITEVENTLOOP_H +#define QUIKITEVENTLOOP_H + +#include <QtGui/QPlatformEventLoopIntegration> + +@class EventLoopHelper; +@class NSTimer; + +QT_BEGIN_NAMESPACE + +class QUIKitEventLoop : public QPlatformEventLoopIntegration +{ +public: + QUIKitEventLoop(); + ~QUIKitEventLoop(); + + void startEventLoop(); + void quitEventLoop(); + void qtNeedsToProcessEvents(); + + EventLoopHelper *mHelper; + NSTimer *mTimer; +}; + +QT_END_NAMESPACE + +#endif diff --git a/src/plugins/platforms/uikit/quikiteventloop.mm b/src/plugins/platforms/uikit/quikiteventloop.mm new file mode 100644 index 0000000..4469ae9 --- /dev/null +++ b/src/plugins/platforms/uikit/quikiteventloop.mm @@ -0,0 +1,158 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "quikiteventloop.h" +#include "quikitwindow.h" +#include "quikitwindowsurface.h" + +#include <UIKit/UIKit.h> + +#include <QtGui/QApplication> +#include <QtGui/QWidget> +#include <QtDebug> + +@interface QUIKitAppDelegate : NSObject <UIApplicationDelegate> { +} +@end + +@interface EventLoopHelper : NSObject { + QUIKitEventLoop *mIntegration; +} + +- (id)initWithEventLoopIntegration:(QUIKitEventLoop *)integration; + +- (void)processEvents; +- (void)processEventsAndSchedule; + +@end + +@implementation QUIKitAppDelegate + +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions +{ + foreach (QWidget *widget, qApp->topLevelWidgets()) { + QRect geom = widget->geometry(); + CGRect bar = [UIApplication sharedApplication].statusBarFrame; + if (geom.y() <= bar.size.height) { + geom.setY(bar.size.height); + widget->setGeometry(geom); + } + QUIKitWindow *platformWindow = static_cast<QUIKitWindow *>(widget->platformWindow()); + platformWindow->ensureNativeWindow(); + QUIKitWindowSurface *surface = static_cast<QUIKitWindowSurface*>(widget->windowSurface()); + UIView *view = surface->nativeView(); + [platformWindow->nativeWindow() addSubview:view]; + [platformWindow->nativeWindow() makeKeyAndVisible]; + } + return YES; +} + +- (void)applicationWillTerminate:(UIApplication *)application +{ + // TODO this isn't called for some reason + qDebug() << "quit"; + qApp->quit(); +} + +@end + +@implementation EventLoopHelper + +- (id)initWithEventLoopIntegration:(QUIKitEventLoop *)integration +{ + if (self = [self init]) { + mIntegration = integration; + } + return self; +} + +- (void)processEvents +{ + QPlatformEventLoopIntegration::processEvents(); +} + +- (void)processEventsAndSchedule +{ + QPlatformEventLoopIntegration::processEvents(); + qint64 nextTime = mIntegration->nextTimerEvent(); + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + NSDate *nextDate = [[NSDate date] dateByAddingTimeInterval:((double)nextTime/1000)]; + [mIntegration->mTimer setFireDate:nextDate]; + [pool release]; +} + +@end + +QT_BEGIN_NAMESPACE + +QUIKitEventLoop::QUIKitEventLoop() +{ + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + mHelper = [[EventLoopHelper alloc] initWithEventLoopIntegration:this]; + mTimer = [[NSTimer timerWithTimeInterval:0.030 target:mHelper selector:@selector(processEventsAndSchedule) userInfo:nil repeats:YES] retain]; + [pool release]; +} + +QUIKitEventLoop::~QUIKitEventLoop() +{ + [mTimer release]; + [mHelper release]; +} + +void QUIKitEventLoop::startEventLoop() +{ + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + [[NSRunLoop currentRunLoop] addTimer:[mTimer autorelease] forMode:NSDefaultRunLoopMode]; + UIApplicationMain(qApp->argc(), qApp->argv(), nil, @"QUIKitAppDelegate"); + [pool release]; +} + +void QUIKitEventLoop::quitEventLoop() +{ + +} + +void QUIKitEventLoop::qtNeedsToProcessEvents() +{ + [mHelper performSelectorOnMainThread:@selector(processEvents) withObject:nil waitUntilDone:NO]; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/uikit/quikitintegration.h b/src/plugins/platforms/uikit/quikitintegration.h new file mode 100644 index 0000000..e448881 --- /dev/null +++ b/src/plugins/platforms/uikit/quikitintegration.h @@ -0,0 +1,72 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QPLATFORMINTEGRATION_UIKIT_H +#define QPLATFORMINTEGRATION_UIKIT_H + +#include <QtGui/QPlatformIntegration> + +QT_BEGIN_NAMESPACE + +class QUIKitIntegration : public QPlatformIntegration +{ +public: + QUIKitIntegration(); + ~QUIKitIntegration(); + + QPixmapData *createPixmapData(QPixmapData::PixelType type) const; + QPlatformWindow *createPlatformWindow(QWidget *widget, WId winId = 0) const; + QWindowSurface *createWindowSurface(QWidget *widget, WId winId) const; + + QList<QPlatformScreen *> screens() const; + + QPlatformFontDatabase *fontDatabase() const; + + QPlatformEventLoopIntegration *createEventLoopIntegration() const; + +private: + QList<QPlatformScreen *> mScreens; +}; + +QT_END_NAMESPACE + +#endif + diff --git a/src/plugins/platforms/uikit/quikitintegration.mm b/src/plugins/platforms/uikit/quikitintegration.mm new file mode 100644 index 0000000..f1fc402 --- /dev/null +++ b/src/plugins/platforms/uikit/quikitintegration.mm @@ -0,0 +1,104 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "quikitintegration.h" +#include "quikitwindow.h" +#include "quikitwindowsurface.h" +#include "quikitscreen.h" +#include "quikiteventloop.h" + +#include <QtGui/QApplication> + +#include <private/qpixmap_raster_p.h> + +#include <UIKit/UIKit.h> + +#include <QtDebug> + +QT_BEGIN_NAMESPACE + +QUIKitIntegration::QUIKitIntegration() +{ + mScreens << new QUIKitScreen(0); +} + +QUIKitIntegration::~QUIKitIntegration() +{ +} + +QPixmapData *QUIKitIntegration::createPixmapData(QPixmapData::PixelType type) const +{ + return new QRasterPixmapData(type); +} + +QPlatformWindow *QUIKitIntegration::createPlatformWindow(QWidget *widget, WId winId) const +{ + Q_UNUSED(winId); + return new QUIKitWindow(widget); +} + +QList<QPlatformScreen *> QUIKitIntegration::screens() const +{ + return mScreens; +} + +QWindowSurface *QUIKitIntegration::createWindowSurface(QWidget *widget, WId winId) const +{ + Q_UNUSED(winId); + return new QUIKitWindowSurface(widget); +} + +QPlatformEventLoopIntegration *QUIKitIntegration::createEventLoopIntegration() const +{ + return new QUIKitEventLoop(); +} + +QPlatformFontDatabase * QUIKitIntegration::fontDatabase() const +{ + static bool initialized = false; + if (!initialized) { + initialized = true; + setenv("QT_QPA_FONTDIR",[[[[NSBundle mainBundle] bundlePath] stringByAppendingPathComponent:@"fonts"] UTF8String],1); + } + return QPlatformIntegration::fontDatabase(); +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/uikit/quikitscreen.h b/src/plugins/platforms/uikit/quikitscreen.h new file mode 100644 index 0000000..0253795 --- /dev/null +++ b/src/plugins/platforms/uikit/quikitscreen.h @@ -0,0 +1,75 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QUIKITSCREEN_H +#define QUIKITSCREEN_H + +#include <UIKit/UIKit.h> + +#include <QtGui/QPlatformScreen> + +QT_BEGIN_NAMESPACE + +class QUIKitScreen : public QPlatformScreen +{ +public: + QUIKitScreen(int screenIndex); + ~QUIKitScreen(); + + QRect geometry() const { return m_geometry; } + int depth() const { return m_depth; } + QImage::Format format() const { return m_format; } + QSize physicalSize() const { return m_physicalSize; } + + UIScreen *uiScreen() const; + +private: + QRect m_geometry; + int m_depth; + QImage::Format m_format; + QSize m_physicalSize; + int m_index; +}; + +QT_END_NAMESPACE + + +#endif diff --git a/src/plugins/platforms/uikit/quikitscreen.mm b/src/plugins/platforms/uikit/quikitscreen.mm new file mode 100644 index 0000000..718ba54 --- /dev/null +++ b/src/plugins/platforms/uikit/quikitscreen.mm @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "quikitscreen.h" + +#include <QtDebug> + +QT_BEGIN_NAMESPACE + +QUIKitScreen::QUIKitScreen(int screenIndex) + : QPlatformScreen(), + m_index(screenIndex) +{ + NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; + UIScreen *screen = [[UIScreen screens] objectAtIndex:screenIndex]; + UIScreenMode *mode = [screen currentMode]; + CGSize size = [mode size]; + m_geometry = QRect(0, 0, size.width, size.height); + CGRect bounds = [screen bounds]; // in 'points', 1p == 1/160in + +// qreal xDpi = size.width * 160. / bounds.size.width; +// qreal yDpi = size.height * 160. / bounds.size.height; +// qDebug() << xDpi << yDpi; + + m_format = QImage::Format_ARGB32; + + m_depth = 24; + + const qreal inch = 25.4; + m_physicalSize = QSize(qRound(bounds.size.width * inch / 160.), qRound(bounds.size.height * inch / 160.)); + [pool release]; +} + +QUIKitScreen::~QUIKitScreen() +{ +} + +UIScreen *QUIKitScreen::uiScreen() const +{ + return [[UIScreen screens] objectAtIndex:m_index]; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/uikit/quikitwindow.h b/src/plugins/platforms/uikit/quikitwindow.h new file mode 100644 index 0000000..8e8c51b --- /dev/null +++ b/src/plugins/platforms/uikit/quikitwindow.h @@ -0,0 +1,70 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QUIKITWINDOW_H +#define QUIKITWINDOW_H + +#include <QPlatformWindow> +#include <UIKit/UIKit.h> + +QT_BEGIN_NAMESPACE + +class QUIKitScreen; + +class QUIKitWindow : public QPlatformWindow +{ +public: + explicit QUIKitWindow(QWidget *tlw); + ~QUIKitWindow(); + + UIWindow *nativeWindow() const { return mWindow; } + void setGeometry(const QRect &rect); + + UIWindow *ensureNativeWindow(); + +private: + QUIKitScreen *mScreen; + UIWindow *mWindow; +}; + +QT_END_NAMESPACE + +#endif // QUIKITWINDOW_H diff --git a/src/plugins/platforms/uikit/quikitwindow.mm b/src/plugins/platforms/uikit/quikitwindow.mm new file mode 100644 index 0000000..4ac7447 --- /dev/null +++ b/src/plugins/platforms/uikit/quikitwindow.mm @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "quikitwindow.h" + +#include "quikitscreen.h" + +#include <QtDebug> + +QT_BEGIN_NAMESPACE + +QUIKitWindow::QUIKitWindow(QWidget *tlw) : + QPlatformWindow(tlw), + mWindow(nil) +{ + mScreen = static_cast<QUIKitScreen *>(QPlatformScreen::platformScreenForWidget(tlw)); + CGRect screenBounds = [mScreen->uiScreen() bounds]; + QRect geom(screenBounds.origin.x, screenBounds.origin.y, screenBounds.size.width, screenBounds.size.height); + setGeometry(geom); + // TODO ensure the native window if the application is already running +} + +QUIKitWindow::~QUIKitWindow() +{ + [mWindow release]; +} + +void QUIKitWindow::setGeometry(const QRect &rect) +{ + if (mWindow) { + mWindow.frame = CGRectMake(rect.x(), rect.y(), rect.width(), rect.height()); + [mWindow setNeedsDisplay]; + } + QPlatformWindow::setGeometry(rect); +} + +UIWindow *QUIKitWindow::ensureNativeWindow() +{ + if (!mWindow) { + CGRect screenBounds = [mScreen->uiScreen() bounds]; + QRect geom = geometry(); + CGRect frame = CGRectMake(geom.x(), geom.y(), geom.width(), geom.height()); + mWindow = [[UIWindow alloc] initWithFrame:frame]; + mWindow.screen = mScreen->uiScreen(); + mWindow.frame = frame; // for some reason setting the screen resets frame.origin + [mWindow setNeedsDisplay]; + } +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/uikit/quikitwindowsurface.h b/src/plugins/platforms/uikit/quikitwindowsurface.h new file mode 100644 index 0000000..2c22d7f --- /dev/null +++ b/src/plugins/platforms/uikit/quikitwindowsurface.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QUIKITWINDOWSURFACE_H +#define QUIKITWINDOWSURFACE_H + +#include <QtGui/QPlatformIntegration> +#include <QtGui/QImage> +#include <QtGui/QWindowSystemInterface> + +#include <UIKit/UIKit.h> + +@interface QImageView : UIView +{ + CGImageRef m_cgImage; + QWidget *m_widget; +} + +- (void)setImage:(QImage *)image; +- (void)setWidget:(QWidget *)widget; + +//- (QList<struct QWindowSystemInterface::TouchPoint>)touchPointsForTouches:(NSSet *)touches; +- (void)sendMouseEventForTouches:(NSSet *)touches withEvent:(UIEvent *)event fakeButtons:(Qt::MouseButtons)buttons; +@end + +QT_BEGIN_NAMESPACE + +class QUIKitWindowSurface : public QWindowSurface +{ +public: + QUIKitWindowSurface(QWidget *window); + + QPaintDevice *paintDevice(); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void resize (const QSize &size); + + QImageView *nativeView() const { return mView; } +private: + QImage *mImage; + QImageView *mView; +}; + +QT_END_NAMESPACE + +#endif // QUIKITWINDOWSURFACE_H diff --git a/src/plugins/platforms/uikit/quikitwindowsurface.mm b/src/plugins/platforms/uikit/quikitwindowsurface.mm new file mode 100644 index 0000000..f21bb77 --- /dev/null +++ b/src/plugins/platforms/uikit/quikitwindowsurface.mm @@ -0,0 +1,242 @@ +/**************************************************************************** +** +** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "quikitwindowsurface.h" +#include "quikitwindow.h" + +#include <QtDebug> + +@implementation QImageView + +- (void)dealloc +{ + CGImageRelease(m_cgImage); + [super dealloc]; +} + +- (void)setImage:(QImage *)image +{ + CGImageRelease(m_cgImage); + + const uchar *imageData = image->bits(); + int bitDepth = image->depth(); + int colorBufferSize = 8; + int bytesPrLine = image->bytesPerLine(); + int width = image->width(); + int height = image->height(); + + CGColorSpaceRef cgColourSpaceRef = CGColorSpaceCreateDeviceRGB(); + + CGDataProviderRef cgDataProviderRef = CGDataProviderCreateWithData( + NULL, + imageData, + image->byteCount(), + NULL); + + m_cgImage = CGImageCreate(width, + height, + colorBufferSize, + bitDepth, + bytesPrLine, + cgColourSpaceRef, + kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Little, + cgDataProviderRef, + NULL, + false, + kCGRenderingIntentDefault); + + CGDataProviderRelease(cgDataProviderRef); + CGColorSpaceRelease(cgColourSpaceRef); +} + +- (void)setWidget:(QWidget *)widget +{ + m_widget = widget; +} + +- (void)drawRect:(CGRect)rect +{ + + if (!m_cgImage) + return; + + CGContextRef cgContext = UIGraphicsGetCurrentContext(); + CGContextSaveGState( cgContext ); + + int dy = rect.origin.y + CGRectGetMaxY(rect); + CGContextTranslateCTM(cgContext, 0, dy); + CGContextScaleCTM(cgContext, 1, -1); + CGImageRef subImage = CGImageCreateWithImageInRect(m_cgImage, rect); + CGContextDrawImage(cgContext,rect,subImage); + CGImageRelease(subImage); + + CGContextRestoreGState(cgContext); +} + +//- (QList<struct QWindowSystemInterface::TouchPoint>)touchPointsForTouches:(NSSet *)touches +//{ +// NSEnumerator *enumerator = [touches objectEnumerator]; +// id touch; +// int count = 0; +// QList<struct QWindowSystemInterface::TouchPoint> result; +// while ((touch = [enumerator nextObject])) { +// CGPoint locationInView = [touch locationInView:self]; +// CGRect bounds = [self bounds]; +// struct QWindowSystemInterface::TouchPoint p; +// p.id = count; +// p.isPrimary = true; +// p.normalPosition = QPointF(locationInView.x / bounds.size.width, +// locationInView.y / bounds.size.height); +// p.area = QRectF(locationInView.x, locationInView.y, 1, 1); +// p.pressure = 1.; +// switch ([touch phase]) { +// case UITouchPhaseBegan: +// p.state = Qt::TouchPointPressed; +// break; +// case UITouchPhaseMoved: +// p.state = Qt::TouchPointMoved; +// break; +// case UITouchPhaseStationary: +// p.state = Qt::TouchPointStationary; +// break; +// case UITouchPhaseEnded: +// case UITouchPhaseCancelled: +// p.state = Qt::TouchPointReleased; +// break; +// } +// result << p; +// qDebug() << p.id << ":" << p.normalPosition << p.area << p.state; +// ++count; +// } +// qDebug() << result.size(); +// return result; +//} + +- (void)sendMouseEventForTouches:(NSSet *)touches withEvent:(UIEvent *)event fakeButtons:(Qt::MouseButtons)buttons +{ + UITouch *touch = [touches anyObject]; + CGPoint locationInView = [touch locationInView:self]; + QPoint p(locationInView.x, locationInView.y); + // TODO handle global touch point? for status bar? + QWindowSystemInterface::handleMouseEvent(m_widget, (ulong)(event.timestamp*1000), + p, p, buttons); +} + +- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event +{ + //QWindowSystemInterface::handleTouchEvent(m_widget, (ulong)(event.timestamp*1000), + // QEvent::TouchBegin, QTouchEvent::TouchScreen, + // [self touchPointsForTouches:touches]); + [self sendMouseEventForTouches:touches withEvent:event fakeButtons:Qt::LeftButton]; +} + +- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event +{ + //QWindowSystemInterface::handleTouchEvent(m_widget, (ulong)(event.timestamp*1000), + // QEvent::TouchUpdate, QTouchEvent::TouchScreen, + // [self touchPointsForTouches:touches]); + [self sendMouseEventForTouches:touches withEvent:event fakeButtons:Qt::LeftButton]; +} + +- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event +{ + //QWindowSystemInterface::handleTouchEvent(m_widget, (ulong)(event.timestamp*1000), + // QEvent::TouchEnd, QTouchEvent::TouchScreen, + // [self touchPointsForTouches:touches]); + [self sendMouseEventForTouches:touches withEvent:event fakeButtons:Qt::NoButton]; +} + +- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event +{ + //QWindowSystemInterface::handleTouchEvent(m_widget, (ulong)(event.timestamp*1000), + // QEvent::TouchEnd, QTouchEvent::TouchScreen, + // [self touchPointsForTouches:touches]); + [self sendMouseEventForTouches:touches withEvent:event fakeButtons:Qt::NoButton]; +} + +@end + +QT_BEGIN_NAMESPACE + +QUIKitWindowSurface::QUIKitWindowSurface(QWidget *window) + : QWindowSurface(window) +{ + QUIKitWindow *platformWindow = static_cast<QUIKitWindow *>(window->platformWindow()); + Q_ASSERT(platformWindow); + const QRect geo = window->geometry(); + mView = [[QImageView alloc] initWithFrame:CGRectMake(geo.x(),geo.y(),geo.width(),geo.height())]; + [mView setMultipleTouchEnabled:YES]; + [mView setWidget:window]; + mImage = new QImage(window->size(),QImage::Format_ARGB32_Premultiplied); + [mView setImage:mImage]; + if (platformWindow->nativeWindow()) { + [platformWindow->nativeWindow() addSubview:mView]; + [mView setNeedsDisplay]; + } +} + +QPaintDevice *QUIKitWindowSurface::paintDevice() +{ + return mImage; +} + +void QUIKitWindowSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(widget); + Q_UNUSED(offset); + + QRect geo = region.boundingRect(); + [mView setNeedsDisplayInRect:CGRectMake(geo.x(),geo.y(),geo.width(),geo.height())]; +} + +void QUIKitWindowSurface::resize (const QSize &size) +{ + QWindowSurface::resize(size); + + delete mImage; + mImage = new QImage(size,QImage::Format_ARGB32_Premultiplied); + [mView setImage:mImage]; + const QRect geo = geometry(); + [mView setFrame:CGRectMake(geo.x(), geo.y(), size.width(), size.height())]; + [mView setNeedsDisplay]; +} + +QT_END_NAMESPACE diff --git a/src/plugins/platforms/uikit/uikit.pro b/src/plugins/platforms/uikit/uikit.pro new file mode 100644 index 0000000..b73c334 --- /dev/null +++ b/src/plugins/platforms/uikit/uikit.pro @@ -0,0 +1,23 @@ +TARGET = quikit +include(../../qpluginbase.pri) +QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/platforms + +OBJECTIVE_SOURCES = main.mm \ + quikitintegration.mm \ + quikitwindow.mm \ + quikitscreen.mm \ + quikiteventloop.mm \ + quikitwindowsurface.mm + +OBJECTIVE_HEADERS = quikitintegration.h \ + quikitwindow.h \ + quikitscreen.h \ + quikiteventloop.h \ + quikitwindowsurface.h + +#add libz for freetype. +LIBS += -lz + +#include(../fontdatabases/basicunix/basicunix.pri) +target.path += $$[QT_INSTALL_PLUGINS]/platforms +INSTALLS += target -- cgit v0.12 From dc96e9a935d8a48bae173b4febfb3bf32b34788d Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Thu, 10 Mar 2011 17:53:45 +0100 Subject: Fix http in combination with QT_NO_NETWORKPROXY. --- src/corelib/global/qfeatures.h | 2 +- src/corelib/global/qfeatures.txt | 2 +- src/network/access/qhttpnetworkconnectionchannel.cpp | 7 ++++++- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index b26563a..d1a73a6 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -579,7 +579,7 @@ #endif // Hyper Text Transfer Protocol -#if !defined(QT_NO_HTTP) && (defined(QT_NO_HOSTINFO) || defined(QT_NO_NETWORKPROXY)) +#if !defined(QT_NO_HTTP) && defined(QT_NO_HOSTINFO) #define QT_NO_HTTP #endif diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index f07fbd5..4d938a9 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -1050,7 +1050,7 @@ SeeAlso: ??? Feature: HTTP Description: Supports HTTP file access. Section: Networking -Requires: HOSTINFO NETWORKPROXY +Requires: HOSTINFO Name: Hyper Text Transfer Protocol SeeAlso: ??? diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 079f608..228bc58 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -91,8 +91,10 @@ void QHttpNetworkConnectionChannel::init() #else socket = new QTcpSocket; #endif +#ifndef QT_NO_NETWORKPROXY // Set by QNAM anyway, but let's be safe here socket->setProxy(QNetworkProxy::NoProxy); +#endif QObject::connect(socket, SIGNAL(bytesWritten(qint64)), this, SLOT(_q_bytesWritten(qint64)), @@ -581,13 +583,15 @@ bool QHttpNetworkConnectionChannel::ensureConnection() #endif } else { // In case of no proxy we can use the Unbuffered QTcpSocket +#ifndef QT_NO_NETWORKPROXY if (connection->d_func()->networkProxy.type() == QNetworkProxy::NoProxy && connection->cacheProxy().type() == QNetworkProxy::NoProxy && connection->transparentProxy().type() == QNetworkProxy::NoProxy) { +#endif socket->connectToHost(connectHost, connectPort, QIODevice::ReadWrite | QIODevice::Unbuffered); // For an Unbuffered QTcpSocket, the read buffer size has a special meaning. socket->setReadBufferSize(1*1024); - +#ifndef QT_NO_NETWORKPROXY } else { socket->connectToHost(connectHost, connectPort); @@ -596,6 +600,7 @@ bool QHttpNetworkConnectionChannel::ensureConnection() // here and there. socket->setReadBufferSize(64*1024); } +#endif } return false; } -- cgit v0.12 From b2fb53bcfcac393c31a1dd4f2ef5e6111cb9f51c Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Thu, 10 Mar 2011 20:45:04 +0100 Subject: XmlPatterns actually compiles and runs. --- src/plugins/platforms/uikit/README | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/uikit/README b/src/plugins/platforms/uikit/README index 19ec83f..7477cb0 100644 --- a/src/plugins/platforms/uikit/README +++ b/src/plugins/platforms/uikit/README @@ -18,11 +18,11 @@ After configuring and building Qt you need to also build src/plugins/platforms/u Simulator: ---------- -configure -qpa -xplatform qws/macx-iphonesimulator-g++ -arch i386 -developer-build -no-accessibility -no-qt3support -no-xmlpatterns -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -no-opengl -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations +configure -qpa -xplatform qws/macx-iphonesimulator-g++ -arch i386 -developer-build -no-accessibility -no-qt3support -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -no-opengl -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations Device: ------- -configure -qpa -xplatform qws/macx-iphonedevice-g++ -arch armv7 -developer-build -no-accessibility -no-qt3support -no-xmlpatterns -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -no-opengl -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations +configure -qpa -xplatform qws/macx-iphonedevice-g++ -arch armv7 -developer-build -no-accessibility -no-qt3support -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -no-opengl -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations 2) XCode setup: - there are examples in the examples subdirectory of the platform plugin -- cgit v0.12 From 48ebe36a8b5d101c5dcad26d88d6fc0504fc9319 Mon Sep 17 00:00:00 2001 From: con <qtc-committer@nokia.com> Date: Fri, 11 Mar 2011 11:31:58 +0100 Subject: Do release build for devices and remove some warnings. --- mkspecs/qws/macx-iphonedevice-g++/qmake.conf | 5 +- mkspecs/qws/macx-iphonesimulator-g++/qmake.conf | 1 + src/plugins/platforms/uikit/README | 2 +- .../qmltest/qmltest.xcodeproj/project.pbxproj | 64 ++++++++++++---------- src/plugins/platforms/uikit/quikiteventloop.mm | 6 +- src/plugins/platforms/uikit/quikitwindow.mm | 1 + 6 files changed, 46 insertions(+), 33 deletions(-) diff --git a/mkspecs/qws/macx-iphonedevice-g++/qmake.conf b/mkspecs/qws/macx-iphonedevice-g++/qmake.conf index 2cef3df..36b9496 100644 --- a/mkspecs/qws/macx-iphonedevice-g++/qmake.conf +++ b/mkspecs/qws/macx-iphonedevice-g++/qmake.conf @@ -2,6 +2,7 @@ # qmake configuration for iphone-device-g++ # include(../../common/mac.conf) +include(../../common/gcc-base-macx.conf) include(../../common/g++-macx.conf) MAKEFILE_GENERATOR = UNIX @@ -27,9 +28,9 @@ QMAKE_CXX = /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++- QMAKE_LINK = $$QMAKE_CXX QMAKE_LINK_SHLIB = $$QMAKE_CXX -QMAKE_CFLAGS += -arch armv7 -marm -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2 -gdwarf-2 +QMAKE_CFLAGS += -arch armv7 -marm -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2 QMAKE_CXXFLAGS += $$QMAKE_CFLAGS -QMAKE_OBJECTIVE_CFLAGS += -arch armv7 -marm -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2 -gdwarf-2 -fobjc-abi-version=2 -fobjc-legacy-dispatch +QMAKE_OBJECTIVE_CFLAGS += -arch armv7 -marm -isysroot $$QMAKE_IOS_SDK -fmessage-length=0 -fexceptions -miphoneos-version-min=4.2 -fobjc-abi-version=2 -fobjc-legacy-dispatch QMAKE_LFLAGS += -arch armv7 -marm -miphoneos-version-min=4.2 -Wl,-syslibroot,$$QMAKE_IOS_SDK QMAKE_INCDIR_OPENGL = diff --git a/mkspecs/qws/macx-iphonesimulator-g++/qmake.conf b/mkspecs/qws/macx-iphonesimulator-g++/qmake.conf index 9a06857..dccab70 100644 --- a/mkspecs/qws/macx-iphonesimulator-g++/qmake.conf +++ b/mkspecs/qws/macx-iphonesimulator-g++/qmake.conf @@ -2,6 +2,7 @@ # qmake configuration for macx-g++ # include(../../common/mac.conf) +include(../../common/gcc-base-macx.conf) include(../../common/g++-macx.conf) MAKEFILE_GENERATOR = UNIX diff --git a/src/plugins/platforms/uikit/README b/src/plugins/platforms/uikit/README index 7477cb0..b2984fc 100644 --- a/src/plugins/platforms/uikit/README +++ b/src/plugins/platforms/uikit/README @@ -22,7 +22,7 @@ configure -qpa -xplatform qws/macx-iphonesimulator-g++ -arch i386 -developer-bui Device: ------- -configure -qpa -xplatform qws/macx-iphonedevice-g++ -arch armv7 -developer-build -no-accessibility -no-qt3support -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -no-opengl -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations +configure -qpa -xplatform qws/macx-iphonedevice-g++ -arch armv7 -developer-build -release -no-accessibility -no-qt3support -no-multimedia -no-phonon -no-phonon-backend -no-svg -no-webkit -no-scripttools -no-openssl -no-sql-mysql -no-sql-odbc -no-cups -no-iconv -no-dbus -no-opengl -static -nomake tools -nomake demos -nomake docs -nomake examples -nomake translations 2) XCode setup: - there are examples in the examples subdirectory of the platform plugin diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj b/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj index e105b73..fc4f1df 100755 --- a/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj +++ b/src/plugins/platforms/uikit/examples/qmltest/qmltest.xcodeproj/project.pbxproj @@ -20,25 +20,27 @@ D3CAA7F113264F52008BB877 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; }; D3CAA7F213264F52008BB877 /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765A40DF7441C002DB57D /* CoreGraphics.framework */; }; D3CAA7FA13264F8A008BB877 /* libz.1.2.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */; }; - D3CAA80613264FD5008BB877 /* libQtCore_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7FB13264FB9008BB877 /* libQtCore_debug.a */; }; - D3CAA80713264FD5008BB877 /* libQtDeclarative_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7FC13264FB9008BB877 /* libQtDeclarative_debug.a */; }; - D3CAA80813264FD6008BB877 /* libQtGui_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7FD13264FB9008BB877 /* libQtGui_debug.a */; }; - D3CAA80913264FD6008BB877 /* libQtScript_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7FE13264FB9008BB877 /* libQtScript_debug.a */; }; - D3CAA80A13264FD7008BB877 /* libQtSql_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7FF13264FB9008BB877 /* libQtSql_debug.a */; }; D3CAA81113264FF0008BB877 /* libz.1.2.3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */; }; - D3CAA81313265005008BB877 /* libquikit_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81213265005008BB877 /* libquikit_debug.a */; }; D3CAA81B13265056008BB877 /* libQtCore_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81613265056008BB877 /* libQtCore_debug.a */; }; D3CAA81C13265056008BB877 /* libQtDeclarative_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81713265056008BB877 /* libQtDeclarative_debug.a */; }; D3CAA81D13265056008BB877 /* libQtGui_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81813265056008BB877 /* libQtGui_debug.a */; }; D3CAA81E13265056008BB877 /* libQtScript_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81913265056008BB877 /* libQtScript_debug.a */; }; D3CAA81F13265056008BB877 /* libQtSql_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA81A13265056008BB877 /* libQtSql_debug.a */; }; D3CAA8211326507D008BB877 /* libquikit_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA8201326507D008BB877 /* libquikit_debug.a */; }; - D3CAA8261326520A008BB877 /* libQtNetwork_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA8251326520A008BB877 /* libQtNetwork_debug.a */; }; D3CAA82813265220008BB877 /* libQtNetwork_debug.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3CAA82713265220008BB877 /* libQtNetwork_debug.a */; }; D3CAA88A132652E5008BB877 /* fonts in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA836132652E5008BB877 /* fonts */; }; D3CAA88B132652E5008BB877 /* fonts in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA836132652E5008BB877 /* fonts */; }; D3CAA89113265310008BB877 /* qml in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA88E13265310008BB877 /* qml */; }; D3CAA89213265310008BB877 /* qml in Resources */ = {isa = PBXBuildFile; fileRef = D3CAA88E13265310008BB877 /* qml */; }; + D3D817B2132A2CFD00CDE422 /* libQtCore.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817AA132A2CFD00CDE422 /* libQtCore.a */; }; + D3D817B3132A2CFD00CDE422 /* libQtDeclarative.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817AB132A2CFD00CDE422 /* libQtDeclarative.a */; }; + D3D817B4132A2CFD00CDE422 /* libQtGui.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817AC132A2CFD00CDE422 /* libQtGui.a */; }; + D3D817B5132A2CFD00CDE422 /* libQtNetwork.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817AD132A2CFD00CDE422 /* libQtNetwork.a */; }; + D3D817B6132A2CFD00CDE422 /* libQtScript.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817AE132A2CFD00CDE422 /* libQtScript.a */; }; + D3D817B7132A2CFD00CDE422 /* libQtSql.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817AF132A2CFD00CDE422 /* libQtSql.a */; }; + D3D817B8132A2CFD00CDE422 /* libQtXml.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817B0132A2CFD00CDE422 /* libQtXml.a */; }; + D3D817B9132A2CFD00CDE422 /* libQtXmlPatterns.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817B1132A2CFD00CDE422 /* libQtXmlPatterns.a */; }; + D3D817BB132A2D0E00CDE422 /* libquikit.a in Frameworks */ = {isa = PBXBuildFile; fileRef = D3D817BA132A2D0E00CDE422 /* libquikit.a */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ @@ -54,22 +56,24 @@ D3CAA7E513264EA6008BB877 /* qmlapplicationviewer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = qmlapplicationviewer.h; path = qmlapplicationviewer/qmlapplicationviewer.h; sourceTree = "<group>"; }; D3CAA7F613264F52008BB877 /* qmltest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = qmltest.app; sourceTree = BUILT_PRODUCTS_DIR; }; D3CAA7F913264F8A008BB877 /* libz.1.2.3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.1.2.3.dylib; path = usr/lib/libz.1.2.3.dylib; sourceTree = SDKROOT; }; - D3CAA7FB13264FB9008BB877 /* libQtCore_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtCore_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtCore_debug.a"; sourceTree = SOURCE_ROOT; }; - D3CAA7FC13264FB9008BB877 /* libQtDeclarative_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtDeclarative_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtDeclarative_debug.a"; sourceTree = SOURCE_ROOT; }; - D3CAA7FD13264FB9008BB877 /* libQtGui_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtGui_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtGui_debug.a"; sourceTree = SOURCE_ROOT; }; - D3CAA7FE13264FB9008BB877 /* libQtScript_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtScript_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtScript_debug.a"; sourceTree = SOURCE_ROOT; }; - D3CAA7FF13264FB9008BB877 /* libQtSql_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtSql_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtSql_debug.a"; sourceTree = SOURCE_ROOT; }; - D3CAA81213265005008BB877 /* libquikit_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libquikit_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/plugins/platforms/libquikit_debug.a"; sourceTree = SOURCE_ROOT; }; D3CAA81613265056008BB877 /* libQtCore_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtCore_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtCore_debug.a"; sourceTree = SOURCE_ROOT; }; D3CAA81713265056008BB877 /* libQtDeclarative_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtDeclarative_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtDeclarative_debug.a"; sourceTree = SOURCE_ROOT; }; D3CAA81813265056008BB877 /* libQtGui_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtGui_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtGui_debug.a"; sourceTree = SOURCE_ROOT; }; D3CAA81913265056008BB877 /* libQtScript_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtScript_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtScript_debug.a"; sourceTree = SOURCE_ROOT; }; D3CAA81A13265056008BB877 /* libQtSql_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtSql_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtSql_debug.a"; sourceTree = SOURCE_ROOT; }; D3CAA8201326507D008BB877 /* libquikit_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libquikit_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/plugins/platforms/libquikit_debug.a"; sourceTree = SOURCE_ROOT; }; - D3CAA8251326520A008BB877 /* libQtNetwork_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtNetwork_debug.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtNetwork_debug.a"; sourceTree = SOURCE_ROOT; }; D3CAA82713265220008BB877 /* libQtNetwork_debug.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtNetwork_debug.a; path = "../../../../../../../qt-lighthouse-ios-simulator/lib/libQtNetwork_debug.a"; sourceTree = SOURCE_ROOT; }; D3CAA836132652E5008BB877 /* fonts */ = {isa = PBXFileReference; lastKnownFileType = folder; name = fonts; path = ../../../../../../lib/fonts; sourceTree = SOURCE_ROOT; }; D3CAA88E13265310008BB877 /* qml */ = {isa = PBXFileReference; lastKnownFileType = folder; path = qml; sourceTree = SOURCE_ROOT; }; + D3D817AA132A2CFD00CDE422 /* libQtCore.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtCore.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtCore.a"; sourceTree = SOURCE_ROOT; }; + D3D817AB132A2CFD00CDE422 /* libQtDeclarative.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtDeclarative.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtDeclarative.a"; sourceTree = SOURCE_ROOT; }; + D3D817AC132A2CFD00CDE422 /* libQtGui.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtGui.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtGui.a"; sourceTree = SOURCE_ROOT; }; + D3D817AD132A2CFD00CDE422 /* libQtNetwork.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtNetwork.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtNetwork.a"; sourceTree = SOURCE_ROOT; }; + D3D817AE132A2CFD00CDE422 /* libQtScript.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtScript.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtScript.a"; sourceTree = SOURCE_ROOT; }; + D3D817AF132A2CFD00CDE422 /* libQtSql.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtSql.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtSql.a"; sourceTree = SOURCE_ROOT; }; + D3D817B0132A2CFD00CDE422 /* libQtXml.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtXml.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtXml.a"; sourceTree = SOURCE_ROOT; }; + D3D817B1132A2CFD00CDE422 /* libQtXmlPatterns.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libQtXmlPatterns.a; path = "../../../../../../../qt-lighthouse-ios-device/lib/libQtXmlPatterns.a"; sourceTree = SOURCE_ROOT; }; + D3D817BA132A2D0E00CDE422 /* libquikit.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libquikit.a; path = "../../../../../../../qt-lighthouse-ios-device/plugins/platforms/libquikit.a"; sourceTree = SOURCE_ROOT; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ @@ -98,14 +102,16 @@ D3CAA7F013264F52008BB877 /* Foundation.framework in Frameworks */, D3CAA7F113264F52008BB877 /* UIKit.framework in Frameworks */, D3CAA7F213264F52008BB877 /* CoreGraphics.framework in Frameworks */, - D3CAA80613264FD5008BB877 /* libQtCore_debug.a in Frameworks */, - D3CAA80713264FD5008BB877 /* libQtDeclarative_debug.a in Frameworks */, - D3CAA80813264FD6008BB877 /* libQtGui_debug.a in Frameworks */, - D3CAA80913264FD6008BB877 /* libQtScript_debug.a in Frameworks */, - D3CAA80A13264FD7008BB877 /* libQtSql_debug.a in Frameworks */, D3CAA81113264FF0008BB877 /* libz.1.2.3.dylib in Frameworks */, - D3CAA81313265005008BB877 /* libquikit_debug.a in Frameworks */, - D3CAA8261326520A008BB877 /* libQtNetwork_debug.a in Frameworks */, + D3D817B2132A2CFD00CDE422 /* libQtCore.a in Frameworks */, + D3D817B3132A2CFD00CDE422 /* libQtDeclarative.a in Frameworks */, + D3D817B4132A2CFD00CDE422 /* libQtGui.a in Frameworks */, + D3D817B5132A2CFD00CDE422 /* libQtNetwork.a in Frameworks */, + D3D817B6132A2CFD00CDE422 /* libQtScript.a in Frameworks */, + D3D817B7132A2CFD00CDE422 /* libQtSql.a in Frameworks */, + D3D817B8132A2CFD00CDE422 /* libQtXml.a in Frameworks */, + D3D817B9132A2CFD00CDE422 /* libQtXmlPatterns.a in Frameworks */, + D3D817BB132A2D0E00CDE422 /* libquikit.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -178,13 +184,15 @@ D3CAA8141326500A008BB877 /* Device */ = { isa = PBXGroup; children = ( - D3CAA81213265005008BB877 /* libquikit_debug.a */, - D3CAA7FB13264FB9008BB877 /* libQtCore_debug.a */, - D3CAA7FC13264FB9008BB877 /* libQtDeclarative_debug.a */, - D3CAA7FD13264FB9008BB877 /* libQtGui_debug.a */, - D3CAA8251326520A008BB877 /* libQtNetwork_debug.a */, - D3CAA7FE13264FB9008BB877 /* libQtScript_debug.a */, - D3CAA7FF13264FB9008BB877 /* libQtSql_debug.a */, + D3D817BA132A2D0E00CDE422 /* libquikit.a */, + D3D817AA132A2CFD00CDE422 /* libQtCore.a */, + D3D817AB132A2CFD00CDE422 /* libQtDeclarative.a */, + D3D817AC132A2CFD00CDE422 /* libQtGui.a */, + D3D817AD132A2CFD00CDE422 /* libQtNetwork.a */, + D3D817AE132A2CFD00CDE422 /* libQtScript.a */, + D3D817AF132A2CFD00CDE422 /* libQtSql.a */, + D3D817B0132A2CFD00CDE422 /* libQtXml.a */, + D3D817B1132A2CFD00CDE422 /* libQtXmlPatterns.a */, ); name = Device; sourceTree = "<group>"; diff --git a/src/plugins/platforms/uikit/quikiteventloop.mm b/src/plugins/platforms/uikit/quikiteventloop.mm index 4469ae9..78f046e 100644 --- a/src/plugins/platforms/uikit/quikiteventloop.mm +++ b/src/plugins/platforms/uikit/quikiteventloop.mm @@ -68,9 +68,10 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + Q_UNUSED(launchOptions) foreach (QWidget *widget, qApp->topLevelWidgets()) { QRect geom = widget->geometry(); - CGRect bar = [UIApplication sharedApplication].statusBarFrame; + CGRect bar = application.statusBarFrame; if (geom.y() <= bar.size.height) { geom.setY(bar.size.height); widget->setGeometry(geom); @@ -87,6 +88,7 @@ - (void)applicationWillTerminate:(UIApplication *)application { + Q_UNUSED(application) // TODO this isn't called for some reason qDebug() << "quit"; qApp->quit(); @@ -98,7 +100,7 @@ - (id)initWithEventLoopIntegration:(QUIKitEventLoop *)integration { - if (self = [self init]) { + if ((self = [self init])) { mIntegration = integration; } return self; diff --git a/src/plugins/platforms/uikit/quikitwindow.mm b/src/plugins/platforms/uikit/quikitwindow.mm index 4ac7447..457598b 100644 --- a/src/plugins/platforms/uikit/quikitwindow.mm +++ b/src/plugins/platforms/uikit/quikitwindow.mm @@ -83,6 +83,7 @@ UIWindow *QUIKitWindow::ensureNativeWindow() mWindow.frame = frame; // for some reason setting the screen resets frame.origin [mWindow setNeedsDisplay]; } + return mWindow; } QT_END_NAMESPACE -- cgit v0.12 From c0fed43b04dec8bd549043d3ea5e28908128082c Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> Date: Tue, 22 Feb 2011 15:40:40 +0100 Subject: Introduce QFontEngineDirectWrite Make a font engine for subpixel positioned text on Windows Vista (with platform update) and Windows 7. If selected during configuration, the engine will be selected only when the hinting preference of a font is set to None or Vertical hinting. The font database uses most of the same logic but creates a direct write font based on the LOGFONT rather than a GDI handle. The engine is currently regarded as experimental, meaning that code using it should do substantial testing to make sure it covers their use cases. Task-number: QTBUG-12678 Reviewed-by: Jiang Jiang --- src/gui/gui.pro | 4 + src/gui/text/qfont.cpp | 102 ++++ src/gui/text/qfont.h | 45 +- src/gui/text/qfont_p.h | 7 +- src/gui/text/qfontdatabase.cpp | 21 + src/gui/text/qfontdatabase_win.cpp | 220 +++++-- src/gui/text/qfontengine_p.h | 2 + src/gui/text/qfontengine_win.cpp | 2 +- src/gui/text/qfontengine_win_p.h | 2 +- src/gui/text/qfontenginedirectwrite.cpp | 646 +++++++++++++++++++++ src/gui/text/qfontenginedirectwrite_p.h | 133 +++++ src/gui/text/qtextformat.cpp | 22 + src/gui/text/qtextformat.h | 11 + src/gui/text/text.pri | 6 + .../qtextscriptengine/tst_qtextscriptengine.cpp | 60 ++ tools/configure/configureapp.cpp | 34 +- 16 files changed, 1259 insertions(+), 58 deletions(-) create mode 100644 src/gui/text/qfontenginedirectwrite.cpp create mode 100644 src/gui/text/qfontenginedirectwrite_p.h diff --git a/src/gui/gui.pro b/src/gui/gui.pro index 076fe0a..fda76a2 100644 --- a/src/gui/gui.pro +++ b/src/gui/gui.pro @@ -79,6 +79,10 @@ neon:*-g++* { QMAKE_EXTRA_COMPILERS += neon_compiler } +win32:!contains(QT_CONFIG, directwrite) { + DEFINES += QT_NO_DIRECTWRITE +} + contains(QMAKE_MAC_XARCH, no) { DEFINES += QT_NO_MAC_XARCH } else { diff --git a/src/gui/text/qfont.cpp b/src/gui/text/qfont.cpp index 64eb27a..f77e237 100644 --- a/src/gui/text/qfont.cpp +++ b/src/gui/text/qfont.cpp @@ -383,6 +383,9 @@ void QFontPrivate::resolve(uint mask, const QFontPrivate *other) if (! (mask & QFont::StretchResolved)) request.stretch = other->request.stretch; + if (! (mask & QFont::HintingPreferenceResolved)) + request.hintingPreference = other->request.hintingPreference; + if (! (mask & QFont::UnderlineResolved)) underline = other->underline; @@ -917,6 +920,105 @@ int QFont::pointSize() const } /*! + \since 4.8 + + \enum QFont::HintingPreference + + This enum describes the different levels of hinting that can be applied + to glyphs to improve legibility on displays where it might be warranted + by the density of pixels. + + \value PreferDefaultHinting Use the default hinting level for the target platform. + \value PreferNoHinting If possible, render text without hinting the outlines + of the glyphs. The text layout will be typographically accurate and + scalable, using the same metrics as are used e.g. when printing. + \value PreferVerticalHinting If possible, render text with no horizontal hinting, + but align glyphs to the pixel grid in the vertical direction. The text will appear + crisper on displays where the density is too low to give an accurate rendering + of the glyphs. But since the horizontal metrics of the glyphs are unhinted, the text's + layout will be scalable to higher density devices (such as printers) without impacting + details such as line breaks. + \value PreferFullHinting If possible, render text with hinting in both horizontal and + vertical directions. The text will be altered to optimize legibility on the target + device, but since the metrics will depend on the target size of the text, the positions + of glyphs, line breaks, and other typographical detail will not scale, meaning that a + text layout may look different on devices with different pixel densities. + + Please note that this enum only describes a preference, as the full range of hinting levels + are not supported on all of Qt's supported platforms. The following table details the effect + of a given hinting preference on a selected set of target platforms. + + \table + \header + \o + \o PreferDefaultHinting + \o PreferNoHinting + \o PreferVerticalHinting + \o PreferFullHinting + \row + \o Windows Vista (w/o Platform Update) and earlier + \o Full hinting + \o Full hinting + \o Full hinting + \o Full hinting + \row + \o Windows 7 and Windows Vista (w/Platform Update) and DirectWrite enabled in Qt + \o Full hinting + \o Vertical hinting + \o Vertical hinting + \o Full hinting + \row + \o FreeType + \o Operating System setting + \o No hinting + \o Vertical hinting (light) + \o Full hinting + \row + \o Cocoa on Mac OS X + \o No hinting + \o No hinting + \o No hinting + \o No hinting + \endtable + + \note Please be aware that altering the hinting preference on Windows is available through + the DirectWrite font engine. This is available on Windows Vista after installing the platform + update, and on Windows 7. In order to use this extension, configure Qt using -directwrite. + The target application will then depend on the availability of DirectWrite on the target + system. + +*/ + +/*! + \since 4.8 + + Set the preference for the hinting level of the glyphs to \a hintingPreference. This is a hint + to the underlying font rendering system to use a certain level of hinting, and has varying + support across platforms. See the table in the documentation for QFont::HintingPreference for + more details. + + The default hinting preference is QFont::PreferDefaultHinting. +*/ +void QFont::setHintingPreference(HintingPreference hintingPreference) +{ + detach(); + + d->request.hintingPreference = hintingPreference; + + resolve_mask |= QFont::HintingPreferenceResolved; +} + +/*! + \since 4.8 + + Returns the currently preferred hinting level for glyphs rendered with this font. +*/ +QFont::HintingPreference QFont::hintingPreference() const +{ + return QFont::HintingPreference(d->request.hintingPreference); +} + +/*! Sets the point size to \a pointSize. The point size must be greater than zero. diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index e7e8a40..ea65c17 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -90,7 +90,14 @@ public: NoAntialias = 0x0100, OpenGLCompatible = 0x0200, ForceIntegerMetrics = 0x0400, - NoFontMerging = 0x8000 + NoFontMerging = 0x8000, + }; + + enum HintingPreference { + PreferDefaultHinting = 0, + PreferNoHinting = 1, + PreferVerticalHinting = 2, + PreferFullHinting = 3 }; enum Weight { @@ -133,22 +140,23 @@ public: }; enum ResolveProperties { - FamilyResolved = 0x0001, - SizeResolved = 0x0002, - StyleHintResolved = 0x0004, - StyleStrategyResolved = 0x0008, - WeightResolved = 0x0010, - StyleResolved = 0x0020, - UnderlineResolved = 0x0040, - OverlineResolved = 0x0080, - StrikeOutResolved = 0x0100, - FixedPitchResolved = 0x0200, - StretchResolved = 0x0400, - KerningResolved = 0x0800, - CapitalizationResolved = 0x1000, - LetterSpacingResolved = 0x2000, - WordSpacingResolved = 0x4000, - AllPropertiesResolved = 0x7fff + FamilyResolved = 0x0001, + SizeResolved = 0x0002, + StyleHintResolved = 0x0004, + StyleStrategyResolved = 0x0008, + WeightResolved = 0x0010, + StyleResolved = 0x0020, + UnderlineResolved = 0x0040, + OverlineResolved = 0x0080, + StrikeOutResolved = 0x0100, + FixedPitchResolved = 0x0200, + StretchResolved = 0x0400, + KerningResolved = 0x0800, + CapitalizationResolved = 0x1000, + LetterSpacingResolved = 0x2000, + WordSpacingResolved = 0x4000, + HintingPreferenceResolved = 0x8000, + AllPropertiesResolved = 0xffff }; QFont(); @@ -213,6 +221,9 @@ public: void setCapitalization(Capitalization); Capitalization capitalization() const; + void setHintingPreference(HintingPreference hintingPreference); + HintingPreference hintingPreference() const; + // is raw mode still needed? bool rawMode() const; void setRawMode(bool); diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index 0a3f76d..b23f96e 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -72,7 +72,7 @@ struct QFontDef : pointSize(-1.0), pixelSize(-1), styleStrategy(QFont::PreferDefault), styleHint(QFont::AnyStyle), weight(50), fixedPitch(false), style(QFont::StyleNormal), stretch(100), - ignorePitch(true) + ignorePitch(true), hintingPreference(QFont::PreferDefaultHinting) #ifdef Q_WS_MAC ,fixedPitchComputed(false) #endif @@ -98,7 +98,8 @@ struct QFontDef uint ignorePitch : 1; uint fixedPitchComputed : 1; // for Mac OS X only - int reserved : 16; // for future extensions + uint hintingPreference : 2; + int reserved : 14; // for future extensions bool exactMatch(const QFontDef &other) const; bool operator==(const QFontDef &other) const @@ -111,6 +112,7 @@ struct QFontDef && styleStrategy == other.styleStrategy && ignorePitch == other.ignorePitch && fixedPitch == other.fixedPitch && family == other.family + && hintingPreference == other.hintingPreference #ifdef Q_WS_X11 && addStyle == other.addStyle #endif @@ -125,6 +127,7 @@ struct QFontDef if (styleHint != other.styleHint) return styleHint < other.styleHint; if (styleStrategy != other.styleStrategy) return styleStrategy < other.styleStrategy; if (family != other.family) return family < other.family; + if (hintingPreference != other.hintingPreference) return hintingPreference < other.hintingPreference; #ifdef Q_WS_X11 if (addStyle != other.addStyle) return addStyle < other.addStyle; diff --git a/src/gui/text/qfontdatabase.cpp b/src/gui/text/qfontdatabase.cpp index 1e94bf5..cbe0423 100644 --- a/src/gui/text/qfontdatabase.cpp +++ b/src/gui/text/qfontdatabase.cpp @@ -81,6 +81,10 @@ # define FM_DEBUG if (false) qDebug #endif +#if defined(Q_WS_WIN) && !defined(QT_NO_DIRECTWRITE) +# include <dwrite.h> +#endif + QT_BEGIN_NAMESPACE #define SMOOTH_SCALABLE 0xffff @@ -643,13 +647,24 @@ public: #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() { @@ -667,6 +682,12 @@ public: #endif QtFontFamily **families; +#if defined(Q_WS_WIN) && !defined(QT_NO_DIRECTWRITE) + IDWriteFactory *directWriteFactory; + IDWriteGdiInterop *directWriteGdiInterop; +#endif + + struct ApplicationFont { QString fileName; QByteArray data; diff --git a/src/gui/text/qfontdatabase_win.cpp b/src/gui/text/qfontdatabase_win.cpp index e2c5116..0bb1d8d 100644 --- a/src/gui/text/qfontdatabase_win.cpp +++ b/src/gui/text/qfontdatabase_win.cpp @@ -49,6 +49,11 @@ #include "qabstractfileengine.h" #include "qendian.h" +#if !defined(QT_NO_DIRECTWRITE) +# include "qsettings.h" +# include "qfontenginedirectwrite_p.h" +#endif + #ifdef Q_OS_WINCE # include <QTemporaryFile> #endif @@ -542,6 +547,65 @@ static void initFontInfo(QFontEngineWin *fe, const QFontDef &request, const QFon } } +#if !defined(QT_NO_DIRECTWRITE) +static void initFontInfo(QFontEngineDirectWrite *fe, const QFontDef &request, + const QFontPrivate *fp, IDWriteFont *font) +{ + fe->fontDef = request; + + IDWriteFontFamily *fontFamily = NULL; + HRESULT hr = font->GetFontFamily(&fontFamily); + + IDWriteLocalizedStrings *familyNames = NULL; + if (SUCCEEDED(hr)) + hr = fontFamily->GetFamilyNames(&familyNames); + + UINT32 index = 0; + BOOL exists = false; + + wchar_t localeName[LOCALE_NAME_MAX_LENGTH]; + + if (SUCCEEDED(hr)) { + int defaultLocaleSuccess = GetUserDefaultLocaleName(localeName, LOCALE_NAME_MAX_LENGTH); + + if (defaultLocaleSuccess) + hr = familyNames->FindLocaleName(localeName, &index, &exists); + + if (SUCCEEDED(hr) && !exists) + hr = familyNames->FindLocaleName(L"en-us", &index, &exists); + } + + if (!exists) + index = 0; + + UINT32 length = 0; + if (SUCCEEDED(hr)) + hr = familyNames->GetStringLength(index, &length); + + wchar_t *name = new (std::nothrow) wchar_t[length+1]; + if (name == NULL) + hr = E_OUTOFMEMORY; + + // Get the family name. + if (SUCCEEDED(hr)) + hr = familyNames->GetString(index, name, length + 1); + + if (SUCCEEDED(hr)) + fe->fontDef.family = QString::fromWCharArray(name); + + delete[] name; + if (familyNames != NULL) + familyNames->Release(); + + if (FAILED(hr)) + qErrnoWarning(hr, "initFontInfo: Failed to get family name"); + + if (fe->fontDef.pointSize < 0) + fe->fontDef.pointSize = fe->fontDef.pixelSize * 72. / fp->dpi; + else if (fe->fontDef.pixelSize == -1) + fe->fontDef.pixelSize = qRound(fe->fontDef.pointSize * fp->dpi / 72.); +} +#endif static const char *other_tryFonts[] = { "Arial", @@ -595,6 +659,14 @@ static const char *kr_tryFonts[] = { static const char **tryFonts = 0; +#if !defined(QT_NO_DIRECTWRITE) +static QString fontNameSubstitute(const QString &familyName) +{ + QLatin1String key("HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\" + "FontSubstitutes"); + return QSettings(key, QSettings::NativeFormat).value(familyName, familyName).toString(); +} +#endif static inline HFONT systemFont() { @@ -629,6 +701,15 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, const QFontDef &requ HFONT hfont = 0; + +#if !defined(QT_NO_DIRECTWRITE) + bool useDirectWrite = (request.hintingPreference & QFont::PreferNoHinting) + || (request.hintingPreference & QFont::PreferVerticalHinting); + IDWriteFont *directWriteFont = 0; +#else + bool useDirectWrite = false; +#endif + if (fp->rawMode) { // will choose a stock font int f, deffnt = SYSTEM_FONT; QString fam = desc->family->name.toLower(); @@ -745,6 +826,7 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, const QFontDef &requ fam = QLatin1String("Courier New"); memcpy(lf.lfFaceName, fam.utf16(), sizeof(wchar_t) * qMin(fam.length() + 1, 32)); // 32 = Windows hard-coded + hfont = CreateFontIndirect(&lf); if (!hfont) qErrnoWarning("QFontEngine::loadEngine: CreateFontIndirect failed"); @@ -759,52 +841,120 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, const QFontDef &requ res = GetTextMetrics(hdc, &tm); avWidth = tm.tmAveCharWidth; ttf = tm.tmPitchAndFamily & TMPF_TRUETYPE; - SelectObject(hdc, oldObj); - if (hfont && (!ttf || request.stretch != 100)) { - DeleteObject(hfont); - if (!res) - qErrnoWarning("QFontEngine::loadEngine: GetTextMetrics failed"); - lf.lfWidth = avWidth * request.stretch/100; - hfont = CreateFontIndirect(&lf); - if (!hfont) - qErrnoWarning("QFontEngine::loadEngine: CreateFontIndirect with stretch failed"); - } + if (!ttf || !useDirectWrite) { + useDirectWrite = false; + + if (hfont && (!ttf || request.stretch != 100)) { + DeleteObject(hfont); + if (!res) + qErrnoWarning("QFontEngine::loadEngine: GetTextMetrics failed"); + lf.lfWidth = avWidth * request.stretch/100; + hfont = CreateFontIndirect(&lf); + if (!hfont) + qErrnoWarning("QFontEngine::loadEngine: CreateFontIndirect with stretch failed"); + } #ifndef Q_WS_WINCE - if (hfont == 0) { - hfont = (HFONT)GetStockObject(ANSI_VAR_FONT); - stockFont = true; - } + if (hfont == 0) { + hfont = (HFONT)GetStockObject(ANSI_VAR_FONT); + stockFont = true; + } #else - if (hfont == 0) { - hfont = (HFONT)GetStockObject(SYSTEM_FONT); - stockFont = true; + if (hfont == 0) { + hfont = (HFONT)GetStockObject(SYSTEM_FONT); + stockFont = true; + } +#endif + + } + +#if !defined(QT_NO_DIRECTWRITE) + else { + // Default to false for DirectWrite (and re-enable once/if everything + // turns out okay) + useDirectWrite = false; + + QFontDatabasePrivate *db = privateDb(); + if (db->directWriteFactory == 0) { + HRESULT hr = DWriteCreateFactory( + DWRITE_FACTORY_TYPE_SHARED, + __uuidof(IDWriteFactory), + reinterpret_cast<IUnknown **>(&db->directWriteFactory) + ); + if (FAILED(hr)) { + qErrnoWarning("QFontEngine::loadEngine: DWriteCreateFactory failed"); + } else { + hr = db->directWriteFactory->GetGdiInterop(&db->directWriteGdiInterop); + if (FAILED(hr)) + qErrnoWarning("QFontEngine::loadEngine: GetGdiInterop failed"); + } + } + + if (db->directWriteGdiInterop != 0) { + QString nameSubstitute = fontNameSubstitute(QString::fromWCharArray(lf.lfFaceName)); + memcpy(lf.lfFaceName, nameSubstitute.utf16(), + sizeof(wchar_t) * qMin(nameSubstitute.length() + 1, LF_FACESIZE)); + + HRESULT hr = db->directWriteGdiInterop->CreateFontFromLOGFONT( + &lf, + &directWriteFont); + if (FAILED(hr)) { + qErrnoWarning("QFontEngine::loadEngine: CreateFontFromLOGFONT failed " + "for %ls (0x%lx)", + lf.lfFaceName, hr); + } else { + DeleteObject(hfont); + useDirectWrite = true; + } + } } #endif } - QFontEngineWin *few = new QFontEngineWin(font_name, hfont, stockFont, lf); - - if (preferClearTypeAA) - few->glyphFormat = QFontEngineGlyphCache::Raster_RGBMask; - - // Also check for OpenType tables when using complex scripts - // ### TODO: This only works for scripts that require OpenType. More generally - // for scripts that do not require OpenType we should just look at the list of - // supported writing systems in the font's OS/2 table. - if (scriptRequiresOpenType(script)) { - HB_Face hbFace = few->harfbuzzFace(); - if (!hbFace || !hbFace->supported_scripts[script]) { - FM_DEBUG(" OpenType support missing for script\n"); - delete few; - return 0; + + QFontEngine *fe = 0; + if (!useDirectWrite) { + QFontEngineWin *few = new QFontEngineWin(font_name, hfont, stockFont, lf); + if (preferClearTypeAA) + few->glyphFormat = QFontEngineGlyphCache::Raster_RGBMask; + + // Also check for OpenType tables when using complex scripts + // ### TODO: This only works for scripts that require OpenType. More generally + // for scripts that do not require OpenType we should just look at the list of + // supported writing systems in the font's OS/2 table. + if (scriptRequiresOpenType(script)) { + HB_Face hbFace = few->harfbuzzFace(); + if (!hbFace || !hbFace->supported_scripts[script]) { + FM_DEBUG(" OpenType support missing for script\n"); + delete few; + return 0; + } } + + initFontInfo(few, request, fp); + fe = few; } - QFontEngine *fe = few; - initFontInfo(few, request, fp); +#if !defined(QT_NO_DIRECTWRITE) + else { + QFontDatabasePrivate *db = privateDb(); + QFontEngineDirectWrite *fedw = new QFontEngineDirectWrite(font_name, + db->directWriteFactory, + db->directWriteGdiInterop, + directWriteFont, + request.pixelSize); + + initFontInfo(fedw, request, fp, directWriteFont); + + fe = fedw; + } + + if (directWriteFont != 0) + directWriteFont->Release(); +#endif + if(script == QUnicodeTables::Common && !(request.styleStrategy & QFont::NoFontMerging) && !(desc->family->writingSystems[QFontDatabase::Symbol] & QtFontFamily::Supported)) { @@ -836,7 +986,7 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, const QFontDef &requ list << QLatin1String(*tf); ++tf; } - QFontEngine *mfe = new QFontEngineMultiWin(few, list); + QFontEngine *mfe = new QFontEngineMultiWin(fe, list); mfe->fontDef = fe->fontDef; fe = mfe; } diff --git a/src/gui/text/qfontengine_p.h b/src/gui/text/qfontengine_p.h index bbb242b..f501141 100644 --- a/src/gui/text/qfontengine_p.h +++ b/src/gui/text/qfontengine_p.h @@ -117,6 +117,8 @@ public: // S60 types S60FontEngine, // Cannot be simply called "S60". Reason is qt_s60Data.h + DirectWrite, + TestFontEngine = 0x1000 }; diff --git a/src/gui/text/qfontengine_win.cpp b/src/gui/text/qfontengine_win.cpp index ecb0384..82d9da0 100644 --- a/src/gui/text/qfontengine_win.cpp +++ b/src/gui/text/qfontengine_win.cpp @@ -1286,7 +1286,7 @@ QImage QFontEngineWin::alphaRGBMapForGlyph(glyph_t glyph, QFixed, int margin, co // -------------------------------------- Multi font engine -QFontEngineMultiWin::QFontEngineMultiWin(QFontEngineWin *first, const QStringList &fallbacks) +QFontEngineMultiWin::QFontEngineMultiWin(QFontEngine *first, const QStringList &fallbacks) : QFontEngineMulti(fallbacks.size()+1), fallbacks(fallbacks) { diff --git a/src/gui/text/qfontengine_win_p.h b/src/gui/text/qfontengine_win_p.h index 22085e8..28d8000 100644 --- a/src/gui/text/qfontengine_win_p.h +++ b/src/gui/text/qfontengine_win_p.h @@ -150,7 +150,7 @@ private: class QFontEngineMultiWin : public QFontEngineMulti { public: - QFontEngineMultiWin(QFontEngineWin *first, const QStringList &fallbacks); + QFontEngineMultiWin(QFontEngine *first, const QStringList &fallbacks); void loadEngine(int at); QStringList fallbacks; diff --git a/src/gui/text/qfontenginedirectwrite.cpp b/src/gui/text/qfontenginedirectwrite.cpp new file mode 100644 index 0000000..23fff0d --- /dev/null +++ b/src/gui/text/qfontenginedirectwrite.cpp @@ -0,0 +1,646 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QT_NO_DIRECTWRITE + +#include "qfontenginedirectwrite_p.h" + +#include <qendian.h> +#include <dwrite.h> +#include <private/qnativeimage_p.h> + +#include <d2d1.h> + +QT_BEGIN_NAMESPACE + +// Convert from design units to logical pixels +#define DESIGN_TO_LOGICAL(DESIGN_UNIT_VALUE) \ + QFixed::fromReal((qreal(DESIGN_UNIT_VALUE) / qreal(m_unitsPerEm)) * fontDef.pixelSize) + +namespace { + + class GeometrySink: public IDWriteGeometrySink + { + public: + GeometrySink(QPainterPath *path) : m_path(path), m_refCount(0) + { + Q_ASSERT(m_path != 0); + } + + IFACEMETHOD_(void, AddBeziers)(const D2D1_BEZIER_SEGMENT *beziers, UINT bezierCount); + IFACEMETHOD_(void, AddLines)(const D2D1_POINT_2F *points, UINT pointCount); + IFACEMETHOD_(void, BeginFigure)(D2D1_POINT_2F startPoint, D2D1_FIGURE_BEGIN figureBegin); + IFACEMETHOD(Close)(); + IFACEMETHOD_(void, EndFigure)(D2D1_FIGURE_END figureEnd); + IFACEMETHOD_(void, SetFillMode)(D2D1_FILL_MODE fillMode); + IFACEMETHOD_(void, SetSegmentFlags)(D2D1_PATH_SEGMENT vertexFlags); + + IFACEMETHOD_(unsigned long, AddRef)(); + IFACEMETHOD_(unsigned long, Release)(); + IFACEMETHOD(QueryInterface)(IID const &riid, void **ppvObject); + + private: + inline static QPointF fromD2D1_POINT_2F(const D2D1_POINT_2F &inp) + { + return QPointF(inp.x, inp.y); + } + + unsigned long m_refCount; + QPointF m_startPoint; + QPainterPath *m_path; + }; + + void GeometrySink::AddBeziers(const D2D1_BEZIER_SEGMENT *beziers, + UINT bezierCount) + { + for (uint i=0; i<bezierCount; ++i) { + QPointF c1 = fromD2D1_POINT_2F(beziers[i].point1); + QPointF c2 = fromD2D1_POINT_2F(beziers[i].point2); + QPointF p2 = fromD2D1_POINT_2F(beziers[i].point3); + + m_path->cubicTo(c1, c2, p2); + } + } + + void GeometrySink::AddLines(const D2D1_POINT_2F *points, UINT pointsCount) + { + for (uint i=0; i<pointsCount; ++i) + m_path->lineTo(fromD2D1_POINT_2F(points[i])); + } + + void GeometrySink::BeginFigure(D2D1_POINT_2F startPoint, + D2D1_FIGURE_BEGIN /*figureBegin*/) + { + m_startPoint = fromD2D1_POINT_2F(startPoint); + m_path->moveTo(m_startPoint); + } + + IFACEMETHODIMP GeometrySink::Close() + { + return E_NOTIMPL; + } + + void GeometrySink::EndFigure(D2D1_FIGURE_END figureEnd) + { + if (figureEnd == D2D1_FIGURE_END_CLOSED) + m_path->closeSubpath(); + } + + void GeometrySink::SetFillMode(D2D1_FILL_MODE fillMode) + { + m_path->setFillRule(fillMode == D2D1_FILL_MODE_ALTERNATE + ? Qt::OddEvenFill + : Qt::WindingFill); + } + + void GeometrySink::SetSegmentFlags(D2D1_PATH_SEGMENT /*vertexFlags*/) + { + /* Not implemented */ + } + + IFACEMETHODIMP_(unsigned long) GeometrySink::AddRef() + { + return InterlockedIncrement(&m_refCount); + } + + IFACEMETHODIMP_(unsigned long) GeometrySink::Release() + { + unsigned long newCount = InterlockedDecrement(&m_refCount); + if (newCount == 0) + { + delete this; + return 0; + } + + return newCount; + } + + IFACEMETHODIMP GeometrySink::QueryInterface(IID const &riid, void **ppvObject) + { + if (__uuidof(IDWriteGeometrySink) == riid) { + *ppvObject = this; + } else if (__uuidof(IUnknown) == riid) { + *ppvObject = this; + } else { + *ppvObject = NULL; + return E_FAIL; + } + + AddRef(); + return S_OK; + } + +} + +QFontEngineDirectWrite::QFontEngineDirectWrite(const QString &name, + IDWriteFactory *directWriteFactory, + IDWriteGdiInterop *directWriteGdiInterop, + IDWriteFont *directWriteFont, + qreal pixelSize) + : m_name(name) + , m_directWriteFont(directWriteFont) + , m_directWriteFontFace(0) + , m_directWriteFactory(directWriteFactory) + , m_directWriteBitmapRenderTarget(0) + , m_directWriteGdiInterop(directWriteGdiInterop) + , m_lineThickness(-1) + , m_unitsPerEm(-1) + , m_ascent(-1) + , m_descent(-1) + , m_xHeight(-1) + , m_lineGap(-1) +{ + m_directWriteFont->AddRef(); + m_directWriteFactory->AddRef(); + m_directWriteGdiInterop->AddRef(); + + fontDef.pixelSize = pixelSize; + + HRESULT hr = m_directWriteFont->CreateFontFace(&m_directWriteFontFace); + if (FAILED(hr)) + qErrnoWarning("QFontEngineDirectWrite: CreateFontFace failed"); + + collectMetrics(); +} + +QFontEngineDirectWrite::~QFontEngineDirectWrite() +{ + m_directWriteFont->Release(); + m_directWriteFactory->Release(); + m_directWriteGdiInterop->Release(); + + if (m_directWriteBitmapRenderTarget != 0) + m_directWriteBitmapRenderTarget->Release(); +} + +void QFontEngineDirectWrite::collectMetrics() +{ + if (m_directWriteFont != 0) { + DWRITE_FONT_METRICS metrics; + + m_directWriteFont->GetMetrics(&metrics); + m_unitsPerEm = metrics.designUnitsPerEm; + + m_lineThickness = DESIGN_TO_LOGICAL(metrics.underlineThickness); + m_ascent = DESIGN_TO_LOGICAL(metrics.ascent); + m_descent = DESIGN_TO_LOGICAL(metrics.descent); + m_xHeight = DESIGN_TO_LOGICAL(metrics.xHeight); + m_lineGap = DESIGN_TO_LOGICAL(metrics.lineGap); + } +} + +QFixed QFontEngineDirectWrite::lineThickness() const +{ + if (m_lineThickness > 0) + return m_lineThickness; + else + return QFontEngine::lineThickness(); +} + +bool QFontEngineDirectWrite::getSfntTableData(uint tag, uchar *buffer, uint *length) const +{ + if (m_directWriteFontFace) { + DWORD t = qbswap<quint32>(tag); + + const void *tableData = 0; + void *tableContext = 0; + UINT32 tableSize; + BOOL exists; + HRESULT hr = m_directWriteFontFace->TryGetFontTable( + t, &tableData, &tableSize, &tableContext, &exists + ); + + if (SUCCEEDED(hr)) { + if (!exists) + return false; + + if (buffer == 0) { + *length = tableSize; + return true; + } else if (*length < tableSize) { + return false; + } + + qMemCopy(buffer, tableData, tableSize); + m_directWriteFontFace->ReleaseFontTable(tableContext); + + return true; + } else { + qErrnoWarning("QFontEngineDirectWrite::getSfntTableData: TryGetFontTable failed"); + } + } + + return false; +} + +QFixed QFontEngineDirectWrite::emSquareSize() const +{ + if (m_unitsPerEm > 0) + return m_unitsPerEm; + else + return QFontEngine::emSquareSize(); +} + +inline unsigned int getChar(const QChar *str, int &i, const int len) +{ + unsigned int uc = str[i].unicode(); + if (uc >= 0xd800 && uc < 0xdc00 && i < len-1) { + uint low = str[i+1].unicode(); + if (low >= 0xdc00 && low < 0xe000) { + uc = (uc - 0xd800)*0x400 + (low - 0xdc00) + 0x10000; + ++i; + } + } + return uc; +} + +bool QFontEngineDirectWrite::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, + int *nglyphs, QTextEngine::ShaperFlags flags) const +{ + if (m_directWriteFontFace != 0) { + QVarLengthArray<UINT32> codePoints(len); + for (int i=0; i<len; ++i) { + codePoints[i] = getChar(str, i, len); + if (flags & QTextEngine::RightToLeft) + codePoints[i] = QChar::mirroredChar(codePoints[i]); + } + + QVarLengthArray<UINT16> glyphIndices(len); + HRESULT hr = m_directWriteFontFace->GetGlyphIndicesW(codePoints.data(), + len, + glyphIndices.data()); + + if (SUCCEEDED(hr)) { + for (int i=0; i<len; ++i) + glyphs->glyphs[i] = glyphIndices[i]; + + *nglyphs = len; + + if (!(flags & QTextEngine::GlyphIndicesOnly)) + recalcAdvances(glyphs, 0); + + return true; + } else { + qErrnoWarning("QFontEngineDirectWrite::stringToCMap: GetGlyphIndicesW failed"); + } + } + + return false; +} + +void QFontEngineDirectWrite::recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags) const +{ + if (m_directWriteFontFace == 0) + return; + + QVarLengthArray<UINT16> glyphIndices(glyphs->numGlyphs); + + // ### Caching? + for(int i=0; i<glyphs->numGlyphs; i++) + glyphIndices[i] = UINT16(glyphs->glyphs[i]); + + QVarLengthArray<DWRITE_GLYPH_METRICS> glyphMetrics(glyphIndices.size()); + HRESULT hr = m_directWriteFontFace->GetDesignGlyphMetrics(glyphIndices.data(), + glyphIndices.size(), + glyphMetrics.data()); + if (SUCCEEDED(hr)) { + for (int i=0; i<glyphs->numGlyphs; ++i) { + glyphs->advances_x[i] = DESIGN_TO_LOGICAL(glyphMetrics[i].advanceWidth); + if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) + glyphs->advances_x[i] = glyphs->advances_x[i].round(); + glyphs->advances_y[i] = 0; + } + } else { + qErrnoWarning("QFontEngineDirectWrite::recalcAdvances: GetDesignGlyphMetrics failed"); + } +} + +void QFontEngineDirectWrite::addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, + QPainterPath *path, QTextItem::RenderFlags flags) +{ + if (m_directWriteFontFace == 0) + return; + + QVarLengthArray<UINT16> glyphIndices(nglyphs); + QVarLengthArray<DWRITE_GLYPH_OFFSET> glyphOffsets(nglyphs); + QVarLengthArray<FLOAT> glyphAdvances(nglyphs); + + for (int i=0; i<nglyphs; ++i) { + glyphIndices[i] = glyphs[i]; + glyphOffsets[i].advanceOffset = positions[i].x.toReal(); + glyphOffsets[i].ascenderOffset = -positions[i].y.toReal(); + glyphAdvances[i] = 0.0; + } + + GeometrySink geometrySink(path); + HRESULT hr = m_directWriteFontFace->GetGlyphRunOutline( + fontDef.pixelSize, + glyphIndices.data(), + glyphAdvances.data(), + glyphOffsets.data(), + nglyphs, + false, + flags & QTextItem::RightToLeft, + &geometrySink + ); + + if (FAILED(hr)) + qErrnoWarning("QFontEngineDirectWrite::addGlyphsToPath: GetGlyphRunOutline failed"); +} + +glyph_metrics_t QFontEngineDirectWrite::boundingBox(const QGlyphLayout &glyphs) +{ + if (glyphs.numGlyphs == 0) + return glyph_metrics_t(); + + bool round = fontDef.styleStrategy & QFont::ForceIntegerMetrics; + + QFixed w = 0; + for (int i = 0; i < glyphs.numGlyphs; ++i) { + w += round ? glyphs.effectiveAdvance(i).round() : glyphs.effectiveAdvance(i); + + } + + return glyph_metrics_t(0, -m_ascent, w - lastRightBearing(glyphs), m_ascent + m_descent, w, 0); +} + +glyph_metrics_t QFontEngineDirectWrite::boundingBox(glyph_t g) +{ + if (m_directWriteFontFace == 0) + return glyph_metrics_t(); + + UINT16 glyphIndex = g; + + DWRITE_GLYPH_METRICS glyphMetrics; + HRESULT hr = m_directWriteFontFace->GetDesignGlyphMetrics(&glyphIndex, 1, &glyphMetrics); + if (SUCCEEDED(hr)) { + QFixed advanceWidth = DESIGN_TO_LOGICAL(glyphMetrics.advanceWidth); + QFixed leftSideBearing = DESIGN_TO_LOGICAL(glyphMetrics.leftSideBearing); + QFixed rightSideBearing = DESIGN_TO_LOGICAL(glyphMetrics.rightSideBearing); + QFixed advanceHeight = DESIGN_TO_LOGICAL(glyphMetrics.advanceHeight); + QFixed verticalOriginY = DESIGN_TO_LOGICAL(glyphMetrics.verticalOriginY); + + if (fontDef.styleStrategy & QFont::ForceIntegerMetrics) { + advanceWidth = advanceWidth.round(); + advanceHeight = advanceHeight.round(); + } + + QFixed width = advanceWidth - leftSideBearing - rightSideBearing; + + return glyph_metrics_t(-leftSideBearing, -verticalOriginY, + width, m_ascent + m_descent, + advanceWidth, advanceHeight); + } else { + qErrnoWarning("QFontEngineDirectWrite::boundingBox: GetDesignGlyphMetrics failed"); + } + + return glyph_metrics_t(); +} + +QFixed QFontEngineDirectWrite::ascent() const +{ + return fontDef.styleStrategy & QFont::ForceIntegerMetrics + ? m_ascent.round() + : m_ascent; +} + +QFixed QFontEngineDirectWrite::descent() const +{ + return fontDef.styleStrategy & QFont::ForceIntegerMetrics + ? (m_descent - 1).round() + : (m_descent - 1); +} + +QFixed QFontEngineDirectWrite::leading() const +{ + return fontDef.styleStrategy & QFont::ForceIntegerMetrics + ? m_lineGap.round() + : m_lineGap; +} + +QFixed QFontEngineDirectWrite::xHeight() const +{ + return fontDef.styleStrategy & QFont::ForceIntegerMetrics + ? m_xHeight.round() + : m_xHeight; +} + +qreal QFontEngineDirectWrite::maxCharWidth() const +{ + // ### + return 0; +} + +extern uint qt_pow_gamma[256]; + +QImage QFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition) +{ + QImage im = imageForGlyph(glyph, subPixelPosition, 0, QTransform()); + + QImage indexed(im.width(), im.height(), QImage::Format_Indexed8); + QVector<QRgb> colors(256); + for (int i=0; i<256; ++i) + colors[i] = qRgba(0, 0, 0, i); + indexed.setColorTable(colors); + + for (int y=0; y<im.height(); ++y) { + uint *src = (uint*) im.scanLine(y); + uchar *dst = indexed.scanLine(y); + for (int x=0; x<im.width(); ++x) { + *dst = qGray(*src); + if (QNativeImage::systemFormat() == QImage::Format_RGB16) + *dst = 255 - qGray(*src); + else + *dst = 255 - (qt_pow_gamma[qGray(*src)] * 255. / 2047.); + + ++dst; + ++src; + } + } + + return indexed; +} + +bool QFontEngineDirectWrite::supportsSubPixelPositions() const +{ + return true; +} + +QImage QFontEngineDirectWrite::imageForGlyph(glyph_t t, + QFixed subPixelPosition, + int margin, + const QTransform &xform) +{ + glyph_metrics_t metrics = QFontEngine::boundingBox(t, xform); + int width = (metrics.width + margin * 2 + 4).ceil().toInt() ; + int height = (metrics.height + margin * 2 + 4).ceil().toInt(); + + UINT16 glyphIndex = t; + FLOAT glyphAdvance = metrics.xoff.toReal(); + + DWRITE_GLYPH_OFFSET glyphOffset; + glyphOffset.advanceOffset = 0; + glyphOffset.ascenderOffset = 0; + + DWRITE_GLYPH_RUN glyphRun; + glyphRun.fontFace = m_directWriteFontFace; + glyphRun.fontEmSize = fontDef.pixelSize; + glyphRun.glyphCount = 1; + glyphRun.glyphIndices = &glyphIndex; + glyphRun.glyphAdvances = &glyphAdvance; + glyphRun.isSideways = false; + glyphRun.bidiLevel = 0; + glyphRun.glyphOffsets = &glyphOffset; + + QFixed x = margin - metrics.x.round() + subPixelPosition; + QFixed y = margin - metrics.y.floor(); + + DWRITE_MATRIX transform; + transform.dx = x.toReal(); + transform.dy = y.toReal(); + transform.m11 = xform.m11(); + transform.m12 = xform.m12(); + transform.m21 = xform.m21(); + transform.m22 = xform.m22(); + + IDWriteGlyphRunAnalysis *glyphAnalysis = NULL; + HRESULT hr = m_directWriteFactory->CreateGlyphRunAnalysis( + &glyphRun, + 1.0f, + &transform, + DWRITE_RENDERING_MODE_CLEARTYPE_NATURAL_SYMMETRIC, + DWRITE_MEASURING_MODE_NATURAL, + 0.0, 0.0, + &glyphAnalysis + ); + + if (SUCCEEDED(hr)) { + RECT rect; + rect.left = 0; + rect.top = 0; + rect.right = width; + rect.bottom = height; + + int size = width * height * 3; + BYTE *alphaValues = new BYTE[size]; + qMemSet(alphaValues, size, 0); + + hr = glyphAnalysis->CreateAlphaTexture(DWRITE_TEXTURE_CLEARTYPE_3x1, + &rect, + alphaValues, + size); + + if (SUCCEEDED(hr)) { + QImage img(width, height, QImage::Format_RGB32); + img.fill(0xffffffff); + + for (int y=0; y<height; ++y) { + uint *dest = reinterpret_cast<uint *>(img.scanLine(y)); + BYTE *src = alphaValues + width * 3 * y; + + for (int x=0; x<width; ++x) { + dest[x] = *(src) << 16 + | *(src + 1) << 8 + | *(src + 2); + + src += 3; + } + } + + delete[] alphaValues; + glyphAnalysis->Release(); + + return img; + } else { + delete[] alphaValues; + glyphAnalysis->Release(); + + qErrnoWarning("QFontEngineDirectWrite::imageForGlyph: CreateAlphaTexture failed"); + } + + } else { + qErrnoWarning("QFontEngineDirectWrite::imageForGlyph: CreateGlyphRunAnalysis failed"); + } + + return QImage(); +} + +QImage QFontEngineDirectWrite::alphaRGBMapForGlyph(glyph_t t, + QFixed subPixelPosition, + int margin, + const QTransform &xform) +{ + QImage mask = imageForGlyph(t, subPixelPosition, margin, xform); + return mask.depth() == 32 + ? mask + : mask.convertToFormat(QImage::Format_RGB32); +} + +const char *QFontEngineDirectWrite::name() const +{ + return 0; +} + +bool QFontEngineDirectWrite::canRender(const QChar *string, int len) +{ + for (int i=0; i<len; ++i) { + BOOL exists; + UINT32 codePoint = getChar(string, i, len); + HRESULT hr = m_directWriteFont->HasCharacter(codePoint, &exists); + if (FAILED(hr)) { + qErrnoWarning("QFontEngineDirectWrite::canRender: HasCharacter failed"); + return false; + } else if (!exists) { + return false; + } + } + + return true; +} + +QFontEngine::Type QFontEngineDirectWrite::type() const +{ + return QFontEngine::DirectWrite; +} + +QT_END_NAMESPACE + +#endif // QT_NO_DIRECTWRITE diff --git a/src/gui/text/qfontenginedirectwrite_p.h b/src/gui/text/qfontenginedirectwrite_p.h new file mode 100644 index 0000000..80f90b8 --- /dev/null +++ b/src/gui/text/qfontenginedirectwrite_p.h @@ -0,0 +1,133 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtGui module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QFONTENGINEDIRECTWRITE_H +#define QFONTENGINEDIRECTWRITE_H + +#ifndef QT_NO_DIRECTWRITE + +// +// W A R N I N G +// ------------- +// +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. +// +// We mean it. +// + +#include "private/qfontengine_p.h" + +struct IDWriteFont ; +struct IDWriteFontFace ; +struct IDWriteFactory ; +struct IDWriteBitmapRenderTarget ; +struct IDWriteGdiInterop ; + +QT_BEGIN_NAMESPACE + +class QFontEngineDirectWrite : public QFontEngine +{ + Q_OBJECT +public: + explicit QFontEngineDirectWrite(const QString &name, + IDWriteFactory *directWriteFactory, + IDWriteGdiInterop *directWriteGdiInterop, + IDWriteFont *directWriteFont, + qreal pixelSize); + ~QFontEngineDirectWrite(); + + QFixed lineThickness() const; + bool getSfntTableData(uint tag, uchar *buffer, uint *length) const; + QFixed emSquareSize() const; + + bool stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags) const; + void recalcAdvances(QGlyphLayout *glyphs, QTextEngine::ShaperFlags) const; + + void addGlyphsToPath(glyph_t *glyphs, QFixedPoint *positions, int nglyphs, + QPainterPath *path, QTextItem::RenderFlags flags); + + glyph_metrics_t boundingBox(const QGlyphLayout &glyphs); + glyph_metrics_t boundingBox(glyph_t g); + + QFixed ascent() const; + QFixed descent() const; + QFixed leading() const; + QFixed xHeight() const; + qreal maxCharWidth() const; + + const char *name() const; + + bool supportsSubPixelPositions() const; + + QImage alphaMapForGlyph(glyph_t glyph, QFixed subPixelPosition); + QImage alphaRGBMapForGlyph(glyph_t t, QFixed subPixelPosition, int margin, + const QTransform &xform); + + bool canRender(const QChar *string, int len); + Type type() const; + +private: + QImage imageForGlyph(glyph_t t, QFixed subPixelPosition, int margin, const QTransform &xform); + void collectMetrics(); + + QString m_name; + IDWriteFont *m_directWriteFont; + IDWriteFontFace *m_directWriteFontFace; + IDWriteFactory *m_directWriteFactory; + IDWriteBitmapRenderTarget *m_directWriteBitmapRenderTarget; + IDWriteGdiInterop *m_directWriteGdiInterop; + + QFixed m_lineThickness; + int m_unitsPerEm; + QFixed m_ascent; + QFixed m_descent; + QFixed m_xHeight; + QFixed m_lineGap; + FaceId m_faceId; +}; + +QT_END_NAMESPACE + +#endif // QT_NO_DIRECTWRITE + +#endif // QFONTENGINEDIRECTWRITE_H diff --git a/src/gui/text/qtextformat.cpp b/src/gui/text/qtextformat.cpp index c9af401..a02ea49 100644 --- a/src/gui/text/qtextformat.cpp +++ b/src/gui/text/qtextformat.cpp @@ -411,6 +411,9 @@ void QTextFormatPrivate::recalcFont() const case QTextFormat::FontStyleHint: f.setStyleHint(static_cast<QFont::StyleHint>(props.at(i).value.toInt()), f.styleStrategy()); break; + case QTextFormat::FontHintingPreference: + f.setHintingPreference(static_cast<QFont::HintingPreference>(props.at(i).value.toInt())); + break; case QTextFormat::FontStyleStrategy: f.setStyleStrategy(static_cast<QFont::StyleStrategy>(props.at(i).value.toInt())); break; @@ -1565,6 +1568,25 @@ void QTextCharFormat::setUnderlineStyle(UnderlineStyle style) \sa font() */ +/*! + \since 4.8 + + \fn void QTextCharFormat::setFontHintingPreference(QFont::HintingPreference hintingPreference) + + Sets the hinting preference of the text format's font to be \a hintingPreference. + + \sa setFont(), QFont::setHintingPreference() +*/ + +/*! + \since 4.8 + + \fn QFont::HintingPreference QTextCharFormat::fontHintingPreference() const + + Returns the hinting preference set for this text format. + + \sa font(), QFont::hintingPreference() +*/ /*! \fn QPen QTextCharFormat::textOutline() const diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h index 9a573a0..ff28eaa 100644 --- a/src/gui/text/qtextformat.h +++ b/src/gui/text/qtextformat.h @@ -177,6 +177,7 @@ public: FontStyleHint = 0x1FE3, FontStyleStrategy = 0x1FE4, FontKerning = 0x1FE5, + FontHintingPreference = 0x1FE6, FontFamily = 0x2000, FontPointSize = 0x2001, FontSizeAdjustment = 0x2002, @@ -460,6 +461,16 @@ public: QFont::StyleStrategy fontStyleStrategy() const { return static_cast<QFont::StyleStrategy>(intProperty(FontStyleStrategy)); } + inline void setFontHintingPreference(QFont::HintingPreference hintingPreference) + { + setProperty(FontHintingPreference, hintingPreference); + } + + inline QFont::HintingPreference fontHintingPreference() const + { + return static_cast<QFont::HintingPreference>(intProperty(FontHintingPreference)); + } + inline void setFontKerning(bool enable) { setProperty(FontKerning, enable); } inline bool fontKerning() const diff --git a/src/gui/text/text.pri b/src/gui/text/text.pri index d3e8f2d..7fb2783 100644 --- a/src/gui/text/text.pri +++ b/src/gui/text/text.pri @@ -81,6 +81,12 @@ win32 { HEADERS += text/qfontengine_win_p.h } +contains(QT_CONFIG, directwrite) { + LIBS_PRIVATE += -ldwrite + HEADERS += text/qfontenginedirectwrite_p.h + SOURCES += text/qfontenginedirectwrite.cpp +} + unix:x11 { HEADERS += \ text/qfontengine_x11_p.h \ diff --git a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp index 4f4e706a..07da68d 100644 --- a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp +++ b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp @@ -61,6 +61,9 @@ #include <private/qtextengine_p.h> #include <qtextlayout.h> #undef private +#else +#include <private/qtextengine_p.h> +#include <qtextlayout.h> #endif #include <qfontdatabase.h> @@ -105,6 +108,9 @@ private slots: void linearB(); void controlInSyllable_qtbug14204(); void combiningMarks_qtbug15675(); + + void mirroredChars_data(); + void mirroredChars(); }; tst_QTextScriptEngine::tst_QTextScriptEngine() @@ -1156,5 +1162,59 @@ void tst_QTextScriptEngine::combiningMarks_qtbug15675() #endif } +void tst_QTextScriptEngine::mirroredChars_data() +{ + QTest::addColumn<int>("hintingPreference"); + + QTest::newRow("Default hinting") << int(QFont::PreferDefaultHinting); + QTest::newRow("No hinting") << int(QFont::PreferNoHinting); + QTest::newRow("Vertical hinting") << int(QFont::PreferVerticalHinting); + QTest::newRow("Full hinting") << int(QFont::PreferFullHinting); +} + +void tst_QTextScriptEngine::mirroredChars() +{ + QFETCH(int, hintingPreference); + + QFont font; + font.setHintingPreference(QFont::HintingPreference(hintingPreference)); + + QString s; + s.append(QLatin1Char('(')); + s.append(QLatin1Char(')')); + + HB_Glyph leftParenthesis; + HB_Glyph rightParenthesis; + { + QTextLayout layout(s); + layout.beginLayout(); + layout.createLine(); + layout.endLayout(); + + QTextEngine *e = layout.engine(); + e->itemize(); + e->shape(0); + QCOMPARE(e->layoutData->items[0].num_glyphs, ushort(2)); + + const QGlyphLayout &glyphLayout = e->layoutData->glyphLayout; + leftParenthesis = glyphLayout.glyphs[0]; + rightParenthesis = glyphLayout.glyphs[1]; + } + + { + QTextLayout layout(s); + layout.setFlags(Qt::TextForceRightToLeft); + + QTextEngine *e = layout.engine(); + e->itemize(); + e->shape(0); + QCOMPARE(e->layoutData->items[0].num_glyphs, ushort(2)); + + const QGlyphLayout &glyphLayout = e->layoutData->glyphLayout; + QCOMPARE(glyphLayout.glyphs[0], rightParenthesis); + QCOMPARE(glyphLayout.glyphs[1], leftParenthesis); + } +} + QTEST_MAIN(tst_QTextScriptEngine) #include "tst_qtextscriptengine.moc" diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp index 19cef9a..4503235 100644 --- a/tools/configure/configureapp.cpp +++ b/tools/configure/configureapp.cpp @@ -281,6 +281,7 @@ Configure::Configure(int& argc, char** argv) dictionary[ "DECLARATIVE" ] = "auto"; dictionary[ "DECLARATIVE_DEBUG" ]= "yes"; dictionary[ "PLUGIN_MANIFESTS" ] = "yes"; + dictionary[ "DIRECTWRITE" ] = "no"; QString version; QFile qglobal_h(sourcePath + "/src/corelib/global/qglobal.h"); @@ -1229,6 +1230,12 @@ void Configure::parseCmdLine() } } + else if (configCmdLine.at(i) == "-directwrite") { + dictionary["DIRECTWRITE"] = "yes"; + } else if (configCmdLine.at(i) == "-no-directwrite") { + dictionary["DIRECTWRITE"] = "no"; + } + else { dictionary[ "HELP" ] = "yes"; cout << "Unknown option " << configCmdLine.at(i) << endl; @@ -1684,7 +1691,9 @@ bool Configure::displayHelp() "[-phonon] [-no-phonon-backend] [-phonon-backend]\n" "[-no-multimedia] [-multimedia] [-no-audio-backend] [-audio-backend]\n" "[-no-script] [-script] [-no-scripttools] [-scripttools]\n" - "[-no-webkit] [-webkit] [-webkit-debug] [-graphicssystem raster|opengl|openvg]\n\n", 0, 7); + "[-no-webkit] [-webkit] [-webkit-debug]\n" + "[-graphicssystem raster|opengl|openvg]\n" + "[-no-directwrite] [-directwrite]\n\n", 0, 7); desc("Installation options:\n\n"); @@ -1881,6 +1890,8 @@ bool Configure::displayHelp() desc("DECLARATIVE", "yes", "-declarative", "Build the declarative module"); desc("DECLARATIVE_DEBUG", "no", "-no-declarative-debug", "Do not build the declarative debugging support"); desc("DECLARATIVE_DEBUG", "yes", "-declarative-debug", "Build the declarative debugging support"); + desc("DIRECTWRITE", "no", "-no-directwrite", "Do not build support for DirectWrite font rendering"); + desc("DIRECTWRITE", "yes", "-directwrite", "Build support for DirectWrite font rendering (experimental, requires DirectWrite availability on target systems, e.g. Windows Vista with Platform Update, Windows 7, etc.)"); desc( "-arch <arch>", "Specify an architecture.\n" "Available values for <arch>:"); @@ -2244,6 +2255,8 @@ bool Configure::checkAvailability(const QString &part) available = false; } } + } else if (part == "DIRECTWRITE") { + available = findFile("dwrite.h") && findFile("d2d1.h") && findFile("dwrite.lib"); } return available; @@ -2399,6 +2412,15 @@ bool Configure::verifyConfiguration() dictionary["SCRIPT"] = "yes"; } + if (dictionary["DIRECTWRITE"] == "yes" && !checkAvailability("DIRECTWRITE")) { + cout << "WARNING: To be able to compile the DirectWrite font engine you will" << endl + << "need the Microsoft DirectWrite and Microsoft Direct2D development" << endl + << "files such as headers and libraries." << endl + << "(Press any key to continue..)"; + if (_getch() == 3) // _Any_ keypress w/no echo(eat <Enter> for stdout) + exit(0); // Exit cleanly for Ctrl+C + } + return true; } @@ -2755,6 +2777,9 @@ void Configure::generateOutputVars() qtConfig += "declarative"; } + if (dictionary["DIRECTWRITE"] == "yes") + qtConfig += "directwrite"; + if (dictionary[ "NATIVE_GESTURES" ] == "yes") qtConfig += "native-gestures"; @@ -2986,6 +3011,10 @@ void Configure::generateCachefile() configStream << " def_files_disabled"; } } + + if (dictionary["DIRECTWRITE"] == "yes") + configStream << "directwrite"; + configStream << endl; configStream << "QT_ARCH = " << dictionary[ "ARCHITECTURE" ] << endl; if (dictionary["QT_EDITION"].contains("OPENSOURCE")) @@ -3454,7 +3483,8 @@ void Configure::displayConfig() cout << "QtScript support............" << dictionary[ "SCRIPT" ] << endl; cout << "QtScriptTools support......." << dictionary[ "SCRIPTTOOLS" ] << endl; cout << "Graphics System............." << dictionary[ "GRAPHICS_SYSTEM" ] << endl; - cout << "Qt3 compatibility..........." << dictionary[ "QT3SUPPORT" ] << endl << endl; + cout << "Qt3 compatibility..........." << dictionary[ "QT3SUPPORT" ] << endl; + cout << "DirectWrite support........." << dictionary[ "DIRECTWRITE" ] << endl << endl; cout << "Third Party Libraries:" << endl; cout << " ZLIB support............" << dictionary[ "ZLIB" ] << endl; -- cgit v0.12 From 57bda4d3139edeb76689ac64a8c36e5551093bf9 Mon Sep 17 00:00:00 2001 From: Jiang Jiang <jiang.jiang@nokia.com> Date: Fri, 18 Feb 2011 10:18:49 +0100 Subject: Fix combining marks shaping without GPOS feature in HarfBuzz For certain OpenType fonts like DejaVu Sans Mono, not all combining marks has GPOS feature applied, U+0062 U+0332 is one of the case. Only getting the advances for indivivual glyphs is not enough, we should also do heuristic positioning to put the combining mark in the right place. Task-number: QTBUG-15675 Reviewed-by: Lars Knoll --- src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp | 2 +- .../qtextscriptengine/tst_qtextscriptengine.cpp | 22 +++++++++++++++++++++- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp index ef86144..6c4d9f1 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp +++ b/src/3rdparty/harfbuzz/src/harfbuzz-shaper.cpp @@ -1232,7 +1232,7 @@ HB_Bool HB_OpenTypePosition(HB_ShaperItem *item, int availableGlyphs, HB_Bool do } if (!face->glyphs_substituted && !glyphs_positioned) { - HB_GetGlyphAdvances(item); + HB_HeuristicPosition(item); return true; // nothing to do for us } diff --git a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp index 07da68d..54c07a2 100644 --- a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp +++ b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp @@ -1157,8 +1157,28 @@ void tst_QTextScriptEngine::combiningMarks_qtbug15675() QVERIFY(e->layoutData->items[0].num_glyphs == 4); QVERIFY(e->layoutData->glyphLayout.advances_y[2] > 0); +#elif defined(Q_WS_X11) + QFontDatabase db; + + if (!db.families().contains("DejaVu Sans Mono")) { + QSKIP("Required font (DejaVu Sans Mono) doesn't exist, skip test.", SkipAll); + return; + } + + QString s; + s.append(QChar(0x0062)); + s.append(QChar(0x0332)); + s.append(QChar(0x0063)); + + QTextLayout layout(s, QFont("DejaVu Sans Mono")); + QTextEngine *e = layout.d; + e->itemize(); + e->shape(0); + + QVERIFY(e->layoutData->items[0].num_glyphs == 3); + QVERIFY(e->layoutData->glyphLayout.advances_x[1] == 0); #else - QSKIP("Mac specific test", SkipAll); + QSKIP("X11/Mac specific test", SkipAll); #endif } -- cgit v0.12 From a12d39fddf615a7d75e56403525a64847e4ba5a6 Mon Sep 17 00:00:00 2001 From: Lars Knoll <lars.knoll@nokia.com> Date: Mon, 31 Jan 2011 15:57:53 +0100 Subject: Fix hebrew shaping of characters with multiple diacritics. The old code would work for a maximum of one diacritic and insert dotted circles in valid syllables. --- src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c b/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c index 67029be..b5431a5 100644 --- a/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c +++ b/src/3rdparty/harfbuzz/src/harfbuzz-hebrew.c @@ -84,7 +84,7 @@ HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item) logClusters[0] = 0; for (i = 1; i < shaper_item->item.length; ++i) { - hb_uint16 base = shapedChars[slen-1]; + hb_uint16 base = shapedChars[cluster_start]; hb_uint16 shaped = 0; HB_Bool invalid = FALSE; if (uc[i] == Dagesh) { @@ -143,7 +143,7 @@ HB_Bool HB_HebrewShape(HB_ShaperItem *shaper_item) } if (shaped) { if (shaper_item->font->klass->canRender(shaper_item->font, (HB_UChar16 *)&shaped, 1)) { - shapedChars[slen-1] = shaped; + shapedChars[cluster_start] = shaped; } else shaped = 0; } -- cgit v0.12 From 4d104eb33542b78e233abb9a0d6d4a0ee1495868 Mon Sep 17 00:00:00 2001 From: Jiang Jiang <jiang.jiang@nokia.com> Date: Mon, 14 Mar 2011 12:04:31 +0100 Subject: Add RightToLeft direction forcing to Core Text shaper So that setting Qt::TextForceRightToLeft flag on QTextLayout can work. Reviewed-by: Eskil --- src/gui/text/qfontengine_coretext.mm | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qfontengine_coretext.mm b/src/gui/text/qfontengine_coretext.mm index 0209689..4b65cf5 100644 --- a/src/gui/text/qfontengine_coretext.mm +++ b/src/gui/text/qfontengine_coretext.mm @@ -119,14 +119,25 @@ uint QCoreTextFontEngineMulti::fontIndexForFont(CTFontRef id) const return engines.count() - 1; } -bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags, +bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLayout *glyphs, int *nglyphs, QTextEngine::ShaperFlags flags, unsigned short *logClusters, const HB_CharAttributes *) const { QCFType<CFStringRef> cfstring = CFStringCreateWithCharactersNoCopy(0, reinterpret_cast<const UniChar *>(str), len, kCFAllocatorNull); QCFType<CFAttributedStringRef> attributedString = CFAttributedStringCreate(0, cfstring, attributeDict); - QCFType<CTTypesetterRef> typeSetter = CTTypesetterCreateWithAttributedString(attributedString); + QCFType<CTTypesetterRef> typeSetter; + + if (flags & QTextEngine::RightToLeft) { + const void *optionKeys[] = { kCTTypesetterOptionForcedEmbeddingLevel }; + const short rtlForcedEmbeddingLevelValue = 1; + const void *rtlOptionValues[] = { CFNumberCreate(kCFAllocatorDefault, kCFNumberShortType, &rtlForcedEmbeddingLevelValue) }; + QCFType<CFDictionaryRef> options = CFDictionaryCreate(kCFAllocatorDefault, optionKeys, rtlOptionValues, 1, + &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); + typeSetter = CTTypesetterCreateWithAttributedStringAndOptions(attributedString, options); + } else + typeSetter = CTTypesetterCreateWithAttributedString(attributedString); + CFRange range = {0, 0}; QCFType<CTLineRef> line = CTTypesetterCreateLine(typeSetter, range); CFArrayRef array = CTLineGetGlyphRuns(line); -- cgit v0.12 From 25a30c8e258df642a1aa2ffcfb162633611e7259 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> Date: Mon, 14 Mar 2011 16:07:33 +0100 Subject: Fix checking hintingPreference in Windows font database This was a left-over of when the API was flags-based. Reviewed-by: Jiang Jiang --- src/gui/text/qfontdatabase_win.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qfontdatabase_win.cpp b/src/gui/text/qfontdatabase_win.cpp index 0bb1d8d..8279195 100644 --- a/src/gui/text/qfontdatabase_win.cpp +++ b/src/gui/text/qfontdatabase_win.cpp @@ -703,8 +703,8 @@ QFontEngine *loadEngine(int script, const QFontPrivate *fp, const QFontDef &requ #if !defined(QT_NO_DIRECTWRITE) - bool useDirectWrite = (request.hintingPreference & QFont::PreferNoHinting) - || (request.hintingPreference & QFont::PreferVerticalHinting); + bool useDirectWrite = (request.hintingPreference == QFont::PreferNoHinting) + || (request.hintingPreference == QFont::PreferVerticalHinting); IDWriteFont *directWriteFont = 0; #else bool useDirectWrite = false; -- cgit v0.12 From 369ad09515fc8dac87613930114f4b3cf6381e81 Mon Sep 17 00:00:00 2001 From: Paul Olav Tvete <paul.tvete@nokia.com> Date: Mon, 14 Mar 2011 16:55:19 +0100 Subject: Fix race condition in the non-GL case MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Make sure to also flush output when waiting for an ack from the compositor, in case we haven't sent the frame request yet. Reviewed-by: Jørgen --- src/plugins/platforms/wayland/qwaylanddisplay.cpp | 11 ++++++++--- src/plugins/platforms/wayland/qwaylanddisplay.h | 4 +++- src/plugins/platforms/wayland/qwaylandshmsurface.cpp | 2 +- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.cpp b/src/plugins/platforms/wayland/qwaylanddisplay.cpp index d0a0725..27f4334 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.cpp +++ b/src/plugins/platforms/wayland/qwaylanddisplay.cpp @@ -141,7 +141,12 @@ void QWaylandDisplay::displayHandleGlobal(struct wl_display *display, } } -void QWaylandDisplay::eventDispatcher(void) +void QWaylandDisplay::iterate() +{ + wl_display_iterate(mDisplay, WL_DISPLAY_READABLE | WL_DISPLAY_WRITABLE); +} + +void QWaylandDisplay::readEvents(void) { wl_display_iterate(mDisplay, WL_DISPLAY_READABLE); } @@ -189,7 +194,7 @@ QWaylandDisplay::QWaylandDisplay(void) mNativeEglDisplay = 0; #endif - eventDispatcher(); + readEvents(); #ifdef QT_WAYLAND_GL_SUPPORT mEglDisplay = eglGetDisplay((EGLNativeDisplayType)mNativeEglDisplay); @@ -208,7 +213,7 @@ QWaylandDisplay::QWaylandDisplay(void) int fd = wl_display_get_fd(mDisplay, sourceUpdate, this); mReadNotifier = new QSocketNotifier(fd, QSocketNotifier::Read, this); connect(mReadNotifier, - SIGNAL(activated(int)), this, SLOT(eventDispatcher())); + SIGNAL(activated(int)), this, SLOT(readEvents())); mWriteNotifier = new QSocketNotifier(fd, QSocketNotifier::Write, this); connect(mWriteNotifier, diff --git a/src/plugins/platforms/wayland/qwaylanddisplay.h b/src/plugins/platforms/wayland/qwaylanddisplay.h index ca31756..d994ffe 100644 --- a/src/plugins/platforms/wayland/qwaylanddisplay.h +++ b/src/plugins/platforms/wayland/qwaylanddisplay.h @@ -81,8 +81,10 @@ public: void syncCallback(wl_display_sync_func_t func, void *data); void frameCallback(wl_display_frame_func_t func, void *data); + void iterate(); + public slots: - void eventDispatcher(void); + void readEvents(void); void flushRequests(void); private: diff --git a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp index b1cba71..6872bac 100644 --- a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp @@ -111,7 +111,7 @@ QPaintDevice *QWaylandShmWindowSurface::paintDevice() void QWaylandShmWindowSurface::beginPaint(const QRegion &) { while (mWaitingForFrameSync) { - mDisplay->eventDispatcher(); + mDisplay->iterate(); } } -- cgit v0.12 From 6d4ef0ff8fd30e5f50f6f770d651a51584e5cfdc Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> Date: Tue, 15 Mar 2011 09:39:13 +0100 Subject: Fix grayscale antialiasing with DirectWrite engine The code that converted DirectWrite's output to grayscale in alphaMapForGlyph() had a bunch of copy-paste errors and had obviously not been tested properly. We invert the input to the gamma function to get the right curve and then invert the output back. See windows font engine for comparison. Reviewed-by: Jiang Jiang --- src/gui/text/qfontenginedirectwrite.cpp | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/gui/text/qfontenginedirectwrite.cpp b/src/gui/text/qfontenginedirectwrite.cpp index 23fff0d..af5bab2 100644 --- a/src/gui/text/qfontenginedirectwrite.cpp +++ b/src/gui/text/qfontenginedirectwrite.cpp @@ -485,12 +485,7 @@ QImage QFontEngineDirectWrite::alphaMapForGlyph(glyph_t glyph, QFixed subPixelPo uint *src = (uint*) im.scanLine(y); uchar *dst = indexed.scanLine(y); for (int x=0; x<im.width(); ++x) { - *dst = qGray(*src); - if (QNativeImage::systemFormat() == QImage::Format_RGB16) - *dst = 255 - qGray(*src); - else - *dst = 255 - (qt_pow_gamma[qGray(*src)] * 255. / 2047.); - + *dst = 255 - (qt_pow_gamma[qGray(0xffffffff - *src)] * 255. / 2047.); ++dst; ++src; } -- cgit v0.12 From f7cbd336ba532e29a07d1f81f62e1b12ca53f835 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <samuel.rodal@nokia.com> Date: Tue, 15 Mar 2011 10:36:41 +0100 Subject: Properly set the window event masks etc for screens and GL windows too. --- src/plugins/platforms/xcb/qxcbscreen.cpp | 2 +- src/plugins/platforms/xcb/qxcbwindow.cpp | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 519db63..f868db8 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -66,7 +66,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen, int num | XCB_EVENT_MASK_PROPERTY_CHANGE }; - xcb_configure_window(xcb_connection(), screen->root, mask, values); + xcb_change_window_attributes(xcb_connection(), screen->root, mask, values); } QXcbScreen::~QXcbScreen() diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 005aa0e..9478b5b 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -155,12 +155,14 @@ QXcbWindow::QXcbWindow(QWidget *tlw) 0, // border width XCB_WINDOW_CLASS_INPUT_OUTPUT, // window class m_screen->screen()->root_visual, // visual - mask, // value mask - values); // value list + 0, // value mask + 0); // value list printf("created regular window: %d\n", m_window); } + xcb_change_window_attributes(xcb_connection(), m_window, mask, values); + xcb_atom_t properties[4]; int propertyCount = 0; properties[propertyCount++] = atom(QXcbAtom::WM_DELETE_WINDOW); -- cgit v0.12 From d524e983c60ba59f3c65d811ec92f02c97d1a8ab Mon Sep 17 00:00:00 2001 From: Fabien Freling <fabien.freling@nokia.com> Date: Tue, 15 Mar 2011 14:48:49 +0100 Subject: Change the way the unified toolbar is flushed. The flushing of the unified toolbar is no longer tied to the main window, making it more flexible. Task-number: QTBUG-17754 Reviewed-by: Richard Moe Gustavsen --- src/gui/kernel/qcocoawindowdelegate_mac.mm | 18 +++++++++++++- src/gui/kernel/qwidget.cpp | 14 +++++++++-- src/gui/painting/qunifiedtoolbarsurface_mac.cpp | 31 +++++++++++++------------ src/gui/painting/qunifiedtoolbarsurface_mac_p.h | 4 ++-- src/gui/painting/qwindowsurface_raster.cpp | 20 +++------------- 5 files changed, 50 insertions(+), 37 deletions(-) diff --git a/src/gui/kernel/qcocoawindowdelegate_mac.mm b/src/gui/kernel/qcocoawindowdelegate_mac.mm index 9e7aa58..1faf068 100644 --- a/src/gui/kernel/qcocoawindowdelegate_mac.mm +++ b/src/gui/kernel/qcocoawindowdelegate_mac.mm @@ -48,6 +48,9 @@ #include <qlayout.h> #include <qcoreapplication.h> #include <qmenubar.h> +#include <QMainWindow> +#include <QToolBar> +#include <private/qmainwindowlayout_p.h> QT_BEGIN_NAMESPACE extern QWidgetData *qt_qwidget_data(QWidget *); // qwidget.cpp @@ -218,8 +221,21 @@ static void cleanupCocoaWindowDelegate() // We force the repaint to be synchronized with the resize of the window. // Otherwise, the resize looks sluggish because we paint one event loop later. - if ([[window contentView] inLiveResize]) + if ([[window contentView] inLiveResize]) { qwidget->repaint(); + + // We need to repaint the toolbar as well. + QMainWindow* mWindow = qobject_cast<QMainWindow*>(qwidget->window()); + if (mWindow) { + QMainWindowLayout *mLayout = qobject_cast<QMainWindowLayout*>(mWindow->layout()); + QList<QToolBar *> toolbarList = mLayout->qtoolbarsInUnifiedToolbarList; + + for (int i = 0; i < toolbarList.size(); ++i) { + QToolBar* toolbar = toolbarList.at(i); + toolbar->repaint(); + } + } + } } - (void)windowDidMove:(NSNotification *)notification diff --git a/src/gui/kernel/qwidget.cpp b/src/gui/kernel/qwidget.cpp index 5fc9951..198d4e5 100644 --- a/src/gui/kernel/qwidget.cpp +++ b/src/gui/kernel/qwidget.cpp @@ -1367,6 +1367,16 @@ void QWidgetPrivate::init(QWidget *parentWidget, Qt::WindowFlags f) QApplication::postEvent(q, new QEvent(QEvent::PolishRequest)); extraPaintEngine = 0; + +#ifdef QT_MAC_USE_COCOA + // If we add a child to the unified toolbar, we have to redirect the painting. + if (parentWidget && parentWidget->d_func() && parentWidget->d_func()->isInUnifiedToolbar) { + if (parentWidget->d_func()->unifiedSurface) { + QWidget *toolbar = parentWidget->d_func()->toolbar_ancestor; + parentWidget->d_func()->unifiedSurface->recursiveRedirect(toolbar, toolbar, toolbar->d_func()->toolbar_offset); + } + } +#endif // QT_MAC_USE_COCOA } @@ -10478,7 +10488,7 @@ void QWidget::update(const QRect &rect) if (hasBackingStoreSupport()) { #ifdef QT_MAC_USE_COCOA if (qt_widget_private(this)->isInUnifiedToolbar) { - qt_widget_private(this)->unifiedSurface->renderToolbar(this); + qt_widget_private(this)->unifiedSurface->renderToolbar(this, true); return; } #endif // QT_MAC_USE_COCOA @@ -10508,7 +10518,7 @@ void QWidget::update(const QRegion &rgn) if (hasBackingStoreSupport()) { #ifdef QT_MAC_USE_COCOA if (qt_widget_private(this)->isInUnifiedToolbar) { - qt_widget_private(this)->unifiedSurface->renderToolbar(this); + qt_widget_private(this)->unifiedSurface->renderToolbar(this, true); return; } #endif // QT_MAC_USE_COCOA diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp index 87206f3..0993b22 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp +++ b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp @@ -106,16 +106,18 @@ void QUnifiedToolbarSurface::recursiveRemoval(QObject *object) if (object->isWidgetType()) { QWidget *widget = qobject_cast<QWidget *>(object); - if (!(widget->windowType() & Qt::Window)) { - widget->d_func()->unifiedSurface = 0; - widget->d_func()->isInUnifiedToolbar = false; - widget->d_func()->toolbar_offset = QPoint(); - widget->d_func()->toolbar_ancestor = 0; + // If it's a pop-up or something similar, we don't redirect it. + if (widget->windowType() & Qt::Window) + return; + + widget->d_func()->unifiedSurface = 0; + widget->d_func()->isInUnifiedToolbar = false; + widget->d_func()->toolbar_offset = QPoint(); + widget->d_func()->toolbar_ancestor = 0; + } - for (int i = 0; i < object->children().size(); ++i) { - recursiveRemoval(object->children().at(i)); - } - } + for (int i = 0; i < object->children().size(); ++i) { + recursiveRemoval(object->children().at(i)); } } } @@ -154,12 +156,11 @@ void QUnifiedToolbarSurface::updateToolbarOffset(QWidget *widget) mlayout->updateUnifiedToolbarOffset(); } -void QUnifiedToolbarSurface::flush(QWidget *widget, const QRegion &rgn, const QPoint &offset) +void QUnifiedToolbarSurface::flush(QWidget *widget) { Q_D(QUnifiedToolbarSurface); - Q_UNUSED(offset); - if (!d->image || rgn.rectCount() == 0) + if (!d->image) return; if (widget->d_func()->flushRequested) { @@ -173,7 +174,7 @@ void QUnifiedToolbarSurface::prepareBuffer(QImage::Format format, QWidget *widge Q_D(QUnifiedToolbarSurface); int width = geometry().width(); - int height = geometry().height(); + int height = 100; // FIXME if (d->image) { width = qMax(d->image->width(), width); height = qMax(d->image->height(), height); @@ -244,11 +245,11 @@ void QUnifiedToolbarSurface::renderToolbar(QWidget *widget, bool forceFlush) QRegion beginPaintRegion(beginPaintRect); beginPaint(beginPaintRegion); - toolbar->render(paintDevice(), toolbar->d_func()->toolbar_offset, QRegion(), QWidget::DrawChildren); + toolbar->render(paintDevice(), toolbar->d_func()->toolbar_offset, QRegion(toolbar->geometry()), QWidget::DrawChildren); toolbar->d_func()->flushRequested = true; if (forceFlush) - flush(toolbar, beginPaintRegion, toolbar->d_func()->toolbar_offset); + flush(toolbar); } QT_END_NAMESPACE diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h index 99839fa..8a552fb 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h +++ b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h @@ -79,20 +79,20 @@ public: QUnifiedToolbarSurface(QWidget *widget); ~QUnifiedToolbarSurface(); - void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); + void flush(QWidget *widget); void setGeometry(const QRect &rect); void beginPaint(const QRegion &rgn); void insertToolbar(QWidget *toolbar, const QPoint &offset); void removeToolbar(QToolBar *toolbar); void updateToolbarOffset(QWidget *widget); void renderToolbar(QWidget *widget, bool forceFlush = false); + void recursiveRedirect(QObject *widget, QWidget *parent_toolbar, const QPoint &offset); QPaintDevice *paintDevice(); CGContextRef imageContext(); private: void prepareBuffer(QImage::Format format, QWidget *widget); - void recursiveRedirect(QObject *widget, QWidget *parent_toolbar, const QPoint &offset); void recursiveRemoval(QObject *object); Q_DECLARE_PRIVATE(QUnifiedToolbarSurface) diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index 27d8cb9..8170b7a 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -277,35 +277,21 @@ void QRasterWindowSurface::flush(QWidget *widget, const QRegion &rgn, const QPoi #ifdef Q_WS_MAC + Q_UNUSED(offset); + // This is mainly done for native components like native "open file" dialog. if (widget->testAttribute(Qt::WA_DontShowOnScreen)) { return; } #ifdef QT_MAC_USE_COCOA + this->needsFlush = true; this->regionToFlush += rgn; // The actual flushing will be processed in [view drawRect:rect] qt_mac_setNeedsDisplay(widget); - // Unified toolbar hack. - // We issue a flush call for each QToolBar so they get repainted right after - // the main window. - QMainWindow* mWindow = qobject_cast<QMainWindow*>(widget->window()); - if (mWindow) { - QMainWindowLayout *mLayout = qobject_cast<QMainWindowLayout*>(mWindow->layout()); - QList<QToolBar *> toolbarList = mLayout->qtoolbarsInUnifiedToolbarList; - - for (int i = 0; i < toolbarList.size(); ++i) { - QToolBar* toolbar = toolbarList.at(i); - if (mLayout->toolBarArea(toolbar) == Qt::TopToolBarArea) { - QWidget* tbWidget = (QWidget*) toolbar; - if (tbWidget->d_func()->unifiedSurface) - tbWidget->d_func()->unifiedSurface->flush(tbWidget, rgn, offset); - } - } - } #else // Get a context for the widget. CGContextRef context; -- cgit v0.12 From 81ce61c9459c85f53486e668b532fe43a4d40ff0 Mon Sep 17 00:00:00 2001 From: Eskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@nokia.com> Date: Tue, 15 Mar 2011 15:36:33 +0100 Subject: Fix some warnings in font code Comma at the end of enumerator list and wrong initializer list on Mac. Reviewed-by: Jiang Jiang --- src/gui/text/qfont.h | 2 +- src/gui/text/qfont_p.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index ea65c17..8dbc746 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -90,7 +90,7 @@ public: NoAntialias = 0x0100, OpenGLCompatible = 0x0200, ForceIntegerMetrics = 0x0400, - NoFontMerging = 0x8000, + NoFontMerging = 0x8000 }; enum HintingPreference { diff --git a/src/gui/text/qfont_p.h b/src/gui/text/qfont_p.h index b23f96e..c1a5048 100644 --- a/src/gui/text/qfont_p.h +++ b/src/gui/text/qfont_p.h @@ -97,8 +97,8 @@ struct QFontDef uint stretch : 12; // 0-400 uint ignorePitch : 1; - uint fixedPitchComputed : 1; // for Mac OS X only uint hintingPreference : 2; + uint fixedPitchComputed : 1; // for Mac OS X only int reserved : 14; // for future extensions bool exactMatch(const QFontDef &other) const; -- cgit v0.12 From 234a4b614e30ec2ad3e161c0dcd4d339182ff9ec Mon Sep 17 00:00:00 2001 From: Martin Jones <martin.jones@nokia.com> Date: Wed, 16 Mar 2011 13:09:21 +1000 Subject: Qt.include() used in WorkerScript is broken on Windows. The script local filename was used to resolve the source URL rather than the script URL. Change-Id: I78aa23eadbd76e100bb872b6ac9459aa9a5ee5ce Task-number: QTBUG-17977 Reviewed-by: Aaron Kennedy --- src/declarative/qml/qdeclarativescriptparser.cpp | 2 +- src/declarative/qml/qdeclarativeworkerscript.cpp | 2 +- .../qdeclarativeworkerscript/data/Global.js | 1 + .../qdeclarativeworkerscript/data/script_include.js | 5 +++++ .../qdeclarativeworkerscript/data/worker_include.qml | 5 +++++ .../tst_qdeclarativeworkerscript.cpp | 19 +++++++++++++++++++ 6 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeworkerscript/data/Global.js create mode 100644 tests/auto/declarative/qdeclarativeworkerscript/data/script_include.js create mode 100644 tests/auto/declarative/qdeclarativeworkerscript/data/worker_include.qml diff --git a/src/declarative/qml/qdeclarativescriptparser.cpp b/src/declarative/qml/qdeclarativescriptparser.cpp index b604706..d9e3ebf 100644 --- a/src/declarative/qml/qdeclarativescriptparser.cpp +++ b/src/declarative/qml/qdeclarativescriptparser.cpp @@ -940,7 +940,7 @@ QDeclarativeParser::Object::ScriptBlock::Pragmas QDeclarativeScriptParser::extra if (l.currentLineNo() == startLine) return rv; - if (pragmaValue == QLatin1String("library")) { + if (pragmaValue == library) { rv |= QDeclarativeParser::Object::ScriptBlock::Shared; replaceWithSpace(script, startOffset, endOffset - startOffset); } else { diff --git a/src/declarative/qml/qdeclarativeworkerscript.cpp b/src/declarative/qml/qdeclarativeworkerscript.cpp index f8d52b5..1ff0caa 100644 --- a/src/declarative/qml/qdeclarativeworkerscript.cpp +++ b/src/declarative/qml/qdeclarativeworkerscript.cpp @@ -313,7 +313,7 @@ void QDeclarativeWorkerScriptEnginePrivate::processLoad(int id, const QUrl &url) QScriptContext *ctxt = QScriptDeclarativeClass::pushCleanContext(workerEngine); QScriptValue urlContext = workerEngine->newObject(); - urlContext.setData(QScriptValue(workerEngine, fileName)); + urlContext.setData(QScriptValue(workerEngine, url.toString())); ctxt->pushScope(urlContext); ctxt->pushScope(activation); ctxt->setActivationObject(activation); diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/Global.js b/tests/auto/declarative/qdeclarativeworkerscript/data/Global.js new file mode 100644 index 0000000..6bdb4a5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/Global.js @@ -0,0 +1 @@ +var data = "World" diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/script_include.js b/tests/auto/declarative/qdeclarativeworkerscript/data/script_include.js new file mode 100644 index 0000000..0385d91 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/script_include.js @@ -0,0 +1,5 @@ +WorkerScript.onMessage = function(msg) { + var res = Qt.include("Global.js"); + WorkerScript.sendMessage(msg + " " + data) +} + diff --git a/tests/auto/declarative/qdeclarativeworkerscript/data/worker_include.qml b/tests/auto/declarative/qdeclarativeworkerscript/data/worker_include.qml new file mode 100644 index 0000000..595cb2b --- /dev/null +++ b/tests/auto/declarative/qdeclarativeworkerscript/data/worker_include.qml @@ -0,0 +1,5 @@ +import QtQuick 1.0 + +BaseWorker { + source: "script_include.js" +} diff --git a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp index 4b922fb..b64e10c 100644 --- a/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp +++ b/tests/auto/declarative/qdeclarativeworkerscript/tst_qdeclarativeworkerscript.cpp @@ -79,6 +79,7 @@ private slots: void messaging_sendQObjectList(); void messaging_sendJsObject(); void script_with_pragma(); + void script_included(); void scriptError_onLoad(); void scriptError_onCall(); @@ -226,6 +227,24 @@ void tst_QDeclarativeWorkerScript::script_with_pragma() delete worker; } +void tst_QDeclarativeWorkerScript::script_included() +{ + QDeclarativeComponent component(&m_engine, SRCDIR "/data/worker_include.qml"); + QDeclarativeWorkerScript *worker = qobject_cast<QDeclarativeWorkerScript*>(component.create()); + QVERIFY(worker != 0); + + QString value("Hello"); + + QVERIFY(QMetaObject::invokeMethod(worker, "testSend", Q_ARG(QVariant, value))); + waitForEchoMessage(worker); + + const QMetaObject *mo = worker->metaObject(); + QCOMPARE(mo->property(mo->indexOfProperty("response")).read(worker).toString(), value + " World"); + + qApp->processEvents(); + delete worker; +} + static QString qdeclarativeworkerscript_lastWarning; static void qdeclarativeworkerscript_warningsHandler(QtMsgType type, const char *msg) { -- cgit v0.12 From f673f4c8273bcdde76b36cb58cb7b5e46a87f1ac Mon Sep 17 00:00:00 2001 From: Armin Berres <armin.berres@basyskom.de> Date: Wed, 16 Mar 2011 08:23:57 +0100 Subject: Make getters for staticContentsSupport and partialUpdateSupport virtual MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When QRuntimeGraphicsSystem is asked for its support for static contents of partial updates it should return the value for the currently running wrapped graphicssystem. As the getters have not been virtual so far this could not be implemented. Additionally the setters have been removed as these values are not supposed to be set from the outside. Only the graphicssystems itself knows what it supports. If the default values should be changed the methods should be overwritten. Merge-request: 1136 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> --- src/gui/painting/qbackingstore_p.h | 3 +- src/gui/painting/qgraphicssystem_runtime.cpp | 10 +++++ src/gui/painting/qgraphicssystem_runtime_p.h | 3 ++ src/gui/painting/qunifiedtoolbarsurface_mac.cpp | 1 - src/gui/painting/qwindowsurface.cpp | 28 ++------------ src/gui/painting/qwindowsurface_p.h | 6 +-- src/gui/painting/qwindowsurface_raster.cpp | 6 ++- src/gui/painting/qwindowsurface_raster_p.h | 1 + src/gui/painting/qwindowsurface_s60.cpp | 7 +++- src/gui/painting/qwindowsurface_s60_p.h | 2 + src/gui/painting/qwindowsurface_x11.cpp | 12 ++++-- src/gui/painting/qwindowsurface_x11_p.h | 1 + src/opengl/qwindowsurface_gl.cpp | 14 +++++-- src/opengl/qwindowsurface_gl_p.h | 2 + src/openvg/qwindowsurface_vg.cpp | 6 ++- src/openvg/qwindowsurface_vg_p.h | 2 + src/s60installs/bwins/QtGuiu.def | 2 - src/s60installs/eabi/QtGuiu.def | 2 - tests/auto/qwindowsurface/tst_qwindowsurface.cpp | 47 ------------------------ 19 files changed, 63 insertions(+), 92 deletions(-) diff --git a/src/gui/painting/qbackingstore_p.h b/src/gui/painting/qbackingstore_p.h index 47387ab..39bf66c 100644 --- a/src/gui/painting/qbackingstore_p.h +++ b/src/gui/painting/qbackingstore_p.h @@ -262,7 +262,8 @@ private: } inline bool hasStaticContents() const - { return !staticWidgets.isEmpty() && windowSurface->hasStaticContentsSupport(); } + { return !staticWidgets.isEmpty() && windowSurface->hasStaticContentsSupport() + && windowSurface->hasPartialUpdateSupport(); } friend QRegion qt_dirtyRegion(QWidget *); friend class QWidgetPrivate; diff --git a/src/gui/painting/qgraphicssystem_runtime.cpp b/src/gui/painting/qgraphicssystem_runtime.cpp index 5841d40..93245ef 100644 --- a/src/gui/painting/qgraphicssystem_runtime.cpp +++ b/src/gui/painting/qgraphicssystem_runtime.cpp @@ -319,6 +319,16 @@ QPoint QRuntimeWindowSurface::offset(const QWidget *widget) const return m_windowSurface->offset(widget); } +bool QRuntimeWindowSurface::hasStaticContentsSupport() const +{ + return m_windowSurface->hasStaticContentsSupport(); +} + +bool QRuntimeWindowSurface::hasPartialUpdateSupport() const +{ + return m_windowSurface->hasPartialUpdateSupport(); +} + QRuntimeGraphicsSystem::QRuntimeGraphicsSystem() : m_windowSurfaceDestroyPolicy(DestroyImmediately), m_graphicsSystem(0) diff --git a/src/gui/painting/qgraphicssystem_runtime_p.h b/src/gui/painting/qgraphicssystem_runtime_p.h index 30b4e3e..998fa98 100644 --- a/src/gui/painting/qgraphicssystem_runtime_p.h +++ b/src/gui/painting/qgraphicssystem_runtime_p.h @@ -129,6 +129,9 @@ public: virtual QPoint offset(const QWidget *widget) const; + virtual bool hasStaticContentsSupport() const; + virtual bool hasPartialUpdateSupport() const; + QScopedPointer<QWindowSurface> m_windowSurface; QScopedPointer<QWindowSurface> m_pendingWindowSurface; diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp index e7434c7..c64f572 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp +++ b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp @@ -55,7 +55,6 @@ QUnifiedToolbarSurface::QUnifiedToolbarSurface(QWidget *widget) { d_ptr->image = 0; d_ptr->inSetGeometry = false; - setStaticContentsSupport(true); setGeometry(QRect(QPoint(0, 0), QSize(widget->width(), 100))); // FIXME: Fix height. } diff --git a/src/gui/painting/qwindowsurface.cpp b/src/gui/painting/qwindowsurface.cpp index 029b9dc..9b71818 100644 --- a/src/gui/painting/qwindowsurface.cpp +++ b/src/gui/painting/qwindowsurface.cpp @@ -52,8 +52,6 @@ class QWindowSurfacePrivate public: QWindowSurfacePrivate(QWidget *w) : window(w) - , staticContentsSupport(0) - , partialUpdateSupport(1) { } @@ -65,8 +63,6 @@ public: #endif //Q_WS_QPA QRegion staticContents; QList<QImage*> bufferImages; - uint staticContentsSupport : 1; - uint partialUpdateSupport : 1; }; /*! @@ -313,16 +309,7 @@ QPoint QWindowSurface::offset(const QWidget *widget) const bool QWindowSurface::hasStaticContentsSupport() const { - return d_ptr->staticContentsSupport; -} - -void QWindowSurface::setStaticContentsSupport(bool enable) -{ - if (enable && !d_ptr->partialUpdateSupport) { - qWarning("QWindowSurface::setStaticContentsSupport: static contents support requires partial update support"); - return; - } - d_ptr->staticContentsSupport = enable; + return false; } void QWindowSurface::setStaticContents(const QRegion ®ion) @@ -337,21 +324,12 @@ QRegion QWindowSurface::staticContents() const bool QWindowSurface::hasStaticContents() const { - return d_ptr->staticContentsSupport && !d_ptr->staticContents.isEmpty(); + return hasStaticContentsSupport() && !d_ptr->staticContents.isEmpty(); } bool QWindowSurface::hasPartialUpdateSupport() const { - return d_ptr->partialUpdateSupport; -} - -void QWindowSurface::setPartialUpdateSupport(bool enable) -{ - if (!enable && d_ptr->staticContentsSupport) { - qWarning("QWindowSurface::setPartialUpdateSupport: static contents support requires partial update support"); - return; - } - d_ptr->partialUpdateSupport = enable; + return true; } #ifdef Q_WS_QPA diff --git a/src/gui/painting/qwindowsurface_p.h b/src/gui/painting/qwindowsurface_p.h index 62137ef..4a2775f 100644 --- a/src/gui/painting/qwindowsurface_p.h +++ b/src/gui/painting/qwindowsurface_p.h @@ -100,16 +100,14 @@ public: virtual QPoint offset(const QWidget *widget) const; inline QRect rect(const QWidget *widget) const; - bool hasStaticContentsSupport() const; - bool hasPartialUpdateSupport() const; + virtual bool hasStaticContentsSupport() const; + virtual bool hasPartialUpdateSupport() const; void setStaticContents(const QRegion ®ion); QRegion staticContents() const; protected: bool hasStaticContents() const; - void setStaticContentsSupport(bool enable); - void setPartialUpdateSupport(bool enable); private: QWindowSurfacePrivate *d_ptr; diff --git a/src/gui/painting/qwindowsurface_raster.cpp b/src/gui/painting/qwindowsurface_raster.cpp index 419518ac..3a5dcc3 100644 --- a/src/gui/painting/qwindowsurface_raster.cpp +++ b/src/gui/painting/qwindowsurface_raster.cpp @@ -103,7 +103,6 @@ QRasterWindowSurface::QRasterWindowSurface(QWidget *window, bool setDefaultSurfa #endif d_ptr->image = 0; d_ptr->inSetGeometry = false; - setStaticContentsSupport(true); } @@ -425,6 +424,11 @@ bool QRasterWindowSurface::scroll(const QRegion &area, int dx, int dy) #endif } +bool QRasterWindowSurface::hasStaticContentsSupport() const +{ + return true; +} + void QRasterWindowSurface::prepareBuffer(QImage::Format format, QWidget *widget) { diff --git a/src/gui/painting/qwindowsurface_raster_p.h b/src/gui/painting/qwindowsurface_raster_p.h index 903810b..ad57d48 100644 --- a/src/gui/painting/qwindowsurface_raster_p.h +++ b/src/gui/painting/qwindowsurface_raster_p.h @@ -105,6 +105,7 @@ public: void beginPaint(const QRegion &rgn); void setGeometry(const QRect &rect); bool scroll(const QRegion &area, int dx, int dy); + bool hasStaticContentsSupport() const; private: #if defined(Q_WS_X11) && !defined(QT_NO_MITSHM) diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index 71556d7..3f2247b 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -90,8 +90,6 @@ QS60WindowSurface::QS60WindowSurface(QWidget* widget) data->fromSymbianBitmap(bitmap, true); d_ptr->device = QPixmap(data); } - - setStaticContentsSupport(true); } QS60WindowSurface::~QS60WindowSurface() @@ -231,6 +229,11 @@ void QS60WindowSurface::setGeometry(const QRect& rect) QWindowSurface::setGeometry(rect); } +bool QS60WindowSurface::hasStaticContentsSupport() const +{ + return true; +} + CFbsBitmap* QS60WindowSurface::symbianBitmap() const { QS60PixmapData *data = static_cast<QS60PixmapData*>(d_ptr->device.data_ptr().data()); diff --git a/src/gui/painting/qwindowsurface_s60_p.h b/src/gui/painting/qwindowsurface_s60_p.h index d0d4925..f730c87 100644 --- a/src/gui/painting/qwindowsurface_s60_p.h +++ b/src/gui/painting/qwindowsurface_s60_p.h @@ -79,6 +79,8 @@ public: void setGeometry(const QRect &rect); + bool hasStaticContentsSupport() const; + CFbsBitmap *symbianBitmap() const; private: diff --git a/src/gui/painting/qwindowsurface_x11.cpp b/src/gui/painting/qwindowsurface_x11.cpp index 2324bc2..ab4f53e 100644 --- a/src/gui/painting/qwindowsurface_x11.cpp +++ b/src/gui/painting/qwindowsurface_x11.cpp @@ -70,9 +70,6 @@ QX11WindowSurface::QX11WindowSurface(QWidget *widget) #ifndef QT_NO_XRENDER d_ptr->translucentBackground = X11->use_xrender && widget->x11Info().depth() == 32; - setStaticContentsSupport(!d_ptr->translucentBackground); -#else - setStaticContentsSupport(true); #endif } @@ -253,4 +250,13 @@ QPixmap QX11WindowSurface::grabWidget(const QWidget *widget, return px; } +bool QX11WindowSurface::hasStaticContentsSupport() const +{ +#ifndef QT_NO_XRENDER + return !d_ptr->translucentBackground; +#else + return true; +#endif +} + QT_END_NAMESPACE diff --git a/src/gui/painting/qwindowsurface_x11_p.h b/src/gui/painting/qwindowsurface_x11_p.h index 88753ea..d5179dd 100644 --- a/src/gui/painting/qwindowsurface_x11_p.h +++ b/src/gui/painting/qwindowsurface_x11_p.h @@ -80,6 +80,7 @@ public: bool scroll(const QRegion &area, int dx, int dy); QPixmap grabWidget(const QWidget *widget, const QRect& rectangle = QRect()) const; + bool hasStaticContentsSupport() const; private: QX11WindowSurfacePrivate *d_ptr; GC gc; diff --git a/src/opengl/qwindowsurface_gl.cpp b/src/opengl/qwindowsurface_gl.cpp index 21b2f09..ea1f765 100644 --- a/src/opengl/qwindowsurface_gl.cpp +++ b/src/opengl/qwindowsurface_gl.cpp @@ -299,6 +299,8 @@ struct QGLWindowSurfacePrivate QList<QImage> buffers; QGLWindowSurfaceGLPaintDevice glDevice; QGLWindowSurface* q_ptr; + + bool partialUpdateSupport; }; QGLFormat QGLWindowSurface::surfaceFormat; @@ -351,6 +353,7 @@ QGLWindowSurface::QGLWindowSurface(QWidget *window) d_ptr->q_ptr = this; d_ptr->geometry_updated = false; d_ptr->did_paint = false; + d_ptr->partialUpdateSupport = false; } QGLWindowSurface::~QGLWindowSurface() @@ -429,11 +432,11 @@ void QGLWindowSurface::hijackWindow(QWidget *widget) if (ctx->d_func()->eglContext->configAttrib(EGL_SWAP_BEHAVIOR) != EGL_BUFFER_PRESERVED && ! haveNOKSwapRegion) - setPartialUpdateSupport(false); // Force full-screen updates + d_ptr->partialUpdateSupport = false; // Force full-screen updates else - setPartialUpdateSupport(true); + d_ptr->partialUpdateSupport = true; #else - setPartialUpdateSupport(false); + d_ptr->partialUpdateSupport = false; #endif widgetPrivate->extraData()->glContext = ctx; @@ -1081,6 +1084,11 @@ QImage *QGLWindowSurface::buffer(const QWidget *widget) return &d_ptr->buffers.last(); } +bool QGLWindowSurface::hasPartialUpdateSupport() const +{ + return d_ptr->partialUpdateSupport; +} + QT_END_NAMESPACE diff --git a/src/opengl/qwindowsurface_gl_p.h b/src/opengl/qwindowsurface_gl_p.h index 67f9f41..e1689bf 100644 --- a/src/opengl/qwindowsurface_gl_p.h +++ b/src/opengl/qwindowsurface_gl_p.h @@ -108,6 +108,8 @@ public: QImage *buffer(const QWidget *widget); + bool hasPartialUpdateSupport() const; + QGLContext *context() const; static QGLFormat surfaceFormat; diff --git a/src/openvg/qwindowsurface_vg.cpp b/src/openvg/qwindowsurface_vg.cpp index 9ce7f9a..6f99de4 100644 --- a/src/openvg/qwindowsurface_vg.cpp +++ b/src/openvg/qwindowsurface_vg.cpp @@ -57,7 +57,6 @@ QVGWindowSurface::QVGWindowSurface(QWidget *window) { // Create the default type of EGL window surface for windows. d_ptr = new QVGEGLWindowSurfaceDirect(this); - setStaticContentsSupport(d_ptr->supportsStaticContents()); } QVGWindowSurface::QVGWindowSurface @@ -120,6 +119,11 @@ QPaintEngine *QVGWindowSurface::paintEngine() const return d_ptr->paintEngine(); } +bool QVGWindowSurface::hasStaticContentsSupport() const +{ + d_ptr->supportsStaticContents(); +} + int QVGWindowSurface::metric(PaintDeviceMetric met) const { return qt_paint_device_metric(window(), met); diff --git a/src/openvg/qwindowsurface_vg_p.h b/src/openvg/qwindowsurface_vg_p.h index 06b16d0..2d6b4f9 100644 --- a/src/openvg/qwindowsurface_vg_p.h +++ b/src/openvg/qwindowsurface_vg_p.h @@ -78,6 +78,8 @@ public: QPaintEngine *paintEngine() const; + bool hasStaticContentsSupport() const; + protected: int metric(PaintDeviceMetric metric) const; diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index a1f1b50..68cdc9e 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -9875,7 +9875,6 @@ EXPORTS ?setState@QPaintEngineEx@@UAEXPAVQPainterState@@@Z @ 9874 NONAME ; void QPaintEngineEx::setState(class QPainterState *) ?setState@TouchPoint@QTouchEvent@@QAEXV?$QFlags@W4TouchPointState@Qt@@@@@Z @ 9875 NONAME ; void QTouchEvent::TouchPoint::setState(class QFlags<enum Qt::TouchPointState>) ?setStaticContents@QWindowSurface@@QAEXABVQRegion@@@Z @ 9876 NONAME ; void QWindowSurface::setStaticContents(class QRegion const &) - ?setStaticContentsSupport@QWindowSurface@@IAEX_N@Z @ 9877 NONAME ; void QWindowSurface::setStaticContentsSupport(bool) ?setStatus@QPictureIO@@QAEXH@Z @ 9878 NONAME ; void QPictureIO::setStatus(int) ?setStatusBar@QMainWindow@@QAEXPAVQStatusBar@@@Z @ 9879 NONAME ; void QMainWindow::setStatusBar(class QStatusBar *) ?setStatusTip@QAction@@QAEXABVQString@@@Z @ 9880 NONAME ; void QAction::setStatusTip(class QString const &) @@ -12651,7 +12650,6 @@ EXPORTS ?toImage@QRuntimePixmapData@@UBE?AVQImage@@XZ @ 12650 NONAME ; class QImage QRuntimePixmapData::toImage(void) const ??0QAbstractScrollAreaPrivate@@QAE@XZ @ 12651 NONAME ; QAbstractScrollAreaPrivate::QAbstractScrollAreaPrivate(void) ?resizeEvent@QSplitterHandle@@MAEXPAVQResizeEvent@@@Z @ 12652 NONAME ; void QSplitterHandle::resizeEvent(class QResizeEvent *) - ?setPartialUpdateSupport@QWindowSurface@@IAEX_N@Z @ 12653 NONAME ; void QWindowSurface::setPartialUpdateSupport(bool) ?HandleForegroundEventL@QS60MainAppUi@@MAEXH@Z @ 12654 NONAME ; void QS60MainAppUi::HandleForegroundEventL(int) ?curveThreshold@QStrokerOps@@QBEMXZ @ 12655 NONAME ; float QStrokerOps::curveThreshold(void) const ?createTextureData@QImageTextureGlyphCache@@UAEXHH@Z @ 12656 NONAME ; void QImageTextureGlyphCache::createTextureData(int, int) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index ef1d67c..8f4b7cc 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -3164,7 +3164,6 @@ EXPORTS _ZN14QWindowSurface10beginPaintERK7QRegion @ 3163 NONAME _ZN14QWindowSurface11setGeometryERK5QRect @ 3164 NONAME _ZN14QWindowSurface17setStaticContentsERK7QRegion @ 3165 NONAME - _ZN14QWindowSurface24setStaticContentsSupportEb @ 3166 NONAME _ZN14QWindowSurface6bufferEPK7QWidget @ 3167 NONAME _ZN14QWindowSurface6scrollERK7QRegionii @ 3168 NONAME _ZN14QWindowSurface8endPaintERK7QRegion @ 3169 NONAME @@ -11887,7 +11886,6 @@ EXPORTS _ZN14QGraphicsScale13zScaleChangedEv @ 11886 NONAME _ZN14QPaintEngineEx19drawPixmapFragmentsEPKN8QPainter14PixmapFragmentEiRK7QPixmap6QFlagsINS0_18PixmapFragmentHintEE @ 11887 NONAME _ZN14QWidgetPrivate6renderEP12QPaintDeviceRK6QPointRK7QRegion6QFlagsIN7QWidget10RenderFlagEEb @ 11888 NONAME - _ZN14QWindowSurface23setPartialUpdateSupportEb @ 11889 NONAME _ZN15QGraphicsObject12widthChangedEv @ 11890 NONAME _ZN15QGraphicsObject13heightChangedEv @ 11891 NONAME _ZN15QGraphicsObject15childrenChangedEv @ 11892 NONAME diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp index b309917..4e3435e 100644 --- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp +++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp @@ -82,8 +82,6 @@ public: /* nothing */ } - using QWindowSurface::setStaticContentsSupport; - using QWindowSurface::setPartialUpdateSupport; private: QImage image; }; @@ -283,51 +281,6 @@ void tst_QWindowSurface::grabWidget() QVERIFY(QColor(childInvalidSubImage.pixel(0, 0)) == QColor(Qt::white)); } -void tst_QWindowSurface::staticContentsAndPartialUpdateSupport() -{ - QWidget widget; - MyWindowSurface surface(&widget); - - // Default values. - QVERIFY(surface.hasPartialUpdateSupport()); - QVERIFY(!surface.hasStaticContentsSupport()); - - // Partial: YES, Static: YES - surface.setStaticContentsSupport(true); - QVERIFY(surface.hasPartialUpdateSupport()); - QVERIFY(surface.hasStaticContentsSupport()); - - // Static contents requires support for partial updates. - // We simply ingore bad combinations and spit out a warning. - - // CONFLICT: Partial: NO, Static: YES - QTest::ignoreMessage(QtWarningMsg, "QWindowSurface::setPartialUpdateSupport: static contents support requires partial update support"); - surface.setPartialUpdateSupport(false); - QVERIFY(surface.hasPartialUpdateSupport()); - QVERIFY(surface.hasStaticContentsSupport()); - - // Partial: YES, Static: NO - surface.setStaticContentsSupport(false); - QVERIFY(surface.hasPartialUpdateSupport()); - QVERIFY(!surface.hasStaticContentsSupport()); - - // Partial: NO, Static: NO - surface.setPartialUpdateSupport(false); - QVERIFY(!surface.hasPartialUpdateSupport()); - QVERIFY(!surface.hasStaticContentsSupport()); - - // CONFLICT: Partial: NO, Static: YES - QTest::ignoreMessage(QtWarningMsg, "QWindowSurface::setStaticContentsSupport: static contents support requires partial update support"); - surface.setStaticContentsSupport(true); - QVERIFY(!surface.hasPartialUpdateSupport()); - QVERIFY(!surface.hasStaticContentsSupport()); - - // Partial: YES, Static: NO - surface.setPartialUpdateSupport(true); - QVERIFY(surface.hasPartialUpdateSupport()); - QVERIFY(!surface.hasStaticContentsSupport()); -} - QTEST_MAIN(tst_QWindowSurface) #else // Q_WS_MAC -- cgit v0.12 From f58fea162bf20ba42c57a7bf81d0b4de9cbae725 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 09:07:10 +0100 Subject: Update NaCl mkspecs. Less duplication, use the common unix and gcc conf files. --- mkspecs/qws/linux-nacl-g++/qmake.conf | 69 ++-------- mkspecs/qws/linux-nacl-g++/qplatformdefs.h | 122 +---------------- mkspecs/qws/macx-nacl-g++/qmake.conf | 94 ++------------ mkspecs/qws/macx-nacl-g++/qplatformdefs.h | 201 +++++++---------------------- 4 files changed, 79 insertions(+), 407 deletions(-) diff --git a/mkspecs/qws/linux-nacl-g++/qmake.conf b/mkspecs/qws/linux-nacl-g++/qmake.conf index 83ce65b..7293a1a 100644 --- a/mkspecs/qws/linux-nacl-g++/qmake.conf +++ b/mkspecs/qws/linux-nacl-g++/qmake.conf @@ -2,73 +2,28 @@ # qmake configuration for building with nacl-g++ # -include(../../common/unix.conf) +include(../../common/linux.conf) include(../../common/qws.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) QT = core gui -# copy of ../../common/g++.conf, with modifications: - QMAKE_CC = nacl-gcc QMAKE_CXX = nacl-g++ QMAKE_LINK = nacl-g++ QMAKE_LINK_SHLIB = nacl-g++ - -#QMAKE_CC = gcc -QMAKE_CFLAGS += -pipe -DXP_UNIX -DNACL_STANDALONE=1 -QMAKE_CFLAGS_DEPS += -M -QMAKE_CFLAGS_WARN_ON += -Wall -W -QMAKE_CFLAGS_WARN_OFF += -w -QMAKE_CFLAGS_RELEASE += -O2 -QMAKE_CFLAGS_DEBUG += -g -QMAKE_CFLAGS_SHLIB += -fPIC -#QMAKE_CFLAGS_STATIC_LIB += -fPIC -QMAKE_CFLAGS_YACC += -Wno-unused -Wno-parentheses -QMAKE_CFLAGS_HIDESYMS += -fvisibility=hidden -QMAKE_CFLAGS_PRECOMPILE += -x c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} -QMAKE_CFLAGS_USE_PRECOMPILE += -include ${QMAKE_PCH_OUTPUT_BASE} - -#QMAKE_CXX = g++ -QMAKE_CXXFLAGS += $$QMAKE_CFLAGS -QMAKE_CXXFLAGS_DEPS += $$QMAKE_CFLAGS_DEPS -QMAKE_CXXFLAGS_WARN_ON += $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF += $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE += $$QMAKE_CFLAGS_RELEASE -QMAKE_CXXFLAGS_DEBUG += $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB += $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_STATIC_LIB += $$QMAKE_CFLAGS_STATIC_LIB -QMAKE_CXXFLAGS_YACC += $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_HIDESYMS += $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden -QMAKE_CXXFLAGS_PRECOMPILE += -x c++-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT} -QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE - -#QMAKE_LINK = g++ -#QMAKE_LINK_SHLIB = g++ -QMAKE_LINK_C = gcc -QMAKE_LINK_C_SHLIB = gcc -QMAKE_LFLAGS += -QMAKE_LFLAGS_RELEASE += -Wl,-O1 -QMAKE_LFLAGS_DEBUG += -QMAKE_LFLAGS_APP += -QMAKE_LFLAGS_SHLIB += -shared -QMAKE_LFLAGS_PLUGIN += $$QMAKE_LFLAGS_SHLIB -QMAKE_LFLAGS_SONAME += -Wl,-soname, -QMAKE_LFLAGS_THREAD += -QMAKE_LFLAGS_NOUNDEF += -Wl,--no-undefined -QMAKE_LFLAGS_RPATH = -Wl,-rpath, - -QMAKE_LIBS = -lgoogle_nacl_imc -lgoogle_nacl_npruntime -lgoogle_nacl_pgl -lgoogle_nacl_gpu -lpthread -lsrpc - -QMAKE_PCH_OUTPUT_EXT = .gch - -# -Bsymbolic-functions (ld) support -QMAKE_LFLAGS_BSYMBOLIC_FUNC = -Wl,-Bsymbolic-functions -QMAKE_LFLAGS_DYNAMIC_LIST = -Wl,--dynamic-list, - -# modifications to linux.conf QMAKE_AR = nacl-ar q QMAKE_OBJCOPY = nacl-objcopy QMAKE_STRIP = nacl-strip -QMAKE_LIBS_DYNLOAD = + +# work around linker crash when using PIC +QMAKE_CFLAGS_STATIC_LIB -= -fPIC +QMAKE_CFLAGS_SHLIB -= -fPIC +QMAKE_CXXFLAGS_STATIC_LIB -= -fPIC +QMAKE_CXXFLAGS_SHLIB -= -fPIC + +#QMAKE_CFLAGS += -pipe -DXP_UNIX -DNACL_STANDALONE=1 +QMAKE_LIBS_DYNLOAD -= -ldl load(qt_config) diff --git a/mkspecs/qws/linux-nacl-g++/qplatformdefs.h b/mkspecs/qws/linux-nacl-g++/qplatformdefs.h index 01b26d9..70572bf 100644 --- a/mkspecs/qws/linux-nacl-g++/qplatformdefs.h +++ b/mkspecs/qws/linux-nacl-g++/qplatformdefs.h @@ -48,128 +48,20 @@ #include "qglobal.h" - -#define _POSIX_TIMERS -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -// 1) need to reset default environment if _BSD_SOURCE is defined -// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0 -// 3) it seems older glibc need this to include the X/Open stuff -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif - -#include <unistd.h> - - -// We are hot - unistd.h should have turned on the specific APIs we requested - -#include <sys/features.h> -#include <pthread.h> -#include <dirent.h> -#include <fcntl.h> -#include <grp.h> -#include <pwd.h> -#include <signal.h> -//#include <dlfcn.h> - -#include <sys/types.h> -//#include <sys/ioctl.h> -//#include <sys/ipc.h> - -#include <sys/time.h> -//#include <sys/shm.h> -//#include <sys/socket.h> -#include <sys/stat.h> -#include <sys/wait.h> -//#include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif - // extra disabling. -#ifdef __native_client__ +#ifdef __native_client__ #define QT_NO_FSFILEENGINE -#define QT_NO_TRANSLATION #endif -#ifdef QT_LARGEFILE_SUPPORT -#define QT_STATBUF struct stat64 -#define QT_STATBUF4TSTAT struct stat64 -#define QT_STAT ::stat64 -#define QT_FSTAT ::fstat64 -#define QT_LSTAT ::lstat64 -#define QT_OPEN ::open64 -#define QT_TRUNCATE ::truncate64 -#define QT_FTRUNCATE ::ftruncate64 -#define QT_LSEEK ::lseek64 -#else -#define QT_STATBUF struct stat -#define QT_STATBUF4TSTAT struct stat -#define QT_STAT ::stat -#define QT_FSTAT ::fstat -#define QT_LSTAT ::lstat -#define QT_OPEN ::open -#define QT_TRUNCATE ::truncate -#define QT_FTRUNCATE ::ftruncate -#define QT_LSEEK ::lseek -#endif +#define QT_NO_SOCKET_H -#ifdef QT_LARGEFILE_SUPPORT -#define QT_FOPEN ::fopen64 -#define QT_FSEEK ::fseeko64 -#define QT_FTELL ::ftello64 -#define QT_FGETPOS ::fgetpos64 -#define QT_FSETPOS ::fsetpos64 -#define QT_FPOS_T fpos64_t -#define QT_OFF_T off64_t -#else -#define QT_FOPEN ::fopen -#define QT_FSEEK ::fseek -#define QT_FTELL ::ftell -#define QT_FGETPOS ::fgetpos -#define QT_FSETPOS ::fsetpos -#define QT_FPOS_T fpos_t -#define QT_OFF_T long -#endif +#define DIR void * +#define PATH_MAX 256 -#define QT_STAT_REG S_IFREG -#define QT_STAT_DIR S_IFDIR -#define QT_STAT_MASK S_IFMT -#define QT_STAT_LNK S_IFLNK -#define QT_SOCKET_CONNECT ::connect -#define QT_SOCKET_BIND ::bind -#define QT_FILENO fileno -#define QT_CLOSE ::close -#define QT_READ ::read -#define QT_WRITE ::write -#define QT_ACCESS ::access -#define QT_GETCWD ::getcwd -#define QT_CHDIR ::chdir -#define QT_MKDIR ::mkdir -#define QT_RMDIR ::rmdir -#define QT_OPEN_LARGEFILE O_LARGEFILE -#define QT_OPEN_RDONLY O_RDONLY -#define QT_OPEN_WRONLY O_WRONLY -#define QT_OPEN_RDWR O_RDWR -#define QT_OPEN_CREAT O_CREAT -#define QT_OPEN_TRUNC O_TRUNC -#define QT_OPEN_APPEND O_APPEND +#include "../../common/posix/qplatformdefs.h" -#define QT_SIGNAL_RETTYPE void -#define QT_SIGNAL_ARGS int -#define QT_SIGNAL_IGNORE SIG_IGN - -#if defined(__GLIBC__) && (__GLIBC__ >= 2) -#define QT_SOCKLEN_T socklen_t -#else -#define QT_SOCKLEN_T int -#endif - -#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500) -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf -#endif +#undef QT_LSTAT +#define QT_LSTAT QT_STAT #endif // QPLATFORMDEFS_H diff --git a/mkspecs/qws/macx-nacl-g++/qmake.conf b/mkspecs/qws/macx-nacl-g++/qmake.conf index 0a54b4b..7293a1a 100644 --- a/mkspecs/qws/macx-nacl-g++/qmake.conf +++ b/mkspecs/qws/macx-nacl-g++/qmake.conf @@ -1,95 +1,29 @@ # -# qmake configuration for macx-nacl-g++ with embedded-lite +# qmake configuration for building with nacl-g++ # -include(../../common/unix.conf) - -MAKEFILE_GENERATOR = UNIX -TEMPLATE = app -CONFIG += qt warn_on release link_prl -QT += core gui -QMAKE_INCREMENTAL_STYLE = sublib -QMAKE_EXTENSION_SHLIB = dylib +include(../../common/linux.conf) +include(../../common/qws.conf) +include(../../common/gcc-base-unix.conf) +include(../../common/g++-unix.conf) +QT = core gui QMAKE_CC = nacl-gcc QMAKE_CXX = nacl-g++ QMAKE_LINK = nacl-g++ QMAKE_LINK_SHLIB = nacl-g++ - -#QMAKE_CC = $(TB)cc -QMAKE_LEX = flex -QMAKE_LEXFLAGS = -QMAKE_YACC = yacc -QMAKE_YACCFLAGS = -d -QMAKE_CFLAGS = -pipe -DXP_UNIX -DNACL_STANDALONE=1 -QMAKE_CFLAGS_WARN_ON = -Wall -W -QMAKE_CFLAGS_WARN_OFF = -QMAKE_CFLAGS_RELEASE = -O2 -QMAKE_CFLAGS_DEBUG = -g -QMAKE_CFLAGS_SHLIB = -fPIC -QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses -QMAKE_CFLAGS_THREAD = -D_REENTRANT -QMAKE_CFLAGS_HIDESYMS = -fvisibility=hidden - -#QMAKE_CXX = $(TB)c++ -QMAKE_CXXFLAGS = $$QMAKE_CFLAGS -DQT_NO_QWS_TRANSFORMED -QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON -QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF -QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE -fno-default-inline -QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG -QMAKE_CXXFLAGS_SHLIB = $$QMAKE_CFLAGS_SHLIB -QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC -QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD -QMAKE_CXXFLAGS_HIDESYMS = $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden - -QMAKE_INCDIR = -QMAKE_LIBDIR = -QMAKE_INCDIR_X11 = -QMAKE_LIBDIR_X11 = -QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS] -QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS] -QMAKE_INCDIR_OPENGL = -QMAKE_LIBDIR_OPENGL = -QMAKE_INCDIR_QTOPIA = $(QPEDIR)/include -QMAKE_LIBDIR_QTOPIA = $(QPEDIR)/lib - -#QMAKE_LINK = $$QMAKE_CXX -#QMAKE_LINK_SHLIB = $$QMAKE_CXX -QMAKE_LFLAGS = -QMAKE_LFLAGS_RELEASE = -QMAKE_LFLAGS_DEBUG = -QMAKE_LFLAGS_SHLIB = -dynamiclib -QMAKE_LFLAGS_INCREMENTAL = -undefined suppress -flat_namespace -QMAKE_LFLAGS_PLUGIN = -bundle -QMAKE_LFLAGS_SONAME = -QMAKE_LFLAGS_THREAD = - -QMAKE_LIBS = -lgoogle_nacl_imc -lgoogle_nacl_npruntime -lgoogle_nacl_pgl -lgoogle_nacl_gpu -lpthread -lsrpc -QMAKE_LIBS_X11 = -QMAKE_LIBS_X11SM = -QMAKE_LIBS_QT = -lqte -QMAKE_LIBS_QT_THREAD = -lqte-mt -QMAKE_LIBS_QT_OPENGL = -lqgl -QMAKE_LIBS_QTOPIA = -lqpe -lqtopia -QMAKE_LIBS_THREAD = -QMAKE_LIBS_OPENGL = - -QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -QMAKE_UIC = $$[QT_INSTALL_BINS]/uic - QMAKE_AR = nacl-ar q QMAKE_OBJCOPY = nacl-objcopy QMAKE_STRIP = nacl-strip -QMAKE_RANLIB = -QMAKE_TAR = tar -cf -QMAKE_GZIP = gzip -9f +# work around linker crash when using PIC +QMAKE_CFLAGS_STATIC_LIB -= -fPIC +QMAKE_CFLAGS_SHLIB -= -fPIC +QMAKE_CXXFLAGS_STATIC_LIB -= -fPIC +QMAKE_CXXFLAGS_SHLIB -= -fPIC + +#QMAKE_CFLAGS += -pipe -DXP_UNIX -DNACL_STANDALONE=1 +QMAKE_LIBS_DYNLOAD -= -ldl -QMAKE_COPY = cp -f -QMAKE_MOVE = mv -f -QMAKE_DEL_FILE = rm -f -QMAKE_DEL_DIR = rmdir -QMAKE_CHK_DIR_EXISTS = test -d -QMAKE_MKDIR = mkdir -p load(qt_config) diff --git a/mkspecs/qws/macx-nacl-g++/qplatformdefs.h b/mkspecs/qws/macx-nacl-g++/qplatformdefs.h index 01b26d9..f893238 100644 --- a/mkspecs/qws/macx-nacl-g++/qplatformdefs.h +++ b/mkspecs/qws/macx-nacl-g++/qplatformdefs.h @@ -1,175 +1,66 @@ /**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the qmake spec of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ + ** + ** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). + ** All rights reserved. + ** Contact: Nokia Corporation (qt-info@nokia.com) + ** + ** This file is part of the qmake spec of the Qt Toolkit. + ** + ** $QT_BEGIN_LICENSE:LGPL$ + ** No Commercial Usage + ** This file contains pre-release code and may not be distributed. + ** You may use this file in accordance with the terms and conditions + ** contained in the Technology Preview License Agreement accompanying + ** this package. + ** + ** GNU Lesser General Public License Usage + ** Alternatively, this file may be used under the terms of the GNU Lesser + ** General Public License version 2.1 as published by the Free Software + ** Foundation and appearing in the file LICENSE.LGPL included in the + ** packaging of this file. Please review the following information to + ** ensure the GNU Lesser General Public License version 2.1 requirements + ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. + ** + ** In addition, as a special exception, Nokia gives you certain additional + ** rights. These rights are described in the Nokia Qt LGPL Exception + ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. + ** + ** If you have questions regarding the use of this file, please contact + ** Nokia at qt-info@nokia.com. + ** + ** + ** + ** + ** + ** + ** + ** + ** $QT_END_LICENSE$ + ** + ****************************************************************************/ #ifndef QPLATFORMDEFS_H #define QPLATFORMDEFS_H -// Get Qt defines/settings #define _POSIX_TIMERS #include "qglobal.h" - -#define _POSIX_TIMERS -// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs - -// 1) need to reset default environment if _BSD_SOURCE is defined -// 2) need to specify POSIX thread interfaces explicitly in glibc 2.0 -// 3) it seems older glibc need this to include the X/Open stuff -#ifndef _GNU_SOURCE -# define _GNU_SOURCE -#endif - -#include <unistd.h> - - -// We are hot - unistd.h should have turned on the specific APIs we requested - -#include <sys/features.h> -#include <pthread.h> -#include <dirent.h> -#include <fcntl.h> -#include <grp.h> -#include <pwd.h> -#include <signal.h> -//#include <dlfcn.h> - -#include <sys/types.h> -//#include <sys/ioctl.h> -//#include <sys/ipc.h> - -#include <sys/time.h> -//#include <sys/shm.h> -//#include <sys/socket.h> -#include <sys/stat.h> -#include <sys/wait.h> -//#include <netinet/in.h> -#ifndef QT_NO_IPV6IFNAME -#include <net/if.h> -#endif - // extra disabling. -#ifdef __native_client__ +#ifdef __native_client__ #define QT_NO_FSFILEENGINE -#define QT_NO_TRANSLATION #endif -#ifdef QT_LARGEFILE_SUPPORT -#define QT_STATBUF struct stat64 -#define QT_STATBUF4TSTAT struct stat64 -#define QT_STAT ::stat64 -#define QT_FSTAT ::fstat64 -#define QT_LSTAT ::lstat64 -#define QT_OPEN ::open64 -#define QT_TRUNCATE ::truncate64 -#define QT_FTRUNCATE ::ftruncate64 -#define QT_LSEEK ::lseek64 -#else -#define QT_STATBUF struct stat -#define QT_STATBUF4TSTAT struct stat -#define QT_STAT ::stat -#define QT_FSTAT ::fstat -#define QT_LSTAT ::lstat -#define QT_OPEN ::open -#define QT_TRUNCATE ::truncate -#define QT_FTRUNCATE ::ftruncate -#define QT_LSEEK ::lseek -#endif +#define QT_NO_SOCKET_H -#ifdef QT_LARGEFILE_SUPPORT -#define QT_FOPEN ::fopen64 -#define QT_FSEEK ::fseeko64 -#define QT_FTELL ::ftello64 -#define QT_FGETPOS ::fgetpos64 -#define QT_FSETPOS ::fsetpos64 -#define QT_FPOS_T fpos64_t -#define QT_OFF_T off64_t -#else -#define QT_FOPEN ::fopen -#define QT_FSEEK ::fseek -#define QT_FTELL ::ftell -#define QT_FGETPOS ::fgetpos -#define QT_FSETPOS ::fsetpos -#define QT_FPOS_T fpos_t -#define QT_OFF_T long -#endif +#define DIR void * +#define PATH_MAX 256 -#define QT_STAT_REG S_IFREG -#define QT_STAT_DIR S_IFDIR -#define QT_STAT_MASK S_IFMT -#define QT_STAT_LNK S_IFLNK -#define QT_SOCKET_CONNECT ::connect -#define QT_SOCKET_BIND ::bind -#define QT_FILENO fileno -#define QT_CLOSE ::close -#define QT_READ ::read -#define QT_WRITE ::write -#define QT_ACCESS ::access -#define QT_GETCWD ::getcwd -#define QT_CHDIR ::chdir -#define QT_MKDIR ::mkdir -#define QT_RMDIR ::rmdir -#define QT_OPEN_LARGEFILE O_LARGEFILE -#define QT_OPEN_RDONLY O_RDONLY -#define QT_OPEN_WRONLY O_WRONLY -#define QT_OPEN_RDWR O_RDWR -#define QT_OPEN_CREAT O_CREAT -#define QT_OPEN_TRUNC O_TRUNC -#define QT_OPEN_APPEND O_APPEND +#include "../../common/posix/qplatformdefs.h" -#define QT_SIGNAL_RETTYPE void -#define QT_SIGNAL_ARGS int -#define QT_SIGNAL_IGNORE SIG_IGN - -#if defined(__GLIBC__) && (__GLIBC__ >= 2) -#define QT_SOCKLEN_T socklen_t -#else -#define QT_SOCKLEN_T int -#endif - -#if defined(_XOPEN_SOURCE) && (_XOPEN_SOURCE >= 500) -#define QT_SNPRINTF ::snprintf -#define QT_VSNPRINTF ::vsnprintf -#endif +#undef QT_LSTAT +#define QT_LSTAT QT_STAT #endif // QPLATFORMDEFS_H -- cgit v0.12 From 66f30105ef15579c13b5574cc11bbe49f1615f41 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 09:16:20 +0100 Subject: Fix CoreServices framework addition for qpa. Test against the coreservices QT_CONFIG on qpa, unconditionally add CoreFoundation for mac and darwin --- src/corelib/corelib.pro | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro index f03550d..58d2c7b 100644 --- a/src/corelib/corelib.pro +++ b/src/corelib/corelib.pro @@ -20,14 +20,13 @@ include(statemachine/statemachine.pri) include(xml/xml.pri) !qpa:mac|darwin:LIBS_PRIVATE += -framework ApplicationServices -qpa:mac|darwin { - contains(QT_CONFIG, coreservices) { - LIBS_PRIVATE += -framework CoreServices - } else { - LIBS_PRIVATE += -framework CoreFoundation - } +qpa { + contains(QT_CONFIG, coreservices) { + LIBS_PRIVATE += -framework CoreServices + } +} else:mac|darwin { + LIBS_PRIVATE += -framework CoreFoundation } - mac:lib_bundle:DEFINES += QT_NO_DEBUG_PLUGIN_CHECK win32:DEFINES-=QT_NO_CAST_TO_ASCII -- cgit v0.12 From 2eddefa0d26e32e1f8e2dd93998ff14ff9c912d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 09:18:20 +0100 Subject: Compile. --- src/corelib/global/qnaclunimplemented.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/corelib/global/qnaclunimplemented.h b/src/corelib/global/qnaclunimplemented.h index 2d3d426..921667e 100644 --- a/src/corelib/global/qnaclunimplemented.h +++ b/src/corelib/global/qnaclunimplemented.h @@ -44,6 +44,8 @@ #ifdef Q_OS_NACL +#include <sys/types.h> + // pthread #include <pthread.h> #define PTHREAD_CANCEL_DISABLE 1 -- cgit v0.12 From 517290f73be74d1cf08fbd603870d3dacc379ff3 Mon Sep 17 00:00:00 2001 From: Michael Hasselmann <michaelh@openismus.com> Date: Thu, 10 Feb 2011 19:14:45 +0100 Subject: Introduce QGraphicsItem::ItemStopsFocusHandling flag MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When set for an item, QGraphicsScene will skip focus handling for this item and everything underneath it (including focus-out). Allows users to reimplement custom focus handling. Use case: touch devices that implement panning. Here, focus-in has to happen only if no panning was triggered. Analogous, no focus-out should happen when panning was detected. Fixes the alternative proposal ("black holes for focus changes") of QTBUG-16343: QGraphicsView doesn't support focus change on mouse release. The previous test was only testing one scenario, which didn't give a good idea whether the flag was actually working as intended. Task-number: QTBUG-17505 Reviewed-by: Yoann Lopes Reviewed-by: Jan-Arve Sæther --- src/gui/graphicsview/qgraphicsitem.cpp | 8 +++ src/gui/graphicsview/qgraphicsitem.h | 3 +- src/gui/graphicsview/qgraphicsitem_p.h | 6 +-- src/gui/graphicsview/qgraphicsscene.cpp | 17 +++++-- tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp | 69 ++++++++++++++++++++++---- 5 files changed, 84 insertions(+), 19 deletions(-) diff --git a/src/gui/graphicsview/qgraphicsitem.cpp b/src/gui/graphicsview/qgraphicsitem.cpp index f463887..4e2d4e2 100644 --- a/src/gui/graphicsview/qgraphicsitem.cpp +++ b/src/gui/graphicsview/qgraphicsitem.cpp @@ -417,6 +417,11 @@ click focus to items underneath when being clicked on. This flag allows you create a non-focusable item that can be clicked on without changing the focus. \endomit + + \omitvalue ItemStopsFocusHandling \omit Same as + ItemStopsClickFocusPropagation, but also suppresses focus-out. This flag + allows you to completely take over focus handling. + This flag was introduced in Qt 4.7. */ /*! @@ -11549,6 +11554,9 @@ QDebug operator<<(QDebug debug, QGraphicsItem::GraphicsItemFlag flag) case QGraphicsItem::ItemStopsClickFocusPropagation: str = "ItemStopsClickFocusPropagation"; break; + case QGraphicsItem::ItemStopsFocusHandling: + str = "ItemStopsFocusHandling"; + break; } debug << str; return debug; diff --git a/src/gui/graphicsview/qgraphicsitem.h b/src/gui/graphicsview/qgraphicsitem.h index e59a7c9..67c9cd3 100644 --- a/src/gui/graphicsview/qgraphicsitem.h +++ b/src/gui/graphicsview/qgraphicsitem.h @@ -107,7 +107,8 @@ public: ItemIsPanel = 0x4000, ItemIsFocusScope = 0x8000, // internal ItemSendsScenePositionChanges = 0x10000, - ItemStopsClickFocusPropagation = 0x20000 + ItemStopsClickFocusPropagation = 0x20000, + ItemStopsFocusHandling = 0x40000 // NB! Don't forget to increase the d_ptr->flags bit field by 1 when adding a new flag. }; Q_DECLARE_FLAGS(GraphicsItemFlags, GraphicsItemFlag) diff --git a/src/gui/graphicsview/qgraphicsitem_p.h b/src/gui/graphicsview/qgraphicsitem_p.h index 5c82116..90ff43f 100644 --- a/src/gui/graphicsview/qgraphicsitem_p.h +++ b/src/gui/graphicsview/qgraphicsitem_p.h @@ -559,7 +559,7 @@ public: quint32 dirtyChildrenBoundingRect : 1; // Packed 32 bits - quint32 flags : 18; + quint32 flags : 19; quint32 paintedViewBoundingRectsNeedRepaint : 1; quint32 dirtySceneTransform : 1; quint32 geometryChanged : 1; @@ -573,9 +573,9 @@ public: quint32 sceneTransformTranslateOnly : 1; quint32 notifyBoundingRectChanged : 1; quint32 notifyInvalidated : 1; - quint32 mouseSetsFocus : 1; // New 32 bits + quint32 mouseSetsFocus : 1; quint32 explicitActivate : 1; quint32 wantsActive : 1; quint32 holesInSiblingIndex : 1; @@ -586,7 +586,7 @@ public: quint32 mayHaveChildWithGraphicsEffect : 1; quint32 isDeclarativeItem : 1; quint32 sendParentChangeNotification : 1; - quint32 padding : 22; + quint32 padding : 21; // Optional stacking order int globalStackingOrder; diff --git a/src/gui/graphicsview/qgraphicsscene.cpp b/src/gui/graphicsview/qgraphicsscene.cpp index f997fc2..2d85de6 100644 --- a/src/gui/graphicsview/qgraphicsscene.cpp +++ b/src/gui/graphicsview/qgraphicsscene.cpp @@ -1317,8 +1317,10 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou // Set focus on the topmost enabled item that can take focus. bool setFocus = false; + foreach (QGraphicsItem *item, cachedItemsUnderMouse) { - if (item->isBlockedByModalPanel()) { + if (item->isBlockedByModalPanel() + || (item->d_ptr->flags & QGraphicsItem::ItemStopsFocusHandling)) { // Make sure we don't clear focus. setFocus = true; break; @@ -1331,10 +1333,10 @@ void QGraphicsScenePrivate::mousePressEventHandler(QGraphicsSceneMouseEvent *mou break; } } - if (item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation) - break; if (item->isPanel()) break; + if (item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation) + break; } // Check for scene modality. @@ -5925,6 +5927,7 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve // Set focus on the topmost enabled item that can take focus. bool setFocus = false; + foreach (QGraphicsItem *item, cachedItemsUnderMouse) { if (item->isEnabled() && ((item->flags() & QGraphicsItem::ItemIsFocusable) && item->d_ptr->mouseSetsFocus)) { if (!item->isWidget() || ((QGraphicsWidget *)item)->focusPolicy() & Qt::ClickFocus) { @@ -5938,6 +5941,11 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve break; if (item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation) break; + if (item->d_ptr->flags & QGraphicsItem::ItemStopsFocusHandling) { + // Make sure we don't clear focus. + setFocus = true; + break; + } } // If nobody could take focus, clear it. @@ -5970,7 +5978,8 @@ bool QGraphicsScenePrivate::sendTouchBeginEvent(QGraphicsItem *origin, QTouchEve } if (item && item->isPanel()) break; - if (item && (item->d_ptr->flags & QGraphicsItem::ItemStopsClickFocusPropagation)) + if (item && (item->d_ptr->flags + & (QGraphicsItem::ItemStopsClickFocusPropagation | QGraphicsItem::ItemStopsFocusHandling))) break; } diff --git a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp index dacb61e..168f75e 100644 --- a/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp +++ b/tests/auto/qgraphicsitem/tst_qgraphicsitem.cpp @@ -447,7 +447,8 @@ private slots: void updateMicroFocus(); void textItem_shortcuts(); void scroll(); - void stopClickFocusPropagation(); + void focusHandling_data(); + void focusHandling(); void deviceCoordinateCache_simpleRotations(); // task specific tests below me @@ -10537,8 +10538,39 @@ void tst_QGraphicsItem::scroll() QCOMPARE(item2->lastExposedRect, expectedItem2Expose); } -void tst_QGraphicsItem::stopClickFocusPropagation() +Q_DECLARE_METATYPE(QGraphicsItem::GraphicsItemFlag); + +void tst_QGraphicsItem::focusHandling_data() { + QTest::addColumn<QGraphicsItem::GraphicsItemFlag>("focusFlag"); + QTest::addColumn<bool>("useStickyFocus"); + QTest::addColumn<int>("expectedFocusItem"); // 0: none, 1: focusableUnder, 2: itemWithFocus + + QTest::newRow("Focus goes through.") + << static_cast<QGraphicsItem::GraphicsItemFlag>(0x0) << false << 1; + + QTest::newRow("Focus goes through, even with sticky scene.") + << static_cast<QGraphicsItem::GraphicsItemFlag>(0x0) << true << 1; + + QTest::newRow("With ItemStopsClickFocusPropagation, we cannot focus the item beneath the flagged one (but can still focus-out).") + << QGraphicsItem::ItemStopsClickFocusPropagation << false << 0; + + QTest::newRow("With ItemStopsClickFocusPropagation, we cannot focus the item beneath the flagged one (and cannot focus-out if scene is sticky).") + << QGraphicsItem::ItemStopsClickFocusPropagation << true << 2; + + QTest::newRow("With ItemStopsFocusHandling, focus cannot be changed by presses.") + << QGraphicsItem::ItemStopsFocusHandling << false << 2; + + QTest::newRow("With ItemStopsFocusHandling, focus cannot be changed by presses (even if scene is sticky).") + << QGraphicsItem::ItemStopsFocusHandling << true << 2; +} + +void tst_QGraphicsItem::focusHandling() +{ + QFETCH(QGraphicsItem::GraphicsItemFlag, focusFlag); + QFETCH(bool, useStickyFocus); + QFETCH(int, expectedFocusItem); + class MyItem : public QGraphicsRectItem { public: @@ -10549,12 +10581,9 @@ void tst_QGraphicsItem::stopClickFocusPropagation() } }; - QGraphicsScene scene(-50, -50, 400, 400); - scene.setStickyFocus(true); - QGraphicsRectItem *noFocusOnTop = new MyItem; + noFocusOnTop->setFlag(QGraphicsItem::ItemIsFocusable, false); noFocusOnTop->setBrush(Qt::yellow); - noFocusOnTop->setFlag(QGraphicsItem::ItemStopsClickFocusPropagation); QGraphicsRectItem *focusableUnder = new MyItem; focusableUnder->setBrush(Qt::blue); @@ -10566,9 +10595,13 @@ void tst_QGraphicsItem::stopClickFocusPropagation() itemWithFocus->setFlag(QGraphicsItem::ItemIsFocusable); itemWithFocus->setPos(250, 10); + QGraphicsScene scene(-50, -50, 400, 400); scene.addItem(noFocusOnTop); scene.addItem(focusableUnder); scene.addItem(itemWithFocus); + scene.setStickyFocus(useStickyFocus); + + noFocusOnTop->setFlag(focusFlag); focusableUnder->stackBefore(noFocusOnTop); itemWithFocus->setFocus(); @@ -10580,14 +10613,28 @@ void tst_QGraphicsItem::stopClickFocusPropagation() QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view)); QVERIFY(itemWithFocus->hasFocus()); - QPointF mousePressPoint = noFocusOnTop->mapToScene(QPointF()); - mousePressPoint.rx() += 60; - mousePressPoint.ry() += 60; + const QPointF mousePressPoint = noFocusOnTop->mapToScene(noFocusOnTop->boundingRect().center()); const QList<QGraphicsItem *> itemsAtMousePressPosition = scene.items(mousePressPoint); - QVERIFY(itemsAtMousePressPosition.contains(focusableUnder)); + QVERIFY(itemsAtMousePressPosition.contains(noFocusOnTop)); sendMousePress(&scene, mousePressPoint); - QVERIFY(itemWithFocus->hasFocus()); + + switch (expectedFocusItem) { + case 0: + QCOMPARE(scene.focusItem(), static_cast<QGraphicsRectItem *>(0)); + break; + case 1: + QCOMPARE(scene.focusItem(), focusableUnder); + break; + case 2: + QCOMPARE(scene.focusItem(), itemWithFocus); + break; + } + + // Sanity check - manually setting the focus must work regardless of our + // focus handling flags: + focusableUnder->setFocus(); + QCOMPARE(scene.focusItem(), focusableUnder); } void tst_QGraphicsItem::deviceCoordinateCache_simpleRotations() -- cgit v0.12 From 451d1c58913404e27b63395996a2e4b9aab65b95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 09:28:36 +0100 Subject: Lighthouse: Support Q_NO_CLIPBOARD. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reviewed-by: Jørgen Lind --- src/gui/kernel/qplatformclipboard_qpa.cpp | 4 ++++ src/gui/kernel/qplatformclipboard_qpa.h | 3 +++ src/gui/kernel/qplatformintegration_qpa.cpp | 5 +++++ src/gui/kernel/qplatformintegration_qpa.h | 2 ++ 4 files changed, 14 insertions(+) diff --git a/src/gui/kernel/qplatformclipboard_qpa.cpp b/src/gui/kernel/qplatformclipboard_qpa.cpp index fff4e19..8321e94 100644 --- a/src/gui/kernel/qplatformclipboard_qpa.cpp +++ b/src/gui/kernel/qplatformclipboard_qpa.cpp @@ -40,6 +40,8 @@ ****************************************************************************/ #include "qplatformclipboard_qpa.h" +#ifndef QT_NO_CLIPBOARD + QT_BEGIN_NAMESPACE class QClipboardData @@ -99,3 +101,5 @@ bool QPlatformClipboard::supportsMode(QClipboard::Mode mode) const } QT_END_NAMESPACE + +#endif //QT_NO_CLIPBOARD diff --git a/src/gui/kernel/qplatformclipboard_qpa.h b/src/gui/kernel/qplatformclipboard_qpa.h index 3f7bfbb..51371cb 100644 --- a/src/gui/kernel/qplatformclipboard_qpa.h +++ b/src/gui/kernel/qplatformclipboard_qpa.h @@ -44,6 +44,8 @@ #include <qplatformdefs.h> +#ifndef QT_NO_CLIPBOARD + #include <QtGui/QClipboard> QT_BEGIN_HEADER @@ -66,5 +68,6 @@ QT_END_NAMESPACE QT_END_HEADER +#endif // QT_NO_CLIPBOARD #endif //QPLATFORMCLIPBOARD_QPA_H diff --git a/src/gui/kernel/qplatformintegration_qpa.cpp b/src/gui/kernel/qplatformintegration_qpa.cpp index f43e141..06ac40f 100644 --- a/src/gui/kernel/qplatformintegration_qpa.cpp +++ b/src/gui/kernel/qplatformintegration_qpa.cpp @@ -102,6 +102,9 @@ QPlatformFontDatabase *QPlatformIntegration::fontDatabase() const \sa QPlatformClipboard */ + +#ifndef QT_NO_CLIPBOARD + QPlatformClipboard *QPlatformIntegration::clipboard() const { static QPlatformClipboard *clipboard = 0; @@ -111,6 +114,8 @@ QPlatformClipboard *QPlatformIntegration::clipboard() const return clipboard; } +#endif + QPlatformNativeInterface * QPlatformIntegration::nativeInterface() const { return 0; diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index 1d69af4..357e4de 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -86,7 +86,9 @@ public: //Deeper window system integrations virtual QPlatformFontDatabase *fontDatabase() const; +#ifndef QT_NO_CLIPBOARD virtual QPlatformClipboard *clipboard() const; +#endif // Experimental in mainthread eventloop integration // This should only be used if it is only possible to do window system event processing in -- cgit v0.12 From a2ba87d1edfe1008f96a99f24c2c52c521e404e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 09:29:22 +0100 Subject: qpnghandler: Compile with QT_NO_IMAGE_TEXT. --- src/gui/image/qpnghandler.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index a9aad51..7e0355a 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -492,8 +492,10 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage) outImage->setDotsPerMeterX(png_get_x_pixels_per_meter(png_ptr,info_ptr)); outImage->setDotsPerMeterY(png_get_y_pixels_per_meter(png_ptr,info_ptr)); +#ifndef QT_NO_IMAGE_TEXT for (int i = 0; i < readTexts.size()-1; i+=2) outImage->setText(readTexts.at(i), readTexts.at(i+1)); +#endif state = ReadingEnd; png_read_end(png_ptr, end_info); -- cgit v0.12 From 294ce2967d3e205c920965464642847ce014ab67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 09:43:04 +0100 Subject: posix platformdefs: Add QT_NO_SOCKET_H. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Prevents including <sys/socket.h> Reviewed-by: Jørgen Lind --- mkspecs/common/posix/qplatformdefs.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mkspecs/common/posix/qplatformdefs.h b/mkspecs/common/posix/qplatformdefs.h index 103ce89..60bc041 100644 --- a/mkspecs/common/posix/qplatformdefs.h +++ b/mkspecs/common/posix/qplatformdefs.h @@ -45,7 +45,9 @@ #include <signal.h> #include <sys/types.h> -#include <sys/socket.h> +#ifndef QT_NO_SOCKET_H +# include <sys/socket.h> +#endif #include <sys/stat.h> #if defined(QT_USE_XOPEN_LFS_EXTENSIONS) && defined(QT_LARGEFILE_SUPPORT) -- cgit v0.12 From fa5731a3591034723df192d869cd9ff7c1b52428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 09:44:25 +0100 Subject: NaCl: disable libtiff. (libtiff doesn't compile) --- configure | 1 + 1 file changed, 1 insertion(+) diff --git a/configure b/configure index 1922728..070447b 100755 --- a/configure +++ b/configure @@ -983,6 +983,7 @@ if [ "$CFG_EMBEDDED" = "nacl" ]; then CFG_SCRIPT=no CFG_SQLITE=no CFG_SQL_sqlite=no + CFG_LIBTIFF=no CFG_NOBUILD_PARTS="$CFG_NOBUILD_PARTS tests" QT_CONFIG="$QT_CONFIG nacl" fi -- cgit v0.12 From 3ed39aceda261d7c6b247d39cafff5931b168e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 09:45:35 +0100 Subject: NaCl: Dont force release builds. --- configure | 2 -- 1 file changed, 2 deletions(-) diff --git a/configure b/configure index 070447b..ffc93d8 100755 --- a/configure +++ b/configure @@ -960,8 +960,6 @@ if [ "$CFG_EMBEDDED" = "nacl" ]; then PLATFORM_QPA=yes echo "-fast" OPT_FAST=yes - echo "-release" - CFG_DEBUG=no echo "-qconfig minimal-system-dependencies" CFG_QCONFIG=minimal-system-dependencies -- cgit v0.12 From 5ba2675a33922cdd4ccef7de968e77b05bc1d556 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 09:53:43 +0100 Subject: Compile. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Respect the system-zlib QT_CONFIG setting. Reviewed-by: Jørgen Lind --- src/plugins/platforms/fontdatabases/basicunix/basicunix.pri | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/plugins/platforms/fontdatabases/basicunix/basicunix.pri b/src/plugins/platforms/fontdatabases/basicunix/basicunix.pri index 21aedba..da4698d 100644 --- a/src/plugins/platforms/fontdatabases/basicunix/basicunix.pri +++ b/src/plugins/platforms/fontdatabases/basicunix/basicunix.pri @@ -73,7 +73,11 @@ contains(QT_CONFIG, freetype) { $$QT_SOURCE_TREE/src/3rdparty/freetype/src \ $$QT_SOURCE_TREE/src/3rdparty/freetype/include - DEFINES += FT2_BUILD_LIBRARY FT_CONFIG_OPTION_SYSTEM_ZLIB + DEFINES += FT2_BUILD_LIBRARY + contains(QT_CONFIG, system-zlib) { + DEFINES += FT_CONFIG_OPTION_SYSTEM_ZLIB + } + } else:contains(QT_CONFIG, system-freetype) { # pull in the proper freetype2 include directory include($$QT_SOURCE_TREE/config.tests/unix/freetype/freetype.pri) -- cgit v0.12 From 468142db15fe99c70505f507f6c2941706172853 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 11:03:19 +0100 Subject: Add QT_NO_DYNAMIC_LIBRARY. Set it for nacl, replace the Q_OS defines vxworks already has in place. Motivation: Support static plugins on platforms that does not support dynamic plugins. Static plugin support is implemented in QPluginLoader, which has a QLibraryPrivate d pointer. The easiest way to untangle this seems to be to compile in QLibrary and then disable the ports of it that uses dlopen. Reviewed-By: Harald Fernengel --- src/corelib/plugin/qlibrary_unix.cpp | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp index 466350e..e32729a 100644 --- a/src/corelib/plugin/qlibrary_unix.cpp +++ b/src/corelib/plugin/qlibrary_unix.cpp @@ -56,9 +56,13 @@ #include <string.h> #endif +#if defined(Q_OS_VXWORKS) || defined (Q_OS_NACL) +#define QT_NO_DYNAMIC_LIBRARY +#endif + QT_BEGIN_NAMESPACE -#if !defined(QT_HPUX_LD) && !defined(Q_OS_VXWORKS) +#if !defined(QT_HPUX_LD) && !defined(QT_NO_DYNAMIC_LIBRARY) QT_BEGIN_INCLUDE_NAMESPACE #include <dlfcn.h> QT_END_INCLUDE_NAMESPACE @@ -66,8 +70,8 @@ QT_END_INCLUDE_NAMESPACE static QString qdlerror() { -#if defined(Q_OS_VXWORKS) - const char *err = "VxWorks does not support dynamic libraries."; +#if defined(QT_NO_DYNAMIC_LIBRARY) + const char *err = "This platform does not support dynamic libraries."; #elif !defined(QT_HPUX_LD) const char *err = dlerror(); #else @@ -79,7 +83,7 @@ static QString qdlerror() bool QLibraryPrivate::load_sys() { QString attempt; -#if !defined(Q_OS_VXWORKS) +#if !defined(QT_NO_DYNAMIC_LIBRARY) QFileInfo fi(fileName); #if defined(Q_OS_SYMBIAN) @@ -235,7 +239,7 @@ bool QLibraryPrivate::load_sys() } } #endif -#endif // Q_OS_VXWORKS +#endif // QT_NO_DYNAMIC_LIBRARY if (!pHnd) { errorString = QLibrary::tr("Cannot load library %1: %2").arg(fileName).arg(qdlerror()); } @@ -248,7 +252,7 @@ bool QLibraryPrivate::load_sys() bool QLibraryPrivate::unload_sys() { -#if !defined(Q_OS_VXWORKS) +#if !defined(QT_NO_DYNAMIC_LIBRARY) # if defined(QT_HPUX_LD) if (shl_unload((shl_t)pHnd)) { # else @@ -282,7 +286,7 @@ void* QLibraryPrivate::resolve_sys(const char* symbol) void* address = 0; if (shl_findsym((shl_t*)&pHnd, symbol, TYPE_UNDEFINED, &address) < 0) address = 0; -#elif defined(Q_OS_VXWORKS) +#elif defined (QT_NO_DYNAMIC_LIBRARY) void *address = 0; #else void* address = dlsym(pHnd, symbol); -- cgit v0.12 From f0fc5b8a9ab3f4bca0022771e576722d63a78ca2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@nokia.com> Date: Fri, 25 Feb 2011 11:22:00 +0100 Subject: Add QT_NO_FILESYSTEMITERATOR. This makes it possible to use the file-related classes on platforms that does not have a native QFileSystemIterator implementation. One use case is that we want to use the Qt resource system even if the platform file system support is limited. Reviewed-by: joao --- src/corelib/global/qfeatures.h | 3 +++ src/corelib/global/qfeatures.txt | 8 ++++++++ src/corelib/io/qdiriterator.cpp | 10 ++++++++++ src/corelib/io/qfilesystemiterator_p.h | 5 +++++ src/corelib/io/qfilesystemiterator_unix.cpp | 4 ++++ 5 files changed, 30 insertions(+) diff --git a/src/corelib/global/qfeatures.h b/src/corelib/global/qfeatures.h index d1a73a6..604d08a 100644 --- a/src/corelib/global/qfeatures.h +++ b/src/corelib/global/qfeatures.h @@ -79,6 +79,9 @@ // Effects //#define QT_NO_EFFECTS +// QFileSystemIterator +//#define QT_NO_FILESYSTEMITERATOR + // QFileSystemWatcher //#define QT_NO_FILESYSTEMWATCHER diff --git a/src/corelib/global/qfeatures.txt b/src/corelib/global/qfeatures.txt index 4d938a9..6b861d4 100644 --- a/src/corelib/global/qfeatures.txt +++ b/src/corelib/global/qfeatures.txt @@ -242,6 +242,14 @@ Requires: Name: QFileSystemWatcher SeeAlso: ??? +Feature: FILESYSTEMITERATOR +Description: Provides fast file-system iteration. +for modications. +Section: File I/O +Requires: +Name: QFileSystemIterator +SeeAlso: ??? + # Widgets Feature: TREEWIDGET diff --git a/src/corelib/io/qdiriterator.cpp b/src/corelib/io/qdiriterator.cpp index d293791..c7e56bd 100644 --- a/src/corelib/io/qdiriterator.cpp +++ b/src/corelib/io/qdiriterator.cpp @@ -142,7 +142,9 @@ public: #endif QDirIteratorPrivateIteratorStack<QAbstractFileEngineIterator> fileEngineIterators; +#ifndef QT_NO_FILESYSTEMITERATOR QDirIteratorPrivateIteratorStack<QFileSystemIterator> nativeIterators; +#endif QFileInfo currentFileInfo; QFileInfo nextFileInfo; @@ -204,9 +206,11 @@ void QDirIteratorPrivate::pushDirectory(const QFileInfo &fileInfo) // No iterator; no entry list. } } else { +#ifndef QT_NO_FILESYSTEMITERATOR QFileSystemIterator *it = new QFileSystemIterator(fileInfo.d_ptr->fileEntry, filters, nameFilters, iteratorFlags); nativeIterators << it; +#endif } } @@ -244,6 +248,7 @@ void QDirIteratorPrivate::advance() delete it; } } else { +#ifndef QT_NO_FILESYSTEMITERATOR QFileSystemEntry nextEntry; QFileSystemMetaData nextMetaData; @@ -260,6 +265,7 @@ void QDirIteratorPrivate::advance() nativeIterators.pop(); delete it; } +#endif } currentFileInfo = nextFileInfo; @@ -500,7 +506,11 @@ bool QDirIterator::hasNext() const if (d->engine) return !d->fileEngineIterators.isEmpty(); else +#ifndef QT_NO_FILESYSTEMITERATOR return !d->nativeIterators.isEmpty(); +#else + return false; +#endif } /*! diff --git a/src/corelib/io/qfilesystemiterator_p.h b/src/corelib/io/qfilesystemiterator_p.h index 66f4b1e..3477242 100644 --- a/src/corelib/io/qfilesystemiterator_p.h +++ b/src/corelib/io/qfilesystemiterator_p.h @@ -54,6 +54,9 @@ // #include <QtCore/qglobal.h> + +#ifndef QT_NO_FILESYSTEMITERATOR + #include <QtCore/qdir.h> #include <QtCore/qdiriterator.h> #include <QtCore/qstringlist.h> @@ -112,4 +115,6 @@ private: QT_END_NAMESPACE +#endif // QT_NO_FILESYSTEMITERATOR + #endif // include guard diff --git a/src/corelib/io/qfilesystemiterator_unix.cpp b/src/corelib/io/qfilesystemiterator_unix.cpp index 00ccd41..7c5fc29 100644 --- a/src/corelib/io/qfilesystemiterator_unix.cpp +++ b/src/corelib/io/qfilesystemiterator_unix.cpp @@ -42,6 +42,8 @@ #include "qplatformdefs.h" #include "qfilesystemiterator_p.h" +#ifndef QT_NO_FILESYSTEMITERATOR + #include <stdlib.h> #include <errno.h> @@ -111,3 +113,5 @@ bool QFileSystemIterator::advance(QFileSystemEntry &fileEntry, QFileSystemMetaDa } QT_END_NAMESPACE + +#endif // QT_NO_FILESYSTEMITERATOR -- cgit v0.12 From ed218edcf3d40e05b7cc9e1b895b7dad662e0511 Mon Sep 17 00:00:00 2001 From: Jiang Jiang <jiang.jiang@nokia.com> Date: Wed, 16 Mar 2011 09:34:01 +0100 Subject: Only enable RightToLeft forcing in OS X 10.6 and skip the test Reviewed-by: Eskil --- src/gui/text/qfontengine_coretext.mm | 2 ++ tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp | 3 +++ 2 files changed, 5 insertions(+) diff --git a/src/gui/text/qfontengine_coretext.mm b/src/gui/text/qfontengine_coretext.mm index 52d2455..4d9192e 100644 --- a/src/gui/text/qfontengine_coretext.mm +++ b/src/gui/text/qfontengine_coretext.mm @@ -128,6 +128,7 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay QCFType<CFAttributedStringRef> attributedString = CFAttributedStringCreate(0, cfstring, attributeDict); QCFType<CTTypesetterRef> typeSetter; +#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 if (flags & QTextEngine::RightToLeft) { const void *optionKeys[] = { kCTTypesetterOptionForcedEmbeddingLevel }; const short rtlForcedEmbeddingLevelValue = 1; @@ -136,6 +137,7 @@ bool QCoreTextFontEngineMulti::stringToCMap(const QChar *str, int len, QGlyphLay &kCFCopyStringDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); typeSetter = CTTypesetterCreateWithAttributedStringAndOptions(attributedString, options); } else +#endif typeSetter = CTTypesetterCreateWithAttributedString(attributedString); CFRange range = {0, 0}; diff --git a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp index 54c07a2..1952796 100644 --- a/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp +++ b/tests/auto/qtextscriptengine/tst_qtextscriptengine.cpp @@ -1194,6 +1194,9 @@ void tst_QTextScriptEngine::mirroredChars_data() void tst_QTextScriptEngine::mirroredChars() { +#if defined(Q_WS_MAC) + QSKIP("Not supported on Mac", SkipAll); +#endif QFETCH(int, hintingPreference); QFont font; -- cgit v0.12 From 8ec40d6de585315e0a4bd4f533a9113e836c8436 Mon Sep 17 00:00:00 2001 From: Morten Sorvig <msorvig@trolltech.com> Date: Wed, 16 Mar 2011 12:13:20 +0100 Subject: Rename qconfig-minimal-system-depenencies.h Rename to qconfig.nacl.h. This reflects that the config now enables all dependencies NaCl can support, not necessarily the minimal set. --- configure | 4 +- .../global/qconfig-minimal-system-dependencies.h | 371 --------------------- src/corelib/global/qconfig-nacl.h | 371 +++++++++++++++++++++ 3 files changed, 373 insertions(+), 373 deletions(-) delete mode 100644 src/corelib/global/qconfig-minimal-system-dependencies.h create mode 100644 src/corelib/global/qconfig-nacl.h diff --git a/configure b/configure index ffc93d8..2ea3689 100755 --- a/configure +++ b/configure @@ -960,8 +960,8 @@ if [ "$CFG_EMBEDDED" = "nacl" ]; then PLATFORM_QPA=yes echo "-fast" OPT_FAST=yes - echo "-qconfig minimal-system-dependencies" - CFG_QCONFIG=minimal-system-dependencies + echo "-qconfig nacl" + CFG_QCONFIG=nacl if [ `uname` = "Linux" ]; then I_FLAGS="$I_FLAGS -I${CFG_NACL_PATH}/toolchain/linux_x86/sdk/nacl-sdk/include" diff --git a/src/corelib/global/qconfig-minimal-system-dependencies.h b/src/corelib/global/qconfig-minimal-system-dependencies.h deleted file mode 100644 index 63319b9..0000000 --- a/src/corelib/global/qconfig-minimal-system-dependencies.h +++ /dev/null @@ -1,371 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#define QT_FONTS_ARE_RESOURCES - -/* Data structures */ -#ifndef QT_NO_QUUID_STRING -# define QT_NO_QUUID_STRING -#endif -#ifndef QT_NO_STL -# define QT_NO_STL -#endif -#ifndef QT_NO_TEXTDATE -# define QT_NO_TEXTDATE -#endif -#ifndef QT_NO_DATESTRING -# define QT_NO_DATESTRING -#endif - -/* Dialogs */ -#ifndef QT_NO_FILEDIALOG -# define QT_NO_FILEDIALOG -#endif -#ifndef QT_NO_PRINTDIALOG -# define QT_NO_PRINTDIALOG -#endif -#ifndef QT_NO_PRINTPREVIEWDIALOG -# define QT_NO_PRINTPREVIEWDIALOG -#endif - - -/* File I/O */ -#ifndef QT_NO_DOM -# define QT_NO_DOM -#endif -#ifndef QT_NO_FILESYSTEMWATCHER -# define QT_NO_FILESYSTEMWATCHER -#endif -#ifndef QT_NO_FSFILEENGINE -# define QT_NO_FSFILEENGINE -#endif -#ifndef QT_NO_FILESYSTEMMODEL -# define QT_NO_FILESYSTEMMODEL -#endif -#ifndef QT_NO_FILESYSTEMMODEL -# define QT_NO_FILESYSTEMMODEL -#endif -#ifndef QT_NO_PROCESS -# define QT_NO_PROCESS -#endif -#ifndef QT_NO_TEMPORARYFILE -# define QT_NO_TEMPORARYFILE -#endif -#ifndef QT_NO_SETTINGS -# define QT_NO_SETTINGS -#endif -#ifndef QT_NO_LIBRARY -# define QT_NO_LIBRARY -#endif - -/* Fonts */ -#ifndef QT_NO_QWS_QPF2 -# define QT_NO_QWS_QPF2 -#endif - -/* Images */ -#ifndef QT_NO_IMAGEFORMATPLUGIN -# define QT_NO_IMAGEFORMATPLUGIN -#endif -#ifndef QT_NO_IMAGE_HEURISTIC_MASK -# define QT_NO_IMAGE_HEURISTIC_MASK -#endif -#ifndef QT_NO_IMAGE_TEXT -# define QT_NO_IMAGE_TEXT -#endif -#ifndef QT_NO_MOVIE -# define QT_NO_MOVIE -#endif - -/* Internationalization */ -#ifndef QT_NO_BIG_CODECS -# define QT_NO_BIG_CODECS -#endif -#ifndef QT_NO_QWS_INPUTMETHODS -# define QT_NO_QWS_INPUTMETHODS -#endif -#ifndef QT_NO_TEXTCODEC -# define QT_NO_TEXTCODEC -#endif -#ifndef QT_NO_CODECS -# define QT_NO_CODECS -#endif -#ifndef QT_NO_TEXTCODECPLUGIN -# define QT_NO_TEXTCODECPLUGIN -#endif -#ifndef QT_NO_TRANSLATION -# define QT_NO_TRANSLATION -#endif -#ifndef QT_NO_TRANSLATION_UTF8 -# define QT_NO_TRANSLATION_UTF8 -#endif - -/* ItemViews */ - -#ifndef QT_NO_DIRMODEL -# define QT_NO_DIRMODEL -#endif - -/* Kernel */ -#ifndef QT_NO_CLIPBOARD -# define QT_NO_CLIPBOARD -#endif -#ifndef QT_NO_CSSPARSER -# define QT_NO_CSSPARSER -#endif -#ifndef QT_NO_CURSOR -# define QT_NO_CURSOR -#endif -#ifndef QT_NO_DRAGANDDROP -# define QT_NO_DRAGANDDROP -#endif -#ifndef QT_NO_EFFECTS -# define QT_NO_EFFECTS -#endif -#ifndef QT_NO_SESSIONMANAGER -# define QT_NO_SESSIONMANAGER -#endif -#ifndef QT_NO_SHAREDMEMORY -# define QT_NO_SHAREDMEMORY -#endif -#ifndef QT_NO_SOUND -# define QT_NO_SOUND -#endif -#ifndef QT_NO_SYSTEMLOCALE -# define QT_NO_SYSTEMSEMAPHORE -#endif -#ifndef QT_NO_SYSTEMSEMAPHORE -# define QT_NO_SYSTEMSEMAPHORE -#endif -#ifndef QT_NO_TABLETEVENT -# define QT_NO_TABLETEVENT -#endif -#ifndef QT_NO_CRASHHANDLER -# define QT_NO_CRASHHANDLER -#endif -#ifndef QT_NO_CONCURRENT -# define QT_NO_CONCURRENT -#endif -#ifndef QT_NO_XMLSTREAM -# define QT_NO_XMLSTREAM -#endif -#ifndef QT_NO_XMLSTREAMREADER -# define QT_NO_XMLSTREAMREADER -#endif -#ifndef QT_NO_XMLSTREAMWRITER -# define QT_NO_XMLSTREAMWRITER -#endif - -/* Networking */ -#ifndef QT_NO_COP -# define QT_NO_COP -#endif -#ifndef QT_NO_HOSTINFO -# define QT_NO_HOSTINFO -#endif -#ifndef QT_NO_HTTP -# define QT_NO_HTTP -#endif -#ifndef QT_NO_NETWORKPROXY -# define QT_NO_NETWORKPROXY -#endif -#ifndef QT_NO_SOCKS5 -# define QT_NO_SOCKS5 -#endif -#ifndef QT_NO_UDPSOCKET -# define QT_NO_UDPSOCKET -#endif -#ifndef QT_NO_URLINFO -# define QT_NO_URLINFO -#endif -#ifndef QT_NO_FTP -# define QT_NO_FTP -#endif - -/* Painting */ -#ifndef QT_NO_COLORNAMES -# define QT_NO_COLORNAMES -#endif -#ifndef QT_NO_DIRECTPAINTER -# define QT_NO_DIRECTPAINTER -#endif -#ifndef QT_NO_PAINTONSCREEN -# define QT_NO_PAINTONSCREEN -#endif -#ifndef QT_NO_PAINT_DEBUG -# define QT_NO_PAINT_DEBUG -#endif -#ifndef QT_NO_PICTURE -# define QT_NO_PICTURE -#endif -#ifndef QT_NO_PRINTER -# define QT_NO_PRINTER -#endif -#ifndef QT_NO_CUPS -# define QT_NO_CUPS -#endif - -/* Qt for Embedded Linux */ -#ifndef QT_NO_QWSEMBEDWIDGET -# define QT_NO_QWSEMBEDWIDGET -#endif -#ifndef QT_NO_QWS_ALPHA_CURSOR -# define QT_NO_QWS_ALPHA_CURSOR -#endif -#ifndef QT_NO_QWS_CURSOR -# define QT_NO_QWS_CURSOR -#endif -#ifndef QT_NO_QWS_DECORATION_DEFAULT -# define QT_NO_QWS_DECORATION_DEFAULT -#endif -#ifndef QT_NO_QWS_DECORATION_STYLED -# define QT_NO_QWS_DECORATION_STYLED -#endif -#ifndef QT_NO_QWS_DECORATION_WINDOWS -# define QT_NO_QWS_DECORATION_WINDOWS -#endif -#ifndef QT_NO_QWS_MANAGER -# define QT_NO_QWS_MANAGER -#endif -#ifndef QT_NO_QWS_KEYBOARD -# define QT_NO_QWS_KEYBOARD -#endif -#ifndef QT_NO_QWS_MOUSE -# define QT_NO_QWS_MOUSE -#endif -#ifndef QT_NO_QWS_MOUSE_AUTO -# define QT_NO_QWS_MOUSE_AUTO -#endif -#ifndef QT_NO_QWS_MOUSE_MANUAL -# define QT_NO_QWS_MOUSE_MANUAL -#endif -#ifndef QT_NO_QWS_MULTIPROCESS -# define QT_NO_QWS_MULTIPROCESS -#endif -#ifndef QT_NO_QWS_SOUNDSERVER -# define QT_NO_QWS_SOUNDSERVER -#endif -#ifndef QT_NO_SXE -# define QT_NO_SXE -#endif -#ifndef QT_NO_QWS_PROPERTIES -# define QT_NO_QWS_PROPERTIES -#endif -#ifndef QT_NO_QWS_PROXYSCREEN -# define QT_NO_QWS_PROXYSCREEN -#endif -#ifndef QT_NO_QWS_DYNAMICSCREENTRANSFORMATION -# define QT_NO_QWS_DYNAMICSCREENTRANSFORMATION -#endif -#ifndef QT_NO_QWS_LINUXFB -# define QT_NO_QWS_LINUXFB -#endif -#ifndef QT_NO_QWS_MOUSE_PC -# define QT_NO_QWS_MOUSE_PC -#endif -#ifndef QT_NO_QWS_MOUSE_LINUXTP -# define QT_NO_QWS_MOUSE_LINUXTP -#endif -#ifndef QT_NO_QWS_QPF -# define QT_NO_QWS_QPF -#endif - -/* SVG */ -#ifndef QT_NO_SVG -# define QT_NO_SVG -#endif -#ifndef QT_NO_GRAPHICSSVGITEM -# define QT_NO_GRAPHICSSVGITEM -#endif -#ifndef QT_NO_SVGGENERATOR -# define QT_NO_SVGGENERATOR -#endif -#ifndef QT_NO_SVGRENDERER -# define QT_NO_SVGRENDERER -#endif -#ifndef QT_NO_SVGWIDGET -# define QT_NO_SVGWIDGET -#endif - -/* Styles */ -#ifndef QT_NO_STYLE_MOTIF -# define QT_NO_STYLE_MOTIF -#endif -#ifndef QT_NO_STYLE_CDE -# define QT_NO_STYLE_CDE -#endif -#ifndef QT_NO_STYLE_STYLESHEET -# define QT_NO_STYLE_STYLESHEET -#endif -#ifndef QT_NO_STYLE_WINDOWSCE -# define QT_NO_STYLE_WINDOWSCE -#endif -#ifndef QT_NO_STYLE_WINDOWSMOBILE -# define QT_NO_STYLE_WINDOWSMOBILE -#endif -#ifndef QT_NO_STYLE_WINDOWSVISTA -# define QT_NO_STYLE_WINDOWSVISTA -#endif -#ifndef QT_NO_STYLE_WINDOWSXP -# define QT_NO_STYLE_WINDOWSXP -#endif - -/* Utilities */ -#ifndef QT_NO_ACCESSIBILITY -# define QT_NO_ACCESSIBILITY -#endif -#ifndef QT_NO_COMPLETER -# define QT_NO_COMPLETER -#endif -#ifndef QT_NO_DESKTOPSERVICES -# define QT_NO_DESKTOPSERVICES -#endif -#ifndef QT_NO_SCRIPT -# define QT_NO_SCRIPT -#endif -#ifndef QT_NO_SYSTEMTRAYICON -# define QT_NO_SYSTEMTRAYICON -#endif - -/* Windows */ -#ifndef QT_NO_WIN_ACTIVEQT -# define QT_NO_WIN_ACTIVEQT -#endif diff --git a/src/corelib/global/qconfig-nacl.h b/src/corelib/global/qconfig-nacl.h new file mode 100644 index 0000000..63319b9 --- /dev/null +++ b/src/corelib/global/qconfig-nacl.h @@ -0,0 +1,371 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#define QT_FONTS_ARE_RESOURCES + +/* Data structures */ +#ifndef QT_NO_QUUID_STRING +# define QT_NO_QUUID_STRING +#endif +#ifndef QT_NO_STL +# define QT_NO_STL +#endif +#ifndef QT_NO_TEXTDATE +# define QT_NO_TEXTDATE +#endif +#ifndef QT_NO_DATESTRING +# define QT_NO_DATESTRING +#endif + +/* Dialogs */ +#ifndef QT_NO_FILEDIALOG +# define QT_NO_FILEDIALOG +#endif +#ifndef QT_NO_PRINTDIALOG +# define QT_NO_PRINTDIALOG +#endif +#ifndef QT_NO_PRINTPREVIEWDIALOG +# define QT_NO_PRINTPREVIEWDIALOG +#endif + + +/* File I/O */ +#ifndef QT_NO_DOM +# define QT_NO_DOM +#endif +#ifndef QT_NO_FILESYSTEMWATCHER +# define QT_NO_FILESYSTEMWATCHER +#endif +#ifndef QT_NO_FSFILEENGINE +# define QT_NO_FSFILEENGINE +#endif +#ifndef QT_NO_FILESYSTEMMODEL +# define QT_NO_FILESYSTEMMODEL +#endif +#ifndef QT_NO_FILESYSTEMMODEL +# define QT_NO_FILESYSTEMMODEL +#endif +#ifndef QT_NO_PROCESS +# define QT_NO_PROCESS +#endif +#ifndef QT_NO_TEMPORARYFILE +# define QT_NO_TEMPORARYFILE +#endif +#ifndef QT_NO_SETTINGS +# define QT_NO_SETTINGS +#endif +#ifndef QT_NO_LIBRARY +# define QT_NO_LIBRARY +#endif + +/* Fonts */ +#ifndef QT_NO_QWS_QPF2 +# define QT_NO_QWS_QPF2 +#endif + +/* Images */ +#ifndef QT_NO_IMAGEFORMATPLUGIN +# define QT_NO_IMAGEFORMATPLUGIN +#endif +#ifndef QT_NO_IMAGE_HEURISTIC_MASK +# define QT_NO_IMAGE_HEURISTIC_MASK +#endif +#ifndef QT_NO_IMAGE_TEXT +# define QT_NO_IMAGE_TEXT +#endif +#ifndef QT_NO_MOVIE +# define QT_NO_MOVIE +#endif + +/* Internationalization */ +#ifndef QT_NO_BIG_CODECS +# define QT_NO_BIG_CODECS +#endif +#ifndef QT_NO_QWS_INPUTMETHODS +# define QT_NO_QWS_INPUTMETHODS +#endif +#ifndef QT_NO_TEXTCODEC +# define QT_NO_TEXTCODEC +#endif +#ifndef QT_NO_CODECS +# define QT_NO_CODECS +#endif +#ifndef QT_NO_TEXTCODECPLUGIN +# define QT_NO_TEXTCODECPLUGIN +#endif +#ifndef QT_NO_TRANSLATION +# define QT_NO_TRANSLATION +#endif +#ifndef QT_NO_TRANSLATION_UTF8 +# define QT_NO_TRANSLATION_UTF8 +#endif + +/* ItemViews */ + +#ifndef QT_NO_DIRMODEL +# define QT_NO_DIRMODEL +#endif + +/* Kernel */ +#ifndef QT_NO_CLIPBOARD +# define QT_NO_CLIPBOARD +#endif +#ifndef QT_NO_CSSPARSER +# define QT_NO_CSSPARSER +#endif +#ifndef QT_NO_CURSOR +# define QT_NO_CURSOR +#endif +#ifndef QT_NO_DRAGANDDROP +# define QT_NO_DRAGANDDROP +#endif +#ifndef QT_NO_EFFECTS +# define QT_NO_EFFECTS +#endif +#ifndef QT_NO_SESSIONMANAGER +# define QT_NO_SESSIONMANAGER +#endif +#ifndef QT_NO_SHAREDMEMORY +# define QT_NO_SHAREDMEMORY +#endif +#ifndef QT_NO_SOUND +# define QT_NO_SOUND +#endif +#ifndef QT_NO_SYSTEMLOCALE +# define QT_NO_SYSTEMSEMAPHORE +#endif +#ifndef QT_NO_SYSTEMSEMAPHORE +# define QT_NO_SYSTEMSEMAPHORE +#endif +#ifndef QT_NO_TABLETEVENT +# define QT_NO_TABLETEVENT +#endif +#ifndef QT_NO_CRASHHANDLER +# define QT_NO_CRASHHANDLER +#endif +#ifndef QT_NO_CONCURRENT +# define QT_NO_CONCURRENT +#endif +#ifndef QT_NO_XMLSTREAM +# define QT_NO_XMLSTREAM +#endif +#ifndef QT_NO_XMLSTREAMREADER +# define QT_NO_XMLSTREAMREADER +#endif +#ifndef QT_NO_XMLSTREAMWRITER +# define QT_NO_XMLSTREAMWRITER +#endif + +/* Networking */ +#ifndef QT_NO_COP +# define QT_NO_COP +#endif +#ifndef QT_NO_HOSTINFO +# define QT_NO_HOSTINFO +#endif +#ifndef QT_NO_HTTP +# define QT_NO_HTTP +#endif +#ifndef QT_NO_NETWORKPROXY +# define QT_NO_NETWORKPROXY +#endif +#ifndef QT_NO_SOCKS5 +# define QT_NO_SOCKS5 +#endif +#ifndef QT_NO_UDPSOCKET +# define QT_NO_UDPSOCKET +#endif +#ifndef QT_NO_URLINFO +# define QT_NO_URLINFO +#endif +#ifndef QT_NO_FTP +# define QT_NO_FTP +#endif + +/* Painting */ +#ifndef QT_NO_COLORNAMES +# define QT_NO_COLORNAMES +#endif +#ifndef QT_NO_DIRECTPAINTER +# define QT_NO_DIRECTPAINTER +#endif +#ifndef QT_NO_PAINTONSCREEN +# define QT_NO_PAINTONSCREEN +#endif +#ifndef QT_NO_PAINT_DEBUG +# define QT_NO_PAINT_DEBUG +#endif +#ifndef QT_NO_PICTURE +# define QT_NO_PICTURE +#endif +#ifndef QT_NO_PRINTER +# define QT_NO_PRINTER +#endif +#ifndef QT_NO_CUPS +# define QT_NO_CUPS +#endif + +/* Qt for Embedded Linux */ +#ifndef QT_NO_QWSEMBEDWIDGET +# define QT_NO_QWSEMBEDWIDGET +#endif +#ifndef QT_NO_QWS_ALPHA_CURSOR +# define QT_NO_QWS_ALPHA_CURSOR +#endif +#ifndef QT_NO_QWS_CURSOR +# define QT_NO_QWS_CURSOR +#endif +#ifndef QT_NO_QWS_DECORATION_DEFAULT +# define QT_NO_QWS_DECORATION_DEFAULT +#endif +#ifndef QT_NO_QWS_DECORATION_STYLED +# define QT_NO_QWS_DECORATION_STYLED +#endif +#ifndef QT_NO_QWS_DECORATION_WINDOWS +# define QT_NO_QWS_DECORATION_WINDOWS +#endif +#ifndef QT_NO_QWS_MANAGER +# define QT_NO_QWS_MANAGER +#endif +#ifndef QT_NO_QWS_KEYBOARD +# define QT_NO_QWS_KEYBOARD +#endif +#ifndef QT_NO_QWS_MOUSE +# define QT_NO_QWS_MOUSE +#endif +#ifndef QT_NO_QWS_MOUSE_AUTO +# define QT_NO_QWS_MOUSE_AUTO +#endif +#ifndef QT_NO_QWS_MOUSE_MANUAL +# define QT_NO_QWS_MOUSE_MANUAL +#endif +#ifndef QT_NO_QWS_MULTIPROCESS +# define QT_NO_QWS_MULTIPROCESS +#endif +#ifndef QT_NO_QWS_SOUNDSERVER +# define QT_NO_QWS_SOUNDSERVER +#endif +#ifndef QT_NO_SXE +# define QT_NO_SXE +#endif +#ifndef QT_NO_QWS_PROPERTIES +# define QT_NO_QWS_PROPERTIES +#endif +#ifndef QT_NO_QWS_PROXYSCREEN +# define QT_NO_QWS_PROXYSCREEN +#endif +#ifndef QT_NO_QWS_DYNAMICSCREENTRANSFORMATION +# define QT_NO_QWS_DYNAMICSCREENTRANSFORMATION +#endif +#ifndef QT_NO_QWS_LINUXFB +# define QT_NO_QWS_LINUXFB +#endif +#ifndef QT_NO_QWS_MOUSE_PC +# define QT_NO_QWS_MOUSE_PC +#endif +#ifndef QT_NO_QWS_MOUSE_LINUXTP +# define QT_NO_QWS_MOUSE_LINUXTP +#endif +#ifndef QT_NO_QWS_QPF +# define QT_NO_QWS_QPF +#endif + +/* SVG */ +#ifndef QT_NO_SVG +# define QT_NO_SVG +#endif +#ifndef QT_NO_GRAPHICSSVGITEM +# define QT_NO_GRAPHICSSVGITEM +#endif +#ifndef QT_NO_SVGGENERATOR +# define QT_NO_SVGGENERATOR +#endif +#ifndef QT_NO_SVGRENDERER +# define QT_NO_SVGRENDERER +#endif +#ifndef QT_NO_SVGWIDGET +# define QT_NO_SVGWIDGET +#endif + +/* Styles */ +#ifndef QT_NO_STYLE_MOTIF +# define QT_NO_STYLE_MOTIF +#endif +#ifndef QT_NO_STYLE_CDE +# define QT_NO_STYLE_CDE +#endif +#ifndef QT_NO_STYLE_STYLESHEET +# define QT_NO_STYLE_STYLESHEET +#endif +#ifndef QT_NO_STYLE_WINDOWSCE +# define QT_NO_STYLE_WINDOWSCE +#endif +#ifndef QT_NO_STYLE_WINDOWSMOBILE +# define QT_NO_STYLE_WINDOWSMOBILE +#endif +#ifndef QT_NO_STYLE_WINDOWSVISTA +# define QT_NO_STYLE_WINDOWSVISTA +#endif +#ifndef QT_NO_STYLE_WINDOWSXP +# define QT_NO_STYLE_WINDOWSXP +#endif + +/* Utilities */ +#ifndef QT_NO_ACCESSIBILITY +# define QT_NO_ACCESSIBILITY +#endif +#ifndef QT_NO_COMPLETER +# define QT_NO_COMPLETER +#endif +#ifndef QT_NO_DESKTOPSERVICES +# define QT_NO_DESKTOPSERVICES +#endif +#ifndef QT_NO_SCRIPT +# define QT_NO_SCRIPT +#endif +#ifndef QT_NO_SYSTEMTRAYICON +# define QT_NO_SYSTEMTRAYICON +#endif + +/* Windows */ +#ifndef QT_NO_WIN_ACTIVEQT +# define QT_NO_WIN_ACTIVEQT +#endif -- cgit v0.12 From 48629ab39aa4e20b21a359dc251569a98606983d Mon Sep 17 00:00:00 2001 From: Laszlo Agocs <laszlo.p.agocs@nokia.com> Date: Wed, 16 Mar 2011 13:52:28 +0200 Subject: Fix for wrong dpi metrics for raster pixmaps on Symbian. The original implementation relied on SizeInTwips() for the underlying bitmap which unfortunately returns 0, leading to incorrect results from QPixmap::logicalDpiX/Y(). This caused issues in text rendering onto pixmaps (QTBUG-17628). This fix changes QS60PixmapData to use a slightly different metrics() implementation (the one VG and GL PixmapData are using). Task-number: QTBUG-18154 Reviewed-by: Jani Hautakangas --- src/gui/image/qpixmap_s60.cpp | 29 +++++++++++------------------ 1 file changed, 11 insertions(+), 18 deletions(-) diff --git a/src/gui/image/qpixmap_s60.cpp b/src/gui/image/qpixmap_s60.cpp index fbdebf3..32d8dd7 100644 --- a/src/gui/image/qpixmap_s60.cpp +++ b/src/gui/image/qpixmap_s60.cpp @@ -601,6 +601,9 @@ bool QS60PixmapData::scroll(int dx, int dy, const QRect &rect) return res; } +Q_GUI_EXPORT int qt_defaultDpiX(); +Q_GUI_EXPORT int qt_defaultDpiY(); + int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const { if (!cfbsBitmap) @@ -611,28 +614,18 @@ int QS60PixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const return cfbsBitmap->SizeInPixels().iWidth; case QPaintDevice::PdmHeight: return cfbsBitmap->SizeInPixels().iHeight; - case QPaintDevice::PdmWidthMM: { - TInt twips = cfbsBitmap->SizeInTwips().iWidth; - return (int)(twips * (25.4/KTwipsPerInch)); - } - case QPaintDevice::PdmHeightMM: { - TInt twips = cfbsBitmap->SizeInTwips().iHeight; - return (int)(twips * (25.4/KTwipsPerInch)); - } + case QPaintDevice::PdmWidthMM: + return qRound(cfbsBitmap->SizeInPixels().iWidth * 25.4 / qt_defaultDpiX()); + case QPaintDevice::PdmHeightMM: + return qRound(cfbsBitmap->SizeInPixels().iHeight * 25.4 / qt_defaultDpiY()); case QPaintDevice::PdmNumColors: return TDisplayModeUtils::NumDisplayModeColors(cfbsBitmap->DisplayMode()); case QPaintDevice::PdmDpiX: - case QPaintDevice::PdmPhysicalDpiX: { - TReal inches = cfbsBitmap->SizeInTwips().iWidth / (TReal)KTwipsPerInch; - TInt pixels = cfbsBitmap->SizeInPixels().iWidth; - return pixels / inches; - } + case QPaintDevice::PdmPhysicalDpiX: + return qt_defaultDpiX(); case QPaintDevice::PdmDpiY: - case QPaintDevice::PdmPhysicalDpiY: { - TReal inches = cfbsBitmap->SizeInTwips().iHeight / (TReal)KTwipsPerInch; - TInt pixels = cfbsBitmap->SizeInPixels().iHeight; - return pixels / inches; - } + case QPaintDevice::PdmPhysicalDpiY: + return qt_defaultDpiY(); case QPaintDevice::PdmDepth: return TDisplayModeUtils::NumDisplayModeBitsPerPixel(cfbsBitmap->DisplayMode()); default: -- cgit v0.12 From cc994cf5a10a4ab31e37ae8712b9cd1b37878e79 Mon Sep 17 00:00:00 2001 From: Fabien Freling <fabien.freling@nokia.com> Date: Wed, 16 Mar 2011 13:45:42 +0100 Subject: Remove the check on flushRequested. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The check on flushRequested was needed since we were flushing the toolbar with the main window, but the flushing is now independent so we don't need it anymore. It is now making us skip some flushing. Reviewed-by: Samuel Rødal --- src/gui/kernel/qcocoaview_mac.mm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/kernel/qcocoaview_mac.mm b/src/gui/kernel/qcocoaview_mac.mm index 43eb072..54e7e3e 100644 --- a/src/gui/kernel/qcocoaview_mac.mm +++ b/src/gui/kernel/qcocoaview_mac.mm @@ -299,7 +299,7 @@ static int qCocoaViewCount = 0; } else { QUnifiedToolbarSurface *unifiedSurface = qwidgetprivate->unifiedSurface; - if (!unifiedSurface || !qwidgetprivate->flushRequested) { + if (!unifiedSurface) { qt_mac_release_graphics_context(context); return; } -- cgit v0.12 From d149125e0b539ff13f77cb2a67194ac3d6e331a0 Mon Sep 17 00:00:00 2001 From: Fabien Freling <fabien.freling@nokia.com> Date: Wed, 16 Mar 2011 13:53:30 +0100 Subject: Add an overloading function to flush(). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In the case of the unified toolbar, we don't need as much arguments for flush(). So we overload flush() to only take one argument, the widget. Reviewed-by: Samuel Rødal --- src/gui/painting/qunifiedtoolbarsurface_mac.cpp | 8 ++++++++ src/gui/painting/qunifiedtoolbarsurface_mac_p.h | 1 + 2 files changed, 9 insertions(+) diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp index 63364f3..9913c9a 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac.cpp +++ b/src/gui/painting/qunifiedtoolbarsurface_mac.cpp @@ -156,6 +156,14 @@ void QUnifiedToolbarSurface::updateToolbarOffset(QWidget *widget) mlayout->updateUnifiedToolbarOffset(); } +void QUnifiedToolbarSurface::flush(QWidget *widget, const QRegion ®ion, const QPoint &offset) +{ + Q_UNUSED(region); + Q_UNUSED(offset); + + this->flush(widget); +} + void QUnifiedToolbarSurface::flush(QWidget *widget) { Q_D(QUnifiedToolbarSurface); diff --git a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h index b0075b6..0a7ebf1 100644 --- a/src/gui/painting/qunifiedtoolbarsurface_mac_p.h +++ b/src/gui/painting/qunifiedtoolbarsurface_mac_p.h @@ -80,6 +80,7 @@ public: ~QUnifiedToolbarSurface(); void flush(QWidget *widget); + void flush(QWidget *widget, const QRegion ®ion, const QPoint &offset); void setGeometry(const QRect &rect); void beginPaint(const QRegion &rgn); void insertToolbar(QWidget *toolbar, const QPoint &offset); -- cgit v0.12 From d376a506cc25dc2beb5c88ded145bc5e807f9f85 Mon Sep 17 00:00:00 2001 From: Morten Sorvig <msorvig@trolltech.com> Date: Wed, 16 Mar 2011 12:19:45 +0100 Subject: Rename qnaclunimplemented -> qfunctions_nacl (Match the existing files for wince and vxworks.) --- mkspecs/qws/linux-nacl-g++/qplatformdefs.h | 2 + mkspecs/qws/macx-nacl-g++/qplatformdefs.h | 2 + src/corelib/global/global.pri | 4 - src/corelib/global/qglobal.h | 4 - src/corelib/global/qnaclunimplemented.cpp | 156 ----------------------------- src/corelib/global/qnaclunimplemented.h | 97 ------------------ src/corelib/kernel/kernel.pri | 7 ++ src/corelib/kernel/qfunctions_nacl.cpp | 156 +++++++++++++++++++++++++++++ src/corelib/kernel/qfunctions_nacl.h | 97 ++++++++++++++++++ src/corelib/kernel/qfunctions_p.h | 2 + 10 files changed, 266 insertions(+), 261 deletions(-) delete mode 100644 src/corelib/global/qnaclunimplemented.cpp delete mode 100644 src/corelib/global/qnaclunimplemented.h create mode 100644 src/corelib/kernel/qfunctions_nacl.cpp create mode 100644 src/corelib/kernel/qfunctions_nacl.h diff --git a/mkspecs/qws/linux-nacl-g++/qplatformdefs.h b/mkspecs/qws/linux-nacl-g++/qplatformdefs.h index 70572bf..ec8ca8f 100644 --- a/mkspecs/qws/linux-nacl-g++/qplatformdefs.h +++ b/mkspecs/qws/linux-nacl-g++/qplatformdefs.h @@ -59,6 +59,8 @@ #define PATH_MAX 256 #include "../../common/posix/qplatformdefs.h" +#include "qfunctions_nacl.h" +#include <pthread.h> #undef QT_LSTAT #define QT_LSTAT QT_STAT diff --git a/mkspecs/qws/macx-nacl-g++/qplatformdefs.h b/mkspecs/qws/macx-nacl-g++/qplatformdefs.h index f893238..05b133f 100644 --- a/mkspecs/qws/macx-nacl-g++/qplatformdefs.h +++ b/mkspecs/qws/macx-nacl-g++/qplatformdefs.h @@ -58,6 +58,8 @@ #define PATH_MAX 256 #include "../../common/posix/qplatformdefs.h" +#include "qfunctions_nacl.h" +#include <pthread.h> #undef QT_LSTAT #define QT_LSTAT QT_STAT diff --git a/src/corelib/global/global.pri b/src/corelib/global/global.pri index 83caa96..d80706a 100644 --- a/src/corelib/global/global.pri +++ b/src/corelib/global/global.pri @@ -13,10 +13,6 @@ SOURCES += \ global/qmalloc.cpp \ global/qnumeric.cpp -nacl { - SOURCES += global/qnaclunimplemented.cpp -} - # qlibraryinfo.cpp includes qconfig.cpp INCLUDEPATH += $$QT_BUILD_TREE/src/corelib/global diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index 1879537..0bcaeb5 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -2714,10 +2714,6 @@ QT_LICENSED_MODULE(DBus) # define QT_NO_PROCESS #endif -#ifdef Q_OS_NACL -#include <QtCore/qnaclunimplemented.h> -#endif - #if defined (__ELF__) # if defined (Q_OS_LINUX) || defined (Q_OS_SOLARIS) || defined (Q_OS_FREEBSD) || defined (Q_OS_OPENBSD) || defined (Q_OS_IRIX) # define Q_OF_ELF diff --git a/src/corelib/global/qnaclunimplemented.cpp b/src/corelib/global/qnaclunimplemented.cpp deleted file mode 100644 index 1a89b8df..0000000 --- a/src/corelib/global/qnaclunimplemented.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "qnaclunimplemented.h" -#include <pthread.h> -#include <qglobal.h> - -/* - The purpose of this file is to stub out certain functions - that are not provided by the Native Client SDK. This is - done as an alterative to sprinkling the Qt sources with - NACL ifdefs. - - There are two main classes of functions: - - - Functions that are called but can have no effect: - For these we simply give an empty implementation - - - Functions that are referenced in the source code, but - is not/must not be called at run-time: - These we either leave undefined or implement with a - qFatal. - - This is a work in progress. -*/ - -extern "C" { - -void pthread_cleanup_push(void (*)(void *), void *) -{ - -} - -void pthread_cleanup_pop(int) -{ - -} - -int pthread_setcancelstate(int, int *) -{ - return 0; -} - -int pthread_setcanceltype(int, int *) -{ - return 0; -} - -void pthread_testcancel(void) -{ - -} - - -int pthread_cancel(pthread_t) -{ - return 0; -} - -int pthread_attr_setinheritsched(pthread_attr_t *,int) -{ - return 0; -} - - -int pthread_attr_getinheritsched(const pthread_attr_t *, int *) -{ - return 0; -} - -// event dispatcher, select -//struct fd_set; -//struct timeval; - -int fcntl(int, int, ...) -{ - return 0; -} - -int sigaction(int, const struct sigaction *, struct sigaction *) -{ - return 0; -} - -int open(const char *, int, ...) -{ - return 0; -} - -int open64(const char *, int, ...) -{ - return 0; -} - -int access(const char *, int) -{ - return 0; -} - -typedef long off64_t; -off64_t ftello64(void *) -{ - qFatal("ftello64 called"); - return 0; -} - -off64_t lseek64(int, off_t, int) -{ - qFatal("lseek64 called"); - return 0; -} - -} // Extern C - -int select(int, fd_set *, fd_set *, fd_set *, struct timeval *) -{ - return 0; -} diff --git a/src/corelib/global/qnaclunimplemented.h b/src/corelib/global/qnaclunimplemented.h deleted file mode 100644 index 921667e..0000000 --- a/src/corelib/global/qnaclunimplemented.h +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. -** Contact: Nokia Corporation (qt-info@nokia.com) -** -** This file is part of the QtCore module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** No Commercial Usage -** This file contains pre-release code and may not be distributed. -** You may use this file in accordance with the terms and conditions -** contained in the Technology Preview License Agreement accompanying -** this package. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 2.1 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 2.1 requirements -** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** If you have questions regarding the use of this file, please contact -** Nokia at qt-info@nokia.com. -** -** -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef QNACLUNIMPLEMENTED_H -#define QNACLUNIMPLEMENTED_H - -#ifdef Q_OS_NACL - -#include <sys/types.h> - -// pthread -#include <pthread.h> -#define PTHREAD_CANCEL_DISABLE 1 -#define PTHREAD_CANCEL_ENABLE 2 -#define PTHREAD_INHERIT_SCHED 3 - -QT_BEGIN_HEADER - -QT_BEGIN_NAMESPACE - -QT_MODULE(Core) - -extern "C" { - -void pthread_cleanup_push(void (*handler)(void *), void *arg); -void pthread_cleanup_pop(int execute); - -int pthread_setcancelstate(int state, int *oldstate); -int pthread_setcanceltype(int type, int *oldtype); -void pthread_testcancel(void); -int pthread_cancel(pthread_t thread); - -int pthread_attr_setinheritsched(pthread_attr_t *attr, - int inheritsched); -int pthread_attr_getinheritsched(const pthread_attr_t *attr, - int *inheritsched); - -// event dispatcher, select -//struct fd_set; -//struct timeval; -int fcntl(int fildes, int cmd, ...); -int sigaction(int sig, const struct sigaction * act, struct sigaction * oact); - -typedef long off64_t; -off64_t ftello64(void *stream); -off64_t lseek64(int fildes, off_t offset, int whence); -int open64(const char *path, int oflag, ...); - -} - -int select(int nfds, fd_set * readfds, fd_set * writefds, fd_set * errorfds, struct timeval * timeout); - -QT_END_NAMESPACE - -QT_END_HEADER - -#endif //Q_OS_NACL - -#endif //QNACLUNIMPLEMENTED_H diff --git a/src/corelib/kernel/kernel.pri b/src/corelib/kernel/kernel.pri index c3a6721..a3628b1 100644 --- a/src/corelib/kernel/kernel.pri +++ b/src/corelib/kernel/kernel.pri @@ -90,6 +90,13 @@ mac:!nacl { kernel/qcore_mac.cpp } +nacl { + SOURCES += \ + kernel/qfunctions_nacl.cpp + HEADERS += \ + kernel/qfunctions_nacl.h +} + unix:!symbian { SOURCES += \ kernel/qcore_unix.cpp \ diff --git a/src/corelib/kernel/qfunctions_nacl.cpp b/src/corelib/kernel/qfunctions_nacl.cpp new file mode 100644 index 0000000..bc14cf0 --- /dev/null +++ b/src/corelib/kernel/qfunctions_nacl.cpp @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "qfunctions_nacl.h" +#include <pthread.h> +#include <qglobal.h> + +/* + The purpose of this file is to stub out certain functions + that are not provided by the Native Client SDK. This is + done as an alterative to sprinkling the Qt sources with + NACL ifdefs. + + There are two main classes of functions: + + - Functions that are called but can have no effect: + For these we simply give an empty implementation + + - Functions that are referenced in the source code, but + is not/must not be called at run-time: + These we either leave undefined or implement with a + qFatal. + + This is a work in progress. +*/ + +extern "C" { + +void pthread_cleanup_push(void (*)(void *), void *) +{ + +} + +void pthread_cleanup_pop(int) +{ + +} + +int pthread_setcancelstate(int, int *) +{ + return 0; +} + +int pthread_setcanceltype(int, int *) +{ + return 0; +} + +void pthread_testcancel(void) +{ + +} + + +int pthread_cancel(pthread_t) +{ + return 0; +} + +int pthread_attr_setinheritsched(pthread_attr_t *,int) +{ + return 0; +} + + +int pthread_attr_getinheritsched(const pthread_attr_t *, int *) +{ + return 0; +} + +// event dispatcher, select +//struct fd_set; +//struct timeval; + +int fcntl(int, int, ...) +{ + return 0; +} + +int sigaction(int, const struct sigaction *, struct sigaction *) +{ + return 0; +} + +int open(const char *, int, ...) +{ + return 0; +} + +int open64(const char *, int, ...) +{ + return 0; +} + +int access(const char *, int) +{ + return 0; +} + +typedef long off64_t; +off64_t ftello64(void *) +{ + qFatal("ftello64 called"); + return 0; +} + +off64_t lseek64(int, off_t, int) +{ + qFatal("lseek64 called"); + return 0; +} + +} // Extern C + +int select(int, fd_set *, fd_set *, fd_set *, struct timeval *) +{ + return 0; +} diff --git a/src/corelib/kernel/qfunctions_nacl.h b/src/corelib/kernel/qfunctions_nacl.h new file mode 100644 index 0000000..921667e --- /dev/null +++ b/src/corelib/kernel/qfunctions_nacl.h @@ -0,0 +1,97 @@ +/**************************************************************************** +** +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtCore module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef QNACLUNIMPLEMENTED_H +#define QNACLUNIMPLEMENTED_H + +#ifdef Q_OS_NACL + +#include <sys/types.h> + +// pthread +#include <pthread.h> +#define PTHREAD_CANCEL_DISABLE 1 +#define PTHREAD_CANCEL_ENABLE 2 +#define PTHREAD_INHERIT_SCHED 3 + +QT_BEGIN_HEADER + +QT_BEGIN_NAMESPACE + +QT_MODULE(Core) + +extern "C" { + +void pthread_cleanup_push(void (*handler)(void *), void *arg); +void pthread_cleanup_pop(int execute); + +int pthread_setcancelstate(int state, int *oldstate); +int pthread_setcanceltype(int type, int *oldtype); +void pthread_testcancel(void); +int pthread_cancel(pthread_t thread); + +int pthread_attr_setinheritsched(pthread_attr_t *attr, + int inheritsched); +int pthread_attr_getinheritsched(const pthread_attr_t *attr, + int *inheritsched); + +// event dispatcher, select +//struct fd_set; +//struct timeval; +int fcntl(int fildes, int cmd, ...); +int sigaction(int sig, const struct sigaction * act, struct sigaction * oact); + +typedef long off64_t; +off64_t ftello64(void *stream); +off64_t lseek64(int fildes, off_t offset, int whence); +int open64(const char *path, int oflag, ...); + +} + +int select(int nfds, fd_set * readfds, fd_set * writefds, fd_set * errorfds, struct timeval * timeout); + +QT_END_NAMESPACE + +QT_END_HEADER + +#endif //Q_OS_NACL + +#endif //QNACLUNIMPLEMENTED_H diff --git a/src/corelib/kernel/qfunctions_p.h b/src/corelib/kernel/qfunctions_p.h index 3d41c0c..d27fec3 100644 --- a/src/corelib/kernel/qfunctions_p.h +++ b/src/corelib/kernel/qfunctions_p.h @@ -59,6 +59,8 @@ # include "QtCore/qfunctions_wince.h" #elif defined(Q_OS_VXWORKS) # include "QtCore/qfunctions_vxworks.h" +#elif defined(Q_OS_NACL) +# include "QtCore/qfunctions_nacl.h" #endif #ifdef Q_CC_RVCT -- cgit v0.12 From ce8fd88984f3da545de8132b6094ed519bdbaa11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Wed, 16 Mar 2011 15:10:01 +0100 Subject: Lighthouse: Add pkg-config check for opengl es2 --- configure | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/configure b/configure index 2ea3689..bf9d0b4 100755 --- a/configure +++ b/configure @@ -6134,7 +6134,16 @@ if [ "$PLATFORM_QPA" = "yes" ]; then fi elif [ "$CFG_OPENGL" = "es2" ]; then #OpenGL ES 2.x - "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS + if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists glesv2 2>/dev/null; then + QMAKE_INCDIR_OPENGL_ES2=`$PKG_CONFIG --variable=includedir glesv2 2>/dev/null` + QMAKE_LIBDIR_OPENGL_ES2=`$PKG_CONFIG --variable=libdir glesv2 2>/dev/null` + QMAKE_LIBS_OPENGL_ES2=`$PKG_CONFIG --libs glesv2 2>/dev/null` + QMakeVar set QMAKE_INCDIR_OPENGL_ES2 "$QMAKE_INCDIR_OPENGL_ES2" + QMakeVar set QMAKE_LIBDIR_OPENGL_ES2 "$QMAKE_LIBDIR_OPENGL_ES2" + QMakeVar set QMAKE_LIBS_OPENGL_ES2 "$QMAKE_LIBS_OPENGL_ES2" + fi + + "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/opengles2 "OpenGL ES 2.x" $L_FLAGS $I_FLAGS $l_FLAGS -I$QMAKE_INCDIR_OPENGL_ES2 $QMAKE_LIBS_OPENGL_ES2 -L$QMAKE_LIBDIR_OPENGL_ES2 if [ $? != "0" ]; then echo "The OpenGL ES 2.0 functionality test failed!" echo " You might need to modify the include and library search paths by editing" -- cgit v0.12 From f2f545a37982e44c3a9e614b64bf484294c13756 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Wed, 16 Mar 2011 15:11:40 +0100 Subject: Lighthouse: Make sure we don't use xkbcommon when we don't have it --- configure | 18 ++++++++++++++---- mkspecs/common/linux.conf | 3 ++- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/configure b/configure index bf9d0b4..a71dd31 100755 --- a/configure +++ b/configure @@ -6181,10 +6181,18 @@ if [ "$PLATFORM_QPA" = "yes" ]; then fi - if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists wayland-client xkbcommon 2>/dev/null; then - QMAKE_CFLAGS_WAYLAND=`$PKG_CONFIG --cflags wayland-client xkbcommon 2>/dev/null` - QMAKE_LIBS_WAYLAND=`$PKG_CONFIG --libs wayland-client xkbcommon 2>/dev/null` - QMAKE_INCDIR_WAYLAND=`$PKG_CONFIG --variable=includedir wayland-client xkbcommon 2>/dev/null` + if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists wayland-client 2>/dev/null; then + QMAKE_CFLAGS_WAYLAND=`$PKG_CONFIG --cflags wayland-client 2>/dev/null` + QMAKE_LIBS_WAYLAND=`$PKG_CONFIG --libs wayland-client 2>/dev/null` + QMAKE_INCDIR_WAYLAND=`$PKG_CONFIG --variable=includedir wayland-client 2>/dev/null` + QMAKE_LIBDIR_WAYLAND=`$PKG_CONFIG --variable=libdir wayland-client 2>/dev/null` + + if [ -n "$PKG_CONFIG" ] && $PKG_CONFIG --exists xkbcommon 2>/dev/null; then + QMAKE_CFLAGS_WAYLAND=$QMAKE_CFLAGS_WAYLAND `$PKG_CONFIG --cflags xkbcommon 2>/dev/null` + QMAKE_LIBS_WAYLAND=$QMAKE_LIBS_WAYLAND `$PKG_CONFIG --libs xkbcommon 2>/dev/null` + else + QMAKE_DEFINES_WAYLAND=QT_NO_WAYLAND_XKB + fi fi # QMake variables set here override those in the mkspec. Therefore we only set the variables here if they are not zero. @@ -6192,6 +6200,8 @@ if [ "$PLATFORM_QPA" = "yes" ]; then QMakeVar set QMAKE_CFLAGS_WAYLAND "$QMAKE_CFLAGS_WAYLAND" QMakeVar set QMAKE_INCDIR_WAYLAND "$QMAKE_INCDIR_WAYLAND" QMakeVar set QMAKE_LIBS_WAYLAND "$QMAKE_LIBS_WAYLAND" + QMakeVar set QMAKE_LIBDIR_WAYLAND "$QMAKE_LIBDIR_WAYLAND" + QMakeVar set QMAKE_DEFINES_WAYLAND " $QMAKE_DEFINES_WAYLAND" fi if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/qpa/wayland "Wayland" $L_FLAGS $I_FLAGS $l_FLAGS $QMAKE_CFLAGS_WAYLAND -I$QMAKE_INCDIR_WAYLAND $QMAKE_LIBS_WAYLAND; then diff --git a/mkspecs/common/linux.conf b/mkspecs/common/linux.conf index 283cf83..d60533e 100644 --- a/mkspecs/common/linux.conf +++ b/mkspecs/common/linux.conf @@ -37,7 +37,8 @@ QMAKE_LIBS_THREAD = -lpthread QMAKE_CFLAGS_WAYLAND = QMAKE_INCDIR_WAYLAND = -QMAKE_LIBS_WAYLAND = -lwayland-client -lxkbcommon +QMAKE_LIBS_WAYLAND = +QMAKE_LIBDIR_WAYLAND = QMAKE_DEFINES_WAYLAND = QMAKE_MOC = $$[QT_INSTALL_BINS]/moc -- cgit v0.12 From f3ec9966ab23d1c4e56e17e593b99165364612ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Wed, 16 Mar 2011 15:52:07 +0100 Subject: Lighthouse: Xcb, compile fix for the glx path --- src/plugins/platforms/xcb/qxcbconnection.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index da60311..5a6bef7 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -443,10 +443,12 @@ void QXcbConnection::initializeAllAtoms() { m_allAtoms[i] = xcb_intern_atom_reply(xcb_connection(), cookies[i], 0)->atom; } +#if defined(XCB_USE_EGL) bool QXcbConnection::hasEgl() const { return m_has_egl; } +#endif // defined(XCB_USE_EGL) #ifdef XCB_USE_DRI2 void QXcbConnection::initializeDri2() -- cgit v0.12 From 50c0c6a032ef2c0af8c93f52f5c2f86ca145e852 Mon Sep 17 00:00:00 2001 From: Yann Bodson <yann.bodson@nokia.com> Date: Thu, 17 Mar 2011 14:41:40 +1000 Subject: Re-enable lineHeight tests. These tests were disabled by 24d8e96624af91ab01a20c10625858300f16099b Change-Id: I5bf3e11dfb3c975415c3039b39a39c22984d2900 --- tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp index 2d52642..581b58c 100644 --- a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -1206,13 +1206,13 @@ void tst_qdeclarativetext::lineHeight() myText->setLineHeightMode(QDeclarativeText::ProportionalHeight); myText->setLineHeight(1.0); - //qreal h2 = myText->height(); + qreal h2 = myText->height(); myText->setLineHeight(2.0); - //QVERIFY(myText->height() == h2 * 2.0); + QVERIFY(myText->height() == h2 * 2.0); myText->setLineHeightMode(QDeclarativeText::FixedHeight); myText->setLineHeight(10); - //QCOMPARE(myText->height(), myText->lineCount() * 10.0); + QCOMPARE(myText->height(), myText->lineCount() * 10.0); delete canvas; } -- cgit v0.12 From 82a53835a71a8e1902774c67e792bf6d7d6385de Mon Sep 17 00:00:00 2001 From: Martin Jones <martin.jones@nokia.com> Date: Thu, 17 Mar 2011 14:24:50 +1000 Subject: QDeclarativeView flickers when composited on MeeGo Set Qt::WA_OpaquePaintEvent and Qt::WA_NoSystemBackground for QDeclarativeView on meego. Change-Id: I301d2381ae831485d205ff42b0c15b3fa7a73424 Task-number: QTBUG-17173 Reviewed-by: Michael Brasser --- doc/src/declarative/qdeclarativeperformance.qdoc | 11 +++++++++++ src/declarative/declarative.pro | 2 ++ src/declarative/util/qdeclarativeview.cpp | 7 +++++++ 3 files changed, 20 insertions(+) diff --git a/doc/src/declarative/qdeclarativeperformance.qdoc b/doc/src/declarative/qdeclarativeperformance.qdoc index 36b4878..6760869 100644 --- a/doc/src/declarative/qdeclarativeperformance.qdoc +++ b/doc/src/declarative/qdeclarativeperformance.qdoc @@ -136,4 +136,15 @@ The QML Viewer uses the raster graphics system by default for X11 and OS X. It a includes a \c -opengl command line option which sets a QGLWidget as the viewport of the view. On OS X, a QGLWidget is always used. +You can also prevent QDeclarativeView from painting its window background if +you will provide the background of your application using QML, e.g. + +\code +QDeclarativeView window; +window.setAttribute(Qt::WA_OpaquePaintEvent); +window.setAttribute(Qt::WA_NoSystemBackground); +window.viewport()->setAttribute(Qt::WA_OpaquePaintEvent); +window.viewport()->setAttribute(Qt::WA_NoSystemBackground); +\endcode + */ diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro index 1ad888b..f3a7db9 100644 --- a/src/declarative/declarative.pro +++ b/src/declarative/declarative.pro @@ -29,6 +29,8 @@ symbian: { LIBS += -lefsrv } +linux-g++-maemo:DEFINES += QDECLARATIVEVIEW_NOBACKGROUND + DEFINES += QT_NO_OPENTYPE INCLUDEPATH += ../3rdparty/harfbuzz/src diff --git a/src/declarative/util/qdeclarativeview.cpp b/src/declarative/util/qdeclarativeview.cpp index c2e5efe..13880c2 100644 --- a/src/declarative/util/qdeclarativeview.cpp +++ b/src/declarative/util/qdeclarativeview.cpp @@ -293,6 +293,13 @@ void QDeclarativeViewPrivate::init() q->setFocusPolicy(Qt::StrongFocus); q->scene()->setStickyFocus(true); //### needed for correct focus handling + +#ifdef QDECLARATIVEVIEW_NOBACKGROUND + q->setAttribute(Qt::WA_OpaquePaintEvent); + q->setAttribute(Qt::WA_NoSystemBackground); + q->viewport()->setAttribute(Qt::WA_OpaquePaintEvent); + q->viewport()->setAttribute(Qt::WA_NoSystemBackground); +#endif } /*! -- cgit v0.12 From cb0b93e3ef107b8a47445c926753b6bcf07b796d Mon Sep 17 00:00:00 2001 From: Yann Bodson <yann.bodson@nokia.com> Date: Thu, 17 Mar 2011 16:12:29 +1000 Subject: Doc improvement for Image.fillMode. Change-Id: I2aec2c9fae07a8551001b2c7d5f5ab8da0fbb7df Task-number: QTBUG-14899 --- src/declarative/graphicsitems/qdeclarativeimage.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index 2c9bde5..ec20200 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -147,8 +147,8 @@ void QDeclarativeImagePrivate::setPixmap(const QPixmap &pixmap) /*! \qmlproperty enumeration Image::fillMode - Set this property to define what happens when the image set for the item is smaller - than the size of the item. + Set this property to define what happens when the source image has a different size + than the item. \list \o Image.Stretch - the image is scaled to fit @@ -234,6 +234,9 @@ void QDeclarativeImagePrivate::setPixmap(const QPixmap &pixmap) \endtable + Note that \c clip is \c false by default which means that the element might + paint outside its bounding rectangle even if the fillMode is set to \c PreserveAspectCrop. + \sa {declarative/imageelements/image}{Image example} */ QDeclarativeImage::FillMode QDeclarativeImage::fillMode() const -- cgit v0.12 From 695a39410c8ce186a2ce78cef51093c55fc32643 Mon Sep 17 00:00:00 2001 From: Martin Jones <martin.jones@nokia.com> Date: Thu, 17 Mar 2011 17:10:56 +1000 Subject: Image.PreserveAspectFit has unexpected effect on Image's sourceSize The sourceSize should always be the size of the image, unless set otherwise. When calculating the size of an image with Image.PreserveAspectFit set the natural image size should be used for the calculation if no size has been set explicitly. Change-Id: I104b7d1c3c16aa5b4fc98b1f9078ed8ae997cf69 Task-number: QTBUG-16389 Reviewed-by: Joona Petrell --- .../graphicsitems/qdeclarativeimage.cpp | 10 +++++--- .../graphicsitems/qdeclarativeimagebase.cpp | 2 +- .../qdeclarativeimage/data/qtbug_16389.qml | 30 ++++++++++++++++++++++ .../qdeclarativeimage/tst_qdeclarativeimage.cpp | 24 +++++++++++++++++ 4 files changed, 61 insertions(+), 5 deletions(-) create mode 100644 tests/auto/declarative/qdeclarativeimage/data/qtbug_16389.qml diff --git a/src/declarative/graphicsitems/qdeclarativeimage.cpp b/src/declarative/graphicsitems/qdeclarativeimage.cpp index ec20200..ed5d5fc 100644 --- a/src/declarative/graphicsitems/qdeclarativeimage.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimage.cpp @@ -389,14 +389,16 @@ void QDeclarativeImage::updatePaintedGeometry() if (d->fillMode == PreserveAspectFit) { if (!d->pix.width() || !d->pix.height()) return; - qreal widthScale = width() / qreal(d->pix.width()); - qreal heightScale = height() / qreal(d->pix.height()); + qreal w = widthValid() ? width() : d->pix.width(); + qreal widthScale = w / qreal(d->pix.width()); + qreal h = heightValid() ? height() : d->pix.height(); + qreal heightScale = h / qreal(d->pix.height()); if (widthScale <= heightScale) { - d->paintedWidth = width(); + d->paintedWidth = w; d->paintedHeight = widthScale * qreal(d->pix.height()); } else if(heightScale < widthScale) { d->paintedWidth = heightScale * qreal(d->pix.width()); - d->paintedHeight = height(); + d->paintedHeight = h; } if (widthValid() && !heightValid()) { setImplicitHeight(d->paintedHeight); diff --git a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp index 471c87f..2de3ba0 100644 --- a/src/declarative/graphicsitems/qdeclarativeimagebase.cpp +++ b/src/declarative/graphicsitems/qdeclarativeimagebase.cpp @@ -130,7 +130,7 @@ QSize QDeclarativeImageBase::sourceSize() const int width = d->sourcesize.width(); int height = d->sourcesize.height(); - return QSize(width != -1 ? width : implicitWidth(), height != -1 ? height : implicitHeight()); + return QSize(width != -1 ? width : d->pix.width(), height != -1 ? height : d->pix.height()); } bool QDeclarativeImageBase::cache() const diff --git a/tests/auto/declarative/qdeclarativeimage/data/qtbug_16389.qml b/tests/auto/declarative/qdeclarativeimage/data/qtbug_16389.qml new file mode 100644 index 0000000..29fba40 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeimage/data/qtbug_16389.qml @@ -0,0 +1,30 @@ +import QtQuick 1.0 +Rectangle { + width: 400 + height: 400 + + Item { + anchors.top: parent.top + anchors.left: parent.left + anchors.bottom: blueHandle.top + anchors.right: blueHandle.left + + Image { + id: iconImage + objectName: "iconImage" + anchors.top: parent.top + anchors.bottom: parent.bottom + source: "heart200.png" + fillMode: Image.PreserveAspectFit + smooth: true + } + } + + Rectangle { + id: blueHandle + objectName: "blueHandle" + color: "blue" + width: 25 + height: 25 + } +} diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp index f1fe2bd..9e090d2 100644 --- a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -89,6 +89,7 @@ private slots: void noLoading(); void paintedWidthHeight(); void sourceSize_QTBUG_14303(); + void sourceSize_QTBUG_16389(); void nullPixmapPaint(); void testQtQuick11Attributes(); void testQtQuick11Attributes_data(); @@ -640,6 +641,29 @@ void tst_qdeclarativeimage::sourceSize_QTBUG_14303() QTRY_COMPARE(sourceSizeSpy.count(), 2); } +void tst_qdeclarativeimage::sourceSize_QTBUG_16389() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/qtbug_16389.qml")); + canvas->show(); + qApp->processEvents(); + + QDeclarativeImage *image = findItem<QDeclarativeImage>(canvas->rootObject(), "iconImage"); + QDeclarativeItem *handle = findItem<QDeclarativeItem>(canvas->rootObject(), "blueHandle"); + + QCOMPARE(image->sourceSize().width(), 200); + QCOMPARE(image->sourceSize().height(), 200); + QCOMPARE(image->paintedWidth(), 0.0); + QCOMPARE(image->paintedHeight(), 0.0); + + handle->setY(20); + + QCOMPARE(image->sourceSize().width(), 200); + QCOMPARE(image->sourceSize().height(), 200); + QCOMPARE(image->paintedWidth(), 20.0); + QCOMPARE(image->paintedHeight(), 20.0); +} + static int numberOfWarnings = 0; static void checkWarnings(QtMsgType, const char *) { -- cgit v0.12 From ac704e9f682378a5ec56e3f5c195dcf2f2dfa1ac Mon Sep 17 00:00:00 2001 From: Martin Jones <martin.jones@nokia.com> Date: Thu, 17 Mar 2011 18:01:50 +1000 Subject: PathView doesn't update if preferred highlight range changes. Simply call refill() when they change. Change-Id: I45ab56cbcaf5c726ce4c4f23f66ee687a6d89dad Task-number: QTBUG-15356 Reviewed-by: Kevin Wu Won --- .../graphicsitems/qdeclarativepathview.cpp | 2 ++ .../qdeclarativepathview/data/dragpath.qml | 2 +- .../tst_qdeclarativepathview.cpp | 40 ++++++++++++++++++++++ 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/src/declarative/graphicsitems/qdeclarativepathview.cpp b/src/declarative/graphicsitems/qdeclarativepathview.cpp index 4e401e9..778b8b9 100644 --- a/src/declarative/graphicsitems/qdeclarativepathview.cpp +++ b/src/declarative/graphicsitems/qdeclarativepathview.cpp @@ -796,6 +796,7 @@ void QDeclarativePathView::setPreferredHighlightBegin(qreal start) return; d->highlightRangeStart = start; d->haveHighlightRange = d->highlightRangeMode != NoHighlightRange && d->highlightRangeStart <= d->highlightRangeEnd; + refill(); emit preferredHighlightBeginChanged(); } @@ -812,6 +813,7 @@ void QDeclarativePathView::setPreferredHighlightEnd(qreal end) return; d->highlightRangeEnd = end; d->haveHighlightRange = d->highlightRangeMode != NoHighlightRange && d->highlightRangeStart <= d->highlightRangeEnd; + refill(); emit preferredHighlightEndChanged(); } diff --git a/tests/auto/declarative/qdeclarativepathview/data/dragpath.qml b/tests/auto/declarative/qdeclarativepathview/data/dragpath.qml index a361bdc..0f94840 100644 --- a/tests/auto/declarative/qdeclarativepathview/data/dragpath.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/dragpath.qml @@ -9,7 +9,7 @@ PathView { startX: 0; startY: 100 PathLine { x: 400; y: 100 } } - delegate: Rectangle { height: 100; width: 1; color: PathView.isCurrentItem?"red" : "black" } + delegate: Rectangle { objectName: "wrapper"; height: 100; width: 2; color: PathView.isCurrentItem?"red" : "black" } dragMargin: 100 preferredHighlightBegin: 0.5 preferredHighlightEnd: 0.5 diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp index ebb5f98..8000137 100644 --- a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -111,6 +111,7 @@ private slots: void undefinedPath(); void mouseDrag(); void treeModel(); + void changePreferredHighlight(); private: QDeclarativeView *createView(); @@ -948,6 +949,45 @@ void tst_QDeclarativePathView::treeModel() delete canvas; } +void tst_QDeclarativePathView::changePreferredHighlight() +{ + QDeclarativeView *canvas = createView(); + canvas->setFixedSize(400,200); + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/dragpath.qml")); + canvas->show(); + QApplication::setActiveWindow(canvas); + QTest::qWaitForWindowShown(canvas); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(canvas)); + + QDeclarativePathView *pathview = qobject_cast<QDeclarativePathView*>(canvas->rootObject()); + QVERIFY(pathview != 0); + + int current = pathview->currentIndex(); + QCOMPARE(current, 0); + + QDeclarativeRectangle *firstItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", 0); + QVERIFY(firstItem); + QDeclarativePath *path = qobject_cast<QDeclarativePath*>(pathview->path()); + QVERIFY(path); + QPointF start = path->pointAt(0.5); + start.setX(qRound(start.x())); + start.setY(qRound(start.y())); + QPointF offset;//Center of item is at point, but pos is from corner + offset.setX(firstItem->width()/2); + offset.setY(firstItem->height()/2); + QTRY_COMPARE(firstItem->pos() + offset, start); + + pathview->setPreferredHighlightBegin(0.8); + pathview->setPreferredHighlightEnd(0.8); + start = path->pointAt(0.8); + start.setX(qRound(start.x())); + start.setY(qRound(start.y())); + QTRY_COMPARE(firstItem->pos() + offset, start); + QCOMPARE(pathview->currentIndex(), 0); + + delete canvas; +} + QDeclarativeView *tst_QDeclarativePathView::createView() { QDeclarativeView *canvas = new QDeclarativeView(0); -- cgit v0.12 From 58548add6d3ff7c09db0573abdba4d006a10bad1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <samuel.rodal@nokia.com> Date: Wed, 16 Mar 2011 10:45:16 +0100 Subject: Don't skip remaining events on unhandled events in xcb backend. --- src/plugins/platforms/xcb/qxcbconnection.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index 5a6bef7..de3f926 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -216,6 +216,7 @@ void printXcbEvent(const char *message, xcb_generic_event_t *event) void QXcbConnection::eventDispatcher() { while (xcb_generic_event_t *event = xcb_poll_for_event(xcb_connection())) { + bool handled = true; switch (event->response_type & ~0x80) { case XCB_EXPOSE: HANDLE_PLATFORM_WINDOW_EVENT(xcb_expose_event_t, window, handleExposeEvent); @@ -245,10 +246,13 @@ void QXcbConnection::eventDispatcher() m_keyboard->handleMappingNotifyEvent((xcb_mapping_notify_event_t *)event); break; default: - printXcbEvent("Unhandled XCB event", event); + handled = false; return; } - printXcbEvent("Handled XCB event", event); + if (handled) + printXcbEvent("Handled XCB event", event); + else + printXcbEvent("Unhandled XCB event", event); } } -- cgit v0.12 From 64f06b90f58a3f88482e116fa36f2b26acd82b0b Mon Sep 17 00:00:00 2001 From: Morten Sorvig <msorvig@trolltech.com> Date: Thu, 17 Mar 2011 12:22:26 +0100 Subject: Mac: add autorelease pools to create_sys Fixes a couple of on-startup leaks. --- src/gui/kernel/qwidget_mac.mm | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/kernel/qwidget_mac.mm b/src/gui/kernel/qwidget_mac.mm index 14a90ef..34918e4 100644 --- a/src/gui/kernel/qwidget_mac.mm +++ b/src/gui/kernel/qwidget_mac.mm @@ -2476,6 +2476,8 @@ void QWidgetPrivate::createWindow_sys() void QWidgetPrivate::create_sys(WId window, bool initializeWindow, bool destroyOldWindow) { Q_Q(QWidget); + QMacCocoaAutoReleasePool pool; + OSViewRef destroyid = 0; #ifndef QT_MAC_USE_COCOA window_event = 0; @@ -4423,6 +4425,8 @@ void QWidgetPrivate::adjustWithinMaxAndMinSize(int &w, int &h) void QWidgetPrivate::applyMaxAndMinSizeOnWindow() { Q_Q(QWidget); + QMacCocoaAutoReleasePool pool; + const float max_f(20000); #ifndef QT_MAC_USE_COCOA #define SF(x) ((x > max_f) ? max_f : x) -- cgit v0.12 From 2ba58fc0a36a30d19e46f9c012598958f98c2e33 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Thu, 17 Mar 2011 12:23:51 +0100 Subject: Clipboard/Windows: Fix a hang when sending to non-responsive clients. Check if clipboard viewer is responsive before sending the contents. This prevents Qt Creator from hanging when copying text while a debugging session with a crashed/stopped debuggee is in progress. Reviewed-by: Prasanth Ullattil <prasanth.ullattil@nokia.com> Task-number: QTBUG-17465 --- src/gui/kernel/qclipboard_win.cpp | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/gui/kernel/qclipboard_win.cpp b/src/gui/kernel/qclipboard_win.cpp index 52b9663..ea41165 100644 --- a/src/gui/kernel/qclipboard_win.cpp +++ b/src/gui/kernel/qclipboard_win.cpp @@ -52,6 +52,7 @@ #include "qt_windows.h" #include "qdnd_p.h" #include <private/qwidget_p.h> +#include <private/qsystemlibrary_p.h> QT_BEGIN_NAMESPACE @@ -70,6 +71,9 @@ void QtCeFlushClipboard(); #endif +typedef BOOL (WINAPI *PtrIsHungAppWindow)(HWND); + +static PtrIsHungAppWindow ptrIsHungAppWindow = 0; class QClipboardWatcher : public QInternalMimeData { public: @@ -327,9 +331,16 @@ bool QClipboard::event(QEvent *e) d->releaseIData(); propagate = true; } - if (propagate && d->nextClipboardViewer) { - SendMessage(d->nextClipboardViewer, m->message, m->wParam, m->lParam); + if (ptrIsHungAppWindow == 0) { + QSystemLibrary library(QLatin1String("User32")); + ptrIsHungAppWindow = (PtrIsHungAppWindow)library.resolve("IsHungAppWindow"); + } + if (ptrIsHungAppWindow && ptrIsHungAppWindow(d->nextClipboardViewer)) { + qWarning("%s: Cowardly refusing to send clipboard message to hung application...", Q_FUNC_INFO); + } else { + SendMessage(d->nextClipboardViewer, m->message, m->wParam, m->lParam); + } } return true; -- cgit v0.12 From b9b1d0c5ae9ff9a8799616acd7165565afbd2337 Mon Sep 17 00:00:00 2001 From: aavit <qt-info@nokia.com> Date: Thu, 17 Mar 2011 11:16:16 +0100 Subject: Fixes: some text fields in PNG image files were not read Text chunks placed after the real image data (IDAT chunks) were ignored. Reviewed-by: Kim --- src/gui/image/qpnghandler.cpp | 65 ++++++++++++++++----------- tests/auto/qimagereader/images/txts.png | Bin 0 -> 5413 bytes tests/auto/qimagereader/qimagereader.qrc | 1 + tests/auto/qimagereader/tst_qimagereader.cpp | 28 ++++++++++++ 4 files changed, 68 insertions(+), 26 deletions(-) create mode 100755 tests/auto/qimagereader/images/txts.png diff --git a/src/gui/image/qpnghandler.cpp b/src/gui/image/qpnghandler.cpp index a9aad51..450e8c6 100644 --- a/src/gui/image/qpnghandler.cpp +++ b/src/gui/image/qpnghandler.cpp @@ -109,6 +109,7 @@ public: bool readPngHeader(); bool readPngImage(QImage *image); + void readPngTexts(png_info *info); QImage::Format readImageFormat(); @@ -359,6 +360,39 @@ static void CALLBACK_CALL_TYPE qt_png_warning(png_structp /*png_ptr*/, png_const } #endif + +/*! + \internal +*/ +void Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngTexts(png_info *info) +{ +#ifndef QT_NO_IMAGE_TEXT + png_textp text_ptr; + int num_text=0; + png_get_text(png_ptr, info, &text_ptr, &num_text); + + while (num_text--) { + QString key, value; + key = QString::fromLatin1(text_ptr->key); +#if defined(PNG_iTXt_SUPPORTED) + if (text_ptr->itxt_length) { + value = QString::fromUtf8(text_ptr->text, int(text_ptr->itxt_length)); + } else +#endif + { + value = QString::fromLatin1(text_ptr->text, int(text_ptr->text_length)); + } + if (!description.isEmpty()) + description += QLatin1String("\n\n"); + description += key + QLatin1String(": ") + value.simplified(); + readTexts.append(key); + readTexts.append(value); + text_ptr++; + } +#endif +} + + /*! \internal */ @@ -394,30 +428,7 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngHeader() png_set_read_fn(png_ptr, this, iod_read_fn); png_read_info(png_ptr, info_ptr); -#ifndef QT_NO_IMAGE_TEXT - png_textp text_ptr; - int num_text=0; - png_get_text(png_ptr,info_ptr,&text_ptr,&num_text); - - while (num_text--) { - QString key, value; - key = QString::fromLatin1(text_ptr->key); -#if defined(PNG_iTXt_SUPPORTED) - if (text_ptr->itxt_length) { - value = QString::fromUtf8(text_ptr->text, int(text_ptr->itxt_length)); - } else -#endif - { - value = QString::fromLatin1(QByteArray(text_ptr->text, int(text_ptr->text_length))); - } - if (!description.isEmpty()) - description += QLatin1String("\n\n"); - description += key + QLatin1String(": ") + value.simplified(); - readTexts.append(key); - readTexts.append(value); - text_ptr++; - } -#endif + readPngTexts(info_ptr); state = ReadHeader; return true; @@ -492,11 +503,13 @@ bool Q_INTERNAL_WIN_NO_THROW QPngHandlerPrivate::readPngImage(QImage *outImage) outImage->setDotsPerMeterX(png_get_x_pixels_per_meter(png_ptr,info_ptr)); outImage->setDotsPerMeterY(png_get_y_pixels_per_meter(png_ptr,info_ptr)); + state = ReadingEnd; + png_read_end(png_ptr, end_info); + + readPngTexts(end_info); for (int i = 0; i < readTexts.size()-1; i+=2) outImage->setText(readTexts.at(i), readTexts.at(i+1)); - state = ReadingEnd; - png_read_end(png_ptr, end_info); png_destroy_read_struct(&png_ptr, &info_ptr, &end_info); delete [] row_pointers; png_ptr = 0; diff --git a/tests/auto/qimagereader/images/txts.png b/tests/auto/qimagereader/images/txts.png new file mode 100755 index 0000000..99be1eb Binary files /dev/null and b/tests/auto/qimagereader/images/txts.png differ diff --git a/tests/auto/qimagereader/qimagereader.qrc b/tests/auto/qimagereader/qimagereader.qrc index 5536b38..632b73a 100644 --- a/tests/auto/qimagereader/qimagereader.qrc +++ b/tests/auto/qimagereader/qimagereader.qrc @@ -64,5 +64,6 @@ <file>images/corrupt.svg</file> <file>images/corrupt.svgz</file> <file>images/qtbug13653-no_eoi.jpg</file> + <file>images/txts.png</file> </qresource> </RCC> diff --git a/tests/auto/qimagereader/tst_qimagereader.cpp b/tests/auto/qimagereader/tst_qimagereader.cpp index f02fd6a..5db5f56 100644 --- a/tests/auto/qimagereader/tst_qimagereader.cpp +++ b/tests/auto/qimagereader/tst_qimagereader.cpp @@ -183,6 +183,9 @@ private slots: void saveFormat_data(); void saveFormat(); + void readText_data(); + void readText(); + void preserveTexts_data(); void preserveTexts(); }; @@ -1968,6 +1971,31 @@ void tst_QImageReader::saveFormat() } +void tst_QImageReader::readText_data() +{ + QTest::addColumn<QString>("fileName"); + QTest::addColumn<QString>("key"); + QTest::addColumn<QString>("text"); + + QTest::newRow("png, tEXt before img") << "txts.png" << "Title" << "PNG"; + QTest::newRow("png, zTXt before img") << "txts.png" << "Comment" << "Some compressed text."; + QTest::newRow("png, tEXt after img") << "txts.png" << "Disclaimer" << "For testing only."; + QTest::newRow("png, zTXt after img") << "txts.png" << "Description" << "Rendered by Persistence of Vision (tm) Ray Tracer"; +} + + +void tst_QImageReader::readText() +{ + QFETCH(QString, fileName); + QFETCH(QString, key); + QFETCH(QString, text); + + QImage img(prefix + fileName); + QVERIFY(img.textKeys().contains(key)); + QCOMPARE(img.text(key), text); +} + + void tst_QImageReader::preserveTexts_data() { QTest::addColumn<QString>("text"); -- cgit v0.12 From 1cd2752dab75ed88a4b41e352dc695060935594a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Thu, 17 Mar 2011 12:32:41 +0100 Subject: Fixup license headers in Lighthouse plugins --- src/plugins/platforms/cocoa/main.mm | 2 +- .../platforms/cocoa/qcocoaautoreleasepool.h | 2 +- .../platforms/cocoa/qcocoaautoreleasepool.mm | 2 +- .../platforms/cocoa/qcocoaeventloopintegration.h | 2 +- .../platforms/cocoa/qcocoaeventloopintegration.mm | 2 +- src/plugins/platforms/cocoa/qcocoaintegration.h | 2 +- src/plugins/platforms/cocoa/qcocoaintegration.mm | 2 +- src/plugins/platforms/cocoa/qcocoawindow.h | 4 +-- src/plugins/platforms/cocoa/qcocoawindow.mm | 4 +-- src/plugins/platforms/cocoa/qcocoawindowsurface.h | 4 +-- src/plugins/platforms/cocoa/qcocoawindowsurface.mm | 4 +-- src/plugins/platforms/cocoa/qnsview.h | 2 +- src/plugins/platforms/cocoa/qnsview.mm | 2 +- src/plugins/platforms/cocoa/qnswindowdelegate.h | 2 +- src/plugins/platforms/cocoa/qnswindowdelegate.mm | 2 +- src/plugins/platforms/directfb/main.cpp | 2 +- .../eglconvenience/qxlibeglintegration.cpp | 4 +-- .../platforms/eglconvenience/qxlibeglintegration.h | 2 +- src/plugins/platforms/linuxfb/main.cpp | 2 +- .../platforms/linuxfb/qlinuxfbintegration.cpp | 2 +- .../platforms/linuxfb/qlinuxfbintegration.h | 2 +- src/plugins/platforms/openvglite/main.cpp | 2 +- .../openvglite/qgraphicssystem_vglite.cpp | 2 +- .../platforms/openvglite/qgraphicssystem_vglite.h | 2 +- .../platforms/openvglite/qwindowsurface_vglite.cpp | 4 +-- .../platforms/openvglite/qwindowsurface_vglite.h | 2 +- src/plugins/platforms/qvfb/main.cpp | 2 +- src/plugins/platforms/qvfb/qvfbintegration.cpp | 2 +- src/plugins/platforms/qvfb/qvfbintegration.h | 2 +- src/plugins/platforms/qvfb/qvfbwindowsurface.cpp | 4 +-- src/plugins/platforms/qvfb/qvfbwindowsurface.h | 4 +-- .../qmlapplicationviewer/qmlapplicationviewer.cpp | 41 ++++++++++++++++++++++ .../qmlapplicationviewer/qmlapplicationviewer.h | 41 ++++++++++++++++++++++ src/plugins/platforms/uikit/main.mm | 2 +- src/plugins/platforms/uikit/quikiteventloop.h | 2 +- src/plugins/platforms/uikit/quikiteventloop.mm | 2 +- src/plugins/platforms/uikit/quikitintegration.h | 2 +- src/plugins/platforms/uikit/quikitintegration.mm | 2 +- src/plugins/platforms/uikit/quikitscreen.h | 2 +- src/plugins/platforms/uikit/quikitscreen.mm | 2 +- src/plugins/platforms/uikit/quikitwindow.h | 2 +- src/plugins/platforms/uikit/quikitwindow.mm | 2 +- src/plugins/platforms/uikit/quikitwindowsurface.h | 2 +- src/plugins/platforms/uikit/quikitwindowsurface.mm | 2 +- src/plugins/platforms/vnc/main.cpp | 2 +- src/plugins/platforms/vnc/qvnccursor.cpp | 4 +-- src/plugins/platforms/vnc/qvnccursor.h | 4 +-- src/plugins/platforms/vnc/qvncintegration.cpp | 2 +- src/plugins/platforms/vnc/qvncintegration.h | 2 +- src/plugins/platforms/vnc/qvncserver.cpp | 2 +- src/plugins/platforms/vnc/qvncserver.h | 2 +- src/plugins/platforms/wayland/main.cpp | 2 +- src/plugins/platforms/wayland/qwaylandcursor.cpp | 2 +- src/plugins/platforms/wayland/qwaylandcursor.h | 2 +- .../platforms/wayland/qwaylanddrmsurface.cpp | 4 +-- .../platforms/wayland/qwaylandintegration.h | 2 +- .../platforms/wayland/qwaylandshmsurface.cpp | 4 +-- src/plugins/platforms/wayland/qwaylandshmsurface.h | 4 +-- src/plugins/platforms/xcb/main.cpp | 2 +- src/plugins/platforms/xcb/qdri2context.cpp | 41 ++++++++++++++++++++++ src/plugins/platforms/xcb/qdri2context.h | 41 ++++++++++++++++++++++ src/plugins/platforms/xcb/qglxintegration.cpp | 2 +- src/plugins/platforms/xcb/qglxintegration.h | 2 +- src/plugins/platforms/xcb/qxcbconnection.cpp | 2 +- src/plugins/platforms/xcb/qxcbconnection.h | 2 +- src/plugins/platforms/xcb/qxcbintegration.cpp | 2 +- src/plugins/platforms/xcb/qxcbintegration.h | 2 +- src/plugins/platforms/xcb/qxcbkeyboard.cpp | 2 +- src/plugins/platforms/xcb/qxcbkeyboard.h | 2 +- src/plugins/platforms/xcb/qxcbnativeinterface.cpp | 41 ++++++++++++++++++++++ src/plugins/platforms/xcb/qxcbnativeinterface.h | 41 ++++++++++++++++++++++ src/plugins/platforms/xcb/qxcbobject.h | 2 +- src/plugins/platforms/xcb/qxcbscreen.cpp | 2 +- src/plugins/platforms/xcb/qxcbscreen.h | 2 +- src/plugins/platforms/xcb/qxcbwindow.cpp | 2 +- src/plugins/platforms/xcb/qxcbwindow.h | 2 +- src/plugins/platforms/xcb/qxcbwindowsurface.cpp | 2 +- src/plugins/platforms/xcb/qxcbwindowsurface.h | 2 +- src/plugins/platforms/xlib/main.cpp | 2 +- src/plugins/platforms/xlib/qglxintegration.cpp | 2 +- src/plugins/platforms/xlib/qglxintegration.h | 2 +- src/plugins/platforms/xlib/qxlibclipboard.cpp | 4 +-- src/plugins/platforms/xlib/qxlibclipboard.h | 4 +-- src/plugins/platforms/xlib/qxlibcursor.cpp | 2 +- src/plugins/platforms/xlib/qxlibcursor.h | 4 +-- src/plugins/platforms/xlib/qxlibdisplay.cpp | 41 ++++++++++++++++++++++ src/plugins/platforms/xlib/qxlibdisplay.h | 41 ++++++++++++++++++++++ src/plugins/platforms/xlib/qxlibintegration.cpp | 2 +- src/plugins/platforms/xlib/qxlibintegration.h | 2 +- src/plugins/platforms/xlib/qxlibkeyboard.cpp | 2 +- src/plugins/platforms/xlib/qxlibkeyboard.h | 2 +- src/plugins/platforms/xlib/qxlibmime.cpp | 2 +- src/plugins/platforms/xlib/qxlibmime.h | 2 +- src/plugins/platforms/xlib/qxlibscreen.cpp | 2 +- src/plugins/platforms/xlib/qxlibscreen.h | 2 +- src/plugins/platforms/xlib/qxlibstatic.cpp | 2 +- src/plugins/platforms/xlib/qxlibstatic.h | 2 +- src/plugins/platforms/xlib/qxlibwindow.cpp | 4 +-- src/plugins/platforms/xlib/qxlibwindow.h | 4 +-- src/plugins/platforms/xlib/qxlibwindowsurface.cpp | 4 +-- src/plugins/platforms/xlib/qxlibwindowsurface.h | 4 +-- 101 files changed, 441 insertions(+), 113 deletions(-) diff --git a/src/plugins/platforms/cocoa/main.mm b/src/plugins/platforms/cocoa/main.mm index 8be8883..da7af3f 100644 --- a/src/plugins/platforms/cocoa/main.mm +++ b/src/plugins/platforms/cocoa/main.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/cocoa/qcocoaautoreleasepool.h b/src/plugins/platforms/cocoa/qcocoaautoreleasepool.h index 47b94d1..6e41e9a 100644 --- a/src/plugins/platforms/cocoa/qcocoaautoreleasepool.h +++ b/src/plugins/platforms/cocoa/qcocoaautoreleasepool.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/cocoa/qcocoaautoreleasepool.mm b/src/plugins/platforms/cocoa/qcocoaautoreleasepool.mm index 9a18fe2..35750cd 100644 --- a/src/plugins/platforms/cocoa/qcocoaautoreleasepool.mm +++ b/src/plugins/platforms/cocoa/qcocoaautoreleasepool.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/cocoa/qcocoaeventloopintegration.h b/src/plugins/platforms/cocoa/qcocoaeventloopintegration.h index 87998e3..81e272e 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventloopintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaeventloopintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/cocoa/qcocoaeventloopintegration.mm b/src/plugins/platforms/cocoa/qcocoaeventloopintegration.mm index 844751c..885916e 100644 --- a/src/plugins/platforms/cocoa/qcocoaeventloopintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaeventloopintegration.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.h b/src/plugins/platforms/cocoa/qcocoaintegration.h index b94bcb9..2a04e8c 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.h +++ b/src/plugins/platforms/cocoa/qcocoaintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/cocoa/qcocoaintegration.mm b/src/plugins/platforms/cocoa/qcocoaintegration.mm index a75b88c..7c4319c 100644 --- a/src/plugins/platforms/cocoa/qcocoaintegration.mm +++ b/src/plugins/platforms/cocoa/qcocoaintegration.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/cocoa/qcocoawindow.h b/src/plugins/platforms/cocoa/qcocoawindow.h index 660e9f8..b71879d 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.h +++ b/src/plugins/platforms/cocoa/qcocoawindow.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/cocoa/qcocoawindow.mm b/src/plugins/platforms/cocoa/qcocoawindow.mm index 4e233ee..aa54fe9 100644 --- a/src/plugins/platforms/cocoa/qcocoawindow.mm +++ b/src/plugins/platforms/cocoa/qcocoawindow.mm @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/cocoa/qcocoawindowsurface.h b/src/plugins/platforms/cocoa/qcocoawindowsurface.h index 35f4064..5ae7be1 100644 --- a/src/plugins/platforms/cocoa/qcocoawindowsurface.h +++ b/src/plugins/platforms/cocoa/qcocoawindowsurface.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/cocoa/qcocoawindowsurface.mm b/src/plugins/platforms/cocoa/qcocoawindowsurface.mm index 443a486..ecf6879 100644 --- a/src/plugins/platforms/cocoa/qcocoawindowsurface.mm +++ b/src/plugins/platforms/cocoa/qcocoawindowsurface.mm @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/cocoa/qnsview.h b/src/plugins/platforms/cocoa/qnsview.h index 0523725..fc946e2 100644 --- a/src/plugins/platforms/cocoa/qnsview.h +++ b/src/plugins/platforms/cocoa/qnsview.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/cocoa/qnsview.mm b/src/plugins/platforms/cocoa/qnsview.mm index 60de6ba..6fda27b 100644 --- a/src/plugins/platforms/cocoa/qnsview.mm +++ b/src/plugins/platforms/cocoa/qnsview.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.h b/src/plugins/platforms/cocoa/qnswindowdelegate.h index 9fc1d63..f4dcec7 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.h +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/cocoa/qnswindowdelegate.mm b/src/plugins/platforms/cocoa/qnswindowdelegate.mm index c04602b..58dffb7 100644 --- a/src/plugins/platforms/cocoa/qnswindowdelegate.mm +++ b/src/plugins/platforms/cocoa/qnswindowdelegate.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/directfb/main.cpp b/src/plugins/platforms/directfb/main.cpp index f4ece32..d9caa70 100644 --- a/src/plugins/platforms/directfb/main.cpp +++ b/src/plugins/platforms/directfb/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/eglconvenience/qxlibeglintegration.cpp b/src/plugins/platforms/eglconvenience/qxlibeglintegration.cpp index 1135d2f..7f296c5 100644 --- a/src/plugins/platforms/eglconvenience/qxlibeglintegration.cpp +++ b/src/plugins/platforms/eglconvenience/qxlibeglintegration.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/eglconvenience/qxlibeglintegration.h b/src/plugins/platforms/eglconvenience/qxlibeglintegration.h index f62dce4..51996da 100644 --- a/src/plugins/platforms/eglconvenience/qxlibeglintegration.h +++ b/src/plugins/platforms/eglconvenience/qxlibeglintegration.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/linuxfb/main.cpp b/src/plugins/platforms/linuxfb/main.cpp index c5f7fe0..fb14ef4 100644 --- a/src/plugins/platforms/linuxfb/main.cpp +++ b/src/plugins/platforms/linuxfb/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp index af5a337..a088a31 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h index ddf8873..f361843 100644 --- a/src/plugins/platforms/linuxfb/qlinuxfbintegration.h +++ b/src/plugins/platforms/linuxfb/qlinuxfbintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/openvglite/main.cpp b/src/plugins/platforms/openvglite/main.cpp index dc0b4a8..97321fa 100644 --- a/src/plugins/platforms/openvglite/main.cpp +++ b/src/plugins/platforms/openvglite/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp index 41b2303..5f7106e 100644 --- a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp +++ b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h index 512793d..9d45bf9 100644 --- a/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h +++ b/src/plugins/platforms/openvglite/qgraphicssystem_vglite.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp b/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp index c73e35a..8432ad6 100644 --- a/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp +++ b/src/plugins/platforms/openvglite/qwindowsurface_vglite.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/openvglite/qwindowsurface_vglite.h b/src/plugins/platforms/openvglite/qwindowsurface_vglite.h index b7d0a92..6d66c42 100644 --- a/src/plugins/platforms/openvglite/qwindowsurface_vglite.h +++ b/src/plugins/platforms/openvglite/qwindowsurface_vglite.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/qvfb/main.cpp b/src/plugins/platforms/qvfb/main.cpp index 997e544..5c3b72b 100644 --- a/src/plugins/platforms/qvfb/main.cpp +++ b/src/plugins/platforms/qvfb/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/qvfb/qvfbintegration.cpp b/src/plugins/platforms/qvfb/qvfbintegration.cpp index 0cc3938..ddde800 100644 --- a/src/plugins/platforms/qvfb/qvfbintegration.cpp +++ b/src/plugins/platforms/qvfb/qvfbintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/qvfb/qvfbintegration.h b/src/plugins/platforms/qvfb/qvfbintegration.h index 198a45c..33e31a5 100644 --- a/src/plugins/platforms/qvfb/qvfbintegration.h +++ b/src/plugins/platforms/qvfb/qvfbintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/qvfb/qvfbwindowsurface.cpp b/src/plugins/platforms/qvfb/qvfbwindowsurface.cpp index 6699072..85918eb 100644 --- a/src/plugins/platforms/qvfb/qvfbwindowsurface.cpp +++ b/src/plugins/platforms/qvfb/qvfbwindowsurface.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/qvfb/qvfbwindowsurface.h b/src/plugins/platforms/qvfb/qvfbwindowsurface.h index 9228189..9f828d3 100644 --- a/src/plugins/platforms/qvfb/qvfbwindowsurface.h +++ b/src/plugins/platforms/qvfb/qvfbwindowsurface.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp index 7844e46..72f8c52 100644 --- a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp +++ b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + // checksum 0x17fa version 0x3000a /* This file was generated by the Qt Quick Application wizard of Qt Creator. diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h index 0e4de04..01b2af0 100644 --- a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h +++ b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/qmlapplicationviewer.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + // checksum 0x5a59 version 0x3000a /* This file was generated by the Qt Quick Application wizard of Qt Creator. diff --git a/src/plugins/platforms/uikit/main.mm b/src/plugins/platforms/uikit/main.mm index 05e0d02..1ef69fa 100644 --- a/src/plugins/platforms/uikit/main.mm +++ b/src/plugins/platforms/uikit/main.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/uikit/quikiteventloop.h b/src/plugins/platforms/uikit/quikiteventloop.h index 5c18999..cf5c682 100644 --- a/src/plugins/platforms/uikit/quikiteventloop.h +++ b/src/plugins/platforms/uikit/quikiteventloop.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/uikit/quikiteventloop.mm b/src/plugins/platforms/uikit/quikiteventloop.mm index 78f046e..70757b1 100644 --- a/src/plugins/platforms/uikit/quikiteventloop.mm +++ b/src/plugins/platforms/uikit/quikiteventloop.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/uikit/quikitintegration.h b/src/plugins/platforms/uikit/quikitintegration.h index e448881..a986e92 100644 --- a/src/plugins/platforms/uikit/quikitintegration.h +++ b/src/plugins/platforms/uikit/quikitintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/uikit/quikitintegration.mm b/src/plugins/platforms/uikit/quikitintegration.mm index f1fc402..d4b4192 100644 --- a/src/plugins/platforms/uikit/quikitintegration.mm +++ b/src/plugins/platforms/uikit/quikitintegration.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/uikit/quikitscreen.h b/src/plugins/platforms/uikit/quikitscreen.h index 0253795..15c7d69 100644 --- a/src/plugins/platforms/uikit/quikitscreen.h +++ b/src/plugins/platforms/uikit/quikitscreen.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/uikit/quikitscreen.mm b/src/plugins/platforms/uikit/quikitscreen.mm index 718ba54..ec94e3a 100644 --- a/src/plugins/platforms/uikit/quikitscreen.mm +++ b/src/plugins/platforms/uikit/quikitscreen.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/uikit/quikitwindow.h b/src/plugins/platforms/uikit/quikitwindow.h index 8e8c51b..d5a6690 100644 --- a/src/plugins/platforms/uikit/quikitwindow.h +++ b/src/plugins/platforms/uikit/quikitwindow.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/uikit/quikitwindow.mm b/src/plugins/platforms/uikit/quikitwindow.mm index 457598b..ebdee06 100644 --- a/src/plugins/platforms/uikit/quikitwindow.mm +++ b/src/plugins/platforms/uikit/quikitwindow.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/uikit/quikitwindowsurface.h b/src/plugins/platforms/uikit/quikitwindowsurface.h index 2c22d7f..50d02b4 100644 --- a/src/plugins/platforms/uikit/quikitwindowsurface.h +++ b/src/plugins/platforms/uikit/quikitwindowsurface.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/uikit/quikitwindowsurface.mm b/src/plugins/platforms/uikit/quikitwindowsurface.mm index f21bb77..1274fca 100644 --- a/src/plugins/platforms/uikit/quikitwindowsurface.mm +++ b/src/plugins/platforms/uikit/quikitwindowsurface.mm @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/vnc/main.cpp b/src/plugins/platforms/vnc/main.cpp index e051e2d..890b8f8 100644 --- a/src/plugins/platforms/vnc/main.cpp +++ b/src/plugins/platforms/vnc/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/vnc/qvnccursor.cpp b/src/plugins/platforms/vnc/qvnccursor.cpp index e83696d..dbcdef3 100644 --- a/src/plugins/platforms/vnc/qvnccursor.cpp +++ b/src/plugins/platforms/vnc/qvnccursor.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/vnc/qvnccursor.h b/src/plugins/platforms/vnc/qvnccursor.h index eeb3686..8eb26e0 100644 --- a/src/plugins/platforms/vnc/qvnccursor.h +++ b/src/plugins/platforms/vnc/qvnccursor.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/vnc/qvncintegration.cpp b/src/plugins/platforms/vnc/qvncintegration.cpp index 56cbe4b..b99ff3f 100644 --- a/src/plugins/platforms/vnc/qvncintegration.cpp +++ b/src/plugins/platforms/vnc/qvncintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/vnc/qvncintegration.h b/src/plugins/platforms/vnc/qvncintegration.h index 80338a1..ef16dfa 100644 --- a/src/plugins/platforms/vnc/qvncintegration.h +++ b/src/plugins/platforms/vnc/qvncintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/vnc/qvncserver.cpp b/src/plugins/platforms/vnc/qvncserver.cpp index 288d1bc..be2de7c 100644 --- a/src/plugins/platforms/vnc/qvncserver.cpp +++ b/src/plugins/platforms/vnc/qvncserver.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/vnc/qvncserver.h b/src/plugins/platforms/vnc/qvncserver.h index 7244bdf..3b514a5 100644 --- a/src/plugins/platforms/vnc/qvncserver.h +++ b/src/plugins/platforms/vnc/qvncserver.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/wayland/main.cpp b/src/plugins/platforms/wayland/main.cpp index 1bca661..6dc1c2b 100644 --- a/src/plugins/platforms/wayland/main.cpp +++ b/src/plugins/platforms/wayland/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/wayland/qwaylandcursor.cpp b/src/plugins/platforms/wayland/qwaylandcursor.cpp index 0ad0702..614686f 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.cpp +++ b/src/plugins/platforms/wayland/qwaylandcursor.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/wayland/qwaylandcursor.h b/src/plugins/platforms/wayland/qwaylandcursor.h index 19e6047..254cb94 100644 --- a/src/plugins/platforms/wayland/qwaylandcursor.h +++ b/src/plugins/platforms/wayland/qwaylandcursor.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp index 38bbc59..a8bc352 100644 --- a/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylanddrmsurface.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/wayland/qwaylandintegration.h b/src/plugins/platforms/wayland/qwaylandintegration.h index c3919ab..067b6e4 100644 --- a/src/plugins/platforms/wayland/qwaylandintegration.h +++ b/src/plugins/platforms/wayland/qwaylandintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp index 6872bac..54da9a1 100644 --- a/src/plugins/platforms/wayland/qwaylandshmsurface.cpp +++ b/src/plugins/platforms/wayland/qwaylandshmsurface.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/wayland/qwaylandshmsurface.h b/src/plugins/platforms/wayland/qwaylandshmsurface.h index 615d944..02b324a 100644 --- a/src/plugins/platforms/wayland/qwaylandshmsurface.h +++ b/src/plugins/platforms/wayland/qwaylandshmsurface.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/main.cpp b/src/plugins/platforms/xcb/main.cpp index 1966003..89bc66e 100644 --- a/src/plugins/platforms/xcb/main.cpp +++ b/src/plugins/platforms/xcb/main.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qdri2context.cpp b/src/plugins/platforms/xcb/qdri2context.cpp index 10c9417..0079f91 100644 --- a/src/plugins/platforms/xcb/qdri2context.cpp +++ b/src/plugins/platforms/xcb/qdri2context.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qdri2context.h" #include "qxcbwindow.h" diff --git a/src/plugins/platforms/xcb/qdri2context.h b/src/plugins/platforms/xcb/qdri2context.h index 8e4ac89..42dd6bd 100644 --- a/src/plugins/platforms/xcb/qdri2context.h +++ b/src/plugins/platforms/xcb/qdri2context.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QDRI2CONTEXT_H #define QDRI2CONTEXT_H diff --git a/src/plugins/platforms/xcb/qglxintegration.cpp b/src/plugins/platforms/xcb/qglxintegration.cpp index 0cb6b1d..e94b6a6 100644 --- a/src/plugins/platforms/xcb/qglxintegration.cpp +++ b/src/plugins/platforms/xcb/qglxintegration.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qglxintegration.h b/src/plugins/platforms/xcb/qglxintegration.h index 0006363..f2e20c4 100644 --- a/src/plugins/platforms/xcb/qglxintegration.h +++ b/src/plugins/platforms/xcb/qglxintegration.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbconnection.cpp b/src/plugins/platforms/xcb/qxcbconnection.cpp index de3f926..191699b 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.cpp +++ b/src/plugins/platforms/xcb/qxcbconnection.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbconnection.h b/src/plugins/platforms/xcb/qxcbconnection.h index a7fa7fd..e00fbb1 100644 --- a/src/plugins/platforms/xcb/qxcbconnection.h +++ b/src/plugins/platforms/xcb/qxcbconnection.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbintegration.cpp b/src/plugins/platforms/xcb/qxcbintegration.cpp index 0981655..63c26a1 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.cpp +++ b/src/plugins/platforms/xcb/qxcbintegration.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbintegration.h b/src/plugins/platforms/xcb/qxcbintegration.h index eab6949..6c9634e 100644 --- a/src/plugins/platforms/xcb/qxcbintegration.h +++ b/src/plugins/platforms/xcb/qxcbintegration.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.cpp b/src/plugins/platforms/xcb/qxcbkeyboard.cpp index f594232..ec9a009 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.cpp +++ b/src/plugins/platforms/xcb/qxcbkeyboard.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbkeyboard.h b/src/plugins/platforms/xcb/qxcbkeyboard.h index 2a17e48..ddade79 100644 --- a/src/plugins/platforms/xcb/qxcbkeyboard.h +++ b/src/plugins/platforms/xcb/qxcbkeyboard.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp index 8b6678b..b2ca1be 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.cpp +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qxcbnativeinterface.h" #include "qxcbscreen.h" diff --git a/src/plugins/platforms/xcb/qxcbnativeinterface.h b/src/plugins/platforms/xcb/qxcbnativeinterface.h index 72c27d5..f60905c 100644 --- a/src/plugins/platforms/xcb/qxcbnativeinterface.h +++ b/src/plugins/platforms/xcb/qxcbnativeinterface.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QXCBNATIVEINTERFACE_H #define QXCBNATIVEINTERFACE_H diff --git a/src/plugins/platforms/xcb/qxcbobject.h b/src/plugins/platforms/xcb/qxcbobject.h index cabfd7c..69494b0 100644 --- a/src/plugins/platforms/xcb/qxcbobject.h +++ b/src/plugins/platforms/xcb/qxcbobject.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index f868db8..53b0563 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbscreen.h b/src/plugins/platforms/xcb/qxcbscreen.h index 77ee46f..6f69fc7 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.h +++ b/src/plugins/platforms/xcb/qxcbscreen.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbwindow.cpp b/src/plugins/platforms/xcb/qxcbwindow.cpp index 9478b5b..cbf50f7 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.cpp +++ b/src/plugins/platforms/xcb/qxcbwindow.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbwindow.h b/src/plugins/platforms/xcb/qxcbwindow.h index 2e8238b..1e9930d 100644 --- a/src/plugins/platforms/xcb/qxcbwindow.h +++ b/src/plugins/platforms/xcb/qxcbwindow.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp index 513de08..7fed230 100644 --- a/src/plugins/platforms/xcb/qxcbwindowsurface.cpp +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xcb/qxcbwindowsurface.h b/src/plugins/platforms/xcb/qxcbwindowsurface.h index ee63190..61689b1 100644 --- a/src/plugins/platforms/xcb/qxcbwindowsurface.h +++ b/src/plugins/platforms/xcb/qxcbwindowsurface.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtGui module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/main.cpp b/src/plugins/platforms/xlib/main.cpp index 3e2a6b9..f0bf6ff 100644 --- a/src/plugins/platforms/xlib/main.cpp +++ b/src/plugins/platforms/xlib/main.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/xlib/qglxintegration.cpp b/src/plugins/platforms/xlib/qglxintegration.cpp index 89cd768..80011d9 100644 --- a/src/plugins/platforms/xlib/qglxintegration.cpp +++ b/src/plugins/platforms/xlib/qglxintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/xlib/qglxintegration.h b/src/plugins/platforms/xlib/qglxintegration.h index 81b48c9..dbb5c2e 100644 --- a/src/plugins/platforms/xlib/qglxintegration.h +++ b/src/plugins/platforms/xlib/qglxintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/xlib/qxlibclipboard.cpp b/src/plugins/platforms/xlib/qxlibclipboard.cpp index 49b2dc7..dfaf552 100644 --- a/src/plugins/platforms/xlib/qxlibclipboard.cpp +++ b/src/plugins/platforms/xlib/qxlibclipboard.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibclipboard.h b/src/plugins/platforms/xlib/qxlibclipboard.h index ec1d728..15901b0 100644 --- a/src/plugins/platforms/xlib/qxlibclipboard.h +++ b/src/plugins/platforms/xlib/qxlibclipboard.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibcursor.cpp b/src/plugins/platforms/xlib/qxlibcursor.cpp index 074d2f7..042cbc9 100644 --- a/src/plugins/platforms/xlib/qxlibcursor.cpp +++ b/src/plugins/platforms/xlib/qxlibcursor.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibcursor.h b/src/plugins/platforms/xlib/qxlibcursor.h index 77c66bf..62b13eb 100644 --- a/src/plugins/platforms/xlib/qxlibcursor.h +++ b/src/plugins/platforms/xlib/qxlibcursor.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibdisplay.cpp b/src/plugins/platforms/xlib/qxlibdisplay.cpp index 3b60af2..d8aa230 100644 --- a/src/plugins/platforms/xlib/qxlibdisplay.cpp +++ b/src/plugins/platforms/xlib/qxlibdisplay.cpp @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #include "qxlibdisplay.h" QXlibDisplay::QXlibDisplay(Display *display) diff --git a/src/plugins/platforms/xlib/qxlibdisplay.h b/src/plugins/platforms/xlib/qxlibdisplay.h index f2cca9e..557ab52 100644 --- a/src/plugins/platforms/xlib/qxlibdisplay.h +++ b/src/plugins/platforms/xlib/qxlibdisplay.h @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + #ifndef QXLIBDISPLAY_H #define QXLIBDISPLAY_H diff --git a/src/plugins/platforms/xlib/qxlibintegration.cpp b/src/plugins/platforms/xlib/qxlibintegration.cpp index c207eb2..6733ed1 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.cpp +++ b/src/plugins/platforms/xlib/qxlibintegration.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/xlib/qxlibintegration.h b/src/plugins/platforms/xlib/qxlibintegration.h index dd8cdec..3bbf897 100644 --- a/src/plugins/platforms/xlib/qxlibintegration.h +++ b/src/plugins/platforms/xlib/qxlibintegration.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/xlib/qxlibkeyboard.cpp b/src/plugins/platforms/xlib/qxlibkeyboard.cpp index 690d273..8d94157 100644 --- a/src/plugins/platforms/xlib/qxlibkeyboard.cpp +++ b/src/plugins/platforms/xlib/qxlibkeyboard.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibkeyboard.h b/src/plugins/platforms/xlib/qxlibkeyboard.h index 02fc290..5e0135a 100644 --- a/src/plugins/platforms/xlib/qxlibkeyboard.h +++ b/src/plugins/platforms/xlib/qxlibkeyboard.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibmime.cpp b/src/plugins/platforms/xlib/qxlibmime.cpp index 61a0735..e98983d 100644 --- a/src/plugins/platforms/xlib/qxlibmime.cpp +++ b/src/plugins/platforms/xlib/qxlibmime.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibmime.h b/src/plugins/platforms/xlib/qxlibmime.h index 316d423..a9bc265 100644 --- a/src/plugins/platforms/xlib/qxlibmime.h +++ b/src/plugins/platforms/xlib/qxlibmime.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibscreen.cpp b/src/plugins/platforms/xlib/qxlibscreen.cpp index 5a9aca9..23a2d07 100644 --- a/src/plugins/platforms/xlib/qxlibscreen.cpp +++ b/src/plugins/platforms/xlib/qxlibscreen.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/xlib/qxlibscreen.h b/src/plugins/platforms/xlib/qxlibscreen.h index 8dac41d..35c0141 100644 --- a/src/plugins/platforms/xlib/qxlibscreen.h +++ b/src/plugins/platforms/xlib/qxlibscreen.h @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** diff --git a/src/plugins/platforms/xlib/qxlibstatic.cpp b/src/plugins/platforms/xlib/qxlibstatic.cpp index f67fbdc..6117781 100644 --- a/src/plugins/platforms/xlib/qxlibstatic.cpp +++ b/src/plugins/platforms/xlib/qxlibstatic.cpp @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibstatic.h b/src/plugins/platforms/xlib/qxlibstatic.h index 8473ee9..72cfaec 100644 --- a/src/plugins/platforms/xlib/qxlibstatic.h +++ b/src/plugins/platforms/xlib/qxlibstatic.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibwindow.cpp b/src/plugins/platforms/xlib/qxlibwindow.cpp index b0d32d9..a7bc53c 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.cpp +++ b/src/plugins/platforms/xlib/qxlibwindow.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibwindow.h b/src/plugins/platforms/xlib/qxlibwindow.h index be98032..08694a5 100644 --- a/src/plugins/platforms/xlib/qxlibwindow.h +++ b/src/plugins/platforms/xlib/qxlibwindow.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp index fa1e197..513f10d 100644 --- a/src/plugins/platforms/xlib/qxlibwindowsurface.cpp +++ b/src/plugins/platforms/xlib/qxlibwindowsurface.cpp @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage diff --git a/src/plugins/platforms/xlib/qxlibwindowsurface.h b/src/plugins/platforms/xlib/qxlibwindowsurface.h index 12b4c60..d46b7b4 100644 --- a/src/plugins/platforms/xlib/qxlibwindowsurface.h +++ b/src/plugins/platforms/xlib/qxlibwindowsurface.h @@ -1,10 +1,10 @@ /**************************************************************************** ** -** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtOpenVG module of the Qt Toolkit. +** This file is part of the plugins of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage -- cgit v0.12 From 483a069415f2648a0d4c1f86d69f372607750ae6 Mon Sep 17 00:00:00 2001 From: Simon Hausmann <simon.hausmann@nokia.com> Date: Thu, 17 Mar 2011 14:51:10 +0100 Subject: Fix disk cache interaction for range retrieval HTTP requests. The disk cache API does not currently support retrieving partial content, it can only serve entire files. Therefore we disable the use of the cache for these kinds of requests, as indicated by the presence of the Range header field. Done-with: Jocelyn Turcotte Reviewed-by: Markus Goetz Reviewed-by: Peter Hartmann --- src/network/access/qnetworkaccesshttpbackend.cpp | 5 ++ tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 74 +++++++++++++++++------- 2 files changed, 58 insertions(+), 21 deletions(-) diff --git a/src/network/access/qnetworkaccesshttpbackend.cpp b/src/network/access/qnetworkaccesshttpbackend.cpp index 4189743..108ac68 100644 --- a/src/network/access/qnetworkaccesshttpbackend.cpp +++ b/src/network/access/qnetworkaccesshttpbackend.cpp @@ -360,6 +360,11 @@ void QNetworkAccessHttpBackend::validateCache(QHttpNetworkRequest &httpRequest, return; } + // The disk cache API does not currently support partial content retrieval. + // That is why we don't use the disk cache for any such requests. + if (request().hasRawHeader("Range")) + return; + QAbstractNetworkCache *nc = networkCache(); if (!nc) return; // no local cache diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 39bb0fc..4338e74 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -2663,6 +2663,7 @@ void tst_QNetworkReply::ioGetFromHttpWithCache_data() QTest::addColumn<QString>("body"); QTest::addColumn<MyMemoryCache::CachedContent>("cachedReply"); QTest::addColumn<int>("cacheMode"); + QTest::addColumn<QStringList>("extraHttpHeaders"); QTest::addColumn<bool>("loadedFromCache"); QTest::addColumn<bool>("networkUsed"); @@ -2680,11 +2681,11 @@ void tst_QNetworkReply::ioGetFromHttpWithCache_data() "\r\n"; QTest::newRow("not-cached,always-network") - << reply200 << "Reloaded" << MyMemoryCache::CachedContent() << int(QNetworkRequest::AlwaysNetwork) << false << true; + << reply200 << "Reloaded" << MyMemoryCache::CachedContent() << int(QNetworkRequest::AlwaysNetwork) << QStringList() << false << true; QTest::newRow("not-cached,prefer-network") - << reply200 << "Reloaded" << MyMemoryCache::CachedContent() << int(QNetworkRequest::PreferNetwork) << false << true; + << reply200 << "Reloaded" << MyMemoryCache::CachedContent() << int(QNetworkRequest::PreferNetwork) << QStringList() << false << true; QTest::newRow("not-cached,prefer-cache") - << reply200 << "Reloaded" << MyMemoryCache::CachedContent() << int(QNetworkRequest::PreferCache) << false << true; + << reply200 << "Reloaded" << MyMemoryCache::CachedContent() << int(QNetworkRequest::PreferCache) << QStringList() << false << true; QDateTime present = QDateTime::currentDateTime().toUTC(); QDateTime past = present.addSecs(-3600); @@ -2706,14 +2707,14 @@ void tst_QNetworkReply::ioGetFromHttpWithCache_data() content.first.setLastModified(past); QTest::newRow("expired,200,prefer-network") - << reply200 << "Reloaded" << content << int(QNetworkRequest::PreferNetwork) << false << true; + << reply200 << "Reloaded" << content << int(QNetworkRequest::PreferNetwork) << QStringList() << false << true; QTest::newRow("expired,200,prefer-cache") - << reply200 << "Reloaded" << content << int(QNetworkRequest::PreferCache) << false << true; + << reply200 << "Reloaded" << content << int(QNetworkRequest::PreferCache) << QStringList() << false << true; QTest::newRow("expired,304,prefer-network") - << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferNetwork) << true << true; + << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferNetwork) << QStringList() << true << true; QTest::newRow("expired,304,prefer-cache") - << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferCache) << true << true; + << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferCache) << QStringList() << true << true; // // Set to not-expired @@ -2725,20 +2726,20 @@ void tst_QNetworkReply::ioGetFromHttpWithCache_data() content.first.setExpirationDate(future); QTest::newRow("not-expired,200,always-network") - << reply200 << "Reloaded" << content << int(QNetworkRequest::AlwaysNetwork) << false << true; + << reply200 << "Reloaded" << content << int(QNetworkRequest::AlwaysNetwork) << QStringList() << false << true; QTest::newRow("not-expired,200,prefer-network") - << reply200 << "Not-reloaded" << content << int(QNetworkRequest::PreferNetwork) << true << false; + << reply200 << "Not-reloaded" << content << int(QNetworkRequest::PreferNetwork) << QStringList() << true << false; QTest::newRow("not-expired,200,prefer-cache") - << reply200 << "Not-reloaded" << content << int(QNetworkRequest::PreferCache) << true << false; + << reply200 << "Not-reloaded" << content << int(QNetworkRequest::PreferCache) << QStringList() << true << false; QTest::newRow("not-expired,200,always-cache") - << reply200 << "Not-reloaded" << content << int(QNetworkRequest::AlwaysCache) << true << false; + << reply200 << "Not-reloaded" << content << int(QNetworkRequest::AlwaysCache) << QStringList() << true << false; QTest::newRow("not-expired,304,prefer-network") - << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferNetwork) << true << false; + << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferNetwork) << QStringList() << true << false; QTest::newRow("not-expired,304,prefer-cache") - << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferCache) << true << false; + << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferCache) << QStringList() << true << false; QTest::newRow("not-expired,304,always-cache") - << reply304 << "Not-reloaded" << content << int(QNetworkRequest::AlwaysCache) << true << false; + << reply304 << "Not-reloaded" << content << int(QNetworkRequest::AlwaysCache) << QStringList() << true << false; // // Set must-revalidate now @@ -2749,20 +2750,42 @@ void tst_QNetworkReply::ioGetFromHttpWithCache_data() content.first.setRawHeaders(rawHeaders); QTest::newRow("must-revalidate,200,always-network") - << reply200 << "Reloaded" << content << int(QNetworkRequest::AlwaysNetwork) << false << true; + << reply200 << "Reloaded" << content << int(QNetworkRequest::AlwaysNetwork) << QStringList() << false << true; QTest::newRow("must-revalidate,200,prefer-network") - << reply200 << "Reloaded" << content << int(QNetworkRequest::PreferNetwork) << false << true; + << reply200 << "Reloaded" << content << int(QNetworkRequest::PreferNetwork) << QStringList() << false << true; QTest::newRow("must-revalidate,200,prefer-cache") - << reply200 << "Not-reloaded" << content << int(QNetworkRequest::PreferCache) << true << false; + << reply200 << "Not-reloaded" << content << int(QNetworkRequest::PreferCache) << QStringList() << true << false; QTest::newRow("must-revalidate,200,always-cache") - << reply200 << "Not-reloaded" << content << int(QNetworkRequest::AlwaysCache) << true << false; + << reply200 << "Not-reloaded" << content << int(QNetworkRequest::AlwaysCache) << QStringList() << true << false; QTest::newRow("must-revalidate,304,prefer-network") - << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferNetwork) << true << true; + << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferNetwork) << QStringList() << true << true; QTest::newRow("must-revalidate,304,prefer-cache") - << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferCache) << true << false; + << reply304 << "Not-reloaded" << content << int(QNetworkRequest::PreferCache) << QStringList() << true << false; QTest::newRow("must-revalidate,304,always-cache") - << reply304 << "Not-reloaded" << content << int(QNetworkRequest::AlwaysCache) << true << false; + << reply304 << "Not-reloaded" << content << int(QNetworkRequest::AlwaysCache) << QStringList() << true << false; + + // + // Partial content + // + rawHeaders.clear(); + rawHeaders << QNetworkCacheMetaData::RawHeader("Date", QLocale::c().toString(past, dateFormat).toLatin1()) + << QNetworkCacheMetaData::RawHeader("Cache-control", "max-age=7200"); // isn't used in cache loading + content.first.setRawHeaders(rawHeaders); + content.first.setExpirationDate(future); + + QByteArray reply206 = + "HTTP/1.0 206\r\n" + "Connection: keep-alive\r\n" + "Content-Type: text/plain\r\n" + "Cache-control: no-cache\r\n" + "Content-Range: bytes 2-6/8\r\n" + "Content-length: 4\r\n" + "\r\n" + "load"; + + QTest::newRow("partial,dontuse-cache") + << reply206 << "load" << content << int(QNetworkRequest::PreferCache) << (QStringList() << "Range" << "bytes=2-6") << false << true; } void tst_QNetworkReply::ioGetFromHttpWithCache() @@ -2784,6 +2807,15 @@ void tst_QNetworkReply::ioGetFromHttpWithCache() QNetworkRequest request(url); request.setAttribute(QNetworkRequest::CacheLoadControlAttribute, cacheMode); request.setAttribute(QNetworkRequest::CacheSaveControlAttribute, false); + + QFETCH(QStringList, extraHttpHeaders); + QStringListIterator it(extraHttpHeaders); + while (it.hasNext()) { + QString header = it.next(); + QString value = it.next(); + request.setRawHeader(header.toLatin1(), value.toLatin1()); // To latin1? Deal with it! + } + QNetworkReplyPtr reply = manager.get(request); connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); -- cgit v0.12 From 268394b854766855c7ce5697bbc079a6974ad866 Mon Sep 17 00:00:00 2001 From: Simon Hausmann <simon.hausmann@nokia.com> Date: Thu, 17 Mar 2011 15:19:25 +0100 Subject: Fix accidental population of the disk cache with partial content Since the disk cache does not support partial content, we should not try to store it in the cache altogether. Done-with: Jocelyn Turcotte Reviewed-by: Markus Goetz Reviewed-by: Peter Hartmann --- src/network/access/qnetworkreplyimpl.cpp | 7 ++ tests/auto/qnetworkreply/tst_qnetworkreply.cpp | 93 ++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) diff --git a/src/network/access/qnetworkreplyimpl.cpp b/src/network/access/qnetworkreplyimpl.cpp index 343f344..894df79 100644 --- a/src/network/access/qnetworkreplyimpl.cpp +++ b/src/network/access/qnetworkreplyimpl.cpp @@ -505,6 +505,13 @@ void QNetworkReplyImplPrivate::initCacheSaveDevice() { Q_Q(QNetworkReplyImpl); + // The disk cache does not support partial content, so don't even try to + // save any such content into the cache. + if (q->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt() == 206) { + cacheEnabled = false; + return; + } + // save the meta data QNetworkCacheMetaData metaData; metaData.setUrl(url); diff --git a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp index 4338e74..81278b6 100644 --- a/tests/auto/qnetworkreply/tst_qnetworkreply.cpp +++ b/tests/auto/qnetworkreply/tst_qnetworkreply.cpp @@ -333,6 +333,8 @@ private Q_SLOTS: void synchronousRequest(); void synchronousRequestSslFailure(); + void dontInsertPartialContentIntoTheCache(); + // NOTE: This test must be last! void parentingRepliesToTheApp(); }; @@ -573,6 +575,63 @@ public: Q_DECLARE_METATYPE(MyMemoryCache::CachedContent) Q_DECLARE_METATYPE(MyMemoryCache::CacheData) +class MySpyMemoryCache: public QAbstractNetworkCache +{ +public: + MySpyMemoryCache(QObject *parent) : QAbstractNetworkCache(parent) {} + ~MySpyMemoryCache() + { + qDeleteAll(m_buffers); + m_buffers.clear(); + } + + QHash<QUrl, QIODevice*> m_buffers; + QList<QUrl> m_insertedUrls; + + QNetworkCacheMetaData metaData(const QUrl &) + { + return QNetworkCacheMetaData(); + } + + void updateMetaData(const QNetworkCacheMetaData &) + { + } + + QIODevice *data(const QUrl &) + { + return 0; + } + + bool remove(const QUrl &url) + { + delete m_buffers.take(url); + return m_insertedUrls.removeAll(url) > 0; + } + + qint64 cacheSize() const + { + return 0; + } + + QIODevice *prepare(const QNetworkCacheMetaData &metaData) + { + QBuffer* buffer = new QBuffer; + buffer->open(QIODevice::ReadWrite); + buffer->setProperty("url", metaData.url()); + m_buffers.insert(metaData.url(), buffer); + return buffer; + } + + void insert(QIODevice *buffer) + { + QUrl url = buffer->property("url").toUrl(); + m_insertedUrls << url; + delete m_buffers.take(url); + } + + void clear() { m_insertedUrls.clear(); } +}; + class DataReader: public QObject { Q_OBJECT @@ -5275,6 +5334,39 @@ void tst_QNetworkReply::synchronousRequestSslFailure() QCOMPARE(sslErrorsSpy.count(), 0); } +void tst_QNetworkReply::dontInsertPartialContentIntoTheCache() +{ + QByteArray reply206 = + "HTTP/1.0 206\r\n" + "Connection: keep-alive\r\n" + "Content-Type: text/plain\r\n" + "Cache-control: no-cache\r\n" + "Content-Range: bytes 2-6/8\r\n" + "Content-length: 4\r\n" + "\r\n" + "load"; + + MiniHttpServer server(reply206); + server.doClose = false; + + MySpyMemoryCache *memoryCache = new MySpyMemoryCache(&manager); + manager.setCache(memoryCache); + + QUrl url = "http://localhost:" + QString::number(server.serverPort()); + QNetworkRequest request(url); + request.setRawHeader("Range", "bytes=2-6"); + + QNetworkReplyPtr reply = manager.get(request); + + connect(reply, SIGNAL(finished()), &QTestEventLoop::instance(), SLOT(exitLoop())); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + + QVERIFY(server.totalConnections > 0); + QCOMPARE(reply->readAll().constData(), "load"); + QCOMPARE(memoryCache->m_insertedUrls.count(), 0); +} + // NOTE: This test must be last testcase in tst_qnetworkreply! void tst_QNetworkReply::parentingRepliesToTheApp() { @@ -5284,4 +5376,5 @@ void tst_QNetworkReply::parentingRepliesToTheApp() } QTEST_MAIN(tst_QNetworkReply) + #include "tst_qnetworkreply.moc" -- cgit v0.12 From ce33fe15dde2151905839196da9927f4c19b18be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B8rgen=20Lind?= <jorgen.lind@nokia.com> Date: Thu, 17 Mar 2011 17:12:38 +0100 Subject: Fixes detected by the static-check This included added a license header on a moc file. Its nasty, but has to stay like that until we have a better sollution for generating moc files on uikit --- src/gui/kernel/qplatformintegration_qpa.h | 2 +- .../platforms/uikit/examples/qmltest/main.mm | 45 +++++++++++++++++++++- .../moc_qmlapplicationviewer.cpp | 41 ++++++++++++++++++++ src/plugins/platforms/xcb/qxcbscreen.cpp | 2 +- 4 files changed, 86 insertions(+), 4 deletions(-) diff --git a/src/gui/kernel/qplatformintegration_qpa.h b/src/gui/kernel/qplatformintegration_qpa.h index e76d077..0aacefa 100644 --- a/src/gui/kernel/qplatformintegration_qpa.h +++ b/src/gui/kernel/qplatformintegration_qpa.h @@ -98,7 +98,7 @@ public: //jl:XXX should it be hasGLContext and do we need it at all? virtual bool hasOpenGL() const; -// Access native handles. The window handle is allready available from Wid; +// Access native handles. The window handle is already available from Wid; virtual QPlatformNativeInterface *nativeInterface() const; }; diff --git a/src/plugins/platforms/uikit/examples/qmltest/main.mm b/src/plugins/platforms/uikit/examples/qmltest/main.mm index d90be56..6fd5629 100644 --- a/src/plugins/platforms/uikit/examples/qmltest/main.mm +++ b/src/plugins/platforms/uikit/examples/qmltest/main.mm @@ -1,3 +1,44 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + // // main.m // qmltest @@ -16,9 +57,9 @@ Q_IMPORT_PLUGIN(UIKit) int main(int argc, char *argv[]) { - + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; - + setenv("QT_QPA_PLATFORM","uikit",1); QApplication app(argc, argv); diff --git a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp index 7733ce2..a2b40ec 100644 --- a/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp +++ b/src/plugins/platforms/uikit/examples/qmltest/qmlapplicationviewer/moc_qmlapplicationviewer.cpp @@ -1,4 +1,45 @@ /**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the plugins of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +/**************************************************************************** ** Meta object code from reading C++ file 'qmlapplicationviewer.h' ** ** Created: Fri Feb 18 17:53:42 2011 diff --git a/src/plugins/platforms/xcb/qxcbscreen.cpp b/src/plugins/platforms/xcb/qxcbscreen.cpp index 53b0563..fffeb2e 100644 --- a/src/plugins/platforms/xcb/qxcbscreen.cpp +++ b/src/plugins/platforms/xcb/qxcbscreen.cpp @@ -49,7 +49,7 @@ QXcbScreen::QXcbScreen(QXcbConnection *connection, xcb_screen_t *screen, int num , m_number(number) { printf ("\n"); - printf ("Informations of screen %d:\n", screen->root); + printf ("Information of screen %d:\n", screen->root); printf (" width.........: %d\n", screen->width_in_pixels); printf (" height........: %d\n", screen->height_in_pixels); printf (" depth.........: %d\n", screen->root_depth); -- cgit v0.12 From 5e2f4be486140d694c0acccbfc7a55fc7c104c61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <samuel.rodal@nokia.com> Date: Thu, 17 Mar 2011 12:03:06 +0100 Subject: Switch to raster also when last window is destroyed (on MeeGo). This will save GPU resources for applications that are in the background for most of the time and only show a window now and then. Reviewed-by: Armin Berres --- .../graphicssystems/meego/qmeegographicssystem.cpp | 39 +++++++++++++++++++++- 1 file changed, 38 insertions(+), 1 deletion(-) diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp index 18a0944..cb66695 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp @@ -59,6 +59,8 @@ #include "qmeegographicssystem.h" #include "qmeegoextensions.h" +#include <QTimer> + bool QMeeGoGraphicsSystem::surfaceWasCreated = false; QHash <Qt::HANDLE, QPixmap*> QMeeGoGraphicsSystem::liveTexturePixmaps; @@ -85,8 +87,12 @@ public: void addWidget(QWidget *widget); bool eventFilter(QObject *, QEvent *); + void handleMapNotify(); + private slots: void removeWidget(QObject *object); + void switchToRaster(); + void switchToMeeGo(); private: int visibleWidgets() const; @@ -95,22 +101,46 @@ private: QList<QWidget *> m_widgets; }; +typedef bool(*QX11FilterFunction)(XEvent *event); +Q_GUI_EXPORT void qt_installX11EventFilter(QX11FilterFunction func); + +static bool x11EventFilter(XEvent *event); + QMeeGoGraphicsSystemSwitchHandler::QMeeGoGraphicsSystemSwitchHandler() { + qt_installX11EventFilter(x11EventFilter); } void QMeeGoGraphicsSystemSwitchHandler::addWidget(QWidget *widget) { - if (!m_widgets.contains(widget)) { + if (widget != qt_gl_share_widget() && !m_widgets.contains(widget)) { widget->installEventFilter(this); connect(widget, SIGNAL(destroyed(QObject *)), this, SLOT(removeWidget(QObject *))); m_widgets << widget; } } +void QMeeGoGraphicsSystemSwitchHandler::handleMapNotify() +{ + if (m_widgets.isEmpty()) + QTimer::singleShot(0, this, SLOT(switchToMeeGo())); +} + void QMeeGoGraphicsSystemSwitchHandler::removeWidget(QObject *object) { m_widgets.removeOne(static_cast<QWidget *>(object)); + if (m_widgets.isEmpty()) + QTimer::singleShot(0, this, SLOT(switchToRaster())); +} + +void QMeeGoGraphicsSystemSwitchHandler::switchToRaster() +{ + QMeeGoGraphicsSystem::switchToRaster(); +} + +void QMeeGoGraphicsSystemSwitchHandler::switchToMeeGo() +{ + QMeeGoGraphicsSystem::switchToMeeGo(); } int QMeeGoGraphicsSystemSwitchHandler::visibleWidgets() const @@ -148,6 +178,13 @@ bool QMeeGoGraphicsSystemSwitchHandler::eventFilter(QObject *object, QEvent *eve Q_GLOBAL_STATIC(QMeeGoGraphicsSystemSwitchHandler, switch_handler) +bool x11EventFilter(XEvent *event) +{ + if (event->type == MapNotify) + switch_handler()->handleMapNotify(); + return false; +} + QWindowSurface* QMeeGoGraphicsSystem::createWindowSurface(QWidget *widget) const { QGLWidget *shareWidget = qt_gl_share_widget(); -- cgit v0.12 From 3fb5fce61b6f64534ad292a78250e4256a6514b6 Mon Sep 17 00:00:00 2001 From: Robin Burchell <robin.burchell@collabora.co.uk> Date: Thu, 17 Mar 2011 18:32:58 +0100 Subject: Changes to driver workarounds. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Force enable brokenFBOReadBack on non-Nokia v1.4 SGX drivers (as this is apparantly not fixed, except on the Nokia drivers) - Add debug when workarounds are enabled to ease debugging This fixes the following MeeGo bug: https://bugs.meego.com/show_bug.cgi?id=5616 Merge-request: 1144 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com> --- src/opengl/qgl_egl.cpp | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/src/opengl/qgl_egl.cpp b/src/opengl/qgl_egl.cpp index 674d80d..d6b2d3b 100644 --- a/src/opengl/qgl_egl.cpp +++ b/src/opengl/qgl_egl.cpp @@ -39,6 +39,7 @@ ** ****************************************************************************/ +#include <QtCore/qdebug.h> #include <QtOpenGL/qgl.h> #include <QtOpenGL/qglpixelbuffer.h> #include "qgl_p.h" @@ -195,6 +196,7 @@ void QGLContext::makeCurrent() // PowerVR MBX/SGX chips needs to clear all buffers when starting to render // a new frame, otherwise there will be a performance penalty to pay for // each frame. + qDebug() << "Found SGX/MBX driver, enabling FullClearOnEveryFrame"; d->workaround_needsFullClearOnEveryFrame = true; // Older PowerVR SGX drivers (like the one in the N900) have a @@ -202,10 +204,31 @@ void QGLContext::makeCurrent() // or GL_ALPHA texture bound to an FBO. The only way to // identify that driver is to check the EGL version number for it. const char *egl_version = eglQueryString(d->eglContext->display(), EGL_VERSION); - if (egl_version && strstr(egl_version, "1.3")) + + if (egl_version && strstr(egl_version, "1.3")) { + qDebug() << "Found v1.3 driver, enabling brokenFBOReadBack"; d->workaround_brokenFBOReadBack = true; - else if (egl_version && strstr(egl_version, "1.4")) + } else if (egl_version && strstr(egl_version, "1.4")) { + qDebug() << "Found v1.4 driver, enabling brokenTexSubImage"; d->workaround_brokenTexSubImage = true; + + // this is a bit complicated; 1.4 version SGX drivers from + // Nokia have fixed the brokenFBOReadBack problem, but + // official drivers from TI haven't, meaning that things + // like the beagleboard are broken unless we hack around it + // - but at the same time, we want to not reduce performance + // by not enabling this elsewhere. + // + // so, let's check for a Nokia-specific addon, and only + // enable if it isn't present. + // (see MeeGo bug #5616) + if (!QEgl::hasExtension("EGL_NOK_image_shared")) { + // no Nokia extension, this is probably a standard SGX + // driver, so enable the workaround + qDebug() << "Found non-Nokia v1.4 driver, enabling brokenFBOReadBack"; + d->workaround_brokenFBOReadBack = true; + } + } } } } -- cgit v0.12 From 9d39e3e9df50eec695608497533d0440cce3a03e Mon Sep 17 00:00:00 2001 From: Jani Hautakangas <jani.hautakangas@nokia.com> Date: Thu, 17 Mar 2011 19:36:09 +0100 Subject: Fix def files Reviewed-by: TRUSTME --- src/s60installs/bwins/QtGuiu.def | 770 ++++++++++++++++++++++++--------------- src/s60installs/eabi/QtGuiu.def | 617 ++++++++++++++++--------------- 2 files changed, 800 insertions(+), 587 deletions(-) diff --git a/src/s60installs/bwins/QtGuiu.def b/src/s60installs/bwins/QtGuiu.def index 68cdc9e..38bd760 100644 --- a/src/s60installs/bwins/QtGuiu.def +++ b/src/s60installs/bwins/QtGuiu.def @@ -5028,7 +5028,7 @@ EXPORTS ?hasSelection@QItemSelectionModel@@QBE_NXZ @ 5027 NONAME ; bool QItemSelectionModel::hasSelection(void) const ?hasSelection@QTextCursor@@QBE_NXZ @ 5028 NONAME ; bool QTextCursor::hasSelection(void) const ?hasStaticContents@QWindowSurface@@IBE_NXZ @ 5029 NONAME ; bool QWindowSurface::hasStaticContents(void) const - ?hasStaticContentsSupport@QWindowSurface@@QBE_NXZ @ 5030 NONAME ; bool QWindowSurface::hasStaticContentsSupport(void) const + ?hasStaticContentsSupport@QWindowSurface@@UBE_NXZ @ 5030 NONAME ; bool QWindowSurface::hasStaticContentsSupport(void) const ?hasThemeIcon@QIcon@@SA_NABVQString@@@Z @ 5031 NONAME ; bool QIcon::hasThemeIcon(class QString const &) ?hasTracking@QAbstractSlider@@QBE_NXZ @ 5032 NONAME ; bool QAbstractSlider::hasTracking(void) const ?hasTranslateOnlySceneTransform@QGraphicsItemPrivate@@QAE_NXZ @ 5033 NONAME ; bool QGraphicsItemPrivate::hasTranslateOnlySceneTransform(void) @@ -9875,6 +9875,7 @@ EXPORTS ?setState@QPaintEngineEx@@UAEXPAVQPainterState@@@Z @ 9874 NONAME ; void QPaintEngineEx::setState(class QPainterState *) ?setState@TouchPoint@QTouchEvent@@QAEXV?$QFlags@W4TouchPointState@Qt@@@@@Z @ 9875 NONAME ; void QTouchEvent::TouchPoint::setState(class QFlags<enum Qt::TouchPointState>) ?setStaticContents@QWindowSurface@@QAEXABVQRegion@@@Z @ 9876 NONAME ; void QWindowSurface::setStaticContents(class QRegion const &) + ?setStaticContentsSupport@QWindowSurface@@IAEX_N@Z @ 9877 NONAME ABSENT ; void QWindowSurface::setStaticContentsSupport(bool) ?setStatus@QPictureIO@@QAEXH@Z @ 9878 NONAME ; void QPictureIO::setStatus(int) ?setStatusBar@QMainWindow@@QAEXPAVQStatusBar@@@Z @ 9879 NONAME ; void QMainWindow::setStatusBar(class QStatusBar *) ?setStatusTip@QAction@@QAEXABVQString@@@Z @ 9880 NONAME ; void QAction::setStatusTip(class QString const &) @@ -12650,6 +12651,7 @@ EXPORTS ?toImage@QRuntimePixmapData@@UBE?AVQImage@@XZ @ 12650 NONAME ; class QImage QRuntimePixmapData::toImage(void) const ??0QAbstractScrollAreaPrivate@@QAE@XZ @ 12651 NONAME ; QAbstractScrollAreaPrivate::QAbstractScrollAreaPrivate(void) ?resizeEvent@QSplitterHandle@@MAEXPAVQResizeEvent@@@Z @ 12652 NONAME ; void QSplitterHandle::resizeEvent(class QResizeEvent *) + ?setPartialUpdateSupport@QWindowSurface@@IAEX_N@Z @ 12653 NONAME ABSENT ; void QWindowSurface::setPartialUpdateSupport(bool) ?HandleForegroundEventL@QS60MainAppUi@@MAEXH@Z @ 12654 NONAME ; void QS60MainAppUi::HandleForegroundEventL(int) ?curveThreshold@QStrokerOps@@QBEMXZ @ 12655 NONAME ; float QStrokerOps::curveThreshold(void) const ?createTextureData@QImageTextureGlyphCache@@UAEXHH@Z @ 12656 NONAME ; void QImageTextureGlyphCache::createTextureData(int, int) @@ -12851,7 +12853,7 @@ EXPORTS ?updateAll@QGraphicsViewPrivate@@QAEXXZ @ 12852 NONAME ; void QGraphicsViewPrivate::updateAll(void) ?updateMicroFocus@QGraphicsItem@@IAEXXZ @ 12853 NONAME ; void QGraphicsItem::updateMicroFocus(void) ?populate@QTextureGlyphCache@@QAEXPAVQFontEngine@@HPBIPBUQFixedPoint@@@Z @ 12854 NONAME ABSENT ; void QTextureGlyphCache::populate(class QFontEngine *, int, unsigned int const *, struct QFixedPoint const *) - ?hasPartialUpdateSupport@QWindowSurface@@QBE_NXZ @ 12855 NONAME ; bool QWindowSurface::hasPartialUpdateSupport(void) const + ?hasPartialUpdateSupport@QWindowSurface@@UBE_NXZ @ 12855 NONAME ; bool QWindowSurface::hasPartialUpdateSupport(void) const ?scroll@QRuntimePixmapData@@UAE_NHHABVQRect@@@Z @ 12856 NONAME ; bool QRuntimePixmapData::scroll(int, int, class QRect const &) ?qt_draw_glyphs@@YAXPAVQPainter@@PBIPBVQPointF@@H@Z @ 12857 NONAME ; void qt_draw_glyphs(class QPainter *, unsigned int const *, class QPointF const *, int) ?nativeDisplay@QEgl@@YAHXZ @ 12858 NONAME ; int QEgl::nativeDisplay(void) @@ -12903,302 +12905,470 @@ EXPORTS ?reactivateDeferredActiveObjects@QEventDispatcherS60@@UAEXXZ @ 12904 NONAME ; void QEventDispatcherS60::reactivateDeferredActiveObjects(void) ?userData@QStaticTextItem@@QBEPAVQStaticTextUserData@@XZ @ 12905 NONAME ; class QStaticTextUserData * QStaticTextItem::userData(void) const ?populate@QTextureGlyphCache@@QAE_NPAVQFontEngine@@HPBIPBUQFixedPoint@@@Z @ 12906 NONAME ; bool QTextureGlyphCache::populate(class QFontEngine *, int, unsigned int const *, struct QFixedPoint const *) - ?clipEnabledChanged@QBlitterPaintEngine@@UAEXXZ @ 12907 NONAME ; void QBlitterPaintEngine::clipEnabledChanged(void) - ?supportsSubPixelPositions@QFontEngine@@UBE_NXZ @ 12908 NONAME ; bool QFontEngine::supportsSubPixelPositions(void) const - ?heightForWidth@QTabWidget@@UBEHH@Z @ 12909 NONAME ; int QTabWidget::heightForWidth(int) const - ??0QRasterWindowSurface@@QAE@PAVQWidget@@_N@Z @ 12910 NONAME ; QRasterWindowSurface::QRasterWindowSurface(class QWidget *, bool) - ?brushChanged@QBlitterPaintEngine@@UAEXXZ @ 12911 NONAME ; void QBlitterPaintEngine::brushChanged(void) - ?clip@QBlitterPaintEngine@@UAEXABVQRect@@W4ClipOperation@Qt@@@Z @ 12912 NONAME ; void QBlitterPaintEngine::clip(class QRect const &, enum Qt::ClipOperation) - ?detach@QGlyphs@@AAEXXZ @ 12913 NONAME ; void QGlyphs::detach(void) - ?capabilities@QBlittable@@QBE?AV?$QFlags@W4Capability@QBlittable@@@@XZ @ 12914 NONAME ; class QFlags<enum QBlittable::Capability> QBlittable::capabilities(void) const - ?swap@QBrush@@QAEXAAV1@@Z @ 12915 NONAME ; void QBrush::swap(class QBrush &) - ?swap@QPixmap@@QAEXAAV1@@Z @ 12916 NONAME ; void QPixmap::swap(class QPixmap &) - ??0QBlitterPaintEngine@@QAE@PAVQBlittablePixmapData@@@Z @ 12917 NONAME ; QBlitterPaintEngine::QBlitterPaintEngine(class QBlittablePixmapData *) - ?numberPrefix@QTextListFormat@@QBE?AVQString@@XZ @ 12918 NONAME ; class QString QTextListFormat::numberPrefix(void) const - ??MQItemSelectionRange@@QBE_NABV0@@Z @ 12919 NONAME ; bool QItemSelectionRange::operator<(class QItemSelectionRange const &) const - ?setWidthForHeight@QSizePolicy@@QAEX_N@Z @ 12920 NONAME ; void QSizePolicy::setWidthForHeight(bool) - ?qt_fontdata_from_index@@YA?AVQByteArray@@H@Z @ 12921 NONAME ; class QByteArray qt_fontdata_from_index(int) - ?swap@QImage@@QAEXAAV1@@Z @ 12922 NONAME ; void QImage::swap(class QImage &) - ?compositionModeChanged@QBlitterPaintEngine@@UAEXXZ @ 12923 NONAME ; void QBlitterPaintEngine::compositionModeChanged(void) - ?drawRects@QBlitterPaintEngine@@UAEXPBVQRectF@@H@Z @ 12924 NONAME ; void QBlitterPaintEngine::drawRects(class QRectF const *, int) - ??1QBlitterPaintEngine@@UAE@XZ @ 12925 NONAME ; QBlitterPaintEngine::~QBlitterPaintEngine(void) - ?markRasterOverlay@QBlittablePixmapData@@QAEXPBVQRectF@@H@Z @ 12926 NONAME ; void QBlittablePixmapData::markRasterOverlay(class QRectF const *, int) - ?drawTextItem@QBlitterPaintEngine@@UAEXABVQPointF@@ABVQTextItem@@@Z @ 12927 NONAME ; void QBlitterPaintEngine::drawTextItem(class QPointF const &, class QTextItem const &) - ??8QGlyphs@@QBE_NABV0@@Z @ 12928 NONAME ; bool QGlyphs::operator==(class QGlyphs const &) const - ?drawImage@QBlitterPaintEngine@@UAEXABVQRectF@@ABVQImage@@0V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 12929 NONAME ; void QBlitterPaintEngine::drawImage(class QRectF const &, class QImage const &, class QRectF const &, class QFlags<enum Qt::ImageConversionFlag>) - ?mimeTypes@QAbstractProxyModel@@UBE?AVQStringList@@XZ @ 12930 NONAME ; class QStringList QAbstractProxyModel::mimeTypes(void) const - ?createState@QBlitterPaintEngine@@UBEPAVQPainterState@@PAV2@@Z @ 12931 NONAME ; class QPainterState * QBlitterPaintEngine::createState(class QPainterState *) const - ?removeItem@QGraphicsGridLayout@@QAEXPAVQGraphicsLayoutItem@@@Z @ 12932 NONAME ; void QGraphicsGridLayout::removeItem(class QGraphicsLayoutItem *) - ?clipBoundingRect@QPainter@@QBE?AVQRectF@@XZ @ 12933 NONAME ; class QRectF QPainter::clipBoundingRect(void) const - ?raster@QBlitterPaintEngine@@ABEPAVQRasterPaintEngine@@XZ @ 12934 NONAME ; class QRasterPaintEngine * QBlitterPaintEngine::raster(void) const - ?sort@QAbstractProxyModel@@UAEXHW4SortOrder@Qt@@@Z @ 12935 NONAME ; void QAbstractProxyModel::sort(int, enum Qt::SortOrder) - ?d_func@QBlittable@@AAEPAVQBlittablePrivate@@XZ @ 12936 NONAME ; class QBlittablePrivate * QBlittable::d_func(void) - ?type@QBlitterPaintEngine@@UBE?AW4Type@QPaintEngine@@XZ @ 12937 NONAME ; enum QPaintEngine::Type QBlitterPaintEngine::type(void) const - ?buddy@QAbstractProxyModel@@UBE?AVQModelIndex@@ABV2@@Z @ 12938 NONAME ; class QModelIndex QAbstractProxyModel::buddy(class QModelIndex const &) const - ?fill@QImage@@QAEXABVQColor@@@Z @ 12939 NONAME ; void QImage::fill(class QColor const &) - ?fill@QImage@@QAEXW4GlobalColor@Qt@@@Z @ 12940 NONAME ; void QImage::fill(enum Qt::GlobalColor) - ?canFetchMore@QAbstractProxyModel@@UBE_NABVQModelIndex@@@Z @ 12941 NONAME ; bool QAbstractProxyModel::canFetchMore(class QModelIndex const &) const - ?setFont@QGlyphs@@QAEXABVQFont@@@Z @ 12942 NONAME ; void QGlyphs::setFont(class QFont const &) - ?resize@QBlittablePixmapData@@UAEXHH@Z @ 12943 NONAME ; void QBlittablePixmapData::resize(int, int) - ?getText@QInputDialog@@SA?AVQString@@PAVQWidget@@ABV2@1W4EchoMode@QLineEdit@@1PA_NV?$QFlags@W4WindowType@Qt@@@@V?$QFlags@W4InputMethodHint@Qt@@@@@Z @ 12944 NONAME ; class QString QInputDialog::getText(class QWidget *, class QString const &, class QString const &, enum QLineEdit::EchoMode, class QString const &, bool *, class QFlags<enum Qt::WindowType>, class QFlags<enum Qt::InputMethodHint>) - ?hasWidthForHeight@QSizePolicy@@QBE_NXZ @ 12945 NONAME ; bool QSizePolicy::hasWidthForHeight(void) const - ?transformChanged@QBlitterPaintEngine@@UAEXXZ @ 12946 NONAME ; void QBlitterPaintEngine::transformChanged(void) - ??0QBlittablePixmapData@@QAE@XZ @ 12947 NONAME ; QBlittablePixmapData::QBlittablePixmapData(void) - ?size@QBlittable@@QBE?AVQSize@@XZ @ 12948 NONAME ; class QSize QBlittable::size(void) const - ?setBlittable@QBlittablePixmapData@@QAEXPAVQBlittable@@@Z @ 12949 NONAME ; void QBlittablePixmapData::setBlittable(class QBlittable *) - ?opacityChanged@QBlitterPaintEngine@@UAEXXZ @ 12950 NONAME ; void QBlitterPaintEngine::opacityChanged(void) - ?createExplicitFontWithName@QFontEngine@@IBE?AVQFont@@ABVQString@@@Z @ 12951 NONAME ; class QFont QFontEngine::createExplicitFontWithName(class QString const &) const - ?setState@QBlitterPaintEngine@@UAEXPAVQPainterState@@@Z @ 12952 NONAME ; void QBlitterPaintEngine::setState(class QPainterState *) - ?clip@QBlitterPaintEngine@@UAEXABVQRegion@@W4ClipOperation@Qt@@@Z @ 12953 NONAME ; void QBlitterPaintEngine::clip(class QRegion const &, enum Qt::ClipOperation) - ?subPixelPositionForX@QTextureGlyphCache@@QBE?AUQFixed@@U2@@Z @ 12954 NONAME ; struct QFixed QTextureGlyphCache::subPixelPositionForX(struct QFixed) const - ?hasAlphaChannel@QBlittablePixmapData@@UBE_NXZ @ 12955 NONAME ; bool QBlittablePixmapData::hasAlphaChannel(void) const - ?numberSuffix@QTextListFormat@@QBE?AVQString@@XZ @ 12956 NONAME ; class QString QTextListFormat::numberSuffix(void) const - ??HQGlyphs@@ABE?AV0@ABV0@@Z @ 12957 NONAME ; class QGlyphs QGlyphs::operator+(class QGlyphs const &) const - ?end@QBlitterPaintEngine@@UAE_NXZ @ 12958 NONAME ; bool QBlitterPaintEngine::end(void) - ?fill@QBlitterPaintEngine@@UAEXABVQVectorPath@@ABVQBrush@@@Z @ 12959 NONAME ; void QBlitterPaintEngine::fill(class QVectorPath const &, class QBrush const &) - ?drawPixmap@QBlitterPaintEngine@@UAEXABVQRectF@@ABVQPixmap@@0@Z @ 12960 NONAME ; void QBlitterPaintEngine::drawPixmap(class QRectF const &, class QPixmap const &, class QRectF const &) - ?glyphIndexes@QGlyphs@@QBE?AV?$QVector@I@@XZ @ 12961 NONAME ; class QVector<unsigned int> QGlyphs::glyphIndexes(void) const - ?get@QFontPrivate@@SAPAV1@ABVQFont@@@Z @ 12962 NONAME ; class QFontPrivate * QFontPrivate::get(class QFont const &) - ?fetchMore@QAbstractProxyModel@@UAEXABVQModelIndex@@@Z @ 12963 NONAME ; void QAbstractProxyModel::fetchMore(class QModelIndex const &) - ?glyphs@QTextLine@@ABE?AV?$QList@VQGlyphs@@@@HH@Z @ 12964 NONAME ; class QList<class QGlyphs> QTextLine::glyphs(int, int) const - ?alphaRGBMapForGlyph@QFontEngine@@UAE?AVQImage@@IUQFixed@@HABVQTransform@@@Z @ 12965 NONAME ; class QImage QFontEngine::alphaRGBMapForGlyph(unsigned int, struct QFixed, int, class QTransform const &) - ?swap@QBitmap@@QAEXAAV1@@Z @ 12966 NONAME ; void QBitmap::swap(class QBitmap &) - ??0QWindowSurface@@QAE@PAVQWidget@@_N@Z @ 12967 NONAME ; QWindowSurface::QWindowSurface(class QWidget *, bool) - ?fill@QBlittablePixmapData@@UAEXABVQColor@@@Z @ 12968 NONAME ; void QBlittablePixmapData::fill(class QColor const &) - ?metric@QBlittablePixmapData@@UBEHW4PaintDeviceMetric@QPaintDevice@@@Z @ 12969 NONAME ; int QBlittablePixmapData::metric(enum QPaintDevice::PaintDeviceMetric) const - ?fillRect@QBlitterPaintEngine@@UAEXABVQRectF@@ABVQColor@@@Z @ 12970 NONAME ; void QBlitterPaintEngine::fillRect(class QRectF const &, class QColor const &) - ??6@YA?AVQDebug@@V0@PBVQSymbianEvent@@@Z @ 12971 NONAME ; class QDebug operator<<(class QDebug, class QSymbianEvent const *) - ??_EQBlittablePixmapData@@UAE@I@Z @ 12972 NONAME ; QBlittablePixmapData::~QBlittablePixmapData(unsigned int) - ?mimeData@QAbstractProxyModel@@UBEPAVQMimeData@@ABV?$QList@VQModelIndex@@@@@Z @ 12973 NONAME ; class QMimeData * QAbstractProxyModel::mimeData(class QList<class QModelIndex> const &) const - ?minimumSizeHint@QRadioButton@@UBE?AVQSize@@XZ @ 12974 NONAME ; class QSize QRadioButton::minimumSizeHint(void) const - ?setPositions@QGlyphs@@QAEXABV?$QVector@VQPointF@@@@@Z @ 12975 NONAME ; void QGlyphs::setPositions(class QVector<class QPointF> const &) - ?drawRects@QBlitterPaintEngine@@UAEXPBVQRect@@H@Z @ 12976 NONAME ; void QBlitterPaintEngine::drawRects(class QRect const *, int) - ?fillInPendingGlyphs@QTextureGlyphCache@@QAEXXZ @ 12977 NONAME ; void QTextureGlyphCache::fillInPendingGlyphs(void) - ?renderHintsChanged@QBlitterPaintEngine@@UAEXXZ @ 12978 NONAME ; void QBlitterPaintEngine::renderHintsChanged(void) - ?supportedDropActions@QAbstractProxyModel@@UBE?AV?$QFlags@W4DropAction@Qt@@@@XZ @ 12979 NONAME ; class QFlags<enum Qt::DropAction> QAbstractProxyModel::supportedDropActions(void) const - ?fillRect@QBlitterPaintEngine@@UAEXABVQRectF@@ABVQBrush@@@Z @ 12980 NONAME ; void QBlitterPaintEngine::fillRect(class QRectF const &, class QBrush const &) - ?setGlyphIndexes@QGlyphs@@QAEXABV?$QVector@I@@@Z @ 12981 NONAME ; void QGlyphs::setGlyphIndexes(class QVector<unsigned int> const &) - ?alphaMapBoundingBox@QFontEngine@@UAE?AUglyph_metrics_t@@IABVQTransform@@W4GlyphFormat@1@@Z @ 12982 NONAME ; struct glyph_metrics_t QFontEngine::alphaMapBoundingBox(unsigned int, class QTransform const &, enum QFontEngine::GlyphFormat) - ?d_func@QBlittable@@ABEPBVQBlittablePrivate@@XZ @ 12983 NONAME ; class QBlittablePrivate const * QBlittable::d_func(void) const - ?state@QBlitterPaintEngine@@QBEPBVQPainterState@@XZ @ 12984 NONAME ; class QPainterState const * QBlitterPaintEngine::state(void) const - ?clear@QGlyphs@@QAEXXZ @ 12985 NONAME ; void QGlyphs::clear(void) - ??1QBlittablePixmapData@@UAE@XZ @ 12986 NONAME ; QBlittablePixmapData::~QBlittablePixmapData(void) - ?font@QGlyphs@@QBE?AVQFont@@XZ @ 12987 NONAME ; class QFont QGlyphs::font(void) const - ?paintEngine@QBlittablePixmapData@@UBEPAVQPaintEngine@@XZ @ 12988 NONAME ; class QPaintEngine * QBlittablePixmapData::paintEngine(void) const - ?hasChildren@QAbstractProxyModel@@UBE_NABVQModelIndex@@@Z @ 12989 NONAME ; bool QAbstractProxyModel::hasChildren(class QModelIndex const &) const - ?swap@QPen@@QAEXAAV1@@Z @ 12990 NONAME ; void QPen::swap(class QPen &) - ?span@QAbstractProxyModel@@UBE?AVQSize@@ABVQModelIndex@@@Z @ 12991 NONAME ; class QSize QAbstractProxyModel::span(class QModelIndex const &) const - ?textureMapForGlyph@QTextureGlyphCache@@QBE?AVQImage@@IUQFixed@@@Z @ 12992 NONAME ; class QImage QTextureGlyphCache::textureMapForGlyph(unsigned int, struct QFixed) const - ??0QGlyphs@@QAE@XZ @ 12993 NONAME ; QGlyphs::QGlyphs(void) - ?begin@QBlitterPaintEngine@@UAE_NPAVQPaintDevice@@@Z @ 12994 NONAME ; bool QBlitterPaintEngine::begin(class QPaintDevice *) - ?inFontUcs4@QFontMetricsF@@QBE_NI@Z @ 12995 NONAME ; bool QFontMetricsF::inFontUcs4(unsigned int) const - ?markRasterOverlay@QBlittablePixmapData@@QAEXABVQRectF@@@Z @ 12996 NONAME ; void QBlittablePixmapData::markRasterOverlay(class QRectF const &) - ?d_func@QBlitterPaintEngine@@AAEPAVQBlitterPaintEnginePrivate@@XZ @ 12997 NONAME ; class QBlitterPaintEnginePrivate * QBlitterPaintEngine::d_func(void) - ?setNumberPrefix@QTextListFormat@@QAEXABVQString@@@Z @ 12998 NONAME ; void QTextListFormat::setNumberPrefix(class QString const &) - ?getItem@QInputDialog@@SA?AVQString@@PAVQWidget@@ABV2@1ABVQStringList@@H_NPA_NV?$QFlags@W4WindowType@Qt@@@@V?$QFlags@W4InputMethodHint@Qt@@@@@Z @ 12999 NONAME ; class QString QInputDialog::getItem(class QWidget *, class QString const &, class QString const &, class QStringList const &, int, bool, bool *, class QFlags<enum Qt::WindowType>, class QFlags<enum Qt::InputMethodHint>) - ?clip@QBlitterPaintEngine@@UAEXABVQVectorPath@@W4ClipOperation@Qt@@@Z @ 13000 NONAME ; void QBlitterPaintEngine::clip(class QVectorPath const &, enum Qt::ClipOperation) - ?positions@QGlyphs@@QBE?AV?$QVector@VQPointF@@@@XZ @ 13001 NONAME ; class QVector<class QPointF> QGlyphs::positions(void) const - ?glyphs@QTextLayout@@QBE?AV?$QList@VQGlyphs@@@@XZ @ 13002 NONAME ; class QList<class QGlyphs> QTextLayout::glyphs(void) const - ?alphaMapForGlyph@QFontEngine@@UAE?AVQImage@@IUQFixed@@ABVQTransform@@@Z @ 13003 NONAME ; class QImage QFontEngine::alphaMapForGlyph(unsigned int, struct QFixed, class QTransform const &) - ?fromImage@QBlittablePixmapData@@UAEXABVQImage@@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 13004 NONAME ; void QBlittablePixmapData::fromImage(class QImage const &, class QFlags<enum Qt::ImageConversionFlag>) - ??4QGlyphs@@QAEAAV0@ABV0@@Z @ 13005 NONAME ; class QGlyphs & QGlyphs::operator=(class QGlyphs const &) - ??0QBlittable@@QAE@ABVQSize@@V?$QFlags@W4Capability@QBlittable@@@@@Z @ 13006 NONAME ; QBlittable::QBlittable(class QSize const &, class QFlags<enum QBlittable::Capability>) - ?markRasterOverlay@QBlittablePixmapData@@QAEXPBVQRect@@H@Z @ 13007 NONAME ; void QBlittablePixmapData::markRasterOverlay(class QRect const *, int) - ?calculateSubPixelPositionCount@QTextureGlyphCache@@IBEHI@Z @ 13008 NONAME ; int QTextureGlyphCache::calculateSubPixelPositionCount(unsigned int) const - ?glyphs@QTextFragment@@QBE?AV?$QList@VQGlyphs@@@@XZ @ 13009 NONAME ; class QList<class QGlyphs> QTextFragment::glyphs(void) const - ?resetInternalData@QAbstractProxyModel@@IAEXXZ @ 13010 NONAME ; void QAbstractProxyModel::resetInternalData(void) - ?markRasterOverlay@QBlittablePixmapData@@QAEXABVQVectorPath@@@Z @ 13011 NONAME ; void QBlittablePixmapData::markRasterOverlay(class QVectorPath const &) - ?clip@QBlitterPaintEngine@@QAEPBVQClipData@@XZ @ 13012 NONAME ; class QClipData const * QBlitterPaintEngine::clip(void) - ?setNumberSuffix@QTextListFormat@@QAEXABVQString@@@Z @ 13013 NONAME ; void QTextListFormat::setNumberSuffix(class QString const &) - ?swap@QPicture@@QAEXAAV1@@Z @ 13014 NONAME ; void QPicture::swap(class QPicture &) - ?swap@QPainterPath@@QAEXAAV1@@Z @ 13015 NONAME ; void QPainterPath::swap(class QPainterPath &) - ?minimumSizeHint@QCheckBox@@UBE?AVQSize@@XZ @ 13016 NONAME ; class QSize QCheckBox::minimumSizeHint(void) const - ?createExplicitFont@QFontEngine@@UBE?AVQFont@@XZ @ 13017 NONAME ; class QFont QFontEngine::createExplicitFont(void) const - ?alphaMapForGlyph@QFontEngine@@UAE?AVQImage@@IUQFixed@@@Z @ 13018 NONAME ; class QImage QFontEngine::alphaMapForGlyph(unsigned int, struct QFixed) - ?fillTexture@QImageTextureGlyphCache@@UAEXABUCoord@QTextureGlyphCache@@IUQFixed@@@Z @ 13019 NONAME ; void QImageTextureGlyphCache::fillTexture(struct QTextureGlyphCache::Coord const &, unsigned int, struct QFixed) - ?swap@QIcon@@QAEXAAV1@@Z @ 13020 NONAME ; void QIcon::swap(class QIcon &) - ?unmarkRasterOverlay@QBlittablePixmapData@@QAEXABVQRectF@@@Z @ 13021 NONAME ; void QBlittablePixmapData::unmarkRasterOverlay(class QRectF const &) - ?brushOriginChanged@QBlitterPaintEngine@@UAEXXZ @ 13022 NONAME ; void QBlitterPaintEngine::brushOriginChanged(void) - ??0QApplicationPrivate@@QAE@AAHPAPADW4Type@QApplication@@H@Z @ 13023 NONAME ; QApplicationPrivate::QApplicationPrivate(int &, char * *, enum QApplication::Type, int) - ?inFontUcs4@QFontMetrics@@QBE_NI@Z @ 13024 NONAME ; bool QFontMetrics::inFontUcs4(unsigned int) const - ?unlock@QBlittable@@QAEXXZ @ 13025 NONAME ; void QBlittable::unlock(void) - ?swap@QRegion@@QAEXAAV1@@Z @ 13026 NONAME ; void QRegion::swap(class QRegion &) - ?setItemData@QAbstractProxyModel@@UAE_NABVQModelIndex@@ABV?$QMap@HVQVariant@@@@@Z @ 13027 NONAME ; bool QAbstractProxyModel::setItemData(class QModelIndex const &, class QMap<int, class QVariant> const &) - ?swap@QPolygonF@@QAEXAAV1@@Z @ 13028 NONAME ; void QPolygonF::swap(class QPolygonF &) - ?swap@QPolygon@@QAEXAAV1@@Z @ 13029 NONAME ; void QPolygon::swap(class QPolygon &) - ?d_func@QBlitterPaintEngine@@ABEPBVQBlitterPaintEnginePrivate@@XZ @ 13030 NONAME ; class QBlitterPaintEnginePrivate const * QBlitterPaintEngine::d_func(void) const - ?swap@QKeySequence@@QAEXAAV1@@Z @ 13031 NONAME ; void QKeySequence::swap(class QKeySequence &) - ??1QGlyphs@@QAE@XZ @ 13032 NONAME ; QGlyphs::~QGlyphs(void) - ?stroke@QBlitterPaintEngine@@UAEXABVQVectorPath@@ABVQPen@@@Z @ 13033 NONAME ; void QBlitterPaintEngine::stroke(class QVectorPath const &, class QPen const &) - ??9QGlyphs@@QBE_NABV0@@Z @ 13034 NONAME ; bool QGlyphs::operator!=(class QGlyphs const &) const - ??1QBlittable@@UAE@XZ @ 13035 NONAME ; QBlittable::~QBlittable(void) - ??_EQBlitterPaintEngine@@UAE@I@Z @ 13036 NONAME ; QBlitterPaintEngine::~QBlitterPaintEngine(unsigned int) - ?buffer@QBlittablePixmapData@@UAEPAVQImage@@XZ @ 13037 NONAME ; class QImage * QBlittablePixmapData::buffer(void) - ?drawStaticTextItem@QBlitterPaintEngine@@UAEXPAVQStaticTextItem@@@Z @ 13038 NONAME ; void QBlitterPaintEngine::drawStaticTextItem(class QStaticTextItem *) - ??0QGlyphs@@QAE@ABV0@@Z @ 13039 NONAME ; QGlyphs::QGlyphs(class QGlyphs const &) - ?lock@QBlittable@@QAEPAVQImage@@XZ @ 13040 NONAME ; class QImage * QBlittable::lock(void) - ?markRasterOverlay@QBlittablePixmapData@@QAEXABVQPointF@@ABVQTextItem@@@Z @ 13041 NONAME ; void QBlittablePixmapData::markRasterOverlay(class QPointF const &, class QTextItem const &) - ??YQGlyphs@@AAEAAV0@ABV0@@Z @ 13042 NONAME ; class QGlyphs & QGlyphs::operator+=(class QGlyphs const &) - ?drawEllipse@QBlitterPaintEngine@@UAEXABVQRectF@@@Z @ 13043 NONAME ; void QBlitterPaintEngine::drawEllipse(class QRectF const &) - ?blittable@QBlittablePixmapData@@QBEPAVQBlittable@@XZ @ 13044 NONAME ; class QBlittable * QBlittablePixmapData::blittable(void) const - ?resizeCache@QTextureGlyphCache@@QAEXHH@Z @ 13045 NONAME ; void QTextureGlyphCache::resizeCache(int, int) - ?state@QBlitterPaintEngine@@QAEPAVQPainterState@@XZ @ 13046 NONAME ; class QPainterState * QBlitterPaintEngine::state(void) - ?penChanged@QBlitterPaintEngine@@UAEXXZ @ 13047 NONAME ; void QBlitterPaintEngine::penChanged(void) - ?hasHeightForWidth@QWidgetPrivate@@UBE_NXZ @ 13048 NONAME ; bool QWidgetPrivate::hasHeightForWidth(void) const - ?toImage@QBlittablePixmapData@@UBE?AVQImage@@XZ @ 13049 NONAME ; class QImage QBlittablePixmapData::toImage(void) const - ??_EQBlittable@@UAE@I@Z @ 13050 NONAME ; QBlittable::~QBlittable(unsigned int) - ?qt_addBitmapToPath@@YAXMMPBEHHHPAVQPainterPath@@@Z @ 13051 NONAME ; void qt_addBitmapToPath(float, float, unsigned char const *, int, int, int, class QPainterPath *) - ?drawGlyphs@QPainter@@QAEXABVQPointF@@ABVQGlyphs@@@Z @ 13052 NONAME ; void QPainter::drawGlyphs(class QPointF const &, class QGlyphs const &) - ??0QFlickGesture@@QAE@PAVQObject@@W4MouseButton@Qt@@0@Z @ 13053 NONAME ; QFlickGesture::QFlickGesture(class QObject *, enum Qt::MouseButton, class QObject *) - ??0QScrollEvent@@QAE@ABVQPointF@@0W4ScrollState@0@@Z @ 13054 NONAME ; QScrollEvent::QScrollEvent(class QPointF const &, class QPointF const &, enum QScrollEvent::ScrollState) - ??0QScrollPrepareEvent@@QAE@ABVQPointF@@@Z @ 13055 NONAME ; QScrollPrepareEvent::QScrollPrepareEvent(class QPointF const &) - ??0QScroller@@AAE@PAVQObject@@@Z @ 13056 NONAME ; QScroller::QScroller(class QObject *) - ??0QScrollerProperties@@QAE@ABV0@@Z @ 13057 NONAME ; QScrollerProperties::QScrollerProperties(class QScrollerProperties const &) - ??0QScrollerProperties@@QAE@XZ @ 13058 NONAME ; QScrollerProperties::QScrollerProperties(void) - ??1QFlickGesture@@UAE@XZ @ 13059 NONAME ; QFlickGesture::~QFlickGesture(void) - ??1QScrollEvent@@UAE@XZ @ 13060 NONAME ; QScrollEvent::~QScrollEvent(void) - ??1QScrollPrepareEvent@@UAE@XZ @ 13061 NONAME ; QScrollPrepareEvent::~QScrollPrepareEvent(void) - ??1QScroller@@EAE@XZ @ 13062 NONAME ; QScroller::~QScroller(void) - ??1QScrollerProperties@@UAE@XZ @ 13063 NONAME ; QScrollerProperties::~QScrollerProperties(void) - ??4QScrollerProperties@@QAEAAV0@ABV0@@Z @ 13064 NONAME ; class QScrollerProperties & QScrollerProperties::operator=(class QScrollerProperties const &) - ??8QScrollerProperties@@QBE_NABV0@@Z @ 13065 NONAME ; bool QScrollerProperties::operator==(class QScrollerProperties const &) const - ??9QScrollerProperties@@QBE_NABV0@@Z @ 13066 NONAME ; bool QScrollerProperties::operator!=(class QScrollerProperties const &) const - ??_EQFlickGesture@@UAE@I@Z @ 13067 NONAME ; QFlickGesture::~QFlickGesture(unsigned int) - ??_EQScrollEvent@@UAE@I@Z @ 13068 NONAME ; QScrollEvent::~QScrollEvent(unsigned int) - ??_EQScrollPrepareEvent@@UAE@I@Z @ 13069 NONAME ; QScrollPrepareEvent::~QScrollPrepareEvent(unsigned int) - ??_EQScroller@@UAE@I@Z @ 13070 NONAME ; QScroller::~QScroller(unsigned int) - ??_EQScrollerProperties@@UAE@I@Z @ 13071 NONAME ; QScrollerProperties::~QScrollerProperties(unsigned int) - ?activeScrollers@QScroller@@SA?AV?$QList@PAVQScroller@@@@XZ @ 13072 NONAME ; class QList<class QScroller *> QScroller::activeScrollers(void) - ?canStartScrollingAt@QAbstractScrollAreaPrivate@@QAE_NABVQPoint@@@Z @ 13073 NONAME ; bool QAbstractScrollAreaPrivate::canStartScrollingAt(class QPoint const &) - ?clearSubFocus@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@0@Z @ 13074 NONAME ; void QGraphicsItemPrivate::clearSubFocus(class QGraphicsItem *, class QGraphicsItem *) - ?contentPos@QScrollEvent@@QBE?AVQPointF@@XZ @ 13075 NONAME ; class QPointF QScrollEvent::contentPos(void) const - ?contentPos@QScrollPrepareEvent@@QBE?AVQPointF@@XZ @ 13076 NONAME ; class QPointF QScrollPrepareEvent::contentPos(void) const - ?contentPosRange@QScrollPrepareEvent@@QBE?AVQRectF@@XZ @ 13077 NONAME ; class QRectF QScrollPrepareEvent::contentPosRange(void) const - ?d_func@QFlickGesture@@AAEPAVQFlickGesturePrivate@@XZ @ 13078 NONAME ; class QFlickGesturePrivate * QFlickGesture::d_func(void) - ?d_func@QFlickGesture@@ABEPBVQFlickGesturePrivate@@XZ @ 13079 NONAME ; class QFlickGesturePrivate const * QFlickGesture::d_func(void) const - ?d_func@QScrollEvent@@AAEPAVQScrollEventPrivate@@XZ @ 13080 NONAME ; class QScrollEventPrivate * QScrollEvent::d_func(void) - ?d_func@QScrollEvent@@ABEPBVQScrollEventPrivate@@XZ @ 13081 NONAME ; class QScrollEventPrivate const * QScrollEvent::d_func(void) const - ?d_func@QScrollPrepareEvent@@AAEPAVQScrollPrepareEventPrivate@@XZ @ 13082 NONAME ; class QScrollPrepareEventPrivate * QScrollPrepareEvent::d_func(void) - ?d_func@QScrollPrepareEvent@@ABEPBVQScrollPrepareEventPrivate@@XZ @ 13083 NONAME ; class QScrollPrepareEventPrivate const * QScrollPrepareEvent::d_func(void) const - ?d_func@QScroller@@AAEPAVQScrollerPrivate@@XZ @ 13084 NONAME ; class QScrollerPrivate * QScroller::d_func(void) - ?d_func@QScroller@@ABEPBVQScrollerPrivate@@XZ @ 13085 NONAME ; class QScrollerPrivate const * QScroller::d_func(void) const - ?ensureVisible@QScroller@@QAEXABVQRectF@@MM@Z @ 13086 NONAME ; void QScroller::ensureVisible(class QRectF const &, float, float) - ?ensureVisible@QScroller@@QAEXABVQRectF@@MMH@Z @ 13087 NONAME ; void QScroller::ensureVisible(class QRectF const &, float, float, int) - ?finalPosition@QScroller@@QBE?AVQPointF@@XZ @ 13088 NONAME ; class QPointF QScroller::finalPosition(void) const - ?getStaticMetaObject@QFlickGesture@@SAABUQMetaObject@@XZ @ 13089 NONAME ; struct QMetaObject const & QFlickGesture::getStaticMetaObject(void) - ?getStaticMetaObject@QScroller@@SAABUQMetaObject@@XZ @ 13090 NONAME ; struct QMetaObject const & QScroller::getStaticMetaObject(void) - ?grabGesture@QScroller@@SA?AW4GestureType@Qt@@PAVQObject@@W4ScrollerGestureType@1@@Z @ 13091 NONAME ; enum Qt::GestureType QScroller::grabGesture(class QObject *, enum QScroller::ScrollerGestureType) - ?grabbedGesture@QScroller@@SA?AW4GestureType@Qt@@PAVQObject@@@Z @ 13092 NONAME ; enum Qt::GestureType QScroller::grabbedGesture(class QObject *) - ?handleInput@QScroller@@QAE_NW4Input@1@ABVQPointF@@_J@Z @ 13093 NONAME ; bool QScroller::handleInput(enum QScroller::Input, class QPointF const &, long long) - ?hasScroller@QScroller@@SA_NPAVQObject@@@Z @ 13094 NONAME ; bool QScroller::hasScroller(class QObject *) - ?metaObject@QFlickGesture@@UBEPBUQMetaObject@@XZ @ 13095 NONAME ; struct QMetaObject const * QFlickGesture::metaObject(void) const - ?metaObject@QScroller@@UBEPBUQMetaObject@@XZ @ 13096 NONAME ; struct QMetaObject const * QScroller::metaObject(void) const - ?overshootDistance@QScrollEvent@@QBE?AVQPointF@@XZ @ 13097 NONAME ; class QPointF QScrollEvent::overshootDistance(void) const - ?pixelPerMeter@QScroller@@QBE?AVQPointF@@XZ @ 13098 NONAME ; class QPointF QScroller::pixelPerMeter(void) const - ?qGamma_correct_back_to_linear_cs@@YAXPAVQImage@@@Z @ 13099 NONAME ; void qGamma_correct_back_to_linear_cs(class QImage *) - ?qt_metacall@QFlickGesture@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 13100 NONAME ; int QFlickGesture::qt_metacall(enum QMetaObject::Call, int, void * *) - ?qt_metacall@QScroller@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 13101 NONAME ; int QScroller::qt_metacall(enum QMetaObject::Call, int, void * *) - ?qt_metacast@QFlickGesture@@UAEPAXPBD@Z @ 13102 NONAME ; void * QFlickGesture::qt_metacast(char const *) - ?qt_metacast@QScroller@@UAEPAXPBD@Z @ 13103 NONAME ; void * QScroller::qt_metacast(char const *) - ?resendPrepareEvent@QScroller@@QAEXXZ @ 13104 NONAME ; void QScroller::resendPrepareEvent(void) - ?resetCursorBlinkTimer@QLineControl@@QAEXXZ @ 13105 NONAME ; void QLineControl::resetCursorBlinkTimer(void) - ?scrollMetric@QScrollerProperties@@QBE?AVQVariant@@W4ScrollMetric@1@@Z @ 13106 NONAME ; class QVariant QScrollerProperties::scrollMetric(enum QScrollerProperties::ScrollMetric) const - ?scrollState@QScrollEvent@@QBE?AW4ScrollState@1@XZ @ 13107 NONAME ; enum QScrollEvent::ScrollState QScrollEvent::scrollState(void) const - ?scrollTo@QScroller@@QAEXABVQPointF@@@Z @ 13108 NONAME ; void QScroller::scrollTo(class QPointF const &) - ?scrollTo@QScroller@@QAEXABVQPointF@@H@Z @ 13109 NONAME ; void QScroller::scrollTo(class QPointF const &, int) - ?scroller@QScroller@@SAPAV1@PAVQObject@@@Z @ 13110 NONAME ; class QScroller * QScroller::scroller(class QObject *) - ?scroller@QScroller@@SAPBV1@PBVQObject@@@Z @ 13111 NONAME ; class QScroller const * QScroller::scroller(class QObject const *) - ?scrollerProperties@QScroller@@QBE?AVQScrollerProperties@@XZ @ 13112 NONAME ; class QScrollerProperties QScroller::scrollerProperties(void) const - ?scrollerPropertiesChanged@QScroller@@IAEXABVQScrollerProperties@@@Z @ 13113 NONAME ; void QScroller::scrollerPropertiesChanged(class QScrollerProperties const &) - ?setContentPos@QScrollPrepareEvent@@QAEXABVQPointF@@@Z @ 13114 NONAME ; void QScrollPrepareEvent::setContentPos(class QPointF const &) - ?setContentPosRange@QScrollPrepareEvent@@QAEXABVQRectF@@@Z @ 13115 NONAME ; void QScrollPrepareEvent::setContentPosRange(class QRectF const &) - ?setDefaultScrollerProperties@QScrollerProperties@@SAXABV1@@Z @ 13116 NONAME ; void QScrollerProperties::setDefaultScrollerProperties(class QScrollerProperties const &) - ?setScrollMetric@QScrollerProperties@@QAEXW4ScrollMetric@1@ABVQVariant@@@Z @ 13117 NONAME ; void QScrollerProperties::setScrollMetric(enum QScrollerProperties::ScrollMetric, class QVariant const &) - ?setScrollerProperties@QScroller@@QAEXABVQScrollerProperties@@@Z @ 13118 NONAME ; void QScroller::setScrollerProperties(class QScrollerProperties const &) - ?setSnapPositionsX@QScroller@@QAEXABV?$QList@M@@@Z @ 13119 NONAME ; void QScroller::setSnapPositionsX(class QList<float> const &) - ?setSnapPositionsX@QScroller@@QAEXMM@Z @ 13120 NONAME ; void QScroller::setSnapPositionsX(float, float) - ?setSnapPositionsY@QScroller@@QAEXABV?$QList@M@@@Z @ 13121 NONAME ; void QScroller::setSnapPositionsY(class QList<float> const &) - ?setSnapPositionsY@QScroller@@QAEXMM@Z @ 13122 NONAME ; void QScroller::setSnapPositionsY(float, float) - ?setSubFocus@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@0@Z @ 13123 NONAME ; void QGraphicsItemPrivate::setSubFocus(class QGraphicsItem *, class QGraphicsItem *) - ?setViewportSize@QScrollPrepareEvent@@QAEXABVQSizeF@@@Z @ 13124 NONAME ; void QScrollPrepareEvent::setViewportSize(class QSizeF const &) - ?startPos@QScrollPrepareEvent@@QBE?AVQPointF@@XZ @ 13125 NONAME ; class QPointF QScrollPrepareEvent::startPos(void) const - ?state@QScroller@@QBE?AW4State@1@XZ @ 13126 NONAME ; enum QScroller::State QScroller::state(void) const - ?stateChanged@QScroller@@IAEXW4State@1@@Z @ 13127 NONAME ; void QScroller::stateChanged(enum QScroller::State) - ?stop@QScroller@@QAEXXZ @ 13128 NONAME ; void QScroller::stop(void) - ?target@QScroller@@QBEPAVQObject@@XZ @ 13129 NONAME ; class QObject * QScroller::target(void) const - ?tr@QFlickGesture@@SA?AVQString@@PBD0@Z @ 13130 NONAME ; class QString QFlickGesture::tr(char const *, char const *) - ?tr@QFlickGesture@@SA?AVQString@@PBD0H@Z @ 13131 NONAME ; class QString QFlickGesture::tr(char const *, char const *, int) - ?tr@QScroller@@SA?AVQString@@PBD0@Z @ 13132 NONAME ; class QString QScroller::tr(char const *, char const *) - ?tr@QScroller@@SA?AVQString@@PBD0H@Z @ 13133 NONAME ; class QString QScroller::tr(char const *, char const *, int) - ?trUtf8@QFlickGesture@@SA?AVQString@@PBD0@Z @ 13134 NONAME ; class QString QFlickGesture::trUtf8(char const *, char const *) - ?trUtf8@QFlickGesture@@SA?AVQString@@PBD0H@Z @ 13135 NONAME ; class QString QFlickGesture::trUtf8(char const *, char const *, int) - ?trUtf8@QScroller@@SA?AVQString@@PBD0@Z @ 13136 NONAME ; class QString QScroller::trUtf8(char const *, char const *) - ?trUtf8@QScroller@@SA?AVQString@@PBD0H@Z @ 13137 NONAME ; class QString QScroller::trUtf8(char const *, char const *, int) - ?ungrabGesture@QScroller@@SAXPAVQObject@@@Z @ 13138 NONAME ; void QScroller::ungrabGesture(class QObject *) - ?unsetDefaultScrollerProperties@QScrollerProperties@@SAXXZ @ 13139 NONAME ; void QScrollerProperties::unsetDefaultScrollerProperties(void) - ?velocity@QScroller@@QBE?AVQPointF@@XZ @ 13140 NONAME ; class QPointF QScroller::velocity(void) const - ?viewportSize@QScrollPrepareEvent@@QBE?AVQSizeF@@XZ @ 13141 NONAME ; class QSizeF QScrollPrepareEvent::viewportSize(void) const - ?staticMetaObject@QScroller@@2UQMetaObject@@B @ 13142 NONAME ; struct QMetaObject const QScroller::staticMetaObject - ?staticMetaObject@QFlickGesture@@2UQMetaObject@@B @ 13143 NONAME ; struct QMetaObject const QFlickGesture::staticMetaObject - ?isDragEnabled@QTextControl@@QBE_NXZ @ 13144 NONAME ; bool QTextControl::isDragEnabled(void) const - ?setWordSelectionEnabled@QTextControl@@QAEX_N@Z @ 13145 NONAME ; void QTextControl::setWordSelectionEnabled(bool) - ?setDragEnabled@QTextControl@@QAEX_N@Z @ 13146 NONAME ; void QTextControl::setDragEnabled(bool) - ?isWordSelectionEnabled@QTextControl@@QBE_NXZ @ 13147 NONAME ; bool QTextControl::isWordSelectionEnabled(void) const - ?ProcessCommandParametersL@QS60MainAppUi@@UAEHW4TApaCommand@@AAV?$TBuf@$0BAA@@@ABVTDesC8@@@Z @ 13148 NONAME ; int QS60MainAppUi::ProcessCommandParametersL(enum TApaCommand, class TBuf<256> &, class TDesC8 const &) - ?openFile@QFileOpenEvent@@QBE_NAAVQFile@@V?$QFlags@W4OpenModeFlag@QIODevice@@@@@Z @ 13149 NONAME ; bool QFileOpenEvent::openFile(class QFile &, class QFlags<enum QIODevice::OpenModeFlag>) const - ??0QFileOpenEvent@@QAE@ABVRFile@@@Z @ 13150 NONAME ; QFileOpenEvent::QFileOpenEvent(class RFile const &) - ?beginDataAccess@QVolatileImage@@QBEXXZ @ 13151 NONAME ; void QVolatileImage::beginDataAccess(void) const - ??1QVolatileImage@@QAE@XZ @ 13152 NONAME ; QVolatileImage::~QVolatileImage(void) - ?trUtf8@QInternalMimeData@@SA?AVQString@@PBD0@Z @ 13153 NONAME ; class QString QInternalMimeData::trUtf8(char const *, char const *) - ??0QVolatileImage@@QAE@HHW4Format@QImage@@@Z @ 13154 NONAME ; QVolatileImage::QVolatileImage(int, int, enum QImage::Format) - ?ensureFormat@QVolatileImage@@QAE_NW4Format@QImage@@@Z @ 13155 NONAME ; bool QVolatileImage::ensureFormat(enum QImage::Format) - ?fill@QVolatileImage@@QAEXI@Z @ 13156 NONAME ; void QVolatileImage::fill(unsigned int) - ?assignedInputContext@QWidgetPrivate@@QBEPAVQInputContext@@XZ @ 13157 NONAME ; class QInputContext * QWidgetPrivate::assignedInputContext(void) const - ?retrieveData@QInternalMimeData@@MBE?AVQVariant@@ABVQString@@W4Type@2@@Z @ 13158 NONAME ; class QVariant QInternalMimeData::retrieveData(class QString const &, enum QVariant::Type) const - ?formats@QInternalMimeData@@UBE?AVQStringList@@XZ @ 13159 NONAME ; class QStringList QInternalMimeData::formats(void) const - ?isNull@QVolatileImage@@QBE_NXZ @ 13160 NONAME ; bool QVolatileImage::isNull(void) const - ?toImage@QVolatileImage@@QBE?AVQImage@@XZ @ 13161 NONAME ; class QImage QVolatileImage::toImage(void) const - ??0QVolatileImage@@QAE@ABVQImage@@@Z @ 13162 NONAME ; QVolatileImage::QVolatileImage(class QImage const &) - ?tr@QInternalMimeData@@SA?AVQString@@PBD0H@Z @ 13163 NONAME ; class QString QInternalMimeData::tr(char const *, char const *, int) - ?resolveFontFamilyAlias@QFontDatabase@@CA?AVQString@@ABV2@@Z @ 13164 NONAME ; class QString QFontDatabase::resolveFontFamilyAlias(class QString const &) - ?hasFormat@QInternalMimeData@@UBE_NABVQString@@@Z @ 13165 NONAME ; bool QInternalMimeData::hasFormat(class QString const &) const - ?format@QVolatileImage@@QBE?AW4Format@QImage@@XZ @ 13166 NONAME ; enum QImage::Format QVolatileImage::format(void) const - ?renderDataHelper@QInternalMimeData@@SA?AVQByteArray@@ABVQString@@PBVQMimeData@@@Z @ 13167 NONAME ; class QByteArray QInternalMimeData::renderDataHelper(class QString const &, class QMimeData const *) - ?endDataAccess@QVolatileImage@@QBEX_N@Z @ 13168 NONAME ; void QVolatileImage::endDataAccess(bool) const - ?constBits@QVolatileImage@@QBEPBEXZ @ 13169 NONAME ; unsigned char const * QVolatileImage::constBits(void) const - ?updateMicroFocus@QLineControl@@IAEXXZ @ 13170 NONAME ; void QLineControl::updateMicroFocus(void) - ?height@QVolatileImage@@QBEHXZ @ 13171 NONAME ; int QVolatileImage::height(void) const - ?duplicateNativeImage@QVolatileImage@@QBEPAXXZ @ 13172 NONAME ; void * QVolatileImage::duplicateNativeImage(void) const - ?formatsHelper@QInternalMimeData@@SA?AVQStringList@@PBVQMimeData@@@Z @ 13173 NONAME ; class QStringList QInternalMimeData::formatsHelper(class QMimeData const *) - ?qt_metacast@QInternalMimeData@@UAEPAXPBD@Z @ 13174 NONAME ; void * QInternalMimeData::qt_metacast(char const *) - ?bits@QVolatileImage@@QAEPAEXZ @ 13175 NONAME ; unsigned char * QVolatileImage::bits(void) - ?paintEngine@QVolatileImage@@QAEPAVQPaintEngine@@XZ @ 13176 NONAME ; class QPaintEngine * QVolatileImage::paintEngine(void) - ?bytesPerLine@QVolatileImage@@QBEHXZ @ 13177 NONAME ; int QVolatileImage::bytesPerLine(void) const - ?width@QVolatileImage@@QBEHXZ @ 13178 NONAME ; int QVolatileImage::width(void) const - ?qt_metacall@QInternalMimeData@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 13179 NONAME ; int QInternalMimeData::qt_metacall(enum QMetaObject::Call, int, void * *) - ?lineHeightType@QTextBlockFormat@@QBEHXZ @ 13180 NONAME ; int QTextBlockFormat::lineHeightType(void) const - ?trUtf8@QInternalMimeData@@SA?AVQString@@PBD0H@Z @ 13181 NONAME ; class QString QInternalMimeData::trUtf8(char const *, char const *, int) - ?copyFrom@QVolatileImage@@QAEXPAV1@ABVQRect@@@Z @ 13182 NONAME ; void QVolatileImage::copyFrom(class QVolatileImage *, class QRect const &) - ?lineHeight@QTextBlockFormat@@QBEMMM@Z @ 13183 NONAME ; float QTextBlockFormat::lineHeight(float, float) const - ?canReadData@QInternalMimeData@@SA_NABVQString@@@Z @ 13184 NONAME ; bool QInternalMimeData::canReadData(class QString const &) - ?releaseCachedResources@QGraphicsSystem@@UAEXXZ @ 13185 NONAME ; void QGraphicsSystem::releaseCachedResources(void) - ??0QInternalMimeData@@QAE@XZ @ 13186 NONAME ; QInternalMimeData::QInternalMimeData(void) - ?setLineHeight@QTextBlockFormat@@QAEXMH@Z @ 13187 NONAME ; void QTextBlockFormat::setLineHeight(float, int) - ?imageRef@QVolatileImage@@QAEAAVQImage@@XZ @ 13188 NONAME ; class QImage & QVolatileImage::imageRef(void) - ??0QVolatileImage@@QAE@PAX0@Z @ 13189 NONAME ; QVolatileImage::QVolatileImage(void *, void *) - ??4QVolatileImage@@QAEAAV0@ABV0@@Z @ 13190 NONAME ; class QVolatileImage & QVolatileImage::operator=(class QVolatileImage const &) - ??0QVolatileImage@@QAE@XZ @ 13191 NONAME ; QVolatileImage::QVolatileImage(void) - ?getStaticMetaObject@QInternalMimeData@@SAABUQMetaObject@@XZ @ 13192 NONAME ; struct QMetaObject const & QInternalMimeData::getStaticMetaObject(void) - ?lineHeight@QTextBlockFormat@@QBEMXZ @ 13193 NONAME ; float QTextBlockFormat::lineHeight(void) const - ?tr@QInternalMimeData@@SA?AVQString@@PBD0@Z @ 13194 NONAME ; class QString QInternalMimeData::tr(char const *, char const *) - ?hasAlphaChannel@QVolatileImage@@QBE_NXZ @ 13195 NONAME ; bool QVolatileImage::hasAlphaChannel(void) const - ?setAlphaChannel@QVolatileImage@@QAEXABVQPixmap@@@Z @ 13196 NONAME ; void QVolatileImage::setAlphaChannel(class QPixmap const &) - ??_EQInternalMimeData@@UAE@I@Z @ 13197 NONAME ; QInternalMimeData::~QInternalMimeData(unsigned int) - ?byteCount@QVolatileImage@@QBEHXZ @ 13198 NONAME ; int QVolatileImage::byteCount(void) const - ??0QVolatileImage@@QAE@ABV0@@Z @ 13199 NONAME ; QVolatileImage::QVolatileImage(class QVolatileImage const &) - ?metaObject@QInternalMimeData@@UBEPBUQMetaObject@@XZ @ 13200 NONAME ; struct QMetaObject const * QInternalMimeData::metaObject(void) const - ?depth@QVolatileImage@@QBEHXZ @ 13201 NONAME ; int QVolatileImage::depth(void) const - ?hasFormatHelper@QInternalMimeData@@SA_NABVQString@@PBVQMimeData@@@Z @ 13202 NONAME ; bool QInternalMimeData::hasFormatHelper(class QString const &, class QMimeData const *) - ??1QInternalMimeData@@UAE@XZ @ 13203 NONAME ; QInternalMimeData::~QInternalMimeData(void) - ?staticMetaObject@QInternalMimeData@@2UQMetaObject@@B @ 13204 NONAME ; struct QMetaObject const QInternalMimeData::staticMetaObject + ?resetCursorBlinkTimer@QLineControl@@QAEXXZ @ 12907 NONAME ; void QLineControl::resetCursorBlinkTimer(void) + ?setSubFocus@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@0@Z @ 12908 NONAME ; void QGraphicsItemPrivate::setSubFocus(class QGraphicsItem *, class QGraphicsItem *) + ?clearSubFocus@QGraphicsItemPrivate@@QAEXPAVQGraphicsItem@@0@Z @ 12909 NONAME ; void QGraphicsItemPrivate::clearSubFocus(class QGraphicsItem *, class QGraphicsItem *) + ?hitTest@QTextDocumentLayout@@UBEHABVQPointF@@W4HitTestAccuracy@Qt@@@Z @ 12910 NONAME ABSENT ; int QTextDocumentLayout::hitTest(class QPointF const &, enum Qt::HitTestAccuracy) const + ?positionInlineObject@QTextDocumentLayout@@MAEXVQTextInlineObject@@HABVQTextFormat@@@Z @ 12911 NONAME ABSENT ; void QTextDocumentLayout::positionInlineObject(class QTextInlineObject, int, class QTextFormat const &) + ?timerEvent@QTextDocumentLayout@@MAEXPAVQTimerEvent@@@Z @ 12912 NONAME ABSENT ; void QTextDocumentLayout::timerEvent(class QTimerEvent *) + ?draw@QTextDocumentLayout@@UAEXPAVQPainter@@ABUPaintContext@QAbstractTextDocumentLayout@@@Z @ 12913 NONAME ABSENT ; void QTextDocumentLayout::draw(class QPainter *, struct QAbstractTextDocumentLayout::PaintContext const &) + ?documentSize@QTextDocumentLayout@@UBE?AVQSizeF@@XZ @ 12914 NONAME ABSENT ; class QSizeF QTextDocumentLayout::documentSize(void) const + ?drawInlineObject@QTextDocumentLayout@@MAEXPAVQPainter@@ABVQRectF@@VQTextInlineObject@@HABVQTextFormat@@@Z @ 12915 NONAME ABSENT ; void QTextDocumentLayout::drawInlineObject(class QPainter *, class QRectF const &, class QTextInlineObject, int, class QTextFormat const &) + ?resizeInlineObject@QTextDocumentLayout@@MAEXVQTextInlineObject@@HABVQTextFormat@@@Z @ 12916 NONAME ABSENT ; void QTextDocumentLayout::resizeInlineObject(class QTextInlineObject, int, class QTextFormat const &) + ?dynamicDocumentSize@QTextDocumentLayout@@QBE?AVQSizeF@@XZ @ 12917 NONAME ABSENT ; class QSizeF QTextDocumentLayout::dynamicDocumentSize(void) const + ?metaObject@QTextDocumentLayout@@UBEPBUQMetaObject@@XZ @ 12918 NONAME ABSENT ; struct QMetaObject const * QTextDocumentLayout::metaObject(void) const + ?getStaticMetaObject@QTextDocumentLayout@@SAABUQMetaObject@@XZ @ 12919 NONAME ABSENT ; struct QMetaObject const & QTextDocumentLayout::getStaticMetaObject(void) + ?blockBoundingRect@QTextDocumentLayout@@UBE?AVQRectF@@ABVQTextBlock@@@Z @ 12920 NONAME ABSENT ; class QRectF QTextDocumentLayout::blockBoundingRect(class QTextBlock const &) const + ?qt_metacall@QTextDocumentLayout@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 12921 NONAME ABSENT ; int QTextDocumentLayout::qt_metacall(enum QMetaObject::Call, int, void * *) + ?d_func@QTextDocumentLayout@@AAEPAVQTextDocumentLayoutPrivate@@XZ @ 12922 NONAME ABSENT ; class QTextDocumentLayoutPrivate * QTextDocumentLayout::d_func(void) + ?isDragEnabled@QTextControl@@QBE_NXZ @ 12923 NONAME ; bool QTextControl::isDragEnabled(void) const + ?staticMetaObject@QTextDocumentLayout@@2UQMetaObject@@B @ 12924 NONAME ABSENT ; struct QMetaObject const QTextDocumentLayout::staticMetaObject + ?qt_metacast@QTextDocumentLayout@@UAEPAXPBD@Z @ 12925 NONAME ABSENT ; void * QTextDocumentLayout::qt_metacast(char const *) + ?documentChanged@QTextDocumentLayout@@MAEXHHH@Z @ 12926 NONAME ABSENT ; void QTextDocumentLayout::documentChanged(int, int, int) + ??1QTextDocumentLayout@@UAE@XZ @ 12927 NONAME ABSENT ; QTextDocumentLayout::~QTextDocumentLayout(void) + ?layoutStatus@QTextDocumentLayout@@QBEHXZ @ 12928 NONAME ABSENT ; int QTextDocumentLayout::layoutStatus(void) const + ?setDragEnabled@QTextControl@@QAEX_N@Z @ 12929 NONAME ; void QTextControl::setDragEnabled(bool) + ?d_func@QTextDocumentLayout@@ABEPBVQTextDocumentLayoutPrivate@@XZ @ 12930 NONAME ABSENT ; class QTextDocumentLayoutPrivate const * QTextDocumentLayout::d_func(void) const + ?idealWidth@QTextDocumentLayout@@QBEMXZ @ 12931 NONAME ABSENT ; float QTextDocumentLayout::idealWidth(void) const + ?setFixedColumnWidth@QTextDocumentLayout@@QAEXH@Z @ 12932 NONAME ABSENT ; void QTextDocumentLayout::setFixedColumnWidth(int) + ?cursorWidth@QTextDocumentLayout@@QBEHXZ @ 12933 NONAME ABSENT ; int QTextDocumentLayout::cursorWidth(void) const + ?trUtf8@QTextDocumentLayout@@SA?AVQString@@PBD0H@Z @ 12934 NONAME ABSENT ; class QString QTextDocumentLayout::trUtf8(char const *, char const *, int) + ?pageCount@QTextDocumentLayout@@UBEHXZ @ 12935 NONAME ABSENT ; int QTextDocumentLayout::pageCount(void) const + ?setViewport@QTextDocumentLayout@@QAEXABVQRectF@@@Z @ 12936 NONAME ABSENT ; void QTextDocumentLayout::setViewport(class QRectF const &) + ?contentHasAlignment@QTextDocumentLayout@@QBE_NXZ @ 12937 NONAME ABSENT ; bool QTextDocumentLayout::contentHasAlignment(void) const + ?tr@QTextDocumentLayout@@SA?AVQString@@PBD0@Z @ 12938 NONAME ABSENT ; class QString QTextDocumentLayout::tr(char const *, char const *) + ?setLineHeight@QTextDocumentLayout@@IAEXMW4LineHeightMode@1@@Z @ 12939 NONAME ABSENT ; void QTextDocumentLayout::setLineHeight(float, enum QTextDocumentLayout::LineHeightMode) + ?tr@QTextDocumentLayout@@SA?AVQString@@PBD0H@Z @ 12940 NONAME ABSENT ; class QString QTextDocumentLayout::tr(char const *, char const *, int) + ?trUtf8@QTextDocumentLayout@@SA?AVQString@@PBD0@Z @ 12941 NONAME ABSENT ; class QString QTextDocumentLayout::trUtf8(char const *, char const *) + ?frameBoundingRect@QTextDocumentLayout@@UBE?AVQRectF@@PAVQTextFrame@@@Z @ 12942 NONAME ABSENT ; class QRectF QTextDocumentLayout::frameBoundingRect(class QTextFrame *) const + ?setCursorWidth@QTextDocumentLayout@@QAEXH@Z @ 12943 NONAME ABSENT ; void QTextDocumentLayout::setCursorWidth(int) + ??_EQTextDocumentLayout@@UAE@I@Z @ 12944 NONAME ABSENT ; QTextDocumentLayout::~QTextDocumentLayout(unsigned int) + ??0QTextDocumentLayout@@QAE@PAVQTextDocument@@@Z @ 12945 NONAME ABSENT ; QTextDocumentLayout::QTextDocumentLayout(class QTextDocument *) + ?doLayout@QTextDocumentLayout@@AAE?AVQRectF@@HHH@Z @ 12946 NONAME ABSENT ; class QRectF QTextDocumentLayout::doLayout(int, int, int) + ?ensureLayouted@QTextDocumentLayout@@QAEXM@Z @ 12947 NONAME ABSENT ; void QTextDocumentLayout::ensureLayouted(float) + ?layoutFinished@QTextDocumentLayout@@AAEXXZ @ 12948 NONAME ABSENT ; void QTextDocumentLayout::layoutFinished(void) + ?dynamicPageCount@QTextDocumentLayout@@QBEHXZ @ 12949 NONAME ABSENT ; int QTextDocumentLayout::dynamicPageCount(void) const + ?setWordSelectionEnabled@QTextControl@@QAEX_N@Z @ 12950 NONAME ; void QTextControl::setWordSelectionEnabled(bool) + ?isWordSelectionEnabled@QTextControl@@QBE_NXZ @ 12951 NONAME ; bool QTextControl::isWordSelectionEnabled(void) const + ?assignedInputContext@QWidgetPrivate@@QBEPAVQInputContext@@XZ @ 12952 NONAME ; class QInputContext * QWidgetPrivate::assignedInputContext(void) const + ?updateMicroFocus@QLineControl@@IAEXXZ @ 12953 NONAME ; void QLineControl::updateMicroFocus(void) + ?beginDataAccess@QVolatileImage@@QBEXXZ @ 12954 NONAME ; void QVolatileImage::beginDataAccess(void) const + ??1QVolatileImage@@QAE@XZ @ 12955 NONAME ; QVolatileImage::~QVolatileImage(void) + ??0QVolatileImage@@QAE@HHW4Format@QImage@@@Z @ 12956 NONAME ; QVolatileImage::QVolatileImage(int, int, enum QImage::Format) + ?ensureFormat@QVolatileImage@@QAE_NW4Format@QImage@@@Z @ 12957 NONAME ; bool QVolatileImage::ensureFormat(enum QImage::Format) + ?fill@QVolatileImage@@QAEXI@Z @ 12958 NONAME ; void QVolatileImage::fill(unsigned int) + ?isNull@QVolatileImage@@QBE_NXZ @ 12959 NONAME ; bool QVolatileImage::isNull(void) const + ?toImage@QVolatileImage@@QBE?AVQImage@@XZ @ 12960 NONAME ; class QImage QVolatileImage::toImage(void) const + ??0QVolatileImage@@QAE@ABVQImage@@@Z @ 12961 NONAME ; QVolatileImage::QVolatileImage(class QImage const &) + ?format@QVolatileImage@@QBE?AW4Format@QImage@@XZ @ 12962 NONAME ; enum QImage::Format QVolatileImage::format(void) const + ?endDataAccess@QVolatileImage@@QBEX_N@Z @ 12963 NONAME ; void QVolatileImage::endDataAccess(bool) const + ?constBits@QVolatileImage@@QBEPBEXZ @ 12964 NONAME ; unsigned char const * QVolatileImage::constBits(void) const + ?height@QVolatileImage@@QBEHXZ @ 12965 NONAME ; int QVolatileImage::height(void) const + ?duplicateNativeImage@QVolatileImage@@QBEPAXXZ @ 12966 NONAME ; void * QVolatileImage::duplicateNativeImage(void) const + ?bits@QVolatileImage@@QAEPAEXZ @ 12967 NONAME ; unsigned char * QVolatileImage::bits(void) + ?paintEngine@QVolatileImage@@QAEPAVQPaintEngine@@XZ @ 12968 NONAME ; class QPaintEngine * QVolatileImage::paintEngine(void) + ?bytesPerLine@QVolatileImage@@QBEHXZ @ 12969 NONAME ; int QVolatileImage::bytesPerLine(void) const + ?width@QVolatileImage@@QBEHXZ @ 12970 NONAME ; int QVolatileImage::width(void) const + ?copyFrom@QVolatileImage@@QAEXPAV1@ABVQRect@@@Z @ 12971 NONAME ; void QVolatileImage::copyFrom(class QVolatileImage *, class QRect const &) + ?imageRef@QVolatileImage@@QAEAAVQImage@@XZ @ 12972 NONAME ; class QImage & QVolatileImage::imageRef(void) + ??0QVolatileImage@@QAE@PAX0@Z @ 12973 NONAME ; QVolatileImage::QVolatileImage(void *, void *) + ??4QVolatileImage@@QAEAAV0@ABV0@@Z @ 12974 NONAME ; class QVolatileImage & QVolatileImage::operator=(class QVolatileImage const &) + ??0QVolatileImage@@QAE@XZ @ 12975 NONAME ; QVolatileImage::QVolatileImage(void) + ?hasAlphaChannel@QVolatileImage@@QBE_NXZ @ 12976 NONAME ; bool QVolatileImage::hasAlphaChannel(void) const + ?setAlphaChannel@QVolatileImage@@QAEXABVQPixmap@@@Z @ 12977 NONAME ; void QVolatileImage::setAlphaChannel(class QPixmap const &) + ?byteCount@QVolatileImage@@QBEHXZ @ 12978 NONAME ; int QVolatileImage::byteCount(void) const + ??0QVolatileImage@@QAE@ABV0@@Z @ 12979 NONAME ; QVolatileImage::QVolatileImage(class QVolatileImage const &) + ?depth@QVolatileImage@@QBEHXZ @ 12980 NONAME ; int QVolatileImage::depth(void) const + ?releaseCachedResources@QGraphicsSystem@@UAEXXZ @ 12981 NONAME ; void QGraphicsSystem::releaseCachedResources(void) + ?qt_s60_setPartialScreenInputMode@@YAX_N@Z @ 12982 NONAME ; void qt_s60_setPartialScreenInputMode(bool) + ?clipEnabledChanged@QBlitterPaintEngine@@UAEXXZ @ 12983 NONAME ; void QBlitterPaintEngine::clipEnabledChanged(void) + ?supportsSubPixelPositions@QFontEngine@@UBE_NXZ @ 12984 NONAME ; bool QFontEngine::supportsSubPixelPositions(void) const + ??_EQScrollerProperties@@UAE@I@Z @ 12985 NONAME ; QScrollerProperties::~QScrollerProperties(unsigned int) + ??_EQFontPrivate@@QAE@I@Z @ 12986 NONAME ; QFontPrivate::~QFontPrivate(unsigned int) + ??0QMimeSource@@QAE@XZ @ 12987 NONAME ; QMimeSource::QMimeSource(void) + ??0QStyleFactoryInterface@@QAE@XZ @ 12988 NONAME ; QStyleFactoryInterface::QStyleFactoryInterface(void) + ?d_func@QScrollEvent@@AAEPAVQScrollEventPrivate@@XZ @ 12989 NONAME ; class QScrollEventPrivate * QScrollEvent::d_func(void) + ??0QFileOpenEvent@@QAE@ABV0@@Z @ 12990 NONAME ; QFileOpenEvent::QFileOpenEvent(class QFileOpenEvent const &) + ??4QStyleOptionViewItemV2@@QAEAAV0@ABV0@@Z @ 12991 NONAME ; class QStyleOptionViewItemV2 & QStyleOptionViewItemV2::operator=(class QStyleOptionViewItemV2 const &) + ?heightForWidth@QTabWidget@@UBEHH@Z @ 12992 NONAME ; int QTabWidget::heightForWidth(int) const + ??1QFlickGesture@@UAE@XZ @ 12993 NONAME ; QFlickGesture::~QFlickGesture(void) + ??0QRasterWindowSurface@@QAE@PAVQWidget@@_N@Z @ 12994 NONAME ; QRasterWindowSurface::QRasterWindowSurface(class QWidget *, bool) + ?brushChanged@QBlitterPaintEngine@@UAEXXZ @ 12995 NONAME ; void QBlitterPaintEngine::brushChanged(void) + ?clip@QBlitterPaintEngine@@UAEXABVQRect@@W4ClipOperation@Qt@@@Z @ 12996 NONAME ; void QBlitterPaintEngine::clip(class QRect const &, enum Qt::ClipOperation) + ?detach@QGlyphs@@AAEXXZ @ 12997 NONAME ; void QGlyphs::detach(void) + ?trUtf8@QInternalMimeData@@SA?AVQString@@PBD0@Z @ 12998 NONAME ; class QString QInternalMimeData::trUtf8(char const *, char const *) + ??0QShowEvent@@QAE@ABV0@@Z @ 12999 NONAME ; QShowEvent::QShowEvent(class QShowEvent const &) + ??0QMouseEvent@@QAE@ABV0@@Z @ 13000 NONAME ; QMouseEvent::QMouseEvent(class QMouseEvent const &) + ?setHintingPreference@QFont@@QAEXW4HintingPreference@1@@Z @ 13001 NONAME ; void QFont::setHintingPreference(enum QFont::HintingPreference) + ??0QActionEvent@@QAE@ABV0@@Z @ 13002 NONAME ; QActionEvent::QActionEvent(class QActionEvent const &) + ??0QTouchEvent@@QAE@ABV0@@Z @ 13003 NONAME ; QTouchEvent::QTouchEvent(class QTouchEvent const &) + ?capabilities@QBlittable@@QBE?AV?$QFlags@W4Capability@QBlittable@@@@XZ @ 13004 NONAME ; class QFlags<enum QBlittable::Capability> QBlittable::capabilities(void) const + ?setContentPosRange@QScrollPrepareEvent@@QAEXABVQRectF@@@Z @ 13005 NONAME ; void QScrollPrepareEvent::setContentPosRange(class QRectF const &) + ??_EQImageData@@QAE@I@Z @ 13006 NONAME ; QImageData::~QImageData(unsigned int) + ?swap@QBrush@@QAEXAAV1@@Z @ 13007 NONAME ; void QBrush::swap(class QBrush &) + ?trUtf8@QFlickGesture@@SA?AVQString@@PBD0H@Z @ 13008 NONAME ; class QString QFlickGesture::trUtf8(char const *, char const *, int) + ?fontHintingPreference@QTextCharFormat@@QBE?AW4HintingPreference@QFont@@XZ @ 13009 NONAME ; enum QFont::HintingPreference QTextCharFormat::fontHintingPreference(void) const + ?swap@QPixmap@@QAEXAAV1@@Z @ 13010 NONAME ; void QPixmap::swap(class QPixmap &) + ??0QBlitterPaintEngine@@QAE@PAVQBlittablePixmapData@@@Z @ 13011 NONAME ; QBlitterPaintEngine::QBlitterPaintEngine(class QBlittablePixmapData *) + ?numberPrefix@QTextListFormat@@QBE?AVQString@@XZ @ 13012 NONAME ; class QString QTextListFormat::numberPrefix(void) const + ?setSnapPositionsX@QScroller@@QAEXMM@Z @ 13013 NONAME ; void QScroller::setSnapPositionsX(float, float) + ?scroller@QScroller@@SAPBV1@PBVQObject@@@Z @ 13014 NONAME ; class QScroller const * QScroller::scroller(class QObject const *) + ?qt_metacall@QScroller@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 13015 NONAME ; int QScroller::qt_metacall(enum QMetaObject::Call, int, void * *) + ?tr@QFlickGesture@@SA?AVQString@@PBD0@Z @ 13016 NONAME ; class QString QFlickGesture::tr(char const *, char const *) + ??4QBezier@@QAEAAV0@ABV0@@Z @ 13017 NONAME ; class QBezier & QBezier::operator=(class QBezier const &) + ?setScrollerProperties@QScroller@@QAEXABVQScrollerProperties@@@Z @ 13018 NONAME ; void QScroller::setScrollerProperties(class QScrollerProperties const &) + ??0QIconEngineV2@@QAE@XZ @ 13019 NONAME ; QIconEngineV2::QIconEngineV2(void) + ??4iterator@QTextBlock@@QAEAAV01@ABV01@@Z @ 13020 NONAME ; class QTextBlock::iterator & QTextBlock::iterator::operator=(class QTextBlock::iterator const &) + ??MQItemSelectionRange@@QBE_NABV0@@Z @ 13021 NONAME ; bool QItemSelectionRange::operator<(class QItemSelectionRange const &) const + ?setWidthForHeight@QSizePolicy@@QAEX_N@Z @ 13022 NONAME ; void QSizePolicy::setWidthForHeight(bool) + ?qt_fontdata_from_index@@YA?AVQByteArray@@H@Z @ 13023 NONAME ; class QByteArray qt_fontdata_from_index(int) + ??0QIconEngineV2@@QAE@ABV0@@Z @ 13024 NONAME ; QIconEngineV2::QIconEngineV2(class QIconEngineV2 const &) + ?swap@QImage@@QAEXAAV1@@Z @ 13025 NONAME ; void QImage::swap(class QImage &) + ??0QIconEngineFactoryInterfaceV2@@QAE@XZ @ 13026 NONAME ; QIconEngineFactoryInterfaceV2::QIconEngineFactoryInterfaceV2(void) + ??0QScroller@@AAE@PAVQObject@@@Z @ 13027 NONAME ; QScroller::QScroller(class QObject *) + ?compositionModeChanged@QBlitterPaintEngine@@UAEXXZ @ 13028 NONAME ; void QBlitterPaintEngine::compositionModeChanged(void) + ?contentPosRange@QScrollPrepareEvent@@QBE?AVQRectF@@XZ @ 13029 NONAME ; class QRectF QScrollPrepareEvent::contentPosRange(void) const + ?grabGesture@QScroller@@SA?AW4GestureType@Qt@@PAVQObject@@W4ScrollerGestureType@1@@Z @ 13030 NONAME ; enum Qt::GestureType QScroller::grabGesture(class QObject *, enum QScroller::ScrollerGestureType) + ??_EQFlickGesture@@UAE@I@Z @ 13031 NONAME ; QFlickGesture::~QFlickGesture(unsigned int) + ?drawRects@QBlitterPaintEngine@@UAEXPBVQRectF@@H@Z @ 13032 NONAME ; void QBlitterPaintEngine::drawRects(class QRectF const *, int) + ??4QTextLine@@QAEAAV0@ABV0@@Z @ 13033 NONAME ; class QTextLine & QTextLine::operator=(class QTextLine const &) + ??0QToolBarChangeEvent@@QAE@ABV0@@Z @ 13034 NONAME ; QToolBarChangeEvent::QToolBarChangeEvent(class QToolBarChangeEvent const &) + ??1QBlitterPaintEngine@@UAE@XZ @ 13035 NONAME ; QBlitterPaintEngine::~QBlitterPaintEngine(void) + ?markRasterOverlay@QBlittablePixmapData@@QAEXPBVQRectF@@H@Z @ 13036 NONAME ; void QBlittablePixmapData::markRasterOverlay(class QRectF const *, int) + ??0QResizeEvent@@QAE@ABV0@@Z @ 13037 NONAME ; QResizeEvent::QResizeEvent(class QResizeEvent const &) + ??0QIconEngineFactoryInterface@@QAE@XZ @ 13038 NONAME ; QIconEngineFactoryInterface::QIconEngineFactoryInterface(void) + ?drawTextItem@QBlitterPaintEngine@@UAEXABVQPointF@@ABVQTextItem@@@Z @ 13039 NONAME ; void QBlitterPaintEngine::drawTextItem(class QPointF const &, class QTextItem const &) + ??0QPictureFormatInterface@@QAE@XZ @ 13040 NONAME ; QPictureFormatInterface::QPictureFormatInterface(void) + ?trUtf8@QFlickGesture@@SA?AVQString@@PBD0@Z @ 13041 NONAME ; class QString QFlickGesture::trUtf8(char const *, char const *) + ?stop@QScroller@@QAEXXZ @ 13042 NONAME ; void QScroller::stop(void) + ?retrieveData@QInternalMimeData@@MBE?AVQVariant@@ABVQString@@W4Type@2@@Z @ 13043 NONAME ; class QVariant QInternalMimeData::retrieveData(class QString const &, enum QVariant::Type) const + ??8QGlyphs@@QBE_NABV0@@Z @ 13044 NONAME ; bool QGlyphs::operator==(class QGlyphs const &) const + ?drawImage@QBlitterPaintEngine@@UAEXABVQRectF@@ABVQImage@@0V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 13045 NONAME ; void QBlitterPaintEngine::drawImage(class QRectF const &, class QImage const &, class QRectF const &, class QFlags<enum Qt::ImageConversionFlag>) + ?contentPos@QScrollEvent@@QBE?AVQPointF@@XZ @ 13046 NONAME ; class QPointF QScrollEvent::contentPos(void) const + ?mimeTypes@QAbstractProxyModel@@UBE?AVQStringList@@XZ @ 13047 NONAME ; class QStringList QAbstractProxyModel::mimeTypes(void) const + ?createState@QBlitterPaintEngine@@UBEPAVQPainterState@@PAV2@@Z @ 13048 NONAME ; class QPainterState * QBlitterPaintEngine::createState(class QPainterState *) const + ?removeItem@QGraphicsGridLayout@@QAEXPAVQGraphicsLayoutItem@@@Z @ 13049 NONAME ; void QGraphicsGridLayout::removeItem(class QGraphicsLayoutItem *) + ?clipBoundingRect@QPainter@@QBE?AVQRectF@@XZ @ 13050 NONAME ; class QRectF QPainter::clipBoundingRect(void) const + ?formats@QInternalMimeData@@UBE?AVQStringList@@XZ @ 13051 NONAME ; class QStringList QInternalMimeData::formats(void) const + ?stateChanged@QScroller@@IAEXW4State@1@@Z @ 13052 NONAME ; void QScroller::stateChanged(enum QScroller::State) + ?raster@QBlitterPaintEngine@@ABEPAVQRasterPaintEngine@@XZ @ 13053 NONAME ; class QRasterPaintEngine * QBlitterPaintEngine::raster(void) const + ?sort@QAbstractProxyModel@@UAEXHW4SortOrder@Qt@@@Z @ 13054 NONAME ; void QAbstractProxyModel::sort(int, enum Qt::SortOrder) + ?d_func@QBlittable@@AAEPAVQBlittablePrivate@@XZ @ 13055 NONAME ; class QBlittablePrivate * QBlittable::d_func(void) + ?setDefaultScrollerProperties@QScrollerProperties@@SAXABV1@@Z @ 13056 NONAME ; void QScrollerProperties::setDefaultScrollerProperties(class QScrollerProperties const &) + ??_EQPolygon@@QAE@I@Z @ 13057 NONAME ; QPolygon::~QPolygon(unsigned int) + ?type@QBlitterPaintEngine@@UBE?AW4Type@QPaintEngine@@XZ @ 13058 NONAME ; enum QPaintEngine::Type QBlitterPaintEngine::type(void) const + ?qt_metacast@QScroller@@UAEPAXPBD@Z @ 13059 NONAME ; void * QScroller::qt_metacast(char const *) + ??_EQImageReader@@QAE@I@Z @ 13060 NONAME ; QImageReader::~QImageReader(unsigned int) + ?buddy@QAbstractProxyModel@@UBE?AVQModelIndex@@ABV2@@Z @ 13061 NONAME ; class QModelIndex QAbstractProxyModel::buddy(class QModelIndex const &) const + ?tr@QScroller@@SA?AVQString@@PBD0H@Z @ 13062 NONAME ; class QString QScroller::tr(char const *, char const *, int) + ?fill@QImage@@QAEXABVQColor@@@Z @ 13063 NONAME ; void QImage::fill(class QColor const &) + ?scrollMetric@QScrollerProperties@@QBE?AVQVariant@@W4ScrollMetric@1@@Z @ 13064 NONAME ; class QVariant QScrollerProperties::scrollMetric(enum QScrollerProperties::ScrollMetric) const + ?fill@QImage@@QAEXW4GlobalColor@Qt@@@Z @ 13065 NONAME ; void QImage::fill(enum Qt::GlobalColor) + ??4QStyleOptionGraphicsItem@@QAEAAV0@ABV0@@Z @ 13066 NONAME ; class QStyleOptionGraphicsItem & QStyleOptionGraphicsItem::operator=(class QStyleOptionGraphicsItem const &) + ?canFetchMore@QAbstractProxyModel@@UBE_NABVQModelIndex@@@Z @ 13067 NONAME ; bool QAbstractProxyModel::canFetchMore(class QModelIndex const &) const + ??4QStyleOptionProgressBarV2@@QAEAAV0@ABV0@@Z @ 13068 NONAME ; class QStyleOptionProgressBarV2 & QStyleOptionProgressBarV2::operator=(class QStyleOptionProgressBarV2 const &) + ??1QScroller@@EAE@XZ @ 13069 NONAME ; QScroller::~QScroller(void) + ?setFont@QGlyphs@@QAEXABVQFont@@@Z @ 13070 NONAME ; void QGlyphs::setFont(class QFont const &) + ?startPos@QScrollPrepareEvent@@QBE?AVQPointF@@XZ @ 13071 NONAME ; class QPointF QScrollPrepareEvent::startPos(void) const + ?resize@QBlittablePixmapData@@UAEXHH@Z @ 13072 NONAME ; void QBlittablePixmapData::resize(int, int) + ?setTabsClosable@QMdiArea@@QAEX_N@Z @ 13073 NONAME ; void QMdiArea::setTabsClosable(bool) + ?ensureVisible@QScroller@@QAEXABVQRectF@@MM@Z @ 13074 NONAME ; void QScroller::ensureVisible(class QRectF const &, float, float) + ?getText@QInputDialog@@SA?AVQString@@PAVQWidget@@ABV2@1W4EchoMode@QLineEdit@@1PA_NV?$QFlags@W4WindowType@Qt@@@@V?$QFlags@W4InputMethodHint@Qt@@@@@Z @ 13075 NONAME ; class QString QInputDialog::getText(class QWidget *, class QString const &, class QString const &, enum QLineEdit::EchoMode, class QString const &, bool *, class QFlags<enum Qt::WindowType>, class QFlags<enum Qt::InputMethodHint>) + ?hasWidthForHeight@QSizePolicy@@QBE_NXZ @ 13076 NONAME ; bool QSizePolicy::hasWidthForHeight(void) const + ?transformChanged@QBlitterPaintEngine@@UAEXXZ @ 13077 NONAME ; void QBlitterPaintEngine::transformChanged(void) + ??0QDragEnterEvent@@QAE@ABV0@@Z @ 13078 NONAME ; QDragEnterEvent::QDragEnterEvent(class QDragEnterEvent const &) + ??0QBlittablePixmapData@@QAE@XZ @ 13079 NONAME ; QBlittablePixmapData::QBlittablePixmapData(void) + ??_EKey@QPixmapCache@@QAE@I@Z @ 13080 NONAME ; QPixmapCache::Key::~Key(unsigned int) + ??_EQCursor@@QAE@I@Z @ 13081 NONAME ; QCursor::~QCursor(unsigned int) + ?size@QBlittable@@QBE?AVQSize@@XZ @ 13082 NONAME ; class QSize QBlittable::size(void) const + ??0QShortcutEvent@@QAE@ABV0@@Z @ 13083 NONAME ; QShortcutEvent::QShortcutEvent(class QShortcutEvent const &) + ?setBlittable@QBlittablePixmapData@@QAEXPAVQBlittable@@@Z @ 13084 NONAME ; void QBlittablePixmapData::setBlittable(class QBlittable *) + ?opacityChanged@QBlitterPaintEngine@@UAEXXZ @ 13085 NONAME ; void QBlitterPaintEngine::opacityChanged(void) + ?tr@QFlickGesture@@SA?AVQString@@PBD0H@Z @ 13086 NONAME ; class QString QFlickGesture::tr(char const *, char const *, int) + ??_EQTextCursor@@QAE@I@Z @ 13087 NONAME ; QTextCursor::~QTextCursor(unsigned int) + ?createExplicitFontWithName@QFontEngine@@IBE?AVQFont@@ABVQString@@@Z @ 13088 NONAME ; class QFont QFontEngine::createExplicitFontWithName(class QString const &) const + ?setState@QBlitterPaintEngine@@UAEXPAVQPainterState@@@Z @ 13089 NONAME ; void QBlitterPaintEngine::setState(class QPainterState *) + ?clip@QBlitterPaintEngine@@UAEXABVQRegion@@W4ClipOperation@Qt@@@Z @ 13090 NONAME ; void QBlitterPaintEngine::clip(class QRegion const &, enum Qt::ClipOperation) + ?subPixelPositionForX@QTextureGlyphCache@@QBE?AUQFixed@@U2@@Z @ 13091 NONAME ; struct QFixed QTextureGlyphCache::subPixelPositionForX(struct QFixed) const + ?hasAlphaChannel@QBlittablePixmapData@@UBE_NXZ @ 13092 NONAME ; bool QBlittablePixmapData::hasAlphaChannel(void) const + ?setSnapPositionsX@QScroller@@QAEXABV?$QList@M@@@Z @ 13093 NONAME ; void QScroller::setSnapPositionsX(class QList<float> const &) + ?numberSuffix@QTextListFormat@@QBE?AVQString@@XZ @ 13094 NONAME ; class QString QTextListFormat::numberSuffix(void) const + ??HQGlyphs@@ABE?AV0@ABV0@@Z @ 13095 NONAME ; class QGlyphs QGlyphs::operator+(class QGlyphs const &) const + ??0QGradient@@QAE@ABV0@@Z @ 13096 NONAME ; QGradient::QGradient(class QGradient const &) + ?tabsMovable@QMdiArea@@QBE_NXZ @ 13097 NONAME ; bool QMdiArea::tabsMovable(void) const + ??4QInputMethodEvent@@QAEAAV0@ABV0@@Z @ 13098 NONAME ; class QInputMethodEvent & QInputMethodEvent::operator=(class QInputMethodEvent const &) + ?contentPos@QScrollPrepareEvent@@QBE?AVQPointF@@XZ @ 13099 NONAME ; class QPointF QScrollPrepareEvent::contentPos(void) const + ?getStaticMetaObject@QScroller@@SAABUQMetaObject@@XZ @ 13100 NONAME ; struct QMetaObject const & QScroller::getStaticMetaObject(void) + ?end@QBlitterPaintEngine@@UAE_NXZ @ 13101 NONAME ; bool QBlitterPaintEngine::end(void) + ??1QScrollerProperties@@UAE@XZ @ 13102 NONAME ; QScrollerProperties::~QScrollerProperties(void) + ??0QFlickGesture@@QAE@PAVQObject@@W4MouseButton@Qt@@0@Z @ 13103 NONAME ; QFlickGesture::QFlickGesture(class QObject *, enum Qt::MouseButton, class QObject *) + ?fill@QBlitterPaintEngine@@UAEXABVQVectorPath@@ABVQBrush@@@Z @ 13104 NONAME ; void QBlitterPaintEngine::fill(class QVectorPath const &, class QBrush const &) + ?drawPixmap@QBlitterPaintEngine@@UAEXABVQRectF@@ABVQPixmap@@0@Z @ 13105 NONAME ; void QBlitterPaintEngine::drawPixmap(class QRectF const &, class QPixmap const &, class QRectF const &) + ??0QVector2D@@QAE@ABV0@@Z @ 13106 NONAME ; QVector2D::QVector2D(class QVector2D const &) + ?setSnapPositionsY@QScroller@@QAEXABV?$QList@M@@@Z @ 13107 NONAME ; void QScroller::setSnapPositionsY(class QList<float> const &) + ??4QStyleOptionFocusRect@@QAEAAV0@ABV0@@Z @ 13108 NONAME ; class QStyleOptionFocusRect & QStyleOptionFocusRect::operator=(class QStyleOptionFocusRect const &) + ??_EQPen@@QAE@I@Z @ 13109 NONAME ; QPen::~QPen(unsigned int) + ??_EQKeySequence@@QAE@I@Z @ 13110 NONAME ; QKeySequence::~QKeySequence(unsigned int) + ?tr@QInternalMimeData@@SA?AVQString@@PBD0H@Z @ 13111 NONAME ; class QString QInternalMimeData::tr(char const *, char const *, int) + ?velocity@QScroller@@QBE?AVQPointF@@XZ @ 13112 NONAME ; class QPointF QScroller::velocity(void) const + ?glyphIndexes@QGlyphs@@QBE?AV?$QVector@I@@XZ @ 13113 NONAME ; class QVector<unsigned int> QGlyphs::glyphIndexes(void) const + ?get@QFontPrivate@@SAPAV1@ABVQFont@@@Z @ 13114 NONAME ; class QFontPrivate * QFontPrivate::get(class QFont const &) + ?setScrollMetric@QScrollerProperties@@QAEXW4ScrollMetric@1@ABVQVariant@@@Z @ 13115 NONAME ; void QScrollerProperties::setScrollMetric(enum QScrollerProperties::ScrollMetric, class QVariant const &) + ??4QGradient@@QAEAAV0@ABV0@@Z @ 13116 NONAME ; class QGradient & QGradient::operator=(class QGradient const &) + ??0QScrollEvent@@QAE@ABVQPointF@@0W4ScrollState@0@@Z @ 13117 NONAME ; QScrollEvent::QScrollEvent(class QPointF const &, class QPointF const &, enum QScrollEvent::ScrollState) + ?d_func@QFlickGesture@@AAEPAVQFlickGesturePrivate@@XZ @ 13118 NONAME ; class QFlickGesturePrivate * QFlickGesture::d_func(void) + ?scrollState@QScrollEvent@@QBE?AW4ScrollState@1@XZ @ 13119 NONAME ; enum QScrollEvent::ScrollState QScrollEvent::scrollState(void) const + ??0QTextTableFormat@@QAE@ABV0@@Z @ 13120 NONAME ; QTextTableFormat::QTextTableFormat(class QTextTableFormat const &) + ??_EQImagePixmapCleanupHooks@@QAE@I@Z @ 13121 NONAME ; QImagePixmapCleanupHooks::~QImagePixmapCleanupHooks(unsigned int) + ?fetchMore@QAbstractProxyModel@@UAEXABVQModelIndex@@@Z @ 13122 NONAME ; void QAbstractProxyModel::fetchMore(class QModelIndex const &) + ?glyphs@QTextLine@@ABE?AV?$QList@VQGlyphs@@@@HH@Z @ 13123 NONAME ; class QList<class QGlyphs> QTextLine::glyphs(int, int) const + ?getStaticMetaObject@QFlickGesture@@SAABUQMetaObject@@XZ @ 13124 NONAME ; struct QMetaObject const & QFlickGesture::getStaticMetaObject(void) + ?setViewportSize@QScrollPrepareEvent@@QAEXABVQSizeF@@@Z @ 13125 NONAME ; void QScrollPrepareEvent::setViewportSize(class QSizeF const &) + ??0QStatusTipEvent@@QAE@ABV0@@Z @ 13126 NONAME ; QStatusTipEvent::QStatusTipEvent(class QStatusTipEvent const &) + ??0Value@QCss@@QAE@ABU01@@Z @ 13127 NONAME ; QCss::Value::Value(struct QCss::Value const &) + ?d_func@QScrollPrepareEvent@@AAEPAVQScrollPrepareEventPrivate@@XZ @ 13128 NONAME ; class QScrollPrepareEventPrivate * QScrollPrepareEvent::d_func(void) + ?overshootDistance@QScrollEvent@@QBE?AVQPointF@@XZ @ 13129 NONAME ; class QPointF QScrollEvent::overshootDistance(void) const + ?resolveFontFamilyAlias@QFontDatabase@@CA?AVQString@@ABV2@@Z @ 13130 NONAME ; class QString QFontDatabase::resolveFontFamilyAlias(class QString const &) + ?alphaRGBMapForGlyph@QFontEngine@@UAE?AVQImage@@IUQFixed@@HABVQTransform@@@Z @ 13131 NONAME ; class QImage QFontEngine::alphaRGBMapForGlyph(unsigned int, struct QFixed, int, class QTransform const &) + ??4QSizePolicy@@QAEAAV0@ABV0@@Z @ 13132 NONAME ; class QSizePolicy & QSizePolicy::operator=(class QSizePolicy const &) + ?swap@QBitmap@@QAEXAAV1@@Z @ 13133 NONAME ; void QBitmap::swap(class QBitmap &) + ?hasFormat@QInternalMimeData@@UBE_NABVQString@@@Z @ 13134 NONAME ; bool QInternalMimeData::hasFormat(class QString const &) const + ?renderDataHelper@QInternalMimeData@@SA?AVQByteArray@@ABVQString@@PBVQMimeData@@@Z @ 13135 NONAME ; class QByteArray QInternalMimeData::renderDataHelper(class QString const &, class QMimeData const *) + ??_ETouchPoint@QTouchEvent@@QAE@I@Z @ 13136 NONAME ; QTouchEvent::TouchPoint::~TouchPoint(unsigned int) + ??0QWindowSurface@@QAE@PAVQWidget@@_N@Z @ 13137 NONAME ; QWindowSurface::QWindowSurface(class QWidget *, bool) + ?fill@QBlittablePixmapData@@UAEXABVQColor@@@Z @ 13138 NONAME ; void QBlittablePixmapData::fill(class QColor const &) + ?metric@QBlittablePixmapData@@UBEHW4PaintDeviceMetric@QPaintDevice@@@Z @ 13139 NONAME ; int QBlittablePixmapData::metric(enum QPaintDevice::PaintDeviceMetric) const + ??4QItemSelection@@QAEAAV0@ABV0@@Z @ 13140 NONAME ; class QItemSelection & QItemSelection::operator=(class QItemSelection const &) + ?fillRect@QBlitterPaintEngine@@UAEXABVQRectF@@ABVQColor@@@Z @ 13141 NONAME ; void QBlitterPaintEngine::fillRect(class QRectF const &, class QColor const &) + ??4QStyleOptionQ3ListView@@QAEAAV0@ABV0@@Z @ 13142 NONAME ; class QStyleOptionQ3ListView & QStyleOptionQ3ListView::operator=(class QStyleOptionQ3ListView const &) + ??6@YA?AVQDebug@@V0@PBVQSymbianEvent@@@Z @ 13143 NONAME ; class QDebug operator<<(class QDebug, class QSymbianEvent const *) + ??0QSizePolicy@@QAE@ABV0@@Z @ 13144 NONAME ; QSizePolicy::QSizePolicy(class QSizePolicy const &) + ?ProcessCommandParametersL@QS60MainAppUi@@UAEHW4TApaCommand@@AAV?$TBuf@$0BAA@@@ABVTDesC8@@@Z @ 13145 NONAME ; int QS60MainAppUi::ProcessCommandParametersL(enum TApaCommand, class TBuf<256> &, class TDesC8 const &) + ?scrollerProperties@QScroller@@QBE?AVQScrollerProperties@@XZ @ 13146 NONAME ; class QScrollerProperties QScroller::scrollerProperties(void) const + ??_EQBlittablePixmapData@@UAE@I@Z @ 13147 NONAME ; QBlittablePixmapData::~QBlittablePixmapData(unsigned int) + ?mimeData@QAbstractProxyModel@@UBEPAVQMimeData@@ABV?$QList@VQModelIndex@@@@@Z @ 13148 NONAME ; class QMimeData * QAbstractProxyModel::mimeData(class QList<class QModelIndex> const &) const + ??4QStyleOptionFrameV2@@QAEAAV0@ABV0@@Z @ 13149 NONAME ; class QStyleOptionFrameV2 & QStyleOptionFrameV2::operator=(class QStyleOptionFrameV2 const &) + ??_EQScroller@@UAE@I@Z @ 13150 NONAME ; QScroller::~QScroller(unsigned int) + ??1QScrollPrepareEvent@@UAE@XZ @ 13151 NONAME ; QScrollPrepareEvent::~QScrollPrepareEvent(void) + ??4QVector3D@@QAEAAV0@ABV0@@Z @ 13152 NONAME ; class QVector3D & QVector3D::operator=(class QVector3D const &) + ?setTabsMovable@QMdiArea@@QAEX_N@Z @ 13153 NONAME ; void QMdiArea::setTabsMovable(bool) + ?minimumSizeHint@QRadioButton@@UBE?AVQSize@@XZ @ 13154 NONAME ; class QSize QRadioButton::minimumSizeHint(void) const + ??4QStyleOptionQ3DockWindow@@QAEAAV0@ABV0@@Z @ 13155 NONAME ; class QStyleOptionQ3DockWindow & QStyleOptionQ3DockWindow::operator=(class QStyleOptionQ3DockWindow const &) + ?qt_metacast@QFlickGesture@@UAEPAXPBD@Z @ 13156 NONAME ; void * QFlickGesture::qt_metacast(char const *) + ??_EQFont@@QAE@I@Z @ 13157 NONAME ; QFont::~QFont(unsigned int) + ?setPositions@QGlyphs@@QAEXABV?$QVector@VQPointF@@@@@Z @ 13158 NONAME ; void QGlyphs::setPositions(class QVector<class QPointF> const &) + ??4QStyleOptionDockWidget@@QAEAAV0@ABV0@@Z @ 13159 NONAME ; class QStyleOptionDockWidget & QStyleOptionDockWidget::operator=(class QStyleOptionDockWidget const &) + ??0QPainterState@@QAE@ABV0@@Z @ 13160 NONAME ; QPainterState::QPainterState(class QPainterState const &) + ??4QStyleOptionFrame@@QAEAAV0@ABV0@@Z @ 13161 NONAME ; class QStyleOptionFrame & QStyleOptionFrame::operator=(class QStyleOptionFrame const &) + ?drawRects@QBlitterPaintEngine@@UAEXPBVQRect@@H@Z @ 13162 NONAME ; void QBlitterPaintEngine::drawRects(class QRect const *, int) + ?fillInPendingGlyphs@QTextureGlyphCache@@QAEXXZ @ 13163 NONAME ; void QTextureGlyphCache::fillInPendingGlyphs(void) + ?metaObject@QFlickGesture@@UBEPBUQMetaObject@@XZ @ 13164 NONAME ; struct QMetaObject const * QFlickGesture::metaObject(void) const + ?renderHintsChanged@QBlitterPaintEngine@@UAEXXZ @ 13165 NONAME ; void QBlitterPaintEngine::renderHintsChanged(void) + ?supportedDropActions@QAbstractProxyModel@@UBE?AV?$QFlags@W4DropAction@Qt@@@@XZ @ 13166 NONAME ; class QFlags<enum Qt::DropAction> QAbstractProxyModel::supportedDropActions(void) const + ?hasStaticContentsSupport@QRasterWindowSurface@@UBE_NXZ @ 13167 NONAME ; bool QRasterWindowSurface::hasStaticContentsSupport(void) const + ?fillRect@QBlitterPaintEngine@@UAEXABVQRectF@@ABVQBrush@@@Z @ 13168 NONAME ; void QBlitterPaintEngine::fillRect(class QRectF const &, class QBrush const &) + ?setGlyphIndexes@QGlyphs@@QAEXABV?$QVector@I@@@Z @ 13169 NONAME ; void QGlyphs::setGlyphIndexes(class QVector<unsigned int> const &) + ?alphaMapBoundingBox@QFontEngine@@UAE?AUglyph_metrics_t@@IABVQTransform@@W4GlyphFormat@1@@Z @ 13170 NONAME ; struct glyph_metrics_t QFontEngine::alphaMapBoundingBox(unsigned int, class QTransform const &, enum QFontEngine::GlyphFormat) + ?resendPrepareEvent@QScroller@@QAEXXZ @ 13171 NONAME ; void QScroller::resendPrepareEvent(void) + ??4QTextLength@@QAEAAV0@ABV0@@Z @ 13172 NONAME ; class QTextLength & QTextLength::operator=(class QTextLength const &) + ??0QHelpEvent@@QAE@ABV0@@Z @ 13173 NONAME ; QHelpEvent::QHelpEvent(class QHelpEvent const &) + ??0QContextMenuEvent@@QAE@ABV0@@Z @ 13174 NONAME ; QContextMenuEvent::QContextMenuEvent(class QContextMenuEvent const &) + ?d_func@QBlittable@@ABEPBVQBlittablePrivate@@XZ @ 13175 NONAME ; class QBlittablePrivate const * QBlittable::d_func(void) const + ?state@QBlitterPaintEngine@@QBEPBVQPainterState@@XZ @ 13176 NONAME ; class QPainterState const * QBlitterPaintEngine::state(void) const + ??0QScrollPrepareEvent@@QAE@ABVQPointF@@@Z @ 13177 NONAME ; QScrollPrepareEvent::QScrollPrepareEvent(class QPointF const &) + ??0QWhatsThisClickedEvent@@QAE@ABV0@@Z @ 13178 NONAME ; QWhatsThisClickedEvent::QWhatsThisClickedEvent(class QWhatsThisClickedEvent const &) + ??4QStyleOptionTab@@QAEAAV0@ABV0@@Z @ 13179 NONAME ; class QStyleOptionTab & QStyleOptionTab::operator=(class QStyleOptionTab const &) + ??0QTabletEvent@@QAE@ABV0@@Z @ 13180 NONAME ; QTabletEvent::QTabletEvent(class QTabletEvent const &) + ?scrollTo@QScroller@@QAEXABVQPointF@@H@Z @ 13181 NONAME ; void QScroller::scrollTo(class QPointF const &, int) + ?ungrabGesture@QScroller@@SAXPAVQObject@@@Z @ 13182 NONAME ; void QScroller::ungrabGesture(class QObject *) + ??4QItemSelectionRange@@QAEAAV0@ABV0@@Z @ 13183 NONAME ; class QItemSelectionRange & QItemSelectionRange::operator=(class QItemSelectionRange const &) + ?clear@QGlyphs@@QAEXXZ @ 13184 NONAME ; void QGlyphs::clear(void) + ??_EQStyleOptionViewItemV4@@QAE@I@Z @ 13185 NONAME ; QStyleOptionViewItemV4::~QStyleOptionViewItemV4(unsigned int) + ??1QBlittablePixmapData@@UAE@XZ @ 13186 NONAME ; QBlittablePixmapData::~QBlittablePixmapData(void) + ?formatsHelper@QInternalMimeData@@SA?AVQStringList@@PBVQMimeData@@@Z @ 13187 NONAME ; class QStringList QInternalMimeData::formatsHelper(class QMimeData const *) + ?qt_metacast@QInternalMimeData@@UAEPAXPBD@Z @ 13188 NONAME ; void * QInternalMimeData::qt_metacast(char const *) + ?font@QGlyphs@@QBE?AVQFont@@XZ @ 13189 NONAME ; class QFont QGlyphs::font(void) const + ?paintEngine@QBlittablePixmapData@@UBEPAVQPaintEngine@@XZ @ 13190 NONAME ; class QPaintEngine * QBlittablePixmapData::paintEngine(void) const + ?unsetDefaultScrollerProperties@QScrollerProperties@@SAXXZ @ 13191 NONAME ; void QScrollerProperties::unsetDefaultScrollerProperties(void) + ?hasChildren@QAbstractProxyModel@@UBE_NABVQModelIndex@@@Z @ 13192 NONAME ; bool QAbstractProxyModel::hasChildren(class QModelIndex const &) const + ?swap@QPen@@QAEXAAV1@@Z @ 13193 NONAME ; void QPen::swap(class QPen &) + ?span@QAbstractProxyModel@@UBE?AVQSize@@ABVQModelIndex@@@Z @ 13194 NONAME ; class QSize QAbstractProxyModel::span(class QModelIndex const &) const + ??4QEglProperties@@QAEAAV0@ABV0@@Z @ 13195 NONAME ; class QEglProperties & QEglProperties::operator=(class QEglProperties const &) + ??0QHoverEvent@@QAE@ABV0@@Z @ 13196 NONAME ; QHoverEvent::QHoverEvent(class QHoverEvent const &) + ??0QPaintEngineState@@QAE@XZ @ 13197 NONAME ; QPaintEngineState::QPaintEngineState(void) + ?setSnapPositionsY@QScroller@@QAEXMM@Z @ 13198 NONAME ; void QScroller::setSnapPositionsY(float, float) + ?d_func@QScrollPrepareEvent@@ABEPBVQScrollPrepareEventPrivate@@XZ @ 13199 NONAME ; class QScrollPrepareEventPrivate const * QScrollPrepareEvent::d_func(void) const + ?textureMapForGlyph@QTextureGlyphCache@@QBE?AVQImage@@IUQFixed@@@Z @ 13200 NONAME ; class QImage QTextureGlyphCache::textureMapForGlyph(unsigned int, struct QFixed) const + ??0QKeyEvent@@QAE@ABV0@@Z @ 13201 NONAME ; QKeyEvent::QKeyEvent(class QKeyEvent const &) + ??0QIconEngine@@QAE@ABV0@@Z @ 13202 NONAME ; QIconEngine::QIconEngine(class QIconEngine const &) + ??4QStyleOptionToolBoxV2@@QAEAAV0@ABV0@@Z @ 13203 NONAME ; class QStyleOptionToolBoxV2 & QStyleOptionToolBoxV2::operator=(class QStyleOptionToolBoxV2 const &) + ?qt_metacall@QInternalMimeData@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 13204 NONAME ; int QInternalMimeData::qt_metacall(enum QMetaObject::Call, int, void * *) + ?lineHeightType@QTextBlockFormat@@QBEHXZ @ 13205 NONAME ; int QTextBlockFormat::lineHeightType(void) const + ?hintingPreference@QFont@@QBE?AW4HintingPreference@1@XZ @ 13206 NONAME ; enum QFont::HintingPreference QFont::hintingPreference(void) const + ??0QGlyphs@@QAE@XZ @ 13207 NONAME ; QGlyphs::QGlyphs(void) + ?trUtf8@QInternalMimeData@@SA?AVQString@@PBD0H@Z @ 13208 NONAME ; class QString QInternalMimeData::trUtf8(char const *, char const *, int) + ??0QImageIOHandlerFactoryInterface@@QAE@XZ @ 13209 NONAME ; QImageIOHandlerFactoryInterface::QImageIOHandlerFactoryInterface(void) + ??_EQRegion@@QAE@I@Z @ 13210 NONAME ; QRegion::~QRegion(unsigned int) + ?begin@QBlitterPaintEngine@@UAE_NPAVQPaintDevice@@@Z @ 13211 NONAME ; bool QBlitterPaintEngine::begin(class QPaintDevice *) + ?inFontUcs4@QFontMetricsF@@QBE_NI@Z @ 13212 NONAME ; bool QFontMetricsF::inFontUcs4(unsigned int) const + ?viewportSize@QScrollPrepareEvent@@QBE?AVQSizeF@@XZ @ 13213 NONAME ; class QSizeF QScrollPrepareEvent::viewportSize(void) const + ?markRasterOverlay@QBlittablePixmapData@@QAEXABVQRectF@@@Z @ 13214 NONAME ; void QBlittablePixmapData::markRasterOverlay(class QRectF const &) + ?d_func@QBlitterPaintEngine@@AAEPAVQBlitterPaintEnginePrivate@@XZ @ 13215 NONAME ; class QBlitterPaintEnginePrivate * QBlitterPaintEngine::d_func(void) + ?setNumberPrefix@QTextListFormat@@QAEXABVQString@@@Z @ 13216 NONAME ; void QTextListFormat::setNumberPrefix(class QString const &) + ?lineHeight@QTextBlockFormat@@QBEMMM@Z @ 13217 NONAME ; float QTextBlockFormat::lineHeight(float, float) const + ??4QStyleOptionComplex@@QAEAAV0@ABV0@@Z @ 13218 NONAME ; class QStyleOptionComplex & QStyleOptionComplex::operator=(class QStyleOptionComplex const &) + ?getItem@QInputDialog@@SA?AVQString@@PAVQWidget@@ABV2@1ABVQStringList@@H_NPA_NV?$QFlags@W4WindowType@Qt@@@@V?$QFlags@W4InputMethodHint@Qt@@@@@Z @ 13219 NONAME ; class QString QInputDialog::getItem(class QWidget *, class QString const &, class QString const &, class QStringList const &, int, bool, bool *, class QFlags<enum Qt::WindowType>, class QFlags<enum Qt::InputMethodHint>) + ??_EFileInfo@QZipReader@@QAE@I@Z @ 13220 NONAME ; QZipReader::FileInfo::~FileInfo(unsigned int) + ?qGamma_correct_back_to_linear_cs@@YAXPAVQImage@@@Z @ 13221 NONAME ; void qGamma_correct_back_to_linear_cs(class QImage *) + ??0QBitmap@@QAE@ABV0@@Z @ 13222 NONAME ; QBitmap::QBitmap(class QBitmap const &) + ?clip@QBlitterPaintEngine@@UAEXABVQVectorPath@@W4ClipOperation@Qt@@@Z @ 13223 NONAME ; void QBlitterPaintEngine::clip(class QVectorPath const &, enum Qt::ClipOperation) + ??1QScrollEvent@@UAE@XZ @ 13224 NONAME ; QScrollEvent::~QScrollEvent(void) + ?state@QScroller@@QBE?AW4State@1@XZ @ 13225 NONAME ; enum QScroller::State QScroller::state(void) const + ?positions@QGlyphs@@QBE?AV?$QVector@VQPointF@@@@XZ @ 13226 NONAME ; class QVector<class QPointF> QGlyphs::positions(void) const + ?tr@QScroller@@SA?AVQString@@PBD0@Z @ 13227 NONAME ; class QString QScroller::tr(char const *, char const *) + ?canReadData@QInternalMimeData@@SA_NABVQString@@@Z @ 13228 NONAME ; bool QInternalMimeData::canReadData(class QString const &) + ?glyphs@QTextLayout@@QBE?AV?$QList@VQGlyphs@@@@XZ @ 13229 NONAME ; class QList<class QGlyphs> QTextLayout::glyphs(void) const + ??_EQTextFormat@@QAE@I@Z @ 13230 NONAME ; QTextFormat::~QTextFormat(unsigned int) + ??4QStyleOptionTabWidgetFrame@@QAEAAV0@ABV0@@Z @ 13231 NONAME ; class QStyleOptionTabWidgetFrame & QStyleOptionTabWidgetFrame::operator=(class QStyleOptionTabWidgetFrame const &) + ?trUtf8@QScroller@@SA?AVQString@@PBD0H@Z @ 13232 NONAME ; class QString QScroller::trUtf8(char const *, char const *, int) + ?d_func@QFlickGesture@@ABEPBVQFlickGesturePrivate@@XZ @ 13233 NONAME ; class QFlickGesturePrivate const * QFlickGesture::d_func(void) const + ??4QMouseEvent@@QAEAAV0@ABV0@@Z @ 13234 NONAME ; class QMouseEvent & QMouseEvent::operator=(class QMouseEvent const &) + ??_EQPainter@@QAE@I@Z @ 13235 NONAME ; QPainter::~QPainter(unsigned int) + ??4QStyleOptionTabBarBaseV2@@QAEAAV0@ABV0@@Z @ 13236 NONAME ; class QStyleOptionTabBarBaseV2 & QStyleOptionTabBarBaseV2::operator=(class QStyleOptionTabBarBaseV2 const &) + ??4QInputEvent@@QAEAAV0@ABV0@@Z @ 13237 NONAME ; class QInputEvent & QInputEvent::operator=(class QInputEvent const &) + ?hasScroller@QScroller@@SA_NPAVQObject@@@Z @ 13238 NONAME ; bool QScroller::hasScroller(class QObject *) + ?alphaMapForGlyph@QFontEngine@@UAE?AVQImage@@IUQFixed@@ABVQTransform@@@Z @ 13239 NONAME ; class QImage QFontEngine::alphaMapForGlyph(unsigned int, struct QFixed, class QTransform const &) + ??_EQPainterPath@@QAE@I@Z @ 13240 NONAME ; QPainterPath::~QPainterPath(unsigned int) + ??_EQGlyphs@@QAE@I@Z @ 13241 NONAME ; QGlyphs::~QGlyphs(unsigned int) + ?fromImage@QBlittablePixmapData@@UAEXABVQImage@@V?$QFlags@W4ImageConversionFlag@Qt@@@@@Z @ 13242 NONAME ; void QBlittablePixmapData::fromImage(class QImage const &, class QFlags<enum Qt::ImageConversionFlag>) + ??0QInternalMimeData@@QAE@XZ @ 13243 NONAME ; QInternalMimeData::QInternalMimeData(void) + ??_EQScrollEvent@@UAE@I@Z @ 13244 NONAME ; QScrollEvent::~QScrollEvent(unsigned int) + ??4QGlyphs@@QAEAAV0@ABV0@@Z @ 13245 NONAME ; class QGlyphs & QGlyphs::operator=(class QGlyphs const &) + ??4QQuaternion@@QAEAAV0@ABV0@@Z @ 13246 NONAME ; class QQuaternion & QQuaternion::operator=(class QQuaternion const &) + ??4Symbol@QCss@@QAEAAU01@ABU01@@Z @ 13247 NONAME ; struct QCss::Symbol & QCss::Symbol::operator=(struct QCss::Symbol const &) + ??0QBlittable@@QAE@ABVQSize@@V?$QFlags@W4Capability@QBlittable@@@@@Z @ 13248 NONAME ; QBlittable::QBlittable(class QSize const &, class QFlags<enum QBlittable::Capability>) + ??0QIconDragEvent@@QAE@ABV0@@Z @ 13249 NONAME ; QIconDragEvent::QIconDragEvent(class QIconDragEvent const &) + ?scroller@QScroller@@SAPAV1@PAVQObject@@@Z @ 13250 NONAME ; class QScroller * QScroller::scroller(class QObject *) + ??4QScrollerProperties@@QAEAAV0@ABV0@@Z @ 13251 NONAME ; class QScrollerProperties & QScrollerProperties::operator=(class QScrollerProperties const &) + ?d_func@QScroller@@AAEPAVQScrollerPrivate@@XZ @ 13252 NONAME ; class QScrollerPrivate * QScroller::d_func(void) + ?scrollerPropertiesChanged@QScroller@@IAEXABVQScrollerProperties@@@Z @ 13253 NONAME ; void QScroller::scrollerPropertiesChanged(class QScrollerProperties const &) + ?markRasterOverlay@QBlittablePixmapData@@QAEXPBVQRect@@H@Z @ 13254 NONAME ; void QBlittablePixmapData::markRasterOverlay(class QRect const *, int) + ?tabsClosable@QMdiArea@@QBE_NXZ @ 13255 NONAME ; bool QMdiArea::tabsClosable(void) const + ?canStartScrollingAt@QAbstractScrollAreaPrivate@@QAE_NABVQPoint@@@Z @ 13256 NONAME ; bool QAbstractScrollAreaPrivate::canStartScrollingAt(class QPoint const &) + ??0QScrollerProperties@@QAE@XZ @ 13257 NONAME ; QScrollerProperties::QScrollerProperties(void) + ?setLineHeight@QTextBlockFormat@@QAEXMH@Z @ 13258 NONAME ; void QTextBlockFormat::setLineHeight(float, int) + ?calculateSubPixelPositionCount@QTextureGlyphCache@@IBEHI@Z @ 13259 NONAME ; int QTextureGlyphCache::calculateSubPixelPositionCount(unsigned int) const + ??0QTextImageFormat@@QAE@ABV0@@Z @ 13260 NONAME ; QTextImageFormat::QTextImageFormat(class QTextImageFormat const &) + ??0QMoveEvent@@QAE@ABV0@@Z @ 13261 NONAME ; QMoveEvent::QMoveEvent(class QMoveEvent const &) + ?glyphs@QTextFragment@@QBE?AV?$QList@VQGlyphs@@@@XZ @ 13262 NONAME ; class QList<class QGlyphs> QTextFragment::glyphs(void) const + ??0QInputContextFactoryInterface@@QAE@XZ @ 13263 NONAME ; QInputContextFactoryInterface::QInputContextFactoryInterface(void) + ??0QTextFrameFormat@@QAE@ABV0@@Z @ 13264 NONAME ; QTextFrameFormat::QTextFrameFormat(class QTextFrameFormat const &) + ?resetInternalData@QAbstractProxyModel@@IAEXXZ @ 13265 NONAME ; void QAbstractProxyModel::resetInternalData(void) + ??0Symbol@QCss@@QAE@ABU01@@Z @ 13266 NONAME ; QCss::Symbol::Symbol(struct QCss::Symbol const &) + ?markRasterOverlay@QBlittablePixmapData@@QAEXABVQVectorPath@@@Z @ 13267 NONAME ; void QBlittablePixmapData::markRasterOverlay(class QVectorPath const &) + ??4QStyleOptionFrameV3@@QAEAAV0@ABV0@@Z @ 13268 NONAME ; class QStyleOptionFrameV3 & QStyleOptionFrameV3::operator=(class QStyleOptionFrameV3 const &) + ?scrollTo@QScroller@@QAEXABVQPointF@@@Z @ 13269 NONAME ; void QScroller::scrollTo(class QPointF const &) + ??0QGraphicsSystem@@QAE@XZ @ 13270 NONAME ; QGraphicsSystem::QGraphicsSystem(void) + ??4QStyleOptionViewItem@@QAEAAV0@ABV0@@Z @ 13271 NONAME ; class QStyleOptionViewItem & QStyleOptionViewItem::operator=(class QStyleOptionViewItem const &) + ??4QStyleOptionProgressBar@@QAEAAV0@ABV0@@Z @ 13272 NONAME ; class QStyleOptionProgressBar & QStyleOptionProgressBar::operator=(class QStyleOptionProgressBar const &) + ?clip@QBlitterPaintEngine@@QAEPBVQClipData@@XZ @ 13273 NONAME ; class QClipData const * QBlitterPaintEngine::clip(void) + ?d_func@QScroller@@ABEPBVQScrollerPrivate@@XZ @ 13274 NONAME ; class QScrollerPrivate const * QScroller::d_func(void) const + ?setNumberSuffix@QTextListFormat@@QAEXABVQString@@@Z @ 13275 NONAME ; void QTextListFormat::setNumberSuffix(class QString const &) + ?swap@QPicture@@QAEXAAV1@@Z @ 13276 NONAME ; void QPicture::swap(class QPicture &) + ?swap@QPainterPath@@QAEXAAV1@@Z @ 13277 NONAME ; void QPainterPath::swap(class QPainterPath &) + ??4QStyleOptionRubberBand@@QAEAAV0@ABV0@@Z @ 13278 NONAME ; class QStyleOptionRubberBand & QStyleOptionRubberBand::operator=(class QStyleOptionRubberBand const &) + ?minimumSizeHint@QCheckBox@@UBE?AVQSize@@XZ @ 13279 NONAME ; class QSize QCheckBox::minimumSizeHint(void) const + ?createExplicitFont@QFontEngine@@UBE?AVQFont@@XZ @ 13280 NONAME ; class QFont QFontEngine::createExplicitFont(void) const + ?alphaMapForGlyph@QFontEngine@@UAE?AVQImage@@IUQFixed@@@Z @ 13281 NONAME ; class QImage QFontEngine::alphaMapForGlyph(unsigned int, struct QFixed) + ?fillTexture@QImageTextureGlyphCache@@UAEXABUCoord@QTextureGlyphCache@@IUQFixed@@@Z @ 13282 NONAME ; void QImageTextureGlyphCache::fillTexture(struct QTextureGlyphCache::Coord const &, unsigned int, struct QFixed) + ?swap@QIcon@@QAEXAAV1@@Z @ 13283 NONAME ; void QIcon::swap(class QIcon &) + ?unmarkRasterOverlay@QBlittablePixmapData@@QAEXABVQRectF@@@Z @ 13284 NONAME ; void QBlittablePixmapData::unmarkRasterOverlay(class QRectF const &) + ??0QDragResponseEvent@@QAE@ABV0@@Z @ 13285 NONAME ; QDragResponseEvent::QDragResponseEvent(class QDragResponseEvent const &) + ??0QIconEngine@@QAE@XZ @ 13286 NONAME ; QIconEngine::QIconEngine(void) + ?brushOriginChanged@QBlitterPaintEngine@@UAEXXZ @ 13287 NONAME ; void QBlitterPaintEngine::brushOriginChanged(void) + ?openFile@QFileOpenEvent@@QBE_NAAVQFile@@V?$QFlags@W4OpenModeFlag@QIODevice@@@@@Z @ 13288 NONAME ; bool QFileOpenEvent::openFile(class QFile &, class QFlags<enum QIODevice::OpenModeFlag>) const + ??_EQBrush@@QAE@I@Z @ 13289 NONAME ; QBrush::~QBrush(unsigned int) + ??0QApplicationPrivate@@QAE@AAHPAPADW4Type@QApplication@@H@Z @ 13290 NONAME ; QApplicationPrivate::QApplicationPrivate(int &, char * *, enum QApplication::Type, int) + ?handleInput@QScroller@@QAE_NW4Input@1@ABVQPointF@@_J@Z @ 13291 NONAME ; bool QScroller::handleInput(enum QScroller::Input, class QPointF const &, long long) + ??8QScrollerProperties@@QBE_NABV0@@Z @ 13292 NONAME ; bool QScrollerProperties::operator==(class QScrollerProperties const &) const + ?inFontUcs4@QFontMetrics@@QBE_NI@Z @ 13293 NONAME ; bool QFontMetrics::inFontUcs4(unsigned int) const + ??_EQTableWidgetSelectionRange@@QAE@I@Z @ 13294 NONAME ; QTableWidgetSelectionRange::~QTableWidgetSelectionRange(unsigned int) + ??4QStyleOptionTabBarBase@@QAEAAV0@ABV0@@Z @ 13295 NONAME ; class QStyleOptionTabBarBase & QStyleOptionTabBarBase::operator=(class QStyleOptionTabBarBase const &) + ??0QTextObjectInterface@@QAE@XZ @ 13296 NONAME ; QTextObjectInterface::QTextObjectInterface(void) + ?unlock@QBlittable@@QAEXXZ @ 13297 NONAME ; void QBlittable::unlock(void) + ?metaObject@QScroller@@UBEPBUQMetaObject@@XZ @ 13298 NONAME ; struct QMetaObject const * QScroller::metaObject(void) const + ?d_func@QScrollEvent@@ABEPBVQScrollEventPrivate@@XZ @ 13299 NONAME ; class QScrollEventPrivate const * QScrollEvent::d_func(void) const + ?swap@QRegion@@QAEXAAV1@@Z @ 13300 NONAME ; void QRegion::swap(class QRegion &) + ??0QHideEvent@@QAE@ABV0@@Z @ 13301 NONAME ; QHideEvent::QHideEvent(class QHideEvent const &) + ?ensureVisible@QScroller@@QAEXABVQRectF@@MMH@Z @ 13302 NONAME ; void QScroller::ensureVisible(class QRectF const &, float, float, int) + ?qt_metacall@QFlickGesture@@UAEHW4Call@QMetaObject@@HPAPAX@Z @ 13303 NONAME ; int QFlickGesture::qt_metacall(enum QMetaObject::Call, int, void * *) + ?setItemData@QAbstractProxyModel@@UAE_NABVQModelIndex@@ABV?$QMap@HVQVariant@@@@@Z @ 13304 NONAME ; bool QAbstractProxyModel::setItemData(class QModelIndex const &, class QMap<int, class QVariant> const &) + ?getStaticMetaObject@QInternalMimeData@@SAABUQMetaObject@@XZ @ 13305 NONAME ; struct QMetaObject const & QInternalMimeData::getStaticMetaObject(void) + ?swap@QPolygonF@@QAEXAAV1@@Z @ 13306 NONAME ; void QPolygonF::swap(class QPolygonF &) + ?swap@QPolygon@@QAEXAAV1@@Z @ 13307 NONAME ; void QPolygon::swap(class QPolygon &) + ??_EQScrollPrepareEvent@@UAE@I@Z @ 13308 NONAME ; QScrollPrepareEvent::~QScrollPrepareEvent(unsigned int) + ?d_func@QBlitterPaintEngine@@ABEPBVQBlitterPaintEnginePrivate@@XZ @ 13309 NONAME ; class QBlitterPaintEnginePrivate const * QBlitterPaintEngine::d_func(void) const + ?pixelPerMeter@QScroller@@QBE?AVQPointF@@XZ @ 13310 NONAME ; class QPointF QScroller::pixelPerMeter(void) const + ?target@QScroller@@QBEPAVQObject@@XZ @ 13311 NONAME ; class QObject * QScroller::target(void) const + ?swap@QKeySequence@@QAEXAAV1@@Z @ 13312 NONAME ; void QKeySequence::swap(class QKeySequence &) + ??1QGlyphs@@QAE@XZ @ 13313 NONAME ; QGlyphs::~QGlyphs(void) + ?lineHeight@QTextBlockFormat@@QBEMXZ @ 13314 NONAME ; float QTextBlockFormat::lineHeight(void) const + ?stroke@QBlitterPaintEngine@@UAEXABVQVectorPath@@ABVQPen@@@Z @ 13315 NONAME ; void QBlitterPaintEngine::stroke(class QVectorPath const &, class QPen const &) + ?tr@QInternalMimeData@@SA?AVQString@@PBD0@Z @ 13316 NONAME ; class QString QInternalMimeData::tr(char const *, char const *) + ??9QGlyphs@@QBE_NABV0@@Z @ 13317 NONAME ; bool QGlyphs::operator!=(class QGlyphs const &) const + ??1QBlittable@@UAE@XZ @ 13318 NONAME ; QBlittable::~QBlittable(void) + ??_EQBlitterPaintEngine@@UAE@I@Z @ 13319 NONAME ; QBlitterPaintEngine::~QBlitterPaintEngine(unsigned int) + ??0QCloseEvent@@QAE@ABV0@@Z @ 13320 NONAME ; QCloseEvent::QCloseEvent(class QCloseEvent const &) + ?grabbedGesture@QScroller@@SA?AW4GestureType@Qt@@PAVQObject@@@Z @ 13321 NONAME ; enum Qt::GestureType QScroller::grabbedGesture(class QObject *) + ?buffer@QBlittablePixmapData@@UAEPAVQImage@@XZ @ 13322 NONAME ; class QImage * QBlittablePixmapData::buffer(void) + ??0QTextFrameLayoutData@@QAE@XZ @ 13323 NONAME ; QTextFrameLayoutData::QTextFrameLayoutData(void) + ?staticMetaObject@QFlickGesture@@2UQMetaObject@@B @ 13324 NONAME ; struct QMetaObject const QFlickGesture::staticMetaObject + ?finalPosition@QScroller@@QBE?AVQPointF@@XZ @ 13325 NONAME ; class QPointF QScroller::finalPosition(void) const + ??4QStyleOptionTabWidgetFrameV2@@QAEAAV0@ABV0@@Z @ 13326 NONAME ; class QStyleOptionTabWidgetFrameV2 & QStyleOptionTabWidgetFrameV2::operator=(class QStyleOptionTabWidgetFrameV2 const &) + ?drawStaticTextItem@QBlitterPaintEngine@@UAEXPAVQStaticTextItem@@@Z @ 13327 NONAME ; void QBlitterPaintEngine::drawStaticTextItem(class QStaticTextItem *) + ??0QGlyphs@@QAE@ABV0@@Z @ 13328 NONAME ; QGlyphs::QGlyphs(class QGlyphs const &) + ?lock@QBlittable@@QAEPAVQImage@@XZ @ 13329 NONAME ; class QImage * QBlittable::lock(void) + ?setFontHintingPreference@QTextCharFormat@@QAEXW4HintingPreference@QFont@@@Z @ 13330 NONAME ; void QTextCharFormat::setFontHintingPreference(enum QFont::HintingPreference) + ??4QStyleOptionTabV2@@QAEAAV0@ABV0@@Z @ 13331 NONAME ; class QStyleOptionTabV2 & QStyleOptionTabV2::operator=(class QStyleOptionTabV2 const &) + ??_EQInternalMimeData@@UAE@I@Z @ 13332 NONAME ; QInternalMimeData::~QInternalMimeData(unsigned int) + ??4QTextListFormat@@QAEAAV0@ABV0@@Z @ 13333 NONAME ; class QTextListFormat & QTextListFormat::operator=(class QTextListFormat const &) + ??_EQPalette@@QAE@I@Z @ 13334 NONAME ; QPalette::~QPalette(unsigned int) + ??0QFocusEvent@@QAE@ABV0@@Z @ 13335 NONAME ; QFocusEvent::QFocusEvent(class QFocusEvent const &) + ??4QStyleOptionQ3ListViewItem@@QAEAAV0@ABV0@@Z @ 13336 NONAME ; class QStyleOptionQ3ListViewItem & QStyleOptionQ3ListViewItem::operator=(class QStyleOptionQ3ListViewItem const &) + ?markRasterOverlay@QBlittablePixmapData@@QAEXABVQPointF@@ABVQTextItem@@@Z @ 13337 NONAME ; void QBlittablePixmapData::markRasterOverlay(class QPointF const &, class QTextItem const &) + ?trUtf8@QScroller@@SA?AVQString@@PBD0@Z @ 13338 NONAME ; class QString QScroller::trUtf8(char const *, char const *) + ??_EQIcon@@QAE@I@Z @ 13339 NONAME ; QIcon::~QIcon(unsigned int) + ??YQGlyphs@@AAEAAV0@ABV0@@Z @ 13340 NONAME ; class QGlyphs & QGlyphs::operator+=(class QGlyphs const &) + ??9QScrollerProperties@@QBE_NABV0@@Z @ 13341 NONAME ; bool QScrollerProperties::operator!=(class QScrollerProperties const &) const + ??0QTextListFormat@@QAE@ABV0@@Z @ 13342 NONAME ; QTextListFormat::QTextListFormat(class QTextListFormat const &) + ?drawEllipse@QBlitterPaintEngine@@UAEXABVQRectF@@@Z @ 13343 NONAME ; void QBlitterPaintEngine::drawEllipse(class QRectF const &) + ??0QGuiPlatformPluginInterface@@QAE@XZ @ 13344 NONAME ; QGuiPlatformPluginInterface::QGuiPlatformPluginInterface(void) + ??_EQTextLayout@@QAE@I@Z @ 13345 NONAME ; QTextLayout::~QTextLayout(unsigned int) + ??0QWheelEvent@@QAE@ABV0@@Z @ 13346 NONAME ; QWheelEvent::QWheelEvent(class QWheelEvent const &) + ?blittable@QBlittablePixmapData@@QBEPAVQBlittable@@XZ @ 13347 NONAME ; class QBlittable * QBlittablePixmapData::blittable(void) const + ?resizeCache@QTextureGlyphCache@@QAEXHH@Z @ 13348 NONAME ; void QTextureGlyphCache::resizeCache(int, int) + ??0QScrollerProperties@@QAE@ABV0@@Z @ 13349 NONAME ; QScrollerProperties::QScrollerProperties(class QScrollerProperties const &) + ??0QWindowStateChangeEvent@@QAE@ABV0@@Z @ 13350 NONAME ; QWindowStateChangeEvent::QWindowStateChangeEvent(class QWindowStateChangeEvent const &) + ?metaObject@QInternalMimeData@@UBEPBUQMetaObject@@XZ @ 13351 NONAME ; struct QMetaObject const * QInternalMimeData::metaObject(void) const + ?setContentPos@QScrollPrepareEvent@@QAEXABVQPointF@@@Z @ 13352 NONAME ; void QScrollPrepareEvent::setContentPos(class QPointF const &) + ??_EQTextEngine@@QAE@I@Z @ 13353 NONAME ; QTextEngine::~QTextEngine(unsigned int) + ??4QStyleOptionTitleBar@@QAEAAV0@ABV0@@Z @ 13354 NONAME ; class QStyleOptionTitleBar & QStyleOptionTitleBar::operator=(class QStyleOptionTitleBar const &) + ??4Value@QCss@@QAEAAU01@ABU01@@Z @ 13355 NONAME ; struct QCss::Value & QCss::Value::operator=(struct QCss::Value const &) + ?staticMetaObject@QScroller@@2UQMetaObject@@B @ 13356 NONAME ; struct QMetaObject const QScroller::staticMetaObject + ?hasFormatHelper@QInternalMimeData@@SA_NABVQString@@PBVQMimeData@@@Z @ 13357 NONAME ; bool QInternalMimeData::hasFormatHelper(class QString const &, class QMimeData const *) + ?state@QBlitterPaintEngine@@QAEPAVQPainterState@@XZ @ 13358 NONAME ; class QPainterState * QBlitterPaintEngine::state(void) + ?penChanged@QBlitterPaintEngine@@UAEXXZ @ 13359 NONAME ; void QBlitterPaintEngine::penChanged(void) + ??0QFileOpenEvent@@QAE@ABVRFile@@@Z @ 13360 NONAME ; QFileOpenEvent::QFileOpenEvent(class RFile const &) + ?hasHeightForWidth@QWidgetPrivate@@UBE_NXZ @ 13361 NONAME ; bool QWidgetPrivate::hasHeightForWidth(void) const + ??0QDragLeaveEvent@@QAE@ABV0@@Z @ 13362 NONAME ; QDragLeaveEvent::QDragLeaveEvent(class QDragLeaveEvent const &) + ?toImage@QBlittablePixmapData@@UBE?AVQImage@@XZ @ 13363 NONAME ; class QImage QBlittablePixmapData::toImage(void) const + ??_EQBlittable@@UAE@I@Z @ 13364 NONAME ; QBlittable::~QBlittable(unsigned int) + ??4QBitmap@@QAEAAV0@ABV0@@Z @ 13365 NONAME ; class QBitmap & QBitmap::operator=(class QBitmap const &) + ??1QInternalMimeData@@UAE@XZ @ 13366 NONAME ; QInternalMimeData::~QInternalMimeData(void) + ??0QItemSelection@@QAE@ABV0@@Z @ 13367 NONAME ; QItemSelection::QItemSelection(class QItemSelection const &) + ?qt_addBitmapToPath@@YAXMMPBEHHHPAVQPainterPath@@@Z @ 13368 NONAME ; void qt_addBitmapToPath(float, float, unsigned char const *, int, int, int, class QPainterPath *) + ?staticMetaObject@QInternalMimeData@@2UQMetaObject@@B @ 13369 NONAME ; struct QMetaObject const QInternalMimeData::staticMetaObject + ?activeScrollers@QScroller@@SA?AV?$QList@PAVQScroller@@@@XZ @ 13370 NONAME ; class QList<class QScroller *> QScroller::activeScrollers(void) + ?drawGlyphs@QPainter@@QAEXABVQPointF@@ABVQGlyphs@@@Z @ 13371 NONAME ; void QPainter::drawGlyphs(class QPointF const &, class QGlyphs const &) + ??4QTextFrameFormat@@QAEAAV0@ABV0@@Z @ 13372 NONAME ; class QTextFrameFormat & QTextFrameFormat::operator=(class QTextFrameFormat const &) diff --git a/src/s60installs/eabi/QtGuiu.def b/src/s60installs/eabi/QtGuiu.def index 8f4b7cc..fc256e4 100644 --- a/src/s60installs/eabi/QtGuiu.def +++ b/src/s60installs/eabi/QtGuiu.def @@ -3164,6 +3164,7 @@ EXPORTS _ZN14QWindowSurface10beginPaintERK7QRegion @ 3163 NONAME _ZN14QWindowSurface11setGeometryERK5QRect @ 3164 NONAME _ZN14QWindowSurface17setStaticContentsERK7QRegion @ 3165 NONAME + _ZN14QWindowSurface24setStaticContentsSupportEb @ 3166 NONAME ABSENT _ZN14QWindowSurface6bufferEPK7QWidget @ 3167 NONAME _ZN14QWindowSurface6scrollERK7QRegionii @ 3168 NONAME _ZN14QWindowSurface8endPaintERK7QRegion @ 3169 NONAME @@ -11886,6 +11887,7 @@ EXPORTS _ZN14QGraphicsScale13zScaleChangedEv @ 11886 NONAME _ZN14QPaintEngineEx19drawPixmapFragmentsEPKN8QPainter14PixmapFragmentEiRK7QPixmap6QFlagsINS0_18PixmapFragmentHintEE @ 11887 NONAME _ZN14QWidgetPrivate6renderEP12QPaintDeviceRK6QPointRK7QRegion6QFlagsIN7QWidget10RenderFlagEEb @ 11888 NONAME + _ZN14QWindowSurface23setPartialUpdateSupportEb @ 11889 NONAME ABSENT _ZN15QGraphicsObject12widthChangedEv @ 11890 NONAME _ZN15QGraphicsObject13heightChangedEv @ 11891 NONAME _ZN15QGraphicsObject15childrenChangedEv @ 11892 NONAME @@ -12103,291 +12105,332 @@ EXPORTS _ZN15QStaticTextItemD1Ev @ 12104 NONAME _ZN15QStaticTextItemD2Ev @ 12105 NONAME _ZN19QEventDispatcherS6031reactivateDeferredActiveObjectsEv @ 12106 NONAME - _Z18qt_addBitmapToPathffPKhiiiP12QPainterPath @ 12107 NONAME - _Z22qt_fontdata_from_indexi @ 12108 NONAME - _ZN10QBlittable4lockEv @ 12109 NONAME - _ZN10QBlittable6unlockEv @ 12110 NONAME - _ZN10QBlittableC2ERK5QSize6QFlagsINS_10CapabilityEE @ 12111 NONAME - _ZN10QBlittableD0Ev @ 12112 NONAME - _ZN10QBlittableD1Ev @ 12113 NONAME - _ZN10QBlittableD2Ev @ 12114 NONAME - _ZN11QFontEngine19alphaRGBMapForGlyphEj6QFixediRK10QTransform @ 12115 NONAME - _ZN12QInputDialog7getItemEP7QWidgetRK7QStringS4_RK11QStringListibPb6QFlagsIN2Qt10WindowTypeEES9_INSA_15InputMethodHintEE @ 12116 NONAME - _ZN12QInputDialog7getTextEP7QWidgetRK7QStringS4_N9QLineEdit8EchoModeES4_Pb6QFlagsIN2Qt10WindowTypeEES8_INS9_15InputMethodHintEE @ 12117 NONAME - _ZN14QWindowSurfaceC2EP7QWidgetb @ 12118 NONAME - _ZN18QTextureGlyphCache19fillInPendingGlyphsEv @ 12119 NONAME - _ZN19QAbstractProxyModel11setItemDataERK11QModelIndexRK4QMapIi8QVariantE @ 12120 NONAME - _ZN19QAbstractProxyModel17resetInternalDataEv @ 12121 NONAME - _ZN19QAbstractProxyModel4sortEiN2Qt9SortOrderE @ 12122 NONAME - _ZN19QAbstractProxyModel9fetchMoreERK11QModelIndex @ 12123 NONAME - _ZN19QApplicationPrivateC1ERiPPcN12QApplication4TypeEi @ 12124 NONAME - _ZN19QApplicationPrivateC2ERiPPcN12QApplication4TypeEi @ 12125 NONAME - _ZN19QBlitterPaintEngine10drawPixmapERK6QRectFRK7QPixmapS2_ @ 12126 NONAME - _ZN19QBlitterPaintEngine10penChangedEv @ 12127 NONAME - _ZN19QBlitterPaintEngine11drawEllipseERK6QRectF @ 12128 NONAME - _ZN19QBlitterPaintEngine12brushChangedEv @ 12129 NONAME - _ZN19QBlitterPaintEngine12drawTextItemERK7QPointFRK9QTextItem @ 12130 NONAME - _ZN19QBlitterPaintEngine14opacityChangedEv @ 12131 NONAME - _ZN19QBlitterPaintEngine16transformChangedEv @ 12132 NONAME - _ZN19QBlitterPaintEngine18brushOriginChangedEv @ 12133 NONAME - _ZN19QBlitterPaintEngine18clipEnabledChangedEv @ 12134 NONAME - _ZN19QBlitterPaintEngine18drawStaticTextItemEP15QStaticTextItem @ 12135 NONAME - _ZN19QBlitterPaintEngine18renderHintsChangedEv @ 12136 NONAME - _ZN19QBlitterPaintEngine22compositionModeChangedEv @ 12137 NONAME - _ZN19QBlitterPaintEngine3endEv @ 12138 NONAME - _ZN19QBlitterPaintEngine4clipERK11QVectorPathN2Qt13ClipOperationE @ 12139 NONAME - _ZN19QBlitterPaintEngine4clipERK5QRectN2Qt13ClipOperationE @ 12140 NONAME - _ZN19QBlitterPaintEngine4clipERK7QRegionN2Qt13ClipOperationE @ 12141 NONAME - _ZN19QBlitterPaintEngine4fillERK11QVectorPathRK6QBrush @ 12142 NONAME - _ZN19QBlitterPaintEngine5beginEP12QPaintDevice @ 12143 NONAME - _ZN19QBlitterPaintEngine6strokeERK11QVectorPathRK4QPen @ 12144 NONAME - _ZN19QBlitterPaintEngine8fillRectERK6QRectFRK6QBrush @ 12145 NONAME - _ZN19QBlitterPaintEngine8fillRectERK6QRectFRK6QColor @ 12146 NONAME - _ZN19QBlitterPaintEngine8setStateEP13QPainterState @ 12147 NONAME - _ZN19QBlitterPaintEngine9drawImageERK6QRectFRK6QImageS2_6QFlagsIN2Qt19ImageConversionFlagEE @ 12148 NONAME - _ZN19QBlitterPaintEngine9drawRectsEPK5QRecti @ 12149 NONAME - _ZN19QBlitterPaintEngine9drawRectsEPK6QRectFi @ 12150 NONAME - _ZN19QBlitterPaintEngineC1EP20QBlittablePixmapData @ 12151 NONAME - _ZN19QBlitterPaintEngineC2EP20QBlittablePixmapData @ 12152 NONAME - _ZN19QBlitterPaintEngineD0Ev @ 12153 NONAME - _ZN19QBlitterPaintEngineD1Ev @ 12154 NONAME - _ZN19QBlitterPaintEngineD2Ev @ 12155 NONAME - _ZN19QGraphicsGridLayout10removeItemEP19QGraphicsLayoutItem @ 12156 NONAME - _ZN20QBlittablePixmapData12setBlittableEP10QBlittable @ 12157 NONAME - _ZN20QBlittablePixmapData4fillERK6QColor @ 12158 NONAME - _ZN20QBlittablePixmapData6bufferEv @ 12159 NONAME - _ZN20QBlittablePixmapData6resizeEii @ 12160 NONAME - _ZN20QBlittablePixmapData9fromImageERK6QImage6QFlagsIN2Qt19ImageConversionFlagEE @ 12161 NONAME - _ZN20QBlittablePixmapDataC2Ev @ 12162 NONAME - _ZN20QBlittablePixmapDataD0Ev @ 12163 NONAME - _ZN20QBlittablePixmapDataD1Ev @ 12164 NONAME - _ZN20QBlittablePixmapDataD2Ev @ 12165 NONAME - _ZN20QRasterWindowSurfaceC1EP7QWidgetb @ 12166 NONAME - _ZN20QRasterWindowSurfaceC2EP7QWidgetb @ 12167 NONAME - _ZN23QImageTextureGlyphCache11fillTextureERKN18QTextureGlyphCache5CoordEj6QFixed @ 12168 NONAME - _ZN6QImage4fillEN2Qt11GlobalColorE @ 12169 NONAME - _ZN6QImage4fillERK6QColor @ 12170 NONAME - _ZN7QGlyphs12setPositionsERK7QVectorI7QPointFE @ 12171 NONAME - _ZN7QGlyphs15setGlyphIndexesERK7QVectorIjE @ 12172 NONAME - _ZN7QGlyphs5clearEv @ 12173 NONAME - _ZN7QGlyphs6detachEv @ 12174 NONAME - _ZN7QGlyphs7setFontERK5QFont @ 12175 NONAME - _ZN7QGlyphsC1ERKS_ @ 12176 NONAME - _ZN7QGlyphsC1Ev @ 12177 NONAME - _ZN7QGlyphsC2ERKS_ @ 12178 NONAME - _ZN7QGlyphsC2Ev @ 12179 NONAME - _ZN7QGlyphsD1Ev @ 12180 NONAME - _ZN7QGlyphsD2Ev @ 12181 NONAME - _ZN7QGlyphsaSERKS_ @ 12182 NONAME - _ZN7QGlyphspLERKS_ @ 12183 NONAME - _ZN8QPainter10drawGlyphsERK7QPointFRK7QGlyphs @ 12184 NONAME - _ZNK10QBlittable12capabilitiesEv @ 12185 NONAME - _ZNK10QBlittable4sizeEv @ 12186 NONAME - _ZNK10QTabWidget14heightForWidthEi @ 12187 NONAME - _ZNK11QFontEngine18createExplicitFontEv @ 12188 NONAME - _ZNK11QFontEngine26createExplicitFontWithNameERK7QString @ 12189 NONAME - _ZNK11QTextLayout6glyphsEv @ 12190 NONAME - _ZNK12QFontMetrics10inFontUcs4Ej @ 12191 NONAME - _ZNK12QRadioButton15minimumSizeHintEv @ 12192 NONAME - _ZNK13QFontMetricsF10inFontUcs4Ej @ 12193 NONAME - _ZNK13QTextFragment6glyphsEv @ 12194 NONAME - _ZNK14QWidgetPrivate17hasHeightForWidthEv @ 12195 NONAME - _ZNK16QFileSystemModel5rmdirERK11QModelIndex @ 12196 NONAME - _ZNK18QTextureGlyphCache18textureMapForGlyphEj6QFixed @ 12197 NONAME - _ZNK18QTextureGlyphCache20subPixelPositionForXE6QFixed @ 12198 NONAME - _ZNK18QTextureGlyphCache30calculateSubPixelPositionCountEj @ 12199 NONAME - _ZNK19QAbstractProxyModel11hasChildrenERK11QModelIndex @ 12200 NONAME - _ZNK19QAbstractProxyModel12canFetchMoreERK11QModelIndex @ 12201 NONAME - _ZNK19QAbstractProxyModel20supportedDropActionsEv @ 12202 NONAME - _ZNK19QAbstractProxyModel4spanERK11QModelIndex @ 12203 NONAME - _ZNK19QAbstractProxyModel5buddyERK11QModelIndex @ 12204 NONAME - _ZNK19QAbstractProxyModel8mimeDataERK5QListI11QModelIndexE @ 12205 NONAME - _ZNK19QAbstractProxyModel9mimeTypesEv @ 12206 NONAME - _ZNK19QBlitterPaintEngine11createStateEP13QPainterState @ 12207 NONAME - _ZNK20QBlittablePixmapData11paintEngineEv @ 12208 NONAME - _ZNK20QBlittablePixmapData15hasAlphaChannelEv @ 12209 NONAME - _ZNK20QBlittablePixmapData6metricEN12QPaintDevice17PaintDeviceMetricE @ 12210 NONAME - _ZNK20QBlittablePixmapData7toImageEv @ 12211 NONAME - _ZNK20QBlittablePixmapData9blittableEv @ 12212 NONAME - _ZNK7QGlyphs12glyphIndexesEv @ 12213 NONAME - _ZNK7QGlyphs4fontEv @ 12214 NONAME - _ZNK7QGlyphs9positionsEv @ 12215 NONAME - _ZNK7QGlyphseqERKS_ @ 12216 NONAME - _ZNK7QGlyphsneERKS_ @ 12217 NONAME - _ZNK7QGlyphsplERKS_ @ 12218 NONAME - _ZNK8QPainter16clipBoundingRectEv @ 12219 NONAME - _ZNK9QCheckBox15minimumSizeHintEv @ 12220 NONAME - _ZNK9QTextLine6glyphsEii @ 12221 NONAME - _ZTI10QBlittable @ 12222 NONAME - _ZTI19QBlitterPaintEngine @ 12223 NONAME - _ZTI20QBlittablePixmapData @ 12224 NONAME - _ZTV10QBlittable @ 12225 NONAME - _ZTV19QBlitterPaintEngine @ 12226 NONAME - _ZTV20QBlittablePixmapData @ 12227 NONAME - _Zls6QDebugPK13QSymbianEvent @ 12228 NONAME - _ZN13QS60MainAppUi25ProcessCommandParametersLE11TApaCommandR4TBufILi256EERK6TDesC8 @ 12229 NONAME - _ZN14QFileOpenEventC1ERK5RFile @ 12230 NONAME - _ZN14QFileOpenEventC2ERK5RFile @ 12231 NONAME - _ZNK14QFileOpenEvent8openFileER5QFile6QFlagsIN9QIODevice12OpenModeFlagEE @ 12232 NONAME - _ZN11QFontEngine16alphaMapForGlyphEj6QFixed @ 12233 NONAME - _ZN11QFontEngine16alphaMapForGlyphEj6QFixedRK10QTransform @ 12234 NONAME - _Z32qGamma_correct_back_to_linear_csP6QImage @ 12235 NONAME - _ZN12QLineControl21resetCursorBlinkTimerEv @ 12236 NONAME - _ZN12QScrollEvent6d_funcEv @ 12237 NONAME - _ZN12QScrollEventC1ERK7QPointFS2_NS_11ScrollStateE @ 12238 NONAME - _ZN12QScrollEventC2ERK7QPointFS2_NS_11ScrollStateE @ 12239 NONAME - _ZN12QScrollEventD0Ev @ 12240 NONAME - _ZN12QScrollEventD1Ev @ 12241 NONAME - _ZN12QScrollEventD2Ev @ 12242 NONAME - _ZN13QFlickGesture11qt_metacallEN11QMetaObject4CallEiPPv @ 12243 NONAME - _ZN13QFlickGesture11qt_metacastEPKc @ 12244 NONAME - _ZN13QFlickGesture16staticMetaObjectE @ 12245 NONAME DATA 16 - _ZN13QFlickGesture19getStaticMetaObjectEv @ 12246 NONAME - _ZN13QFlickGestureC1EP7QObjectN2Qt11MouseButtonES1_ @ 12247 NONAME - _ZN13QFlickGestureC2EP7QObjectN2Qt11MouseButtonES1_ @ 12248 NONAME - _ZN13QFlickGestureD0Ev @ 12249 NONAME - _ZN13QFlickGestureD1Ev @ 12250 NONAME - _ZN13QFlickGestureD2Ev @ 12251 NONAME - _ZN19QScrollPrepareEvent13setContentPosERK7QPointF @ 12252 NONAME - _ZN19QScrollPrepareEvent15setViewportSizeERK6QSizeF @ 12253 NONAME - _ZN19QScrollPrepareEvent18setContentPosRangeERK6QRectF @ 12254 NONAME - _ZN19QScrollPrepareEvent6d_funcEv @ 12255 NONAME - _ZN19QScrollPrepareEventC1ERK7QPointF @ 12256 NONAME - _ZN19QScrollPrepareEventC2ERK7QPointF @ 12257 NONAME - _ZN19QScrollPrepareEventD0Ev @ 12258 NONAME - _ZN19QScrollPrepareEventD1Ev @ 12259 NONAME - _ZN19QScrollPrepareEventD2Ev @ 12260 NONAME - _ZN19QScrollerProperties15setScrollMetricENS_12ScrollMetricERK8QVariant @ 12261 NONAME - _ZN19QScrollerProperties28setDefaultScrollerPropertiesERKS_ @ 12262 NONAME - _ZN19QScrollerProperties30unsetDefaultScrollerPropertiesEv @ 12263 NONAME - _ZN19QScrollerPropertiesC1ERKS_ @ 12264 NONAME - _ZN19QScrollerPropertiesC1Ev @ 12265 NONAME - _ZN19QScrollerPropertiesC2ERKS_ @ 12266 NONAME - _ZN19QScrollerPropertiesC2Ev @ 12267 NONAME - _ZN19QScrollerPropertiesD0Ev @ 12268 NONAME - _ZN19QScrollerPropertiesD1Ev @ 12269 NONAME - _ZN19QScrollerPropertiesD2Ev @ 12270 NONAME - _ZN19QScrollerPropertiesaSERKS_ @ 12271 NONAME - _ZN20QGraphicsItemPrivate11setSubFocusEP13QGraphicsItemS1_ @ 12272 NONAME - _ZN20QGraphicsItemPrivate13clearSubFocusEP13QGraphicsItemS1_ @ 12273 NONAME - _ZN26QAbstractScrollAreaPrivate19canStartScrollingAtERK6QPoint @ 12274 NONAME - _ZN9QScroller11grabGestureEP7QObjectNS_19ScrollerGestureTypeE @ 12275 NONAME - _ZN9QScroller11handleInputENS_5InputERK7QPointFx @ 12276 NONAME - _ZN9QScroller11hasScrollerEP7QObject @ 12277 NONAME - _ZN9QScroller11qt_metacallEN11QMetaObject4CallEiPPv @ 12278 NONAME - _ZN9QScroller11qt_metacastEPKc @ 12279 NONAME - _ZN9QScroller12stateChangedENS_5StateE @ 12280 NONAME - _ZN9QScroller13ensureVisibleERK6QRectFff @ 12281 NONAME - _ZN9QScroller13ensureVisibleERK6QRectFffi @ 12282 NONAME - _ZN9QScroller13ungrabGestureEP7QObject @ 12283 NONAME - _ZN9QScroller14grabbedGestureEP7QObject @ 12284 NONAME - _ZN9QScroller15activeScrollersEv @ 12285 NONAME - _ZN9QScroller16staticMetaObjectE @ 12286 NONAME DATA 16 - _ZN9QScroller17setSnapPositionsXERK5QListIfE @ 12287 NONAME - _ZN9QScroller17setSnapPositionsXEff @ 12288 NONAME - _ZN9QScroller17setSnapPositionsYERK5QListIfE @ 12289 NONAME - _ZN9QScroller17setSnapPositionsYEff @ 12290 NONAME - _ZN9QScroller18resendPrepareEventEv @ 12291 NONAME - _ZN9QScroller19getStaticMetaObjectEv @ 12292 NONAME - _ZN9QScroller21setScrollerPropertiesERK19QScrollerProperties @ 12293 NONAME - _ZN9QScroller25scrollerPropertiesChangedERK19QScrollerProperties @ 12294 NONAME - _ZN9QScroller4stopEv @ 12295 NONAME - _ZN9QScroller8scrollToERK7QPointF @ 12296 NONAME - _ZN9QScroller8scrollToERK7QPointFi @ 12297 NONAME - _ZN9QScroller8scrollerEP7QObject @ 12298 NONAME - _ZN9QScroller8scrollerEPK7QObject @ 12299 NONAME - _ZN9QScrollerC1EP7QObject @ 12300 NONAME - _ZN9QScrollerC2EP7QObject @ 12301 NONAME - _ZN9QScrollerD0Ev @ 12302 NONAME - _ZN9QScrollerD1Ev @ 12303 NONAME - _ZN9QScrollerD2Ev @ 12304 NONAME - _ZNK12QScrollEvent10contentPosEv @ 12305 NONAME - _ZNK12QScrollEvent11scrollStateEv @ 12306 NONAME - _ZNK12QScrollEvent17overshootDistanceEv @ 12307 NONAME - _ZNK12QScrollEvent6d_funcEv @ 12308 NONAME - _ZNK13QFlickGesture10metaObjectEv @ 12309 NONAME - _ZNK19QScrollPrepareEvent10contentPosEv @ 12310 NONAME - _ZNK19QScrollPrepareEvent12viewportSizeEv @ 12311 NONAME - _ZNK19QScrollPrepareEvent15contentPosRangeEv @ 12312 NONAME - _ZNK19QScrollPrepareEvent6d_funcEv @ 12313 NONAME - _ZNK19QScrollPrepareEvent8startPosEv @ 12314 NONAME - _ZNK19QScrollerProperties12scrollMetricENS_12ScrollMetricE @ 12315 NONAME - _ZNK19QScrollerPropertieseqERKS_ @ 12316 NONAME - _ZNK19QScrollerPropertiesneERKS_ @ 12317 NONAME - _ZNK9QScroller10metaObjectEv @ 12318 NONAME - _ZNK9QScroller13finalPositionEv @ 12319 NONAME - _ZNK9QScroller13pixelPerMeterEv @ 12320 NONAME - _ZNK9QScroller18scrollerPropertiesEv @ 12321 NONAME - _ZNK9QScroller5stateEv @ 12322 NONAME - _ZNK9QScroller6targetEv @ 12323 NONAME - _ZNK9QScroller8velocityEv @ 12324 NONAME - _ZTI12QScrollEvent @ 12325 NONAME - _ZTI13QFlickGesture @ 12326 NONAME - _ZTI19QScrollPrepareEvent @ 12327 NONAME - _ZTI19QScrollerProperties @ 12328 NONAME - _ZTI9QScroller @ 12329 NONAME - _ZTV12QScrollEvent @ 12330 NONAME - _ZTV13QFlickGesture @ 12331 NONAME - _ZTV19QScrollPrepareEvent @ 12332 NONAME - _ZTV19QScrollerProperties @ 12333 NONAME - _ZTV9QScroller @ 12334 NONAME - _ZN12QTextControl14setDragEnabledEb @ 12335 NONAME - _ZN12QTextControl23setWordSelectionEnabledEb @ 12336 NONAME - _ZNK12QTextControl13isDragEnabledEv @ 12337 NONAME - _ZNK12QTextControl22isWordSelectionEnabledEv @ 12338 NONAME - _ZN12QLineControl16updateMicroFocusEv @ 12339 NONAME - _ZN13QFontDatabase22resolveFontFamilyAliasERK7QString @ 12340 NONAME - _ZN14QVolatileImage11paintEngineEv @ 12341 NONAME - _ZN14QVolatileImage12ensureFormatEN6QImage6FormatE @ 12342 NONAME - _ZN14QVolatileImage15setAlphaChannelERK7QPixmap @ 12343 NONAME - _ZN14QVolatileImage4bitsEv @ 12344 NONAME - _ZN14QVolatileImage4fillEj @ 12345 NONAME - _ZN14QVolatileImage8copyFromEPS_RK5QRect @ 12346 NONAME - _ZN14QVolatileImage8imageRefEv @ 12347 NONAME - _ZN14QVolatileImageC1EPvS0_ @ 12348 NONAME - _ZN14QVolatileImageC1ERK6QImage @ 12349 NONAME - _ZN14QVolatileImageC1ERKS_ @ 12350 NONAME - _ZN14QVolatileImageC1EiiN6QImage6FormatE @ 12351 NONAME - _ZN14QVolatileImageC1Ev @ 12352 NONAME - _ZN14QVolatileImageC2EPvS0_ @ 12353 NONAME - _ZN14QVolatileImageC2ERK6QImage @ 12354 NONAME - _ZN14QVolatileImageC2ERKS_ @ 12355 NONAME - _ZN14QVolatileImageC2EiiN6QImage6FormatE @ 12356 NONAME - _ZN14QVolatileImageC2Ev @ 12357 NONAME - _ZN14QVolatileImageD1Ev @ 12358 NONAME - _ZN14QVolatileImageD2Ev @ 12359 NONAME - _ZN14QVolatileImageaSERKS_ @ 12360 NONAME - _ZN15QGraphicsSystem22releaseCachedResourcesEv @ 12361 NONAME - _ZN17QInternalMimeData11canReadDataERK7QString @ 12362 NONAME - _ZN17QInternalMimeData11qt_metacallEN11QMetaObject4CallEiPPv @ 12363 NONAME - _ZN17QInternalMimeData11qt_metacastEPKc @ 12364 NONAME - _ZN17QInternalMimeData13formatsHelperEPK9QMimeData @ 12365 NONAME - _ZN17QInternalMimeData15hasFormatHelperERK7QStringPK9QMimeData @ 12366 NONAME - _ZN17QInternalMimeData16renderDataHelperERK7QStringPK9QMimeData @ 12367 NONAME - _ZN17QInternalMimeData16staticMetaObjectE @ 12368 NONAME DATA 16 - _ZN17QInternalMimeData19getStaticMetaObjectEv @ 12369 NONAME - _ZN17QInternalMimeDataC2Ev @ 12370 NONAME - _ZN17QInternalMimeDataD0Ev @ 12371 NONAME - _ZN17QInternalMimeDataD1Ev @ 12372 NONAME - _ZN17QInternalMimeDataD2Ev @ 12373 NONAME - _ZNK14QVolatileImage12bytesPerLineEv @ 12374 NONAME - _ZNK14QVolatileImage13endDataAccessEb @ 12375 NONAME - _ZNK14QVolatileImage15beginDataAccessEv @ 12376 NONAME - _ZNK14QVolatileImage15hasAlphaChannelEv @ 12377 NONAME - _ZNK14QVolatileImage20duplicateNativeImageEv @ 12378 NONAME - _ZNK14QVolatileImage5depthEv @ 12379 NONAME - _ZNK14QVolatileImage5widthEv @ 12380 NONAME - _ZNK14QVolatileImage6formatEv @ 12381 NONAME - _ZNK14QVolatileImage6heightEv @ 12382 NONAME - _ZNK14QVolatileImage6isNullEv @ 12383 NONAME - _ZNK14QVolatileImage7toImageEv @ 12384 NONAME - _ZNK14QVolatileImage9byteCountEv @ 12385 NONAME - _ZNK14QVolatileImage9constBitsEv @ 12386 NONAME - _ZNK14QWidgetPrivate20assignedInputContextEv @ 12387 NONAME - _ZNK17QInternalMimeData10metaObjectEv @ 12388 NONAME - _ZNK17QInternalMimeData12retrieveDataERK7QStringN8QVariant4TypeE @ 12389 NONAME - _ZNK17QInternalMimeData7formatsEv @ 12390 NONAME - _ZNK17QInternalMimeData9hasFormatERK7QString @ 12391 NONAME - _ZTI17QInternalMimeData @ 12392 NONAME - _ZTV17QInternalMimeData @ 12393 NONAME + _ZN20QGraphicsItemPrivate11setSubFocusEP13QGraphicsItemS1_ @ 12107 NONAME + _ZN20QGraphicsItemPrivate13clearSubFocusEP13QGraphicsItemS1_ @ 12108 NONAME + _ZN12QLineControl21resetCursorBlinkTimerEv @ 12109 NONAME + _ZN12QTextControl14setDragEnabledEb @ 12110 NONAME + _ZN19QTextDocumentLayout10timerEventEP11QTimerEvent @ 12111 NONAME ABSENT + _ZN19QTextDocumentLayout11qt_metacallEN11QMetaObject4CallEiPPv @ 12112 NONAME ABSENT + _ZN19QTextDocumentLayout11qt_metacastEPKc @ 12113 NONAME ABSENT + _ZN19QTextDocumentLayout11setViewportERK6QRectF @ 12114 NONAME ABSENT + _ZN19QTextDocumentLayout13setLineHeightEfNS_14LineHeightModeE @ 12115 NONAME ABSENT + _ZN19QTextDocumentLayout14ensureLayoutedEf @ 12116 NONAME ABSENT + _ZN19QTextDocumentLayout14layoutFinishedEv @ 12117 NONAME ABSENT + _ZN19QTextDocumentLayout14setCursorWidthEi @ 12118 NONAME ABSENT + _ZN19QTextDocumentLayout15documentChangedEiii @ 12119 NONAME ABSENT + _ZN19QTextDocumentLayout16drawInlineObjectEP8QPainterRK6QRectF17QTextInlineObjectiRK11QTextFormat @ 12120 NONAME ABSENT + _ZN19QTextDocumentLayout16staticMetaObjectE @ 12121 NONAME DATA 16 ABSENT + _ZN19QTextDocumentLayout18resizeInlineObjectE17QTextInlineObjectiRK11QTextFormat @ 12122 NONAME ABSENT + _ZN19QTextDocumentLayout19getStaticMetaObjectEv @ 12123 NONAME ABSENT + _ZN19QTextDocumentLayout19setFixedColumnWidthEi @ 12124 NONAME ABSENT + _ZN19QTextDocumentLayout20positionInlineObjectE17QTextInlineObjectiRK11QTextFormat @ 12125 NONAME ABSENT + _ZN19QTextDocumentLayout4drawEP8QPainterRKN27QAbstractTextDocumentLayout12PaintContextE @ 12126 NONAME ABSENT + _ZN19QTextDocumentLayout8doLayoutEiii @ 12127 NONAME ABSENT + _ZN19QTextDocumentLayoutC1EP13QTextDocument @ 12128 NONAME ABSENT + _ZN19QTextDocumentLayoutC2EP13QTextDocument @ 12129 NONAME ABSENT + _ZNK12QTextControl13isDragEnabledEv @ 12130 NONAME + _ZNK19QTextDocumentLayout10idealWidthEv @ 12131 NONAME ABSENT + _ZNK19QTextDocumentLayout10metaObjectEv @ 12132 NONAME ABSENT + _ZNK19QTextDocumentLayout11cursorWidthEv @ 12133 NONAME ABSENT + _ZNK19QTextDocumentLayout12documentSizeEv @ 12134 NONAME ABSENT + _ZNK19QTextDocumentLayout12layoutStatusEv @ 12135 NONAME ABSENT + _ZNK19QTextDocumentLayout16dynamicPageCountEv @ 12136 NONAME ABSENT + _ZNK19QTextDocumentLayout17blockBoundingRectERK10QTextBlock @ 12137 NONAME ABSENT + _ZNK19QTextDocumentLayout17frameBoundingRectEP10QTextFrame @ 12138 NONAME ABSENT + _ZNK19QTextDocumentLayout19contentHasAlignmentEv @ 12139 NONAME ABSENT + _ZNK19QTextDocumentLayout19dynamicDocumentSizeEv @ 12140 NONAME ABSENT + _ZNK19QTextDocumentLayout7hitTestERK7QPointFN2Qt15HitTestAccuracyE @ 12141 NONAME ABSENT + _ZNK19QTextDocumentLayout9pageCountEv @ 12142 NONAME ABSENT + _ZTI19QTextDocumentLayout @ 12143 NONAME ABSENT + _ZTV19QTextDocumentLayout @ 12144 NONAME ABSENT + _ZN12QTextControl23setWordSelectionEnabledEb @ 12145 NONAME + _ZNK12QTextControl22isWordSelectionEnabledEv @ 12146 NONAME + _ZN12QLineControl16updateMicroFocusEv @ 12147 NONAME + _ZNK14QWidgetPrivate20assignedInputContextEv @ 12148 NONAME + _ZN14QVolatileImage11paintEngineEv @ 12149 NONAME + _ZN14QVolatileImage12ensureFormatEN6QImage6FormatE @ 12150 NONAME + _ZN14QVolatileImage15setAlphaChannelERK7QPixmap @ 12151 NONAME + _ZN14QVolatileImage4bitsEv @ 12152 NONAME + _ZN14QVolatileImage4fillEj @ 12153 NONAME + _ZN14QVolatileImage8copyFromEPS_RK5QRect @ 12154 NONAME + _ZN14QVolatileImage8imageRefEv @ 12155 NONAME + _ZN14QVolatileImageC1EPvS0_ @ 12156 NONAME + _ZN14QVolatileImageC1ERK6QImage @ 12157 NONAME + _ZN14QVolatileImageC1ERKS_ @ 12158 NONAME + _ZN14QVolatileImageC1EiiN6QImage6FormatE @ 12159 NONAME + _ZN14QVolatileImageC1Ev @ 12160 NONAME + _ZN14QVolatileImageC2EPvS0_ @ 12161 NONAME + _ZN14QVolatileImageC2ERK6QImage @ 12162 NONAME + _ZN14QVolatileImageC2ERKS_ @ 12163 NONAME + _ZN14QVolatileImageC2EiiN6QImage6FormatE @ 12164 NONAME + _ZN14QVolatileImageC2Ev @ 12165 NONAME + _ZN14QVolatileImageD1Ev @ 12166 NONAME + _ZN14QVolatileImageD2Ev @ 12167 NONAME + _ZN14QVolatileImageaSERKS_ @ 12168 NONAME + _ZNK14QVolatileImage12bytesPerLineEv @ 12169 NONAME + _ZNK14QVolatileImage13endDataAccessEb @ 12170 NONAME + _ZNK14QVolatileImage15beginDataAccessEv @ 12171 NONAME + _ZNK14QVolatileImage15hasAlphaChannelEv @ 12172 NONAME + _ZNK14QVolatileImage20duplicateNativeImageEv @ 12173 NONAME + _ZNK14QVolatileImage5depthEv @ 12174 NONAME + _ZNK14QVolatileImage5widthEv @ 12175 NONAME + _ZNK14QVolatileImage6formatEv @ 12176 NONAME + _ZNK14QVolatileImage6heightEv @ 12177 NONAME + _ZNK14QVolatileImage6isNullEv @ 12178 NONAME + _ZNK14QVolatileImage7toImageEv @ 12179 NONAME + _ZNK14QVolatileImage9byteCountEv @ 12180 NONAME + _ZNK14QVolatileImage9constBitsEv @ 12181 NONAME + _ZN15QGraphicsSystem22releaseCachedResourcesEv @ 12182 NONAME + _Z32qt_s60_setPartialScreenInputModeb @ 12183 NONAME + _Z18qt_addBitmapToPathffPKhiiiP12QPainterPath @ 12184 NONAME + _Z22qt_fontdata_from_indexi @ 12185 NONAME + _Z32qGamma_correct_back_to_linear_csP6QImage @ 12186 NONAME + _ZN10QBlittable4lockEv @ 12187 NONAME + _ZN10QBlittable6unlockEv @ 12188 NONAME + _ZN10QBlittableC2ERK5QSize6QFlagsINS_10CapabilityEE @ 12189 NONAME + _ZN10QBlittableD0Ev @ 12190 NONAME + _ZN10QBlittableD1Ev @ 12191 NONAME + _ZN10QBlittableD2Ev @ 12192 NONAME + _ZN11QFontEngine16alphaMapForGlyphEj6QFixed @ 12193 NONAME + _ZN11QFontEngine16alphaMapForGlyphEj6QFixedRK10QTransform @ 12194 NONAME + _ZN11QFontEngine19alphaRGBMapForGlyphEj6QFixediRK10QTransform @ 12195 NONAME + _ZN12QInputDialog7getItemEP7QWidgetRK7QStringS4_RK11QStringListibPb6QFlagsIN2Qt10WindowTypeEES9_INSA_15InputMethodHintEE @ 12196 NONAME + _ZN12QInputDialog7getTextEP7QWidgetRK7QStringS4_N9QLineEdit8EchoModeES4_Pb6QFlagsIN2Qt10WindowTypeEES8_INS9_15InputMethodHintEE @ 12197 NONAME + _ZN12QScrollEvent6d_funcEv @ 12198 NONAME + _ZN12QScrollEventC1ERK7QPointFS2_NS_11ScrollStateE @ 12199 NONAME + _ZN12QScrollEventC2ERK7QPointFS2_NS_11ScrollStateE @ 12200 NONAME + _ZN12QScrollEventD0Ev @ 12201 NONAME + _ZN12QScrollEventD1Ev @ 12202 NONAME + _ZN12QScrollEventD2Ev @ 12203 NONAME + _ZN13QFlickGesture11qt_metacallEN11QMetaObject4CallEiPPv @ 12204 NONAME + _ZN13QFlickGesture11qt_metacastEPKc @ 12205 NONAME + _ZN13QFlickGesture16staticMetaObjectE @ 12206 NONAME DATA 16 + _ZN13QFlickGesture19getStaticMetaObjectEv @ 12207 NONAME + _ZN13QFlickGestureC1EP7QObjectN2Qt11MouseButtonES1_ @ 12208 NONAME + _ZN13QFlickGestureC2EP7QObjectN2Qt11MouseButtonES1_ @ 12209 NONAME + _ZN13QFlickGestureD0Ev @ 12210 NONAME + _ZN13QFlickGestureD1Ev @ 12211 NONAME + _ZN13QFlickGestureD2Ev @ 12212 NONAME + _ZN13QFontDatabase22resolveFontFamilyAliasERK7QString @ 12213 NONAME + _ZN13QS60MainAppUi25ProcessCommandParametersLE11TApaCommandR4TBufILi256EERK6TDesC8 @ 12214 NONAME + _ZN14QFileOpenEventC1ERK5RFile @ 12215 NONAME + _ZN14QFileOpenEventC2ERK5RFile @ 12216 NONAME + _ZN14QWindowSurfaceC2EP7QWidgetb @ 12217 NONAME + _ZN17QInternalMimeData11canReadDataERK7QString @ 12218 NONAME + _ZN17QInternalMimeData11qt_metacallEN11QMetaObject4CallEiPPv @ 12219 NONAME + _ZN17QInternalMimeData11qt_metacastEPKc @ 12220 NONAME + _ZN17QInternalMimeData13formatsHelperEPK9QMimeData @ 12221 NONAME + _ZN17QInternalMimeData15hasFormatHelperERK7QStringPK9QMimeData @ 12222 NONAME + _ZN17QInternalMimeData16renderDataHelperERK7QStringPK9QMimeData @ 12223 NONAME + _ZN17QInternalMimeData16staticMetaObjectE @ 12224 NONAME DATA 16 + _ZN17QInternalMimeData19getStaticMetaObjectEv @ 12225 NONAME + _ZN17QInternalMimeDataC2Ev @ 12226 NONAME + _ZN17QInternalMimeDataD0Ev @ 12227 NONAME + _ZN17QInternalMimeDataD1Ev @ 12228 NONAME + _ZN17QInternalMimeDataD2Ev @ 12229 NONAME + _ZN18QTextureGlyphCache19fillInPendingGlyphsEv @ 12230 NONAME + _ZN19QAbstractProxyModel11setItemDataERK11QModelIndexRK4QMapIi8QVariantE @ 12231 NONAME + _ZN19QAbstractProxyModel17resetInternalDataEv @ 12232 NONAME + _ZN19QAbstractProxyModel4sortEiN2Qt9SortOrderE @ 12233 NONAME + _ZN19QAbstractProxyModel9fetchMoreERK11QModelIndex @ 12234 NONAME + _ZN19QApplicationPrivateC1ERiPPcN12QApplication4TypeEi @ 12235 NONAME + _ZN19QApplicationPrivateC2ERiPPcN12QApplication4TypeEi @ 12236 NONAME + _ZN19QBlitterPaintEngine10drawPixmapERK6QRectFRK7QPixmapS2_ @ 12237 NONAME + _ZN19QBlitterPaintEngine10penChangedEv @ 12238 NONAME + _ZN19QBlitterPaintEngine11drawEllipseERK6QRectF @ 12239 NONAME + _ZN19QBlitterPaintEngine12brushChangedEv @ 12240 NONAME + _ZN19QBlitterPaintEngine12drawTextItemERK7QPointFRK9QTextItem @ 12241 NONAME + _ZN19QBlitterPaintEngine14opacityChangedEv @ 12242 NONAME + _ZN19QBlitterPaintEngine16transformChangedEv @ 12243 NONAME + _ZN19QBlitterPaintEngine18brushOriginChangedEv @ 12244 NONAME + _ZN19QBlitterPaintEngine18clipEnabledChangedEv @ 12245 NONAME + _ZN19QBlitterPaintEngine18drawStaticTextItemEP15QStaticTextItem @ 12246 NONAME + _ZN19QBlitterPaintEngine18renderHintsChangedEv @ 12247 NONAME + _ZN19QBlitterPaintEngine22compositionModeChangedEv @ 12248 NONAME + _ZN19QBlitterPaintEngine3endEv @ 12249 NONAME + _ZN19QBlitterPaintEngine4clipERK11QVectorPathN2Qt13ClipOperationE @ 12250 NONAME + _ZN19QBlitterPaintEngine4clipERK5QRectN2Qt13ClipOperationE @ 12251 NONAME + _ZN19QBlitterPaintEngine4clipERK7QRegionN2Qt13ClipOperationE @ 12252 NONAME + _ZN19QBlitterPaintEngine4fillERK11QVectorPathRK6QBrush @ 12253 NONAME + _ZN19QBlitterPaintEngine5beginEP12QPaintDevice @ 12254 NONAME + _ZN19QBlitterPaintEngine6strokeERK11QVectorPathRK4QPen @ 12255 NONAME + _ZN19QBlitterPaintEngine8fillRectERK6QRectFRK6QBrush @ 12256 NONAME + _ZN19QBlitterPaintEngine8fillRectERK6QRectFRK6QColor @ 12257 NONAME + _ZN19QBlitterPaintEngine8setStateEP13QPainterState @ 12258 NONAME + _ZN19QBlitterPaintEngine9drawImageERK6QRectFRK6QImageS2_6QFlagsIN2Qt19ImageConversionFlagEE @ 12259 NONAME + _ZN19QBlitterPaintEngine9drawRectsEPK5QRecti @ 12260 NONAME + _ZN19QBlitterPaintEngine9drawRectsEPK6QRectFi @ 12261 NONAME + _ZN19QBlitterPaintEngineC1EP20QBlittablePixmapData @ 12262 NONAME + _ZN19QBlitterPaintEngineC2EP20QBlittablePixmapData @ 12263 NONAME + _ZN19QBlitterPaintEngineD0Ev @ 12264 NONAME + _ZN19QBlitterPaintEngineD1Ev @ 12265 NONAME + _ZN19QBlitterPaintEngineD2Ev @ 12266 NONAME + _ZN19QGraphicsGridLayout10removeItemEP19QGraphicsLayoutItem @ 12267 NONAME + _ZN19QScrollPrepareEvent13setContentPosERK7QPointF @ 12268 NONAME + _ZN19QScrollPrepareEvent15setViewportSizeERK6QSizeF @ 12269 NONAME + _ZN19QScrollPrepareEvent18setContentPosRangeERK6QRectF @ 12270 NONAME + _ZN19QScrollPrepareEvent6d_funcEv @ 12271 NONAME + _ZN19QScrollPrepareEventC1ERK7QPointF @ 12272 NONAME + _ZN19QScrollPrepareEventC2ERK7QPointF @ 12273 NONAME + _ZN19QScrollPrepareEventD0Ev @ 12274 NONAME + _ZN19QScrollPrepareEventD1Ev @ 12275 NONAME + _ZN19QScrollPrepareEventD2Ev @ 12276 NONAME + _ZN19QScrollerProperties15setScrollMetricENS_12ScrollMetricERK8QVariant @ 12277 NONAME + _ZN19QScrollerProperties28setDefaultScrollerPropertiesERKS_ @ 12278 NONAME + _ZN19QScrollerProperties30unsetDefaultScrollerPropertiesEv @ 12279 NONAME + _ZN19QScrollerPropertiesC1ERKS_ @ 12280 NONAME + _ZN19QScrollerPropertiesC1Ev @ 12281 NONAME + _ZN19QScrollerPropertiesC2ERKS_ @ 12282 NONAME + _ZN19QScrollerPropertiesC2Ev @ 12283 NONAME + _ZN19QScrollerPropertiesD0Ev @ 12284 NONAME + _ZN19QScrollerPropertiesD1Ev @ 12285 NONAME + _ZN19QScrollerPropertiesD2Ev @ 12286 NONAME + _ZN19QScrollerPropertiesaSERKS_ @ 12287 NONAME + _ZN20QBlittablePixmapData12setBlittableEP10QBlittable @ 12288 NONAME + _ZN20QBlittablePixmapData4fillERK6QColor @ 12289 NONAME + _ZN20QBlittablePixmapData6bufferEv @ 12290 NONAME + _ZN20QBlittablePixmapData6resizeEii @ 12291 NONAME + _ZN20QBlittablePixmapData9fromImageERK6QImage6QFlagsIN2Qt19ImageConversionFlagEE @ 12292 NONAME + _ZN20QBlittablePixmapDataC2Ev @ 12293 NONAME + _ZN20QBlittablePixmapDataD0Ev @ 12294 NONAME + _ZN20QBlittablePixmapDataD1Ev @ 12295 NONAME + _ZN20QBlittablePixmapDataD2Ev @ 12296 NONAME + _ZN20QRasterWindowSurfaceC1EP7QWidgetb @ 12297 NONAME + _ZN20QRasterWindowSurfaceC2EP7QWidgetb @ 12298 NONAME + _ZN23QImageTextureGlyphCache11fillTextureERKN18QTextureGlyphCache5CoordEj6QFixed @ 12299 NONAME + _ZN26QAbstractScrollAreaPrivate19canStartScrollingAtERK6QPoint @ 12300 NONAME + _ZN5QFont20setHintingPreferenceENS_17HintingPreferenceE @ 12301 NONAME + _ZN6QImage4fillEN2Qt11GlobalColorE @ 12302 NONAME + _ZN6QImage4fillERK6QColor @ 12303 NONAME + _ZN7QGlyphs12setPositionsERK7QVectorI7QPointFE @ 12304 NONAME + _ZN7QGlyphs15setGlyphIndexesERK7QVectorIjE @ 12305 NONAME + _ZN7QGlyphs5clearEv @ 12306 NONAME + _ZN7QGlyphs6detachEv @ 12307 NONAME + _ZN7QGlyphs7setFontERK5QFont @ 12308 NONAME + _ZN7QGlyphsC1ERKS_ @ 12309 NONAME + _ZN7QGlyphsC1Ev @ 12310 NONAME + _ZN7QGlyphsC2ERKS_ @ 12311 NONAME + _ZN7QGlyphsC2Ev @ 12312 NONAME + _ZN7QGlyphsD1Ev @ 12313 NONAME + _ZN7QGlyphsD2Ev @ 12314 NONAME + _ZN7QGlyphsaSERKS_ @ 12315 NONAME + _ZN7QGlyphspLERKS_ @ 12316 NONAME + _ZN8QMdiArea14setTabsMovableEb @ 12317 NONAME + _ZN8QMdiArea15setTabsClosableEb @ 12318 NONAME + _ZN8QPainter10drawGlyphsERK7QPointFRK7QGlyphs @ 12319 NONAME + _ZN9QScroller11grabGestureEP7QObjectNS_19ScrollerGestureTypeE @ 12320 NONAME + _ZN9QScroller11handleInputENS_5InputERK7QPointFx @ 12321 NONAME + _ZN9QScroller11hasScrollerEP7QObject @ 12322 NONAME + _ZN9QScroller11qt_metacallEN11QMetaObject4CallEiPPv @ 12323 NONAME + _ZN9QScroller11qt_metacastEPKc @ 12324 NONAME + _ZN9QScroller12stateChangedENS_5StateE @ 12325 NONAME + _ZN9QScroller13ensureVisibleERK6QRectFff @ 12326 NONAME + _ZN9QScroller13ensureVisibleERK6QRectFffi @ 12327 NONAME + _ZN9QScroller13ungrabGestureEP7QObject @ 12328 NONAME + _ZN9QScroller14grabbedGestureEP7QObject @ 12329 NONAME + _ZN9QScroller15activeScrollersEv @ 12330 NONAME + _ZN9QScroller16staticMetaObjectE @ 12331 NONAME DATA 16 + _ZN9QScroller17setSnapPositionsXERK5QListIfE @ 12332 NONAME + _ZN9QScroller17setSnapPositionsXEff @ 12333 NONAME + _ZN9QScroller17setSnapPositionsYERK5QListIfE @ 12334 NONAME + _ZN9QScroller17setSnapPositionsYEff @ 12335 NONAME + _ZN9QScroller18resendPrepareEventEv @ 12336 NONAME + _ZN9QScroller19getStaticMetaObjectEv @ 12337 NONAME + _ZN9QScroller21setScrollerPropertiesERK19QScrollerProperties @ 12338 NONAME + _ZN9QScroller25scrollerPropertiesChangedERK19QScrollerProperties @ 12339 NONAME + _ZN9QScroller4stopEv @ 12340 NONAME + _ZN9QScroller8scrollToERK7QPointF @ 12341 NONAME + _ZN9QScroller8scrollToERK7QPointFi @ 12342 NONAME + _ZN9QScroller8scrollerEP7QObject @ 12343 NONAME + _ZN9QScroller8scrollerEPK7QObject @ 12344 NONAME + _ZN9QScrollerC1EP7QObject @ 12345 NONAME + _ZN9QScrollerC2EP7QObject @ 12346 NONAME + _ZN9QScrollerD0Ev @ 12347 NONAME + _ZN9QScrollerD1Ev @ 12348 NONAME + _ZN9QScrollerD2Ev @ 12349 NONAME + _ZNK10QBlittable12capabilitiesEv @ 12350 NONAME + _ZNK10QBlittable4sizeEv @ 12351 NONAME + _ZNK10QTabWidget14heightForWidthEi @ 12352 NONAME + _ZNK11QFontEngine18createExplicitFontEv @ 12353 NONAME + _ZNK11QFontEngine26createExplicitFontWithNameERK7QString @ 12354 NONAME + _ZNK11QTextLayout6glyphsEv @ 12355 NONAME + _ZNK12QFontMetrics10inFontUcs4Ej @ 12356 NONAME + _ZNK12QRadioButton15minimumSizeHintEv @ 12357 NONAME + _ZNK12QScrollEvent10contentPosEv @ 12358 NONAME + _ZNK12QScrollEvent11scrollStateEv @ 12359 NONAME + _ZNK12QScrollEvent17overshootDistanceEv @ 12360 NONAME + _ZNK12QScrollEvent6d_funcEv @ 12361 NONAME + _ZNK13QFlickGesture10metaObjectEv @ 12362 NONAME + _ZNK13QFontMetricsF10inFontUcs4Ej @ 12363 NONAME + _ZNK13QTextFragment6glyphsEv @ 12364 NONAME + _ZNK14QFileOpenEvent8openFileER5QFile6QFlagsIN9QIODevice12OpenModeFlagEE @ 12365 NONAME + _ZNK14QWidgetPrivate17hasHeightForWidthEv @ 12366 NONAME + _ZNK16QFileSystemModel5rmdirERK11QModelIndex @ 12367 NONAME + _ZNK17QInternalMimeData10metaObjectEv @ 12368 NONAME + _ZNK17QInternalMimeData12retrieveDataERK7QStringN8QVariant4TypeE @ 12369 NONAME + _ZNK17QInternalMimeData7formatsEv @ 12370 NONAME + _ZNK17QInternalMimeData9hasFormatERK7QString @ 12371 NONAME + _ZNK18QTextureGlyphCache18textureMapForGlyphEj6QFixed @ 12372 NONAME + _ZNK18QTextureGlyphCache20subPixelPositionForXE6QFixed @ 12373 NONAME + _ZNK18QTextureGlyphCache30calculateSubPixelPositionCountEj @ 12374 NONAME + _ZNK19QAbstractProxyModel11hasChildrenERK11QModelIndex @ 12375 NONAME + _ZNK19QAbstractProxyModel12canFetchMoreERK11QModelIndex @ 12376 NONAME + _ZNK19QAbstractProxyModel20supportedDropActionsEv @ 12377 NONAME + _ZNK19QAbstractProxyModel4spanERK11QModelIndex @ 12378 NONAME + _ZNK19QAbstractProxyModel5buddyERK11QModelIndex @ 12379 NONAME + _ZNK19QAbstractProxyModel8mimeDataERK5QListI11QModelIndexE @ 12380 NONAME + _ZNK19QAbstractProxyModel9mimeTypesEv @ 12381 NONAME + _ZNK19QBlitterPaintEngine11createStateEP13QPainterState @ 12382 NONAME + _ZNK19QScrollPrepareEvent10contentPosEv @ 12383 NONAME + _ZNK19QScrollPrepareEvent12viewportSizeEv @ 12384 NONAME + _ZNK19QScrollPrepareEvent15contentPosRangeEv @ 12385 NONAME + _ZNK19QScrollPrepareEvent6d_funcEv @ 12386 NONAME + _ZNK19QScrollPrepareEvent8startPosEv @ 12387 NONAME + _ZNK19QScrollerProperties12scrollMetricENS_12ScrollMetricE @ 12388 NONAME + _ZNK19QScrollerPropertieseqERKS_ @ 12389 NONAME + _ZNK19QScrollerPropertiesneERKS_ @ 12390 NONAME + _ZNK20QBlittablePixmapData11paintEngineEv @ 12391 NONAME + _ZNK20QBlittablePixmapData15hasAlphaChannelEv @ 12392 NONAME + _ZNK20QBlittablePixmapData6metricEN12QPaintDevice17PaintDeviceMetricE @ 12393 NONAME + _ZNK20QBlittablePixmapData7toImageEv @ 12394 NONAME + _ZNK20QBlittablePixmapData9blittableEv @ 12395 NONAME + _ZNK20QRasterWindowSurface24hasStaticContentsSupportEv @ 12396 NONAME + _ZNK5QFont17hintingPreferenceEv @ 12397 NONAME + _ZNK7QGlyphs12glyphIndexesEv @ 12398 NONAME + _ZNK7QGlyphs4fontEv @ 12399 NONAME + _ZNK7QGlyphs9positionsEv @ 12400 NONAME + _ZNK7QGlyphseqERKS_ @ 12401 NONAME + _ZNK7QGlyphsneERKS_ @ 12402 NONAME + _ZNK7QGlyphsplERKS_ @ 12403 NONAME + _ZNK8QMdiArea11tabsMovableEv @ 12404 NONAME + _ZNK8QMdiArea12tabsClosableEv @ 12405 NONAME + _ZNK8QPainter16clipBoundingRectEv @ 12406 NONAME + _ZNK9QCheckBox15minimumSizeHintEv @ 12407 NONAME + _ZNK9QScroller10metaObjectEv @ 12408 NONAME + _ZNK9QScroller13finalPositionEv @ 12409 NONAME + _ZNK9QScroller13pixelPerMeterEv @ 12410 NONAME + _ZNK9QScroller18scrollerPropertiesEv @ 12411 NONAME + _ZNK9QScroller5stateEv @ 12412 NONAME + _ZNK9QScroller6targetEv @ 12413 NONAME + _ZNK9QScroller8velocityEv @ 12414 NONAME + _ZNK9QTextLine6glyphsEii @ 12415 NONAME + _ZTI10QBlittable @ 12416 NONAME + _ZTI12QScrollEvent @ 12417 NONAME + _ZTI13QFlickGesture @ 12418 NONAME + _ZTI17QInternalMimeData @ 12419 NONAME + _ZTI19QBlitterPaintEngine @ 12420 NONAME + _ZTI19QScrollPrepareEvent @ 12421 NONAME + _ZTI19QScrollerProperties @ 12422 NONAME + _ZTI20QBlittablePixmapData @ 12423 NONAME + _ZTI9QScroller @ 12424 NONAME + _ZTV10QBlittable @ 12425 NONAME + _ZTV12QScrollEvent @ 12426 NONAME + _ZTV13QFlickGesture @ 12427 NONAME + _ZTV17QInternalMimeData @ 12428 NONAME + _ZTV19QBlitterPaintEngine @ 12429 NONAME + _ZTV19QScrollPrepareEvent @ 12430 NONAME + _ZTV19QScrollerProperties @ 12431 NONAME + _ZTV20QBlittablePixmapData @ 12432 NONAME + _ZTV9QScroller @ 12433 NONAME + _Zls6QDebugPK13QSymbianEvent @ 12434 NONAME -- cgit v0.12 From 25a2df08706679d89780fae9216508ef0f094221 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <samuel.rodal@nokia.com> Date: Fri, 18 Mar 2011 12:53:28 +0100 Subject: Remove undefined symbol from tst_qwindowsurface. --- tests/auto/qwindowsurface/tst_qwindowsurface.cpp | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp index 4e3435e..b209258 100644 --- a/tests/auto/qwindowsurface/tst_qwindowsurface.cpp +++ b/tests/auto/qwindowsurface/tst_qwindowsurface.cpp @@ -66,7 +66,6 @@ private slots: void getSetWindowSurface(); void flushOutsidePaintEvent(); void grabWidget(); - void staticContentsAndPartialUpdateSupport(); }; class MyWindowSurface : public QWindowSurface -- cgit v0.12 From d164ca3dd62cb645767f332b7cddf07b400c8beb Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen <miikka.heikkinen@digia.com> Date: Fri, 18 Mar 2011 14:35:08 +0200 Subject: Add /q switch to QMAKE_DEL_FILE command in symbian Builds will otherwise halt without giving reason if a wildcard is given in QMAKE_CLEAN in symbian-abld. Task-number: QTBUG-18207 Reviewed-by: axis --- mkspecs/common/symbian/symbian.conf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mkspecs/common/symbian/symbian.conf b/mkspecs/common/symbian/symbian.conf index c16e4f1..eab9644 100644 --- a/mkspecs/common/symbian/symbian.conf +++ b/mkspecs/common/symbian/symbian.conf @@ -93,7 +93,7 @@ contains(QMAKE_HOST.os,Windows) { QMAKE_COPY = copy /y QMAKE_COPY_DIR = xcopy /s /q /y /i QMAKE_MOVE = move - QMAKE_DEL_FILE = del 2> NUL + QMAKE_DEL_FILE = del /q 2> NUL QMAKE_MKDIR = mkdir QMAKE_DEL_DIR = rmdir QMAKE_DEL_TREE = rmdir /s /q -- cgit v0.12 From c2317645b94f9a3004d76dda558c4a2b853a1489 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Samuel=20R=C3=B8dal?= <samuel.rodal@nokia.com> Date: Fri, 18 Mar 2011 14:24:03 +0100 Subject: Added setSwitchPolicy to MeeGo graphicssystem helper API. This lets the application control whether or not automatic switching should be used, and also to completely disable switching if desired. Reviewed-by: Armin Berres --- .../graphicssystems/meego/qmeegographicssystem.cpp | 19 ++++++++++++++----- .../graphicssystems/meego/qmeegographicssystem.h | 6 +++++- .../qmeegographicssystemhelper.cpp | 5 +++++ .../qmeegographicssystemhelper.h | 19 +++++++++++++++++++ tools/qmeegographicssystemhelper/qmeegoruntime.cpp | 13 ++++++++++++- tools/qmeegographicssystemhelper/qmeegoruntime.h | 3 +++ 6 files changed, 58 insertions(+), 7 deletions(-) diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp index cb66695..c904c3c 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.cpp @@ -67,6 +67,8 @@ QHash <Qt::HANDLE, QPixmap*> QMeeGoGraphicsSystem::liveTexturePixmaps; QList<QMeeGoSwitchCallback> QMeeGoGraphicsSystem::switchCallbacks; +QMeeGoGraphicsSystem::SwitchPolicy QMeeGoGraphicsSystem::switchPolicy = QMeeGoGraphicsSystem::AutomaticSwitch; + QMeeGoGraphicsSystem::QMeeGoGraphicsSystem() { qDebug("Using the meego graphics system"); @@ -122,14 +124,14 @@ void QMeeGoGraphicsSystemSwitchHandler::addWidget(QWidget *widget) void QMeeGoGraphicsSystemSwitchHandler::handleMapNotify() { - if (m_widgets.isEmpty()) + if (m_widgets.isEmpty() && QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch) QTimer::singleShot(0, this, SLOT(switchToMeeGo())); } void QMeeGoGraphicsSystemSwitchHandler::removeWidget(QObject *object) { m_widgets.removeOne(static_cast<QWidget *>(object)); - if (m_widgets.isEmpty()) + if (m_widgets.isEmpty() && QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch) QTimer::singleShot(0, this, SLOT(switchToRaster())); } @@ -153,7 +155,9 @@ int QMeeGoGraphicsSystemSwitchHandler::visibleWidgets() const bool QMeeGoGraphicsSystemSwitchHandler::eventFilter(QObject *object, QEvent *event) { - if (event->type() == QEvent::WindowStateChange) { + if (event->type() == QEvent::WindowStateChange + && QMeeGoGraphicsSystem::switchPolicy == QMeeGoGraphicsSystem::AutomaticSwitch) + { QWindowStateChangeEvent *change = static_cast<QWindowStateChangeEvent *>(event); QWidget *widget = static_cast<QWidget *>(object); @@ -380,7 +384,7 @@ QString QMeeGoGraphicsSystem::runningGraphicsSystemName() void QMeeGoGraphicsSystem::switchToMeeGo() { - if (meeGoRunning()) + if (switchPolicy == NoSwitch || meeGoRunning()) return; if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime")) @@ -397,7 +401,7 @@ void QMeeGoGraphicsSystem::switchToMeeGo() void QMeeGoGraphicsSystem::switchToRaster() { - if (runningGraphicsSystemName() == QLatin1String("raster")) + if (switchPolicy == NoSwitch || runningGraphicsSystemName() == QLatin1String("raster")) return; if (QApplicationPrivate::instance()->graphics_system_name != QLatin1String("runtime")) @@ -522,4 +526,9 @@ void qt_meego_register_switch_callback(QMeeGoSwitchCallback callback) QMeeGoGraphicsSystem::registerSwitchCallback(callback); } +void qt_meego_set_switch_policy(int policy) +{ + QMeeGoGraphicsSystem::switchPolicy = QMeeGoGraphicsSystem::SwitchPolicy(policy); +} + #include "qmeegographicssystem.moc" diff --git a/src/plugins/graphicssystems/meego/qmeegographicssystem.h b/src/plugins/graphicssystems/meego/qmeegographicssystem.h index ecc85b2..3528425 100644 --- a/src/plugins/graphicssystems/meego/qmeegographicssystem.h +++ b/src/plugins/graphicssystems/meego/qmeegographicssystem.h @@ -52,6 +52,8 @@ extern "C" typedef void (*QMeeGoSwitchCallback)(int type, const char *name); class QMeeGoGraphicsSystem : public QGraphicsSystem { public: + enum SwitchPolicy { AutomaticSwitch, ManualSwitch, NoSwitch }; + QMeeGoGraphicsSystem(); ~QMeeGoGraphicsSystem(); @@ -84,6 +86,8 @@ public: static void registerSwitchCallback(QMeeGoSwitchCallback callback); + static SwitchPolicy switchPolicy; + private: static bool meeGoRunning(); static EGLSurface getSurfaceForLiveTexturePixmap(QPixmap *pixmap); @@ -93,7 +97,6 @@ private: static bool surfaceWasCreated; static QHash<Qt::HANDLE, QPixmap*> liveTexturePixmaps; static QList<QMeeGoSwitchCallback> switchCallbacks; - }; /* C api */ @@ -118,6 +121,7 @@ extern "C" { Q_DECL_EXPORT void qt_meego_switch_to_raster(void); Q_DECL_EXPORT void qt_meego_switch_to_meego(void); Q_DECL_EXPORT void qt_meego_register_switch_callback(QMeeGoSwitchCallback callback); + Q_DECL_EXPORT void qt_meego_set_switch_policy(int policy); } #endif diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp index 3f39bda..6778bd5 100644 --- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.cpp @@ -136,6 +136,11 @@ void QMeeGoGraphicsSystemHelper::setSwapBehavior(SwapMode mode) QGLWindowSurface::swapBehavior = QGLWindowSurface::KillSwap; } +void QMeeGoGraphicsSystemHelper::setSwitchPolicy(SwitchPolicy policy) +{ + QMeeGoRuntime::setSwitchPolicy(policy); +} + void QMeeGoGraphicsSystemHelper::enableSwitchEvents() { QMeeGoRuntime::enableSwitchEvents(); diff --git a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h index 9e50652..4612190 100644 --- a/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h +++ b/tools/qmeegographicssystemhelper/qmeegographicssystemhelper.h @@ -112,6 +112,7 @@ public: If switch events are enabled, two events will be emitted for each switch -- one before the switch (QMeeGoSwitchEvent::WillSwitch) and one after the switch (QMeeGoSwitchEvent::DidSwitch). + If the switch policy is set to NoSwitch, this function has no effect. */ static void switchToMeeGo(); @@ -124,9 +125,27 @@ public: Calling this function will emit QMeeGoSwitchEvent to the top level widgets. If switch events are enabled, two events will be emitted for each switch -- one before the switch (QMeeGoSwitchEvent::WillSwitch) and one after the switch (QMeeGoSwitchEvent::DidSwitch). + If the switch policy is set to NoSwitch, this function has no effect. */ static void switchToRaster(); + //! Used to specify the policy for graphics system switching. + enum SwitchPolicy { + AutomaticSwitch, /**< Automatic switching */ + ManualSwitch, /**< Switching is controleld by the application */ + NoSwitch /**< Switching is disabled completely */ + }; + + //! Sets the policy of graphicssystem switching + /*! + By default, the switch to raster happens automatically when all windows are either + minimized or when the last window is destroyed. This function lets the application + change the graphicssystem switching policy to prevent the switching from happening + automatically (that is if the application doesn't want switching at all or wishes + to control the switching manually). + */ + static void setSwitchPolicy(SwitchPolicy policy); + //! Returns the name of the active graphics system /*! Returns the name of the currently active system. If running with 'runtime' graphics diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.cpp b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp index 15f9cdf..928d01a 100644 --- a/tools/qmeegographicssystemhelper/qmeegoruntime.cpp +++ b/tools/qmeegographicssystemhelper/qmeegoruntime.cpp @@ -75,6 +75,7 @@ typedef void (*QMeeGoInvalidateLiveSurfacesFunc) (void); typedef void (*QMeeGoSwitchToRasterFunc) (void); typedef void (*QMeeGoSwitchToMeeGoFunc) (void); typedef void (*QMeeGoRegisterSwitchCallbackFunc) (void (*callback)(int type, const char *name)); +typedef void (*QMeeGoSetSwitchPolicyFunc) (int policy); static QMeeGoImageToEglSharedImageFunc qt_meego_image_to_egl_shared_image = NULL; static QMeeGoPixmapDataFromEglSharedImageFunc qt_meego_pixmapdata_from_egl_shared_image = NULL; @@ -95,6 +96,7 @@ static QMeeGoInvalidateLiveSurfacesFunc qt_meego_invalidate_live_surfaces = NULL static QMeeGoSwitchToRasterFunc qt_meego_switch_to_raster = NULL; static QMeeGoSwitchToMeeGoFunc qt_meego_switch_to_meego = NULL; static QMeeGoRegisterSwitchCallbackFunc qt_meego_register_switch_callback = NULL; +static QMeeGoSetSwitchPolicyFunc qt_meego_set_switch_policy = NULL; extern "C" void handleSwitch(int type, const char *name) { @@ -134,6 +136,7 @@ void QMeeGoRuntime::initialize() qt_meego_switch_to_raster = (QMeeGoSwitchToRasterFunc) library.resolve("qt_meego_switch_to_raster"); qt_meego_switch_to_meego = (QMeeGoSwitchToMeeGoFunc) library.resolve("qt_meego_switch_to_meego"); qt_meego_register_switch_callback = (QMeeGoRegisterSwitchCallbackFunc) library.resolve("qt_meego_register_switch_callback"); + qt_meego_set_switch_policy = (QMeeGoSetSwitchPolicyFunc) library.resolve("qt_meego_set_switch_policy"); if (qt_meego_image_to_egl_shared_image && qt_meego_pixmapdata_from_egl_shared_image && qt_meego_pixmapdata_with_gl_texture && qt_meego_destroy_egl_shared_image && qt_meego_update_egl_shared_image_pixmap && @@ -141,7 +144,8 @@ void QMeeGoRuntime::initialize() qt_meego_pixmapdata_with_new_live_texture && qt_meego_pixmapdata_from_live_texture_handle && qt_meego_live_texture_lock && qt_meego_live_texture_release && qt_meego_live_texture_get_handle && qt_meego_create_fence_sync && qt_meego_destroy_fence_sync && qt_meego_invalidate_live_surfaces && - qt_meego_switch_to_raster && qt_meego_switch_to_meego && qt_meego_register_switch_callback) + qt_meego_switch_to_raster && qt_meego_switch_to_meego && qt_meego_register_switch_callback && + qt_meego_set_switch_policy) { qDebug("Successfully resolved MeeGo graphics system: %s %s\n", qPrintable(libraryPrivate->fileName), qPrintable(libraryPrivate->fullVersion)); } else { @@ -289,3 +293,10 @@ void QMeeGoRuntime::enableSwitchEvents() switchEventsEnabled = true; } } + +void QMeeGoRuntime::setSwitchPolicy(QMeeGoGraphicsSystemHelper::SwitchPolicy policy) +{ + ENSURE_INITIALIZED; + Q_ASSERT(qt_meego_set_switch_policy); + qt_meego_set_switch_policy(int(policy)); +} diff --git a/tools/qmeegographicssystemhelper/qmeegoruntime.h b/tools/qmeegographicssystemhelper/qmeegoruntime.h index 6279b4c..b898699 100644 --- a/tools/qmeegographicssystemhelper/qmeegoruntime.h +++ b/tools/qmeegographicssystemhelper/qmeegoruntime.h @@ -42,6 +42,8 @@ #include <QPixmap> #include <QImage> +#include "qmeegographicssystemhelper.h" + class QMeeGoRuntime { public: @@ -66,6 +68,7 @@ public: static void switchToRaster(); static void switchToMeeGo(); static void enableSwitchEvents(); + static void setSwitchPolicy(QMeeGoGraphicsSystemHelper::SwitchPolicy policy); private: static bool initialized; -- cgit v0.12 From 59373dd338cb9428514b67c21d0e03b8dc189eef Mon Sep 17 00:00:00 2001 From: Gareth Stockwell <gareth.stockwell@accenture.com> Date: Fri, 18 Mar 2011 10:21:26 +0000 Subject: Fixed unmatched quotes in s60installs.pro Reviewed-by: Miikka Heikkinen --- src/s60installs/s60installs.pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/s60installs/s60installs.pro b/src/s60installs/s60installs.pro index 1e5ce0f..76f1dda 100644 --- a/src/s60installs/s60installs.pro +++ b/src/s60installs/s60installs.pro @@ -58,7 +58,7 @@ symbian: { " \"$$pluginLocations/qts60plugin_5_0$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qts60plugin_5_0$${QT_LIBINFIX}.dll\"" \ " \"$$bearerPluginLocation/qsymbianbearer$${QT_LIBINFIX}.dll\" - \"c:\\sys\\bin\\qsymbianbearer$${QT_LIBINFIX}.dll\"" \ "ENDIF" \ - " \"$$bearerStubZ\" - \"c:$$replace(QT_PLUGINS_BASE_DIR,/,\\)\\bearer\\qsymbianbearer$${QT_LIBINFIX}.qtplugin\" + " \"$$bearerStubZ\" - \"c:$$replace(QT_PLUGINS_BASE_DIR,/,\\)\\bearer\\qsymbianbearer$${QT_LIBINFIX}.qtplugin\"" } else { # No need to deploy plugins for older platform versions when building on Symbian3 or later qts60plugindeployment = \ -- cgit v0.12 From 31514ab488c610056973318f5a950d925155d480 Mon Sep 17 00:00:00 2001 From: Gareth Stockwell <ext-gareth.stockwell@nokia.com> Date: Wed, 16 Mar 2011 15:53:45 +0000 Subject: Add flag for forcibly propagating backing store alpha to framebuffer Previously, the following rules applies to the creation and blitting of the Symbian raster backing store: 1. Creation of backing store with an alpha channel: Backing store has an alpha channel only if !QWidget::isOpaque. 2. Pre-filling of backing store prior to paint loop: Backing store is filled with transparent pixels if !QWidget::isOpaque. 3. Blitting of backing store: CGraphicsContext::EDrawModeWriteAlpha is used (meaning that backing store alpha values are propagated into the frame buffer), if QWidget::isOpaque. In order for the direct camera viewfinder to be visible on DSA devices, alpha=0 must be written into the framebuffer in the region where the viewfinder will be displayed. This requires a backing store with an alpha channel (1), use of CGraphicsContext::EDrawModeWriteAlpha (3), but not pre-filling of the entire backing store (2). This patch adds a new enum value, QWExtra::BlitWriteAlpha, which can be used by camera backends to achieve the desired behaviour. Task-number: QTMOBILITY-1278 Reviewed-by: Jani Hautakangas --- src/gui/kernel/qapplication_s60.cpp | 3 ++- src/gui/kernel/qwidget_p.h | 5 +++++ src/gui/kernel/qwidget_s60.cpp | 10 +++++++--- src/gui/painting/qwindowsurface_s60.cpp | 28 +++++++++++++++++++--------- 4 files changed, 33 insertions(+), 13 deletions(-) diff --git a/src/gui/kernel/qapplication_s60.cpp b/src/gui/kernel/qapplication_s60.cpp index 43b9b01..2b10d63 100644 --- a/src/gui/kernel/qapplication_s60.cpp +++ b/src/gui/kernel/qapplication_s60.cpp @@ -1132,7 +1132,8 @@ void QSymbianControl::Draw(const TRect& controlRect) const // Do nothing break; case QWExtra::Blit: - if (qwidget->d_func()->isOpaque) + case QWExtra::BlitWriteAlpha: + if (qwidget->d_func()->isOpaque || nativePaintMode == QWExtra::BlitWriteAlpha) gc.SetDrawMode(CGraphicsContext::EDrawModeWriteAlpha); gc.BitBlt(controlRect.iTl, bitmap, backingStoreRect); break; diff --git a/src/gui/kernel/qwidget_p.h b/src/gui/kernel/qwidget_p.h index 5235dc4..13e2349 100644 --- a/src/gui/kernel/qwidget_p.h +++ b/src/gui/kernel/qwidget_p.h @@ -315,6 +315,11 @@ struct QWExtra { */ ZeroFill, + /** + * Blit backing store, propagating alpha channel into the framebuffer. + */ + BlitWriteAlpha, + Default = Blit }; diff --git a/src/gui/kernel/qwidget_s60.cpp b/src/gui/kernel/qwidget_s60.cpp index 62d09fe..b65ae4d 100644 --- a/src/gui/kernel/qwidget_s60.cpp +++ b/src/gui/kernel/qwidget_s60.cpp @@ -805,9 +805,14 @@ void QWidgetPrivate::s60UpdateIsOpaque() { Q_Q(QWidget); - if (!q->testAttribute(Qt::WA_WState_Created) || !q->testAttribute(Qt::WA_TranslucentBackground)) + if (!q->testAttribute(Qt::WA_WState_Created)) return; + const bool writeAlpha = extraData()->nativePaintMode == QWExtra::BlitWriteAlpha; + if (!q->testAttribute(Qt::WA_TranslucentBackground) && !writeAlpha) + return; + const bool requireAlphaChannel = !isOpaque || writeAlpha; + createTLExtra(); RWindow *const window = static_cast<RWindow *>(q->effectiveWinId()->DrawableWindow()); @@ -819,12 +824,11 @@ void QWidgetPrivate::s60UpdateIsOpaque() return; } #endif - if (!isOpaque) { + if (requireAlphaChannel) { const TDisplayMode displayMode = static_cast<TDisplayMode>(window->SetRequiredDisplayMode(EColor16MA)); if (window->SetTransparencyAlphaChannel() == KErrNone) { window->SetBackgroundColor(TRgb(255, 255, 255, 0)); extra->topextra->nativeWindowTransparencyEnabled = 1; - if (extra->topextra->backingStore.data() && ( QApplicationPrivate::graphics_system_name == QLatin1String("openvg") || QApplicationPrivate::graphics_system_name == QLatin1String("opengl"))) { diff --git a/src/gui/painting/qwindowsurface_s60.cpp b/src/gui/painting/qwindowsurface_s60.cpp index 9f371a8..cb53ea0 100644 --- a/src/gui/painting/qwindowsurface_s60.cpp +++ b/src/gui/painting/qwindowsurface_s60.cpp @@ -63,7 +63,6 @@ struct QS60WindowSurfacePrivate TDisplayMode displayMode(bool opaque) { - TDisplayMode mode = S60->screenDevice()->DisplayMode(); if (opaque) { mode = EColor16MU; @@ -76,10 +75,18 @@ TDisplayMode displayMode(bool opaque) return mode; } +bool blitWriteAlpha(QWidgetPrivate *widgetPrivate) +{ + QWExtra *extra = widgetPrivate->extraData(); + return extra ? extra->nativePaintMode == QWExtra::BlitWriteAlpha : false; +} + QS60WindowSurface::QS60WindowSurface(QWidget* widget) : QWindowSurface(widget), d_ptr(new QS60WindowSurfacePrivate) { - TDisplayMode mode = displayMode(qt_widget_private(widget)->isOpaque); + QWidgetPrivate *widgetPrivate = qt_widget_private(widget); + const bool opaque = widgetPrivate->isOpaque && !blitWriteAlpha(widgetPrivate); + TDisplayMode mode = displayMode(opaque); // We create empty CFbsBitmap here -> it will be resized in setGeometry CFbsBitmap *bitmap = q_check_ptr(new CFbsBitmap); // CBase derived object needs check on new qt_symbian_throwIfError( bitmap->Create( TSize(0, 0), mode ) ); @@ -123,7 +130,8 @@ void QS60WindowSurface::beginPaint(const QRegion &rgn) S60->wsSession().Finish(); #endif - if (!qt_widget_private(window())->isOpaque) { + QWidgetPrivate *windowPrivate = qt_widget_private(window()); + if (!windowPrivate->isOpaque || blitWriteAlpha(windowPrivate)) { QS60PixmapData *pixmapData = static_cast<QS60PixmapData *>(d_ptr->device.data_ptr().data()); TDisplayMode mode = displayMode(false); @@ -132,12 +140,14 @@ void QS60WindowSurface::beginPaint(const QRegion &rgn) pixmapData->beginDataAccess(); - QPainter p(&pixmapData->image); - p.setCompositionMode(QPainter::CompositionMode_Source); - const QVector<QRect> rects = rgn.rects(); - const QColor blank = Qt::transparent; - for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) { - p.fillRect(*it, blank); + if (!windowPrivate->isOpaque) { + QPainter p(&pixmapData->image); + p.setCompositionMode(QPainter::CompositionMode_Source); + const QVector<QRect> rects = rgn.rects(); + const QColor blank = Qt::transparent; + for (QVector<QRect>::const_iterator it = rects.begin(); it != rects.end(); ++it) { + p.fillRect(*it, blank); + } } pixmapData->endDataAccess(); -- cgit v0.12 From af760349e083c0d9719733abe5f39f35ff02f81c Mon Sep 17 00:00:00 2001 From: Joerg Bornemann <joerg.bornemann@nokia.com> Date: Fri, 18 Mar 2011 19:21:11 +0100 Subject: qmake vcproj generator: do not insert $(INHERIT) This will remove the warnings about undefined environment variables when building with IncrediBuild. The $(INHERIT) feature does not work in the "Create PCH through file" property of Visual Studio. It expands to an empty string but doesn't yield a warning in a standard VS build. Also, the value of "Create PCH through file" is supposed to be exactly the string as in the include statement of the cpp file. Done-with: Marius Storm-Olsen --- qmake/generators/win32/msvc_objectmodel.cpp | 8 ++++---- qmake/generators/win32/msvc_objectmodel.h | 1 + 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/qmake/generators/win32/msvc_objectmodel.cpp b/qmake/generators/win32/msvc_objectmodel.cpp index 020c3d8..815a476 100644 --- a/qmake/generators/win32/msvc_objectmodel.cpp +++ b/qmake/generators/win32/msvc_objectmodel.cpp @@ -355,7 +355,7 @@ VCCLCompilerTool::VCCLCompilerTool() TreatWChar_tAsBuiltInType(unset), TurnOffAssemblyGeneration(unset), UndefineAllPreprocessorDefinitions(unset), - UsePrecompiledHeader(pchNone), + UsePrecompiledHeader(pchUnset), UseUnicodeForAssemblerListing(unset), WarnAsError(unset), WarningLevel(warningLevel_0), @@ -389,7 +389,7 @@ inline XmlOutput::xml_output xformUsePrecompiledHeaderForNET2005(pchOption whatP if (whatPch == pchGenerateAuto) whatPch = (pchOption)0; if (whatPch == pchUseUsingSpecific) whatPch = (pchOption)2; } - return attrE(_UsePrecompiledHeader, whatPch); + return attrE(_UsePrecompiledHeader, whatPch, /*ifNot*/ pchUnset); } inline XmlOutput::xml_output xformExceptionHandlingNET2005(exceptionHandling eh, DotNET compilerVersion) @@ -2146,7 +2146,7 @@ void VCFilter::modifyPCHstage(QString str) useCompilerTool = true; // Setup PCH options CompilerTool.UsePrecompiledHeader = (isCFile ? pchNone : pchCreateUsingSpecific); - CompilerTool.PrecompiledHeaderThrough = (isCPPFile ? QString("$(INHERIT)") : QString("$(NOINHERIT)")); + CompilerTool.PrecompiledHeaderThrough = (isCPPFile ? Project->precompHFilename : QString("$(NOINHERIT)")); CompilerTool.ForcedIncludeFiles = QStringList("$(NOINHERIT)"); } @@ -2514,7 +2514,7 @@ void VCProjectWriter::write(XmlOutput &xml, const VCCLCompilerTool &tool) << attrT(_TurnOffAssemblyGeneration, tool.TurnOffAssemblyGeneration) << attrT(_UndefineAllPreprocessorDefinitions, tool.UndefineAllPreprocessorDefinitions) << attrX(_UndefinePreprocessorDefinitions, tool.UndefinePreprocessorDefinitions) - << (!tool.PrecompiledHeaderFile.isEmpty() || !tool.PrecompiledHeaderThrough.isEmpty() ? xformUsePrecompiledHeaderForNET2005(tool.UsePrecompiledHeader, tool.config->CompilerVersion) : noxml()) + << xformUsePrecompiledHeaderForNET2005(tool.UsePrecompiledHeader, tool.config->CompilerVersion) << attrT(_WarnAsError, tool.WarnAsError) << attrE(_WarningLevel, tool.WarningLevel, /*ifNot*/ warningLevelUnknown) << attrT(_WholeProgramOptimization, tool.WholeProgramOptimization) diff --git a/qmake/generators/win32/msvc_objectmodel.h b/qmake/generators/win32/msvc_objectmodel.h index 5431ce0..3e62fb4 100644 --- a/qmake/generators/win32/msvc_objectmodel.h +++ b/qmake/generators/win32/msvc_objectmodel.h @@ -366,6 +366,7 @@ enum optLinkTimeCodeGenType { optLTCGUpdate }; enum pchOption { + pchUnset = -1, pchNone, pchCreateUsingSpecific, pchGenerateAuto, -- cgit v0.12 From 3d91f9a971990324ef1d785c9c0b8bbed1175711 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Mon, 21 Mar 2011 09:35:19 +0100 Subject: Designer: Do not translate page object names of QMdiArea. and page-based containers. Task-number: QTBUG-18244 --- tools/designer/src/lib/shared/qdesigner_command.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/designer/src/lib/shared/qdesigner_command.cpp b/tools/designer/src/lib/shared/qdesigner_command.cpp index 148b4c8..f4e250d 100644 --- a/tools/designer/src/lib/shared/qdesigner_command.cpp +++ b/tools/designer/src/lib/shared/qdesigner_command.cpp @@ -2094,12 +2094,12 @@ void AddContainerWidgetPageCommand::init(QWidget *containerWidget, ContainerType case PageContainer: setText(QApplication::translate("Command", "Insert Page")); m_widget = new QDesignerWidget(formWindow(), m_containerWidget); - m_widget->setObjectName(QApplication::translate("Command", "page")); + m_widget->setObjectName(QLatin1String("page")); break; case MdiContainer: setText(QApplication::translate("Command", "Insert Subwindow")); m_widget = new QDesignerWidget(formWindow(), m_containerWidget); - m_widget->setObjectName(QApplication::translate("Command", "subwindow")); + m_widget->setObjectName(QLatin1String("subwindow")); setPropertySheetWindowTitle(core, m_widget, QApplication::translate("Command", "Subwindow")); break; case WizardContainer: // Apply style, don't manage -- cgit v0.12 From 8a9dd3f463a312963dc420ee83ca75fd52e24463 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint <Friedemann.Kleint@nokia.com> Date: Mon, 21 Mar 2011 15:54:49 +0100 Subject: Designer: Remember default of main container's object name. as a default property value. Users can then safely reset it to its original value. The default-generated name previously led to the uic-generated file names to be different, causing build errors in IDE's. Task-number: QTBUG-18256 --- .../src/components/formeditor/qdesigner_resource.cpp | 5 ++++- tools/designer/src/lib/shared/qdesigner_propertysheet.cpp | 13 +++++++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/tools/designer/src/components/formeditor/qdesigner_resource.cpp b/tools/designer/src/components/formeditor/qdesigner_resource.cpp index 714a556..005459b 100644 --- a/tools/designer/src/components/formeditor/qdesigner_resource.cpp +++ b/tools/designer/src/components/formeditor/qdesigner_resource.cpp @@ -741,7 +741,10 @@ QWidget *QDesignerResource::load(QIODevice *dev, QWidget *parentWidget) case LoadPreCheckOk: break; } - return QEditorFormBuilder::load(dev, parentWidget); + QWidget *w = QEditorFormBuilder::load(dev, parentWidget); + if (w) // Store the class name as 'reset' value for the main container's object name. + w->setProperty("_q_classname", w->objectName()); + return w; } bool QDesignerResource::saveRelative() const diff --git a/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp b/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp index babe20e..27527da 100644 --- a/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp +++ b/tools/designer/src/lib/shared/qdesigner_propertysheet.cpp @@ -1195,8 +1195,17 @@ bool QDesignerPropertySheet::reset(int index) { if (d->invalidIndex(Q_FUNC_INFO, index)) return false; - if (d->isStringProperty(index)) - setProperty(index, QVariant::fromValue(qdesigner_internal::PropertySheetStringValue())); + if (d->isStringProperty(index)) { + qdesigner_internal::PropertySheetStringValue value; + // Main container: Reset to stored class name as not to change the file names generated by uic. + if (propertyName(index) == QLatin1String("objectName")) { + const QVariant classNameDefaultV = d->m_object->property("_q_classname"); + if (classNameDefaultV.isValid()) + value.setValue(classNameDefaultV.toString()); + } + setProperty(index, QVariant::fromValue(value)); + return true; + } if (d->isKeySequenceProperty(index)) setProperty(index, QVariant::fromValue(qdesigner_internal::PropertySheetKeySequenceValue())); if (d->isResourceProperty(index)) { -- cgit v0.12