mirror of
https://github.com/leahneukirchen/cwm.git
synced 2023-08-10 21:13:12 +03:00
have screen_find_xinerama() return struct geom *reliably* instead of
XineramaScreenInfo; simplifies goop around the callers.
This commit is contained in:
35
menu.c
35
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),
|
||||
|
Reference in New Issue
Block a user