forked from speedie/spmenu
significant image drawing codebase cleanup
This commit is contained in:
parent
00966f7547
commit
c0d8adec85
19
libs/draw.c
19
libs/draw.c
|
@ -573,24 +573,9 @@ void drawmenu_layer(void) {
|
|||
calcoffsets();
|
||||
get_mh();
|
||||
|
||||
// why have an empty line?
|
||||
if ((hideprompt && hideinput && hidemode && hidematchcount && hidecaps)) {
|
||||
// bh must be removed from menu height resizing later
|
||||
if ((hideprompt && hideinput && hidemode && hidematchcount && hidecaps) && lines) {
|
||||
y -= bh;
|
||||
mh -= bh;
|
||||
|
||||
if (!protocol && (hideimage || !image)) {
|
||||
#if USEX
|
||||
XResizeWindow(dpy, win, mw - 2 * sp - 2 * borderwidth, mh);
|
||||
drw_resize(drw, mw - 2 * sp - 2 * borderwidth, mh);
|
||||
#endif
|
||||
} else if (protocol && (hideimage || !image)) {
|
||||
#if USEWAYLAND
|
||||
state.width = mw;
|
||||
state.height = mh;
|
||||
|
||||
set_layer_size(&state, state.width, state.height);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
if (!hideprompt && !fullscreen) {
|
||||
|
|
10
libs/img.c
10
libs/img.c
|
@ -111,6 +111,7 @@ void drawimage(void) {
|
|||
} else if (imageposition == 1 && image) { // bottom mode = 1
|
||||
if (height > width)
|
||||
width = height;
|
||||
|
||||
drw_img(drw, leftmargin + (imagewidth - width) / 2 + xta, mh - height - leftmargin);
|
||||
} else if (imageposition == 2 && image) { // center mode = 2
|
||||
drw_img(drw, leftmargin + (imagewidth - width) / 2 + xta, (mh - wta - height) / 2 + wta);
|
||||
|
@ -354,7 +355,6 @@ void resizetoimageheight(int imagewidth, int imageheight) {
|
|||
void resizetoimageheight_x11(int imageheight) {
|
||||
int omh = mh, olines = lines;
|
||||
lines = reallines;
|
||||
int wtr = 0;
|
||||
|
||||
int x, y;
|
||||
#if USEXINERAMA
|
||||
|
@ -370,16 +370,8 @@ void resizetoimageheight_x11(int imageheight) {
|
|||
lines = (imageheight + imagegaps * 2) / bh;
|
||||
}
|
||||
|
||||
if (hideprompt && hideinput && hidemode && hidematchcount) {
|
||||
wtr = bh;
|
||||
}
|
||||
|
||||
get_mh();
|
||||
|
||||
if (mh - bh < imageheight + imagegaps * 2) {
|
||||
mh = (imageheight + imagegaps * 2 + bh) - wtr;
|
||||
}
|
||||
|
||||
// init xinerama screens
|
||||
#if USEXINERAMA
|
||||
int i = 0;
|
||||
|
|
|
@ -243,7 +243,8 @@ void buttonpress_wl(uint32_t button, double ex, double ey) {
|
|||
if (!hidemode) modeWidth = pango_mode ? TEXTWM(modetext) : TEXTW(modetext);
|
||||
if (!hidecaps) capsWidth = pango_caps ? TEXTWM(capstext) : TEXTW(capstext);
|
||||
|
||||
if (!strcmp(capstext, "")) capsWidth = 0; // No caps lock width for no chars
|
||||
if (!strcmp(capstext, ""))
|
||||
capsWidth = 0;
|
||||
|
||||
click = ClickWindow; // Used as a default, will be overriden.
|
||||
|
||||
|
@ -543,14 +544,14 @@ void resizeclient_wl(struct state *state) {
|
|||
reallines = lines;
|
||||
get_mh();
|
||||
|
||||
if (hideprompt && hideinput && hidemode && hidematchcount && hidecaps) {
|
||||
mh -= bh;
|
||||
}
|
||||
|
||||
if (mh == omh) {
|
||||
return;
|
||||
}
|
||||
|
||||
// why have an empty line? when there's nothing to draw there anyway?
|
||||
if (hideprompt && hideinput && hidemode && hidematchcount)
|
||||
mh += bh;
|
||||
|
||||
state->width = mw;
|
||||
state->height = mh;
|
||||
|
||||
|
|
|
@ -98,6 +98,10 @@ void resizeclient_x11(void) {
|
|||
|
||||
get_mh();
|
||||
|
||||
if (hideprompt && hideinput && hidemode && hidematchcount && hidecaps) {
|
||||
mh -= bh;
|
||||
}
|
||||
|
||||
// init xinerama screens
|
||||
#if USEXINERAMA
|
||||
int i = 0;
|
||||
|
@ -157,10 +161,6 @@ void resizeclient_x11(void) {
|
|||
}
|
||||
}
|
||||
|
||||
// why have an empty line? when there's nothing to draw there anyway?
|
||||
if (hideprompt && hideinput && hidemode && hidematchcount)
|
||||
mh += bh;
|
||||
|
||||
// no window/invalid window or menu height we had before is the same as the current window height
|
||||
if (!win || omh == mh) return;
|
||||
|
||||
|
|
|
@ -26,7 +26,9 @@ void buttonpress_x11(XEvent *e) {
|
|||
if (!hidemode) modeWidth = pango_mode ? TEXTWM(modetext) : TEXTW(modetext);
|
||||
if (!hidecaps) capsWidth = pango_caps ? TEXTWM(capstext) : TEXTW(capstext);
|
||||
|
||||
if (!strcmp(capstext, "")) capsWidth = 0; // no caps lock width for no chars
|
||||
if (!strcmp(capstext, ""))
|
||||
capsWidth = 0;
|
||||
|
||||
if (ev->window != win) return; // if incorrect or wrong window, return
|
||||
|
||||
click = ClickWindow; // clicking anywhere, we use this and override it if we clicked on something specific
|
||||
|
|
Loading…
Reference in a new issue