jdk/src/windows/classes/sun/awt/windows/WEmbeddedFrame.java

Print this page
rev 5693 : 7192977: Issue in toolkit thread
Reviewed-by: skoivu, rupashka, art


  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.awt.windows;
  27 
  28 import sun.awt.*;
  29 import java.awt.*;
  30 import java.awt.event.*;
  31 import java.awt.peer.ComponentPeer;
  32 import java.util.*;
  33 import java.awt.color.*;
  34 import java.awt.image.*;
  35 import sun.awt.image.ByteInterleavedRaster;
  36 import sun.security.action.GetPropertyAction;
  37 import java.lang.reflect.*;
  38 
  39 public class WEmbeddedFrame extends EmbeddedFrame {
  40 
  41     static {
  42         initIDs();
  43     }
  44 
  45     private long handle;
  46 
  47     private int bandWidth = 0;
  48     private int bandHeight = 0;
  49     private int imgWid = 0;
  50     private int imgHgt = 0;
  51 
  52     private static int pScale = 0;
  53     private static final int MAX_BAND_SIZE = (1024*30);
  54 
  55     private static String printScale = (String) java.security.AccessController
  56        .doPrivileged(new GetPropertyAction("sun.java2d.print.pluginscalefactor"));
  57 


 215     private static native void initIDs();
 216 
 217     /**
 218      * This method is called from the native code when this embedded
 219      * frame should be activated. It is expected to be overridden in
 220      * subclasses, for example, in plugin to activate the browser
 221      * window that contains this embedded frame.
 222      *
 223      * NOTE: This method may be called by privileged threads.
 224      *     DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 225      */
 226     public void activateEmbeddingTopLevel() {
 227     }
 228 
 229     public void synthesizeWindowActivation(final boolean doActivate) {
 230         if (!doActivate || EventQueue.isDispatchThread()) {
 231             ((WEmbeddedFramePeer)getPeer()).synthesizeWmActivate(doActivate);
 232         } else {
 233             // To avoid focus concurrence b/w IE and EmbeddedFrame
 234             // activation is postponed by means of posting it to EDT.
 235             EventQueue.invokeLater(new Runnable() {
 236                     public void run() {
 237                         ((WEmbeddedFramePeer)getPeer()).synthesizeWmActivate(true);
 238                     }
 239                 });


 240         }
 241     }
 242 
 243     public void registerAccelerator(AWTKeyStroke stroke) {}
 244     public void unregisterAccelerator(AWTKeyStroke stroke) {}
 245 
 246     /**
 247      * Should be overridden in subclasses. Call to
 248      *     super.notifyModalBlocked(blocker, blocked) must be present
 249      *     when overriding.
 250      * It may occur that embedded frame is not put into its
 251      *     container at the moment when it is blocked, for example,
 252      *     when running an applet in IE. Then the call to this method
 253      *     should be delayed until embedded frame is reparented.
 254      *
 255      * NOTE: This method may be called by privileged threads.
 256      *     DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 257      */
 258     public void notifyModalBlocked(Dialog blocker, boolean blocked) {
 259         try {


  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package sun.awt.windows;
  27 
  28 import sun.awt.*;
  29 import java.awt.*;
  30 import java.awt.event.*;
  31 import java.awt.peer.ComponentPeer;


  32 import java.awt.image.*;
  33 import sun.awt.image.ByteInterleavedRaster;
  34 import sun.security.action.GetPropertyAction;

  35 
  36 public class WEmbeddedFrame extends EmbeddedFrame {
  37 
  38     static {
  39         initIDs();
  40     }
  41 
  42     private long handle;
  43 
  44     private int bandWidth = 0;
  45     private int bandHeight = 0;
  46     private int imgWid = 0;
  47     private int imgHgt = 0;
  48 
  49     private static int pScale = 0;
  50     private static final int MAX_BAND_SIZE = (1024*30);
  51 
  52     private static String printScale = (String) java.security.AccessController
  53        .doPrivileged(new GetPropertyAction("sun.java2d.print.pluginscalefactor"));
  54 


 212     private static native void initIDs();
 213 
 214     /**
 215      * This method is called from the native code when this embedded
 216      * frame should be activated. It is expected to be overridden in
 217      * subclasses, for example, in plugin to activate the browser
 218      * window that contains this embedded frame.
 219      *
 220      * NOTE: This method may be called by privileged threads.
 221      *     DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 222      */
 223     public void activateEmbeddingTopLevel() {
 224     }
 225 
 226     public void synthesizeWindowActivation(final boolean doActivate) {
 227         if (!doActivate || EventQueue.isDispatchThread()) {
 228             ((WEmbeddedFramePeer)getPeer()).synthesizeWmActivate(doActivate);
 229         } else {
 230             // To avoid focus concurrence b/w IE and EmbeddedFrame
 231             // activation is postponed by means of posting it to EDT.
 232             Runnable r = new Runnable() {
 233                 public void run() {
 234                     ((WEmbeddedFramePeer)getPeer()).synthesizeWmActivate(true);
 235                 }
 236             };
 237             WToolkit.postEvent(WToolkit.targetToAppContext(this),
 238                                new InvocationEvent(this, r));
 239         }
 240     }
 241 
 242     public void registerAccelerator(AWTKeyStroke stroke) {}
 243     public void unregisterAccelerator(AWTKeyStroke stroke) {}
 244 
 245     /**
 246      * Should be overridden in subclasses. Call to
 247      *     super.notifyModalBlocked(blocker, blocked) must be present
 248      *     when overriding.
 249      * It may occur that embedded frame is not put into its
 250      *     container at the moment when it is blocked, for example,
 251      *     when running an applet in IE. Then the call to this method
 252      *     should be delayed until embedded frame is reparented.
 253      *
 254      * NOTE: This method may be called by privileged threads.
 255      *     DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 256      */
 257     public void notifyModalBlocked(Dialog blocker, boolean blocked) {
 258         try {