summaryrefslogtreecommitdiffstats
path: root/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc')
-rw-r--r--chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc79
1 files changed, 2 insertions, 77 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
index e46e377..fd13ee1 100644
--- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
+++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc
@@ -103,9 +103,6 @@ AutocompleteEditViewGtk::AutocompleteEditViewGtk(
popup_window_mode_(popup_window_mode),
scheme_security_level_(ToolbarModel::NORMAL),
mark_set_handler_id_(0),
- button_1_pressed_(false),
- text_selected_during_click_(false),
- text_view_focused_before_button_press_(false),
#if !defined(TOOLKIT_VIEWS)
theme_provider_(GtkThemeProvider::GetFrom(profile)),
#endif
@@ -192,10 +189,6 @@ void AutocompleteEditViewGtk::Init() {
G_CALLBACK(&HandleKeyPressThunk), this);
g_signal_connect(text_view_, "key-release-event",
G_CALLBACK(&HandleKeyReleaseThunk), this);
- g_signal_connect(text_view_, "button-press-event",
- G_CALLBACK(&HandleViewButtonPressThunk), this);
- g_signal_connect(text_view_, "button-release-event",
- G_CALLBACK(&HandleViewButtonReleaseThunk), this);
g_signal_connect(text_view_, "focus-in-event",
G_CALLBACK(&HandleViewFocusInThunk), this);
g_signal_connect(text_view_, "focus-out-event",
@@ -390,8 +383,6 @@ void AutocompleteEditViewGtk::SelectAll(bool reversed) {
// SelectAll() is invoked as a side effect of other actions (e.g. switching
// tabs or hitting Escape) in autocomplete_edit.cc, so we don't update the
// PRIMARY selection here.
- // TODO(derat): But this is also called by LocationBarView::FocusLocation() --
- // should the X selection be updated when the user hits Ctrl-L?
SelectAllInternal(reversed, false);
}
@@ -724,63 +715,6 @@ gboolean AutocompleteEditViewGtk::HandleKeyRelease(GtkWidget* widget,
return FALSE; // Propagate into GtkTextView.
}
-gboolean AutocompleteEditViewGtk::HandleViewButtonPress(GdkEventButton* event) {
- // We don't need to care about double and triple clicks.
- if (event->type != GDK_BUTTON_PRESS)
- return FALSE;
-
- if (event->button == 1) {
- // When the first button is pressed, track some stuff that will help us
- // determine whether we should select all of the text when the button is
- // released.
- button_1_pressed_ = true;
- text_view_focused_before_button_press_ = GTK_WIDGET_HAS_FOCUS(text_view_);
- text_selected_during_click_ = false;
-
- // Button press event may change the selection, we need to record the change
- // and report it to |model_| later when button is released.
- OnBeforePossibleChange();
- } else if (event->button == 2) {
- // GtkTextView pastes PRIMARY selection with middle click.
- // We can't call model_->on_paste_replacing_all() here, because the actual
- // paste clipboard action may not be performed if the clipboard is empty.
- paste_clipboard_requested_ = true;
- }
- return FALSE;
-}
-
-gboolean AutocompleteEditViewGtk::HandleViewButtonRelease(
- GdkEventButton* event) {
- if (event->button != 1)
- return FALSE;
-
- button_1_pressed_ = false;
-
- // Call the GtkTextView default handler, ignoring the fact that it will
- // likely have told us to stop propagating. We want to handle selection.
- GtkWidgetClass* klass = GTK_WIDGET_GET_CLASS(text_view_);
- klass->button_release_event(text_view_, event);
-
- if (!text_view_focused_before_button_press_ && !text_selected_during_click_) {
- // If this was a focusing click and the user didn't drag to highlight any
- // text, select the full input and update the PRIMARY selection.
- SelectAllInternal(false, true);
-
- // So we told the buffer where the cursor should be, but make sure to tell
- // the view so it can scroll it to be visible if needed.
- // NOTE: This function doesn't seem to like a count of 0, looking at the
- // code it will skip an important loop. Use -1 to achieve the same.
- GtkTextIter start, end;
- gtk_text_buffer_get_bounds(text_buffer_, &start, &end);
- gtk_text_view_move_visually(GTK_TEXT_VIEW(text_view_), &start, -1);
- }
-
- // Inform |model_| about possible text selection change.
- OnAfterPossibleChange();
-
- return TRUE; // Don't continue, we called the default handler already.
-}
-
gboolean AutocompleteEditViewGtk::HandleViewFocusIn() {
GdkModifierType modifiers;
gdk_window_get_pointer(text_view_->window, NULL, NULL, &modifiers);
@@ -913,19 +847,11 @@ void AutocompleteEditViewGtk::HandleMarkSet(GtkTextBuffer* buffer,
if (gtk_text_buffer_get_selection_bounds(text_buffer_, &start, &end)) {
gchar* text = gtk_text_iter_get_text(&start, &end);
size_t text_len = strlen(text);
- if (text_len) {
+ if (text_len)
new_selected_text = std::string(text, text_len);
- }
g_free(text);
}
- // If the user just selected some text with the mouse (or at least while the
- // mouse button was down), make sure that we won't blow their selection away
- // later by selecting all of the text when the button is released.
- if (button_1_pressed_ && !new_selected_text.empty()) {
- text_selected_during_click_ = true;
- }
-
// If we had some text selected earlier but it's no longer highlighted, we
// might need to save it now...
if (!selected_text_.empty() && new_selected_text.empty()) {
@@ -937,9 +863,8 @@ void AutocompleteEditViewGtk::HandleMarkSet(GtkTextBuffer* buffer,
// selection, the text buffer still owns it even if GTK is about to take it
// away in the default handler.)
GtkClipboard* clipboard = gtk_clipboard_get(GDK_SELECTION_PRIMARY);
- if (gtk_clipboard_get_owner(clipboard) == G_OBJECT(text_buffer_)) {
+ if (gtk_clipboard_get_owner(clipboard) == G_OBJECT(text_buffer_))
SavePrimarySelection(selected_text_);
- }
}
selected_text_ = new_selected_text;