[gtkmm/gtkmm-2-24] Window: Correct my broken begin_drag() implementation.



commit d83df4a1fc89992fa319bf6f15327eccac319fb3
Author: Murray Cumming <murrayc murrayc com>
Date:   Fri Jan 14 16:07:35 2011 +0100

    Window: Correct my broken begin_drag() implementation.
    
    * gdk/src/window.ccg: gdk_drag_begin() takes a GList*, not an array.

 ChangeLog          |    6 ++++++
 gdk/src/window.ccg |   15 ++++++++-------
 2 files changed, 14 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 1a9c3c1..a96490f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2011-01-14  Murray Cumming  <murrayc murrayc com>
 
+	Window: Correct my broken begin_drag() implementation.
+
+	* gdk/src/window.ccg: gdk_drag_begin() takes a GList*, not an array.
+
+2011-01-14  Murray Cumming  <murrayc murrayc com>
+
 	DragContext: Deprecate create(), adding Window::drag_begin().
 
 	* gdk/src/dragcontext.hg: Deprecate the constructor and create(), because 
diff --git a/gdk/src/window.ccg b/gdk/src/window.ccg
index eff082f..351a1da 100644
--- a/gdk/src/window.ccg
+++ b/gdk/src/window.ccg
@@ -92,26 +92,27 @@ void Window::restack(bool above)
   gdk_window_restack(gobj(), NULL, above);
 }
 
-Glib::RefPtr<DragContext> Window::drag_begin(const Glib::StringArrayHandle& targets))
+Glib::RefPtr<DragContext> Window::drag_begin(const Glib::StringArrayHandle& targets)
 {
   Glib::RefPtr<DragContext> result;
   
   //Put it into a real container that we can use:
   std::vector<Glib::ustring> targets_copy = targets;
    
-  //Create array of target GdkAtoms from target strings:
+  //Create GList from target strings:
   if(!targets_copy.empty())
   {
-    GdkAtom* pAtoms = new GdkAtom[targets_copy.size()];
-
+    GList* list = 0;
+    
     for(guint i = 0; i < targets_copy.size(); ++i)
     {
-      *pAtoms = Gdk::AtomString::to_c_type(targets_copy[i]);
+      GdkAtom atom = Gdk::AtomString::to_c_type(targets_copy[i]);
+      list = g_list_append (list, GUINT_TO_POINTER (atom));
     }
 
-    result = Glib::wrap(gdk_drag_begin(gobj(), targets), true);
+    result = Glib::wrap(gdk_drag_begin(gobj(), list), true);
 
-    delete[] pAtoms;
+    g_list_free(list);
   }
 
   return result;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]