diff --git a/include/osgViewer/api/Carbon/GraphicsWindowCarbon b/include/osgViewer/api/Carbon/GraphicsWindowCarbon index 08d45d82c..925cd14fa 100644 --- a/include/osgViewer/api/Carbon/GraphicsWindowCarbon +++ b/include/osgViewer/api/Carbon/GraphicsWindowCarbon @@ -128,6 +128,8 @@ class GraphicsWindowCarbon : public osgViewer::GraphicsWindow WindowRef _window; AGLContext _context; AGLPixelFormat _pixelFormat; + + int _windowTitleHeight; private: bool _closeRequested; diff --git a/src/osgViewer/GraphicsWindowCarbon.cpp b/src/osgViewer/GraphicsWindowCarbon.cpp index ac2c8adfb..bbb1ee5b4 100644 --- a/src/osgViewer/GraphicsWindowCarbon.cpp +++ b/src/osgViewer/GraphicsWindowCarbon.cpp @@ -538,6 +538,7 @@ void GraphicsWindowCarbon::setWindowDecoration(bool flag) void GraphicsWindowCarbon::init() { + _windowTitleHeight = 0; _closeRequested = false; _context = NULL; _window = NULL; @@ -594,8 +595,14 @@ bool GraphicsWindowCarbon::realizeImplementation() if (err) { osg::notify(osg::WARN) << "GraphicsWindowCarbon::realizeImplementation() failed creating a window: " << err << std::endl; return false; + } else { + osg::notify(osg::INFO) << "GraphicsWindowCarbon::realizeImplementation() - window created with bounds(" << bounds.top << ", " << bounds.left << ", " << bounds.bottom << ", " << bounds.right << ")" << std::endl; } + Rect titleRect; + GetWindowBounds(_window, kWindowTitleBarRgn, &titleRect); + _windowTitleHeight = abs(titleRect.top); + // register window event handler to receive resize-events EventTypeSpec windEventList[] = { { kEventClassWindow, kEventWindowBoundsChanged}, @@ -744,6 +751,10 @@ bool GraphicsWindowCarbon::handleMouseEvent(EventRef theEvent) Point wheresMyMouse; GetEventParameter (theEvent, kEventParamWindowMouseLocation, typeQDPoint, NULL, sizeof(wheresMyMouse), NULL, &wheresMyMouse); + wheresMyMouse.v -= _windowTitleHeight; + if (_useWindowDecoration && (wheresMyMouse.v < 0)) + return false; + Point wheresMyMouseGlobal; GetEventParameter (theEvent, kEventParamMouseLocation, typeQDPoint, NULL, sizeof(wheresMyMouse), NULL, &wheresMyMouseGlobal);