diff options
author | Christian Neukirchen <chneukirchen@gmail.com> | 2015-07-01 16:38:16 +0200 |
---|---|---|
committer | Christian Neukirchen <chneukirchen@gmail.com> | 2015-07-01 16:40:15 +0200 |
commit | 671671959360a30e99b6812f132b6f1f0ff0d6e6 (patch) | |
tree | 4926d843020562666ed212543d7149ac1d92469f /menu.c | |
parent | 4454948f213d470ca3e6c087bb790190c7bfd484 (diff) | |
parent | 8efaf33cfbced84ff073f5c4d3b2c8e9d7b3bff4 (diff) | |
download | cwm-671671959360a30e99b6812f132b6f1f0ff0d6e6.tar.gz cwm-671671959360a30e99b6812f132b6f1f0ff0d6e6.tar.xz cwm-671671959360a30e99b6812f132b6f1f0ff0d6e6.zip |
cvsimport
Diffstat (limited to 'menu.c')
-rw-r--r-- | menu.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/menu.c b/menu.c index f0b864b..211264e 100644 --- a/menu.c +++ b/menu.c @@ -72,7 +72,7 @@ static void menu_draw(struct menu_ctx *, struct menu_q *, static void menu_draw_entry(struct menu_ctx *, struct menu_q *, int, int); static int menu_calc_entry(struct menu_ctx *, int, int); -static struct menu *menu_complete_path(struct menu_ctx *); +static struct menu *menu_complete_path(struct menu_ctx *); static int menu_keycode(XKeyEvent *, enum ctltype *, char *); struct menu * @@ -184,6 +184,7 @@ out: static struct menu * menu_complete_path(struct menu_ctx *mc) { + struct screen_ctx *sc = mc->sc; struct menu *mi, *mr; struct menu_q menuq; @@ -191,7 +192,7 @@ menu_complete_path(struct menu_ctx *mc) TAILQ_INIT(&menuq); - if ((mi = menu_filter(mc->sc, &menuq, mc->searchstr, NULL, + if ((mi = menu_filter(sc, &menuq, mc->searchstr, NULL, CWM_MENU_DUMMY, search_match_path_any, NULL)) != NULL) { mr->abort = mi->abort; mr->dummy = mi->dummy; @@ -331,7 +332,7 @@ menu_draw(struct menu_ctx *mc, struct menu_q *menuq, struct menu_q *resultq) { struct screen_ctx *sc = mc->sc; struct menu *mi; - struct geom xine; + struct geom area; int n, xsave, ysave; if (mc->list) { @@ -374,25 +375,25 @@ menu_draw(struct menu_ctx *mc, struct menu_q *menuq, struct menu_q *resultq) mc->num++; } - xine = screen_find_xinerama(sc, mc->geom.x, mc->geom.y, CWM_GAP); - xine.w += xine.x - Conf.bwidth * 2; - xine.h += xine.y - Conf.bwidth * 2; + area = screen_area(sc, mc->geom.x, mc->geom.y, CWM_GAP); + area.w += area.x - Conf.bwidth * 2; + area.h += area.y - Conf.bwidth * 2; xsave = mc->geom.x; ysave = mc->geom.y; /* Never hide the top, or left side, of the menu. */ - if (mc->geom.x + mc->geom.w >= xine.w) - mc->geom.x = xine.w - mc->geom.w; - if (mc->geom.x < xine.x) { - mc->geom.x = xine.x; - mc->geom.w = MIN(mc->geom.w, (xine.w - xine.x)); + if (mc->geom.x + mc->geom.w >= area.w) + mc->geom.x = area.w - mc->geom.w; + if (mc->geom.x < area.x) { + mc->geom.x = area.x; + mc->geom.w = MIN(mc->geom.w, (area.w - area.x)); } - if (mc->geom.y + mc->geom.h >= xine.h) - mc->geom.y = xine.h - mc->geom.h; - if (mc->geom.y < xine.y) { - mc->geom.y = xine.y; - mc->geom.h = MIN(mc->geom.h, (xine.h - xine.y)); + if (mc->geom.y + mc->geom.h >= area.h) + mc->geom.y = area.h - mc->geom.h; + if (mc->geom.y < area.y) { + mc->geom.y = area.y; + mc->geom.h = MIN(mc->geom.h, (area.h - area.y)); } if (mc->geom.x != xsave || mc->geom.y != ysave) @@ -415,7 +416,7 @@ menu_draw(struct menu_ctx *mc, struct menu_q *menuq, struct menu_q *resultq) int y = n * (sc->xftfont->height + 1) + sc->xftfont->ascent + 1; /* Stop drawing when menu doesn't fit inside the screen. */ - if (mc->geom.y + y > xine.h) + if (mc->geom.y + y > area.h) break; xu_xft_draw(sc, text, CWM_COLOR_MENU_FONT, 0, y); |