Skip to content

Commit

Permalink
Close certain dialogs containing only one Exit button with Enter key (i…
Browse files Browse the repository at this point in the history
  • Loading branch information
a1exsh authored Oct 19, 2021
1 parent c7a5cef commit 472b88f
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/fheroes2/battle/battle_dialogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ void Battle::DialogBattleSettings( void )
RedrawBattleSettings( optionAreas );
saveConfiguration = true;
}
else if ( Game::HotKeyPressEvent( Game::EVENT_DEFAULT_EXIT ) || le.MouseClickLeft( btn_ok.area() ) ) {
else if ( HotKeyCloseWindow || le.MouseClickLeft( btn_ok.area() ) ) {
break;
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/fheroes2/castle/castle_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ int Castle::OpenDialog( bool readonly )
le.MousePressLeft( buttonExit.area() ) ? buttonExit.drawOnPress() : buttonExit.drawOnRelease();

// Check buttons for closing this castle's window.
if ( le.MouseClickLeft( buttonExit.area() ) || Game::HotKeyPressEvent( Game::EVENT_DEFAULT_EXIT ) ) {
if ( le.MouseClickLeft( buttonExit.area() ) || HotKeyCloseWindow ) {
result = Dialog::CANCEL;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/fheroes2/dialog/dialog_adventure.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ int Dialog::AdventureOptions( bool enabledig )
result = Dialog::DIG;
break;
}
if ( le.MouseClickLeft( buttonCancel.area() ) || Game::HotKeyPressEvent( Game::EVENT_DEFAULT_EXIT ) ) {
if ( le.MouseClickLeft( buttonCancel.area() ) || HotKeyCloseWindow ) {
result = Dialog::CANCEL;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/fheroes2/dialog/dialog_armyinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ int Dialog::ArmyInfo( const Troop & troop, int flags, bool isReflected )
break;
}
// exit
if ( le.MouseClickLeft( buttonExit.area() ) || Game::HotKeyPressEvent( Game::EVENT_DEFAULT_EXIT ) ) {
if ( le.MouseClickLeft( buttonExit.area() ) || HotKeyCloseWindow ) {
result = Dialog::CANCEL;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/fheroes2/dialog/dialog_file.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ fheroes2::GameMode Dialog::FileOptions()
break;
}
}
else if ( le.MouseClickLeft( buttonCancel.area() ) || Game::HotKeyPressEvent( Game::EVENT_DEFAULT_EXIT ) ) {
else if ( le.MouseClickLeft( buttonCancel.area() ) || HotKeyCloseWindow ) {
result = fheroes2::GameMode::CANCEL;
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/fheroes2/heroes/heroes_dialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ int Heroes::OpenDialog( bool readonly /* = false */, bool fade /* = false */, bo
}

// exit
if ( le.MouseClickLeft( buttonExit.area() ) || Game::HotKeyPressEvent( Game::EVENT_DEFAULT_EXIT ) )
if ( le.MouseClickLeft( buttonExit.area() ) || HotKeyCloseWindow )
return Dialog::CANCEL;

// heroes troops
Expand Down
2 changes: 1 addition & 1 deletion src/fheroes2/kingdom/kingdom_overview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -721,7 +721,7 @@ void Kingdom::openOverviewDialog()
}

// Exit this dialog.
if ( le.MouseClickLeft( buttonExit.area() ) || Game::HotKeyPressEvent( Game::EVENT_DEFAULT_EXIT ) )
if ( le.MouseClickLeft( buttonExit.area() ) || HotKeyCloseWindow )
break;

// switch view: heroes/castle
Expand Down
2 changes: 1 addition & 1 deletion src/fheroes2/kingdom/view_world.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ void ViewWorld::ViewWorldWindow( const int color, const ViewWorldMode mode, Inte

bool changed = false;

if ( le.MouseClickLeft( buttonExit.area() ) || Game::HotKeyPressEvent( Game::EVENT_DEFAULT_EXIT ) ) {
if ( le.MouseClickLeft( buttonExit.area() ) || HotKeyCloseWindow ) {
break;
}
else if ( le.MouseClickLeft( buttonZoom.area() ) ) {
Expand Down
2 changes: 1 addition & 1 deletion src/fheroes2/spell/spell_book.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ Spell SpellBook::Open( const HeroBase & hero, const Filter displayableSpells, co
else if ( le.MousePressRight( next_list ) ) {
Dialog::Message( "", _( "View next page" ), Font::BIG );
}
else if ( le.MouseClickLeft( clos_rt ) || Game::HotKeyPressEvent( Game::EVENT_DEFAULT_EXIT ) )
else if ( le.MouseClickLeft( clos_rt ) || HotKeyCloseWindow )
break;
else if ( le.MouseClickLeft( pos ) ) {
const int32_t index = GetRectIndex( coords, le.GetMouseCursor() );
Expand Down

0 comments on commit 472b88f

Please sign in to comment.