Huw Davies : user32: Don't send the menu clicks if we can' t retrieve the item rect.

Alexandre Julliard julliard at winehq.org
Tue Jul 22 09:35:30 CDT 2008


Module: wine
Branch: master
Commit: 80fe2faeb6c794a3e37e600cd6d0e7e8cbd27b87
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=80fe2faeb6c794a3e37e600cd6d0e7e8cbd27b87

Author: Huw Davies <huw at codeweavers.com>
Date:   Mon Jul 21 14:50:10 2008 +0100

user32: Don't send the menu clicks if we can't retrieve the item rect.

---

 dlls/user32/tests/menu.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/dlls/user32/tests/menu.c b/dlls/user32/tests/menu.c
index 1aa2eb6..4e879c6 100644
--- a/dlls/user32/tests/menu.c
+++ b/dlls/user32/tests/menu.c
@@ -1691,7 +1691,7 @@ static struct menu_mouse_tests_s {
 static void send_key(WORD wVk)
 {
     TEST_INPUT i[2];
-    memset(&i, 0, 2*sizeof(INPUT));
+    memset(i, 0, sizeof(i));
     i[0].type = i[1].type = INPUT_KEYBOARD;
     i[0].u.ki.wVk = i[1].u.ki.wVk = wVk;
     i[1].u.ki.dwFlags = KEYEVENTF_KEYUP;
@@ -1706,10 +1706,10 @@ static void click_menu(HANDLE hWnd, struct menu_item_pair_s *mi)
     RECT r;
     int screen_w = GetSystemMetrics(SM_CXSCREEN);
     int screen_h = GetSystemMetrics(SM_CYSCREEN);
+    BOOL ret = GetMenuItemRect(mi->uMenu > 2 ? NULL : hWnd, hMenu, mi->uItem, &r);
+    if(!ret) return;
 
-    GetMenuItemRect(mi->uMenu > 2 ? NULL : hWnd, hMenu, mi->uItem, &r);
-
-    memset(&i, 0, 3*sizeof(INPUT));
+    memset(i, 0, sizeof(i));
     i[0].type = i[1].type = i[2].type = INPUT_MOUSE;
     i[0].u.mi.dx = i[1].u.mi.dx = i[2].u.mi.dx
             = ((r.left + 5) * 65535) / screen_w;




More information about the wine-cvs mailing list