Clone in a terminal:
Commit 9abdea0
Johan Mattsson - 2022-05-30T20:10:49+00:00
9abdea0564c4cd843dd469f2a6c4e6bfa24d8c14johan.mattsson.m@gmail.com

Fix tooltip

Changed files (2)

Diff

diff --git a/birdfont/GtkWindow.vala b/birdfont/GtkWindow.valaindex bea720a..5cb54d0 100644--- a/birdfont/GtkWindow.vala+++ b/birdfont/GtkWindow.vala@@ -610,10 +610,16 @@ class ToolboxCanvas : DrawingArea { 			get_allocation (out allocation); 			Toolbox.allocation_width = allocation.width; 			Toolbox.allocation_height = allocation.height;+			 			Toolbox.redraw_tool_box (); 		}); 		 		tb.redraw.connect ((x, y, w, h) => {+			if (h < 0) {+				warning (@"Toolbox height is less than zero: $(h)");+				return;+			}+			 			queue_draw_area (x, y, w, h); 		}); 		@@ -632,7 +638,6 @@ class ToolboxCanvas : DrawingArea { 		});  		motion_notify_event.connect ((sen, e)=> {-			// FIXME: e.y is two pixels off in GTK under Gnome 			tb.move (e.x, e.y); 			return true; 		});@@ -641,11 +646,11 @@ class ToolboxCanvas : DrawingArea { 			Gtk.Allocation allocation; 			get_allocation (out allocation); 			-			Context cw = e;-			//cw = cairo_create((!) get_window());+			Context cw = cairo_create((!) get_window()); 			Toolbox.allocation_width = allocation.width; 			Toolbox.allocation_height = allocation.height;-			tb.draw (allocation.width, allocation.height, cw);+			+			tb.draw (Toolbox.allocation_width, Toolbox.allocation_height, cw); 			 			return true; 		});@@ -661,7 +666,8 @@ class ToolboxCanvas : DrawingArea { 		 		add_events (EventMask.BUTTON_PRESS_MASK | EventMask.BUTTON_RELEASE_MASK | EventMask.POINTER_MOTION_MASK | EventMask.LEAVE_NOTIFY_MASK | EventMask.SCROLL_MASK); -		set_size_request (212, 100);+		int width = 212;+		set_size_request (width, 100);  		leave_notify_event.connect ((t, e)=> { 			tb.reset_active_tool ();diff --git a/libbirdfont/Toolbox.vala b/libbirdfont/Toolbox.valaindex 1be6e33..82b390d 100644--- a/libbirdfont/Toolbox.vala+++ b/libbirdfont/Toolbox.vala@@ -516,16 +516,19 @@ public class Toolbox : GLib.Object  { 		 		draw_tool_tip (cr); 	}-	+ 	private void draw_tool_tip (Context cr) { 		TextArea t; 		 		if (tool_tip != null && tool_tip != "") { 			t = new TextArea (17 * get_scale ());+    			t.allocation = new WidgetAllocation.for_area (0, 0, allocation_width, allocation_height); 			t.set_editable (false); 			t.set_text ((!) tool_tip);+			 			t.width = allocation_width - 20 * get_scale ();+			 			t.min_height = 17 * get_scale (); 			t.height = 17 * get_scale (); 

Contact

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