[sysprof/wip/gtk4: 1/2] Rough gtk4 port



commit 2a619805feb7331311eba81444b91f0eba6f46c3
Author: Timm Bäder <mail baedert org>
Date:   Wed May 24 14:10:56 2017 +0200

    Rough gtk4 port

 configure.ac                                |    4 +-
 lib/meson.build                             |    2 +-
 lib/resources/ui/sp-empty-state-view.ui     |    5 +-
 lib/resources/ui/sp-failed-state-view.ui    |    5 +-
 lib/resources/ui/sp-profiler-menu-button.ui |   11 +-
 lib/resources/ui/sp-recording-state-view.ui |    6 +-
 lib/sp-line-visualizer-row.c                |   29 +-
 lib/sp-multi-paned.c                        |  656 +++++----------------------
 lib/sp-visualizer-row.c                     |   39 +-
 lib/sp-visualizer-ticks.c                   |   46 ++-
 lib/sp-visualizer-view.c                    |   37 +-
 src/resources/ui/sp-window.ui               |    2 +-
 12 files changed, 235 insertions(+), 607 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 0a2febc..5bf1e36 100644
--- a/configure.ac
+++ b/configure.ac
@@ -113,14 +113,14 @@ dnl ***********************************************************************
 dnl Check for required packages
 dnl ***********************************************************************
 m4_define([glib_required_version], [2.44.0])
-m4_define([gtk_required_version], [3.22.0])
+m4_define([gtk_required_version], [3.89.5])
 m4_define([systemd_required_version], [222])
 
 PKG_CHECK_MODULES(GIO,
                   [gio-2.0 >= glib_required_version
                    gio-unix-2.0 >= glib_required_version])
 PKG_CHECK_MODULES(GTK,
-                  [gtk+-3.0 >= gtk_required_version],
+                  [gtk+-4.0 >= gtk_required_version],
                   [have_gtk=yes],
                   [have_gtk=no])
 PKG_CHECK_MODULES(POLKIT,
diff --git a/lib/meson.build b/lib/meson.build
index a7e823b..d083122 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -220,7 +220,7 @@ if get_option('enable_gtk')
 
   libsysprof_ui_deps = [
     libsysprof_dep,
-    dependency('gtk+-3.0', version: '>=3.21.5'),
+    dependency('gtk+-4.0', version: '>=3.89.5'),
   ]
 
   libsysprof_ui = shared_library('sysprof-ui-' + libsysprof_api_version,
diff --git a/lib/resources/ui/sp-empty-state-view.ui b/lib/resources/ui/sp-empty-state-view.ui
index 61c02e7..bfd3b88 100644
--- a/lib/resources/ui/sp-empty-state-view.ui
+++ b/lib/resources/ui/sp-empty-state-view.ui
@@ -3,11 +3,12 @@
   <template class="SpEmptyStateView" parent="GtkBin">
     <child>
       <object class="GtkBox">
-        <property name="border-width">36</property>
         <property name="orientation">vertical</property>
         <property name="spacing">12</property>
         <property name="visible">true</property>
-        <child type="center">
+        <property name="halign">center</property>
+        <property name="valign">center</property>
+        <child>
           <object class="GtkImage">
             <property name="icon-name">sysprof-symbolic</property>
             <property name="pixel-size">256</property>
diff --git a/lib/resources/ui/sp-failed-state-view.ui b/lib/resources/ui/sp-failed-state-view.ui
index ba2f17e..0f9939a 100644
--- a/lib/resources/ui/sp-failed-state-view.ui
+++ b/lib/resources/ui/sp-failed-state-view.ui
@@ -3,11 +3,12 @@
   <template class="SpFailedStateView" parent="GtkBin">
     <child>
       <object class="GtkBox">
-        <property name="border-width">36</property>
         <property name="orientation">vertical</property>
         <property name="spacing">12</property>
         <property name="visible">true</property>
-        <child type="center">
+        <property name="halign">center</property>
+        <property name="valign">center</property>
+        <child>
           <object class="GtkImage">
             <property name="icon-name">computer-fail-symbolic</property>
             <property name="pixel-size">256</property>
diff --git a/lib/resources/ui/sp-profiler-menu-button.ui b/lib/resources/ui/sp-profiler-menu-button.ui
index 4e6359f..cd1aed1 100644
--- a/lib/resources/ui/sp-profiler-menu-button.ui
+++ b/lib/resources/ui/sp-profiler-menu-button.ui
@@ -12,10 +12,8 @@
           <object class="GtkLabel" id="label">
             <property name="ellipsize">end</property>
             <property name="visible">true</property>
+            <property name="hexpand">1</property>
           </object>
-          <packing>
-            <property name="expand">true</property>
-          </packing>
         </child>
         <child>
           <object class="GtkImage">
@@ -38,11 +36,11 @@
         <property name="visible">true</property>
         <child>
           <object class="GtkStackSwitcher">
-            <property name="border-width">6</property>
             <property name="halign">center</property>
             <property name="orientation">horizontal</property>
             <property name="stack">stack</property>
             <property name="visible">true</property>
+            <property name="margin">6</property>
           </object>
         </child>
         <child>
@@ -52,7 +50,7 @@
             <property name="hexpand">true</property>
             <property name="margin">10</property>
             <property name="spacing">12</property>
-            <child type="center">
+            <child>
               <object class="GtkLabel">
                 <property name="hexpand">true</property>
                 <property name="label" translatable="yes">Profile my _entire system</property>
@@ -78,11 +76,11 @@
             <property name="vhomogeneous">false</property>
             <property name="interpolate-size">true</property>
             <property name="visible">true</property>
-            <property name="border-width">10</property>
             <child>
               <object class="GtkBox">
                 <!-- box with single child is used so we can toggle visibility of the child -->
                 <property name="visible">true</property>
+                <property name="margin">12</property>
                 <child>
                   <object class="GtkBox" id="processes_box">
                     <property name="orientation">vertical</property>
@@ -126,6 +124,7 @@
                 <property name="orientation">vertical</property>
                 <property name="spacing">12</property>
                 <property name="visible">true</property>
+                <property name="margin">12</property>
                 <child>
                   <object class="GtkLabel">
                     <property name="label" translatable="yes">Command Line</property>
diff --git a/lib/resources/ui/sp-recording-state-view.ui b/lib/resources/ui/sp-recording-state-view.ui
index 0e15477..e76898c 100644
--- a/lib/resources/ui/sp-recording-state-view.ui
+++ b/lib/resources/ui/sp-recording-state-view.ui
@@ -3,11 +3,11 @@
   <template class="SpRecordingStateView" parent="GtkBin">
     <child>
       <object class="GtkBox">
-        <property name="border-width">36</property>
         <property name="orientation">vertical</property>
         <property name="spacing">12</property>
-        <property name="visible">true</property>
-        <child type="center">
+        <property name="halign">center</property>
+        <property name="valign">center</property>
+        <child>
           <object class="GtkImage">
             <property name="icon-name">sysprof-symbolic</property>
             <property name="pixel-size">256</property>
diff --git a/lib/sp-line-visualizer-row.c b/lib/sp-line-visualizer-row.c
index 0a92e5a..945cc06 100644
--- a/lib/sp-line-visualizer-row.c
+++ b/lib/sp-line-visualizer-row.c
@@ -131,28 +131,31 @@ copy_array (GArray *ar)
   return ret;
 }
 
-static gboolean
-sp_line_visualizer_row_draw (GtkWidget *widget,
-                             cairo_t   *cr)
+static void
+sp_line_visualizer_row_snapshot (GtkWidget   *widget,
+                                 GtkSnapshot *snapshot)
 {
   SpLineVisualizerRow *self = (SpLineVisualizerRow *)widget;
   SpLineVisualizerRowPrivate *priv = sp_line_visualizer_row_get_instance_private (self);
   GtkStyleContext *style_context;
-  GtkStateFlags flags;
   GdkRGBA foreground;
-  gboolean ret;
+  cairo_t *cr;
+  graphene_rect_t bounds;
 
   g_assert (SP_IS_LINE_VISUALIZER_ROW (widget));
-  g_assert (cr != NULL);
-
-  ret = GTK_WIDGET_CLASS (sp_line_visualizer_row_parent_class)->draw (widget, cr);
 
   if (priv->cache == NULL)
-    return ret;
+    return;
+
+  graphene_rect_init (&bounds,
+                      0, 0,
+                      gtk_widget_get_allocated_width (widget),
+                      gtk_widget_get_allocated_height (widget));
+  cr = gtk_snapshot_append_cairo (snapshot, &bounds, "SpLineVisualizerRow");
+
 
   style_context = gtk_widget_get_style_context (widget);
-  flags = gtk_widget_get_state_flags (widget);
-  gtk_style_context_get_color (style_context, flags, &foreground);
+  gtk_style_context_get_color (style_context, &foreground);
 
   for (guint line = 0; line < priv->lines->len; line++)
     {
@@ -205,7 +208,7 @@ sp_line_visualizer_row_draw (GtkWidget *widget,
         }
     }
 
-  return ret;
+  cairo_destroy (cr);
 }
 
 static void
@@ -383,7 +386,7 @@ sp_line_visualizer_row_class_init (SpLineVisualizerRowClass *klass)
   object_class->get_property = sp_line_visualizer_row_get_property;
   object_class->set_property = sp_line_visualizer_row_set_property;
 
-  widget_class->draw = sp_line_visualizer_row_draw;
+  widget_class->snapshot = sp_line_visualizer_row_snapshot;
 
   visualizer_class->set_reader = sp_line_visualizer_row_set_reader;
 
diff --git a/lib/sp-multi-paned.c b/lib/sp-multi-paned.c
index 01d5928..77184da 100644
--- a/lib/sp-multi-paned.c
+++ b/lib/sp-multi-paned.c
@@ -42,12 +42,6 @@ typedef struct
   GtkWidget *widget;
 
   /*
-   * The input only window for resize grip.
-   * Has a cursor associated with it.
-   */
-  GdkWindow *handle;
-
-  /*
    * The position the handle has been dragged to.
    * This is used to adjust size requests.
    */
@@ -169,12 +163,6 @@ enum {
 };
 
 enum {
-  STYLE_PROP_0,
-  STYLE_PROP_HANDLE_SIZE,
-  N_STYLE_PROPS
-};
-
-enum {
   RESIZE_DRAG_BEGIN,
   RESIZE_DRAG_END,
   N_SIGNALS
@@ -187,7 +175,6 @@ enum {
 
 static GParamSpec *properties [N_PROPS];
 static GParamSpec *child_properties [N_CHILD_PROPS];
-static GParamSpec *style_properties [N_STYLE_PROPS];
 static guint signals [N_SIGNALS];
 static AllocationStage allocation_stages[] = {
   allocation_stage_borders,
@@ -259,6 +246,7 @@ sp_multi_paned_is_last_visible_child (SpMultiPaned      *self,
   return !sp_multi_paned_get_next_visible_child (self, child);
 }
 
+#if 0
 static void
 sp_multi_paned_get_handle_rect (SpMultiPaned      *self,
                                  SpMultiPanedChild *child,
@@ -300,50 +288,7 @@ sp_multi_paned_get_handle_rect (SpMultiPaned      *self,
       handle_rect->height = HANDLE_HEIGHT;
     }
 }
-
-static void
-sp_multi_paned_create_child_handle (SpMultiPaned      *self,
-                                     SpMultiPanedChild *child)
-{
-  SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
-  GdkWindowAttr attributes = { 0 };
-  GdkDisplay *display;
-  GdkWindow *parent;
-  const char *cursor_name;
-  GdkRectangle handle_rect;
-
-  g_assert (SP_IS_MULTI_PANED (self));
-  g_assert (child != NULL);
-  g_assert (child->handle == NULL);
-
-  display = gtk_widget_get_display (GTK_WIDGET (self));
-  parent = gtk_widget_get_window (GTK_WIDGET (self));
-
-  cursor_name = (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
-                ? "col-resize"
-                : "row-resize";
-
-  sp_multi_paned_get_handle_rect (self, child, &handle_rect);
-
-  attributes.window_type = GDK_WINDOW_CHILD;
-  attributes.wclass = GDK_INPUT_ONLY;
-  attributes.x = handle_rect.x;
-  attributes.y = -handle_rect.y;
-  attributes.width = handle_rect.width;
-  attributes.height = handle_rect.height;
-  attributes.visual = gtk_widget_get_visual (GTK_WIDGET (self));
-  attributes.event_mask = (GDK_BUTTON_PRESS_MASK |
-                           GDK_BUTTON_RELEASE_MASK |
-                           GDK_ENTER_NOTIFY_MASK |
-                           GDK_LEAVE_NOTIFY_MASK |
-                           GDK_POINTER_MOTION_MASK);
-  attributes.cursor = gdk_cursor_new_from_name (display, cursor_name);
-
-  child->handle = gdk_window_new (parent, &attributes, GDK_WA_CURSOR);
-  gtk_widget_register_window (GTK_WIDGET (self), child->handle);
-
-  g_clear_object (&attributes.cursor);
-}
+#endif
 
 static gint
 sp_multi_paned_calc_handle_size (SpMultiPaned *self)
@@ -355,7 +300,7 @@ sp_multi_paned_calc_handle_size (SpMultiPaned *self)
 
   g_assert (SP_IS_MULTI_PANED (self));
 
-  gtk_widget_style_get (GTK_WIDGET (self), "handle-size", &handle_size, NULL);
+  handle_size = 10;
 
   for (i = 0; i < priv->children->len; i++)
     {
@@ -368,51 +313,6 @@ sp_multi_paned_calc_handle_size (SpMultiPaned *self)
   return MAX (0, (visible_children - 1) * handle_size);
 }
 
-static void
-sp_multi_paned_destroy_child_handle (SpMultiPaned      *self,
-                                      SpMultiPanedChild *child)
-{
-  g_assert (SP_IS_MULTI_PANED (self));
-  g_assert (child != NULL);
-
-  if (child->handle != NULL)
-    {
-      gdk_window_destroy (child->handle);
-      child->handle = NULL;
-    }
-}
-
-static void
-sp_multi_paned_update_child_handles (SpMultiPaned *self)
-{
-  SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
-  GtkWidget *widget = GTK_WIDGET (self);
-
-  if (gtk_widget_get_realized (widget))
-    {
-      GdkCursor *cursor;
-      guint i;
-
-      if (gtk_widget_is_sensitive (widget))
-        cursor = gdk_cursor_new_from_name (gtk_widget_get_display (widget),
-                                           priv->orientation == GTK_ORIENTATION_HORIZONTAL
-                                           ? "col-resize"
-                                           : "row-resize");
-      else
-        cursor = NULL;
-
-      for (i = 0; i < priv->children->len; i++)
-        {
-          SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
-
-          gdk_window_set_cursor (child->handle, cursor);
-        }
-
-      if (cursor)
-        g_object_unref (cursor);
-    }
-}
-
 static SpMultiPanedChild *
 sp_multi_paned_get_child (SpMultiPaned *self,
                            GtkWidget     *widget)
@@ -487,9 +387,6 @@ sp_multi_paned_add (GtkContainer *container,
   child.widget = g_object_ref_sink (widget);
   child.position = -1;
 
-  if (gtk_widget_get_realized (GTK_WIDGET (self)))
-    sp_multi_paned_create_child_handle (self, &child);
-
   gtk_widget_set_parent (widget, GTK_WIDGET (self));
 
   g_array_append_val (priv->children, child);
@@ -516,8 +413,6 @@ sp_multi_paned_remove (GtkContainer *container,
 
       if (child->widget == widget)
         {
-          sp_multi_paned_destroy_child_handle (self, child);
-
           g_array_remove_index (priv->children, i);
           child = NULL;
 
@@ -535,7 +430,6 @@ sp_multi_paned_remove (GtkContainer *container,
 
 static void
 sp_multi_paned_forall (GtkContainer *container,
-                        gboolean      include_internals,
                         GtkCallback   callback,
                         gpointer      user_data)
 {
@@ -567,266 +461,85 @@ sp_multi_paned_get_request_mode (GtkWidget *widget)
 }
 
 static void
-sp_multi_paned_get_preferred_height (GtkWidget *widget,
-                                      gint      *min_height,
-                                      gint      *nat_height)
+sp_multi_paned_measure (GtkWidget      *widget,
+                        GtkOrientation  orientation,
+                        int             for_size,
+                        int            *minimum,
+                        int            *natural,
+                        int            *minimum_baseline,
+                        int            *natural_baseline)
 {
   SpMultiPaned *self = (SpMultiPaned *)widget;
   SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+  int handle_size;
+  int min = 0;
+  int nat = 0;
   guint i;
-  gint real_min_height = 0;
-  gint real_nat_height = 0;
 
-  g_assert (SP_IS_MULTI_PANED (self));
-  g_assert (min_height != NULL);
-  g_assert (nat_height != NULL);
+  *minimum = 0;
+  *natural = 0;
 
-  for (i = 0; i < priv->children->len; i++)
-    {
-      SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
-      gint child_min_height = 0;
-      gint child_nat_height = 0;
+  handle_size = sp_multi_paned_calc_handle_size (self);
 
-      if (gtk_widget_get_visible (child->widget))
+  if (orientation == GTK_ORIENTATION_HORIZONTAL)
+    {
+      for (i = 0; i < priv->children->len; i++)
         {
-          gtk_widget_get_preferred_height (child->widget, &child_min_height, &child_nat_height);
+          SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
+          int child_min, child_nat;
 
-          if (priv->orientation == GTK_ORIENTATION_VERTICAL)
+          gtk_widget_measure (child->widget, orientation, for_size,
+                              &child_min, &child_nat, NULL, NULL);
+
+          if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
             {
-              real_min_height += child_min_height;
-              real_nat_height += child_nat_height;
+              min += child_min;
+              nat += child_nat;
             }
           else
             {
-              real_min_height = MAX (real_min_height, child_min_height);
-              real_nat_height = MAX (real_nat_height, child_nat_height);
+              min = MAX (min, child_min);
+              nat = MAX (nat, child_nat);
             }
         }
-    }
-
-  if (priv->orientation == GTK_ORIENTATION_VERTICAL)
-    {
-      gint handle_size = sp_multi_paned_calc_handle_size (self);
-
-      real_min_height += handle_size;
-      real_nat_height += handle_size;
-    }
-
-  *min_height = real_min_height;
-  *nat_height = real_nat_height;
-}
-
-static void
-sp_multi_paned_get_child_preferred_height_for_width (SpMultiPaned      *self,
-                                                      SpMultiPanedChild *children,
-                                                      gint                n_children,
-                                                      gint                width,
-                                                      gint               *min_height,
-                                                      gint               *nat_height)
-{
-  SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
-  SpMultiPanedChild *child = children;
-  gint child_min_height = 0;
-  gint child_nat_height = 0;
-  gint neighbor_min_height = 0;
-  gint neighbor_nat_height = 0;
-
-  g_assert (SP_IS_MULTI_PANED (self));
-  g_assert (n_children == 0 || children != NULL);
-  g_assert (min_height != NULL);
-  g_assert (nat_height != NULL);
-
-  *min_height = 0;
-  *nat_height = 0;
-
-  if (n_children == 0)
-    return;
-
-  if (gtk_widget_get_visible (child->widget))
-    gtk_widget_get_preferred_height_for_width (child->widget,
-                                               width,
-                                               &child_min_height,
-                                               &child_nat_height);
 
-  sp_multi_paned_get_child_preferred_height_for_width (self,
-                                                        children + 1,
-                                                        n_children - 1,
-                                                        width,
-                                                        &neighbor_min_height,
-                                                        &neighbor_nat_height);
-
-  if (priv->orientation == GTK_ORIENTATION_VERTICAL)
-    {
-      *min_height = child_min_height + neighbor_min_height;
-      *nat_height = child_nat_height + neighbor_nat_height;
+      if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+        {
+          min += handle_size;
+          nat += handle_size;
+        }
     }
   else
     {
-      *min_height = MAX (child_min_height, neighbor_min_height);
-      *nat_height = MAX (child_nat_height, neighbor_nat_height);
-    }
-}
-
-static void
-sp_multi_paned_get_preferred_height_for_width (GtkWidget *widget,
-                                                gint       width,
-                                                gint      *min_height,
-                                                gint      *nat_height)
-{
-  SpMultiPaned *self = (SpMultiPaned *)widget;
-  SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
-
-  g_assert (SP_IS_MULTI_PANED (self));
-  g_assert (min_height != NULL);
-  g_assert (nat_height != NULL);
-
-  *min_height = 0;
-  *nat_height = 0;
-
-  sp_multi_paned_get_child_preferred_height_for_width (self,
-                                                        (SpMultiPanedChild *)(gpointer)priv->children->data,
-                                                        priv->children->len,
-                                                        width,
-                                                        min_height,
-                                                        nat_height);
-
-  if (priv->orientation == GTK_ORIENTATION_VERTICAL)
-    {
-      gint handle_size = sp_multi_paned_calc_handle_size (self);
-
-      *min_height += handle_size;
-      *nat_height += handle_size;
-    }
-}
-
-static void
-sp_multi_paned_get_preferred_width (GtkWidget *widget,
-                                     gint      *min_width,
-                                     gint      *nat_width)
-{
-  SpMultiPaned *self = (SpMultiPaned *)widget;
-  SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
-  guint i;
-  gint real_min_width = 0;
-  gint real_nat_width = 0;
-
-  g_assert (SP_IS_MULTI_PANED (self));
-  g_assert (min_width != NULL);
-  g_assert (nat_width != NULL);
-
-  for (i = 0; i < priv->children->len; i++)
-    {
-      SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
-      gint child_min_width = 0;
-      gint child_nat_width = 0;
-
-      if (gtk_widget_get_visible (child->widget))
+      for (i = 0; i < priv->children->len; i++)
         {
-          gtk_widget_get_preferred_width (child->widget, &child_min_width, &child_nat_width);
+          SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
+          int child_min, child_nat;
+
+          gtk_widget_measure (child->widget, orientation, for_size,
+                              &child_min, &child_nat, NULL, NULL);
 
-          if (priv->orientation == GTK_ORIENTATION_VERTICAL)
+          if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
             {
-              real_min_width = MAX (real_min_width, child_min_width);
-              real_nat_width = MAX (real_nat_width, child_nat_width);
+              min = MAX (min, child_min);
+              nat = MAX (nat, child_nat);
             }
           else
             {
-              real_min_width += child_min_width;
-              real_nat_width += child_nat_width;
+              min += child_min;
+              nat += child_nat;
             }
         }
-    }
-
-  if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
-    {
-      gint handle_size = sp_multi_paned_calc_handle_size (self);
-
-      real_min_width += handle_size;
-      real_nat_width += handle_size;
-    }
-
-  *min_width = real_min_width;
-  *nat_width = real_nat_width;
-}
-
-static void
-sp_multi_paned_get_child_preferred_width_for_height (SpMultiPaned      *self,
-                                                      SpMultiPanedChild *children,
-                                                      gint                n_children,
-                                                      gint                height,
-                                                      gint               *min_width,
-                                                      gint               *nat_width)
-{
-  SpMultiPanedChild *child = children;
-  SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
-  gint child_min_width = 0;
-  gint child_nat_width = 0;
-  gint neighbor_min_width = 0;
-  gint neighbor_nat_width = 0;
-
-  g_assert (SP_IS_MULTI_PANED (self));
-  g_assert (n_children == 0 || children != NULL);
-  g_assert (min_width != NULL);
-  g_assert (nat_width != NULL);
 
-  *min_width = 0;
-  *nat_width = 0;
-
-  if (n_children == 0)
-    return;
-
-  if (gtk_widget_get_visible (child->widget))
-    gtk_widget_get_preferred_width_for_height (child->widget,
-                                               height,
-                                               &child_min_width,
-                                               &child_nat_width);
-
-  sp_multi_paned_get_child_preferred_width_for_height (self,
-                                                        children + 1,
-                                                        n_children - 1,
-                                                        height,
-                                                        &neighbor_min_width,
-                                                        &neighbor_nat_width);
-
-  if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
-    {
-      *min_width = child_min_width + neighbor_min_width;
-      *nat_width = child_nat_width + neighbor_nat_width;
-    }
-  else
-    {
-      *min_width = MAX (child_min_width, neighbor_min_width);
-      *nat_width = MAX (child_nat_width, neighbor_nat_width);
+      if (priv->orientation == GTK_ORIENTATION_VERTICAL)
+        {
+          min += handle_size;
+          nat += handle_size;
+        }
     }
-}
-
-static void
-sp_multi_paned_get_preferred_width_for_height (GtkWidget *widget,
-                                                gint       height,
-                                                gint      *min_width,
-                                                gint      *nat_width)
-{
-  SpMultiPaned *self = (SpMultiPaned *)widget;
-  SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
-
-  g_assert (SP_IS_MULTI_PANED (self));
-  g_assert (min_width != NULL);
-  g_assert (nat_width != NULL);
-
-  sp_multi_paned_get_child_preferred_width_for_height (self,
-                                                        (SpMultiPanedChild *)(gpointer)priv->children->data,
-                                                        priv->children->len,
-                                                        height,
-                                                        min_width,
-                                                        nat_width);
 
-  if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
-    {
-      gint handle_size = sp_multi_paned_calc_handle_size (self);
-
-      *min_width += handle_size;
-      *nat_width += handle_size;
-    }
+  *minimum = min;
+  *natural = nat;
 }
 
 static void
@@ -965,7 +678,7 @@ allocation_stage_borders (SpMultiPaned   *self,
   g_assert (state->children != NULL);
   g_assert (state->n_children > 0);
 
-  border_width = gtk_container_get_border_width (GTK_CONTAINER (self));
+  border_width = 0;
 
   state->top_alloc.x += border_width;
   state->top_alloc.y += border_width;
@@ -998,15 +711,15 @@ allocation_stage_cache_request (SpMultiPaned   *self,
       SpMultiPanedChild *child = state->children [i];
 
       if (IS_HORIZONTAL (state->orientation))
-        gtk_widget_get_preferred_width_for_height (child->widget,
-                                                   state->avail_height,
-                                                   &child->min_req.width,
-                                                   &child->nat_req.width);
+        gtk_widget_measure (child->widget, GTK_ORIENTATION_HORIZONTAL,
+                            state->avail_height,
+                            &child->min_req.width,&child->nat_req.width,
+                            NULL, NULL);
       else
-        gtk_widget_get_preferred_height_for_width (child->widget,
-                                                   state->avail_width,
-                                                   &child->min_req.height,
-                                                   &child->nat_req.height);
+        gtk_widget_measure (child->widget, GTK_ORIENTATION_VERTICAL,
+                            state->avail_width,
+                            &child->min_req.height,&child->nat_req.height,
+                            NULL, NULL);
     }
 }
 
@@ -1272,6 +985,7 @@ allocation_stage_allocate (SpMultiPaned   *self,
                            AllocationState *state)
 {
   guint i;
+  GtkAllocation clip;
 
   g_assert (SP_IS_MULTI_PANED (self));
   g_assert (state != NULL);
@@ -1282,35 +996,15 @@ allocation_stage_allocate (SpMultiPaned   *self,
     {
       SpMultiPanedChild *child = state->children [i];
 
-      gtk_widget_size_allocate (child->widget, &child->alloc);
-
-      if ((child->handle != NULL) && (state->n_children != (i + 1)))
-        {
-          if (state->orientation == GTK_ORIENTATION_HORIZONTAL)
-            {
-              gdk_window_move_resize (child->handle,
-                                      child->alloc.x + child->alloc.width - (HANDLE_WIDTH / 2),
-                                      child->alloc.y,
-                                      HANDLE_WIDTH,
-                                      child->alloc.height);
-            }
-          else
-            {
-              gdk_window_move_resize (child->handle,
-                                      child->alloc.x,
-                                      child->alloc.y + child->alloc.height - (HANDLE_HEIGHT / 2),
-                                      child->alloc.width,
-                                      HANDLE_HEIGHT);
-            }
-
-          gdk_window_show (child->handle);
-        }
+      gtk_widget_size_allocate (child->widget, &child->alloc, -1, &clip);
     }
 }
 
 static void
-sp_multi_paned_size_allocate (GtkWidget     *widget,
-                               GtkAllocation *allocation)
+sp_multi_paned_size_allocate (GtkWidget           *widget,
+                              const GtkAllocation *allocation,
+                              int                  baseline,
+                              GtkAllocation       *out_clip)
 {
   SpMultiPaned *self = (SpMultiPaned *)widget;
   SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
@@ -1321,7 +1015,10 @@ sp_multi_paned_size_allocate (GtkWidget     *widget,
   g_assert (SP_IS_MULTI_PANED (self));
   g_assert (allocation != NULL);
 
-  GTK_WIDGET_CLASS (sp_multi_paned_parent_class)->size_allocate (widget, allocation);
+  GTK_WIDGET_CLASS (sp_multi_paned_parent_class)->size_allocate (widget,
+                                                                 allocation,
+                                                                 baseline,
+                                                                 out_clip);
 
   if (priv->children->len == 0)
     return;
@@ -1341,8 +1038,6 @@ sp_multi_paned_size_allocate (GtkWidget     *widget,
           gtk_widget_get_child_visible (child->widget) &&
           gtk_widget_get_visible (child->widget))
         g_ptr_array_add (children, child);
-      else if (child->handle)
-        gdk_window_hide (child->handle);
     }
 
   state.children = (SpMultiPanedChild **)children->pdata;
@@ -1354,9 +1049,7 @@ sp_multi_paned_size_allocate (GtkWidget     *widget,
       return;
     }
 
-  gtk_widget_style_get (GTK_WIDGET (self),
-                        "handle-size", &state.handle_size,
-                        NULL);
+  state.handle_size = 10;
 
   state.orientation = priv->orientation;
   state.top_alloc = *allocation;
@@ -1370,136 +1063,62 @@ sp_multi_paned_size_allocate (GtkWidget     *widget,
 }
 
 static void
-sp_multi_paned_realize (GtkWidget *widget)
-{
-  SpMultiPaned *self = (SpMultiPaned *)widget;
-  SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
-  guint i;
-
-  g_assert (SP_IS_MULTI_PANED (self));
-
-  GTK_WIDGET_CLASS (sp_multi_paned_parent_class)->realize (widget);
-
-  for (i = 0; i < priv->children->len; i++)
-    {
-      SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
-
-      sp_multi_paned_create_child_handle (self, child);
-    }
-}
-
-static void
-sp_multi_paned_unrealize (GtkWidget *widget)
-{
-  SpMultiPaned *self = (SpMultiPaned *)widget;
-  SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
-  guint i;
-
-  g_assert (SP_IS_MULTI_PANED (self));
-
-  for (i = 0; i < priv->children->len; i++)
-    {
-      SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
-
-      sp_multi_paned_destroy_child_handle (self, child);
-    }
-
-  GTK_WIDGET_CLASS (sp_multi_paned_parent_class)->unrealize (widget);
-}
-
-static void
-sp_multi_paned_map (GtkWidget *widget)
+sp_multi_paned_snapshot (GtkWidget   *widget,
+                         GtkSnapshot *snapshot)
 {
   SpMultiPaned *self = (SpMultiPaned *)widget;
   SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
+  GtkStyleContext *style_context;
+  gint handle_size = 1;
   guint i;
+  cairo_t *cr;
+  graphene_rect_t bounds;
 
   g_assert (SP_IS_MULTI_PANED (self));
 
-  GTK_WIDGET_CLASS (sp_multi_paned_parent_class)->map (widget);
+  GTK_WIDGET_CLASS (sp_multi_paned_parent_class)->snapshot (widget, snapshot);
 
-  for (i = 0; i < priv->children->len; i++)
-    {
-      SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
+  graphene_rect_init (&bounds,
+                      0, 0,
+                      gtk_widget_get_allocated_width (widget),
+                      gtk_widget_get_allocated_height (widget));
+  cr = gtk_snapshot_append_cairo (snapshot, &bounds, "multi paned");
 
-      gdk_window_show (child->handle);
-    }
-}
-
-static void
-sp_multi_paned_unmap (GtkWidget *widget)
-{
-  SpMultiPaned *self = (SpMultiPaned *)widget;
-  SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
-  guint i;
+  style_context = gtk_widget_get_style_context (GTK_WIDGET (self));
 
-  g_assert (SP_IS_MULTI_PANED (self));
+  handle_size = 10;
 
   for (i = 0; i < priv->children->len; i++)
     {
       SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
+      GtkAllocation alloc;
 
-      gdk_window_hide (child->handle);
-    }
-
-  GTK_WIDGET_CLASS (sp_multi_paned_parent_class)->unmap (widget);
-}
-
-static gboolean
-sp_multi_paned_draw (GtkWidget *widget,
-                      cairo_t   *cr)
-{
-  SpMultiPaned *self = (SpMultiPaned *)widget;
-  SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
-  gboolean ret;
-
-  g_assert (SP_IS_MULTI_PANED (self));
-  g_assert (cr != NULL);
+      if (!gtk_widget_get_realized (child->widget) ||
+          !gtk_widget_get_visible (child->widget))
+        continue;
 
-  ret = GTK_WIDGET_CLASS (sp_multi_paned_parent_class)->draw (widget, cr);
+      gtk_widget_get_allocation (child->widget, &alloc);
 
-  if (ret != GDK_EVENT_STOP)
-    {
-      GtkStyleContext *style_context;
-      gint handle_size = 1;
-      guint i;
-
-      style_context = gtk_widget_get_style_context (GTK_WIDGET (self));
-
-      gtk_widget_style_get (widget, "handle-size", &handle_size, NULL);
-
-      for (i = 0; i < priv->children->len; i++)
+      if (!sp_multi_paned_is_last_visible_child (self, child))
         {
-          SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
-          GtkAllocation alloc;
-
-          if (!gtk_widget_get_realized (child->widget) ||
-              !gtk_widget_get_visible (child->widget))
-            continue;
-
-          gtk_widget_get_allocation (child->widget, &alloc);
-
-          if (!sp_multi_paned_is_last_visible_child (self, child))
-            {
-              if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
-                gtk_render_handle (style_context,
-                                   cr,
-                                   alloc.x + alloc.width,
-                                   0,
-                                   handle_size,
-                                   alloc.height);
-              else
-                gtk_render_handle (style_context,
-                                   cr,
-                                   0,
-                                   alloc.y + alloc.height,
-                                   alloc.width,
-                                   handle_size);
-            }
+          if (priv->orientation == GTK_ORIENTATION_HORIZONTAL)
+            gtk_render_handle (style_context,
+                               cr,
+                               alloc.x + alloc.width,
+                               0,
+                               handle_size,
+                               alloc.height);
+          else
+            gtk_render_handle (style_context,
+                               cr,
+                               0,
+                               alloc.y + alloc.height,
+                               alloc.width,
+                               handle_size);
         }
     }
 
-  return ret;
+  cairo_destroy (cr);
 }
 
 static void
@@ -1509,31 +1128,31 @@ sp_multi_paned_pan_gesture_drag_begin (SpMultiPaned *self,
                                         GtkGesturePan *gesture)
 {
   SpMultiPanedPrivate *priv = sp_multi_paned_get_instance_private (self);
-  GdkEventSequence *sequence;
-  const GdkEvent *event;
+  /*GdkEventSequence *sequence;*/
+  /*const GdkEvent *event;*/
   guint i;
 
   g_assert (SP_IS_MULTI_PANED (self));
   g_assert (GTK_IS_GESTURE_PAN (gesture));
   g_assert (gesture == priv->gesture);
 
-  sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));
-  event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);
+  /*sequence = gtk_gesture_single_get_current_sequence (GTK_GESTURE_SINGLE (gesture));*/
+  /*event = gtk_gesture_get_last_event (GTK_GESTURE (gesture), sequence);*/
 
   priv->drag_begin = NULL;
   priv->drag_begin_position = 0;
   priv->drag_extra_offset = 0;
 
-  for (i = 0; i < priv->children->len; i++)
-    {
-      SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
+  /*for (i = 0; i < priv->children->len; i++)*/
+    /*{*/
+      /*SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);*/
 
-      if (child->handle == event->any.window)
-        {
-          priv->drag_begin = child;
-          break;
-        }
-    }
+      /*if (child->handle == event->any.window)*/
+        /*{*/
+          /*priv->drag_begin = child;*/
+          /*break;*/
+        /*}*/
+    /*}*/
 
   if (priv->drag_begin == NULL)
     {
@@ -1545,8 +1164,8 @@ sp_multi_paned_pan_gesture_drag_begin (SpMultiPaned *self,
     {
       SpMultiPanedChild *child = &g_array_index (priv->children, SpMultiPanedChild, i);
 
-      if (child->handle == event->any.window)
-        break;
+      /*if (child->handle == event->any.window)*/
+        /*break;*/
 
       /*
        * We want to make any child before the drag child "sticky" so that it
@@ -1783,7 +1402,6 @@ sp_multi_paned_set_property (GObject      *object,
     {
     case PROP_ORIENTATION:
       priv->orientation = g_value_get_enum (value);
-      sp_multi_paned_update_child_handles (self);
       gtk_widget_queue_resize (GTK_WIDGET (self));
       break;
 
@@ -1793,15 +1411,6 @@ sp_multi_paned_set_property (GObject      *object,
 }
 
 static void
-sp_multi_paned_state_flags_changed (GtkWidget     *widget,
-                                     GtkStateFlags  previous_state)
-{
-  sp_multi_paned_update_child_handles (SP_MULTI_PANED (widget));
-
-  GTK_WIDGET_CLASS (sp_multi_paned_parent_class)->state_flags_changed (widget, previous_state);
-}
-
-static void
 sp_multi_paned_class_init (SpMultiPanedClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
@@ -1813,17 +1422,9 @@ sp_multi_paned_class_init (SpMultiPanedClass *klass)
   object_class->finalize = sp_multi_paned_finalize;
 
   widget_class->get_request_mode = sp_multi_paned_get_request_mode;
-  widget_class->get_preferred_width = sp_multi_paned_get_preferred_width;
-  widget_class->get_preferred_height = sp_multi_paned_get_preferred_height;
-  widget_class->get_preferred_width_for_height = sp_multi_paned_get_preferred_width_for_height;
-  widget_class->get_preferred_height_for_width = sp_multi_paned_get_preferred_height_for_width;
+  widget_class->measure  = sp_multi_paned_measure;
+  widget_class->snapshot = sp_multi_paned_snapshot;
   widget_class->size_allocate = sp_multi_paned_size_allocate;
-  widget_class->realize = sp_multi_paned_realize;
-  widget_class->unrealize = sp_multi_paned_unrealize;
-  widget_class->map = sp_multi_paned_map;
-  widget_class->unmap = sp_multi_paned_unmap;
-  widget_class->draw = sp_multi_paned_draw;
-  widget_class->state_flags_changed = sp_multi_paned_state_flags_changed;
 
   container_class->add = sp_multi_paned_add;
   container_class->remove = sp_multi_paned_remove;
@@ -1857,15 +1458,6 @@ sp_multi_paned_class_init (SpMultiPanedClass *klass)
 
   gtk_container_class_install_child_properties (container_class, N_CHILD_PROPS, child_properties);
 
-  style_properties [STYLE_PROP_HANDLE_SIZE] =
-    g_param_spec_int ("handle-size",
-                      "Handle Size",
-                      "Width of the resize handle",
-                      0,
-                      G_MAXINT,
-                      1,
-                      (G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
-  gtk_widget_class_install_style_property (widget_class, style_properties [STYLE_PROP_HANDLE_SIZE]);
 
   signals [RESIZE_DRAG_BEGIN] =
     g_signal_new ("resize-drag-begin",
diff --git a/lib/sp-visualizer-row.c b/lib/sp-visualizer-row.c
index 3272ccb..f4f82de 100644
--- a/lib/sp-visualizer-row.c
+++ b/lib/sp-visualizer-row.c
@@ -66,22 +66,31 @@ _sp_visualizer_row_get_graph_width (SpVisualizerRow *self)
 }
 
 static void
-sp_visualizer_row_get_preferred_width (GtkWidget *widget,
-                                       gint      *min_width,
-                                       gint      *nat_width)
+sp_visualizer_row_measure (GtkWidget      *widget,
+                           GtkOrientation  orientation,
+                           int             for_size,
+                           int            *minimum,
+                           int            *natural,
+                           int            *minimum_baseline,
+                           int            *natural_baseline)
 {
-  SpVisualizerRow *self = (SpVisualizerRow *)widget;
-  gint graph_width;
-  gint real_min_width = 0;
-  gint real_nat_width = 0;
-
-  g_assert (SP_IS_VISUALIZER_ROW (self));
+  if (orientation == GTK_ORIENTATION_HORIZONTAL)
+    {
+      int real_min_width, real_nat_width;
+      int graph_width;
 
-  GTK_WIDGET_CLASS (sp_visualizer_row_parent_class)->get_preferred_width (widget, &real_min_width, 
&real_nat_width);
+      GTK_WIDGET_CLASS (sp_visualizer_row_parent_class)->measure (widget, orientation, -1,
+                                                                  &real_min_width, &real_nat_width,
+                                                                  NULL, NULL);
 
-  graph_width = _sp_visualizer_row_get_graph_width (self);
+      graph_width = _sp_visualizer_row_get_graph_width (SP_VISUALIZER_ROW (widget));
 
-  *min_width = *nat_width = real_min_width + graph_width;
+      *minimum = *natural = real_min_width + graph_width;
+    }
+  else
+    {
+      *minimum = *natural = 0;
+    }
 }
 
 static void
@@ -144,7 +153,7 @@ sp_visualizer_row_class_init (SpVisualizerRowClass *klass)
   object_class->get_property = sp_visualizer_row_get_property;
   object_class->set_property = sp_visualizer_row_set_property;
 
-  widget_class->get_preferred_width = sp_visualizer_row_get_preferred_width;
+  widget_class->measure = sp_visualizer_row_measure;
 
   properties [PROP_ZOOM_MANAGER] =
     g_param_spec_object ("zoom-manager",
@@ -265,14 +274,12 @@ adjust_alloc_for_borders (SpVisualizerRow *self,
 {
   GtkStyleContext *style_context;
   GtkBorder border;
-  GtkStateFlags state;
 
   g_assert (SP_IS_VISUALIZER_ROW (self));
   g_assert (alloc != NULL);
 
-  state = gtk_widget_get_state_flags (GTK_WIDGET (self));
   style_context = gtk_widget_get_style_context (GTK_WIDGET (self));
-  gtk_style_context_get_border (style_context, state, &border);
+  gtk_style_context_get_border (style_context, &border);
 
   subtract_border (alloc, &border);
 }
diff --git a/lib/sp-visualizer-ticks.c b/lib/sp-visualizer-ticks.c
index 26665ed..0956eb2 100644
--- a/lib/sp-visualizer-ticks.c
+++ b/lib/sp-visualizer-ticks.c
@@ -229,28 +229,31 @@ draw_ticks (SpVisualizerTicks *self,
   return count > 2;
 }
 
-static gboolean
-sp_visualizer_ticks_draw (GtkWidget *widget,
-                          cairo_t   *cr)
+static void
+sp_visualizer_ticks_snapshot (GtkWidget   *widget,
+                              GtkSnapshot *snapshot)
 {
   SpVisualizerTicks *self = SP_VISUALIZER_TICKS (widget);
   GtkStyleContext *style;
   GtkAllocation alloc;
-  GtkStateFlags state;
   gint64 timespan;
   GdkRGBA color;
+  graphene_rect_t bounds;
+  cairo_t *cr;
 
   g_assert (SP_IS_VISUALIZER_TICKS (self));
-  g_assert (cr != NULL);
 
   if (0 == (timespan = self->end_time - self->begin_time))
-    return GDK_EVENT_PROPAGATE;
+    return;
 
   gtk_widget_get_allocation (GTK_WIDGET (self), &alloc);
+  graphene_rect_init (&bounds,
+                      0, 0,
+                      alloc.width, alloc.height);
+  cr = gtk_snapshot_append_cairo (snapshot, &bounds, "visualizer ticks");
 
   style = gtk_widget_get_style_context (widget);
-  state = gtk_widget_get_state_flags (widget);
-  gtk_style_context_get_color (style, state, &color);
+  gtk_style_context_get_color (style, &color);
 
   gdk_cairo_set_source_rgba (cr, &color);
 
@@ -281,17 +284,26 @@ sp_visualizer_ticks_draw (GtkWidget *widget,
       break;
     }
 
-  return GDK_EVENT_PROPAGATE;
+  cairo_destroy (cr);
 }
 
 static void
-sp_visualizer_ticks_get_preferred_height (GtkWidget *widget,
-                                          gint      *min_height,
-                                          gint      *nat_height)
+sp_visualizer_ticks_measure (GtkWidget      *widget,
+                             GtkOrientation  orientation,
+                             int             for_size,
+                             int            *minimum,
+                             int            *natural,
+                             int            *minimum_baseline,
+                             int            *natural_baseline)
 {
-  g_assert (SP_IS_VISUALIZER_TICKS (widget));
-
-  *min_height = *nat_height = tick_sizing[0].height + LABEL_HEIGHT_PX;
+  if (orientation == GTK_ORIENTATION_HORIZONTAL)
+    {
+      *minimum = *natural = 0;
+    }
+  else
+    {
+      *minimum = *natural = tick_sizing[0].height + LABEL_HEIGHT_PX;
+    }
 }
 
 static void
@@ -299,8 +311,8 @@ sp_visualizer_ticks_class_init (SpVisualizerTicksClass *klass)
 {
   GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
 
-  widget_class->draw = sp_visualizer_ticks_draw;
-  widget_class->get_preferred_height = sp_visualizer_ticks_get_preferred_height;
+  widget_class->measure = sp_visualizer_ticks_measure;
+  widget_class->snapshot = sp_visualizer_ticks_snapshot;
 
   gtk_widget_class_set_css_name (widget_class, "ticks");
 }
diff --git a/lib/sp-visualizer-view.c b/lib/sp-visualizer-view.c
index d1e2cfe..17a2b2a 100644
--- a/lib/sp-visualizer-view.c
+++ b/lib/sp-visualizer-view.c
@@ -223,15 +223,17 @@ sp_visualizer_view_hadjustment_value_changed (SpVisualizerView *self,
 }
 
 static void
-sp_visualizer_view_size_allocate (GtkWidget     *widget,
-                                  GtkAllocation *allocation)
+sp_visualizer_view_size_allocate (GtkWidget           *widget,
+                                  const GtkAllocation *allocation,
+                                  int                  baseline,
+                                  GtkAllocation       *out_clip)
 {
   SpVisualizerView *self = (SpVisualizerView *)widget;
 
   g_assert (SP_IS_VISUALIZER_VIEW (self));
   g_assert (allocation != NULL);
 
-  GTK_WIDGET_CLASS (sp_visualizer_view_parent_class)->size_allocate (widget, allocation);
+  GTK_WIDGET_CLASS (sp_visualizer_view_parent_class)->size_allocate (widget, allocation, -1, out_clip);
 
   sp_visualizer_view_update_ticks (self);
 }
@@ -264,17 +266,25 @@ draw_selection_cb (SpSelection *selection,
   gtk_render_background (draw->style_context, draw->cr, area.x, area.y, area.width, area.height);
 }
 
-static gboolean
-sp_visualizer_view_draw (GtkWidget *widget,
-                         cairo_t   *cr)
+static void
+sp_visualizer_view_snapshot (GtkWidget   *widget,
+                             GtkSnapshot *snapshot)
 {
   SpVisualizerView *self = (SpVisualizerView *)widget;
   SpVisualizerViewPrivate *priv = sp_visualizer_view_get_instance_private (self);
   SelectionDraw draw = { 0 };
-  gboolean ret;
+  graphene_rect_t bounds;
+  cairo_t *cr;
 
   g_assert (GTK_IS_WIDGET (widget));
-  g_assert (cr != NULL);
+
+  graphene_rect_init (&bounds,
+                      0, 0,
+                      gtk_widget_get_allocated_width (widget),
+                      gtk_widget_get_allocated_height (widget));
+  cr = gtk_snapshot_append_cairo (snapshot, &bounds, "multi paned");
+
+
 
   draw.style_context = gtk_widget_get_style_context (widget);
   draw.self = self;
@@ -282,7 +292,7 @@ sp_visualizer_view_draw (GtkWidget *widget,
 
   gtk_widget_get_allocation (widget, &draw.alloc);
 
-  ret = GTK_WIDGET_CLASS (sp_visualizer_view_parent_class)->draw (widget, cr);
+  GTK_WIDGET_CLASS (sp_visualizer_view_parent_class)->snapshot (widget, snapshot);
 
   if (sp_selection_get_has_selection (priv->selection) || priv->button_pressed)
     {
@@ -293,7 +303,7 @@ sp_visualizer_view_draw (GtkWidget *widget,
       gtk_style_context_remove_class (draw.style_context, "selection");
     }
 
-  return ret;
+  cairo_destroy (cr);
 }
 
 static gboolean
@@ -398,7 +408,10 @@ sp_visualizer_view_list_realize_after (SpVisualizerView *self,
   window = gtk_widget_get_window (GTK_WIDGET (list));
   display = gdk_window_get_display (window);
   cursor = gdk_cursor_new_from_name (display, "text");
-  gdk_window_set_cursor (window, cursor);
+
+  /* TODO: gtk_widget_set_cursor is still private */
+  /*gdk_window_set_cursor (window, cursor);*/
+
   g_clear_object (&cursor);
 }
 
@@ -482,7 +495,7 @@ sp_visualizer_view_class_init (SpVisualizerViewClass *klass)
   object_class->get_property = sp_visualizer_view_get_property;
   object_class->set_property = sp_visualizer_view_set_property;
 
-  widget_class->draw = sp_visualizer_view_draw;
+  widget_class->snapshot = sp_visualizer_view_snapshot;
   widget_class->size_allocate = sp_visualizer_view_size_allocate;
 
   properties [PROP_READER] =
diff --git a/src/resources/ui/sp-window.ui b/src/resources/ui/sp-window.ui
index 005c31e..705eb2c 100644
--- a/src/resources/ui/sp-window.ui
+++ b/src/resources/ui/sp-window.ui
@@ -201,12 +201,12 @@
     <property name="min-zoom">0.01</property>
   </object>
   <object class="GtkPopover" id="gear_popover">
-    <property name="border-width">12</property>
     <property name="width-request">225</property>
     <child>
       <object class="GtkBox">
         <property name="orientation">vertical</property>
         <property name="visible">true</property>
+        <property name="margin">12</property>
         <child>
           <object class="GtkBox">
             <property name="hexpand">true</property>


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