summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmmanuele Bassi <ebassi@linux.intel.com>2010-03-10 23:36:45 +0000
committerEmmanuele Bassi <ebassi@linux.intel.com>2010-03-10 23:36:45 +0000
commit920ec05edf8d632d76c564253c74f7ec3c5f0428 (patch)
tree1ba939af42f81b2308c1d25ab4692a1257828022
parent2c313a75d60d707b266d0ee797f0625bc4e47c23 (diff)
downloadclutter-gtk-920ec05edf8d632d76c564253c74f7ec3c5f0428.tar.gz
embed: Do not use deprecated API
Drop the deprecated flag accessor macros and avoid using direct access to struct members.
-rw-r--r--clutter-gtk/gtk-clutter-embed.c72
1 files changed, 42 insertions, 30 deletions
diff --git a/clutter-gtk/gtk-clutter-embed.c b/clutter-gtk/gtk-clutter-embed.c
index 11ab644..8be9ed6 100644
--- a/clutter-gtk/gtk-clutter-embed.c
+++ b/clutter-gtk/gtk-clutter-embed.c
@@ -72,17 +72,19 @@ struct _GtkClutterEmbedPrivate
static void
gtk_clutter_embed_send_configure (GtkClutterEmbed *embed)
{
- GtkWidget *widget;
GdkEvent *event = gdk_event_new (GDK_CONFIGURE);
+ GtkAllocation allocation;
+ GtkWidget *widget;
widget = GTK_WIDGET (embed);
+ gtk_widget_get_allocation (widget, &allocation);
- event->configure.window = g_object_ref (widget->window);
+ event->configure.window = g_object_ref (gtk_widget_get_window (widget));
event->configure.send_event = TRUE;
- event->configure.x = widget->allocation.x;
- event->configure.y = widget->allocation.y;
- event->configure.width = widget->allocation.width;
- event->configure.height = widget->allocation.height;
+ event->configure.x = allocation.x;
+ event->configure.y = allocation.y;
+ event->configure.width = allocation.width;
+ event->configure.height = allocation.height;
gtk_widget_event (widget, event);
gdk_event_free (event);
@@ -131,7 +133,7 @@ gtk_clutter_embed_show (GtkWidget *widget)
{
GtkClutterEmbedPrivate *priv = GTK_CLUTTER_EMBED (widget)->priv;
- if (GTK_WIDGET_REALIZED (widget))
+ if (gtk_widget_get_realized (widget))
clutter_actor_show (priv->stage);
GTK_WIDGET_CLASS (gtk_clutter_embed_parent_class)->show (widget);
@@ -155,7 +157,10 @@ gtk_clutter_embed_realize (GtkWidget *widget)
{
GtkClutterEmbedPrivate *priv = GTK_CLUTTER_EMBED (widget)->priv;
GdkWindowAttr attributes;
+ GtkAllocation allocation;
int attributes_mask;
+ GdkWindow *window;
+ GtkStyle *style;
#ifdef HAVE_CLUTTER_GTK_X11
{
@@ -178,13 +183,16 @@ gtk_clutter_embed_realize (GtkWidget *widget)
}
#endif /* HAVE_CLUTTER_GTK_X11 */
- GTK_WIDGET_SET_FLAGS (widget, GTK_REALIZED);
+ gtk_widget_set_realized (widget, TRUE);
attributes.window_type = GDK_WINDOW_CHILD;
- attributes.x = widget->allocation.x;
- attributes.y = widget->allocation.y;
- attributes.width = widget->allocation.width;
- attributes.height = widget->allocation.height;
+
+ gtk_widget_get_allocation (widget, &allocation);
+ attributes.x = allocation.x;
+ attributes.y = allocation.y;
+ attributes.width = allocation.width;
+ attributes.height = allocation.height;
+
attributes.wclass = GDK_INPUT_OUTPUT;
attributes.visual = gtk_widget_get_visual (widget);
attributes.colormap = gtk_widget_get_colormap (widget);
@@ -204,27 +212,28 @@ gtk_clutter_embed_realize (GtkWidget *widget)
attributes_mask = GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP;
- widget->window = gdk_window_new (gtk_widget_get_parent_window (widget),
- &attributes,
- attributes_mask);
- gdk_window_set_user_data (widget->window, widget);
+ window = gdk_window_new (gtk_widget_get_parent_window (widget),
+ &attributes,
+ attributes_mask);
+ gdk_window_set_user_data (window, widget);
+ gdk_window_set_back_pixmap (window, NULL, FALSE);
+ gtk_widget_set_window (widget, window);
- widget->style = gtk_style_attach (widget->style, widget->window);
- gtk_style_set_background (widget->style, widget->window, GTK_STATE_NORMAL);
+ gtk_widget_style_attach (widget);
+ style = gtk_widget_get_style (widget);
+ gtk_style_set_background (style, >window, GTK_STATE_NORMAL);
- gdk_window_set_back_pixmap (widget->window, NULL, FALSE);
-
#if defined(HAVE_CLUTTER_GTK_X11)
clutter_x11_set_stage_foreign (CLUTTER_STAGE (priv->stage),
- GDK_WINDOW_XID (widget->window));
+ GDK_WINDOW_XID (window));
#elif defined(HAVE_CLUTTER_GTK_WIN32)
clutter_win32_set_stage_foreign (CLUTTER_STAGE (priv->stage),
- GDK_WINDOW_HWND (widget->window));
+ GDK_WINDOW_HWND (window));
#endif /* HAVE_CLUTTER_GTK_{X11,WIN32} */
clutter_actor_realize (priv->stage);
- if (GTK_WIDGET_VISIBLE (widget))
+ if (gtk_widget_get_visible (widget))
clutter_actor_show (priv->stage);
gtk_clutter_embed_send_configure (GTK_CLUTTER_EMBED (widget));
@@ -246,13 +255,15 @@ gtk_clutter_embed_size_allocate (GtkWidget *widget,
{
GtkClutterEmbedPrivate *priv = GTK_CLUTTER_EMBED (widget)->priv;
- widget->allocation = *allocation;
+ gtk_widget_set_allocation (widget, allocation);
- if (GTK_WIDGET_REALIZED (widget))
+ if (gtk_widget_get_realized (widget))
{
- gdk_window_move_resize (widget->window,
- allocation->x, allocation->y,
- allocation->width, allocation->height);
+ gdk_window_move_resize (gtk_widget_get_window (widget),
+ allocation->x,
+ allocation->y,
+ allocation->width,
+ allocation->height);
gtk_clutter_embed_send_configure (GTK_CLUTTER_EMBED (widget));
}
@@ -665,12 +676,13 @@ gtk_clutter_embed_class_init (GtkClutterEmbedClass *klass)
static void
gtk_clutter_embed_init (GtkClutterEmbed *embed)
{
+ GtkWidget *widget = GTK_WIDGET (embed);
GtkClutterEmbedPrivate *priv;
embed->priv = priv = GTK_CLUTTER_EMBED_GET_PRIVATE (embed);
- GTK_WIDGET_SET_FLAGS (embed, GTK_CAN_FOCUS);
- GTK_WIDGET_UNSET_FLAGS (embed, GTK_NO_WINDOW);
+ gtk_widget_set_can_focus (widget, TRUE);
+ gtk_widget_set_has_window (widget, TRUE);
/* disable double-buffering: it's automatically provided
* by OpenGL