diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2009-04-23 08:46:26 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-04-23 08:46:26 (GMT) |
commit | be3916b7e4e8007394cbed40484ef6b696e90f2b (patch) | |
tree | a66dc85f3900e08a040f0d80eb0e56f43a163efc /src/plugins | |
parent | ed24cd82444faeeda0a171a9082808ebb667e092 (diff) | |
parent | 389c4fdebe681eb3af5a2431c390323f52a03c17 (diff) | |
download | Qt-be3916b7e4e8007394cbed40484ef6b696e90f2b.zip Qt-be3916b7e4e8007394cbed40484ef6b696e90f2b.tar.gz Qt-be3916b7e4e8007394cbed40484ef6b696e90f2b.tar.bz2 |
Merge branch '4.5' of git@scm.dev.nokia.troll.no:qt/qt
Conflicts:
src/corelib/global/qfeatures.h
src/gui/painting/qtransform.cpp
util/scripts/make_qfeatures_dot_h
Diffstat (limited to 'src/plugins')
5 files changed, 184 insertions, 76 deletions
diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp index cd19f69..368b9f9 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbkeyboard.cpp @@ -173,6 +173,22 @@ void QDirectFBKeyboardHandlerPrivate::readKeyboardData() Qt::KeyboardModifiers modifiers = Qt::NoModifier; + // Not implemented: + // if (input.modifiers & DIMM_SUPER) + // if (input.modifiers & DIMM_HYPER) + + if (!(input.flags & DIEF_KEYSYMBOL) || + !(input.flags & DIEF_KEYID) || + !(input.type & (DIET_KEYPRESS|DIET_KEYRELEASE))) + { + static bool first = true; + if (first) { + qWarning("QDirectFBKeyboardHandler - Getting unexpected non-keyboard related events"); + first = false; + } + break; + } + if (input.flags & DIEF_MODIFIERS) { if (input.modifiers & DIMM_SHIFT) modifiers |= Qt::ShiftModifier; @@ -185,31 +201,15 @@ void QDirectFBKeyboardHandlerPrivate::readKeyboardData() if (input.modifiers & DIMM_META) modifiers |= Qt::MetaModifier; } - // Not implemented: - // if (input.modifiers & DIMM_SUPER) - // if (input.modifiers & DIMM_HYPER) - if ( !(input.flags & DIEF_KEYSYMBOL) || - !(input.flags & DIEF_KEYID) || - !(input.type & (DIET_KEYPRESS | DIET_KEYRELEASE)) ) - { - static int warningCount = 0; - if (!warningCount) { - qWarning("QDirectFBKeyboardHandler - Getting unexpected non-keyboard related events"); - warningCount = 100; - } - else - warningCount--; - break; - } - bool press = input.type & DIET_KEYPRESS; + const bool press = input.type & DIET_KEYPRESS; DFBInputDeviceKeySymbol symbol = input.key_symbol; int unicode = -1; int keycode = 0; keycode = keymap()->value(symbol); - if (keycode == 0 && DFB_KEY_TYPE(symbol) == DIKT_UNICODE) + if (DFB_KEY_TYPE(symbol) == DIKT_UNICODE) unicode = symbol; if (unicode != -1 || keycode != 0) { @@ -314,6 +314,100 @@ KeyMap::KeyMap() insert(DIKS_DEAD_SEMIVOICED_SOUND , Qt::Key_Dead_Semivoiced_Sound); insert(DIKS_DEAD_TILDE , Qt::Key_Dead_Tilde); insert(DIKS_DEAD_VOICED_SOUND , Qt::Key_Dead_Voiced_Sound); + insert(DIKS_SPACE , Qt::Key_Space); + insert(DIKS_EXCLAMATION_MARK , Qt::Key_Exclam); + insert(DIKS_QUOTATION , Qt::Key_QuoteDbl); + insert(DIKS_NUMBER_SIGN , Qt::Key_NumberSign); + insert(DIKS_DOLLAR_SIGN , Qt::Key_Dollar); + insert(DIKS_PERCENT_SIGN , Qt::Key_Percent); + insert(DIKS_AMPERSAND , Qt::Key_Ampersand); + insert(DIKS_APOSTROPHE , Qt::Key_Apostrophe); + insert(DIKS_PARENTHESIS_LEFT , Qt::Key_ParenLeft); + insert(DIKS_PARENTHESIS_RIGHT , Qt::Key_ParenRight); + insert(DIKS_ASTERISK , Qt::Key_Asterisk); + insert(DIKS_PLUS_SIGN , Qt::Key_Plus); + insert(DIKS_COMMA , Qt::Key_Comma); + insert(DIKS_MINUS_SIGN , Qt::Key_Minus); + insert(DIKS_PERIOD , Qt::Key_Period); + insert(DIKS_SLASH , Qt::Key_Slash); + insert(DIKS_0 , Qt::Key_0); + insert(DIKS_1 , Qt::Key_1); + insert(DIKS_2 , Qt::Key_2); + insert(DIKS_3 , Qt::Key_3); + insert(DIKS_4 , Qt::Key_4); + insert(DIKS_5 , Qt::Key_5); + insert(DIKS_6 , Qt::Key_6); + insert(DIKS_7 , Qt::Key_7); + insert(DIKS_8 , Qt::Key_8); + insert(DIKS_9 , Qt::Key_9); + insert(DIKS_COLON , Qt::Key_Colon); + insert(DIKS_SEMICOLON , Qt::Key_Semicolon); + insert(DIKS_LESS_THAN_SIGN , Qt::Key_Less); + insert(DIKS_EQUALS_SIGN , Qt::Key_Equal); + insert(DIKS_GREATER_THAN_SIGN , Qt::Key_Greater); + insert(DIKS_QUESTION_MARK , Qt::Key_Question); + insert(DIKS_AT , Qt::Key_At); + insert(DIKS_CAPITAL_A , Qt::Key_A); + insert(DIKS_CAPITAL_B , Qt::Key_B); + insert(DIKS_CAPITAL_C , Qt::Key_C); + insert(DIKS_CAPITAL_D , Qt::Key_D); + insert(DIKS_CAPITAL_E , Qt::Key_E); + insert(DIKS_CAPITAL_F , Qt::Key_F); + insert(DIKS_CAPITAL_G , Qt::Key_G); + insert(DIKS_CAPITAL_H , Qt::Key_H); + insert(DIKS_CAPITAL_I , Qt::Key_I); + insert(DIKS_CAPITAL_J , Qt::Key_J); + insert(DIKS_CAPITAL_K , Qt::Key_K); + insert(DIKS_CAPITAL_L , Qt::Key_L); + insert(DIKS_CAPITAL_M , Qt::Key_M); + insert(DIKS_CAPITAL_N , Qt::Key_N); + insert(DIKS_CAPITAL_O , Qt::Key_O); + insert(DIKS_CAPITAL_P , Qt::Key_P); + insert(DIKS_CAPITAL_Q , Qt::Key_Q); + insert(DIKS_CAPITAL_R , Qt::Key_R); + insert(DIKS_CAPITAL_S , Qt::Key_S); + insert(DIKS_CAPITAL_T , Qt::Key_T); + insert(DIKS_CAPITAL_U , Qt::Key_U); + insert(DIKS_CAPITAL_V , Qt::Key_V); + insert(DIKS_CAPITAL_W , Qt::Key_W); + insert(DIKS_CAPITAL_X , Qt::Key_X); + insert(DIKS_CAPITAL_Y , Qt::Key_Y); + insert(DIKS_CAPITAL_Z , Qt::Key_Z); + insert(DIKS_SQUARE_BRACKET_LEFT , Qt::Key_BracketLeft); + insert(DIKS_BACKSLASH , Qt::Key_Backslash); + insert(DIKS_SQUARE_BRACKET_RIGHT , Qt::Key_BracketRight); + insert(DIKS_CIRCUMFLEX_ACCENT , Qt::Key_AsciiCircum); + insert(DIKS_UNDERSCORE , Qt::Key_Underscore); + insert(DIKS_SMALL_A , Qt::Key_A); + insert(DIKS_SMALL_B , Qt::Key_B); + insert(DIKS_SMALL_C , Qt::Key_C); + insert(DIKS_SMALL_D , Qt::Key_D); + insert(DIKS_SMALL_E , Qt::Key_E); + insert(DIKS_SMALL_F , Qt::Key_F); + insert(DIKS_SMALL_G , Qt::Key_G); + insert(DIKS_SMALL_H , Qt::Key_H); + insert(DIKS_SMALL_I , Qt::Key_I); + insert(DIKS_SMALL_J , Qt::Key_J); + insert(DIKS_SMALL_K , Qt::Key_K); + insert(DIKS_SMALL_L , Qt::Key_L); + insert(DIKS_SMALL_M , Qt::Key_M); + insert(DIKS_SMALL_N , Qt::Key_N); + insert(DIKS_SMALL_O , Qt::Key_O); + insert(DIKS_SMALL_P , Qt::Key_P); + insert(DIKS_SMALL_Q , Qt::Key_Q); + insert(DIKS_SMALL_R , Qt::Key_R); + insert(DIKS_SMALL_S , Qt::Key_S); + insert(DIKS_SMALL_T , Qt::Key_T); + insert(DIKS_SMALL_U , Qt::Key_U); + insert(DIKS_SMALL_V , Qt::Key_V); + insert(DIKS_SMALL_W , Qt::Key_W); + insert(DIKS_SMALL_X , Qt::Key_X); + insert(DIKS_SMALL_Y , Qt::Key_Y); + insert(DIKS_SMALL_Z , Qt::Key_Z); + insert(DIKS_CURLY_BRACKET_LEFT , Qt::Key_BraceLeft); + insert(DIKS_VERTICAL_BAR , Qt::Key_Bar); + insert(DIKS_CURLY_BRACKET_RIGHT , Qt::Key_BraceRight); + insert(DIKS_TILDE , Qt::Key_AsciiTilde); } #include "qdirectfbkeyboard.moc" diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp index 2a2ef5c..924090c 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpaintdevice.cpp @@ -56,23 +56,16 @@ IDirectFBSurface *QDirectFBPaintDevice::directFBSurface() const } -// Locks the dfb surface and creates a QImage (lockedImage) from the pointer -void QDirectFBPaintDevice::lockDirectFB() { - +void QDirectFBPaintDevice::lockDirectFB() +{ if (lockedImage) return; // Already locked - void *mem; - int w, h; - DFBResult result = dfbSurface->Lock(dfbSurface, DSLF_WRITE, &mem, &bpl); - if (result != DFB_OK || !mem) { - DirectFBError("QDirectFBPixmapData::buffer()", result); - return; + if (uchar *mem = QDirectFBScreen::lockSurface(dfbSurface, DSLF_WRITE, &bpl)) { + const QSize s = size(); + lockedImage = new QImage(mem, s.width(), s.height(), bpl, + QDirectFBScreen::getImageFormat(dfbSurface)); } - - dfbSurface->GetSize(dfbSurface, &w, &h); - lockedImage = new QImage(static_cast<uchar*>(mem), w, h, bpl, - QDirectFBScreen::getImageFormat(dfbSurface)); } diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp index 0a1696a..ea9bb3a 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbpixmap.cpp @@ -157,10 +157,13 @@ static bool checkForAlphaPixels(const QImage &img) return false; } -void QDirectFBPixmapData::fromImage(const QImage &img, +void QDirectFBPixmapData::fromImage(const QImage &i, Qt::ImageConversionFlags flags) { - Q_ASSERT(img.depth() != 1); // these should be handled by QRasterPixmapData +#ifdef QT_NO_DIRECTFB_OPAQUE_DETECTION + Q_UNUSED(flags); +#endif + const QImage img = (i.depth() == 1 ? i.convertToFormat(screen->alphaPixmapFormat()) : i); if (img.hasAlphaChannel() #ifndef QT_NO_DIRECTFB_OPAQUE_DETECTION && (flags & Qt::NoOpaqueDetection || ::checkForAlphaPixels(img)) @@ -267,16 +270,17 @@ void QDirectFBPixmapData::fill(const QColor &color) if (forceRaster) { // in DSPF_RGB32 all dfb drawing causes the Alpha byte to be // set to 0. This causes issues for the raster engine. - char *mem; - int bpl; - const int h = QPixmapData::height(); - dfbSurface->Lock(dfbSurface, DSLF_WRITE, (void**)&mem, &bpl); - const int c = color.rgba(); - for (int i = 0; i < h; ++i) { - memset(mem, c, bpl); - mem += bpl; + uchar *mem = QDirectFBScreen::lockSurface(dfbSurface, DSLF_WRITE, &bpl); + if (mem) { + const int h = QPixmapData::height(); + const int w = QPixmapData::width() * 4; // 4 bytes per 32 bit pixel + const int c = color.rgba(); + for (int i = 0; i < h; ++i) { + memset(mem, c, w); + mem += bpl; + } + dfbSurface->Unlock(dfbSurface); } - dfbSurface->Unlock(dfbSurface); } else { dfbSurface->Clear(dfbSurface, color.red(), color.green(), color.blue(), color.alpha()); diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp index 041d522..3e54e7f 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.cpp @@ -159,15 +159,17 @@ IDirectFBSurface* QDirectFBScreen::createDFBSurface(const QImage &img, SurfaceCr IDirectFBSurface *surface = createDFBSurface(&desc, options); #ifdef QT_NO_DIRECTFB_PREALLOCATED if (surface) { - char *mem; int bpl; - surface->Lock(surface, DSLF_WRITE, (void**)&mem, &bpl); - const int h = img.height(); - for (int i = 0; i < h; ++i) { - memcpy(mem, img.scanLine(i), bpl); - mem += bpl; + uchar *mem = QDirectFBScreen::lockSurface(surface, DSLF_WRITE, &bpl); + if (mem) { + const int h = img.height(); + const int w = img.width() * img.depth() / 8; + for (int i = 0; i < h; ++i) { + memcpy(mem, img.scanLine(i), w); + mem += bpl; + } + surface->Unlock(surface); } - surface->Unlock(surface); } #endif #ifndef QT_NO_DIRECTFB_PALETTE @@ -317,15 +319,17 @@ IDirectFBSurface *QDirectFBScreen::copyToDFBSurface(const QImage &img, imgSurface->Release(imgSurface); #else // QT_NO_DIRECTFB_PREALLOCATED Q_ASSERT(image.format() == pixmapFormat); - char *mem; int bpl; - dfbSurface->Lock(dfbSurface, DSLF_WRITE, (void**)&mem, &bpl); - const int w = image.width() * image.depth() / 8; - for (int i = 0; i < image.height(); ++i) { - memcpy(mem, image.scanLine(i), w); - mem += bpl; + uchar *mem = QDirectFBScreen::lockSurface(dfbSurface, DSLF_WRITE, &bpl); + if (mem) { + const int h = image.height(); + const int w = image.width() * image.depth() / 8; + for (int i=0; i<h; ++i) { + memcpy(mem, image.scanLine(i), w); + mem += bpl; + } + dfbSurface->Unlock(dfbSurface); } - dfbSurface->Unlock(dfbSurface); #endif return dfbSurface; } @@ -833,15 +837,15 @@ bool QDirectFBScreen::connect(const QString &displaySpec) description.flags = DFBSurfaceDescriptionFlags(description.flags | DSDESC_WIDTH); if (::setIntOption(displayArgs, QLatin1String("height"), &description.height)) description.flags = DFBSurfaceDescriptionFlags(description.flags | DSDESC_HEIGHT); - description.caps = DFBSurfaceCapabilities(DSCAPS_PRIMARY - | DSCAPS_DOUBLE - | DSCAPS_STATIC_ALLOC); - if (displayArgs.contains(QLatin1String("forcepremultiplied"), - Qt::CaseInsensitive)) { - description.caps = DFBSurfaceCapabilities(description.caps - | DSCAPS_PREMULTIPLIED); + uint caps = DSCAPS_PRIMARY|DSCAPS_DOUBLE; + if (displayArgs.contains(QLatin1String("static_alloc"))) + caps |= DSCAPS_STATIC_ALLOC; + + if (displayArgs.contains(QLatin1String("forcepremultiplied"), Qt::CaseInsensitive)) { + caps |= DSCAPS_PREMULTIPLIED; } + description.caps = DFBSurfaceCapabilities(caps); // We don't track the primary surface as it's released in disconnect d_ptr->dfbSurface = createDFBSurface(&description, DontTrackSurface); if (!d_ptr->dfbSurface) { @@ -952,16 +956,15 @@ void QDirectFBScreen::disconnect() bool QDirectFBScreen::initDevice() { - QWSServer *server = QWSServer::instance(); #ifndef QT_NO_DIRECTFB_MOUSE if (qgetenv("QWS_MOUSE_PROTO").isEmpty()) { - server->setDefaultMouse("None"); + QWSServer::instance()->setDefaultMouse("None"); d_ptr->mouse = new QDirectFBMouseHandler; } #endif #ifndef QT_NO_DIRECTFB_KEYBOARD if (qgetenv("QWS_KEYBOARD").isEmpty()) { - server->setDefaultKeyboard("None"); + QWSServer::instance()->setDefaultKeyboard("None"); d_ptr->keyboard = new QDirectFBKeyboardHandler(QString()); } #endif @@ -1188,23 +1191,23 @@ void QDirectFBScreen::blit(IDirectFBSurface *src, const QPoint &topLeft, points.data(), n); } +// This function is only ever called by QScreen::drawBackground which +// is only ever called by QScreen::compose which is never called with +// DirectFB so it's really a noop. void QDirectFBScreen::solidFill(const QColor &color, const QRegion ®ion) { if (region.isEmpty()) return; if (QDirectFBScreen::getImageFormat(d_ptr->dfbSurface) == QImage::Format_RGB32) { - uchar *mem; - int bpl; - d_ptr->dfbSurface->Lock(d_ptr->dfbSurface, DSLF_WRITE, (void**)&mem, &bpl); - QImage img(mem, w, h, bpl, QImage::Format_RGB32); - QPainter p(&img); - p.setBrush(color); - p.setPen(Qt::NoPen); - const QVector<QRect> rects = region.rects(); - p.drawRects(rects.constData(), rects.size()); - p.end(); + data = QDirectFBScreen::lockSurface(d_ptr->dfbSurface, DSLF_WRITE, &lstep); + if (!data) + return; + + QScreen::solidFill(color, region); d_ptr->dfbSurface->Unlock(d_ptr->dfbSurface); + data = 0; + lstep = 0; } else { d_ptr->dfbSurface->SetColor(d_ptr->dfbSurface, color.red(), color.green(), color.blue(), @@ -1241,3 +1244,15 @@ bool QDirectFBScreen::initSurfaceDescriptionPixelFormat(DFBSurfaceDescription *d } return true; } + +uchar *QDirectFBScreen::lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFlags flags, int *bpl) +{ + void *mem; + const DFBResult result = surface->Lock(surface, flags, static_cast<void**>(&mem), bpl); + if (result != DFB_OK) { + DirectFBError("QDirectFBPixmapData::lockSurface()", result); + } + + return reinterpret_cast<uchar*>(mem); +} + diff --git a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h index f394ac1..8dd38dc 100644 --- a/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h +++ b/src/plugins/gfxdrivers/directfb/qdirectfbscreen.h @@ -127,6 +127,8 @@ public: const QImage &image); #endif + static uchar *lockSurface(IDirectFBSurface *surface, DFBSurfaceLockFlags flags, int *bpl = 0); + private: void compose(const QRegion &r); void blit(IDirectFBSurface *src, const QPoint &topLeft, |