From e1effdcc817fb362f0a842e3e4b03708c4eaccf1 Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Wed, 24 Mar 2021 13:10:47 +0900 Subject: VButton key text code refactoring. Signed-off-by: Michele Calgaro --- src/VButton.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'src/VButton.cpp') 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 #include #include +#include "Xutils.h" +#include + 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) -- cgit v1.2.3