user32: Make the combo's listbox a topmost window.

Huw Davies huw at codeweavers.com
Fri Nov 7 10:48:49 CST 2014


---
 dlls/user32/combo.c       |  2 +-
 dlls/user32/tests/combo.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/dlls/user32/combo.c b/dlls/user32/combo.c
index 2aa4424..e891c58 100644
--- a/dlls/user32/combo.c
+++ b/dlls/user32/combo.c
@@ -1059,7 +1059,7 @@ static void CBDropDown( LPHEADCOMBO lphc )
        r.bottom = min( r.top + nDroppedHeight, mon_info.rcWork.bottom );
    }
 
-   SetWindowPos( lphc->hWndLBox, HWND_TOP, r.left, r.top, r.right - r.left, r.bottom - r.top,
+   SetWindowPos( lphc->hWndLBox, HWND_TOPMOST, r.left, r.top, r.right - r.left, r.bottom - r.top,
                  SWP_NOACTIVATE | SWP_SHOWWINDOW );
 
 
diff --git a/dlls/user32/tests/combo.c b/dlls/user32/tests/combo.c
index d9875ea..b6d5ef6 100644
--- a/dlls/user32/tests/combo.c
+++ b/dlls/user32/tests/combo.c
@@ -537,6 +537,61 @@ static void test_editselection(void)
     DestroyWindow(hCombo);
 }
 
+static void test_listbox_styles(DWORD cb_style)
+{
+    BOOL (WINAPI *pGetComboBoxInfo)(HWND, PCOMBOBOXINFO);
+    HWND combo;
+    COMBOBOXINFO info;
+    DWORD style, exstyle, expect_style, expect_exstyle;
+    BOOL ret;
+
+    pGetComboBoxInfo = (void*)GetProcAddress(GetModuleHandleA("user32.dll"), "GetComboBoxInfo");
+    if (!pGetComboBoxInfo){
+        win_skip("GetComboBoxInfo is not available\n");
+        return;
+    }
+
+    expect_style = WS_CHILD|WS_CLIPSIBLINGS|LBS_COMBOBOX|LBS_HASSTRINGS|LBS_NOTIFY;
+    if (cb_style == CBS_SIMPLE)
+    {
+        expect_style |= WS_VISIBLE;
+        expect_exstyle = WS_EX_CLIENTEDGE;
+    }
+    else
+    {
+        expect_style |= WS_BORDER;
+        expect_exstyle = WS_EX_TOOLWINDOW;
+    }
+
+    combo = build_combo(cb_style);
+    info.cbSize = sizeof(COMBOBOXINFO);
+    SetLastError(0xdeadbeef);
+    ret = pGetComboBoxInfo(combo, &info);
+    ok(ret, "Failed to get combobox info structure.\n");
+
+    style = GetWindowLongW( info.hwndList, GWL_STYLE );
+    exstyle = GetWindowLongW( info.hwndList, GWL_EXSTYLE );
+    ok(style == expect_style, "%08x: got %08x\n", cb_style, style);
+    ok(exstyle == expect_exstyle, "%08x: got %08x\n", cb_style, exstyle);
+
+    if (cb_style != CBS_SIMPLE)
+        expect_exstyle |= WS_EX_TOPMOST;
+
+    SendMessageW(combo, CB_SHOWDROPDOWN, TRUE, 0 );
+    style = GetWindowLongW( info.hwndList, GWL_STYLE );
+    exstyle = GetWindowLongW( info.hwndList, GWL_EXSTYLE );
+    ok(style == (expect_style | WS_VISIBLE), "%08x: got %08x\n", cb_style, style);
+    ok(exstyle == expect_exstyle, "%08x: got %08x\n", cb_style, exstyle);
+
+    SendMessageW(combo, CB_SHOWDROPDOWN, FALSE, 0 );
+    style = GetWindowLongW( info.hwndList, GWL_STYLE );
+    exstyle = GetWindowLongW( info.hwndList, GWL_EXSTYLE );
+    ok(style == expect_style, "%08x: got %08x\n", cb_style, style);
+    ok(exstyle == expect_exstyle, "%08x: got %08x\n", cb_style, exstyle);
+
+    DestroyWindow(combo);
+}
+
 START_TEST(combo)
 {
     hMainWnd = CreateWindowA("static", "Test", WS_OVERLAPPEDWINDOW, 10, 10, 300, 300, NULL, NULL, NULL, 0);
@@ -551,6 +606,9 @@ START_TEST(combo)
     test_changesize(CBS_DROPDOWN);
     test_changesize(CBS_DROPDOWNLIST);
     test_editselection();
+    test_listbox_styles(CBS_SIMPLE);
+    test_listbox_styles(CBS_DROPDOWN);
+    test_listbox_styles(CBS_DROPDOWNLIST);
 
     DestroyWindow(hMainWnd);
 }
-- 
1.8.0




More information about the wine-patches mailing list