[gimp/gtk3-port: 45/228] app: port to GtkWidget::draw()



commit dee7693e96ef744427fcab3d676f72bf67ccc49e
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 85cde97..da5fda4 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);
@@ -239,8 +239,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);
 }
 
@@ -271,12 +271,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;
@@ -284,8 +283,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);
@@ -296,26 +293,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]