The Birdfont Source Code


All Repositories / birdfont.git / commit – RSS feed

Send events only to text input area when it has focus

These changes was commited to the Birdfont repository Sat, 14 Mar 2015 13:36:52 +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, 14 Mar 2015 13:36:52 +0000 (14:36 +0100)
committer Johan Mattsson <johan.mattsson.m@gmail.com>
Sat, 14 Mar 2015 13:36:52 +0000 (14:36 +0100)
commit f2bc0ccf088523249bdf7c9b8711e0aa7ed21144
tree 120f13ec81016e09e2711a3542b1a8b451769899
parent 8af0fcb01842dc00bef7a057ef230a7179623c63
Send events only to text input area when it has focus

libbirdfont/TabContent.vala
--- a/libbirdfont/TabContent.vala +++ b/libbirdfont/TabContent.vala @@ -23,6 +23,8 @@ static LineTextArea text_input; static Button text_input_button; static bool text_input_visible = false; + + static const int TEXT_INPUT_HEIGHT = 51; public static void zoom_in () { if (MenuTab.suppress_event) { @@ -149,10 +151,16 @@ if (MainWindow.get_menu ().show_menu) { MainWindow.get_menu ().button_release (button, x, y); } else { - GlyphCanvas.current_display.button_release (button, x, y); - if (text_input_visible) { text_input.button_release (button, x, y); + + if (y > TEXT_INPUT_HEIGHT) { + hide_text_input (); + } + + GlyphCanvas.redraw (); + } else { + GlyphCanvas.current_display.button_release (button, x, y); } } } @@ -165,11 +173,11 @@ if (MainWindow.get_dialog ().visible) { MainWindow.get_dialog ().button_press (button, x, y); } else if (!MainWindow.get_menu ().show_menu) { - GlyphCanvas.current_display.button_press (button, x, y); - if (text_input_visible) { text_input.button_press (button, x, y); text_input_button.button_press (button, x, y); + } else { + GlyphCanvas.current_display.button_press (button, x, y); } } } @@ -279,7 +287,7 @@ public static void draw_text_input (WidgetAllocation allocation, Context cr) { cr.save (); Theme.color (cr, "Background 4"); - cr.rectangle (0, 0, allocation.width, 51); + cr.rectangle (0, 0, allocation.width, TEXT_INPUT_HEIGHT); cr.fill (); cr.restore ();