Hi,
Here is a patch for the missing WM_NCRBUTTONUP. It's wine code. Well
it breaks the mouse pointer set position and activates the system menu
at the left upper corner. Looks like to many hack being made to bypass
unimplemented functions. So stop doing it and fix it. I know~ locating
all of them is a big head ache but remember what I always type, don't
build code on top of hacks on hacks!
James
Index: win32ss/user/user32/windows/defwnd.c
===================================================================
--- win32ss/user/user32/windows/defwnd.c (revision 58633)
+++ win32ss/user/user32/windows/defwnd.c (working copy)
@@ -22,6 +22,7 @@
LRESULT DefWndNCHitTest(HWND hWnd, POINT Point);
LRESULT DefWndNCLButtonDown(HWND hWnd, WPARAM wParam, LPARAM lParam);
LRESULT DefWndNCLButtonDblClk(HWND hWnd, WPARAM wParam, LPARAM lParam);
+LRESULT NC_HandleNCRButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam );
void FASTCALL MenuInitSysMenuPopup(HMENU Menu, DWORD Style, DWORD
ClsStyle, LONG HitTest );
void MENU_EndMenu( HWND );
@@ -1101,14 +1102,7 @@
}
case WM_NCRBUTTONDOWN:
- {
- /* in Windows, capture is taken when right-clicking on
the caption bar */
- if (wParam == HTCAPTION)
- {
- SetCapture(hWnd);
- }
- break;
- }
+ return NC_HandleNCRButtonDown( hWnd, wParam, lParam );
case WM_RBUTTONUP:
{
Index: win32ss/user/user32/windows/nonclient.c
===================================================================
--- win32ss/user/user32/windows/nonclient.c (revision 58633)
+++ win32ss/user/user32/windows/nonclient.c (working copy)
@@ -1035,6 +1035,14 @@
case HTBOTTOMLEFT:
case HTBOTTOMRIGHT:
{
+ /* Old comment:
+ * "make sure hittest fits into 0xf and doesn't overlap
with HTSYSMENU"
+ * This was previously done by setting wParam=SC_SIZE + wParam - 2
+ */
+ /* But that is not what WinNT does. Instead it sends this. This
+ * is easy to differentiate from HTSYSMENU, because HTSYSMENU adds
+ * SC_MOUSEMENU into wParam.
+ */
SendMessageW(hWnd, WM_SYSCOMMAND, SC_SIZE + wParam -
(HTLEFT - WMSZ_LEFT), lParam);
break;
}
@@ -1073,6 +1081,41 @@
return(0);
}
+/***********************************************************************
+ * NC_HandleNCRButtonDown
+ *
+ * Handle a WM_NCRBUTTONDOWN message. Called from DefWindowProc().
+ */
+LRESULT NC_HandleNCRButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam )
+{
+ MSG msg;
+ INT hittest = wParam;
+
+ switch (hittest)
+ {
+ case HTCAPTION:
+ case HTSYSMENU:
+ if (!GetSystemMenu( hwnd, FALSE )) break;
+
+ SetCapture( hwnd );
+ for (;;)
+ {
+ if (!GetMessageW( &msg, 0, WM_MOUSEFIRST, WM_MOUSELAST )) break;
+ if (CallMsgFilterW( &msg, MSGF_MAX )) continue;
+ if (msg.message == WM_RBUTTONUP)
+ {
+ hittest = DefWndNCHitTest( hwnd, msg.pt );
+ break;
+ }
+ }
+ ReleaseCapture();
+ if (hittest == HTCAPTION || hittest == HTSYSMENU)
+ SendMessageW( hwnd, WM_SYSCOMMAND, SC_MOUSEMENU + HTSYSMENU,
msg.lParam );
+ break;
+ }
+ return 0;
+}
+
VOID
DefWndTrackScrollBar(HWND hWnd, WPARAM wParam, POINT Point)
{