Mixer: Fix some button handling.

This commit is contained in:
Jonathan Moore Liles 2013-04-22 21:54:45 -07:00
parent 455c93683c
commit 5af9afdd8d
3 changed files with 29 additions and 32 deletions

View File

@ -155,13 +155,9 @@ public:
virtual int virtual int
handle ( int m ) handle ( int m )
{ {
static int _button;
switch ( m ) switch ( m )
{ {
case FL_PUSH: case FL_PUSH:
_button = Fl::event_button();
if ( top_sb_visible() && if ( top_sb_visible() &&
Fl::event_inside( x(), y(), w(), sbh ) ) Fl::event_inside( x(), y(), w(), sbh ) )
{ {
@ -175,22 +171,17 @@ public:
break; break;
case FL_RELEASE: case FL_RELEASE:
{ {
int b = _button; if ( top_sb_visible() &&
_button = 0; Fl::event_inside( x(), y(), w(), sbh ) )
if ( b == 1 )
{ {
if ( top_sb_visible() && yposition( yposition() + ( h() / 4 ) );
Fl::event_inside( x(), y(), w(), sbh ) ) return 1;
{ }
yposition( yposition() + ( h() / 4 ) ); else if ( bottom_sb_visible() &&
return 1; Fl::event_inside( x(), y() + h() - sbh, w(), sbh ) )
} {
else if ( bottom_sb_visible() && yposition( yposition() - (h() / 4 ) );
Fl::event_inside( x(), y() + h() - sbh, w(), sbh ) ) return 1;
{
yposition( yposition() - (h() / 4 ) );
return 1;
}
} }
break; break;
} }

View File

@ -726,6 +726,7 @@ Mixer_Strip::handle ( int m )
} }
case FL_PUSH: case FL_PUSH:
_button = Fl::event_button(); _button = Fl::event_button();
break;
case FL_RELEASE: case FL_RELEASE:
{ {
int b = _button; int b = _button;

View File

@ -778,7 +778,9 @@ Module::handle_chain_name_changed ( )
int int
Module::handle ( int m ) Module::handle ( int m )
{ {
static int _button = 0; static unsigned long _event_state = 0;
unsigned long evstate = Fl::event_state();
if ( Fl_Group::handle( m ) ) if ( Fl_Group::handle( m ) )
return 1; return 1;
@ -797,33 +799,36 @@ Module::handle ( int m )
} }
case FL_PUSH: case FL_PUSH:
take_focus(); take_focus();
_button = Fl::event_button(); _event_state = evstate;
return 1; return 1;
// if ( Fl::visible_focus() && handle( FL_FOCUS )) Fl::focus(this); // if ( Fl::visible_focus() && handle( FL_FOCUS )) Fl::focus(this);
case FL_DRAG: case FL_DRAG:
_button = Fl::event_button(); _event_state = evstate;
return 1; return 1;
case FL_RELEASE: case FL_RELEASE:
{ {
int b = _button; unsigned long e = _event_state;
_button = 0; _event_state = 0;
DMESSAGE( "Button %i", b);
if ( 3 == b ) if ( ! Fl::event_inside( this ) )
{
menu_popup( &menu() );
return 1; return 1;
}
else if ( 1 == b ) if ( e & FL_BUTTON1 )
{ {
command_open_parameter_editor(); command_open_parameter_editor();
return 1; return 1;
} }
else if ( 3 == b && Fl::event_ctrl() ) else if ( e & FL_BUTTON3 && e & FL_CTRL )
{ {
command_remove(); command_remove();
return 1; return 1;
} }
else if ( 2 == b ) else if ( e & FL_BUTTON3 )
{
menu_popup( &menu() );
return 1;
}
else if ( e & FL_BUTTON2 )
{ {
if ( !bypassable() ) if ( !bypassable() )
{ {