< prev index next >
src/java.desktop/unix/classes/sun/awt/X11/XDecoratedPeer.java
Print this page
*** 127,138 ****
--- 127,143 ----
}
}
}
public void updateMinimumSize() {
+ XToolkit.awtLock();
+ try {
super.updateMinimumSize();
updateMinSizeHints();
+ } finally {
+ XToolkit.awtUnlock();
+ }
}
private void updateMinSizeHints() {
if (isResizable()) {
Dimension minimumSize = getTargetMinimumSize();
*** 302,311 ****
--- 307,318 ----
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,340 ****
|| 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()) {
return;
}
wm_set_insets = null;
Insets in = getWMSetInsets(XAtom.get(ev.get_atom()));
if (isNull(in)) {
return;
}
--- 335,349 ----
|| 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()) {
return;
}
+ XToolkit.awtLock();
+ try {
wm_set_insets = null;
Insets in = getWMSetInsets(XAtom.get(ev.get_atom()));
if (isNull(in)) {
return;
}
*** 343,372 ****
}
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.
XlibWrapper.XConfigureWindow(XToolkit.getDisplay(),
getWindow(), 0, 0);
} else {
! // recalculate dimensions when window is just created
! // and the initially guessed insets were wrong
handleCorrectInsets(in);
}
! } 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.
XlibWrapper.XConfigureWindow(XToolkit.getDisplay(),
getWindow(), 0, 0);
}
}
}
}
long reparent_serial = 0;
--- 352,387 ----
}
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.
XlibWrapper.XConfigureWindow(XToolkit.getDisplay(),
getWindow(), 0, 0);
} else {
! // recalculate dimensions when window is just
! // created and the initially guessed insets were
! // wrong
handleCorrectInsets(in);
}
! } 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.
XlibWrapper.XConfigureWindow(XToolkit.getDisplay(),
getWindow(), 0, 0);
}
+ } finally {
+ XToolkit.awtUnlock();
+ }
}
}
}
long reparent_serial = 0;
*** 680,691 ****
* @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;
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
--- 695,706 ----
* @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)
{
! 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,708 ****
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;
dims.setClientSize(width, height);
break;
}
case SET_BOUNDS:
default:
--- 712,723 ----
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;
dims.setClientSize(width, height);
break;
}
case SET_BOUNDS:
default:
*** 714,723 ****
--- 729,741 ----
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,775 ****
// XXX: should really only consider synthetic events, but
if (isReparented()) {
configure_seen = true;
}
!
if (!isMaximized()
! && (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 no WM we receive CN only _before_ being visible.
* We should process these CNs.
*/
if (!isVisible() && XWM.getWMID() != XWM.NO_WM) {
--- 770,794 ----
// 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) {
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 no WM we receive CN only _before_ being visible.
* We should process these CNs.
*/
if (!isVisible() && XWM.getWMID() != XWM.NO_WM) {
*** 784,811 ****
* 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());
}
if (!isReparented() && isVisible() && runningWM != XWM.NO_WM
! && !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) {
long parent = XlibUtil.getParentWindow(window);
! 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);
} else {
! insLog.finer("Configure notify - insets are still not available");
}
}
if (correctWM != null) {
handleCorrectInsets(copyAndScaleDown(correctWM));
} else {
--- 803,835 ----
* 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());
}
if (!isReparented() && isVisible() && runningWM != XWM.NO_WM
! && !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) {
long parent = XlibUtil.getParentWindow(window);
! 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);
} else {
! insLog.finer("Configure notify - insets are still " +
! " not available");
}
}
if (correctWM != null) {
handleCorrectInsets(copyAndScaleDown(correctWM));
} else {
*** 815,825 ****
}
}
updateChildrenSizes();
! 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);
--- 839,850 ----
}
}
updateChildrenSizes();
! 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,847 ****
--- 863,875 ----
}
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,943 ****
void initResizability() {
setResizable(winAttr.initialResizability);
}
public void setResizable(boolean resizable) {
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);
} else {
! 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);
} else {
! fs &= ~(MWMConstants.MWM_FUNC_RESIZE | MWMConstants.MWM_FUNC_MAXIMIZE);
}
winAttr.functions = fs;
! XWM.setShellNotResizable(this, dimensions, dimensions.getBounds(), false);
}
}
Rectangle getShellBounds() {
return dimensions.getClientRect();
--- 935,983 ----
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);
} else {
! 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);
} else {
! fs &= ~(MWMConstants.MWM_FUNC_RESIZE
! | MWMConstants.MWM_FUNC_MAXIMIZE);
}
winAttr.functions = fs;
! 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 >