From b6cf4847cedfc09ccad10db651e2e97d7ac89184 Mon Sep 17 00:00:00 2001 From: phillbush Date: Thu, 30 Jul 2020 00:25:55 -0300 Subject: [PATCH] removing variables config.screen* --- Makefile | 2 +- xmenu.c | 12 +++++------- xmenu.h | 1 - 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/Makefile b/Makefile index 7430e09..58079ce 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ all: ${PROG} ${PROG}: ${OBJS} ${CC} -o $@ ${OBJS} ${LDFLAGS} -${OBJS}: config.h +${OBJS}: config.h ${PROG}.h .c.o: ${CC} ${CFLAGS} -c $< diff --git a/xmenu.c b/xmenu.c index 4d1c223..bc66235 100644 --- a/xmenu.c +++ b/xmenu.c @@ -30,7 +30,7 @@ static void ealloccolor(const char *s, XftColor *color); static void initmonitor(void); static void initresources(void); static void initdc(void); -static void initconfig(void); +static void initiconsize(void); static void initatoms(void); /* structure builders, and their helper routines */ @@ -160,7 +160,7 @@ main(int argc, char *argv[]) initmonitor(); initresources(); initdc(); - initconfig(); + initiconsize(); initatoms(); /* set window class */ @@ -390,12 +390,10 @@ initdc(void) dc.gc = XCreateGC(dpy, rootwin, 0, NULL); } -/* calculate configuration values that are not set manually */ +/* calculate icon size */ static void -initconfig(void) +initiconsize(void) { - config.screenw = DisplayWidth(dpy, screen); - config.screenh = DisplayHeight(dpy, screen); config.iconsize = config.height_pixels - config.iconpadding * 2; } @@ -741,7 +739,7 @@ setupmenupos(struct Menu *menu) if (pflag || (config.posy > mon.y && mon.y + mon.h - config.posy >= height)) menu->y = config.posy; - else if (config.screenh > height) + else if (mon.y + mon.h > height) menu->y = mon.y + mon.h - height; } else { /* else, calculate in respect to parent menu */ int parentwidth; diff --git a/xmenu.h b/xmenu.h index 04a4ddf..bf5cb80 100644 --- a/xmenu.h +++ b/xmenu.h @@ -42,7 +42,6 @@ struct Config { /* the value below is computed by xmenu */ int iconsize; - int screenw, screenh; /* screen width and height */ }; /* draw context structure */