Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(793)

Side by Side Diff: chrome/browser/autocomplete/autocomplete_edit_view_gtk.cc

Issue 173324: Fix double control key issue with the omnibox. (Closed)
Patch Set: Created 11 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 <gtk/gtk.h> 7 #include <gtk/gtk.h>
8 #include <gdk/gdkkeysyms.h> 8 #include <gdk/gdkkeysyms.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 641 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 static guint signal_id = 652 static guint signal_id =
653 g_signal_lookup("key-press-event", GTK_TYPE_WIDGET); 653 g_signal_lookup("key-press-event", GTK_TYPE_WIDGET);
654 g_signal_stop_emission(widget, signal_id, 0); 654 g_signal_stop_emission(widget, signal_id, 0);
655 } 655 }
656 656
657 return result; 657 return result;
658 } 658 }
659 659
660 gboolean AutocompleteEditViewGtk::HandleKeyRelease(GtkWidget* widget, 660 gboolean AutocompleteEditViewGtk::HandleKeyRelease(GtkWidget* widget,
661 GdkEventKey* event) { 661 GdkEventKey* event) {
662 // Omnibox2 can switch its contents while pressing a control key. To switch
663 // the contents of omnibox2, we notify the AutocompleteEditModel class when
664 // the control-key state is changed.
662 if (event->keyval == GDK_Control_L || event->keyval == GDK_Control_R) { 665 if (event->keyval == GDK_Control_L || event->keyval == GDK_Control_R) {
663 // Omnibox2 can switch its contents while pressing a control key. To switch 666 // Round trip to query the control state after the release. This allows
Evan Martin 2009/08/25 01:03:50 Maybe mention that |event| still thinks control is
664 // the contents of omnibox2, we notify the AutocompleteEditModel class when 667 // you to release one control key while still holding another control key.
665 // the control-key state is changed. 668 GdkDisplay* display = gdk_drawable_get_display(event->window);
666 model_->OnControlKeyChanged(false); 669 GdkModifierType mod;
670 gdk_display_get_pointer(display, NULL, NULL, NULL, &mod);
671 if (!(mod & GDK_CONTROL_MASK))
672 model_->OnControlKeyChanged(false);
667 } 673 }
668 674
669 // Even though we handled the press ourselves, let GtkTextView handle the 675 // Even though we handled the press ourselves, let GtkTextView handle the
670 // release. It shouldn't do anything particularly interesting, but it will 676 // release. It shouldn't do anything particularly interesting, but it will
671 // handle the IME work for us. 677 // handle the IME work for us.
672 return FALSE; // Propagate into GtkTextView. 678 return FALSE; // Propagate into GtkTextView.
673 } 679 }
674 680
675 gboolean AutocompleteEditViewGtk::HandleViewButtonPress(GdkEventButton* event) { 681 gboolean AutocompleteEditViewGtk::HandleViewButtonPress(GdkEventButton* event) {
676 if (event->button == 1) { 682 if (event->button == 1) {
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after
1105 const std::string& selected_text) { 1111 const std::string& selected_text) {
1106 GtkClipboard* clipboard = 1112 GtkClipboard* clipboard =
1107 gtk_widget_get_clipboard(text_view_, GDK_SELECTION_PRIMARY); 1113 gtk_widget_get_clipboard(text_view_, GDK_SELECTION_PRIMARY);
1108 DCHECK(clipboard); 1114 DCHECK(clipboard);
1109 if (!clipboard) 1115 if (!clipboard)
1110 return; 1116 return;
1111 1117
1112 gtk_clipboard_set_text( 1118 gtk_clipboard_set_text(
1113 clipboard, selected_text.data(), selected_text.size()); 1119 clipboard, selected_text.data(), selected_text.size());
1114 } 1120 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698