[vte] Port to GtkWidget::draw
- From: Christian Persch <chpe src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vte] Port to GtkWidget::draw
- Date: Sun, 26 Sep 2010 14:24:46 +0000 (UTC)
commit 6a7f6538aaaf81e5ef755c6660dcca8311835ca1
Author: Christian Persch <chpe gnome org>
Date: Mon Sep 13 16:27:13 2010 +0200
Port to GtkWidget::draw
... to work with the rendering-cleanup-next branch of gtk.
Need to think what will happen with the update_regions.
src/vte.c | 45 +++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 43 insertions(+), 2 deletions(-)
---
diff --git a/src/vte.c b/src/vte.c
index dc1c280..2dc79f6 100644
--- a/src/vte.c
+++ b/src/vte.c
@@ -10914,8 +10914,43 @@ vte_terminal_paint(GtkWidget *widget, GdkRegion *region)
}
/* Handle an expose event by painting the exposed area. */
-static gint
-vte_terminal_expose(GtkWidget *widget, GdkEventExpose *event)
+#if GTK_CHECK_VERSION (2, 90, 8)
+
+static gboolean
+vte_terminal_draw(GtkWidget *widget,
+ cairo_t *cr,
+ int draw_width G_GNUC_UNUSED,
+ int draw_height G_GNUC_UNUSED)
+{
+ VteTerminal *terminal = VTE_TERMINAL (widget);
+ cairo_rectangle_int_t clip_rect;
+ cairo_region_t *region;
+
+ if (!gdk_cairo_get_clip_rectangle (cr, &clip_rect))
+ return FALSE;
+
+ _vte_debug_print (VTE_DEBUG_WORK, "+");
+ _vte_debug_print (VTE_DEBUG_EVENTS, "Draw (%d,%d)x(%d,%d)\n",
+ clip_rect.x, clip_rect.y,
+ clip_rect.width, clip_rect.height);
+
+ /* Sucks that we don't have the expose region available; the clip rect
+ * is potentially much much larger.
+ */
+ region = cairo_region_create_rectangle (&clip_rect);
+ vte_terminal_paint(widget, region);
+ cairo_region_destroy (region);
+
+ terminal->pvt->invalidated_all = FALSE;
+
+ return FALSE;
+}
+
+#else
+
+static gboolean
+vte_terminal_expose(GtkWidget *widget,
+ GdkEventExpose *event)
{
VteTerminal *terminal = VTE_TERMINAL (widget);
GtkAllocation allocation;
@@ -10955,6 +10990,8 @@ vte_terminal_expose(GtkWidget *widget, GdkEventExpose *event)
return FALSE;
}
+#endif /* GTK 3.0 */
+
/* Handle a scroll event. */
static gboolean
vte_terminal_scroll(GtkWidget *widget, GdkEventScroll *event)
@@ -11337,7 +11374,11 @@ vte_terminal_class_init(VteTerminalClass *klass)
gobject_class->set_property = vte_terminal_set_property;
widget_class->realize = vte_terminal_realize;
widget_class->scroll_event = vte_terminal_scroll;
+#if GTK_CHECK_VERSION (2, 90, 8)
+ widget_class->draw = vte_terminal_draw;
+#else
widget_class->expose_event = vte_terminal_expose;
+#endif
widget_class->key_press_event = vte_terminal_key_press;
widget_class->key_release_event = vte_terminal_key_release;
widget_class->button_press_event = vte_terminal_button_press;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]