]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/dnd.cpp
aui docking works well on systems with solid window dragging turned off
[wxWidgets.git] / src / gtk / dnd.cpp
index 14cee77258743184f65a8e8830befc4aae5aff4c..6ef44f891a2bb405b016da6016b844d7de6399b6 100644 (file)
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
 
 #ifndef WX_PRECOMP
     #include "wx/intl.h"
+    #include "wx/log.h"
+    #include "wx/app.h"
+    #include "wx/utils.h"
+    #include "wx/window.h"
+    #include "wx/gdicmn.h"
 #endif
 
 #endif
 
-#include "wx/window.h"
-#include "wx/app.h"
-#include "wx/gdicmn.h"
-#include "wx/log.h"
-#include "wx/utils.h"
-
 #include "wx/gtk/private.h"
 
 #include <gdk/gdkprivate.h>
 #include "wx/gtk/private.h"
 
 #include <gdk/gdkprivate.h>
@@ -338,7 +337,7 @@ static gboolean target_drag_drop( GtkWidget *widget,
     }
     else
     {
     }
     else
     {
-        wxLogTrace(TRACE_DND, wxT( "Drop target: OnDrop returned TRUE") );
+        wxLogTrace(TRACE_DND, wxT( "Drop target: OnDrop returned true") );
 
 #if wxUSE_THREADS
         /* disable GUI threads */
 
 #if wxUSE_THREADS
         /* disable GUI threads */
@@ -416,7 +415,7 @@ static void target_drag_data_received( GtkWidget *WXUNUSED(widget),
 
     if ( wxIsDragResultOk( drop_target->OnData( x, y, result ) ) )
     {
 
     if ( wxIsDragResultOk( drop_target->OnData( x, y, result ) ) )
     {
-        wxLogTrace(TRACE_DND, wxT( "Drop target: OnData returned TRUE") );
+        wxLogTrace(TRACE_DND, wxT( "Drop target: OnData returned true") );
 
         /* tell GTK that data transfer was successful */
         gtk_drag_finish( context, TRUE, FALSE, time );
 
         /* tell GTK that data transfer was successful */
         gtk_drag_finish( context, TRUE, FALSE, time );
@@ -656,7 +655,7 @@ source_drag_data_get  (GtkWidget          *WXUNUSED(widget),
 
 extern "C" {
 static void source_drag_data_delete( GtkWidget *WXUNUSED(widget),
 
 extern "C" {
 static void source_drag_data_delete( GtkWidget *WXUNUSED(widget),
-                                     GdkDragContext *context,
+                                     GdkDragContext *WXUNUSED(context),
                                      wxDropSource *WXUNUSED(drop_source) )
 {
     if (g_isIdle)
                                      wxDropSource *WXUNUSED(drop_source) )
 {
     if (g_isIdle)
@@ -707,8 +706,7 @@ extern "C" {
 static gint
 gtk_dnd_window_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxDropSource *source )
 {
 static gint
 gtk_dnd_window_configure_callback( GtkWidget *WXUNUSED(widget), GdkEventConfigure *WXUNUSED(event), wxDropSource *source )
 {
-    if (g_isIdle)
-        wxapp_install_idle_handler();
+    // don't need to install idle handler, its done from "event" signal
 
     source->GiveFeedback( ConvertFromGTK(source->m_dragContext->action) );
 
 
     source->GiveFeedback( ConvertFromGTK(source->m_dragContext->action) );
 
@@ -912,6 +910,14 @@ wxDragResult wxDropSource::DoDragDrop(int flags)
 
     UnregisterWindow();
 
 
     UnregisterWindow();
 
+    // this shouldn't be needed but somehow, sometimes, without this the cursor
+    // stays grabbed even when the DND operation ends and the application
+    // becomes unresponsive and has to be killed resulting in loss of all
+    // unsaved data, so while this fix is ugly it's still better than
+    // alternative
+    if ( gdk_pointer_is_grabbed() )
+        gdk_pointer_ungrab(GDK_CURRENT_TIME);
+
     return m_retValue;
 }
 
     return m_retValue;
 }