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

Print this page




 125             boolean needHandleResize = !(newBounds.equals(getBounds()));
 126             reshape(newBounds);
 127             if (needHandleResize) {
 128                 insLog.fine("Sending RESIZED");
 129                 handleResize(newBounds);
 130             }
 131         } finally {
 132             XToolkit.awtUnlock();
 133         }
 134         validateSurface();
 135     }
 136 
 137     // NOTE: This method may be called by privileged threads.
 138     //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 139     public void handleResize(Rectangle bounds) {
 140         AWTAccessor.getComponentAccessor().setSize((Component)target, bounds.width, 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
 154         // actually handle saved expose events on deiconification.
 155 
 156         if (parentFrame instanceof XFramePeer &&
 157                 (((XFramePeer)parentFrame).getState() & java.awt.Frame.ICONIFIED) != 0) {
 158             // Save expose events if the frame is iconified
 159             // in order to handle them on deiconification.
 160             iconifiedExposeEvents.add(new SavedExposeEvent(target, x, y, w, h));
 161         } else {
 162             // Normal case: [it is not a frame or] the frame is not iconified.
 163             super.handleExposeEvent(target, x, y, w, h);
 164         }
 165     }
 166 
 167     void purgeIconifiedExposeEvents() {
 168         for (SavedExposeEvent evt : iconifiedExposeEvents) {
 169             super.handleExposeEvent(evt.target, evt.x, evt.y, evt.w, evt.h);
 170         }
 171         iconifiedExposeEvents.clear();
 172     }
 173 
 174     private static class SavedExposeEvent {
 175         Component target;
 176         int x, y, w, h;
 177         SavedExposeEvent(Component target, int x, int y, int w, int h) {
 178             this.target = target;
 179             this.x = x;
 180             this.y = y;
 181             this.w = w;
 182             this.h = h;
 183         }
 184     }
 185 
 186     public String toString() {
 187         return getClass().getName() + "[" + getBounds() + "]";
 188     }
 189 }


 125             boolean needHandleResize = !(newBounds.equals(getBounds()));
 126             reshape(newBounds);
 127             if (needHandleResize) {
 128                 insLog.fine("Sending RESIZED");
 129                 handleResize(newBounds);
 130             }
 131         } finally {
 132             XToolkit.awtUnlock();
 133         }
 134         validateSurface();
 135     }
 136 
 137     // NOTE: This method may be called by privileged threads.
 138     //       DO NOT INVOKE CLIENT CODE ON THIS THREAD!
 139     public void handleResize(Rectangle bounds) {
 140         AWTAccessor.getComponentAccessor().setSize((Component)target, bounds.width, bounds.height);
 141         postEvent(new ComponentEvent(target, ComponentEvent.COMPONENT_RESIZED));
 142     }
 143 
 144 
 145     public void postPaintEvent(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
 154         // actually handle saved expose events on deiconification.
 155 
 156         if (parentFrame instanceof XFramePeer &&
 157                 (((XFramePeer)parentFrame).getState() & java.awt.Frame.ICONIFIED) != 0) {
 158             // Save expose events if the frame is iconified
 159             // in order to handle them on deiconification.
 160             iconifiedExposeEvents.add(new SavedExposeEvent(target, x, y, w, h));
 161         } else {
 162             // Normal case: [it is not a frame or] the frame is not iconified.
 163             super.postPaintEvent(target, x, y, w, h);
 164         }
 165     }
 166 
 167     void purgeIconifiedExposeEvents() {
 168         for (SavedExposeEvent evt : iconifiedExposeEvents) {
 169             super.postPaintEvent(evt.target, evt.x, evt.y, evt.w, evt.h);
 170         }
 171         iconifiedExposeEvents.clear();
 172     }
 173 
 174     private static class SavedExposeEvent {
 175         Component target;
 176         int x, y, w, h;
 177         SavedExposeEvent(Component target, int x, int y, int w, int h) {
 178             this.target = target;
 179             this.x = x;
 180             this.y = y;
 181             this.w = w;
 182             this.h = h;
 183         }
 184     }
 185 
 186     public String toString() {
 187         return getClass().getName() + "[" + getBounds() + "]";
 188     }
 189 }