[cig-commits] commit: Getting the CarbonWindows to be able to resize nicely.
Mercurial
hg at geodynamics.org
Mon Nov 24 11:29:15 PST 2008
changeset: 42:7b6734132e27
user: RobertTurnbull
date: Fri Jan 11 05:41:53 2008 +0000
files: Base/src/Window.c Base/src/Window.h Windowing/src/CarbonWindow.c
description:
Getting the CarbonWindows to be able to resize nicely.
(I'll try to do the same on the X11 windows sometime soon)
diff -r f891be02e23a -r 7b6734132e27 Base/src/Window.c
--- a/Base/src/Window.c Sat Nov 24 23:21:07 2007 +0000
+++ b/Base/src/Window.c Fri Jan 11 05:41:53 2008 +0000
@@ -39,7 +39,7 @@
*+ Patrick Sunter
*+ Greg Watson
*+
-** $Id: Window.c 740 2007-10-11 08:05:31Z SteveQuenette $
+** $Id: Window.c 754 2008-01-11 05:41:53Z RobertTurnbull $
**
**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
@@ -885,4 +885,27 @@ void lucWindow_ToggleApplicationQuit( vo
self->toggleApplicationQuit = True;
}
+void lucWindow_Resize( void* window, Pixel_Index newWidth, Pixel_Index newHeight ) {
+ lucWindow* self = (lucWindow*) window;
+ Viewport_Index viewport_I;
+ Viewport_Index viewportCount = self->viewportCount;
+ lucViewportInfo* viewportInfo;
+ double xScale = (double) newWidth / (double) self->width;
+ double yScale = (double) newHeight / (double) self->height;
+
+ for ( viewport_I = 0 ; viewport_I < viewportCount ; viewport_I++ ) {
+ viewportInfo = &self->viewportInfoList[ viewport_I ];
+
+ viewportInfo->startx = (Pixel_Index) ( xScale * (double) viewportInfo->startx + 0.5 );
+ viewportInfo->width = (Pixel_Index) ( xScale * (double) viewportInfo->width + 0.5 );
+ viewportInfo->starty = (Pixel_Index) ( yScale * (double) viewportInfo->starty + 0.5 );
+ viewportInfo->height = (Pixel_Index) ( yScale * (double) viewportInfo->height + 0.5 );
+ viewportInfo->needsToDraw = True;
+ }
+
+ self->width = newWidth;
+ self->height = newHeight;
+
+}
+
#endif /* HAVE_GL */
diff -r f891be02e23a -r 7b6734132e27 Base/src/Window.h
--- a/Base/src/Window.h Sat Nov 24 23:21:07 2007 +0000
+++ b/Base/src/Window.h Fri Jan 11 05:41:53 2008 +0000
@@ -39,7 +39,7 @@
*+ Patrick Sunter
*+ Greg Watson
*+
-** $Id: Window.h 658 2007-02-05 00:58:07Z CecileDuboz $
+** $Id: Window.h 754 2008-01-11 05:41:53Z RobertTurnbull $
**
**~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
@@ -148,4 +148,5 @@
void lucWindow_BeginEventLoop( void* window ) ;
void lucWindow_QuitEventLoop( void* window ) ;
void lucWindow_ToggleApplicationQuit( void* window ) ;
+ void lucWindow_Resize( void* window, Pixel_Index newWidth, Pixel_Index newHeight ) ;
#endif
diff -r f891be02e23a -r 7b6734132e27 Windowing/src/CarbonWindow.c
--- a/Windowing/src/CarbonWindow.c Sat Nov 24 23:21:07 2007 +0000
+++ b/Windowing/src/CarbonWindow.c Fri Jan 11 05:41:53 2008 +0000
@@ -524,8 +524,7 @@ static pascal OSStatus lucCarbonWindow_E
self->offsetX = (Pixel_Index) rect.left;
self->offsetY = (Pixel_Index) rect.top;
- self->width = (Pixel_Index) (rect.right - rect.left);
- self->height = (Pixel_Index) (rect.bottom - rect.top);
+ lucWindow_Resize( self, (Pixel_Index) (rect.right - rect.left), (Pixel_Index) (rect.bottom - rect.top) );
if (self->windowIsVisible && self->graphicsContext)
lucCarbonWindow_Draw(self);
More information about the CIG-COMMITS
mailing list