use of java.awt.peer.ComponentPeer in project jdk8u_jdk by JetBrains.
the class BasicSplitPaneUI method startDragging.
/**
* Should be messaged before the dragging session starts, resets
* lastDragLocation and dividerSize.
*/
protected void startDragging() {
Component leftC = splitPane.getLeftComponent();
Component rightC = splitPane.getRightComponent();
ComponentPeer cPeer;
beginDragDividerLocation = getDividerLocation(splitPane);
draggingHW = false;
if (leftC != null && (cPeer = leftC.getPeer()) != null && !(cPeer instanceof LightweightPeer)) {
draggingHW = true;
} else if (rightC != null && (cPeer = rightC.getPeer()) != null && !(cPeer instanceof LightweightPeer)) {
draggingHW = true;
}
if (orientation == JSplitPane.HORIZONTAL_SPLIT) {
setLastDragLocation(divider.getBounds().x);
dividerSize = divider.getSize().width;
if (!isContinuousLayout() && draggingHW) {
nonContinuousLayoutDivider.setBounds(getLastDragLocation(), 0, dividerSize, splitPane.getHeight());
addHeavyweightDivider();
}
} else {
setLastDragLocation(divider.getBounds().y);
dividerSize = divider.getSize().height;
if (!isContinuousLayout() && draggingHW) {
nonContinuousLayoutDivider.setBounds(0, getLastDragLocation(), splitPane.getWidth(), dividerSize);
addHeavyweightDivider();
}
}
}
use of java.awt.peer.ComponentPeer in project jdk8u_jdk by JetBrains.
the class CGLVolatileSurfaceManager method initAcceleratedSurface.
/**
* Create a pbuffer-based SurfaceData object (or init the backbuffer
* of an existing window if this is a double buffered GraphicsConfig)
*/
protected SurfaceData initAcceleratedSurface() {
SurfaceData sData = null;
Component comp = vImg.getComponent();
final ComponentPeer peer = (comp != null) ? comp.getPeer() : null;
try {
boolean createVSynced = false;
boolean forceback = false;
if (context instanceof Boolean) {
forceback = ((Boolean) context).booleanValue();
if (forceback && peer instanceof BackBufferCapsProvider) {
BackBufferCapsProvider provider = (BackBufferCapsProvider) peer;
BufferCapabilities caps = provider.getBackBufferCaps();
if (caps instanceof ExtendedBufferCapabilities) {
ExtendedBufferCapabilities ebc = (ExtendedBufferCapabilities) caps;
if (ebc.getVSync() == VSYNC_ON && ebc.getFlipContents() == COPIED) {
createVSynced = true;
forceback = false;
}
}
}
}
if (forceback) {
// peer must be non-null in this case
// TODO: modify parameter to delegate
// sData = CGLSurfaceData.createData(peer, vImg, FLIP_BACKBUFFER);
} else {
CGLGraphicsConfig gc = (CGLGraphicsConfig) vImg.getGraphicsConfig();
ColorModel cm = gc.getColorModel(vImg.getTransparency());
int type = vImg.getForcedAccelSurfaceType();
// use the forced type, otherwise choose one based on caps
if (type == OGLSurfaceData.UNDEFINED) {
type = gc.isCapPresent(CAPS_EXT_FBOBJECT) ? OGLSurfaceData.FBOBJECT : OGLSurfaceData.PBUFFER;
}
if (createVSynced) {
// TODO: modify parameter to delegate
// sData = CGLSurfaceData.createData(peer, vImg, type);
} else {
sData = CGLSurfaceData.createData(gc, vImg.getWidth(), vImg.getHeight(), cm, vImg, type);
}
}
} catch (NullPointerException ex) {
sData = null;
} catch (OutOfMemoryError er) {
sData = null;
}
return sData;
}
use of java.awt.peer.ComponentPeer in project jdk8u_jdk by JetBrains.
the class Component method updateCursorImmediately.
/**
* Updates the cursor. May not be invoked from the native
* message pump.
*/
final void updateCursorImmediately() {
if (peer instanceof LightweightPeer) {
Container nativeContainer = getNativeContainer();
if (nativeContainer == null)
return;
ComponentPeer cPeer = nativeContainer.getPeer();
if (cPeer != null) {
cPeer.updateCursorImmediately();
}
} else if (peer != null) {
peer.updateCursorImmediately();
}
}
use of java.awt.peer.ComponentPeer in project jdk8u_jdk by JetBrains.
the class XComponentPeer method addTree.
private void addTree(Collection order, Set set, Container cont) {
for (int i = 0; i < cont.getComponentCount(); i++) {
Component comp = cont.getComponent(i);
ComponentPeer peer = comp.getPeer();
if (peer instanceof XComponentPeer) {
Long window = Long.valueOf(((XComponentPeer) peer).getWindow());
if (!set.contains(window)) {
set.add(window);
order.add(window);
}
} else if (comp instanceof Container) {
// It is lightweight container, it might contain heavyweight components attached to this
// peer
addTree(order, set, (Container) comp);
}
}
}
use of java.awt.peer.ComponentPeer in project jdk8u_jdk by JetBrains.
the class XWindowPeer method recursivelySetIcon.
public void recursivelySetIcon(java.util.List<IconInfo> icons) {
dumpIcons(winAttr.icons);
setIconHints(icons);
Window target = (Window) this.target;
Window[] children = target.getOwnedWindows();
int cnt = children.length;
for (int i = 0; i < cnt; i++) {
ComponentPeer childPeer = children[i].getPeer();
if (childPeer != null && childPeer instanceof XWindowPeer) {
if (((XWindowPeer) childPeer).winAttr.iconsInherited) {
((XWindowPeer) childPeer).winAttr.icons = icons;
((XWindowPeer) childPeer).recursivelySetIcon(icons);
}
}
}
}
Aggregations