Skip to content

Commit

Permalink
libappfw: Switch to text input mode in text editor widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
skyjake committed Sep 1, 2019
1 parent ebf44b6 commit 21dfbd3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
16 changes: 10 additions & 6 deletions doomsday/libs/appfw/src/widgets/lineeditwidget.cpp
Expand Up @@ -392,7 +392,9 @@ void LineEditWidget::focusGained()
d->hint->setOpacity(0);
}

#if defined (DE_MOBILE)
root().window().eventHandler().setKeyboardMode(WindowEventHandler::TextInput);

/*#if defined (DE_MOBILE)
{
auto &win = root().window();
emit win.textEntryRequest();
Expand All @@ -401,19 +403,21 @@ void LineEditWidget::focusGained()
connect(&win, &GLWindow::userEnteredText, this, &LineEditWidget::userEnteredText);
connect(&win, &GLWindow::userFinishedTextEntry, this, &LineEditWidget::userFinishedTextEntry);
}
#endif
#endif*/
}

void LineEditWidget::focusLost()
{
#if defined (DE_MOBILE)
root().window().eventHandler().setKeyboardMode(WindowEventHandler::RawKeys);

/*#if defined (DE_MOBILE)
{
auto &win = root().window();
disconnect(&win, &GLWindow::userEnteredText, this, &LineEditWidget::userEnteredText);
disconnect(&win, &GLWindow::userFinishedTextEntry, this, &LineEditWidget::userFinishedTextEntry);
emit win.textEntryDismiss();
}
#endif
#endif*/

d->contentChanged(false /* don't notify */);

Expand All @@ -423,7 +427,7 @@ void LineEditWidget::focusLost()
}
}

#if defined (DE_MOBILE)
/*#if defined (DE_MOBILE)
void LineEditWidget::userEnteredText(QString text)
{
setText(text);
Expand All @@ -433,7 +437,7 @@ void LineEditWidget::userFinishedTextEntry()
{
root().popFocus();
}
#endif
#endif*/

void LineEditWidget::update()
{
Expand Down
2 changes: 1 addition & 1 deletion doomsday/libs/appfw/src/widgets/popupwidget.cpp
Expand Up @@ -94,7 +94,7 @@ DE_GUI_PIMPL(PopupWidget)
self().setOpeningDirection(openDir);
}

typedef Vector2<Rule const *> Vector2R;
using Vector2R = Vector2<Rule const *>;

Vector2R anchorRule() const
{
Expand Down
4 changes: 2 additions & 2 deletions doomsday/libs/gui/src/windoweventhandler.cpp
Expand Up @@ -290,12 +290,12 @@ void WindowEventHandler::setKeyboardMode(KeyboardMode kbMode)
d->keyboardMode = kbMode;
if (kbMode == TextInput)
{
LOG_INPUT_MSG("Begin text input mode");
LOG_INPUT_MSG("Keyboard mode changed to text input");
SDL_StartTextInput();
}
else
{
LOG_INPUT_MSG("End text input mode");
LOG_INPUT_MSG("Keyboard mode changed to raw key events");
SDL_StopTextInput();
}
}
Expand Down

0 comments on commit 21dfbd3

Please sign in to comment.