[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: playground/base/plasma/applets/plasmaboard
From: Björn Ruberg <bjoern () ruberg-wegener ! de>
Date: 2009-03-31 20:53:53
Message-ID: 1238532833.427111.26499.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 947597 by ruberg:
If you keep the key pressed, repeated symbols are now send to the X-Server
M +7 -3 AlphaNumKey.cpp
M +3 -1 AlphaNumKey.h
M +2 -3 BoardKey.cpp
M +2 -1 BoardKey.h
M +13 -10 FuncKey.cpp
M +2 -2 FuncKey.h
--- trunk/playground/base/plasma/applets/plasmaboard/AlphaNumKey.cpp #947596:947597
@@ -19,11 +19,13 @@
#include "AlphaNumKey.h"
+#include <kpushbutton.h>
AlphaNumKey::AlphaNumKey(PlasmaboardWidget *parent):
BoardKey::BoardKey(parent){
// TODO Auto-generated constructor stub
- QObject::connect(this, SIGNAL( clicked() ), this, SLOT( sendKeycode() ) );
+ QObject::connect(static_cast<const KPushButton*>(this->nativeWidget()), SIGNAL( \
pressed() ), this, SLOT( sendKeycodePress() ) ); + QObject::connect(static_cast<const \
KPushButton*>(this->nativeWidget()), SIGNAL( released() ), this, SLOT( \
sendKeycodeRelease() ) ); }
AlphaNumKey::~AlphaNumKey() {
@@ -51,8 +53,10 @@
}
}
-void AlphaNumKey::sendKeycode() {
+void AlphaNumKey::sendKeycodePress() {
Helpers::fakeKeyPress(getKeycode());
+}
+
+void AlphaNumKey::sendKeycodeRelease() {
Helpers::fakeKeyRelease(getKeycode());
}
-
--- trunk/playground/base/plasma/applets/plasmaboard/AlphaNumKey.h #947596:947597
@@ -35,7 +35,9 @@
void setKeycode(unsigned int keysym);
public Q_SLOTS:
- virtual void sendKeycode();
+ virtual void sendKeycodePress();
+ virtual void sendKeycodeRelease();
+
};
#endif /* ALPHANUMKEY_H_ */
--- trunk/playground/base/plasma/applets/plasmaboard/BoardKey.cpp #947596:947597
@@ -43,6 +43,5 @@
return keycode;
}
-void BoardKey::sendKeycode() {
-
-}
+void BoardKey::sendKeycodePress() {}
+void BoardKey::sendKeycodeRelease() {}
--- trunk/playground/base/plasma/applets/plasmaboard/BoardKey.h #947596:947597
@@ -34,7 +34,8 @@
unsigned int getKeycode();
public Q_SLOTS:
- virtual void sendKeycode();
+ virtual void sendKeycodePress();
+ virtual void sendKeycodeRelease();
protected:
unsigned int keycode;
--- trunk/playground/base/plasma/applets/plasmaboard/FuncKey.cpp #947596:947597
@@ -19,11 +19,12 @@
#include "FuncKey.h"
+#include <kpushbutton.h>
FuncKey::FuncKey(PlasmaboardWidget *parent):
BoardKey::BoardKey(parent) {
// TODO Auto-generated constructor stub
- QObject::connect(this, SIGNAL( clicked() ), this, SLOT( sendKeycode() ) );
+ QObject::connect(static_cast<const KPushButton*>(this->nativeWidget()), SIGNAL( \
pressed() ), this, SLOT( sendKeycodePress() ) ); oldStyle = \
Plasma::PushButton::styleSheet(); }
@@ -32,7 +33,7 @@
}
void FuncKey::toggleOn(){
- Plasma::PushButton::setStyleSheet(oldStyle + "color:red;text-align:left;"); // \
sorry, but I need some visual confirmation \
+ Plasma::PushButton::setStyleSheet(oldStyle + "color:red;text-align:center;"); // \
sorry, but I need some visual confirmation }
void FuncKey::toggleOff(){
@@ -41,15 +42,17 @@
void FuncKey::setKeycode(unsigned int code, bool sendUp){
keycode = Helpers::keysymToKeycode(code);
- sendUpEvent = sendUp;
+ if(sendUp){
+ QObject::connect(static_cast<const KPushButton*>(this->nativeWidget()), SIGNAL( \
released() ), this, SLOT( sendKeycodeRelease() ) ); + }
}
-void FuncKey::sendKeycode() {
+void FuncKey::sendKeycodePress() {
Helpers::fakeKeyPress(getKeycode());
- if(sendUpEvent){
- Helpers::fakeKeyRelease(getKeycode());
- }
- else{
- toggleOn();
- }
+ toggleOn();
}
+
+void FuncKey::sendKeycodeRelease() {
+ Helpers::fakeKeyRelease(getKeycode());
+ toggleOff();
+}
--- trunk/playground/base/plasma/applets/plasmaboard/FuncKey.h #947596:947597
@@ -34,10 +34,10 @@
void setKeycode(unsigned int code, bool sendUp);
public Q_SLOTS:
- virtual void sendKeycode();
+ virtual void sendKeycodePress();
+ virtual void sendKeycodeRelease();
private:
- bool sendUpEvent;
QString oldStyle;
};
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic