gnu: Add kafs-client
[jackhill/guix/guix.git] / gnu / packages / patches / vinagre-newer-freerdp.patch
1 https://gitlab.gnome.org/GNOME/vinagre/merge_requests/4.patch
2
3 From 83ec3835c36d5cd2c957512c18d21a33b4136c95 Mon Sep 17 00:00:00 2001
4 From: Ondrej Holy <oholy@redhat.com>
5 Date: Tue, 20 Nov 2018 14:57:17 +0100
6 Subject: [PATCH 1/2] Fix build with recent FreeRDP versions
7
8 Vinagre is not buildable with recent FreeRDP versions and similar patches
9 are used by distributions to fix that. I have also removed some old
10 compatibility codes, because it wasn't buildable against 1.0, nor 1.1
11 anyway and 1.2 has never been officially released and is superseded by 2.0.
12
13 https://gitlab.gnome.org/GNOME/vinagre/issues/4
14 ---
15 configure.ac | 7 +-
16 plugins/rdp/vinagre-rdp-tab.c | 129 +++++++---------------------------
17 2 files changed, 27 insertions(+), 109 deletions(-)
18
19 diff --git a/configure.ac b/configure.ac
20 index 5b51a82..61617f1 100644
21 --- a/configure.ac
22 +++ b/configure.ac
23 @@ -58,16 +58,15 @@ AS_IF([test "x$have_ssh" = "xyes"],
24 AM_CONDITIONAL([VINAGRE_ENABLE_SSH], [test "x$have_ssh" = "xyes"])
25
26 # Whether to enable support for RDP.
27 -RDP_DEPS="freerdp x11"
28 +RDP_DEPS="freerdp2 x11"
29 +
30 AC_ARG_ENABLE([rdp],
31 [AS_HELP_STRING([--disable-rdp],
32 [Disable Remote Desktop Protocol (RDP) support])])
33
34 AS_IF([test "x$enable_rdp" != "xno"],
35 [PKG_CHECK_EXISTS([$RDP_DEPS],
36 - [have_rdp=yes
37 - PKG_CHECK_EXISTS(freerdp >= 1.1,
38 - [AC_DEFINE([HAVE_FREERDP_1_1], [1], [FreeRDP is of version 1.1 or newer])], [])],
39 + [have_rdp=yes],
40 [have_rdp=no])],
41 [have_rdp=no])
42
43 diff --git a/plugins/rdp/vinagre-rdp-tab.c b/plugins/rdp/vinagre-rdp-tab.c
44 index 5b98c24..28e3eb6 100644
45 --- a/plugins/rdp/vinagre-rdp-tab.c
46 +++ b/plugins/rdp/vinagre-rdp-tab.c
47 @@ -29,12 +29,7 @@
48 #include <freerdp/types.h>
49 #include <freerdp/freerdp.h>
50 #include <freerdp/gdi/gdi.h>
51 -#if HAVE_FREERDP_1_1
52 #include <freerdp/locale/keyboard.h>
53 -#else
54 -#include <freerdp/kbd/vkcodes.h>
55 -#include <gdk/gdkx.h>
56 -#endif
57
58 #include "vinagre-rdp-tab.h"
59 #include "vinagre-rdp-connection.h"
60 @@ -44,12 +39,6 @@
61
62 #define SELECT_TIMEOUT 50
63
64 -#if !HAVE_FREERDP_1_1
65 -typedef boolean BOOL;
66 -typedef uint8 UINT8;
67 -typedef uint16 UINT16;
68 -#endif
69 -
70 struct _VinagreRdpTabPrivate
71 {
72 freerdp *freerdp_session;
73 @@ -476,16 +465,18 @@ frdp_drawing_area_draw (GtkWidget *area,
74 return TRUE;
75 }
76
77 -static void
78 +static BOOL
79 frdp_begin_paint (rdpContext *context)
80 {
81 rdpGdi *gdi = context->gdi;
82
83 gdi->primary->hdc->hwnd->invalid->null = 1;
84 gdi->primary->hdc->hwnd->ninvalid = 0;
85 +
86 + return TRUE;
87 }
88
89 -static void
90 +static BOOL
91 frdp_end_paint (rdpContext *context)
92 {
93 VinagreRdpTab *rdp_tab = ((frdpContext *) context)->rdp_tab;
94 @@ -495,7 +486,7 @@ frdp_end_paint (rdpContext *context)
95 gint x, y, w, h;
96
97 if (gdi->primary->hdc->hwnd->invalid->null)
98 - return;
99 + return TRUE;
100
101 x = gdi->primary->hdc->hwnd->invalid->x;
102 y = gdi->primary->hdc->hwnd->invalid->y;
103 @@ -517,6 +508,8 @@ frdp_end_paint (rdpContext *context)
104 {
105 gtk_widget_queue_draw_area (priv->display, x, y, w, h);
106 }
107 +
108 + return TRUE;
109 }
110
111 static BOOL
112 @@ -524,7 +517,6 @@ frdp_pre_connect (freerdp *instance)
113 {
114 rdpSettings *settings = instance->settings;
115
116 -#if HAVE_FREERDP_1_1
117 settings->OrderSupport[NEG_DSTBLT_INDEX] = TRUE;
118 settings->OrderSupport[NEG_PATBLT_INDEX] = TRUE;
119 settings->OrderSupport[NEG_SCRBLT_INDEX] = TRUE;
120 @@ -549,32 +541,6 @@ frdp_pre_connect (freerdp *instance)
121 settings->OrderSupport[NEG_POLYGON_CB_INDEX] = FALSE;
122 settings->OrderSupport[NEG_ELLIPSE_SC_INDEX] = FALSE;
123 settings->OrderSupport[NEG_ELLIPSE_CB_INDEX] = FALSE;
124 -#else
125 - settings->order_support[NEG_DSTBLT_INDEX] = true;
126 - settings->order_support[NEG_PATBLT_INDEX] = true;
127 - settings->order_support[NEG_SCRBLT_INDEX] = true;
128 - settings->order_support[NEG_OPAQUE_RECT_INDEX] = true;
129 - settings->order_support[NEG_DRAWNINEGRID_INDEX] = false;
130 - settings->order_support[NEG_MULTIDSTBLT_INDEX] = false;
131 - settings->order_support[NEG_MULTIPATBLT_INDEX] = false;
132 - settings->order_support[NEG_MULTISCRBLT_INDEX] = false;
133 - settings->order_support[NEG_MULTIOPAQUERECT_INDEX] = true;
134 - settings->order_support[NEG_MULTI_DRAWNINEGRID_INDEX] = false;
135 - settings->order_support[NEG_LINETO_INDEX] = true;
136 - settings->order_support[NEG_POLYLINE_INDEX] = true;
137 - settings->order_support[NEG_MEMBLT_INDEX] = true;
138 - settings->order_support[NEG_MEM3BLT_INDEX] = false;
139 - settings->order_support[NEG_MEMBLT_V2_INDEX] = true;
140 - settings->order_support[NEG_MEM3BLT_V2_INDEX] = false;
141 - settings->order_support[NEG_SAVEBITMAP_INDEX] = false;
142 - settings->order_support[NEG_GLYPH_INDEX_INDEX] = true;
143 - settings->order_support[NEG_FAST_INDEX_INDEX] = true;
144 - settings->order_support[NEG_FAST_GLYPH_INDEX] = false;
145 - settings->order_support[NEG_POLYGON_SC_INDEX] = false;
146 - settings->order_support[NEG_POLYGON_CB_INDEX] = false;
147 - settings->order_support[NEG_ELLIPSE_SC_INDEX] = false;
148 - settings->order_support[NEG_ELLIPSE_CB_INDEX] = false;
149 -#endif
150
151 return TRUE;
152 }
153 @@ -587,15 +553,7 @@ frdp_post_connect (freerdp *instance)
154 rdpGdi *gdi;
155 int stride;
156
157 - gdi_init (instance,
158 -#if defined(FREERDP_VERSION_MAJOR) && defined(FREERDP_VERSION_MINOR) && \
159 - !(FREERDP_VERSION_MAJOR > 1 || (FREERDP_VERSION_MAJOR == 1 && \
160 - FREERDP_VERSION_MINOR >= 2))
161 - CLRBUF_24BPP,
162 -#else
163 - CLRBUF_32BPP,
164 -#endif
165 - NULL);
166 + gdi_init (instance, PIXEL_FORMAT_BGRA32);
167 gdi = instance->context->gdi;
168
169 instance->update->BeginPaint = frdp_begin_paint;
170 @@ -705,21 +663,15 @@ frdp_key_pressed (GtkWidget *widget,
171 VinagreRdpTab *rdp_tab = (VinagreRdpTab *) user_data;
172 VinagreRdpTabPrivate *priv = rdp_tab->priv;
173 frdpEventKey *frdp_event;
174 -#if HAVE_FREERDP_1_1
175 UINT16 scancode;
176 -#endif
177
178 frdp_event = g_new0 (frdpEventKey, 1);
179 frdp_event->type = FRDP_EVENT_TYPE_KEY;
180 frdp_event->flags = event->type == GDK_KEY_PRESS ? KBD_FLAGS_DOWN : KBD_FLAGS_RELEASE;
181
182 -#if HAVE_FREERDP_1_1
183 scancode = freerdp_keyboard_get_rdp_scancode_from_x11_keycode (event->hardware_keycode);
184 frdp_event->code = RDP_SCANCODE_CODE(scancode);
185 frdp_event->extended = RDP_SCANCODE_EXTENDED(scancode);
186 -#else
187 - frdp_event->code = freerdp_kbd_get_scancode_by_keycode (event->hardware_keycode, &frdp_event->extended);
188 -#endif
189
190 if (frdp_event->extended)
191 frdp_event->flags |= KBD_FLAGS_EXTENDED;
192 @@ -934,11 +886,13 @@ frdp_authenticate (freerdp *instance,
193 return TRUE;
194 }
195
196 -static BOOL
197 +static DWORD
198 frdp_certificate_verify (freerdp *instance,
199 - char *subject,
200 - char *issuer,
201 - char *fingerprint)
202 + const char *common_name,
203 + const char *subject,
204 + const char *issuer,
205 + const char *fingerprint,
206 + BOOL host_mismatch)
207 {
208 VinagreTab *tab = VINAGRE_TAB (((frdpContext *) instance->context)->rdp_tab);
209 GtkBuilder *builder;
210 @@ -968,17 +922,18 @@ frdp_certificate_verify (freerdp *instance,
211 gtk_widget_hide (dialog);
212
213
214 - return response == GTK_RESPONSE_YES;
215 + return (response == GTK_RESPONSE_YES) ? 1 : 0;
216 }
217
218 -
219 -#if HAVE_FREERDP_1_1
220 -static BOOL
221 +static DWORD
222 frdp_changed_certificate_verify (freerdp *instance,
223 - char *subject,
224 - char *issuer,
225 - char *new_fingerprint,
226 - char *old_fingerprint)
227 + const char *common_name,
228 + const char *subject,
229 + const char *issuer,
230 + const char *new_fingerprint,
231 + const char *old_subject,
232 + const char *old_issuer,
233 + const char *old_fingerprint)
234 {
235 VinagreTab *tab = VINAGRE_TAB (((frdpContext *) instance->context)->rdp_tab);
236 GtkBuilder *builder;
237 @@ -1023,9 +978,8 @@ frdp_changed_certificate_verify (freerdp *instance,
238 gtk_widget_hide (dialog);
239
240
241 - return response == GTK_RESPONSE_YES;
242 + return (response == GTK_RESPONSE_YES) ? 1 : 0;
243 }
244 -#endif
245
246 static void
247 init_freerdp (VinagreRdpTab *rdp_tab)
248 @@ -1053,15 +1007,9 @@ init_freerdp (VinagreRdpTab *rdp_tab)
249 priv->freerdp_session->PostConnect = frdp_post_connect;
250 priv->freerdp_session->Authenticate = frdp_authenticate;
251 priv->freerdp_session->VerifyCertificate = frdp_certificate_verify;
252 -#if HAVE_FREERDP_1_1
253 priv->freerdp_session->VerifyChangedCertificate = frdp_changed_certificate_verify;
254 -#endif
255
256 -#if HAVE_FREERDP_1_1
257 priv->freerdp_session->ContextSize = sizeof (frdpContext);
258 -#else
259 - priv->freerdp_session->context_size = sizeof (frdpContext);
260 -#endif
261
262 freerdp_context_new (priv->freerdp_session);
263 ((frdpContext *) priv->freerdp_session->context)->rdp_tab = rdp_tab;
264 @@ -1070,53 +1018,24 @@ init_freerdp (VinagreRdpTab *rdp_tab)
265 settings = priv->freerdp_session->settings;
266
267 /* Security settings */
268 -#if HAVE_FREERDP_1_1
269 settings->RdpSecurity = TRUE;
270 settings->TlsSecurity = TRUE;
271 settings->NlaSecurity = TRUE;
272 settings->EncryptionMethods = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
273 settings->EncryptionLevel = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
274 -#else
275 - settings->rdp_security = true;
276 - settings->tls_security = true;
277 - settings->nla_security = true;
278 - settings->encryption = true;
279 - settings->encryption_method = ENCRYPTION_METHOD_40BIT | ENCRYPTION_METHOD_128BIT | ENCRYPTION_METHOD_FIPS;
280 - settings->encryption_level = ENCRYPTION_LEVEL_CLIENT_COMPATIBLE;
281 -#endif
282 -#include <freerdp/version.h>
283 -#if (FREERDP_VERSION_MAJOR == 1 && FREERDP_VERSION_MINOR >= 2 && FREERDP_VERSION_REVISION >= 1) || (FREERDP_VERSION_MAJOR == 2)
284 settings->UseRdpSecurityLayer = FALSE;
285 -#else
286 - settings->DisableEncryption = FALSE;
287 -#endif
288
289 /* Set display size */
290 -#if HAVE_FREERDP_1_1
291 settings->DesktopWidth = width;
292 settings->DesktopHeight = height;
293 -#else
294 - settings->width = width;
295 - settings->height = height;
296 -#endif
297
298 /* Set hostname */
299 -#if HAVE_FREERDP_1_1
300 settings->WindowTitle = g_strdup (hostname);
301 settings->ServerHostname = g_strdup (hostname);
302 settings->ServerPort = port;
303 -#else
304 - settings->window_title = g_strdup (hostname);
305 - settings->hostname = g_strdup (hostname);
306 - settings->port = port;
307 -#endif
308
309 /* Set keyboard layout */
310 -#if HAVE_FREERDP_1_1
311 freerdp_keyboard_init (KBD_US);
312 -#else
313 - freerdp_kbd_init (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ()), KBD_US);
314 -#endif
315
316 /* Allow font smoothing by default */
317 settings->AllowFontSmoothing = TRUE;
318 --
319 2.18.1
320