[gtk+/xi2-for-master] Drop multidevice-events and GtkDeviceGroup.
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/xi2-for-master] Drop multidevice-events and GtkDeviceGroup.
- Date: Fri, 21 May 2010 14:06:18 +0000 (UTC)
commit f8685af5500a093b6314017c7a3f8521d8007481
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri May 21 16:03:21 2010 +0200
Drop multidevice-events and GtkDeviceGroup.
For now, it isn't yet clear how is Xorg going to handle multitouch in the
medium term, so leave these aside at the moment waiting for better times.
gtk/Makefile.am | 2 -
gtk/gtk.symbols | 12 -
gtk/gtkdevicegroup.c | 215 -------------
gtk/gtkdevicegroup.h | 71 -----
gtk/gtkwidget.c | 368 ---------------------
gtk/gtkwidget.h | 44 ---
tests/Makefile.am | 2 -
tests/multidevice/Makefile.am | 47 ---
tests/multidevice/testangle.c | 193 -----------
tests/multidevice/testcoordinates.c | 47 ---
tests/multidevice/testcoordinatewidget.c | 249 ---------------
tests/multidevice/testcoordinatewidget.h | 57 ----
tests/multidevice/testphotoalbum.c | 113 -------
tests/multidevice/testphotoalbumwidget.c | 508 ------------------------------
tests/multidevice/testphotoalbumwidget.h | 60 ----
15 files changed, 0 insertions(+), 1988 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index a51cf1f..ce1e2af 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -203,7 +203,6 @@ gtk_public_h_sources = \
gtkcomboboxentry.h \
gtkcontainer.h \
gtkdebug.h \
- gtkdevicegroup.h \
gtkdialog.h \
gtkdnd.h \
gtkdrawingarea.h \
@@ -461,7 +460,6 @@ gtk_base_c_sources = \
gtkcombobox.c \
gtkcomboboxentry.c \
gtkcontainer.c \
- gtkdevicegroup.c \
gtkdialog.c \
gtkdrawingarea.c \
gtkeditable.c \
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index b010460..d9332b0 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -4476,22 +4476,10 @@ gtk_widget_set_mapped
gtk_widget_get_mapped
gtk_widget_get_support_multidevice
gtk_widget_set_support_multidevice
-gtk_widget_create_device_group
-gtk_widget_remove_device_group
-gtk_widget_get_group_for_device
gtk_widget_device_is_shadowed
#endif
#endif
-#if IN_HEADER(__GTK_DEVICE_GROUP_H__)
-#if IN_FILE(__GTK_DEVICE_GROUP_C__)
-gtk_device_group_get_type G_GNUC_CONST
-gtk_device_group_add_device
-gtk_device_group_remove_device
-gtk_device_group_get_devices
-#endif
-#endif
-
#if IN_HEADER(__GTK_WINDOW_H__)
#if IN_FILE(__GTK_WINDOW_C__)
gtk_window_activate_default
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index ab695ef..29450ef 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -2407,29 +2407,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
_gtk_marshal_BOOLEAN__UINT,
G_TYPE_BOOLEAN, 1, G_TYPE_UINT);
- /**
- * GtkWidget::multidevice-event:
- * @widget: the object which received the signal
- * @device_group: the #GtkDeviceGroup that was updated by a
- * device event
- * @event: a #GtkMultiDeviceEvent containing event information
- * for all devices in @device_group.
- *
- * This signal is emitted right after an input device that is
- * contained in @device_group emits one event, or whenever a
- * #GdkDevice is added or removed from @device_group.
- *
- * Since: 3.0
- */
- widget_signals[MULTIDEVICE_EVENT] =
- g_signal_new (I_("multidevice-event"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- 0, NULL, NULL,
- _gtk_marshal_VOID__OBJECT_POINTER,
- G_TYPE_NONE, 2,
- GTK_TYPE_DEVICE_GROUP, G_TYPE_POINTER);
-
binding_set = gtk_binding_set_by_class (klass);
gtk_binding_entry_add_signal (binding_set, GDK_F10, GDK_SHIFT_MASK,
"popup-menu", 0);
@@ -4786,85 +4763,6 @@ event_window_is_still_viewable (GdkEvent *event)
}
}
-static void
-compose_multidevice_event (GtkWidget *widget,
- GdkDevice *device,
- GdkEventMotion *new_event)
-{
- GHashTable *multidevice_events;
- GtkMultiDeviceEventType type;
- GtkDeviceGroup *group;
- GtkMultiDeviceData *data;
- GtkMultiDeviceEvent event;
- GdkEvent *updated_event;
- GList *devices;
- gint i = 0;
-
- data = g_object_get_qdata ((GObject *) widget,
- quark_multidevice_data);
- if (!data)
- return;
-
- group = g_hash_table_lookup (data->by_dev, device);
-
- if (!group)
- return;
-
- multidevice_events = g_object_get_qdata ((GObject *) widget,
- quark_multidevice_events);
-
- if (G_UNLIKELY (!multidevice_events))
- {
- multidevice_events = g_hash_table_new_full (g_direct_hash,
- g_direct_equal,
- (GDestroyNotify) g_object_unref,
- (GDestroyNotify) gdk_event_free);
- g_object_set_qdata_full ((GObject *) widget,
- quark_multidevice_events,
- multidevice_events,
- (GDestroyNotify) g_hash_table_destroy);
- }
-
- if (!new_event)
- {
- g_hash_table_remove (multidevice_events, device);
- type = GTK_EVENT_DEVICE_REMOVED;
- updated_event = NULL;
- }
- else
- {
- if (g_hash_table_lookup (multidevice_events, device) == NULL)
- type = GTK_EVENT_DEVICE_ADDED;
- else
- type = GTK_EVENT_DEVICE_UPDATED;
-
- updated_event = gdk_event_copy ((GdkEvent *) new_event);
-
- g_hash_table_insert (multidevice_events,
- g_object_ref (device),
- updated_event);
- }
-
- devices = gtk_device_group_get_devices (group);
-
- /* Compose event */
- event.type = type;
- event.n_events = g_list_length (devices);
- event.events = g_new0 (GdkEventMotion *, event.n_events);
- event.updated_event = (GdkEventMotion *) updated_event;
- event.updated_device = device;
-
- while (devices)
- {
- event.events[i] = g_hash_table_lookup (multidevice_events, devices->data);
- devices = devices->next;
- i++;
- }
-
- g_signal_emit (widget, widget_signals[MULTIDEVICE_EVENT], 0, group, &event);
- g_free (event.events);
-}
-
static gint
gtk_widget_event_internal (GtkWidget *widget,
GdkEvent *event)
@@ -4987,15 +4885,6 @@ gtk_widget_event_internal (GtkWidget *widget,
}
if (signal_num != -1)
g_signal_emit (widget, widget_signals[signal_num], 0, event, &return_val);
-
- if (event->type == GDK_MOTION_NOTIFY &&
- (GTK_WIDGET_FLAGS (widget) & GTK_MULTIDEVICE) != 0)
- {
- GdkEventMotion *event_motion;
-
- event_motion = (GdkEventMotion *) event;
- compose_multidevice_event (widget, event_motion->device, event_motion);
- }
}
if (WIDGET_REALIZED_FOR_EVENT (widget, event))
g_signal_emit (widget, widget_signals[EVENT_AFTER], 0, event);
@@ -11632,263 +11521,6 @@ gtk_widget_set_support_multidevice (GtkWidget *widget,
gdk_window_set_support_multidevice (widget->window, support_multidevice);
}
-static GdkEventMotion *
-convert_event_to_motion (GdkEvent *event)
-{
- GdkEventMotion *new_event;
-
- new_event = (GdkEventMotion *) gdk_event_new (GDK_MOTION_NOTIFY);
-
- switch (event->type)
- {
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- case GDK_BUTTON_RELEASE:
- new_event->window = g_object_ref (event->button.window);
- new_event->send_event = TRUE;
- new_event->time = event->button.time;
- new_event->x = event->button.x;
- new_event->y = event->button.y;
-
- if (event->button.axes)
- new_event->axes = g_memdup (event->button.axes,
- sizeof (gdouble) * event->button.device->num_axes);
-
- new_event->state = 0; /* FIXME */
- new_event->is_hint = FALSE;
- new_event->device = event->button.device;
- new_event->x_root = event->button.x_root;
- new_event->y_root = event->button.y_root;
- break;
- case GDK_ENTER_NOTIFY:
- case GDK_LEAVE_NOTIFY:
- new_event->window = g_object_ref (event->crossing.window);
- new_event->send_event = TRUE;
- new_event->time = event->crossing.time;
- new_event->x = event->crossing.x;
- new_event->y = event->crossing.y;
- new_event->axes = NULL; /* FIXME: not ideal for non-mice */
- new_event->state = 0; /* FIXME */
- new_event->is_hint = FALSE;
- new_event->x_root = event->crossing.x_root;
- new_event->y_root = event->crossing.y_root;
- gdk_event_set_device ((GdkEvent *) new_event, gdk_event_get_device ((GdkEvent *) event));
- break;
- default:
- g_warning ("Event with type %d can not be transformed to GdkEventMotion", event->type);
- gdk_event_free ((GdkEvent *) new_event);
- new_event = NULL;
- }
-
- return new_event;
-}
-
-static void
-device_group_device_added (GtkDeviceGroup *group,
- GdkDevice *device,
- GtkWidget *widget)
-{
- GtkMultiDeviceData *data;
- GtkDeviceGroup *old_group;
- GdkEventMotion *new_event = NULL;
- GtkWidget *event_widget;
- GdkEvent *event;
-
- data = g_object_get_qdata (G_OBJECT (widget), quark_multidevice_data);
-
- if (G_UNLIKELY (!data))
- return;
-
- /* Remove device from old group, if any */
- old_group = g_hash_table_lookup (data->by_dev, device);
-
- if (old_group)
- gtk_device_group_remove_device (old_group, device);
-
- g_hash_table_insert (data->by_dev,
- g_object_ref (device),
- g_object_ref (group));
-
- event = gtk_get_current_event ();
-
- if (!event)
- return;
-
- if (event->type == GDK_MOTION_NOTIFY)
- new_event = (GdkEventMotion *) event;
- else
- {
- event_widget = gtk_get_event_widget (event);
-
- if (widget == event_widget)
- new_event = convert_event_to_motion (event);
-
- gdk_event_free (event);
- }
-
- if (new_event)
- {
- gtk_widget_event_internal (widget, (GdkEvent *) new_event);
- gdk_event_free ((GdkEvent *) new_event);
- }
-}
-
-static void
-device_group_device_removed (GtkDeviceGroup *group,
- GdkDevice *device,
- GtkWidget *widget)
-{
- GtkMultiDeviceData *data;
-
- data = g_object_get_qdata (G_OBJECT (widget), quark_multidevice_data);
-
- g_assert (data != NULL);
-
- compose_multidevice_event (widget, device, NULL);
- g_hash_table_remove (data->by_dev, device);
-}
-
-static void
-free_multidevice_data (GtkMultiDeviceData *data)
-{
- g_list_foreach (data->groups, (GFunc) g_object_unref, NULL);
- g_list_free (data->groups);
-
- g_hash_table_destroy (data->by_dev);
-
- g_slice_free (GtkMultiDeviceData, data);
-}
-
-/**
- * gtk_widget_create_device_group:
- * @widget: a #GtkWidget
- *
- * Creates a new #GtkDeviceGroup for @widget. devices can be added
- * later through gtk_device_group_add_device(). Note that
- * #GdkDevice<!-- -->s can only pertain to one #GtkDeviceGroup for a
- * given #GtkWidget, so adding it to a new group will remove it from
- * its previous one.
- *
- * Returns: a newly created #GtkDeviceGroup. This object is owned by
- * @widget and must be destroyed through
- * gtk_widget_remove_device_group().
- *
- * Since: 3.0
- **/
-GtkDeviceGroup *
-gtk_widget_create_device_group (GtkWidget *widget)
-{
- GtkMultiDeviceData *data;
- GtkDeviceGroup *group;
-
- g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
-
- group = g_object_new (GTK_TYPE_DEVICE_GROUP, NULL);
-
- g_signal_connect (group, "device-added",
- G_CALLBACK (device_group_device_added), widget);
- g_signal_connect (group, "device-removed",
- G_CALLBACK (device_group_device_removed), widget);
-
- data = g_object_get_qdata (G_OBJECT (widget), quark_multidevice_data);
-
- if (G_UNLIKELY (!data))
- {
- data = g_slice_new0 (GtkMultiDeviceData);
- data->by_dev = g_hash_table_new_full (g_direct_hash,
- g_direct_equal,
- (GDestroyNotify) g_object_unref,
- (GDestroyNotify) g_object_unref);
-
- g_object_set_qdata_full (G_OBJECT (widget),
- quark_multidevice_data,
- data,
- (GDestroyNotify) free_multidevice_data);
- }
-
- data->groups = g_list_prepend (data->groups, group);
-
- return group;
-}
-
-/**
- * gtk_widget_remove_device_group:
- * @widget: a #GtkWidget
- * @group: a #GtkDeviceGroup
- *
- * If @group pertains to @widget, @group will be destroyed so no further
- * #GtkWidget::multidevice-event<!-- -->s are emitted for it.
- *
- * Since: 3.0
- **/
-void
-gtk_widget_remove_device_group (GtkWidget *widget,
- GtkDeviceGroup *group)
-{
- GtkMultiDeviceData *data;
- GList *devices, *g;
-
- g_return_if_fail (GTK_IS_WIDGET (widget));
- g_return_if_fail (GTK_IS_DEVICE_GROUP (group));
-
- data = g_object_get_qdata (G_OBJECT (widget), quark_multidevice_data);
-
- if (G_UNLIKELY (!data))
- return;
-
- g = g_list_find (data->groups, group);
-
- if (G_UNLIKELY (!g))
- return;
-
- devices = gtk_device_group_get_devices (group);
-
- /* Free per-device data */
- while (devices)
- {
- g_hash_table_remove (data->by_dev, devices->data);
- devices = devices->next;
- }
-
- /* Free group */
- data->groups = g_list_remove_link (data->groups, g);
- g_object_unref (g->data);
- g_list_free_1 (g);
-}
-
-/**
- * gtk_widget_get_group_for_device:
- * @widget: a #GtkWidget
- * @device: a #GdkDevice
- *
- * Returns the #GtkDeviceGroup containing the #GdkDevice, or %NULL if
- * there is none.
- *
- * Returns: a #GtkDeviceGroup, or %NULL.
- *
- * Since: 3.0
- **/
-GtkDeviceGroup *
-gtk_widget_get_group_for_device (GtkWidget *widget,
- GdkDevice *device)
-{
- GtkMultiDeviceData *data;
- GtkDeviceGroup *group = NULL;
-
- g_return_val_if_fail (GTK_IS_WIDGET (widget), NULL);
- g_return_val_if_fail (GDK_IS_DEVICE (device), NULL);
-
- data = g_object_get_qdata (G_OBJECT (widget), quark_multidevice_data);
-
- if (!data)
- return NULL;
-
- group = g_hash_table_lookup (data->by_dev, device);
-
- return group;
-}
-
static void
_gtk_widget_set_has_focus (GtkWidget *widget,
gboolean has_focus)
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 02119f6..f42fa25 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -37,7 +37,6 @@
#include <gtk/gtkadjustment.h>
#include <gtk/gtkstyle.h>
#include <gtk/gtksettings.h>
-#include <gtk/gtkdevicegroup.h>
#include <atk/atk.h>
G_BEGIN_DECLS
@@ -205,7 +204,6 @@ typedef struct _GtkWidgetShapeInfo GtkWidgetShapeInfo;
typedef struct _GtkClipboard GtkClipboard;
typedef struct _GtkTooltip GtkTooltip;
typedef struct _GtkWindow GtkWindow;
-typedef struct _GtkMultiDeviceEvent GtkMultiDeviceEvent;
/**
@@ -537,43 +535,6 @@ struct _GtkWidgetClass
void (*_gtk_reserved7) (void);
};
-/**
- * GtkMultiDeviceEventType:
- * @GTK_EVENT_DEVICE_ADDED: A device was added to the device group.
- * @GTK_EVENT_DEVICE_REMOVED: A device was removed from the device group.
- * @GTK_EVENT_DEVICE_UPDATED: A device in the device group has updated its
- * state.
- *
- * Provides a hint about the change that initiated the
- * #GtkWidget::multidevice-event.
- */
-typedef enum
-{
- GTK_EVENT_DEVICE_ADDED,
- GTK_EVENT_DEVICE_REMOVED,
- GTK_EVENT_DEVICE_UPDATED
-} GtkMultiDeviceEventType;
-
-/**
- * GtkMultiDeviceEvent:
- * @type: the event type.
- * @n_events: number of device events contained in this #GtkMultiDeviceEvent
- * @events: an array of #GdkEventMotion structs.
- * @updated_event: latest updated event, or %NULL if @type is %GDK_EVENT_DEVICE_REMOVED.
- * @updated_device: device that triggered the event.
- *
- * The #GtkMultiDeviceEvent struct contains information about latest state of
- * multiple device pointers. These devices are contained in a #GtkDeviceGroup.
- */
-struct _GtkMultiDeviceEvent
-{
- GtkMultiDeviceEventType type;
- guint n_events;
- GdkEventMotion **events;
- GdkEventMotion *updated_event;
- GdkDevice *updated_device;
-};
-
struct _GtkWidgetAuxInfo
{
gint x;
@@ -807,11 +768,6 @@ GdkPixmap * gtk_widget_get_snapshot (GtkWidget *widget,
gboolean gtk_widget_get_support_multidevice (GtkWidget *widget);
void gtk_widget_set_support_multidevice (GtkWidget *widget,
gboolean support_multidevice);
-GtkDeviceGroup * gtk_widget_get_group_for_device (GtkWidget *widget,
- GdkDevice *device);
-GtkDeviceGroup * gtk_widget_create_device_group (GtkWidget *widget);
-void gtk_widget_remove_device_group (GtkWidget *widget,
- GtkDeviceGroup *group);
/* Accessibility support */
AtkObject* gtk_widget_get_accessible (GtkWidget *widget);
diff --git a/tests/Makefile.am b/tests/Makefile.am
index cf9c16a..526c1f6 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -1,8 +1,6 @@
## Makefile.am for gtk+/tests
include $(top_srcdir)/Makefile.decl
-SUBDIRS = multidevice
-
INCLUDES = \
-I$(top_srcdir) \
-I$(top_builddir)/gdk \
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]