]> git.lyx.org Git - lyx.git/blobdiff - src/WorkArea.C
better mouse pointer handling, actualy makes sense now
[lyx.git] / src / WorkArea.C
index b6b82313700b35ded283d9267250302356552b16..5b71a2a692279d6227a9c8c6d79680cda1df3fb4 100644 (file)
@@ -22,6 +22,8 @@
 #include "support/lstrings.h"
 #include "BufferView.h"
 
+using std::endl;
+
 FL_OBJECT * figinset_canvas;
 
 // need to make the c++ compiler fint the correct version of abs.
@@ -209,8 +211,22 @@ WorkArea::~WorkArea()
 
 bool WorkArea::belowMouse() const
 {
-       lyxerr << "Below mouse: " << work_area->belowmouse << endl;
-       return work_area->belowmouse;
+       FL_Coord x, y;
+       unsigned int button;
+       fl_get_mouse(&x, &y, &button);
+       FL_Coord ulx = work_area->form->x + work_area->x;
+       FL_Coord uly = work_area->form->y + work_area->y;
+       FL_Coord w = work_area->w;
+       FL_Coord h = work_area->h;
+       if (x > ulx && y > uly && x < ulx + h && y < uly + w)
+               return true;
+       return false;
+       
+       
+       //lyxerr << "Mouse: (" << x << ", " << y <<") button = " << button << endl;
+       //lyxerr << "Workarea: (" << work_area->x + work_area->form->x << ", " << work_area->y + work_area->form->y << ", " << work_area->w << ", " << work_area->h << ")" << endl;
+       //lyxerr << "Below mouse: " << work_area->belowmouse << endl;
+       //return work_area->belowmouse;
 }
 
 
@@ -412,9 +428,11 @@ int WorkArea::work_area_handler(FL_OBJECT * ob, int event,
                break;
        case FL_ENTER:
                lyxerr.debug() << "Workarea event: ENTER" << endl;
+               area->owner->enterView();
                break;
        case FL_LEAVE:
                lyxerr.debug() << "Workarea event: LEAVE" << endl;
+               area->owner->leaveView();
                break;
        case FL_DBLCLICK:
                if (!ev) break;