< prev index next >

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

Print this page

        

*** 78,87 **** --- 78,89 ---- /* * Called (on the Toolkit thread) before the appropriate * WindowStateEvent is posted to the EventQueue. */ private WindowListener windowListener; + private float scaleX; + private float scaleY; /** * Initialize JNI field IDs */ private static native void initIDs();
*** 188,198 **** ((Window) target).setBackground(SystemColor.window); } // Express our interest in display changes GraphicsConfiguration gc = getGraphicsConfiguration(); ! ((Win32GraphicsDevice)gc.getDevice()).addDisplayChangedListener(this); initActiveWindowsTracking((Window)target); updateIconImages(); --- 190,203 ---- ((Window) target).setBackground(SystemColor.window); } // Express our interest in display changes GraphicsConfiguration gc = getGraphicsConfiguration(); ! Win32GraphicsDevice gd = (Win32GraphicsDevice) gc.getDevice(); ! gd.addDisplayChangedListener(this); ! scaleX = gd.getDefaultScaleX(); ! scaleY = gd.getDefaultScaleY(); initActiveWindowsTracking((Window)target); updateIconImages();
*** 537,546 **** --- 542,564 ---- newDev.addDisplayChangedListener(this); } AWTAccessor.getComponentAccessor(). setGraphicsConfiguration((Component)target, winGraphicsConfig); + + checkDPIChange(newDev); + } + + private void checkDPIChange(Win32GraphicsDevice newDev) { + float newScaleX = newDev.getDefaultScaleX(); + float newScaleY = newDev.getDefaultScaleY(); + + if (scaleX != newScaleX || scaleY != newScaleY) { + windowDPIChange(scaleX, scaleY, newScaleX, newScaleY); + scaleX = newScaleX; + scaleY = newScaleY; + } } /** * From the DisplayChangedListener interface. *
*** 779,788 **** --- 797,809 ---- log.finer("Translucent window painter is null in updateWindow"); } } } + native void windowDPIChange(float prevScaleX, float prevScaleY, + float newScaleX, float newScaleY); + /* * The method maps the list of the active windows to the window's AppContext, * then the method registers ActiveWindowListener, GuiDisposedListener listeners; * it executes the initilialization only once per AppContext. */
< prev index next >