Commit 56ab55d3 authored by Francis Beaudet's avatar Francis Beaudet Committed by Alexandre Julliard

Enabled the persistent clipboard server.

parent 7bf36ad3
......@@ -146,7 +146,7 @@ static void OLEClipbrd_Destroy(OLEClipbrd* ptrToDestroy);
static HWND OLEClipbrd_CreateWindow();
static void OLEClipbrd_DestroyWindow(HWND hwnd);
LRESULT CALLBACK OLEClipbrd_WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static HRESULT OLEClipbrd_RenderFormat(LPFORMATETC pFormatetc);
static HRESULT OLEClipbrd_RenderFormat( IDataObject *pIDataObject, LPFORMATETC pFormatetc );
static HGLOBAL OLEClipbrd_GlobalDupMem( HGLOBAL hGlobalSrc );
/*
......@@ -473,6 +473,7 @@ HRESULT WINAPI OleFlushClipboard()
FORMATETC rgelt;
HRESULT hr = S_OK;
BOOL bClipboardOpen = FALSE;
IDataObject* pIDataObjectSrc = NULL;
TRACE("()\n");
......@@ -488,6 +489,13 @@ HRESULT WINAPI OleFlushClipboard()
return S_OK;
/*
* Addref and save the source data object we are holding on to temporarily,
* since it will be released when we empty the clipboard.
*/
pIDataObjectSrc = theOleClipboard->pIDataObjectSrc;
IDataObject_AddRef(pIDataObjectSrc);
/*
* Open the Windows clipboard
*/
if ( !(bClipboardOpen = OpenClipboard(theOleClipboard->hWndClipboard)) )
......@@ -503,7 +511,7 @@ HRESULT WINAPI OleFlushClipboard()
* Render all HGLOBAL formats supported by the source into
* the windows clipboard.
*/
if ( FAILED( hr = IDataObject_EnumFormatEtc( (IDataObject*)&(theOleClipboard->lpvtbl1),
if ( FAILED( hr = IDataObject_EnumFormatEtc( pIDataObjectSrc,
DATADIR_GET,
&penumFormatetc) ))
{
......@@ -522,7 +530,7 @@ HRESULT WINAPI OleFlushClipboard()
/*
* Render the clipboard data
*/
if ( FAILED(OLEClipbrd_RenderFormat( &rgelt )) )
if ( FAILED(OLEClipbrd_RenderFormat( pIDataObjectSrc, &rgelt )) )
continue;
}
}
......@@ -530,13 +538,9 @@ HRESULT WINAPI OleFlushClipboard()
IEnumFORMATETC_Release(penumFormatetc);
/*
* Release the data object we are holding on to
* Release the source data object we are holding on to
*/
if ( theOleClipboard->pIDataObjectSrc )
{
IDataObject_Release(theOleClipboard->pIDataObjectSrc);
theOleClipboard->pIDataObjectSrc = NULL;
}
IDataObject_Release(pIDataObjectSrc);
CLEANUP:
......@@ -795,7 +799,7 @@ LRESULT CALLBACK OLEClipbrd_WndProc
* Render the clipboard data.
* (We must have a source data object or we wouldn't be in this WndProc)
*/
OLEClipbrd_RenderFormat( &rgelt );
OLEClipbrd_RenderFormat( (IDataObject*)&(theOleClipboard->lpvtbl1), &rgelt );
break;
}
......@@ -835,7 +839,7 @@ LRESULT CALLBACK OLEClipbrd_WndProc
/*
* Render the clipboard data.
*/
if ( FAILED(OLEClipbrd_RenderFormat( &rgelt )) )
if ( FAILED(OLEClipbrd_RenderFormat( (IDataObject*)&(theOleClipboard->lpvtbl1), &rgelt )) )
continue;
TRACE("(): WM_RENDERALLFORMATS(cfFormat=%d)\n", rgelt.cfFormat);
......@@ -891,14 +895,13 @@ LRESULT CALLBACK OLEClipbrd_WndProc
* source data object.
* Note: This function assumes it is passed an HGLOBAL format to render.
*/
static HRESULT OLEClipbrd_RenderFormat(LPFORMATETC pFormatetc)
static HRESULT OLEClipbrd_RenderFormat(IDataObject *pIDataObject, LPFORMATETC pFormatetc)
{
STGMEDIUM medium;
HGLOBAL hDup;
HRESULT hr = S_OK;
if ( FAILED(hr = IDataObject_GetData((IDataObject*)&(theOleClipboard->lpvtbl1),
pFormatetc, &medium)) )
if ( FAILED(hr = IDataObject_GetData(pIDataObject, pFormatetc, &medium)) )
{
WARN("() : IDataObject_GetData failed to render clipboard data! (%lx)\n", hr);
return hr;
......
......@@ -488,7 +488,7 @@ static LPWINE_CLIPFORMAT CLIPBOARD_RenderText( UINT wFormat )
TRACE("\tconverting from '%s' to '%s', %i chars\n",
lpSource->Name, lpTarget->Name, size);
lpTarget->hData32 = GlobalAlloc(GMEM_ZEROINIT, size);
lpTarget->hData32 = GlobalAlloc(GMEM_ZEROINIT | GMEM_MOVEABLE | GMEM_DDESHARE, size);
lpstrT = (LPSTR)GlobalLock(lpTarget->hData32);
if( lpstrT )
......@@ -791,7 +791,8 @@ HANDLE16 WINAPI GetClipboardData16( UINT16 wFormat )
}
/* Convert between 32 -> 16 bit data, if necessary */
if( lpRender->hData32 && !lpRender->hData16 )
if( lpRender->hData32 && !lpRender->hData16
&& CLIPBOARD_IsMemoryObject(wFormat) )
{
int size;
if( lpRender->wFormatID == CF_METAFILEPICT )
......@@ -857,7 +858,8 @@ HANDLE WINAPI GetClipboardData( UINT wFormat )
}
/* Convert between 16 -> 32 bit data, if necessary */
if( lpRender->hData16 && !lpRender->hData32 )
if( lpRender->hData16 && !lpRender->hData32
&& CLIPBOARD_IsMemoryObject(wFormat) )
{
int size;
if( lpRender->wFormatID == CF_METAFILEPICT )
......
......@@ -171,11 +171,6 @@ static void USER_AppExit( HINSTANCE16 hInstance )
* but does nothing);
*/
/* TODO: Start up persistant WINE X clipboard server process which will
* take ownership of the X selection and continue to service selection
* requests from other apps.
*/
/* ModuleUnload() in "Internals" */
hInstance = GetExePtr( hInstance );
......
DEFS = @DLLFLAGS@ -D__WINE__
DEFS = @DLLFLAGS@ -D__WINE__ -DBINDIR="\"$(bindir)\""
TOPSRCDIR = @top_srcdir@
TOPOBJDIR = ../..
SRCDIR = @srcdir@
......@@ -23,8 +23,6 @@ all: $(MODULE).o $(PROGRAMS)
wineclipsrv: wineclipsrv.c
$(CC) $(ALLCFLAGS) -o wineclipsrv $(SRCDIR)/wineclipsrv.c $(X_LIBS) $(XLIB) $(LIBS)
all: $(MODULE).o
@MAKE_RULES@
### Dependencies:
......@@ -158,5 +158,9 @@ Startup=
;InitialColumns=80
;TerminalType=nxterm
[Clipboard]
ClearAllSelections=0
PersistentSelection=1
# </wineconf>
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