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/browser_titlebar.h" | 5 #include "chrome/browser/ui/gtk/browser_titlebar.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 <string> | 10 #include <string> |
(...skipping 818 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
829 favicon_menu_->PopupForWidget(app_mode_favicon_, event->button, event->time); | 829 favicon_menu_->PopupForWidget(app_mode_favicon_, event->button, event->time); |
830 } | 830 } |
831 | 831 |
832 void BrowserTitlebar::MaximizeButtonClicked() { | 832 void BrowserTitlebar::MaximizeButtonClicked() { |
833 GdkEvent* event = gtk_get_current_event(); | 833 GdkEvent* event = gtk_get_current_event(); |
834 if (event->button.button == 1) { | 834 if (event->button.button == 1) { |
835 gtk_window_maximize(window_); | 835 gtk_window_maximize(window_); |
836 } else { | 836 } else { |
837 GtkWidget* widget = GTK_WIDGET(window_); | 837 GtkWidget* widget = GTK_WIDGET(window_); |
838 GdkScreen* screen = gtk_widget_get_screen(widget); | 838 GdkScreen* screen = gtk_widget_get_screen(widget); |
839 gint monitor = gdk_screen_get_monitor_at_window(screen, widget->window); | 839 gint monitor = gdk_screen_get_monitor_at_window( |
| 840 screen, gtk_widget_get_window(widget)); |
840 GdkRectangle screen_rect; | 841 GdkRectangle screen_rect; |
841 gdk_screen_get_monitor_geometry(screen, monitor, &screen_rect); | 842 gdk_screen_get_monitor_geometry(screen, monitor, &screen_rect); |
842 | 843 |
843 gint x, y; | 844 gint x, y; |
844 gtk_window_get_position(window_, &x, &y); | 845 gtk_window_get_position(window_, &x, &y); |
845 gint width = widget->allocation.width; | 846 gint width = widget->allocation.width; |
846 gint height = widget->allocation.height; | 847 gint height = widget->allocation.height; |
847 | 848 |
848 if (event->button.button == 3) { | 849 if (event->button.button == 3) { |
849 x = 0; | 850 x = 0; |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1035 NOTREACHED(); | 1036 NOTREACHED(); |
1036 } | 1037 } |
1037 } | 1038 } |
1038 | 1039 |
1039 void BrowserTitlebar::ActiveWindowChanged(GdkWindow* active_window) { | 1040 void BrowserTitlebar::ActiveWindowChanged(GdkWindow* active_window) { |
1040 // Can be called during shutdown; BrowserWindowGtk will set our |window_| | 1041 // Can be called during shutdown; BrowserWindowGtk will set our |window_| |
1041 // to NULL during that time. | 1042 // to NULL during that time. |
1042 if (!window_) | 1043 if (!window_) |
1043 return; | 1044 return; |
1044 | 1045 |
1045 window_has_focus_ = GTK_WIDGET(window_)->window == active_window; | 1046 window_has_focus_ = |
| 1047 gtk_widget_get_window(GTK_WIDGET(window_)) == active_window; |
1046 if (IsTypePanel()) { | 1048 if (IsTypePanel()) { |
1047 if (window_has_focus_ || window_has_mouse_) | 1049 if (window_has_focus_ || window_has_mouse_) |
1048 gtk_widget_show(panel_wrench_button_->widget()); | 1050 gtk_widget_show(panel_wrench_button_->widget()); |
1049 else | 1051 else |
1050 gtk_widget_hide(panel_wrench_button_->widget()); | 1052 gtk_widget_hide(panel_wrench_button_->widget()); |
1051 } | 1053 } |
1052 UpdateTextColor(); | 1054 UpdateTextColor(); |
1053 } | 1055 } |
1054 | 1056 |
1055 bool BrowserTitlebar::IsTypePanel() { | 1057 bool BrowserTitlebar::IsTypePanel() { |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1125 ui::SimpleMenuModel::Delegate* delegate) | 1127 ui::SimpleMenuModel::Delegate* delegate) |
1126 : SimpleMenuModel(delegate) { | 1128 : SimpleMenuModel(delegate) { |
1127 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); | 1129 AddItemWithStringId(IDC_NEW_TAB, IDS_TAB_CXMENU_NEWTAB); |
1128 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); | 1130 AddItemWithStringId(IDC_RESTORE_TAB, IDS_RESTORE_TAB); |
1129 AddSeparator(); | 1131 AddSeparator(); |
1130 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); | 1132 AddItemWithStringId(IDC_TASK_MANAGER, IDS_TASK_MANAGER); |
1131 AddSeparator(); | 1133 AddSeparator(); |
1132 AddCheckItemWithStringId(kShowWindowDecorationsCommand, | 1134 AddCheckItemWithStringId(kShowWindowDecorationsCommand, |
1133 IDS_SHOW_WINDOW_DECORATIONS_MENU); | 1135 IDS_SHOW_WINDOW_DECORATIONS_MENU); |
1134 } | 1136 } |
OLD | NEW |