[gimp/gtk3-port: 43/248] app: port to GtkWidget::draw() and to the new GDK_KEY_foo key names



commit da71f5819db9bee4cb29bc46d178e3724e31a6e7
Author: Michael Natterer <mitch gimp org>
Date:   Fri Oct 15 14:35:13 2010 +0200

    app: port to GtkWidget::draw() and to the new GDK_KEY_foo key names

 app/widgets/gimpnavigationview.c |   34 +++++++++++-----------------------
 1 files changed, 11 insertions(+), 23 deletions(-)
---
diff --git a/app/widgets/gimpnavigationview.c b/app/widgets/gimpnavigationview.c
index dbd85ad..4a9366d 100644
--- a/app/widgets/gimpnavigationview.c
+++ b/app/widgets/gimpnavigationview.c
@@ -74,8 +74,8 @@ struct _GimpNavigationView
 
 static void     gimp_navigation_view_size_allocate  (GtkWidget      *widget,
                                                      GtkAllocation  *allocation);
-static gboolean gimp_navigation_view_expose         (GtkWidget      *widget,
-                                                     GdkEventExpose *event);
+static gboolean gimp_navigation_view_draw           (GtkWidget      *widget,
+                                                     cairo_t        *cr);
 static gboolean gimp_navigation_view_button_press   (GtkWidget      *widget,
                                                      GdkEventButton *bevent);
 static gboolean gimp_navigation_view_button_release (GtkWidget      *widget,
@@ -144,7 +144,7 @@ gimp_navigation_view_class_init (GimpNavigationViewClass *klass)
                   GDK_TYPE_SCROLL_DIRECTION);
 
   widget_class->size_allocate        = gimp_navigation_view_size_allocate;
-  widget_class->expose_event         = gimp_navigation_view_expose;
+  widget_class->draw                 = gimp_navigation_view_draw;
   widget_class->button_press_event   = gimp_navigation_view_button_press;
   widget_class->button_release_event = gimp_navigation_view_button_release;
   widget_class->scroll_event         = gimp_navigation_view_scroll;
@@ -186,24 +186,12 @@ gimp_navigation_view_size_allocate (GtkWidget     *widget,
 }
 
 static gboolean
-gimp_navigation_view_expose (GtkWidget      *widget,
-                             GdkEventExpose *event)
+gimp_navigation_view_draw (GtkWidget *widget,
+                           cairo_t   *cr)
 {
-  if (gtk_widget_is_drawable (widget))
-    {
-      cairo_t *cr;
-
-      GTK_WIDGET_CLASS (parent_class)->expose_event (widget, event);
-
-      cr = gdk_cairo_create (gtk_widget_get_window (widget));
+  GTK_WIDGET_CLASS (parent_class)->draw (widget, cr);
 
-      gdk_cairo_region (cr, event->region);
-      cairo_clip (cr);
-
-      gimp_navigation_view_draw_marker (GIMP_NAVIGATION_VIEW (widget), cr);
-
-      cairo_destroy (cr);
-    }
+  gimp_navigation_view_draw_marker (GIMP_NAVIGATION_VIEW (widget), cr);
 
   return TRUE;
 }
@@ -404,19 +392,19 @@ gimp_navigation_view_key_press (GtkWidget   *widget,
 
   switch (kevent->keyval)
     {
-    case GDK_Up:
+    case GDK_KEY_Up:
       scroll_y = -1;
       break;
 
-    case GDK_Left:
+    case GDK_KEY_Left:
       scroll_x = -1;
       break;
 
-    case GDK_Right:
+    case GDK_KEY_Right:
       scroll_x = 1;
       break;
 
-    case GDK_Down:
+    case GDK_KEY_Down:
       scroll_y = 1;
       break;
 



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