[Bf-committers] [Bf-blender-cvs] SVN commit: /data/svn/bf-blender [54759] trunk/blender/intern/ghost/intern/ GHOST_WindowWin32.cpp: Fix for windows size on win32

Campbell Barton ideasman42 at gmail.com
Mon Mar 4 10:40:16 CET 2013


On Sat, Feb 23, 2013 at 2:57 AM, Alexander Kuznetsov <kuzsasha at gmail.com> wrote:
> Revision: 54759
>           http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=54759
> Author:   alexk
> Date:     2013-02-22 15:57:50 +0000 (Fri, 22 Feb 2013)
> Log Message:
> -----------
> Fix for windows size on win32
>
> Modified Paths:
> --------------
>     trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp
>
> Modified: trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp
> ===================================================================
> --- trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp     2013-02-22 15:54:10 UTC (rev 54758)
> +++ trunk/blender/intern/ghost/intern/GHOST_WindowWin32.cpp     2013-02-22 15:57:50 UTC (rev 54759)
> @@ -470,38 +470,22 @@
>  void GHOST_WindowWin32::getClientBounds(GHOST_Rect& bounds) const
>  {
>         RECT rect;
> -       GHOST_TWindowState state = this->getState();
> -       LONG_PTR result = ::GetWindowLongPtr(m_hWnd, GWL_STYLE);
> -       int sm_cysizeframe = GetSystemMetrics(SM_CYSIZEFRAME);
> -       ::GetWindowRect(m_hWnd, &rect);
> +       POINT coord;
> +       ::GetClientRect(m_hWnd, &rect);
>
> -       if ((result & (WS_POPUP | WS_MAXIMIZE)) != (WS_POPUP | WS_MAXIMIZE)) {
> -               if (state == GHOST_kWindowStateMaximized) {
> -                       // in maximized state we don't have borders on the window
> -                       bounds.m_b = rect.bottom - GetSystemMetrics(SM_CYCAPTION) - sm_cysizeframe * 2;
> -                       bounds.m_l = rect.left + sm_cysizeframe;
> -                       bounds.m_r = rect.right - sm_cysizeframe;
> -                       bounds.m_t = rect.top;
> -               }
> -               else if (state == GHOST_kWindowStateEmbedded) {
> -                       bounds.m_b = rect.bottom;
> -                       bounds.m_l = rect.left;
> -                       bounds.m_r = rect.right;
> -                       bounds.m_t = rect.top;
> -               }
> -               else {
> -                       bounds.m_b = rect.bottom - GetSystemMetrics(SM_CYCAPTION) - sm_cysizeframe * 2;
> -                       bounds.m_l = rect.left;
> -                       bounds.m_r = rect.right - sm_cysizeframe * 2;
> -                       bounds.m_t = rect.top;
> -               }
> -       }
> -       else {
> -               bounds.m_b = rect.bottom;
> -               bounds.m_l = rect.left;
> -               bounds.m_r = rect.right;
> -               bounds.m_t = rect.top;
> -       }
> +       coord.x = rect.left;
> +       coord.y = rect.top;
> +       ::ClientToScreen(m_hWnd, &coord);
> +
> +       bounds.m_l = coord.x;
> +       bounds.m_t = coord.y;
> +
> +       coord.x = rect.right;
> +       coord.y = rect.bottom;
> +       ::ClientToScreen(m_hWnd, &coord);
> +
> +       bounds.m_r = coord.x;
> +       bounds.m_b = coord.y;
>  }

Checking commits for 2.66a and not sure about this one.

What does this fix?

Surely if resizing a window on ms-win was broken we would have had
many complaints.

-- 
- Campbell


More information about the Bf-committers mailing list