diff --git a/debian/changelog b/debian/changelog index 9b59fc9..bb3790c 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,7 @@ -applauncherd (1.0.10) unstable; urgency=low +applauncherd (1.1.0) unstable; urgency=low * Changes: Add unit test for Logger - open log twice + * Fixes: NB#269075 - Precached (LibMeegotouch) applications do not set WM_CLASS window atom properly -- Dmitry Rozenshtein Mon, 5 Sep 2011 13:33:55 +0300 diff --git a/src/launcherlib/booster.cpp b/src/launcherlib/booster.cpp index 8a64654..245f0fe 100644 --- a/src/launcherlib/booster.cpp +++ b/src/launcherlib/booster.cpp @@ -530,6 +530,10 @@ int Booster::launchProcess() // Load the application and find out the address of main() void* handle = loadMain(); + // make booster specific initializations unless booster is in boot mode + if (!m_bootMode) + preinit(); + #ifdef WITH_COVERAGE __gcov_flush(); #endif diff --git a/src/launcherlib/booster.h b/src/launcherlib/booster.h index 5bbc56d..3a447c9 100644 --- a/src/launcherlib/booster.h +++ b/src/launcherlib/booster.h @@ -207,6 +207,14 @@ protected: const string &portraitSplash, const string &landscapeSplash, const string &pixmapId); + + /*! This method is called just before call boosted application's + * main function. Empty by default but some booster specific + * initializations can be done here. + * Re-implement if needed. + */ + virtual void preinit() {}; + //! Set nice value and store the old priority. Return true on success. bool pushPriority(int nice); @@ -223,6 +231,9 @@ protected: //! Reset out-of-memory killer adjustment void resetOomAdj(); + //! Data structure representing the application to be invoked + AppData* m_appData; + private: //! Disable copy-constructor @@ -238,9 +249,6 @@ private: //! Helper method: load the library and find out address for "main". void* loadMain(); - //! Data structure representing the application to be invoked - AppData* m_appData; - //! Socket connection to invoker Connection* m_connection; diff --git a/src/mbooster/mbooster.cpp b/src/mbooster/mbooster.cpp index 2c538b3..a126385 100644 --- a/src/mbooster/mbooster.cpp +++ b/src/mbooster/mbooster.cpp @@ -104,3 +104,17 @@ bool MBooster::receiveDataFromInvoker(int socketFd) } } +void MBooster::preinit() +{ + QString appName = QFileInfo(m_appData->argv()[0]).fileName(); + + QString appClass = appName.left(1).toUpper(); + if (appName.length() > 1) + appClass += appName.right(appName.length() - 1); + + char* app_name = qstrdup(appName.toLatin1().data()); + QApplication::setAppName(app_name); + + char* app_class = qstrdup(appClass.toLatin1().data()); + QApplication::setAppClass(app_class); +} diff --git a/src/mbooster/mbooster.h b/src/mbooster/mbooster.h index 072d7c3..35f6148 100644 --- a/src/mbooster/mbooster.h +++ b/src/mbooster/mbooster.h @@ -20,6 +20,9 @@ #ifndef MBOOSTER_H #define MBOOSTER_H +#include +#include "QFileInfo" + #include "eventhandler.h" #include "booster.h" @@ -77,6 +80,9 @@ protected: //! \reimp virtual bool receiveDataFromInvoker(int socketFd); + //! \reimp + virtual void preinit(); + private: //! Disable copy-constructor diff --git a/src/qdeclarativebooster/mdeclarativecache.cpp b/src/qdeclarativebooster/mdeclarativecache.cpp index 053744e..0b06b76 100644 --- a/src/qdeclarativebooster/mdeclarativecache.cpp +++ b/src/qdeclarativebooster/mdeclarativecache.cpp @@ -129,16 +129,6 @@ QApplication* MDeclarativeCachePrivate::qApplication(int &argc, char **argv) if (loadTestabilityEnv || loadTestabilityArg) testabilityInit(); - QString appClass = appName.left(1).toUpper(); - if (appName.length() > 1) - appClass += appName.right(appName.length() - 1); - - char* app_name = qstrdup(appName.toLatin1().data()); - QApplication::setAppName(app_name); - - char* app_class = qstrdup(appClass.toLatin1().data()); - QApplication::setAppClass(app_class); - #ifdef Q_WS_X11 // reinit WM_COMMAND X11 property if (qDeclarativeViewInstance) diff --git a/src/qdeclarativebooster/qdeclarativebooster.cpp b/src/qdeclarativebooster/qdeclarativebooster.cpp index f3a6647..f799553 100644 --- a/src/qdeclarativebooster/qdeclarativebooster.cpp +++ b/src/qdeclarativebooster/qdeclarativebooster.cpp @@ -94,3 +94,19 @@ bool QDeclarativeBooster::receiveDataFromInvoker(int socketFd) return true; } } + + +void QDeclarativeBooster::preinit() +{ + QString appName = QFileInfo(m_appData->argv()[0]).fileName(); + + QString appClass = appName.left(1).toUpper(); + if (appName.length() > 1) + appClass += appName.right(appName.length() - 1); + + char* app_name = qstrdup(appName.toLatin1().data()); + QApplication::setAppName(app_name); + + char* app_class = qstrdup(appClass.toLatin1().data()); + QApplication::setAppClass(app_class); +} diff --git a/src/qdeclarativebooster/qdeclarativebooster.h b/src/qdeclarativebooster/qdeclarativebooster.h index 36b9ce2..8ce08a4 100644 --- a/src/qdeclarativebooster/qdeclarativebooster.h +++ b/src/qdeclarativebooster/qdeclarativebooster.h @@ -20,6 +20,9 @@ #ifndef QDECLARATIVEBOOSTER_H #define QDECLARATIVEBOOSTER_H +#include +#include "QFileInfo" + #include "eventhandler.h" #include "booster.h" @@ -70,6 +73,9 @@ protected: //! \reimp virtual bool receiveDataFromInvoker(int socketFd); + //! \reimp + virtual void preinit(); + private: //! Disable copy-constructor diff --git a/tests/harmattan/red-tests/tests.xml b/tests/harmattan/red-tests/tests.xml index 3956a1e..2468b8a 100644 --- a/tests/harmattan/red-tests/tests.xml +++ b/tests/harmattan/red-tests/tests.xml @@ -30,9 +30,9 @@ source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-daemons.py test_app_exits_clean - + source /tmp/session_bus_address.user; DISPLAY=:0 `pyversions -d` /usr/share/applauncherd-testscripts/test-func-launcher.py test_launched_app_wm_class_d diff --git a/tests/harmattan/testscripts/test-func-launcher.py b/tests/harmattan/testscripts/test-func-launcher.py index 0a36c5f..ea5dd17 100644 --- a/tests/harmattan/testscripts/test-func-launcher.py +++ b/tests/harmattan/testscripts/test-func-launcher.py @@ -842,16 +842,16 @@ class launcher_tests (unittest.TestCase): Test that launched application have correct WM_CLASS Xproperty booster m """ #For booster-m MApplicationWindow from MComponentCache - self._test_launched_app_wm_class_helper("m","fala_wl","-faulty","fala_wl",2) + self._test_launched_app_wm_class_helper("m","fala_wl","-faulty","fala_wl",1) - #For booster-m MApplicationWindow NOT from cache. 3 windows (2 for application + 1 is created by cache but not used) - self._test_launched_app_wm_class_helper("m","fala_ft_hello","-window-not-from-cache","fala_ft_hello",3) + #For booster-m MApplicationWindow NOT from cache. 2 windows (1 for application + 1 is created by cache but not used) + self._test_launched_app_wm_class_helper("m","fala_ft_hello","-window-not-from-cache","fala_ft_hello",2) - #For booster-m multiple MApplicationWindow (3 windows + 1) - self._test_launched_app_wm_class_helper("m","fala_multi-window","","fala_multi-window",4) + #For booster-m multiple MApplicationWindow (2 windows + 1) + self._test_launched_app_wm_class_helper("m","fala_multi-window","","fala_multi-window",3) - #For booster-m multiple MApplicationWindow NOT from cache (3 windows + 1 + 1 created by cache but not used) - self._test_launched_app_wm_class_helper("m","fala_multi-window","-window-not-from-cache","fala_multi-window",5) + #For booster-m multiple MApplicationWindow NOT from cache (2 windows + 1 + 1 created by cache but not used) + self._test_launched_app_wm_class_helper("m","fala_multi-window","-window-not-from-cache","fala_multi-window",4) def test_launched_app_wm_class_d(self): """