From Blasius Czink, "when creating windows with decorations (titlebar) the mouse position
should be adjusted."
This commit is contained in:
parent
e8cf7b22ad
commit
9cfff7fa19
@ -128,6 +128,8 @@ class GraphicsWindowCarbon : public osgViewer::GraphicsWindow
|
||||
WindowRef _window;
|
||||
AGLContext _context;
|
||||
AGLPixelFormat _pixelFormat;
|
||||
|
||||
int _windowTitleHeight;
|
||||
|
||||
private:
|
||||
bool _closeRequested;
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user