E: Make E work with the new XCB stuffs. This breaks out e_alert into

it's own utility (as per raster's request/idea). Remove explicit
x_clags in Makefile.am(s) as they are no longer needed.

NB: I added some additional libs to the precache stuffs (even tho it's
not used right now). Also a newer e_main (more optimized).

NB: IF you are brave and want to test this, build evas w/ xcb, build
ecore w/ xcb, then rebuild E. Also, disable building opengl in both
evas & ecore (it's not ready for public consumption when paired w/ xcb).



SVN revision: 61680
This commit is contained in:
Christopher Michael 2011-07-25 09:40:18 +00:00
parent bc5f550546
commit 1a13f8c26f
17 changed files with 2356 additions and 1850 deletions

View File

@ -77,7 +77,7 @@ EFL_CHECK_PATH_MAX
AC_CHECK_FUNCS(setenv)
AC_CHECK_FUNCS(unsetenv)
AC_CHECK_HEADERS(X11/extensions/shape.h,, AC_MSG_ERROR([Cannot find X11/extensions/shape.h. Make sure your CFLAGS environment variable contains include lines for the location of this file]))
dnl AC_CHECK_HEADERS(X11/extensions/shape.h,, AC_MSG_ERROR([Cannot find X11/extensions/shape.h. Make sure your CFLAGS environment variable contains include lines for the location of this file]))
AC_CHECK_HEADERS(fnmatch.h,, AC_MSG_ERROR([Cannot find fnmatch.h. Make sure your CFLAGS environment variable contains include lines for the location of this file]))
@ -160,25 +160,25 @@ AC_ARG_ENABLE(simple-x11,
[ want_evas_simple_x11=$enableval ]
)
x_dir=""
x_cflags=""
x_libs=""
AC_PATH_XTRA
AC_CHECK_HEADER(X11/X.h,
[
if test "x$want_evas_simple_x11" = "xyes"; then
x_libs="${x_libs} -lX11 -lXext"
else
x_dir=${x_dir:-/usr/X11R6}
x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext"
fi
],[
AC_MSG_ERROR([Cannot find X headers and libraries.])
]
)
AC_SUBST(x_cflags)
AC_SUBST(x_libs)
dnl x_dir=""
dnl x_cflags=""
dnl x_libs=""
dnl AC_PATH_XTRA
dnl AC_CHECK_HEADER(X11/X.h,
dnl [
dnl if test "x$want_evas_simple_x11" = "xyes"; then
dnl x_libs="${x_libs} -lX11 -lXext"
dnl else
dnl x_dir=${x_dir:-/usr/X11R6}
dnl x_cflags=${x_cflags:--I${x_includes:-$x_dir/include}}
dnl x_libs="${x_libs:--L${x_libraries:-$x_dir/lib}} -lX11 -lXext"
dnl fi
dnl ],[
dnl AC_MSG_ERROR([Cannot find X headers and libraries.])
dnl ]
dnl )
dnl AC_SUBST(x_cflags)
dnl AC_SUBST(x_libs)
cf_cflags=""
cf_libs=""
@ -372,12 +372,16 @@ eeze_mount=
EEZE_MOUNT_CONFIG=0
if test "x$e_cv_want_mount_eeze" != "xno" ; then
AC_CHECK_LIB([eeze], [eeze_disk_function],
## [
## eeze_mount="eeze >= 1.1.0"
## EEZE_MOUNT_CONFIG=1
## AC_DEFINE_UNQUOTED([HAVE_EEZE_MOUNT], [1], [enable eeze mounting])
## AC_MSG_NOTICE([eeze mounting enabled])
## ],
[
eeze_mount="eeze >= 1.0.99 ecore-con >= 1.0.999"
EEZE_MOUNT_CONFIG=1
AC_DEFINE_UNQUOTED([HAVE_EEZE_MOUNT], [1], [enable eeze mounting])
AC_MSG_NOTICE([eeze mounting enabled])
],
AC_MSG_NOTICE([eeze mounting disabled])
e_cv_want_mount_eeze=no
]
)
else
AC_MSG_NOTICE([eeze mounting disabled])
@ -390,7 +394,7 @@ AM_CONDITIONAL([HAVE_EEZE_MOUNT], [false])
test -n "$hal_mount" && AC_DEFINE_UNQUOTED([HAVE_HAL_MOUNT], [1], [enable HAL mounting])
test -n "$udisks_mount" && AC_DEFINE_UNQUOTED([HAVE_UDISKS_MOUNT], [1], [enable Udisks mounting])
AM_CONDITIONAL([HAVE_UDISKS_MOUNT], [test -n "$udisks_mount"])
AM_CONDITIONAL([HAVE_EEZE_MOUNT], [test -n "$eeze_mount"])
##AM_CONDITIONAL([HAVE_EEZE_MOUNT], [test -n "$eeze_mount"])
# doxygen program for documentation building
@ -442,6 +446,7 @@ PKG_CHECK_MODULES(E_FM_OP, [
PKG_CHECK_MODULES(E_FM_OPEN, [
ecore >= 1.0.999
ecore-ipc >= 1.0.999
ecore-con >= 1.0.999
eet >= 1.4.0
eina >= 1.0.999
])
@ -460,6 +465,13 @@ PKG_CHECK_MODULES(E_INIT, [
eina >= 1.0.999
])
PKG_CHECK_MODULES(E_ALERT, [
xcb
eina >= 1.0.999
ecore >= 1.0.999
ecore-ipc >= 1.0.999
])
PKG_CHECK_MODULES(E, [
evas >= 1.0.999
ecore >= 1.0.999

View File

@ -9,7 +9,6 @@ INCLUDES = \
-I$(top_srcdir) \
-I$(top_srcdir)/src/bin \
@e_cflags@ \
@x_cflags@ \
@cf_cflags@ \
@VALGRIND_CFLAGS@ \
@EDJE_DEF@ \
@ -30,7 +29,8 @@ enlightenment_fm_op \
enlightenment_init \
enlightenment_sys \
enlightenment_thumb \
enlightenment_backlight
enlightenment_backlight \
enlightenment_alert
ENLIGHTENMENTHEADERS = \
e_about.h \
@ -184,8 +184,8 @@ e_zone.h
enlightenment_src = \
e_about.c \
e_acpi.c \
e_actions.c \
e_alert.c \
e_actions.c \
e_atoms.c \
e_backlight.c \
e_bg.c \
@ -331,7 +331,7 @@ e_main.c \
$(enlightenment_src)
enlightenment_LDFLAGS = -export-dynamic
enlightenment_LDADD = @e_libs@ @x_libs@ @dlopen_libs@ @cf_libs@ @VALGRIND_LIBS@ -lm
enlightenment_LDADD = @e_libs@ @dlopen_libs@ @cf_libs@ @VALGRIND_LIBS@ -lm
enlightenment_imc_SOURCES = \
e.h \
@ -375,6 +375,12 @@ e_xinerama.c
enlightenment_init_LDADD = @E_INIT_LIBS@
enlightenment_alert_SOURCES = \
e_alert_main.c
enlightenment_alert_LDADD = @E_ALERT_LIBS@
enlightenment_alert_CFLAGS = @E_ALERT_CFLAGS@
# HACK! why install-data-hook? install-exec-hook is run after bin_PROGRAMS
# and before internal_bin_PROGRAMS are installed. install-data-hook is
# run after both

View File

@ -1,117 +1,117 @@
#ifndef E_H
#define E_H
# define E_H
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
# ifdef HAVE_CONFIG_H
# include "config.h"
# endif
#define USE_IPC
#if 0
#define OBJECT_PARANOIA_CHECK
#define OBJECT_CHECK
#endif
# define USE_IPC
# if 0
# define OBJECT_PARANOIA_CHECK
# define OBJECT_CHECK
# endif
#ifndef _FILE_OFFSET_BITS
#define _FILE_OFFSET_BITS 64
#endif
# ifndef _FILE_OFFSET_BITS
# define _FILE_OFFSET_BITS 64
# endif
#ifdef HAVE_ALLOCA_H
# ifdef HAVE_ALLOCA_H
# include <alloca.h>
#elif defined __GNUC__
# elif defined __GNUC__
# define alloca __builtin_alloca
#elif defined _AIX
# elif defined _AIX
# define alloca __alloca
#elif defined _MSC_VER
# elif defined _MSC_VER
# include <malloc.h>
# define alloca _alloca
#else
# else
# include <stddef.h>
# ifdef __cplusplus
extern "C"
# endif
void *alloca (size_t);
#endif
# endif
# ifdef __linux__
# include <features.h>
# endif
#ifdef __linux__
#include <features.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/param.h>
#include <utime.h>
#include <dlfcn.h>
#include <math.h>
#include <fnmatch.h>
#include <limits.h>
#include <ctype.h>
#include <time.h>
#include <dirent.h>
#include <pwd.h>
#include <grp.h>
#include <glob.h>
#include <locale.h>
#include <errno.h>
#include <signal.h>
#include <inttypes.h>
#include <sys/time.h>
#include <sys/resource.h>
# include <stdio.h>
# include <stdlib.h>
# include <unistd.h>
# include <string.h>
# include <sys/types.h>
# include <sys/stat.h>
# include <sys/time.h>
# include <sys/param.h>
# include <sys/resource.h>
# include <utime.h>
# include <dlfcn.h>
# include <math.h>
# include <fcntl.h>
# include <fnmatch.h>
# include <limits.h>
# include <ctype.h>
# include <time.h>
# include <dirent.h>
# include <pwd.h>
# include <grp.h>
# include <glob.h>
# include <locale.h>
# include <errno.h>
# include <signal.h>
# include <inttypes.h>
#ifdef HAVE_GETTEXT
# ifdef HAVE_GETTEXT
# include <libintl.h>
#endif
# endif
#ifndef _POSIX_HOST_NAME_MAX
#define _POSIX_HOST_NAME_MAX 255
#endif
# ifndef _POSIX_HOST_NAME_MAX
# define _POSIX_HOST_NAME_MAX 255
# endif
#ifdef HAVE_VALGRIND
# ifdef HAVE_VALGRIND
# include <memcheck.h>
#endif
# endif
#ifdef __GLIBC__
#include <execinfo.h>
#include <setjmp.h>
#endif
# ifdef __GLIBC__
# include <execinfo.h>
# include <setjmp.h>
# endif
#include <Eina.h>
#include <Evas.h>
#include <Evas_Engine_Buffer.h>
#include <Ecore.h>
#include <Ecore_X.h>
#include <Ecore_Evas.h>
#include <Ecore_Input.h>
#include <Ecore_Input_Evas.h>
#include <Ecore_Con.h>
#include <Ecore_Ipc.h>
#include <Ecore_File.h>
#include <Eet.h>
#include <Edje.h>
#include <Efreet.h>
#include <Efreet_Mime.h>
#include <E_DBus.h>
# include <Eina.h>
# include <Eet.h>
# include <Evas.h>
# include <Evas_Engine_Buffer.h>
# include <Ecore.h>
# include <Ecore_X.h>
# include <Ecore_Evas.h>
# include <Ecore_Input.h>
# include <Ecore_Input_Evas.h>
# include <Ecore_Con.h>
# include <Ecore_Ipc.h>
# include <Ecore_File.h>
# include <Efreet.h>
# include <Efreet_Mime.h>
# include <Edje.h>
# include <E_DBus.h>
#ifdef EAPI
#undef EAPI
#endif
#ifdef WIN32
# ifdef EAPI
# undef EAPI
# endif
# ifdef WIN32
# ifdef BUILDING_DLL
# define EAPI __declspec(dllexport)
# else
# define EAPI __declspec(dllimport)
# endif
#else
# else
# ifdef __GNUC__
# if __GNUC__ >= 4
/* BROKEN in gcc 4 on amd64 */
#if 0
# if 0
# pragma GCC visibility push(hidden)
#endif
# endif
# define EAPI __attribute__ ((visibility("default")))
# else
# define EAPI
@ -119,35 +119,39 @@ void *alloca (size_t);
# else
# define EAPI
# endif
#endif
# endif
#ifdef EINTERN
#undef EINTERN
#endif
#ifdef __GNUC__
# ifdef EINTERN
# undef EINTERN
# endif
# ifdef __GNUC__
# if __GNUC__ >= 4
# define EINTERN __attribute__ ((visibility("hidden")))
# else
# define EINTERN
# endif
#else
# else
# define EINTERN
#endif
# endif
typedef struct _E_Before_Idler E_Before_Idler;
typedef struct _E_Rect E_Rect;
/* convenience macro to compress code and avoid typos */
#define E_FN_DEL(_fn, _h) if (_h) { _fn(_h); _h = NULL; }
#define E_INTERSECTS(x, y, w, h, xx, yy, ww, hh) (((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && (((x) + (w)) > (xx)) && (((y) + (h)) > (yy)))
#define E_INSIDE(x, y, xx, yy, ww, hh) (((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && ((x) >= (xx)) && ((y) >= (yy)))
#define E_CONTAINS(x, y, w, h, xx, yy, ww, hh) (((xx) >= (x)) && (((x) + (w)) >= ((xx) + (ww))) && ((yy) >= (y)) && (((y) + (h)) >= ((yy) + (hh))))
#define E_SPANS_COMMON(x1, w1, x2, w2) (!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
#define E_REALLOC(p, s, n) p = (s *)realloc(p, sizeof(s) * n)
#define E_NEW(s, n) (s *)calloc(n, sizeof(s))
#define E_NEW_RAW(s, n) (s *)malloc(n * sizeof(s))
#define E_FREE(p) do { free(p); p = NULL; } while (0)
#define E_FREE_LIST(list, free) \
# define E_FN_DEL(_fn, _h) if (_h) { _fn(_h); _h = NULL; }
# define E_INTERSECTS(x, y, w, h, xx, yy, ww, hh) \
(((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && (((x) + (w)) > (xx)) && (((y) + (h)) > (yy)))
# define E_INSIDE(x, y, xx, yy, ww, hh) \
(((x) < ((xx) + (ww))) && ((y) < ((yy) + (hh))) && ((x) >= (xx)) && ((y) >= (yy)))
# define E_CONTAINS(x, y, w, h, xx, yy, ww, hh) \
(((xx) >= (x)) && (((x) + (w)) >= ((xx) + (ww))) && ((yy) >= (y)) && (((y) + (h)) >= ((yy) + (hh))))
# define E_SPANS_COMMON(x1, w1, x2, w2) \
(!((((x2) + (w2)) <= (x1)) || ((x2) >= ((x1) + (w1)))))
# define E_REALLOC(p, s, n) p = (s *)realloc(p, sizeof(s) * n)
# define E_NEW(s, n) (s *)calloc(n, sizeof(s))
# define E_NEW_RAW(s, n) (s *)malloc(n * sizeof(s))
# define E_FREE(p) do { free(p); p = NULL; } while (0)
# define E_FREE_LIST(list, free) \
do \
{ \
if (list) \
@ -162,8 +166,8 @@ typedef struct _E_Rect E_Rect;
} \
while (0)
#define E_CLAMP(x, min, max) (x < min ? min : (x > max ? max : x))
#define E_RECTS_CLIP_TO_RECT(_x, _y, _w, _h, _cx, _cy, _cw, _ch) \
# define E_CLAMP(x, min, max) (x < min ? min : (x > max ? max : x))
# define E_RECTS_CLIP_TO_RECT(_x, _y, _w, _h, _cx, _cy, _cw, _ch) \
{ \
if (E_INTERSECTS(_x, _y, _w, _h, _cx, _cy, _cw, _ch)) \
{ \
@ -190,28 +194,27 @@ typedef struct _E_Rect E_Rect;
} \
}
#define E_REMOTE_OPTIONS 1
#define E_REMOTE_OUT 2
#define E_WM_IN 3
#define E_REMOTE_IN 4
#define E_ENUM 5
#define E_LIB_IN 6
# define E_REMOTE_OPTIONS 1
# define E_REMOTE_OUT 2
# define E_WM_IN 3
# define E_REMOTE_IN 4
# define E_ENUM 5
# define E_LIB_IN 6
#define E_TYPEDEFS 1
#include "e_includes.h"
#undef E_TYPEDEFS
#include "e_includes.h"
# define E_TYPEDEFS 1
# include "e_includes.h"
# undef E_TYPEDEFS
# include "e_includes.h"
EAPI E_Before_Idler *e_main_idler_before_add(int (*func) (void *data), void *data, int once);
EAPI void e_main_idler_before_del(E_Before_Idler *eb);
struct _E_Before_Idler
{
int (*func) (void *data);
void *data;
unsigned char once : 1;
unsigned char delete_me : 1;
Eina_Bool once : 1;
Eina_Bool delete_me : 1;
};
struct _E_Rect
@ -227,14 +230,15 @@ extern EAPI E_Path *path_icons;
extern EAPI E_Path *path_modules;
extern EAPI E_Path *path_backgrounds;
extern EAPI E_Path *path_messages;
extern EAPI int restart;
extern EAPI int good;
extern EAPI int evil;
extern EAPI int starting;
extern EAPI int stopping;
extern EAPI Eina_Bool good;
extern EAPI Eina_Bool evil;
extern EAPI Eina_Bool starting;
extern EAPI Eina_Bool stopping;
extern EAPI Eina_Bool restart;
extern EAPI Eina_Bool e_precache_end;
extern EAPI Eina_Bool x_fatal;
extern EAPI unsigned long e_alert_composite_win;
//extern EAPI unsigned long e_alert_composite_win;
#endif

View File

@ -1,74 +1,17 @@
#include "e.h"
#include "e_alert.h"
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <unistd.h>
#include <signal.h>
#include <X11/Xlib.h>
#include <X11/X.h>
#include <X11/extensions/shape.h>
#include <Ecore.h>
/* local function prototypes */
static Eina_Bool _e_alert_cb_exe_del(void *data __UNUSED__, int type __UNUSED__, void *event);
/* local subsystem functions */
/* local variables */
static Ecore_Exe *alert_exe = NULL;
static Ecore_Event_Handler *alert_exe_hdl = NULL;
/* local subsystem globals */
static Display *dd = NULL;
static char *title = NULL, *str1 = NULL, *str2 = NULL;
static Font font = 0;
static XFontStruct *fs = NULL;
static GC gc = 0;
static Window win = 0, b1 = 0, b2 = 0;
static int ww = 320, hh = 240, wx = 20, wy = 20;
EAPI unsigned long e_alert_composite_win = 0;
/* externally accessible functions */
EINTERN int
e_alert_init(const char *disp)
e_alert_init(void)
{
XGCValues gcv;
int wid, hih, mask;
XSetWindowAttributes att;
dd = XOpenDisplay(disp);
if (!dd) return 0;
font = XLoadFont(dd, "fixed");
fs = XQueryFont(dd, font);
/* dont i18n this - i dont want gettext doing anything as this is called
from a segv */
title = "Enlightenment Error";
str1 = "(F1) Recover";
str2 = "(F2) Exit";
wid = DisplayWidth(dd, DefaultScreen(dd));
hih = DisplayHeight(dd, DefaultScreen(dd));
att.background_pixel = WhitePixel(dd, DefaultScreen(dd));
att.border_pixel = BlackPixel(dd, DefaultScreen(dd));
att.override_redirect = True;
mask = CWBackPixel | CWBorderPixel | CWOverrideRedirect;
wx = (wid - ww) / 2;
wy = (hih - hh) / 2;
win = XCreateWindow(dd, DefaultRootWindow(dd),
wx, wy, ww, hh, 0,
CopyFromParent, InputOutput,
CopyFromParent, mask, &att);
b1 = XCreateWindow(dd, win, -100, -100, 1, 1, 0, CopyFromParent,
InputOutput, CopyFromParent, mask, &att);
b2 = XCreateWindow(dd, win, -100, -100, 1, 1, 0, CopyFromParent,
InputOutput, CopyFromParent, mask, &att);
XMapWindow(dd, b1);
XMapWindow(dd, b2);
gc = XCreateGC(dd, win, 0, &gcv);
XSetForeground(dd, gc, att.border_pixel);
XSelectInput(dd, win, KeyPressMask | KeyReleaseMask | ExposureMask);
alert_exe_hdl =
ecore_event_handler_add(ECORE_EXE_EVENT_DEL, _e_alert_cb_exe_del, NULL);
return 1;
}
@ -76,154 +19,42 @@ e_alert_init(const char *disp)
EINTERN int
e_alert_shutdown(void)
{
if (!x_fatal)
{
XDestroyWindow(dd, win);
XFreeGC(dd, gc);
XFreeFont(dd, fs);
XCloseDisplay(dd);
}
title = NULL;
str1 = NULL;
str2 = NULL;
dd = NULL;
font = 0;
fs = NULL;
gc = 0;
e_alert_hide();
if (alert_exe_hdl) ecore_event_handler_del(alert_exe_hdl);
alert_exe_hdl = NULL;
return 1;
}
EAPI void
e_alert_show(const char *text)
e_alert_show(int sig)
{
int w, i, j, k;
char line[1024];
XEvent ev;
int fw, fh, mh;
KeyCode key;
int button;
char buf[8192];
if (!text) return;
snprintf(buf, sizeof(buf),
"%s/enlightenment/utils/enlightenment_alert %d %d",
e_prefix_lib_get(), sig, getpid());
if ((!dd) || (!fs))
{
fputs(text, stderr);
fflush(stderr);
exit(1);
}
fh = fs->ascent + fs->descent;
mh = ((ww - 20) / 2) - 20;
/* fixed size... */
w = 20;
XMoveResizeWindow(dd, b1, w, hh - 15 - fh, mh + 10, fh + 10);
XSelectInput(dd, b1, ButtonPressMask | ButtonReleaseMask | ExposureMask);
w = ww - 20 - mh;
XMoveResizeWindow(dd, b2, w, hh - 15 - fh, mh + 10, fh + 10);
XSelectInput(dd, b2, ButtonPressMask | ButtonReleaseMask | ExposureMask);
if (e_alert_composite_win)
{
#ifdef ShapeInput
XRectangle rect;
rect.x = wx;
rect.y = wy;
rect.width = ww;
rect.height = hh;
XShapeCombineRectangles(dd, e_alert_composite_win, ShapeInput,
0, 0, &rect, 1, ShapeSet, Unsorted);
#endif
XReparentWindow(dd, win, e_alert_composite_win, wx, wy);
}
XMapRaised(dd, win);
XGrabPointer(dd, win, True, ButtonPressMask | ButtonReleaseMask,
GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
XGrabKeyboard(dd, win, False, GrabModeAsync, GrabModeAsync, CurrentTime);
XSetInputFocus(dd, win, RevertToPointerRoot, CurrentTime);
XSync(dd, False);
button = 0;
while (button == 0)
{
XNextEvent(dd, &ev);
switch (ev.type)
{
case KeyPress:
key = XKeysymToKeycode(dd, XStringToKeysym("F1"));
if (key == ev.xkey.keycode)
{
button = 1;
break;
}
key = XKeysymToKeycode(dd, XStringToKeysym("F2"));
if (key == ev.xkey.keycode)
{
button = 2;
break;
}
break;
case ButtonPress:
if (ev.xbutton.window == b1)
button = 1;
else if (ev.xbutton.window == b2)
button = 2;
break;
case Expose:
while (XCheckTypedWindowEvent(dd, ev.xexpose.window, Expose, &ev));
/* outline */
XDrawRectangle(dd, win, gc, 0, 0, ww - 1, hh - 1);
XDrawRectangle(dd, win, gc, 2, 2, ww - 4 - 1, fh + 4 - 1);
fw = XTextWidth(fs, title, strlen(title));
XDrawString(dd, win, gc, 2 + 2 + ((ww - 4 - 4 - fw) / 2) , 2 + 2 + fs->ascent, title, strlen(title));
i = 0;
j = 0;
k = 2 + fh + 4 + 2;
while (text[i])
{
line[j++] = text[i++];
if (line[j - 1] == '\n')
{
line[j - 1] = 0;
j = 0;
XDrawString(dd, win, gc, 4, k + fs->ascent, line, strlen(line));
k += fh + 2;
}
}
fw = XTextWidth(fs, str1, strlen(str1));
XDrawRectangle(dd, b1, gc, 0, 0, mh - 1, fh + 10 - 1);
XDrawString(dd, b1, gc, 5 + ((mh - fw) / 2), 5 + fs->ascent, str1, strlen(str1));
fw = XTextWidth(fs, str2, strlen(str2));
XDrawRectangle(dd, b2, gc, 0, 0, mh - 1, fh + 10 - 1);
XDrawString(dd, b2, gc, 5 + ((mh - fw) / 2), 5 + fs->ascent, str2, strlen(str2));
XSync(dd, False);
break;
default:
break;
}
}
XDestroyWindow(dd, win);
XSync(dd, False);
switch (button)
{
case 1:
ecore_app_restart();
break;
case 2:
exit(-11);
break;
default:
break;
}
alert_exe = ecore_exe_run(buf, NULL);
pause();
}
/* local subsystem functions */
EAPI void
e_alert_hide(void)
{
if (alert_exe) ecore_exe_terminate(alert_exe);
}
/* local functions */
static Eina_Bool
_e_alert_cb_exe_del(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Exe_Event_Del *ev;
ev = event;
if (!alert_exe) return ECORE_CALLBACK_RENEW;
if (ev->exe == alert_exe) alert_exe = NULL;
return ECORE_CALLBACK_RENEW;
}

View File

@ -1,13 +1,20 @@
#ifdef E_TYPEDEFS
typedef enum _E_Alert_Op_Type
{
E_ALERT_OP_RESTART = 0,
E_ALERT_OP_EXIT
} E_Alert_Op_Type;
#else
#ifndef E_ALERT_H
#define E_ALERT_H
EINTERN int e_alert_init(const char *disp);
EINTERN int e_alert_init(void);
EINTERN int e_alert_shutdown(void);
void e_alert_show(const char *text);
EAPI void e_alert_show(int sig);
EAPI void e_alert_hide(void);
#endif
#endif

615
src/bin/e_alert_main.c Normal file
View File

@ -0,0 +1,615 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <sys/types.h>
#include <unistd.h>
#include <signal.h>
#include <limits.h>
#include <Eina.h>
#include <Ecore.h>
#include <Ecore_Ipc.h>
#include <xcb/xcb.h>
#define WINDOW_WIDTH 320
#define WINDOW_HEIGHT 240
/* local function prototypes */
static int _e_alert_ipc_init(void);
static Eina_Bool _e_alert_ipc_server_add(void *data, int type, void *event);
static int _e_alert_connect(void);
static void _e_alert_create(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_window_raise(xcb_window_t win);
static void _e_alert_sync(void);
static void _e_alert_shutdown(void);
static void _e_alert_run(void);
static void _e_alert_draw(void);
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 xcb_char2b_t *_e_alert_build_string(const char *str);
static void _e_alert_draw_outline(void);
static void _e_alert_draw_title_outline(void);
static void _e_alert_draw_title(void);
static void _e_alert_draw_text(void);
static void _e_alert_draw_button_outlines(void);
static void _e_alert_draw_button_text(void);
static void _e_alert_restart_e(void);
static void _e_alert_exit_e(void);
/* local variables */
static Ecore_Ipc_Server *_ipc_server = NULL;
static Ecore_Ipc_Server *_server = NULL;
static xcb_connection_t *conn = NULL;
static xcb_screen_t *screen = NULL;
static xcb_window_t win = 0;
static xcb_window_t btn1 = 0;
static xcb_window_t btn2 = 0;
static xcb_font_t font = 0;
static xcb_gcontext_t gc = 0;
static int sw = 0, sh = 0;
static int fa = 0, fh = 0, fw = 0;
static const char *title = NULL, *str1 = NULL, *str2 = NULL;
static int ret = 0, sig = 0;
static pid_t pid;
int
main(int argc, char **argv)
{
int i = 0;
for (i = 1; i < argc; i++)
{
if ((!strcmp(argv[i], "-h")) ||
(!strcmp(argv[i], "-help")) ||
(!strcmp(argv[i], "--help")))
{
printf("This is an internal tool for Enlightenment.\n"
"do not use it.\n");
exit(0);
}
else if ((i == 1))
sig = atoi(argv[i]); // signal
else if ((i == 2))
pid = atoi(argv[i]); // E's pid
}
if (!ecore_init()) return EXIT_FAILURE;
if (!ecore_ipc_init())
{
ecore_shutdown();
return EXIT_FAILURE;
}
if (!_e_alert_connect())
{
printf("FAILED TO INIT ALERT SYSTEM!!!\n");
ecore_ipc_shutdown();
ecore_shutdown();
return EXIT_FAILURE;
}
if (!_e_alert_ipc_init())
{
printf("Failed to Connect to Enlightenment!!!\n");
ecore_ipc_shutdown();
ecore_shutdown();
return EXIT_FAILURE;
}
title = "Enlightenment Error";
str1 = "(F1) Recover";
str2 = "(F2) Exit";
_e_alert_create();
_e_alert_display();
_e_alert_run();
_e_alert_shutdown();
if (ret == 1)
_e_alert_restart_e();
else if (ret == 2)
_e_alert_exit_e();
if (_ipc_server)
ecore_ipc_server_del(_ipc_server);
ecore_ipc_shutdown();
ecore_shutdown();
return EXIT_SUCCESS;
}
/* local functions */
static int
_e_alert_ipc_init(void)
{
char *edir = NULL;
if (!(edir = getenv("E_IPC_SOCKET"))) return 0;
_ipc_server =
ecore_ipc_server_connect(ECORE_IPC_LOCAL_SYSTEM, edir, 0, NULL);
if (!_ipc_server) return 0;
ecore_event_handler_add(ECORE_IPC_EVENT_SERVER_ADD,
_e_alert_ipc_server_add, NULL);
return 1;
}
static Eina_Bool
_e_alert_ipc_server_add(void *data, int type, void *event)
{
Ecore_Ipc_Event_Server_Add *e;
e = event;
_server = e->server;
return ECORE_CALLBACK_PASS_ON;
}
static int
_e_alert_connect(void)
{
conn = xcb_connect(NULL, NULL);
if ((!conn) || (xcb_connection_has_error(conn)))
{
printf("E_Alert_Main: Error Trying to Connect!!\n");
return 0;
}
/* grab default screen */
screen = xcb_setup_roots_iterator(xcb_get_setup(conn)).data;
sw = screen->width_in_pixels;
sh = screen->height_in_pixels;
return 1;
}
static void
_e_alert_create(void)
{
uint32_t mask, mask_list[4];
int wx = 0, wy = 0;
wx = ((sw - WINDOW_WIDTH) / 2);
wy = ((sh - WINDOW_HEIGHT) / 2);
font = xcb_generate_id(conn);
xcb_open_font(conn, font, strlen("fixed"), "fixed");
/* create main window */
mask = (XCB_CW_BACK_PIXEL | XCB_CW_BORDER_PIXEL |
XCB_CW_OVERRIDE_REDIRECT | XCB_CW_EVENT_MASK);
mask_list[0] = screen->white_pixel;
mask_list[1] = screen->black_pixel;
mask_list[2] = 1;
mask_list[3] = (XCB_EVENT_MASK_KEY_PRESS | XCB_EVENT_MASK_KEY_RELEASE |
XCB_EVENT_MASK_EXPOSURE);
win = xcb_generate_id(conn);
xcb_create_window(conn, XCB_COPY_FROM_PARENT, win, screen->root,
wx, wy, WINDOW_WIDTH, WINDOW_HEIGHT, 0,
XCB_WINDOW_CLASS_INPUT_OUTPUT,
XCB_COPY_FROM_PARENT, mask, mask_list);
/* create button 1 */
mask_list[3] = (XCB_EVENT_MASK_BUTTON_PRESS |
XCB_EVENT_MASK_BUTTON_RELEASE | XCB_EVENT_MASK_EXPOSURE);
btn1 = xcb_generate_id(conn);
xcb_create_window(conn, XCB_COPY_FROM_PARENT, btn1, win,
-100, -100, 1, 1, 0,
XCB_WINDOW_CLASS_INPUT_OUTPUT,
XCB_COPY_FROM_PARENT, mask, mask_list);
xcb_map_window(conn, btn1);
/* create button 2 */
btn2 = xcb_generate_id(conn);
xcb_create_window(conn, XCB_COPY_FROM_PARENT, btn2, win,
-100, -100, 1, 1, 0,
XCB_WINDOW_CLASS_INPUT_OUTPUT,
XCB_COPY_FROM_PARENT, mask, mask_list);
xcb_map_window(conn, btn2);
/* create drawing gc */
mask = (XCB_GC_FOREGROUND | XCB_GC_BACKGROUND | XCB_GC_FONT);
mask_list[0] = screen->black_pixel;
mask_list[1] = screen->white_pixel;
mask_list[2] = font;
gc = xcb_generate_id(conn);
xcb_create_gc(conn, gc, win, mask, mask_list);
}
static void
_e_alert_display(void)
{
xcb_char2b_t *str = NULL;
xcb_query_text_extents_cookie_t cookie;
xcb_query_text_extents_reply_t *reply;
int x = 0, w = 0;
str = _e_alert_build_string(title);
cookie =
xcb_query_text_extents_unchecked(conn, font, strlen(title), str);
reply = xcb_query_text_extents_reply(conn, cookie, NULL);
if (reply)
{
fa = reply->font_ascent;
fh = (fa + reply->font_descent);
fw = reply->overall_width;
free(reply);
}
free(str);
/* move buttons */
x = 20;
w = (WINDOW_WIDTH / 2) - 40;
_e_alert_button_move_resize(btn1, x, WINDOW_HEIGHT - 20 - (fh + 20),
w, (fh + 20));
x = ((WINDOW_WIDTH / 2) + 20);
_e_alert_button_move_resize(btn2, x, WINDOW_HEIGHT - 20 - (fh + 20),
w, (fh + 20));
/* FIXME: May need e_alert_composite_win here and checks for shapedinput */
/* if (e_alert_composite_win) */
/* { */
/* #ifdef ShapeInput */
/* XRectangle rect; */
/* rect.x = wx; */
/* rect.y = wy; */
/* rect.width = ww; */
/* rect.height = hh; */
/* XShapeCombineRectangles(dd, e_alert_composite_win, ShapeInput, */
/* 0, 0, &rect, 1, ShapeSet, Unsorted); */
/* #endif */
/* XReparentWindow(dd, win, e_alert_composite_win, wx, wy); */
/* } */
/* map and raise main window */
xcb_map_window(conn, win);
_e_alert_window_raise(win);
/* grab pointer & keyboard */
xcb_grab_pointer_unchecked(conn, 0, win,
(XCB_EVENT_MASK_BUTTON_PRESS |
XCB_EVENT_MASK_BUTTON_RELEASE),
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC,
XCB_NONE, XCB_NONE, XCB_CURRENT_TIME);
xcb_grab_keyboard_unchecked(conn, 0, win, XCB_CURRENT_TIME,
XCB_GRAB_MODE_ASYNC, XCB_GRAB_MODE_ASYNC);
xcb_set_input_focus(conn, XCB_INPUT_FOCUS_POINTER_ROOT,
win, XCB_CURRENT_TIME);
/* flush screen */
xcb_flush(conn);
/* sync */
_e_alert_sync();
}
static void
_e_alert_button_move_resize(xcb_window_t btn, int x, int y, int w, int h)
{
uint32_t list[4], mask;
if (!btn) return;
mask = (XCB_CONFIG_WINDOW_X | XCB_CONFIG_WINDOW_Y |
XCB_CONFIG_WINDOW_WIDTH | XCB_CONFIG_WINDOW_HEIGHT);
list[0] = x;
list[1] = y;
list[2] = w;
list[3] = h;
xcb_configure_window(conn, btn, mask, (const uint32_t *)&list);
}
static void
_e_alert_window_raise(xcb_window_t win)
{
uint32_t list[] = { XCB_STACK_MODE_ABOVE };
if (!win) return;
xcb_configure_window(conn, win, XCB_CONFIG_WINDOW_STACK_MODE, list);
}
static void
_e_alert_sync(void)
{
xcb_flush(conn);
free(xcb_get_input_focus_reply(conn,
xcb_get_input_focus(conn), NULL));
}
static void
_e_alert_shutdown(void)
{
xcb_close_font(conn, font);
xcb_destroy_window(conn, btn1);
xcb_destroy_window(conn, btn2);
xcb_destroy_window(conn, win);
xcb_free_gc(conn, gc);
xcb_disconnect(conn);
}
static void
_e_alert_run(void)
{
xcb_generic_event_t *event = NULL;
xcb_flush(conn);
while ((event = xcb_wait_for_event(conn)))
{
switch (event->response_type & ~0x80)
{
case XCB_BUTTON_PRESS:
ret = _e_alert_handle_button_press(event);
break;
case XCB_KEY_PRESS:
ret = _e_alert_handle_key_press(event);
break;
case XCB_EXPOSE:
{
xcb_expose_event_t *ev;
ev = (xcb_expose_event_t *)event;
if (ev->window != win) break;
_e_alert_draw();
_e_alert_sync();
break;
}
default:
break;
}
free(event);
if (ret > 0) break;
}
}
static void
_e_alert_draw(void)
{
_e_alert_draw_outline();
_e_alert_draw_title_outline();
_e_alert_draw_title();
_e_alert_draw_text();
_e_alert_draw_button_outlines();
_e_alert_draw_button_text();
xcb_flush(conn);
}
static int
_e_alert_handle_key_press(xcb_generic_event_t *event)
{
xcb_key_press_event_t *ev;
ev = (xcb_key_press_event_t *)event;
if (ev->detail == 67) // F1
return 1;
else if (ev->detail == 68) // F2
return 2;
else
return 0;
}
static int
_e_alert_handle_button_press(xcb_generic_event_t *event)
{
xcb_button_press_event_t *ev;
ev = (xcb_button_press_event_t *)event;
if (ev->child == btn1)
return 1;
else if (ev->child == btn2)
return 2;
else
return 0;
}
static xcb_char2b_t *
_e_alert_build_string(const char *str)
{
unsigned int i = 0;
xcb_char2b_t *ret = NULL;
if (!(ret = malloc(strlen(str) * sizeof(xcb_char2b_t))))
return NULL;
for (i = 0; i < strlen(str); i++)
{
ret[i].byte1 = 0;
ret[i].byte2 = str[i];
}
return ret;
}
static void
_e_alert_draw_outline(void)
{
xcb_rectangle_t rect;
/* draw outline */
rect.x = 0;
rect.y = 0;
rect.width = (WINDOW_WIDTH - 1);
rect.height = (WINDOW_HEIGHT - 1);
xcb_poly_rectangle(conn, win, gc, 1, &rect);
}
static void
_e_alert_draw_title_outline(void)
{
xcb_rectangle_t rect;
/* draw title box */
rect.x = 2;
rect.y = 2;
rect.width = (WINDOW_WIDTH - 4 - 1);
rect.height = (fh + 4 + 2);
xcb_poly_rectangle(conn, win, gc, 1, &rect);
}
static void
_e_alert_draw_title(void)
{
xcb_void_cookie_t cookie;
int x = 0, y = 0;
/* draw title */
x = (2 + 2 + ((WINDOW_WIDTH - 4 - 4 - fw) / 2));
y = (2 + 2 + fh);
cookie =
xcb_image_text_8(conn, strlen(title), win, gc, x, y, title);
}
static void
_e_alert_draw_text(void)
{
xcb_void_cookie_t cookie;
char warn[1024], msg[PATH_MAX], line[1024];
int i = 0, j = 0, k = 0;
snprintf(msg, sizeof(msg),
"This is not meant to happen and is likely a sign of \n"
"a bug in Enlightenment or the libraries it relies \n"
"on. You can gdb attach to this process (%d) now \n"
"to try debug it or you could exit, or just hit \n"
"restart to try and get your desktop back the way \n"
"it was.\n"
"\n"
"Please compile everything with -g in your CFLAGS.", pid);
switch (sig)
{
case SIGSEGV:
snprintf(warn, sizeof(warn),
"This is very bad. Enlightenment SEGV'd.");
break;
case SIGILL:
snprintf(warn, sizeof(warn),
"This is very bad. Enlightenment SIGILL'd.");
break;
case SIGFPE:
snprintf(warn, sizeof(warn),
"This is very bad. Enlightenment SIGFPE'd.");
break;
case SIGBUS:
snprintf(warn, sizeof(warn),
"This is very bad. Enlightenment SIGBUS'd.");
break;
case SIGABRT:
snprintf(warn, sizeof(warn),
"This is very bad. Enlightenment SIGABRT'd.");
break;
default:
break;
}
/* draw text */
k = (fh + 12);
cookie =
xcb_image_text_8(conn, strlen(warn), win, gc,
4, (k + fa), warn);
k += (2 * (fh + 2));
while (msg[i])
{
line[j++] = msg[i++];
if (line[j - 1] == '\n')
{
line[j - 1] = 0;
j = 0;
cookie =
xcb_image_text_8(conn, strlen(line), win, gc,
4, (k + fa), line);
k += (fh + 2);
}
}
}
static void
_e_alert_draw_button_outlines(void)
{
xcb_rectangle_t rect;
rect.x = 0;
rect.y = 0;
rect.width = (WINDOW_WIDTH / 2) - 40 - 1;
rect.height = (fh + 20) - 1;
/* draw button outlines */
xcb_poly_rectangle(conn, btn1, gc, 1, &rect);
xcb_poly_rectangle(conn, btn2, gc, 1, &rect);
}
static void
_e_alert_draw_button_text(void)
{
xcb_void_cookie_t dcookie;
xcb_char2b_t *str = NULL;
xcb_query_text_extents_cookie_t cookie;
xcb_query_text_extents_reply_t *reply;
int x = 0, w = 0, bw = 0;
bw = (WINDOW_WIDTH / 2) - 40 - 1;
/* draw button1 text */
str = _e_alert_build_string(str1);
cookie =
xcb_query_text_extents_unchecked(conn, font, strlen(str1), str);
reply = xcb_query_text_extents_reply(conn, cookie, NULL);
if (reply)
{
w = reply->overall_width;
free(reply);
}
free(str);
x = (5 + ((bw - w) / 2));
dcookie =
xcb_image_text_8(conn, strlen(str1), btn1, gc, x, (10 + fa), str1);
/* draw button2 text */
str = _e_alert_build_string(str2);
cookie =
xcb_query_text_extents_unchecked(conn, font, strlen(str2), str);
reply = xcb_query_text_extents_reply(conn, cookie, NULL);
if (reply)
{
w = reply->overall_width;
free(reply);
}
free(str);
x = (5 + ((bw - w) / 2));
dcookie =
xcb_image_text_8(conn, strlen(str2), btn2, gc, x, (10 + fa), str2);
}
static void
_e_alert_restart_e(void)
{
kill(getppid(), SIGUSR2);
ecore_ipc_server_send(_server, 8, 0, 0, 0, 0, NULL, 0);
ecore_ipc_server_flush(_server);
}
static void
_e_alert_exit_e(void)
{
kill(getppid(), SIGUSR2);
ecore_ipc_server_send(_server, 8, 1, 0, 0, 0, NULL, 0);
ecore_ipc_server_flush(_server);
}

View File

@ -1021,15 +1021,13 @@ e_config_load(void)
{
printf("EEEK! no config of any sort! abort abort abort!\n");
fprintf(stderr, "EEEK! no config of any sort! abort abort abort!\n");
e_alert_show("Enlightenment was started without any configuration\n"
e_error_message_show("Enlightenment was started without any configuration\n"
"files available for the given profile (normally\n"
"default or the last profile used or provided on the\n"
"command-line with -profile etc.)\n"
"\n"
"command-line with -profile etc.)\n\n"
"Cannot contiue without configuration to work with.\n"
"Please ensure you have system or user configuration\n"
"for the profile you are using before proceeeding."
);
"for the profile you are using before proceeeding.");
abort();
}
if (e_config->config_version < E_CONFIG_FILE_VERSION)

View File

@ -6,7 +6,6 @@ AM_CFLAGS = \
-I$(top_srcdir) \
-I$(top_srcdir)/src/bin \
@e_cflags@ \
@x_cflags@ \
@cf_cflags@ \
@VALGRIND_CFLAGS@ \
@EDJE_DEF@ \
@ -61,4 +60,3 @@ $(eeze_s) \
../e_sha1.c
enlightenment_fm_LDADD = @E_FM_LIBS@

View File

@ -2,15 +2,9 @@
#ifdef USE_IPC
/* local subsystem functions */
static Eina_Bool _e_ipc_cb_client_add(void *data __UNUSED__,
int type __UNUSED__,
void *event);
static Eina_Bool _e_ipc_cb_client_del(void *data __UNUSED__,
int type __UNUSED__,
void *event);
static Eina_Bool _e_ipc_cb_client_data(void *data __UNUSED__,
int type __UNUSED__,
void *event);
static Eina_Bool _e_ipc_cb_client_add(void *data __UNUSED__, int type __UNUSED__, void *event);
static Eina_Bool _e_ipc_cb_client_del(void *data __UNUSED__, int type __UNUSED__, void *event);
static Eina_Bool _e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event);
/* local subsystem globals */
static Ecore_Ipc_Server *_e_ipc_server = NULL;
@ -42,8 +36,7 @@ e_ipc_init(void)
if (stat(buf, &st) == 0)
{
if ((st.st_uid ==
getuid()) &&
if ((st.st_uid == getuid()) &&
((st.st_mode & (S_IFDIR | S_IRWXU | S_IRWXG | S_IRWXO)) ==
(S_IRWXU | S_IFDIR)))
{
@ -68,15 +61,19 @@ e_ipc_init(void)
return 0;
}
}
snprintf(buf, sizeof(buf), "%s/enlightenment-%s/disp-%s-%i", tmp, user, disp, pid);
snprintf(buf, sizeof(buf), "%s/enlightenment-%s/disp-%s-%i",
tmp, user, disp, pid);
_e_ipc_server = ecore_ipc_server_add(ECORE_IPC_LOCAL_SYSTEM, buf, 0, NULL);
e_util_env_set("E_IPC_SOCKET", "");
if (!_e_ipc_server) return 0;
e_util_env_set("E_IPC_SOCKET", buf);
printf("INFO: E_IPC_SOCKET=%s\n", buf);
ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD, _e_ipc_cb_client_add, NULL);
ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL, _e_ipc_cb_client_del, NULL);
ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA, _e_ipc_cb_client_data, NULL);
ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_ADD,
_e_ipc_cb_client_add, NULL);
ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DEL,
_e_ipc_cb_client_del, NULL);
ecore_event_handler_add(ECORE_IPC_EVENT_CLIENT_DATA,
_e_ipc_cb_client_data, NULL);
e_ipc_codec_init();
#endif
@ -100,26 +97,24 @@ e_ipc_shutdown(void)
#ifdef USE_IPC
/* local subsystem globals */
static Eina_Bool
_e_ipc_cb_client_add(void *data __UNUSED__,
int type __UNUSED__,
void *event)
_e_ipc_cb_client_add(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Ipc_Event_Client_Add *e;
e = event;
if (ecore_ipc_client_server_get(e->client) != _e_ipc_server) return ECORE_CALLBACK_PASS_ON;
if (ecore_ipc_client_server_get(e->client) != _e_ipc_server)
return ECORE_CALLBACK_PASS_ON;
return ECORE_CALLBACK_PASS_ON;
}
static Eina_Bool
_e_ipc_cb_client_del(void *data __UNUSED__,
int type __UNUSED__,
void *event)
_e_ipc_cb_client_del(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Ipc_Event_Client_Del *e;
e = event;
if (ecore_ipc_client_server_get(e->client) != _e_ipc_server) return ECORE_CALLBACK_PASS_ON;
if (ecore_ipc_client_server_get(e->client) != _e_ipc_server)
return ECORE_CALLBACK_PASS_ON;
/* delete client sruct */
e_thumb_client_del(e);
e_fm2_client_del(e);
@ -129,14 +124,13 @@ _e_ipc_cb_client_del(void *data __UNUSED__,
}
static Eina_Bool
_e_ipc_cb_client_data(void *data __UNUSED__,
int type __UNUSED__,
void *event)
_e_ipc_cb_client_data(void *data __UNUSED__, int type __UNUSED__, void *event)
{
Ecore_Ipc_Event_Client_Data *e;
e = event;
if (ecore_ipc_client_server_get(e->client) != _e_ipc_server) return ECORE_CALLBACK_PASS_ON;
if (ecore_ipc_client_server_get(e->client) != _e_ipc_server)
return ECORE_CALLBACK_PASS_ON;
switch (e->major)
{
case E_IPC_DOMAIN_SETUP:
@ -163,7 +157,7 @@ _e_ipc_cb_client_data(void *data __UNUSED__,
{
E_Action *act = e_action_find(req->str1);
if (act && act->func.go)
if ((act) && (act->func.go))
{
act->func.go(E_OBJECT(man), req->str2);
ok = 1;
@ -208,6 +202,23 @@ _e_ipc_cb_client_data(void *data __UNUSED__,
e_init_client_data(e);
break;
case E_IPC_DOMAIN_ALERT:
{
E_Action *a = NULL;
switch (e->minor)
{
case E_ALERT_OP_RESTART:
a = e_action_find("restart");
break;
case E_ALERT_OP_EXIT:
a = e_action_find("exit");
break;
}
if ((a) && (a->func.go)) a->func.go(NULL, NULL);
break;
}
default:
break;
}

View File

@ -15,6 +15,7 @@ typedef enum _E_Ipc_Domain
E_IPC_DOMAIN_THUMB,
E_IPC_DOMAIN_FM,
E_IPC_DOMAIN_INIT,
E_IPC_DOMAIN_ALERT,
E_IPC_DOMAIN_LAST
} E_Ipc_Domain;

File diff suppressed because it is too large Load Diff

View File

@ -4,7 +4,6 @@
* to add backtrace support.
*/
#include "e.h"
#include <X11/Xlib.h>
#ifdef HAVE_EXECINFO_H
# include <execinfo.h>
@ -15,14 +14,14 @@ static volatile Eina_Bool _e_x_composite_shutdown_try = 0;
static void
_e_x_composite_shutdown(void)
{
Ecore_X_Display *dpy;
// Ecore_X_Display *dpy;
Ecore_X_Window root;
if (_e_x_composite_shutdown_try) return; /* we failed :-( */
_e_x_composite_shutdown_try = 1;
dpy = ecore_x_display_get();
root = DefaultRootWindow(dpy);
// dpy = ecore_x_display_get();
root = ecore_x_window_root_first_get();
/* ignore errors, we really don't care at this point */
ecore_x_composite_unredirect_subwindows(root, ECORE_X_COMPOSITE_UPDATE_MANUAL);
@ -89,16 +88,14 @@ _e_gdb_print_backtrace(int fd)
#define _e_backtrace(msg) _e_backtrace_int(2, msg, sizeof(msg))
static void
_e_backtrace_int(int fd __UNUSED__, const char *msg __UNUSED__, size_t msg_len __UNUSED__)
_e_backtrace_int(int fd, const char *msg, size_t msg_len)
{
/*
char attachmsg[1024];
void *array[255];
size_t size;
*/
return; // disable. causes hangs and problems
/*
_e_write_safe_int(fd, msg, msg_len);
_e_write_safe(fd, "\nBEGIN TRACEBACK\n");
size = backtrace(array, 255);
@ -111,7 +108,6 @@ _e_backtrace_int(int fd __UNUSED__, const char *msg __UNUSED__, size_t msg_len _
_e_write_safe_int(fd, attachmsg, size);
_e_gdb_print_backtrace(fd);
*/
}
/* a tricky little devil, requires e and it's libs to be built
@ -120,108 +116,52 @@ _e_backtrace_int(int fd __UNUSED__, const char *msg __UNUSED__, size_t msg_len _
EAPI void
e_sigseg_act(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__)
{
char msg[1024];
_e_backtrace("**** SEGMENTATION FAULT ****");
_e_x_composite_shutdown();
ecore_x_pointer_ungrab();
ecore_x_keyboard_ungrab();
ecore_x_ungrab();
ecore_x_sync();
snprintf(msg, sizeof(msg),
"This is very bad. Enlightenment SEGV'd.\n"
"\n"
"This is not meant to happen and is likely a sign of\n"
"a bug in Enlightenment or the libraries it relies\n"
"on. You can gdb attach to this process (%d) now\n"
"to try debug it or you could exit, or just hit\n"
"restart to try and get your desktop back the way\n"
"it was.\n"
"\n"
"Please compile everything with -g in your CFLAGS.\n",
getpid());
e_alert_show(msg);
e_alert_show(SIGSEGV);
exit(-11);
}
EAPI void
e_sigill_act(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__)
{
char msg[1024];
_e_backtrace("**** ILLEGAL INSTRUCTION ****");
_e_x_composite_shutdown();
ecore_x_pointer_ungrab();
ecore_x_keyboard_ungrab();
ecore_x_ungrab();
ecore_x_sync();
snprintf(msg, sizeof(msg),
"This is very bad. Enlightenment SIGILL'd.\n"
"\n"
"This is not meant to happen and is likely a sign of\n"
"a bug in Enlightenment or the libraries it relies\n"
"on. You can gdb attach to this process (%d) now\n"
"to try debug it or you could exit, or just hit\n"
"restart to try and get your desktop back the way\n"
"it was.\n"
"\n"
"Please compile everything with -g in your CFLAGS.\n",
getpid());
e_alert_show(msg);
e_alert_show(SIGILL);
exit(-11);
}
EAPI void
e_sigfpe_act(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__)
{
char msg[1024];
_e_backtrace("**** FLOATING POINT EXCEPTION ****");
_e_x_composite_shutdown();
ecore_x_pointer_ungrab();
ecore_x_keyboard_ungrab();
ecore_x_ungrab();
ecore_x_sync();
snprintf(msg, sizeof(msg),
"This is very bad. Enlightenment SIGFPE'd.\n"
"\n"
"This is not meant to happen and is likely a sign of\n"
"a bug in Enlightenment or the libraries it relies\n"
"on. You can gdb attach to this process (%d) now\n"
"to try debug it or you could exit, or just hit\n"
"restart to try and get your desktop back the way\n"
"it was.\n"
"\n"
"Please compile everything with -g in your CFLAGS.\n",
getpid());
e_alert_show(msg);
e_alert_show(SIGFPE);
exit(-11);
}
EAPI void
e_sigbus_act(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED__)
{
char msg[1024];
_e_backtrace("**** BUS ERROR ****");
_e_x_composite_shutdown();
ecore_x_pointer_ungrab();
ecore_x_keyboard_ungrab();
ecore_x_ungrab();
ecore_x_sync();
snprintf(msg, sizeof(msg),
"This is very bad. Enlightenment SIGBUS'd.\n"
"\n"
"This is not meant to happen and is likely a sign of\n"
"a bug in Enlightenment or the libraries it relies\n"
"on. You can gdb attach to this process (%d) now\n"
"to try debug it or you could exit, or just hit\n"
"restart to try and get your desktop back the way\n"
"it was.\n"
"\n"
"Please compile everything with -g in your CFLAGS.\n",
getpid());
e_alert_show(msg);
e_alert_show(SIGBUS);
exit(-11);
}
@ -234,14 +174,6 @@ e_sigabrt_act(int x __UNUSED__, siginfo_t *info __UNUSED__, void *data __UNUSED_
ecore_x_keyboard_ungrab();
ecore_x_ungrab();
ecore_x_sync();
e_alert_show("This is very bad. Enlightenment SIGABRT'd.\n"
"\n"
"This is not meant to happen and is likely a sign of\n"
"a bug in Enlightenment or the libraries it relies\n"
"on. You can gdb attach to this process now to try\n"
"debug it or you could exit, or just hit restart to\n"
"try and get your desktop back the way it was.\n"
"\n"
"Please compile everything with -g in your CFLAGS\n");
e_alert_show(SIGABRT);
exit(-11);
}

View File

@ -527,21 +527,48 @@ main(int argc, char **argv)
void *lib, *func;
/* sanity checks - if precache might fail - check here first */
lib = dlopen("libevas.so", RTLD_GLOBAL | RTLD_LAZY);
if (!lib) dlopen("libevas.so.1", RTLD_GLOBAL | RTLD_LAZY);
lib = dlopen("libeina.so", RTLD_GLOBAL | RTLD_LAZY);
if (!lib) dlopen("libeina.so.1", RTLD_GLOBAL | RTLD_LAZY);
if (!lib) goto done;
func = dlsym(lib, "evas_init");
func = dlsym(lib, "eina_init");
if (!func) goto done;
lib = dlopen("libecore.so", RTLD_GLOBAL | RTLD_LAZY);
if (!lib) dlopen("libecore.so.1", RTLD_GLOBAL | RTLD_LAZY);
if (!lib) goto done;
func = dlsym(lib, "ecore_init");
if (!func) goto done;
lib = dlopen("libecore_file.so", RTLD_GLOBAL | RTLD_LAZY);
if (!lib) dlopen("libecore_file.so.1", RTLD_GLOBAL | RTLD_LAZY);
if (!lib) goto done;
func = dlsym(lib, "ecore_file_init");
if (!func) goto done;
lib = dlopen("libecore_x.so", RTLD_GLOBAL | RTLD_LAZY);
if (!lib) dlopen("libecore_x.so.1", RTLD_GLOBAL | RTLD_LAZY);
if (!lib) goto done;
func = dlsym(lib, "ecore_x_init");
if (!func) goto done;
lib = dlopen("libevas.so", RTLD_GLOBAL | RTLD_LAZY);
if (!lib) dlopen("libevas.so.1", RTLD_GLOBAL | RTLD_LAZY);
if (!lib) goto done;
func = dlsym(lib, "evas_init");
if (!func) goto done;
lib = dlopen("libedje.so", RTLD_GLOBAL | RTLD_LAZY);
if (!lib) dlopen("libedje.so.1", RTLD_GLOBAL | RTLD_LAZY);
if (!lib) goto done;
func = dlsym(lib, "edje_init");
if (!func) goto done;
lib = dlopen("libeet.so", RTLD_GLOBAL | RTLD_LAZY);
if (!lib) dlopen("libeet.so.0", RTLD_GLOBAL | RTLD_LAZY);
if (!lib) goto done;
func = dlsym(lib, "eet_init");
if (!func) goto done;
/* precache SHOULD work */
snprintf(buf, sizeof(buf), "%s/lib/enlightenment/preload/e_precache.so", _prefix_path);
env_set("LD_PRELOAD", buf);

View File

@ -8,11 +8,6 @@ EAPI E_Path *path_icons = NULL;
EAPI E_Path *path_modules = NULL;
EAPI E_Path *path_backgrounds = NULL;
EAPI E_Path *path_messages = NULL;
EAPI int restart = 0;
EAPI int good = 0;
EAPI int evil = 0;
EAPI int starting = 1;
EAPI int stopping = 0;
typedef struct _E_Util_Fake_Mouse_Up_Info E_Util_Fake_Mouse_Up_Info;
typedef struct _E_Util_Image_Import_Settings E_Util_Image_Import_Settings;

View File

@ -3139,7 +3139,7 @@ _e_mod_comp_add(E_Manager *man)
}
ecore_x_screen_is_composited_set(c->man->num, c->cm_selection);
if (c->man->num == 0) e_alert_composite_win = c->win;
// if (c->man->num == 0) e_alert_composite_win = c->win;
if (_comp_mod->conf->engine == E_EVAS_ENGINE_GL_X11)
{
@ -3309,7 +3309,7 @@ _e_mod_comp_del(E_Comp *c)
ecore_x_composite_unredirect_subwindows
(c->man->root, ECORE_X_COMPOSITE_UPDATE_MANUAL);
ecore_x_composite_render_window_disable(c->win);
if (c->man->num == 0) e_alert_composite_win = 0;
// if (c->man->num == 0) e_alert_composite_win = 0;
if (c->render_animator) ecore_animator_del(c->render_animator);
if (c->new_up_timer) ecore_timer_del(c->new_up_timer);
if (c->update_job) ecore_job_del(c->update_job);

View File

@ -3,7 +3,6 @@ MAINTAINERCLEANFILES = Makefile.in
INCLUDES = -I. \
-I$(top_srcdir) \
-I$(top_srcdir)src/preload \
@x_cflags@ \
@e_cflags@
pkgdir = $(libdir)/enlightenment/preload
@ -14,7 +13,7 @@ pkg_LTLIBRARIES = e_precache.la
#e_hack_la_SOURCES = \
#e_hack.c \
#e_hack.h
#e_hack_la_LIBADD = @x_libs@ @dlopen_libs@
#e_hack_la_LIBADD = @dlopen_libs@
#e_hack_la_LDFLAGS = -module -avoid-version
#e_hack_la_DEPENDENCIES = $(top_builddir)/config.h

View File

@ -1,8 +1,12 @@
#include "config.h"
#include "e_precache.h"
static void *lib_evas = NULL;
static void *lib_eina = NULL;
static void *lib_ecore = NULL;
static void *lib_ecore_file = NULL;
static void *lib_ecore_x = NULL;
static void *lib_evas = NULL;
static void *lib_edje = NULL;
static void *lib_eet = NULL;
static int *e_precache_end = NULL;
@ -105,21 +109,35 @@ lib_func(const char *lib1, const char *lib2, const char *fname, const char *libn
}
/* intercepts */
void
evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key)
Eina_Module *
eina_module_find(const Eina_Array *array, const char *module)
{
static void (*func) (Evas_Object *obj, const char *file, const char *key) = NULL;
static Eina_Module *(*func) (const Eina_Array *array, const char *module) = NULL;
if (!func)
func = lib_func("libevas.so", "libevas.so.1",
"evas_object_image_file_set", "lib_evas", &lib_evas);
if (do_log) log_write("o", file);
(*func) (obj, file, key);
func = lib_func("libeina.so", "libeina.so.1",
"eina_module_find", "lib_eina", &lib_eina);
if (do_log) log_write("o", module);
return (*func) (array, module);
}
void
ecore_app_args_set(int argc, const char **argv)
{
static void (*func) (int argc, const char **argv) = NULL;
if (!func)
func = lib_func("libecore.so", "libecore.so.1",
"ecore_app_args_set", "lib_ecore", &lib_ecore);
if (do_log) log_write("o", (const char *)argv);
(*func) (argc, argv);
}
long long
ecore_file_mod_time(const char *file)
{
static long long (*func) (const char *file) = NULL;
if (!func)
func = lib_func("libecore_file.so", "libecore_file.so.1",
"ecore_file_mod_time", "lib_ecore_file", &lib_ecore_file);
@ -131,6 +149,7 @@ long long
ecore_file_size(const char *file)
{
static int (*func) (const char *file) = NULL;
if (!func)
func = lib_func("libecore_file.so", "libecore_file.so.1",
"ecore_file_size", "lib_ecore_file", &lib_ecore_file);
@ -142,6 +161,7 @@ Eina_Bool
ecore_file_exists(const char *file)
{
static int (*func) (const char *file) = NULL;
if (!func)
func = lib_func("libecore_file.so", "libecore_file.so.1",
"ecore_file_exists", "lib_ecore_file", &lib_ecore_file);
@ -153,6 +173,7 @@ Eina_Bool
ecore_file_is_dir(const char *file)
{
static int (*func) (const char *file) = NULL;
if (!func)
func = lib_func("libecore_file.so", "libecore_file.so.1",
"ecore_file_is_dir", "lib_ecore_file", &lib_ecore_file);
@ -164,6 +185,7 @@ Eina_Bool
ecore_file_can_read(const char *file)
{
static int (*func) (const char *file) = NULL;
if (!func)
func = lib_func("libecore_file.so", "libecore_file.so.1",
"ecore_file_can_read", "lib_ecore_file", &lib_ecore_file);
@ -175,6 +197,7 @@ Eina_Bool
ecore_file_can_write(const char *file)
{
static int (*func) (const char *file) = NULL;
if (!func)
func = lib_func("libecore_file.so", "libecore_file.so.1",
"ecore_file_can_write", "lib_ecore_file", &lib_ecore_file);
@ -186,6 +209,7 @@ Eina_Bool
ecore_file_can_exec(const char *file)
{
static int (*func) (const char *file) = NULL;
if (!func)
func = lib_func("libecore_file.so", "libecore_file.so.1",
"ecore_file_can_exec", "lib_ecore_file", &lib_ecore_file);
@ -197,6 +221,7 @@ Eina_List *
ecore_file_ls(const char *file)
{
static Eina_List * (*func) (const char *file) = NULL;
if (!func)
func = lib_func("libecore_file.so", "libecore_file.so.1",
"ecore_file_ls", "lib_ecore_file", &lib_ecore_file);
@ -204,13 +229,52 @@ ecore_file_ls(const char *file)
return (*func) (file);
}
int
ecore_x_init(const char *name)
{
static int (*func) (const char *name) = NULL;
if (!func)
func = lib_func("libecore_x.so", "libecore_x.so.1",
"ecore_x_init", "lib_ecore_x", &lib_ecore_x);
if (do_log) log_write("o", name);
return (*func) (name);
}
void
evas_object_image_file_set(Evas_Object *obj, const char *file, const char *key)
{
static void (*func) (Evas_Object *obj, const char *file, const char *key) = NULL;
if (!func)
func = lib_func("libevas.so", "libevas.so.1",
"evas_object_image_file_set", "lib_evas", &lib_evas);
if (do_log) log_write("o", file);
(*func) (obj, file, key);
}
/* edje */
Eina_Bool
edje_object_file_set(Evas_Object *obj, const char *file, const char *group)
{
static Eina_Bool (*func) (Evas_Object *obj, const char *file, const char *group) = NULL;
if (!func)
func = lib_func("libedje.so", "libedje.so.1",
"edje_object_file_set", "lib_edje", &lib_edje);
if (do_log) log_write("o", file);
return (*func) (obj, file, group);
}
Eet_File *
eet_open(const char *file, Eet_File_Mode mode)
{
static Eet_File * (*func) (const char *file, Eet_File_Mode mode) = NULL;
if (!func)
func = lib_func("libeet.so", "libeet.so.0",
"eet_open", "lib_eet", &lib_eet);
if (do_log) log_write("o", file);
return (*func) (file, mode);
}