From 2001111130c39fe87ed7898af8ec5e9f475a89df Mon Sep 17 00:00:00 2001 From: Pierre-Luc Beaudoin Date: Wed, 20 May 2009 17:39:39 -0400 Subject: [PATCH] The window has to be realized (on show) before setting the cursor --- champlain-gtk/champlain-view-embed.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/champlain-gtk/champlain-view-embed.c b/champlain-gtk/champlain-view-embed.c index 6c7549b..12121a0 100644 --- a/champlain-gtk/champlain-view-embed.c +++ b/champlain-gtk/champlain-view-embed.c @@ -64,6 +64,8 @@ static gboolean mouse_button_cb (GtkWidget *widget, GdkEventButton *event, ChamplainViewEmbed *view); static void view_size_allocated_cb (GtkWidget *widget, GtkAllocation *allocation, ChamplainViewEmbed *view); +static void view_show_cb (GtkWidget *widget, + ChamplainViewEmbed *view); G_DEFINE_TYPE (ChamplainViewEmbed, champlain_view_embed, GTK_TYPE_ALIGNMENT); @@ -168,6 +170,10 @@ champlain_view_embed_init (ChamplainViewEmbed *embed) "size-allocate", G_CALLBACK (view_size_allocated_cb), embed); + g_signal_connect (priv->clutter_embed, + "show", + G_CALLBACK (view_show_cb), + embed); g_signal_connect (priv->clutter_embed, "button-press-event", G_CALLBACK (mouse_button_cb), @@ -188,6 +194,16 @@ champlain_view_embed_init (ChamplainViewEmbed *embed) embed->priv = priv; } +static void +view_show_cb (GtkWidget *widget, + ChamplainViewEmbed *view) +{ + ChamplainViewEmbedPrivate *priv = view->priv; + + // Setup mouse cursor to a hand + gdk_window_set_cursor (priv->clutter_embed->window, priv->cursor_hand_open); +} + static void view_size_allocated_cb (GtkWidget *widget, GtkAllocation *allocation, @@ -196,9 +212,6 @@ view_size_allocated_cb (GtkWidget *widget, ChamplainViewEmbedPrivate *priv = view->priv; champlain_view_set_size(priv->view, allocation->width, allocation->height); - - // Setup mouse cursor to a hand - gdk_window_set_cursor( priv->clutter_embed->window, priv->cursor_hand_open); } static gboolean -- 2.39.5