guacamole-spice-protocol/src/protocols/vnc/display.h

121 lines
4.2 KiB
C

/*
* Copyright (C) 2013 Glyptodon LLC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/
#ifndef GUAC_VNC_DISPLAY_H
#define GUAC_VNC_DISPLAY_H
#include "config.h"
#include <rfb/rfbclient.h>
#include <rfb/rfbproto.h>
/**
* Callback invoked by libVNCServer when it receives a new binary image data.
* the VNC server. The image itself will be stored in the designated sub-
* rectangle of client->framebuffer.
*
* @param client
* The VNC client associated with the VNC session in which the new image
* was received.
*
* @param x
* The X coordinate of the upper-left corner of the destination rectangle
* in which the image should be drawn, in pixels.
*
* @param y
* The Y coordinate of the upper-left corner of the destination rectangle
* in which the image should be drawn, in pixels.
*
* @param w
* The width of the image, in pixels.
*
* @param h
* The height of the image, in pixels.
*/
void guac_vnc_update(rfbClient* client, int x, int y, int w, int h);
/**
* Callback invoked by libVNCServer when it receives a CopyRect message.
* CopyRect specified a rectangle of source data within the display and a
* set of X/Y coordinates to which that rectangle should be copied.
*
* @param client
* The VNC client associated with the VNC session in which the CopyRect
* was received.
*
* @param src_x
* The X coordinate of the upper-left corner of the source rectangle
* from which the image data should be copied, in pixels.
*
* @param src_y
* The Y coordinate of the upper-left corner of the source rectangle
* from which the image data should be copied, in pixels.
*
* @param w
* The width of the source and destination rectangles, in pixels.
*
* @param h
* The height of the source and destination rectangles, in pixels.
*
* @param dest_x
* The X coordinate of the upper-left corner of the destination rectangle
* in which the copied image data should be drawn, in pixels.
*
* @param dest_y
* The Y coordinate of the upper-left corner of the destination rectangle
* in which the copied image data should be drawn, in pixels.
*/
void guac_vnc_copyrect(rfbClient* client, int src_x, int src_y, int w, int h,
int dest_x, int dest_y);
/**
* Sets the pixel format to request of the VNC server. The request will be made
* during the connection handshake with the VNC server using the values
* specified by this function. Note that the VNC server is not required to
* honor this request.
*
* @param client
* The VNC client associated with the VNC session whose desired pixel
* format should be set.
*
* @param color_depth
* The desired new color depth, in bits per pixel. Valid values are 8, 16,
* 24, and 32.
*/
void guac_vnc_set_pixel_format(rfbClient* client, int color_depth);
/**
* Overridden implementation of the rfb_MallocFrameBuffer function invoked by
* libVNCServer when the display is being resized (or initially allocated).
*
* @param client
* The VNC client associated with the VNC session whose display needs to be
* allocated or reallocated.
*
* @return
* The original value returned by rfb_MallocFrameBuffer().
*/
rfbBool guac_vnc_malloc_framebuffer(rfbClient* rfb_client);
#endif