Tizen 2.1 base
authorJinkun Jang <jinkun.jang@samsung.com>
Tue, 12 Mar 2013 16:52:21 +0000 (01:52 +0900)
committerJinkun Jang <jinkun.jang@samsung.com>
Tue, 12 Mar 2013 16:52:21 +0000 (01:52 +0900)
51 files changed:
AUTHORS [new file with mode: 0644]
CMakeLists.txt [changed mode: 0755->0644]
LICENSE [new file with mode: 0644]
NOTICE [new file with mode: 0644]
cbhm.manifest [new file with mode: 0644]
data/images/B12_button_delete.png [new file with mode: 0755]
data/images/B12_button_delete_press.png [new file with mode: 0755]
data/images/B12_panel_button.png [new file with mode: 0755]
data/images/B12_panel_button_press.png [new file with mode: 0755]
data/images/B12_panel_icon_arrow.png [new file with mode: 0755]
data/images/B12_panel_icon_arrow_press.png [new file with mode: 0755]
data/images/B12_panel_icon_delete.png [new file with mode: 0755]
data/images/B12_panel_title_bg.png [new file with mode: 0755]
data/images/B12_panel_title_line.png [new file with mode: 0755]
data/images/cbhm_default_img.png [new file with mode: 0755]
data/images/clipboard_arrow.png [new file with mode: 0644]
data/images/clipboard_bg.png [new file with mode: 0644]
data/images/clipboard_button_delete.png [new file with mode: 0644]
data/images/clipboard_button_delete_press.png [new file with mode: 0644]
data/images/clipboard_more.png [new file with mode: 0755]
data/images/clipboard_scroll_bar.png [new file with mode: 0644]
data/images/old/05_delete.png [new file with mode: 0755]
data/images/old/clipboard_arrow_bar.png [new file with mode: 0755]
data/images/old/clipboard_close_arrow.png [new file with mode: 0644]
data/images/old/clipboard_close_bg.png [new file with mode: 0644]
data/images/old/clipboard_panel_bg.png [new file with mode: 0755]
data/images/old/clipboard_panel_list_bg.png [new file with mode: 0755]
data/init_script/cbhm [new file with mode: 0755]
data/themes/cbhmdrawer.edc
data/themes/extstyles.edc [new file with mode: 0644]
debian/cbhm.install.in
debian/cbhm.postinst [new file with mode: 0755]
debian/cbhm.prerm [new file with mode: 0755]
debian/changelog
debian/control
debian/copyright
debian/rules
packaging/cbhm.service [new file with mode: 0644]
packaging/cbhm.spec [new file with mode: 0644]
src/cbhm.h [new file with mode: 0644]
src/clipdrawer.c
src/clipdrawer.h
src/item_manager.c [new file with mode: 0644]
src/item_manager.h [new file with mode: 0644]
src/main.c [new file with mode: 0644]
src/storage.c
src/storage.h
src/xconverter.c [new file with mode: 0644]
src/xconverter.h [new file with mode: 0644]
src/xhandler.c [new file with mode: 0644]
src/xhandler.h [new file with mode: 0644]

diff --git a/AUTHORS b/AUTHORS
new file mode 100644 (file)
index 0000000..45fcd4c
--- /dev/null
+++ b/AUTHORS
@@ -0,0 +1 @@
+Jaehyun Cho <jae_hyun.cho@samsung.com>
old mode 100755 (executable)
new mode 100644 (file)
index abafcc7..1d5b289
@@ -1,20 +1,23 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 PROJECT(cbhm C)
 
-SET(SRCS src/cbhm_main.c
+SET(SRCS src/main.c
+       src/item_manager.c
+       src/xconverter.c
+       src/xhandler.c
        src/clipdrawer.c
        src/storage.c
-       src/xcnphandler.c
 )
 
 INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
 
 INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED elementary appcore-efl appcore-common x11 ecore-x)
+pkg_check_modules(pkgs REQUIRED elementary eet appcore-efl appcore-common x11 ecore-x utilX eina evas ecore ecore-file ecore-evas edje ecore-input xext xcomposite svi pixman-1 enotify capi-content-media-content)
 
 FOREACH(flag ${pkgs_CFLAGS})
        SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
 ENDFOREACH(flag)
+SET(EXTRA_CFLAGS "${EXTRA_CFLAGS}")
 #SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} -finstrument-functions")
 
 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${EXTRA_CFLAGS}")
@@ -25,14 +28,20 @@ ADD_DEFINITIONS("-DTARGET")
 ADD_DEFINITIONS("-DSLP_DEBUG")
 
 ADD_EXECUTABLE(${PROJECT_NAME} ${SRCS})
+#for XV extension screenshot
+SET(pkgs_LDFLAGS "${pkgs_LDFLAGS} -L/usr/lib -lsvi")
 TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${pkgs_LDFLAGS})
 
 ADD_CUSTOM_TARGET(cbhmdrawer.edj 
                COMMAND edje_cc 
+               -id ${CMAKE_CURRENT_SOURCE_DIR}/data/images             
                ${CMAKE_SOURCE_DIR}/data/themes/cbhmdrawer.edc ${CMAKE_BINARY_DIR}/data/themes/cbhmdrawer.edj
                DEPENDS ${CMAKE_SOURCE_DIR}/data/themes/cbhmdrawer.edc
+               DEPENDS ${CMAKE_SOURCE_DIR}/data/themes/extstyles.edc
 )
 ADD_DEPENDENCIES(${PROJECT_NAME} cbhmdrawer.edj)
 
 INSTALL(TARGETS ${PROJECT_NAME} DESTINATION bin)
 INSTALL(FILES ${CMAKE_BINARY_DIR}/data/themes/cbhmdrawer.edj DESTINATION share/edje)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/data/images/cbhm_default_img.png DESTINATION share/cbhm/icons)
+INSTALL(FILES ${CMAKE_BINARY_DIR}/data/init_script/cbhm DESTINATION /etc/init.d PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
diff --git a/LICENSE b/LICENSE
new file mode 100644 (file)
index 0000000..d645695
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,202 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software
+   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+   See the License for the specific language governing permissions and
+   limitations under the License.
diff --git a/NOTICE b/NOTICE
new file mode 100644 (file)
index 0000000..ccdad52
--- /dev/null
+++ b/NOTICE
@@ -0,0 +1,3 @@
+Copyright (c) Samsung Electronics Co., Ltd. All rights reserved.
+Except as noted, this software is licensed under Apache License, Version 2.
+Please, see the LICENSE file for Apache License terms and conditions.
diff --git a/cbhm.manifest b/cbhm.manifest
new file mode 100644 (file)
index 0000000..99ac57f
--- /dev/null
@@ -0,0 +1,14 @@
+<manifest>
+       <define>
+               <domain name="cbhm"/>
+       </define>
+       <request>
+               <domain name="cbhm"/>
+       </request>
+       <assign>
+               <filesystem path="/etc/init.d/cbhm" label="_" exec_label="none" />
+               <filesystem path="/etc/rc.d/rc3.d/S95cbhm" label="_" exec_label="none" />
+               <filesystem path="/usr/lib/systemd/user/cbhm.service" label="_" exec_label="none" />
+               <filesystem path="/usr/lib/systemd/user/core-efl.target.wants/cbhm.service" label="_" exec_label="none" />
+       </assign>
+</manifest>
diff --git a/data/images/B12_button_delete.png b/data/images/B12_button_delete.png
new file mode 100755 (executable)
index 0000000..81d6de4
Binary files /dev/null and b/data/images/B12_button_delete.png differ
diff --git a/data/images/B12_button_delete_press.png b/data/images/B12_button_delete_press.png
new file mode 100755 (executable)
index 0000000..5d6cba4
Binary files /dev/null and b/data/images/B12_button_delete_press.png differ
diff --git a/data/images/B12_panel_button.png b/data/images/B12_panel_button.png
new file mode 100755 (executable)
index 0000000..be18ef0
Binary files /dev/null and b/data/images/B12_panel_button.png differ
diff --git a/data/images/B12_panel_button_press.png b/data/images/B12_panel_button_press.png
new file mode 100755 (executable)
index 0000000..9d965b2
Binary files /dev/null and b/data/images/B12_panel_button_press.png differ
diff --git a/data/images/B12_panel_icon_arrow.png b/data/images/B12_panel_icon_arrow.png
new file mode 100755 (executable)
index 0000000..69b7d27
Binary files /dev/null and b/data/images/B12_panel_icon_arrow.png differ
diff --git a/data/images/B12_panel_icon_arrow_press.png b/data/images/B12_panel_icon_arrow_press.png
new file mode 100755 (executable)
index 0000000..2cc03cb
Binary files /dev/null and b/data/images/B12_panel_icon_arrow_press.png differ
diff --git a/data/images/B12_panel_icon_delete.png b/data/images/B12_panel_icon_delete.png
new file mode 100755 (executable)
index 0000000..e947b40
Binary files /dev/null and b/data/images/B12_panel_icon_delete.png differ
diff --git a/data/images/B12_panel_title_bg.png b/data/images/B12_panel_title_bg.png
new file mode 100755 (executable)
index 0000000..3e000e9
Binary files /dev/null and b/data/images/B12_panel_title_bg.png differ
diff --git a/data/images/B12_panel_title_line.png b/data/images/B12_panel_title_line.png
new file mode 100755 (executable)
index 0000000..4375ab4
Binary files /dev/null and b/data/images/B12_panel_title_line.png differ
diff --git a/data/images/cbhm_default_img.png b/data/images/cbhm_default_img.png
new file mode 100755 (executable)
index 0000000..7440457
Binary files /dev/null and b/data/images/cbhm_default_img.png differ
diff --git a/data/images/clipboard_arrow.png b/data/images/clipboard_arrow.png
new file mode 100644 (file)
index 0000000..f31ac9c
Binary files /dev/null and b/data/images/clipboard_arrow.png differ
diff --git a/data/images/clipboard_bg.png b/data/images/clipboard_bg.png
new file mode 100644 (file)
index 0000000..609cc66
Binary files /dev/null and b/data/images/clipboard_bg.png differ
diff --git a/data/images/clipboard_button_delete.png b/data/images/clipboard_button_delete.png
new file mode 100644 (file)
index 0000000..41abd43
Binary files /dev/null and b/data/images/clipboard_button_delete.png differ
diff --git a/data/images/clipboard_button_delete_press.png b/data/images/clipboard_button_delete_press.png
new file mode 100644 (file)
index 0000000..ddfac2e
Binary files /dev/null and b/data/images/clipboard_button_delete_press.png differ
diff --git a/data/images/clipboard_more.png b/data/images/clipboard_more.png
new file mode 100755 (executable)
index 0000000..388ddb4
Binary files /dev/null and b/data/images/clipboard_more.png differ
diff --git a/data/images/clipboard_scroll_bar.png b/data/images/clipboard_scroll_bar.png
new file mode 100644 (file)
index 0000000..6bf42ea
Binary files /dev/null and b/data/images/clipboard_scroll_bar.png differ
diff --git a/data/images/old/05_delete.png b/data/images/old/05_delete.png
new file mode 100755 (executable)
index 0000000..e06007f
Binary files /dev/null and b/data/images/old/05_delete.png differ
diff --git a/data/images/old/clipboard_arrow_bar.png b/data/images/old/clipboard_arrow_bar.png
new file mode 100755 (executable)
index 0000000..ff213e6
Binary files /dev/null and b/data/images/old/clipboard_arrow_bar.png differ
diff --git a/data/images/old/clipboard_close_arrow.png b/data/images/old/clipboard_close_arrow.png
new file mode 100644 (file)
index 0000000..54e4e1c
Binary files /dev/null and b/data/images/old/clipboard_close_arrow.png differ
diff --git a/data/images/old/clipboard_close_bg.png b/data/images/old/clipboard_close_bg.png
new file mode 100644 (file)
index 0000000..4fc47fa
Binary files /dev/null and b/data/images/old/clipboard_close_bg.png differ
diff --git a/data/images/old/clipboard_panel_bg.png b/data/images/old/clipboard_panel_bg.png
new file mode 100755 (executable)
index 0000000..bca7741
Binary files /dev/null and b/data/images/old/clipboard_panel_bg.png differ
diff --git a/data/images/old/clipboard_panel_list_bg.png b/data/images/old/clipboard_panel_list_bg.png
new file mode 100755 (executable)
index 0000000..8068680
Binary files /dev/null and b/data/images/old/clipboard_panel_list_bg.png differ
diff --git a/data/init_script/cbhm b/data/init_script/cbhm
new file mode 100755 (executable)
index 0000000..087b703
--- /dev/null
@@ -0,0 +1,2 @@
+#!/bin/sh
+/usr/bin/cbhm &
index 4699775..b842913 100644 (file)
+/*
+ * cbhm
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
 #define MAIN_W 480
-#define MAIN_H 400
-
-collections 
-{
-       group 
-       {
-               name: "cbhmdrawer";
-               //min: MAIN_W MAIN_H;
-               //max: MAIN_W MAIN_H;
-
-               parts 
-               {
-                       part 
-                       { 
-                               name: "background";
-                               type: RECT;
-                               mouse_events: 1;
-                               description 
-                               {
-                                       state: "default" 0.0;
-                                       rel1 { relative: 0.0 0.0; }
-                                       rel2 { relative: 1.0 1.0; }
-                                       color: 100 100 100 255;
-                               }
-                       }
-
-                       part 
-                       {
-                               name: "cbhmdrawer/imglist";
-                               type: SWALLOW;
-                               mouse_events: 1;
-                               description
-                               {
-                                       state: "default" 0.0;
-                                       rel1 { relative: 0.0 0.0; to: background; }
-                                       rel2 { relative: 1.0 0.4; to: background; }
-                               }
-                       }
-                       part 
-                       {
-                               name: "cbhmdrawer/txtlist";
-                               type: SWALLOW;
-                               mouse_events: 1;
-                               description
-                               {
-                                       state: "default" 0.0;
-                                       rel1 { relative: 0.0 0.4; to: background; }
-                                       rel2 { relative: 1.0 1.0; to: background; }
-                               }
-                       }
-               }
-       }
+#define MAIN_H 360
+
+collections {
+
+#include "extstyles.edc"
+
+   group { name: "cbhmdrawer";
+      images {
+         image: "B12_panel_title_bg.png" COMP;
+         image: "B12_panel_button.png" COMP;
+         image: "B12_panel_button_press.png" COMP;
+         image: "B12_panel_icon_arrow.png" COMP;
+         image: "B12_panel_icon_arrow_press.png" COMP;
+      }
+      data.item: "clipboard_height" 522;
+      data.item: "clipboard_landscape_height" 315;
+      data.item: "grid_item_w" 310;
+      data.item: "grid_item_h" 196;
+
+      parts {
+         part { name: "background";
+            type: RECT;
+            scale: 1;
+            mouse_events: 1;
+            description { state: "default" 0.0;
+               rel1 { relative: 0.0 0.0; }
+               rel2 { relative: 1.0 1.0; }
+               color: 39 39 39 255;
+            }
+         }
+         part { name: "historyitems";
+            type: SWALLOW;
+            scale: 1;
+            mouse_events: 1;
+            description { state: "default" 0.0;
+               rel1 { relative: 0.0 0.0; offset: 0 84; to: "background"; }
+               rel2 { relative: 1.0 1.0; to: "background"; }
+            }
+         }
+         part { name: "background/title";
+            type: RECT;
+            scale: 1;
+            mouse_events: 1;
+            description { state: "default" 0.0;
+               rel1 { relative: 0.0 0.0; to: "background";}
+               rel2 { relative: 1.0 0.0; offset: 0 84; to: "background";}
+               color: 0 0 0 0;
+            }
+         }
+         part { name: "background/title/image";
+            type: IMAGE;
+            scale: 1;
+            mouse_events: 1;
+            description { state: "default" 0.0;
+               rel1 { relative: 0.0 0.0; to: "background/title";}
+               rel2 { relative: 1.0 1.0; to: "background/title";}
+               image {
+                  normal: "B12_panel_title_bg.png";
+               }
+            }
+         }
+         part { name: "panel_title";
+            type: TEXT;
+            scale: 1;
+            description { state: "default" 0.0;
+               color: 205 205 205 255;
+               text {
+                  font: "Sans:style=Medium";
+                  size: 34;
+                  min: 0 1;
+                  align: 0.0 0.5;
+               }
+               rel1 { relative: 0.0 0.0; offset: 82 12; to: "background/title";}
+               rel2 { relative: 1.0 1.0; to: "background/title";}
+            }
+         }
+         part { name: "background/title/delete";
+            type: RECT;
+            scale: 1;
+            mouse_events: 1;
+            description { state: "default" 0.0;
+               rel1 { relative: 0.0 0.0; to: "panel_function";}
+               rel2 { relative: 1.0 1.0; to: "panel_function";}
+               color: 255 0 0 0;
+            }
+         }
+         part { name: "background/title/delete/image";
+            type: IMAGE;
+            scale: 1;
+            mouse_events: 1;
+            description { state: "default" 0.0;
+               align: 0.5 0.5;
+               min: 62 60;
+               max: 300 60;
+               fixed: 0 1;
+               visible: 1;
+                  rel1 { relative: 0.0 0.0; offset: -28 0; to: "panel_function";}
+                  rel2 { relative: 1.0 1.0; offset: 28 0; to: "panel_function"; }
+                  image { normal: "B12_panel_button.png";
+                  border: 30 30 30 30; border_scale: 1;
+               }
+            }
+            description { state: "pressed" 0.0;
+               inherit: "default" 0.0;
+               image { normal: "B12_panel_button_press.png"; }
+            }
+         }
+         part { name: "right_padding";
+            type: RECT;
+            scale: 1;
+            mouse_events: 0;
+            description {
+               state: "default" 0.0;
+               align: 1.0 0.5;
+               min: 40 60;
+               max: 40 60;
+               fixed: 1 1;
+               rel1 { relative: 1.0 0.0; offset: 0 12; to: "background/title"; }
+               rel2 { relative: 1.0 1.0; to: "background/title"; }
+               color: 0 0 255 0;
+            }
+         }
+         part { name: "panel_function";
+            type: TEXT;
+            scale: 1;
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               color: 204 204 204 255;
+               align: 1.0 0.5;
+               max: 300 60;
+               fixed: 1 1;
+               visible: 1;
+               text {
+                  font: "Sans:style=Medium";
+                  size: 32;
+                  min: 1 1;
+                  align: 0.5 0.5;
+               }
+               rel1 { relative: 0.0 0.0; to: "right_padding"; }
+               rel2 { relative: 0.0 1.0; to: "right_padding"; }
+            }
+         }
+         part { name: "background/title/close";
+            type: RECT;
+            scale: 1;
+            mouse_events: 1;
+            description { state: "default" 0.0;
+               rel1 { relative: 0.0 0.0; offset: 12 12; to: "background/title"; }
+               rel2 { relative: 0.0 1.0; offset: 60 0; to: "background/title"; }
+               color: 0 0 0 0;
+            }
+         }
+         part { name: "background/title/close/image";
+            type: IMAGE;
+            scale: 1;
+            mouse_events: 1;
+            description { state: "default" 0.0;
+               align: 0.5 0.5;
+               min: 60 60;
+               max: 60 60;
+               fixed: 1 1;
+               rel1 { relative: 0.0 0.0; to: "background/title/close"; }
+               rel2 { relative: 1.0 1.0; to: "background/title/close"; }
+               image { normal: "B12_panel_icon_arrow.png"; }
+            }
+            description { state: "pressed" 0.0;
+               inherit: "default" 0.0;
+               image { normal: "B12_panel_icon_arrow_press.png"; }
+            }
+         }
+      }
+      programs {
+         program { name: "mouse_down_closebtn_arrow";
+            signal: "mouse,down,1";
+            source: "background/title/close/image";
+            action: STATE_SET "pressed" 0.0;
+            target: "background/title/close/image";
+         }
+         program { name:   "mouse_up_closebtn_bg";
+            signal: "mouse,up,1";
+            source: "background/title/close";
+            action: SIGNAL_EMIT "elm,action,click" "";
+         }
+         program { name: "mouse_out_closebtn";
+            signal: "mouse,out";
+            source: "background/title/close/image";
+            action: STATE_SET "default" 0.0;
+            target: "background/title/close/image";
+         }
+         program { name: "mouse_up_closebtn_arrow";
+            signal: "mouse,up,1";
+            source: "background/title/close/image";
+            action: SIGNAL_EMIT "elm,action,click" "";
+         }
+         program { name: "mouse_up_delete";
+            signal: "mouse,up,1";
+            source: "background/title/delete";
+            action: SIGNAL_EMIT "elm,action,click" "";
+         }
+         program { name: "mouse_down_delbtn";
+            signal: "mouse,down,1";
+            source: "background/title/delete/image";
+            action: STATE_SET "pressed" 0.0;
+            target: "background/title/delete/image";
+         }
+         program { name: "mouse_up_delbtn";
+            signal: "mouse,up,1";
+            source: "background/title/delete/image";
+            action: STATE_SET "default" 0.0;
+            target: "background/title/delete/image";
+         }
+         program { name: "show_panel_function";
+            source: "elm";
+            signal: "elm,state,show,function";
+            action: STATE_SET "show" 0.0;
+            target: "panel_function";
+         }
+         program { name: "hide_panel_function";
+            source: "elm";
+            signal: "elm,state,hide,function";
+            action: STATE_SET "default" 0.0;
+            target: "panel_function";
+         }
+         program { name: "hide_del_mode";
+            source: "elm";
+            signal: "elm,state,hide,delmode";
+            action: STATE_SET "hide" 0.0;
+            target: "background/title/delete/image";
+         }
+         program { name: "show_del_mode";
+            source: "elm";
+            signal: "elm,state,show,delmode";
+            action: STATE_SET "default" 0.0;
+            target: "background/title/delete/image";
+         }
+      }
+   }
+   group { name: "elm/gengrid/item/clipboard_photo_style/default";
+      data.item: "contents" "elm.swallow.icon elm.swallow.entry";
+
+      parts {
+         part { name: "bg";
+            type: RECT;
+            description { state: "default" 0.0;
+               color: 0 0 0 0;
+            }
+         }
+         part { name: "left_top_padding";
+            type: RECT;
+            scale: 1;
+            description { state: "default" 0.0;
+               min: 10 24;
+               align: 0.0 0.0;
+               visible: 0;
+               rel1.to: "bg";
+               rel2 { relative: 0.0 0.0; to: "bg"; }
+            }
+         }
+         part { name: "right_bottom_padding";
+            type: RECT;
+            scale: 1;
+            description { state: "default" 0.0;
+               min: 10 0;
+               align: 1.0 1.0;
+               visible: 0;
+               rel1 { relative: 1.0 1.0; to: "bg"; }
+               rel2.to: "bg";
+            }
+         }
+         part { name: "icon_bg";
+            type: RECT;
+            description { state: "default" 0.0;
+               color: 0 0 0 0;
+               rel1 { relative: 1.0 1.0; to: "left_top_padding"; }
+               rel2 { relative: 0.0 0.0; to: "right_bottom_padding"; }
+            }
+         }
+         part { name: "photo_frame";
+            type: RECT;
+            description { state: "default" 0.0;
+               color: 255 255 255 255;
+               rel1 { relative: 0.0 0.0; to: "elm.swallow.icon"; offset: -2 -2; }
+               rel2 { relative: 1.0 1.0; to: "elm.swallow.icon"; offset: 1 1; }
+            }
+         }
+         part { name: "elm.swallow.icon";
+            type: SWALLOW;
+            description { state: "default" 0.0;
+               fixed: 1 1;
+               rel1.to_x: "right_bottom_padding";
+               rel1 { relative: 0.5 0.5; to: "icon_bg"; }
+               rel2 { relative: 0.5 0.5; to: "icon_bg"; }
+               align: 0.5 0.5;
+            }
+         }
+         part { name: "elm.swallow.entry";
+            type: SWALLOW;
+            description { state: "default" 0.0;
+               rel1 { relative: 0.0 0.0; offset: 2 2; to: "icon_bg"; }
+               rel2 { relative: 1.0 1.0; offset: -1 -1;to: "icon_bg"; }
+            }
+         }
+      }
+   }
+   group { name: "elm/gengrid/item/clipboard_style";
+      images {
+         image: "B12_button_delete.png" COMP;
+         image: "B12_button_delete_press.png" COMP;
+      }
+      script {
+         new st[31];
+         new Float:vl;
+      }
+      parts {
+         part { name: "bg";
+            type: RECT;
+            description { state: "default" 0.0;
+               color: 0 0 0 0;
+            }
+         }
+         part { name: "elm.swallow.icon";
+            type: SWALLOW;
+            scale: 1;
+            description { state: "default" 0.0;
+               rel1 { relative: 0.0 0.0; to: "bg"; }
+               rel2 { relative: 1.0 1.0; to: "bg"; }
+            }
+         }
+         part { name: "elm.rect.dim";
+            type: RECT;
+            scale: 1;
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               visible: 0;
+               color: 0 0 0 200;
+               rel1.to: "elm.swallow.icon";
+               rel2.to: "elm.swallow.icon";
+            }
+            description { state: "show" 0.0;
+               inherit: "default" 0.0;
+               visible: 1;
+            }
+         }
+         part { name: "delbtn";
+            type: RECT;
+            mouse_events: 0;
+            scale: 1;
+            description { state: "default" 0.0;
+               rel1.to: "elm.swallow.icon";
+               rel1.offset: -4 4;
+               rel2.to: "elm.swallow.icon";
+               rel2.offset: -4 4;
+               align: 1.0 0.0;
+               min: 60 60;
+               max: 60 60;
+               visible: 0;
+            }
+         }
+         part { name: "delbtn/img";
+            mouse_events: 1;
+            scale: 1;
+            description { state: "default" 0.0;
+               rel1.to: "delbtn";
+               rel2.to: "delbtn";
+               visible: 0;
+            }
+            description { state: "show" 0.0;
+               inherit: "default" 0.0;
+               visible: 1;
+               image {
+                  normal: "B12_button_delete.png";
+               }
+            }
+            description { state: "pressed" 0.0;
+               inherit: "default" 0.0;
+               visible: 1;
+               image {
+                  normal: "B12_button_delete_press.png";
+               }
+            }
+         }
+      }
+      programs {
+         program { name: "pressed";
+            signal: "mouse,down,1";
+            source: "delbtn/img";
+            script {
+               get_state(PART:"delbtn/img", st, 30, vl);
+               if (!strcmp(st, "show"))
+                  set_state(PART:"delbtn/img", "pressed", 0.0);
+            }
+         }
+         program { name: "mouseout";
+            signal: "mouse,out";
+            source: "delbtn/img";
+            script {
+               get_state(PART:"delbtn/img", st, 30, vl);
+               if (!strcmp(st, "pressed"))
+                  set_state(PART:"delbtn/img", "show", 0.0);
+            }
+         }
+         program { name: "mouse_up_delbtn_img";
+            signal: "mouse,up,1";
+            source: "delbtn/img";
+            action: SIGNAL_EMIT "elm,action,click" "";
+         }
+         program { name: "show_delbtn";
+            source: "elm";
+            signal: "elm,state,show,delbtn";
+            script {
+               set_state(PART:"delbtn/img", "show", 0.0);
+            }
+         }
+         program { name: "hide_delbtn";
+            source: "elm";
+            signal: "elm,state,hide,delbtn";
+            script {
+               set_state(PART:"delbtn/img", "default", 0.0);
+            }
+         }
+         program { name: "show_dim";
+            source: "elm";
+            signal: "elm,state,show,dim";
+            action: STATE_SET "show" 0.0;
+            target: "elm.rect.dim";
+         }
+         program { name: "hide_dim";
+            source: "elm";
+            signal: "elm,state,hide,dim";
+            action: STATE_SET "default" 0.0;
+            target: "elm.rect.dim";
+         }
+      }
+   }
 }
diff --git a/data/themes/extstyles.edc b/data/themes/extstyles.edc
new file mode 100644 (file)
index 0000000..9551d10
--- /dev/null
@@ -0,0 +1,393 @@
+/*
+ * cbhm
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+////////////////////////////////////////////////////////////////////////////////
+   group { name: "elm/check/base/extended/itemcheck";
+      images {
+         image: "B12_button_delete.png" COMP;
+         image: "B12_button_delete_press.png" COMP;
+      }
+      script {
+         new st[31];
+         new Float:vl;
+      }
+      parts {
+         part { name: "bg";
+            mouse_events: 1;
+            scale: 1;
+            type: RECT;
+            description { state: "default" 0.0;
+               rel2.relative: 0.0 1.0;
+               fixed: 1 0;
+               align: 0.0 0.5;
+               min: 122 32;
+               max: 122 32;
+               color: 0 0 0 0;
+            }
+         }
+         part { name: "bg2";
+            type: RECT;
+            mouse_events: 0;
+            scale: 1;
+            description { state: "default" 0.0;
+               rel2.relative: 1.0 1.0;
+               align: 0.95 0.01;
+               min: 46 40;
+               max: 46 40;
+               color:  0 0 0 0;
+               visible: 1;
+            }
+            description { state: "pressed" 0.0;
+               inherit: "default" 0.0;
+            }
+            description { state: "disabled" 0.0;
+               inherit: "default" 0.0;
+               visible: 1;
+            }
+         }
+         part { name: "check";
+            mouse_events: 0;
+            scale: 1;
+            description { state: "default" 0.0;
+               rel1.to: "bg2";
+               rel2.to: "bg2";
+               visible: 1;
+               image {
+                  normal: "B12_button_delete.png";
+                  //border: 16 12 14 14;
+                  //middle: 1;
+                  //border_scale: 1;
+               }
+            }
+            description { state: "visible" 0.0;
+               inherit: "default" 0.0;
+               image {
+                  //normal: "00_check_on.png";
+               }
+            }
+            description { state: "pressed" 0.0;
+               inherit: "default" 0.0;
+               image {
+                  normal: "B12_button_delete_press.png";
+               }
+            }
+            description { state: "visible_pressed" 0.0;
+               inherit: "default" 0.0;
+               image {
+                  //normal: "00_check_on_press.png";
+               }
+            }
+         }
+         part { name: "elm.swallow.content";
+            type: SWALLOW;
+            description { state: "default" 0.0;
+               fixed: 1 0;
+               visible: 0;
+               color: 255 255 255 255;
+               align: 0.0 0.5;
+               rel1.to_x: "bg";
+               rel1.relative: 1.0 0.0;
+               rel1.offset: 1 1;
+               rel2.to_x: "bg";
+               rel2.relative: 1.0 1.0;
+               rel2.offset: 2 -2;
+            }
+            description { state: "visible" 0.0;
+               inherit: "default" 0.0;
+               fixed: 1 1;
+               visible: 1;
+               aspect: 1.0 1.0;
+               aspect_preference: VERTICAL;
+            }
+            description { state: "disabled" 0.0;
+               inherit: "default" 0.0;
+               color: 128 128 128 128;
+            }
+            description { state: "disabled_visible" 0.0;
+               inherit: "default" 0.0;
+               color: 128 128 128 128;
+               fixed: 1 1;
+               visible: 1;
+               aspect: 1.0 1.0;
+            }
+         }
+         part { name: "events";
+            type: RECT;
+            ignore_flags: ON_HOLD;
+            description { state: "default" 0.0;
+               color: 0 0 0 0;
+            }
+         }
+         part { name: "disabler";
+            type: RECT;
+            description { state: "default" 0.0;
+               color: 0 0 0 0;
+               visible: 0;
+            }
+            description { state: "disabled" 0.0;
+               inherit: "default" 0.0;
+               visible: 1;
+               color: 0 0 0 128;
+            }
+         }
+      }
+      programs {
+         program { name: "click";
+            signal: "mouse,up,1";
+            source: "events";
+            action: SIGNAL_EMIT "elm,action,check,toggle" "";
+         }
+         program { name: "pressed";
+            signal: "mouse,down,1";
+            source: "events";
+            script {
+               get_state(PART:"check", st, 30, vl);
+               if (!strcmp(st, "visible"))
+                  set_state(PART:"check", "visible_pressed", 0.0);
+               else if (!strcmp(st, "default"))
+                  set_state(PART:"check", "pressed", 0.0);
+            }
+            after: "checkpressed";
+         }
+         program { name: "checkpressed";
+            signal: "mouse,up,1";
+            source: "check";
+            action: SIGNAL_EMIT "elm,action,click" "";
+         }
+         program { name: "mouseout";
+            signal: "mouse,out";
+            source: "events";
+            after: "bg_check_normal";
+         }
+         program { name: "bg_check_normal";
+            script {
+               get_state(PART:"check", st, 30, vl);
+               if (!strcmp(st, "pressed"))
+                  set_state(PART:"check", "default", 0.0);
+               else if (!strcmp(st, "visible_pressed"))
+                  set_state(PART:"check", "visible", 0.0);
+            }
+         }
+         program { name: "check_on";
+            signal: "elm,state,check,on";
+            source: "elm";
+            action:  STATE_SET "visible" 0.0;
+            target: "check";
+         }
+         program { name: "check_off";
+            signal: "elm,state,check,off";
+            source: "elm";
+            action:  STATE_SET "default" 0.0;
+            target: "check";
+         }
+         program { name: "icon_show";
+            signal: "elm,state,icon,visible";
+            source: "elm";
+            action:  STATE_SET "visible" 0.0;
+            target: "elm.swallow.content";
+         }
+         program { name: "icon_hide";
+            signal: "elm,state,icon,hidden";
+            source: "elm";
+            action:  STATE_SET "default" 0.0;
+            target: "elm.swallow.content";
+         }
+         program { name: "disable";
+            signal: "elm,state,disabled";
+            source: "elm";
+            action: STATE_SET "disabled" 0.0;
+            target: "disabler";
+         }
+         program { name: "enable";
+            signal: "elm,state,enabled";
+            source: "elm";
+            action: STATE_SET "default" 0.0;
+            target: "disabler";
+         }
+      }
+   }
+
+#define W               187
+#define H               151
+#define PL              187 // Thumbnail Long
+#define PS              151  // Thumbnail Short
+#define INNER           6   // Inner line
+
+   group { name: "elm/gengrid/widestyle/horizontal_layout";
+      images {
+         image: "B12_button_delete.png" COMP;
+         image: "B12_button_delete_press.png" COMP;
+      }
+      script {
+         new st[31];
+         new Float:vl;
+      }
+      parts {
+         part { name: "bg";
+            type: RECT;
+            mouse_events: 1;
+            scale: 1;
+            description { state: "default" 0.0;
+               rel1 { relative: 0.0 0.0; }
+               rel2 { relative: 1.0 1.0; }
+               color: 0 0 0 0;
+            }
+         }
+         part { name: "icon_bg";
+            type: RECT;
+            scale: 1;
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               rel1 { relative: 0.0 0.0; to: "bg"; }
+               rel2 { relative: 1.0 1.0; to: "bg"; }
+            }
+         }
+         part { name: "elm.swallow.icon";
+            type: SWALLOW;
+            scale: 1;
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               rel1 { relative: 0.0 0.0; offset: 1 1; to: "icon_bg"; }
+               rel2 { relative: 1.0 1.0; offset: -2 -2; to: "icon_bg"; }
+            }
+         }
+         part { name: "cliprect";
+            type: RECT;
+            scale: 1;
+            description { state: "default" 0.0;
+               rel1 { relative: 0.0 0.0; to: "elm.swallow.icon"; }
+               rel2 { relative: 1.0 1.0; to: "elm.swallow.icon"; }
+            }
+         }
+         part { name: "elm.swallow.inner";
+            type: SWALLOW;
+            clip_to: "cliprect";
+            scale: 1;
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               rel1 { relative: 0.0 0.0; offset: 1 1; to: "cliprect"; }
+               rel2 { relative: 1.0 1.0; offset: -1 -1; to: "cliprect"; }
+            }
+         }
+         part { name: "elm.rect.dim";
+            type: RECT;
+            scale: 1;
+            mouse_events: 0;
+            description { state: "default" 0.0;
+               visible: 0;
+               color: 0 0 0 200;
+               rel1.to: "cliprect";
+               rel2.to: "cliprect";
+            }
+            description { state: "show" 0.0;
+               inherit: "default" 0.0;
+               visible: 1;
+            }
+         }
+         part { name: "delbtn";
+            type: RECT;
+            mouse_events: 0;
+            scale: 1;
+            description { state: "default" 0.0;
+               rel1.to: "elm.swallow.icon";
+               rel1.offset: -4 4;
+               rel2.to: "elm.swallow.icon";
+               rel2.offset: -4 4;
+               align: 1.0 0.0;
+               min: 60 60;
+               max: 60 60;
+               visible: 0;
+            }
+         }
+         part { name: "delbtn/img";
+            mouse_events: 1;
+            scale: 1;
+            description { state: "default" 0.0;
+               rel1.to: "delbtn";
+               rel2.to: "delbtn";
+               visible: 0;
+            }
+            description { state: "show" 0.0;
+               inherit: "default" 0.0;
+               visible: 1;
+               image {
+                  normal: "B12_button_delete.png";
+               }
+            }
+            description { state: "pressed" 0.0;
+               inherit: "default" 0.0;
+               visible: 1;
+               image {
+                  normal: "B12_button_delete_press.png";
+               }
+            }
+         }
+      }
+      programs {
+         program { name: "pressed";
+            signal: "mouse,down,1";
+            source: "delbtn/img";
+            script {
+               get_state(PART:"delbtn/img", st, 30, vl);
+               if (!strcmp(st, "show"))
+                  set_state(PART:"delbtn/img", "pressed", 0.0);
+            }
+         }
+         program { name: "mouseout";
+            signal: "mouse,out";
+            source: "delbtn/img";
+            script {
+               get_state(PART:"delbtn/img", st, 30, vl);
+               if (!strcmp(st, "pressed"))
+                  set_state(PART:"delbtn/img", "show", 0.0);
+            }
+         }
+         program { name: "mouse_up_delbtn_img";
+            signal: "mouse,up,1";
+            source: "delbtn/img";
+            action: SIGNAL_EMIT "elm,action,click" "";
+         }
+         program { name: "show_delbtn";
+            source: "elm";
+            signal: "elm,state,show,delbtn";
+            script {
+               set_state(PART:"delbtn/img", "show", 0.0);
+            }
+         }
+         program { name: "hide_delbtn";
+            source: "elm";
+            signal: "elm,state,hide,delbtn";
+            script {
+               set_state(PART:"delbtn/img", "default", 0.0);
+            }
+         }
+         program { name: "show_dim";
+            source: "elm";
+            signal: "elm,state,show,dim";
+            action: STATE_SET "show" 0.0;
+            target: "elm.rect.dim";
+         }
+         program { name: "hide_dim";
+            source: "elm";
+            signal: "elm,state,hide,dim";
+            action: STATE_SET "default" 0.0;
+            target: "elm.rect.dim";
+         }
+      }
+   }
index cb17b09..cc61105 100644 (file)
@@ -1,2 +1,3 @@
 @PREFIX@/bin/*
 @PREFIX@/share/*
+/etc/init.d/*
diff --git a/debian/cbhm.postinst b/debian/cbhm.postinst
new file mode 100755 (executable)
index 0000000..8ab65f6
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+ln -s /etc/init.d/cbhm /etc/rc.d/rc3.d/S95cbhm
+
+sync
diff --git a/debian/cbhm.prerm b/debian/cbhm.prerm
new file mode 100755 (executable)
index 0000000..c1e0d7c
--- /dev/null
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+rm /etc/rc.d/rc3.d/S95cbhm
+
+sync
index 0dce12f..57f184a 100644 (file)
@@ -1,3 +1,961 @@
+cbhm (0.1.116) unstable; urgency=low
+
+  * remove delete popup 
+  * Git: slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.116
+
+ -- Minseok Kim <minseok3.kim@samsung.com>  Tue, 19 Jun 2012 16:04:20 +0900
+
+cbhm (0.1.115) unstable; urgency=low
+
+  * remove debug message(S1-3110)
+  * Git: slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.115
+
+ -- Minseok Kim <minseok3.kim@samsung.com>  Tue, 18 May 2012 16:04:20 +0900
+
+cbhm (0.1.114) unstable; urgency=low
+
+  * modify cbhm GUI
+  * Git: slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.114
+
+ -- Minseok Kim <minseok3.kim@samsung.com>  Tue, 15 May 2012 16:11:20 +0900
+
+cbhm (0.1.113) unstable; urgency=low
+
+  * Package Upload
+  * Git: slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.113
+
+ -- Jeonghyun Yun <jh0506.yun@samsung.com>  Fri, 27 Apr 2012 13:56:23 +0900
+
+cbhm (0.1.0-112) unstable; urgency=low
+
+  * fixed copy&paste error in webkit and S1-2158, S1-2290 issue
+  * Git: slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-112
+
+ -- Minseok Kim <minseok3.kim@samsung.com>  Fri, 20 Apr 2012 17:28:20 +0900
+
+cbhm (0.1.0-111) unstable; urgency=low
+
+  * fixed N_SE-326, N_SE-398, S1-1584 issue 
+  * Git: slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-111
+
+ -- Minseok Kim <minseok3.kim@samsung.com>  Fri, 06 Apr 2012 10:08:20 +0900
+
+cbhm (0.1.0-110) unstable; urgency=low
+
+  * modified cbhm GUI and replaced tickernotif as notification
+  * Git: slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-110
+
+ -- Minseok Kim <minseok3.kim@samsung.com>  Fri, 06 Apr 2012 10:08:20 +0900
+
+cbhm (0.1.0-109) unstable; urgency=low
+
+  * fixed cbhm package upload for NabiS1-2106 issue
+  * Git: slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-109
+
+ -- Minseok Kim <minseok3.kim@samsung.com>  Tue, 27 Mar 2012 12:09:08 +0900
+
+cbhm (0.1.0-108) unstable; urgency=low
+
+  * package upload for efl migration
+  * Git: slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-108
+
+ -- Deasung Kim <deasung.kim@samsung.com>  Fri, 16 Mar 2012 15:46:15 +0900
+
+cbhm (0.1.0-107) unstable; urgency=low
+
+  * change Elm_Gengrid_Item to Elm_Object_Item for EFL migration
+  * Git: slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-107
+
+ -- Deasung Kim <deasung.kim@samsung.com>  Wed, 15 Feb 2012 21:40:55 +0900
+
+cbhm (0.1.0-106) unstable; urgency=low
+
+  * Refactoring(add convert function)
+  * Git: slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-106
+
+ -- Deasung Kim <deasung.kim@samsung.com>  Mon, 06 Feb 2012 17:53:50 +0900
+
+cbhm (0.1.0-105) unstable; urgency=low
+
+  * change screen capture directory
+  * Git: slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-105
+
+ -- Deasung Kim <deasung.kim@samsung.com>  Thu, 26 Jan 2012 14:12:18 +0900
+
+cbhm (0.1.0-104) unstable; urgency=low
+
+  * import screen capture routine for remove xsever-util-ex package
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-104
+
+ -- Deasung Kim <deasung.kim@samsung.com>  Tue, 06 Dec 2011 15:19:48 +0900
+
+cbhm (0.1.0-103) unstable; urgency=low
+
+  * [CQ:H0100137365] set to can't get focus when cbhm window is disappear.
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-103
+
+ -- Deasung Kim <deasung.kim@samsung.com>  Wed, 30 Nov 2011 14:39:50 +0900
+
+cbhm (0.1.0-102) unstable; urgency=low
+
+  * remove default item
+  * change screen capture effect
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-102
+
+ -- Deasung Kim <deasung.kim@samsung.com>  Thu, 24 Nov 2011 16:42:38 +0900
+
+cbhm (0.1.0-101) unstable; urgency=low
+
+  * add clipboard selection check timer
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-101
+
+ -- Deasung Kim <deasung.kim@samsung.com>  Mon, 07 Nov 2011 13:08:56 +0900
+
+cbhm (0.1.0-100) unstable; urgency=low
+
+  * change clipboard text color to black
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-100
+
+ -- Deasung Kim <deasung.kim@samsung.com>  Thu, 03 Nov 2011 23:33:13 +0900
+
+cbhm (0.1.0-99) unstable; urgency=low
+
+  * using utilx_get_screen_capture function for MDM
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-99
+
+ -- Deasung Kim <deasung.kim@samsung.com>  Mon, 24 Oct 2011 15:47:23 +0900
+
+cbhm (0.1.0-98) unstable; urgency=low
+
+  * bugfix: apply scale value
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-98
+
+ -- Deasung Kim <deasung.kim@samsung.com>  Thu, 20 Oct 2011 15:45:49 +0900
+
+cbhm (0.1.0-97) unstable; urgency=low
+
+  * bugfix: sometimes image shown when textonly setted & dim move from evas_rect(c) to edje(edc)
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-97
+
+ -- Deasung Kim <deasung.kim@samsung.com>  Fri, 07 Oct 2011 20:46:14 +0900
+
+cbhm (0.1.0-96) unstable; urgency=low
+
+  * using ecore_x_e_illume_sliding_win_geometry_set().
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-96
+
+ -- Deasung Kim <deasung.kim@samsung.com>  Fri, 07 Oct 2011 16:41:43 +0900
+
+cbhm (0.1.0-95) unstable; urgency=low
+
+  * Packaging for upload
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-95
+
+ -- Myungjae Lee <mjae.lee@samsung.com>  Thu, 06 Oct 2011 20:47:27 +0900
+
+cbhm (0.1.0-94) unstable; urgency=low
+
+  * Add libsvi-dev library to control
+  * Git: git:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-94
+
+ -- Myoungwoon Kim <myoungwoon.kim@samsung.com>  Mon, 19 Sep 2011 12:52:03 +0900
+
+cbhm (0.1.0-93) unstable; urgency=low
+
+  * bugfix: paste image in text using cbhm UI
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-93
+
+ -- ChunEon Park <chuneon.park@samsung.com>  Mon, 19 Sep 2011 09:56:08 +0900
+
+cbhm (0.1.0-92) unstable; urgency=low
+
+  * bugfix: paste image in text using cbhm UI
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-92
+
+ -- Deasung.Kim <deasung.kim@samsung.com>  Thu, 18 Aug 2011 15:25:18 +0900
+
+cbhm (0.1.0-91) unstable; urgency=low
+
+  * changed screenshot-related API names according to the x11-server-utils-ex package changes
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-91
+
+ -- Deasung.Kim <deasung.kim@samsung.com>  Wed, 10 Aug 2011 11:08:48 +0900
+
+cbhm (0.1.0-90) unstable; urgency=low
+
+  * fixing paste image
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-90 
+
+ -- Deasung.Kim <deasung.kim@samsung.com>  Fri, 05 Aug 2011 15:28:55 +0900
+
+cbhm (0.1.0-89) unstable; urgency=low
+
+  * fixing black-out-screen, and rotation bugs
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-89
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 08 Jun 2011 15:34:01 +0900
+
+cbhm (0.1.0-88) unstable; urgency=low
+
+  * repackaging for upload
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-88
+
+ -- Myungjae Lee <mjae.lee@samsung.com>  Tue, 31 May 2011 21:53:00 +0900
+
+cbhm (0.1.0-87) unstable; urgency=low
+
+  * repackaging for upload
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-87
+
+ -- Myungjae Lee <mjae.lee@samsung.com>  Tue, 31 May 2011 21:51:00 +0900
+
+cbhm (0.1.0-86) unstable; urgency=low
+
+  * fixed bug in showing/hiding cbhm window
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-86
+
+ -- Myungjae Lee <mjae.lee@samsung.com>  Tue, 31 May 2011 21:42:00 +0900
+
+cbhm (0.1.0-85) unstable; urgency=low
+
+  * add rotation feature
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-85
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 12 Apr 2011 17:05:24 +0900
+
+cbhm (0.1.0-84) unstable; urgency=low
+
+  * version up
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-84
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 29 Mar 2011 20:56:29 +0900
+
+cbhm (0.1.0-83) unstable; urgency=low
+
+  * add libscreenshot to LDFLAGS
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-83
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 29 Mar 2011 11:02:45 +0900
+
+cbhm (0.1.0-82) unstable; urgency=low
+
+  * remove focus at idle status
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-82
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Thu, 24 Mar 2011 16:25:04 +0900
+
+cbhm (0.1.0-81) unstable; urgency=low
+
+  * remove image file extension checking
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-81
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 23 Mar 2011 19:09:47 +0900
+
+cbhm (0.1.0-80) unstable; urgency=low
+
+  * version up
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-80
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Mon, 28 Feb 2011 16:03:50 +0900
+
+cbhm (0.1.0-79) unstable; urgency=low
+
+  * change content buffer copying method
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-79
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Mon, 28 Feb 2011 15:41:18 +0900
+
+cbhm (0.1.0-78) unstable; urgency=low
+
+  * change internal string saving storage type
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-78
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Thu, 17 Feb 2011 17:34:43 +0900
+
+cbhm (0.1.0-77) unstable; urgency=low
+
+  * version up
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-77
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 15 Feb 2011 17:11:16 +0900
+
+cbhm (0.1.0-76) unstable; urgency=low
+
+  * changing sound path
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-76
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 15 Feb 2011 15:29:43 +0900
+
+cbhm (0.1.0-75) unstable; urgency=low
+
+  * changing recent item saving method
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-75
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 08 Feb 2011 21:10:23 +0900
+
+cbhm (0.1.0-74) unstable; urgency=low
+
+  * reapply item saving method, ui changes
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-74
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Sat, 05 Feb 2011 17:32:26 +0900
+
+cbhm (0.1.0-73) unstable; urgency=low
+
+  * Rollback to Jan. 27.
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-73
+
+ -- Juyung Seo <juyung.seo@samsung.com>  Wed, 02 Feb 2011 14:33:29 +0900
+
+cbhm (0.1.0-72) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-72
+  * adjust UI to guideline
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 01 Feb 2011 17:37:06 +0900
+
+cbhm (0.1.0-71) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-71
+  * change animation effect duration time
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Thu, 27 Jan 2011 11:26:06 +0900
+
+cbhm (0.1.0-70) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-70
+  * change animation effect duration time
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Sat, 22 Jan 2011 17:52:37 +0900
+
+cbhm (0.1.0-69) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-69
+  * show/hide effect on
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Sat, 22 Jan 2011 17:41:52 +0900
+
+cbhm (0.1.0-68) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-68
+  * show/hide effect prototyping
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Sat, 22 Jan 2011 12:33:23 +0900
+
+cbhm (0.1.0-67) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-67
+  * enable textonly mode
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Thu, 20 Jan 2011 16:46:30 +0900
+
+cbhm (0.1.0-66) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-66
+  * add textonly mode feature
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Fri, 14 Jan 2011 15:45:55 +0900
+
+cbhm (0.1.0-65) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-65
+  * version up
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 12 Jan 2011 19:40:10 +0900
+
+cbhm (0.1.0-64) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-64
+  * version up
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 12 Jan 2011 19:31:42 +0900
+
+cbhm (0.1.0-63) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-63
+  * elm_gengrid changes
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 12 Jan 2011 19:29:46 +0900
+
+cbhm (0.1.0-62) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-62
+  * version up for new elm
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 12 Jan 2011 16:41:04 +0900
+
+cbhm (0.1.0-61) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-61
+  * change default item size, bugfix content update
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Thu, 06 Jan 2011 20:44:32 +0900
+
+cbhm (0.1.0-60) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-60
+  * version up
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 05 Jan 2011 10:07:55 +0900
+
+cbhm (0.1.0-59) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-59
+  * minor bugfix(error handling at scrcapture)
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 05 Jan 2011 09:53:54 +0900
+
+cbhm (0.1.0-58) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-58
+  * add to set transient_for at main_win
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Mon, 03 Jan 2011 15:46:38 +0900
+
+cbhm (0.1.0-57) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-57
+  * change screen capture effect sound
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 29 Dec 2010 15:52:40 +0900
+
+cbhm (0.1.0-56) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-56
+  * add screen capture effect sound
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 28 Dec 2010 20:11:13 +0900
+
+cbhm (0.1.0-55) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-55
+  * fix screen capture return value error
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 28 Dec 2010 16:46:23 +0900
+
+cbhm (0.1.0-54) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-54
+  * version up
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Mon, 20 Dec 2010 15:36:16 +0900
+
+cbhm (0.1.0-53) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-53
+  * set gengrid selection item to false
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Mon, 20 Dec 2010 15:11:28 +0900
+
+cbhm (0.1.0-52) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-52
+  * enable delbtn popup
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Mon, 20 Dec 2010 14:34:45 +0900
+
+cbhm (0.1.0-51) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-51
+  * applying new UX(0.2)
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 14 Dec 2010 15:57:44 +0900
+
+cbhm (0.1.0-50) unstable; urgency=low
+
+  * Git: 165.213.180.234:slp/pkgs/c/cbhm
+  * Tag: cbhm_0.1.0-50
+  * update git path
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 08 Dec 2010 11:31:55 +0900
+
+cbhm (0.1.0-49) unstable; urgency=low
+
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-49
+  * remove screen capture keygrab
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 08 Dec 2010 11:19:51 +0900
+
+cbhm (0.1.0-48) unstable; urgency=low
+
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-48
+  * change delete popup timeout
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Mon, 29 Nov 2010 17:03:40 +0900
+
+cbhm (0.1.0-47) unstable; urgency=low
+
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-47
+  * change history item retrieving method, disable window effect
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Mon, 29 Nov 2010 16:32:31 +0900
+
+cbhm (0.1.0-46) unstable; urgency=low
+
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-46
+  * add null checking at scrcapture
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 17 Nov 2010 14:16:28 +0900
+
+cbhm (0.1.0-45) unstable; urgency=low
+
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-45
+  * add default img history item
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Mon, 15 Nov 2010 16:18:38 +0900
+
+cbhm (0.1.0-44) unstable; urgency=low
+
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-44
+  * add item delete mode, capture key change
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 09 Nov 2010 04:26:51 +0000
+
+cbhm (0.1.0-43) unstable; urgency=low
+
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-43
+  * check file exist when img item adding
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 27 Oct 2010 21:11:21 +0900
+
+cbhm (0.1.0-42) unstable; urgency=low
+
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-42
+  * realign close arrow button image pos
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 26 Oct 2010 15:23:05 +0900
+
+cbhm (0.1.0-41) unstable; urgency=low
+
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-41
+  * deactivate by default
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 26 Oct 2010 15:12:30 +0900
+
+cbhm (0.1.0-40) unstable; urgency=low
+
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-40
+  * make scalable positioning
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 26 Oct 2010 15:08:02 +0900
+
+cbhm (0.1.0-39) unstable; urgency=low
+
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-39
+  * limit 10 image items, change img path
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Mon, 25 Oct 2010 18:11:00 +0900
+
+cbhm (0.1.0-38) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-38
+  * code clean up
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Thu, 21 Oct 2010 18:08:08 +0900
+
+cbhm (0.1.0-37) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-37
+  * dummy for version up
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Thu, 21 Oct 2010 16:17:38 +0900
+
+cbhm (0.1.0-36) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-36
+  * add html atom to targets
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Thu, 21 Oct 2010 16:15:59 +0900
+
+cbhm (0.1.0-35) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-35
+  * disable reacting delete,request from window mgr
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 20 Oct 2010 20:01:50 +0900
+
+cbhm (0.1.0-34) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-34
+  * enable screencapture feature
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 20 Oct 2010 19:43:44 +0900
+
+cbhm (0.1.0-33) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-33
+  * revise screencapture feature
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 20 Oct 2010 17:36:42 +0900
+
+cbhm (0.1.0-32) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-32
+  * add screencapture feature
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 20 Oct 2010 10:42:33 +0900
+
+cbhm (0.1.0-31) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-31
+  * temporary clipdrawer height change
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Fri, 15 Oct 2010 18:35:31 +0900
+
+cbhm (0.1.0-30) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-30
+  * change default charset from XA_STRING to UTF-8
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 12 Oct 2010 20:00:10 +0900
+
+cbhm (0.1.0-29) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-29
+  * lowering view at focus-out
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Mon, 11 Oct 2010 15:04:34 +0900
+
+cbhm (0.1.0-28) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-28
+  * reduce default img and align imglist to left
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Mon, 11 Oct 2010 14:49:15 +0900
+
+cbhm (0.1.0-27) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-27
+  * dummy for version up
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Mon, 11 Oct 2010 12:44:56 +0900
+
+cbhm (0.1.0-26) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-26
+  * do not lowering at focusout, and item pasting
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Mon, 11 Oct 2010 12:08:45 +0900
+
+cbhm (0.1.0-25) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-25
+  * add image copy history feature
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Mon, 11 Oct 2010 11:25:38 +0900
+
+cbhm (0.1.0-24) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-24
+  * apply customized elm_list style
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Thu, 07 Oct 2010 20:03:29 +0900
+
+cbhm (0.1.0-23) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-23
+  * apply texthistory background image
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Thu, 07 Oct 2010 16:37:15 +0900
+
+cbhm (0.1.0-22) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-22
+  * apply background image
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 06 Oct 2010 21:58:06 +0900
+
+cbhm (0.1.0-21) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-21
+  * add close button
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 06 Oct 2010 21:41:08 +0900
+
+cbhm (0.1.0-20) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-20
+  * change imglist from elm_photo to elm_gengrid
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 05 Oct 2010 15:05:24 +0900
+
+cbhm (0.1.0-19) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-19
+  * translate escaped string to plain string
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Thu, 30 Sep 2010 12:02:45 +0900
+
+cbhm (0.1.0-18) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-18
+  * adjust background color
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 29 Sep 2010 09:07:22 +0900
+
+cbhm (0.1.0-17) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-17
+  * add handing xwin focus out event
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 28 Sep 2010 19:51:59 +0900
+
+cbhm (0.1.0-16) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-16
+  * update debian/control pkg dependency
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 28 Sep 2010 15:36:21 +0900
+
+cbhm (0.1.0-15) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-15
+  * adding img&txt paste features
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 28 Sep 2010 13:06:19 +0900
+
+cbhm (0.1.0-14) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-14
+  * update changelog
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Sat, 25 Sep 2010 17:18:47 +0900
+
+cbhm (0.1.0-13) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-13
+  * disable list clicked pasting feature 
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Fri, 24 Sep 2010 18:05:44 +0900
+
+cbhm (0.1.0-12) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-12
+  * change default img path
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Fri, 17 Sep 2010 14:07:51 +0900
+
+cbhm (0.1.0-11) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-11
+  * enable by default
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Thu, 16 Sep 2010 14:46:41 +0900
+
+cbhm (0.1.0-10) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-10
+  * disabled by default
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 15 Sep 2010 20:10:25 +0900
+
+cbhm (0.1.0-9) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-9
+  * change lowering scheme
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 15 Sep 2010 17:16:50 +0900
+
+cbhm (0.1.0-8) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-8
+  * lowering at app init
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 15 Sep 2010 16:51:25 +0900
+
+cbhm (0.1.0-7) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-7
+  * add init script
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 15 Sep 2010 16:47:09 +0900
+
+cbhm (0.1.0-6) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-6
+  * add dependancy utilX
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 15 Sep 2010 13:29:33 +0900
+
+cbhm (0.1.0-5) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-5
+  * version up for pkg uploading
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 15 Sep 2010 13:15:51 +0900
+
+cbhm (0.1.0-4) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-4
+  * refine list update routine
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Wed, 15 Sep 2010 12:38:14 +0900
+
+cbhm (0.1.0-3) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-3
+  * refine list update routine
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 14 Sep 2010 22:03:28 +0900
+
+cbhm (0.1.0-2) unstable; urgency=low
+
+  * case of inhouse package
+  * Git: 165.213.180.234:/git/slp/pkgs/cbhm
+  * Tag: cbhm_0.1.0-2
+  * initial upload
+
+ -- Hyoyoung Chang <hyoyoung.chang@samsung.com>  Tue, 14 Sep 2010 21:57:41 +0900
+
 cbhm (0.1.0-1) unstable; urgency=low
 
   * init
index ed85b0a..96c094d 100755 (executable)
@@ -1,8 +1,9 @@
 Source: cbhm
 Section: devel
 Priority: extra
-Maintainer: Hyoyoung Chang <hyoyoung.chang@samsung.com>
-Build-Depends: debhelper (>= 5), libelm-dev, libappcore-efl-dev
+Maintainer: Minseok Kim <minseok3.kim@samsung.com>, Deasung Kim <deasung.kim@samsung.com>, Hyoyoung Chang <hyoyoung.chang@samsung.com>
+Uploaders: Juyung Seo <juyung.seo@samsung.com>, Myungjae Lee <mjae.lee@samsung.com>, ChunEon Park <chuneon.park@samsung.com>
+Build-Depends: debhelper (>= 5), libelm-dev, libappcore-efl-dev, libappcore-common-dev, libx11-dev, libecore-dev, libslp-utilx-dev, libmm-common-dev, libmm-sound-dev, libsvi-dev, libpixman-1-dev
 Standards-Version: 0.1.1
 
 Package: cbhm
index dc32d87..8b13789 100644 (file)
@@ -1,23 +1 @@
-This is $PACKAGE_NAME, written and maintained by $NAME <$EMAIL>
-on Fri, 13 Nov 2009 14:08:22 +0900.
-
-The original source can always be found at:
-        ftp://slp.samsung.net/dists/unstable/main/source/
-
-Copyright Holder: $NAME
-
-License:
-        samsung
-
-/*
- * SLP2.0
- * Copyright (c) 2008 Samsung Electronics, Inc.
- * All rights reserved.
- *
- * This software is a confidential and proprietary information
- * of Samsung Electronics, Inc. ("Confidential Information").  You
- * shall not disclose such Confidential Information and shall use
- * it only in accordance with the terms of the license agreement
- * you entered into with Samsung Electronics.
- */
 
index 18bee42..a67d4f6 100755 (executable)
@@ -65,6 +65,7 @@ clean:
        rm -rf install_manifest.txt
        rm -rf *.so
        rm -rf *.edj
+       rm -rf data/themes/*.edj
 
        rm -rf po/CMakeCache.txt
        rm -rf po/CMakeFiles
@@ -97,7 +98,7 @@ binary-arch: build install
        dh_testdir
        dh_testroot
        dh_installchangelogs 
-       dh_installdocs
+#      dh_installdocs
        dh_installexamples
        dh_install --sourcedir=debian/tmp
 #      dh_installmenu
diff --git a/packaging/cbhm.service b/packaging/cbhm.service
new file mode 100644 (file)
index 0000000..a657b92
--- /dev/null
@@ -0,0 +1,10 @@
+[Unit]
+Description=Clipboard helper module
+After=xorg.target
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/cbhm
+
+[Install]
+WantedBy=core-efl.target
diff --git a/packaging/cbhm.spec b/packaging/cbhm.spec
new file mode 100644 (file)
index 0000000..12164ca
--- /dev/null
@@ -0,0 +1,66 @@
+#sbs-git:slp/pkgs/c/cbhm cbhm 0.1.0 a67e97190313d19025925d8b9fd0aa9da3d0dc6a
+Name:       cbhm
+Summary:    cbhm application
+Version:    0.1.139r03
+Release:    1
+Group:      TO_BE/FILLED_IN
+License:    APLv2
+Source0:    %{name}-%{version}.tar.gz
+Source1:    cbhm.service
+BuildRequires:  cmake
+BuildRequires:  pkgconfig(elementary)
+BuildRequires:  pkgconfig(appcore-efl)
+BuildRequires:  pkgconfig(appcore-common)
+BuildRequires:  pkgconfig(x11)
+BuildRequires:  pkgconfig(ecore)
+BuildRequires:  pkgconfig(utilX)
+BuildRequires:  pkgconfig(mm-sound)
+BuildRequires:  pkgconfig(mm-common)
+BuildRequires:  pkgconfig(xext)
+BuildRequires:  pkgconfig(xrandr)
+BuildRequires:  pkgconfig(xcomposite)
+BuildRequires:  pkgconfig(xi)
+BuildRequires:  pkgconfig(svi)
+BuildRequires:  pkgconfig(pixman-1)
+BuildRequires:  pkgconfig(enotify)
+BuildRequires:  pkgconfig(capi-content-media-content)
+BuildRequires:  edje-tools
+
+%description
+Description: cbhm application
+
+
+%prep
+%setup -q
+cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix}
+
+
+%build
+make %{?jobs:-j%jobs}
+
+
+%install
+rm -rf %{buildroot}
+%make_install
+mkdir -p %{buildroot}/usr/share/license
+cp %{_builddir}/%{buildsubdir}/LICENSE %{buildroot}/usr/share/license/%{name}
+
+mkdir -p %{buildroot}%{_sysconfdir}/init.d
+mkdir -p %{buildroot}%{_sysconfdir}/rc.d/rc3.d
+mkdir -p %{buildroot}/usr/lib/systemd/user/core-efl.target.wants
+
+ln -s /etc/init.d/cbhm %{buildroot}%{_sysconfdir}/rc.d/rc3.d/S95cbhm
+install -m 644 %{SOURCE1} %{buildroot}/usr/lib/systemd/user/cbhm.service
+ln -s ../cbhm.service  %{buildroot}/usr/lib/systemd/user/core-efl.target.wants/cbhm.service
+
+%files
+%manifest %{name}.manifest
+%defattr(-,root,root,-)
+%{_sysconfdir}/init.d/cbhm
+%{_sysconfdir}/rc.d/rc3.d/S95cbhm
+%{_bindir}/cbhm
+%{_datadir}/cbhm/icons/cbhm_default_img.png
+%{_datadir}/edje/cbhmdrawer.edj
+/usr/lib/systemd/user/cbhm.service
+/usr/lib/systemd/user/core-efl.target.wants/cbhm.service
+/usr/share/license/%{name}
diff --git a/src/cbhm.h b/src/cbhm.h
new file mode 100644 (file)
index 0000000..97f370a
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * cbhm
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#ifndef _CBHM_H_
+#define _CBHM_H_
+
+#include <Elementary.h>
+#include <Ecore_X.h>
+
+#if !defined(PACKAGE)
+#  define PACKAGE "CBHM"
+#endif
+
+#if !defined(APPNAME)
+#  define APPNAME "Clipboard History Manager"
+#endif
+
+#if !defined(LOCALEDIR)
+#  define LOCALEDIR "/usr/share/locale"
+#endif
+
+#define CBHM_MAGIC 0xad960009
+
+typedef struct _TargetHandler TargetHandler;
+typedef struct _AppData AppData;
+typedef struct _ClipdrawerData ClipdrawerData;
+typedef struct _CNP_ITEM CNP_ITEM;
+typedef struct _XHandlerData XHandlerData;
+typedef struct _SCaptureData SCaptureData;
+typedef struct _StorageData StorageData;
+typedef char *(*text_converter_func)(AppData *ad, int type_index, const char *str);
+
+#include "clipdrawer.h"
+#include "item_manager.h"
+#include "xhandler.h"
+#include "xconverter.h"
+#include "storage.h"
+
+struct _TargetHandler {
+       Ecore_X_Atom *atom;
+       char **name;
+       int atom_cnt;
+       text_converter_func convert_for_entry;
+       text_converter_func convert_to_target[ATOM_INDEX_MAX];
+};
+
+struct _AppData {
+       int magic;
+       Ecore_X_Display *x_disp;
+       Ecore_X_Window x_root_win;
+       Ecore_X_Window x_event_win;
+       Ecore_X_Window x_active_win;
+       Eina_List *item_list;
+
+       Eina_Bool (*draw_item_add)(AppData *ad, CNP_ITEM *item);
+       Eina_Bool (*draw_item_del)(AppData *ad, CNP_ITEM *item);
+       Eina_Bool (*storage_item_add)(AppData *ad, CNP_ITEM *item);
+       Eina_Bool (*storage_item_del)(AppData *ad, CNP_ITEM *item);
+//     CNP_ITEM *(*storage_item_load)(AppData *ad, int index);
+
+       ClipdrawerData *clipdrawer;
+       XHandlerData *xhandler;
+       StorageData *storage;
+
+       CNP_ITEM *clip_selected_item;
+       TargetHandler targetAtoms[ATOM_INDEX_MAX];
+};
+
+void *d_malloc(char *func, int line, size_t size);
+void *d_calloc(char *func, int line, size_t n, size_t size);
+void d_free(char *func, int line, void *m);
+
+//#define DEBUG
+
+#ifdef DEBUG
+#define DTRACE(fmt, args...) \
+{do { fprintf(stderr, "[%s:%04d] " fmt, __func__,__LINE__, ##args); } while (0); }
+#define DMSG(fmt, args...) printf("[%s] " fmt, __func__, ## args )
+#define CALLED() printf("called %s, %s\n", __FILE__, __func__);
+#define DTIME(fmt, args...) \
+{do { struct timeval tv1; gettimeofday(&tv1, NULL); double t1=tv1.tv_sec+(tv1.tv_usec/1000000.0); fprintf(stderr, "[CBHM][time=%lf:%s:%04d] " fmt, t1, __func__, __LINE__, ##args); } while (0); }
+#ifdef MEM_DEBUG
+#define MALLOC(size) d_malloc(__func__, __LINE__, size)
+#define CALLOC(n, size) d_calloc(__func__, __LINE__, n, size)
+#define FREE(p) d_free(__func__, __LINE__, p)
+#else
+#define MALLOC(size) malloc(size)
+#define CALLOC(n, size) calloc(n, size)
+#define FREE(p) free(p)
+#endif
+#else
+#define DTRACE(fmt, args...)
+#define DMSG(fmt, args...)
+#define CALLED()
+#define DTIME(fmt, args...)
+#define MALLOC(size) malloc(size)
+#define CALLOC(n, size) calloc(n, size)
+#define FREE(p) free(p)
+#endif
+
+#define ITEM_CNT_MAX 12
+
+#endif // _CBHM_H_
index 5182c8a..66cf655 100644 (file)
-#include "common.h"
+/*
+ * cbhm
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include <utilX.h>
 #include "clipdrawer.h"
-#include "cbhm_main.h"
-#include "storage.h"
-
-#ifndef _EDJ
-#define _EDJ(ly) elm_layout_edje_get(ly)
-#endif
-
-#define IM     "/mnt/ums/Images/Wallpapers/"
-static const char *images[] = {
-       IM"TFT_01_480x800.jpg",
-       IM"TFT_02_480x800.jpg",
-       IM"TFT_03_480x800.jpg",
-       IM"TFT_04_480x800.jpg",
-       IM"TFT_05_480x800.jpg",
-       IM"OCTA_01_480x800.jpg",
-       IM"OCTA_02_480x800.jpg",
-       IM"OCTA_03_480x800.jpg",
-       IM"OCTA_04_480x800.jpg",
-       IM"OCTA_05_480x800.jpg",
-};
-#define N_IMAGES (10)
-
-static void _list_click( void *data, Evas_Object *obj, void *event_info )
-{
-    Elm_List_Item *it = (Elm_List_Item *) elm_list_selected_item_get( obj );
-       if (it == NULL)
-               return;
+#include "item_manager.h"
+#include "xconverter.h"
+
+#define EDJ_PATH "/usr/share/edje"
+#define APP_EDJ_FILE EDJ_PATH"/cbhmdrawer.edj"
+#define GRP_MAIN "cbhmdrawer"
+
+#define ANIM_DURATION 30 // 1 seconds
+#define ANIM_FLOPS (0.5/30)
+#define DEFAULT_WIDTH 720
+#define GRID_IMAGE_INNER 10
+
+#define MULTI_(id) dgettext("sys_string", #id)
+#define S_CLIPBOARD MULTI_(IDS_COM_BODY_CLIPBOARD)
+#define S_DELETE MULTI_(IDS_COM_BODY_DELETE)
+#define S_DONE MULTI_(IDS_COM_BODY_DONE)
 
-    elm_list_item_selected_set(it, 0);
+static Evas_Object *create_win(ClipdrawerData *cd, const char *name);
+static Evas_Object *_grid_content_get(void *data, Evas_Object *obj, const char *part);
+static void _grid_del(void *data, Evas_Object *obj);
+static Eina_Bool clipdrawer_add_item(AppData *ad, CNP_ITEM *item);
+static Eina_Bool clipdrawer_del_item(AppData *ad, CNP_ITEM *item);
+static void clipdrawer_ly_clicked(void *data, Evas_Object *obj, const char *emission, const char *source);
+static void _grid_item_ly_clicked(void *data, Evas_Object *obj, const char *emission, const char *source);
+static void setting_win(Ecore_X_Display *x_disp, Ecore_X_Window x_main_win);
+static void set_transient_for(Ecore_X_Window x_main_win, Ecore_X_Window x_active_win);
+static void unset_transient_for(Ecore_X_Window x_main_win, Ecore_X_Window x_active_win);
+
+static void _change_gengrid_paste_textonly_mode(ClipdrawerData *cd)
+{
+       CNP_ITEM *item = NULL;
+
+       Elm_Object_Item *gitem = elm_gengrid_first_item_get(cd->gengrid);
+
+       while (gitem)
+       {
+               item = elm_object_item_data_get(gitem);
+               if ((item->type_index == ATOM_INDEX_IMAGE) && (item->layout))
+               {
+                       if (cd->paste_text_only)
+                               edje_object_signal_emit(elm_layout_edje_get(item->layout), "elm,state,show,dim", "elm");
+                       else
+                               edje_object_signal_emit(elm_layout_edje_get(item->layout), "elm,state,hide,dim", "elm");
+               }
+               gitem = elm_gengrid_item_next_get(gitem);
+       }
+}
 
-       char *p = NULL;
-       char *cpdata = NULL;
-       int clen;
+void clipdrawer_paste_textonly_set(AppData *ad, Eina_Bool textonly)
+{
+       ClipdrawerData *cd = ad->clipdrawer;
+       if (cd->paste_text_only != textonly)
+               cd->paste_text_only = textonly;
+       DTRACE("paste textonly mode = %d\n", textonly);
+
+       _change_gengrid_paste_textonly_mode(cd);
+}
+
+Eina_Bool clipdrawer_paste_textonly_get(AppData *ad)
+{
+       ClipdrawerData *cd = ad->clipdrawer;
+       return cd->paste_text_only;
+}
+
+static Evas_Object *_load_edj(Evas_Object* win, const char *file, const char *group)
+{
+       Evas_Object *layout = elm_layout_add(win);
+       if (!layout)
+       {
+               DMSG("ERROR: elm_layout_add return NULL\n");
+               return NULL;
+       }
+
+       if (!elm_layout_file_set(layout, file, group))
+       {
+               DMSG("ERROR: elm_layout_file_set return FALSE\n");
+               evas_object_del(layout);
+               return NULL;
+       }
+
+       evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+       elm_win_resize_object_add(win, layout);
+
+       evas_object_show(layout);
+       return layout;
+}
+
+static Eina_Bool keydown_cb(void *data, int type, void *event)
+{
+       AppData *ad = data;
+       Ecore_Event_Key *ev = event;
+       if (!strcmp(ev->keyname, KEY_END))
+               clipdrawer_lower_view(ad);
+
+       return ECORE_CALLBACK_PASS_ON;
+}
+
+ClipdrawerData* init_clipdrawer(AppData *ad)
+{
+       ClipdrawerData *cd = calloc(1, sizeof(ClipdrawerData));
+
+       /* create and setting window */
+       if (!cd)
+               return NULL;
+       if (!(cd->main_win = create_win(cd, APPNAME)))
+       {
+               free(cd);
+               return NULL;
+       }
+       cd->x_main_win = elm_win_xwindow_get(cd->main_win);
+       setting_win(ad->x_disp, cd->x_main_win);
+
+       /* edj setting */
+       if (!(cd->main_layout = _load_edj(cd->main_win, APP_EDJ_FILE, GRP_MAIN)))
+       {
+               evas_object_del(cd->main_win);
+               free(cd);
+               return NULL;
+       }
+
+       Evas_Object* ly = elm_layout_edje_get(cd->main_layout);
+       cd->height = atoi(edje_object_data_get(ly, "clipboard_height"));
+       cd->landscape_height = atoi(edje_object_data_get(ly, "clipboard_landscape_height"));
+       cd->grid_item_w = atoi(edje_object_data_get(ly, "grid_item_w"));
+       cd->grid_item_h = atoi(edje_object_data_get(ly, "grid_item_h"));
+       printf("height: %d , land_height:%d\n", cd->height, cd->landscape_height);
+
+       /* create and setting gengrid */
+       elm_theme_extension_add(NULL, APP_EDJ_FILE);
+       edje_object_signal_callback_add(elm_layout_edje_get(cd->main_layout),
+                       "mouse,up,1", "*", clipdrawer_ly_clicked, ad);
+
+       cd->gengrid = elm_gengrid_add(cd->main_win);
+       elm_object_part_content_set(cd->main_layout, "historyitems", cd->gengrid);
+       elm_gengrid_item_size_set(cd->gengrid, cd->grid_item_w, cd->grid_item_h);
+       elm_gengrid_align_set(cd->gengrid, 0.0, 0.0);
+       elm_gengrid_horizontal_set(cd->gengrid, EINA_TRUE);
+       elm_gengrid_bounce_set(cd->gengrid, EINA_TRUE, EINA_FALSE);
+       elm_gengrid_multi_select_set(cd->gengrid, EINA_FALSE);
+//     evas_object_smart_callback_add(cd->gengrid, "selected", _grid_click_paste, ad);
+       evas_object_size_hint_weight_set(cd->gengrid, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
+
+       elm_gengrid_clear(cd->gengrid);
+
+       cd->gic.item_style = "clipboard_photo_style";
+       cd->gic.func.text_get = NULL;
+       cd->gic.func.content_get = _grid_content_get;
+       cd->gic.func.state_get = NULL;
+       cd->gic.func.del = _grid_del;
+
+       evas_object_show(cd->gengrid);
+
+       ad->draw_item_add = clipdrawer_add_item;
+       ad->draw_item_del = clipdrawer_del_item;
+//     ad->x_main_win = cd->x_main_win;
+
+       cd->keydown_handler = ecore_event_handler_add(ECORE_EVENT_KEY_DOWN, keydown_cb, ad);
+       cd->evas = evas_object_evas_get(cd->main_win);
+
+       delete_mode = EINA_FALSE;
+
+       return cd;
+}
 
-       cpdata = elm_list_item_label_get(it);
-       if (cpdata == NULL)
+void depose_clipdrawer(ClipdrawerData *cd)
+{
+       evas_object_del(cd->main_win);
+       if (cd->anim_timer)
+               ecore_timer_del(cd->anim_timer);
+       if (cd->keydown_handler)
+               ecore_event_handler_del(cd->keydown_handler);
+       free(cd);
+}
+
+static Eina_Bool clipdrawer_add_item(AppData *ad, CNP_ITEM *item)
+{
+       ClipdrawerData *cd = ad->clipdrawer;
+       if (item->type_index == ATOM_INDEX_IMAGE)
+       {
+               Elm_Object_Item *gitem = elm_gengrid_first_item_get(cd->gengrid);
+               while (gitem)
+               {
+                       CNP_ITEM *gitem_data = elm_object_item_data_get(gitem);
+                       gitem = elm_gengrid_item_next_get(gitem);
+                       if ((gitem_data->type_index == item->type_index) && (!strcmp(item->data, gitem_data->data)))
+                       {
+                               DMSG("duplicated file path = %s\n", item->data);
+                               item_delete_by_CNP_ITEM(ad, gitem_data);
+                       }
+               }
+       }
+
+       item->gitem = elm_gengrid_item_prepend(cd->gengrid, &cd->gic, item, NULL, NULL);
+
+       return EINA_TRUE;
+}
+
+static Eina_Bool clipdrawer_del_item(AppData *ad, CNP_ITEM *item)
+{
+       if (item->gitem)
+               elm_object_item_del(item->gitem);
+       return EINA_TRUE;
+}
+
+static void _grid_del(void *data, Evas_Object *obj)
+{
+       CNP_ITEM *item = data;
+       item->gitem = NULL;
+       item->layout = NULL;
+}
+
+static Evas_Object *_grid_content_get(void *data, Evas_Object *obj, const char *part)
+{
+       CNP_ITEM *item = data;
+       AppData *ad = item->ad;
+       ClipdrawerData *cd = ad->clipdrawer;
+
+       if (item->type_index == ATOM_INDEX_IMAGE && !strcmp(part, "elm.swallow.icon")) /* text/uri */
+       {
+               int w, h, iw, ih;
+
+               Evas_Object *layout = elm_layout_add(obj);
+               elm_layout_theme_set(layout, "gengrid", "item", "clipboard_style");
+               edje_object_signal_callback_add(elm_layout_edje_get(layout),
+                               "mouse,up,1", "*", _grid_item_ly_clicked, data);
+
+
+               Evas_Object *sicon;
+               int grid_image_real_w;
+               int grid_image_real_h;
+               grid_image_real_w = cd->grid_item_w - (2*GRID_IMAGE_INNER);
+               grid_image_real_h = cd->grid_item_h - (2*GRID_IMAGE_INNER);
+               sicon = evas_object_image_add(evas_object_evas_get(obj));
+               evas_object_image_load_size_set(sicon, grid_image_real_w, grid_image_real_h);
+               evas_object_image_file_set(sicon, item->data, NULL);
+               evas_object_image_size_get(sicon, &w, &h);
+
+               if (w > grid_image_real_w || h > grid_image_real_h)
+               {
+                       if (w >= h)
+                       {
+                               iw = grid_image_real_w;
+                               ih = (float)grid_image_real_w / w * h;
+                       }
+                       else
+                       {
+                               iw = (float)grid_image_real_h / h * w;
+                               ih = grid_image_real_h;
+                       }
+               }
+               else
+               {
+                       iw = w;
+                       ih = h;
+               }
+
+               evas_object_image_fill_set(sicon, 0, 0, iw, ih);
+               evas_object_resize(sicon, iw, ih);
+               evas_object_size_hint_min_set(sicon, iw, ih);
+               elm_object_part_content_set(layout, "elm.swallow.icon", sicon);
+
+               if (cd->paste_text_only)
+                       edje_object_signal_emit(elm_layout_edje_get(layout), "elm,state,show,dim", "elm");
+               else
+                       edje_object_signal_emit(elm_layout_edje_get(layout), "elm,state,hide,dim", "elm");
+
+               item->layout = layout;
+       }
+       else if (item->type_index != ATOM_INDEX_IMAGE && !strcmp(part, "elm.swallow.entry")) /* text/uri */
+       {
+               Evas_Object *layout = elm_layout_add(obj);
+               elm_layout_theme_set(layout, "gengrid", "widestyle", "horizontal_layout");
+               edje_object_signal_callback_add(elm_layout_edje_get(layout), 
+                               "mouse,up,1", "*", _grid_item_ly_clicked, data);
+               Evas_Object *rect = evas_object_rectangle_add(evas_object_evas_get(obj));
+               evas_object_resize(rect, cd->grid_item_w, cd->grid_item_h);
+               evas_object_color_set(rect, 237, 233, 208, 255);
+               evas_object_show(rect);
+               elm_object_part_content_set(layout, "elm.swallow.icon", rect);
+
+               Evas_Object *ientry = elm_entry_add(obj);
+               evas_object_size_hint_weight_set(ientry, 0, 0);
+               elm_entry_scrollable_set(ientry, EINA_TRUE);
+
+               char *entry_text = string_for_entry_get(ad, item->type_index, item->data);
+               if (entry_text)
+               {
+                       elm_object_part_text_set(ientry, NULL, entry_text);
+                       free(entry_text);
+               }
+               else
+               {
+                       elm_object_part_text_set(ientry, NULL, item->data);
+               }
+               elm_entry_editable_set(ientry, EINA_FALSE);
+               elm_entry_context_menu_disabled_set(ientry, EINA_TRUE);
+               evas_object_show(ientry);
+               elm_object_part_content_set(layout, "elm.swallow.inner", ientry);
+
+               item->layout = layout;
+       }
+       else
+               return NULL;
+
+       if (delete_mode)
+               edje_object_signal_emit(elm_layout_edje_get(item->layout), "elm,state,show,delbtn", "elm");
+       else
+               edje_object_signal_emit(elm_layout_edje_get(item->layout), "elm,state,hide,delbtn", "elm");
+
+       return item->layout;
+}
+
+static void clipdrawer_ly_clicked(void *data, Evas_Object *obj, const char *emission, const char *source)
+{
+       AppData *ad = data;
+
+       if (ad->clipdrawer->anim_status != STATUS_NONE)
                return;
-       clen = strlen(cpdata);
-       p = malloc(clen + 1);
-       snprintf(p, clen, "%s", cpdata);
-       fprintf(stderr, "## cbhm : sel : %s\n", p);
-       elm_selection_set(1, obj, /*mark up*/1, p);
+
+#define EDJE_CLOSE_PART_PREFIX "background/title/close"
+#define EDJE_DELETE_MODE_PREFIX "background/title/delete"
+       if (!strncmp(source, EDJE_CLOSE_PART_PREFIX, strlen(EDJE_CLOSE_PART_PREFIX)))
+       {
+               clipdrawer_lower_view(ad);
+       }
+       else if (!strncmp(source, EDJE_DELETE_MODE_PREFIX, strlen(EDJE_DELETE_MODE_PREFIX)))
+       {
+               _delete_mode_set(ad, !delete_mode);
+       }
+
 }
 
-int clipdrawer_update_contents(void *data)
+static void _grid_item_ly_clicked(void *data, Evas_Object *obj, const char *emission, const char *source)
 {
-       struct appdata *ad = data;
-       int i, pos;
+       CNP_ITEM *item = data;
+       AppData *ad = item->ad;
+       ClipdrawerData *cd = ad->clipdrawer;
+
+       if (cd->anim_status != STATUS_NONE)
+               return;
+
+       Elm_Object_Item *sgobj = NULL;
+       sgobj = elm_gengrid_selected_item_get(cd->gengrid);
+       item = elm_object_item_data_get(sgobj);
+
+       if (!sgobj || !item)
+       {
+               DTRACE("ERR: cbhm can't get the selected item\n");
+               return;
+       }
+
+       #define EDJE_DELBTN_PART_PREFIX "delbtn"
+       if (strncmp(source, EDJE_DELBTN_PART_PREFIX, strlen(EDJE_DELBTN_PART_PREFIX)))
+       {
+               elm_gengrid_item_selected_set(sgobj, EINA_FALSE);
+
+               if (delete_mode)
+                       return;
 
-       elm_list_clear(ad->txtlist);
-       for (i = 0; i < HISTORY_QUEUE_NUMBER; i++)
+               if (item->type_index != ATOM_INDEX_IMAGE || !cd->paste_text_only)
+               {
+                       set_selection_owner(ad, ECORE_X_SELECTION_SECONDARY, item);
+               }
+       }
+       else
        {
-               pos = get_current_history_position()+i;
-               if (pos > HISTORY_QUEUE_NUMBER-1)
-                       pos = pos-HISTORY_QUEUE_NUMBER;
-               if (get_item_contents_by_pos(pos) != NULL)
-                       elm_list_item_append(ad->txtlist, get_item_contents_by_pos(pos), NULL, NULL, NULL, ad);
+               elm_gengrid_item_selected_set(sgobj, EINA_FALSE);
+
+               item_delete_by_CNP_ITEM(ad, item);
        }
-       elm_list_go(ad->txtlist);
+}
+
+void set_transient_for(Ecore_X_Window x_main_win, Ecore_X_Window x_active_win)
+{
+       ecore_x_icccm_transient_for_set(x_main_win, x_active_win);
+       ecore_x_event_mask_set(x_active_win,
+                               ECORE_X_EVENT_MASK_WINDOW_PROPERTY | ECORE_X_EVENT_MASK_WINDOW_CONFIGURE);
+}
 
-       return 0;
+void unset_transient_for(Ecore_X_Window x_main_win, Ecore_X_Window x_active_win)
+{
+       ecore_x_event_mask_unset(x_active_win,
+                       ECORE_X_EVENT_MASK_WINDOW_PROPERTY | ECORE_X_EVENT_MASK_WINDOW_CONFIGURE);
+       ecore_x_icccm_transient_for_unset(x_main_win);
 }
 
-static int clipdrawer_init(void *data)
+static void set_focus_for_app_window(Ecore_X_Window x_main_win, Eina_Bool enable)
 {
-       struct appdata *ad = data;
+       CALLED();
+       Eina_Bool accepts_focus;
+       Ecore_X_Window_State_Hint initial_state;
+       Ecore_X_Pixmap icon_pixmap;
+       Ecore_X_Pixmap icon_mask;
+       Ecore_X_Window icon_window;
+       Ecore_X_Window window_group;
+       Eina_Bool is_urgent;
 
-       evas_object_resize(ad->win_main, 480, 400);
-       evas_object_move(ad->win_main, 0, 400);
-       evas_object_resize(ad->ly_main, 480, 400);
-       evas_object_move(ad->ly_main, 0, 400);
+       ecore_x_icccm_hints_get (x_main_win,
+                       &accepts_focus, &initial_state, &icon_pixmap, &icon_mask, &icon_window, &window_group, &is_urgent);
+       ecore_x_icccm_hints_set (x_main_win,
+                       enable, initial_state, icon_pixmap, icon_mask, icon_window, window_group, is_urgent);
+       DMSG("set focus mode = %d\n", enable);
+}
 
-       ad->scrl = elm_scroller_add(ad->win_main);
-       edje_object_part_swallow(_EDJ(ad->ly_main), "cbhmdrawer/imglist", ad->scrl);
-       evas_object_size_hint_weight_set(ad->scrl, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
-       elm_scroller_bounce_set(ad->scrl, EINA_TRUE, EINA_FALSE);
-       elm_scroller_policy_set(ad->scrl, ELM_SCROLLER_POLICY_AUTO, ELM_SCROLLER_POLICY_OFF);
-       elm_win_resize_object_add(ad->win_main, ad->scrl);
-       evas_object_show(ad->scrl);
+void setting_win(Ecore_X_Display *x_disp, Ecore_X_Window x_main_win)
+{
+       CALLED();
+       // disable window effect
+       utilx_set_window_effect_state(x_disp, x_main_win, 0);
 
-       evas_object_resize(ad->scrl,480,95);
-       ad->imgbox = elm_box_add(ad->win_main);
-       elm_box_horizontal_set(ad->imgbox, TRUE);
-       evas_object_size_hint_weight_set(ad->imgbox, EVAS_HINT_EXPAND, 0);
-       evas_object_size_hint_align_set(ad->imgbox, EVAS_HINT_FILL, EVAS_HINT_FILL);
-       elm_scroller_content_set(ad->scrl, ad->imgbox);
-       evas_object_show(ad->imgbox);
+       ecore_x_icccm_name_class_set(x_main_win, "NORMAL_WINDOW", "NORMAL_WINDOW");
+
+       set_focus_for_app_window(x_main_win, EINA_FALSE);
+
+}
 
-       Evas_Object *pt;
-       int i;
-       for (i = 0 ; i < N_IMAGES ; i ++)
+Evas_Object *create_win(ClipdrawerData *cd, const char *name)
+{
+       CALLED();
+
+       Evas_Object *win = elm_win_add(NULL, name, ELM_WIN_BASIC);
+       if (!win)
        {
-               pt = elm_photo_add(ad->win_main);
-               elm_photo_file_set(pt, images[i]);
-               evas_object_size_hint_weight_set(pt, EVAS_HINT_EXPAND,
-                               EVAS_HINT_EXPAND);
-               evas_object_size_hint_align_set(pt, EVAS_HINT_FILL,
-                               EVAS_HINT_FILL);
-               elm_photo_size_set(pt, 145);
-               elm_box_pack_end(ad->imgbox, pt);
-               evas_object_show(pt);
-               evas_object_data_set(pt,"URI",images[i]);
+               DMSG("ERROR: elm_win_add return NULL\n");
+               return NULL;
        }
+       elm_win_title_set(win, name);
+       elm_win_borderless_set(win, EINA_TRUE);
+       ecore_x_window_size_get(ecore_x_window_root_first_get(), &cd->root_w, &cd->root_h);
+       DMSG("root_w: %d, root_h: %d\n", cd->root_w, cd->root_h);
+       evas_object_resize(win, cd->root_w, cd->root_h);
 
-       ad->txtlist = elm_list_add(ad->win_main);
-       elm_layout_content_set(ad->ly_main, "cbhmdrawer/txtlist", ad->txtlist);
-       elm_list_horizontal_mode_set(ad->txtlist, ELM_LIST_COMPRESS);
-       evas_object_smart_callback_add(ad->txtlist, "selected", _list_click, ad);
-       elm_list_item_append(ad->txtlist, "default", NULL, NULL, NULL, ad);
+       elm_config_scale_set((double)cd->root_w/DEFAULT_WIDTH);
+       return win;
+}
 
-       elm_list_go(ad->txtlist);
+static void set_sliding_win_geometry(ClipdrawerData *cd)
+{
+       CALLED();
+       Ecore_X_Window zone;
+       Evas_Coord x, y, w, h;
+       zone = ecore_x_e_illume_zone_get(cd->x_main_win);
+       DTRACE(" zone:%x\n", zone);
 
-       if (get_item_counts() != 0)
-               clipdrawer_update_contents(ad);
+       if (cd->o_degree == 90 || cd->o_degree == 270)
+       {
+               h = cd->anim_count * cd->landscape_height / ANIM_DURATION;
+               x = 0;
+               y = cd->root_w - h;
+               w = cd->root_h;
+       }
+       else
+       {
+               h = cd->anim_count * cd->height / ANIM_DURATION;
+               x = 0;
+               y = cd->root_h - h;
+               w = cd->root_w;
+       }
+
+       if (!h)
+               w = 0;
 
-       return 0;
+       DTRACE("[CBHM] change degree geometry... (%d, %d, %d x %d)\n", x, y, w, h);
+       int clipboard_state;
+       if (cd->anim_count)
+               clipboard_state = ECORE_X_ILLUME_CLIPBOARD_STATE_ON;
+       else
+               clipboard_state = ECORE_X_ILLUME_CLIPBOARD_STATE_OFF;
+       if (cd->anim_status != HIDE_ANIM)
+          ecore_x_e_illume_clipboard_geometry_set(zone, x, y, w, h);
+       ecore_x_e_illume_clipboard_state_set(zone, clipboard_state);
 }
 
-int clipdrawer_create_view(void *data)
+void set_rotation_to_clipdrawer(ClipdrawerData *cd)
 {
-       struct appdata *ad = data;
+       CALLED();
+       int angle = cd->o_degree;
+       int x, y, w, h;
 
-       clipdrawer_init(ad);
+       if (angle == 180) // reverse
+       {
+               h = cd->height;
+               x = 0;
+               y = 0;
+               w = cd->root_w;
+       }
+       else if (angle == 90) // right rotate
+       {
+               h = cd->landscape_height;
+               x = cd->root_w - h;
+               y = 0;
+               w = cd->root_h;
+       }
+       else if (angle == 270) // left rotate
+       {
+               h = cd->landscape_height;
+               x = 0;
+               y = 0;
+               w = cd->root_h;
+       }
+       else // angle == 0
+       {
+               h = cd->height;
+               x = 0;
+               y = cd->root_h - h;
+               w = cd->root_w;
+       }
+
+       evas_object_resize(cd->main_win, w, h);
+       evas_object_move(cd->main_win, x, y);
+       if (cd->anim_count == ANIM_DURATION)
+               set_sliding_win_geometry(cd);
+}
+
+static Eina_Bool _get_anim_pos(ClipdrawerData *cd, int *sp, int *ep)
+{
+       if (!sp || !ep)
+               return EINA_FALSE;
+
+       int angle = cd->o_degree;
+       int anim_start, anim_end;
+
+       if (angle == 180) // reverse
+       {
+               anim_start = -(cd->root_h - cd->height);
+               anim_end = 0;
+       }
+       else if (angle == 90) // right rotate
+       {
+               anim_start = cd->root_w;
+               anim_end = anim_start - cd->landscape_height;
+       }
+       else if (angle == 270) // left rotate
+       {
+               anim_start = -(cd->root_w - cd->landscape_height);
+               anim_end = 0;
+       }
+       else // angle == 0
+       {
+               anim_start = cd->root_h;
+               anim_end = anim_start - cd->height;
+       }
 
-       return 0;
+       *sp = anim_start;
+       *ep = anim_end;
+       return EINA_TRUE;
 }
 
-void clipdrawer_activate_view(void *data)
+static Eina_Bool _do_anim_delta_pos(ClipdrawerData *cd, int sp, int ep, int ac, int *dp)
 {
-       struct appdata *ad = data;
+       if (!dp)
+               return EINA_FALSE;
+
+       int angle = cd->o_degree;
+       int delta;
+       double posprop;
+       posprop = 1.0*ac/ANIM_DURATION;
+
+       if (angle == 180) // reverse
+       {
+               delta = (int)((ep-sp)*posprop);
+               evas_object_move(cd->main_win, 0, sp+delta);
+       }
+       else if (angle == 90) // right rotate
+       {
+               delta = (int)((ep-sp)*posprop);
+               evas_object_move(cd->main_win, sp+delta, 0);
+       }
+       else if (angle == 270) // left rotate
+       {
+               delta = (int)((ep-sp)*posprop);
+               evas_object_move(cd->main_win, sp+delta, 0);
+       }
+       else // angle == 0
+       {
+               delta = (int)((sp-ep)*posprop);
+               evas_object_move(cd->main_win, 0, sp-delta);
+       }
        
-       if (ad->win_main)
-               elm_win_activate(ad->win_main);
+       *dp = delta;
+
+       return EINA_TRUE;
+}
+
+static void stop_animation(AppData *ad)
+{
+       CALLED();
+       ClipdrawerData *cd = ad->clipdrawer;
+       cd->anim_status = STATUS_NONE;
+       if (cd->anim_timer)
+       {
+               ecore_timer_del(cd->anim_timer);
+               cd->anim_timer = NULL;
+       }
+
+       set_sliding_win_geometry(cd);
+}
+
+static Eina_Bool anim_pos_calc_cb(void *data)
+{
+       AppData *ad = data;
+       ClipdrawerData *cd = ad->clipdrawer;
+       int anim_start, anim_end, delta;
+
+       _get_anim_pos(cd, &anim_start, &anim_end);
+
+       if (cd->anim_status == SHOW_ANIM)
+       {
+               if (cd->anim_count > ANIM_DURATION)
+               {
+                       cd->anim_count = ANIM_DURATION;
+                       stop_animation(ad);
+                       return EINA_FALSE;
+               }
+               _do_anim_delta_pos(cd, anim_start, anim_end, cd->anim_count, &delta);
+               if (cd->anim_count == 1)
+                       evas_object_show(cd->main_win);
+               cd->anim_count++;
+       }
+       else if (cd->anim_status == HIDE_ANIM)
+       {
+               if (cd->anim_count < 0)
+               {
+                       cd->anim_count = 0;
+                       evas_object_hide(cd->main_win);
+                       elm_win_lower(cd->main_win);
+                       unset_transient_for(cd->x_main_win, ad->x_active_win);
+                       stop_animation(ad);
+                       _delete_mode_set(ad, EINA_FALSE);
+                       return EINA_FALSE;
+               }
+               _do_anim_delta_pos(cd, anim_start, anim_end, cd->anim_count, &delta);
+               cd->anim_count--;
+       }
+       else
+       {
+               stop_animation(ad);
+               return EINA_FALSE;
+       }
+
+       return EINA_TRUE;
+}
+
+static Eina_Bool clipdrawer_anim_effect(AppData *ad, AnimStatus atype)
+{
+       CALLED();
+       ClipdrawerData *cd = ad->clipdrawer;
+       if (atype == cd->anim_status)
+       {
+               DTRACE("Warning: Animation effect is already in progress. \n");
+               return EINA_FALSE;
+       }
+
+       cd->anim_status = atype;
+
+       if (cd->anim_timer)
+               ecore_timer_del(cd->anim_timer);
+       cd->anim_timer = ecore_timer_add(ANIM_FLOPS, anim_pos_calc_cb, ad);
+
+       return EINA_TRUE;
+}
+
+void clipdrawer_activate_view(AppData* ad)
+{
+       CALLED();
+       ClipdrawerData *cd = ad->clipdrawer;
+
+       elm_object_part_text_set(cd->main_layout, "panel_title", S_CLIPBOARD);
+       elm_object_part_text_set(cd->main_layout, "panel_function", S_DELETE);
+
+       if (cd->main_win)
+       {
+               set_focus_for_app_window(cd->x_main_win, EINA_TRUE);
+               set_transient_for(cd->x_main_win, ad->x_active_win);
+               cd->o_degree = get_active_window_degree(ad->x_active_win);
+               elm_win_rotation_set(cd->main_win, cd->o_degree);
+               set_rotation_to_clipdrawer(cd);
+               evas_object_show(cd->main_win);
+               elm_win_activate(cd->main_win);
+               clipdrawer_anim_effect(ad, SHOW_ANIM);
+       }
+}
+
+void clipdrawer_lower_view(AppData* ad)
+{
+       CALLED();
+       ClipdrawerData *cd = ad->clipdrawer;
+       Ecore_X_Window zone;
+       if (cd->main_win && cd->anim_count)
+       {
+               set_focus_for_app_window(cd->x_main_win, EINA_FALSE);
+       //      if (clipdrawer_anim_effect(ad, HIDE_ANIM))
+       //              ad->windowshow = EINA_FALSE;
+          zone = ecore_x_e_illume_zone_get(cd->x_main_win);
+          ecore_x_e_illume_clipboard_geometry_set(zone, 0, 0, 0, 0);
+               clipdrawer_anim_effect(ad, HIDE_ANIM);
+               cbhm_send_event(ad, ad->x_active_win, "INIT_CNPDATA");
+       }
+}
+
+void _delete_mode_set(AppData* ad, Eina_Bool del_mode)
+{
+       ClipdrawerData *cd = ad->clipdrawer;
+       CNP_ITEM *item = NULL;
+
+       delete_mode = del_mode;
+       if (del_mode)
+       {
+               elm_object_part_text_set(cd->main_layout, "panel_function", S_DONE);
+       }
+       else
+       {
+               elm_object_part_text_set(cd->main_layout, "panel_function", S_DELETE);
+       }
+
+       Elm_Object_Item *gitem = elm_gengrid_first_item_get(cd->gengrid);
+       while (gitem)
+       {
+               item = elm_object_item_data_get(gitem);
+               if (del_mode)
+                       edje_object_signal_emit(elm_layout_edje_get(item->layout), "elm,state,show,delbtn", "elm");
+               else
+                       edje_object_signal_emit(elm_layout_edje_get(item->layout), "elm,state,hide,delbtn", "elm");
+
+               gitem = elm_gengrid_item_next_get(gitem);
+       }
 }
index efd0e0c..2add6c5 100644 (file)
@@ -1,9 +1,71 @@
-#ifndef _clipdrawer_h_
-#define _clipdrawer_h_
+/*
+ * cbhm
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
-static int clipdrawer_init();
-int clipdrawer_update_contents(void *data);
-int clipdrawer_create_view();
-void clipdrawer_activate_view();
 
-#endif // _clipdrawer_h_
+
+#ifndef _CLIPDRAWER_H_
+#define _CLIPDRAWER_H_
+
+#include <Ecore_X.h>
+#include <Elementary.h>
+
+typedef enum _AnimStatus AnimStatus;
+enum _AnimStatus {
+       STATUS_NONE = 0,
+       SHOW_ANIM,
+       HIDE_ANIM
+};
+
+struct _ClipdrawerData {
+       Evas_Object *main_win;
+       Ecore_X_Window x_main_win;
+       Evas_Object *gengrid;
+       Evas_Object *main_layout;
+       Elm_Gengrid_Item_Class gic;
+       Evas_Object *popup;
+
+       int o_degree;
+
+       int root_w;
+       int root_h;
+
+       int height;
+       int landscape_height;
+       int grid_item_w;
+       int grid_item_h;
+
+       Ecore_Event_Handler *keydown_handler;
+       Evas *evas;
+
+       Ecore_Timer *anim_timer;
+       AnimStatus anim_status;
+       int anim_count;
+       Eina_Bool paste_text_only:1;
+};
+
+#include "cbhm.h"
+
+Eina_Bool delete_mode;
+
+void set_rotation_to_clipdrawer(ClipdrawerData *ad);
+void clipdrawer_activate_view(AppData* ad);
+void clipdrawer_lower_view(AppData* ad);
+ClipdrawerData *init_clipdrawer(AppData *ad);
+void depose_clipdrawer(ClipdrawerData *cd);
+void _delete_mode_set(AppData *ad, Eina_Bool del_mode);
+
+#endif // _CLIPDRAWER_H_
diff --git a/src/item_manager.c b/src/item_manager.c
new file mode 100644 (file)
index 0000000..cdccd3e
--- /dev/null
@@ -0,0 +1,194 @@
+/*
+ * cbhm
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include "item_manager.h"
+
+static void item_free(CNP_ITEM *item)
+{
+       CALLED();
+       if (!item)
+       {
+               DMSG("WRONG PARAMETER in %s\n", __func__);
+               return;
+       }
+       // remove gengrid
+       if (item->ad)
+       {
+               if (item->ad->draw_item_del)
+                       item->ad->draw_item_del(item->ad, item);
+               if (item->ad->storage_item_del)
+                       item->ad->storage_item_del(item->ad, item);
+       }
+       if (item->data)
+               FREE(item->data);
+
+       if (item->ad)
+       {
+               if (item->ad->clip_selected_item == item)
+               item->ad->clip_selected_item = NULL;
+       }
+       FREE(item);
+}
+
+CNP_ITEM *item_add_by_CNP_ITEM(AppData *ad, CNP_ITEM *item)
+{
+       if (!ad || !item)
+       {
+               DMSG("WRONG PARAMETER in %s, ad: 0x%x, item: 0x%x\n", __func__, ad, item);
+               return NULL;
+       }
+       item->ad = ad;
+
+       ad->item_list = eina_list_prepend(ad->item_list, item);
+       if (ad && ad->draw_item_add)
+               ad->draw_item_add(ad, item);
+       if (ad && ad->storage_item_add)
+               ad->storage_item_add(ad, item);
+
+       while (ITEM_CNT_MAX < eina_list_count(ad->item_list))
+       {
+               CNP_ITEM *ditem = eina_list_nth(ad->item_list, ITEM_CNT_MAX);
+
+               ad->item_list = eina_list_remove(ad->item_list, ditem);
+               item_free(ditem);
+       }
+
+       slot_property_set(ad, -1);
+       slot_item_count_set(ad);
+
+       return item;
+}
+
+CNP_ITEM *item_add_by_data(AppData *ad, Ecore_X_Atom type, void *data, int len)
+{
+       if (!ad || !data)
+       {
+               DMSG("WRONG PARAMETER in %s\n", __func__);
+               return NULL;
+       }
+       CNP_ITEM *item;
+       item = CALLOC(1, sizeof(CNP_ITEM));
+       if (!item)
+               return NULL;
+       item->type_index = atom_type_index_get(ad, type);
+       item->data = data;
+       item->len = len;
+
+       item = item_add_by_CNP_ITEM(ad, item);
+       return item;
+}
+
+CNP_ITEM *item_get_by_index(AppData *ad, int index)
+{
+       if (!ad || eina_list_count(ad->item_list) <= index || 0 > index)
+       {
+               DMSG("WRONG PARAMETER in %s\n", __func__);
+               return NULL;
+       }
+       CNP_ITEM *item;
+       item = eina_list_nth(ad->item_list, index);
+       return item;
+}
+
+CNP_ITEM *item_get_by_data(AppData *ad, void *data)
+{
+       if (!ad || !data)
+       {
+               DMSG("WRONG PARAMETER in %s\n", __func__);
+               return NULL;
+       }
+       CNP_ITEM *item;
+       Eina_List *l;
+       EINA_LIST_FOREACH(ad->item_list, l, item)
+       {
+               if (item && item->data == data)
+               {
+                       return item;
+               }
+       }
+       return NULL;
+}
+
+CNP_ITEM *item_get_last(AppData *ad)
+{
+       if (!ad)
+       {
+               DMSG("WRONG PARAMETER in %s\n", __func__);
+               return NULL;
+       }
+       return eina_list_data_get(ad->item_list);
+}
+
+void item_delete_by_CNP_ITEM(AppData *ad, CNP_ITEM *item)
+{
+       CALLED();
+       if (!ad || !item)
+       {
+               DMSG("WRONG PARAMETER in %s\n", __func__);
+               return;
+       }
+       DMSG("item: 0x%x, item->gitem: 0x%x\n", item, item->gitem);
+       ad->item_list = eina_list_remove(ad->item_list, item);
+       item_free(item);
+       slot_property_set(ad, -1);
+       slot_item_count_set(ad);
+}
+
+void item_delete_by_data(AppData *ad, void *data)
+{
+       CALLED();
+       if (!ad || !data)
+       {
+               DMSG("WRONG PARAMETER in %s\n", __func__);
+               return;
+       }
+       CNP_ITEM *item;
+       item = item_get_by_data(ad, data);
+       item_delete_by_CNP_ITEM(ad, item);
+}
+
+void item_delete_by_index(AppData *ad, int index)
+{
+       CALLED();
+       if (!ad || eina_list_count(ad->item_list) <= index || 0 > index)
+       {
+               DMSG("WRONG PARAMETER in %s\n", __func__);
+               return;
+       }
+       CNP_ITEM *item;
+       item = item_get_by_index(ad, index);
+       item_delete_by_CNP_ITEM(ad, item);
+}
+
+void item_clear_all(AppData *ad)
+{
+       CALLED();
+       while(ad->item_list)
+       {
+               CNP_ITEM *item = eina_list_data_get(ad->item_list);
+               ad->item_list = eina_list_remove(ad->item_list, item);
+               if (item)
+                       item_free(item);
+       }
+}
+
+int item_count_get(AppData *ad)
+{
+       return eina_list_count(ad->item_list);
+}
diff --git a/src/item_manager.h b/src/item_manager.h
new file mode 100644 (file)
index 0000000..66b3dcd
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * cbhm
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#ifndef _ITEM_MANAGER_H_
+#define _ITEM_MANAGER_H_
+
+#include "cbhm.h"
+
+struct _CNP_ITEM {
+       int type_index;
+       void *data;
+       size_t len;
+
+       Elm_Object_Item *gitem;
+       Evas_Object *layout;
+       AppData *ad;
+};
+
+CNP_ITEM *item_add_by_CNP_ITEM(AppData *ad, CNP_ITEM *item);
+CNP_ITEM *item_add_by_data(AppData *ad, Ecore_X_Atom type, void *data, int len);
+
+CNP_ITEM *item_get_by_index(AppData *ad, int index);
+CNP_ITEM *item_get_by_data(AppData *ad, void *data);
+CNP_ITEM *item_get_last(AppData *ad);
+
+void item_delete_by_CNP_ITEM(AppData *ad, CNP_ITEM *item);
+void item_delete_by_data(AppData *ad, void *data);
+void item_delete_by_index(AppData *ad, int index);
+void item_clear_all(AppData *ad);
+int item_count_get(AppData *ad);
+
+#endif /*_ITEM_MANAGER_H_*/
+
diff --git a/src/main.c b/src/main.c
new file mode 100644 (file)
index 0000000..c7d2f7c
--- /dev/null
@@ -0,0 +1,175 @@
+/*
+ * cbhm
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include <appcore-efl.h>
+#include <Ecore_X.h>
+#include <X11/Xlib.h>
+#include <X11/Xatom.h>
+#include <X11/extensions/XInput.h>
+#include <X11/extensions/XInput2.h>
+#include <X11/extensions/XI2.h>
+#include <X11/extensions/XIproto.h>
+
+#include "cbhm.h"
+
+#define CLIPBOARD_MANAGER_WINDOW_TITLE_STRING "X11_CLIPBOARD_HISTORY_MANAGER"
+#define ATOM_CLIPBOARD_MANAGER_NAME "CLIPBOARD_MANAGER"
+
+static AppData *g_main_ad = NULL;
+
+void *d_malloc(char *func, int line, size_t size)
+{
+       char *m = malloc(size);
+       printf("in %s, %d: 0x%x = malloc(%d)\n", func, line, m, size);
+       return m;
+}
+void *d_calloc(char *func, int line, size_t n, size_t size)
+{
+       char *m = calloc(n, size);
+       printf("in %s, %d: 0x%x = calloc(%d)\n", func, line, m, size);
+       return m;
+}
+void d_free(char *func, int line, void *m)
+{
+       printf("in %s, %d: free(0x%x)\n", func, line, m);
+       free(m);
+}
+
+static Eina_Bool setClipboardManager(AppData *ad)
+{
+       ad->x_disp = ecore_x_display_get();
+       DMSG("x_disp: 0x%x\n", ad->x_disp);
+       if (ad->x_disp)
+       {
+               Ecore_X_Atom clipboard_manager_atom = XInternAtom(ad->x_disp, ATOM_CLIPBOARD_MANAGER_NAME, False);
+               Ecore_X_Window clipboard_manager = XGetSelectionOwner(ad->x_disp, clipboard_manager_atom);
+               DMSG("clipboard_manager_window: 0x%x\n");
+               if (!clipboard_manager)
+               {
+                       ad->x_root_win = DefaultRootWindow(ad->x_disp);
+                       if (ad->x_root_win)
+                       {
+                               ad->x_event_win = ecore_x_window_new(ad->x_root_win, 0, 0, 19, 19);
+                               DMSG("x_event_win: 0x%x\n", ad->x_event_win);
+                               if (ad->x_event_win)
+                               {
+                                       XSetSelectionOwner(ad->x_disp, clipboard_manager_atom, ad->x_event_win, CurrentTime);
+                                       Ecore_X_Window clipboard_manager = XGetSelectionOwner(ad->x_disp, clipboard_manager_atom);
+                                       DMSG("clipboard_manager: 0x%x\n", clipboard_manager);
+                                       if (ad->x_event_win == clipboard_manager)
+                                       {
+                                               return EINA_TRUE;
+                                       }
+                               }
+                       }
+               }
+       }
+       return EINA_FALSE;
+}
+
+static void set_x_window(Ecore_X_Window x_event_win, Ecore_X_Window x_root_win)
+{
+       ecore_x_netwm_name_set(x_event_win, CLIPBOARD_MANAGER_WINDOW_TITLE_STRING);
+       ecore_x_event_mask_set(x_event_win,
+                       ECORE_X_EVENT_MASK_WINDOW_PROPERTY);
+       ecore_x_event_mask_set(x_root_win,
+                       ECORE_X_EVENT_MASK_WINDOW_CONFIGURE);
+       ecore_x_window_prop_property_set(
+                       x_root_win, ecore_x_atom_get("CBHM_XWIN"),
+                       XA_WINDOW, 32, &x_event_win, 1);
+       ecore_x_flush();
+}
+
+static int app_create(void *data)
+{
+       AppData *ad = data;
+
+       if (!setClipboardManager(ad))
+       {
+               DMSG("Clipboard Manager set failed\n");
+               return EXIT_FAILURE;
+       }
+
+       set_x_window(ad->x_event_win, ad->x_root_win);
+
+       if (!ecore_init()) return EXIT_FAILURE;
+       if (!ecore_evas_init()) return EXIT_FAILURE;
+       if (!edje_init()) return EXIT_FAILURE;
+       ad->magic = CBHM_MAGIC;
+       init_target_atoms(ad);
+       if (!(ad->clipdrawer = init_clipdrawer(ad))) return EXIT_FAILURE;
+       if (!(ad->xhandler = init_xhandler(ad))) return EXIT_FAILURE;
+       if (!(ad->storage = init_storage(ad))) return EXIT_FAILURE;
+       slot_item_count_set(ad);
+
+       set_selection_owner(ad, ECORE_X_SELECTION_CLIPBOARD, NULL);
+       return 0;
+}
+
+static int app_terminate(void *data)
+{
+       AppData *ad = data;
+
+       depose_clipdrawer(ad->clipdrawer);
+       depose_xhandler(ad->xhandler);
+       depose_storage(ad->storage);
+       item_clear_all(ad);
+       depose_target_atoms(ad);
+       FREE(ad);
+
+       return 0;
+}
+
+static int app_pause(void *data)
+{
+       AppData *ad = data;
+       return 0;
+}
+
+static int app_resume(void *data)
+{
+       AppData *ad = data;
+       return 0;
+}
+
+static int app_reset(bundle *b, void *data)
+{
+       AppData *ad = data;
+
+       return 0;
+}
+
+int main(int argc, char *argv[])
+{
+       AppData *ad;
+       struct appcore_ops ops = {
+               .create = app_create,
+               .terminate = app_terminate,
+               .pause = app_pause,
+               .resume = app_resume,
+               .reset = app_reset,
+       };
+       ad = CALLOC(1, sizeof(AppData));
+       ops.data = ad;
+       g_main_ad = ad;
+
+       appcore_set_i18n(PACKAGE, LOCALEDIR);
+
+       return appcore_efl_main(PACKAGE, &argc, &argv, &ops);
+}
index 014fb90..518af63 100644 (file)
-#include "common.h"
-#include "storage.h"
+/*
+ * cbhm
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
 
-#define STORAGE_FILEPATH "/tmp/.savecbh"
-#define STORAGE_MAX_ITEMS HISTORY_QUEUE_NUMBER
-#define HEADER_ITEM_SIZE (sizeof(int)) 
-#define BODY_ITEM_SIZE (4 * 1024) // 4Kilo 
-#define STORAGE_HEADER_SIZE (STORAGE_MAX_ITEMS * HEADER_ITEM_SIZE)
-#define STORAGE_BODY_SIZE (STORAGE_MAX_ITEMS * BODY_ITEM_SIZE) 
-#define TOTAL_STORAGE_SIZE (STORAGE_HEADER_SIZE+STORAGE_BODY_SIZE)
 
-#define GET_ITEM_ADDR_BY_POSITION(map, pos) (map+STORAGE_HEADER_SIZE+pos*BODY_ITEM_SIZE)
 
-static int g_storage_fd = 0;
-static unsigned int g_storage_serial_number = 0;
-static char *g_map = NULL;
+#include <Ecore_File.h>
 
-int init_storage()
-{
-       int i;
-       int result = 0;
+#include "storage.h"
+#define STORAGE_FILEPATH "/opt/var/.savecbh"
+#define STORAGE_KEY_INDEX "index"
+#define STORAGE_KEY_FORMAT "data%02d"
+#define STORAGE_INDEX_ITEM_NONE 0.0
 
-       if (g_storage_fd != 0)
-               return 1;
+static void storage_item_index_wrote(StorageData *sd);
+static Eina_Bool item_write(Eet_File *ef, int index, CNP_ITEM *item);
+static void storage_rewrite_all_items(StorageData *sd);
+static Eina_Bool storage_index_write(StorageData *sd);
+static Eina_Bool storage_item_write(AppData *ad, CNP_ITEM *item);
+static Eina_Bool storage_item_delete(AppData *ad, CNP_ITEM *item);
+static CNP_ITEM *storage_item_load(StorageData *sd, int index);
+#ifdef DEBUG
+static void dump_items(StorageData *sd);
+#else
+#define dump_items(a)
+#endif
 
-       g_storage_fd = open(STORAGE_FILEPATH, O_RDWR | O_CREAT, (mode_t)0600);
-       if (g_storage_fd == -1)
-       {
-               g_storage_fd = 0;
-               close_storage();
-               DTRACE("Error : failed openning file for writing\n");
-               return -1;
-       }
+static int getMinIndex(indexType *indexTable, int len)
+{
+       int i = 0;
+       int minIndex;
+       indexType min;
+       min = indexTable[i];
+       minIndex = i;
 
-    result = lseek(g_storage_fd, TOTAL_STORAGE_SIZE-1, SEEK_SET);
-    if (result == -1) 
-       {
-               close_storage();
-               DTRACE("Error : failed moving file position to file's end\n");
-               return -1;
-    }
-    
-    result = write(g_storage_fd, "", 1);
-    if (result != 1) 
+       for (i = 1; i < len; i++)
        {
-               close_storage();
-               DTRACE("Error : failed writing to file's end\n");
-               return -1;
-    }
+               if ((min > indexTable[i]))
+               {
+                       min = indexTable[i];
+                       minIndex = i;
+               }
+       }
+       return minIndex;
+}
 
-       g_map = mmap(0, TOTAL_STORAGE_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, g_storage_fd, 0);
-       if (g_map == MAP_FAILED)
+static int getMaxIndex(indexType *indexTable, int len)
+{
+       int i = 0;
+       indexType max = indexTable[i];
+       int maxIndex = i;
+       for (i = 1; i < len; i++)
        {
-               close_storage();
-               DTRACE("Error : failed mmapping the file\n");
-               return -1;
+               if (max < indexTable[i])
+               {
+                       max = indexTable[i];
+                       maxIndex = i;
+               }
        }
+       return maxIndex;
+}
 
-       // FIXME : do not unconditionaly initialize, maybe old data can be
-       // at here
-       int *header = g_map;
-       for (i = 0; i < STORAGE_MAX_ITEMS; i++)
+StorageData *init_storage(AppData *ad)
+{
+       CALLED();
+       StorageData *sd = CALLOC(1, sizeof(StorageData));
+       eet_init();
+       ecore_file_init();
+
+       sd->ef = eet_open(STORAGE_FILEPATH, EET_FILE_MODE_READ_WRITE);
+       /*
+       if (sd->ef)
        {
-               char d = 0;
-               header[i] = 0;
-               memcpy(GET_ITEM_ADDR_BY_POSITION(g_map, i), &d, 1);
+               int read_size;
+               indexType *read_data;
+               read_data = eet_read(sd->ef, STORAGE_KEY_INDEX, &read_size);
+
+               int storage_size = sizeof(indexType) * STORAGE_ITEM_CNT;
+
+               int copy_size = storage_size < read_size ? storage_size : read_size;
+
+               if (read_data)
+               {
+                       indexType *temp = MALLOC(read_size);
+                       if (!temp)
+                               return sd;
+                       memcpy(temp, read_data, read_size);
+
+                       int i;
+                       int copy_cnt = copy_size/sizeof(indexType);
+                       for (i = 0; i < copy_cnt; i++)
+                       {
+                               int maxIndex = getMaxIndex(temp, copy_cnt);
+                               if (temp[maxIndex] == STORAGE_INDEX_ITEM_NONE)
+                                       break;
+                               sd->itemTable[i] = storage_item_load(sd, maxIndex);
+                               if (sd->itemTable[i])
+                                       sd->indexTable[i] = temp[maxIndex];
+                               temp[maxIndex] = STORAGE_INDEX_ITEM_NONE;
+
+                               DMSG("load storage item index %d\n", i);
+                       }
+                       for (i = copy_cnt - 1; i >= 0; i--)
+                       {
+                               if (sd->itemTable[i])
+                                       item_add_by_CNP_ITEM(ad, sd->itemTable[i]);
+                       }
+               }
+               else
+               {
+                       DMSG("load storage index failed\n");
+               }
        }
-       DTRACE("Success : storage init is done\n");
+       else
+               DMSG("storage ef is NULLd\n");
+       */
+       dump_items(sd);
 
-       g_storage_serial_number = 0;
+       ad->storage_item_add = storage_item_write;
+       ad->storage_item_del = storage_item_delete;
+//     ad->storage_item_load = storage_item_load;
 
-       return 0;
+       return sd;
 }
 
-int sync_storage()
+void depose_storage(StorageData *sd)
 {
-       if (g_map == NULL)
-       {
-               DTRACE("g_map is null\n");
-               return -1;
-       }
-       msync(g_map, TOTAL_STORAGE_SIZE, MS_ASYNC);
-
-       return 0;
+       CALLED();
+       storage_rewrite_all_items(sd);
+       dump_items(sd);
+       if (sd->ef)
+               eet_close(sd->ef);
+       sd->ef = NULL;
+       eet_shutdown();
+       ecore_file_shutdown();
 }
 
-int get_total_storage_size()
+#ifdef DEBUG
+static void dump_items(StorageData *sd)
 {
-       return TOTAL_STORAGE_SIZE;
+       CALLED();
+       int i;
+       for (i = 0; i < STORAGE_ITEM_CNT; i++)
+       {
+               CNP_ITEM *item = storage_item_load(sd, i);
+               if (item)
+                       printf("item #%d type: 0x%x, data: %s\n, len: %d\n", i, item->type_index, item->data, item->len);
+       }
 }
+#endif
 
-unsigned int get_storage_serial_code()
+static Eina_Bool item_write(Eet_File *ef, int index, CNP_ITEM *item)
 {
-       return g_storage_serial_number;
+       if (!ef)
+       {
+               DMSG("eet_file is NULL\n");
+               return EINA_FALSE;
+       }
+       char datakey[10];
+       snprintf(datakey, 10, STORAGE_KEY_FORMAT, index);
+       int buf_size = item->len + sizeof(int);
+       char *buf = MALLOC(buf_size);
+       if (!buf)
+               return EINA_FALSE;
+       ((int *)buf)[0] = item->type_index;
+       char *data = buf + sizeof(int);
+       memcpy(data, item->data, item->len);
+
+       int ret = eet_write(ef, datakey, buf, buf_size, 1);
+       DMSG("write result: %d, datakey: %s, buf_size: %d, item_len: %d\n", ret, datakey, buf_size, item->len);
+/*     if (ret)
+               eet_sync(ef);*/
+       return ret != 0;
 }
 
-int adding_item_to_storage(int pos, char *data)
+static void storage_rewrite_all_items(StorageData *sd)
 {
-       int *header = get_storage_start_addr();
+       CALLED();
+       if (sd->ef)
+               eet_close(sd->ef);
+       ecore_file_remove(STORAGE_FILEPATH);
+       sd->ef = eet_open(STORAGE_FILEPATH, EET_FILE_MODE_READ_WRITE);
 
-       if (g_map == NULL)
+       int i;
+       for (i = 0; i < STORAGE_ITEM_CNT; i++)
        {
-               DTRACE("g_map is null");
-               return -1;
+               if ((sd->indexTable[i] != STORAGE_INDEX_ITEM_NONE) && (sd->itemTable[i]))
+                       item_write(sd->ef, i, sd->itemTable[i]);
        }
-       // saving relative addr at header
-       header[pos] = STORAGE_HEADER_SIZE+pos*BODY_ITEM_SIZE; 
-       memcpy(GET_ITEM_ADDR_BY_POSITION(g_map, pos), data, BODY_ITEM_SIZE);
-       g_storage_serial_number++;
-       return 0;
+       storage_index_write(sd);
 }
 
-char *get_storage_start_addr()
+static Eina_Bool storage_item_write(AppData *ad, CNP_ITEM *item)
 {
-       return g_map;
+       CALLED();
+       StorageData *sd = ad->storage;
+       int index = getMinIndex(sd->indexTable, STORAGE_ITEM_CNT);
+       sd->indexTable[index] = ecore_time_unix_get();
+       sd->itemTable[index] = item;
+
+       item_write(sd->ef, index, item);
+       storage_index_write(sd);
+       dump_items(sd);
+       return EINA_TRUE;
 }
 
-int get_item_counts()
+static Eina_Bool storage_item_delete(AppData *ad, CNP_ITEM *item)
 {
-       int i, count;
-       int *header = get_storage_start_addr();
+       CALLED();
+       StorageData *sd = ad->storage;
+       int index;
+       for (index = 0; index < STORAGE_ITEM_CNT; index++)
+       {
+               if (sd->itemTable[index] == item)
+                       break;
+       }
 
-       count = 0;
-       for (i = 0; i < STORAGE_MAX_ITEMS; i++)
+       if (index < STORAGE_ITEM_CNT)
        {
-               if (header[i] != 0)
-                       count++;
+               sd->indexTable[index] = STORAGE_INDEX_ITEM_NONE;
+               storage_index_write(sd);
        }
-       return count;
+       return EINA_TRUE;
 }
 
-char *get_item_contents_by_pos(int pos)
+static CNP_ITEM *storage_item_load(StorageData *sd, int index)
 {
-       if (g_map == NULL)
+       if (!sd->ef)
        {
-               DTRACE("g_map is null");
+               DMSG("eet_file is NULL\n");
+               return EINA_FALSE;
+       }
+       if (index >= STORAGE_ITEM_CNT)
                return NULL;
+
+       indexType copyTable[STORAGE_ITEM_CNT];
+       memcpy(copyTable, sd->indexTable, sizeof(copyTable));
+       int i;
+       for (i = 0; i < index; i++)
+       {
+               int maxIndex = getMaxIndex(copyTable, STORAGE_ITEM_CNT);
+               if (maxIndex == -1)
+                       maxIndex = 0;
+               copyTable[maxIndex] = 0;
        }
-       return GET_ITEM_ADDR_BY_POSITION(g_map, pos);
-}
 
-int close_storage()
-{
-       if (g_map)
-               munmap(g_map, TOTAL_STORAGE_SIZE);
-       g_map = NULL;
+       char datakey[10];
+       snprintf(datakey, 10, STORAGE_KEY_FORMAT, i);
 
-       if (g_storage_fd)
-               close(g_storage_fd);
-       g_storage_fd = 0;
-       g_storage_serial_number = 0;
+       int read_size;
+       char *read_data = eet_read(sd->ef, datakey, &read_size);
 
-       return 0;
+       if (!read_data)
+       {
+               DMSG("read failed index: %d\n", index);
+               return NULL;
+       }
+       CNP_ITEM *item = CALLOC(1, sizeof(CNP_ITEM));
+       if (item)
+       {
+               char *data = read_data + sizeof(int);
+               int data_size = read_size - sizeof(int);
+               char *buf = CALLOC(1, data_size);
+               if (!buf)
+               {
+                       FREE(item);
+                       free(read_data);
+                       return NULL;
+               }
+               item->type_index = ((int *)read_data)[0];
+               memcpy(buf, data, data_size);
+               item->data = buf;
+               item->len = data_size;
+       }
+       free(read_data);
+       return item;
 }
 
-
+static Eina_Bool storage_index_write(StorageData *sd)
+{
+       CALLED();
+       int ret;
+       if (!sd->ef)
+       {
+               DMSG("eet_file is NULL\n");
+               return EINA_FALSE;
+       }
+#ifdef DEBUG
+       for (ret = 0; ret < STORAGE_ITEM_CNT; ret++)
+               printf(", index %d: %lf", ret, sd->indexTable[ret]);
+       printf("\n");
+#endif
+       ret = eet_write(sd->ef, STORAGE_KEY_INDEX, sd->indexTable, sizeof(indexType) * STORAGE_ITEM_CNT, 1);
+       if (ret)
+               eet_sync(sd->ef);
+       return ret != 0;
+}
index 352f701..4788ac9 100644 (file)
@@ -1,18 +1,40 @@
-#ifndef _storage_h_
-#define _storage_h_
-
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <fcntl.h>
-#include <sys/mman.h>
-
-int init_storage();
-int sync_storage();
-unsigned int get_storage_serial_code();
-int adding_item_to_storage(int pos, char *data);
-char *get_storage_start_addr();
-int get_item_counts();
-char *get_item_contents_by_pos(int pos);
-int close_storage();
-
-#endif // _storage_h_
+/*
+ * cbhm
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#ifndef _STORAGE_H_
+#define _STORAGE_H_
+
+#include <Eet.h>
+#include <Eina.h>
+#include <Ecore.h>
+
+#include "item_manager.h"
+
+typedef double indexType; /* Ecore_Time */
+
+#define STORAGE_ITEM_CNT 12
+struct _StorageData {
+       Eet_File *ef;
+       indexType indexTable[STORAGE_ITEM_CNT];
+       CNP_ITEM *itemTable[STORAGE_ITEM_CNT];
+};
+
+StorageData *init_storage(AppData *ad);
+void depose_storage(StorageData *sd);
+#endif
diff --git a/src/xconverter.c b/src/xconverter.c
new file mode 100644 (file)
index 0000000..3196fdb
--- /dev/null
@@ -0,0 +1,1348 @@
+/*
+ * cbhm
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include "xconverter.h"
+
+static char *html_to_entry(AppData *ad, int type_index, const char *str);
+static char *efl_to_entry(AppData *ad, int type_index, const char *str);
+static char *text_to_entry(AppData *ad, int type_index, const char *str);
+static char *image_path_to_entry(AppData *ad, int type_index, const char *str);
+
+static char *make_close_tag(Eina_List* nodes);
+static char *do_not_convert(AppData *ad, int type_index, const char *str);
+static char *html_to_efl(AppData *ad, int type_index, const char *str);
+static char *efl_to_html(AppData *ad, int type_index, const char *str);
+static char *text_to_html(AppData *ad, int type_index, const char *str);
+static char *text_to_efl(AppData *ad, int type_index, const char *str);
+static char *to_text(AppData *ad, int type_index, const char *str);
+static char *image_path_to_html(AppData *ad, int type_index, const char *str);
+static char *image_path_to_efl(AppData *ad, int type_index, const char *str);
+//static char *image_path_to_text(AppData *ad, int type_index, const char *str);
+//static char *efl_to_efl(AppData *ad, int type_index, const char *str);
+//static char *html_to_html(AppData *ad, int type_index, const char *str);
+static char *image_path_to_image_path(AppData *ad, int type_index, const char *str);
+
+int atom_type_index_get(AppData *ad, Ecore_X_Atom atom)
+{
+       int i, j;
+       for (i = 0; i < ATOM_INDEX_MAX; i++)
+       {
+               for (j = 0; j < ad->targetAtoms[i].atom_cnt; j++)
+                       if (ad->targetAtoms[i].atom[j] == atom)
+                               return i;
+       }
+       return -1;
+}
+
+void init_target_atoms(AppData *ad)
+{
+       int atom_cnt[ATOM_INDEX_MAX] = {
+               1, 5, 2, 1, 2
+       };
+       char *targetAtomNames[][5] = {
+               { "TARGETS" },
+               { "UTF8_STRING", "STRING", "TEXT", "text/plain;charset=utf-8", "text/plain" },
+               { "text/html;charset=utf-8", "text/html" },
+               { "application/x-elementary-markup" },
+               { "text/uri", "text/uri-list" }
+       };
+       text_converter_func converts_for_entry[ATOM_INDEX_MAX] = {
+               NULL, text_to_entry, html_to_entry, efl_to_entry, image_path_to_entry
+       };
+
+       text_converter_func converts[ATOM_INDEX_MAX][ATOM_INDEX_MAX] = {
+               {NULL, NULL, NULL, NULL, NULL},
+               {NULL, do_not_convert, text_to_html, text_to_efl, NULL},
+               {NULL, to_text, do_not_convert, html_to_efl, NULL},
+               {NULL, to_text, efl_to_html, do_not_convert, NULL},
+               {NULL, NULL, image_path_to_html, image_path_to_efl, image_path_to_image_path}
+       };
+
+       int i, j;
+       for (i = 0; i < ATOM_INDEX_MAX; i++)
+       {
+               ad->targetAtoms[i].atom_cnt = atom_cnt[i];
+               ad->targetAtoms[i].name = MALLOC(sizeof(char *) * atom_cnt[i]);
+               ad->targetAtoms[i].atom = MALLOC(sizeof(Ecore_X_Atom) * atom_cnt[i]);
+               for (j = 0; j < atom_cnt[i]; j++)
+               {
+                       DMSG("atomName: %s\n", targetAtomNames[i][j]);
+                       ad->targetAtoms[i].name[j] = strdup(targetAtomNames[i][j]);
+                       ad->targetAtoms[i].atom[j] = ecore_x_atom_get(targetAtomNames[i][j]);
+               }
+               ad->targetAtoms[i].convert_for_entry = converts_for_entry[i];
+
+               for (j = 0; j < ATOM_INDEX_MAX; j++)
+                       ad->targetAtoms[i].convert_to_target[j] = converts[i][j];
+               //ecore_x_selection_converter_atom_add(ad->targetAtoms[i].atom, target_converters[i]);
+               //ecore_x_selection_converter_atom_add(ad->targetAtoms[i].atom, generic_converter);
+       }
+}
+
+void depose_target_atoms(AppData *ad)
+{
+       int i, j;
+       for (i = 0; i < ATOM_INDEX_MAX; i++)
+       {
+               for (j = 0; j < ad->targetAtoms[i].atom_cnt; j++)
+               {
+                       if (ad->targetAtoms[i].name[j])
+                               FREE(ad->targetAtoms[i].name[j]);
+               }
+               if (ad->targetAtoms[i].name)
+                       FREE(ad->targetAtoms[i].name);
+               if (ad->targetAtoms[i].atom)
+                       FREE(ad->targetAtoms[i].atom);
+       }
+}
+
+static Eina_Bool targets_converter(AppData *ad, Ecore_X_Atom reqAtom, CNP_ITEM *item, void **data_ret, int *size_ret, Ecore_X_Atom *ttype, int *tsize)
+{
+       CALLED();
+
+       int count;
+       int i, j;
+
+       int item_type_index = ATOM_INDEX_TEXT;
+       if (item)
+               item_type_index = item->type_index;
+
+       for (i = 0, count = 0; i < ATOM_INDEX_MAX; i++)
+       {
+               if (ad->targetAtoms[item_type_index].convert_to_target[i])
+                       count += ad->targetAtoms[i].atom_cnt;
+       }
+
+       *data_ret = MALLOC(sizeof(Ecore_X_Atom) * count);
+       DMSG("item_type: %d, target Atom cnt: %d\n", item_type_index, count);
+       if (!*data_ret)
+               return EINA_FALSE;
+
+       for (i = 0, count = 0; i < ATOM_INDEX_MAX; i++)
+       {
+               if (ad->targetAtoms[item_type_index].convert_to_target[i])
+               {
+                       for(j = 0; j < ad->targetAtoms[i].atom_cnt; j++)
+                       {
+                               ((Ecore_X_Atom *)*data_ret)[count++] = ad->targetAtoms[i].atom[j];
+                               DMSG("send target atom: %s\n", ad->targetAtoms[i].name[j]);
+                       }
+               }
+       }
+
+       if (size_ret) *size_ret = count;
+       if (ttype) *ttype = ECORE_X_ATOM_ATOM;
+       if (tsize) *tsize = 32;
+       return EINA_TRUE;
+}
+
+Eina_Bool generic_converter(AppData *ad, Ecore_X_Atom reqAtom, CNP_ITEM *item, void **data_ret, int *size_ret, Ecore_X_Atom *ttype, int *tsize)
+{
+       CALLED();
+
+       if (ad->targetAtoms[ATOM_INDEX_TARGET].atom[0] == reqAtom)
+               return targets_converter(ad, reqAtom, item, data_ret, size_ret, ttype, tsize);
+
+       int req_index = atom_type_index_get(ad, reqAtom);
+       int item_type_index = ATOM_INDEX_TEXT;
+       void *item_data = "";
+
+       if (req_index < 0) return EINA_FALSE;
+
+       if (item)
+       {
+               item_type_index = item->type_index;
+               item_data = item->data;
+       }
+
+       if (ad->targetAtoms[item_type_index].convert_to_target[req_index])
+       {
+               *data_ret = ad->targetAtoms[item_type_index].convert_to_target[req_index](ad, item_type_index, item_data);
+               if (!*data_ret)
+                       return EINA_FALSE;
+               if (size_ret) *size_ret = strlen(*data_ret);
+               if (ttype) *ttype = ad->targetAtoms[item_type_index].atom[0];
+               if (tsize) *tsize = 8;
+               return EINA_TRUE;
+       }
+
+       return EINA_FALSE;
+}
+
+/* For convert EFL to HTML */
+
+#define TAGPOS_START    0x00000001
+#define TAGPOS_END      0x00000002
+#define TAGPOS_ALONE    0x00000003
+
+/* TEXTBLOCK tag using stack but close tag word has no mean maybe bug...
+ * TEXTBLOCK <b>bold<font>font</b>bold</font>
+ * HTML <b>bold<font>font bold</b>font</font> */
+
+typedef struct _TagTable {
+       char *src;
+       char *dst;
+}TagTable;
+
+TagTable _EFLtoHTMLConvertTable[] = {
+       {"font", "font"},
+       {"underline", "del"},
+       {"strikethrough", "ins"},
+       {"br", "br"},
+       {"br/", "br"},
+       {"ps", "br"},
+       {"b", "b"},
+       {"item", "img"}
+};
+
+TagTable _HTMLtoEFLConvertTable[] = {
+       {"font", ""},
+       {"del", "underline"},
+       {"u", "underline"},
+       {"ins", "strikethrough"},
+       {"s", "strikethrough"},
+       {"br", "br"},
+       {"b", "b"},
+       {"strong", "b"},
+       {"img", "item"}
+};
+
+
+typedef struct _TagNode TagNode, *PTagNode;
+struct _TagNode {
+       char *tag;  //EINA_STRINGSHARE if NULL just str
+       char *tag_str;
+       char *str;
+       const char *pos_in_ori_str;
+       PTagNode matchTag;
+       void *tagData;
+       unsigned char tagPosType;
+};
+
+typedef struct _FontTagData FontTagData, *PFontTagData;
+struct _FontTagData {
+       char *name;
+       char *color;
+       char *size;
+       char *bg_color;
+};
+
+
+typedef struct _ItemTagData ItemTagData, *PItemTagData;
+struct _ItemTagData {
+       char *href;
+       char *width;
+       char *height;
+};
+
+#define SAFEFREE(ptr) \
+       do\
+{\
+       if (ptr)\
+       FREE(ptr);\
+       ptr = NULL;\
+} while(0);\
+
+#define freeAndAssign(dst, value) \
+       do\
+{\
+       if (value)\
+       {\
+               SAFEFREE(dst);\
+               dst = value;\
+       }\
+} while(0);
+
+static PTagNode _new_tag_node(char *tag, char *tag_str, char* str, const char *pos_in_ori_str);
+static PTagNode _get_start_node(const char *str);
+static PTagNode _get_next_node(PTagNode prev);
+static void _delete_node(PTagNode node);
+static void _link_match_tags(Eina_List *nodes);
+static char *_get_tag_value(const char *tag_str, const char *tag_name);
+static char *_convert_to_html(Eina_List* nodes);
+static void _set_EFL_tag_data(Eina_List* nodes);
+static char *_convert_to_edje(Eina_List* nodes);
+static void _set_HTML_tag_data(Eina_List* nodes);
+static void cleanup_tag_list(Eina_List *nodeList);
+static PFontTagData _set_EFL_font_data(PFontTagData data, const char *tag_str);
+static PItemTagData _set_EFL_item_data(PItemTagData data, const char *tag_str);
+static PFontTagData _set_HTML_font_data(PFontTagData data, const char *tag_str);
+static PItemTagData _set_HTML_img_data(PItemTagData data, const char *tag_str);
+
+#ifdef DEBUG
+static void _dumpNode(Eina_List* nodes);
+#endif
+
+static PTagNode
+_new_tag_node(char *tag, char *tag_str, char* str, const char *pos_in_ori_str)
+{
+       PTagNode newNode = CALLOC(1, sizeof(TagNode));
+       if (tag)
+               eina_str_tolower(&tag);
+       newNode->tag = tag;
+       newNode->tag_str = tag_str;
+       newNode->str = str;
+       newNode->pos_in_ori_str = pos_in_ori_str;
+       return newNode;
+}
+
+static PTagNode
+_get_start_node(const char *str)
+{
+       char *startStr = NULL;
+       if (!str || str[0] == '\0')
+               return NULL;
+
+       if (str[0] != '<')
+       {
+               char *tagStart = strchr(str, '<');
+               if (!tagStart)
+                       startStr = strdup(str);
+               else
+               {
+                       int strLength = tagStart - str;
+                       startStr = MALLOC(sizeof(char) * (strLength + 1));
+                       strncpy(startStr, str, strLength);
+                       startStr[strLength] = '\0';
+               }
+       }
+
+       return _new_tag_node(NULL, NULL, startStr, str);
+}
+
+static PTagNode
+_get_next_node(PTagNode prev)
+{
+       PTagNode retTag = NULL;
+       char *tagStart;
+       char *tagEnd;
+       char *tagNameEnd = NULL;
+       char *nextTagStart;
+
+       if (prev->tag == NULL)
+               tagStart = strchr(prev->pos_in_ori_str, '<');
+       else
+               tagStart = strchr(prev->pos_in_ori_str + 1, '<');
+
+       if (!tagStart)
+               return retTag;
+
+       tagEnd = strchr(tagStart, '>');
+       nextTagStart = strchr(tagStart + 1, '<');
+
+       if (!tagEnd || (nextTagStart && (nextTagStart < tagEnd)))
+               return _get_start_node(tagStart + 1);
+
+       int spCnt = 5;
+       char *spArray[spCnt];
+       spArray[0] = strchr(tagStart, '=');
+       spArray[1] = strchr(tagStart, '_');
+       spArray[2] = strchr(tagStart, ' ');
+       spArray[3] = strchr(tagStart, '\t');
+       spArray[4] = strchr(tagStart, '\n');
+       tagNameEnd = tagEnd;
+
+       int i;
+       for (i = 0; i < spCnt; i++)
+       {
+               if (spArray[i] && spArray[i] < tagNameEnd)
+                       tagNameEnd = spArray[i];
+       }
+
+       int tagLength = tagNameEnd - tagStart - 1;
+       char *tagName = NULL;
+       if (!strncmp(&tagStart[1], "/item", tagLength))
+               tagName = strdup("");
+       else
+               tagName = strndup(&tagStart[1], tagLength);
+
+       int tagStrLength = 0;
+       char *tagStr = NULL;
+       if (tagName)
+       {
+               tagStrLength = tagEnd - tagStart + 1;
+               tagStr = strndup(tagStart, tagStrLength);
+       }
+
+       unsigned int strLength = nextTagStart ? (unsigned int)(nextTagStart - tagEnd - 1) : strlen(&tagEnd[1]);
+       char *str = strndup(&tagEnd[1], strLength);
+
+       retTag = _new_tag_node(tagName, tagStr, str, tagStart);
+       return retTag;
+}
+
+
+static void
+_delete_node(PTagNode node)
+{
+       if (node)
+       {
+               SAFEFREE(node->tag_str);
+               SAFEFREE(node->str);
+
+               if (node->tagData)
+               {
+                       if (node->tag)
+                       {
+                               if (!strcmp("font", node->tag))
+                               {
+                                       PFontTagData data = node->tagData;
+                                       SAFEFREE(data->name);
+                                       SAFEFREE(data->color);
+                                       SAFEFREE(data->size);
+                                       SAFEFREE(data->bg_color);
+                               }
+                               if (!strcmp("item", node->tag))
+                               {
+                                       PItemTagData data = node->tagData;
+                                       SAFEFREE(data->href);
+                                       SAFEFREE(data->width);
+                                       SAFEFREE(data->height);
+                               }
+
+                       }
+                       SAFEFREE(node->tagData);
+               }
+               SAFEFREE(node->tag);
+               SAFEFREE(node);
+       }
+}
+
+static void
+_link_match_tags(Eina_List *nodes)
+{
+       Eina_List *stack = NULL;
+
+       PTagNode trail, popData;
+       Eina_List *l, *r;
+
+       EINA_LIST_FOREACH(nodes, l, trail)
+       {
+               if (!trail->tag || trail->tag[0] == '\0')
+                       continue;
+               if (!strcmp("br", trail->tag) || !strcmp("br/", trail->tag))
+               {
+                       trail->tagPosType = TAGPOS_ALONE;
+                       continue;
+               }
+               else if (!strcmp("item", trail->tag) || !strcmp("img", trail->tag))
+               {
+                       trail->tagPosType = TAGPOS_ALONE;
+                       continue;
+               }
+
+               if (trail->tag[0] != '/') // PUSH
+               {
+                       stack = eina_list_append(stack, trail);
+                       /*             eina_array_push(stack, trail);
+                                                  DMSG("stack: %d, tag %s\n", eina_array_count_get(stack), trail->tag);*/
+                       DMSG("stack: %d, tag %s\n", eina_list_count(stack), trail->tag);
+               }
+               else // POP
+               {
+                       if (!eina_list_count(stack))
+                       {
+                               DMSG("tag not matched %s\n", trail->tag);
+                               continue;
+                       }
+
+                       EINA_LIST_REVERSE_FOREACH(stack, r, popData)
+                       {
+                               if (popData->tag && !strcmp(popData->tag, &trail->tag[1]))
+                               {
+                                       popData->tagPosType = TAGPOS_START;
+                                       trail->tagPosType = TAGPOS_END;
+                                       popData->matchTag = trail;
+                                       trail->matchTag = popData;
+                                       stack = eina_list_remove_list(stack, r);
+                                       break;
+                               }
+                       }
+                       /*             popData = eina_array_pop(stack);
+
+                                                  popData->tagPosType = TAGPOS_START;
+                                                  trail->tagPosType = TAGPOS_END;
+                                                  popData->matchTag = trail;
+                                                  trail->matchTag = popData;
+                                                  DMSG("pop stack: %d, tag %s\n", eina_array_count_get(stack), trail->tag);
+                        */
+               }
+       }
+
+       /*   if (eina_array_count_get(stack))
+                DMSG("stack state: %d, tag %s\n", eina_array_count_get(stack), trail->tag);*/
+
+       /* Make Dummy close tag */
+       /*   while ((popData = eina_array_pop(stack)))  */
+
+       EINA_LIST_REVERSE_FOREACH(stack, r, popData)
+       {
+               PTagNode newData;
+               int tagLength = strlen(popData->tag);
+               char *tagName = MALLOC(sizeof(char) * (tagLength + 2));
+
+               tagName[0] = '/';
+               tagName[1] = '\0';
+               strcat(tagName, popData->tag);
+
+               newData = _new_tag_node(tagName, NULL, NULL, NULL);
+               popData->tagPosType = TAGPOS_START;
+               newData->tagPosType = TAGPOS_END;
+               popData->matchTag = newData;
+               newData->matchTag = popData;
+               nodes = eina_list_append(nodes, newData);
+               /*        DMSG("stack: %d, tag %s\n", eina_array_count_get(stack), popData->tag);*/
+       }
+       /*   DMSG("stack_top: %d\n", eina_array_count_get(stack));
+                eina_array_free(stack);*/
+       eina_list_free(stack);
+}
+
+static char *
+_get_tag_value(const char *tag_str, const char *tag_name)
+{
+       if (!tag_name || !tag_str)
+               return NULL;
+
+       char *tag;
+       if ((tag = strstr(tag_str, tag_name)))
+       {
+               if (tag[strlen(tag_name)] == '_')
+                       return NULL;
+               char *value = strchr(tag, '=');
+               if (value)
+               {
+                       do
+                       {
+                               value++;
+                       } while (!isalnum(*value) && *value != '#');
+
+                       int spCnt = 6;
+                       char *spArray[spCnt];
+                       spArray[0] = strchr(value, ' ');
+                       spArray[1] = strchr(value, '>');
+                       spArray[2] = strchr(value, '\"');
+                       spArray[3] = strchr(value, '\'');
+                       spArray[4] = strchr(value, '\t');
+                       spArray[5] = strchr(value, '\n');
+                       char *valueEnd = strchr(value, '\0');
+
+                       int i;
+                       int start = 0;
+                       if ((!strncmp(tag_str, "<item", 5) && !strcmp(tag_name, "href")) // EFL img tag
+               || (!strncmp(tag_str, "<img", 4) && !strcmp(tag_name, "src"))) // HTML img tag
+               start = 1;
+
+                       for (i = start; i < spCnt; i++)
+                       {
+                               if (spArray[i] && spArray[i] < valueEnd)
+                                       valueEnd = spArray[i];
+                       }
+
+                       int valueLength = valueEnd - value;
+                       return strndup(value, valueLength);
+               }
+       }
+       return NULL;
+}
+
+static PFontTagData
+_set_EFL_font_data(PFontTagData data, const char *tag_str)
+{
+       char *value;
+
+       if (!data)
+               data = CALLOC(1, sizeof(FontTagData));
+       value = _get_tag_value(tag_str, "font_size");
+       freeAndAssign(data->size, value);
+       value = _get_tag_value(tag_str, "color");
+       freeAndAssign(data->color, value);
+       value = _get_tag_value(tag_str, "bgcolor");
+       freeAndAssign(data->bg_color, value);
+       value = _get_tag_value(tag_str, "font");
+       freeAndAssign(data->name, value);
+
+       return data;
+}
+
+static PItemTagData
+_set_EFL_item_data(PItemTagData data, const char *tag_str)
+{
+       char *value;
+
+       if (!data)
+               data = CALLOC(1, sizeof(ItemTagData));
+       value = _get_tag_value(tag_str, "href");
+       if (value)
+       {
+               char *path = strstr(value, "file://");
+               if (path)
+               {
+                       char *modify = MALLOC(sizeof(char) * (strlen(value) + 1));
+                       strncpy(modify, "file://", 8);
+                       path += 7;
+                       while (path[1] && path[0] && path[1] == '/' && path[0] == '/')
+                       {
+                               path++;
+                       }
+                       strcat(modify, path);
+                       data->href = modify;
+                       DMSG("image href ---%s---\n", data->href);
+                       FREE(value);
+               }
+               else
+                       freeAndAssign(data->href, value);
+       }
+
+       value = _get_tag_value(tag_str, "absize");
+       if (value)
+       {
+               char *xpos = strchr(value, 'x');
+               if (xpos)
+               {
+                       int absizeLen = strlen(value);
+                       freeAndAssign(data->width, strndup(value, xpos - value));
+                       freeAndAssign(data->height, strndup(xpos + 1, absizeLen - (xpos - value) - 1));
+                       DMSG("image width: -%s-, height: -%s-\n", data->width, data->height);
+               }
+               FREE(value);
+       }
+       return data;
+}
+
+static void
+_set_EFL_tag_data(Eina_List* nodes)
+{
+       PTagNode trail;
+       Eina_List *l;
+
+       EINA_LIST_FOREACH(nodes, l, trail)
+       {
+               if (!trail->tag)
+                       continue;
+               if (!strcmp("font", trail->tag) || !strcmp("color", trail->tag))
+                       trail->tagData = _set_EFL_font_data(trail->tagData, trail->tag_str);
+               else if (!strcmp("item", trail->tag))
+                       trail->tagData = _set_EFL_item_data(trail->tagData, trail->tag_str);
+       }
+}
+
+static PFontTagData
+_set_HTML_font_data(PFontTagData data, const char *tag_str)
+{
+       char *value;
+
+       if (!data)
+               data = CALLOC(1, sizeof(FontTagData));
+       value = _get_tag_value(tag_str, "size");
+       freeAndAssign(data->size, value);
+       value = _get_tag_value(tag_str, "color");
+       freeAndAssign(data->color, value);
+       value = _get_tag_value(tag_str, "bgcolor");
+       freeAndAssign(data->bg_color, value);
+       value = _get_tag_value(tag_str, "face");
+       freeAndAssign(data->name, value);
+
+       return data;
+}
+
+static PItemTagData
+_set_HTML_img_data(PItemTagData data, const char *tag_str)
+{
+       char *value;
+
+       if (!data)
+               data = CALLOC(1, sizeof(ItemTagData));
+       value = _get_tag_value(tag_str, "src");
+       if (value)
+       {
+               char *path = strstr(value, "file://");
+               if (path)
+               {
+                       char *modify = MALLOC(sizeof(char) * (strlen(value) + 1));
+                       strncpy(modify, "file://", 8);
+                       path += 7;
+                       while (path[1] && path[0] && path[1] == '/' && path[0] == '/')
+                       {
+                               path++;
+                       }
+                       strcat(modify, path);
+                       data->href = modify;
+                       DMSG("image src ---%s---\n", data->href);
+                       FREE(value);
+               }
+               else
+                       freeAndAssign(data->href, value);
+       }
+
+       value = _get_tag_value(tag_str, "width");
+       freeAndAssign(data->width, value);
+       value = _get_tag_value(tag_str, "height");
+       freeAndAssign(data->height, value);
+       return data;
+}
+
+static void
+_set_HTML_tag_data(Eina_List* nodes)
+{
+       PTagNode trail;
+       Eina_List *l;
+
+       EINA_LIST_FOREACH(nodes, l, trail)
+       {
+               if (!trail->tag)
+                       continue;
+               if (!strcmp("font", trail->tag) || !strcmp("color", trail->tag))
+                       trail->tagData = _set_HTML_font_data(trail->tagData, trail->tag_str);
+               else if (!strcmp("img", trail->tag))
+                       trail->tagData = _set_HTML_img_data(trail->tagData, trail->tag_str);
+       }
+}
+
+#ifdef DEBUG
+static void
+_dumpNode(Eina_List* nodes)
+{
+       PTagNode trail;
+       Eina_List *l;
+
+       EINA_LIST_FOREACH(nodes, l, trail)
+       {
+               DMSG("tag: %s, tag_str: %s, str: %s, tagPosType: %d\n",
+                               trail->tag, trail->tag_str, trail->str, trail->tagPosType);
+               DMSG("matchTag: %x ", (unsigned int)trail->matchTag);
+               if (trail->matchTag)
+                       DMSG("matchTag->tag_str: %s", trail->matchTag->tag_str);
+               if (trail->tagData)
+               {
+                       if (!strcmp(trail->tag, "font"))
+                       {
+                               PFontTagData data = trail->tagData;
+                               DMSG(" tagData->name: %s, tagData->color: %s, tagData->size: %s, tagData->bg_color: %s",
+                                               data->name, data->color, data->size, data->bg_color);
+                       }
+                       else if (!strcmp(trail->tag, "item") || !strcmp(trail->tag, "img"))
+                       {
+                               PItemTagData data = trail->tagData;
+                               DMSG(" tagData->href: %s, tagData->width: %s, tagData->height: %s",
+                                               data->href, data->width, data->height);
+                       }
+                       else
+                               DMSG("\nERROR!!!! not need tagData");
+               }
+               DMSG("\n");
+       }
+}
+#endif
+
+static char *
+_convert_to_html(Eina_List* nodes)
+{
+       PTagNode trail;
+       Eina_List *l;
+
+       Eina_Strbuf *html = eina_strbuf_new();
+
+       int tableCnt = sizeof(_EFLtoHTMLConvertTable) / sizeof(TagTable);
+
+       EINA_LIST_FOREACH(nodes, l, trail)
+       {
+               if (trail->tag)
+               {
+                       char *tagName = trail->tagPosType == TAGPOS_END ?
+                               trail->matchTag->tag : trail->tag;
+                       int j;
+                       for(j = 0; j < tableCnt; j++)
+                       {
+                               if (!strcmp(_EFLtoHTMLConvertTable[j].src, tagName))
+                               {
+                                       switch(trail->tagPosType)
+                                       {
+                                               case TAGPOS_END:
+                                                       eina_strbuf_append(html, "</");
+                                                       break;
+                                               default:
+                                                       eina_strbuf_append(html, "<");
+                                                       break;
+                                       }
+
+                                       eina_strbuf_append(html, _EFLtoHTMLConvertTable[j].dst);
+                                       if (trail->tagPosType != TAGPOS_END)
+                                       {
+                                               if (!strcmp(_EFLtoHTMLConvertTable[j].src, "font"))
+                                               {
+                                                       PFontTagData data = trail->tagData;
+                                                       if (data->name)
+                                                       {
+                                                       }
+                                                       if (data->color)
+                                                       {
+                                                               char *color = strdup(data->color);
+                                                               if (color && color[0] == '#' && strlen(color) == 9)
+                                                               {
+                                                                       color[7] = '\0';
+                                                                       eina_strbuf_append_printf(html, " color=\"%s\"", color);
+                                                               }
+                                                               else
+                                                                       eina_strbuf_append_printf(html, " color=\"%s\"", data->color);
+                                                               if (color)
+                                                                       FREE(color);
+                                                       }
+                                                       if (data->size)
+                                                               eina_strbuf_append_printf(html, " size=\"%s\"", data->size);
+                                                       if (data->bg_color)
+                                                       {
+                                                       }
+                                               }
+                                               else if (!strcmp(_EFLtoHTMLConvertTable[j].src, "item"))
+                                               {
+                                                       PItemTagData data = trail->tagData;
+                                                       if (data->href)
+                                                               eina_strbuf_append_printf(html, " src=\"%s\"", data->href);
+                                                       if (data->width)
+                                                               eina_strbuf_append_printf(html, " width=\"%s\"", data->width);
+                                                       if (data->height)
+                                                               eina_strbuf_append_printf(html, " height=\"%s\"", data->height);
+                                               }
+                                       }
+                                       switch(trail->tagPosType)
+                                       {
+                                               /* closed tag does not need in HTML
+                                                  case TAGPOS_ALONE:
+                                                  eina_strbuf_append(html, " />");
+                                                  break;*/
+                                               default:
+                                                       eina_strbuf_append(html, ">");
+                                                       break;
+                                       }
+                                       break;
+                               }
+                       }
+               }
+               if (trail->str)
+                       eina_strbuf_append(html, trail->str);
+       }
+
+       eina_strbuf_replace_all(html, "  ", " &nbsp;");
+       char *ret = eina_strbuf_string_steal(html);
+       eina_strbuf_free(html);
+       return ret;
+}
+
+#define IMAGE_DEFAULT_WIDTH "240"
+#define IMAGE_DEFAULT_HEIGHT "180"
+
+
+static char *
+_convert_to_edje(Eina_List* nodes)
+{
+       PTagNode trail;
+       Eina_List *l;
+
+       Eina_Strbuf *edje = eina_strbuf_new();
+
+       int tableCnt = sizeof(_HTMLtoEFLConvertTable) / sizeof(TagTable);
+
+       EINA_LIST_FOREACH(nodes, l, trail)
+       {
+               if (trail->tag)
+               {
+                       char *tagName = trail->tagPosType == TAGPOS_END ?
+                               trail->matchTag->tag : trail->tag;
+                       int j;
+                       for(j = 0; j < tableCnt; j++)
+                       {
+                               if (!strcmp(_HTMLtoEFLConvertTable[j].src, tagName))
+                               {
+                                       if (_HTMLtoEFLConvertTable[j].dst[0] != '\0')
+                                       {
+                                               switch(trail->tagPosType)
+                                               {
+                                                       case TAGPOS_END:
+                                                               eina_strbuf_append(edje, "</");
+                                                               break;
+                                                       default:
+                                                               eina_strbuf_append(edje, "<");
+                                                               break;
+                                               }
+
+                                               eina_strbuf_append(edje, _HTMLtoEFLConvertTable[j].dst);
+                                       }
+                                       if (trail->tagPosType != TAGPOS_END)
+                                       {
+                                               if (!strcmp(_HTMLtoEFLConvertTable[j].src, "font"))
+                                               {
+                                                       PFontTagData data = trail->tagData;
+                                                       if (data->name)
+                                                       {
+                                                       }
+                                                       if (data->color)
+                                                       {
+                                                               if (data->color[0] == '#' && strlen(data->color) == 7)
+                                                                       eina_strbuf_append_printf(edje, "<color=%sff>", data->color);
+                                                               else
+                                                                       eina_strbuf_append_printf(edje, "<color=%s>", data->color);
+
+                                                       }
+                                                       if (data->size)
+                                                               eina_strbuf_append_printf(edje, "<font_size=%s>", data->size);
+                                                       if (data->bg_color)
+                                                       {
+                                                       }
+                                                       break;
+                                               }
+                                               else if (!strcmp(_HTMLtoEFLConvertTable[j].src, "img"))
+                                               {
+                                                       PItemTagData data = trail->tagData;
+                                                       char *width = IMAGE_DEFAULT_WIDTH, *height = IMAGE_DEFAULT_HEIGHT;
+                                                       if (data->width)
+                                                               width = data->width;
+                                                       if (data->height)
+                                                               height = data->height;
+                                                       eina_strbuf_append_printf(edje, " absize=%sx%s", width, height);
+                                                       if (data->href)
+                                                               eina_strbuf_append_printf(edje, " href=%s></item>", data->href);
+                                                       break;
+                                               }
+                                       }
+                                       else
+                                       {
+                                               if (_HTMLtoEFLConvertTable[j].dst[0] == '\0')
+                                               {
+                                                       if (!strcmp(_HTMLtoEFLConvertTable[j].src, "font"))
+                                                       {
+                                                               if (trail->matchTag->tagData)
+                                                               {
+                                                                       PFontTagData data = trail->matchTag->tagData;
+                                                                       if (data->name)
+                                                                       {
+                                                                       }
+                                                                       if (data->color)
+                                                                               eina_strbuf_append_printf(edje, "</color>");
+                                                                       if (data->size)
+                                                                               eina_strbuf_append_printf(edje, "</font>");
+                                                                       if (data->bg_color)
+                                                                       {
+                                                                       }
+                                                                       break;
+                                                               }
+                                                       }
+                                               }
+                                       }
+                                       switch(trail->tagPosType)
+                                       {
+                                               /* not support in efl
+                                                  case TAGPOS_ALONE:
+                                                  eina_strbuf_append(edje, " />");
+                                                  break;
+                                                */
+                                               default:
+                                                       eina_strbuf_append(edje, ">");
+                                                       break;
+                                       }
+                                       break;
+                               }
+                       }/* for(j = 0; j < tableCnt; j++) end */
+               }
+               if (trail->str)
+                       eina_strbuf_append(edje, trail->str);
+       }
+
+       eina_strbuf_replace_all(edje, "&nbsp;", " ");
+       char *ret = eina_strbuf_string_steal(edje);
+       eina_strbuf_free(edje);
+       return ret;
+}
+
+char *string_for_entry_get(AppData *ad, int type_index, const char *str)
+{
+       DMSG("type_index: %d ", type_index);
+       DMSG("str: %s\n", str);
+       if (ad->targetAtoms[type_index].convert_for_entry)
+               return ad->targetAtoms[type_index].convert_for_entry(ad, type_index, str);
+       return NULL;
+}
+
+static char *make_close_tag(Eina_List* nodes)
+{
+       CALLED();
+       PTagNode trail;
+       Eina_List *l;
+
+       Eina_Strbuf *tag_str = eina_strbuf_new();
+
+       EINA_LIST_FOREACH(nodes, l, trail)
+       {
+               if (trail->tag)
+               {
+                       if (trail->tag_str)
+                               eina_strbuf_append(tag_str, trail->tag_str);
+                       else
+                       {
+                               eina_strbuf_append(tag_str, "<");
+                               eina_strbuf_append(tag_str, trail->tag);
+                               eina_strbuf_append(tag_str, ">");
+                       }
+               }
+               if (trail->str)
+                       eina_strbuf_append(tag_str, trail->str);
+       }
+
+       char *ret = eina_strbuf_string_steal(tag_str);
+       eina_strbuf_free(tag_str);
+       return ret;
+}
+
+static char *do_not_convert(AppData *ad, int type_index, const char *str)
+{
+       DMSG("str: %s\n", str);
+       if (type_index != ATOM_INDEX_TEXT)
+       {
+               Eina_List *nodeList = NULL;
+               PTagNode nodeData;
+
+               nodeData = _get_start_node(str);
+
+               while (nodeData)
+               {
+                       nodeList = eina_list_append(nodeList, nodeData);
+                       nodeData = _get_next_node(nodeData);
+               }
+
+               _link_match_tags(nodeList);
+
+#ifdef DEBUG
+               _dumpNode(nodeList);
+#endif
+               char *ret = make_close_tag(nodeList);
+               cleanup_tag_list(nodeList);
+               DMSG("convert str: %s\n", ret);
+               return ret;
+       }
+       return strdup(str);
+}
+/*
+   static char *efl_to_efl(AppData *ad, int type_index, const char *str)
+   {
+   CALLED();
+   return NULL;
+   }
+
+   static char *html_to_html(AppData *ad, int type_index, const char *str)
+   {
+   CALLED();
+   return NULL;
+   }
+ */
+
+#define IMAGE_DEFAULT_WIDTH "240"
+#define IMAGE_DEFAULT_HEIGHT "180"
+static char *make_image_path_tag(int type_index, const char *str)
+{
+       char *img_tag_str = "file://%s";
+       char *efl_img_tag = "<item absize="IMAGE_DEFAULT_WIDTH"x"IMAGE_DEFAULT_HEIGHT" href=file://%s>";
+       char *html_img_tag = "<img src=\"file://%s\">";
+
+       switch (type_index)
+       {
+               case ATOM_INDEX_HTML:
+                       img_tag_str = html_img_tag;
+                       break;
+               case ATOM_INDEX_EFL:
+                       img_tag_str = efl_img_tag;
+                       break;
+               case ATOM_INDEX_TEXT:
+               case ATOM_INDEX_IMAGE:
+                       break;
+               default:
+                       DMSG("ERROR: wrong type_index: %d\n", type_index);
+                       return NULL;
+       }
+
+       size_t len = snprintf(NULL, 0, img_tag_str, str) + 1;
+       char *ret = MALLOC(sizeof(char) * len);
+       if (ret)
+               snprintf(ret, len, img_tag_str, str);
+       return ret;
+}
+
+/*
+static char *image_path_to_text(AppData *ad, int type_index, const char *str)
+{
+       DMSG("str: %s\n", str);
+       return make_image_path_tag(ATOM_INDEX_TEXT, str);
+}
+*/
+
+static char *image_path_to_html(AppData *ad, int type_index, const char *str)
+{
+       DMSG("str: %s\n", str);
+       return make_image_path_tag(ATOM_INDEX_HTML, str);
+}
+
+static char *image_path_to_efl(AppData *ad, int type_index, const char *str)
+{
+       DMSG("str: %s\n", str);
+       return make_image_path_tag(ATOM_INDEX_EFL, str);
+}
+
+static char *image_path_to_image_path(AppData *ad, int type_index, const char *str)
+{
+       DMSG("str: %s\n", str);
+       return make_image_path_tag(ATOM_INDEX_IMAGE, str);;
+}
+static char *markup_to_entry(AppData *ad, int type_index, const char *str)
+{
+       CALLED();
+       if (!str)
+               return NULL;
+
+       Eina_Strbuf *strbuf = eina_strbuf_new();
+       if (!strbuf)
+               return strdup(str);
+       eina_strbuf_prepend(strbuf, "<font_size=28><color=#000000FF>");
+
+       const char *trail = str;
+       char *image_tag_str = NULL;
+       char *html_img_tag = "img";
+       char *efl_img_tag = "item";
+       if (type_index == ATOM_INDEX_HTML) /* HTML */
+               image_tag_str = html_img_tag;
+       else if (type_index == ATOM_INDEX_EFL) /* EFL */
+               image_tag_str = efl_img_tag;
+
+       while (trail && *trail)
+       {
+               const char *pretrail = trail;
+               unsigned long length;
+               char *temp;
+               char *endtag;
+
+               trail = strchr(trail, '<');
+               if (!trail)
+               {
+                       eina_strbuf_append(strbuf, pretrail);
+                       break;
+               }
+               endtag = strchr(trail, '>');
+               if (!endtag)
+                       break;
+
+               length = trail - pretrail;
+
+               temp = strndup(pretrail, length);
+               if (!temp)
+               {
+                       trail++;
+                       continue;
+               }
+
+               eina_strbuf_append(strbuf, temp);
+               FREE(temp);
+               trail++;
+
+               if (trail[0] == '/')
+               {
+                       trail = endtag + 1;
+                       continue;
+               }
+
+               if (strncmp(trail, "br", 2) == 0)
+               {
+                       eina_strbuf_append(strbuf, "<br>");
+                       trail = endtag + 1;
+                       continue;
+               }
+
+               if (image_tag_str && strncmp(trail, image_tag_str, strlen(image_tag_str)) == 0)
+               {
+                       char *src = strstr(trail, "file://");
+                       char *src_endtag = strchr(trail, '>');
+                       if (!src || !src_endtag || src_endtag < src)
+                               continue;
+
+                       length = src_endtag - src;
+
+                       src = strndup(src, length);
+                       if (!src)
+                       {
+                               trail = endtag + 1;
+                               continue;
+                       }
+                       temp = src;
+                       while(*temp)
+                       {
+                               if (*temp == '\"' || *temp == '>')
+                                       *temp = '\0';
+                               else
+                                       temp++;
+                       }
+
+                       eina_strbuf_append_printf(strbuf, "<item absize=66x62 href=%s></item>", src);
+                       DTRACE("src str: %s \n", src);
+                       FREE(src);
+               }
+               trail = endtag + 1;
+       }
+
+       if (type_index == ATOM_INDEX_HTML)
+               eina_strbuf_replace_all(strbuf, "&nbsp;", " ");
+
+       char *entry_str = eina_strbuf_string_steal(strbuf);
+       eina_strbuf_free(strbuf);
+       return entry_str;
+}
+
+static char *html_to_entry(AppData *ad, int type_index, const char *str)
+{
+       DMSG("str: %s\n", str);
+       return markup_to_entry(ad, type_index, str);
+}
+
+static char *efl_to_entry(AppData *ad, int type_index, const char *str)
+{
+       DMSG("str: %s\n", str);
+       return markup_to_entry(ad, type_index, str);
+}
+
+static char *image_path_to_entry(AppData *ad, int type_index, const char *str)
+{
+       CALLED();
+       return NULL;
+}
+
+static char *text_to_entry(AppData *ad, int type_index, const char *str)
+{
+       DMSG("str: %s\n", str);
+       char *markup = NULL;
+       markup = (char*)_elm_util_text_to_mkup(str);
+       char *for_entry = markup_to_entry(ad, type_index, markup);
+       FREE(markup);
+       return for_entry;
+}
+
+static Eina_List *make_tag_list(int type_index, const char *str)
+{
+       Eina_List *nodeList = NULL;
+       PTagNode nodeData;
+
+       nodeData = _get_start_node(str);
+
+       while (nodeData)
+       {
+               nodeList = eina_list_append(nodeList, nodeData);
+               nodeData = _get_next_node(nodeData);
+       }
+
+       _link_match_tags(nodeList);
+
+       switch(type_index)
+       {
+               case ATOM_INDEX_EFL:
+                       _set_EFL_tag_data(nodeList);
+                       break;
+               case ATOM_INDEX_HTML:
+                       _set_HTML_tag_data(nodeList);
+                       break;
+               default:
+                       DMSG("wrong index: %d\n");
+       }
+
+#ifdef DEBUG
+       _dumpNode(nodeList);
+#endif
+       return nodeList;
+}
+
+static void cleanup_tag_list(Eina_List *nodeList)
+{
+       Eina_List *trail;
+       PTagNode nodeData;
+
+       EINA_LIST_FOREACH(nodeList, trail, nodeData)
+               _delete_node(nodeData);
+       eina_list_free(nodeList);
+}
+
+static char *html_to_efl(AppData *ad, int type_index, const char *str)
+{
+       CALLED();
+       Eina_List *nodeList = NULL;
+       nodeList = make_tag_list(type_index, str);
+       char *ret = _convert_to_edje(nodeList);
+       DMSG("efl: %s\n", ret);
+       cleanup_tag_list(nodeList);
+
+       return ret;
+}
+
+static char *efl_to_html(AppData *ad, int type_index, const char *str)
+{
+       CALLED();
+       Eina_List *nodeList = NULL;
+       nodeList = make_tag_list(type_index, str);
+       char *ret = _convert_to_html(nodeList);
+       DMSG("html: %s\n", ret);
+       cleanup_tag_list(nodeList);
+
+       return ret;
+}
+
+static char *text_to_html(AppData *ad, int type_index, const char *str)
+{
+       DMSG("str: %s\n", str);
+       char *markup = NULL;
+       markup = (char*)_elm_util_text_to_mkup(str);
+       char *html = efl_to_html(ad, ATOM_INDEX_EFL, markup);
+       FREE(markup);
+       return html;
+}
+
+static char *text_to_efl(AppData *ad, int type_index, const char *str)
+{
+       DMSG("str: %s\n", str);
+       char *ret = NULL;
+       ret = (char*)_elm_util_text_to_mkup(str);
+       return ret;
+}
+
+static char *to_text(AppData *ad, int type_index, const char *str)
+{
+       DMSG("str: %s\n", str);
+       char *text = NULL;
+       if (type_index == ATOM_INDEX_HTML)
+       {
+               Eina_Strbuf *buf = eina_strbuf_new();
+               if (buf)
+               {
+                       char *html;
+                       eina_strbuf_append(buf, str);
+                       eina_strbuf_replace_all(buf, "&nbsp;", " ");
+                       html = eina_strbuf_string_steal(buf);
+                       eina_strbuf_free(buf);
+                       text = (char*)_elm_util_mkup_to_text(html);
+                       free(html);
+                       return text;
+               }
+       }
+
+       text = (char*)_elm_util_mkup_to_text(str);
+       return text;
+}
+
diff --git a/src/xconverter.h b/src/xconverter.h
new file mode 100644 (file)
index 0000000..a4cba4d
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * cbhm
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#ifndef _X_ATOM_H_
+#define _X_ATOM_H_
+
+enum ATOM_INDEX {
+       ATOM_INDEX_TARGET = 0,
+       ATOM_INDEX_TEXT = 1,
+       ATOM_INDEX_HTML = 2,
+       ATOM_INDEX_EFL = 3,
+       ATOM_INDEX_IMAGE = 4,
+       ATOM_INDEX_MAX = 5
+};
+
+#include "cbhm.h"
+
+void init_target_atoms(AppData *ad);
+void depose_target_atoms(AppData *ad);
+int atom_type_index_get(AppData *ad, Ecore_X_Atom atom);
+char *string_for_entry_get(AppData *ad, int type_index, const char *str);
+Eina_Bool generic_converter(AppData *ad, Ecore_X_Atom reqAtom, CNP_ITEM *item, void **data_ret, int *size_ret, Ecore_X_Atom *ttype, int *tsize);
+
+#endif
diff --git a/src/xhandler.c b/src/xhandler.c
new file mode 100644 (file)
index 0000000..7f25356
--- /dev/null
@@ -0,0 +1,902 @@
+/*
+ * cbhm
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#include "xhandler.h"
+#include <X11/Xatom.h>
+#include <X11/Xlib.h>
+
+Eina_Bool cbhm_send_event(AppData *ad, Ecore_X_Window xwin, char *msg)
+{
+       ClipdrawerData *cd = ad->clipdrawer;
+
+       Ecore_X_Atom x_atom_cbhm_msg = ecore_x_atom_get("CBHM_MSG");
+       XClientMessageEvent m;
+       memset(&m, 0, sizeof(m));
+       m.type = ClientMessage;
+       m.display = ecore_x_display_get();
+       m.window = cd->x_main_win;
+       m.message_type = x_atom_cbhm_msg;
+       m.format = 8;
+       snprintf(m.data.b, 20, "%s", msg);
+
+       XSendEvent(ecore_x_display_get(), xwin, False, NoEventMask, (XEvent*)&m);
+
+       ecore_x_sync();
+
+       return EINA_TRUE;
+}
+
+Ecore_X_Window get_selection_owner(AppData *ad, Ecore_X_Selection selection)
+{
+       CALLED();
+       if (!ad) return 0;
+       Ecore_X_Atom sel = 0;
+       switch(selection)
+       {
+               case ECORE_X_SELECTION_SECONDARY:
+                       sel = ECORE_X_ATOM_SELECTION_SECONDARY;
+                       break;
+               case ECORE_X_SELECTION_CLIPBOARD:
+                       sel = ECORE_X_ATOM_SELECTION_CLIPBOARD;
+                       break;
+               default:
+                       return 0;
+       }
+       return XGetSelectionOwner(ad->x_disp, sel);
+}
+
+Eina_Bool is_cbhm_selection_owner(AppData *ad, Ecore_X_Selection selection)
+{
+       CALLED();
+       if (!ad) return EINA_FALSE;
+       Ecore_X_Window sel_owner = get_selection_owner(ad, selection);
+       DMSG("selection_owner: 0x%x, x_event_win: 0x%x \n", sel_owner, ad->x_event_win);
+       if (sel_owner == ad->x_event_win)
+               return EINA_TRUE;
+       return EINA_FALSE;
+}
+
+Eina_Bool set_selection_owner(AppData *ad, Ecore_X_Selection selection, CNP_ITEM *item)
+{
+       CALLED();
+       if (!ad) return EINA_FALSE;
+
+       if (!item && is_cbhm_selection_owner(ad, selection))
+               return EINA_TRUE;
+
+       Ecore_X_Atom sel = 0;
+       Eina_Bool (*selection_func)(Ecore_X_Window win, const void *data, int size) = NULL;
+
+       switch(selection)
+       {
+               case ECORE_X_SELECTION_SECONDARY:
+//                     ecore_x_selection_secondary_clear();
+                       selection_func = ecore_x_selection_secondary_set;
+                       ad->clip_selected_item = item;
+                       break;
+               case ECORE_X_SELECTION_CLIPBOARD:
+//                     ecore_x_selection_clipboard_clear();
+                       selection_func = ecore_x_selection_clipboard_set;
+                       break;
+               default:
+                       return EINA_FALSE;
+       }
+
+       slot_selected_item_set(ad);
+       if (selection_func(ad->x_event_win, NULL, 0))
+               return EINA_TRUE;
+
+       DMSG("ERROR: set selection failed\n");
+       return EINA_FALSE;
+}
+
+static Eina_Bool selection_timer_cb(void *data)
+{
+       CALLED();
+       AppData *ad = data;
+       XHandlerData *xd = ad->xhandler;
+
+       set_selection_owner(ad, ECORE_X_SELECTION_CLIPBOARD, NULL);
+       if (is_cbhm_selection_owner(ad, ECORE_X_SELECTION_CLIPBOARD))
+       {
+               ecore_timer_del(xd->selection_timer);
+               xd->selection_timer = NULL;
+               return ECORE_CALLBACK_CANCEL;
+       }
+       return ECORE_CALLBACK_RENEW;
+}
+
+static Eina_Bool _xsel_clear_cb(void *data, int type, void *event)
+{
+       CALLED();
+       if (!data || !event) return EINA_TRUE;
+       AppData *ad = data;
+       XHandlerData *xd = ad->xhandler;
+       Ecore_X_Event_Selection_Clear *ev = event;
+
+       DMSG("in %s, ev->win: 0x%x\n", __func__, ev->win);
+
+       if (is_cbhm_selection_owner(ad, ev->selection)) return EINA_TRUE;
+       if (ev->selection != ECORE_X_SELECTION_CLIPBOARD)
+               return ECORE_CALLBACK_PASS_ON;
+
+       ecore_x_selection_clipboard_request(ad->x_event_win, ECORE_X_SELECTION_TARGET_TARGETS);
+
+       if (xd->selection_timer)
+       {
+               ecore_timer_del(xd->selection_timer);
+               xd->selection_timer = NULL;
+       }
+       xd->selection_timer = ecore_timer_add(SELECTION_CHECK_TIME, selection_timer_cb, ad);
+
+       return ECORE_CALLBACK_DONE;
+}
+
+static Eina_Bool _xsel_request_cb(void *data, int type, void *event)
+{
+       CALLED();
+       if (!data || !event) return ECORE_CALLBACK_PASS_ON;
+       AppData *ad = data;
+       Ecore_X_Event_Selection_Request *ev = event;
+
+#ifdef DEBUG
+       char *names[3];
+       DMSG("selection_owner: 0x%x, ev->... owner: 0x%x, req: 0x%x, selection: %s, target: %s, property: %s\n",
+                       get_selection_owner(ad, ECORE_X_SELECTION_CLIPBOARD), ev->owner, ev->requestor,
+                       names[0] = ecore_x_atom_name_get(ev->selection),
+                       names[1] = ecore_x_atom_name_get(ev->target),
+                       names[2] = ecore_x_atom_name_get(ev->property));
+       FREE(names[0]);
+       FREE(names[1]);
+       FREE(names[2]);
+#endif
+
+       CNP_ITEM *item = NULL;
+       if (ev->selection == ECORE_X_ATOM_SELECTION_CLIPBOARD)
+               item = item_get_last(ad);
+       else if (ev->selection == ECORE_X_ATOM_SELECTION_SECONDARY)
+               item = ad->clip_selected_item;
+       else
+               return ECORE_CALLBACK_PASS_ON;
+
+       if (!item)
+       {
+               DMSG("has no item\n");
+               ecore_x_selection_notify_send(ev->requestor,
+                               ev->selection,
+                               None,
+                               None,
+                               CurrentTime);
+               DMSG("change property notify\n");
+               ecore_x_flush();
+               return ECORE_CALLBACK_DONE;
+       }
+
+       Ecore_X_Atom property = None;
+       void *data_ret = NULL;
+       int size_ret;
+       Ecore_X_Atom ttype;
+       int tsize;
+
+       if (!generic_converter(ad, ev->target, item, &data_ret, &size_ret, &ttype, &tsize))
+               /*      if (!ecore_x_selection_convert(ev->selection,
+                       ev->target,
+                       &data_ret, &len, &typeAtom, &typesize))*/
+
+       {
+               /* Refuse selection, conversion to requested target failed */
+               DMSG("converter return FALSE\n");
+       }
+       else if (data_ret)
+       {
+               /* FIXME: This does not properly handle large data transfers */
+               ecore_x_window_prop_property_set(
+                               ev->requestor,
+                               ev->property,
+                               ttype,
+                               tsize,
+                               data_ret,
+                               size_ret);
+               property = ev->property;
+               FREE(data_ret);
+               DMSG("change property\n");
+       }
+
+       ecore_x_selection_notify_send(ev->requestor,
+                       ev->selection,
+                       ev->target,
+                       property,
+                       CurrentTime);
+       DMSG("change property notify\n");
+       ecore_x_flush();
+       return ECORE_CALLBACK_DONE;
+}
+
+static void send_convert_selection_target(AppData *ad, Ecore_X_Selection_Data_Targets *targets_data)
+{
+       CALLED();
+       /*      struct _Ecore_X_Selection_Data_Targets {
+               Ecore_X_Selection_Data data;
+               struct _Ecore_X_Selection_Data {
+               enum {
+               ECORE_X_SELECTION_CONTENT_NONE,
+               ECORE_X_SELECTION_CONTENT_TEXT,
+               ECORE_X_SELECTION_CONTENT_FILES,
+               ECORE_X_SELECTION_CONTENT_TARGETS,
+               ECORE_X_SELECTION_CONTENT_CUSTOM
+               } content;
+               unsigned char *data;
+               int            length;
+               int            format;
+               int            (*FREE)(void *data);
+               };
+
+               char                 **targets;
+               int                    num_targets;
+               };*/
+       if (!targets_data || !ad)
+               return;
+       Ecore_X_Atom *atomlist = (Ecore_X_Atom *)targets_data->data.data;
+       if (!atomlist)
+               return;
+
+       DMSG("targets_data->num_targets: 0x%x\n", targets_data->num_targets);
+       int i, j, k;
+       for (i = 0; i < targets_data->num_targets; i++)
+       {
+               DMSG("get target: %s\n", targets_data->targets[i]);
+               for (j = 0; j < ATOM_INDEX_MAX; j++)
+               {
+                       for (k = 0; k < ad->targetAtoms[j].atom_cnt; k++)
+                       {
+                               if (!strcmp(targets_data->targets[i], ad->targetAtoms[j].name[k]))
+                               {
+                                       DMSG("find matched target: %s\n", ad->targetAtoms[j].name[k]);
+                                       ecore_x_selection_clipboard_request(ad->x_event_win, ad->targetAtoms[j].name[k]);
+                                       return;
+                               }
+                       }
+               }
+       }
+       DMSG("ERROR: get target atom failed\n");
+}
+
+static Eina_Bool _add_selection_imagepath(AppData* ad, char *str)
+{
+       if (!ad || !str)
+               return EINA_FALSE;
+       DMSG("get FILE: %s\n", str);
+       char *slash = strchr(str, '/');
+       while (slash && slash[0] == '/')
+       {
+               if (slash[1] != '/')
+               {
+                       char *filepath;
+                       filepath = strdup(slash);
+                       if (filepath)
+                       {
+                               if (ecore_file_exists(filepath))
+                               {
+                                       item_add_by_data(ad, ad->targetAtoms[ATOM_INDEX_IMAGE].atom[0], filepath, strlen(filepath) + 1);
+                                       return EINA_TRUE;
+                               }
+                               else
+                                       FREE(filepath);
+                       }
+                       break;
+               }
+               slash++;
+       }
+       DMSG("Error : it isn't normal file = %s\n", str);
+       return EINA_FALSE;
+}
+
+static void _get_selection_data_files(AppData* ad, Ecore_X_Selection_Data_Files *files_data)
+{
+/*     struct _Ecore_X_Selection_Data_Files {
+               Ecore_X_Selection_Data data;
+               char                 **files;
+               int                    num_files;
+       }; */
+
+       int i;
+       for (i = 0; i < files_data->num_files; i++)
+       {
+               _add_selection_imagepath(ad, files_data->files[i]);
+       }
+}
+
+static Eina_Bool _xsel_notify_cb(void *data, int type, void *event)
+{
+       CALLED();
+       if (!data || !event)
+               return ECORE_CALLBACK_PASS_ON;
+
+       AppData *ad = data;
+       XHandlerData *xd = ad->xhandler;
+       if (xd->selection_timer)
+       {
+               ecore_timer_del(xd->selection_timer);
+               xd->selection_timer = NULL;
+       }
+
+/*     struct _Ecore_X_Event_Selection_Notify
+       {
+               Ecore_X_Window    win;
+               Ecore_X_Time      time;
+               Ecore_X_Selection selection;
+               Ecore_X_Atom      atom;
+               char             *target;
+               void             *data;
+       };*/
+       Ecore_X_Event_Selection_Notify *ev = event;
+
+       switch (ev->selection)
+       {
+               case ECORE_X_SELECTION_CLIPBOARD:
+                       break;
+               case ECORE_X_SELECTION_SECONDARY:
+               case ECORE_X_SELECTION_PRIMARY:
+               case ECORE_X_SELECTION_XDND:
+               default:
+                       return ECORE_CALLBACK_PASS_ON;
+       }
+       if (!ev->data)
+               goto set_clipboard_selection_owner;
+
+/*     struct _Ecore_X_Selection_Data {
+               enum {
+                       ECORE_X_SELECTION_CONTENT_NONE,
+                       ECORE_X_SELECTION_CONTENT_TEXT,
+                       ECORE_X_SELECTION_CONTENT_FILES,
+                       ECORE_X_SELECTION_CONTENT_TARGETS,
+                       ECORE_X_SELECTION_CONTENT_CUSTOM
+               } content;
+               unsigned char *data;
+               int            length;
+               int            format;
+               int            (*FREE)(void *data);
+       };*/
+       Ecore_X_Selection_Data *sel_data = ev->data;
+       switch (sel_data->content)
+       {
+               case ECORE_X_SELECTION_CONTENT_NONE:
+                       DMSG("ECORE_X_SELECTION_CONTENT_NONE\n");
+                       break;
+               case ECORE_X_SELECTION_CONTENT_TEXT:
+                       DMSG("ECORE_X_SELECTION_CONTENT_TEXT\n");
+               /*      struct _Ecore_X_Selection_Data_Text {
+                               Ecore_X_Selection_Data data;
+                               char                  *text;
+                       };
+                       Ecore_X_Selection_Data_Text *text_data = ev->data;*/
+               //      DMSG("sel_data->data: 0x%x, text_data->text: 0x%x\n", sel_data->data, text_data->text);
+                       break;
+               case ECORE_X_SELECTION_CONTENT_FILES:
+                       DMSG("ECORE_X_SELECTION_CONTENT_FILES\n");
+                       _get_selection_data_files(ad, ev->data);
+                       goto set_clipboard_selection_owner;
+                       break;
+               case ECORE_X_SELECTION_CONTENT_TARGETS:
+                       DMSG("ECORE_X_SELECTION_CONTENT_TARGETS\n");
+                       send_convert_selection_target(ad, ev->data);
+                       if (!is_cbhm_selection_owner(ad, ECORE_X_SELECTION_CLIPBOARD))
+                               xd->selection_timer = ecore_timer_add(SELECTION_CHECK_TIME, selection_timer_cb, ad);
+                       return ECORE_CALLBACK_DONE;
+               case ECORE_X_SELECTION_CONTENT_CUSTOM:
+                       DMSG("ECORE_X_SELECTION_CONTENT_CUSTOM\n");
+                       break;
+       }
+#ifdef DEBUG
+       char *name;
+       DMSG("get atom: %d(%s), target: %s, length: %d, format: %d\n",
+                       ev->atom, name = ecore_x_atom_name_get(ev->atom), ev->target, sel_data->length, sel_data->format);
+       FREE(name);
+#endif
+
+       Ecore_X_Atom targetAtom = ecore_x_atom_get(ev->target);
+       char *stripstr = strndup(sel_data->data, sel_data->length);
+       DMSG("get data: %s, len: %d\n", stripstr, strlen(stripstr));
+       if (atom_type_index_get(ad, targetAtom) == ATOM_INDEX_IMAGE)
+       {
+               _add_selection_imagepath(ad, stripstr);
+               FREE(stripstr);
+       }
+       else
+               item_add_by_data(ad, targetAtom, stripstr, strlen(stripstr) + 1);
+
+//     FREE(stripstr);
+
+set_clipboard_selection_owner:
+       set_selection_owner(ad, ECORE_X_SELECTION_CLIPBOARD, NULL);
+       if (!is_cbhm_selection_owner(ad, ECORE_X_SELECTION_CLIPBOARD))
+               xd->selection_timer = ecore_timer_add(SELECTION_CHECK_TIME, selection_timer_cb, ad);
+
+       return ECORE_CALLBACK_DONE;
+}
+
+static Eina_Bool _xclient_msg_cb(void *data, int type, void *event)
+{
+       CALLED();
+       AppData *ad = data;
+       XHandlerData *xd = ad->xhandler;
+
+       /*      struct _Ecore_X_Event_Client_Message {
+               Ecore_X_Window win;
+               Ecore_X_Atom   message_type;
+               int            format;
+               union
+               {
+                       char        b[20];
+                       short       s[10];
+                       long        l[5];
+               } data;
+               Ecore_X_Time   time;
+       };*/
+       Ecore_X_Event_Client_Message *ev = event;
+
+       if (ev->message_type != xd->atomCBHM_MSG)
+               return -1;
+
+       DTRACE("## %s\n", ev->data.b);
+
+/*     Atom cbhm_atoms[ITEM_CNT_MAX];
+       char atomname[10];
+       Ecore_X_Window reqwin = ev->win;*/
+
+       if (strcmp("set_owner", ev->data.b) == 0)
+       {
+               cbhm_send_event(ad, ev->win, "SET_OWNER");
+       }
+       else if (strncmp("show", ev->data.b, 4) == 0)
+       {
+               ad->x_active_win = ev->win;
+               if (ev->data.b[4] == '1')
+                       clipdrawer_paste_textonly_set(ad, EINA_FALSE);
+               else
+                       clipdrawer_paste_textonly_set(ad, EINA_TRUE);
+
+               clipdrawer_activate_view(ad);
+       }
+       else if (!strcmp("cbhm_hide", ev->data.b))
+       {
+               clipdrawer_lower_view(ad);
+       }
+       else if (!strcmp("get count", ev->data.b))
+       {
+               int icount = item_count_get(ad);
+               char countbuf[10];
+               DMSG("## cbhm count : %d\n", icount);
+               snprintf(countbuf, 10, "%d", icount);
+               ecore_x_window_prop_property_set(
+                               ev->win,
+                               xd->atomCBHMCount,
+                               xd->atomUTF8String,
+                               8,
+                               countbuf,
+                               strlen(countbuf)+1);
+       }
+       /* for OSP */
+       else if (strncmp("GET_ITEM", ev->data.b, 8) == 0)
+       {
+               int itempos = 0;
+               int index = 8;
+               xd->atomCBHM_ITEM = ecore_x_atom_get("CBHM_ITEM");
+
+               while ('0' <= ev->data.b[index] && ev->data.b[index] <= '9')
+               {
+                       itempos = (itempos * 10) + (ev->data.b[index] - '0');
+                       index++;
+               }
+
+               CNP_ITEM *item = item_get_by_index(ad, itempos);
+               if (!item)
+               {
+                       Ecore_X_Atom itemtype = ecore_x_atom_get("CBHM_ERROR");
+
+                       char error_buf[] = "OUT OF BOUND";
+                       int bufsize = sizeof(error_buf);
+                       ecore_x_window_prop_property_set(
+                                       ev->win,
+                                       xd->atomCBHM_ITEM,
+                                       itemtype,
+                                       8,
+                                       error_buf,
+                                       bufsize);
+                       DMSG("GET ITEM ERROR msg: %s, index: %d, item count: %d\n",
+                                       ev->data.b, itempos, item_count_get(ad));
+               }
+               else
+               {
+                       ecore_x_window_prop_property_set(
+                                       ev->win,
+                                       xd->atomCBHM_ITEM,
+                                       ad->targetAtoms[item->type_index].atom[0],
+                                       8,
+                                       item->data,
+                                       item->len);
+                       DMSG("GET ITEM index: %d, item type: %d, item data: %s, item->len: %d\n",
+                                       itempos, ad->targetAtoms[item->type_index].atom[0],
+                                       item->data, item->len);
+               }
+       }
+       else if (strncmp("SET_ITEM", ev->data.b, 8) == 0)
+       {
+               int ret = 0;
+               int size_ret = 0;
+               unsigned long num_ret = 0;
+               unsigned long bytes = 0;
+               unsigned char *item_data = NULL;
+               unsigned char *prop_ret = NULL;
+               Ecore_X_Atom format = 0;
+               int i;
+               xd->atomCBHM_ITEM = ecore_x_atom_get("CBHM_ITEM");
+               ret = XGetWindowProperty(ecore_x_display_get(), ad->x_event_win, xd->atomCBHM_ITEM, 0, LONG_MAX, False, ecore_x_window_prop_any_type(),
+                               (Atom*)&format, &size_ret, &num_ret, &bytes, &prop_ret);
+               ecore_x_sync();
+               if (ret != Success)
+               {
+                       DMSG("Failed Set Item\n");
+                       return EINA_FALSE;
+               }
+               if (!num_ret)
+               {
+                       XFree(prop_ret);
+                       return EINA_FALSE;
+               }
+
+               if (!(item_data = malloc(num_ret * size_ret / 8)))
+               {
+                       XFree(item_data);
+                       return EINA_FALSE;
+               }
+
+               switch (size_ret)
+               {
+                       case 8:
+                               for (i = 0; i < num_ret; i++)
+                                       item_data[i] = prop_ret[i];
+                               break;
+                       case 16:
+                               for (i = 0; i < num_ret; i++)
+                                       ((unsigned short *)item_data)[i] = ((unsigned short *)prop_ret)[i];
+                               break;
+                       case 32:
+                               for (i = 0; i < num_ret; i++)
+                                       ((unsigned int *)item_data)[i] = ((unsigned long *)prop_ret)[i];
+                               break;
+               }
+
+               XFree(prop_ret);
+
+               DMSG("item_data:%s format:%s(%d)\n", item_data, ecore_x_atom_name_get(format), format);
+               item_add_by_data(ad, format, item_data, strlen(item_data) + 1);
+       }
+       else if (strncmp("DEL_ITEM", ev->data.b, 8) == 0)
+       {
+               int itempos = 0;
+               int index = 8;
+
+               while ('0' <= ev->data.b[index] && ev->data.b[index] <= '9')
+               {
+                       itempos = (itempos * 10) + (ev->data.b[index] - '0');
+                       index++;
+               }
+
+               item_delete_by_index(ad, itempos);
+       }
+/*     else if (strncmp("get #", ev->data.b, 5) == 0)
+       {
+               // FIXME : handle greater than 9
+               int num = ev->data.b[5] - '0';
+               int cur = get_current_history_position();
+               num = cur + num - 1;
+               if (num > ITEMS_CNT_MAX-1)
+                       num = num-ITEMS_CNT_MAX;
+
+               if (num >= 0 && num < ITEMS_CNT_MAX)
+               {
+                       DTRACE("## pos : #%d\n", num);
+                       // FIXME : handle with correct atom
+                       sprintf(atomname, "CBHM_c%d", num);
+                       cbhm_atoms[0] = XInternAtom(g_disp, atomname, False);
+
+                       CNP_ITEM *item = clipdr;
+
+
+                       if (clipdrawer_get_item_data(ad, num) != NULL)
+                       {
+                               XChangeProperty(g_disp, reqwin, cbhm_atoms[0], atomUTF8String,
+                                                               8, PropModeReplace,
+                                                               (unsigned char *) clipdrawer_get_item_data(ad, num),
+                                                               (int) strlen(clipdrawer_get_item_data(ad, num)));
+                       }
+               }
+       }
+       else if (strcmp("get all", ev->data.b) == 0)
+       {
+//             print_history_buffer();
+               pos = get_current_history_position();
+               for (i = 0; i < 5; i++)
+               {
+                       DTRACE("## %d -> %d\n", i, pos);
+                       sprintf(atomname, "CBHM_c%d", i);
+                       cbhm_atoms[i] = XInternAtom(g_disp, atomname, False);
+                       if (clipdrawer_get_item_data(ad, pos) != NULL)
+                       {
+                               XChangeProperty(g_disp, reqwin, cbhm_atoms[i], atomUTF8String,
+                                                               8, PropModeReplace,
+                                                               (unsigned char *) clipdrawer_get_item_data(ad, pos),
+                                                               (int) strlen(clipdrawer_get_item_data(ad, pos)));
+                       }
+                       pos--;
+                       if (pos < 0)
+                               pos = ITEMS_CNT_MAX-1;
+               }
+       }*/
+/*     else if (strcmp("get raw", ev->data.b) == 0)
+       {
+
+               if (get_storage_start_addr != NULL)
+               {
+                       XChangeProperty(g_disp, reqwin, atomCBHM_cRAW, atomUTF8String,
+                                                       8, PropModeReplace,
+                                                       (unsigned char *) get_storage_start_addr(),
+                                                       (int) get_total_storage_size());
+               }
+       }
+       */
+       XFlush(ad->x_disp);
+
+       return EINA_TRUE;
+}
+
+static Eina_Bool _xfocus_out_cb(void *data, int type, void *event)
+{
+       CALLED();
+       AppData *ad = data;
+       DTRACE("XE:FOCUS OUT\n");
+       clipdrawer_lower_view(ad);
+       return EINA_TRUE;
+}
+
+static Eina_Bool _xproperty_notify_cb(void *data, int type, void *event)
+{
+       CALLED();
+       AppData *ad = data;
+       XHandlerData *xd = ad->xhandler;
+       ClipdrawerData *cd = ad->clipdrawer;
+       Ecore_X_Event_Window_Property *pevent = (Ecore_X_Event_Window_Property *)event;
+
+       if (ad->x_active_win != pevent->win)
+               return EINA_TRUE;
+
+       if (xd->atomWindowRotate == pevent->atom)
+       {
+               int angle = get_active_window_degree(ad->x_active_win);
+               if (angle != cd->o_degree)
+               {
+                       cd->o_degree = angle;
+                       elm_win_rotation_set(cd->main_win, angle);
+                       set_rotation_to_clipdrawer(cd);
+               }
+       }
+
+       return EINA_TRUE;
+}
+
+static Eina_Bool _xwin_destroy_cb(void *data, int type, void *event)
+{
+       CALLED();
+       AppData *ad = data;
+       Ecore_X_Event_Window_Destroy *pevent = event;
+       if (ad->x_active_win != pevent->win)
+               return ECORE_CALLBACK_PASS_ON;
+       clipdrawer_lower_view(ad);
+       return ECORE_CALLBACK_DONE;
+}
+
+XHandlerData *init_xhandler(AppData *ad)
+{
+       XHandlerData *xd = CALLOC(1, sizeof(XHandlerData));
+       if (!xd)
+               return NULL;
+       xd->xsel_clear_handler = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_CLEAR, _xsel_clear_cb, ad);
+       xd->xsel_request_handler = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_REQUEST, _xsel_request_cb, ad);
+       xd->xsel_notify_handler = ecore_event_handler_add(ECORE_X_EVENT_SELECTION_NOTIFY, _xsel_notify_cb, ad);
+       xd->xclient_msg_handler = ecore_event_handler_add(ECORE_X_EVENT_CLIENT_MESSAGE, _xclient_msg_cb, ad);
+       xd->xfocus_out_handler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_FOCUS_OUT, _xfocus_out_cb, ad);
+       xd->xproperty_notify_handler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_PROPERTY, _xproperty_notify_cb, ad);
+       xd->xwindow_destroy_handler = ecore_event_handler_add(ECORE_X_EVENT_WINDOW_DESTROY, _xwin_destroy_cb, ad);
+
+       xd->atomInc = ecore_x_atom_get("INCR");
+       xd->atomWindowRotate = ecore_x_atom_get("_E_ILLUME_ROTATE_WINDOW_ANGLE");
+       xd->atomCBHM_MSG = ecore_x_atom_get("CBHM_MSG");
+       xd->atomCBHM_ITEM = ecore_x_atom_get("CBHM_ITEM");
+       xd->atomXKey_MSG = ecore_x_atom_get("_XKEY_COMPOSITION");
+       xd->atomCBHMCount = ecore_x_atom_get("CBHM_cCOUNT");
+       xd->atomUTF8String = ecore_x_atom_get("UTF8_STRING");
+       xd->atomCBHM_SELECTED_ITEM = ecore_x_atom_get("CBHM_SELECTED_ITEM");
+
+       int i;
+       for (i = 0; i < ITEM_CNT_MAX; i++)
+       {
+               char buf[20];
+               snprintf(buf, sizeof(buf), "CBHM_ITEM%d", i);
+               xd->atomCBHM_ITEM = ecore_x_atom_get(buf);
+       }
+
+       return xd;
+}
+
+void depose_xhandler(XHandlerData *xd)
+{
+       ecore_event_handler_del(xd->xsel_clear_handler);
+       ecore_event_handler_del(xd->xsel_request_handler);
+       ecore_event_handler_del(xd->xsel_notify_handler);
+       ecore_event_handler_del(xd->xclient_msg_handler);
+       ecore_event_handler_del(xd->xfocus_out_handler);
+       ecore_event_handler_del(xd->xproperty_notify_handler);
+       ecore_event_handler_del(xd->xwindow_destroy_handler);
+       FREE(xd);
+}
+
+int get_active_window_degree(Ecore_X_Window active)
+{
+       //ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE
+
+       int rotation = 0;
+       unsigned char *prop_data = NULL;
+       int count;
+       int ret = ecore_x_window_prop_property_get(
+                       active, ECORE_X_ATOM_E_ILLUME_ROTATE_WINDOW_ANGLE,
+                       ECORE_X_ATOM_CARDINAL, 32, &prop_data, &count);
+       if (ret && prop_data) memcpy(&rotation, prop_data, sizeof(int));
+       if (prop_data) FREE(prop_data);
+       return rotation;
+}
+
+void slot_property_set(AppData *ad, int index)
+{
+       XHandlerData *xd = ad->xhandler;
+
+       if (index < 0)
+       {
+               int i = 0;
+               char buf[12];
+               CNP_ITEM *item;
+               Eina_List *l;
+
+               EINA_LIST_FOREACH(ad->item_list, l, item)
+               {
+                       snprintf(buf, sizeof(buf), "CBHM_ITEM%d", i);
+                       xd->atomCBHM_ITEM = ecore_x_atom_get(buf);
+                       if (item)
+                       {
+                               ecore_x_window_prop_property_set(
+                                       ad->x_event_win,
+                                       xd->atomCBHM_ITEM,
+                                       ad->targetAtoms[item->type_index].atom[0],
+                                       8,
+                                       item->data,
+                                       item->len);
+                       DMSG("GET ITEM index: %d, item type: %d, item data: %s, item->len: %d\n",
+                                       i, ad->targetAtoms[item->type_index].atom[0],
+                                       item->data, item->len);
+                       }
+
+                       i++;
+               }
+       }
+       else if (index < ITEM_CNT_MAX)
+       {
+               char buf[12];
+               snprintf(buf, sizeof(buf), "CBHM_ITEM%d", index);
+               xd->atomCBHM_ITEM = ecore_x_atom_get(buf);
+
+               CNP_ITEM *item = item_get_by_index(ad, index);
+               if (!item)
+               {
+                       Ecore_X_Atom itemtype = ecore_x_atom_get("CBHM_ERROR");
+
+                       char error_buf[] = "OUT OF BOUND";
+                       int bufsize = sizeof(error_buf);
+                       ecore_x_window_prop_property_set(
+                                       ad->x_event_win,
+                                       xd->atomCBHM_ITEM,
+                                       itemtype,
+                                       8,
+                                       error_buf,
+                                       bufsize);
+                       DMSG("CBHM Error: index: %d, item count: %d\n",
+                                       index, item_count_get(ad));
+               }
+               else
+               {
+                       ecore_x_window_prop_property_set(
+                                       ad->x_event_win,
+                                       xd->atomCBHM_ITEM,
+                                       ad->targetAtoms[item->type_index].atom[0],
+                                       8,
+                                       item->data,
+                                       item->len);
+                       DMSG("GET ITEM index: %d, item type: %d, item data: %s, item->len: %d\n",
+                                       index, ad->targetAtoms[item->type_index].atom[0],
+                                       item->data, item->len);
+               }
+       }
+       else
+       {
+               DMSG("can't set property\n");
+       }
+}
+
+void slot_item_count_set(AppData *ad)
+{
+       XHandlerData *xd = ad->xhandler;
+
+       int icount = item_count_get(ad);
+       char countbuf[10];
+       snprintf(countbuf, 10, "%d", icount);
+       ecore_x_window_prop_property_set(
+                       ad->x_event_win,
+                       xd->atomCBHMCount,
+                       xd->atomUTF8String,
+                       8,
+                       countbuf,
+                       strlen(countbuf)+1);
+}
+
+void slot_selected_item_set(AppData *ad)
+{
+       XHandlerData *xd = ad->xhandler;
+       CNP_ITEM *item = ad->clip_selected_item;
+
+       if (item)
+       {
+               char buf[20];
+               snprintf(buf, sizeof(buf), "CBHM_SELECTED_ITEM");
+               xd->atomCBHM_SELECTED_ITEM = ecore_x_atom_get(buf);
+
+               ecore_x_window_prop_property_set(
+                               ad->x_event_win,
+                               xd->atomCBHM_SELECTED_ITEM,
+                               ad->targetAtoms[item->type_index].atom[0],
+                               8,
+                               item->data,
+                               item->len);
+       }
+       else
+       {
+               Ecore_X_Atom itemtype = ecore_x_atom_get("CBHM_ERROR");
+
+               char error_buf[] = "NOT EXIST SELECTED ITEM";
+               int bufsize = sizeof(error_buf);
+               ecore_x_window_prop_property_set(
+                               ad->x_event_win,
+                               xd->atomCBHM_SELECTED_ITEM,
+                               itemtype,
+                               8,
+                               error_buf,
+                               bufsize);
+
+       }
+}
+
+
diff --git a/src/xhandler.h b/src/xhandler.h
new file mode 100644 (file)
index 0000000..9f5a439
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * cbhm
+ * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the License);
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an AS IS BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+
+#ifndef _XCNPHANDLER_H_
+#define _XCNPHANDLER_H_
+
+#include <Ecore_X.h>
+#include <Ecore.h>
+
+struct _XHandlerData {
+       Ecore_Event_Handler *xsel_clear_handler;
+       Ecore_Event_Handler *xsel_request_handler;
+       Ecore_Event_Handler *xsel_notify_handler;
+       Ecore_Event_Handler *xclient_msg_handler;
+       Ecore_Event_Handler *xfocus_out_handler;
+       Ecore_Event_Handler *xproperty_notify_handler;
+       Ecore_Event_Handler *xwindow_destroy_handler;
+
+       Ecore_X_Atom atomInc;
+       Ecore_X_Atom atomWindowRotate;
+
+       Ecore_X_Atom atomCBHM_MSG;
+       Ecore_X_Atom atomCBHM_ITEM;
+       Ecore_X_Atom atomXKey_MSG;
+
+       Ecore_X_Atom atomUTF8String;
+       Ecore_X_Atom atomCBHMCount;
+       Ecore_X_Atom atomCBHM_SELECTED_ITEM;
+
+       Ecore_Timer *selection_timer;
+};
+
+#include "cbhm.h"
+#include "item_manager.h"
+#include "xconverter.h"
+
+XHandlerData *init_xhandler(AppData *data);
+void depose_xhandler(XHandlerData *xd);
+Eina_Bool set_selection_owner(AppData *ad, Ecore_X_Selection selection, CNP_ITEM *item);
+void slot_property_set(AppData *ad, int index);
+void slot_item_count_set(AppData *ad);
+void slot_selected_item_set(AppData *ad);
+Eina_Bool cbhm_send_event(AppData *ad, Ecore_X_Window xwin, char *msg);
+
+#define SELECTION_CHECK_TIME 10.0
+
+#endif