Add Patch for pinentry-qt foreground window
authorAndre Heinecke <aheinecke@intevation.de>
Fri, 4 Mar 2016 14:50:53 +0000 (15:50 +0100)
committerAndre Heinecke <aheinecke@intevation.de>
Fri, 4 Mar 2016 14:50:53 +0000 (15:50 +0100)
* Makefile.am (EXTRA_DIST): Add patch.
* patches/pinentry-0.9.7/
Qt-Fix-Windows-foreground-window-hacks-for-Qt5.patch: New.

--
Patch is already commited to pinentry master.

Makefile.am
patches/pinentry-0.9.7/Qt-Fix-Windows-foreground-window-hacks-for-Qt5.patch [new file with mode: 0755]

index e167793..9ed96fe 100644 (file)
@@ -57,7 +57,8 @@ EXTRA_DIST = autogen.sh README.GIT ONEWS \
         patches/kleopatra/0003-Add-option-to-disable-KWatchGnuPG.patch \
         patches/kleopatra/0004-Make-DBus-integration-of-the-smime-conf-optional.patch \
         patches/kleopatra/0005-Hack-generated-conf-files-for-Crosscompiling.patch \
-        patches/kcoreaddons/0001-Fix-Kdelibs4-config-migration-for-Windows.patch
+        patches/kcoreaddons/0001-Fix-Kdelibs4-config-migration-for-Windows.patch \
+        patches/pinentry-0.9.7/Qt-Fix-Windows-foreground-window-hacks-for-Qt5.patch
 
 copy-news:
        cp NEWS doc/website/NEWS.last
diff --git a/patches/pinentry-0.9.7/Qt-Fix-Windows-foreground-window-hacks-for-Qt5.patch b/patches/pinentry-0.9.7/Qt-Fix-Windows-foreground-window-hacks-for-Qt5.patch
new file mode 100755 (executable)
index 0000000..80312c1
--- /dev/null
@@ -0,0 +1,61 @@
+#! /bin/sh
+patch -p1 -l -f $* < $0
+exit $?
+
+From a651fe1023be21d01f43864927965e92185af892 Mon Sep 17 00:00:00 2001
+From: Andre Heinecke <aheinecke@intevation.de>
+Date: Fri, 4 Mar 2016 15:44:26 +0100
+Subject: [PATCH 2/2] Qt: Fix Windows foreground window hacks for Qt5
+
+* qt/pinentrydialog.cpp: Use Q_OS_WIN instead of Q_WS_WIN
+ (SetForegroundWindowEx): Handle new Wid type with casts.
+
+--
+Q_WS_WIN is no longer defined by Qt5
+---
+ qt/pinentrydialog.cpp | 12 ++++++------
+ 1 file changed, 6 insertions(+), 6 deletions(-)
+
+diff --git a/qt/pinentrydialog.cpp b/qt/pinentrydialog.cpp
+index 81205ee..1b0d276 100644
+--- a/qt/pinentrydialog.cpp
++++ b/qt/pinentrydialog.cpp
+@@ -35,7 +35,7 @@
+ #include <QPalette>
+ #include <QLineEdit>
+
+-#ifdef Q_WS_WIN
++#ifdef Q_OS_WIN
+ #include <windows.h>
+ #endif
+
+@@ -51,7 +51,7 @@
+    does not always work (e.g. when the ForegroundWindow timeout
+    has not expired.
+    */
+-#ifdef Q_WS_WIN
++#ifdef Q_OS_WIN
+ WINBOOL SetForegroundWindowEx( HWND hWnd )
+ {
+    //Attach foreground window thread to our thread
+@@ -75,14 +75,14 @@ void raiseWindow( QWidget* w )
+     /* Maybe Qt will become agressive enough one day that
+      * this is enough on windows too*/
+     w->raise();
+-#ifdef Q_WS_WIN
++#ifdef Q_OS_WIN
+     /* In the meantime we do our own attention grabbing */
+-    if (!SetForegroundWindow (w->winId()) &&
+-            !SetForegroundWindowEx (w->winId()))  {
++    if (!SetForegroundWindow ((HWND)w->winId()) &&
++            !SetForegroundWindowEx ((HWND)w->winId()))  {
+         OutputDebugString("SetForegroundWindow (ex) failed");
+         /* Yet another fallback which will not work on some
+          * versions and is not recommended by msdn */
+-        if (!ShowWindow (w->winId(), SW_SHOWNORMAL)) {
++        if (!ShowWindow ((HWND)w->winId(), SW_SHOWNORMAL)) {
+             OutputDebugString ("ShowWindow failed.");
+         }
+     }
+--
+2.1.4