[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-tohkbd2.changes
|
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-tohkbd2.spec
^
|
|
[-]
[+]
|
Changed |
_service
^
|
@@ -6,7 +6,7 @@
<service name="tar_git">
<param name="url">https://github.com/kimmoli/tohkbd2.git</param>
<param name="branch">master</param>
- <param name="revision">4cfe18044cf8ab8c3b7cf7d3732a35a9c9de170c</param>
+ <param name="revision">bd306f394f523fb40560ad26e28a277fed5d1183</param>
<param name="token"/>
<param name="debian">N</param>
<param name="dumb">N</param>
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-tohkbd2-0.5.23.tar.bz2/daemon/src/keymapping.cpp
^
|
@@ -31,6 +31,7 @@
layoutPath = QString();
alternativeLayout = QString();
originalLayout = QString();
+ keymapIsValid = false;
pressedCode = 0;
verboseMode = false;
@@ -61,6 +62,13 @@
void keymapping::process(QByteArray inputReport)
{
+ if (!keymapIsValid)
+ {
+ printf("Keymap is invalid, processing aborted.\n");
+ emit keymapInvalid();
+ return;
+ }
+
QList< QPair<int,int> > retKey;
char irCode = 0;
@@ -94,15 +102,19 @@
return;
}
- /* First check modifiers from modifier byte */
- if (inputReport.at(3) & 0x02) symDown = true;
- if (inputReport.at(3) & 0x08) ctrlDown = true;
- if (inputReport.at(3) & 0x10) leftShiftDown = true;
+ /* Translate modifier bytes to ir */
+ if (inputReport.at(3) & 0x02) ir.append(0xE0);
+ if (inputReport.at(3) & 0x08) ir.append(0xE2);
+ if (inputReport.at(3) & 0x10) ir.append(0xE3);
+
/* And other modifiers from the usage codes */
- if (ir.contains(0xEA)) { shiftDown = true; ir.remove(ir.indexOf(0xEA), 1); }
- if (ir.contains(0xCF)) { altDown = true; ir.remove(ir.indexOf(0xCF), 1); }
- if (ir.contains(0xBF)) { ctrlDown = true; ir.remove(ir.indexOf(0xBF), 1); }
- if (ir.contains(0xED)) { symDown = true; ir.remove(ir.indexOf(0xED), 1); }
+ if (ir.contains(0xE0)) { symDown = true; ir.remove(ir.indexOf(0xE0), 1); } /* Left Sym */
+ if (ir.contains(0xED)) { symDown = true; ir.remove(ir.indexOf(0xED), 1); } /* Right Sym */
+ if (ir.contains(0xE2)) { ctrlDown = true; ir.remove(ir.indexOf(0xE2), 1); } /* left Ctrl */
+ if (ir.contains(0xBF)) { ctrlDown = true; ir.remove(ir.indexOf(0xBF), 1); } /* Right Ctrl */
+ if (ir.contains(0xE3)) { leftShiftDown = true; ir.remove(ir.indexOf(0xE3), 1); } /* Left Shift */
+ if (ir.contains(0xEA)) { shiftDown = true; ir.remove(ir.indexOf(0xEA), 1); } /* Right Shift */
+ if (ir.contains(0xCF)) { altDown = true; ir.remove(ir.indexOf(0xCF), 1); } /* Right Alt */
/* Check space key here, it is a special case */
if ((inputReport.at(3) & 0x40) || (inputReport.at(3) & 0x80) || ir.contains(0xE9))
@@ -195,7 +207,7 @@
bool ret = true;
bool alternativeLayoutSet = false;
- if ((toLayout == layout) && !forceReload)
+ if ((toLayout == layout) && !forceReload && keymapIsValid)
return true;
if (forceReload && toLayout.isEmpty())
@@ -349,6 +361,8 @@
printf("keymap: failed to set layout to %s\n", qPrintable(toLayout));
}
+ keymapIsValid = ret;
+
return ret;
}
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-tohkbd2-0.5.23.tar.bz2/daemon/src/keymapping.h
^
|
@@ -42,6 +42,7 @@
bool setLayout(QString toLayout, bool forceReload = false);
bool verboseMode;
+ bool keymapIsValid;
signals:
void shiftChanged();
@@ -54,6 +55,7 @@
void bogusDetected();
void setKeymapVariant(QString keymapVariant);
void setKeymapLayout(QString keymapLayout);
+ void keymapInvalid();
public slots:
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-tohkbd2-0.5.23.tar.bz2/daemon/src/tohkeyboard.cpp
^
|
@@ -177,6 +177,7 @@
connect(keymap, SIGNAL(bogusDetected()), tca8424, SLOT(reset()));
connect(keymap, SIGNAL(setKeymapLayout(QString)), tohkbd2user, SLOT(setKeymapLayout(QString)));
connect(keymap, SIGNAL(setKeymapVariant(QString)), tohkbd2user, SLOT(setKeymapVariant(QString)));
+ connect(keymap, SIGNAL(keymapInvalid()), tohkbd2user, SLOT(showUnsupportedLayoutNotification()));
QString currentPhysicalLayout = tohkbd2user->getActivePhysicalLayout();
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-tohkbd2-0.5.23.tar.bz2/user-daemon/src/userdaemon.cpp
^
|
@@ -19,6 +19,10 @@
physicalLayout = new MGConfItem("/desktop/lipstick-jolla-home/layout");
connect(physicalLayout, SIGNAL(valueChanged()), this, SLOT(handlePhysicalLayout()));
+ unsupportedLayoutNotificationBlocker = new QTimer(this);
+ unsupportedLayoutNotificationBlocker->setSingleShot(true);
+ unsupportedLayoutNotificationBlocker->setInterval(15000);
+
/* Remove tohkbd from enabled layouts if vkb is hidden by maliit.
* The related PR is merged in maliit-framework and should be in 2.0 */
if (checkSailfishVersion("2.0.0.0"))
@@ -230,9 +234,15 @@
void UserDaemon::showUnsupportedLayoutNotification()
{
+ /* Do not spam with notifications */
+ if (unsupportedLayoutNotificationBlocker->isActive())
+ return;
+
//: Notification shown when a physical layout is not supported or the config file has an error. Notification text will scroll.
//% "The selected physical layout is not supported by TOHKBD2. Config file can also be invalid or missing."
showNotification(qtTrId("layout-unsupported"));
+
+ unsupportedLayoutNotificationBlocker->start();
}
void UserDaemon::installKeymaps(const bool &overwrite)
|
[-]
[+]
|
Changed |
_service:tar_git:harbour-ambience-tohkbd2-0.5.23.tar.bz2/user-daemon/src/userdaemon.h
^
|
@@ -61,6 +61,7 @@
bool m_dbusRegistered;
bool m_launchPending;
MGConfItem *physicalLayout;
+ QTimer *unsupportedLayoutNotificationBlocker;
};
#endif // UserDaemon_H
|