Browse Source

Improve event handling and mouse cursor changing.

tags/non-daw-v1.1.0
Jonathan Moore Liles 17 years ago
parent
commit
65606b5fb3
2 changed files with 31 additions and 6 deletions
  1. +30
    -2
      Track.C
  2. +1
    -4
      Track_Widget.C

+ 30
- 2
Track.C View File

@@ -191,12 +191,30 @@ int
Track::handle ( int m ) Track::handle ( int m )
{ {
static Track_Widget *pushed; static Track_Widget *pushed;
static Track_Widget *belowmouse;


switch ( m ) switch ( m )
{ {
case FL_ENTER:
case FL_LEAVE:
return 1;
case FL_MOVE: case FL_MOVE:
{
/* these aren't used, so don't bother doing lookups for them */ /* these aren't used, so don't bother doing lookups for them */
Track_Widget *r = event_widget();

if ( r != belowmouse )
{
if ( belowmouse )
belowmouse->handle( FL_LEAVE );
belowmouse = r;

if ( r )
r->handle( FL_ENTER );
}

return 1; return 1;
}
default: default:
{ {
Track_Widget *r = pushed ? pushed : event_widget(); Track_Widget *r = pushed ? pushed : event_widget();
@@ -216,9 +234,19 @@ Track::handle ( int m )
while ( _delete_queue.size() ) while ( _delete_queue.size() )
{ {


delete _delete_queue.front();
Track_Widget *t = _delete_queue.front();
_delete_queue.pop(); _delete_queue.pop();
pushed = NULL;


if ( pushed == t )
pushed = NULL;
if ( belowmouse == t )
{
belowmouse->handle( FL_LEAVE );
belowmouse = NULL;
}

delete t;
} }


Loggable::block_end(); Loggable::block_end();


+ 1
- 4
Track_Widget.C View File

@@ -107,9 +107,6 @@ Track_Widget::dispatch ( int m )
int int
Track_Widget::handle ( int m ) Track_Widget::handle ( int m )
{ {
/* static int ox, oy; */
/* static bool dragging = false; */

int X = Fl::event_x(); int X = Fl::event_x();
int Y = Fl::event_y(); int Y = Fl::event_y();


@@ -146,7 +143,7 @@ Track_Widget::handle ( int m )
_drag = NULL; _drag = NULL;
} }


fl_cursor( FL_CURSOR_DEFAULT );
fl_cursor( FL_CURSOR_HAND );
return 1; return 1;
case FL_DRAG: case FL_DRAG:
{ {


Loading…
Cancel
Save