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
fb5794a7
Commit
fb5794a7
authored
Mar 13, 2013
by
Ken Thomases
Committed by
Alexandre Julliard
Mar 14, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemac: Extract new function from macdrv_EnumClipboardFormats() parameterized…
winemac: Extract new function from macdrv_EnumClipboardFormats() parameterized by the target pasteboard.
parent
caf6db7b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
96 additions
and
63 deletions
+96
-63
clipboard.c
dlls/winemac.drv/clipboard.c
+96
-63
No files found.
dlls/winemac.drv/clipboard.c
View file @
fb5794a7
...
@@ -1367,6 +1367,79 @@ static BOOL macdrv_pasteboard_has_format(CFTypeRef pasteboard, UINT desired_form
...
@@ -1367,6 +1367,79 @@ static BOOL macdrv_pasteboard_has_format(CFTypeRef pasteboard, UINT desired_form
/**************************************************************************
/**************************************************************************
* macdrv_copy_pasteboard_formats
*/
static
CFArrayRef
macdrv_copy_pasteboard_formats
(
CFTypeRef
pasteboard
)
{
CFArrayRef
types
;
CFIndex
count
;
CFMutableArrayRef
formats
;
CFIndex
i
;
TRACE
(
"pasteboard %p
\n
"
,
pasteboard
);
types
=
macdrv_copy_pasteboard_types
(
pasteboard
);
if
(
!
types
)
{
WARN
(
"Failed to copy pasteboard types
\n
"
);
return
NULL
;
}
count
=
CFArrayGetCount
(
types
);
TRACE
(
"got %ld types
\n
"
,
count
);
if
(
!
count
)
{
CFRelease
(
types
);
return
NULL
;
}
formats
=
CFArrayCreateMutable
(
NULL
,
0
,
NULL
);
if
(
!
formats
)
{
WARN
(
"Failed to allocate formats array
\n
"
);
CFRelease
(
types
);
return
NULL
;
}
for
(
i
=
0
;
i
<
count
;
i
++
)
{
CFStringRef
type
=
CFArrayGetValueAtIndex
(
types
,
i
);
WINE_CLIPFORMAT
*
format
;
format
=
NULL
;
while
((
format
=
format_for_type
(
format
,
type
)))
{
TRACE
(
"for type %s got format %p/%s
\n
"
,
debugstr_cf
(
type
),
format
,
debugstr_format
(
format
->
format_id
));
if
(
format
->
synthesized
)
{
/* Don't override a real value with a synthesized value. */
if
(
!
CFArrayContainsValue
(
formats
,
CFRangeMake
(
0
,
CFArrayGetCount
(
formats
)),
(
void
*
)
format
->
format_id
))
CFArrayAppendValue
(
formats
,
(
void
*
)
format
->
format_id
);
}
else
{
/* If the type was already in the array, it must have been synthesized
because this one's real. Remove the synthesized entry in favor of
this one. */
CFIndex
index
=
CFArrayGetFirstIndexOfValue
(
formats
,
CFRangeMake
(
0
,
CFArrayGetCount
(
formats
)),
(
void
*
)
format
->
format_id
);
if
(
index
!=
kCFNotFound
)
CFArrayRemoveValueAtIndex
(
formats
,
index
);
CFArrayAppendValue
(
formats
,
(
void
*
)
format
->
format_id
);
}
}
}
CFRelease
(
types
);
TRACE
(
" -> %s
\n
"
,
debugstr_cf
(
formats
));
return
formats
;
}
/**************************************************************************
* check_clipboard_ownership
* check_clipboard_ownership
*/
*/
static
void
check_clipboard_ownership
(
HWND
*
owner
)
static
void
check_clipboard_ownership
(
HWND
*
owner
)
...
@@ -1498,88 +1571,48 @@ void CDECL macdrv_EndClipboardUpdate(void)
...
@@ -1498,88 +1571,48 @@ void CDECL macdrv_EndClipboardUpdate(void)
*/
*/
UINT
CDECL
macdrv_EnumClipboardFormats
(
UINT
prev_format
)
UINT
CDECL
macdrv_EnumClipboardFormats
(
UINT
prev_format
)
{
{
CFArrayRef
types
;
CFIndex
count
;
CFIndex
count
;
CFIndex
i
;
CFIndex
i
;
UINT
ret
;
UINT
ret
=
0
;
TRACE
(
"prev_format %s
\n
"
,
debugstr_format
(
prev_format
));
TRACE
(
"prev_format %s
\n
"
,
debugstr_format
(
prev_format
));
check_clipboard_ownership
(
NULL
);
check_clipboard_ownership
(
NULL
);
types
=
macdrv_copy_pasteboard_types
(
NULL
);
if
(
!
types
)
{
WARN
(
"Failed to copy pasteboard types
\n
"
);
return
0
;
}
count
=
CFArrayGetCount
(
types
);
TRACE
(
"got %ld types
\n
"
,
count
);
if
(
!
count
)
{
CFRelease
(
types
);
return
0
;
}
if
(
prev_format
)
if
(
prev_format
)
{
{
CF
MutableArrayRef
formats
=
CFArrayCreateMutable
(
NULL
,
0
,
NULL
);
CF
ArrayRef
formats
=
macdrv_copy_pasteboard_formats
(
NULL
);
if
(
!
formats
)
if
(
formats
)
{
{
WARN
(
"Failed to allocate array to track formats
\n
"
);
count
=
CFArrayGetCount
(
formats
);
CFRelease
(
types
);
i
=
CFArrayGetFirstIndexOfValue
(
formats
,
CFRangeMake
(
0
,
count
),
(
void
*
)
prev_format
);
return
0
;
if
(
i
!=
kCFNotFound
&&
i
+
1
<
count
)
}
ret
=
(
UINT
)
CFArrayGetValueAtIndex
(
formats
,
i
+
1
);
for
(
i
=
0
;
i
<
count
;
i
++
)
CFRelease
(
formats
);
}
}
else
{
CFArrayRef
types
=
macdrv_copy_pasteboard_types
(
NULL
);
if
(
types
)
{
{
CFStringRef
type
=
CFArrayGetValueAtIndex
(
types
,
i
);
count
=
CFArrayGetCount
(
types
);
WINE_CLIPFORMAT
*
format
;
TRACE
(
"got %ld types
\n
"
,
count
)
;
format
=
NULL
;
if
(
count
)
while
((
format
=
format_for_type
(
format
,
type
)))
{
{
TRACE
(
"for type %s got format %p/%s
\n
"
,
debugstr_cf
(
type
),
format
,
debugstr_format
(
format
->
format_id
));
CFStringRef
type
=
CFArrayGetValueAtIndex
(
types
,
0
);
WINE_CLIPFORMAT
*
format
=
format_for_type
(
NULL
,
type
);
if
(
format
->
synthesized
)
ret
=
format
?
format
->
format_id
:
0
;
{
/* Don't override a real value with a synthesized value. */
if
(
!
CFArrayContainsValue
(
formats
,
CFRangeMake
(
0
,
CFArrayGetCount
(
formats
)),
(
void
*
)
format
->
format_id
))
CFArrayAppendValue
(
formats
,
(
void
*
)
format
->
format_id
);
}
else
{
/* If the type was already in the array, it must have been synthesized
because this one's real. Remove the synthesized entry in favor of
this one. */
CFIndex
index
=
CFArrayGetFirstIndexOfValue
(
formats
,
CFRangeMake
(
0
,
CFArrayGetCount
(
formats
)),
(
void
*
)
format
->
format_id
);
if
(
index
!=
kCFNotFound
)
CFArrayRemoveValueAtIndex
(
formats
,
index
);
CFArrayAppendValue
(
formats
,
(
void
*
)
format
->
format_id
);
}
}
}
}
count
=
CFArrayGetCount
(
formats
);
CFRelease
(
types
);
i
=
CFArrayGetFirstIndexOfValue
(
formats
,
CFRangeMake
(
0
,
count
),
(
void
*
)
prev_format
);
}
if
(
i
==
kCFNotFound
||
i
+
1
>=
count
)
ret
=
0
;
else
else
ret
=
(
UINT
)
CFArrayGetValueAtIndex
(
formats
,
i
+
1
);
WARN
(
"Failed to copy pasteboard types
\n
"
);
CFRelease
(
formats
);
}
}
else
{
CFStringRef
type
=
CFArrayGetValueAtIndex
(
types
,
0
);
WINE_CLIPFORMAT
*
format
=
format_for_type
(
NULL
,
type
);
ret
=
format
?
format
->
format_id
:
0
;
}
CFRelease
(
types
);
TRACE
(
" -> %u
\n
"
,
ret
);
TRACE
(
" -> %u
\n
"
,
ret
);
return
ret
;
return
ret
;
}
}
...
...
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