e: e_alert now find the composite window by looking at X property insteed of relying on E.

SVN revision: 78692
This commit is contained in:
Cedric BAIL 2012-10-31 07:50:10 +00:00
parent 7bef20f1b8
commit 7826261e19
4 changed files with 58 additions and 8 deletions

View File

@ -282,7 +282,7 @@ 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;
EAPI void e_alert_composite_win(Ecore_X_Window root, Ecore_X_Window win);
//#define SMARTERR(args...) abort()
#define SMARTERRNR() return

View File

@ -2,7 +2,7 @@
#include <sys/wait.h>
/* public variables */
EAPI unsigned long e_alert_composite_win = 0;
EAPI unsigned long _e_alert_composite_win = 0;
EINTERN int
e_alert_init(void)
@ -16,6 +16,19 @@ e_alert_shutdown(void)
return 1;
}
EAPI void
e_alert_composite_win(Ecore_X_Window root, Ecore_X_Window comp)
{
Ecore_X_Atom composite_win;
composite_win = ecore_x_atom_get("_E_COMP_WINDOW");
if (comp == 0)
ecore_x_window_prop_property_del(root, composite_win);
else
ecore_x_window_prop_card32_set(root, composite_win, &comp, 1);
}
EAPI void
e_alert_show(int sig)
{
@ -34,8 +47,7 @@ e_alert_show(int sig)
args[2] = alloca(21);
snprintf(args[2], 21, "%lu", (long unsigned int)getpid());
args[3] = alloca(21);
snprintf(args[3], 21, "%lu", e_alert_composite_win);
args[3] = NULL;
pid = fork();
if (pid < -1)

View File

@ -72,8 +72,6 @@ main(int argc, char **argv)
sig = atoi(argv[i]); // signal
else if (i == 2)
pid = atoi(argv[i]); // E's pid
else if (i == 3)
comp_win = atoi(argv[i]); // Composite Alert Window
}
tmp = getenv("E17_TAINTED");
@ -181,6 +179,45 @@ _e_alert_create(void)
xcb_create_gc(conn, gc, win, mask, mask_list);
}
static int
_e_alert_atom_get(const char *name)
{
xcb_intern_atom_cookie_t cookie;
xcb_intern_atom_reply_t *reply;
int a;
cookie = xcb_intern_atom_unchecked(conn, 0, strlen(name), name);
reply = xcb_intern_atom_reply(conn, cookie, NULL);
if (!reply) return XCB_ATOM_NONE;
a = reply->atom;
free(reply);
return a;
}
static int
_e_alert_comp_win_get(void)
{
xcb_get_property_cookie_t cookie;
xcb_get_property_reply_t *reply;
uint32_t *v;
int r;
int atom_cardinal, atom_composite_win;
atom_cardinal = _e_alert_atom_get("CARDINAL");
atom_composite_win = _e_alert_atom_get("_E_COMP_WINDOW");
cookie = xcb_get_property_unchecked(conn, 0, screen->root, atom_composite_win,
atom_cardinal, 0, 0x7fffffff);
reply = xcb_get_property_reply(conn, cookie, NULL);
if (!reply) return -1;
v = xcb_get_property_value(reply);
r = v[0];
free(reply);
return r;
}
static void
_e_alert_display(void)
{
@ -213,6 +250,7 @@ _e_alert_display(void)
_e_alert_button_move_resize(btn2, x, WINDOW_HEIGHT - 20 - (fh + 20),
w, (fh + 20));
comp_win = _e_alert_comp_win_get();
if (comp_win)
{
xcb_rectangle_t rect;

View File

@ -3685,7 +3685,7 @@ _e_mod_comp_add(E_Manager *man)
*/
}
if (c->man->num == 0) e_alert_composite_win = c->win;
if (c->man->num == 0) e_alert_composite_win(c->man->root, c->win);
if (_comp_mod->conf->engine == ENGINE_GL)
{
@ -3891,7 +3891,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(c->man->root, 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);