diff options
author | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-24 18:56:27 +0000 |
---|---|---|
committer | deanm@chromium.org <deanm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-04-24 18:56:27 +0000 |
commit | ef921826834b693e83ebe3a4ae6984b9b39b723b (patch) | |
tree | cdd47055756ceadb597d06d0a18b5e56a37d9a99 /chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc | |
parent | b2b26af9cd8e5d436fdf27d2f266ad3c23f7a192 (diff) | |
download | chromium_src-ef921826834b693e83ebe3a4ae6984b9b39b723b.zip chromium_src-ef921826834b693e83ebe3a4ae6984b9b39b723b.tar.gz chromium_src-ef921826834b693e83ebe3a4ae6984b9b39b723b.tar.bz2 |
Override GtkTextView's size request width in the Linux Omnibox.
GtkTextView requests enough space to fit all of the text. It turns out if you
weren't doing something to restrict the window size (like using a tiling
manager) long text in the edit would push the window to fit the text.
Review URL: http://codereview.chromium.org/93127
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@14449 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc index 5310667..6e8efed 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc +++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc @@ -123,6 +123,12 @@ void AutocompleteEditViewGtk::Init() { // signal, but it is very convenient and clean for catching up/down. g_signal_connect(text_view_, "move-cursor", G_CALLBACK(&HandleViewMoveCursorThunk), this); + // Override the size request. We want to keep the original height request + // from the widget, since that's font dependent. We want to ignore the width + // so we don't force a minimum width based on the text length. + g_signal_connect(text_view_, "size-request", + G_CALLBACK(&HandleViewSizeRequestThunk), this); + } void AutocompleteEditViewGtk::SetFocus() { @@ -455,6 +461,13 @@ void AutocompleteEditViewGtk::HandleViewMoveCursor( // Propagate into GtkTextView. } +gboolean AutocompleteEditViewGtk::HandleViewSizeRequest(GtkRequisition* req) { + // Don't force a minimum width, but use the font-relative height. + GTK_WIDGET_GET_CLASS(text_view_)->size_request(text_view_, req); + req->width = 1; + return TRUE; // We already called the default handler. +} + AutocompleteEditViewGtk::CharRange AutocompleteEditViewGtk::GetSelection() { // You can not just use get_selection_bounds here, since the order will be // ascending, and you don't know where the user's start and end of the |