Skip to content
Browse files

PlayBook doesn't handle rotation in the same way as BB10. Add a hack …

…to detect this.
  • Loading branch information...
1 parent 3aefdc4 commit d92c59639dbefc4bfb7ba8b74c3789a67ccac449 @jnicholl jnicholl committed
Showing with 16 additions and 0 deletions.
  1. +2 −0 src/video/playbook/SDL_playbooktouch.c
  2. +14 −0 src/video/playbook/SDL_playbookvideo.c
View
2 src/video/playbook/SDL_playbooktouch.c
@@ -220,6 +220,7 @@ void locateTCOControlFile(_THIS)
if (fd) {
_priv->tcoControlsDir = SDL_malloc(strlen(fullPath) - strlen(filename) + 1);
strncpy(_priv->tcoControlsDir, fullPath, strlen(fullPath) - strlen(filename));
+ _priv->tcoControlsDir[strlen(fullPath)-strlen(filename)] = '\0';
fclose(fd);
} else {
sprintf(fullPath, "%s/../app/native/%s", homeDir, filename);
@@ -227,6 +228,7 @@ void locateTCOControlFile(_THIS)
if (fd) {
_priv->tcoControlsDir = SDL_malloc(strlen(fullPath) - strlen(filename) + 1);
strncpy(_priv->tcoControlsDir, fullPath, strlen(fullPath) - strlen(filename));
+ _priv->tcoControlsDir[strlen(fullPath)-strlen(filename)] = '\0';
fclose(fd);
} else {
_priv->tcoControlsDir = 0; // Use SDL multi-mouse controls.
View
14 src/video/playbook/SDL_playbookvideo.c
@@ -273,6 +273,20 @@ int PLAYBOOK_VideoInit(_THIS, SDL_PixelFormat *vformat)
}
}
+ // FIXME: Bad hack for PlayBook to avoid rotation issues.
+ if (screenResolution[0] == 600 && screenResolution[1] == 1024) {
+ int angle = 0;
+ char *orientation = getenv("ORIENTATION");
+ if (orientation) {
+ fprintf(stderr, "Received orientation: %s\n", orientation);
+ angle = atoi(orientation);
+ if (angle == 0) {
+ screenResolution[0] = 1024;
+ screenResolution[1] = 600;
+ }
+ }
+ }
+
rc = screen_create_window(&_priv->mainWindow, _priv->screenContext);
if (rc) {
SDL_SetError("Cannot create main application window: %s", strerror(errno));

0 comments on commit d92c596

Please sign in to comment.
Something went wrong with that request. Please try again.