Close dialogs with Escape before handling page shortcuts

This commit is contained in:
waozi committed 2026-10-22 00:10:42 -03:00
1 parent d7f1ac1a5d
commit 143a9a03c2
13 files changed
+97 -43

No files matched your search

+4
View File
@@ -2,8 +2,12 @@
## [2.1.38] - 2026-10-21
- Apps uses clean scrollable lists. Hold an app for one second to arrange favorites, then tap Done to return to browsing.
- Apps opens with one shared renderer for its pinned and other apps.
- Arcade switches to newly installed game updates without keeping an older campaign open.
- Shovey's own Back button returns to its game chooser.
- Escape closes the open dialog, including while an input is focused.
- Scrolling stays responsive while a text field is focused.
- Profile Activity shows activity without repeating profile destinations.
- Every achievement has its own meaningful icon, without numbered badge frames.
@@ -1,5 +1,8 @@
- Apps uses clean scrollable lists. Hold an app for one second to arrange favorites, then tap Done to return to browsing.
- Apps opens with one shared renderer for its pinned and other apps.
- Arcade switches to newly installed game updates without keeping an older campaign open.
- Shovey's own Back button returns to its game chooser.
- Escape closes the open dialog, including while an input is focused.
- Scrolling stays responsive while a text field is focused.
- Profile Activity shows activity without repeating profile destinations.
- Every achievement has its own meaningful icon, without numbered badge frames.
+1 -1
View File
@@ -101,7 +101,7 @@ app_draw_session_exit_modal :: (app: *InnerBreeze, can_save: s32, save_message:
return cast(SessionExitModalResult)SessionExitModalDiscard
}
}
return ifx (modal_result == 1) then (cast(SessionExitModalResult)SessionExitModalCancel) else (cast(SessionExitModalResult)SessionExitModalNone)
return ifx (modal_result == 1 || modal_result == -1) then (cast(SessionExitModalResult)SessionExitModalCancel) else (cast(SessionExitModalResult)SessionExitModalNone)
}
app_draw_close_prompt :: (app: *InnerBreeze) {
modal_result: s32
+1 -1
View File
@@ -210,7 +210,7 @@ draw_global_modal :: (app: *InnerBreeze) {
ActionModalAction.{.label = LocaleText("retry_button"), .tone = cast(ButtonTone)ButtonToneAccent, .emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled},
]
modal_result = ActionModal(app.ui.session, ActionModalProps.{.title = LocaleText("meditation_music_network_error_title"), .message = LocaleText("meditation_music_network_error_message")}, actions[:2]).action
if modal_result == 1 {
if modal_result == 1 || modal_result == -1 {
TraceLog(LOG_INFO, "AUDIO: Network error download cancelled")
app_close_modal(app)
} else if modal_result == 2 {
+5 -2
View File
@@ -234,11 +234,14 @@ updateapp :: (app: *InnerBreeze) {
// the desktop rail, so a cold page cannot swallow the next tap.
app_draw_bottom_nav(app)
app_draw_return_bar(app)
// Kryon gives the top overlay first refusal of Escape, before page
// navigation or the idle-home quit shortcut can see that same press.
escape_requested := IsKeyPressed(APP_KEY_ESCAPE) && !TreeEscapeCaptured(app.ui.session)
back_requested := IsKeyPressed(APP_KEY_BACK) ||
((app.launcher_open || app.breathing.screen == ScreenNodeApp || (app.modal.active != 0 &&
(app.modal.type == cast(ModalType)ModalStoragePlans ||
app.modal.type == cast(ModalType)ModalDewTopUp ||
app.modal.type == cast(ModalType)ModalDewGift))) && IsKeyPressed(APP_KEY_ESCAPE))
app.modal.type == cast(ModalType)ModalDewGift))) && escape_requested)
#if !#defined(ANDROID_BUILD) && !#defined(PLATFORM_WEB) {
if IsKeyPressed(KEY_BACKSPACE) && ((app.breathing.screen == ScreenStart && app.practice_tab != PRACTICE_TAB_PLAY) || app.breathing.screen == ScreenSession || app.breathing.screen == ScreenMeditation || app.breathing.screen == ScreenSunSalutation || app.breathing.screen == ScreenPatterns || app.breathing.screen == ScreenTaiChi || app.breathing.screen == ScreenAstralProjection || app.breathing.screen == ScreenWorkout) {
back_requested = true
@@ -272,7 +275,7 @@ updateapp :: (app: *InnerBreeze) {
// Ctrl+Q quits from any screen; Esc quits only from idle home.
if IsKeyPressed(KEY_Q) && (IsKeyDown(KEY_LEFT_CONTROL) || IsKeyDown(KEY_RIGHT_CONTROL)) {
app_request_desktop_quit(app)
} else if !back_requested && IsKeyPressed(APP_KEY_ESCAPE) &&
} else if !back_requested && escape_requested &&
app.breathing.screen == ScreenStart &&
app.practice_tab == PRACTICE_TAB_PLAY &&
app.modal.active == 0 && first_run_guide_active == 0 &&
+6 -2
View File
@@ -183,7 +183,7 @@ Prepare :: (argc: s32, argv: **u8) {
config.height = MINI_WINDOW_HEIGHT
}
RaylibTraceToConsole(RaylibTraceProps.{.android_tag = "InnerBreeze",
.android_note_prefix = "APP PROBE:", .android_note_tag = "InbeStartup"})
.android_note_prefix = "APP PROBE:", .android_note_tag = "InbeStartup"})
if screenshot.active == 0 {
// A separate data root identifies a debug desktop profile.
#if !#defined(ANDROID_BUILD) && !#defined(PLATFORM_WEB) {
@@ -287,9 +287,13 @@ DrawFrame :: (app: *InnerBreeze) {
app_frame_probe_count: s32;
// Kryon moves the focus with Tab and Shift+Tab and, after Tab, presses the
// focused control with Enter or Space. A frame without one of these keys
// focused control with Enter or Space. Escape dismisses the top overlay.
// A frame without one of these keys
// sends 0, which clears the last frame's key.
AppNavigationKey :: () -> s32 {
if IsKeyPressed(KEY_ESCAPE) || TestDriverKeyPressed(KEY_ESCAPE) {
return KeyEscape
}
if IsKeyPressed(KEY_TAB) || TestDriverKeyPressed(KEY_TAB) {
return KeyTab
}
@@ -114,7 +114,7 @@ sun_salutation_handle_exit_modal :: (app: *InnerBreeze) -> s32 {
ActionModalAction.{.label = LocaleText("exit_button"), .tone = cast(ButtonTone)ButtonToneDanger, .emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled},
]
modal_result := ActionModal(app.ui.session, ActionModalProps.{.title = LocaleText("exit_session_title"), .message = LocaleText("all_progress_lost_message")}, actions[:2]).action
if modal_result == 1 {
if modal_result == 1 || modal_result == -1 {
app_close_modal(app)
} else if modal_result == 2 {
exit_to_start(app)
+34 -34
View File
@@ -107,15 +107,15 @@ TaiChiFinish :: (app: *InnerBreeze) {
#program_export
tai_chi_handle_exit_modal :: (app: *InnerBreeze) -> s32 {
if app == null || app.modal.active == 0 ||
app.modal.type != cast(ModalType)ModalConfirmExitSession {
app.modal.type != cast(ModalType)ModalConfirmExitSession {
return 0
}
actions: [2]ActionModalAction = .[
ActionModalAction.{.label = LocaleText("cancel_button"), .tone = cast(ButtonTone)ButtonToneNeutral, .emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft},
ActionModalAction.{.label = LocaleText("exit_button"), .tone = cast(ButtonTone)ButtonToneDanger, .emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled},
ActionModalAction.{.label = LocaleText("cancel_button"), .tone = cast(ButtonTone)ButtonToneNeutral, .emphasis = cast(ButtonEmphasis)ButtonEmphasisSoft},
ActionModalAction.{.label = LocaleText("exit_button"), .tone = cast(ButtonTone)ButtonToneDanger, .emphasis = cast(ButtonEmphasis)ButtonEmphasisFilled},
]
modal_result := ActionModal(app.ui.session, ActionModalProps.{.title = LocaleText("exit_session_title"), .message = LocaleText("all_progress_lost_message")}, actions[:2]).action
if modal_result == 1 {
if modal_result == 1 || modal_result == -1 {
app_close_modal(app)
} else if modal_result == 2 {
TaiChiExitToStart(app)
@@ -238,12 +238,12 @@ TaiChiDrawCue :: (app: *InnerBreeze, top_y: s32) -> s32 {
if subtitle.count > 0 {
font := AppScale(Text16)
Text(CurrentApp().ui.session, TextProps.{
.bounds = Rectangle.{cast(float32)side, cast(float32)y, cast(float32)width, 0},
.text = subtitle,
.font = font,
.class_name = MutedTextClass(),
.align = cast(TextAlign)TextAlignCenter,
.wrap = cast(TextWrap)TextWrapEllipsis})
.bounds = Rectangle.{cast(float32)side, cast(float32)y, cast(float32)width, 0},
.text = subtitle,
.font = font,
.class_name = MutedTextClass(),
.align = cast(TextAlign)TextAlignCenter,
.wrap = cast(TextWrap)TextWrapEllipsis})
y += AppTextLineHeight(font) + AppScale(4)
}
cue := TaiChiCueText(app)
@@ -251,12 +251,12 @@ TaiChiDrawCue :: (app: *InnerBreeze, top_y: s32) -> s32 {
// Room for two lines, so the figure does not jump as cues change.
if cue.count > 0 {
Text(CurrentApp().ui.session, TextProps.{
.bounds = Rectangle.{cast(float32)side, cast(float32)y, cast(float32)width,
cast(float32)(AppTextLineHeight(cue_font) * 2)},
.text = cue,
.font = cue_font,
.align = cast(TextAlign)TextAlignCenter,
.wrap = cast(TextWrap)TextWrapAuto})
.bounds = Rectangle.{cast(float32)side, cast(float32)y, cast(float32)width,
cast(float32)(AppTextLineHeight(cue_font) * 2)},
.text = cue,
.font = cue_font,
.align = cast(TextAlign)TextAlignCenter,
.wrap = cast(TextWrap)TextWrapAuto})
}
return y + AppTextLineHeight(cue_font) * 2
}
@@ -287,10 +287,10 @@ TaiChiDrawAngles :: (app: *InnerBreeze, y: s32, height: s32) {
width = AppScale(440)
}
options: [TAI_CHI_VIEW_COUNT]SegmentOption = .[
SegmentOption.{.label = LocaleText("tai_chi_view_front")},
SegmentOption.{.label = LocaleText("tai_chi_view_back")},
SegmentOption.{.label = LocaleText("tai_chi_view_side")},
SegmentOption.{.label = LocaleText("tai_chi_view_angled")}]
SegmentOption.{.label = LocaleText("tai_chi_view_front")},
SegmentOption.{.label = LocaleText("tai_chi_view_back")},
SegmentOption.{.label = LocaleText("tai_chi_view_side")},
SegmentOption.{.label = LocaleText("tai_chi_view_angled")}]
props: SegmentedControlProps
props.key = KeyHash("inbe/practices/tai_chi/angle")
props.bounds = Rectangle.{cast(float32)((app.ui.view_width - width) / 2), cast(float32)y,
@@ -334,12 +334,12 @@ tai_chi_draw_screen :: (app: *InnerBreeze, center_x: s32, center_y: s32) {
controls[1] = IconRowAction.{.icon = pause_icon}
controls[2] = IconRowAction.{.icon = ActionIcon.IconNext}
row := PracticeControlRow(IconRowRequest.{
.center_x = center_x,
.view_width = app.ui.view_width,
.view_height = app.ui.view_height,
.count = 3,
.items = *controls[0]
})
.center_x = center_x,
.view_width = app.ui.view_width,
.view_height = app.ui.view_height,
.count = 3,
.items = *controls[0]
})
figure_top := TaiChiDrawCue(app, title_h + AppScale(12)) + AppScale(8)
progress_y := row.y - AppScale(22)
@@ -356,16 +356,16 @@ tai_chi_draw_screen :: (app: *InnerBreeze, center_x: s32, center_y: s32) {
if row.clicked_index == {
case 0;
PracticeNarrationStop()
app.tai_chi = TaiChiSeek(app.tai_chi, TaiChiNextStepTime(app.tai_chi, false))
return
PracticeNarrationStop()
app.tai_chi = TaiChiSeek(app.tai_chi, TaiChiNextStepTime(app.tai_chi, false))
return
case 1;
app.session_paused = ifx app.session_paused != 0 then 0 else 1
return
app.session_paused = ifx app.session_paused != 0 then 0 else 1
return
case 2;
PracticeNarrationStop()
app.tai_chi = TaiChiSeek(app.tai_chi, TaiChiNextStepTime(app.tai_chi, true))
return
PracticeNarrationStop()
app.tai_chi = TaiChiSeek(app.tai_chi, TaiChiNextStepTime(app.tai_chi, true))
return
}
PracticeNarrationUpdate(app, "taichi", TaiChiCueKey(app))
+1 -1
View File
@@ -445,7 +445,7 @@ profile_screen_draw_remove_friend_modal :: (app: *InnerBreeze) {
.title = LocaleText("profile_friend_remove_title"),
.message = FrameTextHold(*app.ui.frame_text,
AppTextFromCString(*message[0], 384))}, actions[:2]).action
if modal_result == 1 {
if modal_result == 1 || modal_result == -1 {
app.profile_pending_friend_remove_id[0] = cast(u8)0
app.profile_pending_friend_remove_name[0] = cast(u8)0
app_close_modal(app)
+1 -1
View File
@@ -532,7 +532,7 @@ SettingsDataPrompt :: (app: *InnerBreeze, key: string,
props.message = message
props.max_width = AppScale(440)
result := ActionModal(app.ui.session, props, actions[0:labels.count])
return result.action
return ifx result.action == -1 then 1 else result.action
}
review_scroll: s32;
+5
View File
@@ -80,6 +80,11 @@ with editor("keep-discard") as (driver, database, app):
# Capture only this test process's window on its private display.
found = subprocess.check_output(["xdotool", "search", "--onlyvisible", "--pid", str(app.pid)], text=True)
subprocess.run(["import", "-window", found.splitlines()[0], str(OUTPUT / "prompt.png")], check=True)
driver.key("escape")
driver.wait(focus_id=NAME, value="Unsaved habit")
assert not driver.find(label=PROMPT), "Escape did not dismiss the unsaved prompt"
assert not saved(database, "Unsaved habit"), "Escape saved the draft"
driver.press(label="Back", role="button")
driver.press(label="Keep editing", role="button")
driver.wait(focus_id=NAME, value="Unsaved habit")
assert not saved(database, "Unsaved habit"), "keeping the draft saved it"
+18
View File
@@ -270,6 +270,18 @@ with contextlib.ExitStack() as stack:
assert "Dana" not in names and "Emerald" not in names, names
assert "Owner" in names and "Invited" in names and "Read only" in names, names
assert "Refresh" not in names, names
# Escape works with the invite field focused and stays on this list.
driver.press(key=6540)
subprocess.run(["xdotool", "windowfocus", find_window()], check=True)
subprocess.run(["xdotool", "keydown", "Escape"], check=True)
time.sleep(.12)
subprocess.run(["xdotool", "keyup", "Escape"], check=True)
wait_for(lambda: not driver.find(role="modal", visible=True),
"Escape did not close the focused sharing dialog")
driver.wait(label="Share", role="button")
driver.wait(contains="Garden", role="tab")
driver.press(label="Share", role="button")
driver.wait(label="Cedar")
# The same open dialog remains readable on a phone-sized viewport.
subprocess.run(["xdotool", "windowsize", find_window(), "390", "844"], check=True)
wait_for(lambda: driver.wait(role="modal")["width"] <= 390,
@@ -315,6 +327,12 @@ with contextlib.ExitStack() as stack:
driver.wait(label="Can edit", role="option")
driver.wait(label="Owner", role="option")
driver.wait(label="Remove access", role="option")
# The first Escape closes the access popup, leaving Share open.
driver.key("escape")
wait_for(lambda: not driver.find(role="option", visible=True),
"Escape did not close the access popup")
driver.wait(label="People with access")
driver.press(label="Read only")
driver.press(label="Can edit", role="option")
wait_for(lambda: sql("SELECT json FROM social_snapshots WHERE kind LIKE 'lists.attempt/%/http://127.0.0.1:10'"),
"the permission change was not stored")
+17
View File
@@ -171,6 +171,23 @@ with tempfile.TemporaryDirectory(prefix="inbe-startup-quit-") as temporary, cont
# Preview windows used to discard the close dialog result forever. The
# prompt must also appear and work above the Apps overlay.
for scene in ("close_prompt", "close_prompt_over_apps"):
with application(Path(temporary) / (scene + "-escape"), "escape-" + scene, "--screenshot",
str(Path(temporary) / (scene + "-escape.png")), "--screenshot-scene", scene,
"--screenshot-width", "900", "--screenshot-height", "720",
preview=True) as (app, window, log):
driver.wait(contains="keep Inner Breeze running")
command("xdotool", "windowfocus", window)
command("xdotool", "keydown", "Escape")
time.sleep(.12)
command("xdotool", "keyup", "Escape")
deadline = time.monotonic() + 5
while driver.find(contains="keep Inner Breeze running", visible=True):
assert time.monotonic() < deadline, "Escape did not dismiss the close prompt\n" + driver.text()
time.sleep(.05)
assert app.poll() is None, "Escape quit the app behind the close prompt"
if scene == "close_prompt_over_apps":
driver.wait(label="More apps")
receipts[scene + "_escape"] = "dismissed without quitting"
with application(Path(temporary) / scene, "quit-" + scene, "--screenshot",
str(Path(temporary) / (scene + ".png")), "--screenshot-scene", scene,
"--screenshot-width", "900", "--screenshot-height", "720",