kwo pushed a commit to branch master.

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

commit f9b5e2883a99f51a4acdd52625d243f43fb479e5
Author: Kim Woelders <k...@woelders.dk>
Date:   Sat Aug 14 14:16:24 2021 +0200

    Eliminate EGetGeometry()
---
 src/backgrounds.c |  7 ++-----
 src/container.c   | 12 ++++++------
 src/menus.c       | 20 ++++++++++++--------
 src/slideout.c    |  3 ++-
 src/x.c           | 42 ------------------------------------------
 src/xwin.h        |  3 ---
 6 files changed, 22 insertions(+), 65 deletions(-)

diff --git a/src/backgrounds.c b/src/backgrounds.c
index f45c5b81..43fb9432 100644
--- a/src/backgrounds.c
+++ b/src/backgrounds.c
@@ -691,14 +691,11 @@ BackgroundApplyPmap(Background * bg, Win win, EX_Drawable 
draw,
 static void
 BackgroundApplyWin(Background * bg, Win win)
 {
-   int                 w, h;
    EX_Pixmap           pmap;
    unsigned int        pixel;
 
-   if (!EGetGeometry(win, NULL, NULL, NULL, &w, &h, NULL, NULL))
-      return;
-
-   BackgroundRealize(bg, win, NoXID, w, h, 1, &pmap, &pixel);
+   BackgroundRealize(bg, win, NoXID, WinGetW(win), WinGetH(win), 1,
+                    &pmap, &pixel);
    if (pmap != NoXID)
      {
        ESetWindowBackgroundPixmap(win, pmap, 0);
diff --git a/src/container.c b/src/container.c
index dfb1f255..5d39b992 100644
--- a/src/container.c
+++ b/src/container.c
@@ -1225,7 +1225,7 @@ static void
 ContainerEventScrollWin(Win win __UNUSED__, XEvent * ev, void *prm)
 {
    Container          *ct = (Container *) prm;
-   int                 x, y, w, h;
+   Win                 sbwin;
 
    switch (ev->type)
      {
@@ -1240,19 +1240,19 @@ ContainerEventScrollWin(Win win __UNUSED__, XEvent * 
ev, void *prm)
        if (!ct->scrollbox_clicked)
           break;
        ct->scrollbox_clicked = 0;
-       EGetGeometry(ct->scrollbar_win, NULL, &x, &y, &w, &h, NULL, NULL);
+       sbwin = ct->scrollbar_win;
        if (ct->orientation)
          {
-            if (ev->xbutton.y < y)
+            if (ev->xbutton.y < WinGetY(sbwin))
                ContainerScroll(ct, -8);
-            else if (ev->xbutton.y > (y + h))
+            else if (ev->xbutton.y > WinGetY(sbwin) + WinGetH(sbwin))
                ContainerScroll(ct, 8);
          }
        else
          {
-            if (ev->xbutton.x < x)
+            if (ev->xbutton.x < WinGetX(sbwin))
                ContainerScroll(ct, -8);
-            else if (ev->xbutton.x > (x + w))
+            else if (ev->xbutton.x > WinGetX(sbwin) + WinGetW(sbwin))
                ContainerScroll(ct, 8);
          }
        break;
diff --git a/src/menus.c b/src/menus.c
index aa442376..1a112c0c 100644
--- a/src/menus.c
+++ b/src/menus.c
@@ -290,7 +290,7 @@ static void
 MenuShow(Menu * m, char noshow)
 {
    EWin               *ewin;
-   int                 x, y, w, h;
+   Win                 win;
    int                 wx, wy, mw, mh;
    int                 head_num = 0;
 
@@ -321,13 +321,13 @@ MenuShow(Menu * m, char noshow)
 #endif
      }
 
-   EGetGeometry(m->items[0]->win, NULL, &x, &y, &w, &h, NULL, NULL);
+   win = m->items[0]->win;
    mw = m->w;
    mh = m->h;
 
    EQueryPointer(NULL, &wx, &wy, NULL, NULL);
-   wx -= EoGetX(DesksGetCurrent()) + x + (w / 2);
-   wy -= EoGetY(DesksGetCurrent()) + y + (h / 2);
+   wx -= EoGetX(DesksGetCurrent()) + WinGetX(win) + WinGetW(win) / 2;
+   wy -= EoGetY(DesksGetCurrent()) + WinGetY(win) + WinGetH(win) / 2;
    if (Conf.menus.onscreen)
      {
        Border             *b;
@@ -963,7 +963,10 @@ MenuDrawItem(Menu * m, MenuItem * mi, char shape, int 
state)
        PmapMask            pmm;
        EImage             *im;
 
-       EGetGeometry(mi->win, NULL, &x, &y, &w, &h, NULL, NULL);
+       x = WinGetX(mi->win);
+       y = WinGetY(mi->win);
+       w = WinGetW(mi->win);
+       h = WinGetH(mi->win);
 
        mi_pmm->type = 0;
        mi_pmm->pmap = ECreatePixmap(mi->win, w, h, 0);
@@ -1406,11 +1409,12 @@ _SubmenuGetPlacement(Menu * m, int *xo, int *yo, int 
*mw, int *mh)
    int                 bl1, br1, bt1, bb1;
    int                 bl2, br2, bt2, bb2;
 
-   EGetGeometry(mi->win, NULL, &mix, &miy, &miw, NULL, NULL, NULL);
+   mix = WinGetX(mi->win);
+   miy = WinGetY(mi->win);
+   miw = WinGetW(mi->win);
    my2 = 0;
    if (mi->child->num > 0 && mi->child->items[0])
-      EGetGeometry(mi->child->items[0]->win, NULL, NULL, &my2, NULL, NULL, 
NULL,
-                  NULL);
+      my2 = WinGetY(mi->child->items[0]->win);
 
    ewin = m->ewin;
    ewin2 = m->child->ewin;
diff --git a/src/slideout.c b/src/slideout.c
index 89d5c16a..43fa4c66 100644
--- a/src/slideout.c
+++ b/src/slideout.c
@@ -178,9 +178,10 @@ SlideoutShow(Slideout * s, EWin * ewin, Win win)
       return;
 
    SlideoutCalcSize(s);
-   EGetGeometry(win, NULL, NULL, NULL, &w, &h, NULL, NULL);
    ETranslateCoordinates(win, VROOT, 0, 0, &x, &y, NULL);
 
+   w = WinGetW(win);
+   h = WinGetH(win);
    sw = EoGetW(s);
    sh = EoGetH(s);
    xx = 0;
diff --git a/src/x.c b/src/x.c
index 90a2c5e6..c16555fe 100644
--- a/src/x.c
+++ b/src/x.c
@@ -831,48 +831,6 @@ EXGetSize(EX_Drawable draw, int *w, int *h)
    return 1;
 }
 
-int
-EGetGeometry(Win win, EX_Window * root_return, int *x, int *y,
-            int *w, int *h, int *bw, int *depth)
-{
-   if (!win)
-     {
-       Eprintf("%s win=null\n", __func__);
-       if (root_return)
-          *root_return = NoXID;
-       if (x)
-          *x = 0;
-       if (y)
-          *y = 0;
-       if (w)
-          *w = 0;
-       if (h)
-          *h = 0;
-       if (bw)
-          *bw = 0;
-       if (depth)
-          *depth = 0;
-       return 0;
-     }
-
-   if (root_return)
-      *root_return = WinGetXwin(VROOT);
-   if (x)
-      *x = win->x;
-   if (y)
-      *y = win->y;
-   if (w)
-      *w = win->w;
-   if (h)
-      *h = win->h;
-   if (bw)
-      *bw = 0;
-   if (depth)
-      *depth = win->depth;
-
-   return 1;
-}
-
 void
 EGetWindowAttributes(Win win, XWindowAttributes * pxwa)
 {
diff --git a/src/xwin.h b/src/xwin.h
index ff8a652e..d4763dcf 100644
--- a/src/xwin.h
+++ b/src/xwin.h
@@ -174,9 +174,6 @@ void                EMapWindow(Win win);
 void                EMapRaised(Win win);
 void                EUnmapWindow(Win win);
 void                EReparentWindow(Win win, Win parent, int x, int y);
-int                 EGetGeometry(Win win, EX_Window * root_return,
-                                int *x, int *y, int *w, int *h, int *bw,
-                                int *depth);
 void                EGetWindowAttributes(Win win, XWindowAttributes * pxwa);
 void                EConfigureWindow(Win win, unsigned int mask,
                                     XWindowChanges * wc);

-- 


Reply via email to