mirror of
https://bitbucket.org/smil3y/kde-extraapps.git
synced 2025-02-23 18:32:53 +00:00
kdeplasma-addons: do not send F1-12 keys from paste applet
specials keys outside the Qt::Key_Space-Qt::Key_ydiaeresis range, Katie uses values that equal those used by X11 for keys aswell (i.e. the map is redundant) Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
168700ffa6
commit
8ad6a12c93
4 changed files with 7 additions and 88 deletions
|
@ -128,7 +128,7 @@ void ListForm::clicked(const QModelIndex &index)
|
|||
|
||||
void ListForm::paste()
|
||||
{
|
||||
SendKeys::self() << m_pasteKey;
|
||||
SendKeys::send(m_pasteKey);
|
||||
}
|
||||
|
||||
void ListForm::themeChanged()
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
*/
|
||||
|
||||
#include "paste.h"
|
||||
#include "sendkeys.h"
|
||||
#include "list.h"
|
||||
#include "snippetconfig.h"
|
||||
#include "autopasteconfig.h"
|
||||
|
|
|
@ -24,73 +24,10 @@
|
|||
#include <X11/Xlib.h>
|
||||
#include <X11/keysym.h>
|
||||
|
||||
class SendKeysPrivate {
|
||||
public:
|
||||
SendKeysPrivate()
|
||||
{
|
||||
keys[Qt::Key_F1] = XK_F1;
|
||||
keys[Qt::Key_F2] = XK_F2;
|
||||
keys[Qt::Key_F3] = XK_F3;
|
||||
keys[Qt::Key_F4] = XK_F4;
|
||||
keys[Qt::Key_F5] = XK_F5;
|
||||
keys[Qt::Key_F6] = XK_F6;
|
||||
keys[Qt::Key_F7] = XK_F7;
|
||||
keys[Qt::Key_F8] = XK_F8;
|
||||
keys[Qt::Key_F9] = XK_F9;
|
||||
keys[Qt::Key_F10] = XK_F10;
|
||||
keys[Qt::Key_F11] = XK_F11;
|
||||
keys[Qt::Key_F12] = XK_F12;
|
||||
// Add more if needed
|
||||
};
|
||||
|
||||
QMap<int, int> keys;
|
||||
};
|
||||
|
||||
SendKeys::SendKeys()
|
||||
: d(new SendKeysPrivate())
|
||||
{
|
||||
}
|
||||
|
||||
SendKeys::~SendKeys()
|
||||
{
|
||||
delete d;
|
||||
}
|
||||
|
||||
SendKeys &SendKeys::self()
|
||||
{
|
||||
K_GLOBAL_STATIC(SendKeys, s_instance)
|
||||
return *s_instance;
|
||||
}
|
||||
|
||||
SendKeys &SendKeys::operator<<(const QString &string)
|
||||
{
|
||||
send(string);
|
||||
return *this;
|
||||
}
|
||||
|
||||
SendKeys &SendKeys::operator<<(uint k)
|
||||
{
|
||||
send(k);
|
||||
return *this;
|
||||
}
|
||||
|
||||
SendKeys &SendKeys::operator<<(const QKeySequence &ks)
|
||||
{
|
||||
send(ks);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void SendKeys::send(const QString &string)
|
||||
{
|
||||
foreach(uint key, string.toUcs4()) {
|
||||
send(key);
|
||||
}
|
||||
}
|
||||
|
||||
void SendKeys::send(const QKeySequence &ks)
|
||||
{
|
||||
for (uint i = 0; i < ks.count(); ++i) {
|
||||
send(ks[i]);
|
||||
for (uint i = 0; i < ks.count(); ++i) {
|
||||
SendKeys::send(ks[i]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -102,9 +39,7 @@ void SendKeys::send(uint k)
|
|||
Window currentFocus;
|
||||
int focusState;
|
||||
|
||||
if (d->keys.contains(keycode)) {
|
||||
keycode = d->keys[keycode];
|
||||
} else if (keycode < Qt::Key_Space || keycode > Qt::Key_ydiaeresis) {
|
||||
if (keycode < Qt::Key_Space || keycode > Qt::Key_ydiaeresis) {
|
||||
return;
|
||||
}
|
||||
keycode = XKeysymToKeycode(dsp, keycode);
|
||||
|
|
|
@ -18,28 +18,13 @@
|
|||
#ifndef SENDKEYS_HEADER
|
||||
#define SENDKEYS_HEADER
|
||||
|
||||
#include <QtGlobal>
|
||||
|
||||
#include <QString>
|
||||
#include <QKeySequence>
|
||||
|
||||
class SendKeys
|
||||
{
|
||||
public:
|
||||
static SendKeys &self();
|
||||
|
||||
void send(const QString &string);
|
||||
void send(uint k);
|
||||
void send(const QKeySequence &ks);
|
||||
SendKeys &operator<<(const QString &string);
|
||||
SendKeys &operator<<(uint k);
|
||||
SendKeys &operator<<(const QKeySequence &ks);
|
||||
|
||||
private:
|
||||
SendKeys();
|
||||
~SendKeys();
|
||||
|
||||
class SendKeysPrivate *const d;
|
||||
public:
|
||||
static void send(const QKeySequence &ks);
|
||||
static void send(uint k);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Add table
Reference in a new issue