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

This is updatemouseclip() in win32.cpp (shortened for brevity):
void updatemouseclip (void)
    if (showcursor) {
        amigawinclip_rect = amigawin_rect;
        if (0 && !isfullscreen()) {
            RECT 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:
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 21:40.
mark_k is offline  
Page generated in 0.04007 seconds with 10 queries