diff --git a/debian/changelog b/debian/changelog index 6535a4b..7d5a505 100644 --- a/debian/changelog +++ b/debian/changelog @@ -2,8 +2,9 @@ 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 - -- Jussi Lind Tue, 08 Mar 2011 14:08:07 +0200 + -- Juha Lintula Fri, 08 Mar 2011 10:16:05 +0200 applauncherd (0.20.0) stable; urgency=low diff --git a/src/common/protocol.h b/src/common/protocol.h index fa4e2ff..62aa19a 100644 --- a/src/common/protocol.h +++ b/src/common/protocol.h @@ -32,9 +32,11 @@ const uint32_t INVOKER_MSG_MAGIC_OPTION_DLOPEN_DEEP = 0x00000004; const uint32_t INVOKER_MSG_MAGIC_OPTION_SINGLE_INSTANCE = 0x00000008; const uint32_t INVOKER_MSG_MAGIC_OPTION_SPLASH_SCREEN = 0x00000010; const uint32_t INVOKER_MSG_MAGIC_OPTION_OOM_ADJ_DISABLE = 0x00000020; +const uint32_t INVOKER_MSG_MAGIC_OPTION_LANDSCAPE_SPLASH_SCREEN = 0x00000040; const uint32_t INVOKER_MSG_MASK = 0xffff0000; + const uint32_t INVOKER_MSG_NAME = 0x5a5e0000; const uint32_t INVOKER_MSG_EXEC = 0xe8ec0000; const uint32_t INVOKER_MSG_ARGS = 0xa4650000; @@ -46,6 +48,7 @@ const uint32_t INVOKER_MSG_IO = 0x10fd0000; const uint32_t INVOKER_MSG_END = 0xdead0000; const uint32_t INVOKER_MSG_PID = 0x1d1d0000; const uint32_t INVOKER_MSG_SPLASH = 0x5b1a0000; +const uint32_t INVOKER_MSG_LANDSCAPE_SPLASH = 0x5b120000; const uint32_t INVOKER_MSG_EXIT = 0xe4170000; const uint32_t INVOKER_MSG_ACK = 0x600d0000; const uint32_t INVOKER_MSG_BAD_CREDS = 0x60035800; diff --git a/src/invoker/invoker.c b/src/invoker/invoker.c index 7c03302..79a9445 100644 --- a/src/invoker/invoker.c +++ b/src/invoker/invoker.c @@ -293,6 +293,12 @@ static void invoker_send_splash_file(int fd, char *filename) invoke_send_str(fd, filename); } +static void invoker_send_landscape_splash_file(int fd, char *filename) +{ + invoke_send_msg(fd, INVOKER_MSG_LANDSCAPE_SPLASH); + invoke_send_str(fd, filename); +} + static void invoker_send_exec(int fd, char *exec) { invoke_send_msg(fd, INVOKER_MSG_EXEC); @@ -429,7 +435,6 @@ static void usage(int status) " -L, --splash-landscape LANDSCAPE-FILE\n" " Show splash screen from the LANDSCAPE-FILE\n" " in case the device is in landscape orientation.\n" - " (To be implemented)\n" " -o, --oom-adj-disable Disable default out of memory killing adjustments \n" " for launched process. \n" " -h, --help Print this help.\n\n" @@ -495,7 +500,7 @@ void invoke_fallback(char **prog_argv, char *prog_name, bool wait_term) // "normal" invoke through a socket connection int invoke_remote(int fd, int prog_argc, char **prog_argv, char *prog_name, uint32_t magic_options, bool wait_term, unsigned int respawn_delay, - char *splash_file) + char *splash_file, char *landscape_splash_file) { int status = 0; @@ -518,6 +523,8 @@ int invoke_remote(int fd, int prog_argc, char **prog_argv, char *prog_name, invoker_send_ids(fd, getuid(), getgid()); if (( magic_options & INVOKER_MSG_MAGIC_OPTION_SPLASH_SCREEN ) != 0) invoker_send_splash_file(fd, splash_file); + if (( magic_options & INVOKER_MSG_MAGIC_OPTION_LANDSCAPE_SPLASH_SCREEN ) != 0) + invoker_send_landscape_splash_file(fd, landscape_splash_file); invoker_send_io(fd); invoker_send_env(fd); invoker_send_end(fd); @@ -549,7 +556,7 @@ int invoke_remote(int fd, int prog_argc, char **prog_argv, char *prog_name, // Invokes the given application static int invoke(int prog_argc, char **prog_argv, char *prog_name, enum APP_TYPE app_type, uint32_t magic_options, bool wait_term, unsigned int respawn_delay, - char *splash_file) + char *splash_file, char *landscape_splash_file) { int status = 0; @@ -568,7 +575,7 @@ static int invoke(int prog_argc, char **prog_argv, char *prog_name, { status = invoke_remote(fd, prog_argc, prog_argv, prog_name, magic_options, wait_term, respawn_delay, - splash_file); + splash_file, landscape_splash_file); close(fd); } } @@ -587,6 +594,7 @@ int main(int argc, char *argv[]) char **prog_argv = NULL; char *prog_name = NULL; char *splash_file = NULL; + char *landscape_splash_file = NULL; struct stat file_stat; // wait-term parameter by default @@ -696,8 +704,8 @@ int main(int argc, char *argv[]) break; case 'L': - // Just a placeholder for future development - // of landscape splash screen + magic_options |= INVOKER_MSG_MAGIC_OPTION_LANDSCAPE_SPLASH_SCREEN; + landscape_splash_file = optarg; break; case '?': @@ -749,7 +757,7 @@ int main(int argc, char *argv[]) // Send commands to the launcher daemon info("Invoking execution: '%s'\n", prog_name); - int ret_val = invoke(prog_argc, prog_argv, prog_name, app_type, magic_options, wait_term, respawn_delay, splash_file); + int ret_val = invoke(prog_argc, prog_argv, prog_name, app_type, magic_options, wait_term, respawn_delay, splash_file, landscape_splash_file); // Sleep for delay before exiting if (delay) diff --git a/src/launcherlib/appdata.cpp b/src/launcherlib/appdata.cpp index 659b293..8b82e26 100644 --- a/src/launcherlib/appdata.cpp +++ b/src/launcherlib/appdata.cpp @@ -37,7 +37,8 @@ AppData::AppData() : m_ioDescriptors(), m_gid(0), m_uid(0), - m_splashFileName("") + m_splashFileName(""), + m_landscapeSplashFileName("") #if defined (HAVE_CREDS) , m_peerCreds(NULL) #endif @@ -123,6 +124,16 @@ const string & AppData::splashFileName() const return m_splashFileName; } +void AppData::setLandscapeSplashFileName(const string & fileName) +{ + m_landscapeSplashFileName = fileName; +} + +const string & AppData::landscapeSplashFileName() const +{ + return m_landscapeSplashFileName; +} + void AppData::setPriority(int newPriority) { m_prio = newPriority; diff --git a/src/launcherlib/appdata.h b/src/launcherlib/appdata.h index d24534c..dfd9c65 100644 --- a/src/launcherlib/appdata.h +++ b/src/launcherlib/appdata.h @@ -95,6 +95,12 @@ public: //! Return file name of the image shown as splash screen const string & splashFileName() const; + //! Set file name of the image shown as landscape splash screen + void setLandscapeSplashFileName(const string & fileName); + + //! Return file name of the image shown as landscape splash screen + const string & landscapeSplashFileName() const; + //! Set priority void setPriority(int priority); @@ -159,6 +165,7 @@ private: gid_t m_gid; uid_t m_uid; string m_splashFileName; + string m_landscapeSplashFileName; #if defined (HAVE_CREDS) creds_t m_peerCreds; diff --git a/src/launcherlib/connection.cpp b/src/launcherlib/connection.cpp index 7940943..5848074 100644 --- a/src/launcherlib/connection.cpp +++ b/src/launcherlib/connection.cpp @@ -38,6 +38,7 @@ Connection::Connection(int socketFd, bool testMode) : m_curSocket(socketFd), m_fileName(""), m_splashFileName(""), + m_landscapeSplashFileName(""), m_argc(0), m_argv(NULL), m_priority(0), @@ -307,6 +308,17 @@ bool Connection::receiveSplash() return true; } +bool Connection::receiveLandscapeSplash() +{ + const char* filename = recvStr(); + if (!filename) + return false; + + m_landscapeSplashFileName = filename; + delete [] filename; + return true; +} + bool Connection::receivePriority() { recvMsg(&m_priority); @@ -519,6 +531,10 @@ bool Connection::receiveActions() receiveSplash(); break; + case INVOKER_MSG_LANDSCAPE_SPLASH: + receiveLandscapeSplash(); + break; + case INVOKER_MSG_END: sendMsg(INVOKER_MSG_ACK); @@ -561,6 +577,7 @@ bool Connection::receiveApplicationData(AppData* appData) appData->setArgc(m_argc); appData->setArgv(m_argv); appData->setSplashFileName(m_splashFileName); + appData->setLandscapeSplashFileName(m_landscapeSplashFileName); appData->setIODescriptors(vector(m_io, m_io + IO_DESCRIPTOR_COUNT)); appData->setIDs(m_uid, m_gid); } diff --git a/src/launcherlib/connection.h b/src/launcherlib/connection.h index c529b28..fd9cf14 100644 --- a/src/launcherlib/connection.h +++ b/src/launcherlib/connection.h @@ -128,6 +128,9 @@ private: //! Receive filename used as splash screen image bool receiveSplash(); + //! Receive filename used as landscape splash screen image + bool receiveLandscapeSplash(); + //! Send process pid bool sendPid(pid_t pid); @@ -154,6 +157,7 @@ private: string m_fileName; string m_splashFileName; + string m_landscapeSplashFileName; uint32_t m_argc; const char ** m_argv; int m_io[IO_DESCRIPTOR_COUNT];