summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog31
-rw-r--r--ChangeLog.pre-2-031
-rw-r--r--ChangeLog.pre-2-1031
-rw-r--r--ChangeLog.pre-2-231
-rw-r--r--ChangeLog.pre-2-431
-rw-r--r--ChangeLog.pre-2-631
-rw-r--r--ChangeLog.pre-2-831
-rw-r--r--gdk/gdkevents.c119
-rw-r--r--gdk/gdkevents.h7
-rw-r--r--gtk/gtkmain.c2
-rw-r--r--gtk/gtkwidget.c219
11 files changed, 455 insertions, 109 deletions
diff --git a/ChangeLog b/ChangeLog
index 61ecc64282..6bc8ba57ac 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,34 @@
+Thu Jun 28 23:53:31 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_hide): !GTK_OBJECT_DESTROYED() ->
+ GTK_WIDGET_REALIZE() for resize queueing.
+
+ * gtk/gtkmain.c (gtk_main_do_event): !GTK_OBJECT_DESTROYED() ->
+ GTK_WIDGET_REALIZE() for post event delivery destruction upon
+ GDK_DESTROY.
+
+ * gtk/gtkwidget.c: added GtkWidget::event-after notification signal, to
+ sompensate for former (pre-2.0) connect_after() facility.
+ (gtk_widget_send_expose):
+ (gtk_widget_event): assert the widget is realized, since event delivery
+ to non-realized widgets is essentially a bug. event handlers should
+ be able to unconditionally rely on widget->window (unless they
+ emit events on their own which can trigger widget destruction).
+ (gtk_widget_event_internal): removed old outdated GTK_OBJECT_DESTROYED()
+ logic. event delivery happens as follows:
+ a) emission of GtkWidget::event (RUN_LAST handler). returns was_handled.
+ b) if !was_handled in (a) and the widget is still realized, emit event-
+ specific signal (RUN_LAST handler). returns was_handled.
+ c) emission of GtkWidget::event-after for notification if the widget is
+ still realized (regardless of was_handled from previous stages, no
+ class handler). no return value.
+ d) was_handled gets passed on to caller, to determine further
+ propagation. if the widget got unrealized meanwhile, was_handled
+ is returned as TRUE.
+
+ * gdk/gdkevents.[hc]: added gdk_event_get_root_coords() and
+ gdk_event_get_coords().
+
Thu Jun 28 17:18:41 2001 Tim Janik <timj@gtk.org>
* configure.in (GTK_MICRO_VERSION): up version to 1.3.7, interface
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 61ecc64282..6bc8ba57ac 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,34 @@
+Thu Jun 28 23:53:31 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_hide): !GTK_OBJECT_DESTROYED() ->
+ GTK_WIDGET_REALIZE() for resize queueing.
+
+ * gtk/gtkmain.c (gtk_main_do_event): !GTK_OBJECT_DESTROYED() ->
+ GTK_WIDGET_REALIZE() for post event delivery destruction upon
+ GDK_DESTROY.
+
+ * gtk/gtkwidget.c: added GtkWidget::event-after notification signal, to
+ sompensate for former (pre-2.0) connect_after() facility.
+ (gtk_widget_send_expose):
+ (gtk_widget_event): assert the widget is realized, since event delivery
+ to non-realized widgets is essentially a bug. event handlers should
+ be able to unconditionally rely on widget->window (unless they
+ emit events on their own which can trigger widget destruction).
+ (gtk_widget_event_internal): removed old outdated GTK_OBJECT_DESTROYED()
+ logic. event delivery happens as follows:
+ a) emission of GtkWidget::event (RUN_LAST handler). returns was_handled.
+ b) if !was_handled in (a) and the widget is still realized, emit event-
+ specific signal (RUN_LAST handler). returns was_handled.
+ c) emission of GtkWidget::event-after for notification if the widget is
+ still realized (regardless of was_handled from previous stages, no
+ class handler). no return value.
+ d) was_handled gets passed on to caller, to determine further
+ propagation. if the widget got unrealized meanwhile, was_handled
+ is returned as TRUE.
+
+ * gdk/gdkevents.[hc]: added gdk_event_get_root_coords() and
+ gdk_event_get_coords().
+
Thu Jun 28 17:18:41 2001 Tim Janik <timj@gtk.org>
* configure.in (GTK_MICRO_VERSION): up version to 1.3.7, interface
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 61ecc64282..6bc8ba57ac 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,34 @@
+Thu Jun 28 23:53:31 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_hide): !GTK_OBJECT_DESTROYED() ->
+ GTK_WIDGET_REALIZE() for resize queueing.
+
+ * gtk/gtkmain.c (gtk_main_do_event): !GTK_OBJECT_DESTROYED() ->
+ GTK_WIDGET_REALIZE() for post event delivery destruction upon
+ GDK_DESTROY.
+
+ * gtk/gtkwidget.c: added GtkWidget::event-after notification signal, to
+ sompensate for former (pre-2.0) connect_after() facility.
+ (gtk_widget_send_expose):
+ (gtk_widget_event): assert the widget is realized, since event delivery
+ to non-realized widgets is essentially a bug. event handlers should
+ be able to unconditionally rely on widget->window (unless they
+ emit events on their own which can trigger widget destruction).
+ (gtk_widget_event_internal): removed old outdated GTK_OBJECT_DESTROYED()
+ logic. event delivery happens as follows:
+ a) emission of GtkWidget::event (RUN_LAST handler). returns was_handled.
+ b) if !was_handled in (a) and the widget is still realized, emit event-
+ specific signal (RUN_LAST handler). returns was_handled.
+ c) emission of GtkWidget::event-after for notification if the widget is
+ still realized (regardless of was_handled from previous stages, no
+ class handler). no return value.
+ d) was_handled gets passed on to caller, to determine further
+ propagation. if the widget got unrealized meanwhile, was_handled
+ is returned as TRUE.
+
+ * gdk/gdkevents.[hc]: added gdk_event_get_root_coords() and
+ gdk_event_get_coords().
+
Thu Jun 28 17:18:41 2001 Tim Janik <timj@gtk.org>
* configure.in (GTK_MICRO_VERSION): up version to 1.3.7, interface
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 61ecc64282..6bc8ba57ac 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,34 @@
+Thu Jun 28 23:53:31 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_hide): !GTK_OBJECT_DESTROYED() ->
+ GTK_WIDGET_REALIZE() for resize queueing.
+
+ * gtk/gtkmain.c (gtk_main_do_event): !GTK_OBJECT_DESTROYED() ->
+ GTK_WIDGET_REALIZE() for post event delivery destruction upon
+ GDK_DESTROY.
+
+ * gtk/gtkwidget.c: added GtkWidget::event-after notification signal, to
+ sompensate for former (pre-2.0) connect_after() facility.
+ (gtk_widget_send_expose):
+ (gtk_widget_event): assert the widget is realized, since event delivery
+ to non-realized widgets is essentially a bug. event handlers should
+ be able to unconditionally rely on widget->window (unless they
+ emit events on their own which can trigger widget destruction).
+ (gtk_widget_event_internal): removed old outdated GTK_OBJECT_DESTROYED()
+ logic. event delivery happens as follows:
+ a) emission of GtkWidget::event (RUN_LAST handler). returns was_handled.
+ b) if !was_handled in (a) and the widget is still realized, emit event-
+ specific signal (RUN_LAST handler). returns was_handled.
+ c) emission of GtkWidget::event-after for notification if the widget is
+ still realized (regardless of was_handled from previous stages, no
+ class handler). no return value.
+ d) was_handled gets passed on to caller, to determine further
+ propagation. if the widget got unrealized meanwhile, was_handled
+ is returned as TRUE.
+
+ * gdk/gdkevents.[hc]: added gdk_event_get_root_coords() and
+ gdk_event_get_coords().
+
Thu Jun 28 17:18:41 2001 Tim Janik <timj@gtk.org>
* configure.in (GTK_MICRO_VERSION): up version to 1.3.7, interface
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 61ecc64282..6bc8ba57ac 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,34 @@
+Thu Jun 28 23:53:31 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_hide): !GTK_OBJECT_DESTROYED() ->
+ GTK_WIDGET_REALIZE() for resize queueing.
+
+ * gtk/gtkmain.c (gtk_main_do_event): !GTK_OBJECT_DESTROYED() ->
+ GTK_WIDGET_REALIZE() for post event delivery destruction upon
+ GDK_DESTROY.
+
+ * gtk/gtkwidget.c: added GtkWidget::event-after notification signal, to
+ sompensate for former (pre-2.0) connect_after() facility.
+ (gtk_widget_send_expose):
+ (gtk_widget_event): assert the widget is realized, since event delivery
+ to non-realized widgets is essentially a bug. event handlers should
+ be able to unconditionally rely on widget->window (unless they
+ emit events on their own which can trigger widget destruction).
+ (gtk_widget_event_internal): removed old outdated GTK_OBJECT_DESTROYED()
+ logic. event delivery happens as follows:
+ a) emission of GtkWidget::event (RUN_LAST handler). returns was_handled.
+ b) if !was_handled in (a) and the widget is still realized, emit event-
+ specific signal (RUN_LAST handler). returns was_handled.
+ c) emission of GtkWidget::event-after for notification if the widget is
+ still realized (regardless of was_handled from previous stages, no
+ class handler). no return value.
+ d) was_handled gets passed on to caller, to determine further
+ propagation. if the widget got unrealized meanwhile, was_handled
+ is returned as TRUE.
+
+ * gdk/gdkevents.[hc]: added gdk_event_get_root_coords() and
+ gdk_event_get_coords().
+
Thu Jun 28 17:18:41 2001 Tim Janik <timj@gtk.org>
* configure.in (GTK_MICRO_VERSION): up version to 1.3.7, interface
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 61ecc64282..6bc8ba57ac 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,34 @@
+Thu Jun 28 23:53:31 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_hide): !GTK_OBJECT_DESTROYED() ->
+ GTK_WIDGET_REALIZE() for resize queueing.
+
+ * gtk/gtkmain.c (gtk_main_do_event): !GTK_OBJECT_DESTROYED() ->
+ GTK_WIDGET_REALIZE() for post event delivery destruction upon
+ GDK_DESTROY.
+
+ * gtk/gtkwidget.c: added GtkWidget::event-after notification signal, to
+ sompensate for former (pre-2.0) connect_after() facility.
+ (gtk_widget_send_expose):
+ (gtk_widget_event): assert the widget is realized, since event delivery
+ to non-realized widgets is essentially a bug. event handlers should
+ be able to unconditionally rely on widget->window (unless they
+ emit events on their own which can trigger widget destruction).
+ (gtk_widget_event_internal): removed old outdated GTK_OBJECT_DESTROYED()
+ logic. event delivery happens as follows:
+ a) emission of GtkWidget::event (RUN_LAST handler). returns was_handled.
+ b) if !was_handled in (a) and the widget is still realized, emit event-
+ specific signal (RUN_LAST handler). returns was_handled.
+ c) emission of GtkWidget::event-after for notification if the widget is
+ still realized (regardless of was_handled from previous stages, no
+ class handler). no return value.
+ d) was_handled gets passed on to caller, to determine further
+ propagation. if the widget got unrealized meanwhile, was_handled
+ is returned as TRUE.
+
+ * gdk/gdkevents.[hc]: added gdk_event_get_root_coords() and
+ gdk_event_get_coords().
+
Thu Jun 28 17:18:41 2001 Tim Janik <timj@gtk.org>
* configure.in (GTK_MICRO_VERSION): up version to 1.3.7, interface
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 61ecc64282..6bc8ba57ac 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,34 @@
+Thu Jun 28 23:53:31 2001 Tim Janik <timj@gtk.org>
+
+ * gtk/gtkwidget.c (gtk_widget_hide): !GTK_OBJECT_DESTROYED() ->
+ GTK_WIDGET_REALIZE() for resize queueing.
+
+ * gtk/gtkmain.c (gtk_main_do_event): !GTK_OBJECT_DESTROYED() ->
+ GTK_WIDGET_REALIZE() for post event delivery destruction upon
+ GDK_DESTROY.
+
+ * gtk/gtkwidget.c: added GtkWidget::event-after notification signal, to
+ sompensate for former (pre-2.0) connect_after() facility.
+ (gtk_widget_send_expose):
+ (gtk_widget_event): assert the widget is realized, since event delivery
+ to non-realized widgets is essentially a bug. event handlers should
+ be able to unconditionally rely on widget->window (unless they
+ emit events on their own which can trigger widget destruction).
+ (gtk_widget_event_internal): removed old outdated GTK_OBJECT_DESTROYED()
+ logic. event delivery happens as follows:
+ a) emission of GtkWidget::event (RUN_LAST handler). returns was_handled.
+ b) if !was_handled in (a) and the widget is still realized, emit event-
+ specific signal (RUN_LAST handler). returns was_handled.
+ c) emission of GtkWidget::event-after for notification if the widget is
+ still realized (regardless of was_handled from previous stages, no
+ class handler). no return value.
+ d) was_handled gets passed on to caller, to determine further
+ propagation. if the widget got unrealized meanwhile, was_handled
+ is returned as TRUE.
+
+ * gdk/gdkevents.[hc]: added gdk_event_get_root_coords() and
+ gdk_event_get_coords().
+
Thu Jun 28 17:18:41 2001 Tim Janik <timj@gtk.org>
* configure.in (GTK_MICRO_VERSION): up version to 1.3.7, interface
diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c
index 57f3da04e4..72bfbc236b 100644
--- a/gdk/gdkevents.c
+++ b/gdk/gdkevents.c
@@ -560,6 +560,125 @@ gdk_event_get_state (GdkEvent *event,
}
/**
+ * gdk_event_get_coords:
+ * @event: a #GdkEvent
+ * @x_root: location to put event window x coordinate
+ * @y_root: location to put event window y coordinate
+ *
+ * Extract the event window relative x/y coordinates from an event.
+ *
+ * Return value: %TRUE if the event delivered event window coordinates
+ **/
+gboolean
+gdk_event_get_coords (GdkEvent *event,
+ gdouble *x_win,
+ gdouble *y_win)
+{
+ gdouble x = 0, y = 0;
+ gboolean fetched = TRUE;
+
+ g_return_val_if_fail (event != NULL, FALSE);
+
+ switch (event->type)
+ {
+ case GDK_CONFIGURE:
+ x = event->configure.x;
+ y = event->configure.y;
+ break;
+ case GDK_ENTER_NOTIFY:
+ case GDK_LEAVE_NOTIFY:
+ x = event->crossing.x;
+ y = event->crossing.y;
+ break;
+ case GDK_SCROLL:
+ x = event->scroll.x;
+ y = event->scroll.y;
+ break;
+ case GDK_BUTTON_PRESS:
+ case GDK_2BUTTON_PRESS:
+ case GDK_3BUTTON_PRESS:
+ case GDK_BUTTON_RELEASE:
+ x = event->button.x;
+ y = event->button.y;
+ break;
+ case GDK_MOTION_NOTIFY:
+ x = event->motion.x;
+ y = event->motion.y;
+ break;
+ default:
+ fetched = FALSE;
+ break;
+ }
+
+ if (x_win)
+ *x_win = x;
+ if (y_win)
+ *y_win = x;
+
+ return fetched;
+}
+
+/**
+ * gdk_event_get_root_coords:
+ * @event: a #GdkEvent
+ * @x_root: location to put root window x coordinate
+ * @y_root: location to put root window y coordinate
+ *
+ * Extract the root window relative x/y coordinates from an event.
+ *
+ * Return value: %TRUE if the event delivered root window coordinates
+ **/
+gboolean
+gdk_event_get_root_coords (GdkEvent *event,
+ gdouble *x_root,
+ gdouble *y_root)
+{
+ gdouble x = 0, y = 0;
+ gboolean fetched = TRUE;
+
+ g_return_val_if_fail (event != NULL, FALSE);
+
+ switch (event->type)
+ {
+ case GDK_MOTION_NOTIFY:
+ x = event->motion.x_root;
+ y = event->motion.y_root;
+ break;
+ case GDK_BUTTON_PRESS:
+ case GDK_2BUTTON_PRESS:
+ case GDK_3BUTTON_PRESS:
+ case GDK_BUTTON_RELEASE:
+ x = event->button.x_root;
+ y = event->button.y_root;
+ break;
+ case GDK_ENTER_NOTIFY:
+ case GDK_LEAVE_NOTIFY:
+ x = event->crossing.x_root;
+ y = event->crossing.y_root;
+ break;
+ case GDK_DRAG_ENTER:
+ case GDK_DRAG_LEAVE:
+ case GDK_DRAG_MOTION:
+ case GDK_DRAG_STATUS:
+ case GDK_DROP_START:
+ case GDK_DROP_FINISHED:
+ x = event->dnd.x_root;
+ y = event->dnd.y_root;
+ break;
+ default:
+ fetched = FALSE;
+ break;
+ }
+
+ if (x_root)
+ *x_root = x;
+ if (y_root)
+ *y_root = x;
+
+ return fetched;
+}
+
+/**
* gdk_event_get_axis:
* @event: a #GdkEvent
* @axis_use: the axis use to look for
diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h
index a1eeb02ed2..763c1a377a 100644
--- a/gdk/gdkevents.h
+++ b/gdk/gdkevents.h
@@ -456,10 +456,15 @@ void gdk_event_free (GdkEvent *event);
guint32 gdk_event_get_time (GdkEvent *event);
gboolean gdk_event_get_state (GdkEvent *event,
GdkModifierType *state);
+gboolean gdk_event_get_coords (GdkEvent *event,
+ gdouble *x_win,
+ gdouble *y_win);
+gboolean gdk_event_get_root_coords (GdkEvent *event,
+ gdouble *x_root,
+ gdouble *y_root);
gboolean gdk_event_get_axis (GdkEvent *event,
GdkAxisUse axis_use,
gdouble *value);
-
void gdk_event_handler_set (GdkEventFunc func,
gpointer data,
GDestroyNotify notify);
diff --git a/gtk/gtkmain.c b/gtk/gtkmain.c
index f51d8253da..6c7bcd3a1f 100644
--- a/gtk/gtkmain.c
+++ b/gtk/gtkmain.c
@@ -871,7 +871,7 @@ gtk_main_do_event (GdkEvent *event)
{
gtk_widget_ref (event_widget);
if (!gtk_widget_event (event_widget, event) &&
- !GTK_OBJECT_DESTROYED (event_widget))
+ GTK_WIDGET_REALIZED (event_widget))
gtk_widget_destroy (event_widget);
gtk_widget_unref (event_widget);
}
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index c0826d7c27..ff9dfcfffc 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -74,6 +74,7 @@ enum {
GRAB_FOCUS,
FOCUS,
EVENT,
+ EVENT_AFTER,
BUTTON_PRESS_EVENT,
BUTTON_RELEASE_EVENT,
SCROLL_EVENT,
@@ -664,16 +665,24 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GTK_TYPE_DIRECTION_TYPE);
widget_signals[EVENT] =
g_signal_newc ("event",
- G_TYPE_FROM_CLASS(object_class),
+ G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GtkWidgetClass, event),
_gtk_boolean_handled_accumulator, NULL,
gtk_marshal_BOOLEAN__BOXED,
G_TYPE_BOOLEAN, 1,
GDK_TYPE_EVENT);
+ widget_signals[EVENT_AFTER] =
+ g_signal_newc ("event-after",
+ G_TYPE_FROM_CLASS (object_class),
+ 0,
+ 0,
+ NULL, NULL,
+ gtk_marshal_VOID__BOXED,
+ G_TYPE_NONE, 1, GDK_TYPE_EVENT);
widget_signals[BUTTON_PRESS_EVENT] =
g_signal_newc ("button_press_event",
- G_TYPE_FROM_CLASS(object_class),
+ G_TYPE_FROM_CLASS (object_class),
G_SIGNAL_RUN_LAST,
G_STRUCT_OFFSET(GtkWidgetClass, button_press_event),
_gtk_boolean_handled_accumulator, NULL,
@@ -1732,7 +1741,7 @@ gtk_widget_hide (GtkWidget *widget)
{
gtk_widget_ref (widget);
gtk_signal_emit (GTK_OBJECT (widget), widget_signals[HIDE]);
- if (!GTK_WIDGET_TOPLEVEL (widget) && !GTK_OBJECT_DESTROYED (widget))
+ if (!GTK_WIDGET_TOPLEVEL (widget) && GTK_WIDGET_REALIZED (widget))
gtk_widget_queue_resize (widget);
g_object_notify (G_OBJECT (widget), "visible");
gtk_widget_unref (widget);
@@ -2597,8 +2606,8 @@ gboolean
gtk_widget_event (GtkWidget *widget,
GdkEvent *event)
{
- g_return_val_if_fail (widget != NULL, TRUE);
g_return_val_if_fail (GTK_IS_WIDGET (widget), TRUE);
+ g_return_val_if_fail (GTK_WIDGET_REALIZED (widget), TRUE);
if (event->type == GDK_EXPOSE)
{
@@ -2634,8 +2643,8 @@ gint
gtk_widget_send_expose (GtkWidget *widget,
GdkEvent *event)
{
- g_return_val_if_fail (widget != NULL, TRUE);
g_return_val_if_fail (GTK_IS_WIDGET (widget), TRUE);
+ g_return_val_if_fail (GTK_WIDGET_REALIZED (widget), TRUE);
g_return_val_if_fail (event != NULL, TRUE);
g_return_val_if_fail (event->type == GDK_EXPOSE, TRUE);
@@ -2649,115 +2658,111 @@ static gint
gtk_widget_event_internal (GtkWidget *widget,
GdkEvent *event)
{
- gboolean return_val;
- gint signal_num;
+ gboolean return_val = FALSE;
gtk_widget_ref (widget);
- return_val = FALSE;
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[EVENT], event,
- &return_val);
- if (return_val || GTK_OBJECT_DESTROYED (widget))
- goto out;
- switch (event->type)
+ gtk_signal_emit (GTK_OBJECT (widget), widget_signals[EVENT], event, &return_val);
+ return_val |= !GTK_WIDGET_REALIZED (widget);
+ if (!return_val)
{
- case GDK_NOTHING:
- signal_num = -1;
- break;
- case GDK_BUTTON_PRESS:
- case GDK_2BUTTON_PRESS:
- case GDK_3BUTTON_PRESS:
- signal_num = BUTTON_PRESS_EVENT;
- break;
- case GDK_SCROLL:
- signal_num = SCROLL_EVENT;
- break;
- case GDK_BUTTON_RELEASE:
- signal_num = BUTTON_RELEASE_EVENT;
- break;
- case GDK_MOTION_NOTIFY:
- signal_num = MOTION_NOTIFY_EVENT;
- break;
- case GDK_DELETE:
- signal_num = DELETE_EVENT;
- break;
- case GDK_DESTROY:
- signal_num = DESTROY_EVENT;
- break;
- case GDK_KEY_PRESS:
- signal_num = KEY_PRESS_EVENT;
- break;
- case GDK_KEY_RELEASE:
- signal_num = KEY_RELEASE_EVENT;
- break;
- case GDK_ENTER_NOTIFY:
- signal_num = ENTER_NOTIFY_EVENT;
- break;
- case GDK_LEAVE_NOTIFY:
- signal_num = LEAVE_NOTIFY_EVENT;
- break;
- case GDK_FOCUS_CHANGE:
- if (event->focus_change.in)
- signal_num = FOCUS_IN_EVENT;
- else
- signal_num = FOCUS_OUT_EVENT;
- break;
- case GDK_CONFIGURE:
- signal_num = CONFIGURE_EVENT;
- break;
- case GDK_MAP:
- signal_num = MAP_EVENT;
- break;
- case GDK_UNMAP:
- signal_num = UNMAP_EVENT;
- break;
- case GDK_WINDOW_STATE:
- signal_num = WINDOW_STATE_EVENT;
- break;
- case GDK_PROPERTY_NOTIFY:
- signal_num = PROPERTY_NOTIFY_EVENT;
- break;
- case GDK_SELECTION_CLEAR:
- signal_num = SELECTION_CLEAR_EVENT;
- break;
- case GDK_SELECTION_REQUEST:
- signal_num = SELECTION_REQUEST_EVENT;
- break;
- case GDK_SELECTION_NOTIFY:
- signal_num = SELECTION_NOTIFY_EVENT;
- break;
- case GDK_PROXIMITY_IN:
- signal_num = PROXIMITY_IN_EVENT;
- break;
- case GDK_PROXIMITY_OUT:
- signal_num = PROXIMITY_OUT_EVENT;
- break;
- case GDK_NO_EXPOSE:
- signal_num = NO_EXPOSE_EVENT;
- break;
- case GDK_CLIENT_EVENT:
- signal_num = CLIENT_EVENT;
- break;
- case GDK_EXPOSE:
- if (!event->any.window) /* Why is this necessary */
- goto out;
+ gint signal_num;
- signal_num = EXPOSE_EVENT;
- break;
- case GDK_VISIBILITY_NOTIFY:
- signal_num = VISIBILITY_NOTIFY_EVENT;
- break;
- default:
- g_warning ("could not determine signal number for event: %d", event->type);
- goto out;
+ switch (event->type)
+ {
+ case GDK_NOTHING:
+ signal_num = -1;
+ break;
+ case GDK_BUTTON_PRESS:
+ case GDK_2BUTTON_PRESS:
+ case GDK_3BUTTON_PRESS:
+ signal_num = BUTTON_PRESS_EVENT;
+ break;
+ case GDK_SCROLL:
+ signal_num = SCROLL_EVENT;
+ break;
+ case GDK_BUTTON_RELEASE:
+ signal_num = BUTTON_RELEASE_EVENT;
+ break;
+ case GDK_MOTION_NOTIFY:
+ signal_num = MOTION_NOTIFY_EVENT;
+ break;
+ case GDK_DELETE:
+ signal_num = DELETE_EVENT;
+ break;
+ case GDK_DESTROY:
+ signal_num = DESTROY_EVENT;
+ break;
+ case GDK_KEY_PRESS:
+ signal_num = KEY_PRESS_EVENT;
+ break;
+ case GDK_KEY_RELEASE:
+ signal_num = KEY_RELEASE_EVENT;
+ break;
+ case GDK_ENTER_NOTIFY:
+ signal_num = ENTER_NOTIFY_EVENT;
+ break;
+ case GDK_LEAVE_NOTIFY:
+ signal_num = LEAVE_NOTIFY_EVENT;
+ break;
+ case GDK_FOCUS_CHANGE:
+ signal_num = event->focus_change.in ? FOCUS_IN_EVENT : FOCUS_OUT_EVENT;
+ break;
+ case GDK_CONFIGURE:
+ signal_num = CONFIGURE_EVENT;
+ break;
+ case GDK_MAP:
+ signal_num = MAP_EVENT;
+ break;
+ case GDK_UNMAP:
+ signal_num = UNMAP_EVENT;
+ break;
+ case GDK_WINDOW_STATE:
+ signal_num = WINDOW_STATE_EVENT;
+ break;
+ case GDK_PROPERTY_NOTIFY:
+ signal_num = PROPERTY_NOTIFY_EVENT;
+ break;
+ case GDK_SELECTION_CLEAR:
+ signal_num = SELECTION_CLEAR_EVENT;
+ break;
+ case GDK_SELECTION_REQUEST:
+ signal_num = SELECTION_REQUEST_EVENT;
+ break;
+ case GDK_SELECTION_NOTIFY:
+ signal_num = SELECTION_NOTIFY_EVENT;
+ break;
+ case GDK_PROXIMITY_IN:
+ signal_num = PROXIMITY_IN_EVENT;
+ break;
+ case GDK_PROXIMITY_OUT:
+ signal_num = PROXIMITY_OUT_EVENT;
+ break;
+ case GDK_NO_EXPOSE:
+ signal_num = NO_EXPOSE_EVENT;
+ break;
+ case GDK_CLIENT_EVENT:
+ signal_num = CLIENT_EVENT;
+ break;
+ case GDK_EXPOSE:
+ signal_num = EXPOSE_EVENT;
+ break;
+ case GDK_VISIBILITY_NOTIFY:
+ signal_num = VISIBILITY_NOTIFY_EVENT;
+ break;
+ default:
+ g_warning ("gtk_widget_event(): unhandled event type: %d", event->type);
+ signal_num = -1;
+ break;
+ }
+ if (signal_num != -1)
+ gtk_signal_emit (GTK_OBJECT (widget), widget_signals[signal_num], event, &return_val);
}
-
- if (signal_num != -1)
- gtk_signal_emit (GTK_OBJECT (widget), widget_signals[signal_num], event, &return_val);
-
- return_val |= GTK_OBJECT_DESTROYED (widget);
+ if (GTK_WIDGET_REALIZED (widget))
+ gtk_signal_emit (GTK_OBJECT (widget), widget_signals[EVENT_AFTER], event);
+ else
+ return_val = TRUE;
- out:
gtk_widget_unref (widget);
return return_val;