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 "views/widget/widget_gtk.h" | 5 #include "views/widget/widget_gtk.h" |
6 | 6 |
7 #include <gdk/gdk.h> | 7 #include <gdk/gdk.h> |
8 #include <gdk/gdkx.h> | 8 #include <gdk/gdkx.h> |
9 #include <X11/extensions/shape.h> | 9 #include <X11/extensions/shape.h> |
10 | 10 |
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 | 1260 |
1261 bool WidgetGtk::ReleaseCaptureOnMouseReleased() { | 1261 bool WidgetGtk::ReleaseCaptureOnMouseReleased() { |
1262 return true; | 1262 return true; |
1263 } | 1263 } |
1264 | 1264 |
1265 void WidgetGtk::HandleXGrabBroke() { | 1265 void WidgetGtk::HandleXGrabBroke() { |
1266 } | 1266 } |
1267 | 1267 |
1268 void WidgetGtk::HandleGtkGrabBroke() { | 1268 void WidgetGtk::HandleGtkGrabBroke() { |
1269 if (is_mouse_down_) | 1269 if (is_mouse_down_) |
1270 GetRootView()->ProcessMouseDragCanceled(); | 1270 GetRootView()->OnMouseCaptureLost(); |
1271 is_mouse_down_ = false; | 1271 is_mouse_down_ = false; |
1272 } | 1272 } |
1273 | 1273 |
1274 //////////////////////////////////////////////////////////////////////////////// | 1274 //////////////////////////////////////////////////////////////////////////////// |
1275 // WidgetGtk, private: | 1275 // WidgetGtk, private: |
1276 | 1276 |
1277 RootView* WidgetGtk::CreateRootView() { | 1277 RootView* WidgetGtk::CreateRootView() { |
1278 return new RootView(this); | 1278 return new RootView(this); |
1279 } | 1279 } |
1280 | 1280 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 last_mouse_event_was_move_ = false; | 1331 last_mouse_event_was_move_ = false; |
1332 MouseEvent mouse_up(ui::ET_MOUSE_RELEASED, x, y, | 1332 MouseEvent mouse_up(ui::ET_MOUSE_RELEASED, x, y, |
1333 GetFlagsForEventButton(*event)); | 1333 GetFlagsForEventButton(*event)); |
1334 // Release the capture first, that way we don't get confused if | 1334 // Release the capture first, that way we don't get confused if |
1335 // OnMouseReleased blocks. | 1335 // OnMouseReleased blocks. |
1336 if (HasNativeCapture() && ReleaseCaptureOnMouseReleased()) | 1336 if (HasNativeCapture() && ReleaseCaptureOnMouseReleased()) |
1337 ReleaseNativeCapture(); | 1337 ReleaseNativeCapture(); |
1338 is_mouse_down_ = false; | 1338 is_mouse_down_ = false; |
1339 // GTK generates a mouse release at the end of dnd. We need to ignore it. | 1339 // GTK generates a mouse release at the end of dnd. We need to ignore it. |
1340 if (!drag_data_) | 1340 if (!drag_data_) |
1341 GetRootView()->OnMouseReleased(mouse_up, false); | 1341 GetRootView()->OnMouseReleased(mouse_up); |
1342 } | 1342 } |
1343 | 1343 |
1344 bool WidgetGtk::ProcessScroll(GdkEventScroll* event) { | 1344 bool WidgetGtk::ProcessScroll(GdkEventScroll* event) { |
1345 // An event may come from a contained widget which has its own gdk window. | 1345 // An event may come from a contained widget which has its own gdk window. |
1346 // Translate it to the widget's coordinates. | 1346 // Translate it to the widget's coordinates. |
1347 int x = 0, y = 0; | 1347 int x = 0, y = 0; |
1348 GetContainedWidgetEventCoordinates(event, &x, &y); | 1348 GetContainedWidgetEventCoordinates(event, &x, &y); |
1349 GdkEventScroll translated_event = *event; | 1349 GdkEventScroll translated_event = *event; |
1350 translated_event.x = x; | 1350 translated_event.x = x; |
1351 translated_event.y = y; | 1351 translated_event.y = y; |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1609 | 1609 |
1610 NativeWidget* native_widget = GetNativeWidgetForNativeView(native_view); | 1610 NativeWidget* native_widget = GetNativeWidgetForNativeView(native_view); |
1611 if (native_widget) | 1611 if (native_widget) |
1612 children->insert(native_widget); | 1612 children->insert(native_widget); |
1613 gtk_container_foreach(GTK_CONTAINER(native_view), | 1613 gtk_container_foreach(GTK_CONTAINER(native_view), |
1614 EnumerateChildWidgetsForNativeWidgets, | 1614 EnumerateChildWidgetsForNativeWidgets, |
1615 reinterpret_cast<gpointer>(children)); | 1615 reinterpret_cast<gpointer>(children)); |
1616 } | 1616 } |
1617 | 1617 |
1618 } // namespace views | 1618 } // namespace views |
OLD | NEW |