From 65492f45b78ecb4950f7ee6a1788714e851643b9 Mon Sep 17 00:00:00 2001 From: Sanel Zukan Date: Mon, 8 Sep 2008 11:09:37 +0000 Subject: [PATCH] Removed leftovers from sound stuff. Replaced hardcoded values for screen sizes used by logout dialog with passed values. Removed spawn_backtrace() function; not used any more. Some code reordering --- evoke/EvokeService.cpp | 48 +++++++++++++++++--------------------- evoke/EvokeService.h | 15 ++++++------ evoke/Jamfile | 6 ++--- evoke/Logout.cpp | 15 ++++++------ evoke/Spawn.cpp | 53 ++---------------------------------------- evoke/Spawn.h | 1 - evoke/Splash.cpp | 24 +++++++++---------- evoke/Splash.h | 2 -- evoke/Xsm.cpp | 18 +++++++------- evoke/evoke.conf | 2 -- evoke/evoke.cpp | 30 ++++++++++++------------ 11 files changed, 78 insertions(+), 136 deletions(-) diff --git a/evoke/EvokeService.cpp b/evoke/EvokeService.cpp index 01bcc8e..7c8e213 100644 --- a/evoke/EvokeService.cpp +++ b/evoke/EvokeService.cpp @@ -10,12 +10,13 @@ * See COPYING for details. */ -#include "Log.h" -#include "Logout.h" -#include "EvokeService.h" -#include "Splash.h" -#include "Spawn.h" -#include "Autostart.h" +#include // getpid +#include // pipe +#include // fcntl +#include // free +#include // strdup, memset +#include +#include #include #include @@ -27,15 +28,14 @@ #include #include -#include // getpid -#include // pipe -#include // fcntl -#include // free -#include // strdup, memset -#include -#include +#include "Log.h" +#include "Logout.h" +#include "EvokeService.h" +#include "Splash.h" +#include "Spawn.h" +#include "Autostart.h" -void resolve_path(const edelib::String& datadir, edelib::String& item, bool have_datadir) { +static void resolve_path(const edelib::String& datadir, edelib::String& item, bool have_datadir) { if(item.empty()) return; @@ -51,7 +51,7 @@ void resolve_path(const edelib::String& datadir, edelib::String& item, bool have } } -char* get_basename(const char* path) { +static char* get_basename(const char* path) { char* p = strrchr(path, '/'); if(p) return (p + 1); @@ -72,7 +72,7 @@ char* get_basename(const char* path) { * Alternative would be to sort items (by their basename) and apply consecutive unique on * them, but... is it worth ? */ -void basename_unique(StringList& lst) { +static void basename_unique(StringList& lst) { if(lst.empty()) return; @@ -95,7 +95,7 @@ void basename_unique(StringList& lst) { } } -int get_int_property_value(Atom at) { +static int get_int_property_value(Atom at) { Atom real; int format; unsigned long n, extra; @@ -112,7 +112,7 @@ int get_int_property_value(Atom at) { return ret; } -int get_string_property_value(Atom at, char* txt, int txt_len) { +static int get_string_property_value(Atom at, char* txt, int txt_len) { XTextProperty names; XGetTextProperty(fl_display, RootWindow(fl_display, fl_screen), &names, at); if(!names.nitems || !names.value) @@ -136,7 +136,7 @@ int get_string_property_value(Atom at, char* txt, int txt_len) { * XmuClientWindow() will return parent window of given window; this is used so we don't * send delete message to some button or else, but it's parent. */ -Window mu_try_children(Display* dpy, Window win, Atom wm_state) { +static Window mu_try_children(Display* dpy, Window win, Atom wm_state) { Atom real; Window root, parent; Window* children = 0; @@ -167,7 +167,7 @@ Window mu_try_children(Display* dpy, Window win, Atom wm_state) { return ret; } -Window mu_client_window(Display* dpy, Window win, Atom wm_state) { +static Window mu_client_window(Display* dpy, Window win, Atom wm_state) { Atom real; int format; unsigned long n, extra; @@ -193,7 +193,7 @@ void service_watcher_cb(int pid, int signum) { EvokeService::instance()->service_watcher(pid, signum); } -void wake_up_cb(int fd, void* v) { +static void wake_up_cb(int fd, void* v) { EvokeService::instance()->wake_up(fd); } @@ -313,10 +313,6 @@ bool EvokeService::init_splash(const char* config, bool no_splash, bool dry_run) if(c.get("evoke", "Splash", buff, sizeof(buff))) splashimg = buff; - edelib::String sound; - if(c.get("evoke", "Sound", buff, sizeof(buff))) - sound = buff; - // Startup key must exists if(!c.get("evoke", "Startup", buff, sizeof(buff))) return false; @@ -356,7 +352,6 @@ bool EvokeService::init_splash(const char* config, bool no_splash, bool dry_run) * since Splash expects that. */ resolve_path(datadir, splashimg, have_datadir); - resolve_path(datadir, sound, have_datadir); ClientListIter it, it_end; for(it = clients.begin(), it_end = clients.end(); it != it_end; ++it) @@ -365,7 +360,6 @@ bool EvokeService::init_splash(const char* config, bool no_splash, bool dry_run) Splash sp(no_splash, dry_run); sp.set_clients(&clients); sp.set_background(&splashimg); - sp.set_sound(&sound); sp.run(); diff --git a/evoke/EvokeService.h b/evoke/EvokeService.h index 146a7b1..38d5bda 100644 --- a/evoke/EvokeService.h +++ b/evoke/EvokeService.h @@ -13,18 +13,17 @@ #ifndef __EVOKESERVICE_H__ #define __EVOKESERVICE_H__ -#include "Log.h" -#include "Xsm.h" - -#ifdef HAVE_COMPOSITE -#include "Composite.h" -#endif +#include +#include #include #include -#include -#include +#include "Log.h" +#include "Xsm.h" +#ifdef HAVE_COMPOSITE +#include "Composite.h" +#endif struct EvokeClient { edelib::String desc; // short program description (used in Starting... message) diff --git a/evoke/Jamfile b/evoke/Jamfile index a03c292..d2bac31 100644 --- a/evoke/Jamfile +++ b/evoke/Jamfile @@ -35,9 +35,9 @@ LinkAgainst evoke : -lXcomposite -lXdamage -lXfixes -lXrender ; #LinkAgainst evoke : -lpthread ; EdeProgram evoke : $(SOURCE) ; -FltkProgramBare test/evoke_test : test/evoke_test.cpp ; -FltkProgramBare test/stress_test : test/stress_test.cpp ; -FltkProgramBare test/opacity_test : test/opacity_test.cpp ; +FltkProgramBare test/evoke_test : test/evoke_test.cpp : "noinstall" ; +FltkProgramBare test/stress_test : test/stress_test.cpp : "noinstall" ; +FltkProgramBare test/opacity_test : test/opacity_test.cpp : "noinstall" ; #TranslationStrings locale : $(SOURCE) ; EdeManual doc/evoke.txt ; diff --git a/evoke/Logout.cpp b/evoke/Logout.cpp index 87f17c0..e3dd97d 100644 --- a/evoke/Logout.cpp +++ b/evoke/Logout.cpp @@ -10,9 +10,6 @@ * See COPYING for details. */ -#include "Logout.h" -#include - #include #include #include @@ -22,6 +19,9 @@ #include #include // memset +#include +#include "Logout.h" + static int logout_ret; static Fl_Double_Window* win; static Fl_Round_Button* rb1; @@ -31,7 +31,7 @@ static Fl_Round_Button* rb3; unsigned char* take_x11_screenshot(unsigned char *p, int X, int Y, int w, int h, int alpha); unsigned char* make_darker(unsigned char *p, int X, int Y, int w, int h); -void rb_cb(Fl_Widget*, void* r) { +static void rb_cb(Fl_Widget*, void* r) { Fl_Round_Button* rb = (Fl_Round_Button*)r; if(rb == rb2) { rb1->value(0); @@ -47,7 +47,7 @@ void rb_cb(Fl_Widget*, void* r) { rb->value(1); } -void ok_cb(Fl_Widget*, void*) { +static void ok_cb(Fl_Widget*, void*) { if(rb1->value()) logout_ret = LOGOUT_LOGOUT; else if(rb2->value()) @@ -57,7 +57,7 @@ void ok_cb(Fl_Widget*, void*) { win->hide(); } -void cancel_cb(Fl_Widget*, void*) { +static void cancel_cb(Fl_Widget*, void*) { logout_ret = LOGOUT_CANCEL; win->hide(); } @@ -73,7 +73,7 @@ int logout_dialog(int screen_w, int screen_h, bool disable_restart, bool disable win = new Fl_Double_Window(0, 0, screen_w, screen_h, _("Logout, restart or shutdown")); win->begin(); Fl_Box* bb = new Fl_Box(0, 0, win->w(), win->h()); - Fl_RGB_Image* img = new Fl_RGB_Image(imgdata, 1024, 768); + Fl_RGB_Image* img = new Fl_RGB_Image(imgdata, win->w(), win->h()); img->alloc_array = 1; bb->image(img); @@ -113,6 +113,7 @@ int logout_dialog(int screen_w, int screen_h, bool disable_restart, bool disable g->position(screen_w/2 - g->w()/2, screen_h/2 - g->h()/2); + //win->position(screen_w/2 - win->w()/2, screen_h/2 - win->h()/2); win->end(); win->clear_border(); diff --git a/evoke/Spawn.cpp b/evoke/Spawn.cpp index 1fc2c0c..02b8a3c 100644 --- a/evoke/Spawn.cpp +++ b/evoke/Spawn.cpp @@ -10,7 +10,6 @@ * See COPYING for details. */ -#include "Spawn.h" #include // fork #include // fork, open, close, dup @@ -21,10 +20,11 @@ #include #include #include - #include // getrlimit, setrlimit #include // +#include "Spawn.h" + extern char** environ; SignalWatch* global_watch = 0; @@ -152,52 +152,3 @@ int spawn_program_with_core(const char* cmd, SignalWatch* wf, pid_t* child_pid_r return ret; } - -int spawn_backtrace(const char* gdb_path, const char* program, const char* core, const char* output, const char* script) { - const char* gdb_script = "bt\nquit\n"; - const int gdb_script_len = 8; - - //signal(SIGCHLD, SIG_DFL); - - // file with gdb commands - int sfd = open(script, O_WRONLY | O_TRUNC | O_CREAT, 0770); - if(sfd == -1) - return -1; - write(sfd, gdb_script, gdb_script_len); - close(sfd); - - // output file with gdb backtrace - int ofd = open(output, O_WRONLY | O_TRUNC | O_CREAT, 0770); - if(ofd == -1) - return -1; - - pid_t pid = fork(); - - if(pid == -1) { - close(ofd); - return -1; - } else if(pid == 0) { - dup2(ofd, 1); - close(ofd); - - char* argv[8]; - argv[0] = (char*)gdb_path; - argv[1] = "--quiet"; - argv[2] = "--batch"; - argv[3] = "-x"; - argv[4] = (char*)script; - argv[5] = (char*)program; - argv[6] = (char*)core; - argv[7] = 0; - - execvp(argv[0], argv); - return -1; - } else { - int status; - if(waitpid(pid, &status, 0) != pid) - return -1; - } - - return 0; -} - diff --git a/evoke/Spawn.h b/evoke/Spawn.h index 70f4a26..9973a03 100644 --- a/evoke/Spawn.h +++ b/evoke/Spawn.h @@ -36,6 +36,5 @@ typedef void (SignalWatch)(int pid, int status); int spawn_program(const char* cmd, SignalWatch* wf = 0, pid_t* child_pid_ret = 0, const char* ofile = 0); int spawn_program_with_core(const char* cmd, SignalWatch* wf = 0, pid_t* child_pid_ret = 0); -int spawn_backtrace(const char* gdb_path, const char* program, const char* core, const char* output, const char* script); #endif diff --git a/evoke/Splash.cpp b/evoke/Splash.cpp index d4a33af..01bb15b 100644 --- a/evoke/Splash.cpp +++ b/evoke/Splash.cpp @@ -10,17 +10,17 @@ * See COPYING for details. */ -#include "Splash.h" -#include "Spawn.h" +#include // snprintf + +#include +#include #include #include #include -#include -#include - -#include // snprintf +#include "Splash.h" +#include "Spawn.h" #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 @@ -28,9 +28,9 @@ extern void service_watcher_cb(int pid, int signum); #ifndef EDEWM_HAVE_NET_SPLASH -Splash* global_splash = NULL; +static Splash* global_splash = NULL; -int splash_xmessage_handler(int e) { +static int splash_xmessage_handler(int e) { if(fl_xevent->type == MapNotify) { XRaiseWindow(fl_display, fl_xid(global_splash)); return 1; @@ -51,7 +51,7 @@ int splash_xmessage_handler(int e) { * repeatedly call runner() untill all clients are * started then hide splash window */ -void runner_cb(void* s) { +static void runner_cb(void* s) { Splash* sp = (Splash*)s; if(sp->next_client()) @@ -93,7 +93,7 @@ void Splash::show(void) { #endif void Splash::run(void) { - EASSERT(clist != NULL); + E_ASSERT(clist != NULL); if(no_splash) { while(next_client_nosplash()) @@ -223,7 +223,7 @@ bool Splash::next_client(void) { } - EASSERT(counter < clist->size() && "Internal error; 'counter' out of bounds"); + E_ASSERT(counter < clist->size() && "Internal error; 'counter' out of bounds"); char buff[1024]; const char* msg = (*clist_it).desc.c_str(); @@ -257,7 +257,7 @@ bool Splash::next_client_nosplash(void) { return false; } - EASSERT(counter < clist->size() && "Internal error; 'counter' out of bounds"); + E_ASSERT(counter < clist->size() && "Internal error; 'counter' out of bounds"); char buff[1024]; const char* msg = (*clist_it).desc.c_str(); diff --git a/evoke/Splash.h b/evoke/Splash.h index 7a0b226..791b6cc 100644 --- a/evoke/Splash.h +++ b/evoke/Splash.h @@ -22,7 +22,6 @@ class Splash : public Fl_Double_Window { private: ClientList* clist; const edelib::String* bkg; - const edelib::String* sound; unsigned int counter; bool no_splash; bool dry_run; @@ -42,7 +41,6 @@ class Splash : public Fl_Double_Window { */ void set_clients(ClientList* cl) { clist = cl; } void set_background(const edelib::String* s) { bkg = s; } - void set_sound(const edelib::String* s) { sound = s; } const ClientList* get_clients(void) const { return clist; } bool next_client(void); diff --git a/evoke/Xsm.cpp b/evoke/Xsm.cpp index a126dd8..d3bcac0 100644 --- a/evoke/Xsm.cpp +++ b/evoke/Xsm.cpp @@ -10,7 +10,12 @@ * See COPYING for details. */ -#include "Xsm.h" +#include +#include + +#include +#include + #include #include #include @@ -19,12 +24,8 @@ #include #include #include -#include -#include -#include - -#include +#include "Xsm.h" #define USER_XRESOURCE ".Xdefaults" #define USER_XRESOURCE_TMP ".Xdefaults-tmp" @@ -41,7 +42,7 @@ struct ResourceMap { * highest priority and will override all previous classes (X Resource class, not C++ one :P) * with the same xresource_key. */ -ResourceMap resource_map [] = { +static ResourceMap resource_map [] = { { "Fltk/Background2", "background", "*Text" }, { "Fltk/Background", "background", "*" }, { "Fltk/Foreground", "foreground", "*" } @@ -49,7 +50,7 @@ ResourceMap resource_map [] = { #define RESOURCE_MAP_SIZE(x) (sizeof(x)/sizeof(x[0])) -int ignore_xerrors(Display* display, XErrorEvent* xev) { +static int ignore_xerrors(Display* display, XErrorEvent* xev) { return True; } @@ -319,6 +320,7 @@ bool Xsm::save_serialized(const char* file) { iter = iter->next; } + setting_file.printf("\n"); setting_file.close(); diff --git a/evoke/evoke.conf b/evoke/evoke.conf index a3cfceb..37adbf8 100644 --- a/evoke/evoke.conf +++ b/evoke/evoke.conf @@ -5,8 +5,6 @@ # DataDirectory = data DataDirectory = /home/sanel/programs/EDE/ede2/evoke/data Splash = splash-alpha1.png - Sound = startup.ogg -# Sound = Startup1_2.ogg [edewm] Icon = edewm.png diff --git a/evoke/evoke.cpp b/evoke/evoke.cpp index cbea8b7..b9dd818 100644 --- a/evoke/evoke.cpp +++ b/evoke/evoke.cpp @@ -10,17 +10,17 @@ * See COPYING for details. */ -#include "EvokeService.h" - -#include -#include +#include +#include #include #include #include -#include -#include +#include +#include + +#include "EvokeService.h" #define FOREVER 1e20 #define CONFIG_FILE "evoke.conf" @@ -34,28 +34,28 @@ #define CHECK_ARGV(argv, pshort, plong) ((strcmp(argv, pshort) == 0) || (strcmp(argv, plong) == 0)) -void quit_signal(int sig) { +static void quit_signal(int sig) { EVOKE_LOG("Got quit signal %i\n", sig); EvokeService::instance()->stop(); } -void xmessage_handler(int, void*) { +static void xmessage_handler(int, void*) { +#ifdef USE_FLTK_LOOP_EMULATION XEvent xev; while(XEventsQueued(fl_display, QueuedAfterReading)) { XNextEvent(fl_display, &xev); EvokeService::instance()->handle((const XEvent*)&xev); } -} - -int xmessage_handler2(int) { +#else return EvokeService::instance()->handle(fl_xevent); +#endif } -int composite_handler(int ev) { +static int composite_handler(int ev) { return EvokeService::instance()->composite_handle(fl_xevent); } -const char* next_param(int curr, char** argv, int argc) { +static const char* next_param(int curr, char** argv, int argc) { int j = curr + 1; if(j >= argc) return NULL; @@ -241,9 +241,9 @@ int main(int argc, char** argv) { #else /* * NOTE: composite_handler() is not needed since it will be included - * within xmessage_handler2() call + * within xmessage_handler() call */ - Fl::add_handler(xmessage_handler2); + Fl::add_handler(xmessage_handler); #endif service->start();