Make JavaScript window.screen object work 34/5234/1 61/4661/2
authorJoone Hur <joone.hur@intel.com>
Fri, 14 Jun 2013 21:49:39 +0000 (14:49 -0700)
committerJoone Hur <joone.hur@intel.com>
Mon, 1 Jul 2013 16:38:28 +0000 (09:38 -0700)
This patch allows to get screen size using ecore_wl_screen_size_get.

The following JS APIs will work:

window.screen.availHeight
window.screen.availWidth
window.screen.width
window.screen.height

Source/WebCore/platform/efl/PlatformScreenEfl.cpp
Source/WebKit2/WebProcess/efl/WebProcessMainEfl.cpp

index 97e46e1..898653c 100644 (file)
@@ -44,6 +44,9 @@
 
 #ifdef HAVE_ECORE_X
 #include <Ecore_X.h>
+#else
+#include <Ecore.h>
+#include <Ecore_Wayland.h>
 #endif
 
 #if ENABLE(TIZEN_WEBKIT2)
@@ -116,14 +119,16 @@ bool screenIsMonochrome(Widget* widget)
 
 FloatRect screenRect(Widget* widget)
 {
-#ifdef HAVE_ECORE_X
 #if !ENABLE(ORIENTATION_EVENTS)
     UNUSED_PARAM(widget);
 #endif
-    // Fallback to realistic values if the EcoreX call fails
+
+    // Fallback to realistic values if the Ecore call fails
     // and we cannot accurately detect the screen size.
     int width = 800;
     int height = 600;
+
+#ifdef HAVE_ECORE_X
     ecore_x_screen_size_get(ecore_x_default_screen_get(), &width, &height);
 
 #if OS(TIZEN)
@@ -166,16 +171,14 @@ FloatRect screenRect(Widget* widget)
         width = height;
         height = temp;
     }
-#endif
+#endif // OS(TIZEN)
 
     return FloatRect(0, 0, width, height);
-#else
-    if (!widget || !widget->evas())
-        return FloatRect();
+#else  // HAVE_ECORE_X
 
-    int x, y, w, h;
-    ecore_evas_screen_geometry_get(ecore_evas_ecore_evas_get(widget->evas()), &x, &y, &w, &h);
-    return FloatRect(x, y, w, h);
+    ecore_wl_screen_size_get(&width, &height);
+
+    return FloatRect(0, 0, width, height);
 #endif
 }
 
index a5ffc5b..8d6eab7 100644 (file)
@@ -39,6 +39,8 @@
 
 #ifdef HAVE_ECORE_X
 #include <Ecore_X.h>
+#else
+#include <Ecore_Wayland.h>
 #endif
 
 #if USE(ACCELERATED_COMPOSITING)
@@ -89,11 +91,19 @@ WK_EXPORT int WebProcessMainEfl(int argc, char* argv[])
         eina_shutdown();
         return 1;
     }
+#else
+    if(!ecore_wl_init(0)) {
+        ecore_shutdown();
+        eina_shutdown();
+        return 1;
+    }
 #endif
 
     if (!ecore_file_init()) {
 #ifdef HAVE_ECORE_X
         ecore_x_shutdown();
+#else
+        ecore_wl_shutdown();
 #endif
         ecore_shutdown();
         eina_shutdown();
@@ -143,6 +153,8 @@ WK_EXPORT int WebProcessMainEfl(int argc, char* argv[])
     ecore_file_shutdown();
 #ifdef HAVE_ECORE_X
     ecore_x_shutdown();
+#else
+    ecore_wl_shutdown();
 #endif
     ecore_shutdown();
     eina_shutdown();