diff --git a/ChangeLog b/ChangeLog index 824aebddd..5e939465c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2002-05-24 Havoc Pennington + + * src/window.c (meta_window_show): change how focusing windows + on initial map works, so that we only steal focus from our + transient parent or from a panel/desktop, never from other + normal windows. + 2002-05-24 Havoc Pennington * src/window.c (meta_window_configure_request): modify to ignore diff --git a/src/window.c b/src/window.c index 2319def98..0208fbdb9 100644 --- a/src/window.c +++ b/src/window.c @@ -1337,10 +1337,31 @@ meta_window_show (MetaWindow *window) /* don't focus these */ break; case META_WINDOW_NORMAL: + /* Focus only if the current focus is on a desktop element + * or nonexistent. + * + * (using display->focus_window is a bit of a race condition, + * but I have no idea how to avoid it) + */ + if (display->focus_window == NULL || + (display->focus_window && + (display->focus_window->type == META_WINDOW_DOCK || + display->focus_window->type == META_WINDOW_DESKTOP))) + meta_window_focus (window, + meta_display_get_current_time (window->display)); + break; case META_WINDOW_DIALOG: case META_WINDOW_MODAL_DIALOG: - meta_window_focus (window, - meta_display_get_current_time (window->display)); + /* Focus only if the transient parent has focus */ + /* (using display->focus_window is a bit of a race condition, + * but I have no idea how to avoid it) + */ + if (display->focus_window == NULL || + (display->focus_window && + meta_window_is_ancestor_of_transient (display->focus_window, + window))) + meta_window_focus (window, + meta_display_get_current_time (window->display)); break; } }