Replaced X event notifying via add_fd(). Now all X events could be reported

without possible stealing from fltk. Prevous, add_handler(), would send only
unknown events for fltk which leave us without really important ones, like selection events
used by XSETTINGS manager.

Added XSETTINGS support (yet unfinished) which will make evoke as XSETTINGS manager.
This commit is contained in:
Sanel Zukan
2007-09-18 14:06:09 +00:00
parent 00f5f2d59a
commit ad69c2fc2c
7 changed files with 265 additions and 11 deletions

View File

@@ -19,7 +19,7 @@
#include "Autostart.h"
#include <edelib/File.h>
#include <edelib/Regex.h>
//#include <edelib/Regex.h>
#include <edelib/Config.h>
#include <edelib/DesktopFile.h>
#include <edelib/Directory.h>
@@ -195,14 +195,17 @@ void service_watcher_cb(int pid, int signum) {
EvokeService::instance()->service_watcher(pid, signum);
}
EvokeService::EvokeService() : is_running(0), logfile(NULL), pidfile(NULL), lockfile(NULL) {
top_win = NULL;
EvokeService::EvokeService() :
is_running(0), logfile(NULL), xsm(NULL), pidfile(NULL), lockfile(NULL), top_win(NULL) {
}
EvokeService::~EvokeService() {
if(logfile)
delete logfile;
if(xsm)
delete xsm;
if(lockfile) {
edelib::file_remove(lockfile);
free(lockfile);
@@ -434,6 +437,30 @@ void EvokeService::init_autostart(bool safe) {
dlg.run();
}
void EvokeService::init_xsettings_manager(void) {
xsm = new Xsm;
if(xsm->is_running()) {
int ret = edelib::ask(_("XSETTINGS manager already running on this screen. Would you like to replace it?"));
if(ret < 1) {
stop_xsettings_manager();
return;
} else
goto do_it;
}
do_it:
if(!xsm->init()) {
edelib::alert(_("Unable to load XSETTINGS manager properly"));
stop_xsettings_manager();
}
}
void EvokeService::stop_xsettings_manager(void) {
delete xsm;
xsm = NULL;
}
void EvokeService::setup_atoms(Display* d) {
// with them must be send '1' or property will be ignored (except _EDE_EVOKE_SPAWN)
_ede_shutdown_all = XInternAtom(d, "_EDE_EVOKE_SHUTDOWN_ALL", False);
@@ -694,7 +721,10 @@ bool EvokeService::find_and_unregister_process(pid_t pid, EvokeProcess& pc) {
int EvokeService::handle(const XEvent* ev) {
logfile->printf("Got event %i\n", ev->type);
if(ev->type == MapNotify) {
if(xsm && xsm->should_quit(ev)) {
stop_xsettings_manager();
return 1;
} else if(ev->type == MapNotify) {
if(top_win) {
// for splash to keep it at top (working in old edewm)
XRaiseWindow(fl_display, fl_xid(top_win));