SF.net SVN: geany: [418] trunk/src/callbacks.c

eht16 at users.sourceforge.net eht16 at xxxxx
Tue Jun 6 19:06:43 UTC 2006


Revision: 418
Author:   eht16
Date:     2006-06-06 12:06:38 -0700 (Tue, 06 Jun 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=418&view=rev

Log Message:
-----------
test own pasting code

Modified Paths:
--------------
    trunk/src/callbacks.c
Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2006-06-06 17:53:03 UTC (rev 417)
+++ trunk/src/callbacks.c	2006-06-06 19:06:38 UTC (rev 418)
@@ -972,8 +972,25 @@
 	}
 #endif
 
-	//if (event->type == GDK_2BUTTON_PRESS) geany_debug("double click");
+	// experimental code to simulate pasting by middle mouse button
+	if (event->button == 2)
+	{
+		GtkClipboard *cp = gtk_clipboard_get(gdk_atom_intern("PRIMARY", FALSE));
 
+		if (gtk_clipboard_wait_is_text_available(cp))
+		{
+			gint idx = document_get_cur_idx();
+			gchar *text = gtk_clipboard_wait_for_text(cp);
+
+			if (idx >= 0 && text != NULL)
+			{
+				sci_add_text(doc_list[idx].sci, text);
+				g_free(text);
+				return TRUE;
+			}
+		}
+	}
+
 	if (event->button == 3)
 	{
 		/// TODO pos should possibly be the position of the mouse pointer instead of the


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Commits mailing list