- let callers of font_draw figure out (and pass) the color instead of an
'active' flag. - use strlen() inside of font_draw; the only instance where it wasn't used happened to be ignored on a subsequent draw.
This commit is contained in:
parent
a68efeab64
commit
7f75636e2f
@ -15,7 +15,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* $OpenBSD: calmwm.h,v 1.198 2013/05/11 22:01:07 okan Exp $
|
||||
* $OpenBSD: calmwm.h,v 1.199 2013/05/14 12:35:56 okan Exp $
|
||||
*/
|
||||
|
||||
#ifndef _CALMWM_H_
|
||||
@ -447,7 +447,7 @@ void conf_mousebind(struct conf *, char *, char *);
|
||||
void conf_screen(struct screen_ctx *);
|
||||
void conf_ungrab(struct conf *, struct keybinding *);
|
||||
|
||||
void font_draw(struct screen_ctx *, const char *, int,
|
||||
void font_draw(struct screen_ctx *, const char *,
|
||||
Drawable, int, int, int);
|
||||
void font_init(struct screen_ctx *, const char *,
|
||||
const char **);
|
||||
|
@ -15,7 +15,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* $OpenBSD: font.c,v 1.25 2013/05/02 17:25:15 okan Exp $
|
||||
* $OpenBSD: font.c,v 1.26 2013/05/14 12:35:56 okan Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -75,13 +75,10 @@ font_width(XftFont *xftfont, const char *text, int len)
|
||||
}
|
||||
|
||||
void
|
||||
font_draw(struct screen_ctx *sc, const char *text, int len,
|
||||
Drawable d, int active, int x, int y)
|
||||
font_draw(struct screen_ctx *sc, const char *text,
|
||||
Drawable d, int color, int x, int y)
|
||||
{
|
||||
int color;
|
||||
|
||||
color = active ? CWM_COLOR_MENU_FONT_SEL : CWM_COLOR_MENU_FONT;
|
||||
XftDrawChange(sc->xftdraw, d);
|
||||
XftDrawStringUtf8(sc->xftdraw, &sc->xftcolor[color], sc->xftfont, x, y,
|
||||
(const FcChar8*)text, len);
|
||||
(const FcChar8*)text, strlen(text));
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* $OpenBSD: menu.c,v 1.60 2013/05/10 16:10:40 okan Exp $
|
||||
* $OpenBSD: menu.c,v 1.61 2013/05/14 12:35:56 okan Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -419,7 +419,7 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq,
|
||||
mc->width, mc->height);
|
||||
|
||||
if (mc->hasprompt) {
|
||||
font_draw(sc, mc->dispstr, strlen(mc->dispstr), sc->menuwin, 0,
|
||||
font_draw(sc, mc->dispstr, sc->menuwin, CWM_COLOR_MENU_FONT,
|
||||
0, sc->xftfont->ascent);
|
||||
n = 1;
|
||||
} else
|
||||
@ -434,8 +434,7 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq,
|
||||
if (mc->y + y > xine.h)
|
||||
break;
|
||||
|
||||
font_draw(sc, text, MIN(strlen(text), MENU_MAXENTRY),
|
||||
sc->menuwin, 0, 0, y);
|
||||
font_draw(sc, text, sc->menuwin, CWM_COLOR_MENU_FONT, 0, y);
|
||||
n++;
|
||||
}
|
||||
if (mc->hasprompt && n > 1 && (mc->searchstr[0] != '\0')) {
|
||||
@ -466,7 +465,8 @@ menu_draw_entry(struct screen_ctx *sc, struct menu_ctx *mc,
|
||||
XftDrawRect(sc->xftdraw, &sc->xftcolor[color], 0,
|
||||
(sc->xftfont->height + 1) * entry, mc->width,
|
||||
(sc->xftfont->height + 1) + sc->xftfont->descent);
|
||||
font_draw(sc, text, strlen(text), sc->menuwin, active,
|
||||
color = active ? CWM_COLOR_MENU_FONT_SEL : CWM_COLOR_MENU_FONT;
|
||||
font_draw(sc, text, sc->menuwin, color,
|
||||
0, (sc->xftfont->height + 1) * entry + sc->xftfont->ascent + 1);
|
||||
}
|
||||
|
||||
|
@ -16,7 +16,7 @@
|
||||
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
|
||||
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
*
|
||||
* $OpenBSD: mousefunc.c,v 1.49 2013/05/02 19:33:17 okan Exp $
|
||||
* $OpenBSD: mousefunc.c,v 1.50 2013/05/14 12:35:56 okan Exp $
|
||||
*/
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -62,8 +62,8 @@ mousefunc_sweep_draw(struct client_ctx *cc)
|
||||
XMapWindow(X_Dpy, sc->menuwin);
|
||||
XClearWindow(X_Dpy, sc->menuwin);
|
||||
|
||||
font_draw(sc, asize, strlen(asize), sc->menuwin, 0, 0,
|
||||
sc->xftfont->ascent + 1);
|
||||
font_draw(sc, asize, sc->menuwin, CWM_COLOR_MENU_FONT,
|
||||
0, sc->xftfont->ascent + 1);
|
||||
}
|
||||
|
||||
void
|
||||
|
Loading…
Reference in New Issue
Block a user