Commit a4e800f3 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

win32u: Move NtUserIsClipboardFormatAvailable implementation from user32.

parent 70f8330d
......@@ -940,28 +940,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.@)
*/
BOOL WINAPI GetUpdatedClipboardFormats( UINT *formats, UINT size, UINT *out_size )
......@@ -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;
......
......@@ -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 */
......
......@@ -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)
......
......@@ -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.@)
*/
......@@ -55,6 +96,27 @@ INT WINAPI NtUserCountClipboardFormats(void)
}
/**************************************************************************
* 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.@)
*/
INT WINAPI NtUserGetClipboardFormatName( UINT format, WCHAR *buffer, INT maxlen )
......
......@@ -1168,6 +1168,7 @@ static struct unix_funcs unix_funcs =
NtGdiUpdateColors,
NtGdiWidenPath,
NtUserCountClipboardFormats,
NtUserIsClipboardFormatAvailable,
GDIRealizePalette,
GDISelectPalette,
......
......@@ -1050,7 +1050,7 @@
@ stub NtUserInvalidateRect
@ stub NtUserInvalidateRgn
@ stub NtUserIsChildWindowDpiMessageEnabled
@ stub NtUserIsClipboardFormatAvailable
@ stdcall NtUserIsClipboardFormatAvailable(long)
@ stub NtUserIsMouseInPointerEnabled
@ stub NtUserIsMouseInputEnabled
@ stub NtUserIsNonClientDpiScalingEnabled
......
......@@ -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 );
......
......@@ -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 );
......
......@@ -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 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment