Commit 759c2db997a171292339fa468c8d8d48740d3e5b

Authored by Perry Werneck
1 parent 8b5c2af6
Exists in master and in 1 other branch develop

Paste formatted screen only if the "smart paste" toggle is enabled.

Showing 1 changed file with 6 additions and 2 deletions   Show diff stats
src/selection/linux/paste.c
@@ -28,6 +28,7 @@ @@ -28,6 +28,7 @@
28 */ 28 */
29 29
30 #include <clipboard.h> 30 #include <clipboard.h>
  31 + #include <lib3270/toggle.h>
31 32
32 /*--[ Implement ]------------------------------------------------------------------------------------*/ 33 /*--[ Implement ]------------------------------------------------------------------------------------*/
33 34
@@ -149,7 +150,10 @@ static void formatted_received(GtkClipboard *clipboard, GtkSelectionData *select @@ -149,7 +150,10 @@ static void formatted_received(GtkClipboard *clipboard, GtkSelectionData *select
149 150
150 static void targets_received(GtkClipboard *clipboard, GdkAtom *atoms, gint n_atoms, GtkWidget *widget) 151 static void targets_received(GtkClipboard *clipboard, GdkAtom *atoms, gint n_atoms, GtkWidget *widget)
151 { 152 {
152 - if(has_target(GTK_V3270_GET_CLASS(widget)->clipboard_formatted,atoms,n_atoms)) 153 +
  154 + // If smart paste is enabled try to get formatted clipboard.
  155 + debug("%s: Smart paste is %s", __FUNCTION__, (lib3270_toggle(GTK_V3270(widget)->host,LIB3270_TOGGLE_SMART_PASTE) ? "enabled" : "disabled"));
  156 + if(lib3270_toggle(GTK_V3270(widget)->host,LIB3270_TOGGLE_SMART_PASTE) && has_target(GTK_V3270_GET_CLASS(widget)->clipboard_formatted,atoms,n_atoms))
153 { 157 {
154 debug("Clipboard as TN3270 \"%s\" data",gdk_atom_name(GTK_V3270_GET_CLASS(widget)->clipboard_formatted)); 158 debug("Clipboard as TN3270 \"%s\" data",gdk_atom_name(GTK_V3270_GET_CLASS(widget)->clipboard_formatted));
155 159
@@ -163,7 +167,7 @@ static void targets_received(GtkClipboard *clipboard, GdkAtom *atoms, gint n_ato @@ -163,7 +167,7 @@ static void targets_received(GtkClipboard *clipboard, GdkAtom *atoms, gint n_ato
163 return; 167 return;
164 } 168 }
165 169
166 - // No special format available, request it as text. 170 + // No smart paste or formatted data on clipboard, request as text.
167 gtk_clipboard_request_text( 171 gtk_clipboard_request_text(
168 clipboard, 172 clipboard,
169 (GtkClipboardTextReceivedFunc) text_received, 173 (GtkClipboardTextReceivedFunc) text_received,