Give the browser window widget input focus by defualt on startup.

svn path=/trunk/netsurf/; revision=10948
This commit is contained in:
Michael Drake 2010-11-20 18:50:45 +00:00
parent 908da609e7
commit 71ea71540a
4 changed files with 24 additions and 1 deletions

View File

@ -400,6 +400,13 @@ void fbtk_writable_text(fbtk_widget_t *widget, fbtk_enter_t enter, void *pw);
void fbtk_set_text(fbtk_widget_t *widget, const char *text);
/** Give widget input focus.
*
* @param widget Widget to be given input focus.
*/
void fbtk_set_focus(fbtk_widget_t *widget);
/** enable the on screen keyboard for input */

View File

@ -52,8 +52,10 @@ fbtk_input(fbtk_widget_t *root, nsfb_event_t *event)
/* obtain widget with input focus */
input = root->u.root.input;
if (input == NULL)
if (input == NULL) {
LOG(("No widget has input focus."));
return; /* no widget with input */
}
fbtk_post_callback(input, FBTK_CBT_INPUT, event);
}

View File

@ -685,6 +685,18 @@ fbtk_post_callback(fbtk_widget_t *widget, fbtk_callback_type cbt, ...)
return ret;
}
/* exported function docuemnted in fbtk.h */
void
fbtk_set_focus(fbtk_widget_t *widget)
{
fbtk_widget_t *root;
/* ensure we have the root widget */
root = fbtk_get_root_widget(widget);
root->u.root.input = widget;
}
/* exported function docuemnted in fbtk.h */

View File

@ -1245,6 +1245,8 @@ create_normal_browser_window(struct gui_window *gw, int furniture_width)
/* browser widget */
create_browser_widget(gw, toolbar_height, option_fb_furniture_size);
/* Give browser_window's user widget input focus */
fbtk_set_focus(gw->browser);
}