Kaydet (Commit) ab49c55b authored tarafından Tor Lillqvist's avatar Tor Lillqvist

More orientation experimentation and hacking

Now it re-orients and re-sizes the LO "frame" correctly upon rotation,
but it still starts wrongly if starting in landscape orientation.

Change-Id: I4c12a7e00d687391435a47400b6e8b4c7e49bdda
üst 5358b9ba
...@@ -62,6 +62,8 @@ static View *theView; ...@@ -62,6 +62,8 @@ static View *theView;
[self.window addGestureRecognizer: tapRecognizer]; [self.window addGestureRecognizer: tapRecognizer];
NSLog(@"statusBarOrientation: %d", [[UIApplication sharedApplication] statusBarOrientation]);
if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation])) if (UIInterfaceOrientationIsLandscape([[UIApplication sharedApplication] statusBarOrientation]))
lo_set_view_size(applicationFrame.size.height, applicationFrame.size.width); lo_set_view_size(applicationFrame.size.height, applicationFrame.size.width);
else else
......
...@@ -15,8 +15,9 @@ ...@@ -15,8 +15,9 @@
- (void)drawRect:(CGRect)rect - (void)drawRect:(CGRect)rect
{ {
NSLog(@"drawRect: %dx%d@(%d,%d)", (int) rect.size.width, (int) rect.size.height, (int) rect.origin.x, (int) rect.origin.y); NSLog(@"drawRect: %dx%d@(%d,%d)", (int) rect.size.width, (int) rect.size.height, (int) rect.origin.x, (int) rect.origin.y);
NSLog(@"statusBarOrientation: %d", [[UIApplication sharedApplication] statusBarOrientation]);
NSDate *startDate = [NSDate date]; // NSDate *startDate = [NSDate date];
CGContextRef context = UIGraphicsGetCurrentContext(); CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSaveGState(context); CGContextSaveGState(context);
...@@ -27,23 +28,22 @@ ...@@ -27,23 +28,22 @@
CGContextScaleCTM(context, 1, -1); CGContextScaleCTM(context, 1, -1);
break; break;
case UIInterfaceOrientationLandscapeLeft: case UIInterfaceOrientationLandscapeLeft:
CGContextTranslateCTM(context, self.frame.size.width, self.frame.size.height); CGContextTranslateCTM(context, 0, self.frame.size.width);
CGContextRotateCTM(context, M_PI/2); CGContextScaleCTM(context, 1, -1);
CGContextScaleCTM(context, -1, 1);
break; break;
case UIInterfaceOrientationLandscapeRight: case UIInterfaceOrientationLandscapeRight:
CGContextRotateCTM(context, -M_PI/2); CGContextTranslateCTM(context, 0, self.frame.size.width);
CGContextScaleCTM(context, -1, 1); CGContextScaleCTM(context, 1, -1);
break; break;
case UIInterfaceOrientationPortraitUpsideDown: case UIInterfaceOrientationPortraitUpsideDown:
CGContextTranslateCTM(context, self.frame.size.width, 0); CGContextTranslateCTM(context, 0, self.frame.size.height);
CGContextScaleCTM(context, -1, 1); CGContextScaleCTM(context, 1, -1);
break; break;
} }
lo_render_windows(context, rect); lo_render_windows(context, rect);
CGContextRestoreGState(context); CGContextRestoreGState(context);
NSLog(@"drawRect: lo_render_windows took %f s", [[NSDate date] timeIntervalSinceDate: startDate]); // NSLog(@"drawRect: lo_render_windows took %f s", [[NSDate date] timeIntervalSinceDate: startDate]);
} }
- (void) tapGesture:(UIGestureRecognizer *)gestureRecognizer - (void) tapGesture:(UIGestureRecognizer *)gestureRecognizer
......
...@@ -25,6 +25,13 @@ ...@@ -25,6 +25,13 @@
NSLog(@" frame=%dx%d@(%d,%d)", (int)rect.size.width, (int)rect.size.height, (int)rect.origin.x, (int)rect.origin.y); NSLog(@" frame=%dx%d@(%d,%d)", (int)rect.size.width, (int)rect.size.height, (int)rect.origin.x, (int)rect.origin.y);
} }
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
{
(void) fromInterfaceOrientation;
NSLog(@"didRotateFromInterfaceOrientation: statusBarOrientation: %d interfaceOrientation: %d", [[UIApplication sharedApplication] statusBarOrientation], [self interfaceOrientation]);
}
@end @end
// vim:set shiftwidth=4 softtabstop=4 expandtab: // vim:set shiftwidth=4 softtabstop=4 expandtab:
...@@ -165,6 +165,12 @@ public: ...@@ -165,6 +165,12 @@ public:
IosSalInstance::getInstance()->GetWorkArea( rRect ); IosSalInstance::getInstance()->GetWorkArea( rRect );
} }
void ShowFullScreen( sal_Bool, sal_Int32 )
{
SetPosSize( 0, 0, viewWidth, viewHeight,
SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT );
}
virtual void damaged( const basegfx::B2IBox& rDamageRect ) virtual void damaged( const basegfx::B2IBox& rDamageRect )
{ {
if (rDamageRect.isEmpty()) if (rDamageRect.isEmpty())
...@@ -276,7 +282,10 @@ IMPL_LINK( IosSalInstance, DisplayConfigurationChanged, void*, ) ...@@ -276,7 +282,10 @@ IMPL_LINK( IosSalInstance, DisplayConfigurationChanged, void*, )
for( std::list< SalFrame* >::const_iterator it = getFrames().begin(); for( std::list< SalFrame* >::const_iterator it = getFrames().begin();
it != getFrames().end(); it != getFrames().end();
it++ ) { it++ ) {
(*it)->Show( sal_False, sal_False );
(*it)->CallCallback( SALEVENT_SETTINGSCHANGED, 0 ); (*it)->CallCallback( SALEVENT_SETTINGSCHANGED, 0 );
(*it)->SetPosSize(0, 0, viewWidth, viewHeight, SAL_FRAME_POSSIZE_WIDTH | SAL_FRAME_POSSIZE_HEIGHT);
(*it)->Show( sal_True, sal_False );
} }
lo_damaged( CGRectMake( 0, 0, viewWidth, viewHeight ) ); lo_damaged( CGRectMake( 0, 0, viewWidth, viewHeight ) );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment