< prev index next >

src/java.desktop/windows/native/libawt/windows/awt_Window.cpp

Print this page




1925 }
1926 
1927 MsgRouting AwtWindow::WmGetIcon(WPARAM iconType, LRESULT& retValue)
1928 {
1929     return mrDoDefault;
1930 }
1931 
1932 LRESULT AwtWindow::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
1933 {
1934     MsgRouting mr = mrDoDefault;
1935     LRESULT retValue = 0L;
1936 
1937     switch(message) {
1938         case WM_GETICON:
1939             mr = WmGetIcon(wParam, retValue);
1940             break;
1941         case WM_SYSCOMMAND:
1942             //Fixed 6355340: Contents of frame are not layed out properly on maximize
1943             if ((wParam & 0xFFF0) == SC_SIZE) {
1944                 AwtWindow::sm_resizing = TRUE;
1945                 mr = WmSysCommand(wParam, GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
1946                 if (mr != mrConsume) {
1947                     // Perform size-move loop here
1948                     AwtWindow::DefWindowProc(message, wParam, lParam);
1949                 }
1950                 AwtWindow::sm_resizing = FALSE;
1951                 if (!AwtToolkit::GetInstance().IsDynamicLayoutActive()) {
1952                     WindowResized();
1953                 } else {
1954                     /*
1955                      * 8016356: check whether window snapping occurred after
1956                      * resizing, i.e. GetWindowRect() returns the real
1957                      * (snapped) window rectangle, e.g. (179, 0)-(483, 1040),
1958                      * but GetWindowPlacement() returns the rectangle of
1959                      * normal window position, e.g. (179, 189)-(483, 445) and
1960                      * they are different. If so, send ComponentResized event.
1961                      */
1962                     WINDOWPLACEMENT wp;
1963                     ::GetWindowPlacement(GetHWnd(), &wp);
1964                     RECT rc;
1965                     ::GetWindowRect(GetHWnd(), &rc);


2130 }
2131 
2132 void AwtWindow::WindowDPIChange(int prevScreen,
2133                                 float prevScaleX, float prevScaleY,
2134                                 int screen, float scaleX,
2135                                 float scaleY)
2136 {
2137     int x;
2138     int y;
2139     int w;
2140     int h;
2141     RECT rect;
2142 
2143     if (prevScaleX == scaleX && prevScaleY == scaleY) {
2144         return;
2145     }
2146 
2147     ::GetWindowRect(GetHWnd(), &rect);
2148     x = rect.left;
2149     y = rect.top;
2150     w = (rect.right - rect.left) * scaleX / prevScaleX;
2151     h = (rect.bottom - rect.top) * scaleY / prevScaleY;
2152 
2153     if (prevScreen != screen) {
2154         Devices::InstanceAccess devices;
2155         AwtWin32GraphicsDevice* device = devices->GetDevice(screen);
2156         if (device) {
2157             RECT bounds;
2158             if (MonitorBounds(device->GetMonitor(), &bounds)) {
2159                 x = x < bounds.left ? bounds.left : x;
2160                 y = y < bounds.top ? bounds.top : y;
2161 
2162                 x = (x + w > bounds.right) ? bounds.right - w : x;
2163                 y = (y + h > bounds.bottom) ? bounds.bottom - h : y;
2164             }
2165         }
2166     }
2167 
2168     ReshapeNoScale(x, y, w, h);
2169 }
2170 
2171 BOOL AwtWindow::IsFocusableWindow() {




1925 }
1926 
1927 MsgRouting AwtWindow::WmGetIcon(WPARAM iconType, LRESULT& retValue)
1928 {
1929     return mrDoDefault;
1930 }
1931 
1932 LRESULT AwtWindow::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
1933 {
1934     MsgRouting mr = mrDoDefault;
1935     LRESULT retValue = 0L;
1936 
1937     switch(message) {
1938         case WM_GETICON:
1939             mr = WmGetIcon(wParam, retValue);
1940             break;
1941         case WM_SYSCOMMAND:
1942             //Fixed 6355340: Contents of frame are not layed out properly on maximize
1943             if ((wParam & 0xFFF0) == SC_SIZE) {
1944                 AwtWindow::sm_resizing = TRUE;
1945                 mr = WmSysCommand(static_cast<UINT>(wParam), GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam));
1946                 if (mr != mrConsume) {
1947                     // Perform size-move loop here
1948                     AwtWindow::DefWindowProc(message, wParam, lParam);
1949                 }
1950                 AwtWindow::sm_resizing = FALSE;
1951                 if (!AwtToolkit::GetInstance().IsDynamicLayoutActive()) {
1952                     WindowResized();
1953                 } else {
1954                     /*
1955                      * 8016356: check whether window snapping occurred after
1956                      * resizing, i.e. GetWindowRect() returns the real
1957                      * (snapped) window rectangle, e.g. (179, 0)-(483, 1040),
1958                      * but GetWindowPlacement() returns the rectangle of
1959                      * normal window position, e.g. (179, 189)-(483, 445) and
1960                      * they are different. If so, send ComponentResized event.
1961                      */
1962                     WINDOWPLACEMENT wp;
1963                     ::GetWindowPlacement(GetHWnd(), &wp);
1964                     RECT rc;
1965                     ::GetWindowRect(GetHWnd(), &rc);


2130 }
2131 
2132 void AwtWindow::WindowDPIChange(int prevScreen,
2133                                 float prevScaleX, float prevScaleY,
2134                                 int screen, float scaleX,
2135                                 float scaleY)
2136 {
2137     int x;
2138     int y;
2139     int w;
2140     int h;
2141     RECT rect;
2142 
2143     if (prevScaleX == scaleX && prevScaleY == scaleY) {
2144         return;
2145     }
2146 
2147     ::GetWindowRect(GetHWnd(), &rect);
2148     x = rect.left;
2149     y = rect.top;
2150     w = static_cast<int>((rect.right - rect.left) * scaleX / prevScaleX);
2151     h = static_cast<int>((rect.bottom - rect.top) * scaleY / prevScaleY);
2152 
2153     if (prevScreen != screen) {
2154         Devices::InstanceAccess devices;
2155         AwtWin32GraphicsDevice* device = devices->GetDevice(screen);
2156         if (device) {
2157             RECT bounds;
2158             if (MonitorBounds(device->GetMonitor(), &bounds)) {
2159                 x = x < bounds.left ? bounds.left : x;
2160                 y = y < bounds.top ? bounds.top : y;
2161 
2162                 x = (x + w > bounds.right) ? bounds.right - w : x;
2163                 y = (y + h > bounds.bottom) ? bounds.bottom - h : y;
2164             }
2165         }
2166     }
2167 
2168     ReshapeNoScale(x, y, w, h);
2169 }
2170 
2171 BOOL AwtWindow::IsFocusableWindow() {


< prev index next >