Improve event handling and mouse cursor changing.

pull/3/head
Jonathan Moore Liles 2008-03-05 18:14:46 -06:00
parent 2c50272a9d
commit 65606b5fb3
2 changed files with 33 additions and 8 deletions

36
Track.C
View File

@ -191,12 +191,30 @@ int
Track::handle ( int m )
{
static Track_Widget *pushed;
static Track_Widget *belowmouse;
switch ( m )
{
case FL_MOVE:
/* these aren't used, so don't bother doing lookups for them */
case FL_ENTER:
case FL_LEAVE:
return 1;
case FL_MOVE:
{
/* 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;
}
default:
{
Track_Widget *r = pushed ? pushed : event_widget();
@ -216,9 +234,19 @@ Track::handle ( int m )
while ( _delete_queue.size() )
{
delete _delete_queue.front();
Track_Widget *t = _delete_queue.front();
_delete_queue.pop();
pushed = NULL;
if ( pushed == t )
pushed = NULL;
if ( belowmouse == t )
{
belowmouse->handle( FL_LEAVE );
belowmouse = NULL;
}
delete t;
}
Loggable::block_end();

View File

@ -107,9 +107,6 @@ Track_Widget::dispatch ( int m )
int
Track_Widget::handle ( int m )
{
/* static int ox, oy; */
/* static bool dragging = false; */
int X = Fl::event_x();
int Y = Fl::event_y();
@ -146,7 +143,7 @@ Track_Widget::handle ( int m )
_drag = NULL;
}
fl_cursor( FL_CURSOR_DEFAULT );
fl_cursor( FL_CURSOR_HAND );
return 1;
case FL_DRAG:
{