From 2fedc24bde7c30db4beff025643373c6afcf8060 Mon Sep 17 00:00:00 2001 From: Alexey Shilov Date: Fri, 8 Apr 2011 15:54:46 +0300 Subject: [PATCH] Fixes: NB#238937 - minor splash-screen bugs RevBy: Jussi Lind --- debian/changelog | 1 + src/common/eventhandler.cpp | 9 ++--- src/common/eventhandler.h | 4 +-- src/ebooster/pluginfactory.cpp | 2 +- src/launcherlib/booster.cpp | 33 ++++++++++++++++--- src/launcherlib/booster.h | 12 +++++++ src/mbooster/mbooster.h | 2 +- src/mbooster/pluginfactory.cpp | 2 +- src/qdeclarativebooster/pluginfactory.cpp | 2 +- src/qdeclarativebooster/qdeclarativebooster.h | 2 +- src/qtbooster/pluginfactory.cpp | 2 +- 11 files changed, 54 insertions(+), 17 deletions(-) diff --git a/debian/changelog b/debian/changelog index da1de85..47236e1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,7 @@ applauncherd (0.27.0) unstable; urgency=low * Implemented: SWP#DUI-5199 * Fixes: NB#244103 - Device hangs on closing application in connecting view while configuring MFE account * Fixes: NB#243857 - Mismatched new[] - delete in applauncherd + * Fixes: NB#238937 - minor splash-screen bugs -- Olli Leppanen Fri, 08 Apr 2011 15:08:24 +0300 diff --git a/src/common/eventhandler.cpp b/src/common/eventhandler.cpp index 8057a7a..be2d1e7 100644 --- a/src/common/eventhandler.cpp +++ b/src/common/eventhandler.cpp @@ -1,12 +1,13 @@ +#include +#include +#include + +#include "coverage.h" #include "eventhandler.h" #include "connection.h" #include "logger.h" #include "booster.h" #include -#include -#include -#include -#include "coverage.h" int EventHandler::m_sighupFd[2]; struct sigaction EventHandler::m_oldSigAction; diff --git a/src/common/eventhandler.h b/src/common/eventhandler.h index a7d9fc2..9e3c00e 100644 --- a/src/common/eventhandler.h +++ b/src/common/eventhandler.h @@ -1,8 +1,8 @@ #include -#include +#include #include #include -#include +#include using std::tr1::shared_ptr; diff --git a/src/ebooster/pluginfactory.cpp b/src/ebooster/pluginfactory.cpp index e3d96fb..43abfb0 100644 --- a/src/ebooster/pluginfactory.cpp +++ b/src/ebooster/pluginfactory.cpp @@ -17,8 +17,8 @@ ** ****************************************************************************/ -#include "ebooster.h" #include +#include "ebooster.h" extern "C" { diff --git a/src/launcherlib/booster.cpp b/src/launcherlib/booster.cpp index 6c3c8c7..7db3c3e 100644 --- a/src/launcherlib/booster.cpp +++ b/src/launcherlib/booster.cpp @@ -35,9 +35,11 @@ #include #include +#ifdef Q_WS_X11 #include #include #include +#endif //Q_WS_X11 #include #include @@ -338,10 +340,15 @@ void Booster::requestSplash(const int pid, const std::string &wmclass, const std::string &portraitSplash, const std::string &landscapeSplash, const std::string &pixmapId) { +#ifdef Q_WS_X11 + std::stringstream st; st << pid; std::string pidStr = st.str(); + // set error handler for all Xlib calls + XErrorHandler oldHandler = XSetErrorHandler(Booster::handleXError); + Display * dpy = XOpenDisplay(NULL); if (dpy) { @@ -383,19 +390,35 @@ void Booster::requestSplash(const int pid, const std::string &wmclass, Window compositorWindow = *reinterpret_cast(prop); const char* splashProperty = "_MEEGO_SPLASH_SCREEN"; Atom splashPropertyAtom = XInternAtom(dpy, splashProperty, False); - Atom stringAtom = XInternAtom(dpy, "STRING", False); - - XChangeProperty(dpy, compositorWindow, splashPropertyAtom, stringAtom, - 8, PropModeReplace, (unsigned char *)data, - len); + + XChangeProperty(dpy, compositorWindow, splashPropertyAtom, XA_STRING, + 8, PropModeReplace, (unsigned char*) data, len); // Without flushing, the change seems to loiter in X's queue XFlush(dpy); delete[] data; XFree(prop); } + // close connection to X server + XCloseDisplay(dpy); + XSetErrorHandler(oldHandler); } +#else //Q_WS_X11 + // prevent compilation warnings + (void) pid; + (void) wmclass; + (void) portraitSplash; + (void) landscapeSplash; + (void) pixmapId; +#endif //Q_WS_X11 +} + +#ifdef Q_WS_X11 +int Booster::handleXError(Display *, XErrorEvent *) +{ + return 0; } +#endif //Q_WS_X11 void Booster::setEnvironmentBeforeLaunch() { diff --git a/src/launcherlib/booster.h b/src/launcherlib/booster.h index 5d99cb1..5bbc56d 100644 --- a/src/launcherlib/booster.h +++ b/src/launcherlib/booster.h @@ -20,6 +20,8 @@ #ifndef BOOSTER_H #define BOOSTER_H +#include + #include #include @@ -27,6 +29,10 @@ using std::string; #include "appdata.h" +#ifdef Q_WS_X11 +#include +#endif //Q_WS_X11 + class Connection; class SocketManager; class SingleInstance; @@ -145,6 +151,12 @@ public: //! Return true, if in boot mode. bool bootMode() const; +#ifdef Q_WS_X11 + //! Error handler for Xlib calls + static int handleXError(Display *display, XErrorEvent *event); +#endif + + protected: /*! diff --git a/src/mbooster/mbooster.h b/src/mbooster/mbooster.h index 17ff611..072d7c3 100644 --- a/src/mbooster/mbooster.h +++ b/src/mbooster/mbooster.h @@ -20,8 +20,8 @@ #ifndef MBOOSTER_H #define MBOOSTER_H -#include "booster.h" #include "eventhandler.h" +#include "booster.h" #include diff --git a/src/mbooster/pluginfactory.cpp b/src/mbooster/pluginfactory.cpp index 06b65c3..e8ad388 100644 --- a/src/mbooster/pluginfactory.cpp +++ b/src/mbooster/pluginfactory.cpp @@ -17,8 +17,8 @@ ** ****************************************************************************/ -#include "mbooster.h" #include +#include "mbooster.h" extern "C" { diff --git a/src/qdeclarativebooster/pluginfactory.cpp b/src/qdeclarativebooster/pluginfactory.cpp index a0eab30..f7b2407 100644 --- a/src/qdeclarativebooster/pluginfactory.cpp +++ b/src/qdeclarativebooster/pluginfactory.cpp @@ -17,8 +17,8 @@ ** ****************************************************************************/ -#include "qdeclarativebooster.h" #include +#include "qdeclarativebooster.h" extern "C" { diff --git a/src/qdeclarativebooster/qdeclarativebooster.h b/src/qdeclarativebooster/qdeclarativebooster.h index af57362..36b9ce2 100644 --- a/src/qdeclarativebooster/qdeclarativebooster.h +++ b/src/qdeclarativebooster/qdeclarativebooster.h @@ -20,8 +20,8 @@ #ifndef QDECLARATIVEBOOSTER_H #define QDECLARATIVEBOOSTER_H -#include "booster.h" #include "eventhandler.h" +#include "booster.h" /*! * \class QDeclarativeBooster. diff --git a/src/qtbooster/pluginfactory.cpp b/src/qtbooster/pluginfactory.cpp index 702e672..b89ca48 100644 --- a/src/qtbooster/pluginfactory.cpp +++ b/src/qtbooster/pluginfactory.cpp @@ -17,8 +17,8 @@ ** ****************************************************************************/ -#include "qtbooster.h" #include +#include "qtbooster.h" extern "C" {