devilhorns pushed a commit to branch master.

commit 550dd3c17fe909e18e8eaf9f73b6eb97b9e5d8d0
Author: Chris Michael <[email protected]>
Date:   Tue Apr 9 13:16:42 2013 +0100

    Add start of wl_desktop_shell module code.
    
    Signed-off-by: Chris Michael <[email protected]>
---
 src/modules/wl_desktop_shell/e-desktop-shell.xml   |  79 ++++++++++++++
 .../wl_desktop_shell/e-module-wl_desktop_shell.edj | Bin 0 -> 13048 bytes
 .../wl_desktop_shell/e_desktop_shell_protocol.c    |  60 +++++++++++
 .../wl_desktop_shell/e_desktop_shell_protocol.h    | 117 +++++++++++++++++++++
 src/modules/wl_desktop_shell/e_mod_main.h          |  39 +++++++
 src/modules/wl_desktop_shell/module.desktop.in     |   6 ++
 6 files changed, 301 insertions(+)

diff --git a/src/modules/wl_desktop_shell/e-desktop-shell.xml 
b/src/modules/wl_desktop_shell/e-desktop-shell.xml
new file mode 100644
index 0000000..0421eb5
--- /dev/null
+++ b/src/modules/wl_desktop_shell/e-desktop-shell.xml
@@ -0,0 +1,79 @@
+<protocol name="desktop">
+
+  <interface name="e_desktop_shell" version="1">
+    <request name="set_background">
+      <arg name="output" type="object" interface="wl_output"/>
+      <arg name="surface" type="object" interface="wl_surface"/>
+    </request>
+
+    <request name="set_panel">
+      <arg name="output" type="object" interface="wl_output"/>
+      <arg name="surface" type="object" interface="wl_surface"/>
+    </request>
+
+    <request name="set_lock_surface">
+      <arg name="surface" type="object" interface="wl_surface"/>
+    </request>
+
+    <request name="unlock"/>
+
+    <request name="set_grab_surface">
+      <arg name="surface" type="object" interface="wl_surface"/>
+    </request>
+
+    <!-- We'll fold most of wl_shell into this interface and then
+         they'll share the configure event.  -->
+    <event name="configure">
+      <arg name="edges" type="uint"/>
+      <arg name="surface" type="object" interface="wl_surface"/>
+      <arg name="width" type="int"/>
+      <arg name="height" type="int"/>
+    </event>
+
+    <!-- Tell the shell we want it to create and set the lock surface,
+         which is a GUI asking the user to unlock the screen. The lock
+         surface is announced with 'set_lock_surface'. Whether or not
+         the shell actually implements locking, it MUST send 'unlock'
+         request to let the normal desktop resume. -->
+    <event name="prepare_lock_surface"/>
+    <event name="grab_cursor">
+      <arg name="cursor" type="uint"/>
+    </event>
+
+    <enum name="cursor">
+      <entry name="none" value="0"/>
+
+      <entry name="resize_top" value="1"/>
+      <entry name="resize_bottom" value="2"/>
+
+      <entry name="arrow" value="3"/>
+
+      <entry name="resize_left" value="4"/>
+      <entry name="resize_top_left" value="5"/>
+      <entry name="resize_bottom_left" value="6"/>
+
+      <entry name="move" value="7"/>
+
+      <entry name="resize_right" value="8"/>
+      <entry name="resize_top_right" value="9"/>
+      <entry name="resize_bottom_right" value="10"/>
+
+      <entry name="busy" value="11"/>
+    </enum>
+
+  </interface>
+
+  <!-- Only one client can bind this interface at a time. -->
+  <interface name="screensaver" version="1">
+
+    <!-- Set the surface type as a screensaver for a particular output.
+         A screensaver surface is normally hidden, and only visible after
+         an idle timeout. -->
+    <request name="set_surface">
+      <arg name="surface" type="object" interface="wl_surface"/>
+      <arg name="output" type="object" interface="wl_output"/>
+    </request>
+
+  </interface>
+
+</protocol>
diff --git a/src/modules/wl_desktop_shell/e-module-wl_desktop_shell.edj 
b/src/modules/wl_desktop_shell/e-module-wl_desktop_shell.edj
new file mode 100644
index 0000000..2c1f4d2
Binary files /dev/null and 
b/src/modules/wl_desktop_shell/e-module-wl_desktop_shell.edj differ
diff --git a/src/modules/wl_desktop_shell/e_desktop_shell_protocol.c 
b/src/modules/wl_desktop_shell/e_desktop_shell_protocol.c
new file mode 100644
index 0000000..98d56a1
--- /dev/null
+++ b/src/modules/wl_desktop_shell/e_desktop_shell_protocol.c
@@ -0,0 +1,60 @@
+#include <stdlib.h>
+#include <stdint.h>
+#include "wayland-util.h"
+
+extern const struct wl_interface wl_output_interface;
+extern const struct wl_interface wl_surface_interface;
+extern const struct wl_interface wl_output_interface;
+extern const struct wl_interface wl_surface_interface;
+extern const struct wl_interface wl_surface_interface;
+extern const struct wl_interface wl_surface_interface;
+extern const struct wl_interface wl_surface_interface;
+extern const struct wl_interface wl_surface_interface;
+extern const struct wl_interface wl_output_interface;
+
+static const struct wl_interface *types[] = {
+       NULL,
+       &wl_output_interface,
+       &wl_surface_interface,
+       &wl_output_interface,
+       &wl_surface_interface,
+       &wl_surface_interface,
+       &wl_surface_interface,
+       NULL,
+       &wl_surface_interface,
+       NULL,
+       NULL,
+       &wl_surface_interface,
+       &wl_output_interface,
+};
+
+static const struct wl_message e_desktop_shell_requests[] = {
+       { "set_background", "oo", types + 1 },
+       { "set_panel", "oo", types + 3 },
+       { "set_lock_surface", "o", types + 5 },
+       { "unlock", "", types + 0 },
+       { "set_grab_surface", "o", types + 6 },
+};
+
+static const struct wl_message e_desktop_shell_events[] = {
+       { "configure", "uoii", types + 7 },
+       { "prepare_lock_surface", "", types + 0 },
+       { "grab_cursor", "u", types + 0 },
+};
+
+WL_EXPORT const struct wl_interface e_desktop_shell_interface = {
+       "e_desktop_shell", 1,
+       5, e_desktop_shell_requests,
+       3, e_desktop_shell_events,
+};
+
+static const struct wl_message screensaver_requests[] = {
+       { "set_surface", "oo", types + 11 },
+};
+
+WL_EXPORT const struct wl_interface screensaver_interface = {
+       "screensaver", 1,
+       1, screensaver_requests,
+       0, NULL,
+};
+
diff --git a/src/modules/wl_desktop_shell/e_desktop_shell_protocol.h 
b/src/modules/wl_desktop_shell/e_desktop_shell_protocol.h
new file mode 100644
index 0000000..61bb3f3
--- /dev/null
+++ b/src/modules/wl_desktop_shell/e_desktop_shell_protocol.h
@@ -0,0 +1,117 @@
+#ifndef DESKTOP_SERVER_PROTOCOL_H
+#define DESKTOP_SERVER_PROTOCOL_H
+
+#ifdef  __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+#include <stddef.h>
+#include "wayland-util.h"
+
+struct wl_client;
+struct wl_resource;
+
+/* struct e_desktop_shell; */
+/* struct screensaver; */
+
+extern const struct wl_interface e_desktop_shell_interface;
+extern const struct wl_interface screensaver_interface;
+
+#ifndef E_DESKTOP_SHELL_CURSOR_ENUM
+#define E_DESKTOP_SHELL_CURSOR_ENUM
+enum e_desktop_shell_cursor {
+       E_DESKTOP_SHELL_CURSOR_NONE = 0,
+       E_DESKTOP_SHELL_CURSOR_RESIZE_TOP = 1,
+       E_DESKTOP_SHELL_CURSOR_RESIZE_BOTTOM = 2,
+       E_DESKTOP_SHELL_CURSOR_ARROW = 3,
+       E_DESKTOP_SHELL_CURSOR_RESIZE_LEFT = 4,
+       E_DESKTOP_SHELL_CURSOR_RESIZE_TOP_LEFT = 5,
+       E_DESKTOP_SHELL_CURSOR_RESIZE_BOTTOM_LEFT = 6,
+       E_DESKTOP_SHELL_CURSOR_MOVE = 7,
+       E_DESKTOP_SHELL_CURSOR_RESIZE_RIGHT = 8,
+       E_DESKTOP_SHELL_CURSOR_RESIZE_TOP_RIGHT = 9,
+       E_DESKTOP_SHELL_CURSOR_RESIZE_BOTTOM_RIGHT = 10,
+       E_DESKTOP_SHELL_CURSOR_BUSY = 11,
+};
+#endif /* E_DESKTOP_SHELL_CURSOR_ENUM */
+
+struct e_desktop_shell_interface {
+       /**
+        * set_background - (none)
+        * @output: (none)
+        * @surface: (none)
+        */
+       void (*set_background)(struct wl_client *client,
+                              struct wl_resource *resource,
+                              struct wl_resource *output,
+                              struct wl_resource *surface);
+       /**
+        * set_panel - (none)
+        * @output: (none)
+        * @surface: (none)
+        */
+       void (*set_panel)(struct wl_client *client,
+                         struct wl_resource *resource,
+                         struct wl_resource *output,
+                         struct wl_resource *surface);
+       /**
+        * set_lock_surface - (none)
+        * @surface: (none)
+        */
+       void (*set_lock_surface)(struct wl_client *client,
+                                struct wl_resource *resource,
+                                struct wl_resource *surface);
+       /**
+        * unlock - (none)
+        */
+       void (*unlock)(struct wl_client *client,
+                      struct wl_resource *resource);
+       /**
+        * set_grab_surface - (none)
+        * @surface: (none)
+        */
+       void (*set_grab_surface)(struct wl_client *client,
+                                struct wl_resource *resource,
+                                struct wl_resource *surface);
+};
+
+#define E_DESKTOP_SHELL_CONFIGURE      0
+#define E_DESKTOP_SHELL_PREPARE_LOCK_SURFACE   1
+#define E_DESKTOP_SHELL_GRAB_CURSOR    2
+
+static inline void
+e_desktop_shell_send_configure(struct wl_resource *resource_, uint32_t edges, 
struct wl_resource *surface, int32_t width, int32_t height)
+{
+       wl_resource_post_event(resource_, E_DESKTOP_SHELL_CONFIGURE, edges, 
surface, width, height);
+}
+
+static inline void
+e_desktop_shell_send_prepare_lock_surface(struct wl_resource *resource_)
+{
+       wl_resource_post_event(resource_, E_DESKTOP_SHELL_PREPARE_LOCK_SURFACE);
+}
+
+static inline void
+e_desktop_shell_send_grab_cursor(struct wl_resource *resource_, uint32_t 
cursor)
+{
+       wl_resource_post_event(resource_, E_DESKTOP_SHELL_GRAB_CURSOR, cursor);
+}
+
+struct screensaver_interface {
+       /**
+        * set_surface - (none)
+        * @surface: (none)
+        * @output: (none)
+        */
+       void (*set_surface)(struct wl_client *client,
+                           struct wl_resource *resource,
+                           struct wl_resource *surface,
+                           struct wl_resource *output);
+};
+
+#ifdef  __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/modules/wl_desktop_shell/e_mod_main.h 
b/src/modules/wl_desktop_shell/e_mod_main.h
new file mode 100644
index 0000000..29dc63e
--- /dev/null
+++ b/src/modules/wl_desktop_shell/e_mod_main.h
@@ -0,0 +1,39 @@
+#ifndef E_MOD_MAIN_H
+# define E_MOD_MAIN_H
+
+# define SLOGFNS 1
+
+# ifdef SLOGFNS
+#  include <stdio.h>
+#  define SLOGFN(fl, ln, fn) printf("-E-SHELL: %25s: %5i - %s\n", fl, ln, fn);
+# else
+#  define SLOGFN(fl, ln, fn)
+# endif
+
+typedef struct _E_Wayland_Desktop_Shell E_Wayland_Desktop_Shell;
+typedef struct _E_Wayland_Ping_Timer E_Wayland_Ping_Timer;
+
+struct _E_Wayland_Desktop_Shell
+{
+   E_Wayland_Compositor *compositor;
+   E_Wayland_Surface *grab_surface;
+
+   struct 
+     {
+        struct wl_resource *resource;
+        struct wl_listener destroy_listener;
+     } wl;
+};
+
+struct _E_Wayland_Ping_Timer 
+{
+   struct wl_event_source *source;
+   unsigned int serial;
+};
+
+EAPI extern E_Module_Api e_modapi;
+
+EAPI void *e_modapi_init(E_Module *m);
+EAPI int e_modapi_shutdown(E_Module *m);
+
+#endif
diff --git a/src/modules/wl_desktop_shell/module.desktop.in 
b/src/modules/wl_desktop_shell/module.desktop.in
new file mode 100644
index 0000000..78baef9
--- /dev/null
+++ b/src/modules/wl_desktop_shell/module.desktop.in
@@ -0,0 +1,6 @@
+[Desktop Entry]
+Type=Link
+Name=Wayland Desktop Shell
+Icon=e-module-wl_desktop_shell
+Comment=Enlightenment Wayland Desktop Shell
+X-Enlightenment-ModuleType=look

-- 

------------------------------------------------------------------------------
Precog is a next-generation analytics platform capable of advanced
analytics on semi-structured data. The platform includes APIs for building
apps and a phenomenal toolset for data science. Developers can use
our toolset for easy data analysis & visualization. Get a free account!
http://www2.precog.com/precogplatform/slashdotnewsletter

Reply via email to