[gtk+] entry: Set a clip



commit 863a9cef98a83ce665e28137768575a0100a3498
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Sep 5 23:29:59 2017 -0400

    entry: Set a clip
    
    Now that GtkEntry is using a text node, we were spilling
    the contents out to the side when the entry is scrolling.
    Avoid that by setting a clip.

 gtk/gtkentry.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index e5237c7..e2f22dc 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -3280,10 +3280,17 @@ gtk_entry_snapshot (GtkWidget   *widget,
   GtkEntry *entry = GTK_ENTRY (widget);
   GtkEntryPrivate *priv = gtk_entry_get_instance_private (entry);
   int width, height;
+  graphene_rect_t bounds;
   int i;
 
   gtk_widget_get_content_size (widget, &width, &height);
 
+  graphene_rect_init (&bounds,
+                      0, 0,
+                      width, height);
+
+  gtk_snapshot_push_clip (snapshot, &bounds, "Entry Clip");
+
   /* Draw progress */
   if (priv->progress_widget && gtk_widget_get_visible (priv->progress_widget))
     gtk_widget_snapshot_child (widget, priv->progress_widget, snapshot);
@@ -3311,6 +3318,8 @@ gtk_entry_snapshot (GtkWidget   *widget,
     }
 
   gtk_entry_draw_undershoot (entry, snapshot);
+
+  gtk_snapshot_pop (snapshot);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]