_disabledIconOverlay, a ManagedSurface regularly re-instantiated, should be
deleted rather than merely have its free() method called.
While here, remove an if() which is guaranteed true lest scummvm segfault.
These commands allow greater control over editable ListWidgets, although
the save dialog's list is currently the only one.
kListItemSingleClickedCmd allows clients to respond to selection changes
based on the method used (mouse vs keyboard) and allows responding to
clicking on an already selected item. In the next commit, this will fix
multiple save issues.
kListItemEditModeStartedCmd allows clients to initialize edit mode
consistently. The save dialog has been doing custom initialization after
calling startEditMode, but this is incorrect because ListWidget calls
startEditMode in response to Enter, so the initialization is skipped.
Fixes the delete/backspace hotkey on the save list dialog; it was only
working on the load list even though they both have the same delete
functionality.
This is a check from 17 years ago that I believe was confused and had
no effect at the time. I believe the intent was to ignore these keys
while in edit mode, which makes sense, but instead this code ignored
these keys on all editable lists when *not* in edit mode. This wasn't
noticeable because there's only one editable ListWidget in ScummVM,
the save list, and it didn't listen for kListItemRemovalRequestCmd
until three years ago: aac1eb12bf
When in edit mode on the save dialog, clicking on a disabled item, such
as the Autosave slot 0, would draw the stale caret on the disabled item
at the x position of the previous item.
This makes it so that games are started on the release
of the left mouse button after a double click, instead of
during it being pressed.
This fixes the left mouse button release leaking into the
launched game as actual engine input.
This was actually the intention all along. But if a redraw of the widget
itself was triggered at the same time, it would draw over the caret,
effectively erasing it. To get around this, the caret is now also drawn
as part of the widget, when necessary.
There were two main issues:
1. The intermediate surface on which the rich text is drawn was not
resized when the widget was resized. This resulted in text being
cut.
2. The Graphics::MacText does not properly handle width changes,
Resize is not handled at all if there is a table, but even when
there is no table it can have issues with the font.
As a workaround it is now recreated instead of being resized.
EditableWidget took over keyboard events targeted towards Debugger and
List. This commit fixes it by reverting some part of the code to its
original state.
Fixes issues caused by PR #5366