OLD | NEW |
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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 gfx::Rect view_location( | 430 gfx::Rect view_location( |
431 ltr ? dialog_bounds.width() - prefsize.width() : dialog_bounds.x(), | 431 ltr ? dialog_bounds.width() - prefsize.width() : dialog_bounds.x(), |
432 dialog_bounds.y(), prefsize.width(), prefsize.height()); | 432 dialog_bounds.y(), prefsize.width(), prefsize.height()); |
433 gfx::Rect new_pos = FindBarController::GetLocationForFindbarView( | 433 gfx::Rect new_pos = FindBarController::GetLocationForFindbarView( |
434 view_location, dialog_bounds, avoid_overlapping_rect); | 434 view_location, dialog_bounds, avoid_overlapping_rect); |
435 | 435 |
436 return new_pos; | 436 return new_pos; |
437 } | 437 } |
438 | 438 |
439 bool FindBarGtk::IsFindBarVisible() { | 439 bool FindBarGtk::IsFindBarVisible() { |
440 return GTK_WIDGET_VISIBLE(widget()); | 440 return gtk_widget_get_visible(widget()); |
441 } | 441 } |
442 | 442 |
443 void FindBarGtk::RestoreSavedFocus() { | 443 void FindBarGtk::RestoreSavedFocus() { |
444 // This function sometimes gets called when we don't have focus. We should do | 444 // This function sometimes gets called when we don't have focus. We should do |
445 // nothing in this case. | 445 // nothing in this case. |
446 if (!gtk_widget_is_focus(text_entry_)) | 446 if (!gtk_widget_is_focus(text_entry_)) |
447 return; | 447 return; |
448 | 448 |
449 if (focus_store_.widget()) | 449 if (focus_store_.widget()) |
450 gtk_widget_grab_focus(focus_store_.widget()); | 450 gtk_widget_grab_focus(focus_store_.widget()); |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 | 679 |
680 void FindBarGtk::AdjustTextAlignment() { | 680 void FindBarGtk::AdjustTextAlignment() { |
681 PangoDirection content_dir = | 681 PangoDirection content_dir = |
682 pango_find_base_dir(gtk_entry_get_text(GTK_ENTRY(text_entry_)), -1); | 682 pango_find_base_dir(gtk_entry_get_text(GTK_ENTRY(text_entry_)), -1); |
683 | 683 |
684 GtkTextDirection widget_dir = gtk_widget_get_direction(text_entry_); | 684 GtkTextDirection widget_dir = gtk_widget_get_direction(text_entry_); |
685 | 685 |
686 // Use keymap or widget direction if content does not have strong direction. | 686 // Use keymap or widget direction if content does not have strong direction. |
687 // It matches the behavior of GtkEntry. | 687 // It matches the behavior of GtkEntry. |
688 if (content_dir == PANGO_DIRECTION_NEUTRAL) { | 688 if (content_dir == PANGO_DIRECTION_NEUTRAL) { |
689 if (GTK_WIDGET_HAS_FOCUS(text_entry_)) { | 689 if (gtk_widget_has_focus(text_entry_)) { |
690 content_dir = gdk_keymap_get_direction( | 690 content_dir = gdk_keymap_get_direction( |
691 gdk_keymap_get_for_display(gtk_widget_get_display(text_entry_))); | 691 gdk_keymap_get_for_display(gtk_widget_get_display(text_entry_))); |
692 } else { | 692 } else { |
693 if (widget_dir == GTK_TEXT_DIR_RTL) | 693 if (widget_dir == GTK_TEXT_DIR_RTL) |
694 content_dir = PANGO_DIRECTION_RTL; | 694 content_dir = PANGO_DIRECTION_RTL; |
695 else | 695 else |
696 content_dir = PANGO_DIRECTION_LTR; | 696 content_dir = PANGO_DIRECTION_LTR; |
697 } | 697 } |
698 } | 698 } |
699 | 699 |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
981 | 981 |
982 // static | 982 // static |
983 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event, | 983 gboolean FindBarGtk::OnFocusOut(GtkWidget* entry, GdkEventFocus* event, |
984 FindBarGtk* find_bar) { | 984 FindBarGtk* find_bar) { |
985 g_signal_handlers_disconnect_by_func( | 985 g_signal_handlers_disconnect_by_func( |
986 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), | 986 gdk_keymap_get_for_display(gtk_widget_get_display(entry)), |
987 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), find_bar); | 987 reinterpret_cast<gpointer>(&OnKeymapDirectionChanged), find_bar); |
988 | 988 |
989 return FALSE; // Continue propagation. | 989 return FALSE; // Continue propagation. |
990 } | 990 } |
OLD | NEW |