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 1187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1198 | 1198 |
1199 gboolean OmniboxViewGtk::HandleViewFocusOut(GtkWidget* sender, | 1199 gboolean OmniboxViewGtk::HandleViewFocusOut(GtkWidget* sender, |
1200 GdkEventFocus* event) { | 1200 GdkEventFocus* event) { |
1201 DCHECK(text_view_); | 1201 DCHECK(text_view_); |
1202 GtkWidget* view_getting_focus = NULL; | 1202 GtkWidget* view_getting_focus = NULL; |
1203 GtkWindow* toplevel = platform_util::GetTopLevel(sender); | 1203 GtkWindow* toplevel = platform_util::GetTopLevel(sender); |
1204 if (gtk_window_is_active(toplevel)) | 1204 if (gtk_window_is_active(toplevel)) |
1205 view_getting_focus = going_to_focus_; | 1205 view_getting_focus = going_to_focus_; |
1206 | 1206 |
1207 // This must be invoked before ClosePopup. | 1207 // This must be invoked before ClosePopup. |
1208 model_->OnWillKillFocus(view_getting_focus); | 1208 model_->OnWillKillFocus(); |
1209 | 1209 |
1210 // Close the popup. | 1210 // Close the popup. |
1211 ClosePopup(); | 1211 ClosePopup(); |
1212 // Tell the model to reset itself. | 1212 // Tell the model to reset itself. |
1213 model_->OnKillFocus(); | 1213 model_->OnKillFocus(); |
1214 controller_->OnKillFocus(); | 1214 controller_->OnKillFocus(); |
1215 | 1215 |
1216 g_signal_handlers_disconnect_by_func( | 1216 g_signal_handlers_disconnect_by_func( |
1217 gdk_keymap_get_for_display(gtk_widget_get_display(text_view_)), | 1217 gdk_keymap_get_for_display(gtk_widget_get_display(text_view_)), |
1218 reinterpret_cast<gpointer>(&HandleKeymapDirectionChangedThunk), this); | 1218 reinterpret_cast<gpointer>(&HandleKeymapDirectionChangedThunk), this); |
(...skipping 1023 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2242 void OmniboxViewGtk::AdjustVerticalAlignmentOfInstantView() { | 2242 void OmniboxViewGtk::AdjustVerticalAlignmentOfInstantView() { |
2243 // By default, GtkTextView layouts an anchored child widget just above the | 2243 // By default, GtkTextView layouts an anchored child widget just above the |
2244 // baseline, so we need to move the |instant_view_| down to make sure it | 2244 // baseline, so we need to move the |instant_view_| down to make sure it |
2245 // has the same baseline as the |text_view_|. | 2245 // has the same baseline as the |text_view_|. |
2246 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); | 2246 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); |
2247 int height; | 2247 int height; |
2248 pango_layout_get_size(layout, NULL, &height); | 2248 pango_layout_get_size(layout, NULL, &height); |
2249 int baseline = pango_layout_get_baseline(layout); | 2249 int baseline = pango_layout_get_baseline(layout); |
2250 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); | 2250 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); |
2251 } | 2251 } |
OLD | NEW |