gui: simplify code in GUIKeyboard
- merge duplicated code into new ParseKey method
- convert some unsigned int to int to avoid warnings
- add local variable for current key in NotifyTouch to reduce clutter
Change-Id: I98ddbaca50d487c97ab6e98938df91ef03b9aed5
diff --git a/gui/objects.hpp b/gui/objects.hpp
index 1d20c2a..3e33561 100644
--- a/gui/objects.hpp
+++ b/gui/objects.hpp
@@ -899,9 +899,10 @@
{
unsigned char key;
unsigned char longpresskey;
- unsigned int end_x;
- unsigned int layout;
+ int end_x;
+ int layout;
};
+ int ParseKey(const char* keyinfo, keyboard_key_class& key, int& Xindex, int keyWidth, bool longpress);
struct capslock_tracking_struct
{
int capslock;
@@ -914,9 +915,8 @@
struct capslock_tracking_struct caps_tracking[MAX_KEYBOARD_LAYOUTS];
bool mRendered;
std::string mVariable;
- unsigned int cursorLocation;
- unsigned int currentLayout;
- unsigned int row_heights[MAX_KEYBOARD_LAYOUTS][MAX_KEYBOARD_ROWS];
+ int currentLayout;
+ int row_heights[MAX_KEYBOARD_LAYOUTS][MAX_KEYBOARD_ROWS];
unsigned int KeyboardWidth, KeyboardHeight;
int rowY, colX, highlightRenderCount, hasHighlight, hasCapsHighlight;
GUIAction* mAction;