[libgd/wip/ernestask/gtk4] main-list-view: use snapshot API for rendering



commit bb914f07a1a0ec081125784339cd26428562ac36
Author: Ernestas Kulik <ernestask gnome org>
Date:   Sat Mar 10 11:23:06 2018 +0200

    main-list-view: use snapshot API for rendering

 libgd/gd-main-list-view.c |   28 +++++++++++++---------------
 1 files changed, 13 insertions(+), 15 deletions(-)
---
diff --git a/libgd/gd-main-list-view.c b/libgd/gd-main-list-view.c
index f4ab4ef..63539af 100644
--- a/libgd/gd-main-list-view.c
+++ b/libgd/gd-main-list-view.c
@@ -40,8 +40,8 @@ G_DEFINE_TYPE_WITH_CODE (GdMainListView, gd_main_list_view, GTK_TYPE_TREE_VIEW,
                          G_IMPLEMENT_INTERFACE (GD_TYPE_MAIN_VIEW_GENERIC,
                                                 gd_main_view_generic_iface_init))
 
-static gboolean gd_main_list_view_draw (GtkWidget *widget,
-                                       cairo_t   *cr);
+static void gd_main_list_view_snapshot (GtkWidget   *widget,
+                                        GtkSnapshot *snapshot);
 
 static GtkTreePath*
 get_source_row (GdkDragContext *context)
@@ -181,7 +181,7 @@ gd_main_list_view_class_init (GdMainListViewClass *klass)
 
   oclass->constructed = gd_main_list_view_constructed;
   wclass->drag_data_get = gd_main_list_view_drag_data_get;
-  wclass->draw = gd_main_list_view_draw;
+  wclass->snapshot = gd_main_list_view_snapshot;
 
   g_type_class_add_private (klass, sizeof (GdMainListViewPrivate));
 
@@ -242,9 +242,9 @@ gd_main_list_view_set_selection_mode (GdMainViewGeneric *mv,
   gtk_tree_view_column_queue_resize (self->priv->tree_col);
 }
 
-static gboolean
-gd_main_list_view_draw (GtkWidget *widget,
-                       cairo_t   *cr)
+static void
+gd_main_list_view_snapshot (GtkWidget *widget,
+                            GtkSnapshot *snapshot)
 {
   GdMainListView *self = GD_MAIN_LIST_VIEW (widget);
   GtkStyleContext *context;
@@ -253,7 +253,7 @@ gd_main_list_view_draw (GtkWidget *widget,
   GtkTreePath *path;
   GtkTreePath *rubberband_start, *rubberband_end;
 
-  GTK_WIDGET_CLASS (gd_main_list_view_parent_class)->draw (widget, cr);
+  GTK_WIDGET_CLASS (gd_main_list_view_parent_class)->snapshot (widget, snapshot);
 
   _gd_main_view_generic_get_rubberband_range (GD_MAIN_VIEW_GENERIC (self),
                                              &rubberband_start, &rubberband_end);
@@ -282,18 +282,16 @@ gd_main_list_view_draw (GtkWidget *widget,
        }
       gtk_tree_path_free (path);
 
-      gtk_render_background (context, cr,
-                            lines_rect.x, lines_rect.y,
-                            lines_rect.width, lines_rect.height);
-      gtk_render_frame (context, cr,
-                            lines_rect.x, lines_rect.y,
-                            lines_rect.width, lines_rect.height);
+      gtk_snapshot_render_background (snapshot, context,
+                                      lines_rect.x, lines_rect.y,
+                                      lines_rect.width, lines_rect.height);
+      gtk_snapshot_render_frame (snapshot, context,
+                                 lines_rect.x, lines_rect.y,
+                                 lines_rect.width, lines_rect.height);
 
 
       gtk_style_context_restore (context);
     }
-
-  return FALSE;
 }
 
 static void


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