Compare commits

...

4 Commits
1049 ... 441

Author SHA1 Message Date
Anton Tarasov
84420cd635 JBR-1802 com/sun/java/accessibility/util/8051626/Bug8051626.java: access denied ("java.lang.RuntimePermission" "getClassLoader")
(cherry picked from commit eae772aca9)
2019-08-30 12:14:27 +03:00
Anton Tarasov
4e4231a503 JBR-1795 Project opened from Welcome screen goes to backgound after loading
(cherry picked from commit 322526458a)
2019-08-29 12:43:34 +03:00
Anton Tarasov
04535e29cd JBR-1609 Jupyter Notebook eventually causes IDEA to become unresponsive on Mac OSX
(cherry picked from commit 8ae0be8eb6)
2019-08-26 17:36:57 +03:00
Anton Tarasov
0011a85cca JBR-1786 Weird white border for IDE window
(cherry picked from commit 4b09614a0e)
2019-08-26 17:08:47 +03:00
3 changed files with 55 additions and 49 deletions

View File

@@ -877,46 +877,21 @@ public class CInputMethod extends InputMethodAdapter {
return false;
}
static void await(CountDownLatch latch) {
try {
latch.await();
} catch (InterruptedException e) {
e.printStackTrace();
}
}
// Executed on AppKit
static void invoke(Runnable runnable, sun.awt.im.InputContext inputContext, Component targetToAppContext) throws InvocationTargetException {
CountDownLatch edtLatch = new CountDownLatch(1);
CountDownLatch tkLatch = new CountDownLatch(1);
AtomicBoolean runOnAppKit = new AtomicBoolean(false);
// Emulate EventQueue.invokeAndWait(runnable) for the runnable that delegates execution
// back to AppKit (JavaFX Event thread), without running secondary loop on AppKit.
InvocationEvent event = new InvocationEvent(targetToAppContext, () -> {
try {
runOnAppKit.set(instanceofJFXPanel(getClientComponent(inputContext)));
if (!runOnAppKit.get()) {
runnable.run();
}
} finally {
edtLatch.countDown();
await(tkLatch);
}
});
assert targetToAppContext != null;
AppContext appContext = SunToolkit.targetToAppContext(targetToAppContext);
SunToolkit.postEvent(appContext, event);
SunToolkit.flushPendingEvents(appContext);
await(edtLatch);
try {
if (runOnAppKit.get()) {
// 1) Do not run secondary msg loop in this case.
// 2) Delegate runnable back to FX when applicable.
LWCToolkit.invokeAndWait(() -> {
runOnAppKit.set(instanceofJFXPanel(getClientComponent(inputContext)));
if (!runOnAppKit.get()) {
runnable.run();
}
} finally {
tkLatch.countDown();
}, targetToAppContext);
if (runOnAppKit.get()) {
runnable.run();
}
}
}

View File

@@ -480,7 +480,9 @@ public final class LWCToolkit extends LWToolkit {
@Override
public Insets getScreenInsets(final GraphicsConfiguration gc) {
return ((CGraphicsConfig) gc).getDevice().getScreenInsets();
CGraphicsDevice gd = ((CGraphicsConfig) gc).getDevice();
// Avoid deadlock with input methods
return LWCToolkit.SelectorPerformer.perform(gd::getScreenInsets);
}
@Override
@@ -748,19 +750,21 @@ public final class LWCToolkit extends LWToolkit {
assert EventQueue.isDispatchThread();
if (executor == null) {
// init on EDT
executor = new ThreadPoolExecutor(1, Integer.MAX_VALUE,
60L, TimeUnit.SECONDS,
new SynchronousQueue<>(),
new ThreadFactory() {
private ThreadFactory factory = Executors.privilegedThreadFactory();
@Override
public Thread newThread(Runnable r) {
Thread t = factory.newThread(r);
t.setDaemon(true);
t.setName("AWT-SelectorPerformer " + t.getName());
return t;
}
});
AccessController.doPrivileged((PrivilegedAction<?>)() ->
executor = new ThreadPoolExecutor(1, Integer.MAX_VALUE,
60L, TimeUnit.SECONDS,
new SynchronousQueue<>(),
new ThreadFactory() {
private ThreadFactory factory = Executors.privilegedThreadFactory();
@Override
public Thread newThread(Runnable r) {
Thread t = factory.newThread(r);
t.setDaemon(true);
t.setName("AWT-SelectorPerformer " + t.getName());
return t;
}
})
);
}
LinkedBlockingQueue<InvocationEvent> currentQueue;
synchronized (invocations) {

View File

@@ -30,6 +30,7 @@
#include "awt_IconCursor.h"
#include "awt_Win32GraphicsDevice.h"
#include "ComCtl32Util.h"
#include "shellapi.h"
#include <windowsx.h>
#include <uxtheme.h>
@@ -780,6 +781,24 @@ AwtFrame::Show()
} else {
::ShowWindow(hwnd, SW_SHOWMAXIMIZED);
}
// [tav] Workaround for unclear platform behaviour.
// When a custom decor frame is being shown maximized at the moment
// some another AWT window is still foreground - the frame can go
// in background when shown if:
// 1) the other AWT window is closed the moment after frame's show
// 2) some another maximized window is behind the frame, it steals activation
if (HasCustomDecoration()) {
HWND fgHWnd = ::GetForegroundWindow();
if (fgHWnd != NULL &&
GetComponent(fgHWnd) != NULL && // it's awt window
IsFocusableWindow() &&
IsAutoRequestFocus() &&
!::IsWindow(GetModalBlocker(GetHWnd())))
{
::SetForegroundWindow(GetHWnd());
}
}
}
else if (m_isInputMethodWindow) {
// Don't activate input methow window
@@ -1824,7 +1843,15 @@ MsgRouting AwtFrame::WmNcCalcSize(BOOL wParam, LPNCCALCSIZE_PARAMS lpncsp, LRESU
// [moklev] Workaround for RIDER-27069, IDEA-211327
if (!this->IsUndecorated()) {
rect->right += this->ScaleUpX(1);
rect->bottom -= 1;
// [tav] Decrement NC bottom only when taskbar is bottom/autohide (JBR-1786)
APPBARDATA abData;
abData.cbSize = sizeof(abData);
if (::SHAppBarMessage(ABM_GETTASKBARPOS, &abData) &&
abData.uEdge == ABE_BOTTOM &&
::SHAppBarMessage(ABM_GETSTATE, &abData) == ABS_AUTOHIDE)
{
rect->bottom -= 1;
}
}
}
else {