Add edc file for native window of wrt
authorWonYoung Choi <wy80.choi@samsung.com>
Thu, 9 Apr 2015 05:24:52 +0000 (14:24 +0900)
committerSeungkeun Lee <sngn.lee@samsung.com>
Thu, 9 Apr 2015 11:06:40 +0000 (20:06 +0900)
Change-Id: I4471b0e20d9d27940c200175fc4c2db6be760b43

packaging/wrt.spec
src/runtime/CMakeLists.txt
src/runtime/native_window.cc
src/runtime/web_application.cc
src/runtime/wrt.edc [new file with mode: 0755]

index f28108f..890b95a 100755 (executable)
@@ -11,6 +11,7 @@ URL:        N/A
 Source0:    %{name}-%{version}.tar.gz
 
 BuildRequires: cmake
+BuildRequires: edje-tools
 BuildRequires: pkgconfig(dlog)
 BuildRequires: pkgconfig(elementary)
 BuildRequires: pkgconfig(capi-appfw-application)
@@ -55,10 +56,10 @@ Runtime for Web Application
 mkdir -p %{build_dir}
 cd %{build_dir}
 
-cmake .. \
-  -DCMAKE_BUILD_TYPE=%{?build_type:%build_type} \
-  -DX11_SUPPORT=%{enable_x11} \
-  -DWAYLAND_SUPPORT=%{enable_wayland}
+cmake .. -DCMAKE_INSTALL_PREFIX=%{_prefix} \
+         -DCMAKE_BUILD_TYPE=%{?build_type:%build_type} \
+         -DX11_SUPPORT=%{enable_x11} \
+         -DWAYLAND_SUPPORT=%{enable_wayland}
 
 make %{?jobs:-j%jobs}
 
@@ -70,5 +71,5 @@ cd %{build_dir}
 rm -fr %{buildroot}
 
 %files
-/usr/local/bin/wrt
-
+%attr(755,root,root) %{_bindir}/wrt
+%attr(644,root,root) %{_datadir}/edje/wrt/wrt.edj
index 0613235..ee2431b 100755 (executable)
@@ -34,13 +34,13 @@ SET(TARGET_RUNTIME_LIBS
 
 # Source Files
 SET(TARGET_RUNTIME_SRCS
-  ${PROJECT_SOURCE_DIR}/src/runtime/command_line.cc
-  ${PROJECT_SOURCE_DIR}/src/runtime/native_window.cc
-  ${PROJECT_SOURCE_DIR}/src/runtime/native_app_window.cc
-  ${PROJECT_SOURCE_DIR}/src/runtime/web_application.cc
-  ${PROJECT_SOURCE_DIR}/src/runtime/runtime.cc
-  ${PROJECT_SOURCE_DIR}/src/runtime/web_view.cc
-  ${PROJECT_SOURCE_DIR}/src/runtime/vibration_manager.cc
+  ${BASE_SRCDIR}/runtime/command_line.cc
+  ${BASE_SRCDIR}/runtime/native_window.cc
+  ${BASE_SRCDIR}/runtime/native_app_window.cc
+  ${BASE_SRCDIR}/runtime/web_application.cc
+  ${BASE_SRCDIR}/runtime/runtime.cc
+  ${BASE_SRCDIR}/runtime/web_view.cc
+  ${BASE_SRCDIR}/runtime/vibration_manager.cc
 )
 
 # Compiler Flags
@@ -67,3 +67,19 @@ TARGET_LINK_LIBRARIES(${TARGET_RUNTIME}
 
 # Install
 INSTALL(TARGETS ${TARGET_RUNTIME} DESTINATION bin)
+
+# EDC Build
+ADD_CUSTOM_COMMAND(
+    OUTPUT ${BASE_SRCDIR}/runtime/wrt.edj
+    COMMAND edje_cc
+    ARGS  ${BASE_SRCDIR}/runtime/wrt.edc
+          ${BASE_SRCDIR}/runtime/wrt.edj
+    DEPENDS ${BASE_SRCDIR}/runtime/wrt.edc
+)
+ADD_CUSTOM_TARGET(WRT_EDJE ALL
+    DEPENDS ${BASE_SRCDIR}/runtime/wrt.edj
+)
+INSTALL(FILES
+    ${BASE_SRCDIR}/runtime/wrt.edj
+    DESTINATION share/edje/wrt/
+)
index e9d4f23..588350a 100755 (executable)
@@ -17,7 +17,7 @@
 namespace wrt {
 
 namespace {
-  const char* kWRTEdjePath = "/usr/share/edje/wrt/Wrt.edj";
+  const char* kWRTEdjePath = "/usr/share/edje/wrt/wrt.edj";
   const char* kWinowRotationEventKey = "wm,rotation,changed";
   const char* kWinowFocusedEventKey = "focused";
   const char* kWinowUnfocusedEventKey = "unfocused";
@@ -66,7 +66,7 @@ void NativeWindow::Initialize() {
 
   // background
   Evas_Object* bg = evas_object_rectangle_add(evas_object_evas_get(window_));
-  evas_object_color_set(bg, 0, 0, 0, 0);
+  evas_object_color_set(bg, 0, 0, 0, 255);
   EVAS_SIZE_EXPAND_FILL(bg);
   elm_win_resize_object_add(window_, bg);
   evas_object_render_op_set(bg, EVAS_RENDER_BLEND);
@@ -80,32 +80,16 @@ void NativeWindow::Initialize() {
 
   // top layout
   Evas_Object* top_layout = elm_layout_add(conformant);
-  elm_layout_theme_set(top_layout, "layout", "application", "default");
+  elm_layout_file_set(top_layout, kWRTEdjePath, "web-application");
   EVAS_SIZE_EXPAND_FILL(top_layout);
   elm_object_content_set(conformant, top_layout);
   evas_object_show(top_layout);
 
-  // naviframe
-  Evas_Object* naviframe = elm_naviframe_add(top_layout);
-  EVAS_SIZE_EXPAND_FILL(naviframe);
-  elm_object_part_content_set(top_layout, "elm.swallow.content", naviframe);
-  evas_object_show(naviframe);
-
-  // main layout
-  Evas_Object* main_layout = elm_layout_add(naviframe);
-  elm_layout_file_set(main_layout, kWRTEdjePath, "web-application");
-  EVAS_SIZE_EXPAND_FILL(main_layout);
-  Elm_Object_Item* navi_item = elm_naviframe_item_push(
-      naviframe, NULL, NULL, NULL, main_layout, NULL);
-  elm_naviframe_item_title_enabled_set(navi_item, EINA_FALSE, EINA_FALSE);
-  // elm_naviframe_item_pop_cb_set(navi_item, naviframeItemPopCallback, NULL);
-  evas_object_show(main_layout);
-
   // focus
-  Evas_Object* focus = elm_button_add(main_layout);
+  Evas_Object* focus = elm_button_add(top_layout);
   elm_theme_extension_add(NULL, kWRTEdjePath);
   elm_object_style_set(focus, "wrt");
-  elm_object_part_content_set(main_layout, "elm.swallow.content", focus);
+  elm_object_part_content_set(top_layout, "elm.swallow.content", focus);
   EVAS_SIZE_EXPAND_FILL(focus);
   elm_access_object_unregister(focus);
   evas_object_show(focus);
index 99b5cce..c2bbbac 100755 (executable)
@@ -107,6 +107,14 @@ void WebApplication::Launch() {
   view_stack_.push_front(view);
   window_->SetContent(view->evas_object());
 
+  // TODO(sngn.lee): below code only debug code
+  auto callback = [](void* data, Evas* e, Evas_Object* obj, void* eventInfo) -> void {
+    int x,y,w,h;
+    evas_object_geometry_get(obj, &x,&y,&w,&h);
+    fprintf(stderr,"resize ! (%d, %d, %d, %d)\n", x,y,w,h);
+  };
+  evas_object_event_callback_add(view->evas_object(), EVAS_CALLBACK_RESIZE, callback, NULL );
+
   // TODO(sngn.lee): check the below code location.
   // in Wearable, webkit can render contents before show window
   // but Mobile, webkit can't render contents before show window
diff --git a/src/runtime/wrt.edc b/src/runtime/wrt.edc
new file mode 100755 (executable)
index 0000000..c2ded45
--- /dev/null
@@ -0,0 +1,446 @@
+collections {
+    group {
+        name: "web-application";
+        parts {
+            part {
+                name: "base";
+                scale: 1;
+                type: RECT;
+                description {
+                    state: "default" 0.0;
+                    fixed: 1 1;
+                    rel1 { relative: 0 0; }
+                    rel2 { relative: 1 1; }
+                    color: 0 0 0 255;
+                }
+                description {
+                    state: "transparent" 0.0;
+                    inherit: "default" 0.0;
+                    color: 0 0 0 0;
+                }
+            }
+            part {
+                name: "elm.swallow.content";
+                scale: 1;
+                type: SWALLOW;
+                description {
+                    state: "default" 0.0;
+                    fixed: 1 1;
+                    rel1 { relative: 0.0 0.0; to: base; }
+                    rel2 { relative: 1.0 1.0; to: base; }
+                    align: 0.0 0.0;
+
+                }
+                /* ratio 1x1 (only for gear3) */
+                description {
+                    state: "ratio1x1" 0.0;
+                    fixed: 1 1;
+                    aspect: 1 1;
+                    aspect_preference: BOTH;
+                    align: 0.5 0.5;
+                }
+            }
+            part {
+                name: "elm.swallow.progress";
+                scale: 1;
+                type: SWALLOW;
+                description {
+                    state: "default" 0.0;
+                    visible: 0;
+                    fixed: 0 1;
+                    rel1 { relative: 0.0 0.0; }
+                    rel2 { relative: 1.0 0.0; }
+                    align: 0.5 0.0;
+                }
+                description {
+                    state: "visible" 0.0;
+                    inherit: "default" 0.0;
+                    visible: 1;
+                }
+            }
+        }//end of parts
+        programs {
+            program { name: "show,progress";
+                signal: "show,progress,signal";
+                action: STATE_SET "visible" 0.0;
+                target: "elm.swallow.progress";
+            }
+            program { name: "hide,progress";
+                signal: "hide,progress,signal";
+                action: STATE_SET "default" 0.0;
+                target: "elm.swallow.progress";
+            }
+            program { name: "show,transparent";
+                signal: "show,transparent,signal";
+                action: STATE_SET "transparent" 0.0;
+                target: "base";
+            }
+            program { name: "hide,transparent";
+                signal: "hide,transparent,signal";
+                action: STATE_SET "default" 0.0;
+                target: "base";
+            }
+            /* Webview ratio control (for gear3) */
+            program { name: "1x1,ratio";
+                signal: "1x1,ratio,signal";
+                action: STATE_SET "ratio1x1" 0.0;
+                target: "elm.swallow.content";
+            }
+            program { name: "natural,ratio";
+                signal: "natural,ratio,signal";
+                action: STATE_SET "default" 0.0;
+                target: "elm.swallow.content";
+            }
+        }//end of programs
+    }//end of group
+
+    group {
+        name: "popupWithCheck";
+        parts {
+            part {
+                name: "pad_t";
+                type: SPACER;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    align: 0.5 0.0;
+                    min: 16 0;
+                    fixed: 0 1;
+                    rel1 { relative: 1.0 0.0;to_x: "pad_l"; }
+                    rel2 { relative: 0.0 0.0;to_x: "pad_r"; }
+                }
+            }
+            part {
+                name: "pad_l";
+                type: SPACER;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    min: 16 0;
+                    max: 16 0;
+                    fixed: 1 0;
+                    rel1 { relative: 0.0 0.0; }
+                    rel2 { relative: 0.0 1.0; }
+                    align: 0.0 0.0;
+                }
+            }
+            part {
+                name: "pad_r";
+                type: SPACER;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    min: 16 0;
+                    max: 16 0;
+                    fixed: 1 0;
+                    rel1 { relative: 1.0 0.0; }
+                    rel2 { relative: 1.0 1.0; }
+                    align: 1.0 0.0;
+                }
+            }
+            part {
+                name:"elm.swallow.label";
+                type: SWALLOW;
+                scale : 1;
+                description {
+                    state: "default" 0.0;
+                    fixed: 1 0;
+                    rel1 {
+                        relative: 1.0 1.0;
+                        to_x: "pad_l";
+                        to_y: "pad_t";
+                    }
+                    rel2 {
+                        relative: 0.0 0.0;
+                        to_x: "pad_r";
+                        to_y: "pad_b";
+                    }
+                }
+            }
+            part {
+                name: "bottom_pad";
+                type: SPACER;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    align: 0.0 1.0;
+                    min: 0 16;
+                    fixed: 0 1;
+                    rel1 { relative: 1.0 1.0; to_x: "pad_l"; }
+                    rel2 { relative: 0.0 1.0; to_x: "pad_r"; }
+                }
+            }
+            part {
+                name: "pad_b";
+                type: SPACER;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    align: 0.0 1.0;
+                    min: 0 44;
+                    fixed: 0 1;
+                    rel1 { relative: 0.0 0.0; to: "bottom_pad"; }
+                    rel2 { relative: 1.0 0.0; to: "bottom_pad"; }
+                }
+            }
+            part {
+                name: "end_field";
+                type: SPACER;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    align: 0.0 1.0;
+                    min: 0 40;
+                    fixed: 0 1;
+                    rel1 { relative: 0.0 1.0; to: "pad_b"; }
+                    rel2 { relative: 1.0 1.0; to: "pad_b"; }
+                }
+            }
+            part {
+                name: "elm.swallow.checkbox";
+                type: SWALLOW;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    fixed: 1 1;
+                    align: 0.0 0.5;
+                    rel1.to: "end_field";
+                    rel2.to: "end_field";
+                }
+            }
+        } //end of parts
+    } //end of group
+
+    group {
+        name: "authRequestPopup";
+        parts {
+            part {
+                name: "pad_t";
+                type: SPACER;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    align: 0.5 0.0;
+                    min: 0 32;
+                    fixed: 0 1;
+                    rel1 { relative: 1.0 0.0;to_x: "pad_l"; }
+                    rel2 { relative: 0.0 0.0;to_x: "pad_r"; }
+                }
+            }
+            part {
+                name: "pad_l";
+                type: SPACER;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    min: 26 0;
+                    max: 26 0;
+                    fixed: 1 0;
+                    rel1 { relative: 0.0 0.0; }
+                    rel2 { relative: 0.0 1.0; }
+                    align: 0.0 0.0;
+                }
+            }
+            part {
+                name: "pad_r";
+                type: SPACER;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    min: 26 0;
+                    max: 26 0;
+                    fixed: 1 0;
+                    rel1 { relative: 1.0 0.0; }
+                    rel2 { relative: 1.0 1.0; }
+                    align: 1.0 0.0;
+                }
+            }
+            part {
+                name:"elm.swallow.label";
+                type: SWALLOW;
+                scale : 1;
+                description {
+                    state: "default" 0.0;
+                    fixed: 1 0;
+                    rel1 {
+                        relative: 1.0 1.0;
+                        to_x: "pad_l";
+                        to_y: "pad_t";
+                    }
+                    rel2 {
+                        relative: 0.0 0.0;
+                        to_x: "pad_r";
+                        to_y: "pad_b";
+                    }
+                }
+            }
+            part {
+                name: "bottom_pad";
+                type: SPACER;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    align: 0.0 1.0;
+                    min: 0 32;
+                    fixed: 0 1;
+                    rel1 { relative: 1.0 1.0; to_x: "pad_l"; }
+                    rel2 { relative: 0.0 1.0; to_x: "pad_r"; }
+                }
+            }
+            part {
+                name: "pad_b";
+                type: SPACER;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    align: 0.0 1.0;
+                    min: 0 200;
+                    fixed: 0 1;
+                    rel1 { relative: 0.0 0.1; to: "bottom_pad"; }
+                    rel2 { relative: 1.0 0.1; to: "bottom_pad"; }
+                }
+            }
+            part {
+                name: "pad_m1";
+                type: SPACER;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    align: 0.0 1.0;
+                    min: 0 32;
+                    fixed: 0 1;
+                    rel1 { relative: 0.0 0.0; to: "pad_b"; }
+                    rel2 { relative: 1.0 0.0; to: "pad_b"; }
+                }
+            }
+            part{
+                name:"elm.swallow.idtext";
+                type: TEXT;
+                scale : 1;
+                description {
+                    state: "default" 0.0;
+                    color: 168 168 168 255;
+                    text {
+                        font: "Tizen:style=Medium";
+                        size: 35;
+                        align: 0.0 0.5;
+                    }
+                    align: 0.0 0.0;
+                    min: 0 40;
+                    fixed: 0 1;
+                    rel1 { relative: 0.0 1.0; to: "pad_m1"; }
+                    rel2 { relative: 1.0 1.0; to: "pad_m1"; }
+                }
+            }
+            part {
+                name: "elm.swallow.idfield";
+                type: SWALLOW;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    align: 0.0 0.0;
+                    min: 0 63;
+                    fixed: 0 1;
+                    rel1 { relative: 0.0 1.0; to: "elm.swallow.idtext"; }
+                    rel2 { relative: 1.0 1.0; to: "elm.swallow.idtext"; }
+                }
+            }
+            part {
+                name: "pad_m2";
+                type: SPACER;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    align: 0.0 1.0;
+                    min: 0 32;
+                    fixed: 0 1;
+                    rel1 { relative: 0.0 1.0; to: "elm.swallow.idfield"; }
+                    rel2 { relative: 1.0 1.0; to: "elm.swallow.idfield"; }
+                }
+            }
+            part{
+                name:"elm.swallow.pwtext";
+                type: TEXT;
+                scale : 1;
+                description {
+                    state: "default" 0.0;
+                    color: 168 168 168 255;
+                    text {
+                        font: "Tizen:style=Medium";
+                        size: 35;
+                        align: 0.0 0.5;
+                    }
+                    align: 0.0 0.0;
+                    min: 0 40;
+                    fixed: 0 1;
+                    rel1 { relative: 0.0 1.0; to: "pad_m2"; }
+                    rel2 { relative: 1.0 1.0; to: "pad_m2"; }
+                }
+            }
+            part {
+                name: "elm.swallow.pwfield";
+                type: SWALLOW;
+                scale: 1;
+                description {
+                    state: "default" 0.0;
+                    align: 0.0 0.0;
+                    min: 0 63;
+                    fixed: 0 1;
+                    rel1 { relative: 0.0 1.0; to: "elm.swallow.pwtext"; }
+                    rel2 { relative: 1.0 1.0; to: "elm.swallow.pwtext"; }
+                }
+            }
+        } //end of parts
+    } //end of group
+
+    group { name: "elm/button/base/wrt";
+     #define BUTTON_HEIGHT 78.0
+     parts {
+        part { name: "bg";
+           type: RECT;
+           scale: 1;
+           description { state: "default" 0.0;
+              color: 0 0 0 0;
+              min: 0 BUTTON_HEIGHT;
+           }
+        }
+        part { name: "elm.text";
+           type: TEXTBLOCK;
+           mouse_events: 0;
+           scale: 1;
+           description { state: "default" 0.0;
+              text {
+                 min: 0 1;
+                 style: "button_general_text_normal";
+              }
+           }
+           description { state: "disabled" 0.0;
+              inherit: "default" 0.0;
+              text.style: "button_general_text_dim";
+           }
+           description { state: "pressed" 0.0;
+              inherit: "default" 0.0;
+              text.style: "button_general_text_press";
+           }
+        }
+        part { name: "elm.swallow.content";
+           clip_to: "elm.swallow.content.clip";
+           type: SWALLOW;
+           scale: 1;
+           description { state: "default" 0.0; }
+        }
+        part { name: "elm.swallow.content.clip";
+           type: RECT;
+           scale: 1;
+           description { state: "default" 0.0;
+              color_class: "F022L1i";
+           }
+           description { state: "disabled" 0.0;
+              inherit: "default" 0.0;
+              color_class: "F022L1iD";
+           }
+        }
+     }//end of part
+    }//end of group
+
+}//end of collection