diff --git a/reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c b/reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c index e9b31c1afe1..e0d3362559f 100644 --- a/reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c +++ b/reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.c @@ -1498,6 +1498,21 @@ OnMouse(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM lParam) BOOL Err = FALSE; PCONSRV_CONSOLE Console = GuiData->Console; + /* + * HACK FOR CORE-8394 (Part 2): + * + * Check whether we should ignore the next mouse move event. + * In either case we reset the HACK flag. + * + * See Part 1 of this hack below. + */ + if (GuiData->HackCORE8394IgnoreNextMove && msg == WM_MOUSEMOVE) + { + GuiData->HackCORE8394IgnoreNextMove = FALSE; + goto Quit; + } + GuiData->HackCORE8394IgnoreNextMove = FALSE; + // FIXME: It's here that we need to check whether we have focus or not // and whether we are or not in edit mode, in order to know if we need // to deal with the mouse. @@ -1784,8 +1799,17 @@ OnMouse(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM lParam) } /* - * HACK FOR CORE-8394: Ignore the next mouse move signal - * just after mouse down click actions. + * HACK FOR CORE-8394 (Part 1): + * + * It appears that depending on which VM ReactOS runs, the next mouse + * signal coming after a button-down action can be a mouse-move (e.g. + * on VBox, whereas on QEMU it is not the case). However it is NOT a + * rule, so that we cannot use the IgnoreNextMouseSignal flag to just + * "ignore" the next mouse event, thinking it would always be a mouse- + * move signal. + * + * To work around this problem (that should really be fixed in Win32k), + * we use a second flag to ignore this possible next mouse move signal. */ switch (msg) { @@ -1793,7 +1817,7 @@ OnMouse(PGUI_CONSOLE_DATA GuiData, UINT msg, WPARAM wParam, LPARAM lParam) case WM_MBUTTONDOWN: case WM_RBUTTONDOWN: case WM_XBUTTONDOWN: - GuiData->IgnoreNextMouseSignal = TRUE; + GuiData->HackCORE8394IgnoreNextMove = TRUE; default: break; } diff --git a/reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.h b/reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.h index a1d577cfe39..7c801b1a98c 100644 --- a/reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.h +++ b/reactos/win32ss/user/winsrv/consrv/frontends/gui/conwnd.h @@ -65,7 +65,9 @@ typedef struct _GUI_CONSOLE_DATA /*** The following may be put per-screen-buffer !! ***/ HCURSOR hCursor; /* Handle to the mouse cursor */ INT MouseCursorRefCount; /* The reference counter associated with the mouse cursor. >= 0 and the cursor is shown; < 0 and the cursor is hidden. */ - BOOL IgnoreNextMouseSignal; /* Used in cases where we don't want to treat a mouse signal */ + BOOL IgnoreNextMouseSignal; /* Used when we need to not process a mouse signal */ + + BOOL HackCORE8394IgnoreNextMove; /* HACK FOR CORE-8394. See conwnd.c!OnMouse for more details. */ BOOL IsCloseButtonEnabled; /* TRUE if the Close button and the corresponding system menu item are enabled (default), FALSE otherwise */ UINT CmdIdLow ; /* Lowest menu id of the user-reserved menu id range */ diff --git a/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c b/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c index b4869d2ea06..249aab5bdf8 100644 --- a/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c +++ b/reactos/win32ss/user/winsrv/consrv/frontends/gui/guiterm.c @@ -564,6 +564,8 @@ GuiInitFrontEnd(IN OUT PFRONTEND This, /* A priori don't ignore mouse signals */ GuiData->IgnoreNextMouseSignal = FALSE; + /* Initialize HACK FOR CORE-8394. See conwnd.c!OnMouse for more details. */ + GuiData->HackCORE8394IgnoreNextMove = FALSE; /* Close button and the corresponding system menu item are enabled by default */ GuiData->IsCloseButtonEnabled = TRUE;