diff --git a/src/org/jitsi/util/swing/VideoContainer.java b/src/org/jitsi/util/swing/VideoContainer.java index 41194e97ec18a950adcdf87bf404d13816791cdb..355d91bd57691f44d0e2c9333d383ef7ba9242bb 100644 --- a/src/org/jitsi/util/swing/VideoContainer.java +++ b/src/org/jitsi/util/swing/VideoContainer.java @@ -9,8 +9,6 @@ import java.awt.*; import java.awt.event.*; -import org.jitsi.util.*; - /** * Implements a <tt>Container</tt> for video/visual <tt>Component</tt>s. * <tt>VideoContainer</tt> uses {@link VideoLayout} to layout the video/visual @@ -29,10 +27,10 @@ public class VideoContainer private static final long serialVersionUID = 0L; /** - * The default background color. + * The default background color of <tt>VideoContainer</tt> when it contains + * <tt>Component</tt> instances other than {@link #noVideoComponent}. */ - public static final Color DEFAULT_BACKGROUND_COLOR - = OSUtils.IS_MAC ? Color.BLACK : null; + public static final Color DEFAULT_BACKGROUND_COLOR = Color.BLACK; private int inAddOrRemove; @@ -64,6 +62,9 @@ public VideoContainer(Component noVideoComponent, boolean conference) this.noVideoComponent = noVideoComponent; + if (DEFAULT_BACKGROUND_COLOR != null) + setBackground(DEFAULT_BACKGROUND_COLOR); + addContainerListener( new ContainerListener() { @@ -176,10 +177,29 @@ private void exitAddOrRemove() private void onContainerEvent(ContainerEvent ev) { - synchronized (syncRoot) + try { - if (inAddOrRemove != 0) - validateAndRepaint = true; + if (DEFAULT_BACKGROUND_COLOR != null) + { + int componentCount = getComponentCount(); + + if ((componentCount == 1) + && (getComponent(0) + == VideoContainer.this.noVideoComponent)) + { + componentCount = 0; + } + + setOpaque(componentCount > 0); + } + } + finally + { + synchronized (syncRoot) + { + if (inAddOrRemove != 0) + validateAndRepaint = true; + } } }