1 /***************************************************************************
2 * Copyright (C) 2005-2008 by Tarek Saidi, Felix Geyer *
3 * tarek.saidi@arcor.de *
5 * This program is free software; you can redistribute it and/or modify *
6 * it under the terms of the GNU General Public License as published by *
7 * the Free Software Foundation; version 2 of the License. *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the *
17 * Free Software Foundation, Inc., *
18 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
19 ***************************************************************************/
21 #ifndef _AUTOTYPEX11_H_
22 #define _AUTOTYPEX11_H_
26 #include <X11/Xutil.h>
28 enum AutoTypeActionType{
32 struct AutoTypeAction{
33 AutoTypeAction(AutoTypeActionType t, KeySym d);
34 AutoTypeActionType type;
38 class AutoTypeX11 : public AutoType {
40 AutoTypeX11(KeepassMainWindow* mainWin);
41 void perform(IEntryHandle* entry, bool hideWindow=true, int nr=0, bool wasLocked=false);
42 virtual void updateKeymap();
45 void sleepTime(int msec);
46 inline void sleepKeyStrokeDelay(){ sleepTime(config->autoTypeKeyStrokeDelay()); };
47 void templateToKeysyms(const QString& Template, QList<AutoTypeAction>& KeySymList,IEntryHandle* entry);
48 void stringToKeysyms(const QString& string,QList<AutoTypeAction>& KeySymList);
50 int AddKeysym(KeySym keysym, bool top);
51 void AddModifier(KeySym keysym);
53 void SendKeyPressedEvent(KeySym keysym, unsigned int shift);
54 void SendEvent(XKeyEvent *event);
55 static int MyErrorHandler(Display *my_dpy, XErrorEvent *event);
56 Window getFocusWindow();
58 KeepassMainWindow* mainWin;
62 int min_keycode, max_keycode;
63 int keysym_per_keycode;
75 #endif // _AUTOTYPEX11_H_