diff options
author | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-14 19:53:13 +0000 |
---|---|---|
committer | estade@chromium.org <estade@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-14 19:53:13 +0000 |
commit | 6de627262d774f26056ea431a9ce4eacdbc05be0 (patch) | |
tree | e431cee7793176d4122ab41e36451194d348cc19 /chrome/browser/autocomplete/autocomplete_edit_view_gtk.h | |
parent | 981268b70dab10093c3ca08fabe1d2ecb56744cc (diff) | |
download | chromium_src-6de627262d774f26056ea431a9ce4eacdbc05be0.zip chromium_src-6de627262d774f26056ea431a9ce4eacdbc05be0.tar.gz chromium_src-6de627262d774f26056ea431a9ce4eacdbc05be0.tar.bz2 |
GTK: make the primary selection include the url's scheme when an entire URL is selected.
sometimes the scheme will be hidden, which is the reason we need this workaround.
BUG=41173
TEST=manual
Review URL: http://codereview.chromium.org/1638007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44519 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/autocomplete/autocomplete_edit_view_gtk.h')
-rw-r--r-- | chrome/browser/autocomplete/autocomplete_edit_view_gtk.h | 26 |
1 files changed, 24 insertions, 2 deletions
diff --git a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h index 6dc5bea..22ea93e 100644 --- a/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h +++ b/chrome/browser/autocomplete/autocomplete_edit_view_gtk.h @@ -141,6 +141,9 @@ class AutocompleteEditViewGtk : public AutocompleteEditView, GtkTextBuffer*); CHROMEG_CALLBACK_2(AutocompleteEditViewGtk, void, HandleMarkSet, GtkTextBuffer*, GtkTextIter*, GtkTextMark*); + // As above, but called after the default handler. + CHROMEG_CALLBACK_2(AutocompleteEditViewGtk, void, HandleMarkSetAfter, + GtkTextBuffer*, GtkTextIter*, GtkTextMark*); CHROMEG_CALLBACK_3(AutocompleteEditViewGtk, void, HandleInsertText, GtkTextBuffer*, GtkTextIter*, const gchar*, gint); CHROMEG_CALLBACK_0(AutocompleteEditViewGtk, void, @@ -179,6 +182,20 @@ class AutocompleteEditViewGtk : public AutocompleteEditView, CHROMEGTK_CALLBACK_1(AutocompleteEditViewGtk, void, HandleWidgetDirectionChanged, GtkTextDirection); + // Callback for the PRIMARY selection clipboard. + static void ClipboardGetSelectionThunk(GtkClipboard* clipboard, + GtkSelectionData* selection_data, + guint info, + gpointer object); + void ClipboardGetSelection(GtkClipboard* clipboard, + GtkSelectionData* selection_data, + guint info); + + // Take control of the PRIMARY selection clipboard with |text|. Use + // |text_buffer_| as the owner, so that this doesn't remove the selection on + // it. This makes use of the above callbacks. + void OwnPrimarySelection(const std::string& text); + // Gets the GTK_TEXT_WINDOW_WIDGET coordinates for |text_view_| that bound the // given iters. gfx::Rect WindowBoundsFromIters(GtkTextIter* iter1, GtkTextIter* iter2); @@ -216,7 +233,8 @@ class AutocompleteEditViewGtk : public AutocompleteEditView, // Internally invoked whenever the text changes in some way. void TextChanged(); - // Save |selected_text| as the PRIMARY X selection. + // Save |selected_text| as the PRIMARY X selection. Unlike + // OwnPrimarySelection(), this won't set an owner or use callbacks. void SavePrimarySelection(const std::string& selected_text); // Update the field with |text| and set the selection. @@ -280,8 +298,12 @@ class AutocompleteEditViewGtk : public AutocompleteEditView, // it, we pass this string to SavePrimarySelection()). std::string selected_text_; - // ID of the signal handler for "mark-set" on |text_buffer_|. + // When we own the X clipboard, this is the text for it. + std::string primary_selection_text_; + + // IDs of the signal handlers for "mark-set" on |text_buffer_|. gulong mark_set_handler_id_; + gulong mark_set_handler_id2_; #if defined(OS_CHROMEOS) // The following variables are used to implement select-all-on-mouse-up, which |