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
a21983f1
Commit
a21983f1
authored
Jun 01, 2022
by
Jacek Caban
Committed by
Alexandre Julliard
Jun 03, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winemac: Use unixlib interface for dragdrop.c calls.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
parent
4938929c
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
86 additions
and
37 deletions
+86
-37
clipboard.c
dlls/winemac.drv/clipboard.c
+41
-20
dragdrop.c
dlls/winemac.drv/dragdrop.c
+19
-15
macdrv.h
dlls/winemac.drv/macdrv.h
+4
-2
macdrv_main.c
dlls/winemac.drv/macdrv_main.c
+4
-0
unixlib.h
dlls/winemac.drv/unixlib.h
+18
-0
No files found.
dlls/winemac.drv/clipboard.c
View file @
a21983f1
...
...
@@ -248,6 +248,12 @@ static const char *debugstr_format(UINT id)
}
static
CFTypeRef
pasteboard_from_handle
(
UINT64
handle
)
{
return
(
CFTypeRef
)(
UINT_PTR
)
handle
;
}
/**************************************************************************
* insert_clipboard_format
*/
...
...
@@ -1201,14 +1207,16 @@ HANDLE macdrv_get_pasteboard_data(CFTypeRef pasteboard, UINT desired_format)
/**************************************************************************
* macdrv_pasteboard_has_format
*/
BOOL
macdrv_pasteboard_has_format
(
CFTypeRef
pasteboard
,
UINT
desired_format
)
NTSTATUS
macdrv_dnd_have_format
(
void
*
arg
)
{
struct
dnd_have_format_params
*
params
=
arg
;
CFTypeRef
pasteboard
=
pasteboard_from_handle
(
params
->
handle
);
CFArrayRef
types
;
int
count
;
UINT
i
;
BOOL
found
=
FALSE
;
TRACE
(
"pasteboard %p, desired_format %s
\n
"
,
pasteboard
,
debugstr_format
(
desired_
format
));
TRACE
(
"pasteboard %p, desired_format %s
\n
"
,
pasteboard
,
debugstr_format
(
params
->
format
));
types
=
macdrv_copy_pasteboard_types
(
pasteboard
);
if
(
!
types
)
...
...
@@ -1229,7 +1237,7 @@ BOOL macdrv_pasteboard_has_format(CFTypeRef pasteboard, UINT desired_format)
{
TRACE
(
"for type %s got format %s
\n
"
,
debugstr_cf
(
type
),
debugstr_format
(
format
->
format_id
));
if
(
format
->
format_id
==
desired_
format
)
if
(
format
->
format_id
==
params
->
format
)
{
found
=
TRUE
;
break
;
...
...
@@ -1365,33 +1373,24 @@ static WINE_CLIPFORMAT** get_formats_for_pasteboard(CFTypeRef pasteboard, UINT *
/**************************************************************************
* macdrv_
get_pasteboard
_formats
* macdrv_
dnd_get
_formats
*/
UINT
*
macdrv_get_pasteboard_formats
(
CFTypeRef
pasteboard
,
UINT
*
num_formats
)
NTSTATUS
macdrv_dnd_get_formats
(
void
*
arg
)
{
struct
dnd_get_formats_params
*
params
=
arg
;
CFTypeRef
pasteboard
=
pasteboard_from_handle
(
params
->
handle
);
WINE_CLIPFORMAT
**
formats
;
UINT
count
,
i
;
UINT
*
format_ids
;
formats
=
get_formats_for_pasteboard
(
pasteboard
,
&
count
);
if
(
!
formats
)
return
NULL
;
format_ids
=
malloc
(
count
);
if
(
!
format_ids
)
{
WARN
(
"Failed to allocate formats IDs array
\n
"
);
free
(
formats
);
return
NULL
;
}
return
0
;
count
=
min
(
count
,
ARRAYSIZE
(
params
->
formats
));
for
(
i
=
0
;
i
<
count
;
i
++
)
format_ids
[
i
]
=
formats
[
i
]
->
format_id
;
free
(
formats
);
params
->
formats
[
i
]
=
formats
[
i
]
->
format_id
;
*
num_formats
=
count
;
return
format_ids
;
return
count
;
}
...
...
@@ -1746,3 +1745,25 @@ void macdrv_lost_pasteboard_ownership(HWND hwnd)
if
(
!
macdrv_is_pasteboard_owner
(
clipboard_cocoa_window
))
grab_win32_clipboard
();
}
/**************************************************************************
* macdrv_dnd_release
*/
NTSTATUS
macdrv_dnd_release
(
void
*
arg
)
{
UINT64
handle
=
*
(
UINT64
*
)
arg
;
CFRelease
(
pasteboard_from_handle
(
handle
));
return
0
;
}
/**************************************************************************
* macdrv_dnd_retain
*/
NTSTATUS
macdrv_dnd_retain
(
void
*
arg
)
{
UINT64
handle
=
*
(
UINT64
*
)
arg
;
CFRetain
(
pasteboard_from_handle
(
handle
));
return
0
;
}
dlls/winemac.drv/dragdrop.c
View file @
a21983f1
...
...
@@ -42,7 +42,7 @@ typedef struct
{
IDataObject
IDataObject_iface
;
LONG
ref
;
CFTypeRef
pasteboard
;
UINT64
pasteboard
;
}
DragDropDataObject
;
...
...
@@ -131,7 +131,7 @@ static ULONG WINAPI dddo_Release(IDataObject* iface)
return
refCount
;
TRACE
(
"-- destroying DragDropDataObject (%p)
\n
"
,
This
);
CFRelease
(
This
->
pasteboard
);
MACDRV_CALL
(
dnd_release
,
&
This
->
pasteboard
);
HeapFree
(
GetProcessHeap
(),
0
,
This
);
return
0
;
}
...
...
@@ -148,7 +148,7 @@ static HRESULT WINAPI dddo_GetData(IDataObject* iface, FORMATETC* formatEtc, STG
if
(
SUCCEEDED
(
hr
))
{
medium
->
tymed
=
TYMED_HGLOBAL
;
medium
->
u
.
hGlobal
=
macdrv_get_pasteboard_data
(
This
->
pasteboard
,
formatEtc
->
cfFormat
);
medium
->
u
.
hGlobal
=
macdrv_get_pasteboard_data
(
(
void
*
)(
UINT_PTR
)
This
->
pasteboard
,
formatEtc
->
cfFormat
);
medium
->
pUnkForRelease
=
NULL
;
hr
=
medium
->
u
.
hGlobal
?
S_OK
:
E_OUTOFMEMORY
;
}
...
...
@@ -168,6 +168,7 @@ static HRESULT WINAPI dddo_GetDataHere(IDataObject* iface, FORMATETC* formatEtc,
static
HRESULT
WINAPI
dddo_QueryGetData
(
IDataObject
*
iface
,
FORMATETC
*
formatEtc
)
{
DragDropDataObject
*
This
=
impl_from_IDataObject
(
iface
);
struct
dnd_have_format_params
params
;
HRESULT
hr
=
DV_E_FORMATETC
;
TRACE
(
"This %p formatEtc %p={.tymed=0x%x, .dwAspect=%d, .cfFormat=%s}
\n
"
,
...
...
@@ -185,7 +186,9 @@ static HRESULT WINAPI dddo_QueryGetData(IDataObject* iface, FORMATETC* formatEtc
return
E_NOTIMPL
;
}
if
(
macdrv_pasteboard_has_format
(
This
->
pasteboard
,
formatEtc
->
cfFormat
))
params
.
handle
=
This
->
pasteboard
;
params
.
format
=
formatEtc
->
cfFormat
;
if
(
MACDRV_CALL
(
dnd_have_format
,
&
params
))
hr
=
S_OK
;
TRACE
(
" -> 0x%x
\n
"
,
hr
);
...
...
@@ -225,7 +228,8 @@ static HRESULT WINAPI dddo_EnumFormatEtc(IDataObject* iface, DWORD direction,
IEnumFORMATETC
**
enumFormatEtc
)
{
DragDropDataObject
*
This
=
impl_from_IDataObject
(
iface
);
UINT
*
formats
,
count
;
struct
dnd_get_formats_params
params
;
UINT
count
;
HRESULT
hr
;
TRACE
(
"This %p direction %u enumFormatEtc %p
\n
"
,
This
,
direction
,
enumFormatEtc
);
...
...
@@ -236,8 +240,9 @@ static HRESULT WINAPI dddo_EnumFormatEtc(IDataObject* iface, DWORD direction,
return
E_NOTIMPL
;
}
formats
=
macdrv_get_pasteboard_formats
(
This
->
pasteboard
,
&
count
);
if
(
formats
)
params
.
handle
=
This
->
pasteboard
;
count
=
MACDRV_CALL
(
dnd_get_formats
,
&
params
);
if
(
count
)
{
FORMATETC
*
formatEtcs
=
HeapAlloc
(
GetProcessHeap
(),
0
,
count
*
sizeof
(
FORMATETC
));
if
(
formatEtcs
)
...
...
@@ -246,7 +251,7 @@ static HRESULT WINAPI dddo_EnumFormatEtc(IDataObject* iface, DWORD direction,
for
(
i
=
0
;
i
<
count
;
i
++
)
{
formatEtcs
[
i
].
cfFormat
=
formats
[
i
];
formatEtcs
[
i
].
cfFormat
=
params
.
formats
[
i
];
formatEtcs
[
i
].
ptd
=
NULL
;
formatEtcs
[
i
].
dwAspect
=
DVASPECT_CONTENT
;
formatEtcs
[
i
].
lindex
=
-
1
;
...
...
@@ -258,8 +263,6 @@ static HRESULT WINAPI dddo_EnumFormatEtc(IDataObject* iface, DWORD direction,
}
else
hr
=
E_OUTOFMEMORY
;
HeapFree
(
GetProcessHeap
(),
0
,
formats
);
}
else
hr
=
SHCreateStdEnumFmtEtc
(
0
,
NULL
,
enumFormatEtc
);
...
...
@@ -309,7 +312,7 @@ static const IDataObjectVtbl dovt =
};
static
IDataObject
*
create_data_object_for_pasteboard
(
CFTypeRef
pasteboard
)
static
IDataObject
*
create_data_object_for_pasteboard
(
UINT64
pasteboard
)
{
DragDropDataObject
*
dddo
;
...
...
@@ -319,7 +322,8 @@ static IDataObject *create_data_object_for_pasteboard(CFTypeRef pasteboard)
dddo
->
ref
=
1
;
dddo
->
IDataObject_iface
.
lpVtbl
=
&
dovt
;
dddo
->
pasteboard
=
CFRetain
(
pasteboard
);
dddo
->
pasteboard
=
pasteboard
;
MACDRV_CALL
(
dnd_retain
,
&
dddo
->
pasteboard
);
return
&
dddo
->
IDataObject_iface
;
}
...
...
@@ -421,7 +425,7 @@ NTSTATUS WINAPI macdrv_dnd_query_drop(void *arg, ULONG size)
if
(
!
active_data_object
)
{
WARN
(
"shouldn't happen: no active IDataObject
\n
"
);
active_data_object
=
create_data_object_for_pasteboard
(
(
void
*
)(
UINT_PTR
)
params
->
handle
);
active_data_object
=
create_data_object_for_pasteboard
(
params
->
handle
);
}
pointl
.
x
=
pt
.
x
;
...
...
@@ -564,7 +568,7 @@ NTSTATUS WINAPI macdrv_dnd_query_drag(void *arg, ULONG size)
POINTL
pointl
=
{
pt
.
x
,
pt
.
y
};
if
(
!
active_data_object
)
active_data_object
=
create_data_object_for_pasteboard
(
(
void
*
)(
UINT_PTR
)
params
->
handle
);
active_data_object
=
create_data_object_for_pasteboard
(
params
->
handle
);
TRACE
(
"DragEnter hwnd %p droptarget %p
\n
"
,
hwnd
,
droptarget
);
hr
=
IDropTarget_DragEnter
(
droptarget
,
active_data_object
,
MK_LBUTTON
,
...
...
@@ -605,7 +609,7 @@ NTSTATUS WINAPI macdrv_dnd_query_drag(void *arg, ULONG size)
FORMATETC
formatEtc
;
if
(
!
active_data_object
)
active_data_object
=
create_data_object_for_pasteboard
(
(
void
*
)(
UINT_PTR
)
params
->
handle
);
active_data_object
=
create_data_object_for_pasteboard
(
params
->
handle
);
formatEtc
.
cfFormat
=
CF_HDROP
;
formatEtc
.
ptd
=
NULL
;
...
...
dlls/winemac.drv/macdrv.h
View file @
a21983f1
...
...
@@ -256,8 +256,6 @@ extern void macdrv_UpdateClipboard(void) DECLSPEC_HIDDEN;
extern
BOOL
query_pasteboard_data
(
HWND
hwnd
,
CFStringRef
type
)
DECLSPEC_HIDDEN
;
extern
void
macdrv_lost_pasteboard_ownership
(
HWND
hwnd
)
DECLSPEC_HIDDEN
;
extern
HANDLE
macdrv_get_pasteboard_data
(
CFTypeRef
pasteboard
,
UINT
desired_format
)
DECLSPEC_HIDDEN
;
extern
BOOL
macdrv_pasteboard_has_format
(
CFTypeRef
pasteboard
,
UINT
desired_format
)
DECLSPEC_HIDDEN
;
extern
UINT
*
macdrv_get_pasteboard_formats
(
CFTypeRef
pasteboard
,
UINT
*
num_formats
)
DECLSPEC_HIDDEN
;
extern
struct
opengl_funcs
*
macdrv_wine_get_wgl_driver
(
UINT
version
)
DECLSPEC_HIDDEN
;
extern
const
struct
vulkan_funcs
*
macdrv_wine_get_vulkan_driver
(
UINT
version
)
DECLSPEC_HIDDEN
;
...
...
@@ -287,6 +285,10 @@ extern NTSTATUS WINAPI macdrv_ime_query_char_rect(void *params, ULONG size) DECL
/* unixlib interface */
extern
NTSTATUS
macdrv_dnd_get_formats
(
void
*
arg
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
macdrv_dnd_have_format
(
void
*
arg
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
macdrv_dnd_release
(
void
*
arg
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
macdrv_dnd_retain
(
void
*
arg
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
macdrv_ime_process_text_input
(
void
*
arg
)
DECLSPEC_HIDDEN
;
extern
NTSTATUS
macdrv_notify_icon
(
void
*
arg
)
DECLSPEC_HIDDEN
;
...
...
dlls/winemac.drv/macdrv_main.c
View file @
a21983f1
...
...
@@ -630,6 +630,10 @@ static NTSTATUS macdrv_ime_using_input_method(void *arg)
const
unixlib_entry_t
__wine_unix_call_funcs
[]
=
{
macdrv_dnd_get_formats
,
macdrv_dnd_have_format
,
macdrv_dnd_release
,
macdrv_dnd_retain
,
macdrv_ime_clear
,
macdrv_ime_process_text_input
,
macdrv_ime_using_input_method
,
...
...
dlls/winemac.drv/unixlib.h
View file @
a21983f1
...
...
@@ -21,6 +21,10 @@
enum
macdrv_funcs
{
unix_dnd_get_formats
,
unix_dnd_have_format
,
unix_dnd_release
,
unix_dnd_retain
,
unix_ime_clear
,
unix_ime_process_text_input
,
unix_ime_using_input_method
,
...
...
@@ -33,6 +37,20 @@ enum macdrv_funcs
extern
NTSTATUS
unix_call
(
enum
macdrv_funcs
code
,
void
*
params
)
DECLSPEC_HIDDEN
;
#define MACDRV_CALL(func, params) unix_call( unix_ ## func, params )
/* macdrv_dnd_get_formats params */
struct
dnd_get_formats_params
{
UINT64
handle
;
UINT
formats
[
64
];
};
/* macdrv_dnd_have_format params */
struct
dnd_have_format_params
{
UINT64
handle
;
UINT
format
;
};
/* macdrv_ime_process_text_input params */
struct
process_text_input_params
{
...
...
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