Skip to content

Commit

Permalink
removing variables config.screen*
Browse files Browse the repository at this point in the history
  • Loading branch information
phillbush committed Jul 30, 2020
1 parent 64240f4 commit b6cf484
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<
Expand Down
12 changes: 5 additions & 7 deletions xmenu.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down Expand Up @@ -160,7 +160,7 @@ main(int argc, char *argv[])
initmonitor();
initresources();
initdc();
initconfig();
initiconsize();
initatoms();

/* set window class */
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;
Expand Down
1 change: 0 additions & 1 deletion xmenu.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down

0 comments on commit b6cf484

Please sign in to comment.