Wrap XDraw/FillRectangle.
This commit is contained in:
parent
f334de50cf
commit
d1b7b142cf
13
src/hiwin.c
13
src/hiwin.c
|
@ -41,7 +41,6 @@ struct _hiwin {
|
|||
void (*evcb) (Win win, XEvent * ev, void *data);
|
||||
void *data;
|
||||
char animate;
|
||||
GC gc;
|
||||
EImage *im;
|
||||
};
|
||||
|
||||
|
@ -167,18 +166,15 @@ static const HiwinRender HiwinRenderIclass = {
|
|||
};
|
||||
|
||||
static void
|
||||
HiwinRenderPixmapInit(Hiwin * phi)
|
||||
HiwinRenderPixmapInit(Hiwin * phi __UNUSED__)
|
||||
{
|
||||
phi->gc = EXCreateGC(EoGetXwin(phi), 0, NULL);
|
||||
}
|
||||
|
||||
static void
|
||||
HiwinRenderPixmapDrawX(Hiwin * phi, Drawable draw)
|
||||
{
|
||||
XSetForeground(disp, phi->gc, Dpy.pixel_black);
|
||||
XFillRectangle(disp, draw, phi->gc, 0, 0, EoGetW(phi), EoGetH(phi));
|
||||
XSetForeground(disp, phi->gc, Dpy.pixel_white);
|
||||
XFillRectangle(disp, draw, phi->gc, 1, 1, EoGetW(phi) - 2, EoGetH(phi) - 2);
|
||||
EXPaintRectangle(draw, 0, 0, EoGetW(phi), EoGetH(phi),
|
||||
Dpy.pixel_black, Dpy.pixel_white);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -199,9 +195,6 @@ HiwinRenderPixmapFini(Hiwin * phi, int shown)
|
|||
HiwinRenderPixmapDrawX(phi, pmap);
|
||||
EClearWindow(EoGetWin(phi));
|
||||
}
|
||||
|
||||
EXFreeGC(phi->gc);
|
||||
phi->gc = NULL;
|
||||
}
|
||||
|
||||
static const HiwinRender HiwinRenderPixmap = {
|
||||
|
|
18
src/pager.c
18
src/pager.c
|
@ -463,10 +463,8 @@ doPagerUpdate(Pager * p)
|
|||
}
|
||||
else
|
||||
{
|
||||
XSetForeground(disp, gc, Dpy.pixel_black);
|
||||
XDrawRectangle(disp, pmap, gc, wx - 1, wy - 1, ww + 1, wh + 1);
|
||||
XSetForeground(disp, gc, Dpy.pixel_white);
|
||||
XFillRectangle(disp, pmap, gc, wx, wy, ww, wh);
|
||||
EXPaintRectangle(pmap, wx, wy, ww, wh,
|
||||
Dpy.pixel_black, Dpy.pixel_white);
|
||||
}
|
||||
}
|
||||
#if USE_COMPOSITE
|
||||
|
@ -560,7 +558,6 @@ static void
|
|||
PagerUpdateBg(Pager * p)
|
||||
{
|
||||
Pixmap pmap;
|
||||
GC gc;
|
||||
Background *bg;
|
||||
ImageClass *ic;
|
||||
int pager_mode = PagersGetMode();
|
||||
|
@ -620,16 +617,7 @@ PagerUpdateBg(Pager * p)
|
|||
return;
|
||||
}
|
||||
|
||||
gc = EXCreateGC(pmap, 0, NULL);
|
||||
if (!gc)
|
||||
return;
|
||||
|
||||
XSetForeground(disp, gc, Dpy.pixel_black);
|
||||
XDrawRectangle(disp, pmap, gc, 0, 0, p->dw, p->dh);
|
||||
XSetForeground(disp, gc, Dpy.pixel_white);
|
||||
XFillRectangle(disp, pmap, gc, 1, 1, p->dw - 2, p->dh - 2);
|
||||
|
||||
EXFreeGC(gc);
|
||||
EXPaintRectangle(pmap, 0, 0, p->dw, p->dh, Dpy.pixel_black, Dpy.pixel_white);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
32
src/x.c
32
src/x.c
|
@ -1702,6 +1702,38 @@ EXFillAreaSolid(Drawable dst, int x, int y, unsigned int w, unsigned int h,
|
|||
EXFreeGC(gc);
|
||||
}
|
||||
|
||||
static void
|
||||
_EXDrawRectangle(Drawable dst, GC gc, int x, int y,
|
||||
unsigned int w, unsigned int h, unsigned int pixel)
|
||||
{
|
||||
XSetForeground(disp, gc, pixel);
|
||||
XDrawRectangle(disp, dst, gc, x, y, w, h);
|
||||
}
|
||||
|
||||
static void
|
||||
_EXFillRectangle(Drawable dst, GC gc, int x, int y,
|
||||
unsigned int w, unsigned int h, unsigned int pixel)
|
||||
{
|
||||
XSetForeground(disp, gc, pixel);
|
||||
XFillRectangle(disp, dst, gc, x, y, w, h);
|
||||
}
|
||||
|
||||
void
|
||||
EXPaintRectangle(Drawable dst, int x, int y,
|
||||
unsigned int w, unsigned int h,
|
||||
unsigned int fg, unsigned int bg)
|
||||
{
|
||||
GC gc;
|
||||
|
||||
if (w == 0 || h == 0)
|
||||
return;
|
||||
gc = EXCreateGC(dst, 0, NULL);
|
||||
_EXDrawRectangle(dst, gc, x, y, w - 1, h - 1, fg);
|
||||
if (w > 2 && h > 2)
|
||||
_EXFillRectangle(dst, gc, x + 1, y + 1, w - 2, h - 2, bg);
|
||||
EXFreeGC(gc);
|
||||
}
|
||||
|
||||
GC
|
||||
EXCreateGC(Drawable draw, unsigned int mask, XGCValues * val)
|
||||
{
|
||||
|
|
|
@ -268,6 +268,9 @@ void EXCopyAreaTiled(Drawable src, Pixmap mask, Drawable dst,
|
|||
void EXFillAreaSolid(Drawable dst, int x, int y,
|
||||
unsigned int w, unsigned int h,
|
||||
unsigned int pixel);
|
||||
void EXPaintRectangle(Drawable dst, int x, int y,
|
||||
unsigned int w, unsigned int h,
|
||||
unsigned int fg, unsigned int bg);
|
||||
|
||||
void EXWarpPointer(Window xwin, int x, int y);
|
||||
int EXQueryPointer(Window xwin, int *px, int *py,
|
||||
|
|
Loading…
Reference in New Issue