mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-09-22 22:48:08 +03:00
Make the volume dialog's close button functional
This commit is contained in:
+12
@@ -182,6 +182,18 @@ static void render_icon(int id, mu_Rect rect, mu_Color color) {
|
||||
draw_thick_line(bx, by, cx, cy, thickness);
|
||||
break;
|
||||
}
|
||||
case MU_ICON_CLOSE: {
|
||||
// An X mark: two crossing diagonal strokes.
|
||||
float x = rect.x, y = rect.y, w = rect.w, h = rect.h;
|
||||
float lx = x + w * 0.32f, rx = x + w * 0.68f;
|
||||
float ty = y + h * 0.32f, by = y + h * 0.68f;
|
||||
int thickness = rect.w / 16;
|
||||
if (thickness < 1)
|
||||
thickness = 1;
|
||||
draw_thick_line(lx, ty, rx, by, thickness);
|
||||
draw_thick_line(lx, by, rx, ty, thickness);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
SDL_Rect r = { rect.x + rect.w / 2 - 2, rect.y + rect.h / 2 - 2, 4, 4 };
|
||||
SDL_RenderFillRect(gfx_renderer, &r);
|
||||
|
||||
+3
-1
@@ -166,7 +166,7 @@ static bool volume_build(mu_Context *ctx, modal *modal) {
|
||||
mu_Rect r = mu_rect((view_w - w) / 2, (view_h - h) / 2, w, h);
|
||||
|
||||
if (mu_begin_window_ex(ctx, _("Volume"), r,
|
||||
MU_OPT_NORESIZE | MU_OPT_NOCLOSE | MU_OPT_NOSCROLL)) {
|
||||
MU_OPT_NORESIZE | MU_OPT_NOSCROLL)) {
|
||||
for (int i = 0; i < count; i++) {
|
||||
if (!ch[i].label)
|
||||
continue;
|
||||
@@ -193,6 +193,8 @@ static bool volume_build(mu_Context *ctx, modal *modal) {
|
||||
if (mu_button(ctx, _("Close")))
|
||||
keep_open = false;
|
||||
mu_end_window(ctx);
|
||||
} else {
|
||||
keep_open = false; // The title-bar close button was clicked.
|
||||
}
|
||||
|
||||
if (st->base.cancelled) // Esc
|
||||
|
||||
Reference in New Issue
Block a user