Make sure number of lines/menu height cannot exceed monitor height
This commit is contained in:
parent
6ec63436d7
commit
48e3db316b
|
@ -64,6 +64,8 @@ void setupdisplay_x11(void) {
|
||||||
mo.output_height = wa.height;
|
mo.output_height = wa.height;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get_mh();
|
||||||
|
|
||||||
if (menuposition == 2) { // centered
|
if (menuposition == 2) { // centered
|
||||||
sp.mw = MIN(MAX(max_textw() + sp.promptw, minwidth), mo.output_width);
|
sp.mw = MIN(MAX(max_textw() + sp.promptw, minwidth), mo.output_width);
|
||||||
x = (mo.output_width - sp.mw) / 2 + xpos;
|
x = (mo.output_width - sp.mw) / 2 + xpos;
|
||||||
|
|
12
spmenu.c
12
spmenu.c
|
@ -501,12 +501,24 @@ void get_width(void) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_mh(void) {
|
void get_mh(void) {
|
||||||
|
int epad;
|
||||||
|
|
||||||
sp.mh = (lines + 1) * sp.bh;
|
sp.mh = (lines + 1) * sp.bh;
|
||||||
sp.mh += 2 * menumarginv;
|
sp.mh += 2 * menumarginv;
|
||||||
|
|
||||||
if ((hideprompt && hideinput && hidemode && hidematchcount && hidecaps) && lines) {
|
if ((hideprompt && hideinput && hidemode && hidematchcount && hidecaps) && lines) {
|
||||||
sp.mh -= sp.bh;
|
sp.mh -= sp.bh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
epad = 2 * menupaddingv;
|
||||||
|
|
||||||
|
if (mo.output_height && !xpos && !ypos) {
|
||||||
|
sp.mh = MIN(sp.mh, mo.output_height - epad);
|
||||||
|
|
||||||
|
if (sp.mh == mo.output_height - epad) {
|
||||||
|
lines = ((mo.output_height - epad) / sp.bh) - 1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void set_mode(void) {
|
void set_mode(void) {
|
||||||
|
|
Loading…
Reference in a new issue