diff --git a/FL/Fl_Sometimes_Input.H b/FL/Fl_Sometimes_Input.H index 23fca30..3ebea61 100644 --- a/FL/Fl_Sometimes_Input.H +++ b/FL/Fl_Sometimes_Input.H @@ -22,23 +22,23 @@ /* Just like an Fl_Input, except that when not being edited it * displays just like a label. */ +#include + class Fl_Sometimes_Input : public Fl_Input { - bool _editing; - public: Fl_Sometimes_Input ( int X, int Y, int W, int H, const char *L=0 ) : Fl_Input( X, Y, W, H, L ) { - _editing = false; + clear_visible_focus(); } virtual void draw ( void ) { - if ( _editing ) + if ( this == Fl::focus() ) Fl_Input::draw(); else { @@ -56,15 +56,15 @@ public: switch ( m ) { case FL_FOCUS: - _editing = true; redraw(); return 1; case FL_PUSH: - _editing = true; + set_visible_focus(); + take_focus(); + clear_visible_focus(); redraw(); return r; case FL_UNFOCUS: - _editing = false; if ( window() ) window()->damage( FL_DAMAGE_EXPOSE, x(), y(), w(), h() ); diff --git a/FL/test_press.C b/FL/test_press.C index 6fddf70..158b55c 100644 --- a/FL/test_press.C +++ b/FL/test_press.C @@ -28,7 +28,8 @@ int test_press ( unsigned long e ) { - ((char *)Fl::event_text())[0] = '\0'; + if ( Fl::event_text()[0] ) + ((char *)Fl::event_text())[0] = '\0'; if ( ! ( e & FL_SHIFT ) ) return Fl::test_shortcut( e ) && ! Fl::event_shift(); diff --git a/Timeline/Sequence.C b/Timeline/Sequence.C index 950ddb2..a5e81f6 100644 --- a/Timeline/Sequence.C +++ b/Timeline/Sequence.C @@ -57,6 +57,8 @@ Sequence::init ( void ) box( FL_DOWN_BOX ); color( FL_BACKGROUND_COLOR ); align( FL_ALIGN_LEFT ); + +// clear_visible_focus(); } Sequence::~Sequence ( ) @@ -284,6 +286,10 @@ Sequence::handle ( int m ) switch ( m ) { + case FL_KEYBOARD: + /* this is a hack to override FLTK's use of arrow keys for + * focus navigation */ + return timeline->handle_scroll( m ); case FL_NO_EVENT: /* garbage from overlay window */ return 0; diff --git a/Timeline/Timeline.C b/Timeline/Timeline.C index 7453ebd..5829864 100644 --- a/Timeline/Timeline.C +++ b/Timeline/Timeline.C @@ -950,6 +950,13 @@ Timeline::track_under ( int Y ) #include "FL/event_name.H" #include "FL/test_press.H" +/** give the scrollbars a shot at events */ +int +Timeline::handle_scroll ( int m ) +{ + return hscroll->handle( m ) || vscroll->handle( m ); +} + int Timeline::handle ( int m ) { @@ -959,8 +966,7 @@ Timeline::handle ( int m ) /* if ( m != FL_NO_EVENT ) */ /* DMESSAGE( "%s", event_name( m ) ); */ - - int r = Fl_Overlay_Window::handle( m ); +/* int r = Fl_Overlay_Window::handle( m ); */ switch ( m ) { @@ -1001,7 +1007,7 @@ Timeline::handle ( int m ) /* keep scrollbar from eating these. */ return 0; default: - return r; + return Fl_Overlay_Window::handle( m ); } return 0; @@ -1014,7 +1020,7 @@ Timeline::handle ( int m ) //Fl::focus( this ); -/* r = Fl_Overlay_Window::handle( m ); */ + int r = Fl_Overlay_Window::handle( m ); if ( m != FL_RELEASE && r ) return r; diff --git a/Timeline/Timeline.H b/Timeline/Timeline.H index 8ec984e..dfd1eae 100644 --- a/Timeline/Timeline.H +++ b/Timeline/Timeline.H @@ -171,6 +171,7 @@ public: void draw ( void ); void draw_overlay ( void ); + int handle_scroll ( int m ); int handle ( int m ); static void update_cb ( void *arg ); diff --git a/Timeline/Track.C b/Timeline/Track.C index 0d75d5e..0614306 100644 --- a/Timeline/Track.C +++ b/Timeline/Track.C @@ -124,6 +124,8 @@ Track::init ( void ) labeltype( FL_NO_LABEL ); +// clear_visible_focus(); + Fl_Group::size( timeline->w(), height() ); Track *o = this; @@ -500,8 +502,6 @@ Track::handle ( int m ) } case FL_PUSH: { - Fl::event_key( 0 ); - Logger log( this ); int X = Fl::event_x();