Changeset 9871
- Timestamp:
- 03/09/09 10:58:45 (4 years ago)
- Location:
- OpenSceneGraph/branches/osg-cocoa-dev
- Files:
-
- 3 modified
-
include/osgViewer/api/Carbon/GraphicsWindowCarbon (modified) (2 diffs)
-
src/osgViewer/CMakeLists.txt (modified) (1 diff)
-
src/osgViewer/GraphicsWindowCarbon.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/branches/osg-cocoa-dev/include/osgViewer/api/Carbon/GraphicsWindowCarbon
r9831 r9871 143 143 // get the pixelformat 144 144 AGLPixelFormat getAGLPixelFormat() { return _pixelFormat; } 145 146 void adaptResize(int x, int y, int w, int h); 145 147 146 148 protected: … … 148 150 void init(); 149 151 150 void transformMouseXY(float& x, float& y); 151 152 153 152 void transformMouseXY(float& x, float& y); 154 153 155 154 -
OpenSceneGraph/branches/osg-cocoa-dev/src/osgViewer/CMakeLists.txt
r9845 r9871 100 100 PixelBufferCarbon.cpp 101 101 ) 102 SET(LIB_EXTRA_LIBS ${COCOA_LIBRARY} ${LIB_EXTRA_LIBS}) 102 103 103 104 ELSE(${OSG_WINDOWING_SYSTEM} STREQUAL "Carbon") -
OpenSceneGraph/branches/osg-cocoa-dev/src/osgViewer/GraphicsWindowCarbon.cpp
r9831 r9871 70 70 GetEventParameter( event, kEventParamCurrentBounds, typeQDRectangle, NULL, sizeof(Rect), NULL, &bounds ); 71 71 72 w->resized(bounds.left, bounds.top, bounds.right - bounds.left, bounds.bottom - bounds.top); 73 w->getEventQueue()->windowResize(bounds.left, bounds.top, bounds.right - bounds.left, bounds.bottom - bounds.top, w->getEventQueue()->getTime()); 74 w->requestRedraw(); 72 w->adaptResize(bounds.left, bounds.top, bounds.right - bounds.left, bounds.bottom - bounds.top); 73 w->requestRedraw(); 75 74 result = noErr; 76 75 break; … … 79 78 InvalWindowRect(window, GetWindowPortBounds(window, &bounds)); 80 79 GetWindowBounds(window, kWindowContentRgn, &bounds); 81 w->resized(bounds.left, bounds.top, bounds.right - bounds.left, bounds.bottom - bounds.top); 82 w->getEventQueue()->windowResize(bounds.left, bounds.top, bounds.right - bounds.left, bounds.bottom - bounds.top, w->getEventQueue()->getTime()); 80 w->adaptResize(bounds.left, bounds.top, bounds.right - bounds.left, bounds.bottom - bounds.top); 83 81 result = noErr; 84 82 break; … … 359 357 DarwinWindowingSystemInterface* wsi = dynamic_cast<DarwinWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface()); 360 358 int screenLeft(0), screenTop(0); 361 if (wsi) {362 359 if (wsi) 360 { 363 361 wsi->getScreenTopLeft((*_traits), screenLeft, screenTop); 364 _traits->y += screenTop; 365 _traits->x += screenLeft; 366 } 362 } 367 363 368 364 WindowData *windowData = ( _traits.get() && _traits->inheritedWindowData.get() ) ? static_cast<osgViewer::GraphicsWindowCarbon::WindowData*>(_traits->inheritedWindowData.get()) : 0; … … 373 369 374 370 // create the window 375 Rect bounds = {_traits->y , _traits->x, _traits->y + _traits->height, _traits->x + _traits->width};371 Rect bounds = {_traits->y + screenTop, _traits->x + screenLeft, _traits->y + _traits->height + screenTop, _traits->x + _traits->width + screenLeft}; 376 372 OSStatus err = 0; 377 373 WindowAttributes attr = computeWindowAttributes(_useWindowDecoration, _traits->supportsResize); … … 532 528 aglUpdateContext(_context); 533 529 MenubarController::instance()->update(); 530 531 getEventQueue()->windowResize(x,y,width, height, getEventQueue()->getTime()); 534 532 } 535 533 … … 900 898 bool GraphicsWindowCarbon::setWindowRectangleImplementation(int x, int y, int width, int height) 901 899 { 902 Rect bounds = {y, x, y + height, x + width}; 900 int screenLeft(0), screenTop(0); 901 DarwinWindowingSystemInterface* wsi = dynamic_cast<DarwinWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface()); 902 if (wsi) 903 { 904 wsi->getScreenTopLeft((*_traits), screenLeft, screenTop); 905 } 906 907 Rect bounds = {y + screenTop, x + screenLeft, y + height + screenTop, x + width + screenLeft}; 903 908 SetWindowBounds(getNativeWindowRef(), kWindowContentRgn, &bounds); 904 909 aglUpdateContext(_context); … … 906 911 return true; 907 912 } 913 914 915 916 void GraphicsWindowCarbon::adaptResize(int x, int y, int w, int h) 917 { 918 DarwinWindowingSystemInterface* wsi = dynamic_cast<DarwinWindowingSystemInterface*>(osg::GraphicsContext::getWindowingSystemInterface()); 919 int screenLeft(0), screenTop(0); 920 if (wsi) { 921 922 // get the screen containing the window 923 unsigned int screenNdx = wsi->getScreenContaining(x,y,w,h); 924 925 // update traits 926 _traits->screenNum = screenNdx; 927 928 // get top left of screen 929 wsi->getScreenTopLeft((*_traits), screenLeft, screenTop); 930 } 931 932 resized(x-screenLeft,y-screenTop,w,h); 933 } 934 935 908 936 909 937 void GraphicsWindowCarbon::grabFocus()
