return TRUE when the window is actually freed.

Wed May 24 12:57:32 2006  Søren Sandmann  <sandmann@redhat.com>

        * src/c-window.c (meta_comp_window_free): return TRUE when the
        window is actually freed.

        * src/compositor.c (do_effect): Disable updating before exploding
        the window.

        * src/c-window.c: Make MetaCompWindow refcounted.

        * src/c-window.[ch]: New functions meta_comp_window_{show,hide}

        * src/c-screen.c (meta_comp_screen_unmap): Call
        meta_comp_window_hide() instead of directly setting the viewable
        status of the node.

        * src/c-screen.c (meta_comp_screen_remove_window): Only remove the
        window when it is actually freed.
This commit is contained in:
Søren Sandmann 2006-05-24 16:58:20 +00:00 committed by Søren Sandmann Pedersen
parent 22bc36eb3b
commit 3f4e194c8f
6 changed files with 56 additions and 48 deletions

View File

@ -1,3 +1,26 @@
Wed May 24 12:57:32 2006 Søren Sandmann <sandmann@redhat.com>
* src/c-window.c (meta_comp_window_free): return TRUE when the
window is actually freed.
* src/compositor.c (do_effect): Disable updating before exploding
the window.
* src/c-window.c: Make MetaCompWindow refcounted.
* src/c-window.[ch]: New functions meta_comp_window_{show,hide}
* src/c-screen.c (meta_comp_screen_unmap): Call
meta_comp_window_hide() instead of directly setting the viewable
status of the node.
* src/c-screen.c (meta_comp_screen_remove_window): Only remove the
window when it is actually freed.
Wed May 24 12:45:21 2006 Søren Sandmann <sandmann@redhat.com>
* src/c-screen.c: Delete unused meta_comp_screen_hide_window().
2006-05-23 Adam Jackson <ajax@freedesktop.org>
* src/c-window.c:

View File

@ -566,12 +566,14 @@ meta_comp_screen_remove_window (MetaCompScreen *info,
if (comp_window)
{
CmNode *node = meta_comp_window_get_node (comp_window);
if (meta_comp_window_free (comp_window))
{
CmNode *node = meta_comp_window_get_node (comp_window);
cm_stacker_remove_child (info->stacker, node);
meta_comp_window_free (comp_window);
cm_stacker_remove_child (info->stacker, node);
g_hash_table_remove (info->windows_by_xid, (gpointer)xwindow);
g_hash_table_remove (info->windows_by_xid, (gpointer)xwindow);
}
}
}
@ -636,14 +638,10 @@ void
meta_comp_screen_unmap (MetaCompScreen *info,
Window xwindow)
{
CmDrawableNode *node = CM_DRAWABLE_NODE (find_node (info, xwindow));
MetaCompWindow *window = find_comp_window (info, xwindow);
#if 0
g_print ("unmapping: %lx\n", xwindow);
#endif
if (node)
cm_drawable_node_set_viewable (node, FALSE);
if (window)
meta_comp_window_hide (window);
}
void
@ -657,14 +655,5 @@ meta_comp_screen_set_target_rect (MetaCompScreen *info,
cm_drawable_node_set_scale_rect (node, rect);
}
void
meta_comp_screen_hide_window (MetaCompScreen *info,
Window xwindow)
{
CmDrawableNode *node = CM_DRAWABLE_NODE (find_node (info, xwindow));
cm_drawable_node_set_viewable (node, FALSE);
}
#endif

View File

@ -45,8 +45,6 @@ void meta_comp_screen_set_target_rect (MetaCompScreen *info,
void meta_comp_screen_set_explode (MetaCompScreen *info,
Window xwindow,
gdouble level);
void meta_comp_screen_hide_window (MetaCompScreen *info,
Window xwindow);
void meta_comp_screen_unmap (MetaCompScreen *info,
Window xwindow);
MetaCompWindow *meta_comp_screen_lookup_window (MetaCompScreen *info,

View File

@ -172,8 +172,8 @@ has_counter (MetaCompWindow *comp_window)
return TRUE;
}
static void
show_node (MetaCompWindow *comp_window)
void
meta_comp_window_show (MetaCompWindow *comp_window)
{
if (comp_window->animation_in_progress)
comp_window->hide_after_animation = FALSE;
@ -182,8 +182,8 @@ show_node (MetaCompWindow *comp_window)
cm_drawable_node_update_pixmap (CM_DRAWABLE_NODE (comp_window->node));
}
static void
hide_node (MetaCompWindow *comp_window)
void
meta_comp_window_hide (MetaCompWindow *comp_window)
{
if (comp_window->animation_in_progress)
{
@ -213,7 +213,7 @@ meta_comp_window_new (MetaDisplay *display,
window->counter_value = 1;
window->ref_count = 1;
hide_node (window);
meta_comp_window_hide (window);
return window;
}
@ -226,7 +226,7 @@ comp_window_ref (MetaCompWindow *comp_window)
return comp_window;
}
static void
static gboolean
comp_window_unref (MetaCompWindow *comp_window)
{
if (--comp_window->ref_count == 0)
@ -236,13 +236,17 @@ comp_window_unref (MetaCompWindow *comp_window)
if (comp_window->alarm)
g_object_unref (comp_window->alarm);
g_free (comp_window);
return TRUE;
}
return FALSE;
}
void
gboolean
meta_comp_window_free (MetaCompWindow *window)
{
comp_window_unref (window);
return comp_window_unref (window);
}
void
@ -389,7 +393,7 @@ on_request_alarm (WsSyncAlarm *alarm,
g_print ("alarm for %p\n", comp_window);
#endif
show_node (comp_window);
meta_comp_window_show (comp_window);
g_object_unref (alarm);
}
@ -497,7 +501,7 @@ meta_comp_window_refresh_attrs (MetaCompWindow *comp_window)
#if 0
g_print ("directly showing %p\n", comp_window);
#endif
show_node (comp_window);
meta_comp_window_show (comp_window);
}
else
{
@ -513,7 +517,7 @@ meta_comp_window_refresh_attrs (MetaCompWindow *comp_window)
g_print ("unmapping %p\n", node);
#endif
hide_node (comp_window);
meta_comp_window_hide (comp_window);
}
}
@ -579,18 +583,13 @@ update_explosion (gpointer data)
CmDrawableNode *node = CM_DRAWABLE_NODE (info->comp_window->node);
gdouble elapsed = g_timer_elapsed (info->timer, NULL);
if (!cm_drawable_node_get_viewable (node))
{
g_print ("huh, how did that happen to %p?\n", node);
}
if (elapsed > EXPLODE_TIME)
if (!cm_drawable_node_get_viewable (node) || elapsed > EXPLODE_TIME)
{
meta_effect_end (info->effect);
info->comp_window->animation_in_progress = FALSE;
if (info->comp_window->hide_after_animation)
hide_node (info->comp_window);
meta_comp_window_hide (info->comp_window);
cm_drawable_node_set_explosion_level (node, 0.0);

View File

@ -29,10 +29,12 @@ typedef struct _MetaCompWindow MetaCompWindow;
MetaCompWindow *meta_comp_window_new (MetaDisplay *display,
WsDrawable *drawable);
CmNode *meta_comp_window_get_node (MetaCompWindow *window);
void meta_comp_window_free (MetaCompWindow *window);
gboolean meta_comp_window_free (MetaCompWindow *window);
void meta_comp_window_set_size (MetaCompWindow *window,
WsRectangle *size);
void meta_comp_window_hide (MetaCompWindow *comp_window);
void meta_comp_window_show (MetaCompWindow *comp_window);
void meta_comp_window_refresh_attrs (MetaCompWindow *comp_window);
void meta_comp_window_set_updates (MetaCompWindow *comp_window,
gboolean updates);

View File

@ -140,12 +140,9 @@ do_effect (MetaEffect *effect,
get_xid (effect->u.minimize.window));
MetaCompWindow *window =
meta_comp_screen_lookup_window (screen, effect->u.minimize.window->frame->xwindow);
g_print ("close\n");
meta_comp_window_set_updates (window, FALSE);
meta_comp_window_explode (window, effect);
#if 0
meta_effect_end (effect);
#endif
break;
}
default: