diff options
author | okan | 2013-05-20 20:21:04 +0000 |
---|---|---|
committer | okan | 2013-05-20 20:21:04 +0000 |
commit | a4fa4ac623b54b25b58caaba5b717165be6915bb (patch) | |
tree | 16391330bcca29b3937500ccd6fb18ebe57b653f /menu.c | |
parent | e9251684bd2c326cd3a874f932ccbca1c93b4e2d (diff) | |
download | cwm-a4fa4ac623b54b25b58caaba5b717165be6915bb.tar.gz |
- configure menuwin with the screen, then create the xft drawable using
the menu window since that's the only place on which we draw
- elminate the need to change the drawable on every font draw
Diffstat (limited to 'menu.c')
-rw-r--r-- | menu.c | 17 |
1 files changed, 4 insertions, 13 deletions
@@ -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.63 2013/05/20 20:04:36 okan Exp $ + * $OpenBSD: menu.c,v 1.64 2013/05/20 20:21:04 okan Exp $ */ #include <sys/param.h> @@ -76,15 +76,6 @@ static int menu_calc_entry(struct menu_ctx *, int, int); static struct menu *menu_complete_path(struct menu_ctx *); static int menu_keycode(XKeyEvent *, enum ctltype *, char *); -void -menu_init(struct screen_ctx *sc) -{ - sc->menuwin = XCreateSimpleWindow(X_Dpy, sc->rootwin, 0, 0, 1, 1, - Conf.bwidth, - sc->xftcolor[CWM_COLOR_MENU_FG].pixel, - sc->xftcolor[CWM_COLOR_MENU_BG].pixel); -} - struct menu * menu_filter(struct screen_ctx *sc, struct menu_q *menuq, char *prompt, char *initial, int flags, @@ -417,7 +408,7 @@ menu_draw(struct menu_ctx *mc, struct menu_q *menuq, struct menu_q *resultq) mc->width, mc->height); if (mc->hasprompt) { - xu_xft_draw(sc, mc->dispstr, sc->menuwin, CWM_COLOR_MENU_FONT, + xu_xft_draw(sc, mc->dispstr, CWM_COLOR_MENU_FONT, 0, sc->xftfont->ascent); n = 1; } else @@ -432,7 +423,7 @@ menu_draw(struct menu_ctx *mc, struct menu_q *menuq, struct menu_q *resultq) if (mc->y + y > xine.h) break; - xu_xft_draw(sc, text, sc->menuwin, CWM_COLOR_MENU_FONT, 0, y); + xu_xft_draw(sc, text, CWM_COLOR_MENU_FONT, 0, y); n++; } if (mc->hasprompt && n > 1 && (mc->searchstr[0] != '\0')) { @@ -465,7 +456,7 @@ menu_draw_entry(struct menu_ctx *mc, struct menu_q *resultq, (sc->xftfont->height + 1) * entry, mc->width, (sc->xftfont->height + 1) + sc->xftfont->descent); color = active ? CWM_COLOR_MENU_FONT_SEL : CWM_COLOR_MENU_FONT; - xu_xft_draw(sc, text, sc->menuwin, color, + xu_xft_draw(sc, text, color, 0, (sc->xftfont->height + 1) * entry + sc->xftfont->ascent + 1); } |