Author: hbelusca
Date: Sat Dec 12 20:40:19 2015
New Revision: 70329
URL:
http://svn.reactos.org/svn/reactos?rev=70329&view=rev
Log:
[CLIPBRD]
Handle WM_PALETTECHANGED and WM_QUERYNEWPALETTE: realizes any palette found on the
clipboard, if there is any, if it receives one of those messages.
Modified:
trunk/reactos/base/applications/clipbrd/clipbrd.c
trunk/reactos/base/applications/clipbrd/winutils.c
trunk/reactos/base/applications/clipbrd/winutils.h
Modified: trunk/reactos/base/applications/clipbrd/clipbrd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/clipbrd/…
==============================================================================
--- trunk/reactos/base/applications/clipbrd/clipbrd.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/clipbrd/clipbrd.c [iso-8859-1] Sat Dec 12 20:40:19
2015
@@ -404,6 +404,30 @@
case WM_DROPFILES:
{
LoadClipboardFromDrop((HDROP)wParam);
+ break;
+ }
+
+ case WM_QUERYNEWPALETTE:
+ {
+ if (RealizeClipboardPalette(hWnd) != GDI_ERROR)
+ {
+ InvalidateRect(hWnd, NULL, TRUE);
+ UpdateWindow(hWnd);
+ return TRUE;
+ }
+ return FALSE;
+ }
+
+ case WM_PALETTECHANGED:
+ {
+ if ((HWND)wParam != hWnd)
+ {
+ if (RealizeClipboardPalette(hWnd) != GDI_ERROR)
+ {
+ InvalidateRect(hWnd, NULL, TRUE);
+ UpdateWindow(hWnd);
+ }
+ }
break;
}
Modified: trunk/reactos/base/applications/clipbrd/winutils.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/clipbrd/…
==============================================================================
--- trunk/reactos/base/applications/clipbrd/winutils.c [iso-8859-1] (original)
+++ trunk/reactos/base/applications/clipbrd/winutils.c [iso-8859-1] Sat Dec 12 20:40:19
2015
@@ -156,3 +156,53 @@
hEmf = GetClipboardData(CF_ENHMETAFILE);
PlayEnhMetaFile(hdc, hEmf, lpRect);
}
+
+UINT RealizeClipboardPalette(HWND hWnd)
+{
+ HPALETTE hPalette;
+ HPALETTE hOldPalette;
+ UINT uResult;
+ HDC hDevContext;
+
+ if (!OpenClipboard(NULL))
+ {
+ return GDI_ERROR;
+ }
+
+ if (!IsClipboardFormatAvailable(CF_PALETTE))
+ {
+ CloseClipboard();
+ return GDI_ERROR;
+ }
+
+ hPalette = GetClipboardData(CF_PALETTE);
+ if (!hPalette)
+ {
+ CloseClipboard();
+ return GDI_ERROR;
+ }
+
+ hDevContext = GetDC(hWnd);
+ if (!hDevContext)
+ {
+ CloseClipboard();
+ return GDI_ERROR;
+ }
+
+ hOldPalette = SelectPalette(hDevContext, hPalette, FALSE);
+ if (!hOldPalette)
+ {
+ ReleaseDC(hWnd, hDevContext);
+ CloseClipboard();
+ return GDI_ERROR;
+ }
+
+ uResult = RealizePalette(hDevContext);
+
+ SelectPalette(hDevContext, hOldPalette, FALSE);
+ ReleaseDC(hWnd, hDevContext);
+
+ CloseClipboard();
+
+ PlayEnhMetaFile(hdc, hEmf, lpRect);
+}
Modified: trunk/reactos/base/applications/clipbrd/winutils.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/applications/clipbrd/…
==============================================================================
--- trunk/reactos/base/applications/clipbrd/winutils.h [iso-8859-1] (original)
+++ trunk/reactos/base/applications/clipbrd/winutils.h [iso-8859-1] Sat Dec 12 20:40:19
2015
@@ -15,3 +15,4 @@
void SetDIBitsToDeviceFromClipboard(UINT uFormat, HDC hdc, int XDest, int YDest, int
XSrc, int YSrc, UINT uStartScan, UINT fuColorUse);
void PlayMetaFileFromClipboard(HDC hdc, const RECT *lpRect);
void PlayEnhMetaFileFromClipboard(HDC hdc, const RECT *lpRect);
+UINT RealizeClipboardPalette(HWND hWnd);