update changelog
This commit is contained in:
parent
633e38d091
commit
c4a880d25a
|
@ -1,3 +1,11 @@
|
|||
ukui-screensaver (3.22.1.3-ok11~0412) yangtze; urgency=medium
|
||||
|
||||
* BUG号:I5XFFQ 锁屏登入界面无键盘图标,无实体键盘时无法输入
|
||||
* 需求号:无
|
||||
* 其他修改说明:无
|
||||
|
||||
-- Yang Min <yangmin@kylinos.cn> Wed, 12 Apr 2023 14:48:36 +0800
|
||||
|
||||
ukui-screensaver (3.22.1.3-ok10~0412) yangtze; urgency=medium
|
||||
|
||||
* BUG号:136797 【虚拟机】【virtualbox】【锁屏】锁屏后锁屏页面时间与头像显示未对齐,登录页面正常
|
||||
|
|
|
@ -0,0 +1,813 @@
|
|||
From: winnerym <yangmin@kylinos.cn>
|
||||
Date: Wed, 12 Apr 2023 14:51:58 +0800
|
||||
Subject: update changelog
|
||||
|
||||
---
|
||||
BiometricAuth/biometricdeviceswidget.h | 9 +-
|
||||
BiometricAuth/main.cpp | 9 +-
|
||||
VirtualKeyboard/CMakeLists.txt | 4 +-
|
||||
VirtualKeyboard/src/fakekeyboard.h | 113 +++++++++++++++++
|
||||
VirtualKeyboard/src/keyboardwidget.cpp | 9 +-
|
||||
VirtualKeyboard/src/keyboardwidget.h | 4 +-
|
||||
VirtualKeyboard/src/main.cpp | 9 +-
|
||||
VirtualKeyboard/src/qtkeyboard.cpp | 221 +++++++++++++++++++++++++++++++++
|
||||
VirtualKeyboard/src/qtkeyboard.h | 48 +++++++
|
||||
VirtualKeyboard/src/x11keyboard.cpp | 6 +-
|
||||
VirtualKeyboard/src/x11keyboard.h | 71 +----------
|
||||
examples/LoadCustomPlugin/main.cpp | 17 +++
|
||||
examples/LoadCustomPlugin/widget.cpp | 19 ++-
|
||||
src/fullbackgroundwidget.cpp | 3 -
|
||||
src/lockwidget.cpp | 8 +-
|
||||
15 files changed, 449 insertions(+), 101 deletions(-)
|
||||
create mode 100644 VirtualKeyboard/src/fakekeyboard.h
|
||||
create mode 100644 VirtualKeyboard/src/qtkeyboard.cpp
|
||||
create mode 100644 VirtualKeyboard/src/qtkeyboard.h
|
||||
|
||||
diff --git a/BiometricAuth/biometricdeviceswidget.h b/BiometricAuth/biometricdeviceswidget.h
|
||||
index d606aef..bdef3da 100644
|
||||
--- a/BiometricAuth/biometricdeviceswidget.h
|
||||
+++ b/BiometricAuth/biometricdeviceswidget.h
|
||||
@@ -1,9 +1,9 @@
|
||||
-/**
|
||||
+/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
- * the Free Software Foundation; either version 2, or (at your option)
|
||||
+ * the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
@@ -12,9 +12,8 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
- * along with this program; if not, write to the Free Software
|
||||
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
- * 02110-1301, USA.
|
||||
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
+ *
|
||||
**/
|
||||
#ifndef BIOMETRICDEVICESWIDGET_H
|
||||
#define BIOMETRICDEVICESWIDGET_H
|
||||
diff --git a/BiometricAuth/main.cpp b/BiometricAuth/main.cpp
|
||||
index 6215ae1..cd780b5 100644
|
||||
--- a/BiometricAuth/main.cpp
|
||||
+++ b/BiometricAuth/main.cpp
|
||||
@@ -1,9 +1,9 @@
|
||||
-/**
|
||||
+/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
- * the Free Software Foundation; either version 2, or (at your option)
|
||||
+ * the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
@@ -12,9 +12,8 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
- * along with this program; if not, write to the Free Software
|
||||
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
- * 02110-1301, USA.
|
||||
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
+ *
|
||||
**/
|
||||
#include <QApplication>
|
||||
#include <QDebug>
|
||||
diff --git a/VirtualKeyboard/CMakeLists.txt b/VirtualKeyboard/CMakeLists.txt
|
||||
index 3c8a010..9f5355d 100644
|
||||
--- a/VirtualKeyboard/CMakeLists.txt
|
||||
+++ b/VirtualKeyboard/CMakeLists.txt
|
||||
@@ -9,6 +9,7 @@ qt5_add_resources(VirtualKeyboard_SRC
|
||||
|
||||
qt5_wrap_cpp(VirtualKeyboard_SRC
|
||||
src/vkstackedwidget.h
|
||||
+ src/fakekeyboard.h
|
||||
)
|
||||
|
||||
set(VirtualKeyboard_SRC
|
||||
@@ -17,6 +18,7 @@ set(VirtualKeyboard_SRC
|
||||
src/keyboardwidget.cpp
|
||||
src/virtualkeyboard.cpp
|
||||
src/x11keyboard.cpp
|
||||
+ src/qtkeyboard.cpp
|
||||
src/vkstackedwidget.cpp
|
||||
src/keyboard.qrc)
|
||||
|
||||
@@ -26,4 +28,4 @@ include_directories(
|
||||
)
|
||||
|
||||
add_library(VirtualKeyboard STATIC ${VirtualKeyboard_SRC})
|
||||
-target_link_libraries(VirtualKeyboard Qt5::Core Qt5::Widgets)
|
||||
+target_link_libraries(VirtualKeyboard Qt5::Core Qt5::Widgets Qt5::X11Extras)
|
||||
diff --git a/VirtualKeyboard/src/fakekeyboard.h b/VirtualKeyboard/src/fakekeyboard.h
|
||||
new file mode 100644
|
||||
index 0000000..7c29ce5
|
||||
--- /dev/null
|
||||
+++ b/VirtualKeyboard/src/fakekeyboard.h
|
||||
@@ -0,0 +1,113 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2023 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 3, or (at your option)
|
||||
+ * any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
+ *
|
||||
+**/
|
||||
+#ifndef FAKEKEYBOARD_H
|
||||
+#define FAKEKEYBOARD_H
|
||||
+
|
||||
+#include <QObject>
|
||||
+#include <QMetaEnum>
|
||||
+
|
||||
+class Modifier : public QObject
|
||||
+{
|
||||
+ Q_OBJECT
|
||||
+public:
|
||||
+ Modifier(){}
|
||||
+
|
||||
+ enum MOD{
|
||||
+ UNKNOWN = -1,
|
||||
+ CTRL,
|
||||
+ SHIFT,
|
||||
+ ALT,
|
||||
+ SUPER
|
||||
+ };
|
||||
+ Q_ENUM(MOD)
|
||||
+
|
||||
+ static QString getModifierName(int mod)
|
||||
+ {
|
||||
+ QMetaEnum metaEnum = QMetaEnum::fromType<Modifier::MOD>();
|
||||
+ const char* modName = metaEnum.valueToKey(mod);
|
||||
+ QString result = QString(modName).toLower();
|
||||
+ return result;
|
||||
+ }
|
||||
+ static MOD getModifier(const QString &modName)
|
||||
+ {
|
||||
+ QMetaEnum metaEnum = QMetaEnum::fromType<Modifier::MOD>();
|
||||
+ MOD mod = (MOD)metaEnum.keyToValue(modName.toUpper().toLocal8Bit().data());
|
||||
+ return mod;
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+class FuncKey : public QObject
|
||||
+{
|
||||
+ Q_OBJECT
|
||||
+public:
|
||||
+ FuncKey(){}
|
||||
+
|
||||
+ enum FUNCKEY {
|
||||
+ UNKNOWN = -1,
|
||||
+ SPACE = 0,
|
||||
+ BACKSPACE,
|
||||
+ ENTER,
|
||||
+ HOME,
|
||||
+ END,
|
||||
+ PGUP,
|
||||
+ PGDN,
|
||||
+ INSERT,
|
||||
+ DELETE,
|
||||
+ UP,
|
||||
+ DOWN,
|
||||
+ LEFT,
|
||||
+ RIGHT
|
||||
+ };
|
||||
+ Q_ENUM(FUNCKEY)
|
||||
+ static QString getKeyName(int key)
|
||||
+ {
|
||||
+ QMetaEnum metaEnum = QMetaEnum::fromType<FuncKey::FUNCKEY>();
|
||||
+ const char* keyName = metaEnum.valueToKey(key);
|
||||
+ QString result = QString(keyName).toLower();
|
||||
+ return result;
|
||||
+ }
|
||||
+ static FUNCKEY getKey(const QString &keyName)
|
||||
+ {
|
||||
+ QMetaEnum metaEnum = QMetaEnum::fromType<FuncKey::FUNCKEY>();
|
||||
+ FUNCKEY key = (FUNCKEY)metaEnum.keyToValue(keyName.toUpper().toLocal8Bit().data());
|
||||
+ return key;
|
||||
+ }
|
||||
+};
|
||||
+
|
||||
+class FakeKeyboard : public QObject
|
||||
+{
|
||||
+ Q_OBJECT
|
||||
+public:
|
||||
+ explicit FakeKeyboard(QObject *parent = nullptr)
|
||||
+ : QObject(parent)
|
||||
+ {
|
||||
+
|
||||
+ }
|
||||
+
|
||||
+ virtual void addModifier(Modifier::MOD mod) = 0;
|
||||
+ virtual void removeModifier(Modifier::MOD mod) = 0;
|
||||
+ virtual bool hasModifier(Modifier::MOD mod) = 0;
|
||||
+ virtual QList<Modifier::MOD> getAllModifier() = 0;
|
||||
+ virtual void clearModifier() = 0;
|
||||
+
|
||||
+public Q_SLOTS:
|
||||
+ virtual void onKeyPressed(QChar c) = 0;
|
||||
+ virtual void onKeyPressed(FuncKey::FUNCKEY key) = 0;
|
||||
+};
|
||||
+
|
||||
+#endif // FAKEKEYBOARD_H
|
||||
diff --git a/VirtualKeyboard/src/keyboardwidget.cpp b/VirtualKeyboard/src/keyboardwidget.cpp
|
||||
index be86698..a13adec 100644
|
||||
--- a/VirtualKeyboard/src/keyboardwidget.cpp
|
||||
+++ b/VirtualKeyboard/src/keyboardwidget.cpp
|
||||
@@ -20,6 +20,9 @@
|
||||
#include <QDebug>
|
||||
#include <QMap>
|
||||
#include <QVector>
|
||||
+#include <QX11Info>
|
||||
+#include "x11keyboard.h"
|
||||
+#include "qtkeyboard.h"
|
||||
|
||||
#define SYMBOL_KEY_COUNT 29
|
||||
#define SYMBOL_PAGE_COUNT 2
|
||||
@@ -46,7 +49,11 @@ KeyboardWidget::KeyboardWidget(QWidget *parent) :
|
||||
isShift(false),
|
||||
page(0)
|
||||
{
|
||||
- vKeyboard = new X11Keyboard(this);
|
||||
+ if(QX11Info::isPlatformX11()){
|
||||
+ vKeyboard = new X11Keyboard(this);
|
||||
+ }else{
|
||||
+ vKeyboard = new QtKeyboard(this);
|
||||
+ }
|
||||
connect(this, SIGNAL(keyPressed(QChar)),
|
||||
vKeyboard, SLOT(onKeyPressed(QChar)));
|
||||
connect(this, SIGNAL(keyPressed(FuncKey::FUNCKEY)),
|
||||
diff --git a/VirtualKeyboard/src/keyboardwidget.h b/VirtualKeyboard/src/keyboardwidget.h
|
||||
index d735ebd..c2f7a37 100644
|
||||
--- a/VirtualKeyboard/src/keyboardwidget.h
|
||||
+++ b/VirtualKeyboard/src/keyboardwidget.h
|
||||
@@ -21,7 +21,7 @@
|
||||
#include <QWidget>
|
||||
#include <QMap>
|
||||
#include <QTime>
|
||||
-#include "x11keyboard.h"
|
||||
+#include "fakekeyboard.h"
|
||||
|
||||
namespace Ui {
|
||||
class KeyboardWidget;
|
||||
@@ -70,7 +70,7 @@ private:
|
||||
bool isShift;
|
||||
QTime shiftLastClicked; //shift键上次被点击的时间
|
||||
int page; //当前是第几页的键盘
|
||||
- X11Keyboard *vKeyboard;
|
||||
+ FakeKeyboard *vKeyboard;
|
||||
};
|
||||
|
||||
#endif // KEYBOARDWIDGET_H
|
||||
diff --git a/VirtualKeyboard/src/main.cpp b/VirtualKeyboard/src/main.cpp
|
||||
index 99fc2f0..dbb84a0 100644
|
||||
--- a/VirtualKeyboard/src/main.cpp
|
||||
+++ b/VirtualKeyboard/src/main.cpp
|
||||
@@ -1,9 +1,9 @@
|
||||
-/**
|
||||
+/*
|
||||
* Copyright (C) 2018 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
- * the Free Software Foundation; either version 2, or (at your option)
|
||||
+ * the Free Software Foundation; either version 3, or (at your option)
|
||||
* any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
@@ -12,9 +12,8 @@
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
- * along with this program; if not, write to the Free Software
|
||||
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
|
||||
- * 02110-1301, USA.
|
||||
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
+ *
|
||||
**/
|
||||
#include "virtualkeyboard.h"
|
||||
#include <QApplication>
|
||||
diff --git a/VirtualKeyboard/src/qtkeyboard.cpp b/VirtualKeyboard/src/qtkeyboard.cpp
|
||||
new file mode 100644
|
||||
index 0000000..731b70e
|
||||
--- /dev/null
|
||||
+++ b/VirtualKeyboard/src/qtkeyboard.cpp
|
||||
@@ -0,0 +1,221 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2023 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 3, or (at your option)
|
||||
+ * any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
+ *
|
||||
+**/
|
||||
+#include "qtkeyboard.h"
|
||||
+#include <QDebug>
|
||||
+#include <QWidget>
|
||||
+#include <QKeyEvent>
|
||||
+#include <QDir>
|
||||
+#include <QApplication>
|
||||
+#include <QCoreApplication>
|
||||
+
|
||||
+QMap<QChar,int> m_specialSymbolMap = {
|
||||
+ {' ', Qt::Key_Space},
|
||||
+ {',', Qt::Key_Comma},
|
||||
+ {'.', Qt::Key_Period},
|
||||
+ {'\'', Qt::Key_QuoteLeft},
|
||||
+ {'@', Qt::Key_At},
|
||||
+ {'#', Qt::Key_NumberSign},
|
||||
+ {'$', Qt::Key_Dollar},
|
||||
+ {'%', Qt::Key_Percent},
|
||||
+ {'&', Qt::Key_Ampersand},
|
||||
+ {'*', Qt::Key_Asterisk},
|
||||
+ {'(', Qt::Key_ParenLeft},
|
||||
+ {')', Qt::Key_ParenRight},
|
||||
+ {'-', Qt::Key_Minus},
|
||||
+ {'+', Qt::Key_Plus},
|
||||
+ {'!', Qt::Key_Exclam},
|
||||
+ {'"', Qt::Key_QuoteDbl},
|
||||
+ {'<', Qt::Key_Less},
|
||||
+ {'>', Qt::Key_Greater},
|
||||
+ {':', Qt::Key_Colon},
|
||||
+ {';', Qt::Key_Semicolon},
|
||||
+ {'/', Qt::Key_Slash},
|
||||
+ {'?', Qt::Key_Question},
|
||||
+ {'=', Qt::Key_Equal},
|
||||
+ {'.', Qt::Key_Period}, /*XK_kana_middledot*/
|
||||
+ {'~', Qt::Key_AsciiTilde},
|
||||
+ {'`', Qt::Key_QuoteLeft},
|
||||
+ {'|', Qt::Key_Bar},
|
||||
+ {'^', Qt::Key_AsciiCircum},
|
||||
+ {'{', Qt::Key_BraceLeft},
|
||||
+ {'}', Qt::Key_BraceRight},
|
||||
+ {'[', Qt::Key_BracketLeft},
|
||||
+ {']', Qt::Key_BracketRight},
|
||||
+ {'_', Qt::Key_Underscore},
|
||||
+ {'\\', Qt::Key_Backslash},
|
||||
+};
|
||||
+
|
||||
+QMap<FuncKey::FUNCKEY, int> m_funckeyMap = {
|
||||
+ {FuncKey::SPACE, Qt::Key_Space},
|
||||
+ {FuncKey::BACKSPACE, Qt::Key_Backspace},
|
||||
+ {FuncKey::ENTER, Qt::Key_Enter},
|
||||
+ {FuncKey::HOME, Qt::Key_Home},
|
||||
+ {FuncKey::END, Qt::Key_End},
|
||||
+ {FuncKey::PGUP, Qt::Key_PageUp},
|
||||
+ {FuncKey::PGDN, Qt::Key_PageDown},
|
||||
+ {FuncKey::INSERT, Qt::Key_Insert},
|
||||
+ {FuncKey::DELETE, Qt::Key_Delete},
|
||||
+ {FuncKey::UP, Qt::Key_Up},
|
||||
+ {FuncKey::DOWN, Qt::Key_Down},
|
||||
+ {FuncKey::LEFT, Qt::Key_Left},
|
||||
+ {FuncKey::RIGHT, Qt::Key_Right}
|
||||
+};
|
||||
+
|
||||
+QMap<Modifier::MOD, Qt::KeyboardModifier> m_modifierMap = {
|
||||
+ {Modifier::CTRL, Qt::ControlModifier},
|
||||
+ {Modifier::ALT, Qt::AltModifier},
|
||||
+ {Modifier::SUPER, Qt::MetaModifier},
|
||||
+ {Modifier::SHIFT, Qt::ShiftModifier}
|
||||
+};
|
||||
+
|
||||
+QVector<QChar> m_shiftKeyVec = {'~', '!', '@', '#', '$', '%', '^', '&', '*',
|
||||
+ '(', ')', '_', '+', '{', '}', '|', ':', '"',
|
||||
+ '>', '?'};
|
||||
+
|
||||
+#define DRM_DIR "/sys/class/leds/"
|
||||
+#define CAPSLOCK_STATUS "capslock_state"
|
||||
+
|
||||
+/**
|
||||
+ * @brief 判断大写键状态
|
||||
+ * @return true: 大写锁定
|
||||
+ */
|
||||
+bool checkCapsLockState()
|
||||
+{
|
||||
+ QDir ledDir(DRM_DIR);
|
||||
+ QStringList leds = ledDir.entryList(QDir::Dirs);
|
||||
+ QString capsFile;
|
||||
+
|
||||
+ for(int i = 0;i<leds.count();i++){
|
||||
+ if(leds.at(i).contains("capslock"))
|
||||
+ capsFile = leds.at(i);
|
||||
+ }
|
||||
+ QFile drmStatusFile(DRM_DIR + capsFile + "/brightness");
|
||||
+ if(drmStatusFile.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
+ QTextStream in(&drmStatusFile);
|
||||
+ QString status = in.readLine();
|
||||
+
|
||||
+ if(status == "0") {
|
||||
+ return false;
|
||||
+ }else{
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return false;
|
||||
+}
|
||||
+
|
||||
+QtKeyboard::QtKeyboard(QObject *parent)
|
||||
+ : FakeKeyboard(parent)
|
||||
+{
|
||||
+
|
||||
+}
|
||||
+
|
||||
+QtKeyboard::~QtKeyboard()
|
||||
+{
|
||||
+
|
||||
+}
|
||||
+
|
||||
+void QtKeyboard::addModifier(Modifier::MOD mod)
|
||||
+{
|
||||
+ modList.push_back(mod);
|
||||
+}
|
||||
+
|
||||
+void QtKeyboard::removeModifier(Modifier::MOD mod)
|
||||
+{
|
||||
+ modList.removeOne(mod);
|
||||
+}
|
||||
+
|
||||
+bool QtKeyboard::hasModifier(Modifier::MOD mod)
|
||||
+{
|
||||
+ return modList.contains(mod);
|
||||
+}
|
||||
+
|
||||
+QList<Modifier::MOD> QtKeyboard::getAllModifier()
|
||||
+{
|
||||
+ return modList;
|
||||
+}
|
||||
+
|
||||
+void QtKeyboard::clearModifier()
|
||||
+{
|
||||
+ modList.clear();
|
||||
+}
|
||||
+
|
||||
+
|
||||
+void QtKeyboard::onKeyPressed(QChar c)
|
||||
+{
|
||||
+ /*判断大写锁定打开时,转换字母大小写状态,与x11keyboard类逻辑保持一致*/
|
||||
+ if(checkCapsLockState() && c.isLetter()){
|
||||
+ if(c.isUpper()){
|
||||
+ c = c.toLower();
|
||||
+ }
|
||||
+ else if(c.isLower()){
|
||||
+ c = c.toUpper();
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if(c>='A' && c<='Z'){
|
||||
+ sendKey(c.toLatin1(),c);
|
||||
+ }else if(c>='a' && c<='z'){
|
||||
+ sendKey(c.toLatin1() - 32,c);
|
||||
+ }else if(c >= '0' && c<='9'){
|
||||
+ sendKey(c.toLatin1(),c);
|
||||
+ }else if(m_specialSymbolMap.contains(c)){
|
||||
+ sendKey(m_specialSymbolMap[c],c);
|
||||
+ }else {
|
||||
+ sendKey(c.toLatin1(),c);
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void QtKeyboard::onKeyPressed(FuncKey::FUNCKEY key)
|
||||
+{
|
||||
+ int keysym = m_funckeyMap[key];
|
||||
+ /*这里的text根据实际按键得到的QEvent中的text内容打印*/
|
||||
+ if(key == FuncKey::SPACE){
|
||||
+ sendKey(keysym," ");
|
||||
+ }else if(key == FuncKey::BACKSPACE){
|
||||
+ sendKey(keysym,"\b");
|
||||
+ }else if(key == FuncKey::ENTER){
|
||||
+ sendKey(keysym,"\r");
|
||||
+ }else if(key == FuncKey::INSERT){
|
||||
+ sendKey(keysym,"\u007F");
|
||||
+ }else{
|
||||
+ sendKey(keysym,"");
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+void QtKeyboard::sendKey(const unsigned int keysym,const QString text)
|
||||
+{
|
||||
+ Qt::KeyboardModifiers modifier = Qt::NoModifier;
|
||||
+ for(auto mod : modList){
|
||||
+ modifier = modifier | m_modifierMap[mod];
|
||||
+ }
|
||||
+
|
||||
+ QWidget *objfous = QApplication::focusWidget();
|
||||
+
|
||||
+ if(objfous){
|
||||
+ QKeyEvent event1(QEvent::KeyPress, keysym
|
||||
+ , modifier, text
|
||||
+ , true, 1);
|
||||
+ QKeyEvent event2(QEvent::KeyRelease, keysym
|
||||
+ , modifier, text
|
||||
+ , true, 1);
|
||||
+ QCoreApplication::sendEvent(objfous, &event1);
|
||||
+ QCoreApplication::sendEvent(objfous, &event2);
|
||||
+ }
|
||||
+
|
||||
+}
|
||||
diff --git a/VirtualKeyboard/src/qtkeyboard.h b/VirtualKeyboard/src/qtkeyboard.h
|
||||
new file mode 100644
|
||||
index 0000000..fed4508
|
||||
--- /dev/null
|
||||
+++ b/VirtualKeyboard/src/qtkeyboard.h
|
||||
@@ -0,0 +1,48 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2023 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 3, or (at your option)
|
||||
+ * any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
+ *
|
||||
+**/
|
||||
+#ifndef QTKEYBOARD_H
|
||||
+#define QTKEYBOARD_H
|
||||
+
|
||||
+#include <QObject>
|
||||
+#include <QMetaEnum>
|
||||
+#include "fakekeyboard.h"
|
||||
+
|
||||
+class QtKeyboard : public FakeKeyboard
|
||||
+{
|
||||
+ Q_OBJECT
|
||||
+public:
|
||||
+ explicit QtKeyboard(QObject *parent = nullptr);
|
||||
+ ~QtKeyboard();
|
||||
+ void addModifier(Modifier::MOD mod);
|
||||
+ void removeModifier(Modifier::MOD mod);
|
||||
+ bool hasModifier(Modifier::MOD mod);
|
||||
+ QList<Modifier::MOD> getAllModifier();
|
||||
+ void clearModifier();
|
||||
+
|
||||
+public Q_SLOTS:
|
||||
+ void onKeyPressed(QChar c);
|
||||
+ void onKeyPressed(FuncKey::FUNCKEY key);
|
||||
+
|
||||
+private:
|
||||
+ void sendKey(const unsigned int keyCode,const QString text);
|
||||
+
|
||||
+private:
|
||||
+ QList<Modifier::MOD> modList;
|
||||
+};
|
||||
+
|
||||
+#endif // QTKEYBOARD_H
|
||||
diff --git a/VirtualKeyboard/src/x11keyboard.cpp b/VirtualKeyboard/src/x11keyboard.cpp
|
||||
index 02a196a..25b36d8 100644
|
||||
--- a/VirtualKeyboard/src/x11keyboard.cpp
|
||||
+++ b/VirtualKeyboard/src/x11keyboard.cpp
|
||||
@@ -21,8 +21,6 @@
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/extensions/XTest.h>
|
||||
|
||||
-
|
||||
-
|
||||
struct CharMap {
|
||||
QChar name;
|
||||
KeySym code;
|
||||
@@ -35,7 +33,7 @@ struct CharMap XSpecialSymbolMap[] {
|
||||
{'\'', XK_quoteright},
|
||||
{'@', XK_at},
|
||||
{'#', XK_numbersign},
|
||||
- {'$', XK_dollar},
|
||||
+ {'$', XK_dollar},
|
||||
{'%', XK_percent},
|
||||
{'&', XK_ampersand},
|
||||
{'*', XK_asterisk},
|
||||
@@ -122,7 +120,7 @@ unsigned int keyCodeOfChar(QChar c)
|
||||
}
|
||||
|
||||
X11Keyboard::X11Keyboard(QObject *parent)
|
||||
- : QObject(parent)
|
||||
+ : FakeKeyboard(parent)
|
||||
{
|
||||
|
||||
}
|
||||
diff --git a/VirtualKeyboard/src/x11keyboard.h b/VirtualKeyboard/src/x11keyboard.h
|
||||
index f3bf757..9914019 100644
|
||||
--- a/VirtualKeyboard/src/x11keyboard.h
|
||||
+++ b/VirtualKeyboard/src/x11keyboard.h
|
||||
@@ -20,76 +20,9 @@
|
||||
|
||||
#include <QObject>
|
||||
#include <QMetaEnum>
|
||||
+#include "fakekeyboard.h"
|
||||
|
||||
-class Modifier : public QObject
|
||||
-{
|
||||
- Q_OBJECT
|
||||
-public:
|
||||
- Modifier(){}
|
||||
-
|
||||
- enum MOD{
|
||||
- UNKNOWN = -1,
|
||||
- CTRL,
|
||||
- SHIFT,
|
||||
- ALT,
|
||||
- SUPER
|
||||
- };
|
||||
- Q_ENUM(MOD)
|
||||
-
|
||||
- static QString getModifierName(int mod)
|
||||
- {
|
||||
- QMetaEnum metaEnum = QMetaEnum::fromType<Modifier::MOD>();
|
||||
- const char* modName = metaEnum.valueToKey(mod);
|
||||
- QString result = QString(modName).toLower();
|
||||
- return result;
|
||||
- }
|
||||
- static MOD getModifier(const QString &modName)
|
||||
- {
|
||||
- QMetaEnum metaEnum = QMetaEnum::fromType<Modifier::MOD>();
|
||||
- MOD mod = (MOD)metaEnum.keyToValue(modName.toUpper().toLocal8Bit().data());
|
||||
- return mod;
|
||||
- }
|
||||
-};
|
||||
-
|
||||
-class FuncKey : public QObject
|
||||
-{
|
||||
- Q_OBJECT
|
||||
-public:
|
||||
- FuncKey(){}
|
||||
-
|
||||
- enum FUNCKEY {
|
||||
- UNKNOWN = -1,
|
||||
- SPACE = 0,
|
||||
- BACKSPACE,
|
||||
- ENTER,
|
||||
- HOME,
|
||||
- END,
|
||||
- PGUP,
|
||||
- PGDN,
|
||||
- INSERT,
|
||||
- DELETE,
|
||||
- UP,
|
||||
- DOWN,
|
||||
- LEFT,
|
||||
- RIGHT
|
||||
- };
|
||||
- Q_ENUM(FUNCKEY)
|
||||
- static QString getKeyName(int key)
|
||||
- {
|
||||
- QMetaEnum metaEnum = QMetaEnum::fromType<FuncKey::FUNCKEY>();
|
||||
- const char* keyName = metaEnum.valueToKey(key);
|
||||
- QString result = QString(keyName).toLower();
|
||||
- return result;
|
||||
- }
|
||||
- static FUNCKEY getKey(const QString &keyName)
|
||||
- {
|
||||
- QMetaEnum metaEnum = QMetaEnum::fromType<FuncKey::FUNCKEY>();
|
||||
- FUNCKEY key = (FUNCKEY)metaEnum.keyToValue(keyName.toUpper().toLocal8Bit().data());
|
||||
- return key;
|
||||
- }
|
||||
-};
|
||||
-
|
||||
-class X11Keyboard : public QObject
|
||||
+class X11Keyboard : public FakeKeyboard
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
diff --git a/examples/LoadCustomPlugin/main.cpp b/examples/LoadCustomPlugin/main.cpp
|
||||
index 4d6c97b..1ba44a8 100644
|
||||
--- a/examples/LoadCustomPlugin/main.cpp
|
||||
+++ b/examples/LoadCustomPlugin/main.cpp
|
||||
@@ -1,3 +1,20 @@
|
||||
+/*
|
||||
+ * Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 3, or (at your option)
|
||||
+ * any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
+ *
|
||||
+**/
|
||||
#include "widget.h"
|
||||
#include <QApplication>
|
||||
|
||||
diff --git a/examples/LoadCustomPlugin/widget.cpp b/examples/LoadCustomPlugin/widget.cpp
|
||||
index 45a1213..fe30bca 100644
|
||||
--- a/examples/LoadCustomPlugin/widget.cpp
|
||||
+++ b/examples/LoadCustomPlugin/widget.cpp
|
||||
@@ -1,4 +1,21 @@
|
||||
-#pragma execution_character_set("utf-8")
|
||||
+/*
|
||||
+ * Copyright (C) 2022 Tianjin KYLIN Information Technology Co., Ltd.
|
||||
+ *
|
||||
+ * This program is free software; you can redistribute it and/or modify
|
||||
+ * it under the terms of the GNU General Public License as published by
|
||||
+ * the Free Software Foundation; either version 3, or (at your option)
|
||||
+ * any later version.
|
||||
+ *
|
||||
+ * This program is distributed in the hope that it will be useful,
|
||||
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
+ * GNU General Public License for more details.
|
||||
+ *
|
||||
+ * You should have received a copy of the GNU General Public License
|
||||
+ * along with this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
+ *
|
||||
+**/
|
||||
+#pragma execution_character_set("utf-8")
|
||||
|
||||
#include "widget.h"
|
||||
#include "ui_widget.h"
|
||||
diff --git a/src/fullbackgroundwidget.cpp b/src/fullbackgroundwidget.cpp
|
||||
index 3e4e421..4486055 100644
|
||||
--- a/src/fullbackgroundwidget.cpp
|
||||
+++ b/src/fullbackgroundwidget.cpp
|
||||
@@ -566,7 +566,6 @@ bool FullBackgroundWidget::nativeEventFilter(const QByteArray &eventType, void *
|
||||
//onGlobalKeyPress(xc->detail);
|
||||
} else if (responseType == XCB_KEY_RELEASE) {
|
||||
xcb_key_release_event_t *xc = reinterpret_cast<xcb_key_release_event_t*>(event);
|
||||
- qDebug()<<"---------------------XCB_KEY_RELEASE:"<<xc->detail;
|
||||
onGlobalKeyRelease(xc->detail);
|
||||
} else if(responseType == XCB_GE_GENERIC){
|
||||
xcb_ge_generic_event_t *xc = reinterpret_cast<xcb_ge_generic_event_t*>(event);
|
||||
@@ -580,14 +579,12 @@ bool FullBackgroundWidget::nativeEventFilter(const QByteArray &eventType, void *
|
||||
int x = xc->root_x;
|
||||
int y = xc->root_y;
|
||||
onGlobalButtonPressed(x, y);
|
||||
- qDebug()<<"---------------------XCB_BUTTON_PRESS:"<<x<<","<<y;
|
||||
} else if (responseType == XCB_BUTTON_RELEASE) {
|
||||
} else if (responseType == XCB_MOTION_NOTIFY) { //此处获取的是窗口外的鼠标移动
|
||||
xcb_motion_notify_event_t *xc = reinterpret_cast<xcb_motion_notify_event_t*>(event);
|
||||
int x = xc->root_x;
|
||||
int y = xc->root_y;
|
||||
onGlobalButtonDrag(x, y);
|
||||
- qDebug()<<"---------------------XCB_MOTION_NOTIFY:"<<x<<","<<y;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
diff --git a/src/lockwidget.cpp b/src/lockwidget.cpp
|
||||
index f648e24..bbb0ff7 100644
|
||||
--- a/src/lockwidget.cpp
|
||||
+++ b/src/lockwidget.cpp
|
||||
@@ -814,7 +814,7 @@ void LockWidget::initUI()
|
||||
this->setCursor(Qt::ArrowCursor);
|
||||
});
|
||||
|
||||
- if(QX11Info::isPlatformX11()){
|
||||
+// if(QX11Info::isPlatformX11()){
|
||||
//虚拟键盘
|
||||
ui->btnKeyboard->setIcon(QIcon(":/image/assets/keyboard.svg"));
|
||||
ui->btnKeyboard->setFixedSize(48, 48);
|
||||
@@ -832,10 +832,11 @@ void LockWidget::initUI()
|
||||
|
||||
connect(ui->btnKeyboard, &QPushButton::clicked,
|
||||
this, &LockWidget::showVirtualKeyboard);
|
||||
+/*
|
||||
} else {
|
||||
ui->btnKeyboard->hide();
|
||||
}
|
||||
-
|
||||
+*/
|
||||
//用户切换
|
||||
if(displayManager->canSwitch())
|
||||
{
|
||||
@@ -875,9 +876,6 @@ void LockWidget::netInPutStatus()
|
||||
|
||||
void LockWidget::showVirtualKeyboard()
|
||||
{
|
||||
- if (!QX11Info::isPlatformX11()) {
|
||||
- return ;
|
||||
- }
|
||||
tabAt = LINEEDIT;
|
||||
setBottomBtnSheet();
|
||||
tabAt = BOTTMBTN;
|
|
@ -5,3 +5,4 @@
|
|||
0005-update-changelog.patch
|
||||
0006-update-changelog.patch
|
||||
0007-update-changelog.patch
|
||||
0008-update-changelog.patch
|
||||
|
|
Loading…
Reference in New Issue