| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/gtk/browser_window_gtk.h" | 5 #include "chrome/browser/gtk/browser_window_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdkkeysyms.h> | 7 #include <gdk/gdkkeysyms.h> |
| 8 #include <X11/XF86keysym.h> | 8 #include <X11/XF86keysym.h> |
| 9 | 9 |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| (...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 void BrowserWindowGtk::ShowNewProfileDialog() { | 699 void BrowserWindowGtk::ShowNewProfileDialog() { |
| 700 NOTIMPLEMENTED(); | 700 NOTIMPLEMENTED(); |
| 701 } | 701 } |
| 702 | 702 |
| 703 void BrowserWindowGtk::ShowHTMLDialog(HtmlDialogUIDelegate* delegate, | 703 void BrowserWindowGtk::ShowHTMLDialog(HtmlDialogUIDelegate* delegate, |
| 704 gfx::NativeWindow parent_window) { | 704 gfx::NativeWindow parent_window) { |
| 705 NOTIMPLEMENTED(); | 705 NOTIMPLEMENTED(); |
| 706 } | 706 } |
| 707 | 707 |
| 708 void BrowserWindowGtk::UserChangedTheme() { | 708 void BrowserWindowGtk::UserChangedTheme() { |
| 709 SetBackgroundColor(); |
| 709 gdk_window_invalidate_rect(GTK_WIDGET(window_)->window, | 710 gdk_window_invalidate_rect(GTK_WIDGET(window_)->window, |
| 710 >K_WIDGET(window_)->allocation, TRUE); | 711 >K_WIDGET(window_)->allocation, TRUE); |
| 711 } | 712 } |
| 712 | 713 |
| 713 int BrowserWindowGtk::GetExtraRenderViewHeight() const { | 714 int BrowserWindowGtk::GetExtraRenderViewHeight() const { |
| 714 int sum = infobar_container_->TotalHeightOfClosingBars(); | 715 int sum = infobar_container_->TotalHeightOfClosingBars(); |
| 715 if (bookmark_bar_->IsClosing()) | 716 if (bookmark_bar_->IsClosing()) |
| 716 sum += bookmark_bar_->GetHeight(); | 717 sum += bookmark_bar_->GetHeight(); |
| 717 if (download_shelf_.get() && download_shelf_->IsClosing()) { | 718 if (download_shelf_.get() && download_shelf_->IsClosing()) { |
| 718 sum += download_shelf_->GetHeight(); | 719 sum += download_shelf_->GetHeight(); |
| (...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1132 BrowserWindowGtk* browser_window) { | 1133 BrowserWindowGtk* browser_window) { |
| 1133 int command_id = GetCommandId(keyval, modifier); | 1134 int command_id = GetCommandId(keyval, modifier); |
| 1134 browser_window->ExecuteBrowserCommand(command_id); | 1135 browser_window->ExecuteBrowserCommand(command_id); |
| 1135 | 1136 |
| 1136 return TRUE; | 1137 return TRUE; |
| 1137 } | 1138 } |
| 1138 | 1139 |
| 1139 // static | 1140 // static |
| 1140 gboolean BrowserWindowGtk::OnMouseMoveEvent(GtkWidget* widget, | 1141 gboolean BrowserWindowGtk::OnMouseMoveEvent(GtkWidget* widget, |
| 1141 GdkEventMotion* event, BrowserWindowGtk* browser) { | 1142 GdkEventMotion* event, BrowserWindowGtk* browser) { |
| 1143 // Get the mouse position relative to |widget|. We can't just use event->x |
| 1144 // and event->y because that's relative to the gdk window that got the |
| 1145 // event. |
| 1146 gint x = 0; |
| 1147 gint y = 0; |
| 1148 gtk_widget_get_pointer(widget, &x, &y); |
| 1149 |
| 1142 // Update the cursor if we're on the custom frame border. | 1150 // Update the cursor if we're on the custom frame border. |
| 1143 GdkWindowEdge edge; | 1151 GdkWindowEdge edge; |
| 1144 bool has_hit_edge = browser->GetWindowEdge(static_cast<int>(event->x), | 1152 bool has_hit_edge = browser->GetWindowEdge(x, y, &edge); |
| 1145 static_cast<int>(event->y), &edge); | |
| 1146 GdkCursorType new_cursor = GDK_LAST_CURSOR; | 1153 GdkCursorType new_cursor = GDK_LAST_CURSOR; |
| 1147 if (has_hit_edge) | 1154 if (has_hit_edge) |
| 1148 new_cursor = GdkWindowEdgeToGdkCursorType(edge); | 1155 new_cursor = GdkWindowEdgeToGdkCursorType(edge); |
| 1149 | 1156 |
| 1150 GdkCursorType last_cursor = GDK_LAST_CURSOR; | 1157 GdkCursorType last_cursor = GDK_LAST_CURSOR; |
| 1151 if (browser->frame_cursor_) | 1158 if (browser->frame_cursor_) |
| 1152 last_cursor = browser->frame_cursor_->type; | 1159 last_cursor = browser->frame_cursor_->type; |
| 1153 | 1160 |
| 1154 if (last_cursor != new_cursor) { | 1161 if (last_cursor != new_cursor) { |
| 1155 if (browser->frame_cursor_) { | 1162 if (browser->frame_cursor_) { |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1333 *edge = GDK_WINDOW_EDGE_NORTH_EAST; | 1340 *edge = GDK_WINDOW_EDGE_NORTH_EAST; |
| 1334 } else if (y < bounds_.height() - kResizeAreaCornerSize) { | 1341 } else if (y < bounds_.height() - kResizeAreaCornerSize) { |
| 1335 *edge = GDK_WINDOW_EDGE_EAST; | 1342 *edge = GDK_WINDOW_EDGE_EAST; |
| 1336 } else { | 1343 } else { |
| 1337 *edge = GDK_WINDOW_EDGE_SOUTH_EAST; | 1344 *edge = GDK_WINDOW_EDGE_SOUTH_EAST; |
| 1338 } | 1345 } |
| 1339 return true; | 1346 return true; |
| 1340 } | 1347 } |
| 1341 NOTREACHED(); | 1348 NOTREACHED(); |
| 1342 } | 1349 } |
| OLD | NEW |