1 /***************************************************************************
2 * Copyright (C) 2005-2008 by Felix Geyer *
4 * This program is free software; you can redistribute it and/or modify *
5 * it under the terms of the GNU General Public License as published by *
6 * the Free Software Foundation; version 2 of the License. *
9 * This program is distributed in the hope that it will be useful, *
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
12 * GNU General Public License for more details. *
14 * You should have received a copy of the GNU General Public License *
15 * along with this program; if not, write to the *
16 * Free Software Foundation, Inc., *
17 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18 ***************************************************************************/
21 #include "Application_X11.h"
22 #include "lib/AutoTypeGlobalX11.h"
23 #include "lib/HelperX11.h"
25 KeepassApplication::KeepassApplication(int& argc, char** argv) : QApplication(argc, argv), remove_invalid(0){
28 bool KeepassApplication::x11EventFilter(XEvent* event){
30 return QApplication::x11EventFilter(event);
32 #ifdef GLOBAL_AUTOTYPE
33 if (remove_invalid == 0) {
34 AutoTypeGlobalX11* autoTypeGlobal = static_cast<AutoTypeGlobalX11*>(autoType);
35 remove_invalid = ControlMask | ShiftMask | autoTypeGlobal->maskAlt() |
36 autoTypeGlobal->maskAltGr() | autoTypeGlobal->maskMeta();
39 if (event->type==KeyPress && autoType->getShortcut().key!=0 &&
40 event->xkey.keycode == XKeysymToKeycode(event->xkey.display,HelperX11::getKeysym(autoType->getShortcut().key)) &&
41 (event->xkey.state&remove_invalid) == HelperX11::getShortcutModifierMask(autoType->getShortcut()) &&
45 autoType->performGlobal();
50 if (event->type == MappingNotify) {
51 dynamic_cast<AutoTypeX11*>(autoType)->updateKeymap();
55 return QApplication::x11EventFilter(event);