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

Print this page




  88         return "Content window";
  89     }
  90     protected boolean isEventDisabled(XEvent e) {
  91         switch (e.get_type()) {
  92           // Override parentFrame to receive MouseEnter/Exit
  93           case XConstants.EnterNotify:
  94           case XConstants.LeaveNotify:
  95               return false;
  96           // We handle ConfigureNotify specifically in XDecoratedPeer
  97           case XConstants.ConfigureNotify:
  98               return true;
  99           // We don't want SHOWN/HIDDEN on content window since it will duplicate XDecoratedPeer
 100           case XConstants.MapNotify:
 101           case XConstants.UnmapNotify:
 102               return true;
 103           default:
 104               return super.isEventDisabled(e) || parentFrame.isEventDisabled(e);
 105         }
 106     }
 107 
 108     // Coordinates are that of the shell
 109     void setContentBounds(WindowDimensions dims) {




 110         XToolkit.awtLock();
 111         try {
 112             // Bounds of content window are of the same size as bounds of Java window and with
 113             // location as -(insets)
 114             Rectangle newBounds = dims.getBounds();
 115             Insets in = dims.getInsets();
 116             if (in != null) {
 117                 newBounds.setLocation(-in.left, -in.top);
 118             }
 119             if (insLog.isLoggable(Level.FINE)) insLog.log(Level.FINE, "Setting content bounds {0}, old bounds {1}",
 120                                                           new Object[] {newBounds, getBounds()});
 121             // Fix for 5023533:
 122             // Change in the size of the content window means, well, change of the size
 123             // Change in the location of the content window means change in insets
 124             boolean needHandleResize = !(newBounds.equals(getBounds()));
 125             reshape(newBounds);
 126             if (needHandleResize) {
 127                 insLog.fine("Sending RESIZED");
 128                 handleResize(newBounds);
 129             }


 130         } finally {
 131             XToolkit.awtUnlock();
 132         }
 133         validateSurface();
 134     }
 135 
 136     // NOTE: This method may be called by privileged threads.
 137     //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 138     public void handleResize(Rectangle bounds) {
 139         ComponentAccessor.setWidth((Component)target, bounds.width);
 140         ComponentAccessor.setHeight((Component)target, bounds.height);
 141         postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_RESIZED));
 142     }
 143 
 144 
 145     public void handleExposeEvent(Component target, int x, int y, int w, int h) {
 146         // TODO: ?
 147         // get rid of 'istanceof' by subclassing:
 148         // XContentWindow -> XFrameContentWindow
 149 
 150         // Expose event(s) that result from deiconification
 151         // come before a deicinofication notification.
 152         // We reorder these events by saving all expose events
 153         // that come when the frame is iconified. Then we




  88         return "Content window";
  89     }
  90     protected boolean isEventDisabled(XEvent e) {
  91         switch (e.get_type()) {
  92           // Override parentFrame to receive MouseEnter/Exit
  93           case XConstants.EnterNotify:
  94           case XConstants.LeaveNotify:
  95               return false;
  96           // We handle ConfigureNotify specifically in XDecoratedPeer
  97           case XConstants.ConfigureNotify:
  98               return true;
  99           // We don't want SHOWN/HIDDEN on content window since it will duplicate XDecoratedPeer
 100           case XConstants.MapNotify:
 101           case XConstants.UnmapNotify:
 102               return true;
 103           default:
 104               return super.isEventDisabled(e) || parentFrame.isEventDisabled(e);
 105         }
 106     }
 107 
 108     /**
 109      * Sets content window bounds.
 110      *
 111      * @return whether a COMPONENT_RESIZED event has been sent
 112      */
 113     boolean setContentBounds(WindowDimensions dims) {
 114         XToolkit.awtLock();
 115         try {
 116             // Bounds of content window are of the same size as bounds of Java window and with
 117             // location as -(insets)
 118             Rectangle newBounds = dims.getBounds();
 119             Insets in = dims.getInsets();
 120             if (in != null) {
 121                 newBounds.setLocation(-in.left, -in.top);
 122             }
 123             if (insLog.isLoggable(Level.FINE)) insLog.log(Level.FINE, "Setting content bounds {0}, old bounds {1}",
 124                                                           new Object[] {newBounds, getBounds()});
 125             // Fix for 5023533:
 126             // Change in the size of the content window means, well, change of the size
 127             // Change in the location of the content window means change in insets
 128             boolean needHandleResize = !(newBounds.equals(getBounds()));
 129             reshape(newBounds);
 130             if (needHandleResize) {
 131                 insLog.fine("Sending RESIZED");
 132                 handleResize(newBounds);
 133             }
 134             validateSurface();
 135             return needHandleResize;
 136         } finally {
 137             XToolkit.awtUnlock();
 138         }

 139     }
 140 
 141     // NOTE: This method may be called by privileged threads.
 142     //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 143     public void handleResize(Rectangle bounds) {
 144         ComponentAccessor.setWidth((Component)target, bounds.width);
 145         ComponentAccessor.setHeight((Component)target, bounds.height);
 146         postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_RESIZED));
 147     }
 148 
 149 
 150     public void handleExposeEvent(Component target, int x, int y, int w, int h) {
 151         // TODO: ?
 152         // get rid of 'istanceof' by subclassing:
 153         // XContentWindow -> XFrameContentWindow
 154 
 155         // Expose event(s) that result from deiconification
 156         // come before a deicinofication notification.
 157         // We reorder these events by saving all expose events
 158         // that come when the frame is iconified. Then we