From dd76a20acd16df90457eb7eb11006902f8e3290b Mon Sep 17 00:00:00 2001 From: Johannes Schickel Date: Tue, 14 Sep 2010 00:15:20 +0000 Subject: GUI: Fix caret undrawing. (Regression from r48551) Starting with r48551 the caret undrawing caused the text selection color in ListWidgets to be removed. It also added a slight offset to the character next to the undrawn caret. All this is fixed now. svn-id: r52716 --- gui/ListWidget.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'gui/ListWidget.cpp') diff --git a/gui/ListWidget.cpp b/gui/ListWidget.cpp index 4447b62244..f5f41bba80 100644 --- a/gui/ListWidget.cpp +++ b/gui/ListWidget.cpp @@ -449,11 +449,15 @@ bool ListWidget::handleKeyUp(Common::KeyState state) { } void ListWidget::receivedFocusWidget() { + _inversion = ThemeEngine::kTextInversionFocus; + // Redraw the widget so the selection color will change draw(); } void ListWidget::lostFocusWidget() { + _inversion = ThemeEngine::kTextInversion; + // If we lose focus, we simply forget the user changes _editMode = false; g_system->setFeatureState(OSystem::kFeatureVirtualKeyboard, false); @@ -491,12 +495,8 @@ void ListWidget::drawWidget() { ThemeEngine::TextInversionState inverted = ThemeEngine::kTextInversionNone; // Draw the selected item inverted, on a highlighted background. - if (_selectedItem == pos) { - if (_hasFocus) - inverted = ThemeEngine::kTextInversionFocus; - else - inverted = ThemeEngine::kTextInversion; - } + if (_selectedItem == pos) + inverted = _inversion; Common::Rect r(getEditRect()); int pad = _leftPadding; -- cgit v1.2.3