Commit 8851d75b authored by Matthias Clasen's avatar Matthias Clasen Committed by Emmanuele Bassi

GtkListBox: Convert to indirect rendering

Note that there is a problem with the pixel cache that causes
listboxes to come out black when in a scrolled window.
parent ed8db31f
......@@ -209,8 +209,9 @@ static GSequenceIter* gtk_list_box_get_previous_visible (GtkListBo
GSequenceIter *iter);
static GtkListBoxRow *gtk_list_box_get_first_focusable (GtkListBox *box);
static GtkListBoxRow *gtk_list_box_get_last_focusable (GtkListBox *box);
static gboolean gtk_list_box_draw (GtkWidget *widget,
cairo_t *cr);
static GskRenderNode * gtk_list_box_get_render_node (GtkWidget *widget,
GskRenderer *renderer);
static void gtk_list_box_realize (GtkWidget *widget);
static void gtk_list_box_add (GtkContainer *container,
GtkWidget *widget);
......@@ -301,13 +302,6 @@ static void gtk_list_box_allocate (GtkCssGadget *gadget,
int baseline,
GtkAllocation *out_clip,
gpointer data);
static gboolean gtk_list_box_render (GtkCssGadget *gadget,
cairo_t *cr,
int x,
int y,
int width,
int height,
gpointer data);
......@@ -426,7 +420,7 @@ gtk_list_box_class_init (GtkListBoxClass *klass)
widget_class->motion_notify_event = gtk_list_box_motion_notify_event;
widget_class->show = gtk_list_box_show;
widget_class->focus = gtk_list_box_focus;
widget_class->draw = gtk_list_box_draw;
widget_class->get_render_node = gtk_list_box_get_render_node;
widget_class->realize = gtk_list_box_realize;
widget_class->compute_expand = gtk_list_box_compute_expand;
widget_class->get_request_mode = gtk_list_box_get_request_mode;
......@@ -663,7 +657,7 @@ gtk_list_box_init (GtkListBox *box)
GTK_WIDGET (box),
gtk_list_box_measure,
gtk_list_box_allocate,
gtk_list_box_render,
NULL,
NULL,
NULL);
......@@ -2127,29 +2121,22 @@ gtk_list_box_focus (GtkWidget *widget,
return FALSE;
}
static gboolean
gtk_list_box_draw (GtkWidget *widget,
cairo_t *cr)
static GskRenderNode *
gtk_list_box_get_render_node (GtkWidget *widget,
GskRenderer *renderer)
{
gtk_css_gadget_draw (BOX_PRIV (widget)->gadget, cr);
return FALSE;
}
GtkListBox *box = GTK_LIST_BOX (widget);
GtkListBoxPrivate *priv = BOX_PRIV (box);
GskRenderNode *res = gtk_css_gadget_get_render_node (priv->gadget,
renderer,
FALSE);
static gboolean
gtk_list_box_render (GtkCssGadget *gadget,
cairo_t *cr,
int x,
int y,
int width,
int height,
gpointer data)
{
GtkWidget *widget = gtk_css_gadget_get_owner (gadget);
if (res == NULL)
return NULL;
GTK_WIDGET_CLASS (gtk_list_box_parent_class)->draw (widget, cr);
gtk_container_propagate_render_node (GTK_CONTAINER (widget), renderer, res);
return FALSE;
return res;
}
static void
......@@ -3262,31 +3249,21 @@ gtk_list_box_row_hide (GtkWidget *widget)
gtk_list_box_row_visibility_changed (box, row);
}
static gboolean
gtk_list_box_row_draw (GtkWidget *widget,
cairo_t *cr)
{
gtk_css_gadget_draw (ROW_PRIV (GTK_LIST_BOX_ROW (widget))->gadget, cr);
return GDK_EVENT_PROPAGATE;
}
static gboolean
gtk_list_box_row_render (GtkCssGadget *gadget,
cairo_t *cr,
int x,
int y,
int width,
int height,
gpointer data)
static GskRenderNode *
gtk_list_box_row_get_render_node (GtkWidget *widget,
GskRenderer *renderer)
{
GtkWidget *widget;
GtkListBoxRowPrivate *priv = ROW_PRIV (widget);
GskRenderNode *res = gtk_css_gadget_get_render_node (priv->gadget,
renderer,
gtk_widget_has_visible_focus (widget));
widget = gtk_css_gadget_get_owner (gadget);
if (res == NULL)
return NULL;
GTK_WIDGET_CLASS (gtk_list_box_row_parent_class)->draw (widget, cr);
gtk_container_propagate_render_node (GTK_CONTAINER (widget), renderer, res);
return gtk_widget_has_visible_focus (widget);
return res;
}
static void
......@@ -3750,7 +3727,7 @@ gtk_list_box_row_class_init (GtkListBoxRowClass *klass)
widget_class->show = gtk_list_box_row_show;
widget_class->hide = gtk_list_box_row_hide;
widget_class->draw = gtk_list_box_row_draw;
widget_class->get_render_node = gtk_list_box_row_get_render_node;
widget_class->get_preferred_height = gtk_list_box_row_get_preferred_height;
widget_class->get_preferred_height_for_width = gtk_list_box_row_get_preferred_height_for_width;
widget_class->get_preferred_width = gtk_list_box_row_get_preferred_width;
......@@ -3819,7 +3796,7 @@ gtk_list_box_row_init (GtkListBoxRow *row)
GTK_WIDGET (row),
gtk_list_box_row_measure,
gtk_list_box_row_allocate,
gtk_list_box_row_render,
NULL,
NULL,
NULL);
gtk_css_gadget_add_class (ROW_PRIV (row)->gadget, "activatable");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment