OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/gtk/omnibox/omnibox_view_gtk.h" | 5 #include "chrome/browser/ui/gtk/omnibox/omnibox_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 1189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1200 } | 1200 } |
1201 | 1201 |
1202 gboolean OmniboxViewGtk::HandleKeyRelease(GtkWidget* widget, | 1202 gboolean OmniboxViewGtk::HandleKeyRelease(GtkWidget* widget, |
1203 GdkEventKey* event) { | 1203 GdkEventKey* event) { |
1204 // Omnibox2 can switch its contents while pressing a control key. To switch | 1204 // Omnibox2 can switch its contents while pressing a control key. To switch |
1205 // the contents of omnibox2, we notify the AutocompleteEditModel class when | 1205 // the contents of omnibox2, we notify the AutocompleteEditModel class when |
1206 // the control-key state is changed. | 1206 // the control-key state is changed. |
1207 if (event->keyval == GDK_Control_L || event->keyval == GDK_Control_R) { | 1207 if (event->keyval == GDK_Control_L || event->keyval == GDK_Control_R) { |
1208 // Round trip to query the control state after the release. This allows | 1208 // Round trip to query the control state after the release. This allows |
1209 // you to release one control key while still holding another control key. | 1209 // you to release one control key while still holding another control key. |
1210 GdkDisplay* display = gdk_drawable_get_display(event->window); | 1210 GdkDisplay* display = gdk_window_get_display(event->window); |
1211 GdkModifierType mod; | 1211 GdkModifierType mod; |
1212 gdk_display_get_pointer(display, NULL, NULL, NULL, &mod); | 1212 gdk_display_get_pointer(display, NULL, NULL, NULL, &mod); |
1213 if (!(mod & GDK_CONTROL_MASK)) | 1213 if (!(mod & GDK_CONTROL_MASK)) |
1214 model_->OnControlKeyChanged(false); | 1214 model_->OnControlKeyChanged(false); |
1215 } | 1215 } |
1216 | 1216 |
1217 // Even though we handled the press ourselves, let GtkTextView handle the | 1217 // Even though we handled the press ourselves, let GtkTextView handle the |
1218 // release. It shouldn't do anything particularly interesting, but it will | 1218 // release. It shouldn't do anything particularly interesting, but it will |
1219 // handle the IME work for us. | 1219 // handle the IME work for us. |
1220 return FALSE; // Propagate into GtkTextView. | 1220 return FALSE; // Propagate into GtkTextView. |
(...skipping 1171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2392 | 2392 |
2393 // Make all the children of the widget visible. NOTE: this won't display | 2393 // Make all the children of the widget visible. NOTE: this won't display |
2394 // anything, it just toggles the visible flag. | 2394 // anything, it just toggles the visible flag. |
2395 gtk_widget_show_all(omnibox_view->GetNativeView()); | 2395 gtk_widget_show_all(omnibox_view->GetNativeView()); |
2396 // Hide the widget. NativeViewHostGtk will make it visible again as necessary. | 2396 // Hide the widget. NativeViewHostGtk will make it visible again as necessary. |
2397 gtk_widget_hide(omnibox_view->GetNativeView()); | 2397 gtk_widget_hide(omnibox_view->GetNativeView()); |
2398 | 2398 |
2399 return omnibox_view; | 2399 return omnibox_view; |
2400 } | 2400 } |
2401 #endif | 2401 #endif |
OLD | NEW |