* Copyright (C) 1995-1999 Peter Mattis, Spencer Kimball and Josh MacDonald
*
* This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
+ * modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Library General Public License for more details.
+ * Lesser General Public License for more details.
*
- * You should have received a copy of the GNU Library General Public
+ * You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
/*
- * Modified by the GTK+ Team and others 1997-1999. See the AUTHORS
+ * Modified by the GTK+ Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GTK+ Team. See the ChangeLog
* files for a list of changes. These files are distributed with
* GTK+ at ftp://ftp.gtk.org/pub/gtk/.
#include "x11/gdkx.h"
#elif defined (GDK_WINDOWING_WIN32)
#include "win32/gdkwin32.h"
+#elif defined(GDK_WINDOWING_FB)
+#include "linux-fb/gdkfb.h"
+#elif defined (GDK_WINDOWING_NANOX)
+#include "nanox/gdkprivate-nanox.h"
#endif
#include "gdk/gdkkeysyms.h"
*suggested_action = GDK_ACTION_LINK;
}
}
+ else
+ {
+ *possible_actions = actions;
+
+ if (actions & GDK_ACTION_COPY)
+ *suggested_action = GDK_ACTION_COPY;
+ else if (actions & GDK_ACTION_MOVE)
+ *suggested_action = GDK_ACTION_MOVE;
+ else if (actions & GDK_ACTION_LINK)
+ *suggested_action = GDK_ACTION_LINK;
+ }
return;
}
gtk_widget_queue_clear (widget);
}
+static void
+gtk_drag_dest_set_internal (GtkWidget *widget,
+ GtkDragDestSite *site)
+{
+ GtkDragDestSite *old_site;
+
+ g_return_if_fail (widget != NULL);
+
+ /* HACK, do this in the destroy */
+ old_site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest");
+ if (old_site)
+ gtk_signal_disconnect_by_data (GTK_OBJECT (widget), old_site);
+
+ if (GTK_WIDGET_REALIZED (widget))
+ gtk_drag_dest_realized (widget);
+
+ gtk_signal_connect (GTK_OBJECT (widget), "realize",
+ GTK_SIGNAL_FUNC (gtk_drag_dest_realized), site);
+
+ gtk_object_set_data_full (GTK_OBJECT (widget), "gtk-drag-dest",
+ site, gtk_drag_dest_site_destroy);
+}
+
+
/*************************************************************
* gtk_drag_dest_set:
* Register a drop site, and possibly add default behaviors.
g_return_if_fail (widget != NULL);
- /* HACK, do this in the destroy */
- site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest");
- if (site)
- gtk_signal_disconnect_by_data (GTK_OBJECT (widget), site);
-
- if (GTK_WIDGET_REALIZED (widget))
- gtk_drag_dest_realized (widget);
-
- gtk_signal_connect (GTK_OBJECT (widget), "realize",
- GTK_SIGNAL_FUNC (gtk_drag_dest_realized), NULL);
-
site = g_new (GtkDragDestSite, 1);
site->flags = flags;
site->actions = actions;
site->do_proxy = FALSE;
- gtk_object_set_data_full (GTK_OBJECT (widget), "gtk-drag-dest",
- site, gtk_drag_dest_site_destroy);
+ gtk_drag_dest_set_internal (widget, site);
}
/*************************************************************
g_return_if_fail (widget != NULL);
- /* HACK, do this in the destroy */
- site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest");
- if (site)
- gtk_signal_disconnect_by_data (GTK_OBJECT (widget), site);
-
- if (GTK_WIDGET_REALIZED (widget))
- gtk_drag_dest_realized (widget);
-
- gtk_signal_connect (GTK_OBJECT (widget), "realize",
- GTK_SIGNAL_FUNC (gtk_drag_dest_realized), NULL);
-
site = g_new (GtkDragDestSite, 1);
site->flags = 0;
site->proxy_protocol = protocol;
site->proxy_coords = use_coordinates;
- gtk_object_set_data_full (GTK_OBJECT (widget), "gtk-drag-dest",
- site, gtk_drag_dest_site_destroy);
+ gtk_drag_dest_set_internal (widget, site);
}
/*************************************************************
info->proxy_data = NULL;
info->dropped = FALSE;
info->proxy_drop_wait = FALSE;
- g_dataset_set_data_full (context,
- "gtk-info",
+ g_object_set_qdata_full (G_OBJECT (context),
+ g_quark_from_static_string ("gtk-info"),
info,
gtk_drag_dest_info_destroy);
}
drop_widget = data;
context = gtk_object_get_data (GTK_OBJECT (widget), "drag-context");
- info = g_dataset_get_data (context, "gtk-info");
+ info = g_object_get_qdata (G_OBJECT (context), g_quark_from_static_string ("gtk-info"));
if (info->proxy_data &&
info->proxy_data->target == selection_data->target)
site = gtk_object_get_data (GTK_OBJECT (drop_widget), "gtk-drag-dest");
- if (site->target_list)
+ if (site && site->target_list)
{
guint target_info;
selection_data, 0, time);
}
- if (site->flags & GTK_DEST_DEFAULT_DROP)
+ if (site && site->flags & GTK_DEST_DEFAULT_DROP)
{
gtk_drag_finish (context,
source_info->proxy_dest = dest_info;
- g_dataset_set_data (source_info->context, "gtk-info", source_info);
+ g_object_set_qdata (G_OBJECT (source_info->context),
+ g_quark_from_static_string ("gtk-info"),
+ source_info);
gtk_signal_connect (GTK_OBJECT (source_info->ipc_widget),
"selection_get",
if (site->do_proxy)
{
- GtkDragDestInfo *info = g_dataset_get_data (context, "gtk-info");
+ GtkDragDestInfo *info = g_object_get_qdata (G_OBJECT (context),
+ g_quark_from_static_string ("gtk-info"));
if (info->proxy_source && !info->dropped)
gdk_drag_abort (info->proxy_source->context, time);
GdkWindow *dest_window;
GdkDragProtocol proto;
- GtkDragDestInfo *info = g_dataset_get_data (context, "gtk-info");
+ GtkDragDestInfo *info = g_object_get_qdata (G_OBJECT (context),
+ g_quark_from_static_string ("gtk-info"));
if (!info->proxy_source)
gtk_drag_proxy_begin (widget, info);
site = gtk_object_get_data (GTK_OBJECT (widget), "gtk-drag-dest");
g_return_val_if_fail (site != NULL, FALSE);
- info = g_dataset_get_data (context, "gtk-info");
+ info = g_object_get_qdata (G_OBJECT (context),
+ g_quark_from_static_string ("gtk-info"));
g_return_val_if_fail (info != NULL, FALSE);
info->drop_x = x;
info->context = gdk_drag_begin (info->ipc_widget->window, targets);
g_list_free (targets);
- g_dataset_set_data (info->context, "gtk-info", info);
+ g_object_set_qdata (G_OBJECT (info->context),
+ g_quark_from_static_string ("gtk-info"), info);
info->button = button;
info->target_list = target_list;
gtk_drag_get_event_actions (event, info->button, actions,
&suggested_action, &possible_actions);
- if (event)
- info->cursor = gtk_drag_get_cursor (suggested_action);
+ info->cursor = gtk_drag_get_cursor (suggested_action);
/* Set cur_x, cur_y here so if the "drag_begin" signal shows
* the drag icon, it will be in the right place
*/
- if (event->type == GDK_MOTION_NOTIFY)
+ if (event && event->type == GDK_MOTION_NOTIFY)
{
info->cur_x = event->motion.x_root;
info->cur_y = event->motion.y_root;
gtk_signal_emit_by_name (GTK_OBJECT (widget), "drag_begin",
info->context);
- if (event->type == GDK_MOTION_NOTIFY)
+ if (event && event->type == GDK_MOTION_NOTIFY)
gtk_drag_motion_cb (info->ipc_widget, (GdkEventMotion *)event, info);
info->start_x = info->cur_x;
g_return_if_fail (context != NULL);
g_return_if_fail (widget != NULL);
- info = g_dataset_get_data (context, "gtk-info");
+ info = g_object_get_qdata (G_OBJECT (context),
+ g_quark_from_static_string ("gtk-info"));
gtk_drag_remove_icon (info);
info->icon_window = widget;
gdk_window_get_size (pixmap, &width, &height);
- gtk_widget_push_visual (gdk_colormap_get_visual (colormap));
gtk_widget_push_colormap (colormap);
window = gtk_window_new (GTK_WINDOW_POPUP);
gtk_widget_set_events (window, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK);
gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);
- gtk_widget_pop_visual ();
gtk_widget_pop_colormap ();
gtk_widget_set_usize (window, width, height);
if (default_icon_pixmap)
gdk_pixmap_unref (default_icon_pixmap);
if (default_icon_mask)
- gdk_pixmap_unref (default_icon_pixmap);
+ gdk_pixmap_unref (default_icon_mask);
default_icon_colormap = colormap;
gdk_colormap_ref (colormap);
g_return_if_fail (event != NULL);
context = event->dnd.context;
- info = g_dataset_get_data (context, "gtk-info");
+ info = g_object_get_qdata (G_OBJECT (context),
+ g_quark_from_static_string ("gtk-info"));
if (!info)
return;
/* Mark the context as dead, so if the destination decides
* to respond really late, we still are OK.
*/
- g_dataset_set_data (info->context, "gtk-info", NULL);
+ g_object_set_qdata (G_OBJECT (info->context),
+ g_quark_from_static_string ("gtk-info"), NULL);
gtk_timeout_add (ANIM_STEP_TIME, gtk_drag_anim_timeout, anim);
}
}
i, event);
- info = g_dataset_get_data (context, "gtk-info");
+ info = g_object_get_qdata (G_OBJECT (context),
+ g_quark_from_static_string ("gtk-info"));
if (!info->icon_window)
{
gtk_target_list_unref (info->target_list);
- g_dataset_set_data (info->context, "gtk-info", NULL);
+ g_object_set_qdata (G_OBJECT (info->context), g_quark_from_static_string ("gtk-info"), NULL);
gdk_drag_context_unref (info->context);
if (info->drop_timeout)
send_event.button.time = time;
send_event.button.x = 0;
send_event.button.y = 0;
- send_event.button.pressure = 0.;
- send_event.button.xtilt = 0.;
- send_event.button.ytilt = 0.;
+ send_event.button.axes = NULL;
send_event.button.state = 0;
send_event.button.button = info->button;
- send_event.button.source = GDK_SOURCE_PEN;
- send_event.button.deviceid = GDK_CORE_POINTER;
+ send_event.button.device = gdk_core_pointer;
send_event.button.x_root = 0;
send_event.button.y_root = 0;