OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 1135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1146 gtk_grab_add(window_contents_); | 1146 gtk_grab_add(window_contents_); |
1147 } | 1147 } |
1148 | 1148 |
1149 void WidgetGtk::ReleaseGrab() { | 1149 void WidgetGtk::ReleaseGrab() { |
1150 if (has_capture_) { | 1150 if (has_capture_) { |
1151 has_capture_ = false; | 1151 has_capture_ = false; |
1152 gtk_grab_remove(window_contents_); | 1152 gtk_grab_remove(window_contents_); |
1153 } | 1153 } |
1154 } | 1154 } |
1155 | 1155 |
| 1156 void WidgetGtk::HandleGrabBroke() { |
| 1157 if (has_capture_) { |
| 1158 if (is_mouse_down_) |
| 1159 root_view_->ProcessMouseDragCanceled(); |
| 1160 is_mouse_down_ = false; |
| 1161 has_capture_ = false; |
| 1162 } |
| 1163 } |
| 1164 |
1156 //////////////////////////////////////////////////////////////////////////////// | 1165 //////////////////////////////////////////////////////////////////////////////// |
1157 // WidgetGtk, private: | 1166 // WidgetGtk, private: |
1158 | 1167 |
1159 RootView* WidgetGtk::CreateRootView() { | 1168 RootView* WidgetGtk::CreateRootView() { |
1160 return new RootView(this); | 1169 return new RootView(this); |
1161 } | 1170 } |
1162 | 1171 |
1163 gboolean WidgetGtk::OnWindowPaint(GtkWidget* widget, GdkEventExpose* event) { | 1172 gboolean WidgetGtk::OnWindowPaint(GtkWidget* widget, GdkEventExpose* event) { |
1164 // Clear the background to be totally transparent. We don't need to | 1173 // Clear the background to be totally transparent. We don't need to |
1165 // paint the root view here as that is done by OnPaint. | 1174 // paint the root view here as that is done by OnPaint. |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1392 win, | 1401 win, |
1393 ShapeInput, | 1402 ShapeInput, |
1394 0, // x offset | 1403 0, // x offset |
1395 0, // y offset | 1404 0, // y offset |
1396 NULL, // rectangles | 1405 NULL, // rectangles |
1397 0, // num rectangles | 1406 0, // num rectangles |
1398 ShapeSet, | 1407 ShapeSet, |
1399 0); | 1408 0); |
1400 } | 1409 } |
1401 | 1410 |
1402 void WidgetGtk::HandleGrabBroke() { | |
1403 if (has_capture_) { | |
1404 if (is_mouse_down_) | |
1405 root_view_->ProcessMouseDragCanceled(); | |
1406 is_mouse_down_ = false; | |
1407 has_capture_ = false; | |
1408 } | |
1409 } | |
1410 | |
1411 void WidgetGtk::DrawTransparentBackground(GtkWidget* widget, | 1411 void WidgetGtk::DrawTransparentBackground(GtkWidget* widget, |
1412 GdkEventExpose* event) { | 1412 GdkEventExpose* event) { |
1413 cairo_t* cr = gdk_cairo_create(widget->window); | 1413 cairo_t* cr = gdk_cairo_create(widget->window); |
1414 cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR); | 1414 cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR); |
1415 gdk_cairo_region(cr, event->region); | 1415 gdk_cairo_region(cr, event->region); |
1416 cairo_fill(cr); | 1416 cairo_fill(cr); |
1417 cairo_destroy(cr); | 1417 cairo_destroy(cr); |
1418 } | 1418 } |
1419 | 1419 |
1420 //////////////////////////////////////////////////////////////////////////////// | 1420 //////////////////////////////////////////////////////////////////////////////// |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1520 GtkWindow* window = GTK_WINDOW(element->data); | 1520 GtkWindow* window = GTK_WINDOW(element->data); |
1521 DCHECK(window); | 1521 DCHECK(window); |
1522 RootView *root_view = FindRootView(window); | 1522 RootView *root_view = FindRootView(window); |
1523 if (root_view) | 1523 if (root_view) |
1524 root_view->NotifyLocaleChanged(); | 1524 root_view->NotifyLocaleChanged(); |
1525 } | 1525 } |
1526 g_list_free(window_list); | 1526 g_list_free(window_list); |
1527 } | 1527 } |
1528 | 1528 |
1529 } // namespace views | 1529 } // namespace views |
OLD | NEW |