Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
8df9a11a
Commit
8df9a11a
authored
Jan 11, 2017
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winex11: Add basic support for importing text/html clipboard format.
Based on a patch by Damjan Jovanovic. Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
5f5807cb
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
46 additions
and
1 deletion
+46
-1
clipboard.c
dlls/winex11.drv/clipboard.c
+46
-1
No files found.
dlls/winex11.drv/clipboard.c
View file @
8df9a11a
...
...
@@ -116,6 +116,7 @@ static HANDLE import_string( Atom type, const void *data, size_t size );
static
HANDLE
import_utf8_string
(
Atom
type
,
const
void
*
data
,
size_t
size
);
static
HANDLE
import_compound_text
(
Atom
type
,
const
void
*
data
,
size_t
size
);
static
HANDLE
import_text
(
Atom
type
,
const
void
*
data
,
size_t
size
);
static
HANDLE
import_text_html
(
Atom
type
,
const
void
*
data
,
size_t
size
);
static
HANDLE
import_text_uri_list
(
Atom
type
,
const
void
*
data
,
size_t
size
);
static
HANDLE
import_targets
(
Atom
type
,
const
void
*
data
,
size_t
size
);
...
...
@@ -174,7 +175,7 @@ static const struct
{
JFIFW
,
0
,
XATOM_image_jpeg
,
import_data
,
export_data
},
{
PNGW
,
0
,
XATOM_image_png
,
import_data
,
export_data
},
{
HTMLFormatW
,
0
,
XATOM_HTML_Format
,
import_data
,
export_data
},
{
HTMLFormatW
,
0
,
XATOM_text_html
,
import_
data
,
export_text_html
},
{
HTMLFormatW
,
0
,
XATOM_text_html
,
import_
text_html
,
export_text_html
},
{
0
,
0
,
XATOM_TARGETS
,
import_targets
,
export_targets
},
{
0
,
0
,
XATOM_MULTIPLE
,
NULL
,
export_multiple
},
{
0
,
0
,
XATOM_TIMESTAMP
,
NULL
,
export_timestamp
},
...
...
@@ -842,6 +843,50 @@ static HANDLE import_enhmetafile( Atom type, const void *data, size_t size )
/**************************************************************************
* import_text_html
*/
static
HANDLE
import_text_html
(
Atom
type
,
const
void
*
data
,
size_t
size
)
{
static
const
char
header
[]
=
"Version:0.9
\n
"
"StartHTML:0000000100
\n
"
"EndHTML:%010lu
\n
"
"StartFragment:%010lu
\n
"
"EndFragment:%010lu
\n
"
"<!--StartFragment-->"
;
static
const
char
trailer
[]
=
"
\n
<!--EndFragment-->"
;
char
*
text
=
NULL
;
HANDLE
ret
;
SIZE_T
len
,
total
;
/* Firefox uses UTF-16LE with byte order mark. Convert to UTF-8 without the BOM. */
if
(
size
>=
sizeof
(
WCHAR
)
&&
((
const
WCHAR
*
)
data
)[
0
]
==
0xfeff
)
{
len
=
WideCharToMultiByte
(
CP_UTF8
,
0
,
(
const
WCHAR
*
)
data
+
1
,
size
/
sizeof
(
WCHAR
)
-
1
,
NULL
,
0
,
NULL
,
NULL
);
if
(
!
(
text
=
HeapAlloc
(
GetProcessHeap
(),
0
,
len
)))
return
0
;
WideCharToMultiByte
(
CP_UTF8
,
0
,
(
const
WCHAR
*
)
data
+
1
,
size
/
sizeof
(
WCHAR
)
-
1
,
text
,
len
,
NULL
,
NULL
);
size
=
len
;
data
=
text
;
}
len
=
strlen
(
header
)
+
12
;
/* 3 * 4 extra chars for %010lu */
total
=
len
+
size
+
sizeof
(
trailer
);
if
((
ret
=
GlobalAlloc
(
GMEM_FIXED
,
total
)))
{
char
*
p
=
ret
;
p
+=
sprintf
(
p
,
header
,
total
-
1
,
len
,
len
+
size
+
1
/* include the final \n in the data */
);
memcpy
(
p
,
data
,
size
);
strcpy
(
p
+
size
,
trailer
);
TRACE
(
"returning %s
\n
"
,
debugstr_a
(
ret
));
}
HeapFree
(
GetProcessHeap
(),
0
,
text
);
return
ret
;
}
/**************************************************************************
* import_text_uri_list
*
* Import text/uri-list.
...
...
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