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 "ui/views/widget/desktop_aura/x11_topmost_window_finder.h" | 5 #include "ui/views/widget/desktop_aura/x11_topmost_window_finder.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 #include <X11/extensions/shape.h> | 9 #include <X11/extensions/shape.h> |
10 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // the returned widget. | 121 // the returned widget. |
122 scoped_ptr<Widget> CreateAndShowWidget(const gfx::Rect& bounds) { | 122 scoped_ptr<Widget> CreateAndShowWidget(const gfx::Rect& bounds) { |
123 scoped_ptr<Widget> toplevel(new Widget); | 123 scoped_ptr<Widget> toplevel(new Widget); |
124 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); | 124 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); |
125 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 125 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
126 params.native_widget = new DesktopNativeWidgetAura(toplevel.get()); | 126 params.native_widget = new DesktopNativeWidgetAura(toplevel.get()); |
127 params.bounds = bounds; | 127 params.bounds = bounds; |
128 params.remove_standard_frame = true; | 128 params.remove_standard_frame = true; |
129 toplevel->Init(params); | 129 toplevel->Init(params); |
130 toplevel->Show(); | 130 toplevel->Show(); |
131 return toplevel.Pass(); | 131 return toplevel; |
132 } | 132 } |
133 | 133 |
134 // Creates and shows an X window with |bounds|. | 134 // Creates and shows an X window with |bounds|. |
135 XID CreateAndShowXWindow(const gfx::Rect& bounds) { | 135 XID CreateAndShowXWindow(const gfx::Rect& bounds) { |
136 XID root = DefaultRootWindow(xdisplay()); | 136 XID root = DefaultRootWindow(xdisplay()); |
137 XID xid = XCreateSimpleWindow(xdisplay(), | 137 XID xid = XCreateSimpleWindow(xdisplay(), |
138 root, | 138 root, |
139 0, 0, 1, 1, | 139 0, 0, 1, 1, |
140 0, // border_width | 140 0, // border_width |
141 0, // border | 141 0, // border |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
433 | 433 |
434 EXPECT_EQ(xid, FindTopmostXWindowAt(110, 110)); | 434 EXPECT_EQ(xid, FindTopmostXWindowAt(110, 110)); |
435 EXPECT_EQ(menu_xid, FindTopmostXWindowAt(150, 120)); | 435 EXPECT_EQ(menu_xid, FindTopmostXWindowAt(150, 120)); |
436 EXPECT_EQ(menu_xid, FindTopmostXWindowAt(210, 120)); | 436 EXPECT_EQ(menu_xid, FindTopmostXWindowAt(210, 120)); |
437 | 437 |
438 XDestroyWindow(xdisplay(), xid); | 438 XDestroyWindow(xdisplay(), xid); |
439 XDestroyWindow(xdisplay(), menu_xid); | 439 XDestroyWindow(xdisplay(), menu_xid); |
440 } | 440 } |
441 | 441 |
442 } // namespace views | 442 } // namespace views |
OLD | NEW |