< prev index next >

src/java.desktop/unix/classes/sun/awt/X11/XEmbedChildProxyPeer.java

Print this page
rev 57801 : XXXXXXX: Component.xxxImage cleanup
Reviewed-by: XXX
   1 /*
   2  * Copyright (c) 2003, 2018, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  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.X11;
  27 
  28 import java.awt.*;
  29 import java.awt.event.*;




















  30 import java.awt.image.ColorModel;
  31 import java.awt.image.ImageObserver;
  32 import java.awt.image.ImageProducer;
  33 import java.awt.image.VolatileImage;
  34 import java.awt.peer.*;


  35 import sun.java2d.pipe.Region;
  36 import sun.awt.*;
  37 
  38 public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{
  39     XEmbeddingContainer container;
  40     XEmbedChildProxy proxy;
  41     long handle;
  42     XEmbedChildProxyPeer(XEmbedChildProxy proxy) {
  43         this.container = proxy.getEmbeddingContainer();
  44         this.handle = proxy.getHandle();
  45         this.proxy = proxy;
  46         initDispatching();
  47     }
  48 
  49     void initDispatching() {
  50         XToolkit.awtLock();
  51         try {
  52             XToolkit.addEventDispatcher(handle, this);
  53             XlibWrapper.XSelectInput(XToolkit.getDisplay(), handle,
  54                     XConstants.StructureNotifyMask | XConstants.PropertyChangeMask);
  55         }
  56         finally {


 231                   }
 232               }
 233 
 234               // NOTE: We simulate heavyweight behavior of Motif - component receives focus right
 235               // after request, not after event. Normally, we should better listen for event
 236               // by listeners.
 237 
 238               // TODO: consider replacing with XKeyboardFocusManagerPeer.deliverFocus
 239               return simulateMotifRequestFocus(lightweightChild, temporary, focusedWindowChangeAllowed, time);
 240               // Motif compatibility code
 241           case XKeyboardFocusManagerPeer.SNFH_SUCCESS_HANDLED:
 242               // Either lightweight or excessive requiest - all events are generated.
 243               return true;
 244         }
 245         return false;
 246     }
 247     public boolean              isFocusable() {
 248         return true;
 249     }
 250 
 251     public Image                createImage(ImageProducer producer) { return null; }
 252     public Image                createImage(int width, int height) { return null; }
 253     public VolatileImage        createVolatileImage(int width, int height) { return null; }
 254     public boolean              prepareImage(Image img, int w, int h, ImageObserver o) { return false; }
 255     public int                  checkImage(Image img, int w, int h, ImageObserver o) { return 0; }
 256     public GraphicsConfiguration getGraphicsConfiguration() { return null; }
 257     public boolean     handlesWheelScrolling() { return true; }
 258     public void createBuffers(int numBuffers, BufferCapabilities caps)
 259       throws AWTException { }
 260     public Image getBackBuffer() { return null; }
 261     public void flip(int x1, int y1, int x2, int y2, BufferCapabilities.FlipContents flipAction) {  }
 262     public void destroyBuffers() { }
 263 
 264     /**
 265      * Used by lightweight implementations to tell a ComponentPeer to layout
 266      * its sub-elements.  For instance, a lightweight Checkbox needs to layout
 267      * the box, as well as the text label.
 268      */
 269     public void        layout() {}
 270 
 271     Window getTopLevel(Component comp) {
 272         while (comp != null && !(comp instanceof Window)) {
 273             comp = comp.getParent();
 274         }
 275         return (Window)comp;


   1 /*
   2  * Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  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.X11;
  27 
  28 import java.awt.AWTEvent;
  29 import java.awt.AWTException;
  30 import java.awt.BufferCapabilities;
  31 import java.awt.Color;
  32 import java.awt.Component;
  33 import java.awt.Container;
  34 import java.awt.Dimension;
  35 import java.awt.Font;
  36 import java.awt.FontMetrics;
  37 import java.awt.Graphics;
  38 import java.awt.GraphicsConfiguration;
  39 import java.awt.Image;
  40 import java.awt.Point;
  41 import java.awt.Rectangle;
  42 import java.awt.Toolkit;
  43 import java.awt.Window;
  44 import java.awt.event.ComponentEvent;
  45 import java.awt.event.FocusEvent;
  46 import java.awt.event.InputEvent;
  47 import java.awt.event.InvocationEvent;
  48 import java.awt.event.KeyEvent;
  49 import java.awt.event.PaintEvent;
  50 import java.awt.image.ColorModel;


  51 import java.awt.image.VolatileImage;
  52 import java.awt.peer.ComponentPeer;
  53 import java.awt.peer.ContainerPeer;
  54 
  55 import sun.java2d.pipe.Region;

  56 
  57 public class XEmbedChildProxyPeer implements ComponentPeer, XEventDispatcher{
  58     XEmbeddingContainer container;
  59     XEmbedChildProxy proxy;
  60     long handle;
  61     XEmbedChildProxyPeer(XEmbedChildProxy proxy) {
  62         this.container = proxy.getEmbeddingContainer();
  63         this.handle = proxy.getHandle();
  64         this.proxy = proxy;
  65         initDispatching();
  66     }
  67 
  68     void initDispatching() {
  69         XToolkit.awtLock();
  70         try {
  71             XToolkit.addEventDispatcher(handle, this);
  72             XlibWrapper.XSelectInput(XToolkit.getDisplay(), handle,
  73                     XConstants.StructureNotifyMask | XConstants.PropertyChangeMask);
  74         }
  75         finally {


 250                   }
 251               }
 252 
 253               // NOTE: We simulate heavyweight behavior of Motif - component receives focus right
 254               // after request, not after event. Normally, we should better listen for event
 255               // by listeners.
 256 
 257               // TODO: consider replacing with XKeyboardFocusManagerPeer.deliverFocus
 258               return simulateMotifRequestFocus(lightweightChild, temporary, focusedWindowChangeAllowed, time);
 259               // Motif compatibility code
 260           case XKeyboardFocusManagerPeer.SNFH_SUCCESS_HANDLED:
 261               // Either lightweight or excessive requiest - all events are generated.
 262               return true;
 263         }
 264         return false;
 265     }
 266     public boolean              isFocusable() {
 267         return true;
 268     }
 269 

 270     public Image                createImage(int width, int height) { return null; }
 271     public VolatileImage        createVolatileImage(int width, int height) { return null; }


 272     public GraphicsConfiguration getGraphicsConfiguration() { return null; }
 273     public boolean     handlesWheelScrolling() { return true; }
 274     public void createBuffers(int numBuffers, BufferCapabilities caps)
 275       throws AWTException { }
 276     public Image getBackBuffer() { return null; }
 277     public void flip(int x1, int y1, int x2, int y2, BufferCapabilities.FlipContents flipAction) {  }
 278     public void destroyBuffers() { }
 279 
 280     /**
 281      * Used by lightweight implementations to tell a ComponentPeer to layout
 282      * its sub-elements.  For instance, a lightweight Checkbox needs to layout
 283      * the box, as well as the text label.
 284      */
 285     public void        layout() {}
 286 
 287     Window getTopLevel(Component comp) {
 288         while (comp != null && !(comp instanceof Window)) {
 289             comp = comp.getParent();
 290         }
 291         return (Window)comp;


< prev index next >