I have made the following changes intended for : CE:UX:MTF / lipstick Please review and accept or decline. BOSS has already run some checks on this request. See the "Messages from BOSS" section below.
https://build.pub.meego.com//request/show/7409 Thank You, Robin Burchell [This message was auto-generated] --- Request # 7409: Messages from BOSS: State: review at 2012-11-17T23:10:37 by bossbot Reviews: accepted by bossbot : Prechecks succeeded. new for CE-maintainers : Please replace this text with a review and approve/reject the review (not the SR). BOSS will take care of the rest Changes: submit: home:w00t:branches:CE:UX:MTF / lipstick -> CE:UX:MTF / lipstick changes files: -------------- --- lipstick.changes +++ lipstick.changes @@ -0,0 +1,4 @@ +* Thu Nov 15 2012 Robin Burchell <[email protected]> - 0.5.0 +- Allow for suspending SwitcherPixmapItem updates (SwitcherPixmapItem::enabled property) (from Robin) +- Simplify (and fix) X pixmap refresh, fixes stale pixmaps under some strange conditions (from Robin) + old: ---- lipstick-0.4.12.tar.gz new: ---- lipstick-0.5.0.tar.bz2 spec files: ----------- --- lipstick.spec +++ lipstick.spec @@ -9,12 +9,12 @@ # << macros Summary: QML toolkit for homescreen creation -Version: 0.4.12 +Version: 0.5.0 Release: 1 Group: System/Libraries License: LGPLv2.1 URL: http://github.com/nemomobile/lipstick -Source0: %{name}-%{version}.tar.gz +Source0: %{name}-%{version}.tar.bz2 Source100: lipstick.yaml Requires(post): /sbin/ldconfig Requires(postun): /sbin/ldconfig @@ -62,7 +62,7 @@ %prep -%setup -q -n %{name}-%{version} +%setup -q -n %{name} # >> setup # << setup other changes: -------------- ++++++ lipstick-0.4.12.tar.gz -> lipstick-0.5.0.tar.bz2 --- src/components/switcherpixmapitem.cpp +++ src/components/switcherpixmapitem.cpp @@ -62,6 +62,7 @@ Pixmap xWindowPixmap; Damage xWindowPixmapDamage; QPixmap qWindowPixmap; + QPixmap staticWindowSnapshot; WId windowId; int radius; }; @@ -73,6 +74,7 @@ setFlag(QGraphicsItem::ItemHasNoContents, false); connect(qApp, SIGNAL(damageEvent(Qt::HANDLE &, short &, short &, unsigned short &, unsigned short &)), this, SLOT(damageEvent(Qt::HANDLE &, short &, short &, unsigned short &, unsigned short &))); connect(HomeWindowMonitor::instance(), SIGNAL(isHomeWindowOnTopChanged()), this, SLOT(toggleDamage())); + connect(this, SIGNAL(enabledChanged()), this, SLOT(onEnabledChanged())); } SwitcherPixmapItem::~SwitcherPixmapItem() @@ -85,14 +87,7 @@ void SwitcherPixmapItem::toggleDamage() { - if (HomeWindowMonitor::instance()->isHomeWindowOnTop()) { - SWITCHER_DEBUG() << Q_FUNC_INFO << "Creating damage for " << d->windowId; - createDamage(); - update(); - } else { - SWITCHER_DEBUG() << Q_FUNC_INFO << "Destroying damage for " << d->windowId; - destroyDamage(); - } + updateXWindowPixmap(); } void SwitcherPixmapItem::damageEvent(Qt::HANDLE &damage, short &x, short &y, unsigned short &width, unsigned short &height) @@ -119,14 +114,25 @@ } } -void SwitcherPixmapItem::createDamage() +void SwitcherPixmapItem::onEnabledChanged() { - // TODO: check on display status, don't create damage if off - if (d->windowId == 0) - return; + if (!isEnabled()) { + if (!d->xWindowPixmapIsValid) { + qWarning() << Q_FUNC_INFO << "Pixmap for window " << d->windowId << " is not valid, and enabled changed to " << isEnabled(); + return; + } + + // deep copy the window pixmap + SWITCHER_DEBUG() << Q_FUNC_INFO << "Detaching window pixmap for " << d->windowId; + d->staticWindowSnapshot = QPixmap::fromImage(d->qWindowPixmap.toImage()); + } else { + // restore the original shallow copy + SWITCHER_DEBUG() << Q_FUNC_INFO << "Attaching window pixmap for " << d->windowId; + d->staticWindowSnapshot = QPixmap(); + updateXWindowPixmap(); + } - // Register the pixmap for XDamage events - d->xWindowPixmapDamage = XDamageCreate(QX11Info::display(), d->windowId, XDamageReportNonEmpty); + update(); } void SwitcherPixmapItem::updateXWindowPixmap() @@ -161,8 +167,7 @@ d->xWindowPixmap = newWindowPixmap; // Register the pixmap for XDamage events - if (HomeWindowMonitor::instance()->isHomeWindowOnTop()) - createDamage(); + d->xWindowPixmapDamage = XDamageCreate(QX11Info::display(), d->windowId, XDamageReportNonEmpty); d->qWindowPixmap = QPixmap::fromX11Pixmap(d->xWindowPixmap, QPixmap::ExplicitlyShared); } else { @@ -224,7 +229,11 @@ painter->setRenderHint(QPainter::SmoothPixmapTransform); QT_TRY { - QBrush brush(d->qWindowPixmap); + QBrush brush; + if (!d->staticWindowSnapshot.isNull()) + brush.setTexture(d->staticWindowSnapshot); + else + brush.setTexture(d->qWindowPixmap); // TODO: take clipping of statusbar (if any) into account here qreal scale; @@ -249,32 +258,3 @@ painter->setBrush(oldBrush); } -bool SwitcherPixmapItem::handleXEvent(const XEvent &event) -{ - WId windowId; - - if (event.type == VisibilityNotify) { - if (event.xvisibility.state != VisibilityFullyObscured || - event.xvisibility.send_event != True) { - SWITCHER_DEBUG() << Q_FUNC_INFO << "Ignoring VisibilityNotify that isn't a send_event VisibilityFullyObscured for " << event.xvisibility.window; - return false; - } - - windowId = event.xvisibility.window; - SWITCHER_DEBUG() << Q_FUNC_INFO << "Got obscured for " << windowId << "; want " << d->windowId; - } else if (event.type == ConfigureNotify) { - windowId = event.xconfigure.window; - SWITCHER_DEBUG() << Q_FUNC_INFO << "ConfigureNotify for " << windowId << "; want " << d->windowId; - } else { - return false; - } - - if (windowId != d->windowId) - return false; - - SWITCHER_DEBUG() << Q_FUNC_INFO << "Invalidated, resetting pixmap for " << d->windowId; - d->xWindowPixmapIsValid = false; - update(); - return true; -} - --- src/components/switcherpixmapitem.h +++ src/components/switcherpixmapitem.h @@ -24,7 +24,7 @@ #include "lipstickglobal.h" #include "xtools/xeventlistener.h" -class LIPSTICK_EXPORT SwitcherPixmapItem : public QDeclarativeItem, XEventListener +class LIPSTICK_EXPORT SwitcherPixmapItem : public QDeclarativeItem { Q_OBJECT Q_DISABLE_COPY(SwitcherPixmapItem) @@ -32,7 +32,6 @@ struct Private; Private * const d; - void createDamage(); void destroyDamage(); void updateXWindowPixmap(); @@ -61,9 +60,7 @@ private slots: void damageEvent(Qt::HANDLE &damage, short &x, short &y, unsigned short &width, unsigned short &height); void toggleDamage(); - -private: - virtual bool handleXEvent(const XEvent &event); + void onEnabledChanged(); }; #endif // SWITCHERPIXMAPITEM_H --- src/src.pro +++ src/src.pro @@ -2,7 +2,7 @@ TEMPLATE = lib TARGET = lipstick -VERSION = 0.4.11 +VERSION = 0.5.0 DEFINES += LIPSTICK_BUILD_LIBRARY VERSION=\\\"$$VERSION\\\" ++++++ lipstick.yaml --- lipstick.yaml +++ lipstick.yaml @@ -1,12 +1,12 @@ Name: lipstick Summary: QML toolkit for homescreen creation -Version: 0.4.12 +Version: 0.5.0 Release: 1 Group: System/Libraries License: LGPLv2.1 URL: http://github.com/nemomobile/lipstick Sources: - - "%{name}-%{version}.tar.gz" + - "%{name}-%{version}.tar.bz2" Description: A QML toolkit for homescreen creation Builder: qmake PkgConfigBR:
