diff --git a/ChangeLog b/ChangeLog index e484e8e50..eb32b5a70 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,29 @@ +2003-05-16 Havoc Pennington + + * src/window.c (meta_window_new): fill in window->desc sooner + since we use it sooner now. + + * src/display.c (meta_display_open): init + display->grab_update_alarm + + * src/window.c (meta_window_new): initialize the always_sticky + field + (meta_window_new): initialize the update_icon_queued field + + Patch from Julien Olivier bug #92335 for converting "show desktop + mode" to "all windows are minimized" when you open a new window, + instead of just mapping all the windows again. + + * src/window.c (meta_window_activate): minimize all windows before + coming out of show desktop mode. + (meta_window_unminimize): don't toggle show desktop mode here + + * src/screen.c (meta_screen_minimize_all_except): new function + +2003-05-01 Havoc Pennington + + * src/theme-parser.c (meta_theme_load): fix memleak on error + 2003-05-16 Telsa Gwynne * configure.in: Added "cy" (Welsh) to ALL_LINGUAS. diff --git a/src/display.c b/src/display.c index d26930e81..17ce17404 100644 --- a/src/display.c +++ b/src/display.c @@ -312,6 +312,10 @@ meta_display_open (const char *name) display->expected_focus_window = NULL; display->mru_list = NULL; +#ifdef HAVE_XSYNC + display->grab_update_alarm = None; +#endif + /* FIXME copy the checks from GDK probably */ display->static_gravity_works = g_getenv ("METACITY_USE_STATIC_GRAVITY") != NULL; diff --git a/src/keybindings.c b/src/keybindings.c index 8cdecd849..69bab7411 100644 --- a/src/keybindings.c +++ b/src/keybindings.c @@ -2596,7 +2596,10 @@ handle_toggle_desktop (MetaDisplay *display, MetaKeyBinding *binding) { if (screen->showing_desktop) - meta_screen_unshow_desktop (screen); + { + meta_screen_unshow_desktop (screen); + meta_screen_focus_top_window (screen, NULL); + } else meta_screen_show_desktop (screen); } diff --git a/src/screen.c b/src/screen.c index d39c98841..e589e32f6 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2177,6 +2177,31 @@ queue_windows_showing (MetaScreen *screen) g_slist_free (windows); } +void +meta_screen_minimize_all_except (MetaScreen *screen, + MetaWindow *keep) +{ + GSList *windows; + GSList *tmp; + + windows = meta_display_list_windows (screen->display); + + tmp = windows; + while (tmp != NULL) + { + MetaWindow *w = tmp->data; + + if (w->screen == screen && + w->has_minimize_func && + w != keep) + meta_window_minimize (w); + + tmp = tmp->next; + } + + g_slist_free (windows); +} + void meta_screen_show_desktop (MetaScreen *screen) { @@ -2188,6 +2213,8 @@ meta_screen_show_desktop (MetaScreen *screen) queue_windows_showing (screen); update_showing_desktop_hint (screen); + + meta_screen_focus_top_window (screen, NULL); } void @@ -2201,8 +2228,6 @@ meta_screen_unshow_desktop (MetaScreen *screen) queue_windows_showing (screen); update_showing_desktop_hint (screen); - - meta_screen_focus_top_window (screen, NULL); } #ifdef HAVE_STARTUP_NOTIFICATION diff --git a/src/screen.h b/src/screen.h index d87b043e4..30d24538e 100644 --- a/src/screen.h +++ b/src/screen.h @@ -188,10 +188,12 @@ void meta_screen_resize (MetaScreen *screen, int width, int height); +void meta_screen_minimize_all_except (MetaScreen *screen, + MetaWindow *keep); /* Show/hide the desktop (temporarily hide all windows) */ -void meta_screen_show_desktop (MetaScreen *screen); -void meta_screen_unshow_desktop (MetaScreen *screen); +void meta_screen_show_desktop (MetaScreen *screen); +void meta_screen_unshow_desktop (MetaScreen *screen); void meta_screen_apply_startup_properties (MetaScreen *screen, MetaWindow *window); diff --git a/src/theme-parser.c b/src/theme-parser.c index 88e95f3df..0ed73c0b1 100644 --- a/src/theme-parser.c +++ b/src/theme-parser.c @@ -4269,7 +4269,8 @@ meta_theme_load (const char *theme_name, text = NULL; length = 0; retval = NULL; - + context = NULL; + theme_dir = NULL; theme_file = NULL; @@ -4378,12 +4379,12 @@ meta_theme_load (const char *theme_name, if (!g_markup_parse_context_end_parse (context, &error)) goto out; - g_markup_parse_context_free (context); - goto out; out: + if (context) + g_markup_parse_context_free (context); g_free (text); if (error) diff --git a/src/window.c b/src/window.c index 71a59063a..816fd11f1 100644 --- a/src/window.c +++ b/src/window.c @@ -136,6 +136,49 @@ wm_state_to_string (int state) } #endif +static gboolean +is_desktop_or_dock_foreach (MetaWindow *window, + void *data) +{ + gboolean *result = data; + + *result = + window->type == META_WINDOW_DESKTOP || + window->type == META_WINDOW_DOCK; + if (*result) + return FALSE; /* stop as soon as we find one */ + else + return TRUE; +} + +/* window is the window that's newly mapped provoking + * the possible change + */ +static void +maybe_leave_show_desktop_mode (MetaWindow *window) +{ + gboolean is_desktop_or_dock; + + if (!window->screen->showing_desktop) + return; + + /* If the window is a transient for the dock or desktop, don't + * leave show desktop mode when the window opens. That's + * so you can e.g. hide all windows, manipulate a file on + * the desktop via a dialog, then unshow windows again. + */ + is_desktop_or_dock = FALSE; + + meta_window_foreach_ancestor (window, is_desktop_or_dock_foreach, + &is_desktop_or_dock); + + if (!is_desktop_or_dock) + { + meta_screen_minimize_all_except (window->screen, window); + meta_screen_unshow_desktop (window->screen); + } +} + MetaWindow* meta_window_new (MetaDisplay *display, Window xwindow, @@ -323,6 +366,8 @@ meta_window_new (MetaDisplay *display, g_assert (window->screen); + window->desc = g_strdup_printf ("0x%lx", window->xwindow); + /* avoid tons of stack updates */ meta_stack_freeze (window->screen->stack); @@ -358,8 +403,6 @@ meta_window_new (MetaDisplay *display, meta_icon_cache_init (&window->icon_cache); window->wm_hints_pixmap = None; window->wm_hints_mask = None; - - window->desc = g_strdup_printf ("0x%lx", window->xwindow); window->frame = NULL; window->has_focus = FALSE; @@ -410,6 +453,8 @@ meta_window_new (MetaDisplay *display, window->has_shade_func = TRUE; window->has_fullscreen_func = TRUE; + + window->always_sticky = FALSE; window->wm_state_modal = FALSE; window->skip_taskbar = FALSE; @@ -449,6 +494,7 @@ meta_window_new (MetaDisplay *display, window->using_net_wm_icon_name = FALSE; window->need_reread_icon = TRUE; + window->update_icon_queued = FALSE; window->layer = META_LAYER_LAST; /* invalid value */ window->stack_position = -1; @@ -670,10 +716,7 @@ meta_window_new (MetaDisplay *display, meta_stack_thaw (window->screen->stack); /* disable show desktop mode unless we're a desktop component */ - if (window->screen->showing_desktop && - window->type != META_WINDOW_DESKTOP && - window->type != META_WINDOW_DOCK) - meta_screen_unshow_desktop (window->screen); + maybe_leave_show_desktop_mode (window); meta_window_queue_calc_showing (window); @@ -1181,7 +1224,7 @@ window_should_be_showing (MetaWindow *window) /* 3. See if we're in "show desktop" mode */ - if (showing && + if (showing && window->screen->showing_desktop && window->type != META_WINDOW_DESKTOP && window->type != META_WINDOW_DOCK) @@ -1745,9 +1788,6 @@ meta_window_minimize (MetaWindow *window) void meta_window_unminimize (MetaWindow *window) { - if (window->screen->showing_desktop) - meta_screen_unshow_desktop (window->screen); - if (window->minimized) { window->minimized = FALSE; @@ -1959,7 +1999,7 @@ unminimize_func (MetaWindow *window, static void unminimize_window_and_all_transient_parents (MetaWindow *window) { - meta_window_unminimize (window); + /* This also iterates over the window itself */ meta_window_foreach_ancestor (window, unminimize_func, NULL); } @@ -1968,11 +2008,8 @@ meta_window_activate (MetaWindow *window, guint32 timestamp) { /* disable show desktop mode unless we're a desktop component */ - if (window->screen->showing_desktop && - window->type != META_WINDOW_DESKTOP && - window->type != META_WINDOW_DOCK) - meta_screen_unshow_desktop (window->screen); - + maybe_leave_show_desktop_mode (window); + /* Get window on current workspace */ if (!meta_window_visible_on_workspace (window, window->screen->active_workspace))