summaryrefslogtreecommitdiff
path: root/navit/gui
diff options
context:
space:
mode:
authorgreg <code@gregorkopf.de>2015-07-16 22:20:44 +0200
committerSebastian Leske <sebastian.leske@sleske.name>2015-12-17 23:56:31 +0100
commit52a7a81b41824ee0b0f116f1e68852285eab48fb (patch)
tree74a3db4409a3b2d4b74792d8b6634622f4b8d837 /navit/gui
parent3f4b78d7f3ed8a35e255997d5e2216c1b1fae50d (diff)
downloadnavit-52a7a81b41824ee0b0f116f1e68852285eab48fb.tar.gz
Fix:gui_internal:Correct case-switching & highlighting in search dialog.
Fixes for the on-screen keyboard of the search dialog in the internal GUI: Switch the keyboard to lower-case after first input character, even if entered via the physical keyboard. Switch back to upper-case and un-highlight all keys if user clears search input.
Diffstat (limited to 'navit/gui')
-rw-r--r--navit/gui/internal/gui_internal_keyboard.c36
-rw-r--r--navit/gui/internal/gui_internal_keyboard.h2
-rw-r--r--navit/gui/internal/gui_internal_search.c7
3 files changed, 37 insertions, 8 deletions
diff --git a/navit/gui/internal/gui_internal_keyboard.c b/navit/gui/internal/gui_internal_keyboard.c
index 3e0d1aa33..efddc010d 100644
--- a/navit/gui/internal/gui_internal_keyboard.c
+++ b/navit/gui/internal/gui_internal_keyboard.c
@@ -12,6 +12,33 @@
#include "gui_internal_menu.h"
#include "gui_internal_keyboard.h"
+void
+gui_internal_keyboard_to_upper_case(struct gui_priv *this)
+{
+ struct menu_data *md;
+ md=gui_internal_menu_data(this);
+ // Switch to lowercase after the first key is pressed
+ if (md->keyboard_mode == 10) // Latin
+ gui_internal_keyboard_do(this, md->keyboard, 2);
+ if (md->keyboard_mode == 34) // Umlaut
+ gui_internal_keyboard_do(this, md->keyboard, 26);
+ if (md->keyboard_mode == 50) // Russian/Ukrainian/Belorussian
+ gui_internal_keyboard_do(this, md->keyboard, 42);
+}
+
+void
+gui_internal_keyboard_to_lower_case(struct gui_priv *this)
+{
+ struct menu_data *md;
+ md=gui_internal_menu_data(this);
+ // Switch to lowercase after the first key is pressed
+ if (md->keyboard_mode == (VKBD_LATIN_UPPER | VKBD_FLAG_2)) // Latin
+ gui_internal_keyboard_do(this, md->keyboard, VKBD_LATIN_LOWER | VKBD_FLAG_2);
+ if (md->keyboard_mode == (VKBD_UMLAUT_UPPER | VKBD_FLAG_2)) // Umlaut
+ gui_internal_keyboard_do(this, md->keyboard, VKBD_UMLAUT_LOWER | VKBD_FLAG_2);
+ if (md->keyboard_mode == (VKBD_CYRILLIC_UPPER | VKBD_FLAG_2)) // Russian/Ukrainian/Belorussian
+ gui_internal_keyboard_do(this, md->keyboard, VKBD_CYRILLIC_LOWER | VKBD_FLAG_2);
+}
/**
* @brief Processes a key press on the internal GUI keyboard
@@ -26,16 +53,9 @@
static void
gui_internal_cmd_keypress(struct gui_priv *this, struct widget *wm, void *data)
{
- struct menu_data *md;
gui_internal_keypress_do(this, (char *) wm->data);
- md=gui_internal_menu_data(this);
// Switch to lowercase after the first key is pressed
- if (md->keyboard_mode == (VKBD_LATIN_UPPER | VKBD_FLAG_2)) // Latin
- gui_internal_keyboard_do(this, md->keyboard, VKBD_LATIN_LOWER | VKBD_FLAG_2);
- if (md->keyboard_mode == (VKBD_UMLAUT_UPPER | VKBD_FLAG_2)) // Umlaut
- gui_internal_keyboard_do(this, md->keyboard, VKBD_UMLAUT_LOWER | VKBD_FLAG_2);
- if (md->keyboard_mode == (VKBD_CYRILLIC_UPPER | VKBD_FLAG_2)) // Russian/Ukrainian/Belorussian
- gui_internal_keyboard_do(this, md->keyboard, VKBD_CYRILLIC_LOWER | VKBD_FLAG_2);
+ gui_internal_keyboard_to_lower_case(this);
}
static struct widget *
diff --git a/navit/gui/internal/gui_internal_keyboard.h b/navit/gui/internal/gui_internal_keyboard.h
index 09a4573ff..336ba2c01 100644
--- a/navit/gui/internal/gui_internal_keyboard.h
+++ b/navit/gui/internal/gui_internal_keyboard.h
@@ -25,4 +25,6 @@ struct widget;
struct widget *gui_internal_keyboard_do(struct gui_priv *this, struct widget *wkbdb, int mode);
struct widget *gui_internal_keyboard(struct gui_priv *this, int mode);
int gui_internal_keyboard_init_mode(char *lang);
+void gui_internal_keyboard_to_upper_case(struct gui_priv *this);
+void gui_internal_keyboard_to_lower_case(struct gui_priv *this);
/* end of prototypes */
diff --git a/navit/gui/internal/gui_internal_search.c b/navit/gui/internal/gui_internal_search.c
index 7a0f4869b..307d940bc 100644
--- a/navit/gui/internal/gui_internal_search.c
+++ b/navit/gui/internal/gui_internal_search.c
@@ -428,7 +428,14 @@ gui_internal_search_changed(struct gui_priv *this, struct widget *wm, void *data
search_attr.type=attr_house_number;
search_attr.u.str=wm->text;
search_list_search(this->sl, &search_attr, 1);
+ // Text is not necessarily entered via the on-screen keyboard,
+ // but we now switch it to lower case anyway.
+ gui_internal_keyboard_to_lower_case(this);
gui_internal_search_idle_start(this, wm->name, search_list, param);
+ } else {
+ // If not enough content is entered, we highlight all keys.
+ gui_internal_keyboard_to_upper_case(this);
+ gui_internal_highlight_possible_keys(this, "");
}
l=g_list_last(this->root.children);
gui_internal_widget_render(this, l->data);