FreeRDP
uwac-window.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <assert.h>
#include <sys/mman.h>
#include <errno.h>
#include "uwac-priv.h"
#include "uwac-utils.h"
#include "uwac-os.h"
#include <uwac/config.h>

Macros

#define UWAC_INITIAL_BUFFERS   3
 

Functions

static int bppFromShmFormat (enum wl_shm_format format)
 
static void buffer_release (void *data, struct wl_buffer *buffer)
 
static void UwacWindowDestroyBuffers (UwacWindow *w)
 
static int UwacWindowShmAllocBuffers (UwacWindow *w, int nbuffers, int allocSize, uint32_t width, uint32_t height, enum wl_shm_format format)
 
static void xdg_handle_toplevel_configure (void *data, struct xdg_toplevel *xdg_toplevel, int32_t width, int32_t height, struct wl_array *states)
 
static void xdg_handle_toplevel_close (void *data, struct xdg_toplevel *xdg_toplevel)
 
static void xdg_handle_surface_configure (void *data, struct xdg_surface *xdg_surface, uint32_t serial)
 
static void shell_ping (void *data, struct wl_shell_surface *surface, uint32_t serial)
 
static void shell_configure (void *data, struct wl_shell_surface *surface, uint32_t edges, int32_t width, int32_t height)
 
static void shell_popup_done (void *data, struct wl_shell_surface *surface)
 
static UwacBuffer * UwacWindowFindFreeBuffer (UwacWindow *w, ssize_t *index)
 
static UwacReturnCode UwacWindowSetDecorations (UwacWindow *w)
 
UwacWindow * UwacCreateWindowShm (UwacDisplay *display, uint32_t width, uint32_t height, enum wl_shm_format format)
 
UwacReturnCode UwacDestroyWindow (UwacWindow **pwindow)
 
UwacReturnCode UwacWindowSetOpaqueRegion (UwacWindow *window, uint32_t x, uint32_t y, uint32_t width, uint32_t height)
 
UwacReturnCode UwacWindowSetInputRegion (UwacWindow *window, uint32_t x, uint32_t y, uint32_t width, uint32_t height)
 
void * UwacWindowGetDrawingBuffer (UwacWindow *window)
 
static void frame_done_cb (void *data, struct wl_callback *callback, uint32_t time)
 
static void damage_surface (UwacWindow *window, UwacBuffer *buffer, int scale)
 
static void UwacSubmitBufferPtr (UwacWindow *window, UwacBuffer *buffer)
 
UwacReturnCode UwacWindowAddDamage (UwacWindow *window, uint32_t x, uint32_t y, uint32_t width, uint32_t height)
 
UwacReturnCode UwacWindowGetDrawingBufferGeometry (UwacWindow *window, UwacSize *geometry, size_t *stride)
 
UwacReturnCode UwacWindowSubmitBuffer (UwacWindow *window, bool copyContentForNextFrame)
 
UwacReturnCode UwacWindowGetGeometry (UwacWindow *window, UwacSize *geometry)
 
UwacReturnCode UwacWindowSetFullscreenState (UwacWindow *window, UwacOutput *output, bool isFullscreen)
 
void UwacWindowSetTitle (UwacWindow *window, const char *name)
 
void UwacWindowSetAppId (UwacWindow *window, const char *app_id)
 

Variables

static const struct wl_buffer_listener buffer_listener = { buffer_release }
 
static const struct xdg_toplevel_listener xdg_toplevel_listener
 
static const struct xdg_surface_listener xdg_surface_listener
 
static const struct wl_shell_surface_listener shell_listener
 
static const struct wl_callback_listener frame_listener = { frame_done_cb }
 

Macro Definition Documentation

◆ UWAC_INITIAL_BUFFERS

#define UWAC_INITIAL_BUFFERS   3

Function Documentation

◆ bppFromShmFormat()

static int bppFromShmFormat ( enum wl_shm_format  format)
static
Here is the caller graph for this function:

◆ buffer_release()

static void buffer_release ( void *  data,
struct wl_buffer *  buffer 
)
static

◆ damage_surface()

static void damage_surface ( UwacWindow *  window,
UwacBuffer *  buffer,
int  scale 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ frame_done_cb()

static void frame_done_cb ( void *  data,
struct wl_callback *  callback,
uint32_t  time 
)
static
Here is the call graph for this function:

◆ shell_configure()

static void shell_configure ( void *  data,
struct wl_shell_surface *  surface,
uint32_t  edges,
int32_t  width,
int32_t  height 
)
static
Here is the call graph for this function:

◆ shell_ping()

static void shell_ping ( void *  data,
struct wl_shell_surface *  surface,
uint32_t  serial 
)
static

◆ shell_popup_done()

static void shell_popup_done ( void *  data,
struct wl_shell_surface *  surface 
)
static

◆ UwacCreateWindowShm()

UwacWindow* UwacCreateWindowShm ( UwacDisplay *  display,
uint32_t  width,
uint32_t  height,
enum wl_shm_format  format 
)
    creates a window using a SHM surface
Parameters
displaythe display to attach the window to
widththe width of the window
heightthe heigh of the window
formatformat to use for the SHM surface
Returns
the created UwacWindow, NULL if something failed (use UwacDisplayGetLastError() to know more about this)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UwacDestroyWindow()

UwacReturnCode UwacDestroyWindow ( UwacWindow **  window)
 destroys the corresponding UwacWindow
Parameters
windowa pointer on the UwacWindow to destroy
Returns
if the operation completed successfully
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UwacSubmitBufferPtr()

static void UwacSubmitBufferPtr ( UwacWindow *  window,
UwacBuffer *  buffer 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UwacWindowAddDamage()

UwacReturnCode UwacWindowAddDamage ( UwacWindow *  window,
uint32_t  x,
uint32_t  y,
uint32_t  width,
uint32_t  height 
)
 sets a rectangle as dirty for the next frame of a window
Parameters
windowthe UwacWindow
xleft coordinate
ytop coordinate
widththe width of the dirty rectangle
heightthe height of the dirty rectangle
Returns
UWAC_SUCCESS on success, an Uwac error otherwise
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UwacWindowDestroyBuffers()

static void UwacWindowDestroyBuffers ( UwacWindow *  w)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UwacWindowFindFreeBuffer()

static UwacBuffer* UwacWindowFindFreeBuffer ( UwacWindow *  w,
ssize_t *  index 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UwacWindowGetDrawingBuffer()

void* UwacWindowGetDrawingBuffer ( UwacWindow *  window)
 retrieves a pointer on the current window content to draw a frame
Parameters
windowthe UwacWindow
Returns
a pointer on the current window content
Here is the caller graph for this function:

◆ UwacWindowGetDrawingBufferGeometry()

UwacReturnCode UwacWindowGetDrawingBufferGeometry ( UwacWindow *  window,
UwacSize *  geometry,
size_t *  stride 
)
 returns the geometry of the given UwacWindow buffer
Parameters
windowthe UwacWindow
geometrythe geometry to fill
stridethe length of a buffer line in bytes
Returns
UWAC_SUCCESS on success, an Uwac error otherwise
Here is the caller graph for this function:

◆ UwacWindowGetGeometry()

UwacReturnCode UwacWindowGetGeometry ( UwacWindow *  window,
UwacSize *  geometry 
)
 returns the geometry of the given UwacWindows
Parameters
windowthe UwacWindow
geometrythe geometry to fill
Returns
UWAC_SUCCESS on success, an Uwac error otherwise

◆ UwacWindowSetAppId()

void UwacWindowSetAppId ( UwacWindow *  window,
const char *  app_id 
)
 Sets the app id of the UwacWindow
Parameters
windowthe UwacWindow
app_idapp id
Here is the caller graph for this function:

◆ UwacWindowSetDecorations()

static UwacReturnCode UwacWindowSetDecorations ( UwacWindow *  w)
static
Here is the caller graph for this function:

◆ UwacWindowSetFullscreenState()

UwacReturnCode UwacWindowSetFullscreenState ( UwacWindow *  window,
UwacOutput *  output,
bool  isFullscreen 
)
 Sets or unset the fact that the window is set fullscreen. After this call the
 application should get prepared to receive a configure event. The output is used
 only when going fullscreen, it is optional and not used when exiting fullscreen.
Parameters
windowthe UwacWindow
outputan optional UwacOutput to put the window fullscreen on
isFullscreenset or unset fullscreen
Returns
UWAC_SUCCESS if the operation was a success
Here is the caller graph for this function:

◆ UwacWindowSetInputRegion()

UwacReturnCode UwacWindowSetInputRegion ( UwacWindow *  window,
uint32_t  x,
uint32_t  y,
uint32_t  width,
uint32_t  height 
)
 Sets the region of the window that can trigger input events
Parameters
windowthe UwacWindow
xThe horizontal coordinate in pixels
yThe vertical coordinate in pixels
widthThe width of the region
heightThe height of the region
Returns
UWAC_SUCCESS on success, an error otherwise

◆ UwacWindowSetOpaqueRegion()

UwacReturnCode UwacWindowSetOpaqueRegion ( UwacWindow *  window,
uint32_t  x,
uint32_t  y,
uint32_t  width,
uint32_t  height 
)
 Sets the region that should be considered opaque to the compositor.
Parameters
windowthe UwacWindow
xThe horizontal coordinate in pixels
yThe vertical coordinate in pixels
widthThe width of the region
heightThe height of the region
Returns
UWAC_SUCCESS on success, an error otherwise
Here is the caller graph for this function:

◆ UwacWindowSetTitle()

void UwacWindowSetTitle ( UwacWindow *  window,
const char *  name 
)
 When possible (depending on the shell) sets the title of the UwacWindow
Parameters
windowthe UwacWindow
nametitle
Here is the caller graph for this function:

◆ UwacWindowShmAllocBuffers()

int UwacWindowShmAllocBuffers ( UwacWindow *  w,
int  nbuffers,
int  allocSize,
uint32_t  width,
uint32_t  height,
enum wl_shm_format  format 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UwacWindowSubmitBuffer()

UwacReturnCode UwacWindowSubmitBuffer ( UwacWindow *  window,
bool  copyContentForNextFrame 
)
    Sends a frame to the compositor with the content of the drawing buffer
Parameters
windowthe UwacWindow to refresh
copyContentForNextFrameif true the content to display is copied in the next drawing buffer
Returns
UWAC_SUCCESS if the operation was successful
Here is the call graph for this function:
Here is the caller graph for this function:

◆ xdg_handle_surface_configure()

static void xdg_handle_surface_configure ( void *  data,
struct xdg_surface *  xdg_surface,
uint32_t  serial 
)
static

◆ xdg_handle_toplevel_close()

static void xdg_handle_toplevel_close ( void *  data,
struct xdg_toplevel *  xdg_toplevel 
)
static
Here is the call graph for this function:

◆ xdg_handle_toplevel_configure()

static void xdg_handle_toplevel_configure ( void *  data,
struct xdg_toplevel *  xdg_toplevel,
int32_t  width,
int32_t  height,
struct wl_array *  states 
)
static
Here is the call graph for this function:

Variable Documentation

◆ buffer_listener

const struct wl_buffer_listener buffer_listener = { buffer_release }
static

◆ frame_listener

const struct wl_callback_listener frame_listener = { frame_done_cb }
static

◆ shell_listener

const struct wl_shell_surface_listener shell_listener
static
Initial value:
static void shell_configure(void *data, struct wl_shell_surface *surface, uint32_t edges, int32_t width, int32_t height)
Definition: uwac-window.c:263
static void shell_popup_done(void *data, struct wl_shell_surface *surface)
Definition: uwac-window.c:311
static void shell_ping(void *data, struct wl_shell_surface *surface, uint32_t serial)
Definition: uwac-window.c:258

◆ xdg_surface_listener

const struct xdg_surface_listener xdg_surface_listener
static
Initial value:
= {
}
static void xdg_handle_surface_configure(void *data, struct xdg_surface *xdg_surface, uint32_t serial)
Definition: uwac-window.c:193

◆ xdg_toplevel_listener

const struct xdg_toplevel_listener xdg_toplevel_listener
static
Initial value:
= {
}
static void xdg_handle_toplevel_configure(void *data, struct xdg_toplevel *xdg_toplevel, int32_t width, int32_t height, struct wl_array *states)
Definition: uwac-window.c:84
static void xdg_handle_toplevel_close(void *data, struct xdg_toplevel *xdg_toplevel)
Definition: uwac-window.c:172