jdk/src/java.desktop/unix/classes/sun/awt/X11/XWindow.java
changeset 30469 bac0a7ff7e1e
parent 28231 b608ffcaed74
child 31156 11ae3ca525cc
equal deleted inserted replaced
30468:a016d2637922 30469:bac0a7ff7e1e
     1 /*
     1 /*
     2  * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     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
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
    32 
    32 
    33 import java.lang.ref.WeakReference;
    33 import java.lang.ref.WeakReference;
    34 
    34 
    35 import java.lang.reflect.Method;
    35 import java.lang.reflect.Method;
    36 
    36 
       
    37 import sun.awt.AWTAccessor.ComponentAccessor;
    37 import sun.util.logging.PlatformLogger;
    38 import sun.util.logging.PlatformLogger;
    38 
    39 
    39 import sun.awt.*;
    40 import sun.awt.*;
    40 
    41 
    41 import sun.awt.image.PixelConverter;
    42 import sun.awt.image.PixelConverter;
   280 
   281 
   281     boolean isReparented() {
   282     boolean isReparented() {
   282         return reparented;
   283         return reparented;
   283     }
   284     }
   284 
   285 
   285     @SuppressWarnings("deprecation")
       
   286     static long getParentWindowID(Component target) {
   286     static long getParentWindowID(Component target) {
   287 
   287 
   288         ComponentPeer peer = target.getParent().getPeer();
       
   289         Component temp = target.getParent();
   288         Component temp = target.getParent();
       
   289         final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
       
   290         ComponentPeer peer = acc.getPeer(temp);
   290         while (!(peer instanceof XWindow))
   291         while (!(peer instanceof XWindow))
   291         {
   292         {
   292             temp = temp.getParent();
   293             temp = temp.getParent();
   293             peer = temp.getPeer();
   294             peer = acc.getPeer(temp);
   294         }
   295         }
   295 
   296 
   296         if (peer != null && peer instanceof XWindow)
   297         if (peer != null && peer instanceof XWindow)
   297             return ((XWindow)peer).getContentWindow();
   298             return ((XWindow)peer).getContentWindow();
   298         else return 0;
   299         else return 0;
   299     }
   300     }
   300 
   301 
   301 
   302 
   302     @SuppressWarnings("deprecation")
       
   303     static XWindow getParentXWindowObject(Component target) {
   303     static XWindow getParentXWindowObject(Component target) {
   304         if (target == null) return null;
   304         if (target == null) return null;
   305         Component temp = target.getParent();
   305         Component temp = target.getParent();
   306         if (temp == null) return null;
   306         if (temp == null) return null;
   307         ComponentPeer peer = temp.getPeer();
   307         final ComponentAccessor acc = AWTAccessor.getComponentAccessor();
       
   308         ComponentPeer peer = acc.getPeer(temp);
   308         if (peer == null) return null;
   309         if (peer == null) return null;
   309         while ((peer != null) && !(peer instanceof XWindow))
   310         while ((peer != null) && !(peer instanceof XWindow))
   310         {
   311         {
   311             temp = temp.getParent();
   312             temp = temp.getParent();
   312             peer = temp.getPeer();
   313             peer = acc.getPeer(temp);
   313         }
   314         }
   314         if (peer != null && peer instanceof XWindow)
   315         if (peer != null && peer instanceof XWindow)
   315             return (XWindow) peer;
   316             return (XWindow) peer;
   316         else return null;
   317         else return null;
   317     }
   318     }
   550         int y = xe.get_y();
   551         int y = xe.get_y();
   551         int w = xe.get_width();
   552         int w = xe.get_width();
   552         int h = xe.get_height();
   553         int h = xe.get_height();
   553 
   554 
   554         Component target = getEventSource();
   555         Component target = getEventSource();
   555         AWTAccessor.ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
   556         ComponentAccessor compAccessor = AWTAccessor.getComponentAccessor();
   556 
   557 
   557         if (!compAccessor.getIgnoreRepaint(target)
   558         if (!compAccessor.getIgnoreRepaint(target)
   558             && compAccessor.getWidth(target) != 0
   559             && compAccessor.getWidth(target) != 0
   559             && compAccessor.getHeight(target) != 0)
   560             && compAccessor.getHeight(target) != 0)
   560         {
   561         {