Fixes focus issues:

o Nav keys were being used even if widget didn't have focus
	o When Fl_Input was used as immediate child, wasn't redrawing properly
	  when typing into input fields. (noticed problem with test program in STR# 2832)



git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@9413 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
This commit is contained in:
Greg Ercolano 2012-04-30 21:22:57 +00:00
parent 165cd2b63b
commit f8d269725d
2 changed files with 7 additions and 6 deletions

View File

@ -193,7 +193,8 @@ int Fl_Tree::handle(int e) {
}
case FL_KEYBOARD: { // keyboard shortcut
// Do shortcuts first or scrollbar will get them...
if (_prefs.selectmode() > FL_TREE_SELECT_NONE ) {
if ( (Fl::focus() == this) && // tree has focus?
_prefs.selectmode() > FL_TREE_SELECT_NONE ) { // select mode that supports kb events?
if ( !_item_focus ) {
set_item_focus(first());
}

View File

@ -729,10 +729,11 @@ void Fl_Tree_Item::draw(int X, int &Y, int W, Fl_Widget *tree,
#if FLTK_ABI_VERSION >= 10302
if ( _label &&
( !widget() ||
(prefs.item_draw_mode() & FL_TREE_ITEM_DRAW_LABEL_AND_WIDGET) ) ) {
(prefs.item_draw_mode() & FL_TREE_ITEM_DRAW_LABEL_AND_WIDGET) ) )
#else
if ( _label && !widget() ) { // back compat: don't draw label if widget() present
if ( _label && !widget() ) // back compat: don't draw label if widget() present
#endif
{
fl_color(fg);
fl_font(_labelfont, _labelsize);
int label_y = Y+(H/2)+(_labelsize/2)-fl_descent()/2;
@ -740,9 +741,8 @@ void Fl_Tree_Item::draw(int X, int &Y, int W, Fl_Widget *tree,
}
} // end non-child damage
// Draw child FLTK widget?
if ( widget() && widget()->damage() ) {
widget()->draw();
((Fl_Tree*)tree)->draw_outside_label(*widget());
if ( widget() ) {
((Fl_Tree*)tree)->update_child(*widget()); // let group handle drawing child
}
// Draw focus box around item's bg last
if ( this == itemfocus &&