From 66bc4162170b72f192c156b692b621643f1e5d52 Mon Sep 17 00:00:00 2001 From: okan Date: Fri, 26 Jun 2015 17:17:46 +0000 Subject: Mechanical change from xinerama to region backed areas. --- menu.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'menu.c') diff --git a/menu.c b/menu.c index a348b40..5a7bef3 100644 --- a/menu.c +++ b/menu.c @@ -331,7 +331,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 +374,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 +415,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); -- cgit 1.4.1 From 6b8b8562172c860b8341fc9acf45ee7e2880e45a Mon Sep 17 00:00:00 2001 From: okan Date: Tue, 30 Jun 2015 18:42:50 +0000 Subject: style and spacing nits --- conf.c | 6 +++--- menu.c | 5 +++-- search.c | 10 ++-------- 3 files changed, 8 insertions(+), 13 deletions(-) (limited to 'menu.c') diff --git a/conf.c b/conf.c index a202e73..dab93e2 100644 --- a/conf.c +++ b/conf.c @@ -33,9 +33,9 @@ #include "calmwm.h" static const char *conf_bind_getmask(const char *, unsigned int *); -static void conf_cmd_remove(struct conf *, const char *); -static void conf_unbind_kbd(struct conf *, struct binding *); -static void conf_unbind_mouse(struct conf *, struct binding *); +static void conf_cmd_remove(struct conf *, const char *); +static void conf_unbind_kbd(struct conf *, struct binding *); +static void conf_unbind_mouse(struct conf *, struct binding *); int conf_cmd_add(struct conf *c, const char *name, const char *path) diff --git a/menu.c b/menu.c index 5a7bef3..0151ecf 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; diff --git a/search.c b/search.c index 9ddfd79..edb3421 100644 --- a/search.c +++ b/search.c @@ -42,10 +42,6 @@ static void search_match_path_exec(struct menu_q *, struct menu_q *, char *); static int strsubmatch(char *, char *, int); -/* - * Match: label, title, class. - */ - void search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search) { @@ -66,7 +62,7 @@ search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search) TAILQ_FOREACH(mi, menuq, entry) { int tier = -1, t; - struct client_ctx *cc = mi->ctx; + struct client_ctx *cc = (struct client_ctx *)mi->ctx; /* First, try to match on labels. */ if (cc->label != NULL && strsubmatch(search, cc->label, 0)) { @@ -130,11 +126,9 @@ search_match_client(struct menu_q *menuq, struct menu_q *resultq, char *search) void search_print_client(struct menu *mi, int list) { - struct client_ctx *cc; + struct client_ctx *cc = (struct client_ctx *)mi->ctx; char flag = ' '; - cc = mi->ctx; - if (cc == client_current()) flag = '!'; else if (cc->flags & CLIENT_HIDDEN) -- cgit 1.4.1