8010297: Missing isLoggable() checks in logging code

Add isLoggable() checks

Reviewed-by: anthony, mchung, serb
This commit is contained in:
Laurent Bourges 2013-04-12 14:33:38 +04:00 committed by Anthony Petrov
parent 32995a0452
commit 2e5ce05576
50 changed files with 939 additions and 356 deletions

View File

@ -1152,7 +1152,9 @@ public class LWWindowPeer
if (!becomesFocused && if (!becomesFocused &&
(isGrabbing() || getOwnerFrameDialog(grabbingWindow) == this)) (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. // ungrab a simple window if its owner looses activation.
grabbingWindow.ungrab(); grabbingWindow.ungrab();
} }

View File

@ -208,7 +208,9 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
* aComponent is null * aComponent is null
*/ */
public Component getComponentAfter(Container aContainer, Component aComponent) { 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) { if (aContainer == null || aComponent == null) {
throw new IllegalArgumentException("aContainer and aComponent cannot be 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. // 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. // In that case we must quit the cycle, otherwise return the component found.
if (afterComp != null) { 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; return afterComp;
} }
aComponent = provider; aComponent = provider;
@ -255,7 +259,9 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
List<Component> cycle = getFocusTraversalCycle(aContainer); List<Component> 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); 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. // 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. // In that case we must quit the cycle, otherwise return the component found.
if (beforeComp != null) { 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; return beforeComp;
} }
aComponent = provider; aComponent = provider;
@ -349,7 +357,9 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
List<Component> cycle = getFocusTraversalCycle(aContainer); List<Component> 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); int index = getComponentIndex(cycle, aComponent);
@ -401,7 +411,9 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
public Component getFirstComponent(Container aContainer) { public Component getFirstComponent(Container aContainer) {
List<Component> cycle; List<Component> 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) { if (aContainer == null) {
throw new IllegalArgumentException("aContainer cannot be null"); throw new IllegalArgumentException("aContainer cannot be null");
@ -420,10 +432,14 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
} }
if (cycle.size() == 0) { 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; 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) { for (Component comp : cycle) {
if (accept(comp)) { if (accept(comp)) {
@ -451,7 +467,9 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
*/ */
public Component getLastComponent(Container aContainer) { public Component getLastComponent(Container aContainer) {
List<Component> cycle; List<Component> 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) { if (aContainer == null) {
throw new IllegalArgumentException("aContainer cannot be null"); throw new IllegalArgumentException("aContainer cannot be null");
@ -470,10 +488,14 @@ public class ContainerOrderFocusTraversalPolicy extends FocusTraversalPolicy
} }
if (cycle.size() == 0) { 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; 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--) { for (int i= cycle.size() - 1; i >= 0; i--) {
Component comp = cycle.get(i); Component comp = cycle.get(i);

View File

@ -310,7 +310,9 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
* <code>false</code> otherwise * <code>false</code> otherwise
*/ */
public boolean dispatchEvent(AWTEvent e) { 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()) { switch (e.getID()) {
case WindowEvent.WINDOW_GAINED_FOCUS: { case WindowEvent.WINDOW_GAINED_FOCUS: {
if (repostIfFollowsKeyEvents((WindowEvent)e)) { if (repostIfFollowsKeyEvents((WindowEvent)e)) {
@ -871,7 +873,9 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
} }
} }
if (ke != null) { if (ke != null) {
focusLog.finer("Pumping approved event {0}", ke); if (focusLog.isLoggable(PlatformLogger.FINER)) {
focusLog.finer("Pumping approved event {0}", ke);
}
enqueuedKeyEvents.removeFirst(); enqueuedKeyEvents.removeFirst();
} }
} }
@ -920,7 +924,9 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
// The fix is rolled out. // The fix is rolled out.
if (ke.getWhen() > marker.after) { if (ke.getWhen() > marker.after) {
focusLog.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); enqueuedKeyEvents.addLast(ke);
return true; return true;
} }
@ -932,7 +938,9 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
} }
case FocusEvent.FOCUS_GAINED: 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(); dumpMarkers();
// Search the marker list for the first marker tied to // Search the marker list for the first marker tied to
// the Component which just gained focus. Then remove // the Component which just gained focus. Then remove
@ -959,7 +967,9 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
} }
} else { } else {
// Exception condition - event without marker // 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"); focusLog.finest("Markers after FOCUS_GAINED");
@ -1198,8 +1208,10 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
return; return;
} }
focusLog.finer("Enqueue at {0} for {1}", if (focusLog.isLoggable(PlatformLogger.FINER)) {
focusLog.finer("Enqueue at {0} for {1}",
after, untilFocused); after, untilFocused);
}
int insertionIndex = 0, int insertionIndex = 0,
i = typeAheadMarkers.size(); i = typeAheadMarkers.size();
@ -1238,8 +1250,10 @@ public class DefaultKeyboardFocusManager extends KeyboardFocusManager {
return; return;
} }
focusLog.finer("Dequeue at {0} for {1}", if (focusLog.isLoggable(PlatformLogger.FINER)) {
focusLog.finer("Dequeue at {0} for {1}",
after, untilFocused); after, untilFocused);
}
TypeAheadMarker marker; TypeAheadMarker marker;
ListIterator<TypeAheadMarker> iter = typeAheadMarkers.listIterator ListIterator<TypeAheadMarker> iter = typeAheadMarkers.listIterator

View File

@ -138,7 +138,9 @@ class EventDispatchThread extends Thread {
} }
void addEventFilter(EventFilter filter) { 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) { synchronized (eventFilters) {
if (!eventFilters.contains(filter)) { if (!eventFilters.contains(filter)) {
if (filter instanceof ModalEventFilter) { if (filter instanceof ModalEventFilter) {
@ -162,7 +164,9 @@ class EventDispatchThread extends Thread {
} }
void removeEventFilter(EventFilter filter) { 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) { synchronized (eventFilters) {
eventFilters.remove(filter); eventFilters.remove(filter);
} }

View File

@ -2410,7 +2410,7 @@ public abstract class KeyboardFocusManager
Window nativeFocusedWindow = thisManager.getNativeFocusedWindow(); Window nativeFocusedWindow = thisManager.getNativeFocusedWindow();
if (focusLog.isLoggable(PlatformLogger.FINER)) { if (focusLog.isLoggable(PlatformLogger.FINER)) {
focusLog.finer("SNFH for {0} in {1}", focusLog.finer("SNFH for {0} in {1}",
String.valueOf(descendant), String.valueOf(heavyweight)); String.valueOf(descendant), String.valueOf(heavyweight));
} }
if (focusLog.isLoggable(PlatformLogger.FINEST)) { if (focusLog.isLoggable(PlatformLogger.FINEST)) {
focusLog.finest("0. Current focus owner {0}", focusLog.finest("0. Current focus owner {0}",
@ -2478,9 +2478,10 @@ public abstract class KeyboardFocusManager
manager.enqueueKeyEvents(time, descendant); manager.enqueueKeyEvents(time, descendant);
} }
if (focusLog.isLoggable(PlatformLogger.FINEST)) if (focusLog.isLoggable(PlatformLogger.FINEST)) {
focusLog.finest("3. SNFH_HANDLED for lightweight" + focusLog.finest("3. SNFH_HANDLED for lightweight" +
descendant + " in " + heavyweight); descendant + " in " + heavyweight);
}
return SNFH_SUCCESS_HANDLED; return SNFH_SUCCESS_HANDLED;
} else { } else {
if (!focusedWindowChangeAllowed) { if (!focusedWindowChangeAllowed) {
@ -2501,8 +2502,9 @@ public abstract class KeyboardFocusManager
(hwFocusRequest != null) (hwFocusRequest != null)
? hwFocusRequest.heavyweight ? hwFocusRequest.heavyweight
: nativeFocusedWindow)) { : nativeFocusedWindow)) {
if (focusLog.isLoggable(PlatformLogger.FINEST)) if (focusLog.isLoggable(PlatformLogger.FINEST)) {
focusLog.finest("4. SNFH_FAILURE for " + descendant); focusLog.finest("4. SNFH_FAILURE for " + descendant);
}
return SNFH_FAILURE; return SNFH_FAILURE;
} }
} }
@ -2511,8 +2513,9 @@ public abstract class KeyboardFocusManager
heavyweightRequests.add heavyweightRequests.add
(new HeavyweightFocusRequest(heavyweight, descendant, (new HeavyweightFocusRequest(heavyweight, descendant,
temporary, cause)); temporary, cause));
if (focusLog.isLoggable(PlatformLogger.FINEST)) if (focusLog.isLoggable(PlatformLogger.FINEST)) {
focusLog.finest("5. SNFH_PROCEED for " + descendant); focusLog.finest("5. SNFH_PROCEED for " + descendant);
}
return SNFH_SUCCESS_PROCEED; return SNFH_SUCCESS_PROCEED;
} }
} }

View File

@ -165,8 +165,10 @@ class WaitDispatchSupport implements SecondaryLoop {
*/ */
@Override @Override
public boolean enter() { public boolean enter() {
log.fine("enter(): blockingEDT=" + keepBlockingEDT.get() + if (log.isLoggable(PlatformLogger.FINE)) {
", blockingCT=" + keepBlockingCT.get()); log.fine("enter(): blockingEDT=" + keepBlockingEDT.get() +
", blockingCT=" + keepBlockingCT.get());
}
if (!keepBlockingEDT.compareAndSet(false, true)) { if (!keepBlockingEDT.compareAndSet(false, true)) {
log.fine("The secondary loop is already running, aborting"); log.fine("The secondary loop is already running, aborting");
@ -190,9 +192,13 @@ class WaitDispatchSupport implements SecondaryLoop {
Thread currentThread = Thread.currentThread(); Thread currentThread = Thread.currentThread();
if (currentThread == dispatchThread) { if (currentThread == dispatchThread) {
log.finest("On dispatch thread: " + dispatchThread); if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("On dispatch thread: " + dispatchThread);
}
if (interval != 0) { 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() { timer.schedule(timerTask = new TimerTask() {
@Override @Override
public void run() { public void run() {
@ -207,7 +213,9 @@ class WaitDispatchSupport implements SecondaryLoop {
SequencedEvent currentSE = KeyboardFocusManager. SequencedEvent currentSE = KeyboardFocusManager.
getCurrentKeyboardFocusManager().getCurrentSequencedEvent(); getCurrentKeyboardFocusManager().getCurrentSequencedEvent();
if (currentSE != null) { if (currentSE != null) {
log.fine("Dispose current SequencedEvent: " + currentSE); if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("Dispose current SequencedEvent: " + currentSE);
}
currentSE.dispose(); currentSE.dispose();
} }
// In case the exit() method is called before starting // In case the exit() method is called before starting
@ -223,7 +231,9 @@ class WaitDispatchSupport implements SecondaryLoop {
} }
}); });
} else { } else {
log.finest("On non-dispatch thread: " + currentThread); if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("On non-dispatch thread: " + currentThread);
}
synchronized (getTreeLock()) { synchronized (getTreeLock()) {
if (filter != null) { if (filter != null) {
dispatchThread.addEventFilter(filter); dispatchThread.addEventFilter(filter);
@ -247,9 +257,13 @@ class WaitDispatchSupport implements SecondaryLoop {
getTreeLock().wait(); getTreeLock().wait();
} }
} }
log.fine("waitDone " + keepBlockingEDT.get() + " " + keepBlockingCT.get()); if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("waitDone " + keepBlockingEDT.get() + " " + keepBlockingCT.get());
}
} catch (InterruptedException e) { } catch (InterruptedException e) {
log.fine("Exception caught while waiting: " + e); if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("Exception caught while waiting: " + e);
}
} finally { } finally {
if (filter != null) { if (filter != null) {
dispatchThread.removeEventFilter(filter); dispatchThread.removeEventFilter(filter);
@ -270,8 +284,10 @@ class WaitDispatchSupport implements SecondaryLoop {
* @inheritDoc * @inheritDoc
*/ */
public boolean exit() { public boolean exit() {
log.fine("exit(): blockingEDT=" + keepBlockingEDT.get() + if (log.isLoggable(PlatformLogger.FINE)) {
", blockingCT=" + keepBlockingCT.get()); log.fine("exit(): blockingEDT=" + keepBlockingEDT.get() +
", blockingCT=" + keepBlockingCT.get());
}
if (keepBlockingEDT.compareAndSet(true, false)) { if (keepBlockingEDT.compareAndSet(true, false)) {
wakeupEDT(); wakeupEDT();
return true; return true;
@ -295,7 +311,9 @@ class WaitDispatchSupport implements SecondaryLoop {
}; };
private void wakeupEDT() { private void wakeupEDT() {
log.finest("wakeupEDT(): EDT == " + dispatchThread); if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("wakeupEDT(): EDT == " + dispatchThread);
}
EventQueue eq = dispatchThread.getEventQueue(); EventQueue eq = dispatchThread.getEventQueue();
eq.postEvent(new PeerEvent(this, wakingRunnable, PeerEvent.PRIORITY_EVENT)); eq.postEvent(new PeerEvent(this, wakingRunnable, PeerEvent.PRIORITY_EVENT));
} }

View File

@ -523,8 +523,7 @@ class BufferStrategyPaintManager extends RepaintManager.PaintManager {
if (bufferStrategy.contentsRestored()) { if (bufferStrategy.contentsRestored()) {
contentsLost = true; contentsLost = true;
if (LOGGER.isLoggable(PlatformLogger.FINER)) { if (LOGGER.isLoggable(PlatformLogger.FINER)) {
LOGGER.finer( LOGGER.finer("prepare: contents restored in prepare");
"prepare: contents restored in prepare");
} }
} }
} }

View File

@ -271,7 +271,9 @@ public class SortingFocusTraversalPolicy
// Null result means that we overstepped the limit of the FTP's cycle. // 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. // In that case we must quit the cycle, otherwise return the component found.
if (afterComp != null) { 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; return afterComp;
} }
aComponent = provider; aComponent = provider;
@ -279,7 +281,9 @@ public class SortingFocusTraversalPolicy
List<Component> cycle = getFocusTraversalCycle(aContainer); List<Component> 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); 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. // 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. // In that case we must quit the cycle, otherwise return the component found.
if (beforeComp != null) { 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; return beforeComp;
} }
aComponent = provider; aComponent = provider;
@ -373,7 +379,9 @@ public class SortingFocusTraversalPolicy
List<Component> cycle = getFocusTraversalCycle(aContainer); List<Component> 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); int index = getComponentIndex(cycle, aComponent);
@ -424,7 +432,9 @@ public class SortingFocusTraversalPolicy
public Component getFirstComponent(Container aContainer) { public Component getFirstComponent(Container aContainer) {
List<Component> cycle; List<Component> 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) { if (aContainer == null) {
throw new IllegalArgumentException("aContainer cannot be null"); throw new IllegalArgumentException("aContainer cannot be null");
} }
@ -436,10 +446,14 @@ public class SortingFocusTraversalPolicy
} }
if (cycle.size() == 0) { 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; 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) { for (Component comp : cycle) {
if (accept(comp)) { if (accept(comp)) {
@ -466,7 +480,9 @@ public class SortingFocusTraversalPolicy
*/ */
public Component getLastComponent(Container aContainer) { public Component getLastComponent(Container aContainer) {
List<Component> cycle; List<Component> 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) { if (aContainer == null) {
throw new IllegalArgumentException("aContainer cannot be null"); throw new IllegalArgumentException("aContainer cannot be null");
@ -479,10 +495,14 @@ public class SortingFocusTraversalPolicy
} }
if (cycle.size() == 0) { 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; 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--) { for (int i= cycle.size() - 1; i >= 0; i--) {
Component comp = cycle.get(i); Component comp = cycle.get(i);

View File

@ -375,11 +375,13 @@ public final class AWTAutoShutdown implements Runnable {
} }
final void dumpPeers(final PlatformLogger aLog) { final void dumpPeers(final PlatformLogger aLog) {
synchronized (activationLock) { if (aLog.isLoggable(PlatformLogger.FINE)) {
synchronized (mainLock) { synchronized (activationLock) {
aLog.fine("Mapped peers:"); synchronized (mainLock) {
for (Object key : peerMap.keySet()) { aLog.fine("Mapped peers:");
aLog.fine(key + "->" + peerMap.get(key)); for (Object key : peerMap.keySet()) {
aLog.fine(key + "->" + peerMap.get(key));
}
} }
} }
} }

View File

@ -129,7 +129,7 @@ final class DebugSettings {
// echo the initial property settings to stdout // echo the initial property settings to stdout
if (log.isLoggable(PlatformLogger.FINE)) { if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("DebugSettings:\n{0}" + this); log.fine("DebugSettings:\n{0}", this);
} }
} }

View File

@ -57,8 +57,9 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag
public void clearGlobalFocusOwner(Window activeWindow) { public void clearGlobalFocusOwner(Window activeWindow) {
if (activeWindow != null) { if (activeWindow != null) {
Component focusOwner = activeWindow.getFocusOwner(); Component focusOwner = activeWindow.getFocusOwner();
if (focusLog.isLoggable(PlatformLogger.FINE)) if (focusLog.isLoggable(PlatformLogger.FINE)) {
focusLog.fine("Clearing global focus owner " + focusOwner); focusLog.fine("Clearing global focus owner " + focusOwner);
}
if (focusOwner != null) { if (focusOwner != null) {
FocusEvent fl = new CausedFocusEvent(focusOwner, FocusEvent.FOCUS_LOST, false, null, FocusEvent fl = new CausedFocusEvent(focusOwner, FocusEvent.FOCUS_LOST, false, null,
CausedFocusEvent.Cause.CLEAR_GLOBAL_FOCUS_OWNER); CausedFocusEvent.Cause.CLEAR_GLOBAL_FOCUS_OWNER);
@ -126,16 +127,18 @@ public abstract class KeyboardFocusManagerPeerImpl implements KeyboardFocusManag
FocusEvent fl = new CausedFocusEvent(currentOwner, FocusEvent.FOCUS_LOST, FocusEvent fl = new CausedFocusEvent(currentOwner, FocusEvent.FOCUS_LOST,
false, lightweightChild, cause); false, lightweightChild, cause);
if (focusLog.isLoggable(PlatformLogger.FINER)) if (focusLog.isLoggable(PlatformLogger.FINER)) {
focusLog.finer("Posting focus event: " + fl); focusLog.finer("Posting focus event: " + fl);
}
SunToolkit.postEvent(SunToolkit.targetToAppContext(currentOwner), fl); SunToolkit.postEvent(SunToolkit.targetToAppContext(currentOwner), fl);
} }
FocusEvent fg = new CausedFocusEvent(lightweightChild, FocusEvent.FOCUS_GAINED, FocusEvent fg = new CausedFocusEvent(lightweightChild, FocusEvent.FOCUS_GAINED,
false, currentOwner, cause); false, currentOwner, cause);
if (focusLog.isLoggable(PlatformLogger.FINER)) if (focusLog.isLoggable(PlatformLogger.FINER)) {
focusLog.finer("Posting focus event: " + fg); focusLog.finer("Posting focus event: " + fg);
}
SunToolkit.postEvent(SunToolkit.targetToAppContext(lightweightChild), fg); SunToolkit.postEvent(SunToolkit.targetToAppContext(lightweightChild), fg);
return true; return true;
} }

View File

@ -487,7 +487,9 @@ public abstract class SunToolkit extends Toolkit
setSystemGenerated(event); setSystemGenerated(event);
AppContext eventContext = targetToAppContext(event.getSource()); AppContext eventContext = targetToAppContext(event.getSource());
if (eventContext != null && !eventContext.equals(appContext)) { 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 postEventQueue =
(PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY); (PostEventQueue)appContext.get(POST_EVENT_QUEUE_KEY);

View File

@ -387,7 +387,9 @@ public class InputContext extends java.awt.im.InputContext
} }
previousInputMethod = null; 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) { if (inputMethod instanceof InputMethodAdapter) {
((InputMethodAdapter) inputMethod).setClientComponent(currentClientComponent); ((InputMethodAdapter) inputMethod).setClientComponent(currentClientComponent);
} }
@ -884,14 +886,16 @@ public class InputContext extends java.awt.im.InputContext
} }
private void logCreationFailed(Throwable throwable) { 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"); 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() { InputMethodLocator getInputMethodLocator() {

View File

@ -2065,7 +2065,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
ret = new NegotiateAuthentication(new HttpCallerInfo(authhdr.getHttpCallerInfo(), "Kerberos")); ret = new NegotiateAuthentication(new HttpCallerInfo(authhdr.getHttpCallerInfo(), "Kerberos"));
break; break;
case UNKNOWN: case UNKNOWN:
logger.finest("Unknown/Unsupported authentication scheme: " + scheme); if (logger.isLoggable(PlatformLogger.FINEST)) {
logger.finest("Unknown/Unsupported authentication scheme: " + scheme);
}
/*fall through*/ /*fall through*/
default: default:
throw new AssertionError("should not reach here"); throw new AssertionError("should not reach here");
@ -2222,7 +2224,9 @@ public class HttpURLConnection extends java.net.HttpURLConnection {
} }
break; break;
case UNKNOWN: case UNKNOWN:
logger.finest("Unknown/Unsupported authentication scheme: " + scheme); if (logger.isLoggable(PlatformLogger.FINEST)) {
logger.finest("Unknown/Unsupported authentication scheme: " + scheme);
}
/*fall through*/ /*fall through*/
default: default:
throw new AssertionError("should not reach here"); throw new AssertionError("should not reach here");

View File

@ -142,6 +142,8 @@ class NTLMAuthenticationProxy {
static void finest(Exception e) { static void finest(Exception e) {
PlatformLogger logger = HttpURLConnection.getHttpLogger(); PlatformLogger logger = HttpURLConnection.getHttpLogger();
logger.finest("NTLMAuthenticationProxy: " + e); if (logger.isLoggable(PlatformLogger.FINEST)) {
logger.finest("NTLMAuthenticationProxy: " + e);
}
} }
} }

View File

@ -76,7 +76,9 @@ public abstract class Negotiator {
private static void finest(Exception e) { private static void finest(Exception e) {
PlatformLogger logger = HttpURLConnection.getHttpLogger(); PlatformLogger logger = HttpURLConnection.getHttpLogger();
logger.finest("NegotiateAuthentication: " + e); if (logger.isLoggable(PlatformLogger.FINEST)) {
logger.finest("NegotiateAuthentication: " + e);
}
} }
} }

View File

@ -55,7 +55,9 @@ class XAWTXSettings extends XSettings implements XMSelectionListener {
} }
void initXSettings() { 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 = new XMSelection("_XSETTINGS");
settings.addSelectionListener(this); settings.addSelectionListener(this);
initPerScreenXSettings(); initPerScreenXSettings();
@ -66,21 +68,29 @@ class XAWTXSettings extends XSettings implements XMSelectionListener {
} }
public void ownerDeath(int screen, XMSelection sel, long deadOwner) { 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) { 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) { 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); updateXSettings(screen,owner);
} }
void initPerScreenXSettings() { 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, * 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) { 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) { if (0 == owner) {
return null; return null;
} }
@ -128,13 +140,17 @@ class XAWTXSettings extends XSettings implements XMSelectionListener {
int status = getter.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance()); int status = getter.execute(XErrorHandler.IgnoreBadWindowHandler.getInstance());
if (status != XConstants.Success || getter.getData() == 0) { 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; settings = null;
} }
long ptr = getter.getData(); 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()); byte array[] = Native.toBytes(ptr,getter.getNumberOfItems());
if (array != null) { if (array != null) {
settings = update(array); settings = update(array);

View File

@ -426,7 +426,7 @@ abstract public class XBaseMenuWindow extends XWindow {
try { try {
synchronized(getMenuTreeLock()) { synchronized(getMenuTreeLock()) {
if (showingSubmenu != submenuToShow) { if (showingSubmenu != submenuToShow) {
if (log.isLoggable(PlatformLogger.FINER)) { if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("Changing showing submenu"); log.finest("Changing showing submenu");
} }
if (showingSubmenu != null) { if (showingSubmenu != null) {
@ -1122,7 +1122,9 @@ abstract public class XBaseMenuWindow extends XWindow {
* that grabs input focus * that grabs input focus
*/ */
void doHandleJavaKeyEvent(KeyEvent event) { 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) { if (event.getID() != KeyEvent.KEY_PRESSED) {
return; return;
} }

View File

@ -160,7 +160,9 @@ public class XBaseWindow {
* with class-specific values and perform post-initialization actions. * with class-specific values and perform post-initialization actions.
*/ */
void postInit(XCreateWindowParams params) { 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(); updateWMName();
// Set WM_CLIENT_LEADER property // 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) { 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(); XToolkit.awtLock();
try { try {
XSizeHints hints = getHints(); XSizeHints hints = getHints();
@ -541,8 +545,10 @@ public class XBaseWindow {
flags |= XUtilConstants.PWinGravity; flags |= XUtilConstants.PWinGravity;
hints.set_flags(flags); hints.set_flags(flags);
hints.set_win_gravity((int)XConstants.NorthWestGravity); hints.set_win_gravity((int)XConstants.NorthWestGravity);
if (insLog.isLoggable(PlatformLogger.FINER)) insLog.finer("Setting hints, resulted flags " + XlibWrapper.hintsToString(flags) + if (insLog.isLoggable(PlatformLogger.FINER)) {
", values " + hints); insLog.finer("Setting hints, resulted flags " + XlibWrapper.hintsToString(flags) +
", values " + hints);
}
XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(), getWindow(), hints.pData); XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(), getWindow(), hints.pData);
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
@ -593,7 +599,9 @@ public class XBaseWindow {
public void xRequestFocus(long time) { public void xRequestFocus(long time) {
XToolkit.awtLock(); XToolkit.awtLock();
try { 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); XlibWrapper.XSetInputFocus2(XToolkit.getDisplay(), getWindow(), time);
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
@ -602,7 +610,9 @@ public class XBaseWindow {
public void xRequestFocus() { public void xRequestFocus() {
XToolkit.awtLock(); XToolkit.awtLock();
try { 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()); XlibWrapper.XSetInputFocus(XToolkit.getDisplay(), getWindow());
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
@ -619,7 +629,9 @@ public class XBaseWindow {
} }
public void xSetVisible(boolean visible) { 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(); XToolkit.awtLock();
try { try {
this.visible = visible; this.visible = visible;
@ -704,7 +716,9 @@ public class XBaseWindow {
insLog.warning("Attempt to resize uncreated window"); insLog.warning("Attempt to resize uncreated window");
throw new IllegalStateException("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); width = Math.max(MIN_SIZE, width);
height = Math.max(MIN_SIZE, height); height = Math.max(MIN_SIZE, height);
XToolkit.awtLock(); XToolkit.awtLock();
@ -820,7 +834,9 @@ public class XBaseWindow {
* The active grab overrides activated automatic grab. * The active grab overrides activated automatic grab.
*/ */
public boolean grabInput() { public boolean grabInput() {
grabLog.fine("Grab input on {0}", this); if (grabLog.isLoggable(PlatformLogger.FINE)) {
grabLog.fine("Grab input on {0}", this);
}
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
@ -883,7 +899,9 @@ public class XBaseWindow {
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
XBaseWindow grabWindow = XAwtState.getGrabWindow(); 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) { if (grabWindow != null) {
grabWindow.ungrabInputImpl(); grabWindow.ungrabInputImpl();
if (!XToolkit.getSunAwtDisableGrab()) { if (!XToolkit.getSunAwtDisableGrab()) {
@ -1021,7 +1039,9 @@ public class XBaseWindow {
} }
public void handleConfigureNotifyEvent(XEvent xev) { public void handleConfigureNotifyEvent(XEvent xev) {
XConfigureEvent xe = xev.get_xconfigure(); XConfigureEvent xe = xev.get_xconfigure();
insLog.finer("Configure, {0}", xe); if (insLog.isLoggable(PlatformLogger.FINER)) {
insLog.finer("Configure, {0}", xe);
}
x = xe.get_x(); x = xe.get_x();
y = xe.get_y(); y = xe.get_y();
width = xe.get_width(); width = xe.get_width();
@ -1072,7 +1092,9 @@ public class XBaseWindow {
} }
public void dispatchEvent(XEvent xev) { 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(); int type = xev.get_type();
if (isDisposed()) { if (isDisposed()) {

View File

@ -217,7 +217,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
* Called when component receives focus * Called when component receives focus
*/ */
public void focusGained(FocusEvent e) { public void focusGained(FocusEvent e) {
focusLog.fine("{0}", e); if (focusLog.isLoggable(PlatformLogger.FINE)) {
focusLog.fine("{0}", e);
}
bHasFocus = true; bHasFocus = true;
} }
@ -225,7 +227,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
* Called when component loses focus * Called when component loses focus
*/ */
public void focusLost(FocusEvent e) { public void focusLost(FocusEvent e) {
focusLog.fine("{0}", e); if (focusLog.isLoggable(PlatformLogger.FINE)) {
focusLog.fine("{0}", e);
}
bHasFocus = false; bHasFocus = false;
} }
@ -297,8 +301,10 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
case XKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED: case XKeyboardFocusManagerPeer.SNFH_SUCCESS_PROCEED:
// Currently we just generate focus events like we deal with lightweight instead of calling // Currently we just generate focus events like we deal with lightweight instead of calling
// XSetInputFocus on native window // XSetInputFocus on native window
if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer("Proceeding with request to " + if (focusLog.isLoggable(PlatformLogger.FINER)) {
lightweightChild + " in " + target); focusLog.finer("Proceeding with request to " +
lightweightChild + " in " + target);
}
/** /**
* The problems with requests in non-focused window arise because shouldNativelyFocusHeavyweight * 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 * 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); 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) // If parent window can be made focused and has been made focused(synchronously)
// then we can proceed with children, otherwise we retreat. // then we can proceed with children, otherwise we retreat.
if (!(res && parentWindow.isFocused())) { if (!(res && parentWindow.isFocused())) {
@ -342,13 +350,17 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
} }
private boolean rejectFocusRequestHelper(String logMsg) { private boolean rejectFocusRequestHelper(String logMsg) {
if (focusLog.isLoggable(PlatformLogger.FINER)) focusLog.finer(logMsg); if (focusLog.isLoggable(PlatformLogger.FINER)) {
focusLog.finer(logMsg);
}
XKeyboardFocusManagerPeer.removeLastFocusRequest(target); XKeyboardFocusManagerPeer.removeLastFocusRequest(target);
return false; return false;
} }
void handleJavaFocusEvent(AWTEvent e) { 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) { if (e.getID() == FocusEvent.FOCUS_GAINED) {
focusGained((FocusEvent)e); focusGained((FocusEvent)e);
} else { } else {
@ -631,7 +643,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
} }
public void setBackground(Color c) { 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()) { synchronized (getStateLock()) {
background = c; background = c;
} }
@ -640,7 +654,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
} }
public void setForeground(Color c) { 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()) { synchronized (getStateLock()) {
foreground = c; foreground = c;
} }
@ -659,7 +675,9 @@ public class XComponentPeer extends XWindow implements ComponentPeer, DropTarget
* @since JDK1.0 * @since JDK1.0
*/ */
public FontMetrics getFontMetrics(Font font) { 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); return sun.font.FontDesignMetrics.getMetrics(font);
} }

View File

@ -115,8 +115,10 @@ public final class XContentWindow extends XWindow {
if (in != null) { if (in != null) {
newBounds.setLocation(-in.left, -in.top); newBounds.setLocation(-in.left, -in.top);
} }
if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting content bounds {0}, old bounds {1}", if (insLog.isLoggable(PlatformLogger.FINE)) {
newBounds, getBounds()); insLog.fine("Setting content bounds {0}, old bounds {1}",
newBounds, getBounds());
}
// Fix for 5023533: // Fix for 5023533:
// Change in the size of the content window means, well, change of the size // Change in the size of the content window means, well, change of the size
// Change in the location of the content window means change in insets // Change in the location of the content window means change in insets

View File

@ -78,7 +78,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
Rectangle bounds = (Rectangle)params.get(BOUNDS); Rectangle bounds = (Rectangle)params.get(BOUNDS);
dimensions = new WindowDimensions(bounds, getRealInsets(), false); dimensions = new WindowDimensions(bounds, getRealInsets(), false);
params.put(BOUNDS, dimensions.getClientRect()); params.put(BOUNDS, dimensions.getClientRect());
insLog.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 // Deny default processing of these events on the shell - proxy will take care of
// them instead // them instead
@ -179,7 +181,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
} }
public void setTitle(String title) { 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; winAttr.title = title;
updateWMName(); updateWMName();
} }
@ -227,7 +231,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
// If we somehow received focus events forward it instead to proxy // If we somehow received focus events forward it instead to proxy
// FIXME: Shouldn't we instead check for inferrior? // 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(); // focusProxy.xRequestFocus();
} }
@ -269,7 +275,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
wm_set_insets = XWM.getInsetsFromProp(getWindow(), changedAtom); 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) { if (wm_set_insets != null) {
wm_set_insets = copy(wm_set_insets); wm_set_insets = copy(wm_set_insets);
@ -296,7 +304,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
public void handleReparentNotifyEvent(XEvent xev) { public void handleReparentNotifyEvent(XEvent xev) {
XReparentEvent xe = xev.get_xreparent(); 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(); reparent_serial = xe.get_serial();
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
@ -335,7 +345,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
// Check if we have insets provided by the WM // Check if we have insets provided by the WM
Insets correctWM = getWMSetInsets(null); Insets correctWM = getWMSetInsets(null);
if (correctWM != null) { if (correctWM != null) {
insLog.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 // If these insets are equal to our current insets - no actions are necessary
Insets dimInsets = dimensions.getInsets(); Insets dimInsets = dimensions.getInsets();
if (correctWM.equals(dimInsets)) { if (correctWM.equals(dimInsets)) {
@ -348,10 +360,12 @@ abstract class XDecoratedPeer extends XWindowPeer {
} else { } else {
correctWM = XWM.getWM().getInsets(this, xe.get_window(), xe.get_parent()); correctWM = XWM.getWM().getInsets(this, xe.get_window(), xe.get_parent());
if (correctWM != null) { if (insLog.isLoggable(PlatformLogger.FINER)) {
insLog.finer("correctWM {0}", correctWM); if (correctWM != null) {
} else { insLog.finer("correctWM {0}", correctWM);
insLog.finer("correctWM insets are not available, waiting for configureNotify"); } 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). * initial insets were wrong (most likely they were).
*/ */
Insets correction = difference(correctWM, currentInsets); Insets correction = difference(correctWM, currentInsets);
insLog.finest("Corrention {0}", correction); if (insLog.isLoggable(PlatformLogger.FINEST)) {
insLog.finest("Corrention {0}", correction);
}
if (!isNull(correction)) { if (!isNull(correction)) {
currentInsets = copy(correctWM); currentInsets = copy(correctWM);
applyGuessedInsets(); applyGuessedInsets();
@ -382,7 +398,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
//update minimum size hints //update minimum size hints
updateMinSizeHints(); 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()); dimensions.setInsets(getRealInsets());
insets_corrected = true; insets_corrected = true;
@ -506,8 +524,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
if (!isReparented() || !isVisible()) { 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)); Boolean.valueOf(isReparented()), Boolean.valueOf(visible));
}
// Fix for 6323293. // Fix for 6323293.
// This actually is needed to preserve compatibility with previous releases - // This actually is needed to preserve compatibility with previous releases -
@ -612,9 +632,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
dims.setSize(width, height); dims.setSize(width, height);
break; break;
} }
if (insLog.isLoggable(PlatformLogger.FINE)) if (insLog.isLoggable(PlatformLogger.FINE)) {
insLog.fine("For the operation {0} new dimensions are {1}", insLog.fine("For the operation {0} new dimensions are {1}",
operationToString(operation), dims); operationToString(operation), dims);
}
reshape(dims, operation, userReshape); reshape(dims, operation, userReshape);
} }
@ -644,7 +665,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
public void handleConfigureNotifyEvent(XEvent xev) { public void handleConfigureNotifyEvent(XEvent xev) {
assert (SunToolkit.isAWTLockHeldByCurrentThread()); assert (SunToolkit.isAWTLockHeldByCurrentThread());
XConfigureEvent xe = xev.get_xconfigure(); XConfigureEvent xe = xev.get_xconfigure();
insLog.fine("Configure notify {0}", xe); if (insLog.isLoggable(PlatformLogger.FINE)) {
insLog.fine("Configure notify {0}", xe);
}
// XXX: should really only consider synthetic events, but // XXX: should really only consider synthetic events, but
if (isReparented()) { if (isReparented()) {
@ -735,7 +758,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
case XWM.SAWFISH_WM: case XWM.SAWFISH_WM:
{ {
Point xlocation = queryXLocation(); 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) { if (xlocation != null) {
newLocation = xlocation; newLocation = xlocation;
} }
@ -752,8 +777,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
copy(currentInsets), copy(currentInsets),
true); true);
insLog.finer("Insets are {0}, new dimensions {1}", if (insLog.isLoggable(PlatformLogger.FINER)) {
insLog.finer("Insets are {0}, new dimensions {1}",
currentInsets, newDimensions); currentInsets, newDimensions);
}
checkIfOnNewScreen(newDimensions.getBounds()); checkIfOnNewScreen(newDimensions.getBounds());
@ -788,8 +815,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
} }
public void setShellBounds(Rectangle rec) { public void setShellBounds(Rectangle rec) {
if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting shell bounds on " + if (insLog.isLoggable(PlatformLogger.FINE)) {
this + " to " + rec); insLog.fine("Setting shell bounds on " + this + " to " + rec);
}
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
updateSizeHints(rec.x, rec.y, rec.width, rec.height); updateSizeHints(rec.x, rec.y, rec.width, rec.height);
@ -801,8 +829,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
} }
} }
public void setShellSize(Rectangle rec) { public void setShellSize(Rectangle rec) {
if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting shell size on " + if (insLog.isLoggable(PlatformLogger.FINE)) {
this + " to " + rec); insLog.fine("Setting shell size on " + this + " to " + rec);
}
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
updateSizeHints(rec.x, rec.y, rec.width, rec.height); updateSizeHints(rec.x, rec.y, rec.width, rec.height);
@ -813,8 +842,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
} }
} }
public void setShellPosition(Rectangle rec) { public void setShellPosition(Rectangle rec) {
if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting shell position on " + if (insLog.isLoggable(PlatformLogger.FINE)) {
this + " to " + rec); insLog.fine("Setting shell position on " + this + " to " + rec);
}
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
updateSizeHints(rec.x, rec.y, rec.width, rec.height); updateSizeHints(rec.x, rec.y, rec.width, rec.height);
@ -914,9 +944,10 @@ abstract class XDecoratedPeer extends XWindowPeer {
return toGlobal(0,0); return toGlobal(0,0);
} else { } else {
Point location = target.getLocation(); Point location = target.getLocation();
if (insLog.isLoggable(PlatformLogger.FINE)) if (insLog.isLoggable(PlatformLogger.FINE)) {
insLog.fine("getLocationOnScreen {0} not reparented: {1} ", insLog.fine("getLocationOnScreen {0} not reparented: {1} ",
this, location); this, location);
}
return location; return location;
} }
} finally { } finally {
@ -953,7 +984,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
} }
public void setVisible(boolean vis) { 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()) { if (vis && !isVisible()) {
XWM.setShellDecor(this); XWM.setShellDecor(this);
super.setVisible(vis); super.setVisible(vis);
@ -1004,7 +1037,9 @@ abstract class XDecoratedPeer extends XWindowPeer {
} }
private void handleWmTakeFocus(XClientMessageEvent cl) { 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); 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 // by "proxy" - invisible mapped window. When we want to set X input focus to
// toplevel set it on proxy instead. // toplevel set it on proxy instead.
if (focusProxy == null) { 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 { } 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) { if (timeProvided) {
focusProxy.xRequestFocus(time); focusProxy.xRequestFocus(time);
} else { } else {
@ -1111,9 +1150,11 @@ abstract class XDecoratedPeer extends XWindowPeer {
Window focusedWindow = XKeyboardFocusManagerPeer.getInstance().getCurrentFocusedWindow(); Window focusedWindow = XKeyboardFocusManagerPeer.getInstance().getCurrentFocusedWindow();
Window activeWindow = XWindowPeer.getDecoratedOwner(focusedWindow); 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 == activeWindow),
Boolean.valueOf(target == focusedWindow)); Boolean.valueOf(target == focusedWindow));
}
XWindowPeer toFocus = this; XWindowPeer toFocus = this;
while (toFocus.nextTransientFor != null) { while (toFocus.nextTransientFor != null) {
@ -1136,16 +1177,22 @@ abstract class XDecoratedPeer extends XWindowPeer {
return true; return true;
} }
Window realNativeFocusedWindow = XWindowPeer.getNativeFocusedWindow(); 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); "\nKFM's focused window: " + focusedWindow);
}
// See 6522725, 6613426. // See 6522725, 6613426.
if (target == realNativeFocusedWindow) { 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; 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) { if (timeProvided) {
toFocus.requestXFocus(time); toFocus.requestXFocus(time);

View File

@ -123,7 +123,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
} }
void initDispatching() { 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(); XToolkit.awtLock();
try { try {
XToolkit.addEventDispatcher(xembed.handle, xembed); XToolkit.addEventDispatcher(xembed.handle, xembed);
@ -140,7 +142,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
} }
void endDispatching() { 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(); XToolkit.awtLock();
try { try {
XDropTargetRegistry.getRegistry().unregisterXEmbedClient(getWindow(), xembed.handle); XDropTargetRegistry.getRegistry().unregisterXEmbedClient(getWindow(), xembed.handle);
@ -160,7 +164,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
} }
void childDestroyed() { 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(); endDispatching();
xembed.handle = 0; xembed.handle = 0;
} }
@ -382,7 +388,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
} }
void detachChild() { 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: * XEmbed specification:
* "The embedder can unmap the client and reparent the client window to the root window. If the * "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 { try {
XKeyEvent ke = new XKeyEvent(data); XKeyEvent ke = new XKeyEvent(data);
ke.set_window(xembed.handle); 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(); XToolkit.awtLock();
try { try {
XlibWrapper.XSendEvent(XToolkit.getDisplay(), xembed.handle, false, XConstants.NoEventMask, data); 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() { postEvent(new InvocationEvent(target, new Runnable() {
public void run() { public void run() {
GrabbedKey grab = new GrabbedKey(keysym, modifiers); 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) { synchronized(GRAB_LOCK) {
grabbed_keys.add(grab); grabbed_keys.add(grab);
} }
@ -506,7 +518,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
postEvent(new InvocationEvent(target, new Runnable() { postEvent(new InvocationEvent(target, new Runnable() {
public void run() { public void run() {
GrabbedKey grab = new GrabbedKey(keysym, modifiers); 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) { synchronized(GRAB_LOCK) {
grabbed_keys.remove(grab); grabbed_keys.remove(grab);
} }
@ -519,7 +533,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
public void run() { public void run() {
AWTKeyStroke stroke = xembed.getKeyStrokeForKeySym(keysym, modifiers); AWTKeyStroke stroke = xembed.getKeyStrokeForKeySym(keysym, modifiers);
if (stroke != null) { 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) { synchronized(ACCEL_LOCK) {
accelerators.put(accel_id, stroke); accelerators.put(accel_id, stroke);
accel_lookup.put(stroke, accel_id); accel_lookup.put(stroke, accel_id);
@ -537,7 +553,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
synchronized(ACCEL_LOCK) { synchronized(ACCEL_LOCK) {
stroke = accelerators.get(accel_id); stroke = accelerators.get(accel_id);
if (stroke != null) { 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); accelerators.remove(accel_id);
accel_lookup.remove(stroke); // FIXME: How about several accelerators with the same stroke? 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; 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 // Process ACCELERATORS
AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e); AWTKeyStroke stroke = AWTKeyStroke.getAWTKeyStrokeForEvent(e);
@ -596,7 +616,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
} }
} }
if (exists) { 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? xembed.sendMessage(xembed.handle, XEMBED_ACTIVATE_ACCELERATOR, accel_id, 0, 0); // FIXME: How about overloaded?
result = true; result = true;
} }
@ -608,7 +630,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
exists = grabbed_keys.contains(key); exists = grabbed_keys.contains(key);
} }
if (exists) { 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); forwardKeyEvent(e);
result = true; result = true;
} }
@ -627,9 +651,13 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
public void handleClientMessage(XEvent xev) { public void handleClientMessage(XEvent xev) {
super.handleClientMessage(xev); super.handleClientMessage(xev);
XClientMessageEvent msg = xev.get_xclient(); 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 (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()) { if (isXEmbedActive()) {
switch ((int)msg.get_data(1)) { 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 new_mapped = (flags & XEMBED_MAPPED) != 0;
boolean currently_mapped = XlibUtil.getWindowMapState(handle) != XConstants.IsUnmapped; boolean currently_mapped = XlibUtil.getWindowMapState(handle) != XConstants.IsUnmapped;
if (new_mapped != currently_mapped) { if (new_mapped != currently_mapped) {
if (xembedLog.isLoggable(PlatformLogger.FINER)) if (xembedLog.isLoggable(PlatformLogger.FINER)) {
xembedLog.fine("Mapping state of the client has changed, old state: " + currently_mapped + ", new state: " + new_mapped); xembedLog.finer("Mapping state of the client has changed, old state: " + currently_mapped + ", new state: " + new_mapped);
}
if (new_mapped) { if (new_mapped) {
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
@ -748,7 +777,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
} }
} }
} else { } 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; return true;
} finally { } finally {
@ -759,7 +790,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
public void handlePropertyNotify(XEvent xev) { public void handlePropertyNotify(XEvent xev) {
if (isXEmbedActive()) { if (isXEmbedActive()) {
XPropertyEvent ev = xev.get_xproperty(); 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) { if (ev.get_atom() == XAtom.XA_WM_NORMAL_HINTS) {
childResized(); childResized();
} else if (ev.get_atom() == XEmbedInfo.getAtom()) { } else if (ev.get_atom() == XEmbedInfo.getAtom()) {
@ -780,7 +813,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
void handleConfigureNotify(XEvent xev) { void handleConfigureNotify(XEvent xev) {
if (isXEmbedActive()) { if (isXEmbedActive()) {
XConfigureEvent ev = xev.get_xconfigure(); 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) { if (xev.get_xany().get_window() == handle) {
childResized(); childResized();
} }
@ -831,7 +866,9 @@ public class XEmbedCanvasPeer extends XCanvasPeer implements WindowFocusListener
// We recognize only these masks // We recognize only these masks
modifiers = ke.get_state() & (XConstants.ShiftMask | XConstants.ControlMask | XConstants.LockMask); 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 { } finally {
XlibWrapper.unsafe.freeMemory(data); XlibWrapper.unsafe.freeMemory(data);
} }

View File

@ -95,9 +95,13 @@ public class XEmbedClientHelper extends XEmbedHelper implements XEventDispatcher
void handleClientMessage(XEvent xev) { void handleClientMessage(XEvent xev) {
XClientMessageEvent msg = xev.get_xclient(); 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 (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)) { switch ((int)msg.get_data(1)) {
case XEMBED_EMBEDDED_NOTIFY: // Notification about embedding protocol start case XEMBED_EMBEDDED_NOTIFY: // Notification about embedding protocol start
active = true; active = true;

View File

@ -82,11 +82,15 @@ public class XEmbedHelper {
XEmbedHelper() { XEmbedHelper() {
if (XEmbed == null) { if (XEmbed == null) {
XEmbed = XAtom.get("_XEMBED"); 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) { if (XEmbedInfo == null) {
XEmbedInfo = XAtom.get("_XEMBED_INFO"); 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); msg.set_data(4, data2);
XToolkit.awtLock(); XToolkit.awtLock();
try { 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); XlibWrapper.XSendEvent(XToolkit.getDisplay(), window, false, XConstants.NoEventMask, msg.pData);
} }
finally { finally {

View File

@ -81,7 +81,9 @@ public class XEmbedServerTester implements XEventDispatcher {
throw new RuntimeException("Can't create robot"); throw new RuntimeException("Can't create robot");
} }
initAccel(); 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) { public static XEmbedServerTester getTester(Rectangle serverBounds[], long parent) {
@ -89,12 +91,14 @@ public class XEmbedServerTester implements XEventDispatcher {
} }
private void dumpReceivedEvents() { private void dumpReceivedEvents() {
xembedLog.finer("Events received so far:"); if (xembedLog.isLoggable(PlatformLogger.FINER)) {
int pos = 0; xembedLog.finer("Events received so far:");
for (Integer event : events) { int pos = 0;
xembedLog.finer((pos++) + ":" + XEmbedHelper.msgidToString(event)); 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() { public void test1_1() {
@ -391,7 +395,9 @@ public class XEmbedServerTester implements XEventDispatcher {
SubstructureNotifyMask | KeyPressMask)}); SubstructureNotifyMask | KeyPressMask)});
window = new XBaseWindow(params); 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); XToolkit.addEventDispatcher(window.getWindow(), this);
updateEmbedInfo(); updateEmbedInfo();
@ -529,18 +535,24 @@ public class XEmbedServerTester implements XEventDispatcher {
synchronized(EVENT_LOCK) { synchronized(EVENT_LOCK) {
// Check for already received events after the request // Check for already received events after the request
if (checkEventList(position, event) != -1) { 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; return;
} }
if (eventReceived == event) { if (eventReceived == event) {
// Already received // Already received
xembedLog.finer("Already received " + XEmbedHelper.msgidToString(event)); if (xembedLog.isLoggable(PlatformLogger.FINER)) {
xembedLog.finer("Already received " + XEmbedHelper.msgidToString(event));
}
return; return;
} }
eventReceived = -1; eventReceived = -1;
eventWaited = event; 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 { try {
EVENT_LOCK.wait(3000); EVENT_LOCK.wait(3000);
} catch (InterruptedException ie) { } catch (InterruptedException ie) {
@ -551,7 +563,9 @@ public class XEmbedServerTester implements XEventDispatcher {
dumpReceivedEvents(); dumpReceivedEvents();
throw new RuntimeException("Didn't receive event " + XEmbedHelper.msgidToString(event) + " but recevied " + XEmbedHelper.msgidToString(eventReceived)); throw new RuntimeException("Didn't receive event " + XEmbedHelper.msgidToString(event) + " but recevied " + XEmbedHelper.msgidToString(eventReceived));
} else { } 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) { if (ev.get_type() == ClientMessage) {
XClientMessageEvent msg = ev.get_xclient(); XClientMessageEvent msg = ev.get_xclient();
if (msg.get_message_type() == xembed.XEmbed.getAtom()) { 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)) { switch ((int)msg.get_data(1)) {
case XEmbedHelper.XEMBED_EMBEDDED_NOTIFY: // Notification about embedding protocol start case XEmbedHelper.XEMBED_EMBEDDED_NOTIFY: // Notification about embedding protocol start
xembedActive = true; xembedActive = true;
@ -659,10 +675,14 @@ public class XEmbedServerTester implements XEventDispatcher {
synchronized(EVENT_LOCK) { synchronized(EVENT_LOCK) {
events.add((int)msg.get_data(1)); 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) { if ((int)msg.get_data(1) == eventWaited) {
eventReceived = (int)msg.get_data(1); 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(); EVENT_LOCK.notifyAll();
} }
} }
@ -672,10 +692,14 @@ public class XEmbedServerTester implements XEventDispatcher {
int eventID = (int)ev.get_type() | SYSTEM_EVENT_MASK; int eventID = (int)ev.get_type() | SYSTEM_EVENT_MASK;
events.add(eventID); 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) { if (eventID == eventWaited) {
eventReceived = eventID; 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(); EVENT_LOCK.notifyAll();
} }
} }

View File

@ -720,7 +720,9 @@ class XFileDialogPeer extends XDialogPeer implements FileDialogPeer, ActionListe
} }
File fe = new File(dir).getAbsoluteFile(); File fe = new File(dir).getAbsoluteFile();
log.fine("Current directory : " + fe); if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("Current directory : " + fe);
}
if (!fe.isDirectory()) { if (!fe.isDirectory()) {
dir = "./"; dir = "./";

View File

@ -209,7 +209,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
} }
public void setMaximizedBounds(Rectangle b) { 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; if (b == null) return;
maxBounds = new Rectangle(b); maxBounds = new Rectangle(b);
XToolkit.awtLock(); XToolkit.awtLock();
@ -226,7 +228,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
} else { } else {
hints.set_max_height((int)XlibWrapper.DisplayHeight(XToolkit.getDisplay(), XlibWrapper.DefaultScreen(XToolkit.getDisplay()))); 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); XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(), window, hints.pData);
} finally { } finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
@ -254,14 +258,20 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
int changed = state ^ newState; int changed = state ^ newState;
int changeIconic = changed & Frame.ICONIFIED; int changeIconic = changed & Frame.ICONIFIED;
boolean iconic = (newState & Frame.ICONIFIED) != 0; 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)); Integer.valueOf(state), Integer.valueOf(newState), Boolean.valueOf(iconic));
}
if (changeIconic != 0 && 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(); XToolkit.awtLock();
try { try {
int res = XlibWrapper.XIconifyWindow(XToolkit.getDisplay(), getShell(), getScreenNumber()); 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 { finally {
XToolkit.awtUnlock(); XToolkit.awtUnlock();
@ -271,7 +281,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
setExtendedState(newState); setExtendedState(newState);
} }
if (changeIconic != 0 && !iconic) { if (changeIconic != 0 && !iconic) {
if (stateLog.isLoggable(PlatformLogger.FINER)) stateLog.finer("DeIconifying " + this); if (stateLog.isLoggable(PlatformLogger.FINER)) {
stateLog.finer("DeIconifying " + this);
}
xSetVisible(true); xSetVisible(true);
} }
} }
@ -284,7 +296,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
super.handlePropertyNotify(xev); super.handlePropertyNotify(xev);
XPropertyEvent ev = xev.get_xproperty(); 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 * Let's see if this is a window state protocol message, and
* if it is - decode a new state in terms of java constants. * if it is - decode a new state in terms of java constants.
@ -297,7 +311,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
final int newState = XWM.getWM().getState(this); final int newState = XWM.getWM().getState(this);
int changed = state ^ newState; int changed = state ^ newState;
if (changed == 0) { if (changed == 0) {
stateLog.finer("State is the same: " + state); if (stateLog.isLoggable(PlatformLogger.FINER)) {
stateLog.finer("State is the same: " + state);
}
return; return;
} }
@ -349,7 +365,9 @@ class XFramePeer extends XDecoratedPeer implements FramePeer {
XWMHints hints = getWMHints(); XWMHints hints = getWMHints();
hints.set_flags((int)XUtilConstants.StateHint | hints.get_flags()); hints.set_flags((int)XUtilConstants.StateHint | hints.get_flags());
hints.set_initial_state(wm_state); 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); XlibWrapper.XSetWMHints(XToolkit.getDisplay(), getWindow(), hints.pData);
} }
finally { finally {

View File

@ -61,7 +61,9 @@ public class XIconWindow extends XBaseWindow {
final long screen = adata.get_awt_visInfo().get_screen(); final long screen = adata.get_awt_visInfo().get_screen();
final long display = XToolkit.getDisplay(); 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 = long status =
XlibWrapper.XGetIconSizes(display, XToolkit.getDefaultRootWindow(), XlibWrapper.XGetIconSizes(display, XToolkit.getDefaultRootWindow(),
@ -71,11 +73,15 @@ public class XIconWindow extends XBaseWindow {
} }
int count = Native.getInt(XlibWrapper.iarg1); int count = Native.getInt(XlibWrapper.iarg1);
long sizes_ptr = Native.getLong(XlibWrapper.larg1); // XIconSize* 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]; XIconSize[] res = new XIconSize[count];
for (int i = 0; i < count; i++, sizes_ptr += XIconSize.getSize()) { for (int i = 0; i < count; i++, sizes_ptr += XIconSize.getSize()) {
res[i] = new XIconSize(sizes_ptr); res[i] = new XIconSize(sizes_ptr);
log.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; return res;
} finally { } finally {
@ -92,7 +98,9 @@ public class XIconWindow extends XBaseWindow {
} }
XIconSize[] sizeList = getIconSizes(); 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) { if (sizeList == null) {
// No icon sizes so we simply fall back to 16x16 // No icon sizes so we simply fall back to 16x16
return new Dimension(16, 16); return new Dimension(16, 16);
@ -418,7 +426,9 @@ public class XIconWindow extends XBaseWindow {
} }
} }
if (min != null) { 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); setIconImage(min);
} }
} }
@ -444,7 +454,9 @@ public class XIconWindow extends XBaseWindow {
} }
Dimension iconSize = getIconSize(width, height); Dimension iconSize = getIconSize(width, height);
if (iconSize != null) { if (iconSize != null) {
log.finest("Icon size: {0}", iconSize); if (log.isLoggable(PlatformLogger.FINEST)) {
log.finest("Icon size: {0}", iconSize);
}
iconWidth = iconSize.width; iconWidth = iconSize.width;
iconHeight = iconSize.height; iconHeight = iconSize.height;
} else { } else {

View File

@ -102,13 +102,17 @@ public class XInputMethod extends X11InputMethod {
protected ComponentPeer getPeer(Component client) { protected ComponentPeer getPeer(Component client) {
XComponentPeer peer; 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); peer = (XComponentPeer)XToolkit.targetToPeer(client);
while (client != null && peer == null) { while (client != null && peer == null) {
client = getParent(client); client = getParent(client);
peer = (XComponentPeer)XToolkit.targetToPeer(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) if (peer != null)
return peer; return peer;

View File

@ -575,10 +575,14 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
} }
void mousePressed(MouseEvent mouseEvent) { 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 (isEnabled() && mouseEvent.getButton() == MouseEvent.BUTTON1) {
if (inWindow(mouseEvent.getX(), mouseEvent.getY())) { 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; active = WINDOW;
int i = y2index(mouseEvent.getY()); int i = y2index(mouseEvent.getY());
if (i >= 0) { if (i >= 0) {
@ -615,14 +619,18 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
currentIndex = -1; currentIndex = -1;
} }
} else if (inVerticalScrollbar(mouseEvent.getX(), mouseEvent.getY())) { } 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; active = VERSCROLLBAR;
vsb.handleMouseEvent(mouseEvent.getID(), vsb.handleMouseEvent(mouseEvent.getID(),
mouseEvent.getModifiers(), mouseEvent.getModifiers(),
mouseEvent.getX() - (width - SCROLLBAR_WIDTH), mouseEvent.getX() - (width - SCROLLBAR_WIDTH),
mouseEvent.getY()); mouseEvent.getY());
} else if (inHorizontalScrollbar(mouseEvent.getX(), 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; active = HORSCROLLBAR;
hsb.handleMouseEvent(mouseEvent.getID(), hsb.handleMouseEvent(mouseEvent.getID(),
mouseEvent.getModifiers(), mouseEvent.getModifiers(),
@ -805,7 +813,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
void keyPressed(KeyEvent e) { void keyPressed(KeyEvent e) {
int keyCode = e.getKeyCode(); int keyCode = e.getKeyCode();
if (log.isLoggable(PlatformLogger.FINE)) log.fine(e.toString()); if (log.isLoggable(PlatformLogger.FINE)) {
log.fine(e.toString());
}
switch(keyCode) { switch(keyCode) {
case KeyEvent.VK_UP: case KeyEvent.VK_UP:
case KeyEvent.VK_KP_UP: // TODO: I assume we also want this, too 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) { 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(); int value = obj.getValue();
if (obj == vsb) { if (obj == vsb) {
scrollVertical(v - value); 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 // Update maxLength
boolean repaintItems = !isItemHidden(addedIndex); boolean repaintItems = !isItemHidden(addedIndex);
@ -1091,8 +1105,10 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
| ((vsb.needsRepaint())?(PAINT_VSCROLL):0); | ((vsb.needsRepaint())?(PAINT_VSCROLL):0);
} }
if (log.isLoggable(PlatformLogger.FINEST)) log.finest("Last visible: " + getLastVisibleItem() + if (log.isLoggable(PlatformLogger.FINEST)) {
", hsb changed : " + (hsbWasVis ^ hsbVis) + ", items changed " + repaintItems); log.finest("Last visible: " + getLastVisibleItem() +
", hsb changed : " + (hsbWasVis ^ hsbVis) + ", items changed " + repaintItems);
}
repaint(addedIndex, getLastVisibleItem(), options); repaint(addedIndex, getLastVisibleItem(), options);
} }
@ -1107,10 +1123,14 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
boolean vsbWasVisible = vsbVis; boolean vsbWasVisible = vsbVis;
int oldLastDisplayed = lastItemDisplayed(); 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() + if (log.isLoggable(PlatformLogger.FINEST)) {
", size " + items.size()); log.finest("Last displayed item: " + oldLastDisplayed + ", items in window " + itemsInWindow() +
", size " + items.size());
}
if (items.size() == 0) { if (items.size() == 0) {
return; return;
@ -1177,7 +1197,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
options |= PAINT_FOCUS; 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 // update vsb.val
if (vsb.getValue() >= s) { if (vsb.getValue() >= s) {
@ -1430,7 +1452,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
* y is the number of items to scroll * y is the number of items to scroll
*/ */
void scrollVertical(int y) { 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 itemsInWin = itemsInWindow();
int h = getItemHeight(); int h = getItemHeight();
int pixelsToScroll = y * h; int pixelsToScroll = y * h;
@ -1470,7 +1494,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
* x is the number of pixels to scroll * x is the number of pixels to scroll
*/ */
void scrollHorizontal(int x) { 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(); int w = getListWidth();
w -= ((2 * SPACE) + (2 * MARGIN)); w -= ((2 * SPACE) + (2 * MARGIN));
int h = height - (SCROLLBAR_AREA + (2 * MARGIN)); int h = height - (SCROLLBAR_AREA + (2 * MARGIN));
@ -1706,7 +1732,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
} }
if (localBuffer == null) { 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(), // use GraphicsConfig.cCVI() instead of Component.cVI(),
// because the latter may cause a deadlock with the tree lock // because the latter may cause a deadlock with the tree lock
localBuffer = localBuffer =
@ -1743,7 +1771,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
private void paint(Graphics listG, int firstItem, int lastItem, int options, private void paint(Graphics listG, int firstItem, int lastItem, int options,
Rectangle source, Point distance) { 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) { if (firstItem > lastItem) {
int t = lastItem; int t = lastItem;
lastItem = firstItem; lastItem = firstItem;
@ -1832,7 +1862,9 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
} }
private void paintItems(Graphics g, int firstItem, int lastItem, int options) { 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); firstItem = Math.max(getFirstVisibleItem(), firstItem);
if (firstItem > lastItem) { if (firstItem > lastItem) {
@ -1843,15 +1875,19 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
firstItem = Math.max(getFirstVisibleItem(), firstItem); firstItem = Math.max(getFirstVisibleItem(), firstItem);
lastItem = Math.min(lastItem, items.size()-1); lastItem = Math.min(lastItem, items.size()-1);
if (log.isLoggable(PlatformLogger.FINER)) log.finer("Actually painting items from " + firstItem + " to " + lastItem + if (log.isLoggable(PlatformLogger.FINER)) {
", items in window " + itemsInWindow()); log.finer("Actually painting items from " + firstItem + " to " + lastItem +
", items in window " + itemsInWindow());
}
for (int i = firstItem; i <= lastItem; i++) { for (int i = firstItem; i <= lastItem; i++) {
paintItem(g, i); paintItem(g, i);
} }
} }
private void paintItem(Graphics g, int index) { 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 // 4895367 - only paint items which are visible
if (!isItemHidden(index)) { if (!isItemHidden(index)) {
Shape clip = g.getClip(); Shape clip = g.getClip();
@ -1859,18 +1895,24 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
int h = getItemHeight(); int h = getItemHeight();
int y = getItemY(index); int y = getItemY(index);
int x = getItemX(); 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)); g.setClip(x, y, w - (SPACE*2), h-(SPACE*2));
// Always paint the background so that focus is unpainted in // Always paint the background so that focus is unpainted in
// multiselect mode // multiselect mode
if (isSelected(index)) { 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()); g.setColor(getListForeground());
} else { } else {
g.setColor(getListBackground()); 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); g.fillRect(x, y, w, h);
if (index <= getLastVisibleItem() && index < items.size()) { 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) { 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 " + if (log.isLoggable(PlatformLogger.FINEST)) {
width + " height " + height + ", paintAll " + paintAll); log.finest("Painting scrollbar " + scr + " width " +
width + " height " + height + ", paintAll " + paintAll);
}
g.translate(x, y); g.translate(x, y);
scr.paint(g, getSystemColors(), paintAll); scr.paint(g, getSystemColors(), paintAll);
g.translate(-x, -y); g.translate(-x, -y);
@ -1932,22 +1976,30 @@ class XListPeer extends XComponentPeer implements ListPeer, XScrollbarClient {
if (paintFocus && !hasFocus()) { if (paintFocus && !hasFocus()) {
paintFocus = false; paintFocus = false;
} }
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Painting focus, focus index " + getFocusIndex() + ", focus is " + if (log.isLoggable(PlatformLogger.FINE)) {
(isItemHidden(getFocusIndex())?("invisible"):("visible")) + ", paint focus is " + paintFocus); log.fine("Painting focus, focus index " + getFocusIndex() + ", focus is " +
(isItemHidden(getFocusIndex())?("invisible"):("visible")) + ", paint focus is " + paintFocus);
}
Shape clip = g.getClip(); Shape clip = g.getClip();
g.setClip(0, 0, listWidth, listHeight); 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(); Rectangle rect = getFocusRect();
if (prevFocusRect != null) { if (prevFocusRect != null) {
// Erase focus rect // 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.setColor(getListBackground());
g.drawRect(prevFocusRect.x, prevFocusRect.y, prevFocusRect.width, prevFocusRect.height); g.drawRect(prevFocusRect.x, prevFocusRect.y, prevFocusRect.width, prevFocusRect.height);
prevFocusRect = null; prevFocusRect = null;
} }
if (paintFocus) { if (paintFocus) {
// Paint new // 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.setColor(getListForeground()); // Focus color is always black on Linux
g.drawRect(rect.x, rect.y, rect.width, rect.height); g.drawRect(rect.x, rect.y, rect.width, rect.height);
prevFocusRect = rect; prevFocusRect = rect;

View File

@ -128,7 +128,9 @@ public class XMSelection {
long display = XToolkit.getDisplay(); long display = XToolkit.getDisplay();
synchronized(this) { synchronized(this) {
setOwner(owner, screen); 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); XlibWrapper.XSelectInput(display, owner, XConstants.StructureNotifyMask | eventMask);
XToolkit.addEventDispatcher(owner, XToolkit.addEventDispatcher(owner,
new XEventDispatcher() { new XEventDispatcher() {
@ -148,19 +150,25 @@ public class XMSelection {
try { try {
try { try {
long display = XToolkit.getDisplay(); 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); XlibWrapper.XGrabServer(display);
synchronized(this) { synchronized(this) {
String selection_name = getName()+"_S"+screen; 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); XAtom atom = XAtom.get(selection_name);
selectionMap.put(Long.valueOf(atom.getAtom()),this); // add mapping from atom to the instance of XMSelection selectionMap.put(Long.valueOf(atom.getAtom()),this); // add mapping from atom to the instance of XMSelection
setAtom(atom,screen); setAtom(atom,screen);
long owner = XlibWrapper.XGetSelectionOwner(display, atom.getAtom()); long owner = XlibWrapper.XGetSelectionOwner(display, atom.getAtom());
if (owner != 0) { if (owner != 0) {
setOwner(owner, screen); 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); XlibWrapper.XSelectInput(display, owner, XConstants.StructureNotifyMask | extra_mask);
XToolkit.addEventDispatcher(owner, XToolkit.addEventDispatcher(owner,
new XEventDispatcher() { new XEventDispatcher() {
@ -175,7 +183,9 @@ public class XMSelection {
e.printStackTrace(); e.printStackTrace();
} }
finally { finally {
if (log.isLoggable(PlatformLogger.FINE)) log.fine("UnGrabbing XServer"); if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("UnGrabbing XServer");
}
XlibWrapper.XUngrabServer(XToolkit.getDisplay()); XlibWrapper.XUngrabServer(XToolkit.getDisplay());
} }
} finally { } finally {
@ -187,7 +197,9 @@ public class XMSelection {
static boolean processClientMessage(XEvent xev, int screen) { static boolean processClientMessage(XEvent xev, int screen) {
XClientMessageEvent xce = xev.get_xclient(); XClientMessageEvent xce = xev.get_xclient();
if (xce.get_message_type() == XA_MANAGER.getAtom()) { 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 timestamp = xce.get_data(0);
long atom = xce.get_data(1); long atom = xce.get_data(1);
long owner = xce.get_data(2); long owner = xce.get_data(2);
@ -294,7 +306,9 @@ public class XMSelection {
synchronized void dispatchSelectionChanged( XPropertyEvent ev, int screen) { 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) { if (listeners != null) {
Iterator iter = listeners.iterator(); Iterator iter = listeners.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
@ -305,7 +319,9 @@ public class XMSelection {
} }
synchronized void dispatchOwnerDeath(XDestroyWindowEvent de, int screen) { 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) { if (listeners != null) {
Iterator iter = listeners.iterator(); Iterator iter = listeners.iterator();
while (iter.hasNext()) { while (iter.hasNext()) {
@ -317,7 +333,9 @@ public class XMSelection {
} }
void dispatchSelectionEvent(XEvent xev, int screen) { 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) { if (xev.get_type() == XConstants.DestroyNotify) {
XDestroyWindowEvent de = xev.get_xdestroywindow(); XDestroyWindowEvent de = xev.get_xdestroywindow();
dispatchOwnerDeath( de, screen); dispatchOwnerDeath( de, screen);

View File

@ -519,7 +519,9 @@ public class XMenuBarPeer extends XBaseMenuWindow implements MenuBarPeer {
*/ */
public void handleKeyPress(XEvent xev) { public void handleKeyPress(XEvent xev) {
XKeyEvent xkey = xev.get_xkey(); 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)) { if (isEventDisabled(xev)) {
return; return;
} }

View File

@ -111,7 +111,9 @@ public class XMenuPeer extends XMenuItemPeer implements MenuPeer {
* for adding separators * for adding separators
*/ */
public void addSeparator() { 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) { public void addItem(MenuItem item) {

View File

@ -43,7 +43,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
} }
public void setState(XWindowPeer window, int state) { 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()) { if (window.isShowing()) {
requestState(window, state); requestState(window, state);
} else { } else {
@ -53,7 +55,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
private void setInitialState(XWindowPeer window, int state) { private void setInitialState(XWindowPeer window, int state) {
XAtomList old_state = window.getNETWMState(); XAtomList old_state = window.getNETWMState();
log.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) { if ((state & Frame.MAXIMIZED_VERT) != 0) {
old_state.add(XA_NET_WM_STATE_MAXIMIZED_VERT); old_state.add(XA_NET_WM_STATE_MAXIMIZED_VERT);
} else { } else {
@ -64,7 +68,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
} else { } else {
old_state.remove(XA_NET_WM_STATE_MAXIMIZED_HORZ); old_state.remove(XA_NET_WM_STATE_MAXIMIZED_HORZ);
} }
log.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); window.setNETWMState(old_state);
} }
@ -97,7 +103,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
default: default:
return; 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_type((int)XConstants.ClientMessage);
req.set_window(window.getWindow()); req.set_window(window.getWindow());
req.set_message_type(XA_NET_WM_STATE.getAtom()); 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()); req.set_data(1, state.getAtom());
// Fix for 6735584: req.data[2] must be set to 0 when only one property is changed // Fix for 6735584: req.data[2] must be set to 0 when only one property is changed
req.set_data(2, 0); req.set_data(2, 0);
log.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(); XToolkit.awtLock();
try { try {
XlibWrapper.XSendEvent(XToolkit.getDisplay(), 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 * @param reset Indicates operation, 'set' if false, 'reset' if true
*/ */
private void setStateHelper(XWindowPeer window, XAtom state, boolean set) { 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.isWithdrawn()), Boolean.valueOf(window.isVisible()),
Boolean.valueOf(window.isMapped()), Boolean.valueOf(window.isShowing())); Boolean.valueOf(window.isMapped()), Boolean.valueOf(window.isShowing()));
}
if (window.isShowing()) { if (window.isShowing()) {
requestState(window, state, set); requestState(window, state, set);
} else { } else {
XAtomList net_wm_state = window.getNETWMState(); 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) { if (!set) {
net_wm_state.remove(state); net_wm_state.remove(state);
} else { } else {
net_wm_state.add(state); net_wm_state.add(state);
} }
log.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); window.setNETWMState(net_wm_state);
} }
XToolkit.XSync(); XToolkit.XSync();
@ -274,7 +290,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
} }
NetWindow = checkAnchor(XA_NET_SUPPORTING_WM_CHECK, XAtom.XA_WINDOW); NetWindow = checkAnchor(XA_NET_SUPPORTING_WM_CHECK, XAtom.XA_WINDOW);
supportChecked = true; 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() { boolean active() {
@ -284,7 +302,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
boolean doStateProtocol() { boolean doStateProtocol() {
boolean res = active() && checkProtocol(XA_NET_SUPPORTED, XA_NET_WM_STATE); 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; return res;
} }
@ -311,7 +331,9 @@ final class XNETProtocol extends XProtocol implements XStateProtocol, XLayerProt
if (net_wm_name_string == null) { if (net_wm_name_string == null) {
return false; 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); return net_wm_name_string.startsWith(name);
} }

View File

@ -123,7 +123,9 @@ public class XPopupMenuPeer extends XMenuWindow implements PopupMenuPeer {
* for adding separators * for adding separators
*/ */
public void addSeparator() { 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");
}
} }
/* /*

View File

@ -54,7 +54,9 @@ class XProtocol {
} finally { } finally {
if (firstCheck) { if (firstCheck) {
firstCheck = false; 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);
}
} }
} }
} }

View File

@ -118,7 +118,9 @@ abstract class XScrollbar {
abstract protected void rebuildArrows(); abstract protected void rebuildArrows();
public void setSize(int width, int height) { 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.width = width;
this.height = height; this.height = height;
} }
@ -164,7 +166,9 @@ abstract class XScrollbar {
* @param paintAll paint the whole scrollbar if true, just the thumb is false * @param paintAll paint the whole scrollbar if true, just the thumb is false
*/ */
void paint(Graphics g, Color colors[], boolean paintAll) { 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; boolean useBufferedImage = false;
Graphics2D g2 = null; Graphics2D g2 = null;
@ -335,7 +339,9 @@ abstract class XScrollbar {
* Tell the scroller to start scrolling. * Tell the scroller to start scrolling.
*/ */
void startScrolling() { 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 // Make sure that we scroll at least once
scroll(); scroll();
@ -355,7 +361,9 @@ abstract class XScrollbar {
* See 6243382 for more information * See 6243382 for more information
*/ */
void startScrollingInstance() { 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 // Make sure that we scroll at least once
scroll(); scroll();
@ -368,7 +376,9 @@ abstract class XScrollbar {
* See 6243382 for more information * See 6243382 for more information
*/ */
void stopScrollingInstance() { void stopScrollingInstance() {
log.finer("Stop scrolling on " + this); if (log.isLoggable(PlatformLogger.FINER)) {
log.finer("Stop scrolling on " + this);
}
i_scroller.stop(); i_scroller.stop();
} }

View File

@ -156,7 +156,9 @@ class XScrollbarPeer extends XComponentPeer implements ScrollbarPeer, XScrollbar
public void handleJavaKeyEvent(KeyEvent event) { public void handleJavaKeyEvent(KeyEvent event) {
super.handleJavaKeyEvent(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) { if (!(event.isConsumed()) && event.getID() == KeyEvent.KEY_RELEASED) {
switch(event.getKeyCode()) { switch(event.getKeyCode()) {
case KeyEvent.VK_UP: case KeyEvent.VK_UP:

View File

@ -58,7 +58,9 @@ public class XSystemTrayPeer implements SystemTrayPeer, XMSelectionListener {
long selection_owner = selection.getOwner(SCREEN); long selection_owner = selection.getOwner(SCREEN);
available = (selection_owner != XConstants.None); 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) { 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 { void addTrayIcon(XTrayIconPeer tiPeer) throws AWTException {
long selection_owner = selection.getOwner(SCREEN); 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) { if (selection_owner == XConstants.None) {
throw new AWTException("TrayIcon couldn't be displayed."); throw new AWTException("TrayIcon couldn't be displayed.");

View File

@ -258,7 +258,9 @@ public class XTextFieldPeer extends XComponentPeer implements TextFieldPeer {
} }
public void setBackground(Color c) { 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; background = c;
if (xtext != null) { if (xtext != null) {
xtext.setBackground(c); xtext.setBackground(c);

View File

@ -1492,7 +1492,9 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
} }
} catch (InterruptedException ie) { } catch (InterruptedException ie) {
// Note: the returned timeStamp can be incorrect in this case. // 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 { } finally {
awtUnlock(); awtUnlock();
@ -1657,7 +1659,9 @@ public final class XToolkit extends UNIXToolkit implements Runnable {
name = "gnome." + name; name = "gnome." + name;
setDesktopProperty(name, e.getValue()); 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 // XXX: we probably want to do something smarter. In
// particular, "Net" properties are of interest to the // 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 // Wait for selection notify for oops on win
long event_number = getEventNumber(); long event_number = getEventNumber();
XAtom atom = XAtom.get("WM_S0"); XAtom atom = XAtom.get("WM_S0");
eventLog.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(), XlibWrapper.XConvertSelection(getDisplay(), atom.getAtom(),
XAtom.get("VERSION").getAtom(), oops.getAtom(), XAtom.get("VERSION").getAtom(), oops.getAtom(),
win.getWindow(), XConstants.CurrentTime); win.getWindow(), XConstants.CurrentTime);
XSync(); XSync();
eventLog.finer("Requested OOPS"); eventLog.finer("Requested OOPS");
long start = System.currentTimeMillis(); long start = System.currentTimeMillis();

View File

@ -106,9 +106,11 @@ public class XTrayIconPeer implements TrayIconPeer,
XConfigureEvent ce = ev.get_xconfigure(); 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(), XTrayIconPeer.this, ce.get_width(), ce.get_height(),
ce.get_x(), ce.get_y(), old_x, old_y); ce.get_x(), ce.get_y(), old_x, old_y);
}
// A workaround for Gnome/Metacity (it doesn't affect the behaviour on KDE). // A workaround for Gnome/Metacity (it doesn't affect the behaviour on KDE).
// On Metacity the EmbeddedFrame's parent window bounds are larger // 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 // If both the height and the width differ from the fixed size then WM
// must level at least one side to the fixed size. For some reason it may take // must level at least one side to the fixed size. For some reason it may take
// a few hops (even after reparenting) and we have to skip the intermediate ones. // a few hops (even after reparenting) and we have to skip the intermediate ones.
ctrLog.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); XTrayIconPeer.this);
}
return; return;
} else if (ce.get_height() > TRAY_ICON_HEIGHT) { } 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); XTrayIconPeer.this);
}
XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), eframeParentID, XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), eframeParentID,
ce.get_x(), ce.get_x(),
@ -147,8 +153,10 @@ public class XTrayIconPeer implements TrayIconPeer,
} else if (ce.get_width() > TRAY_ICON_WIDTH) { } 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); XTrayIconPeer.this);
}
XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), eframeParentID, XlibWrapper.XMoveResizeWindow(XToolkit.getDisplay(), eframeParentID,
ce.get_x()+ce.get_width()/2 - TRAY_ICON_WIDTH/2, ce.get_x()+ce.get_width()/2 - TRAY_ICON_WIDTH/2,
@ -165,8 +173,10 @@ public class XTrayIconPeer implements TrayIconPeer,
if (ex_height != 0) { 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); XTrayIconPeer.this);
}
XlibWrapper.XMoveWindow(XToolkit.getDisplay(), eframeParentID, XlibWrapper.XMoveWindow(XToolkit.getDisplay(), eframeParentID,
ce.get_x(), ce.get_x(),
@ -174,15 +184,19 @@ public class XTrayIconPeer implements TrayIconPeer,
} else if (ex_width != 0) { } 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); XTrayIconPeer.this);
}
XlibWrapper.XMoveWindow(XToolkit.getDisplay(), eframeParentID, XlibWrapper.XMoveWindow(XToolkit.getDisplay(), eframeParentID,
ce.get_x() + ex_width/2 - TRAY_ICON_WIDTH/2, ce.get_x() + ex_width/2 - TRAY_ICON_WIDTH/2,
ce.get_y()); ce.get_y());
} else { } else {
ctrLog.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); XTrayIconPeer.this);
}
} }
} }
old_x = ce.get_x(); old_x = ce.get_x();

View File

@ -63,7 +63,9 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol {
req.set_format(32); req.set_format(32);
req.set_data(0, (WIN_STATE_MAXIMIZED_HORIZ | WIN_STATE_MAXIMIZED_VERT)); req.set_data(0, (WIN_STATE_MAXIMIZED_HORIZ | WIN_STATE_MAXIMIZED_VERT));
req.set_data(1, win_state); 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 { try {
XToolkit.awtLock(); XToolkit.awtLock();
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XlibWrapper.XSendEvent(XToolkit.getDisplay(),
@ -111,7 +113,9 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol {
win_state &= ~WIN_STATE_MAXIMIZED_HORIZ; win_state &= ~WIN_STATE_MAXIMIZED_HORIZ;
} }
if ((old_win_state ^ win_state) != 0) { 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); 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(0, layer == LAYER_NORMAL ? WIN_LAYER_NORMAL : WIN_LAYER_ONTOP);
req.set_data(1, 0); req.set_data(1, 0);
req.set_data(2, 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(); XToolkit.awtLock();
try { try {
XlibWrapper.XSendEvent(XToolkit.getDisplay(), XlibWrapper.XSendEvent(XToolkit.getDisplay(),
@ -171,7 +177,9 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol {
} }
req.dispose(); req.dispose();
} else { } 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); 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); WinWindow = checkAnchor(XA_WIN_SUPPORTING_WM_CHECK, XAtom.XA_CARDINAL);
supportChecked = true; 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() { boolean active() {
@ -206,13 +216,17 @@ class XWINProtocol extends XProtocol implements XStateProtocol, XLayerProtocol {
} }
boolean doStateProtocol() { boolean doStateProtocol() {
boolean res = active() && checkProtocol(XA_WIN_PROTOCOLS, XA_WIN_STATE); 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; return res;
} }
boolean doLayerProtocol() { boolean doLayerProtocol() {
boolean res = active() && checkProtocol(XA_WIN_PROTOCOLS, XA_WIN_LAYER); 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; return res;
} }
} }

View File

@ -148,7 +148,9 @@ final class XWM
XWM(int WMID) { XWM(int WMID) {
this.WMID = WMID; this.WMID = WMID;
initializeProtocols(); initializeProtocols();
if (log.isLoggable(PlatformLogger.FINE)) log.fine("Window manager: " + toString()); if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("Window manager: " + toString());
}
} }
int getID() { int getID() {
return WMID; return WMID;
@ -252,7 +254,7 @@ final class XWM
* having a window manager running. I.e. it does not reparent * having a window manager running. I.e. it does not reparent
* top level shells. * top level shells.
*/ */
if (insLog.isLoggable(PlatformLogger.FINE)) { if (insLog.isLoggable(PlatformLogger.FINER)) {
insLog.finer("eXcursion means NO_WM"); insLog.finer("eXcursion means NO_WM");
} }
return true; return true;
@ -270,7 +272,7 @@ final class XWM
long selection_owner = long selection_owner =
XlibWrapper.XGetSelectionOwner(XToolkit.getDisplay(), XlibWrapper.XGetSelectionOwner(XToolkit.getDisplay(),
XAtom.get(selection_name).getAtom()); XAtom.get(selection_name).getAtom());
if (insLog.isLoggable(PlatformLogger.FINE)) { if (insLog.isLoggable(PlatformLogger.FINER)) {
insLog.finer("selection owner of " + selection_name insLog.finer("selection owner of " + selection_name
+ " is " + selection_owner); + " is " + selection_owner);
} }
@ -299,7 +301,7 @@ final class XWM
XToolkit.getDefaultRootWindow(), XToolkit.getDefaultRootWindow(),
XConstants.CWEventMask, XConstants.CWEventMask,
substruct.pData); substruct.pData);
if (insLog.isLoggable(PlatformLogger.FINE)) { if (insLog.isLoggable(PlatformLogger.FINER)) {
insLog.finer("It looks like there is no WM thus NO_WM"); 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()); byte[] bytes = XlibWrapper.getStringBytes(getter.getData());
String id = new String(bytes); String id = new String(bytes);
log.finer("ENLIGHTENMENT_COMMS is " + id); if (log.isLoggable(PlatformLogger.FINER)) {
log.finer("ENLIGHTENMENT_COMMS is " + id);
}
// Parse WINID // Parse WINID
Pattern winIdPat = Pattern.compile("WINID\\s+(\\p{XDigit}{0,8})"); Pattern winIdPat = Pattern.compile("WINID\\s+(\\p{XDigit}{0,8})");
try { try {
Matcher match = winIdPat.matcher(id); Matcher match = winIdPat.matcher(id);
if (match.matches()) { 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); 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); 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; return winid;
} else { } else {
log.finer("ENLIGHTENMENT_COMMS has wrong format"); log.finer("ENLIGHTENMENT_COMMS has wrong format");
@ -407,7 +417,9 @@ final class XWM
static boolean isCDE() { static boolean isCDE() {
if (!XA_DT_SM_WINDOW_INFO.isInterned()) { 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; return false;
} }
@ -438,7 +450,9 @@ final class XWM
/* Now check that this window has _DT_SM_STATE_INFO (ignore contents) */ /* Now check that this window has _DT_SM_STATE_INFO (ignore contents) */
if (!XA_DT_SM_STATE_INFO.isInterned()) { if (!XA_DT_SM_STATE_INFO.isInterned()) {
log.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; return false;
} }
WindowPropertyGetter getter2 = WindowPropertyGetter getter2 =
@ -610,7 +624,9 @@ final class XWM
*/ */
if (!XA_ICEWM_WINOPTHINT.isInterned()) { 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; return false;
} }
@ -643,7 +659,9 @@ final class XWM
*/ */
static boolean isIceWM() { static boolean isIceWM() {
if (!XA_ICEWM_WINOPTHINT.isInterned()) { 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; return false;
} }
@ -654,7 +672,9 @@ final class XWM
try { try {
int status = getter.execute(); int status = getter.execute();
boolean res = (status == XConstants.Success && getter.getActualType() != 0); 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"); return !res || isNetWMName("IceWM");
} finally { } finally {
getter.dispose(); getter.dispose();
@ -816,7 +836,9 @@ final class XWM
} }
hints.set_flags(hints.get_flags() & ~mask); 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(), XlibWrapper.XSetWMNormalHints(XToolkit.getDisplay(),
window.getWindow(), window.getWindow(),
hints.pData); hints.pData);
@ -873,7 +895,9 @@ final class XWM
XAtomList decorDel = new XAtomList(); XAtomList decorDel = new XAtomList();
decorations = normalizeMotifDecor(decorations); 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) { if ((decorations & MWMConstants.MWM_DECOR_TITLE) == 0) {
decorDel.add(XA_OL_DECOR_HEADER); decorDel.add(XA_OL_DECOR_HEADER);
} }
@ -890,7 +914,9 @@ final class XWM
insLog.finer("Deleting OL_DECOR"); insLog.finer("Deleting OL_DECOR");
XA_OL_DECOR_DEL.DeleteProperty(window); XA_OL_DECOR_DEL.DeleteProperty(window);
} else { } 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); XA_OL_DECOR_DEL.setAtomListProperty(window, decorDel);
} }
} }
@ -918,7 +944,9 @@ final class XWM
hints.set_functions(functions); hints.set_functions(functions);
hints.set_decorations(decorations); 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); window.setMWMHints(hints);
} }
@ -980,7 +1008,9 @@ final class XWM
* Make specified shell resizable. * Make specified shell resizable.
*/ */
static void setShellResizable(XDecoratedPeer window) { 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(); XToolkit.awtLock();
try { try {
Rectangle shellBounds = window.getShellBounds(); Rectangle shellBounds = window.getShellBounds();
@ -1010,8 +1040,10 @@ final class XWM
static void setShellNotResizable(XDecoratedPeer window, WindowDimensions newDimensions, Rectangle shellBounds, static void setShellNotResizable(XDecoratedPeer window, WindowDimensions newDimensions, Rectangle shellBounds,
boolean justChangeSize) boolean justChangeSize)
{ {
if (insLog.isLoggable(PlatformLogger.FINE)) insLog.fine("Setting non-resizable shell " + window + ", dimensions " + newDimensions + if (insLog.isLoggable(PlatformLogger.FINE)) {
", shellBounds " + shellBounds +", just change size: " + justChangeSize); insLog.fine("Setting non-resizable shell " + window + ", dimensions " + newDimensions +
", shellBounds " + shellBounds +", just change size: " + justChangeSize);
}
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
/* Fix min/max size hints at the specified values */ /* Fix min/max size hints at the specified values */
@ -1142,7 +1174,9 @@ final class XWM
stateLog.finer("WithdrawnState"); stateLog.finer("WithdrawnState");
return false; return false;
} else { } 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; boolean is_state_change = false;
if (e.get_atom() == XA_WM_STATE.getAtom()) { if (e.get_atom() == XA_WM_STATE.getAtom()) {
@ -1151,7 +1185,9 @@ final class XWM
for (XStateProtocol proto : getProtocols(XStateProtocol.class)) { for (XStateProtocol proto : getProtocols(XStateProtocol.class)) {
is_state_change |= proto.isStateChange(e); 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; return is_state_change;
} }
@ -1303,7 +1339,9 @@ final class XWM
res = defaultInsets; 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; return res;
} }
/* /*
@ -1372,7 +1410,9 @@ final class XWM
XNETProtocol net_protocol = getWM().getNETProtocol(); XNETProtocol net_protocol = getWM().getNETProtocol();
if (net_protocol != null && net_protocol.active()) { if (net_protocol != null && net_protocol.active()) {
Insets insets = getInsetsFromProp(window, XA_NET_FRAME_EXTENTS); Insets insets = getInsetsFromProp(window, XA_NET_FRAME_EXTENTS);
insLog.fine("_NET_FRAME_EXTENTS: {0}", insets); if (insLog.isLoggable(PlatformLogger.FINE)) {
insLog.fine("_NET_FRAME_EXTENTS: {0}", insets);
}
if (insets != null) { if (insets != null) {
return insets; return insets;
@ -1513,7 +1553,9 @@ final class XWM
* [mwm, e!, kwin, fvwm2 ... ] * [mwm, e!, kwin, fvwm2 ... ]
*/ */
Insets correctWM = XWM.getInsetsFromExtents(window); 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) { if (correctWM == null) {
correctWM = new Insets(0,0,0,0); correctWM = new Insets(0,0,0,0);
@ -1574,7 +1616,9 @@ final class XWM
} }
case XWM.OTHER_WM: case XWM.OTHER_WM:
default: { /* this is very similar to the E! case above */ default: { /* this is very similar to the E! case above */
insLog.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); syncTopLevelPos(parent, lwinAttr);
int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(), int status = XlibWrapper.XGetWindowAttributes(XToolkit.getDisplay(),
window, lwinAttr.pData); window, lwinAttr.pData);
@ -1601,8 +1645,10 @@ final class XWM
&& lwinAttr.get_width()+2*lwinAttr.get_border_width() == pattr.get_width() && lwinAttr.get_width()+2*lwinAttr.get_border_width() == pattr.get_width()
&& lwinAttr.get_height()+2*lwinAttr.get_border_width() == pattr.get_height()) && lwinAttr.get_height()+2*lwinAttr.get_border_width() == pattr.get_height())
{ {
insLog.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, pattr, parent, window);
}
lwinAttr.set_x(pattr.get_x()); lwinAttr.set_x(pattr.get_x());
lwinAttr.set_y(pattr.get_y()); lwinAttr.set_y(pattr.get_y());
lwinAttr.set_border_width(lwinAttr.get_border_width()+pattr.get_border_width()); lwinAttr.set_border_width(lwinAttr.get_border_width()+pattr.get_border_width());
@ -1629,8 +1675,10 @@ final class XWM
* widths and inner/outer distinction, so for the time * widths and inner/outer distinction, so for the time
* being, just ignore it. * being, just ignore it.
*/ */
insLog.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); lwinAttr, pattr, parent, window);
}
correctWM = new Insets(lwinAttr.get_y() + lwinAttr.get_border_width(), correctWM = new Insets(lwinAttr.get_y() + lwinAttr.get_border_width(),
lwinAttr.get_x() + lwinAttr.get_border_width(), lwinAttr.get_x() + lwinAttr.get_border_width(),
pattr.get_height() - (lwinAttr.get_y() + lwinAttr.get_height() + 2*lwinAttr.get_border_width()), pattr.get_height() - (lwinAttr.get_y() + lwinAttr.get_height() + 2*lwinAttr.get_border_width()),

View File

@ -402,7 +402,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
((Component)e.getSource()).dispatchEvent(e); ((Component)e.getSource()).dispatchEvent(e);
} }
}, PeerEvent.ULTIMATE_PRIORITY_EVENT); }, 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); XToolkit.postEvent(XToolkit.targetToAppContext(e.getSource()), pe);
} }
@ -660,7 +662,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
if (isEventDisabled(xev)) { if (isEventDisabled(xev)) {
return; return;
} }
if (eventLog.isLoggable(PlatformLogger.FINE)) eventLog.fine(xbe.toString()); if (eventLog.isLoggable(PlatformLogger.FINE)) {
eventLog.fine(xbe.toString());
}
long when; long when;
int modifiers; int modifiers;
boolean popupTrigger = false; boolean popupTrigger = false;
@ -694,9 +698,11 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
/* /*
multiclick checking multiclick checking
*/ */
if (eventLog.isLoggable(PlatformLogger.FINEST)) eventLog.finest("lastWindow = " + lastWindow + ", lastButton " if (eventLog.isLoggable(PlatformLogger.FINEST)) {
+ lastButton + ", lastTime " + lastTime + ", multiClickTime " eventLog.finest("lastWindow = " + lastWindow + ", lastButton "
+ XToolkit.getMultiClickTime()); + lastButton + ", lastTime " + lastTime + ", multiClickTime "
+ XToolkit.getMultiClickTime());
}
if (lastWindow == this && lastButton == lbutton && (when - lastTime) < XToolkit.getMultiClickTime()) { if (lastWindow == this && lastButton == lbutton && (when - lastTime) < XToolkit.getMultiClickTime()) {
clickCount++; clickCount++;
} else { } else {
@ -885,7 +891,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
super.handleXCrossingEvent(xev); super.handleXCrossingEvent(xev);
XCrossingEvent xce = xev.get_xcrossing(); 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) { if (xce.get_type() == XConstants.EnterNotify) {
enterNotify(xce.get_window()); enterNotify(xce.get_window());
@ -987,8 +995,10 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
Rectangle oldBounds = getBounds(); Rectangle oldBounds = getBounds();
super.handleConfigureNotifyEvent(xev); 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)); xev.get_xconfigure(), isEventDisabled(xev));
}
if (isEventDisabled(xev)) { if (isEventDisabled(xev)) {
return; return;
} }
@ -1007,7 +1017,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
public void handleMapNotifyEvent(XEvent xev) { public void handleMapNotifyEvent(XEvent xev) {
super.handleMapNotifyEvent(xev); super.handleMapNotifyEvent(xev);
log.fine("Mapped {0}", this); if (log.isLoggable(PlatformLogger.FINE)) {
log.fine("Mapped {0}", this);
}
if (isEventDisabled(xev)) { if (isEventDisabled(xev)) {
return; return;
} }
@ -1029,10 +1041,12 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
} }
private void dumpKeysymArray(XKeyEvent ev) { private void dumpKeysymArray(XKeyEvent ev) {
keyEventLog.fine(" "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 0))+ if (keyEventLog.isLoggable(PlatformLogger.FINE)) {
"\n "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 1))+ keyEventLog.fine(" "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 0))+
"\n "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 2))+ "\n "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 1))+
"\n "+Long.toHexString(XlibWrapper.XKeycodeToKeysym(XToolkit.getDisplay(), ev.get_keycode(), 3))); "\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. 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); //return (uni > 0? uni + 0x01000000 : 0);
} }
void logIncomingKeyEvent(XKeyEvent ev) { void logIncomingKeyEvent(XKeyEvent ev) {
keyEventLog.fine("--XWindow.java:handleKeyEvent:"+ev); if (keyEventLog.isLoggable(PlatformLogger.FINE)) {
keyEventLog.fine("--XWindow.java:handleKeyEvent:"+ev);
}
dumpKeysymArray(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) { public void handleKeyPress(XEvent xev) {
super.handleKeyPress(xev); super.handleKeyPress(xev);
XKeyEvent ev = xev.get_xkey(); 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)) { if (isEventDisabled(xev)) {
return; return;
} }
@ -1153,7 +1173,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
if (unicodeKey > 0 && !isDeadKey) { 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, postKeyEvent( java.awt.event.KeyEvent.KEY_TYPED,
ev.get_time(), ev.get_time(),
java.awt.event.KeyEvent.VK_UNDEFINED, java.awt.event.KeyEvent.VK_UNDEFINED,
@ -1171,7 +1193,9 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
public void handleKeyRelease(XEvent xev) { public void handleKeyRelease(XEvent xev) {
super.handleKeyRelease(xev); super.handleKeyRelease(xev);
XKeyEvent ev = xev.get_xkey(); 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)) { if (isEventDisabled(xev)) {
return; return;
} }
@ -1333,10 +1357,14 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
void updateSizeHints(int x, int y, int width, int height) { void updateSizeHints(int x, int y, int width, int height) {
long flags = XUtilConstants.PSize | (isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition)); long flags = XUtilConstants.PSize | (isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition));
if (!isResizable()) { if (!isResizable()) {
log.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; flags |= XUtilConstants.PMinSize | XUtilConstants.PMaxSize;
} else { } 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); setSizeHints(flags, x, y, width, height);
} }
@ -1344,10 +1372,14 @@ public class XWindow extends XBaseWindow implements X11ComponentPeer {
void updateSizeHints(int x, int y) { void updateSizeHints(int x, int y) {
long flags = isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition); long flags = isLocationByPlatform() ? 0 : (XUtilConstants.PPosition | XUtilConstants.USPosition);
if (!isResizable()) { if (!isResizable()) {
log.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; flags |= XUtilConstants.PMinSize | XUtilConstants.PMaxSize | XUtilConstants.PSize;
} else { } 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); setSizeHints(flags, x, y, width, height);
} }

View File

@ -227,10 +227,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
if (owner != null) { if (owner != null) {
ownerPeer = (XWindowPeer)owner.getPeer(); ownerPeer = (XWindowPeer)owner.getPeer();
if (focusLog.isLoggable(PlatformLogger.FINER)) { if (focusLog.isLoggable(PlatformLogger.FINER)) {
focusLog.fine("Owner is " + owner); focusLog.finer("Owner is " + owner);
focusLog.fine("Owner peer is " + ownerPeer); focusLog.finer("Owner peer is " + ownerPeer);
focusLog.fine("Owner X window " + Long.toHexString(ownerPeer.getWindow())); focusLog.finer("Owner X window " + Long.toHexString(ownerPeer.getWindow()));
focusLog.fine("Owner content X window " + Long.toHexString(ownerPeer.getContentWindow())); focusLog.finer("Owner content X window " + Long.toHexString(ownerPeer.getContentWindow()));
} }
// as owner window may be an embedded window, we must get a toplevel window // as owner window may be an embedded window, we must get a toplevel window
// to set as TRANSIENT_FOR hint // to set as TRANSIENT_FOR hint
@ -239,8 +239,10 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
XToolkit.awtLock(); XToolkit.awtLock();
try { try {
// Set WM_TRANSIENT_FOR // Set WM_TRANSIENT_FOR
if (focusLog.isLoggable(PlatformLogger.FINE)) focusLog.fine("Setting transient on " + Long.toHexString(getWindow()) if (focusLog.isLoggable(PlatformLogger.FINE)) {
+ " for " + Long.toHexString(ownerWindow)); focusLog.fine("Setting transient on " + Long.toHexString(getWindow())
+ " for " + Long.toHexString(ownerWindow));
}
setToplevelTransientFor(this, ownerPeer, false, true); setToplevelTransientFor(this, ownerPeer, false, true);
// Set group leader // Set group leader
@ -777,7 +779,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
// override_redirect all we can do is check whether our parent // override_redirect all we can do is check whether our parent
// is active. If it is - we can freely synthesize focus transfer. // is active. If it is - we can freely synthesize focus transfer.
// Luckily, this logic is already implemented in requestWindowFocus. // 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); requestWindowFocus(time, timeProvided);
} }
@ -803,7 +807,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
public void handleFocusEvent(XEvent xev) { public void handleFocusEvent(XEvent xev) {
XFocusChangeEvent xfe = xev.get_xfocus(); XFocusChangeEvent xfe = xev.get_xfocus();
FocusEvent fe; FocusEvent fe;
focusLog.fine("{0}", xfe); if (focusLog.isLoggable(PlatformLogger.FINE)) {
focusLog.fine("{0}", xfe);
}
if (isEventDisabled(xev)) { if (isEventDisabled(xev)) {
return; return;
} }
@ -986,7 +992,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
} }
private void updateAlwaysOnTop() { 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, XWM.getWM().setLayer(this,
alwaysOnTop ? alwaysOnTop ?
XLayerProtocol.LAYER_ALWAYS_ON_TOP : XLayerProtocol.LAYER_ALWAYS_ON_TOP :
@ -1511,7 +1519,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
synchronized(getStateLock()) { synchronized(getStateLock()) {
XDialogPeer blockerPeer = (XDialogPeer) AWTAccessor.getComponentAccessor().getPeer(d); XDialogPeer blockerPeer = (XDialogPeer) AWTAccessor.getComponentAccessor().getPeer(d);
if (blocked) { 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; modalBlocker = d;
if (isReparented() || XWM.isNonReparentingWM()) { if (isReparented() || XWM.isNonReparentingWM()) {
@ -1900,7 +1910,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
@Override @Override
public void xSetVisible(boolean visible) { 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(); XToolkit.awtLock();
try { try {
this.visible = visible; this.visible = visible;
@ -2053,7 +2065,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
// since it generates MOUSE_ENTERED/MOUSE_EXITED for frame and dialog. // since it generates MOUSE_ENTERED/MOUSE_EXITED for frame and dialog.
// (fix for 6390326) // (fix for 6390326)
XBaseWindow target = XToolkit.windowToXWindow(xce.get_window()); XBaseWindow target = XToolkit.windowToXWindow(xce.get_window());
grabLog.finer(" - Grab event target {0}", target); if (grabLog.isLoggable(PlatformLogger.FINER)) {
grabLog.finer(" - Grab event target {0}", target);
}
if (target != null && target != this) { if (target != null && target != this) {
target.dispatchEvent(xev); target.dispatchEvent(xev);
return; return;
@ -2064,7 +2078,7 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
public void handleMotionNotify(XEvent xev) { public void handleMotionNotify(XEvent xev) {
XMotionEvent xme = xev.get_xmotion(); XMotionEvent xme = xev.get_xmotion();
if (grabLog.isLoggable(PlatformLogger.FINE)) { if (grabLog.isLoggable(PlatformLogger.FINER)) {
grabLog.finer("{0}, when grabbed {1}, contains {2}", grabLog.finer("{0}, when grabbed {1}, contains {2}",
xme, isGrabbed(), containsGlobal(xme.get_x_root(), xme.get_y_root())); 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_x(localCoord.x);
xme.set_y(localCoord.y); 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 != null) {
if (target != getContentXWindow() && target != this) { if (target != getContentXWindow() && target != this) {
target.dispatchEvent(xev); target.dispatchEvent(xev);
@ -2138,7 +2154,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
// translation) // translation)
XBaseWindow target = XToolkit.windowToXWindow(xbe.get_window()); XBaseWindow target = XToolkit.windowToXWindow(xbe.get_window());
try { try {
grabLog.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 if (xbe.get_type() == XConstants.ButtonPress
&& xbe.get_button() == XConstants.buttons[0]) && xbe.get_button() == XConstants.buttons[0])
{ {
@ -2172,7 +2190,9 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
// According to the specification of UngrabEvent, post it // According to the specification of UngrabEvent, post it
// when press occurs outside of the window and not on its owned windows // when press occurs outside of the window and not on its owned windows
if (xbe.get_type() == XConstants.ButtonPress) { 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())); postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
return; return;
} }
@ -2191,18 +2211,24 @@ class XWindowPeer extends XPanelPeer implements WindowPeer,
// toplevel == null - outside of // toplevel == null - outside of
// hierarchy, toplevel is Dialog - should // hierarchy, toplevel is Dialog - should
// send ungrab (but shouldn't for Window) // send ungrab (but shouldn't for Window)
grabLog.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())); postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
} }
} else { } else {
// toplevel is null - outside of hierarchy // 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())); postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
return; return;
} }
} else { } else {
// target doesn't map to XAWT window - outside of hierarchy // target doesn't map to XAWT window - outside of hierarchy
grabLog.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())); postEventToEventQueue(new sun.awt.UngrabEvent(getEventSource()));
return; return;
} }

View File

@ -806,11 +806,15 @@ public class WrapperGenerator {
} }
} }
if (s_size_32 != null && !s_size_32.equals(Integer.toString(acc_size_32))) { 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"); " 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))) { } 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"); " is not equal to the accumulated size " +acc_size_64+" of the fields");
}
} }
} }

View File

@ -326,8 +326,10 @@ public abstract class X11InputMethod extends InputMethodAdapter {
return; return;
if (lastXICFocussedComponent != null){ if (lastXICFocussedComponent != null){
if (log.isLoggable(PlatformLogger.FINE)) log.fine("XICFocused {0}, AWTFocused {1}", if (log.isLoggable(PlatformLogger.FINE)) {
lastXICFocussedComponent, awtFocussedComponent); log.fine("XICFocused {0}, AWTFocused {1}",
lastXICFocussedComponent, awtFocussedComponent);
}
} }
if (pData == 0) { if (pData == 0) {

View File

@ -360,7 +360,9 @@ public abstract class WComponentPeer extends WObjectPeer
} }
void handleJavaFocusEvent(FocusEvent fe) { 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); setFocus(fe.getID() == FocusEvent.FOCUS_GAINED);
} }
@ -693,7 +695,9 @@ public abstract class WComponentPeer extends WObjectPeer
} }
boolean res = wpeer.requestWindowFocus(cause); 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) // If parent window can be made focused and has been made focused(synchronously)
// then we can proceed with children, otherwise we retreat. // then we can proceed with children, otherwise we retreat.
if (!(res && parentWindow.isFocused())) { if (!(res && parentWindow.isFocused())) {
@ -713,7 +717,9 @@ public abstract class WComponentPeer extends WObjectPeer
} }
private boolean rejectFocusRequestHelper(String logMsg) { 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); WKeyboardFocusManagerPeer.removeLastFocusRequest((Component)target);
return false; return false;
} }
@ -1080,10 +1086,9 @@ public abstract class WComponentPeer extends WObjectPeer
@SuppressWarnings("deprecation") @SuppressWarnings("deprecation")
public void applyShape(Region shape) { public void applyShape(Region shape) {
if (shapeLog.isLoggable(PlatformLogger.FINER)) { if (shapeLog.isLoggable(PlatformLogger.FINER)) {
shapeLog.finer( shapeLog.finer("*** INFO: Setting shape: PEER: " + this
"*** INFO: Setting shape: PEER: " + this + "; TARGET: " + target
+ "; TARGET: " + target + "; SHAPE: " + shape);
+ "; SHAPE: " + shape);
} }
if (shape != null) { if (shape != null) {