forked from enlightenment/enlightenment
make alerts work with composite managers in modules.. so if we segv... we can
see it and recover etc. - requires module compmgr to "do the right thing" and advertise the composite window. SVN revision: 44924
This commit is contained in:
parent
f23dea49bc
commit
dfd5f13aee
|
@ -221,4 +221,6 @@ extern EAPI int evil;
|
|||
extern EAPI int starting;
|
||||
extern EAPI int stopping;
|
||||
|
||||
extern EAPI unsigned long e_alert_composite_win;
|
||||
|
||||
#endif
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include <signal.h>
|
||||
#include <X11/Xlib.h>
|
||||
#include <X11/X.h>
|
||||
#include <X11/extensions/shape.h>
|
||||
#include <Ecore.h>
|
||||
|
||||
/* local subsystem functions */
|
||||
|
@ -21,8 +22,10 @@ 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;
|
||||
static Window cwin = 0, 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 */
|
||||
EAPI int
|
||||
|
@ -50,10 +53,13 @@ e_alert_init(const char *disp)
|
|||
att.override_redirect = True;
|
||||
mask = CWBackPixel | CWBorderPixel | CWOverrideRedirect;
|
||||
|
||||
wx = (wid - ww) / 2;
|
||||
wy = (hih - hh) / 2;
|
||||
|
||||
win = XCreateWindow(dd, DefaultRootWindow(dd),
|
||||
(wid - ww) / 2, (hih - hh) / 2, ww, hh, 0,
|
||||
CopyFromParent, InputOutput,
|
||||
CopyFromParent, mask, &att);
|
||||
wx, wy, ww, hh, 0,
|
||||
CopyFromParent, InputOutput,
|
||||
CopyFromParent, mask, &att);
|
||||
|
||||
b1 = XCreateWindow(dd, win, -100, -100, 1, 1, 0, CopyFromParent,
|
||||
InputOutput, CopyFromParent, mask, &att);
|
||||
|
@ -116,7 +122,21 @@ e_alert_show(const char *text)
|
|||
XMoveResizeWindow(dd, b2, w, hh - 15 - fh, mh + 10, fh + 10);
|
||||
XSelectInput(dd, b2, ButtonPressMask | ButtonReleaseMask | ExposureMask);
|
||||
|
||||
XMapWindow(dd, win);
|
||||
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);
|
||||
|
|
|
@ -183,7 +183,7 @@ _e_mod_comp_win_lower(Comp_Win *cw)
|
|||
static void
|
||||
_e_mod_comp_win_configure(Comp_Win *cw, int x, int y, int w, int h, int border)
|
||||
{
|
||||
if (!((x == cw->c) && (y == cw->y)))
|
||||
if (!((x == cw->x) && (y == cw->y)))
|
||||
{
|
||||
cw->x = x;
|
||||
cw->y = y;
|
||||
|
@ -406,6 +406,7 @@ _e_mod_comp_add(E_Manager *man)
|
|||
if (!c) return NULL;
|
||||
c->man = man;
|
||||
c->win = ecore_x_composite_render_window_enable(man->root);
|
||||
if (c->man->num == 0) e_alert_composite_win = c->win;
|
||||
c->ee = ecore_evas_software_x11_new(NULL, c->win, 0, 0, man->w, man->h);
|
||||
c->evas = ecore_evas_get(c->ee);
|
||||
ecore_evas_show(c->ee);
|
||||
|
@ -490,7 +491,7 @@ e_mod_comp_shutdown(void)
|
|||
|
||||
while (c->wins)
|
||||
{
|
||||
cw = c->wins;
|
||||
cw = (Comp_Win *)(c->wins);
|
||||
_e_mod_comp_win_hide(cw);
|
||||
_e_mod_comp_win_del(cw);
|
||||
}
|
||||
|
@ -498,6 +499,7 @@ e_mod_comp_shutdown(void)
|
|||
// 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;
|
||||
free(c);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue