< prev index next >

src/solaris/classes/sun/awt/X11/XComponentPeer.java

Print this page
rev 1571 : 8010297: Missing isLoggable() checks in logging code
Summary: Add isLoggable() checks
Reviewed-by: anthony, mchung, serb
Contributed-by: Laurent Bourges <bourges.laurent@gmail.com>

*** 414,424 **** case SNFH_FAILURE: return false; case SNFH_SUCCESS_PROCEED: // Currently we just generate focus events like we deal with lightweight instead of calling // XSetInputFocus on native window ! if (focusLog.isLoggable(Level.FINER)) focusLog.finer("Proceeding with request to " + lightweightChild + " in " + target); /** * The problems with requests in non-focused window arise because shouldNativelyFocusHeavyweight * checks that native window is focused while appropriate WINDOW_GAINED_FOCUS has not yet * been processed - it is in EventQueue. Thus, SNFH allows native request and stores request record * in requests list - and it breaks our requests sequence as first record on WGF should be the last focus --- 414,427 ---- case SNFH_FAILURE: return false; case SNFH_SUCCESS_PROCEED: // Currently we just generate focus events like we deal with lightweight instead of calling // XSetInputFocus on native window ! if (focusLog.isLoggable(Level.FINER)) { ! focusLog.finer("Proceeding with request to " + ! lightweightChild + " in " + target); ! } /** * The problems with requests in non-focused window arise because shouldNativelyFocusHeavyweight * checks that native window is focused while appropriate WINDOW_GAINED_FOCUS has not yet * been processed - it is in EventQueue. Thus, SNFH allows native request and stores request record * in requests list - and it breaks our requests sequence as first record on WGF should be the last focus
*** 436,456 **** * when a component inside a Frame is requesting it. */ wpeer.setActualFocusedWindow(null); boolean res = wpeer.requestWindowFocus(); ! if (focusLog.isLoggable(Level.FINER)) focusLog.finer("Requested window focus: " + res); // If parent window can be made focused and has been made focused(synchronously) // then we can proceed with children, otherwise we retreat. if (!(res && parentWindow.isFocused())) { focusLog.finer("Waiting for asynchronous processing of window focus request"); KeyboardFocusManagerPeerImpl.removeLastFocusRequest(target); return false; } } } else { ! if (focusLog.isLoggable(Level.FINER)) focusLog.finer("WARNING: Parent window is null"); return false; } // NOTE: We simulate heavyweight behavior of Motif - component receives focus right // after request, not after event. Normally, we should better listen for event --- 439,465 ---- * when a component inside a Frame is requesting it. */ wpeer.setActualFocusedWindow(null); boolean res = wpeer.requestWindowFocus(); ! if (focusLog.isLoggable(Level.FINER)) { ! focusLog.finer("Requested window focus: " + res); ! } // If parent window can be made focused and has been made focused(synchronously) // then we can proceed with children, otherwise we retreat. if (!(res && parentWindow.isFocused())) { + if (focusLog.isLoggable(Level.FINER)) { focusLog.finer("Waiting for asynchronous processing of window focus request"); + } KeyboardFocusManagerPeerImpl.removeLastFocusRequest(target); return false; } } } else { ! if (focusLog.isLoggable(Level.FINER)) { ! focusLog.finer("WARNING: Parent window is null"); ! } return false; } // NOTE: We simulate heavyweight behavior of Motif - component receives focus right // after request, not after event. Normally, we should better listen for event
*** 464,474 **** } return false; } void handleJavaFocusEvent(AWTEvent e) { ! if (focusLog.isLoggable(Level.FINER)) focusLog.finer(e.toString()); if (e.getID() == FocusEvent.FOCUS_GAINED) { focusGained((FocusEvent)e); } else { focusLost((FocusEvent)e); } --- 473,485 ---- } return false; } void handleJavaFocusEvent(AWTEvent e) { ! if (focusLog.isLoggable(Level.FINER)) { ! focusLog.finer(e.toString()); ! } if (e.getID() == FocusEvent.FOCUS_GAINED) { focusGained((FocusEvent)e); } else { focusLost((FocusEvent)e); }
*** 776,786 **** g.drawLine(x+1, y+height, x+width, y+height); // bottom g.drawLine(x+width, y+height, x+width, y+1); // right } public void setBackground(Color c) { ! if (log.isLoggable(Level.FINE)) log.fine("Set background to " + c); synchronized (getStateLock()) { if (background == null) { if (c == null) return; } else if (background.equals(c)) { return; --- 787,799 ---- g.drawLine(x+1, y+height, x+width, y+height); // bottom g.drawLine(x+width, y+height, x+width, y+1); // right } public void setBackground(Color c) { ! if (log.isLoggable(Level.FINE)) { ! log.fine("Set background to " + c); ! } synchronized (getStateLock()) { if (background == null) { if (c == null) return; } else if (background.equals(c)) { return;
*** 790,800 **** super.setBackground(c); repaint(); } public void setForeground(Color c) { ! if (log.isLoggable(Level.FINE)) log.fine("Set foreground to " + c); synchronized (getStateLock()) { if (foreground == null) { if (c == null) return; } else if (foreground.equals(c)) { return; --- 803,815 ---- super.setBackground(c); repaint(); } public void setForeground(Color c) { ! if (log.isLoggable(Level.FINE)) { ! log.fine("Set foreground to " + c); ! } synchronized (getStateLock()) { if (foreground == null) { if (c == null) return; } else if (foreground.equals(c)) { return;
*** 814,824 **** * @see java.awt.peer.ComponentPeer#getFontMetrics(Font) * @see Toolkit#getFontMetrics(Font) * @since JDK1.0 */ public FontMetrics getFontMetrics(Font font) { ! if (fontLog.isLoggable(Level.FINE)) fontLog.fine("Getting font metrics for " + font); return sun.font.FontDesignMetrics.getMetrics(font); } public void setFont(Font f) { if (f == null) { --- 829,841 ---- * @see java.awt.peer.ComponentPeer#getFontMetrics(Font) * @see Toolkit#getFontMetrics(Font) * @since JDK1.0 */ public FontMetrics getFontMetrics(Font font) { ! if (fontLog.isLoggable(Level.FINE)) { ! fontLog.fine("Getting font metrics for " + font); ! } return sun.font.FontDesignMetrics.getMetrics(font); } public void setFont(Font f) { if (f == null) {
< prev index next >