提交 a09ca6db 编写于 作者: D dcherepanov

6664512: Component and [Default]KeyboardFocusManager pass security sensitive objects to loggers

Summary: toString is called on security sensitive objects
Reviewed-by: art, hawtin
上级 bb73b925
...@@ -4477,7 +4477,7 @@ public abstract class Component implements ImageObserver, MenuContainer, ...@@ -4477,7 +4477,7 @@ public abstract class Component implements ImageObserver, MenuContainer,
} }
if (eventLog.isLoggable(Level.FINEST)) { if (eventLog.isLoggable(Level.FINEST)) {
eventLog.log(Level.FINEST, "{0}", e); eventLog.log(Level.FINEST, "{0}", String.valueOf(e));
} }
/* /*
......
...@@ -380,7 +380,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { ...@@ -380,7 +380,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
// should receive focus first // should receive focus first
if (focusLog.isLoggable(Level.FINER)) { if (focusLog.isLoggable(Level.FINER)) {
focusLog.log(Level.FINER, "tempLost {0}, toFocus {1}", focusLog.log(Level.FINER, "tempLost {0}, toFocus {1}",
new Object[]{tempLost, toFocus}); new Object[]{String.valueOf(tempLost), String.valueOf(toFocus)});
} }
if (tempLost != null) { if (tempLost != null) {
tempLost.requestFocusInWindow(CausedFocusEvent.Cause.ACTIVATION); tempLost.requestFocusInWindow(CausedFocusEvent.Cause.ACTIVATION);
...@@ -448,7 +448,8 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { ...@@ -448,7 +448,8 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
Component newFocusOwner = fe.getComponent(); Component newFocusOwner = fe.getComponent();
if (oldFocusOwner == newFocusOwner) { if (oldFocusOwner == newFocusOwner) {
if (focusLog.isLoggable(Level.FINE)) { if (focusLog.isLoggable(Level.FINE)) {
focusLog.log(Level.FINE, "Skipping {0} because focus owner is the same", new Object[] {e}); focusLog.log(Level.FINE, "Skipping {0} because focus owner is the same",
new Object[] {String.valueOf(e)});
} }
// We can't just drop the event - there could be // We can't just drop the event - there could be
// type-ahead markers associated with it. // type-ahead markers associated with it.
...@@ -565,16 +566,20 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { ...@@ -565,16 +566,20 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
FocusEvent fe = (FocusEvent)e; FocusEvent fe = (FocusEvent)e;
Component currentFocusOwner = getGlobalFocusOwner(); Component currentFocusOwner = getGlobalFocusOwner();
if (currentFocusOwner == null) { if (currentFocusOwner == null) {
if (focusLog.isLoggable(Level.FINE)) focusLog.log(Level.FINE, "Skipping {0} because focus owner is null", if (focusLog.isLoggable(Level.FINE)) {
new Object[] {e}); focusLog.log(Level.FINE, "Skipping {0} because focus owner is null",
new Object[] {String.valueOf(e)});
}
break; break;
} }
// Ignore cases where a Component loses focus to itself. // Ignore cases where a Component loses focus to itself.
// If we make a mistake because of retargeting, then the // If we make a mistake because of retargeting, then the
// FOCUS_GAINED handler will correct it. // FOCUS_GAINED handler will correct it.
if (currentFocusOwner == fe.getOppositeComponent()) { if (currentFocusOwner == fe.getOppositeComponent()) {
if (focusLog.isLoggable(Level.FINE)) focusLog.log(Level.FINE, "Skipping {0} because current focus owner is equal to opposite", if (focusLog.isLoggable(Level.FINE)) {
new Object[] {e}); focusLog.log(Level.FINE, "Skipping {0} because current focus owner is equal to opposite",
new Object[] {String.valueOf(e)});
}
break; break;
} }
...@@ -642,9 +647,11 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { ...@@ -642,9 +647,11 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
Window losingFocusWindow = we.getWindow(); Window losingFocusWindow = we.getWindow();
Window activeWindow = getGlobalActiveWindow(); Window activeWindow = getGlobalActiveWindow();
Window oppositeWindow = we.getOppositeWindow(); Window oppositeWindow = we.getOppositeWindow();
if (focusLog.isLoggable(Level.FINE)) focusLog.log(Level.FINE, "Active {0}, Current focused {1}, losing focus {2} opposite {3}", if (focusLog.isLoggable(Level.FINE)) {
new Object[] {activeWindow, currentFocusedWindow, focusLog.log(Level.FINE, "Active {0}, Current focused {1}, losing focus {2} opposite {3}",
losingFocusWindow, oppositeWindow}); new Object[] {String.valueOf(activeWindow), String.valueOf(currentFocusedWindow),
String.valueOf(losingFocusWindow), String.valueOf(oppositeWindow)});
}
if (currentFocusedWindow == null) { if (currentFocusedWindow == null) {
break; break;
} }
...@@ -828,7 +835,10 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { ...@@ -828,7 +835,10 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
} }
} }
if (ke != null) { if (ke != null) {
focusLog.log(Level.FINER, "Pumping approved event {0}", new Object[] {ke}); if (focusLog.isLoggable(Level.FINER)) {
focusLog.log(Level.FINER, "Pumping approved event {0}",
new Object[] {String.valueOf(ke)});
}
enqueuedKeyEvents.removeFirst(); enqueuedKeyEvents.removeFirst();
} }
} }
...@@ -850,7 +860,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { ...@@ -850,7 +860,7 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
Iterator iter = typeAheadMarkers.iterator(); Iterator iter = typeAheadMarkers.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
TypeAheadMarker marker = (TypeAheadMarker)iter.next(); TypeAheadMarker marker = (TypeAheadMarker)iter.next();
focusLog.log(Level.FINEST, " {0}", marker); focusLog.log(Level.FINEST, " {0}", String.valueOf(marker));
} }
} }
} }
...@@ -878,7 +888,10 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { ...@@ -878,7 +888,10 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
// The fix is rolled out. // The fix is rolled out.
if (ke.getWhen() > marker.after) { if (ke.getWhen() > marker.after) {
focusLog.log(Level.FINER, "Storing event {0} because of marker {1}", new Object[] {ke, marker}); if (focusLog.isLoggable(Level.FINER)) {
focusLog.log(Level.FINER, "Storing event {0} because of marker {1}",
new Object[] {String.valueOf(ke), String.valueOf(marker)});
}
enqueuedKeyEvents.addLast(ke); enqueuedKeyEvents.addLast(ke);
return true; return true;
} }
...@@ -890,7 +903,10 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { ...@@ -890,7 +903,10 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
} }
case FocusEvent.FOCUS_GAINED: case FocusEvent.FOCUS_GAINED:
focusLog.log(Level.FINEST, "Markers before FOCUS_GAINED on {0}", new Object[] {target}); if (focusLog.isLoggable(Level.FINEST)) {
focusLog.log(Level.FINEST, "Markers before FOCUS_GAINED on {0}",
new Object[] {String.valueOf(target)});
}
dumpMarkers(); dumpMarkers();
// Search the marker list for the first marker tied to // Search the marker list for the first marker tied to
// the Component which just gained focus. Then remove // the Component which just gained focus. Then remove
...@@ -919,10 +935,14 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { ...@@ -919,10 +935,14 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
} }
} else { } else {
// Exception condition - event without marker // Exception condition - event without marker
focusLog.log(Level.FINER, "Event without marker {0}", e); if (focusLog.isLoggable(Level.FINER)) {
focusLog.log(Level.FINER, "Event without marker {0}", String.valueOf(e));
}
} }
} }
focusLog.log(Level.FINEST, "Markers after FOCUS_GAINED"); focusLog.log(Level.FINEST, "Markers after FOCUS_GAINED");
dumpMarkers(); dumpMarkers();
redispatchEvent(target, e); redispatchEvent(target, e);
...@@ -1159,8 +1179,10 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { ...@@ -1159,8 +1179,10 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
return; return;
} }
focusLog.log(Level.FINER, "Enqueue at {0} for {1}", if (focusLog.isLoggable(Level.FINER)) {
new Object[] {after, untilFocused}); focusLog.log(Level.FINER, "Enqueue at {0} for {1}",
new Object[] {after, String.valueOf(untilFocused)});
}
int insertionIndex = 0, int insertionIndex = 0,
i = typeAheadMarkers.size(); i = typeAheadMarkers.size();
...@@ -1199,8 +1221,10 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { ...@@ -1199,8 +1221,10 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
return; return;
} }
focusLog.log(Level.FINER, "Dequeue at {0} for {1}", if (focusLog.isLoggable(Level.FINER)) {
new Object[] {after, untilFocused}); focusLog.log(Level.FINER, "Dequeue at {0} for {1}",
new Object[] {after, String.valueOf(untilFocused)});
}
TypeAheadMarker marker; TypeAheadMarker marker;
ListIterator iter = typeAheadMarkers.listIterator ListIterator iter = typeAheadMarkers.listIterator
......
...@@ -611,7 +611,7 @@ public abstract class KeyboardFocusManager ...@@ -611,7 +611,7 @@ public abstract class KeyboardFocusManager
void setNativeFocusOwner(Component comp) { void setNativeFocusOwner(Component comp) {
if (focusLog.isLoggable(Level.FINEST)) { if (focusLog.isLoggable(Level.FINEST)) {
focusLog.log(Level.FINEST, "Calling peer {0} setCurrentFocusOwner for {1}", focusLog.log(Level.FINEST, "Calling peer {0} setCurrentFocusOwner for {1}",
new Object[] {peer, comp}); new Object[] {String.valueOf(peer), String.valueOf(comp)});
} }
peer.setCurrentFocusOwner(comp); peer.setCurrentFocusOwner(comp);
} }
...@@ -2363,20 +2363,20 @@ public abstract class KeyboardFocusManager ...@@ -2363,20 +2363,20 @@ public abstract class KeyboardFocusManager
Window nativeFocusedWindow = thisManager.getNativeFocusedWindow(); Window nativeFocusedWindow = thisManager.getNativeFocusedWindow();
if (focusLog.isLoggable(Level.FINER)) { if (focusLog.isLoggable(Level.FINER)) {
focusLog.log(Level.FINER, "SNFH for {0} in {1}", focusLog.log(Level.FINER, "SNFH for {0} in {1}",
new Object[] {descendant, heavyweight}); new Object[] {String.valueOf(descendant), String.valueOf(heavyweight)});
} }
if (focusLog.isLoggable(Level.FINEST)) { if (focusLog.isLoggable(Level.FINEST)) {
focusLog.log(Level.FINEST, "0. Current focus owner {0}", focusLog.log(Level.FINEST, "0. Current focus owner {0}",
currentFocusOwner); String.valueOf(currentFocusOwner));
focusLog.log(Level.FINEST, "0. Native focus owner {0}", focusLog.log(Level.FINEST, "0. Native focus owner {0}",
nativeFocusOwner); String.valueOf(nativeFocusOwner));
focusLog.log(Level.FINEST, "0. Native focused window {0}", focusLog.log(Level.FINEST, "0. Native focused window {0}",
nativeFocusedWindow); String.valueOf(nativeFocusedWindow));
} }
synchronized (heavyweightRequests) { synchronized (heavyweightRequests) {
HeavyweightFocusRequest hwFocusRequest = getLastHWRequest(); HeavyweightFocusRequest hwFocusRequest = getLastHWRequest();
if (focusLog.isLoggable(Level.FINEST)) { if (focusLog.isLoggable(Level.FINEST)) {
focusLog.log(Level.FINEST, "Request {0}", hwFocusRequest); focusLog.log(Level.FINEST, "Request {0}", String.valueOf(hwFocusRequest));
} }
if (hwFocusRequest == null && if (hwFocusRequest == null &&
heavyweight == nativeFocusOwner) heavyweight == nativeFocusOwner)
...@@ -2385,7 +2385,7 @@ public abstract class KeyboardFocusManager ...@@ -2385,7 +2385,7 @@ public abstract class KeyboardFocusManager
// Redundant request. // Redundant request.
if (focusLog.isLoggable(Level.FINEST)) if (focusLog.isLoggable(Level.FINEST))
focusLog.log(Level.FINEST, "1. SNFH_FAILURE for {0}", focusLog.log(Level.FINEST, "1. SNFH_FAILURE for {0}",
descendant); String.valueOf(descendant));
return SNFH_FAILURE; return SNFH_FAILURE;
} }
...@@ -2418,7 +2418,7 @@ public abstract class KeyboardFocusManager ...@@ -2418,7 +2418,7 @@ public abstract class KeyboardFocusManager
SunToolkit.postEvent(descendant.appContext, newFocusOwnerEvent); SunToolkit.postEvent(descendant.appContext, newFocusOwnerEvent);
if (focusLog.isLoggable(Level.FINEST)) if (focusLog.isLoggable(Level.FINEST))
focusLog.log(Level.FINEST, "2. SNFH_HANDLED for {0}", descendant); focusLog.log(Level.FINEST, "2. SNFH_HANDLED for {0}", String.valueOf(descendant));
return SNFH_SUCCESS_HANDLED; return SNFH_SUCCESS_HANDLED;
} else if (hwFocusRequest != null && } else if (hwFocusRequest != null &&
hwFocusRequest.heavyweight == heavyweight) { hwFocusRequest.heavyweight == heavyweight) {
...@@ -2857,11 +2857,12 @@ public abstract class KeyboardFocusManager ...@@ -2857,11 +2857,12 @@ public abstract class KeyboardFocusManager
KeyboardFocusManager manager = getCurrentKeyboardFocusManager(); KeyboardFocusManager manager = getCurrentKeyboardFocusManager();
if (focusLog.isLoggable(Level.FINER)) { if (focusLog.isLoggable(Level.FINER)) {
if (event instanceof FocusEvent || event instanceof WindowEvent) { if (event instanceof FocusEvent || event instanceof WindowEvent) {
focusLog.log(Level.FINER, ">>> {0}", new Object[] {event}); focusLog.log(Level.FINER, ">>> {0}", new Object[] {String.valueOf(event)});
} }
if (focusLog.isLoggable(Level.FINER) && event instanceof KeyEvent) { if (focusLog.isLoggable(Level.FINER) && event instanceof KeyEvent) {
focusLog.log(Level.FINER, " focus owner is {0}", new Object[] {manager.getGlobalFocusOwner()}); focusLog.log(Level.FINER, " focus owner is {0}",
focusLog.log(Level.FINER, ">>> {0}", new Object[] {event}); new Object[] {String.valueOf(manager.getGlobalFocusOwner())});
focusLog.log(Level.FINER, ">>> {0}", new Object[] {String.valueOf(event)});
} }
} }
......
...@@ -129,7 +129,7 @@ final class DebugSettings { ...@@ -129,7 +129,7 @@ final class DebugSettings {
// echo the initial property settings to stdout // echo the initial property settings to stdout
if (log.isLoggable(Level.FINE)) { if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "DebugSettings:\n{0}", this); log.log(Level.FINE, "DebugSettings:\n{0}", String.valueOf(this));
} }
} }
......
...@@ -824,7 +824,9 @@ public class XBaseWindow { ...@@ -824,7 +824,9 @@ public class XBaseWindow {
* The active grab overrides activated automatic grab. * The active grab overrides activated automatic grab.
*/ */
public boolean grabInput() { public boolean grabInput() {
grabLog.log(Level.FINE, "Grab input on {0}", new Object[] {this}); if (grabLog.isLoggable(Level.FINE)) {
grabLog.log(Level.FINE, "Grab input on {0}", new Object[] {String.valueOf(this)});
}
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
...@@ -887,7 +889,10 @@ public class XBaseWindow { ...@@ -887,7 +889,10 @@ public class XBaseWindow {
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
XBaseWindow grabWindow = XAwtState.getGrabWindow(); XBaseWindow grabWindow = XAwtState.getGrabWindow();
grabLog.log(Level.FINE, "UnGrab input on {0}", new Object[] {grabWindow}); if (grabLog.isLoggable(Level.FINE)) {
grabLog.log(Level.FINE, "UnGrab input on {0}",
new Object[] {String.valueOf(grabWindow)});
}
if (grabWindow != null) { if (grabWindow != null) {
grabWindow.ungrabInputImpl(); grabWindow.ungrabInputImpl();
if (!XToolkit.getSunAwtDisableGrab()) { if (!XToolkit.getSunAwtDisableGrab()) {
...@@ -940,7 +945,7 @@ public class XBaseWindow { ...@@ -940,7 +945,7 @@ public class XBaseWindow {
XPropertyCache.clearCache(window, XAtom.get(msg.get_atom())); XPropertyCache.clearCache(window, XAtom.get(msg.get_atom()));
} }
if (eventLog.isLoggable(Level.FINER)) { if (eventLog.isLoggable(Level.FINER)) {
eventLog.log(Level.FINER, "{0}", new Object[] {msg}); eventLog.log(Level.FINER, "{0}", new Object[] {String.valueOf(msg)});
} }
} }
...@@ -1021,8 +1026,10 @@ public class XBaseWindow { ...@@ -1021,8 +1026,10 @@ public class XBaseWindow {
} }
public void handleConfigureNotifyEvent(XEvent xev) { public void handleConfigureNotifyEvent(XEvent xev) {
XConfigureEvent xe = xev.get_xconfigure(); XConfigureEvent xe = xev.get_xconfigure();
insLog.log(Level.FINER, "Configure, {0}", if (insLog.isLoggable(Level.FINER)) {
new Object[] {xe}); insLog.log(Level.FINER, "Configure, {0}",
new Object[] {String.valueOf(xe)});
}
x = xe.get_x(); x = xe.get_x();
y = xe.get_y(); y = xe.get_y();
width = xe.get_width(); width = xe.get_width();
......
...@@ -29,8 +29,6 @@ import java.awt.*; ...@@ -29,8 +29,6 @@ import java.awt.*;
import java.awt.peer.*; import java.awt.peer.*;
import java.awt.event.*; import java.awt.event.*;
import java.util.logging.*;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import sun.awt.SunToolkit; import sun.awt.SunToolkit;
...@@ -42,8 +40,6 @@ class XCheckboxMenuItemPeer extends XMenuItemPeer implements CheckboxMenuItemPee ...@@ -42,8 +40,6 @@ class XCheckboxMenuItemPeer extends XMenuItemPeer implements CheckboxMenuItemPee
* *
************************************************/ ************************************************/
private static Logger log = Logger.getLogger("sun.awt.X11.XCheckboxMenuItemPeer");
/* /*
* CheckboxMenuItem's fields * CheckboxMenuItem's fields
*/ */
......
...@@ -253,7 +253,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget ...@@ -253,7 +253,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
* Called when component receives focus * Called when component receives focus
*/ */
public void focusGained(FocusEvent e) { public void focusGained(FocusEvent e) {
focusLog.log(Level.FINE, "{0}", new Object[] {e}); if (focusLog.isLoggable(Level.FINE)) {
focusLog.log(Level.FINE, "{0}", new Object[] {String.valueOf(e)});
}
bHasFocus = true; bHasFocus = true;
} }
...@@ -261,7 +263,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget ...@@ -261,7 +263,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
* Called when component loses focus * Called when component loses focus
*/ */
public void focusLost(FocusEvent e) { public void focusLost(FocusEvent e) {
focusLog.log(Level.FINE, "{0}", new Object[] {e}); if (focusLog.isLoggable(Level.FINE)) {
focusLog.log(Level.FINE, "{0}", new Object[] {String.valueOf(e)});
}
bHasFocus = false; bHasFocus = false;
} }
...@@ -414,7 +418,10 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget ...@@ -414,7 +418,10 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
* @see java.awt.peer.ComponentPeer * @see java.awt.peer.ComponentPeer
*/ */
public void setEnabled(boolean value) { public void setEnabled(boolean value) {
enableLog.log(Level.FINE, "{0}ing {1}", new Object[] {(value?"Enabl":"Disabl"), this}); if (enableLog.isLoggable(Level.FINE)) {
enableLog.log(Level.FINE, "{0}ing {1}",
new Object[] {(value?"Enabl":"Disabl"), String.valueOf(this)});
}
boolean repaintNeeded = (enabled != value); boolean repaintNeeded = (enabled != value);
enabled = value; enabled = value;
if (target instanceof Container) { if (target instanceof Container) {
...@@ -1262,7 +1269,10 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget ...@@ -1262,7 +1269,10 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
* ButtonPress, ButtonRelease, KeyPress, KeyRelease, EnterNotify, LeaveNotify, MotionNotify * ButtonPress, ButtonRelease, KeyPress, KeyRelease, EnterNotify, LeaveNotify, MotionNotify
*/ */
protected boolean isEventDisabled(XEvent e) { protected boolean isEventDisabled(XEvent e) {
enableLog.log(Level.FINEST, "Component is {1}, checking for disabled event {0}", new Object[] {e, (isEnabled()?"enabled":"disable")}); if (enableLog.isLoggable(Level.FINEST)) {
enableLog.log(Level.FINEST, "Component is {1}, checking for disabled event {0}",
new Object[] {String.valueOf(e), (isEnabled()?"enabled":"disable")});
}
if (!isEnabled()) { if (!isEnabled()) {
switch (e.get_type()) { switch (e.get_type()) {
case XConstants.ButtonPress: case XConstants.ButtonPress:
...@@ -1272,7 +1282,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget ...@@ -1272,7 +1282,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
case XConstants.EnterNotify: case XConstants.EnterNotify:
case XConstants.LeaveNotify: case XConstants.LeaveNotify:
case XConstants.MotionNotify: case XConstants.MotionNotify:
enableLog.log(Level.FINER, "Event {0} is disable", new Object[] {e}); if (enableLog.isLoggable(Level.FINER)) {
enableLog.log(Level.FINER, "Event {0} is disable", new Object[] {String.valueOf(e)});
}
return true; return true;
} }
} }
......
...@@ -116,8 +116,10 @@ public final class XContentWindow extends XWindow { ...@@ -116,8 +116,10 @@ public final class XContentWindow extends XWindow {
if (in != null) { if (in != null) {
newBounds.setLocation(-in.left, -in.top); newBounds.setLocation(-in.left, -in.top);
} }
if (insLog.isLoggable(Level.FINE)) insLog.log(Level.FINE, "Setting content bounds {0}, old bounds {1}", if (insLog.isLoggable(Level.FINE)) {
new Object[] {newBounds, getBounds()}); insLog.log(Level.FINE, "Setting content bounds {0}, old bounds {1}",
new Object[] {String.valueOf(newBounds), String.valueOf(getBounds())});
}
// Fix for 5023533: // Fix for 5023533:
// Change in the size of the content window means, well, change of the size // Change in the size of the content window means, well, change of the size
// Change in the location of the content window means change in insets // Change in the location of the content window means change in insets
......
...@@ -79,7 +79,9 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -79,7 +79,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
Rectangle bounds = (Rectangle)params.get(BOUNDS); Rectangle bounds = (Rectangle)params.get(BOUNDS);
dimensions = new WindowDimensions(bounds, getRealInsets(), false); dimensions = new WindowDimensions(bounds, getRealInsets(), false);
params.put(BOUNDS, dimensions.getClientRect()); params.put(BOUNDS, dimensions.getClientRect());
insLog.log(Level.FINE, "Initial dimensions {0}", new Object[] { dimensions }); if (insLog.isLoggable(Level.FINE)) {
insLog.log(Level.FINE, "Initial dimensions {0}",new Object[] { String.valueOf(dimensions) });
}
// Deny default processing of these events on the shell - proxy will take care of // Deny default processing of these events on the shell - proxy will take care of
// them instead // them instead
...@@ -265,7 +267,10 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -265,7 +267,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
wm_set_insets = XWM.getInsetsFromProp(getWindow(), changedAtom); wm_set_insets = XWM.getInsetsFromProp(getWindow(), changedAtom);
} }
insLog.log(Level.FINER, "FRAME_EXTENTS: {0}", new Object[]{wm_set_insets}); if (insLog.isLoggable(Level.FINER)) {
insLog.log(Level.FINER, "FRAME_EXTENTS: {0}",
new Object[]{String.valueOf(wm_set_insets)});
}
if (wm_set_insets != null) { if (wm_set_insets != null) {
wm_set_insets = copy(wm_set_insets); wm_set_insets = copy(wm_set_insets);
...@@ -331,7 +336,10 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -331,7 +336,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
// Check if we have insets provided by the WM // Check if we have insets provided by the WM
Insets correctWM = getWMSetInsets(null); Insets correctWM = getWMSetInsets(null);
if (correctWM != null) { if (correctWM != null) {
insLog.log(Level.FINER, "wm-provided insets {0}", new Object[]{correctWM}); if (insLog.isLoggable(Level.FINER)) {
insLog.log(Level.FINER, "wm-provided insets {0}",
new Object[]{String.valueOf(correctWM)});
}
// If these insets are equal to our current insets - no actions are necessary // If these insets are equal to our current insets - no actions are necessary
Insets dimInsets = dimensions.getInsets(); Insets dimInsets = dimensions.getInsets();
if (correctWM.equals(dimInsets)) { if (correctWM.equals(dimInsets)) {
...@@ -345,7 +353,9 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -345,7 +353,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
correctWM = XWM.getWM().getInsets(this, xe.get_window(), xe.get_parent()); correctWM = XWM.getWM().getInsets(this, xe.get_window(), xe.get_parent());
if (correctWM != null) { if (correctWM != null) {
insLog.log(Level.FINER, "correctWM {0}", new Object[] {correctWM}); if (insLog.isLoggable(Level.FINE)) {
insLog.log(Level.FINER, "correctWM {0}", new Object[] {String.valueOf(correctWM)});
}
} else { } else {
insLog.log(Level.FINER, "correctWM insets are not available, waiting for configureNotify"); insLog.log(Level.FINER, "correctWM insets are not available, waiting for configureNotify");
} }
...@@ -368,7 +378,10 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -368,7 +378,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
* initial insets were wrong (most likely they were). * initial insets were wrong (most likely they were).
*/ */
Insets correction = difference(correctWM, currentInsets); Insets correction = difference(correctWM, currentInsets);
insLog.log(Level.FINEST, "Corrention {0}", new Object[] {correction}); if (insLog.isLoggable(Level.FINEST)) {
insLog.log(Level.FINEST, "Corrention {0}",
new Object[] {String.valueOf(correction)});
}
if (!isNull(correction)) { if (!isNull(correction)) {
currentInsets = copy(correctWM); currentInsets = copy(correctWM);
applyGuessedInsets(); applyGuessedInsets();
...@@ -453,7 +466,7 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -453,7 +466,7 @@ abstract class XDecoratedPeer extends XWindowPeer {
Insets in = copy(getRealInsets()); Insets in = copy(getRealInsets());
in.top += getMenuBarHeight(); in.top += getMenuBarHeight();
if (insLog.isLoggable(Level.FINEST)) { if (insLog.isLoggable(Level.FINEST)) {
insLog.log(Level.FINEST, "Get insets returns {0}", new Object[] {in}); insLog.log(Level.FINEST, "Get insets returns {0}", new Object[] {String.valueOf(in)});
} }
return in; return in;
} }
...@@ -610,7 +623,7 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -610,7 +623,7 @@ abstract class XDecoratedPeer extends XWindowPeer {
break; break;
} }
if (insLog.isLoggable(Level.FINE)) insLog.log(Level.FINE, "For the operation {0} new dimensions are {1}", if (insLog.isLoggable(Level.FINE)) insLog.log(Level.FINE, "For the operation {0} new dimensions are {1}",
new Object[] {operationToString(operation), dims}); new Object[] {operationToString(operation), String.valueOf(dims)});
reshape(dims, operation, userReshape); reshape(dims, operation, userReshape);
} }
...@@ -640,7 +653,9 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -640,7 +653,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
public void handleConfigureNotifyEvent(XEvent xev) { public void handleConfigureNotifyEvent(XEvent xev) {
assert (SunToolkit.isAWTLockHeldByCurrentThread()); assert (SunToolkit.isAWTLockHeldByCurrentThread());
XConfigureEvent xe = xev.get_xconfigure(); XConfigureEvent xe = xev.get_xconfigure();
insLog.log(Level.FINE, "Configure notify {0}", new Object[] {xe}); if (insLog.isLoggable(Level.FINE)) {
insLog.log(Level.FINE, "Configure notify {0}", new Object[] {String.valueOf(xe)});
}
// XXX: should really only consider synthetic events, but // XXX: should really only consider synthetic events, but
if (isReparented()) { if (isReparented()) {
...@@ -732,7 +747,10 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -732,7 +747,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
case XWM.SAWFISH_WM: case XWM.SAWFISH_WM:
{ {
Point xlocation = queryXLocation(); Point xlocation = queryXLocation();
if (log.isLoggable(Level.FINE)) log.log(Level.FINE, "New X location: {0}", new Object[]{xlocation}); if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "New X location: {0}",
new Object[]{String.valueOf(xlocation)});
}
if (xlocation != null) { if (xlocation != null) {
newLocation = xlocation; newLocation = xlocation;
} }
...@@ -749,8 +767,10 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -749,8 +767,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
copy(currentInsets), copy(currentInsets),
true); true);
insLog.log(Level.FINER, "Insets are {0}, new dimensions {1}", if (insLog.isLoggable(Level.FINER)) {
new Object[] {currentInsets, newDimensions}); insLog.log(Level.FINER, "Insets are {0}, new dimensions {1}",
new Object[] {String.valueOf(currentInsets), String.valueOf(newDimensions)});
}
checkIfOnNewScreen(newDimensions.getBounds()); checkIfOnNewScreen(newDimensions.getBounds());
...@@ -917,7 +937,7 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -917,7 +937,7 @@ abstract class XDecoratedPeer extends XWindowPeer {
Point location = target.getLocation(); Point location = target.getLocation();
if (insLog.isLoggable(Level.FINE)) if (insLog.isLoggable(Level.FINE))
insLog.log(Level.FINE, "getLocationOnScreen {0} not reparented: {1} ", insLog.log(Level.FINE, "getLocationOnScreen {0} not reparented: {1} ",
new Object[] {this, location}); new Object[] {String.valueOf(this), String.valueOf(location)});
return location; return location;
} }
} finally { } finally {
...@@ -954,7 +974,10 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -954,7 +974,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
} }
public void setVisible(boolean vis) { public void setVisible(boolean vis) {
log.log(Level.FINER, "Setting {0} to visible {1}", new Object[] {this, Boolean.valueOf(vis)}); if (log.isLoggable(Level.FINE)) {
log.log(Level.FINER, "Setting {0} to visible {1}",
new Object[] {String.valueOf(this), Boolean.valueOf(vis)});
}
if (vis && !isVisible()) { if (vis && !isVisible()) {
XWM.setShellDecor(this); XWM.setShellDecor(this);
super.setVisible(vis); super.setVisible(vis);
...@@ -1005,7 +1028,9 @@ abstract class XDecoratedPeer extends XWindowPeer { ...@@ -1005,7 +1028,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
} }
private void handleWmTakeFocus(XClientMessageEvent cl) { private void handleWmTakeFocus(XClientMessageEvent cl) {
focusLog.log(Level.FINE, "WM_TAKE_FOCUS on {0}", new Object[]{this}); if (focusLog.isLoggable(Level.FINE)) {
focusLog.log(Level.FINE, "WM_TAKE_FOCUS on {0}", new Object[]{String.valueOf(this)});
}
requestWindowFocus(cl.get_data(1), true); requestWindowFocus(cl.get_data(1), true);
} }
......
...@@ -117,7 +117,7 @@ abstract class XDropTargetProtocol { ...@@ -117,7 +117,7 @@ abstract class XDropTargetProtocol {
EmbedderRegistryEntry entry = getEmbedderRegistryEntry(toplevel); EmbedderRegistryEntry entry = getEmbedderRegistryEntry(toplevel);
if (logger.isLoggable(Level.FINEST)) { if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, " entry={0}", new Object[] {entry}); logger.log(Level.FINEST, " entry={0}", new Object[] {String.valueOf(entry)});
} }
// Window not registered as an embedder for this protocol. // Window not registered as an embedder for this protocol.
if (entry == null) { if (entry == null) {
...@@ -138,7 +138,8 @@ abstract class XDropTargetProtocol { ...@@ -138,7 +138,8 @@ abstract class XDropTargetProtocol {
long proxy = entry.getProxy(); long proxy = entry.getProxy();
if (logger.isLoggable(Level.FINEST)) { if (logger.isLoggable(Level.FINEST)) {
logger.log(Level.FINEST, " proxy={0} toplevel={1}", new Object[] {proxy, toplevel}); logger.log(Level.FINEST, " proxy={0} toplevel={1}",
new Object[] {String.valueOf(proxy), String.valueOf(toplevel)});
} }
if (proxy == 0) { if (proxy == 0) {
proxy = toplevel; proxy = toplevel;
......
...@@ -34,7 +34,6 @@ import java.util.logging.*; ...@@ -34,7 +34,6 @@ import java.util.logging.*;
* and therefore X doesn't control focus after we have set it to proxy. * and therefore X doesn't control focus after we have set it to proxy.
*/ */
public class XFocusProxyWindow extends XBaseWindow { public class XFocusProxyWindow extends XBaseWindow {
private static final Logger focusLog = Logger.getLogger("sun.awt.X11.focus.XFocusProxyWindow");
XWindowPeer owner; XWindowPeer owner;
public XFocusProxyWindow(XWindowPeer owner) { public XFocusProxyWindow(XWindowPeer owner) {
......
...@@ -283,7 +283,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer { ...@@ -283,7 +283,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
super.handlePropertyNotify(xev); super.handlePropertyNotify(xev);
XPropertyEvent ev = xev.get_xproperty(); XPropertyEvent ev = xev.get_xproperty();
log.log(Level.FINER, "Property change {0}", new Object[] {ev}); if (log.isLoggable(Level.FINER)) {
log.log(Level.FINER, "Property change {0}", new Object[] {String.valueOf(ev)});
}
/* /*
* Let's see if this is a window state protocol message, and * Let's see if this is a window state protocol message, and
* if it is - decode a new state in terms of java constants. * if it is - decode a new state in terms of java constants.
......
...@@ -75,7 +75,7 @@ public class XIconWindow extends XBaseWindow { ...@@ -75,7 +75,7 @@ public class XIconWindow extends XBaseWindow {
XIconSize[] res = new XIconSize[count]; XIconSize[] res = new XIconSize[count];
for (int i = 0; i < count; i++, sizes_ptr += XIconSize.getSize()) { for (int i = 0; i < count; i++, sizes_ptr += XIconSize.getSize()) {
res[i] = new XIconSize(sizes_ptr); res[i] = new XIconSize(sizes_ptr);
log.log(Level.FINEST, "sizes_ptr[{1}] = {0}", new Object[] {res[i], Integer.valueOf(i)}); log.log(Level.FINEST, "sizes_ptr[{1}] = {0}", new Object[] {String.valueOf(res[i]), Integer.valueOf(i)});
} }
return res; return res;
} finally { } finally {
...@@ -92,7 +92,10 @@ public class XIconWindow extends XBaseWindow { ...@@ -92,7 +92,10 @@ public class XIconWindow extends XBaseWindow {
} }
XIconSize[] sizeList = getIconSizes(); XIconSize[] sizeList = getIconSizes();
log.log(Level.FINEST, "Icon sizes: {0}", new Object[] {sizeList});
if (log.isLoggable(Level.FINEST)) {
log.log(Level.FINEST, "Icon sizes: {0}", new Object[] {String.valueOf(sizeList)});
}
if (sizeList == null) { if (sizeList == null) {
// No icon sizes so we simply fall back to 16x16 // No icon sizes so we simply fall back to 16x16
return new Dimension(16, 16); return new Dimension(16, 16);
...@@ -444,7 +447,9 @@ public class XIconWindow extends XBaseWindow { ...@@ -444,7 +447,9 @@ public class XIconWindow extends XBaseWindow {
} }
Dimension iconSize = getIconSize(width, height); Dimension iconSize = getIconSize(width, height);
if (iconSize != null) { if (iconSize != null) {
log.log(Level.FINEST, "Icon size: {0}", iconSize); if (log.isLoggable(Level.FINEST)) {
log.log(Level.FINEST, "Icon size: {0}", String.valueOf(iconSize));
}
iconWidth = iconSize.width; iconWidth = iconSize.width;
iconHeight = iconSize.height; iconHeight = iconSize.height;
} else { } else {
......
...@@ -108,7 +108,10 @@ public class XInputMethod extends X11InputMethod { ...@@ -108,7 +108,10 @@ public class XInputMethod extends X11InputMethod {
client = getParent(client); client = getParent(client);
peer = (XComponentPeer)XToolkit.targetToPeer(client); peer = (XComponentPeer)XToolkit.targetToPeer(client);
} }
log.log(Level.FINE, "Peer is {0}, client is {1}", new Object[] {peer, client}); if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "Peer is {0}, client is {1}",
new Object[] {String.valueOf(peer), String.valueOf(client)});
}
if (peer != null) if (peer != null)
return peer; return peer;
......
...@@ -43,8 +43,6 @@ public class XMenuItemPeer implements MenuItemPeer { ...@@ -43,8 +43,6 @@ public class XMenuItemPeer implements MenuItemPeer {
* *
************************************************/ ************************************************/
private static Logger log = Logger.getLogger("sun.awt.X11.XMenuItemPeer");
/* /*
* Primary members * Primary members
*/ */
......
...@@ -54,7 +54,11 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt ...@@ -54,7 +54,11 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
private void setInitialState(XWindowPeer window, int state) { private void setInitialState(XWindowPeer window, int state) {
XAtomList old_state = window.getNETWMState(); XAtomList old_state = window.getNETWMState();
log.log(Level.FINE, "Current state of the window {0} is {1}", new Object[] {window, old_state}); if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "Current state of the window {0} is {1}",
new Object[] {String.valueOf(window),
String.valueOf(old_state)});
}
if ((state & Frame.MAXIMIZED_VERT) != 0) { if ((state & Frame.MAXIMIZED_VERT) != 0) {
old_state.add(XA_NET_WM_STATE_MAXIMIZED_VERT); old_state.add(XA_NET_WM_STATE_MAXIMIZED_VERT);
} else { } else {
...@@ -65,7 +69,10 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt ...@@ -65,7 +69,10 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
} else { } else {
old_state.remove(XA_NET_WM_STATE_MAXIMIZED_HORZ); old_state.remove(XA_NET_WM_STATE_MAXIMIZED_HORZ);
} }
log.log(Level.FINE, "Setting initial state of the window {0} to {1}", new Object[] {window, old_state}); if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "Setting initial state of the window {0} to {1}",
new Object[] {String.valueOf(window), String.valueOf(old_state)});
}
window.setNETWMState(old_state); window.setNETWMState(old_state);
} }
...@@ -180,7 +187,11 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt ...@@ -180,7 +187,11 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
req.set_data(1, state.getAtom()); req.set_data(1, state.getAtom());
// Fix for 6735584: req.data[2] must be set to 0 when only one property is changed // Fix for 6735584: req.data[2] must be set to 0 when only one property is changed
req.set_data(2, 0); req.set_data(2, 0);
log.log(Level.FINE, "Setting _NET_STATE atom {0} on {1} for {2}", new Object[] {state, window, Boolean.valueOf(isAdd)}); if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "Setting _NET_STATE atom {0} on {1} for {2}",
new Object[] {String.valueOf(state), String.valueOf(window),
Boolean.valueOf(isAdd)});
}
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XlibWrapper.XSendEvent(XToolkit.getDisplay(),
...@@ -212,13 +223,19 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt ...@@ -212,13 +223,19 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
requestState(window, state, set); requestState(window, state, set);
} else { } else {
XAtomList net_wm_state = window.getNETWMState(); XAtomList net_wm_state = window.getNETWMState();
log.log(Level.FINE, "Current state on {0} is {1}", new Object[] {window, net_wm_state}); if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "Current state on {0} is {1}",
new Object[] {String.valueOf(window), net_wm_state});
}
if (!set) { if (!set) {
net_wm_state.remove(state); net_wm_state.remove(state);
} else { } else {
net_wm_state.add(state); net_wm_state.add(state);
} }
log.log(Level.FINE, "Setting states on {0} to {1}", new Object[] {window, net_wm_state}); if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "Setting states on {0} to {1}",
new Object[] {String.valueOf(window), net_wm_state});
}
window.setNETWMState(net_wm_state); window.setNETWMState(net_wm_state);
} }
XToolkit.XSync(); XToolkit.XSync();
......
...@@ -54,7 +54,11 @@ class XProtocol { ...@@ -54,7 +54,11 @@ class XProtocol {
} finally { } finally {
if (firstCheck) { if (firstCheck) {
firstCheck = false; firstCheck = false;
log.log(Level.FINE, "{0}:{1} supports {2}", new Object[] {this, listName, protocols}); if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "{0}:{1} supports {2}",
new Object[] {String.valueOf(this), String.valueOf(listName),
String.valueOf(protocols)});
}
} }
} }
} }
......
...@@ -32,7 +32,6 @@ import java.util.logging.*; ...@@ -32,7 +32,6 @@ import java.util.logging.*;
public class XQueryTree { public class XQueryTree {
private static Unsafe unsafe = XlibWrapper.unsafe; private static Unsafe unsafe = XlibWrapper.unsafe;
private static final Logger log = Logger.getLogger("sun.awt.X11.XQueryTree");
private boolean __executed = false; private boolean __executed = false;
long _w; long _w;
long root_ptr = unsafe.allocateMemory(Native.getLongSize()); long root_ptr = unsafe.allocateMemory(Native.getLongSize());
......
...@@ -624,7 +624,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable { ...@@ -624,7 +624,7 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
} }
if (eventLog.isLoggable(Level.FINER)) { if (eventLog.isLoggable(Level.FINER)) {
eventLog.log(Level.FINER, "{0}", ev); eventLog.log(Level.FINER, "{0}", String.valueOf(ev));
} }
// Check if input method consumes the event // Check if input method consumes the event
...@@ -1837,8 +1837,10 @@ public final class XToolkit extends UNIXToolkit implements Runnable { ...@@ -1837,8 +1837,10 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
if (timeoutTaskLog.isLoggable(Level.FINER)) { if (timeoutTaskLog.isLoggable(Level.FINER)) {
timeoutTaskLog.log(Level.FINER, "XToolkit.schedule(): current time={0}" + timeoutTaskLog.log(Level.FINER, "XToolkit.schedule(): current time={0}" +
"; interval={1}" + "; interval={1}" +
"; task being added={2}" + "; tasks before addition={3}", new Object[] { "; task being added={2}" + "; tasks before addition={3}",
Long.valueOf(System.currentTimeMillis()), Long.valueOf(interval), task, timeoutTasks}); new Object[] {Long.valueOf(System.currentTimeMillis()),
Long.valueOf(interval), String.valueOf(task),
String.valueOf(timeoutTasks)});
} }
if (timeoutTasks == null) { if (timeoutTasks == null) {
...@@ -1883,7 +1885,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable { ...@@ -1883,7 +1885,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
private static void callTimeoutTasks() { private static void callTimeoutTasks() {
if (timeoutTaskLog.isLoggable(Level.FINER)) { if (timeoutTaskLog.isLoggable(Level.FINER)) {
timeoutTaskLog.log(Level.FINER, "XToolkit.callTimeoutTasks(): current time={0}" + timeoutTaskLog.log(Level.FINER, "XToolkit.callTimeoutTasks(): current time={0}" +
"; tasks={1}", new Object[] {Long.valueOf(System.currentTimeMillis()), timeoutTasks}); "; tasks={1}",
new Object[] {Long.valueOf(System.currentTimeMillis()), String.valueOf(timeoutTasks)});
} }
if (timeoutTasks == null || timeoutTasks.isEmpty()) { if (timeoutTasks == null || timeoutTasks.isEmpty()) {
...@@ -1901,7 +1904,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable { ...@@ -1901,7 +1904,8 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
if (timeoutTaskLog.isLoggable(Level.FINER)) { if (timeoutTaskLog.isLoggable(Level.FINER)) {
timeoutTaskLog.log(Level.FINER, "XToolkit.callTimeoutTasks(): current time={0}" + timeoutTaskLog.log(Level.FINER, "XToolkit.callTimeoutTasks(): current time={0}" +
"; about to run task={1}", new Object[] {Long.valueOf(currentTime), task}); "; about to run task={1}",
new Object[] {Long.valueOf(currentTime), String.valueOf(task)});
} }
try { try {
...@@ -2358,7 +2362,10 @@ public final class XToolkit extends UNIXToolkit implements Runnable { ...@@ -2358,7 +2362,10 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
// Wait for selection notify for oops on win // Wait for selection notify for oops on win
long event_number = getEventNumber(); long event_number = getEventNumber();
XAtom atom = XAtom.get("WM_S0"); XAtom atom = XAtom.get("WM_S0");
eventLog.log(Level.FINER, "WM_S0 selection owner {0}", new Object[] {XlibWrapper.XGetSelectionOwner(getDisplay(), atom.getAtom())}); if (eventLog.isLoggable(Level.FINER)) {
eventLog.log(Level.FINER, "WM_S0 selection owner {0}",
new Object[] {String.valueOf(XlibWrapper.XGetSelectionOwner(getDisplay(), atom.getAtom()))});
}
XlibWrapper.XConvertSelection(getDisplay(), atom.getAtom(), XlibWrapper.XConvertSelection(getDisplay(), atom.getAtom(),
XAtom.get("VERSION").getAtom(), oops.getAtom(), XAtom.get("VERSION").getAtom(), oops.getAtom(),
win.getWindow(), XConstants.CurrentTime); win.getWindow(), XConstants.CurrentTime);
......
...@@ -129,14 +129,17 @@ public class XTrayIconPeer implements TrayIconPeer, ...@@ -129,14 +129,17 @@ public class XTrayIconPeer implements TrayIconPeer,
// If both the height and the width differ from the fixed size then WM // If both the height and the width differ from the fixed size then WM
// must level at least one side to the fixed size. For some reason it may take // must level at least one side to the fixed size. For some reason it may take
// a few hops (even after reparenting) and we have to skip the intermediate ones. // a few hops (even after reparenting) and we have to skip the intermediate ones.
ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Skipping as intermediate resizing.", if (ctrLog.isLoggable(Level.FINE)) {
XTrayIconPeer.this); ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Skipping as intermediate resizing.",
String.valueOf(XTrayIconPeer.this));
}
return; return;
} else if (ce.get_height() > TRAY_ICON_HEIGHT) { } else if (ce.get_height() > TRAY_ICON_HEIGHT) {
if (ctrLog.isLoggable(Level.FINE)) {
ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Centering by \"Y\".", ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Centering by \"Y\".",
XTrayIconPeer.this); String.valueOf(XTrayIconPeer.this));
}
XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), eframeParentID, XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), eframeParentID,
ce.get_x(), ce.get_x(),
...@@ -147,9 +150,10 @@ public class XTrayIconPeer implements TrayIconPeer, ...@@ -147,9 +150,10 @@ public class XTrayIconPeer implements TrayIconPeer,
ex_width = 0; ex_width = 0;
} else if (ce.get_width() > TRAY_ICON_WIDTH) { } else if (ce.get_width() > TRAY_ICON_WIDTH) {
if (ctrLog.isLoggable(Level.FINE)) {
ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Centering by \"X\".", ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Centering by \"X\".",
XTrayIconPeer.this); String.valueOf(XTrayIconPeer.this));
}
XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), eframeParentID, XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), eframeParentID,
ce.get_x()+ce.get_width()/2 - TRAY_ICON_WIDTH/2, ce.get_x()+ce.get_width()/2 - TRAY_ICON_WIDTH/2,
...@@ -165,25 +169,32 @@ public class XTrayIconPeer implements TrayIconPeer, ...@@ -165,25 +169,32 @@ public class XTrayIconPeer implements TrayIconPeer,
// In this case the parent window also lose centering. We have to restore it. // In this case the parent window also lose centering. We have to restore it.
if (ex_height != 0) { if (ex_height != 0) {
if (ctrLog.isLoggable(Level.FINE)) {
ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Move detected. Centering by \"Y\".", ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}." +
XTrayIconPeer.this); " Move detected. Centering by \"Y\".",
String.valueOf(XTrayIconPeer.this));
}
XlibWrapper.XMoveWindow(XToolkit.getDisplay(), eframeParentID, XlibWrapper.XMoveWindow(XToolkit.getDisplay(), eframeParentID,
ce.get_x(), ce.get_x(),
ce.get_y() + ex_height/2 - TRAY_ICON_HEIGHT/2); ce.get_y() + ex_height/2 - TRAY_ICON_HEIGHT/2);
} else if (ex_width != 0) { } else if (ex_width != 0) {
if (ctrLog.isLoggable(Level.FINE)) {
ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Move detected. Centering by \"X\".", ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}." +
XTrayIconPeer.this); "Move detected. Centering by \"X\".",
String.valueOf(XTrayIconPeer.this));
}
XlibWrapper.XMoveWindow(XToolkit.getDisplay(), eframeParentID, XlibWrapper.XMoveWindow(XToolkit.getDisplay(), eframeParentID,
ce.get_x() + ex_width/2 - TRAY_ICON_WIDTH/2, ce.get_x() + ex_width/2 - TRAY_ICON_WIDTH/2,
ce.get_y()); ce.get_y());
} else { } else {
ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}. Move detected. Skipping.", if (ctrLog.isLoggable(Level.FINE)) {
XTrayIconPeer.this); ctrLog.log(Level.FINE, "ConfigureNotify on parent of {0}." +
"Move detected. Skipping.",
String.valueOf(XTrayIconPeer.this));
}
} }
} }
old_x = ce.get_x(); old_x = ce.get_x();
......
...@@ -401,7 +401,10 @@ final class XWM ...@@ -401,7 +401,10 @@ final class XWM
static boolean isCDE() { static boolean isCDE() {
if (!XA_DT_SM_WINDOW_INFO.isInterned()) { if (!XA_DT_SM_WINDOW_INFO.isInterned()) {
log.log(Level.FINER, "{0} is not interned", new Object[] {XA_DT_SM_WINDOW_INFO}); if (log.isLoggable(Level.FINER)) {
log.log(Level.FINER, "{0} is not interned",
new Object[] {String.valueOf(XA_DT_SM_WINDOW_INFO)});
}
return false; return false;
} }
...@@ -432,7 +435,10 @@ final class XWM ...@@ -432,7 +435,10 @@ final class XWM
/* Now check that this window has _DT_SM_STATE_INFO (ignore contents) */ /* Now check that this window has _DT_SM_STATE_INFO (ignore contents) */
if (!XA_DT_SM_STATE_INFO.isInterned()) { if (!XA_DT_SM_STATE_INFO.isInterned()) {
log.log(Level.FINER, "{0} is not interned", new Object[] {XA_DT_SM_STATE_INFO}); if (log.isLoggable(Level.FINER)) {
log.log(Level.FINER, "{0} is not interned",
new Object[] {String.valueOf(XA_DT_SM_STATE_INFO)});
}
return false; return false;
} }
WindowPropertyGetter getter2 = WindowPropertyGetter getter2 =
...@@ -596,7 +602,10 @@ final class XWM ...@@ -596,7 +602,10 @@ final class XWM
*/ */
if (!XA_ICEWM_WINOPTHINT.isInterned()) { if (!XA_ICEWM_WINOPTHINT.isInterned()) {
log.log(Level.FINER, "{0} is not interned", new Object[] {XA_ICEWM_WINOPTHINT}); if (log.isLoggable(Level.FINER)) {
log.log(Level.FINER, "{0} is not interned",
String.valueOf(XA_ICEWM_WINOPTHINT));
}
return false; return false;
} }
...@@ -629,7 +638,10 @@ final class XWM ...@@ -629,7 +638,10 @@ final class XWM
*/ */
static boolean isIceWM() { static boolean isIceWM() {
if (!XA_ICEWM_WINOPTHINT.isInterned()) { if (!XA_ICEWM_WINOPTHINT.isInterned()) {
log.log(Level.FINER, "{0} is not interned", new Object[] {XA_ICEWM_WINOPTHINT}); if (log.isLoggable(Level.FINER)) {
log.log(Level.FINER, "{0} is not interned",
new Object[] {String.valueOf(XA_ICEWM_WINOPTHINT)});
}
return false; return false;
} }
...@@ -1354,7 +1366,9 @@ final class XWM ...@@ -1354,7 +1366,9 @@ final class XWM
XNETProtocol net_protocol = getWM().getNETProtocol(); XNETProtocol net_protocol = getWM().getNETProtocol();
if (net_protocol != null && net_protocol.active()) { if (net_protocol != null && net_protocol.active()) {
Insets insets = getInsetsFromProp(window, XA_NET_FRAME_EXTENTS); Insets insets = getInsetsFromProp(window, XA_NET_FRAME_EXTENTS);
insLog.log(Level.FINE, "_NET_FRAME_EXTENTS: {0}", insets); if (insLog.isLoggable(Level.FINE)) {
insLog.log(Level.FINE, "_NET_FRAME_EXTENTS: {0}", String.valueOf(insets));
}
if (insets != null) { if (insets != null) {
return insets; return insets;
...@@ -1495,7 +1509,10 @@ final class XWM ...@@ -1495,7 +1509,10 @@ final class XWM
* [mwm, e!, kwin, fvwm2 ... ] * [mwm, e!, kwin, fvwm2 ... ]
*/ */
Insets correctWM = XWM.getInsetsFromExtents(window); Insets correctWM = XWM.getInsetsFromExtents(window);
insLog.log(Level.FINER, "Got insets from property: {0}", correctWM); if (insLog.isLoggable(Level.FINER)) {
insLog.log(Level.FINER, "Got insets from property: {0}",
String.valueOf(correctWM));
}
if (correctWM == null) { if (correctWM == null) {
correctWM = new Insets(0,0,0,0); correctWM = new Insets(0,0,0,0);
...@@ -1556,7 +1573,10 @@ final class XWM ...@@ -1556,7 +1573,10 @@ final class XWM
} }
case XWM.OTHER_WM: case XWM.OTHER_WM:
default: { /* this is very similar to the E! case above */ default: { /* this is very similar to the E! case above */
insLog.log(Level.FINEST, "Getting correct insets for OTHER_WM/default, parent: {0}", parent); if (insLog.isLoggable(Level.FINEST)) {
insLog.log(Level.FINEST, "Getting correct insets for OTHER_WM/default, parent: {0}",
String.valueOf(parent));
}
syncTopLevelPos(parent, lwinAttr); syncTopLevelPos(parent, lwinAttr);
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(), int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
window, lwinAttr.pData); window, lwinAttr.pData);
...@@ -1583,8 +1603,11 @@ final class XWM ...@@ -1583,8 +1603,11 @@ final class XWM
&& lwinAttr.get_width()+2*lwinAttr.get_border_width() == pattr.get_width() && lwinAttr.get_width()+2*lwinAttr.get_border_width() == pattr.get_width()
&& lwinAttr.get_height()+2*lwinAttr.get_border_width() == pattr.get_height()) && lwinAttr.get_height()+2*lwinAttr.get_border_width() == pattr.get_height())
{ {
insLog.log(Level.FINEST, "Double reparenting detected, pattr({2})={0}, lwinAttr({3})={1}", if (insLog.isLoggable(Level.FINEST)) {
new Object[] {lwinAttr, pattr, parent, window}); insLog.log(Level.FINEST, "Double reparenting detected, pattr({2})={0}, lwinAttr({3})={1}",
new Object[] {String.valueOf(lwinAttr), String.valueOf(pattr),
String.valueOf(parent), String.valueOf(window)});
}
lwinAttr.set_x(pattr.get_x()); lwinAttr.set_x(pattr.get_x());
lwinAttr.set_y(pattr.get_y()); lwinAttr.set_y(pattr.get_y());
lwinAttr.set_border_width(lwinAttr.get_border_width()+pattr.get_border_width()); lwinAttr.set_border_width(lwinAttr.get_border_width()+pattr.get_border_width());
...@@ -1611,8 +1634,11 @@ final class XWM ...@@ -1611,8 +1634,11 @@ final class XWM
* widths and inner/outer distinction, so for the time * widths and inner/outer distinction, so for the time
* being, just ignore it. * being, just ignore it.
*/ */
insLog.log(Level.FINEST, "Attrs before calculation: pattr({2})={0}, lwinAttr({3})={1}", if (insLog.isLoggable(Level.FINEST)) {
new Object[] {lwinAttr, pattr, parent, window}); insLog.log(Level.FINEST, "Attrs before calculation: pattr({2})={0}, lwinAttr({3})={1}",
new Object[] {String.valueOf(lwinAttr), String.valueOf(pattr),
String.valueOf(parent), String.valueOf(window)});
}
correctWM = new Insets(lwinAttr.get_y() + lwinAttr.get_border_width(), correctWM = new Insets(lwinAttr.get_y() + lwinAttr.get_border_width(),
lwinAttr.get_x() + lwinAttr.get_border_width(), lwinAttr.get_x() + lwinAttr.get_border_width(),
pattr.get_height() - (lwinAttr.get_y() + lwinAttr.get_height() + 2*lwinAttr.get_border_width()), pattr.get_height() - (lwinAttr.get_y() + lwinAttr.get_height() + 2*lwinAttr.get_border_width()),
......
...@@ -997,8 +997,10 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -997,8 +997,10 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
Rectangle oldBounds = getBounds(); Rectangle oldBounds = getBounds();
super.handleConfigureNotifyEvent(xev); super.handleConfigureNotifyEvent(xev);
insLog.log(Level.FINER, "Configure, {0}, event disabled: {1}", if (insLog.isLoggable(Level.FINER)) {
new Object[] {xev.get_xconfigure(), isEventDisabled(xev)}); insLog.log(Level.FINER, "Configure, {0}, event disabled: {1}",
new Object[] {String.valueOf(xev.get_xconfigure()), isEventDisabled(xev)});
}
if (isEventDisabled(xev)) { if (isEventDisabled(xev)) {
return; return;
} }
...@@ -1017,7 +1019,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -1017,7 +1019,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
public void handleMapNotifyEvent(XEvent xev) { public void handleMapNotifyEvent(XEvent xev) {
super.handleMapNotifyEvent(xev); super.handleMapNotifyEvent(xev);
log.log(Level.FINE, "Mapped {0}", new Object[] {this}); if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "Mapped {0}", new Object[] {String.valueOf(this)});
}
if (isEventDisabled(xev)) { if (isEventDisabled(xev)) {
return; return;
} }
...@@ -1333,10 +1337,16 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -1333,10 +1337,16 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
void updateSizeHints(int x, int y, int width, int height) { void updateSizeHints(int x, int y, int width, int height) {
long flags = XUtilConstants.PSize | (isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition)); long flags = XUtilConstants.PSize | (isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition));
if (!isResizable()) { if (!isResizable()) {
log.log(Level.FINER, "Window {0} is not resizable", new Object[] {this}); if (log.isLoggable(Level.FINER)) {
log.log(Level.FINER, "Window {0} is not resizable",
new Object[] {String.valueOf(this)});
}
flags |= XUtilConstants.PMinSize | XUtilConstants.PMaxSize; flags |= XUtilConstants.PMinSize | XUtilConstants.PMaxSize;
} else { } else {
log.log(Level.FINER, "Window {0} is resizable", new Object[] {this}); if (keyEventLog.isLoggable(Level.FINER)) {
log.log(Level.FINER, "Window {0} is resizable",
new Object[] {String.valueOf(this)});
}
} }
setSizeHints(flags, x, y, width, height); setSizeHints(flags, x, y, width, height);
} }
...@@ -1344,10 +1354,16 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ...@@ -1344,10 +1354,16 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
void updateSizeHints(int x, int y) { void updateSizeHints(int x, int y) {
long flags = isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition); long flags = isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition);
if (!isResizable()) { if (!isResizable()) {
log.log(Level.FINER, "Window {0} is not resizable", new Object[] {this}); if (log.isLoggable(Level.FINER)) {
log.log(Level.FINER, "Window {0} is not resizable",
new Object[] {String.valueOf(this)});
}
flags |= XUtilConstants.PMinSize | XUtilConstants.PMaxSize | XUtilConstants.PSize; flags |= XUtilConstants.PMinSize | XUtilConstants.PMaxSize | XUtilConstants.PSize;
} else { } else {
log.log(Level.FINER, "Window {0} is resizable", new Object[] {this}); if (log.isLoggable(Level.FINER)) {
log.log(Level.FINER, "Window {0} is resizable",
new Object[] {String.valueOf(this)});
}
} }
setSizeHints(flags, x, y, width, height); setSizeHints(flags, x, y, width, height);
} }
......
...@@ -354,7 +354,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -354,7 +354,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
if (iconLog.isLoggable(Level.FINEST)) { if (iconLog.isLoggable(Level.FINEST)) {
iconLog.log(Level.FINEST, ">>> Sizes of icon images:"); iconLog.log(Level.FINEST, ">>> Sizes of icon images:");
for (Iterator<XIconInfo> i = icons.iterator(); i.hasNext(); ) { for (Iterator<XIconInfo> i = icons.iterator(); i.hasNext(); ) {
iconLog.log(Level.FINEST, " {0}", i.next()); iconLog.log(Level.FINEST, " {0}", String.valueOf(i.next()));
} }
} }
} }
...@@ -769,7 +769,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -769,7 +769,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
public void handleFocusEvent(XEvent xev) { public void handleFocusEvent(XEvent xev) {
XFocusChangeEvent xfe = xev.get_xfocus(); XFocusChangeEvent xfe = xev.get_xfocus();
FocusEvent fe; FocusEvent fe;
focusLog.log(Level.FINE, "{0}", new Object[] {xfe}); if (focusLog.isLoggable(Level.FINE)) {
focusLog.log(Level.FINE, "{0}", new Object[] {String.valueOf(xfe)});
}
if (isEventDisabled(xev)) { if (isEventDisabled(xev)) {
return; return;
} }
...@@ -1388,7 +1390,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -1388,7 +1390,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
synchronized(getStateLock()) { synchronized(getStateLock()) {
XDialogPeer blockerPeer = (XDialogPeer) ComponentAccessor.getPeer(d); XDialogPeer blockerPeer = (XDialogPeer) ComponentAccessor.getPeer(d);
if (blocked) { if (blocked) {
log.log(Level.FINE, "{0} is blocked by {1}", new Object[] { this, blockerPeer}); if (log.isLoggable(Level.FINE)) {
log.log(Level.FINE, "{0} is blocked by {1}",
new Object[] { String.valueOf(this), String.valueOf(blockerPeer)});
}
modalBlocker = d; modalBlocker = d;
if (isReparented() || XWM.isNonReparentingWM()) { if (isReparented() || XWM.isNonReparentingWM()) {
...@@ -1866,7 +1871,8 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -1866,7 +1871,8 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
XCrossingEvent xce = xev.get_xcrossing(); XCrossingEvent xce = xev.get_xcrossing();
if (grabLog.isLoggable(Level.FINE)) { if (grabLog.isLoggable(Level.FINE)) {
grabLog.log(Level.FINE, "{0}, when grabbed {1}, contains {2}", grabLog.log(Level.FINE, "{0}, when grabbed {1}, contains {2}",
new Object[] {xce, isGrabbed(), containsGlobal(xce.get_x_root(), xce.get_y_root())}); new Object[] {String.valueOf(xce), isGrabbed(),
containsGlobal(xce.get_x_root(), xce.get_y_root())});
} }
if (isGrabbed()) { if (isGrabbed()) {
// When window is grabbed, all events are dispatched to // When window is grabbed, all events are dispatched to
...@@ -1877,7 +1883,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -1877,7 +1883,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
// since it generates MOUSE_ENTERED/MOUSE_EXITED for frame and dialog. // since it generates MOUSE_ENTERED/MOUSE_EXITED for frame and dialog.
// (fix for 6390326) // (fix for 6390326)
XBaseWindow target = XToolkit.windowToXWindow(xce.get_window()); XBaseWindow target = XToolkit.windowToXWindow(xce.get_window());
grabLog.log(Level.FINER, " - Grab event target {0}", new Object[] {target}); if (grabLog.isLoggable(Level.FINER)) {
grabLog.log(Level.FINER, " - Grab event target {0}",
new Object[] {String.valueOf(target)});
}
if (target != null && target != this) { if (target != null && target != this) {
target.dispatchEvent(xev); target.dispatchEvent(xev);
return; return;
...@@ -1890,7 +1899,8 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -1890,7 +1899,8 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
XMotionEvent xme = xev.get_xmotion(); XMotionEvent xme = xev.get_xmotion();
if (grabLog.isLoggable(Level.FINE)) { if (grabLog.isLoggable(Level.FINE)) {
grabLog.log(Level.FINER, "{0}, when grabbed {1}, contains {2}", grabLog.log(Level.FINER, "{0}, when grabbed {1}, contains {2}",
new Object[] {xme, isGrabbed(), containsGlobal(xme.get_x_root(), xme.get_y_root())}); new Object[] {String.valueOf(xme), isGrabbed(),
containsGlobal(xme.get_x_root(), xme.get_y_root())});
} }
if (isGrabbed()) { if (isGrabbed()) {
boolean dragging = false; boolean dragging = false;
...@@ -1919,7 +1929,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -1919,7 +1929,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
xme.set_x(localCoord.x); xme.set_x(localCoord.x);
xme.set_y(localCoord.y); xme.set_y(localCoord.y);
} }
grabLog.log(Level.FINER, " - Grab event target {0}", new Object[] {target}); if (grabLog.isLoggable(Level.FINER)) {
grabLog.log(Level.FINER, " - Grab event target {0}",
new Object[] {String.valueOf(target)});
}
if (target != null) { if (target != null) {
if (target != getContentXWindow() && target != this) { if (target != getContentXWindow() && target != this) {
target.dispatchEvent(xev); target.dispatchEvent(xev);
...@@ -1953,7 +1966,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -1953,7 +1966,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
} }
if (grabLog.isLoggable(Level.FINE)) { if (grabLog.isLoggable(Level.FINE)) {
grabLog.log(Level.FINE, "{0}, when grabbed {1}, contains {2} ({3}, {4}, {5}x{6})", grabLog.log(Level.FINE, "{0}, when grabbed {1}, contains {2} ({3}, {4}, {5}x{6})",
new Object[] {xbe, isGrabbed(), containsGlobal(xbe.get_x_root(), xbe.get_y_root()), getAbsoluteX(), getAbsoluteY(), getWidth(), getHeight()}); new Object[] {String.valueOf(xbe), isGrabbed(),
containsGlobal(xbe.get_x_root(), xbe.get_y_root()),
getAbsoluteX(), getAbsoluteY(), getWidth(), getHeight()});
} }
if (isGrabbed()) { if (isGrabbed()) {
// When window is grabbed, all events are dispatched to // When window is grabbed, all events are dispatched to
...@@ -1962,7 +1977,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -1962,7 +1977,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
// translation) // translation)
XBaseWindow target = XToolkit.windowToXWindow(xbe.get_window()); XBaseWindow target = XToolkit.windowToXWindow(xbe.get_window());
try { try {
grabLog.log(Level.FINER, " - Grab event target {0} (press target {1})", new Object[] {target, pressTarget}); if (grabLog.isLoggable(Level.FINER)) {
grabLog.log(Level.FINER, " - Grab event target {0} (press target {1})",
new Object[] {String.valueOf(target), String.valueOf(pressTarget)});
}
if (xbe.get_type() == XConstants.ButtonPress if (xbe.get_type() == XConstants.ButtonPress
&& xbe.get_button() == XConstants.buttons[0]) && xbe.get_button() == XConstants.buttons[0])
{ {
...@@ -1995,7 +2013,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -1995,7 +2013,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
// Outside this toplevel hierarchy // Outside this toplevel hierarchy
// According to the specification of UngrabEvent, post it // According to the specification of UngrabEvent, post it
// when press occurs outside of the window and not on its owned windows // when press occurs outside of the window and not on its owned windows
grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because not inside of shell", this); if (grabLog.isLoggable(Level.FINE)) {
grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because not inside of shell",
String.valueOf(this));
}
postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource())); postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
return; return;
} }
...@@ -2013,18 +2034,27 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, ...@@ -2013,18 +2034,27 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
// toplevel == null - outside of // toplevel == null - outside of
// hierarchy, toplevel is Dialog - should // hierarchy, toplevel is Dialog - should
// send ungrab (but shouldn't for Window) // send ungrab (but shouldn't for Window)
grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because hierarchy ended", this); if (grabLog.isLoggable(Level.FINE)) {
grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because hierarchy ended",
String.valueOf(this));
}
postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource())); postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
} }
} else { } else {
// toplevel is null - outside of hierarchy // toplevel is null - outside of hierarchy
grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because toplevel is null", this); if (grabLog.isLoggable(Level.FINE)) {
grabLog.log(Level.FINE, "Generating UngrabEvent on {0} because toplevel is null",
String.valueOf(this));
}
postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource())); postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
return; return;
} }
} else { } else {
// target doesn't map to XAWT window - outside of hierarchy // target doesn't map to XAWT window - outside of hierarchy
grabLog.log(Level.FINE, "Generating UngrabEvent on because target is null {0}", this); if (grabLog.isLoggable(Level.FINE)) {
grabLog.log(Level.FINE, "Generating UngrabEvent on because target is null {0}",
String.valueOf(this));
}
postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource())); postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
return; return;
} }
......
...@@ -35,7 +35,7 @@ import java.util.logging.Logger; ...@@ -35,7 +35,7 @@ import java.util.logging.Logger;
import java.util.logging.Level; import java.util.logging.Level;
class WMenuItemPeer extends WObjectPeer implements MenuItemPeer { class WMenuItemPeer extends WObjectPeer implements MenuItemPeer {
private static final Logger log = Logger.getLogger("sun.awt.WMenuItemPeer"); private static final Logger log = Logger.getLogger("sun.awt.windows.WMenuItemPeer");
static { static {
initIDs(); initIDs();
......
...@@ -34,7 +34,6 @@ import java.util.logging.*; ...@@ -34,7 +34,6 @@ import java.util.logging.*;
class WPanelPeer extends WCanvasPeer implements PanelPeer { class WPanelPeer extends WCanvasPeer implements PanelPeer {
private static final Logger log = Logger.getLogger("sun.awt.windows.WPanelPeer");
// ComponentPeer overrides // ComponentPeer overrides
public void paint(Graphics g) { public void paint(Graphics g) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册