Discussion:
cwm: avoid displaying empty menu
Martin Brandenburg
2016-02-20 17:29:16 UTC
Permalink
This avoids an empty square in the upper left corner if
there is nothing to display in some menu the user
requests.

-- Martin

Index: menu.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/menu.c,v
retrieving revision 1.89
diff -u -p -r1.89 menu.c
--- menu.c 11 Nov 2015 14:22:01 -0000 1.89
+++ menu.c 20 Feb 2016 17:26:17 -0000
@@ -89,6 +89,9 @@ menu_filter(struct screen_ctx *sc, struc
int evmask, focusrevert;
int xsave, ysave, xcur, ycur;

+ if (TAILQ_EMPTY(menuq))
+ return NULL;
+
TAILQ_INIT(&resultq);

(void)memset(&mc, 0, sizeof(mc));
Okan Demirmen
2016-02-20 21:16:13 UTC
Permalink
Post by Martin Brandenburg
This avoids an empty square in the upper left corner if
there is nothing to display in some menu the user
requests.
Sorry, but I think that is a big hammer; in fact there is evidence of
why these checks are no longer there in the calling functions, such as:

----------------------------
revision 1.89
date: 2015/06/07 19:10:00; author: okan; state: Exp; lines: +1 -7; commitid: DuQBUgWvLWBQOJbB;
even if the menuq is empty, at least show an empty menu instead of just
bailing making it look like the binding isn't working.
----------------------------

So if your application menu is empty, do you want to see the
'application' header with an empty list below it, or zero indication
(not even the header) that anything is working (or is it but empty?)?

..that's the rationale at least.

OR, is this empty square something else -what (empty) menu do you see
just an empty square with no indicator/header in it?

Thanks,
Okan
Post by Martin Brandenburg
-- Martin
Index: menu.c
===================================================================
RCS file: /cvs/xenocara/app/cwm/menu.c,v
retrieving revision 1.89
diff -u -p -r1.89 menu.c
--- menu.c 11 Nov 2015 14:22:01 -0000 1.89
+++ menu.c 20 Feb 2016 17:26:17 -0000
@@ -89,6 +89,9 @@ menu_filter(struct screen_ctx *sc, struc
int evmask, focusrevert;
int xsave, ysave, xcur, ycur;
+ if (TAILQ_EMPTY(menuq))
+ return NULL;
+
TAILQ_INIT(&resultq);
(void)memset(&mc, 0, sizeof(mc));
Loading...