commit
1171083523
@ -0,0 +1,86 @@
|
||||
diff --git a/src/rcw.c b/src/rcw.c
|
||||
index d4093d3b4d91142290015adde0c8dece083d8fcd..27eb3bad1b7a4f4fa49639bd5040d12bea0c138c 100644
|
||||
--- a/src/rcw.c
|
||||
+++ b/src/rcw.c
|
||||
@@ -2060,6 +2060,14 @@ static void rcw_toolbar_tools(GtkToolItem *toggle, RemminaConnectionWindow *cnnw
|
||||
g_strfreev(keystroke_values);
|
||||
}
|
||||
menuitem = gtk_menu_item_new_with_label(_("Send clipboard content as keystrokes"));
|
||||
+ static gchar k_tooltip[] =
|
||||
+ N_("CAUTION! We send hardware codes from your local keyboard,\nmany characters can be different from the original text.\n"
|
||||
+ "\n"
|
||||
+ " • To get the best result, set the same keyboard on the client and server.\n"
|
||||
+ "\n"
|
||||
+ " • Non composable characters using your keyboard will not be transferred.\n"
|
||||
+ "\n");
|
||||
+ gtk_widget_set_tooltip_text(menuitem, k_tooltip);
|
||||
gtk_menu_shell_append(GTK_MENU_SHELL(submenu_keystrokes), menuitem);
|
||||
g_signal_connect_swapped(G_OBJECT(menuitem), "activate",
|
||||
G_CALLBACK(remmina_protocol_widget_send_clipboard),
|
||||
diff --git a/src/remmina_protocol_widget.c b/src/remmina_protocol_widget.c
|
||||
index 1c590b0fceaef6b024eb37d4d8ba2c9391b9976c..e4adfd2a6bc28b2d23ed5a17ae9c964fc141f139 100644
|
||||
--- a/src/remmina_protocol_widget.c
|
||||
+++ b/src/remmina_protocol_widget.c
|
||||
@@ -597,7 +597,7 @@ void remmina_protocol_widget_send_clip_strokes(GtkClipboard *clipboard, const gc
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
RemminaProtocolWidget *gp = REMMINA_PROTOCOL_WIDGET(data);
|
||||
- gchar *text = g_strdup(clip_text);
|
||||
+ gchar *text = g_utf8_normalize(clip_text, -1, G_NORMALIZE_DEFAULT_COMPOSE);
|
||||
guint *keyvals;
|
||||
gint i;
|
||||
GdkKeymap *keymap = gdk_keymap_get_for_display(gdk_display_get_default());
|
||||
@@ -634,18 +634,22 @@ void remmina_protocol_widget_send_clip_strokes(GtkClipboard *clipboard, const gc
|
||||
REMMINA_DEBUG("Text clipboard after replacement is \'%s\'", text);
|
||||
}
|
||||
gchar *iter = g_strdup(text);
|
||||
+ REMMINA_DEBUG("Iter: %s", iter),
|
||||
keyvals = (guint *)g_malloc(strlen(text));
|
||||
while (TRUE) {
|
||||
/* Process each character in the keystrokes */
|
||||
character = g_utf8_get_char_validated(iter, -1);
|
||||
+ REMMINA_DEBUG("Char: U+%04" G_GINT32_FORMAT"X", character);
|
||||
if (character == 0)
|
||||
break;
|
||||
keyval = gdk_unicode_to_keyval(character);
|
||||
+ REMMINA_DEBUG("Keyval: %u", keyval);
|
||||
/* Replace all the special character with its keyval */
|
||||
for (i = 0; text_replaces[i].replace; i++) {
|
||||
if (character == text_replaces[i].replace[0]) {
|
||||
keys = g_new0(GdkKeymapKey, 1);
|
||||
keyval = text_replaces[i].keyval;
|
||||
+ REMMINA_DEBUG("Special Keyval: %u", keyval);
|
||||
/* A special character was generated, no keyval lookup needed */
|
||||
character = 0;
|
||||
break;
|
||||
@@ -655,7 +659,7 @@ void remmina_protocol_widget_send_clip_strokes(GtkClipboard *clipboard, const gc
|
||||
if (character) {
|
||||
/* get keyval without modifications */
|
||||
if (!gdk_keymap_get_entries_for_keyval(keymap, keyval, &keys, &n_keys)) {
|
||||
- g_warning("keyval 0x%04x has no keycode!", keyval);
|
||||
+ REMMINA_WARNING("keyval 0x%04x has no keycode!", keyval);
|
||||
iter = g_utf8_find_next_char(iter, NULL);
|
||||
continue;
|
||||
}
|
||||
@@ -2111,6 +2115,7 @@ void remmina_protocol_widget_send_keys_signals(GtkWidget *widget, const guint *k
|
||||
event.keyval = keyvals[i];
|
||||
event.hardware_keycode = remmina_public_get_keycode_for_keyval(keymap, event.keyval);
|
||||
event.is_modifier = (int)remmina_public_get_modifier_for_keycode(keymap, event.hardware_keycode);
|
||||
+ REMMINA_DEBUG("Sending keyval: %u, hardware_keycode: %u", event.keyval, event.hardware_keycode);
|
||||
g_signal_emit_by_name(G_OBJECT(widget), "key-press-event", &event, &result);
|
||||
}
|
||||
}
|
||||
diff --git a/src/remmina_public.c b/src/remmina_public.c
|
||||
index 02ff5c7d997e132598583fe415149856fee90111..5c5c4640df669705be008db0e3103329d5e6092c 100644
|
||||
--- a/src/remmina_public.c
|
||||
+++ b/src/remmina_public.c
|
||||
@@ -541,7 +541,8 @@ guint16 remmina_public_get_keycode_for_keyval(GdkKeymap *keymap, guint keyval)
|
||||
gboolean remmina_public_get_modifier_for_keycode(GdkKeymap *keymap, guint16 keycode)
|
||||
{
|
||||
TRACE_CALL(__func__);
|
||||
- g_return_val_if_fail(keycode > 0, FALSE);
|
||||
+ //g_return_val_if_fail(keycode > 0, FALSE);
|
||||
+ if (keycode > 0) return FALSE;
|
||||
#ifdef GDK_WINDOWING_X11
|
||||
return gdk_x11_keymap_key_is_modifier(keymap, keycode);
|
||||
#else
|
Loading…
Reference in new issue