[git] Pinentry - branch, master, updated. pinentry-0.9.7-26-gc032ea2

by Andre Heinecke cvs at cvs.gnupg.org
Thu Aug 18 15:00:22 CEST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "The standard pinentry collection".

The branch, master has been updated
       via  c032ea2dcb4ac3ce970e62eae88fd24bec822f9c (commit)
      from  300755c1a10eec1f8bccd4182ed15c569473982c (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit c032ea2dcb4ac3ce970e62eae88fd24bec822f9c
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Thu Aug 18 14:55:27 2016 +0200

    Qt: Add SetWindowPos based foreground hack for Win
    
    * qt/pinentrydialog.cpp(raiseWindow): Add another fallback for
    our foreground window hacks.
    
    --
    Even if SetForegroundWindow or SetForegroundWindowEx do not report
    failures we are not always brought to front. So additionally
    afterwards we also set our Window Position to be absolutely
    in foreground and afterards remove that (so that a user
    may still but us in the background).
    
    This fixes the weird behavior that repeated pinentries for
    symmetric encryption open in background.

diff --git a/qt/pinentrydialog.cpp b/qt/pinentrydialog.cpp
index 009cd31..12f7718 100644
--- a/qt/pinentrydialog.cpp
+++ b/qt/pinentrydialog.cpp
@@ -79,16 +79,28 @@ void raiseWindow(QWidget *w)
      * this is enough on windows too*/
     w->raise();
 #ifdef Q_OS_WIN
+    HWND wid = (HWND)w->effectiveWinId();
     /* In the meantime we do our own attention grabbing */
-    if (!SetForegroundWindow((HWND)w->winId()) &&
-            !SetForegroundWindowEx((HWND)w->winId()))  {
+    if (!SetForegroundWindow(wid) && !SetForegroundWindowEx(wid)) {
         OutputDebugString("SetForegroundWindow (ex) failed");
         /* Yet another fallback which will not work on some
          * versions and is not recommended by msdn */
-        if (!ShowWindow((HWND)w->winId(), SW_SHOWNORMAL)) {
+        if (!ShowWindow(wid, SW_SHOWNORMAL)) {
             OutputDebugString("ShowWindow failed.");
         }
     }
+    /* Even if SetForgeoundWindow / SetForegroundWinowEx don't fail
+     * we sometimes are still not in the foreground. So we try yet
+     * another hack by using SetWindowPos */
+    if (!SetWindowPos(wid, HWND_TOPMOST, 0, 0, 0, 0,
+                      SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW)) {
+        OutputDebugString("SetWindowPos failed.");
+    } else {
+        /* Without moving back to NOTOPMOST we just stay on top.
+         * Even if the user changes focus. */
+        SetWindowPos(wid, HWND_NOTOPMOST, 0, 0, 0, 0,
+                     SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
+    }
 #endif
 }
 

-----------------------------------------------------------------------

Summary of changes:
 qt/pinentrydialog.cpp | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
The standard pinentry collection
http://git.gnupg.org




More information about the Gnupg-commits mailing list