/******************************************************************************
*
*   image_overlay.h
*
*   Internal interface definitions for overlay buffers for the session image.
*   These buffers are an alternative to subwindows for graphics environments
*   without a suitable windowing system.
*
*   These definitions are available to KVME plugins that implement the
*   draw_overlay() function.
*
*   $Id$
*
*   Copyright 2013 Citrix Systems, Inc. All Rights Reserved.
*
******************************************************************************/
#ifndef _IMAGE_OVERLAY_H_
#define _IMAGE_OVERLAY_H_

enum overlay_buffer_type {Not_Allocated = 0,
                          LVB,     /* Buffer is the session image buffer, being
                                    * shared with the overlay.
                                    * (Not yet implemented.)
                                    */
                          Users,   /* Buffer owned and allocated by user. */
                          Plugins, /* Buffer allocated by KVME plugin. */
                          Malloc}; /* Simple heap or shared memory. */

struct image_overlay {
    SIGNED_RECT                 rect;         /* Overlay position and size. */
    enum overlay_buffer_type    buff_type;    /* Type of buffer. */
    UINT32                      buffer_flags;
    struct special_buffer      *buffer_info;  /* The allocated memory. */
    int                         frame;        /* When double buffers. */
    UINT32                      clip_count;   /* Size of clipping list. */
    SIGNED_RECT                *clips;        /* Clipping list. */
    UINT32                      hwin;         /* Seamless window or 0. */

    /* The remaining members are private to the hosting program (wfica)
     * and subject to change.
     */

    UINT32                      clip_alloc;   /* Clip list allocation. */
    UINT32                      ident;        /* Pseudo-window identifier. */
    struct image_overlay       *next;
    int                       (*prepare)(UINT32 xwin, BOOLEAN lock);
    struct special_buffer       own_buff;     /* We allocated this buffer. */
};

/* Additional values for buffer_flags member (also see subwindow.h). */

#define MM_BUF_INVISIBLE        0x10000       /* Hidden. */
#define MM_BUF_DIRECT           0x20000       /* Drawing bypasses LVB. */
#define MM_USE_PLUGIN           0x40000       /* Use Plug.draw_overlay(). */

#define MM_DRAW_FLAGS           (MM_BUF_DIRECT | MM_USE_PLUGIN)

/* Internal interface function - not for use by plugins. */

BOOLEAN IO_destroy_window(UINT32 hwin, UINT32 xwin);
BOOLEAN IO_clip(UINT32, UINT32, SIGNED_RECT *, BOOLEAN);
BOOLEAN IO_map_window(UINT32 xwin, BOOLEAN visible);
BOOLEAN IO_set_geometry(UINT32 hwin, UINT32 xwin, SIGNED_RECT *rt);
#endif /* _IMAGE_OVERLAY_H_ */
