Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(225)

Unified Diff: ui/views/widget/desktop_aura/desktop_screen_wayland.cc

Issue 17265006: wayland patch for inspection Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_root_window_host_wayland.cc ('k') | ui/wayland/demos/sample.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/desktop_screen_wayland.cc
diff --git a/ui/views/widget/desktop_aura/desktop_screen_x11.cc b/ui/views/widget/desktop_aura/desktop_screen_wayland.cc
similarity index 60%
copy from ui/views/widget/desktop_aura/desktop_screen_x11.cc
copy to ui/views/widget/desktop_aura/desktop_screen_wayland.cc
index 77dbaa497a79b926d93fd2fe4b896af09946cdde..d0b3f17fc382561263bc26dcf1e2d960fbabd89e 100644
--- a/ui/views/widget/desktop_aura/desktop_screen_x11.cc
+++ b/ui/views/widget/desktop_aura/desktop_screen_wayland.cc
@@ -4,36 +4,27 @@
#include "ui/views/widget/desktop_aura/desktop_screen.h"
-#include <X11/Xlib.h>
-
-// It clashes with out RootWindow.
-#undef RootWindow
-
#include "base/logging.h"
#include "ui/aura/root_window.h"
#include "ui/aura/root_window_host.h"
-#include "ui/base/x/x11_util.h"
#include "ui/gfx/display.h"
#include "ui/gfx/native_widget_types.h"
#include "ui/gfx/screen.h"
+#include "ui/wayland/wayland_display.h"
+#include "ui/wayland/wayland_screen.h"
namespace {
-// TODO(erg): This method is a temporary hack, until we can reliably extract
-// location data out of XRandR.
gfx::Size GetPrimaryDisplaySize() {
- ::Display* display = ui::GetXDisplay();
- ::Screen* screen = DefaultScreenOfDisplay(display);
- int width = WidthOfScreen(screen);
- int height = HeightOfScreen(screen);
-
- return gfx::Size(width, height);
+ ui::WaylandDisplay* display = ui::WaylandDisplay::GetDisplay();
+ std::list<ui::WaylandScreen*> screens = display->GetScreenList();
+ return screens.empty() ? gfx::Size() : screens.front()->GetAllocation().size();
}
-class DesktopScreenX11 : public gfx::Screen {
+class DesktopScreenWayland : public gfx::Screen {
public:
- DesktopScreenX11();
- virtual ~DesktopScreenX11();
+ DesktopScreenWayland();
+ virtual ~DesktopScreenWayland();
// Overridden from gfx::Screen:
virtual bool IsDIPEnabled() OVERRIDE;
@@ -51,84 +42,69 @@ class DesktopScreenX11 : public gfx::Screen {
virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE;
private:
- DISALLOW_COPY_AND_ASSIGN(DesktopScreenX11);
+ DISALLOW_COPY_AND_ASSIGN(DesktopScreenWayland);
};
////////////////////////////////////////////////////////////////////////////////
-// DesktopScreenX11, public:
+// DesktopScreenWayland, public:
-DesktopScreenX11::DesktopScreenX11() {
+DesktopScreenWayland::DesktopScreenWayland() {
}
-DesktopScreenX11::~DesktopScreenX11() {
+DesktopScreenWayland::~DesktopScreenWayland() {
}
////////////////////////////////////////////////////////////////////////////////
-// DesktopScreenX11, gfx::Screen implementation:
+// DesktopScreenWayland, gfx::Screen implementation:
-bool DesktopScreenX11::IsDIPEnabled() {
+bool DesktopScreenWayland::IsDIPEnabled() {
return false;
}
-gfx::Point DesktopScreenX11::GetCursorScreenPoint() {
- Display* display = ui::GetXDisplay();
-
- ::Window root, child;
- int root_x, root_y, win_x, win_y;
- unsigned int mask;
- XQueryPointer(display,
- DefaultRootWindow(display),
- &root,
- &child,
- &root_x,
- &root_y,
- &win_x,
- &win_y,
- &mask);
-
- return gfx::Point(root_x, root_y);
+gfx::Point DesktopScreenWayland::GetCursorScreenPoint() {
+ return gfx::Point();
}
-gfx::NativeWindow DesktopScreenX11::GetWindowAtCursorScreenPoint() {
+gfx::NativeWindow DesktopScreenWayland::GetWindowAtCursorScreenPoint() {
// TODO(erg): Implement using the discussion at
// http://codereview.chromium.org/10279005/
return NULL;
}
-int DesktopScreenX11::GetNumDisplays() {
+int DesktopScreenWayland::GetNumDisplays() {
// TODO(erg): Figure this out with oshima or piman because I have no clue
// about the XRandR implications here.
return 1;
}
-gfx::Display DesktopScreenX11::GetDisplayNearestWindow(
+gfx::Display DesktopScreenWayland::GetDisplayNearestWindow(
gfx::NativeView window) const {
// TODO(erg): Do the right thing once we know what that is.
return gfx::Display(0, gfx::Rect(GetPrimaryDisplaySize()));
}
-gfx::Display DesktopScreenX11::GetDisplayNearestPoint(
+gfx::Display DesktopScreenWayland::GetDisplayNearestPoint(
const gfx::Point& point) const {
// TODO(erg): Do the right thing once we know what that is.
return gfx::Display(0, gfx::Rect(GetPrimaryDisplaySize()));
}
-gfx::Display DesktopScreenX11::GetDisplayMatching(
+gfx::Display DesktopScreenWayland::GetDisplayMatching(
const gfx::Rect& match_rect) const {
// TODO(erg): Do the right thing once we know what that is.
return gfx::Display(0, gfx::Rect(GetPrimaryDisplaySize()));
}
-gfx::Display DesktopScreenX11::GetPrimaryDisplay() const {
+gfx::Display DesktopScreenWayland::GetPrimaryDisplay() const {
// TODO(erg): Do the right thing once we know what that is.
return gfx::Display(0, gfx::Rect(GetPrimaryDisplaySize()));
}
-void DesktopScreenX11::AddObserver(gfx::DisplayObserver* observer) {
+void DesktopScreenWayland::AddObserver(gfx::DisplayObserver* observer) {
// TODO(erg|oshima): Do the right thing once we know what that is.
// crbug.com/122863
}
-void DesktopScreenX11::RemoveObserver(gfx::DisplayObserver* observer) {
+void DesktopScreenWayland::RemoveObserver(gfx::DisplayObserver* observer) {
// TODO(erg|oshima): Do the right thing once we know what that is.
// crbug.com/122863
}
@@ -140,7 +116,7 @@ void DesktopScreenX11::RemoveObserver(gfx::DisplayObserver* observer) {
namespace views {
gfx::Screen* CreateDesktopScreen() {
- return new DesktopScreenX11;
+ return new DesktopScreenWayland;
}
} // namespace views
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_root_window_host_wayland.cc ('k') | ui/wayland/demos/sample.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698