banshee r3953 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Sources.Gui src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastManager/Source src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView



Author: gburt
Date: Thu May 22 05:43:10 2008
New Revision: 3953
URL: http://svn.gnome.org/viewvc/banshee?rev=3953&view=rev

Log:
2008-05-21  Scott Peterson  <lunchtimemama gmail com>

	* src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastManager/Source/PodcastSourceContents.cs:
	* src/Core/Banshee.ThickClient/Banshee.Sources.Gui/CompositeTrackSourceContents.cs:
	Add null checks to avoid NRE.

	* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Windowing.cs:
	* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs:
	* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs:
	* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs:
	Removed rendering canvases.

	* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs:
	Removed rendering canvases and fixed some bugaboos with cell event
	proxying.



Modified:
   trunk/banshee/ChangeLog
   trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/CompositeTrackSourceContents.cs
   trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastManager/Source/PodcastSourceContents.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
   trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Windowing.cs

Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/CompositeTrackSourceContents.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/CompositeTrackSourceContents.cs	(original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Sources.Gui/CompositeTrackSourceContents.cs	Thu May 22 05:43:10 2008
@@ -66,8 +66,12 @@
         
         protected override void ClearFilterSelections ()
         {
-            artist_view.Selection.Clear ();
-            album_view.Selection.Clear ();
+            if (artist_view.Model != null) {
+                artist_view.Selection.Clear ();
+            }
+            if (album_view.Model != null) {
+                album_view.Selection.Clear ();
+            }
         }
 
         public void SetModels (TrackListModel track, IListModel<ArtistInfo> artist, IListModel<AlbumInfo> album)

Modified: trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastManager/Source/PodcastSourceContents.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastManager/Source/PodcastSourceContents.cs	(original)
+++ trunk/banshee/src/Extensions/Banshee.Podcasting/Banshee.Podcasting.Gui/PodcastManager/Source/PodcastSourceContents.cs	Thu May 22 05:43:10 2008
@@ -68,7 +68,9 @@
         
         protected override void ClearFilterSelections ()
         {
-            feed_view.Selection.Clear ();
+            if (feed_view.Model != null) {
+                feed_view.Selection.Clear ();
+            }
         }
 
         protected override bool ActiveSourceCanHasBrowser {

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs	Thu May 22 05:43:10 2008
@@ -242,7 +242,6 @@
         {
             InvalidateColumnCache ();
             RegenerateColumnCache ();
-            RegenerateCanvases ();
             UpdateAdjustments ();
             QueueDraw ();
         }
@@ -420,7 +419,6 @@
             set { 
                 header_visible = value;
                 MoveResize (Allocation);
-                RegenerateCanvases ();
             }
         }
         

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs	Thu May 22 05:43:10 2008
@@ -200,53 +200,38 @@
 #region Cell Event Proxy        
         
         private IInteractiveCell last_icell;
-        private Gdk.Rectangle last_icell_area;
+        private Gdk.Rectangle last_icell_area = Gdk.Rectangle.Zero;
         
         private void ProxyEventToCell (Gdk.Event evnt, bool press)
         {
             IInteractiveCell icell;
-            Gdk.Rectangle [] damage = new Gdk.Rectangle[2];
-            damage[0] = ProxyEventToCellNoDraw (evnt, press, out icell);
+            Gdk.Rectangle icell_area;
+            bool redraw = ProxyEventToCell (evnt, press, out icell, out icell_area);
             
-            if (last_icell != null && last_icell != icell) {
-                if (last_icell.PointerLeaveEvent ()) {
-                    damage[1] = last_icell_area;
+            if (last_icell_area != icell_area) {
+                if (last_icell != null && last_icell.PointerLeaveEvent ()) {
+                    QueueDrawArea (last_icell_area.X, last_icell_area.Y, last_icell_area.Width, last_icell_area.Height);
                 }
-                
-                last_icell = null;
-                last_icell_area = Gdk.Rectangle.Zero;
+                last_icell = icell;
+                last_icell_area = icell_area;
             }
             
-            if (damage[0].Equals (damage[1])) {
-                if (damage[0].Equals (Gdk.Rectangle.Zero)) {
-                    return;
-                }
-                
-                // FIXME: Should be QueueDrawArea (damage[0]...)
-                QueueDraw ();
-            } else {
-                // FIXME: When QueueDrawArea works, use this
-                // foreach (Gdk.Rectangle area in damage) {
-                //     if (!area.Equals (Gdk.Rectangle.Zero)) {
-                //         QueueDrawArea (area.X, area.Y, area.Width, area.Height);
-                //     }
-                // }
-                
-                QueueDraw (); 
+            if (redraw) {
+                QueueDrawArea (icell_area.X, icell_area.Y, icell_area.Width, icell_area.Height);
             }
         }
         
-        private Gdk.Rectangle ProxyEventToCellNoDraw (Gdk.Event evnt, bool press, out IInteractiveCell icell)
+        private bool ProxyEventToCell (Gdk.Event evnt, bool press, out IInteractiveCell icell, out Gdk.Rectangle icell_area)
         {
-            int evnt_x, evnt_y;
-            Gdk.Rectangle damage = Gdk.Rectangle.Zero;
+            icell = null;
+            icell_area = Gdk.Rectangle.Zero;
+            
+            int evnt_x;
+            int evnt_y;
             
             Gdk.EventButton evnt_button = evnt as Gdk.EventButton;
             Gdk.EventMotion evnt_motion = evnt as Gdk.EventMotion;
             
-            bool redraw = false;
-            icell = null;
-            
             if (evnt_motion != null) {
                 evnt_x = (int)evnt_motion.X;
                 evnt_y = (int)evnt_motion.Y;
@@ -255,7 +240,8 @@
                 evnt_y = (int)evnt_button.Y;
             } else {
                 // Possibly EventCrossing, for the leave event
-                return damage;
+                icell = last_icell;
+                return false;
             }
             
             int y = evnt_y - list_interaction_alloc.Y;
@@ -263,24 +249,23 @@
             
             int row_index = GetRowAtY (y);
             if (row_index < 0 || row_index >= Model.Count) {
-                return damage;
+                return false;
             }
             
             Column column = GetColumnAt (x);
             if (column == null) {
-                return damage;
+                return false;
             }
             
             CachedColumn cached_column = GetCachedColumnForColumn (column);
             
             ColumnCell cell = column.GetCell (0);
             icell = cell as IInteractiveCell;
+            
             if (icell == null) {
-                return damage;
+                return false;
             }
             
-            last_icell = icell;
-            
             // Turn the view-absolute coordinates into cell-relative coordinates
             x -= cached_column.X1;
             int page_offset = (int)vadjustment.Value % RowHeight;
@@ -289,26 +274,15 @@
             // Bind the row to the cell and then send it a synthesized input event
             cell.BindListItem (model[row_index]);
             
-            if (evnt_motion != null) {
-                redraw |= icell.MotionEvent (x, y, evnt_motion);
-            } else if (evnt_button != null) {
-                redraw |= icell.ButtonEvent (x, y, press, evnt_button);
-            }
+            bool redraw = (evnt_motion != null)
+                ? icell.MotionEvent (x, y, evnt_motion) : icell.ButtonEvent (x, y, press, evnt_button);
             
-            // FIXME: This rectangle might not be correct, but I don't
-            // think QueueDrawArea works at all... maybe Scott has
-            // some insight? I smell issues with the blit canvases
-            // --Aaron
-            if (redraw) {
-                damage.X = cached_column.X1;
-                damage.Y = (int)GetYAtRow (row_index);
-                damage.Width = cached_column.Width;
-                damage.Height = RowHeight;
-                
-                last_icell_area = damage;
-            }
+            icell_area.X = cached_column.X1 + Allocation.X;
+            icell_area.Y = (int)GetYAtRow (row_index) + list_interaction_alloc.Y + Allocation.Y;
+            icell_area.Width = cached_column.Width;
+            icell_area.Height = RowHeight;
             
-            return damage;
+            return redraw;
         }   
         
 #endregion
@@ -440,8 +414,7 @@
                 pressed_column_is_dragging = false;
                 pressed_column_index = -1;
                 GdkWindow.Cursor = null;
-                InvalidateHeader ();
-                InvalidateList ();
+                QueueDraw ();
                 return true;
             }
             
@@ -681,12 +654,12 @@
         private void OnHadjustmentChanged (object o, EventArgs args)
         {
             InvalidateHeader ();
-            InvalidateList (false);
+            InvalidateList ();
         }
         
         private void OnVadjustmentChanged (object o, EventArgs args)
         {
-            InvalidateList (false);
+            InvalidateList ();
         }
         
         public void ScrollTo (double val)

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs	Thu May 22 05:43:10 2008
@@ -99,7 +99,6 @@
             }
             
             if (Parent is ScrolledWindow) {
-                render_everything = true;
                 Parent.QueueDraw ();
             }
         }

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs	Thu May 22 05:43:10 2008
@@ -42,21 +42,6 @@
 
     public partial class ListView<T> : Widget
     {
-        // The list is rendered to an off-screen Drawable; the "canvas". The canvas is large enough to hold
-        // the maximum number of rows that can be seen in the list. When new rows comes into view b/c of
-        // scrolling, the contents of the canvas are shifted up or down (depending on whether the user is
-        // scrolling up or down) to accommodate the new rows. The new rows are then painted in situ on the
-        // canvas. The canvas is then painted onto the GdkWindow, offset properly. This means that a row
-        // is only rendered once when it comes into view and that rendering persists on the canvas for as
-        // long as that row remains in view.
-        
-        private Pixmap canvas1;
-        private Pixmap canvas2;
-        private Rectangle canvas_alloc;
-        private int canvas_first_row;
-        private int canvas_last_row;
-        private bool render_everything;
-        
         private Cairo.Context cairo_context;
         private CellContext cell_context;
         private Pango.Layout pango_layout;
@@ -85,39 +70,22 @@
                 damage = damage.Union (rect);
             }
             
-            // First we create a cairo context for rendering to the GdkWindow.
             cairo_context = CairoHelper.Create (evnt.Window);
+            CairoExtensions.CreateLayout (this, cairo_context, ref pango_layout);
+            cell_context.Context = cairo_context;
+            cell_context.Layout = pango_layout;
             
-            // We render the background, the header (if we have one), and the
-            // border to the GdkWindow.
             Theme.DrawFrameBackground (cairo_context, Allocation, true);
             if (header_visible && column_controller != null) {
                 PaintHeader (damage);
             }
-            
             Theme.DrawFrameBorder (cairo_context, Allocation);
-            
-            // Then we render the list to the offscreen canvas.
-            if (canvas1 == null) {
-                canvas1 = new Pixmap (GdkWindow, canvas_alloc.Width, canvas_alloc.Height);
-                render_everything = true;
-            }
-            
-            PaintList ();
-            
-            // Now we blit the offscreen canvas onto the GdkWindow.
-            GdkWindow.DrawDrawable (Style.BaseGC (StateType.Normal), canvas1,
-                (int)hadjustment.Value, (int)vadjustment.Value % RowHeight,
-                list_rendering_alloc.X, list_rendering_alloc.Y,
-                list_rendering_alloc.Width, list_rendering_alloc.Height);
-            
-            // Finally, render the dragging box and dispose of the cairo context.
+            PaintRows(damage);
             PaintDraggingColumn (damage);
+            
             ((IDisposable)cairo_context.Target).Dispose ();
             ((IDisposable)cairo_context).Dispose ();
             
-            render_everything = false;
-            
             return true;
         }
         
@@ -129,16 +97,14 @@
             cairo_context.Rectangle (clip.X, clip.Y, clip.Width, clip.Height);
             cairo_context.Clip ();
             
-            CairoExtensions.CreateLayout (this, cairo_context, ref pango_layout);
             Theme.DrawHeaderBackground (cairo_context, header_rendering_alloc);
             
             Rectangle cell_area = new Rectangle ();
             cell_area.Y = header_rendering_alloc.Y;
             cell_area.Height = header_rendering_alloc.Height;
             
-            cell_context.Context = cairo_context;
-            cell_context.Drawable = GdkWindow;
-            cell_context.Layout = pango_layout;
+            cell_context.Clip = clip;
+            cell_context.Sensitive = true;
             cell_context.TextAsForeground = true;
 
             for (int ci = 0; ci < column_cache.Length; ci++) {
@@ -148,19 +114,19 @@
                 
                 cell_area.X = column_cache[ci].X1 + Theme.TotalBorderWidth + header_rendering_alloc.X - (int)hadjustment.Value;
                 cell_area.Width = column_cache[ci].Width;
-                PaintHeaderCell (cell_area, clip, ci, false);
+                PaintHeaderCell (cell_area, ci, false);
             }
             
             if (pressed_column_is_dragging && pressed_column_index >= 0) {
                 cell_area.X = pressed_column_x_drag + Allocation.X - (int)hadjustment.Value;
                 cell_area.Width = column_cache[pressed_column_index].Width;
-                PaintHeaderCell (cell_area, clip, pressed_column_index, true);
+                PaintHeaderCell (cell_area, pressed_column_index, true);
             }
             
             cairo_context.ResetClip ();
         }
         
-        private void PaintHeaderCell (Rectangle area, Rectangle clip, int ci, bool dragging)
+        private void PaintHeaderCell (Rectangle area, int ci, bool dragging)
         {
             if (ci < 0 || column_cache.Length <= ci)
                 return;
@@ -187,8 +153,6 @@
                 cairo_context.Save ();
                 cairo_context.Translate (area.X, area.Y);
                 cell_context.Area = area;
-                cell_context.Clip = clip;
-                cell_context.Sensitive = true;
                 cell.Render (cell_context, StateType.Normal, area.Width, area.Height);
                 cairo_context.Restore ();
             }
@@ -197,9 +161,10 @@
                 Theme.DrawHeaderSeparator (cairo_context, area, area.Right);
             }
         }
-
-        private void PaintList ()
+        
+        private void PaintRows (Rectangle clip)
         {
+            // TODO factor this out?
             // Render the sort effect to the GdkWindow.
             if (sort_column_index != -1 && (!pressed_column_is_dragging || pressed_column_index != sort_column_index)) {
                 CachedColumn col = column_cache[sort_column_index];
@@ -208,108 +173,25 @@
                     header_rendering_alloc.Bottom + Theme.BorderWidth,
                     col.Width, list_rendering_alloc.Height + Theme.InnerBorderWidth * 2);
             }
-
-            int rows_in_view = RowsInView;
-            int top = (int)vadjustment.Value / RowHeight;
-            int bottom = top + rows_in_view;
-            
-            if (!render_everything && canvas_first_row == top && canvas_last_row == bottom) {
-                // We haven't been told to render everything, and all of the same rows are
-                // still in view, so we don't render anything.
-                return;
-            }
-            
-            // Swap the canvases if nessisary
-            if (canvas2 == null) {
-                canvas2 = new Pixmap (GdkWindow, canvas_alloc.Width, canvas_alloc.Height);
-            } else {
-                Pixmap tmp = canvas1;
-                canvas1 = canvas2;
-                canvas2 = tmp;
-            }
-            
-            // Build a cairo context for the primary canvas.
-            Cairo.Context tmp_cr = cairo_context;
-            cairo_context = CairoHelper.Create (canvas1);
-            CairoExtensions.CreateLayout (this, cairo_context, ref pango_layout);
-            
-            // Render the background to the primary canvas.
-            Theme.DrawListBackground (cairo_context, canvas_alloc, true);
             
-            // Render the sort effect to the canvas.
-            if (sort_column_index != -1 && (!pressed_column_is_dragging || pressed_column_index != sort_column_index)) {
-                CachedColumn col = column_cache[sort_column_index];
-                Theme.PushContext ();
-                Theme.Context.FillAlpha = 0.5;
-                Theme.DrawRowRule (cairo_context, col.X1, 0, col.Width, canvas_alloc.Height);
-                Theme.PopContext ();
-            }
-            
-            int first_row = top;
-            int last_row = bottom;
-            int first_row_y = 0;
-            
-            if (render_everything) {
-                // We need to render everything
-            } else if (canvas_last_row < last_row && canvas_last_row > first_row) {
-                // We're scrolling down, so shift the contents of the list up and
-                // render the new stuff in situ at the bottom.
-                int delta = (last_row - canvas_last_row) * RowHeight;
-                canvas1.DrawDrawable (Style.BaseGC (StateType.Normal), canvas2, 0, delta, 0, 0,
-                    canvas_alloc.Width, canvas_alloc.Height - delta);
-                
-                // If the bottom of the stuff we're shifting up is part of a selection
-                // that continues down into the new stuff, be sure that we render the
-                // whole selection block so the gradient looks nice.
-                while (Selection != null && Selection.Contains (canvas_last_row) && canvas_last_row > first_row) {
-                    canvas_last_row--;
-                }
-                
-                first_row_y = (canvas_last_row - first_row) * RowHeight;
-                first_row = canvas_last_row;
-            } else if (canvas_first_row > first_row && canvas_first_row < last_row) {
-                // We're scrolling up, so shift the contents of the list down and
-                // render the new stuff in situ at the top.
-                int delta = (canvas_first_row - first_row) * RowHeight;
-                canvas1.DrawDrawable (Style.BaseGC (StateType.Normal), canvas2, 0, 0, 0, delta,
-                    canvas_alloc.Width, canvas_alloc.Height - delta);
-                
-                // If the top of the stuff we're shifting down is part of a selection
-                // that continues up into the new stuff, be sure that we render the
-                // whole selection block so the gradient looks nice.
-                while (Selection != null && Selection.Contains (canvas_first_row) && canvas_first_row < last_row) {
-                    canvas_first_row++;
-                }
-                
-                last_row = canvas_first_row;
-            }
-            
-            if (model != null) {
-                PaintRows (first_row, Math.Min (model.Count, last_row), first_row_y);
-            }
-            
-            // Destroy the cairo context.
-            ((IDisposable)cairo_context.Target).Dispose ();
-            ((IDisposable)cairo_context).Dispose ();
-            cairo_context = tmp_cr;
+            clip.Intersect (list_rendering_alloc);
+            cairo_context.Rectangle (clip.X, clip.Y, clip.Width, clip.Height);
+            cairo_context.Clip ();
             
-            canvas_first_row = top;
-            canvas_last_row = bottom;
-        }
-        
-        private void PaintRows (int first_row, int last_row, int first_row_y)
-        {
-            cell_context.Context = cairo_context;
-            cell_context.Drawable = canvas1;
-            cell_context.Layout = pango_layout;
-            cell_context.Clip = canvas_alloc;
+            cell_context.Clip = clip;
             cell_context.TextAsForeground = false;
             
+            int vadjustment_value = (int)vadjustment.Value;
+            int first_row = vadjustment_value / RowHeight;
+            int last_row = Math.Min (model.Count, first_row + RowsInView);
+            int offset = list_rendering_alloc.Y - vadjustment_value % RowHeight;
+            
             Rectangle selected_focus_alloc = Rectangle.Zero;
             Rectangle single_list_alloc = new Rectangle ();
             
-            single_list_alloc.Y = first_row_y;
-            single_list_alloc.Width = canvas_alloc.Width;
+            single_list_alloc.X = list_rendering_alloc.X - (int)(hadjustment.Value);
+            single_list_alloc.Y = offset;
+            single_list_alloc.Width = list_rendering_alloc.Width;
             single_list_alloc.Height = RowHeight;
             
             int selection_height = 0;
@@ -362,7 +244,7 @@
                     }
                     
                     if (selection_height > 0) {
-                        Theme.DrawRowSelection (cairo_context, 0, selection_y, canvas_alloc.Width, selection_height);
+                        Theme.DrawRowSelection (cairo_context, list_rendering_alloc.X, selection_y, list_rendering_alloc.Width, selection_height);
                         selection_height = 0;
                     }
                     
@@ -373,8 +255,8 @@
             }
             
             if (selection_height > 0) {
-                Theme.DrawRowSelection (cairo_context, 0, selection_y, 
-                    canvas_alloc.Width, selection_height);
+                Theme.DrawRowSelection (cairo_context, list_rendering_alloc.X, selection_y, 
+                    list_rendering_alloc.Width, selection_height);
             }
             
             if (Selection != null && Selection.Count > 1 && 
@@ -385,9 +267,11 @@
             }
             
             foreach (int ri in selected_rows) {
-                single_list_alloc.Y = (ri - first_row) * single_list_alloc.Height + first_row_y;
+                single_list_alloc.Y = offset + ((ri - first_row) * single_list_alloc.Height);
                 PaintRow (ri, single_list_alloc, StateType.Selected);
             }
+            
+            cairo_context.ResetClip ();
         }
 
         private void PaintRow (int row_index, Rectangle area, StateType state)
@@ -415,7 +299,7 @@
             
             if (pressed_column_is_dragging && pressed_column_index >= 0) {
                 cell_area.Width = column_cache[pressed_column_index].Width;
-                cell_area.X = pressed_column_x_drag - list_interaction_alloc.X;
+                cell_area.X = pressed_column_x_drag + list_rendering_alloc.X - list_interaction_alloc.X;
                 PaintCell (item, pressed_column_index, row_index, cell_area, sensitive, state, true);
             }
         }
@@ -474,31 +358,17 @@
             cairo_context.Stroke ();
         }
         
-        public new void QueueDraw ()
-        {
-            InvalidateHeader ();
-            InvalidateList ();
-        }
-        
         private void InvalidateList ()
         {
-            InvalidateList (true);
-        }
-        
-        private void InvalidateList (bool render_everything)
-        {
             if (IsRealized) {
-                this.render_everything |= render_everything;
-                GdkWindow.InvalidateRect (list_rendering_alloc, true);
-                base.QueueDraw ();
+                QueueDrawArea (list_rendering_alloc.X, list_rendering_alloc.Y, list_rendering_alloc.Width, list_rendering_alloc.Height);
             }
         }
         
         private void InvalidateHeader ()
         {
             if (IsRealized) {
-                GdkWindow.InvalidateRect (header_rendering_alloc, true);
-                base.QueueDraw ();
+                QueueDrawArea (header_rendering_alloc.X, header_rendering_alloc.Y, header_rendering_alloc.Width, header_rendering_alloc.Height);
             }
         }
         

Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Windowing.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Windowing.cs	(original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Windowing.cs	Thu May 22 05:43:10 2008
@@ -52,6 +52,7 @@
             WidgetFlags |= WidgetFlags.Realized | WidgetFlags.NoWindow;
             
             GdkWindow = Parent.GdkWindow;
+            cell_context.Drawable = GdkWindow;
             
             WindowAttr attributes = new WindowAttr ();
             attributes.WindowType = Gdk.WindowType.Child;
@@ -77,7 +78,6 @@
             
             OnDragSourceSet ();
             MoveResize (Allocation);
-            RegenerateCanvases ();
             
             base.OnRealized ();
         }
@@ -90,8 +90,6 @@
             event_window.Destroy ();
             event_window = null;
             
-            DisposeCanvases ();
-            
             base.OnUnrealized ();
         }
         
@@ -134,30 +132,6 @@
             header_width = header_interaction_alloc.Width;
         }
         
-        private void RegenerateCanvases ()
-        {
-            int canvas_width = Math.Max (1, header_width);
-            int canvas_height = Math.Max (1, RowsInView * RowHeight);
-            
-            if (canvas_alloc.Width != canvas_width || canvas_alloc.Height != canvas_height) {
-                DisposeCanvases ();
-                canvas_alloc.Width = canvas_width;
-                canvas_alloc.Height = canvas_height;
-            }
-        }
-        
-        private void DisposeCanvases ()
-        {
-            if (canvas1 != null) {
-                canvas1.Dispose ();
-                canvas1 = null;
-            }
-            if (canvas2 != null) {
-                canvas2.Dispose ();
-                canvas2 = null;
-            }
-        }
-        
         protected override void OnSizeRequested (ref Requisition requisition)
         {
             // TODO give the minimum height of the header
@@ -179,7 +153,6 @@
             MoveResize (allocation);
             RecalculateColumnSizes ();
             RegenerateColumnCache ();
-            RegenerateCanvases ();
            
             if (vadjustment != null) {
                 hadjustment.PageSize = header_interaction_alloc.Width;
@@ -194,7 +167,7 @@
                 model.RowsInView = RowsInView;
             }
             
-            InvalidateList (false);
+            InvalidateList ();
         }
         
         private int RowsInView {



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