Updated toolchain so that it does a more exact check if this is for PlayBook or BlackBerry 10 Fixed bug with keyboard on PlayBook where keyboard heights only occurred on rotation, and resize would occur twice because of it and resize wouldn't happen for keyboard

This commit is contained in:
Rcmaniac25 2013-09-18 02:00:26 -04:00
parent 325873c14e
commit 447b1167d0
4 changed files with 47 additions and 15 deletions

View File

@ -33,7 +33,7 @@ set( CMAKE_SYSTEM_NAME Linux )
set( CMAKE_SYSTEM_VERSION 1 ) set( CMAKE_SYSTEM_VERSION 1 )
# Check for PlayBook # Check for PlayBook
if( EXISTS "${BLACKBERRY_TARGET_ROOT}/usr/include" ) if( EXISTS "${BLACKBERRY_TARGET_ROOT}/x86/lib/gcc/4.4.2" )
set( PLAYBOOK True ) set( PLAYBOOK True )
endif() endif()

View File

@ -43,7 +43,7 @@ struct tagSFG_PlatformDisplay
{ {
struct tagSFG_PlatformDisplayEGL egl; struct tagSFG_PlatformDisplayEGL egl;
screen_context_t screenContext; screen_context_t screenContext;
bps_event_t* event; bps_event_t* event;
EGLNativeWindowType single_native_window; EGLNativeWindowType single_native_window;
}; };
@ -114,11 +114,15 @@ struct tagSFG_PlatformJoystick
typedef struct tagSFG_PlatformWindowState SFG_PlatformWindowState; typedef struct tagSFG_PlatformWindowState SFG_PlatformWindowState;
struct tagSFG_PlatformWindowState struct tagSFG_PlatformWindowState
{ {
int newWidth; int newWidth;
int newHeight; int newHeight;
int originalRotation; int originalRotation;
navigator_window_state_t windowState; navigator_window_state_t windowState;
GLboolean windowCovered; GLboolean windowCovered;
#ifdef __PLAYBOOK__
int keyboardHeight;
GLboolean keyboardOpen;
#endif
}; };
/* Menu font and color definitions */ /* Menu font and color definitions */

View File

@ -31,11 +31,13 @@
#include "fg_internal.h" #include "fg_internal.h"
#include "egl/fg_window_egl.h" #include "egl/fg_window_egl.h"
#ifdef __PLAYBOOK__
#include <sys/slog.h>
#ifdef NDEBUG #ifdef NDEBUG
#define LOGI(...) #define LOGI(...)
#else #endif
#ifdef __PLAYBOOK__
#include <sys/slog.h>
#ifndef LOGI
#define LOGI(...) ((void)slogf(1337, _SLOG_INFO, __VA_ARGS__)) #define LOGI(...) ((void)slogf(1337, _SLOG_INFO, __VA_ARGS__))
#endif #endif
#define LOGW(...) ((void)slogf(1337, _SLOG_WARNING, __VA_ARGS__)) #define LOGW(...) ((void)slogf(1337, _SLOG_WARNING, __VA_ARGS__))
@ -44,9 +46,7 @@
#endif #endif
#else #else
#include <slog2.h> #include <slog2.h>
#ifdef NDEBUG #ifndef LOGI
#define LOGI(...)
#else
#define LOGI(...) ((void)slog2fa(NULL, 1337, SLOG2_INFO, __VA_ARGS__, SLOG2_FA_END)) #define LOGI(...) ((void)slog2fa(NULL, 1337, SLOG2_INFO, __VA_ARGS__, SLOG2_FA_END))
#endif #endif
#define LOGW(...) ((void)slog2fa(NULL, 1337, SLOG2_WARNING, __VA_ARGS__, SLOG2_FA_END)) #define LOGW(...) ((void)slog2fa(NULL, 1337, SLOG2_WARNING, __VA_ARGS__, SLOG2_FA_END))
@ -353,6 +353,12 @@ void fgPlatformProcessSingleEvent ( void )
do do
{ {
SFG_Window* window = fgStructure.CurrentWindow; SFG_Window* window = fgStructure.CurrentWindow;
#ifdef __PLAYBOOK__
/* Get the keyboard height before doing anything since we otherwise don't get it until it changes */
if(window->State.pWState.keyboardHeight == 0) {
virtualkeyboard_get_height(&window->State.pWState.keyboardHeight);
}
#endif
domain = bps_event_get_domain(fgDisplay.pDisplay.event); domain = bps_event_get_domain(fgDisplay.pDisplay.event);
if (domain == screen_get_domain()) { if (domain == screen_get_domain()) {
int eventType; int eventType;
@ -626,6 +632,8 @@ void fgPlatformProcessSingleEvent ( void )
} else { } else {
LOGW("NAVIGATOR_EXIT: No current window"); LOGW("NAVIGATOR_EXIT: No current window");
} }
//XXX Should this be a bit more "forceful" so that it doesn't continue to loop through events?
break; break;
} }
@ -645,6 +653,11 @@ void fgPlatformProcessSingleEvent ( void )
window->State.pWState.newWidth = 0; window->State.pWState.newWidth = 0;
window->State.pWState.newHeight = 0; window->State.pWState.newHeight = 0;
#ifdef __PLAYBOOK__
/* On rotation, the keyboard is closed. This prevents two resize calls */
window->State.pWState.keyboardOpen = GL_FALSE;
#endif
/* Notify that we want to rotate */ /* Notify that we want to rotate */
navigator_orientation_check_response(fgDisplay.pDisplay.event, true); navigator_orientation_check_response(fgDisplay.pDisplay.event, true);
break; break;
@ -770,20 +783,32 @@ void fgPlatformProcessSingleEvent ( void )
} }
} }
#ifdef __PLAYBOOK__ #ifdef __PLAYBOOK__
/* While this could be used for non-PlayBook, BlackBerry 10 will still get navigator events, so use those. They are a bit more exact. */
else if(domain == virtualkeyboard_get_domain()) { else if(domain == virtualkeyboard_get_domain()) {
unsigned int eventType = bps_event_get_code(fgDisplay.pDisplay.event); unsigned int eventType = bps_event_get_code(fgDisplay.pDisplay.event);
switch (eventType) { switch (eventType) {
case VIRTUALKEYBOARD_EVENT_VISIBLE: case VIRTUALKEYBOARD_EVENT_VISIBLE:
LOGI("fgPlatformProcessSingleEvent: VIRTUALKEYBOARD_EVENT_VISIBLE");
if(window->State.pWState.keyboardOpen != GL_TRUE) {
window->State.pWState.keyboardOpen = GL_TRUE;
fgPlatformHandleKeyboardHeight(window, window->State.pWState.keyboardHeight);
}
break; break;
case VIRTUALKEYBOARD_EVENT_HIDDEN: case VIRTUALKEYBOARD_EVENT_HIDDEN:
LOGI("fgPlatformProcessSingleEvent: VIRTUALKEYBOARD_EVENT_HIDDEN"); LOGI("fgPlatformProcessSingleEvent: VIRTUALKEYBOARD_EVENT_HIDDEN");
fgPlatformHandleKeyboardHeight(window, 0); if(window->State.pWState.keyboardOpen != GL_FALSE) {
window->State.pWState.keyboardOpen = GL_FALSE;
fgPlatformHandleKeyboardHeight(window, 0);
}
break; break;
case VIRTUALKEYBOARD_EVENT_INFO: case VIRTUALKEYBOARD_EVENT_INFO:
LOGI("fgPlatformProcessSingleEvent: VIRTUALKEYBOARD_EVENT_INFO"); LOGI("fgPlatformProcessSingleEvent: VIRTUALKEYBOARD_EVENT_INFO");
fgPlatformHandleKeyboardHeight(window, virtualkeyboard_event_get_height(fgDisplay.pDisplay.event)); window->State.pWState.keyboardHeight = virtualkeyboard_event_get_height(fgDisplay.pDisplay.event);
if(window->State.pWState.keyboardOpen == GL_TRUE) {
fgPlatformHandleKeyboardHeight(window, window->State.pWState.keyboardHeight);
}
break; break;
default: default:

View File

@ -37,4 +37,7 @@ void fgPlatformCreateWindow ( SFG_Window *window )
memset(&(window->State.pWState), 0, sizeof(SFG_PlatformWindowState)); memset(&(window->State.pWState), 0, sizeof(SFG_PlatformWindowState));
window->State.pWState.windowCovered = GL_FALSE; window->State.pWState.windowCovered = GL_FALSE;
#ifdef __PLAYBOOK__
window->State.pWState.keyboardOpen = GL_FALSE;
#endif
} }