summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEamon Walsh <ewalsh@tycho.nsa.gov>2011-08-01 18:08:53 -0400
committerEamon Walsh <ewalsh@tycho.nsa.gov>2011-08-01 18:10:40 -0400
commit17bac9851baa05f4c7ffd40d7d6bd5e8d867d048 (patch)
treef48d0cadd88397bb2e5d7db26de5707484b18023
parent05e55e6d36b6f4eba1377389da98cfc2f35b6105 (diff)
Add drawing of event icons for individual displays in the switcher.
-rw-r--r--src/display.c16
-rw-r--r--src/icon.c25
-rw-r--r--src/icon.h5
3 files changed, 39 insertions, 7 deletions
diff --git a/src/display.c b/src/display.c
index 9ba1602..702a734 100644
--- a/src/display.c
+++ b/src/display.c
@@ -103,7 +103,7 @@ display_update_seclabel(struct display *d)
surf->DrawString(surf, l2->label, -1, screen_width * 3 / 4, 0, DSTF_TOPCENTER);
}
- icon_draw_icons(surf);
+ icon_draw_seclabel(surf);
surf->Flip(surf, NULL, DSFLIP_ONSYNC);
surf->Release(surf);
@@ -198,7 +198,6 @@ show_switcher(void)
d = CIRCLEQ_FIRST(&displays);
n = MIN(num_displays, MAX_THUMBS);
- s = switcher_start_hpos(n);
if (num_displays > MAX_THUMBS) {
d = active_display;
@@ -209,9 +208,11 @@ show_switcher(void)
v->visible = 0;
}
+ s = switcher_start_hpos(n);
+ y = guest_height / 2;
+
for (i = 0; i < n; i++) {
x = switcher_next_hpos(s, i);
- y = guest_height / 2 + CURSOR_WIDTH;
TAILQ_FOREACH(v, &d->views, display_next) {
view_move(v->thumb, x + v->tpos.x, y + v->tpos.y);
@@ -223,7 +224,7 @@ show_switcher(void)
surf->SetColor(surf, 0xff, 0x00, 0x00, 0xff);
surf->FillRectangle(surf,
x - CURSOR_WIDTH,
- guest_height / 2,
+ y - CURSOR_WIDTH,
thumb_width + 2 * CURSOR_WIDTH,
thumb_height + 2 * CURSOR_WIDTH);
}
@@ -231,10 +232,15 @@ show_switcher(void)
surf->SetColor(surf, 0xff, 0xff, 0xff, 0xff);
surf->FillRectangle(surf,
x - BORDER_WIDTH,
- guest_height / 2 + CURSOR_WIDTH - BORDER_WIDTH,
+ y - BORDER_WIDTH,
thumb_width + 2 * BORDER_WIDTH,
thumb_height + 2 * BORDER_WIDTH);
+ /* draw active event icons for this display */
+ icon_draw_display(surf, d,
+ x + thumb_width / 2,
+ y + thumb_height + BORDER_WIDTH + ICON_PAD);
+
d = CIRCLEQ_LOOP_NEXT(&displays, d, display_next);
}
diff --git a/src/icon.c b/src/icon.c
index 617d2d9..0de7025 100644
--- a/src/icon.c
+++ b/src/icon.c
@@ -90,7 +90,7 @@ icon_clear(struct display *d)
}
void
-icon_draw_icons(IDirectFBSurface *surf)
+icon_draw_seclabel(IDirectFBSurface *surf)
{
int i, x, y;
@@ -103,6 +103,29 @@ icon_draw_icons(IDirectFBSurface *surf)
}
}
+void
+icon_draw_display(IDirectFBSurface *surf, struct display *d, int x, int y)
+{
+ int i, n;
+
+ /* Calculate x position to start drawing */
+ for (n = 0, i = 0; i < LINPICKER_NUM_EVENTS; i++)
+ if (d->events[i])
+ n++;
+
+ if (n == 0)
+ return;
+
+ x -= (n * ICON_WIDTH + (n - 1) * ICON_PAD) / 2;
+
+ /* Draw icons */
+ for (i = 0; i < LINPICKER_NUM_EVENTS; i++)
+ if (d->events[i]) {
+ surf->Blit(surf, icons[i], NULL, x, y);
+ x += ICON_WIDTH + ICON_PAD;
+ }
+}
+
int
icon_init(void)
{
diff --git a/src/icon.h b/src/icon.h
index 32d8686..be84bcc 100644
--- a/src/icon.h
+++ b/src/icon.h
@@ -36,7 +36,10 @@ void
icon_clear(struct display *d);
void
-icon_draw_icons(IDirectFBSurface *surf);
+icon_draw_seclabel(IDirectFBSurface *surf);
+
+void
+icon_draw_display(IDirectFBSurface *surf, struct display *d, int x, int y);
int
icon_init(void);