about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorMarco Peereboom <marco@conformal.com>2011-08-21 17:01:06 +0000
committerMarco Peereboom <marco@conformal.com>2011-08-21 17:01:06 +0000
commit174fab26ab1f6ef3f9f6e3aa94f251f2511db5ed (patch)
tree777abf477185f8ffcd256f49e47ae632f5ed2721
parent15623501c8e8874dceadc665c9ae8983c481f793 (diff)
downloadxombrero-174fab26ab1f6ef3f9f6e3aa94f251f2511db5ed.tar.gz
Instead of forcing the xterm clipboard workaround make it an option.
It is disable by default because we expect xterm to soon fix this bug.
-rw-r--r--xxxterm.17
-rw-r--r--xxxterm.c15
-rw-r--r--xxxterm.conf1
3 files changed, 19 insertions, 4 deletions
diff --git a/xxxterm.1 b/xxxterm.1
index 77b4125..a5d0230 100644
--- a/xxxterm.1
+++ b/xxxterm.1
@@ -1046,6 +1046,13 @@ Set the work directory where all
 scratch files are stored.
 Default is
 .Cm ~/.xxxterm .
+.It Cm xterm_workaround
+When enabled
+.Nm
+will look additionally at CUT_BUFFER0 if PRIMARY clipboard is empty.
+Additionally when the PRIMARY clipboard is cleared it will copy CUT_BUFFER0
+into the PRIMARY clipboard.
+Default is 0.
 .El
 .Sh HISTORY
 .Nm
diff --git a/xxxterm.c b/xxxterm.c
index c1ae61b..dd63865 100644
--- a/xxxterm.c
+++ b/xxxterm.c
@@ -561,6 +561,7 @@ gint		max_connections = 25;
 gint		max_host_connections = 5;
 gint		enable_spell_checking = 0;
 char		*spell_check_languages = NULL;
+int		xterm_workaround = 0;
 
 char		*cmd_font_name = NULL;
 char		*oops_font_name = NULL;
@@ -742,6 +743,7 @@ struct settings {
 	{ "window_height",		XT_S_INT, 0,		&window_height, NULL, NULL },
 	{ "window_width",		XT_S_INT, 0,		&window_width, NULL, NULL },
 	{ "work_dir",			XT_S_STR, 0, NULL, NULL,&s_work_dir },
+	{ "xterm_workaround",		XT_S_INT, 0,		&xterm_workaround, NULL, NULL },
 
 	/* font settings */
 	{ "cmd_font",			XT_S_STR, 0, NULL, &cmd_font_name, NULL },
@@ -2556,7 +2558,7 @@ paste_uri(struct tab *t, struct karg *args)
 	p = gtk_clipboard_wait_for_text(clipboard);
 
 	/* if it failed get whatever text is in cut_buffer0 */
-	if (p == NULL)
+	if (p == NULL && xterm_workaround)
 		if (gdk_property_get(gdk_get_default_root_window(),
 		    atom,
 		    gdk_atom_intern("STRING", FALSE),
@@ -8799,6 +8801,9 @@ clipb_primary_cb(GtkClipboard *primary, GdkEvent *event, gpointer notused)
 	GdkAtom			atom = gdk_atom_intern("CUT_BUFFER0", FALSE);
 	gint			len;
 
+	if (xterm_workaround == 0)
+		return;
+
 	/*
 	 * xterm doesn't play nice with clipboards because it clears the
 	 * primary when clicked.  We rely on primary being set to properly
@@ -8888,9 +8893,11 @@ create_canvas(void)
 	}
 	gtk_window_set_default_icon_list(l);
 
-	/* clipboard */
-	g_signal_connect(G_OBJECT(gtk_clipboard_get(GDK_SELECTION_PRIMARY)),
-	    "owner-change", G_CALLBACK(clipb_primary_cb), NULL);
+	/* clipboard work around */
+	if (xterm_workaround)
+		g_signal_connect(
+		    G_OBJECT(gtk_clipboard_get(GDK_SELECTION_PRIMARY)),
+		    "owner-change", G_CALLBACK(clipb_primary_cb), NULL);
 
 	gtk_widget_show_all(abtn);
 	gtk_widget_show_all(main_window);
diff --git a/xxxterm.conf b/xxxterm.conf
index 234f752..4587b88 100644
--- a/xxxterm.conf
+++ b/xxxterm.conf
@@ -30,6 +30,7 @@
 # guess_search		= 0
 # enable_spell_checking	= 1
 # spell_check_languages	= en_US
+# xterm_workaround	= 1
 
 #
 # default_script points to a script executed by the run_script command.