View Single Post
Old 29 April 2017, 21:50   #6
mark_k
Registered User
 
Join Date: Aug 2004
Location:
Posts: 2,816
I went spelunking through MSDN...

This is updatemouseclip() in win32.cpp (shortened for brevity):
Code:
void updatemouseclip (void)
{
    if (showcursor) {
        ClipCursor(NULL);
        amigawinclip_rect = amigawin_rect;
        if (0 && !isfullscreen()) {
            RECT cliprect;
            GetClipCursor(&cliprect);
            IntersectRect(&amigawinclip_rect, &cliprect, &amigawin_rect);
        }
        if (!ClipCursor (&amigawinclip_rect))
            write_log(_T("ClipCursor error %d\n"), GetLastError());
    }
}
So you're clipping the cursor to the intersection of the full screen (ClipCursor(NULL) then GetClipCursor(&cliprect)) with amigawin_rect. But when the window is partly off the bottom of the screen, that rect covers part of the taskbar. Instead I think you should get the work area rect, and intersect that with amigawin_rect.

To find the work area...

The GetSystemMetrics doc says:
"To get the coordinates of the portion of the screen that is not obscured by the system taskbar or by application desktop toolbars, call the SystemParametersInfo function with the SPI_GETWORKAREA value."

The SystemParametersInfo doc says:
"SPI_GETWORKAREA
Retrieves the size of the work area on the primary display monitor. The work area is the portion of the screen not obscured by the system taskbar or by application desktop toolbars. [...]
To get the work area of a monitor other than the primary display monitor, call the GetMonitorInfo function."

So if the emulation window isn't on the primary display monitor that might not work. The GetMonitorInfo doc says:
"The GetMonitorInfo function retrieves information about a display monitor."

GetMonitorInfo takes as an argument a pointer to a MONITORINFO structure. The rcWork field of that will be filled in with the work area: "A RECT structure that specifies the work area rectangle of the display monitor, expressed in virtual-screen coordinates. Note that if the monitor is not the primary display monitor, some of the rectangle's coordinates may be negative values."


Edit to add: Also, could doing ClipCursor(NULL) before ClipCursor (&amigawinclip_rect) maybe explain some occurrences of the mouse becoming uncaptured? If in between the two calls to ClipCursor(), the mouse is moved outside the emulation window and another window is activated, WinUAE will lose focus (and presumably release the mouse because of that).

Last edited by mark_k; 29 April 2017 at 22:40.
mark_k is offline  
 
Page generated in 0.06505 seconds with 9 queries