Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
0f4fbd30
Commit
0f4fbd30
authored
Jan 25, 2011
by
Alexander Scott-Johns
Committed by
Alexandre Julliard
Jan 28, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ole32: Add support for rendering METAFILEPICT clipboard objects.
parent
c117d45c
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
95 additions
and
0 deletions
+95
-0
clipboard.c
dlls/ole32/clipboard.c
+95
-0
No files found.
dlls/ole32/clipboard.c
View file @
0f4fbd30
...
...
@@ -478,6 +478,62 @@ static HRESULT dup_global_mem( HGLOBAL src, DWORD flags, HGLOBAL *dst )
return
S_OK
;
}
/***********************************************************************
* dup_metafilepict
*
* Helper function to duplicate a handle to a METAFILEPICT, and the
* contained HMETAFILE.
*/
static
HRESULT
dup_metafilepict
(
HGLOBAL
src
,
HGLOBAL
*
pdest
)
{
HRESULT
hr
;
HGLOBAL
dest
;
METAFILEPICT
*
dest_ptr
;
*
pdest
=
NULL
;
/* Copy the METAFILEPICT structure. */
hr
=
dup_global_mem
(
src
,
GMEM_DDESHARE
|
GMEM_MOVEABLE
,
&
dest
);
if
(
FAILED
(
hr
))
return
hr
;
dest_ptr
=
GlobalLock
(
dest
);
if
(
!
dest_ptr
)
return
E_FAIL
;
/* Give the new METAFILEPICT a separate HMETAFILE. */
dest_ptr
->
hMF
=
CopyMetaFileW
(
dest_ptr
->
hMF
,
NULL
);
if
(
dest_ptr
->
hMF
)
{
GlobalUnlock
(
dest
);
*
pdest
=
dest
;
return
S_OK
;
}
else
{
GlobalUnlock
(
dest
);
GlobalFree
(
dest
);
return
E_FAIL
;
}
}
/***********************************************************************
* free_metafilepict
*
* Helper function to GlobalFree a handle to a METAFILEPICT, and also
* free the contained HMETAFILE.
*/
static
void
free_metafilepict
(
HGLOBAL
src
)
{
METAFILEPICT
*
src_ptr
;
src_ptr
=
GlobalLock
(
src
);
if
(
src_ptr
)
{
DeleteMetaFile
(
src_ptr
->
hMF
);
GlobalUnlock
(
src
);
}
GlobalFree
(
src
);
}
/************************************************************
* render_embed_source_hack
*
...
...
@@ -744,6 +800,9 @@ static HRESULT get_data_from_global(IDataObject *data, FORMATETC *fmt, HGLOBAL *
return
hr
;
}
/***************************************************************************
* get_data_from_enhmetafile
*/
static
HRESULT
get_data_from_enhmetafile
(
IDataObject
*
data
,
FORMATETC
*
fmt
,
HGLOBAL
*
mem
)
{
HENHMETAFILE
copy
;
...
...
@@ -768,6 +827,34 @@ static HRESULT get_data_from_enhmetafile(IDataObject *data, FORMATETC *fmt, HGLO
return
hr
;
}
/***************************************************************************
* get_data_from_metafilepict
*/
static
HRESULT
get_data_from_metafilepict
(
IDataObject
*
data
,
FORMATETC
*
fmt
,
HGLOBAL
*
mem
)
{
HGLOBAL
copy
;
HRESULT
hr
;
FORMATETC
mem_fmt
;
STGMEDIUM
med
;
*
mem
=
NULL
;
mem_fmt
=
*
fmt
;
mem_fmt
.
tymed
=
TYMED_MFPICT
;
hr
=
IDataObject_GetData
(
data
,
&
mem_fmt
,
&
med
);
if
(
FAILED
(
hr
))
return
hr
;
hr
=
dup_metafilepict
(
med
.
u
.
hMetaFilePict
,
&
copy
);
if
(
FAILED
(
hr
))
return
hr
;
*
mem
=
copy
;
ReleaseStgMedium
(
&
med
);
return
hr
;
}
/***********************************************************************
* render_format
*
...
...
@@ -801,6 +888,11 @@ static HRESULT render_format(IDataObject *data, LPFORMATETC fmt)
{
hr
=
get_data_from_enhmetafile
(
data
,
fmt
,
&
clip_data
);
}
else
if
(
fmt
->
tymed
&
TYMED_MFPICT
)
{
/* Returns global handle to METAFILEPICT, containing a copied HMETAFILE */
hr
=
get_data_from_metafilepict
(
data
,
fmt
,
&
clip_data
);
}
else
{
FIXME
(
"Unhandled tymed %x
\n
"
,
fmt
->
tymed
);
...
...
@@ -812,6 +904,9 @@ static HRESULT render_format(IDataObject *data, LPFORMATETC fmt)
if
(
!
SetClipboardData
(
fmt
->
cfFormat
,
clip_data
)
)
{
WARN
(
"() : Failed to set rendered clipboard data into clipboard!
\n
"
);
if
(
fmt
->
tymed
&
TYMED_MFPICT
)
free_metafilepict
(
clip_data
);
else
GlobalFree
(
clip_data
);
hr
=
CLIPBRD_E_CANT_SET
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment