diff options
author | Anton Tarasov <anton.tarasov@jetbrains.com> | 2017-12-26 14:58:18 +0300 |
---|---|---|
committer | Anton Tarasov <anton.tarasov@jetbrains.com> | 2017-12-26 14:58:18 +0300 |
commit | c9533297bc66028a782f282cbda0945851f80c25 (patch) | |
tree | 6fa0dda19ddb524c5415ca47c21db8f52a2ca081 | |
parent | f7e37acc8e1f14e91d714ad749a4ec49efd7f107 (diff) | |
download | jdk8u_jdk-c9533297bc66028a782f282cbda0945851f80c25.tar.gz |
JRE-612 [followup]jb8u152-b1128
-rw-r--r-- | src/windows/classes/sun/awt/Win32GraphicsDevice.java | 2 | ||||
-rw-r--r-- | src/windows/classes/sun/awt/windows/WFramePeer.java | 8 | ||||
-rw-r--r-- | src/windows/native/sun/windows/awt_Frame.cpp | 24 | ||||
-rw-r--r-- | src/windows/native/sun/windows/awt_Window.cpp | 9 |
4 files changed, 34 insertions, 9 deletions
diff --git a/src/windows/classes/sun/awt/Win32GraphicsDevice.java b/src/windows/classes/sun/awt/Win32GraphicsDevice.java index ec2d8c24e6..1e18cd4d80 100644 --- a/src/windows/classes/sun/awt/Win32GraphicsDevice.java +++ b/src/windows/classes/sun/awt/Win32GraphicsDevice.java @@ -524,8 +524,8 @@ public class Win32GraphicsDevice extends GraphicsDevice implements defaultConfig = null; configs = null; // pass on to all top-level windows on this display - topLevels.notifyListeners(); initScaleFactors(); + topLevels.notifyListeners(); } /** diff --git a/src/windows/classes/sun/awt/windows/WFramePeer.java b/src/windows/classes/sun/awt/windows/WFramePeer.java index 6140c2cd95..ecb9dec2c4 100644 --- a/src/windows/classes/sun/awt/windows/WFramePeer.java +++ b/src/windows/classes/sun/awt/windows/WFramePeer.java @@ -111,6 +111,14 @@ class WFramePeer extends WWindowPeer implements FramePeer { } @Override + public void displayChanged() { + super.displayChanged(); + updateIcon(); + } + + private native void updateIcon(); + + @Override public boolean updateGraphicsData(GraphicsConfiguration gc) { boolean result = super.updateGraphicsData(gc); Rectangle bounds = AWTAccessor.getFrameAccessor(). diff --git a/src/windows/native/sun/windows/awt_Frame.cpp b/src/windows/native/sun/windows/awt_Frame.cpp index 8dca9a4c25..5ee0c48432 100644 --- a/src/windows/native/sun/windows/awt_Frame.cpp +++ b/src/windows/native/sun/windows/awt_Frame.cpp @@ -1188,6 +1188,19 @@ MsgRouting AwtFrame::WmGetIcon(WPARAM iconType, LRESULT& retVal) } } +void _UpdateIcon(void* p) { + JNIEnv *env = (JNIEnv *)JNU_GetEnv(jvm, JNI_VERSION_1_2); + + jobject self = reinterpret_cast<jobject>(p); + PDATA pData; + JNI_CHECK_PEER_GOTO(self, ret); + + AwtFrame* frame = (AwtFrame*)pData; + frame->DoUpdateIcon(); +ret: + env->DeleteGlobalRef(self); +} + void AwtFrame::DoUpdateIcon() { //Workaround windows bug: @@ -1974,6 +1987,17 @@ Java_sun_awt_windows_WFramePeer_synthesizeWmActivate(JNIEnv *env, jobject self, CATCH_BAD_ALLOC; } +JNIEXPORT void JNICALL +Java_sun_awt_windows_WFramePeer_updateIcon(JNIEnv *env, jobject self) +{ + TRY; + + AwtToolkit::GetInstance().InvokeFunction(_UpdateIcon, env->NewGlobalRef(self)); + // global ref is deleted in _UpdateIcon() + + CATCH_BAD_ALLOC; +} + } /* extern "C" */ static bool SetFocusToPluginControl(HWND hwndPlugin) diff --git a/src/windows/native/sun/windows/awt_Window.cpp b/src/windows/native/sun/windows/awt_Window.cpp index 4a542a625e..21e5e5627e 100644 --- a/src/windows/native/sun/windows/awt_Window.cpp +++ b/src/windows/native/sun/windows/awt_Window.cpp @@ -1756,13 +1756,6 @@ MsgRouting AwtWindow::WmEraseBkgnd(HDC hDC, BOOL& didErase) return mrConsume; } -void _DoUpdateIcon(void *p) -{ - DASSERT(p); - AwtWindow* window = reinterpret_cast<AwtWindow*>(p); - window->DoUpdateIcon(); -} - /* * Override AwtComponent's move handling to first update the * java AWT target's position fields directly, since Windows @@ -1784,7 +1777,7 @@ MsgRouting AwtWindow::WmMove(int x, int y) m_screenNum = GetScreenImOn(); } else if (CheckIfOnNewScreen()) { - AwtToolkit::GetInstance().InvokeFunctionLater(_DoUpdateIcon, (void*)this); + DoUpdateIcon(); } /* Update the java AWT target component's fields directly */ |