really - ignore is pointless. restart or exit now.

SVN revision: 23722
This commit is contained in:
Carsten Haitzler 2006-07-05 19:38:59 +00:00
parent 801a2c82aa
commit 06d5e86fae
1 changed files with 15 additions and 39 deletions

View File

@ -17,11 +17,11 @@
/* local subsystem globals */ /* local subsystem globals */
static Display *dd = NULL; static Display *dd = NULL;
static char *title = NULL, *str1 = NULL, *str2 = NULL, *str3 = NULL; static char *title = NULL, *str1 = NULL, *str2 = NULL;
static Font font = 0; static Font font = 0;
static XFontStruct *fs = NULL; static XFontStruct *fs = NULL;
static GC gc = 0; static GC gc = 0;
static Window win = 0, b1 = 0, b2 = 0, b3 = 0; static Window win = 0, b1 = 0, b2 = 0;
static int ww = 600, hh = 440; static int ww = 600, hh = 440;
/* externally accessible functions */ /* externally accessible functions */
@ -40,9 +40,8 @@ e_alert_init(const char *disp)
/* dont i18n this - i dont want gettext doing anything as this is called /* dont i18n this - i dont want gettext doing anything as this is called
from a segv */ from a segv */
title = "Enlightenment Error"; title = "Enlightenment Error";
str1 = "(F1) Ignore"; str1 = "(F1) Restart";
str2 = "(F2) Restart"; str2 = "(F2) Exit";
str3 = "(F3) Exit";
wid = DisplayWidth(dd, DefaultScreen(dd)); wid = DisplayWidth(dd, DefaultScreen(dd));
hih = DisplayHeight(dd, DefaultScreen(dd)); hih = DisplayHeight(dd, DefaultScreen(dd));
@ -60,11 +59,8 @@ e_alert_init(const char *disp)
InputOutput, CopyFromParent, mask, &att); InputOutput, CopyFromParent, mask, &att);
b2 = XCreateWindow(dd, win, -100, -100, 1, 1, 0, CopyFromParent, b2 = XCreateWindow(dd, win, -100, -100, 1, 1, 0, CopyFromParent,
InputOutput, CopyFromParent, mask, &att); InputOutput, CopyFromParent, mask, &att);
b3 = XCreateWindow(dd, win, -100, -100, 1, 1, 0, CopyFromParent,
InputOutput, CopyFromParent, mask, &att);
XMapWindow(dd, b1); XMapWindow(dd, b1);
XMapWindow(dd, b2); XMapWindow(dd, b2);
XMapWindow(dd, b3);
gc = XCreateGC(dd, win, 0, &gcv); gc = XCreateGC(dd, win, 0, &gcv);
XSetForeground(dd, gc, att.border_pixel); XSetForeground(dd, gc, att.border_pixel);
@ -83,7 +79,6 @@ e_alert_shutdown(void)
title = NULL; title = NULL;
str1 = NULL; str1 = NULL;
str2 = NULL; str2 = NULL;
str3 = NULL;
dd = NULL; dd = NULL;
font = 0; font = 0;
fs = NULL; fs = NULL;
@ -111,18 +106,15 @@ e_alert_show(const char *text)
} }
fh = fs->ascent + fs->descent; fh = fs->ascent + fs->descent;
mh = ((ww - 20) / 3) - 20; mh = ((ww - 20) / 2) - 20;
/* fixed size... */ /* fixed size... */
w = 5 + (((ww - 20 - mh) * 0) / 4); w = 20;
XMoveResizeWindow(dd, b1, w, hh - 15 - fh, mh + 10, fh + 10); XMoveResizeWindow(dd, b1, w, hh - 15 - fh, mh + 10, fh + 10);
XSelectInput(dd, b1, ButtonPressMask | ButtonReleaseMask | ExposureMask); XSelectInput(dd, b1, ButtonPressMask | ButtonReleaseMask | ExposureMask);
w = 5 + (((ww - 20 - mh) * 1) / 2); w = ww - 20 - mh;
XMoveResizeWindow(dd, b2, w, hh - 15 - fh, mh + 10, fh + 10); XMoveResizeWindow(dd, b2, w, hh - 15 - fh, mh + 10, fh + 10);
XSelectInput(dd, b2, ButtonPressMask | ButtonReleaseMask | ExposureMask); XSelectInput(dd, b2, ButtonPressMask | ButtonReleaseMask | ExposureMask);
w = 5 + (((ww - 20 - mh) * 2) / 2);
XMoveResizeWindow(dd, b3, w, hh - 15 - fh, mh + 10, fh + 10);
XSelectInput(dd, b3, ButtonPressMask | ButtonReleaseMask | ExposureMask);
XMapWindow(dd, win); XMapWindow(dd, win);
XGrabPointer(dd, win, True, ButtonPressMask | ButtonReleaseMask, XGrabPointer(dd, win, True, ButtonPressMask | ButtonReleaseMask,
@ -137,7 +129,7 @@ e_alert_show(const char *text)
XNextEvent(dd, &ev); XNextEvent(dd, &ev);
switch (ev.type) switch (ev.type)
{ {
case KeyPress: case KeyPress:
key = XKeysymToKeycode(dd, XStringToKeysym("F1")); key = XKeysymToKeycode(dd, XStringToKeysym("F1"));
if (key == ev.xkey.keycode) if (key == ev.xkey.keycode)
{ {
@ -150,24 +142,14 @@ e_alert_show(const char *text)
button = 2; button = 2;
break; break;
} }
key = XKeysymToKeycode(dd, XStringToKeysym("F3"));
if (key == ev.xkey.keycode)
{
button = 3;
break;
}
break; break;
case ButtonPress:
case ButtonPress:
if (ev.xbutton.window == b1) if (ev.xbutton.window == b1)
button = 1; button = 1;
else if (ev.xbutton.window == b2) else if (ev.xbutton.window == b2)
button = 2; button = 2;
else if (ev.xbutton.window == b3)
button = 3;
break; break;
case Expose:
case Expose:
while (XCheckTypedWindowEvent(dd, ev.xexpose.window, Expose, &ev)); while (XCheckTypedWindowEvent(dd, ev.xexpose.window, Expose, &ev));
/* outline */ /* outline */
@ -200,10 +182,6 @@ e_alert_show(const char *text)
XDrawRectangle(dd, b2, gc, 0, 0, mh - 1, fh + 10 - 1); 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)); XDrawString(dd, b2, gc, 5 + ((mh - fw) / 2), 5 + fs->ascent, str2, strlen(str2));
fw = XTextWidth(fs, str3, strlen(str3));
XDrawRectangle(dd, b3, gc, 0, 0, mh - 1, fh + 10 - 1);
XDrawString(dd, b3, gc, 5 + ((mh - fw) / 2), 5 + fs->ascent, str3, strlen(str3));
XSync(dd, False); XSync(dd, False);
break; break;
@ -216,15 +194,13 @@ e_alert_show(const char *text)
switch (button) switch (button)
{ {
case 1: case 1:
break;
case 2:
ecore_app_restart(); ecore_app_restart();
break; break;
case 3: case 2:
exit(-11); exit(-11);
break; break;
default: default:
break; break;
} }
} }