Compare commits

...

11 Commits

Author SHA1 Message Date
Denis Fokin
606304b414 JBR-1414 DnD on linux (XToolkit) does not honor HIDPI scale
(cherry picked from commit 85dfaefecb)
2019-05-17 12:48:27 +03:00
Dmitry Batrak
5cf249dc8b JBR-1435 Various problems with emojis
add piece of code that was missed during migration from JBR 8

(cherry picked from commit 2bbfe3bf2f)
2019-05-17 11:47:56 +03:00
Vitaly Provodin
c5aa469706 updated JTreg exclude list 2019-05-17 14:10:36 +07:00
Vitaly Provodin
182e9a6605 updated JTreg exclude list 2019-05-17 14:07:33 +07:00
Anton Tarasov
7cc06ad84b JBR-1427 pycharm jupyter preview stuck and no response when click on preview.
(cherry picked from commit 1746b04686)
2019-05-16 18:32:08 +03:00
Vyacheslav Moklev
c2665024df JBR-1509 Client area size is wrong in Borderless mode
Fix client area size
2019-05-16 16:25:55 +03:00
Denis Fokin
02c82264b0 JBR-1255 [JDK 11] java.lang.IllegalArgumentException: Wrong parent window
(cherry picked from commit d0acd2b182)
2019-05-16 10:24:01 +03:00
Denis Fokin
19975f77db JBR-1434 "New file dialog" popup remains above all windows on switching application
(cherry picked from commit fbb8ed8326)
2019-05-16 10:23:56 +03:00
Denis Fokin
2c9575573e JBR-1417 JBR 11 does not support chain of popups
Adopted version of "JRE-864  Multiple child windows opened and closed in sequence"

(cherry picked from commit 54bb2dd097)
2019-05-15 18:59:54 +03:00
Denis Fokin
b164d8a4cc JBR-1421 Cannot type opening square bracket or brace with a Spanish-ISO keyboard macOS
(cherry picked from commit b0366b1c0d)
2019-05-15 18:59:47 +03:00
Denis Fokin
353860d875 Revert: JBR-1311 [JBR 11] Double quote adding special character on macOS with "English, U.S. International - PC" layout
JBR-1421 resolves the issue

(cherry picked from commit 2a8bced104)
2019-05-15 18:59:37 +03:00
12 changed files with 100 additions and 78 deletions

View File

@@ -957,24 +957,17 @@ public abstract class LWComponentPeer<T extends Component, D extends JComponent>
}
}
boolean res = parentPeer.requestWindowFocus(cause);
// If parent window can be made focused and has been made focused (synchronously)
// then we can proceed with children, otherwise we retreat
if (!res || !parentWindow.isFocused()) {
if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
focusLog.fine("request rejected, res= " + res + ", parentWindow.isFocused()=" +
parentWindow.isFocused());
}
return parentPeer.requestWindowFocus(cause, () -> {
LWKeyboardFocusManagerPeer.removeLastFocusRequest(getTarget());
return false;
}
}, () -> {
KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance();
KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance();
Component focusOwner = kfmPeer.getCurrentFocusOwner();
return LWKeyboardFocusManagerPeer.deliverFocus(lightweightChild,
getTarget(), temporary,
focusedWindowChangeAllowed,
time, cause, focusOwner);
Component focusOwner = kfmPeer.getCurrentFocusOwner();
LWKeyboardFocusManagerPeer.deliverFocus(lightweightChild,
getTarget(), temporary,
focusedWindowChangeAllowed,
time, cause, focusOwner);
});
case LWKeyboardFocusManagerPeer.SNFH_SUCCESS_HANDLED:
return true;

View File

@@ -61,18 +61,18 @@ public class LWLightweightFramePeer extends LWWindowPeer implements OverrideNati
}
@Override
public boolean requestWindowFocus(FocusEvent.Cause cause) {
public boolean requestWindowFocus(FocusEvent.Cause cause, Runnable r, Runnable lightweightRequest) {
if (!focusAllowedFor()) {
return false;
}
if (getPlatformWindow().rejectFocusRequest(cause)) {
/*if (getPlatformWindow().rejectFocusRequest(cause)) {
return false;
}
}*/
Window opposite = LWKeyboardFocusManagerPeer.getInstance().
getCurrentFocusedWindow();
changeFocusedWindow(true, opposite);
changeFocusedWindow(true, opposite, () -> {});
return true;
}

View File

@@ -61,16 +61,8 @@ import java.util.List;
import javax.swing.JComponent;
import sun.awt.AWTAccessor;
import sun.awt.*;
import sun.awt.AWTAccessor.ComponentAccessor;
import sun.awt.AppContext;
import sun.awt.CGraphicsDevice;
import sun.awt.DisplayChangedListener;
import sun.awt.ExtendedKeyCodes;
import sun.awt.FullScreenCapable;
import sun.awt.SunToolkit;
import sun.awt.TimedWindowEvent;
import sun.awt.UngrabEvent;
import sun.java2d.NullSurfaceData;
import sun.java2d.SunGraphics2D;
import sun.java2d.SunGraphicsEnvironment;
@@ -297,14 +289,24 @@ public class LWWindowPeer
if (!getTarget().isAutoRequestFocus()) {
return;
} else {
requestWindowFocus(FocusEvent.Cause.ACTIVATION);
requestWindowFocus(FocusEvent.Cause.ACTIVATION, () -> {}, () -> {});
}
// Focus the owner in case this window is focused.
} else if (kfmPeer.getCurrentFocusedWindow() == getTarget()) {
// Transfer focus to the owner.
LWWindowPeer owner = getOwnerFrameDialog(LWWindowPeer.this);
if (owner != null) {
owner.requestWindowFocus(FocusEvent.Cause.ACTIVATION);
Window targetOwner = LWWindowPeer.this.getTarget().getOwner();
while (targetOwner != null && (targetOwner.getOwner() != null && !targetOwner.isFocusableWindow())) {
targetOwner = targetOwner.getOwner();
}
if (targetOwner != null) {
LWWindowPeer owner = (LWWindowPeer) AWTAccessor.getComponentAccessor().getPeer(targetOwner);
if (owner != null) {
owner.requestWindowFocus(FocusEvent.Cause.ACTIVATION, () -> {}, () -> {});
}
}
}
}
@@ -781,7 +783,7 @@ public class LWWindowPeer
@Override
public void notifyActivation(boolean activation, LWWindowPeer opposite) {
Window oppositeWindow = (opposite == null)? null : opposite.getTarget();
changeFocusedWindow(activation, oppositeWindow);
changeFocusedWindow(activation, oppositeWindow, () -> {});
}
// MouseDown in non-client area
@@ -898,7 +900,7 @@ public class LWWindowPeer
// 2. An active but not focused owner frame/dialog is clicked.
// The mouse event then will trigger a focus request "in window" to the component, so the window
// should gain focus before.
requestWindowFocus(FocusEvent.Cause.MOUSE_EVENT);
requestWindowFocus(FocusEvent.Cause.MOUSE_EVENT, () -> {}, () -> {});
mouseDownTarget[targetIdx] = targetPeer;
} else if (id == MouseEvent.MOUSE_DRAGGED) {
@@ -1249,19 +1251,20 @@ public class LWWindowPeer
* Requests platform to set native focus on a frame/dialog.
* In case of a simple window, triggers appropriate java focus change.
*/
public boolean requestWindowFocus(FocusEvent.Cause cause) {
public boolean requestWindowFocus(FocusEvent.Cause cause, Runnable rejectFocusRequest, Runnable lightweightRequest) {
if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
focusLog.fine("requesting native focus to " + this);
}
if (!focusAllowedFor()) {
focusLog.fine("focus is not allowed");
rejectFocusRequest.run();
return false;
}
if (platformWindow.rejectFocusRequest(cause)) {
return false;
}
// if (platformWindow.rejectFocusRequest(cause)) {
// return false;
// }
AppContext targetAppContext = AWTAccessor.getComponentAccessor().getAppContext(getTarget());
KeyboardFocusManager kfm = AWTAccessor.getKeyboardFocusManagerAccessor()
@@ -1299,18 +1302,24 @@ public class LWWindowPeer
}
// DKFM will synthesize all the focus/activation events correctly.
changeFocusedWindow(true, opposite);
changeFocusedWindow(true, opposite, lightweightRequest);
return true;
// In case the toplevel is active but not focused, change focus directly,
// as requesting native focus on it will not have effect.
} else if (getTarget() == currentActive && !getTarget().hasFocus()) {
changeFocusedWindow(true, opposite);
changeFocusedWindow(true, opposite, lightweightRequest);
return true;
}
return platformWindow.requestWindowFocus();
focusLog.fine("platformWindow.requestWindowFocus()");
boolean requestFocusResult = platformWindow.requestWindowFocus();
if (requestFocusResult) {
lightweightRequest.run();
return true;
}
return false;
}
protected boolean focusAllowedFor() {
@@ -1338,7 +1347,7 @@ public class LWWindowPeer
@Override
public void emulateActivation(boolean activate) {
changeFocusedWindow(activate, null);
changeFocusedWindow(activate, null, () -> {});
}
@SuppressWarnings("deprecation")
@@ -1357,7 +1366,7 @@ public class LWWindowPeer
/*
* Changes focused window on java level.
*/
protected void changeFocusedWindow(boolean becomesFocused, Window opposite) {
protected void changeFocusedWindow(boolean becomesFocused, Window opposite, Runnable lightweightRequestRunnable) {
if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
focusLog.fine((becomesFocused?"gaining":"loosing") + " focus window: " + this);
}
@@ -1395,19 +1404,22 @@ public class LWWindowPeer
}
KeyboardFocusManagerPeer kfmPeer = LWKeyboardFocusManagerPeer.getInstance();
if (!becomesFocused && kfmPeer.getCurrentFocusedWindow() != getTarget()) {
// late window focus lost event - ingoring
return;
}
kfmPeer.setCurrentFocusedWindow(becomesFocused ? getTarget() : null);
int eventID = becomesFocused ? WindowEvent.WINDOW_GAINED_FOCUS : WindowEvent.WINDOW_LOST_FOCUS;
WindowEvent windowEvent = new TimedWindowEvent(getTarget(), eventID, opposite, System.currentTimeMillis());
SunToolkit.setSystemGenerated(windowEvent);
AWTAccessor.getAWTEventAccessor().setPosted(windowEvent);
PeerEvent pe = new PeerEvent(getTarget(), () -> {
((Component)windowEvent.getSource()).dispatchEvent(windowEvent);
if (becomesFocused) {
lightweightRequestRunnable.run();
}
}, PeerEvent.ULTIMATE_PRIORITY_EVENT);
// TODO: wrap in SequencedEvent
postEvent(windowEvent);
postEvent(pe);
}
/*
@@ -1515,4 +1527,4 @@ public class LWWindowPeer
public String toString() {
return super.toString() + " [target is " + getTarget() + "]";
}
}
}

View File

@@ -758,7 +758,7 @@ public class CInputMethod extends InputMethodAdapter {
}
}
}}
}, fAwtFocussedComponent);
}, fAwtFocussedComponent, true); // [tav] avoid deadlock with javafx
} catch (InvocationTargetException ite) { ite.printStackTrace(); }
synchronized(rect) { return rect; }
@@ -779,7 +779,7 @@ public class CInputMethod extends InputMethodAdapter {
offsetInfo[0] = fIMContext.getLocationOffset(screenX, screenY);
insertPositionOffset[0] = fIMContext.getInsertPositionOffset();
}}
}, fAwtFocussedComponent);
}, fAwtFocussedComponent, true); // [tav] avoid deadlock with javafx
} catch (InvocationTargetException ite) { ite.printStackTrace(); }
// This bit of gymnastics ensures that the returned location is within the composed text.

View File

@@ -516,7 +516,7 @@ static BOOL shouldUsePressAndHold() {
const UCKeyboardLayout *keyboardLayout = (UCKeyboardLayout*)CFDataGetBytePtr(keyLayoutPtr);
UInt32 isDeadKeyPressed;
UInt32 lengthOfBuffer = 4;
UInt32 lengthOfBuffer = 8;
UniChar stringWithChars[lengthOfBuffer];
UniCharCount actualLength;
@@ -549,8 +549,6 @@ static BOOL shouldUsePressAndHold() {
if (status == noErr && isDeadKeyPressed != 0) {
UInt32 isDeadKeyPressedForSpace;
status = UCKeyTranslate(
keyboardLayout,
kVK_Space,
@@ -558,7 +556,7 @@ static BOOL shouldUsePressAndHold() {
0,
LMGetKbdType(),
0,
&isDeadKeyPressedForSpace,
&isDeadKeyPressed,
lengthOfBuffer,
&actualLength,
stringWithChars);

View File

@@ -663,13 +663,6 @@ public class Dialog extends Window {
public Dialog(Window owner, String title, ModalityType modalityType) {
super(owner);
if ((owner != null) &&
!(owner instanceof Frame) &&
!(owner instanceof Dialog))
{
throw new IllegalArgumentException("Wrong parent window");
}
this.title = title;
setModalityType(modalityType);
SunToolkit.checkAndSetPolicy(this);

View File

@@ -1151,6 +1151,10 @@ OGLTR_DrawGlyphList(JNIEnv *env, OGLContext *oglc, OGLSDOps *dstOps,
ok = OGLTR_DrawGrayscaleGlyphNoCache(oglc, ginfo, x, y);
}
} else if (ginfo->rowBytes == ginfo->width * 4) {
if (lcdOpened) {
lcdOpened = JNI_FALSE;
j2d_glEnd();
}
// color glyph data
ok = OGLTR_DrawColorGlyphNoCache(oglc, ginfo, x, y);
} else {

View File

@@ -586,16 +586,19 @@ class XDnDDropTargetProtocol extends XDropTargetProtocol {
return false;
}
x = (int)(xclient.get_data(2) >> 16);
y = (int)(xclient.get_data(2) & 0xFFFF);
XWindow xwindow = null;
{
XBaseWindow xbasewindow = XToolkit.windowToXWindow(xclient.get_window());
if (xbasewindow instanceof XWindow) {
xwindow = (XWindow)xbasewindow;
x = xbasewindow.scaleDown(x);
y = xbasewindow.scaleDown(y);
}
}
x = (int)(xclient.get_data(2) >> 16);
y = (int)(xclient.get_data(2) & 0xFFFF);
if (xwindow == null) {
long receiver =

View File

@@ -1787,18 +1787,21 @@ MsgRouting AwtFrame::WmNcCalcSize(BOOL wParam, LPNCCALCSIZE_PARAMS lpncsp, LRESU
GetSysInsets(&insets, this);
RECT* rect = &lpncsp->rgrc[0];
rect->left = rect->left + insets.left;
rect->left += insets.left;
rect->right -= insets.right;
rect->bottom -= insets.bottom;
if (::IsZoomed(GetHWnd())) {
lpncsp->rgrc[0].top = lpncsp->rgrc[0].top + insets.bottom;
rect->top += insets.bottom;
// [moklev] Workaround for RIDER-27069, IDEA-211327
rect->right += this->ScaleUpX(1);
rect->bottom -= 1;
}
else {
// this makes the native caption go uncovered
// int yBorder = ::GetSystemMetrics(SM_CYBORDER);
// lpncsp->rgrc[0].top = lpncsp->rgrc[0].top + yBorder;
// rect->top += yBorder;
}
rect->right = rect->right - insets.right;
rect->bottom = rect->bottom - insets.bottom;
retVal = 0L;
return mrConsume;
}

View File

@@ -1404,7 +1404,19 @@ void AwtWindow::Show()
if (nCmdShow == SW_SHOWNA) {
flags |= SWP_NOACTIVATE;
}
::SetWindowPos(GetHWnd(), HWND_TOPMOST, 0, 0, 0, 0, flags);
// This flag allows the toplevel to be bellow other process toplevels.
// This behaviour is preferable for popups, but it is not appropriate
// for menus
BOOL isLightweightDialog = TRUE;
jclass windowPeerClass = env->FindClass("java/awt/peer/WindowPeer");
if (windowPeerClass != NULL) {
jmethodID isLightweightDialogMID = env->GetStaticMethodID(windowPeerClass, "isLightweightDialog", "(Ljava/awt/Window;)Z");
if (isLightweightDialogMID != NULL) {
isLightweightDialog = env->CallStaticBooleanMethod(windowPeerClass, isLightweightDialogMID, target);
}
}
::SetWindowPos(GetHWnd(), isLightweightDialog ? HWND_TOP : HWND_TOPMOST, 0, 0, 0, 0, flags);
} else {
::ShowWindow(GetHWnd(), nCmdShow);
}

View File

@@ -223,7 +223,7 @@ java/awt/GridLayout/ComponentPreferredSize/ComponentPreferredSize.java
java/awt/GridLayout/LayoutExtraGaps/LayoutExtraGaps.java 8000171 windows-all
java/awt/JAWT/JAWT.sh 8197798 windows-all
java/awt/KeyboardFocusmanager/TypeAhead/ButtonActionKeyTest/ButtonActionKeyTest.html JRE-898 macosx-all,linux-all
java/awt/KeyboardFocusmanager/TypeAhead/EnqueueWithDialogButtonTest/EnqueueWithDialogButtonTest.java 8198623 macosx-all,windows-all
java/awt/KeyboardFocusmanager/TypeAhead/EnqueueWithDialogButtonTest/EnqueueWithDialogButtonTest.java 8198623 macosx-all,windows-all,linux-all
java/awt/KeyboardFocusmanager/TypeAhead/FreezeTest/FreezeTest.java 8198623 macosx-all,windows-all
java/awt/KeyboardFocusmanager/TypeAhead/SubMenuShowTest/SubMenuShowTest.html 8198624 macosx-all,linux-all,windows-all
java/awt/KeyboardFocusmanager/TypeAhead/TestDialogTypeAhead.html 8198626 macosx-all,windows-all
@@ -1061,7 +1061,7 @@ javax/swing/dnd/8139050/NativeErrorsInTableDnD.java
javax/swing/plaf/basic/BasicComboBoxEditor/Test8015336.java 8198394 generic-all
javax/swing/plaf/basic/BasicComboPopup/JComboBoxPopupLocation/JComboBoxPopupLocation.java 8194945 macosx-all,linux-all,windows-all
javax/swing/plaf/basic/BasicGraphicsUtils/8132119/bug8132119.java 8196434 linux-all,solaris-all
javax/swing/plaf/basic/BasicHTML/4251579/bug4251579.java 8198905,8137101 macosx-all,windows-all
javax/swing/plaf/basic/BasicHTML/4251579/bug4251579.java 8198905,8137101 macosx-all,windows-all,linux-all
javax/swing/plaf/basic/BasicMenuUI/4983388/bug4983388.java 8042383 macosx-all,windows-all
javax/swing/plaf/basic/BasicTextUI/8001470/bug8001470.java 8196098 windows-all,linux-all
javax/swing/plaf/basic/BasicTreeUI/8023474/bug8023474.java 8172887 windows-all

View File

@@ -14,6 +14,8 @@ java/awt/EventDispatchThread/PreserveDispathThread/PreserveDispatchThread.java
java/awt/FileDialog/FileDialogMemoryLeak/FileDialogLeakTest.java nobug windows-all
java/awt/FileDialog/FilenameFilterTest/FilenameFilterTest.html nobug macosx-all
java/awt/FileDialog/MoveToTrashTest.java nobug windows-all
java/awt/FileDialog/ModalFocus/FileDialogModalFocusTest.java nobug linux-all,windows-all
java/awt/Focus/6981400/Test2.java nobug linux-all
java/awt/Focus/AppletInitialFocusTest/AppletInitialFocusTest1.html nobug linux-all,windows-all
java/awt/FileDialog/ModalFocus/FileDialogModalFocusTest.java nobug linux-all,windows-all
java/awt/Focus/ConsumeNextKeyTypedOnModalShowTest/ConsumeNextKeyTypedOnModalShowTest.java nobug macosx-all,linux-all,windows-all
@@ -28,7 +30,9 @@ java/awt/Focus/RemoveAfterRequest/RemoveAfterRequest.java
java/awt/Focus/RequestFocusAndHideTest/RequestFocusAndHideTest.java nobug macosx-all
java/awt/Focus/RequestFocusByCause/RequestFocusByCauseTest.java nobug linux-all,windows-all reproduced with Adopt, OpenJDK
java/awt/Focus/WindowIsFocusableAccessByThreadsTest/WindowIsFocusableAccessByThreadsTest.java nobug macosx-all,windows-all
java/awt/Frame/8158918/SetExtendedState.java nobug linux-all
java/awt/Frame/FrameLocation/FrameLocation.java nobug linux-all
java/awt/Frame/FrameSize/TestFrameSize.java nobug linux-all,mac-osx
java/awt/Frame/MaximizedToIconified/MaximizedToIconified.java nobug linux-all,windows-all
java/awt/Frame/MiscUndecorated/ActiveAWTWindowTest.java nobug macosx-all,windows-all
java/awt/Frame/MiscUndecorated/ActiveSwingWindowTest.java nobug macosx-all,windows-all
@@ -163,7 +167,7 @@ javax/swing/JInternalFrame/8020708/bug8020708.java
javax/swing/JInternalFrame/8145060/TestJInternalFrameMinimize.java nobug macosx-all,linux-all,windows-all
javax/swing/JInternalFrame/InternalFrameIsNotCollectedTest.java nobug macosx-all
javax/swing/JInternalFrame/Test6802868.java nobug macosx-all,linux-all
javax/swing/JLabel/7004134/bug7004134.java nobug macosx-all
javax/swing/JLabel/7004134/bug7004134.java nobug macosx-all,linux-all
javax/swing/JList/6510999/bug6510999.java nobug linux-all,macosx-all,windows-all
javax/swing/JList/BasicListTest.java nobug macosx-all
javax/swing/JMenu/6538132/bug6538132.java nobug windows-all