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
9f2ccf31
Commit
9f2ccf31
authored
Sep 16, 2016
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Get rid of the X11DRV_CLIPBOARD_SerializeMetafile helper.
THere's no common code between the different branches anyway. Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
217f0546
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
81 deletions
+56
-81
clipboard.c
dlls/winex11.drv/clipboard.c
+56
-81
No files found.
dlls/winex11.drv/clipboard.c
View file @
9f2ccf31
...
...
@@ -159,7 +159,6 @@ static BOOL X11DRV_CLIPBOARD_ReadSelectionData(Display *display, LPWINE_CLIPDATA
static
BOOL
X11DRV_CLIPBOARD_ReadProperty
(
Display
*
display
,
Window
w
,
Atom
prop
,
unsigned
char
**
data
,
unsigned
long
*
datasize
);
static
BOOL
X11DRV_CLIPBOARD_RenderFormat
(
Display
*
display
,
LPWINE_CLIPDATA
lpData
);
static
HANDLE
X11DRV_CLIPBOARD_SerializeMetafile
(
INT
wformat
,
HANDLE
hdata
,
LPDWORD
lpcbytes
,
BOOL
out
);
static
void
X11DRV_HandleSelectionRequest
(
HWND
hWnd
,
XSelectionRequestEvent
*
event
,
BOOL
bIsMultiple
);
static
void
empty_clipboard
(
void
);
...
...
@@ -1128,7 +1127,20 @@ static HANDLE import_metafile(Display *display, Window w, Atom prop)
if
(
X11DRV_CLIPBOARD_ReadProperty
(
display
,
w
,
prop
,
&
lpdata
,
&
cbytes
))
{
if
(
cbytes
)
hClipData
=
X11DRV_CLIPBOARD_SerializeMetafile
(
CF_METAFILEPICT
,
lpdata
,
(
LPDWORD
)
&
cbytes
,
FALSE
);
{
hClipData
=
GlobalAlloc
(
0
,
sizeof
(
METAFILEPICT
));
if
(
hClipData
)
{
unsigned
int
wiresize
;
LPMETAFILEPICT
lpmfp
=
GlobalLock
(
hClipData
);
memcpy
(
lpmfp
,
lpdata
,
sizeof
(
METAFILEPICT
));
wiresize
=
cbytes
-
sizeof
(
METAFILEPICT
);
lpmfp
->
hMF
=
SetMetaFileBitsEx
(
wiresize
,
((
const
BYTE
*
)
lpdata
)
+
sizeof
(
METAFILEPICT
));
GlobalUnlock
(
hClipData
);
}
}
/* Free the retrieved property data */
HeapFree
(
GetProcessHeap
(),
0
,
lpdata
);
...
...
@@ -1150,7 +1162,7 @@ static HANDLE import_enhmetafile(Display *display, Window w, Atom prop)
if
(
X11DRV_CLIPBOARD_ReadProperty
(
display
,
w
,
prop
,
&
lpdata
,
&
cbytes
))
{
if
(
cbytes
)
hClipData
=
X11DRV_CLIPBOARD_SerializeMetafile
(
CF_ENHMETAFILE
,
lpdata
,
(
LPDWORD
)
&
cbytes
,
FALSE
);
hClipData
=
SetEnhMetaFileBits
(
cbytes
,
lpdata
);
/* Free the retrieved property data */
HeapFree
(
GetProcessHeap
(),
0
,
lpdata
);
...
...
@@ -1641,13 +1653,36 @@ static HANDLE export_image_bmp(Display *display, Window requestor, Atom aTarget,
static
HANDLE
export_metafile
(
Display
*
display
,
Window
requestor
,
Atom
aTarget
,
Atom
rprop
,
LPWINE_CLIPDATA
lpdata
,
LPDWORD
lpBytes
)
{
LPMETAFILEPICT
lpmfp
;
unsigned
int
size
;
HANDLE
h
;
if
(
!
X11DRV_CLIPBOARD_RenderFormat
(
display
,
lpdata
))
{
ERR
(
"Failed to export %04x format
\n
"
,
lpdata
->
wFormatID
);
return
0
;
}
return
X11DRV_CLIPBOARD_SerializeMetafile
(
CF_METAFILEPICT
,
lpdata
->
hData
,
lpBytes
,
TRUE
);
*
lpBytes
=
0
;
/* Assume failure */
lpmfp
=
GlobalLock
(
lpdata
->
hData
);
size
=
GetMetaFileBitsEx
(
lpmfp
->
hMF
,
0
,
NULL
);
h
=
GlobalAlloc
(
0
,
size
+
sizeof
(
METAFILEPICT
));
if
(
h
)
{
char
*
pdata
=
GlobalLock
(
h
);
memcpy
(
pdata
,
lpmfp
,
sizeof
(
METAFILEPICT
));
GetMetaFileBitsEx
(
lpmfp
->
hMF
,
size
,
pdata
+
sizeof
(
METAFILEPICT
));
*
lpBytes
=
size
+
sizeof
(
METAFILEPICT
);
GlobalUnlock
(
h
);
}
GlobalUnlock
(
lpdata
->
hData
);
return
h
;
}
...
...
@@ -1659,13 +1694,29 @@ static HANDLE export_metafile(Display *display, Window requestor, Atom aTarget,
static
HANDLE
export_enhmetafile
(
Display
*
display
,
Window
requestor
,
Atom
aTarget
,
Atom
rprop
,
LPWINE_CLIPDATA
lpdata
,
LPDWORD
lpBytes
)
{
unsigned
int
size
;
HANDLE
h
;
if
(
!
X11DRV_CLIPBOARD_RenderFormat
(
display
,
lpdata
))
{
ERR
(
"Failed to export %04x format
\n
"
,
lpdata
->
wFormatID
);
return
0
;
}
return
X11DRV_CLIPBOARD_SerializeMetafile
(
CF_ENHMETAFILE
,
lpdata
->
hData
,
lpBytes
,
TRUE
);
*
lpBytes
=
0
;
/* Assume failure */
size
=
GetEnhMetaFileBits
(
lpdata
->
hData
,
0
,
NULL
);
h
=
GlobalAlloc
(
0
,
size
);
if
(
h
)
{
LPVOID
pdata
=
GlobalLock
(
h
);
GetEnhMetaFileBits
(
lpdata
->
hData
,
size
,
pdata
);
*
lpBytes
=
size
;
GlobalUnlock
(
h
);
}
return
h
;
}
...
...
@@ -2348,82 +2399,6 @@ static BOOL X11DRV_CLIPBOARD_ReadProperty(Display *display, Window w, Atom prop,
/**************************************************************************
* CLIPBOARD_SerializeMetafile
*/
static
HANDLE
X11DRV_CLIPBOARD_SerializeMetafile
(
INT
wformat
,
HANDLE
hdata
,
LPDWORD
lpcbytes
,
BOOL
out
)
{
HANDLE
h
=
0
;
TRACE
(
" wFormat=%d hdata=%p out=%d
\n
"
,
wformat
,
hdata
,
out
);
if
(
out
)
/* Serialize out, caller should free memory */
{
*
lpcbytes
=
0
;
/* Assume failure */
if
(
wformat
==
CF_METAFILEPICT
)
{
LPMETAFILEPICT
lpmfp
=
GlobalLock
(
hdata
);
unsigned
int
size
=
GetMetaFileBitsEx
(
lpmfp
->
hMF
,
0
,
NULL
);
h
=
GlobalAlloc
(
0
,
size
+
sizeof
(
METAFILEPICT
));
if
(
h
)
{
char
*
pdata
=
GlobalLock
(
h
);
memcpy
(
pdata
,
lpmfp
,
sizeof
(
METAFILEPICT
));
GetMetaFileBitsEx
(
lpmfp
->
hMF
,
size
,
pdata
+
sizeof
(
METAFILEPICT
));
*
lpcbytes
=
size
+
sizeof
(
METAFILEPICT
);
GlobalUnlock
(
h
);
}
GlobalUnlock
(
hdata
);
}
else
if
(
wformat
==
CF_ENHMETAFILE
)
{
int
size
=
GetEnhMetaFileBits
(
hdata
,
0
,
NULL
);
h
=
GlobalAlloc
(
0
,
size
);
if
(
h
)
{
LPVOID
pdata
=
GlobalLock
(
h
);
GetEnhMetaFileBits
(
hdata
,
size
,
pdata
);
*
lpcbytes
=
size
;
GlobalUnlock
(
h
);
}
}
}
else
{
if
(
wformat
==
CF_METAFILEPICT
)
{
h
=
GlobalAlloc
(
0
,
sizeof
(
METAFILEPICT
));
if
(
h
)
{
unsigned
int
wiresize
;
LPMETAFILEPICT
lpmfp
=
GlobalLock
(
h
);
memcpy
(
lpmfp
,
hdata
,
sizeof
(
METAFILEPICT
));
wiresize
=
*
lpcbytes
-
sizeof
(
METAFILEPICT
);
lpmfp
->
hMF
=
SetMetaFileBitsEx
(
wiresize
,
((
const
BYTE
*
)
hdata
)
+
sizeof
(
METAFILEPICT
));
GlobalUnlock
(
h
);
}
}
else
if
(
wformat
==
CF_ENHMETAFILE
)
{
h
=
SetEnhMetaFileBits
(
*
lpcbytes
,
hdata
);
}
}
return
h
;
}
/**************************************************************************
* X11DRV_CLIPBOARD_ReleaseSelection
*
* Release XA_CLIPBOARD and XA_PRIMARY in response to a SelectionClear event.
...
...
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