[gtk+] Convert GtkEntry to indirect rendering
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] Convert GtkEntry to indirect rendering
- Date: Tue, 1 Nov 2016 18:40:42 +0000 (UTC)
commit 3656c9f94c0401376d3dc0a3963312ef986cb021
Author: Matthias Clasen <mclasen redhat com>
Date: Thu Oct 27 20:46:08 2016 -0400
Convert GtkEntry to indirect rendering
Warning! This unveils some positioning issue with the secondary icon.
gtk/gtkentry.c | 53 +++++++++++++++++++++++++++++++----------------------
1 files changed, 31 insertions(+), 22 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 2f91597..dd5b93c 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -414,8 +414,8 @@ static void gtk_entry_map (GtkWidget *widget);
static void gtk_entry_unmap (GtkWidget *widget);
static void gtk_entry_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
-static gint gtk_entry_draw (GtkWidget *widget,
- cairo_t *cr);
+static GskRenderNode *gtk_entry_get_render_node (GtkWidget *widget,
+ GskRenderer *renderer);
static gboolean gtk_entry_event (GtkWidget *widget,
GdkEvent *event);
static gint gtk_entry_enter_notify (GtkWidget *widget,
@@ -761,7 +761,7 @@ gtk_entry_class_init (GtkEntryClass *class)
widget_class->unrealize = gtk_entry_unrealize;
widget_class->measure = gtk_entry_measure_;
widget_class->size_allocate = gtk_entry_size_allocate;
- widget_class->draw = gtk_entry_draw;
+ widget_class->get_render_node = gtk_entry_get_render_node;
widget_class->enter_notify_event = gtk_entry_enter_notify;
widget_class->leave_notify_event = gtk_entry_leave_notify;
widget_class->event = gtk_entry_event;
@@ -3591,13 +3591,36 @@ should_prelight (GtkEntry *entry,
return TRUE;
}
-static gboolean
-gtk_entry_draw (GtkWidget *widget,
- cairo_t *cr)
+static GskRenderNode *
+gtk_entry_get_render_node (GtkWidget *widget,
+ GskRenderer *renderer)
{
- gtk_css_gadget_draw (GTK_ENTRY (widget)->priv->gadget, cr);
+ GtkEntryPrivate *priv = GTK_ENTRY (widget)->priv;
+ GskRenderNode *res, *node;
+ int i;
- return GDK_EVENT_PROPAGATE;
+ res = gtk_css_gadget_get_render_node (priv->gadget, renderer, FALSE);
+
+ for (i = 0; i < MAX_ICONS; i++)
+ {
+ EntryIconInfo *icon_info = priv->icons[i];
+
+ if (icon_info == NULL)
+ continue;
+
+ node = gtk_css_gadget_get_render_node (icon_info->gadget, renderer, FALSE);
+ gsk_render_node_append_child (res, node);
+ gsk_render_node_unref (node);
+ }
+
+ if (priv->progress_gadget && gtk_css_gadget_get_visible (priv->progress_gadget))
+ {
+ node = gtk_css_gadget_get_render_node (priv->progress_gadget, renderer, FALSE);
+ gsk_render_node_append_child (res, node);
+ gsk_render_node_unref (node);
+ }
+
+ return res;
}
#define UNDERSHOOT_SIZE 20
@@ -3673,16 +3696,11 @@ gtk_entry_render (GtkCssGadget *gadget,
GtkWidget *widget;
GtkEntry *entry;
GtkEntryPrivate *priv;
- int i;
widget = gtk_css_gadget_get_owner (gadget);
entry = GTK_ENTRY (widget);
priv = entry->priv;
- /* Draw progress */
- if (priv->progress_gadget && gtk_css_gadget_get_visible (priv->progress_gadget))
- gtk_css_gadget_draw (priv->progress_gadget, cr);
-
/* Draw text and cursor */
cairo_save (cr);
@@ -3699,15 +3717,6 @@ gtk_entry_render (GtkCssGadget *gadget,
cairo_restore (cr);
- /* Draw icons */
- for (i = 0; i < MAX_ICONS; i++)
- {
- EntryIconInfo *icon_info = priv->icons[i];
-
- if (icon_info != NULL)
- gtk_css_gadget_draw (icon_info->gadget, cr);
- }
-
gtk_entry_draw_undershoot (entry, cr);
return FALSE;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]