Ken Thomases : user32: Respect monitor work area when sizing or moving a top-level window.

Ken Thomases ken at codeweavers.com
Sat Dec 14 03:07:29 CST 2013


Hi Alexandre,

This doesn't do the same thing as what I submitted.  May I ask why you changed it?

For instance, you shouldn't be able to drag the title bar even partially behind the menu bar.  On Windows, I don't believe you can drag the title bar partially off the top of the screen.  I'm certain that, if you position the task bar at the top of the screen, you can't drag the title bar partially behind it, either.  (I tested both but my memory of the former isn't certain.)

-Ken

On Dec 13, 2013, at 12:46 PM, Alexandre Julliard wrote:

> Module: wine
> Branch: master
> Commit: 03f8f85ddae0cb7d7ff85d0478f1d9a77c88b26b
> URL:    http://source.winehq.org/git/wine.git/?a=commit;h=03f8f85ddae0cb7d7ff85d0478f1d9a77c88b26b
> 
> Author: Ken Thomases <ken at codeweavers.com>
> Date:   Thu Dec 12 16:49:48 2013 -0600
> 
> user32: Respect monitor work area when sizing or moving a top-level window.
> 
> This prevents dragging a window's title bar behind a menu bar across the top
> of a screen, for example.
> 
> ---
> 
> dlls/user32/winpos.c |   20 ++++++++++++++++++++
> 1 files changed, 20 insertions(+), 0 deletions(-)
> 
> diff --git a/dlls/user32/winpos.c b/dlls/user32/winpos.c
> index 22ee290..7cae0ad 100644
> --- a/dlls/user32/winpos.c
> +++ b/dlls/user32/winpos.c
> @@ -2625,6 +2625,7 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
>     BOOL    moved = FALSE;
>     DWORD     dwPoint = GetMessagePos ();
>     BOOL DragFullWindows = TRUE;
> +    HMONITOR mon = 0;
> 
>     if (IsZoomed(hwnd) || !IsWindowVisible(hwnd)) return;
> 
> @@ -2673,6 +2674,7 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
>     {
>         parent = 0;
>         mouseRect = get_virtual_screen_rect();
> +        mon = MonitorFromPoint( pt, MONITOR_DEFAULTTONEAREST );
>     }
> 
>     if (ON_LEFT_BORDER(hittest))
> @@ -2749,6 +2751,24 @@ void WINPOS_SysCommandSizeMove( HWND hwnd, WPARAM wParam )
>         pt.y = max( pt.y, mouseRect.top );
>         pt.y = min( pt.y, mouseRect.bottom );
> 
> +        if (!parent)
> +        {
> +            HMONITOR newmon;
> +            MONITORINFO info;
> +
> +            if ((newmon = MonitorFromPoint( pt, MONITOR_DEFAULTTONULL )))
> +                mon = newmon;
> +
> +            info.cbSize = sizeof(info);
> +            if (mon && GetMonitorInfoW( mon, &info ))
> +            {
> +                pt.x = max( pt.x, info.rcWork.left );
> +                pt.x = min( pt.x, info.rcWork.right );
> +                pt.y = max( pt.y, info.rcWork.top );
> +                pt.y = min( pt.y, info.rcWork.bottom );
> +            }
> +        }
> +
>         dx = pt.x - capturePoint.x;
>         dy = pt.y - capturePoint.y;
> 
> 
> 
> 




More information about the wine-devel mailing list