OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include <X11/extensions/shape.h> | 7 #include <X11/extensions/shape.h> |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 | 9 |
10 // Get rid of X11 macros which conflict with gtest. | 10 // Get rid of X11 macros which conflict with gtest. |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 // Creates a widget of size 100x100. | 142 // Creates a widget of size 100x100. |
143 scoped_ptr<Widget> CreateWidget(WidgetDelegate* delegate) { | 143 scoped_ptr<Widget> CreateWidget(WidgetDelegate* delegate) { |
144 scoped_ptr<Widget> widget(new Widget); | 144 scoped_ptr<Widget> widget(new Widget); |
145 Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); | 145 Widget::InitParams params(Widget::InitParams::TYPE_WINDOW); |
146 params.delegate = delegate; | 146 params.delegate = delegate; |
147 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 147 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
148 params.remove_standard_frame = true; | 148 params.remove_standard_frame = true; |
149 params.native_widget = new DesktopNativeWidgetAura(widget.get()); | 149 params.native_widget = new DesktopNativeWidgetAura(widget.get()); |
150 params.bounds = gfx::Rect(100, 100, 100, 100); | 150 params.bounds = gfx::Rect(100, 100, 100, 100); |
151 widget->Init(params); | 151 widget->Init(params); |
152 return widget.Pass(); | 152 return widget; |
153 } | 153 } |
154 | 154 |
155 // Returns the list of rectangles which describe |xid|'s bounding region via the | 155 // Returns the list of rectangles which describe |xid|'s bounding region via the |
156 // X shape extension. | 156 // X shape extension. |
157 std::vector<gfx::Rect> GetShapeRects(XID xid) { | 157 std::vector<gfx::Rect> GetShapeRects(XID xid) { |
158 int dummy; | 158 int dummy; |
159 int shape_rects_size; | 159 int shape_rects_size; |
160 gfx::XScopedPtr<XRectangle[]> shape_rects(XShapeGetRectangles( | 160 gfx::XScopedPtr<XRectangle[]> shape_rects(XShapeGetRectangles( |
161 gfx::GetXDisplay(), xid, ShapeBounding, &shape_rects_size, &dummy)); | 161 gfx::GetXDisplay(), xid, ShapeBounding, &shape_rects_size, &dummy)); |
162 | 162 |
(...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
642 EXPECT_EQ(ui::ET_MOUSEWHEEL, second_recorder.mouse_events()[0].type()); | 642 EXPECT_EQ(ui::ET_MOUSEWHEEL, second_recorder.mouse_events()[0].type()); |
643 EXPECT_EQ(gfx::Point(-25, -25).ToString(), | 643 EXPECT_EQ(gfx::Point(-25, -25).ToString(), |
644 second_recorder.mouse_events()[0].location().ToString()); | 644 second_recorder.mouse_events()[0].location().ToString()); |
645 | 645 |
646 PretendCapture(nullptr); | 646 PretendCapture(nullptr); |
647 first.GetNativeWindow()->RemovePreTargetHandler(&first_recorder); | 647 first.GetNativeWindow()->RemovePreTargetHandler(&first_recorder); |
648 second.GetNativeWindow()->RemovePreTargetHandler(&second_recorder); | 648 second.GetNativeWindow()->RemovePreTargetHandler(&second_recorder); |
649 } | 649 } |
650 | 650 |
651 } // namespace views | 651 } // namespace views |
OLD | NEW |