about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--xxxterm.c84
1 files changed, 21 insertions, 63 deletions
diff --git a/xxxterm.c b/xxxterm.c
index 2a4a0b3..abbe3f3 100644
--- a/xxxterm.c
+++ b/xxxterm.c
@@ -2553,7 +2553,7 @@ paste_uri(struct tab *t, struct karg *args)
 		    atom,
 		    gdk_atom_intern("STRING", FALSE),
 		    0,
-		    65536 /* picked out of my butt */,
+		    1024 * 1024 /* picked out of my butt */,
 		    FALSE,
 		    NULL,
 		    NULL,
@@ -8554,78 +8554,38 @@ button_set_stockid(GtkWidget *button, char *stockid)
 void
 clipb_primary_cb(GtkClipboard *primary, GdkEvent *event, gpointer notused)
 {
-	GtkClipboard		*clipboard;
-	gchar			*p = NULL, *s = NULL;
+	gchar			*p = NULL;
+	GdkAtom			atom = gdk_atom_intern("CUT_BUFFER0", FALSE);
+	gint			len;
 
 	/*
-	 * This code is very aggressive!
-	 * It basically ensures that the primary and regular clipboard are
-	 * always set the same.  This obviously messes with standard X protocol
-	 * but those clowns should have come up with something better.
+	 * xterm doesn't play nice with clipboards because it clears the
+	 * primary when clicked.  We rely on primary being set to properly
+	 * handle middle mouse button clicks (paste).  So when someone clears
+	 * primary copy whatever is in CUT_BUFFER0 into primary to simualte
+	 * other application behavior (as in DON'T clear primary).
 	 */
 
-	if (btn_down)
-		return;
-
-	clipboard = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
 	p = gtk_clipboard_wait_for_text(primary);
 	if (p == NULL) {
-		DNPRINTF(XT_D_CLIP, "primary cleaned\n");
-		p = gtk_clipboard_wait_for_text(clipboard);
-		if (p)
+		if (gdk_property_get(gdk_get_default_root_window(),
+		    atom,
+		    gdk_atom_intern("STRING", FALSE),
+		    0,
+		    1024 * 1024 /* picked out of my butt */,
+		    FALSE,
+		    NULL,
+		    NULL,
+		    &len,
+		    (guchar **)&p)) {
+			/* yes sir, we need to NUL the string */
+			p[len] = '\0';
 			gtk_clipboard_set_text(primary, p, -1);
-	} else {
-		DNPRINTF(XT_D_CLIP, "primary got selection\n");
-		s = gtk_clipboard_wait_for_text(clipboard);
-		if (s) {
-			/*
-			 * if s and p are the same the string was set by
-			 * clipb_clipboard_cb so do nothing in that case
-			 * to prevent endless loop
-			 */
-			if (!strcmp(s, p))
-				goto done;
 		}
-		gtk_clipboard_set_text(clipboard, p, -1);
 	}
-done:
-	if (p)
-		g_free(p);
-	if (s)
-		g_free(s);
-}
-
-void
-clipb_clipboard_cb(GtkClipboard *clipboard, GdkEvent *event, gpointer notused)
-{
-	GtkClipboard		*primary;
-	gchar			*p = NULL, *s = NULL;
-
-	if (btn_down)
-		return;
 
-	DNPRINTF(XT_D_CLIP, "clipboard got content\n");
-
-	primary = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
-	p = gtk_clipboard_wait_for_text(clipboard);
-	if (p) {
-		s = gtk_clipboard_wait_for_text(primary);
-		if (s) {
-			/*
-			 * if s and p are the same the string was set by
-			 * clipb_primary_cb so do nothing in that case
-			 * to prevent endless loop and deselection of text
-			 */
-			if (!strcmp(s, p))
-				goto done;
-		}
-		gtk_clipboard_set_text(primary, p, -1);
-	}
-done:
 	if (p)
 		g_free(p);
-	if (s)
-		g_free(s);
 }
 
 void
@@ -8690,8 +8650,6 @@ create_canvas(void)
 	/* clipboard */
 	g_signal_connect(G_OBJECT(gtk_clipboard_get(GDK_SELECTION_PRIMARY)),
 	    "owner-change", G_CALLBACK(clipb_primary_cb), NULL);
-	g_signal_connect(G_OBJECT(gtk_clipboard_get(GDK_SELECTION_CLIPBOARD)),
-	    "owner-change", G_CALLBACK(clipb_clipboard_cb), NULL);
 
 	gtk_widget_show_all(abtn);
 	gtk_widget_show_all(main_window);
r.Word */ .highlight .w { color: #bbbbbb } /* Text.Whitespace */ .highlight .mb { color: #0000DD; font-weight: bold } /* Literal.Number.Bin */ .highlight .mf { color: #0000DD; font-weight: bold } /* Literal.Number.Float */ .highlight .mh { color: #0000DD; font-weight: bold } /* Literal.Number.Hex */ .highlight .mi { color: #0000DD; font-weight: bold } /* Literal.Number.Integer */ .highlight .mo { color: #0000DD; font-weight: bold } /* Literal.Number.Oct */ .highlight .sa { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Affix */ .highlight .sb { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Backtick */ .highlight .sc { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Char */ .highlight .dl { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Delimiter */ .highlight .sd { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Doc */ .highlight .s2 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Double */ .highlight .se { color: #0044dd; background-color: #fff0f0 } /* Literal.String.Escape */ .highlight .sh { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Heredoc */ .highlight .si { color: #3333bb; background-color: #fff0f0 } /* Literal.String.Interpol */ .highlight .sx { color: #22bb22; background-color: #f0fff0 } /* Literal.String.Other */ .highlight .sr { color: #008800; background-color: #fff0ff } /* Literal.String.Regex */ .highlight .s1 { color: #dd2200; background-color: #fff0f0 } /* Literal.String.Single */ .highlight .ss { color: #aa6600; background-color: #fff0f0 } /* Literal.String.Symbol */ .highlight .bp { color: #003388 } /* Name.Builtin.Pseudo */ .highlight .fm { color: #0066bb; font-weight: bold } /* Name.Function.Magic */ .highlight .vc { color: #336699 } /* Name.Variable.Class */ .highlight .vg { color: #dd7700 } /* Name.Variable.Global */ .highlight .vi { color: #3333bb } /* Name.Variable.Instance */ .highlight .vm { color: #336699 } /* Name.Variable.Magic */ .highlight .il { color: #0000DD; font-weight: bold } /* Literal.Number.Integer.Long */
[colours]
bkgnd=default
titlebar=blue
titlebar.text=bold_white
titlebar.brackets=bold_white
titlebar.unencrypted=bold_red
titlebar.encrypted=bold_white
titlebar.untrusted=bold_yellow
titlebar.trusted=bold_white
titlebar.online=bold_green
titlebar.offline=bold_red
titlebar.away=bold_cyan
titlebar.xa=bold_cyan
titlebar.dnd=bold_red
titlebar.chat=bold_green
statusbar=blue
statusbar.text=bold_white
statusbar.time=bold_white
statusbar.brackets=bold_white
statusbar.active=bold_cyan
statusbar.new=bold_white
main.text=white
main.text.me=cyan
main.text.them=bold_white
main.splash=bold_red
main.help.header=bold_white
main.time=yellow
input.text=bold_green
subscribed=green
unsubscribed=red
otr.started.trusted=green
otr.started.untrusted=yellow
otr.ended=red
otr.trusted=green
otr.untrusted=yellow
online=green
away=cyan
chat=white
dnd=magenta
xa=blue
offline=red
incoming=bold_yellow
mention=bold_cyan
trigger=bold_blue
typing=yellow
gone=red
error=red
roominfo=yellow
roommention=bold_white
roommention.term=bold_cyan
roomtrigger=bold_white
roomtrigger.term=bold_blue
me=blue
them=bold_green
roster.header=bold_yellow
roster.chat=white
roster.online=green
roster.away=cyan
roster.xa=blue
roster.dnd=magenta
roster.offline=red
roster.chat.active=white
roster.online.active=green
roster.away.active=cyan
roster.xa.active=blue
roster.dnd.active=magenta
roster.offline.active=red
roster.chat.unread=bold_white
roster.online.unread=bold_green
roster.away.unread=bold_cyan
roster.xa.unread=bold_blue
roster.dnd.unread=bold_magenta
roster.offline.unread=bold_red
roster.room=green
roster.room.unread=bold_green
roster.room.mention=bold_cyan
roster.room.trigger=bold_blue
occupants.header=bold_yellow
receipt.sent=bold_black

[ui]
beep=false
flash=false
splash=true
wrap=true
time.console=%H:%M:%S
time.chat=%H:%M:%S
time.muc=%H:%M:%S
time.config=off
time.private=%H:%M:%S
time.xmlconsole=off
time.statusbar=%H:%M:%S
time.lastactivity=%d/%m/%y %H:%M:%S
privileges=true
presence=true
intype=true
enc.warn=true
resource.title=true
resource.message=true
statuses.console=none
statuses.chat=none
statuses.muc=none
roster=true
roster.offline=false
roster.empty=false
roster.by=group
roster.order=presence
roster.unread=after
roster.priority=false
roster.size=30
roster.wrap=true
roster.header.char=@
roster.contact.indent=1
roster.resource=true
roster.resource.char=/
roster.resource.indent=1
roster.resource.join=true
roster.presence=true
roster.presence.indent=-1
roster.status=true
roster.contacts=true
roster.unsubscribed=true
roster.rooms=true
roster.rooms.order=name
roster.rooms.unread=after
roster.rooms.pos=last
roster.rooms.by=none
roster.rooms.private.char=/
roster.private=room
roster.count=unread
roster.count.zero=false
occupants=true
occupants.size=15
occupants.jid=false
wins.autotidy=true
otr.char=@
pgp.char=%
omemo.char=*
tls.show=true
console.muc=first
console.chat=all
console.private=all
titlebar.position=1
mainwin.position=2
statusbar.position=3
inputwin.position=4