Bug in dragging from GtkListItem
- From: Elliot Lee <sopwith redhat com>
- To: gtk-devel-list redhat com
- Subject: Bug in dragging from GtkListItem
- Date: Tue, 5 Jan 1999 11:45:37 -0500 (EST)
When dragging from a GtkListItem source to another widget in the same app,
the GtkList keeps an event grab or something, so that moving the mouse
anywhere in the app changes the current list item, and clicking the first
time does not work as expected.
The attached patch (which applies to
gnome-libs/gnome-hello/gnome-hello-5-dnd.c - sorry, no gtk-only one, but
the idea is pretty simple and easy to reproduce) demonstrates the problem.
-- Elliot
"In film you will find four basic story lines. Man versus man, man
versus nature, nature versus nature, and dog versus vampire."
- Steven Spielberg
Index: gnome-hello-5-dnd.c
===================================================================
RCS file: /cvs/gnome/gnome-libs/gnome-hello/gnome-hello-5-dnd.c,v
retrieving revision 1.10
diff -u -r1.10 gnome-hello-5-dnd.c
--- gnome-hello-5-dnd.c 1998/12/17 00:06:00 1.10
+++ gnome-hello-5-dnd.c 1999/01/05 16:36:17
@@ -53,7 +53,7 @@
static void
prepare_app(void)
{
- GtkWidget *source, *drop_target, *vbox;
+ GtkWidget *source, *source2, *drop_target, *vbox, *list;
/* This is the list of formats the drag source exports */
static GtkTargetEntry drag_types[] = {
@@ -75,10 +75,14 @@
vbox = gtk_hbox_new(5, FALSE);
gnome_app_set_contents ( GNOME_APP (app), vbox);
-
- source = gtk_button_new_with_label ("Drag me");
+
+ list = gtk_list_new();
+ source = gtk_list_item_new_with_label ("Drag me");
+ source2 = gtk_list_item_new_with_label ("Drag me too!");
drop_target = gtk_button_new_with_label ("to this button");
- gtk_container_add(GTK_CONTAINER(vbox), source);
+ gtk_container_add(GTK_CONTAINER(list), source);
+ gtk_container_add(GTK_CONTAINER(list), source2);
+ gtk_container_add(GTK_CONTAINER(vbox), list);
gtk_container_add(GTK_CONTAINER(vbox), drop_target);
gtk_signal_connect (GTK_OBJECT (source), "drag_data_get",
@@ -91,6 +95,16 @@
gtk_container_set_border_width (GTK_CONTAINER (source), 60);
+ gtk_signal_connect (GTK_OBJECT (source2), "drag_data_get",
+ GTK_SIGNAL_FUNC(drag_data_get_cb), NULL);
+
+ gtk_drag_source_set (source2,
+ GDK_BUTTON1_MASK,
+ drag_types, sizeof(drag_types) / sizeof(drag_types[0]),
+ GDK_ACTION_COPY);
+
+ gtk_container_set_border_width (GTK_CONTAINER (source2), 60);
+
gtk_signal_connect (GTK_OBJECT (drop_target), "drag_data_received",
GTK_SIGNAL_FUNC(drop_cb), NULL);
@@ -101,7 +115,7 @@
drop_types, sizeof(drop_types) / sizeof(drop_types[0]),
GDK_ACTION_COPY);
- gtk_container_border_width (GTK_CONTAINER (drop_target), 60);
+ gtk_container_set_border_width (GTK_CONTAINER (drop_target), 60);
gtk_widget_show_all (app);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]