Subject: Bug#1601: Patch for x2goclient Qt5 build on Windows

From: Orion Poplawski <[email-masked]>
Date: Tue, 9 May 2023 10:56:08 -0600

Package: x2goclient
Version: 4.1.2.2
Tag: patch

When compiling against Qt5 5.15.9 I get:

../src/wapi.cpp: In function 'void wapiSetWindowIcon(HWND, const QPixmap&)':
../src/wapi.cpp:224:88: error: 'class QPixmap' has no member named 
'toWinHICON'
   224 |     largeIcon=icon.scaled(iconx,icony, 
Qt::IgnoreAspectRatio,Qt::SmoothTransformation).toWinHICON ();
       |                        ^~~~~~~~~~
../src/wapi.cpp:225:90: error: 'class QPixmap' has no member named 
'toWinHICON'
   225 |     smallIcon=icon.scaled(smallx,smally, 
Qt::IgnoreAspectRatio,Qt::SmoothTransformation).toWinHICON ();
       |                          ^~~~~~~~~~

Now, the only call to wapiSetWindowIcon() is commented out, so I just 
commented out the wapiSetWindowIcon() code as we...  Looks like the 
current function to use is QImage::toHICON().

I'm also curious that you need to shift to a Windows API call - 
shouldn't we be able to do everything in Qt?

-- 
Orion Poplawski
he/him/his  - surely the least important thing about me
IT Systems Manager                         720-772-5637
NWRA, Boulder/CoRA Office             FAX: 303-415-9702
3380 Mitchell Lane                       [email-masked]
Boulder, CO 80301                 https://www.nwra.com/

diff -up x2goclient-4.1.2.2/src/wapi.cpp.qt5 x2goclient-4.1.2.2/src/wapi.cpp
--- x2goclient-4.1.2.2/src/wapi.cpp.qt5	2023-05-05 15:01:45.035453899 -0600
+++ x2goclient-4.1.2.2/src/wapi.cpp	2023-05-05 15:02:24.001831740 -0600
@@ -211,6 +211,7 @@ bool wapiSetWindowText( HWND wnd, const
     return SetWindowText(wnd, (LPCTSTR)text.utf16() );
 }
 
+#if 0
 void wapiSetWindowIcon ( HWND wnd, const QPixmap& icon)
 {
     int iconx=GetSystemMetrics(SM_CXICON);
@@ -235,6 +236,7 @@ void wapiSetWindowIcon ( HWND wnd, const
     /*    ShowWindow(wnd, SW_HIDE);
         ShowWindow(wnd, SW_SHOW);*/
 }
+#endif
 
 QString wapiShortFileName ( const QString& longName )
 {
diff -up x2goclient-4.1.2.2/src/wapi.h.qt5 x2goclient-4.1.2.2/src/wapi.h
--- x2goclient-4.1.2.2/src/wapi.h.qt5	2020-02-13 03:36:07.000000000 -0700
+++ x2goclient-4.1.2.2/src/wapi.h	2023-05-05 15:02:47.697061506 -0600
@@ -55,7 +55,7 @@ bool wapiWindowRectWithoutDecoration(HWN
 bool wapiShowWindow ( HWND wnd, wapiCmdShow nCmdShow );
 bool wapiUpdateWindow ( HWND wnd );
 bool wapiSetWindowText ( HWND wnd, const QString& text);
-void wapiSetWindowIcon ( HWND wnd, const QPixmap& icon);
+//void wapiSetWindowIcon ( HWND wnd, const QPixmap& icon);
 bool wapiMoveWindow ( HWND wnd, int x, int y, int width, int height,
                       bool repaint );
 bool wapiGetBorders ( HWND wnd, int& vBorder, int& hBorder, int& barHeight );