X-Git-Url: https://git.subgeniuskitty.com/xmenu/.git/blobdiff_plain/237da9824c6ed299058589519e9f7a1003d5f145..b6cf4847cedfc09ccad10db651e2e97d7ac89184:/xmenu.c diff --git a/xmenu.c b/xmenu.c index 4a4ffca..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; } @@ -671,7 +669,7 @@ drawtext(XftDraw *draw, XftColor *color, int x, int y, unsigned h, const char *t if (draw) { int texty; - texty = y + (h + currfont->ascent) / 2; + texty = y + (h - (currfont->ascent + currfont->descent))/2 + currfont->ascent; XftDrawStringUtf8(draw, color, currfont, x, texty, (XftChar8 *)s, len); x += ext.xOff; @@ -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;