diff --git a/gui/devices/1024x600/res/ui.xml b/gui/devices/1024x600/res/ui.xml
index 4597fb3a..190e6f5d 100755
--- a/gui/devices/1024x600/res/ui.xml
+++ b/gui/devices/1024x600/res/ui.xml
@@ -102,6 +102,7 @@
+
@@ -382,6 +383,7 @@
+
@@ -390,7 +392,7 @@
-
+
diff --git a/gui/devices/1024x768/res/ui.xml b/gui/devices/1024x768/res/ui.xml
index 84f47029..434fe36d 100644
--- a/gui/devices/1024x768/res/ui.xml
+++ b/gui/devices/1024x768/res/ui.xml
@@ -102,6 +102,7 @@
+
@@ -382,6 +383,7 @@
+
@@ -390,7 +392,7 @@
-
+
diff --git a/gui/devices/1080x1920/res/ui.xml b/gui/devices/1080x1920/res/ui.xml
index 3ab69a6e..c336dbad 100644
--- a/gui/devices/1080x1920/res/ui.xml
+++ b/gui/devices/1080x1920/res/ui.xml
@@ -101,6 +101,7 @@
+
@@ -368,6 +369,7 @@
+
@@ -376,7 +378,7 @@
-
+
diff --git a/gui/devices/1200x1920/res/ui.xml b/gui/devices/1200x1920/res/ui.xml
index 5aedca8b..17512163 100644
--- a/gui/devices/1200x1920/res/ui.xml
+++ b/gui/devices/1200x1920/res/ui.xml
@@ -104,6 +104,7 @@
+
@@ -371,6 +372,7 @@
+
@@ -379,7 +381,7 @@
-
+
diff --git a/gui/devices/1280x800/res/ui.xml b/gui/devices/1280x800/res/ui.xml
index c7d91489..447f760f 100644
--- a/gui/devices/1280x800/res/ui.xml
+++ b/gui/devices/1280x800/res/ui.xml
@@ -102,6 +102,7 @@
+
@@ -382,6 +383,7 @@
+
@@ -390,7 +392,7 @@
-
+
diff --git a/gui/devices/1920x1200/res/ui.xml b/gui/devices/1920x1200/res/ui.xml
index dbd6a0b2..251c5fb6 100644
--- a/gui/devices/1920x1200/res/ui.xml
+++ b/gui/devices/1920x1200/res/ui.xml
@@ -102,6 +102,7 @@
+
@@ -382,6 +383,7 @@
+
@@ -390,7 +392,7 @@
-
+
diff --git a/gui/devices/2560x1600/res/ui.xml b/gui/devices/2560x1600/res/ui.xml
index 0a501afc..5344de20 100644
--- a/gui/devices/2560x1600/res/ui.xml
+++ b/gui/devices/2560x1600/res/ui.xml
@@ -102,6 +102,7 @@
+
@@ -382,6 +383,7 @@
+
@@ -390,7 +392,7 @@
-
+
diff --git a/gui/devices/320x480/res/ui.xml b/gui/devices/320x480/res/ui.xml
index 3c3b73d2..5b6fa02b 100644
--- a/gui/devices/320x480/res/ui.xml
+++ b/gui/devices/320x480/res/ui.xml
@@ -97,6 +97,7 @@
+
@@ -355,6 +356,7 @@
+
@@ -363,7 +365,7 @@
-
+
diff --git a/gui/devices/480x800/res/ui.xml b/gui/devices/480x800/res/ui.xml
index 32c90d93..be2db8f9 100644
--- a/gui/devices/480x800/res/ui.xml
+++ b/gui/devices/480x800/res/ui.xml
@@ -97,6 +97,7 @@
+
@@ -355,6 +356,7 @@
+
@@ -363,7 +365,7 @@
-
+
diff --git a/gui/devices/480x854/res/ui.xml b/gui/devices/480x854/res/ui.xml
index a8357703..42e6749e 100644
--- a/gui/devices/480x854/res/ui.xml
+++ b/gui/devices/480x854/res/ui.xml
@@ -96,6 +96,7 @@
+
@@ -354,6 +355,7 @@
+
@@ -362,7 +364,7 @@
-
+
diff --git a/gui/devices/540x960/res/ui.xml b/gui/devices/540x960/res/ui.xml
index 0a43bebc..a60fb3db 100644
--- a/gui/devices/540x960/res/ui.xml
+++ b/gui/devices/540x960/res/ui.xml
@@ -97,6 +97,7 @@
+
@@ -355,6 +356,7 @@
+
@@ -363,7 +365,7 @@
-
+
diff --git a/gui/devices/720x1280/res/ui.xml b/gui/devices/720x1280/res/ui.xml
index 37003da4..2cdd966c 100644
--- a/gui/devices/720x1280/res/ui.xml
+++ b/gui/devices/720x1280/res/ui.xml
@@ -101,6 +101,7 @@
+
@@ -368,6 +369,7 @@
+
@@ -376,7 +378,7 @@
-
+
diff --git a/gui/devices/800x1280/res/ui.xml b/gui/devices/800x1280/res/ui.xml
index 31006e6f..fffe31cd 100755
--- a/gui/devices/800x1280/res/ui.xml
+++ b/gui/devices/800x1280/res/ui.xml
@@ -97,6 +97,7 @@
+
@@ -356,6 +357,7 @@
+
@@ -364,7 +366,7 @@
-
+
diff --git a/gui/devices/800x480/res/ui.xml b/gui/devices/800x480/res/ui.xml
index 8f881d77..35ca6e27 100755
--- a/gui/devices/800x480/res/ui.xml
+++ b/gui/devices/800x480/res/ui.xml
@@ -102,6 +102,7 @@
+
@@ -390,6 +391,7 @@
+
@@ -398,7 +400,7 @@
-
+
diff --git a/gui/keyboard.cpp b/gui/keyboard.cpp
index 78e27a16..bb52d55f 100644
--- a/gui/keyboard.cpp
+++ b/gui/keyboard.cpp
@@ -47,7 +47,7 @@ GUIKeyboard::GUIKeyboard(xml_node<>* node)
{
int layoutindex, rowindex, keyindex, Xindex, Yindex, keyHeight = 0, keyWidth = 0;
rowY = colX = -1;
- highlightRenderCount = hasHighlight = 0;
+ highlightRenderCount = hasHighlight = hasCapsHighlight = 0;
char resource[10], layout[8], row[5], key[6], longpress[7];
xml_attribute<>* attr;
xml_node<>* child;
@@ -82,6 +82,17 @@ GUIKeyboard::GUIKeyboard(xml_node<>* node)
}
}
+ memset(&mCapsHighlightColor, 0, sizeof(COLOR));
+ child = node->first_node("capshighlight");
+ if (child) {
+ attr = child->first_attribute("color");
+ if (attr) {
+ hasCapsHighlight = 1;
+ std::string color = attr->value();
+ ConvertStrToColor(color, &mCapsHighlightColor);
+ }
+ }
+
// Load the images for the different layouts
child = node->first_node("layout");
if (child)
@@ -128,6 +139,16 @@ GUIKeyboard::GUIKeyboard(xml_node<>* node)
keyWidth = atoi(attr->value());
else
keyWidth = 0;
+ attr = child->first_attribute("capslock");
+ if (attr)
+ caps_tracking[layoutindex - 1].capslock = atoi(attr->value());
+ else
+ caps_tracking[layoutindex - 1].capslock = 1;
+ attr = child->first_attribute("revert_layout");
+ if (attr)
+ caps_tracking[layoutindex - 1].revert_layout = atoi(attr->value());
+ else
+ caps_tracking[layoutindex - 1].revert_layout = -1;
}
rowindex = 1;
@@ -320,6 +341,30 @@ int GUIKeyboard::Render(void)
if (keyboardImg[currentLayout - 1] && keyboardImg[currentLayout - 1]->GetResource())
gr_blit(keyboardImg[currentLayout - 1]->GetResource(), 0, 0, KeyboardWidth, KeyboardHeight, mRenderX, mRenderY);
+ // Draw highlight for capslock
+ if (hasCapsHighlight && caps_tracking[currentLayout - 1].capslock == 0 && caps_tracking[currentLayout - 1].set_capslock) {
+ int boxheight, boxwidth, x;
+ gr_color(mCapsHighlightColor.red, mCapsHighlightColor.green, mCapsHighlightColor.blue, mCapsHighlightColor.alpha);
+ for (int indexy=0; indexy 0) {
// Regular key
PageManager::NotifyKeyboard(keyboard_keys[currentLayout - 1][rowIndex][indexx].key);
+ if (caps_tracking[currentLayout - 1].capslock == 0 && !caps_tracking[currentLayout - 1].set_capslock) {
+ // caps lock was not set, change layouts
+ currentLayout = caps_tracking[currentLayout - 1].revert_layout;
+ mRendered = false;
+ }
} else if ((int)keyboard_keys[currentLayout - 1][rowIndex][indexx].key == KEYBOARD_LAYOUT) {
// Switch layouts
- currentLayout = keyboard_keys[currentLayout - 1][rowIndex][indexx].layout;
+ if (caps_tracking[currentLayout - 1].capslock == 0 && keyboard_keys[currentLayout - 1][rowIndex][indexx].layout == caps_tracking[currentLayout - 1].revert_layout) {
+ if (!caps_tracking[currentLayout - 1].set_capslock) {
+ caps_tracking[currentLayout - 1].set_capslock = 1; // Set the caps lock
+ } else {
+ caps_tracking[currentLayout - 1].set_capslock = 0; // Unset the caps lock and change layouts
+ currentLayout = keyboard_keys[currentLayout - 1][rowIndex][indexx].layout;
+ }
+ } else {
+ currentLayout = keyboard_keys[currentLayout - 1][rowIndex][indexx].layout;
+ }
mRendered = false;
} else if ((int)keyboard_keys[currentLayout - 1][rowIndex][indexx].key == KEYBOARD_ACTION) {
// Action
diff --git a/gui/objects.hpp b/gui/objects.hpp
index 472d23b4..f8a4e8ca 100644
--- a/gui/objects.hpp
+++ b/gui/objects.hpp
@@ -828,18 +828,26 @@ protected:
unsigned int end_x;
unsigned int layout;
};
+ struct capslock_tracking_struct
+ {
+ int capslock;
+ int set_capslock;
+ int revert_layout;
+ };
Resource* keyboardImg[MAX_KEYBOARD_LAYOUTS];
struct keyboard_key_class keyboard_keys[MAX_KEYBOARD_LAYOUTS][MAX_KEYBOARD_ROWS][MAX_KEYBOARD_KEYS];
+ 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];
unsigned int KeyboardWidth, KeyboardHeight;
- int rowY, colX, highlightRenderCount, hasHighlight;
+ int rowY, colX, highlightRenderCount, hasHighlight, hasCapsHighlight;
GUIAction* mAction;
COLOR mHighlightColor;
+ COLOR mCapsHighlightColor;
};
// GUIInput - Used for keyboard input