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



commit dc64dc3834c545ff4d6841ae3af77de214a3b4a6
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 f56a57c..eb8b48c 100644
--- a/app/dialogs/about-dialog.c
+++ b/app/dialogs/about-dialog.c
@@ -76,8 +76,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);
@@ -246,8 +246,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);
 }
 
@@ -278,12 +278,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;
@@ -291,8 +290,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);
@@ -303,26 +300,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]