Commit dc27a60
Don't redraw from the background thread
Changed files (5)
modifiedlibbirdfont/MenuTab.valamodifiedlibbirdfont/OverView.valamodifiedlibbirdfont/TabBar.valamodifiedlibbirdfont/Toolbox.valamodifiedlibbirdfont/ZoomBar.vala
Diff
@@ -20,9 +20,14 @@ public class MenuTab : FontDisplay { * * Do always check the return value of set_suppress_event when this * variable is updated.+ * + * This variable is used only in the gui thread. */ public static bool suppress_event; + /** True if the background thread is running. */+ public static bool background_thread;+ /** A notification sent when the file has been saved. */ public static SaveCallback save_callback; @@ -40,6 +45,7 @@ public class MenuTab : FontDisplay { export_callback = new ExportCallback (); suppress_event = false;+ background_thread = false; } public static void set_save_callback (SaveCallback c) {@@ -80,6 +86,7 @@ public class MenuTab : FontDisplay { warning ("suppress_event is already set"); return false; }+ background_thread = e; suppress_event = e; return true; }@@ -61,8 +61,6 @@ public class OverView : FontDisplay { set_glyph_range (gr); } - reset_zoom ();- if (open_selected) { this.open_glyph_signal.connect ((glyph_collection) => { TabBar tabs = MainWindow.get_tab_bar ();@@ -109,6 +107,7 @@ public class OverView : FontDisplay { } update_scrollbar ();+ reset_zoom (); } public GlyphCollection add_empty_character_to_font (unichar character, bool unassigned, string name) {@@ -322,7 +321,6 @@ public class OverView : FontDisplay { OverViewItem get_selected_item () { if (visible_items.size == 0) {- warning ("No items."); return new OverViewItem (null, '\0', 0, 0); } @@ -411,7 +411,7 @@ public class TabBar : GLib.Object { MainWindow.native_window.hide_text_input (); if (index == SHOW_MENU) {- MainWindow.get_menu ().show_menu = ! MainWindow.get_menu ().show_menu;+ MainWindow.get_menu ().show_menu = !MainWindow.get_menu ().show_menu; GlyphCanvas.redraw (); return; }@@ -538,7 +538,10 @@ public class TabBar : GLib.Object { public void select_tab_click (double x, double y, int width, int height) { int over, close; - MainWindow.get_menu ().show_menu = false;+ if (MainWindow.get_menu ().show_menu) {+ MainWindow.get_menu ().show_menu = false;+ GlyphCanvas.redraw ();+ } this.width = width; this.height = height;@@ -274,6 +274,11 @@ public class Toolbox : GLib.Object { } public static void redraw_tool_box () {+ if (MenuTab.suppress_event) {+ warn_if_test ("Don't redraw toolbox when background thread is running.");+ return;+ }+ Toolbox t = MainWindow.get_toolbox (); if (!is_null (t)) { t.redraw (0, 0, allocation_width, allocation_height);@@ -50,7 +50,10 @@ public class ZoomBar : Tool { /** Zoom level from 0 to 1. */ public void set_zoom (double z) { zoom_level = z;- Toolbox.redraw_tool_box ();+ + if (!MenuTab.background_thread) {+ Toolbox.redraw_tool_box ();+ } } void set_zoom_from_mouse (double tx) {