| 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/tab_contents/tab_contents_view_gtk.h" | 5 #include "chrome/browser/tab_contents/tab_contents_view_gtk.h" |
| 6 | 6 |
| 7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
| 8 #include <gdk/gdkkeysyms.h> | 8 #include <gdk/gdkkeysyms.h> |
| 9 #include <gtk/gtk.h> | 9 #include <gtk/gtk.h> |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 gtk_widget_grab_focus(widget); | 62 gtk_widget_grab_focus(widget); |
| 63 bool reverse = focus == GTK_DIR_TAB_BACKWARD; | 63 bool reverse = focus == GTK_DIR_TAB_BACKWARD; |
| 64 tab_contents->FocusThroughTabTraversal(reverse); | 64 tab_contents->FocusThroughTabTraversal(reverse); |
| 65 return TRUE; | 65 return TRUE; |
| 66 } | 66 } |
| 67 | 67 |
| 68 // Called when the mouse leaves the widget. We notify our delegate. | 68 // Called when the mouse leaves the widget. We notify our delegate. |
| 69 gboolean OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event, | 69 gboolean OnLeaveNotify(GtkWidget* widget, GdkEventCrossing* event, |
| 70 TabContents* tab_contents) { | 70 TabContents* tab_contents) { |
| 71 if (tab_contents->delegate()) | 71 if (tab_contents->delegate()) |
| 72 tab_contents->delegate()->ContentsMouseEvent(tab_contents, false); | 72 tab_contents->delegate()->ContentsMouseEvent( |
| 73 tab_contents, gfx::Point(event->x_root, event->y_root), false); |
| 73 return FALSE; | 74 return FALSE; |
| 74 } | 75 } |
| 75 | 76 |
| 76 // Called when the mouse moves within the widget. We notify our delegate. | 77 // Called when the mouse moves within the widget. We notify our delegate. |
| 77 gboolean OnMouseMove(GtkWidget* widget, GdkEventMotion* event, | 78 gboolean OnMouseMove(GtkWidget* widget, GdkEventMotion* event, |
| 78 TabContents* tab_contents) { | 79 TabContents* tab_contents) { |
| 79 if (tab_contents->delegate()) | 80 if (tab_contents->delegate()) |
| 80 tab_contents->delegate()->ContentsMouseEvent(tab_contents, true); | 81 tab_contents->delegate()->ContentsMouseEvent( |
| 82 tab_contents, gfx::Point(event->x_root, event->y_root), true); |
| 81 return FALSE; | 83 return FALSE; |
| 82 } | 84 } |
| 83 | 85 |
| 84 // See tab_contents_view_win.cc for discussion of mouse scroll zooming. | 86 // See tab_contents_view_win.cc for discussion of mouse scroll zooming. |
| 85 gboolean OnMouseScroll(GtkWidget* widget, GdkEventScroll* event, | 87 gboolean OnMouseScroll(GtkWidget* widget, GdkEventScroll* event, |
| 86 TabContents* tab_contents) { | 88 TabContents* tab_contents) { |
| 87 if ((event->state & gtk_accelerator_get_default_mod_mask()) == | 89 if ((event->state & gtk_accelerator_get_default_mod_mask()) == |
| 88 GDK_CONTROL_MASK) { | 90 GDK_CONTROL_MASK) { |
| 89 if (event->direction == GDK_SCROLL_DOWN) { | 91 if (event->direction == GDK_SCROLL_DOWN) { |
| 90 tab_contents->delegate()->ContentsZoomChange(false); | 92 tab_contents->delegate()->ContentsZoomChange(false); |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 472 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 474 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
| 473 widget, "x", &value); | 475 widget, "x", &value); |
| 474 | 476 |
| 475 int child_y = std::max(half_view_height - (requisition.height / 2), 0); | 477 int child_y = std::max(half_view_height - (requisition.height / 2), 0); |
| 476 g_value_set_int(&value, child_y); | 478 g_value_set_int(&value, child_y); |
| 477 gtk_container_child_set_property(GTK_CONTAINER(floating_container), | 479 gtk_container_child_set_property(GTK_CONTAINER(floating_container), |
| 478 widget, "y", &value); | 480 widget, "y", &value); |
| 479 g_value_unset(&value); | 481 g_value_unset(&value); |
| 480 } | 482 } |
| 481 } | 483 } |
| OLD | NEW |