diff options
author | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-30 00:48:16 +0000 |
---|---|---|
committer | derat@chromium.org <derat@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-30 00:48:16 +0000 |
commit | 4d023b86e67eea53d3a07dda4a516a1e74eeb69d (patch) | |
tree | aab34aa24c601d55c2d52df1704e887d853b12b2 /chrome/browser/gtk/bookmark_bubble_gtk.cc | |
parent | 2d4f7dd2730272ae457e5ef10449a747fdd96a84 (diff) | |
download | chromium_src-4d023b86e67eea53d3a07dda4a516a1e74eeb69d.zip chromium_src-4d023b86e67eea53d3a07dda4a516a1e74eeb69d.tar.gz chromium_src-4d023b86e67eea53d3a07dda4a516a1e74eeb69d.tar.bz2 |
Linux: Make InfoBubble use an override-redirect (popup) window.
This makes it work correctly in ion3 and other window managers that don't expect clients to try to move top-level windows themselves.
This implementation grabs the pointer and keyboard. By doing this and using an override-redirect window, we should be able to avoid worrying about interactions with different window managers. The only downside (alluded to in the previous code) is that window manager keybindings don't make it through until the user dismisses the bubble by clicking outside of it or hitting Enter or Escape. I don't think this will be a problem; it's no different from what happens when you open a context menu in an app.
BUG=20523
TEST=tested first-run and bookmark bubbles in Metacity, ion3, Fluxbox, KDE4, and the WM that I'm working on
Review URL: http://codereview.chromium.org/198016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27578 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/gtk/bookmark_bubble_gtk.cc')
-rw-r--r-- | chrome/browser/gtk/bookmark_bubble_gtk.cc | 19 |
1 files changed, 11 insertions, 8 deletions
diff --git a/chrome/browser/gtk/bookmark_bubble_gtk.cc b/chrome/browser/gtk/bookmark_bubble_gtk.cc index 8e93d77..ca4f40a 100644 --- a/chrome/browser/gtk/bookmark_bubble_gtk.cc +++ b/chrome/browser/gtk/bookmark_bubble_gtk.cc @@ -85,7 +85,7 @@ std::vector<const BookmarkNode*> PopulateFolderCombo(BookmarkModel* model, } // namespace // static -void BookmarkBubbleGtk::Show(GtkWindow* transient_toplevel, +void BookmarkBubbleGtk::Show(GtkWindow* toplevel_window, const gfx::Rect& rect, Profile* profile, const GURL& url, @@ -96,7 +96,7 @@ void BookmarkBubbleGtk::Show(GtkWindow* transient_toplevel, // think that closing the previous bubble and opening the new one would make // more sense, but I guess then you would commit the bubble's changes. DCHECK(!g_bubble); - g_bubble = new BookmarkBubbleGtk(transient_toplevel, rect, profile, + g_bubble = new BookmarkBubbleGtk(toplevel_window, rect, profile, url, newly_bookmarked); } @@ -135,7 +135,7 @@ void BookmarkBubbleGtk::Observe(NotificationType type, } } -BookmarkBubbleGtk::BookmarkBubbleGtk(GtkWindow* transient_toplevel, +BookmarkBubbleGtk::BookmarkBubbleGtk(GtkWindow* toplevel_window, const gfx::Rect& rect, Profile* profile, const GURL& url, @@ -143,7 +143,7 @@ BookmarkBubbleGtk::BookmarkBubbleGtk(GtkWindow* transient_toplevel, : url_(url), profile_(profile), theme_provider_(GtkThemeProvider::GetFrom(profile_)), - transient_toplevel_(transient_toplevel), + toplevel_window_(toplevel_window), content_(NULL), name_entry_(NULL), folder_combo_(NULL), @@ -163,7 +163,7 @@ BookmarkBubbleGtk::BookmarkBubbleGtk(GtkWindow* transient_toplevel, GtkWidget* close_button = gtk_button_new_with_label( l10n_util::GetStringUTF8(IDS_CLOSE).c_str()); - // Our content is arrange in 3 rows. |top| contains a left justified + // Our content is arranged in 3 rows. |top| contains a left justified // message, and a right justified remove link button. |table| is the middle // portion with the name entry and the folder combo. |bottom| is the final // row with a spacer, and the edit... and close buttons on the right. @@ -213,8 +213,11 @@ BookmarkBubbleGtk::BookmarkBubbleGtk(GtkWindow* transient_toplevel, // We want the focus to start on the entry, not on the remove button. gtk_container_set_focus_child(GTK_CONTAINER(content), table); - bubble_ = InfoBubbleGtk::Show(transient_toplevel_, - rect, content, theme_provider_, this); + bubble_ = InfoBubbleGtk::Show(toplevel_window_, + rect, + content, + theme_provider_, + this); // delegate if (!bubble_) { NOTREACHED(); return; @@ -347,7 +350,7 @@ void BookmarkBubbleGtk::ShowEditor() { // Closing might delete us, so we'll cache what we want we need on the stack. Profile* profile = profile_; - GtkWidget* toplevel = GTK_WIDGET(transient_toplevel_); + GtkWidget* toplevel = GTK_WIDGET(toplevel_window_); // Close the bubble, deleting the C++ objects, etc. bubble_->Close(); |