mirror of
https://github.com/edeproject/ede.git
synced 2023-08-10 21:13:03 +03:00
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
This commit is contained in:
parent
12174af67d
commit
65492f45b7
@ -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 <sys/types.h> // getpid
|
||||
#include <unistd.h> // pipe
|
||||
#include <fcntl.h> // fcntl
|
||||
#include <stdlib.h> // free
|
||||
#include <string.h> // strdup, memset
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <edelib/File.h>
|
||||
#include <edelib/Config.h>
|
||||
@ -27,15 +28,14 @@
|
||||
#include <edelib/MessageBox.h>
|
||||
#include <edelib/Nls.h>
|
||||
|
||||
#include <sys/types.h> // getpid
|
||||
#include <unistd.h> // pipe
|
||||
#include <fcntl.h> // fcntl
|
||||
#include <stdlib.h> // free
|
||||
#include <string.h> // strdup, memset
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#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();
|
||||
|
||||
|
@ -13,18 +13,17 @@
|
||||
#ifndef __EVOKESERVICE_H__
|
||||
#define __EVOKESERVICE_H__
|
||||
|
||||
#include "Log.h"
|
||||
#include "Xsm.h"
|
||||
|
||||
#ifdef HAVE_COMPOSITE
|
||||
#include "Composite.h"
|
||||
#endif
|
||||
#include <FL/x.h>
|
||||
#include <pthread.h>
|
||||
|
||||
#include <edelib/List.h>
|
||||
#include <edelib/String.h>
|
||||
|
||||
#include <FL/x.h>
|
||||
#include <pthread.h>
|
||||
#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)
|
||||
|
@ -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 ;
|
||||
|
@ -10,9 +10,6 @@
|
||||
* See COPYING for details.
|
||||
*/
|
||||
|
||||
#include "Logout.h"
|
||||
#include <edelib/Nls.h>
|
||||
|
||||
#include <FL/Fl_Double_Window.h>
|
||||
#include <FL/Fl_Box.h>
|
||||
#include <FL/Fl_Button.h>
|
||||
@ -22,6 +19,9 @@
|
||||
#include <FL/x.h>
|
||||
#include <string.h> // memset
|
||||
|
||||
#include <edelib/Nls.h>
|
||||
#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();
|
||||
|
@ -10,7 +10,6 @@
|
||||
* See COPYING for details.
|
||||
*/
|
||||
|
||||
#include "Spawn.h"
|
||||
|
||||
#include <sys/types.h> // fork
|
||||
#include <unistd.h> // fork, open, close, dup
|
||||
@ -21,10 +20,11 @@
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <sys/time.h> // getrlimit, setrlimit
|
||||
#include <sys/resource.h> //
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -10,17 +10,17 @@
|
||||
* See COPYING for details.
|
||||
*/
|
||||
|
||||
#include "Splash.h"
|
||||
#include "Spawn.h"
|
||||
#include <stdio.h> // snprintf
|
||||
|
||||
#include <FL/Fl_Shared_Image.h>
|
||||
#include <FL/Fl.h>
|
||||
|
||||
#include <edelib/Run.h>
|
||||
#include <edelib/Debug.h>
|
||||
#include <edelib/Nls.h>
|
||||
|
||||
#include <FL/Fl_Shared_Image.h>
|
||||
#include <FL/Fl.h>
|
||||
|
||||
#include <stdio.h> // 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();
|
||||
|
@ -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);
|
||||
|
@ -10,7 +10,12 @@
|
||||
* See COPYING for details.
|
||||
*/
|
||||
|
||||
#include "Xsm.h"
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <FL/x.h>
|
||||
#include <X11/Xresource.h>
|
||||
|
||||
#include <edelib/Debug.h>
|
||||
#include <edelib/TiXml.h>
|
||||
#include <edelib/File.h>
|
||||
@ -19,12 +24,8 @@
|
||||
#include <edelib/Util.h>
|
||||
#include <edelib/Directory.h>
|
||||
#include <edelib/XSettingsCommon.h>
|
||||
#include <string.h>
|
||||
#include <limits.h>
|
||||
|
||||
#include <FL/x.h>
|
||||
|
||||
#include <X11/Xresource.h>
|
||||
#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("</ede-settings>\n");
|
||||
|
||||
setting_file.close();
|
||||
|
@ -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
|
||||
|
@ -10,17 +10,17 @@
|
||||
* See COPYING for details.
|
||||
*/
|
||||
|
||||
#include "EvokeService.h"
|
||||
|
||||
#include <FL/Fl.h>
|
||||
#include <FL/x.h>
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
|
||||
#include <edelib/Config.h>
|
||||
#include <edelib/Debug.h>
|
||||
#include <edelib/File.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <signal.h>
|
||||
#include <FL/Fl.h>
|
||||
#include <FL/x.h>
|
||||
|
||||
#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();
|
||||
|
Loading…
Reference in New Issue
Block a user