mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Change getPeer to AWTAccessor calls.
This commit is contained in:
@@ -13,6 +13,7 @@ import com.intellij.openapi.vfs.CharsetToolkit;
|
||||
import com.intellij.openapi.wm.IdeFrame;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import sun.awt.AWTAccessor;
|
||||
import sun.misc.Unsafe;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -325,7 +326,7 @@ public class X11UiUtil {
|
||||
private static boolean hasWindowProperty(JFrame frame, long name, long expected) {
|
||||
if (X11 == null) return false;
|
||||
try {
|
||||
@SuppressWarnings("deprecation") ComponentPeer peer = frame.getPeer();
|
||||
ComponentPeer peer = AWTAccessor.getComponentAccessor().getPeer(frame);
|
||||
if (peer != null) {
|
||||
long window = (Long)X11.getWindow.invoke(peer);
|
||||
long[] values = X11.getLongArrayProperty(window, name, XA_ATOM);
|
||||
@@ -347,7 +348,7 @@ public class X11UiUtil {
|
||||
if (X11 == null) return;
|
||||
|
||||
try {
|
||||
@SuppressWarnings("deprecation") ComponentPeer peer = frame.getPeer();
|
||||
@SuppressWarnings("deprecation") ComponentPeer peer = AWTAccessor.getComponentAccessor().getPeer(frame);
|
||||
if (peer == null) throw new IllegalStateException(frame + " has no peer");
|
||||
long window = (Long)X11.getWindow.invoke(peer);
|
||||
long screen = (Long)X11.getScreenNumber.invoke(peer);
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import com.intellij.openapi.wm.ex.IdeFrameEx;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import sun.awt.AWTAccessor;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.event.ComponentEvent;
|
||||
@@ -60,7 +61,7 @@ public class FrameState {
|
||||
state = ((Frame)component).getExtendedState();
|
||||
if (SystemInfo.isMacOSLion) {
|
||||
// workaround: frame.state is not updated by jdk so get it directly from peer
|
||||
ComponentPeer peer = component.getPeer();
|
||||
ComponentPeer peer = AWTAccessor.getComponentAccessor().getPeer(component);
|
||||
if (peer instanceof FramePeer) {
|
||||
state = ((FramePeer)peer).getState();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import sun.awt.AWTAccessor;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.text.JTextComponent;
|
||||
@@ -141,9 +142,9 @@ public class MacUtil {
|
||||
ID windowId = null;
|
||||
if (Registry.is("skip.untitled.windows.for.mac.messages")) {
|
||||
try {
|
||||
Class <?> cWindowPeerClass = w.getPeer().getClass();
|
||||
Class <?> cWindowPeerClass = AWTAccessor.getComponentAccessor().getPeer(w).getClass();
|
||||
Method getPlatformWindowMethod = cWindowPeerClass.getDeclaredMethod("getPlatformWindow");
|
||||
Object cPlatformWindow = getPlatformWindowMethod.invoke(w.getPeer());
|
||||
Object cPlatformWindow = getPlatformWindowMethod.invoke(AWTAccessor.getComponentAccessor().getPeer(w));
|
||||
Class <?> cPlatformWindowClass = cPlatformWindow.getClass();
|
||||
Method getNSWindowPtrMethod = cPlatformWindowClass.getDeclaredMethod("getNSWindowPtr");
|
||||
windowId = new ID((Long)getNSWindowPtrMethod.invoke(cPlatformWindow));
|
||||
|
||||
Reference in New Issue
Block a user