diff -r d7370ecfa1f3 modules/graphics/src/main/java/com/sun/glass/ui/Screen.java --- a/modules/graphics/src/main/java/com/sun/glass/ui/Screen.java Tue Apr 29 14:15:39 2014 +0400 +++ b/modules/graphics/src/main/java/com/sun/glass/ui/Screen.java Tue Apr 29 14:43:04 2014 +0200 @@ -240,7 +240,7 @@ /** * Called from native when the Screen definitions change. */ - private static void notifySettingsChanged() { + public static void notifySettingsChanged() { // Save the old screens in order to dispose them later List oldScreens = screens; diff -r d7370ecfa1f3 modules/graphics/src/main/java/com/sun/glass/ui/lens/LensApplication.java --- a/modules/graphics/src/main/java/com/sun/glass/ui/lens/LensApplication.java Tue Apr 29 14:15:39 2014 +0400 +++ b/modules/graphics/src/main/java/com/sun/glass/ui/lens/LensApplication.java Tue Apr 29 14:43:04 2014 +0200 @@ -696,6 +696,13 @@ } } + private class LensScreenEvent extends Event { + @Override + void dispatch() { + Screen.notifySettingsChanged(); + } + } + private final LinkedList eventList = new LinkedList(); private void postEvent(Event e) { @@ -1596,6 +1603,17 @@ postEvent(new LensDeviceEvent(flags, attach)); } + + /** + * Notify changes in screen settings from native layer + * This method is triggered when native code detects a change in e.g. screen orientation + */ + private void notifyScreenSettingsChanged() { + if (LensLogger.getLogger().isLoggable(Level.FINE)) { + LensLogger.getLogger().fine("Notify screen settings changed"); + } + postEvent(new LensScreenEvent()); + } //******************************************************************* diff -r d7370ecfa1f3 modules/graphics/src/main/native-glass/lens/LensApplication.c --- a/modules/graphics/src/main/native-glass/lens/LensApplication.c Tue Apr 29 14:15:39 2014 +0400 +++ b/modules/graphics/src/main/native-glass/lens/LensApplication.c Tue Apr 29 14:43:04 2014 +0200 @@ -40,8 +40,12 @@ #include #ifdef ANDROID_SDK +#ifdef DALVIK_VM + #include "dalvikInput.h" +#else #include "androidInput.h" #endif +#endif //******************************************************** // JNI handles ****************************************** @@ -68,6 +72,7 @@ static jmethodID jLensApplication_notifyWindowEvent; static jmethodID jLensApplication_notifyViewEvent; static jmethodID jLensApplication_notifyDeviceEvent; +static jmethodID jLensApplication_notifyScreenSettingsChanged; static jmethodID jLensApplication_notifyMenuEvent; static jmethodID jLensApplication_reportException; @@ -162,6 +167,11 @@ jLensApplication_notifyDeviceEvent = (*env)->GetMethodID(env, jLensApplicationClass, "notifyDeviceEvent", "(IZ)V"); + + jLensApplication_notifyScreenSettingsChanged = + (*env)->GetMethodID(env, jLensApplicationClass, "notifyScreenSettingsChanged", + "()V"); + jLensApplication_notifyMenuEvent = (*env)->GetMethodID(env, jLensApplicationClass, "notifyMenuEvent", "(Lcom/sun/glass/ui/lens/LensView;IIIIZ)V"); @@ -767,6 +777,17 @@ } +void glass_application_notifyScreenSettingsChanged(JNIEnv *env) { + if (!pApplication) { + return; + } + GLASS_LOG_FINEST("JNI call notifyScreenSettinngsChanged"); + (*env)->CallVoidMethod(env, pApplication, + jLensApplication_notifyScreenSettingsChanged); + (void)glass_application_checkReportException(env); +} + + /* * Class: com_sun_glass_events_KeyEvent * Method: _getKeyCodeForChar diff -r d7370ecfa1f3 modules/graphics/src/main/native-glass/lens/LensCommon.h --- a/modules/graphics/src/main/native-glass/lens/LensCommon.h Tue Apr 29 14:15:39 2014 +0400 +++ b/modules/graphics/src/main/native-glass/lens/LensCommon.h Tue Apr 29 14:43:04 2014 +0200 @@ -1530,6 +1530,13 @@ */ void glass_cursor_terminate(void); +/** + * Called when screen characteristics changed. + * @param env + */ +void glass_application_notifyScreenSettingsChanged(JNIEnv *env); + + #include "LensLogger.h" diff -r d7370ecfa1f3 modules/graphics/src/main/native-glass/lens/wm/LensWindowManager.c --- a/modules/graphics/src/main/native-glass/lens/wm/LensWindowManager.c Tue Apr 29 14:15:39 2014 +0400 +++ b/modules/graphics/src/main/native-glass/lens/wm/LensWindowManager.c Tue Apr 29 14:43:04 2014 +0200 @@ -159,6 +159,24 @@ return LENS_OK; } +void lens_wm_repaint_all(JNIEnv *env) { + render_lock(); + glass_window_list_lock(); + NativeWindow w = glass_window_list_getHead(); + while (w) { + if (w && w->view) { + glass_application_notifyViewEvent(env, + w->view, + com_sun_glass_events_ViewEvent_REPAINT, + w->currentBounds.x, w->currentBounds.y, + w->currentBounds.width, w->currentBounds.height); + } + w = w->nextWindow; + } + glass_window_list_unlock(); + render_unlock(); +} + void lens_wm_repaint(JNIEnv *env, NativeWindow window) { render_lock(); diff -r d7370ecfa1f3 modules/graphics/src/main/native-glass/lens/wm/LensWindowManager.h --- a/modules/graphics/src/main/native-glass/lens/wm/LensWindowManager.h Tue Apr 29 14:15:39 2014 +0400 +++ b/modules/graphics/src/main/native-glass/lens/wm/LensWindowManager.h Tue Apr 29 14:43:04 2014 +0200 @@ -191,6 +191,13 @@ */ void lens_wm_repaint(JNIEnv *env, NativeWindow window); +/** + * Repaint all windows + * + * @param env env + */ +void lens_wm_repaint_all(JNIEnv *env); + /// platform specific calls void lens_platform_shutdown(JNIEnv *env);