diff options
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc | 13 | ||||
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_gtk.h | 8 |
2 files changed, 21 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 diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h index 7eef26b..7ee00dd 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h @@ -162,6 +162,14 @@ class AutocompleteEditViewGtk : public AutocompleteEditView { gint count, gboolean extendion_selection); + static gboolean HandleViewSizeRequestThunk(GtkWidget* view, + GtkRequisition* req, + gpointer self) { + return reinterpret_cast<AutocompleteEditViewGtk*>(self)-> + HandleViewSizeRequest(req); + } + gboolean HandleViewSizeRequest(GtkRequisition* req); + // Get the character indices of the current selection. This honors // direction, cp_max is the insertion point, and cp_min is the bound. CharRange GetSelection(); |