use of java.awt.peer.ComponentPeer in project intellij-community by JetBrains.
the class WindowManagerImpl method updateFrameBounds.
private int updateFrameBounds(IdeFrameImpl frame) {
int extendedState = frame.getExtendedState();
if (SystemInfo.isMacOSLion) {
@SuppressWarnings("deprecation") ComponentPeer peer = frame.getPeer();
if (peer instanceof FramePeer) {
// frame.state is not updated by jdk so get it directly from peer
extendedState = ((FramePeer) peer).getState();
}
}
boolean isMaximized = extendedState == Frame.MAXIMIZED_BOTH || isFullScreenSupportedInCurrentOS() && frame.isInFullScreen();
boolean usePreviousBounds = isMaximized && myFrameBounds != null && frame.getBounds().contains(new Point((int) myFrameBounds.getCenterX(), (int) myFrameBounds.getCenterY()));
if (!usePreviousBounds) {
myFrameBounds = frame.getBounds();
}
return extendedState;
}
use of java.awt.peer.ComponentPeer in project intellij-community by JetBrains.
the class X11UiUtil method hasWindowProperty.
private static boolean hasWindowProperty(JFrame frame, long name, long expected) {
if (X11 == null)
return false;
try {
@SuppressWarnings("deprecation") ComponentPeer peer = frame.getPeer();
long window = (Long) X11.getWindow.invoke(peer);
long[] values = X11.getLongArrayProperty(window, name, XA_ATOM);
if (values != null) {
for (long value : values) {
if (value == expected)
return true;
}
}
return false;
} catch (Throwable t) {
LOG.info("cannot check window property", t);
return false;
}
}
use of java.awt.peer.ComponentPeer in project intellij-community by JetBrains.
the class X11UiUtil method toggleFullScreenMode.
public static void toggleFullScreenMode(JFrame frame) {
if (X11 == null)
return;
try {
@SuppressWarnings("deprecation") ComponentPeer peer = frame.getPeer();
long window = (Long) X11.getWindow.invoke(peer);
long screen = (Long) X11.getScreenNumber.invoke(peer);
long rootWindow = X11.getRootWindow(screen);
X11.sendClientMessage(rootWindow, window, X11.NET_WM_STATE, NET_WM_STATE_TOGGLE, X11.NET_WM_STATE_FULLSCREEN);
} catch (Throwable t) {
LOG.info("cannot toggle mode", t);
}
}
use of java.awt.peer.ComponentPeer in project intellij-community by JetBrains.
the class Win7TaskBar method getHandle.
private static WinDef.HWND getHandle(IdeFrame frame) {
try {
ComponentPeer peer = ((Component) frame).getPeer();
Method getHWnd = peer.getClass().getMethod("getHWnd");
return new WinDef.HWND(new Pointer((Long) getHWnd.invoke(peer)));
} catch (Throwable e) {
LOG.error(e);
return null;
}
}
use of java.awt.peer.ComponentPeer in project jdk8u_jdk by JetBrains.
the class Queue method coalescePaintEvent.
private boolean coalescePaintEvent(PaintEvent e) {
ComponentPeer sourcePeer = ((Component) e.getSource()).peer;
if (sourcePeer != null) {
sourcePeer.coalescePaintEvent(e);
}
EventQueueItem[] cache = ((Component) e.getSource()).eventCache;
if (cache == null) {
return false;
}
int index = eventToCacheIndex(e);
if (index != -1 && cache[index] != null) {
PaintEvent merged = mergePaintEvents(e, (PaintEvent) cache[index].event);
if (merged != null) {
cache[index].event = merged;
return true;
}
}
return false;
}
Aggregations