The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Fix the GTK method that blocks all idle events

These changes was commited to the Birdfont repository Sat, 18 Jun 2016 15:05:41 +0000.

Contributing

Send patches or pull requests to johan.mattsson.m@gmail.com.
Clone this repository: git clone https://github.com/johanmattssonm/birdfont.git
author Johan Mattsson <johan.mattsson.m@gmail.com>
Sat, 18 Jun 2016 15:05:41 +0000 (17:05 +0200)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Sat, 18 Jun 2016 15:05:41 +0000 (17:05 +0200)
commit 0a4fc977200bc889f19c3b2b5e101334ab7a8646
tree 376ec303f5ac086dbcb3358c29eac7ff9b8ab7ed
parent 37e393624c714e7a0fd1be10164eafac989b7d64
Fix the GTK method that blocks all idle events

birdfont/GtkWindow.vala
birdfont/Main.vala
libbirdfont/OverView.vala
--- a/birdfont/GtkWindow.vala +++ b/birdfont/GtkWindow.vala @@ -43,15 +43,7 @@ Scrollbar scrollbar; bool scrollbar_supress_signal = false; - - /** Text input and callbacks. */ - public static bool text_input_is_active = false; - TextListener text_listener = new TextListener ("", "", ""); - Label text_input_label; - Entry text_entry; - Box text_box; - Gtk.Button submit_text_button; - + Gtk.Window tooltip_window = new Gtk.Window (); ToolboxCanvas toolbox; @@ -67,10 +59,6 @@ } public void init () { - Notify.init ("Fonts have been exported."); - - clipboard = Clipboard.get_for_display (get_display (), Gdk.SELECTION_CLIPBOARD); - Signal.connect(this, "notify::is-active", (GLib.Callback) window_focus, null); scrollbar.value_changed.connect (() => { @@ -135,29 +123,9 @@ canvas_box.pack_start (glyph_canvas_area, true, true, 0); canvas_box.pack_start (html_box, true, true, 0); canvas_box.pack_start (scrollbar, false, true, 0); - - submit_text_button = new Gtk.Button (); - submit_text_button.set_label ("Submit"); - text_input_label = new Label (" " + "Text"); - text_entry = new Entry (); - text_box = new Box (Orientation.HORIZONTAL, 6); - text_box.pack_start (text_input_label, false, false, 0); - text_box.pack_start (text_entry, true, true, 0); - text_box.pack_start (submit_text_button, false, false, 0); - - text_entry.changed.connect (() => { - text_listener.signal_text_input (text_entry.text); - }); - - submit_text_button.clicked.connect (() => { - text_listener.signal_submit (text_entry.text); - text_input_is_active = false; - }); - tab_box = new Box (Orientation.VERTICAL, 0); tab_box.pack_start (new TabbarCanvas (MainWindow.get_tab_bar ()), false, false, 0); - tab_box.pack_start (text_box, false, false, 5); tab_box.pack_start (canvas_box, true, true, 0); toolbox = new ToolboxCanvas (MainWindow.get_toolbox ()); @@ -168,7 +136,7 @@ Box vbox = new Box (Orientation.VERTICAL, 0); vbox.pack_start(list_box, true, true, 0); add (vbox); - + try { set_icon_from_file ((!) SearchPaths.find_file (null, "birdfont_window_icon.png").get_path ()); } catch (GLib.Error e) { @@ -176,18 +144,13 @@ } key_press_event.connect ((t, event) => { - if (!GtkWindow.text_input_is_active) { - GtkWindow.reset_modifier (event.state); - TabContent.key_press (event.keyval); - } - + TabContent.key_press (event.keyval); + return false; }); key_release_event.connect ((t, event) => { - if (!GtkWindow.text_input_is_active) { - TabContent.key_release (event.keyval); - } + TabContent.key_release (event.keyval); return false; }); @@ -195,14 +158,11 @@ size_allocate.connect(() => { GlyphCanvas.redraw (); }); - - show_all (); scrollbar.set_visible (false); - - hide_text_input (); - MainWindow.open_recent_files_tab (); + show_all (); + MainWindow.open_recent_files_tab (); } public void window_focus (void* data) { @@ -429,26 +389,6 @@ } return fn; - } - - public void hide_text_input () { - text_listener = new TextListener ("", "", ""); - text_box.hide (); - text_input_is_active = false; - } - - public void set_text_listener (TextListener listener) { - text_listener = listener; - text_input_label.set_text (" " + listener.label); - submit_text_button.set_label (listener.button_label); - text_box.show (); - text_entry.set_text (listener.default_text); - text_entry.activate.connect (() => { - text_listener.signal_submit (text_entry.text); - text_input_is_active = false; - }); - text_entry.grab_focus (); - text_input_is_active = true; } public bool convert_to_png (string from, string to) { @@ -646,20 +586,10 @@ draw.connect ((t, e)=> { Gtk.Allocation alloc; - Context cr; - StyleContext context; - Gdk.RGBA color; - + Context cr; + cr = cairo_create (get_window ()); get_allocation (out alloc); - - context = get_style_context (); - context.add_class (STYLE_CLASS_BUTTON); - color = context.get_background_color (Gtk.StateFlags.NORMAL); - - if (color.alpha > 0) { - tabbar.set_background_color (color.red, color.green, color.blue); - } tabbar.draw (cr, alloc.width, alloc.height); return true;
--- a/birdfont/Main.vala +++ b/birdfont/Main.vala @@ -21,7 +21,7 @@ GtkWindow native_window; MainWindow window; BirdFont.BirdFont birdfont; - + birdfont = new BirdFont.BirdFont (); birdfont.init (arg, null, "birdfont", null); Gtk.init (ref arg); @@ -31,12 +31,10 @@ window.set_native (native_window); native_window.init (); + birdfont.load_font_from_command_line (); - birdfont.load_font_from_command_line (); + Gtk.main (); - Gtk.main (); return 0; } - -
--- a/libbirdfont/OverView.vala +++ b/libbirdfont/OverView.vala @@ -117,7 +117,7 @@ if (default_character_set) { IdleSource idle = new IdleSource (); - idle.set_callback (() => { + idle.set_callback (() => { use_default_character_set (); selected_canvas (); return false;