diff --git a/dlls/user32/clipboard.c b/dlls/user32/clipboard.c index 2e0c6b92d39..8023eee4944 100644 --- a/dlls/user32/clipboard.c +++ b/dlls/user32/clipboard.c @@ -939,28 +939,6 @@ UINT WINAPI EnumClipboardFormats( UINT format ) } -/************************************************************************** - * IsClipboardFormatAvailable (USER32.@) - */ -BOOL WINAPI IsClipboardFormatAvailable( UINT format ) -{ - BOOL ret = FALSE; - - if (!format) return FALSE; - - USER_Driver->pUpdateClipboard(); - - SERVER_START_REQ( get_clipboard_formats ) - { - req->format = format; - if (!wine_server_call_err( req )) ret = (reply->count > 0); - } - SERVER_END_REQ; - TRACE( "%s -> %u\n", debugstr_format( format ), ret ); - return ret; -} - - /************************************************************************** * GetUpdatedClipboardFormats (USER32.@) */ @@ -1080,7 +1058,7 @@ INT WINAPI GetPriorityClipboardFormat(UINT *list, INT nCount) return 0; for (i = 0; i < nCount; i++) - if (IsClipboardFormatAvailable(list[i])) + if (NtUserIsClipboardFormatAvailable(list[i])) return list[i]; return -1; diff --git a/dlls/user32/edit.c b/dlls/user32/edit.c index 4de206aa12f..cf5e807de21 100644 --- a/dlls/user32/edit.c +++ b/dlls/user32/edit.c @@ -3313,7 +3313,7 @@ static void EDIT_WM_ContextMenu(EDITSTATE *es, INT x, INT y) /* copy */ EnableMenuItem(popup, 3, MF_BYPOSITION | ((end - start) && !(es->style & ES_PASSWORD) ? MF_ENABLED : MF_GRAYED)); /* paste */ - EnableMenuItem(popup, 4, MF_BYPOSITION | (IsClipboardFormatAvailable(CF_UNICODETEXT) && !(es->style & ES_READONLY) ? MF_ENABLED : MF_GRAYED)); + EnableMenuItem(popup, 4, MF_BYPOSITION | (NtUserIsClipboardFormatAvailable(CF_UNICODETEXT) && !(es->style & ES_READONLY) ? MF_ENABLED : MF_GRAYED)); /* delete */ EnableMenuItem(popup, 5, MF_BYPOSITION | ((end - start) && !(es->style & ES_READONLY) ? MF_ENABLED : MF_GRAYED)); /* select all */ diff --git a/dlls/user32/user32.spec b/dlls/user32/user32.spec index 319dda49eb5..3a46765c038 100644 --- a/dlls/user32/user32.spec +++ b/dlls/user32/user32.spec @@ -460,7 +460,7 @@ @ stdcall -import IsCharUpperA(long) @ stdcall -import IsCharUpperW(long) @ stdcall IsChild(long long) -@ stdcall IsClipboardFormatAvailable(long) +@ stdcall IsClipboardFormatAvailable(long) NtUserIsClipboardFormatAvailable @ stdcall IsDialogMessage(long ptr) IsDialogMessageA @ stdcall IsDialogMessageA(long ptr) @ stdcall IsDialogMessageW(long ptr) diff --git a/dlls/win32u/clipboard.c b/dlls/win32u/clipboard.c index c2fd07ac5b9..4c64655b69e 100644 --- a/dlls/win32u/clipboard.c +++ b/dlls/win32u/clipboard.c @@ -34,6 +34,47 @@ WINE_DEFAULT_DEBUG_CHANNEL(clipboard); +/* get a debug string for a format id */ +static const char *debugstr_format( UINT id ) +{ + WCHAR buffer[256]; + DWORD le = GetLastError(); + BOOL r = NtUserGetClipboardFormatName( id, buffer, ARRAYSIZE(buffer) ); + SetLastError(le); + + if (r) + return wine_dbg_sprintf( "%04x %s", id, debugstr_w(buffer) ); + + switch (id) + { +#define BUILTIN(id) case id: return #id; + BUILTIN(CF_TEXT) + BUILTIN(CF_BITMAP) + BUILTIN(CF_METAFILEPICT) + BUILTIN(CF_SYLK) + BUILTIN(CF_DIF) + BUILTIN(CF_TIFF) + BUILTIN(CF_OEMTEXT) + BUILTIN(CF_DIB) + BUILTIN(CF_PALETTE) + BUILTIN(CF_PENDATA) + BUILTIN(CF_RIFF) + BUILTIN(CF_WAVE) + BUILTIN(CF_UNICODETEXT) + BUILTIN(CF_ENHMETAFILE) + BUILTIN(CF_HDROP) + BUILTIN(CF_LOCALE) + BUILTIN(CF_DIBV5) + BUILTIN(CF_OWNERDISPLAY) + BUILTIN(CF_DSPTEXT) + BUILTIN(CF_DSPBITMAP) + BUILTIN(CF_DSPMETAFILEPICT) + BUILTIN(CF_DSPENHMETAFILE) +#undef BUILTIN + default: return wine_dbg_sprintf( "%04x", id ); + } +} + /************************************************************************** * NtUserCountClipboardFormats (win32u.@) */ @@ -54,6 +95,27 @@ INT WINAPI NtUserCountClipboardFormats(void) return count; } +/************************************************************************** + * NtUserIsClipboardFormatAvailable (win32u.@) + */ +BOOL WINAPI NtUserIsClipboardFormatAvailable( UINT format ) +{ + BOOL ret = FALSE; + + if (!format) return FALSE; + + user_driver->pUpdateClipboard(); + + SERVER_START_REQ( get_clipboard_formats ) + { + req->format = format; + if (!wine_server_call_err( req )) ret = (reply->count > 0); + } + SERVER_END_REQ; + TRACE( "%s -> %u\n", debugstr_format( format ), ret ); + return ret; +} + /************************************************************************** * NtUserGetClipboardFormatName (win32u.@) */ diff --git a/dlls/win32u/gdiobj.c b/dlls/win32u/gdiobj.c index 4737aa30cd2..005bd5af165 100644 --- a/dlls/win32u/gdiobj.c +++ b/dlls/win32u/gdiobj.c @@ -1168,6 +1168,7 @@ static struct unix_funcs unix_funcs = NtGdiUpdateColors, NtGdiWidenPath, NtUserCountClipboardFormats, + NtUserIsClipboardFormatAvailable, GDIRealizePalette, GDISelectPalette, diff --git a/dlls/win32u/win32u.spec b/dlls/win32u/win32u.spec index d1774804293..dbfe196dbcf 100644 --- a/dlls/win32u/win32u.spec +++ b/dlls/win32u/win32u.spec @@ -1050,7 +1050,7 @@ @ stub NtUserInvalidateRect @ stub NtUserInvalidateRgn @ stub NtUserIsChildWindowDpiMessageEnabled -@ stub NtUserIsClipboardFormatAvailable +@ stdcall NtUserIsClipboardFormatAvailable(long) @ stub NtUserIsMouseInPointerEnabled @ stub NtUserIsMouseInputEnabled @ stub NtUserIsNonClientDpiScalingEnabled diff --git a/dlls/win32u/win32u_private.h b/dlls/win32u/win32u_private.h index 7526f4414dd..71a9909cfba 100644 --- a/dlls/win32u/win32u_private.h +++ b/dlls/win32u/win32u_private.h @@ -195,6 +195,7 @@ struct unix_funcs BOOL (WINAPI *pNtGdiUpdateColors)( HDC hdc ); BOOL (WINAPI *pNtGdiWidenPath)( HDC hdc ); INT (WINAPI *pNtUserCountClipboardFormats)(void); + BOOL (WINAPI *pNtUserIsClipboardFormatAvailable)( UINT format ); /* Wine-specific functions */ UINT (WINAPI *pGDIRealizePalette)( HDC hdc ); diff --git a/dlls/win32u/wrappers.c b/dlls/win32u/wrappers.c index d236fb6b2db..50f000bdb3c 100644 --- a/dlls/win32u/wrappers.c +++ b/dlls/win32u/wrappers.c @@ -601,6 +601,11 @@ INT WINAPI NtUserCountClipboardFormats(void) return unix_funcs->pNtUserCountClipboardFormats(); } +BOOL WINAPI NtUserIsClipboardFormatAvailable( UINT format ) +{ + return unix_funcs->pNtUserIsClipboardFormatAvailable( format ); +} + UINT WINAPI GDIRealizePalette( HDC hdc ) { return unix_funcs->pGDIRealizePalette( hdc ); diff --git a/include/ntuser.h b/include/ntuser.h index a68c8458213..083d6cb4a1b 100644 --- a/include/ntuser.h +++ b/include/ntuser.h @@ -38,6 +38,7 @@ BOOL WINAPI NtUserGetObjectInformation( HANDLE handle, INT index, void *info, HWINSTA WINAPI NtUserGetProcessWindowStation(void); HANDLE WINAPI NtUserGetProp( HWND hwnd, const WCHAR *str ); HDESK WINAPI NtUserGetThreadDesktop( DWORD thread ); +BOOL WINAPI NtUserIsClipboardFormatAvailable( UINT format ); HWINSTA WINAPI NtUserOpenWindowStation( OBJECT_ATTRIBUTES *attr, ACCESS_MASK access ); BOOL WINAPI NtUserSetObjectInformation( HANDLE handle, INT index, void *info, DWORD len ); HDESK WINAPI NtUserOpenDesktop( OBJECT_ATTRIBUTES *attr, DWORD flags, ACCESS_MASK access );