aboutsummaryrefslogtreecommitdiffstats
path: root/menu.c
diff options
context:
space:
mode:
Diffstat (limited to 'menu.c')
-rw-r--r--menu.c37
1 files changed, 13 insertions, 24 deletions
diff --git a/menu.c b/menu.c
index e49c675..7275365 100644
--- a/menu.c
+++ b/menu.c
@@ -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.49 2013/01/02 02:19:20 okan Exp $
+ * $OpenBSD: menu.c,v 1.50 2013/01/02 16:26:34 okan Exp $
*/
#include <sys/param.h>
@@ -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),