FreeRDP
uwac-input.c File Reference
#include "uwac-priv.h"
#include "uwac-utils.h"
#include <stdio.h>
#include <inttypes.h>
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <assert.h>
#include <errno.h>
#include <time.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/timerfd.h>
#include <sys/epoll.h>
#include "uwac-os.h"
#include "wayland-cursor.h"
#include "wayland-client-protocol.h"

Functions

static struct wl_buffer * create_pointer_buffer (UwacSeat *seat, const void *src, size_t size)
 
static void on_buffer_release (void *data, struct wl_buffer *wl_buffer)
 
static UwacReturnCode set_cursor_image (UwacSeat *seat, uint32_t serial)
 
static void keyboard_repeat_func (UwacTask *task, uint32_t events)
 
static void keyboard_handle_keymap (void *data, struct wl_keyboard *keyboard, uint32_t format, int fd, uint32_t size)
 
static void keyboard_handle_key (void *data, struct wl_keyboard *keyboard, uint32_t serial, uint32_t time, uint32_t key, uint32_t state_w)
 
static void keyboard_handle_enter (void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface, struct wl_array *keys)
 
static void keyboard_handle_leave (void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface)
 
static int update_key_pressed (UwacSeat *seat, uint32_t key)
 
static int update_key_released (UwacSeat *seat, uint32_t key)
 
static void keyboard_handle_modifiers (void *data, struct wl_keyboard *keyboard, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group)
 
static void set_repeat_info (UwacSeat *input, int32_t rate, int32_t delay)
 
static void keyboard_handle_repeat_info (void *data, struct wl_keyboard *keyboard, int32_t rate, int32_t delay)
 
static bool touch_send_start_frame (UwacSeat *seat)
 
static void touch_handle_down (void *data, struct wl_touch *wl_touch, uint32_t serial, uint32_t time, struct wl_surface *surface, int32_t id, wl_fixed_t x_w, wl_fixed_t y_w)
 
static void touch_handle_up (void *data, struct wl_touch *wl_touch, uint32_t serial, uint32_t time, int32_t id)
 
static void touch_handle_motion (void *data, struct wl_touch *wl_touch, uint32_t time, int32_t id, wl_fixed_t x_w, wl_fixed_t y_w)
 
static void touch_handle_frame (void *data, struct wl_touch *wl_touch)
 
static void touch_handle_cancel (void *data, struct wl_touch *wl_touch)
 
static void touch_handle_shape (void *data, struct wl_touch *wl_touch, int32_t id, wl_fixed_t major, wl_fixed_t minor)
 
static void touch_handle_orientation (void *data, struct wl_touch *wl_touch, int32_t id, wl_fixed_t orientation)
 
static void pointer_handle_enter (void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface, wl_fixed_t sx_w, wl_fixed_t sy_w)
 
static void pointer_handle_leave (void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface)
 
static void pointer_handle_motion (void *data, struct wl_pointer *pointer, uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w)
 
static void pointer_handle_button (void *data, struct wl_pointer *pointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state_w)
 
static void pointer_handle_axis (void *data, struct wl_pointer *pointer, uint32_t time, uint32_t axis, wl_fixed_t value)
 
static void pointer_frame (void *data, struct wl_pointer *wl_pointer)
 
static void pointer_axis_source (void *data, struct wl_pointer *wl_pointer, uint32_t axis_source)
 
static void pointer_axis_stop (void *data, struct wl_pointer *wl_pointer, uint32_t time, uint32_t axis)
 
static void pointer_axis_discrete (void *data, struct wl_pointer *wl_pointer, uint32_t axis, int32_t discrete)
 
static void pointer_axis_value120 (void *data, struct wl_pointer *wl_pointer, uint32_t axis, int32_t value120)
 
static void seat_handle_capabilities (void *data, struct wl_seat *seat, enum wl_seat_capability caps)
 
static void seat_handle_name (void *data, struct wl_seat *seat, const char *name)
 
UwacSeat * UwacSeatNew (UwacDisplay *d, uint32_t id, uint32_t version)
 
void UwacSeatDestroy (UwacSeat *s)
 
const char * UwacSeatGetName (const UwacSeat *seat)
 
UwacSeatId UwacSeatGetId (const UwacSeat *seat)
 
UwacReturnCode UwacSeatInhibitShortcuts (UwacSeat *s, bool inhibit)
 
UwacReturnCode UwacSeatSetMouseCursor (UwacSeat *seat, const void *data, size_t length, size_t width, size_t height, size_t hot_x, size_t hot_y)
 UwacSeatSetMouseCursor Sets the specified image as the new mouse cursor. Special values: If data == NULL && lenght == 0 the cursor is hidden, if data == NULL && length != 0 the default system cursor is used. More...
 

Variables

static const struct wl_buffer_listener buffer_release_listener = { on_buffer_release }
 
static const struct wl_keyboard_listener keyboard_listener
 
static const struct wl_touch_listener touch_listener
 
static const struct wl_pointer_listener pointer_listener
 
static const struct wl_seat_listener seat_listener = { seat_handle_capabilities, seat_handle_name }
 

Function Documentation

◆ create_pointer_buffer()

static struct wl_buffer* create_pointer_buffer ( UwacSeat *  seat,
const void *  src,
size_t  size 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ keyboard_handle_enter()

static void keyboard_handle_enter ( void *  data,
struct wl_keyboard *  keyboard,
uint32_t  serial,
struct wl_surface *  surface,
struct wl_array *  keys 
)
static
Here is the call graph for this function:

◆ keyboard_handle_key()

static void keyboard_handle_key ( void *  data,
struct wl_keyboard *  keyboard,
uint32_t  serial,
uint32_t  time,
uint32_t  key,
uint32_t  state_w 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ keyboard_handle_keymap()

static void keyboard_handle_keymap ( void *  data,
struct wl_keyboard *  keyboard,
uint32_t  format,
int  fd,
uint32_t  size 
)
static

◆ keyboard_handle_leave()

static void keyboard_handle_leave ( void *  data,
struct wl_keyboard *  keyboard,
uint32_t  serial,
struct wl_surface *  surface 
)
static
Here is the call graph for this function:

◆ keyboard_handle_modifiers()

static void keyboard_handle_modifiers ( void *  data,
struct wl_keyboard *  keyboard,
uint32_t  serial,
uint32_t  mods_depressed,
uint32_t  mods_latched,
uint32_t  mods_locked,
uint32_t  group 
)
static
Here is the call graph for this function:

◆ keyboard_handle_repeat_info()

static void keyboard_handle_repeat_info ( void *  data,
struct wl_keyboard *  keyboard,
int32_t  rate,
int32_t  delay 
)
static
Here is the call graph for this function:

◆ keyboard_repeat_func()

static void keyboard_repeat_func ( UwacTask *  task,
uint32_t  events 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ on_buffer_release()

static void on_buffer_release ( void *  data,
struct wl_buffer *  wl_buffer 
)
static

◆ pointer_axis_discrete()

static void pointer_axis_discrete ( void *  data,
struct wl_pointer *  wl_pointer,
uint32_t  axis,
int32_t  discrete 
)
static
Here is the call graph for this function:

◆ pointer_axis_source()

static void pointer_axis_source ( void *  data,
struct wl_pointer *  wl_pointer,
uint32_t  axis_source 
)
static
Here is the call graph for this function:

◆ pointer_axis_stop()

static void pointer_axis_stop ( void *  data,
struct wl_pointer *  wl_pointer,
uint32_t  time,
uint32_t  axis 
)
static

◆ pointer_axis_value120()

static void pointer_axis_value120 ( void *  data,
struct wl_pointer *  wl_pointer,
uint32_t  axis,
int32_t  value120 
)
static
Here is the call graph for this function:

◆ pointer_frame()

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

◆ pointer_handle_axis()

static void pointer_handle_axis ( void *  data,
struct wl_pointer *  pointer,
uint32_t  time,
uint32_t  axis,
wl_fixed_t  value 
)
static
Here is the call graph for this function:

◆ pointer_handle_button()

static void pointer_handle_button ( void *  data,
struct wl_pointer *  pointer,
uint32_t  serial,
uint32_t  time,
uint32_t  button,
uint32_t  state_w 
)
static
Here is the call graph for this function:

◆ pointer_handle_enter()

static void pointer_handle_enter ( void *  data,
struct wl_pointer *  pointer,
uint32_t  serial,
struct wl_surface *  surface,
wl_fixed_t  sx_w,
wl_fixed_t  sy_w 
)
static
Here is the call graph for this function:

◆ pointer_handle_leave()

static void pointer_handle_leave ( void *  data,
struct wl_pointer *  pointer,
uint32_t  serial,
struct wl_surface *  surface 
)
static
Here is the call graph for this function:

◆ pointer_handle_motion()

static void pointer_handle_motion ( void *  data,
struct wl_pointer *  pointer,
uint32_t  time,
wl_fixed_t  sx_w,
wl_fixed_t  sy_w 
)
static
Here is the call graph for this function:

◆ seat_handle_capabilities()

static void seat_handle_capabilities ( void *  data,
struct wl_seat *  seat,
enum wl_seat_capability  caps 
)
static

◆ seat_handle_name()

static void seat_handle_name ( void *  data,
struct wl_seat *  seat,
const char *  name 
)
static
Here is the call graph for this function:

◆ set_cursor_image()

static UwacReturnCode set_cursor_image ( UwacSeat *  seat,
uint32_t  serial 
)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ set_repeat_info()

static void set_repeat_info ( UwacSeat *  input,
int32_t  rate,
int32_t  delay 
)
static
Here is the caller graph for this function:

◆ touch_handle_cancel()

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

◆ touch_handle_down()

static void touch_handle_down ( void *  data,
struct wl_touch *  wl_touch,
uint32_t  serial,
uint32_t  time,
struct wl_surface *  surface,
int32_t  id,
wl_fixed_t  x_w,
wl_fixed_t  y_w 
)
static
Here is the call graph for this function:

◆ touch_handle_frame()

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

◆ touch_handle_motion()

static void touch_handle_motion ( void *  data,
struct wl_touch *  wl_touch,
uint32_t  time,
int32_t  id,
wl_fixed_t  x_w,
wl_fixed_t  y_w 
)
static
Here is the call graph for this function:

◆ touch_handle_orientation()

static void touch_handle_orientation ( void *  data,
struct wl_touch *  wl_touch,
int32_t  id,
wl_fixed_t  orientation 
)
static

◆ touch_handle_shape()

static void touch_handle_shape ( void *  data,
struct wl_touch *  wl_touch,
int32_t  id,
wl_fixed_t  major,
wl_fixed_t  minor 
)
static

◆ touch_handle_up()

static void touch_handle_up ( void *  data,
struct wl_touch *  wl_touch,
uint32_t  serial,
uint32_t  time,
int32_t  id 
)
static
Here is the call graph for this function:

◆ touch_send_start_frame()

static bool touch_send_start_frame ( UwacSeat *  seat)
static
Here is the call graph for this function:
Here is the caller graph for this function:

◆ update_key_pressed()

static int update_key_pressed ( UwacSeat *  seat,
uint32_t  key 
)
static
Here is the caller graph for this function:

◆ update_key_released()

static int update_key_released ( UwacSeat *  seat,
uint32_t  key 
)
static
Here is the caller graph for this function:

◆ UwacSeatDestroy()

void UwacSeatDestroy ( UwacSeat *  s)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UwacSeatGetId()

UwacSeatId UwacSeatGetId ( const UwacSeat *  seat)

returns the id of the given UwacSeat

Parameters
seatthe UwacSeat
Returns
the id of the seat

◆ UwacSeatGetName()

const char* UwacSeatGetName ( const UwacSeat *  seat)

returns the name of the given UwacSeat

Parameters
seatthe UwacSeat
Returns
the name of the seat

◆ UwacSeatInhibitShortcuts()

UwacReturnCode UwacSeatInhibitShortcuts ( UwacSeat *  seat,
bool  inhibit 
)

Inhibits or restores keyboard shortcuts.

Parameters
seatThe UwacSeat to inhibit the shortcuts for
inhibitInhibit or restore keyboard shortcuts
Returns
UWAC_SUCCESS or an appropriate error code.
Here is the caller graph for this function:

◆ UwacSeatNew()

UwacSeat* UwacSeatNew ( UwacDisplay *  d,
uint32_t  id,
uint32_t  version 
)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ UwacSeatSetMouseCursor()

UwacReturnCode UwacSeatSetMouseCursor ( UwacSeat *  seat,
const void *  data,
size_t  length,
size_t  width,
size_t  height,
size_t  hot_x,
size_t  hot_y 
)

UwacSeatSetMouseCursor Sets the specified image as the new mouse cursor. Special values: If data == NULL && lenght == 0 the cursor is hidden, if data == NULL && length != 0 the default system cursor is used.

Parameters
seatThe UwacSeat to apply the cursor image to
dataA pointer to the image data
lengthThe size of the image data
widthThe image width in pixel
heightThe image height in pixel
hot_xThe hotspot horizontal offset in pixel
hot_yThe hotspot vertical offset in pixel
Returns
UWAC_SUCCESS if successful, an appropriate error otherwise.
Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ buffer_release_listener

const struct wl_buffer_listener buffer_release_listener = { on_buffer_release }
static

◆ keyboard_listener

const struct wl_keyboard_listener keyboard_listener
static
Initial value:
= {
}
static void keyboard_handle_modifiers(void *data, struct wl_keyboard *keyboard, uint32_t serial, uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked, uint32_t group)
Definition: uwac-input.c:429
static void keyboard_handle_keymap(void *data, struct wl_keyboard *keyboard, uint32_t format, int fd, uint32_t size)
Definition: uwac-input.c:184
static void keyboard_handle_enter(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface, struct wl_array *keys)
Definition: uwac-input.c:249
static void keyboard_handle_key(void *data, struct wl_keyboard *keyboard, uint32_t serial, uint32_t time, uint32_t key, uint32_t state_w)
Definition: uwac-input.c:357
static void keyboard_handle_leave(void *data, struct wl_keyboard *keyboard, uint32_t serial, struct wl_surface *surface)
Definition: uwac-input.c:273
static void keyboard_handle_repeat_info(void *data, struct wl_keyboard *keyboard, int32_t rate, int32_t delay)
Definition: uwac-input.c:489

◆ pointer_listener

const struct wl_pointer_listener pointer_listener
static
Initial value:
= {
}
static void pointer_frame(void *data, struct wl_pointer *wl_pointer)
Definition: uwac-input.c:892
static void pointer_handle_enter(void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface, wl_fixed_t sx_w, wl_fixed_t sy_w)
Definition: uwac-input.c:751
static void pointer_axis_stop(void *data, struct wl_pointer *wl_pointer, uint32_t time, uint32_t axis)
Definition: uwac-input.c:931
static void pointer_handle_leave(void *data, struct wl_pointer *pointer, uint32_t serial, struct wl_surface *surface)
Definition: uwac-input.c:792
static void pointer_axis_discrete(void *data, struct wl_pointer *wl_pointer, uint32_t axis, int32_t discrete)
Definition: uwac-input.c:938
static void pointer_handle_axis(void *data, struct wl_pointer *pointer, uint32_t time, uint32_t axis, wl_fixed_t value)
Definition: uwac-input.c:868
static void pointer_handle_motion(void *data, struct wl_pointer *pointer, uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w)
Definition: uwac-input.c:813
static void pointer_handle_button(void *data, struct wl_pointer *pointer, uint32_t serial, uint32_t time, uint32_t button, uint32_t state_w)
Definition: uwac-input.c:845
static void pointer_axis_value120(void *data, struct wl_pointer *wl_pointer, uint32_t axis, int32_t value120)
Definition: uwac-input.c:964
static void pointer_axis_source(void *data, struct wl_pointer *wl_pointer, uint32_t axis_source)
Definition: uwac-input.c:911

◆ seat_listener

const struct wl_seat_listener seat_listener = { seat_handle_capabilities, seat_handle_name }
static

◆ touch_listener

const struct wl_touch_listener touch_listener
static
Initial value:
= {
}
static void touch_handle_down(void *data, struct wl_touch *wl_touch, uint32_t serial, uint32_t time, struct wl_surface *surface, int32_t id, wl_fixed_t x_w, wl_fixed_t y_w)
Definition: uwac-input.c:516
static void touch_handle_orientation(void *data, struct wl_touch *wl_touch, int32_t id, wl_fixed_t orientation)
Definition: uwac-input.c:737
static void touch_handle_frame(void *data, struct wl_touch *wl_touch)
Definition: uwac-input.c:680
static void touch_handle_cancel(void *data, struct wl_touch *wl_touch)
Definition: uwac-input.c:694
static void touch_handle_motion(void *data, struct wl_touch *wl_touch, uint32_t time, int32_t id, wl_fixed_t x_w, wl_fixed_t y_w)
Definition: uwac-input.c:629
static void touch_handle_shape(void *data, struct wl_touch *wl_touch, int32_t id, wl_fixed_t major, wl_fixed_t minor)
Definition: uwac-input.c:728
static void touch_handle_up(void *data, struct wl_touch *wl_touch, uint32_t serial, uint32_t time, int32_t id)
Definition: uwac-input.c:586