After splash would finish, evoke would ignore first request to run external command, althought

second and rest would be fine. That is hopefully fixed now.

Splash window still gets hidden by old eiconman; for other apps it is fine. Pending for revision.
This commit is contained in:
Sanel Zukan 2007-09-20 08:47:50 +00:00
parent 762ad9883d
commit 5284410840
5 changed files with 55 additions and 40 deletions

View File

@ -196,7 +196,7 @@ void service_watcher_cb(int pid, int signum) {
} }
EvokeService::EvokeService() : EvokeService::EvokeService() :
is_running(0), logfile(NULL), xsm(NULL), pidfile(NULL), lockfile(NULL), top_win(NULL) { is_running(0), logfile(NULL), xsm(NULL), pidfile(NULL), lockfile(NULL) {
} }
EvokeService::~EvokeService() { EvokeService::~EvokeService() {
@ -745,7 +745,10 @@ int EvokeService::handle(const XEvent* xev) {
EVOKE_LOG("XSETTINGS manager shutdown\n"); EVOKE_LOG("XSETTINGS manager shutdown\n");
stop_xsettings_manager(); stop_xsettings_manager();
// return 1; // return 1;
} else if(xev->type == MapNotify) { }
#if 0
else if(xev->type == MapNotify) {
puts("=================");
if(top_win) { if(top_win) {
// for splash to keep it at top (working in old edewm) // for splash to keep it at top (working in old edewm)
XRaiseWindow(fl_display, fl_xid(top_win)); XRaiseWindow(fl_display, fl_xid(top_win));
@ -757,7 +760,9 @@ int EvokeService::handle(const XEvent* xev) {
XRaiseWindow(fl_display, fl_xid(top_win)); XRaiseWindow(fl_display, fl_xid(top_win));
// return 1; // return 1;
} }
} else if(xev->type == PropertyNotify) { }
#endif
else if(xev->type == PropertyNotify) {
if(xev->xproperty.atom == _ede_spawn) { if(xev->xproperty.atom == _ede_spawn) {
char buff[1024]; char buff[1024];
if(get_string_property_value(_ede_spawn, buff, sizeof(buff))) { if(get_string_property_value(_ede_spawn, buff, sizeof(buff))) {

View File

@ -52,8 +52,6 @@ class EvokeService {
char* pidfile; char* pidfile;
char* lockfile; char* lockfile;
Fl_Double_Window* top_win;
Atom _ede_shutdown_all; Atom _ede_shutdown_all;
Atom _ede_spawn; Atom _ede_spawn;
Atom _ede_evoke_quit; Atom _ede_evoke_quit;
@ -83,9 +81,6 @@ class EvokeService {
Log* log(void) { return logfile; } Log* log(void) { return logfile; }
void register_top(Fl_Double_Window* win) { top_win = win; }
void unregister_top(void) { top_win = NULL; }
void service_watcher(int pid, int signum); void service_watcher(int pid, int signum);
void run_program(const char* cmd, bool enable_vars = 1); void run_program(const char* cmd, bool enable_vars = 1);
//void heuristic_run_program(const char* cmd); //void heuristic_run_program(const char* cmd);

View File

@ -13,9 +13,17 @@ SubDir TOP evoke ;
# use SIGHUP for now as default # use SIGHUP for now as default
ObjectC++Flags evoke.cpp : -DUSE_SIGHUP ; ObjectC++Flags evoke.cpp : -DUSE_SIGHUP ;
SOURCE = evoke.cpp EvokeService.cpp Xsm.cpp Spawn.cpp Splash.cpp Log.cpp Logout.cpp Crash.cpp Autostart.cpp ; SOURCE = evoke.cpp
EvokeService.cpp
Xsm.cpp
Spawn.cpp
Splash.cpp
Log.cpp
Logout.cpp
Crash.cpp
Autostart.cpp ;
LinkAgainst evoke : -lao -lvorbis -lvorbisfile -lmad ; LinkAgainst evoke : -lao -lvorbis -lvorbisfile ;
EdeProgram evoke : $(SOURCE) ; EdeProgram evoke : $(SOURCE) ;
FltkProgramBare test/evoke_test : test/evoke_test.cpp ; FltkProgramBare test/evoke_test : test/evoke_test.cpp ;

View File

@ -56,7 +56,6 @@ int spawn_program(const char* cmd, SignalWatch wf, pid_t* child_pid_ret, const c
int nulldev = -1; int nulldev = -1;
int status_ret = 0; int status_ret = 0;
if(wf) {
struct sigaction sa; struct sigaction sa;
sa.sa_handler = sigchld_handler; sa.sa_handler = sigchld_handler;
sa.sa_flags = SA_NOCLDSTOP; sa.sa_flags = SA_NOCLDSTOP;
@ -64,10 +63,8 @@ int spawn_program(const char* cmd, SignalWatch wf, pid_t* child_pid_ret, const c
sigaction(SIGCHLD, &sa, (struct sigaction*)0); sigaction(SIGCHLD, &sa, (struct sigaction*)0);
global_watch = wf; global_watch = wf;
}
pid_t pid = fork(); pid_t pid = fork();
if(pid == -1) if(pid == -1)
return SPAWN_FORK_FAILED; return SPAWN_FORK_FAILED;

View File

@ -26,11 +26,21 @@
#define TIMEOUT_START 0.5 // timeout when splash is first time shown (also for first client) #define TIMEOUT_START 0.5 // timeout when splash is first time shown (also for first client)
#define TIMEOUT_CONTINUE 2.0 // timeout between starting rest of the cliens #define TIMEOUT_CONTINUE 2.0 // timeout between starting rest of the cliens
#if 0
int splash_xmessage_handler(int ev) { extern void service_watcher_cb(int pid, int signum);
return EvokeService::instance()->handle(fl_xevent);
Fl_Double_Window* splash_win = 0;
int splash_xmessage_handler(int e) {
if(fl_xevent->type == MapNotify || fl_xevent->type == ConfigureNotify) {
if(splash_win) {
XRaiseWindow(fl_display, fl_xid(splash_win));
return 1;
}
}
return 0;
} }
#endif
/* /*
* repeatedly call runner() untill all clients are * repeatedly call runner() untill all clients are
@ -54,6 +64,7 @@ Splash::~Splash() {
EVOKE_LOG("Cleaning splash data\n"); EVOKE_LOG("Cleaning splash data\n");
// elements of icons cleans Fl_Group // elements of icons cleans Fl_Group
delete [] icons; delete [] icons;
Fl::remove_timeout(runner_cb);
} }
@ -175,39 +186,36 @@ void Splash::run(void) {
int sh = DisplayHeight(fl_display, fl_screen); int sh = DisplayHeight(fl_display, fl_screen);
position(sw/2 - w()/2, sh/2 - h()/2); position(sw/2 - w()/2, sh/2 - h()/2);
bool sound_loaded = false;
if(sound && !sound->empty()) if(sound && !sound->empty())
edelib::SoundSystem::init(); sound_loaded = edelib::SoundSystem::init();
show(); show();
Fl::add_timeout(TIMEOUT_START, runner_cb, this); Fl::add_timeout(TIMEOUT_START, runner_cb, this);
// FIXME: validate this again !
#if 0
/* /*
* Fl::wait() will block all events to EvokeService and it will not * Force keeping splash window at the top of all. To do this, we will listen
* be able to keep this window at the top. So we again select event inputs * MappingNotify and ConfigureNotify events, and when they be triggered we will
* and redirect them to EvokeService::handle(). * raise splash window.
*/ */
XSelectInput(fl_display, RootWindow(fl_display, fl_screen), SubstructureNotifyMask); splash_win = this;
Fl::add_handler(splash_xmessage_handler);
#endif
// make sure MappingNotify keeps this window at the top //XSelectInput(fl_display, RootWindow(fl_display, fl_screen), SubstructureNotifyMask);
EvokeService::instance()->register_top(this); //Fl::add_handler(splash_xmessage_handler);
if(edelib::SoundSystem::inited()) if(sound_loaded)
edelib::SoundSystem::play(sound->c_str(), 0); edelib::SoundSystem::play(sound->c_str(), 0);
while(shown()) while(shown())
Fl::wait(); Fl::wait();
EvokeService::instance()->unregister_top(); if(sound_loaded) {
if(edelib::SoundSystem::inited()) {
edelib::SoundSystem::stop(); edelib::SoundSystem::stop();
edelib::SoundSystem::shutdown(); edelib::SoundSystem::shutdown();
} }
splash_win = 0;
} }
// called when splash option is on // called when splash option is on
@ -236,7 +244,8 @@ bool Splash::next_client(void) {
redraw(); redraw();
if(!dry_run) if(!dry_run)
spawn_program(cmd); spawn_program(cmd, service_watcher_cb);
//spawn_program(cmd);
++clist_it; ++clist_it;
++counter; ++counter;
@ -266,7 +275,8 @@ bool Splash::next_client_nosplash(void) {
printf("%s\n", buff); printf("%s\n", buff);
if(!dry_run) if(!dry_run)
spawn_program(cmd); spawn_program(cmd, service_watcher_cb);
//spawn_program(cmd);
++clist_it; ++clist_it;
++counter; ++counter;