make alerts work with composite managers in modules.. so if we segv... we can
authorCarsten Haitzler <raster@rasterman.com>
Wed, 6 Jan 2010 15:04:33 +0000 (15:04 +0000)
committerCarsten Haitzler <raster@rasterman.com>
Wed, 6 Jan 2010 15:04:33 +0000 (15:04 +0000)
see it and recover etc. - requires module compmgr to "do the right thing" and
advertise the composite window.

SVN revision: 44924

src/bin/e.h
src/bin/e_alert.c
src/modules/comp/e_mod_comp.c

index 45f50c53ec4acb0231ed47a636cbcf67f082ffc6..b5893a35578bdfa785d1dbc8384faa44c02bdc78 100644 (file)
@@ -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
index f8df0a74a93875dc33c4ef456828e40a019b3a9c..e26126474fe86b205665c32e544c40af7985532e 100644 (file)
@@ -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);
index 977541d2121ab4fa900c33daffdf1f5fca48f7f5..ecd12b3ef45862e573b5d2e66eb8b2067740fae1 100644 (file)
@@ -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);
      }