devilhorns pushed a commit to branch devs/devilhorns/wayland.

commit 1f810880f9b19ef27083385ce8e6a870ad993733
Author: Chris Michael <[email protected]>
Date:   Thu Mar 7 12:07:24 2013 +0000

    Add start of the Wayland Desktop Shell code.
    
    When running wayland clients inside E's Compositor, we need a Wayland
    Desktop Shell so that those clients can minimize, maximize, etc, etc.
    We will intercept those messages and pass them along to E eventually.
    
    Signed-off-by: Chris Michael <[email protected]>
---
 src/modules/wl_shell/e_mod_main.c | 198 +++++++++++++++++++++++++++++++++++++-
 src/modules/wl_shell/e_mod_main.h |  12 +++
 2 files changed, 209 insertions(+), 1 deletion(-)

diff --git a/src/modules/wl_shell/e_mod_main.c 
b/src/modules/wl_shell/e_mod_main.c
index 45f56e2..133d046 100644
--- a/src/modules/wl_shell/e_mod_main.c
+++ b/src/modules/wl_shell/e_mod_main.c
@@ -1,12 +1,44 @@
 #include "e.h"
 #include "e_comp_wl.h"
 #include "e_mod_main.h"
+#include "e_desktop_shell_protocol.h"
 
 /* local function prototypes */
+static void _e_wl_shell_cb_destroy(struct wl_listener *listener, void *data);
+static void _e_wl_shell_cb_bind(struct wl_client *client, void *data, unsigned 
int version EINA_UNUSED, unsigned int id);
+static void _e_wl_shell_cb_bind_desktop(struct wl_client *client, void *data, 
unsigned int version EINA_UNUSED, unsigned int id);
+static void _e_wl_shell_cb_unbind_desktop(struct wl_resource *resource);
+static void _e_wl_shell_shell_surface_get(struct wl_client *client, struct 
wl_resource *resource, unsigned int id, struct wl_resource *surf_resource);
+
+static E_Wayland_Shell_Surface *_e_wl_shell_shell_surface_create(void *shell, 
E_Wayland_Surface *ews, const void *client);
+static void _e_wl_shell_shell_surface_toplevel_set(E_Wayland_Shell_Surface 
*ewss);
+static void _e_wl_shell_shell_surface_transient_set(E_Wayland_Shell_Surface 
*ewss, E_Wayland_Surface *ews, int x, int y, unsigned int flags);
+static void _e_wl_shell_shell_surface_fullscreen_set(E_Wayland_Shell_Surface 
*ewss, unsigned int method, unsigned int framerate, void *output);
+static int _e_wl_shell_shell_surface_move(E_Wayland_Shell_Surface *ewss, void 
*seat);
+static int _e_wl_shell_shell_surface_resize(E_Wayland_Shell_Surface *ewss, 
void *seat, unsigned int edges);
+
+static void _e_wl_shell_desktop_background_set(struct wl_client *client, 
struct wl_resource *resource, struct wl_resource *output_resource, struct 
wl_resource *surf_resource);
+static void _e_wl_shell_desktop_panel_set(struct wl_client *client, struct 
wl_resource *resource, struct wl_resource *output_resource, struct wl_resource 
*surf_resource);
+static void _e_wl_shell_desktop_lock_surface_set(struct wl_client *client, 
struct wl_resource *resource, struct wl_resource *surf_resource);
+static void _e_wl_shell_desktop_unlock(struct wl_client *client, struct 
wl_resource *resource);
+static void _e_wl_shell_desktop_grab_surface_set(struct wl_client *client, 
struct wl_resource *resource, struct wl_resource *surf_resource);
 
 /* local variables */
 
-/* wayland interfaces */
+/* local wayland interfaces */
+static const struct wl_shell_interface _e_wl_shell_interface = 
+{
+   _e_wl_shell_shell_surface_get
+};
+
+static const struct e_desktop_shell_interface _e_desktop_shell_interface = 
+{
+   _e_wl_shell_desktop_background_set,
+   _e_wl_shell_desktop_panel_set,
+   _e_wl_shell_desktop_lock_surface_set,
+   _e_wl_shell_desktop_unlock,
+   _e_wl_shell_desktop_grab_surface_set
+};
 
 /* external variables */
 
@@ -15,8 +47,50 @@ EAPI E_Module_Api e_modapi = { E_MODULE_API_VERSION, 
"Wl_Shell" };
 EAPI void *
 e_modapi_init(E_Module *m)
 {
+   E_Wayland_Desktop_Shell *shell;
+
    SLOGFN(__FILE__, __LINE__, __FUNCTION__);
 
+   /* TODO: create a new shell */
+
+   if (!(shell = E_NEW(E_Wayland_Desktop_Shell, 1)))
+     return NULL;
+
+   shell->compositor = _e_wl_comp;
+
+   shell->wl.destroy_listener.notify = _e_wl_shell_cb_destroy;
+   wl_signal_add(&_e_wl_comp->wl.signals.destroy, &shell->wl.destroy_listener);
+
+   /* TODO: set compositor ping handler */
+
+   _e_wl_comp->wl.shell_interface.shell = shell;
+   _e_wl_comp->wl.shell_interface.shell_surface_create = 
+     _e_wl_shell_shell_surface_create;
+   _e_wl_comp->wl.shell_interface.toplevel_set = 
+     _e_wl_shell_shell_surface_toplevel_set;
+   _e_wl_comp->wl.shell_interface.transient_set = 
+     _e_wl_shell_shell_surface_transient_set;
+   _e_wl_comp->wl.shell_interface.fullscreen_set = 
+     _e_wl_shell_shell_surface_fullscreen_set;
+   _e_wl_comp->wl.shell_interface.move = _e_wl_shell_shell_surface_move;
+   _e_wl_comp->wl.shell_interface.resize = _e_wl_shell_shell_surface_resize;
+
+   if (!wl_display_add_global(_e_wl_comp->wl.display, 
+                             &wl_shell_interface, shell, 
+                              _e_wl_shell_cb_bind))
+     {
+        free(shell);
+        return NULL;
+     }
+
+   if (!wl_display_add_global(_e_wl_comp->wl.display, 
+                              &e_desktop_shell_interface, shell, 
+                              _e_wl_shell_cb_bind_desktop))
+     {
+        free(shell);
+        return NULL;
+     }
+
    return m;
 }
 
@@ -37,3 +111,125 @@ e_modapi_save(E_Module *m EINA_UNUSED)
 }
 
 /* local functions */
+static void 
+_e_wl_shell_cb_destroy(struct wl_listener *listener, void *data)
+{
+   E_Wayland_Desktop_Shell *shell = NULL;
+
+   shell = 
+     container_of(listener, E_Wayland_Desktop_Shell, wl.destroy_listener);
+
+   free(shell);
+}
+
+static void 
+_e_wl_shell_cb_bind(struct wl_client *client, void *data, unsigned int version 
EINA_UNUSED, unsigned int id)
+{
+   E_Wayland_Desktop_Shell *shell = NULL;
+
+   SLOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+   if (!(shell = data)) return;
+   wl_client_add_object(client, &wl_shell_interface, 
+                        &_e_wl_shell_interface, id, shell);
+}
+
+static void 
+_e_wl_shell_cb_bind_desktop(struct wl_client *client, void *data, unsigned int 
version EINA_UNUSED, unsigned int id)
+{
+   E_Wayland_Desktop_Shell *shell = NULL;
+   struct wl_resource *resource = NULL;
+
+   SLOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+   if (!(shell = data)) return;
+
+   if (!(resource = 
+         wl_client_add_object(client, &e_desktop_shell_interface, 
+                              &_e_desktop_shell_interface, id, shell)))
+     return;
+
+   resource->destroy = _e_wl_shell_cb_unbind_desktop;
+}
+
+static void 
+_e_wl_shell_cb_unbind_desktop(struct wl_resource *resource)
+{
+   SLOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+   free(resource);
+}
+
+static void 
+_e_wl_shell_shell_surface_get(struct wl_client *client, struct wl_resource 
*resource, unsigned int id, struct wl_resource *surf_resource)
+{
+   SLOGFN(__FILE__, __LINE__, __FUNCTION__);
+}
+
+static E_Wayland_Shell_Surface *
+_e_wl_shell_shell_surface_create(void *shell, E_Wayland_Surface *ews, const 
void *client)
+{
+   SLOGFN(__FILE__, __LINE__, __FUNCTION__);
+
+   return NULL;
+}
+
+static void 
+_e_wl_shell_shell_surface_toplevel_set(E_Wayland_Shell_Surface *ewss)
+{
+   SLOGFN(__FILE__, __LINE__, __FUNCTION__);
+}
+
+static void 
+_e_wl_shell_shell_surface_transient_set(E_Wayland_Shell_Surface *ewss, 
E_Wayland_Surface *ews, int x, int y, unsigned int flags)
+{
+   SLOGFN(__FILE__, __LINE__, __FUNCTION__);
+}
+
+static void 
+_e_wl_shell_shell_surface_fullscreen_set(E_Wayland_Shell_Surface *ewss, 
unsigned int method, unsigned int framerate, void *output)
+{
+   SLOGFN(__FILE__, __LINE__, __FUNCTION__);
+}
+
+static int 
+_e_wl_shell_shell_surface_move(E_Wayland_Shell_Surface *ewss, void *seat)
+{
+   SLOGFN(__FILE__, __LINE__, __FUNCTION__);
+}
+
+static int 
+_e_wl_shell_shell_surface_resize(E_Wayland_Shell_Surface *ewss, void *seat, 
unsigned int edges)
+{
+   SLOGFN(__FILE__, __LINE__, __FUNCTION__);
+}
+
+static void 
+_e_wl_shell_desktop_background_set(struct wl_client *client, struct 
wl_resource *resource, struct wl_resource *output_resource, struct wl_resource 
*surf_resource)
+{
+   SLOGFN(__FILE__, __LINE__, __FUNCTION__);
+}
+
+static void 
+_e_wl_shell_desktop_panel_set(struct wl_client *client, struct wl_resource 
*resource, struct wl_resource *output_resource, struct wl_resource 
*surf_resource)
+{
+   SLOGFN(__FILE__, __LINE__, __FUNCTION__);
+}
+
+static void 
+_e_wl_shell_desktop_lock_surface_set(struct wl_client *client, struct 
wl_resource *resource, struct wl_resource *surf_resource)
+{
+   SLOGFN(__FILE__, __LINE__, __FUNCTION__);
+}
+
+static void 
+_e_wl_shell_desktop_unlock(struct wl_client *client, struct wl_resource 
*resource)
+{
+   SLOGFN(__FILE__, __LINE__, __FUNCTION__);
+}
+
+static void 
+_e_wl_shell_desktop_grab_surface_set(struct wl_client *client, struct 
wl_resource *resource, struct wl_resource *surf_resource)
+{
+   SLOGFN(__FILE__, __LINE__, __FUNCTION__);
+}
diff --git a/src/modules/wl_shell/e_mod_main.h 
b/src/modules/wl_shell/e_mod_main.h
index 876367f..74ce278 100644
--- a/src/modules/wl_shell/e_mod_main.h
+++ b/src/modules/wl_shell/e_mod_main.h
@@ -10,4 +10,16 @@
 #  define SLOGFN(fl, ln, fn)
 # endif
 
+typedef struct _E_Wayland_Desktop_Shell E_Wayland_Desktop_Shell;
+
+struct _E_Wayland_Desktop_Shell
+{
+   E_Wayland_Compositor *compositor;
+
+   struct 
+     {
+        struct wl_listener destroy_listener;
+     } wl;
+};
+
 #endif

-- 

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev

Reply via email to