Merge branch 'master' into HEAD

This commit is contained in:
Mathias Panzenböck
2014-02-18 02:11:15 +01:00
4 changed files with 19 additions and 15 deletions

View File

@ -31,7 +31,6 @@ bool GetKey::x11Event( XEvent* e )
{
//keep Qt from closing the dialog upon seeing Esc pressed.
if (e->type == KeyPress) return true;
//On a key press, return the key and quit
//Ctrl+X == [No Key]
if (e->type == KeyRelease) {
@ -53,6 +52,11 @@ bool GetKey::x11Event( XEvent* e )
return false;
}
void GetKey::closeEvent(QCloseEvent *e) {
e->ignore();
done(-1);
}
void GetKey::paintEvent ( QPaintEvent * ) {
//whenever we need to repaint, draw in our text.
QPainter paint( this );

View File

@ -5,6 +5,7 @@
#include <QPainter>
#include <QPixmap>
#include <QIcon>
#include <QCloseEvent>
#include "constant.h"
#include <X11/Xlib.h>
//The KeySym for "x"
@ -21,6 +22,7 @@ class GetKey : public QDialog {
//to avoid focus issues, there is only the dialog widget, all the
//rest is painted on. So, I need to know when to repaint.
void paintEvent ( QPaintEvent * );
void closeEvent (QCloseEvent *);
private:
//the dialog's message
QString Text;

View File

@ -90,7 +90,14 @@ KeyButton::KeyButton( QString name, int val, QWidget* parent, bool m, bool nowMo
void KeyButton::onClick() {
//when clicked, ask for a key!
value = GetKey( buttonname, mouse ).exec();
int retValue = GetKey( buttonname, mouse ).exec();
// -1 is a special value meaning that the window was simply
// closed so we can ignore this
if(retValue == -1) {
return;
} else {
value = retValue;
}
//if the return value was a mouse click...
if (value > MOUSE_OFFSET) {
mouseClicked = true;