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

@ -904,17 +904,8 @@ Chapter 6. Credits
Thank you for your interest and for your support, Mark. Thank you for your interest and for your support, Mark.
_________________________________________________________ _________________________________________________________
Chapter 7. This software is GPL! Chapter 7. Licensing
Check out LICENSE.txt or http://www.gnu.org/licenses/gpl.txt This software is licensed under the terms of the GNU GPLv2.
for details! The bare bones of it is, this program is Please see LICENSE.txt for a full text of the license.
distributed in open-source form so that others may share it
freely, learn from it, or modify it as they see fit. However,
under no circumstances can it be sold!
This code was written entirely by Nathan Gaylinn (excepting
the code used for displaying a tray icon that is adapted from
the Psi source [http://psi.affinix.com/]) but is based on the
idea of xjoypad by Erich Kitzm<7A>ller.
Yay for the power GPL gives to developers!

View File

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

View File

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

View File

@ -90,7 +90,14 @@ KeyButton::KeyButton( QString name, int val, QWidget* parent, bool m, bool nowMo
void KeyButton::onClick() { void KeyButton::onClick() {
//when clicked, ask for a key! //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 the return value was a mouse click...
if (value > MOUSE_OFFSET) { if (value > MOUSE_OFFSET) {
mouseClicked = true; mouseClicked = true;