mirror of
https://github.com/JetBrains/JetBrainsRuntime.git
synced 2025-12-06 09:29:38 +01:00
JBR-5777 isWindowMoveSupported() doesn't work with non-default GraphicsEnvironment
Co-authored-by: Nikita Gubarkov <nikita.gubarkov@jetbrains.com>
This commit is contained in:
@@ -93,7 +93,7 @@ class ProxyInfo {
|
||||
try {
|
||||
if (i != 0) clazz += "$";
|
||||
clazz += nestedClasses[i];
|
||||
lookup = MethodHandles.privateLookupIn(Class.forName(clazz, true, lookup.lookupClass().getClassLoader()), lookup);
|
||||
lookup = MethodHandles.privateLookupIn(Class.forName(clazz, false, lookup.lookupClass().getClassLoader()), lookup);
|
||||
} catch (ClassNotFoundException | IllegalAccessException ignore) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -2605,6 +2605,14 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
|
||||
|
||||
private static class WindowMoveService {
|
||||
WindowMoveService() {
|
||||
final var toolkit = Toolkit.getDefaultToolkit();
|
||||
final var ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
|
||||
if (toolkit == null || ge == null
|
||||
|| !toolkit.getClass().getName().equals("sun.awt.X11.XToolkit")
|
||||
|| !ge.getClass().getName().equals("sun.awt.X11GraphicsEnvironment")) {
|
||||
throw new JBRApi.ServiceNotAvailableException("Supported only with XToolkit and X11GraphicsEnvironment");
|
||||
}
|
||||
|
||||
if (!((XToolkit)Toolkit.getDefaultToolkit()).isWindowMoveSupported()) {
|
||||
throw new JBRApi.ServiceNotAvailableException("Window manager does not support _NET_WM_MOVE_RESIZE");
|
||||
}
|
||||
|
||||
@@ -25,19 +25,25 @@
|
||||
* @test
|
||||
* @summary Verifies that WindowMove test service of JBR is supported
|
||||
* on Linux and not supported elsewhere.
|
||||
* @key headful
|
||||
* @run main WindowMoveTest
|
||||
* @run main/othervm -Djava.awt.headless=true WindowMoveTest
|
||||
*/
|
||||
|
||||
import com.jetbrains.JBR;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
|
||||
public class WindowMoveTest {
|
||||
|
||||
public static void main(String[] args) throws Exception {
|
||||
final String os = System.getProperty("os.name");
|
||||
if ("linux".equalsIgnoreCase(os)) {
|
||||
if (!JBR.isWindowMoveSupported()) {
|
||||
throw new RuntimeException("JBR.isWindowMoveSupported says it is NOT supported on Linux");
|
||||
final boolean isHeadless = GraphicsEnvironment.getLocalGraphicsEnvironment().isHeadlessInstance();
|
||||
if (JBR.isWindowMoveSupported()) {
|
||||
if (isHeadless)
|
||||
throw new RuntimeException("JBR.isWindowMoveSupported says it is supported in the headless mode");
|
||||
} else {
|
||||
if (!isHeadless)
|
||||
throw new RuntimeException("JBR.isWindowMoveSupported says it is NOT supported on Linux");
|
||||
}
|
||||
// Use: JBR.getWindowMove().startMovingTogetherWithMouse(jframe, MouseEvent.BUTTON1);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user