Commit 7bf3bede authored by Peter Achten's avatar Peter Achten
Browse files

(PA): clipboard viewer code added

parent e3e27268
...@@ -36,8 +36,9 @@ static HANDLE ghOSThreadHandle = NULL; ...@@ -36,8 +36,9 @@ static HANDLE ghOSThreadHandle = NULL;
HINSTANCE ghInst; HINSTANCE ghInst;
HWND ghMainWindow = NULL; HWND ghMainWindow = NULL;
/* RWS ... */ /* RWS ... */
static HWND gNextClipboardViewer = NULL; static HWND gNextClipboardViewer = NULL; /* PA: name was not used anymore. Now using it again for storing next clipboardviewer. */
/* ... RWS */ /* ... RWS */
static int gClipboardCount = 0; /* PA: keeps track of changes of clipboard. */
static HACCEL gAcceleratorTable = NULL; /* Refers to the accelerator table of the active frame. */ static HACCEL gAcceleratorTable = NULL; /* Refers to the accelerator table of the active frame. */
static BOOL gAcceleratorTableIsUpToDate = TRUE; static BOOL gAcceleratorTableIsUpToDate = TRUE;
static PAINTSTRUCT gPaintStruct; static PAINTSTRUCT gPaintStruct;
...@@ -1628,6 +1629,8 @@ void lookUpAndRemove(WPARAM dnsHdl,DNSInfo **listPtr,DNSInfo **elPtr) ...@@ -1628,6 +1629,8 @@ void lookUpAndRemove(WPARAM dnsHdl,DNSInfo **listPtr,DNSInfo **elPtr)
// ... MW // ... MW
/* The callback routine for the main window. /* The callback routine for the main window.
PA: The WM_CREATE message registers the main window as a clipboard viewer.
The WM_DESTROY message unregisters the main window.
*/ */
static LRESULT CALLBACK static LRESULT CALLBACK
MainWindowProcedure (HWND hWin, UINT uMess, WPARAM wPara, LPARAM lPara) MainWindowProcedure (HWND hWin, UINT uMess, WPARAM wPara, LPARAM lPara)
...@@ -1697,6 +1700,41 @@ MainWindowProcedure (HWND hWin, UINT uMess, WPARAM wPara, LPARAM lPara) ...@@ -1697,6 +1700,41 @@ MainWindowProcedure (HWND hWin, UINT uMess, WPARAM wPara, LPARAM lPara)
} }
} }
break; break;
/* PA: The WM_CREATE message registers the ghMainWindow (hWin) as a clipboard viewer.
*/
case WM_CREATE:
{
gNextClipboardViewer = SetClipboardViewer (hWin);
}
break;
/* PA: The WM_DESTROY message unregisters the ghMainWindow (hWin) as a clipboard viewer.
*/
case WM_DESTROY:
{
ChangeClipboardChain (hWin, gNextClipboardViewer);
}
break;
/* PA: other clipboard chain management messages:
*/
case WM_DRAWCLIPBOARD:
{
gClipboardCount += 1;
if (gNextClipboardViewer != NULL)
SendMessage (gNextClipboardViewer, uMess, wPara, lPara);
return 0;
}
break;
case WM_CHANGECBCHAIN:
{
if ((HWND)wPara == gNextClipboardViewer) /* gNextClipboardViewer is no longer a clipboard viewer. */
gNextClipboardViewer = (HWND)lPara; /* then store the new viewer. */
else if (gNextClipboardViewer != NULL)
SendMessage (gNextClipboardViewer, uMess, wPara, lPara);
return 0;
}
break;
// MW... // MW...
case PM_SOCKET_EVENT: case PM_SOCKET_EVENT:
{ {
...@@ -6556,6 +6594,12 @@ HandleCleanRequest (CrossCallInfo * pcci) ...@@ -6556,6 +6594,12 @@ HandleCleanRequest (CrossCallInfo * pcci)
MakeReturn1Cci (pcci, (int) result); MakeReturn1Cci (pcci, (int) result);
} break; } break;
/* CcRqGETCLIPBOARDCOUNT is used by Clean to retrieve current clipboard count.
*/
case CcRqGETCLIPBOARDCOUNT: /* no arguments; gClipboardCount result. */
{
MakeReturn1Cci (pcci, gClipboardCount);
} break;
/* Implement WinRestackWindow as a crosscall operation. /* Implement WinRestackWindow as a crosscall operation.
*/ */
case CcRqRESTACKWINDOW: /* thewindow,behind; no result. */ case CcRqRESTACKWINDOW: /* thewindow,behind; no result. */
......
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