added 300ms delay before performing AutoType

git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@95 b624d157-de02-0410-bad0-e51aec6abb33
master
tarek_saidi 19 years ago
parent b3a1a6d216
commit f060033b14
  1. 8
      src/lib/AutoType_X11.cpp

@ -18,7 +18,9 @@
* 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
***************************************************************************/
#include <QApplication>
#include "AutoType.h"
#include <QTime>
#include <QList>
#include <QChar>
@ -64,6 +66,11 @@ switch(mods){
void AutoType::perform(CEntry* entry, QString& err){
struct timespec timeOut,remains;
timeOut.tv_sec = 0;
timeOut.tv_nsec = 300000000; /* 300 milliseconds */
for(int i=0;i<10;i++)nanosleep(&timeOut, &remains);
QString str;
int c=entry->Additional.count("Auto-Type:");
if(c>1){
@ -110,7 +117,6 @@ for(int i=0;i<Keys.size();i++){
int keycode=XKeysymToKeycode(pDisplay,Keys[i]);
int mods=getModifiers(pDisplay,Keys[i],keycode);
pressModifiers(pDisplay,mods);
qDebug("[%i]: Keysym=%i, KeyCode=%i, Mod=%i",i,(int)Keys[i],keycode,mods);
XTestFakeKeyEvent(pDisplay,keycode,True,0);
XTestFakeKeyEvent(pDisplay,keycode,False,1);
releaseModifiers(pDisplay,mods);