< prev index next >

src/java.desktop/windows/classes/sun/awt/windows/WComponentPeer.java

Print this page
rev 60071 : 8211999: Window positioning bugs due to overlapping GraphicsDevice bounds (Windows/HiDPI)
Reviewed-by: XXX


 516                 // No need for sync as disposeAction in Window is performed
 517                 // on EDT
 518                 if (!isDisposed()) {
 519                     try {
 520                         replaceSurfaceData();
 521                     } catch (InvalidPipeException e) {
 522                         // REMIND : what do we do if our surface creation failed?
 523                     }
 524                 }
 525             }
 526         };
 527         Component c = (Component)target;
 528         // Fix 6255371.
 529         if (!PaintEventDispatcher.getPaintEventDispatcher().queueSurfaceDataReplacing(c, r)) {
 530             postEvent(new InvocationEvent(c, r));
 531         }
 532     }
 533 
 534     @Override
 535     public boolean updateGraphicsData(GraphicsConfiguration gc) {

 536         winGraphicsConfig = (Win32GraphicsConfig)gc;



 537         try {
 538             replaceSurfaceData();
 539         } catch (InvalidPipeException e) {
 540             // REMIND : what do we do if our surface creation failed?
 541         }
 542         return false;








 543     }
 544 
 545     //This will return null for Components not yet added to a Container
 546     @Override
 547     public ColorModel getColorModel() {
 548         GraphicsConfiguration gc = getGraphicsConfiguration();
 549         if (gc != null) {
 550             return gc.getColorModel();
 551         }
 552         else {
 553             return null;
 554         }
 555     }
 556 
 557     //This will return null for Components not yet added to a Container
 558     public ColorModel getDeviceColorModel() {
 559         Win32GraphicsConfig gc =
 560             (Win32GraphicsConfig)getGraphicsConfiguration();
 561         if (gc != null) {
 562             return gc.getDeviceColorModel();




 516                 // No need for sync as disposeAction in Window is performed
 517                 // on EDT
 518                 if (!isDisposed()) {
 519                     try {
 520                         replaceSurfaceData();
 521                     } catch (InvalidPipeException e) {
 522                         // REMIND : what do we do if our surface creation failed?
 523                     }
 524                 }
 525             }
 526         };
 527         Component c = (Component)target;
 528         // Fix 6255371.
 529         if (!PaintEventDispatcher.getPaintEventDispatcher().queueSurfaceDataReplacing(c, r)) {
 530             postEvent(new InvocationEvent(c, r));
 531         }
 532     }
 533 
 534     @Override
 535     public boolean updateGraphicsData(GraphicsConfiguration gc) {
 536         var old = getGraphicsConfiguration().getDefaultTransform();
 537         winGraphicsConfig = (Win32GraphicsConfig)gc;
 538         if (gc != null && !old.equals(gc.getDefaultTransform())) {
 539             syncBounds(); // the bound of the peer depends on the DPI
 540         }
 541         try {
 542             replaceSurfaceData();
 543         } catch (InvalidPipeException e) {
 544             // REMIND : what do we do if our surface creation failed?
 545         }
 546         return false;
 547     }
 548 
 549     /**
 550      * Make sure that the native peer's coordinates are in sync with the target.
 551      */
 552     void syncBounds(){
 553         Rectangle r = ((Component)target).getBounds();
 554         setBounds(r.x, r.y, r.width, r.height, SET_BOUNDS);
 555     }
 556 
 557     //This will return null for Components not yet added to a Container
 558     @Override
 559     public ColorModel getColorModel() {
 560         GraphicsConfiguration gc = getGraphicsConfiguration();
 561         if (gc != null) {
 562             return gc.getColorModel();
 563         }
 564         else {
 565             return null;
 566         }
 567     }
 568 
 569     //This will return null for Components not yet added to a Container
 570     public ColorModel getDeviceColorModel() {
 571         Win32GraphicsConfig gc =
 572             (Win32GraphicsConfig)getGraphicsConfiguration();
 573         if (gc != null) {
 574             return gc.getDeviceColorModel();


< prev index next >