diff options
-rw-r--r-- | debian/changelog | 7 | ||||
-rw-r--r-- | meegotouch_config.pri | 2 | ||||
-rw-r--r-- | src/mcompatoms_p.h | 19 | ||||
-rw-r--r-- | src/mcompositemanager.cpp | 97 | ||||
-rw-r--r-- | src/mcompositemanager.h | 19 | ||||
-rw-r--r-- | src/mcompositewindow.cpp | 5 | ||||
-rw-r--r-- | src/mcompositewindowshadereffect.cpp | 15 | ||||
-rw-r--r-- | src/mcompositewindowshadereffect.h | 1 | ||||
-rw-r--r-- | src/mdecoratorframe.h | 1 | ||||
-rw-r--r-- | src/mtexturepixmapitem_p.cpp | 25 | ||||
-rw-r--r-- | src/mtexturepixmapitem_p.h | 1 | ||||
-rw-r--r-- | tests/functional/createTestXml | 7 | ||||
-rw-r--r-- | tests/functional/test20.py.testdata | 1 |
13 files changed, 162 insertions, 38 deletions
diff --git a/debian/changelog b/debian/changelog index 86be95e..ae9d68c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,9 @@ -mcompositor (0.7.7~1) unstable; urgency=low +mcompositor (0.7.7-1) unstable; urgency=low - * unreleased + * Fixes: NB#196487 - display doesn't become dimmed + * Various optimizations and fixes - -- Kimmo Hämäläinen <kihamala@mylly> Fri, 22 Oct 2010 10:35:41 +0300 + -- Abdiel Janulgue <abj@codefuassasin.research.nokia.com> Thu, 28 Oct 2010 00:31:43 +0300 mcompositor (0.7.6-1) unstable; urgency=low diff --git a/meegotouch_config.pri b/meegotouch_config.pri index 0911111..eead51b 100644 --- a/meegotouch_config.pri +++ b/meegotouch_config.pri @@ -34,4 +34,4 @@ contains(QT_CONFIG, opengles2) { } # Compositor components only -VERSION = 0.7.6 +VERSION = 0.7.7 diff --git a/src/mcompatoms_p.h b/src/mcompatoms_p.h index 07b3803..63379d5 100644 --- a/src/mcompatoms_p.h +++ b/src/mcompatoms_p.h @@ -42,6 +42,7 @@ public: }; enum Atoms { + // The following atoms are added to the _NET_SUPPORTED list. // window manager WM_PROTOCOLS, WM_DELETE_WINDOW, @@ -71,6 +72,7 @@ public: _NET_WM_WINDOW_OPACITY, _NET_WM_STATE, _NET_WM_ICON_GEOMETRY, + _NET_WM_USER_TIME_WINDOW, WM_STATE, // misc @@ -96,13 +98,6 @@ public: _MEEGOTOUCH_DESKTOP_VIEW, _MEEGOTOUCH_CANNOT_MINIMIZE, - /* RROutput properties */ - RROUTPUT_CTYPE, - RROUTPUT_PANEL, - RROUTPUT_ALPHA_MODE, - RROUTPUT_GRAPHICS_ALPHA, - RROUTPUT_VIDEO_ALPHA, - #ifdef WINDOW_DEBUG _M_WM_INFO, _M_WM_WINDOW_ZVALUE, @@ -112,6 +107,16 @@ public: _M_WM_WINDOW_DIRECT_INVISIBLE, #endif + // The rest of the atoms are not added to _NET_SUPPORTED. + END_OF_NET_SUPPORTED, + + // RROutput properties + RROUTPUT_CTYPE = END_OF_NET_SUPPORTED, + RROUTPUT_PANEL, + RROUTPUT_ALPHA_MODE, + RROUTPUT_GRAPHICS_ALPHA, + RROUTPUT_VIDEO_ALPHA, + ATOMS_TOTAL }; static MCompAtoms *instance(); diff --git a/src/mcompositemanager.cpp b/src/mcompositemanager.cpp index d46d6e8..0f40c87 100644 --- a/src/mcompositemanager.cpp +++ b/src/mcompositemanager.cpp @@ -134,6 +134,7 @@ MCompAtoms::MCompAtoms() "_NET_WM_WINDOW_OPACITY", "_NET_WM_STATE", "_NET_WM_ICON_GEOMETRY", + "_NET_WM_USER_TIME_WINDOW", "WM_STATE", // misc @@ -159,13 +160,6 @@ MCompAtoms::MCompAtoms() "_MEEGOTOUCH_DESKTOP_VIEW", "_MEEGOTOUCH_CANNOT_MINIMIZE", - /* RROutput properties */ - RR_PROPERTY_CONNECTOR_TYPE, - "Panel", - "AlphaMode", - "GraphicsAlpha", - "VideoAlpha", - #ifdef WINDOW_DEBUG // custom properties for CITA "_M_WM_INFO", @@ -175,6 +169,14 @@ MCompAtoms::MCompAtoms() "_M_WM_WINDOW_DIRECT_VISIBLE", "_M_WM_WINDOW_DIRECT_INVISIBLE", #endif + + // Add atoms you don't want to be in rootWindow::_NET_SUPPORTED below. + // RROutput properties + RR_PROPERTY_CONNECTOR_TYPE, + "Panel", + "AlphaMode", + "GraphicsAlpha", + "VideoAlpha", }; Q_ASSERT((sizeof(atom_names) / sizeof(atom_names[0])) == ATOMS_TOTAL); @@ -186,7 +188,7 @@ MCompAtoms::MCompAtoms() XChangeProperty(dpy, QX11Info::appRootWindow(), atoms[_NET_SUPPORTED], XA_ATOM, 32, PropModeReplace, (unsigned char *)atoms, - ATOMS_TOTAL); + END_OF_NET_SUPPORTED); } MCompAtoms::Type MCompAtoms::windowType(Window w) @@ -1994,10 +1996,10 @@ void MCompositeManagerPrivate::checkStacking(bool force_visibility_check, no_decors.size()); prev_only_mapped = QList<Window>(only_mapped); - checkInputFocus(timestamp); if (!device_state->displayOff()) pingTopmost(); } + checkInputFocus(timestamp); // WM_HINTS can change even if the order didn't if (order_changed || force_visibility_check) { static int xres = ScreenOfDisplay(QX11Info::display(), DefaultScreen(QX11Info::display()))->width; @@ -2383,7 +2385,6 @@ void MCompositeManagerPrivate::clientMessageEvent(XClientMessageEvent *event) bool needComp = false; if (i->isDirectRendered() || d_item->isDirectRendered()) { d_item->setVisible(true); - enableCompositing(true); needComp = true; } @@ -2421,6 +2422,8 @@ void MCompositeManagerPrivate::clientMessageEvent(XClientMessageEvent *event) // that have selective compositing. This is triggered // when windows are rendered off-screen i->iconify(i->propertyCache()->iconGeometry(), needComp); + if (needComp) + enableCompositing(true); if (i->needDecoration()) i->startTransition(); i->stopPing(); @@ -3198,6 +3201,11 @@ void MCompositeManager::positionWindow(Window w, d->positionWindow(w, pos == MCompositeManager::STACK_TOP ? true : false); } +const QRect &MCompositeManager::decoratorRect() const +{ + return MDecoratorFrame::instance()->decoratorRect(); +} + const QList<Window> &MCompositeManager::stackingList() const { return d->stacking_list; @@ -3404,7 +3412,7 @@ void MCompositeManager::dumpState(const char *heading) qDebug("%s: ", heading); qDebug( "display: %s", - d->device_state->displayOff() ? "on" : "off"); + d->device_state->displayOff() ? "off" : "on"); qDebug( "call state: %s", d->device_state->ongoingCall() ? "ongoing" : "idle"); @@ -3502,7 +3510,7 @@ void MCompositeManager::dumpState(const char *heading) XFree(cls.res_class); } - qDebug(" ptr %p == xwin 0x%lx%s: %s", *cwit, cwit.key(), + qDebug(" ptr %p == xwin 0x%lx%s: %s", cw, cw->window(), cw->isValid() ? "" : " (not valid anymore)", name); qDebug(" mapped: %s, newly mapped: %s", yn[cw->isMapped()], yn[cw->isNewlyMapped()]); @@ -3614,7 +3622,7 @@ void MCompositeManager::dumpState(const char *heading) const QRectF &r = gi->boundingRect(); const MCompositeWindow *cw = dynamic_cast<const MCompositeWindow *>(gi); - qDebug(" %p: %dx%d%+d%+d %s", cw ? cw : gi, + qDebug(" %p: %dx%d%+d%+d %s", cw ? (void *)cw : (void *)gi, (int)r.width(), (int)r.height(), (int)r.x(), (int)r.y(), gi->isVisible() ? "visible" : "hidden"); } @@ -3705,16 +3713,64 @@ void MCompositeManager::remoteControl(int cmdfd) } else qDebug("%s: unknown command", cmd); } + +void MCompositeManager::xtrace(const char *fun, const char *msg, int lmsg) +{ + MCompositeManager *p = static_cast<MCompositeManager *>(qApp); + char str[160]; + + // Normalize @fun and @msg so that @msg != NULL in the end, + // and turn synopsis [2] into MCompositor::xtrace(NULL, msg). + if (!msg) { + if (fun) { + msg = fun; + fun = NULL; + } else { + msg = "HERE"; + lmsg = strlen("HERE"); + } + } + + // Fail if we don't have an X connection yet. + if (!p || !p->d || !p->d->xcb_conn) { + qWarning("cannot xtrace yet from %s", fun ? fun : msg); + return; + } + + // Format @str to include both @fun and @msg if @fun was specified, + // and count the length of @str. + if (fun != NULL) { + lmsg = snprintf(str, sizeof(str), "%s from %s", msg, fun); + msg = str; + } else if (lmsg < 0) + lmsg = strlen(msg); + + // Make @str visible in xtrace by sending it along with an innocent + // X request. Unfortunately this makes this function a synchronisation + // point (it has to wait for the reply). Use xcb rather than libx11 + // because the latter maintains a hashtable of known Atom:s. + xcb_intern_atom_reply(p->d->xcb_conn, + xcb_intern_atom(p->d->xcb_conn, False, lmsg, msg), + NULL); +} + +void MCompositeManager::xtracef(const char *fun, const char *fmt, ...) +{ + va_list printf_args; + char msg[160]; + int lmsg; + + va_start(printf_args, fmt); + lmsg = vsnprintf(msg, sizeof(msg), fmt, printf_args); + va_end(printf_args); + xtrace(fun, msg, lmsg); +} #endif // WINDOW_DEBUG MCompositeManager::MCompositeManager(int &argc, char **argv) : QApplication(argc, argv) { signal(SIGUSR1, sigusr1_handler); - if (QX11Info::isCompositingManagerRunning()) { - qCritical("Compositing manager already running."); - ::exit(0); - } d = new MCompositeManagerPrivate(this); MRmiServer *s = new MRmiServer(".mcompositor", this); @@ -3755,7 +3811,12 @@ QGraphicsScene *MCompositeManager::scene() } void MCompositeManager::prepareEvents() -{ +{ + if (QX11Info::isCompositingManagerRunning()) { + qCritical("Compositing manager already running."); + ::exit(0); + } + d->prepare(); } diff --git a/src/mcompositemanager.h b/src/mcompositemanager.h index 5d02f1a..748f104 100644 --- a/src/mcompositemanager.h +++ b/src/mcompositemanager.h @@ -139,6 +139,20 @@ public: // to qDebug(). Only available if compiled with TESTABILITY=on // (-DWINDOW_DEBUG). void dumpState(const char *heading = 0); + + // "Print" @msg in xtrace, to show you where your program's control was + // between the various X requests, responses and events. + // Synopsis: + // [1] MCompositeManager::xtrace(); + // [2] MCompositeManager::xtrace("HEI"); + // [3] MCompositeManager::xtrace(__PRETTY_FUNCTION__, "HEI"); + // + // xtracef() is the same, except that it sends a formatted message. + // You can leave @fun NULL if you want. + static void xtrace (const char *fun = NULL, const char *msg = NULL, + int lmsg = -1); + static void xtracef(const char *fun, const char *fmt, ...) + __attribute__((format(printf, 2, 3))); #endif public slots: @@ -158,6 +172,11 @@ public slots: */ void exposeSwitcher(); + /*! + * Area the decorator occupies. + */ + const QRect &decoratorRect() const; + #ifdef WINDOW_DEBUG void remoteControl(int fd); #endif diff --git a/src/mcompositewindow.cpp b/src/mcompositewindow.cpp index e04ffc8..06f21ba 100644 --- a/src/mcompositewindow.cpp +++ b/src/mcompositewindow.cpp @@ -208,7 +208,8 @@ void MCompositeWindow::setUntransformed() { endAnimation(); - anim->stopAnimation(); // stop and restore the matrix + if (anim) + anim->stopAnimation(); // stop and restore the matrix newly_mapped = false; setVisible(true); setOpacity(1.0); @@ -479,7 +480,7 @@ void MCompositeWindow::requestZValue(int zvalue) { // when animating, Z-value is set again after finishing the animation // (setting it later in finalizeState() caused flickering) - if (!anim->isActive() && !anim->pendingAnimation()) + if (anim && !anim->isActive() && !anim->pendingAnimation()) setZValue(zvalue); } diff --git a/src/mcompositewindowshadereffect.cpp b/src/mcompositewindowshadereffect.cpp index bad88b6..d52f1cd 100644 --- a/src/mcompositewindowshadereffect.cpp +++ b/src/mcompositewindowshadereffect.cpp @@ -183,6 +183,21 @@ void MCompositeWindowShaderEffect::installEffect(MCompositeWindow* window) } /*! + Remove this effect from a composite window object \a window. After removing + the effect the window will use default shaders. +*/ +void MCompositeWindowShaderEffect::removeEffect(MCompositeWindow* window) +{ + if (!window->isValid()) + return; + +#ifdef QT_OPENGL_LIB + MTexturePixmapItem* item = (MTexturePixmapItem*) window; + item->d->installEffect(0); +#endif +} + +/*! \return Whether this effect is enabled or not */ bool MCompositeWindowShaderEffect::enabled() const diff --git a/src/mcompositewindowshadereffect.h b/src/mcompositewindowshadereffect.h index a7ae9b8..902cbe8 100644 --- a/src/mcompositewindowshadereffect.h +++ b/src/mcompositewindowshadereffect.h @@ -44,6 +44,7 @@ class MCompositeWindowShaderEffect: public QObject GLuint activeShaderFragment() const; void installEffect(MCompositeWindow* window); + void removeEffect(MCompositeWindow* window); bool enabled() const; public slots: diff --git a/src/mdecoratorframe.h b/src/mdecoratorframe.h index 411be28..afb26e3 100644 --- a/src/mdecoratorframe.h +++ b/src/mdecoratorframe.h @@ -92,6 +92,7 @@ public: void setDecoratorItem(MCompositeWindow *window); MCompositeWindow *decoratorItem() const; + const QRect &decoratorRect() const { return decorator_rect; } public slots: void setDecoratorAvailableRect(const QRect& r); diff --git a/src/mtexturepixmapitem_p.cpp b/src/mtexturepixmapitem_p.cpp index 828ab7f..65ff92e 100644 --- a/src/mtexturepixmapitem_p.cpp +++ b/src/mtexturepixmapitem_p.cpp @@ -324,18 +324,30 @@ void MTexturePixmapPrivate::q_drawTexture(const QTransform &transform, const QRe void MTexturePixmapPrivate::installEffect(MCompositeWindowShaderEffect* effect) { - if (current_effect == effect) + if (effect == prev_effect) return; - + + if (prev_effect) { + disconnect(prev_effect, SIGNAL(enabledChanged(bool)), this, + SLOT(activateEffect(bool))); + disconnect(prev_effect, SIGNAL(destroyed()), this, + SLOT(removeEffect())); + } current_effect = effect; - connect(effect, SIGNAL(enabledChanged(bool)), SLOT( activateEffect(bool))); - connect(effect, SIGNAL(destroyed()), SLOT(removeEffect())); + prev_effect = effect; + if (effect) { + connect(effect, SIGNAL(enabledChanged(bool)), + SLOT(activateEffect(bool)), Qt::UniqueConnection); + connect(effect, SIGNAL(destroyed()), SLOT(removeEffect()), + Qt::UniqueConnection); + } } void MTexturePixmapPrivate::removeEffect() { MCompositeWindowShaderEffect* e= (MCompositeWindowShaderEffect* ) sender(); - + if (e == prev_effect) + prev_effect = 0; for (int i=0; i < e->fragmentIds().size(); ++i) { GLuint id = e->fragmentIds()[i]; QGLShaderProgram* frag = glresource->customShaders.value(i,0); @@ -399,7 +411,8 @@ MTexturePixmapPrivate::MTexturePixmapPrivate(Qt::HANDLE window, custom_tfp(false), direct_fb_render(false), angle(0), - item(p) + item(p), + prev_effect(0) { if (!glwidget) { MCompositeManager *m = (MCompositeManager*)qApp; diff --git a/src/mtexturepixmapitem_p.h b/src/mtexturepixmapitem_p.h index af83966..c351b00 100644 --- a/src/mtexturepixmapitem_p.h +++ b/src/mtexturepixmapitem_p.h @@ -87,6 +87,7 @@ public: MTexturePixmapItem *item; QPointer<MCompositeWindowShaderEffect> current_effect; + const MCompositeWindowShaderEffect *prev_effect; #ifdef GLES2_VERSION static EglResourceManager *eglresource; diff --git a/tests/functional/createTestXml b/tests/functional/createTestXml index e54e6e2..e229324 100644 --- a/tests/functional/createTestXml +++ b/tests/functional/createTestXml @@ -60,7 +60,12 @@ for CASEFILE in $*; do BNAME=${CASEFILE}.testdata if [ -e $BNAME ]; then . ./$BNAME - TESTCASE_TEMPLATE="\t\t\t<case name=\"$CaseName\" description=\"$CaseDescription\" requirement=\"$CaseRequirement\" timeout=\"$CaseTimeout\">\n\t\t\t\t<step expected_result=\"0\">$INSTALL_PATH/$CASEFILE</step>\n\t\t\t</case>\n" + if [ x$CaseInsignificant != x ]; then + TESTCASE_TEMPLATE="\t\t\t<case name=\"$CaseName\" description=\"$CaseDescription\" requirement=\"$CaseRequirement\" timeout=\"$CaseTimeout\" insignificant=\"$CaseInsignificant\">\n\t\t\t\t<step expected_result=\"0\">$INSTALL_PATH/$CASEFILE</step>\n\t\t\t</case>\n" + else + TESTCASE_TEMPLATE="\t\t\t<case name=\"$CaseName\" description=\"$CaseDescription\" requirement=\"$CaseRequirement\" timeout=\"$CaseTimeout\">\n\t\t\t\t<step expected_result=\"0\">$INSTALL_PATH/$CASEFILE</step>\n\t\t\t</case>\n" + fi + unset CaseInsignificant TESTCASES="${TESTCASES}${TESTCASE_TEMPLATE}" fi done diff --git a/tests/functional/test20.py.testdata b/tests/functional/test20.py.testdata index 5455d03..2077421 100644 --- a/tests/functional/test20.py.testdata +++ b/tests/functional/test20.py.testdata @@ -1,6 +1,7 @@ CaseName="jammed_and_fullscreen_app_during_call_are_decorated" CaseRequirement="NONE" CaseTimeout="360" +CaseInsignificant=true CaseDescription="Check that jammed and (during call) fullscreen apps are decorated.\n \n - Test steps\n |