Remove a dependency with wayland-scanner and add keyrouter-protocol.* 07/39507/2
authorSung-Jin Park <sj76.park@samsung.com>
Mon, 18 May 2015 01:51:23 +0000 (10:51 +0900)
committerSung-Jin Park <sj76.park@samsung.com>
Mon, 18 May 2015 01:56:09 +0000 (10:56 +0900)
Change-Id: Id1334504d49a3d33663b12b6b4b5c697c0f4dbc6

configure.ac
packaging/e-mod-tizen-keyrouter.spec
protocol/keyrouter-protocol.c [new file with mode: 0644]
protocol/keyrouter-protocol.h [new file with mode: 0644]
src/Makefile.am
src/e_mod_main_wl.c

index 8585f6a..272fcae 100644 (file)
@@ -92,16 +92,7 @@ AC_SUBST(ENLIGHTENMENT_LIBS)
 #AC_MSG_CHECKING([Which edje_cc to use])
 #AC_MSG_RESULT(${EDJE_CC})
 
-dnl ========================================================================
-# checks for the existence of wayland_scanner
-dnl ========================================================================
-AC_PATH_PROG([wayland_scanner], [wayland-scanner])
-if test x$wayland_scanner = x; then
-   AC_MSG_ERROR([wayland-scanner is needed to compile])
-fi
-
-PKG_CHECK_MODULES(WAYLAND_SCANNER, [wayland-scanner])
-PKG_CHECK_MODULES(WAYLAND, [wayland-server wayland-client ecore-wayland])
+PKG_CHECK_MODULES(WAYLAND, [wayland-server])
 
 dnl ========================================================================
 # checks for wayland only argument
index 72e12d2..4acb1a0 100644 (file)
@@ -19,9 +19,7 @@ BuildRequires:  pkgconfig(xrandr)
 BuildRequires:  pkgconfig(utilX)
 %endif
 %if %{with wayland}
-BuildRequires:  pkgconfig(ecore)
 BuildRequires:  pkgconfig(wayland-server)
-#BuildRequires:  pkgconfig(ecore-wayland)
 %endif
 BuildRequires:  pkgconfig(dlog)
 BuildRequires:  e-tizen-data
diff --git a/protocol/keyrouter-protocol.c b/protocol/keyrouter-protocol.c
new file mode 100644 (file)
index 0000000..4fc72fa
--- /dev/null
@@ -0,0 +1,63 @@
+/*
+ * Copyright 2012 Samsung Electronics co., Ltd. All Rights Reserved.
+ * Contact: Sung-Jin Park (sj76.park@samsung.com),
+ * Jeonghyun Kang (jhyuni.kang@samsung.com)
+ *
+ * Permission to use, copy, modify, distribute, and sell this
+ * software and its documentation for any purpose is hereby granted
+ * without fee, provided that the above copyright notice appear in
+ * all copies and that both that copyright notice and this permission
+ * notice appear in supporting documentation, and that the name of
+ * the copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose.  It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+
+#include <stdlib.h>
+#include <stdint.h>
+#include "wayland-util.h"
+
+extern const struct wl_interface wl_surface_interface;
+
+static const struct wl_interface *types[] = {
+       &wl_surface_interface,
+       NULL,
+       NULL,
+       &wl_surface_interface,
+       NULL,
+       &wl_surface_interface,
+       NULL,
+       &wl_surface_interface,
+       NULL,
+       NULL,
+       NULL,
+};
+
+static const struct wl_message wl_keyrouter_requests[] = {
+       { "set_keygrab", "?ouu", types + 0 },
+       { "unset_keygrab", "?ou", types + 3 },
+       { "get_keygrab_status", "?ou", types + 5 },
+};
+
+static const struct wl_message wl_keyrouter_events[] = {
+       { "keygrab_notify", "?ouuu", types + 7 },
+};
+
+WL_EXPORT const struct wl_interface wl_keyrouter_interface = {
+       "wl_keyrouter", 1,
+       3, wl_keyrouter_requests,
+       1, wl_keyrouter_events,
+};
+
diff --git a/protocol/keyrouter-protocol.h b/protocol/keyrouter-protocol.h
new file mode 100644 (file)
index 0000000..ba336c6
--- /dev/null
@@ -0,0 +1,144 @@
+/*
+ * Copyright 2012 Samsung Electronics co., Ltd. All Rights Reserved.
+ * Contact: Sung-Jin Park (sj76.park@samsung.com),
+ * Jeonghyun Kang (jhyuni.kang@samsung.com)
+ *
+ * Permission to use, copy, modify, distribute, and sell this
+ * software and its documentation for any purpose is hereby granted
+ * without fee, provided that the above copyright notice appear in
+ * all copies and that both that copyright notice and this permission
+ * notice appear in supporting documentation, and that the name of
+ * the copyright holders not be used in advertising or publicity
+ * pertaining to distribution of the software without specific,
+ * written prior permission.  The copyright holders make no
+ * representations about the suitability of this software for any
+ * purpose.  It is provided "as is" without express or implied
+ * warranty.
+ *
+ * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
+ * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
+ * FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
+ * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
+ * AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
+ * ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
+ * THIS SOFTWARE.
+ */
+
+#ifndef KEYROUTER_SERVER_PROTOCOL_H
+#define KEYROUTER_SERVER_PROTOCOL_H
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stddef.h>
+#include "wayland-server.h"
+
+struct wl_client;
+struct wl_resource;
+
+struct wl_keyrouter;
+
+extern const struct wl_interface wl_keyrouter_interface;
+
+#ifndef WL_KEYROUTER_ERROR_ENUM
+#define WL_KEYROUTER_ERROR_ENUM
+enum wl_keyrouter_error {
+       WL_KEYROUTER_ERROR_NONE = 0,
+       WL_KEYROUTER_ERROR_INVALID_SURFACE = 1,
+       WL_KEYROUTER_ERROR_INVALID_KEY = 2,
+       WL_KEYROUTER_ERROR_INVALID_MODE = 3,
+       WL_KEYROUTER_ERROR_GRABBED_ALREADY = 4,
+       WL_KEYROUTER_ERROR_NO_PERMISSION = 5,
+       WL_KEYROUTER_ERROR_NO_SYSTEM_RESOURCES = 6,
+};
+#endif /* WL_KEYROUTER_ERROR_ENUM */
+
+#ifndef WL_KEYROUTER_MODE_ENUM
+#define WL_KEYROUTER_MODE_ENUM
+/**
+ * wl_keyrouter_mode - mode for a key grab
+ * @WL_KEYROUTER_MODE_NONE: none
+ * @WL_KEYROUTER_MODE_SHARED: mode to get a key grab with the other
+ *     client surfaces when the focused client surface gets the key
+ * @WL_KEYROUTER_MODE_TOPMOST: mode to get a key grab when the client
+ *     surface is the top most surface
+ * @WL_KEYROUTER_MODE_OVERRIDABLE_EXCLUSIVE: mode to get a key grab
+ *     exclusively, overridably regardless of the order in the surface stack
+ * @WL_KEYROUTER_MODE_EXCLUSIVE: mode to get a key grab exclusively
+ *     regardless of the order in surface stack
+ *
+ * This value is used to set a mode for a key grab. With this mode and
+ * the order of the surface between surfaces' stack, the compositor will
+ * determine the destination client surface.
+ */
+enum wl_keyrouter_mode {
+       WL_KEYROUTER_MODE_NONE = 0,
+       WL_KEYROUTER_MODE_SHARED = 1,
+       WL_KEYROUTER_MODE_TOPMOST = 2,
+       WL_KEYROUTER_MODE_OVERRIDABLE_EXCLUSIVE = 3,
+       WL_KEYROUTER_MODE_EXCLUSIVE = 4,
+};
+#endif /* WL_KEYROUTER_MODE_ENUM */
+
+/**
+ * wl_keyrouter - an interface to set each focus for each key
+ * @set_keygrab: (none)
+ * @unset_keygrab: (none)
+ * @get_keygrab_status: (none)
+ *
+ * In tradition, all the keys in a keyboard and a device on which some
+ * keys are attached will be sent to focus surface by default. Currently
+ * it's possible to set up each focus for each key in a keyboard and a
+ * device. Therefore, by setting a key grab for a surface, the owner of the
+ * surface will get the key event when it has the key grab for the key.
+ */
+struct wl_keyrouter_interface {
+       /**
+        * set_keygrab - (none)
+        * @surface: (none)
+        * @key: (none)
+        * @mode: (none)
+        */
+       void (*set_keygrab)(struct wl_client *client,
+                           struct wl_resource *resource,
+                           struct wl_resource *surface,
+                           uint32_t key,
+                           uint32_t mode);
+       /**
+        * unset_keygrab - (none)
+        * @surface: (none)
+        * @key: (none)
+        */
+       void (*unset_keygrab)(struct wl_client *client,
+                             struct wl_resource *resource,
+                             struct wl_resource *surface,
+                             uint32_t key);
+       /**
+        * get_keygrab_status - (none)
+        * @surface: (none)
+        * @key: (none)
+        */
+       void (*get_keygrab_status)(struct wl_client *client,
+                                  struct wl_resource *resource,
+                                  struct wl_resource *surface,
+                                  uint32_t key);
+};
+
+#define WL_KEYROUTER_KEYGRAB_NOTIFY    0
+
+#define WL_KEYROUTER_KEYGRAB_NOTIFY_SINCE_VERSION      1
+
+static inline void
+wl_keyrouter_send_keygrab_notify(struct wl_resource *resource_, struct wl_resource *surface, uint32_t key, uint32_t mode, uint32_t error)
+{
+       wl_resource_post_event(resource_, WL_KEYROUTER_KEYGRAB_NOTIFY, surface, key, mode, error);
+}
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif
index 64996ad..b683d75 100644 (file)
@@ -8,7 +8,8 @@ pkg_LTLIBRARIES        = module.la
 if WAYLAND_ONLY
 module_la_SOURCES      = e_mod_main_wl.c \
                          e_mod_main_wl.h \
-                         keyrouter-protocol.c
+                         $(top_srcdir)/protocol/keyrouter-protocol.c \
+                         $(top_srcdir)/protocol/keyrouter-protocol.h
 module_la_CFLAGS       = @ENLIGHTENMENT_CFLAGS@ @WAYLAND_CFLAGS@ -DHAVE_WAYLAND_ONLY
 module_la_LDFLAGS      = -module -avoid-version @WAYLAND_LIBS@ @ENLIGHTENMENT_LIBS@
 else
@@ -19,19 +20,3 @@ module_la_CFLAGS       = @ENLIGHTENMENT_CFLAGS@
 module_la_LDFLAGS      = -module -avoid-version @ENLIGHTENMENT_LIBS@
 endif
 module_la_DEPENDENCIES = $(top_builddir)/config.h
-
-#uninstall:
-#  rm -rf $(DESTDIR)$(libdir)/enlightenment/modules/$(MODULE)
-
-if WAYLAND_ONLY
-BUILT_SOURCES = keyrouter-protocol.c keyrouter-protocol.h
-
-CLEANFILES = $(BUILT_SOURCES)
-
-%-protocol.c : $(top_srcdir)/protocol/%.xml
-       $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) code < $< > $@
-
-%-protocol.h : $(top_srcdir)/protocol/%.xml
-       $(AM_V_GEN)$(MKDIR_P) $(dir $@) && $(wayland_scanner) server-header < $< > $@
-
-endif
index eefcb48..ec4e5cc 100644 (file)
@@ -1,7 +1,7 @@
 #define E_COMP_WL
 #include "e.h"
 #include "e_mod_main_wl.h"
-#include "keyrouter-protocol.h"
+#include "protocol/keyrouter-protocol.h"
 #include <string.h>
 
 E_KeyrouterPtr krt;