diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2012-07-31 22:18:44 +0100 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2012-07-31 22:18:44 +0100 |
commit | 53183b2411f10dbaf1a0b85ded1d2bd8b6df5ea9 (patch) | |
tree | 044e1f55b88eb69a2447013e3959626a37ed44fc /framebuffer/fbtk | |
parent | 9505fdcf849433d4cb08b4e9a340c3ab73f53e6a (diff) | |
download | netsurf-53183b2411f10dbaf1a0b85ded1d2bd8b6df5ea9.tar.gz netsurf-53183b2411f10dbaf1a0b85ded1d2bd8b6df5ea9.tar.bz2 |
Make text input widget remove caret on "strip focus" event.
Diffstat (limited to 'framebuffer/fbtk')
-rw-r--r-- | framebuffer/fbtk/text.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/framebuffer/fbtk/text.c b/framebuffer/fbtk/text.c index 69e82153d..879d88888 100644 --- a/framebuffer/fbtk/text.c +++ b/framebuffer/fbtk/text.c @@ -413,9 +413,9 @@ text_input(fbtk_widget_t *widget, fbtk_callback_info *cbi) return 0; } -/** Routine called when text events occour in writeable widget. +/** Routine called when click events occour in writeable widget. * - * @param widget The widget reciving input events. + * @param widget The widget reciving click events. * @param cbi The callback parameters. * @return The callback result. */ @@ -447,6 +447,20 @@ text_input_click(fbtk_widget_t *widget, fbtk_callback_info *cbi) return 0; } +/** Routine called when "stripped of focus" event occours for writeable widget. + * + * @param widget The widget reciving "stripped of focus" event. + * @param cbi The callback parameters. + * @return The callback result. + */ +static int +text_input_strip_focus(fbtk_widget_t *widget, fbtk_callback_info *cbi) +{ + fbtk_set_caret(widget, false, 0, 0, 0, NULL); + + return 0; +} + /* exported function documented in fbtk.h */ void fbtk_writable_text(fbtk_widget_t *widget, fbtk_enter_t enter, void *pw) @@ -546,6 +560,7 @@ fbtk_create_writable_text(fbtk_widget_t *parent, fbtk_set_handler(neww, FBTK_CBT_REDRAW, fb_redraw_text, NULL); fbtk_set_handler(neww, FBTK_CBT_CLICK, text_input_click, pw); + fbtk_set_handler(neww, FBTK_CBT_STRIP_FOCUS, text_input_strip_focus, NULL); fbtk_set_handler(neww, FBTK_CBT_INPUT, text_input, neww); return neww; |