Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
23b6ca2f
Commit
23b6ca2f
authored
Apr 19, 2003
by
Cyril Deguet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
* drag&drop works ! (at least with mozilla)
parent
5ee03109
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
77 additions
and
149 deletions
+77
-149
modules/gui/skins/gtk2/gtk2_dragdrop.cpp
modules/gui/skins/gtk2/gtk2_dragdrop.cpp
+52
-108
modules/gui/skins/gtk2/gtk2_dragdrop.h
modules/gui/skins/gtk2/gtk2_dragdrop.h
+11
-26
modules/gui/skins/gtk2/gtk2_theme.cpp
modules/gui/skins/gtk2/gtk2_theme.cpp
+1
-3
modules/gui/skins/gtk2/gtk2_window.cpp
modules/gui/skins/gtk2/gtk2_window.cpp
+9
-8
modules/gui/skins/gtk2/gtk2_window.h
modules/gui/skins/gtk2/gtk2_window.h
+4
-4
No files found.
modules/gui/skins/gtk2/gtk2_dragdrop.cpp
View file @
23b6ca2f
...
...
@@ -2,7 +2,7 @@
* gtk2_dragdrop.cpp: GTK2 implementation of the drag & drop
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_dragdrop.cpp,v 1.
3 2003/04/16 21:40:07 ipkiss
Exp $
* $Id: gtk2_dragdrop.cpp,v 1.
4 2003/04/19 11:16:17 asmax
Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
...
...
@@ -25,27 +25,69 @@
#if !defined WIN32
//--- GTK2 -----------------------------------------------------------------
//#include <windows.h>
#include <gdk/gdk.h>
//--- VLC -------------------------------------------------------------------
#include <vlc/intf.h>
//--- SKIN ------------------------------------------------------------------
#include "../src/event.h"
#include "../os_api.h"
#include "gtk2_dragdrop.h"
/*
//---------------------------------------------------------------------------
GTK2DropObject::GTK2DropObject(
) : IDropTarget(
)
GTK2DropObject
::
GTK2DropObject
(
intf_thread_t
*
_p_intf
)
{
References = 1
;
p_intf
=
_p_intf
;
}
//---------------------------------------------------------------------------
GTK2DropObject
::~
GTK2DropObject
()
{
}
//---------------------------------------------------------------------------
void GTK2DropObject::HandleDrop
( HDROP HDrop
)
void
GTK2DropObject
::
HandleDrop
Start
(
GdkDragContext
*
context
)
{
// Get number of files that are dropped into vlc
GdkAtom
atom
=
gdk_drag_get_selection
(
context
);
guchar
*
buffer
;
GdkAtom
prop_type
;
gint
prop_format
;
// Get the owner of the selection
GdkWindow
*
owner
=
gdk_selection_owner_get
(
atom
);
// Find the possible targets for the selection
string
target
=
""
;
gdk_selection_convert
(
owner
,
atom
,
gdk_atom_intern
(
"TARGETS"
,
FALSE
),
OSAPI_GetTime
()
);
int
len
=
gdk_selection_property_get
(
owner
,
&
buffer
,
&
prop_type
,
&
prop_format
);
for
(
int
i
=
0
;
i
<
len
/
sizeof
(
GdkAtom
);
i
++
)
{
GdkAtom
atom
=
(
(
GdkAtom
*
)
buffer
)[
i
];
string
name
=
gdk_atom_name
(
atom
);
if
(
name
==
"text/plain"
||
name
==
"STRING"
)
{
target
=
name
;
break
;
}
}
if
(
target
==
""
)
{
msg_Warn
(
p_intf
,
"Drag&Drop: target not found
\n
"
);
}
else
{
gdk_selection_convert
(
owner
,
atom
,
gdk_atom_intern
(
target
.
c_str
(),
FALSE
),
OSAPI_GetTime
()
);
len
=
gdk_selection_property_get
(
owner
,
&
buffer
,
&
prop_type
,
&
prop_format
);
OSAPI_PostMessage
(
NULL
,
VLC_DROP
,
(
unsigned
int
)
buffer
,
0
);
}
/* // Get number of files that are dropped into vlc
int NbFiles = DragQueryFile( (HDROP)HDrop, 0xFFFFFFFF, NULL, 0 );
// For each dropped files
...
...
@@ -62,107 +104,9 @@ void GTK2DropObject::HandleDrop( HDROP HDrop )
}
DragFinish( (HDROP)HDrop );
}
//---------------------------------------------------------------------------
STDMETHODIMP GTK2DropObject::QueryInterface( REFIID iid, void FAR* FAR* ppv )
{
// Tell other objects about our capabilities
if( iid == IID_IUnknown || iid == IID_IDropTarget )
{
*ppv = this;
AddRef();
return S_OK;
}
*ppv = NULL;
return ResultFromScode( E_NOINTERFACE );
}
//---------------------------------------------------------------------------
STDMETHODIMP_(ULONG) GTK2DropObject::AddRef()
{
return ++References;
}
//---------------------------------------------------------------------------
STDMETHODIMP_(ULONG) GTK2DropObject::Release()
{
if( --References == 0 )
{
delete this;
return 0;
}
return References;
}
//---------------------------------------------------------------------------
STDMETHODIMP GTK2DropObject::DragEnter( LPDATAOBJECT pDataObj,
DWORD grfKeyState, POINTL pt, DWORD *pdwEffect )
{
FORMATETC fmtetc;
fmtetc.cfFormat = CF_HDROP;
fmtetc.ptd = NULL;
fmtetc.dwAspect = DVASPECT_CONTENT;
fmtetc.lindex = -1;
fmtetc.tymed = TYMED_HGLOBAL;
// Check that the drag source provides CF_HDROP,
// which is the only format we accept
if( pDataObj->QueryGetData( &fmtetc ) == S_OK )
*pdwEffect = DROPEFFECT_COPY;
else
*pdwEffect = DROPEFFECT_NONE;
return S_OK;
}
//---------------------------------------------------------------------------
STDMETHODIMP GTK2DropObject::DragOver( DWORD grfKeyState, POINTL pt,
DWORD *pdwEffect )
{
// For visual feedback
// TODO
return S_OK;
}
//---------------------------------------------------------------------------
STDMETHODIMP GTK2DropObject::DragLeave()
{
// Remove visual feedback
// TODO
return S_OK;
}
//---------------------------------------------------------------------------
STDMETHODIMP GTK2DropObject::Drop( LPDATAOBJECT pDataObj, DWORD grfKeyState,
POINTL pt, DWORD *pdwEffect )
{
// User has dropped on us -- get the CF_HDROP data from drag source
FORMATETC fmtetc;
fmtetc.cfFormat = CF_HDROP;
fmtetc.ptd = NULL;
fmtetc.dwAspect = DVASPECT_CONTENT;
fmtetc.lindex = -1;
fmtetc.tymed = TYMED_HGLOBAL;
STGMEDIUM medium;
HRESULT hr = pDataObj->GetData( &fmtetc, &medium );
if( !FAILED(hr) )
{
// Grab a pointer to the data
HGLOBAL HFiles = medium.hGlobal;
HDROP HDrop = (HDROP)GlobalLock( HFiles );
// Notify the Form of the drop
HandleDrop( HDrop );
// Release the pointer to the memory
GlobalUnlock( HFiles );
// ReleaseStgMedium( &medium );
}
else
{
*pdwEffect = DROPEFFECT_NONE;
return hr;
}
return S_OK;
}
*/
gdk_drop_finish
(
context
,
TRUE
,
OSAPI_GetTime
()
);
}
#endif
modules/gui/skins/gtk2/gtk2_dragdrop.h
View file @
23b6ca2f
...
...
@@ -2,7 +2,7 @@
* gtk2_dragdrop.h: GTK2 implementation of the drag & drop
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_dragdrop.h,v 1.
1 2003/04/12 21:43:2
7 asmax Exp $
* $Id: gtk2_dragdrop.h,v 1.
2 2003/04/19 11:16:1
7 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
...
...
@@ -27,36 +27,21 @@
#define VLC_SKIN_GTK2_DRAGDROP
//--- GTK2 -----------------------------------------------------------------
//#include <shellapi.h>
//#include <ole2.h>
#include <gdk/gdk.h>
#include <stdio.h>
//---------------------------------------------------------------------------
/*
class GTK2DropObject : public IDropTarget
class
GTK2DropObject
{
intf_thread_t
*
p_intf
;
public:
GTK2DropObject();
GTK2DropObject
(
intf_thread_t
*
_p_intf
);
virtual
~
GTK2DropObject
();
protected:
// IUnknown methods
STDMETHOD(QueryInterface)( REFIID riid, void FAR* FAR* ppvObj );
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
// IDropTarget methods
STDMETHOD(DragEnter)( LPDATAOBJECT pDataObj, DWORD grfKeyState,
POINTL pt, DWORD *pdwEffect );
STDMETHOD(DragOver)( DWORD grfKeyState, POINTL pt, DWORD *pdwEffect );
STDMETHOD(DragLeave)();
STDMETHOD(Drop)( LPDATAOBJECT pDataObj, DWORD grfKeyState,
POINTL pt, DWORD *pdwEffect );
private:
unsigned long References;
// Helper function
void HandleDrop( HDROP HDrop );
};*/
void
HandleDropStart
(
GdkDragContext
*
context
);
};
//---------------------------------------------------------------------------
#endif
modules/gui/skins/gtk2/gtk2_theme.cpp
View file @
23b6ca2f
...
...
@@ -2,7 +2,7 @@
* gtk2_theme.cpp: GTK2 implementation of the Theme class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_theme.cpp,v 1.1
7 2003/04/18 16:04
:17 asmax Exp $
* $Id: gtk2_theme.cpp,v 1.1
8 2003/04/19 11:16
:17 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
...
...
@@ -260,8 +260,6 @@ void GTK2Theme::AddWindow( string name, int x, int y, bool visible,
return
;
}
gdk_window_register_dnd
(
gwnd
);
gdk_window_show
(
gwnd
);
WindowList
.
push_back
(
(
Window
*
)
new
OSWindow
(
p_intf
,
gwnd
,
x
,
y
,
visible
,
...
...
modules/gui/skins/gtk2/gtk2_window.cpp
View file @
23b6ca2f
...
...
@@ -2,7 +2,7 @@
* gtk2_window.cpp: GTK2 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_window.cpp,v 1.2
0 2003/04/18 16:04
:17 asmax Exp $
* $Id: gtk2_window.cpp,v 1.2
1 2003/04/19 11:16
:17 asmax Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
...
...
@@ -102,17 +102,14 @@ GTK2Window::GTK2Window( intf_thread_t *p_intf, GdkWindow *gwnd, int x, int y,
SendMessage( ToolTipWindow, TTM_ADDTOOL, 0,
(LPARAM)(LPTOOLINFO) &ToolTipInfo );
// Drag & drop
*/
if
(
DragDrop
)
{
// Initialize the OLE library
OleInitialize( NULL );
DropTarget = (LPDROPTARGET) new GTK2DropObject();
// register the listview as a drop target
RegisterDragDrop( hWnd, DropTarget );
GTK2DropObject
*
DropDrop
=
new
GTK2DropObject
(
p_intf
);
gdk_window_register_dnd
(
gwnd
);
}
*/
// Create Tool Tip window
/* GdkWindowAttr attr;
attr.event_mask = GDK_ALL_EVENTS_MASK;
...
...
@@ -240,6 +237,10 @@ bool GTK2Window::ProcessOSEvent( Event *evt )
(
int
)(
(
GdkEventButton
*
)
p2
)
->
y
,
1
);
return
true
;
case
GDK_DROP_START
:
DropObject
->
HandleDropStart
(
(
(
GdkEventDND
*
)
p2
)
->
context
);
return
true
;
default:
return
false
;
}
...
...
modules/gui/skins/gtk2/gtk2_window.h
View file @
23b6ca2f
...
...
@@ -2,7 +2,7 @@
* gtk2_window.h: GTK2 implementation of the Window class
*****************************************************************************
* Copyright (C) 2003 VideoLAN
* $Id: gtk2_window.h,v 1.
5 2003/04/15 20:33:58 karibu
Exp $
* $Id: gtk2_window.h,v 1.
6 2003/04/19 11:16:17 asmax
Exp $
*
* Authors: Cyril Deguet <asmax@videolan.org>
*
...
...
@@ -46,13 +46,13 @@ class GTK2Window : public Window
int
WindowY
;
string
Name
;
// Drag&Drop
GTK2DropObject
*
DropObject
;
// Tooltip texts
GdkWindow
*
ToolTipWindow
;
// TOOLINFO ToolTipInfo;
// Drag & drop
// LPDROPTARGET DropTarget;
// Left button down
bool
LButtonDown
;
bool
RButtonDown
;
...
...
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