Clone in a terminal:
Commit 1530d08
Johan Mattsson - 2013-01-31T21:47:48+00:00
1530d08400743da5831407e7fb96fc4b12b0d207johan.mattsson.m@gmail.com

Merge branch 'master' of gitorious.org:supplement/birdfont

Changed files (4)

Diff

diff --git a/birdfont/GtkWindow.vala b/birdfont/GtkWindow.valaindex d8d6f58..f17274e 100644--- a/birdfont/GtkWindow.vala+++ b/birdfont/GtkWindow.vala@@ -257,42 +257,71 @@ public class GtkWindow : Gtk.Window, NativeWindow { 		}	 	} 	+	public void dump_clipboard_content (Clipboard clipboard, SelectionData selection_data) {+		string d;+		return_if_fail (!is_null (selection_data));+		d = (string) ((!) selection_data).data;+		stdout.printf (d);+	}++	public void dump_clipboard_target (Clipboard clipboard, Atom[] atoms) {+		foreach (Atom target in atoms) {+			print ("Target: " + target.name () + "\n");+			clipboard.request_contents (target, dump_clipboard_content);+		}+	}+	+	public void dump_clipboard () {+		clipboard.request_targets (dump_clipboard_target);+	}+	 	public string get_clipboard_data () {-		SelectionData? selection_data;-		Atom target;+		if (Supplement.mac) {+			string? t;+			t = clipboard.wait_for_text ();+			return (t == null) ? "" : (!) t;+		} else {+			SelectionData? selection_data;+			Atom target; -		target = Atom.intern_static_string ("image/x-inkscape-svg");-		selection_data = clipboard.wait_for_contents (target);-		-		if (is_null (selection_data) || is_null (((!) selection_data).data)) {-			return "";+			target = Atom.intern_static_string ("image/x-inkscape-svg");+			selection_data = clipboard.wait_for_contents (target);+			+			if (is_null (selection_data) || is_null (((!) selection_data).data)) {+				return "";+			}+			+			return (string) ((!) selection_data).data; 		}-		-		return (string) ((!) selection_data).data; 	} 	 	public void set_inkscape_clipboard (string inkscape_clipboard_data) {-		TargetEntry t = { "image/x-inkscape-svg", 0, 0 };-		TargetEntry[] targets = { t };-		inkscape_clipboard = inkscape_clipboard_data;-		-		// we can't add data to this closure because the third argument -		// is owner and not private data.-		clipboard.set_with_owner (targets,-		-			// obtain clipboard data -			(clipboard, selection_data, info, owner) => {-				Atom type;-				uchar[] data = (uchar[])(!)((GtkWindow*)owner)->inkscape_clipboard.to_utf8 ();-				type = Atom.intern_static_string ("image/x-inkscape-svg");-				selection_data.set (type, 8, data);-			},+		// FIXME: clipboard seems to be rather broken on Mac +		if (Supplement.mac) {+			clipboard.set_text (inkscape_clipboard_data, -1);+		} else {+			TargetEntry t = { "image/x-inkscape-svg", 0, 0 };+			TargetEntry[] targets = { t };+			inkscape_clipboard = inkscape_clipboard_data; 			-			// clear clipboard data-			(clipboard, user_data) => {-			},+			// we can't add data to this closure because the third argument +			// is owner and not private data.+			clipboard.set_with_owner (targets, 			-			this);		+				// obtain clipboard data +				(clipboard, selection_data, info, owner) => {+					Atom type;+					uchar[] data = (uchar[])(!)((GtkWindow*)owner)->inkscape_clipboard.to_utf8 ();+					type = Atom.intern_static_string ("image/x-inkscape-svg");+					selection_data.set (type, 8, data);+				},+				+				// clear clipboard data+				(clipboard, user_data) => {+				},+				+				this);		+		} 	} 	 	public void set_clipboard (string svg) {@@ -854,7 +883,7 @@ public class GlyphCanvasArea : DrawingArea  { 			if (e.direction == Gdk.ScrollDirection.UP) { 				glyph_canvas.current_display.scroll_wheel_up (e.x, e.y); 			} else if (e.direction == Gdk.ScrollDirection.DOWN) {-				glyph_canvas.current_display.scroll_wheel_down (e.x, e.y);+				glyph_canvas.current_display.scroll_wheel_down (e.x, e.y)		; 			} 			 			glyph_canvas.current_display.button_release (2, e.x, e.y);diff --git a/libbirdfont/ClipTool.vala b/libbirdfont/ClipTool.valaindex 306bfcb..e723ff7 100644--- a/libbirdfont/ClipTool.vala+++ b/libbirdfont/ClipTool.vala@@ -61,7 +61,10 @@ public class ClipTool : Tool { 			((!)destination).store_undo_state (); 			 			svg = MainWindow.native_window.get_clipboard_data ();-			ImportSvg.import_svg_data (svg);+			+			if (svg != "") {+				ImportSvg.import_svg_data (svg);+			} 			 			((!)destination).update_view (); 		}diff --git a/libbirdfont/ImportSvg.vala b/libbirdfont/ImportSvg.valaindex 278e474..cbefe4e 100644--- a/libbirdfont/ImportSvg.vala+++ b/libbirdfont/ImportSvg.vala@@ -36,8 +36,7 @@ public class ImportSvg { 	} 	 	public static void import_svg_data (string xml_data) {-		// FIXME:-		if (Supplement.win32) {		+		if (Supplement.win32) { 			string svg; 			string xml; 			xml = xml_data.replace ("id", "__");diff --git a/mac/birdfont.sh b/mac/birdfont.shindex 7a0e5ed..425e152 100755--- a/mac/birdfont.sh+++ b/mac/birdfont.sh@@ -1,3 +1,3 @@ #!/bin/bash cd "${0%/*}"-./birdfont\ No newline at end of file+./birdfont 

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112