diff --git a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java index d50335f7cd5..9d1c9265989 100644 --- a/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java +++ b/jdk/src/macosx/classes/sun/lwawt/LWWindowPeer.java @@ -1152,7 +1152,9 @@ public class LWWindowPeer if (!becomesFocused && (isGrabbing() || getOwnerFrameDialog(grabbingWindow) == this)) { - focusLog.fine("ungrabbing on " + grabbingWindow); + if (focusLog.isLoggable(PlatformLogger.FINE)) { + focusLog.fine("ungrabbing on " + grabbingWindow); + } // ungrab a simple window if its owner looses activation. grabbingWindow.ungrab(); } diff --git a/jdk/src/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java b/jdk/src/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java index 468faf2edc7..e2b846285eb 100644 --- a/jdk/src/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java +++ b/jdk/src/share/classes/java/awt/ContainerOrderFocusTraversalPolicy.java @@ -208,7 +208,9 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy * aComponent is null */ public Component getComponentAfter(Container aContainer, Component aComponent) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Searching in " + aContainer + " for component after " + aComponent); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### Searching in " + aContainer + " for component after " + aComponent); + } if (aContainer == null || aComponent == null) { throw new IllegalArgumentException("aContainer and aComponent cannot be null"); @@ -247,7 +249,9 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy // Null result means that we overstepped the limit of the FTP's cycle. // In that case we must quit the cycle, otherwise return the component found. if (afterComp != null) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### FTP returned " + afterComp); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### FTP returned " + afterComp); + } return afterComp; } aComponent = provider; @@ -255,7 +259,9 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy List cycle = getFocusTraversalCycle(aContainer); - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is " + cycle + ", component is " + aComponent); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### Cycle is " + cycle + ", component is " + aComponent); + } int index = getComponentIndex(cycle, aComponent); @@ -336,7 +342,9 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy // Null result means that we overstepped the limit of the FTP's cycle. // In that case we must quit the cycle, otherwise return the component found. if (beforeComp != null) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### FTP returned " + beforeComp); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### FTP returned " + beforeComp); + } return beforeComp; } aComponent = provider; @@ -349,7 +357,9 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy List cycle = getFocusTraversalCycle(aContainer); - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is " + cycle + ", component is " + aComponent); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### Cycle is " + cycle + ", component is " + aComponent); + } int index = getComponentIndex(cycle, aComponent); @@ -401,7 +411,9 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy public Component getFirstComponent(Container aContainer) { List cycle; - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Getting first component in " + aContainer); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### Getting first component in " + aContainer); + } if (aContainer == null) { throw new IllegalArgumentException("aContainer cannot be null"); @@ -420,10 +432,14 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy } if (cycle.size() == 0) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is empty"); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### Cycle is empty"); + } return null; } - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is " + cycle); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### Cycle is " + cycle); + } for (Component comp : cycle) { if (accept(comp)) { @@ -451,7 +467,9 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy */ public Component getLastComponent(Container aContainer) { List cycle; - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Getting last component in " + aContainer); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### Getting last component in " + aContainer); + } if (aContainer == null) { throw new IllegalArgumentException("aContainer cannot be null"); @@ -470,10 +488,14 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy } if (cycle.size() == 0) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is empty"); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### Cycle is empty"); + } return null; } - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is " + cycle); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### Cycle is " + cycle); + } for (int i= cycle.size() - 1; i >= 0; i--) { Component comp = cycle.get(i); diff --git a/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java b/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java index d2d6bf3175f..68e1f52a221 100644 --- a/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java +++ b/jdk/src/share/classes/java/awt/DefaultKeyboardFocusManager.java @@ -310,7 +310,9 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { * false otherwise */ public boolean dispatchEvent(AWTEvent e) { - if (focusLog.isLoggable(PlatformLogger.FINE) && (e instanceof WindowEvent || e instanceof FocusEvent)) focusLog.fine("" + e); + if (focusLog.isLoggable(PlatformLogger.FINE) && (e instanceof WindowEvent || e instanceof FocusEvent)) { + focusLog.fine("" + e); + } switch (e.getID()) { case WindowEvent.WINDOW_GAINED_FOCUS: { if (repostIfFollowsKeyEvents((WindowEvent)e)) { @@ -871,7 +873,9 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { } } if (ke != null) { - focusLog.finer("Pumping approved event {0}", ke); + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer("Pumping approved event {0}", ke); + } enqueuedKeyEvents.removeFirst(); } } @@ -920,7 +924,9 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { // The fix is rolled out. if (ke.getWhen() > marker.after) { - focusLog.finer("Storing event {0} because of marker {1}", ke, marker); + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer("Storing event {0} because of marker {1}", ke, marker); + } enqueuedKeyEvents.addLast(ke); return true; } @@ -932,7 +938,9 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { } case FocusEvent.FOCUS_GAINED: - focusLog.finest("Markers before FOCUS_GAINED on {0}", target); + if (focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("Markers before FOCUS_GAINED on {0}", target); + } dumpMarkers(); // Search the marker list for the first marker tied to // the Component which just gained focus. Then remove @@ -959,7 +967,9 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { } } else { // Exception condition - event without marker - focusLog.finer("Event without marker {0}", e); + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer("Event without marker {0}", e); + } } } focusLog.finest("Markers after FOCUS_GAINED"); @@ -1198,8 +1208,10 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { return; } - focusLog.finer("Enqueue at {0} for {1}", + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer("Enqueue at {0} for {1}", after, untilFocused); + } int insertionIndex = 0, i = typeAheadMarkers.size(); @@ -1238,8 +1250,10 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager { return; } - focusLog.finer("Dequeue at {0} for {1}", + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer("Dequeue at {0} for {1}", after, untilFocused); + } TypeAheadMarker marker; ListIterator iter = typeAheadMarkers.listIterator diff --git a/jdk/src/share/classes/java/awt/EventDispatchThread.java b/jdk/src/share/classes/java/awt/EventDispatchThread.java index c707f02abdb..3260e37859e 100644 --- a/jdk/src/share/classes/java/awt/EventDispatchThread.java +++ b/jdk/src/share/classes/java/awt/EventDispatchThread.java @@ -138,7 +138,9 @@ class EventDispatchThread extends Thread { } void addEventFilter(EventFilter filter) { - eventLog.finest("adding the event filter: " + filter); + if (eventLog.isLoggable(PlatformLogger.FINEST)) { + eventLog.finest("adding the event filter: " + filter); + } synchronized (eventFilters) { if (!eventFilters.contains(filter)) { if (filter instanceof ModalEventFilter) { @@ -162,7 +164,9 @@ class EventDispatchThread extends Thread { } void removeEventFilter(EventFilter filter) { - eventLog.finest("removing the event filter: " + filter); + if (eventLog.isLoggable(PlatformLogger.FINEST)) { + eventLog.finest("removing the event filter: " + filter); + } synchronized (eventFilters) { eventFilters.remove(filter); } diff --git a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java index af9dcb1b2c2..1d1b78c6e10 100644 --- a/jdk/src/share/classes/java/awt/KeyboardFocusManager.java +++ b/jdk/src/share/classes/java/awt/KeyboardFocusManager.java @@ -2410,7 +2410,7 @@ public abstract class KeyboardFocusManager Window nativeFocusedWindow = thisManager.getNativeFocusedWindow(); if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("SNFH for {0} in {1}", - String.valueOf(descendant), String.valueOf(heavyweight)); + String.valueOf(descendant), String.valueOf(heavyweight)); } if (focusLog.isLoggable(PlatformLogger.FINEST)) { focusLog.finest("0. Current focus owner {0}", @@ -2478,9 +2478,10 @@ public abstract class KeyboardFocusManager manager.enqueueKeyEvents(time, descendant); } - if (focusLog.isLoggable(PlatformLogger.FINEST)) + if (focusLog.isLoggable(PlatformLogger.FINEST)) { focusLog.finest("3. SNFH_HANDLED for lightweight" + descendant + " in " + heavyweight); + } return SNFH_SUCCESS_HANDLED; } else { if (!focusedWindowChangeAllowed) { @@ -2501,8 +2502,9 @@ public abstract class KeyboardFocusManager (hwFocusRequest != null) ? hwFocusRequest.heavyweight : nativeFocusedWindow)) { - if (focusLog.isLoggable(PlatformLogger.FINEST)) + if (focusLog.isLoggable(PlatformLogger.FINEST)) { focusLog.finest("4. SNFH_FAILURE for " + descendant); + } return SNFH_FAILURE; } } @@ -2511,8 +2513,9 @@ public abstract class KeyboardFocusManager heavyweightRequests.add (new HeavyweightFocusRequest(heavyweight, descendant, temporary, cause)); - if (focusLog.isLoggable(PlatformLogger.FINEST)) + if (focusLog.isLoggable(PlatformLogger.FINEST)) { focusLog.finest("5. SNFH_PROCEED for " + descendant); + } return SNFH_SUCCESS_PROCEED; } } diff --git a/jdk/src/share/classes/java/awt/WaitDispatchSupport.java b/jdk/src/share/classes/java/awt/WaitDispatchSupport.java index bf77fa73a62..a93c50a19e2 100644 --- a/jdk/src/share/classes/java/awt/WaitDispatchSupport.java +++ b/jdk/src/share/classes/java/awt/WaitDispatchSupport.java @@ -165,8 +165,10 @@ class WaitDispatchSupport implements SecondaryLoop { */ @Override public boolean enter() { - log.fine("enter(): blockingEDT=" + keepBlockingEDT.get() + - ", blockingCT=" + keepBlockingCT.get()); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("enter(): blockingEDT=" + keepBlockingEDT.get() + + ", blockingCT=" + keepBlockingCT.get()); + } if (!keepBlockingEDT.compareAndSet(false, true)) { log.fine("The secondary loop is already running, aborting"); @@ -190,9 +192,13 @@ class WaitDispatchSupport implements SecondaryLoop { Thread currentThread = Thread.currentThread(); if (currentThread == dispatchThread) { - log.finest("On dispatch thread: " + dispatchThread); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("On dispatch thread: " + dispatchThread); + } if (interval != 0) { - log.finest("scheduling the timer for " + interval + " ms"); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("scheduling the timer for " + interval + " ms"); + } timer.schedule(timerTask = new TimerTask() { @Override public void run() { @@ -207,7 +213,9 @@ class WaitDispatchSupport implements SecondaryLoop { SequencedEvent currentSE = KeyboardFocusManager. getCurrentKeyboardFocusManager().getCurrentSequencedEvent(); if (currentSE != null) { - log.fine("Dispose current SequencedEvent: " + currentSE); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Dispose current SequencedEvent: " + currentSE); + } currentSE.dispose(); } // In case the exit() method is called before starting @@ -223,7 +231,9 @@ class WaitDispatchSupport implements SecondaryLoop { } }); } else { - log.finest("On non-dispatch thread: " + currentThread); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("On non-dispatch thread: " + currentThread); + } synchronized (getTreeLock()) { if (filter != null) { dispatchThread.addEventFilter(filter); @@ -247,9 +257,13 @@ class WaitDispatchSupport implements SecondaryLoop { getTreeLock().wait(); } } - log.fine("waitDone " + keepBlockingEDT.get() + " " + keepBlockingCT.get()); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("waitDone " + keepBlockingEDT.get() + " " + keepBlockingCT.get()); + } } catch (InterruptedException e) { - log.fine("Exception caught while waiting: " + e); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Exception caught while waiting: " + e); + } } finally { if (filter != null) { dispatchThread.removeEventFilter(filter); @@ -270,8 +284,10 @@ class WaitDispatchSupport implements SecondaryLoop { * @inheritDoc */ public boolean exit() { - log.fine("exit(): blockingEDT=" + keepBlockingEDT.get() + - ", blockingCT=" + keepBlockingCT.get()); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("exit(): blockingEDT=" + keepBlockingEDT.get() + + ", blockingCT=" + keepBlockingCT.get()); + } if (keepBlockingEDT.compareAndSet(true, false)) { wakeupEDT(); return true; @@ -295,7 +311,9 @@ class WaitDispatchSupport implements SecondaryLoop { }; private void wakeupEDT() { - log.finest("wakeupEDT(): EDT == " + dispatchThread); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("wakeupEDT(): EDT == " + dispatchThread); + } EventQueue eq = dispatchThread.getEventQueue(); eq.postEvent(new PeerEvent(this, wakingRunnable, PeerEvent.PRIORITY_EVENT)); } diff --git a/jdk/src/share/classes/javax/swing/BufferStrategyPaintManager.java b/jdk/src/share/classes/javax/swing/BufferStrategyPaintManager.java index 66c9baa02ae..577ddf0cf72 100644 --- a/jdk/src/share/classes/javax/swing/BufferStrategyPaintManager.java +++ b/jdk/src/share/classes/javax/swing/BufferStrategyPaintManager.java @@ -523,8 +523,7 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager { if (bufferStrategy.contentsRestored()) { contentsLost = true; if (LOGGER.isLoggable(PlatformLogger.FINER)) { - LOGGER.finer( - "prepare: contents restored in prepare"); + LOGGER.finer("prepare: contents restored in prepare"); } } } diff --git a/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java b/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java index 1595a272ecd..4a70270f23c 100644 --- a/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java +++ b/jdk/src/share/classes/javax/swing/SortingFocusTraversalPolicy.java @@ -271,7 +271,9 @@ public class SortingFocusTraversalPolicy // Null result means that we overstepped the limit of the FTP's cycle. // In that case we must quit the cycle, otherwise return the component found. if (afterComp != null) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### FTP returned " + afterComp); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### FTP returned " + afterComp); + } return afterComp; } aComponent = provider; @@ -279,7 +281,9 @@ public class SortingFocusTraversalPolicy List cycle = getFocusTraversalCycle(aContainer); - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is " + cycle + ", component is " + aComponent); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### Cycle is " + cycle + ", component is " + aComponent); + } int index = getComponentIndex(cycle, aComponent); @@ -360,7 +364,9 @@ public class SortingFocusTraversalPolicy // Null result means that we overstepped the limit of the FTP's cycle. // In that case we must quit the cycle, otherwise return the component found. if (beforeComp != null) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### FTP returned " + beforeComp); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### FTP returned " + beforeComp); + } return beforeComp; } aComponent = provider; @@ -373,7 +379,9 @@ public class SortingFocusTraversalPolicy List cycle = getFocusTraversalCycle(aContainer); - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is " + cycle + ", component is " + aComponent); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### Cycle is " + cycle + ", component is " + aComponent); + } int index = getComponentIndex(cycle, aComponent); @@ -424,7 +432,9 @@ public class SortingFocusTraversalPolicy public Component getFirstComponent(Container aContainer) { List cycle; - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Getting first component in " + aContainer); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### Getting first component in " + aContainer); + } if (aContainer == null) { throw new IllegalArgumentException("aContainer cannot be null"); } @@ -436,10 +446,14 @@ public class SortingFocusTraversalPolicy } if (cycle.size() == 0) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is empty"); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### Cycle is empty"); + } return null; } - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is " + cycle); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### Cycle is " + cycle); + } for (Component comp : cycle) { if (accept(comp)) { @@ -466,7 +480,9 @@ public class SortingFocusTraversalPolicy */ public Component getLastComponent(Container aContainer) { List cycle; - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Getting last component in " + aContainer); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### Getting last component in " + aContainer); + } if (aContainer == null) { throw new IllegalArgumentException("aContainer cannot be null"); @@ -479,10 +495,14 @@ public class SortingFocusTraversalPolicy } if (cycle.size() == 0) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is empty"); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### Cycle is empty"); + } return null; } - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### Cycle is " + cycle); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### Cycle is " + cycle); + } for (int i= cycle.size() - 1; i >= 0; i--) { Component comp = cycle.get(i); diff --git a/jdk/src/share/classes/sun/awt/AWTAutoShutdown.java b/jdk/src/share/classes/sun/awt/AWTAutoShutdown.java index 81e351b099c..8c6ae9ad0fb 100644 --- a/jdk/src/share/classes/sun/awt/AWTAutoShutdown.java +++ b/jdk/src/share/classes/sun/awt/AWTAutoShutdown.java @@ -375,11 +375,13 @@ public final class AWTAutoShutdown implements Runnable { } final void dumpPeers(final PlatformLogger aLog) { - synchronized (activationLock) { - synchronized (mainLock) { - aLog.fine("Mapped peers:"); - for (Object key : peerMap.keySet()) { - aLog.fine(key + "->" + peerMap.get(key)); + if (aLog.isLoggable(PlatformLogger.FINE)) { + synchronized (activationLock) { + synchronized (mainLock) { + aLog.fine("Mapped peers:"); + for (Object key : peerMap.keySet()) { + aLog.fine(key + "->" + peerMap.get(key)); + } } } } diff --git a/jdk/src/share/classes/sun/awt/DebugSettings.java b/jdk/src/share/classes/sun/awt/DebugSettings.java index 9ee9d94d7ed..b4cd81ab0d7 100644 --- a/jdk/src/share/classes/sun/awt/DebugSettings.java +++ b/jdk/src/share/classes/sun/awt/DebugSettings.java @@ -129,7 +129,7 @@ final class DebugSettings { // echo the initial property settings to stdout if (log.isLoggable(PlatformLogger.FINE)) { - log.fine("DebugSettings:\n{0}" + this); + log.fine("DebugSettings:\n{0}", this); } } diff --git a/jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java b/jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java index 2e2350b1c4d..760a48bc76f 100644 --- a/jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java +++ b/jdk/src/share/classes/sun/awt/KeyboardFocusManagerPeerImpl.java @@ -57,8 +57,9 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag public void clearGlobalFocusOwner(Window activeWindow) { if (activeWindow != null) { Component focusOwner = activeWindow.getFocusOwner(); - if (focusLog.isLoggable(PlatformLogger.FINE)) + if (focusLog.isLoggable(PlatformLogger.FINE)) { focusLog.fine("Clearing global focus owner " + focusOwner); + } if (focusOwner != null) { FocusEvent fl = new CausedFocusEvent(focusOwner, FocusEvent.FOCUS_LOST, false, null, CausedFocusEvent.Cause.CLEAR_GLOBAL_FOCUS_OWNER); @@ -126,16 +127,18 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag FocusEvent fl = new CausedFocusEvent(currentOwner, FocusEvent.FOCUS_LOST, false, lightweightChild, cause); - if (focusLog.isLoggable(PlatformLogger.FINER)) + if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("Posting focus event: " + fl); + } SunToolkit.postEvent(SunToolkit.targetToAppContext(currentOwner), fl); } FocusEvent fg = new CausedFocusEvent(lightweightChild, FocusEvent.FOCUS_GAINED, false, currentOwner, cause); - if (focusLog.isLoggable(PlatformLogger.FINER)) + if (focusLog.isLoggable(PlatformLogger.FINER)) { focusLog.finer("Posting focus event: " + fg); + } SunToolkit.postEvent(SunToolkit.targetToAppContext(lightweightChild), fg); return true; } diff --git a/jdk/src/share/classes/sun/awt/SunToolkit.java b/jdk/src/share/classes/sun/awt/SunToolkit.java index 8fc568913fb..733d677aafe 100644 --- a/jdk/src/share/classes/sun/awt/SunToolkit.java +++ b/jdk/src/share/classes/sun/awt/SunToolkit.java @@ -487,7 +487,9 @@ public abstract class SunToolkit extends Toolkit setSystemGenerated(event); AppContext eventContext = targetToAppContext(event.getSource()); if (eventContext != null && !eventContext.equals(appContext)) { - log.fine("Event posted on wrong app context : " + event); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Event posted on wrong app context : " + event); + } } PostEventQueue postEventQueue = (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY); diff --git a/jdk/src/share/classes/sun/awt/im/InputContext.java b/jdk/src/share/classes/sun/awt/im/InputContext.java index 1eccb6aa792..7c6fb2043da 100644 --- a/jdk/src/share/classes/sun/awt/im/InputContext.java +++ b/jdk/src/share/classes/sun/awt/im/InputContext.java @@ -387,7 +387,9 @@ public class InputContext extends java.awt.im.InputContext } previousInputMethod = null; - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Current client component " + currentClientComponent); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Current client component " + currentClientComponent); + } if (inputMethod instanceof InputMethodAdapter) { ((InputMethodAdapter) inputMethod).setClientComponent(currentClientComponent); } @@ -884,14 +886,16 @@ public class InputContext extends java.awt.im.InputContext } private void logCreationFailed(Throwable throwable) { - String errorTextFormat = Toolkit.getProperty("AWT.InputMethodCreationFailed", - "Could not create {0}. Reason: {1}"); - Object[] args = - {inputMethodLocator.getDescriptor().getInputMethodDisplayName(null, Locale.getDefault()), - throwable.getLocalizedMessage()}; - MessageFormat mf = new MessageFormat(errorTextFormat); PlatformLogger logger = PlatformLogger.getLogger("sun.awt.im"); - logger.config(mf.format(args)); + if (logger.isLoggable(PlatformLogger.CONFIG)) { + String errorTextFormat = Toolkit.getProperty("AWT.InputMethodCreationFailed", + "Could not create {0}. Reason: {1}"); + Object[] args = + {inputMethodLocator.getDescriptor().getInputMethodDisplayName(null, Locale.getDefault()), + throwable.getLocalizedMessage()}; + MessageFormat mf = new MessageFormat(errorTextFormat); + logger.config(mf.format(args)); + } } InputMethodLocator getInputMethodLocator() { diff --git a/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java b/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java index 711a1b15a84..780e595da0b 100644 --- a/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java +++ b/jdk/src/share/classes/sun/net/www/protocol/http/HttpURLConnection.java @@ -2065,7 +2065,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection { ret = new NegotiateAuthentication(new HttpCallerInfo(authhdr.getHttpCallerInfo(), "Kerberos")); break; case UNKNOWN: - logger.finest("Unknown/Unsupported authentication scheme: " + scheme); + if (logger.isLoggable(PlatformLogger.FINEST)) { + logger.finest("Unknown/Unsupported authentication scheme: " + scheme); + } /*fall through*/ default: throw new AssertionError("should not reach here"); @@ -2222,7 +2224,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection { } break; case UNKNOWN: - logger.finest("Unknown/Unsupported authentication scheme: " + scheme); + if (logger.isLoggable(PlatformLogger.FINEST)) { + logger.finest("Unknown/Unsupported authentication scheme: " + scheme); + } /*fall through*/ default: throw new AssertionError("should not reach here"); diff --git a/jdk/src/share/classes/sun/net/www/protocol/http/NTLMAuthenticationProxy.java b/jdk/src/share/classes/sun/net/www/protocol/http/NTLMAuthenticationProxy.java index 5d656a0906b..96ede3e67f8 100644 --- a/jdk/src/share/classes/sun/net/www/protocol/http/NTLMAuthenticationProxy.java +++ b/jdk/src/share/classes/sun/net/www/protocol/http/NTLMAuthenticationProxy.java @@ -142,6 +142,8 @@ class NTLMAuthenticationProxy { static void finest(Exception e) { PlatformLogger logger = HttpURLConnection.getHttpLogger(); - logger.finest("NTLMAuthenticationProxy: " + e); + if (logger.isLoggable(PlatformLogger.FINEST)) { + logger.finest("NTLMAuthenticationProxy: " + e); + } } } diff --git a/jdk/src/share/classes/sun/net/www/protocol/http/Negotiator.java b/jdk/src/share/classes/sun/net/www/protocol/http/Negotiator.java index 32446f63f70..bd1c826c4c9 100644 --- a/jdk/src/share/classes/sun/net/www/protocol/http/Negotiator.java +++ b/jdk/src/share/classes/sun/net/www/protocol/http/Negotiator.java @@ -76,7 +76,9 @@ public abstract class Negotiator { private static void finest(Exception e) { PlatformLogger logger = HttpURLConnection.getHttpLogger(); - logger.finest("NegotiateAuthentication: " + e); + if (logger.isLoggable(PlatformLogger.FINEST)) { + logger.finest("NegotiateAuthentication: " + e); + } } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XAWTXSettings.java b/jdk/src/solaris/classes/sun/awt/X11/XAWTXSettings.java index e3403044fc5..4eeca362496 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XAWTXSettings.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XAWTXSettings.java @@ -55,7 +55,9 @@ class XAWTXSettings extends XSettings implements XMSelectionListener { } void initXSettings() { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Initializing XAWT XSettings"); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Initializing XAWT XSettings"); + } settings = new XMSelection("_XSETTINGS"); settings.addSelectionListener(this); initPerScreenXSettings(); @@ -66,21 +68,29 @@ class XAWTXSettings extends XSettings implements XMSelectionListener { } public void ownerDeath(int screen, XMSelection sel, long deadOwner) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Owner " + deadOwner + " died for selection " + sel + " screen "+ screen); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Owner " + deadOwner + " died for selection " + sel + " screen "+ screen); + } } public void ownerChanged(int screen, XMSelection sel, long newOwner, long data, long timestamp) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("New Owner "+ newOwner + " for selection = " + sel + " screen " +screen ); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("New Owner "+ newOwner + " for selection = " + sel + " screen " +screen ); + } } public void selectionChanged(int screen, XMSelection sel, long owner , XPropertyEvent event) { - log.fine("Selection changed on sel " + sel + " screen = " + screen + " owner = " + owner + " event = " + event); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Selection changed on sel " + sel + " screen = " + screen + " owner = " + owner + " event = " + event); + } updateXSettings(screen,owner); } void initPerScreenXSettings() { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Updating Per XSettings changes"); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Updating Per XSettings changes"); + } /* * As toolkit cannot yet cope with per-screen desktop properties, @@ -114,7 +124,9 @@ class XAWTXSettings extends XSettings implements XMSelectionListener { } private Map getUpdatedSettings(final long owner) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("owner =" + owner); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("owner =" + owner); + } if (0 == owner) { return null; } @@ -128,13 +140,17 @@ class XAWTXSettings extends XSettings implements XMSelectionListener { int status = getter.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance()); if (status != XConstants.Success || getter.getData() == 0) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("OH OH : getter failed status = " + status ); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("OH OH : getter failed status = " + status ); + } settings = null; } long ptr = getter.getData(); - if (log.isLoggable(PlatformLogger.FINE)) log.fine("noItems = " + getter.getNumberOfItems()); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("noItems = " + getter.getNumberOfItems()); + } byte array[] = Native.toBytes(ptr,getter.getNumberOfItems()); if (array != null) { settings = update(array); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java b/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java index 56d7a14e961..f0b1aef36cd 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XBaseMenuWindow.java @@ -426,7 +426,7 @@ abstract public class XBaseMenuWindow extends XWindow { try { synchronized(getMenuTreeLock()) { if (showingSubmenu != submenuToShow) { - if (log.isLoggable(PlatformLogger.FINER)) { + if (log.isLoggable(PlatformLogger.FINEST)) { log.finest("Changing showing submenu"); } if (showingSubmenu != null) { @@ -1122,7 +1122,9 @@ abstract public class XBaseMenuWindow extends XWindow { * that grabs input focus */ void doHandleJavaKeyEvent(KeyEvent event) { - if (log.isLoggable(PlatformLogger.FINER)) log.finer(event.toString()); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer(event.toString()); + } if (event.getID() != KeyEvent.KEY_PRESSED) { return; } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java b/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java index 72ca1b7aebe..b6f9f811c9d 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XBaseWindow.java @@ -160,7 +160,9 @@ public class XBaseWindow { * with class-specific values and perform post-initialization actions. */ void postInit(XCreateWindowParams params) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("WM name is " + getWMName()); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("WM name is " + getWMName()); + } updateWMName(); // Set WM_CLIENT_LEADER property @@ -480,7 +482,9 @@ public class XBaseWindow { } public void setSizeHints(long flags, int x, int y, int width, int height) { - if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(flags)); + if (insLog.isLoggable(PlatformLogger.FINER)) { + insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(flags)); + } XToolkit.awtLock(); try { XSizeHints hints = getHints(); @@ -541,8 +545,10 @@ public class XBaseWindow { flags |= XUtilConstants.PWinGravity; hints.set_flags(flags); hints.set_win_gravity((int)XConstants.NorthWestGravity); - if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Setting hints, resulted flags " + XlibWrapper.hintsToString(flags) + - ", values " + hints); + if (insLog.isLoggable(PlatformLogger.FINER)) { + insLog.finer("Setting hints, resulted flags " + XlibWrapper.hintsToString(flags) + + ", values " + hints); + } XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(), getWindow(), hints.pData); } finally { XToolkit.awtUnlock(); @@ -593,7 +599,9 @@ public class XBaseWindow { public void xRequestFocus(long time) { XToolkit.awtLock(); try { - if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer("XSetInputFocus on " + Long.toHexString(getWindow()) + " with time " + time); + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer("XSetInputFocus on " + Long.toHexString(getWindow()) + " with time " + time); + } XlibWrapper.XSetInputFocus2(XToolkit.getDisplay(), getWindow(), time); } finally { XToolkit.awtUnlock(); @@ -602,7 +610,9 @@ public class XBaseWindow { public void xRequestFocus() { XToolkit.awtLock(); try { - if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer("XSetInputFocus on " + Long.toHexString(getWindow())); + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer("XSetInputFocus on " + Long.toHexString(getWindow())); + } XlibWrapper.XSetInputFocus(XToolkit.getDisplay(), getWindow()); } finally { XToolkit.awtUnlock(); @@ -619,7 +629,9 @@ public class XBaseWindow { } public void xSetVisible(boolean visible) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting visible on " + this + " to " + visible); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Setting visible on " + this + " to " + visible); + } XToolkit.awtLock(); try { this.visible = visible; @@ -704,7 +716,9 @@ public class XBaseWindow { insLog.warning("Attempt to resize uncreated window"); throw new IllegalStateException("Attempt to resize uncreated window"); } - insLog.fine("Setting bounds on " + this + " to (" + x + ", " + y + "), " + width + "x" + height); + if (insLog.isLoggable(PlatformLogger.FINE)) { + insLog.fine("Setting bounds on " + this + " to (" + x + ", " + y + "), " + width + "x" + height); + } width = Math.max(MIN_SIZE, width); height = Math.max(MIN_SIZE, height); XToolkit.awtLock(); @@ -820,7 +834,9 @@ public class XBaseWindow { * The active grab overrides activated automatic grab. */ public boolean grabInput() { - grabLog.fine("Grab input on {0}", this); + if (grabLog.isLoggable(PlatformLogger.FINE)) { + grabLog.fine("Grab input on {0}", this); + } XToolkit.awtLock(); try { @@ -883,7 +899,9 @@ public class XBaseWindow { XToolkit.awtLock(); try { XBaseWindow grabWindow = XAwtState.getGrabWindow(); - grabLog.fine("UnGrab input on {0}", grabWindow); + if (grabLog.isLoggable(PlatformLogger.FINE)) { + grabLog.fine("UnGrab input on {0}", grabWindow); + } if (grabWindow != null) { grabWindow.ungrabInputImpl(); if (!XToolkit.getSunAwtDisableGrab()) { @@ -1021,7 +1039,9 @@ public class XBaseWindow { } public void handleConfigureNotifyEvent(XEvent xev) { XConfigureEvent xe = xev.get_xconfigure(); - insLog.finer("Configure, {0}", xe); + if (insLog.isLoggable(PlatformLogger.FINER)) { + insLog.finer("Configure, {0}", xe); + } x = xe.get_x(); y = xe.get_y(); width = xe.get_width(); @@ -1072,7 +1092,9 @@ public class XBaseWindow { } public void dispatchEvent(XEvent xev) { - if (eventLog.isLoggable(PlatformLogger.FINEST)) eventLog.finest(xev.toString()); + if (eventLog.isLoggable(PlatformLogger.FINEST)) { + eventLog.finest(xev.toString()); + } int type = xev.get_type(); if (isDisposed()) { diff --git a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java index 906e9a862a0..116a93f5bba 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XComponentPeer.java @@ -217,7 +217,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget * Called when component receives focus */ public void focusGained(FocusEvent e) { - focusLog.fine("{0}", e); + if (focusLog.isLoggable(PlatformLogger.FINE)) { + focusLog.fine("{0}", e); + } bHasFocus = true; } @@ -225,7 +227,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget * Called when component loses focus */ public void focusLost(FocusEvent e) { - focusLog.fine("{0}", e); + if (focusLog.isLoggable(PlatformLogger.FINE)) { + focusLog.fine("{0}", e); + } bHasFocus = false; } @@ -297,8 +301,10 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget case XKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED: // Currently we just generate focus events like we deal with lightweight instead of calling // XSetInputFocus on native window - if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer("Proceeding with request to " + - lightweightChild + " in " + target); + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer("Proceeding with request to " + + lightweightChild + " in " + target); + } /** * The problems with requests in non-focused window arise because shouldNativelyFocusHeavyweight * checks that native window is focused while appropriate WINDOW_GAINED_FOCUS has not yet @@ -322,7 +328,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget */ boolean res = wpeer.requestWindowFocus(null); - if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer("Requested window focus: " + res); + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer("Requested window focus: " + res); + } // If parent window can be made focused and has been made focused(synchronously) // then we can proceed with children, otherwise we retreat. if (!(res && parentWindow.isFocused())) { @@ -342,13 +350,17 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget } private boolean rejectFocusRequestHelper(String logMsg) { - if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer(logMsg); + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer(logMsg); + } XKeyboardFocusManagerPeer.removeLastFocusRequest(target); return false; } void handleJavaFocusEvent(AWTEvent e) { - if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer(e.toString()); + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer(e.toString()); + } if (e.getID() == FocusEvent.FOCUS_GAINED) { focusGained((FocusEvent)e); } else { @@ -631,7 +643,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget } public void setBackground(Color c) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Set background to " + c); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Set background to " + c); + } synchronized (getStateLock()) { background = c; } @@ -640,7 +654,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget } public void setForeground(Color c) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Set foreground to " + c); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Set foreground to " + c); + } synchronized (getStateLock()) { foreground = c; } @@ -659,7 +675,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget * @since JDK1.0 */ public FontMetrics getFontMetrics(Font font) { - if (fontLog.isLoggable(PlatformLogger.FINE)) fontLog.fine("Getting font metrics for " + font); + if (fontLog.isLoggable(PlatformLogger.FINE)) { + fontLog.fine("Getting font metrics for " + font); + } return sun.font.FontDesignMetrics.getMetrics(font); } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java b/jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java index be662094982..fa90cf19a49 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XContentWindow.java @@ -115,8 +115,10 @@ public final class XContentWindow extends XWindow { if (in != null) { newBounds.setLocation(-in.left, -in.top); } - if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting content bounds {0}, old bounds {1}", - newBounds, getBounds()); + if (insLog.isLoggable(PlatformLogger.FINE)) { + insLog.fine("Setting content bounds {0}, old bounds {1}", + newBounds, getBounds()); + } // Fix for 5023533: // 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 diff --git a/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java index b4617a8d3fa..51af9fa7b74 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XDecoratedPeer.java @@ -78,7 +78,9 @@ abstract class XDecoratedPeer extends XWindowPeer { Rectangle bounds = (Rectangle)params.get(BOUNDS); dimensions = new WindowDimensions(bounds, getRealInsets(), false); params.put(BOUNDS, dimensions.getClientRect()); - insLog.fine("Initial dimensions {0}", dimensions); + 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 @@ -179,7 +181,9 @@ abstract class XDecoratedPeer extends XWindowPeer { } public void setTitle(String title) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Title is " + title); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Title is " + title); + } winAttr.title = title; updateWMName(); } @@ -227,7 +231,9 @@ abstract class XDecoratedPeer extends XWindowPeer { // If we somehow received focus events forward it instead to proxy // FIXME: Shouldn't we instead check for inferrior? - focusLog.finer("Received focus event on shell: " + xfe); + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer("Received focus event on shell: " + xfe); + } // focusProxy.xRequestFocus(); } @@ -269,7 +275,9 @@ abstract class XDecoratedPeer extends XWindowPeer { wm_set_insets = XWM.getInsetsFromProp(getWindow(), changedAtom); } - insLog.finer("FRAME_EXTENTS: {0}", wm_set_insets); + 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); @@ -296,7 +304,9 @@ abstract class XDecoratedPeer extends XWindowPeer { public void handleReparentNotifyEvent(XEvent xev) { XReparentEvent xe = xev.get_xreparent(); - if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine(xe.toString()); + if (insLog.isLoggable(PlatformLogger.FINE)) { + insLog.fine(xe.toString()); + } reparent_serial = xe.get_serial(); XToolkit.awtLock(); try { @@ -335,7 +345,9 @@ abstract class XDecoratedPeer extends XWindowPeer { // Check if we have insets provided by the WM Insets correctWM = getWMSetInsets(null); if (correctWM != null) { - insLog.finer("wm-provided insets {0}", correctWM); + 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)) { @@ -348,10 +360,12 @@ abstract class XDecoratedPeer extends XWindowPeer { } else { correctWM = XWM.getWM().getInsets(this, xe.get_window(), xe.get_parent()); - if (correctWM != null) { - insLog.finer("correctWM {0}", correctWM); - } else { - insLog.finer("correctWM insets are not available, waiting for configureNotify"); + if (insLog.isLoggable(PlatformLogger.FINER)) { + if (correctWM != null) { + insLog.finer("correctWM {0}", correctWM); + } else { + insLog.finer("correctWM insets are not available, waiting for configureNotify"); + } } } @@ -372,7 +386,9 @@ abstract class XDecoratedPeer extends XWindowPeer { * initial insets were wrong (most likely they were). */ Insets correction = difference(correctWM, currentInsets); - insLog.finest("Corrention {0}", correction); + if (insLog.isLoggable(PlatformLogger.FINEST)) { + insLog.finest("Corrention {0}", correction); + } if (!isNull(correction)) { currentInsets = copy(correctWM); applyGuessedInsets(); @@ -382,7 +398,9 @@ abstract class XDecoratedPeer extends XWindowPeer { //update minimum size hints updateMinSizeHints(); } - if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Dimensions before reparent: " + dimensions); + if (insLog.isLoggable(PlatformLogger.FINER)) { + insLog.finer("Dimensions before reparent: " + dimensions); + } dimensions.setInsets(getRealInsets()); insets_corrected = true; @@ -506,8 +524,10 @@ abstract class XDecoratedPeer extends XWindowPeer { XToolkit.awtLock(); try { if (!isReparented() || !isVisible()) { - insLog.fine("- not reparented({0}) or not visible({1}), default reshape", + 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. // This actually is needed to preserve compatibility with previous releases - @@ -612,9 +632,10 @@ abstract class XDecoratedPeer extends XWindowPeer { dims.setSize(width, height); break; } - if (insLog.isLoggable(PlatformLogger.FINE)) + if (insLog.isLoggable(PlatformLogger.FINE)) { insLog.fine("For the operation {0} new dimensions are {1}", operationToString(operation), dims); + } reshape(dims, operation, userReshape); } @@ -644,7 +665,9 @@ abstract class XDecoratedPeer extends XWindowPeer { public void handleConfigureNotifyEvent(XEvent xev) { assert (SunToolkit.isAWTLockHeldByCurrentThread()); XConfigureEvent xe = xev.get_xconfigure(); - insLog.fine("Configure notify {0}", xe); + if (insLog.isLoggable(PlatformLogger.FINE)) { + insLog.fine("Configure notify {0}", xe); + } // XXX: should really only consider synthetic events, but if (isReparented()) { @@ -735,7 +758,9 @@ abstract class XDecoratedPeer extends XWindowPeer { case XWM.SAWFISH_WM: { Point xlocation = queryXLocation(); - if (log.isLoggable(PlatformLogger.FINE)) log.fine("New X location: {0}", xlocation); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("New X location: {0}", xlocation); + } if (xlocation != null) { newLocation = xlocation; } @@ -752,8 +777,10 @@ abstract class XDecoratedPeer extends XWindowPeer { copy(currentInsets), true); - insLog.finer("Insets are {0}, new dimensions {1}", + if (insLog.isLoggable(PlatformLogger.FINER)) { + insLog.finer("Insets are {0}, new dimensions {1}", currentInsets, newDimensions); + } checkIfOnNewScreen(newDimensions.getBounds()); @@ -788,8 +815,9 @@ abstract class XDecoratedPeer extends XWindowPeer { } public void setShellBounds(Rectangle rec) { - if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting shell bounds on " + - this + " to " + 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); @@ -801,8 +829,9 @@ abstract class XDecoratedPeer extends XWindowPeer { } } public void setShellSize(Rectangle rec) { - if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting shell size on " + - this + " to " + 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); @@ -813,8 +842,9 @@ abstract class XDecoratedPeer extends XWindowPeer { } } public void setShellPosition(Rectangle rec) { - if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting shell position on " + - this + " to " + 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); @@ -914,9 +944,10 @@ abstract class XDecoratedPeer extends XWindowPeer { return toGlobal(0,0); } else { Point location = target.getLocation(); - if (insLog.isLoggable(PlatformLogger.FINE)) + if (insLog.isLoggable(PlatformLogger.FINE)) { insLog.fine("getLocationOnScreen {0} not reparented: {1} ", this, location); + } return location; } } finally { @@ -953,7 +984,9 @@ abstract class XDecoratedPeer extends XWindowPeer { } public void setVisible(boolean vis) { - log.finer("Setting {0} to visible {1}", this, Boolean.valueOf(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); @@ -1004,7 +1037,9 @@ abstract class XDecoratedPeer extends XWindowPeer { } private void handleWmTakeFocus(XClientMessageEvent cl) { - focusLog.fine("WM_TAKE_FOCUS on {0}", this); + if (focusLog.isLoggable(PlatformLogger.FINE)) { + focusLog.fine("WM_TAKE_FOCUS on {0}", this); + } requestWindowFocus(cl.get_data(1), true); } @@ -1017,9 +1052,13 @@ abstract class XDecoratedPeer extends XWindowPeer { // 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.FINE)) focusLog.warning("Focus proxy is null for " + this); + 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 (focusLog.isLoggable(PlatformLogger.FINE)) { + focusLog.fine("Requesting focus to proxy: " + focusProxy); + } if (timeProvided) { focusProxy.xRequestFocus(time); } else { @@ -1111,9 +1150,11 @@ abstract class XDecoratedPeer extends XWindowPeer { Window focusedWindow = XKeyboardFocusManagerPeer.getInstance().getCurrentFocusedWindow(); Window activeWindow = XWindowPeer.getDecoratedOwner(focusedWindow); - focusLog.finer("Current window is: active={0}, focused={1}", + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer("Current window is: active={0}, focused={1}", Boolean.valueOf(target == activeWindow), Boolean.valueOf(target == focusedWindow)); + } XWindowPeer toFocus = this; while (toFocus.nextTransientFor != null) { @@ -1136,16 +1177,22 @@ abstract class XDecoratedPeer extends XWindowPeer { return true; } Window realNativeFocusedWindow = XWindowPeer.getNativeFocusedWindow(); - focusLog.finest("Real native focused window: " + realNativeFocusedWindow + + if (focusLog.isLoggable(PlatformLogger.FINEST)) { + focusLog.finest("Real native focused window: " + realNativeFocusedWindow + "\nKFM's focused window: " + focusedWindow); + } // See 6522725, 6613426. if (target == realNativeFocusedWindow) { - focusLog.fine("The window is already natively focused."); + if (focusLog.isLoggable(PlatformLogger.FINE)) { + focusLog.fine("The window is already natively focused."); + } return true; } } - focusLog.fine("Requesting focus to " + (this == toFocus ? "this window" : toFocus)); + if (focusLog.isLoggable(PlatformLogger.FINE)) { + focusLog.fine("Requesting focus to " + (this == toFocus ? "this window" : toFocus)); + } if (timeProvided) { toFocus.requestXFocus(time); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java index 683a33eeee5..2c3bb349cff 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedCanvasPeer.java @@ -123,7 +123,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener } void initDispatching() { - if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Init embedding for " + Long.toHexString(xembed.handle)); + if (xembedLog.isLoggable(PlatformLogger.FINE)) { + xembedLog.fine("Init embedding for " + Long.toHexString(xembed.handle)); + } XToolkit.awtLock(); try { XToolkit.addEventDispatcher(xembed.handle, xembed); @@ -140,7 +142,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener } void endDispatching() { - xembedLog.fine("End dispatching for " + Long.toHexString(xembed.handle)); + if (xembedLog.isLoggable(PlatformLogger.FINE)) { + xembedLog.fine("End dispatching for " + Long.toHexString(xembed.handle)); + } XToolkit.awtLock(); try { XDropTargetRegistry.getRegistry().unregisterXEmbedClient(getWindow(), xembed.handle); @@ -160,7 +164,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener } void childDestroyed() { - xembedLog.fine("Child " + Long.toHexString(xembed.handle) + " has self-destroyed."); + if (xembedLog.isLoggable(PlatformLogger.FINE)) { + xembedLog.fine("Child " + Long.toHexString(xembed.handle) + " has self-destroyed."); + } endDispatching(); xembed.handle = 0; } @@ -382,7 +388,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener } void detachChild() { - if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Detaching child " + Long.toHexString(xembed.handle)); + if (xembedLog.isLoggable(PlatformLogger.FINE)) { + xembedLog.fine("Detaching child " + Long.toHexString(xembed.handle)); + } /** * XEmbed specification: * "The embedder can unmap the client and reparent the client window to the root window. If the @@ -463,7 +471,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener try { XKeyEvent ke = new XKeyEvent(data); ke.set_window(xembed.handle); - if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Forwarding native key event: " + ke); + if (xembedLog.isLoggable(PlatformLogger.FINE)) { + xembedLog.fine("Forwarding native key event: " + ke); + } XToolkit.awtLock(); try { XlibWrapper.XSendEvent(XToolkit.getDisplay(), xembed.handle, false, XConstants.NoEventMask, data); @@ -494,7 +504,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener postEvent(new InvocationEvent(target, new Runnable() { public void run() { GrabbedKey grab = new GrabbedKey(keysym, modifiers); - if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Grabbing key: " + grab); + if (xembedLog.isLoggable(PlatformLogger.FINE)) { + xembedLog.fine("Grabbing key: " + grab); + } synchronized(GRAB_LOCK) { grabbed_keys.add(grab); } @@ -506,7 +518,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener postEvent(new InvocationEvent(target, new Runnable() { public void run() { GrabbedKey grab = new GrabbedKey(keysym, modifiers); - if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("UnGrabbing key: " + grab); + if (xembedLog.isLoggable(PlatformLogger.FINE)) { + xembedLog.fine("UnGrabbing key: " + grab); + } synchronized(GRAB_LOCK) { grabbed_keys.remove(grab); } @@ -519,7 +533,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener public void run() { AWTKeyStroke stroke = xembed.getKeyStrokeForKeySym(keysym, modifiers); if (stroke != null) { - if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Registering accelerator " + accel_id + " for " + stroke); + if (xembedLog.isLoggable(PlatformLogger.FINE)) { + xembedLog.fine("Registering accelerator " + accel_id + " for " + stroke); + } synchronized(ACCEL_LOCK) { accelerators.put(accel_id, stroke); accel_lookup.put(stroke, accel_id); @@ -537,7 +553,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener synchronized(ACCEL_LOCK) { stroke = accelerators.get(accel_id); if (stroke != null) { - if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Unregistering accelerator: " + accel_id); + if (xembedLog.isLoggable(PlatformLogger.FINE)) { + xembedLog.fine("Unregistering accelerator: " + accel_id); + } accelerators.remove(accel_id); accel_lookup.remove(stroke); // FIXME: How about several accelerators with the same stroke? } @@ -583,7 +601,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener boolean result = false; - if (xembedLog.isLoggable(PlatformLogger.FINER)) xembedLog.finer("Post-processing event " + e); + if (xembedLog.isLoggable(PlatformLogger.FINER)) { + xembedLog.finer("Post-processing event " + e); + } // Process ACCELERATORS AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e); @@ -596,7 +616,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener } } if (exists) { - if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Activating accelerator " + accel_id); + if (xembedLog.isLoggable(PlatformLogger.FINE)) { + xembedLog.fine("Activating accelerator " + accel_id); + } xembed.sendMessage(xembed.handle, XEMBED_ACTIVATE_ACCELERATOR, accel_id, 0, 0); // FIXME: How about overloaded? result = true; } @@ -608,7 +630,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener exists = grabbed_keys.contains(key); } if (exists) { - if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Forwarding grabbed key " + e); + if (xembedLog.isLoggable(PlatformLogger.FINE)) { + xembedLog.fine("Forwarding grabbed key " + e); + } forwardKeyEvent(e); result = true; } @@ -627,9 +651,13 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener public void handleClientMessage(XEvent xev) { super.handleClientMessage(xev); XClientMessageEvent msg = xev.get_xclient(); - if (xembedLog.isLoggable(PlatformLogger.FINER)) xembedLog.finer("Client message to embedder: " + msg); + if (xembedLog.isLoggable(PlatformLogger.FINER)) { + xembedLog.finer("Client message to embedder: " + msg); + } if (msg.get_message_type() == xembed.XEmbed.getAtom()) { - if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine(xembed.XEmbedMessageToString(msg)); + if (xembedLog.isLoggable(PlatformLogger.FINE)) { + xembedLog.fine(xembed.XEmbedMessageToString(msg)); + } } if (isXEmbedActive()) { switch ((int)msg.get_data(1)) { @@ -730,8 +758,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener boolean new_mapped = (flags & XEMBED_MAPPED) != 0; boolean currently_mapped = XlibUtil.getWindowMapState(handle) != XConstants.IsUnmapped; if (new_mapped != currently_mapped) { - if (xembedLog.isLoggable(PlatformLogger.FINER)) - xembedLog.fine("Mapping state of the client has changed, old state: " + currently_mapped + ", new state: " + new_mapped); + if (xembedLog.isLoggable(PlatformLogger.FINER)) { + xembedLog.finer("Mapping state of the client has changed, old state: " + currently_mapped + ", new state: " + new_mapped); + } if (new_mapped) { XToolkit.awtLock(); try { @@ -748,7 +777,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener } } } else { - xembedLog.finer("Mapping state didn't change, mapped: " + currently_mapped); + if (xembedLog.isLoggable(PlatformLogger.FINER)) { + xembedLog.finer("Mapping state didn't change, mapped: " + currently_mapped); + } } return true; } finally { @@ -759,7 +790,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener public void handlePropertyNotify(XEvent xev) { if (isXEmbedActive()) { XPropertyEvent ev = xev.get_xproperty(); - if (xembedLog.isLoggable(PlatformLogger.FINER)) xembedLog.finer("Property change on client: " + ev); + if (xembedLog.isLoggable(PlatformLogger.FINER)) { + xembedLog.finer("Property change on client: " + ev); + } if (ev.get_atom() == XAtom.XA_WM_NORMAL_HINTS) { childResized(); } else if (ev.get_atom() == XEmbedInfo.getAtom()) { @@ -780,7 +813,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener void handleConfigureNotify(XEvent xev) { if (isXEmbedActive()) { XConfigureEvent ev = xev.get_xconfigure(); - if (xembedLog.isLoggable(PlatformLogger.FINER)) xembedLog.finer("Bounds change on client: " + ev); + if (xembedLog.isLoggable(PlatformLogger.FINER)) { + xembedLog.finer("Bounds change on client: " + ev); + } if (xev.get_xany().get_window() == handle) { childResized(); } @@ -831,7 +866,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener // We recognize only these masks modifiers = ke.get_state() & (XConstants.ShiftMask | XConstants.ControlMask | XConstants.LockMask); - if (xembedLog.isLoggable(PlatformLogger.FINEST)) xembedLog.finest("Mapped " + e + " to " + this); + if (xembedLog.isLoggable(PlatformLogger.FINEST)) { + xembedLog.finest("Mapped " + e + " to " + this); + } } finally { XlibWrapper.unsafe.freeMemory(data); } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XEmbedClientHelper.java b/jdk/src/solaris/classes/sun/awt/X11/XEmbedClientHelper.java index 026209e048d..434e665ab33 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedClientHelper.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedClientHelper.java @@ -95,9 +95,13 @@ public class XEmbedClientHelper extends XEmbedHelper implements XEventDispatcher void handleClientMessage(XEvent xev) { XClientMessageEvent msg = xev.get_xclient(); - if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine(msg.toString()); + if (xembedLog.isLoggable(PlatformLogger.FINE)) { + xembedLog.fine(msg.toString()); + } if (msg.get_message_type() == XEmbed.getAtom()) { - if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Embedded message: " + msgidToString((int)msg.get_data(1))); + if (xembedLog.isLoggable(PlatformLogger.FINE)) { + xembedLog.fine("Embedded message: " + msgidToString((int)msg.get_data(1))); + } switch ((int)msg.get_data(1)) { case XEMBED_EMBEDDED_NOTIFY: // Notification about embedding protocol start active = true; diff --git a/jdk/src/solaris/classes/sun/awt/X11/XEmbedHelper.java b/jdk/src/solaris/classes/sun/awt/X11/XEmbedHelper.java index 69549f39c13..3109d60d4af 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedHelper.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedHelper.java @@ -82,11 +82,15 @@ public class XEmbedHelper { XEmbedHelper() { if (XEmbed == null) { XEmbed = XAtom.get("_XEMBED"); - if (xembedLog.isLoggable(PlatformLogger.FINER)) xembedLog.finer("Created atom " + XEmbed.toString()); + if (xembedLog.isLoggable(PlatformLogger.FINER)) { + xembedLog.finer("Created atom " + XEmbed.toString()); + } } if (XEmbedInfo == null) { XEmbedInfo = XAtom.get("_XEMBED_INFO"); - if (xembedLog.isLoggable(PlatformLogger.FINER)) xembedLog.finer("Created atom " + XEmbedInfo.toString()); + if (xembedLog.isLoggable(PlatformLogger.FINER)) { + xembedLog.finer("Created atom " + XEmbedInfo.toString()); + } } } @@ -106,7 +110,9 @@ public class XEmbedHelper { msg.set_data(4, data2); XToolkit.awtLock(); try { - if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Sending " + XEmbedMessageToString(msg)); + if (xembedLog.isLoggable(PlatformLogger.FINE)) { + xembedLog.fine("Sending " + XEmbedMessageToString(msg)); + } XlibWrapper.XSendEvent(XToolkit.getDisplay(), window, false, XConstants.NoEventMask, msg.pData); } finally { diff --git a/jdk/src/solaris/classes/sun/awt/X11/XEmbedServerTester.java b/jdk/src/solaris/classes/sun/awt/X11/XEmbedServerTester.java index 84f2a039329..e588f8f5f3a 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XEmbedServerTester.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XEmbedServerTester.java @@ -81,7 +81,9 @@ public class XEmbedServerTester implements XEventDispatcher { throw new RuntimeException("Can't create robot"); } initAccel(); - xembedLog.finer("XEmbed client(tester), embedder window: " + Long.toHexString(parent)); + if (xembedLog.isLoggable(PlatformLogger.FINER)) { + xembedLog.finer("XEmbed client(tester), embedder window: " + Long.toHexString(parent)); + } } public static XEmbedServerTester getTester(Rectangle serverBounds[], long parent) { @@ -89,12 +91,14 @@ public class XEmbedServerTester implements XEventDispatcher { } private void dumpReceivedEvents() { - xembedLog.finer("Events received so far:"); - int pos = 0; - for (Integer event : events) { - xembedLog.finer((pos++) + ":" + XEmbedHelper.msgidToString(event)); + if (xembedLog.isLoggable(PlatformLogger.FINER)) { + xembedLog.finer("Events received so far:"); + int pos = 0; + for (Integer event : events) { + xembedLog.finer((pos++) + ":" + XEmbedHelper.msgidToString(event)); + } + xembedLog.finer("End of event dump"); } - xembedLog.finer("End of event dump"); } public void test1_1() { @@ -391,7 +395,9 @@ public class XEmbedServerTester implements XEventDispatcher { SubstructureNotifyMask | KeyPressMask)}); window = new XBaseWindow(params); - xembedLog.finer("Created tester window: " + window); + if (xembedLog.isLoggable(PlatformLogger.FINER)) { + xembedLog.finer("Created tester window: " + window); + } XToolkit.addEventDispatcher(window.getWindow(), this); updateEmbedInfo(); @@ -529,18 +535,24 @@ public class XEmbedServerTester implements XEventDispatcher { synchronized(EVENT_LOCK) { // Check for already received events after the request if (checkEventList(position, event) != -1) { - xembedLog.finer("The event " + XEmbedHelper.msgidToString(event) + " has already been received"); + if (xembedLog.isLoggable(PlatformLogger.FINER)) { + xembedLog.finer("The event " + XEmbedHelper.msgidToString(event) + " has already been received"); + } return; } if (eventReceived == event) { // Already received - xembedLog.finer("Already received " + XEmbedHelper.msgidToString(event)); + if (xembedLog.isLoggable(PlatformLogger.FINER)) { + xembedLog.finer("Already received " + XEmbedHelper.msgidToString(event)); + } return; } eventReceived = -1; eventWaited = event; - xembedLog.finer("Waiting for " + XEmbedHelper.msgidToString(event) + " starting from " + position); + if (xembedLog.isLoggable(PlatformLogger.FINER)) { + xembedLog.finer("Waiting for " + XEmbedHelper.msgidToString(event) + " starting from " + position); + } try { EVENT_LOCK.wait(3000); } catch (InterruptedException ie) { @@ -551,7 +563,9 @@ public class XEmbedServerTester implements XEventDispatcher { dumpReceivedEvents(); throw new RuntimeException("Didn't receive event " + XEmbedHelper.msgidToString(event) + " but recevied " + XEmbedHelper.msgidToString(eventReceived)); } else { - xembedLog.finer("Successfully recevied " + XEmbedHelper.msgidToString(event)); + if (xembedLog.isLoggable(PlatformLogger.FINER)) { + xembedLog.finer("Successfully recevied " + XEmbedHelper.msgidToString(event)); + } } } } @@ -634,7 +648,9 @@ public class XEmbedServerTester implements XEventDispatcher { if (ev.get_type() == ClientMessage) { XClientMessageEvent msg = ev.get_xclient(); if (msg.get_message_type() == xembed.XEmbed.getAtom()) { - if (xembedLog.isLoggable(PlatformLogger.FINE)) xembedLog.fine("Embedded message: " + XEmbedHelper.msgidToString((int)msg.get_data(1))); + if (xembedLog.isLoggable(PlatformLogger.FINE)) { + xembedLog.fine("Embedded message: " + XEmbedHelper.msgidToString((int)msg.get_data(1))); + } switch ((int)msg.get_data(1)) { case XEmbedHelper.XEMBED_EMBEDDED_NOTIFY: // Notification about embedding protocol start xembedActive = true; @@ -659,10 +675,14 @@ public class XEmbedServerTester implements XEventDispatcher { synchronized(EVENT_LOCK) { events.add((int)msg.get_data(1)); - xembedLog.finer("Tester is waiting for " + XEmbedHelper.msgidToString(eventWaited)); + if (xembedLog.isLoggable(PlatformLogger.FINER)) { + xembedLog.finer("Tester is waiting for " + XEmbedHelper.msgidToString(eventWaited)); + } if ((int)msg.get_data(1) == eventWaited) { eventReceived = (int)msg.get_data(1); - xembedLog.finer("Notifying waiting object for event " + System.identityHashCode(EVENT_LOCK)); + if (xembedLog.isLoggable(PlatformLogger.FINER)) { + xembedLog.finer("Notifying waiting object for event " + System.identityHashCode(EVENT_LOCK)); + } EVENT_LOCK.notifyAll(); } } @@ -672,10 +692,14 @@ public class XEmbedServerTester implements XEventDispatcher { int eventID = (int)ev.get_type() | SYSTEM_EVENT_MASK; events.add(eventID); - xembedLog.finer("Tester is waiting for " + XEmbedHelper.msgidToString(eventWaited) + ", but we received " + ev + "(" + XEmbedHelper.msgidToString(eventID) + ")"); + if (xembedLog.isLoggable(PlatformLogger.FINER)) { + xembedLog.finer("Tester is waiting for " + XEmbedHelper.msgidToString(eventWaited) + ", but we received " + ev + "(" + XEmbedHelper.msgidToString(eventID) + ")"); + } if (eventID == eventWaited) { eventReceived = eventID; - xembedLog.finer("Notifying waiting object" + System.identityHashCode(EVENT_LOCK)); + if (xembedLog.isLoggable(PlatformLogger.FINER)) { + xembedLog.finer("Notifying waiting object" + System.identityHashCode(EVENT_LOCK)); + } EVENT_LOCK.notifyAll(); } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java index f15dbd209d1..0842417e713 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XFileDialogPeer.java @@ -720,7 +720,9 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe } File fe = new File(dir).getAbsoluteFile(); - log.fine("Current directory : " + fe); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Current directory : " + fe); + } if (!fe.isDirectory()) { dir = "./"; diff --git a/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java b/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java index 28522350da6..9a8212919a6 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XFramePeer.java @@ -209,7 +209,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer { } public void setMaximizedBounds(Rectangle b) { - if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting maximized bounds to " + b); + if (insLog.isLoggable(PlatformLogger.FINE)) { + insLog.fine("Setting maximized bounds to " + b); + } if (b == null) return; maxBounds = new Rectangle(b); XToolkit.awtLock(); @@ -226,7 +228,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer { } else { hints.set_max_height((int)XlibWrapper.DisplayHeight(XToolkit.getDisplay(), XlibWrapper.DefaultScreen(XToolkit.getDisplay()))); } - if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(hints.get_flags())); + if (insLog.isLoggable(PlatformLogger.FINER)) { + insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(hints.get_flags())); + } XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(), window, hints.pData); } finally { XToolkit.awtUnlock(); @@ -254,14 +258,20 @@ class XFramePeer extends XDecoratedPeer implements FramePeer { int changed = state ^ newState; int changeIconic = changed & Frame.ICONIFIED; boolean iconic = (newState & Frame.ICONIFIED) != 0; - stateLog.finer("Changing state, old state {0}, new state {1}(iconic {2})", + if (stateLog.isLoggable(PlatformLogger.FINER)) { + stateLog.finer("Changing state, old state {0}, new state {1}(iconic {2})", Integer.valueOf(state), Integer.valueOf(newState), Boolean.valueOf(iconic)); + } if (changeIconic != 0 && iconic) { - if (stateLog.isLoggable(PlatformLogger.FINER)) stateLog.finer("Iconifying shell " + getShell() + ", this " + this + ", screen " + getScreenNumber()); + if (stateLog.isLoggable(PlatformLogger.FINER)) { + stateLog.finer("Iconifying shell " + getShell() + ", this " + this + ", screen " + getScreenNumber()); + } XToolkit.awtLock(); try { int res = XlibWrapper.XIconifyWindow(XToolkit.getDisplay(), getShell(), getScreenNumber()); - if (stateLog.isLoggable(PlatformLogger.FINER)) stateLog.finer("XIconifyWindow returned " + res); + if (stateLog.isLoggable(PlatformLogger.FINER)) { + stateLog.finer("XIconifyWindow returned " + res); + } } finally { XToolkit.awtUnlock(); @@ -271,7 +281,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer { setExtendedState(newState); } if (changeIconic != 0 && !iconic) { - if (stateLog.isLoggable(PlatformLogger.FINER)) stateLog.finer("DeIconifying " + this); + if (stateLog.isLoggable(PlatformLogger.FINER)) { + stateLog.finer("DeIconifying " + this); + } xSetVisible(true); } } @@ -284,7 +296,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer { super.handlePropertyNotify(xev); XPropertyEvent ev = xev.get_xproperty(); - log.finer("Property change {0}", ev); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Property change {0}", ev); + } /* * Let's see if this is a window state protocol message, and * if it is - decode a new state in terms of java constants. @@ -297,7 +311,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer { final int newState = XWM.getWM().getState(this); int changed = state ^ newState; if (changed == 0) { - stateLog.finer("State is the same: " + state); + if (stateLog.isLoggable(PlatformLogger.FINER)) { + stateLog.finer("State is the same: " + state); + } return; } @@ -349,7 +365,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer { XWMHints hints = getWMHints(); hints.set_flags((int)XUtilConstants.StateHint | hints.get_flags()); hints.set_initial_state(wm_state); - if (stateLog.isLoggable(PlatformLogger.FINE)) stateLog.fine("Setting initial WM state on " + this + " to " + wm_state); + if (stateLog.isLoggable(PlatformLogger.FINE)) { + stateLog.fine("Setting initial WM state on " + this + " to " + wm_state); + } XlibWrapper.XSetWMHints(XToolkit.getDisplay(), getWindow(), hints.pData); } finally { diff --git a/jdk/src/solaris/classes/sun/awt/X11/XIconWindow.java b/jdk/src/solaris/classes/sun/awt/X11/XIconWindow.java index bf521db3b72..8c14887748e 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XIconWindow.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XIconWindow.java @@ -61,7 +61,9 @@ public class XIconWindow extends XBaseWindow { final long screen = adata.get_awt_visInfo().get_screen(); final long display = XToolkit.getDisplay(); - if (log.isLoggable(PlatformLogger.FINEST)) log.finest(adata.toString()); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest(adata.toString()); + } long status = XlibWrapper.XGetIconSizes(display, XToolkit.getDefaultRootWindow(), @@ -71,11 +73,15 @@ public class XIconWindow extends XBaseWindow { } int count = Native.getInt(XlibWrapper.iarg1); long sizes_ptr = Native.getLong(XlibWrapper.larg1); // XIconSize* - log.finest("count = {1}, sizes_ptr = {0}", Long.valueOf(sizes_ptr), Integer.valueOf(count)); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("count = {1}, sizes_ptr = {0}", Long.valueOf(sizes_ptr), Integer.valueOf(count)); + } XIconSize[] res = new XIconSize[count]; for (int i = 0; i < count; i++, sizes_ptr += XIconSize.getSize()) { res[i] = new XIconSize(sizes_ptr); - log.finest("sizes_ptr[{1}] = {0}", res[i], Integer.valueOf(i)); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("sizes_ptr[{1}] = {0}", res[i], Integer.valueOf(i)); + } } return res; } finally { @@ -92,7 +98,9 @@ public class XIconWindow extends XBaseWindow { } XIconSize[] sizeList = getIconSizes(); - log.finest("Icon sizes: {0}", (Object[]) sizeList); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("Icon sizes: {0}", (Object[]) sizeList); + } if (sizeList == null) { // No icon sizes so we simply fall back to 16x16 return new Dimension(16, 16); @@ -418,7 +426,9 @@ public class XIconWindow extends XBaseWindow { } } if (min != null) { - log.finer("Icon: {0}x{1}", min.getWidth(null), min.getHeight(null)); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Icon: {0}x{1}", min.getWidth(null), min.getHeight(null)); + } setIconImage(min); } } @@ -444,7 +454,9 @@ public class XIconWindow extends XBaseWindow { } Dimension iconSize = getIconSize(width, height); if (iconSize != null) { - log.finest("Icon size: {0}", iconSize); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("Icon size: {0}", iconSize); + } iconWidth = iconSize.width; iconHeight = iconSize.height; } else { diff --git a/jdk/src/solaris/classes/sun/awt/X11/XInputMethod.java b/jdk/src/solaris/classes/sun/awt/X11/XInputMethod.java index 3785e1935aa..a616bdf07e2 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XInputMethod.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XInputMethod.java @@ -102,13 +102,17 @@ public class XInputMethod extends X11InputMethod { protected ComponentPeer getPeer(Component client) { XComponentPeer peer; - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Client is " + client); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Client is " + client); + } peer = (XComponentPeer)XToolkit.targetToPeer(client); while (client != null && peer == null) { client = getParent(client); peer = (XComponentPeer)XToolkit.targetToPeer(client); } - log.fine("Peer is {0}, client is {1}", peer, client); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Peer is {0}, client is {1}", peer, client); + } if (peer != null) return peer; diff --git a/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java index d9319c99e68..eeeed3975cd 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XListPeer.java @@ -575,10 +575,14 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { } void mousePressed(MouseEvent mouseEvent) { - if (log.isLoggable(PlatformLogger.FINER)) log.finer(mouseEvent.toString() + ", hsb " + hsbVis + ", vsb " + vsbVis); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer(mouseEvent.toString() + ", hsb " + hsbVis + ", vsb " + vsbVis); + } if (isEnabled() && mouseEvent.getButton() == MouseEvent.BUTTON1) { if (inWindow(mouseEvent.getX(), mouseEvent.getY())) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Mouse press in items area"); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Mouse press in items area"); + } active = WINDOW; int i = y2index(mouseEvent.getY()); if (i >= 0) { @@ -615,14 +619,18 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { currentIndex = -1; } } else if (inVerticalScrollbar(mouseEvent.getX(), mouseEvent.getY())) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Mouse press in vertical scrollbar"); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Mouse press in vertical scrollbar"); + } active = VERSCROLLBAR; vsb.handleMouseEvent(mouseEvent.getID(), mouseEvent.getModifiers(), mouseEvent.getX() - (width - SCROLLBAR_WIDTH), mouseEvent.getY()); } else if (inHorizontalScrollbar(mouseEvent.getX(), mouseEvent.getY())) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Mouse press in horizontal scrollbar"); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Mouse press in horizontal scrollbar"); + } active = HORSCROLLBAR; hsb.handleMouseEvent(mouseEvent.getID(), mouseEvent.getModifiers(), @@ -805,7 +813,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { void keyPressed(KeyEvent e) { int keyCode = e.getKeyCode(); - if (log.isLoggable(PlatformLogger.FINE)) log.fine(e.toString()); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine(e.toString()); + } switch(keyCode) { case KeyEvent.VK_UP: case KeyEvent.VK_KP_UP: // TODO: I assume we also want this, too @@ -990,7 +1000,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { */ public void notifyValue(XScrollbar obj, int type, int v, boolean isAdjusting) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Notify value changed on " + obj + " to " + v); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Notify value changed on " + obj + " to " + v); + } int value = obj.getValue(); if (obj == vsb) { scrollVertical(v - value); @@ -1073,7 +1085,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { } } } - if (log.isLoggable(PlatformLogger.FINER)) log.finer("Adding item '" + item + "' to " + addedIndex); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Adding item '" + item + "' to " + addedIndex); + } // Update maxLength boolean repaintItems = !isItemHidden(addedIndex); @@ -1091,8 +1105,10 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { | ((vsb.needsRepaint())?(PAINT_VSCROLL):0); } - if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Last visible: " + getLastVisibleItem() + - ", hsb changed : " + (hsbWasVis ^ hsbVis) + ", items changed " + repaintItems); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("Last visible: " + getLastVisibleItem() + + ", hsb changed : " + (hsbWasVis ^ hsbVis) + ", items changed " + repaintItems); + } repaint(addedIndex, getLastVisibleItem(), options); } @@ -1107,10 +1123,14 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { boolean vsbWasVisible = vsbVis; int oldLastDisplayed = lastItemDisplayed(); - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Deleting from " + s + " to " + e); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Deleting from " + s + " to " + e); + } - if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Last displayed item: " + oldLastDisplayed + ", items in window " + itemsInWindow() + - ", size " + items.size()); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("Last displayed item: " + oldLastDisplayed + ", items in window " + itemsInWindow() + + ", size " + items.size()); + } if (items.size() == 0) { return; @@ -1177,7 +1197,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { options |= PAINT_FOCUS; } - if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Multiple selections: " + multipleSelections); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("Multiple selections: " + multipleSelections); + } // update vsb.val if (vsb.getValue() >= s) { @@ -1430,7 +1452,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { * y is the number of items to scroll */ void scrollVertical(int y) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Scrolling vertically by " + y); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Scrolling vertically by " + y); + } int itemsInWin = itemsInWindow(); int h = getItemHeight(); int pixelsToScroll = y * h; @@ -1470,7 +1494,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { * x is the number of pixels to scroll */ void scrollHorizontal(int x) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Scrolling horizontally by " + y); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Scrolling horizontally by " + y); + } int w = getListWidth(); w -= ((2 * SPACE) + (2 * MARGIN)); int h = height - (SCROLLBAR_AREA + (2 * MARGIN)); @@ -1706,7 +1732,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { } if (localBuffer == null) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Creating buffer " + width + "x" + height); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Creating buffer " + width + "x" + height); + } // use GraphicsConfig.cCVI() instead of Component.cVI(), // because the latter may cause a deadlock with the tree lock localBuffer = @@ -1743,7 +1771,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { private void paint(Graphics listG, int firstItem, int lastItem, int options, Rectangle source, Point distance) { - if (log.isLoggable(PlatformLogger.FINER)) log.finer("Repaint from " + firstItem + " to " + lastItem + " options " + options); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Repaint from " + firstItem + " to " + lastItem + " options " + options); + } if (firstItem > lastItem) { int t = lastItem; lastItem = firstItem; @@ -1832,7 +1862,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { } private void paintItems(Graphics g, int firstItem, int lastItem, int options) { - if (log.isLoggable(PlatformLogger.FINER)) log.finer("Painting items from " + firstItem + " to " + lastItem + ", focused " + focusIndex + ", first " + getFirstVisibleItem() + ", last " + getLastVisibleItem()); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Painting items from " + firstItem + " to " + lastItem + ", focused " + focusIndex + ", first " + getFirstVisibleItem() + ", last " + getLastVisibleItem()); + } firstItem = Math.max(getFirstVisibleItem(), firstItem); if (firstItem > lastItem) { @@ -1843,15 +1875,19 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { firstItem = Math.max(getFirstVisibleItem(), firstItem); lastItem = Math.min(lastItem, items.size()-1); - if (log.isLoggable(PlatformLogger.FINER)) log.finer("Actually painting items from " + firstItem + " to " + lastItem + - ", items in window " + itemsInWindow()); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Actually painting items from " + firstItem + " to " + lastItem + + ", items in window " + itemsInWindow()); + } for (int i = firstItem; i <= lastItem; i++) { paintItem(g, i); } } private void paintItem(Graphics g, int index) { - if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Painting item " + index); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("Painting item " + index); + } // 4895367 - only paint items which are visible if (!isItemHidden(index)) { Shape clip = g.getClip(); @@ -1859,18 +1895,24 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { int h = getItemHeight(); int y = getItemY(index); int x = getItemX(); - if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Setting clip " + new Rectangle(x, y, w - (SPACE*2), h-(SPACE*2))); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("Setting clip " + new Rectangle(x, y, w - (SPACE*2), h-(SPACE*2))); + } g.setClip(x, y, w - (SPACE*2), h-(SPACE*2)); // Always paint the background so that focus is unpainted in // multiselect mode if (isSelected(index)) { - if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Painted item is selected"); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("Painted item is selected"); + } g.setColor(getListForeground()); } else { g.setColor(getListBackground()); } - if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Filling " + new Rectangle(x, y, w, h)); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("Filling " + new Rectangle(x, y, w, h)); + } g.fillRect(x, y, w, h); if (index <= getLastVisibleItem() && index < items.size()) { @@ -1894,8 +1936,10 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { } void paintScrollBar(XScrollbar scr, Graphics g, int x, int y, int width, int height, boolean paintAll) { - if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Painting scrollbar " + scr + " width " + - width + " height " + height + ", paintAll " + paintAll); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("Painting scrollbar " + scr + " width " + + width + " height " + height + ", paintAll " + paintAll); + } g.translate(x, y); scr.paint(g, getSystemColors(), paintAll); g.translate(-x, -y); @@ -1932,22 +1976,30 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient { if (paintFocus && !hasFocus()) { paintFocus = false; } - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Painting focus, focus index " + getFocusIndex() + ", focus is " + - (isItemHidden(getFocusIndex())?("invisible"):("visible")) + ", paint focus is " + paintFocus); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Painting focus, focus index " + getFocusIndex() + ", focus is " + + (isItemHidden(getFocusIndex())?("invisible"):("visible")) + ", paint focus is " + paintFocus); + } Shape clip = g.getClip(); g.setClip(0, 0, listWidth, listHeight); - if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Setting focus clip " + new Rectangle(0, 0, listWidth, listHeight)); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("Setting focus clip " + new Rectangle(0, 0, listWidth, listHeight)); + } Rectangle rect = getFocusRect(); if (prevFocusRect != null) { // Erase focus rect - if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Erasing previous focus rect " + prevFocusRect); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("Erasing previous focus rect " + prevFocusRect); + } g.setColor(getListBackground()); g.drawRect(prevFocusRect.x, prevFocusRect.y, prevFocusRect.width, prevFocusRect.height); prevFocusRect = null; } if (paintFocus) { // Paint new - if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Painting focus rect " + rect); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("Painting focus rect " + rect); + } g.setColor(getListForeground()); // Focus color is always black on Linux g.drawRect(rect.x, rect.y, rect.width, rect.height); prevFocusRect = rect; diff --git a/jdk/src/solaris/classes/sun/awt/X11/XMSelection.java b/jdk/src/solaris/classes/sun/awt/X11/XMSelection.java index 9ccce8b54eb..997fa1c8838 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XMSelection.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XMSelection.java @@ -128,7 +128,9 @@ public class XMSelection { long display = XToolkit.getDisplay(); synchronized(this) { setOwner(owner, screen); - if (log.isLoggable(PlatformLogger.FINE)) log.fine("New Selection Owner for screen " + screen + " = " + owner ); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("New Selection Owner for screen " + screen + " = " + owner ); + } XlibWrapper.XSelectInput(display, owner, XConstants.StructureNotifyMask | eventMask); XToolkit.addEventDispatcher(owner, new XEventDispatcher() { @@ -148,19 +150,25 @@ public class XMSelection { try { try { long display = XToolkit.getDisplay(); - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Grabbing XServer"); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Grabbing XServer"); + } XlibWrapper.XGrabServer(display); synchronized(this) { String selection_name = getName()+"_S"+screen; - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Screen = " + screen + " selection name = " + selection_name); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Screen = " + screen + " selection name = " + selection_name); + } XAtom atom = XAtom.get(selection_name); selectionMap.put(Long.valueOf(atom.getAtom()),this); // add mapping from atom to the instance of XMSelection setAtom(atom,screen); long owner = XlibWrapper.XGetSelectionOwner(display, atom.getAtom()); if (owner != 0) { setOwner(owner, screen); - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Selection Owner for screen " + screen + " = " + owner ); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Selection Owner for screen " + screen + " = " + owner ); + } XlibWrapper.XSelectInput(display, owner, XConstants.StructureNotifyMask | extra_mask); XToolkit.addEventDispatcher(owner, new XEventDispatcher() { @@ -175,7 +183,9 @@ public class XMSelection { e.printStackTrace(); } finally { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("UnGrabbing XServer"); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("UnGrabbing XServer"); + } XlibWrapper.XUngrabServer(XToolkit.getDisplay()); } } finally { @@ -187,7 +197,9 @@ public class XMSelection { static boolean processClientMessage(XEvent xev, int screen) { XClientMessageEvent xce = xev.get_xclient(); if (xce.get_message_type() == XA_MANAGER.getAtom()) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("client messags = " + xce); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("client messags = " + xce); + } long timestamp = xce.get_data(0); long atom = xce.get_data(1); long owner = xce.get_data(2); @@ -294,7 +306,9 @@ public class XMSelection { synchronized void dispatchSelectionChanged( XPropertyEvent ev, int screen) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Selection Changed : Screen = " + screen + "Event =" + ev); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Selection Changed : Screen = " + screen + "Event =" + ev); + } if (listeners != null) { Iterator iter = listeners.iterator(); while (iter.hasNext()) { @@ -305,7 +319,9 @@ public class XMSelection { } synchronized void dispatchOwnerDeath(XDestroyWindowEvent de, int screen) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Owner dead : Screen = " + screen + "Event =" + de); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Owner dead : Screen = " + screen + "Event =" + de); + } if (listeners != null) { Iterator iter = listeners.iterator(); while (iter.hasNext()) { @@ -317,7 +333,9 @@ public class XMSelection { } void dispatchSelectionEvent(XEvent xev, int screen) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Event =" + xev); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Event =" + xev); + } if (xev.get_type() == XConstants.DestroyNotify) { XDestroyWindowEvent de = xev.get_xdestroywindow(); dispatchOwnerDeath( de, screen); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java index 7de670903e8..3b04e74fe9d 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XMenuBarPeer.java @@ -519,7 +519,9 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer { */ public void handleKeyPress(XEvent xev) { XKeyEvent xkey = xev.get_xkey(); - if (log.isLoggable(PlatformLogger.FINE)) log.fine(xkey.toString()); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine(xkey.toString()); + } if (isEventDisabled(xev)) { return; } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XMenuPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XMenuPeer.java index bd25cdbabce..5931d8fecb4 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XMenuPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XMenuPeer.java @@ -111,7 +111,9 @@ public class XMenuPeer extends XMenuItemPeer implements MenuPeer { * for adding separators */ public void addSeparator() { - if (log.isLoggable(PlatformLogger.FINER)) log.finer("addSeparator is not implemented"); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("addSeparator is not implemented"); + } } public void addItem(MenuItem item) { diff --git a/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java b/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java index 92a741bfe70..da35f123aad 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XNETProtocol.java @@ -43,7 +43,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt } public void setState(XWindowPeer window, int state) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting state of " + window + " to " + state); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Setting state of " + window + " to " + state); + } if (window.isShowing()) { requestState(window, state); } else { @@ -53,7 +55,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt private void setInitialState(XWindowPeer window, int state) { XAtomList old_state = window.getNETWMState(); - log.fine("Current state of the window {0} is {1}", window, old_state); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Current state of the window {0} is {1}", window, old_state); + } if ((state & Frame.MAXIMIZED_VERT) != 0) { old_state.add(XA_NET_WM_STATE_MAXIMIZED_VERT); } else { @@ -64,7 +68,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt } else { old_state.remove(XA_NET_WM_STATE_MAXIMIZED_HORZ); } - log.fine("Setting initial state of the window {0} to {1}", window, old_state); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Setting initial state of the window {0} to {1}", window, old_state); + } window.setNETWMState(old_state); } @@ -97,7 +103,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt default: return; } - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Requesting state on " + window + " for " + state); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Requesting state on " + window + " for " + state); + } req.set_type((int)XConstants.ClientMessage); req.set_window(window.getWindow()); req.set_message_type(XA_NET_WM_STATE.getAtom()); @@ -179,7 +187,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt req.set_data(1, state.getAtom()); // Fix for 6735584: req.data[2] must be set to 0 when only one property is changed req.set_data(2, 0); - log.fine("Setting _NET_STATE atom {0} on {1} for {2}", state, window, Boolean.valueOf(isAdd)); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Setting _NET_STATE atom {0} on {1} for {2}", state, window, Boolean.valueOf(isAdd)); + } XToolkit.awtLock(); try { XlibWrapper.XSendEvent(XToolkit.getDisplay(), @@ -204,20 +214,26 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt * @param reset Indicates operation, 'set' if false, 'reset' if true */ private void setStateHelper(XWindowPeer window, XAtom state, boolean set) { - log.finer("Window visibility is: withdrawn={0}, visible={1}, mapped={2} showing={3}", + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Window visibility is: withdrawn={0}, visible={1}, mapped={2} showing={3}", Boolean.valueOf(window.isWithdrawn()), Boolean.valueOf(window.isVisible()), Boolean.valueOf(window.isMapped()), Boolean.valueOf(window.isShowing())); + } if (window.isShowing()) { requestState(window, state, set); } else { XAtomList net_wm_state = window.getNETWMState(); - log.finer("Current state on {0} is {1}", window, net_wm_state); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Current state on {0} is {1}", window, net_wm_state); + } if (!set) { net_wm_state.remove(state); } else { net_wm_state.add(state); } - log.fine("Setting states on {0} to {1}", window, net_wm_state); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Setting states on {0} to {1}", window, net_wm_state); + } window.setNETWMState(net_wm_state); } XToolkit.XSync(); @@ -274,7 +290,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt } NetWindow = checkAnchor(XA_NET_SUPPORTING_WM_CHECK, XAtom.XA_WINDOW); supportChecked = true; - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### " + this + " is active: " + (NetWindow != 0)); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### " + this + " is active: " + (NetWindow != 0)); + } } boolean active() { @@ -284,7 +302,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt boolean doStateProtocol() { boolean res = active() && checkProtocol(XA_NET_SUPPORTED, XA_NET_WM_STATE); - stateLog.finer("doStateProtocol() returns " + res); + if (stateLog.isLoggable(PlatformLogger.FINER)) { + stateLog.finer("doStateProtocol() returns " + res); + } return res; } @@ -311,7 +331,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt if (net_wm_name_string == null) { return false; } - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### WM_NAME = " + net_wm_name_string); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### WM_NAME = " + net_wm_name_string); + } return net_wm_name_string.startsWith(name); } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java index 5dc3defea6a..97afe322b04 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XPopupMenuPeer.java @@ -123,7 +123,9 @@ public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer { * for adding separators */ public void addSeparator() { - if (log.isLoggable(PlatformLogger.FINER)) log.finer("addSeparator is not implemented"); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("addSeparator is not implemented"); + } } /* diff --git a/jdk/src/solaris/classes/sun/awt/X11/XProtocol.java b/jdk/src/solaris/classes/sun/awt/X11/XProtocol.java index 4d11a30981a..81200b76790 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XProtocol.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XProtocol.java @@ -54,7 +54,9 @@ class XProtocol { } finally { if (firstCheck) { firstCheck = false; - log.fine("{0}:{1} supports {2}", this, listName, protocols); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("{0}:{1} supports {2}", this, listName, protocols); + } } } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XScrollbar.java b/jdk/src/solaris/classes/sun/awt/X11/XScrollbar.java index 5c1fcc24754..d8a8aaf8474 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XScrollbar.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XScrollbar.java @@ -118,7 +118,9 @@ abstract class XScrollbar { abstract protected void rebuildArrows(); public void setSize(int width, int height) { - if (log.isLoggable(PlatformLogger.FINER)) log.finer("Setting scroll bar " + this + " size to " + width + "x" + height); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Setting scroll bar " + this + " size to " + width + "x" + height); + } this.width = width; this.height = height; } @@ -164,7 +166,9 @@ abstract class XScrollbar { * @param paintAll paint the whole scrollbar if true, just the thumb is false */ void paint(Graphics g, Color colors[], boolean paintAll) { - if (log.isLoggable(PlatformLogger.FINER)) log.finer("Painting scrollbar " + this); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Painting scrollbar " + this); + } boolean useBufferedImage = false; Graphics2D g2 = null; @@ -335,7 +339,9 @@ abstract class XScrollbar { * Tell the scroller to start scrolling. */ void startScrolling() { - log.finer("Start scrolling on " + this); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Start scrolling on " + this); + } // Make sure that we scroll at least once scroll(); @@ -355,7 +361,9 @@ abstract class XScrollbar { * See 6243382 for more information */ void startScrollingInstance() { - log.finer("Start scrolling on " + this); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Start scrolling on " + this); + } // Make sure that we scroll at least once scroll(); @@ -368,7 +376,9 @@ abstract class XScrollbar { * See 6243382 for more information */ void stopScrollingInstance() { - log.finer("Stop scrolling on " + this); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Stop scrolling on " + this); + } i_scroller.stop(); } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XScrollbarPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XScrollbarPeer.java index e3eeee5caa9..f77519c6d3a 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XScrollbarPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XScrollbarPeer.java @@ -156,7 +156,9 @@ class XScrollbarPeer extends XComponentPeer implements ScrollbarPeer, XScrollbar public void handleJavaKeyEvent(KeyEvent event) { super.handleJavaKeyEvent(event); - if (log.isLoggable(PlatformLogger.FINEST)) log.finer("KeyEvent on scrollbar: " + event); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("KeyEvent on scrollbar: " + event); + } if (!(event.isConsumed()) && event.getID() == KeyEvent.KEY_RELEASED) { switch(event.getKeyCode()) { case KeyEvent.VK_UP: diff --git a/jdk/src/solaris/classes/sun/awt/X11/XSystemTrayPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XSystemTrayPeer.java index faa33eac9e2..2407ccb174e 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XSystemTrayPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XSystemTrayPeer.java @@ -58,7 +58,9 @@ public class XSystemTrayPeer implements SystemTrayPeer, XMSelectionListener { long selection_owner = selection.getOwner(SCREEN); available = (selection_owner != XConstants.None); - log.fine(" check if system tray is available. selection owner: " + selection_owner); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine(" check if system tray is available. selection owner: " + selection_owner); + } } public void ownerChanged(int screen, XMSelection sel, long newOwner, long data, long timestamp) { @@ -106,7 +108,9 @@ public class XSystemTrayPeer implements SystemTrayPeer, XMSelectionListener { void addTrayIcon(XTrayIconPeer tiPeer) throws AWTException { long selection_owner = selection.getOwner(SCREEN); - log.fine(" send SYSTEM_TRAY_REQUEST_DOCK message to owner: " + selection_owner); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine(" send SYSTEM_TRAY_REQUEST_DOCK message to owner: " + selection_owner); + } if (selection_owner == XConstants.None) { throw new AWTException("TrayIcon couldn't be displayed."); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java index 3b069f78f02..c87d7a1ec28 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XTextFieldPeer.java @@ -258,7 +258,9 @@ public class XTextFieldPeer extends XComponentPeer implements TextFieldPeer { } public void setBackground(Color c) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("target="+ target + ", old=" + background + ", new=" + c); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("target="+ target + ", old=" + background + ", new=" + c); + } background = c; if (xtext != null) { xtext.setBackground(c); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java index 220dff15466..68658d6b5a0 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XToolkit.java @@ -1492,7 +1492,9 @@ public final class XToolkit extends UNIXToolkit implements Runnable { } } catch (InterruptedException ie) { // Note: the returned timeStamp can be incorrect in this case. - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Catched exception, timeStamp may not be correct (ie = " + ie + ")"); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Catched exception, timeStamp may not be correct (ie = " + ie + ")"); + } } } finally { awtUnlock(); @@ -1657,7 +1659,9 @@ public final class XToolkit extends UNIXToolkit implements Runnable { name = "gnome." + name; setDesktopProperty(name, e.getValue()); - log.fine("name = " + name + " value = " + e.getValue()); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("name = " + name + " value = " + e.getValue()); + } // XXX: we probably want to do something smarter. In // particular, "Net" properties are of interest to the @@ -2467,13 +2471,14 @@ public final class XToolkit extends UNIXToolkit implements Runnable { // Wait for selection notify for oops on win long event_number = getEventNumber(); XAtom atom = XAtom.get("WM_S0"); - eventLog.finer("WM_S0 selection owner {0}", XlibWrapper.XGetSelectionOwner(getDisplay(), atom.getAtom())); + if (eventLog.isLoggable(PlatformLogger.FINER)) { + eventLog.finer("WM_S0 selection owner {0}", XlibWrapper.XGetSelectionOwner(getDisplay(), atom.getAtom())); + } XlibWrapper.XConvertSelection(getDisplay(), atom.getAtom(), XAtom.get("VERSION").getAtom(), oops.getAtom(), win.getWindow(), XConstants.CurrentTime); XSync(); - eventLog.finer("Requested OOPS"); long start = System.currentTimeMillis(); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java index 7bc452c968e..5ee6b65ec55 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XTrayIconPeer.java @@ -106,9 +106,11 @@ public class XTrayIconPeer implements TrayIconPeer, XConfigureEvent ce = ev.get_xconfigure(); - ctrLog.fine("ConfigureNotify on parent of {0}: {1}x{2}+{3}+{4} (old: {5}+{6})", + if (ctrLog.isLoggable(PlatformLogger.FINE)) { + ctrLog.fine("ConfigureNotify on parent of {0}: {1}x{2}+{3}+{4} (old: {5}+{6})", XTrayIconPeer.this, ce.get_width(), ce.get_height(), ce.get_x(), ce.get_y(), old_x, old_y); + } // A workaround for Gnome/Metacity (it doesn't affect the behaviour on KDE). // On Metacity the EmbeddedFrame's parent window bounds are larger @@ -128,14 +130,18 @@ public class XTrayIconPeer implements TrayIconPeer, // 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 // a few hops (even after reparenting) and we have to skip the intermediate ones. - ctrLog.fine("ConfigureNotify on parent of {0}. Skipping as intermediate resizing.", + if (ctrLog.isLoggable(PlatformLogger.FINE)) { + ctrLog.fine("ConfigureNotify on parent of {0}. Skipping as intermediate resizing.", XTrayIconPeer.this); + } return; } else if (ce.get_height() > TRAY_ICON_HEIGHT) { - ctrLog.fine("ConfigureNotify on parent of {0}. Centering by \"Y\".", + if (ctrLog.isLoggable(PlatformLogger.FINE)) { + ctrLog.fine("ConfigureNotify on parent of {0}. Centering by \"Y\".", XTrayIconPeer.this); + } XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), eframeParentID, ce.get_x(), @@ -147,8 +153,10 @@ public class XTrayIconPeer implements TrayIconPeer, } else if (ce.get_width() > TRAY_ICON_WIDTH) { - ctrLog.fine("ConfigureNotify on parent of {0}. Centering by \"X\".", + if (ctrLog.isLoggable(PlatformLogger.FINE)) { + ctrLog.fine("ConfigureNotify on parent of {0}. Centering by \"X\".", XTrayIconPeer.this); + } XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), eframeParentID, ce.get_x()+ce.get_width()/2 - TRAY_ICON_WIDTH/2, @@ -165,8 +173,10 @@ public class XTrayIconPeer implements TrayIconPeer, if (ex_height != 0) { - ctrLog.fine("ConfigureNotify on parent of {0}. Move detected. Centering by \"Y\".", + if (ctrLog.isLoggable(PlatformLogger.FINE)) { + ctrLog.fine("ConfigureNotify on parent of {0}. Move detected. Centering by \"Y\".", XTrayIconPeer.this); + } XlibWrapper.XMoveWindow(XToolkit.getDisplay(), eframeParentID, ce.get_x(), @@ -174,15 +184,19 @@ public class XTrayIconPeer implements TrayIconPeer, } else if (ex_width != 0) { - ctrLog.fine("ConfigureNotify on parent of {0}. Move detected. Centering by \"X\".", + if (ctrLog.isLoggable(PlatformLogger.FINE)) { + ctrLog.fine("ConfigureNotify on parent of {0}. Move detected. Centering by \"X\".", XTrayIconPeer.this); + } XlibWrapper.XMoveWindow(XToolkit.getDisplay(), eframeParentID, ce.get_x() + ex_width/2 - TRAY_ICON_WIDTH/2, ce.get_y()); } else { - ctrLog.fine("ConfigureNotify on parent of {0}. Move detected. Skipping.", + if (ctrLog.isLoggable(PlatformLogger.FINE)) { + ctrLog.fine("ConfigureNotify on parent of {0}. Move detected. Skipping.", XTrayIconPeer.this); + } } } old_x = ce.get_x(); diff --git a/jdk/src/solaris/classes/sun/awt/X11/XWINProtocol.java b/jdk/src/solaris/classes/sun/awt/X11/XWINProtocol.java index 2234b62ca8a..35b5cfe703e 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XWINProtocol.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XWINProtocol.java @@ -63,7 +63,9 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol { req.set_format(32); req.set_data(0, (WIN_STATE_MAXIMIZED_HORIZ | WIN_STATE_MAXIMIZED_VERT)); req.set_data(1, win_state); - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Sending WIN_STATE to root to change the state to " + win_state); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Sending WIN_STATE to root to change the state to " + win_state); + } try { XToolkit.awtLock(); XlibWrapper.XSendEvent(XToolkit.getDisplay(), @@ -111,7 +113,9 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol { win_state &= ~WIN_STATE_MAXIMIZED_HORIZ; } if ((old_win_state ^ win_state) != 0) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting WIN_STATE on " + window + " to change the state to " + win_state); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Setting WIN_STATE on " + window + " to change the state to " + win_state); + } XA_WIN_STATE.setCard32Property(window, win_state); } } @@ -156,7 +160,9 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol { req.set_data(0, layer == LAYER_NORMAL ? WIN_LAYER_NORMAL : WIN_LAYER_ONTOP); req.set_data(1, 0); req.set_data(2, 0); - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting layer " + layer + " by root message : " + req); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Setting layer " + layer + " by root message : " + req); + } XToolkit.awtLock(); try { XlibWrapper.XSendEvent(XToolkit.getDisplay(), @@ -171,7 +177,9 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol { } req.dispose(); } else { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting layer property to " + layer); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Setting layer property to " + layer); + } XA_WIN_LAYER.setCard32Property(window, layer == LAYER_NORMAL ? WIN_LAYER_NORMAL : WIN_LAYER_ONTOP); } } @@ -197,7 +205,9 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol { } WinWindow = checkAnchor(XA_WIN_SUPPORTING_WM_CHECK, XAtom.XA_CARDINAL); supportChecked = true; - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### " + this + " is active: " + (WinWindow != 0)); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### " + this + " is active: " + (WinWindow != 0)); + } } boolean active() { @@ -206,13 +216,17 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol { } boolean doStateProtocol() { boolean res = active() && checkProtocol(XA_WIN_PROTOCOLS, XA_WIN_STATE); - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### " + this + " supports state: " + res); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### " + this + " supports state: " + res); + } return res; } boolean doLayerProtocol() { boolean res = active() && checkProtocol(XA_WIN_PROTOCOLS, XA_WIN_LAYER); - if (log.isLoggable(PlatformLogger.FINE)) log.fine("### " + this + " supports layer: " + res); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("### " + this + " supports layer: " + res); + } return res; } } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XWM.java b/jdk/src/solaris/classes/sun/awt/X11/XWM.java index 7eb5f2f3639..6dd929460c9 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XWM.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XWM.java @@ -148,7 +148,9 @@ final class XWM XWM(int WMID) { this.WMID = WMID; initializeProtocols(); - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Window manager: " + toString()); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Window manager: " + toString()); + } } int getID() { return WMID; @@ -252,7 +254,7 @@ final class XWM * having a window manager running. I.e. it does not reparent * top level shells. */ - if (insLog.isLoggable(PlatformLogger.FINE)) { + if (insLog.isLoggable(PlatformLogger.FINER)) { insLog.finer("eXcursion means NO_WM"); } return true; @@ -270,7 +272,7 @@ final class XWM long selection_owner = XlibWrapper.XGetSelectionOwner(XToolkit.getDisplay(), XAtom.get(selection_name).getAtom()); - if (insLog.isLoggable(PlatformLogger.FINE)) { + if (insLog.isLoggable(PlatformLogger.FINER)) { insLog.finer("selection owner of " + selection_name + " is " + selection_owner); } @@ -299,7 +301,7 @@ final class XWM XToolkit.getDefaultRootWindow(), XConstants.CWEventMask, substruct.pData); - if (insLog.isLoggable(PlatformLogger.FINE)) { + if (insLog.isLoggable(PlatformLogger.FINER)) { insLog.finer("It looks like there is no WM thus NO_WM"); } } @@ -343,18 +345,26 @@ final class XWM byte[] bytes = XlibWrapper.getStringBytes(getter.getData()); String id = new String(bytes); - log.finer("ENLIGHTENMENT_COMMS is " + id); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("ENLIGHTENMENT_COMMS is " + id); + } // Parse WINID Pattern winIdPat = Pattern.compile("WINID\\s+(\\p{XDigit}{0,8})"); try { Matcher match = winIdPat.matcher(id); if (match.matches()) { - log.finest("Match group count: " + match.groupCount()); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("Match group count: " + match.groupCount()); + } String longId = match.group(1); - log.finest("Match group 1 " + longId); + if (log.isLoggable(PlatformLogger.FINEST)) { + log.finest("Match group 1 " + longId); + } long winid = Long.parseLong(longId, 16); - log.finer("Enlightenment communication window " + winid); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Enlightenment communication window " + winid); + } return winid; } else { log.finer("ENLIGHTENMENT_COMMS has wrong format"); @@ -407,7 +417,9 @@ final class XWM static boolean isCDE() { if (!XA_DT_SM_WINDOW_INFO.isInterned()) { - log.finer("{0} is not interned", XA_DT_SM_WINDOW_INFO); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("{0} is not interned", XA_DT_SM_WINDOW_INFO); + } return false; } @@ -438,7 +450,9 @@ final class XWM /* Now check that this window has _DT_SM_STATE_INFO (ignore contents) */ if (!XA_DT_SM_STATE_INFO.isInterned()) { - log.finer("{0} is not interned", XA_DT_SM_STATE_INFO); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("{0} is not interned", XA_DT_SM_STATE_INFO); + } return false; } WindowPropertyGetter getter2 = @@ -610,7 +624,9 @@ final class XWM */ if (!XA_ICEWM_WINOPTHINT.isInterned()) { - log.finer("{0} is not interned", XA_ICEWM_WINOPTHINT); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("{0} is not interned", XA_ICEWM_WINOPTHINT); + } return false; } @@ -643,7 +659,9 @@ final class XWM */ static boolean isIceWM() { if (!XA_ICEWM_WINOPTHINT.isInterned()) { - log.finer("{0} is not interned", XA_ICEWM_WINOPTHINT); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("{0} is not interned", XA_ICEWM_WINOPTHINT); + } return false; } @@ -654,7 +672,9 @@ final class XWM try { int status = getter.execute(); boolean res = (status == XConstants.Success && getter.getActualType() != 0); - log.finer("Status getting XA_ICEWM_WINOPTHINT: " + !res); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Status getting XA_ICEWM_WINOPTHINT: " + !res); + } return !res || isNetWMName("IceWM"); } finally { getter.dispose(); @@ -816,7 +836,9 @@ final class XWM } hints.set_flags(hints.get_flags() & ~mask); - if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(hints.get_flags())); + if (insLog.isLoggable(PlatformLogger.FINER)) { + insLog.finer("Setting hints, flags " + XlibWrapper.hintsToString(hints.get_flags())); + } XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(), window.getWindow(), hints.pData); @@ -873,7 +895,9 @@ final class XWM XAtomList decorDel = new XAtomList(); decorations = normalizeMotifDecor(decorations); - if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Setting OL_DECOR to " + Integer.toBinaryString(decorations)); + if (insLog.isLoggable(PlatformLogger.FINER)) { + insLog.finer("Setting OL_DECOR to " + Integer.toBinaryString(decorations)); + } if ((decorations & MWMConstants.MWM_DECOR_TITLE) == 0) { decorDel.add(XA_OL_DECOR_HEADER); } @@ -890,7 +914,9 @@ final class XWM insLog.finer("Deleting OL_DECOR"); XA_OL_DECOR_DEL.DeleteProperty(window); } else { - if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Setting OL_DECOR to " + decorDel); + if (insLog.isLoggable(PlatformLogger.FINER)) { + insLog.finer("Setting OL_DECOR to " + decorDel); + } XA_OL_DECOR_DEL.setAtomListProperty(window, decorDel); } } @@ -918,7 +944,9 @@ final class XWM hints.set_functions(functions); hints.set_decorations(decorations); - if (stateLog.isLoggable(PlatformLogger.FINER)) stateLog.finer("Setting MWM_HINTS to " + hints); + if (stateLog.isLoggable(PlatformLogger.FINER)) { + stateLog.finer("Setting MWM_HINTS to " + hints); + } window.setMWMHints(hints); } @@ -980,7 +1008,9 @@ final class XWM * Make specified shell resizable. */ static void setShellResizable(XDecoratedPeer window) { - if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting shell resizable " + window); + if (insLog.isLoggable(PlatformLogger.FINE)) { + insLog.fine("Setting shell resizable " + window); + } XToolkit.awtLock(); try { Rectangle shellBounds = window.getShellBounds(); @@ -1010,8 +1040,10 @@ final class XWM static void setShellNotResizable(XDecoratedPeer window, WindowDimensions newDimensions, Rectangle shellBounds, boolean justChangeSize) { - if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting non-resizable shell " + window + ", dimensions " + newDimensions + - ", shellBounds " + shellBounds +", just change size: " + justChangeSize); + if (insLog.isLoggable(PlatformLogger.FINE)) { + insLog.fine("Setting non-resizable shell " + window + ", dimensions " + newDimensions + + ", shellBounds " + shellBounds +", just change size: " + justChangeSize); + } XToolkit.awtLock(); try { /* Fix min/max size hints at the specified values */ @@ -1142,7 +1174,9 @@ final class XWM stateLog.finer("WithdrawnState"); return false; } else { - stateLog.finer("Window WM_STATE is " + wm_state); + if (stateLog.isLoggable(PlatformLogger.FINER)) { + stateLog.finer("Window WM_STATE is " + wm_state); + } } boolean is_state_change = false; if (e.get_atom() == XA_WM_STATE.getAtom()) { @@ -1151,7 +1185,9 @@ final class XWM for (XStateProtocol proto : getProtocols(XStateProtocol.class)) { is_state_change |= proto.isStateChange(e); - stateLog.finest(proto + ": is state changed = " + is_state_change); + if (stateLog.isLoggable(PlatformLogger.FINEST)) { + stateLog.finest(proto + ": is state changed = " + is_state_change); + } } return is_state_change; } @@ -1303,7 +1339,9 @@ final class XWM res = defaultInsets; } } - if (insLog.isLoggable(PlatformLogger.FINEST)) insLog.finest("WM guessed insets: " + res); + if (insLog.isLoggable(PlatformLogger.FINEST)) { + insLog.finest("WM guessed insets: " + res); + } return res; } /* @@ -1372,7 +1410,9 @@ final class XWM XNETProtocol net_protocol = getWM().getNETProtocol(); if (net_protocol != null && net_protocol.active()) { Insets insets = getInsetsFromProp(window, XA_NET_FRAME_EXTENTS); - insLog.fine("_NET_FRAME_EXTENTS: {0}", insets); + if (insLog.isLoggable(PlatformLogger.FINE)) { + insLog.fine("_NET_FRAME_EXTENTS: {0}", insets); + } if (insets != null) { return insets; @@ -1513,7 +1553,9 @@ final class XWM * [mwm, e!, kwin, fvwm2 ... ] */ Insets correctWM = XWM.getInsetsFromExtents(window); - insLog.finer("Got insets from property: {0}", correctWM); + if (insLog.isLoggable(PlatformLogger.FINER)) { + insLog.finer("Got insets from property: {0}", correctWM); + } if (correctWM == null) { correctWM = new Insets(0,0,0,0); @@ -1574,7 +1616,9 @@ final class XWM } case XWM.OTHER_WM: default: { /* this is very similar to the E! case above */ - insLog.finest("Getting correct insets for OTHER_WM/default, parent: {0}", parent); + if (insLog.isLoggable(PlatformLogger.FINEST)) { + insLog.finest("Getting correct insets for OTHER_WM/default, parent: {0}", parent); + } syncTopLevelPos(parent, lwinAttr); int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(), window, lwinAttr.pData); @@ -1601,8 +1645,10 @@ final class XWM && lwinAttr.get_width()+2*lwinAttr.get_border_width() == pattr.get_width() && lwinAttr.get_height()+2*lwinAttr.get_border_width() == pattr.get_height()) { - insLog.finest("Double reparenting detected, pattr({2})={0}, lwinAttr({3})={1}", + if (insLog.isLoggable(PlatformLogger.FINEST)) { + insLog.finest("Double reparenting detected, pattr({2})={0}, lwinAttr({3})={1}", lwinAttr, pattr, parent, window); + } lwinAttr.set_x(pattr.get_x()); lwinAttr.set_y(pattr.get_y()); lwinAttr.set_border_width(lwinAttr.get_border_width()+pattr.get_border_width()); @@ -1629,8 +1675,10 @@ final class XWM * widths and inner/outer distinction, so for the time * being, just ignore it. */ - insLog.finest("Attrs before calculation: pattr({2})={0}, lwinAttr({3})={1}", + if (insLog.isLoggable(PlatformLogger.FINEST)) { + insLog.finest("Attrs before calculation: pattr({2})={0}, lwinAttr({3})={1}", lwinAttr, pattr, parent, window); + } correctWM = new Insets(lwinAttr.get_y() + 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()), diff --git a/jdk/src/solaris/classes/sun/awt/X11/XWindow.java b/jdk/src/solaris/classes/sun/awt/X11/XWindow.java index e4d0ec6a68d..3eb4cc87269 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XWindow.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XWindow.java @@ -402,7 +402,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { ((Component)e.getSource()).dispatchEvent(e); } }, PeerEvent.ULTIMATE_PRIORITY_EVENT); - if (focusLog.isLoggable(PlatformLogger.FINER) && (e instanceof FocusEvent)) focusLog.finer("Sending " + e); + if (focusLog.isLoggable(PlatformLogger.FINER) && (e instanceof FocusEvent)) { + focusLog.finer("Sending " + e); + } XToolkit.postEvent(XToolkit.targetToAppContext(e.getSource()), pe); } @@ -660,7 +662,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { if (isEventDisabled(xev)) { return; } - if (eventLog.isLoggable(PlatformLogger.FINE)) eventLog.fine(xbe.toString()); + if (eventLog.isLoggable(PlatformLogger.FINE)) { + eventLog.fine(xbe.toString()); + } long when; int modifiers; boolean popupTrigger = false; @@ -694,9 +698,11 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { /* multiclick checking */ - if (eventLog.isLoggable(PlatformLogger.FINEST)) eventLog.finest("lastWindow = " + lastWindow + ", lastButton " - + lastButton + ", lastTime " + lastTime + ", multiClickTime " - + XToolkit.getMultiClickTime()); + if (eventLog.isLoggable(PlatformLogger.FINEST)) { + eventLog.finest("lastWindow = " + lastWindow + ", lastButton " + + lastButton + ", lastTime " + lastTime + ", multiClickTime " + + XToolkit.getMultiClickTime()); + } if (lastWindow == this && lastButton == lbutton && (when - lastTime) < XToolkit.getMultiClickTime()) { clickCount++; } else { @@ -885,7 +891,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { super.handleXCrossingEvent(xev); XCrossingEvent xce = xev.get_xcrossing(); - if (eventLog.isLoggable(PlatformLogger.FINEST)) eventLog.finest(xce.toString()); + if (eventLog.isLoggable(PlatformLogger.FINEST)) { + eventLog.finest(xce.toString()); + } if (xce.get_type() == XConstants.EnterNotify) { enterNotify(xce.get_window()); @@ -987,8 +995,10 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { Rectangle oldBounds = getBounds(); super.handleConfigureNotifyEvent(xev); - insLog.finer("Configure, {0}, event disabled: {1}", + if (insLog.isLoggable(PlatformLogger.FINER)) { + insLog.finer("Configure, {0}, event disabled: {1}", xev.get_xconfigure(), isEventDisabled(xev)); + } if (isEventDisabled(xev)) { return; } @@ -1007,7 +1017,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { public void handleMapNotifyEvent(XEvent xev) { super.handleMapNotifyEvent(xev); - log.fine("Mapped {0}", this); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Mapped {0}", this); + } if (isEventDisabled(xev)) { return; } @@ -1029,10 +1041,12 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { } private void dumpKeysymArray(XKeyEvent ev) { - keyEventLog.fine(" "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 0))+ - "\n "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 1))+ - "\n "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 2))+ - "\n "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 3))); + if (keyEventLog.isLoggable(PlatformLogger.FINE)) { + keyEventLog.fine(" "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 0))+ + "\n "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 1))+ + "\n "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 2))+ + "\n "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 3))); + } } /** Return unicode character or 0 if no correspondent character found. @@ -1057,14 +1071,20 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { //return (uni > 0? uni + 0x01000000 : 0); } void logIncomingKeyEvent(XKeyEvent ev) { - keyEventLog.fine("--XWindow.java:handleKeyEvent:"+ev); + if (keyEventLog.isLoggable(PlatformLogger.FINE)) { + keyEventLog.fine("--XWindow.java:handleKeyEvent:"+ev); + } dumpKeysymArray(ev); - keyEventLog.fine("XXXXXXXXXXXXXX javakeycode will be most probably:0x"+ Integer.toHexString(XKeysym.getJavaKeycodeOnly(ev))); + if (keyEventLog.isLoggable(PlatformLogger.FINE)) { + keyEventLog.fine("XXXXXXXXXXXXXX javakeycode will be most probably:0x"+ Integer.toHexString(XKeysym.getJavaKeycodeOnly(ev))); + } } public void handleKeyPress(XEvent xev) { super.handleKeyPress(xev); XKeyEvent ev = xev.get_xkey(); - if (eventLog.isLoggable(PlatformLogger.FINE)) eventLog.fine(ev.toString()); + if (eventLog.isLoggable(PlatformLogger.FINE)) { + eventLog.fine(ev.toString()); + } if (isEventDisabled(xev)) { return; } @@ -1153,7 +1173,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { if (unicodeKey > 0 && !isDeadKey) { - keyEventLog.fine("fire _TYPED on "+unicodeKey); + if (keyEventLog.isLoggable(PlatformLogger.FINE)) { + keyEventLog.fine("fire _TYPED on "+unicodeKey); + } postKeyEvent( java.awt.event.KeyEvent.KEY_TYPED, ev.get_time(), java.awt.event.KeyEvent.VK_UNDEFINED, @@ -1171,7 +1193,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { public void handleKeyRelease(XEvent xev) { super.handleKeyRelease(xev); XKeyEvent ev = xev.get_xkey(); - if (eventLog.isLoggable(PlatformLogger.FINE)) eventLog.fine(ev.toString()); + if (eventLog.isLoggable(PlatformLogger.FINE)) { + eventLog.fine(ev.toString()); + } if (isEventDisabled(xev)) { return; } @@ -1333,10 +1357,14 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { void updateSizeHints(int x, int y, int width, int height) { long flags = XUtilConstants.PSize | (isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition)); if (!isResizable()) { - log.finer("Window {0} is not resizable", this); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Window {0} is not resizable", this); + } flags |= XUtilConstants.PMinSize | XUtilConstants.PMaxSize; } else { - log.finer("Window {0} is resizable", this); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Window {0} is resizable", this); + } } setSizeHints(flags, x, y, width, height); } @@ -1344,10 +1372,14 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer { void updateSizeHints(int x, int y) { long flags = isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition); if (!isResizable()) { - log.finer("Window {0} is not resizable", this); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Window {0} is not resizable", this); + } flags |= XUtilConstants.PMinSize | XUtilConstants.PMaxSize | XUtilConstants.PSize; } else { - log.finer("Window {0} is resizable", this); + if (log.isLoggable(PlatformLogger.FINER)) { + log.finer("Window {0} is resizable", this); + } } setSizeHints(flags, x, y, width, height); } diff --git a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java index 4d867175597..d038dab878d 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java +++ b/jdk/src/solaris/classes/sun/awt/X11/XWindowPeer.java @@ -227,10 +227,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, if (owner != null) { ownerPeer = (XWindowPeer)owner.getPeer(); if (focusLog.isLoggable(PlatformLogger.FINER)) { - focusLog.fine("Owner is " + owner); - focusLog.fine("Owner peer is " + ownerPeer); - focusLog.fine("Owner X window " + Long.toHexString(ownerPeer.getWindow())); - focusLog.fine("Owner content X window " + Long.toHexString(ownerPeer.getContentWindow())); + focusLog.finer("Owner is " + owner); + focusLog.finer("Owner peer is " + ownerPeer); + focusLog.finer("Owner X window " + Long.toHexString(ownerPeer.getWindow())); + focusLog.finer("Owner content X window " + Long.toHexString(ownerPeer.getContentWindow())); } // as owner window may be an embedded window, we must get a toplevel window // to set as TRANSIENT_FOR hint @@ -239,8 +239,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, XToolkit.awtLock(); try { // Set WM_TRANSIENT_FOR - if (focusLog.isLoggable(PlatformLogger.FINE)) focusLog.fine("Setting transient on " + Long.toHexString(getWindow()) - + " for " + Long.toHexString(ownerWindow)); + if (focusLog.isLoggable(PlatformLogger.FINE)) { + focusLog.fine("Setting transient on " + Long.toHexString(getWindow()) + + " for " + Long.toHexString(ownerWindow)); + } setToplevelTransientFor(this, ownerPeer, false, true); // Set group leader @@ -777,7 +779,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, // override_redirect all we can do is check whether our parent // is active. If it is - we can freely synthesize focus transfer. // Luckily, this logic is already implemented in requestWindowFocus. - if (focusLog.isLoggable(PlatformLogger.FINE)) focusLog.fine("Requesting window focus"); + if (focusLog.isLoggable(PlatformLogger.FINE)) { + focusLog.fine("Requesting window focus"); + } requestWindowFocus(time, timeProvided); } @@ -803,7 +807,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, public void handleFocusEvent(XEvent xev) { XFocusChangeEvent xfe = xev.get_xfocus(); FocusEvent fe; - focusLog.fine("{0}", xfe); + if (focusLog.isLoggable(PlatformLogger.FINE)) { + focusLog.fine("{0}", xfe); + } if (isEventDisabled(xev)) { return; } @@ -986,7 +992,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, } private void updateAlwaysOnTop() { - log.fine("Promoting always-on-top state {0}", Boolean.valueOf(alwaysOnTop)); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Promoting always-on-top state {0}", Boolean.valueOf(alwaysOnTop)); + } XWM.getWM().setLayer(this, alwaysOnTop ? XLayerProtocol.LAYER_ALWAYS_ON_TOP : @@ -1511,7 +1519,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, synchronized(getStateLock()) { XDialogPeer blockerPeer = (XDialogPeer) AWTAccessor.getComponentAccessor().getPeer(d); if (blocked) { - log.fine("{0} is blocked by {1}", this, blockerPeer); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("{0} is blocked by {1}", this, blockerPeer); + } modalBlocker = d; if (isReparented() || XWM.isNonReparentingWM()) { @@ -1900,7 +1910,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, @Override public void xSetVisible(boolean visible) { - if (log.isLoggable(PlatformLogger.FINE)) log.fine("Setting visible on " + this + " to " + visible); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("Setting visible on " + this + " to " + visible); + } XToolkit.awtLock(); try { this.visible = visible; @@ -2053,7 +2065,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, // since it generates MOUSE_ENTERED/MOUSE_EXITED for frame and dialog. // (fix for 6390326) XBaseWindow target = XToolkit.windowToXWindow(xce.get_window()); - grabLog.finer(" - Grab event target {0}", target); + if (grabLog.isLoggable(PlatformLogger.FINER)) { + grabLog.finer(" - Grab event target {0}", target); + } if (target != null && target != this) { target.dispatchEvent(xev); return; @@ -2064,7 +2078,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, public void handleMotionNotify(XEvent xev) { XMotionEvent xme = xev.get_xmotion(); - if (grabLog.isLoggable(PlatformLogger.FINE)) { + if (grabLog.isLoggable(PlatformLogger.FINER)) { grabLog.finer("{0}, when grabbed {1}, contains {2}", xme, isGrabbed(), containsGlobal(xme.get_x_root(), xme.get_y_root())); } @@ -2095,7 +2109,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, xme.set_x(localCoord.x); xme.set_y(localCoord.y); } - grabLog.finer(" - Grab event target {0}", target); + if (grabLog.isLoggable(PlatformLogger.FINER)) { + grabLog.finer(" - Grab event target {0}", target); + } if (target != null) { if (target != getContentXWindow() && target != this) { target.dispatchEvent(xev); @@ -2138,7 +2154,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, // translation) XBaseWindow target = XToolkit.windowToXWindow(xbe.get_window()); try { - grabLog.finer(" - Grab event target {0} (press target {1})", target, pressTarget); + if (grabLog.isLoggable(PlatformLogger.FINER)) { + grabLog.finer(" - Grab event target {0} (press target {1})", target, pressTarget); + } if (xbe.get_type() == XConstants.ButtonPress && xbe.get_button() == XConstants.buttons[0]) { @@ -2172,7 +2190,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, // According to the specification of UngrabEvent, post it // when press occurs outside of the window and not on its owned windows if (xbe.get_type() == XConstants.ButtonPress) { - grabLog.fine("Generating UngrabEvent on {0} because not inside of shell", this); + if (grabLog.isLoggable(PlatformLogger.FINE)) { + grabLog.fine("Generating UngrabEvent on {0} because not inside of shell", this); + } postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource())); return; } @@ -2191,18 +2211,24 @@ class XWindowPeer extends XPanelPeer implements WindowPeer, // toplevel == null - outside of // hierarchy, toplevel is Dialog - should // send ungrab (but shouldn't for Window) - grabLog.fine("Generating UngrabEvent on {0} because hierarchy ended", this); + if (grabLog.isLoggable(PlatformLogger.FINE)) { + grabLog.fine("Generating UngrabEvent on {0} because hierarchy ended", this); + } postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource())); } } else { // toplevel is null - outside of hierarchy - grabLog.fine("Generating UngrabEvent on {0} because toplevel is null", this); + if (grabLog.isLoggable(PlatformLogger.FINE)) { + grabLog.fine("Generating UngrabEvent on {0} because toplevel is null", this); + } postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource())); return; } } else { // target doesn't map to XAWT window - outside of hierarchy - grabLog.fine("Generating UngrabEvent on because target is null {0}", this); + if (grabLog.isLoggable(PlatformLogger.FINE)) { + grabLog.fine("Generating UngrabEvent on because target is null {0}", this); + } postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource())); return; } diff --git a/jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java b/jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java index 7ad7386070a..fd66a03fda5 100644 --- a/jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java +++ b/jdk/src/solaris/classes/sun/awt/X11/generator/WrapperGenerator.java @@ -806,11 +806,15 @@ public class WrapperGenerator { } } if (s_size_32 != null && !s_size_32.equals(Integer.toString(acc_size_32))) { - log.fine("32 bits: The size of the structure " + stp.getName() + " " + s_size_32 + + if (log.isLoggable(Level.FINE)) { + log.fine("32 bits: The size of the structure " + stp.getName() + " " + s_size_32 + " is not equal to the accumulated size " +acc_size_32 + " of the fields"); + } } else if (s_size_64 != null && !s_size_64.equals(Integer.toString(acc_size_64))) { - log.fine("64 bits: The size of the structure " + stp.getName() + " " +s_size_64+ + if (log.isLoggable(Level.FINE)) { + log.fine("64 bits: The size of the structure " + stp.getName() + " " +s_size_64+ " is not equal to the accumulated size " +acc_size_64+" of the fields"); + } } } diff --git a/jdk/src/solaris/classes/sun/awt/X11InputMethod.java b/jdk/src/solaris/classes/sun/awt/X11InputMethod.java index b1939a67d9b..eb88cbd6cf4 100644 --- a/jdk/src/solaris/classes/sun/awt/X11InputMethod.java +++ b/jdk/src/solaris/classes/sun/awt/X11InputMethod.java @@ -326,8 +326,10 @@ public abstract class X11InputMethod extends InputMethodAdapter { return; if (lastXICFocussedComponent != null){ - if (log.isLoggable(PlatformLogger.FINE)) log.fine("XICFocused {0}, AWTFocused {1}", - lastXICFocussedComponent, awtFocussedComponent); + if (log.isLoggable(PlatformLogger.FINE)) { + log.fine("XICFocused {0}, AWTFocused {1}", + lastXICFocussedComponent, awtFocussedComponent); + } } if (pData == 0) { diff --git a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java index 37a257f1130..1fc17679f26 100644 --- a/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java +++ b/jdk/src/windows/classes/sun/awt/windows/WComponentPeer.java @@ -360,7 +360,9 @@ public abstract class WComponentPeer extends WObjectPeer } void handleJavaFocusEvent(FocusEvent fe) { - if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer(fe.toString()); + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer(fe.toString()); + } setFocus(fe.getID() == FocusEvent.FOCUS_GAINED); } @@ -693,7 +695,9 @@ public abstract class WComponentPeer extends WObjectPeer } boolean res = wpeer.requestWindowFocus(cause); - if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer("Requested window focus: " + res); + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer("Requested window focus: " + res); + } // If parent window can be made focused and has been made focused(synchronously) // then we can proceed with children, otherwise we retreat. if (!(res && parentWindow.isFocused())) { @@ -713,7 +717,9 @@ public abstract class WComponentPeer extends WObjectPeer } private boolean rejectFocusRequestHelper(String logMsg) { - if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer(logMsg); + if (focusLog.isLoggable(PlatformLogger.FINER)) { + focusLog.finer(logMsg); + } WKeyboardFocusManagerPeer.removeLastFocusRequest((Component)target); return false; } @@ -1080,10 +1086,9 @@ public abstract class WComponentPeer extends WObjectPeer @SuppressWarnings("deprecation") public void applyShape(Region shape) { if (shapeLog.isLoggable(PlatformLogger.FINER)) { - shapeLog.finer( - "*** INFO: Setting shape: PEER: " + this - + "; TARGET: " + target - + "; SHAPE: " + shape); + shapeLog.finer("*** INFO: Setting shape: PEER: " + this + + "; TARGET: " + target + + "; SHAPE: " + shape); } if (shape != null) {