[gtk+/wip/actor: 23/25] xxx: widgetactor
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/actor: 23/25] xxx: widgetactor
- Date: Fri, 21 Dec 2012 22:53:48 +0000 (UTC)
commit 6c79d493206bb6118c48f2cc0e761fe2d4bf5bd2
Author: Benjamin Otte <otte redhat com>
Date: Thu Dec 20 15:01:59 2012 +0100
xxx: widgetactor
gtk/actors/gtkwidgetactor.c | 37 ++++++++++++++++++++++++++++++++++++-
1 files changed, 36 insertions(+), 1 deletions(-)
---
diff --git a/gtk/actors/gtkwidgetactor.c b/gtk/actors/gtkwidgetactor.c
index b1c5730..fcf6ca4 100644
--- a/gtk/actors/gtkwidgetactor.c
+++ b/gtk/actors/gtkwidgetactor.c
@@ -23,6 +23,8 @@
#include "gtkwidgetprivate.h"
+#include <math.h>
+
struct _GtkWidgetActorPrivate {
gpointer dummy;
};
@@ -30,6 +32,38 @@ struct _GtkWidgetActorPrivate {
G_DEFINE_TYPE (GtkWidgetActor, _gtk_widget_actor, GTK_TYPE_CSS_BOX)
static void
+gtk_widget_actor_real_queue_redraw (GtkActor *actor,
+ const cairo_rectangle_t *box)
+{
+ GtkWidget *widget;
+ int x, y, w, h;
+
+ if (_gtk_actor_get_parent (actor))
+ {
+ GTK_ACTOR_CLASS (_gtk_widget_actor_parent_class)->queue_redraw (actor, box);
+ return;
+ }
+
+ widget = _gtk_actor_get_widget (actor);
+ x = floor (box->x);
+ y = floor (box->y);
+ w = ceil (box->x + box->width) - x;
+ h = ceil (box->y + box->height) - y;
+
+ if (!gtk_widget_get_has_window (widget))
+ {
+ GtkAllocation allocation;
+
+ gtk_widget_get_allocation (widget, &allocation);
+
+ x += allocation.x;
+ y += allocation.y;
+ }
+
+ gtk_widget_queue_draw_area (widget, x, y, w, h);
+}
+
+static void
gtk_widget_actor_real_style_updated (GtkCssActor *actor,
const GtkBitmask *changed)
{
@@ -41,10 +75,10 @@ gtk_widget_actor_real_style_updated (GtkCssActor *actor,
static void
_gtk_widget_actor_class_init (GtkWidgetActorClass *klass)
{
+ GtkActorClass *actor_class = GTK_ACTOR_CLASS (klass);
GtkCssActorClass *css_actor_class = GTK_CSS_ACTOR_CLASS (klass);
#if 0
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkActorClass *actor_class = GTK_ACTOR_CLASS (klass);
actor_class->parent_set = gtk_widget_actor_real_parent_set;
actor_class->show = gtk_css_box_real_show;
@@ -56,6 +90,7 @@ _gtk_widget_actor_class_init (GtkWidgetActorClass *klass)
actor_class->get_preferred_size = gtk_css_box_real_get_preferred_size;
actor_class->allocate = gtk_css_box_real_allocate;
#endif
+ actor_class->queue_redraw = gtk_widget_actor_real_queue_redraw;
css_actor_class->style_updated = gtk_widget_actor_real_style_updated;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]