+ case NAVIGATOR_SWIPE_DOWN:
+ /* XXX Open app menu */
+ break;
+
+ /* Orientation is a bunch of handshakes.
+ - First the app get's asked if it wants to rotate (NAVIGATOR_ORIENTATION_CHECK)
+ - If the app wants to rotate, then it will be told what size it will be after rotate (NAVIGATOR_ORIENTATION_SIZE).
+ - Once the OS confirms that it's ready to rotate, it tells the app to handle rotation (NAVIGATOR_ORIENTATION).
+ - Once rotation is complete, the OS tells the app it's done (NAVIGATOR_ORIENTATION_DONE) */
+ case NAVIGATOR_ORIENTATION_CHECK:
+ LOGI("fgPlatformProcessSingleEvent: NAVIGATOR_ORIENTATION_CHECK");
+
+ /* Reset sizes */
+ window->State.pWState.newWidth = 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 */
+ navigator_orientation_check_response(fgDisplay.pDisplay.event, true);
+ break;
+
+ case NAVIGATOR_ORIENTATION:
+ LOGI("fgPlatformProcessSingleEvent: NAVIGATOR_ORIENTATION");
+
+ /* NAVIGATOR_ORIENTATION occurs before NAVIGATOR_KEYBOARD_POSITION */
+
+ /* Rotate and resize the window */
+ fgPlatformRotateWindow(window, navigator_event_get_orientation_angle(fgDisplay.pDisplay.event));
+ fgPlatformFlushCommands();
+#ifdef __PLAYBOOK__
+ /* PlayBook doesn't indicate what the new size will be, so we need to retrieve it from the window itself */
+ window->State.pWState.newWidth = glutGet(GLUT_WINDOW_WIDTH);
+ window->State.pWState.newHeight = glutGet(GLUT_WINDOW_HEIGHT);
+ fghOnReshapeNotify(window, window->State.pWState.newWidth, window->State.pWState.newHeight, GL_FALSE);
+#else
+ if(window->State.pWState.keyboardOpen == GL_FALSE) {
+ /* On rotation, if the keyboard is open, it will get the keyboard resize events anyway. Otherwise, handle the resize. */
+ fghOnReshapeNotify(window, window->State.pWState.newWidth, window->State.pWState.newHeight, GL_FALSE);
+ }
+#endif
+
+ /* Reset sizes */
+ window->State.pWState.newWidth = 0;
+ window->State.pWState.newHeight = 0;
+
+ /* Done rotating */
+ navigator_done_orientation(fgDisplay.pDisplay.event);
+ break;
+
+ case NAVIGATOR_BACK:
+ LOGI("fgPlatformProcessSingleEvent: NAVIGATOR_BACK");
+ INVOKE_WCB(*window, Keyboard, (ESCAPE_BUTTON_KEY, window->State.MouseX, window->State.MouseY));
+ INVOKE_WCB(*window, KeyboardUp, (ESCAPE_BUTTON_KEY, window->State.MouseX, window->State.MouseY));
+ break;
+
+ case NAVIGATOR_WINDOW_ACTIVE:
+ LOGI("fgPlatformProcessSingleEvent: NAVIGATOR_WINDOW_ACTIVE");
+ INVOKE_WCB(*window, AppStatus, (GLUT_APPSTATUS_RESUME));
+ break;
+
+ case NAVIGATOR_WINDOW_INACTIVE:
+ LOGI("fgPlatformProcessSingleEvent: NAVIGATOR_WINDOW_INACTIVE");
+ INVOKE_WCB(*window, AppStatus, (GLUT_APPSTATUS_PAUSE));
+ break;
+
+ case NAVIGATOR_ORIENTATION_DONE:
+ case NAVIGATOR_ORIENTATION_RESULT:
+ LOGI("fgPlatformProcessSingleEvent: NAVIGATOR_ORIENTATION_DONE/NAVIGATOR_ORIENTATION_RESULT");
+ break;
+
+#ifndef __PLAYBOOK__
+ case NAVIGATOR_KEYBOARD_STATE:
+ case NAVIGATOR_KEYBOARD_POSITION:
+ /* See virtual keyboard handling for info on why this is not used. */
+ break;
+
+ case NAVIGATOR_DEVICE_LOCK_STATE:
+ break;
+
+ case NAVIGATOR_WINDOW_COVER:
+ case NAVIGATOR_WINDOW_COVER_ENTER:
+ case NAVIGATOR_WINDOW_COVER_EXIT:
+ /* BlackBerry specific. Let app status and window status take care of everything */
+ break;
+
+ case NAVIGATOR_APP_STATE:
+ /* Can do the same as NAVIGATOR_WINDOW_ACTIVE/NAVIGATOR_WINDOW_INACTIVE but
+ seems like it doesn't work when the app comes to the foreground. Might be a bug */
+ break;
+
+ case NAVIGATOR_ORIENTATION_SIZE:
+ LOGI("fgPlatformProcessSingleEvent: NAVIGATOR_ORIENTATION_SIZE");
+
+ /* Get new window size */
+ window->State.pWState.newWidth = navigator_event_get_orientation_size_width(fgDisplay.pDisplay.event);
+ window->State.pWState.newHeight = navigator_event_get_orientation_size_height(fgDisplay.pDisplay.event);
+ break;
+#endif
+
+ case 0: //Doesn't exist in header, but shows up when keyboard shows and resizes
+ case NAVIGATOR_OTHER:
+ break;
+
+ default:
+ LOGW("fgPlatformProcessSingleEvent: unknown navigator event: 0x%X", SLOG2_FA_SIGNED(eventType));
+ break;
+ }
+ }
+ /*
+ * BlackBerry 10 navigator provides keyboard events, but they conflict with how we handle keyboard events.
+ * Causing multiple reshape messages and can leave window state incorrectly setup.
+ */
+ else if(domain == virtualkeyboard_get_domain()) {
+ unsigned int eventType = bps_event_get_code(fgDisplay.pDisplay.event);
+ switch (eventType) {
+ 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;
+
+ case VIRTUALKEYBOARD_EVENT_HIDDEN:
+ LOGI("fgPlatformProcessSingleEvent: VIRTUALKEYBOARD_EVENT_HIDDEN");
+ if(window->State.pWState.keyboardOpen != GL_FALSE) {
+ window->State.pWState.keyboardOpen = GL_FALSE;
+ fgPlatformHandleKeyboardHeight(window, 0);