I'm trying to fix a bug that I've found in the Windows version of libgdk. Consider this code fragment from a switch statement:-

Code:
    case WM_ENTERSIZEMOVE:
    case WM_ENTERMENULOOP:
      _gdk_win32_begin_modal_call ();
      break;

    case WM_EXITSIZEMOVE:
    case WM_EXITMENULOOP:
      _gdk_win32_end_modal_call ();
      break;
The way the code is currently written, every call to _gdk_win32_begin_modal_call() is expected to be matched by a subsequent call to _gdk_win32_end_modal_call(). WM_ENTERSIZEMOVE seems to get sent whenever a user right-clicks on a top level window's title bar (e.g. to select "Move" from the popup menu that gets displayed).

If I do actually move the window, when I release my mouse button (to finish the move) WM_EXITSIZEMOVE gets sent which neatly calls _gdk_win32_end_modal_call()

BUT.... if I right-click a title bar, then (without moving the window) I simply cancel the move by left-clicking my mouse on the desktop, WM_EXITSIZEMOVE doesn't seem to get get sent. The way the code is written, this causes a crash if I subsequently right-click the title bar again.

Is there some other message I can trap to detect when the user cancels a move before it even begins?