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
bf824ed3
Commit
bf824ed3
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 setting of clipboard data with support for text formats.
parent
764a8edb
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
84 additions
and
0 deletions
+84
-0
clipboard.c
dlls/winemac.drv/clipboard.c
+0
-0
cocoa_clipboard.m
dlls/winemac.drv/cocoa_clipboard.m
+77
-0
macdrv_cocoa.h
dlls/winemac.drv/macdrv_cocoa.h
+3
-0
winemac.drv.spec
dlls/winemac.drv/winemac.drv.spec
+4
-0
No files found.
dlls/winemac.drv/clipboard.c
View file @
bf824ed3
This diff is collapsed.
Click to expand it.
dlls/winemac.drv/cocoa_clipboard.m
View file @
bf824ed3
...
...
@@ -22,6 +22,25 @@
#import "cocoa_app.h"
static
int
owned_change_count
=
-
1
;
/***********************************************************************
* macdrv_is_pasteboard_owner
*/
int
macdrv_is_pasteboard_owner
(
void
)
{
__block
int
ret
;
OnMainThread
(
^
{
NSPasteboard
*
pb
=
[
NSPasteboard
generalPasteboard
];
ret
=
([
pb
changeCount
]
==
owned_change_count
);
});
return
ret
;
}
/***********************************************************************
* macdrv_copy_pasteboard_types
*
...
...
@@ -78,3 +97,61 @@ CFDataRef macdrv_copy_pasteboard_data(CFStringRef type)
return
(
CFDataRef
)
ret
;
}
/***********************************************************************
* macdrv_clear_pasteboard
*
* Takes ownership of the Mac pasteboard and clears it of all data types.
*/
void
macdrv_clear_pasteboard
(
void
)
{
OnMainThreadAsync
(
^
{
@try
{
NSPasteboard
*
pb
=
[
NSPasteboard
generalPasteboard
];
owned_change_count
=
[
pb
declareTypes
:[
NSArray
array
]
owner
:
nil
];
}
@catch
(
id
e
)
{
ERR
(
@"Exception discarded while clearing pasteboard: %@
\n
"
,
e
);
}
});
}
/***********************************************************************
* macdrv_set_pasteboard_data
*
* Sets the pasteboard data for a specified type. Replaces any data of
* that type already on the pasteboard.
*
* Returns 0 on error, non-zero on success.
*/
int
macdrv_set_pasteboard_data
(
CFStringRef
type
,
CFDataRef
data
)
{
__block
int
ret
=
0
;
OnMainThread
(
^
{
@try
{
NSPasteboard
*
pb
=
[
NSPasteboard
generalPasteboard
];
NSInteger
change_count
=
[
pb
addTypes
:[
NSArray
arrayWithObject
:(
NSString
*
)
type
]
owner
:
nil
];
if
(
change_count
)
{
owned_change_count
=
change_count
;
if
(
data
)
ret
=
[
pb
setData
:(
NSData
*
)
data
forType
:(
NSString
*
)
type
];
else
ret
=
1
;
}
}
@catch
(
id
e
)
{
ERR
(
@"Exception discarded while copying pasteboard types: %@
\n
"
,
e
);
}
});
return
ret
;
}
dlls/winemac.drv/macdrv_cocoa.h
View file @
bf824ed3
...
...
@@ -276,6 +276,9 @@ 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
;
extern
int
macdrv_is_pasteboard_owner
(
void
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_clear_pasteboard
(
void
)
DECLSPEC_HIDDEN
;
extern
int
macdrv_set_pasteboard_data
(
CFStringRef
type
,
CFDataRef
data
)
DECLSPEC_HIDDEN
;
/* opengl */
...
...
dlls/winemac.drv/winemac.drv.spec
View file @
bf824ed3
...
...
@@ -4,6 +4,7 @@
# USER driver
@ cdecl AcquireClipboard(long) macdrv_AcquireClipboard
@ cdecl ActivateKeyboardLayout(long long) macdrv_ActivateKeyboardLayout
@ cdecl Beep() macdrv_Beep
@ cdecl ChangeDisplaySettingsEx(ptr ptr long long long) macdrv_ChangeDisplaySettingsEx
...
...
@@ -13,6 +14,8 @@
@ cdecl CreateWindow(long) macdrv_CreateWindow
@ cdecl DestroyCursorIcon(long) macdrv_DestroyCursorIcon
@ cdecl DestroyWindow(long) macdrv_DestroyWindow
@ cdecl EmptyClipboard(long) macdrv_EmptyClipboard
@ cdecl EndClipboardUpdate() macdrv_EndClipboardUpdate
@ cdecl EnumClipboardFormats(long) macdrv_EnumClipboardFormats
@ cdecl EnumDisplayMonitors(long ptr ptr long) macdrv_EnumDisplayMonitors
@ cdecl EnumDisplaySettingsEx(ptr long ptr long) macdrv_EnumDisplaySettingsEx
...
...
@@ -26,6 +29,7 @@
@ cdecl MapVirtualKeyEx(long long long) macdrv_MapVirtualKeyEx
@ cdecl MsgWaitForMultipleObjectsEx(long ptr long long long) macdrv_MsgWaitForMultipleObjectsEx
@ cdecl ScrollDC(long long long ptr ptr long ptr) macdrv_ScrollDC
@ cdecl SetClipboardData(long long long) macdrv_SetClipboardData
@ cdecl SetCursor(long) macdrv_SetCursor
@ cdecl SetCursorPos(long long) macdrv_SetCursorPos
@ cdecl SetFocus(long) macdrv_SetFocus
...
...
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