banshee r3754 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Gui.Widgets src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView src/Libraries/Hyena.Gui/Hyena.Widgets
- From: scottp svn gnome org
- To: svn-commits-list gnome org
- Subject: banshee r3754 - in trunk/banshee: . src/Core/Banshee.ThickClient/Banshee.Gui.Widgets src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView src/Libraries/Hyena.Gui/Hyena.Widgets
- Date: Thu, 10 Apr 2008 23:40:09 +0100 (BST)
Author: scottp
Date: Thu Apr 10 23:40:08 2008
New Revision: 3754
URL: http://svn.gnome.org/viewvc/banshee?rev=3754&view=rev
Log:
* src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs:
We now inherit from Widget and render to the parent GdkWindow and
call base.OnRealize (). This fixes BGO #524429.
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs:
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Windowing.cs:
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Header.cs:
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Rendering.cs:
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Interaction.cs:
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView.cs:
* src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_Model.cs:
Call base.OnRealize () and inherit from Widget.
* src/Libraries/Hyena.Gui/Hyena.Widgets/MenuButton.cs:
* src/Libraries/Hyena.Gui/Hyena.Widgets/AnimatedWidget.cs:
* src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/VideoDisplay.cs:
* src/Libraries/Hyena.Gui/Hyena.Widgets/AnimatedBox.cs: Call
base.OnRealize ().
Modified:
trunk/banshee/ChangeLog
trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs
trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/VideoDisplay.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.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
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/AnimatedBox.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/AnimatedWidget.cs
trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/MenuButton.cs
Modified: trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs
==============================================================================
--- trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs (original)
+++ trunk/banshee/src/Core/Banshee.ThickClient/Banshee.Gui.Widgets/TrackInfoDisplay.cs Thu Apr 10 23:40:08 2008
@@ -32,7 +32,7 @@
using Mono.Unix;
using Gtk;
-using Cairo;
+using Gdk;
using Hyena;
using Hyena.Gui;
@@ -46,13 +46,15 @@
namespace Banshee.Gui.Widgets
{
- public class TrackInfoDisplay : Bin
+ public class TrackInfoDisplay : Widget
{
+ private Gdk.Window event_window;
+
private ArtworkManager artwork_manager;
- private Gdk.Pixbuf current_pixbuf;
- private Gdk.Pixbuf incoming_pixbuf;
- private Gdk.Pixbuf missing_audio_pixbuf;
- private Gdk.Pixbuf missing_video_pixbuf;
+ private Pixbuf current_pixbuf;
+ private Pixbuf incoming_pixbuf;
+ private Pixbuf missing_audio_pixbuf;
+ private Pixbuf missing_video_pixbuf;
private Cairo.Color background_color;
private Cairo.Color text_color;
@@ -106,57 +108,52 @@
protected override void OnRealized ()
{
- WidgetFlags |= WidgetFlags.Realized;
+ WidgetFlags |= WidgetFlags.Realized | WidgetFlags.NoWindow;
+ GdkWindow = Parent.GdkWindow;
- Gdk.WindowAttr attributes = new Gdk.WindowAttr ();
+ WindowAttr attributes = new WindowAttr ();
attributes.WindowType = Gdk.WindowType.Child;
attributes.X = Allocation.X;
attributes.Y = Allocation.Y;
attributes.Width = Allocation.Width;
attributes.Height = Allocation.Height;
- attributes.Visual = Visual;
- attributes.Wclass = Gdk.WindowClass.InputOutput;
- attributes.Colormap = Colormap;
+ attributes.Wclass = WindowClass.InputOnly;
attributes.EventMask = (int)(
- Gdk.EventMask.VisibilityNotifyMask |
- Gdk.EventMask.ExposureMask |
- Gdk.EventMask.PointerMotionMask |
- Gdk.EventMask.EnterNotifyMask |
- Gdk.EventMask.LeaveNotifyMask |
- Events);
-
- Gdk.WindowAttributesType attributes_mask =
- Gdk.WindowAttributesType.X |
- Gdk.WindowAttributesType.Y |
- Gdk.WindowAttributesType.Visual |
- Gdk.WindowAttributesType.Colormap;
-
- GdkWindow = new Gdk.Window (Parent.GdkWindow, attributes, attributes_mask);
- GdkWindow.UserData = Handle;
+ EventMask.PointerMotionMask |
+ EventMask.EnterNotifyMask |
+ EventMask.LeaveNotifyMask |
+ EventMask.ExposureMask);
+
+ WindowAttributesType attributes_mask =
+ WindowAttributesType.X | WindowAttributesType.Y | WindowAttributesType.Wmclass;
- GdkWindow.SetBackPixmap (null, false);
- Style.SetBackground (GdkWindow, StateType.Normal);
- Style = Style.Attach (GdkWindow);
+ event_window = new Gdk.Window (GdkWindow, attributes, attributes_mask);
+ event_window.UserData = Handle;
+
+ base.OnRealized ();
}
protected override void OnUnrealized ()
{
WidgetFlags ^= WidgetFlags.Realized;
- GdkWindow.UserData = IntPtr.Zero;
- GdkWindow.Destroy ();
- GdkWindow = null;
+
+ event_window.UserData = IntPtr.Zero;
+ event_window.Destroy ();
+ event_window = null;
+
+ base.OnUnrealized ();
}
-
+
protected override void OnMapped ()
{
- WidgetFlags |= WidgetFlags.Mapped;
- GdkWindow.Show ();
+ event_window.Show ();
+ base.OnMapped ();
}
-
+
protected override void OnUnmapped ()
{
- WidgetFlags ^= WidgetFlags.Mapped;
- GdkWindow.Hide ();
+ event_window.Hide ();
+ base.OnUnmapped ();
}
protected override void OnSizeAllocated (Gdk.Rectangle allocation)
@@ -164,14 +161,12 @@
base.OnSizeAllocated (allocation);
if (IsRealized) {
- GdkWindow.MoveResize (allocation);
+ event_window.MoveResize (allocation);
}
if (current_track == null) {
LoadCurrentTrack ();
}
-
- QueueDraw ();
}
protected override void OnSizeRequested (ref Requisition requisition)
@@ -193,19 +188,19 @@
#region Interaction Events
- protected override bool OnEnterNotifyEvent (Gdk.EventCrossing evnt)
+ protected override bool OnEnterNotifyEvent (EventCrossing evnt)
{
in_thumbnail_region = evnt.X <= Allocation.Height;
return ShowHideCoverArt ();
}
- protected override bool OnLeaveNotifyEvent (Gdk.EventCrossing evnt)
+ protected override bool OnLeaveNotifyEvent (EventCrossing evnt)
{
in_thumbnail_region = false;
return ShowHideCoverArt ();
}
- protected override bool OnMotionNotifyEvent (Gdk.EventMotion evnt)
+ protected override bool OnMotionNotifyEvent (EventMotion evnt)
{
in_thumbnail_region = evnt.X <= Allocation.Height;
return ShowHideCoverArt ();
@@ -261,6 +256,8 @@
protected override void OnStyleSet (Style previous)
{
+ base.OnStyleSet (previous);
+
text_color = CairoExtensions.GdkColorToCairoColor (Style.Foreground (StateType.Normal));
background_color = CairoExtensions.GdkColorToCairoColor (Style.Background (StateType.Normal));
text_light_color = Hyena.Gui.Theming.GtkTheme.GetCairoTextMidColor (this);
@@ -276,38 +273,22 @@
}
}
- protected override bool OnExposeEvent (Gdk.EventExpose evnt)
+ protected override bool OnExposeEvent (EventExpose evnt)
{
- if (!Visible || !IsMapped) {
+ if (!Visible || !IsMapped || (incoming_track == null && current_track == null)) {
return true;
}
-
- Style.ApplyDefaultBackground (GdkWindow, true, StateType.Normal, evnt.Area,
- 0, 0, Allocation.Width, Allocation.Height);
-
+
Cairo.Context cr = Gdk.CairoHelper.Create (evnt.Window);
-
- foreach (Gdk.Rectangle rect in evnt.Region.GetRectangles ()) {
- PaintRegion (cr, evnt, rect);
- }
-
+ cr.Rectangle (Allocation.X, Allocation.Y, Allocation.Width, Allocation.Height);
+ cr.Clip ();
+ RenderAnimation (cr);
CairoExtensions.DisposeContext (cr);
- cr = null;
return true;
}
-
- private void PaintRegion (Cairo.Context cr, Gdk.EventExpose evnt, Gdk.Rectangle clip)
- {
- cr.Rectangle (clip.X, clip.Y, clip.Width, clip.Height);
- cr.Clip ();
-
- if (incoming_track != null || current_track != null) {
- RenderAnimation (cr, clip);
- }
- }
- private void RenderAnimation (Cairo.Context cr, Gdk.Rectangle clip)
+ private void RenderAnimation (Cairo.Context cr)
{
if (stage.Actor == null) {
// We are not in a transition, just render
@@ -324,11 +305,8 @@
cr.PaintWithAlpha (stage.Actor.Percent);
return;
}
-
+
// XFade only the cover art
- cr.Rectangle (0, 0, Allocation.Height, Allocation.Height);
- cr.Clip ();
-
RenderCoverArt (cr, incoming_pixbuf);
CairoExtensions.PushGroup (cr);
@@ -336,19 +314,15 @@
CairoExtensions.PopGroupToSource (cr);
cr.PaintWithAlpha (1.0 - stage.Actor.Percent);
-
+
// Fade in/out the text
- cr.ResetClip ();
- cr.Rectangle (clip.X, clip.Y, clip.Width, clip.Height);
- cr.Clip ();
-
bool same_artist_album = incoming_track != null ? incoming_track.ArtistAlbumEqual (current_track) : false;
bool same_track = incoming_track != null ? incoming_track.Equals (current_track) : false;
if (same_artist_album) {
RenderTrackInfo (cr, incoming_track, same_track, true);
}
-
+
if (stage.Actor.Percent <= 0.5) {
// Fade out old text
CairoExtensions.PushGroup (cr);
@@ -366,19 +340,19 @@
}
}
- private void RenderStage (Cairo.Context cr, TrackInfo track, Gdk.Pixbuf pixbuf)
+ private void RenderStage (Cairo.Context cr, TrackInfo track, Pixbuf pixbuf)
{
RenderCoverArt (cr, pixbuf);
RenderTrackInfo (cr, track, true, true);
}
- private void RenderCoverArt (Cairo.Context cr, Gdk.Pixbuf pixbuf)
+ private void RenderCoverArt (Cairo.Context cr, Pixbuf pixbuf)
{
- ArtworkRenderer.RenderThumbnail (cr, pixbuf, false, 0, 0, Allocation.Height, Allocation.Height,
+ ArtworkRenderer.RenderThumbnail (cr, pixbuf, false, Allocation.X, Allocation.Y, Allocation.Height, Allocation.Height,
!IsMissingPixbuf (pixbuf), 0, IsMissingPixbuf (pixbuf), background_color);
}
- private bool IsMissingPixbuf (Gdk.Pixbuf pb)
+ private bool IsMissingPixbuf (Pixbuf pb)
{
return (pb == missing_audio_pixbuf || pb == missing_video_pixbuf);
}
@@ -389,8 +363,9 @@
return;
}
- double x = Allocation.Height + 10, y = 0;
- double width = Allocation.Width - x;
+ double offset = Allocation.Height + 10, y = 0;
+ double x = Allocation.X + offset;
+ double width = Allocation.Width - offset;
int fl_width, fl_height, sl_width, sl_height;
// Set up the text layouts
@@ -411,7 +386,7 @@
SetSizeRequest (-1, fl_height + sl_height);
}
- y = (Allocation.Height - (fl_height + sl_height)) / 2;
+ y = Allocation.Y + (Allocation.Height - (fl_height + sl_height)) / 2;
// Render the layouts
cr.Antialias = Cairo.Antialias.Default;
@@ -435,15 +410,6 @@
second_line_layout.Dispose ();
}
- public new void QueueDraw ()
- {
- if (GdkWindow != null) {
- GdkWindow.InvalidateRect (new Gdk.Rectangle (0, 0, Allocation.Width, Allocation.Height), false);
- }
-
- base.QueueDraw ();
- }
-
private void OnPlayerEngineEventChanged (object o, PlayerEngineEventArgs args)
{
if (args.Event == PlayerEngineEvent.StartOfStream || args.Event == PlayerEngineEvent.TrackInfoUpdated) {
Modified: trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/VideoDisplay.cs
==============================================================================
--- trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/VideoDisplay.cs (original)
+++ trunk/banshee/src/Extensions/Banshee.NowPlaying/Banshee.NowPlaying/VideoDisplay.cs Thu Apr 10 23:40:08 2008
@@ -95,6 +95,7 @@
GdkWindow.UserData = Handle;
video_window.Reparent (Parent.GdkWindow, Allocation.X, Allocation.Y);
+ base.OnRealized ();
}
protected override void OnUnrealized ()
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView.cs Thu Apr 10 23:40:08 2008
@@ -28,7 +28,7 @@
namespace Hyena.Data.Gui
{
- public partial class ListView<T> : Gtk.Container, IListView<T>
+ public partial class ListView<T> : Gtk.Widget, IListView<T>
{
public ListView ()
{
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Data.Gui/ListView/ListView_DragAndDrop.cs Thu Apr 10 23:40:08 2008
@@ -43,7 +43,7 @@
(uint)TargetType.ModelSelection);
}
- public partial class ListView<T> : Container
+ public partial class ListView<T> : Widget
{
private static TargetEntry [] drag_drop_dest_entries = new TargetEntry [] {
ListViewDragDropTarget.ModelSelection
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 Apr 10 23:40:08 2008
@@ -33,7 +33,7 @@
namespace Hyena.Data.Gui
{
- public partial class ListView<T> : Container
+ public partial class ListView<T> : Widget
{
internal struct CachedColumn
{
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 Apr 10 23:40:08 2008
@@ -35,7 +35,7 @@
namespace Hyena.Data.Gui
{
- public partial class ListView<T> : Container
+ public partial class ListView<T> : Widget
{
private int focused_row_index = -1;
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 Apr 10 23:40:08 2008
@@ -33,7 +33,7 @@
namespace Hyena.Data.Gui
{
- public partial class ListView<T> : Container
+ public partial class ListView<T> : Widget
{
public void SetModel (IListModel<T> model)
{
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 Apr 10 23:40:08 2008
@@ -40,7 +40,7 @@
{
public delegate int ListViewRowHeightHandler (Widget widget);
- public partial class ListView<T> : Container
+ 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
@@ -66,10 +66,14 @@
get { return theme; }
}
- protected override void OnStyleSet (Gtk.Style old_style)
+ protected override void OnStyleSet (Style old_style)
{
base.OnStyleSet (old_style);
RecomputeRowHeight = true;
+ theme = new GtkTheme (this);
+ cell_context = new CellContext ();
+ cell_context.Theme = theme;
+ cell_context.Widget = this;
}
protected override bool OnExposeEvent (EventExpose evnt)
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 Apr 10 23:40:08 2008
@@ -34,7 +34,7 @@
namespace Hyena.Data.Gui
{
- public partial class ListView<T> : Container
+ public partial class ListView<T> : Widget
{
private Rectangle list_rendering_alloc;
private Rectangle header_rendering_alloc;
@@ -52,11 +52,6 @@
WidgetFlags |= WidgetFlags.Realized | WidgetFlags.NoWindow;
GdkWindow = Parent.GdkWindow;
- theme = new GtkTheme (this);
- cell_context = new CellContext ();
- cell_context.Theme = theme;
- cell_context.Widget = this;
- //graphics.RefreshColors ();
WindowAttr attributes = new WindowAttr ();
attributes.WindowType = Gdk.WindowType.Child;
@@ -66,7 +61,6 @@
attributes.Height = Allocation.Height;
attributes.Wclass = WindowClass.InputOnly;
attributes.EventMask = (int)(
- GdkWindow.Events |
EventMask.PointerMotionMask |
EventMask.KeyPressMask |
EventMask.KeyReleaseMask |
@@ -84,6 +78,8 @@
OnDragSourceSet ();
MoveResize (Allocation);
RegenerateCanvases ();
+
+ base.OnRealized ();
}
protected override void OnUnrealized ()
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/AnimatedBox.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/AnimatedBox.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/AnimatedBox.cs Thu Apr 10 23:40:08 2008
@@ -363,6 +363,7 @@
{
WidgetFlags |= WidgetFlags.Realized | WidgetFlags.NoWindow;
GdkWindow = Parent.GdkWindow;
+ base.OnRealized ();
}
protected override void ForAll (bool include_internals, Callback callback)
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/AnimatedWidget.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/AnimatedWidget.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/AnimatedWidget.cs Thu Apr 10 23:40:08 2008
@@ -122,9 +122,9 @@
Gdk.WindowAttributesType.Y;
GdkWindow = new Gdk.Window (Parent.GdkWindow, attributes, attributes_mask);
- Style = Style.Attach (GdkWindow);
GdkWindow.UserData = Handle;
GdkWindow.Background = Style.Background (State);
+ base.OnRealized ();
}
protected override void OnSizeRequested (ref Requisition requisition)
Modified: trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/MenuButton.cs
==============================================================================
--- trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/MenuButton.cs (original)
+++ trunk/banshee/src/Libraries/Hyena.Gui/Hyena.Widgets/MenuButton.cs Thu Apr 10 23:40:08 2008
@@ -82,14 +82,13 @@
{
WidgetFlags |= WidgetFlags.Realized | WidgetFlags.NoWindow;
GdkWindow = Parent.GdkWindow;
- Style = Style.Attach (GdkWindow);
+ base.OnRealized ();
}
protected override void OnUnrealized ()
{
- WidgetFlags &= ~(WidgetFlags.Realized | WidgetFlags.NoWindow);
- GdkWindow = null;
- Style = null;
+ WidgetFlags ^= WidgetFlags.Realized;
+ base.OnUnrealized ();
}
protected override void OnSizeRequested (ref Requisition requisition)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]