| 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.h" | 5 #include "ui/views/widget/desktop_aura/desktop_screen.h" |
| 6 | 6 |
| 7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
| 8 | 8 |
| 9 // It clashes with out RootWindow. | 9 // It clashes with out RootWindow. |
| 10 #undef RootWindow | 10 #undef RootWindow |
| 11 | 11 |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "ui/aura/root_window.h" | 13 #include "ui/aura/root_window.h" |
| 14 #include "ui/aura/root_window_host.h" | 14 #include "ui/aura/root_window_host.h" |
| 15 #include "ui/base/x/x11_util.h" | |
| 16 #include "ui/gfx/display.h" | 15 #include "ui/gfx/display.h" |
| 17 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
| 18 #include "ui/gfx/screen.h" | 17 #include "ui/gfx/screen.h" |
| 18 #include "ui/gfx/x/x11_types.h" |
| 19 | 19 |
| 20 namespace { | 20 namespace { |
| 21 | 21 |
| 22 // TODO(erg): This method is a temporary hack, until we can reliably extract | 22 // TODO(erg): This method is a temporary hack, until we can reliably extract |
| 23 // location data out of XRandR. | 23 // location data out of XRandR. |
| 24 gfx::Size GetPrimaryDisplaySize() { | 24 gfx::Size GetPrimaryDisplaySize() { |
| 25 ::Display* display = ui::GetXDisplay(); | 25 ::XDisplay* display = gfx::GetXDisplay(); |
| 26 ::Screen* screen = DefaultScreenOfDisplay(display); | 26 ::Screen* screen = DefaultScreenOfDisplay(display); |
| 27 int width = WidthOfScreen(screen); | 27 int width = WidthOfScreen(screen); |
| 28 int height = HeightOfScreen(screen); | 28 int height = HeightOfScreen(screen); |
| 29 | 29 |
| 30 return gfx::Size(width, height); | 30 return gfx::Size(width, height); |
| 31 } | 31 } |
| 32 | 32 |
| 33 class DesktopScreenX11 : public gfx::Screen { | 33 class DesktopScreenX11 : public gfx::Screen { |
| 34 public: | 34 public: |
| 35 DesktopScreenX11(); | 35 DesktopScreenX11(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 } | 67 } |
| 68 | 68 |
| 69 //////////////////////////////////////////////////////////////////////////////// | 69 //////////////////////////////////////////////////////////////////////////////// |
| 70 // DesktopScreenX11, gfx::Screen implementation: | 70 // DesktopScreenX11, gfx::Screen implementation: |
| 71 | 71 |
| 72 bool DesktopScreenX11::IsDIPEnabled() { | 72 bool DesktopScreenX11::IsDIPEnabled() { |
| 73 return false; | 73 return false; |
| 74 } | 74 } |
| 75 | 75 |
| 76 gfx::Point DesktopScreenX11::GetCursorScreenPoint() { | 76 gfx::Point DesktopScreenX11::GetCursorScreenPoint() { |
| 77 Display* display = ui::GetXDisplay(); | 77 XDisplay* display = gfx::GetXDisplay(); |
| 78 | 78 |
| 79 ::Window root, child; | 79 ::Window root, child; |
| 80 int root_x, root_y, win_x, win_y; | 80 int root_x, root_y, win_x, win_y; |
| 81 unsigned int mask; | 81 unsigned int mask; |
| 82 XQueryPointer(display, | 82 XQueryPointer(display, |
| 83 DefaultRootWindow(display), | 83 DefaultRootWindow(display), |
| 84 &root, | 84 &root, |
| 85 &child, | 85 &child, |
| 86 &root_x, | 86 &root_x, |
| 87 &root_y, | 87 &root_y, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 //////////////////////////////////////////////////////////////////////////////// | 152 //////////////////////////////////////////////////////////////////////////////// |
| 153 | 153 |
| 154 namespace views { | 154 namespace views { |
| 155 | 155 |
| 156 gfx::Screen* CreateDesktopScreen() { | 156 gfx::Screen* CreateDesktopScreen() { |
| 157 return new DesktopScreenX11; | 157 return new DesktopScreenX11; |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace views | 160 } // namespace views |
| OLD | NEW |