(svn r24785) -Add: Various methods to open the OSK. (based on patch by Eagle_rainbow)

This commit is contained in:
frosch
2012-12-05 19:34:25 +00:00
parent b3bd33adfb
commit 5b2da98ca3
6 changed files with 36 additions and 2 deletions

View File

@@ -30,6 +30,15 @@
#include "table/strings.h"
/** Method to open the OSK. */
enum OskActivation {
OSKA_DISABLED, ///< The OSK shall not be activated at all.
OSKA_DOUBLE_CLICK, ///< Double click on the edit box opens OSK.
OSKA_SINGLE_CLICK, ///< Single click after focus click opens OSK.
OSKA_IMMEDIATELY, ///< Focussing click already opens OSK.
};
static const NWidgetPart _nested_land_info_widgets[] = {
NWidget(NWID_HORIZONTAL),
NWidget(WWT_CLOSEBOX, COLOUR_GREY),
@@ -835,8 +844,10 @@ void QueryString::ClickEditBox(Window *w, Point pt, int wid, int click_count, bo
return;
}
if (!focus_changed && w->window_class != WC_OSK) {
/* Open the OSK window if clicked on an edit box, while not changing focus */
if (w->window_class != WC_OSK && _settings_client.gui.osk_activation != OSKA_DISABLED &&
(!focus_changed || _settings_client.gui.osk_activation == OSKA_IMMEDIATELY) &&
(click_count == 2 || _settings_client.gui.osk_activation != OSKA_DOUBLE_CLICK)) {
/* Open the OSK window */
ShowOnScreenKeyboard(w, wid);
}
}