Add Tizen-platform implementation of Screen.
authorSeungSeop Park <sns.park@samsung.com>
Tue, 27 May 2014 15:50:15 +0000 (11:50 -0400)
committerYoungsoo Choi <kenshin.choi@samsung.com>
Tue, 10 Jul 2018 06:57:09 +0000 (06:57 +0000)
All Screen methods fallback to GetPrimaryScreen at this point.

Change-Id: I411a31453f20f1d0b13ace9b5838d2b03d436875

tizen_src/impl/chromium-efl.gyp
tizen_src/impl/screen_efl.cc [new file with mode: 0644]
tizen_src/impl/screen_efl.h [new file with mode: 0644]

index cbf9e6b50c21e8600f1fb54ca421bcefd4828a7f..2aaac6c6f3d587c67e15834e490c39f1333bbdf5 100644 (file)
@@ -59,6 +59,8 @@
       'renderer/render_process_observer_efl.h',
       'renderer/render_view_observer_efl.cc',
       'renderer/render_view_observer_efl.h',
+      'screen_efl.cc',
+      'screen_efl.h',
       'web_contents_delegate_efl.cc',
       'web_contents_delegate_efl.h',
     ],
diff --git a/tizen_src/impl/screen_efl.cc b/tizen_src/impl/screen_efl.cc
new file mode 100644 (file)
index 0000000..8227ef3
--- /dev/null
@@ -0,0 +1,106 @@
+#include "screen_efl.h"
+
+#include <X11/Xlib.h>
+
+#include "ui/gfx/screen_type_delegate.h"
+#include "ui/base/x/x11_util.h"
+#include "ui/gfx/display.h"
+#include "ui/gfx/display_observer.h"
+#include "ui/gfx/screen.h"
+#include "ui/gfx/x/x11_types.h"
+#include "ui/views/view.h"
+
+namespace ui {
+
+class EflScreen : public gfx::Screen {
+ public:
+  EflScreen() {
+  }
+
+  virtual ~EflScreen() {
+  }
+
+  virtual bool IsDIPEnabled() OVERRIDE {
+    return false;
+  }
+
+  virtual gfx::Point GetCursorScreenPoint() OVERRIDE {
+    XDisplay* display = gfx::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);
+  }
+
+  virtual gfx::NativeWindow GetWindowUnderCursor() OVERRIDE {
+    return GetWindowAtScreenPoint(GetCursorScreenPoint());
+  }
+
+  virtual gfx::NativeWindow GetWindowAtScreenPoint(const gfx::Point& point) OVERRIDE {
+    return NULL;
+  }
+
+  virtual int GetNumDisplays() const OVERRIDE {
+    return 1;
+  }
+
+  virtual std::vector<gfx::Display> GetAllDisplays() const OVERRIDE {
+    return std::vector<gfx::Display>(1, GetPrimaryDisplay());
+  }
+
+  virtual gfx::Display GetDisplayNearestWindow(gfx::NativeView view) const OVERRIDE {
+    return GetPrimaryDisplay();
+  }
+
+  virtual gfx::Display GetDisplayNearestPoint(
+      const gfx::Point& point) const OVERRIDE {
+    return GetPrimaryDisplay();
+  }
+
+  virtual gfx::Display GetDisplayMatching(
+      const gfx::Rect& match_rect) const OVERRIDE {
+    return GetPrimaryDisplay();
+  }
+
+  virtual gfx::Display GetPrimaryDisplay() const OVERRIDE {
+    static ::Screen* screen = DefaultScreenOfDisplay(gfx::GetXDisplay());
+
+    static gfx::Display display(0,
+        gfx::Rect(0, 0, WidthOfScreen(screen), HeightOfScreen(screen)));
+    return display;
+  }
+
+  virtual void AddObserver(gfx::DisplayObserver* observer) OVERRIDE {
+  }
+
+  virtual void RemoveObserver(gfx::DisplayObserver* observer) OVERRIDE {
+  }
+
+ private:
+  DISALLOW_COPY_AND_ASSIGN(EflScreen);
+};
+
+}
+
+namespace content {
+void InstallScreenInstance()
+{
+  static bool installed = false;
+  if (!installed) {
+    installed = true;
+    gfx::Screen::SetScreenInstance(gfx::SCREEN_TYPE_NATIVE, new ui::EflScreen());
+  }
+}
+
+}
diff --git a/tizen_src/impl/screen_efl.h b/tizen_src/impl/screen_efl.h
new file mode 100644 (file)
index 0000000..9fdc936
--- /dev/null
@@ -0,0 +1,12 @@
+#ifndef SCREEN_EFL
+#define SCREEN_EFL
+
+#include "ui/gfx/screen.h"
+
+namespace content {
+
+void InstallScreenInstance();
+
+}
+
+#endif