Handle back button on android
This commit is contained in:
parent
73be29aa61
commit
9f50249ca8
@ -25,7 +25,7 @@ ConsoleView::ConsoleView():
|
|||||||
|
|
||||||
void ConsoleView::DoKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt)
|
void ConsoleView::DoKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, bool alt)
|
||||||
{
|
{
|
||||||
if ((ui::Engine::Ref().GraveExitsConsole && scan == SDL_SCANCODE_GRAVE && key != '~') || key == SDLK_ESCAPE)
|
if ((ui::Engine::Ref().GraveExitsConsole && scan == SDL_SCANCODE_GRAVE && key != '~') || key == SDLK_ESCAPE || key == SDLK_AC_BACK)
|
||||||
{
|
{
|
||||||
if (!repeat)
|
if (!repeat)
|
||||||
doClose = true;
|
doClose = true;
|
||||||
|
@ -254,6 +254,7 @@ void ElementSearchActivity::OnKeyPress(int key, int scan, bool repeat, bool shif
|
|||||||
if(firstResult)
|
if(firstResult)
|
||||||
gameController->SetActiveTool(0, firstResult);
|
gameController->SetActiveTool(0, firstResult);
|
||||||
case SDLK_ESCAPE:
|
case SDLK_ESCAPE:
|
||||||
|
case SDLK_AC_BACK:
|
||||||
exit = true;
|
exit = true;
|
||||||
break;
|
break;
|
||||||
case SDLK_LSHIFT:
|
case SDLK_LSHIFT:
|
||||||
|
@ -16,6 +16,8 @@ namespace ui
|
|||||||
constexpr int MAX_WIDTH = 64;
|
constexpr int MAX_WIDTH = 64;
|
||||||
class FontEditor: public ui::Window
|
class FontEditor: public ui::Window
|
||||||
{
|
{
|
||||||
|
void HandleExit();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ByteString dataFile;
|
ByteString dataFile;
|
||||||
std::map<String::value_type, unsigned char> fontWidths;
|
std::map<String::value_type, unsigned char> fontWidths;
|
||||||
|
@ -1597,6 +1597,12 @@ void GameView::OnKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl,
|
|||||||
{
|
{
|
||||||
switch (key)
|
switch (key)
|
||||||
{
|
{
|
||||||
|
case SDLK_AC_BACK:
|
||||||
|
if (ALLOW_QUIT)
|
||||||
|
{
|
||||||
|
ui::Engine::Ref().ConfirmExit();
|
||||||
|
}
|
||||||
|
break;
|
||||||
case SDLK_TAB: //Tab
|
case SDLK_TAB: //Tab
|
||||||
c->ChangeBrush();
|
c->ChangeBrush();
|
||||||
break;
|
break;
|
||||||
|
@ -366,7 +366,7 @@ void Window::DoKeyPress(int key, int scan, bool repeat, bool shift, bool ctrl, b
|
|||||||
if (!stop)
|
if (!stop)
|
||||||
OnKeyPress(key, scan, repeat, shift, ctrl, alt);
|
OnKeyPress(key, scan, repeat, shift, ctrl, alt);
|
||||||
|
|
||||||
if (key == SDLK_ESCAPE)
|
if (key == SDLK_ESCAPE || key == SDLK_AC_BACK)
|
||||||
OnTryExit(Escape);
|
OnTryExit(Escape);
|
||||||
|
|
||||||
if (key == SDLK_KP_ENTER || key == SDLK_RETURN)
|
if (key == SDLK_KP_ENTER || key == SDLK_RETURN)
|
||||||
|
@ -201,7 +201,7 @@ void LocalBrowserView::OnKeyPress(int key, int scan, bool repeat, bool shift, bo
|
|||||||
{
|
{
|
||||||
if (repeat)
|
if (repeat)
|
||||||
return;
|
return;
|
||||||
if (key == SDLK_ESCAPE)
|
if (key == SDLK_ESCAPE || key == SDLK_AC_BACK)
|
||||||
c->Exit();
|
c->Exit();
|
||||||
else if (key == SDLK_LCTRL || key == SDLK_RCTRL)
|
else if (key == SDLK_LCTRL || key == SDLK_RCTRL)
|
||||||
c->SetMoveToFront(false);
|
c->SetMoveToFront(false);
|
||||||
|
@ -643,7 +643,7 @@ void SearchView::OnKeyPress(int key, int scan, bool repeat, bool shift, bool ctr
|
|||||||
{
|
{
|
||||||
if (repeat)
|
if (repeat)
|
||||||
return;
|
return;
|
||||||
if (key == SDLK_ESCAPE)
|
if (key == SDLK_ESCAPE || key == SDLK_AC_BACK)
|
||||||
c->Exit();
|
c->Exit();
|
||||||
else if ((focusedComponent_ != pageTextbox && focusedComponent_ != searchField) && scan == SDL_SCANCODE_A && ctrl)
|
else if ((focusedComponent_ != pageTextbox && focusedComponent_ != searchField) && scan == SDL_SCANCODE_A && ctrl)
|
||||||
c->SelectAllSaves();
|
c->SelectAllSaves();
|
||||||
|
Reference in New Issue
Block a user