src/solaris/classes/sun/awt/X11/XDecoratedPeer.java
Print this page
*** 76,86 ****
applyGuessedInsets();
Rectangle bounds = (Rectangle)params.get(BOUNDS);
dimensions = new WindowDimensions(bounds, getRealInsets(), false);
params.put(BOUNDS, dimensions.getClientRect());
! if (insLog.isLoggable(PlatformLogger.FINE)) {
insLog.fine("Initial dimensions {0}", dimensions);
}
// Deny default processing of these events on the shell - proxy will take care of
// them instead
--- 76,86 ----
applyGuessedInsets();
Rectangle bounds = (Rectangle)params.get(BOUNDS);
dimensions = new WindowDimensions(bounds, getRealInsets(), false);
params.put(BOUNDS, dimensions.getClientRect());
! if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
insLog.fine("Initial dimensions {0}", dimensions);
}
// Deny default processing of these events on the shell - proxy will take care of
// them instead
*** 179,189 ****
compAccessor.getBackground(target),
compAccessor.getFont(target));
}
public void setTitle(String title) {
! if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("Title is " + title);
}
winAttr.title = title;
updateWMName();
}
--- 179,189 ----
compAccessor.getBackground(target),
compAccessor.getFont(target));
}
public void setTitle(String title) {
! if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("Title is " + title);
}
winAttr.title = title;
updateWMName();
}
*** 229,239 ****
super.handleFocusEvent(xev);
XFocusChangeEvent xfe = xev.get_xfocus();
// If we somehow received focus events forward it instead to proxy
// FIXME: Shouldn't we instead check for inferrior?
! if (focusLog.isLoggable(PlatformLogger.FINER)) {
focusLog.finer("Received focus event on shell: " + xfe);
}
// focusProxy.xRequestFocus();
}
--- 229,239 ----
super.handleFocusEvent(xev);
XFocusChangeEvent xfe = xev.get_xfocus();
// If we somehow received focus events forward it instead to proxy
// FIXME: Shouldn't we instead check for inferrior?
! if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
focusLog.finer("Received focus event on shell: " + xfe);
}
// focusProxy.xRequestFocus();
}
*** 273,283 ****
wm_set_insets = XWM.getInsetsFromExtents(getWindow());
} else {
wm_set_insets = XWM.getInsetsFromProp(getWindow(), changedAtom);
}
! if (insLog.isLoggable(PlatformLogger.FINER)) {
insLog.finer("FRAME_EXTENTS: {0}", wm_set_insets);
}
if (wm_set_insets != null) {
wm_set_insets = copy(wm_set_insets);
--- 273,283 ----
wm_set_insets = XWM.getInsetsFromExtents(getWindow());
} else {
wm_set_insets = XWM.getInsetsFromProp(getWindow(), changedAtom);
}
! if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
insLog.finer("FRAME_EXTENTS: {0}", wm_set_insets);
}
if (wm_set_insets != null) {
wm_set_insets = copy(wm_set_insets);
*** 302,312 ****
long reparent_serial = 0;
public void handleReparentNotifyEvent(XEvent xev) {
XReparentEvent xe = xev.get_xreparent();
! if (insLog.isLoggable(PlatformLogger.FINE)) {
insLog.fine(xe.toString());
}
reparent_serial = xe.get_serial();
XToolkit.awtLock();
try {
--- 302,312 ----
long reparent_serial = 0;
public void handleReparentNotifyEvent(XEvent xev) {
XReparentEvent xe = xev.get_xreparent();
! if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
insLog.fine(xe.toString());
}
reparent_serial = xe.get_serial();
XToolkit.awtLock();
try {
*** 343,353 ****
insets_corrected = false;
// Check if we have insets provided by the WM
Insets correctWM = getWMSetInsets(null);
if (correctWM != null) {
! if (insLog.isLoggable(PlatformLogger.FINER)) {
insLog.finer("wm-provided insets {0}", correctWM);
}
// If these insets are equal to our current insets - no actions are necessary
Insets dimInsets = dimensions.getInsets();
if (correctWM.equals(dimInsets)) {
--- 343,353 ----
insets_corrected = false;
// Check if we have insets provided by the WM
Insets correctWM = getWMSetInsets(null);
if (correctWM != null) {
! if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
insLog.finer("wm-provided insets {0}", correctWM);
}
// If these insets are equal to our current insets - no actions are necessary
Insets dimInsets = dimensions.getInsets();
if (correctWM.equals(dimInsets)) {
*** 358,368 ****
return;
}
} else {
correctWM = XWM.getWM().getInsets(this, xe.get_window(), xe.get_parent());
! if (insLog.isLoggable(PlatformLogger.FINER)) {
if (correctWM != null) {
insLog.finer("correctWM {0}", correctWM);
} else {
insLog.finer("correctWM insets are not available, waiting for configureNotify");
}
--- 358,368 ----
return;
}
} else {
correctWM = XWM.getWM().getInsets(this, xe.get_window(), xe.get_parent());
! if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
if (correctWM != null) {
insLog.finer("correctWM {0}", correctWM);
} else {
insLog.finer("correctWM insets are not available, waiting for configureNotify");
}
*** 384,394 ****
/*
* Ok, now see if we need adjust window size because
* initial insets were wrong (most likely they were).
*/
Insets correction = difference(correctWM, currentInsets);
! if (insLog.isLoggable(PlatformLogger.FINEST)) {
insLog.finest("Corrention {0}", correction);
}
if (!isNull(correction)) {
currentInsets = copy(correctWM);
applyGuessedInsets();
--- 384,394 ----
/*
* Ok, now see if we need adjust window size because
* initial insets were wrong (most likely they were).
*/
Insets correction = difference(correctWM, currentInsets);
! if (insLog.isLoggable(PlatformLogger.Level.FINEST)) {
insLog.finest("Corrention {0}", correction);
}
if (!isNull(correction)) {
currentInsets = copy(correctWM);
applyGuessedInsets();
*** 396,406 ****
//Fix for 6318109: PIT: Min Size is not honored properly when a
//smaller size is specified in setSize(), XToolkit
//update minimum size hints
updateMinSizeHints();
}
! if (insLog.isLoggable(PlatformLogger.FINER)) {
insLog.finer("Dimensions before reparent: " + dimensions);
}
dimensions.setInsets(getRealInsets());
insets_corrected = true;
--- 396,406 ----
//Fix for 6318109: PIT: Min Size is not honored properly when a
//smaller size is specified in setSize(), XToolkit
//update minimum size hints
updateMinSizeHints();
}
! if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
insLog.finer("Dimensions before reparent: " + dimensions);
}
dimensions.setInsets(getRealInsets());
insets_corrected = true;
*** 471,481 ****
}
public Insets getInsets() {
Insets in = copy(getRealInsets());
in.top += getMenuBarHeight();
! if (insLog.isLoggable(PlatformLogger.FINEST)) {
insLog.finest("Get insets returns {0}", in);
}
return in;
}
--- 471,481 ----
}
public Insets getInsets() {
Insets in = copy(getRealInsets());
in.top += getMenuBarHeight();
! if (insLog.isLoggable(PlatformLogger.Level.FINEST)) {
insLog.finest("Get insets returns {0}", in);
}
return in;
}
*** 501,511 ****
// Coordinates are that of the target
// Called only on Toolkit thread
public void reshape(WindowDimensions newDimensions, int op,
boolean userReshape)
{
! if (insLog.isLoggable(PlatformLogger.FINE)) {
insLog.fine("Reshaping " + this + " to " + newDimensions + " op " + op + " user reshape " + userReshape);
}
if (userReshape) {
// We handle only userReshape == true cases. It means that
// if the window manager or any other part of the windowing
--- 501,511 ----
// Coordinates are that of the target
// Called only on Toolkit thread
public void reshape(WindowDimensions newDimensions, int op,
boolean userReshape)
{
! if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
insLog.fine("Reshaping " + this + " to " + newDimensions + " op " + op + " user reshape " + userReshape);
}
if (userReshape) {
// We handle only userReshape == true cases. It means that
// if the window manager or any other part of the windowing
*** 522,532 ****
newDimensions = new WindowDimensions(newBounds, insets, newDimensions.isClientSizeSet());
}
XToolkit.awtLock();
try {
if (!isReparented() || !isVisible()) {
! if (insLog.isLoggable(PlatformLogger.FINE)) {
insLog.fine("- not reparented({0}) or not visible({1}), default reshape",
Boolean.valueOf(isReparented()), Boolean.valueOf(visible));
}
// Fix for 6323293.
--- 522,532 ----
newDimensions = new WindowDimensions(newBounds, insets, newDimensions.isClientSizeSet());
}
XToolkit.awtLock();
try {
if (!isReparented() || !isVisible()) {
! if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
insLog.fine("- not reparented({0}) or not visible({1}), default reshape",
Boolean.valueOf(isReparented()), Boolean.valueOf(visible));
}
// Fix for 6323293.
*** 630,640 ****
default:
dims.setLocation(x, y);
dims.setSize(width, height);
break;
}
! if (insLog.isLoggable(PlatformLogger.FINE)) {
insLog.fine("For the operation {0} new dimensions are {1}",
operationToString(operation), dims);
}
reshape(dims, operation, userReshape);
--- 630,640 ----
default:
dims.setLocation(x, y);
dims.setSize(width, height);
break;
}
! if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
insLog.fine("For the operation {0} new dimensions are {1}",
operationToString(operation), dims);
}
reshape(dims, operation, userReshape);
*** 663,673 ****
boolean no_reparent_artifacts = false;
public void handleConfigureNotifyEvent(XEvent xev) {
assert (SunToolkit.isAWTLockHeldByCurrentThread());
XConfigureEvent xe = xev.get_xconfigure();
! if (insLog.isLoggable(PlatformLogger.FINE)) {
insLog.fine("Configure notify {0}", xe);
}
// XXX: should really only consider synthetic events, but
if (isReparented()) {
--- 663,673 ----
boolean no_reparent_artifacts = false;
public void handleConfigureNotifyEvent(XEvent xev) {
assert (SunToolkit.isAWTLockHeldByCurrentThread());
XConfigureEvent xe = xev.get_xconfigure();
! if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
insLog.fine("Configure notify {0}", xe);
}
// XXX: should really only consider synthetic events, but
if (isReparented()) {
*** 702,712 ****
* possibly MWM as well). If we haven't been reparented yet
* 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.FINE)) {
insLog.fine("reparented={0}, visible={1}, WM={2}, decorations={3}",
isReparented(), isVisible(), runningWM, getDecorations());
}
if (!isReparented() && isVisible() && runningWM != XWM.NO_WM
&& !XWM.isNonReparentingWM()
--- 702,712 ----
* possibly MWM as well). If we haven't been reparented yet
* 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()
*** 716,726 ****
}
//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.FINER)) {
if (correctWM != null) {
insLog.finer("Configure notify - insets : " + correctWM);
} else {
insLog.finer("Configure notify - insets are still not available");
}
--- 716,726 ----
}
//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");
}
*** 756,766 ****
case XWM.METACITY_WM:
case XWM.MUTTER_WM:
case XWM.SAWFISH_WM:
{
Point xlocation = queryXLocation();
! if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("New X location: {0}", xlocation);
}
if (xlocation != null) {
newLocation = xlocation;
}
--- 756,766 ----
case XWM.METACITY_WM:
case XWM.MUTTER_WM:
case XWM.SAWFISH_WM:
{
Point xlocation = queryXLocation();
! if (log.isLoggable(PlatformLogger.Level.FINE)) {
log.fine("New X location: {0}", xlocation);
}
if (xlocation != null) {
newLocation = xlocation;
}
*** 775,785 ****
new WindowDimensions(newLocation,
new Dimension(xe.get_width(), xe.get_height()),
copy(currentInsets),
true);
! if (insLog.isLoggable(PlatformLogger.FINER)) {
insLog.finer("Insets are {0}, new dimensions {1}",
currentInsets, newDimensions);
}
checkIfOnNewScreen(newDimensions.getBounds());
--- 775,785 ----
new WindowDimensions(newLocation,
new Dimension(xe.get_width(), xe.get_height()),
copy(currentInsets),
true);
! if (insLog.isLoggable(PlatformLogger.Level.FINER)) {
insLog.finer("Insets are {0}, new dimensions {1}",
currentInsets, newDimensions);
}
checkIfOnNewScreen(newDimensions.getBounds());
*** 813,823 ****
checkShellRectSize(shellRect);
checkShellRectPos(shellRect);
}
public void setShellBounds(Rectangle rec) {
! if (insLog.isLoggable(PlatformLogger.FINE)) {
insLog.fine("Setting shell bounds on " + this + " to " + rec);
}
XToolkit.awtLock();
try {
updateSizeHints(rec.x, rec.y, rec.width, rec.height);
--- 813,823 ----
checkShellRectSize(shellRect);
checkShellRectPos(shellRect);
}
public void setShellBounds(Rectangle rec) {
! if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
insLog.fine("Setting shell bounds on " + this + " to " + rec);
}
XToolkit.awtLock();
try {
updateSizeHints(rec.x, rec.y, rec.width, rec.height);
*** 827,837 ****
finally {
XToolkit.awtUnlock();
}
}
public void setShellSize(Rectangle rec) {
! if (insLog.isLoggable(PlatformLogger.FINE)) {
insLog.fine("Setting shell size on " + this + " to " + rec);
}
XToolkit.awtLock();
try {
updateSizeHints(rec.x, rec.y, rec.width, rec.height);
--- 827,837 ----
finally {
XToolkit.awtUnlock();
}
}
public void setShellSize(Rectangle rec) {
! if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
insLog.fine("Setting shell size on " + this + " to " + rec);
}
XToolkit.awtLock();
try {
updateSizeHints(rec.x, rec.y, rec.width, rec.height);
*** 840,850 ****
finally {
XToolkit.awtUnlock();
}
}
public void setShellPosition(Rectangle rec) {
! if (insLog.isLoggable(PlatformLogger.FINE)) {
insLog.fine("Setting shell position on " + this + " to " + rec);
}
XToolkit.awtLock();
try {
updateSizeHints(rec.x, rec.y, rec.width, rec.height);
--- 840,850 ----
finally {
XToolkit.awtUnlock();
}
}
public void setShellPosition(Rectangle rec) {
! if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
insLog.fine("Setting shell position on " + this + " to " + rec);
}
XToolkit.awtLock();
try {
updateSizeHints(rec.x, rec.y, rec.width, rec.height);
*** 942,952 ****
try {
if (configure_seen) {
return toGlobal(0,0);
} else {
Point location = target.getLocation();
! if (insLog.isLoggable(PlatformLogger.FINE)) {
insLog.fine("getLocationOnScreen {0} not reparented: {1} ",
this, location);
}
return location;
}
--- 942,952 ----
try {
if (configure_seen) {
return toGlobal(0,0);
} else {
Point location = target.getLocation();
! if (insLog.isLoggable(PlatformLogger.Level.FINE)) {
insLog.fine("getLocationOnScreen {0} not reparented: {1} ",
this, location);
}
return location;
}
*** 982,992 ****
int getFunctions() {
return winAttr.functions;
}
public void setVisible(boolean vis) {
! if (log.isLoggable(PlatformLogger.FINER)) {
log.finer("Setting {0} to visible {1}", this, Boolean.valueOf(vis));
}
if (vis && !isVisible()) {
XWM.setShellDecor(this);
super.setVisible(vis);
--- 982,992 ----
int getFunctions() {
return winAttr.functions;
}
public void setVisible(boolean vis) {
! if (log.isLoggable(PlatformLogger.Level.FINER)) {
log.finer("Setting {0} to visible {1}", this, Boolean.valueOf(vis));
}
if (vis && !isVisible()) {
XWM.setShellDecor(this);
super.setVisible(vis);
*** 1035,1045 ****
}
}
}
private void handleWmTakeFocus(XClientMessageEvent cl) {
! if (focusLog.isLoggable(PlatformLogger.FINE)) {
focusLog.fine("WM_TAKE_FOCUS on {0}", this);
}
requestWindowFocus(cl.get_data(1), true);
}
--- 1035,1045 ----
}
}
}
private void handleWmTakeFocus(XClientMessageEvent cl) {
! if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
focusLog.fine("WM_TAKE_FOCUS on {0}", this);
}
requestWindowFocus(cl.get_data(1), true);
}
*** 1050,1064 ****
protected void requestXFocus(long time, boolean timeProvided) {
// We have proxied focus mechanism - instead of shell the focus is held
// by "proxy" - invisible mapped window. When we want to set X input focus to
// toplevel set it on proxy instead.
if (focusProxy == null) {
! if (focusLog.isLoggable(PlatformLogger.WARNING)) {
focusLog.warning("Focus proxy is null for " + this);
}
} else {
! if (focusLog.isLoggable(PlatformLogger.FINE)) {
focusLog.fine("Requesting focus to proxy: " + focusProxy);
}
if (timeProvided) {
focusProxy.xRequestFocus(time);
} else {
--- 1050,1064 ----
protected void requestXFocus(long time, boolean timeProvided) {
// We have proxied focus mechanism - instead of shell the focus is held
// by "proxy" - invisible mapped window. When we want to set X input focus to
// toplevel set it on proxy instead.
if (focusProxy == null) {
! if (focusLog.isLoggable(PlatformLogger.Level.WARNING)) {
focusLog.warning("Focus proxy is null for " + this);
}
} else {
! if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
focusLog.fine("Requesting focus to proxy: " + focusProxy);
}
if (timeProvided) {
focusProxy.xRequestFocus(time);
} else {
*** 1148,1158 ****
// If this is Frame or Dialog we can't assure focus request success - but we still can try
// If this is Window and its owner Frame is active we can be sure request succedded.
Window focusedWindow = XKeyboardFocusManagerPeer.getInstance().getCurrentFocusedWindow();
Window activeWindow = XWindowPeer.getDecoratedOwner(focusedWindow);
! if (focusLog.isLoggable(PlatformLogger.FINER)) {
focusLog.finer("Current window is: active={0}, focused={1}",
Boolean.valueOf(target == activeWindow),
Boolean.valueOf(target == focusedWindow));
}
--- 1148,1158 ----
// If this is Frame or Dialog we can't assure focus request success - but we still can try
// If this is Window and its owner Frame is active we can be sure request succedded.
Window focusedWindow = XKeyboardFocusManagerPeer.getInstance().getCurrentFocusedWindow();
Window activeWindow = XWindowPeer.getDecoratedOwner(focusedWindow);
! if (focusLog.isLoggable(PlatformLogger.Level.FINER)) {
focusLog.finer("Current window is: active={0}, focused={1}",
Boolean.valueOf(target == activeWindow),
Boolean.valueOf(target == focusedWindow));
}
*** 1175,1198 ****
focusLog.fine("Focus is on child window - transfering it back to the owner");
handleWindowFocusInSync(-1);
return true;
}
Window realNativeFocusedWindow = XWindowPeer.getNativeFocusedWindow();
! if (focusLog.isLoggable(PlatformLogger.FINEST)) {
focusLog.finest("Real native focused window: " + realNativeFocusedWindow +
"\nKFM's focused window: " + focusedWindow);
}
// A workaround for Metacity. See 6522725, 6613426, 7147075.
if (target == realNativeFocusedWindow && XWM.getWMID() == XWM.METACITY_WM) {
! if (focusLog.isLoggable(PlatformLogger.FINE)) {
focusLog.fine("The window is already natively focused.");
}
return true;
}
}
! if (focusLog.isLoggable(PlatformLogger.FINE)) {
focusLog.fine("Requesting focus to " + (this == toFocus ? "this window" : toFocus));
}
if (timeProvided) {
toFocus.requestXFocus(time);
--- 1175,1198 ----
focusLog.fine("Focus is on child window - transfering it back to the owner");
handleWindowFocusInSync(-1);
return true;
}
Window realNativeFocusedWindow = XWindowPeer.getNativeFocusedWindow();
! if (focusLog.isLoggable(PlatformLogger.Level.FINEST)) {
focusLog.finest("Real native focused window: " + realNativeFocusedWindow +
"\nKFM's focused window: " + focusedWindow);
}
// A workaround for Metacity. See 6522725, 6613426, 7147075.
if (target == realNativeFocusedWindow && XWM.getWMID() == XWM.METACITY_WM) {
! if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
focusLog.fine("The window is already natively focused.");
}
return true;
}
}
! if (focusLog.isLoggable(PlatformLogger.Level.FINE)) {
focusLog.fine("Requesting focus to " + (this == toFocus ? "this window" : toFocus));
}
if (timeProvided) {
toFocus.requestXFocus(time);