This commit is contained in:
Peter Robinson 2010-12-28 19:34:36 +00:00
parent 366c643e74
commit 7d074279f1
4 changed files with 10 additions and 380 deletions

1
.gitignore vendored
View File

@ -2,3 +2,4 @@ clutter-gtk-0.10.4.tar.bz2
/clutter-gtk-0.90.2.tar.bz2
/clutter-gtk-0.91.2.tar.bz2
/clutter-gtk-0.91.4.tar.bz2
/clutter-gtk-0.91.6.tar.bz2

View File

@ -1,372 +0,0 @@
From 5dce4bd149935ad039b4aa1e33eb96a461b36818 Mon Sep 17 00:00:00 2001
From: Emmanuele Bassi <ebassi@linux.intel.com>
Date: Wed, 01 Dec 2010 17:09:33 +0000
Subject: window: Do not use size-request
---
diff --git a/clutter-gtk/gtk-clutter-window.c b/clutter-gtk/gtk-clutter-window.c
index 1087cb1..d572d70 100644
--- a/clutter-gtk/gtk-clutter-window.c
+++ b/clutter-gtk/gtk-clutter-window.c
@@ -63,24 +63,31 @@ gtk_clutter_window_finalize (GObject *self)
}
static void
-gtk_clutter_window_size_request (GtkWidget *self,
- GtkRequisition *requisition)
+gtk_clutter_window_get_preferred_width (GtkWidget *self,
+ gint *minimum,
+ gint *natural)
{
- GtkClutterWindowPrivate *priv;
+ GtkClutterWindowPrivate *priv = GTK_CLUTTER_WINDOW (self)->priv;
GtkWidget *bin;
- g_return_if_fail (GTK_CLUTTER_IS_WINDOW (self));
- priv = GTK_CLUTTER_WINDOW (self)->priv;
-
bin = gtk_clutter_actor_get_widget (GTK_CLUTTER_ACTOR (priv->actor));
+ gtk_widget_get_preferred_width (gtk_bin_get_child (GTK_BIN (bin)),
+ minimum,
+ natural);
+}
- /* find out what the preferred size of the bin contents are, since we
- * can't ask Clutter for some reason (it always returns the allocated
- * size -- why?). This means things like any scaling applied to the actor
- * won't make the window change size (feature?) */
- gtk_widget_get_preferred_size (gtk_bin_get_child (GTK_BIN (bin)),
- requisition,
- NULL);
+static void
+gtk_clutter_window_get_preferred_height (GtkWidget *self,
+ gint *minimum,
+ gint *natural)
+{
+ GtkClutterWindowPrivate *priv = GTK_CLUTTER_WINDOW (self)->priv;
+ GtkWidget *bin;
+
+ bin = gtk_clutter_actor_get_widget (GTK_CLUTTER_ACTOR (priv->actor));
+ gtk_widget_get_preferred_height (gtk_bin_get_child (GTK_BIN (bin)),
+ minimum,
+ natural);
}
static void
@@ -230,7 +237,8 @@ gtk_clutter_window_class_init (GtkClutterWindowClass *klass)
gobject_class->finalize = gtk_clutter_window_finalize;
- widget_class->size_request = gtk_clutter_window_size_request;
+ widget_class->get_preferred_width = gtk_clutter_window_get_preferred_width;
+ widget_class->get_preferred_height = gtk_clutter_window_get_preferred_height;
/* connect all of the container methods up to our bin */
container_class->add = gtk_clutter_window_add;
--
cgit v0.8.3.1-30-gff3a
From 7f1e7e2ae81591e24009b369263d641379f296f9 Mon Sep 17 00:00:00 2001
From: Emmanuele Bassi <ebassi@linux.intel.com>
Date: Wed, 01 Dec 2010 17:10:11 +0000
Subject: offscreen: Do not use size-request
Still, something in either Clutter or GTK+ master broke the widget
embedding.
---
diff --git a/clutter-gtk/gtk-clutter-offscreen.c b/clutter-gtk/gtk-clutter-offscreen.c
index 752cebf..826e06f 100644
--- a/clutter-gtk/gtk-clutter-offscreen.c
+++ b/clutter-gtk/gtk-clutter-offscreen.c
@@ -20,39 +20,31 @@ static void
gtk_clutter_offscreen_add (GtkContainer *container,
GtkWidget *child)
{
- GtkClutterOffscreen *offscreen;
-
- g_return_if_fail (GTK_CLUTTER_IS_OFFSCREEN (container));
-
- offscreen = GTK_CLUTTER_OFFSCREEN (container);
+ GtkClutterOffscreen *offscreen = GTK_CLUTTER_OFFSCREEN (container);
GTK_CONTAINER_CLASS (_gtk_clutter_offscreen_parent_class)->add (container, child);
- if (CLUTTER_ACTOR_IS_VISIBLE (offscreen->actor))
+ if (offscreen->actor != NULL &&
+ CLUTTER_ACTOR_IS_VISIBLE (offscreen->actor))
{
/* force a relayout */
- clutter_actor_set_size (offscreen->actor, -1, -1);
clutter_actor_queue_relayout (offscreen->actor);
}
-
}
static void
gtk_clutter_offscreen_remove (GtkContainer *container,
GtkWidget *child)
{
- GtkClutterOffscreen *offscreen;
-
- g_return_if_fail (GTK_CLUTTER_IS_OFFSCREEN (container));
-
- offscreen = GTK_CLUTTER_OFFSCREEN (container);
+ GtkClutterOffscreen *offscreen = GTK_CLUTTER_OFFSCREEN (container);
GTK_CONTAINER_CLASS (_gtk_clutter_offscreen_parent_class)->remove (container, child);
- if (offscreen->actor != NULL && CLUTTER_ACTOR_IS_VISIBLE (offscreen->actor))
+ if (offscreen->actor != NULL &&
+ CLUTTER_ACTOR_IS_VISIBLE (offscreen->actor))
{
/* force a relayout */
- clutter_actor_set_size (offscreen->actor, -1, -1);
+ clutter_actor_queue_relayout (offscreen->actor);
}
}
@@ -61,16 +53,19 @@ gtk_clutter_offscreen_check_resize (GtkContainer *container)
{
GtkClutterOffscreen *offscreen = GTK_CLUTTER_OFFSCREEN (container);
+ /* queue a relayout only if we're not in the middle of an
+ * allocation
+ */
if (offscreen->actor != NULL && !offscreen->in_allocation)
clutter_actor_queue_relayout (offscreen->actor);
}
static void
-offscreen_window_to_parent (GdkWindow *offscreen_window,
- double offscreen_x,
- double offscreen_y,
- double *parent_x,
- double *parent_y,
+offscreen_window_to_parent (GdkWindow *offscreen_window,
+ double offscreen_x,
+ double offscreen_y,
+ double *parent_x,
+ double *parent_y,
GtkClutterOffscreen *offscreen)
{
ClutterVertex point, vertex;
@@ -84,14 +79,15 @@ offscreen_window_to_parent (GdkWindow *offscreen_window,
}
static void
-offscreen_window_from_parent (GdkWindow *window,
- double parent_x,
- double parent_y,
- double *offscreen_x,
- double *offscreen_y,
+offscreen_window_from_parent (GdkWindow *window,
+ double parent_x,
+ double parent_y,
+ double *offscreen_x,
+ double *offscreen_y,
GtkClutterOffscreen *offscreen)
{
gfloat x, y;
+
if (clutter_actor_transform_stage_point (offscreen->actor,
parent_x,
parent_y,
@@ -118,20 +114,21 @@ gtk_clutter_offscreen_realize (GtkWidget *widget)
GdkWindowAttr attributes;
gint attributes_mask;
guint border_width;
- GtkWidget *parent;
+ GtkWidget *parent, *child;
gtk_widget_set_realized (widget, TRUE);
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
gtk_widget_get_allocation (widget, &allocation);
+
attributes.x = allocation.x + border_width;
attributes.y = allocation.y + border_width;
attributes.width = allocation.width - 2 * border_width;
attributes.height = allocation.height - 2 * border_width;
attributes.window_type = GDK_WINDOW_OFFSCREEN;
- attributes.event_mask = gtk_widget_get_events (widget) |
- GDK_EXPOSURE_MASK;
+ attributes.event_mask = gtk_widget_get_events (widget)
+ | GDK_EXPOSURE_MASK;
attributes.visual = gtk_widget_get_visual (widget);
attributes.wclass = GDK_INPUT_OUTPUT;
@@ -140,14 +137,21 @@ gtk_clutter_offscreen_realize (GtkWidget *widget)
parent = gtk_widget_get_parent (widget);
window = gdk_window_new (gdk_screen_get_root_window (gdk_window_get_screen (gtk_widget_get_window (parent))),
- &attributes, attributes_mask);
+ &attributes,
+ attributes_mask);
gtk_widget_set_window (widget, window);
gdk_window_set_user_data (window, widget);
g_signal_connect (window, "to-embedder",
- G_CALLBACK (offscreen_window_to_parent), widget);
+ G_CALLBACK (offscreen_window_to_parent),
+ widget);
g_signal_connect (window, "from-embedder",
- G_CALLBACK (offscreen_window_from_parent), widget);
+ G_CALLBACK (offscreen_window_from_parent),
+ widget);
+
+ child = gtk_bin_get_child (GTK_BIN (widget));
+ if (child != NULL)
+ gtk_widget_set_parent_window (child, window);
gtk_widget_style_attach (widget);
style = gtk_widget_get_style (widget);
@@ -156,7 +160,6 @@ gtk_clutter_offscreen_realize (GtkWidget *widget)
if (offscreen->active)
_gtk_clutter_embed_set_child_active (GTK_CLUTTER_EMBED (parent),
widget, TRUE);
-
}
static void
@@ -172,25 +175,56 @@ gtk_clutter_offscreen_unrealize (GtkWidget *widget)
}
static void
-gtk_clutter_offscreen_size_request (GtkWidget *widget,
- GtkRequisition *requisition)
+gtk_clutter_offscreen_get_preferred_width (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
{
+ GtkBin *bin = GTK_BIN (widget);
GtkWidget *child;
- guint border_width;
+ gint border_width;
border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
- requisition->width = (border_width * 2);
- requisition->height = (border_width * 2);
- child = gtk_bin_get_child (GTK_BIN (widget));
- if (child && gtk_widget_get_visible (child))
+ *minimum = border_width * 2;
+ *natural = border_width * 2;
+
+ child = gtk_bin_get_child (bin);
+
+ if (child != NULL && gtk_widget_get_visible (child))
+ {
+ gint child_min, child_nat;
+
+ gtk_widget_get_preferred_width (child, &child_min, &child_nat);
+
+ *minimum += child_min;
+ *natural += child_nat;
+ }
+}
+
+static void
+gtk_clutter_offscreen_get_preferred_height (GtkWidget *widget,
+ gint *minimum,
+ gint *natural)
+{
+ GtkBin *bin = GTK_BIN (widget);
+ GtkWidget *child;
+ gint border_width;
+
+ border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
+
+ *minimum = border_width * 2;
+ *natural = border_width * 2;
+
+ child = gtk_bin_get_child (bin);
+
+ if (child != NULL && gtk_widget_get_visible (child))
{
- GtkRequisition child_requisition;
+ gint child_min, child_nat;
- gtk_widget_get_preferred_size (child, &child_requisition, NULL);
+ gtk_widget_get_preferred_height (child, &child_min, &child_nat);
- requisition->width += child_requisition.width;
- requisition->height += child_requisition.height;
+ *minimum += child_min;
+ *natural += child_nat;
}
}
@@ -198,24 +232,22 @@ static void
gtk_clutter_offscreen_size_allocate (GtkWidget *widget,
GtkAllocation *allocation)
{
- GtkClutterOffscreen *offscreen;
- GtkAllocation widget_allocation;
- GtkWidget *child;
- guint border_width;
+ GtkAllocation old_allocation;
- offscreen = GTK_CLUTTER_OFFSCREEN (widget);
- gtk_widget_get_allocation (widget, &widget_allocation);
+ gtk_widget_get_allocation (widget, &old_allocation);
/* some widgets call gtk_widget_queue_resize() which triggers a
- * size-request/size-allocate cycle.
+ * size request/allocate cycle.
+ *
* Calling gdk_window_move_resize() triggers an expose-event of the entire
* widget tree, so we only want to do it if the allocation has changed in
- * some way, otherwise we can just ignore it. */
+ * some way, otherwise we can just ignore it.
+ */
if (gtk_widget_get_realized (widget) &&
- (allocation->x != widget_allocation.x ||
- allocation->y != widget_allocation.y ||
- allocation->width != widget_allocation.width ||
- allocation->height != widget_allocation.height))
+ (allocation->x != old_allocation.x ||
+ allocation->y != old_allocation.y ||
+ allocation->width != old_allocation.width ||
+ allocation->height != old_allocation.height))
{
gdk_window_move_resize (gtk_widget_get_window (widget),
0, 0,
@@ -223,25 +255,7 @@ gtk_clutter_offscreen_size_allocate (GtkWidget *widget,
allocation->height);
}
- gtk_widget_set_allocation (widget, allocation);
- border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
-
- child = gtk_bin_get_child (GTK_BIN (offscreen));
- if (child && gtk_widget_get_visible (child))
- {
- GtkAllocation child_allocation;
-
- child_allocation.x = border_width;
- child_allocation.y = border_width;
-
- child_allocation.width = MAX (1, allocation->width -
- border_width * 2);
- child_allocation.height = MAX (1, allocation->height -
- border_width * 2);
-
- gtk_widget_size_allocate (gtk_bin_get_child (GTK_BIN (widget)),
- &child_allocation);
- }
+ GTK_WIDGET_CLASS (_gtk_clutter_offscreen_parent_class)->size_allocate (widget, allocation);
}
static gboolean
@@ -267,7 +281,8 @@ _gtk_clutter_offscreen_class_init (GtkClutterOffscreenClass *klass)
widget_class->realize = gtk_clutter_offscreen_realize;
widget_class->unrealize = gtk_clutter_offscreen_unrealize;
- widget_class->size_request = gtk_clutter_offscreen_size_request;
+ widget_class->get_preferred_width = gtk_clutter_offscreen_get_preferred_width;
+ widget_class->get_preferred_height = gtk_clutter_offscreen_get_preferred_height;
widget_class->size_allocate = gtk_clutter_offscreen_size_allocate;
container_class->add = gtk_clutter_offscreen_add;
--
cgit v0.8.3.1-30-gff3a

View File

@ -1,15 +1,14 @@
%define clutter_version 1.0
Name: clutter-gtk
Version: 0.91.4
Release: 2%{?dist}
Version: 0.91.6
Release: 1%{?dist}
Summary: A basic GTK clutter widget
Group: Development/Languages
License: LGPLv2+
URL: http://www.clutter-project.org
Source0: http://www.clutter-project.org/sources/%{name}/%{clutter_version}/%{name}-%{version}.tar.bz2
Patch0: %{name}-0.91.4-no-size-request.patch
Source0: http://www.clutter-project.org/sources/%{name}/0.91/%{name}-%{version}.tar.bz2
BuildRequires: gtk3-devel
BuildRequires: clutter-devel
@ -24,7 +23,7 @@ also allow the reverse, namely embedding GTK in Clutter
Summary: Clutter-gtk development environment
Group: Development/Libraries
Requires: %{name} = %{version}-%{release}
Requires: gtk2-devel clutter-devel
Requires: gtk3-devel clutter-devel
%description devel
Header files and libraries for building a extension library for the
@ -33,7 +32,6 @@ clutter-gtk
%prep
%setup -q
%patch0 -p1 -b .no-size-request
%build
@ -58,7 +56,6 @@ find %{buildroot} -name '*.la' -exec rm -f {} ';'
%files devel
%defattr(-,root,root,-)
%doc
%{_includedir}/clutter-gtk-%{clutter_version}/
%{_libdir}/pkgconfig/clutter-gtk-%{clutter_version}.pc
%{_libdir}/*.so
@ -66,6 +63,10 @@ find %{buildroot} -name '*.la' -exec rm -f {} ';'
%{_datadir}/gtk-doc/html/clutter-gtk
%changelog
* Tue Dec 28 2010 Peter Robinson <pbrobinson@gmail.com> 0.91.6-1
- Update to 0.91.6
- Fix deps and other bits of spec file
* Wed Dec 22 2010 Dan Horák <dan[at]danny.cz> - 0.91.4-2
- Update to recent gtk (FTBFS)

View File

@ -1 +1 @@
3a3e4a49eeefa859517704638dff679c clutter-gtk-0.91.4.tar.bz2
1fb64d994cb0ccf733235dcafd31fea8 clutter-gtk-0.91.6.tar.bz2