widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #13421
[Merge] lp:~widelands-dev/widelands/bug-keyboard-after-save-delete into lp:widelands
Notabilis has proposed merging lp:~widelands-dev/widelands/bug-keyboard-after-save-delete into lp:widelands.
Commit message:
Fixing keyboard navigation after "remove game" dialog has been displayed.
Requested reviews:
Widelands Developers (widelands-dev)
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/bug-keyboard-after-save-delete/+merge/345469
When in the single player "load game" menu the "remove game" dialog has been displayed, keyboard navigation afterwards no longer works, e.g., selecting a game with the arrow keys. The problem is that the current focus isn't correctly set afterwards.
The focus is determined by a list of pointer over the panels of the window, each pointing to its child that currently has the focus: p1->p2->p3->p4->p5 (with p5 being the game list that should be controlled). When the removal dialog is opened, its parent is set as p3, resulting in the focus pointer in p3 being changed. When the game list p5 later on re-requests the focus, the pointer in p4 is checked before setting it. Since it is already pointing to p5, the modified pointer in p3 is never reached.
This branch removes this check since it seems to me that it is only a (in this case broken) optimization. Another possible approach would be to set the focus pointers of all child panels to nullptr when a pointer is changed (not tested).
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/bug-keyboard-after-save-delete into lp:widelands.
=== modified file 'src/ui_basic/panel.cc'
--- src/ui_basic/panel.cc 2018-05-07 05:35:32 +0000
+++ src/ui_basic/panel.cc 2018-05-13 08:07:57 +0000
@@ -664,8 +664,6 @@
if (!parent_ || this == modal_) {
return;
}
- if (parent_->focus_ == this)
- return;
parent_->focus_ = this;
parent_->focus(false);
=== modified file 'src/wui/load_or_save_game.cc'
--- src/wui/load_or_save_game.cc 2018-05-13 07:15:39 +0000
+++ src/wui/load_or_save_game.cc 2018-05-13 08:07:57 +0000
@@ -268,6 +268,7 @@
ngettext("Confirm Deleting File", "Confirm Deleting Files", no_selections), message,
UI::WLMessageBox::MBoxType::kOkCancel);
do_delete = confirmationBox.run<UI::Panel::Returncodes>() == UI::Panel::Returncodes::kOk;
+ table_.focus();
}
if (do_delete) {
for (const uint32_t index : selections) {
@@ -292,7 +293,6 @@
// Make sure that the game details are updated
entry_selected();
}
- // TODO(GunChleoc): When the removal dialog was open, navigation with arrow keys no longer works.
}
UI::Button* LoadOrSaveGame::delete_button() {
Follow ups