removing variables config.screen*

This commit is contained in:
phillbush 2020-07-30 00:25:55 -03:00
parent 64240f40ee
commit b6cf4847ce
3 changed files with 6 additions and 9 deletions

View File

@ -8,7 +8,7 @@ all: ${PROG}
${PROG}: ${OBJS} ${PROG}: ${OBJS}
${CC} -o $@ ${OBJS} ${LDFLAGS} ${CC} -o $@ ${OBJS} ${LDFLAGS}
${OBJS}: config.h ${OBJS}: config.h ${PROG}.h
.c.o: .c.o:
${CC} ${CFLAGS} -c $< ${CC} ${CFLAGS} -c $<

12
xmenu.c
View File

@ -30,7 +30,7 @@ static void ealloccolor(const char *s, XftColor *color);
static void initmonitor(void); static void initmonitor(void);
static void initresources(void); static void initresources(void);
static void initdc(void); static void initdc(void);
static void initconfig(void); static void initiconsize(void);
static void initatoms(void); static void initatoms(void);
/* structure builders, and their helper routines */ /* structure builders, and their helper routines */
@ -160,7 +160,7 @@ main(int argc, char *argv[])
initmonitor(); initmonitor();
initresources(); initresources();
initdc(); initdc();
initconfig(); initiconsize();
initatoms(); initatoms();
/* set window class */ /* set window class */
@ -390,12 +390,10 @@ initdc(void)
dc.gc = XCreateGC(dpy, rootwin, 0, NULL); dc.gc = XCreateGC(dpy, rootwin, 0, NULL);
} }
/* calculate configuration values that are not set manually */ /* calculate icon size */
static void static void
initconfig(void) initiconsize(void)
{ {
config.screenw = DisplayWidth(dpy, screen);
config.screenh = DisplayHeight(dpy, screen);
config.iconsize = config.height_pixels - config.iconpadding * 2; 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)) if (pflag || (config.posy > mon.y && mon.y + mon.h - config.posy >= height))
menu->y = config.posy; menu->y = config.posy;
else if (config.screenh > height) else if (mon.y + mon.h > height)
menu->y = mon.y + mon.h - height; menu->y = mon.y + mon.h - height;
} else { /* else, calculate in respect to parent menu */ } else { /* else, calculate in respect to parent menu */
int parentwidth; int parentwidth;

View File

@ -42,7 +42,6 @@ struct Config {
/* the value below is computed by xmenu */ /* the value below is computed by xmenu */
int iconsize; int iconsize;
int screenw, screenh; /* screen width and height */
}; };
/* draw context structure */ /* draw context structure */