[gtk+/rendering-cleanup-next: 148/155] API: widget: Remove the expose event
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/rendering-cleanup-next: 148/155] API: widget: Remove the expose event
- Date: Wed, 15 Sep 2010 03:09:21 +0000 (UTC)
commit 6185e3a3ed62ab6d9e57522add0c4620fcf912f5
Author: Benjamin Otte <otte redhat com>
Date: Sat Sep 11 00:42:51 2010 +0200
API: widget: Remove the expose event
gtk_widget_send_expose() now calls the draw function.
gtk/gtkwidget.c | 132 +++++++++++++++++++------------------------------------
gtk/gtkwidget.h | 2 -
2 files changed, 46 insertions(+), 88 deletions(-)
---
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 6634266..107403c 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -342,8 +342,6 @@ static gboolean gtk_widget_real_show_help (GtkWidget *widget,
static void gtk_widget_dispatch_child_properties_changed (GtkWidget *object,
guint n_pspecs,
GParamSpec **pspecs);
-static gboolean gtk_widget_real_expose_event (GtkWidget *widget,
- GdkEventExpose *event);
static gboolean gtk_widget_real_key_press_event (GtkWidget *widget,
GdkEventKey *event);
static gboolean gtk_widget_real_key_release_event (GtkWidget *widget,
@@ -629,7 +627,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
klass->motion_notify_event = NULL;
klass->delete_event = NULL;
klass->destroy_event = NULL;
- klass->expose_event = gtk_widget_real_expose_event;
klass->key_press_event = gtk_widget_real_key_press_event;
klass->key_release_event = gtk_widget_real_key_release_event;
klass->enter_notify_event = NULL;
@@ -1614,33 +1611,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
/**
- * GtkWidget::expose-event:
- * @widget: the object which received the signal.
- * @event: (type Gdk.EventExpose): the #GdkEventExpose which triggered
- * this signal.
- *
- * The ::expose-event signal is emitted when an area of a previously
- * obscured #GdkWindow is made visible and needs to be redrawn.
- * #GTK_NO_WINDOW widgets will get a synthesized event from their parent
- * widget.
- *
- * To receive this signal, the #GdkWindow associated to the widget needs
- * to enable the #GDK_EXPOSURE_MASK mask.
- *
- * Returns: %TRUE to stop other handlers from being invoked for the event.
- * %FALSE to propagate the event further.
- */
- widget_signals[EXPOSE_EVENT] =
- g_signal_new (I_("expose-event"),
- G_TYPE_FROM_CLASS (gobject_class),
- G_SIGNAL_RUN_LAST,
- G_STRUCT_OFFSET (GtkWidgetClass, expose_event),
- _gtk_boolean_handled_accumulator, NULL,
- _gtk_marshal_BOOLEAN__BOXED,
- G_TYPE_BOOLEAN, 1,
- GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE);
-
- /**
* GtkWidget::key-press-event:
* @widget: the object which received the signal
* @event: (type Gdk.EventKey): the #GdkEventKey which triggered this signal.
@@ -5146,59 +5116,6 @@ _gtk_widget_draw_internal (GtkWidget *widget,
}
static gboolean
-gtk_widget_real_expose_event (GtkWidget *widget,
- GdkEventExpose *expose)
-{
- GdkWindow *window, *w;
- gboolean result = FALSE;
- cairo_t *cr;
- int x, y;
-
- if (!gtk_widget_is_drawable (widget))
- return FALSE;
-
- cr = gdk_cairo_create (expose->window);
- gtk_cairo_set_event (cr, expose);
-
- gdk_cairo_region (cr, expose->region);
- cairo_clip (cr);
-
- if (!gtk_widget_get_has_window (widget))
- {
- x = widget->priv->allocation.x;
- y = widget->priv->allocation.y;
- }
- else
- {
- x = 0;
- y = 0;
- }
-
- /* translate cairo context properly */
- window = gtk_widget_get_window (widget);
-
- for (w = expose->window; w && w != window; w = gdk_window_get_parent (w))
- {
- int wx, wy;
- gdk_window_get_position (w, &wx, &wy);
- x -= wx;
- y -= wy;
- }
-
- if (w)
- cairo_translate (cr, x, y);
-
- _gtk_widget_draw_internal (widget, cr, w != NULL);
-
- /* unset here, so if someone keeps a reference to cr we
- * don't leak the window. */
- gtk_cairo_set_event (cr, NULL);
- cairo_destroy (cr);
-
- return result;
-}
-
-static gboolean
gtk_widget_real_key_press_event (GtkWidget *widget,
GdkEventKey *event)
{
@@ -5292,12 +5209,55 @@ gint
gtk_widget_send_expose (GtkWidget *widget,
GdkEvent *event)
{
+ GdkWindow *window, *w;
+ gboolean result = FALSE;
+ cairo_t *cr;
+ int x, y;
+
g_return_val_if_fail (GTK_IS_WIDGET (widget), TRUE);
g_return_val_if_fail (gtk_widget_get_realized (widget), TRUE);
g_return_val_if_fail (event != NULL, TRUE);
g_return_val_if_fail (event->type == GDK_EXPOSE, TRUE);
- return gtk_widget_event_internal (widget, event);
+ cr = gdk_cairo_create (event->expose.window);
+ gtk_cairo_set_event (cr, &event->expose);
+
+ gdk_cairo_region (cr, event->expose.region);
+ cairo_clip (cr);
+
+ if (!gtk_widget_get_has_window (widget))
+ {
+ x = widget->priv->allocation.x;
+ y = widget->priv->allocation.y;
+ }
+ else
+ {
+ x = 0;
+ y = 0;
+ }
+
+ /* translate cairo context properly */
+ window = gtk_widget_get_window (widget);
+
+ for (w = event->expose.window; w && w != window; w = gdk_window_get_parent (w))
+ {
+ int wx, wy;
+ gdk_window_get_position (w, &wx, &wy);
+ x -= wx;
+ y -= wy;
+ }
+
+ if (w)
+ cairo_translate (cr, x, y);
+
+ _gtk_widget_draw_internal (widget, cr, w != NULL);
+
+ /* unset here, so if someone keeps a reference to cr we
+ * don't leak the window. */
+ gtk_cairo_set_event (cr, NULL);
+ cairo_destroy (cr);
+
+ return result;
}
static gboolean
@@ -6673,7 +6633,7 @@ gtk_widget_set_mapped (GtkWidget *widget,
* @app_paintable: %TRUE if the application will paint on the widget
*
* Sets whether the application intends to draw on the widget in
- * an #GtkWidget::expose-event handler.
+ * an #GtkWidget::draw handler.
*
* This is a hint to the widget and does not affect the behavior of
* the GTK+ core; many widgets ignore this flag entirely. For widgets
@@ -6711,7 +6671,7 @@ gtk_widget_set_app_paintable (GtkWidget *widget,
* @widget: a #GtkWidget
*
* Determines whether the application intends to draw on the widget in
- * an #GtkWidget::expose-event handler.
+ * an #GtkWidget::draw handler.
*
* See gtk_widget_set_app_paintable()
*
diff --git a/gtk/gtkwidget.h b/gtk/gtkwidget.h
index 9520a23..7cf6d6b 100644
--- a/gtk/gtkwidget.h
+++ b/gtk/gtkwidget.h
@@ -358,8 +358,6 @@ struct _GtkWidgetClass
GdkEventAny *event);
gboolean (* destroy_event) (GtkWidget *widget,
GdkEventAny *event);
- gboolean (* expose_event) (GtkWidget *widget,
- GdkEventExpose *event);
gboolean (* key_press_event) (GtkWidget *widget,
GdkEventKey *event);
gboolean (* key_release_event) (GtkWidget *widget,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]