[gimp/gtk3-port: 43/233] app: port to GtkWidget::draw()



commit f2ccc65367faee97fd61f9475fb5efa0a99a6eb1
Author: Michael Natterer <mitch gimp org>
Date:   Tue Oct 19 17:48:30 2010 +0200

    app: port to GtkWidget::draw()

 app/dialogs/about-dialog.c |   25 +++++++++----------------
 1 files changed, 9 insertions(+), 16 deletions(-)
---
diff --git a/app/dialogs/about-dialog.c b/app/dialogs/about-dialog.c
index 7fbf03c..8c4c6b8 100644
--- a/app/dialogs/about-dialog.c
+++ b/app/dialogs/about-dialog.c
@@ -78,8 +78,8 @@ static void        about_dialog_unmap         (GtkWidget       *widget,
 static GdkPixbuf * about_dialog_load_logo     (void);
 static void        about_dialog_add_animation (GtkWidget       *vbox,
                                                GimpAboutDialog *dialog);
-static gboolean    about_dialog_anim_expose   (GtkWidget       *widget,
-                                               GdkEventExpose  *event,
+static gboolean    about_dialog_anim_draw     (GtkWidget       *widget,
+                                               cairo_t         *cr,
                                                GimpAboutDialog *dialog);
 static void        about_dialog_reshuffle     (GimpAboutDialog *dialog);
 static gboolean    about_dialog_timer         (gpointer         data);
@@ -248,8 +248,8 @@ about_dialog_add_animation (GtkWidget       *vbox,
 
   gtk_widget_set_size_request (dialog->anim_area, -1, 2 * height);
 
-  g_signal_connect (dialog->anim_area, "expose-event",
-                    G_CALLBACK (about_dialog_anim_expose),
+  g_signal_connect (dialog->anim_area, "draw",
+                    G_CALLBACK (about_dialog_anim_draw),
                     dialog);
 }
 
@@ -280,12 +280,11 @@ about_dialog_reshuffle (GimpAboutDialog *dialog)
 }
 
 static gboolean
-about_dialog_anim_expose (GtkWidget       *widget,
-                          GdkEventExpose  *event,
-                          GimpAboutDialog *dialog)
+about_dialog_anim_draw (GtkWidget       *widget,
+                        cairo_t         *cr,
+                        GimpAboutDialog *dialog)
 {
   GtkStyle      *style = gtk_widget_get_style (widget);
-  cairo_t       *cr;
   GtkAllocation  allocation;
   gint           x, y;
   gint           width, height;
@@ -293,8 +292,6 @@ about_dialog_anim_expose (GtkWidget       *widget,
   if (! dialog->visible)
     return FALSE;
 
-  cr = gdk_cairo_create (event->window);
-
   gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]);
 
   gtk_widget_get_allocation (widget, &allocation);
@@ -305,26 +302,22 @@ about_dialog_anim_expose (GtkWidget       *widget,
 
   if (dialog->textrange[1] > 0)
     {
-      GdkRegion *covered_region;
+      cairo_region_t *covered_region;
 
       covered_region = gdk_pango_layout_get_clip_region (dialog->layout,
                                                          x, y,
                                                          dialog->textrange, 1);
 
-      gdk_region_intersect (covered_region, event->region);
-
       gdk_cairo_region (cr, covered_region);
       cairo_clip (cr);
 
-      gdk_region_destroy (covered_region);
+      cairo_region_destroy (covered_region);
     }
 
   cairo_move_to (cr, x, y);
 
   pango_cairo_show_layout (cr, dialog->layout);
 
-  cairo_destroy (cr);
-
   return FALSE;
 }
 


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