summaryrefslogtreecommitdiffstats
path: root/src/VButton.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2021-03-24 13:10:47 +0900
committerMichele Calgaro <[email protected]>2021-03-24 13:10:47 +0900
commite1effdcc817fb362f0a842e3e4b03708c4eaccf1 (patch)
treed416ba7868a662cc256f5f1c577e1812c9a14409 /src/VButton.cpp
parentb1c1fd93a72134d2e450301926d0121a8f73529b (diff)
downloadkvkbd-e1effdcc817fb362f0a842e3e4b03708c4eaccf1.tar.gz
kvkbd-e1effdcc817fb362f0a842e3e4b03708c4eaccf1.zip
VButton key text code refactoring.
Signed-off-by: Michele Calgaro <[email protected]>
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)