Enlightenment CVS committal
Author : kwo
Project : e16
Module : e
Dir : e16/e/src
Modified Files:
E.h borders.c draw.c ewin-ops.c ewins.c icccm.c iconify.c
menus.c slideout.c warp.c x.c
Log Message:
Another attempt to get shape right.
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/E.h,v
retrieving revision 1.431
retrieving revision 1.432
diff -u -3 -r1.431 -r1.432
--- E.h 14 May 2005 20:00:35 -0000 1.431
+++ E.h 21 May 2005 20:58:17 -0000 1.432
@@ -1244,7 +1244,7 @@
void EwinBorderDetach(EWin * ewin);
void EwinBorderSetTo(EWin * ewin, const Border * b);
void EwinBorderDraw(EWin * ewin, int do_shape, int do_paint);
-void EwinBorderCalcSizes(EWin * ewin);
+void EwinBorderCalcSizes(EWin * ewin, int propagate);
void EwinBorderMinShadeSize(EWin * ewin, int *mw, int *mh);
void EwinBorderUpdateInfo(EWin * ewin);
void EwinBorderUpdateState(EWin * ewin);
@@ -1478,7 +1478,6 @@
Imlib_Image *ELoadImage(const char *file);
void DrawEwinShape(EWin * ewin, int md, int x, int y, int w,
int h, char firstlast);
-void PropagateShapes(Window win);
/* econfig.c */
void ConfigurationLoad(void);
@@ -1594,7 +1593,6 @@
void *ptr,
void (*init) (EWin * ewin, void *ptr));
void EwinReparent(EWin * ewin, Window parent);
-void SyncBorderToEwin(EWin * ewin);
Window EwinGetClientWin(const EWin * ewin);
const char *EwinGetName(const EWin * ewin);
const char *EwinGetIconName(const EWin * ewin);
@@ -2251,17 +2249,6 @@
void EMapWindow(Window win);
void EMapRaised(Window win);
void EUnmapWindow(Window win);
-void EShapeCombineMask(Window win, int dest, int x, int y,
- Pixmap pmap, int op);
-void EShapeCombineMaskTiled(Window win, int dest, int x, int y,
- Pixmap pmap, int op, int w, int h);
-void EShapeCombineRectangles(Window win, int dest, int x, int y,
- XRectangle * rect, int n_rects,
- int op, int ordering);
-void EShapeCombineShape(Window win, int dest, int x, int y,
- Window src_win, int src_kind, int op);
-XRectangle *EShapeGetRectangles(Window win, int dest, int *rn,
- int *ord);
void EReparentWindow(Window win, Window parent, int x, int y);
int EGetGeometry(Window win, Window * root_return,
int *x, int *y, int *w, int *h, int *bw,
@@ -2270,7 +2257,6 @@
XWindowChanges * wc);
void ESetWindowBackgroundPixmap(Window win, Pixmap pmap);
void ESetWindowBackground(Window win, int col);
-Pixmap EWindowGetShapePixmap(Window win);
#define ESelectInput(win, mask) XSelectInput(disp, win, mask)
#define EGetWindowAttributes(win, attr) XGetWindowAttributes(disp, win, attr)
@@ -2282,6 +2268,21 @@
#define ECreatePixmap(draw, w, h, dep) XCreatePixmap(disp, draw, w, h, dep)
#define EFreePixmap(pmap) XFreePixmap(disp, pmap)
+void EShapeCombineMask(Window win, int dest, int x, int y,
+ Pixmap pmap, int op);
+void EShapeCombineMaskTiled(Window win, int dest, int x, int y,
+ Pixmap pmap, int op, int w, int h);
+void EShapeCombineRectangles(Window win, int dest, int x, int y,
+ XRectangle * rect, int n_rects,
+ int op, int ordering);
+void EShapeCombineShape(Window win, int dest, int x, int y,
+ Window src_win, int src_kind, int op);
+XRectangle *EShapeGetRectangles(Window win, int dest, int *rn,
+ int *ord);
+int EShapeCopy(Window dst, Window src);
+void EShapePropagate(Window win);
+Pixmap EWindowGetShapePixmap(Window win);
+
GC ECreateGC(Drawable d, unsigned long mask, XGCValues * val);
int EFreeGC(GC gc);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/borders.c,v
retrieving revision 1.261
retrieving revision 1.262
diff -u -3 -r1.261 -r1.262
--- borders.c 14 May 2005 19:40:14 -0000 1.261
+++ borders.c 21 May 2005 20:58:18 -0000 1.262
@@ -35,16 +35,6 @@
static void BorderFrameHandleEvents(XEvent * ev, void *prm);
void
-SyncBorderToEwin(EWin * ewin)
-{
- const Border *b;
-
- b = ewin->border;
- ICCCM_GetShapeInfo(ewin);
- EwinSetBorder(ewin, b, 1);
-}
-
-void
EwinBorderUpdateState(EWin * ewin)
{
EwinBorderDraw(ewin, 0, 0);
@@ -366,7 +356,7 @@
}
void
-EwinBorderCalcSizes(EWin * ewin)
+EwinBorderCalcSizes(EWin * ewin, int propagate)
{
int i, ww, hh;
char reshape;
@@ -394,10 +384,14 @@
ewin->bits[i].no_expose = 1;
}
+#if 0 /* Debug */
+ Eprintf("EwinBorderCalcSizes prop=%d reshape=%d\n", propagate, reshape);
+#endif
if (reshape)
{
ewin->shapedone = 0;
- EwinPropagateShapes(ewin);
+ if (propagate)
+ EwinPropagateShapes(ewin);
}
}
@@ -429,9 +423,6 @@
if (b && strncmp(b->name, "__", 2))
goto done;
- ICCCM_GetShapeInfo(ewin);
- ewin->shapedone = 0;
-
if ((!ewin->client.mwm_decor_title && !ewin->client.mwm_decor_border) ||
(Conf.dock.enable && ewin->docked))
b = FindItem("BORDERLESS", 0, LIST_FINDBY_NAME, LIST_TYPE_BORDER);
@@ -567,7 +558,8 @@
if (!ewin->shaded)
EMoveWindow(ewin->win_container, b->border.left, b->border.top);
- EwinBorderCalcSizes(ewin);
+ ewin->shapedone = 0;
+ EwinBorderCalcSizes(ewin, 0);
SnapshotEwinUpdate(ewin, SNAP_USE_BORDER);
}
@@ -581,7 +573,6 @@
if (apply)
{
EwinBorderSetTo(ewin, b);
- ICCCM_MatchSize(ewin);
MoveResizeEwin(ewin, EoGetX(ewin), EoGetY(ewin),
ewin->client.w, ewin->client.h);
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/draw.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -3 -r1.73 -r1.74
--- draw.c 17 May 2005 15:50:01 -0000 1.73
+++ draw.c 21 May 2005 20:58:18 -0000 1.74
@@ -1116,112 +1116,3 @@
return NULL;
}
-
-void
-PropagateShapes(Window win)
-{
- Window rt, par, *list = NULL;
- unsigned int i, num, num_rects;
- int k, rn, ord;
- int x, y, xx, yy, ww, hh, d;
- XRectangle *rects, *rl;
- XWindowAttributes att;
-
- if (!EGetGeometry(win, &rt, &xx, &yy, &ww, &hh, &d, &d))
- return;
- if ((ww <= 0) || (hh <= 0))
- return;
-
-#if 0
- Eprintf("PropagateShapes %#lx %d,%d %dx%d\n", win, xx, yy, ww, hh);
-#endif
-
- XQueryTree(disp, win, &rt, &par, &list, &num);
- if (!list)
- return;
-
- num_rects = 0;
- rects = NULL;
-
- /* go through all child windows and create/inset spans */
- for (i = 0; i < num; i++)
- {
- XGetWindowAttributes(disp, list[i], &att);
- x = att.x;
- y = att.y;
- if ((att.class == InputOutput) && (att.map_state != IsUnmapped))
- {
- rl = EShapeGetRectangles(list[i], ShapeBounding, &rn, &ord);
- if (rl)
- {
- if (rn > 0)
- {
- rects = Erealloc(rects,
- (num_rects + rn) * sizeof(XRectangle));
- /* go through all clip rects in thsi window's shape */
- for (k = 0; k < rn; k++)
- {
- /* for each clip rect, add it to the rect list */
- rects[num_rects + k].x = x + rl[k].x;
- rects[num_rects + k].y = y + rl[k].y;
- rects[num_rects + k].width = rl[k].width;
- rects[num_rects + k].height = rl[k].height;
- }
- num_rects += rn;
- }
- Efree(rl);
- }
- else
- {
- rects = Erealloc(rects, (num_rects + 1) * sizeof(XRectangle));
-
- rects[num_rects].x = x;
- rects[num_rects].y = y;
- rects[num_rects].width = att.width;
- rects[num_rects].height = att.height;
- num_rects++;
- }
- }
- }
-
-#if 0
- for (i = 0; i < num_rects; i++)
- Eprintf("%3d %4d,%4d %4dx%4d\n", i, rects[i].x, rects[i].y,
- rects[i].width, rects[i].height);
-#endif
-
- /* set the rects as the shape mask */
- if (rects)
- {
- EShapeCombineRectangles(win, ShapeBounding, 0, 0, rects,
- num_rects, ShapeSet, Unsorted);
-
- /* Limit shape to window extents */
- rects[0].x = 0;
- rects[0].y = 0;
- rects[0].width = ww;
- rects[0].height = hh;
- EShapeCombineRectangles(win, ShapeBounding, 0, 0, rects,
- 1, ShapeIntersect, Unsorted);
-
- Efree(rects);
- rl = NULL;
- rl = EShapeGetRectangles(win, ShapeBounding, &rn, &ord);
- if (rl)
- {
- if (rn < 1)
- EShapeCombineMask(win, ShapeBounding, 0, 0, None, ShapeSet);
- else if (rn == 1)
- {
- if ((rl[0].x == 0) && (rl[0].y == 0)
- && (rl[0].width == ww) && (rl[0].height == hh))
- EShapeCombineMask(win, ShapeBounding, 0, 0,
- None, ShapeSet);
- }
- Efree(rl);
- }
- else
- EShapeCombineMask(win, ShapeBounding, 0, 0, None, ShapeSet);
- }
- XFree(list);
-}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewin-ops.c,v
retrieving revision 1.37
retrieving revision 1.38
diff -u -3 -r1.37 -r1.38
--- ewin-ops.c 15 May 2005 18:29:45 -0000 1.37
+++ ewin-ops.c 21 May 2005 20:58:18 -0000 1.38
@@ -421,12 +421,7 @@
else
EoMoveResize(ewin, x, y, w, h);
- if (raise)
- {
- EoSetFloating(ewin, floating);
- RaiseEwin(ewin);
- }
-
+#if 1 /* FIXME - Should be done when
shading/unshading */
if (ewin->shaded == 0)
{
EMoveResizeWindow(ewin->win_container,
@@ -437,10 +432,21 @@
{
EMoveResizeWindow(ewin->win_container, -30, -30, 1, 1);
}
+#endif
- EMoveResizeWindow(ewin->client.win, 0, 0, ewin->client.w, ewin->client.h);
+ if (flags & MRF_RESIZE)
+ {
+ EMoveResizeWindow(ewin->client.win, 0, 0, ewin->client.w,
+ ewin->client.h);
+ EwinBorderCalcSizes(ewin, 0);
+ }
+ EwinPropagateShapes(ewin);
- EwinBorderCalcSizes(ewin);
+ if (raise)
+ {
+ EoSetFloating(ewin, floating);
+ RaiseEwin(ewin);
+ }
if (Mode.mode == MODE_NONE || Conf.movres.update_while_moving)
ICCCM_Configure(ewin);
@@ -797,7 +803,7 @@
ewin->shaded = 2;
EoMoveResize(ewin, x, y, w, h);
EMoveResizeWindow(ewin->win_container, -30, -30, 1, 1);
- EwinBorderCalcSizes(ewin);
+ EwinBorderCalcSizes(ewin, 1);
ESync();
HintsSetWindowState(ewin);
@@ -901,7 +907,7 @@
if ((Conf.animate_shading) || (ewin->type == EWIN_TYPE_MENU))
{
ETimedLoopInit(0, 1024, speed);
- for (k = 0; k <= 1024;)
+ for (k = 0; k < 1024;)
{
i = ((a * (1024 - k)) + (b * k)) >> 10;
w = i;
@@ -921,7 +927,7 @@
0, ewin->client.win, ShapeBounding,
ShapeSet);
EoMoveResize(ewin, x, y, w, h);
- EwinBorderCalcSizes(ewin);
+ EwinBorderCalcSizes(ewin, 1);
k = ETimedLoopNext();
}
@@ -938,7 +944,7 @@
if ((Conf.animate_shading) || (ewin->type == EWIN_TYPE_MENU))
{
ETimedLoopInit(0, 1024, speed);
- for (k = 0; k <= 1024;)
+ for (k = 0; k < 1024;)
{
i = ((a * (1024 - k)) + (b * k)) >> 10;
j = ((c * (1024 - k)) + (d * k)) >> 10;
@@ -959,7 +965,7 @@
ShapeBounding, 0, 0, ewin->client.win,
ShapeBounding, ShapeSet);
EoMoveResize(ewin, x, y, w, h);
- EwinBorderCalcSizes(ewin);
+ EwinBorderCalcSizes(ewin, 1);
k = ETimedLoopNext();
}
@@ -975,7 +981,7 @@
if ((Conf.animate_shading) || (ewin->type == EWIN_TYPE_MENU))
{
ETimedLoopInit(0, 1024, speed);
- for (k = 0; k <= 1024;)
+ for (k = 0; k < 1024;)
{
i = ((a * (1024 - k)) + (b * k)) >> 10;
h = i;
@@ -996,7 +1002,7 @@
ewin->client.win, ShapeBounding,
ShapeSet);
EoMoveResize(ewin, x, y, w, h);
- EwinBorderCalcSizes(ewin);
+ EwinBorderCalcSizes(ewin, 1);
k = ETimedLoopNext();
}
@@ -1014,7 +1020,7 @@
if ((Conf.animate_shading) || (ewin->type == EWIN_TYPE_MENU))
{
ETimedLoopInit(0, 1024, speed);
- for (k = 0; k <= 1024;)
+ for (k = 0; k < 1024;)
{
i = ((a * (1024 - k)) + (b * k)) >> 10;
j = ((c * (1024 - k)) + (d * k)) >> 10;
@@ -1035,7 +1041,7 @@
ShapeBounding, 0, 0, ewin->client.win,
ShapeBounding, ShapeSet);
EoMoveResize(ewin, x, y, w, h);
- EwinBorderCalcSizes(ewin);
+ EwinBorderCalcSizes(ewin, 1);
k = ETimedLoopNext();
}
@@ -1049,7 +1055,9 @@
if (ewin->client.shaped)
EShapeCombineShape(ewin->win_container, ShapeBounding, 0, 0,
ewin->client.win, ShapeBounding, ShapeSet);
- MoveEwin(ewin, EoGetX(ewin), EoGetY(ewin));
+
+ MoveResizeEwin(ewin, EoGetX(ewin), EoGetY(ewin), ewin->client.w,
+ ewin->client.h);
ESync();
#if 0
@@ -1105,7 +1113,7 @@
if ((Conf.animate_shading) || (ewin->type == EWIN_TYPE_MENU))
{
ETimedLoopInit(0, 1024, speed);
- for (k = 0; k <= 1024;)
+ for (k = 0; k < 1024;)
{
i = ((a * (1024 - k)) + (b * k)) >> 10;
w = i;
@@ -1124,7 +1132,7 @@
ewin->client.win, ShapeBounding,
ShapeSet);
EoMoveResize(ewin, x, y, w, h);
- EwinBorderCalcSizes(ewin);
+ EwinBorderCalcSizes(ewin, 1);
k = ETimedLoopNext();
}
@@ -1151,7 +1159,7 @@
if ((Conf.animate_shading) || (ewin->type == EWIN_TYPE_MENU))
{
ETimedLoopInit(0, 1024, speed);
- for (k = 0; k <= 1024;)
+ for (k = 0; k < 1024;)
{
i = ((a * (1024 - k)) + (b * k)) >> 10;
j = ((c * (1024 - k)) + (d * k)) >> 10;
@@ -1167,7 +1175,7 @@
ShapeBounding, 0, 0, ewin->client.win,
ShapeBounding, ShapeSet);
EoMoveResize(ewin, x, y, w, h);
- EwinBorderCalcSizes(ewin);
+ EwinBorderCalcSizes(ewin, 1);
k = ETimedLoopNext();
}
@@ -1192,7 +1200,7 @@
if ((Conf.animate_shading) || (ewin->type == EWIN_TYPE_MENU))
{
ETimedLoopInit(0, 1024, speed);
- for (k = 0; k <= 1024;)
+ for (k = 0; k < 1024;)
{
i = ((a * (1024 - k)) + (b * k)) >> 10;
h = i;
@@ -1211,7 +1219,7 @@
ewin->client.win, ShapeBounding,
ShapeSet);
EoMoveResize(ewin, x, y, w, h);
- EwinBorderCalcSizes(ewin);
+ EwinBorderCalcSizes(ewin, 1);
k = ETimedLoopNext();
}
@@ -1238,7 +1246,7 @@
if ((Conf.animate_shading) || (ewin->type == EWIN_TYPE_MENU))
{
ETimedLoopInit(0, 1024, speed);
- for (k = 0; k <= 1024;)
+ for (k = 0; k < 1024;)
{
i = ((a * (1024 - k)) + (b * k)) >> 10;
j = ((c * (1024 - k)) + (d * k)) >> 10;
@@ -1254,7 +1262,7 @@
ShapeBounding, 0, 0, ewin->client.win,
ShapeBounding, ShapeSet);
EoMoveResize(ewin, x, y, w, h);
- EwinBorderCalcSizes(ewin);
+ EwinBorderCalcSizes(ewin, 1);
k = ETimedLoopNext();
}
@@ -1267,6 +1275,11 @@
att.win_gravity = NorthWestGravity;
EChangeWindowAttributes(ewin->client.win, CWWinGravity, &att);
+ EMoveResizeWindow(ewin->client.win, 0, 0, ewin->client.w, ewin->client.h);
+ EMoveResizeWindow(ewin->win_container,
+ ewin->border->border.left,
+ ewin->border->border.top, ewin->client.w, ewin->client.h);
+
if (ewin->client.shaped)
EShapeCombineShape(ewin->win_container, ShapeBounding, 0, 0,
ewin->client.win, ShapeBounding, ShapeSet);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/ewins.c,v
retrieving revision 1.62
retrieving revision 1.63
diff -u -3 -r1.62 -r1.63
--- ewins.c 12 May 2005 22:38:00 -0000 1.62
+++ ewins.c 21 May 2005 20:58:18 -0000 1.63
@@ -149,8 +149,6 @@
ewin->client.event_mask = EWIN_CLIENT_EVENT_MASK;
AddItem(ewin, "EWIN", win, LIST_TYPE_EWIN);
- XShapeSelectInput(disp, win, ShapeNotifyMask);
-
if (EventDebug(EDBUG_TYPE_EWINS))
Eprintf("EwinCreate %#lx frame=%#lx state=%d\n", ewin->client.win,
EoGetWin(ewin), ewin->state);
@@ -163,6 +161,7 @@
if (!EwinIsInternal(ewin))
{
+ XShapeSelectInput(disp, win, ShapeNotifyMask);
XSetWindowBorderWidth(disp, win, 0);
ewin->client.bw = 0;
}
@@ -504,7 +503,7 @@
#endif
if (!ewin->shapedone)
{
- PropagateShapes(EoGetWin(ewin));
+ EShapePropagate(EoGetWin(ewin));
EoChangeShape(ewin);
ewin->shapedone = 1;
}
@@ -1164,7 +1163,7 @@
Mode.move.check = 0; /* Don't restrict client requests */
MoveResizeEwin(ewin, x, y, w, h);
Mode.move.check = 1;
-
+#if 0 /* FIXME - Remove? */
{
char pshaped;
@@ -1172,10 +1171,11 @@
ICCCM_GetShapeInfo(ewin);
if (pshaped != ewin->client.shaped)
{
- SyncBorderToEwin(ewin);
+ ewin->shapedone = 0;
EwinPropagateShapes(ewin);
}
}
+#endif
ReZoom(ewin);
}
else
@@ -1204,6 +1204,7 @@
w = ev->xresizerequest.width;
h = ev->xresizerequest.height;
ResizeEwin(ewin, w, h);
+#if 0 /* FIXME - Remove? */
{
char pshaped;
@@ -1211,10 +1212,11 @@
ICCCM_GetShapeInfo(ewin);
if (pshaped != ewin->client.shaped)
{
- SyncBorderToEwin(ewin);
+ ewin->shapedone = 0;
EwinPropagateShapes(ewin);
}
}
+#endif
ReZoom(ewin);
}
else
@@ -1254,7 +1256,6 @@
HintsProcessPropertyChange(ewin, ev->xproperty.atom);
SessionGetInfo(ewin, ev->xproperty.atom);
- SyncBorderToEwin(ewin);
EwinChangesProcess(ewin);
EUngrabServer();
@@ -1263,14 +1264,8 @@
static void
EwinEventShapeChange(EWin * ewin)
{
- const Border *b;
-
- b = ewin->border;
- SyncBorderToEwin(ewin);
-#if 0
- if (ewin->border == b)
-#endif
- ewin->shapedone = 0;
+ ICCCM_GetShapeInfo(ewin);
+ ewin->shapedone = 0;
EwinPropagateShapes(ewin);
}
@@ -1598,7 +1593,7 @@
if (EWinChanges.flags & EWIN_CHANGE_NAME)
{
EwinBorderUpdateInfo(ewin);
- EwinBorderCalcSizes(ewin);
+ EwinBorderCalcSizes(ewin, 1);
}
if (EWinChanges.flags & EWIN_CHANGE_DESKTOP)
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/icccm.c,v
retrieving revision 1.95
retrieving revision 1.96
diff -u -3 -r1.95 -r1.96
--- icccm.c 12 May 2005 22:38:01 -0000 1.95
+++ icccm.c 21 May 2005 20:58:18 -0000 1.96
@@ -765,46 +765,14 @@
void
ICCCM_GetShapeInfo(EWin * ewin)
{
- XRectangle *rl = NULL;
- int rn = 0, ord;
- int x, y, w, h, d;
- Window rt;
-
EGrabServer();
- EGetGeometry(ewin->client.win, &rt, &x, &y, &w, &h, &d, &d);
- rl = EShapeGetRectangles(ewin->client.win, ShapeBounding, &rn, &ord);
+ ewin->client.shaped = EShapeCopy(ewin->win_container, ewin->client.win);
EUngrabServer();
- if (rn < 1)
- {
- ewin->client.shaped = 0;
- EShapeCombineMask(ewin->win_container, ShapeBounding, 0, 0, None,
- ShapeSet);
- }
- else if (rn == 1)
- {
- if ((rl[0].x <= 0) && (rl[0].y <= 0) && (rl[0].width >= w)
- && (rl[0].height >= h))
- {
- ewin->client.shaped = 0;
- EShapeCombineMask(ewin->win_container, ShapeBounding, 0, 0,
- None, ShapeSet);
- }
- else
- {
- ewin->client.shaped = 1;
- EShapeCombineShape(ewin->win_container, ShapeBounding, 0, 0,
- ewin->client.win, ShapeBounding, ShapeSet);
- }
- }
- else
- {
- ewin->client.shaped = 1;
- EShapeCombineShape(ewin->win_container, ShapeBounding, 0, 0,
- ewin->client.win, ShapeBounding, ShapeSet);
- }
- if (rl)
- XFree(rl);
+#if 0 /* Debug */
+ Eprintf("ICCCM_GetShapeInfo %#lx cont=%#lx shaped=%d\n",
+ ewin->client.win, ewin->win_container, ewin->client.shaped);
+#endif
}
void
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/iconify.c,v
retrieving revision 1.148
retrieving revision 1.149
diff -u -3 -r1.148 -r1.149
--- iconify.c 15 May 2005 18:29:45 -0000 1.148
+++ iconify.c 21 May 2005 20:58:18 -0000 1.149
@@ -1654,13 +1654,13 @@
}
#if 0 /* FIXME - Remove? */
- PropagateShapes(ib->win);
+ EShapePropagate(ib->win);
if (ib->ewin)
{
const Border *b;
b = ib->ewin->border;
- SyncBorderToEwin(ib->ewin);
+ ICCCM_GetShapeInfo(ib->ewin);
if (ib->ewin->border == b)
EwinPropagateShapes(ib->ewin);
}
@@ -1918,14 +1918,14 @@
EClearWindow(ib->icon_win);
if (ib->type == IB_TYPE_SYSTRAY && ib->nobg && !ib->draw_icon_base)
- PropagateShapes(ib->icon_win);
+ EShapePropagate(ib->icon_win);
}
else
{
/* Transparent and no objects */
EUnmapWindow(ib->icon_win);
}
- PropagateShapes(ib->win);
+ EShapePropagate(ib->win);
ICCCM_GetShapeInfo(ib->ewin);
ib->ewin->shapedone = 0;
EwinPropagateShapes(ib->ewin);
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/menus.c,v
retrieving revision 1.193
retrieving revision 1.194
diff -u -3 -r1.193 -r1.194
--- menus.c 14 May 2005 19:40:34 -0000 1.193
+++ menus.c 21 May 2005 20:58:18 -0000 1.194
@@ -876,7 +876,7 @@
{
for (i = 0; i < m->num; i++)
MenuDrawItem(m, m->items[i], 0);
- PropagateShapes(m->win);
+ EShapePropagate(m->win);
}
}
@@ -942,7 +942,7 @@
EClearWindow(mi->win);
if ((shape) && (m->style->use_item_bg))
- PropagateShapes(m->win);
+ EShapePropagate(m->win);
if (mi->state == STATE_HILITED)
{
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/slideout.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -3 -r1.30 -r1.31
--- slideout.c 7 May 2005 11:20:00 -0000 1.30
+++ slideout.c 21 May 2005 20:58:18 -0000 1.31
@@ -315,7 +315,7 @@
break;
}
}
- PropagateShapes(s->win);
+ EShapePropagate(s->win);
}
static void
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/warp.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -3 -r1.63 -r1.64
--- warp.c 14 May 2005 19:40:35 -0000 1.63
+++ warp.c 21 May 2005 20:58:18 -0000 1.64
@@ -148,7 +148,7 @@
0, ST_WARPLIST);
}
- PropagateShapes(warpFocusWindow->win);
+ EShapePropagate(warpFocusWindow->win);
EobjMap(warpFocusWindow, 0);
/*
@@ -202,7 +202,7 @@
}
}
- PropagateShapes(warpFocusWindow->win);
+ EShapePropagate(warpFocusWindow->win);
EFlush();
}
===================================================================
RCS file: /cvsroot/enlightenment/e16/e/src/x.c,v
retrieving revision 1.90
retrieving revision 1.91
diff -u -3 -r1.90 -r1.91
--- x.c 16 May 2005 15:31:28 -0000 1.90
+++ x.c 21 May 2005 20:58:18 -0000 1.91
@@ -537,191 +537,6 @@
}
void
-EShapeCombineMask(Window win, int dest, int x, int y, Pixmap pmap, int op)
-{
- EXID *xid;
-
- xid = EXidFind(win);
- if (xid)
- {
- char wasshaped = 0;
-
- if (xid->rects)
- {
- xid->num_rect = 0;
- XFree(xid->rects);
- xid->rects = NULL;
- wasshaped = 1;
- }
- if (pmap)
- {
- XShapeCombineMask(disp, win, dest, x, y, pmap, op);
- xid->rects =
- XShapeGetRectangles(disp, win, dest, &(xid->num_rect),
- &(xid->ord));
- if (xid->rects)
- {
- if (xid->num_rect == 1)
- {
- if ((xid->rects[0].x == 0) && (xid->rects[0].y == 0)
- && (xid->rects[0].width == xid->w)
- && (xid->rects[0].height == xid->h))
- {
- xid->num_rect = 0;
- XFree(xid->rects);
- xid->rects = NULL;
- }
- }
- }
- }
- else if ((!pmap) && (wasshaped))
- XShapeCombineMask(disp, win, dest, x, y, pmap, op);
- }
- else
- XShapeCombineMask(disp, win, dest, x, y, pmap, op);
-}
-
-void
-EShapeCombineMaskTiled(Window win, int dest, int x, int y,
- Pixmap pmap, int op, int w, int h)
-{
- XGCValues gcv;
- GC gc;
- Window tm;
-
- gcv.fill_style = FillTiled;
- gcv.tile = pmap;
- gcv.ts_x_origin = 0;
- gcv.ts_y_origin = 0;
- tm = ECreatePixmap(win, w, h, 1);
- gc = ECreateGC(tm, GCFillStyle | GCTile |
- GCTileStipXOrigin | GCTileStipYOrigin, &gcv);
- XFillRectangle(disp, tm, gc, 0, 0, w, h);
- EFreeGC(gc);
- EShapeCombineMask(win, dest, x, y, tm, op);
- EFreePixmap(tm);
-}
-
-void
-EShapeCombineRectangles(Window win, int dest, int x, int y,
- XRectangle * rect, int n_rects, int op, int ordering)
-{
- EXID *xid;
-
- xid = EXidFind(win);
- if (xid)
- {
- if (n_rects == 1 && op == ShapeSet)
- {
- if ((rect[0].x == 0) && (rect[0].y == 0)
- && (rect[0].width == xid->w) && (rect[0].height == xid->h))
- {
- xid->num_rect = 0;
- XFree(xid->rects);
- xid->rects = NULL;
- XShapeCombineMask(disp, win, dest, x, y, None, op);
- return;
- }
- }
- xid->num_rect = 0;
- if (xid->rects)
- XFree(xid->rects);
- XShapeCombineRectangles(disp, win, dest, x, y, rect, n_rects, op,
- ordering);
- xid->rects =
- XShapeGetRectangles(disp, win, dest, &(xid->num_rect), &(xid->ord));
- if (xid->rects)
- {
- if (xid->num_rect == 1)
- {
- if ((xid->rects[0].x == 0) && (xid->rects[0].y == 0)
- && (xid->rects[0].width == xid->w)
- && (xid->rects[0].height == xid->h))
- {
- xid->num_rect = 0;
- XFree(xid->rects);
- xid->rects = NULL;
- }
- }
- }
- }
- else
- XShapeCombineRectangles(disp, win, dest, x, y, rect, n_rects, op,
- ordering);
-}
-
-void
-EShapeCombineShape(Window win, int dest, int x, int y,
- Window src_win, int src_kind, int op)
-{
- EXID *xid;
-
- xid = EXidFind(win);
- if (xid)
- {
- xid->num_rect = 0;
- if (xid->rects)
- XFree(xid->rects);
- XShapeCombineShape(disp, win, dest, x, y, src_win, src_kind, op);
- xid->rects =
- XShapeGetRectangles(disp, win, dest, &(xid->num_rect), &(xid->ord));
- if (xid->rects)
- {
- if (xid->num_rect == 1)
- {
- if ((xid->rects[0].x == 0) && (xid->rects[0].y == 0)
- && (xid->rects[0].width == xid->w)
- && (xid->rects[0].height == xid->h))
- {
- xid->num_rect = 0;
- XFree(xid->rects);
- xid->rects = NULL;
- }
- }
- }
- }
- else
- XShapeCombineShape(disp, win, dest, x, y, src_win, src_kind, op);
-}
-
-XRectangle *
-EShapeGetRectangles(Window win, int dest, int *rn, int *ord)
-{
- EXID *xid;
-
- xid = EXidFind(win);
- if (xid && !xid->attached)
- {
- XRectangle *r;
-
- *rn = xid->num_rect;
- *ord = xid->ord;
- if (xid->num_rect > 0)
- {
- r = Emalloc(sizeof(XRectangle) * xid->num_rect);
- memcpy(r, xid->rects, sizeof(XRectangle) * xid->num_rect);
- return r;
- }
- else
- return NULL;
- }
- else
- {
- XRectangle *r, *rr;
-
- r = XShapeGetRectangles(disp, win, dest, rn, ord);
- if (r)
- {
- rr = Emalloc(sizeof(XRectangle) * *rn);
- memcpy(rr, r, sizeof(XRectangle) * *rn);
- XFree(r);
- return rr;
- }
- }
- return NULL;
-}
-
-void
EReparentWindow(Window win, Window parent, int x, int y)
{
EXID *xid;
@@ -922,6 +737,364 @@
XSelectInput(disp, win, xwa.your_event_mask);
}
+#define DEBUG_SHAPE_OPS 0
+#define DEBUG_SHAPE_PROPAGATE 0
+
+#if DEBUG_SHAPE_OPS
+static void
+EShapeShow(const char *txt, XRectangle * pr, int nr)
+{
+ int i;
+
+ Eprintf("%s nr=%d\n", txt, nr);
+ for (i = 0; i < nr; i++)
+ Eprintf(" %d - %4d,%4d %4dx%4d\n", i,
+ pr[i].x, pr[i].y, pr[i].width, pr[i].height);
+}
+#endif
+
+static void
+EXidShapeUpdate(EXID * xid)
+{
+ if (xid->rects)
+ {
+ XFree(xid->rects);
+ xid->num_rect = 0;
+ }
+
+ xid->rects =
+ XShapeGetRectangles(disp, xid->win, ShapeBounding, &(xid->num_rect),
+ &(xid->ord));
+ if (xid->rects)
+ {
+ if (xid->num_rect == 1)
+ {
+ if ((xid->rects[0].x == 0) && (xid->rects[0].y == 0)
+ && (xid->rects[0].width == xid->w)
+ && (xid->rects[0].height == xid->h))
+ {
+ xid->num_rect = 0;
+ XFree(xid->rects);
+ xid->rects = NULL;
+ }
+ }
+ }
+ else
+ {
+ xid->num_rect = -1;
+ }
+#if DEBUG_SHAPE_OPS
+ EShapeShow("EXidShapeUpdate", xid->rects, xid->num_rect);
+#endif
+}
+
+void
+EShapeCombineMask(Window win, int dest, int x, int y, Pixmap pmap, int op)
+{
+ EXID *xid;
+
+ xid = EXidFind(win);
+ if (xid)
+ {
+ char wasshaped = 0;
+
+ if (xid->rects)
+ {
+ xid->num_rect = 0;
+ XFree(xid->rects);
+ xid->rects = NULL;
+ wasshaped = 1;
+ }
+#if DEBUG_SHAPE_OPS
+ Eprintf("EShapeCombineMask %#lx wassh=%d\n", win, wasshaped);
+#endif
+ if (pmap)
+ {
+ XShapeCombineMask(disp, win, dest, x, y, pmap, op);
+ EXidShapeUpdate(xid);
+ }
+ else if (wasshaped)
+ XShapeCombineMask(disp, win, dest, x, y, pmap, op);
+ }
+ else
+ XShapeCombineMask(disp, win, dest, x, y, pmap, op);
+}
+
+void
+EShapeCombineMaskTiled(Window win, int dest, int x, int y,
+ Pixmap pmap, int op, int w, int h)
+{
+ XGCValues gcv;
+ GC gc;
+ Window tm;
+
+ gcv.fill_style = FillTiled;
+ gcv.tile = pmap;
+ gcv.ts_x_origin = 0;
+ gcv.ts_y_origin = 0;
+ tm = ECreatePixmap(win, w, h, 1);
+ gc = ECreateGC(tm, GCFillStyle | GCTile |
+ GCTileStipXOrigin | GCTileStipYOrigin, &gcv);
+ XFillRectangle(disp, tm, gc, 0, 0, w, h);
+ EFreeGC(gc);
+ EShapeCombineMask(win, dest, x, y, tm, op);
+ EFreePixmap(tm);
+}
+
+void
+EShapeCombineRectangles(Window win, int dest, int x, int y,
+ XRectangle * rect, int n_rects, int op, int ordering)
+{
+ EXID *xid;
+
+#if DEBUG_SHAPE_OPS
+ Eprintf("EShapeCombineRectangles %#lx %d\n", win, n_rects);
+#endif
+
+ xid = EXidFind(win);
+ if (xid)
+ {
+ if (n_rects == 1 && op == ShapeSet)
+ {
+ if ((rect[0].x == 0) && (rect[0].y == 0) &&
+ (rect[0].width == xid->w) && (rect[0].height == xid->h))
+ {
+ xid->num_rect = 0;
+ XFree(xid->rects);
+ xid->rects = NULL;
+ XShapeCombineMask(disp, win, dest, x, y, None, op);
+ return;
+ }
+ }
+ XShapeCombineRectangles(disp, win, dest, x, y, rect, n_rects, op,
+ ordering);
+ if (n_rects > 1)
+ {
+ /* Limit shape to window extents */
+ XRectangle r;
+
+ r.x = r.y = 0;
+ r.width = xid->w;
+ r.height = xid->h;
+ XShapeCombineRectangles(disp, win, ShapeBounding, 0, 0, &r,
+ 1, ShapeIntersect, Unsorted);
+ }
+ EXidShapeUpdate(xid);
+ }
+ else
+ XShapeCombineRectangles(disp, win, dest, x, y, rect, n_rects, op,
+ ordering);
+}
+
+void
+EShapeCombineShape(Window win, int dest, int x, int y,
+ Window src_win, int src_kind, int op)
+{
+ EXID *xid;
+
+ xid = EXidFind(win);
+ if (xid)
+ {
+ XShapeCombineShape(disp, win, dest, x, y, src_win, src_kind, op);
+ EXidShapeUpdate(xid);
+ }
+ else
+ XShapeCombineShape(disp, win, dest, x, y, src_win, src_kind, op);
+}
+
+XRectangle *
+EShapeGetRectangles(Window win, int dest, int *rn, int *ord)
+{
+ EXID *xid;
+
+ xid = EXidFind(win);
+ if (xid && !xid->attached)
+ {
+ XRectangle *r;
+
+#if DEBUG_SHAPE_OPS
+ Eprintf("EShapeGetRectangles-A %#lx nr=%d\n", win, xid->num_rect);
+#endif
+ *rn = xid->num_rect;
+ *ord = xid->ord;
+ if (xid->num_rect > 0)
+ {
+ r = Emalloc(sizeof(XRectangle) * xid->num_rect);
+ memcpy(r, xid->rects, sizeof(XRectangle) * xid->num_rect);
+ return r;
+ }
+ }
+ else
+ {
+ XRectangle *r, *rr;
+
+#if DEBUG_SHAPE_OPS
+ Eprintf("EShapeGetRectangles-B %#lx nr=%d\n", win, xid->num_rect);
+#endif
+ r = XShapeGetRectangles(disp, win, dest, rn, ord);
+ if (r)
+ {
+ rr = Emalloc(sizeof(XRectangle) * *rn);
+ memcpy(rr, r, sizeof(XRectangle) * *rn);
+ XFree(r);
+ return rr;
+ }
+ }
+ return NULL;
+}
+
+int
+EShapeCopy(Window dst, Window src)
+{
+ XRectangle *rl;
+ int rn = 0, ord;
+ int x, y, w, h, d;
+ Window rt;
+
+ EGrabServer();
+ EGetGeometry(src, &rt, &x, &y, &w, &h, &d, &d);
+ rl = EShapeGetRectangles(src, ShapeBounding, &rn, &ord);
+ EUngrabServer();
+
+ if (rn < 0)
+ {
+ /* Source has empty shape */
+ EShapeCombineShape(dst, ShapeBounding, 0, 0,
+ src, ShapeBounding, ShapeSet);
+ }
+ else if (rn == 0)
+ {
+ /* Source has default shape (no shape) */
+ EShapeCombineMask(dst, ShapeBounding, 0, 0, None, ShapeSet);
+ }
+ else if (rn == 1)
+ {
+ if ((rl[0].x <= 0) && (rl[0].y <= 0) && (rl[0].width >= w)
+ && (rl[0].height >= h))
+ {
+ rn = 0;
+ EShapeCombineMask(dst, ShapeBounding, 0, 0, None, ShapeSet);
+ }
+ else
+ {
+ EShapeCombineShape(dst, ShapeBounding, 0, 0,
+ src, ShapeBounding, ShapeSet);
+ }
+ }
+ else
+ {
+ EShapeCombineShape(dst, ShapeBounding, 0, 0,
+ src, ShapeBounding, ShapeSet);
+ }
+ if (rl)
+ XFree(rl);
+
+ return rn != 0;
+}
+
+void
+EShapePropagate(Window win)
+{
+ Window rt, par, *list = NULL;
+ unsigned int i, num, num_rects;
+ int k, rn, ord;
+ int x, y, w, h, xx, yy, ww, hh, d;
+ XRectangle *rects, *rl;
+ XWindowAttributes att;
+
+ if (!EGetGeometry(win, &rt, &xx, &yy, &ww, &hh, &d, &d))
+ return;
+ if ((ww <= 0) || (hh <= 0))
+ return;
+
+#if DEBUG_SHAPE_PROPAGATE
+ Eprintf("EShapePropagate %#lx %d,%d %dx%d\n", win, xx, yy, ww, hh);
+#endif
+
+ XQueryTree(disp, win, &rt, &par, &list, &num);
+ if (!list)
+ return;
+
+ num_rects = 0;
+ rects = NULL;
+
+ /* go through all child windows and create/inset spans */
+ for (i = 0; i < num; i++)
+ {
+ XGetWindowAttributes(disp, list[i], &att);
+#if DEBUG_SHAPE_PROPAGATE > 1
+ Eprintf("%3d %#lx(%d): %4d,%4d %4dx%4d\n", i, list[i], att.map_state,
+ att.x, att.y, att.width, att.height);
+#endif
+ if ((att.class != InputOutput) || (att.map_state == IsUnmapped))
+ continue;
+
+ x = att.x;
+ y = att.y;
+ w = att.width;
+ h = att.height;
+ if (x >= ww || y >= hh || x + w < 0 || y + h < 0)
+ continue;
+
+ rl = EShapeGetRectangles(list[i], ShapeBounding, &rn, &ord);
+
+ if (rn > 0)
+ {
+ rects = Erealloc(rects, (num_rects + rn) * sizeof(XRectangle));
+ /* go through all clip rects in thsi window's shape */
+ for (k = 0; k < rn; k++)
+ {
+ /* for each clip rect, add it to the rect list */
+ rects[num_rects + k].x = x + rl[k].x;
+ rects[num_rects + k].y = y + rl[k].y;
+ rects[num_rects + k].width = rl[k].width;
+ rects[num_rects + k].height = rl[k].height;
+#if DEBUG_SHAPE_PROPAGATE > 1
+ Eprintf(" - %d: %4d,%4d %4dx%4d\n", k,
+ rects[num_rects + k].x,
+ rects[num_rects + k].y, rects[num_rects + k].width,
+ rects[num_rects + k].height);
+#endif
+ }
+ num_rects += rn;
+ Efree(rl);
+ }
+ else if (rn == 0)
+ {
+ /* Unshaped */
+ rects = Erealloc(rects, (num_rects + 1) * sizeof(XRectangle));
+
+ rects[num_rects].x = x;
+ rects[num_rects].y = y;
+ rects[num_rects].width = w;
+ rects[num_rects].height = h;
+ num_rects++;
+ }
+ }
+
+#if DEBUG_SHAPE_PROPAGATE > 1
+ Eprintf("EShapePropagate %#lx nr=%d\n", win, num_rects);
+ for (i = 0; i < num_rects; i++)
+ Eprintf("%3d %4d,%4d %4dx%4d\n", i, rects[i].x, rects[i].y,
+ rects[i].width, rects[i].height);
+#endif
+
+ /* set the rects as the shape mask */
+ if (rects)
+ {
+ EShapeCombineRectangles(win, ShapeBounding, 0, 0, rects,
+ num_rects, ShapeSet, Unsorted);
+ Efree(rects);
+ }
+ else
+ {
+ /* Empty shape */
+ EShapeCombineRectangles(win, ShapeBounding, 0, 0, NULL, 0, ShapeSet,
+ Unsorted);
+ }
+ XFree(list);
+}
+
GC
ECreateGC(Drawable d, unsigned long mask, XGCValues * val)
{
-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs