Permalink
Browse files

Merge pull request #17 from blackberry/next

Set screen rotation on video initialization to ensure that applications
  • Loading branch information...
asimonov-rim
asimonov-rim committed Mar 12, 2012
2 parents 9f5a9ba + 2848c71 commit d492015cbbbcf7341dfb39a01b0d104fcb8e8d76
@@ -448,6 +448,17 @@ SDL_Surface *PLAYBOOK_SetVideoMode(_THIS, SDL_Surface *current,
return NULL;
}
+ int angle = 0;
+ char *orientation = getenv("ORIENTATION");
+ if (orientation) {
+ angle = atoi(orientation);
+ }
+ rc = screen_set_window_property_iv(screenWindow, SCREEN_PROPERTY_ROTATION, &angle);
+ if (rc) {
+ SDL_SetError("Cannot set window rotation: %s", strerror(errno));
+ return NULL;
+ }
+
int bufferCount = 1; // FIXME: (flags & SDL_DOUBLEBUF)?2:1; - Currently double-buffered surfaces are slow!
rc = screen_create_window_buffers(screenWindow, bufferCount);
if (rc) {
@@ -370,6 +370,17 @@ SDL_Surface *PLAYBOOK_8Bit_SetVideoMode(_THIS, SDL_Surface *current,
goto error4;
}
+ int angle = 0;
+ char *orientation = getenv("ORIENTATION");
+ if (orientation) {
+ angle = atoi(orientation);
+ }
+ rc = screen_set_window_property_iv(screenWindow, SCREEN_PROPERTY_ROTATION, &angle);
+ if (rc) {
+ SDL_SetError("Cannot set window rotation: %s", strerror(errno));
+ goto error4;
+ }
+
rc = screen_create_window_buffers(screenWindow, 2);
if (rc) {
SDL_SetError("Cannot create window buffers: %s", strerror(errno));
@@ -148,6 +148,17 @@ SDL_Surface *PLAYBOOK_SetVideoMode_GL(_THIS, SDL_Surface *current,
goto error4;
}
+ int angle = 0;
+ char *orientation = getenv("ORIENTATION");
+ if (orientation) {
+ angle = atoi(orientation);
+ }
+ rc = screen_set_window_property_iv(screenWindow, SCREEN_PROPERTY_ROTATION, &angle);
+ if (rc) {
+ SDL_SetError("Cannot set window rotation: %s", strerror(errno));
+ goto error4;
+ }
+
rc = screen_create_window_buffers(screenWindow, 2);
if (rc) {
SDL_SetError("Cannot create window buffers: %s", strerror(errno));

0 comments on commit d492015

Please sign in to comment.