FreeRDP
uwac-display.c File Reference
#include "uwac-priv.h"
#include "uwac-utils.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdarg.h>
#include <assert.h>
#include <errno.h>
#include <time.h>
#include <unistd.h>
#include <sys/epoll.h>
#include "uwac-os.h"

Macros

#define TARGET_COMPOSITOR_INTERFACE   3
 
#define TARGET_SHM_INTERFACE   1
 
#define TARGET_SHELL_INTERFACE   1
 
#define TARGET_DDM_INTERFACE   1
 
#define TARGET_SEAT_INTERFACE   5
 
#define TARGET_XDG_VERSION   5 /* The version of xdg-shell that we implement */
 

Functions

bool uwac_default_error_handler (UwacDisplay *display, UwacReturnCode code, const char *msg,...)
 
void UwacInstallErrorHandler (UwacErrorHandler handler)
 
static void cb_shm_format (void *data, struct wl_shm *wl_shm, uint32_t format)
 
static void xdg_shell_ping (void *data, struct xdg_shell *shell, uint32_t serial)
 
static void display_destroy_seat (UwacDisplay *d, uint32_t name)
 
static void registry_handle_global (void *data, struct wl_registry *registry, uint32_t id, const char *interface, uint32_t version)
 
static void registry_handle_global_remove (void *data, struct wl_registry *registry, uint32_t name)
 
void UwacDestroyGlobal (UwacGlobal *global)
 
voiddisplay_bind (UwacDisplay *display, uint32_t name, const struct wl_interface *interface, uint32_t version)
 
int UwacDisplayWatchFd (UwacDisplay *display, int fd, uint32_t events, UwacTask *task)
 
void UwacDisplayUnwatchFd (UwacDisplay *display, int fd)
 
static void display_exit (UwacDisplay *display)
 
static void display_dispatch_events (UwacTask *task, uint32_t events)
 
UwacDisplay * UwacOpenDisplay (const char *name, UwacReturnCode *err)
 
int UwacDisplayDispatch (UwacDisplay *display, int timeout)
 
UwacReturnCode UwacDisplayGetLastError (const UwacDisplay *display)
 
UwacReturnCode UwacCloseDisplay (UwacDisplay **pdisplay)
 
int UwacDisplayGetFd (UwacDisplay *display)
 
const char * UwacErrorString (UwacReturnCode error)
 
UwacReturnCode UwacDisplayQueryInterfaceVersion (const UwacDisplay *display, const char *name, uint32_t *version)
 
uint32_t UwacDisplayQueryGetNbShmFormats (UwacDisplay *display)
 
UwacReturnCode UwacDisplayQueryShmFormats (const UwacDisplay *display, enum wl_shm_format *formats, int formats_size, int *filled)
 
uint32_t UwacDisplayGetNbOutputs (UwacDisplay *display)
 
UwacOutput * UwacDisplayGetOutput (UwacDisplay *display, int index)
 
UwacReturnCode UwacOutputGetResolution (UwacOutput *output, UwacSize *resolution)
 
UwacEvent * UwacDisplayNewEvent (UwacDisplay *display, int type)
 
bool UwacHasEvent (UwacDisplay *display)
 
UwacReturnCode UwacNextEvent (UwacDisplay *display, UwacEvent *event)
 

Variables

static const char * event_names []
 
UwacErrorHandler uwacErrorHandler = uwac_default_error_handler
 
struct wl_shm_listener shm_listener
 
static const struct xdg_shell_listener xdg_shell_listener
 
static const struct wl_registry_listener registry_listener
 
static const char * errorStrings []
 

Macro Definition Documentation

#define TARGET_COMPOSITOR_INTERFACE   3
#define TARGET_DDM_INTERFACE   1
#define TARGET_SEAT_INTERFACE   5
#define TARGET_SHELL_INTERFACE   1
#define TARGET_SHM_INTERFACE   1
#define TARGET_XDG_VERSION   5 /* The version of xdg-shell that we implement */

Function Documentation

static void cb_shm_format ( void data,
struct wl_shm *  wl_shm,
uint32_t  format 
)
static

Here is the call graph for this function:

void* display_bind ( UwacDisplay *  display,
uint32_t  name,
const struct wl_interface *  interface,
uint32_t  version 
)
static void display_destroy_seat ( UwacDisplay *  d,
uint32_t  name 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void display_dispatch_events ( UwacTask *  task,
uint32_t  events 
)
static

Here is the call graph for this function:

Here is the caller graph for this function:

static void display_exit ( UwacDisplay *  display)
static

Here is the caller graph for this function:

static void registry_handle_global ( void data,
struct wl_registry *  registry,
uint32_t  id,
const char *  interface,
uint32_t  version 
)
static

Here is the call graph for this function:

static void registry_handle_global_remove ( void data,
struct wl_registry *  registry,
uint32_t  name 
)
static

Here is the call graph for this function:

bool uwac_default_error_handler ( UwacDisplay *  display,
UwacReturnCode  code,
const char *  msg,
  ... 
)

Here is the caller graph for this function:

UwacReturnCode UwacCloseDisplay ( UwacDisplay **  pdisplay)

closes the corresponding UwacDisplay

Parameters
pdisplaya pointer on the display to close
Returns
UWAC_SUCCESS if the operation was successful, the corresponding error otherwise

Here is the call graph for this function:

Here is the caller graph for this function:

void UwacDestroyGlobal ( UwacGlobal *  global)

Here is the caller graph for this function:

int UwacDisplayDispatch ( UwacDisplay *  display,
int  timeout 
)
Parameters
display
timeout
Returns

Here is the caller graph for this function:

int UwacDisplayGetFd ( UwacDisplay *  display)

Returns the file descriptor associated with the UwacDisplay, this is useful when you want to poll that file descriptor for activity.

Parameters
displayan opened UwacDisplay
Returns
the corresponding descriptor

Here is the caller graph for this function:

UwacReturnCode UwacDisplayGetLastError ( const UwacDisplay *  display)

returns the last error that occurred on a display

Parameters
displaythe display
Returns
the last error that have been set for this display
uint32_t UwacDisplayGetNbOutputs ( UwacDisplay *  display)

returns the number of registered outputs

Parameters
displaythe display to query
Returns
the number of outputs
UwacOutput* UwacDisplayGetOutput ( UwacDisplay *  display,
int  index 
)

retrieve a particular UwacOutput object

Parameters
displaythe display to query
indexindex of the output
Returns
the given UwacOutput, NULL if something failed (so you should query UwacDisplayGetLastError() to have the reason)

Here is the caller graph for this function:

UwacEvent* UwacDisplayNewEvent ( UwacDisplay *  display,
int  type 
)

Here is the call graph for this function:

Here is the caller graph for this function:

uint32_t UwacDisplayQueryGetNbShmFormats ( UwacDisplay *  display)

returns the number SHM formats that have been reported by the compositor

Parameters
displaya connected UwacDisplay
Returns
the number of SHM formats supported
UwacReturnCode UwacDisplayQueryInterfaceVersion ( const UwacDisplay *  display,
const char *  name,
uint32_t *  version 
)

retrieves the version of a given interface

Parameters
displaythe display connection
namethe name of the interface
versionthe output variable for the version
Returns
UWAC_SUCCESS if the interface was found, UWAC_NOT_FOUND otherwise
UwacReturnCode UwacDisplayQueryShmFormats ( const UwacDisplay *  display,
enum wl_shm_format *  formats,
int  formats_size,
int *  filled 
)

returns the supported ShmFormats

Parameters
displaya connected UwacDisplay
formatsa pointer on an array of wl_shm_format with enough place for formats_size items
formats_sizethe size of the formats array
filledthe number of filled entries in the formats array
Returns
UWAC_SUCCESS on success, an error otherwise

Here is the call graph for this function:

void UwacDisplayUnwatchFd ( UwacDisplay *  display,
int  fd 
)
int UwacDisplayWatchFd ( UwacDisplay *  display,
int  fd,
uint32_t  events,
UwacTask *  task 
)

Here is the caller graph for this function:

const char* UwacErrorString ( UwacReturnCode  error)

Returns a human readable form of a Uwac error code

Parameters
errorthe error number
Returns
the associated string
bool UwacHasEvent ( UwacDisplay *  display)

Returns if you have some pending events, and you can UwacNextEvent() without blocking

Parameters
displaythe UwacDisplay
Returns
if there's some pending events

Here is the caller graph for this function:

void UwacInstallErrorHandler ( UwacErrorHandler  handler)

install a handler that will be called when UWAC encounter internal errors. The handler is supposed to answer if the execution can continue. I can also be used to log things.

Parameters
handler

Here is the call graph for this function:

UwacReturnCode UwacNextEvent ( UwacDisplay *  display,
UwacEvent *  event 
)

Waits until an event occurs, and when it's there copy the event from the queue to event.

Parameters
displaythe Uwac display
eventthe event to fill
Returns
if the operation completed successfully

Here is the call graph for this function:

Here is the caller graph for this function:

UwacDisplay* UwacOpenDisplay ( const char *  name,
UwacReturnCode err 
)

Opens the corresponding wayland display, using NULL you will open the default display.

Parameters
namethe name of the display to open
Returns
the created UwacDisplay object

Here is the call graph for this function:

Here is the caller graph for this function:

UwacReturnCode UwacOutputGetResolution ( UwacOutput *  output,
UwacSize *  resolution 
)

retrieve the resolution of a given UwacOutput

Parameters
outputthe UwacOutput
resolutiona pointer on the
Returns
UWAC_SUCCESS on success

Here is the caller graph for this function:

static void xdg_shell_ping ( void data,
struct xdg_shell *  shell,
uint32_t  serial 
)
static

Variable Documentation

const char* errorStrings[]
static
Initial value:
=
{
"success",
"out of memory error",
"unable to connect to wayland display",
"invalid UWAC display",
"not enough resources",
"timed out",
"not found",
"closed connection",
"internal error",
}
const char* event_names[]
static
Initial value:
=
{
"new seat",
"removed seat",
"new output",
"configure",
"pointer enter",
"pointer leave",
"pointer motion",
"pointer buttons",
"pointer axis",
"keyboard enter",
"key",
"touch frame begin",
"touch up",
"touch down",
"touch motion",
"touch cancel",
"touch frame end",
"frame done",
"close",
}
if availableBytes return NULL
Definition: TPCircularBuffer.h:104
const struct wl_registry_listener registry_listener
static
Initial value:
=
{
}
static void registry_handle_global(void *data, struct wl_registry *registry, uint32_t id, const char *interface, uint32_t version)
Definition: uwac-display.c:141
static void registry_handle_global_remove(void *data, struct wl_registry *registry, uint32_t name)
Definition: uwac-display.c:246
struct wl_shm_listener shm_listener
Initial value:
=
{
}
static void cb_shm_format(void *data, struct wl_shm *wl_shm, uint32_t format)
Definition: uwac-display.c:88
const struct xdg_shell_listener xdg_shell_listener
static
Initial value:
=
{
}
static void xdg_shell_ping(void *data, struct xdg_shell *shell, uint32_t serial)
Definition: uwac-display.c:106