| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h" | 5 #include "chrome/browser/autocomplete/autocomplete_edit_view_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 1734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1745 | 1745 |
| 1746 // Stop propagating the signal. | 1746 // Stop propagating the signal. |
| 1747 static guint copy_signal_id = | 1747 static guint copy_signal_id = |
| 1748 g_signal_lookup("copy-clipboard", GTK_TYPE_TEXT_VIEW); | 1748 g_signal_lookup("copy-clipboard", GTK_TYPE_TEXT_VIEW); |
| 1749 static guint cut_signal_id = | 1749 static guint cut_signal_id = |
| 1750 g_signal_lookup("cut-clipboard", GTK_TYPE_TEXT_VIEW); | 1750 g_signal_lookup("cut-clipboard", GTK_TYPE_TEXT_VIEW); |
| 1751 g_signal_stop_emission(text_view_, | 1751 g_signal_stop_emission(text_view_, |
| 1752 copy ? copy_signal_id : cut_signal_id, | 1752 copy ? copy_signal_id : cut_signal_id, |
| 1753 0); | 1753 0); |
| 1754 | 1754 |
| 1755 if (!copy) | 1755 if (!copy && gtk_text_view_get_editable(GTK_TEXT_VIEW(text_view_))) |
| 1756 gtk_text_buffer_delete_selection(text_buffer_, true, true); | 1756 gtk_text_buffer_delete_selection(text_buffer_, true, true); |
| 1757 } | 1757 } |
| 1758 | 1758 |
| 1759 OwnPrimarySelection(UTF16ToUTF8(text)); | 1759 OwnPrimarySelection(UTF16ToUTF8(text)); |
| 1760 } | 1760 } |
| 1761 | 1761 |
| 1762 bool AutocompleteEditViewGtk::OnPerformDropImpl(const string16& text) { | 1762 bool AutocompleteEditViewGtk::OnPerformDropImpl(const string16& text) { |
| 1763 if (model_->CanPasteAndGo(CollapseWhitespace(text, true))) { | 1763 if (model_->CanPasteAndGo(CollapseWhitespace(text, true))) { |
| 1764 model_->PasteAndGo(); | 1764 model_->PasteAndGo(); |
| 1765 return true; | 1765 return true; |
| (...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2322 // baseline, so we need to move the |instant_view_| down to make sure it | 2322 // baseline, so we need to move the |instant_view_| down to make sure it |
| 2323 // has the same baseline as the |text_view_|. | 2323 // has the same baseline as the |text_view_|. |
| 2324 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); | 2324 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); |
| 2325 int height; | 2325 int height; |
| 2326 pango_layout_get_size(layout, NULL, &height); | 2326 pango_layout_get_size(layout, NULL, &height); |
| 2327 PangoLayoutIter* iter = pango_layout_get_iter(layout); | 2327 PangoLayoutIter* iter = pango_layout_get_iter(layout); |
| 2328 int baseline = pango_layout_iter_get_baseline(iter); | 2328 int baseline = pango_layout_iter_get_baseline(iter); |
| 2329 pango_layout_iter_free(iter); | 2329 pango_layout_iter_free(iter); |
| 2330 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); | 2330 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); |
| 2331 } | 2331 } |
| OLD | NEW |