summaryrefslogtreecommitdiffstats
path: root/src/VButton.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <michele.calgaro@yahoo.it>2021-03-24 13:10:47 +0900
committerMichele Calgaro <michele.calgaro@yahoo.it>2021-03-24 13:11:15 +0900
commit930795987eb069d556ea7d2290afe68a720bacad (patch)
treeac564032c159e3af0c235b7408c0906cad9a768b /src/VButton.cpp
parent630dc679f1db5b25e669e97d2bc9fd4b3237cefd (diff)
downloadkvkbd-930795987eb069d556ea7d2290afe68a720bacad.tar.gz
kvkbd-930795987eb069d556ea7d2290afe68a720bacad.zip
VButton key text code refactoring.
Signed-off-by: Michele Calgaro <michele.calgaro@yahoo.it> (cherry picked from commit e1effdcc817fb362f0a842e3e4b03708c4eaccf1)
Diffstat (limited to 'src/VButton.cpp')
-rw-r--r--src/VButton.cpp30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/VButton.cpp b/src/VButton.cpp
index 41871cd..1959990 100644
--- a/src/VButton.cpp
+++ b/src/VButton.cpp
@@ -3,6 +3,9 @@
#include <tqfont.h>
#include <tdeconfig.h>
#include <tdeapplication.h>
+#include "Xutils.h"
+#include <X11/XKBlib.h>
+
double VButton::pw=552.0;
double VButton::ph=235.0;
@@ -21,6 +24,33 @@ VButton::~VButton()
{
}
+void VButton::setupTexts(Display *display)
+{
+ // normal text
+ KeySym keysym_c = XkbKeycodeToKeysym(display, keycode, 0, 0);
+ TQChar c((uint)keysym2ucs(keysym_c));
+ if (c == '&')
+ {
+ setText("&&");
+ }
+ else
+ {
+ setText(c);
+ }
+
+ // shift text
+ keysym_c = XkbKeycodeToKeysym(display, keycode, 0, 1);
+ c = (uint)keysym2ucs(keysym_c);
+ if (c == '&')
+ {
+ setShiftText("&&");
+ }
+ else
+ {
+ setShiftText(c);
+ }
+}
+
void VButton::shiftCapsPressed(bool shift, bool caps)
{
if (isAlpha)