FL: Clean up enter key press behavior of Fl_Sometimes_Input

This commit is contained in:
Jonathan Moore Liles 2012-05-27 20:34:49 -07:00
parent b1cbd4faa6
commit 8df6acd540
1 changed files with 7 additions and 9 deletions

View File

@ -28,7 +28,6 @@
class Fl_Sometimes_Input : public Fl_Input class Fl_Sometimes_Input : public Fl_Input
{ {
Fl_Boxtype _up_box; Fl_Boxtype _up_box;
public: public:
@ -38,7 +37,7 @@ public:
{ {
clear_visible_focus(); clear_visible_focus();
up_box( FL_NO_BOX ); up_box( FL_NO_BOX );
when(FL_WHEN_ENTER_KEY_ALWAYS); when(FL_WHEN_ENTER_KEY);
} }
void up_box ( Fl_Boxtype b ) { _up_box = b; } void up_box ( Fl_Boxtype b ) { _up_box = b; }
@ -73,20 +72,19 @@ public:
switch ( m ) switch ( m )
{ {
case FL_KEYDOWN:
{
if ( r && Fl::event_key() == FL_Enter )
Fl::focus( NULL );
}
case FL_FOCUS: case FL_FOCUS:
case FL_UNFOCUS:
redraw(); redraw();
return 1; return 1;
case FL_PUSH: case FL_PUSH:
take_focus(); take_focus();
redraw(); redraw();
return 1; return 1;
case FL_UNFOCUS:
if ( window() )
window()->damage( FL_DAMAGE_EXPOSE, x(), y(), w(), h() );
redraw();
return r;
default: default:
return r; return r;
} }