]> git.sesse.net Git - vlc/commitdiff
* very beginning of drag and drop support in X11 skins
authorCyril Deguet <asmax@videolan.org>
Sun, 8 Jun 2003 18:17:50 +0000 (18:17 +0000)
committerCyril Deguet <asmax@videolan.org>
Sun, 8 Jun 2003 18:17:50 +0000 (18:17 +0000)
modules/gui/skins/x11/x11_dragdrop.cpp
modules/gui/skins/x11/x11_dragdrop.h
modules/gui/skins/x11/x11_run.cpp
modules/gui/skins/x11/x11_window.cpp

index d86761af51c35d9092582a9e6e4306c5e027fb65..000cd4c42978f4615b332569423cdd899c0ec82b 100644 (file)
@@ -2,7 +2,7 @@
  * x11_dragdrop.cpp: X11 implementation of the drag & drop
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: x11_dragdrop.cpp,v 1.1 2003/04/28 14:32:57 asmax Exp $
+ * $Id: x11_dragdrop.cpp,v 1.2 2003/06/08 18:17:50 asmax Exp $
  *
  * Authors: Cyril Deguet     <asmax@videolan.org>
  *
@@ -46,6 +46,25 @@ X11DropObject::~X11DropObject()
 {
 }
 //---------------------------------------------------------------------------
+void X11DropObject::DndEnter( ldata_t data )
+{
+    fprintf(stderr,"dnd enter\n");
+}
+//---------------------------------------------------------------------------
+void X11DropObject::DndPosition( ldata_t data )
+{
+    fprintf(stderr,"dnd position\n");
+}
+//---------------------------------------------------------------------------
+void X11DropObject::DndLeave( ldata_t data )
+{
+    fprintf(stderr,"dnd leave\n");
+}
+//---------------------------------------------------------------------------
+void X11DropObject::DndDrop( ldata_t data )
+{
+    fprintf(stderr,"dnd drop\n");
+}
 #if 0
 void X11DropObject::HandleDropStart( GdkDragContext *context )
 {
index 9ce484b9ae4eba96e4e37ae3da2ebfcf6a458f24..f2c111713e51073fb0f98a00c3edde49f163bc60 100644 (file)
@@ -2,7 +2,7 @@
  * x11_dragdrop.h: X11 implementation of the drag & drop
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: x11_dragdrop.h,v 1.1 2003/04/28 14:32:57 asmax Exp $
+ * $Id: x11_dragdrop.h,v 1.2 2003/06/08 18:17:50 asmax Exp $
  *
  * Authors: Cyril Deguet     <asmax@videolan.org>
  *
@@ -30,6 +30,9 @@
 #include <X11/Xlib.h>
 
 //---------------------------------------------------------------------------
+
+typedef long ldata_t[5];
+
 class X11DropObject
 {
     private:
@@ -39,7 +42,10 @@ class X11DropObject
        X11DropObject( intf_thread_t *_p_intf );
        virtual ~X11DropObject();
 
- //      void HandleDropStart( GdkDragContext *context );
+       void DndEnter( ldata_t data );
+       void DndPosition( ldata_t data );
+       void DndLeave( ldata_t data );
+       void DndDrop( ldata_t data );
 };
 //---------------------------------------------------------------------------
 #endif
index 6c73f0aec71702149ba335ec9ea01384baa17568..616d2ae2e54562063e693f8af13410cb97424f30 100644 (file)
@@ -2,7 +2,7 @@
  * x11_run.cpp:
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: x11_run.cpp,v 1.19 2003/06/08 11:33:14 asmax Exp $
+ * $Id: x11_run.cpp,v 1.20 2003/06/08 18:17:50 asmax Exp $
  *
  * Authors: Cyril Deguet     <asmax@videolan.org>
  *
@@ -64,7 +64,8 @@ int ProcessEvent( intf_thread_t *p_intf, VlcProc *proc, XEvent *event )
     
     // Create event to dispatch in windows
     // Skin event
-    if( event->type == ClientMessage )
+    if( event->type == ClientMessage && 
+        ((XClientMessageEvent*)event)->message_type == 0 )
     {
         msg = ( (XClientMessageEvent *)event )->data.l[0];
         evt = (Event *)new OSEvent( p_intf, 
index 7fc782b6a571874ff5a93780706da4bd50727d70..914c2b1213d1c6d184323a008cd757668abb1555 100644 (file)
@@ -2,7 +2,7 @@
  * x11_window.cpp: X11 implementation of the Window class
  *****************************************************************************
  * Copyright (C) 2003 VideoLAN
- * $Id: x11_window.cpp,v 1.15 2003/06/08 12:45:13 gbazin Exp $
+ * $Id: x11_window.cpp,v 1.16 2003/06/08 18:17:50 asmax Exp $
  *
  * Authors: Cyril Deguet     <asmax@videolan.org>
  *
@@ -32,6 +32,7 @@
 
 //--- X11 -------------------------------------------------------------------
 #include <X11/Xlib.h>
+#include <X11/Xatom.h>
 #include <X11/extensions/shape.h>
 
 //--- SKIN ------------------------------------------------------------------
@@ -85,7 +86,13 @@ X11Window::X11Window( intf_thread_t *p_intf, Window wnd, int x, int y,
     {
         // register the listview as a drop target
         DropObject = new X11DropObject( p_intf );
-    //    gdk_window_register_dnd( gwnd );
+
+        Atom xdndAtom = XInternAtom( display, "XdndAware", False );
+        char xdndVersion = 4;
+        XLOCK;
+        XChangeProperty( display, wnd, xdndAtom, XA_ATOM, 32, 
+                         PropModeReplace, (unsigned char *)&xdndVersion, 1);
+        XUNLOCK;
     }
 
     // Create Tool Tip window
@@ -332,10 +339,33 @@ bool X11Window::ProcessOSEvent( Event *evt )
             OSAPI_PostMessage( this, WINDOW_LEAVE, 0, 0 );
             return true;
 
-/*        case GDK_DROP_START:
-            DropObject->HandleDropStart( ( (GdkEventDND *)p2 )->context );
-            return true;
-*/
+        case ClientMessage:
+            {
+            string type = XGetAtomName( display, ( (XClientMessageEvent*)
+                                                    p2 )->message_type );
+            if( type == "XdndEnter" )
+            {
+                DropObject->DndEnter( ((XClientMessageEvent*)p2)->data.l );
+                return true;
+            }
+            else if( type == "XdndPosition" )
+            {
+                DropObject->DndPosition( ((XClientMessageEvent*)p2)->data.l );
+                return true;
+            }
+            else if( type == "XdndLeave" )
+            {
+                DropObject->DndLeave( ((XClientMessageEvent*)p2)->data.l );
+                return true;
+            }
+            else if( type == "XdndDrop" )
+            {
+                DropObject->DndDrop( ((XClientMessageEvent*)p2)->data.l );
+                return true;
+            }
+            }
+            return false;
+            
         default:
             return false;
     }