From 90bcd989f76bee66c1e8165bff5b021bb8498c78 Mon Sep 17 00:00:00 2001 From: Tom Marble Date: Tue, 18 Oct 2022 13:31:31 -0500 Subject: [PATCH] Reverts quit operation --- apps/mtxcli/locales/i18n.json | 12 ------------ apps/mtxcli/src/cmds.rs | 4 ---- apps/mtxcli/src/cmds/help.rs | 6 +----- apps/mtxcli/src/cmds/quit.rs | 26 -------------------------- services/gam/src/api.rs | 3 --- services/gam/src/lib.rs | 6 ------ services/gam/src/main.rs | 10 ---------- 7 files changed, 1 insertion(+), 66 deletions(-) delete mode 100644 apps/mtxcli/src/cmds/quit.rs diff --git a/apps/mtxcli/locales/i18n.json b/apps/mtxcli/locales/i18n.json index 25e803b32..1a033b88a 100644 --- a/apps/mtxcli/locales/i18n.json +++ b/apps/mtxcli/locales/i18n.json @@ -17,18 +17,6 @@ "zh": "TBD available mtxcli commands:", "en-tts": "available mtxcli commands:" }, - "mtxcli.quit.help": { - "en": "quit (returns to shellchat)", - "ja": "TBD quit...", - "zh": "TBD quit...", - "en-tts": "quit (returns to shellchat)" - }, - "mtxcli.quit.quitting": { - "en": "quitting...", - "ja": "TBD quitting...", - "zh": "TBD quitting...", - "en-tts": "quitting.." - }, "mtxcli.unknown.help": { "en": "unknown command", "ja": "TBD unknown command", diff --git a/apps/mtxcli/src/cmds.rs b/apps/mtxcli/src/cmds.rs index a1b7ba4cd..d09823e79 100644 --- a/apps/mtxcli/src/cmds.rs +++ b/apps/mtxcli/src/cmds.rs @@ -81,14 +81,12 @@ impl CommonEnv { ///// 1. add your module here, and pull its namespace into the local crate mod help; use help::*; -mod quit; use quit::*; pub struct CmdEnv { common_env: CommonEnv, lastverb: String::<256>, ///// 2. declare storage for your command here. help_cmd: Help, - quit_cmd: Quit, } impl CmdEnv { pub fn new(xns: &xous_names::XousNames) -> CmdEnv { @@ -110,7 +108,6 @@ impl CmdEnv { lastverb: String::<256>::new(), ///// 3. initialize your storage, by calling new() help_cmd: Help::new(&xns), - quit_cmd: Quit::new(&xns), } } @@ -120,7 +117,6 @@ impl CmdEnv { let commands: &mut [& mut dyn ShellCmdApi] = &mut [ ///// 4. add your command to this array, so that it can be looked up and dispatched &mut self.help_cmd, - &mut self.quit_cmd, ]; if let Some(cmdline) = maybe_cmdline { diff --git a/apps/mtxcli/src/cmds/help.rs b/apps/mtxcli/src/cmds/help.rs index 8ba6693da..98893a402 100644 --- a/apps/mtxcli/src/cmds/help.rs +++ b/apps/mtxcli/src/cmds/help.rs @@ -27,13 +27,9 @@ impl<'a> ShellCmdApi<'a> for Help { "help" => { write!(ret, "{}", t!("mtxcli.help.help", xous::LANG)).unwrap(); } - "quit" => { - write!(ret, "{}", t!("mtxcli.quit.help", xous::LANG)).unwrap(); - } "" => { write!(ret, "{}\n", t!("mtxcli.help.overview", xous::LANG)).unwrap(); - write!(ret, "{}\n", t!("mtxcli.help.help", xous::LANG)).unwrap(); - write!(ret, "{}", t!("mtxcli.quit.help", xous::LANG)).unwrap(); + write!(ret, "{}", t!("mtxcli.help.help", xous::LANG)).unwrap(); } _ => { write!(ret, "{}: {}", diff --git a/apps/mtxcli/src/cmds/quit.rs b/apps/mtxcli/src/cmds/quit.rs deleted file mode 100644 index dad519df9..000000000 --- a/apps/mtxcli/src/cmds/quit.rs +++ /dev/null @@ -1,26 +0,0 @@ -use crate::{ShellCmdApi,CommonEnv}; -use xous_ipc::String; -use core::fmt::Write; -use locales::t; - -#[derive(Debug)] -pub struct Quit { -} -impl Quit { - pub fn new(_xns: &xous_names::XousNames) -> Self { - Quit { - } - } -} - -impl<'a> ShellCmdApi<'a> for Quit { - cmd_api!(quit); - - fn process(&mut self, _args: String::<1024>, env: &mut CommonEnv) -> Result>, xous::Error> { - let mut ret = String::<1024>::new(); - - write!(ret, "{}", t!("mtxcli.quit.quitting", xous::LANG)).unwrap(); - env.gam.request_default_app().unwrap(); - Ok(Some(ret)) - } -} diff --git a/services/gam/src/api.rs b/services/gam/src/api.rs index 59d74e5c4..3b86e8265 100644 --- a/services/gam/src/api.rs +++ b/services/gam/src/api.rs @@ -201,9 +201,6 @@ pub(crate) enum Opcode { Bip39toBytes = 30, BytestoBip39 = 31, Bip39Suggestions = 32, - - /// Request switching to the default app - DefaultApp = 33, } // small wart -- we have to reset the size of a modal to max size for resize computations diff --git a/services/gam/src/lib.rs b/services/gam/src/lib.rs index 3cd3ca5c4..c53417d7b 100644 --- a/services/gam/src/lib.rs +++ b/services/gam/src/lib.rs @@ -394,12 +394,6 @@ impl Gam { let buf = Buffer::into_buf(switchapp).or(Err(xous::Error::InternalError))?; buf.send(self.conn, Opcode::SwitchToApp.to_u32().unwrap()).or(Err(xous::Error::InternalError)).map(|_|()) } - /// Allows applications to "quit" and switch to a default application - pub fn request_default_app(&self) -> Result<(), xous::Error> { - send_message(self.conn, - Message::new_scalar(Opcode::DefaultApp.to_usize().unwrap(), 0, 0, 0, 0) - ).map(|_|()) - } pub fn raise_menu(&self, menu_name_str: &str) -> Result<(), xous::Error> { let menu_name = GamActivation { name: String::<128>::from_str(menu_name_str), diff --git a/services/gam/src/main.rs b/services/gam/src/main.rs index 97c42bbb6..bafdae764 100644 --- a/services/gam/src/main.rs +++ b/services/gam/src/main.rs @@ -664,16 +664,6 @@ fn wrapped_main() -> ! { } buffer.replace(spec).unwrap(); } - Some(Opcode::DefaultApp) => { - if let Some(new_app_token) = context_mgr.find_app_token_by_name(INITIAL_APP_FOCUS) { - match context_mgr.activate(&gfx, &mut canvases, new_app_token, true) { - Ok(_) => (), - Err(_) => log::warn!("failed to switch to {}, silent error!", switchapp.app_name.as_str().unwrap()), - } - } else { - log::warn!("Request to switch to default app, but the default app has not registered itself yet!"); - } - } Some(Opcode::Quit) => break, None => {log::error!("unhandled message {:?}", msg);} }