Changes: Implementation of the applauncherd-mcompositor communication for splash screen.

Sets pid, wmclass, portrait splash image, landscape splash
         image, and pixmap id in the _MEEGO_SPLASH_SCREEN X11 property
         of the compositor window.  Pid is the booster/application
         pid, wmclass is derived from the application binary name,
         splash images are the parameters given for --splash and
         --splash-landscape. The pixmap id is set to the empty stirng.

RevBy: Antti Kervinen
pull/1/head
Pertti Kellomäki 15 years ago committed by Juha Lintula
parent 5539597ebc
commit 47899b7607

1
debian/changelog vendored

@ -3,6 +3,7 @@ applauncherd (0.21.0) stable; urgency=low
* Changes: Disable out of memory adjustments command line parameter added to invoker
* Changes: AppData code refactoring
* Landscape splash-message implemented to protocol between invoker and launcher
* Splash parameters communicated to mcompositor
-- Juha Lintula <juha.lintula@nokia.com> Fri, 08 Mar 2011 10:16:05 +0200

@ -15,7 +15,7 @@ qt4_wrap_cpp(MOC_SRC ${MOC_HDRS})
# Set libraries to be linked. Shared libraries to be preloaded are not linked in anymore,
# but dlopen():ed and listed in src/launcher/preload.h instead.
link_libraries(${LIBDL} )
link_libraries(${LIBDL} ${X11_LIBRARIES})
# Set executable
add_library(applauncherd MODULE ${SRC} ${MOC_SRC})

@ -33,6 +33,11 @@
#include <sys/resource.h>
#include <fcntl.h>
#include <cstring>
#include <sstream>
#include <X11/Xlib.h>
#include <X11/Xatom.h>
#include <X11/Xutil.h>
#include <sys/types.h>
#include <grp.h>
@ -298,6 +303,68 @@ void Booster::renameProcess(int parentArgc, char** parentArgv,
}
}
void Booster::requestSplash(const int pid, const std::string &wmclass,
const std::string &portraitSplash, const std::string &landscapeSplash,
const std::string &pixmapId)
{
std::stringstream st;
st << getpid();
std::string pidStr = st.str();
Display * dpy = XOpenDisplay(NULL);
if (dpy) {
const char *compositorWindowIdProperty = "_NET_SUPPORTING_WM_CHECK";
Atom compositorWindowIdAtom = XInternAtom(dpy, compositorWindowIdProperty, False);
Atom type;
int format;
unsigned long nItems;
unsigned long bytesAfter;
unsigned char *prop = 0;
// Get the compositor window id
Window rootWin = XDefaultRootWindow(dpy);
int retval = XGetWindowProperty(dpy, rootWin, compositorWindowIdAtom,
0, 0x7fffffff, False, XA_WINDOW,
&type, &format, &nItems, &bytesAfter, &prop);
if(retval == Success) {
// Package up the data and set the property
int len = pidStr.length() + 1
+ wmclass.length() + 1
+ portraitSplash.length() + 1
+ landscapeSplash.length() + 1
+ pixmapId.length() + 1;
char *data = new char[len];
char *d = data;
strcpy(d, pidStr.c_str());
d = d + pidStr.length() + 1;
strcpy(d, wmclass.c_str());
d = d + wmclass.length() + 1;
strcpy(d, portraitSplash.c_str());
d = d + portraitSplash.length() + 1;
strcpy(d, landscapeSplash.c_str());
d = d + landscapeSplash.length() + 1;
strcpy(d, pixmapId.c_str());
Window compositorWindow = *reinterpret_cast<Window *>(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);
// Without flushing, the change seems to loiter in X's queue
XFlush(dpy);
delete[] data;
XFree(prop);
}
}
}
void Booster::setEnvironmentBeforeLaunch()
{
// Possibly restore process priority
@ -343,6 +410,28 @@ void Booster::setEnvironmentBeforeLaunch()
}
#endif
// Request splash screen from mcompositor if needed
if (m_appData->splashFileName().length() > 0 || m_appData->landscapeSplashFileName().length() > 0) {
// Construct WM_CLASS from the app absolute path
std::string wmclass(m_appData->appName());
size_t pos = wmclass.rfind('/');
wmclass.erase(0, pos+1);
wmclass[0] = toupper(wmclass[0]);
// Communicate splash data to compositor
requestSplash(getpid(), wmclass,
m_appData->splashFileName(),
m_appData->landscapeSplashFileName(),
// Compositor can also show an X pixmap as splash,
// but this feature is currently not used.
std::string(""));
}
// Load the application and find out the address of main()
void* handle = loadMain();
// Duplicate I/O descriptors
for (unsigned int i = 0; i < m_appData->ioDescriptors().size(); i++)
{

@ -175,6 +175,25 @@ protected:
*/
virtual bool receiveDataFromInvoker(int socketFd);
/*!
* \brief Request splash from mcompositor
* Sets a property in the mcompositor window so that the compositor
* knows to present a splash screen. The paths to the splash image
* can be either absolute or relative. If they are relative, the
* compositor uses a default prefix to turn them into absolute
* paths. The splash screen content can also come from a pixmap in
* the X server.
*
* \param pid The pid of the launched application
* \param wmclass The wmclass of the launched application
* \param portraitSplash Path to the portrait mode splash image
* \param landscapeSplash Path to the landscape mode splash image
* \param pixmapId A pixmap id to be used as the splash screen content
*/
void requestSplash(const int pid, const string &wmclass,
const string &portraitSplash, const string &landscapeSplash,
const string &pixmapId);
//! Set nice value and store the old priority. Return true on success.
bool pushPriority(int nice);

@ -16,7 +16,7 @@ set(QT_USE_QTTEST TRUE)
# Set include paths
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/src/common ${LAUNCHER})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${LIBCREDS})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${LIBCREDS} ${X11_LIBRARIES})
# Enable Qt (may not be needed, because already defined on higher level)
include(${QT_USE_FILE})

@ -18,7 +18,7 @@ set(QT_USE_QTTEST TRUE)
# Set include paths
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/src/common ${LAUNCHER})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${MEEGOTOUCH_LIBRARIES} ${LIBCREDS})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${MEEGOTOUCH_LIBRARIES} ${LIBCREDS} ${X11_LIBRARIES})
# Enable Qt (may not be needed, because already defined on higher level)
include(${QT_USE_FILE})

@ -20,7 +20,7 @@ set(QT_USE_QTTEST TRUE)
# Set include paths
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/src/common ${LAUNCHER})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${MEEGOTOUCH_LIBRARIES})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${MEEGOTOUCH_LIBRARIES} ${X11_LIBRARIES})
# Enable Qt (may not be needed, because already defined on higher level)
include(${QT_USE_FILE})

@ -20,7 +20,7 @@ set(QT_USE_QTTEST TRUE)
# Set include paths
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/src/common ${LAUNCHER})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${MEEGOTOUCH_LIBRARIES})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${MEEGOTOUCH_LIBRARIES} ${X11_LIBRARIES})
# Enable Qt (may not be needed, because already defined on higher level)
include(${QT_USE_FILE})

@ -20,7 +20,7 @@ set(QT_USE_QTTEST TRUE)
# Set include paths
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/src/common ${LAUNCHER} ${EBOOSTER})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${MEEGOTOUCH_LIBRARIES} ${LIBCREDS})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${MEEGOTOUCH_LIBRARIES} ${LIBCREDS} ${X11_LIBRARIES})
# Enable Qt (may not be needed, because already defined on higher level)
include(${QT_USE_FILE})

@ -17,7 +17,7 @@ set(QT_USE_QTTEST TRUE)
# Set include paths
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_HOME_DIRECTORY}/src/common ${LAUNCHER} ${QTBOOSTER})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${LIBCREDS})
link_libraries(${QT_QTCORE_LIBRARY} ${QT_QTTEST_LIBRARY} ${LIBCREDS} ${X11_LIBRARIES})
# Enable Qt (may not be needed, because already defined on higher level)
include(${QT_USE_FILE})

Loading…
Cancel
Save