///////////////////////////////////////////////////////////////////////////////
-// Name: dnd.cpp
+// Name: src/gtk1/dnd.cpp
// Purpose: wxDropTarget class
// Author: Robert Roebling
// Id: $Id$
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
-#include "wx/dnd.h"
-#include "wx/log.h"
-
-
#if wxUSE_DRAG_AND_DROP
-#include "wx/window.h"
-#include "wx/app.h"
-#include "wx/gdicmn.h"
-#include "wx/intl.h"
-#include "wx/utils.h"
+#include "wx/dnd.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
-#include "wx/gtk/private.h"
+#include "wx/gtk1/private.h"
#include <gdk/gdkprivate.h>
GdkAtom format = drop_target->GetMatchingPair();
// this does happen somehow, see bug 555111
- wxCHECK_MSG( format, FALSE, _T("no matching GdkAtom for format?") )
+ wxCHECK_MSG( format, FALSE, _T("no matching GdkAtom for format?") );
/*
GdkDragAction action = GDK_ACTION_MOVE;
GList *child = m_dragContext->targets;
while (child)
{
- // in GTK+ 1.x GdkAtom was a gulong, but now it's a pointer
- GdkAtom formatAtom = (GdkAtom)
-#ifndef __WXGTK20__
- GPOINTER_TO_INT
-#endif
- (child->data);
+ GdkAtom formatAtom = GPOINTER_TO_INT(child->data);
wxDataFormat format( formatAtom );
#ifdef __WXDEBUG__
gdk_window_get_size (pixmap, &width, &height);
GdkColormap *colormap = gtk_widget_get_colormap( m_widget );
-#ifndef __WXGTK20__
gtk_widget_push_visual (gdk_colormap_get_visual (colormap));
-#endif
gtk_widget_push_colormap (colormap);
m_iconWindow = gtk_window_new (GTK_WINDOW_POPUP);
gtk_widget_set_events (m_iconWindow, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
gtk_widget_set_app_paintable (GTK_WIDGET (m_iconWindow), TRUE);
-#ifndef __WXGTK20__
gtk_widget_pop_visual ();
-#endif
gtk_widget_pop_colormap ();
gtk_widget_set_usize (m_iconWindow, width, height);
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;
}