fill in window->desc sooner since we use it sooner now.

2003-05-16  Havoc Pennington  <hp@redhat.com>

	* 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
This commit is contained in:
Havoc Pennington 2003-05-16 21:59:08 +00:00 committed by Havoc Pennington
parent 1ac3f938de
commit 4b02b0ddf1
7 changed files with 122 additions and 24 deletions

View File

@ -1,3 +1,29 @@
2003-05-16 Havoc Pennington <hp@redhat.com>
* 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 <hp@redhat.com>
* src/theme-parser.c (meta_theme_load): fix memleak on error
2003-05-16 Telsa Gwynne <hobbit@aloss.ukuu.org.uk> 2003-05-16 Telsa Gwynne <hobbit@aloss.ukuu.org.uk>
* configure.in: Added "cy" (Welsh) to ALL_LINGUAS. * configure.in: Added "cy" (Welsh) to ALL_LINGUAS.

View File

@ -312,6 +312,10 @@ meta_display_open (const char *name)
display->expected_focus_window = NULL; display->expected_focus_window = NULL;
display->mru_list = NULL; display->mru_list = NULL;
#ifdef HAVE_XSYNC
display->grab_update_alarm = None;
#endif
/* FIXME copy the checks from GDK probably */ /* FIXME copy the checks from GDK probably */
display->static_gravity_works = g_getenv ("METACITY_USE_STATIC_GRAVITY") != NULL; display->static_gravity_works = g_getenv ("METACITY_USE_STATIC_GRAVITY") != NULL;

View File

@ -2596,7 +2596,10 @@ handle_toggle_desktop (MetaDisplay *display,
MetaKeyBinding *binding) MetaKeyBinding *binding)
{ {
if (screen->showing_desktop) if (screen->showing_desktop)
{
meta_screen_unshow_desktop (screen); meta_screen_unshow_desktop (screen);
meta_screen_focus_top_window (screen, NULL);
}
else else
meta_screen_show_desktop (screen); meta_screen_show_desktop (screen);
} }

View File

@ -2177,6 +2177,31 @@ queue_windows_showing (MetaScreen *screen)
g_slist_free (windows); 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 void
meta_screen_show_desktop (MetaScreen *screen) meta_screen_show_desktop (MetaScreen *screen)
{ {
@ -2188,6 +2213,8 @@ meta_screen_show_desktop (MetaScreen *screen)
queue_windows_showing (screen); queue_windows_showing (screen);
update_showing_desktop_hint (screen); update_showing_desktop_hint (screen);
meta_screen_focus_top_window (screen, NULL);
} }
void void
@ -2201,8 +2228,6 @@ meta_screen_unshow_desktop (MetaScreen *screen)
queue_windows_showing (screen); queue_windows_showing (screen);
update_showing_desktop_hint (screen); update_showing_desktop_hint (screen);
meta_screen_focus_top_window (screen, NULL);
} }
#ifdef HAVE_STARTUP_NOTIFICATION #ifdef HAVE_STARTUP_NOTIFICATION

View File

@ -188,6 +188,8 @@ void meta_screen_resize (MetaScreen *screen,
int width, int width,
int height); int height);
void meta_screen_minimize_all_except (MetaScreen *screen,
MetaWindow *keep);
/* Show/hide the desktop (temporarily hide all windows) */ /* Show/hide the desktop (temporarily hide all windows) */
void meta_screen_show_desktop (MetaScreen *screen); void meta_screen_show_desktop (MetaScreen *screen);

View File

@ -4269,6 +4269,7 @@ meta_theme_load (const char *theme_name,
text = NULL; text = NULL;
length = 0; length = 0;
retval = NULL; retval = NULL;
context = NULL;
theme_dir = NULL; theme_dir = NULL;
theme_file = NULL; theme_file = NULL;
@ -4378,12 +4379,12 @@ meta_theme_load (const char *theme_name,
if (!g_markup_parse_context_end_parse (context, &error)) if (!g_markup_parse_context_end_parse (context, &error))
goto out; goto out;
g_markup_parse_context_free (context);
goto out; goto out;
out: out:
if (context)
g_markup_parse_context_free (context);
g_free (text); g_free (text);
if (error) if (error)

View File

@ -136,6 +136,49 @@ wm_state_to_string (int state)
} }
#endif #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* MetaWindow*
meta_window_new (MetaDisplay *display, meta_window_new (MetaDisplay *display,
Window xwindow, Window xwindow,
@ -323,6 +366,8 @@ meta_window_new (MetaDisplay *display,
g_assert (window->screen); g_assert (window->screen);
window->desc = g_strdup_printf ("0x%lx", window->xwindow);
/* avoid tons of stack updates */ /* avoid tons of stack updates */
meta_stack_freeze (window->screen->stack); meta_stack_freeze (window->screen->stack);
@ -359,8 +404,6 @@ meta_window_new (MetaDisplay *display,
window->wm_hints_pixmap = None; window->wm_hints_pixmap = None;
window->wm_hints_mask = None; window->wm_hints_mask = None;
window->desc = g_strdup_printf ("0x%lx", window->xwindow);
window->frame = NULL; window->frame = NULL;
window->has_focus = FALSE; window->has_focus = FALSE;
@ -411,6 +454,8 @@ meta_window_new (MetaDisplay *display,
window->has_fullscreen_func = TRUE; window->has_fullscreen_func = TRUE;
window->always_sticky = FALSE;
window->wm_state_modal = FALSE; window->wm_state_modal = FALSE;
window->skip_taskbar = FALSE; window->skip_taskbar = FALSE;
window->skip_pager = FALSE; window->skip_pager = FALSE;
@ -449,6 +494,7 @@ meta_window_new (MetaDisplay *display,
window->using_net_wm_icon_name = FALSE; window->using_net_wm_icon_name = FALSE;
window->need_reread_icon = TRUE; window->need_reread_icon = TRUE;
window->update_icon_queued = FALSE;
window->layer = META_LAYER_LAST; /* invalid value */ window->layer = META_LAYER_LAST; /* invalid value */
window->stack_position = -1; window->stack_position = -1;
@ -670,10 +716,7 @@ meta_window_new (MetaDisplay *display,
meta_stack_thaw (window->screen->stack); meta_stack_thaw (window->screen->stack);
/* disable show desktop mode unless we're a desktop component */ /* disable show desktop mode unless we're a desktop component */
if (window->screen->showing_desktop && maybe_leave_show_desktop_mode (window);
window->type != META_WINDOW_DESKTOP &&
window->type != META_WINDOW_DOCK)
meta_screen_unshow_desktop (window->screen);
meta_window_queue_calc_showing (window); meta_window_queue_calc_showing (window);
@ -1745,9 +1788,6 @@ meta_window_minimize (MetaWindow *window)
void void
meta_window_unminimize (MetaWindow *window) meta_window_unminimize (MetaWindow *window)
{ {
if (window->screen->showing_desktop)
meta_screen_unshow_desktop (window->screen);
if (window->minimized) if (window->minimized)
{ {
window->minimized = FALSE; window->minimized = FALSE;
@ -1959,7 +1999,7 @@ unminimize_func (MetaWindow *window,
static void static void
unminimize_window_and_all_transient_parents (MetaWindow *window) 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); meta_window_foreach_ancestor (window, unminimize_func, NULL);
} }
@ -1968,10 +2008,7 @@ meta_window_activate (MetaWindow *window,
guint32 timestamp) guint32 timestamp)
{ {
/* disable show desktop mode unless we're a desktop component */ /* disable show desktop mode unless we're a desktop component */
if (window->screen->showing_desktop && maybe_leave_show_desktop_mode (window);
window->type != META_WINDOW_DESKTOP &&
window->type != META_WINDOW_DOCK)
meta_screen_unshow_desktop (window->screen);
/* Get window on current workspace */ /* Get window on current workspace */
if (!meta_window_visible_on_workspace (window, if (!meta_window_visible_on_workspace (window,