desktop-shell: Add dummy xdg-shell and update .gitignore
authorJaehoon Jeong <jh01.j@samsung.com>
Thu, 2 Jul 2015 07:08:14 +0000 (16:08 +0900)
committerTaekyun Kim <tkq.kim@samsung.com>
Tue, 7 Jul 2015 06:56:51 +0000 (15:56 +0900)
    - add xdg-shell.c
    - update Makefile.am
    - update .gitignore for protocol related files

Change-Id: Iaa485170cf6f3c55542082d8981ffd6f7a026bd6

.gitignore
desktop-shell/src/Makefile.am
desktop-shell/src/xdg-shell.c [new file with mode: 0644]

index c161da4..a791463 100644 (file)
@@ -25,6 +25,8 @@ ltmain.sh
 missing
 .deps/
 .libs/
+*/protocol/*.c
+*/protocol/*.h
 Makefile
 stamp-h1
 
index 06af7f6..24f55d6 100644 (file)
@@ -4,14 +4,16 @@ include_HEADERS = pepper-desktop-shell.h
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = pepper-desktop-shell.pc
 
-libpepper_desktop_shell_la_CFLAGS = $(PEPPER_DESKTOP_SHELL_CFLAGS)
+libpepper_desktop_shell_la_CFLAGS = $(PEPPER_DESKTOP_SHELL_CFLAGS) -I$(top_srcdir)/protocol/
 libpepper_desktop_shell_la_LIBADD = $(PEPPER_DESKTOP_SHELL_LIBS)
 
 libpepper_desktop_shell_la_SOURCES =            \
         desktop-shell-internal.h  \
         shell.c                   \
         shell-surface.c           \
-        wl-shell.c
+        wl-shell.c                \
+        $(top_srcdir)/protocol/xdg-shell-protocol.c             \
+        xdg-shell.c
 
 # xdg-shell.xml
 xdg_shell_SOURCES  =                       \
diff --git a/desktop-shell/src/xdg-shell.c b/desktop-shell/src/xdg-shell.c
new file mode 100644 (file)
index 0000000..3584c47
--- /dev/null
@@ -0,0 +1,258 @@
+#include "desktop-shell-internal.h"
+#include "xdg-shell-server-protocol.h"
+
+static void
+xdg_surface_destroy(struct wl_client    *client,
+                    struct wl_resource  *resource)
+{
+    /* TODO: */
+}
+
+static void
+xdg_surface_set_parent(struct wl_client     *client,
+                       struct wl_resource   *resource,
+                       struct wl_resource   *parent_resource)
+{
+    /* TODO: */
+}
+
+static void
+xdg_surface_set_app_id(struct wl_client     *client,
+                       struct wl_resource   *resource,
+                       const char           *app_id)
+{
+    /* TODO: */
+}
+
+static void
+xdg_surface_show_window_menu(struct wl_client   *client,
+                             struct wl_resource *surface_resource,
+                             struct wl_resource *seat_resource,
+                             uint32_t            serial,
+                             int32_t             x,
+                             int32_t             y)
+{
+    /* TODO: */
+}
+
+static void
+xdg_surface_set_title(struct wl_client      *client,
+                      struct wl_resource    *resource,
+                      const char            *title)
+{
+    /* TODO: */
+}
+
+static void
+xdg_surface_move(struct wl_client   *client,
+                 struct wl_resource *resource,
+                 struct wl_resource *seat_resource,
+                 uint32_t            serial)
+{
+    /* TODO: */
+}
+
+static void
+xdg_surface_resize(struct wl_client     *client,
+                   struct wl_resource   *resource,
+                   struct wl_resource   *seat_resource,
+                   uint32_t              serial,
+                   uint32_t              edges)
+{
+    /* TODO: */
+}
+
+static void
+xdg_surface_ack_configure(struct wl_client      *client,
+                          struct wl_resource    *resource,
+                          uint32_t               serial)
+{
+    /* TODO: */
+}
+
+static void
+xdg_surface_set_window_geometry(struct wl_client    *client,
+                                struct wl_resource  *resource,
+                                int32_t              x,
+                                int32_t              y,
+                                int32_t              width,
+                                int32_t              height)
+{
+    /* TODO: */
+}
+
+static void
+xdg_surface_set_maximized(struct wl_client      *client,
+                          struct wl_resource    *resource)
+{
+    /* TODO: */
+}
+
+static void
+xdg_surface_unset_maximized(struct wl_client    *client,
+                            struct wl_resource  *resource)
+{
+    /* TODO: */
+}
+
+static void
+xdg_surface_set_fullscreen(struct wl_client     *client,
+                           struct wl_resource   *resource,
+                           struct wl_resource   *output_resource)
+{
+    /* TODO: */
+}
+
+static void
+xdg_surface_unset_fullscreen(struct wl_client   *client,
+                             struct wl_resource *resource)
+{
+    /* TODO: */
+}
+
+static void
+xdg_surface_set_minimized(struct wl_client      *client,
+                          struct wl_resource    *resource)
+{
+    /* TODO: */
+}
+
+static const struct xdg_surface_interface xdg_surface_implementation =
+{
+    xdg_surface_destroy,
+    xdg_surface_set_parent,
+    xdg_surface_set_title,
+    xdg_surface_set_app_id,
+    xdg_surface_show_window_menu,
+    xdg_surface_move,
+    xdg_surface_resize,
+    xdg_surface_ack_configure,
+    xdg_surface_set_window_geometry,
+    xdg_surface_set_maximized,
+    xdg_surface_unset_maximized,
+    xdg_surface_set_fullscreen,
+    xdg_surface_unset_fullscreen,
+    xdg_surface_set_minimized,
+};
+
+static void
+xdg_shell_destroy(struct wl_client   *client,
+                  struct wl_resource *resource)
+{
+    /* TODO: */
+}
+
+static void
+xdg_shell_use_unstable_version(struct wl_client     *client,
+                               struct wl_resource   *resource,
+                               int32_t               version)
+{
+    /* TODO: */
+    if (version != XDG_SHELL_VERSION_CURRENT)
+        PEPPER_ERROR("wl_client@%p want bad XDG_SHELL version %d\n", client, version);
+}
+
+static void
+xdg_shell_get_xdg_surface(struct wl_client      *client,
+                          struct wl_resource    *resource,
+                          uint32_t               id,
+                          struct wl_resource    *surface_resource)
+{
+    shell_client_t     *shell_client = wl_resource_get_user_data(resource);
+    pepper_object_t    *surface      = wl_resource_get_user_data(surface_resource);
+    shell_surface_t    *shsurf;
+
+    if (!pepper_surface_set_role(surface, "xdg_surface"))
+    {
+        wl_resource_post_error(resource, XDG_SHELL_ERROR_ROLE,
+                               "Assign \"xdg_surface\" to wl_surface failed\n");
+        return ;
+    }
+
+    /* TODO: */
+
+    shsurf = shell_surface_create(shell_client, surface, client, &xdg_surface_interface,
+                                  &xdg_surface_implementation, 1, id);
+    if (!shsurf)
+        wl_client_post_no_memory(client);
+}
+
+static void
+xdg_popup_destroy(struct wl_client *client,
+                  struct wl_resource *resource)
+{
+    /* TODO: */
+    wl_resource_destroy(resource);
+}
+
+static const struct xdg_popup_interface xdg_popup_implementation =
+{
+    xdg_popup_destroy,
+};
+
+static void
+xdg_shell_get_xdg_popup(struct wl_client    *client,
+                        struct wl_resource  *resource,
+                        uint32_t             id,
+                        struct wl_resource  *surface_resource,
+                        struct wl_resource  *parent_resource,
+                        struct wl_resource  *seat_resource,
+                        uint32_t             serial,
+                        int32_t              x,
+                        int32_t              y)
+{
+    shell_client_t     *shell_client = wl_resource_get_user_data(resource);
+    pepper_object_t    *surface      = wl_resource_get_user_data(surface_resource);
+    shell_surface_t    *shsurf;
+
+    if (!pepper_surface_set_role(surface, "xdg_popup"))
+    {
+        wl_resource_post_error(resource, XDG_SHELL_ERROR_ROLE,
+                               "Assign \"xdg_popup\" to wl_surface failed\n");
+        return ;
+    }
+
+    /* TODO: */
+
+    shsurf = shell_surface_create(shell_client, surface, client, &xdg_popup_interface,
+                                  &xdg_popup_implementation, 1, id);
+    if (!shsurf)
+        wl_client_post_no_memory(client);
+}
+
+static void
+xdg_shell_pong(struct wl_client     *client,
+               struct wl_resource   *resource,
+               uint32_t              serial)
+{
+    /* TODO: */
+}
+
+static const struct xdg_shell_interface xdg_shell_implementation =
+{
+    xdg_shell_destroy,
+    xdg_shell_use_unstable_version,
+    xdg_shell_get_xdg_surface,
+    xdg_shell_get_xdg_popup,
+    xdg_shell_pong
+};
+
+static void
+bind_xdg_shell(struct wl_client *client, void *data, uint32_t version, uint32_t id)
+{
+    shell_client_create((desktop_shell_t *)data, client,
+                        &xdg_shell_interface, &xdg_shell_implementation, version, id);
+}
+
+pepper_bool_t
+init_xdg_shell(desktop_shell_t *shell)
+{
+    struct wl_display  *display = pepper_compositor_get_display(shell->compositor);
+    struct wl_global   *global;
+
+    global = wl_global_create(display, &xdg_shell_interface, 1, shell, bind_xdg_shell);
+    if (!global)
+        return PEPPER_FALSE;
+
+    return PEPPER_TRUE;
+}