Add start of wl_desktop_shell module code.

Signed-off-by: Chris Michael <cp.michael@samsung.com>
This commit is contained in:
Chris Michael 2013-04-09 13:16:42 +01:00
parent 45b13b243f
commit 550dd3c17f
6 changed files with 301 additions and 0 deletions

View File

@ -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>

View File

@ -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,
};

View File

@ -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

View File

@ -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

View File

@ -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