|
|
@@ -609,6 +609,18 @@ static void draw_toolbar(struct ngui_rect r)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+/* ngui's scroll pane paints its bar over the right edge of the pane, so the
|
|
|
+ * content must leave that strip free while the pane scrolls. */
|
|
|
+#define SCROLLBAR_ROOM 20
|
|
|
+
|
|
|
+static struct ngui_rect scroll_content(struct ngui_rect area,
|
|
|
+ const struct ngui_scroll *s)
|
|
|
+{
|
|
|
+ if (!s->hide_bar && s->content_h > s->view_h)
|
|
|
+ area.w -= SCROLLBAR_ROOM;
|
|
|
+ return area;
|
|
|
+}
|
|
|
+
|
|
|
/* Empty IDE channels and absent eMMC/USB slots are registered as devices
|
|
|
* but have nothing to show; a floppy drive is listed without media too. */
|
|
|
static int listed(const struct disk *d)
|
|
|
@@ -619,7 +631,7 @@ static int listed(const struct disk *d)
|
|
|
static void draw_device_list(struct ngui_rect area)
|
|
|
{
|
|
|
struct ngui_row row;
|
|
|
- struct ngui_rect r;
|
|
|
+ struct ngui_rect r, col;
|
|
|
char sub[64], size[16];
|
|
|
int i, y;
|
|
|
|
|
|
@@ -630,12 +642,13 @@ static void draw_device_list(struct ngui_rect area)
|
|
|
list_scroll.content_h = (y + 1) * ROW_H + 2 * SECTION_H;
|
|
|
ngui_scroll_begin(&ui, area, &list_scroll);
|
|
|
ngui_scroll_wheel(&ui, area, &list_scroll);
|
|
|
+ col = scroll_content(area, &list_scroll);
|
|
|
y = area.y - list_scroll.offset;
|
|
|
|
|
|
- r = (struct ngui_rect){ area.x, y, area.w, SECTION_H };
|
|
|
+ r = (struct ngui_rect){ col.x, y, col.w, SECTION_H };
|
|
|
ngui_section(&ui, r, "Overview", 0, 0);
|
|
|
y += SECTION_H;
|
|
|
- r = (struct ngui_rect){ area.x, y, area.w, ROW_H };
|
|
|
+ r = (struct ngui_rect){ col.x, y, col.w, ROW_H };
|
|
|
if (visible(r, area)) {
|
|
|
snprintf(sub, sizeof(sub), "%d filesystem%s", nmounts,
|
|
|
nmounts == 1 ? "" : "s");
|
|
|
@@ -652,7 +665,7 @@ static void draw_device_list(struct ngui_rect area)
|
|
|
}
|
|
|
y += ROW_H;
|
|
|
|
|
|
- r = (struct ngui_rect){ area.x, y, area.w, SECTION_H };
|
|
|
+ r = (struct ngui_rect){ col.x, y, col.w, SECTION_H };
|
|
|
ngui_section(&ui, r, "Devices", 0, 0);
|
|
|
y += SECTION_H;
|
|
|
for (i = 0; i < ndisks; i++) {
|
|
|
@@ -660,7 +673,7 @@ static void draw_device_list(struct ngui_rect area)
|
|
|
|
|
|
if (!listed(d))
|
|
|
continue;
|
|
|
- r = (struct ngui_rect){ area.x, y, area.w, ROW_H };
|
|
|
+ r = (struct ngui_rect){ col.x, y, col.w, ROW_H };
|
|
|
y += ROW_H;
|
|
|
if (!visible(r, area))
|
|
|
continue;
|
|
|
@@ -985,20 +998,27 @@ static int draw_disk(struct ngui_rect area, int y, struct disk *d)
|
|
|
|
|
|
static void draw_details(struct ngui_rect area)
|
|
|
{
|
|
|
- int y, top;
|
|
|
+ struct ngui_rect col;
|
|
|
+ int y, top, had_bar;
|
|
|
|
|
|
ngui_inset(&area, 14);
|
|
|
ngui_scroll_begin(&ui, area, &detail_scroll);
|
|
|
ngui_scroll_wheel(&ui, area, &detail_scroll);
|
|
|
if (!ui.focus)
|
|
|
ngui_scroll_keys(&ui, &detail_scroll);
|
|
|
+ /* The height is only known after drawing, so the bar decision uses
|
|
|
+ * the previous frame's; redraw once when it flips. */
|
|
|
+ col = scroll_content(area, &detail_scroll);
|
|
|
+ had_bar = col.w != area.w;
|
|
|
top = area.y - detail_scroll.offset;
|
|
|
if (sel_disk < 0)
|
|
|
- y = draw_overview(area, top);
|
|
|
+ y = draw_overview(col, top);
|
|
|
else
|
|
|
- y = draw_disk(area, top, &disks[sel_disk]);
|
|
|
+ y = draw_disk(col, top, &disks[sel_disk]);
|
|
|
detail_scroll.content_h = y - top;
|
|
|
ngui_scroll_end(&ui, area, &detail_scroll);
|
|
|
+ if (had_bar != (scroll_content(area, &detail_scroll).w != area.w))
|
|
|
+ ngui_invalidate(&ui);
|
|
|
}
|
|
|
|
|
|
/* ---- dialogs ---- */
|