git: 2d95f2614dbe - main - sysutils/synergy: Fix build with Qt 6.9

From: Jason E. Hale <jhale_at_FreeBSD.org>
Date: Sun, 27 Apr 2025 03:13:07 UTC
The branch main has been updated by jhale:

URL: https://cgit.FreeBSD.org/ports/commit/?id=2d95f2614dbe14303a3fafe4c9d6f967daaf87a1

commit 2d95f2614dbe14303a3fafe4c9d6f967daaf87a1
Author:     Jason E. Hale <jhale@FreeBSD.org>
AuthorDate: 2025-04-27 03:08:26 +0000
Commit:     Jason E. Hale <jhale@FreeBSD.org>
CommitDate: 2025-04-27 03:09:39 +0000

    sysutils/synergy: Fix build with Qt 6.9
    
    With hat:       kde@
    PR:             286051
---
 .../files/patch-src_gui_src_KeySequence.cpp        | 24 ++++++++++++++++++++++
 .../synergy/files/patch-src_gui_src_KeySequence.h  | 17 +++++++++++++++
 2 files changed, 41 insertions(+)

diff --git a/sysutils/synergy/files/patch-src_gui_src_KeySequence.cpp b/sysutils/synergy/files/patch-src_gui_src_KeySequence.cpp
new file mode 100644
index 000000000000..752b3f931b15
--- /dev/null
+++ b/sysutils/synergy/files/patch-src_gui_src_KeySequence.cpp
@@ -0,0 +1,24 @@
+Fix build with Qt >= 6.9.0
+
+Backported from: https://github.com/symless/synergy/commit/f48514f57297112f8e1757c11b303dcedbb51644
+
+--- src/gui/src/KeySequence.cpp.orig	2024-08-30 21:23:08 UTC
++++ src/gui/src/KeySequence.cpp
+@@ -207,9 +207,14 @@ QString KeySequence::keyToString(int key) {
+   }
+ 
+   // representable in ucs2?
+-  if (key < 0x10000)
+-    return QString("\\u%1").arg(
+-        QChar(key).toLower().unicode(), 4, 16, QChar('0'));
++  if (key < 0x10000) {
++#if QT_VERSION >= QT_VERSION_CHECK(6, 9, 0)
++    const uint16_t keyHex = QChar(key).toLower().unicode();
++    return QString("\\u%1").arg(keyHex, kStrSize, kBase, kFillChar);
++#else
++    return QString("\\u%1").arg(QChar(key).toLower().unicode(), kStrSize, kBase, kFillChar);
++#endif
++  }
+ 
+   // give up, synergy probably won't handle this
+   return "";
diff --git a/sysutils/synergy/files/patch-src_gui_src_KeySequence.h b/sysutils/synergy/files/patch-src_gui_src_KeySequence.h
new file mode 100644
index 000000000000..e99c1804ff51
--- /dev/null
+++ b/sysutils/synergy/files/patch-src_gui_src_KeySequence.h
@@ -0,0 +1,17 @@
+Fix build with Qt >= 6.9.0
+
+Backported from: https://github.com/symless/synergy/commit/f48514f57297112f8e1757c11b303dcedbb51644
+
+--- src/gui/src/KeySequence.h.orig	2024-08-30 21:23:08 UTC
++++ src/gui/src/KeySequence.h
+@@ -52,6 +52,10 @@ class KeySequence { (private)
+   int m_Modifiers;
+   bool m_IsValid;
+ 
++  inline static const int kStrSize = 4;
++  inline static const int kBase = 16;
++  inline static const QChar kFillChar = QChar('0');
++
+   static QString keyToString(int key);
+ };
+