]> git.lyx.org Git - lyx.git/blobdiff - src/WorkArea.C
better mouse pointer handling, actualy makes sense now
[lyx.git] / src / WorkArea.C
index 2611fdaea4efbbb5ce6bd6c1f6b599e6e62bc4fc..5b71a2a692279d6227a9c8c6d79680cda1df3fb4 100644 (file)
@@ -211,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;
 }
 
 
@@ -414,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;