summarylogtreecommitdiffstats
path: root/0005_release-keys-when-xfreerdp-is-unfocused-to-prevent-s.patch
blob: e45c21c9af0a17c0b4c088526abcc59710801ae0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
>From ffa7f0363fa4f0770d0f1ac451d7a5e87d415d7b Mon Sep 17 00:00:00 2001
From: Seray Rosh <seray.rosh@web.de>
Date: Fri, 27 Feb 2015 16:02:40 +0100
Subject: [PATCH] fix #778650: release keys when xfreerdp is unfocused to prevent stuck keys

This fixes https://bugs.debian.org/778650
Originated from https://github.com/FreeRDP/FreeRDP/pull/2430
Cherry picked from upstream commit ffa7f0363fa4f0770d0f1ac451d7a5e87d415d7b, ported for debian/1.1.0~git20140921.1.440916e+dfsg1-5

---

Signed-off-by: Petr Vorel <petr.vorel@gmail.com>
---
 client/X11/xf_event.c    | 1 +
 client/X11/xf_keyboard.c | 6 ++++++
 2 files changed, 7 insertions(+)

--- a/client/X11/xf_event.c
+++ b/client/X11/xf_event.c
@@ -456,6 +456,7 @@
 	if (event->xfocus.mode == NotifyWhileGrabbed)
 		XUngrabKeyboard(xfc->display, CurrentTime);
 
+	xf_kbd_release_all_keypress(xfc);
 	xf_kbd_clear(xfc);
 
 	if (app)
--- a/client/X11/xf_keyboard.c
+++ b/client/X11/xf_keyboard.c
@@ -75,6 +75,12 @@
 		if (xfc->pressed_keys[keycode] != NoSymbol)
 		{
 			rdp_scancode = freerdp_keyboard_get_rdp_scancode_from_x11_keycode(keycode);
+
+			// release tab before releasing the windows key.
+			// this stops the start menu from opening on unfocus event.
+			if (rdp_scancode == RDP_SCANCODE_LWIN)
+				freerdp_input_send_keyboard_event_ex(xfc->instance->input, FALSE, RDP_SCANCODE_TAB);
+
 			freerdp_input_send_keyboard_event_ex(xfc->instance->input, FALSE, rdp_scancode);
 			xfc->pressed_keys[keycode] = NoSymbol;
 		}