kwo pushed a commit to branch master.

http://git.enlightenment.org/e16/e16.git/commit/?id=a14e2978d85da39a36ad604284ad93087d7af23b

commit a14e2978d85da39a36ad604284ad93087d7af23b
Author: Kim Woelders <k...@woelders.dk>
Date:   Sat Dec 28 22:35:10 2013 +0100

    Wrap some calls to XFillRectangle.
---
 src/backgrounds.c | 10 +---------
 src/ecompmgr.c    |  9 +--------
 src/extinitwin.c  | 11 ++---------
 src/iclass.c      |  1 -
 src/x.c           | 20 ++++++++++++++++----
 src/xwin.h        |  3 +++
 6 files changed, 23 insertions(+), 31 deletions(-)

diff --git a/src/backgrounds.c b/src/backgrounds.c
index bdedda0..606e4ed 100644
--- a/src/backgrounds.c
+++ b/src/backgrounds.c
@@ -588,16 +588,8 @@ BackgroundRealize(Background * bg, Win win, Drawable draw, 
unsigned int rw,
        pixel = EAllocColor(WinGetCmap(VROOT), bg->bg_solid);
 
        if (!is_win)
-         {
-            GC                  gc;
+          EXFillAreaSolid(draw, 0, 0, rw, rh, pixel);
 
-            gc = EXCreateGC(draw, 0, NULL);
-            XSetClipMask(disp, gc, 0);
-            XSetFillStyle(disp, gc, FillSolid);
-            XSetForeground(disp, gc, pixel);
-            XFillRectangle(disp, draw, gc, 0, 0, rw, rh);
-            EXFreeGC(gc);
-         }
        if (ppmap)
           *ppmap = NoXID;
        if (ppixel)
diff --git a/src/ecompmgr.c b/src/ecompmgr.c
index dc0d5b0..0aecae3 100644
--- a/src/ecompmgr.c
+++ b/src/ecompmgr.c
@@ -275,15 +275,8 @@ ECompMgrDeskConfigure(Desk * dsk)
 
    if (dsk->bg.pmap == NoXID)
      {
-       GC                  gc;
-
        pmap = XCreatePixmap(disp, Mode_compmgr.root, 1, 1, WinGetDepth(VROOT));
-       gc = EXCreateGC(pmap, 0, NULL);
-       XSetClipMask(disp, gc, 0);
-       XSetFillStyle(disp, gc, FillSolid);
-       XSetForeground(disp, gc, dsk->bg.pixel);
-       XFillRectangle(disp, pmap, gc, 0, 0, 1, 1);
-       EXFreeGC(gc);
+       EXFillAreaSolid(pmap, 0, 0, 1, 1, dsk->bg.pixel);
      }
    else
      {
diff --git a/src/extinitwin.c b/src/extinitwin.c
index 09483f5..9b783cd 100644
--- a/src/extinitwin.c
+++ b/src/extinitwin.c
@@ -99,7 +99,6 @@ static EiwLoopFunc *
 _eiw_window_init(Window win, EiwData * d)
 {
    Pixmap              pmap, mask;
-   GC                  gc;
    XColor              cl;
 
    d->cwin = XCreateWindow(disp, win, 0, 0, 32, 32, 0, CopyFromParent,
@@ -108,16 +107,10 @@ _eiw_window_init(Window win, EiwData * d)
                           CWBackPixel | CWBorderPixel, &d->attr);
 
    pmap = XCreatePixmap(disp, d->cwin, 16, 16, 1);
-   gc = XCreateGC(disp, pmap, 0, NULL);
-   XSetForeground(disp, gc, 0);
-   XFillRectangle(disp, pmap, gc, 0, 0, 16, 16);
-   XFreeGC(disp, gc);
+   EXFillAreaSolid(pmap, 0, 0, 16, 16, 0);
 
    mask = XCreatePixmap(disp, d->cwin, 16, 16, 1);
-   gc = XCreateGC(disp, mask, 0, NULL);
-   XSetForeground(disp, gc, 0);
-   XFillRectangle(disp, mask, gc, 0, 0, 16, 16);
-   XFreeGC(disp, gc);
+   EXFillAreaSolid(mask, 0, 0, 16, 16, 0);
 
    d->curs = XCreatePixmapCursor(disp, pmap, mask, &cl, &cl, 0, 0);
    XDefineCursor(disp, win, d->curs);
diff --git a/src/iclass.c b/src/iclass.c
index ad4c1aa..5670716 100644
--- a/src/iclass.c
+++ b/src/iclass.c
@@ -1098,7 +1098,6 @@ ImagestateDrawNoImg(ImageState * is, Drawable draw, int 
x, int y, int w, int h)
    ImagestateColorsAlloc(is);
 
    gc = EXCreateGC(draw, 0, NULL);
-   XSetFillStyle(disp, gc, FillSolid);
    XSetForeground(disp, gc, is->bg_pixel);
    XFillRectangle(disp, draw, gc, x, y, w, h);
    if (is->bevelstyle != BEVEL_NONE)
diff --git a/src/x.c b/src/x.c
index 6635a44..bf85457 100644
--- a/src/x.c
+++ b/src/x.c
@@ -1653,15 +1653,15 @@ EXCreatePixmapCopy(Pixmap src, unsigned int w, unsigned 
int h,
 }
 
 void
-EXCopyAreaGC(Drawable src, Drawable dst, GC gc, int sx, int sy, unsigned int w,
-            unsigned int h, int dx, int dy)
+EXCopyAreaGC(Drawable src, Drawable dst, GC gc, int sx, int sy,
+            unsigned int w, unsigned int h, int dx, int dy)
 {
    XCopyArea(disp, src, dst, gc, sx, sy, w, h, dx, dy);
 }
 
 void
-EXCopyArea(Drawable src, Drawable dst, int sx, int sy, unsigned int w,
-          unsigned int h, int dx, int dy)
+EXCopyArea(Drawable src, Drawable dst, int sx, int sy,
+          unsigned int w, unsigned int h, int dx, int dy)
 {
    GC                  gc;
 
@@ -1689,6 +1689,18 @@ EXCopyAreaTiled(Drawable src, Pixmap mask, Drawable dst, 
int sx, int sy,
    EXFreeGC(gc);
 }
 
+void
+EXFillAreaSolid(Drawable dst, int x, int y, unsigned int w, unsigned int h,
+               unsigned int pixel)
+{
+   GC                  gc;
+
+   gc = EXCreateGC(dst, 0, NULL);
+   XSetForeground(disp, gc, pixel);
+   XFillRectangle(disp, dst, gc, x, y, w, h);
+   EXFreeGC(gc);
+}
+
 GC
 EXCreateGC(Drawable draw, unsigned int mask, XGCValues * val)
 {
diff --git a/src/xwin.h b/src/xwin.h
index f6f5bef..22f70de 100644
--- a/src/xwin.h
+++ b/src/xwin.h
@@ -265,6 +265,9 @@ void                EXCopyAreaTiled(Drawable src, Pixmap 
mask, Drawable dst,
                                    int sx, int sy,
                                    unsigned int w, unsigned int h,
                                    int dx, int dy);
+void                EXFillAreaSolid(Drawable dst, int x, int y,
+                                   unsigned int w, unsigned int h,
+                                   unsigned int pixel);
 
 void                EXWarpPointer(Window xwin, int x, int y);
 int                 EXQueryPointer(Window xwin, int *px, int *py,

-- 


Reply via email to