[Spice-devel] [PATCH spice-protocol 1/2] Add foreign menu protocol

Hans de Goede hdegoede at redhat.com
Mon Oct 18 01:19:37 PDT 2010


Ack.

On 10/18/2010 10:13 AM, Arnon Gilboa wrote:
> ---
>   spice/Makefile.am         |    1 +
>   spice/foreign_menu_prot.h |  107 +++++++++++++++++++++++++++++++++++++++++++++
>   2 files changed, 108 insertions(+), 0 deletions(-)
>   create mode 100644 spice/foreign_menu_prot.h
>
> diff --git a/spice/Makefile.am b/spice/Makefile.am
> index e552cf4..60ddb58 100644
> --- a/spice/Makefile.am
> +++ b/spice/Makefile.am
> @@ -7,6 +7,7 @@ spice_protocol_include_HEADERS=		\
>   	end-packed.h	\
>   	enums.h	\
>   	error_codes.h	\
> +	foreign_menu_prot.h	\
>   	ipc_ring.h	\
>   	protocol.h	\
>   	macros.h	\
> diff --git a/spice/foreign_menu_prot.h b/spice/foreign_menu_prot.h
> new file mode 100644
> index 0000000..8c22461
> --- /dev/null
> +++ b/spice/foreign_menu_prot.h
> @@ -0,0 +1,107 @@
> +/*
> +   Copyright (C) 2009 Red Hat, Inc.
> +
> +   This library is free software; you can redistribute it and/or
> +   modify it under the terms of the GNU Lesser General Public
> +   License as published by the Free Software Foundation; either
> +   version 2.1 of the License, or (at your option) any later version.
> +
> +   This library is distributed in the hope that it will be useful,
> +   but WITHOUT ANY WARRANTY; without even the implied warranty of
> +   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
> +   Lesser General Public License for more details.
> +
> +   You should have received a copy of the GNU Lesser General Public
> +   License along with this library; if not, see<http://www.gnu.org/licenses/>.
> +*/
> +
> +#ifndef _H_FOREIGN_MENU_PROT
> +#define _H_FOREIGN_MENU_PROT
> +
> +#define FOREIGN_MENU_MAGIC      (*(uint32_t*)"FRGM")
> +#define FOREIGN_MENU_VERSION    1
> +
> +#ifdef __GNUC__
> +#define ATTR_PACKED __attribute__ ((__packed__))
> +#else
> +#define ATTR_PACKED __declspec(align(1))
> +#endif
> +
> +typedef struct ATTR_PACKED FrgMenuInitHeader {
> +    uint32_t magic;
> +    uint32_t version;
> +    uint32_t size;
> +} FrgMenuInitHeader;
> +
> +typedef struct ATTR_PACKED FrgMenuInit {
> +    FrgMenuInitHeader base;
> +    uint64_t credentials;
> +    uint8_t title[0]; //UTF8
> +} FrgMenuInit;
> +
> +typedef struct ATTR_PACKED FrgMenuMsg {
> +    uint32_t id;
> +    uint32_t size;
> +} FrgMenuMsg;
> +
> +enum {
> +    //extrenal app ->  spice client
> +    FOREIGN_MENU_SET_TITLE = 1,
> +    FOREIGN_MENU_ADD_ITEM,
> +    FOREIGN_MENU_MODIFY_ITEM,
> +    FOREIGN_MENU_REMOVE_ITEM,
> +    FOREIGN_MENU_CLEAR,
> +
> +    //spice client ->  external app
> +    FOREIGN_MENU_ITEM_EVENT = 1001,
> +    FOREIGN_MENU_APP_ACTIVATED,
> +    FOREIGN_MENU_APP_DEACTIVATED,
> +};
> +
> +typedef struct ATTR_PACKED FrgMenuSetTitle {
> +    FrgMenuMsg base;
> +    uint8_t string[0]; //UTF8
> +} FrgMenuSetTitle;
> +
> +enum {
> +    FOREIGN_MENU_ITEM_TYPE_CHECKED      = 1<<  0,
> +    FOREIGN_MENU_ITEM_TYPE_DIM          = 1<<  1,
> +    FOREIGN_MENU_ITEM_TYPE_SEPARATOR    = 1<<  2
> +};
> +
> +#define FOREIGN_MENU_INVALID_ID 0
> +
> +typedef struct ATTR_PACKED FrgMenuAddItem {
> +    FrgMenuMsg base;
> +    uint32_t id;
> +    uint32_t type;
> +    uint32_t position;
> +    uint8_t string[0]; //UTF8
> +} FrgMenuAddItem, FrgMenuModItem;
> +
> +typedef struct ATTR_PACKED FrgMenuRmItem {
> +    FrgMenuMsg base;
> +    uint32_t id;
> +} FrgMenuRmItem;
> +
> +typedef struct FrgMenuMsg FrgMenuRmItems;
> +typedef struct FrgMenuMsg FrgMenuDelete;
> +
> +enum {
> +    FOREIGN_MENU_EVENT_CLICK,
> +    FOREIGN_MENU_EVENT_CHECKED,
> +    FOREIGN_MENU_EVENT_UNCHECKED
> +};
> +
> +typedef struct ATTR_PACKED FrgMenuEvent {
> +    FrgMenuMsg base;
> +    uint32_t id;
> +    uint32_t action; //FOREIGN_MENU_EVENT_?
> +} FrgMenuEvent;
> +
> +typedef struct FrgMenuMsg FrgMenuActivate;
> +typedef struct FrgMenuMsg FrgMenuDeactivate;
> +
> +#undef ATTR_PACKED
> +
> +#endif


More information about the Spice-devel mailing list