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