Fix keycodes for evdev mapping

Add LSGT key for non-US keyboards
Add RWIN key - set both Win keys to non-toggle for xmodmap use
Show ampersand when on lower level of key
Fix Num pad numbers keycodes where 0-9 are not on lower level of keyboard key
Abbreviate num pad keys text
Fix size of keys for keyboard right side alignment
Represent dead_key characters on the keys
Use icons for quit and num pad show/hide buttons
Resize quit, num pad show/hide, configure buttons
Add a tooltip for the panel icon
Set keyboard colour [fixed at #cdc0b0 in the patch]
Set key/button colour [fixed at #f0f0f0 in the patch]
Add Lock on screen code from v0.5
Revise the Caps and Shift lock algorithms
Move the setFocusPolicy in MainWidget::MainWidget
Fix font auto resize when the num pad is clicked into view

Signed-off-by: Ray-V <ray-v@inbox.lv>
pull/9/head
Ray-V 4 years ago
parent 2a5540d0da
commit 95b50f9473

@ -16,7 +16,6 @@ Features include:
* dynamic detection of languages
* Auto font resize
* button repeat
* CSS Color themes
CONTRIBUTING

@ -4,7 +4,7 @@ DragWidget::DragWidget(TQWidget *parent, const char *name, WFlags f) : TQWidget(
{
dragP=TQPoint(0,0);
drag=false;
locked=false;
}
DragWidget::~DragWidget()
{
@ -15,6 +15,7 @@ void DragWidget::mousePressEvent(TQMouseEvent *e)
{
dragP=e->pos();
gpress=e->globalPos();
if (locked)return;
drag=true;
}
@ -33,4 +34,14 @@ void DragWidget::mouseMoveEvent(TQMouseEvent *e)
}
void DragWidget::setLocked(bool mode)
{
locked=mode;
}
const bool DragWidget::isLocked() const
{
return locked;
}
#include "DragWidget.moc"

@ -12,6 +12,9 @@ public:
DragWidget(TQWidget *parent=0, const char *name="", WFlags f=0);
virtual ~DragWidget();
void setLocked(bool mode);
const bool isLocked() const;
private:
bool drag;
@ -22,6 +25,7 @@ protected:
void mouseReleaseEvent ( TQMouseEvent * e );
TQPoint dragP;
TQPoint gpress;
bool locked;
};

@ -43,7 +43,7 @@
#define R1LEN 13
#define R2LEN 10
#define R3LEN 9
#define R4LEN 7
#define R4LEN 8
bool shutting=false;
@ -69,14 +69,17 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
//TQString k3s="ASDFGHJKL";
unsigned int kc3[R3LEN] = {38,39,40,41,42,43,44,45,46}; //,{47,48};
//TQString k4="zxcvbnm"; //,./";
//TQString k4s="ZXCVBNM";
unsigned int kc4[R4LEN] = {52,53,54,55,56,57,58};//59,60,61};
//TQString k4="<zxcvbnm"; //,./";
//TQString k4s=">ZXCVBNM";
unsigned int kc4[R4LEN] = {94,52,53,54,55,56,57,58};//59,60,61};
int stx=15;
int stx=16;
int sty=15;
extent_visible=false;
setPaletteBackgroundColor ( TQColor("#cdc0b0") );
setFocusPolicy ( TQ_NoFocus );
// resize ( 550,235 );
// move(0,0);
@ -94,7 +97,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
VButton *f = new VButton ( this,"" );
f->setKeyCode ( 67+a );
f->setText ( "F"+TQString ( "%1" ).arg ( a+1 ) );
f->move ( stx+esc->width() + ( 35*a ) +20,sty );
f->move ( stx+esc->width() +30 + ( 35*a ),sty );
f->res();
other_keys.append(f);
connect ( f,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) );
@ -104,7 +107,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
VButton *f = new VButton ( this,"" );
f->setKeyCode ( 71+a );
f->setText ( "F"+TQString ( "%1" ).arg ( a+5 ) );
f->move ( stx+esc->width() + ( 35*a ) +40+ ( 4*35 ),sty );
f->move ( stx+esc->width() +30 + ( 4*35 ) +14 + ( 35*a ),sty );
f->res();
other_keys.append(f);
connect ( f,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) );
@ -115,7 +118,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
f->setKeyCode ( 75+a );
if ( a>1 ) f->setKeyCode ( 93+a );
f->setText ( "F"+TQString ( "%1" ).arg ( a+9 ) );
f->move ( stx+esc->width() + ( 35*a ) +45+ ( 8*35 ) +10,sty );
f->move ( stx+esc->width() +30 + ( 8*35 ) +28 + ( 35*a ),sty );
f->res();
other_keys.append(f);
connect ( f,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) );
@ -136,7 +139,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
VButton *bksp = new VButton ( this,"" );
bksp->setKeyCode ( 22 );
bksp->move ( stx+ ( R1LEN *35 ),sty+35 );
bksp->resize ( 46,30 );
bksp->resize ( 48,30 );
bksp->setText ( "Bksp" );
bksp->res();
other_keys.append(bksp);
@ -146,7 +149,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
VButton *tab = new VButton ( this,"" );
tab->setKeyCode ( 23 );
tab->move ( stx,sty+35+35 );
tab->resize ( 47,30 );
tab->resize ( 48,30 );
tab->setText ( "Tab" );
tab->res();
other_keys.append(tab);
@ -217,7 +220,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
}
VButton *smcl = new VButton ( this,"" );
smcl->setKeyCode ( 47 );
smcl->move ( stx+ ( R3LEN *35 ) +caps->width() +5,sty+ ( 3*35 ) );
smcl->move ( stx+caps->width() +5+ ( R3LEN *35 ) ,sty+ ( 3*35 ) );
//smcl->setText ( ";" );
//smcl->setShiftText ( ":" );
connect ( smcl,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) );
@ -226,7 +229,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
VButton *sngq = new VButton ( this,"" );
sngq->setKeyCode ( 48 );
sngq->move ( stx+ ( ( R3LEN +1 ) *35 ) +caps->width() +5,sty+ ( 3*35 ) );
sngq->move ( stx+caps->width() +5+ ( ( R3LEN +1 ) *35 ) ,sty+ ( 3*35 ) );
//sngq->setText ( "'" );
//sngq->setShiftText ( "\"" );
connect ( sngq,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) );
@ -235,7 +238,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
VButton *enter = new VButton ( this,"" );
enter->setKeyCode ( 36 );
enter->move ( stx+ ( ( R3LEN +2 ) *35 ) +caps->width() +5,sty+ ( 3*35 ) );
enter->move ( stx+caps->width() +5+ ( ( R3LEN +2 ) *35 ) ,sty+ ( 3*35 ) );
enter->resize ( 50,30 );
enter->setText ( "Enter" );
connect ( enter,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) );
@ -246,7 +249,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
lshft = new VButton ( this,"" );
lshft->setKeyCode ( 50 );
lshft->move ( stx,sty+ ( 4*35 ) );
lshft->resize ( 80,30 );
lshft->resize ( 45,30 );
lshft->setText ( "Shift" );
lshft->setToggleButton ( true );
connect ( lshft,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( toggleShift() ) );
@ -259,7 +262,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
v->setKeyCode ( kc4[a] );
//v->setText ( k4.mid ( a,1 ) );
//v->setShiftText ( k4s.mid ( a,1 ) );
v->move ( stx+35+16+35+ ( 35*a ),sty+ ( 4*35 ) );
v->move ( stx+lshft->width() +5+ ( 35*a ),sty+ ( 4*35 ) );
btns.append ( v );
v->res();
connect ( v,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) );
@ -267,7 +270,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
VButton *sm = new VButton ( this,"" );
sm->setKeyCode ( 59 );
sm->move ( stx+ ( R4LEN *35 ) +lshft->width() +5,sty+ ( 4*35 ) );
sm->move ( stx+lshft->width() +5+ ( R4LEN *35 ) ,sty+ ( 4*35 ) );
//sm->setText ( "," );
//sm->setShiftText ( "<" );
connect ( sm,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) );
@ -276,7 +279,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
VButton *gr = new VButton ( this,"" );
gr->setKeyCode ( 60 );
gr->move ( stx+ ( ( R4LEN +1 ) *35 ) +lshft->width() +5,sty+ ( 4*35 ) );
gr->move ( stx+lshft->width() +5+ ( ( R4LEN +1 ) *35 ) ,sty+ ( 4*35 ) );
//gr->setText ( "." );
//gr->setShiftText ( ">" );
connect ( gr,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) );
@ -285,7 +288,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
VButton *sl = new VButton ( this,"" );
sl->setKeyCode ( 61 );
sl->move ( stx+ ( ( R4LEN +2 ) *35 ) +lshft->width() +5,sty+ ( 4*35 ) );
sl->move ( stx+lshft->width() +5+ ( ( R4LEN +2 ) *35 ) ,sty+ ( 4*35 ) );
//sl->setText ( "/" );
//sl->setShiftText ( "?" );
connect ( sl,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) );
@ -293,8 +296,8 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
sl->res();
rshft = new VButton ( this,"" );
rshft->setKeyCode ( 50 );
rshft->move ( stx+ ( ( R4LEN +3 ) *35 ) +lshft->width() +5,sty+ ( 4*35 ) );
rshft->setKeyCode ( 62 );
rshft->move ( stx+lshft->width() +5+ ( ( R4LEN +3 ) *35 ) ,sty+ ( 4*35 ) );
rshft->resize ( 68,30 );
rshft->setText ( "Shift" );
rshft->setToggleButton ( true );
@ -303,7 +306,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
rshft->res();
//ROW 5
lctrl = new VButton ( this,"" );
lctrl->resize ( 45,30 );
lctrl->move ( stx, sty+ ( 5*35 ) );
@ -315,18 +318,19 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
win = new VButton ( this,"" );
win->resize ( 45,30 );
win->move ( 5+lctrl->x() +lctrl->width(), sty+ ( 5*35 ) );
win->setText ( "Win" );
win->setKeyCode ( 115 );
win->setToggleButton ( true );
mod_keys.append ( win );
win->resize ( 50,30 );
win->move ( lctrl->x() +lctrl->width() +5, sty+ ( 5*35 ) );
win->setText ( "LWin" );
win->setKeyCode ( 133 );
win->setToggleButton ( false );
connect ( win, TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) );
other_keys.append( win );
win->res();
lalt = new VButton ( this,"" );
lalt->resize ( 45,30 );
lalt->move ( 5+win->x() +win->width(), sty+ ( 5*35 ) );
lalt->move ( win->x() +win->width() +5, sty+ ( 5*35 ) );
lalt->setText ( "Alt" );
lalt->setKeyCode ( 64 );
lalt->setToggleButton ( true );
@ -336,27 +340,37 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
VButton *space = new VButton ( this,"" );
space->setKeyCode ( 65 );
space->resize ( 5*35+28,30 );
space->move ( 5+lalt->x() +lalt->width(),sty+ ( 5*35 ) );
space->resize ( 133,30 );
space->move ( lalt->x() +lalt->width() +5, sty+ ( 5*35 ) );
connect ( space, TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) );
space->res();
other_keys.append(space);
ralt = new VButton ( this,"" );
ralt->resize ( 45,30 );
ralt->move ( 5+space->x() +space->width(), sty+ ( 5*35 ) );
ralt->resize ( 50,30 );
ralt->move ( space->x() +space->width() +5, sty+ ( 5*35 ) );
ralt->setText ( "AltGr" );
ralt->setKeyCode ( 113 );
ralt->setKeyCode ( 108 );
ralt->setToggleButton ( true );
mod_keys.append ( ralt );
ralt->res();
rwin = new VButton ( this,"" );
rwin->resize ( 50,30 );
rwin->move ( ralt->x() +ralt->width() +5, sty+ ( 5*35 ) );
rwin->setText ( "RWin" );
rwin->setKeyCode ( 134 );
rwin->setToggleButton ( false );
connect ( rwin, TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) );
other_keys.append( rwin );
rwin->res();
mnu = new VButton ( this,"" );
mnu->resize ( 45,30 );
mnu->move ( 5+ralt->x() +ralt->width(), sty+ ( 5*35 ) );
mnu->resize ( 50,30 );
mnu->move ( rwin->x() +rwin->width() +5, sty+ ( 5*35 ) );
mnu->setText ( "Menu" );
mnu->setKeyCode ( 117 );
mnu->setKeyCode ( 135 );
mnu->setToggleButton ( false );
connect ( mnu, TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) );
other_keys.append(mnu);
@ -365,9 +379,9 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
rctrl = new VButton ( this,"" );
rctrl->resize ( 45,30 );
rctrl->move ( 5+mnu->x() +mnu->width(), sty+ ( 5*35 ) );
rctrl->move ( mnu->x() +mnu->width() +5, sty+ ( 5*35 ) );
rctrl->setText ( "Ctrl" );
rctrl->setKeyCode ( 37 );
rctrl->setKeyCode ( 105 );
rctrl->setToggleButton ( true );
mod_keys.append ( rctrl );
rctrl->res();
@ -375,17 +389,17 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
mappingNotify(NULL);
quit = new VButton ( this,"quit" );
quit->resize ( 15,30 );
quit->move ( 525,15 );
quit->setPaletteBackgroundColor ( TQt::red );
quit->resize ( 20,30 );
quit->move ( 526,15 );
quit->setPixmap(TQIconSet(SmallIcon("application-exit")).pixmap());
quit->res();
other_keys.append(quit);
connect ( quit,TQT_SIGNAL ( clicked() ),this, TQT_SLOT ( quitClicked() ) );
extent = new VButton(this,"extent");
extent->resize( 15,65 );
extent->move(525, 85 );
extent->setText(">>");
extent->resize ( 20,65 );
extent->move(526, 85 );
extent->setPixmap(TQIconSet(SmallIcon("media-seek-forward")).pixmap());
extent->res();
other_keys.append(extent);
connect (extent, TQT_SIGNAL( clicked() ) , this, TQT_SLOT ( toggleNumericPad() ) );
@ -394,17 +408,14 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
connect ( t, TQT_SIGNAL ( timeout() ), this, TQT_SLOT ( queryModState() ) );
t->start ( 500, FALSE );
setPaletteBackgroundColor ( TQt::black );
setFocusPolicy ( TQ_NoFocus );
int padx= 550;
TQString txt[9] = { "Ho\nme", TQString::fromUtf8(""), "Pg\nUp",
int padx= 553;
TQString txt[9] = { TQString::fromUtf8("H\u2190"), TQString::fromUtf8(""), TQString::fromUtf8("P\u2191"),
TQString::fromUtf8(""), " ", TQString::fromUtf8(""),
"End", TQString::fromUtf8(""), "Pg\nDn" };
TQString::fromUtf8("E\u2192"), TQString::fromUtf8(""), TQString::fromUtf8("P\u2193") };
TQString nump[9] = {"7","8","9","4","5","6","1","2","3"};
int val=0;
int nval[9] = {16,17,18,13,14,15,10,11,12};
int nval[9] = {79,80,81,83,84,85,87,88,89};
int cval[9] = {79,80,81,83,84,85,87,88,89};
for (int a=2;a<5;a++){
for (int b=0;b<3;b++){
@ -424,7 +435,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
ins->move(padx,sty+(5*35));
ins->res();
ins->setText("Ins");
ins->setKeyCode(19,90);
ins->setKeyCode(90,90);
ins->setShiftText("0");
numl_keys.append(ins);
@ -436,7 +447,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
del->res();
del->setText("Del");
del->setShiftText(".");
del->setKeyCode(60,91);
del->setKeyCode(91,91);
numl_keys.append(del);
connect ( del, TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) );
@ -445,7 +456,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
numl->setKeyCode(77);
numl->move(padx,sty+(1*35));
numl->res();
numl->setText("Num\nLock");
numl->setText(TQString::fromUtf8("\u2116"));
numl->setToggleButton ( true );
other_keys.append(numl);
connect ( numl, TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) );
@ -456,7 +467,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
div->move(padx+(35),sty+(1*35));
div->res();
div->setText("/");
div->setKeyCode(112);
div->setKeyCode(106);
other_keys.append(div);
connect ( div, TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) );
@ -473,7 +484,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
ent->move(padx+70+35,sty+(4*35));
ent->res();
ent->setText("Ent");
ent->setKeyCode(36);
ent->setKeyCode(104);
other_keys.append(ent);
connect ( ent, TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( keyPress ( unsigned int ) ) );
@ -517,6 +528,10 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
m->setItemChecked(mnu_dock, show_dock);
mnu_lock = m->insertItem("Lock on screen", this, TQT_SLOT(toggleLock()));
bool is_locked = cfg->readBoolEntry("locked",false);
m->setItemChecked(mnu_lock,is_locked);
//m->insertItem("Configure", this, TQT_SLOT(config()));
m->insertSeparator();
m->insertItem ( "Help", h->menu() );
@ -539,8 +554,8 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
setFont(fnt);
popup_menu = new VButton ( this,"popupmenu" );
popup_menu->resize ( 15,30 );
popup_menu->move ( 525,15+35 );
popup_menu->resize ( 20,30 );
popup_menu->move ( 526,15+35 );
//popup_menu->setPaletteBackgroundColor ( TQt::green );
popup_menu->res();
@ -581,7 +596,7 @@ void MainWidget::restorePosition()
TQDesktopWidget *desktop = TQApplication::desktop();
TQRect screen_geom = desktop->screenGeometry();
int d_width=550;
int d_width=552;
int d_height=235;
TQRect dflt_geom(screen_geom.width()-d_width,screen_geom.height()-d_height,d_width,d_height);
@ -627,17 +642,17 @@ void MainWidget::resizeEvent(TQResizeEvent * e)
if (extent_visible){
sdxb = width();
sdxs = width() - (width() * (150.0/700.0));
VButton::pw=700.0;
sdxs = width() - (width() * (150.0/702.0));
VButton::pw=702.0;
VButton::ph=235.0;
setMinimumSize(700/3,235/3);
setMinimumSize(702/3,235/3);
}
else{
sdxs = width();
sdxb = width() + (width() * (150.0/550.0));
VButton::pw=550.0;
sdxb = width() + (width() * (150.0/552.0));
VButton::pw=552.0;
VButton::ph=235.0;
setMinimumSize(550/3,235/3);
setMinimumSize(552/3,235/3);
}
for ( unsigned a=0;a<btns.size();a++ ){
@ -673,7 +688,10 @@ void MainWidget::updateFont()
TQFont fnt = this->font();
fnt.setWeight(TQFont::Bold);
//double rs = (100.0/700.0)*width();
double rp = (8.0/600.0)*width();
if (extent_visible) {
rp = (11.0/600.0)*width() * (552.0/702.0); }
else {
rp = (11.0/600.0)*width(); }
//fnt.setStretch(rs);
fnt.setPointSizeFloat(rp);
setFont(fnt);
@ -686,11 +704,11 @@ void MainWidget::toggleNumericPad()
if (extent_visible){
extent_visible=false;
TQWidget::resize ( (int)sdxs, height() );
extent->setText(">>");
extent->setPixmap(TQIconSet(SmallIcon("media-seek-forward")).pixmap());
}
else{
extent_visible=true;
extent->setText("<<");
extent->setPixmap(TQIconSet(SmallIcon("media-seek-backward")).pixmap());
TQWidget::resize ( (int)sdxb, height() );
}
nresize=false;
@ -729,6 +747,18 @@ void MainWidget::quitClicked()
else
hide();
}
void MainWidget::toggleLock()
{
bool c = isLocked();
tray->contextMenu()->setItemChecked ( mnu_lock, !c );
setLocked(!c);
TDEConfig *cfg = TDEApplication::kApplication()->config();
cfg->writeEntry ("locked", !c);
cfg->sync();
}
void MainWidget::showDock()
{
bool c = dock->isShown();
@ -876,30 +906,26 @@ void MainWidget::setupText(VButton& v)
{
KeyCode keycode=v.getKeyCode();
// first level character keysym
KeySym keysym_l = XkbKeycodeToKeysym(display, keycode, 0, 0);
// second level, ie shift, character keysym
KeySym keysym_s = XkbKeycodeToKeysym(display, keycode, 0, 1);
KeySym keysym_u = XkbKeycodeToKeysym(display, keycode, 0, 1);
long ret = keysym2ucs(keysym_l);
TQString btn_text(TQChar((uint)ret));
long retl = keysym2ucs(keysym_l);
v.setText(btn_text);
TQChar l((uint)retl);
if (l=='&')
v.setText("&&");
else
v.setText(l);
TQString btn_upper(btn_text.upper());
long rets = keysym2ucs(keysym_s);
if (btn_upper==btn_text) {
ret = keysym2ucs(keysym_u);
TQChar c((uint)ret);
if (c=='&')
TQChar s((uint)rets);
if (s=='&')
v.setShiftText("&&");
else
v.setShiftText(c);
}
else {
v.setShiftText(btn_upper);
}
v.setShiftText(s);
}
void MainWidget::mappingNotify(XMappingEvent *)
@ -926,7 +952,7 @@ KbdDock::KbdDock ( MainWidget *m )
setFocusPolicy ( TQ_NoFocus );
icn=UserIcon ( "dock" );
resize ( 96,47 );
resize ( 64,31 );
TQToolTip::add ( this, "Toggle keyboard visibility" );
}
@ -997,6 +1023,7 @@ struct codepair {
unsigned short keysym;
unsigned short ucs;
} keysymtab[] = {
{ 0x0000, 0x0020 }, /* NoSymbol -> <- space */
{ 0x01a1, 0x0104 }, /* Aogonek Ą LATIN CAPITAL LETTER A WITH OGONEK */
{ 0x01a2, 0x02d8 }, /* breve ˘ BREVE */
{ 0x01a3, 0x0141 }, /* Lstroke Ł LATIN CAPITAL LETTER L WITH STROKE */
@ -1235,6 +1262,7 @@ struct codepair {
{ 0x06aa, 0x045a }, /* Cyrillic_nje њ CYRILLIC SMALL LETTER NJE */
{ 0x06ab, 0x045b }, /* Serbian_tshe ћ CYRILLIC SMALL LETTER TSHE */
{ 0x06ac, 0x045c }, /* Macedonia_kje ќ CYRILLIC SMALL LETTER KJE */
{ 0x06ad, 0x0491 }, /* Ukrainian_ghe_with_upturn ґ CYRILLIC SMALL LETTER GHE WITH UPTURN */
{ 0x06ae, 0x045e }, /* Byelorussian_shortu ў CYRILLIC SMALL LETTER SHORT U */
{ 0x06af, 0x045f }, /* Cyrillic_dzhe џ CYRILLIC SMALL LETTER DZHE */
{ 0x06b0, 0x2116 }, /* numerosign № NUMERO SIGN */
@ -1250,6 +1278,7 @@ struct codepair {
{ 0x06ba, 0x040a }, /* Cyrillic_NJE Њ CYRILLIC CAPITAL LETTER NJE */
{ 0x06bb, 0x040b }, /* Serbian_TSHE Ћ CYRILLIC CAPITAL LETTER TSHE */
{ 0x06bc, 0x040c }, /* Macedonia_KJE Ќ CYRILLIC CAPITAL LETTER KJE */
{ 0x06bd, 0x0490 }, /* Ukrainian_GHE_WITH_UPTURN Ґ CYRILLIC CAPITAL LETTER GHE WITH UPTURN */
{ 0x06be, 0x040e }, /* Byelorussian_SHORTU Ў CYRILLIC CAPITAL LETTER SHORT U */
{ 0x06bf, 0x040f }, /* Cyrillic_DZHE Џ CYRILLIC CAPITAL LETTER DZHE */
{ 0x06c0, 0x044e }, /* Cyrillic_yu ю CYRILLIC SMALL LETTER YU */
@ -1770,6 +1799,22 @@ struct codepair {
{ 0x13bd, 0x0153 }, /* oe œ LATIN SMALL LIGATURE OE */
{ 0x13be, 0x0178 }, /* Ydiaeresis Ÿ LATIN CAPITAL LETTER Y WITH DIAERESIS */
{ 0x20ac, 0x20ac }, /* EuroSign € EURO SIGN */
{ 0xfe50, 0x0060 }, /* dead_grave \` */
{ 0xfe51, 0x00b4 }, /* dead_acute ´ */
{ 0xfe52, 0x02c6 }, /* dead_circumflex ˆ */
{ 0xfe53, 0x02dc }, /* dead_tilde ˜ small tilde */
{ 0xfe54, 0x00af }, /* dead_macron ¯ */
{ 0xfe55, 0x02d8 }, /* dead_breve ˘ */
{ 0xfe56, 0x02d9 }, /* dead_abovedot ˙ */
{ 0xfe57, 0x00a8 }, /* dead_diaeresis ¨ */
{ 0xfe58, 0x02da }, /* dead_abovering ° */
{ 0xfe59, 0x02dd }, /* dead_doubleacute ˝ */
{ 0xfe5a, 0x02c7 }, /* dead_caron ˇ */
{ 0xfe5b, 0x00b8 }, /* dead_cedilla ¸ */
{ 0xfe5c, 0x02db }, /* dead_ogonek ˛ */
{ 0xfe5d, 0x0269 }, /* dead_iota ɩ Latin small iota */
{ 0xfe64, 0x1fbf }, /* dead_abovecomma Greek Psili */
{ 0xfe65, 0x1ffe }, /* dead_abovereversedcomma Greek Dasia */
};
long MainWidget::keysym2ucs(KeySym keysym)
@ -1806,7 +1851,7 @@ long MainWidget::keysym2ucs(KeySym keysym)
KbdTray::KbdTray(TQWidget *parent, const char *name) : KSystemTray(parent,name)
{
TQToolTip::add ( this, "Virtual keyboard" );
}
void KbdTray::mousePressEvent(TQMouseEvent *e)
{

@ -67,6 +67,7 @@ public slots:
void showConfigMenu();
// void shutDown();
void saveState();
void toggleLock();
protected:
void resizeEvent(TQResizeEvent *e);
@ -94,6 +95,7 @@ private:
VButton *ralt;
VButton *win;
VButton *rwin;
VButton *mnu;
VButton *numl;
@ -126,8 +128,10 @@ private:
VButton *extent;
double sdxs;
double sdxb;
double rp;
int mnu_dock;
int mnu_autores;
int mnu_lock;
};

@ -2,13 +2,14 @@
#include <tqvbox.h>
#include <tqfont.h>
double VButton::pw=550.0;
double VButton::pw=552.0;
double VButton::ph=235.0;
VButton::VButton(TQWidget *parent, const char *name): TQPushButton (parent,name)
{
//connect(this,TQT_SIGNAL(clicked()),this,TQT_SLOT(sendKey()));
setPaletteBackgroundColor ( TQColor("#f0f0f0") );
setFocusPolicy(TQ_NoFocus);
resize(30,30);
press=false;
@ -20,35 +21,18 @@ VButton::~VButton()
}
void VButton::shiftPressed(bool press)
{
if (press==true){
TQString tu=l.upper();
if (tu.compare(l)==0){
//TQPushButton::setText(tu);
TQPushButton::setText(u);
}
else{
TQPushButton::setText(tu);
}
}
else{
if (press==true)
TQPushButton::setText(s);
else
TQPushButton::setText(l);
}
}
void VButton::capsPressed(bool press)
{
if (press==true){
if (press==true) {
TQString tu=l.upper();
if (tu.compare(l)==0){
TQPushButton::setText(tu);
}
else{
TQPushButton::setText(u);
}
}
else{
TQPushButton::setText(tu); }
else
TQPushButton::setText(l);
}
}
void VButton::setText(const TQString& text)
@ -58,7 +42,7 @@ void VButton::setText(const TQString& text)
}
void VButton::setShiftText(const TQString& text)
{
u=text;
s=text;
}
void VButton::setKeyCode(unsigned int keycode)

@ -29,7 +29,7 @@ private:
protected:
unsigned int keycode;
TQString u;
TQString s;
TQString l;
TQRect orig_size;
void timerEvent ( TQTimerEvent * );

@ -33,7 +33,7 @@ NumpadVButton::~NumpadVButton()
void NumpadVButton::numlockPressed(bool press)
{
if (press==true){
TQPushButton::setText(u);
TQPushButton::setText(s);
VButton::setKeyCode(numlock_code);
}
else{

@ -36,6 +36,7 @@ ResizableDragWidget::~ResizableDragWidget()
void ResizableDragWidget::mousePressEvent(TQMouseEvent * e)
{
if (locked)return;
TQPoint pos = e->pos();
if (pos.x()>width()-20 && pos.x()<width() && pos.y()>height()-20 && pos.y()<height() ) {

Loading…
Cancel
Save