mirror of
https://github.com/reactos/wine.git
synced 2025-02-18 20:10:18 +00:00
user32: Use SendNotifyMessage to send WM_DRAWCLIPBOARD.
This commit is contained in:
parent
503032749b
commit
dd573925e5
@ -287,7 +287,7 @@ BOOL WINAPI CloseClipboard(void)
|
|||||||
bCBHasChanged = FALSE;
|
bCBHasChanged = FALSE;
|
||||||
|
|
||||||
if (hWndViewer)
|
if (hWndViewer)
|
||||||
SendMessageW(hWndViewer, WM_DRAWCLIPBOARD, (WPARAM) GetClipboardOwner(), 0);
|
SendNotifyMessageW(hWndViewer, WM_DRAWCLIPBOARD, (WPARAM) GetClipboardOwner(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bRet = TRUE;
|
bRet = TRUE;
|
||||||
@ -393,7 +393,7 @@ HWND WINAPI SetClipboardViewer( HWND hWnd )
|
|||||||
HWND hwndPrev = CLIPBOARD_SetClipboardViewer(hWnd);
|
HWND hwndPrev = CLIPBOARD_SetClipboardViewer(hWnd);
|
||||||
|
|
||||||
if (hWnd)
|
if (hWnd)
|
||||||
SendMessageW(hWnd, WM_DRAWCLIPBOARD, (WPARAM) GetClipboardOwner(), 0);
|
SendNotifyMessageW(hWnd, WM_DRAWCLIPBOARD, (WPARAM) GetClipboardOwner(), 0);
|
||||||
TRACE("(%p): returning %p\n", hWnd, hwndPrev);
|
TRACE("(%p): returning %p\n", hWnd, hwndPrev);
|
||||||
|
|
||||||
return hwndPrev;
|
return hwndPrev;
|
||||||
|
@ -269,6 +269,83 @@ static void test_synthesized(void)
|
|||||||
ok(r, "gle %d\n", GetLastError());
|
ok(r, "gle %d\n", GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static CRITICAL_SECTION clipboard_cs;
|
||||||
|
static LRESULT CALLBACK clipboard_wnd_proc(HWND hwnd, UINT msg, WPARAM wp, LPARAM lp)
|
||||||
|
{
|
||||||
|
switch(msg) {
|
||||||
|
case WM_DRAWCLIPBOARD:
|
||||||
|
EnterCriticalSection(&clipboard_cs);
|
||||||
|
LeaveCriticalSection(&clipboard_cs);
|
||||||
|
break;
|
||||||
|
case WM_USER:
|
||||||
|
PostQuitMessage(0);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return DefWindowProc(hwnd, msg, wp, lp);
|
||||||
|
}
|
||||||
|
|
||||||
|
static DWORD WINAPI clipboard_thread(void *param)
|
||||||
|
{
|
||||||
|
HWND win = param;
|
||||||
|
BOOL r;
|
||||||
|
|
||||||
|
EnterCriticalSection(&clipboard_cs);
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
SetClipboardViewer(win);
|
||||||
|
ok(GetLastError() == 0xdeadbeef, "GetLastError = %d\n", GetLastError());
|
||||||
|
LeaveCriticalSection(&clipboard_cs);
|
||||||
|
|
||||||
|
r = OpenClipboard(win);
|
||||||
|
ok(r, "OpenClipboard failed: %d\n", GetLastError());
|
||||||
|
|
||||||
|
r = EmptyClipboard();
|
||||||
|
ok(r, "EmptyClipboard failed: %d\n", GetLastError());
|
||||||
|
|
||||||
|
EnterCriticalSection(&clipboard_cs);
|
||||||
|
r = CloseClipboard();
|
||||||
|
ok(r, "CloseClipboard failed: %d\n", GetLastError());
|
||||||
|
LeaveCriticalSection(&clipboard_cs);
|
||||||
|
|
||||||
|
r = PostMessage(win, WM_USER, 0, 0);
|
||||||
|
ok(r, "PostMessage failed: %d\n", GetLastError());
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void test_messages(void)
|
||||||
|
{
|
||||||
|
WNDCLASS cls;
|
||||||
|
HWND win;
|
||||||
|
MSG msg;
|
||||||
|
HANDLE thread;
|
||||||
|
DWORD tid;
|
||||||
|
|
||||||
|
InitializeCriticalSection(&clipboard_cs);
|
||||||
|
|
||||||
|
memset(&cls, 0, sizeof(cls));
|
||||||
|
cls.lpfnWndProc = clipboard_wnd_proc;
|
||||||
|
cls.hInstance = GetModuleHandle(0);
|
||||||
|
cls.lpszClassName = "clipboard_test";
|
||||||
|
RegisterClass(&cls);
|
||||||
|
|
||||||
|
win = CreateWindow("clipboard_test", NULL, 0, 0, 0, 0, 0, NULL, 0, NULL, 0);
|
||||||
|
ok(win != NULL, "CreateWindow failed: %d\n", GetLastError());
|
||||||
|
|
||||||
|
thread = CreateThread(NULL, 0, clipboard_thread, (void*)win, 0, &tid);
|
||||||
|
ok(thread != NULL, "CreateThread failed: %d\n", GetLastError());
|
||||||
|
|
||||||
|
while(GetMessage(&msg, NULL, 0, 0)) {
|
||||||
|
TranslateMessage(&msg);
|
||||||
|
DispatchMessage(&msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
ok(WaitForSingleObject(thread, INFINITE) == WAIT_OBJECT_0, "WaitForSingleObject failed\n");
|
||||||
|
CloseHandle(thread);
|
||||||
|
|
||||||
|
UnregisterClass("clipboard_test", GetModuleHandle(0));
|
||||||
|
DeleteCriticalSection(&clipboard_cs);
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(clipboard)
|
START_TEST(clipboard)
|
||||||
{
|
{
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
@ -278,4 +355,5 @@ START_TEST(clipboard)
|
|||||||
test_RegisterClipboardFormatA();
|
test_RegisterClipboardFormatA();
|
||||||
test_ClipboardOwner();
|
test_ClipboardOwner();
|
||||||
test_synthesized();
|
test_synthesized();
|
||||||
|
test_messages();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user