formatting

DEAR CEDRIC: PLEASE LEARN HOW TO FORMAT YOUR CODE CORRECTLY. THANKS.


SVN revision: 79276
This commit is contained in:
Mike Blumenkrantz 2012-11-14 09:57:11 +00:00
parent 714185fd1a
commit cc887a265c
5 changed files with 120 additions and 112 deletions

View File

@ -37,5 +37,6 @@ e_alert_show(void)
fprintf(stderr, "PAUSE !\n"); fprintf(stderr, "PAUSE !\n");
pause(); pause();
} }
return ; return;
} }

View File

@ -16,32 +16,32 @@
#include <xcb/shape.h> #include <xcb/shape.h>
#include <X11/keysym.h> #include <X11/keysym.h>
#define WINDOW_WIDTH 320 #define WINDOW_WIDTH 320
#define WINDOW_HEIGHT 240 #define WINDOW_HEIGHT 240
#ifndef XCB_ATOM_NONE #ifndef XCB_ATOM_NONE
# define XCB_ATOM_NONE 0 # define XCB_ATOM_NONE 0
#endif #endif
/* local function prototypes */ /* local function prototypes */
static int _e_alert_connect(void); static int _e_alert_connect(void);
static void _e_alert_create(void); static void _e_alert_create(void);
static void _e_alert_display(void); static void _e_alert_display(void);
static void _e_alert_button_move_resize(xcb_window_t btn, int x, int y, int w, int h); static void _e_alert_button_move_resize(xcb_window_t btn, int x, int y, int w, int h);
static void _e_alert_window_raise(xcb_window_t win); static void _e_alert_window_raise(xcb_window_t win);
static void _e_alert_sync(void); static void _e_alert_sync(void);
static void _e_alert_shutdown(void); static void _e_alert_shutdown(void);
static void _e_alert_run(void); static void _e_alert_run(void);
static void _e_alert_draw(void); static void _e_alert_draw(void);
static int _e_alert_handle_key_press(xcb_generic_event_t *event); static int _e_alert_handle_key_press(xcb_generic_event_t *event);
static int _e_alert_handle_button_press(xcb_generic_event_t *event); static int _e_alert_handle_button_press(xcb_generic_event_t *event);
static xcb_char2b_t *_e_alert_build_string(const char *str); static xcb_char2b_t *_e_alert_build_string(const char *str);
static void _e_alert_draw_outline(void); static void _e_alert_draw_outline(void);
static void _e_alert_draw_title_outline(void); static void _e_alert_draw_title_outline(void);
static void _e_alert_draw_title(void); static void _e_alert_draw_title(void);
static void _e_alert_draw_text(void); static void _e_alert_draw_text(void);
static void _e_alert_draw_button_outlines(void); static void _e_alert_draw_button_outlines(void);
static void _e_alert_draw_button_text(void); static void _e_alert_draw_button_text(void);
/* local variables */ /* local variables */
static xcb_connection_t *conn = NULL; static xcb_connection_t *conn = NULL;
@ -71,16 +71,16 @@ main(int argc, char **argv)
(!strcmp(argv[i], "-help")) || (!strcmp(argv[i], "-help")) ||
(!strcmp(argv[i], "--help"))) (!strcmp(argv[i], "--help")))
{ {
printf("This is an internal tool for Enlightenment.\n" printf("This is an internal tool for Enlightenment.\n"
"do not use it.\n"); "do not use it.\n");
exit(0); exit(0);
} }
else if (i == 1) else if (i == 1)
sig = atoi(argv[i]); // signal sig = atoi(argv[i]); // signal
else if (i == 2) else if (i == 2)
pid = atoi(argv[i]); // E's pid pid = atoi(argv[i]); // E's pid
else if (i == 3) else if (i == 3)
backtrace_str = argv[i]; backtrace_str = argv[i];
} }
tmp = getenv("E17_TAINTED"); tmp = getenv("E17_TAINTED");
@ -313,7 +313,7 @@ _e_alert_display(void)
/* grab pointer & keyboard */ /* grab pointer & keyboard */
xcb_grab_pointer_unchecked(conn, 0, win, xcb_grab_pointer_unchecked(conn, 0, win,
(XCB_EVENT_MASK_BUTTON_PRESS | (XCB_EVENT_MASK_BUTTON_PRESS |
XCB_EVENT_MASK_BUTTON_RELEASE), XCB_EVENT_MASK_BUTTON_RELEASE),
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC,
XCB_NONE, XCB_NONE, XCB_CURRENT_TIME); XCB_NONE, XCB_NONE, XCB_CURRENT_TIME);
xcb_grab_keyboard_unchecked(conn, 0, win, XCB_CURRENT_TIME, xcb_grab_keyboard_unchecked(conn, 0, win, XCB_CURRENT_TIME,
@ -389,21 +389,24 @@ _e_alert_run(void)
case XCB_BUTTON_PRESS: case XCB_BUTTON_PRESS:
ret = _e_alert_handle_button_press(event); ret = _e_alert_handle_button_press(event);
break; break;
case XCB_KEY_PRESS: case XCB_KEY_PRESS:
ret = _e_alert_handle_key_press(event); ret = _e_alert_handle_key_press(event);
break; break;
case XCB_EXPOSE: case XCB_EXPOSE:
{ {
xcb_expose_event_t *ev; xcb_expose_event_t *ev;
ev = (xcb_expose_event_t *)event; ev = (xcb_expose_event_t *)event;
if (ev->window != win) break; if (ev->window != win) break;
_e_alert_draw(); _e_alert_draw();
_e_alert_sync(); _e_alert_sync();
break;
}
break;
}
default: default:
break; break;
} }
@ -517,15 +520,16 @@ _e_alert_draw_title(void)
xcb_image_text_8(conn, strlen(title), win, gc, x, y, title); xcb_image_text_8(conn, strlen(title), win, gc, x, y, title);
} }
struct { struct
int signal; {
const char *name; int signal;
const char *name;
} signal_name[5] = { } signal_name[5] = {
{ SIGSEGV, "SEGV" }, { SIGSEGV, "SEGV" },
{ SIGILL, "SIGILL" }, { SIGILL, "SIGILL" },
{ SIGFPE, "SIGFPE" }, { SIGFPE, "SIGFPE" },
{ SIGBUS, "SIGBUS" }, { SIGBUS, "SIGBUS" },
{ SIGABRT, "SIGABRT" } { SIGABRT, "SIGABRT" }
}; };
static void static void
@ -561,7 +565,6 @@ _e_alert_draw_text(void)
"\n" "\n"
"Please compile latest svn E17 and EFL with\n" "Please compile latest svn E17 and EFL with\n"
"-g and -ggdb3 in your CFLAGS.\n", pid); "-g and -ggdb3 in your CFLAGS.\n", pid);
} }
} }
else else
@ -572,7 +575,7 @@ _e_alert_draw_text(void)
"modules; before reporting this issue, please\n" "modules; before reporting this issue, please\n"
"unload them and try to see if the bug is still\n" "unload them and try to see if the bug is still\n"
"there. Also update to latest svn and be sure to\n" "there. Also update to latest svn and be sure to\n"
"compile E17 and EFL with -g and -ggdb3 in your CFLAGS"); "compile E17 and EFL with -g and -ggdb3 in your CFLAGS");
} }
strcpy(warn, ""); strcpy(warn, "");
@ -580,8 +583,8 @@ _e_alert_draw_text(void)
for (i = 0; i < sizeof(signal_name) / sizeof(signal_name[0]); ++i) for (i = 0; i < sizeof(signal_name) / sizeof(signal_name[0]); ++i)
if (signal_name[i].signal == sig) if (signal_name[i].signal == sig)
snprintf(warn, sizeof(warn), snprintf(warn, sizeof(warn),
"This is very bad. Enlightenment %s'd.", "This is very bad. Enlightenment %s'd.",
signal_name[i].name); signal_name[i].name);
/* draw text */ /* draw text */
k = (fh + 12); k = (fh + 12);
@ -661,3 +664,4 @@ _e_alert_draw_button_text(void)
xcb_image_text_8(conn, strlen(str2), btn2, gc, x, (10 + fa), str2); xcb_image_text_8(conn, strlen(str2), btn2, gc, x, (10 + fa), str2);
} }

View File

@ -17,7 +17,7 @@ _e_x_composite_shutdown(void)
// Ecore_X_Display *dpy; // Ecore_X_Display *dpy;
Ecore_X_Window root; Ecore_X_Window root;
if (_e_x_composite_shutdown_try) return; /* we failed :-( */ if (_e_x_composite_shutdown_try) return; /* we failed :-( */
_e_x_composite_shutdown_try = 1; _e_x_composite_shutdown_try = 1;
// dpy = ecore_x_display_get(); // dpy = ecore_x_display_get();
@ -36,24 +36,25 @@ _e_write_safe_int(int fd, const char *buf, size_t size)
{ {
while (size > 0) while (size > 0)
{ {
ssize_t done = write(fd, buf, size); ssize_t done = write(fd, buf, size);
if (done >= 0) if (done >= 0)
{ {
buf += done; buf += done;
size -= done; size -= done;
} }
else else
{ {
if ((errno == EAGAIN) || (errno == EINTR)) if ((errno == EAGAIN) || (errno == EINTR))
continue; continue;
else else
{ {
perror("write"); perror("write");
return; return;
} }
} }
} }
} }
#endif #endif
/* a tricky little devil, requires e and it's libs to be built /* a tricky little devil, requires e and it's libs to be built
@ -120,3 +121,4 @@ e_sigabrt_act(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED_
ecore_x_sync(); ecore_x_sync();
e_alert_show(); e_alert_show();
} }

View File

@ -218,14 +218,14 @@ _env_path_append(const char *env, const char *path)
} }
} }
static void static void
_sigusr1(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__) _sigusr1(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__)
{ {
struct sigaction action; struct sigaction action;
/* release ptrace */ /* release ptrace */
stop_ptrace = EINA_TRUE; stop_ptrace = EINA_TRUE;
action.sa_sigaction = _sigusr1; action.sa_sigaction = _sigusr1;
action.sa_flags = SA_RESETHAND; action.sa_flags = SA_RESETHAND;
sigemptyset(&action.sa_mask); sigemptyset(&action.sa_mask);
@ -244,7 +244,7 @@ main(int argc, char **argv)
Eina_Bool really_know = EINA_FALSE; Eina_Bool really_know = EINA_FALSE;
struct sigaction action; struct sigaction action;
#if !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__) && \ #if !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__) && \
!(defined (__MACH__) && defined (__APPLE__)) !(defined (__MACH__) && defined (__APPLE__))
Eina_Bool restart = EINA_TRUE; Eina_Bool restart = EINA_TRUE;
#endif #endif
@ -252,12 +252,12 @@ main(int argc, char **argv)
action.sa_flags = SA_RESETHAND; action.sa_flags = SA_RESETHAND;
sigemptyset(&action.sa_mask); sigemptyset(&action.sa_mask);
sigaction(SIGUSR1, &action, NULL); sigaction(SIGUSR1, &action, NULL);
eina_init(); eina_init();
/* reexcute myself with dbus-launch if dbus-launch is not running yet */ /* reexcute myself with dbus-launch if dbus-launch is not running yet */
if ((!getenv("DBUS_SESSION_BUS_ADDRESS")) && if ((!getenv("DBUS_SESSION_BUS_ADDRESS")) &&
(!getenv("DBUS_LAUNCHD_SESSION_BUS_SOCKET"))) (!getenv("DBUS_LAUNCHD_SESSION_BUS_SOCKET")))
{ {
char **dbus_argv; char **dbus_argv;
@ -410,7 +410,7 @@ main(int argc, char **argv)
/* not run at the moment !! */ /* not run at the moment !! */
#if !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__) && \ #if !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__FreeBSD__) && \
!(defined (__MACH__) && defined (__APPLE__)) !(defined (__MACH__) && defined (__APPLE__))
/* Now looping until */ /* Now looping until */
while (restart) while (restart)
{ {
@ -451,10 +451,10 @@ main(int argc, char **argv)
#endif #endif
while (!done) while (!done)
{ {
Eina_Bool remember_sigill = EINA_FALSE; Eina_Bool remember_sigill = EINA_FALSE;
Eina_Bool remember_sigusr1 = EINA_FALSE; Eina_Bool remember_sigusr1 = EINA_FALSE;
result = waitpid(child, &status, 0); result = waitpid(child, &status, 0);
if (result == child) if (result == child)
{ {
@ -467,25 +467,25 @@ main(int argc, char **argv)
int back; int back;
#ifdef HAVE_SYS_PTRACE_H #ifdef HAVE_SYS_PTRACE_H
if (!really_know) if (!really_know)
r = ptrace(PTRACE_GETSIGINFO, child, NULL, &sig); r = ptrace(PTRACE_GETSIGINFO, child, NULL, &sig);
#endif #endif
back = r == 0 && back = r == 0 &&
sig.si_signo != SIGTRAP ? sig.si_signo : 0; sig.si_signo != SIGTRAP ? sig.si_signo : 0;
if (sig.si_signo == SIGUSR1) if (sig.si_signo == SIGUSR1)
{ {
if (remember_sigill) if (remember_sigill)
remember_sigusr1 = EINA_TRUE; remember_sigusr1 = EINA_TRUE;
} }
else if (sig.si_signo == SIGILL) else if (sig.si_signo == SIGILL)
{ {
remember_sigill = EINA_TRUE; remember_sigill = EINA_TRUE;
} }
else else
{ {
remember_sigill = EINA_FALSE; remember_sigill = EINA_FALSE;
} }
if (r != 0 || if (r != 0 ||
(sig.si_signo != SIGSEGV && (sig.si_signo != SIGSEGV &&
@ -497,7 +497,7 @@ main(int argc, char **argv)
if (!really_know) if (!really_know)
ptrace(PT_CONTINUE, child, NULL, back); ptrace(PT_CONTINUE, child, NULL, back);
#endif #endif
continue ; continue;
} }
#ifdef HAVE_SYS_PTRACE_H #ifdef HAVE_SYS_PTRACE_H
if (!really_know) if (!really_know)

View File

@ -6,8 +6,8 @@
*/ */
/* local subsystem functions */ /* local subsystem functions */
static void _e_startup(void); static void _e_startup(void);
static void _e_startup_next_cb(void *data); static void _e_startup_next_cb(void *data);
static Eina_Bool _e_startup_event_cb(void *data, int ev_type, void *ev); static Eina_Bool _e_startup_event_cb(void *data, int ev_type, void *ev);
/* local subsystem globals */ /* local subsystem globals */
@ -23,20 +23,20 @@ e_startup(E_Startup_Mode mode)
if (mode == E_STARTUP_START) if (mode == E_STARTUP_START)
{ {
e_user_dir_concat_static(buf, "applications/startup/.order"); e_user_dir_concat_static(buf, "applications/startup/.order");
if (!ecore_file_exists(buf)) if (!ecore_file_exists(buf))
e_prefix_data_concat_static(buf, "data/applications/startup/.order"); e_prefix_data_concat_static(buf, "data/applications/startup/.order");
} }
else if (mode == E_STARTUP_RESTART) else if (mode == E_STARTUP_RESTART)
{ {
e_user_dir_concat_static(buf, "applications/restart/.order"); e_user_dir_concat_static(buf, "applications/restart/.order");
if (!ecore_file_exists(buf)) if (!ecore_file_exists(buf))
e_prefix_data_concat_static(buf, "data/applications/restart/.order"); e_prefix_data_concat_static(buf, "data/applications/restart/.order");
} }
desktop_cache_update_handler = desktop_cache_update_handler =
ecore_event_handler_add(EFREET_EVENT_DESKTOP_CACHE_BUILD, ecore_event_handler_add(EFREET_EVENT_DESKTOP_CACHE_BUILD,
_e_startup_event_cb, _e_startup_event_cb,
strdup(buf)); strdup(buf));
e_init_undone(); e_init_undone();
} }
@ -49,18 +49,18 @@ _e_startup(void)
if (!startup_apps) if (!startup_apps)
{ {
e_init_done(); e_init_done();
return; return;
} }
desktop = eina_list_nth(startup_apps->desktops, start_app_pos); desktop = eina_list_nth(startup_apps->desktops, start_app_pos);
start_app_pos++; start_app_pos++;
if (!desktop) if (!desktop)
{ {
e_object_del(E_OBJECT(startup_apps)); e_object_del(E_OBJECT(startup_apps));
startup_apps = NULL; startup_apps = NULL;
start_app_pos = -1; start_app_pos = -1;
e_init_done(); e_init_done();
return; return;
} }
e_exec(NULL, desktop, NULL, NULL, NULL); e_exec(NULL, desktop, NULL, NULL, NULL);
snprintf(buf, sizeof(buf), "%s %s", _("Starting"), desktop->name); snprintf(buf, sizeof(buf), "%s %s", _("Starting"), desktop->name);
@ -83,8 +83,9 @@ _e_startup_event_cb(void *data, int ev_type __UNUSED__, void *ev __UNUSED__)
buf = data; buf = data;
startup_apps = e_order_new(buf); startup_apps = e_order_new(buf);
if (startup_apps) if (startup_apps)
start_app_pos = 0; start_app_pos = 0;
free(buf); free(buf);
_e_startup(); _e_startup();
return ECORE_CALLBACK_PASS_ON; return ECORE_CALLBACK_PASS_ON;
} }