[gtk+/rendering-cleanup-next: 17/154] entry: Port to draw signal



commit a2168b3784a0296cd6d081f28f6a0aac83263be3
Author: Benjamin Otte <otte redhat com>
Date:   Fri Sep 3 17:53:08 2010 +0200

    entry: Port to draw signal

 gtk/gtkentry.c |   27 ++++++++++-----------------
 1 files changed, 10 insertions(+), 17 deletions(-)
---
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 0aef90e..ddb35de 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -268,8 +268,8 @@ static void   gtk_entry_draw_frame           (GtkWidget        *widget,
 static void   gtk_entry_draw_progress        (GtkWidget        *widget,
                                               cairo_t          *cr,
                                               GdkWindow        *window);
-static gint   gtk_entry_expose               (GtkWidget        *widget,
-					      GdkEventExpose   *event);
+static gint   gtk_entry_draw                 (GtkWidget        *widget,
+                                              cairo_t          *cr);
 static gint   gtk_entry_button_press         (GtkWidget        *widget,
 					      GdkEventButton   *event);
 static gint   gtk_entry_button_release       (GtkWidget        *widget,
@@ -582,7 +582,7 @@ gtk_entry_class_init (GtkEntryClass *class)
   widget_class->unrealize = gtk_entry_unrealize;
   widget_class->size_request = gtk_entry_size_request;
   widget_class->size_allocate = gtk_entry_size_allocate;
-  widget_class->expose_event = gtk_entry_expose;
+  widget_class->draw = gtk_entry_draw;
   widget_class->enter_notify_event = gtk_entry_enter_notify;
   widget_class->leave_notify_event = gtk_entry_leave_notify;
   widget_class->button_press_event = gtk_entry_button_press;
@@ -3453,29 +3453,24 @@ gtk_entry_draw_progress (GtkWidget      *widget,
 }
 
 static gint
-gtk_entry_expose (GtkWidget      *widget,
-		  GdkEventExpose *event)
+gtk_entry_draw (GtkWidget *widget,
+		cairo_t   *cr)
 {
   GtkEntry *entry = GTK_ENTRY (widget);
   GtkStyle *style;
   GtkStateType state;
   GtkEntryPrivate *priv = GTK_ENTRY_GET_PRIVATE (entry);
-  cairo_t *cr;
   int i;
 
-  cr = gdk_cairo_create (event->window);
-  gdk_cairo_region (cr, event->region);
-  cairo_clip (cr);
-
   style = gtk_widget_get_style (widget);
 
   state = gtk_widget_has_focus (widget) ?
     GTK_STATE_ACTIVE : gtk_widget_get_state (widget);
 
-  if (gtk_widget_get_window (widget) == event->window)
+  if (gtk_cairo_should_draw_window (cr, gtk_widget_get_window (widget)))
     gtk_entry_draw_frame (widget, cr);
 
-  if (entry->text_area == event->window)
+  if (gtk_cairo_should_draw_window (cr, entry->text_area))
     {
       gint width, height;
 
@@ -3504,7 +3499,7 @@ gtk_entry_expose (GtkWidget      *widget,
     {
       EntryIconInfo *icon_info = priv->icons[i];
 
-      if (icon_info != NULL && event->window == icon_info->window)
+      if (icon_info != NULL && gtk_cairo_should_draw_window (cr, icon_info->window))
         {
           gint width, height;
 
@@ -3522,8 +3517,6 @@ gtk_entry_expose (GtkWidget      *widget,
         }
     }
 
-  cairo_destroy (cr);
-
   return FALSE;
 }
 
@@ -6754,7 +6747,7 @@ gtk_entry_set_buffer (GtkEntry       *entry,
  * @entry: a #GtkEntry
  *
  * Returns the #GdkWindow which contains the text. This function is
- * useful when drawing something to the entry in an expose-event
+ * useful when drawing something to the entry in a draw
  * callback because it enables the callback to distinguish between
  * the text window and entry's icon windows.
  *
@@ -8183,7 +8176,7 @@ gtk_entry_get_current_icon_drag_source (GtkEntry *entry)
  *
  * Returns the #GdkWindow which contains the entry's icon at
  * @icon_pos. This function is useful when drawing something to the
- * entry in an expose-event callback because it enables the callback
+ * entry in a draw callback because it enables the callback
  * to distinguish between the text window and entry's icon windows.
  *
  * See also gtk_entry_get_text_window().



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