From 750dbdf926780d721f50f695ac2e395418d1d479 Mon Sep 17 00:00:00 2001 From: Christopher Michael Date: Sun, 7 Aug 2011 14:03:21 +0000 Subject: [PATCH] E: Re-enable Alert window when composite module is running. SVN revision: 62182 --- configure.ac | 1 + src/bin/e.h | 2 +- src/bin/e_alert.c | 7 +++++-- src/bin/e_alert_main.c | 38 +++++++++++++++++++++-------------- src/modules/comp/e_mod_comp.c | 4 ++-- 5 files changed, 32 insertions(+), 20 deletions(-) diff --git a/configure.ac b/configure.ac index 9c9d3b0ed..c6162dbd4 100644 --- a/configure.ac +++ b/configure.ac @@ -467,6 +467,7 @@ PKG_CHECK_MODULES(E_INIT, [ PKG_CHECK_MODULES(E_ALERT, [ xcb + xcb-shape eina >= 1.0.999 ecore >= 1.0.999 ecore-ipc >= 1.0.999 diff --git a/src/bin/e.h b/src/bin/e.h index ad47ce7cf..f0adf6271 100644 --- a/src/bin/e.h +++ b/src/bin/e.h @@ -239,6 +239,6 @@ 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 diff --git a/src/bin/e_alert.c b/src/bin/e_alert.c index 9bb78f456..2b633a949 100644 --- a/src/bin/e_alert.c +++ b/src/bin/e_alert.c @@ -7,6 +7,9 @@ static Eina_Bool _e_alert_cb_exe_del(void *data __UNUSED__, int type __UNUSED__, static Ecore_Exe *alert_exe = NULL; static Ecore_Event_Handler *alert_exe_hdl = NULL; +/* public variables */ +EAPI unsigned long e_alert_composite_win = 0; + EINTERN int e_alert_init(void) { @@ -33,8 +36,8 @@ e_alert_show(int sig) char buf[8192]; snprintf(buf, sizeof(buf), - "%s/enlightenment/utils/enlightenment_alert %d %d", - e_prefix_lib_get(), sig, getpid()); + "%s/enlightenment/utils/enlightenment_alert %d %d %d", + e_prefix_lib_get(), sig, getpid(), e_alert_composite_win); alert_exe = ecore_exe_run(buf, NULL); pause(); diff --git a/src/bin/e_alert_main.c b/src/bin/e_alert_main.c index aa2bde598..5d64b8a3f 100644 --- a/src/bin/e_alert_main.c +++ b/src/bin/e_alert_main.c @@ -10,6 +10,7 @@ #include #include #include +#include #define WINDOW_WIDTH 320 #define WINDOW_HEIGHT 240 @@ -43,7 +44,7 @@ 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 win = 0, comp_win = 0; static xcb_window_t btn1 = 0; static xcb_window_t btn2 = 0; static xcb_font_t font = 0; @@ -73,6 +74,8 @@ 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 } if (!ecore_init()) return EXIT_FAILURE; @@ -253,21 +256,25 @@ _e_alert_display(void) _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; */ + if (comp_win) + { + xcb_rectangle_t rect; + int wx = 0, wy = 0; - /* 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); */ - /* } */ + wx = ((sw - WINDOW_WIDTH) / 2); + wy = ((sh - WINDOW_HEIGHT) / 2); + + rect.x = wx; + rect.y = wy; + rect.width = WINDOW_WIDTH; + rect.height = WINDOW_HEIGHT; + + xcb_shape_rectangles(conn, XCB_SHAPE_SO_SET, + XCB_SHAPE_SK_INPUT, XCB_CLIP_ORDERING_UNSORTED, + comp_win, 0, 0, 1, &rect); + + xcb_reparent_window(conn, win, comp_win, wx, wy); + } /* map and raise main window */ xcb_map_window(conn, win); @@ -332,6 +339,7 @@ _e_alert_shutdown(void) xcb_destroy_window(conn, btn1); xcb_destroy_window(conn, btn2); xcb_destroy_window(conn, win); + if (comp_win) xcb_destroy_window(conn, comp_win); xcb_free_gc(conn, gc); xcb_disconnect(conn); } diff --git a/src/modules/comp/e_mod_comp.c b/src/modules/comp/e_mod_comp.c index 09d785b7a..342d817e8 100644 --- a/src/modules/comp/e_mod_comp.c +++ b/src/modules/comp/e_mod_comp.c @@ -3140,7 +3140,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) { @@ -3310,7 +3310,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);