Clone in a terminal:
Commit 04ead23
Johan Mattsson - 2015-06-15T16:16:11+00:00
04ead2384539213db26fbbfbc5cfb94630a29af8johan.mattsson.m@gmail.com

Scroll wheel on Mac OS X

Changed files (8)

Diff

diff --git a/libbirdfont/DrawingTools.vala b/libbirdfont/DrawingTools.valaindex f9ea514..c95400a 100644--- a/libbirdfont/DrawingTools.vala+++ b/libbirdfont/DrawingTools.vala@@ -1386,7 +1386,8 @@ public class DrawingTools : ToolCollection  { 			hide_all_modifiers ();  			foreach (Tool t in draw_tools.tool) {-				t.set_selected (false);+				// FIXME: infinite loop on Mac OS +				// t.set_selected (false); 			} 			 			cut_background.set_selected (false);diff --git a/libbirdfont/FontDisplay.vala b/libbirdfont/FontDisplay.valaindex d61b207..9647582 100644--- a/libbirdfont/FontDisplay.vala+++ b/libbirdfont/FontDisplay.vala@@ -104,9 +104,9 @@ public abstract class FontDisplay : GLib.Object { 			d = y - last_tap_y;		 			if (last_tap_y > -1 && fabs (d) > 15) { // FIXME: pixels, other units are better 				if (d > 0) {-					scroll_wheel_up (x, y);+					scroll_wheel_up (x, y, 15); 				} else {-					scroll_wheel_down (x, y);+					scroll_wheel_down (x, y, 15); 				} 			} 			@@ -141,10 +141,10 @@ public abstract class FontDisplay : GLib.Object { 	public virtual void next_view () { 	} 	-	public virtual void scroll_wheel_up (double x, double y) {+	public virtual void scroll_wheel_up (double x, double y, double pixeldelta) { 	} 	-	public virtual void scroll_wheel_down (double x, double y) {+	public virtual void scroll_wheel_down (double x, double y, double pixeldelta) { 	}  	public virtual void undo () {diff --git a/libbirdfont/Glyph.vala b/libbirdfont/Glyph.valaindex 90bbfb1..65ecf4d 100644--- a/libbirdfont/Glyph.vala+++ b/libbirdfont/Glyph.vala@@ -375,25 +375,25 @@ public class Glyph : FontDisplay { 		return background_image; 	} 		-	public override void scroll_wheel_up (double x, double y) {+	public override void scroll_wheel_up (double x, double y, double pixeldelta) { 		if (KeyBindings.has_alt ()) { 			zoom_in_at_point (x, y); 		} else if (KeyBindings.has_ctrl ()) { -			view_offset_x -= 10 / view_zoom;+			view_offset_x -= pixeldelta / view_zoom; 		} else {-			view_offset_y -= 10 / view_zoom;+			view_offset_y -= pixeldelta / view_zoom; 		} 		 		redraw_area (0, 0, allocation.width, allocation.height); 	} 	-	public override void scroll_wheel_down (double x, double y) {+	public override void scroll_wheel_down (double x, double y, double pixeldelta) { 		if (KeyBindings.has_alt ()) { 			zoom_out_at_point (x, y); 		} else	if (KeyBindings.has_ctrl ()) { -			view_offset_x += 10 / view_zoom;+			view_offset_x -= pixeldelta / view_zoom; 		} else {-			view_offset_y += 10 / view_zoom;+			view_offset_y -= pixeldelta / view_zoom; 		} 		 		redraw_area (0, 0, allocation.width, allocation.height);diff --git a/libbirdfont/OverView.vala b/libbirdfont/OverView.valaindex 77f03cd..cc866be 100644--- a/libbirdfont/OverView.vala+++ b/libbirdfont/OverView.vala@@ -266,7 +266,7 @@ public class OverView : FontDisplay { 		return true; 	} -	public override void scroll_wheel_up (double x, double y) {+	public override void scroll_wheel_up (double x, double y, double pixeldelta) { 		key_up (); 		update_scrollbar (); 		GlyphCanvas.redraw ();@@ -279,7 +279,7 @@ public class OverView : FontDisplay { 		} 	} 	-	public override void scroll_wheel_down (double x, double y) {+	public override void scroll_wheel_down (double x, double y, double pixeldelta) { 		key_down (); 		update_scrollbar (); 		GlyphCanvas.redraw ();diff --git a/libbirdfont/SettingsDisplay.vala b/libbirdfont/SettingsDisplay.valaindex 9b713e8..a9e79ba 100644--- a/libbirdfont/SettingsDisplay.vala+++ b/libbirdfont/SettingsDisplay.vala@@ -219,7 +219,7 @@ public abstract class SettingsDisplay : FontDisplay { 		return true; 	} 	-	public override void scroll_wheel_down (double x, double y) {+	public override void scroll_wheel_down (double x, double y, double pixeldelta) { 		foreach (SettingsItem s in tools) { 			if (s.handle_events && s.button != null) { 				if (((!) s.button).is_over (x, y)) {@@ -239,7 +239,7 @@ public abstract class SettingsDisplay : FontDisplay { 		GlyphCanvas.redraw (); 	} 	-	public override void scroll_wheel_up (double x, double y) {+	public override void scroll_wheel_up (double x, double y, double pixeldelta) { 		foreach (SettingsItem s in tools) { 			if (s.handle_events && s.button != null) { 				if (((!) s.button).is_over (x, y)) {diff --git a/libbirdfont/TabContent.vala b/libbirdfont/TabContent.valaindex c045da0..32977e0 100644--- a/libbirdfont/TabContent.vala+++ b/libbirdfont/TabContent.vala@@ -202,13 +202,27 @@ public class TabContent : GLib.Object { 		} 	} 	+	public static void scroll_wheel_pixel_delta (double x, double y, double pixeldelta) {+		if (MenuTab.suppress_event) {+			return;+		}+		+		if (!MainWindow.get_menu ().show_menu) {+			if (pixeldelta < 0) {+				GlyphCanvas.current_display.scroll_wheel_up (x, y, pixeldelta);+			} else {+				GlyphCanvas.current_display.scroll_wheel_down (x, y, pixeldelta);+			}+		}		+	}+		 	public static void scroll_wheel_up (double x, double y) { 		if (MenuTab.suppress_event) { 			return; 		} 		 		if (!MainWindow.get_menu ().show_menu) {-			GlyphCanvas.current_display.scroll_wheel_up (x, y);+			GlyphCanvas.current_display.scroll_wheel_up (x, y, 15); 		} 	} 	@@ -218,7 +232,7 @@ public class TabContent : GLib.Object { 		} 		 		if (!MainWindow.get_menu ().show_menu) {-			GlyphCanvas.current_display.scroll_wheel_down (x, y);+			GlyphCanvas.current_display.scroll_wheel_down (x, y, 15); 		} 	} diff --git a/libbirdfont/Table.vala b/libbirdfont/Table.valaindex b2d0f3f..1825214 100644--- a/libbirdfont/Table.vala+++ b/libbirdfont/Table.vala@@ -210,7 +210,7 @@ public abstract class Table : FontDisplay { 		return true; 	} 	-	public override void scroll_wheel_down (double x, double y) {+	public override void scroll_wheel_down (double x, double y, double pixeldelta) { 		scroll += 30  * MainWindow.units;  		if (scroll > page_height - allocation.height) {@@ -225,7 +225,7 @@ public abstract class Table : FontDisplay { 		redraw_area (0, 0, allocation.width, allocation.height); 	} 	-	public override void scroll_wheel_up (double x, double y) {+	public override void scroll_wheel_up (double x, double y, double pixeldelta) { 		scroll -= 30 * MainWindow.units; 		 		if (scroll < 0) {diff --git a/libbirdfont/TableLayout.vala b/libbirdfont/TableLayout.valaindex 52c7fce..f7eb495 100644--- a/libbirdfont/TableLayout.vala+++ b/libbirdfont/TableLayout.vala@@ -211,7 +211,7 @@ public class TableLayout : FontDisplay { 		return true; 	} 	-	public override void scroll_wheel_down (double x, double y) {+	public override void scroll_wheel_down (double x, double y, double pixeldelta) { 		scroll += 25 * MainWindow.units; 		 		if (scroll + allocation.height >=  content_height) {@@ -226,7 +226,7 @@ public class TableLayout : FontDisplay { 		GlyphCanvas.redraw (); 	} 	-	public override void scroll_wheel_up (double x, double y) {+	public override void scroll_wheel_up (double x, double y, double pixeldelta) { 		scroll -= 25 * MainWindow.units; 		 		if (scroll < 0) {

Contact

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