OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/desktop_screen_x11.h" | 5 #include "ui/views/widget/desktop_aura/desktop_screen_x11.h" |
6 | 6 |
7 #include <X11/extensions/Xrandr.h> | 7 #include <X11/extensions/Xrandr.h> |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 | 9 |
10 // It clashes with out RootWindow. | 10 // It clashes with out RootWindow. |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 return gfx::Point(root_x, root_y); | 176 return gfx::Point(root_x, root_y); |
177 } | 177 } |
178 | 178 |
179 gfx::NativeWindow DesktopScreenX11::GetWindowUnderCursor() { | 179 gfx::NativeWindow DesktopScreenX11::GetWindowUnderCursor() { |
180 return GetWindowAtScreenPoint(GetCursorScreenPoint()); | 180 return GetWindowAtScreenPoint(GetCursorScreenPoint()); |
181 } | 181 } |
182 | 182 |
183 gfx::NativeWindow DesktopScreenX11::GetWindowAtScreenPoint( | 183 gfx::NativeWindow DesktopScreenX11::GetWindowAtScreenPoint( |
184 const gfx::Point& point) { | 184 const gfx::Point& point) { |
185 std::vector<aura::Window*> windows = | 185 std::vector<aura::Window*> windows = |
186 DesktopRootWindowHostX11::GetAllOpenWindows(); | 186 DesktopWindowTreeHostX11::GetAllOpenWindows(); |
187 | 187 |
188 for (std::vector<aura::Window*>::const_iterator it = windows.begin(); | 188 for (std::vector<aura::Window*>::const_iterator it = windows.begin(); |
189 it != windows.end(); ++it) { | 189 it != windows.end(); ++it) { |
190 if ((*it)->GetBoundsInScreen().Contains(point)) | 190 if ((*it)->GetBoundsInScreen().Contains(point)) |
191 return *it; | 191 return *it; |
192 } | 192 } |
193 | 193 |
194 return NULL; | 194 return NULL; |
195 } | 195 } |
196 | 196 |
(...skipping 11 matching lines...) Expand all Loading... |
208 // | 208 // |
209 // You'd think we'd be able to just call window->GetBoundsInScreen(), but we | 209 // You'd think we'd be able to just call window->GetBoundsInScreen(), but we |
210 // can't because |window| (and the associated RootWindow*) can be partially | 210 // can't because |window| (and the associated RootWindow*) can be partially |
211 // initialized at this point; RootWindow initializations call through into | 211 // initialized at this point; RootWindow initializations call through into |
212 // GetDisplayNearestWindow(). But the X11 resources are created before we | 212 // GetDisplayNearestWindow(). But the X11 resources are created before we |
213 // create the aura::RootWindow. So we ask what the DRWHX11 believes the | 213 // create the aura::RootWindow. So we ask what the DRWHX11 believes the |
214 // window bounds are instead of going through the aura::Window's screen | 214 // window bounds are instead of going through the aura::Window's screen |
215 // bounds. | 215 // bounds. |
216 aura::WindowEventDispatcher* dispatcher = window->GetDispatcher(); | 216 aura::WindowEventDispatcher* dispatcher = window->GetDispatcher(); |
217 if (dispatcher) { | 217 if (dispatcher) { |
218 DesktopRootWindowHostX11* rwh = DesktopRootWindowHostX11::GetHostForXID( | 218 DesktopWindowTreeHostX11* rwh = DesktopWindowTreeHostX11::GetHostForXID( |
219 dispatcher->host()->GetAcceleratedWidget()); | 219 dispatcher->host()->GetAcceleratedWidget()); |
220 if (rwh) | 220 if (rwh) |
221 return GetDisplayMatching(rwh->GetX11RootWindowBounds()); | 221 return GetDisplayMatching(rwh->GetX11RootWindowBounds()); |
222 } | 222 } |
223 | 223 |
224 return GetPrimaryDisplay(); | 224 return GetPrimaryDisplay(); |
225 } | 225 } |
226 | 226 |
227 gfx::Display DesktopScreenX11::GetDisplayNearestPoint( | 227 gfx::Display DesktopScreenX11::GetDisplayNearestPoint( |
228 const gfx::Point& point) const { | 228 const gfx::Point& point) const { |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
382 ProcessDisplayChange(new_displays); | 382 ProcessDisplayChange(new_displays); |
383 } | 383 } |
384 | 384 |
385 //////////////////////////////////////////////////////////////////////////////// | 385 //////////////////////////////////////////////////////////////////////////////// |
386 | 386 |
387 gfx::Screen* CreateDesktopScreen() { | 387 gfx::Screen* CreateDesktopScreen() { |
388 return new DesktopScreenX11; | 388 return new DesktopScreenX11; |
389 } | 389 } |
390 | 390 |
391 } // namespace views | 391 } // namespace views |
OLD | NEW |