Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
764a8edb
Commit
764a8edb
authored
Mar 10, 2013
by
Ken Thomases
Committed by
Alexandre Julliard
Mar 11, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemac: Implement GetClipboardData() with support for text formats.
parent
7cf3e059
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
97 additions
and
0 deletions
+97
-0
clipboard.c
dlls/winemac.drv/clipboard.c
+67
-0
cocoa_clipboard.m
dlls/winemac.drv/cocoa_clipboard.m
+28
-0
macdrv_cocoa.h
dlls/winemac.drv/macdrv_cocoa.h
+1
-0
winemac.drv.spec
dlls/winemac.drv/winemac.drv.spec
+1
-0
No files found.
dlls/winemac.drv/clipboard.c
View file @
764a8edb
...
...
@@ -738,6 +738,73 @@ UINT CDECL macdrv_EnumClipboardFormats(UINT prev_format)
/**************************************************************************
* GetClipboardData (MACDRV.@)
*/
HANDLE
CDECL
macdrv_GetClipboardData
(
UINT
desired_format
)
{
CFArrayRef
types
;
CFIndex
count
;
CFIndex
i
;
CFStringRef
type
,
best_type
;
WINE_CLIPFORMAT
*
best_format
=
NULL
;
HANDLE
data
=
NULL
;
TRACE
(
"desired_format %s
\n
"
,
debugstr_format
(
desired_format
));
types
=
macdrv_copy_pasteboard_types
();
if
(
!
types
)
{
WARN
(
"Failed to copy pasteboard types
\n
"
);
return
NULL
;
}
count
=
CFArrayGetCount
(
types
);
TRACE
(
"got %ld types
\n
"
,
count
);
for
(
i
=
0
;
(
!
best_format
||
best_format
->
synthesized
)
&&
i
<
count
;
i
++
)
{
WINE_CLIPFORMAT
*
format
;
type
=
CFArrayGetValueAtIndex
(
types
,
i
);
format
=
NULL
;
while
((
!
best_format
||
best_format
->
synthesized
)
&&
(
format
=
format_for_type
(
format
,
type
)))
{
TRACE
(
"for type %s got format %p/%s
\n
"
,
debugstr_cf
(
type
),
format
,
debugstr_format
(
format
?
format
->
format_id
:
0
));
if
(
format
->
format_id
==
desired_format
)
{
/* The best format is the matching one which is not synthesized. Failing that,
the best format is the first matching synthesized format. */
if
(
!
format
->
synthesized
||
!
best_format
)
{
best_type
=
type
;
best_format
=
format
;
}
}
}
}
if
(
best_format
)
{
CFDataRef
pasteboard_data
=
macdrv_copy_pasteboard_data
(
best_type
);
TRACE
(
"got pasteboard data for type %s: %s
\n
"
,
debugstr_cf
(
best_type
),
debugstr_cf
(
pasteboard_data
));
if
(
pasteboard_data
)
{
data
=
best_format
->
import_func
(
pasteboard_data
);
CFRelease
(
pasteboard_data
);
}
}
CFRelease
(
types
);
TRACE
(
" -> %p
\n
"
,
data
);
return
data
;
}
/**************************************************************************
* IsClipboardFormatAvailable (MACDRV.@)
*/
BOOL
CDECL
macdrv_IsClipboardFormatAvailable
(
UINT
desired_format
)
...
...
dlls/winemac.drv/cocoa_clipboard.m
View file @
764a8edb
...
...
@@ -50,3 +50,31 @@ CFArrayRef macdrv_copy_pasteboard_types(void)
[
pool
release
];
return
ret
;
}
/***********************************************************************
* macdrv_copy_pasteboard_data
*
* Returns the pasteboard data for a specified type, or NULL on error or
* if there's no such type on the pasteboard. The caller is responsible
* for releasing the returned data object with CFRelease().
*/
CFDataRef
macdrv_copy_pasteboard_data
(
CFStringRef
type
)
{
__block
NSData
*
ret
=
nil
;
OnMainThread
(
^
{
@try
{
NSPasteboard
*
pb
=
[
NSPasteboard
generalPasteboard
];
if
([
pb
availableTypeFromArray
:[
NSArray
arrayWithObject
:(
NSString
*
)
type
]])
ret
=
[[
pb
dataForType
:(
NSString
*
)
type
]
copy
];
}
@catch
(
id
e
)
{
ERR
(
@"Exception discarded while copying pasteboard types: %@
\n
"
,
e
);
}
});
return
(
CFDataRef
)
ret
;
}
dlls/winemac.drv/macdrv_cocoa.h
View file @
764a8edb
...
...
@@ -275,6 +275,7 @@ extern CFDataRef macdrv_copy_keyboard_layout(CGEventSourceKeyboardType* keyboard
/* clipboard */
extern
CFArrayRef
macdrv_copy_pasteboard_types
(
void
)
DECLSPEC_HIDDEN
;
extern
CFDataRef
macdrv_copy_pasteboard_data
(
CFStringRef
type
)
DECLSPEC_HIDDEN
;
/* opengl */
...
...
dlls/winemac.drv/winemac.drv.spec
View file @
764a8edb
...
...
@@ -16,6 +16,7 @@
@ cdecl EnumClipboardFormats(long) macdrv_EnumClipboardFormats
@ cdecl EnumDisplayMonitors(long ptr ptr long) macdrv_EnumDisplayMonitors
@ cdecl EnumDisplaySettingsEx(ptr long ptr long) macdrv_EnumDisplaySettingsEx
@ cdecl GetClipboardData(long) macdrv_GetClipboardData
@ cdecl GetCursorPos(ptr) macdrv_GetCursorPos
@ cdecl GetKeyboardLayout(long) macdrv_GetKeyboardLayout
@ cdecl GetKeyboardLayoutName(ptr) macdrv_GetKeyboardLayoutName
...
...
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