diff options
author | okan <okan> | 2013-01-02 16:26:34 +0000 |
---|---|---|
committer | okan <okan> | 2013-01-02 16:26:34 +0000 |
commit | ce8ef02ed22041e88d23c20341060b3b977906a5 (patch) | |
tree | 3e4d240ea1633c916a1e7cb137dce6e2d1633ac6 /menu.c | |
parent | e492ed8e4138b3552349c314d45f2514ad3e62d5 (diff) | |
download | cwm-ce8ef02ed22041e88d23c20341060b3b977906a5.tar.gz cwm-ce8ef02ed22041e88d23c20341060b3b977906a5.tar.xz cwm-ce8ef02ed22041e88d23c20341060b3b977906a5.zip |
have screen_find_xinerama() return struct geom *reliably* instead of
XineramaScreenInfo; simplifies goop around the callers.
Diffstat (limited to 'menu.c')
-rw-r--r-- | menu.c | 35 |
1 files changed, 12 insertions, 23 deletions
diff --git a/menu.c b/menu.c index c5ceea9..f0d8f54 100644 --- a/menu.c +++ b/menu.c @@ -350,8 +350,7 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq, struct menu_q *resultq) { struct menu *mi; - XineramaScreenInfo *xine; - int x_org, y_org, xmax, ymax; + struct geom xine; int n, xsave, ysave; if (mc->list) { @@ -395,32 +394,22 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq, } xine = screen_find_xinerama(sc, mc->x, mc->y); - if (xine) { - x_org = xine->x_org; - y_org = xine->y_org; - xmax = xine->x_org + xine->width; - ymax = xine->y_org + xine->height; - } else { - x_org = y_org = 0; - xmax = sc->view.w; - ymax = sc->view.h; - } xsave = mc->x; ysave = mc->y; /* Never hide the top, or left side, of the menu. */ - if (mc->x + mc->width >= xmax) - mc->x = xmax - mc->width; - if (mc->x < x_org) { - mc->x = x_org; - mc->width = xmax - x_org; + if (mc->x + mc->width >= xine.w) + mc->x = xine.w - mc->width; + if (mc->x < xine.x) { + mc->x = xine.x; + mc->width = xine.w - xine.x; } - if (mc->y + mc->height >= ymax) - mc->y = ymax - mc->height; - if (mc->y < y_org) { - mc->y = y_org; - mc->height = ymax - y_org; + if (mc->y + mc->height >= xine.h) + mc->y = xine.h - mc->height; + if (mc->y < xine.y) { + mc->y = xine.y; + mc->height = xine.h - xine.y; } if (mc->x != xsave || mc->y != ysave) @@ -443,7 +432,7 @@ menu_draw(struct screen_ctx *sc, struct menu_ctx *mc, struct menu_q *menuq, int y = n * font_height(sc) + font_ascent(sc) + 1; /* Stop drawing when menu doesn't fit inside the screen. */ - if (mc->y + y > ymax) + if (mc->y + y > xine.h) break; font_draw(sc, text, MIN(strlen(text), MENU_MAXENTRY), |