windows.dragdrop-listener: generalize some code for reuse

modern-harvey2
Alexander Iljin 2017-08-18 01:18:47 +03:00
parent 75f5f08810
commit db24910497
1 changed files with 6 additions and 3 deletions

View File

@ -19,7 +19,7 @@ IN: windows.dragdrop-listener
utf16n alien>string
] with map ;
: filenames-from-data-object ( data-object -- filenames )
: handle-data-object ( handler: ( hdrop -- x ) data-object -- filenames )
FORMATETC <struct>
CF_HDROP >>cfFormat
f >>ptd
@ -29,9 +29,12 @@ IN: windows.dragdrop-listener
STGMEDIUM <struct>
[ IDataObject::GetData ] keep swap succeeded? [
dup data>>
[ filenames-from-hdrop ] with-global-lock
[ rot execute( hdrop -- x ) ] with-global-lock
swap ReleaseStgMedium
] [ drop f ] if ;
] [ 2drop f ] if ;
: filenames-from-data-object ( data-object -- filenames )
\ filenames-from-hdrop swap handle-data-object ;
TUPLE: listener-dragdrop hWnd last-drop-effect ;