mirror of
https://github.com/mintycube/dmenu.git
synced 2024-10-22 12:05:48 +00:00
pango: addressing some lineheight and emoji patch compatibility issues
This commit is contained in:
parent
82aa682b40
commit
c70b92c85c
106
dmenu.c
106
dmenu.c
@ -377,16 +377,29 @@ drawitem(struct item *item, int x, int y, int w)
|
|||||||
int temppadding = 0;
|
int temppadding = 0;
|
||||||
if (iscomment == 2) {
|
if (iscomment == 2) {
|
||||||
if (text[2] == ' ') {
|
if (text[2] == ' ') {
|
||||||
|
#if PANGO_PATCH
|
||||||
|
temppadding = drw->font->h * 3;
|
||||||
|
#else
|
||||||
temppadding = drw->fonts->h * 3;
|
temppadding = drw->fonts->h * 3;
|
||||||
|
#endif // PANGO_PATCH
|
||||||
animated = 1;
|
animated = 1;
|
||||||
char dest[1000];
|
char dest[1000];
|
||||||
strcpy(dest, text);
|
strcpy(dest, text);
|
||||||
dest[6] = '\0';
|
dest[6] = '\0';
|
||||||
#if LINE_HEIGHT_PATCH
|
drw_text(drw, x, y
|
||||||
drw_text(drw, x, y, temppadding, MAX(lineheight, bh), temppadding / 2.6, dest + 3, 0);
|
, temppadding
|
||||||
#else
|
#if LINE_HEIGHT_PATCH
|
||||||
drw_text(drw, x, y, temppadding, bh, temppadding / 2.6, dest + 3, 0);
|
, MAX(lineheight, bh)
|
||||||
#endif // LINE_HEIGHT_PATCH
|
#else
|
||||||
|
, bh
|
||||||
|
#endif // LINE_HEIGHT_PATCH
|
||||||
|
, temppadding / 2.6
|
||||||
|
, dest + 3
|
||||||
|
, 0
|
||||||
|
#if PANGO_PATCH
|
||||||
|
, True
|
||||||
|
#endif // PANGO_PATCH
|
||||||
|
);
|
||||||
iscomment = 6;
|
iscomment = 6;
|
||||||
drw_setscheme(drw, sel == item ? scheme[SchemeHover] : scheme[SchemeNorm]);
|
drw_setscheme(drw, sel == item ? scheme[SchemeHover] : scheme[SchemeNorm]);
|
||||||
}
|
}
|
||||||
@ -432,7 +445,7 @@ drawitem(struct item *item, int x, int y, int w)
|
|||||||
, w
|
, w
|
||||||
, bh
|
, bh
|
||||||
#if EMOJI_HIGHLIGHT_PATCH
|
#if EMOJI_HIGHLIGHT_PATCH
|
||||||
, commented ? (bh - drw_fontset_getwidth(drw, output)) / 2 : lrpad / 2
|
, commented ? (bh - TEXTW(output) - lrpad) / 2 : lrpad / 2
|
||||||
#else
|
#else
|
||||||
, lrpad / 2
|
, lrpad / 2
|
||||||
#endif // EMOJI_HIGHLIGHT_PATCH
|
#endif // EMOJI_HIGHLIGHT_PATCH
|
||||||
@ -483,11 +496,11 @@ drawmenu(void)
|
|||||||
#if !PLAIN_PROMPT_PATCH
|
#if !PLAIN_PROMPT_PATCH
|
||||||
drw_setscheme(drw, scheme[SchemeSel]);
|
drw_setscheme(drw, scheme[SchemeSel]);
|
||||||
#endif // PLAIN_PROMPT_PATCH
|
#endif // PLAIN_PROMPT_PATCH
|
||||||
#if PANGO_PATCH
|
x = drw_text(drw, x, 0, promptw, bh, lrpad / 2, prompt, 0
|
||||||
x = drw_text(drw, x, 0, promptw, bh, lrpad / 2, prompt, 0, True);
|
#if PANGO_PATCH
|
||||||
#else
|
, True
|
||||||
x = drw_text(drw, x, 0, promptw, bh, lrpad / 2, prompt, 0);
|
#endif // PANGO_PATCH
|
||||||
#endif // PANGO_PATCH
|
);
|
||||||
}
|
}
|
||||||
/* draw input field */
|
/* draw input field */
|
||||||
w = (lines > 0 || !matches) ? mw - x : inputw;
|
w = (lines > 0 || !matches) ? mw - x : inputw;
|
||||||
@ -495,8 +508,8 @@ drawmenu(void)
|
|||||||
#if SCROLL_PATCH
|
#if SCROLL_PATCH
|
||||||
w -= lrpad / 2;
|
w -= lrpad / 2;
|
||||||
x += lrpad / 2;
|
x += lrpad / 2;
|
||||||
rcurlen = drw_fontset_getwidth(drw, text + cursor);
|
rcurlen = TEXTW(text + cursor) - lrpad;
|
||||||
curlen = drw_fontset_getwidth(drw, text) - rcurlen;
|
curlen = TEXTW(text) - lrpad - rcurlen;
|
||||||
curpos += curlen - oldcurlen;
|
curpos += curlen - oldcurlen;
|
||||||
curpos = MIN(w, MAX(0, curpos));
|
curpos = MIN(w, MAX(0, curpos));
|
||||||
curpos = MAX(curpos, w - rcurlen);
|
curpos = MAX(curpos, w - rcurlen);
|
||||||
@ -530,22 +543,29 @@ drawmenu(void)
|
|||||||
if (passwd) {
|
if (passwd) {
|
||||||
censort = ecalloc(1, sizeof(text));
|
censort = ecalloc(1, sizeof(text));
|
||||||
memset(censort, '.', strlen(text));
|
memset(censort, '.', strlen(text));
|
||||||
#if PANGO_PATCH
|
drw_text(drw, x, 0, w, bh, lrpad / 2, censort, 0
|
||||||
drw_text(drw, x, 0, w, bh, lrpad / 2, censort, 0, False);
|
#if PANGO_PATCH
|
||||||
#else
|
, False
|
||||||
drw_text(drw, x, 0, w, bh, lrpad / 2, censort, 0);
|
#endif // PANGO_PATCH
|
||||||
#endif // PANGO_PATCH
|
);
|
||||||
|
drw_text(drw, x, 0, w, bh, lrpad / 2, censort, 0
|
||||||
|
#if PANGO_PATCH
|
||||||
|
, False
|
||||||
|
#endif // PANGO_PATCH
|
||||||
|
);
|
||||||
free(censort);
|
free(censort);
|
||||||
} else
|
} else
|
||||||
#if PANGO_PATCH
|
drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0
|
||||||
drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0, False);
|
#if PANGO_PATCH
|
||||||
#else
|
, False
|
||||||
drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0);
|
#endif // PANGO_PATCH
|
||||||
#endif // PANGO_PATCH
|
);
|
||||||
#elif PANGO_PATCH
|
|
||||||
drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0, False);
|
|
||||||
#else
|
#else
|
||||||
drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0);
|
drw_text(drw, x, 0, w, bh, lrpad / 2, text, 0
|
||||||
|
#if PANGO_PATCH
|
||||||
|
, False
|
||||||
|
#endif // PANGO_PATCH
|
||||||
|
);
|
||||||
#endif // PASSWORD_PATCH
|
#endif // PASSWORD_PATCH
|
||||||
|
|
||||||
curpos = TEXTW(text) - TEXTW(&text[cursor]);
|
curpos = TEXTW(text) - TEXTW(&text[cursor]);
|
||||||
@ -605,11 +625,11 @@ drawmenu(void)
|
|||||||
w = TEXTW("<");
|
w = TEXTW("<");
|
||||||
if (curr->left) {
|
if (curr->left) {
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
#if PANGO_PATCH
|
drw_text(drw, x, 0, w, bh, lrpad / 2, "<", 0
|
||||||
drw_text(drw, x, 0, w, bh, lrpad / 2, "<", 0, True);
|
#if PANGO_PATCH
|
||||||
#else
|
, True
|
||||||
drw_text(drw, x, 0, w, bh, lrpad / 2, "<", 0);
|
#endif // PANGO_PATCH
|
||||||
#endif // PANGO_PATCH
|
);
|
||||||
}
|
}
|
||||||
x += w;
|
x += w;
|
||||||
for (item = curr; item != next; item = item->right) {
|
for (item = curr; item != next; item = item->right) {
|
||||||
@ -636,15 +656,17 @@ drawmenu(void)
|
|||||||
w = TEXTW(">");
|
w = TEXTW(">");
|
||||||
#endif // SYMBOLS_PATCH
|
#endif // SYMBOLS_PATCH
|
||||||
drw_setscheme(drw, scheme[SchemeNorm]);
|
drw_setscheme(drw, scheme[SchemeNorm]);
|
||||||
#if PANGO_PATCH && SYMBOLS_PATCH
|
drw_text(drw, mw - w - rpad, 0, w, bh, lrpad / 2
|
||||||
drw_text(drw, mw - w - rpad, 0, w, bh, lrpad / 2, symbol_2, 0, True);
|
#if SYMBOLS_PATCH
|
||||||
#elif PANGO_PATCH
|
, symbol_2
|
||||||
drw_text(drw, mw - w - rpad, 0, w, bh, lrpad / 2, ">", 0, True);
|
#else
|
||||||
#elif SYMBOLS_PATCH
|
, ">"
|
||||||
drw_text(drw, mw - w, 0, w, bh, lrpad / 2, symbol_2, 0);
|
#endif // SYMBOLS_PATCH
|
||||||
#else
|
, 0
|
||||||
drw_text(drw, mw - w - rpad, 0, w, bh, lrpad / 2, ">", 0);
|
#if PANGO_PATCH
|
||||||
#endif // PANGO_PATCH
|
, True
|
||||||
|
#endif // PANGO_PATCH
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#if NUMBERS_PATCH
|
#if NUMBERS_PATCH
|
||||||
@ -1986,7 +2008,11 @@ main(int argc, char *argv[])
|
|||||||
|
|
||||||
#if LINE_HEIGHT_PATCH
|
#if LINE_HEIGHT_PATCH
|
||||||
if (lineheight == -1)
|
if (lineheight == -1)
|
||||||
|
#if PANGO_PATCH
|
||||||
|
lineheight = drw->font->h * 2.5;
|
||||||
|
#else
|
||||||
lineheight = drw->fonts->h * 2.5;
|
lineheight = drw->fonts->h * 2.5;
|
||||||
|
#endif // PANGO_PATCH
|
||||||
#endif // LINE_HEIGHT_PATCH
|
#endif // LINE_HEIGHT_PATCH
|
||||||
|
|
||||||
#ifdef __OpenBSD__
|
#ifdef __OpenBSD__
|
||||||
|
Loading…
x
Reference in New Issue
Block a user