forked from e16/e16
1
0
Fork 0

Add function to create inverted shape pixmap.

SVN revision: 45487
This commit is contained in:
Kim Woelders 2010-01-23 14:26:28 +00:00
parent 96037118e2
commit 0ace2f68e6
2 changed files with 19 additions and 5 deletions

23
src/x.c
View File

@ -1534,9 +1534,8 @@ EShapeSetShape(Win win, int x, int y, Win src_win)
return win->num_rect != 0;
}
/* Build mask from window shape rects */
Pixmap
EWindowGetShapePixmap(Win win)
static Pixmap
_EWindowGetShapePixmap(Win win, unsigned int fg, unsigned int bg)
{
Pixmap mask;
GC gc;
@ -1549,10 +1548,10 @@ EWindowGetShapePixmap(Win win)
mask = ECreatePixmap(win, win->w, win->h, 1);
gc = EXCreateGC(mask, 0, NULL);
XSetForeground(disp, gc, 0);
XSetForeground(disp, gc, bg);
XFillRectangle(disp, mask, gc, 0, 0, win->w, win->h);
XSetForeground(disp, gc, 1);
XSetForeground(disp, gc, fg);
rect = win->rects;
for (i = 0; i < win->num_rect; i++)
XFillRectangle(disp, mask, gc, rect[i].x, rect[i].y,
@ -1563,6 +1562,20 @@ EWindowGetShapePixmap(Win win)
return mask;
}
/* Build mask from window shape rects */
Pixmap
EWindowGetShapePixmap(Win win)
{
return _EWindowGetShapePixmap(win, 1, 0);
}
/* Build inverted mask from window shape rects */
Pixmap
EWindowGetShapePixmapInverted(Win win)
{
return _EWindowGetShapePixmap(win, 0, 1);
}
Pixmap
ECreatePixmap(Win win, unsigned int width, unsigned int height,
unsigned int depth)

View File

@ -218,6 +218,7 @@ int EShapeSetShape(Win win, int x, int y, Win src_win);
int EShapePropagate(Win win);
int EShapeCheck(Win win);
Pixmap EWindowGetShapePixmap(Win win);
Pixmap EWindowGetShapePixmapInverted(Win win);
Bool EQueryPointer(Win win, int *px, int *py,
Window * pchild, unsigned int *pmask);