cleanup menu height setting
This commit is contained in:
parent
3bc300d029
commit
d7122af473
|
@ -567,6 +567,7 @@ void drawmenu_layer(void) {
|
||||||
y += menumarginv;
|
y += menumarginv;
|
||||||
|
|
||||||
calcoffsets();
|
calcoffsets();
|
||||||
|
get_mh();
|
||||||
|
|
||||||
// why have an empty line?
|
// why have an empty line?
|
||||||
if ((hideprompt && hideinput && hidemode && hidematchcount && hidecaps
|
if ((hideprompt && hideinput && hidemode && hidematchcount && hidecaps
|
||||||
|
@ -576,7 +577,7 @@ void drawmenu_layer(void) {
|
||||||
)) {
|
)) {
|
||||||
#endif
|
#endif
|
||||||
y -= bh;
|
y -= bh;
|
||||||
mh = (lines + 1) * bh - bh + 2 * menumarginv;
|
mh -= bh;
|
||||||
|
|
||||||
if (!protocol) {
|
if (!protocol) {
|
||||||
#if USEX
|
#if USEX
|
||||||
|
@ -594,7 +595,7 @@ void drawmenu_layer(void) {
|
||||||
#if USEIMAGE
|
#if USEIMAGE
|
||||||
else if (hideprompt && hideinput && hidemode && hidematchcount && hidecaps) {
|
else if (hideprompt && hideinput && hidemode && hidematchcount && hidecaps) {
|
||||||
y -= bh;
|
y -= bh;
|
||||||
mh = (lines + 1) * bh - bh + 2 * menumarginv;
|
mh -= bh;
|
||||||
|
|
||||||
#if USEWAYLAND
|
#if USEWAYLAND
|
||||||
if (protocol) {
|
if (protocol) {
|
||||||
|
|
|
@ -374,10 +374,10 @@ void resizetoimageheight_x11(int imageheight) {
|
||||||
wtr = bh;
|
wtr = bh;
|
||||||
}
|
}
|
||||||
|
|
||||||
mh = MAX((lines + 1) * bh + 2 * menumarginv, ((lines + 1) * bh) - wtr + 2 * menumarginv);
|
get_mh();
|
||||||
|
|
||||||
if (mh - bh < imageheight + imagegaps * 2) {
|
if (mh - bh < imageheight + imagegaps * 2) {
|
||||||
mh = (imageheight + imagegaps * 2 + bh) - wtr + 2 * menumarginv;
|
mh = (imageheight + imagegaps * 2 + bh) - wtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// init xinerama screens
|
// init xinerama screens
|
||||||
|
@ -478,10 +478,10 @@ void resizetoimageheight_wl(int imageheight) {
|
||||||
wtr = bh;
|
wtr = bh;
|
||||||
}
|
}
|
||||||
|
|
||||||
mh = MAX((lines + 1) * bh + 2 * menumarginv, ((lines + 1) * bh) - wtr + 2 * menumarginv);
|
get_mh();
|
||||||
|
|
||||||
if (mh - bh < imageheight + imagegaps * 2) {
|
if (mh - bh < imageheight + imagegaps * 2) {
|
||||||
mh = (imageheight + imagegaps * 2 + bh) - wtr + 2 * menumarginv;
|
mh = (imageheight + imagegaps * 2 + bh) - wtr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (omh == mh) {
|
if (omh == mh) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ void handle_wl(void) {
|
||||||
create_layer(&state, "spmenu");
|
create_layer(&state, "spmenu");
|
||||||
|
|
||||||
mw = (menuwidth > 0 ? menuwidth : output_width);
|
mw = (menuwidth > 0 ? menuwidth : output_width);
|
||||||
mh = (lines + 1) * bh + 2 * menumarginv;
|
get_mh();
|
||||||
|
|
||||||
if (menuposition == 2) {
|
if (menuposition == 2) {
|
||||||
mw = MIN(MAX(max_textw() + promptw, minwidth), output_width);
|
mw = MIN(MAX(max_textw() + promptw, minwidth), output_width);
|
||||||
|
|
|
@ -541,7 +541,7 @@ void resizeclient_wl(struct state *state) {
|
||||||
bh = MAX(drw->font->h, drw->font->h + 2 + lineheight);
|
bh = MAX(drw->font->h, drw->font->h + 2 + lineheight);
|
||||||
lines = MIN(ic, MAX(lines, 0));
|
lines = MIN(ic, MAX(lines, 0));
|
||||||
reallines = lines;
|
reallines = lines;
|
||||||
mh = (lines + 1) * bh + 2 * menumarginv;
|
get_mh();
|
||||||
|
|
||||||
if (mh == omh) {
|
if (mh == omh) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -96,7 +96,7 @@ void resizeclient_x11(void) {
|
||||||
if (image) resizetoimageheight(imagewidth, imageheight);
|
if (image) resizetoimageheight(imagewidth, imageheight);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mh = (lines + 1) * bh + 2 * menumarginv;
|
get_mh();
|
||||||
|
|
||||||
// init xinerama screens
|
// init xinerama screens
|
||||||
#if USEXINERAMA
|
#if USEXINERAMA
|
||||||
|
|
|
@ -134,7 +134,7 @@ void prepare_window_size_x11(void) {
|
||||||
reallines = lines;
|
reallines = lines;
|
||||||
|
|
||||||
lrpad = drw->font->h + textpadding;
|
lrpad = drw->font->h + textpadding;
|
||||||
mh = (lines + 1) * bh + 2 * menumarginv; // lines + 1 * bh is the menu height
|
get_mh();
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
6
spmenu.c
6
spmenu.c
|
@ -197,6 +197,7 @@ static void grabfocus(void);
|
||||||
#endif
|
#endif
|
||||||
static void resizeclient(void);
|
static void resizeclient(void);
|
||||||
static void get_width(void);
|
static void get_width(void);
|
||||||
|
static void get_mh(void);
|
||||||
static void set_mode(void);
|
static void set_mode(void);
|
||||||
static void handle(void);
|
static void handle(void);
|
||||||
static void appenditem(struct item *item, struct item **list, struct item **last);
|
static void appenditem(struct item *item, struct item **list, struct item **last);
|
||||||
|
@ -465,6 +466,11 @@ void get_width(void) {
|
||||||
inputw = mw / 3;
|
inputw = mw / 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void get_mh(void) {
|
||||||
|
mh = (lines + 1) * bh;
|
||||||
|
mh += 2 * menumarginv;
|
||||||
|
}
|
||||||
|
|
||||||
void set_mode(void) {
|
void set_mode(void) {
|
||||||
if (!type) { // no typing allowed, require normal mode
|
if (!type) { // no typing allowed, require normal mode
|
||||||
mode = 0;
|
mode = 0;
|
||||||
|
|
Loading…
Reference in a new issue