X-Git-Url: http://git.mutantstargoat.com/user/nuclear/?a=blobdiff_plain;f=src%2Fblackberry%2Ffg_state_blackberry.c;h=246ba04c6dc57c85bc666b6b58c7efa3fe7609b8;hb=265a4c1c07f001dce197024c77ecad3d6aa9b111;hp=c7991a941ef55caeb81c491e8d43ccaa17e805e5;hpb=5f89d95bd3ce9d96f28b457afe53e68098a8380e;p=freeglut diff --git a/src/blackberry/fg_state_blackberry.c b/src/blackberry/fg_state_blackberry.c index c7991a9..246ba04 100644 --- a/src/blackberry/fg_state_blackberry.c +++ b/src/blackberry/fg_state_blackberry.c @@ -35,8 +35,10 @@ //From fg_state_android.c int fgPlatformGlutDeviceGet ( GLenum eWhat ) { +#ifndef __PLAYBOOK__ int deviceCount, i, value; screen_device_t* devices; +#endif switch( eWhat ) { @@ -51,7 +53,8 @@ int fgPlatformGlutDeviceGet ( GLenum eWhat ) case GLUT_NUM_MOUSE_BUTTONS: /* BlackBerry has a touchscreen, which we can consider a 1-button mouse at min. - Otherwise check for an actual mouse, else get max touch points */ + Otherwise check for an actual mouse, else get max touch points. PlayBook does not support this. */ +#ifndef __PLAYBOOK__ if(!screen_get_context_property_iv(fgDisplay.pDisplay.screenContext, SCREEN_PROPERTY_DEVICE_COUNT, &deviceCount)) { devices = (screen_device_t*)calloc(deviceCount, sizeof(screen_device_t)); if(!screen_get_context_property_pv(fgDisplay.pDisplay.screenContext, SCREEN_PROPERTY_DEVICES, (void**)devices)) { @@ -60,6 +63,7 @@ int fgPlatformGlutDeviceGet ( GLenum eWhat ) if(!screen_get_device_property_iv(devices[i], SCREEN_PROPERTY_TYPE, &value) && value == SCREEN_EVENT_POINTER && !screen_get_device_property_iv(devices[i], SCREEN_PROPERTY_BUTTON_COUNT, &value)) { + free(devices); return value; } } @@ -68,12 +72,14 @@ int fgPlatformGlutDeviceGet ( GLenum eWhat ) if(!screen_get_device_property_iv(devices[i], SCREEN_PROPERTY_TYPE, &value) && value == SCREEN_EVENT_MTOUCH_TOUCH && !screen_get_device_property_iv(devices[i], SCREEN_PROPERTY_MAXIMUM_TOUCH_ID, &value)) { + free(devices); return value; } } } free(devices); } +#endif /* Backup, pretend it's a 1-button mouse */ return 1; @@ -101,18 +107,20 @@ int fgPlatformGlutGet ( GLenum eWhat ) { if ( fgStructure.CurrentWindow == NULL ) return 0; + int size[2]; int orientation; if ( screen_get_window_property_iv(fgStructure.CurrentWindow->Window.Handle, SCREEN_PROPERTY_BUFFER_SIZE, size) != 0 ) return 0; if ( screen_get_window_property_iv(fgStructure.CurrentWindow->Window.Handle, SCREEN_PROPERTY_ROTATION, &orientation) != 0 ) - return 0; + return 0; + int orientationDif = abs(orientation - fgStructure.CurrentWindow->State.pWState.originalRotation); if (orientationDif == 90 || orientationDif == 270) { - /* Swap dim. if screen is rotated */ - int tmp = size[0]; - size[0] = size[1]; - size[1] = tmp; + /* Swap dim. if screen is rotated */ + int tmp = size[0]; + size[0] = size[1]; + size[1] = tmp; } switch ( eWhat ) {