diff --git a/ChangeLog b/ChangeLog index 6151562e8..e7f3e18be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,26 @@ +Wed May 24 12:57:32 2006 Søren Sandmann + + * 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 + + * src/c-screen.c: Delete unused meta_comp_screen_hide_window(). + 2006-05-23 Adam Jackson * src/c-window.c: diff --git a/src/c-screen.c b/src/c-screen.c index 8d2b60ad0..990326478 100644 --- a/src/c-screen.c +++ b/src/c-screen.c @@ -566,12 +566,14 @@ meta_comp_screen_remove_window (MetaCompScreen *info, if (comp_window) { - CmNode *node = meta_comp_window_get_node (comp_window); - - cm_stacker_remove_child (info->stacker, node); - meta_comp_window_free (comp_window); - - g_hash_table_remove (info->windows_by_xid, (gpointer)xwindow); + if (meta_comp_window_free (comp_window)) + { + CmNode *node = meta_comp_window_get_node (comp_window); + + cm_stacker_remove_child (info->stacker, node); + + 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)); - -#if 0 - g_print ("unmapping: %lx\n", xwindow); -#endif - - if (node) - cm_drawable_node_set_viewable (node, FALSE); + MetaCompWindow *window = find_comp_window (info, xwindow); + + 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 diff --git a/src/c-screen.h b/src/c-screen.h index a37c8cd14..9cca1addb 100644 --- a/src/c-screen.h +++ b/src/c-screen.h @@ -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, diff --git a/src/c-window.c b/src/c-window.c index 97a5fc696..b6f5995a6 100644 --- a/src/c-window.c +++ b/src/c-window.c @@ -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); diff --git a/src/c-window.h b/src/c-window.h index 54705e486..627d81d74 100644 --- a/src/c-window.h +++ b/src/c-window.h @@ -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); diff --git a/src/compositor.c b/src/compositor.c index 5935c7016..1be021f74 100644 --- a/src/compositor.c +++ b/src/compositor.c @@ -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: