summaryrefslogtreecommitdiffstats
path: root/src/MainWidget.cpp
diff options
context:
space:
mode:
authorMichele Calgaro <[email protected]>2021-03-25 10:01:12 +0900
committerMichele Calgaro <[email protected]>2021-03-26 13:18:54 +0900
commit85af0341dc94a5a65d3643f53d95c21d40017c1c (patch)
tree362b74dd24ca92b77265d8ff6c6a85c783258ce0 /src/MainWidget.cpp
parentc4eebbfcf4a070aef2ee77726cc45d9eb62ee235 (diff)
downloadkvkbd-85af0341dc94a5a65d3643f53d95c21d40017c1c.tar.gz
kvkbd-85af0341dc94a5a65d3643f53d95c21d40017c1c.zip
Added support for AltGr characters. This resolves issue #11.
Signed-off-by: Michele Calgaro <[email protected]>
Diffstat (limited to 'src/MainWidget.cpp')
-rw-r--r--src/MainWidget.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/MainWidget.cpp b/src/MainWidget.cpp
index c8558ae..076ebf7 100644
--- a/src/MainWidget.cpp
+++ b/src/MainWidget.cpp
@@ -197,7 +197,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
caps->resize ( 63,30 );
caps->setText ( "Caps" );
caps->setToggleButton ( true );
- connect ( caps,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( toggleShift ( unsigned int ) ) );
+ connect ( caps,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( toggleShiftCapsAltGr ( unsigned int ) ) );
other_keys.append(caps);
caps->res();
@@ -246,7 +246,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
lshift->resize ( 45,30 );
lshift->setText ( "Shift" );
lshift->setToggleButton ( true );
- connect ( lshift,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( toggleShift( unsigned int ) ) );
+ connect ( lshift,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( toggleShiftCapsAltGr( unsigned int ) ) );
mod_keys.append ( lshift );
lshift->res();
@@ -295,7 +295,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
rshift->resize ( 68,30 );
rshift->setText ( "Shift" );
rshift->setToggleButton ( true );
- connect ( rshift,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( toggleShift( unsigned int ) ) );
+ connect ( rshift,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( toggleShiftCapsAltGr( unsigned int ) ) );
mod_keys.append ( rshift );
rshift->res();
@@ -342,6 +342,7 @@ MainWidget::MainWidget ( TDEAboutData *about, bool tren, TQWidget *parent, const
ralt->setText ( "AltGr" );
ralt->setKeyCode ( 108 );
ralt->setToggleButton ( true );
+ connect ( ralt,TQT_SIGNAL ( keyClick ( unsigned int ) ), this, TQT_SLOT ( toggleShiftCapsAltGr ( unsigned int ) ) );
mod_keys.append ( ralt );
ralt->res();
@@ -849,19 +850,20 @@ void MainWidget::updateNumlock()
}
}
-void MainWidget::toggleShift(unsigned int keycode)
+void MainWidget::toggleShiftCapsAltGr(unsigned int keycode)
{
send_key(keycode);
- updateShiftCaps();
+ updateShiftCapsAltGr();
}
-void MainWidget::updateShiftCaps()
+void MainWidget::updateShiftCapsAltGr()
{
bool shiftState = lshift->isOn() || rshift->isOn();
bool capsState = caps->isOn();
+ bool altGrState = ralt->isOn();
for (unsigned a = 0; a < btns.size(); a++)
{
- btns[a]->shiftCapsPressed(shiftState, capsState);
+ btns[a]->shiftCapsAltGrPressed(shiftState, capsState, altGrState);
}
}
@@ -873,7 +875,7 @@ void MainWidget::keyPress(unsigned int a)
mod_keys[a]->setOn(false);
}
// Make sure the key labels are correctly updated
- updateShiftCaps();
+ updateShiftCapsAltGr();
}
void MainWidget::send_key(unsigned int keycode)
@@ -926,7 +928,7 @@ void MainWidget::queryModState()
if (caps_state != caps->isOn())
{
caps->setOn(caps_state);
- updateShiftCaps();
+ updateShiftCapsAltGr();
}
bool numl_state = keyState(XK_Num_Lock);
@@ -944,7 +946,7 @@ void MainWidget::mappingNotify(XMappingEvent *)
btns[a]->setupTexts(display);
}
updateNumlock();
- updateShiftCaps();
+ updateShiftCapsAltGr();
}
KbdDock::KbdDock ( MainWidget *m )