diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-14 21:33:42 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-07-14 21:33:42 +0000 |
commit | 4ea809e23e15b81ac87933b600d330b5ea908a2e (patch) | |
tree | d4847f589630c1c14d7aac4c292421839eb01cbc /chrome/browser/gtk/bookmark_manager_gtk.cc | |
parent | 13895daf8c9a82ae677d4294b27c472856f592c2 (diff) | |
download | chromium_src-4ea809e23e15b81ac87933b600d330b5ea908a2e.zip chromium_src-4ea809e23e15b81ac87933b600d330b5ea908a2e.tar.gz chromium_src-4ea809e23e15b81ac87933b600d330b5ea908a2e.tar.bz2 |
Make GTK file dialog box modal for parent window, instead of for the entire
application.
This works by adding the GtkWindow in BrowserWindowGtk to its own
GtkWindowGroup and adding the SelectFile dialog to the same group. The
following call to gtk_grab_add(...) makes the SelectFile dialog modal, but
only to the windows within the same group.
Similarly, the bookmark manager window is also added to its own unique
GtkWindowGroup, so the import/export dialogs behave correctly.
If I'm understanding things correctly, the GtkWindowGroup objects are
reference counted once the have windows attached to them, and will delete
themselves after all references to them are destroyed. I'm not sure how to
verify this.
Test:
- Open two new chrome window: A and B
- Open "Save file as..." dialog in window A
- Verify that window A does not respond to keyboard or mouse events.
- Verify that window B does responde to keyboard and mouse events.
- Open "Save file as..." dialog in window B
- Verify that window B does not respond to keyboard or mouse events.
- Cancel dialog on window A.
- Verify that window A starts responding to keyboard and mouse events.
- Cancel dialog on window B.
- Verify that window B starts responding to keyboard and mouse events.
BUG=8727
patch by Mohit Muthanna <mmuthanna@google.com>
original review URL: http://codereview.chromium.org/149548
Review URL: http://codereview.chromium.org/155518
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@20667 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/bookmark_manager_gtk.cc')
-rw-r--r-- | chrome/browser/gtk/bookmark_manager_gtk.cc | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/chrome/browser/gtk/bookmark_manager_gtk.cc b/chrome/browser/gtk/bookmark_manager_gtk.cc index dab3508..e1c43ae 100644 --- a/chrome/browser/gtk/bookmark_manager_gtk.cc +++ b/chrome/browser/gtk/bookmark_manager_gtk.cc @@ -328,6 +328,11 @@ void BookmarkManagerGtk::InitWidgets() { gtk_window_set_title(GTK_WINDOW(window_), l10n_util::GetStringUTF8(IDS_BOOKMARK_MANAGER_TITLE).c_str()); + // Add this window to its own unique window group to allow for + // window-to-parent modality. + gtk_window_group_add_window(gtk_window_group_new(), GTK_WINDOW(window_)); + g_object_unref(gtk_window_get_group(GTK_WINDOW(window_))); + // Set the default size of the bookmark manager. int width, height; gtk_util::GetWidgetSizeFromResources(window_, |