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

Side by Side Diff: chrome/browser/ui/gtk/find_bar_gtk.cc

Issue 7484035: Reapplies r91761. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/find_bar_gtk.h" 5 #include "chrome/browser/ui/gtk/find_bar_gtk.h"
6 6
7 #include <gdk/gdkkeysyms.h> 7 #include <gdk/gdkkeysyms.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <string> 10 #include <string>
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
431 gfx::Rect view_location( 431 gfx::Rect view_location(
432 ltr ? dialog_bounds.width() - prefsize.width() : dialog_bounds.x(), 432 ltr ? dialog_bounds.width() - prefsize.width() : dialog_bounds.x(),
433 dialog_bounds.y(), prefsize.width(), prefsize.height()); 433 dialog_bounds.y(), prefsize.width(), prefsize.height());
434 gfx::Rect new_pos = FindBarController::GetLocationForFindbarView( 434 gfx::Rect new_pos = FindBarController::GetLocationForFindbarView(
435 view_location, dialog_bounds, avoid_overlapping_rect); 435 view_location, dialog_bounds, avoid_overlapping_rect);
436 436
437 return new_pos; 437 return new_pos;
438 } 438 }
439 439
440 bool FindBarGtk::IsFindBarVisible() { 440 bool FindBarGtk::IsFindBarVisible() {
441 return GTK_WIDGET_VISIBLE(widget()); 441 return gtk_widget_get_visible(widget());
442 } 442 }
443 443
444 void FindBarGtk::RestoreSavedFocus() { 444 void FindBarGtk::RestoreSavedFocus() {
445 // This function sometimes gets called when we don't have focus. We should do 445 // This function sometimes gets called when we don't have focus. We should do
446 // nothing in this case. 446 // nothing in this case.
447 if (!gtk_widget_is_focus(text_entry_)) 447 if (!gtk_widget_is_focus(text_entry_))
448 return; 448 return;
449 449
450 if (focus_store_.widget()) 450 if (focus_store_.widget())
451 gtk_widget_grab_focus(focus_store_.widget()); 451 gtk_widget_grab_focus(focus_store_.widget());
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 680
681 void FindBarGtk::AdjustTextAlignment() { 681 void FindBarGtk::AdjustTextAlignment() {
682 PangoDirection content_dir = 682 PangoDirection content_dir =
683 pango_find_base_dir(gtk_entry_get_text(GTK_ENTRY(text_entry_)), -1); 683 pango_find_base_dir(gtk_entry_get_text(GTK_ENTRY(text_entry_)), -1);
684 684
685 GtkTextDirection widget_dir = gtk_widget_get_direction(text_entry_); 685 GtkTextDirection widget_dir = gtk_widget_get_direction(text_entry_);
686 686
687 // Use keymap or widget direction if content does not have strong direction. 687 // Use keymap or widget direction if content does not have strong direction.
688 // It matches the behavior of GtkEntry. 688 // It matches the behavior of GtkEntry.
689 if (content_dir == PANGO_DIRECTION_NEUTRAL) { 689 if (content_dir == PANGO_DIRECTION_NEUTRAL) {
690 if (GTK_WIDGET_HAS_FOCUS(text_entry_)) { 690 if (gtk_widget_has_focus(text_entry_)) {
691 content_dir = gdk_keymap_get_direction( 691 content_dir = gdk_keymap_get_direction(
692 gdk_keymap_get_for_display(gtk_widget_get_display(text_entry_))); 692 gdk_keymap_get_for_display(gtk_widget_get_display(text_entry_)));
693 } else { 693 } else {
694 if (widget_dir == GTK_TEXT_DIR_RTL) 694 if (widget_dir == GTK_TEXT_DIR_RTL)
695 content_dir = PANGO_DIRECTION_RTL; 695 content_dir = PANGO_DIRECTION_RTL;
696 else 696 else
697 content_dir = PANGO_DIRECTION_LTR; 697 content_dir = PANGO_DIRECTION_LTR;
698 } 698 }
699 } 699 }
700 700
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 982
983 // static 983 // static
984 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event, 984 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event,
985 FindBarGtk* find_bar) { 985 FindBarGtk* find_bar) {
986 g_signal_handlers_disconnect_by_func( 986 g_signal_handlers_disconnect_by_func(
987 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), 987 gdk_keymap_get_for_display(gtk_widget_get_display(entry)),
988 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), find_bar); 988 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), find_bar);
989 989
990 return FALSE; // Continue propagation. 990 return FALSE; // Continue propagation.
991 } 991 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/gtk/extensions/extension_installed_bubble_gtk.cc ('k') | chrome/browser/ui/gtk/gtk_chrome_button.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698