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

Side by Side Diff: chrome/browser/ui/gtk/omnibox/omnibox_view_gtk.cc

Issue 7227027: GTK: More 2.18 goodness. Move from macros to real accessor functions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove views/ Created 9 years, 5 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 | Annotate | Revision Log
OLDNEW
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/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 1239 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 return FALSE; 1250 return FALSE;
1251 1251
1252 DCHECK(text_view_); 1252 DCHECK(text_view_);
1253 1253
1254 if (event->button == 1) { 1254 if (event->button == 1) {
1255 #if defined(OS_CHROMEOS) 1255 #if defined(OS_CHROMEOS)
1256 // When the first button is pressed, track some stuff that will help us 1256 // When the first button is pressed, track some stuff that will help us
1257 // determine whether we should select all of the text when the button is 1257 // determine whether we should select all of the text when the button is
1258 // released. 1258 // released.
1259 button_1_pressed_ = true; 1259 button_1_pressed_ = true;
1260 text_view_focused_before_button_press_ = GTK_WIDGET_HAS_FOCUS(text_view_); 1260 text_view_focused_before_button_press_ = gtk_widget_has_focus(text_view_);
1261 text_selected_during_click_ = false; 1261 text_selected_during_click_ = false;
1262 #endif 1262 #endif
1263 1263
1264 // Button press event may change the selection, we need to record the change 1264 // Button press event may change the selection, we need to record the change
1265 // and report it to |model_| later when button is released. 1265 // and report it to |model_| later when button is released.
1266 OnBeforePossibleChange(); 1266 OnBeforePossibleChange();
1267 } else if (event->button == 2) { 1267 } else if (event->button == 2) {
1268 // GtkTextView pastes PRIMARY selection with middle click. 1268 // GtkTextView pastes PRIMARY selection with middle click.
1269 // We can't call model_->on_paste_replacing_all() here, because the actual 1269 // We can't call model_->on_paste_replacing_all() here, because the actual
1270 // paste clipboard action may not be performed if the clipboard is empty. 1270 // paste clipboard action may not be performed if the clipboard is empty.
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
1691 1691
1692 // Trigger Tab to search behavior only when Tab key is pressed. 1692 // Trigger Tab to search behavior only when Tab key is pressed.
1693 if (model_->is_keyword_hint()) 1693 if (model_->is_keyword_hint())
1694 handled = model_->AcceptKeyword(); 1694 handled = model_->AcceptKeyword();
1695 1695
1696 #if GTK_CHECK_VERSION(2, 20, 0) 1696 #if GTK_CHECK_VERSION(2, 20, 0)
1697 if (!handled && !pre_edit_.empty()) 1697 if (!handled && !pre_edit_.empty())
1698 handled = true; 1698 handled = true;
1699 #endif 1699 #endif
1700 1700
1701 if (!handled && GTK_WIDGET_VISIBLE(instant_view_)) 1701 if (!handled && gtk_widget_get_visible(instant_view_))
1702 handled = model_->CommitSuggestedText(true); 1702 handled = model_->CommitSuggestedText(true);
1703 1703
1704 if (!handled) { 1704 if (!handled) {
1705 if (!IsCaretAtEnd()) { 1705 if (!IsCaretAtEnd()) {
1706 OnBeforePossibleChange(); 1706 OnBeforePossibleChange();
1707 PlaceCaretAt(GetTextLength()); 1707 PlaceCaretAt(GetTextLength());
1708 OnAfterPossibleChange(); 1708 OnAfterPossibleChange();
1709 handled = true; 1709 handled = true;
1710 } 1710 }
1711 } 1711 }
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
2332 // baseline, so we need to move the |instant_view_| down to make sure it 2332 // baseline, so we need to move the |instant_view_| down to make sure it
2333 // has the same baseline as the |text_view_|. 2333 // has the same baseline as the |text_view_|.
2334 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_)); 2334 PangoLayout* layout = gtk_label_get_layout(GTK_LABEL(instant_view_));
2335 int height; 2335 int height;
2336 pango_layout_get_size(layout, NULL, &height); 2336 pango_layout_get_size(layout, NULL, &height);
2337 PangoLayoutIter* iter = pango_layout_get_iter(layout); 2337 PangoLayoutIter* iter = pango_layout_get_iter(layout);
2338 int baseline = pango_layout_iter_get_baseline(iter); 2338 int baseline = pango_layout_iter_get_baseline(iter);
2339 pango_layout_iter_free(iter); 2339 pango_layout_iter_free(iter);
2340 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL); 2340 g_object_set(instant_anchor_tag_, "rise", baseline - height, NULL);
2341 } 2341 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/omnibox/omnibox_popup_view_gtk.cc ('k') | chrome/browser/ui/gtk/reload_button_gtk.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698