[gimp/gtk3-port: 55/228] app: port the tag entry to GTK+ 3.0



commit 5d1ed269d824ca226f23be19866b26c029aa2e1d
Author: Michael Natterer <mitch gimp org>
Date:   Tue Oct 19 20:05:17 2010 +0200

    app: port the tag entry to GTK+ 3.0

 app/widgets/gimptagentry.c |   25 +++++++++++++------------
 1 files changed, 13 insertions(+), 12 deletions(-)
---
diff --git a/app/widgets/gimptagentry.c b/app/widgets/gimptagentry.c
index 2e9bc5b..3aa5a50 100644
--- a/app/widgets/gimptagentry.c
+++ b/app/widgets/gimptagentry.c
@@ -113,8 +113,8 @@ static gboolean gimp_tag_entry_auto_complete             (GimpTagEntry     *entr
 
 static void     gimp_tag_entry_toggle_desc               (GimpTagEntry     *widget,
                                                           gboolean          show);
-static gboolean gimp_tag_entry_expose                    (GtkWidget        *widget,
-                                                          GdkEventExpose   *event);
+static gboolean gimp_tag_entry_draw                      (GtkWidget        *widget,
+                                                          cairo_t          *cr);
 static void     gimp_tag_entry_commit_region             (GString          *tags,
                                                           GString          *mask);
 static void     gimp_tag_entry_commit_tags               (GimpTagEntry     *entry);
@@ -210,8 +210,8 @@ gimp_tag_entry_init (GimpTagEntry *entry)
   g_signal_connect (entry, "focus-out-event",
                     G_CALLBACK (gimp_tag_entry_focus_out),
                     NULL);
-  g_signal_connect_after (entry, "expose-event",
-                          G_CALLBACK (gimp_tag_entry_expose),
+  g_signal_connect_after (entry, "draw",
+                          G_CALLBACK (gimp_tag_entry_draw),
                           NULL);
 }
 
@@ -1268,10 +1268,11 @@ gimp_tag_entry_toggle_desc (GimpTagEntry *tag_entry,
 }
 
 static gboolean
-gimp_tag_entry_expose (GtkWidget      *widget,
-                       GdkEventExpose *event)
+gimp_tag_entry_draw (GtkWidget *widget,
+                     cairo_t   *cr)
 {
   GimpTagEntry   *tag_entry = GIMP_TAG_ENTRY (widget);
+  GdkWindow      *window;
   PangoLayout    *layout;
   PangoAttrList  *attr_list;
   PangoAttribute *attribute;
@@ -1282,8 +1283,9 @@ gimp_tag_entry_expose (GtkWidget      *widget,
   gint            offset;
   const char     *display_text;
 
-  /* eeeeeek */
-  if (event->window != gtk_entry_get_text_window (GTK_ENTRY (widget)))
+  window = gtk_entry_get_text_window (GTK_ENTRY (widget));
+
+  if (! gtk_cairo_should_draw_window (cr, window))
     return FALSE;
 
   if (! GIMP_TAG_ENTRY (widget)->description_shown)
@@ -1307,17 +1309,16 @@ gimp_tag_entry_expose (GtkWidget      *widget,
   pango_layout_set_attributes (layout, attr_list);
   pango_attr_list_unref (attr_list);
 
-  window_width  = gdk_window_get_width (event->window);
-  window_height = gdk_window_get_height (event->window);
+  window_width  = gdk_window_get_width  (window);
+  window_height = gdk_window_get_height (window);
   pango_layout_get_size (layout,
                          &layout_width, &layout_height);
   offset = (window_height - PANGO_PIXELS (layout_height)) / 2;
 
   gtk_paint_layout (gtk_widget_get_style (widget),
-                    event->window,
+                    cr,
                     GTK_STATE_INSENSITIVE,
                     TRUE,
-                    &event->area,
                     widget,
                     NULL,
                     (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL) ?



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