Change EXGetGeometry() to EXGetSize()

Only w and h are ever used.

Also remove now unnecessary initializations of returned values.
This commit is contained in:
Kim Woelders 2021-08-14 13:39:43 +02:00
parent 1618ea2ca8
commit b7c18a9c12
5 changed files with 12 additions and 39 deletions

View File

@ -634,7 +634,7 @@ ScaleTile(Win wsrc, EX_Drawable src, Win wdst, EX_Pixmap dst,
sw = WinGetW(wsrc);
sh = WinGetH(wsrc);
EXGetGeometry(src, NULL, NULL, NULL, &stw, &sth, NULL, NULL);
EXGetSize(src, &stw, &sth);
if (stw >= sw && sth >= sh)
{
ScaleRect(wsrc, src, wdst, dst, 0, 0, sw, sh, dx, dy, dw, dh, scale);
@ -670,8 +670,7 @@ EDrawableDumpImage(EX_Drawable draw, const char *txt)
Imlib_Image im;
int w, h;
w = h = 0;
EXGetGeometry(draw, NULL, NULL, NULL, &w, &h, NULL, NULL);
EXGetSize(draw, &w, &h);
if (w <= 0 || h <= 0)
return;
im = EImageGrabDrawableScaled(ELookupXwin(draw), draw, NoXID,

View File

@ -1,6 +1,6 @@
/*
* Copyright (C) 2000-2007 Carsten Haitzler, Geoff Harrison and various contributors
* Copyright (C) 2004-2018 Kim Woelders
* Copyright (C) 2004-2021 Kim Woelders
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to
@ -179,11 +179,8 @@ IB_GetAppIcon(EWin * ewin, int size)
if (!ewin->icccm.icon_pmap)
return NULL;
w = 0;
h = 0;
EXGetGeometry(ewin->icccm.icon_pmap, NULL, NULL, NULL, &w, &h, NULL, NULL);
if (w < 1 || h < 1)
EXGetSize(ewin->icccm.icon_pmap, &w, &h);
if (w <= 0 || h <= 0)
return NULL;
im = EImageGrabDrawable(ewin->icccm.icon_pmap, ewin->icccm.icon_mask,

View File

@ -68,7 +68,7 @@ TextDrawRotTo(Win win, EX_Drawable src, EX_Drawable dst, int x, int y,
EImageFree(im);
break;
case FONT_TO_DOWN:
EXGetGeometry(src, NULL, NULL, NULL, &win_w, NULL, NULL, NULL);
EXGetSize(src, &win_w, NULL);
im = EImageGrabDrawable(src, NoXID, win_w - y - h, x, h, w, 0);
EImageOrientate(im, 3);
EImageRenderOnDrawable(im, win, dst, 0, 0, 0, w, h);
@ -101,7 +101,7 @@ TextDrawRotBack(Win win, EX_Drawable dst, EX_Drawable src, int x, int y,
EImageFree(im);
break;
case FONT_TO_DOWN:
EXGetGeometry(dst, NULL, NULL, NULL, &win_w, NULL, NULL, NULL);
EXGetSize(dst, &win_w, NULL);
im = EImageGrabDrawable(src, NoXID, 0, 0, w, h, 0);
EImageOrientate(im, 1);
EImageRenderOnDrawable(im, win, dst, 0, win_w - y - h, x, h, w);
@ -141,7 +141,7 @@ TextImageGet(Win win __UNUSED__, EX_Drawable src, int x, int y, int w, int h,
EImageOrientate(im, 1);
break;
case FONT_TO_DOWN:
EXGetGeometry(src, NULL, NULL, NULL, &win_w, NULL, NULL, NULL);
EXGetSize(src, &win_w, NULL);
im = EImageGrabDrawable(src, NoXID, win_w - y - h, x, h, w, 0);
EImageOrientate(im, 3);
break;
@ -171,7 +171,7 @@ TextImagePut(EImage * im, Win win, EX_Drawable dst, int x, int y,
EImageRenderOnDrawable(im, win, dst, 0, y, x, h, w);
break;
case FONT_TO_DOWN:
EXGetGeometry(dst, NULL, NULL, NULL, &win_w, NULL, NULL, NULL);
EXGetSize(dst, &win_w, NULL);
EImageOrientate(im, 1);
EImageRenderOnDrawable(im, win, dst, 0, win_w - y - h, x, h, w);
break;

25
src/x.c
View File

@ -803,8 +803,7 @@ EXGetWindowAttributes(EX_Window xwin, XWindowAttributes * pxwa)
}
int
EXGetGeometry(EX_Drawable draw, EX_Window * root_return, int *x, int *y,
int *w, int *h, int *bw, int *depth)
EXGetSize(EX_Drawable draw, int *w, int *h)
{
int ok;
Window rr;
@ -817,37 +816,17 @@ EXGetGeometry(EX_Drawable draw, EX_Window * root_return, int *x, int *y,
#if 0 /* Debug */
Eprintf("%s win=%#x, error %d\n", __func__, draw, ok);
#endif
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 = rr;
if (x)
*x = xx;
if (y)
*y = yy;
if (w)
*w = ww;
if (h)
*h = hh;
if (bw)
*bw = bb;
if (depth)
*depth = dd;
return 1;
}
@ -1239,7 +1218,7 @@ EXDrawableOk(EX_Drawable draw)
if (draw == NoXID)
return 0;
return EXGetGeometry(draw, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
return EXGetSize(draw, NULL, NULL);
}
int

View File

@ -254,9 +254,7 @@ unsigned int EAllocColor(EX_Colormap cmap, unsigned int argb);
EX_Window EXWindowGetParent(EX_Window xwin);
int EXGetWindowAttributes(EX_Window xwin,
XWindowAttributes * pxwa);
int EXGetGeometry(EX_Window xwin, EX_Window * root_return,
int *x, int *y, int *w, int *h, int *bw,
int *depth);
int EXGetSize(EX_Window xwin, int *w, int *h);
void EXRestackWindows(EX_Window * windows, int nwindows);