< prev index next >
src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java
Print this page
@@ -127,12 +127,17 @@
}
}
}
public void updateMinimumSize() {
+ XToolkit.awtLock();
+ try {
super.updateMinimumSize();
updateMinSizeHints();
+ } finally {
+ XToolkit.awtUnlock();
+ }
}
private void updateMinSizeHints() {
if (isResizable()) {
Dimension minimumSize = getTargetMinimumSize();
@@ -302,10 +307,12 @@
private void resetWMSetInsets() {
if (XWM.getWMID() != XWM.UNITY_COMPIZ_WM) {
currentInsets = new Insets(0, 0, 0, 0);
wm_set_insets = null;
+ } else {
+ insets_corrected = false;
}
}
public void handlePropertyNotify(XEvent xev) {
super.handlePropertyNotify(xev);
@@ -328,13 +335,15 @@
|| ev.get_atom() == XWM.XA_NET_FRAME_EXTENTS.getAtom())
{
if (XWM.getWMID() != XWM.UNITY_COMPIZ_WM) {
getWMSetInsets(XAtom.get(ev.get_atom()));
} else {
- if(!isReparented()) {
+ if (!isReparented()) {
return;
}
+ XToolkit.awtLock();
+ try {
wm_set_insets = null;
Insets in = getWMSetInsets(XAtom.get(ev.get_atom()));
if (isNull(in)) {
return;
}
@@ -343,30 +352,36 @@
}
if (!in.equals(dimensions.getInsets())) {
if (insets_corrected || isMaximized()) {
currentInsets = in;
insets_corrected = true;
- // insets were changed by WM. To handle this situation
- // re-request window bounds because the current
- // dimensions may be not actual as well.
+ // insets were changed by WM. To handle this
+ // situation re-request window bounds because the
+ // current dimensions may be not actual as well.
XlibWrapper.XConfigureWindow(XToolkit.getDisplay(),
getWindow(), 0, 0);
} else {
- // recalculate dimensions when window is just created
- // and the initially guessed insets were wrong
+ // recalculate dimensions when window is just
+ // created and the initially guessed insets were
+ // wrong
handleCorrectInsets(in);
}
- } else if (!insets_corrected || !dimensions.isClientSizeSet()) {
+ } else if (!insets_corrected ||
+ !dimensions.isClientSizeSet()) {
insets_corrected = true;
// initial insets were guessed correctly. Re-request
- // frame bounds because they may be changed by WM if the
- // initial window position overlapped desktop's toolbars.
- // This should initiate the final ConfigureNotify upon which
- // the target will be notified with the final size.
+ // frame bounds because they may be changed by WM if
+ // the initial window position overlapped desktop's
+ // toolbars. This should initiate the final
+ // ConfigureNotify upon which the target will be
+ // notified with the final size.
XlibWrapper.XConfigureWindow(XToolkit.getDisplay(),
getWindow(), 0, 0);
}
+ } finally {
+ XToolkit.awtUnlock();
+ }
}
}
}
long reparent_serial = 0;
@@ -680,12 +695,12 @@
* @param x, y, width, heith - dimensions of the window with insets
*/
private void reshape(int x, int y, int width, int height, int operation,
boolean userReshape)
{
- Rectangle newRec;
- boolean setClient = false;
+ XToolkit.awtLock();
+ try {
WindowDimensions dims = new WindowDimensions(dimensions);
switch (operation & (~NO_EMBEDDED_CHECK)) {
case SET_LOCATION:
// Set location always sets bounds location. However, until the window is mapped we
// should use client coordinates
@@ -697,12 +712,12 @@
dims.setSize(width, height);
break;
case SET_CLIENT_SIZE: {
// Sets client rect size. Width and height contain insets.
Insets in = currentInsets;
- width -= in.left+in.right;
- height -= in.top+in.bottom;
+ width -= in.left + in.right;
+ height -= in.top + in.bottom;
dims.setClientSize(width, height);
break;
}
case SET_BOUNDS:
default:
@@ -714,10 +729,13 @@
insLog.fine("For the operation {0} new dimensions are {1}",
operationToString(operation), dims);
}
reshape(dims, operation, userReshape);
+ } finally {
+ XToolkit.awtUnlock();
+ }
}
// This method gets overriden in XFramePeer & XDialogPeer.
abstract boolean isTargetUndecorated();
@@ -752,24 +770,25 @@
// XXX: should really only consider synthetic events, but
if (isReparented()) {
configure_seen = true;
}
-
+ XToolkit.awtLock();
+ try {
if (!isMaximized()
- && (xe.get_serial() == reparent_serial || xe.get_window() != getShell())
- && !no_reparent_artifacts)
- {
+ && (xe.get_serial() == reparent_serial
+ || xe.get_window() != getShell())
+ && !no_reparent_artifacts) {
insLog.fine("- reparent artifact, skipping");
return;
}
no_reparent_artifacts = false;
/**
- * When there is a WM we receive some CN before being visible and after.
- * We should skip all CN which are before being visible, because we assume
- * the gravity is in action while it is not yet.
+ * When there is a WM we receive some CN before being visible and
+ * after. We should skip all CN which are before being visible,
+ * because we assume the gravity is in action while it is not yet.
*
* When there is no WM we receive CN only _before_ being visible.
* We should process these CNs.
*/
if (!isVisible() && XWM.getWMID() != XWM.NO_WM) {
@@ -784,28 +803,33 @@
* this is just the WM shuffling us into position. Ignore
* it!!!! or we wind up in a bogus location.
*/
int runningWM = XWM.getWMID();
if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
- insLog.fine("reparented={0}, visible={1}, WM={2}, decorations={3}",
- isReparented(), isVisible(), runningWM, getDecorations());
+ insLog.fine("reparented={0}, visible={1}, WM={2}, " +
+ "decorations={3}", isReparented(), isVisible(),
+ runningWM, getDecorations());
}
if (!isReparented() && isVisible() && runningWM != XWM.NO_WM
- && !XWM.isNonReparentingWM()
- && getDecorations() != XWindowAttributesData.AWT_DECOR_NONE) {
+ && !XWM.isNonReparentingWM() && getDecorations() !=
+ XWindowAttributesData.AWT_DECOR_NONE) {
insLog.fine("- visible but not reparented, skipping");
return;
}
//Last chance to correct insets
- if (!insets_corrected && getDecorations() != XWindowAttributesData.AWT_DECOR_NONE) {
+ if (!insets_corrected && getDecorations() !=
+ XWindowAttributesData.AWT_DECOR_NONE) {
long parent = XlibUtil.getParentWindow(window);
- Insets correctWM = (parent != -1) ? XWM.getWM().getInsets(this, window, parent) : null;
+ Insets correctWM = (parent != -1) ? XWM.getWM().
+ getInsets(this, window, parent) : null;
if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
if (correctWM != null) {
- insLog.finer("Configure notify - insets : " + correctWM);
+ insLog.finer("Configure notify - insets : "
+ + correctWM);
} else {
- insLog.finer("Configure notify - insets are still not available");
+ insLog.finer("Configure notify - insets are still " +
+ " not available");
}
}
if (correctWM != null) {
handleCorrectInsets(copyAndScaleDown(correctWM));
} else {
@@ -815,11 +839,12 @@
}
}
updateChildrenSizes();
- Point newLocation = getNewLocation(xe, currentInsets.left, currentInsets.top);
+ Point newLocation = getNewLocation(xe, currentInsets.left,
+ currentInsets.top);
WindowDimensions newDimensions =
new WindowDimensions(newLocation,
new Dimension(scaleDown(xe.get_width()),
scaleDown(xe.get_height())),
copy(currentInsets), true);
@@ -838,10 +863,13 @@
}
reconfigureContentWindow(newDimensions);
updateChildrenSizes();
repositionSecurityWarning();
+ } finally {
+ XToolkit.awtUnlock();
+ }
}
private void checkShellRectSize(Rectangle shellRect) {
shellRect.width = Math.max(MIN_SIZE, shellRect.width);
shellRect.height = Math.max(MIN_SIZE, shellRect.height);
@@ -907,37 +935,49 @@
void initResizability() {
setResizable(winAttr.initialResizability);
}
public void setResizable(boolean resizable) {
+ XToolkit.awtLock();
+ try {
int fs = winAttr.functions;
if (!isResizable() && resizable) {
resetWMSetInsets();
if (!isEmbedded()) {
setReparented(false);
}
winAttr.isResizable = resizable;
if ((fs & MWMConstants.MWM_FUNC_ALL) != 0) {
- fs &= ~(MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
+ fs &= ~(MWMConstants.MWM_FUNC_RESIZE
+ | MWMConstants.MWM_FUNC_MAXIMIZE);
} else {
- fs |= (MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
+ fs |= (MWMConstants.MWM_FUNC_RESIZE
+ | MWMConstants.MWM_FUNC_MAXIMIZE);
}
winAttr.functions = fs;
XWM.setShellResizable(this);
} else if (isResizable() && !resizable) {
resetWMSetInsets();
if (!isEmbedded()) {
setReparented(false);
}
winAttr.isResizable = resizable;
if ((fs & MWMConstants.MWM_FUNC_ALL) != 0) {
- fs |= (MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
+ fs |= (MWMConstants.MWM_FUNC_RESIZE
+ | MWMConstants.MWM_FUNC_MAXIMIZE);
} else {
- fs &= ~(MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
+ fs &= ~(MWMConstants.MWM_FUNC_RESIZE
+ | MWMConstants.MWM_FUNC_MAXIMIZE);
}
winAttr.functions = fs;
- XWM.setShellNotResizable(this, dimensions, dimensions.getBounds(), false);
+ XWM.setShellNotResizable(this, dimensions,
+ XWM.getWMID() == XWM.UNITY_COMPIZ_WM && configure_seen ?
+ dimensions.getScreenBounds() :
+ dimensions.getBounds(), false);
+ }
+ } finally {
+ XToolkit.awtUnlock();
}
}
Rectangle getShellBounds() {
return dimensions.getClientRect();
< prev index next >