Interrupt auto-type if the focused window changed meanwhile
Update changelog git-svn-id: https://svn.code.sf.net/p/keepassx/code/trunk@332 b624d157-de02-0410-bad0-e51aec6abb33
This commit is contained in:
parent
be548a6446
commit
d97fce6394
10
changelog
10
changelog
|
@ -1,15 +1,21 @@
|
|||
----------------------------
|
||||
0.4.1 (2009-06-XX)
|
||||
0.4.1 (2009-08-XX)
|
||||
----------------------------
|
||||
- Added initial documentation
|
||||
- Added and improved many translations
|
||||
- Seperate columns settings between normal and search results view
|
||||
- Interrupt auto-type if the focused window changed meanwhile
|
||||
- Reduced height of password generator dialog (Bug #2831504)
|
||||
- Fixed: "Key Stroke Delay" interpreted as seconds instead of ms (Bug #2716877)
|
||||
- Escape HTML chars in detail view (Bug #2836096)
|
||||
- Fixed: Mispelling of initialize in interface (Bug #2806402)
|
||||
- Fixed: Race condition on lock file (Bug #2801583)
|
||||
- Fixed: Modified entry does not refresh Entry Details Pane (Bug #2782262)
|
||||
- Fixed: Logoff doesn't close database correctly (Bug #2726197)
|
||||
- Fixed: Incorrect auto-type keymapping when KeePassX is in autostart
|
||||
- Fixed: Workspace is being locked after auto-type
|
||||
- Fixed: Wrong "Key Stroke Delay" (Bug #2716877)
|
||||
- Fixed: compiler warning/error "format not a string literal and no format arguments" (Bug #2815290)
|
||||
- Fixed: Makefile uninstall target removes system directories (Bug #2830345)
|
||||
- Fixed key rounds benchmark to return incorrect results
|
||||
- Set default auto-type key stroke delay to 5ms
|
||||
- Removed "Close to Tray" option
|
||||
|
|
|
@ -1456,7 +1456,9 @@ bool Kdb3Database::save(){
|
|||
int size = EncryptedPartSize+DB_HEADER_SIZE;
|
||||
|
||||
if (!File->resize(size)){
|
||||
// only recreate file if the new database is smaller
|
||||
if (File->size() > size) {
|
||||
qDebug("Unable to resize, trying to recreate file");
|
||||
if (!File->remove() || !File->open(QIODevice::ReadWrite)) {
|
||||
delete [] buffer;
|
||||
error=decodeFileError(File->error());
|
||||
|
|
|
@ -19,7 +19,11 @@
|
|||
#include <QDesktopWidget>
|
||||
#include "AutoTypeDlg.h"
|
||||
|
||||
bool AutoTypeDlg::dialogVisible = false;
|
||||
|
||||
AutoTypeDlg::AutoTypeDlg(QList<IEntryHandle*> entries, QList<int> numbers, bool wasLocked) : pWasLocked(wasLocked){
|
||||
Q_ASSERT(!dialogVisible);
|
||||
dialogVisible = true;
|
||||
setupUi(this);
|
||||
|
||||
setAttribute(Qt::WA_DeleteOnClose);
|
||||
|
@ -86,8 +90,14 @@ void AutoTypeDlg::paintEvent(QPaintEvent* event){
|
|||
}
|
||||
|
||||
void AutoTypeDlg::resizeEvent(QResizeEvent* event){
|
||||
Q_UNUSED(event);
|
||||
createBanner(&BannerPixmap,getPixmap("keepassx_large"),tr("Auto-Type"),width());
|
||||
QWidget::resizeEvent(event);
|
||||
}
|
||||
|
||||
void AutoTypeDlg::closeEvent(QCloseEvent* event) {
|
||||
Q_ASSERT(dialogVisible);
|
||||
dialogVisible = false;
|
||||
QWidget::closeEvent(event);
|
||||
}
|
||||
|
||||
bool AutoTypeDlg::event(QEvent* event){
|
||||
|
|
|
@ -25,10 +25,12 @@ class AutoTypeDlg : public QWidget, private Ui::AutoTypeDlg
|
|||
|
||||
public:
|
||||
AutoTypeDlg(QList<IEntryHandle*> entries, QList<int> numbers, bool wasLocked);
|
||||
inline static bool isDialogVisible() { return dialogVisible; };
|
||||
|
||||
protected:
|
||||
void paintEvent(QPaintEvent* event);
|
||||
void resizeEvent(QResizeEvent* event);
|
||||
void closeEvent(QCloseEvent* event);
|
||||
bool event(QEvent* event);
|
||||
|
||||
private slots:
|
||||
|
@ -43,4 +45,5 @@ class AutoTypeDlg : public QWidget, private Ui::AutoTypeDlg
|
|||
QHash<QTreeWidgetItem*,AutoTypeEntry> itemToEntry;
|
||||
QPixmap BannerPixmap;
|
||||
bool pWasLocked;
|
||||
static bool dialogVisible;
|
||||
};
|
||||
|
|
|
@ -38,6 +38,8 @@ AutoTypeGlobalX11::AutoTypeGlobalX11(KeepassMainWindow* mainWin) : AutoTypeX11(m
|
|||
focusedWindow = 0;
|
||||
oldCode = 0;
|
||||
oldMod = 0;
|
||||
inGlobalAutoType = false;
|
||||
|
||||
//windowBlacklist << "kicker" << "KDE Desktop";
|
||||
classBlacklist << "desktop_window" << "gnome-panel"; // Gnome
|
||||
classBlacklist << "kdesktop" << "kicker"; // KDE 3
|
||||
|
@ -51,11 +53,21 @@ void AutoTypeGlobalX11::updateKeymap() {
|
|||
}
|
||||
|
||||
void AutoTypeGlobalX11::perform(IEntryHandle* entry, bool hideWindow, int nr, bool wasLocked){
|
||||
if (inGlobalAutoType)
|
||||
return;
|
||||
inGlobalAutoType = true;
|
||||
|
||||
if (focusedWindow && (!hideWindow || wasLocked)) { // detect if global auto-type
|
||||
XSetInputFocus(dpy, focusedWindow, RevertToPointerRoot, CurrentTime);
|
||||
focusedWindow = 0;
|
||||
}
|
||||
else {
|
||||
focusWindow = NULL;
|
||||
}
|
||||
|
||||
AutoTypeX11::perform(entry, hideWindow, nr, wasLocked);
|
||||
|
||||
inGlobalAutoType = false;
|
||||
}
|
||||
|
||||
void AutoTypeGlobalX11::windowTitles(Window window, QStringList& titleList){
|
||||
|
@ -95,12 +107,13 @@ void AutoTypeGlobalX11::windowTitles(Window window, QStringList& titleList){
|
|||
Window* children = NULL;
|
||||
unsigned int num_children;
|
||||
int tree = XQueryTree(dpy, window, &root, &parent, &children, &num_children);
|
||||
if (tree && children){
|
||||
if (tree && children) {
|
||||
for (uint i=0; i<num_children; i++)
|
||||
windowTitles(children[i], titleList);
|
||||
}
|
||||
else
|
||||
else {
|
||||
XFree(children);
|
||||
}
|
||||
}
|
||||
|
||||
QStringList AutoTypeGlobalX11::getAllWindowTitles(){
|
||||
|
@ -111,6 +124,13 @@ void AutoTypeGlobalX11::windowTitles(Window window, QStringList& titleList){
|
|||
}
|
||||
|
||||
void AutoTypeGlobalX11::performGlobal(){
|
||||
if (AutoTypeDlg::isDialogVisible()) {
|
||||
qWarning("Already performing auto-type, ignoring this one");
|
||||
return;
|
||||
}
|
||||
|
||||
focusWindow = getFocusWindow();
|
||||
|
||||
bool wasLocked = mainWin->isLocked();
|
||||
if (wasLocked)
|
||||
mainWin->OnUnLockWorkspace();
|
||||
|
|
|
@ -47,6 +47,7 @@ class AutoTypeGlobalX11 : public AutoTypeX11, public AutoTypeGlobal {
|
|||
Window focusedWindow;
|
||||
int oldCode;
|
||||
uint oldMod;
|
||||
bool inGlobalAutoType;
|
||||
};
|
||||
|
||||
#endif // _AUTOTYPEGLOBALX11_H_
|
||||
|
|
|
@ -38,6 +38,7 @@ AutoTypeAction::AutoTypeAction(AutoTypeActionType t, KeySym d) : type(t), data(d
|
|||
AutoTypeX11::AutoTypeX11(KeepassMainWindow* mainWin) {
|
||||
this->mainWin = mainWin;
|
||||
dpy = QX11Info::display();
|
||||
inAutoType = false;
|
||||
|
||||
keysym_table = NULL;
|
||||
alt_mask = 0;
|
||||
|
@ -57,7 +58,18 @@ void AutoTypeX11::updateKeymap() {
|
|||
meta_mask = Mod4Mask;
|
||||
}
|
||||
|
||||
Window AutoTypeX11::getFocusWindow() {
|
||||
Window w;
|
||||
int revert_to_return;
|
||||
XGetInputFocus(dpy, &w, &revert_to_return);
|
||||
return w;
|
||||
}
|
||||
|
||||
void AutoTypeX11::perform(IEntryHandle* entry, bool hideWindow, int nr, bool wasLocked){
|
||||
if (inAutoType)
|
||||
return;
|
||||
inAutoType = true;
|
||||
|
||||
QString indexStr;
|
||||
if (nr==0)
|
||||
indexStr = "Auto-Type:";
|
||||
|
@ -130,8 +142,16 @@ void AutoTypeX11::perform(IEntryHandle* entry, bool hideWindow, int nr, bool was
|
|||
QApplication::processEvents();
|
||||
sleepTime(config->autoTypePreGap());
|
||||
|
||||
if (!focusWindow)
|
||||
focusWindow = getFocusWindow();
|
||||
|
||||
QString type;
|
||||
for(int i=0;i<Keys.size();i++){
|
||||
if (focusWindow != getFocusWindow()) {
|
||||
qWarning("Focus window changed, interrupting auto-type");
|
||||
break;
|
||||
}
|
||||
|
||||
if (Keys[i].type==TypeKey){
|
||||
SendKeyPressedEvent(Keys[i].data, 0);
|
||||
sleepKeyStrokeDelay();
|
||||
|
@ -154,6 +174,9 @@ void AutoTypeX11::perform(IEntryHandle* entry, bool hideWindow, int nr, bool was
|
|||
if (hideWindow && !(config->showSysTrayIcon() && config->minimizeTray()) )
|
||||
mainWin->showMinimized();
|
||||
}
|
||||
|
||||
inAutoType = false;
|
||||
focusWindow = NULL;
|
||||
}
|
||||
|
||||
void AutoTypeX11::sleepTime(int msec){
|
||||
|
|
|
@ -53,6 +53,7 @@ class AutoTypeX11 : public AutoType {
|
|||
void SendKeyPressedEvent(KeySym keysym, unsigned int shift);
|
||||
void SendEvent(XKeyEvent *event);
|
||||
static int MyErrorHandler(Display *my_dpy, XErrorEvent *event);
|
||||
Window getFocusWindow();
|
||||
|
||||
KeepassMainWindow* mainWin;
|
||||
Display* dpy;
|
||||
|
@ -65,6 +66,10 @@ class AutoTypeX11 : public AutoType {
|
|||
int altgr_mask;
|
||||
KeySym altgr_keysym;
|
||||
bool reReadKeymap;
|
||||
Window focusWindow;
|
||||
|
||||
private:
|
||||
bool inAutoType;
|
||||
};
|
||||
|
||||
#endif // _AUTOTYPEX11_H_
|
||||
|
|
Loading…
Reference in New Issue